@databricks/design-system 1.12.20 → 1.12.21

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.
Files changed (87) hide show
  1. package/codemods/camelize.ts +5 -5
  2. package/dist/Popover-CrX63HDP.js +3831 -0
  3. package/dist/Popover-CrX63HDP.js.map +1 -0
  4. package/dist/Popover-DQEbjNyV.js +3831 -0
  5. package/dist/Popover-DQEbjNyV.js.map +1 -0
  6. package/dist/WizardStepContentWrapper-Bv2MqnDd.js +2276 -0
  7. package/dist/WizardStepContentWrapper-Bv2MqnDd.js.map +1 -0
  8. package/dist/WizardStepContentWrapper-CzvxVy-w.js +2278 -0
  9. package/dist/WizardStepContentWrapper-CzvxVy-w.js.map +1 -0
  10. package/dist/development.js +3 -3
  11. package/dist/development.js.map +1 -1
  12. package/dist/index-BC9PpmGo.js +770 -0
  13. package/dist/index-BC9PpmGo.js.map +1 -0
  14. package/dist/index-DxyvNv4-.js +770 -0
  15. package/dist/index-DxyvNv4-.js.map +1 -0
  16. package/dist/index.js +162 -66
  17. package/dist/index.js.map +1 -1
  18. package/dist/patterns.js +2 -2
  19. package/package.json +4 -4
  20. package/scripts/theme_regeneration/common.ts +3 -3
  21. package/scripts/theme_regeneration/regenerate_color_validity_enums.ts +3 -3
  22. package/src/assets/icons/RowsIcon.svg +3 -0
  23. package/src/assets/icons/TokenIcon.svg +8 -0
  24. package/src/assets/icons/TrendingIcon.svg +1 -0
  25. package/src/design-system/Accordion/Accordion.tsx +2 -2
  26. package/src/design-system/Alert/Alert.tsx +1 -1
  27. package/src/design-system/ApplyGlobalStyles/ApplyGlobalStyles.tsx +1 -1
  28. package/src/design-system/Card/Card.test.tsx +52 -0
  29. package/src/design-system/Card/Card.tsx +21 -5
  30. package/src/design-system/DatePicker/DatePicker.tsx +6 -4
  31. package/src/design-system/DesignSystemEventProvider/DesignSystemEventProvider.test.tsx +5 -3
  32. package/src/design-system/DesignSystemProvider/DesignSystemProvider.test.tsx +1 -1
  33. package/src/design-system/DesignSystemProvider/DesignSystemProvider.tsx +8 -6
  34. package/src/design-system/Dropdown/Dropdown.tsx +1 -1
  35. package/src/design-system/Empty/Empty.tsx +1 -1
  36. package/src/design-system/Grid/Col.tsx +1 -1
  37. package/src/design-system/Grid/Row.tsx +1 -1
  38. package/src/design-system/Header/Header.tsx +1 -1
  39. package/src/design-system/Hooks/useDesignSystemTheme.tsx +3 -1
  40. package/src/design-system/HoverCard/HoverCard.tsx +11 -5
  41. package/src/design-system/Icon/Icon.tsx +4 -4
  42. package/src/design-system/Icon/__generated/icons/{InfoIcon.tsx → RowsIcon.tsx} +6 -7
  43. package/src/design-system/Icon/__generated/icons/TokenIcon.tsx +28 -0
  44. package/src/design-system/Icon/__generated/icons/TrendingIcon.tsx +23 -0
  45. package/src/design-system/Icon/__generated/icons/index.ts +3 -1
  46. package/src/design-system/Input/Password.tsx +25 -23
  47. package/src/design-system/LegacyForm/LegacyForm.tsx +5 -1
  48. package/src/design-system/LegacyPopover/LegacyPopover.tsx +5 -1
  49. package/src/design-system/LegacySelect/LegacySelect.tsx +2 -2
  50. package/src/design-system/LegacyTable/LegacyTable.tsx +1 -1
  51. package/src/design-system/LegacyTabs/index.tsx +4 -1
  52. package/src/design-system/LegacyTooltip/LegacyTooltip.tsx +1 -1
  53. package/src/design-system/LoadingState/LoadingState.tsx +1 -1
  54. package/src/design-system/Modal/Modal.tsx +19 -2
  55. package/src/design-system/PageWrapper/PageWrapper.tsx +1 -1
  56. package/src/design-system/Pagination/index.tsx +2 -2
  57. package/src/design-system/PreviewCard/PreviewCard.test.tsx +70 -0
  58. package/src/design-system/PreviewCard/PreviewCard.tsx +15 -5
  59. package/src/design-system/Radio/Radio.tsx +28 -28
  60. package/src/design-system/SegmentedControl/SegmentedControl.tsx +2 -2
  61. package/src/design-system/Select/SimpleSelect.tsx +4 -1
  62. package/src/design-system/Skeleton/TableSkeleton.tsx +4 -2
  63. package/src/design-system/Skeleton/TitleSkeleton.tsx +10 -2
  64. package/src/design-system/Space/Space.tsx +1 -1
  65. package/src/design-system/Spacer/Spacer.tsx +1 -1
  66. package/src/design-system/Spinner/Spinner.tsx +1 -1
  67. package/src/design-system/SplitButton/Dropdown/DropdownButton.tsx +1 -1
  68. package/src/design-system/SplitButton/SplitButton.tsx +3 -1
  69. package/src/design-system/Stepper/Stepper.tsx +1 -1
  70. package/src/design-system/Switch/Switch.tsx +1 -1
  71. package/src/design-system/TableUI/TableCell.tsx +10 -1
  72. package/src/design-system/Tooltip/Tooltip.tsx +1 -1
  73. package/src/design-system/TypeaheadCombobox/CountBadge.tsx +5 -1
  74. package/src/design-system/TypeaheadCombobox/TypeaheadComboboxControls.tsx +1 -1
  75. package/src/design-system/TypeaheadCombobox/TypeaheadComboboxRoot.tsx +1 -1
  76. package/src/design-system/TypeaheadCombobox/TypeaheadComboboxSelectedItem.tsx +1 -1
  77. package/src/design-system/TypeaheadCombobox/tests/TypeaheadCombobox.test.tsx +3 -3
  78. package/src/design-system/TypeaheadCombobox/tests/testFixtures.tsx +3 -3
  79. package/src/design-system/utils/css-utils.tsx +6 -6
  80. package/src/design-system/utils/shadow-dom-storybook-wrapper.tsx +1 -1
  81. package/src/development/Banner/Banner.tsx +1 -1
  82. package/src/development/PillControl/PillControl.tsx +1 -0
  83. package/src/development/TreeGrid/TreeGrid.test.tsx +2 -2
  84. package/src/development/TreeGrid/TreeGrid.tsx +1 -1
  85. package/src/theme/convertToLessVars.ts +5 -5
  86. package/src/~patterns/Wizard/VerticalWizardContent.tsx +3 -1
  87. package/src/assets/icons/InfoIcon.svg +0 -5
