@cloudscape-design/components-themeable 3.0.935 → 3.0.937

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 (130) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/code-editor/resizable-box/styles.scss +7 -15
  3. package/lib/internal/scss/internal/components/drag-handle-wrapper/motion.scss +190 -0
  4. package/lib/internal/scss/internal/components/drag-handle-wrapper/styles.scss +110 -0
  5. package/lib/internal/scss/side-navigation/test-classes/styles.scss +7 -0
  6. package/lib/internal/scss/table/selection/styles.scss +5 -0
  7. package/lib/internal/template/code-editor/index.d.ts.map +1 -1
  8. package/lib/internal/template/code-editor/index.js +2 -2
  9. package/lib/internal/template/code-editor/index.js.map +1 -1
  10. package/lib/internal/template/code-editor/interfaces.d.ts +2 -0
  11. package/lib/internal/template/code-editor/interfaces.d.ts.map +1 -1
  12. package/lib/internal/template/code-editor/interfaces.js.map +1 -1
  13. package/lib/internal/template/code-editor/pane.d.ts +3 -1
  14. package/lib/internal/template/code-editor/pane.d.ts.map +1 -1
  15. package/lib/internal/template/code-editor/pane.js +2 -2
  16. package/lib/internal/template/code-editor/pane.js.map +1 -1
  17. package/lib/internal/template/code-editor/resizable-box/index.d.ts +3 -1
  18. package/lib/internal/template/code-editor/resizable-box/index.d.ts.map +1 -1
  19. package/lib/internal/template/code-editor/resizable-box/index.js +40 -8
  20. package/lib/internal/template/code-editor/resizable-box/index.js.map +1 -1
  21. package/lib/internal/template/code-editor/resizable-box/styles.css.js +4 -3
  22. package/lib/internal/template/code-editor/resizable-box/styles.scoped.css +16 -37
  23. package/lib/internal/template/code-editor/resizable-box/styles.selectors.js +4 -3
  24. package/lib/internal/template/i18n/messages/all.all.js +1 -1
  25. package/lib/internal/template/i18n/messages/all.all.json +1 -1
  26. package/lib/internal/template/i18n/messages/all.ar.js +1 -1
  27. package/lib/internal/template/i18n/messages/all.ar.json +1 -1
  28. package/lib/internal/template/i18n/messages/all.de.js +1 -1
  29. package/lib/internal/template/i18n/messages/all.de.json +1 -1
  30. package/lib/internal/template/i18n/messages/all.en-GB.js +1 -1
  31. package/lib/internal/template/i18n/messages/all.en-GB.json +1 -1
  32. package/lib/internal/template/i18n/messages/all.en.js +1 -1
  33. package/lib/internal/template/i18n/messages/all.en.json +1 -1
  34. package/lib/internal/template/i18n/messages/all.es.js +1 -1
  35. package/lib/internal/template/i18n/messages/all.es.json +1 -1
  36. package/lib/internal/template/i18n/messages/all.fr.js +1 -1
  37. package/lib/internal/template/i18n/messages/all.fr.json +1 -1
  38. package/lib/internal/template/i18n/messages/all.id.js +1 -1
  39. package/lib/internal/template/i18n/messages/all.id.json +1 -1
  40. package/lib/internal/template/i18n/messages/all.it.js +1 -1
  41. package/lib/internal/template/i18n/messages/all.it.json +1 -1
  42. package/lib/internal/template/i18n/messages/all.ja.js +1 -1
  43. package/lib/internal/template/i18n/messages/all.ja.json +1 -1
  44. package/lib/internal/template/i18n/messages/all.ko.js +1 -1
  45. package/lib/internal/template/i18n/messages/all.ko.json +1 -1
  46. package/lib/internal/template/i18n/messages/all.pt-BR.js +1 -1
  47. package/lib/internal/template/i18n/messages/all.pt-BR.json +1 -1
  48. package/lib/internal/template/i18n/messages/all.tr.js +1 -1
  49. package/lib/internal/template/i18n/messages/all.tr.json +1 -1
  50. package/lib/internal/template/i18n/messages/all.zh-CN.js +1 -1
  51. package/lib/internal/template/i18n/messages/all.zh-CN.json +1 -1
  52. package/lib/internal/template/i18n/messages/all.zh-TW.js +1 -1
  53. package/lib/internal/template/i18n/messages/all.zh-TW.json +1 -1
  54. package/lib/internal/template/i18n/messages-types.d.ts +2 -0
  55. package/lib/internal/template/i18n/messages-types.d.ts.map +1 -1
  56. package/lib/internal/template/i18n/messages-types.js.map +1 -1
  57. package/lib/internal/template/internal/base-component/styles.scoped.css +29 -0
  58. package/lib/internal/template/internal/components/drag-handle/button.d.ts +5 -0
  59. package/lib/internal/template/internal/components/drag-handle/button.d.ts.map +1 -0
  60. package/lib/internal/template/internal/components/drag-handle/button.js +35 -0
  61. package/lib/internal/template/internal/components/drag-handle/button.js.map +1 -0
  62. package/lib/internal/template/internal/components/drag-handle/index.d.ts.map +1 -1
  63. package/lib/internal/template/internal/components/drag-handle/index.js +6 -30
  64. package/lib/internal/template/internal/components/drag-handle/index.js.map +1 -1
  65. package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts +7 -1
  66. package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts.map +1 -1
  67. package/lib/internal/template/internal/components/drag-handle/interfaces.js.map +1 -1
  68. package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.d.ts +11 -0
  69. package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.d.ts.map +1 -0
  70. package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.js +30 -0
  71. package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.js.map +1 -0
  72. package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts +4 -0
  73. package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts.map +1 -0
  74. package/lib/internal/template/internal/components/drag-handle-wrapper/index.js +138 -0
  75. package/lib/internal/template/internal/components/drag-handle-wrapper/index.js.map +1 -0
  76. package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts +10 -0
  77. package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts.map +1 -0
  78. package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.js +4 -0
  79. package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.js.map +1 -0
  80. package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.d.ts +6 -0
  81. package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.d.ts.map +1 -0
  82. package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js +56 -0
  83. package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js.map +1 -0
  84. package/lib/internal/template/internal/components/drag-handle-wrapper/styles.css.js +32 -0
  85. package/lib/internal/template/internal/components/drag-handle-wrapper/styles.scoped.css +508 -0
  86. package/lib/internal/template/internal/components/drag-handle-wrapper/styles.selectors.js +33 -0
  87. package/lib/internal/template/internal/environment.js +1 -1
  88. package/lib/internal/template/internal/environment.json +1 -1
  89. package/lib/internal/template/internal/generated/styles/tokens.d.ts +6 -0
  90. package/lib/internal/template/internal/generated/styles/tokens.js +6 -0
  91. package/lib/internal/template/internal/generated/theming/index.cjs +186 -0
  92. package/lib/internal/template/internal/generated/theming/index.js +186 -0
  93. package/lib/internal/template/internal/utils/pointer-events-mock.d.ts +5 -0
  94. package/lib/internal/template/internal/utils/pointer-events-mock.d.ts.map +1 -0
  95. package/lib/internal/template/internal/utils/pointer-events-mock.js +10 -0
  96. package/lib/internal/template/internal/utils/pointer-events-mock.js.map +1 -0
  97. package/lib/internal/template/side-navigation/parts.d.ts.map +1 -1
  98. package/lib/internal/template/side-navigation/parts.js +2 -1
  99. package/lib/internal/template/side-navigation/parts.js.map +1 -1
  100. package/lib/internal/template/side-navigation/test-classes/styles.css.js +6 -0
  101. package/lib/internal/template/side-navigation/test-classes/styles.scoped.css +7 -0
  102. package/lib/internal/template/side-navigation/test-classes/styles.selectors.js +7 -0
  103. package/lib/internal/template/table/index.d.ts.map +1 -1
  104. package/lib/internal/template/table/index.js +5 -2
  105. package/lib/internal/template/table/index.js.map +1 -1
  106. package/lib/internal/template/table/interfaces.d.ts +6 -0
  107. package/lib/internal/template/table/interfaces.d.ts.map +1 -1
  108. package/lib/internal/template/table/interfaces.js.map +1 -1
  109. package/lib/internal/template/table/internal.d.ts.map +1 -1
  110. package/lib/internal/template/table/internal.js +5 -5
  111. package/lib/internal/template/table/internal.js.map +1 -1
  112. package/lib/internal/template/table/selection/selection-cell.d.ts.map +1 -1
  113. package/lib/internal/template/table/selection/selection-cell.js +1 -1
  114. package/lib/internal/template/table/selection/selection-cell.js.map +1 -1
  115. package/lib/internal/template/table/selection/selection-control.d.ts +2 -1
  116. package/lib/internal/template/table/selection/selection-control.d.ts.map +1 -1
  117. package/lib/internal/template/table/selection/selection-control.js +5 -5
  118. package/lib/internal/template/table/selection/selection-control.js.map +1 -1
  119. package/lib/internal/template/table/selection/styles.css.js +4 -3
  120. package/lib/internal/template/table/selection/styles.scoped.css +8 -3
  121. package/lib/internal/template/table/selection/styles.selectors.js +4 -3
  122. package/lib/internal/template/test-utils/dom/side-navigation/index.d.ts +1 -0
  123. package/lib/internal/template/test-utils/dom/side-navigation/index.js +4 -0
  124. package/lib/internal/template/test-utils/dom/side-navigation/index.js.map +1 -1
  125. package/lib/internal/template/test-utils/selectors/side-navigation/index.d.ts +1 -0
  126. package/lib/internal/template/test-utils/selectors/side-navigation/index.js +4 -0
  127. package/lib/internal/template/test-utils/selectors/side-navigation/index.js.map +1 -1
  128. package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
  129. package/package.json +1 -1
  130. package/lib/internal/scss/code-editor/assets/resize-handler.svg +0 -3
