@cloudscape-design/components-themeable 3.0.1212 → 3.0.1213

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 (45) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
  3. package/lib/internal/scss/wizard/styles.scss +21 -6
  4. package/lib/internal/template/button-dropdown/internal.js +1 -1
  5. package/lib/internal/template/button-dropdown/internal.js.map +1 -1
  6. package/lib/internal/template/date-picker/index.js +1 -1
  7. package/lib/internal/template/date-picker/index.js.map +1 -1
  8. package/lib/internal/template/date-range-picker/dropdown.d.ts +2 -2
  9. package/lib/internal/template/date-range-picker/dropdown.d.ts.map +1 -1
  10. package/lib/internal/template/date-range-picker/dropdown.js +2 -2
  11. package/lib/internal/template/date-range-picker/dropdown.js.map +1 -1
  12. package/lib/internal/template/date-range-picker/index.js +2 -2
  13. package/lib/internal/template/date-range-picker/index.js.map +1 -1
  14. package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
  15. package/lib/internal/template/internal/components/dropdown/index.d.ts +1 -1
  16. package/lib/internal/template/internal/components/dropdown/index.d.ts.map +1 -1
  17. package/lib/internal/template/internal/components/dropdown/index.js +35 -6
  18. package/lib/internal/template/internal/components/dropdown/index.js.map +1 -1
  19. package/lib/internal/template/internal/components/dropdown/interfaces.d.ts +19 -2
  20. package/lib/internal/template/internal/components/dropdown/interfaces.d.ts.map +1 -1
  21. package/lib/internal/template/internal/components/dropdown/interfaces.js.map +1 -1
  22. package/lib/internal/template/internal/environment.js +2 -2
  23. package/lib/internal/template/internal/environment.json +2 -2
  24. package/lib/internal/template/wizard/internal.d.ts.map +1 -1
  25. package/lib/internal/template/wizard/internal.js +6 -2
  26. package/lib/internal/template/wizard/internal.js.map +1 -1
  27. package/lib/internal/template/wizard/styles.css.js +30 -30
  28. package/lib/internal/template/wizard/styles.scoped.css +76 -63
  29. package/lib/internal/template/wizard/styles.selectors.js +30 -30
  30. package/lib/internal/template/wizard/wizard-form.d.ts +0 -1
  31. package/lib/internal/template/wizard/wizard-form.d.ts.map +1 -1
  32. package/lib/internal/template/wizard/wizard-form.js +1 -4
  33. package/lib/internal/template/wizard/wizard-form.js.map +1 -1
  34. package/lib/internal/template/wizard/wizard-navigation.d.ts.map +1 -1
  35. package/lib/internal/template/wizard/wizard-navigation.js +13 -86
  36. package/lib/internal/template/wizard/wizard-navigation.js.map +1 -1
  37. package/lib/internal/template/wizard/wizard-step-list.d.ts +27 -0
  38. package/lib/internal/template/wizard/wizard-step-list.d.ts.map +1 -0
  39. package/lib/internal/template/wizard/wizard-step-list.js +105 -0
  40. package/lib/internal/template/wizard/wizard-step-list.js.map +1 -0
  41. package/lib/internal/template/wizard/wizard-step-navigation-expandable.d.ts +16 -0
  42. package/lib/internal/template/wizard/wizard-step-navigation-expandable.d.ts.map +1 -0
  43. package/lib/internal/template/wizard/wizard-step-navigation-expandable.js +18 -0
  44. package/lib/internal/template/wizard/wizard-step-navigation-expandable.js.map +1 -0
  45. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/index.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAyI7C,QAAA,MAAM,QAAQ,GAAI,8UA2Bf,aAAa,gBAoUf,CAAC;AAMF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/index.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AA+I7C,QAAA,MAAM,QAAQ,GAAI,mXA8Bf,aAAa,gBAyWf,CAAC;AAMF,eAAe,QAAQ,CAAC"}
@@ -29,7 +29,7 @@ const DropdownContainer = ({ triggerRef, children, renderWithPortal, id, referre
29
29
  const currentDocument = (_b = (_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) !== null && _b !== void 0 ? _b : document;
30
30
  return createPortal(React.createElement("div", { id: id, "data-awsui-referrer-id": referrerId }, children), currentDocument.body);
31
31
  };
32
- const TransitionContent = ({ state, transitionRef, dropdownClasses, matchTriggerWidth, hideBlockBorder, interior, isRefresh, dropdownRef, verticalContainerRef, expandToViewport, minWidth, maxWidth, header, content, footer, position, open, onMouseDown, id, ariaRole, ariaLabel, ariaLabelledby, ariaDescribedby, }) => {
32
+ const TransitionContent = ({ state, transitionRef, dropdownClasses, matchTriggerWidth, hideBlockBorder, interior, isRefresh, dropdownRef, verticalContainerRef, expandToViewport, minWidth, maxWidth, header, content, footer, position, open, onMouseDown, onFocusEnter, onFocusLeave, id, ariaRole, ariaLabel, ariaLabelledby, ariaDescribedby, }) => {
33
33
  const contentRef = useMergeRefs(dropdownRef, transitionRef);
34
34
  const dropdownStyles = {};
35
35
  if (minWidth) {
@@ -46,7 +46,7 @@ const TransitionContent = ({ state, transitionRef, dropdownClasses, matchTrigger
46
46
  [styles.refresh]: isRefresh,
47
47
  [styles['use-portal']]: expandToViewport && !interior,
48
48
  [styles['use-flexible-width']]: !matchTriggerWidth && !interior,
49
- }), ref: contentRef, id: id, role: ariaRole, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "data-open": open, "data-animating": state !== 'exited', "aria-hidden": !open, style: dropdownStyles, onMouseDown: onMouseDown },
49
+ }), ref: contentRef, id: id, role: ariaRole, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "data-open": open, "data-animating": state !== 'exited', "aria-hidden": !open, style: dropdownStyles, onMouseDown: onMouseDown, onFocus: onFocusEnter, onBlur: onFocusLeave },
50
50
  React.createElement("div", { className: clsx(styles['dropdown-content-wrapper'], !header && !content && styles['is-empty'], isRefresh && styles.refresh) },
51
51
  React.createElement("div", { ref: verticalContainerRef, className: styles['dropdown-content'] },
52
52
  React.createElement(DropdownContextProvider, { position: position },
@@ -54,7 +54,7 @@ const TransitionContent = ({ state, transitionRef, dropdownClasses, matchTrigger
54
54
  content,
55
55
  footer)))));
56
56
  };
57
- const Dropdown = ({ content, trigger, open, onDropdownClose, onMouseDown, header, footer, dropdownId, stretchTriggerHeight = false, stretchHeight = false, minWidth, maxWidth, hideBlockBorder = true, expandToViewport = false, preferredAlignment = 'start', interior = false, scrollable = true, loopFocus = expandToViewport, onFocus, onBlur, contentKey, dropdownContentId, ariaRole, ariaLabel, ariaLabelledby, ariaDescribedby, }) => {
57
+ const Dropdown = ({ content, trigger, open, onOutsideClick, onMouseDown, header, footer, dropdownId, stretchTriggerHeight = false, stretchHeight = false, minWidth, maxWidth, hideBlockBorder = true, expandToViewport = false, preferredAlignment = 'start', interior = false, scrollable = true, loopFocus = expandToViewport, onFocus, onBlur, onFocusEnter, onFocusLeave, onEscape, contentKey, dropdownContentId, ariaRole, ariaLabel, ariaLabelledby, ariaDescribedby, }) => {
58
58
  const wrapperRef = useRef(null);
59
59
  const triggerRef = useRef(null);
60
60
  const dropdownRef = useRef(null);
@@ -144,6 +144,17 @@ const Dropdown = ({ content, trigger, open, onDropdownClose, onMouseDown, header
144
144
  fireNonCancelableEvent(onBlur, event);
145
145
  }
146
146
  };
147
+ const isOutsideDropdownContent = (element) => !dropdownRef.current || !nodeBelongs(dropdownRef.current, element);
148
+ const focusEnterHandler = (event) => {
149
+ if (!event.relatedTarget || isOutsideDropdownContent(event.relatedTarget)) {
150
+ fireNonCancelableEvent(onFocusEnter, event);
151
+ }
152
+ };
153
+ const focusLeaveHandler = (event) => {
154
+ if (!event.relatedTarget || isOutsideDropdownContent(event.relatedTarget)) {
155
+ fireNonCancelableEvent(onFocusLeave, event);
156
+ }
157
+ };
147
158
  // Check if the dropdown has enough space to fit with its desired width constraints
148
159
  // If not, remove the class that allows flexible width sizing
149
160
  const fixStretching = () => {
@@ -204,14 +215,32 @@ const Dropdown = ({ content, trigger, open, onDropdownClose, onMouseDown, header
204
215
  // shadow root if the component is rendered inside shadow DOM.
205
216
  const target = event.composedPath ? event.composedPath()[0] : event.target;
206
217
  if (!nodeBelongs(dropdownRef.current, target) && !nodeBelongs(triggerRef.current, target)) {
207
- fireNonCancelableEvent(onDropdownClose);
218
+ fireNonCancelableEvent(onOutsideClick);
208
219
  }
209
220
  };
210
221
  window.addEventListener('click', clickListener, true);
211
222
  return () => {
212
223
  window.removeEventListener('click', clickListener, true);
213
224
  };
214
- }, [open, onDropdownClose]);
225
+ }, [open, onOutsideClick]);
226
+ // subscribe to Escape key press
227
+ useEffect(() => {
228
+ // Only add the listener if onEscape callback is provided
229
+ if (!open || !onEscape) {
230
+ return;
231
+ }
232
+ const keydownListener = (event) => {
233
+ if (event.key === 'Escape') {
234
+ // Prevent any surrounding modals or dialogs from acting on this Escape key
235
+ event.stopPropagation();
236
+ fireNonCancelableEvent(onEscape);
237
+ }
238
+ };
239
+ window.addEventListener('keydown', keydownListener, true);
240
+ return () => {
241
+ window.removeEventListener('keydown', keydownListener, true);
242
+ };
243
+ }, [open, onEscape]);
215
244
  // sync dropdown position on scroll and resize