@@ -0,0 +1,2278 @@
1
+ import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
2
+ import { isUndefined, pick, compact, noop } from 'lodash';
3
+ import React__default, { forwardRef, useContext, useMemo, useRef, useEffect, createContext, useLayoutEffect, useState, useCallback } from 'react';
4
+ import { I as Icon, v as DesignSystemEventSuppressInteractionProviderContext, w as DesignSystemEventSuppressInteractionTrueContextValue, e as DesignSystemEventProviderAnalyticsEventTypes, u as useDesignSystemTheme, a as useDesignSystemSafexFlags, f as useDesignSystemEventComponentCallbacks, h as DesignSystemEventProviderComponentTypes, k as useNotifyOnFirstView, s as safex, x as augmentWithDataComponentProps, D as DesignSystemAntDConfigProvider, b as addDebugOutlineIfEnabled, y as RestoreAntDDefaultClsPrefix, C as CloseIcon, l as DangerIcon, B as Button, z as addDebugOutlineStylesIfEnabled, A as getDarkModePortalStyles, E as getShadowScrollStyles, c as getAnimationCss, i as importantify, T as Typography, q as ChevronRightIcon, o as ChevronLeftIcon, W as WarningIcon, L as LoadingIcon, G as DEFAULT_SPACING_UNIT, H as useDesignSystemContext, R as Root$1, m as Trigger$1, n as Content$2 } from './Popover-DQEbjNyV.js';
5
+ import { css, Global, keyframes, createElement } from '@emotion/react';
6
+ import { ResizableBox } from 'react-resizable';
7
+ import * as RadixTooltip from '@radix-ui/react-tooltip';
8
+ import { Modal as Modal$1 } from 'antd';
9
+
10
+ function SvgCheckIcon(props) {
11
+ return /*#__PURE__*/ jsx("svg", {
12
+ xmlns: "http://www.w3.org/2000/svg",
13
+ width: "1em",
14
+ height: "1em",
15
+ fill: "none",
16
+ viewBox: "0 0 16 16",
17
+ ...props,
18
+ children: /*#__PURE__*/ jsx("path", {
19
+ fill: "currentColor",
20
+ fillRule: "evenodd",
21
+ d: "m15.06 3.56-9.53 9.531L1 8.561 2.06 7.5l3.47 3.47L14 2.5z",
22
+ clipRule: "evenodd"
23
+ })
24
+ });
25
+ }
26
+ const CheckIcon = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
27
+ return /*#__PURE__*/ jsx(Icon, {
28
+ ref: forwardedRef,
29
+ ...props,
30
+ component: SvgCheckIcon
31
+ });
32
+ });
33
+ CheckIcon.displayName = 'CheckIcon';
34
+
35
+ function SvgInfoSmallIcon(props) {
36
+ return /*#__PURE__*/ jsxs("svg", {
37
+ xmlns: "http://www.w3.org/2000/svg",
38
+ width: "1em",
39
+ height: "1em",
40
+ fill: "none",
41
+ viewBox: "0 0 16 16",
42
+ ...props,
43
+ children: [
44
+ /*#__PURE__*/ jsx("path", {
45
+ fill: "currentColor",
46
+ d: "M7.25 10.5v-3h1.5v3zM8 5a.75.75 0 1 1 0 1.5A.75.75 0 0 1 8 5"
47
+ }),
48
+ /*#__PURE__*/ jsx("path", {
49
+ fill: "currentColor",
50
+ fillRule: "evenodd",
51
+ d: "M8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12m0-1.5a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9",
52
+ clipRule: "evenodd"
53
+ })
54
+ ]
55
+ });
56
+ }
57
+ const InfoSmallIcon = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
58
+ return /*#__PURE__*/ jsx(Icon, {
59
+ ref: forwardedRef,
60
+ ...props,
61
+ component: SvgInfoSmallIcon
62
+ });
63
+ });
64
+ InfoSmallIcon.displayName = 'InfoSmallIcon';
65
+
66
+ function SvgListIcon(props) {
67
+ return /*#__PURE__*/ jsx("svg", {
68
+ xmlns: "http://www.w3.org/2000/svg",
69
+ width: "1em",
70
+ height: "1em",
71
+ fill: "none",
72
+ viewBox: "0 0 16 16",
73
+ ...props,
74
+ children: /*#__PURE__*/ jsx("path", {
75
+ fill: "currentColor",
76
+ d: "M1.5 2.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0M3 2h13v1.5H3zM3 5.5h13V7H3zM3 9h13v1.5H3zM3 12.5h13V14H3zM.75 7a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M1.5 13.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0M.75 10.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5"
77
+ })
78
+ });
79
+ }
80
+ const ListIcon = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
81
+ return /*#__PURE__*/ jsx(Icon, {
82
+ ref: forwardedRef,
83
+ ...props,
84
+ component: SvgListIcon
85
+ });
86
+ });
87
+ ListIcon.displayName = 'ListIcon';
88
+
89
+ const ModalContext = /*#__PURE__*/ createContext({
90
+ isInsideModal: true
91
+ });
92
+ const useModalContext = ()=>useContext(ModalContext);
93
+ const SIZE_PRESETS = {
94
+ normal: 640,
95
+ wide: 880
96
+ };
97
+ const getModalEmotionStyles = (args)=>{
98
+ const { theme, clsPrefix, hasFooter = true, maxedOutHeight, useNewShadows, useNewBorderRadii, useNewBorderColors } = args;
99
+ const classNameClose = `.${clsPrefix}-modal-close`;
100
+ const classNameCloseX = `.${clsPrefix}-modal-close-x`;
101
+ const classNameTitle = `.${clsPrefix}-modal-title`;
102
+ const classNameContent = `.${clsPrefix}-modal-content`;
103
+ const classNameBody = `.${clsPrefix}-modal-body`;
104
+ const classNameHeader = `.${clsPrefix}-modal-header`;
105
+ const classNameFooter = `.${clsPrefix}-modal-footer`;
106
+ const classNameButton = `.${clsPrefix}-btn`;
107
+ const classNameDropdownTrigger = `.${clsPrefix}-dropdown-button`;
108
+ const MODAL_PADDING = theme.spacing.lg;
109
+ const BUTTON_SIZE = theme.general.heightSm;
110
+ // Needed for moving some of the padding from the header and footer to the content to avoid a scrollbar from appearing
111
+ // when the content has some interior components that reach the limits of the content div
112
+ // 8px is an arbitrary value, it still leaves enough padding for the header and footer too to avoid the same problem
113
+ // from occurring there too
114
+ const CONTENT_BUFFER = 8;
115
+ const modalMaxHeight = '90vh';
116
+ const headerHeight = 64;
117
+ const footerHeight = hasFooter ? 52 : 0;
118
+ const bodyMaxHeight = `calc(${modalMaxHeight} - ${headerHeight}px - ${footerHeight}px - ${MODAL_PADDING}px)`;
119
+ return /*#__PURE__*/ css({
120
+ '&&': {
121
+ ...addDebugOutlineStylesIfEnabled(theme)
122
+ },
123
+ [classNameHeader]: {
124
+ background: 'transparent',
125
+ paddingTop: theme.spacing.md,
126
+ paddingLeft: theme.spacing.lg,
127
+ paddingRight: theme.spacing.md,
128
+ paddingBottom: theme.spacing.md
129
+ },
130
+ [classNameFooter]: {
131
+ height: footerHeight,
132
+ paddingTop: theme.spacing.lg - CONTENT_BUFFER,
133
+ paddingLeft: MODAL_PADDING,
134
+ paddingRight: MODAL_PADDING,
135
+ marginTop: 'auto',
136
+ [`${classNameButton} + ${classNameButton}`]: {
137
+ marginLeft: theme.spacing.sm
138
+ },
139
+ // Needed to override AntD style for the SplitButton's dropdown button back to its original value
140
+ [`${classNameDropdownTrigger} > ${classNameButton}:nth-of-type(2)`]: {
141
+ marginLeft: -1
142
+ }
143
+ },
144
+ [classNameCloseX]: {
145
+ fontSize: theme.general.iconSize,
146
+ height: BUTTON_SIZE,
147
+ width: BUTTON_SIZE,
148
+ lineHeight: 'normal',
149
+ display: 'flex',
150
+ alignItems: 'center',
151
+ justifyContent: 'center',
152
+ color: theme.colors.textSecondary
153
+ },
154
+ [classNameClose]: {
155
+ height: BUTTON_SIZE,
156
+ width: BUTTON_SIZE,
157
+ // Note: Ant has the close button absolutely positioned, rather than in a flex container with the title.
158
+ // This magic number is eyeballed to get the close X to align with the title text.
159
+ margin: '16px 16px 0 0',
160
+ borderRadius: useNewBorderRadii ? theme.borders.borderRadiusSm : theme.legacyBorders.borderRadiusMd,
161
+ backgroundColor: theme.colors.actionDefaultBackgroundDefault,
162
+ borderColor: theme.colors.actionDefaultBackgroundDefault,
163
+ color: theme.colors.actionDefaultTextDefault,
164
+ '&:hover': {
165
+ backgroundColor: theme.colors.actionDefaultBackgroundHover,
166
+ borderColor: theme.colors.actionDefaultBackgroundHover,
167
+ color: theme.colors.actionDefaultTextHover
168
+ },
169
+ '&:active': {
170
+ backgroundColor: theme.colors.actionDefaultBackgroundPress,
171
+ borderColor: theme.colors.actionDefaultBackgroundPress,
172
+ color: theme.colors.actionDefaultTextPress
173
+ },
174
+ '&:focus-visible': {
175
+ outlineStyle: 'solid',
176
+ outlineWidth: '2px',
177
+ outlineOffset: '1px',
178
+ outlineColor: theme.colors.actionDefaultBorderFocus
179
+ }
180
+ },
181
+ [classNameTitle]: {
182
+ fontSize: theme.typography.fontSizeXl,
183
+ lineHeight: theme.typography.lineHeightXl,
184
+ fontWeight: theme.typography.typographyBoldFontWeight,
185
+ paddingRight: MODAL_PADDING,
186
+ minHeight: headerHeight / 2,
187
+ display: 'flex',
188
+ alignItems: 'center',
189
+ overflowWrap: 'anywhere'
190
+ },
191
+ [classNameContent]: {
192
+ backgroundColor: theme.colors.backgroundPrimary,
193
+ maxHeight: modalMaxHeight,
194
+ height: maxedOutHeight ? modalMaxHeight : '',
195
+ overflow: 'hidden',
196
+ paddingBottom: MODAL_PADDING,
197
+ display: 'flex',
198
+ flexDirection: 'column',
199
+ boxShadow: useNewShadows ? theme.shadows.xl : theme.general.shadowHigh,
200
+ ...useNewBorderRadii && {
201
+ borderRadius: theme.borders.borderRadiusLg
202
+ },
203
+ ...getDarkModePortalStyles(theme, useNewShadows, useNewBorderColors)
204
+ },
205
+ [classNameBody]: {
206
+ overflowY: 'auto',
207
+ maxHeight: bodyMaxHeight,
208
+ paddingLeft: MODAL_PADDING,
209
+ paddingRight: MODAL_PADDING,
210
+ paddingTop: CONTENT_BUFFER,
211
+ paddingBottom: CONTENT_BUFFER,
212
+ ...getShadowScrollStyles(theme)
213
+ },
214
+ ...getAnimationCss(theme.options.enableAnimation)
215
+ });
216
+ };
217
+ function closeButtonComponentId(componentId) {
218
+ return componentId ? `${componentId}.footer.cancel` : 'codegen_design-system_src_design-system_modal_modal.tsx_260';
219
+ }
220
+ /**
221
+ * Render default footer with our buttons. Copied from AntD.
222
+ */ function DefaultFooter(param) {
223
+ let { componentId, onOk, onCancel, confirmLoading, okText, cancelText, okButtonProps, cancelButtonProps, autoFocusButton, shouldStartInteraction } = param;
224
+ const handleCancel = (e)=>{
225
+ onCancel?.(e);
226
+ };
227
+ const handleOk = (e)=>{
228
+ onOk?.(e);
229
+ };
230
+ return /*#__PURE__*/ jsxs(Fragment, {
231
+ children: [
232
+ cancelText && /*#__PURE__*/ jsx(Button, {
233
+ componentId: closeButtonComponentId(componentId),
234
+ onClick: handleCancel,
235
+ autoFocus: autoFocusButton === 'cancel',
236
+ dangerouslyUseFocusPseudoClass: true,
237
+ shouldStartInteraction: shouldStartInteraction,
238
+ ...cancelButtonProps,
239
+ children: cancelText
240
+ }),
241
+ okText && /*#__PURE__*/ jsx(Button, {
242
+ componentId: componentId ? `${componentId}.footer.ok` : 'codegen_design-system_src_design-system_modal_modal.tsx_271',
243
+ loading: confirmLoading,
244
+ onClick: handleOk,
245
+ type: "primary",
246
+ autoFocus: autoFocusButton === 'ok',
247
+ dangerouslyUseFocusPseudoClass: true,
248
+ shouldStartInteraction: shouldStartInteraction,
249
+ ...okButtonProps,
250
+ children: okText
251
+ })
252
+ ]
253
+ });
254
+ }
255
+ function Modal(props) {
256
+ return /*#__PURE__*/ jsx(DesignSystemEventSuppressInteractionProviderContext.Provider, {
257
+ value: DesignSystemEventSuppressInteractionTrueContextValue,
258
+ children: /*#__PURE__*/ jsx(ModalInternal, {
259
+ ...props
260
+ })
261
+ });
262
+ }
263
+ function ModalInternal(param) {
264
+ let { componentId, analyticsEvents = [
265
+ DesignSystemEventProviderAnalyticsEventTypes.OnView
266
+ ], okButtonProps, cancelButtonProps, dangerouslySetAntdProps, children, title, footer, size = 'normal', verticalSizing = 'dynamic', autoFocusButton, truncateTitle, shouldStartInteraction, ...props } = param;
267
+ const { theme, classNamePrefix } = useDesignSystemTheme();
268
+ const { useNewShadows, useNewBorderRadii, useNewBorderColors } = useDesignSystemSafexFlags();
269
+ const memoizedAnalyticsEvents = useMemo(()=>analyticsEvents, [
270
+ analyticsEvents
271
+ ]);
272
+ const eventContext = useDesignSystemEventComponentCallbacks({
273
+ componentType: DesignSystemEventProviderComponentTypes.Modal,
274
+ componentId,
275
+ analyticsEvents: memoizedAnalyticsEvents,
276
+ shouldStartInteraction
277
+ });
278
+ const { elementRef } = useNotifyOnFirstView({
279
+ onView: eventContext.onView
280
+ });
281
+ const emitViewEventThroughVisibleEffect = dangerouslySetAntdProps?.closable === false;
282
+ const isViewedViaVisibleEffectRef = useRef(false);
283
+ useEffect(()=>{
284
+ if (emitViewEventThroughVisibleEffect && !isViewedViaVisibleEffectRef.current && props.visible === true) {
285
+ isViewedViaVisibleEffectRef.current = true;
286
+ eventContext.onView();
287
+ }
288
+ }, [
289
+ props.visible,
290
+ emitViewEventThroughVisibleEffect,
291
+ eventContext
292
+ ]);
293
+ // Need to simulate the close button being closed if the user clicks outside of the modal or clicks on the dismiss button
294
+ // This should only be applied to the modal prop and not to the footer component
295
+ const closeButtonEventContext = useDesignSystemEventComponentCallbacks({
296
+ componentType: DesignSystemEventProviderComponentTypes.Button,
297
+ componentId: closeButtonComponentId(componentId),
298
+ analyticsEvents: [
299
+ DesignSystemEventProviderAnalyticsEventTypes.OnClick
300
+ ],
301
+ shouldStartInteraction
302
+ });
303
+ const onCancelWrapper = (e)=>{
304
+ closeButtonEventContext.onClick(e);
305
+ props.onCancel?.(e);
306
+ };
307
+ // add data-component-* props to make modal discoverable by go/component-finder
308
+ const augmentedChildren = safex('databricks.fe.observability.enableModalDataComponentProps', false) ? augmentWithDataComponentProps(children, eventContext.dataComponentProps) : children;
309
+ return /*#__PURE__*/ jsx(DesignSystemAntDConfigProvider, {
310
+ children: /*#__PURE__*/ jsx(Modal$1, {
311
+ ...addDebugOutlineIfEnabled(),
312
+ css: getModalEmotionStyles({
313
+ theme,
314
+ clsPrefix: classNamePrefix,
315
+ hasFooter: footer !== null,
316
+ maxedOutHeight: verticalSizing === 'maxed_out',
317
+ useNewShadows,
318
+ useNewBorderRadii,
319
+ useNewBorderColors
320
+ }),
321
+ title: /*#__PURE__*/ jsx(RestoreAntDDefaultClsPrefix, {
322
+ children: truncateTitle ? /*#__PURE__*/ jsx("div", {
323
+ css: {
324
+ textOverflow: 'ellipsis',
325
+ marginRight: theme.spacing.md,
326
+ overflow: 'hidden',
327
+ whiteSpace: 'nowrap'
328
+ },
329
+ title: typeof title === 'string' ? title : undefined,
330
+ children: title
331
+ }) : title
332
+ }),
333
+ footer: footer === null ? null : /*#__PURE__*/ jsx(RestoreAntDDefaultClsPrefix, {
334
+ children: footer === undefined ? /*#__PURE__*/ jsx(DefaultFooter, {
335
+ componentId: componentId,
336
+ onOk: props.onOk,
337
+ onCancel: props.onCancel,
338
+ confirmLoading: props.confirmLoading,
339
+ okText: props.okText,
340
+ cancelText: props.cancelText,
341
+ okButtonProps: okButtonProps,
342
+ cancelButtonProps: cancelButtonProps,
343
+ autoFocusButton: autoFocusButton,
344
+ shouldStartInteraction: shouldStartInteraction
345
+ }) : footer
346
+ }),
347
+ width: size ? SIZE_PRESETS[size] : undefined,
348
+ closeIcon: /*#__PURE__*/ jsx(CloseIcon, {
349
+ ref: elementRef
350
+ }),
351
+ centered: true,
352
+ zIndex: theme.options.zIndexBase,
353
+ maskStyle: {
354
+ backgroundColor: theme.colors.overlayOverlay
355
+ },
356
+ ...props,
357
+ onCancel: onCancelWrapper,
358
+ ...dangerouslySetAntdProps,
359
+ children: /*#__PURE__*/ jsx(RestoreAntDDefaultClsPrefix, {
360
+ children: /*#__PURE__*/ jsx(ModalContext.Provider, {
361
+ value: {
362
+ isInsideModal: true
363
+ },
364
+ children: augmentedChildren
365
+ })
366
+ })
367
+ })
368
+ });
369
+ }
370
+ function DangerModal(props) {
371
+ const { theme } = useDesignSystemTheme();
372
+ const { title, onCancel, onOk, cancelText, okText, okButtonProps, cancelButtonProps, ...restProps } = props;
373
+ const iconSize = 18;
374
+ const iconFontSize = 18;
375
+ const titleComp = /*#__PURE__*/ jsxs("div", {
376
+ css: {
377
+ position: 'relative',
378
+ display: 'inline-flex',
379
+ alignItems: 'center'
380
+ },
381
+ children: [
382
+ /*#__PURE__*/ jsx(DangerIcon, {
383
+ css: {
384
+ color: theme.colors.textValidationDanger,
385
+ left: 2,
386
+ height: iconSize,
387
+ width: iconSize,
388
+ fontSize: iconFontSize
389
+ }
390
+ }),
391
+ /*#__PURE__*/ jsx("div", {
392
+ css: {
393
+ paddingLeft: 6
394
+ },
395
+ children: title
396
+ })
397
+ ]
398
+ });
399
+ return /*#__PURE__*/ jsx(Modal, {
400
+ shouldStartInteraction: props.shouldStartInteraction,
401
+ title: titleComp,
402
+ footer: [
403
+ /*#__PURE__*/ jsx(Button, {
404
+ componentId: props.componentId ? `${props.componentId}.danger.footer.cancel` : 'codegen_design-system_src_design-system_modal_modal.tsx_386',
405
+ onClick: onCancel,
406
+ shouldStartInteraction: props.shouldStartInteraction,
407
+ ...cancelButtonProps,
408
+ children: cancelText || 'Cancel'
409
+ }, "cancel"),
410
+ /*#__PURE__*/ jsx(Button, {
411
+ componentId: props.componentId ? `${props.componentId}.danger.footer.ok` : 'codegen_design-system_src_design-system_modal_modal.tsx_395',
412
+ type: "primary",
413
+ danger: true,
414
+ onClick: onOk,
415
+ loading: props.confirmLoading,
416
+ shouldStartInteraction: props.shouldStartInteraction,
417
+ ...okButtonProps,
418
+ children: okText || 'Delete'
419
+ }, "discard")
420
+ ],
421
+ onOk: onOk,
422
+ onCancel: onCancel,
423
+ ...restProps
424
+ });
425
+ }
426
+
427
+ const Spacer = (param)=>{
428
+ let { size = 'md', shrinks, ...props } = param;
429
+ const { theme } = useDesignSystemTheme();
430
+ const spacingValues = {
431
+ xs: theme.spacing.xs,
432
+ sm: theme.spacing.sm,
433
+ md: theme.spacing.md,
434
+ lg: theme.spacing.lg
435
+ };
436
+ return /*#__PURE__*/ jsx("div", {
437
+ css: /*#__PURE__*/ css({
438
+ height: spacingValues[size],
439
+ ...shrinks === false ? {
440
+ flexShrink: 0
441
+ } : undefined
442
+ }),
443
+ ...props
444
+ });
445
+ };
446
+
447
+ /**
448
+ * Copied from usehooks-ts.
449
+ * Custom hook for using either `useLayoutEffect` or `useEffect` based on the environment (client-side or server-side).
450
+ *
451
+ * [Documentation](https://usehooks-ts.com/react-hook/use-isomorphic-layout-effect)
452
+ *
453
+ * Example:
454
+ * ```
455
+ * useIsomorphicLayoutEffect(() => {
456
+ * // Code to be executed during the layout phase on the client side
457
+ * }, [dependency1, dependency2]);
458
+ * ```
459
+ */ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
460
+
461
+ const IS_SERVER = typeof window === 'undefined';
462
+ /**
463
+ * Copied from usehooks-ts.
464
+ * Custom hook for tracking the state of a media query. Returns The current state of the media query (true if the query matches, false otherwise).
465
+ *
466
+ * [Documentation](https://usehooks-ts.com/react-hook/use-media-query)
467
+ *
468
+ * [MDN Match Media](https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia)
469
+ *
470
+ * Example:
471
+ *
472
+ * `const isSmallScreen = useMediaQuery('(max-width: 600px)');`
473
+ *
474
+ * Use `isSmallScreen` to conditionally apply styles or logic based on the screen size.
475
+ */ function useMediaQuery(param) {
476
+ let { query, options } = param;
477
+ // TODO: Refactor this code after the deprecated signature has been removed.
478
+ const defaultValue = typeof options === 'boolean' ? options : options?.defaultValue ?? false;
479
+ const initializeWithValue = typeof options === 'boolean' ? undefined : options?.initializeWithValue ?? undefined;
480
+ const [matches, setMatches] = useState(()=>{
481
+ if (initializeWithValue) {
482
+ return getMatches(query);
483
+ }
484
+ return defaultValue;
485
+ });
486
+ const getMatches = (query)=>{
487
+ if (IS_SERVER) {
488
+ return defaultValue;
489
+ }
490
+ return window.matchMedia(query).matches;
491
+ };
492
+ /** Handles the change event of the media query. */ function handleChange() {
493
+ setMatches(getMatches(query));
494
+ }
495
+ useIsomorphicLayoutEffect(()=>{
496
+ const matchMedia = window.matchMedia(query);
497
+ // Triggered at the first client-side load and if query changes
498
+ handleChange();
499
+ // Use deprecated `addListener` and `removeListener` to support Safari < 14 (#135)
500
+ if (matchMedia.addListener) {
501
+ matchMedia.addListener(handleChange);
502
+ } else {
503
+ matchMedia.addEventListener('change', handleChange);
504
+ }
505
+ return ()=>{
506
+ if (matchMedia.removeListener) {
507
+ matchMedia.removeListener(handleChange);
508
+ } else {
509
+ matchMedia.removeEventListener('change', handleChange);
510
+ }
511
+ };
512
+ }, [
513
+ query
514
+ ]);
515
+ return matches;
516
+ }
517
+
518
+ /**
519
+ * `ResizableBox` passes `handleAxis` to the element used as handle. We need to wrap the handle to prevent
520
+ * `handleAxis becoming an attribute on the div element.
521
+ */ const ResizablePanelHandle = /*#__PURE__*/ forwardRef(function ResizablePanelHandle(param, ref) {
522
+ let { handleAxis, children, ...otherProps } = param;
523
+ return /*#__PURE__*/ jsx("div", {
524
+ ref: ref,
525
+ ...otherProps,
526
+ children: children
527
+ });
528
+ });
529
+ const DEFAULT_WIDTH = 200;
530
+ const ContentContextDefaults = {
531
+ openPanelId: undefined,
532
+ closable: true,
533
+ destroyInactivePanels: false,
534
+ setIsClosed: ()=>{}
535
+ };
536
+ const SidebarContextDefaults = {
537
+ position: 'left'
538
+ };
539
+ const ContentContext = /*#__PURE__*/ createContext(ContentContextDefaults);
540
+ const SidebarContext = /*#__PURE__*/ createContext(SidebarContextDefaults);
541
+ function Nav(param) {
542
+ let { children, dangerouslyAppendEmotionCSS } = param;
543
+ const { theme } = useDesignSystemTheme();
544
+ return /*#__PURE__*/ jsx("nav", {
545
+ css: [
546
+ {
547
+ display: 'flex',
548
+ flexDirection: 'column',
549
+ gap: theme.spacing.xs,
550
+ padding: theme.spacing.xs
551
+ },
552
+ dangerouslyAppendEmotionCSS
553
+ ],
554
+ children: children
555
+ });
556
+ }
557
+ const NavButton = /*#__PURE__*/ React__default.forwardRef((param, ref)=>{
558
+ let { active, disabled, icon, onClick, children, dangerouslyAppendEmotionCSS, 'aria-label': ariaLabel, ...restProps } = param;
559
+ const { theme } = useDesignSystemTheme();
560
+ return /*#__PURE__*/ jsx("div", {
561
+ css: [
562
+ active ? importantify({
563
+ borderRadius: theme.borders.borderRadiusSm,
564
+ background: theme.colors.actionDefaultBackgroundPress,
565
+ button: {
566
+ '&:enabled:not(:hover):not(:active) > .anticon': {
567
+ color: theme.colors.actionTertiaryTextPress
568
+ }
569
+ }
570
+ }) : undefined,
571
+ dangerouslyAppendEmotionCSS
572
+ ],
573
+ children: /*#__PURE__*/ jsx(Button, {
574
+ ref: ref,
575
+ icon: icon,
576
+ onClick: onClick,
577
+ disabled: disabled,
578
+ "aria-label": ariaLabel,
579
+ ...restProps,
580
+ children: children
581
+ })
582
+ });
583
+ });
584
+ const TOGGLE_BUTTON_Z_INDEX = 100;
585
+ const COMPACT_CONTENT_Z_INDEX = 50;
586
+ const ToggleButton = (param)=>{
587
+ let { isExpanded, position, toggleIsExpanded, componentId } = param;
588
+ const { theme } = useDesignSystemTheme();
589
+ const positionStyle = useMemo(()=>{
590
+ if (position === 'right') {
591
+ return isExpanded ? {
592
+ right: DEFAULT_WIDTH,
593
+ transform: 'translateX(+50%)'
594
+ } : {
595
+ left: 0,
596
+ transform: 'translateX(-50%)'
597
+ };
598
+ } else {
599
+ return isExpanded ? {
600
+ left: DEFAULT_WIDTH,
601
+ transform: 'translateX(-50%)'
602
+ } : {
603
+ right: 0,
604
+ transform: 'translateX(+50%)'
605
+ };
606
+ }
607
+ }, [
608
+ isExpanded,
609
+ position
610
+ ]);
611
+ const ToggleIcon = useMemo(()=>{
612
+ if (position === 'right') {
613
+ return isExpanded ? ChevronRightIcon : ChevronLeftIcon;
614
+ } else {
615
+ return isExpanded ? ChevronLeftIcon : ChevronRightIcon;
616
+ }
617
+ }, [
618
+ isExpanded,
619
+ position
620
+ ]);
621
+ return /*#__PURE__*/ jsxs("div", {
622
+ css: {
623
+ position: 'absolute',
624
+ top: 0,
625
+ height: 46,
626
+ display: 'flex',
627
+ alignItems: 'center',
628
+ zIndex: TOGGLE_BUTTON_Z_INDEX,
629
+ ...positionStyle
630
+ },
631
+ children: [
632
+ /*#__PURE__*/ jsx("div", {
633
+ css: {
634
+ borderRadius: '100%',
635
+ width: theme.spacing.lg,
636
+ height: theme.spacing.lg,
637
+ backgroundColor: theme.colors.backgroundPrimary,
638
+ position: 'absolute'
639
+ }
640
+ }),
641
+ /*#__PURE__*/ jsx(Button, {
642
+ componentId: componentId,
643
+ css: {
644
+ borderRadius: '100%',
645
+ '&&': {
646
+ padding: '0px !important',
647
+ width: `${theme.spacing.lg}px !important`
648
+ }
649
+ },
650
+ onClick: toggleIsExpanded,
651
+ size: "small",
652
+ "aria-label": isExpanded ? 'hide sidebar' : 'expand sidebar',
653
+ "aria-expanded": isExpanded,
654
+ children: /*#__PURE__*/ jsx(ToggleIcon, {})
655
+ })
656
+ ]
657
+ });
658
+ };
659
+ const getContentAnimation = (width)=>{
660
+ const showAnimation = /*#__PURE__*/ keyframes("from{opacity:0}80%{opacity:0}to{opacity:1}");
661
+ const openAnimation = /*#__PURE__*/ keyframes("from{width:50px}to{width:", width, "px}");
662
+ return {
663
+ open: `${openAnimation} .2s cubic-bezier(0, 0, 0.2, 1)`,
664
+ show: `${showAnimation} .25s linear`
665
+ };
666
+ };
667
+ const Content$1 = /*#__PURE__*/ forwardRef(function Content(param, ref) {
668
+ let { disableResize, openPanelId, closable = true, onClose, onResizeStart, onResizeStop, width, minWidth, maxWidth, destroyInactivePanels = false, children, dangerouslyAppendEmotionCSS, enableCompact, resizeBoxStyle, noSideBorder, hideResizeHandle, componentId } = param;
669
+ const { theme } = useDesignSystemTheme();
670
+ const isCompact = useMediaQuery({
671
+ query: `not (min-width: ${theme.responsive.breakpoints.sm}px)`
672
+ }) && enableCompact;
673
+ const defaultAnimation = useMemo(()=>getContentAnimation(isCompact ? DEFAULT_WIDTH : width || DEFAULT_WIDTH), [
674
+ isCompact,
675
+ width
676
+ ]);
677
+ // specifically for non closable panel in compact mode
678
+ const [isExpanded, setIsExpanded] = useState(true);
679
+ // hide the panel in compact mode when the panel is not closable and collapsed
680
+ const isNotExpandedStyle = /*#__PURE__*/ css(isCompact && !closable && !isExpanded && {
681
+ display: 'none'
682
+ });
683
+ const sidebarContext = useContext(SidebarContext);
684
+ const onCloseRef = useRef(onClose);
685
+ const resizeHandleStyle = sidebarContext.position === 'right' ? {
686
+ left: 0
687
+ } : {
688
+ right: 0
689
+ };
690
+ const [dragging, setDragging] = useState(false);
691
+ const isPanelClosed = openPanelId == null;
692
+ const [animation, setAnimation] = useState(isPanelClosed ? defaultAnimation : undefined);
693
+ const compactStyle = /*#__PURE__*/ css(isCompact && {
694
+ position: 'absolute',
695
+ zIndex: COMPACT_CONTENT_Z_INDEX,
696
+ left: sidebarContext.position === 'left' && closable ? '100%' : undefined,
697
+ right: sidebarContext.position === 'right' && closable ? '100%' : undefined,
698
+ borderRight: sidebarContext.position === 'left' && !noSideBorder ? `1px solid ${theme.colors.border}` : undefined,
699
+ borderLeft: sidebarContext.position === 'right' && !noSideBorder ? `1px solid ${theme.colors.border}` : undefined,
700
+ backgroundColor: theme.colors.backgroundPrimary,
701
+ width: DEFAULT_WIDTH,
702
+ // shift to the top due to border
703
+ top: -1
704
+ });
705
+ const hiddenPanelStyle = /*#__PURE__*/ css(isPanelClosed && {
706
+ display: 'none'
707
+ });
708
+ const containerStyle = /*#__PURE__*/ css({
709
+ animation: animation?.open,
710
+ direction: sidebarContext.position === 'right' ? 'rtl' : 'ltr',
711
+ position: 'relative',
712
+ borderWidth: sidebarContext.position === 'right' ? `0 ${noSideBorder ? 0 : theme.general.borderWidth}px 0 0 ` : `0 0 0 ${noSideBorder ? 0 : theme.general.borderWidth}px`,
713
+ borderStyle: 'inherit',
714
+ borderColor: 'inherit',
715
+ boxSizing: 'content-box'
716
+ });
717
+ const highlightedBorderStyle = sidebarContext.position === 'right' ? /*#__PURE__*/ css({
718
+ borderLeft: `2px solid ${theme.colors.actionDefaultBorderHover}`
719
+ }) : /*#__PURE__*/ css({
720
+ borderRight: `2px solid ${theme.colors.actionDefaultBorderHover}`
721
+ });
722
+ useEffect(()=>{
723
+ onCloseRef.current = onClose;
724
+ }, [
725
+ onClose
726
+ ]);
727
+ // For non closable panel, reset expanded state to true so that the panel stays open
728
+ // the next time the screen goes into compact mode.
729
+ useEffect(()=>{
730
+ if (!closable && enableCompact && !isCompact) {
731
+ setIsExpanded(true);
732
+ }
733
+ }, [
734
+ isCompact,
735
+ closable,
736
+ defaultAnimation,
737
+ enableCompact
738
+ ]);
739
+ const value = useMemo(()=>({
740
+ openPanelId,
741
+ closable,
742
+ destroyInactivePanels,
743
+ setIsClosed: ()=>{
744
+ onCloseRef.current?.();
745
+ if (!animation) {
746
+ setAnimation(defaultAnimation);
747
+ }
748
+ }
749
+ }), [
750
+ openPanelId,
751
+ closable,
752
+ defaultAnimation,
753
+ animation,
754
+ destroyInactivePanels
755
+ ]);
756
+ return /*#__PURE__*/ jsx(ContentContext.Provider, {
757
+ value: value,
758
+ children: disableResize || isCompact ? /*#__PURE__*/ jsxs(Fragment, {
759
+ children: [
760
+ /*#__PURE__*/ jsx("div", {
761
+ css: [
762
+ /*#__PURE__*/ css({
763
+ width: width || '100%',
764
+ height: '100%',
765
+ overflow: 'hidden'
766
+ }, containerStyle, compactStyle),
767
+ dangerouslyAppendEmotionCSS,
768
+ hiddenPanelStyle,
769
+ isNotExpandedStyle
770
+ ],
771
+ "aria-hidden": isPanelClosed,
772
+ children: /*#__PURE__*/ jsx("div", {
773
+ css: {
774
+ opacity: 1,
775
+ height: '100%',
776
+ animation: animation?.show,
777
+ direction: 'ltr'
778
+ },
779
+ children: children
780
+ })
781
+ }),
782
+ !closable && isCompact && /*#__PURE__*/ jsx("div", {
783
+ css: {
784
+ width: !isExpanded ? theme.spacing.md : undefined,
785
+ marginRight: isExpanded ? theme.spacing.md : undefined,
786
+ position: 'relative'
787
+ },
788
+ children: /*#__PURE__*/ jsx(ToggleButton, {
789
+ componentId: componentId ? `${componentId}.toggle` : 'sidebar-toggle',
790
+ isExpanded: isExpanded,
791
+ position: sidebarContext.position || 'left',
792
+ toggleIsExpanded: ()=>setIsExpanded((prev)=>!prev)
793
+ })
794
+ })
795
+ ]
796
+ }) : /*#__PURE__*/ jsxs(Fragment, {
797
+ children: [
798
+ dragging && /*#__PURE__*/ jsx(Global, {
799
+ styles: [
800
+ {
801
+ 'body, :host': {
802
+ userSelect: 'none'
803
+ }
804
+ }
805
+ ]
806
+ }),
807
+ /*#__PURE__*/ jsx(ResizableBox, {
808
+ style: resizeBoxStyle,
809
+ width: width || DEFAULT_WIDTH,
810
+ height: undefined,
811
+ axis: "x",
812
+ resizeHandles: sidebarContext.position === 'right' ? [
813
+ 'w'
814
+ ] : [
815
+ 'e'
816
+ ],
817
+ minConstraints: [
818
+ minWidth ?? DEFAULT_WIDTH,
819
+ 150
820
+ ],
821
+ maxConstraints: [
822
+ maxWidth ?? 800,
823
+ 150
824
+ ],
825
+ onResizeStart: (_, param)=>{
826
+ let { size } = param;
827
+ onResizeStart?.(size.width);
828
+ setDragging(true);
829
+ },
830
+ onResizeStop: (_, param)=>{
831
+ let { size } = param;
832
+ onResizeStop?.(size.width);
833
+ setDragging(false);
834
+ },
835
+ handle: hideResizeHandle ? // Passing null shows default handle from react-resizable
836
+ /*#__PURE__*/ jsx(Fragment, {}) : /*#__PURE__*/ jsx(ResizablePanelHandle, {
837
+ css: /*#__PURE__*/ css({
838
+ width: 10,
839
+ height: '100%',
840
+ position: 'absolute',
841
+ top: 0,
842
+ cursor: sidebarContext.position === 'right' ? 'w-resize' : 'e-resize',
843
+ '&:hover': highlightedBorderStyle,
844
+ ...resizeHandleStyle
845
+ }, dragging && highlightedBorderStyle)
846
+ }),
847
+ css: [
848
+ containerStyle,
849
+ hiddenPanelStyle
850
+ ],
851
+ "aria-hidden": isPanelClosed,
852
+ children: /*#__PURE__*/ jsx("div", {
853
+ ref: ref,
854
+ css: [
855
+ {
856
+ opacity: 1,
857
+ animation: animation?.show,
858
+ direction: 'ltr',
859
+ height: '100%'
860
+ },
861
+ dangerouslyAppendEmotionCSS
862
+ ],
863
+ children: children
864
+ })
865
+ })
866
+ ]
867
+ })
868
+ });
869
+ });
870
+ function Panel(param) {
871
+ let { panelId, children, forceRender = false, dangerouslyAppendEmotionCSS, ...delegated } = param;
872
+ const { openPanelId, destroyInactivePanels } = useContext(ContentContext);
873
+ const hasOpenedPanelRef = useRef(false);
874
+ const isPanelOpen = openPanelId === panelId;
875
+ if (isPanelOpen && !hasOpenedPanelRef.current) {
876
+ hasOpenedPanelRef.current = true;
877
+ }
878
+ if ((destroyInactivePanels || !hasOpenedPanelRef.current) && !isPanelOpen && !forceRender) return null;
879
+ return /*#__PURE__*/ jsx("div", {
880
+ css: [
881
+ {
882
+ display: 'flex',
883
+ height: '100%',
884
+ flexDirection: 'column'
885
+ },
886
+ dangerouslyAppendEmotionCSS,
887
+ !isPanelOpen && {
888
+ display: 'none'
889
+ }
890
+ ],
891
+ "aria-hidden": !isPanelOpen,
892
+ ...delegated,
893
+ children: children
894
+ });
895
+ }
896
+ function PanelHeader(param) {
897
+ let { children, dangerouslyAppendEmotionCSS, componentId } = param;
898
+ const { theme } = useDesignSystemTheme();
899
+ const contentContext = useContext(ContentContext);
900
+ return /*#__PURE__*/ jsxs("div", {
901
+ css: [
902
+ {
903
+ display: 'flex',
904
+ paddingLeft: 8,
905
+ paddingRight: 4,
906
+ alignItems: 'center',
907
+ minHeight: theme.general.heightSm,
908
+ justifyContent: 'space-between',
909
+ fontWeight: theme.typography.typographyBoldFontWeight,
910
+ color: theme.colors.textPrimary
911
+ },
912
+ dangerouslyAppendEmotionCSS
913
+ ],
914
+ children: [
915
+ /*#__PURE__*/ jsx("div", {
916
+ css: {
917
+ width: contentContext.closable ? `calc(100% - ${theme.spacing.lg}px)` : '100%'
918
+ },
919
+ children: /*#__PURE__*/ jsx(Typography.Title, {
920
+ level: 4,
921
+ css: {
922
+ display: 'flex',
923
+ justifyContent: 'space-between',
924
+ alignItems: 'center',
925
+ '&&': {
926
+ margin: 0
927
+ }
928
+ },
929
+ children: children
930
+ })
931
+ }),
932
+ contentContext.closable ? /*#__PURE__*/ jsx("div", {
933
+ children: /*#__PURE__*/ jsx(Button, {
934
+ componentId: componentId ? `${componentId}.close` : 'codegen_design-system_src_design-system_sidebar_sidebar.tsx_427',
935
+ size: "small",
936
+ icon: /*#__PURE__*/ jsx(CloseIcon, {}),
937
+ "aria-label": "Close",
938
+ onClick: ()=>{
939
+ contentContext.setIsClosed();
940
+ }
941
+ })
942
+ }) : null
943
+ ]
944
+ });
945
+ }
946
+ function PanelHeaderTitle(param) {
947
+ let { title, dangerouslyAppendEmotionCSS } = param;
948
+ return /*#__PURE__*/ jsx("div", {
949
+ title: title,
950
+ css: [
951
+ {
952
+ alignSelf: 'center',
953
+ whiteSpace: 'nowrap',
954
+ overflow: 'hidden',
955
+ textOverflow: 'ellipsis'
956
+ },
957
+ dangerouslyAppendEmotionCSS
958
+ ],
959
+ children: title
960
+ });
961
+ }
962
+ function PanelHeaderButtons(param) {
963
+ let { children, dangerouslyAppendEmotionCSS } = param;
964
+ const { theme } = useDesignSystemTheme();
965
+ return /*#__PURE__*/ jsx("div", {
966
+ css: [
967
+ {
968
+ display: 'flex',
969
+ alignItems: 'center',
970
+ gap: theme.spacing.xs,
971
+ paddingRight: theme.spacing.xs
972
+ },
973
+ dangerouslyAppendEmotionCSS
974
+ ],
975
+ children: children
976
+ });
977
+ }
978
+ function PanelBody(param) {
979
+ let { children, dangerouslyAppendEmotionCSS } = param;
980
+ const { theme } = useDesignSystemTheme();
981
+ const [shouldBeFocusable, setShouldBeFocusable] = useState(false);
982
+ const bodyRef = useRef(null);
983
+ useEffect(()=>{
984
+ const ref = bodyRef.current;
985
+ if (ref) {
986
+ if (ref.scrollHeight > ref.clientHeight) {
987
+ setShouldBeFocusable(true);
988
+ } else {
989
+ setShouldBeFocusable(false);
990
+ }
991
+ }
992
+ }, []);
993
+ return /*#__PURE__*/ jsx("div", {
994
+ ref: bodyRef,
995
+ // Needed to make panel body content focusable when scrollable for keyboard-only users to be able to focus & scroll
996
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
997
+ tabIndex: shouldBeFocusable ? 0 : -1,
998
+ css: [
999
+ {
1000
+ height: '100%',
1001
+ overflowX: 'hidden',
1002
+ overflowY: 'auto',
1003
+ padding: '0 8px',
1004
+ colorScheme: theme.isDarkMode ? 'dark' : 'light'
1005
+ },
1006
+ dangerouslyAppendEmotionCSS
1007
+ ],
1008
+ children: children
1009
+ });
1010
+ }
1011
+ const Sidebar = /* #__PURE__ */ (()=>{
1012
+ function Sidebar(param) {
1013
+ let { position, children, dangerouslyAppendEmotionCSS, ...dataProps } = param;
1014
+ const { theme } = useDesignSystemTheme();
1015
+ const { useNewBorderColors } = useDesignSystemSafexFlags();
1016
+ const value = useMemo(()=>{
1017
+ return {
1018
+ position: position || 'left'
1019
+ };
1020
+ }, [
1021
+ position
1022
+ ]);
1023
+ return /*#__PURE__*/ jsx(SidebarContext.Provider, {
1024
+ value: value,
1025
+ children: /*#__PURE__*/ jsx("div", {
1026
+ ...addDebugOutlineIfEnabled(),
1027
+ ...dataProps,
1028
+ css: [
1029
+ {
1030
+ display: 'flex',
1031
+ height: '100%',
1032
+ backgroundColor: theme.colors.backgroundPrimary,
1033
+ flexDirection: position === 'right' ? 'row-reverse' : 'row',
1034
+ borderStyle: 'solid',
1035
+ borderColor: useNewBorderColors ? theme.colors.border : theme.colors.borderDecorative,
1036
+ borderWidth: position === 'right' ? `0 0 0 ${theme.general.borderWidth}px` : `0px ${theme.general.borderWidth}px 0 0`,
1037
+ boxSizing: 'content-box',
1038
+ position: 'relative'
1039
+ },
1040
+ dangerouslyAppendEmotionCSS
1041
+ ],
1042
+ children: children
1043
+ })
1044
+ });
1045
+ }
1046
+ Sidebar.Content = Content$1;
1047
+ Sidebar.Nav = Nav;
1048
+ Sidebar.NavButton = NavButton;
1049
+ Sidebar.Panel = Panel;
1050
+ Sidebar.PanelHeader = PanelHeader;
1051
+ Sidebar.PanelHeaderTitle = PanelHeaderTitle;
1052
+ Sidebar.PanelHeaderButtons = PanelHeaderButtons;
1053
+ Sidebar.PanelBody = PanelBody;
1054
+ return Sidebar;
1055
+ })();
1056
+
1057
+ function Stepper(param) {
1058
+ let { direction: requestedDirection, currentStepIndex: currentStep, steps, localizeStepNumber, responsive = true, onStepClicked } = param;
1059
+ const { theme } = useDesignSystemTheme();
1060
+ const ref = useRef(null);
1061
+ const { direction } = useResponsiveDirection({
1062
+ ref,
1063
+ requestedDirection,
1064
+ responsive,
1065
+ enabled: steps.length > 0
1066
+ });
1067
+ if (steps.length === 0) {
1068
+ return null;
1069
+ }
1070
+ const isHorizontal = direction === 'horizontal';
1071
+ const currentStepIndex = currentStep ? Math.min(steps.length - 1, Math.max(0, currentStep)) : 0;
1072
+ return /*#__PURE__*/ jsx("ol", {
1073
+ ...addDebugOutlineIfEnabled(),
1074
+ css: /*#__PURE__*/ css(getStepsStyle(theme, isHorizontal)),
1075
+ ref: ref,
1076
+ children: steps.map((step, index)=>{
1077
+ const isCurrentStep = index === currentStepIndex;
1078
+ const isLastStep = index === steps.length - 1;
1079
+ const displayEndingDivider = !isLastStep;
1080
+ const contentTitleLevel = 4;
1081
+ const StepIcon = step.icon;
1082
+ const clickEnabled = step.clickEnabled && onStepClicked;
1083
+ const { icon, iconBackgroundColor, iconTextColor, titleTextColor, titleAsParagraph, descriptionTextColor, hasStepItemIconBorder, stepItemIconBorderColor } = getStepContentStyleFields(theme, isCurrentStep, step.status, StepIcon, step.additionalVerticalContent);
1084
+ return /*#__PURE__*/ jsx("li", {
1085
+ "aria-current": isCurrentStep,
1086
+ css: css(getStepItemStyle(theme, isHorizontal, isLastStep)),
1087
+ ...step.status === 'error' && {
1088
+ 'data-error': true
1089
+ },
1090
+ ...step.status === 'loading' && {
1091
+ 'data-loading': true
1092
+ },
1093
+ children: /*#__PURE__*/ jsxs(StepContentGrid, {
1094
+ isHorizontal: isHorizontal,
1095
+ children: [
1096
+ /*#__PURE__*/ jsx("div", {
1097
+ css: css(getStepItemIconParentStyle(theme, iconBackgroundColor, hasStepItemIconBorder, stepItemIconBorderColor, Boolean(clickEnabled))),
1098
+ onClick: clickEnabled ? ()=>onStepClicked(index) : undefined,
1099
+ children: StepIcon ? /*#__PURE__*/ jsx(StepIcon, {
1100
+ statusColor: iconTextColor,
1101
+ status: step.status
1102
+ }) : icon ? /*#__PURE__*/ jsx("span", {
1103
+ css: {
1104
+ color: iconTextColor,
1105
+ display: 'flex'
1106
+ },
1107
+ children: icon
1108
+ }) : /*#__PURE__*/ jsx(Typography.Title, {
1109
+ level: contentTitleLevel,
1110
+ css: {
1111
+ color: `${iconTextColor} !important`
1112
+ },
1113
+ withoutMargins: true,
1114
+ children: localizeStepNumber(index + 1)
1115
+ })
1116
+ }),
1117
+ /*#__PURE__*/ jsx("span", {
1118
+ onClick: clickEnabled ? ()=>onStepClicked(index) : undefined,
1119
+ onKeyDown: (event)=>{
1120
+ if (event.key === 'Enter' && clickEnabled) {
1121
+ onStepClicked(index);
1122
+ }
1123
+ },
1124
+ css: {
1125
+ cursor: clickEnabled ? 'pointer' : undefined
1126
+ },
1127
+ tabIndex: clickEnabled ? 0 : undefined,
1128
+ role: clickEnabled ? 'button' : undefined,
1129
+ children: titleAsParagraph ? /*#__PURE__*/ jsx(Typography.Text, {
1130
+ withoutMargins: true,
1131
+ css: {
1132
+ flexShrink: 0,
1133
+ color: `${titleTextColor} !important`
1134
+ },
1135
+ children: step.title
1136
+ }) : /*#__PURE__*/ jsx(Typography.Title, {
1137
+ level: 4,
1138
+ withoutMargins: true,
1139
+ css: {
1140
+ flexShrink: 0,
1141
+ color: `${titleTextColor} !important`
1142
+ },
1143
+ children: step.title
1144
+ })
1145
+ }),
1146
+ displayEndingDivider && /*#__PURE__*/ jsx("div", {
1147
+ css: css(getStepEndingDividerStyles(theme, isHorizontal, step.status === 'completed'))
1148
+ }),
1149
+ (step.description || step.additionalVerticalContent && !isHorizontal) && /*#__PURE__*/ jsxs("div", {
1150
+ css: css(getStepDescriptionStyles(theme, isHorizontal, isLastStep, descriptionTextColor)),
1151
+ children: [
1152
+ step.description && /*#__PURE__*/ jsx(Typography.Text, {
1153
+ css: css(getStepDescriptionTextStyles(descriptionTextColor)),
1154
+ withoutMargins: true,
1155
+ size: "sm",
1156
+ children: step.description
1157
+ }),
1158
+ step.additionalVerticalContent && !isHorizontal && /*#__PURE__*/ jsx("div", {
1159
+ css: css(getAdditionalVerticalStepContentStyles(theme, Boolean(step.description))),
1160
+ children: step.additionalVerticalContent
1161
+ })
1162
+ ]
1163
+ })
1164
+ ]
1165
+ })
1166
+ }, index);
1167
+ })
1168
+ });
1169
+ }
1170
+ function getStepsStyle(theme, isHorizontal) {
1171
+ return /*#__PURE__*/ css({
1172
+ listStyle: 'none',
1173
+ display: 'flex',
1174
+ flexDirection: isHorizontal ? 'row' : 'column',
1175
+ flexWrap: 'wrap',
1176
+ alignItems: 'flex-start',
1177
+ gap: isHorizontal ? theme.spacing.sm : theme.spacing.xs,
1178
+ width: '100%',
1179
+ margin: '0',
1180
+ padding: '0'
1181
+ });
1182
+ }
1183
+ function getStepItemStyle(theme, isHorizontal, isLastStep) {
1184
+ return /*#__PURE__*/ css({
1185
+ flexDirection: 'column',
1186
+ alignItems: 'center',
1187
+ justifyContent: 'flex-start',
1188
+ flexGrow: isLastStep ? 0 : 1,
1189
+ marginRight: isLastStep && isHorizontal ? theme.spacing.lg + theme.spacing.md : 0,
1190
+ width: isHorizontal ? undefined : '100%'
1191
+ });
1192
+ }
1193
+ function getStepContentStyleFields(theme, isCurrentStep, status, icon, additionalVerticalContent) {
1194
+ const fields = getStepContentStyleFieldsFromStatus(theme, isCurrentStep, status, !isUndefined(additionalVerticalContent));
1195
+ if (icon) {
1196
+ return {
1197
+ ...fields,
1198
+ icon: undefined,
1199
+ iconBackgroundColor: undefined,
1200
+ iconTextColor: getCustomIconColor(theme, isCurrentStep, status),
1201
+ hasStepItemIconBorder: false
1202
+ };
1203
+ }
1204
+ return fields;
1205
+ }
1206
+ function getCustomIconColor(theme, isCurrentStep, status) {
1207
+ switch(status){
1208
+ case 'completed':
1209
+ return theme.colors.actionLinkDefault;
1210
+ case 'loading':
1211
+ return theme.colors.textPlaceholder;
1212
+ case 'error':
1213
+ return theme.colors.textValidationDanger;
1214
+ case 'warning':
1215
+ return theme.colors.textValidationWarning;
1216
+ default:
1217
+ case 'upcoming':
1218
+ return isCurrentStep ? theme.colors.actionLinkDefault : theme.colors.textPlaceholder;
1219
+ }
1220
+ }
1221
+ function getStepContentStyleFieldsFromStatus(theme, isCurrentStep, status, hasAdditionalVerticalContent) {
1222
+ switch(status){
1223
+ case 'completed':
1224
+ return {
1225
+ icon: /*#__PURE__*/ jsx(CheckIcon, {}),
1226
+ iconBackgroundColor: isCurrentStep ? theme.colors.actionLinkDefault : theme.isDarkMode ? theme.colors.blue800 : theme.colors.blue100,
1227
+ iconTextColor: isCurrentStep ? theme.colors.white : theme.colors.actionLinkDefault,
1228
+ titleAsParagraph: false,
1229
+ titleTextColor: theme.colors.actionLinkDefault,
1230
+ descriptionTextColor: theme.colors.textSecondary,
1231
+ hasStepItemIconBorder: true,
1232
+ stepItemIconBorderColor: theme.colors.actionDefaultBackgroundPress
1233
+ };
1234
+ case 'loading':
1235
+ return {
1236
+ icon: /*#__PURE__*/ jsx(LoadingIcon, {
1237
+ spin: true,
1238
+ css: {
1239
+ fontSize: isCurrentStep ? theme.typography.fontSizeXl : theme.typography.fontSizeLg
1240
+ }
1241
+ }),
1242
+ iconBackgroundColor: undefined,
1243
+ iconTextColor: theme.colors.textPlaceholder,
1244
+ titleAsParagraph: false,
1245
+ titleTextColor: isCurrentStep ? theme.colors.textPrimary : theme.colors.textSecondary,
1246
+ descriptionTextColor: theme.colors.textSecondary,
1247
+ hasStepItemIconBorder: false
1248
+ };
1249
+ case 'error':
1250
+ return {
1251
+ icon: /*#__PURE__*/ jsx(DangerIcon, {}),
1252
+ iconBackgroundColor: isCurrentStep ? theme.colors.textValidationDanger : theme.colors.backgroundDanger,
1253
+ iconTextColor: isCurrentStep ? theme.colors.white : theme.colors.textValidationDanger,
1254
+ titleAsParagraph: false,
1255
+ titleTextColor: theme.colors.textValidationDanger,
1256
+ descriptionTextColor: theme.colors.textValidationDanger,
1257
+ hasStepItemIconBorder: true,
1258
+ stepItemIconBorderColor: theme.colors.borderDanger
1259
+ };
1260
+ case 'warning':
1261
+ return {
1262
+ icon: /*#__PURE__*/ jsx(WarningIcon, {}),
1263
+ iconBackgroundColor: isCurrentStep ? theme.colors.textValidationWarning : theme.colors.backgroundWarning,
1264
+ iconTextColor: isCurrentStep ? theme.colors.white : theme.colors.textValidationWarning,
1265
+ titleAsParagraph: false,
1266
+ titleTextColor: theme.colors.textValidationWarning,
1267
+ descriptionTextColor: theme.colors.textValidationWarning,
1268
+ hasStepItemIconBorder: true,
1269
+ stepItemIconBorderColor: theme.colors.borderWarning
1270
+ };
1271
+ default:
1272
+ case 'upcoming':
1273
+ if (isCurrentStep) {
1274
+ return {
1275
+ icon: undefined,
1276
+ iconBackgroundColor: theme.colors.actionLinkDefault,
1277
+ iconTextColor: 'white',
1278
+ titleAsParagraph: false,
1279
+ titleTextColor: theme.colors.actionLinkDefault,
1280
+ descriptionTextColor: hasAdditionalVerticalContent ? theme.colors.textSecondary : theme.colors.textPrimary,
1281
+ hasStepItemIconBorder: false
1282
+ };
1283
+ }
1284
+ return {
1285
+ icon: undefined,
1286
+ iconBackgroundColor: undefined,
1287
+ iconTextColor: theme.colors.textPlaceholder,
1288
+ titleAsParagraph: true,
1289
+ titleTextColor: theme.colors.textSecondary,
1290
+ descriptionTextColor: theme.colors.textSecondary,
1291
+ hasStepItemIconBorder: true,
1292
+ stepItemIconBorderColor: theme.colors.border
1293
+ };
1294
+ }
1295
+ }
1296
+ const MaxHorizontalStepDescriptionWidth = 140;
1297
+ const StepIconSize = DEFAULT_SPACING_UNIT * 4;
1298
+ function getStepItemIconParentStyle(theme, iconBackgroundColor, hasStepItemIconBorder, stepItemIconBorderColor, clickEnabled) {
1299
+ return /*#__PURE__*/ css({
1300
+ width: StepIconSize,
1301
+ height: StepIconSize,
1302
+ backgroundColor: iconBackgroundColor,
1303
+ borderRadius: theme.borders.borderRadiusFull,
1304
+ display: 'flex',
1305
+ justifyContent: 'center',
1306
+ alignItems: 'center',
1307
+ fontSize: '20px',
1308
+ flexShrink: 0,
1309
+ border: hasStepItemIconBorder ? `1px solid ${stepItemIconBorderColor ?? theme.colors.textPlaceholder}` : undefined,
1310
+ boxSizing: 'border-box',
1311
+ cursor: clickEnabled ? 'pointer' : undefined
1312
+ });
1313
+ }
1314
+ function getStepEndingDividerStyles(theme, isHorizontal, isCompleted) {
1315
+ const backgroundColor = isCompleted ? theme.colors.actionLinkDefault : theme.colors.border;
1316
+ if (isHorizontal) {
1317
+ return /*#__PURE__*/ css({
1318
+ backgroundColor,
1319
+ height: '1px',
1320
+ width: '100%',
1321
+ minWidth: theme.spacing.md
1322
+ });
1323
+ }
1324
+ return /*#__PURE__*/ css({
1325
+ backgroundColor,
1326
+ height: '100%',
1327
+ minHeight: theme.spacing.lg,
1328
+ width: '1px',
1329
+ alignSelf: 'flex-start',
1330
+ marginLeft: theme.spacing.md
1331
+ });
1332
+ }
1333
+ function getStepDescriptionStyles(theme, isHorizontal, isLastStep, textColor) {
1334
+ return /*#__PURE__*/ css({
1335
+ alignSelf: 'flex-start',
1336
+ width: '100%',
1337
+ gridColumn: isHorizontal || isLastStep ? '2 / span 2' : undefined,
1338
+ maxWidth: isHorizontal ? MaxHorizontalStepDescriptionWidth : undefined,
1339
+ paddingBottom: isHorizontal ? undefined : theme.spacing.sm,
1340
+ color: `${textColor} !important`
1341
+ });
1342
+ }
1343
+ function getStepDescriptionTextStyles(textColor) {
1344
+ return /*#__PURE__*/ css({
1345
+ color: `${textColor} !important`
1346
+ });
1347
+ }
1348
+ function getAdditionalVerticalStepContentStyles(theme, addTopPadding) {
1349
+ return /*#__PURE__*/ css({
1350
+ paddingTop: addTopPadding ? theme.spacing.sm : 0
1351
+ });
1352
+ }
1353
+ function StepContentGrid(param) {
1354
+ let { children, isHorizontal } = param;
1355
+ const { theme } = useDesignSystemTheme();
1356
+ if (isHorizontal) {
1357
+ return /*#__PURE__*/ jsx("div", {
1358
+ css: {
1359
+ display: 'grid',
1360
+ gridTemplateColumns: `${StepIconSize}px fit-content(100%) 1fr`,
1361
+ gridTemplateRows: `${StepIconSize}px auto`,
1362
+ alignItems: 'center',
1363
+ justifyItems: 'flex-start',
1364
+ gridColumnGap: theme.spacing.sm,
1365
+ width: '100%'
1366
+ },
1367
+ children: children
1368
+ });
1369
+ }
1370
+ return /*#__PURE__*/ jsx("div", {
1371
+ css: {
1372
+ display: 'grid',
1373
+ gridTemplateColumns: `${StepIconSize}px minmax(0, 1fr)`,
1374
+ alignItems: 'center',
1375
+ justifyItems: 'flex-start',
1376
+ gridColumnGap: theme.spacing.sm,
1377
+ gridRowGap: theme.spacing.xs,
1378
+ width: '100%',
1379
+ '& > :first-child': {
1380
+ // horizontally center the first column (circle/icon)
1381
+ justifySelf: 'center'
1382
+ }
1383
+ },
1384
+ children: children
1385
+ });
1386
+ }
1387
+ // Ant design uses the same value for their stepper and to works well for us as well.
1388
+ const MinimumHorizonalDirectionWidth = 532;
1389
+ // exported for unit test
1390
+ function useResponsiveDirection(param) {
1391
+ let { requestedDirection = 'horizontal', responsive, enabled, ref } = param;
1392
+ const [direction, setDirection] = useState(requestedDirection);
1393
+ useEffect(()=>{
1394
+ if (requestedDirection === 'vertical' || !enabled || !responsive || !ref.current) {
1395
+ return;
1396
+ }
1397
+ let timeoutId;
1398
+ const resizeObserver = new ResizeObserver((entries)=>{
1399
+ timeoutId = requestAnimationFrame(()=>{
1400
+ if (entries.length === 1) {
1401
+ const width = entries[0].target.clientWidth || 0;
1402
+ setDirection(width < MinimumHorizonalDirectionWidth ? 'vertical' : 'horizontal');
1403
+ }
1404
+ });
1405
+ });
1406
+ if (ref.current) {
1407
+ resizeObserver.observe(ref.current);
1408
+ }
1409
+ return ()=>{
1410
+ resizeObserver.disconnect();
1411
+ cancelAnimationFrame(timeoutId);
1412
+ };
1413
+ }, [
1414
+ requestedDirection,
1415
+ enabled,
1416
+ ref,
1417
+ responsive
1418
+ ]);
1419
+ return {
1420
+ direction
1421
+ };
1422
+ }
1423
+
1424
+ const isInsideTest = ()=>typeof jest !== 'undefined';
1425
+
1426
+ const useTooltipStyles = (param)=>{
1427
+ let { maxWidth } = param;
1428
+ const { theme, classNamePrefix: clsPrefix } = useDesignSystemTheme();
1429
+ const { useNewShadows } = useDesignSystemSafexFlags();
1430
+ const classTypography = `.${clsPrefix}-typography`;
1431
+ const { isDarkMode } = theme;
1432
+ const slideUpAndFade = /*#__PURE__*/ keyframes({
1433
+ from: {
1434
+ opacity: 0,
1435
+ transform: 'translateY(2px)'
1436
+ },
1437
+ to: {
1438
+ opacity: 1,
1439
+ transform: 'translateY(0)'
1440
+ }
1441
+ });
1442
+ const slideRightAndFade = /*#__PURE__*/ keyframes({
1443
+ from: {
1444
+ opacity: 0,
1445
+ transform: 'translateX(-2px)'
1446
+ },
1447
+ to: {
1448
+ opacity: 1,
1449
+ transform: 'translateX(0)'
1450
+ }
1451
+ });
1452
+ const slideDownAndFade = /*#__PURE__*/ keyframes({
1453
+ from: {
1454
+ opacity: 0,
1455
+ transform: 'translateY(-2px)'
1456
+ },
1457
+ to: {
1458
+ opacity: 1,
1459
+ transform: 'translateY(0)'
1460
+ }
1461
+ });
1462
+ const slideLeftAndFade = /*#__PURE__*/ keyframes({
1463
+ from: {
1464
+ opacity: 0,
1465
+ transform: 'translateX(2px)'
1466
+ },
1467
+ to: {
1468
+ opacity: 1,
1469
+ transform: 'translateX(0)'
1470
+ }
1471
+ });
1472
+ const linkColor = isDarkMode ? theme.colors.blue600 : theme.colors.blue500;
1473
+ const linkActiveColor = isDarkMode ? theme.colors.blue800 : theme.colors.blue300;
1474
+ const linkHoverColor = isDarkMode ? theme.colors.blue700 : theme.colors.blue400;
1475
+ return {
1476
+ content: {
1477
+ backgroundColor: theme.colors.tooltipBackgroundTooltip,
1478
+ color: theme.colors.actionPrimaryTextDefault,
1479
+ borderRadius: theme.borders.borderRadiusSm,
1480
+ fontSize: theme.typography.fontSizeMd,
1481
+ padding: `${theme.spacing.xs}px ${theme.spacing.sm}px`,
1482
+ lineHeight: theme.typography.lineHeightLg,
1483
+ fontWeight: theme.typography.typographyRegularFontWeight,
1484
+ boxShadow: useNewShadows ? theme.shadows.lg : theme.general.shadowHigh,
1485
+ maxWidth: maxWidth,
1486
+ wordWrap: 'break-word',
1487
+ whiteSpace: 'normal',
1488
+ zIndex: theme.options.zIndexBase + 70,
1489
+ willChange: 'transform, opacity',
1490
+ "&[data-state='delayed-open'][data-side='top']": {
1491
+ animation: `${slideDownAndFade} 400ms cubic-bezier(0.16, 1, 0.3, 1)`
1492
+ },
1493
+ "&[data-state='delayed-open'][data-side='right']": {
1494
+ animation: `${slideLeftAndFade} 400ms cubic-bezier(0.16, 1, 0.3, 1)`
1495
+ },
1496
+ "&[data-state='delayed-open'][data-side='bottom']": {
1497
+ animation: `${slideUpAndFade} 400ms cubic-bezier(0.16, 1, 0.3, 1)`
1498
+ },
1499
+ "&[data-state='delayed-open'][data-side='left']": {
1500
+ animation: `${slideRightAndFade} 400ms cubic-bezier(0.16, 1, 0.3, 1)`
1501
+ },
1502
+ [`& a${classTypography}`]: {
1503
+ '&, :focus': {
1504
+ color: linkColor,
1505
+ '.anticon': {
1506
+ color: linkColor
1507
+ }
1508
+ },
1509
+ ':active': {
1510
+ color: linkActiveColor,
1511
+ '.anticon': {
1512
+ color: linkActiveColor
1513
+ }
1514
+ },
1515
+ ':hover': {
1516
+ color: linkHoverColor,
1517
+ '.anticon': {
1518
+ color: linkHoverColor
1519
+ }
1520
+ }
1521
+ }
1522
+ },
1523
+ arrow: {
1524
+ fill: theme.colors.tooltipBackgroundTooltip,
1525
+ zIndex: theme.options.zIndexBase + 70,
1526
+ visibility: 'visible'
1527
+ }
1528
+ };
1529
+ };
1530
+ /**
1531
+ * If the tooltip is not displaying for you, it might be because the child does not accept the onMouseEnter, onMouseLeave, onPointerEnter,
1532
+ * onPointerLeave, onFocus, and onClick props. You can add these props to your child component, or wrap it in a `<span>` tag.
1533
+ *
1534
+ * See go/dubois.
1535
+ */ const Tooltip = (param)=>{
1536
+ let { children, content, defaultOpen = false, delayDuration = 350, side = 'top', sideOffset = 4, align = 'center', maxWidth = 250, componentId, analyticsEvents = [
1537
+ DesignSystemEventProviderAnalyticsEventTypes.OnView
1538
+ ], open, onOpenChange, zIndex, ...props } = param;
1539
+ const { theme } = useDesignSystemTheme();
1540
+ const { getPopupContainer } = useDesignSystemContext();
1541
+ const tooltipStyles = useTooltipStyles({
1542
+ maxWidth
1543
+ });
1544
+ const memoizedAnalyticsEvents = useMemo(()=>analyticsEvents, [
1545
+ analyticsEvents
1546
+ ]);
1547
+ const eventContext = useDesignSystemEventComponentCallbacks({
1548
+ componentType: DesignSystemEventProviderComponentTypes.Tooltip,
1549
+ componentId,
1550
+ analyticsEvents: memoizedAnalyticsEvents
1551
+ });
1552
+ const firstView = useRef(true);
1553
+ const handleOpenChange = useCallback((open)=>{
1554
+ if (open && firstView.current) {
1555
+ eventContext.onView();
1556
+ firstView.current = false;
1557
+ }
1558
+ onOpenChange?.(open);
1559
+ }, [
1560
+ eventContext,
1561
+ firstView,
1562
+ onOpenChange
1563
+ ]);
1564
+ const IS_INSIDE_TEST = isInsideTest();
1565
+ return /*#__PURE__*/ jsxs(RadixTooltip.Root, {
1566
+ defaultOpen: defaultOpen,
1567
+ delayDuration: IS_INSIDE_TEST ? 10 : delayDuration,
1568
+ open: open,
1569
+ onOpenChange: handleOpenChange,
1570
+ children: [
1571
+ /*#__PURE__*/ jsx(RadixTooltip.Trigger, {
1572
+ asChild: true,
1573
+ children: children
1574
+ }),
1575
+ content ? /*#__PURE__*/ jsx(RadixTooltip.Portal, {
1576
+ container: getPopupContainer && getPopupContainer(),
1577
+ children: /*#__PURE__*/ jsxs(RadixTooltip.Content, {
1578
+ side: side,
1579
+ align: align,
1580
+ sideOffset: theme.spacing.sm,
1581
+ arrowPadding: theme.spacing.md,
1582
+ css: [
1583
+ tooltipStyles['content'],
1584
+ zIndex ? {
1585
+ zIndex
1586
+ } : undefined
1587
+ ],
1588
+ ...props,
1589
+ ...eventContext.dataComponentProps,
1590
+ children: [
1591
+ content,
1592
+ /*#__PURE__*/ jsx(RadixTooltip.Arrow, {
1593
+ css: tooltipStyles['arrow']
1594
+ })
1595
+ ]
1596
+ })
1597
+ }) : null
1598
+ ]
1599
+ });
1600
+ };
1601
+
1602
+ function useStepperStepsFromWizardSteps(wizardSteps, currentStepIdx, hideDescriptionForFutureSteps) {
1603
+ return useMemo(()=>wizardSteps.map((wizardStep, stepIdx)=>({
1604
+ ...pick(wizardStep, [
1605
+ 'title',
1606
+ 'status'
1607
+ ]),
1608
+ description: hideDescriptionForFutureSteps && !(stepIdx <= currentStepIdx || wizardStep.status === 'completed' || wizardStep.status === 'error' || wizardStep.status === 'warning') ? undefined : wizardStep.description,
1609
+ additionalVerticalContent: wizardStep.additionalHorizontalLayoutStepContent,
1610
+ clickEnabled: isUndefined(wizardStep.clickEnabled) ? isWizardStepEnabled(wizardSteps, stepIdx, currentStepIdx, wizardStep.status) : wizardStep.clickEnabled
1611
+ })), [
1612
+ currentStepIdx,
1613
+ hideDescriptionForFutureSteps,
1614
+ wizardSteps
1615
+ ]);
1616
+ }
1617
+ function isWizardStepEnabled(steps, stepIdx, currentStepIdx, status) {
1618
+ if (stepIdx < currentStepIdx || status === 'completed' || status === 'error' || status === 'warning') {
1619
+ return true;
1620
+ }
1621
+ // if every step before stepIdx is completed then the step is enabled
1622
+ return steps.slice(0, stepIdx).every((step)=>step.status === 'completed');
1623
+ }
1624
+
1625
+ function HorizontalWizardStepsContent(param) {
1626
+ let { steps: wizardSteps, currentStepIndex, localizeStepNumber, enableClickingToSteps, goToStep, hideDescriptionForFutureSteps = false } = param;
1627
+ const { theme } = useDesignSystemTheme();
1628
+ const stepperSteps = useStepperStepsFromWizardSteps(wizardSteps, currentStepIndex, hideDescriptionForFutureSteps);
1629
+ const expandContentToFullHeight = wizardSteps[currentStepIndex].expandContentToFullHeight ?? true;
1630
+ const disableDefaultScrollBehavior = wizardSteps[currentStepIndex].disableDefaultScrollBehavior ?? false;
1631
+ return /*#__PURE__*/ jsxs(Fragment, {
1632
+ children: [
1633
+ /*#__PURE__*/ jsx(Stepper, {
1634
+ currentStepIndex: currentStepIndex,
1635
+ direction: "horizontal",
1636
+ localizeStepNumber: localizeStepNumber,
1637
+ steps: stepperSteps,
1638
+ responsive: false,
1639
+ onStepClicked: enableClickingToSteps ? goToStep : undefined
1640
+ }),
1641
+ /*#__PURE__*/ jsx("div", {
1642
+ css: {
1643
+ marginTop: theme.spacing.md,
1644
+ flexGrow: expandContentToFullHeight ? 1 : undefined,
1645
+ overflowY: disableDefaultScrollBehavior ? 'hidden' : 'auto',
1646
+ ...!disableDefaultScrollBehavior ? getShadowScrollStyles(theme) : {}
1647
+ },
1648
+ children: wizardSteps[currentStepIndex].content
1649
+ })
1650
+ ]
1651
+ });
1652
+ }
1653
+
1654
+ /* eslint-disable react/no-unused-prop-types */ // eslint doesn't like passing props as object through to a function
1655
+ // disabling to avoid a bunch of duplicate code.
1656
+ // Buttons are returned in order with primary button last
1657
+ function getWizardFooterButtons(param) {
1658
+ let { title, goToNextStepOrDone, isLastStep, currentStepIndex, goToPreviousStep, busyValidatingNextStep, nextButtonDisabled, nextButtonLoading, nextButtonContentOverride, previousButtonContentOverride, previousStepButtonHidden, previousButtonDisabled, previousButtonLoading, cancelButtonContent, cancelStepButtonHidden, nextButtonContent, previousButtonContent, doneButtonContent, extraFooterButtonsLeft, extraFooterButtonsRight, onCancel, moveCancelToOtherSide, componentId, tooltipContent } = param;
1659
+ return compact([
1660
+ !cancelStepButtonHidden && (moveCancelToOtherSide ? /*#__PURE__*/ jsx("div", {
1661
+ css: {
1662
+ flexGrow: 1
1663
+ },
1664
+ children: /*#__PURE__*/ jsx(CancelButton, {
1665
+ onCancel: onCancel,
1666
+ cancelButtonContent: cancelButtonContent,
1667
+ componentId: componentId ? `${componentId}.cancel` : undefined
1668
+ })
1669
+ }, "cancel") : /*#__PURE__*/ jsx(CancelButton, {
1670
+ onCancel: onCancel,
1671
+ cancelButtonContent: cancelButtonContent,
1672
+ componentId: componentId ? `${componentId}.cancel` : undefined
1673
+ }, "cancel")),
1674
+ currentStepIndex > 0 && !previousStepButtonHidden && /*#__PURE__*/ jsx(Button, {
1675
+ onClick: goToPreviousStep,
1676
+ type: "tertiary",
1677
+ disabled: previousButtonDisabled,
1678
+ loading: previousButtonLoading,
1679
+ componentId: componentId ? `${componentId}.previous` : 'dubois-wizard-footer-previous',
1680
+ children: previousButtonContentOverride ? previousButtonContentOverride : previousButtonContent
1681
+ }, "previous"),
1682
+ extraFooterButtonsLeft && extraFooterButtonsLeft.map((buttonProps, index)=>/*#__PURE__*/ createElement(ButtonWithTooltip, {
1683
+ ...buttonProps,
1684
+ type: undefined,
1685
+ key: `extra-left-${index}`
1686
+ })),
1687
+ /*#__PURE__*/ jsx(ButtonWithTooltip, {
1688
+ onClick: goToNextStepOrDone,
1689
+ disabled: nextButtonDisabled,
1690
+ tooltipContent: tooltipContent,
1691
+ loading: nextButtonLoading || busyValidatingNextStep,
1692
+ type: (extraFooterButtonsRight?.length ?? 0) > 0 ? undefined : 'primary',
1693
+ componentId: componentId ? `${componentId}.next` : 'dubois-wizard-footer-next',
1694
+ children: nextButtonContentOverride ? nextButtonContentOverride : isLastStep ? doneButtonContent : nextButtonContent
1695
+ }, "next"),
1696
+ extraFooterButtonsRight && extraFooterButtonsRight.map((buttonProps, index)=>/*#__PURE__*/ createElement(ButtonWithTooltip, {
1697
+ ...buttonProps,
1698
+ type: index === extraFooterButtonsRight.length - 1 ? 'primary' : undefined,
1699
+ key: `extra-right-${index}`
1700
+ }))
1701
+ ]);
1702
+ }
1703
+ function CancelButton(param) {
1704
+ let { onCancel, cancelButtonContent, componentId } = param;
1705
+ return /*#__PURE__*/ jsx(Button, {
1706
+ onClick: onCancel,
1707
+ type: "tertiary",
1708
+ componentId: componentId ?? 'dubois-wizard-footer-cancel',
1709
+ children: cancelButtonContent
1710
+ }, "cancel");
1711
+ }
1712
+ function ButtonWithTooltip(param) {
1713
+ let { tooltipContent, disabled, children, ...props } = param;
1714
+ return tooltipContent ? /*#__PURE__*/ jsx(Tooltip, {
1715
+ componentId: "dubois-wizard-footer-tooltip",
1716
+ content: tooltipContent,
1717
+ children: /*#__PURE__*/ jsx(Button, {
1718
+ ...props,
1719
+ disabled: disabled,
1720
+ children: children
1721
+ })
1722
+ }) : /*#__PURE__*/ jsx(Button, {
1723
+ ...props,
1724
+ disabled: disabled,
1725
+ children: children
1726
+ });
1727
+ }
1728
+
1729
+ function HorizontalWizardContent(param) {
1730
+ let { width, height, steps, currentStepIndex, localizeStepNumber, onStepsChange, enableClickingToSteps, hideDescriptionForFutureSteps, ...footerProps } = param;
1731
+ return /*#__PURE__*/ jsxs("div", {
1732
+ css: {
1733
+ width,
1734
+ height,
1735
+ display: 'flex',
1736
+ flexDirection: 'column',
1737
+ justifyContent: 'flex-start'
1738
+ },
1739
+ ...addDebugOutlineIfEnabled(),
1740
+ children: [
1741
+ /*#__PURE__*/ jsx(HorizontalWizardStepsContent, {
1742
+ steps: steps,
1743
+ currentStepIndex: currentStepIndex,
1744
+ localizeStepNumber: localizeStepNumber,
1745
+ enableClickingToSteps: Boolean(enableClickingToSteps),
1746
+ goToStep: footerProps.goToStep,
1747
+ hideDescriptionForFutureSteps: hideDescriptionForFutureSteps
1748
+ }),
1749
+ /*#__PURE__*/ jsx(Spacer, {
1750
+ size: "lg"
1751
+ }),
1752
+ /*#__PURE__*/ jsx(WizardFooter, {
1753
+ currentStepIndex: currentStepIndex,
1754
+ ...steps[currentStepIndex],
1755
+ ...footerProps,
1756
+ moveCancelToOtherSide: true
1757
+ })
1758
+ ]
1759
+ });
1760
+ }
1761
+ function WizardFooter(props) {
1762
+ const { theme } = useDesignSystemTheme();
1763
+ return /*#__PURE__*/ jsx("div", {
1764
+ css: {
1765
+ display: 'flex',
1766
+ flexDirection: 'row',
1767
+ justifyContent: 'flex-end',
1768
+ columnGap: theme.spacing.sm,
1769
+ paddingTop: theme.spacing.md,
1770
+ paddingBottom: theme.spacing.md,
1771
+ borderTop: `1px solid ${theme.colors.border}`
1772
+ },
1773
+ children: getWizardFooterButtons(props)
1774
+ });
1775
+ }
1776
+
1777
+ function Root(param) {
1778
+ let { children, initialContentId } = param;
1779
+ const [currentContentId, setCurrentContentId] = useState(initialContentId);
1780
+ return /*#__PURE__*/ jsx(DocumentationSideBarContext.Provider, {
1781
+ value: useMemo(()=>({
1782
+ currentContentId,
1783
+ setCurrentContentId
1784
+ }), [
1785
+ currentContentId,
1786
+ setCurrentContentId
1787
+ ]),
1788
+ children: children
1789
+ });
1790
+ }
1791
+ const DocumentationSideBarContext = /*#__PURE__*/ React__default.createContext({
1792
+ currentContentId: undefined,
1793
+ setCurrentContentId: noop
1794
+ });
1795
+ const useDocumentationSidebarContext = ()=>{
1796
+ const context = React__default.useContext(DocumentationSideBarContext);
1797
+ return context;
1798
+ };
1799
+ function Trigger(param) {
1800
+ let { contentId, label, tooltipContent, asChild, children, ...tooltipProps } = param;
1801
+ const { theme } = useDesignSystemTheme();
1802
+ const { setCurrentContentId } = useDocumentationSidebarContext();
1803
+ const triggerProps = useMemo(()=>({
1804
+ onClick: ()=>setCurrentContentId(contentId),
1805
+ [`aria-label`]: label
1806
+ }), [
1807
+ contentId,
1808
+ label,
1809
+ setCurrentContentId
1810
+ ]);
1811
+ const renderAsChild = asChild && /*#__PURE__*/ React__default.isValidElement(children);
1812
+ return /*#__PURE__*/ jsx(Tooltip, {
1813
+ ...tooltipProps,
1814
+ content: tooltipContent,
1815
+ children: renderAsChild ? /*#__PURE__*/ React__default.cloneElement(children, triggerProps) : /*#__PURE__*/ jsx("button", {
1816
+ css: {
1817
+ border: 'none',
1818
+ backgroundColor: 'transparent',
1819
+ padding: 0,
1820
+ display: 'flex',
1821
+ height: 'var(--spacing-md)',
1822
+ alignItems: 'center',
1823
+ cursor: 'pointer'
1824
+ },
1825
+ ...triggerProps,
1826
+ children: /*#__PURE__*/ jsx(InfoSmallIcon, {
1827
+ css: {
1828
+ fontSize: theme.typography.fontSizeSm,
1829
+ color: theme.colors.textSecondary
1830
+ }
1831
+ })
1832
+ })
1833
+ });
1834
+ }
1835
+ function Content(param) {
1836
+ let { title, modalTitleWhenCompact, width, children, closeLabel, displayModalWhenCompact } = param;
1837
+ const { theme } = useDesignSystemTheme();
1838
+ const { currentContentId, setCurrentContentId } = useDocumentationSidebarContext();
1839
+ if (isUndefined(currentContentId)) {
1840
+ return null;
1841
+ }
1842
+ const content = /*#__PURE__*/ React__default.isValidElement(children) ? /*#__PURE__*/ React__default.cloneElement(children, {
1843
+ contentId: currentContentId
1844
+ }) : children;
1845
+ if (displayModalWhenCompact) {
1846
+ return /*#__PURE__*/ jsx(Modal, {
1847
+ componentId: `documentation-side-bar-compact-modal-${currentContentId}`,
1848
+ visible: true,
1849
+ size: "wide",
1850
+ onOk: ()=>setCurrentContentId(undefined),
1851
+ okText: closeLabel,
1852
+ okButtonProps: {
1853
+ type: undefined
1854
+ },
1855
+ onCancel: ()=>setCurrentContentId(undefined),
1856
+ title: modalTitleWhenCompact ?? title,
1857
+ children: content
1858
+ });
1859
+ }
1860
+ return /*#__PURE__*/ jsx(Sidebar, {
1861
+ position: "right",
1862
+ dangerouslyAppendEmotionCSS: {
1863
+ border: 'none'
1864
+ },
1865
+ children: /*#__PURE__*/ jsx(Sidebar.Content, {
1866
+ componentId: `documentation-side-bar-content-${currentContentId}`,
1867
+ openPanelId: 0,
1868
+ closable: true,
1869
+ disableResize: true,
1870
+ enableCompact: true,
1871
+ width: width,
1872
+ children: /*#__PURE__*/ jsx(Sidebar.Panel, {
1873
+ panelId: 0,
1874
+ children: /*#__PURE__*/ jsxs("div", {
1875
+ css: {
1876
+ height: '100%',
1877
+ display: 'flex',
1878
+ flexDirection: 'column',
1879
+ rowGap: theme.spacing.md,
1880
+ borderRadius: theme.legacyBorders.borderRadiusLg,
1881
+ border: `1px solid ${theme.colors.backgroundSecondary}`,
1882
+ padding: `${theme.spacing.md}px ${theme.spacing.lg}px`,
1883
+ backgroundColor: theme.colors.backgroundSecondary
1884
+ },
1885
+ children: [
1886
+ /*#__PURE__*/ jsxs("div", {
1887
+ css: {
1888
+ display: 'flex',
1889
+ flexDirection: 'row',
1890
+ justifyContent: 'space-between',
1891
+ alignItems: 'center',
1892
+ width: '100%'
1893
+ },
1894
+ children: [
1895
+ /*#__PURE__*/ jsx(Typography.Text, {
1896
+ color: "secondary",
1897
+ children: title
1898
+ }),
1899
+ /*#__PURE__*/ jsx(Button, {
1900
+ "aria-label": closeLabel,
1901
+ icon: /*#__PURE__*/ jsx(CloseIcon, {}),
1902
+ componentId: `documentation-side-bar-close-${currentContentId}`,
1903
+ onClick: ()=>setCurrentContentId(undefined)
1904
+ })
1905
+ ]
1906
+ }),
1907
+ content
1908
+ ]
1909
+ })
1910
+ })
1911
+ })
1912
+ });
1913
+ }
1914
+
1915
+ var DocumentationSidebar = /*#__PURE__*/Object.freeze({
1916
+ __proto__: null,
1917
+ Content: Content,
1918
+ Root: Root,
1919
+ Trigger: Trigger,
1920
+ useDocumentationSidebarContext: useDocumentationSidebarContext
1921
+ });
1922
+
1923
+ const SMALL_FIXED_VERTICAL_STEPPER_WIDTH = 240;
1924
+ const FIXED_VERTICAL_STEPPER_WIDTH = 280;
1925
+ const MAX_VERTICAL_WIZARD_CONTENT_WIDTH = 920;
1926
+ const DOCUMENTATION_SIDEBAR_WIDTH = 400;
1927
+ const EXTRA_COMPACT_BUTTON_HEIGHT = 32 + 24; // button height + gap
1928
+ function VerticalWizardContent(param) {
1929
+ let { width, height, steps: wizardSteps, currentStepIndex, localizeStepNumber, onStepsChange, title, padding, verticalCompactButtonContent, enableClickingToSteps, verticalDocumentationSidebarConfig, hideDescriptionForFutureSteps = false, contentMaxWidth, ...footerProps } = param;
1930
+ const { theme } = useDesignSystemTheme();
1931
+ const stepperSteps = useStepperStepsFromWizardSteps(wizardSteps, currentStepIndex, hideDescriptionForFutureSteps);
1932
+ const expandContentToFullHeight = wizardSteps[currentStepIndex].expandContentToFullHeight ?? true;
1933
+ const disableDefaultScrollBehavior = wizardSteps[currentStepIndex].disableDefaultScrollBehavior ?? false;
1934
+ const displayDocumentationSideBar = Boolean(verticalDocumentationSidebarConfig);
1935
+ const Wrapper = displayDocumentationSideBar ? Root : React__default.Fragment;
1936
+ const displayCompactStepper = useMediaQuery({
1937
+ query: `(max-width: ${theme.responsive.breakpoints.lg}px)`
1938
+ }) && Boolean(verticalCompactButtonContent);
1939
+ const displayCompactSidebar = useMediaQuery({
1940
+ query: `(max-width: ${theme.responsive.breakpoints.xxl}px)`
1941
+ });
1942
+ return /*#__PURE__*/ jsx(Wrapper, {
1943
+ ...displayDocumentationSideBar && {
1944
+ initialContentId: verticalDocumentationSidebarConfig?.initialContentId
1945
+ },
1946
+ children: /*#__PURE__*/ jsxs("div", {
1947
+ css: {
1948
+ width,
1949
+ height: expandContentToFullHeight ? height : 'fit-content',
1950
+ maxHeight: '100%',
1951
+ display: 'flex',
1952
+ flexDirection: displayCompactStepper ? 'column' : 'row',
1953
+ gap: theme.spacing.lg,
1954
+ justifyContent: 'center'
1955
+ },
1956
+ ...addDebugOutlineIfEnabled(),
1957
+ children: [
1958
+ !displayCompactStepper && /*#__PURE__*/ jsxs("div", {
1959
+ css: {
1960
+ display: 'flex',
1961
+ flexDirection: 'column',
1962
+ flexShrink: 0,
1963
+ rowGap: theme.spacing.lg,
1964
+ paddingTop: theme.spacing.lg,
1965
+ paddingBottom: theme.spacing.lg,
1966
+ height: 'fit-content',
1967
+ width: SMALL_FIXED_VERTICAL_STEPPER_WIDTH,
1968
+ [`@media (min-width: ${theme.responsive.breakpoints.xl}px)`]: {
1969
+ width: FIXED_VERTICAL_STEPPER_WIDTH
1970
+ },
1971
+ overflowX: 'hidden'
1972
+ },
1973
+ children: [
1974
+ title,
1975
+ /*#__PURE__*/ jsx(Stepper, {
1976
+ currentStepIndex: currentStepIndex,
1977
+ direction: "vertical",
1978
+ localizeStepNumber: localizeStepNumber,
1979
+ steps: stepperSteps,
1980
+ responsive: false,
1981
+ onStepClicked: enableClickingToSteps ? footerProps.goToStep : undefined
1982
+ })
1983
+ ]
1984
+ }),
1985
+ displayCompactStepper && /*#__PURE__*/ jsxs(Root$1, {
1986
+ componentId: "codegen_design-system_src_~patterns_wizard_verticalwizardcontent.tsx_93",
1987
+ children: [
1988
+ /*#__PURE__*/ jsx(Trigger$1, {
1989
+ asChild: true,
1990
+ children: /*#__PURE__*/ jsx("div", {
1991
+ children: /*#__PURE__*/ jsx(Button, {
1992
+ icon: /*#__PURE__*/ jsx(ListIcon, {}),
1993
+ componentId: "dubois-wizard-vertical-compact-show-stepper-popover",
1994
+ children: verticalCompactButtonContent?.(currentStepIndex, stepperSteps.length)
1995
+ })
1996
+ })
1997
+ }),
1998
+ /*#__PURE__*/ jsx(Content$2, {
1999
+ align: "start",
2000
+ side: "bottom",
2001
+ css: {
2002
+ padding: theme.spacing.md
2003
+ },
2004
+ children: /*#__PURE__*/ jsx(Stepper, {
2005
+ currentStepIndex: currentStepIndex,
2006
+ direction: "vertical",
2007
+ localizeStepNumber: localizeStepNumber,
2008
+ steps: stepperSteps,
2009
+ responsive: false,
2010
+ onStepClicked: enableClickingToSteps ? footerProps.goToStep : undefined
2011
+ })
2012
+ })
2013
+ ]
2014
+ }),
2015
+ /*#__PURE__*/ jsxs("div", {
2016
+ css: {
2017
+ display: 'flex',
2018
+ flexDirection: 'column',
2019
+ columnGap: theme.spacing.lg,
2020
+ border: `1px solid ${theme.colors.border}`,
2021
+ borderRadius: theme.legacyBorders.borderRadiusLg,
2022
+ flexGrow: 1,
2023
+ padding: padding ?? theme.spacing.lg,
2024
+ height: displayCompactStepper ? `calc(100% - ${EXTRA_COMPACT_BUTTON_HEIGHT}px)` : '100%',
2025
+ maxWidth: contentMaxWidth ?? MAX_VERTICAL_WIZARD_CONTENT_WIDTH
2026
+ },
2027
+ children: [
2028
+ /*#__PURE__*/ jsx("div", {
2029
+ css: {
2030
+ flexGrow: expandContentToFullHeight ? 1 : undefined,
2031
+ overflowY: disableDefaultScrollBehavior ? 'hidden' : 'auto',
2032
+ ...!disableDefaultScrollBehavior ? getShadowScrollStyles(theme) : {},
2033
+ borderRadius: theme.legacyBorders.borderRadiusLg
2034
+ },
2035
+ children: wizardSteps[currentStepIndex].content
2036
+ }),
2037
+ /*#__PURE__*/ jsx("div", {
2038
+ css: {
2039
+ display: 'flex',
2040
+ flexDirection: 'row',
2041
+ justifyContent: 'flex-end',
2042
+ columnGap: theme.spacing.sm,
2043
+ ...padding !== undefined && {
2044
+ padding: theme.spacing.lg
2045
+ },
2046
+ paddingTop: theme.spacing.md
2047
+ },
2048
+ children: getWizardFooterButtons({
2049
+ currentStepIndex: currentStepIndex,
2050
+ ...wizardSteps[currentStepIndex],
2051
+ ...footerProps,
2052
+ moveCancelToOtherSide: true
2053
+ })
2054
+ })
2055
+ ]
2056
+ }),
2057
+ displayDocumentationSideBar && verticalDocumentationSidebarConfig && /*#__PURE__*/ jsx(Content, {
2058
+ width: displayCompactSidebar ? undefined : DOCUMENTATION_SIDEBAR_WIDTH,
2059
+ title: verticalDocumentationSidebarConfig.title,
2060
+ modalTitleWhenCompact: verticalDocumentationSidebarConfig.modalTitleWhenCompact,
2061
+ closeLabel: verticalDocumentationSidebarConfig.closeLabel,
2062
+ displayModalWhenCompact: displayCompactSidebar,
2063
+ children: verticalDocumentationSidebarConfig.content
2064
+ })
2065
+ ]
2066
+ })
2067
+ });
2068
+ }
2069
+
2070
+ function useWizardCurrentStep(param) {
2071
+ let { currentStepIndex, setCurrentStepIndex, totalSteps, onValidateStepChange, onStepChanged } = param;
2072
+ const [busyValidatingNextStep, setBusyValidatingNextStep] = useState(false);
2073
+ const isLastStep = useMemo(()=>currentStepIndex === totalSteps - 1, [
2074
+ currentStepIndex,
2075
+ totalSteps
2076
+ ]);
2077
+ const onStepsChange = useCallback(async function(step) {
2078
+ let completed = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
2079
+ if (!completed && step === currentStepIndex) return;
2080
+ setCurrentStepIndex(step);
2081
+ onStepChanged({
2082
+ step,
2083
+ completed
2084
+ });
2085
+ }, [
2086
+ currentStepIndex,
2087
+ onStepChanged,
2088
+ setCurrentStepIndex
2089
+ ]);
2090
+ const goToNextStepOrDone = useCallback(async ()=>{
2091
+ if (onValidateStepChange) {
2092
+ setBusyValidatingNextStep(true);
2093
+ try {
2094
+ const approvedStepChange = await onValidateStepChange(currentStepIndex);
2095
+ if (!approvedStepChange) {
2096
+ return;
2097
+ }
2098
+ } finally{
2099
+ setBusyValidatingNextStep(false);
2100
+ }
2101
+ }
2102
+ onStepsChange(Math.min(currentStepIndex + 1, totalSteps - 1), isLastStep);
2103
+ }, [
2104
+ currentStepIndex,
2105
+ isLastStep,
2106
+ onStepsChange,
2107
+ onValidateStepChange,
2108
+ totalSteps
2109
+ ]);
2110
+ const goToPreviousStep = useCallback(()=>{
2111
+ if (currentStepIndex > 0) {
2112
+ onStepsChange(currentStepIndex - 1);
2113
+ }
2114
+ }, [
2115
+ currentStepIndex,
2116
+ onStepsChange
2117
+ ]);
2118
+ const goToStep = useCallback((step)=>{
2119
+ if (step > -1 && step < totalSteps) {
2120
+ onStepsChange(step);
2121
+ }
2122
+ }, [
2123
+ onStepsChange,
2124
+ totalSteps
2125
+ ]);
2126
+ return {
2127
+ busyValidatingNextStep,
2128
+ isLastStep,
2129
+ onStepsChange,
2130
+ goToNextStepOrDone,
2131
+ goToPreviousStep,
2132
+ goToStep
2133
+ };
2134
+ }
2135
+
2136
+ function Wizard(param) {
2137
+ let { steps, onStepChanged, onValidateStepChange, initialStep, ...props } = param;
2138
+ const [currentStepIndex, setCurrentStepIndex] = useState(initialStep ?? 0);
2139
+ const currentStepProps = useWizardCurrentStep({
2140
+ currentStepIndex,
2141
+ setCurrentStepIndex,
2142
+ totalSteps: steps.length,
2143
+ onStepChanged,
2144
+ onValidateStepChange
2145
+ });
2146
+ return /*#__PURE__*/ jsx(WizardControlled, {
2147
+ ...currentStepProps,
2148
+ currentStepIndex: currentStepIndex,
2149
+ initialStep: initialStep,
2150
+ steps: steps,
2151
+ onStepChanged: onStepChanged,
2152
+ ...props
2153
+ });
2154
+ }
2155
+ function WizardControlled(param) {
2156
+ let { initialStep = 0, layout = 'vertical', width = '100%', height = '100%', steps, title, ...restOfProps } = param;
2157
+ if (steps.length === 0 || !isUndefined(initialStep) && (initialStep < 0 || initialStep >= steps.length)) {
2158
+ return null;
2159
+ }
2160
+ if (layout === 'vertical') {
2161
+ return /*#__PURE__*/ jsx(VerticalWizardContent, {
2162
+ width: width,
2163
+ height: height,
2164
+ steps: steps,
2165
+ title: title,
2166
+ ...restOfProps
2167
+ });
2168
+ }
2169
+ return /*#__PURE__*/ jsx(HorizontalWizardContent, {
2170
+ width: width,
2171
+ height: height,
2172
+ steps: steps,
2173
+ ...restOfProps
2174
+ });
2175
+ }
2176
+
2177
+ function WizardModal(param) {
2178
+ let { onStepChanged, onCancel, initialStep, steps, onModalClose, localizeStepNumber, cancelButtonContent, nextButtonContent, previousButtonContent, doneButtonContent, enableClickingToSteps, ...modalProps } = param;
2179
+ const [currentStepIndex, setCurrentStepIndex] = useState(initialStep ?? 0);
2180
+ const { onStepsChange, isLastStep, ...footerActions } = useWizardCurrentStep({
2181
+ currentStepIndex,
2182
+ setCurrentStepIndex,
2183
+ totalSteps: steps.length,
2184
+ onStepChanged
2185
+ });
2186
+ if (steps.length === 0 || !isUndefined(initialStep) && (initialStep < 0 || initialStep >= steps.length)) {
2187
+ return null;
2188
+ }
2189
+ const footerButtons = getWizardFooterButtons({
2190
+ onCancel,
2191
+ isLastStep,
2192
+ currentStepIndex,
2193
+ doneButtonContent,
2194
+ previousButtonContent,
2195
+ nextButtonContent,
2196
+ cancelButtonContent,
2197
+ ...footerActions,
2198
+ ...steps[currentStepIndex]
2199
+ });
2200
+ return /*#__PURE__*/ jsx(Modal, {
2201
+ ...modalProps,
2202
+ onCancel: onModalClose,
2203
+ size: "wide",
2204
+ footer: footerButtons,
2205
+ children: /*#__PURE__*/ jsx(HorizontalWizardStepsContent, {
2206
+ steps: steps,
2207
+ currentStepIndex: currentStepIndex,
2208
+ localizeStepNumber: localizeStepNumber,
2209
+ enableClickingToSteps: Boolean(enableClickingToSteps),
2210
+ goToStep: footerActions.goToStep
2211
+ })
2212
+ });
2213
+ }
2214
+
2215
+ function WizardStepContentWrapper(param) {
2216
+ let { header, title, description, alertContent, children } = param;
2217
+ const { theme } = useDesignSystemTheme();
2218
+ return /*#__PURE__*/ jsxs("div", {
2219
+ css: {
2220
+ display: 'flex',
2221
+ flexDirection: 'column',
2222
+ height: '100%'
2223
+ },
2224
+ children: [
2225
+ /*#__PURE__*/ jsxs("div", {
2226
+ style: {
2227
+ backgroundColor: theme.colors.backgroundSecondary,
2228
+ padding: theme.spacing.lg,
2229
+ display: 'flex',
2230
+ flexDirection: 'column',
2231
+ borderTopLeftRadius: theme.legacyBorders.borderRadiusLg,
2232
+ borderTopRightRadius: theme.legacyBorders.borderRadiusLg
2233
+ },
2234
+ children: [
2235
+ /*#__PURE__*/ jsx(Typography.Text, {
2236
+ size: "sm",
2237
+ style: {
2238
+ fontWeight: 500
2239
+ },
2240
+ children: header
2241
+ }),
2242
+ /*#__PURE__*/ jsx(Typography.Title, {
2243
+ withoutMargins: true,
2244
+ style: {
2245
+ paddingTop: theme.spacing.lg
2246
+ },
2247
+ level: 3,
2248
+ children: title
2249
+ }),
2250
+ /*#__PURE__*/ jsx(Typography.Text, {
2251
+ color: "secondary",
2252
+ children: description
2253
+ })
2254
+ ]
2255
+ }),
2256
+ alertContent && /*#__PURE__*/ jsx("div", {
2257
+ css: {
2258
+ padding: `${theme.spacing.lg}px ${theme.spacing.lg}px 0`
2259
+ },
2260
+ children: alertContent
2261
+ }),
2262
+ /*#__PURE__*/ jsx("div", {
2263
+ css: {
2264
+ display: 'flex',
2265
+ flexDirection: 'column',
2266
+ height: '100%',
2267
+ padding: `${theme.spacing.lg}px ${theme.spacing.lg}px 0`,
2268
+ overflowY: 'auto',
2269
+ ...getShadowScrollStyles(theme)
2270
+ },
2271
+ children: children
2272
+ })
2273
+ ]
2274
+ });
2275
+ }
2276
+
2277
+ export { CheckIcon as C, DocumentationSidebar as D, FIXED_VERTICAL_STEPPER_WIDTH as F, InfoSmallIcon as I, ListIcon as L, MAX_VERTICAL_WIZARD_CONTENT_WIDTH as M, Nav as N, Panel as P, Spacer as S, Tooltip as T, Wizard as W, WizardControlled as a, WizardModal as b, WizardStepContentWrapper as c, Modal as d, useModalContext as e, DangerModal as f, NavButton as g, Content$1 as h, PanelHeader as i, PanelHeaderTitle as j, PanelHeaderButtons as k, PanelBody as l, Sidebar as m, Stepper as n, useWizardCurrentStep as u };
2278
+ //# sourceMappingURL=WizardStepContentWrapper-CzvxVy-w.js.map