@cloudscape-design/components 3.0.269 → 3.0.271

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/internal/base-component/styles.scoped.css +4 -4
  2. package/internal/environment.js +1 -1
  3. package/internal/generated/theming/index.cjs +11 -11
  4. package/internal/generated/theming/index.js +11 -11
  5. package/internal/manifest.json +1 -1
  6. package/modal/index.d.ts +1 -1
  7. package/modal/index.d.ts.map +1 -1
  8. package/modal/index.js +2 -2
  9. package/modal/index.js.map +1 -1
  10. package/modal/internal.d.ts +1 -1
  11. package/modal/internal.d.ts.map +1 -1
  12. package/modal/internal.js.map +1 -1
  13. package/package.json +1 -1
  14. package/split-panel/index.d.ts.map +1 -1
  15. package/split-panel/index.js +3 -3
  16. package/split-panel/index.js.map +1 -1
  17. package/split-panel/utils/use-keyboard-events.d.ts.map +1 -1
  18. package/split-panel/utils/use-keyboard-events.js +8 -4
  19. package/split-panel/utils/use-keyboard-events.js.map +1 -1
  20. package/table/header-cell/styles.css.js +19 -19
  21. package/table/header-cell/styles.scoped.css +33 -33
  22. package/table/header-cell/styles.selectors.js +19 -19
  23. package/test-utils/dom/flashbar/index.d.ts +8 -0
  24. package/test-utils/dom/flashbar/index.js +10 -0
  25. package/test-utils/dom/flashbar/index.js.map +1 -1
  26. package/test-utils/dom/multiselect/index.d.ts +1 -1
  27. package/test-utils/dom/multiselect/index.js +1 -1
  28. package/test-utils/dom/select/index.d.ts +1 -1
  29. package/test-utils/dom/select/index.js +1 -1
  30. package/test-utils/selectors/flashbar/index.d.ts +8 -0
  31. package/test-utils/selectors/flashbar/index.js +10 -0
  32. package/test-utils/selectors/flashbar/index.js.map +1 -1
  33. package/test-utils/selectors/multiselect/index.d.ts +1 -1
  34. package/test-utils/selectors/multiselect/index.js +1 -1
  35. package/test-utils/selectors/select/index.d.ts +1 -1
  36. package/test-utils/selectors/select/index.js +1 -1
  37. package/test-utils/tsconfig.tsbuildinfo +1 -1
@@ -260,7 +260,7 @@
260
260
  --color-border-status-info-546i7i:#0972d3;
261
261
  --color-border-status-success-cqi45f:#037f0c;
262
262
  --color-border-status-warning-hg85ut:#7d8998;
263
- --color-border-divider-interactive-default-0hdcst:#414d5c;
263
+ --color-border-divider-interactive-default-4pf6ra:#7d8998;
264
264
  --color-border-tabs-divider-69fx5i:#e9ebed;
265
265
  --color-border-tabs-shadow-4lmh2z:rgba(0, 7, 22, 0.12);
266
266
  --color-border-tabs-underline-9bcfzu:#0972d3;
@@ -834,7 +834,7 @@
834
834
  --color-border-status-info-546i7i:#539fe5;
835
835
  --color-border-status-success-cqi45f:#29ad32;
836
836
  --color-border-status-warning-hg85ut:#8d99a8;
837
- --color-border-divider-interactive-default-0hdcst:#d1d5db;
837
+ --color-border-divider-interactive-default-4pf6ra:#d1d5db;
838
838
  --color-border-tabs-divider-69fx5i:#414d5c;
839
839
  --color-border-tabs-shadow-4lmh2z:rgba(0, 7, 22, 1);
840
840
  --color-border-tabs-underline-9bcfzu:#539fe5;
@@ -1105,7 +1105,7 @@
1105
1105
  --color-border-status-info-546i7i:#539fe5;
1106
1106
  --color-border-status-success-cqi45f:#29ad32;
1107
1107
  --color-border-status-warning-hg85ut:#8d99a8;
1108
- --color-border-divider-interactive-default-0hdcst:#d1d5db;
1108
+ --color-border-divider-interactive-default-4pf6ra:#d1d5db;
1109
1109
  --color-border-tabs-divider-69fx5i:#414d5c;
1110
1110
  --color-border-tabs-shadow-4lmh2z:rgba(0, 7, 22, 1);
1111
1111
  --color-border-tabs-underline-9bcfzu:#539fe5;
@@ -1289,7 +1289,7 @@
1289
1289
  --color-border-status-info-546i7i:#539fe5;
1290
1290
  --color-border-status-success-cqi45f:#29ad32;
1291
1291
  --color-border-status-warning-hg85ut:#8d99a8;
1292
- --color-border-divider-interactive-default-0hdcst:#d1d5db;
1292
+ --color-border-divider-interactive-default-4pf6ra:#d1d5db;
1293
1293
  --color-border-tabs-divider-69fx5i:#414d5c;
1294
1294
  --color-border-tabs-shadow-4lmh2z:rgba(0, 7, 22, 1);
1295
1295
  --color-border-tabs-underline-9bcfzu:#539fe5;
@@ -1,6 +1,6 @@
1
1
 
2
2
  export var PACKAGE_SOURCE = 'components';
3
- export var PACKAGE_VERSION = '3.0.0 (4029c1b)';
3
+ export var PACKAGE_VERSION = '3.0.0 (5ed314a)';
4
4
  export var THEME = 'open-source-visual-refresh';
5
5
  export var ALWAYS_VISUAL_REFRESH = true;
6
6
 
@@ -1164,8 +1164,8 @@ module.exports.preset = {
1164
1164
  "dark": "{colorGrey450}"
1165
1165
  },
1166
1166
  "colorBorderDividerInteractiveDefault": {
1167
- "light": "{colorTextInteractiveDefault}",
1168
- "dark": "{colorTextInteractiveDefault}"
1167
+ "light": "{colorGrey500}",
1168
+ "dark": "{colorGrey300}"
1169
1169
  },
