@cloudscape-design/components 3.0.489 → 3.0.490

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.
@@ -37,15 +37,10 @@ function ApplicationController({ activeElementKey, activeElementRef, onFocus, on
37
37
  if (!isFocused || focusTransitionRef.current === true) {
38
38
  return;
39
39
  }
40
- // Delay focus juggle to let the last focus event settle in Firefox.
41
- // Without the delay the focus is getting lost.
42
- const timeoutId = setTimeout(() => {
43
- focusTransitionRef.current = true;
44
- containerRef.current.removeChild(applicationRef.current);
45
- containerRef.current.appendChild(applicationRef.current);
46
- focusApplication(applicationRef.current, (activeElementRef === null || activeElementRef === void 0 ? void 0 : activeElementRef.current) || null);
47
- }, 0);
48
- return () => clearTimeout(timeoutId);
40
+ focusTransitionRef.current = true;
41
+ containerRef.current.removeChild(applicationRef.current);
42
+ containerRef.current.appendChild(applicationRef.current);
43
+ focusApplication(applicationRef.current, (activeElementRef === null || activeElementRef === void 0 ? void 0 : activeElementRef.current) || null);
49
44
  }, [isFocused, activeElementKey, activeElementRef]);
50
45
  return (React.createElement("g", { ref: containerRef },
51
46
  React.createElement("g", { tabIndex: -1, ref: applicationRef, onFocus: onApplicationFocus, onBlur: onApplicationBlur, onKeyDown: onApplicationKeyDown, className: styles.application })));