216
245
  useLayoutEffect(() => {
217
246
  if (!expandToViewport || !open) {
@@ -264,7 +293,7 @@ const Dropdown = ({ content, trigger, open, onDropdownClose, onMouseDown, header
264
293
  React.createElement(DropdownContainer, { triggerRef: triggerRef, renderWithPortal: expandToViewport && !interior, id: dropdownId, referrerId: referrerId, open: open },
265
294
  React.createElement(Transition, { in: open !== null && open !== void 0 ? open : false, exit: false }, (state, ref) => (React.createElement("div", { ref: dropdownContainerRef },
266
295
  React.createElement(TabTrap, { focusNextCallback: () => { var _a; return triggerRef.current && ((_a = getLastFocusable(triggerRef.current)) === null || _a === void 0 ? void 0 : _a.focus()); }, disabled: !open || !loopFocus }),
267
- React.createElement(TransitionContent, { state: state, transitionRef: ref, dropdownClasses: dropdownClasses, open: open, matchTriggerWidth: matchTriggerWidth, hideBlockBorder: hideBlockBorder, interior: interior, header: header, content: content, expandToViewport: expandToViewport, minWidth: getMinWidthCssValue(), maxWidth: getMaxWidthCssValue(), footer: footer, onMouseDown: onMouseDown, isRefresh: isRefresh, dropdownRef: dropdownRef, verticalContainerRef: verticalContainerRef, position: position, id: dropdownContentId, ariaRole: ariaRole, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescribedby: ariaDescribedby }),
296
+ React.createElement(TransitionContent, { state: state, transitionRef: ref, dropdownClasses: dropdownClasses, open: open, matchTriggerWidth: matchTriggerWidth, hideBlockBorder: hideBlockBorder, interior: interior, header: header, content: content, expandToViewport: expandToViewport, minWidth: getMinWidthCssValue(), maxWidth: getMaxWidthCssValue(), footer: footer, onMouseDown: onMouseDown, onFocusEnter: focusEnterHandler, onFocusLeave: focusLeaveHandler, isRefresh: isRefresh, dropdownRef: dropdownRef, verticalContainerRef: verticalContainerRef, position: position, id: dropdownContentId, ariaRole: ariaRole, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescribedby: ariaDescribedby }),
268
297
  React.createElement(TabTrap, { focusNextCallback: () => { var _a; return triggerRef.current && ((_a = getFirstFocusable(triggerRef.current)) === null || _a === void 0 ? void 0 : _a.focus()); }, disabled: !open || !loopFocus })))))));
269
298
  };
270
299
  const isInteriorPosition = (position) => position.insetBlockEnd !== undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC7G,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;A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AAI,IAAI,CAAC,SAAS,GAC7B,CACE,CACP,CACU,CACK,CAChB,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CACzB,QAAqD,EACf,EAAE,CAAE,QAAqC,CAAC,aAAa,KAAK,SAAS,CAAC;AAE9G,eAAe,QAAQ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useResizeObserver, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { getLogicalBoundingClientRect } from '@cloudscape-design/component-toolkit/internal';\n\nimport { fireNonCancelableEvent } from '../../events';\nimport customCssProps from '../../generated/custom-css-properties';\nimport { useMobile } from '../../hooks/use-mobile';\nimport { usePortalModeClasses } from '../../hooks/use-portal-mode-classes';\nimport { useVisualRefresh } from '../../hooks/use-visual-mode';\nimport { nodeBelongs } from '../../utils/node-belongs';\nimport { getFirstFocusable, getLastFocusable } from '../focus-lock/utils.js';\nimport TabTrap from '../tab-trap/index.js';\nimport { Transition, TransitionStatus } from '../transition';\nimport { DropdownContextProvider, DropdownContextProviderProps } from './context';\nimport {\n calculatePosition,\n DropdownPosition,\n hasEnoughSpaceForFlexibleWidth,\n InteriorDropdownPosition,\n} from './dropdown-fit-handler';\nimport { applyDropdownPositionRelativeToViewport, LogicalDOMRect } from './dropdown-position';\nimport { DropdownProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface DropdownContainerProps {\n triggerRef: React.RefObject<HTMLElement>;\n children?: React.ReactNode;\n renderWithPortal: boolean;\n id?: string;\n referrerId?: string;\n open?: boolean;\n}\n\nconst DropdownContainer = ({\n triggerRef,\n children,\n renderWithPortal,\n id,\n referrerId,\n open,\n}: DropdownContainerProps) => {\n if (!renderWithPortal) {\n return <>{children}</>;\n }\n if (!open) {\n return null;\n }\n const currentDocument = triggerRef.current?.ownerDocument ?? document;\n return createPortal(\n <div id={id} data-awsui-referrer-id={referrerId}>\n {children}\n </div>,\n currentDocument.body\n );\n};\n\ninterface TransitionContentProps {\n state: TransitionStatus;\n transitionRef: React.MutableRefObject<any>;\n dropdownClasses: string;\n matchTriggerWidth: boolean;\n hideBlockBorder: boolean;\n interior: boolean;\n isRefresh: boolean;\n dropdownRef: React.RefObject<HTMLDivElement>;\n verticalContainerRef: React.RefObject<HTMLDivElement>;\n expandToViewport?: boolean;\n minWidth?: string;\n maxWidth?: string;\n header?: React.ReactNode;\n content?: React.ReactNode;\n footer?: React.ReactNode;\n position?: DropdownContextProviderProps['position'];\n open?: boolean;\n onMouseDown?: React.MouseEventHandler<Element>;\n id?: string;\n ariaRole?: string;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n}\n\nconst TransitionContent = ({\n state,\n transitionRef,\n dropdownClasses,\n matchTriggerWidth,\n hideBlockBorder,\n interior,\n isRefresh,\n dropdownRef,\n verticalContainerRef,\n expandToViewport,\n minWidth,\n maxWidth,\n header,\n content,\n footer,\n position,\n open,\n onMouseDown,\n id,\n ariaRole,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n}: TransitionContentProps) => {\n const contentRef = useMergeRefs(dropdownRef, transitionRef);\n const dropdownStyles: Record<string, string> = {};\n if (minWidth) {\n dropdownStyles[customCssProps.dropdownDefaultMinWidth] = minWidth;\n }\n if (maxWidth) {\n dropdownStyles[customCssProps.dropdownDefaultMaxWidth] = maxWidth;\n }\n return (\n <div\n className={clsx(styles.dropdown, dropdownClasses, {\n [styles.open]: open,\n [styles['with-limited-width']]: !matchTriggerWidth,\n [styles['hide-block-border']]: hideBlockBorder,\n [styles.interior]: interior,\n [styles.refresh]: isRefresh,\n [styles['use-portal']]: expandToViewport && !interior,\n [styles['use-flexible-width']]: !matchTriggerWidth && !interior,\n })}\n ref={contentRef}\n id={id}\n role={ariaRole}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n data-open={open}\n data-animating={state !== 'exited'}\n aria-hidden={!open}\n style={dropdownStyles}\n onMouseDown={onMouseDown}\n >\n <div\n className={clsx(\n styles['dropdown-content-wrapper'],\n !header && !content && styles['is-empty'],\n isRefresh && styles.refresh\n )}\n >\n <div ref={verticalContainerRef} className={styles['dropdown-content']}>\n <DropdownContextProvider position={position}>\n {header}\n {content}\n {footer}\n </DropdownContextProvider>\n </div>\n </div>\n </div>\n );\n};\n\nconst Dropdown = ({\n content,\n trigger,\n open,\n onDropdownClose,\n onMouseDown,\n header,\n footer,\n dropdownId,\n stretchTriggerHeight = false,\n stretchHeight = false,\n minWidth,\n maxWidth,\n hideBlockBorder = true,\n expandToViewport = false,\n preferredAlignment = 'start',\n interior = false,\n scrollable = true,\n loopFocus = expandToViewport,\n onFocus,\n onBlur,\n contentKey,\n dropdownContentId,\n ariaRole,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n}: DropdownProps) => {\n const wrapperRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLDivElement | null>(null);\n const dropdownRef = useRef<HTMLDivElement | null>(null);\n const dropdownContainerRef = useRef<HTMLDivElement | null>(null);\n const verticalContainerRef = useRef<HTMLDivElement>(null);\n // To keep track of the initial position (drop up/down) which is kept the same during fixed repositioning\n const fixedPosition = useRef<DropdownPosition | null>(null);\n\n const isRefresh = useVisualRefresh();\n\n const dropdownClasses = usePortalModeClasses(triggerRef);\n const [position, setPosition] = useState<DropdownContextProviderProps['position']>('bottom-right');\n\n const isMobile = useMobile();\n\n // Derive if dropdown should match trigger width exactly\n // This happens when both minWidth and maxWidth are explicitly set to 'trigger'\n const matchTriggerWidth = minWidth === 'trigger' && maxWidth === 'trigger';\n\n // Convert preferredAlignment to boolean for internal positioning logic\n const preferCenter = preferredAlignment === 'center';\n\n const setDropdownPosition = (\n position: DropdownPosition | InteriorDropdownPosition,\n triggerBox: LogicalDOMRect,\n target: HTMLDivElement,\n verticalContainer: HTMLDivElement\n ) => {\n verticalContainer.style.maxBlockSize = position.blockSize;\n\n // Only apply occupy-entire-width when matching trigger width exactly and not in portal mode\n if (!interior && matchTriggerWidth && !expandToViewport) {\n target.classList.add(styles['occupy-entire-width']);\n } else {\n target.style.inlineSize = position.inlineSize;\n }\n\n // Using styles for main dropdown to adjust its position as preferred alternative\n if (position.dropBlockStart && !interior) {\n target.classList.add(styles['dropdown-drop-up']);\n if (!expandToViewport) {\n target.style.insetBlockEnd = '100%';\n }\n } else {\n target.classList.remove(styles['dropdown-drop-up']);\n }\n target.classList.add(position.dropInlineStart ? styles['dropdown-drop-left'] : styles['dropdown-drop-right']);\n\n if (position.insetInlineStart && position.insetInlineStart !== 'auto') {\n target.style.insetInlineStart = position.insetInlineStart;\n }\n\n // Position normal overflow dropdowns with fixed positioning relative to viewport\n if (expandToViewport && !interior) {\n applyDropdownPositionRelativeToViewport({\n position,\n dropdownElement: target,\n triggerRect: triggerBox,\n isMobile,\n });\n // Keep track of the initial dropdown position and direction.\n // Dropdown direction doesn't need to change as the user scrolls, just needs to stay attached to the trigger.\n fixedPosition.current = position;\n return;\n }\n\n // For an interior dropdown (the fly out) we need exact values for positioning\n // and classes are not enough\n // usage of relative position is impossible due to overwrite of overflow-x\n if (interior && isInteriorPosition(position)) {\n if (position.dropBlockStart) {\n target.style.insetBlockEnd = position.insetBlockEnd;\n } else {\n target.style.insetBlockStart = position.insetBlockStart;\n }\n target.style.insetInlineStart = position.insetInlineStart;\n }\n\n if (position.dropBlockStart && position.dropInlineStart) {\n setPosition('top-left');\n } else if (position.dropBlockStart) {\n setPosition('top-right');\n } else if (position.dropInlineStart) {\n setPosition('bottom-left');\n } else {\n setPosition('bottom-right');\n }\n };\n\n const isOutsideDropdown = (element: Element) =>\n (!wrapperRef.current || !nodeBelongs(wrapperRef.current, element)) &&\n (!dropdownContainerRef.current || !nodeBelongs(dropdownContainerRef.current, element));\n\n const focusHandler = (event: React.FocusEvent) => {\n if (!event.relatedTarget || isOutsideDropdown(event.relatedTarget)) {\n fireNonCancelableEvent(onFocus, event);\n }\n };\n\n const blurHandler = (event: React.FocusEvent) => {\n if (!event.relatedTarget || isOutsideDropdown(event.relatedTarget)) {\n fireNonCancelableEvent(onBlur, event);\n }\n };\n\n // Check if the dropdown has enough space to fit with its desired width constraints\n // If not, remove the class that allows flexible width sizing\n const fixStretching = () => {\n const classNameToRemove = styles['use-flexible-width'];\n if (\n open &&\n dropdownRef.current &&\n triggerRef.current &&\n dropdownRef.current.classList.contains(classNameToRemove) &&\n !hasEnoughSpaceForFlexibleWidth({\n triggerElement: triggerRef.current,\n dropdownElement: dropdownRef.current,\n minWidthConstraint: minWidth,\n maxWidthConstraint: maxWidth,\n expandToViewport,\n stretchHeight,\n isMobile,\n })\n ) {\n dropdownRef.current.classList.remove(classNameToRemove);\n }\n };\n\n useResizeObserver(() => dropdownRef.current, fixStretching);\n\n useLayoutEffect(() => {\n const onDropdownOpen = () => {\n if (open && dropdownRef.current && triggerRef.current && verticalContainerRef.current) {\n if (scrollable) {\n dropdownRef.current.classList.add(styles.nowrap);\n }\n\n setDropdownPosition(\n ...calculatePosition(\n dropdownRef.current,\n triggerRef.current,\n verticalContainerRef.current,\n interior,\n expandToViewport,\n preferCenter,\n matchTriggerWidth,\n stretchHeight,\n isMobile,\n minWidth,\n maxWidth\n ),\n dropdownRef.current,\n verticalContainerRef.current\n );\n\n if (scrollable) {\n dropdownRef.current.classList.remove(styles.nowrap);\n }\n }\n };\n onDropdownOpen();\n\n if (open) {\n // window may scroll when dropdown opens, for example when soft keyboard shows up\n window.addEventListener('scroll', onDropdownOpen);\n // only listen to window scroll within very short time after the dropdown opens\n // do not want to interfere dropdown position on scroll afterwards\n const timeoutId = setTimeout(() => {\n window.removeEventListener('scroll', onDropdownOpen);\n }, 500);\n\n return () => {\n clearTimeout(timeoutId);\n window.removeEventListener('scroll', onDropdownOpen);\n };\n }\n // See AWSUI-13040\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, dropdownRef, triggerRef, verticalContainerRef, interior, matchTriggerWidth, isMobile, contentKey]);\n\n // subscribe to outside click\n useEffect(() => {\n if (!open) {\n return;\n }\n const clickListener = (event: MouseEvent) => {\n // Since the listener is registered on the window, `event.target` will incorrectly point at the\n // shadow root if the component is rendered inside shadow DOM.\n const target = event.composedPath ? event.composedPath()[0] : event.target;\n if (!nodeBelongs(dropdownRef.current, target) && !nodeBelongs(triggerRef.current, target)) {\n fireNonCancelableEvent(onDropdownClose);\n }\n };\n window.addEventListener('click', clickListener, true);\n\n return () => {\n window.removeEventListener('click', clickListener, true);\n };\n }, [open, onDropdownClose]);\n\n // sync dropdown position on scroll and resize\n useLayoutEffect(() => {\n if (!expandToViewport || !open) {\n return;\n }\n const updateDropdownPosition = () => {\n if (triggerRef.current && dropdownRef.current && verticalContainerRef.current && fixedPosition.current) {\n applyDropdownPositionRelativeToViewport({\n position: fixedPosition.current,\n dropdownElement: dropdownRef.current,\n triggerRect: getLogicalBoundingClientRect(triggerRef.current),\n isMobile,\n });\n }\n };\n\n updateDropdownPosition();\n\n const controller = new AbortController();\n window.addEventListener('scroll', updateDropdownPosition, { capture: true, signal: controller.signal });\n window.addEventListener('resize', updateDropdownPosition, { capture: true, signal: controller.signal });\n return () => {\n controller.abort();\n };\n }, [open, expandToViewport, isMobile]);\n\n const referrerId = useUniqueId();\n\n // Compute CSS variable values for min/max width\n // These will be used by the use-flexible-width CSS class\n const getMinWidthCssValue = (): string | undefined => {\n if (minWidth === undefined) {\n return undefined;\n }\n if (typeof minWidth === 'number') {\n return `${minWidth}px`;\n }\n // 'trigger' maps to 100% (relative to parent)\n return '100%';\n };\n\n const getMaxWidthCssValue = (): string | undefined => {\n if (maxWidth === undefined) {\n return 'none';\n }\n if (typeof maxWidth === 'number') {\n return `${maxWidth}px`;\n }\n // 'trigger' maps to 100% (relative to parent)\n return '100%';\n };\n\n return (\n <div\n className={clsx(\n styles.root,\n interior && styles.interior,\n stretchTriggerHeight && styles['stretch-trigger-height']\n )}\n ref={wrapperRef}\n onFocus={focusHandler}\n onBlur={blurHandler}\n >\n <div id={referrerId} className={clsx(stretchTriggerHeight && styles['stretch-trigger-height'])} ref={triggerRef}>\n {trigger}\n </div>\n\n <TabTrap\n focusNextCallback={() => dropdownRef.current && getFirstFocusable(dropdownRef.current)?.focus()}\n disabled={!open || !loopFocus}\n />\n\n <DropdownContainer\n triggerRef={triggerRef}\n renderWithPortal={expandToViewport && !interior}\n id={dropdownId}\n referrerId={referrerId}\n open={open}\n >\n <Transition in={open ?? false} exit={false}>\n {(state, ref) => (\n <div ref={dropdownContainerRef}>\n <TabTrap\n focusNextCallback={() => triggerRef.current && getLastFocusable(triggerRef.current)?.focus()}\n disabled={!open || !loopFocus}\n />\n\n <TransitionContent\n state={state}\n transitionRef={ref}\n dropdownClasses={dropdownClasses}\n open={open}\n matchTriggerWidth={matchTriggerWidth}\n hideBlockBorder={hideBlockBorder}\n interior={interior}\n header={header}\n content={content}\n expandToViewport={expandToViewport}\n minWidth={getMinWidthCssValue()}\n maxWidth={getMaxWidthCssValue()}\n footer={footer}\n onMouseDown={onMouseDown}\n isRefresh={isRefresh}\n dropdownRef={dropdownRef}\n verticalContainerRef={verticalContainerRef}\n position={position}\n id={dropdownContentId}\n ariaRole={ariaRole}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n />\n\n <TabTrap\n focusNextCallback={() => triggerRef.current && getFirstFocusable(triggerRef.current)?.focus()}\n disabled={!open || !loopFocus}\n />\n </div>\n )}\n </Transition>\n </DropdownContainer>\n </div>\n );\n};\n\nconst isInteriorPosition = (\n position: DropdownPosition | InteriorDropdownPosition\n): position is InteriorDropdownPosition => (position as InteriorDropdownPosition).insetBlockEnd !== undefined;\n\nexport default Dropdown;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/index.tsx"],"names":[],"mappings":"AAA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,EACxB,YAAY,EAAE,iBAAiB,EAC/B,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,oBAAoB,EAC1C,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,iBAAiB,EACrB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,GAChC;gBAEF,oBAAC,OAAO,IACN,iBAAiB,EAAE,GAAG,EAAE,WAAC,OAAA,UAAU,CAAC,OAAO,KAAI,MAAA,iBAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,0CAAE,KAAK,EAAE,CAAA,CAAA,EAAA,EAC7F,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,SAAS,GAC7B,CACE,CACP,CACU,CACK,CAChB,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CACzB,QAAqD,EACf,EAAE,CAAE,QAAqC,CAAC,aAAa,KAAK,SAAS,CAAC;AAE9G,eAAe,QAAQ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useResizeObserver, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { getLogicalBoundingClientRect } from '@cloudscape-design/component-toolkit/internal';\n\nimport { fireNonCancelableEvent } from '../../events';\nimport customCssProps from '../../generated/custom-css-properties';\nimport { useMobile } from '../../hooks/use-mobile';\nimport { usePortalModeClasses } from '../../hooks/use-portal-mode-classes';\nimport { useVisualRefresh } from '../../hooks/use-visual-mode';\nimport { nodeBelongs } from '../../utils/node-belongs';\nimport { getFirstFocusable, getLastFocusable } from '../focus-lock/utils.js';\nimport TabTrap from '../tab-trap/index.js';\nimport { Transition, TransitionStatus } from '../transition';\nimport { DropdownContextProvider, DropdownContextProviderProps } from './context';\nimport {\n calculatePosition,\n DropdownPosition,\n hasEnoughSpaceForFlexibleWidth,\n InteriorDropdownPosition,\n} from './dropdown-fit-handler';\nimport { applyDropdownPositionRelativeToViewport, LogicalDOMRect } from './dropdown-position';\nimport { DropdownProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface DropdownContainerProps {\n triggerRef: React.RefObject<HTMLElement>;\n children?: React.ReactNode;\n renderWithPortal: boolean;\n id?: string;\n referrerId?: string;\n open?: boolean;\n}\n\nconst DropdownContainer = ({\n triggerRef,\n children,\n renderWithPortal,\n id,\n referrerId,\n open,\n}: DropdownContainerProps) => {\n if (!renderWithPortal) {\n return <>{children}</>;\n }\n if (!open) {\n return null;\n }\n const currentDocument = triggerRef.current?.ownerDocument ?? document;\n return createPortal(\n <div id={id} data-awsui-referrer-id={referrerId}>\n {children}\n </div>,\n currentDocument.body\n );\n};\n\ninterface TransitionContentProps {\n state: TransitionStatus;\n transitionRef: React.MutableRefObject<any>;\n dropdownClasses: string;\n matchTriggerWidth: boolean;\n hideBlockBorder: boolean;\n interior: boolean;\n isRefresh: boolean;\n dropdownRef: React.RefObject<HTMLDivElement>;\n verticalContainerRef: React.RefObject<HTMLDivElement>;\n expandToViewport?: boolean;\n minWidth?: string;\n maxWidth?: string;\n header?: React.ReactNode;\n content?: React.ReactNode;\n footer?: React.ReactNode;\n position?: DropdownContextProviderProps['position'];\n open?: boolean;\n onMouseDown?: React.MouseEventHandler<Element>;\n onFocusEnter?: React.FocusEventHandler<Element>;\n onFocusLeave?: React.FocusEventHandler<Element>;\n id?: string;\n ariaRole?: string;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n}\n\nconst TransitionContent = ({\n state,\n transitionRef,\n dropdownClasses,\n matchTriggerWidth,\n hideBlockBorder,\n interior,\n isRefresh,\n dropdownRef,\n verticalContainerRef,\n expandToViewport,\n minWidth,\n maxWidth,\n header,\n content,\n footer,\n position,\n open,\n onMouseDown,\n onFocusEnter,\n onFocusLeave,\n id,\n ariaRole,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n}: TransitionContentProps) => {\n const contentRef = useMergeRefs(dropdownRef, transitionRef);\n const dropdownStyles: Record<string, string> = {};\n if (minWidth) {\n dropdownStyles[customCssProps.dropdownDefaultMinWidth] = minWidth;\n }\n if (maxWidth) {\n dropdownStyles[customCssProps.dropdownDefaultMaxWidth] = maxWidth;\n }\n return (\n <div\n className={clsx(styles.dropdown, dropdownClasses, {\n [styles.open]: open,\n [styles['with-limited-width']]: !matchTriggerWidth,\n [styles['hide-block-border']]: hideBlockBorder,\n [styles.interior]: interior,\n [styles.refresh]: isRefresh,\n [styles['use-portal']]: expandToViewport && !interior,\n [styles['use-flexible-width']]: !matchTriggerWidth && !interior,\n })}\n ref={contentRef}\n id={id}\n role={ariaRole}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n data-open={open}\n data-animating={state !== 'exited'}\n aria-hidden={!open}\n style={dropdownStyles}\n onMouseDown={onMouseDown}\n onFocus={onFocusEnter}\n onBlur={onFocusLeave}\n >\n <div\n className={clsx(\n styles['dropdown-content-wrapper'],\n !header && !content && styles['is-empty'],\n isRefresh && styles.refresh\n )}\n >\n <div ref={verticalContainerRef} className={styles['dropdown-content']}>\n <DropdownContextProvider position={position}>\n {header}\n {content}\n {footer}\n </DropdownContextProvider>\n </div>\n </div>\n </div>\n );\n};\n\nconst Dropdown = ({\n content,\n trigger,\n open,\n onOutsideClick,\n onMouseDown,\n header,\n footer,\n dropdownId,\n stretchTriggerHeight = false,\n stretchHeight = false,\n minWidth,\n maxWidth,\n hideBlockBorder = true,\n expandToViewport = false,\n preferredAlignment = 'start',\n interior = false,\n scrollable = true,\n loopFocus = expandToViewport,\n onFocus,\n onBlur,\n onFocusEnter,\n onFocusLeave,\n onEscape,\n contentKey,\n dropdownContentId,\n ariaRole,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n}: DropdownProps) => {\n const wrapperRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLDivElement | null>(null);\n const dropdownRef = useRef<HTMLDivElement | null>(null);\n const dropdownContainerRef = useRef<HTMLDivElement | null>(null);\n const verticalContainerRef = useRef<HTMLDivElement>(null);\n // To keep track of the initial position (drop up/down) which is kept the same during fixed repositioning\n const fixedPosition = useRef<DropdownPosition | null>(null);\n\n const isRefresh = useVisualRefresh();\n\n const dropdownClasses = usePortalModeClasses(triggerRef);\n const [position, setPosition] = useState<DropdownContextProviderProps['position']>('bottom-right');\n\n const isMobile = useMobile();\n\n // Derive if dropdown should match trigger width exactly\n // This happens when both minWidth and maxWidth are explicitly set to 'trigger'\n const matchTriggerWidth = minWidth === 'trigger' && maxWidth === 'trigger';\n\n // Convert preferredAlignment to boolean for internal positioning logic\n const preferCenter = preferredAlignment === 'center';\n\n const setDropdownPosition = (\n position: DropdownPosition | InteriorDropdownPosition,\n triggerBox: LogicalDOMRect,\n target: HTMLDivElement,\n verticalContainer: HTMLDivElement\n ) => {\n verticalContainer.style.maxBlockSize = position.blockSize;\n\n // Only apply occupy-entire-width when matching trigger width exactly and not in portal mode\n if (!interior && matchTriggerWidth && !expandToViewport) {\n target.classList.add(styles['occupy-entire-width']);\n } else {\n target.style.inlineSize = position.inlineSize;\n }\n\n // Using styles for main dropdown to adjust its position as preferred alternative\n if (position.dropBlockStart && !interior) {\n target.classList.add(styles['dropdown-drop-up']);\n if (!expandToViewport) {\n target.style.insetBlockEnd = '100%';\n }\n } else {\n target.classList.remove(styles['dropdown-drop-up']);\n }\n target.classList.add(position.dropInlineStart ? styles['dropdown-drop-left'] : styles['dropdown-drop-right']);\n\n if (position.insetInlineStart && position.insetInlineStart !== 'auto') {\n target.style.insetInlineStart = position.insetInlineStart;\n }\n\n // Position normal overflow dropdowns with fixed positioning relative to viewport\n if (expandToViewport && !interior) {\n applyDropdownPositionRelativeToViewport({\n position,\n dropdownElement: target,\n triggerRect: triggerBox,\n isMobile,\n });\n // Keep track of the initial dropdown position and direction.\n // Dropdown direction doesn't need to change as the user scrolls, just needs to stay attached to the trigger.\n fixedPosition.current = position;\n return;\n }\n\n // For an interior dropdown (the fly out) we need exact values for positioning\n // and classes are not enough\n // usage of relative position is impossible due to overwrite of overflow-x\n if (interior && isInteriorPosition(position)) {\n if (position.dropBlockStart) {\n target.style.insetBlockEnd = position.insetBlockEnd;\n } else {\n target.style.insetBlockStart = position.insetBlockStart;\n }\n target.style.insetInlineStart = position.insetInlineStart;\n }\n\n if (position.dropBlockStart && position.dropInlineStart) {\n setPosition('top-left');\n } else if (position.dropBlockStart) {\n setPosition('top-right');\n } else if (position.dropInlineStart) {\n setPosition('bottom-left');\n } else {\n setPosition('bottom-right');\n }\n };\n\n const isOutsideDropdown = (element: Element) =>\n (!wrapperRef.current || !nodeBelongs(wrapperRef.current, element)) &&\n (!dropdownContainerRef.current || !nodeBelongs(dropdownContainerRef.current, element));\n\n const focusHandler = (event: React.FocusEvent) => {\n if (!event.relatedTarget || isOutsideDropdown(event.relatedTarget)) {\n fireNonCancelableEvent(onFocus, event);\n }\n };\n\n const blurHandler = (event: React.FocusEvent) => {\n if (!event.relatedTarget || isOutsideDropdown(event.relatedTarget)) {\n fireNonCancelableEvent(onBlur, event);\n }\n };\n\n const isOutsideDropdownContent = (element: Element) =>\n !dropdownRef.current || !nodeBelongs(dropdownRef.current, element);\n\n const focusEnterHandler = (event: React.FocusEvent) => {\n if (!event.relatedTarget || isOutsideDropdownContent(event.relatedTarget)) {\n fireNonCancelableEvent(onFocusEnter, event);\n }\n };\n\n const focusLeaveHandler = (event: React.FocusEvent) => {\n if (!event.relatedTarget || isOutsideDropdownContent(event.relatedTarget)) {\n fireNonCancelableEvent(onFocusLeave, event);\n }\n };\n\n // Check if the dropdown has enough space to fit with its desired width constraints\n // If not, remove the class that allows flexible width sizing\n const fixStretching = () => {\n const classNameToRemove = styles['use-flexible-width'];\n if (\n open &&\n dropdownRef.current &&\n triggerRef.current &&\n dropdownRef.current.classList.contains(classNameToRemove) &&\n !hasEnoughSpaceForFlexibleWidth({\n triggerElement: triggerRef.current,\n dropdownElement: dropdownRef.current,\n minWidthConstraint: minWidth,\n maxWidthConstraint: maxWidth,\n expandToViewport,\n stretchHeight,\n isMobile,\n })\n ) {\n dropdownRef.current.classList.remove(classNameToRemove);\n }\n };\n\n useResizeObserver(() => dropdownRef.current, fixStretching);\n\n useLayoutEffect(() => {\n const onDropdownOpen = () => {\n if (open && dropdownRef.current && triggerRef.current && verticalContainerRef.current) {\n if (scrollable) {\n dropdownRef.current.classList.add(styles.nowrap);\n }\n\n setDropdownPosition(\n ...calculatePosition(\n dropdownRef.current,\n triggerRef.current,\n verticalContainerRef.current,\n interior,\n expandToViewport,\n preferCenter,\n matchTriggerWidth,\n stretchHeight,\n isMobile,\n minWidth,\n maxWidth\n ),\n dropdownRef.current,\n verticalContainerRef.current\n );\n\n if (scrollable) {\n dropdownRef.current.classList.remove(styles.nowrap);\n }\n }\n };\n onDropdownOpen();\n\n if (open) {\n // window may scroll when dropdown opens, for example when soft keyboard shows up\n window.addEventListener('scroll', onDropdownOpen);\n // only listen to window scroll within very short time after the dropdown opens\n // do not want to interfere dropdown position on scroll afterwards\n const timeoutId = setTimeout(() => {\n window.removeEventListener('scroll', onDropdownOpen);\n }, 500);\n\n return () => {\n clearTimeout(timeoutId);\n window.removeEventListener('scroll', onDropdownOpen);\n };\n }\n // See AWSUI-13040\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, dropdownRef, triggerRef, verticalContainerRef, interior, matchTriggerWidth, isMobile, contentKey]);\n\n // subscribe to outside click\n useEffect(() => {\n if (!open) {\n return;\n }\n const clickListener = (event: MouseEvent) => {\n // Since the listener is registered on the window, `event.target` will incorrectly point at the\n // shadow root if the component is rendered inside shadow DOM.\n const target = event.composedPath ? event.composedPath()[0] : event.target;\n if (!nodeBelongs(dropdownRef.current, target) && !nodeBelongs(triggerRef.current, target)) {\n fireNonCancelableEvent(onOutsideClick);\n }\n };\n window.addEventListener('click', clickListener, true);\n\n return () => {\n window.removeEventListener('click', clickListener, true);\n };\n }, [open, onOutsideClick]);\n\n // subscribe to Escape key press\n useEffect(() => {\n // Only add the listener if onEscape callback is provided\n if (!open || !onEscape) {\n return;\n }\n const keydownListener = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n // Prevent any surrounding modals or dialogs from acting on this Escape key\n event.stopPropagation();\n fireNonCancelableEvent(onEscape);\n }\n };\n window.addEventListener('keydown', keydownListener, true);\n\n return () => {\n window.removeEventListener('keydown', keydownListener, true);\n };\n }, [open, onEscape]);\n\n // sync dropdown position on scroll and resize\n useLayoutEffect(() => {\n if (!expandToViewport || !open) {\n return;\n }\n const updateDropdownPosition = () => {\n if (triggerRef.current && dropdownRef.current && verticalContainerRef.current && fixedPosition.current) {\n applyDropdownPositionRelativeToViewport({\n position: fixedPosition.current,\n dropdownElement: dropdownRef.current,\n triggerRect: getLogicalBoundingClientRect(triggerRef.current),\n isMobile,\n });\n }\n };\n\n updateDropdownPosition();\n\n const controller = new AbortController();\n window.addEventListener('scroll', updateDropdownPosition, { capture: true, signal: controller.signal });\n window.addEventListener('resize', updateDropdownPosition, { capture: true, signal: controller.signal });\n return () => {\n controller.abort();\n };\n }, [open, expandToViewport, isMobile]);\n\n const referrerId = useUniqueId();\n\n // Compute CSS variable values for min/max width\n // These will be used by the use-flexible-width CSS class\n const getMinWidthCssValue = (): string | undefined => {\n if (minWidth === undefined) {\n return undefined;\n }\n if (typeof minWidth === 'number') {\n return `${minWidth}px`;\n }\n // 'trigger' maps to 100% (relative to parent)\n return '100%';\n };\n\n const getMaxWidthCssValue = (): string | undefined => {\n if (maxWidth === undefined) {\n return 'none';\n }\n if (typeof maxWidth === 'number') {\n return `${maxWidth}px`;\n }\n // 'trigger' maps to 100% (relative to parent)\n return '100%';\n };\n\n return (\n <div\n className={clsx(\n styles.root,\n interior && styles.interior,\n stretchTriggerHeight && styles['stretch-trigger-height']\n )}\n ref={wrapperRef}\n onFocus={focusHandler}\n onBlur={blurHandler}\n >\n <div id={referrerId} className={clsx(stretchTriggerHeight && styles['stretch-trigger-height'])} ref={triggerRef}>\n {trigger}\n </div>\n\n <TabTrap\n focusNextCallback={() => dropdownRef.current && getFirstFocusable(dropdownRef.current)?.focus()}\n disabled={!open || !loopFocus}\n />\n\n <DropdownContainer\n triggerRef={triggerRef}\n renderWithPortal={expandToViewport && !interior}\n id={dropdownId}\n referrerId={referrerId}\n open={open}\n >\n <Transition in={open ?? false} exit={false}>\n {(state, ref) => (\n <div ref={dropdownContainerRef}>\n <TabTrap\n focusNextCallback={() => triggerRef.current && getLastFocusable(triggerRef.current)?.focus()}\n disabled={!open || !loopFocus}\n />\n\n <TransitionContent\n state={state}\n transitionRef={ref}\n dropdownClasses={dropdownClasses}\n open={open}\n matchTriggerWidth={matchTriggerWidth}\n hideBlockBorder={hideBlockBorder}\n interior={interior}\n header={header}\n content={content}\n expandToViewport={expandToViewport}\n minWidth={getMinWidthCssValue()}\n maxWidth={getMaxWidthCssValue()}\n footer={footer}\n onMouseDown={onMouseDown}\n onFocusEnter={focusEnterHandler}\n onFocusLeave={focusLeaveHandler}\n isRefresh={isRefresh}\n dropdownRef={dropdownRef}\n verticalContainerRef={verticalContainerRef}\n position={position}\n id={dropdownContentId}\n ariaRole={ariaRole}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n />\n\n <TabTrap\n focusNextCallback={() => triggerRef.current && getFirstFocusable(triggerRef.current)?.focus()}\n disabled={!open || !loopFocus}\n />\n </div>\n )}\n </Transition>\n </DropdownContainer>\n </div>\n );\n};\n\nconst isInteriorPosition = (\n position: DropdownPosition | InteriorDropdownPosition\n): position is InteriorDropdownPosition => (position as InteriorDropdownPosition).insetBlockEnd !== undefined;\n\nexport default Dropdown;\n"]}
@@ -71,9 +71,11 @@ export interface DropdownProps extends ExpandToViewport {
71
71
  */
72
72
  open?: boolean;
73
73
  /**
74
- * Called when a user clicks outside of the dropdown content, when it is open.
74
+ * Called when the user clicks outside the dropdown and trigger.
75
+ * The dropdown does not close automatically - the parent component
76
+ * must update the `open` prop to close the dropdown.
75
77
  */
76
- onDropdownClose?: NonCancelableEventHandler<null>;
78
+ onOutsideClick?: NonCancelableEventHandler<null>;
77
79
  /**
78
80
  * Called when a mouse button is pressed inside the dropdown content.
79
81
  */
@@ -134,6 +136,21 @@ export interface DropdownProps extends ExpandToViewport {
134
136
  * Called when focus leaves the trigger or dropdown content.
135
137
  */
136
138
  onBlur?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;
139
+ /**
140
+ * Called when focus enters the dropdown content from outside.
141
+ * This fires only once when focus moves into the dropdown, not when moving between elements within it.
142
+ */
143
+ onFocusEnter?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;
144
+ /**
145
+ * Called when focus leaves the dropdown content entirely.
146
+ */
147
+ onFocusLeave?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;
148
+ /**
149
+ * Called when the user presses the Escape key while the dropdown is open.
150
+ * The dropdown does not close automatically - the parent component
151
+ * must update the `open` prop to close the dropdown.
152
+ */
153
+ onEscape?: NonCancelableEventHandler;
137
154
  /**
138
155
  * ID for the dropdown content wrapper
139
156
  */
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,OAAO,GACP,QAAQ,CAAC;AAEb;;;;GAIG;AACH,MAAM,MAAM,u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OAAO,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC;IAExF;;OAEG;IACH,MAAM,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC;IAEvF;;;OAGG;IACH,YAAY,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC;IAE7F;;OAEG;IACH,YAAY,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC;IAE7F;;;;OAIG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IAErC;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { NonCancelableEventHandler } from '../../events';\n\nexport type OptionsFilteringType = 'none' | 'auto' | 'manual';\n\n/**\n * Alignment of the dropdown relative to its trigger.\n */\nexport type DropdownAlignment =\n | 'start' // Aligns to the start edge of trigger (default)\n | 'center'; // Centers dropdown on trigger\n\n/**\n * Width constraint for the dropdown.\n * - 'trigger': references the trigger element's width\n * - number: width in pixels\n */\nexport type DropdownWidthConstraint = 'trigger' | number;\n\nexport interface OptionsLoadItemsDetail {\n filteringText: string;\n firstPage: boolean;\n samePage: boolean;\n}\n\nexport interface BaseDropdownHostProps extends ExpandToViewport {\n /**\n * If you have more than 500 options, enable this flag to apply a performance optimization\n * that makes the filtering experience smoother. We don't recommend enabling the feature if you\n * have less than 500 options, because the improvements to performance are offset by a\n * visible scrolling lag.\n *\n * When you set this flag to `true`, it removes options that are not currently in view from the DOM.\n * If your test accesses such options, you need to first scroll the options container\n * to the correct offset, before performing any operations on them. Use the element returned\n * by the `findOptionsContainer` test utility for this.\n */\n virtualScroll?: boolean;\n\n /**\n * Use this event to implement the asynchronous behavior for the component.\n *\n * The event is called in the following situations:\n * * The user scrolls to the end of the list of options, if `statusType` is set to `pending`.\n * * The user clicks on the recovery button in the error state.\n * * The user types inside the input field.\n * * The user focuses the input field.\n *\n * The detail object contains the following properties:\n * * `filteringText` - The value that you need to use to fetch options.\n * * `firstPage` - Indicates that you should fetch the first page of options that match the `filteringText`.\n * * `samePage` - Indicates that you should fetch the same page that you have previously fetched (for example, when the user clicks on the recovery button).\n **/\n onLoadItems?: NonCancelableEventHandler<OptionsLoadItemsDetail>;\n}\n\nexport interface DropdownProps extends ExpandToViewport {\n /**\n * Trigger element.\n */\n trigger: React.ReactNode;\n\n /**\n * \"Sticky\" header of the dropdown content\n */\n header?: React.ReactNode;\n\n /**\n * Footer slot fixed at the bottom of the dropdown\n */\n footer?: React.ReactNode;\n\n /**\n * Dropdown content elements.\n */\n content?: React.ReactNode;\n\n /**\n * Updating content key triggers dropdown position re-evaluation.\n */\n contentKey?: string;\n\n /**\n * Open state of the dropdown.\n */\n open?: boolean;\n\n /**\n * Called when a user clicks outside of the dropdown content, when it is open.\n */\n onDropdownClose?: NonCancelableEventHandler<null>;\n\n /**\n * Called when a mouse button is pressed inside the dropdown content.\n */\n onMouseDown?: React.MouseEventHandler;\n\n /**\n * Dropdown id\n */\n dropdownId?: string;\n\n /**\n * Stretches dropdown to occupy entire height.\n */\n stretchHeight?: boolean;\n\n /**\n * Stretches the trigger to the height of the dropdown container.\n */\n stretchTriggerHeight?: boolean;\n\n /**\n * Minimum width constraint for the dropdown.\n * - Number: minimum width in pixels\n * - 'trigger': dropdown will be at least as wide as the trigger\n * - undefined: no minimum constraint (fits content)\n */\n minWidth?: DropdownWidthConstraint;\n\n /**\n * Maximum width constraint for the dropdown.\n * - Number: maximum width in pixels\n * - 'trigger': dropdown cannot exceed the trigger width\n * - undefined: fit to content width (no max constraint)\n */\n maxWidth?: DropdownWidthConstraint;\n\n /**\n * Preferred alignment of the dropdown relative to its trigger.\n * The dropdown will attempt this alignment first, but will automatically\n * adjust if there's insufficient space on the preferred side.\n */\n preferredAlignment?: DropdownAlignment;\n\n /**\n * Hides the block (top/bottom) borders of the dropdown content wrapper.\n */\n hideBlockBorder?: boolean;\n\n /**\n * Indicates if this dropdown lies within a parent dropdown and positions itself relative to it (as a fly out).\n */\n interior?: boolean;\n\n /**\n * Whether the dropdown will have a scrollbar or not\n */\n scrollable?: boolean;\n\n /**\n * Whether the dropdown will have a focus loop including trigger, header, content and footer.\n */\n loopFocus?: boolean;\n\n /**\n * Called when focus enters the trigger or dropdown content.\n */\n onFocus?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;\n\n /**\n * Called when focus leaves the trigger or dropdown content.\n */\n onBlur?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;\n\n /**\n * ID for the dropdown content wrapper\n */\n dropdownContentId?: string;\n\n /**\n * HTML role for the dropdown content wrapper\n */\n ariaRole?: string;\n\n /**\n * Aria label for the dropdown content wrapper\n */\n ariaLabel?: string;\n\n /**\n * Labelledby for the dropdown (required when role=\"dialog\")\n */\n ariaLabelledby?: string;\n\n /**\n * Describedby for the dropdown (recommended when role=\"dialog\")\n */\n ariaDescribedby?: string;\n}\n\nexport interface ExpandToViewport {\n /**\n * By default, the dropdown height is constrained to fit inside the height of its next scrollable container element.\n * Enabling this property will allow the dropdown to extend beyond that container by using fixed positioning and\n * [React Portals](https://reactjs.org/docs/portals.html).\n *\n * Set this property if the dropdown would otherwise be constrained by a scrollable container,\n * for example inside table and split view layouts.\n *\n * We recommend you use discretion, and don't enable this property unless necessary\n * because fixed positioning results in a slight, visible lag when scrolling complex pages.\n */\n expandToViewport?: boolean;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { NonCancelableEventHandler } from '../../events';\n\nexport type OptionsFilteringType = 'none' | 'auto' | 'manual';\n\n/**\n * Alignment of the dropdown relative to its trigger.\n */\nexport type DropdownAlignment =\n | 'start' // Aligns to the start edge of trigger (default)\n | 'center'; // Centers dropdown on trigger\n\n/**\n * Width constraint for the dropdown.\n * - 'trigger': references the trigger element's width\n * - number: width in pixels\n */\nexport type DropdownWidthConstraint = 'trigger' | number;\n\nexport interface OptionsLoadItemsDetail {\n filteringText: string;\n firstPage: boolean;\n samePage: boolean;\n}\n\nexport interface BaseDropdownHostProps extends ExpandToViewport {\n /**\n * If you have more than 500 options, enable this flag to apply a performance optimization\n * that makes the filtering experience smoother. We don't recommend enabling the feature if you\n * have less than 500 options, because the improvements to performance are offset by a\n * visible scrolling lag.\n *\n * When you set this flag to `true`, it removes options that are not currently in view from the DOM.\n * If your test accesses such options, you need to first scroll the options container\n * to the correct offset, before performing any operations on them. Use the element returned\n * by the `findOptionsContainer` test utility for this.\n */\n virtualScroll?: boolean;\n\n /**\n * Use this event to implement the asynchronous behavior for the component.\n *\n * The event is called in the following situations:\n * * The user scrolls to the end of the list of options, if `statusType` is set to `pending`.\n * * The user clicks on the recovery button in the error state.\n * * The user types inside the input field.\n * * The user focuses the input field.\n *\n * The detail object contains the following properties:\n * * `filteringText` - The value that you need to use to fetch options.\n * * `firstPage` - Indicates that you should fetch the first page of options that match the `filteringText`.\n * * `samePage` - Indicates that you should fetch the same page that you have previously fetched (for example, when the user clicks on the recovery button).\n **/\n onLoadItems?: NonCancelableEventHandler<OptionsLoadItemsDetail>;\n}\n\nexport interface DropdownProps extends ExpandToViewport {\n /**\n * Trigger element.\n */\n trigger: React.ReactNode;\n\n /**\n * \"Sticky\" header of the dropdown content\n */\n header?: React.ReactNode;\n\n /**\n * Footer slot fixed at the bottom of the dropdown\n */\n footer?: React.ReactNode;\n\n /**\n * Dropdown content elements.\n */\n content?: React.ReactNode;\n\n /**\n * Updating content key triggers dropdown position re-evaluation.\n */\n contentKey?: string;\n\n /**\n * Open state of the dropdown.\n */\n open?: boolean;\n\n /**\n * Called when the user clicks outside the dropdown and trigger.\n * The dropdown does not close automatically - the parent component\n * must update the `open` prop to close the dropdown.\n */\n onOutsideClick?: NonCancelableEventHandler<null>;\n\n /**\n * Called when a mouse button is pressed inside the dropdown content.\n */\n onMouseDown?: React.MouseEventHandler;\n\n /**\n * Dropdown id\n */\n dropdownId?: string;\n\n /**\n * Stretches dropdown to occupy entire height.\n */\n stretchHeight?: boolean;\n\n /**\n * Stretches the trigger to the height of the dropdown container.\n */\n stretchTriggerHeight?: boolean;\n\n /**\n * Minimum width constraint for the dropdown.\n * - Number: minimum width in pixels\n * - 'trigger': dropdown will be at least as wide as the trigger\n * - undefined: no minimum constraint (fits content)\n */\n minWidth?: DropdownWidthConstraint;\n\n /**\n * Maximum width constraint for the dropdown.\n * - Number: maximum width in pixels\n * - 'trigger': dropdown cannot exceed the trigger width\n * - undefined: fit to content width (no max constraint)\n */\n maxWidth?: DropdownWidthConstraint;\n\n /**\n * Preferred alignment of the dropdown relative to its trigger.\n * The dropdown will attempt this alignment first, but will automatically\n * adjust if there's insufficient space on the preferred side.\n */\n preferredAlignment?: DropdownAlignment;\n\n /**\n * Hides the block (top/bottom) borders of the dropdown content wrapper.\n */\n hideBlockBorder?: boolean;\n\n /**\n * Indicates if this dropdown lies within a parent dropdown and positions itself relative to it (as a fly out).\n */\n interior?: boolean;\n\n /**\n * Whether the dropdown will have a scrollbar or not\n */\n scrollable?: boolean;\n\n /**\n * Whether the dropdown will have a focus loop including trigger, header, content and footer.\n */\n loopFocus?: boolean;\n\n /**\n * Called when focus enters the trigger or dropdown content.\n */\n onFocus?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;\n\n /**\n * Called when focus leaves the trigger or dropdown content.\n */\n onBlur?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;\n\n /**\n * Called when focus enters the dropdown content from outside.\n * This fires only once when focus moves into the dropdown, not when moving between elements within it.\n */\n onFocusEnter?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;\n\n /**\n * Called when focus leaves the dropdown content entirely.\n */\n onFocusLeave?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;\n\n /**\n * Called when the user presses the Escape key while the dropdown is open.\n * The dropdown does not close automatically - the parent component\n * must update the `open` prop to close the dropdown.\n */\n onEscape?: NonCancelableEventHandler;\n\n /**\n * ID for the dropdown content wrapper\n */\n dropdownContentId?: string;\n\n /**\n * HTML role for the dropdown content wrapper\n */\n ariaRole?: string;\n\n /**\n * Aria label for the dropdown content wrapper\n */\n ariaLabel?: string;\n\n /**\n * Labelledby for the dropdown (required when role=\"dialog\")\n */\n ariaLabelledby?: string;\n\n /**\n * Describedby for the dropdown (recommended when role=\"dialog\")\n */\n ariaDescribedby?: string;\n}\n\nexport interface ExpandToViewport {\n /**\n * By default, the dropdown height is constrained to fit inside the height of its next scrollable container element.\n * Enabling this property will allow the dropdown to extend beyond that container by using fixed positioning and\n * [React Portals](https://reactjs.org/docs/portals.html).\n *\n * Set this property if the dropdown would otherwise be constrained by a scrollable container,\n * for example inside table and split view layouts.\n *\n * We recommend you use discretion, and don't enable this property unless necessary\n * because fixed positioning results in a slight, visible lag when scrolling complex pages.\n */\n expandToViewport?: boolean;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (96f8230d)";
3
- export var GIT_SHA = "96f8230d";
2
+ export var PACKAGE_VERSION = "3.0.0 (f13e0284)";
3
+ export var GIT_SHA = "f13e0284";
4
4
  export var THEME = "open-source-visual-refresh";
5
5
  export var SYSTEM = "core";
6
6
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (96f8230d)",
4
- "GIT_SHA": "96f8230d",
3
+ "PACKAGE_VERSION": "3.0.0 (f13e0284)",
4
+ "GIT_SHA": "f13e0284",
5
5
  "THEME": "default",
6
6
  "SYSTEM": "core",
7
7
  "ALWAYS_VISUAL_REFRESH": false
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/wizard/internal.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAKlF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAO3C,KAAK,mBAAmB,GAAG,WAAW,GACpC,0BAA0B,GAAG;IAC3B,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C,CAAC;AAEJ,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,KAAK,EACL,eAAe,EAAE,yBAAyB,EAC1C,gBAAgB,EAChB,iBAAyB,EACzB,WAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,kCAA0C,EAC1C,GAAG,IAAI,EACR,EAAE,mBAAmB,eAoKrB"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/wizard/internal.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAKlF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAQ3C,KAAK,mBAAmB,GAAG,WAAW,GACpC,0BAA0B,GAAG;IAC3B,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C,CAAC;AAEJ,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,KAAK,EACL,eAAe,EAAE,yBAAyB,EAC1C,gBAAgB,EAChB,iBAAyB,EACzB,WAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,kCAA0C,EAC1C,GAAG,IAAI,EACR,EAAE,mBAAmB,eAoLrB"}
@@ -1,6 +1,6 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import React, { useRef } from 'react';
3
+ import React, { useRef, useState } from 'react';
4
4
  import clsx from 'clsx';
5
5
  import { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';
6
6
  import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
@@ -16,6 +16,7 @@ import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
16
16
  import { useFunnelChangeEvent } from './analytics';
17
17
  import WizardForm, { STEP_NAME_SELECTOR } from './wizard-form';
18
18
  import WizardNavigation from './wizard-navigation';
19
+ import WizardStepNavigationExpandable from './wizard-step-navigation-expandable';
19
20
  import analyticsSelectors from './analytics-metadata/styles.css.js';
20
21
  import styles from './styles.css.js';
21
22
  export default function InternalWizard({ steps, activeStepIndex: controlledActiveStepIndex, submitButtonText, isLoadingNextStep = false, allowSkipTo = false, customPrimaryActions, secondaryActions, onCancel, onSubmit, onNavigate, __internalRootRef, __injectAnalyticsComponentMetadata = false, ...rest }) {
@@ -35,6 +36,7 @@ export default function InternalWizard({ steps, activeStepIndex: controlledActiv
35
36
  farthestStepIndex.current = Math.max(farthestStepIndex.current, actualActiveStepIndex);
36
37
  const isVisualRefresh = useVisualRefresh();
37
38
  const isLastStep = actualActiveStepIndex >= steps.length - 1;
39
+ const [isStepNavigationExpanded, setIsStepNavigationExpanded] = useState(false);
38
40
  const navigationEvent = (requestedStepIndex, reason) => {
39
41
  if (funnelInteractionId) {
40
42
  const stepName = getTextFromSelector(STEP_NAME_SELECTOR);
@@ -106,7 +108,9 @@ export default function InternalWizard({ steps, activeStepIndex: controlledActiv
106
108
  : {}) },
107
109
  React.createElement("div", { className: clsx(styles.wizard, isVisualRefresh && styles.refresh, smallContainer && styles['small-container']) },
108
110
  React.createElement(WizardNavigation, { activeStepIndex: actualActiveStepIndex, farthestStepIndex: farthestStepIndex.current, allowSkipTo: allowSkipTo, hidden: smallContainer, i18nStrings: i18nStrings, isLoadingNextStep: isLoadingNextStep, onStepClick: onStepClick, onSkipToClick: onSkipToClick, steps: steps }),
111
+ smallContainer && (React.createElement("div", { className: styles['collapsed-steps'] },
112
+ React.createElement(WizardStepNavigationExpandable, { activeStepIndex: actualActiveStepIndex, farthestStepIndex: farthestStepIndex.current, allowSkipTo: allowSkipTo, i18nStrings: i18nStrings, isLoadingNextStep: isLoadingNextStep, onStepClick: onStepClick, onSkipToClick: onSkipToClick, steps: steps, expanded: isStepNavigationExpanded, onExpandChange: setIsStepNavigationExpanded }))),
109
113
  React.createElement("div", { className: clsx(styles.form, isVisualRefresh && styles.refresh, smallContainer && styles['small-container']) },
110
- React.createElement(WizardForm, { steps: steps, showCollapsedSteps: smallContainer, i18nStrings: i18nStrings, submitButtonText: submitButtonText, activeStepIndex: actualActiveStepIndex, isPrimaryLoading: isLoadingNextStep, allowSkipTo: allowSkipTo, customPrimaryActions: customPrimaryActions, secondaryActions: secondaryActions, onCancelClick: onCancelClick, onPreviousClick: onPreviousClick, onSkipToClick: onSkipToClick, onPrimaryClick: onPrimaryClick })))));
114
+ React.createElement(WizardForm, { steps: steps, i18nStrings: i18nStrings, submitButtonText: submitButtonText, activeStepIndex: actualActiveStepIndex, isPrimaryLoading: isLoadingNextStep, allowSkipTo: allowSkipTo, customPrimaryActions: customPrimaryActions, secondaryActions: secondaryActions, onCancelClick: onCancelClick, onPreviousClick: onPreviousClick, onSkipToClick: onSkipToClick, onPrimaryClick: onPrimaryClick })))));
111
115
  }
112
116
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/wizard/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,C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AC,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC;YAC1E,CAAC,CAAC,EAAE,CAAC;QAEP,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,IAAI,MAAM,CAAC,OAAO,EAAE,cAAc,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;YAE9G,oBAAC,gBAAgB,IACf,eAAe,EAAE,qBAAqB,EACtC,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,EAC5C,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,cAAc,EACtB,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,GACZ;YACF,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,IAAI,MAAM,CAAC,OAAO,EAAE,cAAc,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;gBAE5G,oBAAC,UAAU,IACT,KAAK,EAAE,KAAK,EACZ,kBAAkB,EAAE,cAAc,EAClC,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,eAAe,EAAE,qBAAqB,EACtC,gBAAgB,EAAE,iBAAiB,EACnC,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,oBAAoB,EAC1C,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAC9B,CACE,CACF,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FUNNEL_KEY,\n FUNNEL_KEY_FUNNEL_NAME,\n FUNNEL_KEY_STEP_NAME,\n getSubStepAllSelector,\n getTextFromSelector,\n} from '../internal/analytics/selectors';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useFunnelChangeEvent } from './analytics';\nimport { GeneratedAnalyticsMetadataWizardComponent } from './analytics-metadata/interfaces';\nimport { WizardProps } from './interfaces';\nimport WizardForm, { STEP_NAME_SELECTOR } from './wizard-form';\nimport WizardNavigation from './wizard-navigation';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\ntype InternalWizardProps = WizardProps &\n InternalBaseComponentProps & {\n __injectAnalyticsComponentMetadata?: boolean;\n };\n\nexport default function InternalWizard({\n steps,\n activeStepIndex: controlledActiveStepIndex,\n submitButtonText,\n isLoadingNextStep = false,\n allowSkipTo = false,\n customPrimaryActions,\n secondaryActions,\n onCancel,\n onSubmit,\n onNavigate,\n __internalRootRef,\n __injectAnalyticsComponentMetadata = false,\n ...rest\n}: InternalWizardProps) {\n const baseProps = getBaseProps(rest);\n\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n const ref = useMergeRefs(breakpointsRef, __internalRootRef);\n\n const smallContainer = breakpoint === 'default';\n\n const [activeStepIndex, setActiveStepIndex] = useControllable(controlledActiveStepIndex, onNavigate, 0, {\n componentName: 'Wizard',\n controlledProp: 'activeStepIndex',\n changeHandler: 'onNavigate',\n });\n const { funnelIdentifier, funnelInteractionId, funnelSubmit, funnelCancel, funnelProps, funnelNextOrSubmitAttempt } =\n useFunnel();\n const actualActiveStepIndex = activeStepIndex ? Math.min(activeStepIndex, steps.length - 1) : 0;\n\n const farthestStepIndex = useRef<number>(actualActiveStepIndex);\n farthestStepIndex.current = Math.max(farthestStepIndex.current, actualActiveStepIndex);\n\n const isVisualRefresh = useVisualRefresh();\n const isLastStep = actualActiveStepIndex >= steps.length - 1;\n\n const navigationEvent = (requestedStepIndex: number, reason: WizardProps.NavigationReason) => {\n if (funnelInteractionId) {\n const stepName = getTextFromSelector(STEP_NAME_SELECTOR);\n\n FunnelMetrics.funnelStepNavigation({\n navigationType: reason,\n funnelInteractionId,\n stepNumber: actualActiveStepIndex + 1,\n stepName,\n stepNameSelector: STEP_NAME_SELECTOR,\n destinationStepNumber: requestedStepIndex + 1,\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n\n setActiveStepIndex(requestedStepIndex);\n fireNonCancelableEvent(onNavigate, { requestedStepIndex, reason });\n };\n const onStepClick = (stepIndex: number) => navigationEvent(stepIndex, 'step');\n const onSkipToClick = (stepIndex: number) => navigationEvent(stepIndex, 'skip');\n const onCancelClick = () => {\n funnelCancel();\n fireNonCancelableEvent(onCancel);\n };\n const onPreviousClick = () => navigationEvent(actualActiveStepIndex - 1, 'previous');\n const onPrimaryClick = () => {\n funnelNextOrSubmitAttempt();\n\n if (isLastStep) {\n funnelSubmit();\n fireNonCancelableEvent(onSubmit);\n } else {\n navigationEvent(actualActiveStepIndex + 1, 'next');\n }\n };\n\n useFunnelChangeEvent(funnelInteractionId, funnelIdentifier, steps);\n\n const i18n = useInternalI18n('wizard');\n const skipToButtonLabel = i18n(\n 'i18nStrings.skipToButtonLabel',\n rest.i18nStrings?.skipToButtonLabel,\n format => task => format({ task__title: task.title })\n );\n\n const i18nStrings: WizardProps.I18nStrings = {\n ...rest.i18nStrings,\n skipToButtonLabel,\n stepNumberLabel: i18n(\n 'i18nStrings.stepNumberLabel',\n rest.i18nStrings?.stepNumberLabel,\n format => stepNumber => format({ stepNumber })\n ),\n collapsedStepsLabel: i18n(\n 'i18nStrings.collapsedStepsLabel',\n rest.i18nStrings?.collapsedStepsLabel,\n format => (stepNumber, stepsCount) => format({ stepNumber, stepsCount })\n ),\n navigationAriaLabel: i18n('i18nStrings.navigationAriaLabel', rest.i18nStrings?.navigationAriaLabel),\n cancelButton: i18n('i18nStrings.cancelButton', rest.i18nStrings?.cancelButton),\n previousButton: i18n('i18nStrings.previousButton', rest.i18nStrings?.previousButton),\n nextButton: i18n('i18nStrings.nextButton', rest.i18nStrings?.nextButton),\n optional: i18n('i18nStrings.optional', rest.i18nStrings?.optional),\n };\n\n if (activeStepIndex && activeStepIndex >= steps.length) {\n warnOnce(\n 'Wizard',\n `You have set \\`activeStepIndex\\` to ${activeStepIndex} but you have provided only ${\n steps.length\n } steps. Its value is ignored and the component uses ${steps.length - 1} instead.`\n );\n }\n\n if (allowSkipTo && !skipToButtonLabel) {\n warnOnce(\n 'Wizard',\n `You have set \\`allowSkipTo\\` but you have not provided \\`i18nStrings.skipToButtonLabel\\`. The skip-to button will not be rendered.`\n );\n }\n\n const componentAnalyticsMetadata: GeneratedAnalyticsMetadataWizardComponent = {\n name: 'awsui.Wizard',\n label: {\n root: 'body',\n selector: `[${DATA_ATTR_FUNNEL_KEY}=\"${FUNNEL_KEY_FUNNEL_NAME}\"]`,\n },\n properties: {\n stepsCount: `${(steps || []).length}`,\n activeStepIndex: `${activeStepIndex}`,\n activeStepLabel: `[${DATA_ATTR_FUNNEL_KEY}=\"${FUNNEL_KEY_STEP_NAME}\"]`,\n ...(rest.analyticsMetadata || {}),\n },\n };\n\n return (\n <div\n {...baseProps}\n {...funnelProps}\n ref={ref}\n className={clsx(styles.root, analyticsSelectors.root, baseProps.className)}\n {...(__injectAnalyticsComponentMetadata\n ? getAnalyticsMetadataAttribute({ component: componentAnalyticsMetadata })\n : {})}\n >\n <div\n className={clsx(styles.wizard, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n <WizardNavigation\n activeStepIndex={actualActiveStepIndex}\n farthestStepIndex={farthestStepIndex.current}\n allowSkipTo={allowSkipTo}\n hidden={smallContainer}\n i18nStrings={i18nStrings}\n isLoadingNextStep={isLoadingNextStep}\n onStepClick={onStepClick}\n onSkipToClick={onSkipToClick}\n steps={steps}\n />\n <div\n className={clsx(styles.form, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n <WizardForm\n steps={steps}\n showCollapsedSteps={smallContainer}\n i18nStrings={i18nStrings}\n submitButtonText={submitButtonText}\n activeStepIndex={actualActiveStepIndex}\n isPrimaryLoading={isLoadingNextStep}\n allowSkipTo={allowSkipTo}\n customPrimaryActions={customPrimaryActions}\n secondaryActions={secondaryActions}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onSkipToClick={onSkipToClick}\n onPrimaryClick={onPrimaryClick}\n />\n </div>\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/wizard/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;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2B,GAC3C,CACE,CACP;YACD,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,IAAI,MAAM,CAAC,OAAO,EAAE,cAAc,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;gBAE5G,oBAAC,UAAU,IACT,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,eAAe,EAAE,qBAAqB,EACtC,gBAAgB,EAAE,iBAAiB,EACnC,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,oBAAoB,EAC1C,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAC9B,CACE,CACF,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FUNNEL_KEY,\n FUNNEL_KEY_FUNNEL_NAME,\n FUNNEL_KEY_STEP_NAME,\n getSubStepAllSelector,\n getTextFromSelector,\n} from '../internal/analytics/selectors';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useFunnelChangeEvent } from './analytics';\nimport { GeneratedAnalyticsMetadataWizardComponent } from './analytics-metadata/interfaces';\nimport { WizardProps } from './interfaces';\nimport WizardForm, { STEP_NAME_SELECTOR } from './wizard-form';\nimport WizardNavigation from './wizard-navigation';\nimport WizardStepNavigationExpandable from './wizard-step-navigation-expandable';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\ntype InternalWizardProps = WizardProps &\n InternalBaseComponentProps & {\n __injectAnalyticsComponentMetadata?: boolean;\n };\n\nexport default function InternalWizard({\n steps,\n activeStepIndex: controlledActiveStepIndex,\n submitButtonText,\n isLoadingNextStep = false,\n allowSkipTo = false,\n customPrimaryActions,\n secondaryActions,\n onCancel,\n onSubmit,\n onNavigate,\n __internalRootRef,\n __injectAnalyticsComponentMetadata = false,\n ...rest\n}: InternalWizardProps) {\n const baseProps = getBaseProps(rest);\n\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n const ref = useMergeRefs(breakpointsRef, __internalRootRef);\n const smallContainer = breakpoint === 'default';\n\n const [activeStepIndex, setActiveStepIndex] = useControllable(controlledActiveStepIndex, onNavigate, 0, {\n componentName: 'Wizard',\n controlledProp: 'activeStepIndex',\n changeHandler: 'onNavigate',\n });\n const { funnelIdentifier, funnelInteractionId, funnelSubmit, funnelCancel, funnelProps, funnelNextOrSubmitAttempt } =\n useFunnel();\n const actualActiveStepIndex = activeStepIndex ? Math.min(activeStepIndex, steps.length - 1) : 0;\n\n const farthestStepIndex = useRef<number>(actualActiveStepIndex);\n farthestStepIndex.current = Math.max(farthestStepIndex.current, actualActiveStepIndex);\n\n const isVisualRefresh = useVisualRefresh();\n const isLastStep = actualActiveStepIndex >= steps.length - 1;\n\n const [isStepNavigationExpanded, setIsStepNavigationExpanded] = useState(false);\n\n const navigationEvent = (requestedStepIndex: number, reason: WizardProps.NavigationReason) => {\n if (funnelInteractionId) {\n const stepName = getTextFromSelector(STEP_NAME_SELECTOR);\n\n FunnelMetrics.funnelStepNavigation({\n navigationType: reason,\n funnelInteractionId,\n stepNumber: actualActiveStepIndex + 1,\n stepName,\n stepNameSelector: STEP_NAME_SELECTOR,\n destinationStepNumber: requestedStepIndex + 1,\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n\n setActiveStepIndex(requestedStepIndex);\n fireNonCancelableEvent(onNavigate, { requestedStepIndex, reason });\n };\n const onStepClick = (stepIndex: number) => navigationEvent(stepIndex, 'step');\n const onSkipToClick = (stepIndex: number) => navigationEvent(stepIndex, 'skip');\n const onCancelClick = () => {\n funnelCancel();\n fireNonCancelableEvent(onCancel);\n };\n const onPreviousClick = () => navigationEvent(actualActiveStepIndex - 1, 'previous');\n const onPrimaryClick = () => {\n funnelNextOrSubmitAttempt();\n\n if (isLastStep) {\n funnelSubmit();\n fireNonCancelableEvent(onSubmit);\n } else {\n navigationEvent(actualActiveStepIndex + 1, 'next');\n }\n };\n\n useFunnelChangeEvent(funnelInteractionId, funnelIdentifier, steps);\n\n const i18n = useInternalI18n('wizard');\n const skipToButtonLabel = i18n(\n 'i18nStrings.skipToButtonLabel',\n rest.i18nStrings?.skipToButtonLabel,\n format => task => format({ task__title: task.title })\n );\n\n const i18nStrings: WizardProps.I18nStrings = {\n ...rest.i18nStrings,\n skipToButtonLabel,\n stepNumberLabel: i18n(\n 'i18nStrings.stepNumberLabel',\n rest.i18nStrings?.stepNumberLabel,\n format => stepNumber => format({ stepNumber })\n ),\n collapsedStepsLabel: i18n(\n 'i18nStrings.collapsedStepsLabel',\n rest.i18nStrings?.collapsedStepsLabel,\n format => (stepNumber, stepsCount) => format({ stepNumber, stepsCount })\n ),\n navigationAriaLabel: i18n('i18nStrings.navigationAriaLabel', rest.i18nStrings?.navigationAriaLabel),\n cancelButton: i18n('i18nStrings.cancelButton', rest.i18nStrings?.cancelButton),\n previousButton: i18n('i18nStrings.previousButton', rest.i18nStrings?.previousButton),\n nextButton: i18n('i18nStrings.nextButton', rest.i18nStrings?.nextButton),\n optional: i18n('i18nStrings.optional', rest.i18nStrings?.optional),\n };\n\n if (activeStepIndex && activeStepIndex >= steps.length) {\n warnOnce(\n 'Wizard',\n `You have set \\`activeStepIndex\\` to ${activeStepIndex} but you have provided only ${\n steps.length\n } steps. Its value is ignored and the component uses ${steps.length - 1} instead.`\n );\n }\n\n if (allowSkipTo && !skipToButtonLabel) {\n warnOnce(\n 'Wizard',\n `You have set \\`allowSkipTo\\` but you have not provided \\`i18nStrings.skipToButtonLabel\\`. The skip-to button will not be rendered.`\n );\n }\n\n const componentAnalyticsMetadata: GeneratedAnalyticsMetadataWizardComponent = {\n name: 'awsui.Wizard',\n label: {\n root: 'body',\n selector: `[${DATA_ATTR_FUNNEL_KEY}=\"${FUNNEL_KEY_FUNNEL_NAME}\"]`,\n },\n properties: {\n stepsCount: `${(steps || []).length}`,\n activeStepIndex: `${activeStepIndex}`,\n activeStepLabel: `[${DATA_ATTR_FUNNEL_KEY}=\"${FUNNEL_KEY_STEP_NAME}\"]`,\n ...(rest.analyticsMetadata || {}),\n },\n };\n\n return (\n <div\n {...baseProps}\n {...funnelProps}\n ref={ref}\n className={clsx(styles.root, analyticsSelectors.root, baseProps.className)}\n {...(__injectAnalyticsComponentMetadata\n ? getAnalyticsMetadataAttribute({ component: componentAnalyticsMetadata })\n : {})}\n >\n <div\n className={clsx(styles.wizard, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n <WizardNavigation\n activeStepIndex={actualActiveStepIndex}\n farthestStepIndex={farthestStepIndex.current}\n allowSkipTo={allowSkipTo}\n hidden={smallContainer}\n i18nStrings={i18nStrings}\n isLoadingNextStep={isLoadingNextStep}\n onStepClick={onStepClick}\n onSkipToClick={onSkipToClick}\n steps={steps}\n />\n {smallContainer && (\n <div className={styles['collapsed-steps']}>\n <WizardStepNavigationExpandable\n activeStepIndex={actualActiveStepIndex}\n farthestStepIndex={farthestStepIndex.current}\n allowSkipTo={allowSkipTo}\n i18nStrings={i18nStrings}\n isLoadingNextStep={isLoadingNextStep}\n onStepClick={onStepClick}\n onSkipToClick={onSkipToClick}\n steps={steps}\n expanded={isStepNavigationExpanded}\n onExpandChange={setIsStepNavigationExpanded}\n />\n </div>\n )}\n <div\n className={clsx(styles.form, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n <WizardForm\n steps={steps}\n i18nStrings={i18nStrings}\n submitButtonText={submitButtonText}\n activeStepIndex={actualActiveStepIndex}\n isPrimaryLoading={isLoadingNextStep}\n allowSkipTo={allowSkipTo}\n customPrimaryActions={customPrimaryActions}\n secondaryActions={secondaryActions}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onSkipToClick={onSkipToClick}\n onPrimaryClick={onPrimaryClick}\n />\n </div>\n </div>\n </div>\n );\n}\n"]}
@@ -1,35 +1,35 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_1xupv_1vmie_145",
5
- "wizard": "awsui_wizard_1xupv_1vmie_177",
6
- "refresh": "awsui_refresh_1xupv_1vmie_177",
7
- "small-container": "awsui_small-container_1xupv_1vmie_184",
8
- "navigation": "awsui_navigation_1xupv_1vmie_193",
9
- "number": "awsui_number_1xupv_1vmie_226",
10
- "circle": "awsui_circle_1xupv_1vmie_242",
11
- "title": "awsui_title_1xupv_1vmie_253",
12
- "active": "awsui_active_1xupv_1vmie_284",
13
- "disabled": "awsui_disabled_1xupv_1vmie_295",
14
- "enabled": "awsui_enabled_1xupv_1vmie_305",
15
- "form": "awsui_form_1xupv_1vmie_349",
16
- "form-header": "awsui_form-header_1xupv_1vmie_354",
17
- "form-header-content": "awsui_form-header-content_1xupv_1vmie_369",
18
- "form-component": "awsui_form-component_1xupv_1vmie_373",
19
- "hidden": "awsui_hidden_1xupv_1vmie_387",
20
- "collapsed-steps": "awsui_collapsed-steps_1xupv_1vmie_391",
21
- "collapsed-steps-hidden": "awsui_collapsed-steps-hidden_1xupv_1vmie_396",
22
- "form-header-component-wrapper": "awsui_form-header-component-wrapper_1xupv_1vmie_400",
23
- "form-header-component": "awsui_form-header-component_1xupv_1vmie_400",
24
- "navigation-link": "awsui_navigation-link_1xupv_1vmie_416",
25
- "navigation-link-item": "awsui_navigation-link-item_1xupv_1vmie_417",
26
- "navigation-link-label": "awsui_navigation-link-label_1xupv_1vmie_418",
27
- "navigation-link-active": "awsui_navigation-link-active_1xupv_1vmie_422",
28
- "navigation-link-disabled": "awsui_navigation-link-disabled_1xupv_1vmie_427",
29
- "cancel-button": "awsui_cancel-button_1xupv_1vmie_431",
30
- "previous-button": "awsui_previous-button_1xupv_1vmie_432",
31
- "primary-button": "awsui_primary-button_1xupv_1vmie_433",
32
- "skip-to-button": "awsui_skip-to-button_1xupv_1vmie_434",
33
- "action-buttons": "awsui_action-buttons_1xupv_1vmie_438"
4
+ "root": "awsui_root_1xupv_1rebv_145",
5
+ "wizard": "awsui_wizard_1xupv_1rebv_177",
6
+ "refresh": "awsui_refresh_1xupv_1rebv_177",
7
+ "small-container": "awsui_small-container_1xupv_1rebv_184",
8
+ "navigation": "awsui_navigation_1xupv_1rebv_198",
9
+ "number": "awsui_number_1xupv_1rebv_231",
10
+ "circle": "awsui_circle_1xupv_1rebv_247",
11
+ "title": "awsui_title_1xupv_1rebv_258",
12
+ "active": "awsui_active_1xupv_1rebv_289",
13
+ "disabled": "awsui_disabled_1xupv_1rebv_300",
14
+ "enabled": "awsui_enabled_1xupv_1rebv_310",
15
+ "form": "awsui_form_1xupv_1rebv_354",
16
+ "form-header": "awsui_form-header_1xupv_1rebv_359",
17
+ "form-header-content": "awsui_form-header-content_1xupv_1rebv_374",
18
+ "form-component": "awsui_form-component_1xupv_1rebv_378",
19
+ "hidden": "awsui_hidden_1xupv_1rebv_394",
20
+ "collapsed-steps": "awsui_collapsed-steps_1xupv_1rebv_398",
21
+ "collapsed-steps-navigation": "awsui_collapsed-steps-navigation_1xupv_1rebv_404",
22
+ "form-header-component-wrapper": "awsui_form-header-component-wrapper_1xupv_1rebv_413",
23
+ "form-header-component": "awsui_form-header-component_1xupv_1rebv_413",
24
+ "navigation-link": "awsui_navigation-link_1xupv_1rebv_429",
25
+ "navigation-link-item": "awsui_navigation-link-item_1xupv_1rebv_430",
26
+ "navigation-link-label": "awsui_navigation-link-label_1xupv_1rebv_431",
27
+ "navigation-link-active": "awsui_navigation-link-active_1xupv_1rebv_435",
28
+ "navigation-link-disabled": "awsui_navigation-link-disabled_1xupv_1rebv_440",
29
+ "cancel-button": "awsui_cancel-button_1xupv_1rebv_444",
30
+ "previous-button": "awsui_previous-button_1xupv_1rebv_445",
31
+ "primary-button": "awsui_primary-button_1xupv_1rebv_446",
32
+ "skip-to-button": "awsui_skip-to-button_1xupv_1rebv_447",
33
+ "action-buttons": "awsui_action-buttons_1xupv_1rebv_451"
34
34
  };
35
35