@cloudscape-design/components 3.0.27 → 3.0.28
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/alert/internal.d.ts.map +1 -1
- package/alert/internal.js +3 -4
- package/alert/internal.js.map +1 -1
- package/app-layout/index.js +1 -1
- package/app-layout/index.js.map +1 -1
- package/cards/index.js +1 -1
- package/cards/index.js.map +1 -1
- package/code-editor/index.d.ts.map +1 -1
- package/code-editor/index.js +2 -3
- package/code-editor/index.js.map +1 -1
- package/container/internal.js +1 -1
- package/container/internal.js.map +1 -1
- package/container/use-sticky-header.js +1 -1
- package/container/use-sticky-header.js.map +1 -1
- package/flashbar/index.js +1 -1
- package/flashbar/index.js.map +1 -1
- package/form-field/internal.d.ts.map +1 -1
- package/form-field/internal.js +3 -6
- package/form-field/internal.js.map +1 -1
- package/header/internal.d.ts.map +1 -1
- package/header/internal.js +3 -6
- package/header/internal.js.map +1 -1
- package/icon/internal.js +1 -1
- package/icon/internal.js.map +1 -1
- package/internal/components/checkbox-icon/index.d.ts.map +1 -1
- package/internal/components/checkbox-icon/index.js +3 -4
- package/internal/components/checkbox-icon/index.js.map +1 -1
- package/internal/components/content-layout/index.d.ts.map +1 -1
- package/internal/components/content-layout/index.js +3 -4
- package/internal/components/content-layout/index.js.map +1 -1
- package/internal/components/dropdown/index.js +1 -1
- package/internal/components/dropdown/index.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/hooks/use-mutation-observer/index.d.ts +5 -0
- package/internal/hooks/use-mutation-observer/index.d.ts.map +1 -1
- package/internal/hooks/use-mutation-observer/index.js +5 -0
- package/internal/hooks/use-mutation-observer/index.js.map +1 -1
- package/internal/hooks/use-portal-mode-classes/index.js +1 -1
- package/internal/hooks/use-portal-mode-classes/index.js.map +1 -1
- package/internal/hooks/use-singleton-handler/index.d.ts +2 -1
- package/internal/hooks/use-singleton-handler/index.d.ts.map +1 -1
- package/internal/hooks/use-singleton-handler/index.js.map +1 -1
- package/internal/hooks/use-visual-mode/index.d.ts +1 -1
- package/internal/hooks/use-visual-mode/index.d.ts.map +1 -1
- package/internal/hooks/use-visual-mode/index.js +16 -11
- package/internal/hooks/use-visual-mode/index.js.map +1 -1
- package/link/internal.js +3 -3
- package/link/internal.js.map +1 -1
- package/link/styles.css.js +19 -18
- package/link/styles.scoped.css +73 -69
- package/link/styles.selectors.js +19 -18
- package/mixed-line-bar-chart/bar-series.d.ts.map +1 -1
- package/mixed-line-bar-chart/bar-series.js +3 -4
- package/mixed-line-bar-chart/bar-series.js.map +1 -1
- package/mixed-line-bar-chart/chart-container.js +1 -1
- package/mixed-line-bar-chart/chart-container.js.map +1 -1
- package/mixed-line-bar-chart/interfaces.d.ts +5 -4
- package/mixed-line-bar-chart/interfaces.d.ts.map +1 -1
- package/mixed-line-bar-chart/interfaces.js.map +1 -1
- package/modal/internal.js +1 -1
- package/modal/internal.js.map +1 -1
- package/package.json +1 -1
- package/pie-chart/pie-chart.d.ts.map +1 -1
- package/pie-chart/pie-chart.js +2 -2
- package/pie-chart/pie-chart.js.map +1 -1
- package/pie-chart/segments.d.ts +1 -2
- package/pie-chart/segments.d.ts.map +1 -1
- package/pie-chart/segments.js +2 -2
- package/pie-chart/segments.js.map +1 -1
- package/popover/container.js +1 -1
- package/popover/container.js.map +1 -1
- package/property-filter/index.d.ts.map +1 -1
- package/property-filter/index.js +10 -2
- package/property-filter/index.js.map +1 -1
- package/radio-group/radio-button.d.ts.map +1 -1
- package/radio-group/radio-button.js +3 -4
- package/radio-group/radio-button.js.map +1 -1
- package/s3-resource-selector/s3-modal/index.d.ts.map +1 -1
- package/s3-resource-selector/s3-modal/index.js +2 -3
- package/s3-resource-selector/s3-modal/index.js.map +1 -1
- package/table/internal.js +1 -1
- package/table/internal.js.map +1 -1
- package/table/sticky-scrollbar.js +1 -1
- package/table/sticky-scrollbar.js.map +1 -1
- package/tabs/tab-header-bar.js +1 -1
- package/tabs/tab-header-bar.js.map +1 -1
- package/tutorial-panel/components/tutorial-detail-view/index.d.ts.map +1 -1
- package/tutorial-panel/components/tutorial-detail-view/index.js +3 -4
- package/tutorial-panel/components/tutorial-detail-view/index.js.map +1 -1
- package/tutorial-panel/components/tutorial-list/index.d.ts.map +1 -1
- package/tutorial-panel/components/tutorial-list/index.js +5 -7
- package/tutorial-panel/components/tutorial-list/index.js.map +1 -1
- package/wizard/index.d.ts.map +1 -1
- package/wizard/index.js +2 -3
- package/wizard/index.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-sticky-header.js","sourceRoot":"","sources":["../../../src/container/use-sticky-header.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAa,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7G,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,cAAc,MAAM,6CAA6C,CAAC;AAMzE,MAAM,CAAC,IAAM,mBAAmB,GAAG,aAAa,CAA2B,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;AAE/F,MAAM,CAAC,IAAM,eAAe,GAAG,UAC7B,OAAkC,EAClC,SAAoC,EACpC,cAAwB,EACxB,cAAuB;IAEvB,IAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IACvC,IAAM,gBAAgB,GAAG,SAAS,CAAC,OAAO,CAAC;IAC3C,IAAM,WAAW,GAAG,OAAO,CAAC;QAC1B,IAAM,mBAAmB,GAAG,cAAc;YACxC,CAAC,CAAC,QA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EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;IACtC,SAAS,CAAC;QACR,IAAI,QAAQ,EAAE;YACZ,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;YACtD,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YAChD,OAAO;gBACL,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;gBACzD,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YACrD,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;IAC7B,OAAO;QACL,QAAQ,UAAA;QACR,OAAO,SAAA;QACP,YAAY,cAAA;KACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,UAAU,uBAAuB;IACrC,IAAM,QAAQ,GAAG,SAAS,EAAE,CAAC;IAC7B,OAAO,sBAAsB,EAAE,IAAI,CAAC,QAAQ,CAAC;AAC/C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { RefObject, useState, useLayoutEffect, useCallback, useEffect, createContext, useMemo } from 'react';\nimport { useAppLayoutContext } from '../internal/context/app-layout-context';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { findUpUntil, supportsStickyPosition } from '../internal/utils/dom';\nimport { getOverflowParents } from '../internal/utils/scrollable-containers';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport customCssProps from '../internal/generated/custom-css-properties';\n\ninterface StickyHeaderContextProps {\n isStuck: boolean;\n}\n\nexport const StickyHeaderContext = createContext<StickyHeaderContextProps>({ isStuck: false });\n\nexport const useStickyHeader = (\n rootRef: RefObject<HTMLDivElement>,\n headerRef: RefObject<HTMLDivElement>,\n __stickyHeader?: boolean,\n __stickyOffset?: number\n) => {\n const currentRootRef = rootRef.current;\n const currentHeaderRef = headerRef.current;\n const totalBorder = useMemo(() => {\n const containerRootBorder = currentRootRef\n ? parseInt(getComputedStyle(currentRootRef).getPropertyValue('border-top-width'), 10)\n : 0;\n const headerBorder = currentHeaderRef\n ? parseInt(getComputedStyle(currentHeaderRef).getPropertyValue('border-top-width'), 10)\n : 0;\n return containerRootBorder + headerBorder;\n }, [currentRootRef, currentHeaderRef]);\n\n // We reach into AppLayoutContext in case sticky header needs to be offset down by the height\n // of other sticky elements positioned on top of the view.\n const { stickyOffsetTop } = useAppLayoutContext();\n const isSticky = useSupportsStickyHeader() && !!__stickyHeader;\n const isRefresh = useVisualRefresh();\n\n // If it has overflow parents inside the app layout, we shouldn't apply a sticky offset.\n const [hasInnerOverflowParents, setHasInnerOverflowParents] = useState(false);\n const [isStuck, setIsStuck] = useState(false);\n useLayoutEffect(() => {\n if (rootRef.current) {\n const overflowParents = getOverflowParents(rootRef.current);\n const mainElement = findUpUntil(rootRef.current, elem => elem.tagName === 'MAIN');\n // In both versions of the app layout, the scrolling element for disableBodyScroll\n // is the <main>. If the closest overflow parent is also the closest <main> and we have\n // offset values, it's safe to assume that it's the app layout scroll root and we\n // should stop there.\n setHasInnerOverflowParents(overflowParents.length > 0 && overflowParents[0] !== mainElement);\n }\n }, [rootRef]);\n\n const effectiveStickyOffset = __stickyOffset ?? (hasInnerOverflowParents ? 0 : stickyOffsetTop);\n\n /**\n * The AppLayout refactor removed the need for passing the sticky offset in px all the time through the\n * AppLayoutDomContext provider because that information already exists on the DOM in a custom property\n * on the Layout subcomponent. Thus, if the Container header is sticky, we are in Visual Refresh and use\n * body scroll then we will use that property. When a component is used outside AppLayout, we fall back\n * to the default offset calculated in AppLayoutDomContext.\n */\n let computedOffset = `${effectiveStickyOffset - totalBorder}px`;\n if (isRefresh && !hasInnerOverflowParents) {\n computedOffset = `var(${customCssProps.offsetTopWithNotifications}, ${computedOffset})`;\n }\n\n const stickyStyles = isSticky\n ? {\n style: {\n top: computedOffset,\n },\n }\n : {};\n\n // \"stuck\" state, when the header has moved from its original posititon has a\n // box-shadow, applied here by a \"header-stuck\" className\n const checkIfStuck = useCallback(() => {\n if (rootRef.current && headerRef.current) {\n const rootTop = rootRef.current.getBoundingClientRect().top;\n const headerTop = headerRef.current.getBoundingClientRect().top;\n if (rootTop + totalBorder < headerTop) {\n setIsStuck(true);\n } else {\n setIsStuck(false);\n }\n }\n }, [rootRef, headerRef, totalBorder]);\n useEffect(() => {\n if (isSticky) {\n window.addEventListener('scroll', checkIfStuck, true);\n window.addEventListener('resize', checkIfStuck);\n return () => {\n window.removeEventListener('scroll', checkIfStuck, true);\n window.removeEventListener('resize', checkIfStuck);\n };\n }\n }, [isSticky, checkIfStuck]);\n return {\n isSticky,\n isStuck,\n stickyStyles,\n };\n};\n\nexport function useSupportsStickyHeader() {\n const isMobile = useMobile();\n return supportsStickyPosition() && !isMobile;\n}\n"]}
|
package/flashbar/index.js
CHANGED
|
@@ -19,7 +19,7 @@ export default function Flashbar(_a) {
|
|
|
19
19
|
var items = _a.items, restProps = __rest(_a, ["items"]);
|
|
20
20
|
var __internalRootRef = useBaseComponent('Flashbar').__internalRootRef;
|
|
21
21
|
var _b = useContainerBreakpoints(['xs']), breakpoint = _b[0], ref = _b[1];
|
|
22
|
-
var isRefresh = useVisualRefresh(
|
|
22
|
+
var isRefresh = useVisualRefresh();
|
|
23
23
|
var baseProps = getBaseProps(restProps);
|
|
24
24
|
var mergedRef = useMergeRefs(ref, __internalRootRef);
|
|
25
25
|
// All the flash items should have ids so we can identify which DOM element is being removed from the DOM to animate it.
|
package/flashbar/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/flashbar/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CA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UAAC,IAAI,EAAE,KAAK,IAAK,OAAA,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,EAA5B,CAA4B,CAAC;YAC1D,CAAC,CAAC,+BAA+B,CAAC,KAAK,CAAC,CACzC,CACJ,CACa,CACZ,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,QAAQ,EAAE,UAAU,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 React from 'react';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { getBaseProps } from '../internal/base-component';\nimport styles from './styles.css.js';\nimport { Flash } from './flash';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport VisualContext from '../internal/components/visual-context';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useReducedMotion, useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { FlashbarProps } from './interfaces';\nimport { TransitionGroup } from 'react-transition-group';\nimport { Transition } from '../internal/components/transition';\nimport { TIMEOUT_FOR_ENTERING_ANIMATION } from './constant';\n\nexport { FlashbarProps };\n\nexport default function Flashbar({ items, ...restProps }: FlashbarProps) {\n const { __internalRootRef } = useBaseComponent('Flashbar');\n const [breakpoint, ref] = useContainerBreakpoints(['xs']);\n const isRefresh = useVisualRefresh();\n const baseProps = getBaseProps(restProps);\n\n const mergedRef = useMergeRefs(ref, __internalRootRef);\n\n // All the flash items should have ids so we can identify which DOM element is being removed from the DOM to animate it.\n const motionDisabled = useReducedMotion(ref as any) || !isRefresh || (items && !items.every(item => 'id' in item));\n // Motion will be disabled if any of the provided flash messages does not contain an `id`\n\n const renderFlashItem = (item: FlashbarProps.MessageDefinition, index: number) => (\n <Flash\n key={item.id ?? index}\n // eslint-disable-next-line react/forbid-component-props\n className={clsx(isRefresh ? styles['flash-refresh'] : '')}\n {...item}\n />\n );\n const renderFlashItemsWithTransitions = (items: readonly FlashbarProps.MessageDefinition[]) => {\n return (\n <>\n <TransitionGroup component={null}>\n {items &&\n items.map((item, index) => (\n <Transition\n transitionChangeDelay={{ entering: TIMEOUT_FOR_ENTERING_ANIMATION }}\n key={item.id ?? index}\n in={true}\n >\n {(state: string, transitionRootElement: React.Ref<HTMLDivElement> | undefined) => (\n <Flash\n ref={transitionRootElement}\n key={item.id ?? index}\n transitionState={state}\n // eslint-disable-next-line react/forbid-component-props\n className={clsx(isRefresh ? styles['flash-refresh'] : '')}\n {...item}\n />\n )}\n </Transition>\n ))}\n </TransitionGroup>\n </>\n );\n };\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.flashbar, styles[`breakpoint-${breakpoint}`])}\n ref={mergedRef}\n >\n <VisualContext contextName=\"flashbar\">\n {items && (\n <>\n {motionDisabled\n ? items.map((item, index) => renderFlashItem(item, index))\n : renderFlashItemsWithTransitions(items)}\n </>\n )}\n </VisualContext>\n </div>\n );\n}\n\napplyDisplayName(Flashbar, 'Flashbar');\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/form-field/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/form-field/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAGtD,UAAU,mBAAmB;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,cAAc,qBAAsB,mBAAmB,gBAWnE,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,SAAS,EACT,OAAe,EACf,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,SAAS,EACT,WAAW,EACX,iBAAwB,EACxB,GAAG,IAAI,EACR,EAAE,sBAAsB,eA6ExB"}
|
package/form-field/internal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import React
|
|
4
|
+
import React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { getBaseProps } from '../internal/base-component';
|
|
7
7
|
import { FormFieldContext, useFormFieldContext } from '../internal/context/form-field-context';
|
|
@@ -11,7 +11,6 @@ import InternalGrid from '../grid/internal';
|
|
|
11
11
|
import InternalIcon from '../icon/internal';
|
|
12
12
|
import { getAriaDescribedBy, getGridDefinition, getSlotIds } from './util';
|
|
13
13
|
import styles from './styles.css.js';
|
|
14
|
-
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
15
14
|
import { joinStrings } from '../internal/utils/strings';
|
|
16
15
|
export var FormFieldError = function (_a) {
|
|
17
16
|
var id = _a.id, children = _a.children;
|
|
@@ -24,8 +23,7 @@ export var FormFieldError = function (_a) {
|
|
|
24
23
|
export default function InternalFormField(_a) {
|
|
25
24
|
var controlId = _a.controlId, _b = _a.stretch, stretch = _b === void 0 ? false : _b, label = _a.label, info = _a.info, children = _a.children, secondaryControl = _a.secondaryControl, description = _a.description, constraintText = _a.constraintText, errorText = _a.errorText, __hideLabel = _a.__hideLabel, _c = _a.__internalRootRef, __internalRootRef = _c === void 0 ? null : _c, rest = __rest(_a, ["controlId", "stretch", "label", "info", "children", "secondaryControl", "description", "constraintText", "errorText", "__hideLabel", "__internalRootRef"]);
|
|
26
25
|
var baseProps = getBaseProps(rest);
|
|
27
|
-
var
|
|
28
|
-
var isRefresh = useVisualRefresh(ref);
|
|
26
|
+
var isRefresh = useVisualRefresh();
|
|
29
27
|
var instanceUniqueId = useUniqueId('formField');
|
|
30
28
|
var generatedControlId = controlId || instanceUniqueId;
|
|
31
29
|
var formFieldId = controlId || generatedControlId;
|
|
@@ -38,8 +36,7 @@ export default function InternalFormField(_a) {
|
|
|
38
36
|
ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,
|
|
39
37
|
invalid: !!errorText || !!parentInvalid
|
|
40
38
|
};
|
|
41
|
-
|
|
42
|
-
return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles.root), ref: mergedRef }),
|
|
39
|
+
return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles.root), ref: __internalRootRef }),
|
|
43
40
|
React.createElement("div", { className: clsx(__hideLabel && styles['visually-hidden']) },
|
|
44
41
|
label && (React.createElement("label", { className: styles.label, id: slotIds.label, htmlFor: generatedControlId }, label)),
|
|
45
42
|
!__hideLabel && info && React.createElement("span", { className: styles.info }, info)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/form-field/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/form-field/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE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,EAAE,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC;YAC1E,oBAAC,YAAY,IAAC,cAAc,EAAE,cAAc;gBAC1C,oBAAC,gBAAgB,CAAC,QAAQ,IACxB,KAAK,aACH,SAAS,EAAE,kBAAkB,IAC1B,6BAA6B,KAGjC,QAAQ,IAAI,6BAAK,SAAS,EAAE,MAAM,CAAC,OAAO,IAAG,QAAQ,CAAO,CACnC;gBAE3B,gBAAgB,IAAI,CACnB,oBAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,6BAA6B;oBAC7D,6BAAK,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC,IAAG,gBAAgB,CAAO,CAC3C,CAC7B,CACY,CACX;QAEL,CAAC,cAAc,IAAI,SAAS,CAAC,IAAI,CAChC,6BAAK,SAAS,EAAE,MAAM,CAAC,KAAK;YACzB,SAAS,IAAI,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,KAAK,IAAG,SAAS,CAAkB;YAC5E,cAAc,IAAI,CACjB,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,IAAI,MAAM,CAAC,sBAAsB,CAAC,CAAC,EAC/E,EAAE,EAAE,OAAO,CAAC,UAAU,IAErB,cAAc,CACX,CACP,CACG,CACP,CACG,CACP,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';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { FormFieldContext, useFormFieldContext } from '../internal/context/form-field-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\n\nimport InternalGrid from '../grid/internal';\nimport InternalIcon from '../icon/internal';\nimport { getAriaDescribedBy, getGridDefinition, getSlotIds } from './util';\n\nimport styles from './styles.css.js';\nimport { InternalFormFieldProps } from './interfaces';\nimport { joinStrings } from '../internal/utils/strings';\n\ninterface FormFieldErrorProps {\n id?: string;\n children?: React.ReactNode;\n}\n\nexport const FormFieldError = ({ id, children }: FormFieldErrorProps) => (\n <div className={styles.error}>\n <div className={styles['error-icon-shake-wrapper']}>\n <div className={styles['error-icon-scale-wrapper']}>\n <InternalIcon name=\"status-warning\" size=\"small\" />\n </div>\n </div>\n <span id={id} className={styles.error__message}>\n {children}\n </span>\n </div>\n);\n\nexport default function InternalFormField({\n controlId,\n stretch = false,\n label,\n info,\n children,\n secondaryControl,\n description,\n constraintText,\n errorText,\n __hideLabel,\n __internalRootRef = null,\n ...rest\n}: InternalFormFieldProps) {\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n\n const instanceUniqueId = useUniqueId('formField');\n const generatedControlId = controlId || instanceUniqueId;\n const formFieldId = controlId || generatedControlId;\n\n const slotIds = getSlotIds(formFieldId, label, description, constraintText, errorText);\n\n const ariaDescribedBy = getAriaDescribedBy(slotIds);\n\n const gridDefinition = getGridDefinition(stretch, !!secondaryControl, isRefresh);\n\n const {\n ariaLabelledby: parentAriaLabelledby,\n ariaDescribedby: parentAriaDescribedby,\n invalid: parentInvalid,\n } = useFormFieldContext({});\n\n const contextValuesWithoutControlId = {\n ariaLabelledby: joinStrings(parentAriaLabelledby, slotIds.label) || undefined,\n ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,\n invalid: !!errorText || !!parentInvalid,\n };\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <div className={clsx(__hideLabel && styles['visually-hidden'])}>\n {label && (\n <label className={styles.label} id={slotIds.label} htmlFor={generatedControlId}>\n {label}\n </label>\n )}\n {!__hideLabel && info && <span className={styles.info}>{info}</span>}\n </div>\n\n {description && (\n <div className={styles.description} id={slotIds.description}>\n {description}\n </div>\n )}\n\n <div className={clsx(styles.controls, __hideLabel && styles['label-hidden'])}>\n <InternalGrid gridDefinition={gridDefinition}>\n <FormFieldContext.Provider\n value={{\n controlId: generatedControlId,\n ...contextValuesWithoutControlId,\n }}\n >\n {children && <div className={styles.control}>{children}</div>}\n </FormFieldContext.Provider>\n\n {secondaryControl && (\n <FormFieldContext.Provider value={contextValuesWithoutControlId}>\n <div className={styles['secondary-control']}>{secondaryControl}</div>\n </FormFieldContext.Provider>\n )}\n </InternalGrid>\n </div>\n\n {(constraintText || errorText) && (\n <div className={styles.hints}>\n {errorText && <FormFieldError id={slotIds.error}>{errorText}</FormFieldError>}\n {constraintText && (\n <div\n className={clsx(styles.constraint, errorText && styles['constraint-has-error'])}\n id={slotIds.constraint}\n >\n {constraintText}\n </div>\n )}\n </div>\n )}\n </div>\n );\n}\n"]}
|
package/header/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/header/internal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/header/internal.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,UAAU,mBAAoB,SAAQ,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,0BAA0B;IACpG,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,WAAW,EACX,IAAI,EACJ,iBAAwB,EACxB,wBAAwB,EACxB,GAAG,SAAS,EACb,EAAE,mBAAmB,eAkErB"}
|
package/header/internal.js
CHANGED
|
@@ -2,8 +2,7 @@ import { __assign, __rest } from "tslib";
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import {
|
|
6
|
-
import React, { useContext, useRef } from 'react';
|
|
5
|
+
import React, { useContext } from 'react';
|
|
7
6
|
import { getBaseProps } from '../internal/base-component';
|
|
8
7
|
import { StickyHeaderContext } from '../container/use-sticky-header';
|
|
9
8
|
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
@@ -13,12 +12,10 @@ export default function InternalHeader(_a) {
|
|
|
13
12
|
var HeadingTag = headingTagOverride !== null && headingTagOverride !== void 0 ? headingTagOverride : (variant === 'awsui-h1-sticky' ? 'h1' : variant);
|
|
14
13
|
var isStuck = useContext(StickyHeaderContext).isStuck;
|
|
15
14
|
var baseProps = getBaseProps(restProps);
|
|
16
|
-
var
|
|
17
|
-
var isRefresh = useVisualRefresh(ref);
|
|
15
|
+
var isRefresh = useVisualRefresh();
|
|
18
16
|
var dynamicVariant = isStuck ? 'h2' : 'h1';
|
|
19
17
|
var variantOverride = variant === 'awsui-h1-sticky' ? (isRefresh ? dynamicVariant : 'h2') : variant;
|
|
20
|
-
|
|
21
|
-
return (React.createElement("div", __assign({}, baseProps, { className: clsx(styles.root, baseProps.className, styles["root-variant-".concat(variantOverride)], isRefresh && styles["root-variant-".concat(variantOverride, "-refresh")], !actions && [styles["root-no-actions"]], description && [styles["root-has-description"]], __disableActionsWrapping && [styles['root-no-wrap']]), ref: mergedRef }),
|
|
18
|
+
return (React.createElement("div", __assign({}, baseProps, { className: clsx(styles.root, baseProps.className, styles["root-variant-".concat(variantOverride)], isRefresh && styles["root-variant-".concat(variantOverride, "-refresh")], !actions && [styles["root-no-actions"]], description && [styles["root-has-description"]], __disableActionsWrapping && [styles['root-no-wrap']]), ref: __internalRootRef }),
|
|
22
19
|
React.createElement("div", { className: clsx(styles.main, styles["main-variant-".concat(variantOverride)], isRefresh && styles["main-variant-".concat(variantOverride, "-refresh")]) },
|
|
23
20
|
React.createElement("div", { className: clsx(styles.title, styles["title-variant-".concat(variantOverride)], isRefresh && styles["title-variant-".concat(variantOverride, "-refresh")]) },
|
|
24
21
|
React.createElement(HeadingTag, { className: clsx(styles.heading, styles["heading-variant-".concat(variantOverride)]) },
|
package/header/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/header/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/header/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAOrC,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAWjB;IAVpB,IAAA,OAAO,aAAA,EACP,kBAAkB,wBAAA,EAClB,QAAQ,cAAA,EACR,OAAO,aAAA,EACP,OAAO,aAAA,EACP,WAAW,iBAAA,EACX,IAAI,UAAA,EACJ,yBAAwB,EAAxB,iBAAiB,mBAAG,IAAI,KAAA,EACxB,wBAAwB,8BAAA,EACrB,SAAS,cAVyB,2IAWtC,CADa;IAEZ,IAAM,UAAU,GAAG,kBAAkB,aAAlB,kBAAkB,cAAlB,kBAAkB,GAAI,CAAC,OAAO,KAAK,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAClF,IAAA,OAAO,GAAK,UAAU,CA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AAM,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,IAAG,QAAQ,CAAQ;oBACzD,OAAO,KAAK,SAAS,IAAI,8BAAM,SAAS,EAAE,MAAM,CAAC,OAAO;;wBAAI,OAAO,CAAQ,CACjE;gBACZ,IAAI,IAAI,8BAAM,SAAS,EAAE,MAAM,CAAC,IAAI,IAAG,IAAI,CAAQ,CAChD;YACL,WAAW,IAAI,CACd,2BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,8BAAuB,eAAe,CAAE,CAAC,EAChD,SAAS,IAAI,MAAM,CAAC,8BAAuB,eAAe,aAAU,CAAC,CACtE,IAEA,WAAW,CACV,CACL,CACG;QACL,OAAO,IAAI,CACV,6BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,0BAAmB,eAAe,CAAE,CAAC,EAC5C,SAAS,IAAI,MAAM,CAAC,0BAAmB,eAAe,aAAU,CAAC,CAClE,IAEA,OAAO,CACJ,CACP,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useContext } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport { StickyHeaderContext } from '../container/use-sticky-header';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { HeaderProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { SomeRequired } from '../internal/types';\n\ninterface InternalHeaderProps extends SomeRequired<HeaderProps, 'variant'>, InternalBaseComponentProps {\n __disableActionsWrapping?: boolean;\n}\n\nexport default function InternalHeader({\n variant,\n headingTagOverride,\n children,\n actions,\n counter,\n description,\n info,\n __internalRootRef = null,\n __disableActionsWrapping,\n ...restProps\n}: InternalHeaderProps) {\n const HeadingTag = headingTagOverride ?? (variant === 'awsui-h1-sticky' ? 'h1' : variant);\n const { isStuck } = useContext(StickyHeaderContext);\n const baseProps = getBaseProps(restProps);\n const isRefresh = useVisualRefresh();\n const dynamicVariant = isStuck ? 'h2' : 'h1';\n const variantOverride = variant === 'awsui-h1-sticky' ? (isRefresh ? dynamicVariant : 'h2') : variant;\n return (\n <div\n {...baseProps}\n className={clsx(\n styles.root,\n baseProps.className,\n styles[`root-variant-${variantOverride}`],\n isRefresh && styles[`root-variant-${variantOverride}-refresh`],\n !actions && [styles[`root-no-actions`]],\n description && [styles[`root-has-description`]],\n __disableActionsWrapping && [styles['root-no-wrap']]\n )}\n ref={__internalRootRef}\n >\n <div\n className={clsx(\n styles.main,\n styles[`main-variant-${variantOverride}`],\n isRefresh && styles[`main-variant-${variantOverride}-refresh`]\n )}\n >\n <div\n className={clsx(\n styles.title,\n styles[`title-variant-${variantOverride}`],\n isRefresh && styles[`title-variant-${variantOverride}-refresh`]\n )}\n >\n <HeadingTag className={clsx(styles.heading, styles[`heading-variant-${variantOverride}`])}>\n <span className={styles['heading-text']}>{children}</span>\n {counter !== undefined && <span className={styles.counter}> {counter}</span>}\n </HeadingTag>\n {info && <span className={styles.info}>{info}</span>}\n </div>\n {description && (\n <p\n className={clsx(\n styles.description,\n styles[`description-variant-${variantOverride}`],\n isRefresh && styles[`description-variant-${variantOverride}-refresh`]\n )}\n >\n {description}\n </p>\n )}\n </div>\n {actions && (\n <div\n className={clsx(\n styles.actions,\n styles[`actions-variant-${variantOverride}`],\n isRefresh && styles[`actions-variant-${variantOverride}-refresh`]\n )}\n >\n {actions}\n </div>\n )}\n </div>\n );\n}\n"]}
|
package/icon/internal.js
CHANGED
|
@@ -34,7 +34,7 @@ var InternalIcon = function (_a) {
|
|
|
34
34
|
var name = _a.name, _b = _a.size, size = _b === void 0 ? 'normal' : _b, _c = _a.variant, variant = _c === void 0 ? 'normal' : _c, url = _a.url, alt = _a.alt, svg = _a.svg, badge = _a.badge, _d = _a.__internalRootRef, __internalRootRef = _d === void 0 ? null : _d, props = __rest(_a, ["name", "size", "variant", "url", "alt", "svg", "badge", "__internalRootRef"]);
|
|
35
35
|
var iconRef = useRef(null);
|
|
36
36
|
// To ensure a re-render is triggered on visual mode changes
|
|
37
|
-
useVisualRefresh(
|
|
37
|
+
useVisualRefresh();
|
|
38
38
|
var _e = useState(null), parentHeight = _e[0], setParentHeight = _e[1];
|
|
39
39
|
var contextualSize = size === 'inherit';
|
|
40
40
|
var iconSize = contextualSize ? iconSizeMap(parentHeight) : size;
|
package/icon/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/icon/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,KAAK,MAAM,SAAS,CAAC;AAG5B,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAOrE,SAAS,WAAW,CAAC,MAAqB;IACxC,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,2EAA2E;QAC3E,OAAO,QAAQ,CAAC;KACjB;IAED,IAAI,MAAM,IAAI,EAAE,EAAE;QAChB,OAAO,OAAO,CAAC;KAChB;SAAM,IAAI,MAAM,IAAI,EAAE,EAAE;QACvB,OAAO,KAAK,CAAC;KACd;SAAM,IAAI,MAAM,IAAI,EAAE,EAAE;QACvB,OAAO,QAAQ,CAAC;KACjB;SAAM,IAAI,MAAM,IAAI,EAAE,EAAE;QACvB,OAAO,OAAO,CAA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IACnB,CACH,CAAC;AACJ,CAAC,CAAC;AAGF,eAAe,YAAY,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport { warnOnce } from '../internal/logging';\nimport styles from './styles.css.js';\nimport icons from './icons';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { IconProps } from './interfaces';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\n\ntype InternalIconProps = IconProps &\n InternalBaseComponentProps & {\n badge?: boolean;\n };\n\nfunction iconSizeMap(height: number | null) {\n if (height === null) {\n // This is the best guess for the contextual height while server rendering.\n return 'normal';\n }\n\n if (height >= 50) {\n return 'large';\n } else if (height >= 36) {\n return 'big';\n } else if (height >= 24) {\n return 'medium';\n } else if (height <= 16) {\n return 'small';\n } else {\n return 'normal';\n }\n}\n\nconst InternalIcon = ({\n name,\n size = 'normal',\n variant = 'normal',\n url,\n alt,\n svg,\n badge,\n __internalRootRef = null,\n ...props\n}: InternalIconProps) => {\n const iconRef = useRef<HTMLElement>(null);\n // To ensure a re-render is triggered on visual mode changes\n useVisualRefresh();\n const [parentHeight, setParentHeight] = useState<number | null>(null);\n const contextualSize = size === 'inherit';\n const iconSize = contextualSize ? iconSizeMap(parentHeight) : size;\n const inlineStyles = contextualSize && parentHeight !== null ? { height: `${parentHeight}px` } : {};\n const baseProps = getBaseProps(props);\n\n baseProps.className = clsx(\n baseProps.className,\n styles.icon,\n contextualSize && styles['icon-flex-height'],\n badge && styles.badge,\n !contextualSize && styles[`size-${iconSize}-mapped-height`],\n styles[`size-${iconSize}`],\n styles[`variant-${variant}`]\n );\n\n // Possible infinite loop is not a concern here because line\n // height should not change without an external state update.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(() => {\n if (!contextualSize || !iconRef.current) {\n return;\n }\n const { lineHeight } = getComputedStyle(iconRef.current);\n const newParentHeight = parseInt(lineHeight, 10);\n setParentHeight(newParentHeight);\n });\n\n const mergedRef = useMergeRefs(iconRef, __internalRootRef);\n\n if (svg) {\n if (url) {\n warnOnce(\n 'Icon',\n 'You have specified both `url` and `svg`. `svg` will take precedence and `url` will be ignored.'\n );\n }\n return (\n <span {...baseProps} ref={mergedRef} aria-hidden=\"true\" style={inlineStyles}>\n {svg}\n </span>\n );\n }\n\n if (url) {\n return (\n <span {...baseProps} ref={mergedRef} style={inlineStyles}>\n <img src={url} alt={alt} />\n </span>\n );\n }\n\n const validIcon = name && Object.prototype.hasOwnProperty.call(icons, name);\n\n return (\n <span\n {...baseProps}\n // dangerouslySetInnerHTML is safe here, as we control the content coming from `icons`\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={validIcon ? { __html: icons[name] } : undefined}\n ref={mergedRef}\n style={inlineStyles}\n />\n );\n};\n\nexport { InternalIconProps };\nexport default InternalIcon;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/checkbox-icon/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAgB,MAAM,sBAAsB,CAAC;AAIxE,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE,SAAS,CAiBnF,CAAC;AAEF,QAAA,MAAM,YAAY,uDAAgE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/checkbox-icon/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAgB,MAAM,sBAAsB,CAAC;AAIxE,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE,SAAS,CAiBnF,CAAC;AAEF,QAAA,MAAM,YAAY,uDAAgE,iBAAiB,gBA2BlG,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { __assign, __rest } from "tslib";
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
6
6
|
import { getBaseProps } from '../../base-component';
|
|
7
7
|
import { useVisualRefresh } from '../../hooks/use-visual-mode';
|
|
8
8
|
import styles from './styles.css.js';
|
|
@@ -29,10 +29,9 @@ var CheckboxIcon = function (_a) {
|
|
|
29
29
|
var _b, _c;
|
|
30
30
|
var checked = _a.checked, indeterminate = _a.indeterminate, _d = _a.disabled, disabled = _d === void 0 ? false : _d, restProps = __rest(_a, ["checked", "indeterminate", "disabled"]);
|
|
31
31
|
var baseProps = getBaseProps(restProps);
|
|
32
|
-
var
|
|
33
|
-
var theme = useVisualRefresh(checkboxRef) ? 'refresh' : 'default';
|
|
32
|
+
var theme = useVisualRefresh() ? 'refresh' : 'default';
|
|
34
33
|
var dimensions = dimensionsByTheme[theme];
|
|
35
|
-
return (React.createElement("svg", __assign({ className: styles.root, viewBox: dimensions.viewBox, "aria-hidden": "true", focusable: "false"
|
|
34
|
+
return (React.createElement("svg", __assign({ className: styles.root, viewBox: dimensions.viewBox, "aria-hidden": "true", focusable: "false" }, baseProps),
|
|
36
35
|
React.createElement("rect", { className: clsx(styles['styled-box'], (_b = {},
|
|
37
36
|
_b[styles['styled-box-checked']] = checked,
|
|
38
37
|
_b[styles['styled-box-indeterminate']] = indeterminate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/checkbox-icon/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/checkbox-icon/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAsB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAgBrC,6CAA6C;AAC7C,MAAM,CAAC,IAAM,iBAAiB,GAA0D;IACtF,SAAO,EAAE;QACP,OAAO,EAAE,WAAW;QACpB,aAAa,EAAE,cAAc;QAC7B,OAAO,EAAE,iBAAiB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AAa,CAAC,CAAC,CAAC,CAC1B,kCACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,YAAI,GAAC,MAAM,CAAC,sBAAsB,CAAC,IAAG,QAAQ,MAAG,EACtF,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,GACrE,CACH,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React from 'react';\nimport { BaseComponentProps, getBaseProps } from '../../base-component';\nimport { useVisualRefresh } from '../../hooks/use-visual-mode';\nimport styles from './styles.css.js';\n\nexport interface CheckboxIconProps extends BaseComponentProps {\n checked?: boolean;\n indeterminate?: boolean;\n disabled?: boolean;\n}\nexport interface Dimension {\n viewBox: string;\n indeterminate: string;\n checked: string;\n xy: number;\n r: number;\n size: number;\n}\n\n// Can't use css variables for svg attributes\nexport const dimensionsByTheme: Record<NonNullable<'default' | 'refresh'>, Dimension> = {\n default: {\n viewBox: '0 0 14 14',\n indeterminate: '2.5,7 11.5,7',\n checked: '2.5,7 6,10 11,3',\n xy: 0.5,\n r: 1.5,\n size: 13,\n },\n refresh: {\n viewBox: '0 0 16 16',\n indeterminate: '3.5,8 12.5,8',\n checked: '3.5,8 7,11 12,4',\n xy: 1,\n r: 2,\n size: 14,\n },\n};\n\nconst CheckboxIcon = ({ checked, indeterminate, disabled = false, ...restProps }: CheckboxIconProps) => {\n const baseProps = getBaseProps(restProps);\n const theme = useVisualRefresh() ? 'refresh' : 'default';\n const dimensions = dimensionsByTheme[theme];\n return (\n <svg className={styles.root} viewBox={dimensions.viewBox} aria-hidden=\"true\" focusable=\"false\" {...baseProps}>\n <rect\n className={clsx(styles['styled-box'], {\n [styles['styled-box-checked']]: checked,\n [styles['styled-box-indeterminate']]: indeterminate,\n [styles['styled-box-disabled']]: disabled,\n })}\n x={dimensions.xy}\n y={dimensions.xy}\n rx={dimensions.r}\n ry={dimensions.r}\n width={dimensions.size}\n height={dimensions.size}\n />\n {checked || indeterminate ? (\n <polyline\n className={clsx(styles['styled-line'], { [styles['styled-line-disabled']]: disabled })}\n points={indeterminate ? dimensions.indeterminate : dimensions.checked}\n />\n ) : null}\n </svg>\n );\n};\n\nexport default CheckboxIcon;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/content-layout/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKlD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/content-layout/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKlD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,kBAAkB,eAkC7F"}
|
|
@@ -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, { useContext
|
|
3
|
+
import React, { useContext } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { AppLayoutContext } from '../../../app-layout/visual-refresh/context';
|
|
6
6
|
import { useVisualRefresh } from '../../hooks/use-visual-mode';
|
|
@@ -10,14 +10,13 @@ export default function ContentLayout(_a) {
|
|
|
10
10
|
var _b, _c, _d;
|
|
11
11
|
var children = _a.children, disableOverlap = _a.disableOverlap, header = _a.header;
|
|
12
12
|
var breadcrumbs = useContext(AppLayoutContext).breadcrumbs;
|
|
13
|
-
var
|
|
14
|
-
var isVisualRefresh = useVisualRefresh(rootElement);
|
|
13
|
+
var isVisualRefresh = useVisualRefresh();
|
|
15
14
|
var isOverlapDisabled = !children || !header || disableOverlap;
|
|
16
15
|
var overlapElement = useDynamicOverlap();
|
|
17
16
|
return (React.createElement("div", { className: clsx(styles.layout, (_b = {},
|
|
18
17
|
_b[styles['is-overlap-disabled']] = isOverlapDisabled,
|
|
19
18
|
_b[styles['is-visual-refresh']] = isVisualRefresh,
|
|
20
|
-
_b))
|
|
19
|
+
_b)) },
|
|
21
20
|
React.createElement("div", { className: clsx(styles.background, (_c = {}, _c[styles['is-overlap-disabled']] = isOverlapDisabled, _c), 'awsui-context-content-header'), ref: overlapElement }),
|
|
22
21
|
header && (React.createElement("div", { className: clsx(styles.header, (_d = {}, _d[styles['has-breadcrumbs']] = breadcrumbs, _d), 'awsui-context-content-header') }, header)),
|
|
23
22
|
children && React.createElement("div", { className: styles.content }, children)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/content-layout/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/content-layout/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAE9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8DAA8D,CAAC;AAIjG,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAwD;;QAAtD,QAAQ,cAAA,EAAE,cAAc,oBAAA,EAAE,MAAM,YAAA;IAC9D,IAAA,WAAW,GAAK,UAAU,CAAC,gBAAgB,CAAC,YAAjC,CAAkC;IACrD,IAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAC3C,IAAM,iBAAiB,GAAG,CAAC,QAAQ,IAAI,CAAC,MAAM,IAAI,cAAc,CAAC;IAEjE,IAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAE3C,OAAO,CACL,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YAC3B,GAAC,MAAM,CAAC,qBAAqB,CAAC,IAAG,iBAAiB;YAClD,GAAC,MAAM,CAAC,mBAAmB,CAAC,IAAG,eAAe;gBAC9C;QAEF,6BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,UAAU,YACf,GAAC,MAAM,CAAC,qBAAqB,CAAC,IAAG,iBAAiB,OACpD,8BAA8B,CAC/B,EACD,GAAG,EAAE,cAAc,GACnB;QAED,MAAM,IAAI,CACT,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,YAAI,GAAC,MAAM,CAAC,iBAAiB,CAAC,IAAG,WAAW,OAAI,8BAA8B,CAAC,IAE3G,MAAM,CACH,CACP;QAEA,QAAQ,IAAI,6BAAK,SAAS,EAAE,MAAM,CAAC,OAAO,IAAG,QAAQ,CAAO,CACzD,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext } from 'react';\nimport clsx from 'clsx';\nimport { AppLayoutContext } from '../../../app-layout/visual-refresh/context';\nimport { ContentLayoutProps } from './interfaces';\nimport { useVisualRefresh } from '../../hooks/use-visual-mode';\nimport styles from './styles.css.js';\nimport { useDynamicOverlap } from '../../../app-layout/visual-refresh/hooks/use-dynamic-overlap';\n\nexport { ContentLayoutProps };\n\nexport default function ContentLayout({ children, disableOverlap, header }: ContentLayoutProps) {\n const { breadcrumbs } = useContext(AppLayoutContext);\n const isVisualRefresh = useVisualRefresh();\n const isOverlapDisabled = !children || !header || disableOverlap;\n\n const overlapElement = useDynamicOverlap();\n\n return (\n <div\n className={clsx(styles.layout, {\n [styles['is-overlap-disabled']]: isOverlapDisabled,\n [styles['is-visual-refresh']]: isVisualRefresh,\n })}\n >\n <div\n className={clsx(\n styles.background,\n { [styles['is-overlap-disabled']]: isOverlapDisabled },\n 'awsui-context-content-header'\n )}\n ref={overlapElement}\n />\n\n {header && (\n <div\n className={clsx(styles.header, { [styles['has-breadcrumbs']]: breadcrumbs }, 'awsui-context-content-header')}\n >\n {header}\n </div>\n )}\n\n {children && <div className={styles.content}>{children}</div>}\n </div>\n );\n}\n"]}
|
|
@@ -59,7 +59,7 @@ var Dropdown = function (_a) {
|
|
|
59
59
|
var verticalContainerRef = useRef(null);
|
|
60
60
|
// To keep track of the initial position (drop up/down) which is kept the same during fixed repositioning
|
|
61
61
|
var fixedPosition = useRef(null);
|
|
62
|
-
var isRefresh = useVisualRefresh(
|
|
62
|
+
var isRefresh = useVisualRefresh();
|
|
63
63
|
var dropdownClasses = usePortalModeClasses(triggerRef);
|
|
64
64
|
var _m = useState('bottom-right'), position = _m[0], setPosition = _m[1];
|
|
65
65
|
var isMobile = useMobile();
|
|
@@ -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;A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,EAC7F,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,SAAS,GAC7B,CACE,CACP,EAhCgB,CAgChB,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 hasContent: 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 hasContent,\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 && !hasContent,\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 hasContent = true,\n scrollable = true,\n trapFocus = false,\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(triggerRef);\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]);\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 hasContent={hasContent}\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,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,MAAM,WAAW,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAS7E,IAAM,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S,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,UAAU,EAAE,UAAU,EACtB,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,EAhCgB,CAgChB,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 hasContent: 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 hasContent,\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 && !hasContent,\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 hasContent = true,\n scrollable = true,\n trapFocus = false,\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]);\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 hasContent={hasContent}\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"]}
|
package/internal/environment.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Fires onChange with the given target element as an argument every time any DOM node attribute changes.
|
|
4
|
+
*
|
|
5
|
+
* @deprecated The hook has performance implications. Consider alternatives.
|
|
6
|
+
*/
|
|
2
7
|
export declare function useMutationObserver(elementRef: React.RefObject<HTMLElement>, onChange: (element: HTMLElement) => void): void;
|
|
3
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-mutation-observer/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAUzC,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,EACxC,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,QAYzC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-mutation-observer/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAUzC;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,EACxC,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,QAYzC"}
|
|
@@ -8,6 +8,11 @@ var useMutationSingleton = createSingletonHandler(function (handler) {
|
|
|
8
8
|
observer.observe(document.body, { attributes: true, subtree: true });
|
|
9
9
|
return function () { return observer.disconnect(); };
|
|
10
10
|
});
|
|
11
|
+
/**
|
|
12
|
+
* Fires onChange with the given target element as an argument every time any DOM node attribute changes.
|
|
13
|
+
*
|
|
14
|
+
* @deprecated The hook has performance implications. Consider alternatives.
|
|
15
|
+
*/
|
|
11
16
|
export function useMutationObserver(elementRef, onChange) {
|
|
12
17
|
var handler = useStableEventHandler(function () {
|
|
13
18
|
if (elementRef.current) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-mutation-observer/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,IAAM,oBAAoB,GAAG,sBAAsB,CAAO,UAAA,OAAO;IAC/D,IAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,cAAM,OAAA,OAAO,EAAE,EAAT,CAAS,CAAC,CAAC;IACvD,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACrE,OAAO,cAAM,OAAA,QAAQ,CAAC,UAAU,EAAE,EAArB,CAAqB,CAAC;AACrC,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,mBAAmB,CACjC,UAAwC,EACxC,QAAwC;IAExC,IAAM,OAAO,GAAG,qBAAqB,CAAC;QACpC,IAAI,UAAU,CAAC,OAAO,EAAE;YACtB,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;SAC9B;IACH,CAAC,CAAC,CAAC;IACH,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAE9B,SAAS,CAAC;QACR,OAAO,EAAE,CAAC;IACZ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAChB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect } from 'react';\nimport { useStableEventHandler } from '../use-stable-event-handler';\nimport { createSingletonHandler } from '../use-singleton-handler';\n\nconst useMutationSingleton = createSingletonHandler<void>(handler => {\n const observer = new MutationObserver(() => handler());\n observer.observe(document.body, { attributes: true, subtree: true });\n return () => observer.disconnect();\n});\n\nexport function useMutationObserver(\n elementRef: React.RefObject<HTMLElement>,\n onChange: (element: HTMLElement) => void\n) {\n const handler = useStableEventHandler(() => {\n if (elementRef.current) {\n onChange(elementRef.current);\n }\n });\n useMutationSingleton(handler);\n\n useEffect(() => {\n handler();\n }, [handler]);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-mutation-observer/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,IAAM,oBAAoB,GAAG,sBAAsB,CAAO,UAAA,OAAO;IAC/D,IAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,cAAM,OAAA,OAAO,EAAE,EAAT,CAAS,CAAC,CAAC;IACvD,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACrE,OAAO,cAAM,OAAA,QAAQ,CAAC,UAAU,EAAE,EAArB,CAAqB,CAAC;AACrC,CAAC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,UAAwC,EACxC,QAAwC;IAExC,IAAM,OAAO,GAAG,qBAAqB,CAAC;QACpC,IAAI,UAAU,CAAC,OAAO,EAAE;YACtB,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;SAC9B;IACH,CAAC,CAAC,CAAC;IACH,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAE9B,SAAS,CAAC;QACR,OAAO,EAAE,CAAC;IACZ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAChB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect } from 'react';\nimport { useStableEventHandler } from '../use-stable-event-handler';\nimport { createSingletonHandler } from '../use-singleton-handler';\n\nconst useMutationSingleton = createSingletonHandler<void>(handler => {\n const observer = new MutationObserver(() => handler());\n observer.observe(document.body, { attributes: true, subtree: true });\n return () => observer.disconnect();\n});\n\n/**\n * Fires onChange with the given target element as an argument every time any DOM node attribute changes.\n *\n * @deprecated The hook has performance implications. Consider alternatives.\n */\nexport function useMutationObserver(\n elementRef: React.RefObject<HTMLElement>,\n onChange: (element: HTMLElement) => void\n) {\n const handler = useStableEventHandler(() => {\n if (elementRef.current) {\n onChange(elementRef.current);\n }\n });\n useMutationSingleton(handler);\n\n useEffect(() => {\n handler();\n }, [handler]);\n}\n"]}
|
|
@@ -8,7 +8,7 @@ export function usePortalModeClasses(ref) {
|
|
|
8
8
|
var colorMode = useCurrentMode(ref);
|
|
9
9
|
var densityMode = useDensityMode(ref);
|
|
10
10
|
var context = useVisualContext(ref);
|
|
11
|
-
var visualRefresh = useVisualRefresh(
|
|
11
|
+
var visualRefresh = useVisualRefresh();
|
|
12
12
|
return clsx((_a = {
|
|
13
13
|
'awsui-polaris-dark-mode awsui-dark-mode': colorMode === 'dark',
|
|
14
14
|
'awsui-polaris-compact-mode awsui-compact-mode': densityMode === 'compact',
|