@cloudscape-design/components 3.0.76 → 3.0.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app-layout/drawer.d.ts +2 -1
- package/app-layout/drawer.d.ts.map +1 -1
- package/app-layout/drawer.js +8 -2
- package/app-layout/drawer.js.map +1 -1
- package/app-layout/index.d.ts.map +1 -1
- package/app-layout/index.js +6 -5
- package/app-layout/index.js.map +1 -1
- package/app-layout/interfaces.d.ts +6 -0
- package/app-layout/interfaces.d.ts.map +1 -1
- package/app-layout/interfaces.js.map +1 -1
- package/app-layout/notifications/index.js +1 -1
- package/app-layout/notifications/index.js.map +1 -1
- package/app-layout/tools-and-split-panel.d.ts +2 -1
- package/app-layout/tools-and-split-panel.d.ts.map +1 -1
- package/app-layout/tools-and-split-panel.js +2 -2
- package/app-layout/tools-and-split-panel.js.map +1 -1
- package/app-layout/utils/use-focus-control.d.ts +10 -4
- package/app-layout/utils/use-focus-control.d.ts.map +1 -1
- package/app-layout/utils/use-focus-control.js +30 -9
- package/app-layout/utils/use-focus-control.js.map +1 -1
- package/app-layout/visual-refresh/app-bar.js +2 -2
- package/app-layout/visual-refresh/app-bar.js.map +1 -1
- package/app-layout/visual-refresh/context.d.ts +3 -1
- package/app-layout/visual-refresh/context.d.ts.map +1 -1
- package/app-layout/visual-refresh/context.js +8 -4
- package/app-layout/visual-refresh/context.js.map +1 -1
- package/app-layout/visual-refresh/navigation.js +1 -1
- package/app-layout/visual-refresh/navigation.js.map +1 -1
- package/app-layout/visual-refresh/notifications.js +2 -2
- package/app-layout/visual-refresh/notifications.js.map +1 -1
- package/app-layout/visual-refresh/tools.d.ts.map +1 -1
- package/app-layout/visual-refresh/tools.js +7 -4
- package/app-layout/visual-refresh/tools.js.map +1 -1
- package/date-range-picker/calendar/index.d.ts.map +1 -1
- package/date-range-picker/calendar/index.js +22 -26
- package/date-range-picker/calendar/index.js.map +1 -1
- package/date-range-picker/index.js +1 -1
- package/date-range-picker/index.js.map +1 -1
- package/date-range-picker/styles.css.js +36 -37
- package/date-range-picker/styles.scoped.css +50 -54
- package/date-range-picker/styles.selectors.js +36 -37
- package/input/internal.d.ts.map +1 -1
- package/input/internal.js +2 -3
- package/input/internal.js.map +1 -1
- package/internal/base-component/styles.scoped.css +4 -0
- package/internal/components/autosuggest-input/index.d.ts.map +1 -1
- package/internal/components/autosuggest-input/index.js +4 -5
- package/internal/components/autosuggest-input/index.js.map +1 -1
- package/internal/components/button-trigger/index.d.ts.map +1 -1
- package/internal/components/button-trigger/index.js +2 -3
- package/internal/components/button-trigger/index.js.map +1 -1
- package/internal/components/chart-popover/index.js +1 -1
- package/internal/components/chart-popover/index.js.map +1 -1
- package/internal/components/dropdown/index.d.ts.map +1 -1
- package/internal/components/dropdown/index.js +1 -1
- package/internal/components/dropdown/index.js.map +1 -1
- package/internal/components/dropdown-status/index.d.ts.map +1 -1
- package/internal/components/dropdown-status/index.js +2 -4
- package/internal/components/dropdown-status/index.js.map +1 -1
- package/internal/components/options-list/index.d.ts.map +1 -1
- package/internal/components/options-list/index.js +2 -2
- package/internal/components/options-list/index.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/events/index.d.ts +0 -9
- package/internal/events/index.d.ts.map +1 -1
- package/internal/events/index.js +0 -11
- package/internal/events/index.js.map +1 -1
- package/internal/generated/theming/index.cjs +23 -0
- package/internal/generated/theming/index.js +23 -0
- package/package.json +1 -1
- package/pagination/internal.d.ts.map +1 -1
- package/pagination/internal.js +1 -1
- package/pagination/internal.js.map +1 -1
- package/popover/internal.js +2 -2
- package/popover/internal.js.map +1 -1
- package/popover/styles.css.js +50 -49
- package/popover/styles.scoped.css +67 -62
- package/popover/styles.selectors.js +50 -49
- package/table/header-cell/index.d.ts.map +1 -1
- package/table/header-cell/index.js +1 -0
- package/table/header-cell/index.js.map +1 -1
- package/table/header-cell/styles.css.js +15 -14
- package/table/header-cell/styles.scoped.css +27 -24
- package/table/header-cell/styles.selectors.js +15 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/button-trigger/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAsB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/button-trigger/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAsB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAyC,MAAM,cAAc,CAAC;AAC7G,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAsBxD,IAAM,aAAa,GAAG,UACpB,EAmBqB,EACrB,GAAiC;IAnB/B,IAAA,QAAQ,cAAA,EACR,eAAe,EAAf,OAAO,mBAAG,KAAK,KAAA,EACf,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EACjB,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,eAAe,EAAf,OAAO,mBAAG,KAAK,KAAA,EACf,gBAAgB,sBAAA,EAChB,YAAY,kBAAA,EACZ,SAAS,eAAA,EACT,cAAc,oBAAA,EACd,eAAe,qBAAA,EACf,SAAS,eAAA,EACT,OAAO,aAAA,EACP,WAAW,iBAAA,E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AO,EAAE,EAAE,EAAE,KAAK,CAAC,EAAvC,CAAuC,CAAC,EACtE,OAAO,EAAE,OAAO,IAAI,CAAC,UAAA,KAAK,IAAI,OAAA,mBAAmB,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,EAAvC,CAAuC,CAAC,EACtE,MAAM,EAAE,MAAM,IAAI,CAAC,UAAA,KAAK,IAAI,OAAA,mBAAmB,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,EAAE,KAAK,CAAC,EAA1E,CAA0E,CAAC,GACxG,CAAC;IAEF,IAAI,OAAO,EAAE;QACX,UAAU,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC;KACtC;IAED,OAAO,CACL,yCAAQ,GAAG,EAAE,GAAG,IAAM,UAAU;QAC7B,QAAQ;QACR,CAAC,SAAS,IAAI,CACb,8BAAM,SAAS,EAAE,MAAM,CAAC,KAAK;YAC3B,oBAAC,YAAY,IAAC,IAAI,EAAC,mBAAmB,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,GAAI,CAC/E,CACR,CACM,CACV,CAAC;AACJ,CAAC,CAAC;AAQF,eAAe,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ButtonHTMLAttributes } from 'react';\nimport clsx from 'clsx';\nimport { BaseComponentProps, getBaseProps } from '../../base-component';\nimport InternalIcon from '../../../icon/internal';\nimport styles from './styles.css.js';\nimport { fireKeyboardEvent, fireCancelableEvent, CancelableEventHandler, BaseKeyDetail } from '../../events';\nimport useFocusVisible from '../../hooks/focus-visible';\n\nexport interface ButtonTriggerProps extends BaseComponentProps {\n children?: React.ReactNode;\n pressed?: boolean;\n hideCaret?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n invalid?: boolean;\n inFilteringToken?: boolean;\n ariaHasPopup?: 'true' | 'listbox';\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n onKeyDown?: CancelableEventHandler<BaseKeyDetail>;\n onKeyUp?: CancelableEventHandler<BaseKeyDetail>;\n onMouseDown?: CancelableEventHandler;\n onClick?: CancelableEventHandler;\n onFocus?: CancelableEventHandler;\n onBlur?: CancelableEventHandler<{ relatedTarget: Node | null }>;\n}\n\nconst ButtonTrigger = (\n {\n children,\n pressed = false,\n hideCaret = false,\n disabled = false,\n readOnly = false,\n invalid = false,\n inFilteringToken,\n ariaHasPopup,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onClick,\n onFocus,\n onBlur,\n ...restProps\n }: ButtonTriggerProps,\n ref: React.Ref<HTMLButtonElement>\n) => {\n const baseProps = getBaseProps(restProps);\n const focusVisible = useFocusVisible();\n\n const attributes: ButtonHTMLAttributes<HTMLButtonElement> = {\n ...focusVisible,\n ...baseProps,\n type: 'button',\n className: clsx(\n styles['button-trigger'],\n baseProps.className,\n pressed && styles.pressed,\n disabled && styles.disabled,\n invalid && styles.invalid,\n !hideCaret && styles['has-caret'],\n readOnly && styles['read-only'],\n inFilteringToken && styles['in-filtering-token']\n ),\n disabled: disabled || readOnly,\n 'aria-expanded': pressed,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-haspopup': ariaHasPopup ?? 'listbox',\n onKeyDown: onKeyDown && (event => fireKeyboardEvent(onKeyDown, event)),\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n onMouseDown: onMouseDown && (event => fireCancelableEvent(onMouseDown, {}, event)),\n onClick: onClick && (event => fireCancelableEvent(onClick, {}, event)),\n onFocus: onFocus && (event => fireCancelableEvent(onFocus, {}, event)),\n onBlur: onBlur && (event => fireCancelableEvent(onBlur, { relatedTarget: event.relatedTarget }, event)),\n };\n\n if (invalid) {\n attributes['aria-invalid'] = invalid;\n }\n\n return (\n <button ref={ref} {...attributes}>\n {children}\n {!hideCaret && (\n <span className={styles.arrow}>\n <InternalIcon name=\"caret-down-filled\" variant={disabled ? 'disabled' : 'normal'} />\n </span>\n )}\n </button>\n );\n};\n\nexport namespace ButtonTriggerProps {\n export interface Ref {\n focus(): void;\n }\n}\n\nexport default React.forwardRef(ButtonTrigger);\n"]}
|
|
@@ -28,7 +28,7 @@ export default function ChartPopover(_a) {
|
|
|
28
28
|
document.removeEventListener('mousedown', onDocumentClick, { capture: true });
|
|
29
29
|
};
|
|
30
30
|
}, [container, onDismiss]);
|
|
31
|
-
return (React.createElement("
|
|
31
|
+
return (React.createElement("div", __assign({}, baseProps, { className: clsx(popoverStyles.root, styles.root, baseProps.className, (_b = {}, _b[styles.dismissable] = dismissButton, _b)), ref: popoverRef }),
|
|
32
32
|
React.createElement(PopoverContainer, { size: size, fixedWidth: fixedWidth, position: position, trackRef: trackRef, trackKey: trackKey, arrow: function (position) { return (React.createElement("div", { className: clsx(popoverStyles.arrow, popoverStyles["arrow-position-".concat(position)]) },
|
|
33
33
|
React.createElement("div", { className: popoverStyles['arrow-outer'] }),
|
|
34
34
|
React.createElement("div", { className: popoverStyles['arrow-inner'] }))); } },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/chart-popover/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAC1D,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,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QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,UAAA,QAAQ,IAAI,OAAA,CACjB,6BAAK,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,yBAAkB,QAAQ,CAAE,CAAC,CAAC;gBACpF,6BAAK,SAAS,EAAE,aAAa,CAAC,aAAa,CAAC,GAAI;gBAChD,6BAAK,SAAS,EAAE,aAAa,CAAC,aAAa,CAAC,GAAI,CAC5C,CACP,EALkB,CAKlB;YAED,oBAAC,WAAW,IACV,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,KAAK,EAClB,MAAM,EAAE,KAAK,EACb,SAAS,EAAE,SAAS,IAEnB,QAAQ,CACG,CACG,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, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../../base-component';\n\nimport { PopoverProps } from '../../../popover/interfaces';\nimport PopoverContainer from '../../../popover/container';\nimport PopoverBody from '../../../popover/body';\nimport popoverStyles from '../../../popover/styles.css.js';\nimport { nodeContains } from '../../utils/dom';\n\nimport styles from './styles.css.js';\n\nexport interface ChartPopoverProps extends PopoverProps {\n /** Title of the popover */\n title?: React.ReactNode;\n\n /** References the element the container is positioned against. */\n trackRef: React.RefObject<Element>;\n /**\n Used to update the container position in case track or track position changes:\n \n const trackRef = useRef<Element>(null)\n return (<>\n <Track style={getPosition(selectedItemId)} ref={trackRef} />\n <PopoverContainer trackRef={trackRef} trackKey={selectedItemId} .../>\n </>)\n */\n trackKey?: string | number;\n\n /** Optional container element that prevents any clicks in there from dismissing the popover */\n container: Element | null;\n\n /** Event that is fired when the popover is dismissed */\n onDismiss: (outsideClick?: boolean) => void;\n\n /** Popover content */\n children?: React.ReactNode;\n}\n\nexport default function ChartPopover({\n position = 'right',\n size = 'medium',\n fixedWidth = false,\n dismissButton = false,\n dismissAriaLabel,\n\n children,\n\n title,\n trackRef,\n trackKey,\n onDismiss,\n container,\n\n ...restProps\n}: ChartPopoverProps) {\n const baseProps = getBaseProps(restProps);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n\n useEffect(() => {\n const onDocumentClick = (event: MouseEvent) => {\n if (\n event.target &&\n !nodeContains(popoverRef.current, event.target as Element) && // click not in popover\n !nodeContains(container, event.target as Element) // click not in segment\n ) {\n onDismiss(true);\n }\n };\n\n document.addEventListener('mousedown', onDocumentClick, { capture: true });\n return () => {\n document.removeEventListener('mousedown', onDocumentClick, { capture: true });\n };\n }, [container, onDismiss]);\n\n return (\n <div\n {...baseProps}\n className={clsx(popoverStyles.root, styles.root, baseProps.className, { [styles.dismissable]: dismissButton })}\n ref={popoverRef}\n >\n <PopoverContainer\n size={size}\n fixedWidth={fixedWidth}\n position={position}\n trackRef={trackRef}\n trackKey={trackKey}\n arrow={position => (\n <div className={clsx(popoverStyles.arrow, popoverStyles[`arrow-position-${position}`])}>\n <div className={popoverStyles['arrow-outer']} />\n <div className={popoverStyles['arrow-inner']} />\n </div>\n )}\n >\n <PopoverBody\n dismissButton={dismissButton}\n dismissAriaLabel={dismissAriaLabel}\n returnFocus={false}\n header={title}\n onDismiss={onDismiss}\n >\n {children}\n </PopoverBody>\n </PopoverContainer>\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAiG7C,QAAA,MAAM,QAAQ,4PAoBX,aAAa,gBAgQf,CAAC;AAMF,eAAe,QAAQ,CAAC"}
|
|
@@ -41,7 +41,7 @@ var TransitionContent = function (_a) {
|
|
|
41
41
|
_b[styles['is-empty']] = !header && !children,
|
|
42
42
|
_b[styles.refresh] = isRefresh,
|
|
43
43
|
_b[styles['use-portal']] = expandToViewport && !interior,
|
|
44
|
-
_b)), ref: contentRef, "data-open": open, "data-animating": state !== 'exited', onMouseDown: onMouseDown },
|
|
44
|
+
_b)), ref: contentRef, "data-open": open, "data-animating": state !== 'exited', "aria-hidden": !open, onMouseDown: onMouseDown },
|
|
45
45
|
React.createElement("div", { className: clsx(styles['dropdown-content-wrapper'], isRefresh && styles.refresh) },
|
|
46
46
|
React.createElement("div", { className: styles['ie11-wrapper'] },
|
|
47
47
|
React.createElement("div", { ref: verticalContainerRef, className: styles['dropdown-content'] },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,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,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAA8C,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACvG,OAAO,EAAE,UAAU,EAAoB,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAgC,M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AU,CAAC,OAAO,KAAI,MAAA,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,0CAAE,KAAK,EAAE,CAAA,CAAA,EAAA,EAC5F,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,SAAS,GAC7B;gBAEF,oBAAC,iBAAiB,IAChB,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,GAAG,EAClB,eAAe,EAAE,eAAe,EAChC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,oBAAoB,EAC1C,QAAQ,EAAE,QAAQ,IAEjB,QAAQ,CACS;gBAEpB,oBAAC,OAAO,IACN,iBAAiB,EAAE,sBAAM,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,EA/BgB,CA+BhB,CACU,CACK,CAChB,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,IAAM,kBAAkB,GAAG,UACzB,QAAqD,IACZ,OAAC,QAAqC,CAAC,MAAM,KAAK,SAAS,EAA3D,CAA2D,CAAC;AAEvG,eAAe,QAAQ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport styles from './styles.css.js';\nimport clsx from 'clsx';\nimport { useMergeRefs } from '../../hooks/use-merge-refs';\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { fireNonCancelableEvent } from '../../events';\nimport { DropdownProps } from './interfaces';\nimport { DropdownPosition, InteriorDropdownPosition, calculatePosition } from './dropdown-fit-handler';\nimport { Transition, TransitionStatus } from '../transition';\nimport { useVisualRefresh } from '../../hooks/use-visual-mode';\nimport { usePortalModeClasses } from '../../hooks/use-portal-mode-classes';\nimport { DropdownContextProvider, DropdownContextProviderProps } from './context';\nimport { useMobile } from '../../hooks/use-mobile';\nimport TabTrap from '../tab-trap/index.js';\nimport { getFirstFocusable, getLastFocusable } from '../focus-lock/utils.js';\n\ninterface DropdownContainerProps {\n children?: React.ReactNode;\n renderWithPortal?: boolean;\n id?: string;\n open?: boolean;\n}\n\nconst DropdownContainer = ({ children, renderWithPortal = false, id, open }: DropdownContainerProps) => {\n if (renderWithPortal) {\n if (open) {\n return createPortal(<div id={id}>{children}</div>, document.body);\n } else {\n return null;\n }\n } else {\n return <>{children}</>;\n }\n};\n\ninterface TransitionContentProps {\n state: TransitionStatus;\n transitionRef: React.MutableRefObject<any>;\n dropdownClasses: string;\n stretchWidth: boolean;\n interior: boolean;\n isRefresh: boolean;\n dropdownRef: React.RefObject<HTMLDivElement>;\n verticalContainerRef: React.RefObject<HTMLDivElement>;\n expandToViewport?: boolean;\n header?: React.ReactNode;\n children?: React.ReactNode;\n footer?: React.ReactNode;\n position?: DropdownContextProviderProps['position'];\n open?: boolean;\n onMouseDown?: React.MouseEventHandler<Element>;\n}\n\nconst TransitionContent = ({\n state,\n transitionRef,\n dropdownClasses,\n stretchWidth,\n interior,\n isRefresh,\n dropdownRef,\n verticalContainerRef,\n expandToViewport,\n header,\n children,\n footer,\n position,\n open,\n onMouseDown,\n}: TransitionContentProps) => {\n const contentRef = useMergeRefs(dropdownRef, transitionRef);\n return (\n <div\n className={clsx(styles.dropdown, dropdownClasses, {\n [styles.open]: open,\n [styles['with-limited-width']]: !stretchWidth,\n [styles['hide-upper-border']]: stretchWidth,\n [styles.interior]: interior,\n [styles['is-empty']]: !header && !children,\n [styles.refresh]: isRefresh,\n [styles['use-portal']]: expandToViewport && !interior,\n })}\n ref={contentRef}\n data-open={open}\n data-animating={state !== 'exited'}\n onMouseDown={onMouseDown}\n >\n <div className={clsx(styles['dropdown-content-wrapper'], isRefresh && styles.refresh)}>\n <div className={styles['ie11-wrapper']}>\n <div ref={verticalContainerRef} className={styles['dropdown-content']}>\n <DropdownContextProvider position={position}>\n {header}\n {children}\n {footer}\n </DropdownContextProvider>\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nconst Dropdown = ({\n children,\n trigger,\n open,\n onDropdownClose,\n onMouseDown,\n header,\n footer,\n dropdownId,\n stretchTriggerHeight = false,\n stretchWidth = true,\n stretchHeight = false,\n stretchToTriggerWidth = true,\n expandToViewport = false,\n preferCenter = false,\n interior = false,\n minWidth,\n scrollable = true,\n trapFocus = false,\n contentKey,\n}: DropdownProps) => {\n const triggerRef = useRef<HTMLDivElement>(null);\n const dropdownRef = useRef<HTMLDivElement>(null);\n // This container is only needed to apply max-height to. We can't move max-height to it's parent\n // because of an IE11 issue with flexbox. https://github.com/philipwalton/flexbugs/issues/216\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 const setDropdownPosition = (\n position: DropdownPosition | InteriorDropdownPosition,\n triggerBox: DOMRect,\n target: HTMLDivElement,\n verticalContainer: HTMLDivElement\n ) => {\n const entireWidth = !interior && stretchWidth;\n if (!stretchWidth) {\n // 1px offset for dropdowns where the dropdown itself needs a border, rather than on the items\n verticalContainer.style.maxHeight = `${parseInt(position.height) + 1}px`;\n } else {\n verticalContainer.style.maxHeight = position.height;\n }\n\n if (entireWidth && !expandToViewport) {\n if (stretchToTriggerWidth) {\n target.classList.add(styles['occupy-entire-width']);\n }\n } else {\n target.style.width = position.width;\n }\n // Using styles for main dropdown to adjust its position as preferred alternative\n if (position.dropUp && !interior) {\n target.classList.add(styles['dropdown-drop-up']);\n if (!expandToViewport) {\n target.style.bottom = '100%';\n }\n } else {\n target.classList.remove(styles['dropdown-drop-up']);\n }\n target.classList.add(position.dropLeft ? styles['dropdown-drop-left'] : styles['dropdown-drop-right']);\n\n if (position.left && position.left !== 'auto') {\n target.style.left = position.left;\n }\n\n // Position normal overflow dropdowns with fixed positioning relative to viewport\n if (expandToViewport && !interior) {\n target.style.position = 'fixed';\n if (position.dropUp) {\n target.style.bottom = `calc(100% - ${triggerBox.top}px)`;\n } else {\n target.style.top = `${triggerBox.bottom}px`;\n }\n if (position.dropLeft) {\n target.style.left = `calc(${triggerBox.right}px - ${position.width})`;\n } else {\n target.style.left = `${triggerBox.left}px`;\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.dropUp) {\n target.style.bottom = position.bottom;\n } else {\n target.style.top = position.top;\n }\n target.style.left = position.left;\n }\n\n if (position.dropUp && position.dropLeft) {\n setPosition('top-left');\n } else if (position.dropUp) {\n setPosition('top-right');\n } else if (position.dropLeft) {\n setPosition('bottom-left');\n } else {\n setPosition('bottom-right');\n }\n };\n\n useLayoutEffect(() => {\n const onDropdownOpen = () => {\n if (open && dropdownRef.current && triggerRef.current && verticalContainerRef.current) {\n // calculate scroll width only for dropdowns that has a scrollbar and ignore it for date picker components\n if (scrollable) {\n dropdownRef.current.classList.add(styles.nowrap);\n }\n setDropdownPosition(\n ...calculatePosition(\n dropdownRef.current,\n triggerRef.current,\n verticalContainerRef.current,\n interior,\n expandToViewport,\n preferCenter,\n stretchWidth,\n stretchHeight,\n isMobile,\n minWidth\n ),\n dropdownRef.current,\n verticalContainerRef.current\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, stretchWidth, isMobile, contentKey]);\n\n // subscribe to outside click\n useEffect(() => {\n if (!open) {\n return;\n }\n const clickListener = (e: MouseEvent) => {\n if (!dropdownRef.current?.contains(e.target as Node)) {\n fireNonCancelableEvent(onDropdownClose);\n }\n };\n\n /*\n * This small delay allows the event that opened the dropdown to\n * finish bubbling, so that it is not immediately captured here.\n */\n const timeout = setTimeout(() => {\n window.addEventListener('click', clickListener);\n }, 0);\n\n return () => {\n clearTimeout(timeout);\n window.removeEventListener('click', clickListener);\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) {\n const triggerRect = triggerRef.current.getBoundingClientRect();\n const target = dropdownRef.current;\n if (fixedPosition.current) {\n if (fixedPosition.current.dropUp) {\n dropdownRef.current.style.bottom = `calc(100% - ${triggerRect.top}px)`;\n } else {\n target.style.top = `${triggerRect.bottom}px`;\n }\n if (fixedPosition.current.dropLeft) {\n target.style.left = `calc(${triggerRect.right}px - ${fixedPosition.current.width})`;\n } else {\n target.style.left = `${triggerRect.left}px`;\n }\n }\n }\n };\n\n updateDropdownPosition();\n\n window.addEventListener('scroll', updateDropdownPosition, true);\n window.addEventListener('resize', updateDropdownPosition, true);\n return () => {\n window.removeEventListener('scroll', updateDropdownPosition, true);\n window.removeEventListener('resize', updateDropdownPosition, true);\n };\n }, [open, expandToViewport]);\n\n return (\n <div\n className={clsx(\n styles.root,\n interior && styles.interior,\n stretchTriggerHeight && styles['stretch-trigger-height']\n )}\n >\n <div 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 || !trapFocus}\n />\n\n <DropdownContainer renderWithPortal={expandToViewport && !interior} id={dropdownId} open={open}>\n <Transition in={open ?? false} exit={false}>\n {(state, ref) => (\n <div onBlur={event => trapFocus && event.stopPropagation()}>\n <TabTrap\n focusNextCallback={() => triggerRef.current && getLastFocusable(triggerRef.current)?.focus()}\n disabled={!open || !trapFocus}\n />\n\n <TransitionContent\n state={state}\n transitionRef={ref}\n dropdownClasses={dropdownClasses}\n open={open}\n stretchWidth={stretchWidth}\n interior={interior}\n header={header}\n expandToViewport={expandToViewport}\n footer={footer}\n onMouseDown={onMouseDown}\n isRefresh={isRefresh}\n dropdownRef={dropdownRef}\n verticalContainerRef={verticalContainerRef}\n position={position}\n >\n {children}\n </TransitionContent>\n\n <TabTrap\n focusNextCallback={() => triggerRef.current && getFirstFocusable(triggerRef.current)?.focus()}\n disabled={!open || !trapFocus}\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).bottom !== undefined;\n\nexport default Dropdown;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAA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AE,CAAC,IAAI,IAAI,CAAC,SAAS,GAC7B,CACE,CACP,EA/BgB,CA+BhB,CACU,CACK,CAChB,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,IAAM,kBAAkB,GAAG,UACzB,QAAqD,IACZ,OAAC,QAAqC,CAAC,MAAM,KAAK,SAAS,EAA3D,CAA2D,CAAC;AAEvG,eAAe,QAAQ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport styles from './styles.css.js';\nimport clsx from 'clsx';\nimport { useMergeRefs } from '../../hooks/use-merge-refs';\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { fireNonCancelableEvent } from '../../events';\nimport { DropdownProps } from './interfaces';\nimport { DropdownPosition, InteriorDropdownPosition, calculatePosition } from './dropdown-fit-handler';\nimport { Transition, TransitionStatus } from '../transition';\nimport { useVisualRefresh } from '../../hooks/use-visual-mode';\nimport { usePortalModeClasses } from '../../hooks/use-portal-mode-classes';\nimport { DropdownContextProvider, DropdownContextProviderProps } from './context';\nimport { useMobile } from '../../hooks/use-mobile';\nimport TabTrap from '../tab-trap/index.js';\nimport { getFirstFocusable, getLastFocusable } from '../focus-lock/utils.js';\n\ninterface DropdownContainerProps {\n children?: React.ReactNode;\n renderWithPortal?: boolean;\n id?: string;\n open?: boolean;\n}\n\nconst DropdownContainer = ({ children, renderWithPortal = false, id, open }: DropdownContainerProps) => {\n if (renderWithPortal) {\n if (open) {\n return createPortal(<div id={id}>{children}</div>, document.body);\n } else {\n return null;\n }\n } else {\n return <>{children}</>;\n }\n};\n\ninterface TransitionContentProps {\n state: TransitionStatus;\n transitionRef: React.MutableRefObject<any>;\n dropdownClasses: string;\n stretchWidth: boolean;\n interior: boolean;\n isRefresh: boolean;\n dropdownRef: React.RefObject<HTMLDivElement>;\n verticalContainerRef: React.RefObject<HTMLDivElement>;\n expandToViewport?: boolean;\n header?: React.ReactNode;\n children?: React.ReactNode;\n footer?: React.ReactNode;\n position?: DropdownContextProviderProps['position'];\n open?: boolean;\n onMouseDown?: React.MouseEventHandler<Element>;\n}\n\nconst TransitionContent = ({\n state,\n transitionRef,\n dropdownClasses,\n stretchWidth,\n interior,\n isRefresh,\n dropdownRef,\n verticalContainerRef,\n expandToViewport,\n header,\n children,\n footer,\n position,\n open,\n onMouseDown,\n}: TransitionContentProps) => {\n const contentRef = useMergeRefs(dropdownRef, transitionRef);\n return (\n <div\n className={clsx(styles.dropdown, dropdownClasses, {\n [styles.open]: open,\n [styles['with-limited-width']]: !stretchWidth,\n [styles['hide-upper-border']]: stretchWidth,\n [styles.interior]: interior,\n [styles['is-empty']]: !header && !children,\n [styles.refresh]: isRefresh,\n [styles['use-portal']]: expandToViewport && !interior,\n })}\n ref={contentRef}\n data-open={open}\n data-animating={state !== 'exited'}\n aria-hidden={!open}\n onMouseDown={onMouseDown}\n >\n <div className={clsx(styles['dropdown-content-wrapper'], isRefresh && styles.refresh)}>\n <div className={styles['ie11-wrapper']}>\n <div ref={verticalContainerRef} className={styles['dropdown-content']}>\n <DropdownContextProvider position={position}>\n {header}\n {children}\n {footer}\n </DropdownContextProvider>\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nconst Dropdown = ({\n children,\n trigger,\n open,\n onDropdownClose,\n onMouseDown,\n header,\n footer,\n dropdownId,\n stretchTriggerHeight = false,\n stretchWidth = true,\n stretchHeight = false,\n stretchToTriggerWidth = true,\n expandToViewport = false,\n preferCenter = false,\n interior = false,\n minWidth,\n scrollable = true,\n trapFocus = false,\n contentKey,\n}: DropdownProps) => {\n const triggerRef = useRef<HTMLDivElement>(null);\n const dropdownRef = useRef<HTMLDivElement>(null);\n // This container is only needed to apply max-height to. We can't move max-height to it's parent\n // because of an IE11 issue with flexbox. https://github.com/philipwalton/flexbugs/issues/216\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 const setDropdownPosition = (\n position: DropdownPosition | InteriorDropdownPosition,\n triggerBox: DOMRect,\n target: HTMLDivElement,\n verticalContainer: HTMLDivElement\n ) => {\n const entireWidth = !interior && stretchWidth;\n if (!stretchWidth) {\n // 1px offset for dropdowns where the dropdown itself needs a border, rather than on the items\n verticalContainer.style.maxHeight = `${parseInt(position.height) + 1}px`;\n } else {\n verticalContainer.style.maxHeight = position.height;\n }\n\n if (entireWidth && !expandToViewport) {\n if (stretchToTriggerWidth) {\n target.classList.add(styles['occupy-entire-width']);\n }\n } else {\n target.style.width = position.width;\n }\n // Using styles for main dropdown to adjust its position as preferred alternative\n if (position.dropUp && !interior) {\n target.classList.add(styles['dropdown-drop-up']);\n if (!expandToViewport) {\n target.style.bottom = '100%';\n }\n } else {\n target.classList.remove(styles['dropdown-drop-up']);\n }\n target.classList.add(position.dropLeft ? styles['dropdown-drop-left'] : styles['dropdown-drop-right']);\n\n if (position.left && position.left !== 'auto') {\n target.style.left = position.left;\n }\n\n // Position normal overflow dropdowns with fixed positioning relative to viewport\n if (expandToViewport && !interior) {\n target.style.position = 'fixed';\n if (position.dropUp) {\n target.style.bottom = `calc(100% - ${triggerBox.top}px)`;\n } else {\n target.style.top = `${triggerBox.bottom}px`;\n }\n if (position.dropLeft) {\n target.style.left = `calc(${triggerBox.right}px - ${position.width})`;\n } else {\n target.style.left = `${triggerBox.left}px`;\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.dropUp) {\n target.style.bottom = position.bottom;\n } else {\n target.style.top = position.top;\n }\n target.style.left = position.left;\n }\n\n if (position.dropUp && position.dropLeft) {\n setPosition('top-left');\n } else if (position.dropUp) {\n setPosition('top-right');\n } else if (position.dropLeft) {\n setPosition('bottom-left');\n } else {\n setPosition('bottom-right');\n }\n };\n\n useLayoutEffect(() => {\n const onDropdownOpen = () => {\n if (open && dropdownRef.current && triggerRef.current && verticalContainerRef.current) {\n // calculate scroll width only for dropdowns that has a scrollbar and ignore it for date picker components\n if (scrollable) {\n dropdownRef.current.classList.add(styles.nowrap);\n }\n setDropdownPosition(\n ...calculatePosition(\n dropdownRef.current,\n triggerRef.current,\n verticalContainerRef.current,\n interior,\n expandToViewport,\n preferCenter,\n stretchWidth,\n stretchHeight,\n isMobile,\n minWidth\n ),\n dropdownRef.current,\n verticalContainerRef.current\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, stretchWidth, isMobile, contentKey]);\n\n // subscribe to outside click\n useEffect(() => {\n if (!open) {\n return;\n }\n const clickListener = (e: MouseEvent) => {\n if (!dropdownRef.current?.contains(e.target as Node)) {\n fireNonCancelableEvent(onDropdownClose);\n }\n };\n\n /*\n * This small delay allows the event that opened the dropdown to\n * finish bubbling, so that it is not immediately captured here.\n */\n const timeout = setTimeout(() => {\n window.addEventListener('click', clickListener);\n }, 0);\n\n return () => {\n clearTimeout(timeout);\n window.removeEventListener('click', clickListener);\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) {\n const triggerRect = triggerRef.current.getBoundingClientRect();\n const target = dropdownRef.current;\n if (fixedPosition.current) {\n if (fixedPosition.current.dropUp) {\n dropdownRef.current.style.bottom = `calc(100% - ${triggerRect.top}px)`;\n } else {\n target.style.top = `${triggerRect.bottom}px`;\n }\n if (fixedPosition.current.dropLeft) {\n target.style.left = `calc(${triggerRect.right}px - ${fixedPosition.current.width})`;\n } else {\n target.style.left = `${triggerRect.left}px`;\n }\n }\n }\n };\n\n updateDropdownPosition();\n\n window.addEventListener('scroll', updateDropdownPosition, true);\n window.addEventListener('resize', updateDropdownPosition, true);\n return () => {\n window.removeEventListener('scroll', updateDropdownPosition, true);\n window.removeEventListener('resize', updateDropdownPosition, true);\n };\n }, [open, expandToViewport]);\n\n return (\n <div\n className={clsx(\n styles.root,\n interior && styles.interior,\n stretchTriggerHeight && styles['stretch-trigger-height']\n )}\n >\n <div 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 || !trapFocus}\n />\n\n <DropdownContainer renderWithPortal={expandToViewport && !interior} id={dropdownId} open={open}>\n <Transition in={open ?? false} exit={false}>\n {(state, ref) => (\n <div onBlur={event => trapFocus && event.stopPropagation()}>\n <TabTrap\n focusNextCallback={() => triggerRef.current && getLastFocusable(triggerRef.current)?.focus()}\n disabled={!open || !trapFocus}\n />\n\n <TransitionContent\n state={state}\n transitionRef={ref}\n dropdownClasses={dropdownClasses}\n open={open}\n stretchWidth={stretchWidth}\n interior={interior}\n header={header}\n expandToViewport={expandToViewport}\n footer={footer}\n onMouseDown={onMouseDown}\n isRefresh={isRefresh}\n dropdownRef={dropdownRef}\n verticalContainerRef={verticalContainerRef}\n position={position}\n >\n {children}\n </TransitionContent>\n\n <TabTrap\n focusNextCallback={() => triggerRef.current && getFirstFocusable(triggerRef.current)?.focus()}\n disabled={!open || !trapFocus}\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).bottom !== undefined;\n\nexport default Dropdown;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown-status/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAGtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown-status/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAGtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE,OAAO,EAAE,yBAAyB,EAA+C,MAAM,cAAc,CAAC;AAGtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGnD,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,yBAAyB,CAAC;IAC5C,aAAa,CAAC,EAAE,gBAAgB,CAAC;CAClC;AAED,iBAAS,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,eAMlE;AAED,aAAK,iBAAiB,GAAG,CAAC,EACxB,UAAU,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,OAAO,EACP,SAAS,EACT,OAAO,EACP,eAAe,EACf,aAAa,GACd,EAAE,2BAA2B,KAAK,oBAAoB,CAAC;AAExD,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;IAChC,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,iBAAiB,EAAE,iBAoD/B,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { __assign } from "tslib";
|
|
|
4
4
|
import React, { useRef } from 'react';
|
|
5
5
|
import InternalLink from '../../../link/internal';
|
|
6
6
|
import InternalStatusIndicator from '../../../status-indicator/internal';
|
|
7
|
-
import { fireNonCancelableEvent, fireCancelableEvent
|
|
7
|
+
import { fireNonCancelableEvent, fireCancelableEvent } from '../../events';
|
|
8
8
|
import { usePrevious } from '../../hooks/use-previous';
|
|
9
9
|
import styles from './styles.css.js';
|
|
10
10
|
function DropdownStatus(_a) {
|
|
@@ -21,9 +21,7 @@ export var useDropdownStatus = function (_a) {
|
|
|
21
21
|
statusResult.content = React.createElement(InternalStatusIndicator, { type: 'loading' }, loadingText);
|
|
22
22
|
}
|
|
23
23
|
else if (statusType === 'error') {
|
|
24
|
-
statusResult.content = (React.createElement("span", { ref: recoveryProps ? recoveryProps.ref : null, onBlur: function (event) {
|
|
25
|
-
return fireCancelableEvent(recoveryProps === null || recoveryProps === void 0 ? void 0 : recoveryProps.onBlur, { relatedTarget: getBlurEventRelatedTarget(event.nativeEvent) }, event);
|
|
26
|
-
} },
|
|
24
|
+
statusResult.content = (React.createElement("span", { ref: recoveryProps ? recoveryProps.ref : null, onBlur: function (event) { return fireCancelableEvent(recoveryProps === null || recoveryProps === void 0 ? void 0 : recoveryProps.onBlur, { relatedTarget: event.relatedTarget }, event); } },
|
|
27
25
|
React.createElement(InternalStatusIndicator, { type: "error", __animate: previousStatusType !== 'error' }, errorText),
|
|
28
26
|
' ',
|
|
29
27
|
recoveryText && (React.createElement(InternalLink, __assign({}, recoveryProps, { ref: linkRef, onFollow: function () { return fireNonCancelableEvent(onRecoveryClick); }, variant: "recovery", className: styles.recovery }), recoveryText))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown-status/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAGlD,OAAO,uBAAuB,MAAM,oCAAoC,CAAC;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown-status/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAGlD,OAAO,uBAAuB,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAA6B,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACtG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAkBrC,SAAS,cAAc,CAAC,EAA2C;QAAzC,QAAQ,cAAA;IAChC,OAAO,CACL,6BAAK,SAAS,EAAE,MAAM,CAAC,IAAI,eAAY,QAAQ,IAC5C,QAAQ,CACL,CACP,CAAC;AACJ,CAAC;AAsBD,MAAM,CAAC,IAAM,iBAAiB,GAAsB,UAAC,EAYpD;QAXC,UAAU,gBAAA,EACV,KAAK,WAAA,EACL,WAAW,iBAAA,E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AAS,EAAE,MAAM,CAAC,QAAQ,KAEzB,YAAY,CACA,CAChB,CACI,CACR,CAAC;KACH;SAAM,IAAI,OAAO,IAAI,KAAK,EAAE;QAC3B,YAAY,CAAC,OAAO,GAAG,KAAK,CAAC;KAC9B;SAAM,IAAI,SAAS,IAAI,OAAO,EAAE;QAC/B,YAAY,CAAC,OAAO,GAAG,OAAO,CAAC;KAChC;SAAM,IAAI,UAAU,KAAK,UAAU,IAAI,YAAY,EAAE;QACpD,YAAY,CAAC,OAAO,GAAG,YAAY,CAAC;QACpC,YAAY,CAAC,QAAQ,GAAG,KAAK,CAAC;KAC/B;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,eAAe,cAAc,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 { LinkProps } from '../../../link/interfaces';\nimport InternalLink from '../../../link/internal';\nimport { RecoveryLinkProp } from '../../../select/utils/use-select';\n\nimport InternalStatusIndicator from '../../../status-indicator/internal';\nimport { NonCancelableEventHandler, fireNonCancelableEvent, fireCancelableEvent } from '../../events';\nimport { usePrevious } from '../../hooks/use-previous';\n\nimport { DropdownStatusProps } from './interfaces';\nimport styles from './styles.css.js';\n\nexport { DropdownStatusProps };\n\nexport interface DropdownStatusPropsExtended extends DropdownStatusProps {\n isEmpty?: boolean;\n isNoMatch?: boolean;\n noMatch?: React.ReactNode;\n /**\n * Called when the user clicks the recovery button placed at the\n * bottom of the dropdown list in the error state. Use this to\n * retry a failed request or provide another option for the user\n * to recover from the error.\n */\n onRecoveryClick?: NonCancelableEventHandler;\n recoveryProps?: RecoveryLinkProp;\n}\n\nfunction DropdownStatus({ children }: { children: React.ReactNode }) {\n return (\n <div className={styles.root} aria-live=\"polite\">\n {children}\n </div>\n );\n}\n\ntype UseDropdownStatus = ({\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n onRecoveryClick,\n recoveryProps,\n}: DropdownStatusPropsExtended) => DropdownStatusResult;\n\ninterface DropdownStatusResult {\n isSticky: boolean;\n content: React.ReactNode | null;\n focusRecoveryLink: () => void;\n}\n\nexport const useDropdownStatus: UseDropdownStatus = ({\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n onRecoveryClick,\n recoveryProps,\n}) => {\n const linkRef = useRef<LinkProps.Ref | null>(null);\n const focusRecoveryLink = () => linkRef.current?.focus();\n const previousStatusType = usePrevious(statusType);\n const statusResult: DropdownStatusResult = { isSticky: true, content: null, focusRecoveryLink };\n\n if (statusType === 'loading') {\n statusResult.content = <InternalStatusIndicator type={'loading'}>{loadingText}</InternalStatusIndicator>;\n } else if (statusType === 'error') {\n statusResult.content = (\n <span\n ref={recoveryProps ? recoveryProps.ref : null}\n onBlur={event => fireCancelableEvent(recoveryProps?.onBlur, { relatedTarget: event.relatedTarget }, event)}\n >\n <InternalStatusIndicator type=\"error\" __animate={previousStatusType !== 'error'}>\n {errorText}\n </InternalStatusIndicator>{' '}\n {recoveryText && (\n <InternalLink\n {...recoveryProps}\n ref={linkRef}\n onFollow={() => fireNonCancelableEvent(onRecoveryClick)}\n variant=\"recovery\"\n className={styles.recovery}\n >\n {recoveryText}\n </InternalLink>\n )}\n </span>\n );\n } else if (isEmpty && empty) {\n statusResult.content = empty;\n } else if (isNoMatch && noMatch) {\n statusResult.content = noMatch;\n } else if (statusType === 'finished' && finishedText) {\n statusResult.content = finishedText;\n statusResult.isSticky = false;\n }\n\n return statusResult;\n};\n\nexport default DropdownStatus;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/options-list/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAgB,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAEL,yBAAyB,EACzB,sBAAsB,EACtB,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/options-list/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAgB,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAEL,yBAAyB,EACzB,sBAAsB,EACtB,aAAa,EAEd,MAAM,cAAc,CAAC;AAItB,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACvC;;OAEG;IACH,UAAU,CAAC,EAAE,yBAAyB,CAAC;IACvC,SAAS,CAAC,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;IAClD,MAAM,CAAC,EAAE,yBAAyB,CAAC;QAAE,aAAa,EAAE,IAAI,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IACnE,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC3C,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;;AAiFD,wBAA6C"}
|
|
@@ -5,7 +5,7 @@ import clsx from 'clsx';
|
|
|
5
5
|
import { useMergeRefs } from '../../hooks/use-merge-refs';
|
|
6
6
|
import React, { useEffect, useRef } from 'react';
|
|
7
7
|
import { getBaseProps } from '../../base-component';
|
|
8
|
-
import { fireNonCancelableEvent, fireKeyboardEvent,
|
|
8
|
+
import { fireNonCancelableEvent, fireKeyboardEvent, } from '../../events';
|
|
9
9
|
import { findUpUntil } from '../../utils/dom';
|
|
10
10
|
import styles from './styles.css.js';
|
|
11
11
|
var BOTTOM_TRIGGER_OFFSET = 80;
|
|
@@ -39,7 +39,7 @@ var OptionsList = function (_a, ref) {
|
|
|
39
39
|
_b[styles['decrease-top-margin']] = decreaseTopMargin,
|
|
40
40
|
_b));
|
|
41
41
|
var mergedRef = useMergeRefs(ref, menuRef);
|
|
42
|
-
return (React.createElement("ul", __assign({}, baseProps, nativeAttributes, { className: className, ref: mergedRef, style: { position: position }, role: role, onScroll: handleScroll, onKeyDown: function (event) { return onKeyDown && fireKeyboardEvent(onKeyDown, event); }, onMouseMove: function (event) { return onMouseMove === null || onMouseMove === void 0 ? void 0 : onMouseMove(getItemIndex(menuRef, event)); }, onMouseUp: function (event) { return onMouseUp === null || onMouseUp === void 0 ? void 0 : onMouseUp(getItemIndex(menuRef, event)); }, onBlur: function (event) { return fireNonCancelableEvent(onBlur, { relatedTarget:
|
|
42
|
+
return (React.createElement("ul", __assign({}, baseProps, nativeAttributes, { className: className, ref: mergedRef, style: { position: position }, role: role, onScroll: handleScroll, onKeyDown: function (event) { return onKeyDown && fireKeyboardEvent(onKeyDown, event); }, onMouseMove: function (event) { return onMouseMove === null || onMouseMove === void 0 ? void 0 : onMouseMove(getItemIndex(menuRef, event)); }, onMouseUp: function (event) { return onMouseUp === null || onMouseUp === void 0 ? void 0 : onMouseUp(getItemIndex(menuRef, event)); }, onBlur: function (event) { return fireNonCancelableEvent(onBlur, { relatedTarget: event.relatedTarget }); }, onFocus: function () { return fireNonCancelableEvent(onFocus); }, tabIndex: -1, "aria-labelledby": ariaLabelledby }), open && children));
|
|
43
43
|
};
|
|
44
44
|
export default React.forwardRef(OptionsList);
|
|
45
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/options-list/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAsB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EACL,sBAAsB,EAItB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/options-list/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAsB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EACL,sBAAsB,EAItB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAwBrC,IAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC,IAAM,YAAY,GAAG,UAAC,YAA0C,EAAE,KAAuB;IACvF,IAAM,MAAM,GAAG,WAAW,CACxB,KAAK,CAAC,MAAqB,EAC3B,UAAA,OAAO,IAAI,OAAA,OAAO,KAAK,YAAY,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAjE,CAAiE,CAC7E,CAAC;IACF,IAAM,WAAW,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAA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C,GAAC,MAAM,CAAC,qBAAqB,CAAC,IAAG,iBAAiB;YAClD,CAAC;IAEH,IAAM,SAAS,GAAG,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAE7C,OAAO,CACL,uCACM,SAAS,EACT,gBAAgB,IACpB,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,EAAE,QAAQ,UAAA,EAAE,EACnB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,UAAA,KAAK,IAAI,OAAA,SAAS,IAAI,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC,EAAhD,CAAgD,EACpE,WAAW,EAAE,UAAA,KAAK,IAAI,OAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,EAA3C,CAA2C,EACjE,SAAS,EAAE,UAAA,KAAK,IAAI,OAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAG,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,EAAzC,CAAyC,EAC7D,MAAM,EAAE,UAAA,KAAK,IAAI,OAAA,sBAAsB,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,EAAtE,CAAsE,EACvF,OAAO,EAAE,cAAM,OAAA,sBAAsB,CAAC,OAAO,CAAC,EAA/B,CAA+B,EAC9C,QAAQ,EAAE,CAAC,CAAC,qBACK,cAAc,KAE9B,IAAI,IAAI,QAAQ,CACd,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport { useMergeRefs } from '../../hooks/use-merge-refs';\nimport React, { useEffect, useRef } from 'react';\nimport { BaseComponentProps, getBaseProps } from '../../base-component';\nimport {\n fireNonCancelableEvent,\n NonCancelableEventHandler,\n CancelableEventHandler,\n BaseKeyDetail,\n fireKeyboardEvent,\n} from '../../events';\nimport { findUpUntil } from '../../utils/dom';\nimport styles from './styles.css.js';\n\nexport interface OptionsListProps extends BaseComponentProps {\n open?: boolean;\n /**\n * Options list\n */\n children: React.ReactNode;\n nativeAttributes?: Record<string, any>;\n /**\n * Called when more items need to be loaded.\n */\n onLoadMore?: NonCancelableEventHandler;\n onKeyDown?: CancelableEventHandler<BaseKeyDetail>;\n onBlur?: NonCancelableEventHandler<{ relatedTarget: Node | null }>;\n onFocus?: NonCancelableEventHandler;\n onMouseUp?: (itemIndex: number) => void;\n onMouseMove?: (itemIndex: number) => void;\n position?: React.CSSProperties['position'];\n role?: 'listbox' | 'list' | 'menu';\n ariaLabelledby?: string;\n decreaseTopMargin?: boolean;\n}\n\nconst BOTTOM_TRIGGER_OFFSET = 80;\n\nconst getItemIndex = (containerRef: React.RefObject<HTMLElement>, event: React.MouseEvent) => {\n const target = findUpUntil(\n event.target as HTMLElement,\n element => element === containerRef.current || !!element.dataset.mouseTarget\n );\n const mouseTarget = target?.dataset.mouseTarget;\n return mouseTarget ? parseInt(mouseTarget) : -1;\n};\n\nconst OptionsList = (\n {\n open,\n children,\n nativeAttributes = {},\n onKeyDown,\n onBlur,\n onFocus,\n onLoadMore,\n onMouseUp,\n onMouseMove,\n position = 'relative',\n role = 'listbox',\n decreaseTopMargin = false,\n ariaLabelledby,\n ...restProps\n }: OptionsListProps,\n ref: React.Ref<HTMLUListElement>\n) => {\n const baseProps = getBaseProps(restProps);\n const menuRef = useRef<HTMLUListElement>(null);\n\n const handleScroll = () => {\n const scrollContainer = menuRef?.current;\n if (scrollContainer) {\n const bottomEdgePosition = scrollContainer.scrollTop + scrollContainer.clientHeight;\n const remainingScrollHeight = scrollContainer.scrollHeight - bottomEdgePosition;\n if (remainingScrollHeight < BOTTOM_TRIGGER_OFFSET) {\n fireNonCancelableEvent(onLoadMore);\n }\n }\n };\n\n useEffect(() => {\n if (!open) {\n return;\n }\n handleScroll();\n });\n\n const className = clsx(styles['options-list'], {\n [styles['decrease-top-margin']]: decreaseTopMargin,\n });\n\n const mergedRef = useMergeRefs(ref, menuRef);\n\n return (\n <ul\n {...baseProps}\n {...nativeAttributes}\n className={className}\n ref={mergedRef}\n style={{ position }}\n role={role}\n onScroll={handleScroll}\n onKeyDown={event => onKeyDown && fireKeyboardEvent(onKeyDown, event)}\n onMouseMove={event => onMouseMove?.(getItemIndex(menuRef, event))}\n onMouseUp={event => onMouseUp?.(getItemIndex(menuRef, event))}\n onBlur={event => fireNonCancelableEvent(onBlur, { relatedTarget: event.relatedTarget })}\n onFocus={() => fireNonCancelableEvent(onFocus)}\n tabIndex={-1}\n aria-labelledby={ariaLabelledby}\n >\n {open && children}\n </ul>\n );\n};\n\nexport default React.forwardRef(OptionsList);\n"]}
|
package/internal/environment.js
CHANGED
|
@@ -27,13 +27,4 @@ export declare function fireNonCancelableEvent<T = null>(handler: NonCancelableE
|
|
|
27
27
|
export declare function fireCancelableEvent<T>(handler: CancelableEventHandler<T> | undefined, detail: T, sourceEvent?: React.SyntheticEvent | Event): boolean;
|
|
28
28
|
export declare function fireKeyboardEvent(handler: CancelableEventHandler<BaseKeyDetail>, reactEvent: React.KeyboardEvent): boolean;
|
|
29
29
|
export declare function isPlainLeftClick(event?: React.MouseEvent | React.KeyboardEvent): boolean | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Returns the element the focus is going to, when a blur event is fired.
|
|
32
|
-
* IE11 does not support `realtedTarget` on blur FocusEvent's. However, it
|
|
33
|
-
* moves the focus before the blur event is fired, so we can get the needed
|
|
34
|
-
* element by accessing `document.activeElement`
|
|
35
|
-
* @param event FocusEvent - native focus event
|
|
36
|
-
* @returns Node | null - the element recieving the focus
|
|
37
|
-
*/
|
|
38
|
-
export declare const getBlurEventRelatedTarget: (event: FocusEvent) => Node | null;
|
|
39
30
|
//# sourceMappingURL=index.d.ts.map
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EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAE/F;AAED,wBAAgB,sBAAsB,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,yBAAyB,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,QAM7G;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,SAAS,EAC9C,MAAM,EAAE,CAAC,EACT,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,GAAG,KAAK,WAc3C;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,CAAC,aAAa,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,aAAa,WAahH;AAMD,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,aAAa,uBAS9E"}
|
package/internal/events/index.js
CHANGED
|
@@ -61,15 +61,4 @@ export function isPlainLeftClick(event) {
|
|
|
61
61
|
!event.shiftKey &&
|
|
62
62
|
!event.metaKey);
|
|
63
63
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Returns the element the focus is going to, when a blur event is fired.
|
|
66
|
-
* IE11 does not support `realtedTarget` on blur FocusEvent's. However, it
|
|
67
|
-
* moves the focus before the blur event is fired, so we can get the needed
|
|
68
|
-
* element by accessing `document.activeElement`
|
|
69
|
-
* @param event FocusEvent - native focus event
|
|
70
|
-
* @returns Node | null - the element recieving the focus
|
|
71
|
-
*/
|
|
72
|
-
export var getBlurEventRelatedTarget = function (event) {
|
|
73
|
-
return (event.relatedTarget || document.activeElement);
|
|
74
|
-
};
|
|
75
64
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/events/index.ts"],"names":[],"mappings":"AAYA;IAGE,yBAAmB,UAA2B,EAAS,MAAuB;QAA3D,2BAAA,EAAA,kBAA2B;QAAS,uBAAA,EAAA,aAAuB;QAA3D,eAAU,GAAV,UAAU,CAAiB;QAAS,WAAM,GAAN,MAAM,CAAiB;QAF9E,qBAAgB,GAAG,KAAK,CAAC;QACzB,iBAAY,GAAG,KAAK,CAAC;IAC4D,CAAC;IAElF,wCAAc,GAAd;QACE,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED,yCAAe,GAAf;QACE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3B,CAAC;IACH,sBAAC;AAAD,CAAC,AAZD,IAYC;AAyBD,MAAM,UAAU,iBAAiB,CAAI,EAA0C;QAAxC,UAAU,gBAAA,EAAE,MAAM,YAAA;IACvD,OAAO,IAAI,eAAe,CAAC,UAAU,EAAE,MAAM,CAAgB,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAW,OAAiD,EAAE,MAAU;IAC5G,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO;KACR;IACD,IAAM,KAAK,GAAG,iBAAiB,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;IAC/D,OAAO,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,OAA8C,EAC9C,MAAS,EACT,WAA0C;IAE1C,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAC;KACd;IACD,IAAM,KAAK,GAAG,iBAAiB,CAAC,EAAE,UAAU,EAAE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U,iBAAiB,CAAC,OAA8C,EAAE,UAA+B;IAC/G,OAAO,mBAAmB,CACxB,OAAO,EACP;QACE,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,GAAG,EAAE,UAAU,CAAC,GAAG;QACnB,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,OAAO,EAAE,UAAU,CAAC,OAAO;KAC5B,EACD,UAAU,CACX,CAAC;AACJ,CAAC;AAED,IAAM,YAAY,GAAG,UAAC,CAAyC;IAC7D,OAAQ,CAAsB,CAAC,MAAM,KAAK,SAAS,CAAC;AACtD,CAAC,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,KAA8C;IAC7E,OAAO,CACL,KAAK;QACL,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;QAC5C,CAAC,KAAK,CAAC,OAAO;QACd,CAAC,KAAK,CAAC,MAAM;QACb,CAAC,KAAK,CAAC,QAAQ;QACf,CAAC,KAAK,CAAC,OAAO,CACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\n// This is a part of our public types API. We cannot change this in the current major version\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type NonCancelableEventHandler<Detail = {}> = (event: NonCancelableCustomEvent<Detail>) => void;\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type CancelableEventHandler<Detail = {}> = (event: CustomEvent<Detail>) => void;\n\nexport type NonCancelableCustomEvent<DetailType> = Omit<CustomEvent<DetailType>, 'preventDefault'>;\n\nclass CustomEventStub<T> {\n defaultPrevented = false;\n cancelBubble = false;\n constructor(public cancelable: boolean = false, public detail: T | null = null) {}\n\n preventDefault() {\n this.defaultPrevented = true;\n }\n\n stopPropagation() {\n this.cancelBubble = true;\n }\n}\n\nexport interface BaseKeyDetail {\n keyCode: number;\n key: string;\n ctrlKey: boolean;\n shiftKey: boolean;\n altKey: boolean;\n metaKey: boolean;\n}\n\nexport interface ClickDetail {\n button: number;\n ctrlKey: boolean;\n shiftKey: boolean;\n altKey: boolean;\n metaKey: boolean;\n}\n\nexport interface BaseNavigationDetail {\n href: string | undefined;\n external?: boolean;\n target?: string;\n}\n\nexport function createCustomEvent<T>({ cancelable, detail }: CustomEventInit<T>): CustomEvent<T> {\n return new CustomEventStub(cancelable, detail) as CustomEvent;\n}\n\nexport function fireNonCancelableEvent<T = null>(handler: NonCancelableEventHandler<T> | undefined, detail?: T) {\n if (!handler) {\n return;\n }\n const event = createCustomEvent({ cancelable: false, detail });\n handler(event);\n}\n\nexport function fireCancelableEvent<T>(\n handler: CancelableEventHandler<T> | undefined,\n detail: T,\n sourceEvent?: React.SyntheticEvent | Event\n) {\n if (!handler) {\n return false;\n }\n const event = createCustomEvent({ cancelable: true, detail });\n handler(event);\n if (event.defaultPrevented && sourceEvent) {\n sourceEvent.preventDefault();\n }\n if (event.cancelBubble && sourceEvent) {\n sourceEvent.stopPropagation();\n }\n return event.defaultPrevented;\n}\n\nexport function fireKeyboardEvent(handler: CancelableEventHandler<BaseKeyDetail>, reactEvent: React.KeyboardEvent) {\n return fireCancelableEvent(\n handler,\n {\n keyCode: reactEvent.keyCode,\n key: reactEvent.key,\n ctrlKey: reactEvent.ctrlKey,\n shiftKey: reactEvent.shiftKey,\n altKey: reactEvent.altKey,\n metaKey: reactEvent.metaKey,\n },\n reactEvent\n );\n}\n\nconst isMouseEvent = (e: React.MouseEvent | React.KeyboardEvent): e is React.MouseEvent => {\n return (e as React.MouseEvent).button !== undefined;\n};\n\nexport function isPlainLeftClick(event?: React.MouseEvent | React.KeyboardEvent) {\n return (\n event &&\n (!isMouseEvent(event) || event.button === 0) &&\n !event.ctrlKey &&\n !event.altKey &&\n !event.shiftKey &&\n !event.metaKey\n );\n}\n"]}
|
|
@@ -1154,6 +1154,10 @@ module.exports.preset = {
|
|
|
1154
1154
|
"light": "{colorGrey500}",
|
|
1155
1155
|
"dark": "{colorGrey450}"
|
|
1156
1156
|
},
|
|
1157
|
+
"colorBorderDividerInteractiveDefault": {
|
|
1158
|
+
"light": "{colorBorderDividerDefault}",
|
|
1159
|
+
"dark": "{colorBorderDividerDefault}"
|
|
1160
|
+
},
|
|
1157
1161
|
"colorBorderTabsDivider": {
|
|
1158
1162
|
"light": "{colorGrey200}",
|
|
1159
1163
|
"dark": "{colorGrey600}"
|
|
@@ -2674,6 +2678,10 @@ module.exports.preset = {
|
|
|
2674
2678
|
"light": "{colorGrey450}",
|
|
2675
2679
|
"dark": "{colorGrey450}"
|
|
2676
2680
|
},
|
|
2681
|
+
"colorBorderDividerInteractiveDefault": {
|
|
2682
|
+
"light": "{colorBorderDividerDefault}",
|
|
2683
|
+
"dark": "{colorBorderDividerDefault}"
|
|
2684
|
+
},
|
|
2677
2685
|
"colorBorderTabsDivider": {
|
|
2678
2686
|
"light": "{colorGrey600}",
|
|
2679
2687
|
"dark": "{colorGrey600}"
|
|
@@ -3576,6 +3584,10 @@ module.exports.preset = {
|
|
|
3576
3584
|
"light": "{colorGrey450}",
|
|
3577
3585
|
"dark": "{colorGrey450}"
|
|
3578
3586
|
},
|
|
3587
|
+
"colorBorderDividerInteractiveDefault": {
|
|
3588
|
+
"light": "{colorBorderDividerDefault}",
|
|
3589
|
+
"dark": "{colorBorderDividerDefault}"
|
|
3590
|
+
},
|
|
3579
3591
|
"colorBorderTabsDivider": {
|
|
3580
3592
|
"light": "{colorGrey600}",
|
|
3581
3593
|
"dark": "{colorGrey600}"
|
|
@@ -4426,6 +4438,10 @@ module.exports.preset = {
|
|
|
4426
4438
|
"light": "{colorGrey500}",
|
|
4427
4439
|
"dark": "{colorGrey450}"
|
|
4428
4440
|
},
|
|
4441
|
+
"colorBorderDividerInteractiveDefault": {
|
|
4442
|
+
"light": "{colorBorderDividerDefault}",
|
|
4443
|
+
"dark": "{colorBorderDividerDefault}"
|
|
4444
|
+
},
|
|
4429
4445
|
"colorBorderTabsDivider": {
|
|
4430
4446
|
"light": "{colorGrey200}",
|
|
4431
4447
|
"dark": "{colorGrey600}"
|
|
@@ -5276,6 +5292,10 @@ module.exports.preset = {
|
|
|
5276
5292
|
"light": "{colorGrey500}",
|
|
5277
5293
|
"dark": "{colorGrey450}"
|
|
5278
5294
|
},
|
|
5295
|
+
"colorBorderDividerInteractiveDefault": {
|
|
5296
|
+
"light": "{colorBorderDividerDefault}",
|
|
5297
|
+
"dark": "{colorBorderDividerDefault}"
|
|
5298
|
+
},
|
|
5279
5299
|
"colorBorderTabsDivider": {
|
|
5280
5300
|
"light": "{colorGrey200}",
|
|
5281
5301
|
"dark": "{colorGrey600}"
|
|
@@ -5936,6 +5956,7 @@ module.exports.preset = {
|
|
|
5936
5956
|
"colorBorderStatusInfo": "color",
|
|
5937
5957
|
"colorBorderStatusSuccess": "color",
|
|
5938
5958
|
"colorBorderStatusWarning": "color",
|
|
5959
|
+
"colorBorderDividerInteractiveDefault": "color",
|
|
5939
5960
|
"colorBorderTabsDivider": "color",
|
|
5940
5961
|
"colorBorderTabsShadow": "color",
|
|
5941
5962
|
"colorBorderTabsUnderline": "color",
|
|
@@ -6936,6 +6957,7 @@ module.exports.preset = {
|
|
|
6936
6957
|
"colorBorderStatusInfo": "color-border-status-info",
|
|
6937
6958
|
"colorBorderStatusSuccess": "color-border-status-success",
|
|
6938
6959
|
"colorBorderStatusWarning": "color-border-status-warning",
|
|
6960
|
+
"colorBorderDividerInteractiveDefault": "color-border-divider-interactive-default",
|
|
6939
6961
|
"colorBorderTabsDivider": "color-border-tabs-divider",
|
|
6940
6962
|
"colorBorderTabsShadow": "color-border-tabs-shadow",
|
|
6941
6963
|
"colorBorderTabsUnderline": "color-border-tabs-underline",
|
|
@@ -7579,6 +7601,7 @@ module.exports.preset = {
|
|
|
7579
7601
|
"colorBorderStatusInfo": "--color-border-status-info-546i7i",
|
|
7580
7602
|
"colorBorderStatusSuccess": "--color-border-status-success-cqi45f",
|
|
7581
7603
|
"colorBorderStatusWarning": "--color-border-status-warning-hg85ut",
|
|
7604
|
+
"colorBorderDividerInteractiveDefault": "--color-border-divider-interactive-default-rcasvw",
|
|
7582
7605
|
"colorBorderTabsDivider": "--color-border-tabs-divider-69fx5i",
|
|
7583
7606
|
"colorBorderTabsShadow": "--color-border-tabs-shadow-4lmh2z",
|
|
7584
7607
|
"colorBorderTabsUnderline": "--color-border-tabs-underline-9bcfzu",
|
|
@@ -1154,6 +1154,10 @@ export var preset = {
|
|
|
1154
1154
|
"light": "{colorGrey500}",
|
|
1155
1155
|
"dark": "{colorGrey450}"
|
|
1156
1156
|
},
|
|
1157
|
+
"colorBorderDividerInteractiveDefault": {
|
|
1158
|
+
"light": "{colorBorderDividerDefault}",
|
|
1159
|
+
"dark": "{colorBorderDividerDefault}"
|
|
1160
|
+
},
|
|
1157
1161
|
"colorBorderTabsDivider": {
|
|
1158
1162
|
"light": "{colorGrey200}",
|
|
1159
1163
|
"dark": "{colorGrey600}"
|
|
@@ -2674,6 +2678,10 @@ export var preset = {
|
|
|
2674
2678
|
"light": "{colorGrey450}",
|
|
2675
2679
|
"dark": "{colorGrey450}"
|
|
2676
2680
|
},
|
|
2681
|
+
"colorBorderDividerInteractiveDefault": {
|
|
2682
|
+
"light": "{colorBorderDividerDefault}",
|
|
2683
|
+
"dark": "{colorBorderDividerDefault}"
|
|
2684
|
+
},
|
|
2677
2685
|
"colorBorderTabsDivider": {
|
|
2678
2686
|
"light": "{colorGrey600}",
|
|
2679
2687
|
"dark": "{colorGrey600}"
|
|
@@ -3576,6 +3584,10 @@ export var preset = {
|
|
|
3576
3584
|
"light": "{colorGrey450}",
|
|
3577
3585
|
"dark": "{colorGrey450}"
|
|
3578
3586
|
},
|
|
3587
|
+
"colorBorderDividerInteractiveDefault": {
|
|
3588
|
+
"light": "{colorBorderDividerDefault}",
|
|
3589
|
+
"dark": "{colorBorderDividerDefault}"
|
|
3590
|
+
},
|
|
3579
3591
|
"colorBorderTabsDivider": {
|
|
3580
3592
|
"light": "{colorGrey600}",
|
|
3581
3593
|
"dark": "{colorGrey600}"
|
|
@@ -4426,6 +4438,10 @@ export var preset = {
|
|
|
4426
4438
|
"light": "{colorGrey500}",
|
|
4427
4439
|
"dark": "{colorGrey450}"
|
|
4428
4440
|
},
|
|
4441
|
+
"colorBorderDividerInteractiveDefault": {
|
|
4442
|
+
"light": "{colorBorderDividerDefault}",
|
|
4443
|
+
"dark": "{colorBorderDividerDefault}"
|
|
4444
|
+
},
|
|
4429
4445
|
"colorBorderTabsDivider": {
|
|
4430
4446
|
"light": "{colorGrey200}",
|
|
4431
4447
|
"dark": "{colorGrey600}"
|
|
@@ -5276,6 +5292,10 @@ export var preset = {
|
|
|
5276
5292
|
"light": "{colorGrey500}",
|
|
5277
5293
|
"dark": "{colorGrey450}"
|
|
5278
5294
|
},
|
|
5295
|
+
"colorBorderDividerInteractiveDefault": {
|
|
5296
|
+
"light": "{colorBorderDividerDefault}",
|
|
5297
|
+
"dark": "{colorBorderDividerDefault}"
|
|
5298
|
+
},
|
|
5279
5299
|
"colorBorderTabsDivider": {
|
|
5280
5300
|
"light": "{colorGrey200}",
|
|
5281
5301
|
"dark": "{colorGrey600}"
|
|
@@ -5936,6 +5956,7 @@ export var preset = {
|
|
|
5936
5956
|
"colorBorderStatusInfo": "color",
|
|
5937
5957
|
"colorBorderStatusSuccess": "color",
|
|
5938
5958
|
"colorBorderStatusWarning": "color",
|
|
5959
|
+
"colorBorderDividerInteractiveDefault": "color",
|
|
5939
5960
|
"colorBorderTabsDivider": "color",
|
|
5940
5961
|
"colorBorderTabsShadow": "color",
|
|
5941
5962
|
"colorBorderTabsUnderline": "color",
|
|
@@ -6936,6 +6957,7 @@ export var preset = {
|
|
|
6936
6957
|
"colorBorderStatusInfo": "color-border-status-info",
|
|
6937
6958
|
"colorBorderStatusSuccess": "color-border-status-success",
|
|
6938
6959
|
"colorBorderStatusWarning": "color-border-status-warning",
|
|
6960
|
+
"colorBorderDividerInteractiveDefault": "color-border-divider-interactive-default",
|
|
6939
6961
|
"colorBorderTabsDivider": "color-border-tabs-divider",
|
|
6940
6962
|
"colorBorderTabsShadow": "color-border-tabs-shadow",
|
|
6941
6963
|
"colorBorderTabsUnderline": "color-border-tabs-underline",
|
|
@@ -7579,6 +7601,7 @@ export var preset = {
|
|
|
7579
7601
|
"colorBorderStatusInfo": "--color-border-status-info-546i7i",
|
|
7580
7602
|
"colorBorderStatusSuccess": "--color-border-status-success-cqi45f",
|
|
7581
7603
|
"colorBorderStatusWarning": "--color-border-status-warning-hg85ut",
|
|
7604
|
+
"colorBorderDividerInteractiveDefault": "--color-border-divider-interactive-default-rcasvw",
|
|
7582
7605
|
"colorBorderTabsDivider": "--color-border-tabs-divider-69fx5i",
|
|
7583
7606
|
"colorBorderTabsShadow": "--color-border-tabs-shadow-4lmh2z",
|
|
7584
7607
|
"colorBorderTabsUnderline": "--color-border-tabs-underline-9bcfzu",
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/pagination/internal.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/pagination/internal.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AA8D/C,aAAK,uBAAuB,GAAG,eAAe,GAAG,0BAA0B,CAAC;AAE5E,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,mBAAmB,EACnB,iBAAwB,EACxB,GAAG,IAAI,EACR,EAAE,uBAAuB,eA+EzB"}
|
package/pagination/internal.js
CHANGED
|
@@ -22,7 +22,7 @@ function PageButton(_a) {
|
|
|
22
22
|
onClick(pageIndex);
|
|
23
23
|
}
|
|
24
24
|
return (React.createElement("li", { className: styles['page-item'] },
|
|
25
|
-
React.createElement("button", __assign({}, focusVisible, { className: clsx(className, styles.button, disabled && styles['button-disabled'], isCurrent && styles['button-current']), type: "button", "aria-label": ariaLabel,
|
|
25
|
+
React.createElement("button", __assign({}, focusVisible, { className: clsx(className, styles.button, disabled && styles['button-disabled'], isCurrent && styles['button-current']), type: "button", "aria-label": ariaLabel, disabled: disabled, onClick: handleClick, "aria-current": isCurrent }), children)));
|
|
26
26
|
}
|
|
27
27
|
function PageNumber(_a) {
|
|
28
28
|
var pageIndex = _a.pageIndex, rest = __rest(_a, ["pageIndex"]);
|