@livechat/design-system-react-components 1.0.0-alpha.9 → 1.0.0-y.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/dist/dsrc.cjs.js +15 -1
- package/dist/dsrc.es.js +3158 -971
- package/dist/dsrc.umd.js +15 -1
- package/dist/shadow/shadow.css +7 -0
- package/dist/shadow/shadow.css.map +1 -0
- package/dist/shadow/spacing.css +18 -0
- package/dist/shadow/spacing.css.map +1 -0
- package/dist/spacing/shadow.css +7 -0
- package/dist/spacing/shadow.css.map +1 -0
- package/dist/spacing/spacing.css +18 -0
- package/dist/spacing/spacing.css.map +1 -0
- package/dist/src/components/Alert/Alert.d.ts +3 -7
- package/dist/src/components/Avatar/Avatar.d.ts +19 -0
- package/dist/src/components/Avatar/Avatar.helpers.d.ts +2 -0
- package/dist/src/components/Avatar/index.d.ts +1 -0
- package/dist/src/components/Badge/Badge.d.ts +6 -2
- package/dist/src/components/Badge/Badge.helpers.d.ts +1 -0
- package/dist/src/components/Button/Button.d.ts +4 -3
- package/dist/src/components/Button/index.d.ts +1 -1
- package/dist/src/components/Card/Card.d.ts +8 -2
- package/dist/src/components/Checkbox/Checkbox.d.ts +3 -3
- package/dist/src/components/Checkbox/index.d.ts +0 -1
- package/dist/src/components/DatePicker/DatePicker.d.ts +4 -0
- package/dist/src/components/DatePicker/DatePickerNavbar.d.ts +4 -0
- package/dist/src/components/DatePicker/RangeDatePicker.d.ts +16 -0
- package/dist/src/components/DatePicker/helpers.d.ts +39 -0
- package/dist/src/components/DatePicker/hooks.d.ts +6 -0
- package/dist/src/components/DatePicker/index.d.ts +2 -0
- package/dist/src/components/DatePicker/types.d.ts +100 -0
- package/dist/src/components/FileUploadProgress/FileUploadProgress.d.ts +15 -0
- package/dist/src/components/FileUploadProgress/FileUploadProgressActions.d.ts +9 -0
- package/dist/src/components/FileUploadProgress/index.d.ts +2 -0
- package/dist/src/components/{TextField/TextField.d.ts → FormField/FormField.d.ts} +2 -2
- package/dist/src/components/FormField/index.d.ts +1 -0
- package/dist/src/components/Icon/Icon.d.ts +6 -62
- package/dist/src/components/Icon/index.d.ts +1 -1
- package/dist/src/components/Input/Input.d.ts +14 -0
- package/dist/src/components/Input/index.d.ts +1 -0
- package/dist/src/components/Modal/Modal.d.ts +2 -0
- package/dist/src/components/Modal/ModalBase.d.ts +1 -0
- package/dist/src/components/Modal/ModalCloseButton.d.ts +4 -1
- package/dist/src/components/Modal/ModalPortal.d.ts +1 -1
- package/dist/src/components/Modal/index.d.ts +0 -2
- package/dist/src/components/NumericInput/index.d.ts +0 -1
- package/dist/src/components/Picker/Picker.d.ts +23 -0
- package/dist/src/components/Picker/PickerList.d.ts +23 -0
- package/dist/src/components/Picker/Trigger.d.ts +15 -0
- package/dist/src/components/Picker/TriggerBody.d.ts +16 -0
- package/dist/src/components/Picker/constants.d.ts +21 -0
- package/dist/src/components/Picker/index.d.ts +2 -0
- package/dist/src/components/Popover/Popover.d.ts +4 -7
- package/dist/src/components/Progress/ProgressBar.d.ts +9 -0
- package/dist/src/components/Progress/ProgressCircle.d.ts +1 -1
- package/dist/src/components/Progress/constants.d.ts +2 -10
- package/dist/src/components/Progress/index.d.ts +1 -0
- package/dist/src/components/PromoBanner/PromoBanner.d.ts +0 -6
- package/dist/src/components/RadioButton/RadioButton.d.ts +2 -2
- package/dist/src/components/Search/Search.d.ts +12 -0
- package/dist/src/components/Search/index.d.ts +1 -0
- package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +18 -0
- package/dist/src/components/SegmentedControl/index.d.ts +2 -0
- package/dist/src/components/Switch/Switch.d.ts +5 -8
- package/dist/src/components/Tab/Tab.d.ts +4 -1
- package/dist/src/components/Tag/Tag.d.ts +3 -1
- package/dist/src/components/TagInput/TagInput.d.ts +1 -0
- package/dist/src/components/Textarea/Textarea.d.ts +6 -0
- package/dist/src/components/Textarea/index.d.ts +1 -0
- package/dist/src/components/Toast/Toast.d.ts +7 -13
- package/dist/src/components/Toast/ToastWrapper.d.ts +2 -9
- package/dist/src/components/Tooltip/Info.d.ts +8 -0
- package/dist/src/components/Tooltip/Interactive.d.ts +14 -0
- package/dist/src/components/Tooltip/Simple.d.ts +4 -0
- package/dist/src/components/Tooltip/SpotlightOverlay.d.ts +7 -0
- package/dist/src/components/Tooltip/Tooltip.d.ts +22 -0
- package/dist/src/components/Tooltip/UserGuide.d.ts +12 -0
- package/dist/src/components/Tooltip/helpers.d.ts +2 -0
- package/dist/src/components/Tooltip/index.d.ts +5 -0
- package/dist/src/components/Tooltip/virtualElementReference.d.ts +9 -0
- package/dist/src/components/UploadBar/UploadBar.d.ts +16 -0
- package/dist/src/components/UploadBar/index.d.ts +1 -0
- package/dist/src/foundations/shadow-token.d.ts +5 -0
- package/dist/src/foundations/spacing-token.d.ts +16 -0
- package/dist/src/index.d.ts +16 -4
- package/dist/src/themes/{designTokens.d.ts → design-token.d.ts} +104 -4
- package/dist/src/utils/constants.d.ts +1 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/themes/dark.css +128 -21
- package/dist/themes/dark.css.map +1 -1
- package/dist/themes/legacy.css +116 -9
- package/dist/themes/legacy.css.map +1 -1
- package/dist/themes/light.css +116 -9
- package/dist/themes/light.css.map +1 -1
- package/package.json +21 -11
- package/dist/src/components/ButtonGroup/ButtonGroup.d.ts +0 -11
- package/dist/src/components/ButtonGroup/index.d.ts +0 -1
- package/dist/src/components/Checkbox/CheckboxField.d.ts +0 -7
- package/dist/src/components/InputField/InputField.d.ts +0 -15
- package/dist/src/components/InputField/index.d.ts +0 -1
- package/dist/src/components/Modal/ActionModal.d.ts +0 -8
- package/dist/src/components/NumericInput/NumericInputField.d.ts +0 -19
- package/dist/src/components/TextField/index.d.ts +0 -1
package/dist/dsrc.es.js
CHANGED
|
@@ -29,64 +29,163 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
+
var __publicField = (obj, key, value) => {
|
|
33
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
|
+
return value;
|
|
35
|
+
};
|
|
32
36
|
import * as React from "react";
|
|
37
|
+
import { useReducer, useRef, useEffect, useCallback, useMemo } from "react";
|
|
33
38
|
import cx from "clsx";
|
|
34
|
-
import { Info, Warning, CheckCircleSolid, Block,
|
|
35
|
-
import
|
|
36
|
-
import * as ReactDOM from "react-dom";
|
|
37
|
-
import { usePopper } from "react-popper";
|
|
39
|
+
import { Close, Info as Info$1, Warning, CheckCircleSolid, Block, Person, ChevronUp, ChevronDown, Check, DoubleArrowLeft, ChevronLeft, ChevronRight, DoubleArrowRight, VisibilityOn, VisibilityOff, Error as Error2, Search, LockBlack, Refresh } from "@livechat/design-system-icons/react/material";
|
|
40
|
+
import debounce from "lodash.debounce";
|
|
38
41
|
import { getContrast } from "polished";
|
|
42
|
+
import ReactDayPicker from "react-day-picker";
|
|
43
|
+
import { subMonths, differenceInCalendarMonths, addMonths, isSameMonth, isSameDay, isAfter, differenceInCalendarDays } from "date-fns";
|
|
44
|
+
import * as ReactDOM from "react-dom";
|
|
45
|
+
import { useFloating, offset, flip, autoUpdate, arrow } from "@floating-ui/react-dom";
|
|
39
46
|
import escape from "lodash.escape";
|
|
40
47
|
import { TransitionGroup, CSSTransition } from "react-transition-group";
|
|
48
|
+
import { css } from "@emotion/css";
|
|
41
49
|
var index = "";
|
|
42
|
-
const
|
|
50
|
+
const DesignToken = {
|
|
43
51
|
Background: "--background",
|
|
52
|
+
Background01: "--background-01",
|
|
53
|
+
Background02: "--background-02",
|
|
54
|
+
Background03: "--background-03",
|
|
44
55
|
SurfaceBasicDefault: "--surface-basic-default",
|
|
56
|
+
SurfacePrimaryDefault: "--surface-primary-default",
|
|
45
57
|
SurfaceBasicSubtle: "--surface-basic-subtle",
|
|
58
|
+
SurfaceSecondaryDefault: "--surface-secondary-default",
|
|
59
|
+
SurfaceSecondaryHover: "--surface-secondary-hover",
|
|
60
|
+
SurfaceSecondaryActive: "--surface-secondary-active",
|
|
61
|
+
SurfaceSecondaryDisabled: "--surface-secondary-disabled",
|
|
46
62
|
SurfaceBasicHover: "--surface-basic-hover",
|
|
63
|
+
SurfacePrimaryHover: "--surface-primary-hover",
|
|
47
64
|
SurfaceBasicActive: "--surface-basic-active",
|
|
65
|
+
SurfacePrimaryActive: "--surface-primary-active",
|
|
66
|
+
SurfacePrimaryActiveColored: "--surface-primary-active-colored",
|
|
48
67
|
SurfaceBasicDisabled: "--surface-basic-disabled",
|
|
49
|
-
|
|
68
|
+
SurfacePrimaryDisabled: "--surface-primary-disabled",
|
|
69
|
+
SurfaceTertiaryDefault: "--surface-tertiary-default",
|
|
50
70
|
SurfaceSecondarySubtle: "--surface-secondary-subtle",
|
|
51
|
-
|
|
52
|
-
|
|
71
|
+
SurfaceModerateDefault: "--surface-moderate-default",
|
|
72
|
+
SurfaceModerateHover: "--surface-moderate-hover",
|
|
73
|
+
SurfaceModerateActive: "--surface-moderate-active",
|
|
74
|
+
SurfaceTertiaryHover: "--surface-tertiary-hover",
|
|
75
|
+
SurfaceTertiaryActive: "--surface-tertiary-active",
|
|
76
|
+
SurfaceTertiaryDisabled: "--surface-tertiary-disabled",
|
|
53
77
|
SurfaceFeedbackInfo: "--surface-feedback-info",
|
|
78
|
+
SurfaceAccentEmphasisLowInfo: "--surface-accent-emphasis-low-info",
|
|
54
79
|
SurfaceFeedbackNegative: "--surface-feedback-negative",
|
|
80
|
+
SurfaceAccentEmphasisLowNegative: "--surface-accent-emphasis-low-negative",
|
|
55
81
|
SurfaceFeedbackWarning: "--surface-feedback-warning",
|
|
82
|
+
SurfaceAccentEmphasisLowWarning: "--surface-accent-emphasis-low-warning",
|
|
56
83
|
SurfaceFeedbackPositive: "--surface-feedback-positive",
|
|
84
|
+
SurfaceAccentEmphasisLowPositive: "--surface-accent-emphasis-low-positive",
|
|
85
|
+
SurfaceAccentEmphasisLowPurple: "--surface-accent-emphasis-low-purple",
|
|
86
|
+
SurfaceAccentEmphasisMinInfo: "--surface-accent-emphasis-min-info",
|
|
87
|
+
SurfaceAccentEmphasisMinNegative: "--surface-accent-emphasis-min-negative",
|
|
88
|
+
SurfaceAccentEmphasisMinWarning: "--surface-accent-emphasis-min-warning",
|
|
89
|
+
SurfaceAccentEmphasisMinPositive: "--surface-accent-emphasis-min-positive",
|
|
90
|
+
SurfaceAccentEmphasisMinPurple: "--surface-accent-emphasis-min-purple",
|
|
57
91
|
SurfaceInvertDefault: "--surface-invert-default",
|
|
92
|
+
SurfaceInvertPrimary: "--surface-invert-primary",
|
|
58
93
|
SurfaceInvertSubtle: "--surface-invert-subtle",
|
|
94
|
+
SurfaceInvertSecondary: "--surface-invert-secondary",
|
|
59
95
|
SurfaceInvertDisabled: "--surface-invert-disabled",
|
|
96
|
+
SurfaceLockedDefault: "--surface-locked-default",
|
|
97
|
+
SurfaceLockedHover: "--surface-locked-hover",
|
|
98
|
+
SurfaceLockedActive: "--surface-locked-active",
|
|
99
|
+
SurfaceLockedDisabled: "--surface-locked-disabled",
|
|
100
|
+
SurfaceLockedWhite: "--surface-locked-white",
|
|
101
|
+
SurfaceLockedBlack: "--surface-locked-black",
|
|
102
|
+
SurfaceAccentEmphasisHighInfo: "--surface-accent-emphasis-high-info",
|
|
103
|
+
SurfaceAccentEmphasisHighNegative: "--surface-accent-emphasis-high-negative",
|
|
104
|
+
SurfaceAccentEmphasisHighWarning: "--surface-accent-emphasis-high-warning",
|
|
105
|
+
SurfaceAccentEmphasisHighPositive: "--surface-accent-emphasis-high-positive",
|
|
106
|
+
SurfaceAccentEmphasisHighPurple: "--surface-accent-emphasis-high-purple",
|
|
60
107
|
SurfaceOverlay: "--surface-overlay",
|
|
108
|
+
SurfaceOtherOverlay: "--surface-other-overlay",
|
|
109
|
+
SurfaceOtherAgent: "--surface-other-agent",
|
|
110
|
+
SurfaceOtherSkeleton: "--surface-other-skeleton",
|
|
61
111
|
ContentDefault: "--content-default",
|
|
112
|
+
ContentBasicPrimary: "--content-basic-primary",
|
|
62
113
|
ContentSubtle: "--content-subtle",
|
|
114
|
+
ContentBasicSecondary: "--content-basic-secondary",
|
|
63
115
|
ContentDisabled: "--content-disabled",
|
|
116
|
+
ContentBasicDisabled: "--content-basic-disabled",
|
|
117
|
+
ContentBasicNegative: "--content-basic-negative",
|
|
118
|
+
ContentBasicWarning: "--content-basic-warning",
|
|
119
|
+
ContentBasicPositive: "--content-basic-positive",
|
|
120
|
+
ContentBasicInfo: "--content-basic-info",
|
|
121
|
+
ContentBasicPurple: "--content-basic-purple",
|
|
122
|
+
ContentBasicGradient01: "--content-basic-gradient-01",
|
|
64
123
|
ContentWhiteLocked: "--content-white-locked",
|
|
124
|
+
ContentLockedWhite: "--content-locked-white",
|
|
125
|
+
ContentBlackLocked: "--content-black-locked",
|
|
126
|
+
ContentLockedBlack: "--content-locked-black",
|
|
127
|
+
ContentLockedDefault: "--content-locked-default",
|
|
128
|
+
ContentLockedHover: "--content-locked-hover",
|
|
129
|
+
ContentLockedActive: "--content-locked-active",
|
|
130
|
+
ContentLockedDisabled: "--content-locked-disabled",
|
|
65
131
|
ContentInvertDefault: "--content-invert-default",
|
|
132
|
+
ContentInvertPrimary: "--content-invert-primary",
|
|
66
133
|
ContentInvertSubtle: "--content-invert-subtle",
|
|
134
|
+
ContentInvertSecondary: "--content-invert-secondary",
|
|
67
135
|
ContentInvertDisabled: "--content-invert-disabled",
|
|
136
|
+
ContentInvertGradient01: "--content-invert-gradient-01",
|
|
68
137
|
BorderDefault: "--border-default",
|
|
138
|
+
BorderBasicPrimary: "--border-basic-primary",
|
|
139
|
+
BorderBasicSecondary: "--border-basic-secondary",
|
|
69
140
|
BorderSubtle: "--border-subtle",
|
|
141
|
+
BorderBasicTertiary: "--border-basic-tertiary",
|
|
70
142
|
BorderHover: "--border-hover",
|
|
143
|
+
BorderBasicHover: "--border-basic-hover",
|
|
71
144
|
BorderDisabled: "--border-disabled",
|
|
145
|
+
BorderBasicDisabled: "--border-basic-disabled",
|
|
146
|
+
BorderBasicNegative: "--border-basic-negative",
|
|
147
|
+
BorderBasicWarning: "--border-basic-warning",
|
|
148
|
+
BorderBasicPositive: "--border-basic-positive",
|
|
149
|
+
BorderBasicInfo: "--border-basic-info",
|
|
150
|
+
BorderBasicPurple: "--border-basic-purple",
|
|
72
151
|
BorderInvertDefault: "--border-invert-default",
|
|
152
|
+
BorderInvertPrimary: "--border-invert-primary",
|
|
73
153
|
BorderInvertSubtle: "--border-invert-subtle",
|
|
154
|
+
BorderInvertSecondary: "--border-invert-secondary",
|
|
74
155
|
BorderInvertHover: "--border-invert-hover",
|
|
75
156
|
BorderInvertDisabled: "--border-invert-disabled",
|
|
76
157
|
ColorActionActive: "--color-action-active",
|
|
158
|
+
ActionPrimaryActive: "--action-primary-active",
|
|
77
159
|
ColorActionHover: "--color-action-hover",
|
|
160
|
+
ActionPrimaryHover: "--action-primary-hover",
|
|
78
161
|
ColorActionDefault: "--color-action-default",
|
|
162
|
+
ActionPrimaryDefault: "--action-primary-default",
|
|
163
|
+
ColorActionDefaultRgb: "--color-action-default-rgb",
|
|
79
164
|
ColorActionDisabled: "--color-action-disabled",
|
|
165
|
+
ActionPrimaryDisabled: "--action-primary-disabled",
|
|
80
166
|
ColorNegativeActive: "--color-negative-active",
|
|
167
|
+
ActionNegativeActive: "--action-negative-active",
|
|
81
168
|
ColorNegativeHover: "--color-negative-hover",
|
|
169
|
+
ActionNegativeHover: "--action-negative-hover",
|
|
82
170
|
ColorNegativeDefault: "--color-negative-default",
|
|
171
|
+
ActionNegativeDefault: "--action-negative-default",
|
|
83
172
|
ColorNegativeDisabled: "--color-negative-disabled",
|
|
173
|
+
ActionNegativeDisabled: "--action-negative-disabled",
|
|
84
174
|
ColorWarningDefault: "--color-warning-default",
|
|
175
|
+
ActionWarningDefault: "--action-warning-default",
|
|
85
176
|
ColorWarningHover: "--color-warning-hover",
|
|
177
|
+
ActionWarningHover: "--action-warning-hover",
|
|
86
178
|
ColorPositiveDefault: "--color-positive-default",
|
|
179
|
+
ActionPositiveDefault: "--action-positive-default",
|
|
87
180
|
ColorPositiveHover: "--color-positive-hover",
|
|
181
|
+
ActionPositiveHover: "--action-positive-hover",
|
|
88
182
|
ColorPositiveDisabled: "--color-positive-disabled",
|
|
183
|
+
ActionPositiveDisabled: "--action-positive-disabled",
|
|
184
|
+
ActionNeutralDefault: "--action-neutral-default",
|
|
185
|
+
ActionNeutralHover: "--action-neutral-hover",
|
|
186
|
+
ActionNeutralDisabled: "--action-neutral-disabled",
|
|
89
187
|
ColorBot: "--color-bot",
|
|
188
|
+
SurfaceOtherBot: "--surface-other-bot",
|
|
90
189
|
ColorBlack: "--color-black",
|
|
91
190
|
ColorWhite: "--color-white",
|
|
92
191
|
DecorBlue900: "--decor-blue900",
|
|
@@ -163,10 +262,40 @@ const DesignTokens = {
|
|
|
163
262
|
DecorPurple300: "--decor-purple300",
|
|
164
263
|
DecorPurple200: "--decor-purple200",
|
|
165
264
|
DecorPurple100: "--decor-purple100",
|
|
166
|
-
DecorPurple50: "--decor-purple50"
|
|
265
|
+
DecorPurple50: "--decor-purple50",
|
|
266
|
+
ProductsLivechat: "--products-livechat",
|
|
267
|
+
ProductsHelpdesk: "--products-helpdesk",
|
|
268
|
+
ProductsChatbot: "--products-chatbot",
|
|
269
|
+
ProductsKnowledgebase: "--products-knowledgebase",
|
|
270
|
+
IllustrationsPrimary: "--illustrations-primary",
|
|
271
|
+
IllustrationsSecondary: "--illustrations-secondary",
|
|
272
|
+
IllustrationsStroke: "--illustrations-stroke",
|
|
273
|
+
TagSurface01: "--tag-surface-01",
|
|
274
|
+
TagContent01: "--tag-content-01"
|
|
275
|
+
};
|
|
276
|
+
const SpacingToken = {
|
|
277
|
+
Spacing0: "--spacing-0",
|
|
278
|
+
Spacing05: "--spacing-05",
|
|
279
|
+
Spacing1: "--spacing-1",
|
|
280
|
+
Spacing2: "--spacing-2",
|
|
281
|
+
Spacing3: "--spacing-3",
|
|
282
|
+
Spacing4: "--spacing-4",
|
|
283
|
+
Spacing5: "--spacing-5",
|
|
284
|
+
Spacing6: "--spacing-6",
|
|
285
|
+
Spacing8: "--spacing-8",
|
|
286
|
+
Spacing12: "--spacing-12",
|
|
287
|
+
Spacing16: "--spacing-16",
|
|
288
|
+
Spacing18: "--spacing-18",
|
|
289
|
+
Spacing20: "--spacing-20",
|
|
290
|
+
Spacing24: "--spacing-24"
|
|
291
|
+
};
|
|
292
|
+
const ShadowToken = {
|
|
293
|
+
Float: "--shadow-float",
|
|
294
|
+
PopOver: "--shadow-pop-over",
|
|
295
|
+
Modal: "--shadow-modal"
|
|
167
296
|
};
|
|
168
297
|
const caps = "lc-Typography-module__caps___c3eNJ";
|
|
169
|
-
var styles$
|
|
298
|
+
var styles$E = {
|
|
170
299
|
"heading-xl": "lc-Typography-module__heading-xl___nhr-6",
|
|
171
300
|
"heading-lg": "lc-Typography-module__heading-lg___XYF7l",
|
|
172
301
|
"heading-md": "lc-Typography-module__heading-md___wHOIs",
|
|
@@ -183,14 +312,13 @@ var styles$r = {
|
|
|
183
312
|
"paragraph-xs": "lc-Typography-module__paragraph-xs___OUooD",
|
|
184
313
|
"paragraph-xs--bold": "lc-Typography-module__paragraph-xs--bold___z7om7"
|
|
185
314
|
};
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
})(sizeToElement || {});
|
|
315
|
+
const SIZE_TO_ELEMENT_MAP = {
|
|
316
|
+
xl: "h1",
|
|
317
|
+
lg: "h2",
|
|
318
|
+
md: "h3",
|
|
319
|
+
sm: "h4",
|
|
320
|
+
xs: "h5"
|
|
321
|
+
};
|
|
194
322
|
const Heading = (_a) => {
|
|
195
323
|
var _b = _a, {
|
|
196
324
|
as,
|
|
@@ -203,7 +331,7 @@ const Heading = (_a) => {
|
|
|
203
331
|
"children",
|
|
204
332
|
"className"
|
|
205
333
|
]);
|
|
206
|
-
return React.createElement(as ||
|
|
334
|
+
return React.createElement(as || SIZE_TO_ELEMENT_MAP[size], __spreadValues({ className: cx(styles$E[`heading-${size}`], className) }, props), children);
|
|
207
335
|
};
|
|
208
336
|
const Text = (_c) => {
|
|
209
337
|
var _d = _c, {
|
|
@@ -228,15 +356,15 @@ const Text = (_c) => {
|
|
|
228
356
|
const baseClassPrefix = caps2 ? "caps" : `paragraph-${size}`;
|
|
229
357
|
return React.createElement(as, __spreadValues({
|
|
230
358
|
className: cx({
|
|
231
|
-
[styles$
|
|
232
|
-
[styles$
|
|
233
|
-
[styles$
|
|
234
|
-
[styles$
|
|
359
|
+
[styles$E[`${baseClassPrefix}`]]: true,
|
|
360
|
+
[styles$E[`${baseClassPrefix}--bold`]]: bold,
|
|
361
|
+
[styles$E[`${baseClassPrefix}--strike`]]: strike,
|
|
362
|
+
[styles$E[`${baseClassPrefix}--underline`]]: underline
|
|
235
363
|
}, className)
|
|
236
364
|
}, props), children);
|
|
237
365
|
};
|
|
238
366
|
const icon$1 = "lc-Icon-module__icon___tw31R";
|
|
239
|
-
var styles$
|
|
367
|
+
var styles$D = {
|
|
240
368
|
icon: icon$1,
|
|
241
369
|
"icon--primary": "lc-Icon-module__icon--primary___JJnBV",
|
|
242
370
|
"icon--subtle": "lc-Icon-module__icon--subtle___sZIzL",
|
|
@@ -255,95 +383,49 @@ var styles$q = {
|
|
|
255
383
|
"icon--disabled--warning": "lc-Icon-module__icon--disabled--warning___8ko1e",
|
|
256
384
|
"icon--disabled--error": "lc-Icon-module__icon--disabled--error___9KbVo"
|
|
257
385
|
};
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
IconSizeName2["Small"] = "small";
|
|
261
|
-
IconSizeName2["Medium"] = "medium";
|
|
262
|
-
IconSizeName2["Large"] = "large";
|
|
263
|
-
IconSizeName2["XLarge"] = "xlarge";
|
|
264
|
-
return IconSizeName2;
|
|
265
|
-
})(IconSizeName || {});
|
|
266
|
-
const IconSize = {
|
|
267
|
-
["xsmall"]: {
|
|
386
|
+
const IconSizeMap = {
|
|
387
|
+
xsmall: {
|
|
268
388
|
width: 12,
|
|
269
389
|
height: 12
|
|
270
390
|
},
|
|
271
|
-
|
|
391
|
+
small: {
|
|
272
392
|
width: 16,
|
|
273
393
|
height: 16
|
|
274
394
|
},
|
|
275
|
-
|
|
395
|
+
medium: {
|
|
276
396
|
width: 20,
|
|
277
397
|
height: 20
|
|
278
398
|
},
|
|
279
|
-
|
|
399
|
+
large: {
|
|
280
400
|
width: 24,
|
|
281
401
|
height: 24
|
|
282
402
|
},
|
|
283
|
-
|
|
403
|
+
xlarge: {
|
|
284
404
|
width: 32,
|
|
285
405
|
height: 32
|
|
286
406
|
}
|
|
287
407
|
};
|
|
288
|
-
|
|
289
|
-
IconTypeName2["Primary"] = "primary";
|
|
290
|
-
IconTypeName2["Subtle"] = "subtle";
|
|
291
|
-
IconTypeName2["Inverted"] = "inverted";
|
|
292
|
-
IconTypeName2["InvertedSubtle"] = "inverted_subtle";
|
|
293
|
-
IconTypeName2["Link"] = "link";
|
|
294
|
-
IconTypeName2["Success"] = "success";
|
|
295
|
-
IconTypeName2["Warning"] = "warning";
|
|
296
|
-
IconTypeName2["Error"] = "error";
|
|
297
|
-
return IconTypeName2;
|
|
298
|
-
})(IconTypeName || {});
|
|
299
|
-
const IconColorMapper = {
|
|
300
|
-
["primary"]: "primary",
|
|
301
|
-
["subtle"]: "subtle",
|
|
302
|
-
["inverted"]: "inverted",
|
|
303
|
-
["inverted_subtle"]: "inverted-subtle",
|
|
304
|
-
["link"]: "link",
|
|
305
|
-
["success"]: "success",
|
|
306
|
-
["warning"]: "warning",
|
|
307
|
-
["error"]: "error"
|
|
308
|
-
};
|
|
309
|
-
const IconColorDisabledMapper = {
|
|
310
|
-
["primary"]: "disabled--primary",
|
|
311
|
-
["subtle"]: "disabled--subtle",
|
|
312
|
-
["inverted"]: "disabled--inverted",
|
|
313
|
-
["inverted_subtle"]: "disabled--inverted-subtle",
|
|
314
|
-
["link"]: "disabled--link",
|
|
315
|
-
["success"]: "disabled--success",
|
|
316
|
-
["warning"]: "disabled--warning",
|
|
317
|
-
["error"]: "disabled--error"
|
|
318
|
-
};
|
|
319
|
-
const baseClass$t = "icon";
|
|
408
|
+
const baseClass$M = "icon";
|
|
320
409
|
const Icon = (props) => {
|
|
321
410
|
const _a = props, {
|
|
322
411
|
source,
|
|
323
412
|
size = "medium",
|
|
324
|
-
|
|
413
|
+
kind,
|
|
325
414
|
disabled,
|
|
326
415
|
className,
|
|
327
416
|
customColor
|
|
328
417
|
} = _a, restProps = __objRest(_a, [
|
|
329
418
|
"source",
|
|
330
419
|
"size",
|
|
331
|
-
"
|
|
420
|
+
"kind",
|
|
332
421
|
"disabled",
|
|
333
422
|
"className",
|
|
334
423
|
"customColor"
|
|
335
424
|
]);
|
|
336
|
-
|
|
337
|
-
if (iconType) {
|
|
338
|
-
filledColor = IconColorMapper[iconType];
|
|
339
|
-
if (disabled) {
|
|
340
|
-
filledColor = IconColorDisabledMapper[iconType];
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
const GeneratedIcon = React.createElement(source, __spreadProps(__spreadValues({}, IconSize[size]), {
|
|
425
|
+
const GeneratedIcon = React.createElement(source, __spreadProps(__spreadValues({}, IconSizeMap[size]), {
|
|
344
426
|
color: customColor
|
|
345
427
|
}));
|
|
346
|
-
const mergedClassNames = cx(className, styles$
|
|
428
|
+
const mergedClassNames = cx(className, styles$D[baseClass$M], kind && styles$D[`${baseClass$M}--${disabled ? "disabled--" : ""}${kind}`]);
|
|
347
429
|
return /* @__PURE__ */ React.createElement("span", __spreadProps(__spreadValues({}, restProps), {
|
|
348
430
|
className: mergedClassNames
|
|
349
431
|
}), GeneratedIcon);
|
|
@@ -351,7 +433,7 @@ const Icon = (props) => {
|
|
|
351
433
|
const alert = "lc-Alert-module__alert___HBTns";
|
|
352
434
|
const alert__content = "lc-Alert-module__alert__content___9nZdf";
|
|
353
435
|
const alert__icon = "lc-Alert-module__alert__icon___8TaAH";
|
|
354
|
-
var styles$
|
|
436
|
+
var styles$C = {
|
|
355
437
|
alert,
|
|
356
438
|
alert__content,
|
|
357
439
|
"alert__content-text": "lc-Alert-module__alert__content-text___x2Un5",
|
|
@@ -365,34 +447,40 @@ var styles$p = {
|
|
|
365
447
|
"alert--error": "lc-Alert-module__alert--error___DKPo0",
|
|
366
448
|
alert__icon
|
|
367
449
|
};
|
|
368
|
-
const IconConfig
|
|
369
|
-
|
|
370
|
-
source: Info,
|
|
371
|
-
|
|
450
|
+
const IconConfig = {
|
|
451
|
+
info: {
|
|
452
|
+
source: Info$1,
|
|
453
|
+
kind: "link"
|
|
372
454
|
},
|
|
373
|
-
|
|
455
|
+
warning: {
|
|
374
456
|
source: Warning,
|
|
375
|
-
|
|
457
|
+
kind: "warning"
|
|
376
458
|
},
|
|
377
|
-
|
|
459
|
+
success: {
|
|
378
460
|
source: CheckCircleSolid,
|
|
379
|
-
|
|
461
|
+
kind: "success"
|
|
380
462
|
},
|
|
381
|
-
|
|
463
|
+
error: {
|
|
382
464
|
source: Block,
|
|
383
|
-
|
|
465
|
+
kind: "error"
|
|
384
466
|
}
|
|
385
467
|
};
|
|
386
|
-
const baseClass$
|
|
387
|
-
const Alert = ({
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
468
|
+
const baseClass$L = "alert";
|
|
469
|
+
const Alert = (_e) => {
|
|
470
|
+
var _f = _e, {
|
|
471
|
+
children,
|
|
472
|
+
className,
|
|
473
|
+
kind = "info",
|
|
474
|
+
onClose
|
|
475
|
+
} = _f, props = __objRest(_f, [
|
|
476
|
+
"children",
|
|
477
|
+
"className",
|
|
478
|
+
"kind",
|
|
479
|
+
"onClose"
|
|
480
|
+
]);
|
|
393
481
|
const containerRef = React.useRef(null);
|
|
394
482
|
const [isSmallContainer, setIsSmallContainer] = React.useState(false);
|
|
395
|
-
const mergedClassNames = cx(styles$
|
|
483
|
+
const mergedClassNames = cx(styles$C[baseClass$L], styles$C[`${baseClass$L}--${kind}`], isSmallContainer && styles$C[`${baseClass$L}--small`], className);
|
|
396
484
|
React.useEffect(() => {
|
|
397
485
|
const handleResize = debounce(() => {
|
|
398
486
|
if (containerRef.current && containerRef.current.offsetWidth <= 400) {
|
|
@@ -403,47 +491,192 @@ const Alert = ({
|
|
|
403
491
|
window.addEventListener("resize", handleResize);
|
|
404
492
|
return () => window.removeEventListener("resize", handleResize);
|
|
405
493
|
});
|
|
406
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
494
|
+
return /* @__PURE__ */ React.createElement("div", __spreadValues({
|
|
407
495
|
ref: containerRef,
|
|
408
496
|
className: mergedClassNames
|
|
409
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
410
|
-
className: styles$
|
|
411
|
-
}, /* @__PURE__ */ React.createElement(Icon, __spreadProps(__spreadValues({}, IconConfig
|
|
412
|
-
|
|
497
|
+
}, props), /* @__PURE__ */ React.createElement("div", {
|
|
498
|
+
className: styles$C[`${baseClass$L}__content`]
|
|
499
|
+
}, /* @__PURE__ */ React.createElement(Icon, __spreadProps(__spreadValues({}, IconConfig[kind]), {
|
|
500
|
+
size: "large",
|
|
501
|
+
className: styles$C[`${baseClass$L}__content-icon`]
|
|
413
502
|
})), /* @__PURE__ */ React.createElement(Text, {
|
|
414
503
|
as: "div",
|
|
415
|
-
className: cx(styles$
|
|
504
|
+
className: cx(styles$C[`${baseClass$L}__content-text`], onClose && styles$C[`${baseClass$L}__content-text--margin`])
|
|
416
505
|
}, children)), onClose && /* @__PURE__ */ React.createElement("button", {
|
|
417
506
|
type: "button",
|
|
418
|
-
className: styles$
|
|
507
|
+
className: styles$C[`${baseClass$L}__close-icon`],
|
|
419
508
|
onClick: onClose
|
|
420
509
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
421
510
|
source: Close,
|
|
422
|
-
size:
|
|
423
|
-
|
|
511
|
+
size: "large",
|
|
512
|
+
kind: "primary"
|
|
424
513
|
})));
|
|
425
514
|
};
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
515
|
+
function getInitials(name = "", count = 2) {
|
|
516
|
+
return name.split(" ").map((el) => el.charAt(0)).join("").substring(0, count).toUpperCase();
|
|
517
|
+
}
|
|
518
|
+
function getFontColor(color) {
|
|
519
|
+
return getContrast(color, "#FFFFFF") > 4.5 ? "var(--color-white)" : "var(--color-black)";
|
|
520
|
+
}
|
|
521
|
+
const avatar = "lc-Avatar-module__avatar___1zTCE";
|
|
522
|
+
const avatar__status = "lc-Avatar-module__avatar__status___nX2Ls";
|
|
523
|
+
const avatar__rim = "lc-Avatar-module__avatar__rim___RCQ8Q";
|
|
524
|
+
const avatar__image = "lc-Avatar-module__avatar__image___YqfqE";
|
|
525
|
+
var styles$B = {
|
|
526
|
+
avatar,
|
|
527
|
+
avatar__status,
|
|
528
|
+
"avatar__status--available": "lc-Avatar-module__avatar__status--available___tcpFg",
|
|
529
|
+
"avatar__status--unavailable": "lc-Avatar-module__avatar__status--unavailable___ciauF",
|
|
530
|
+
"avatar__status--unknown": "lc-Avatar-module__avatar__status--unknown___MBaGB",
|
|
531
|
+
"avatar__status--xxxsmall": "lc-Avatar-module__avatar__status--xxxsmall___8pkEO",
|
|
532
|
+
"avatar__status--circle": "lc-Avatar-module__avatar__status--circle___doV5H",
|
|
533
|
+
"avatar__status--xxsmall": "lc-Avatar-module__avatar__status--xxsmall___M69lx",
|
|
534
|
+
"avatar__status--xsmall": "lc-Avatar-module__avatar__status--xsmall___RKQiI",
|
|
535
|
+
"avatar__status--small": "lc-Avatar-module__avatar__status--small___cVrA7",
|
|
536
|
+
"avatar__status--medium": "lc-Avatar-module__avatar__status--medium___n5z1H",
|
|
537
|
+
"avatar__status--large": "lc-Avatar-module__avatar__status--large___Lt-0p",
|
|
538
|
+
"avatar__status--xlarge": "lc-Avatar-module__avatar__status--xlarge___RWIcJ",
|
|
539
|
+
"avatar__status--xxlarge": "lc-Avatar-module__avatar__status--xxlarge___crG9D",
|
|
540
|
+
"avatar__status--rounded-square": "lc-Avatar-module__avatar__status--rounded-square___-My1P",
|
|
541
|
+
avatar__rim,
|
|
542
|
+
"avatar__rim--xxxsmall": "lc-Avatar-module__avatar__rim--xxxsmall___0CH9D",
|
|
543
|
+
"avatar__rim--xxsmall": "lc-Avatar-module__avatar__rim--xxsmall___Mde0K",
|
|
544
|
+
"avatar__rim--xsmall": "lc-Avatar-module__avatar__rim--xsmall___LAN-b",
|
|
545
|
+
"avatar__rim--small": "lc-Avatar-module__avatar__rim--small___FT8LX",
|
|
546
|
+
"avatar__rim--medium": "lc-Avatar-module__avatar__rim--medium___Dy0pr",
|
|
547
|
+
"avatar__rim--large": "lc-Avatar-module__avatar__rim--large___FPvGp",
|
|
548
|
+
"avatar__rim--xlarge": "lc-Avatar-module__avatar__rim--xlarge___CY0kN",
|
|
549
|
+
"avatar__rim--xxlarge": "lc-Avatar-module__avatar__rim--xxlarge___tE053",
|
|
550
|
+
avatar__image,
|
|
551
|
+
"avatar__icon--xxxsmall": "lc-Avatar-module__avatar__icon--xxxsmall___KaoMa",
|
|
552
|
+
"avatar__icon--xxsmall": "lc-Avatar-module__avatar__icon--xxsmall___NJJNV",
|
|
553
|
+
"avatar__icon--xsmall": "lc-Avatar-module__avatar__icon--xsmall___yHEZK",
|
|
554
|
+
"avatar__icon--small": "lc-Avatar-module__avatar__icon--small___l6lBu",
|
|
555
|
+
"avatar__icon--medium": "lc-Avatar-module__avatar__icon--medium___LF4w2",
|
|
556
|
+
"avatar__icon--large": "lc-Avatar-module__avatar__icon--large___QntBf",
|
|
557
|
+
"avatar__icon--xlarge": "lc-Avatar-module__avatar__icon--xlarge___bcHbI",
|
|
558
|
+
"avatar__icon--xxlarge": "lc-Avatar-module__avatar__icon--xxlarge___sx8Fq",
|
|
559
|
+
"avatar--circle": "lc-Avatar-module__avatar--circle___XwEz-",
|
|
560
|
+
"avatar--rounded-square": "lc-Avatar-module__avatar--rounded-square___m7-4I",
|
|
561
|
+
"avatar--with-rim": "lc-Avatar-module__avatar--with-rim___pvFZR",
|
|
562
|
+
"avatar--xxxsmall": "lc-Avatar-module__avatar--xxxsmall___EHzpP",
|
|
563
|
+
"avatar--xxsmall": "lc-Avatar-module__avatar--xxsmall___EDOVp",
|
|
564
|
+
"avatar--xsmall": "lc-Avatar-module__avatar--xsmall___nI348",
|
|
565
|
+
"avatar--small": "lc-Avatar-module__avatar--small___UuQen",
|
|
566
|
+
"avatar--medium": "lc-Avatar-module__avatar--medium___Bt9Eo",
|
|
567
|
+
"avatar--large": "lc-Avatar-module__avatar--large___OU-08",
|
|
568
|
+
"avatar--xlarge": "lc-Avatar-module__avatar--xlarge___zwgeW",
|
|
569
|
+
"avatar--xxlarge": "lc-Avatar-module__avatar--xxlarge___Ur0ul"
|
|
430
570
|
};
|
|
431
|
-
const
|
|
432
|
-
|
|
571
|
+
const baseClass$K = "avatar";
|
|
572
|
+
const defaultBackgroundColor = "var(--surface-basic-disabled)";
|
|
573
|
+
const defaultFontColor = "var(--content-subtle)";
|
|
574
|
+
const Avatar = ({
|
|
575
|
+
alt,
|
|
433
576
|
className,
|
|
434
|
-
|
|
577
|
+
color,
|
|
578
|
+
shape = "circle",
|
|
579
|
+
size = "medium",
|
|
580
|
+
src,
|
|
581
|
+
status,
|
|
582
|
+
text,
|
|
583
|
+
type,
|
|
584
|
+
withRim = false
|
|
435
585
|
}) => {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
586
|
+
const isImproperImageSetup = type === "image" && !src;
|
|
587
|
+
const [shouldDisplayFallbackAvatar, setShouldDisplayFallbackAvatar] = React.useState(isImproperImageSetup);
|
|
588
|
+
const shouldDisplayImage = type === "image" && !!src && !shouldDisplayFallbackAvatar;
|
|
589
|
+
const shouldDisplayInitials = type === "text";
|
|
590
|
+
const letterCount = ["xxxsmall", "xxsmall", "xsmall"].includes(size) ? 1 : 2;
|
|
591
|
+
const initials = getInitials(text, letterCount);
|
|
592
|
+
const backgroundColor = color || defaultBackgroundColor;
|
|
593
|
+
const fontColor = color ? getFontColor(color) : defaultFontColor;
|
|
594
|
+
const mergedClassNames = cx({
|
|
595
|
+
[styles$B[baseClass$K]]: true,
|
|
596
|
+
[styles$B[`${baseClass$K}--${shape}`]]: true,
|
|
597
|
+
[styles$B[`${baseClass$K}--${size}`]]: true,
|
|
598
|
+
[styles$B[`${baseClass$K}--with-rim`]]: withRim,
|
|
599
|
+
[`${className}`]: className
|
|
600
|
+
});
|
|
601
|
+
const mergedStatusClassNames = cx(styles$B[`${baseClass$K}__status`], styles$B[`${baseClass$K}__status--${shape}`], styles$B[`${baseClass$K}__status--${size}`], styles$B[`${baseClass$K}__status--${status}`]);
|
|
602
|
+
const mergedIconClassNames = cx(styles$B[`${baseClass$K}__icon`], styles$B[`${baseClass$K}__icon--${size}`]);
|
|
603
|
+
const mergedRimClassNames = cx(styles$B[`${baseClass$K}__rim`], styles$B[`${baseClass$K}__rim--${size}`]);
|
|
604
|
+
const handleError = React.useCallback(() => setShouldDisplayFallbackAvatar(true), []);
|
|
605
|
+
React.useEffect(() => {
|
|
606
|
+
setShouldDisplayFallbackAvatar(isImproperImageSetup);
|
|
607
|
+
}, [isImproperImageSetup]);
|
|
608
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
609
|
+
className: mergedClassNames,
|
|
610
|
+
style: { backgroundColor }
|
|
611
|
+
}, withRim && /* @__PURE__ */ React.createElement("div", {
|
|
612
|
+
"data-testid": `${baseClass$K}__rim`,
|
|
613
|
+
className: mergedRimClassNames
|
|
614
|
+
}), status && /* @__PURE__ */ React.createElement("div", {
|
|
615
|
+
"data-testid": `${baseClass$K}__status`,
|
|
616
|
+
className: mergedStatusClassNames
|
|
617
|
+
}), shouldDisplayImage && /* @__PURE__ */ React.createElement("img", {
|
|
618
|
+
className: styles$B[`${baseClass$K}__image`],
|
|
619
|
+
src,
|
|
620
|
+
alt,
|
|
621
|
+
onError: handleError
|
|
622
|
+
}), shouldDisplayInitials && /* @__PURE__ */ React.createElement("span", {
|
|
623
|
+
style: { color: fontColor }
|
|
624
|
+
}, initials), shouldDisplayFallbackAvatar && /* @__PURE__ */ React.createElement(Icon, {
|
|
625
|
+
"data-testid": `${baseClass$K}__icon`,
|
|
626
|
+
className: mergedIconClassNames,
|
|
627
|
+
source: Person,
|
|
628
|
+
kind: "primary"
|
|
629
|
+
}));
|
|
630
|
+
};
|
|
631
|
+
const badge = "lc-Badge-module__badge___GhLnu";
|
|
632
|
+
const badge__dot = "lc-Badge-module__badge__dot___z6RO6";
|
|
633
|
+
var styles$A = {
|
|
634
|
+
badge,
|
|
635
|
+
badge__dot,
|
|
636
|
+
"badge--large": "lc-Badge-module__badge--large___B131q",
|
|
637
|
+
"badge--medium": "lc-Badge-module__badge--medium___TDU8a",
|
|
638
|
+
"badge--compact": "lc-Badge-module__badge--compact___9xJ4y",
|
|
639
|
+
"badge--primary": "lc-Badge-module__badge--primary___8LRpp",
|
|
640
|
+
"badge--secondary": "lc-Badge-module__badge--secondary___JjNIJ",
|
|
641
|
+
"badge--tertiary": "lc-Badge-module__badge--tertiary___e83wV"
|
|
642
|
+
};
|
|
643
|
+
function formatCount(count, max) {
|
|
644
|
+
return count > max ? `${max}+` : `${count}`;
|
|
645
|
+
}
|
|
646
|
+
const baseClass$J = "badge";
|
|
647
|
+
const Badge = (_g) => {
|
|
648
|
+
var _h = _g, {
|
|
649
|
+
className,
|
|
650
|
+
count = 0,
|
|
651
|
+
max = 99,
|
|
652
|
+
kind = "primary",
|
|
653
|
+
size = "medium",
|
|
654
|
+
type = "counter"
|
|
655
|
+
} = _h, spanProps = __objRest(_h, [
|
|
656
|
+
"className",
|
|
657
|
+
"count",
|
|
658
|
+
"max",
|
|
659
|
+
"kind",
|
|
660
|
+
"size",
|
|
661
|
+
"type"
|
|
662
|
+
]);
|
|
663
|
+
const mergedClassNames = cx(className, styles$A[baseClass$J], styles$A[`${baseClass$J}--${kind}`], styles$A[`${baseClass$J}--${size}`]);
|
|
664
|
+
const content = {
|
|
665
|
+
["counter"]: formatCount(count, max),
|
|
666
|
+
["alert"]: "!",
|
|
667
|
+
["dot"]: /* @__PURE__ */ React.createElement("span", {
|
|
668
|
+
className: styles$A[`${baseClass$J}__dot`]
|
|
439
669
|
})
|
|
440
|
-
}
|
|
670
|
+
}[type];
|
|
671
|
+
return /* @__PURE__ */ React.createElement("span", __spreadValues({
|
|
672
|
+
className: mergedClassNames
|
|
673
|
+
}, spanProps), content);
|
|
441
674
|
};
|
|
442
675
|
const loader = "lc-Loader-module__loader___LRflD";
|
|
443
676
|
const loader__spinner = "lc-Loader-module__loader__spinner___l3C1g";
|
|
444
677
|
const rotate = "lc-Loader-module__rotate___Tlni-";
|
|
445
678
|
const loader__label = "lc-Loader-module__loader__label___R74f6";
|
|
446
|
-
var styles$
|
|
679
|
+
var styles$z = {
|
|
447
680
|
loader,
|
|
448
681
|
loader__spinner,
|
|
449
682
|
"loader__spinner--small": "lc-Loader-module__loader__spinner--small___dGFFt",
|
|
@@ -453,8 +686,8 @@ var styles$n = {
|
|
|
453
686
|
rotate,
|
|
454
687
|
loader__label
|
|
455
688
|
};
|
|
456
|
-
const baseClass$
|
|
457
|
-
const spinnerClass = `${baseClass$
|
|
689
|
+
const baseClass$I = "loader";
|
|
690
|
+
const spinnerClass = `${baseClass$I}__spinner`;
|
|
458
691
|
const Loader = ({
|
|
459
692
|
primaryColor,
|
|
460
693
|
secondaryColor,
|
|
@@ -463,11 +696,11 @@ const Loader = ({
|
|
|
463
696
|
size = "medium"
|
|
464
697
|
}) => {
|
|
465
698
|
return /* @__PURE__ */ React.createElement("div", {
|
|
466
|
-
className: cx(styles$
|
|
699
|
+
className: cx(styles$z[baseClass$I], className)
|
|
467
700
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
468
|
-
className: cx(styles$
|
|
701
|
+
className: cx(styles$z[spinnerClass], styles$z[`${spinnerClass}--${size}`])
|
|
469
702
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
470
|
-
className: styles$
|
|
703
|
+
className: styles$z["loader__spinner-circle"],
|
|
471
704
|
style: {
|
|
472
705
|
borderColor: secondaryColor,
|
|
473
706
|
borderTopColor: primaryColor
|
|
@@ -475,14 +708,14 @@ const Loader = ({
|
|
|
475
708
|
})), label && /* @__PURE__ */ React.createElement(Text, {
|
|
476
709
|
as: "div",
|
|
477
710
|
size: "md",
|
|
478
|
-
className: styles$
|
|
711
|
+
className: styles$z["loader__label"]
|
|
479
712
|
}, label));
|
|
480
713
|
};
|
|
481
714
|
const btn$1 = "lc-Button-module__btn___aijZJ";
|
|
482
715
|
const btn__loader = "lc-Button-module__btn__loader___c8zZz";
|
|
483
716
|
const btn__content = "lc-Button-module__btn__content___wefl2";
|
|
484
717
|
const btn__icon = "lc-Button-module__btn__icon___GVExB";
|
|
485
|
-
var styles$
|
|
718
|
+
var styles$y = {
|
|
486
719
|
btn: btn$1,
|
|
487
720
|
"btn--disabled": "lc-Button-module__btn--disabled___lXBav",
|
|
488
721
|
"btn--icon-only": "lc-Button-module__btn--icon-only___bF5pW",
|
|
@@ -503,9 +736,9 @@ var styles$m = {
|
|
|
503
736
|
btn__content,
|
|
504
737
|
btn__icon
|
|
505
738
|
};
|
|
506
|
-
const baseClass$
|
|
507
|
-
const Button = (
|
|
508
|
-
var
|
|
739
|
+
const baseClass$H = "btn";
|
|
740
|
+
const Button = (_i) => {
|
|
741
|
+
var _j = _i, {
|
|
509
742
|
loading = false,
|
|
510
743
|
disabled = false,
|
|
511
744
|
type = "button",
|
|
@@ -517,8 +750,9 @@ const Button = (_e) => {
|
|
|
517
750
|
loaderLabel,
|
|
518
751
|
className,
|
|
519
752
|
children,
|
|
520
|
-
href
|
|
521
|
-
|
|
753
|
+
href,
|
|
754
|
+
onClick
|
|
755
|
+
} = _j, props = __objRest(_j, [
|
|
522
756
|
"loading",
|
|
523
757
|
"disabled",
|
|
524
758
|
"type",
|
|
@@ -530,125 +764,212 @@ const Button = (_e) => {
|
|
|
530
764
|
"loaderLabel",
|
|
531
765
|
"className",
|
|
532
766
|
"children",
|
|
533
|
-
"href"
|
|
767
|
+
"href",
|
|
768
|
+
"onClick"
|
|
534
769
|
]);
|
|
535
770
|
const isDisabled = loading || disabled;
|
|
536
771
|
const Component = href ? "a" : "button";
|
|
537
|
-
const mergedClassNames = cx(className, styles$
|
|
538
|
-
[styles$
|
|
539
|
-
[styles$
|
|
540
|
-
[styles$
|
|
541
|
-
[styles$
|
|
772
|
+
const mergedClassNames = cx(className, styles$y[baseClass$H], styles$y[`${baseClass$H}--${kind}`], styles$y[`${baseClass$H}--${size}`], {
|
|
773
|
+
[styles$y[`${baseClass$H}--loading`]]: loading,
|
|
774
|
+
[styles$y[`${baseClass$H}--full-width`]]: fullWidth,
|
|
775
|
+
[styles$y[`${baseClass$H}--icon-only`]]: !children && icon2,
|
|
776
|
+
[styles$y[`${baseClass$H}--disabled`]]: isDisabled
|
|
542
777
|
});
|
|
543
778
|
return /* @__PURE__ */ React.createElement(Component, __spreadValues({
|
|
544
779
|
className: mergedClassNames,
|
|
545
|
-
disabled: isDisabled,
|
|
780
|
+
"aria-disabled": isDisabled,
|
|
546
781
|
type,
|
|
547
|
-
href: isDisabled ? void 0 : href
|
|
782
|
+
href: isDisabled ? void 0 : href,
|
|
783
|
+
onClick: isDisabled ? void 0 : onClick
|
|
548
784
|
}, props), loading && /* @__PURE__ */ React.createElement(Loader, {
|
|
549
785
|
size: "small",
|
|
550
786
|
label: loaderLabel,
|
|
551
|
-
className: styles$
|
|
787
|
+
className: styles$y[`${baseClass$H}__loader`]
|
|
552
788
|
}), icon2 && React.cloneElement(icon2, {
|
|
553
|
-
className: cx(styles$
|
|
789
|
+
className: cx(styles$y[`${baseClass$H}__icon`], styles$y[`${baseClass$H}__icon--${iconPosition}`]),
|
|
554
790
|
disabled
|
|
555
791
|
}), /* @__PURE__ */ React.createElement("div", {
|
|
556
|
-
className: styles$
|
|
792
|
+
className: styles$y[`${baseClass$H}__content`]
|
|
557
793
|
}, children));
|
|
558
794
|
};
|
|
559
|
-
const btn = "lc-
|
|
560
|
-
var styles$
|
|
561
|
-
"
|
|
795
|
+
const btn = "lc-SegmentedControl-module__btn___tfsvL";
|
|
796
|
+
var styles$x = {
|
|
797
|
+
"segmented-control": "lc-SegmentedControl-module__segmented-control___LHWSk",
|
|
562
798
|
btn,
|
|
563
|
-
"btn--active": "lc-
|
|
564
|
-
"btn--compact": "lc-
|
|
565
|
-
"btn--medium": "lc-
|
|
566
|
-
"btn--large": "lc-
|
|
799
|
+
"btn--active": "lc-SegmentedControl-module__btn--active___Za-th",
|
|
800
|
+
"btn--compact": "lc-SegmentedControl-module__btn--compact___gcSwq",
|
|
801
|
+
"btn--medium": "lc-SegmentedControl-module__btn--medium___w3UzC",
|
|
802
|
+
"btn--large": "lc-SegmentedControl-module__btn--large___yHPw4"
|
|
567
803
|
};
|
|
568
804
|
function noop() {
|
|
569
805
|
}
|
|
570
|
-
const baseClass$
|
|
571
|
-
const
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
"initialIndex"
|
|
588
|
-
]);
|
|
589
|
-
const mergedClassName = cx(styles$l[baseClass$p], className);
|
|
590
|
-
const [currentStateIndex, setCurrentStateIndex] = React.useState(initialIndex);
|
|
591
|
-
const isControlled = typeof currentIndex === "number";
|
|
592
|
-
const _currentIndex = isControlled ? currentIndex : currentStateIndex;
|
|
593
|
-
const handleClick = (index2, event) => {
|
|
806
|
+
const baseClass$G = "segmented-control";
|
|
807
|
+
const SegmentedControl = ({
|
|
808
|
+
size = "medium",
|
|
809
|
+
buttons,
|
|
810
|
+
className,
|
|
811
|
+
initialId,
|
|
812
|
+
currentId,
|
|
813
|
+
fullWidth = false,
|
|
814
|
+
onButtonClick = noop
|
|
815
|
+
}) => {
|
|
816
|
+
const mergedClassName = cx(styles$x[baseClass$G], className);
|
|
817
|
+
const [currentStateId, setCurrentStateId] = React.useState(() => initialId);
|
|
818
|
+
const isControlled = typeof currentId === "string";
|
|
819
|
+
React.useEffect(() => {
|
|
820
|
+
isControlled && setCurrentStateId(currentId);
|
|
821
|
+
}, [currentId]);
|
|
822
|
+
const handleClick = (id, event) => {
|
|
594
823
|
if (!isControlled) {
|
|
595
|
-
|
|
824
|
+
setCurrentStateId(id);
|
|
596
825
|
}
|
|
597
|
-
|
|
826
|
+
onButtonClick(id, event);
|
|
598
827
|
};
|
|
599
|
-
|
|
828
|
+
const buttonSet = buttons.map(({ id, label, loading, disabled, icon: icon2 }) => {
|
|
829
|
+
const isPressed = id === currentStateId;
|
|
830
|
+
const activityStyles = isPressed ? styles$x["btn--active"] : "";
|
|
831
|
+
const loadingStatus = isPressed ? false : loading;
|
|
832
|
+
return /* @__PURE__ */ React.createElement(Button, {
|
|
833
|
+
key: id,
|
|
834
|
+
fullWidth,
|
|
835
|
+
loading: loadingStatus,
|
|
836
|
+
disabled,
|
|
837
|
+
"aria-pressed": isPressed,
|
|
838
|
+
kind: "secondary",
|
|
839
|
+
icon: icon2,
|
|
840
|
+
className: cx(styles$x["btn"], styles$x[`btn--${size}`], activityStyles),
|
|
841
|
+
onClick: (event) => {
|
|
842
|
+
handleClick(id, event);
|
|
843
|
+
}
|
|
844
|
+
}, label);
|
|
845
|
+
});
|
|
846
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
600
847
|
role: "group",
|
|
601
848
|
className: mergedClassName
|
|
602
|
-
},
|
|
603
|
-
fullWidth,
|
|
604
|
-
size,
|
|
605
|
-
kind: "secondary",
|
|
606
|
-
type: "button",
|
|
607
|
-
onClick: (event) => {
|
|
608
|
-
handleClick(i, event);
|
|
609
|
-
if (child.props.onClick) {
|
|
610
|
-
child.props.onClick(event);
|
|
611
|
-
}
|
|
612
|
-
},
|
|
613
|
-
className: cx(styles$l["btn"], styles$l[`btn--${size}`], i === _currentIndex && styles$l["btn--active"])
|
|
614
|
-
})));
|
|
849
|
+
}, buttonSet);
|
|
615
850
|
};
|
|
616
851
|
const card = "lc-Card-module__card___GqMm2";
|
|
617
|
-
const
|
|
618
|
-
const
|
|
619
|
-
const
|
|
620
|
-
|
|
852
|
+
const card__header = "lc-Card-module__card__header___0ptfD";
|
|
853
|
+
const card__header__image = "lc-Card-module__card__header__image___QMwSu";
|
|
854
|
+
const card__header__heading = "lc-Card-module__card__header__heading___Wkikx";
|
|
855
|
+
const card__header__heading__title = "lc-Card-module__card__header__heading__title___Uxi8s";
|
|
856
|
+
const card__header__heading__description = "lc-Card-module__card__header__heading__description___6LnOK";
|
|
857
|
+
const card__content = "lc-Card-module__card__content___KuDcc";
|
|
858
|
+
const card__actions = "lc-Card-module__card__actions___q9sAo";
|
|
859
|
+
const card__actions__line = "lc-Card-module__card__actions__line___TF1bt";
|
|
860
|
+
const card__actions__buttons = "lc-Card-module__card__actions__buttons___PDMMR";
|
|
861
|
+
var styles$w = {
|
|
621
862
|
card,
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
863
|
+
card__header,
|
|
864
|
+
card__header__image,
|
|
865
|
+
card__header__heading,
|
|
866
|
+
card__header__heading__title,
|
|
867
|
+
card__header__heading__description,
|
|
868
|
+
"card__header__no-image": "lc-Card-module__card__header__no-image___UcnNY",
|
|
869
|
+
card__content,
|
|
870
|
+
"card__expanded-content": "lc-Card-module__card__expanded-content___yB-QL",
|
|
871
|
+
card__actions,
|
|
872
|
+
card__actions__line,
|
|
873
|
+
card__actions__buttons,
|
|
874
|
+
"card__actions__buttons-expander": "lc-Card-module__card__actions__buttons-expander___lz4h-"
|
|
625
875
|
};
|
|
626
|
-
const
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
876
|
+
const baseClass$F = "card";
|
|
877
|
+
const headerClass = `${baseClass$F}__header`;
|
|
878
|
+
const headingClass = `${headerClass}__heading`;
|
|
879
|
+
const actionsClass = `${baseClass$F}__actions`;
|
|
880
|
+
const noImageClass = `${headerClass}__no-image`;
|
|
881
|
+
const Card = (_k) => {
|
|
882
|
+
var _l = _k, {
|
|
883
|
+
alt,
|
|
884
|
+
buttonsOptions = [],
|
|
630
885
|
children,
|
|
631
|
-
className
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
886
|
+
className,
|
|
887
|
+
description,
|
|
888
|
+
expandableContent,
|
|
889
|
+
src,
|
|
890
|
+
title
|
|
891
|
+
} = _l, divProps = __objRest(_l, [
|
|
892
|
+
"alt",
|
|
893
|
+
"buttonsOptions",
|
|
635
894
|
"children",
|
|
636
|
-
"className"
|
|
895
|
+
"className",
|
|
896
|
+
"description",
|
|
897
|
+
"expandableContent",
|
|
898
|
+
"src",
|
|
899
|
+
"title"
|
|
637
900
|
]);
|
|
638
|
-
|
|
901
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
902
|
+
const expandIcon = isExpanded ? ChevronUp : ChevronDown;
|
|
903
|
+
const expandButtonText = isExpanded ? "Hide" : "Show more";
|
|
904
|
+
const shouldShowActionButtons = (buttonsOptions == null ? void 0 : buttonsOptions.length) > 0;
|
|
905
|
+
const shouldShowExpandAction = !!expandableContent;
|
|
906
|
+
const shouldShowActions = shouldShowActionButtons || shouldShowExpandAction;
|
|
907
|
+
const isTitleAvailable = title;
|
|
908
|
+
const isImageAvailable = src;
|
|
909
|
+
const noImageAvailable = isImageAvailable ? "" : styles$w[noImageClass];
|
|
910
|
+
return /* @__PURE__ */ React.createElement("div", __spreadValues({
|
|
911
|
+
className: cx(styles$w[baseClass$F], className)
|
|
912
|
+
}, divProps), isTitleAvailable && /* @__PURE__ */ React.createElement("div", {
|
|
913
|
+
className: cx(styles$w[headerClass], noImageAvailable)
|
|
914
|
+
}, isImageAvailable && /* @__PURE__ */ React.createElement("img", {
|
|
915
|
+
alt,
|
|
916
|
+
className: styles$w[`${headerClass}__image`],
|
|
917
|
+
src
|
|
918
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
919
|
+
className: styles$w[headingClass]
|
|
920
|
+
}, /* @__PURE__ */ React.createElement(Heading, {
|
|
921
|
+
size: "sm",
|
|
922
|
+
className: styles$w[`${headingClass}__title`]
|
|
923
|
+
}, title), /* @__PURE__ */ React.createElement(Text, {
|
|
924
|
+
size: "sm",
|
|
925
|
+
className: styles$w[`${headingClass}__description`]
|
|
926
|
+
}, description))), /* @__PURE__ */ React.createElement(Text, {
|
|
639
927
|
as: "div",
|
|
640
928
|
size: "md",
|
|
641
|
-
className:
|
|
642
|
-
},
|
|
929
|
+
className: styles$w[`${baseClass$F}__content`]
|
|
930
|
+
}, children), isExpanded && /* @__PURE__ */ React.createElement(Text, {
|
|
643
931
|
as: "div",
|
|
644
|
-
size: "
|
|
645
|
-
className: styles$
|
|
646
|
-
},
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
932
|
+
size: "md",
|
|
933
|
+
className: styles$w[`${baseClass$F}__expanded-content`]
|
|
934
|
+
}, expandableContent), shouldShowActions && /* @__PURE__ */ React.createElement("div", {
|
|
935
|
+
className: styles$w[actionsClass]
|
|
936
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
937
|
+
className: styles$w[`${actionsClass}__line`]
|
|
938
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
939
|
+
className: styles$w[`${actionsClass}__buttons`]
|
|
940
|
+
}, shouldShowActionButtons && buttonsOptions.map(({ kind, onClick, children: buttonChildren }) => /* @__PURE__ */ React.createElement(Button, {
|
|
941
|
+
size: "compact",
|
|
942
|
+
kind,
|
|
943
|
+
onClick
|
|
944
|
+
}, buttonChildren)), shouldShowExpandAction && /* @__PURE__ */ React.createElement(Button, {
|
|
945
|
+
className: styles$w[`${actionsClass}__buttons-expander`],
|
|
946
|
+
kind: "plain",
|
|
947
|
+
iconPosition: "right",
|
|
948
|
+
icon: /* @__PURE__ */ React.createElement(Icon, {
|
|
949
|
+
source: expandIcon
|
|
950
|
+
}),
|
|
951
|
+
onClick: () => setIsExpanded(!isExpanded)
|
|
952
|
+
}, expandButtonText))));
|
|
953
|
+
};
|
|
954
|
+
var styles$v = {
|
|
955
|
+
"field-description": "lc-FieldDescription-module__field-description___IcRDH"
|
|
956
|
+
};
|
|
957
|
+
const baseClass$E = "field-description";
|
|
958
|
+
const FieldDescription = (_m) => {
|
|
959
|
+
var _n = _m, {
|
|
960
|
+
children,
|
|
961
|
+
className = ""
|
|
962
|
+
} = _n, props = __objRest(_n, [
|
|
963
|
+
"children",
|
|
964
|
+
"className"
|
|
965
|
+
]);
|
|
966
|
+
const mergedClassNames = cx(styles$v[baseClass$E], className);
|
|
967
|
+
return /* @__PURE__ */ React.createElement(Text, __spreadProps(__spreadValues({
|
|
968
|
+
as: "span",
|
|
969
|
+
size: "sm"
|
|
970
|
+
}, props), {
|
|
971
|
+
className: mergedClassNames
|
|
972
|
+
}), children);
|
|
652
973
|
};
|
|
653
974
|
const checkbox = "lc-Checkbox-module__checkbox___G7nTf";
|
|
654
975
|
const checkbox__label = "lc-Checkbox-module__checkbox__label___-o01x";
|
|
@@ -657,7 +978,7 @@ const checkbox__checkmark = "lc-Checkbox-module__checkbox__checkmark___16pfY";
|
|
|
657
978
|
const checkbox__input = "lc-Checkbox-module__checkbox__input___YLbVF";
|
|
658
979
|
const checkbox__text = "lc-Checkbox-module__checkbox__text___P2SIq";
|
|
659
980
|
const checkbox__helper = "lc-Checkbox-module__checkbox__helper___YSJ-n";
|
|
660
|
-
var styles$
|
|
981
|
+
var styles$u = {
|
|
661
982
|
checkbox,
|
|
662
983
|
checkbox__label,
|
|
663
984
|
checkbox__square,
|
|
@@ -668,39 +989,612 @@ var styles$j = {
|
|
|
668
989
|
"checkbox--disabled": "lc-Checkbox-module__checkbox--disabled___-lAqW",
|
|
669
990
|
checkbox__helper
|
|
670
991
|
};
|
|
671
|
-
const baseClass$
|
|
672
|
-
const Checkbox = (
|
|
673
|
-
var
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
className: styles$
|
|
992
|
+
const baseClass$D = "checkbox";
|
|
993
|
+
const Checkbox = React.forwardRef((_o, ref) => {
|
|
994
|
+
var _p = _o, { checked, disabled, children, description, className } = _p, restInputProps = __objRest(_p, ["checked", "disabled", "children", "description", "className"]);
|
|
995
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
996
|
+
className: cx(styles$u[baseClass$D], className, {
|
|
997
|
+
[styles$u[`${baseClass$D}--selected`]]: checked,
|
|
998
|
+
[styles$u[`${baseClass$D}--disabled`]]: disabled
|
|
999
|
+
})
|
|
1000
|
+
}, /* @__PURE__ */ React.createElement("label", {
|
|
1001
|
+
className: styles$u[`${baseClass$D}__label`]
|
|
1002
|
+
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({}, restInputProps), {
|
|
1003
|
+
ref,
|
|
1004
|
+
checked,
|
|
1005
|
+
disabled,
|
|
1006
|
+
className: styles$u[`${baseClass$D}__input`],
|
|
681
1007
|
type: "checkbox"
|
|
682
1008
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
683
|
-
className:
|
|
1009
|
+
className: styles$u[`${baseClass$D}__square`]
|
|
684
1010
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
685
1011
|
source: Check,
|
|
686
|
-
|
|
687
|
-
size:
|
|
688
|
-
className: styles$
|
|
689
|
-
})))
|
|
1012
|
+
kind: "inverted",
|
|
1013
|
+
size: "xsmall",
|
|
1014
|
+
className: styles$u[`${baseClass$D}__checkmark`]
|
|
1015
|
+
}))), children && /* @__PURE__ */ React.createElement(Text, {
|
|
1016
|
+
as: "div",
|
|
1017
|
+
size: "md",
|
|
1018
|
+
className: styles$u[`${baseClass$D}__text`]
|
|
1019
|
+
}, children)), description && /* @__PURE__ */ React.createElement(FieldDescription, {
|
|
1020
|
+
className: styles$u[`${baseClass$D}__helper`]
|
|
1021
|
+
}, description));
|
|
1022
|
+
});
|
|
1023
|
+
var styles$t = {
|
|
1024
|
+
"date-picker": "lc-DatePicker-module__date-picker___9AqJ2",
|
|
1025
|
+
"date-picker--interaction-disabled": "lc-DatePicker-module__date-picker--interaction-disabled___-zn8o",
|
|
1026
|
+
"date-picker__day": "lc-DatePicker-module__date-picker__day___ZTSw9",
|
|
1027
|
+
"date-picker__day--disabled": "lc-DatePicker-module__date-picker__day--disabled___4O6yW",
|
|
1028
|
+
"date-picker__day--selected": "lc-DatePicker-module__date-picker__day--selected___1D1tC",
|
|
1029
|
+
"date-picker__day--outside": "lc-DatePicker-module__date-picker__day--outside___ptNdC",
|
|
1030
|
+
"date-picker__day-content": "lc-DatePicker-module__date-picker__day-content___rDIa0",
|
|
1031
|
+
"date-picker__wrapper": "lc-DatePicker-module__date-picker__wrapper___tNp4l",
|
|
1032
|
+
"date-picker__months": "lc-DatePicker-module__date-picker__months___QuPb0",
|
|
1033
|
+
"date-picker__month": "lc-DatePicker-module__date-picker__month___239nh",
|
|
1034
|
+
"date-picker__nav-bar": "lc-DatePicker-module__date-picker__nav-bar___u-l17",
|
|
1035
|
+
"date-picker__nav-button": "lc-DatePicker-module__date-picker__nav-button___1Ysdp",
|
|
1036
|
+
"date-picker__nav-button--interaction-disabled": "lc-DatePicker-module__date-picker__nav-button--interaction-disabled___Ivjrx",
|
|
1037
|
+
"date-picker__caption": "lc-DatePicker-module__date-picker__caption___XPgZJ",
|
|
1038
|
+
"date-picker__weekdays": "lc-DatePicker-module__date-picker__weekdays___kpTY9",
|
|
1039
|
+
"date-picker__weekdays-row": "lc-DatePicker-module__date-picker__weekdays-row___tGgay",
|
|
1040
|
+
"date-picker__weekday": "lc-DatePicker-module__date-picker__weekday___3FCx8",
|
|
1041
|
+
"date-picker__body": "lc-DatePicker-module__date-picker__body___toP1u",
|
|
1042
|
+
"date-picker__week": "lc-DatePicker-module__date-picker__week___nZI1x",
|
|
1043
|
+
"date-picker__day-wrapper": "lc-DatePicker-module__date-picker__day-wrapper___gGeeJ",
|
|
1044
|
+
"date-picker__day--today": "lc-DatePicker-module__date-picker__day--today___LL51c",
|
|
1045
|
+
"date-picker__footer": "lc-DatePicker-module__date-picker__footer___cXMQ5",
|
|
1046
|
+
"date-picker__input": "lc-DatePicker-module__date-picker__input___r6qih",
|
|
1047
|
+
"date-picker__input-overlay-wrapper": "lc-DatePicker-module__date-picker__input-overlay-wrapper___vmC0M",
|
|
1048
|
+
"date-picker__input-overlay": "lc-DatePicker-module__date-picker__input-overlay___eJ9D0",
|
|
1049
|
+
"date-picker--range": "lc-DatePicker-module__date-picker--range___ZU-7k",
|
|
1050
|
+
"date-picker__day--start": "lc-DatePicker-module__date-picker__day--start___-oB8U",
|
|
1051
|
+
"date-picker__day--end": "lc-DatePicker-module__date-picker__day--end___TtN5P",
|
|
1052
|
+
"date-picker__day--single": "lc-DatePicker-module__date-picker__day--single___biWcB",
|
|
1053
|
+
"date-picker__day--sunday": "lc-DatePicker-module__date-picker__day--sunday___JEnhV",
|
|
1054
|
+
"date-picker__day--monday": "lc-DatePicker-module__date-picker__day--monday___NXYIr",
|
|
1055
|
+
"date-picker--range__select-input": "lc-DatePicker-module__date-picker--range__select-input___6pyj3",
|
|
1056
|
+
"date-picker--range__calendars-wrapper": "lc-DatePicker-module__date-picker--range__calendars-wrapper___8nWaW",
|
|
1057
|
+
"date-picker__navbar-buttons-wrapper": "lc-DatePicker-module__date-picker__navbar-buttons-wrapper___Hnksb"
|
|
690
1058
|
};
|
|
691
|
-
|
|
692
|
-
|
|
1059
|
+
const baseClass$C = "date-picker";
|
|
1060
|
+
const DatePickerNavbar = (props) => {
|
|
1061
|
+
const {
|
|
1062
|
+
onPreviousClick,
|
|
1063
|
+
onMonthChange,
|
|
1064
|
+
onNextClick,
|
|
1065
|
+
showNextButton,
|
|
1066
|
+
showPreviousButton,
|
|
1067
|
+
className,
|
|
1068
|
+
classNames,
|
|
1069
|
+
numberOfMonths,
|
|
1070
|
+
month,
|
|
1071
|
+
fromMonth,
|
|
1072
|
+
toMonth
|
|
1073
|
+
} = props;
|
|
1074
|
+
const handlePrevClick = () => {
|
|
1075
|
+
if (typeof onPreviousClick === "function") {
|
|
1076
|
+
onPreviousClick();
|
|
1077
|
+
}
|
|
1078
|
+
};
|
|
1079
|
+
const handleNextClick = () => {
|
|
1080
|
+
if (typeof onNextClick === "function") {
|
|
1081
|
+
onNextClick();
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
const handlePrevYearClick = () => {
|
|
1085
|
+
if (!fromMonth) {
|
|
1086
|
+
const newMonth2 = subMonths(month, 12);
|
|
1087
|
+
return onMonthChange(newMonth2);
|
|
1088
|
+
}
|
|
1089
|
+
const diff = Math.abs(differenceInCalendarMonths(month, fromMonth));
|
|
1090
|
+
const newMonth = subMonths(month, !Number.isNaN(diff) && diff > 12 ? 12 : diff);
|
|
1091
|
+
return onMonthChange(newMonth);
|
|
1092
|
+
};
|
|
1093
|
+
const handleNextYearClick = () => {
|
|
1094
|
+
if (!toMonth) {
|
|
1095
|
+
const newMonth2 = addMonths(month, 12);
|
|
1096
|
+
return onMonthChange(newMonth2);
|
|
1097
|
+
}
|
|
1098
|
+
const diff = Math.abs(differenceInCalendarMonths(toMonth, month));
|
|
1099
|
+
const newMonth = addMonths(month, !Number.isNaN(diff) && diff > 12 ? 12 : diff);
|
|
1100
|
+
if (numberOfMonths === 2 && isSameMonth(newMonth, toMonth)) {
|
|
1101
|
+
return onMonthChange(subMonths(newMonth, 1));
|
|
1102
|
+
}
|
|
1103
|
+
return onMonthChange(newMonth);
|
|
1104
|
+
};
|
|
1105
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1106
|
+
className
|
|
1107
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1108
|
+
className: styles$t[`${baseClass$C}__navbar-buttons-wrapper`]
|
|
1109
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
1110
|
+
"data-testid": "date-picker-prev-year-button",
|
|
1111
|
+
className: cx({
|
|
1112
|
+
[classNames.navButtonPrev]: true,
|
|
1113
|
+
[classNames.navButtonInteractionDisabled]: !showPreviousButton
|
|
1114
|
+
}),
|
|
1115
|
+
onClick: handlePrevYearClick
|
|
1116
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
1117
|
+
source: DoubleArrowLeft,
|
|
1118
|
+
kind: "subtle"
|
|
1119
|
+
})), /* @__PURE__ */ React.createElement("button", {
|
|
1120
|
+
"data-testid": "date-picker-prev-month-button",
|
|
1121
|
+
className: cx({
|
|
1122
|
+
[classNames.navButtonPrev]: true,
|
|
1123
|
+
[classNames.navButtonInteractionDisabled]: !showPreviousButton
|
|
1124
|
+
}),
|
|
1125
|
+
onClick: handlePrevClick
|
|
1126
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
1127
|
+
source: ChevronLeft,
|
|
1128
|
+
kind: "subtle"
|
|
1129
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
1130
|
+
className: styles$t[`${baseClass$C}__navbar-buttons-wrapper`]
|
|
1131
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
1132
|
+
"data-testid": "date-picker-next-month-button",
|
|
1133
|
+
className: cx({
|
|
1134
|
+
[classNames.navButtonNext]: true,
|
|
1135
|
+
[classNames.navButtonInteractionDisabled]: !showNextButton
|
|
1136
|
+
}),
|
|
1137
|
+
onClick: handleNextClick
|
|
1138
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
1139
|
+
source: ChevronRight,
|
|
1140
|
+
kind: "subtle"
|
|
1141
|
+
})), /* @__PURE__ */ React.createElement("button", {
|
|
1142
|
+
"data-testid": "date-picker-next-year-button",
|
|
1143
|
+
className: cx({
|
|
1144
|
+
[classNames.navButtonNext]: true,
|
|
1145
|
+
[classNames.navButtonInteractionDisabled]: !showNextButton
|
|
1146
|
+
}),
|
|
1147
|
+
onClick: handleNextYearClick
|
|
1148
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
1149
|
+
source: DoubleArrowRight,
|
|
1150
|
+
kind: "subtle"
|
|
1151
|
+
}))));
|
|
693
1152
|
};
|
|
694
|
-
const baseClass$
|
|
695
|
-
const
|
|
696
|
-
|
|
1153
|
+
const baseClass$B = "date-picker";
|
|
1154
|
+
const isDateWithinRange = (date, range) => {
|
|
1155
|
+
const { from, to } = range;
|
|
1156
|
+
if (to && !isSameDay(date, to) && isAfter(date, to)) {
|
|
1157
|
+
return false;
|
|
1158
|
+
}
|
|
1159
|
+
if (from && !isSameDay(date, from) && !isAfter(date, from)) {
|
|
1160
|
+
return false;
|
|
1161
|
+
}
|
|
1162
|
+
return true;
|
|
1163
|
+
};
|
|
1164
|
+
const calculateDatePickerMonth = (initialFromDate, initialToDate, toMonth) => {
|
|
1165
|
+
if (!initialToDate) {
|
|
1166
|
+
return subMonths(toMonth || new Date(), 1);
|
|
1167
|
+
}
|
|
1168
|
+
const forcePreviousMonth = initialFromDate && !isSameMonth(initialFromDate, initialToDate);
|
|
1169
|
+
if (forcePreviousMonth || toMonth && isSameMonth(initialToDate, toMonth)) {
|
|
1170
|
+
return subMonths(initialToDate, 1);
|
|
1171
|
+
}
|
|
1172
|
+
return initialToDate;
|
|
1173
|
+
};
|
|
1174
|
+
const getRangeDatePickerModifiers = (from, to) => {
|
|
1175
|
+
const base = {
|
|
1176
|
+
[styles$t[`${baseClass$B}__day--monday`]]: { daysOfWeek: [1] },
|
|
1177
|
+
[styles$t[`${baseClass$B}__day--sunday`]]: { daysOfWeek: [0] },
|
|
1178
|
+
[styles$t[`${baseClass$B}__day--start`]]: from,
|
|
1179
|
+
[styles$t[`${baseClass$B}__day--end`]]: from
|
|
1180
|
+
};
|
|
1181
|
+
if (!to || !from)
|
|
1182
|
+
return base;
|
|
1183
|
+
const diff = differenceInCalendarDays(to, from);
|
|
1184
|
+
if (diff > 0) {
|
|
1185
|
+
return __spreadProps(__spreadValues({}, base), {
|
|
1186
|
+
[styles$t[`${baseClass$B}__day--end`]]: to
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
if (diff < 0) {
|
|
1190
|
+
return __spreadProps(__spreadValues({}, base), {
|
|
1191
|
+
[styles$t[`${baseClass$B}__day--start`]]: to
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
return base;
|
|
1195
|
+
};
|
|
1196
|
+
const getSelectedOption = (itemId, options) => {
|
|
1197
|
+
const selectedOption = options.find((item) => {
|
|
1198
|
+
return item.id === itemId;
|
|
1199
|
+
});
|
|
1200
|
+
return selectedOption ? selectedOption : void 0;
|
|
1201
|
+
};
|
|
1202
|
+
const isSelectingFirstDay = (from, to) => {
|
|
1203
|
+
const isRangeSelected = from && to;
|
|
1204
|
+
return Boolean(!from || isRangeSelected);
|
|
1205
|
+
};
|
|
1206
|
+
const getInitialStateFromProps = (props) => {
|
|
1207
|
+
const state = {};
|
|
1208
|
+
if (!props.initialSelectedItemKey) {
|
|
1209
|
+
return state;
|
|
1210
|
+
}
|
|
1211
|
+
const selectedOption = getSelectedOption(props.initialSelectedItemKey, props.options);
|
|
1212
|
+
if (!selectedOption) {
|
|
1213
|
+
return {};
|
|
1214
|
+
}
|
|
1215
|
+
state.selectedItem = props.initialSelectedItemKey;
|
|
1216
|
+
if (!selectedOption.isManual) {
|
|
1217
|
+
return state;
|
|
1218
|
+
}
|
|
1219
|
+
if (props.initialFromDate) {
|
|
1220
|
+
state.from = props.initialFromDate;
|
|
1221
|
+
}
|
|
1222
|
+
if (props.initialToDate) {
|
|
1223
|
+
state.to = props.initialToDate;
|
|
1224
|
+
state.temporaryTo = props.initialToDate;
|
|
1225
|
+
}
|
|
1226
|
+
return state;
|
|
1227
|
+
};
|
|
1228
|
+
const getDatePickerClassNames = (range, classNames) => __spreadValues({
|
|
1229
|
+
container: cx({
|
|
1230
|
+
[styles$t[`${baseClass$B}`]]: true,
|
|
1231
|
+
[styles$t[`${baseClass$B}--range`]]: range
|
|
1232
|
+
}),
|
|
1233
|
+
wrapper: styles$t[`${baseClass$B}__wrapper`],
|
|
1234
|
+
interactionDisabled: styles$t[`${baseClass$B}--interaction-disabled`],
|
|
1235
|
+
months: styles$t[`${baseClass$B}__months`],
|
|
1236
|
+
month: styles$t[`${baseClass$B}__month`],
|
|
1237
|
+
navBar: styles$t[`${baseClass$B}__nav-bar`],
|
|
1238
|
+
navButtonPrev: cx(styles$t[`${baseClass$B}__nav-button`], styles$t[`${baseClass$B}__nav-button--prev`]),
|
|
1239
|
+
navButtonNext: cx(styles$t[`${baseClass$B}__nav-button`], styles$t[`${baseClass$B}__nav-button--next`]),
|
|
1240
|
+
navButtonInteractionDisabled: styles$t[`${baseClass$B}__nav-button--interaction-disabled`],
|
|
1241
|
+
caption: styles$t[`${baseClass$B}__caption`],
|
|
1242
|
+
weekdays: styles$t[`${baseClass$B}__weekdays`],
|
|
1243
|
+
weekdaysRow: styles$t[`${baseClass$B}__weekdays-row`],
|
|
1244
|
+
weekday: styles$t[`${baseClass$B}__weekday`],
|
|
1245
|
+
body: styles$t[`${baseClass$B}__body`],
|
|
1246
|
+
week: styles$t[`${baseClass$B}__week`],
|
|
1247
|
+
weekNumber: styles$t[`${baseClass$B}__week-number`],
|
|
1248
|
+
day: styles$t[`${baseClass$B}__day`],
|
|
1249
|
+
footer: styles$t[`${baseClass$B}__footer`],
|
|
1250
|
+
todayButton: styles$t[`${baseClass$B}__today-button`],
|
|
1251
|
+
today: styles$t[`${baseClass$B}__day--today`],
|
|
1252
|
+
selected: styles$t[`${baseClass$B}__day--selected`],
|
|
1253
|
+
disabled: styles$t[`${baseClass$B}__day--disabled`],
|
|
1254
|
+
outside: styles$t[`${baseClass$B}__day--outside`],
|
|
1255
|
+
start: styles$t[`${baseClass$B}__day--start`],
|
|
1256
|
+
end: styles$t[`${baseClass$B}__day--end`]
|
|
1257
|
+
}, classNames);
|
|
1258
|
+
const baseClass$A = "date-picker";
|
|
1259
|
+
const defaultDayRenderer = (day) => {
|
|
1260
|
+
const date = day.getDate();
|
|
1261
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1262
|
+
className: styles$t[`${baseClass$A}__day-wrapper`]
|
|
1263
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1264
|
+
className: styles$t[`${baseClass$A}__day-content`]
|
|
1265
|
+
}, date));
|
|
1266
|
+
};
|
|
1267
|
+
const DatePickerComponent = (props) => {
|
|
1268
|
+
const _a = props, {
|
|
1269
|
+
classNames,
|
|
1270
|
+
range,
|
|
1271
|
+
toMonth,
|
|
1272
|
+
month,
|
|
1273
|
+
fromMonth,
|
|
1274
|
+
firstDayOfWeek: propsFirstDayOfWeek,
|
|
1275
|
+
numberOfMonths,
|
|
1276
|
+
navbarElement,
|
|
1277
|
+
renderDay,
|
|
1278
|
+
innerRef
|
|
1279
|
+
} = _a, restProps = __objRest(_a, [
|
|
1280
|
+
"classNames",
|
|
1281
|
+
"range",
|
|
1282
|
+
"toMonth",
|
|
1283
|
+
"month",
|
|
1284
|
+
"fromMonth",
|
|
1285
|
+
"firstDayOfWeek",
|
|
1286
|
+
"numberOfMonths",
|
|
1287
|
+
"navbarElement",
|
|
1288
|
+
"renderDay",
|
|
1289
|
+
"innerRef"
|
|
1290
|
+
]);
|
|
1291
|
+
const [currentMonth, setCurrentMonth] = React.useState(month || new Date());
|
|
1292
|
+
React.useEffect(() => {
|
|
1293
|
+
if (month && month !== currentMonth) {
|
|
1294
|
+
setCurrentMonth(month);
|
|
1295
|
+
}
|
|
1296
|
+
}, [month, currentMonth]);
|
|
1297
|
+
React.useEffect(() => {
|
|
1298
|
+
if (toMonth) {
|
|
1299
|
+
if (!isDateWithinRange(currentMonth, { from: fromMonth, to: toMonth })) {
|
|
1300
|
+
setCurrentMonth(toMonth);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
}, [currentMonth, props.toMonth, props.fromMonth]);
|
|
1304
|
+
const handleMonthChange = React.useCallback((month2) => {
|
|
1305
|
+
if (props.onMonthChange && month2) {
|
|
1306
|
+
props.onMonthChange(month2);
|
|
1307
|
+
return;
|
|
1308
|
+
}
|
|
1309
|
+
setCurrentMonth(month2);
|
|
1310
|
+
}, [month, props.onMonthChange]);
|
|
1311
|
+
let firstDayOfWeek = 1;
|
|
1312
|
+
if (propsFirstDayOfWeek === 0 || propsFirstDayOfWeek && propsFirstDayOfWeek < 7) {
|
|
1313
|
+
firstDayOfWeek = propsFirstDayOfWeek;
|
|
1314
|
+
}
|
|
1315
|
+
const datePickerClassNames = React.useMemo(() => getDatePickerClassNames(range, classNames), [range, classNames]);
|
|
1316
|
+
return /* @__PURE__ */ React.createElement(ReactDayPicker, __spreadValues({
|
|
1317
|
+
navbarElement: navbarElement || /* @__PURE__ */ React.createElement(DatePickerNavbar, {
|
|
1318
|
+
month: currentMonth,
|
|
1319
|
+
classNames: datePickerClassNames,
|
|
1320
|
+
numberOfMonths,
|
|
1321
|
+
onMonthChange: handleMonthChange,
|
|
1322
|
+
toMonth,
|
|
1323
|
+
fromMonth
|
|
1324
|
+
}),
|
|
1325
|
+
ref: innerRef,
|
|
1326
|
+
classNames: datePickerClassNames,
|
|
1327
|
+
numberOfMonths,
|
|
1328
|
+
toMonth,
|
|
1329
|
+
fromMonth,
|
|
1330
|
+
firstDayOfWeek,
|
|
1331
|
+
month: currentMonth,
|
|
1332
|
+
renderDay: renderDay || defaultDayRenderer
|
|
1333
|
+
}, restProps));
|
|
1334
|
+
};
|
|
1335
|
+
const DatePicker = React.forwardRef((props, ref) => /* @__PURE__ */ React.createElement(DatePickerComponent, __spreadValues({
|
|
1336
|
+
innerRef: ref
|
|
1337
|
+
}, props)));
|
|
1338
|
+
DatePicker.displayName = "DatePicker";
|
|
1339
|
+
var RangeDatePickerAction = /* @__PURE__ */ ((RangeDatePickerAction2) => {
|
|
1340
|
+
RangeDatePickerAction2["NEW_SELECTED_ITEM"] = "NEW_SELECTED_ITEM";
|
|
1341
|
+
RangeDatePickerAction2["NEW_TEMPORARY_TO_VALUE"] = "NEW_TEMPORARY_TO_VALUE";
|
|
1342
|
+
RangeDatePickerAction2["CLEAR"] = "CLEAR";
|
|
1343
|
+
RangeDatePickerAction2["SET_FROM"] = "SET_FROM";
|
|
1344
|
+
RangeDatePickerAction2["SET_TO"] = "SET_TO";
|
|
1345
|
+
RangeDatePickerAction2["SELECT_FIRST_DAY"] = "SELECT_FIRST_DAY";
|
|
1346
|
+
RangeDatePickerAction2["SELECT_SECOND_DAY_AS_FROM"] = "SELECT_SECOND_DAY_AS_FROM";
|
|
1347
|
+
RangeDatePickerAction2["SELECT_SECOND_DAY_AS_TO"] = "SELECT_SECOND_DAY_AS_TO";
|
|
1348
|
+
RangeDatePickerAction2["CURRENT_MONTH_CHANGE"] = "CURRENT_MONTH_CHANGE";
|
|
1349
|
+
return RangeDatePickerAction2;
|
|
1350
|
+
})(RangeDatePickerAction || {});
|
|
1351
|
+
const useRangeDatePickerState = (props) => {
|
|
1352
|
+
const initialCurrentMonth = calculateDatePickerMonth(props.initialFromDate, props.initialToDate, props.toMonth);
|
|
1353
|
+
const defaultInitialState = {
|
|
1354
|
+
selectedItem: null,
|
|
1355
|
+
from: void 0,
|
|
1356
|
+
to: void 0,
|
|
1357
|
+
temporaryTo: void 0,
|
|
1358
|
+
currentMonth: initialCurrentMonth
|
|
1359
|
+
};
|
|
1360
|
+
const initialState = __spreadValues(__spreadValues({}, defaultInitialState), getInitialStateFromProps(props));
|
|
1361
|
+
function reducer(state, action) {
|
|
1362
|
+
switch (action.type) {
|
|
1363
|
+
case RangeDatePickerAction.NEW_SELECTED_ITEM:
|
|
1364
|
+
return {
|
|
1365
|
+
selectedItem: action.payload.selectedItem,
|
|
1366
|
+
from: void 0,
|
|
1367
|
+
to: void 0,
|
|
1368
|
+
temporaryTo: void 0,
|
|
1369
|
+
currentMonth: initialCurrentMonth
|
|
1370
|
+
};
|
|
1371
|
+
case RangeDatePickerAction.NEW_TEMPORARY_TO_VALUE:
|
|
1372
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
1373
|
+
temporaryTo: action.payload.date
|
|
1374
|
+
});
|
|
1375
|
+
case RangeDatePickerAction.SELECT_FIRST_DAY:
|
|
1376
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
1377
|
+
from: action.payload.date,
|
|
1378
|
+
to: void 0,
|
|
1379
|
+
temporaryTo: void 0
|
|
1380
|
+
});
|
|
1381
|
+
case RangeDatePickerAction.SELECT_SECOND_DAY_AS_FROM:
|
|
1382
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
1383
|
+
from: action.payload.date,
|
|
1384
|
+
to: state.from,
|
|
1385
|
+
temporaryTo: state.from
|
|
1386
|
+
});
|
|
1387
|
+
case RangeDatePickerAction.SELECT_SECOND_DAY_AS_TO:
|
|
1388
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
1389
|
+
to: action.payload.date,
|
|
1390
|
+
temporaryTo: action.payload.date
|
|
1391
|
+
});
|
|
1392
|
+
case RangeDatePickerAction.CURRENT_MONTH_CHANGE:
|
|
1393
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
1394
|
+
currentMonth: action.payload.date
|
|
1395
|
+
});
|
|
1396
|
+
case RangeDatePickerAction.SET_FROM:
|
|
1397
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
1398
|
+
from: action.payload.date
|
|
1399
|
+
});
|
|
1400
|
+
case RangeDatePickerAction.SET_TO:
|
|
1401
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
1402
|
+
to: action.payload.date
|
|
1403
|
+
});
|
|
1404
|
+
default:
|
|
1405
|
+
return state;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
return useReducer(reducer, initialState);
|
|
1409
|
+
};
|
|
1410
|
+
const RangeDatePicker = ({
|
|
1411
|
+
options,
|
|
1412
|
+
initialSelectedItemKey,
|
|
1413
|
+
initialFromDate,
|
|
1414
|
+
initialToDate,
|
|
1415
|
+
toMonth,
|
|
1416
|
+
onChange,
|
|
1417
|
+
children
|
|
1418
|
+
}) => {
|
|
1419
|
+
const prevSelectedItem = useRef(initialSelectedItemKey || null);
|
|
1420
|
+
const [state, dispatch] = useRangeDatePickerState({
|
|
1421
|
+
options,
|
|
1422
|
+
initialSelectedItemKey,
|
|
1423
|
+
initialFromDate,
|
|
1424
|
+
initialToDate,
|
|
1425
|
+
toMonth,
|
|
1426
|
+
onChange,
|
|
1427
|
+
children
|
|
1428
|
+
});
|
|
1429
|
+
useEffect(() => {
|
|
1430
|
+
dispatch({
|
|
1431
|
+
type: RangeDatePickerAction.SET_FROM,
|
|
1432
|
+
payload: { date: initialFromDate }
|
|
1433
|
+
});
|
|
1434
|
+
}, [initialFromDate]);
|
|
1435
|
+
useEffect(() => {
|
|
1436
|
+
dispatch({
|
|
1437
|
+
type: RangeDatePickerAction.SET_TO,
|
|
1438
|
+
payload: { date: initialToDate }
|
|
1439
|
+
});
|
|
1440
|
+
}, [initialToDate]);
|
|
1441
|
+
useEffect(() => {
|
|
1442
|
+
const currentMonth = calculateDatePickerMonth(initialFromDate, initialToDate, toMonth);
|
|
1443
|
+
dispatch({
|
|
1444
|
+
type: RangeDatePickerAction.CURRENT_MONTH_CHANGE,
|
|
1445
|
+
payload: { date: currentMonth }
|
|
1446
|
+
});
|
|
1447
|
+
}, [toMonth, initialFromDate, initialToDate]);
|
|
1448
|
+
useEffect(() => {
|
|
1449
|
+
const { from, selectedItem, to } = state;
|
|
1450
|
+
if (!(from && to)) {
|
|
1451
|
+
return;
|
|
1452
|
+
}
|
|
1453
|
+
const selectedOption = getSelectedOption(selectedItem, options);
|
|
1454
|
+
if (!selectedOption)
|
|
1455
|
+
return;
|
|
1456
|
+
onChange && onChange(__spreadProps(__spreadValues({}, selectedOption), {
|
|
1457
|
+
value: {
|
|
1458
|
+
from,
|
|
1459
|
+
to
|
|
1460
|
+
}
|
|
1461
|
+
}));
|
|
1462
|
+
}, [state.from, state.to, state.selectedItem, options, onChange]);
|
|
1463
|
+
useEffect(() => {
|
|
1464
|
+
const { selectedItem } = state;
|
|
1465
|
+
if (selectedItem === prevSelectedItem.current) {
|
|
1466
|
+
return;
|
|
1467
|
+
}
|
|
1468
|
+
if (!selectedItem) {
|
|
1469
|
+
onChange(null);
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
const selectedOption = getSelectedOption(selectedItem, options);
|
|
1473
|
+
if (!selectedOption) {
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1476
|
+
const optionsHash = options.reduce((acc, option) => __spreadProps(__spreadValues({}, acc), { [option.id]: option }), {});
|
|
1477
|
+
onChange(optionsHash[selectedItem]);
|
|
1478
|
+
}, [onChange, state.selectedItem, options]);
|
|
1479
|
+
const handleDayMouseEnter = useCallback((day) => {
|
|
1480
|
+
const isInRange = toMonth ? differenceInCalendarDays(toMonth, day) >= 0 : true;
|
|
1481
|
+
if (!isSelectingFirstDay(state.from, state.to) && isInRange) {
|
|
1482
|
+
dispatch({
|
|
1483
|
+
type: RangeDatePickerAction.NEW_TEMPORARY_TO_VALUE,
|
|
1484
|
+
payload: { date: day }
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
}, [toMonth, state.from, state.to]);
|
|
1488
|
+
const handleDayClick = useCallback((day) => {
|
|
1489
|
+
const { from, to } = state;
|
|
1490
|
+
if (!isDateWithinRange(day, { to: toMonth })) {
|
|
1491
|
+
return;
|
|
1492
|
+
}
|
|
1493
|
+
if (isSelectingFirstDay(from, to)) {
|
|
1494
|
+
dispatch({
|
|
1495
|
+
type: RangeDatePickerAction.SELECT_FIRST_DAY,
|
|
1496
|
+
payload: { date: day }
|
|
1497
|
+
});
|
|
1498
|
+
} else if (from && isSameDay(day, from) || from && isAfter(day, from)) {
|
|
1499
|
+
dispatch({
|
|
1500
|
+
type: RangeDatePickerAction.SELECT_SECOND_DAY_AS_TO,
|
|
1501
|
+
payload: { date: day }
|
|
1502
|
+
});
|
|
1503
|
+
} else {
|
|
1504
|
+
dispatch({
|
|
1505
|
+
type: RangeDatePickerAction.SELECT_SECOND_DAY_AS_FROM,
|
|
1506
|
+
payload: { date: day }
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
}, [toMonth, state.from, state.to]);
|
|
1510
|
+
const handleItemSelect = useCallback((itemKey) => {
|
|
1511
|
+
if (itemKey === null) {
|
|
1512
|
+
dispatch({
|
|
1513
|
+
type: RangeDatePickerAction.NEW_SELECTED_ITEM,
|
|
1514
|
+
payload: { selectedItem: null }
|
|
1515
|
+
});
|
|
1516
|
+
return;
|
|
1517
|
+
}
|
|
1518
|
+
const selectedOption = getSelectedOption(itemKey, options);
|
|
1519
|
+
if (!selectedOption) {
|
|
1520
|
+
return;
|
|
1521
|
+
}
|
|
1522
|
+
dispatch({
|
|
1523
|
+
type: RangeDatePickerAction.NEW_SELECTED_ITEM,
|
|
1524
|
+
payload: { selectedItem: itemKey }
|
|
1525
|
+
});
|
|
1526
|
+
}, [options]);
|
|
1527
|
+
const handleMonthChange = useCallback((date) => {
|
|
1528
|
+
dispatch({
|
|
1529
|
+
type: RangeDatePickerAction.CURRENT_MONTH_CHANGE,
|
|
1530
|
+
payload: { date }
|
|
1531
|
+
});
|
|
1532
|
+
}, []);
|
|
1533
|
+
const getRangeDatePickerApi = () => {
|
|
1534
|
+
const { currentMonth, from, selectedItem, temporaryTo, to } = state;
|
|
1535
|
+
const modifiers = useMemo(() => getRangeDatePickerModifiers(from, temporaryTo), [from, temporaryTo]);
|
|
1536
|
+
const selectedOption = useMemo(() => {
|
|
1537
|
+
return getSelectedOption(selectedItem, options);
|
|
1538
|
+
}, [options, selectedItem]);
|
|
1539
|
+
const selectedDays = useMemo(() => {
|
|
1540
|
+
return [from, { from, to: temporaryTo }];
|
|
1541
|
+
}, [from, temporaryTo]);
|
|
1542
|
+
const disabledDays = useMemo(() => {
|
|
1543
|
+
return toMonth ? { after: toMonth } : void 0;
|
|
1544
|
+
}, [toMonth]);
|
|
1545
|
+
return {
|
|
1546
|
+
select: {
|
|
1547
|
+
onItemSelect: handleItemSelect,
|
|
1548
|
+
selected: selectedItem || ""
|
|
1549
|
+
},
|
|
1550
|
+
inputs: {
|
|
1551
|
+
fromDate: from,
|
|
1552
|
+
toDate: to
|
|
1553
|
+
},
|
|
1554
|
+
datepicker: {
|
|
1555
|
+
range: true,
|
|
1556
|
+
month: currentMonth,
|
|
1557
|
+
numberOfMonths: 2,
|
|
1558
|
+
onDayClick: handleDayClick,
|
|
1559
|
+
selectedDays,
|
|
1560
|
+
modifiers,
|
|
1561
|
+
initialMonth: toMonth && subMonths(toMonth, 1),
|
|
1562
|
+
toMonth,
|
|
1563
|
+
disabledDays,
|
|
1564
|
+
onDayMouseEnter: handleDayMouseEnter,
|
|
1565
|
+
onMonthChange: handleMonthChange
|
|
1566
|
+
},
|
|
1567
|
+
selectedOption
|
|
1568
|
+
};
|
|
1569
|
+
};
|
|
1570
|
+
return children(getRangeDatePickerApi());
|
|
1571
|
+
};
|
|
1572
|
+
RangeDatePicker.defaultProps = {
|
|
1573
|
+
options: [
|
|
1574
|
+
{
|
|
1575
|
+
id: "default",
|
|
1576
|
+
label: "Default option",
|
|
1577
|
+
isManual: true,
|
|
1578
|
+
value: {
|
|
1579
|
+
from: void 0,
|
|
1580
|
+
to: void 0
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
]
|
|
1584
|
+
};
|
|
1585
|
+
var styles$s = {
|
|
1586
|
+
"field-error": "lc-FieldError-module__field-error___IDkPT"
|
|
1587
|
+
};
|
|
1588
|
+
const baseClass$z = "field-error";
|
|
1589
|
+
const FieldError = (_q) => {
|
|
1590
|
+
var _r = _q, {
|
|
697
1591
|
children,
|
|
698
1592
|
className = ""
|
|
699
|
-
} =
|
|
1593
|
+
} = _r, props = __objRest(_r, [
|
|
700
1594
|
"children",
|
|
701
1595
|
"className"
|
|
702
1596
|
]);
|
|
703
|
-
const mergedClassNames = cx(styles$
|
|
1597
|
+
const mergedClassNames = cx(styles$s[baseClass$z], className);
|
|
704
1598
|
return /* @__PURE__ */ React.createElement(Text, __spreadProps(__spreadValues({
|
|
705
1599
|
as: "span",
|
|
706
1600
|
size: "sm"
|
|
@@ -708,66 +1602,12 @@ const FieldDescription = (_m) => {
|
|
|
708
1602
|
className: mergedClassNames
|
|
709
1603
|
}), children);
|
|
710
1604
|
};
|
|
711
|
-
|
|
712
|
-
const CheckboxField = (_o) => {
|
|
713
|
-
var _p = _o, {
|
|
714
|
-
children,
|
|
715
|
-
className = "",
|
|
716
|
-
description,
|
|
717
|
-
checked,
|
|
718
|
-
disabled
|
|
719
|
-
} = _p, props = __objRest(_p, [
|
|
720
|
-
"children",
|
|
721
|
-
"className",
|
|
722
|
-
"description",
|
|
723
|
-
"checked",
|
|
724
|
-
"disabled"
|
|
725
|
-
]);
|
|
726
|
-
const mergedClassNames = cx(styles$j[baseClass$m], className, {
|
|
727
|
-
[styles$j[`${baseClass$m}--selected`]]: checked,
|
|
728
|
-
[styles$j[`${baseClass$m}--disabled`]]: disabled
|
|
729
|
-
});
|
|
730
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
731
|
-
className: mergedClassNames
|
|
732
|
-
}, /* @__PURE__ */ React.createElement("label", {
|
|
733
|
-
className: styles$j[`${baseClass$m}__label`]
|
|
734
|
-
}, /* @__PURE__ */ React.createElement(Checkbox, __spreadProps(__spreadValues({}, props), {
|
|
735
|
-
checked,
|
|
736
|
-
disabled
|
|
737
|
-
})), /* @__PURE__ */ React.createElement(Text, {
|
|
738
|
-
as: "div",
|
|
739
|
-
size: "md",
|
|
740
|
-
className: styles$j[`${baseClass$m}__text`]
|
|
741
|
-
}, children)), description && /* @__PURE__ */ React.createElement(FieldDescription, {
|
|
742
|
-
className: styles$j[`${baseClass$m}__helper`]
|
|
743
|
-
}, description));
|
|
744
|
-
};
|
|
745
|
-
var styles$h = {
|
|
746
|
-
"field-error": "lc-FieldError-module__field-error___IDkPT"
|
|
747
|
-
};
|
|
748
|
-
const baseClass$l = "field-error";
|
|
749
|
-
const FieldError = (_q) => {
|
|
750
|
-
var _r = _q, {
|
|
751
|
-
children,
|
|
752
|
-
className = ""
|
|
753
|
-
} = _r, props = __objRest(_r, [
|
|
754
|
-
"children",
|
|
755
|
-
"className"
|
|
756
|
-
]);
|
|
757
|
-
const mergedClassNames = cx(styles$h[baseClass$l], className);
|
|
758
|
-
return /* @__PURE__ */ React.createElement(Text, __spreadProps(__spreadValues({
|
|
759
|
-
as: "span",
|
|
760
|
-
size: "sm"
|
|
761
|
-
}, props), {
|
|
762
|
-
className: mergedClassNames
|
|
763
|
-
}), children);
|
|
764
|
-
};
|
|
765
|
-
var styles$g = {
|
|
1605
|
+
var styles$r = {
|
|
766
1606
|
"field-group": "lc-FieldGroup-module__field-group___gy8lp",
|
|
767
1607
|
"field-group--inline": "lc-FieldGroup-module__field-group--inline___or4qf",
|
|
768
1608
|
"field-group--stretched": "lc-FieldGroup-module__field-group--stretched___6rkuO"
|
|
769
1609
|
};
|
|
770
|
-
const baseClass$
|
|
1610
|
+
const baseClass$y = "field-group";
|
|
771
1611
|
const FieldGroup = (_s) => {
|
|
772
1612
|
var _t = _s, {
|
|
773
1613
|
className = "",
|
|
@@ -784,9 +1624,9 @@ const FieldGroup = (_s) => {
|
|
|
784
1624
|
"inline",
|
|
785
1625
|
"stretch"
|
|
786
1626
|
]);
|
|
787
|
-
const mergedClassNames = cx(styles$
|
|
788
|
-
[styles$
|
|
789
|
-
[styles$
|
|
1627
|
+
const mergedClassNames = cx(styles$r[baseClass$y], className, {
|
|
1628
|
+
[styles$r[`${baseClass$y}--inline`]]: inline,
|
|
1629
|
+
[styles$r[`${baseClass$y}--stretched`]]: stretch
|
|
790
1630
|
});
|
|
791
1631
|
return /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({}, props), {
|
|
792
1632
|
className: mergedClassNames
|
|
@@ -797,14 +1637,14 @@ const form__header = "lc-Form-module__form__header___U4B7t";
|
|
|
797
1637
|
const form__footer = "lc-Form-module__form__footer___1-sUX";
|
|
798
1638
|
const form__label = "lc-Form-module__form__label___spg-J";
|
|
799
1639
|
const form__helper = "lc-Form-module__form__helper___bhfwS";
|
|
800
|
-
var styles$
|
|
1640
|
+
var styles$q = {
|
|
801
1641
|
form,
|
|
802
1642
|
form__header,
|
|
803
1643
|
form__footer,
|
|
804
1644
|
form__label,
|
|
805
1645
|
form__helper
|
|
806
1646
|
};
|
|
807
|
-
const baseClass$
|
|
1647
|
+
const baseClass$x = "form";
|
|
808
1648
|
const Form = (_u) => {
|
|
809
1649
|
var _v = _u, {
|
|
810
1650
|
className,
|
|
@@ -820,73 +1660,37 @@ const Form = (_u) => {
|
|
|
820
1660
|
"formFooter"
|
|
821
1661
|
]);
|
|
822
1662
|
return /* @__PURE__ */ React.createElement("form", __spreadValues({
|
|
823
|
-
className: cx(styles$
|
|
1663
|
+
className: cx(styles$q[baseClass$x], className)
|
|
824
1664
|
}, restProps), (labelText || helperText) && /* @__PURE__ */ React.createElement("div", {
|
|
825
|
-
className: styles$
|
|
1665
|
+
className: styles$q[`${baseClass$x}__header`]
|
|
826
1666
|
}, labelText && /* @__PURE__ */ React.createElement(Heading, {
|
|
827
1667
|
size: "sm",
|
|
828
|
-
className: styles$
|
|
1668
|
+
className: styles$q[`${baseClass$x}__label`]
|
|
829
1669
|
}, labelText), helperText && /* @__PURE__ */ React.createElement(Text, {
|
|
830
1670
|
as: "p",
|
|
831
1671
|
size: "sm",
|
|
832
|
-
className: styles$
|
|
1672
|
+
className: styles$q[`${baseClass$x}__helper`]
|
|
833
1673
|
}, helperText)), children, formFooter && /* @__PURE__ */ React.createElement("div", {
|
|
834
|
-
className: styles$
|
|
1674
|
+
className: styles$q[`${baseClass$x}__footer`]
|
|
835
1675
|
}, formFooter));
|
|
836
1676
|
};
|
|
837
|
-
var styles$
|
|
838
|
-
"form-
|
|
839
|
-
"form-
|
|
840
|
-
"form-
|
|
841
|
-
"form-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
"className",
|
|
852
|
-
"children",
|
|
853
|
-
"labelText",
|
|
854
|
-
"helperText"
|
|
855
|
-
]);
|
|
856
|
-
const mergedClassNames = cx(styles$e[baseClass$i], className);
|
|
857
|
-
return /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
858
|
-
role: "group"
|
|
859
|
-
}), labelText && { "aria-label": labelText }), {
|
|
860
|
-
className: mergedClassNames
|
|
861
|
-
}), /* @__PURE__ */ React.createElement("div", {
|
|
862
|
-
className: styles$e[`${baseClass$i}__header`]
|
|
863
|
-
}, /* @__PURE__ */ React.createElement(Heading, {
|
|
864
|
-
as: "div",
|
|
865
|
-
size: "sm",
|
|
866
|
-
className: styles$e[`${baseClass$i}__label`]
|
|
867
|
-
}, labelText), helperText && /* @__PURE__ */ React.createElement(Text, {
|
|
868
|
-
as: "div",
|
|
869
|
-
size: "sm",
|
|
870
|
-
className: styles$e[`${baseClass$i}__helper`]
|
|
871
|
-
}, helperText)), children);
|
|
1677
|
+
var styles$p = {
|
|
1678
|
+
"form-field": "lc-FormField-module__form-field___JqnX6",
|
|
1679
|
+
"form-field--inline": "lc-FormField-module__form-field--inline___4DgIq",
|
|
1680
|
+
"form-field__wrapper--inline": "lc-FormField-module__form-field__wrapper--inline___Ubvrn",
|
|
1681
|
+
"form-field__label": "lc-FormField-module__form-field__label___hNCFS",
|
|
1682
|
+
"form-field__label--inline": "lc-FormField-module__form-field__label--inline___QxyM6",
|
|
1683
|
+
"form-field__label--no-text": "lc-FormField-module__form-field__label--no-text___Ohs-I",
|
|
1684
|
+
"form-field__label-wrapper": "lc-FormField-module__form-field__label-wrapper___61-NO",
|
|
1685
|
+
"form-field__label-adornment": "lc-FormField-module__form-field__label-adornment___HB0z7",
|
|
1686
|
+
"form-field__label-left-node": "lc-FormField-module__form-field__label-left-node___dvipB",
|
|
1687
|
+
"form-field__label-right-node": "lc-FormField-module__form-field__label-right-node___LR-03",
|
|
1688
|
+
"form-field__label-right-node--inline": "lc-FormField-module__form-field__label-right-node--inline___BkiPG",
|
|
1689
|
+
"form-field__row-break": "lc-FormField-module__form-field__row-break___DCBjC",
|
|
1690
|
+
"form-field__content": "lc-FormField-module__form-field__content___XaOx3"
|
|
872
1691
|
};
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
"text-field--inline": "lc-TextField-module__text-field--inline___MPHqg",
|
|
876
|
-
"text-field__wrapper--inline": "lc-TextField-module__text-field__wrapper--inline___-gOob",
|
|
877
|
-
"text-field__label": "lc-TextField-module__text-field__label___vpNdg",
|
|
878
|
-
"text-field__label--inline": "lc-TextField-module__text-field__label--inline___YSRYX",
|
|
879
|
-
"text-field__label--no-text": "lc-TextField-module__text-field__label--no-text___XSyn2",
|
|
880
|
-
"text-field__label-wrapper": "lc-TextField-module__text-field__label-wrapper___SNCct",
|
|
881
|
-
"text-field__label-adornment": "lc-TextField-module__text-field__label-adornment___--pgp",
|
|
882
|
-
"text-field__label-right-node": "lc-TextField-module__text-field__label-right-node___sdnWg",
|
|
883
|
-
"text-field__label-right-node--inline": "lc-TextField-module__text-field__label-right-node--inline___vMBP2",
|
|
884
|
-
"text-field__row-break": "lc-TextField-module__text-field__row-break___AnNrI",
|
|
885
|
-
"text-field__content": "lc-TextField-module__text-field__content___dCkUW",
|
|
886
|
-
"field-label": "lc-TextField-module__field-label___q8Y-p"
|
|
887
|
-
};
|
|
888
|
-
const baseClass$h = "text-field";
|
|
889
|
-
const TextField = ({
|
|
1692
|
+
const baseClass$w = "form-field";
|
|
1693
|
+
const FormField = ({
|
|
890
1694
|
inline,
|
|
891
1695
|
error,
|
|
892
1696
|
description,
|
|
@@ -897,92 +1701,153 @@ const TextField = ({
|
|
|
897
1701
|
children,
|
|
898
1702
|
labelRightNode
|
|
899
1703
|
}) => {
|
|
900
|
-
const mergedClassNames = cx(styles$
|
|
901
|
-
[styles$
|
|
1704
|
+
const mergedClassNames = cx(styles$p[baseClass$w], {
|
|
1705
|
+
[styles$p[`${baseClass$w}--inline`]]: inline
|
|
902
1706
|
}, className);
|
|
903
1707
|
return /* @__PURE__ */ React.createElement("div", {
|
|
904
1708
|
className: mergedClassNames
|
|
905
1709
|
}, labelRightNode && inline && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
906
|
-
className: cx(styles$
|
|
1710
|
+
className: cx(styles$p[`${baseClass$w}__label-right-node`], styles$p[`${baseClass$w}__label-right-node--inline`])
|
|
907
1711
|
}, labelRightNode), /* @__PURE__ */ React.createElement("div", {
|
|
908
|
-
className: styles$
|
|
1712
|
+
className: styles$p[`${baseClass$w}__row-break`]
|
|
909
1713
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
910
|
-
className: cx(styles$
|
|
1714
|
+
className: cx(styles$p[`${baseClass$w}__wrapper`], inline && styles$p[`${baseClass$w}__wrapper--inline`])
|
|
911
1715
|
}, (labelText || labelRightNode) && /* @__PURE__ */ React.createElement("div", {
|
|
912
|
-
className: cx(styles$
|
|
1716
|
+
className: cx(styles$p[`${baseClass$w}__label`], inline && styles$p[`${baseClass$w}__label--inline`], !labelText && styles$p[`${baseClass$w}__label--no-text`])
|
|
913
1717
|
}, labelText && /* @__PURE__ */ React.createElement("div", {
|
|
914
|
-
className: cx(styles$
|
|
1718
|
+
className: cx(styles$p[`${baseClass$w}__label-wrapper`])
|
|
915
1719
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
916
|
-
className:
|
|
1720
|
+
className: styles$p[`${baseClass$w}__label-left-node`],
|
|
917
1721
|
htmlFor: labelFor
|
|
918
1722
|
}, /* @__PURE__ */ React.createElement(Text, {
|
|
919
1723
|
as: "span",
|
|
920
1724
|
size: "sm"
|
|
921
1725
|
}, labelText)), labelAdornment && /* @__PURE__ */ React.createElement("div", {
|
|
922
|
-
className: cx(styles$
|
|
1726
|
+
className: cx(styles$p[`${baseClass$w}__label-adornment`])
|
|
923
1727
|
}, labelAdornment)), labelRightNode && !inline && /* @__PURE__ */ React.createElement("div", {
|
|
924
|
-
className: cx(styles$
|
|
1728
|
+
className: cx(styles$p[`${baseClass$w}__label-right-node`])
|
|
925
1729
|
}, labelRightNode)), /* @__PURE__ */ React.createElement("div", {
|
|
926
|
-
className: cx(styles$
|
|
1730
|
+
className: cx(styles$p[`${baseClass$w}__content`])
|
|
927
1731
|
}, children, error && /* @__PURE__ */ React.createElement(FieldError, null, error), description && /* @__PURE__ */ React.createElement(FieldDescription, null, description))));
|
|
928
1732
|
};
|
|
929
|
-
var styles$
|
|
930
|
-
"
|
|
931
|
-
"
|
|
1733
|
+
var styles$o = {
|
|
1734
|
+
"form-group": "lc-FormGroup-module__form-group___e2JHa",
|
|
1735
|
+
"form-group__header": "lc-FormGroup-module__form-group__header___DgGmR",
|
|
1736
|
+
"form-group__label": "lc-FormGroup-module__form-group__label___NC-JW",
|
|
1737
|
+
"form-group__helper": "lc-FormGroup-module__form-group__helper___SRuxe"
|
|
932
1738
|
};
|
|
933
|
-
const baseClass$
|
|
934
|
-
const
|
|
935
|
-
var
|
|
936
|
-
|
|
1739
|
+
const baseClass$v = "form-group";
|
|
1740
|
+
const FormGroup = (_w) => {
|
|
1741
|
+
var _x = _w, {
|
|
1742
|
+
className = "",
|
|
1743
|
+
children,
|
|
937
1744
|
labelText,
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
inline,
|
|
941
|
-
error,
|
|
942
|
-
description,
|
|
943
|
-
labelRightNode,
|
|
944
|
-
fieldClassName,
|
|
945
|
-
style,
|
|
946
|
-
type = "text"
|
|
947
|
-
} = _z, restProps = __objRest(_z, [
|
|
948
|
-
"id",
|
|
949
|
-
"labelText",
|
|
950
|
-
"labelAdornment",
|
|
1745
|
+
helperText
|
|
1746
|
+
} = _x, props = __objRest(_x, [
|
|
951
1747
|
"className",
|
|
952
|
-
"
|
|
1748
|
+
"children",
|
|
1749
|
+
"labelText",
|
|
1750
|
+
"helperText"
|
|
1751
|
+
]);
|
|
1752
|
+
const mergedClassNames = cx(styles$o[baseClass$v], className);
|
|
1753
|
+
return /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
1754
|
+
role: "group"
|
|
1755
|
+
}), labelText && { "aria-label": labelText }), {
|
|
1756
|
+
className: mergedClassNames
|
|
1757
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
1758
|
+
className: styles$o[`${baseClass$v}__header`]
|
|
1759
|
+
}, /* @__PURE__ */ React.createElement(Heading, {
|
|
1760
|
+
as: "div",
|
|
1761
|
+
size: "sm",
|
|
1762
|
+
className: styles$o[`${baseClass$v}__label`]
|
|
1763
|
+
}, labelText), helperText && /* @__PURE__ */ React.createElement(Text, {
|
|
1764
|
+
as: "div",
|
|
1765
|
+
size: "sm",
|
|
1766
|
+
className: styles$o[`${baseClass$v}__helper`]
|
|
1767
|
+
}, helperText)), children);
|
|
1768
|
+
};
|
|
1769
|
+
const input = "lc-Input-module__input___qeMAQ";
|
|
1770
|
+
var styles$n = {
|
|
1771
|
+
input,
|
|
1772
|
+
"input--focused": "lc-Input-module__input--focused___wQH5-",
|
|
1773
|
+
"input--disabled": "lc-Input-module__input--disabled___HidXX",
|
|
1774
|
+
"input--error": "lc-Input-module__input--error___DlDbC",
|
|
1775
|
+
"input--compact": "lc-Input-module__input--compact___iKSQZ",
|
|
1776
|
+
"input--medium": "lc-Input-module__input--medium___3BjqQ",
|
|
1777
|
+
"input--large": "lc-Input-module__input--large___jX5RW",
|
|
1778
|
+
"input__icon--disabled": "lc-Input-module__input__icon--disabled___XO3dc",
|
|
1779
|
+
"input__icon--left": "lc-Input-module__input__icon--left___BcySs",
|
|
1780
|
+
"input__icon--right": "lc-Input-module__input__icon--right___VefSK",
|
|
1781
|
+
"input__visibility-button": "lc-Input-module__input__visibility-button___eWrVe"
|
|
1782
|
+
};
|
|
1783
|
+
const baseClass$u = "input";
|
|
1784
|
+
const renderIcon = (icon2, disabled) => React.cloneElement(icon2.source, {
|
|
1785
|
+
["data-testid"]: `input-icon-${icon2.place}`,
|
|
1786
|
+
className: cx(styles$n[`${baseClass$u}__icon`], styles$n[`${baseClass$u}__icon--${icon2.place}`], {
|
|
1787
|
+
[styles$n[`${baseClass$u}__icon--disabled`]]: disabled
|
|
1788
|
+
})
|
|
1789
|
+
});
|
|
1790
|
+
const Input = React.forwardRef((_y, ref) => {
|
|
1791
|
+
var _z = _y, {
|
|
1792
|
+
inputSize = "medium",
|
|
1793
|
+
error = false,
|
|
1794
|
+
disabled,
|
|
1795
|
+
icon: icon2 = null,
|
|
1796
|
+
className
|
|
1797
|
+
} = _z, inputProps = __objRest(_z, [
|
|
1798
|
+
"inputSize",
|
|
953
1799
|
"error",
|
|
954
|
-
"
|
|
955
|
-
"
|
|
956
|
-
"
|
|
957
|
-
"style",
|
|
958
|
-
"type"
|
|
1800
|
+
"disabled",
|
|
1801
|
+
"icon",
|
|
1802
|
+
"className"
|
|
959
1803
|
]);
|
|
960
|
-
const
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
id,
|
|
974
|
-
ref,
|
|
1804
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
1805
|
+
const [isPasswordVisible, setIsPasswordVisible] = React.useState(false);
|
|
1806
|
+
const { type, onFocus, onBlur } = inputProps;
|
|
1807
|
+
const mergedClassNames = cx(className, styles$n[baseClass$u], styles$n[`${baseClass$u}--${inputSize}`], {
|
|
1808
|
+
[styles$n[`${baseClass$u}--disabled`]]: disabled,
|
|
1809
|
+
[styles$n[`${baseClass$u}--focused`]]: isFocused,
|
|
1810
|
+
[styles$n[`${baseClass$u}--error`]]: error
|
|
1811
|
+
});
|
|
1812
|
+
const iconCustomColor = !disabled ? "var(--content-default)" : "var(--content-disabled)";
|
|
1813
|
+
const iconSource = isPasswordVisible ? VisibilityOn : VisibilityOff;
|
|
1814
|
+
const shouldRenderLeftIcon = icon2 && icon2.place === "left";
|
|
1815
|
+
const shouldRenderRightIcon = icon2 && type !== "password" && icon2.place === "right";
|
|
1816
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
975
1817
|
className: mergedClassNames,
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
})
|
|
1818
|
+
"aria-disabled": disabled,
|
|
1819
|
+
"tab-index": "0"
|
|
1820
|
+
}, shouldRenderLeftIcon && renderIcon(icon2, disabled), /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({
|
|
1821
|
+
"data-testid": "input"
|
|
1822
|
+
}, inputProps), {
|
|
1823
|
+
ref,
|
|
1824
|
+
onFocus: (e) => {
|
|
1825
|
+
setIsFocused(true);
|
|
1826
|
+
onFocus == null ? void 0 : onFocus(e);
|
|
1827
|
+
},
|
|
1828
|
+
onBlur: (e) => {
|
|
1829
|
+
setIsFocused(false);
|
|
1830
|
+
onBlur == null ? void 0 : onBlur(e);
|
|
1831
|
+
},
|
|
1832
|
+
disabled,
|
|
1833
|
+
type: type && !isPasswordVisible ? type : "text"
|
|
1834
|
+
})), shouldRenderRightIcon && renderIcon(icon2, disabled), type === "password" && /* @__PURE__ */ React.createElement(Button, {
|
|
1835
|
+
disabled,
|
|
1836
|
+
kind: "plain",
|
|
1837
|
+
icon: /* @__PURE__ */ React.createElement(Icon, {
|
|
1838
|
+
customColor: iconCustomColor,
|
|
1839
|
+
source: iconSource
|
|
1840
|
+
}),
|
|
1841
|
+
onClick: () => setIsPasswordVisible((v) => !v),
|
|
1842
|
+
className: styles$n[`${baseClass$u}__visibility-button`]
|
|
1843
|
+
}));
|
|
979
1844
|
});
|
|
980
1845
|
const link = "lc-Link-module__link___kqx52";
|
|
981
|
-
var styles$
|
|
1846
|
+
var styles$m = {
|
|
982
1847
|
link,
|
|
983
1848
|
"link--bold": "lc-Link-module__link--bold___1rGdO"
|
|
984
1849
|
};
|
|
985
|
-
const baseClass$
|
|
1850
|
+
const baseClass$t = "link";
|
|
986
1851
|
const Link = (_A) => {
|
|
987
1852
|
var _B = _A, {
|
|
988
1853
|
bold = false,
|
|
@@ -992,21 +1857,37 @@ const Link = (_A) => {
|
|
|
992
1857
|
"className"
|
|
993
1858
|
]);
|
|
994
1859
|
return /* @__PURE__ */ React.createElement("a", __spreadValues({
|
|
995
|
-
className: cx(styles$
|
|
1860
|
+
className: cx(styles$m[baseClass$t], bold && styles$m[`${baseClass$t}--bold`], className)
|
|
996
1861
|
}, rest));
|
|
997
1862
|
};
|
|
1863
|
+
const KeyCodes = {
|
|
1864
|
+
esc: "Escape",
|
|
1865
|
+
enter: "Enter",
|
|
1866
|
+
backspace: "Backspace",
|
|
1867
|
+
delete: "Delete",
|
|
1868
|
+
spacebar: " ",
|
|
1869
|
+
tab: "Tab",
|
|
1870
|
+
semicolon: ";",
|
|
1871
|
+
comma: ",",
|
|
1872
|
+
arrowUp: "ArrowUp",
|
|
1873
|
+
arrowDown: "ArrowDown"
|
|
1874
|
+
};
|
|
998
1875
|
const modal__header = "lc-Modal-module__modal__header___Fp5VE";
|
|
999
1876
|
const modal__heading = "lc-Modal-module__modal__heading___G9KVK";
|
|
1000
1877
|
const modal__body = "lc-Modal-module__modal__body___M-jmN";
|
|
1001
1878
|
const modal__footer = "lc-Modal-module__modal__footer___2LYdc";
|
|
1002
|
-
var styles$
|
|
1879
|
+
var styles$l = {
|
|
1003
1880
|
"modal-base": "lc-Modal-module__modal-base___hbL1U",
|
|
1004
1881
|
"modal-base__overlay": "lc-Modal-module__modal-base__overlay___kCQ8t",
|
|
1005
1882
|
"modal-base__overlay--visible": "lc-Modal-module__modal-base__overlay--visible___zUNJL",
|
|
1006
1883
|
"modal-base__close": "lc-Modal-module__modal-base__close___gJlgr",
|
|
1884
|
+
"modal-base__close--label-type": "lc-Modal-module__modal-base__close--label-type___Om0Vb",
|
|
1007
1885
|
modal__header,
|
|
1886
|
+
"modal__label-header": "lc-Modal-module__modal__label-header___ZPtEy",
|
|
1008
1887
|
modal__heading,
|
|
1888
|
+
"modal__label-heading": "lc-Modal-module__modal__label-heading___WnYcF",
|
|
1009
1889
|
modal__body,
|
|
1890
|
+
"modal__body--full-space": "lc-Modal-module__modal__body--full-space___LsSNE",
|
|
1010
1891
|
modal__footer,
|
|
1011
1892
|
"action-modal": "lc-Modal-module__action-modal___CsRC7",
|
|
1012
1893
|
"action-modal__heading": "lc-Modal-module__action-modal__heading___m3MuG",
|
|
@@ -1014,43 +1895,22 @@ var styles$a = {
|
|
|
1014
1895
|
"action-modal__actions": "lc-Modal-module__action-modal__actions___kpRXD",
|
|
1015
1896
|
"action-modal__icon": "lc-Modal-module__action-modal__icon___MK5xt"
|
|
1016
1897
|
};
|
|
1017
|
-
const
|
|
1018
|
-
onClick
|
|
1019
|
-
}) => /* @__PURE__ */ React.createElement("button", {
|
|
1020
|
-
title: "Close modal",
|
|
1021
|
-
className: styles$a["modal-base__close"],
|
|
1022
|
-
onClick,
|
|
1023
|
-
type: "button"
|
|
1024
|
-
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
1025
|
-
source: Close,
|
|
1026
|
-
size: IconSizeName.Large
|
|
1027
|
-
}));
|
|
1028
|
-
const KeyCodes = {
|
|
1029
|
-
esc: "Escape",
|
|
1030
|
-
enter: "Enter",
|
|
1031
|
-
backspace: "Backspace",
|
|
1032
|
-
delete: "Delete",
|
|
1033
|
-
spacebar: " ",
|
|
1034
|
-
tab: "Tab",
|
|
1035
|
-
semicolon: ";",
|
|
1036
|
-
comma: ",",
|
|
1037
|
-
arrowUp: "ArrowUp",
|
|
1038
|
-
arrowDown: "ArrowDown"
|
|
1039
|
-
};
|
|
1040
|
-
const baseClass$e = "modal-base";
|
|
1898
|
+
const baseClass$s = "modal-base";
|
|
1041
1899
|
const ModalBase = (_C) => {
|
|
1042
1900
|
var _D = _C, {
|
|
1043
1901
|
children,
|
|
1044
1902
|
className = "",
|
|
1045
1903
|
onClose,
|
|
1046
|
-
closeOnEscPress = true
|
|
1904
|
+
closeOnEscPress = true,
|
|
1905
|
+
closeOnOverlayPress = true
|
|
1047
1906
|
} = _D, props = __objRest(_D, [
|
|
1048
1907
|
"children",
|
|
1049
1908
|
"className",
|
|
1050
1909
|
"onClose",
|
|
1051
|
-
"closeOnEscPress"
|
|
1910
|
+
"closeOnEscPress",
|
|
1911
|
+
"closeOnOverlayPress"
|
|
1052
1912
|
]);
|
|
1053
|
-
const mergedClassNames = cx(styles$
|
|
1913
|
+
const mergedClassNames = cx(styles$l[baseClass$s], className);
|
|
1054
1914
|
React.useEffect(() => {
|
|
1055
1915
|
if (!closeOnEscPress) {
|
|
1056
1916
|
return;
|
|
@@ -1064,79 +1924,85 @@ const ModalBase = (_C) => {
|
|
|
1064
1924
|
return () => document.removeEventListener("keyup", onKeyUp, true);
|
|
1065
1925
|
}, [closeOnEscPress]);
|
|
1066
1926
|
const onOverlayClick = (event) => {
|
|
1067
|
-
if (event.target === event.currentTarget) {
|
|
1927
|
+
if (closeOnOverlayPress && event.target === event.currentTarget) {
|
|
1068
1928
|
onClose();
|
|
1069
1929
|
}
|
|
1070
1930
|
};
|
|
1071
|
-
const onCloseButtonClick = (event) => {
|
|
1072
|
-
event.preventDefault();
|
|
1073
|
-
event.stopPropagation();
|
|
1074
|
-
onClose();
|
|
1075
|
-
};
|
|
1076
1931
|
return /* @__PURE__ */ React.createElement("div", {
|
|
1077
1932
|
"data-testid": "lc-modal-overlay",
|
|
1078
1933
|
onMouseDown: onOverlayClick,
|
|
1079
|
-
className: cx(styles$
|
|
1934
|
+
className: cx(styles$l[`${baseClass$s}__overlay`], styles$l[`${baseClass$s}__overlay--visible`])
|
|
1080
1935
|
}, /* @__PURE__ */ React.createElement("div", __spreadValues({
|
|
1936
|
+
role: "dialog",
|
|
1937
|
+
"aria-modal": true,
|
|
1081
1938
|
className: mergedClassNames
|
|
1082
|
-
}, props),
|
|
1083
|
-
onClick: onCloseButtonClick
|
|
1084
|
-
}), children));
|
|
1939
|
+
}, props), children));
|
|
1085
1940
|
};
|
|
1086
|
-
const
|
|
1087
|
-
|
|
1941
|
+
const ModalCloseButton = ({
|
|
1942
|
+
labelType,
|
|
1943
|
+
customColor,
|
|
1944
|
+
onClick
|
|
1945
|
+
}) => /* @__PURE__ */ React.createElement("button", {
|
|
1946
|
+
title: "Close modal",
|
|
1947
|
+
className: cx(styles$l["modal-base__close"], labelType && styles$l["modal-base__close--label-type"]),
|
|
1948
|
+
onClick,
|
|
1949
|
+
type: "button"
|
|
1950
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
1951
|
+
source: Close,
|
|
1952
|
+
size: "large",
|
|
1953
|
+
customColor
|
|
1954
|
+
}));
|
|
1955
|
+
const baseClass$r = "modal";
|
|
1956
|
+
const Modal = (_E) => {
|
|
1088
1957
|
var _F = _E, {
|
|
1089
1958
|
children,
|
|
1090
1959
|
className = "",
|
|
1091
|
-
icon: icon2,
|
|
1092
1960
|
heading,
|
|
1093
|
-
|
|
1961
|
+
labelHeading,
|
|
1962
|
+
fullSpaceContent,
|
|
1963
|
+
footer,
|
|
1964
|
+
onClose
|
|
1094
1965
|
} = _F, props = __objRest(_F, [
|
|
1095
|
-
"children",
|
|
1096
|
-
"className",
|
|
1097
|
-
"icon",
|
|
1098
|
-
"heading",
|
|
1099
|
-
"actions"
|
|
1100
|
-
]);
|
|
1101
|
-
const mergedClassNames = cx(styles$a[baseClass$d], className);
|
|
1102
|
-
return /* @__PURE__ */ React.createElement(ModalBase, __spreadValues({
|
|
1103
|
-
className: mergedClassNames
|
|
1104
|
-
}, props), icon2 && /* @__PURE__ */ React.createElement("div", {
|
|
1105
|
-
className: styles$a[`${baseClass$d}__icon`]
|
|
1106
|
-
}, icon2), heading && /* @__PURE__ */ React.createElement("div", {
|
|
1107
|
-
className: styles$a[`${baseClass$d}__heading`]
|
|
1108
|
-
}, heading), /* @__PURE__ */ React.createElement("div", {
|
|
1109
|
-
className: styles$a[`${baseClass$d}__content`]
|
|
1110
|
-
}, children), actions && /* @__PURE__ */ React.createElement("div", {
|
|
1111
|
-
className: styles$a[`${baseClass$d}__actions`]
|
|
1112
|
-
}, actions));
|
|
1113
|
-
};
|
|
1114
|
-
const baseClass$c = "modal";
|
|
1115
|
-
const Modal = (_G) => {
|
|
1116
|
-
var _H = _G, {
|
|
1117
|
-
children,
|
|
1118
|
-
className = "",
|
|
1119
|
-
heading,
|
|
1120
|
-
footer
|
|
1121
|
-
} = _H, props = __objRest(_H, [
|
|
1122
1966
|
"children",
|
|
1123
1967
|
"className",
|
|
1124
1968
|
"heading",
|
|
1125
|
-
"
|
|
1969
|
+
"labelHeading",
|
|
1970
|
+
"fullSpaceContent",
|
|
1971
|
+
"footer",
|
|
1972
|
+
"onClose"
|
|
1126
1973
|
]);
|
|
1127
|
-
const mergedClassNames = cx(styles$
|
|
1974
|
+
const mergedClassNames = cx(styles$l[baseClass$r], className);
|
|
1975
|
+
const onCloseButtonClick = (event) => {
|
|
1976
|
+
event.preventDefault();
|
|
1977
|
+
event.stopPropagation();
|
|
1978
|
+
onClose();
|
|
1979
|
+
};
|
|
1128
1980
|
return /* @__PURE__ */ React.createElement(ModalBase, __spreadValues({
|
|
1129
|
-
className: mergedClassNames
|
|
1130
|
-
|
|
1131
|
-
|
|
1981
|
+
className: mergedClassNames,
|
|
1982
|
+
onClose
|
|
1983
|
+
}, props), labelHeading && /* @__PURE__ */ React.createElement("div", {
|
|
1984
|
+
className: styles$l[`${baseClass$r}__label-header`]
|
|
1985
|
+
}, /* @__PURE__ */ React.createElement(Heading, {
|
|
1986
|
+
size: "xs",
|
|
1987
|
+
as: "div",
|
|
1988
|
+
className: styles$l[`${baseClass$r}__label-heading`]
|
|
1989
|
+
}, labelHeading), /* @__PURE__ */ React.createElement(ModalCloseButton, {
|
|
1990
|
+
labelType: !!labelHeading,
|
|
1991
|
+
customColor: `var(--color-white)`,
|
|
1992
|
+
onClick: onCloseButtonClick
|
|
1993
|
+
})), !labelHeading && heading && /* @__PURE__ */ React.createElement("div", {
|
|
1994
|
+
className: styles$l[`${baseClass$r}__header`]
|
|
1132
1995
|
}, /* @__PURE__ */ React.createElement(Heading, {
|
|
1133
1996
|
size: "sm",
|
|
1134
1997
|
as: "div",
|
|
1135
|
-
className: styles$
|
|
1136
|
-
}, heading)), /* @__PURE__ */ React.createElement(
|
|
1137
|
-
|
|
1998
|
+
className: styles$l[`${baseClass$r}__heading`]
|
|
1999
|
+
}, heading)), !labelHeading && /* @__PURE__ */ React.createElement(ModalCloseButton, {
|
|
2000
|
+
onClick: onCloseButtonClick
|
|
2001
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
2002
|
+
"data-testid": "modal-body",
|
|
2003
|
+
className: cx(styles$l[`${baseClass$r}__body`], fullSpaceContent && styles$l[`${baseClass$r}__body--full-space`])
|
|
1138
2004
|
}, children), footer && /* @__PURE__ */ React.createElement("div", {
|
|
1139
|
-
className: styles$
|
|
2005
|
+
className: styles$l[`${baseClass$r}__footer`]
|
|
1140
2006
|
}, footer));
|
|
1141
2007
|
};
|
|
1142
2008
|
const ModalPortal = ({
|
|
@@ -1159,10 +2025,10 @@ const ModalPortal = ({
|
|
|
1159
2025
|
var _a2;
|
|
1160
2026
|
(_a2 = document.querySelector(parentElementName)) == null ? void 0 : _a2.removeChild(container);
|
|
1161
2027
|
};
|
|
1162
|
-
}, []);
|
|
2028
|
+
}, [parentElementName]);
|
|
1163
2029
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, ReactDOM.createPortal(children, container));
|
|
1164
2030
|
};
|
|
1165
|
-
var styles$
|
|
2031
|
+
var styles$k = {
|
|
1166
2032
|
"numeric-input": "lc-NumericInput-module__numeric-input___j1esc",
|
|
1167
2033
|
"numeric-input__increment": "lc-NumericInput-module__numeric-input__increment___i3Tys",
|
|
1168
2034
|
"numeric-input__decrement": "lc-NumericInput-module__numeric-input__decrement___3qgn0",
|
|
@@ -1170,9 +2036,9 @@ var styles$9 = {
|
|
|
1170
2036
|
"numeric-input--no-controls": "lc-NumericInput-module__numeric-input--no-controls___D90rG",
|
|
1171
2037
|
"numeric-input--error": "lc-NumericInput-module__numeric-input--error___TMxRx"
|
|
1172
2038
|
};
|
|
1173
|
-
const baseClass$
|
|
1174
|
-
const NumericInput = (
|
|
1175
|
-
var
|
|
2039
|
+
const baseClass$q = "numeric-input";
|
|
2040
|
+
const NumericInput = (_G) => {
|
|
2041
|
+
var _H = _G, {
|
|
1176
2042
|
className,
|
|
1177
2043
|
error,
|
|
1178
2044
|
value,
|
|
@@ -1182,7 +2048,7 @@ const NumericInput = (_I) => {
|
|
|
1182
2048
|
noControls,
|
|
1183
2049
|
style,
|
|
1184
2050
|
onChange
|
|
1185
|
-
} =
|
|
2051
|
+
} = _H, restProps = __objRest(_H, [
|
|
1186
2052
|
"className",
|
|
1187
2053
|
"error",
|
|
1188
2054
|
"value",
|
|
@@ -1194,10 +2060,10 @@ const NumericInput = (_I) => {
|
|
|
1194
2060
|
"onChange"
|
|
1195
2061
|
]);
|
|
1196
2062
|
const inputRef = React.useRef(null);
|
|
1197
|
-
const mergedClassNames = cx(styles$
|
|
1198
|
-
[styles$
|
|
1199
|
-
[styles$
|
|
1200
|
-
[styles$
|
|
2063
|
+
const mergedClassNames = cx(styles$k[baseClass$q], {
|
|
2064
|
+
[styles$k[`${baseClass$q}--error`]]: error,
|
|
2065
|
+
[styles$k[`${baseClass$q}--no-controls`]]: noControls,
|
|
2066
|
+
[styles$k[`${baseClass$q}--disabled`]]: disabled
|
|
1201
2067
|
}, className);
|
|
1202
2068
|
const callOnChange = (val) => onChange(String(val));
|
|
1203
2069
|
const calcValue = (val) => {
|
|
@@ -1262,115 +2128,670 @@ const NumericInput = (_I) => {
|
|
|
1262
2128
|
disabled: disabled || hasReachedTheLimit(value, max),
|
|
1263
2129
|
onClick: handleIncrementClick,
|
|
1264
2130
|
"aria-label": "Increment value",
|
|
1265
|
-
className: styles$
|
|
2131
|
+
className: styles$k[`${baseClass$q}__increment`],
|
|
1266
2132
|
type: "button"
|
|
1267
2133
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
1268
2134
|
source: ChevronUp,
|
|
1269
2135
|
disabled: disabled || hasReachedTheLimit(value, max),
|
|
1270
|
-
|
|
2136
|
+
kind: "primary"
|
|
1271
2137
|
})), /* @__PURE__ */ React.createElement("button", {
|
|
1272
2138
|
tabIndex: -1,
|
|
1273
2139
|
disabled: disabled || hasReachedTheLimit(value, min),
|
|
1274
2140
|
"aria-label": "Decrement value",
|
|
1275
|
-
className: styles$
|
|
2141
|
+
className: styles$k[`${baseClass$q}__decrement`],
|
|
1276
2142
|
onClick: handleDecrementClick,
|
|
1277
2143
|
type: "button"
|
|
1278
2144
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
1279
2145
|
source: ChevronDown,
|
|
1280
|
-
|
|
2146
|
+
kind: "primary",
|
|
1281
2147
|
disabled: disabled || hasReachedTheLimit(value, min)
|
|
1282
2148
|
}))));
|
|
1283
2149
|
};
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
"className",
|
|
1301
|
-
"inline",
|
|
1302
|
-
"error",
|
|
1303
|
-
"description",
|
|
1304
|
-
"labelRightNode",
|
|
1305
|
-
"fieldClassName",
|
|
1306
|
-
"style"
|
|
1307
|
-
]);
|
|
1308
|
-
return /* @__PURE__ */ React.createElement(TextField, {
|
|
1309
|
-
inline,
|
|
1310
|
-
error,
|
|
1311
|
-
description,
|
|
1312
|
-
labelText,
|
|
1313
|
-
labelAdornment,
|
|
1314
|
-
className,
|
|
1315
|
-
labelFor: id,
|
|
1316
|
-
labelRightNode
|
|
1317
|
-
}, /* @__PURE__ */ React.createElement(NumericInput, __spreadProps(__spreadValues({}, restProps), {
|
|
1318
|
-
id,
|
|
1319
|
-
className: fieldClassName,
|
|
1320
|
-
style,
|
|
1321
|
-
error
|
|
1322
|
-
})));
|
|
1323
|
-
};
|
|
1324
|
-
const popover = "lc-Popover-module__popover___8X1b2";
|
|
1325
|
-
var cssStyles = {
|
|
1326
|
-
popover,
|
|
1327
|
-
"popover--visible": "lc-Popover-module__popover--visible___u5NXB"
|
|
2150
|
+
var styles$j = {
|
|
2151
|
+
"picker-trigger": "lc-Trigger-module__picker-trigger___BIvTx",
|
|
2152
|
+
"picker-trigger--compact": "lc-Trigger-module__picker-trigger--compact___3i1DL",
|
|
2153
|
+
"picker-trigger--medium": "lc-Trigger-module__picker-trigger--medium___-fbEx",
|
|
2154
|
+
"picker-trigger--large": "lc-Trigger-module__picker-trigger--large___C8qkZ",
|
|
2155
|
+
"picker-trigger--multi-select": "lc-Trigger-module__picker-trigger--multi-select___rLpTy",
|
|
2156
|
+
"picker-trigger--multi-select--with-items": "lc-Trigger-module__picker-trigger--multi-select--with-items___QFhY2",
|
|
2157
|
+
"picker-trigger__controls": "lc-Trigger-module__picker-trigger__controls___EsSeM",
|
|
2158
|
+
"picker-trigger__controls--compact": "lc-Trigger-module__picker-trigger__controls--compact___g3P6e",
|
|
2159
|
+
"picker-trigger__controls--medium": "lc-Trigger-module__picker-trigger__controls--medium___G4OYQ",
|
|
2160
|
+
"picker-trigger__controls--large": "lc-Trigger-module__picker-trigger__controls--large___h-egq",
|
|
2161
|
+
"picker-trigger__clear-icon": "lc-Trigger-module__picker-trigger__clear-icon___8H-4T",
|
|
2162
|
+
"picker-trigger__content": "lc-Trigger-module__picker-trigger__content___bYnCH",
|
|
2163
|
+
"picker-trigger--disabled": "lc-Trigger-module__picker-trigger--disabled___7H4tD",
|
|
2164
|
+
"picker-trigger--focused": "lc-Trigger-module__picker-trigger--focused___vTr39",
|
|
2165
|
+
"picker-trigger--error": "lc-Trigger-module__picker-trigger--error___Rh8Qd"
|
|
1328
2166
|
};
|
|
1329
|
-
const
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
2167
|
+
const baseClass$p = "picker-trigger";
|
|
2168
|
+
const Trigger = ({
|
|
2169
|
+
children,
|
|
2170
|
+
isSearchDisabled,
|
|
2171
|
+
isDisabled,
|
|
2172
|
+
isError,
|
|
2173
|
+
isItemSelected,
|
|
2174
|
+
isOpen,
|
|
2175
|
+
isRequired,
|
|
2176
|
+
isMultiSelect,
|
|
2177
|
+
size = "medium",
|
|
2178
|
+
onTrigger,
|
|
2179
|
+
onClear
|
|
2180
|
+
}) => {
|
|
2181
|
+
const triggerRef = React.useRef(null);
|
|
2182
|
+
const mergedClassNames = cx(styles$j[baseClass$p], styles$j[`${baseClass$p}--${size}`], isMultiSelect && styles$j[`${baseClass$p}--multi-select`], isMultiSelect && isItemSelected && styles$j[`${baseClass$p}--multi-select--with-items`], isDisabled && styles$j[`${baseClass$p}--disabled`], isOpen && styles$j[`${baseClass$p}--focused`], isError && styles$j[`${baseClass$p}--error`]);
|
|
2183
|
+
React.useEffect(() => {
|
|
2184
|
+
const onKeyDown = (e) => {
|
|
2185
|
+
const isFocused = document.activeElement === triggerRef.current;
|
|
2186
|
+
if (isFocused && e.key !== KeyCodes.tab) {
|
|
2187
|
+
onTrigger(e);
|
|
2188
|
+
}
|
|
2189
|
+
};
|
|
2190
|
+
if (!isSearchDisabled) {
|
|
2191
|
+
document.addEventListener("keydown", onKeyDown);
|
|
1337
2192
|
}
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
2193
|
+
return () => {
|
|
2194
|
+
if (!isSearchDisabled) {
|
|
2195
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
2196
|
+
}
|
|
2197
|
+
};
|
|
2198
|
+
}, [isSearchDisabled]);
|
|
2199
|
+
const handleTriggerClick = (e) => {
|
|
2200
|
+
onTrigger(e);
|
|
2201
|
+
};
|
|
2202
|
+
const handleOnClearClick = (e) => {
|
|
2203
|
+
e.stopPropagation();
|
|
2204
|
+
onClear();
|
|
2205
|
+
};
|
|
2206
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2207
|
+
ref: triggerRef,
|
|
2208
|
+
className: mergedClassNames,
|
|
2209
|
+
onClick: handleTriggerClick,
|
|
2210
|
+
tabIndex: 0
|
|
2211
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2212
|
+
className: styles$j[`${baseClass$p}__content`]
|
|
2213
|
+
}, children), /* @__PURE__ */ React.createElement("div", {
|
|
2214
|
+
className: cx(styles$j[`${baseClass$p}__controls`], styles$j[`${baseClass$p}__controls--${size}`])
|
|
2215
|
+
}, isItemSelected && !isDisabled && !isRequired && /* @__PURE__ */ React.createElement("div", {
|
|
2216
|
+
"data-testid": `${baseClass$p}__clear-icon`,
|
|
2217
|
+
className: styles$j[`${baseClass$p}__clear-icon`],
|
|
2218
|
+
onClick: handleOnClearClick
|
|
2219
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
2220
|
+
kind: "primary",
|
|
2221
|
+
size: "small",
|
|
2222
|
+
source: Close
|
|
2223
|
+
})), /* @__PURE__ */ React.createElement(Icon, {
|
|
2224
|
+
className: styles$j[`${baseClass$p}__chevron-icon`],
|
|
2225
|
+
source: !isOpen ? ChevronDown : ChevronUp,
|
|
2226
|
+
size: "large",
|
|
2227
|
+
disabled: isDisabled
|
|
2228
|
+
})));
|
|
2229
|
+
};
|
|
2230
|
+
var styles$i = {
|
|
2231
|
+
"picker-list": "lc-PickerList-module__picker-list___FqdgZ",
|
|
2232
|
+
"picker-list__no-results": "lc-PickerList-module__picker-list__no-results___tX172",
|
|
2233
|
+
"picker-list__item": "lc-PickerList-module__picker-list__item___8QNS0",
|
|
2234
|
+
"picker-list__item--select-all": "lc-PickerList-module__picker-list__item--select-all___PlTHV",
|
|
2235
|
+
"picker-list__item__header": "lc-PickerList-module__picker-list__item__header___mxmg0",
|
|
2236
|
+
"picker-list__item__content": "lc-PickerList-module__picker-list__item__content___D-tsE",
|
|
2237
|
+
"picker-list__item__custom": "lc-PickerList-module__picker-list__item__custom___kJEP6"
|
|
2238
|
+
};
|
|
2239
|
+
const SELECT_ALL_OPTION_KEY = "select-all";
|
|
2240
|
+
const baseClass$o = "picker-list";
|
|
2241
|
+
const itemClassName = `${baseClass$o}__item`;
|
|
2242
|
+
const PickerList = ({
|
|
2243
|
+
isOpen,
|
|
2244
|
+
items,
|
|
2245
|
+
selectedItemsKeys,
|
|
2246
|
+
emptyStateText = "No results found",
|
|
2247
|
+
selectAllOptionText,
|
|
2248
|
+
isMultiSelect,
|
|
2249
|
+
onClose,
|
|
2250
|
+
onSelect,
|
|
2251
|
+
onSelectAll
|
|
2252
|
+
}) => {
|
|
2253
|
+
const mergedClassNames = cx(styles$i[baseClass$o], {
|
|
2254
|
+
[styles$i[`${baseClass$o}__no-results`]]: items.length === 0
|
|
2255
|
+
});
|
|
2256
|
+
const [currentItemKey, setCurrentItemKey] = React.useState(null);
|
|
2257
|
+
const indexRef = React.useRef(-1);
|
|
2258
|
+
const lastIndexRef = React.useRef(0);
|
|
2259
|
+
const listRef = React.useRef(null);
|
|
2260
|
+
const onKeyDown = (e) => {
|
|
2261
|
+
if (e.key === KeyCodes.esc) {
|
|
2262
|
+
e.preventDefault();
|
|
2263
|
+
onClose();
|
|
1343
2264
|
}
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
options: __spreadValues({
|
|
1349
|
-
rootBoundary: "viewport"
|
|
1350
|
-
}, preventOverflow || {})
|
|
2265
|
+
if (e.key === KeyCodes.arrowUp && indexRef.current > 0) {
|
|
2266
|
+
e.preventDefault();
|
|
2267
|
+
indexRef.current = getPrevItemIndex();
|
|
2268
|
+
setCurrentItemKey(items[indexRef.current].key);
|
|
1351
2269
|
}
|
|
1352
|
-
|
|
1353
|
-
|
|
2270
|
+
if (e.key === KeyCodes.arrowDown && indexRef.current + 1 < items.length) {
|
|
2271
|
+
e.preventDefault();
|
|
2272
|
+
indexRef.current = getNextItemIndex();
|
|
2273
|
+
setCurrentItemKey(items[indexRef.current].key);
|
|
2274
|
+
}
|
|
2275
|
+
if (e.key === KeyCodes.enter && !items[indexRef.current].disabled) {
|
|
2276
|
+
e.preventDefault();
|
|
2277
|
+
if (items[indexRef.current].key === SELECT_ALL_OPTION_KEY) {
|
|
2278
|
+
return onSelectAll();
|
|
2279
|
+
}
|
|
2280
|
+
onSelect(items[indexRef.current]);
|
|
2281
|
+
}
|
|
2282
|
+
};
|
|
2283
|
+
React.useEffect(() => {
|
|
2284
|
+
if (indexRef.current > -1 && items.length > 0) {
|
|
2285
|
+
setCurrentItemKey(items[indexRef.current].key);
|
|
2286
|
+
}
|
|
2287
|
+
if (isOpen) {
|
|
2288
|
+
document.addEventListener("keydown", onKeyDown);
|
|
2289
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
2290
|
+
} else {
|
|
2291
|
+
indexRef.current = -1;
|
|
2292
|
+
lastIndexRef.current = 0;
|
|
2293
|
+
setCurrentItemKey(null);
|
|
2294
|
+
}
|
|
2295
|
+
}, [items, isOpen, onKeyDown]);
|
|
2296
|
+
const isHeaderOrDisabled = (i) => !!items[i] && (items[i].disabled || items[i].groupHeader);
|
|
2297
|
+
const getPrevItemIndex = () => {
|
|
2298
|
+
indexRef.current = indexRef.current - 1;
|
|
2299
|
+
while (isHeaderOrDisabled(indexRef.current)) {
|
|
2300
|
+
indexRef.current = indexRef.current - 1;
|
|
2301
|
+
if (!isHeaderOrDisabled(indexRef.current)) {
|
|
2302
|
+
break;
|
|
2303
|
+
}
|
|
2304
|
+
}
|
|
2305
|
+
lastIndexRef.current = indexRef.current;
|
|
2306
|
+
return indexRef.current;
|
|
2307
|
+
};
|
|
2308
|
+
const getNextItemIndex = () => {
|
|
2309
|
+
indexRef.current = indexRef.current + 1;
|
|
2310
|
+
if (!isHeaderOrDisabled(indexRef.current)) {
|
|
2311
|
+
lastIndexRef.current = indexRef.current;
|
|
2312
|
+
return indexRef.current;
|
|
2313
|
+
}
|
|
2314
|
+
while (isHeaderOrDisabled(indexRef.current)) {
|
|
2315
|
+
indexRef.current = indexRef.current + 1;
|
|
2316
|
+
if (indexRef.current === items.length && !isHeaderOrDisabled(indexRef.current)) {
|
|
2317
|
+
return lastIndexRef.current;
|
|
2318
|
+
}
|
|
2319
|
+
if (!isHeaderOrDisabled(indexRef.current)) {
|
|
2320
|
+
break;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
lastIndexRef.current = indexRef.current;
|
|
2324
|
+
return indexRef.current;
|
|
2325
|
+
};
|
|
2326
|
+
const handleOnClick = (item) => onSelect(item);
|
|
2327
|
+
const handleOnSelectAllClick = () => onSelectAll();
|
|
2328
|
+
const isItemSelected = (key) => {
|
|
2329
|
+
if (!selectedItemsKeys) {
|
|
2330
|
+
return false;
|
|
2331
|
+
}
|
|
2332
|
+
return selectedItemsKeys.includes(key);
|
|
2333
|
+
};
|
|
2334
|
+
const getSelectAllOption = () => {
|
|
2335
|
+
if (!isMultiSelect || isMultiSelect && !selectAllOptionText) {
|
|
2336
|
+
return null;
|
|
2337
|
+
}
|
|
2338
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
2339
|
+
ref: (element) => {
|
|
2340
|
+
if (currentItemKey === SELECT_ALL_OPTION_KEY) {
|
|
2341
|
+
element == null ? void 0 : element.scrollIntoView({ block: "nearest" });
|
|
2342
|
+
}
|
|
2343
|
+
},
|
|
2344
|
+
role: "option",
|
|
2345
|
+
"aria-current": currentItemKey === SELECT_ALL_OPTION_KEY,
|
|
2346
|
+
id: SELECT_ALL_OPTION_KEY,
|
|
2347
|
+
key: SELECT_ALL_OPTION_KEY,
|
|
2348
|
+
className: cx(styles$i[itemClassName], styles$i[`${itemClassName}--select-all`]),
|
|
2349
|
+
onClick: handleOnSelectAllClick
|
|
2350
|
+
}, selectAllOptionText);
|
|
2351
|
+
};
|
|
2352
|
+
const getOptionContent = (item) => {
|
|
2353
|
+
if (item == null ? void 0 : item.customElement) {
|
|
2354
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2355
|
+
className: styles$i[`${itemClassName}__custom`]
|
|
2356
|
+
}, item.customElement.listItemBody);
|
|
2357
|
+
}
|
|
2358
|
+
return item.name;
|
|
2359
|
+
};
|
|
2360
|
+
if (!isOpen) {
|
|
2361
|
+
return null;
|
|
2362
|
+
}
|
|
2363
|
+
if (items.length === 0) {
|
|
2364
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2365
|
+
className: mergedClassNames
|
|
2366
|
+
}, emptyStateText);
|
|
2367
|
+
}
|
|
2368
|
+
return /* @__PURE__ */ React.createElement("ul", {
|
|
2369
|
+
ref: listRef,
|
|
2370
|
+
className: mergedClassNames,
|
|
2371
|
+
role: "listbox",
|
|
2372
|
+
tabIndex: -1
|
|
2373
|
+
}, getSelectAllOption(), items.map((item) => {
|
|
2374
|
+
if (item.groupHeader) {
|
|
2375
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
2376
|
+
role: "option",
|
|
2377
|
+
key: item.key,
|
|
2378
|
+
className: styles$i[`${itemClassName}__header`]
|
|
2379
|
+
}, item.name);
|
|
2380
|
+
}
|
|
2381
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
2382
|
+
"data-testid": item.key,
|
|
2383
|
+
ref: (element) => {
|
|
2384
|
+
if (currentItemKey === item.key) {
|
|
2385
|
+
element == null ? void 0 : element.scrollIntoView({ block: "nearest" });
|
|
2386
|
+
}
|
|
2387
|
+
},
|
|
2388
|
+
role: "option",
|
|
2389
|
+
"aria-current": currentItemKey === item.key,
|
|
2390
|
+
"aria-selected": isItemSelected(item.key),
|
|
2391
|
+
"aria-disabled": item.disabled,
|
|
2392
|
+
id: item.key,
|
|
2393
|
+
key: item.key,
|
|
2394
|
+
className: cx(styles$i[itemClassName], {
|
|
2395
|
+
[styles$i[`${itemClassName}__custom`]]: item == null ? void 0 : item.customElement
|
|
2396
|
+
}),
|
|
2397
|
+
onClick: () => !item.disabled && handleOnClick(item)
|
|
2398
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2399
|
+
className: styles$i[`${itemClassName}__content`]
|
|
2400
|
+
}, getOptionContent(item)), isItemSelected(item.key) && /* @__PURE__ */ React.createElement(Icon, {
|
|
2401
|
+
kind: "link",
|
|
2402
|
+
source: Check
|
|
2403
|
+
}));
|
|
2404
|
+
}));
|
|
2405
|
+
};
|
|
2406
|
+
const picker = "lc-Picker-module__picker___GRj9W";
|
|
2407
|
+
const picker__container = "lc-Picker-module__picker__container___s0PUc";
|
|
2408
|
+
const picker__label = "lc-Picker-module__picker__label___Ac7Vu";
|
|
2409
|
+
const picker__error = "lc-Picker-module__picker__error___H865k";
|
|
2410
|
+
const picker__error__icon = "lc-Picker-module__picker__error__icon___bbL7r";
|
|
2411
|
+
var styles$h = {
|
|
2412
|
+
picker,
|
|
2413
|
+
picker__container,
|
|
2414
|
+
picker__label,
|
|
2415
|
+
"picker__label--disabled": "lc-Picker-module__picker__label--disabled___Opu7s",
|
|
2416
|
+
picker__error,
|
|
2417
|
+
picker__error__icon
|
|
2418
|
+
};
|
|
2419
|
+
const tag = "lc-Tag-module__tag___1QRVY";
|
|
2420
|
+
const tag__remove = "lc-Tag-module__tag__remove___UmtrW";
|
|
2421
|
+
const icon = "lc-Tag-module__icon___2Z-35";
|
|
2422
|
+
const tag__icon = "lc-Tag-module__tag__icon___tZoQ9";
|
|
2423
|
+
const tag__avatar = "lc-Tag-module__tag__avatar___U4c-P";
|
|
2424
|
+
var styles$g = {
|
|
2425
|
+
tag,
|
|
2426
|
+
"tag--success": "lc-Tag-module__tag--success___P2hXQ",
|
|
2427
|
+
tag__remove,
|
|
2428
|
+
"tag--error": "lc-Tag-module__tag--error___1cjsm",
|
|
2429
|
+
"tag--warning": "lc-Tag-module__tag--warning___PstMG",
|
|
2430
|
+
"tag--info": "lc-Tag-module__tag--info___RTH0C",
|
|
2431
|
+
"tag--medium": "lc-Tag-module__tag--medium___l5-KI",
|
|
2432
|
+
"tag--large": "lc-Tag-module__tag--large___ytC6Y",
|
|
2433
|
+
"tag--outline": "lc-Tag-module__tag--outline___aZXtr",
|
|
2434
|
+
icon,
|
|
2435
|
+
"tag--text-white": "lc-Tag-module__tag--text-white___x0fnD",
|
|
2436
|
+
"tag--text-black": "lc-Tag-module__tag--text-black___dUvmD",
|
|
2437
|
+
"tag--with-icon": "lc-Tag-module__tag--with-icon___ZlkvT",
|
|
2438
|
+
"tag--dismissible": "lc-Tag-module__tag--dismissible___Qobyr",
|
|
2439
|
+
tag__icon,
|
|
2440
|
+
tag__avatar
|
|
2441
|
+
};
|
|
2442
|
+
const baseClass$n = "tag";
|
|
2443
|
+
const getCustomTextClass = (customColor) => {
|
|
2444
|
+
if (!customColor) {
|
|
2445
|
+
return "";
|
|
2446
|
+
}
|
|
2447
|
+
return getContrast(customColor, "#FFFFFF") > 4.5 ? "text-white" : "text-black";
|
|
2448
|
+
};
|
|
2449
|
+
const Tag = (_I) => {
|
|
2450
|
+
var _J = _I, {
|
|
2451
|
+
className = "",
|
|
2452
|
+
children,
|
|
2453
|
+
dismissible = false,
|
|
2454
|
+
size = "medium",
|
|
2455
|
+
iconSize = "medium",
|
|
2456
|
+
kind = "default",
|
|
2457
|
+
onRemove,
|
|
2458
|
+
outline = false,
|
|
2459
|
+
icon: icon2,
|
|
2460
|
+
avatar: avatar2,
|
|
2461
|
+
customColor
|
|
2462
|
+
} = _J, restProps = __objRest(_J, [
|
|
2463
|
+
"className",
|
|
2464
|
+
"children",
|
|
2465
|
+
"dismissible",
|
|
2466
|
+
"size",
|
|
2467
|
+
"iconSize",
|
|
2468
|
+
"kind",
|
|
2469
|
+
"onRemove",
|
|
2470
|
+
"outline",
|
|
2471
|
+
"icon",
|
|
2472
|
+
"avatar",
|
|
2473
|
+
"customColor"
|
|
2474
|
+
]);
|
|
2475
|
+
const mergedClassNames = cx(styles$g[baseClass$n], className, styles$g[`${baseClass$n}--${size}`], styles$g[`${baseClass$n}--${kind}`], {
|
|
2476
|
+
[styles$g[`${baseClass$n}--dismissible`]]: dismissible,
|
|
2477
|
+
[styles$g[`${baseClass$n}--outline`]]: outline,
|
|
2478
|
+
[styles$g[`${baseClass$n}--with-icon`]]: !!icon2 || !!avatar2,
|
|
2479
|
+
[styles$g[`${baseClass$n}--${getCustomTextClass(customColor)}`]]: !!customColor
|
|
2480
|
+
});
|
|
2481
|
+
const getCustomColorStyles = () => {
|
|
2482
|
+
if (!customColor) {
|
|
2483
|
+
return {};
|
|
2484
|
+
}
|
|
2485
|
+
if (outline) {
|
|
2486
|
+
return {
|
|
2487
|
+
style: {
|
|
2488
|
+
backgroundColor: "transparent",
|
|
2489
|
+
color: customColor,
|
|
2490
|
+
borderColor: customColor
|
|
2491
|
+
}
|
|
2492
|
+
};
|
|
2493
|
+
}
|
|
2494
|
+
return { style: { backgroundColor: customColor } };
|
|
2495
|
+
};
|
|
2496
|
+
const getIconCustomColor = () => {
|
|
2497
|
+
if (!customColor) {
|
|
2498
|
+
return void 0;
|
|
2499
|
+
}
|
|
2500
|
+
if (outline) {
|
|
2501
|
+
return customColor;
|
|
2502
|
+
}
|
|
2503
|
+
return getContrast(customColor, "#FFFFFF") > 4.5 ? "#FFFFFF" : "#000000";
|
|
2504
|
+
};
|
|
2505
|
+
return /* @__PURE__ */ React.createElement(Text, __spreadProps(__spreadValues(__spreadValues({
|
|
2506
|
+
className: mergedClassNames
|
|
2507
|
+
}, restProps), getCustomColorStyles()), {
|
|
2508
|
+
as: "div",
|
|
2509
|
+
size: "md"
|
|
2510
|
+
}), avatar2 && /* @__PURE__ */ React.createElement("img", {
|
|
2511
|
+
className: styles$g[`${baseClass$n}__avatar`],
|
|
2512
|
+
src: avatar2,
|
|
2513
|
+
alt: "tag-avatar",
|
|
2514
|
+
"data-testid": "lc-tag-avatar"
|
|
2515
|
+
}), " ", icon2 && !avatar2 && /* @__PURE__ */ React.createElement(Icon, {
|
|
2516
|
+
"data-testid": "lc-tag-icon",
|
|
2517
|
+
className: styles$g[`${baseClass$n}__icon`],
|
|
2518
|
+
source: icon2,
|
|
2519
|
+
size: "small",
|
|
2520
|
+
customColor: getIconCustomColor()
|
|
2521
|
+
}), children, dismissible && /* @__PURE__ */ React.createElement("button", {
|
|
2522
|
+
title: "Remove",
|
|
2523
|
+
onClick: onRemove,
|
|
2524
|
+
type: "button",
|
|
2525
|
+
className: styles$g[`${baseClass$n}__remove`]
|
|
2526
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
2527
|
+
"data-dismiss-icon": true,
|
|
2528
|
+
source: Close,
|
|
2529
|
+
size: iconSize,
|
|
2530
|
+
customColor: getIconCustomColor()
|
|
2531
|
+
})));
|
|
2532
|
+
};
|
|
2533
|
+
var styles$f = {
|
|
2534
|
+
"picker-trigger-body": "lc-TriggerBody-module__picker-trigger-body___ZWjX9",
|
|
2535
|
+
"picker-trigger-body__item": "lc-TriggerBody-module__picker-trigger-body__item___0DBg1",
|
|
2536
|
+
"picker-trigger-body__input": "lc-TriggerBody-module__picker-trigger-body__input___ezPyz"
|
|
2537
|
+
};
|
|
2538
|
+
const baseClass$m = "picker-trigger-body";
|
|
2539
|
+
const TriggerBody = ({
|
|
2540
|
+
isOpen,
|
|
2541
|
+
isSearchDisabled,
|
|
2542
|
+
isDisabled,
|
|
2543
|
+
placeholder,
|
|
2544
|
+
items,
|
|
2545
|
+
type,
|
|
2546
|
+
iconSize,
|
|
2547
|
+
onItemRemove,
|
|
2548
|
+
onFilter
|
|
2549
|
+
}) => {
|
|
2550
|
+
const shouldDisplaySearch = isOpen && !isSearchDisabled;
|
|
2551
|
+
const getSingleItem = (item) => {
|
|
2552
|
+
if (type === "single" && isOpen && !isSearchDisabled) {
|
|
2553
|
+
return null;
|
|
2554
|
+
}
|
|
2555
|
+
if (item == null ? void 0 : item.customElement) {
|
|
2556
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2557
|
+
className: styles$f[`${baseClass$m}__custom`]
|
|
2558
|
+
}, item.customElement.selectedItemBody);
|
|
2559
|
+
}
|
|
2560
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2561
|
+
className: styles$f[`${baseClass$m}__item`]
|
|
2562
|
+
}, item.name);
|
|
2563
|
+
};
|
|
2564
|
+
const handleOnChange = (e) => {
|
|
2565
|
+
onFilter(e.target.value);
|
|
2566
|
+
};
|
|
2567
|
+
const getSearch = () => /* @__PURE__ */ React.createElement("input", {
|
|
2568
|
+
className: styles$f[`${baseClass$m}__input`],
|
|
2569
|
+
placeholder: "Select option",
|
|
2570
|
+
onChange: handleOnChange,
|
|
2571
|
+
autoFocus: true
|
|
2572
|
+
});
|
|
2573
|
+
if (!items || items.length === 0) {
|
|
2574
|
+
return shouldDisplaySearch ? getSearch() : /* @__PURE__ */ React.createElement("div", null, placeholder);
|
|
2575
|
+
}
|
|
2576
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2577
|
+
className: styles$f[baseClass$m]
|
|
2578
|
+
}, type === "single" ? getSingleItem(items[0]) : items.map((item) => {
|
|
2579
|
+
return /* @__PURE__ */ React.createElement(Tag, {
|
|
2580
|
+
key: item.name,
|
|
2581
|
+
className: styles$f[`${baseClass$m}__tag`],
|
|
2582
|
+
iconSize,
|
|
2583
|
+
dismissible: !isDisabled,
|
|
2584
|
+
onRemove: () => onItemRemove(item)
|
|
2585
|
+
}, getSingleItem(item));
|
|
2586
|
+
}), shouldDisplaySearch && getSearch());
|
|
2587
|
+
};
|
|
2588
|
+
const baseClass$l = "picker";
|
|
2589
|
+
const Picker = ({
|
|
2590
|
+
className,
|
|
2591
|
+
disabled,
|
|
2592
|
+
error,
|
|
2593
|
+
label,
|
|
2594
|
+
options,
|
|
2595
|
+
selected,
|
|
2596
|
+
size = "medium",
|
|
2597
|
+
tagIconSize = "medium",
|
|
2598
|
+
placeholder = "Select option",
|
|
2599
|
+
isRequired,
|
|
2600
|
+
noSearchResultText = "No results found",
|
|
2601
|
+
selectAllOptionText,
|
|
2602
|
+
type = "single",
|
|
2603
|
+
searchDisabled = false,
|
|
2604
|
+
onSelect
|
|
2605
|
+
}) => {
|
|
2606
|
+
const [isListOpen, setIsListOpen] = React.useState(false);
|
|
2607
|
+
const [searchPhrase, setSearchPhrase] = React.useState(null);
|
|
2608
|
+
const triggerRef = React.useRef(null);
|
|
2609
|
+
const mergedClassNames = cx(styles$h[baseClass$l], className);
|
|
2610
|
+
React.useEffect(() => {
|
|
2611
|
+
if (isListOpen) {
|
|
2612
|
+
const onDocumentClick = (e) => {
|
|
2613
|
+
var _a;
|
|
2614
|
+
if (!((_a = triggerRef.current) == null ? void 0 : _a.contains(e.target))) {
|
|
2615
|
+
setIsListOpen(false);
|
|
2616
|
+
}
|
|
2617
|
+
};
|
|
2618
|
+
const onKeyDown = (e) => {
|
|
2619
|
+
if (e.key === KeyCodes.tab) {
|
|
2620
|
+
setIsListOpen(false);
|
|
2621
|
+
}
|
|
2622
|
+
};
|
|
2623
|
+
document.addEventListener("mousedown", onDocumentClick);
|
|
2624
|
+
document.addEventListener("keydown", onKeyDown);
|
|
2625
|
+
return () => {
|
|
2626
|
+
document.removeEventListener("mousedown", onDocumentClick);
|
|
2627
|
+
document.addEventListener("keydown", onKeyDown);
|
|
2628
|
+
};
|
|
2629
|
+
} else {
|
|
2630
|
+
setSearchPhrase(null);
|
|
2631
|
+
}
|
|
2632
|
+
}, [isListOpen]);
|
|
2633
|
+
const handleTrigger = (e) => {
|
|
2634
|
+
const target = e.target;
|
|
2635
|
+
if (disabled || target.getAttribute("data-dismiss-icon")) {
|
|
2636
|
+
return;
|
|
2637
|
+
}
|
|
2638
|
+
setIsListOpen((prev) => !prev);
|
|
2639
|
+
};
|
|
2640
|
+
const handleOnClose = () => {
|
|
2641
|
+
setIsListOpen(false);
|
|
2642
|
+
};
|
|
2643
|
+
const handleSelect = (item) => {
|
|
2644
|
+
if (type === "single") {
|
|
2645
|
+
setIsListOpen(false);
|
|
2646
|
+
return onSelect([item]);
|
|
2647
|
+
}
|
|
2648
|
+
const selectedItemKey = item.key;
|
|
2649
|
+
const currentSelectedItemsKeys = selectedItemsKeys;
|
|
2650
|
+
if (!currentSelectedItemsKeys) {
|
|
2651
|
+
return onSelect([item]);
|
|
2652
|
+
}
|
|
2653
|
+
const newSelectedItemsKeys = currentSelectedItemsKeys.includes(selectedItemKey) ? currentSelectedItemsKeys.filter((key) => key !== selectedItemKey) : currentSelectedItemsKeys.concat(selectedItemKey);
|
|
2654
|
+
if ((newSelectedItemsKeys == null ? void 0 : newSelectedItemsKeys.length) === 0) {
|
|
2655
|
+
return onSelect(null);
|
|
2656
|
+
}
|
|
2657
|
+
const newSelectedItems = options.filter((item2) => newSelectedItemsKeys.includes(item2.key));
|
|
2658
|
+
onSelect(newSelectedItems);
|
|
2659
|
+
};
|
|
2660
|
+
const isItemSelectable = (item) => !item.disabled && !item.groupHeader && item.key !== SELECT_ALL_OPTION_KEY;
|
|
2661
|
+
const handleSelectAll = () => {
|
|
2662
|
+
setIsListOpen(false);
|
|
2663
|
+
const itemsToSelect = items.filter(isItemSelectable);
|
|
2664
|
+
onSelect(itemsToSelect);
|
|
2665
|
+
};
|
|
2666
|
+
const handleClear = () => {
|
|
2667
|
+
setIsListOpen(false);
|
|
2668
|
+
onSelect(null);
|
|
2669
|
+
};
|
|
2670
|
+
const handleOnFilter = (text) => setSearchPhrase(text);
|
|
2671
|
+
const handleItemRemove = (item) => {
|
|
2672
|
+
const newSelectedItems = selected ? selected.filter((selectedItem) => selectedItem !== item) : null;
|
|
2673
|
+
if ((newSelectedItems == null ? void 0 : newSelectedItems.length) === 0) {
|
|
2674
|
+
return onSelect(null);
|
|
2675
|
+
}
|
|
2676
|
+
onSelect(newSelectedItems);
|
|
2677
|
+
};
|
|
2678
|
+
const items = React.useMemo(() => {
|
|
2679
|
+
if (!searchPhrase) {
|
|
2680
|
+
return options;
|
|
2681
|
+
}
|
|
2682
|
+
return options.filter((item) => {
|
|
2683
|
+
if (item.groupHeader) {
|
|
2684
|
+
return false;
|
|
2685
|
+
}
|
|
2686
|
+
const search = searchPhrase.toLowerCase();
|
|
2687
|
+
const itemName = item.name.toLowerCase();
|
|
2688
|
+
return itemName.includes(search);
|
|
2689
|
+
});
|
|
2690
|
+
}, [searchPhrase]);
|
|
2691
|
+
const selectedItemsKeys = React.useMemo(() => {
|
|
2692
|
+
if (!selected) {
|
|
2693
|
+
return null;
|
|
2694
|
+
}
|
|
2695
|
+
return selected.map((item) => item.key);
|
|
2696
|
+
}, [selected]);
|
|
2697
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2698
|
+
ref: triggerRef,
|
|
2699
|
+
className: mergedClassNames
|
|
2700
|
+
}, label && /* @__PURE__ */ React.createElement("div", {
|
|
2701
|
+
className: cx(styles$h[`${baseClass$l}__label`], {
|
|
2702
|
+
[styles$h[`${baseClass$l}__label--disabled`]]: disabled
|
|
2703
|
+
})
|
|
2704
|
+
}, label), /* @__PURE__ */ React.createElement("div", {
|
|
2705
|
+
className: styles$h[`${baseClass$l}__container`]
|
|
2706
|
+
}, /* @__PURE__ */ React.createElement(Trigger, {
|
|
2707
|
+
isSearchDisabled: searchDisabled,
|
|
2708
|
+
isError: !!error,
|
|
2709
|
+
isOpen: isListOpen,
|
|
2710
|
+
isDisabled: disabled,
|
|
2711
|
+
isItemSelected: !!selected,
|
|
2712
|
+
isRequired,
|
|
2713
|
+
isMultiSelect: type === "multi",
|
|
2714
|
+
size,
|
|
2715
|
+
onTrigger: handleTrigger,
|
|
2716
|
+
onClear: handleClear
|
|
2717
|
+
}, /* @__PURE__ */ React.createElement(TriggerBody, {
|
|
2718
|
+
isOpen: isListOpen,
|
|
2719
|
+
isSearchDisabled: searchDisabled,
|
|
2720
|
+
isDisabled: disabled,
|
|
2721
|
+
placeholder,
|
|
2722
|
+
iconSize: tagIconSize,
|
|
2723
|
+
items: selected,
|
|
2724
|
+
type,
|
|
2725
|
+
onItemRemove: handleItemRemove,
|
|
2726
|
+
onFilter: handleOnFilter
|
|
2727
|
+
})), /* @__PURE__ */ React.createElement(PickerList, {
|
|
2728
|
+
selectedItemsKeys,
|
|
2729
|
+
items,
|
|
2730
|
+
isOpen: isListOpen,
|
|
2731
|
+
isMultiSelect: type === "multi",
|
|
2732
|
+
emptyStateText: noSearchResultText,
|
|
2733
|
+
selectAllOptionText,
|
|
2734
|
+
onClose: handleOnClose,
|
|
2735
|
+
onSelect: handleSelect,
|
|
2736
|
+
onSelectAll: handleSelectAll
|
|
2737
|
+
})), error && /* @__PURE__ */ React.createElement("div", {
|
|
2738
|
+
className: styles$h[`${baseClass$l}__error`]
|
|
2739
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
2740
|
+
className: styles$h[`${baseClass$l}__error__icon`],
|
|
2741
|
+
source: Error2,
|
|
2742
|
+
kind: "error",
|
|
2743
|
+
size: "small"
|
|
2744
|
+
}), error));
|
|
2745
|
+
};
|
|
2746
|
+
const popover = "lc-Popover-module__popover___8X1b2";
|
|
2747
|
+
var cssStyles = {
|
|
2748
|
+
popover,
|
|
2749
|
+
"popover--visible": "lc-Popover-module__popover--visible___u5NXB"
|
|
1354
2750
|
};
|
|
1355
2751
|
const Popover = (props) => {
|
|
1356
2752
|
const {
|
|
1357
2753
|
triggerRenderer,
|
|
2754
|
+
onClose,
|
|
1358
2755
|
children,
|
|
1359
2756
|
className,
|
|
1360
2757
|
placement,
|
|
2758
|
+
flipOptions,
|
|
1361
2759
|
isVisible = false
|
|
1362
2760
|
} = props;
|
|
1363
|
-
const rendererRef = React.useRef(null);
|
|
1364
|
-
const popperRef = React.useRef(null);
|
|
1365
2761
|
const [visible, setVisibility] = React.useState(false);
|
|
2762
|
+
const prevVisibleState = React.useRef(false);
|
|
2763
|
+
const {
|
|
2764
|
+
x,
|
|
2765
|
+
y,
|
|
2766
|
+
reference,
|
|
2767
|
+
floating,
|
|
2768
|
+
strategy,
|
|
2769
|
+
refs,
|
|
2770
|
+
update,
|
|
2771
|
+
placement: updatedPlacement
|
|
2772
|
+
} = useFloating({
|
|
2773
|
+
middleware: [offset(4), flip(flipOptions)],
|
|
2774
|
+
placement
|
|
2775
|
+
});
|
|
1366
2776
|
React.useEffect(() => {
|
|
1367
2777
|
setVisibility(isVisible);
|
|
1368
2778
|
}, [isVisible]);
|
|
2779
|
+
React.useEffect(() => {
|
|
2780
|
+
if (onClose && prevVisibleState.current !== visible && !visible) {
|
|
2781
|
+
onClose();
|
|
2782
|
+
}
|
|
2783
|
+
prevVisibleState.current = visible;
|
|
2784
|
+
}, [visible]);
|
|
2785
|
+
React.useEffect(() => {
|
|
2786
|
+
if (!refs.reference.current || !refs.floating.current) {
|
|
2787
|
+
return;
|
|
2788
|
+
}
|
|
2789
|
+
return autoUpdate(refs.reference.current, refs.floating.current, update);
|
|
2790
|
+
}, [refs.reference, refs.floating, update, updatedPlacement, visible]);
|
|
1369
2791
|
function handleDocumentClick(event) {
|
|
1370
|
-
|
|
1371
|
-
if ((_a = popperRef.current) == null ? void 0 : _a.contains(event.target)) {
|
|
2792
|
+
if (refs.floating.current && refs.floating.current.contains(event.target)) {
|
|
1372
2793
|
return;
|
|
1373
|
-
} else if (
|
|
2794
|
+
} else if (refs.reference.current && refs.reference.current.contains(event.target)) {
|
|
1374
2795
|
setVisibility((prevVisible) => !prevVisible);
|
|
1375
2796
|
} else {
|
|
1376
2797
|
setVisibility(false);
|
|
@@ -1389,33 +2810,22 @@ const Popover = (props) => {
|
|
|
1389
2810
|
document.removeEventListener("mousedown", handleDocumentClick);
|
|
1390
2811
|
};
|
|
1391
2812
|
}, []);
|
|
1392
|
-
const { styles: styles2, attributes } = usePopper(rendererRef.current, popperRef.current, {
|
|
1393
|
-
modifiers: props.modifiers ? buildPopperModifiers(props.modifiers) : [],
|
|
1394
|
-
placement
|
|
1395
|
-
});
|
|
1396
2813
|
const mergedClassNames = cx(cssStyles["popover"], className, {
|
|
1397
2814
|
[cssStyles["popover--visible"]]: visible
|
|
1398
2815
|
});
|
|
1399
2816
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
2817
|
+
style: { width: "fit-content" },
|
|
2818
|
+
ref: reference
|
|
2819
|
+
}, triggerRenderer()), /* @__PURE__ */ React.createElement("div", {
|
|
2820
|
+
ref: floating,
|
|
1403
2821
|
className: mergedClassNames,
|
|
1404
|
-
style:
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
return ProgressStatus2;
|
|
1412
|
-
})(ProgressStatus || {});
|
|
1413
|
-
var ProgressSize = /* @__PURE__ */ ((ProgressSize2) => {
|
|
1414
|
-
ProgressSize2["Small"] = "small";
|
|
1415
|
-
ProgressSize2["Medium"] = "medium";
|
|
1416
|
-
ProgressSize2["Large"] = "large";
|
|
1417
|
-
return ProgressSize2;
|
|
1418
|
-
})(ProgressSize || {});
|
|
2822
|
+
style: {
|
|
2823
|
+
position: strategy,
|
|
2824
|
+
top: y != null ? y : "",
|
|
2825
|
+
left: x != null ? x : ""
|
|
2826
|
+
}
|
|
2827
|
+
}, children));
|
|
2828
|
+
};
|
|
1419
2829
|
const PROGRESS_STATUSES = [
|
|
1420
2830
|
"normal",
|
|
1421
2831
|
"error",
|
|
@@ -1423,18 +2833,18 @@ const PROGRESS_STATUSES = [
|
|
|
1423
2833
|
];
|
|
1424
2834
|
const clampPercentage = (percent) => Math.min(Math.max(percent, 0), 100);
|
|
1425
2835
|
function getPercentNumber(status, percent = 0) {
|
|
1426
|
-
if (status ===
|
|
2836
|
+
if (status === "error") {
|
|
1427
2837
|
return 0;
|
|
1428
2838
|
}
|
|
1429
2839
|
return clampPercentage(parseInt(percent.toString(), 10));
|
|
1430
2840
|
}
|
|
1431
2841
|
function getProgressStatus(status, percent) {
|
|
1432
2842
|
if (!PROGRESS_STATUSES.includes(status) && percent >= 100) {
|
|
1433
|
-
return
|
|
2843
|
+
return "normal";
|
|
1434
2844
|
}
|
|
1435
|
-
return status ||
|
|
2845
|
+
return status || "normal";
|
|
1436
2846
|
}
|
|
1437
|
-
var styles$
|
|
2847
|
+
var styles$e = {
|
|
1438
2848
|
"progress-circle": "lc-ProgressCircle-module__progress-circle___NRHCi",
|
|
1439
2849
|
"progress-circle--small": "lc-ProgressCircle-module__progress-circle--small___8FVwG",
|
|
1440
2850
|
"progress-circle--medium": "lc-ProgressCircle-module__progress-circle--medium___XlzEX",
|
|
@@ -1451,37 +2861,35 @@ var styles$8 = {
|
|
|
1451
2861
|
"progress-circle--normal": "lc-ProgressCircle-module__progress-circle--normal___dFneQ"
|
|
1452
2862
|
};
|
|
1453
2863
|
const THICKNESS_FROM_SIZE = {
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
2864
|
+
small: 2,
|
|
2865
|
+
medium: 3,
|
|
2866
|
+
large: 4
|
|
1457
2867
|
};
|
|
1458
2868
|
const SIZE_VALUE_FROM_SIZE = {
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
2869
|
+
small: 15,
|
|
2870
|
+
medium: 36,
|
|
2871
|
+
large: 56
|
|
1462
2872
|
};
|
|
1463
|
-
const baseClass$
|
|
1464
|
-
const ProgressCircle = React.forwardRef((
|
|
1465
|
-
var
|
|
1466
|
-
status =
|
|
1467
|
-
|
|
2873
|
+
const baseClass$k = "progress-circle";
|
|
2874
|
+
const ProgressCircle = React.forwardRef((_K, ref) => {
|
|
2875
|
+
var _L = _K, {
|
|
2876
|
+
status = "normal",
|
|
2877
|
+
progressValue,
|
|
1468
2878
|
className,
|
|
1469
|
-
size =
|
|
1470
|
-
} =
|
|
2879
|
+
size = "medium"
|
|
2880
|
+
} = _L, restProps = __objRest(_L, [
|
|
1471
2881
|
"status",
|
|
1472
|
-
"
|
|
2882
|
+
"progressValue",
|
|
1473
2883
|
"className",
|
|
1474
2884
|
"size"
|
|
1475
2885
|
]);
|
|
1476
|
-
const progressStatus = getProgressStatus(status,
|
|
1477
|
-
const percentNumber = getPercentNumber(progressStatus,
|
|
2886
|
+
const progressStatus = getProgressStatus(status, progressValue);
|
|
2887
|
+
const percentNumber = getPercentNumber(progressStatus, progressValue);
|
|
1478
2888
|
const thickness = THICKNESS_FROM_SIZE[size];
|
|
1479
2889
|
const sizeValue = SIZE_VALUE_FROM_SIZE[size];
|
|
1480
|
-
const mergedClassNames = cx(styles$
|
|
1481
|
-
[styles$
|
|
1482
|
-
[styles$
|
|
1483
|
-
[styles$8[`${baseClass$a}--success`]]: progressStatus === ProgressStatus.Success,
|
|
1484
|
-
[styles$8[`${baseClass$a}--normal`]]: progressStatus === ProgressStatus.Normal
|
|
2890
|
+
const mergedClassNames = cx(styles$e[baseClass$k], {
|
|
2891
|
+
[styles$e[`${baseClass$k}--${size}`]]: size,
|
|
2892
|
+
[styles$e[`${baseClass$k}--${status}`]]: status
|
|
1485
2893
|
}, className);
|
|
1486
2894
|
const circumference = 2 * Math.PI * ((sizeValue - thickness) / 2);
|
|
1487
2895
|
const indicatorStyle = {
|
|
@@ -1496,14 +2904,14 @@ const ProgressCircle = React.forwardRef((_M, ref) => {
|
|
|
1496
2904
|
}, restProps), /* @__PURE__ */ React.createElement("svg", {
|
|
1497
2905
|
viewBox: svgViewBox
|
|
1498
2906
|
}, /* @__PURE__ */ React.createElement("circle", {
|
|
1499
|
-
className: styles$
|
|
2907
|
+
className: styles$e[`${baseClass$k}__bg-line--${status}`],
|
|
1500
2908
|
cx: sizeValue,
|
|
1501
2909
|
cy: sizeValue,
|
|
1502
2910
|
r: (sizeValue - thickness) / 2,
|
|
1503
2911
|
fill: "none",
|
|
1504
2912
|
strokeWidth: thickness
|
|
1505
2913
|
}), /* @__PURE__ */ React.createElement("circle", {
|
|
1506
|
-
className: styles$
|
|
2914
|
+
className: styles$e[`${baseClass$k}__indicator--${status}`],
|
|
1507
2915
|
style: indicatorStyle,
|
|
1508
2916
|
cx: sizeValue,
|
|
1509
2917
|
cy: sizeValue,
|
|
@@ -1512,7 +2920,46 @@ const ProgressCircle = React.forwardRef((_M, ref) => {
|
|
|
1512
2920
|
strokeWidth: thickness
|
|
1513
2921
|
})));
|
|
1514
2922
|
});
|
|
1515
|
-
var styles$
|
|
2923
|
+
var styles$d = {
|
|
2924
|
+
"progress-bar": "lc-ProgressBar-module__progress-bar___3pa3d",
|
|
2925
|
+
"progress-bar--small": "lc-ProgressBar-module__progress-bar--small___7nQKx",
|
|
2926
|
+
"progress-bar--medium": "lc-ProgressBar-module__progress-bar--medium___cM44p",
|
|
2927
|
+
"progress-bar--large": "lc-ProgressBar-module__progress-bar--large___UlzNR",
|
|
2928
|
+
"progress-bar--error": "lc-ProgressBar-module__progress-bar--error___MulqI",
|
|
2929
|
+
"progress-bar--success": "lc-ProgressBar-module__progress-bar--success___p7nB-",
|
|
2930
|
+
"progress-bar--normal": "lc-ProgressBar-module__progress-bar--normal___ZwCb-",
|
|
2931
|
+
"progress-bar__indicator--success": "lc-ProgressBar-module__progress-bar__indicator--success___wRjR3",
|
|
2932
|
+
"progress-bar__indicator--normal": "lc-ProgressBar-module__progress-bar__indicator--normal___0Uhle"
|
|
2933
|
+
};
|
|
2934
|
+
const baseClass$j = "progress-bar";
|
|
2935
|
+
const ProgressBar = React.forwardRef((_M, ref) => {
|
|
2936
|
+
var _N = _M, {
|
|
2937
|
+
status = "normal",
|
|
2938
|
+
percent,
|
|
2939
|
+
size = "medium",
|
|
2940
|
+
className = ""
|
|
2941
|
+
} = _N, restProps = __objRest(_N, [
|
|
2942
|
+
"status",
|
|
2943
|
+
"percent",
|
|
2944
|
+
"size",
|
|
2945
|
+
"className"
|
|
2946
|
+
]);
|
|
2947
|
+
const progressStatus = getProgressStatus(status, percent);
|
|
2948
|
+
const percentNumber = getPercentNumber(progressStatus, percent);
|
|
2949
|
+
const mergedClassNames = cx(styles$d[baseClass$j], {
|
|
2950
|
+
[styles$d[`${baseClass$j}--${size}`]]: size,
|
|
2951
|
+
[styles$d[`${baseClass$j}--${status}`]]: status
|
|
2952
|
+
}, className);
|
|
2953
|
+
return /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({}, restProps), {
|
|
2954
|
+
className: mergedClassNames,
|
|
2955
|
+
ref,
|
|
2956
|
+
role: "progressbar"
|
|
2957
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
2958
|
+
className: styles$d[`${baseClass$j}__indicator--${status}`],
|
|
2959
|
+
style: { width: `${percentNumber}%` }
|
|
2960
|
+
}));
|
|
2961
|
+
});
|
|
2962
|
+
var styles$c = {
|
|
1516
2963
|
"promo-banner": "lc-PromoBanner-module__promo-banner___-mGpq",
|
|
1517
2964
|
"promo-banner__content": "lc-PromoBanner-module__promo-banner__content___kRWar",
|
|
1518
2965
|
"promo-banner__wrapper": "lc-PromoBanner-module__promo-banner__wrapper___I-8cl",
|
|
@@ -1520,13 +2967,15 @@ var styles$7 = {
|
|
|
1520
2967
|
"promo-banner__img": "lc-PromoBanner-module__promo-banner__img___eaShb",
|
|
1521
2968
|
"promo-banner__button-text": "lc-PromoBanner-module__promo-banner__button-text___taYKa",
|
|
1522
2969
|
"promo-banner--light": "lc-PromoBanner-module__promo-banner--light___eJxOR",
|
|
1523
|
-
"promo-banner--small": "lc-PromoBanner-module__promo-banner--small___7sWLV",
|
|
1524
2970
|
"promo-banner__footer": "lc-PromoBanner-module__promo-banner__footer___8OjvH",
|
|
1525
|
-
"promo-banner--
|
|
2971
|
+
"promo-banner--small": "lc-PromoBanner-module__promo-banner--small___7sWLV",
|
|
1526
2972
|
"promo-banner--large": "lc-PromoBanner-module__promo-banner--large___pMiCU",
|
|
1527
2973
|
"promo-banner__close-icon": "lc-PromoBanner-module__promo-banner__close-icon___GowBL"
|
|
1528
2974
|
};
|
|
1529
|
-
const
|
|
2975
|
+
const SMALL_CONTAINER_WIDTH_TRESHOLD = 400;
|
|
2976
|
+
const LARGE_CONTAINER_WIDTH_TRESHOLD = 800;
|
|
2977
|
+
const RESIZE_DEBOUNCE_TRESHOLD = 500;
|
|
2978
|
+
const baseClass$i = "promo-banner";
|
|
1530
2979
|
const PromoBanner = ({
|
|
1531
2980
|
className,
|
|
1532
2981
|
buttonText,
|
|
@@ -1535,50 +2984,69 @@ const PromoBanner = ({
|
|
|
1535
2984
|
img,
|
|
1536
2985
|
light = false,
|
|
1537
2986
|
linkText,
|
|
1538
|
-
size = "small",
|
|
1539
2987
|
onButtonClick,
|
|
1540
2988
|
onClose,
|
|
1541
2989
|
onLinkClick
|
|
1542
2990
|
}) => {
|
|
1543
|
-
const
|
|
1544
|
-
|
|
1545
|
-
|
|
2991
|
+
const containerRef = React.useRef(null);
|
|
2992
|
+
const [containerSize, setContainerSize] = React.useState("medium");
|
|
2993
|
+
const mergedClassNames = cx(styles$c[baseClass$i], {
|
|
2994
|
+
[styles$c[`${baseClass$i}--light`]]: light,
|
|
2995
|
+
[styles$c[`${baseClass$i}--small`]]: containerSize === "small",
|
|
2996
|
+
[styles$c[`${baseClass$i}--large`]]: containerSize === "large"
|
|
1546
2997
|
}, className);
|
|
1547
|
-
|
|
1548
|
-
|
|
2998
|
+
React.useEffect(() => {
|
|
2999
|
+
const handleResize = () => {
|
|
3000
|
+
if (containerRef.current && containerRef.current.offsetWidth <= SMALL_CONTAINER_WIDTH_TRESHOLD) {
|
|
3001
|
+
return setContainerSize("small");
|
|
3002
|
+
}
|
|
3003
|
+
if (containerRef.current && containerRef.current.offsetWidth >= LARGE_CONTAINER_WIDTH_TRESHOLD) {
|
|
3004
|
+
return setContainerSize("large");
|
|
3005
|
+
}
|
|
3006
|
+
return setContainerSize("medium");
|
|
3007
|
+
};
|
|
3008
|
+
const debouncedHandleResize = debounce(handleResize, RESIZE_DEBOUNCE_TRESHOLD);
|
|
3009
|
+
window.addEventListener("resize", debouncedHandleResize);
|
|
3010
|
+
handleResize();
|
|
3011
|
+
return () => {
|
|
3012
|
+
debouncedHandleResize.cancel();
|
|
3013
|
+
window.removeEventListener("resize", handleResize);
|
|
3014
|
+
};
|
|
3015
|
+
}, []);
|
|
1549
3016
|
const footer = /* @__PURE__ */ React.createElement("div", {
|
|
1550
|
-
className: styles$
|
|
3017
|
+
className: styles$c[`${baseClass$i}__footer`]
|
|
1551
3018
|
}, buttonText && /* @__PURE__ */ React.createElement(Button, {
|
|
1552
3019
|
kind: "primary",
|
|
1553
3020
|
size: "compact",
|
|
1554
3021
|
onClick: onButtonClick,
|
|
1555
|
-
className: styles$
|
|
3022
|
+
className: styles$c[`${baseClass$i}__button-text`]
|
|
1556
3023
|
}, buttonText), linkText && /* @__PURE__ */ React.createElement(Button, {
|
|
1557
3024
|
size: "compact",
|
|
1558
3025
|
kind: "text",
|
|
1559
3026
|
onClick: onLinkClick
|
|
1560
3027
|
}, linkText));
|
|
1561
3028
|
return /* @__PURE__ */ React.createElement("div", {
|
|
3029
|
+
ref: containerRef,
|
|
1562
3030
|
className: mergedClassNames
|
|
1563
3031
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
1564
|
-
className: styles$
|
|
3032
|
+
className: styles$c[`${baseClass$i}__content`]
|
|
1565
3033
|
}, img && /* @__PURE__ */ React.createElement("img", {
|
|
1566
3034
|
src: img,
|
|
1567
|
-
className: styles$
|
|
3035
|
+
className: styles$c[`${baseClass$i}__img`]
|
|
1568
3036
|
}), /* @__PURE__ */ React.createElement("div", {
|
|
1569
|
-
className: styles$
|
|
3037
|
+
className: styles$c[`${baseClass$i}__wrapper`]
|
|
1570
3038
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
1571
|
-
className: styles$
|
|
1572
|
-
}, header), /* @__PURE__ */ React.createElement("div", null, children),
|
|
3039
|
+
className: styles$c[`${baseClass$i}__header`]
|
|
3040
|
+
}, header), /* @__PURE__ */ React.createElement("div", null, children), containerSize !== "large" && footer), containerSize === "large" && footer), onClose && /* @__PURE__ */ React.createElement("button", {
|
|
1573
3041
|
type: "button",
|
|
1574
|
-
className: styles$
|
|
3042
|
+
className: styles$c[`${baseClass$i}__close-icon`],
|
|
1575
3043
|
onClick: onClose
|
|
1576
3044
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
1577
3045
|
source: Close,
|
|
1578
|
-
size:
|
|
3046
|
+
size: "large"
|
|
1579
3047
|
})));
|
|
1580
3048
|
};
|
|
1581
|
-
var styles$
|
|
3049
|
+
var styles$b = {
|
|
1582
3050
|
"radio-button": "lc-RadioButton-module__radio-button___WaToM",
|
|
1583
3051
|
"radio-button__label": "lc-RadioButton-module__radio-button__label___i7ygg",
|
|
1584
3052
|
"radio-button__circle": "lc-RadioButton-module__radio-button__circle___wimWA",
|
|
@@ -1589,79 +3057,186 @@ var styles$6 = {
|
|
|
1589
3057
|
"radio-button--selected": "lc-RadioButton-module__radio-button--selected___s9lqj",
|
|
1590
3058
|
"radio-button--disabled": "lc-RadioButton-module__radio-button--disabled___wHSA7"
|
|
1591
3059
|
};
|
|
1592
|
-
const baseClass$
|
|
1593
|
-
const RadioButton = (_O) => {
|
|
1594
|
-
var _P = _O, {
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
checked,
|
|
1599
|
-
disabled
|
|
1600
|
-
} = _P, props = __objRest(_P, [
|
|
1601
|
-
"children",
|
|
1602
|
-
"className",
|
|
1603
|
-
"description",
|
|
1604
|
-
"checked",
|
|
1605
|
-
"disabled"
|
|
1606
|
-
]);
|
|
1607
|
-
const mergedClassNames = cx(styles$6[baseClass$8], className, {
|
|
1608
|
-
[styles$6[`${baseClass$8}--selected`]]: checked,
|
|
1609
|
-
[styles$6[`${baseClass$8}--disabled`]]: disabled
|
|
3060
|
+
const baseClass$h = "radio-button";
|
|
3061
|
+
const RadioButton = React.forwardRef((_O, ref) => {
|
|
3062
|
+
var _P = _O, { children, className = "", description, checked, disabled } = _P, props = __objRest(_P, ["children", "className", "description", "checked", "disabled"]);
|
|
3063
|
+
const mergedClassNames = cx(styles$b[baseClass$h], className, {
|
|
3064
|
+
[styles$b[`${baseClass$h}--selected`]]: checked,
|
|
3065
|
+
[styles$b[`${baseClass$h}--disabled`]]: disabled
|
|
1610
3066
|
});
|
|
1611
3067
|
return /* @__PURE__ */ React.createElement("div", {
|
|
1612
3068
|
className: mergedClassNames
|
|
1613
3069
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
1614
|
-
className: styles$
|
|
3070
|
+
className: styles$b[`${baseClass$h}__label`]
|
|
1615
3071
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
1616
|
-
className: styles$
|
|
3072
|
+
className: styles$b[`${baseClass$h}__circle`]
|
|
1617
3073
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
1618
|
-
className: styles$
|
|
1619
|
-
}), /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({
|
|
1620
|
-
className: styles$
|
|
1621
|
-
|
|
3074
|
+
className: styles$b[`${baseClass$h}__inner-circle`]
|
|
3075
|
+
}), /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({}, props), {
|
|
3076
|
+
className: styles$b[`${baseClass$h}__input`],
|
|
3077
|
+
ref,
|
|
1622
3078
|
type: "radio",
|
|
1623
3079
|
checked,
|
|
1624
3080
|
disabled
|
|
1625
|
-
}))), /* @__PURE__ */ React.createElement(Text, {
|
|
3081
|
+
}))), children && /* @__PURE__ */ React.createElement(Text, {
|
|
1626
3082
|
as: "div",
|
|
1627
3083
|
size: "md",
|
|
1628
|
-
className: styles$
|
|
3084
|
+
className: styles$b[`${baseClass$h}__text`]
|
|
1629
3085
|
}, children)), description && /* @__PURE__ */ React.createElement(FieldDescription, {
|
|
1630
|
-
className: styles$
|
|
3086
|
+
className: styles$b[`${baseClass$h}__helper`]
|
|
1631
3087
|
}, description));
|
|
3088
|
+
});
|
|
3089
|
+
var styles$a = {
|
|
3090
|
+
"search-input": "lc-Search-module__search-input___FsbCk",
|
|
3091
|
+
"search-input--compact": "lc-Search-module__search-input--compact___498To",
|
|
3092
|
+
"search-input--medium": "lc-Search-module__search-input--medium___Hwteg",
|
|
3093
|
+
"search-input--large": "lc-Search-module__search-input--large___-IBuC",
|
|
3094
|
+
"search-input--focused": "lc-Search-module__search-input--focused___i2eul",
|
|
3095
|
+
"search-input--disabled": "lc-Search-module__search-input--disabled___LSJ2e",
|
|
3096
|
+
"search-input--collapsable": "lc-Search-module__search-input--collapsable___5GaIH",
|
|
3097
|
+
"search-input__search-icon": "lc-Search-module__search-input__search-icon___BBQoD",
|
|
3098
|
+
"search-input--collapsable--open": "lc-Search-module__search-input--collapsable--open___vqTpD",
|
|
3099
|
+
"search-input__clear-icon": "lc-Search-module__search-input__clear-icon___LoNkc",
|
|
3100
|
+
"search-input__loader": "lc-Search-module__search-input__loader___pkpIG",
|
|
3101
|
+
"search-input__input": "lc-Search-module__search-input__input___OhyTr"
|
|
3102
|
+
};
|
|
3103
|
+
const baseClass$g = "search-input";
|
|
3104
|
+
const inputBaseClass = `${baseClass$g}__input`;
|
|
3105
|
+
const SearchInput = ({
|
|
3106
|
+
isCollapsable,
|
|
3107
|
+
isDisabled,
|
|
3108
|
+
isLoading,
|
|
3109
|
+
placeholder = "Search ...",
|
|
3110
|
+
size = "medium",
|
|
3111
|
+
value,
|
|
3112
|
+
className,
|
|
3113
|
+
onChange
|
|
3114
|
+
}) => {
|
|
3115
|
+
const [isCollapsed, setIsCollapsed] = React.useState(true);
|
|
3116
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
3117
|
+
const inputRef = React.useRef(null);
|
|
3118
|
+
const isCloseIconVisible = !!value && !isDisabled && !isLoading;
|
|
3119
|
+
const ariaExpandedValue = isCollapsable && !isCollapsed && "true";
|
|
3120
|
+
const mergedClassNames = cx(className, styles$a[baseClass$g], styles$a[`${baseClass$g}--${size}`], isFocused && styles$a[`${baseClass$g}--focused`], isDisabled && styles$a[`${baseClass$g}--disabled`], isCollapsable && styles$a[`${baseClass$g}--collapsable`], !isCollapsed && styles$a[`${baseClass$g}--collapsable--open`]);
|
|
3121
|
+
React.useEffect(() => {
|
|
3122
|
+
if (isCollapsable && !!value) {
|
|
3123
|
+
setIsCollapsed(false);
|
|
3124
|
+
}
|
|
3125
|
+
}, [isCollapsable]);
|
|
3126
|
+
const handleOnChange = (e) => {
|
|
3127
|
+
const value2 = e.currentTarget.value;
|
|
3128
|
+
onChange(value2);
|
|
3129
|
+
};
|
|
3130
|
+
const handleClear = () => {
|
|
3131
|
+
onChange("");
|
|
3132
|
+
};
|
|
3133
|
+
const handleClick = () => {
|
|
3134
|
+
var _a;
|
|
3135
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
3136
|
+
};
|
|
3137
|
+
const handleFocus = () => {
|
|
3138
|
+
if (isCollapsable) {
|
|
3139
|
+
setIsCollapsed(false);
|
|
3140
|
+
}
|
|
3141
|
+
setIsFocused(true);
|
|
3142
|
+
};
|
|
3143
|
+
const handleBlur = () => {
|
|
3144
|
+
if (isCollapsable && !value) {
|
|
3145
|
+
setIsCollapsed(true);
|
|
3146
|
+
}
|
|
3147
|
+
setIsFocused(false);
|
|
3148
|
+
};
|
|
3149
|
+
const handleKeyDown = (e) => {
|
|
3150
|
+
if (e.key === KeyCodes.enter) {
|
|
3151
|
+
e.preventDefault();
|
|
3152
|
+
onChange(value);
|
|
3153
|
+
}
|
|
3154
|
+
};
|
|
3155
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3156
|
+
"aria-expanded": ariaExpandedValue,
|
|
3157
|
+
role: "search",
|
|
3158
|
+
className: mergedClassNames,
|
|
3159
|
+
onClick: handleClick
|
|
3160
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
3161
|
+
className: styles$a[`${baseClass$g}__search-icon`],
|
|
3162
|
+
source: Search,
|
|
3163
|
+
disabled: isDisabled,
|
|
3164
|
+
kind: "primary"
|
|
3165
|
+
}), /* @__PURE__ */ React.createElement("input", {
|
|
3166
|
+
role: "searchbox",
|
|
3167
|
+
ref: inputRef,
|
|
3168
|
+
className: styles$a[inputBaseClass],
|
|
3169
|
+
type: "text",
|
|
3170
|
+
value,
|
|
3171
|
+
placeholder,
|
|
3172
|
+
onChange: handleOnChange,
|
|
3173
|
+
onBlur: handleBlur,
|
|
3174
|
+
onFocus: handleFocus,
|
|
3175
|
+
onKeyDown: handleKeyDown,
|
|
3176
|
+
disabled: isDisabled
|
|
3177
|
+
}), isCloseIconVisible && /* @__PURE__ */ React.createElement("button", {
|
|
3178
|
+
"aria-label": "Clear search",
|
|
3179
|
+
title: "Clear search",
|
|
3180
|
+
className: styles$a[`${baseClass$g}__clear-icon`],
|
|
3181
|
+
onClick: handleClear
|
|
3182
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
3183
|
+
source: Close,
|
|
3184
|
+
kind: "primary"
|
|
3185
|
+
})), isLoading && /* @__PURE__ */ React.createElement("div", {
|
|
3186
|
+
"data-testid": `${baseClass$g}-loader`,
|
|
3187
|
+
className: styles$a[`${baseClass$g}__loader`]
|
|
3188
|
+
}, /* @__PURE__ */ React.createElement(Loader, {
|
|
3189
|
+
size: "small"
|
|
3190
|
+
})));
|
|
1632
3191
|
};
|
|
1633
3192
|
const switch__input = "lc-Switch-module__switch__input___NiiOR";
|
|
1634
3193
|
const switch__container = "lc-Switch-module__switch__container___79F7W";
|
|
1635
3194
|
const switch__track = "lc-Switch-module__switch__track___2wr2M";
|
|
1636
3195
|
const switch__slider = "lc-Switch-module__switch__slider___WHd--";
|
|
1637
|
-
|
|
3196
|
+
const switch__loader = "lc-Switch-module__switch__loader___FE-fA";
|
|
3197
|
+
const switch__icon = "lc-Switch-module__switch__icon___-O1qY";
|
|
3198
|
+
var styles$9 = {
|
|
1638
3199
|
"switch": "lc-Switch-module__switch___AaA2k",
|
|
1639
3200
|
"switch__track--enabled": "lc-Switch-module__switch__track--enabled___sy4Xl",
|
|
1640
|
-
"switch__track--
|
|
1641
|
-
"
|
|
3201
|
+
"switch__track--on": "lc-Switch-module__switch__track--on___aOMWe",
|
|
3202
|
+
"switch__track--off": "lc-Switch-module__switch__track--off___NAisj",
|
|
3203
|
+
"switch--large": "lc-Switch-module__switch--large___pSoJ7",
|
|
1642
3204
|
"switch--compact": "lc-Switch-module__switch--compact___OGFIX",
|
|
3205
|
+
"switch--medium": "lc-Switch-module__switch--medium___EcZwT",
|
|
1643
3206
|
switch__input,
|
|
3207
|
+
"switch__input--disabled": "lc-Switch-module__switch__input--disabled___Po8gh",
|
|
1644
3208
|
switch__container,
|
|
1645
3209
|
switch__track,
|
|
3210
|
+
"switch__track--disabled": "lc-Switch-module__switch__track--disabled___HkDhl",
|
|
1646
3211
|
switch__slider,
|
|
1647
|
-
"switch__slider--
|
|
1648
|
-
"switch__slider--
|
|
1649
|
-
"switch__slider--
|
|
3212
|
+
"switch__slider--large": "lc-Switch-module__switch__slider--large___WoEgi",
|
|
3213
|
+
"switch__slider--large--on": "lc-Switch-module__switch__slider--large--on___7Qp3G",
|
|
3214
|
+
"switch__slider--large--off": "lc-Switch-module__switch__slider--large--off___iRMmD",
|
|
1650
3215
|
"switch__slider--compact": "lc-Switch-module__switch__slider--compact___uZ-lS",
|
|
1651
|
-
"switch__slider--compact--
|
|
1652
|
-
"switch__slider--compact--
|
|
3216
|
+
"switch__slider--compact--on": "lc-Switch-module__switch__slider--compact--on___FykE3",
|
|
3217
|
+
"switch__slider--compact--off": "lc-Switch-module__switch__slider--compact--off___s5yR8",
|
|
3218
|
+
"switch__slider--medium": "lc-Switch-module__switch__slider--medium___uhptz",
|
|
3219
|
+
"switch__slider--medium--on": "lc-Switch-module__switch__slider--medium--on___SfeAV",
|
|
3220
|
+
"switch__slider--medium--off": "lc-Switch-module__switch__slider--medium--off___eXJJz",
|
|
3221
|
+
switch__loader,
|
|
3222
|
+
"switch__loader--compact": "lc-Switch-module__switch__loader--compact___3imUh",
|
|
3223
|
+
"switch__loader--medium": "lc-Switch-module__switch__loader--medium___2zi05",
|
|
3224
|
+
"switch__loader--large": "lc-Switch-module__switch__loader--large___vLRFa",
|
|
3225
|
+
switch__icon
|
|
1653
3226
|
};
|
|
1654
|
-
const baseClass$
|
|
3227
|
+
const baseClass$f = "switch";
|
|
1655
3228
|
const Switch = (_Q) => {
|
|
1656
3229
|
var _R = _Q, {
|
|
1657
3230
|
className = "",
|
|
1658
3231
|
defaultOn = false,
|
|
1659
3232
|
disabled = false,
|
|
1660
|
-
name = baseClass$
|
|
3233
|
+
name = baseClass$f,
|
|
1661
3234
|
on,
|
|
1662
3235
|
onChange = noop,
|
|
1663
|
-
size = "
|
|
1664
|
-
|
|
3236
|
+
size = "large",
|
|
3237
|
+
state = "regular",
|
|
3238
|
+
innerRef,
|
|
3239
|
+
ariaLabel
|
|
1665
3240
|
} = _R, props = __objRest(_R, [
|
|
1666
3241
|
"className",
|
|
1667
3242
|
"defaultOn",
|
|
@@ -1670,211 +3245,130 @@ const Switch = (_Q) => {
|
|
|
1670
3245
|
"on",
|
|
1671
3246
|
"onChange",
|
|
1672
3247
|
"size",
|
|
1673
|
-
"
|
|
3248
|
+
"state",
|
|
3249
|
+
"innerRef",
|
|
3250
|
+
"ariaLabel"
|
|
1674
3251
|
]);
|
|
1675
|
-
const
|
|
1676
|
-
return on !== void 0 ? on : defaultOn;
|
|
1677
|
-
};
|
|
1678
|
-
const [enabled, setEnabled] = React.useState(getEnabledValue());
|
|
3252
|
+
const [checked, setChecked] = React.useState(() => on !== void 0 ? on : defaultOn);
|
|
1679
3253
|
React.useEffect(() => {
|
|
1680
3254
|
if (on !== void 0) {
|
|
1681
|
-
|
|
3255
|
+
setChecked(on);
|
|
1682
3256
|
}
|
|
1683
3257
|
}, [on]);
|
|
1684
|
-
const
|
|
1685
|
-
const
|
|
3258
|
+
const isLoading = state === "loading";
|
|
3259
|
+
const isLocked = state === "locked";
|
|
3260
|
+
const iconSize = size === "large" ? "small" : "xsmall";
|
|
3261
|
+
const toggleStyles = checked ? "on" : "off";
|
|
3262
|
+
const shouldBehaveAsDisabled = disabled || isLoading || isLocked;
|
|
3263
|
+
const availabilityStyles = shouldBehaveAsDisabled ? "disabled" : "enabled";
|
|
3264
|
+
const mergedClassNames = cx(styles$9[baseClass$f], styles$9[`${baseClass$f}--${size}`], className);
|
|
1686
3265
|
const handleChange = (e) => {
|
|
1687
3266
|
const hasOnChangePassed = onChange !== noop;
|
|
1688
|
-
if (hasOnChangePassed) {
|
|
1689
|
-
onChange(e,
|
|
1690
|
-
return;
|
|
1691
|
-
}
|
|
1692
|
-
e.stopPropagation();
|
|
1693
|
-
|
|
1694
|
-
};
|
|
1695
|
-
return /* @__PURE__ */ React.createElement("span", {
|
|
1696
|
-
className: mergedClassNames
|
|
1697
|
-
}, /* @__PURE__ */ React.createElement("input", __spreadValues({
|
|
1698
|
-
type: "checkbox",
|
|
1699
|
-
className: styles$
|
|
1700
|
-
onChange: handleChange,
|
|
1701
|
-
checked
|
|
1702
|
-
name,
|
|
1703
|
-
ref: innerRef,
|
|
1704
|
-
disabled,
|
|
1705
|
-
"
|
|
1706
|
-
}, props)), /* @__PURE__ */ React.createElement("span", {
|
|
1707
|
-
className: styles$
|
|
1708
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
1709
|
-
className: cx(styles$
|
|
1710
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
1711
|
-
className: cx(styles$
|
|
1712
|
-
}
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
};
|
|
1721
|
-
|
|
1722
|
-
const
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
}
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
const
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
})
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
const
|
|
1772
|
-
const
|
|
1773
|
-
var styles$
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
if (!customColor) {
|
|
1794
|
-
return "";
|
|
1795
|
-
}
|
|
1796
|
-
return getContrast(customColor, "#FFFFFF") > 4.5 ? "text-white" : "text-black";
|
|
1797
|
-
};
|
|
1798
|
-
const Tag = (_U) => {
|
|
1799
|
-
var _V = _U, {
|
|
1800
|
-
className = "",
|
|
1801
|
-
children,
|
|
1802
|
-
dismissible = false,
|
|
1803
|
-
size = "medium",
|
|
1804
|
-
kind = "default",
|
|
1805
|
-
onRemove,
|
|
1806
|
-
outline = false,
|
|
1807
|
-
icon: icon2,
|
|
1808
|
-
avatar,
|
|
1809
|
-
customColor
|
|
1810
|
-
} = _V, restProps = __objRest(_V, [
|
|
1811
|
-
"className",
|
|
1812
|
-
"children",
|
|
1813
|
-
"dismissible",
|
|
1814
|
-
"size",
|
|
1815
|
-
"kind",
|
|
1816
|
-
"onRemove",
|
|
1817
|
-
"outline",
|
|
1818
|
-
"icon",
|
|
1819
|
-
"avatar",
|
|
1820
|
-
"customColor"
|
|
1821
|
-
]);
|
|
1822
|
-
const mergedClassNames = cx(styles$2[baseClass$4], className, styles$2[`${baseClass$4}--${size}`], styles$2[`${baseClass$4}--${kind}`], {
|
|
1823
|
-
[styles$2[`${baseClass$4}--dismissible`]]: dismissible,
|
|
1824
|
-
[styles$2[`${baseClass$4}--outline`]]: outline,
|
|
1825
|
-
[styles$2[`${baseClass$4}--with-icon`]]: !!icon2 || !!avatar,
|
|
1826
|
-
[styles$2[`${baseClass$4}--${getCustomTextClass(customColor)}`]]: !!customColor
|
|
1827
|
-
});
|
|
1828
|
-
const getCustomColorStyles = () => {
|
|
1829
|
-
if (!customColor) {
|
|
1830
|
-
return {};
|
|
1831
|
-
}
|
|
1832
|
-
if (outline) {
|
|
1833
|
-
return {
|
|
1834
|
-
style: {
|
|
1835
|
-
backgroundColor: "transparent",
|
|
1836
|
-
color: customColor,
|
|
1837
|
-
borderColor: customColor
|
|
1838
|
-
}
|
|
1839
|
-
};
|
|
1840
|
-
}
|
|
1841
|
-
return { style: { backgroundColor: customColor } };
|
|
1842
|
-
};
|
|
1843
|
-
const getIconCustomColor = () => {
|
|
1844
|
-
if (!customColor) {
|
|
1845
|
-
return void 0;
|
|
1846
|
-
}
|
|
1847
|
-
if (outline) {
|
|
1848
|
-
return customColor;
|
|
1849
|
-
}
|
|
1850
|
-
return getContrast(customColor, "#FFFFFF") > 4.5 ? "#FFFFFF" : "#000000";
|
|
1851
|
-
};
|
|
1852
|
-
return /* @__PURE__ */ React.createElement(Text, __spreadProps(__spreadValues(__spreadValues({
|
|
1853
|
-
className: mergedClassNames
|
|
1854
|
-
}, restProps), getCustomColorStyles()), {
|
|
1855
|
-
as: "div",
|
|
1856
|
-
size: "md"
|
|
1857
|
-
}), avatar && /* @__PURE__ */ React.createElement("img", {
|
|
1858
|
-
className: styles$2[`${baseClass$4}__avatar`],
|
|
1859
|
-
src: avatar,
|
|
1860
|
-
alt: "tag-avatar",
|
|
1861
|
-
"data-testid": "lc-tag-avatar"
|
|
1862
|
-
}), " ", icon2 && !avatar && /* @__PURE__ */ React.createElement(Icon, {
|
|
1863
|
-
"data-testid": "lc-tag-icon",
|
|
1864
|
-
className: styles$2[`${baseClass$4}__icon`],
|
|
1865
|
-
source: icon2,
|
|
1866
|
-
size: IconSizeName.Small,
|
|
1867
|
-
customColor: getIconCustomColor()
|
|
1868
|
-
}), children, dismissible && /* @__PURE__ */ React.createElement("button", {
|
|
1869
|
-
title: "Remove",
|
|
1870
|
-
onClick: onRemove,
|
|
1871
|
-
type: "button",
|
|
1872
|
-
className: styles$2[`${baseClass$4}__remove`]
|
|
1873
|
-
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
1874
|
-
source: Close,
|
|
1875
|
-
size: IconSizeName.Medium,
|
|
1876
|
-
customColor: getIconCustomColor()
|
|
1877
|
-
})));
|
|
3267
|
+
if (hasOnChangePassed) {
|
|
3268
|
+
onChange(e, checked);
|
|
3269
|
+
return;
|
|
3270
|
+
}
|
|
3271
|
+
e.stopPropagation();
|
|
3272
|
+
setChecked((prevEnabled) => !prevEnabled);
|
|
3273
|
+
};
|
|
3274
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
3275
|
+
className: mergedClassNames
|
|
3276
|
+
}, /* @__PURE__ */ React.createElement("input", __spreadValues({
|
|
3277
|
+
type: "checkbox",
|
|
3278
|
+
className: cx(styles$9[`${baseClass$f}__input`], styles$9[`${baseClass$f}__input--${availabilityStyles}`]),
|
|
3279
|
+
onChange: handleChange,
|
|
3280
|
+
checked,
|
|
3281
|
+
name,
|
|
3282
|
+
ref: innerRef,
|
|
3283
|
+
disabled: shouldBehaveAsDisabled,
|
|
3284
|
+
"aria-label": ariaLabel
|
|
3285
|
+
}, props)), /* @__PURE__ */ React.createElement("span", {
|
|
3286
|
+
className: styles$9[`${baseClass$f}__container`]
|
|
3287
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
3288
|
+
className: cx(styles$9[`${baseClass$f}__track`], styles$9[`${baseClass$f}__track--${toggleStyles}`], styles$9[`${baseClass$f}__track--${availabilityStyles}`])
|
|
3289
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
3290
|
+
className: cx(styles$9[`${baseClass$f}__slider`], styles$9[`${baseClass$f}__slider--${size}`], styles$9[`${baseClass$f}__slider--${size}--${toggleStyles}`])
|
|
3291
|
+
}, isLoading && /* @__PURE__ */ React.createElement(Loader, {
|
|
3292
|
+
className: cx(styles$9[`${baseClass$f}__loader`], styles$9[`${baseClass$f}__loader--${size}`])
|
|
3293
|
+
}), isLocked && /* @__PURE__ */ React.createElement(Icon, {
|
|
3294
|
+
className: styles$9[`${baseClass$f}__icon`],
|
|
3295
|
+
"data-testid": "lock-icon",
|
|
3296
|
+
size: iconSize,
|
|
3297
|
+
source: LockBlack,
|
|
3298
|
+
kind: "primary"
|
|
3299
|
+
}))));
|
|
3300
|
+
};
|
|
3301
|
+
const tab = "lc-Tab-module__tab___fME7u";
|
|
3302
|
+
const tab__count = "lc-Tab-module__tab__count___gc8tA";
|
|
3303
|
+
const tab__badge = "lc-Tab-module__tab__badge___W9c-T";
|
|
3304
|
+
var styles$8 = {
|
|
3305
|
+
tab,
|
|
3306
|
+
tab__count,
|
|
3307
|
+
"tab--compact": "lc-Tab-module__tab--compact___4qead",
|
|
3308
|
+
"tab--medium": "lc-Tab-module__tab--medium___bHnGV",
|
|
3309
|
+
"tab--large": "lc-Tab-module__tab--large___JL30g",
|
|
3310
|
+
tab__badge,
|
|
3311
|
+
"tab--selected": "lc-Tab-module__tab--selected___c0EkL",
|
|
3312
|
+
"tab--disabled": "lc-Tab-module__tab--disabled___URdTh"
|
|
3313
|
+
};
|
|
3314
|
+
const baseClass$e = "tab";
|
|
3315
|
+
const Tab = (_S) => {
|
|
3316
|
+
var _T = _S, {
|
|
3317
|
+
children,
|
|
3318
|
+
className,
|
|
3319
|
+
count,
|
|
3320
|
+
isSelected,
|
|
3321
|
+
asBadge,
|
|
3322
|
+
size = "medium"
|
|
3323
|
+
} = _T, restProps = __objRest(_T, [
|
|
3324
|
+
"children",
|
|
3325
|
+
"className",
|
|
3326
|
+
"count",
|
|
3327
|
+
"isSelected",
|
|
3328
|
+
"asBadge",
|
|
3329
|
+
"size"
|
|
3330
|
+
]);
|
|
3331
|
+
const { disabled } = restProps;
|
|
3332
|
+
const shouldDisplayAsCounter = count !== void 0 && !asBadge;
|
|
3333
|
+
const shouldDisplayAsBadge = count !== void 0 && asBadge;
|
|
3334
|
+
return /* @__PURE__ */ React.createElement(Text, __spreadProps(__spreadValues({}, restProps), {
|
|
3335
|
+
as: restProps.href ? "a" : "button",
|
|
3336
|
+
size: "md",
|
|
3337
|
+
bold: isSelected,
|
|
3338
|
+
className: cx(className, styles$8[baseClass$e], styles$8[`${baseClass$e}--${size}`], isSelected && styles$8[`${baseClass$e}--selected`], disabled && styles$8[`${baseClass$e}--disabled`])
|
|
3339
|
+
}), children, shouldDisplayAsCounter && /* @__PURE__ */ React.createElement(Text, {
|
|
3340
|
+
as: "span",
|
|
3341
|
+
size: "md",
|
|
3342
|
+
className: styles$8[`${baseClass$e}__count`]
|
|
3343
|
+
}, "(", count, ")"), shouldDisplayAsBadge && /* @__PURE__ */ React.createElement(Badge, {
|
|
3344
|
+
"data-testid": "tab-badge",
|
|
3345
|
+
count,
|
|
3346
|
+
size: "compact",
|
|
3347
|
+
className: styles$8[`${baseClass$e}__badge`]
|
|
3348
|
+
}));
|
|
3349
|
+
};
|
|
3350
|
+
const tabs = "lc-TabsWrapper-module__tabs___Y2xyD";
|
|
3351
|
+
const tabs__list = "lc-TabsWrapper-module__tabs__list___i6tVO";
|
|
3352
|
+
var styles$7 = {
|
|
3353
|
+
tabs,
|
|
3354
|
+
tabs__list
|
|
3355
|
+
};
|
|
3356
|
+
const baseClass$d = "tabs";
|
|
3357
|
+
const TabsWrapper = ({
|
|
3358
|
+
className,
|
|
3359
|
+
children
|
|
3360
|
+
}) => {
|
|
3361
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3362
|
+
className: cx(styles$7[baseClass$d], className)
|
|
3363
|
+
}, children);
|
|
3364
|
+
};
|
|
3365
|
+
const TabsList = ({
|
|
3366
|
+
className,
|
|
3367
|
+
children
|
|
3368
|
+
}) => {
|
|
3369
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3370
|
+
className: cx(styles$7[`${baseClass$d}__list`], className)
|
|
3371
|
+
}, children);
|
|
1878
3372
|
};
|
|
1879
3373
|
const EditableTagContent = ({
|
|
1880
3374
|
className = "",
|
|
@@ -1933,7 +3427,7 @@ const EditableTagContent = ({
|
|
|
1933
3427
|
dangerouslySetInnerHTML: { __html: escape(value) }
|
|
1934
3428
|
});
|
|
1935
3429
|
};
|
|
1936
|
-
var styles$
|
|
3430
|
+
var styles$6 = {
|
|
1937
3431
|
"tag-input": "lc-TagInput-module__tag-input___CLVY-",
|
|
1938
3432
|
"tag-input--error": "lc-TagInput-module__tag-input--error___RP0SB",
|
|
1939
3433
|
"tag-input__input": "lc-TagInput-module__tag-input__input___dgEYB",
|
|
@@ -1941,7 +3435,7 @@ var styles$1 = {
|
|
|
1941
3435
|
"tag-input__input--large": "lc-TagInput-module__tag-input__input--large___G6iEO",
|
|
1942
3436
|
"tag-input__tag__content": "lc-TagInput-module__tag-input__tag__content___x95-M"
|
|
1943
3437
|
};
|
|
1944
|
-
const baseClass$
|
|
3438
|
+
const baseClass$c = "tag-input__tag";
|
|
1945
3439
|
const EditableTag = ({
|
|
1946
3440
|
children,
|
|
1947
3441
|
index: index2,
|
|
@@ -1965,13 +3459,13 @@ const EditableTag = ({
|
|
|
1965
3459
|
value: children,
|
|
1966
3460
|
inputRef,
|
|
1967
3461
|
innerEditableRef,
|
|
1968
|
-
className: styles$
|
|
3462
|
+
className: styles$6[`${baseClass$c}__content`],
|
|
1969
3463
|
change: (newValue) => update(index2, newValue),
|
|
1970
3464
|
remove: removeTag,
|
|
1971
3465
|
validator
|
|
1972
3466
|
}));
|
|
1973
3467
|
};
|
|
1974
|
-
const baseClass$
|
|
3468
|
+
const baseClass$b = "tag-input";
|
|
1975
3469
|
const tagSeparatorKeys = [
|
|
1976
3470
|
KeyCodes.enter,
|
|
1977
3471
|
KeyCodes.spacebar,
|
|
@@ -1981,6 +3475,7 @@ const tagSeparatorKeys = [
|
|
|
1981
3475
|
];
|
|
1982
3476
|
const tagRemoveKeys = [KeyCodes.backspace, KeyCodes.delete];
|
|
1983
3477
|
const TagInput = ({
|
|
3478
|
+
id,
|
|
1984
3479
|
tags,
|
|
1985
3480
|
onChange,
|
|
1986
3481
|
validator,
|
|
@@ -1988,10 +3483,10 @@ const TagInput = ({
|
|
|
1988
3483
|
placeholder,
|
|
1989
3484
|
size = "medium"
|
|
1990
3485
|
}) => {
|
|
1991
|
-
const mergedClassNames = cx(styles$
|
|
1992
|
-
[styles$
|
|
3486
|
+
const mergedClassNames = cx(styles$6[baseClass$b], {
|
|
3487
|
+
[styles$6[`${baseClass$b}--error`]]: error
|
|
1993
3488
|
});
|
|
1994
|
-
const inputClassNames = cx(styles$
|
|
3489
|
+
const inputClassNames = cx(styles$6[`${baseClass$b}__input`], styles$6[`${baseClass$b}__input--${size}`]);
|
|
1995
3490
|
const [inputValue, setInputValue] = React.useState("");
|
|
1996
3491
|
const inputRef = React.useRef(null);
|
|
1997
3492
|
const addTag = (value) => {
|
|
@@ -2045,6 +3540,7 @@ const TagInput = ({
|
|
|
2045
3540
|
validator,
|
|
2046
3541
|
size
|
|
2047
3542
|
}, tag2)), /* @__PURE__ */ React.createElement("input", {
|
|
3543
|
+
id,
|
|
2048
3544
|
ref: inputRef,
|
|
2049
3545
|
className: inputClassNames,
|
|
2050
3546
|
placeholder,
|
|
@@ -2060,6 +3556,7 @@ const emailValidator = (value) => {
|
|
|
2060
3556
|
return emailRegex.test(value);
|
|
2061
3557
|
};
|
|
2062
3558
|
const EmailTagInput = ({
|
|
3559
|
+
id,
|
|
2063
3560
|
tags,
|
|
2064
3561
|
onChange,
|
|
2065
3562
|
error,
|
|
@@ -2067,6 +3564,7 @@ const EmailTagInput = ({
|
|
|
2067
3564
|
size
|
|
2068
3565
|
}) => {
|
|
2069
3566
|
return /* @__PURE__ */ React.createElement(TagInput, {
|
|
3567
|
+
id,
|
|
2070
3568
|
tags,
|
|
2071
3569
|
error,
|
|
2072
3570
|
onChange,
|
|
@@ -2077,18 +3575,13 @@ const EmailTagInput = ({
|
|
|
2077
3575
|
};
|
|
2078
3576
|
const toast = "lc-Toast-module__toast___j5Amn";
|
|
2079
3577
|
const toast__content = "lc-Toast-module__toast__content___HjaNw";
|
|
2080
|
-
const toast__icon = "lc-Toast-module__toast__icon___wLbLu";
|
|
2081
|
-
const toast__close = "lc-Toast-module__toast__close___O18Lh";
|
|
2082
3578
|
const toast__actions = "lc-Toast-module__toast__actions___JWu-1";
|
|
2083
|
-
var styles = {
|
|
3579
|
+
var styles$5 = {
|
|
2084
3580
|
toast,
|
|
2085
3581
|
toast__content,
|
|
2086
|
-
toast__icon,
|
|
2087
|
-
toast__close,
|
|
2088
3582
|
toast__actions,
|
|
2089
|
-
"toast__actions
|
|
2090
|
-
"toast__actions
|
|
2091
|
-
"toast--notification": "lc-Toast-module__toast--notification___pDXnc",
|
|
3583
|
+
"toast__actions--close": "lc-Toast-module__toast__actions--close___QuXHY",
|
|
3584
|
+
"toast__actions--custom": "lc-Toast-module__toast__actions--custom___lm-pM",
|
|
2092
3585
|
"toast--success": "lc-Toast-module__toast--success___7UC6m",
|
|
2093
3586
|
"toast--warning": "lc-Toast-module__toast--warning___pteb7",
|
|
2094
3587
|
"toast--error": "lc-Toast-module__toast--error___trg--",
|
|
@@ -2110,86 +3603,73 @@ var styles = {
|
|
|
2110
3603
|
"toast-exit--fade": "lc-Toast-module__toast-exit--fade___iDA1p",
|
|
2111
3604
|
"toast-exit-active--fade": "lc-Toast-module__toast-exit-active--fade___tL7sb"
|
|
2112
3605
|
};
|
|
2113
|
-
const
|
|
2114
|
-
|
|
2115
|
-
Variants2["Success"] = "success";
|
|
2116
|
-
Variants2["Warning"] = "warning";
|
|
2117
|
-
Variants2["Error"] = "error";
|
|
2118
|
-
Variants2["Info"] = "info";
|
|
2119
|
-
Variants2["Notification"] = "notification";
|
|
2120
|
-
return Variants2;
|
|
2121
|
-
})(Variants || {});
|
|
2122
|
-
const IconConfig = {
|
|
2123
|
-
["success"]: {
|
|
3606
|
+
const iconConfig = {
|
|
3607
|
+
success: {
|
|
2124
3608
|
source: CheckCircleSolid,
|
|
2125
|
-
|
|
3609
|
+
kind: "inverted"
|
|
2126
3610
|
},
|
|
2127
|
-
|
|
3611
|
+
warning: {
|
|
2128
3612
|
source: Warning
|
|
2129
3613
|
},
|
|
2130
|
-
|
|
2131
|
-
source:
|
|
2132
|
-
|
|
2133
|
-
},
|
|
2134
|
-
["info"]: {
|
|
2135
|
-
source: Info,
|
|
2136
|
-
iconType: IconTypeName.Inverted
|
|
3614
|
+
error: {
|
|
3615
|
+
source: Block,
|
|
3616
|
+
kind: "inverted"
|
|
2137
3617
|
},
|
|
2138
|
-
|
|
2139
|
-
source: Info
|
|
2140
|
-
iconType: IconTypeName.Link
|
|
3618
|
+
info: {
|
|
3619
|
+
source: Info$1
|
|
2141
3620
|
}
|
|
2142
3621
|
};
|
|
2143
|
-
const
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
3622
|
+
const baseClass$a = "toast";
|
|
3623
|
+
const Toast = (_U) => {
|
|
3624
|
+
var _V = _U, {
|
|
3625
|
+
action,
|
|
3626
|
+
className,
|
|
3627
|
+
children,
|
|
3628
|
+
removable,
|
|
3629
|
+
kind = "info",
|
|
3630
|
+
onClose
|
|
3631
|
+
} = _V, divProps = __objRest(_V, [
|
|
3632
|
+
"action",
|
|
3633
|
+
"className",
|
|
3634
|
+
"children",
|
|
3635
|
+
"removable",
|
|
3636
|
+
"kind",
|
|
3637
|
+
"onClose"
|
|
3638
|
+
]);
|
|
3639
|
+
const mergedClassNames = cx(styles$5[baseClass$a], styles$5[`${baseClass$a}--${kind}`], className);
|
|
2152
3640
|
const onActionClick = (action2) => {
|
|
2153
|
-
if (action2 && action2.
|
|
2154
|
-
action2.
|
|
3641
|
+
if (action2 && action2.closesOnClick && onClose) {
|
|
3642
|
+
action2.onClick();
|
|
2155
3643
|
return onClose();
|
|
2156
3644
|
}
|
|
2157
|
-
return action2.
|
|
3645
|
+
return action2.onClick();
|
|
2158
3646
|
};
|
|
2159
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
3647
|
+
return /* @__PURE__ */ React.createElement("div", __spreadValues({
|
|
2160
3648
|
className: mergedClassNames
|
|
2161
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
2162
|
-
className: styles[`${baseClass$
|
|
2163
|
-
}, /* @__PURE__ */ React.createElement(Icon, __spreadValues({},
|
|
2164
|
-
|
|
3649
|
+
}, divProps), /* @__PURE__ */ React.createElement("div", {
|
|
3650
|
+
className: styles$5[`${baseClass$a}__icon`]
|
|
3651
|
+
}, /* @__PURE__ */ React.createElement(Icon, __spreadProps(__spreadValues({}, iconConfig[kind]), {
|
|
3652
|
+
size: "medium"
|
|
3653
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
3654
|
+
className: styles$5[`${baseClass$a}__content`]
|
|
2165
3655
|
}, children), (action || removable) && /* @__PURE__ */ React.createElement("div", {
|
|
2166
|
-
className: styles[`${baseClass$
|
|
2167
|
-
}, action && /* @__PURE__ */ React.createElement(
|
|
2168
|
-
className: styles[`${baseClass$
|
|
3656
|
+
className: styles$5[`${baseClass$a}__actions`]
|
|
3657
|
+
}, action && /* @__PURE__ */ React.createElement(Button, {
|
|
3658
|
+
className: styles$5[`${baseClass$a}__actions--custom`],
|
|
3659
|
+
kind: "plain",
|
|
2169
3660
|
onClick: () => onActionClick(action)
|
|
2170
3661
|
}, action.label), removable && /* @__PURE__ */ React.createElement("div", {
|
|
2171
|
-
className: styles[`${baseClass$
|
|
3662
|
+
className: styles$5[`${baseClass$a}__actions--close`],
|
|
2172
3663
|
"aria-label": "Close toast",
|
|
2173
3664
|
onClick: onClose
|
|
2174
3665
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
2175
3666
|
source: Close,
|
|
2176
|
-
size:
|
|
2177
|
-
|
|
3667
|
+
size: "medium",
|
|
3668
|
+
kind: ["warning", "info"].includes(kind) ? "primary" : "inverted"
|
|
2178
3669
|
}))));
|
|
2179
3670
|
};
|
|
2180
|
-
var HorizontalPosition = /* @__PURE__ */ ((HorizontalPosition2) => {
|
|
2181
|
-
HorizontalPosition2["Left"] = "left";
|
|
2182
|
-
HorizontalPosition2["Center"] = "center";
|
|
2183
|
-
HorizontalPosition2["Right"] = "right";
|
|
2184
|
-
return HorizontalPosition2;
|
|
2185
|
-
})(HorizontalPosition || {});
|
|
2186
|
-
var VerticalPosition = /* @__PURE__ */ ((VerticalPosition2) => {
|
|
2187
|
-
VerticalPosition2["Top"] = "top";
|
|
2188
|
-
VerticalPosition2["Bottom"] = "bottom";
|
|
2189
|
-
return VerticalPosition2;
|
|
2190
|
-
})(VerticalPosition || {});
|
|
2191
3671
|
const ANIMATION_TIME = 200;
|
|
2192
|
-
const baseClass = "toast-wrapper";
|
|
3672
|
+
const baseClass$9 = "toast-wrapper";
|
|
2193
3673
|
const ToastWrapper = ({
|
|
2194
3674
|
className,
|
|
2195
3675
|
toasts = [],
|
|
@@ -2199,30 +3679,737 @@ const ToastWrapper = ({
|
|
|
2199
3679
|
verticalPosition = "top",
|
|
2200
3680
|
horizontalPosition = "center"
|
|
2201
3681
|
}) => {
|
|
2202
|
-
const mergedClassNames = cx(styles[baseClass], {
|
|
2203
|
-
[styles[`${baseClass}--fixed`]]: fixed,
|
|
2204
|
-
[styles[`${baseClass}--block`]]: !fixed && block,
|
|
2205
|
-
[styles[`${baseClass}--horizontal-${horizontalPosition}`]]: horizontalPosition,
|
|
2206
|
-
[styles[`${baseClass}--vertical-${verticalPosition}`]]: verticalPosition
|
|
3682
|
+
const mergedClassNames = cx(styles$5[baseClass$9], {
|
|
3683
|
+
[styles$5[`${baseClass$9}--fixed`]]: fixed,
|
|
3684
|
+
[styles$5[`${baseClass$9}--block`]]: !fixed && block,
|
|
3685
|
+
[styles$5[`${baseClass$9}--horizontal-${horizontalPosition}`]]: horizontalPosition,
|
|
3686
|
+
[styles$5[`${baseClass$9}--vertical-${verticalPosition}`]]: verticalPosition
|
|
2207
3687
|
}, className);
|
|
2208
3688
|
return /* @__PURE__ */ React.createElement("div", {
|
|
2209
3689
|
className: mergedClassNames
|
|
2210
3690
|
}, /* @__PURE__ */ React.createElement(TransitionGroup, {
|
|
2211
3691
|
component: null
|
|
2212
|
-
}, toasts.map(({ id,
|
|
3692
|
+
}, toasts.map(({ id, kind, content, removable, action, onClose }) => /* @__PURE__ */ React.createElement(CSSTransition, {
|
|
2213
3693
|
key: id,
|
|
2214
3694
|
classNames: {
|
|
2215
|
-
enter: styles[`toast-appear--${animationType}`],
|
|
2216
|
-
enterActive: styles[`toast-appear-active--${animationType}`],
|
|
2217
|
-
exit: styles[`toast-exit--${animationType}`],
|
|
2218
|
-
exitActive: styles[`toast-exit-active--${animationType}`]
|
|
3695
|
+
enter: styles$5[`toast-appear--${animationType}`],
|
|
3696
|
+
enterActive: styles$5[`toast-appear-active--${animationType}`],
|
|
3697
|
+
exit: styles$5[`toast-exit--${animationType}`],
|
|
3698
|
+
exitActive: styles$5[`toast-exit-active--${animationType}`]
|
|
2219
3699
|
},
|
|
2220
3700
|
timeout: ANIMATION_TIME
|
|
2221
3701
|
}, /* @__PURE__ */ React.createElement(Toast, {
|
|
2222
|
-
|
|
3702
|
+
kind,
|
|
2223
3703
|
onClose,
|
|
2224
3704
|
removable,
|
|
2225
3705
|
action
|
|
2226
3706
|
}, content)))));
|
|
2227
3707
|
};
|
|
2228
|
-
|
|
3708
|
+
const tooltip = "lc-Tooltip-module__tooltip___QOOAr";
|
|
3709
|
+
const tooltip__arrow = "lc-Tooltip-module__tooltip__arrow___Ov1YW";
|
|
3710
|
+
var styles$4 = {
|
|
3711
|
+
tooltip,
|
|
3712
|
+
"tooltip--invert": "lc-Tooltip-module__tooltip--invert___PVjhE",
|
|
3713
|
+
"tooltip--important": "lc-Tooltip-module__tooltip--important___X-IMK",
|
|
3714
|
+
tooltip__arrow,
|
|
3715
|
+
"tooltip-header": "lc-Tooltip-module__tooltip-header___QV0Vd",
|
|
3716
|
+
"tooltip-image": "lc-Tooltip-module__tooltip-image___Aorwg",
|
|
3717
|
+
"tooltip-text": "lc-Tooltip-module__tooltip-text___FB8OV",
|
|
3718
|
+
"tooltip-close": "lc-Tooltip-module__tooltip-close___3r3h9",
|
|
3719
|
+
"tooltip-step": "lc-Tooltip-module__tooltip-step___-j0n8",
|
|
3720
|
+
"guide-tooltip--slide": "lc-Tooltip-module__guide-tooltip--slide___Uawm2",
|
|
3721
|
+
"guide-tooltip__overlay": "lc-Tooltip-module__guide-tooltip__overlay___IyrKK",
|
|
3722
|
+
"guide-tooltip__overlay--slide": "lc-Tooltip-module__guide-tooltip__overlay--slide___VW8oq",
|
|
3723
|
+
"guide-tooltip__overlay--visible": "lc-Tooltip-module__guide-tooltip__overlay--visible___dbdsZ"
|
|
3724
|
+
};
|
|
3725
|
+
const sleep = (milliseconds) => {
|
|
3726
|
+
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
3727
|
+
};
|
|
3728
|
+
const baseClass$8 = "tooltip";
|
|
3729
|
+
const Tooltip = (props) => {
|
|
3730
|
+
const {
|
|
3731
|
+
triggerRenderer,
|
|
3732
|
+
referenceElement,
|
|
3733
|
+
children,
|
|
3734
|
+
className,
|
|
3735
|
+
theme,
|
|
3736
|
+
placement,
|
|
3737
|
+
isVisible,
|
|
3738
|
+
withFadeAnimation = true,
|
|
3739
|
+
transitionDuration = 200,
|
|
3740
|
+
transitionDelay = 0,
|
|
3741
|
+
hoverOutDelayTimeout = 100,
|
|
3742
|
+
offsetMainAxis = 8,
|
|
3743
|
+
triggerOnClick = false,
|
|
3744
|
+
arrowOffsetY,
|
|
3745
|
+
arrowOffsetX,
|
|
3746
|
+
onOpen,
|
|
3747
|
+
onClose
|
|
3748
|
+
} = props;
|
|
3749
|
+
const isManaged = isVisible !== void 0;
|
|
3750
|
+
const arrowRef = React.useRef(null);
|
|
3751
|
+
const [visible, setVisibility] = React.useState(isVisible);
|
|
3752
|
+
const isHovered = React.useRef(false);
|
|
3753
|
+
const {
|
|
3754
|
+
x,
|
|
3755
|
+
y,
|
|
3756
|
+
reference,
|
|
3757
|
+
floating,
|
|
3758
|
+
strategy,
|
|
3759
|
+
update,
|
|
3760
|
+
refs,
|
|
3761
|
+
placement: updatedPlacement,
|
|
3762
|
+
middlewareData: { arrow: { x: arrowX, y: arrowY } = {} }
|
|
3763
|
+
} = useFloating({
|
|
3764
|
+
middleware: [
|
|
3765
|
+
offset({ mainAxis: offsetMainAxis }),
|
|
3766
|
+
arrow({ element: arrowRef }),
|
|
3767
|
+
flip()
|
|
3768
|
+
],
|
|
3769
|
+
placement
|
|
3770
|
+
});
|
|
3771
|
+
React.useEffect(() => {
|
|
3772
|
+
referenceElement && reference(referenceElement);
|
|
3773
|
+
}, [reference, referenceElement]);
|
|
3774
|
+
React.useEffect(() => {
|
|
3775
|
+
setVisibility(isVisible);
|
|
3776
|
+
}, [isVisible]);
|
|
3777
|
+
React.useEffect(() => {
|
|
3778
|
+
document.addEventListener("keydown", handleCloseAction);
|
|
3779
|
+
return () => {
|
|
3780
|
+
document.removeEventListener("keydown", handleCloseAction);
|
|
3781
|
+
};
|
|
3782
|
+
}, []);
|
|
3783
|
+
React.useEffect(() => {
|
|
3784
|
+
if (!refs.reference.current || !refs.floating.current) {
|
|
3785
|
+
return;
|
|
3786
|
+
}
|
|
3787
|
+
return autoUpdate(refs.reference.current, refs.floating.current, update);
|
|
3788
|
+
}, [refs.reference, refs.floating, update, updatedPlacement, visible]);
|
|
3789
|
+
const handleMouseLeave = () => {
|
|
3790
|
+
if (triggerOnClick || isManaged)
|
|
3791
|
+
return;
|
|
3792
|
+
isHovered.current = false;
|
|
3793
|
+
void sleep(hoverOutDelayTimeout).then(() => {
|
|
3794
|
+
if (!isHovered.current) {
|
|
3795
|
+
setVisibility(false);
|
|
3796
|
+
}
|
|
3797
|
+
});
|
|
3798
|
+
};
|
|
3799
|
+
const handleOpen = () => {
|
|
3800
|
+
if (onOpen)
|
|
3801
|
+
onOpen();
|
|
3802
|
+
if (!isManaged) {
|
|
3803
|
+
setVisibility(true);
|
|
3804
|
+
}
|
|
3805
|
+
};
|
|
3806
|
+
const handleClose = () => {
|
|
3807
|
+
if (onClose)
|
|
3808
|
+
onClose();
|
|
3809
|
+
if (!isManaged) {
|
|
3810
|
+
setVisibility(false);
|
|
3811
|
+
}
|
|
3812
|
+
};
|
|
3813
|
+
const handleMouseEnter = () => {
|
|
3814
|
+
if (triggerOnClick || isManaged)
|
|
3815
|
+
return;
|
|
3816
|
+
isHovered.current = true;
|
|
3817
|
+
setVisibility(true);
|
|
3818
|
+
};
|
|
3819
|
+
const handleCloseAction = (event) => {
|
|
3820
|
+
if (event instanceof KeyboardEvent && event.key === "Escape") {
|
|
3821
|
+
handleClose();
|
|
3822
|
+
}
|
|
3823
|
+
if (event.type === "click") {
|
|
3824
|
+
handleClose();
|
|
3825
|
+
}
|
|
3826
|
+
};
|
|
3827
|
+
const handleClick = () => {
|
|
3828
|
+
if (isManaged)
|
|
3829
|
+
return;
|
|
3830
|
+
if (visible) {
|
|
3831
|
+
handleClose();
|
|
3832
|
+
} else {
|
|
3833
|
+
handleOpen();
|
|
3834
|
+
}
|
|
3835
|
+
};
|
|
3836
|
+
const top = arrowOffsetY && arrowY ? arrowY + arrowOffsetY : arrowY;
|
|
3837
|
+
const left = arrowOffsetX && arrowX ? arrowX + arrowOffsetX : arrowX;
|
|
3838
|
+
const mergedClassNames = cx(styles$4[baseClass$8], className, {
|
|
3839
|
+
[styles$4[`${baseClass$8}--invert`]]: theme === "invert",
|
|
3840
|
+
[styles$4[`${baseClass$8}--important`]]: theme === "important"
|
|
3841
|
+
});
|
|
3842
|
+
const floatingComponent = /* @__PURE__ */ React.createElement("div", {
|
|
3843
|
+
ref: floating,
|
|
3844
|
+
style: {
|
|
3845
|
+
position: strategy,
|
|
3846
|
+
top: y != null ? y : "",
|
|
3847
|
+
left: x != null ? x : ""
|
|
3848
|
+
},
|
|
3849
|
+
className: mergedClassNames,
|
|
3850
|
+
onMouseEnter: handleMouseEnter,
|
|
3851
|
+
onMouseLeave: handleMouseLeave
|
|
3852
|
+
}, React.Children.map(children, (child) => {
|
|
3853
|
+
if (React.isValidElement(child)) {
|
|
3854
|
+
return React.cloneElement(child, __spreadValues({
|
|
3855
|
+
handleCloseAction,
|
|
3856
|
+
theme
|
|
3857
|
+
}, child.props));
|
|
3858
|
+
}
|
|
3859
|
+
return null;
|
|
3860
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
3861
|
+
ref: arrowRef,
|
|
3862
|
+
className: cx([styles$4[`${baseClass$8}__arrow`]]),
|
|
3863
|
+
"data-arrow-placement": updatedPlacement,
|
|
3864
|
+
style: { top, left }
|
|
3865
|
+
}));
|
|
3866
|
+
function renderFloatingComponent() {
|
|
3867
|
+
if (withFadeAnimation) {
|
|
3868
|
+
const enter = css`
|
|
3869
|
+
opacity: 0;
|
|
3870
|
+
`;
|
|
3871
|
+
const enterActive = css`
|
|
3872
|
+
opacity: 1;
|
|
3873
|
+
transition-property: opacity;
|
|
3874
|
+
transition-duration: ${transitionDuration}ms;
|
|
3875
|
+
transition-delay: ${transitionDelay}ms;
|
|
3876
|
+
`;
|
|
3877
|
+
const exit = css`
|
|
3878
|
+
opacity: 1;
|
|
3879
|
+
`;
|
|
3880
|
+
const exitActive = css`
|
|
3881
|
+
opacity: 0;
|
|
3882
|
+
transition-property: opacity;
|
|
3883
|
+
transition-duration: ${transitionDuration}ms;
|
|
3884
|
+
transition-delay: ${transitionDelay}ms;
|
|
3885
|
+
`;
|
|
3886
|
+
const timeout = transitionDuration + transitionDelay;
|
|
3887
|
+
return /* @__PURE__ */ React.createElement(CSSTransition, {
|
|
3888
|
+
in: visible,
|
|
3889
|
+
mountOnEnter: true,
|
|
3890
|
+
unmountOnExit: true,
|
|
3891
|
+
timeout,
|
|
3892
|
+
classNames: {
|
|
3893
|
+
enter,
|
|
3894
|
+
enterActive,
|
|
3895
|
+
exit,
|
|
3896
|
+
exitActive
|
|
3897
|
+
}
|
|
3898
|
+
}, floatingComponent);
|
|
3899
|
+
} else {
|
|
3900
|
+
return visible && floatingComponent;
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
if (referenceElement) {
|
|
3904
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, renderFloatingComponent());
|
|
3905
|
+
}
|
|
3906
|
+
const referenceOptions = () => {
|
|
3907
|
+
if (!isManaged) {
|
|
3908
|
+
if (triggerOnClick) {
|
|
3909
|
+
return {
|
|
3910
|
+
onClick: handleClick
|
|
3911
|
+
};
|
|
3912
|
+
} else {
|
|
3913
|
+
return {
|
|
3914
|
+
onMouseEnter: handleMouseEnter,
|
|
3915
|
+
onMouseLeave: handleMouseLeave
|
|
3916
|
+
};
|
|
3917
|
+
}
|
|
3918
|
+
}
|
|
3919
|
+
};
|
|
3920
|
+
const triggerElement = /* @__PURE__ */ React.createElement("div", __spreadValues({
|
|
3921
|
+
ref: reference
|
|
3922
|
+
}, referenceOptions()), triggerRenderer());
|
|
3923
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, triggerElement, renderFloatingComponent());
|
|
3924
|
+
};
|
|
3925
|
+
const Simple = ({ text }) => {
|
|
3926
|
+
return /* @__PURE__ */ React.createElement("div", null, text);
|
|
3927
|
+
};
|
|
3928
|
+
function getIconType(theme) {
|
|
3929
|
+
switch (theme) {
|
|
3930
|
+
case "invert":
|
|
3931
|
+
return "inverted";
|
|
3932
|
+
case "important":
|
|
3933
|
+
return "subtle";
|
|
3934
|
+
default:
|
|
3935
|
+
return "primary";
|
|
3936
|
+
}
|
|
3937
|
+
}
|
|
3938
|
+
const baseClass$7 = "tooltip";
|
|
3939
|
+
const Info = ({ header, text, closeWithX, theme, handleCloseAction }) => {
|
|
3940
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3941
|
+
style: { position: "relative" }
|
|
3942
|
+
}, closeWithX && /* @__PURE__ */ React.createElement("div", {
|
|
3943
|
+
className: styles$4[`${baseClass$7}-close`],
|
|
3944
|
+
onClick: handleCloseAction
|
|
3945
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
3946
|
+
source: Close,
|
|
3947
|
+
kind: theme ? getIconType(theme) : "primary"
|
|
3948
|
+
})), header && /* @__PURE__ */ React.createElement("div", {
|
|
3949
|
+
className: styles$4[`${baseClass$7}-header`]
|
|
3950
|
+
}, header), /* @__PURE__ */ React.createElement("div", {
|
|
3951
|
+
className: styles$4[`${baseClass$7}-text`]
|
|
3952
|
+
}, text));
|
|
3953
|
+
};
|
|
3954
|
+
const baseClass$6 = "tooltip";
|
|
3955
|
+
const Interactive = ({
|
|
3956
|
+
header,
|
|
3957
|
+
text,
|
|
3958
|
+
image,
|
|
3959
|
+
closeWithX,
|
|
3960
|
+
theme,
|
|
3961
|
+
handleCloseAction,
|
|
3962
|
+
handleClickPrimary,
|
|
3963
|
+
handleClickSecondary
|
|
3964
|
+
}) => {
|
|
3965
|
+
const decoration = theme === "invert" ? "underline" : "none";
|
|
3966
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3967
|
+
style: { width: "270px" }
|
|
3968
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
3969
|
+
style: { position: "relative", height: "25px", marginBottom: "10px" }
|
|
3970
|
+
}, closeWithX && /* @__PURE__ */ React.createElement("div", {
|
|
3971
|
+
className: styles$4[`${baseClass$6}-close`]
|
|
3972
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
3973
|
+
onClick: handleCloseAction
|
|
3974
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
3975
|
+
source: Close,
|
|
3976
|
+
kind: theme ? getIconType(theme) : "primary"
|
|
3977
|
+
})))), image && /* @__PURE__ */ React.createElement("div", {
|
|
3978
|
+
style: { margin: "0 4px" }
|
|
3979
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
3980
|
+
className: styles$4[`${baseClass$6}-image`],
|
|
3981
|
+
src: image.src,
|
|
3982
|
+
alt: image.alt
|
|
3983
|
+
})), header && /* @__PURE__ */ React.createElement("div", {
|
|
3984
|
+
className: styles$4[`${baseClass$6}-header`]
|
|
3985
|
+
}, header), /* @__PURE__ */ React.createElement("div", {
|
|
3986
|
+
className: styles$4[`${baseClass$6}-text`]
|
|
3987
|
+
}, text), /* @__PURE__ */ React.createElement("div", {
|
|
3988
|
+
style: { margin: "4px" }
|
|
3989
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
3990
|
+
kind: "primary",
|
|
3991
|
+
onClick: handleClickPrimary
|
|
3992
|
+
}, "Primary button"), /* @__PURE__ */ React.createElement("div", {
|
|
3993
|
+
onClick: handleClickSecondary,
|
|
3994
|
+
style: {
|
|
3995
|
+
cursor: "pointer",
|
|
3996
|
+
display: "inline-block",
|
|
3997
|
+
marginLeft: "16px",
|
|
3998
|
+
textDecoration: decoration
|
|
3999
|
+
}
|
|
4000
|
+
}, "Link")));
|
|
4001
|
+
};
|
|
4002
|
+
const baseClass$5 = "guide-tooltip";
|
|
4003
|
+
const SpotlightOverlay = ({
|
|
4004
|
+
gap,
|
|
4005
|
+
isVisible,
|
|
4006
|
+
slide,
|
|
4007
|
+
disablePointerEvents
|
|
4008
|
+
}) => {
|
|
4009
|
+
if (!gap)
|
|
4010
|
+
return null;
|
|
4011
|
+
const overlayLeft = {
|
|
4012
|
+
top: `${gap.top}px`,
|
|
4013
|
+
left: "0",
|
|
4014
|
+
width: `${gap.left}px`,
|
|
4015
|
+
height: `${gap.height}px`
|
|
4016
|
+
};
|
|
4017
|
+
const overlayRight = {
|
|
4018
|
+
top: `${gap.top}px`,
|
|
4019
|
+
left: `${gap.right}px`,
|
|
4020
|
+
width: `calc(100% - ${gap.right}px)`,
|
|
4021
|
+
height: `${gap.height}px`
|
|
4022
|
+
};
|
|
4023
|
+
const overlayTop = {
|
|
4024
|
+
top: "0",
|
|
4025
|
+
left: "0",
|
|
4026
|
+
width: "100%",
|
|
4027
|
+
height: `${gap.top}px`
|
|
4028
|
+
};
|
|
4029
|
+
const overlayBottom = {
|
|
4030
|
+
top: `${gap.bottom}px`,
|
|
4031
|
+
left: "0",
|
|
4032
|
+
width: "100%",
|
|
4033
|
+
height: `calc(100% - ${gap.bottom}px)`
|
|
4034
|
+
};
|
|
4035
|
+
const spotlight = {
|
|
4036
|
+
top: `${gap.top}px`,
|
|
4037
|
+
left: `${gap.left}px`,
|
|
4038
|
+
width: `${gap.width}px`,
|
|
4039
|
+
height: `${gap.height}px`,
|
|
4040
|
+
backgroundColor: "transparent"
|
|
4041
|
+
};
|
|
4042
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
4043
|
+
className: cx({
|
|
4044
|
+
[styles$4[`${baseClass$5}__overlay`]]: true,
|
|
4045
|
+
[styles$4[`${baseClass$5}__overlay--visible`]]: isVisible,
|
|
4046
|
+
[styles$4[`${baseClass$5}__overlay--slide`]]: slide
|
|
4047
|
+
}),
|
|
4048
|
+
style: overlayLeft
|
|
4049
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
4050
|
+
className: cx({
|
|
4051
|
+
[styles$4[`${baseClass$5}__overlay`]]: true,
|
|
4052
|
+
[styles$4[`${baseClass$5}__overlay--visible`]]: isVisible,
|
|
4053
|
+
[styles$4[`${baseClass$5}__overlay--slide`]]: slide
|
|
4054
|
+
}),
|
|
4055
|
+
style: overlayTop
|
|
4056
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
4057
|
+
className: cx({
|
|
4058
|
+
[styles$4[`${baseClass$5}__overlay`]]: true,
|
|
4059
|
+
[styles$4[`${baseClass$5}__overlay--visible`]]: isVisible,
|
|
4060
|
+
[styles$4[`${baseClass$5}__overlay--slide`]]: slide
|
|
4061
|
+
}),
|
|
4062
|
+
style: overlayRight
|
|
4063
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
4064
|
+
className: cx({
|
|
4065
|
+
[styles$4[`${baseClass$5}__overlay`]]: true,
|
|
4066
|
+
[styles$4[`${baseClass$5}__overlay--visible`]]: isVisible,
|
|
4067
|
+
[styles$4[`${baseClass$5}__overlay--slide`]]: slide
|
|
4068
|
+
}),
|
|
4069
|
+
style: overlayBottom
|
|
4070
|
+
}), disablePointerEvents && /* @__PURE__ */ React.createElement("div", {
|
|
4071
|
+
className: cx({
|
|
4072
|
+
[styles$4[`${baseClass$5}__overlay`]]: true,
|
|
4073
|
+
[styles$4[`${baseClass$5}__overlay--visible`]]: isVisible,
|
|
4074
|
+
[styles$4[`${baseClass$5}__overlay--slide`]]: slide
|
|
4075
|
+
}),
|
|
4076
|
+
style: spotlight
|
|
4077
|
+
}));
|
|
4078
|
+
};
|
|
4079
|
+
class VirtualReference {
|
|
4080
|
+
constructor(element, padding) {
|
|
4081
|
+
__publicField(this, "element");
|
|
4082
|
+
__publicField(this, "padding");
|
|
4083
|
+
this.element = element;
|
|
4084
|
+
this.padding = padding;
|
|
4085
|
+
}
|
|
4086
|
+
addPadding(rect) {
|
|
4087
|
+
const x = Math.round(rect.left) - this.padding;
|
|
4088
|
+
const y = Math.round(rect.top) - this.padding;
|
|
4089
|
+
const width = Math.round(rect.width) + 2 * this.padding;
|
|
4090
|
+
const height = Math.round(rect.height) + 2 * this.padding;
|
|
4091
|
+
const top = y;
|
|
4092
|
+
const left = x;
|
|
4093
|
+
const bottom = top + height;
|
|
4094
|
+
const right = left + width;
|
|
4095
|
+
return {
|
|
4096
|
+
x,
|
|
4097
|
+
y,
|
|
4098
|
+
width,
|
|
4099
|
+
height,
|
|
4100
|
+
top,
|
|
4101
|
+
left,
|
|
4102
|
+
bottom,
|
|
4103
|
+
right
|
|
4104
|
+
};
|
|
4105
|
+
}
|
|
4106
|
+
getBoundingClientRect() {
|
|
4107
|
+
return this.addPadding(this.element.getBoundingClientRect());
|
|
4108
|
+
}
|
|
4109
|
+
get clientWidth() {
|
|
4110
|
+
return this.getBoundingClientRect().width;
|
|
4111
|
+
}
|
|
4112
|
+
get clientHeight() {
|
|
4113
|
+
return this.getBoundingClientRect().height;
|
|
4114
|
+
}
|
|
4115
|
+
}
|
|
4116
|
+
const spotlightPadding = 8;
|
|
4117
|
+
const baseClass$4 = "guide-tooltip";
|
|
4118
|
+
const virtualReference = (element, padding) => new VirtualReference(element, padding);
|
|
4119
|
+
const UserGuide = (props) => {
|
|
4120
|
+
const {
|
|
4121
|
+
className,
|
|
4122
|
+
parentElementName,
|
|
4123
|
+
isVisible = false,
|
|
4124
|
+
shouldSlide = true
|
|
4125
|
+
} = props;
|
|
4126
|
+
const [parentElement, setParentElement] = React.useState(null);
|
|
4127
|
+
const [rect, setRect] = React.useState(null);
|
|
4128
|
+
const [isSliding, setIsSliding] = React.useState(shouldSlide);
|
|
4129
|
+
const handleViewportChange = () => {
|
|
4130
|
+
if (parentElement) {
|
|
4131
|
+
setRect(virtualReference(parentElement, spotlightPadding).getBoundingClientRect());
|
|
4132
|
+
setIsSliding(false);
|
|
4133
|
+
}
|
|
4134
|
+
};
|
|
4135
|
+
React.useEffect(() => {
|
|
4136
|
+
if (parentElement !== null) {
|
|
4137
|
+
window.addEventListener("resize", handleViewportChange);
|
|
4138
|
+
window.addEventListener("scroll", handleViewportChange);
|
|
4139
|
+
return () => {
|
|
4140
|
+
window.addEventListener("resize", handleViewportChange);
|
|
4141
|
+
window.addEventListener("resize", handleViewportChange);
|
|
4142
|
+
};
|
|
4143
|
+
}
|
|
4144
|
+
}, [parentElement, parentElementName]);
|
|
4145
|
+
React.useEffect(() => {
|
|
4146
|
+
if (parentElementName) {
|
|
4147
|
+
const element = document.querySelector(parentElementName);
|
|
4148
|
+
setParentElement(element);
|
|
4149
|
+
}
|
|
4150
|
+
}, [parentElementName]);
|
|
4151
|
+
React.useEffect(() => {
|
|
4152
|
+
parentElement && setRect(virtualReference(parentElement, spotlightPadding).getBoundingClientRect());
|
|
4153
|
+
setIsSliding(true);
|
|
4154
|
+
}, [parentElement]);
|
|
4155
|
+
return parentElement && isVisible ? /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(SpotlightOverlay, {
|
|
4156
|
+
gap: rect,
|
|
4157
|
+
isVisible,
|
|
4158
|
+
slide: isSliding,
|
|
4159
|
+
disablePointerEvents: true
|
|
4160
|
+
}), /* @__PURE__ */ React.createElement(Tooltip, __spreadProps(__spreadValues({}, props), {
|
|
4161
|
+
referenceElement: {
|
|
4162
|
+
getBoundingClientRect: () => {
|
|
4163
|
+
return rect;
|
|
4164
|
+
},
|
|
4165
|
+
contextElement: parentElement
|
|
4166
|
+
},
|
|
4167
|
+
arrowOffsetY: 25,
|
|
4168
|
+
className: cx({
|
|
4169
|
+
[styles$4[baseClass$4]]: true,
|
|
4170
|
+
[styles$4[`${baseClass$4}--slide`]]: isSliding,
|
|
4171
|
+
className
|
|
4172
|
+
})
|
|
4173
|
+
}), props.children)) : null;
|
|
4174
|
+
};
|
|
4175
|
+
const textarea = "lc-Textarea-module__textarea___g6U8F";
|
|
4176
|
+
var styles$3 = {
|
|
4177
|
+
textarea,
|
|
4178
|
+
"textarea--focused": "lc-Textarea-module__textarea--focused___1vtEx",
|
|
4179
|
+
"textarea--disabled": "lc-Textarea-module__textarea--disabled___xXaGv",
|
|
4180
|
+
"textarea--error": "lc-Textarea-module__textarea--error___0EGuq"
|
|
4181
|
+
};
|
|
4182
|
+
const baseClass$3 = "textarea";
|
|
4183
|
+
const Textarea = React.forwardRef((_W, ref) => {
|
|
4184
|
+
var _X = _W, { className, error } = _X, textareaProps = __objRest(_X, ["className", "error"]);
|
|
4185
|
+
const { disabled } = textareaProps;
|
|
4186
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
4187
|
+
const mergedClassNames = cx(className, styles$3[baseClass$3], {
|
|
4188
|
+
[styles$3[`${baseClass$3}--disabled`]]: disabled,
|
|
4189
|
+
[styles$3[`${baseClass$3}--focused`]]: isFocused,
|
|
4190
|
+
[styles$3[`${baseClass$3}--error`]]: error
|
|
4191
|
+
});
|
|
4192
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4193
|
+
className: mergedClassNames
|
|
4194
|
+
}, /* @__PURE__ */ React.createElement("textarea", __spreadProps(__spreadValues({}, textareaProps), {
|
|
4195
|
+
ref,
|
|
4196
|
+
onFocus: () => setIsFocused(true),
|
|
4197
|
+
onBlur: () => setIsFocused(false)
|
|
4198
|
+
})));
|
|
4199
|
+
});
|
|
4200
|
+
var styles$2 = {
|
|
4201
|
+
"file-upload-progress": "lc-FileUploadProgress-module__file-upload-progress___xw8h8",
|
|
4202
|
+
"file-upload-progress__icon": "lc-FileUploadProgress-module__file-upload-progress__icon___p8Rfz",
|
|
4203
|
+
"file-upload-progress__wrapper": "lc-FileUploadProgress-module__file-upload-progress__wrapper___01Nkq",
|
|
4204
|
+
"file-upload-progress__wrapper--with-icon": "lc-FileUploadProgress-module__file-upload-progress__wrapper--with-icon___GSXmA",
|
|
4205
|
+
"file-upload-progress__wrapper__header": "lc-FileUploadProgress-module__file-upload-progress__wrapper__header___mYBGK",
|
|
4206
|
+
"file-upload-progress__wrapper__header__actions": "lc-FileUploadProgress-module__file-upload-progress__wrapper__header__actions___tvhB3",
|
|
4207
|
+
"file-upload-progress__wrapper__header__title": "lc-FileUploadProgress-module__file-upload-progress__wrapper__header__title___2IVuv",
|
|
4208
|
+
"file-upload-progress__wrapper__header__title--success": "lc-FileUploadProgress-module__file-upload-progress__wrapper__header__title--success___E6DQl",
|
|
4209
|
+
"file-upload-progress__wrapper__header__title--error": "lc-FileUploadProgress-module__file-upload-progress__wrapper__header__title--error___5BPpI"
|
|
4210
|
+
};
|
|
4211
|
+
var styles$1 = {
|
|
4212
|
+
"file-upload-progress-actions": "lc-FileUploadProgressActions-module__file-upload-progress-actions___qOBr2",
|
|
4213
|
+
"file-upload-progress-actions__close-button": "lc-FileUploadProgressActions-module__file-upload-progress-actions__close-button___Eh4um",
|
|
4214
|
+
"file-upload-progress-actions__retry-button": "lc-FileUploadProgressActions-module__file-upload-progress-actions__retry-button___DqFEo"
|
|
4215
|
+
};
|
|
4216
|
+
const baseClass$2 = "file-upload-progress-actions";
|
|
4217
|
+
const FileUploadProgressActions = ({ status, onCloseButtonClick, onRetryButtonClick }) => {
|
|
4218
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4219
|
+
className: styles$1[`${baseClass$2}`]
|
|
4220
|
+
}, onRetryButtonClick && status === "error" && /* @__PURE__ */ React.createElement("button", {
|
|
4221
|
+
type: "button",
|
|
4222
|
+
className: styles$1[`${baseClass$2}__retry-button`],
|
|
4223
|
+
"aria-label": "Retry",
|
|
4224
|
+
onClick: onRetryButtonClick
|
|
4225
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
4226
|
+
source: Refresh
|
|
4227
|
+
})), onCloseButtonClick && status !== "success" && /* @__PURE__ */ React.createElement("button", {
|
|
4228
|
+
type: "button",
|
|
4229
|
+
className: styles$1[`${baseClass$2}__close-button`],
|
|
4230
|
+
"aria-label": "Close",
|
|
4231
|
+
onClick: onCloseButtonClick
|
|
4232
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
4233
|
+
source: Close
|
|
4234
|
+
})));
|
|
4235
|
+
};
|
|
4236
|
+
const baseClass$1 = "file-upload-progress";
|
|
4237
|
+
const wrapperHeaderTitleClass = `${baseClass$1}__wrapper__header__title`;
|
|
4238
|
+
const FileUploadProgress = React.forwardRef(({
|
|
4239
|
+
actionsVisibility = "hidden",
|
|
4240
|
+
className,
|
|
4241
|
+
icon: icon2,
|
|
4242
|
+
title,
|
|
4243
|
+
progressValue: percent,
|
|
4244
|
+
size,
|
|
4245
|
+
status = "normal",
|
|
4246
|
+
onCloseButtonClick,
|
|
4247
|
+
onRetryButtonClick
|
|
4248
|
+
}, ref) => {
|
|
4249
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4250
|
+
className: styles$2[baseClass$1],
|
|
4251
|
+
ref
|
|
4252
|
+
}, icon2 && status !== "success" && /* @__PURE__ */ React.createElement("div", {
|
|
4253
|
+
className: styles$2[`${baseClass$1}__icon`]
|
|
4254
|
+
}, icon2), status === "success" && /* @__PURE__ */ React.createElement("div", {
|
|
4255
|
+
className: styles$2[`${baseClass$1}__icon`]
|
|
4256
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
4257
|
+
source: Check,
|
|
4258
|
+
kind: "success"
|
|
4259
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
4260
|
+
className: cx(styles$2[`${baseClass$1}__wrapper`], {
|
|
4261
|
+
[styles$2[`${baseClass$1}__wrapper--with-icon`]]: icon2
|
|
4262
|
+
})
|
|
4263
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4264
|
+
className: styles$2[`${baseClass$1}__wrapper__header`]
|
|
4265
|
+
}, title && /* @__PURE__ */ React.createElement("div", {
|
|
4266
|
+
className: cx(styles$2[wrapperHeaderTitleClass], {
|
|
4267
|
+
[styles$2[`${wrapperHeaderTitleClass}--success`]]: status === "success",
|
|
4268
|
+
[styles$2[`${wrapperHeaderTitleClass}--error`]]: status === "error"
|
|
4269
|
+
})
|
|
4270
|
+
}, title), actionsVisibility !== "hidden" && /* @__PURE__ */ React.createElement("div", {
|
|
4271
|
+
className: cx({
|
|
4272
|
+
[styles$2[`${baseClass$1}__wrapper__header__actions`]]: actionsVisibility === "hover"
|
|
4273
|
+
})
|
|
4274
|
+
}, /* @__PURE__ */ React.createElement(FileUploadProgressActions, {
|
|
4275
|
+
status,
|
|
4276
|
+
onCloseButtonClick,
|
|
4277
|
+
onRetryButtonClick
|
|
4278
|
+
}))), status !== "success" && /* @__PURE__ */ React.createElement(ProgressBar, {
|
|
4279
|
+
className,
|
|
4280
|
+
percent,
|
|
4281
|
+
status,
|
|
4282
|
+
size
|
|
4283
|
+
})));
|
|
4284
|
+
});
|
|
4285
|
+
var styles = {
|
|
4286
|
+
"upload-bar": "lc-UploadBar-module__upload-bar___6Or8h",
|
|
4287
|
+
"upload-bar--error": "lc-UploadBar-module__upload-bar--error___MzvhT",
|
|
4288
|
+
"upload-bar__wrapper": "lc-UploadBar-module__upload-bar__wrapper___MAUeH",
|
|
4289
|
+
"upload-bar__wrapper__header": "lc-UploadBar-module__upload-bar__wrapper__header___x9fen",
|
|
4290
|
+
"upload-bar__wrapper__header__icon": "lc-UploadBar-module__upload-bar__wrapper__header__icon___Aetm5",
|
|
4291
|
+
"upload-bar__wrapper__header__title": "lc-UploadBar-module__upload-bar__wrapper__header__title___BNuDu",
|
|
4292
|
+
"upload-bar__wrapper__header__collapse-button": "lc-UploadBar-module__upload-bar__wrapper__header__collapse-button___3khMy",
|
|
4293
|
+
"upload-bar__wrapper__header__actions-container": "lc-UploadBar-module__upload-bar__wrapper__header__actions-container___5Pj4y",
|
|
4294
|
+
"upload-bar__files": "lc-UploadBar-module__upload-bar__files___3W4nx",
|
|
4295
|
+
"upload-bar__files--enter": "lc-UploadBar-module__upload-bar__files--enter___zGq19",
|
|
4296
|
+
"upload-bar__files--enter-active": "lc-UploadBar-module__upload-bar__files--enter-active___-dMVb",
|
|
4297
|
+
"upload-bar__files--exit": "lc-UploadBar-module__upload-bar__files--exit___MXBRY",
|
|
4298
|
+
"upload-bar__files--exit-active": "lc-UploadBar-module__upload-bar__files--exit-active___krGW5",
|
|
4299
|
+
"upload-bar__files--exit-done": "lc-UploadBar-module__upload-bar__files--exit-done___2I72G",
|
|
4300
|
+
"upload-bar__files-wrapper": "lc-UploadBar-module__upload-bar__files-wrapper___93bs8",
|
|
4301
|
+
"upload-bar__files__list": "lc-UploadBar-module__upload-bar__files__list___QJFEq"
|
|
4302
|
+
};
|
|
4303
|
+
const baseClass = "upload-bar";
|
|
4304
|
+
const wrapperHeaderClass = `${baseClass}__wrapper__header`;
|
|
4305
|
+
const TRANSITION_TIMEOUT = 300;
|
|
4306
|
+
const getHeaderIcon = (status, progressValue) => {
|
|
4307
|
+
if (status === "success") {
|
|
4308
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4309
|
+
className: styles[`${wrapperHeaderClass}__success-icon`]
|
|
4310
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
4311
|
+
source: Check,
|
|
4312
|
+
kind: "success"
|
|
4313
|
+
}));
|
|
4314
|
+
}
|
|
4315
|
+
if (status === "error") {
|
|
4316
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4317
|
+
className: styles[`${wrapperHeaderClass}__error-icon`]
|
|
4318
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
4319
|
+
source: Error2,
|
|
4320
|
+
kind: "error"
|
|
4321
|
+
}));
|
|
4322
|
+
}
|
|
4323
|
+
return /* @__PURE__ */ React.createElement(ProgressCircle, {
|
|
4324
|
+
status,
|
|
4325
|
+
progressValue,
|
|
4326
|
+
size: "small"
|
|
4327
|
+
});
|
|
4328
|
+
};
|
|
4329
|
+
const UploadBar = ({
|
|
4330
|
+
children,
|
|
4331
|
+
className,
|
|
4332
|
+
progressValue,
|
|
4333
|
+
title,
|
|
4334
|
+
isExpanded,
|
|
4335
|
+
errorMessage,
|
|
4336
|
+
status = "normal",
|
|
4337
|
+
icon: icon2,
|
|
4338
|
+
size,
|
|
4339
|
+
mode = "multiple",
|
|
4340
|
+
onCloseButtonClick,
|
|
4341
|
+
onRetryButtonClick
|
|
4342
|
+
}) => {
|
|
4343
|
+
const [expanded, setExpanded] = React.useState(isExpanded || false);
|
|
4344
|
+
const withError = status === "error";
|
|
4345
|
+
const withSuccess = status === "success";
|
|
4346
|
+
const mergedClassNames = cx(styles[baseClass], className, {
|
|
4347
|
+
[styles[`${baseClass}--error`]]: withError,
|
|
4348
|
+
[styles[`${baseClass}--success`]]: withSuccess
|
|
4349
|
+
});
|
|
4350
|
+
const shouldShowCollapseButton = !(withError && (onRetryButtonClick || onCloseButtonClick));
|
|
4351
|
+
const handleOnWrapperClick = () => setExpanded(!expanded);
|
|
4352
|
+
if (mode === "single") {
|
|
4353
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4354
|
+
className: mergedClassNames
|
|
4355
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4356
|
+
className: styles[`${baseClass}__wrapper`]
|
|
4357
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4358
|
+
className: styles[`${wrapperHeaderClass}`]
|
|
4359
|
+
}, /* @__PURE__ */ React.createElement(FileUploadProgress, {
|
|
4360
|
+
title: withError ? errorMessage || title : title,
|
|
4361
|
+
progressValue,
|
|
4362
|
+
status,
|
|
4363
|
+
icon: icon2,
|
|
4364
|
+
size
|
|
4365
|
+
})), status === "error" && /* @__PURE__ */ React.createElement(FileUploadProgressActions, {
|
|
4366
|
+
status,
|
|
4367
|
+
onCloseButtonClick,
|
|
4368
|
+
onRetryButtonClick
|
|
4369
|
+
})));
|
|
4370
|
+
}
|
|
4371
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4372
|
+
className: mergedClassNames
|
|
4373
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4374
|
+
className: styles[`${baseClass}__wrapper`],
|
|
4375
|
+
onClick: handleOnWrapperClick
|
|
4376
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4377
|
+
className: styles[`${wrapperHeaderClass}`]
|
|
4378
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4379
|
+
className: styles[`${wrapperHeaderClass}__icon`]
|
|
4380
|
+
}, getHeaderIcon(status, progressValue)), /* @__PURE__ */ React.createElement("div", {
|
|
4381
|
+
className: styles[`${wrapperHeaderClass}__title`]
|
|
4382
|
+
}, withError ? errorMessage || title : title), shouldShowCollapseButton && /* @__PURE__ */ React.createElement("button", {
|
|
4383
|
+
className: styles[`${wrapperHeaderClass}__collapse-button`],
|
|
4384
|
+
type: "button",
|
|
4385
|
+
onClick: handleOnWrapperClick
|
|
4386
|
+
}, expanded ? /* @__PURE__ */ React.createElement(Icon, {
|
|
4387
|
+
source: ChevronUp
|
|
4388
|
+
}) : /* @__PURE__ */ React.createElement(Icon, {
|
|
4389
|
+
source: ChevronDown
|
|
4390
|
+
})), status === "error" && /* @__PURE__ */ React.createElement("div", {
|
|
4391
|
+
className: styles[`${wrapperHeaderClass}__actions-container`]
|
|
4392
|
+
}, /* @__PURE__ */ React.createElement(FileUploadProgressActions, {
|
|
4393
|
+
status,
|
|
4394
|
+
onCloseButtonClick,
|
|
4395
|
+
onRetryButtonClick
|
|
4396
|
+
})))), /* @__PURE__ */ React.createElement(TransitionGroup, {
|
|
4397
|
+
component: null
|
|
4398
|
+
}, expanded && /* @__PURE__ */ React.createElement(CSSTransition, {
|
|
4399
|
+
timeout: TRANSITION_TIMEOUT,
|
|
4400
|
+
classNames: {
|
|
4401
|
+
enter: styles[`${baseClass}__files--enter`],
|
|
4402
|
+
enterActive: styles[`${baseClass}__files--enter-active`],
|
|
4403
|
+
exit: styles[`${baseClass}__files--exit`],
|
|
4404
|
+
exitActive: styles[`${baseClass}__files--exit-active`],
|
|
4405
|
+
exitDone: styles[`${baseClass}__files--exit-done`]
|
|
4406
|
+
}
|
|
4407
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4408
|
+
className: styles[`${baseClass}__files`]
|
|
4409
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4410
|
+
className: styles[`${baseClass}__files-wrapper`]
|
|
4411
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4412
|
+
className: styles[`${baseClass}__files__list`]
|
|
4413
|
+
}, children))))));
|
|
4414
|
+
};
|
|
4415
|
+
export { ANIMATION_TIME, Alert, Avatar, Badge, Button, Card, Checkbox, DatePicker, DesignToken, EmailTagInput, FieldDescription, FieldError, FieldGroup, FileUploadProgress, FileUploadProgressActions, Form, FormField, FormGroup, Heading, Icon, Info, Input, Interactive, Link, Loader, Modal, ModalBase, ModalCloseButton, ModalPortal, NumericInput, Picker, PickerList, Popover, ProgressBar, ProgressCircle, PromoBanner, RadioButton, RangeDatePicker, SearchInput, SegmentedControl, ShadowToken, Simple, SpacingToken, Switch, Tab, TabsList, TabsWrapper, Tag, TagInput, Text, Textarea, Toast, ToastWrapper, Tooltip, UploadBar, UserGuide };
|