@@ -1 +1 @@
1
- {"version":3,"file":"application-controller.js","sourceRoot":"lib/default/","sources":["internal/components/chart-plot/application-controller.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzG,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAcrC,eAAe,UAAU,CAAC,qBAAqB,CAAC,CAAC;AAEjD,SAAS,qBAAqB,CAC5B,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,SA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AO,CAAC,UAAU,CAAC;IACtC,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,MAAM,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;KAChC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport styles from './styles.css.js';\n\nexport interface ApplicationRef {\n focus(): void;\n}\n\nexport interface ApplicationControllerProps {\n activeElementKey: null | string | number | boolean;\n activeElementRef?: React.RefObject<SVGGElement>;\n onFocus?: (event: React.FocusEvent<SVGGElement>) => void;\n onBlur?: (event: React.FocusEvent<SVGGElement>) => void;\n onKeyDown?: (event: React.KeyboardEvent<SVGGElement>) => void;\n}\n\nexport default forwardRef(ApplicationController);\n\nfunction ApplicationController(\n { activeElementKey, activeElementRef, onFocus, onBlur, onKeyDown }: ApplicationControllerProps,\n ref: React.Ref<ApplicationRef>\n) {\n const containerRef = useRef<SVGGElement>(null);\n const applicationRef = useRef<SVGGElement>(null);\n const focusTransitionRef = useRef(false);\n const [isFocused, setFocused] = useState(false);\n\n // Calls provided onFocus handler when the application obtains focus, ignoring internal focus juggling.\n const onApplicationFocus = useCallback(\n (event: React.FocusEvent<SVGGElement>) => {\n if (focusTransitionRef.current === false) {\n setFocused(true);\n onFocus && onFocus(event);\n } else {\n focusTransitionRef.current = false;\n }\n },\n [onFocus]\n );\n // Calls provided onBlur handler when the application loses focus, ignoring internal focus juggling.\n const onApplicationBlur = useCallback(\n (event: React.FocusEvent<SVGGElement>) => {\n if (focusTransitionRef.current === false) {\n setFocused(false);\n onBlur && onBlur(event);\n // The application controller can only be focused programmatically.\n muteApplication(applicationRef.current!);\n }\n },\n [onBlur]\n );\n const onApplicationKeyDown = onKeyDown;\n\n useImperativeHandle(\n ref,\n () => ({\n focus: () => focusApplication(applicationRef.current!, activeElementRef?.current || null),\n }),\n [activeElementRef]\n );\n\n // Re-attaches and re-focuses the application for screen readers to treat it as an update.\n useEffect(() => {\n // Skip if not focused or if the transition is already happening.\n if (!isFocused || focusTransitionRef.current === true) {\n return;\n }\n\n // Delay focus juggle to let the last focus event settle in Firefox.\n // Without the delay the focus is getting lost.\n const timeoutId = setTimeout(() => {\n focusTransitionRef.current = true;\n containerRef.current!.removeChild(applicationRef.current!);\n containerRef.current!.appendChild(applicationRef.current!);\n focusApplication(applicationRef.current!, activeElementRef?.current || null);\n }, 0);\n\n return () => clearTimeout(timeoutId);\n }, [isFocused, activeElementKey, activeElementRef]);\n\n return (\n <g ref={containerRef}>\n <g\n tabIndex={-1}\n ref={applicationRef}\n onFocus={onApplicationFocus}\n onBlur={onApplicationBlur}\n onKeyDown={onApplicationKeyDown}\n className={styles.application}\n ></g>\n </g>\n );\n}\n\n// Focuses application but before copies aria-attributes from the target.\nfunction focusApplication(app: SVGGElement, target: null | SVGGElement) {\n // Remove prev attributes.\n for (const attributeName of getAttributeNames(app)) {\n if (attributeName === 'role' || attributeName.slice(0, 4) === 'aria') {\n app.removeAttribute(attributeName);\n }\n }\n\n // Copy new attributes.\n if (target) {\n for (const attributeName of getAttributeNames(target)) {\n if (attributeName === 'role' || attributeName.slice(0, 4) === 'aria') {\n const attributeValue = target.getAttribute(attributeName);\n attributeValue && app.setAttribute(attributeName, attributeValue);\n }\n }\n }\n\n // Make app focusable.\n app.tabIndex = 0;\n app.setAttribute('focusable', 'true');\n app.setAttribute('aria-hidden', 'false');\n\n // Focus app.\n app.focus({ preventScroll: true });\n}\n\n// The application is to be only focused programmatically.\nfunction muteApplication(app: SVGGElement) {\n // Remove prev attributes.\n for (const attributeName of getAttributeNames(app)) {\n if (attributeName === 'role' || attributeName.slice(0, 4) === 'aria') {\n app.removeAttribute(attributeName);\n }\n }\n\n // Make app non-focusable.\n app.tabIndex = -1;\n app.setAttribute('focusable', 'false');\n app.setAttribute('aria-hidden', 'true');\n}\n\n// Polyfill for element.getAttributeNames(), IE11\n// https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames#polyfill\nfunction getAttributeNames(element: Element) {\n const attributes = element.attributes;\n const result = new Array(attributes.length);\n for (let i = 0; i < attributes.length; i++) {\n result[i] = attributes[i].name;\n }\n return result;\n}\n"]}
1
+ {"version":3,"file":"application-controller.js","sourceRoot":"lib/default/","sources":["internal/components/chart-plot/application-controller.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzG,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAcrC,eAAe,UAAU,CAAC,qBAAqB,CAAC,CAAC;AAEjD,SAAS,qBAAqB,CAC5B,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAA8B,EAC9F,GAA8B;IAE9B,MAAM,YAAY,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IAC/C,MAAM,cAAc,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IACjD,MAAM,kBAAkB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEhD,uGAAuG;IACvG,MAAM,kBAAkB,GAAG,WAAW,CACpC,CAAC,KAAoC,EAAE,EAAE;QACvC,IAAI,kBAAkB,CAAC,OAAO,KAAK,KAAK,EAAE;YACxC,UAAU,CAAC,IAAI,CAAC,CAAC;YACjB,OAAO,IAAI,OAAO,CAAC,KAA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AC;AACrC,CAAC;AAED,0DAA0D;AAC1D,SAAS,eAAe,CAAC,GAAgB;IACvC,0BAA0B;IAC1B,KAAK,MAAM,aAAa,IAAI,iBAAiB,CAAC,GAAG,CAAC,EAAE;QAClD,IAAI,aAAa,KAAK,MAAM,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,EAAE;YACpE,GAAG,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;SACpC;KACF;IAED,0BAA0B;IAC1B,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;IAClB,GAAG,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACvC,GAAG,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAC1C,CAAC;AAED,iDAAiD;AACjD,sFAAsF;AACtF,SAAS,iBAAiB,CAAC,OAAgB;IACzC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACtC,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,MAAM,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;KAChC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport styles from './styles.css.js';\n\nexport interface ApplicationRef {\n focus(): void;\n}\n\nexport interface ApplicationControllerProps {\n activeElementKey: null | string | number | boolean;\n activeElementRef?: React.RefObject<SVGGElement>;\n onFocus?: (event: React.FocusEvent<SVGGElement>) => void;\n onBlur?: (event: React.FocusEvent<SVGGElement>) => void;\n onKeyDown?: (event: React.KeyboardEvent<SVGGElement>) => void;\n}\n\nexport default forwardRef(ApplicationController);\n\nfunction ApplicationController(\n { activeElementKey, activeElementRef, onFocus, onBlur, onKeyDown }: ApplicationControllerProps,\n ref: React.Ref<ApplicationRef>\n) {\n const containerRef = useRef<SVGGElement>(null);\n const applicationRef = useRef<SVGGElement>(null);\n const focusTransitionRef = useRef(false);\n const [isFocused, setFocused] = useState(false);\n\n // Calls provided onFocus handler when the application obtains focus, ignoring internal focus juggling.\n const onApplicationFocus = useCallback(\n (event: React.FocusEvent<SVGGElement>) => {\n if (focusTransitionRef.current === false) {\n setFocused(true);\n onFocus && onFocus(event);\n } else {\n focusTransitionRef.current = false;\n }\n },\n [onFocus]\n );\n // Calls provided onBlur handler when the application loses focus, ignoring internal focus juggling.\n const onApplicationBlur = useCallback(\n (event: React.FocusEvent<SVGGElement>) => {\n if (focusTransitionRef.current === false) {\n setFocused(false);\n onBlur && onBlur(event);\n // The application controller can only be focused programmatically.\n muteApplication(applicationRef.current!);\n }\n },\n [onBlur]\n );\n const onApplicationKeyDown = onKeyDown;\n\n useImperativeHandle(\n ref,\n () => ({\n focus: () => focusApplication(applicationRef.current!, activeElementRef?.current || null),\n }),\n [activeElementRef]\n );\n\n // Re-attaches and re-focuses the application for screen readers to treat it as an update.\n useEffect(() => {\n // Skip if not focused or if the transition is already happening.\n if (!isFocused || focusTransitionRef.current === true) {\n return;\n }\n focusTransitionRef.current = true;\n containerRef.current!.removeChild(applicationRef.current!);\n containerRef.current!.appendChild(applicationRef.current!);\n focusApplication(applicationRef.current!, activeElementRef?.current || null);\n }, [isFocused, activeElementKey, activeElementRef]);\n\n return (\n <g ref={containerRef}>\n <g\n tabIndex={-1}\n ref={applicationRef}\n onFocus={onApplicationFocus}\n onBlur={onApplicationBlur}\n onKeyDown={onApplicationKeyDown}\n className={styles.application}\n ></g>\n </g>\n );\n}\n\n// Focuses application but before copies aria-attributes from the target.\nfunction focusApplication(app: SVGGElement, target: null | SVGGElement) {\n // Remove prev attributes.\n for (const attributeName of getAttributeNames(app)) {\n if (attributeName === 'role' || attributeName.slice(0, 4) === 'aria') {\n app.removeAttribute(attributeName);\n }\n }\n\n // Copy new attributes.\n if (target) {\n for (const attributeName of getAttributeNames(target)) {\n if (attributeName === 'role' || attributeName.slice(0, 4) === 'aria') {\n const attributeValue = target.getAttribute(attributeName);\n attributeValue && app.setAttribute(attributeName, attributeValue);\n }\n }\n }\n\n // Make app focusable.\n app.tabIndex = 0;\n app.setAttribute('focusable', 'true');\n app.setAttribute('aria-hidden', 'false');\n\n // Focus app.\n app.focus({ preventScroll: true });\n}\n\n// The application is to be only focused programmatically.\nfunction muteApplication(app: SVGGElement) {\n // Remove prev attributes.\n for (const attributeName of getAttributeNames(app)) {\n if (attributeName === 'role' || attributeName.slice(0, 4) === 'aria') {\n app.removeAttribute(attributeName);\n }\n }\n\n // Make app non-focusable.\n app.tabIndex = -1;\n app.setAttribute('focusable', 'false');\n app.setAttribute('aria-hidden', 'true');\n}\n\n// Polyfill for element.getAttributeNames(), IE11\n// https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames#polyfill\nfunction getAttributeNames(element: Element) {\n const attributes = element.attributes;\n const result = new Array(attributes.length);\n for (let i = 0; i < attributes.length; i++) {\n result[i] = attributes[i].name;\n }\n return result;\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (9f65ea40)";
2
+ export var PACKAGE_VERSION = "3.0.0 (f304de34)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (9f65ea40)",
3
+ "PACKAGE_VERSION": "3.0.0 (f304de34)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "9f65ea408177be13561dc2c2e2f56e90f3b1f351"
2
+ "commit": "f304de348d3df83b5f88c9809ea8661651eb0c3d"
3
3
  }
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@cloudscape-design/components","main":"./index.js","exports":{".":"./index.js","./package.json":"./package.json","./theming":"./theming/index.js","./test-utils/dom":"./test-utils/dom/index.js","./test-utils/selectors":"./test-utils/selectors/index.js","./interfaces":"./interfaces.js","./contexts/form-field":"./contexts/form-field.js","./alert":"./alert/index.js","./anchor-navigation":"./anchor-navigation/index.js","./annotation-context":"./annotation-context/index.js","./app-layout":"./app-layout/index.js","./area-chart":"./area-chart/index.js","./attribute-editor":"./attribute-editor/index.js","./autosuggest":"./autosuggest/index.js","./badge":"./badge/index.js","./bar-chart":"./bar-chart/index.js","./box":"./box/index.js","./breadcrumb-group":"./breadcrumb-group/index.js","./button":"./button/index.js","./button-dropdown":"./button-dropdown/index.js","./calendar":"./calendar/index.js","./cards":"./cards/index.js","./checkbox":"./checkbox/index.js","./code-editor":"./code-editor/index.js","./collection-preferences":"./collection-preferences/index.js","./column-layout":"./column-layout/index.js","./container":"./container/index.js","./content-layout":"./content-layout/index.js","./date-input":"./date-input/index.js","./date-picker":"./date-picker/index.js","./date-range-picker":"./date-range-picker/index.js","./drawer":"./drawer/index.js","./expandable-section":"./expandable-section/index.js","./file-upload":"./file-upload/index.js","./flashbar":"./flashbar/index.js","./form":"./form/index.js","./form-field":"./form-field/index.js","./grid":"./grid/index.js","./header":"./header/index.js","./help-panel":"./help-panel/index.js","./hotspot":"./hotspot/index.js","./icon":"./icon/index.js","./input":"./input/index.js","./line-chart":"./line-chart/index.js","./link":"./link/index.js","./mixed-line-bar-chart":"./mixed-line-bar-chart/index.js","./modal":"./modal/index.js","./multiselect":"./multiselect/index.js","./pagination":"./pagination/index.js","./pie-chart":"./pie-chart/index.js","./popover":"./popover/index.js","./progress-bar":"./progress-bar/index.js","./property-filter":"./property-filter/index.js","./radio-group":"./radio-group/index.js","./s3-resource-selector":"./s3-resource-selector/index.js","./segmented-control":"./segmented-control/index.js","./select":"./select/index.js","./side-navigation":"./side-navigation/index.js","./space-between":"./space-between/index.js","./spinner":"./spinner/index.js","./split-panel":"./split-panel/index.js","./status-indicator":"./status-indicator/index.js","./table":"./table/index.js","./tabs":"./tabs/index.js","./tag-editor":"./tag-editor/index.js","./text-content":"./text-content/index.js","./text-filter":"./text-filter/index.js","./textarea":"./textarea/index.js","./tiles":"./tiles/index.js","./time-input":"./time-input/index.js","./toggle":"./toggle/index.js","./token-group":"./token-group/index.js","./top-navigation":"./top-navigation/index.js","./tutorial-panel":"./tutorial-panel/index.js","./wizard":"./wizard/index.js","./top-navigation/1.0-beta":"./top-navigation/1.0-beta/index.js","./i18n":"./i18n/index.js","./i18n/messages/all.all":"./i18n/messages/all.all.js","./i18n/messages/all.all.json":"./i18n/messages/all.all.json","./i18n/messages/all.de":"./i18n/messages/all.de.js","./i18n/messages/all.de.json":"./i18n/messages/all.de.json","./i18n/messages/all.en-GB":"./i18n/messages/all.en-GB.js","./i18n/messages/all.en-GB.json":"./i18n/messages/all.en-GB.json","./i18n/messages/all.en":"./i18n/messages/all.en.js","./i18n/messages/all.en.json":"./i18n/messages/all.en.json","./i18n/messages/all.es":"./i18n/messages/all.es.js","./i18n/messages/all.es.json":"./i18n/messages/all.es.json","./i18n/messages/all.fr":"./i18n/messages/all.fr.js","./i18n/messages/all.fr.json":"./i18n/messages/all.fr.json","./i18n/messages/all.id":"./i18n/messages/all.id.js","./i18n/messages/all.id.json":"./i18n/messages/all.id.json","./i18n/messages/all.it":"./i18n/messages/all.it.js","./i18n/messages/all.it.json":"./i18n/messages/all.it.json","./i18n/messages/all.ja":"./i18n/messages/all.ja.js","./i18n/messages/all.ja.json":"./i18n/messages/all.ja.json","./i18n/messages/all.ko":"./i18n/messages/all.ko.js","./i18n/messages/all.ko.json":"./i18n/messages/all.ko.json","./i18n/messages/all.pt-BR":"./i18n/messages/all.pt-BR.js","./i18n/messages/all.pt-BR.json":"./i18n/messages/all.pt-BR.json","./i18n/messages/all.th":"./i18n/messages/all.th.js","./i18n/messages/all.th.json":"./i18n/messages/all.th.json","./i18n/messages/all.tr":"./i18n/messages/all.tr.js","./i18n/messages/all.tr.json":"./i18n/messages/all.tr.json","./i18n/messages/all.zh-CN":"./i18n/messages/all.zh-CN.js","./i18n/messages/all.zh-CN.json":"./i18n/messages/all.zh-CN.json","./i18n/messages/all.zh-TW":"./i18n/messages/all.zh-TW.js","./i18n/messages/all.zh-TW.json":"./i18n/messages/all.zh-TW.json"},"sideEffects":["*.css","./internal/base-component/index.js","./internal/base-component/styles.css.js"],"version":"3.0.489","repository":{"type":"git","url":"https://github.com/cloudscape-design/components.git"},"homepage":"https://cloudscape.design","dependencies":{"@cloudscape-design/collection-hooks":"^1.0.0","@cloudscape-design/component-toolkit":"^1.0.0-beta","@cloudscape-design/test-utils-core":"^1.0.0","@cloudscape-design/theming-runtime":"^1.0.0","@dnd-kit/core":"^6.0.8","@dnd-kit/sortable":"^7.0.2","@dnd-kit/utilities":"^3.2.1","@juggle/resize-observer":"^3.3.1","ace-builds":"^1.23.0","balanced-match":"^1.0.2","clsx":"^1.1.0","d3-shape":"^1.3.7","date-fns":"^2.25.0","intl-messageformat":"^10.3.1","mnth":"^2.0.0","react-keyed-flatten-children":"^1.3.0","react-transition-group":"^4.4.2","react-virtual":"^2.8.2","tslib":"^2.4.0","weekstart":"^1.1.0"},"peerDependencies":{"react":"^16.8 || ^17 || ^18","react-dom":"^16.8 || ^17 || ^18"},"license":"Apache-2.0"}
1
+ {"name":"@cloudscape-design/components","main":"./index.js","exports":{".":"./index.js","./package.json":"./package.json","./theming":"./theming/index.js","./test-utils/dom":"./test-utils/dom/index.js","./test-utils/selectors":"./test-utils/selectors/index.js","./interfaces":"./interfaces.js","./contexts/form-field":"./contexts/form-field.js","./alert":"./alert/index.js","./anchor-navigation":"./anchor-navigation/index.js","./annotation-context":"./annotation-context/index.js","./app-layout":"./app-layout/index.js","./area-chart":"./area-chart/index.js","./attribute-editor":"./attribute-editor/index.js","./autosuggest":"./autosuggest/index.js","./badge":"./badge/index.js","./bar-chart":"./bar-chart/index.js","./box":"./box/index.js","./breadcrumb-group":"./breadcrumb-group/index.js","./button":"./button/index.js","./button-dropdown":"./button-dropdown/index.js","./calendar":"./calendar/index.js","./cards":"./cards/index.js","./checkbox":"./checkbox/index.js","./code-editor":"./code-editor/index.js","./collection-preferences":"./collection-preferences/index.js","./column-layout":"./column-layout/index.js","./container":"./container/index.js","./content-layout":"./content-layout/index.js","./date-input":"./date-input/index.js","./date-picker":"./date-picker/index.js","./date-range-picker":"./date-range-picker/index.js","./drawer":"./drawer/index.js","./expandable-section":"./expandable-section/index.js","./file-upload":"./file-upload/index.js","./flashbar":"./flashbar/index.js","./form":"./form/index.js","./form-field":"./form-field/index.js","./grid":"./grid/index.js","./header":"./header/index.js","./help-panel":"./help-panel/index.js","./hotspot":"./hotspot/index.js","./icon":"./icon/index.js","./input":"./input/index.js","./line-chart":"./line-chart/index.js","./link":"./link/index.js","./mixed-line-bar-chart":"./mixed-line-bar-chart/index.js","./modal":"./modal/index.js","./multiselect":"./multiselect/index.js","./pagination":"./pagination/index.js","./pie-chart":"./pie-chart/index.js","./popover":"./popover/index.js","./progress-bar":"./progress-bar/index.js","./property-filter":"./property-filter/index.js","./radio-group":"./radio-group/index.js","./s3-resource-selector":"./s3-resource-selector/index.js","./segmented-control":"./segmented-control/index.js","./select":"./select/index.js","./side-navigation":"./side-navigation/index.js","./space-between":"./space-between/index.js","./spinner":"./spinner/index.js","./split-panel":"./split-panel/index.js","./status-indicator":"./status-indicator/index.js","./table":"./table/index.js","./tabs":"./tabs/index.js","./tag-editor":"./tag-editor/index.js","./text-content":"./text-content/index.js","./text-filter":"./text-filter/index.js","./textarea":"./textarea/index.js","./tiles":"./tiles/index.js","./time-input":"./time-input/index.js","./toggle":"./toggle/index.js","./token-group":"./token-group/index.js","./top-navigation":"./top-navigation/index.js","./tutorial-panel":"./tutorial-panel/index.js","./wizard":"./wizard/index.js","./top-navigation/1.0-beta":"./top-navigation/1.0-beta/index.js","./i18n":"./i18n/index.js","./i18n/messages/all.all":"./i18n/messages/all.all.js","./i18n/messages/all.all.json":"./i18n/messages/all.all.json","./i18n/messages/all.de":"./i18n/messages/all.de.js","./i18n/messages/all.de.json":"./i18n/messages/all.de.json","./i18n/messages/all.en-GB":"./i18n/messages/all.en-GB.js","./i18n/messages/all.en-GB.json":"./i18n/messages/all.en-GB.json","./i18n/messages/all.en":"./i18n/messages/all.en.js","./i18n/messages/all.en.json":"./i18n/messages/all.en.json","./i18n/messages/all.es":"./i18n/messages/all.es.js","./i18n/messages/all.es.json":"./i18n/messages/all.es.json","./i18n/messages/all.fr":"./i18n/messages/all.fr.js","./i18n/messages/all.fr.json":"./i18n/messages/all.fr.json","./i18n/messages/all.id":"./i18n/messages/all.id.js","./i18n/messages/all.id.json":"./i18n/messages/all.id.json","./i18n/messages/all.it":"./i18n/messages/all.it.js","./i18n/messages/all.it.json":"./i18n/messages/all.it.json","./i18n/messages/all.ja":"./i18n/messages/all.ja.js","./i18n/messages/all.ja.json":"./i18n/messages/all.ja.json","./i18n/messages/all.ko":"./i18n/messages/all.ko.js","./i18n/messages/all.ko.json":"./i18n/messages/all.ko.json","./i18n/messages/all.pt-BR":"./i18n/messages/all.pt-BR.js","./i18n/messages/all.pt-BR.json":"./i18n/messages/all.pt-BR.json","./i18n/messages/all.th":"./i18n/messages/all.th.js","./i18n/messages/all.th.json":"./i18n/messages/all.th.json","./i18n/messages/all.tr":"./i18n/messages/all.tr.js","./i18n/messages/all.tr.json":"./i18n/messages/all.tr.json","./i18n/messages/all.zh-CN":"./i18n/messages/all.zh-CN.js","./i18n/messages/all.zh-CN.json":"./i18n/messages/all.zh-CN.json","./i18n/messages/all.zh-TW":"./i18n/messages/all.zh-TW.js","./i18n/messages/all.zh-TW.json":"./i18n/messages/all.zh-TW.json"},"sideEffects":["*.css","./internal/base-component/index.js","./internal/base-component/styles.css.js"],"version":"3.0.490","repository":{"type":"git","url":"https://github.com/cloudscape-design/components.git"},"homepage":"https://cloudscape.design","dependencies":{"@cloudscape-design/collection-hooks":"^1.0.0","@cloudscape-design/component-toolkit":"^1.0.0-beta","@cloudscape-design/test-utils-core":"^1.0.0","@cloudscape-design/theming-runtime":"^1.0.0","@dnd-kit/core":"^6.0.8","@dnd-kit/sortable":"^7.0.2","@dnd-kit/utilities":"^3.2.1","@juggle/resize-observer":"^3.3.1","ace-builds":"^1.23.0","balanced-match":"^1.0.2","clsx":"^1.1.0","d3-shape":"^1.3.7","date-fns":"^2.25.0","intl-messageformat":"^10.3.1","mnth":"^2.0.0","react-keyed-flatten-children":"^1.3.0","react-transition-group":"^4.4.2","react-virtual":"^2.8.2","tslib":"^2.4.0","weekstart":"^1.1.0"},"peerDependencies":{"react":"^16.8 || ^17 || ^18","react-dom":"^16.8 || ^17 || ^18"},"license":"Apache-2.0"}