1170
1170
  "colorBorderTabsDivider": {
1171
1171
  "light": "{colorGrey200}",
@@ -3125,8 +3125,8 @@ module.exports.preset = {
3125
3125
  "dark": "{colorGrey450}"
3126
3126
  },
3127
3127
  "colorBorderDividerInteractiveDefault": {
3128
- "light": "{colorTextInteractiveDefault}",
3129
- "dark": "{colorTextInteractiveDefault}"
3128
+ "light": "{colorGrey300}",
3129
+ "dark": "{colorGrey300}"
3130
3130
  },
3131
3131
  "colorBorderTabsDivider": {
3132
3132
  "light": "{colorGrey600}",
@@ -4103,8 +4103,8 @@ module.exports.preset = {
4103
4103
  "dark": "{colorGrey450}"
4104
4104
  },
4105
4105
  "colorBorderDividerInteractiveDefault": {
4106
- "light": "{colorTextInteractiveDefault}",
4107
- "dark": "{colorTextInteractiveDefault}"
4106
+ "light": "{colorGrey300}",
4107
+ "dark": "{colorGrey300}"
4108
4108
  },
4109
4109
  "colorBorderTabsDivider": {
4110
4110
  "light": "{colorGrey600}",
@@ -5013,8 +5013,8 @@ module.exports.preset = {
5013
5013
  "dark": "{colorGrey450}"
5014
5014
  },
5015
5015
  "colorBorderDividerInteractiveDefault": {
5016
- "light": "{colorTextInteractiveDefault}",
5017
- "dark": "{colorTextInteractiveDefault}"
5016
+ "light": "{colorGrey500}",
5017
+ "dark": "{colorGrey300}"
5018
5018
  },
5019
5019
  "colorBorderTabsDivider": {
5020
5020
  "light": "{colorGrey200}",
@@ -5923,8 +5923,8 @@ module.exports.preset = {
5923
5923
  "dark": "{colorGrey450}"
5924
5924
  },
5925
5925
  "colorBorderDividerInteractiveDefault": {
5926
- "light": "{colorTextInteractiveDefault}",
5927
- "dark": "{colorTextInteractiveDefault}"
5926
+ "light": "{colorGrey500}",
5927
+ "dark": "{colorGrey300}"
5928
5928
  },
5929
5929
  "colorBorderTabsDivider": {
5930
5930
  "light": "{colorGrey200}",
@@ -8334,7 +8334,7 @@ module.exports.preset = {
8334
8334
  "colorBorderStatusInfo": "--color-border-status-info-546i7i",
8335
8335
  "colorBorderStatusSuccess": "--color-border-status-success-cqi45f",
8336
8336
  "colorBorderStatusWarning": "--color-border-status-warning-hg85ut",
8337
- "colorBorderDividerInteractiveDefault": "--color-border-divider-interactive-default-0hdcst",
8337
+ "colorBorderDividerInteractiveDefault": "--color-border-divider-interactive-default-4pf6ra",
8338
8338
  "colorBorderTabsDivider": "--color-border-tabs-divider-69fx5i",
8339
8339
  "colorBorderTabsShadow": "--color-border-tabs-shadow-4lmh2z",
8340
8340
  "colorBorderTabsUnderline": "--color-border-tabs-underline-9bcfzu",
@@ -1164,8 +1164,8 @@ export var preset = {
1164
1164
  "dark": "{colorGrey450}"
1165
1165
  },
1166
1166
  "colorBorderDividerInteractiveDefault": {
1167
- "light": "{colorTextInteractiveDefault}",
1168
- "dark": "{colorTextInteractiveDefault}"
1167
+ "light": "{colorGrey500}",
1168
+ "dark": "{colorGrey300}"
1169
1169
  },
1170
1170
  "colorBorderTabsDivider": {
1171
1171
  "light": "{colorGrey200}",
@@ -3125,8 +3125,8 @@ export var preset = {
3125
3125
  "dark": "{colorGrey450}"
3126
3126
  },
3127
3127
  "colorBorderDividerInteractiveDefault": {
3128
- "light": "{colorTextInteractiveDefault}",
3129
- "dark": "{colorTextInteractiveDefault}"
3128
+ "light": "{colorGrey300}",
3129
+ "dark": "{colorGrey300}"
3130
3130
  },
3131
3131
  "colorBorderTabsDivider": {
3132
3132
  "light": "{colorGrey600}",
@@ -4103,8 +4103,8 @@ export var preset = {
4103
4103
  "dark": "{colorGrey450}"
4104
4104
  },
4105
4105
  "colorBorderDividerInteractiveDefault": {
4106
- "light": "{colorTextInteractiveDefault}",
4107
- "dark": "{colorTextInteractiveDefault}"
4106
+ "light": "{colorGrey300}",
4107
+ "dark": "{colorGrey300}"
4108
4108
  },
4109
4109
  "colorBorderTabsDivider": {
4110
4110
  "light": "{colorGrey600}",
@@ -5013,8 +5013,8 @@ export var preset = {
5013
5013
  "dark": "{colorGrey450}"
5014
5014
  },
5015
5015
  "colorBorderDividerInteractiveDefault": {
5016
- "light": "{colorTextInteractiveDefault}",
5017
- "dark": "{colorTextInteractiveDefault}"
5016
+ "light": "{colorGrey500}",
5017
+ "dark": "{colorGrey300}"
5018
5018
  },
5019
5019
  "colorBorderTabsDivider": {
5020
5020
  "light": "{colorGrey200}",
@@ -5923,8 +5923,8 @@ export var preset = {
5923
5923
  "dark": "{colorGrey450}"
5924
5924
  },
5925
5925
  "colorBorderDividerInteractiveDefault": {
5926
- "light": "{colorTextInteractiveDefault}",
5927
- "dark": "{colorTextInteractiveDefault}"
5926
+ "light": "{colorGrey500}",
5927
+ "dark": "{colorGrey300}"
5928
5928
  },
5929
5929
  "colorBorderTabsDivider": {
5930
5930
  "light": "{colorGrey200}",
@@ -8334,7 +8334,7 @@ export var preset = {
8334
8334
  "colorBorderStatusInfo": "--color-border-status-info-546i7i",
8335
8335
  "colorBorderStatusSuccess": "--color-border-status-success-cqi45f",
8336
8336
  "colorBorderStatusWarning": "--color-border-status-warning-hg85ut",
8337
- "colorBorderDividerInteractiveDefault": "--color-border-divider-interactive-default-0hdcst",
8337
+ "colorBorderDividerInteractiveDefault": "--color-border-divider-interactive-default-4pf6ra",
8338
8338
  "colorBorderTabsDivider": "--color-border-tabs-divider-69fx5i",
8339
8339
  "colorBorderTabsShadow": "--color-border-tabs-shadow-4lmh2z",
8340
8340
  "colorBorderTabsUnderline": "--color-border-tabs-underline-9bcfzu",
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "4029c1bd7ef9fe60051616c79cee8fc3ee537e73"
2
+ "commit": "5ed314a6a0a2b6ba2d16b28f590fd1aa6bb4abdc"
3
3
  }
package/modal/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { ModalProps } from './interfaces';
3
3
  export { ModalProps };
4
- export default function Modal({ size, closeAriaLabel, ...props }: ModalProps): JSX.Element;
4
+ export default function Modal({ size, ...props }: ModalProps): JSX.Element;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["modal/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,IAAe,EAAE,cAAmB,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,eAG3F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["modal/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,IAAe,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,eAGtE"}
package/modal/index.js CHANGED
@@ -6,9 +6,9 @@ import { applyDisplayName } from '../internal/utils/apply-display-name';
6
6
  import InternalModal from './internal';
7
7
  import useBaseComponent from '../internal/hooks/use-base-component';
8
8
  export default function Modal(_a) {
9
- var { size = 'medium', closeAriaLabel = '' } = _a, props = __rest(_a, ["size", "closeAriaLabel"]);
9
+ var { size = 'medium' } = _a, props = __rest(_a, ["size"]);
10
10
  const baseComponentProps = useBaseComponent('Modal');
11
- return React.createElement(InternalModal, Object.assign({ size: size, closeAriaLabel: closeAriaLabel }, props, baseComponentProps));
11
+ return React.createElement(InternalModal, Object.assign({ size: size }, props, baseComponentProps));
12
12
  }
13
13
  applyDisplayName(Modal, 'Modal');
14
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["modal/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,aAAa,MAAM,YAAY,CAAC;AACvC,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAIpE,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAA8D;QAA9D,EAAE,IAAI,GAAG,QAAQ,EAAE,cAAc,GAAG,EAAE,OAAwB,EAAnB,KAAK,cAAhD,0BAAkD,CAAF;IAC5E,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACrD,OAAO,oBAAC,aAAa,kBAAC,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,cAAc,IAAM,KAAK,EAAM,kBAAkB,EAAI,CAAC;AAC1G,CAAC;AAED,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { ModalProps } from './interfaces';\nimport InternalModal from './internal';\nimport useBaseComponent from '../internal/hooks/use-base-component';\n\nexport { ModalProps };\n\nexport default function Modal({ size = 'medium', closeAriaLabel = '', ...props }: ModalProps) {\n const baseComponentProps = useBaseComponent('Modal');\n return <InternalModal size={size} closeAriaLabel={closeAriaLabel} {...props} {...baseComponentProps} />;\n}\n\napplyDisplayName(Modal, 'Modal');\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["modal/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,aAAa,MAAM,YAAY,CAAC;AACvC,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAIpE,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAyC;QAAzC,EAAE,IAAI,GAAG,QAAQ,OAAwB,EAAnB,KAAK,cAA3B,QAA6B,CAAF;IACvD,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACrD,OAAO,oBAAC,aAAa,kBAAC,IAAI,EAAE,IAAI,IAAM,KAAK,EAAM,kBAAkB,EAAI,CAAC;AAC1E,CAAC;AAED,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { ModalProps } from './interfaces';\nimport InternalModal from './internal';\nimport useBaseComponent from '../internal/hooks/use-base-component';\n\nexport { ModalProps };\n\nexport default function Modal({ size = 'medium', ...props }: ModalProps) {\n const baseComponentProps = useBaseComponent('Modal');\n return <InternalModal size={size} {...props} {...baseComponentProps} />;\n}\n\napplyDisplayName(Modal, 'Modal');\n"]}
@@ -2,7 +2,7 @@
2
2
  import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
3
3
  import { ModalProps } from './interfaces';
4
4
  import { SomeRequired } from '../internal/types';
5
- type InternalModalProps = SomeRequired<ModalProps, 'size' | 'closeAriaLabel'> & InternalBaseComponentProps;
5
+ type InternalModalProps = SomeRequired<ModalProps, 'size'> & InternalBaseComponentProps;
6
6
  export default function InternalModal({ modalRoot, ...rest }: InternalModalProps): JSX.Element;
7
7
  export {};
8
8
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["modal/internal.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAYlF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKjD,KAAK,kBAAkB,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAAC,GAAG,0BAA0B,CAAC;AAE3G,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,kBAAkB,eAM/E"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["modal/internal.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAYlF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKjD,KAAK,kBAAkB,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,0BAA0B,CAAC;AAExF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,kBAAkB,eAM/E"}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["modal/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;A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,GAAG,EAAE,iBAAiB,GAAI,CAC3B;wBACL,MAAM,IAAI,CACT,6BAAK,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC,IACxF,MAAM,CACH,CACP,CACG,CACF,CACI,CACR,CACoB,CAC7B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { KeyCode } from '../internal/keycode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { InternalButton } from '../button/internal';\nimport InternalHeader from '../header/internal';\nimport Portal from '../internal/components/portal';\nimport { useContainerBreakpoints, useContainerQuery } from '../internal/hooks/container-queries';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { FormFieldContext } from '../internal/context/form-field-context';\n\nimport { disableBodyScrolling, enableBodyScrolling } from './body-scroll';\nimport { ModalProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { SomeRequired } from '../internal/types';\nimport FocusLock from '../internal/components/focus-lock';\nimport { useInternalI18n } from '../internal/i18n/context';\nimport { useIntersectionObserver } from '../internal/hooks/use-intersection-observer';\n\ntype InternalModalProps = SomeRequired<ModalProps, 'size' | 'closeAriaLabel'> & InternalBaseComponentProps;\n\nexport default function InternalModal({ modalRoot, ...rest }: InternalModalProps) {\n return (\n <Portal container={modalRoot}>\n <InnerModal {...rest} />\n </Portal>\n );\n}\n\n// Separate component to prevent the Portal from getting in the way of refs, as it needs extra cycles to render the inner components.\n// useContainerQuery needs its targeted element to exist on the first render in order to work properly.\nfunction InnerModal({\n size,\n visible,\n header,\n children,\n footer,\n disableContentPaddings,\n onDismiss,\n __internalRootRef = null,\n ...rest\n}: InternalModalProps) {\n const instanceUniqueId = useUniqueId();\n const headerId = `${rest.id || instanceUniqueId}-header`;\n const lastMouseDownElementRef = useRef<HTMLElement | null>(null);\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n\n const i18n = useInternalI18n('modal');\n const closeAriaLabel = i18n('closeAriaLabel', rest.closeAriaLabel);\n\n const refObject = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(breakpointsRef, refObject, __internalRootRef);\n\n const isRefresh = useVisualRefresh();\n\n const baseProps = getBaseProps(rest);\n\n // enable body scroll and restore focus if unmounting while visible\n useEffect(() => {\n return () => {\n enableBodyScrolling();\n };\n }, []);\n\n // enable / disable body scroll\n useEffect(() => {\n if (visible) {\n disableBodyScrolling();\n } else {\n enableBodyScrolling();\n }\n }, [visible]);\n\n // Because we hide the element with styles (and not actually detach it from DOM), we need to scroll to top\n useEffect(() => {\n if (visible && refObject.current) {\n refObject.current.scrollTop = 0;\n }\n }, [visible]);\n\n const dismiss = (reason: string) => fireNonCancelableEvent(onDismiss, { reason });\n\n const onOverlayMouseDown = (event: React.MouseEvent) => {\n lastMouseDownElementRef.current = event.target as HTMLElement;\n };\n const onOverlayClick = (event: React.MouseEvent) => {\n const overlay = refObject.current;\n const lastClicked = lastMouseDownElementRef.current;\n\n if (event.target === overlay && lastClicked === overlay) {\n dismiss('overlay');\n }\n };\n const onCloseButtonClick = () => dismiss('closeButton');\n const escKeyHandler = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n dismiss('keyboard');\n }\n };\n\n // We use an empty div element at the end of the content slot as a sentinel\n // to detect when the user has scrolled to the bottom.\n const { ref: stickySentinelRef, isIntersecting: footerStuck } = useIntersectionObserver();\n\n // Add extra scroll padding to account for the height of the sticky footer,\n // to prevent it from covering focused elements.\n const [footerHeight, footerRef] = useContainerQuery(rect => rect.borderBoxHeight);\n\n return (\n <FormFieldContext.Provider value={{}}>\n <div\n {...baseProps}\n className={clsx(styles.root, { [styles.hidden]: !visible }, baseProps.className, isRefresh && styles.refresh)}\n role=\"dialog\"\n aria-modal={true}\n aria-labelledby={headerId}\n onMouseDown={onOverlayMouseDown}\n onClick={onOverlayClick}\n ref={mergedRef}\n style={footerHeight ? { scrollPaddingBottom: footerHeight } : undefined}\n >\n <FocusLock disabled={!visible} autoFocus={true} restoreFocus={true} className={styles['focus-lock']}>\n <div\n className={clsx(\n styles.dialog,\n styles[size],\n styles[`breakpoint-${breakpoint}`],\n isRefresh && styles.refresh\n )}\n onKeyDown={escKeyHandler}\n tabIndex={-1}\n >\n <div className={styles.container}>\n <div className={styles.header}>\n <InternalHeader\n variant=\"h2\"\n __disableActionsWrapping={true}\n actions={\n <InternalButton\n ariaLabel={closeAriaLabel}\n className={styles['dismiss-control']}\n variant=\"modal-dismiss\"\n iconName=\"close\"\n formAction=\"none\"\n onClick={onCloseButtonClick}\n />\n }\n >\n <span id={headerId} className={styles['header--text']}>\n {header}\n </span>\n </InternalHeader>\n </div>\n <div className={clsx(styles.content, { [styles['no-paddings']]: disableContentPaddings })}>\n {children}\n <div ref={stickySentinelRef} />\n </div>\n {footer && (\n <div ref={footerRef} className={clsx(styles.footer, footerStuck && styles['footer--stuck'])}>\n {footer}\n </div>\n )}\n </div>\n </div>\n </FocusLock>\n </div>\n </FormFieldContext.Provider>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["modal/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE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,CAAC,MAAM,EAAE,WAAW,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC,IACxF,MAAM,CACH,CACP,CACG,CACF,CACI,CACR,CACoB,CAC7B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { KeyCode } from '../internal/keycode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { InternalButton } from '../button/internal';\nimport InternalHeader from '../header/internal';\nimport Portal from '../internal/components/portal';\nimport { useContainerBreakpoints, useContainerQuery } from '../internal/hooks/container-queries';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { FormFieldContext } from '../internal/context/form-field-context';\n\nimport { disableBodyScrolling, enableBodyScrolling } from './body-scroll';\nimport { ModalProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { SomeRequired } from '../internal/types';\nimport FocusLock from '../internal/components/focus-lock';\nimport { useInternalI18n } from '../internal/i18n/context';\nimport { useIntersectionObserver } from '../internal/hooks/use-intersection-observer';\n\ntype InternalModalProps = SomeRequired<ModalProps, 'size'> & InternalBaseComponentProps;\n\nexport default function InternalModal({ modalRoot, ...rest }: InternalModalProps) {\n return (\n <Portal container={modalRoot}>\n <InnerModal {...rest} />\n </Portal>\n );\n}\n\n// Separate component to prevent the Portal from getting in the way of refs, as it needs extra cycles to render the inner components.\n// useContainerQuery needs its targeted element to exist on the first render in order to work properly.\nfunction InnerModal({\n size,\n visible,\n header,\n children,\n footer,\n disableContentPaddings,\n onDismiss,\n __internalRootRef = null,\n ...rest\n}: InternalModalProps) {\n const instanceUniqueId = useUniqueId();\n const headerId = `${rest.id || instanceUniqueId}-header`;\n const lastMouseDownElementRef = useRef<HTMLElement | null>(null);\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n\n const i18n = useInternalI18n('modal');\n const closeAriaLabel = i18n('closeAriaLabel', rest.closeAriaLabel);\n\n const refObject = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(breakpointsRef, refObject, __internalRootRef);\n\n const isRefresh = useVisualRefresh();\n\n const baseProps = getBaseProps(rest);\n\n // enable body scroll and restore focus if unmounting while visible\n useEffect(() => {\n return () => {\n enableBodyScrolling();\n };\n }, []);\n\n // enable / disable body scroll\n useEffect(() => {\n if (visible) {\n disableBodyScrolling();\n } else {\n enableBodyScrolling();\n }\n }, [visible]);\n\n // Because we hide the element with styles (and not actually detach it from DOM), we need to scroll to top\n useEffect(() => {\n if (visible && refObject.current) {\n refObject.current.scrollTop = 0;\n }\n }, [visible]);\n\n const dismiss = (reason: string) => fireNonCancelableEvent(onDismiss, { reason });\n\n const onOverlayMouseDown = (event: React.MouseEvent) => {\n lastMouseDownElementRef.current = event.target as HTMLElement;\n };\n const onOverlayClick = (event: React.MouseEvent) => {\n const overlay = refObject.current;\n const lastClicked = lastMouseDownElementRef.current;\n\n if (event.target === overlay && lastClicked === overlay) {\n dismiss('overlay');\n }\n };\n const onCloseButtonClick = () => dismiss('closeButton');\n const escKeyHandler = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n dismiss('keyboard');\n }\n };\n\n // We use an empty div element at the end of the content slot as a sentinel\n // to detect when the user has scrolled to the bottom.\n const { ref: stickySentinelRef, isIntersecting: footerStuck } = useIntersectionObserver();\n\n // Add extra scroll padding to account for the height of the sticky footer,\n // to prevent it from covering focused elements.\n const [footerHeight, footerRef] = useContainerQuery(rect => rect.borderBoxHeight);\n\n return (\n <FormFieldContext.Provider value={{}}>\n <div\n {...baseProps}\n className={clsx(styles.root, { [styles.hidden]: !visible }, baseProps.className, isRefresh && styles.refresh)}\n role=\"dialog\"\n aria-modal={true}\n aria-labelledby={headerId}\n onMouseDown={onOverlayMouseDown}\n onClick={onOverlayClick}\n ref={mergedRef}\n style={footerHeight ? { scrollPaddingBottom: footerHeight } : undefined}\n >\n <FocusLock disabled={!visible} autoFocus={true} restoreFocus={true} className={styles['focus-lock']}>\n <div\n className={clsx(\n styles.dialog,\n styles[size],\n styles[`breakpoint-${breakpoint}`],\n isRefresh && styles.refresh\n )}\n onKeyDown={escKeyHandler}\n tabIndex={-1}\n >\n <div className={styles.container}>\n <div className={styles.header}>\n <InternalHeader\n variant=\"h2\"\n __disableActionsWrapping={true}\n actions={\n <InternalButton\n ariaLabel={closeAriaLabel}\n className={styles['dismiss-control']}\n variant=\"modal-dismiss\"\n iconName=\"close\"\n formAction=\"none\"\n onClick={onCloseButtonClick}\n />\n }\n >\n <span id={headerId} className={styles['header--text']}>\n {header}\n </span>\n </InternalHeader>\n </div>\n <div className={clsx(styles.content, { [styles['no-paddings']]: disableContentPaddings })}>\n {children}\n <div ref={stickySentinelRef} />\n </div>\n {footer && (\n <div ref={footerRef} className={clsx(styles.footer, footerStuck && styles['footer--stuck'])}>\n {footer}\n </div>\n )}\n </div>\n </div>\n </FocusLock>\n </div>\n </FormFieldContext.Provider>\n );\n}\n"]}
package/package.json CHANGED
@@ -109,7 +109,7 @@
109
109
  "./internal/base-component/index.js",
110
110
  "./internal/base-component/styles.css.js"
111
111
  ],
112
- "version": "3.0.269",
112
+ "version": "3.0.271",
113
113
  "repository": {
114
114
  "type": "git",
115
115
  "url": "https://github.com/cloudscape-design/components.git"
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["split-panel/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;AAiBjE,OAAO,EAAE,eAAe,EAAE,CAAC;AAK3B,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,MAAM,EACN,QAAQ,EACR,qBAA6B,EAC7B,aAA0B,EAC1B,WAAW,EACX,GAAG,SAAS,EACb,EAAE,eAAe,eA8QjB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["split-panel/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;AAiBjE,OAAO,EAAE,eAAe,EAAE,CAAC;AAK3B,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,MAAM,EACN,QAAQ,EACR,qBAA6B,EAC7B,aAA0B,EAC1B,WAAW,EACX,GAAG,SAAS,EACb,EAAE,eAAe,eAiRjB"}
@@ -43,11 +43,11 @@ export default function SplitPanel(_a) {
43
43
  // wait one frame to allow app-layout to complete its calculations
44
44
  const handle = requestAnimationFrame(() => {
45
45
  const maxSize = position === 'bottom' ? getMaxHeight() : getMaxWidth();
46
- setRelativeSize((size / maxSize) * 100);
46
+ setRelativeSize(((size - minSize) / (maxSize - minSize)) * 100);
47
47
  setMaxSize(maxSize);
48
48
  });
49
49
  return () => cancelAnimationFrame(handle);
50
- }, [size, position, getMaxHeight, getMaxWidth]);
50
+ }, [size, minSize, position, getMaxHeight, getMaxWidth]);
51
51
  useEffect(() => {
52
52
  reportSize(cappedSize);
53
53
  }, [reportSize, cappedSize]);
@@ -93,7 +93,7 @@ export default function SplitPanel(_a) {
93
93
  React.createElement(InternalButton, { className: styles['preferences-button'], iconName: "settings", variant: "icon", onClick: () => setPreferencesOpen(true), formAction: "none", ariaLabel: i18nStrings.preferencesTitle, ref: refs.preferences }),
94
94
  React.createElement("span", { className: styles.divider }))),
95
95
  isOpen ? (React.createElement(InternalButton, { className: styles['close-button'], iconName: isRefresh && closeBehavior === 'collapse' ? (position === 'side' ? 'angle-right' : 'angle-down') : 'close', variant: "icon", onClick: onToggle, formAction: "none", ariaLabel: i18nStrings.closeButtonAriaLabel, ariaExpanded: isOpen })) : position === 'side' ? null : (React.createElement(InternalButton, { className: styles['open-button'], iconName: "angle-up", variant: "icon", formAction: "none", ariaLabel: i18nStrings.openButtonAriaLabel, ref: refs.toggle, ariaExpanded: isOpen })))));
96
- const resizeHandle = (React.createElement("div", { ref: refs.slider, role: "slider", tabIndex: 0, "aria-label": i18nStrings.resizeHandleAriaLabel, "aria-valuemax": 100, "aria-valuemin": 0, "aria-valuenow": relativeSize, className: clsx(styles.slider, styles[`slider-${position}`]), onKeyDown: onKeyDown, onPointerDown: onSliderPointerDown },
96
+ const resizeHandle = (React.createElement("div", { ref: refs.slider, role: "slider", tabIndex: 0, "aria-label": i18nStrings.resizeHandleAriaLabel, "aria-valuemax": 100, "aria-valuemin": 0, "aria-valuenow": position === 'bottom' ? relativeSize : 100 - relativeSize, className: clsx(styles.slider, styles[`slider-${position}`]), onKeyDown: onKeyDown, onPointerDown: onSliderPointerDown },
97
97
  React.createElement(ResizeHandler, { className: clsx(styles['slider-icon'], styles[`slider-icon-${position}`]) })));
98
98
  /*
99
99
  This effect forces the browser to recalculate the layout
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["split-panel/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,aAAa,MAAM,wBAAwB,CAAC;AACnD,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,MAA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ACtB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,EACZ,uBAAuB,EAAE,uBAAuB,EAChD,iBAAiB,EAAE,iBAAiB,IAEnC,eAAe,CACQ,CAC3B;QACA,iBAAiB,IAAI,CACpB,oBAAC,gBAAgB,IACf,OAAO,EAAE,IAAI,EACb,WAAW,EAAE,EAAE,QAAQ,EAAE,EACzB,oBAAoB,EAAE,QAAQ,KAAK,QAAQ,IAAI,gBAAgB,EAC/D,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE;gBACX,MAAM,EAAE,WAAW,CAAC,gBAAgB;gBACpC,OAAO,EAAE,WAAW,CAAC,kBAAkB;gBACvC,MAAM,EAAE,WAAW,CAAC,iBAAiB;gBACrC,aAAa,EAAE,WAAW,CAAC,wBAAwB;gBACnD,mBAAmB,EAAE,WAAW,CAAC,8BAA8B;gBAC/D,cAAc,EAAE,WAAW,CAAC,yBAAyB;gBACrD,YAAY,EAAE,WAAW,CAAC,uBAAuB;aAClD,EACD,SAAS,EAAE,WAAW,CAAC,EAAE;gBACvB,mBAAmB,mBAAM,WAAW,EAAG,CAAC;gBACxC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,EACD,SAAS,EAAE,GAAG,EAAE;gBACd,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,GACD,CACH,CACA,CACJ,CACU,CACd,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState, useEffect, useLayoutEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\n\nimport { SplitPanelProps, SizeControlProps } from './interfaces';\nimport ResizeHandler from './icons/resize-handler';\nimport PreferencesModal from './preferences-modal';\nimport { usePointerEvents } from './utils/use-pointer-events';\nimport { useKeyboardEvents } from './utils/use-keyboard-events';\n\nimport styles from './styles.css.js';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { AppLayoutContext } from '../internal/context/app-layout-context';\nimport { getLimitedValue } from './utils/size-utils';\nimport { Transition } from '../internal/components/transition';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { SplitPanelContentSide } from './side';\nimport { SplitPanelContentBottom } from './bottom';\n\nexport { SplitPanelProps };\n\nconst MIN_HEIGHT = 160;\nconst MIN_WIDTH = 280;\n\nexport default function SplitPanel({\n header,\n children,\n hidePreferencesButton = false,\n closeBehavior = 'collapse',\n i18nStrings,\n ...restProps\n}: SplitPanelProps) {\n const isRefresh = useVisualRefresh();\n const { __internalRootRef } = useBaseComponent('SplitPanel');\n const {\n size,\n getMaxWidth,\n getMaxHeight,\n position,\n topOffset,\n bottomOffset,\n rightOffset,\n contentWidthStyles,\n isOpen,\n isForcedPosition,\n onPreferencesChange,\n onResize,\n onToggle,\n reportSize,\n setSplitPanelToggle,\n refs,\n } = useSplitPanelContext();\n const baseProps = getBaseProps(restProps);\n const [isPreferencesOpen, setPreferencesOpen] = useState<boolean>(false);\n const [relativeSize, setRelativeSize] = useState(0);\n const [maxSize, setMaxSize] = useState(size);\n const minSize = position === 'bottom' ? MIN_HEIGHT : MIN_WIDTH;\n const cappedSize = getLimitedValue(minSize, size, maxSize);\n const appLayoutMaxWidth = isRefresh && position === 'bottom' ? contentWidthStyles : undefined;\n\n useEffect(() => {\n setSplitPanelToggle({ displayed: closeBehavior === 'collapse', ariaLabel: i18nStrings.openButtonAriaLabel });\n }, [setSplitPanelToggle, i18nStrings.openButtonAriaLabel, closeBehavior]);\n\n useEffect(() => {\n // effects are called inside out in the components tree\n // wait one frame to allow app-layout to complete its calculations\n const handle = requestAnimationFrame(() => {\n const maxSize = position === 'bottom' ? getMaxHeight() : getMaxWidth();\n setRelativeSize((size / maxSize) * 100);\n setMaxSize(maxSize);\n });\n return () => cancelAnimationFrame(handle);\n }, [size, position, getMaxHeight, getMaxWidth]);\n\n useEffect(() => {\n reportSize(cappedSize);\n }, [reportSize, cappedSize]);\n\n useEffect(() => {\n const handler = () => setMaxSize(position === 'bottom' ? getMaxHeight() : getMaxWidth());\n window.addEventListener('resize', handler);\n return () => window.removeEventListener('resize', handler);\n }, [position, getMaxWidth, getMaxHeight]);\n\n const setSidePanelWidth = (width: number) => {\n const maxWidth = getMaxWidth();\n const size = getLimitedValue(MIN_WIDTH, width, maxWidth);\n\n if (isOpen && maxWidth >= MIN_WIDTH) {\n onResize({ size });\n }\n };\n\n const setBottomPanelHeight = (height: number) => {\n const maxHeight = getMaxHeight();\n const size = getLimitedValue(MIN_HEIGHT, height, maxHeight);\n\n if (isOpen && maxHeight >= MIN_HEIGHT) {\n onResize({ size });\n }\n };\n\n const splitPanelRefObject = useRef<HTMLDivElement>(null);\n\n const sizeControlProps: SizeControlProps = {\n position,\n splitPanelRef: splitPanelRefObject,\n handleRef: refs.slider,\n setSidePanelWidth,\n setBottomPanelHeight,\n };\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const wrappedChildren = (\n <AppLayoutContext.Provider\n value={{\n stickyOffsetTop: topOffset,\n stickyOffsetBottom: bottomOffset,\n hasBreadcrumbs: false,\n }}\n >\n {children}\n </AppLayoutContext.Provider>\n );\n\n const panelHeaderId = useUniqueId('split-panel-header');\n\n const wrappedHeader = (\n <div className={styles.header} style={appLayoutMaxWidth}>\n <h2 className={styles['header-text']} id={panelHeaderId}>\n {header}\n </h2>\n <div className={styles['header-actions']}>\n {!hidePreferencesButton && isOpen && (\n <>\n <InternalButton\n className={styles['preferences-button']}\n iconName=\"settings\"\n variant=\"icon\"\n onClick={() => setPreferencesOpen(true)}\n formAction=\"none\"\n ariaLabel={i18nStrings.preferencesTitle}\n ref={refs.preferences}\n />\n <span className={styles.divider} />\n </>\n )}\n\n {isOpen ? (\n <InternalButton\n className={styles['close-button']}\n iconName={\n isRefresh && closeBehavior === 'collapse' ? (position === 'side' ? 'angle-right' : 'angle-down') : 'close'\n }\n variant=\"icon\"\n onClick={onToggle}\n formAction=\"none\"\n ariaLabel={i18nStrings.closeButtonAriaLabel}\n ariaExpanded={isOpen}\n />\n ) : position === 'side' ? null : (\n <InternalButton\n className={styles['open-button']}\n iconName=\"angle-up\"\n variant=\"icon\"\n formAction=\"none\"\n ariaLabel={i18nStrings.openButtonAriaLabel}\n ref={refs.toggle}\n ariaExpanded={isOpen}\n />\n )}\n </div>\n </div>\n );\n\n const resizeHandle = (\n <div\n ref={refs.slider}\n role=\"slider\"\n tabIndex={0}\n aria-label={i18nStrings.resizeHandleAriaLabel}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={relativeSize}\n className={clsx(styles.slider, styles[`slider-${position}`])}\n onKeyDown={onKeyDown}\n onPointerDown={onSliderPointerDown}\n >\n <ResizeHandler className={clsx(styles['slider-icon'], styles[`slider-icon-${position}`])} />\n </div>\n );\n\n /*\n This effect forces the browser to recalculate the layout\n whenever the split panel might have moved.\n\n This is needed as a workaround for a bug in Safari, which does\n not automatically calculate the new position of the split panel\n _content_ when the split panel moves.\n */\n useLayoutEffect(() => {\n const root = __internalRootRef.current;\n\n if (root) {\n const property = 'transform';\n const temporaryValue = 'translateZ(0)';\n\n const valueBefore = root.style[property];\n root.style[property] = temporaryValue;\n\n // This line forces the browser to recalculate the layout\n void root.offsetHeight;\n\n root.style[property] = valueBefore;\n }\n }, [rightOffset, __internalRootRef]);\n\n const mergedRef = useMergeRefs(splitPanelRefObject, __internalRootRef);\n\n if (closeBehavior === 'hide' && !isOpen) {\n return <></>;\n }\n\n /**\n * The AppLayout factor moved the circular buttons out of the\n * SplitPanel and into the Tools component. This conditional\n * is still needed for the early return to prevent execution\n * of the following code.\n */\n if (isRefresh && !isOpen && position === 'side') {\n return <></>;\n }\n\n return (\n <Transition in={isOpen ?? false}>\n {(state, transitioningElementRef) => (\n <>\n {position === 'side' && (\n <SplitPanelContentSide\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={cappedSize}\n onToggle={onToggle}\n i18nStrings={i18nStrings}\n toggleRef={refs.toggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n >\n {wrappedChildren}\n </SplitPanelContentSide>\n )}\n\n {position === 'bottom' && (\n <SplitPanelContentBottom\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={cappedSize}\n onToggle={onToggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n state={state}\n transitioningElementRef={transitioningElementRef}\n appLayoutMaxWidth={appLayoutMaxWidth}\n >\n {wrappedChildren}\n </SplitPanelContentBottom>\n )}\n {isPreferencesOpen && (\n <PreferencesModal\n visible={true}\n preferences={{ position }}\n disabledSidePosition={position === 'bottom' && isForcedPosition}\n isRefresh={isRefresh}\n i18nStrings={{\n header: i18nStrings.preferencesTitle,\n confirm: i18nStrings.preferencesConfirm,\n cancel: i18nStrings.preferencesCancel,\n positionLabel: i18nStrings.preferencesPositionLabel,\n positionDescription: i18nStrings.preferencesPositionDescription,\n positionBottom: i18nStrings.preferencesPositionBottom,\n positionSide: i18nStrings.preferencesPositionSide,\n }}\n onConfirm={preferences => {\n onPreferencesChange({ ...preferences });\n setPreferencesOpen(false);\n }}\n onDismiss={() => {\n setPreferencesOpen(false);\n }}\n />\n )}\n </>\n )}\n </Transition>\n );\n}\n\napplyDisplayName(SplitPanel, 'SplitPanel');\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["split-panel/index.tsx"],"names":[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EAAE,WAAW,CAAC,wBAAwB;gBACnD,mBAAmB,EAAE,WAAW,CAAC,8BAA8B;gBAC/D,cAAc,EAAE,WAAW,CAAC,yBAAyB;gBACrD,YAAY,EAAE,WAAW,CAAC,uBAAuB;aAClD,EACD,SAAS,EAAE,WAAW,CAAC,EAAE;gBACvB,mBAAmB,mBAAM,WAAW,EAAG,CAAC;gBACxC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,EACD,SAAS,EAAE,GAAG,EAAE;gBACd,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,GACD,CACH,CACA,CACJ,CACU,CACd,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState, useEffect, useLayoutEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\n\nimport { SplitPanelProps, SizeControlProps } from './interfaces';\nimport ResizeHandler from './icons/resize-handler';\nimport PreferencesModal from './preferences-modal';\nimport { usePointerEvents } from './utils/use-pointer-events';\nimport { useKeyboardEvents } from './utils/use-keyboard-events';\n\nimport styles from './styles.css.js';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { AppLayoutContext } from '../internal/context/app-layout-context';\nimport { getLimitedValue } from './utils/size-utils';\nimport { Transition } from '../internal/components/transition';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { SplitPanelContentSide } from './side';\nimport { SplitPanelContentBottom } from './bottom';\n\nexport { SplitPanelProps };\n\nconst MIN_HEIGHT = 160;\nconst MIN_WIDTH = 280;\n\nexport default function SplitPanel({\n header,\n children,\n hidePreferencesButton = false,\n closeBehavior = 'collapse',\n i18nStrings,\n ...restProps\n}: SplitPanelProps) {\n const isRefresh = useVisualRefresh();\n const { __internalRootRef } = useBaseComponent('SplitPanel');\n const {\n size,\n getMaxWidth,\n getMaxHeight,\n position,\n topOffset,\n bottomOffset,\n rightOffset,\n contentWidthStyles,\n isOpen,\n isForcedPosition,\n onPreferencesChange,\n onResize,\n onToggle,\n reportSize,\n setSplitPanelToggle,\n refs,\n } = useSplitPanelContext();\n const baseProps = getBaseProps(restProps);\n const [isPreferencesOpen, setPreferencesOpen] = useState<boolean>(false);\n const [relativeSize, setRelativeSize] = useState(0);\n const [maxSize, setMaxSize] = useState(size);\n const minSize = position === 'bottom' ? MIN_HEIGHT : MIN_WIDTH;\n const cappedSize = getLimitedValue(minSize, size, maxSize);\n const appLayoutMaxWidth = isRefresh && position === 'bottom' ? contentWidthStyles : undefined;\n\n useEffect(() => {\n setSplitPanelToggle({ displayed: closeBehavior === 'collapse', ariaLabel: i18nStrings.openButtonAriaLabel });\n }, [setSplitPanelToggle, i18nStrings.openButtonAriaLabel, closeBehavior]);\n\n useEffect(() => {\n // effects are called inside out in the components tree\n // wait one frame to allow app-layout to complete its calculations\n const handle = requestAnimationFrame(() => {\n const maxSize = position === 'bottom' ? getMaxHeight() : getMaxWidth();\n setRelativeSize(((size - minSize) / (maxSize - minSize)) * 100);\n setMaxSize(maxSize);\n });\n return () => cancelAnimationFrame(handle);\n }, [size, minSize, position, getMaxHeight, getMaxWidth]);\n\n useEffect(() => {\n reportSize(cappedSize);\n }, [reportSize, cappedSize]);\n\n useEffect(() => {\n const handler = () => setMaxSize(position === 'bottom' ? getMaxHeight() : getMaxWidth());\n window.addEventListener('resize', handler);\n return () => window.removeEventListener('resize', handler);\n }, [position, getMaxWidth, getMaxHeight]);\n\n const setSidePanelWidth = (width: number) => {\n const maxWidth = getMaxWidth();\n const size = getLimitedValue(MIN_WIDTH, width, maxWidth);\n\n if (isOpen && maxWidth >= MIN_WIDTH) {\n onResize({ size });\n }\n };\n\n const setBottomPanelHeight = (height: number) => {\n const maxHeight = getMaxHeight();\n const size = getLimitedValue(MIN_HEIGHT, height, maxHeight);\n\n if (isOpen && maxHeight >= MIN_HEIGHT) {\n onResize({ size });\n }\n };\n\n const splitPanelRefObject = useRef<HTMLDivElement>(null);\n\n const sizeControlProps: SizeControlProps = {\n position,\n splitPanelRef: splitPanelRefObject,\n handleRef: refs.slider,\n setSidePanelWidth,\n setBottomPanelHeight,\n };\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const wrappedChildren = (\n <AppLayoutContext.Provider\n value={{\n stickyOffsetTop: topOffset,\n stickyOffsetBottom: bottomOffset,\n hasBreadcrumbs: false,\n }}\n >\n {children}\n </AppLayoutContext.Provider>\n );\n\n const panelHeaderId = useUniqueId('split-panel-header');\n\n const wrappedHeader = (\n <div className={styles.header} style={appLayoutMaxWidth}>\n <h2 className={styles['header-text']} id={panelHeaderId}>\n {header}\n </h2>\n <div className={styles['header-actions']}>\n {!hidePreferencesButton && isOpen && (\n <>\n <InternalButton\n className={styles['preferences-button']}\n iconName=\"settings\"\n variant=\"icon\"\n onClick={() => setPreferencesOpen(true)}\n formAction=\"none\"\n ariaLabel={i18nStrings.preferencesTitle}\n ref={refs.preferences}\n />\n <span className={styles.divider} />\n </>\n )}\n\n {isOpen ? (\n <InternalButton\n className={styles['close-button']}\n iconName={\n isRefresh && closeBehavior === 'collapse' ? (position === 'side' ? 'angle-right' : 'angle-down') : 'close'\n }\n variant=\"icon\"\n onClick={onToggle}\n formAction=\"none\"\n ariaLabel={i18nStrings.closeButtonAriaLabel}\n ariaExpanded={isOpen}\n />\n ) : position === 'side' ? null : (\n <InternalButton\n className={styles['open-button']}\n iconName=\"angle-up\"\n variant=\"icon\"\n formAction=\"none\"\n ariaLabel={i18nStrings.openButtonAriaLabel}\n ref={refs.toggle}\n ariaExpanded={isOpen}\n />\n )}\n </div>\n </div>\n );\n\n const resizeHandle = (\n <div\n ref={refs.slider}\n role=\"slider\"\n tabIndex={0}\n aria-label={i18nStrings.resizeHandleAriaLabel}\n aria-valuemax={100}\n aria-valuemin={0}\n // Allows us to use the logical left/right keys to move the slider left/right,\n // but match aria keyboard behavior of using left/right to decrease/increase\n // the slider value.\n aria-valuenow={position === 'bottom' ? relativeSize : 100 - relativeSize}\n className={clsx(styles.slider, styles[`slider-${position}`])}\n onKeyDown={onKeyDown}\n onPointerDown={onSliderPointerDown}\n >\n <ResizeHandler className={clsx(styles['slider-icon'], styles[`slider-icon-${position}`])} />\n </div>\n );\n\n /*\n This effect forces the browser to recalculate the layout\n whenever the split panel might have moved.\n\n This is needed as a workaround for a bug in Safari, which does\n not automatically calculate the new position of the split panel\n _content_ when the split panel moves.\n */\n useLayoutEffect(() => {\n const root = __internalRootRef.current;\n\n if (root) {\n const property = 'transform';\n const temporaryValue = 'translateZ(0)';\n\n const valueBefore = root.style[property];\n root.style[property] = temporaryValue;\n\n // This line forces the browser to recalculate the layout\n void root.offsetHeight;\n\n root.style[property] = valueBefore;\n }\n }, [rightOffset, __internalRootRef]);\n\n const mergedRef = useMergeRefs(splitPanelRefObject, __internalRootRef);\n\n if (closeBehavior === 'hide' && !isOpen) {\n return <></>;\n }\n\n /**\n * The AppLayout factor moved the circular buttons out of the\n * SplitPanel and into the Tools component. This conditional\n * is still needed for the early return to prevent execution\n * of the following code.\n */\n if (isRefresh && !isOpen && position === 'side') {\n return <></>;\n }\n\n return (\n <Transition in={isOpen ?? false}>\n {(state, transitioningElementRef) => (\n <>\n {position === 'side' && (\n <SplitPanelContentSide\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={cappedSize}\n onToggle={onToggle}\n i18nStrings={i18nStrings}\n toggleRef={refs.toggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n >\n {wrappedChildren}\n </SplitPanelContentSide>\n )}\n\n {position === 'bottom' && (\n <SplitPanelContentBottom\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={cappedSize}\n onToggle={onToggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n state={state}\n transitioningElementRef={transitioningElementRef}\n appLayoutMaxWidth={appLayoutMaxWidth}\n >\n {wrappedChildren}\n </SplitPanelContentBottom>\n )}\n {isPreferencesOpen && (\n <PreferencesModal\n visible={true}\n preferences={{ position }}\n disabledSidePosition={position === 'bottom' && isForcedPosition}\n isRefresh={isRefresh}\n i18nStrings={{\n header: i18nStrings.preferencesTitle,\n confirm: i18nStrings.preferencesConfirm,\n cancel: i18nStrings.preferencesCancel,\n positionLabel: i18nStrings.preferencesPositionLabel,\n positionDescription: i18nStrings.preferencesPositionDescription,\n positionBottom: i18nStrings.preferencesPositionBottom,\n positionSide: i18nStrings.preferencesPositionSide,\n }}\n onConfirm={preferences => {\n onPreferencesChange({ ...preferences });\n setPreferencesOpen(false);\n }}\n onDismiss={() => {\n setPreferencesOpen(false);\n }}\n />\n )}\n </>\n )}\n </Transition>\n );\n}\n\napplyDisplayName(SplitPanel, 'SplitPanel');\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use-keyboard-events.d.ts","sourceRoot":"lib/default/","sources":["split-panel/utils/use-keyboard-events.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAqBjD,eAAO,MAAM,iBAAiB,0EAK3B,gBAAgB,aACF,mBAAmB,SAkDnC,CAAC"}
1
+ {"version":3,"file":"use-keyboard-events.d.ts","sourceRoot":"lib/default/","sources":["split-panel/utils/use-keyboard-events.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAqBjD,eAAO,MAAM,iBAAiB,0EAK3B,gBAAgB,aACF,mBAAmB,SAuDnC,CAAC"}
@@ -32,14 +32,18 @@ export const useKeyboardEvents = ({ position, setSidePanelWidth, setBottomPanelH
32
32
  // don't need the exact max size as it's constrained in the set size function
33
33
  maxSize = window.innerHeight;
34
34
  }
35
+ const primaryGrowKey = position === 'bottom' ? KeyCode.up : KeyCode.left;
36
+ const primaryShrinkKey = position === 'bottom' ? KeyCode.down : KeyCode.right;
37
+ const altGrowKey = position === 'bottom' ? KeyCode.right : KeyCode.down;
38
+ const altShrinkKey = position === 'bottom' ? KeyCode.left : KeyCode.up;
35
39
  let isEventHandled = true;
36
40
  switch (event.keyCode) {
37
- case KeyCode.left:
38
- case KeyCode.up:
41
+ case primaryGrowKey:
42
+ case altGrowKey:
39
43
  setSizeFunction(currentSize + KEYBOARD_SINGLE_STEP_SIZE);
40
44
  break;
41
- case KeyCode.right:
42
- case KeyCode.down:
45
+ case primaryShrinkKey:
46
+ case altShrinkKey:
43
47
  setSizeFunction(currentSize - KEYBOARD_SINGLE_STEP_SIZE);
44
48
  break;
45
49
  case KeyCode.pageUp:
@@ -1 +1 @@
1
- {"version":3,"file":"use-keyboard-events.js","sourceRoot":"lib/default/","sources":["split-panel/utils/use-keyboard-events.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,MAAM,yBAAyB,GAAG,EAAE,CAAC;AACrC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAExC,MAAM,cAAc,GAAG,CAAC,aAA+C,EAAE,EAAE;IACzE,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE;QAC5C,OAAO;YACL,gBAAgB,EAAE,CAAC;YACnB,eAAe,EAAE,CAAC;SACnB,CAAC;KACH;IAED,MAAM,cAAc,GAAG,CAAC,IAAI,GAAG,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;I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AM;YACR,KAAK,OAAO,CAAC,QAAQ;gBACnB,eAAe,CAAC,WAAW,GAAG,4BAA4B,CAAC,CAAC;gBAC5D,MAAM;YACR,KAAK,OAAO,CAAC,IAAI;gBACf,eAAe,CAAC,OAAO,CAAC,CAAC;gBACzB,MAAM;YACR,KAAK,OAAO,CAAC,GAAG;gBACd,eAAe,CAAC,CAAC,CAAC,CAAC;gBACnB,MAAM;YACR;gBACE,cAAc,GAAG,KAAK,CAAC;SAC1B;QAED,IAAI,cAAc,EAAE;YAClB,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC,eAAe,EAAE,CAAC;SACzB;IACH,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { KeyCode } from '../../internal/keycode';\nimport { SizeControlProps } from '../interfaces';\n\nconst KEYBOARD_SINGLE_STEP_SIZE = 10;\nconst KEYBOARD_MULTIPLE_STEPS_SIZE = 60;\n\nconst getCurrentSize = (splitPanelRef?: React.RefObject<HTMLDivElement>) => {\n if (!splitPanelRef || !splitPanelRef.current) {\n return {\n splitPanelHeight: 0,\n splitPanelWidth: 0,\n };\n }\n\n const safeParseFloat = (size = '') => parseFloat(size) || 0;\n\n return {\n splitPanelHeight: safeParseFloat(splitPanelRef.current.style.height),\n splitPanelWidth: safeParseFloat(splitPanelRef.current.style.width),\n };\n};\n\nexport const useKeyboardEvents = ({\n position,\n setSidePanelWidth,\n setBottomPanelHeight,\n splitPanelRef,\n}: SizeControlProps) => {\n return (event: React.KeyboardEvent) => {\n let setSizeFunction;\n let currentSize;\n let maxSize;\n\n const { splitPanelHeight, splitPanelWidth } = getCurrentSize(splitPanelRef);\n\n if (position === 'side') {\n setSizeFunction = setSidePanelWidth;\n currentSize = splitPanelWidth;\n // don't need the exact max size as it's constrained in the set size function\n maxSize = window.innerWidth;\n } else {\n setSizeFunction = setBottomPanelHeight;\n currentSize = splitPanelHeight;\n // don't need the exact max size as it's constrained in the set size function\n maxSize = window.innerHeight;\n }\n\n let isEventHandled = true;\n switch (event.keyCode) {\n case KeyCode.left:\n case KeyCode.up:\n setSizeFunction(currentSize + KEYBOARD_SINGLE_STEP_SIZE);\n break;\n case KeyCode.right:\n case KeyCode.down:\n setSizeFunction(currentSize - KEYBOARD_SINGLE_STEP_SIZE);\n break;\n case KeyCode.pageUp:\n setSizeFunction(currentSize + KEYBOARD_MULTIPLE_STEPS_SIZE);\n break;\n case KeyCode.pageDown:\n setSizeFunction(currentSize - KEYBOARD_MULTIPLE_STEPS_SIZE);\n break;\n case KeyCode.home:\n setSizeFunction(maxSize);\n break;\n case KeyCode.end:\n setSizeFunction(0);\n break;\n default:\n isEventHandled = false;\n }\n\n if (isEventHandled) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n};\n"]}
1
+ {"version":3,"file":"use-keyboard-events.js","sourceRoot":"lib/default/","sources":["split-panel/utils/use-keyboard-events.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,MAAM,yBAAyB,GAAG,EAAE,CAAC;AACrC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAExC,MAAM,cAAc,GAAG,CAAC,aAA+C,EAAE,EAAE;IACzE,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE;QAC5C,OAAO;YACL,gBAAgB,EAAE,CAAC;YACnB,eAAe,EAAE,CAAC;SACnB,CAAC;KACH;IAED,MAAM,cAAc,GAAG,CAAC,IAAI,GAAG,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE5D,OAAO;QACL,gBAAgB,EAAE,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;QACpE,eAAe,EAAE,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CA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AC;YACpB,KAAK,UAAU;gBACb,eAAe,CAAC,WAAW,GAAG,yBAAyB,CAAC,CAAC;gBACzD,MAAM;YACR,KAAK,gBAAgB,CAAC;YACtB,KAAK,YAAY;gBACf,eAAe,CAAC,WAAW,GAAG,yBAAyB,CAAC,CAAC;gBACzD,MAAM;YACR,KAAK,OAAO,CAAC,MAAM;gBACjB,eAAe,CAAC,WAAW,GAAG,4BAA4B,CAAC,CAAC;gBAC5D,MAAM;YACR,KAAK,OAAO,CAAC,QAAQ;gBACnB,eAAe,CAAC,WAAW,GAAG,4BAA4B,CAAC,CAAC;gBAC5D,MAAM;YACR,KAAK,OAAO,CAAC,IAAI;gBACf,eAAe,CAAC,OAAO,CAAC,CAAC;gBACzB,MAAM;YACR,KAAK,OAAO,CAAC,GAAG;gBACd,eAAe,CAAC,CAAC,CAAC,CAAC;gBACnB,MAAM;YACR;gBACE,cAAc,GAAG,KAAK,CAAC;SAC1B;QAED,IAAI,cAAc,EAAE;YAClB,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC,eAAe,EAAE,CAAC;SACzB;IACH,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { KeyCode } from '../../internal/keycode';\nimport { SizeControlProps } from '../interfaces';\n\nconst KEYBOARD_SINGLE_STEP_SIZE = 10;\nconst KEYBOARD_MULTIPLE_STEPS_SIZE = 60;\n\nconst getCurrentSize = (splitPanelRef?: React.RefObject<HTMLDivElement>) => {\n if (!splitPanelRef || !splitPanelRef.current) {\n return {\n splitPanelHeight: 0,\n splitPanelWidth: 0,\n };\n }\n\n const safeParseFloat = (size = '') => parseFloat(size) || 0;\n\n return {\n splitPanelHeight: safeParseFloat(splitPanelRef.current.style.height),\n splitPanelWidth: safeParseFloat(splitPanelRef.current.style.width),\n };\n};\n\nexport const useKeyboardEvents = ({\n position,\n setSidePanelWidth,\n setBottomPanelHeight,\n splitPanelRef,\n}: SizeControlProps) => {\n return (event: React.KeyboardEvent) => {\n let setSizeFunction;\n let currentSize;\n let maxSize;\n\n const { splitPanelHeight, splitPanelWidth } = getCurrentSize(splitPanelRef);\n\n if (position === 'side') {\n setSizeFunction = setSidePanelWidth;\n currentSize = splitPanelWidth;\n // don't need the exact max size as it's constrained in the set size function\n maxSize = window.innerWidth;\n } else {\n setSizeFunction = setBottomPanelHeight;\n currentSize = splitPanelHeight;\n // don't need the exact max size as it's constrained in the set size function\n maxSize = window.innerHeight;\n }\n\n const primaryGrowKey = position === 'bottom' ? KeyCode.up : KeyCode.left;\n const primaryShrinkKey = position === 'bottom' ? KeyCode.down : KeyCode.right;\n const altGrowKey = position === 'bottom' ? KeyCode.right : KeyCode.down;\n const altShrinkKey = position === 'bottom' ? KeyCode.left : KeyCode.up;\n\n let isEventHandled = true;\n switch (event.keyCode) {\n case primaryGrowKey:\n case altGrowKey:\n setSizeFunction(currentSize + KEYBOARD_SINGLE_STEP_SIZE);\n break;\n case primaryShrinkKey:\n case altShrinkKey:\n setSizeFunction(currentSize - KEYBOARD_SINGLE_STEP_SIZE);\n break;\n case KeyCode.pageUp:\n setSizeFunction(currentSize + KEYBOARD_MULTIPLE_STEPS_SIZE);\n break;\n case KeyCode.pageDown:\n setSizeFunction(currentSize - KEYBOARD_MULTIPLE_STEPS_SIZE);\n break;\n case KeyCode.home:\n setSizeFunction(maxSize);\n break;\n case KeyCode.end:\n setSizeFunction(0);\n break;\n default:\n isEventHandled = false;\n }\n\n if (isEventHandled) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n};\n"]}
@@ -1,24 +1,24 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "header-cell": "awsui_header-cell_1spae_f15ng_93",
5
- "header-cell-sticky": "awsui_header-cell-sticky_1spae_f15ng_105",
6
- "header-cell-stuck": "awsui_header-cell-stuck_1spae_f15ng_108",
7
- "header-cell-variant-full-page": "awsui_header-cell-variant-full-page_1spae_f15ng_108",
8
- "header-cell-hidden": "awsui_header-cell-hidden_1spae_f15ng_111",
9
- "header-cell-sortable": "awsui_header-cell-sortable_1spae_f15ng_114",
10
- "header-cell-resizable": "awsui_header-cell-resizable_1spae_f15ng_129",
11
- "sorting-icon": "awsui_sorting-icon_1spae_f15ng_133",
12
- "edit-icon": "awsui_edit-icon_1spae_f15ng_141",
13
- "header-cell-content": "awsui_header-cell-content_1spae_f15ng_147",
14
- "header-cell-fake-focus": "awsui_header-cell-fake-focus_1spae_f15ng_176",
15
- "header-cell-disabled": "awsui_header-cell-disabled_1spae_f15ng_194",
16
- "header-cell-sorted": "awsui_header-cell-sorted_1spae_f15ng_194",
17
- "header-cell-text": "awsui_header-cell-text_1spae_f15ng_208",
18
- "header-cell-text-wrap": "awsui_header-cell-text-wrap_1spae_f15ng_213",
19
- "header-cell-ascending": "awsui_header-cell-ascending_1spae_f15ng_219",
20
- "header-cell-descending": "awsui_header-cell-descending_1spae_f15ng_220",
21
- "is-visual-refresh": "awsui_is-visual-refresh_1spae_f15ng_230",
22
- "has-striped-rows": "awsui_has-striped-rows_1spae_f15ng_241"
4
+ "header-cell": "awsui_header-cell_1spae_12dot_93",
5
+ "header-cell-sticky": "awsui_header-cell-sticky_1spae_12dot_105",
6
+ "header-cell-stuck": "awsui_header-cell-stuck_1spae_12dot_108",
7
+ "header-cell-variant-full-page": "awsui_header-cell-variant-full-page_1spae_12dot_108",
8
+ "header-cell-hidden": "awsui_header-cell-hidden_1spae_12dot_111",
9
+ "header-cell-sortable": "awsui_header-cell-sortable_1spae_12dot_114",
10
+ "header-cell-resizable": "awsui_header-cell-resizable_1spae_12dot_129",
11
+ "sorting-icon": "awsui_sorting-icon_1spae_12dot_133",
12
+ "edit-icon": "awsui_edit-icon_1spae_12dot_141",
13
+ "header-cell-content": "awsui_header-cell-content_1spae_12dot_147",
14
+ "header-cell-fake-focus": "awsui_header-cell-fake-focus_1spae_12dot_176",
15
+ "header-cell-disabled": "awsui_header-cell-disabled_1spae_12dot_194",
16
+ "header-cell-sorted": "awsui_header-cell-sorted_1spae_12dot_194",
17
+ "header-cell-text": "awsui_header-cell-text_1spae_12dot_208",
18
+ "header-cell-text-wrap": "awsui_header-cell-text-wrap_1spae_12dot_213",
19
+ "header-cell-ascending": "awsui_header-cell-ascending_1spae_12dot_219",
20
+ "header-cell-descending": "awsui_header-cell-descending_1spae_12dot_220",
21
+ "is-visual-refresh": "awsui_is-visual-refresh_1spae_12dot_230",
22
+ "has-striped-rows": "awsui_has-striped-rows_1spae_12dot_241"
23
23
  };
24
24