@@ -1 +1 @@
1
- {"version":3,"file":"pane.js","sourceRoot":"","sources":["../../../src/code-editor/pane.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAc,MAAM,QAAQ,CAAC;AAEvD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC,MAAM,UAAU,GAAG,CA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CAAC,EAAE,EAAE;;4BAAC,OAAA,CAClC,4BACE,GAAG,EAAE,CAAC,EACN,IAAI,EAAC,MAAM,EACX,SAAS,EAAE,MAAM,CAAC,UAAU,EAC5B,WAAW,EAAE,iBAAiB,EAC9B,OAAO,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,EAC3C,SAAS,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,EAC/C,QAAQ,EAAE,CAAC;gCAEX,4BAAI,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,IACxE,MAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAG,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,mCAAI,EAAE,CAClF;gCACL,4BAAI,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,IAC3E,UAAU,CAAC,IAAI,CACb,CACF,CACN,CAAA;yBAAA,CAAC,CACI,CACF,CACJ;gBACN,6BAAK,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC;oBAC7C,oBAAC,cAAc,IACb,UAAU,EAAC,MAAM,EACjB,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,oBAAoB,GAC/B,CACE,CACI,CACC,CACX,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport { Ace } from 'ace-builds';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../button/internal';\nimport FocusLock from '../internal/components/focus-lock';\nimport { KeyCode } from '../internal/keycode';\nimport { ResizableBox } from './resizable-box';\nimport { getStatusButtonId, PaneStatus } from './util';\n\nimport styles from './styles.css.js';\n\nconst ANNOTATION_ITEM_HEIGHT = 31;\nconst PANE_ANNOTATIONS_PADDING = 12;\nconst MIN_HEIGHT = 3 * ANNOTATION_ITEM_HEIGHT + 2 * PANE_ANNOTATIONS_PADDING;\n\ninterface PaneProps {\n id: string;\n paneStatus: PaneStatus;\n\n visible: boolean;\n annotations: Ace.Annotation[];\n highlighted?: Ace.Annotation;\n\n cursorPositionLabel?: (row: number, column: number) => string;\n closeButtonAriaLabel?: string;\n\n onClose: () => void;\n onAnnotationClick: (annotation: Ace.Annotation) => void;\n onAnnotationClear: () => void;\n}\n\nexport const Pane = ({\n id,\n paneStatus,\n visible,\n annotations,\n highlighted,\n onClose,\n onAnnotationClick,\n onAnnotationClear,\n cursorPositionLabel,\n closeButtonAriaLabel,\n}: PaneProps) => {\n const [paneHeight, setPaneHeight] = useState(MIN_HEIGHT);\n const listRef = useRef<HTMLTableSectionElement>(null);\n\n useEffect(() => {\n if (!highlighted) {\n return;\n }\n const { row, column } = highlighted;\n const highlightedAnnotationIndex = annotations.indexOf(\n annotations.filter(a => a.row === row && a.column === column)[0]\n );\n\n if (highlightedAnnotationIndex > -1) {\n const errorItem = listRef.current?.children[highlightedAnnotationIndex] as HTMLElement | undefined;\n errorItem?.focus();\n }\n }, [highlighted, annotations]);\n\n const onItemClick = (annotation: Ace.Annotation) => {\n onAnnotationClick(annotation);\n };\n\n const onItemKeyDown = (annotation: Ace.Annotation, event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.enter || event.keyCode === KeyCode.space) {\n event.preventDefault();\n onAnnotationClick(annotation);\n }\n };\n\n const onEscKeyDown = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n event.preventDefault();\n onClose();\n }\n };\n\n const ariaLabelledBy = getStatusButtonId({ paneId: id, paneStatus: paneStatus });\n\n if (!visible) {\n return null;\n }\n\n return (\n <div id={id} className={styles.pane} onKeyDown={onEscKeyDown} role=\"tabpanel\" aria-labelledby={ariaLabelledBy}>\n <ResizableBox height={paneHeight} minHeight={MIN_HEIGHT} onResize={newHeight => setPaneHeight(newHeight)}>\n <FocusLock className={styles['focus-lock']} autoFocus={true} restoreFocus={true}>\n <div className={styles.pane__list} tabIndex={-1}>\n <table className={styles.pane__table} role=\"presentation\">\n <colgroup>\n <col style={{ width: 1 } /* shrink to fit content */} />\n <col style={{ width: 'auto' }} />\n </colgroup>\n <tbody ref={listRef}>\n {annotations.map((annotation, i) => (\n <tr\n key={i}\n role=\"link\"\n className={styles.pane__item}\n onMouseOver={onAnnotationClear}\n onClick={onItemClick.bind(null, annotation)}\n onKeyDown={onItemKeyDown.bind(null, annotation)}\n tabIndex={0}\n >\n <td className={clsx(styles.pane__location, styles.pane__cell)} tabIndex={-1}>\n {cursorPositionLabel?.((annotation.row || 0) + 1, (annotation.column || 0) + 1) ?? ''}\n </td>\n <td className={clsx(styles.pane__description, styles.pane__cell)} tabIndex={-1}>\n {annotation.text}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n <div className={styles['pane__close-container']}>\n <InternalButton\n formAction=\"none\"\n variant=\"icon\"\n iconName=\"close\"\n onClick={onClose}\n ariaLabel={closeButtonAriaLabel}\n />\n </div>\n </FocusLock>\n </ResizableBox>\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"pane.js","sourceRoot":"","sources":["../../../src/code-editor/pane.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,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AAC;oBAC7C,oBAAC,cAAc,IACb,UAAU,EAAC,MAAM,EACjB,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,oBAAoB,GAC/B,CACE,CACI,CACC,CACX,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport { Ace } from 'ace-builds';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../button/internal';\nimport FocusLock from '../internal/components/focus-lock';\nimport { KeyCode } from '../internal/keycode';\nimport { ResizableBox } from './resizable-box';\nimport { getStatusButtonId, PaneStatus } from './util';\n\nimport styles from './styles.css.js';\n\nconst ANNOTATION_ITEM_HEIGHT = 31;\nconst PANE_ANNOTATIONS_PADDING = 12;\nconst MIN_HEIGHT = 3 * ANNOTATION_ITEM_HEIGHT + 2 * PANE_ANNOTATIONS_PADDING;\n\ninterface PaneProps {\n id: string;\n paneStatus: PaneStatus;\n\n visible: boolean;\n annotations: Ace.Annotation[];\n highlighted?: Ace.Annotation;\n\n cursorPositionLabel?: (row: number, column: number) => string;\n closeButtonAriaLabel?: string;\n handleAriaLabel?: string;\n handleTooltipText?: string;\n\n onClose: () => void;\n onAnnotationClick: (annotation: Ace.Annotation) => void;\n onAnnotationClear: () => void;\n}\n\nexport const Pane = ({\n id,\n paneStatus,\n visible,\n annotations,\n highlighted,\n onClose,\n onAnnotationClick,\n onAnnotationClear,\n cursorPositionLabel,\n closeButtonAriaLabel,\n handleAriaLabel,\n handleTooltipText,\n}: PaneProps) => {\n const [paneHeight, setPaneHeight] = useState(MIN_HEIGHT);\n const listRef = useRef<HTMLTableSectionElement>(null);\n\n useEffect(() => {\n if (!highlighted) {\n return;\n }\n const { row, column } = highlighted;\n const highlightedAnnotationIndex = annotations.indexOf(\n annotations.filter(a => a.row === row && a.column === column)[0]\n );\n\n if (highlightedAnnotationIndex > -1) {\n const errorItem = listRef.current?.children[highlightedAnnotationIndex] as HTMLElement | undefined;\n errorItem?.focus();\n }\n }, [highlighted, annotations]);\n\n const onItemClick = (annotation: Ace.Annotation) => {\n onAnnotationClick(annotation);\n };\n\n const onItemKeyDown = (annotation: Ace.Annotation, event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.enter || event.keyCode === KeyCode.space) {\n event.preventDefault();\n onAnnotationClick(annotation);\n }\n };\n\n const onEscKeyDown = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n event.preventDefault();\n onClose();\n }\n };\n\n const ariaLabelledBy = getStatusButtonId({ paneId: id, paneStatus: paneStatus });\n\n if (!visible) {\n return null;\n }\n\n return (\n <div id={id} className={styles.pane} onKeyDown={onEscKeyDown} role=\"tabpanel\" aria-labelledby={ariaLabelledBy}>\n <ResizableBox\n height={paneHeight}\n minHeight={MIN_HEIGHT}\n onResize={newHeight => setPaneHeight(newHeight)}\n handleAriaLabel={handleAriaLabel}\n handleTooltipText={handleTooltipText}\n >\n <FocusLock className={styles['focus-lock']} autoFocus={true} restoreFocus={true}>\n <div className={styles.pane__list} tabIndex={-1}>\n <table className={styles.pane__table} role=\"presentation\">\n <colgroup>\n <col style={{ width: 1 } /* shrink to fit content */} />\n <col style={{ width: 'auto' }} />\n </colgroup>\n <tbody ref={listRef}>\n {annotations.map((annotation, i) => (\n <tr\n key={i}\n role=\"link\"\n className={styles.pane__item}\n onMouseOver={onAnnotationClear}\n onClick={onItemClick.bind(null, annotation)}\n onKeyDown={onItemKeyDown.bind(null, annotation)}\n tabIndex={0}\n >\n <td className={clsx(styles.pane__location, styles.pane__cell)} tabIndex={-1}>\n {cursorPositionLabel?.((annotation.row || 0) + 1, (annotation.column || 0) + 1) ?? ''}\n </td>\n <td className={clsx(styles.pane__description, styles.pane__cell)} tabIndex={-1}>\n {annotation.text}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n <div className={styles['pane__close-container']}>\n <InternalButton\n formAction=\"none\"\n variant=\"icon\"\n iconName=\"close\"\n onClick={onClose}\n ariaLabel={closeButtonAriaLabel}\n />\n </div>\n </FocusLock>\n </ResizableBox>\n </div>\n );\n};\n"]}
@@ -4,6 +4,8 @@ export interface ResizeBoxProps {
4
4
  height: number;
5
5
  minHeight: number;
6
6
  onResize: (newHeight: number) => void;
7
+ handleAriaLabel?: string;
8
+ handleTooltipText?: string;
7
9
  }
8
- export declare function ResizableBox({ children, height, minHeight, onResize }: ResizeBoxProps): JSX.Element;
10
+ export declare function ResizableBox({ children, height, minHeight, onResize, handleAriaLabel, handleTooltipText, }: ResizeBoxProps): JSX.Element;
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAM3D,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAED,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,cAAc,eA2CrF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAU3D,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAEtC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,MAAM,EACN,SAAS,EACT,QAAQ,EACR,eAAe,EACf,iBAAiB,GAClB,EAAE,cAAc,eAoFhB"}
@@ -2,42 +2,74 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import React, { useEffect, useRef, useState } from 'react';
4
4
  import { useStableCallback } from '@cloudscape-design/component-toolkit/internal';
5
+ import InternalDragHandle from '../../internal/components/drag-handle';
5
6
  import styles from './styles.css.js';
6
- export function ResizableBox({ children, height, minHeight, onResize }) {
7
+ const KEYBOARD_STEP_SIZE = 20;
8
+ export function ResizableBox({ children, height, minHeight, onResize, handleAriaLabel, handleTooltipText, }) {
7
9
  const [dragOffset, setDragOffset] = useState(null);
8
10
  const onResizeStable = useStableCallback(onResize);
9
11
  const containerRef = useRef(null);
10
- const onMouseDown = event => {
11
- if (event.button !== 0 || !containerRef.current) {
12
+ const onPointerDown = event => {
13
+ if ((event.pointerType === 'mouse' && event.button !== 0) || !containerRef.current) {
12
14
  return;
13
15
  }
14
16
  const containerBottom = containerRef.current.getBoundingClientRect().bottom;
15
17
  setDragOffset(containerBottom - event.clientY);
16
18
  };
19
+ const onKeyDown = event => {
20
+ switch (event.key) {
21
+ case 'ArrowDown':
22
+ case 'ArrowRight':
23
+ onResizeStable(height + KEYBOARD_STEP_SIZE);
24
+ break;
25
+ case 'ArrowUp':
26
+ case 'ArrowLeft':
27
+ onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));
28
+ break;
29
+ }
30
+ };
17
31
  useEffect(() => {
18
32
  if (dragOffset === null || !containerRef.current) {
19
33
  return;
20
34
  }
21
35
  const container = containerRef.current;
22
- const onMouseMove = (event) => {
36
+ const onPointerMove = (event) => {
23
37
  const { top } = container.getBoundingClientRect();
24
38
  const cursor = event.clientY;
25
39
  onResizeStable(Math.max(cursor + dragOffset - top, minHeight));
26
40
  };
27
- const onMouseUp = () => {
41
+ const onPointerUp = () => {
28
42
  setDragOffset(null);
29
43
  };
30
44
  const controller = new AbortController();
31
45
  document.body.classList.add(styles['resize-active']);
32
- document.addEventListener('mousemove', onMouseMove, { signal: controller.signal });
33
- document.addEventListener('mouseup', onMouseUp, { signal: controller.signal });
46
+ container.classList.add(styles['cursor-active']);
47
+ document.addEventListener('pointermove', onPointerMove, { signal: controller.signal });
48
+ document.addEventListener('pointerup', onPointerUp, { signal: controller.signal });
34
49
  return () => {
35
50
  controller.abort();
36
51
  document.body.classList.remove(styles['resize-active']);
52
+ container.classList.remove(styles['cursor-active']);
37
53
  };
38
54
  }, [dragOffset, minHeight, onResizeStable]);
39
55
  return (React.createElement("div", { ref: containerRef, className: styles['resizable-box'], style: { height } },
40
56
  children,
41
- React.createElement("span", { className: styles['resizable-box-handle'], onMouseDown: onMouseDown })));
57
+ React.createElement("div", { className: styles['resizable-box-handle'] },
58
+ React.createElement(InternalDragHandle, { ariaLabel: handleAriaLabel, variant: "resize-area",
59
+ // Provide an arbitrary large value to valueMax since the editor can be
60
+ // resized to be infinitely large.
61
+ ariaValue: { valueMin: minHeight, valueMax: 1000000, valueNow: height }, tooltipText: handleTooltipText, onPointerDown: onPointerDown, onKeyDown: onKeyDown, directions: {
62
+ 'block-start': height > minHeight ? 'active' : 'disabled',
63
+ 'block-end': 'active',
64
+ }, onDirectionClick: direction => {
65
+ switch (direction) {
66
+ case 'block-end':
67
+ onResizeStable(height + KEYBOARD_STEP_SIZE);
68
+ break;
69
+ case 'block-start':
70
+ onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));
71
+ break;
72
+ }
73
+ } }))));
42
74
  }
43
75
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE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AC;QACtB,CAAC,CAAC;QACF,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;QACrD,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;QACnF,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/E,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,KAAK,EAAE,CAAC;YACnB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;IAE5C,OAAO,CACL,6BAAK,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE;QAC1E,QAAQ;QACT,8BAAM,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC,EAAE,WAAW,EAAE,WAAW,GAAI,CACzE,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { useStableCallback } from '@cloudscape-design/component-toolkit/internal';\n\nimport styles from './styles.css.js';\n\nexport interface ResizeBoxProps {\n children: React.ReactNode;\n height: number;\n minHeight: number;\n onResize: (newHeight: number) => void;\n}\n\nexport function ResizableBox({ children, height, minHeight, onResize }: ResizeBoxProps) {\n const [dragOffset, setDragOffset] = useState<null | number>(null);\n const onResizeStable = useStableCallback(onResize);\n const containerRef = useRef<HTMLDivElement>(null);\n\n const onMouseDown: React.MouseEventHandler = event => {\n if (event.button !== 0 || !containerRef.current) {\n return;\n }\n const containerBottom = containerRef.current.getBoundingClientRect().bottom;\n setDragOffset(containerBottom - event.clientY);\n };\n\n useEffect(() => {\n if (dragOffset === null || !containerRef.current) {\n return;\n }\n const container = containerRef.current;\n\n const onMouseMove = (event: MouseEvent) => {\n const { top } = container.getBoundingClientRect();\n const cursor = event.clientY;\n onResizeStable(Math.max(cursor + dragOffset - top, minHeight));\n };\n const onMouseUp = () => {\n setDragOffset(null);\n };\n const controller = new AbortController();\n document.body.classList.add(styles['resize-active']);\n document.addEventListener('mousemove', onMouseMove, { signal: controller.signal });\n document.addEventListener('mouseup', onMouseUp, { signal: controller.signal });\n return () => {\n controller.abort();\n document.body.classList.remove(styles['resize-active']);\n };\n }, [dragOffset, minHeight, onResizeStable]);\n\n return (\n <div ref={containerRef} className={styles['resizable-box']} style={{ height }}>\n {children}\n <span className={styles['resizable-box-handle']} onMouseDown={onMouseDown} />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,kBAAkB,MAAM,uCAAuC,CAAC;AAEvE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAY9B,MAAM,UAAU,YAAY,CAAC,EAC3B,QAAQ,EACR,MAAM,EACN,SAAS,EACT,QAAQ,EACR,eAAe,EACf,iBAAiB,GACF;IACf,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAClE,MAAM,cAAc,G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EAAE,MAAM,EAAE,EACvE,WAAW,EAAE,iBAAiB,EAC9B,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE;oBACV,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU;oBACzD,WAAW,EAAE,QAAQ;iBACtB,EACD,gBAAgB,EAAE,SAAS,CAAC,EAAE;oBAC5B,QAAQ,SAAS,EAAE;wBACjB,KAAK,WAAW;4BACd,cAAc,CAAC,MAAM,GAAG,kBAAkB,CAAC,CAAC;4BAC5C,MAAM;wBACR,KAAK,aAAa;4BAChB,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,kBAAkB,EAAE,SAAS,CAAC,CAAC,CAAC;4BACjE,MAAM;qBACT;gBACH,CAAC,GACD,CACE,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { useStableCallback } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalDragHandle from '../../internal/components/drag-handle';\n\nimport styles from './styles.css.js';\n\nconst KEYBOARD_STEP_SIZE = 20;\n\nexport interface ResizeBoxProps {\n children: React.ReactNode;\n height: number;\n minHeight: number;\n onResize: (newHeight: number) => void;\n\n handleAriaLabel?: string;\n handleTooltipText?: string;\n}\n\nexport function ResizableBox({\n children,\n height,\n minHeight,\n onResize,\n handleAriaLabel,\n handleTooltipText,\n}: ResizeBoxProps) {\n const [dragOffset, setDragOffset] = useState<null | number>(null);\n const onResizeStable = useStableCallback(onResize);\n const containerRef = useRef<HTMLDivElement>(null);\n\n const onPointerDown: React.PointerEventHandler = event => {\n if ((event.pointerType === 'mouse' && event.button !== 0) || !containerRef.current) {\n return;\n }\n const containerBottom = containerRef.current.getBoundingClientRect().bottom;\n setDragOffset(containerBottom - event.clientY);\n };\n\n const onKeyDown: React.KeyboardEventHandler = event => {\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowRight':\n onResizeStable(height + KEYBOARD_STEP_SIZE);\n break;\n case 'ArrowUp':\n case 'ArrowLeft':\n onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));\n break;\n }\n };\n\n useEffect(() => {\n if (dragOffset === null || !containerRef.current) {\n return;\n }\n const container = containerRef.current;\n\n const onPointerMove = (event: PointerEvent) => {\n const { top } = container.getBoundingClientRect();\n const cursor = event.clientY;\n onResizeStable(Math.max(cursor + dragOffset - top, minHeight));\n };\n const onPointerUp = () => {\n setDragOffset(null);\n };\n const controller = new AbortController();\n document.body.classList.add(styles['resize-active']);\n container.classList.add(styles['cursor-active']);\n document.addEventListener('pointermove', onPointerMove, { signal: controller.signal });\n document.addEventListener('pointerup', onPointerUp, { signal: controller.signal });\n return () => {\n controller.abort();\n document.body.classList.remove(styles['resize-active']);\n container.classList.remove(styles['cursor-active']);\n };\n }, [dragOffset, minHeight, onResizeStable]);\n\n return (\n <div ref={containerRef} className={styles['resizable-box']} style={{ height }}>\n {children}\n\n <div className={styles['resizable-box-handle']}>\n <InternalDragHandle\n ariaLabel={handleAriaLabel}\n variant=\"resize-area\"\n // Provide an arbitrary large value to valueMax since the editor can be\n // resized to be infinitely large.\n ariaValue={{ valueMin: minHeight, valueMax: 1000000, valueNow: height }}\n tooltipText={handleTooltipText}\n onPointerDown={onPointerDown}\n onKeyDown={onKeyDown}\n directions={{\n 'block-start': height > minHeight ? 'active' : 'disabled',\n 'block-end': 'active',\n }}\n onDirectionClick={direction => {\n switch (direction) {\n case 'block-end':\n onResizeStable(height + KEYBOARD_STEP_SIZE);\n break;\n case 'block-start':\n onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));\n break;\n }\n }}\n />\n </div>\n </div>\n );\n}\n"]}
@@ -1,8 +1,9 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "resizable-box": "awsui_resizable-box_cufu9_e8bsh_149",
5
- "resizable-box-handle": "awsui_resizable-box-handle_cufu9_e8bsh_154",
6
- "resize-active": "awsui_resize-active_cufu9_e8bsh_197"
4
+ "resizable-box": "awsui_resizable-box_cufu9_j3e9z_149",
5
+ "cursor-active": "awsui_cursor-active_cufu9_j3e9z_153",
6
+ "resizable-box-handle": "awsui_resizable-box-handle_cufu9_j3e9z_167",
7
+ "resize-active": "awsui_resize-active_cufu9_j3e9z_176"
7
8
  };
8
9
 
@@ -146,55 +146,34 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
146
146
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
147
147
  SPDX-License-Identifier: Apache-2.0
148
148
  */
149
- .awsui_resizable-box_cufu9_e8bsh_149:not(#\9) {
149
+ .awsui_resizable-box_cufu9_j3e9z_149:not(#\9) {
150
150
  position: relative;
151
151
  inline-size: 100%;
152
152
  }
153
+ .awsui_resizable-box_cufu9_j3e9z_149:not(#\9):not(.awsui_cursor-active_cufu9_j3e9z_153) {
154
+ transition: height var(--motion-duration-complex-wo6kj4, 270ms) var(--motion-easing-responsive-jm8d79, ease-out);
155
+ }
156
+ @media (prefers-reduced-motion: reduce) {
157
+ .awsui_resizable-box_cufu9_j3e9z_149:not(#\9):not(.awsui_cursor-active_cufu9_j3e9z_153) {
158
+ animation: none;
159
+ transition: none;
160
+ }
161
+ }
162
+ .awsui-motion-disabled .awsui_resizable-box_cufu9_j3e9z_149:not(#\9):not(.awsui_cursor-active_cufu9_j3e9z_153), .awsui-mode-entering .awsui_resizable-box_cufu9_j3e9z_149:not(#\9):not(.awsui_cursor-active_cufu9_j3e9z_153) {
163
+ animation: none;
164
+ transition: none;
165
+ }
153
166
 
154
- .awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9) {
167
+ .awsui_resizable-box-handle_cufu9_j3e9z_167:not(#\9) {
155
168
  position: absolute;
156
169
  inset-inline-end: 0;
157
170
  inset-block-end: 0;
158
171
  z-index: 10;
159
172
  inline-size: var(--space-l-eenfqd, 20px);
160
173
  block-size: var(--space-l-eenfqd, 20px);
161
- background-repeat: no-repeat;
162
- background-origin: content-box;
163
- box-sizing: border-box;
164
- background-position: bottom right;
165
- background-size: var(--space-l-eenfqd, 20px);
166
- cursor: ns-resize;
167
- background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' stroke='%23687078' fill-opacity='0' stroke-width='1'%3E %3Cpath d='M 8 13 L 13 8 M 13 11 L 11 13 M 5 13 L 13 5'/%3E %3C/svg%3E");
168
- /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
169
- }
170
- @supports (--css-variable-support-check: #000) {
171
- @media not print {
172
- .awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9) {
173
- /* stylelint-disable selector-combinator-disallowed-list, selector-class-pattern */
174
- }
175
- .awsui-polaris-dark-mode .awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9), .awsui-dark-mode .awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9) {
176
- background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' stroke='%23687078' fill-opacity='0' stroke-width='1'%3E %3Cpath d='M 8 13 L 13 8 M 13 11 L 11 13 M 5 13 L 13 5'/%3E %3C/svg%3E");
177
- }
178
- }
179
- }
180
- @supports (--css-variable-support-check: #000) {
181
- .awsui-visual-refresh .awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9) {
182
- background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' stroke='%23424650' fill-opacity='0' stroke-width='1'%3E %3Cpath d='M 8 13 L 13 8 M 13 11 L 11 13 M 5 13 L 13 5'/%3E %3C/svg%3E");
183
- }
184
- @media not print {
185
- .awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9) {
186
- /* stylelint-disable selector-combinator-disallowed-list, selector-class-pattern */
187
- }
188
- .awsui-visual-refresh.awsui-polaris-dark-mode .awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9), .awsui-visual-refresh.awsui-dark-mode .awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9) {
189
- background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' stroke='%23dedee3' fill-opacity='0' stroke-width='1'%3E %3Cpath d='M 8 13 L 13 8 M 13 11 L 11 13 M 5 13 L 13 5'/%3E %3C/svg%3E");
190
- }
191
- }
192
- }
193
- .awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9):dir(rtl) {
194
- transform: scaleX(-1);
195
174
  }
196
175
 
197
- .awsui_resize-active_cufu9_e8bsh_197:not(#\9) {
176
+ .awsui_resize-active_cufu9_j3e9z_176:not(#\9) {
198
177
  -webkit-user-select: none;
199
178
  user-select: none;
200
179
  }
@@ -2,8 +2,9 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "resizable-box": "awsui_resizable-box_cufu9_e8bsh_149",
6
- "resizable-box-handle": "awsui_resizable-box-handle_cufu9_e8bsh_154",
7
- "resize-active": "awsui_resize-active_cufu9_e8bsh_197"
5
+ "resizable-box": "awsui_resizable-box_cufu9_j3e9z_149",
6
+ "cursor-active": "awsui_cursor-active_cufu9_j3e9z_153",
7
+ "resizable-box-handle": "awsui_resizable-box-handle_cufu9_j3e9z_167",
8
+ "resize-active": "awsui_resize-active_cufu9_j3e9z_176"
8
9
  };
9
10