@cloudscape-design/components-themeable 3.0.936 → 3.0.938

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 (106) 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/template/code-editor/index.d.ts.map +1 -1
  6. package/lib/internal/template/code-editor/index.js +2 -2
  7. package/lib/internal/template/code-editor/index.js.map +1 -1
  8. package/lib/internal/template/code-editor/interfaces.d.ts +2 -0
  9. package/lib/internal/template/code-editor/interfaces.d.ts.map +1 -1
  10. package/lib/internal/template/code-editor/interfaces.js.map +1 -1
  11. package/lib/internal/template/code-editor/pane.d.ts +3 -1
  12. package/lib/internal/template/code-editor/pane.d.ts.map +1 -1
  13. package/lib/internal/template/code-editor/pane.js +2 -2
  14. package/lib/internal/template/code-editor/pane.js.map +1 -1
  15. package/lib/internal/template/code-editor/resizable-box/index.d.ts +3 -1
  16. package/lib/internal/template/code-editor/resizable-box/index.d.ts.map +1 -1
  17. package/lib/internal/template/code-editor/resizable-box/index.js +40 -8
  18. package/lib/internal/template/code-editor/resizable-box/index.js.map +1 -1
  19. package/lib/internal/template/code-editor/resizable-box/styles.css.js +4 -3
  20. package/lib/internal/template/code-editor/resizable-box/styles.scoped.css +16 -37
  21. package/lib/internal/template/code-editor/resizable-box/styles.selectors.js +4 -3
  22. package/lib/internal/template/i18n/messages/all.all.js +1 -1
  23. package/lib/internal/template/i18n/messages/all.all.json +1 -1
  24. package/lib/internal/template/i18n/messages/all.ar.js +1 -1
  25. package/lib/internal/template/i18n/messages/all.ar.json +1 -1
  26. package/lib/internal/template/i18n/messages/all.de.js +1 -1
  27. package/lib/internal/template/i18n/messages/all.de.json +1 -1
  28. package/lib/internal/template/i18n/messages/all.en-GB.js +1 -1
  29. package/lib/internal/template/i18n/messages/all.en-GB.json +1 -1
  30. package/lib/internal/template/i18n/messages/all.en.js +1 -1
  31. package/lib/internal/template/i18n/messages/all.en.json +1 -1
  32. package/lib/internal/template/i18n/messages/all.es.js +1 -1
  33. package/lib/internal/template/i18n/messages/all.es.json +1 -1
  34. package/lib/internal/template/i18n/messages/all.fr.js +1 -1
  35. package/lib/internal/template/i18n/messages/all.fr.json +1 -1
  36. package/lib/internal/template/i18n/messages/all.id.js +1 -1
  37. package/lib/internal/template/i18n/messages/all.id.json +1 -1
  38. package/lib/internal/template/i18n/messages/all.it.js +1 -1
  39. package/lib/internal/template/i18n/messages/all.it.json +1 -1
  40. package/lib/internal/template/i18n/messages/all.ja.js +1 -1
  41. package/lib/internal/template/i18n/messages/all.ja.json +1 -1
  42. package/lib/internal/template/i18n/messages/all.ko.js +1 -1
  43. package/lib/internal/template/i18n/messages/all.ko.json +1 -1
  44. package/lib/internal/template/i18n/messages/all.pt-BR.js +1 -1
  45. package/lib/internal/template/i18n/messages/all.pt-BR.json +1 -1
  46. package/lib/internal/template/i18n/messages/all.tr.js +1 -1
  47. package/lib/internal/template/i18n/messages/all.tr.json +1 -1
  48. package/lib/internal/template/i18n/messages/all.zh-CN.js +1 -1
  49. package/lib/internal/template/i18n/messages/all.zh-CN.json +1 -1
  50. package/lib/internal/template/i18n/messages/all.zh-TW.js +1 -1
  51. package/lib/internal/template/i18n/messages/all.zh-TW.json +1 -1
  52. package/lib/internal/template/i18n/messages-types.d.ts +2 -0
  53. package/lib/internal/template/i18n/messages-types.d.ts.map +1 -1
  54. package/lib/internal/template/i18n/messages-types.js.map +1 -1
  55. package/lib/internal/template/internal/analytics/components/analytics-funnel.d.ts.map +1 -1
  56. package/lib/internal/template/internal/analytics/components/analytics-funnel.js +7 -2
  57. package/lib/internal/template/internal/analytics/components/analytics-funnel.js.map +1 -1
  58. package/lib/internal/template/internal/base-component/styles.scoped.css +29 -0
  59. package/lib/internal/template/internal/components/drag-handle/button.d.ts +5 -0
  60. package/lib/internal/template/internal/components/drag-handle/button.d.ts.map +1 -0
  61. package/lib/internal/template/internal/components/drag-handle/button.js +35 -0
  62. package/lib/internal/template/internal/components/drag-handle/button.js.map +1 -0
  63. package/lib/internal/template/internal/components/drag-handle/index.d.ts.map +1 -1
  64. package/lib/internal/template/internal/components/drag-handle/index.js +6 -30
  65. package/lib/internal/template/internal/components/drag-handle/index.js.map +1 -1
  66. package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts +7 -1
  67. package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts.map +1 -1
  68. package/lib/internal/template/internal/components/drag-handle/interfaces.js.map +1 -1
  69. package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.d.ts +11 -0
  70. package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.d.ts.map +1 -0
  71. package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.js +30 -0
  72. package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.js.map +1 -0
  73. package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts +4 -0
  74. package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts.map +1 -0
  75. package/lib/internal/template/internal/components/drag-handle-wrapper/index.js +138 -0
  76. package/lib/internal/template/internal/components/drag-handle-wrapper/index.js.map +1 -0
  77. package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts +10 -0
  78. package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts.map +1 -0
  79. package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.js +4 -0
  80. package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.js.map +1 -0
  81. package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.d.ts +6 -0
  82. package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.d.ts.map +1 -0
  83. package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js +56 -0
  84. package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js.map +1 -0
  85. package/lib/internal/template/internal/components/drag-handle-wrapper/styles.css.js +32 -0
  86. package/lib/internal/template/internal/components/drag-handle-wrapper/styles.scoped.css +508 -0
  87. package/lib/internal/template/internal/components/drag-handle-wrapper/styles.selectors.js +33 -0
  88. package/lib/internal/template/internal/environment.js +1 -1
  89. package/lib/internal/template/internal/environment.json +1 -1
  90. package/lib/internal/template/internal/generated/styles/tokens.d.ts +6 -0
  91. package/lib/internal/template/internal/generated/styles/tokens.js +6 -0
  92. package/lib/internal/template/internal/generated/theming/index.cjs +186 -0
  93. package/lib/internal/template/internal/generated/theming/index.js +186 -0
  94. package/lib/internal/template/internal/hooks/use-telemetry/index.d.ts.map +1 -1
  95. package/lib/internal/template/internal/hooks/use-telemetry/index.js +3 -1
  96. package/lib/internal/template/internal/hooks/use-telemetry/index.js.map +1 -1
  97. package/lib/internal/template/internal/utils/get-visual-theme.d.ts +2 -0
  98. package/lib/internal/template/internal/utils/get-visual-theme.d.ts.map +1 -0
  99. package/lib/internal/template/internal/utils/get-visual-theme.js +9 -0
  100. package/lib/internal/template/internal/utils/get-visual-theme.js.map +1 -0
  101. package/lib/internal/template/internal/utils/pointer-events-mock.d.ts +5 -0
  102. package/lib/internal/template/internal/utils/pointer-events-mock.d.ts.map +1 -0
  103. package/lib/internal/template/internal/utils/pointer-events-mock.js +10 -0
  104. package/lib/internal/template/internal/utils/pointer-events-mock.js.map +1 -0
  105. package/package.json +1 -1
  106. package/lib/internal/scss/code-editor/assets/resize-handler.svg +0 -3
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "9f361a1392ca76f9a063b4312e8c995f2478b400"
2
+ "commit": "99e4e2b0e8c6c023722a2f68f6d73878406e4a1a"
3
3
  }
@@ -5,10 +5,17 @@
5
5
  @use '../../internal/styles' as styles;
6
6
  @use '../../internal/styles/tokens' as awsui;
7
7
  @use '../background-inline-svg.scss' as utils;
8
+ @use '@cloudscape-design/component-toolkit/internal/focus-visible' as focus-visible;
8
9
 
9
10
  .resizable-box {
10
11
  position: relative;
11
12
  inline-size: 100%;
13
+
14
+ &:not(.cursor-active) {
15
+ @include styles.with-motion {
16
+ transition: height awsui.$motion-duration-complex awsui.$motion-easing-responsive;
17
+ }
18
+ }
12
19
  }
13
20
 
14
21
  .resizable-box-handle {
@@ -19,21 +26,6 @@
19
26
 
20
27
  inline-size: awsui.$space-l;
21
28
  block-size: awsui.$space-l;
22
-
23
- background-repeat: no-repeat;
24
- background-origin: content-box;
25
- box-sizing: border-box;
26
- background-position: bottom right;
27
- background-size: awsui.$space-l;
28
- cursor: ns-resize;
29
- @include utils.background-inline-svg(
30
- $path: '../assets/resize-handler.svg',
31
- $stroke: 'colorStrokeCodeEditorResizeHandler'
32
- );
33
-
34
- @include styles.with-direction('rtl') {
35
- transform: scaleX(-1);
36
- }
37
29
  }
38
30
 
39
31
  .resize-active {
@@ -0,0 +1,190 @@
1
+ /*
2
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ @use '../../styles' as styles;
6
+ @use '../../styles/tokens' as awsui;
7
+
8
+ .direction-button-wrapper {
9
+ @include styles.with-motion {
10
+ @include styles.animation-fade-in;
11
+ @include styles.animation-fade-out-0;
12
+ }
13
+ }
14
+
15
+ .direction-button-wrapper-motion-enter,
16
+ .direction-button-wrapper-motion-entering,
17
+ .direction-button-wrapper-motion-exit,
18
+ .direction-button-wrapper-motion-exiting {
19
+ @include styles.with-motion {
20
+ pointer-events: none;
21
+ }
22
+ }
23
+
24
+ .direction-button-wrapper-block-start {
25
+ &.direction-button-wrapper-motion-entering {
26
+ @include styles.with-motion {
27
+ animation:
28
+ slide-up awsui.$motion-duration-complex awsui.$motion-easing-responsive,
29
+ awsui-motion-fade-in awsui.$motion-duration-complex awsui.$motion-easing-responsive;
30
+ }
31
+ }
32
+ &.direction-button-wrapper-motion-exiting {
33
+ @include styles.with-motion {
34
+ animation:
35
+ slide-up-exit awsui.$motion-duration-complex awsui.$motion-easing-responsive,
36
+ awsui-motion-fade-out-0 awsui.$motion-duration-complex awsui.$motion-easing-responsive;
37
+ }
38
+ }
39
+ }
40
+
41
+ .direction-button-wrapper-block-end {
42
+ &.direction-button-wrapper-motion-entering {
43
+ @include styles.with-motion {
44
+ animation:
45
+ slide-down awsui.$motion-duration-complex awsui.$motion-easing-responsive,
46
+ awsui-motion-fade-in awsui.$motion-duration-complex awsui.$motion-easing-responsive;
47
+ }
48
+ }
49
+ &.direction-button-wrapper-motion-exiting {
50
+ @include styles.with-motion {
51
+ animation:
52
+ slide-down-exit awsui.$motion-duration-complex awsui.$motion-easing-responsive,
53
+ awsui-motion-fade-out-0 awsui.$motion-duration-complex awsui.$motion-easing-responsive;
54
+ }
55
+ }
56
+ }
57
+
58
+ .direction-button-wrapper-inline-start {
59
+ &.direction-button-wrapper-motion-entering {
60
+ @include styles.with-motion {
61
+ animation:
62
+ slide-left awsui.$motion-duration-complex awsui.$motion-easing-responsive,
63
+ awsui-motion-fade-in awsui.$motion-duration-complex awsui.$motion-easing-responsive;
64
+ }
65
+ }
66
+ &.direction-button-wrapper-rtl.direction-button-wrapper-motion-entering {
67
+ @include styles.with-motion {
68
+ animation:
69
+ slide-right awsui.$motion-duration-complex awsui.$motion-easing-responsive,
70
+ awsui-motion-fade-in awsui.$motion-duration-complex awsui.$motion-easing-responsive;
71
+ }
72
+ }
73
+ &.direction-button-wrapper-motion-exiting {
74
+ @include styles.with-motion {
75
+ animation:
76
+ slide-left-exit awsui.$motion-duration-complex awsui.$motion-easing-responsive,
77
+ awsui-motion-fade-out-0 awsui.$motion-duration-complex awsui.$motion-easing-responsive;
78
+ }
79
+ }
80
+ &.direction-button-wrapper-rtl.direction-button-wrapper-motion-exiting {
81
+ @include styles.with-motion {
82
+ animation:
83
+ slide-right-exit awsui.$motion-duration-complex awsui.$motion-easing-responsive,
84
+ awsui-motion-fade-out-0 awsui.$motion-duration-complex awsui.$motion-easing-responsive;
85
+ }
86
+ }
87
+ }
88
+
89
+ .direction-button-wrapper-inline-end {
90
+ &.direction-button-wrapper-motion-entering {
91
+ @include styles.with-motion {
92
+ animation:
93
+ slide-right awsui.$motion-duration-complex awsui.$motion-easing-responsive,
94
+ awsui-motion-fade-in awsui.$motion-duration-complex awsui.$motion-easing-responsive;
95
+ }
96
+ }
97
+ &.direction-button-wrapper-rtl.direction-button-wrapper-motion-entering {
98
+ @include styles.with-motion {
99
+ animation:
100
+ slide-left awsui.$motion-duration-complex awsui.$motion-easing-responsive,
101
+ awsui-motion-fade-in awsui.$motion-duration-complex awsui.$motion-easing-responsive;
102
+ }
103
+ }
104
+ &.direction-button-wrapper-motion-exiting {
105
+ @include styles.with-motion {
106
+ animation:
107
+ slide-right-exit awsui.$motion-duration-complex awsui.$motion-easing-responsive,
108
+ awsui-motion-fade-out-0 awsui.$motion-duration-complex awsui.$motion-easing-responsive;
109
+ }
110
+ }
111
+ &.direction-button-wrapper-rtl.direction-button-wrapper-motion-exiting {
112
+ @include styles.with-motion {
113
+ animation:
114
+ slide-left-exit awsui.$motion-duration-complex awsui.$motion-easing-responsive,
115
+ awsui-motion-fade-out-0 awsui.$motion-duration-complex awsui.$motion-easing-responsive;
116
+ }
117
+ }
118
+ }
119
+
120
+ @keyframes slide-up {
121
+ 0% {
122
+ transform: translate(0, 20px);
123
+ }
124
+ 100% {
125
+ transform: translate(0, 0);
126
+ }
127
+ }
128
+
129
+ @keyframes slide-up-exit {
130
+ 0% {
131
+ transform: translate(0, 0);
132
+ }
133
+ 100% {
134
+ transform: translate(0, 20px);
135
+ }
136
+ }
137
+
138
+ @keyframes slide-down {
139
+ 0% {
140
+ transform: translate(0, -20px);
141
+ }
142
+ 100% {
143
+ transform: translate(0, 0);
144
+ }
145
+ }
146
+
147
+ @keyframes slide-down-exit {
148
+ 0% {
149
+ transform: translate(0, 0);
150
+ }
151
+ 100% {
152
+ transform: translate(0, -20px);
153
+ }
154
+ }
155
+
156
+ @keyframes slide-left {
157
+ 0% {
158
+ transform: translate(20px, 0);
159
+ }
160
+ 100% {
161
+ transform: translate(0, 0);
162
+ }
163
+ }
164
+
165
+ @keyframes slide-left-exit {
166
+ 0% {
167
+ transform: translate(0, 0);
168
+ }
169
+ 100% {
170
+ transform: translate(20px, 0);
171
+ }
172
+ }
173
+
174
+ @keyframes slide-right {
175
+ 0% {
176
+ transform: translate(-20px, 0);
177
+ }
178
+ 100% {
179
+ transform: translate(0, 0);
180
+ }
181
+ }
182
+
183
+ @keyframes slide-right-exit {
184
+ 0% {
185
+ transform: translate(0, 0);
186
+ }
187
+ 100% {
188
+ transform: translate(-20px, 0);
189
+ }
190
+ }
@@ -0,0 +1,110 @@
1
+ /*
2
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ @use '../../styles' as styles;
7
+ @use '../../styles/tokens' as awsui;
8
+ @use './motion';
9
+
10
+ $direction-button-wrapper-size: calc(#{awsui.$space-static-xl} + 2 * #{awsui.$space-static-xxs});
11
+ $direction-button-size: awsui.$space-static-xl;
12
+ $direction-button-offset: awsui.$space-static-xxs;
13
+
14
+ .drag-handle-wrapper {
15
+ position: relative;
16
+ display: inline-block;
17
+ }
18
+
19
+ .portal-overlay {
20
+ position: absolute;
21
+ inset-block-start: 0;
22
+ inset-inline-start: 0;
23
+
24
+ // Since the overlay takes up the exact width/height of the element below it, this prevents
25
+ // any clicks on this element from occluding clicks on the element below.
26
+ pointer-events: none;
27
+
28
+ // Similar to the expandToViewport dropdown, this needs to be higher than modal's z-index.
29
+ z-index: 7000;
30
+ }
31
+
32
+ .portal-overlay-contents {
33
+ pointer-events: auto;
34
+ }
35
+
36
+ .drag-handle {
37
+ position: relative;
38
+ display: flex;
39
+ }
40
+
41
+ .direction-button-wrapper {
42
+ position: absolute;
43
+ block-size: $direction-button-size;
44
+ inline-size: $direction-button-size;
45
+ padding-block: $direction-button-offset;
46
+ padding-inline: $direction-button-offset;
47
+ }
48
+
49
+ .direction-button-wrapper-hidden {
50
+ display: none;
51
+ }
52
+
53
+ .direction-button-wrapper-block-start {
54
+ inset-block-start: calc(-1 * $direction-button-wrapper-size);
55
+ inset-inline-start: calc(50% - $direction-button-wrapper-size / 2);
56
+ }
57
+
58
+ .direction-button-wrapper-block-end {
59
+ inset-block-end: calc(-1 * $direction-button-wrapper-size);
60
+ inset-inline-start: calc(50% - $direction-button-wrapper-size / 2);
61
+ }
62
+
63
+ .direction-button-wrapper-inline-start {
64
+ inset-inline-start: calc(-1 * $direction-button-wrapper-size);
65
+ inset-block-start: calc(50% - $direction-button-wrapper-size / 2);
66
+ }
67
+
68
+ .direction-button-wrapper-inline-end {
69
+ inset-inline-end: calc(-1 * $direction-button-wrapper-size);
70
+ inset-block-start: calc(50% - $direction-button-wrapper-size / 2);
71
+ }
72
+
73
+ .direction-button {
74
+ position: absolute;
75
+ border-width: 0;
76
+ cursor: pointer;
77
+ display: inline-block;
78
+ box-sizing: border-box;
79
+
80
+ // This skips the browser waiting for a double-tap interaction before activating.
81
+ // False positive - this isn't supported in Safari Desktop but is supported on iOS.
82
+ // stylelint-disable-next-line plugin/no-unsupported-browser-features
83
+ touch-action: manipulation;
84
+
85
+ inline-size: $direction-button-size;
86
+ block-size: $direction-button-size;
87
+ padding-block: awsui.$space-xxs;
88
+ padding-inline: awsui.$space-xxs;
89
+ border-start-start-radius: 50%;
90
+ border-start-end-radius: 50%;
91
+ border-end-start-radius: 50%;
92
+ border-end-end-radius: 50%;
93
+ background-color: awsui.$color-background-direction-button-default;
94
+ color: awsui.$color-text-direction-button-default;
95
+ box-shadow: awsui.$shadow-dropdown;
96
+
97
+ &:not(.direction-button-disabled):hover {
98
+ background-color: awsui.$color-background-direction-button-hover;
99
+ }
100
+
101
+ &:not(.direction-button-disabled):active {
102
+ background-color: awsui.$color-background-direction-button-active;
103
+ }
104
+ }
105
+
106
+ .direction-button-disabled {
107
+ cursor: default;
108
+ background-color: awsui.$color-background-direction-button-disabled;
109
+ color: awsui.$color-text-direction-button-disabled;
110
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code-editor/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAqB7F,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAqB/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,QAAA,MAAM,UAAU,6FAuQd,CAAC;AAGH,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code-editor/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAqB7F,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAqB/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,QAAA,MAAM,UAAU,6FA2Qd,CAAC;AAGH,eAAe,UAAU,CAAC"}
@@ -135,11 +135,11 @@ const CodeEditor = forwardRef((props, ref) => {
135
135
  setEditorHeight(height);
136
136
  onResize();
137
137
  fireNonCancelableEvent(onEditorContentResize, { height });
138
- } },
138
+ }, handleAriaLabel: i18n('i18nStrings.resizeHandleAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.resizeHandleAriaLabel), handleTooltipText: i18n('i18nStrings.resizeHandleTooltipText', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.resizeHandleTooltipText) },
139
139
  React.createElement("div", { ref: editorRef, className: clsx(styles.editor, styles.ace, isRefresh && styles['editor-refresh']), onKeyDown: onEditorKeydown, tabIndex: 0, role: "group", "aria-label": i18n('i18nStrings.editorGroupAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.editorGroupAriaLabel) })),
140
140
  React.createElement("div", { role: "group", "aria-label": i18n('i18nStrings.statusBarGroupAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.statusBarGroupAriaLabel) },
141
141
  React.createElement(StatusBar, { languageLabel: languageLabel, cursorPosition: i18n('i18nStrings.cursorPosition', (_b = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.cursorPosition) === null || _b === void 0 ? void 0 : _b.call(i18nStrings, cursorPosition.row + 1, cursorPosition.column + 1), format => format({ row: cursorPosition.row + 1, column: cursorPosition.column + 1 })), errorCount: errorCount, warningCount: warningCount, paneStatus: paneStatus, onErrorPaneToggle: onErrorPaneToggle, onWarningPaneToggle: onWarningPaneToggle, onTabFocus: onTabFocus, onTabBlur: onTabBlur, errorsTabRef: errorsTabRef, warningsTabRef: warningsTabRef, i18nStrings: i18nStrings, isTabFocused: isTabFocused, paneId: isPaneVisible ? paneId : undefined, onPreferencesOpen: onPreferencesOpen, isRefresh: isRefresh }),
142
- React.createElement(Pane, { id: paneId, paneStatus: paneStatus, visible: isPaneVisible, annotations: currentAnnotations, highlighted: highlightedAnnotation, onAnnotationClick: onAnnotationClick, onAnnotationClear: onAnnotationClear, onClose: onPaneClose, cursorPositionLabel: i18n('i18nStrings.cursorPosition', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.cursorPosition, format => (row, column) => format({ row, column })), closeButtonAriaLabel: i18n('i18nStrings.paneCloseButtonAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.paneCloseButtonAriaLabel) })),
142
+ React.createElement(Pane, { id: paneId, paneStatus: paneStatus, visible: isPaneVisible, annotations: currentAnnotations, highlighted: highlightedAnnotation, onAnnotationClick: onAnnotationClick, onAnnotationClear: onAnnotationClear, onClose: onPaneClose, cursorPositionLabel: i18n('i18nStrings.cursorPosition', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.cursorPosition, format => (row, column) => format({ row, column })), closeButtonAriaLabel: i18n('i18nStrings.paneCloseButtonAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.paneCloseButtonAriaLabel), handleAriaLabel: i18n('i18nStrings.resizeHandleAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.resizeHandleAriaLabel), handleTooltipText: i18n('i18nStrings.resizeHandleTooltipText', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.resizeHandleTooltipText) })),
143
143
  isPreferencesModalVisible && (React.createElement(PreferencesModal, { getModalRoot: getModalRoot, removeModalRoot: removeModalRoot, onConfirm: onPreferencesConfirm, onDismiss: onPreferencesDismiss, themes: themes !== null && themes !== void 0 ? themes : DEFAULT_AVAILABLE_THEMES, preferences: preferences, defaultTheme: defaultTheme, i18nStrings: {
144
144
  header: i18n('i18nStrings.preferencesModalHeader', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalHeader),
145
145
  cancel: i18n('i18nStrings.preferencesModalCancel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalCancel),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/code-editor/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,C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sBAAsB,CAAC;oBACvF,MAAM,EAAE,IAAI,CAAC,oCAAoC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,sBAAsB,CAAC;oBACvF,OAAO,EAAE,IAAI,CAAC,qCAAqC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,uBAAuB,CAAC;oBAC1F,SAAS,EAAE,IAAI,CAAC,uCAAuC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,yBAAyB,CAAC;oBAChG,KAAK,EAAE,IAAI,CAAC,mCAAmC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,qBAAqB,CAAC;oBACpF,WAAW,EAAE,IAAI,CAAC,yCAAyC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,2BAA2B,CAAC;oBACtG,UAAU,EAAE,IAAI,CAAC,wCAAwC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,0BAA0B,CAAC;oBACnG,uBAAuB,EAAE,IAAI,CAC3B,qDAAqD,EACrD,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,uCAAuC,CACrD;oBACD,yBAAyB,EAAE,IAAI,CAC7B,uDAAuD,EACvD,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,yCAAyC,CACvD;oBACD,4BAA4B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,4CAA4C;iBACxF,GACD,CACH,CACA,CACJ,CACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAC3C,eAAe,UAAU,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Ace } from 'ace-builds';\nimport clsx from 'clsx';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { useCurrentMode } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { KeyCode } from '../internal/keycode';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport InternalLiveRegion from '../live-region/internal';\nimport ErrorScreen from './error-screen';\nimport { CodeEditorProps } from './interfaces';\nimport { useChangeEffect } from './listeners';\nimport LoadingScreen from './loading-screen';\nimport { Pane } from './pane';\nimport PreferencesModal from './preferences-modal';\nimport { ResizableBox } from './resizable-box';\nimport { setupEditor } from './setup-editor';\nimport { StatusBar } from './status-bar';\nimport {\n useEditor,\n useSyncEditorLabels,\n useSyncEditorLanguage,\n useSyncEditorSize,\n useSyncEditorTheme,\n useSyncEditorValue,\n useSyncEditorWrapLines,\n} from './use-editor';\nimport { DEFAULT_AVAILABLE_THEMES, getDefaultTheme, getLanguageLabel, PaneStatus } from './util';\n\nimport styles from './styles.css.js';\n\nexport { CodeEditorProps };\n\nconst CodeEditor = forwardRef((props: CodeEditorProps, ref: React.Ref<CodeEditorProps.Ref>) => {\n const {\n ace,\n value,\n language,\n i18nStrings,\n editorContentHeight,\n onEditorContentResize,\n ariaLabel,\n languageLabel: customLanguageLabel,\n preferences,\n loading,\n themes,\n getModalRoot,\n removeModalRoot,\n ...rest\n } = props;\n const { __internalRootRef } = useBaseComponent('CodeEditor', { props: { language } });\n const { controlId, ariaLabelledby, ariaDescribedby } = useFormFieldContext(props);\n const [editorHeight = 480, setEditorHeight] = useControllable(editorContentHeight, onEditorContentResize, 480, {\n componentName: 'code-editor',\n changeHandler: 'onEditorContentResize',\n controlledProp: 'editorContentHeight',\n });\n const mode = useCurrentMode(__internalRootRef);\n const isRefresh = useVisualRefresh();\n const baseProps = getBaseProps(rest);\n const i18n = useInternalI18n('code-editor');\n\n const errorsTabRef = useRef<HTMLButtonElement>(null);\n const warningsTabRef = useRef<HTMLButtonElement>(null);\n const [codeEditorWidth, codeEditorMeasureRef] = useContainerQuery(rect => rect.contentBoxWidth);\n const mergedRef = useMergeRefs(codeEditorMeasureRef, __internalRootRef);\n\n const paneId = useUniqueId('code-editor-pane');\n\n const [paneStatus, setPaneStatus] = useState<PaneStatus>('hidden');\n const [annotations, setAnnotations] = useState<Ace.Annotation[]>([]);\n const [highlightedAnnotation, setHighlightedAnnotation] = useState<Ace.Annotation>();\n const [cursorPosition, setCursorPosition] = useState<Ace.Point>({ row: 0, column: 0 });\n const [isTabFocused, setTabFocused] = useState<boolean>(false);\n\n const { editorRef, editor } = useEditor(ace, themes, loading);\n\n useForwardFocus(ref, editorRef);\n\n useEffect(() => {\n if (!ace || !editor) {\n return;\n }\n\n setupEditor(ace, editor, setAnnotations, setCursorPosition, setHighlightedAnnotation, setPaneStatus);\n\n return () => {\n editor?.destroy();\n };\n }, [ace, editor]);\n\n useSyncEditorLabels(editor, { controlId, ariaLabel, ariaLabelledby, ariaDescribedby });\n\n const { onResize } = useSyncEditorSize(editor, { width: codeEditorWidth, height: editorContentHeight });\n\n useSyncEditorValue(editor, value);\n\n useSyncEditorLanguage(editor, language);\n\n useSyncEditorWrapLines(editor, preferences?.wrapLines);\n\n const defaultTheme = getDefaultTheme(mode, themes);\n useSyncEditorTheme(editor, preferences?.theme ?? defaultTheme);\n\n // Change listeners\n useChangeEffect(editor, props.onChange, props.onDelayedChange);\n\n // Hide error panel when there are no errors to show.\n useEffect(() => {\n if (annotations.length === 0) {\n setPaneStatus('hidden');\n }\n\n if (props.onValidate) {\n fireNonCancelableEvent(props.onValidate, { annotations });\n }\n }, [annotations, props.onValidate]);\n\n const languageLabel = customLanguageLabel ?? getLanguageLabel(language);\n\n const errorCount = annotations.filter(a => a.type === 'error').length;\n const warningCount = annotations.filter(a => a.type === 'warning').length;\n const currentAnnotations = useMemo(() => annotations.filter(a => a.type === paneStatus), [annotations, paneStatus]);\n\n /*\n * Callbacks\n */\n\n const onEditorKeydown = useCallback(\n (e: React.KeyboardEvent) => {\n if (editor && e.target === editor.container && e.keyCode === KeyCode.enter) {\n e.stopPropagation();\n e.preventDefault();\n editor.focus();\n }\n },\n [editor]\n );\n\n const onTabFocus = useCallback(() => setTabFocused(true), []);\n const onTabBlur = useCallback(() => setTabFocused(false), []);\n\n const onErrorPaneToggle = useCallback(() => {\n setPaneStatus(paneStatus !== 'error' ? 'error' : 'hidden');\n }, [paneStatus]);\n\n const onWarningPaneToggle = useCallback(() => {\n setPaneStatus(paneStatus !== 'warning' ? 'warning' : 'hidden');\n }, [paneStatus]);\n\n const onPaneClose = () => {\n setPaneStatus('hidden');\n };\n\n const onAnnotationClick = ({ row = 0, column = 0 }: Ace.Annotation) => {\n if (!editor) {\n return;\n }\n editor.focus();\n editor.gotoLine(row + 1, column, false);\n setHighlightedAnnotation(undefined);\n };\n\n const onAnnotationClear = useCallback(() => {\n setHighlightedAnnotation(undefined);\n }, []);\n\n const [isPreferencesModalVisible, setPreferencesModalVisible] = useState(false);\n const onPreferencesOpen = () => setPreferencesModalVisible(true);\n const onPreferencesConfirm = (p: CodeEditorProps.Preferences) => {\n fireNonCancelableEvent(props.onPreferencesChange, p);\n setPreferencesModalVisible(false);\n };\n const onPreferencesDismiss = () => setPreferencesModalVisible(false);\n\n const isPaneVisible = paneStatus !== 'hidden';\n\n return (\n <div\n {...baseProps}\n className={clsx(styles['code-editor'], baseProps.className, { [styles['code-editor-refresh']]: isRefresh })}\n ref={mergedRef}\n >\n {loading && (\n <LoadingScreen>\n <InternalLiveRegion tagName=\"span\">\n {i18n('i18nStrings.loadingState', i18nStrings?.loadingState)}\n </InternalLiveRegion>\n </LoadingScreen>\n )}\n\n {!ace && !loading && (\n <ErrorScreen\n recoveryText={i18n('i18nStrings.errorStateRecovery', i18nStrings?.errorStateRecovery)}\n onRecoveryClick={props.onRecoveryClick}\n >\n {i18n('i18nStrings.errorState', i18nStrings?.errorState)}\n </ErrorScreen>\n )}\n\n {ace && !loading && (\n <>\n <ResizableBox\n height={Math.max(editorHeight, 20)}\n minHeight={20}\n onResize={height => {\n setEditorHeight(height);\n onResize();\n fireNonCancelableEvent(onEditorContentResize, { height });\n }}\n >\n <div\n ref={editorRef}\n className={clsx(styles.editor, styles.ace, isRefresh && styles['editor-refresh'])}\n onKeyDown={onEditorKeydown}\n tabIndex={0}\n role=\"group\"\n aria-label={i18n('i18nStrings.editorGroupAriaLabel', i18nStrings?.editorGroupAriaLabel)}\n />\n </ResizableBox>\n <div\n role=\"group\"\n aria-label={i18n('i18nStrings.statusBarGroupAriaLabel', i18nStrings?.statusBarGroupAriaLabel)}\n >\n <StatusBar\n languageLabel={languageLabel}\n cursorPosition={i18n(\n 'i18nStrings.cursorPosition',\n i18nStrings?.cursorPosition?.(cursorPosition.row + 1, cursorPosition.column + 1),\n format => format({ row: cursorPosition.row + 1, column: cursorPosition.column + 1 })\n )}\n errorCount={errorCount}\n warningCount={warningCount}\n paneStatus={paneStatus}\n onErrorPaneToggle={onErrorPaneToggle}\n onWarningPaneToggle={onWarningPaneToggle}\n onTabFocus={onTabFocus}\n onTabBlur={onTabBlur}\n errorsTabRef={errorsTabRef}\n warningsTabRef={warningsTabRef}\n i18nStrings={i18nStrings}\n isTabFocused={isTabFocused}\n paneId={isPaneVisible ? paneId : undefined}\n onPreferencesOpen={onPreferencesOpen}\n isRefresh={isRefresh}\n />\n <Pane\n id={paneId}\n paneStatus={paneStatus}\n visible={isPaneVisible}\n annotations={currentAnnotations}\n highlighted={highlightedAnnotation}\n onAnnotationClick={onAnnotationClick}\n onAnnotationClear={onAnnotationClear}\n onClose={onPaneClose}\n cursorPositionLabel={i18n(\n 'i18nStrings.cursorPosition',\n i18nStrings?.cursorPosition,\n format => (row, column) => format({ row, column })\n )}\n closeButtonAriaLabel={i18n('i18nStrings.paneCloseButtonAriaLabel', i18nStrings?.paneCloseButtonAriaLabel)}\n />\n </div>\n {isPreferencesModalVisible && (\n <PreferencesModal\n getModalRoot={getModalRoot}\n removeModalRoot={removeModalRoot}\n onConfirm={onPreferencesConfirm}\n onDismiss={onPreferencesDismiss}\n themes={themes ?? DEFAULT_AVAILABLE_THEMES}\n preferences={preferences}\n defaultTheme={defaultTheme}\n i18nStrings={{\n header: i18n('i18nStrings.preferencesModalHeader', i18nStrings?.preferencesModalHeader),\n cancel: i18n('i18nStrings.preferencesModalCancel', i18nStrings?.preferencesModalCancel),\n confirm: i18n('i18nStrings.preferencesModalConfirm', i18nStrings?.preferencesModalConfirm),\n wrapLines: i18n('i18nStrings.preferencesModalWrapLines', i18nStrings?.preferencesModalWrapLines),\n theme: i18n('i18nStrings.preferencesModalTheme', i18nStrings?.preferencesModalTheme),\n lightThemes: i18n('i18nStrings.preferencesModalLightThemes', i18nStrings?.preferencesModalLightThemes),\n darkThemes: i18n('i18nStrings.preferencesModalDarkThemes', i18nStrings?.preferencesModalDarkThemes),\n themeFilteringAriaLabel: i18n(\n 'i18nStrings.preferencesModalThemeFilteringAriaLabel',\n i18nStrings?.preferencesModalThemeFilteringAriaLabel\n ),\n themeFilteringPlaceholder: i18n(\n 'i18nStrings.preferencesModalThemeFilteringPlaceholder',\n i18nStrings?.preferencesModalThemeFilteringPlaceholder\n ),\n themeFilteringClearAriaLabel: i18nStrings?.preferencesModalThemeFilteringClearAriaLabel,\n }}\n />\n )}\n </>\n )}\n </div>\n );\n});\n\napplyDisplayName(CodeEditor, 'CodeEditor');\nexport default CodeEditor;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/code-editor/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,WAAW,EA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AAE,yBAAyB,CAAC;oBAChG,KAAK,EAAE,IAAI,CAAC,mCAAmC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,qBAAqB,CAAC;oBACpF,WAAW,EAAE,IAAI,CAAC,yCAAyC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,2BAA2B,CAAC;oBACtG,UAAU,EAAE,IAAI,CAAC,wCAAwC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,0BAA0B,CAAC;oBACnG,uBAAuB,EAAE,IAAI,CAC3B,qDAAqD,EACrD,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,uCAAuC,CACrD;oBACD,yBAAyB,EAAE,IAAI,CAC7B,uDAAuD,EACvD,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,yCAAyC,CACvD;oBACD,4BAA4B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,4CAA4C;iBACxF,GACD,CACH,CACA,CACJ,CACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAC3C,eAAe,UAAU,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Ace } from 'ace-builds';\nimport clsx from 'clsx';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { useCurrentMode } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { KeyCode } from '../internal/keycode';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport InternalLiveRegion from '../live-region/internal';\nimport ErrorScreen from './error-screen';\nimport { CodeEditorProps } from './interfaces';\nimport { useChangeEffect } from './listeners';\nimport LoadingScreen from './loading-screen';\nimport { Pane } from './pane';\nimport PreferencesModal from './preferences-modal';\nimport { ResizableBox } from './resizable-box';\nimport { setupEditor } from './setup-editor';\nimport { StatusBar } from './status-bar';\nimport {\n useEditor,\n useSyncEditorLabels,\n useSyncEditorLanguage,\n useSyncEditorSize,\n useSyncEditorTheme,\n useSyncEditorValue,\n useSyncEditorWrapLines,\n} from './use-editor';\nimport { DEFAULT_AVAILABLE_THEMES, getDefaultTheme, getLanguageLabel, PaneStatus } from './util';\n\nimport styles from './styles.css.js';\n\nexport { CodeEditorProps };\n\nconst CodeEditor = forwardRef((props: CodeEditorProps, ref: React.Ref<CodeEditorProps.Ref>) => {\n const {\n ace,\n value,\n language,\n i18nStrings,\n editorContentHeight,\n onEditorContentResize,\n ariaLabel,\n languageLabel: customLanguageLabel,\n preferences,\n loading,\n themes,\n getModalRoot,\n removeModalRoot,\n ...rest\n } = props;\n const { __internalRootRef } = useBaseComponent('CodeEditor', { props: { language } });\n const { controlId, ariaLabelledby, ariaDescribedby } = useFormFieldContext(props);\n const [editorHeight = 480, setEditorHeight] = useControllable(editorContentHeight, onEditorContentResize, 480, {\n componentName: 'code-editor',\n changeHandler: 'onEditorContentResize',\n controlledProp: 'editorContentHeight',\n });\n const mode = useCurrentMode(__internalRootRef);\n const isRefresh = useVisualRefresh();\n const baseProps = getBaseProps(rest);\n const i18n = useInternalI18n('code-editor');\n\n const errorsTabRef = useRef<HTMLButtonElement>(null);\n const warningsTabRef = useRef<HTMLButtonElement>(null);\n const [codeEditorWidth, codeEditorMeasureRef] = useContainerQuery(rect => rect.contentBoxWidth);\n const mergedRef = useMergeRefs(codeEditorMeasureRef, __internalRootRef);\n\n const paneId = useUniqueId('code-editor-pane');\n\n const [paneStatus, setPaneStatus] = useState<PaneStatus>('hidden');\n const [annotations, setAnnotations] = useState<Ace.Annotation[]>([]);\n const [highlightedAnnotation, setHighlightedAnnotation] = useState<Ace.Annotation>();\n const [cursorPosition, setCursorPosition] = useState<Ace.Point>({ row: 0, column: 0 });\n const [isTabFocused, setTabFocused] = useState<boolean>(false);\n\n const { editorRef, editor } = useEditor(ace, themes, loading);\n\n useForwardFocus(ref, editorRef);\n\n useEffect(() => {\n if (!ace || !editor) {\n return;\n }\n\n setupEditor(ace, editor, setAnnotations, setCursorPosition, setHighlightedAnnotation, setPaneStatus);\n\n return () => {\n editor?.destroy();\n };\n }, [ace, editor]);\n\n useSyncEditorLabels(editor, { controlId, ariaLabel, ariaLabelledby, ariaDescribedby });\n\n const { onResize } = useSyncEditorSize(editor, { width: codeEditorWidth, height: editorContentHeight });\n\n useSyncEditorValue(editor, value);\n\n useSyncEditorLanguage(editor, language);\n\n useSyncEditorWrapLines(editor, preferences?.wrapLines);\n\n const defaultTheme = getDefaultTheme(mode, themes);\n useSyncEditorTheme(editor, preferences?.theme ?? defaultTheme);\n\n // Change listeners\n useChangeEffect(editor, props.onChange, props.onDelayedChange);\n\n // Hide error panel when there are no errors to show.\n useEffect(() => {\n if (annotations.length === 0) {\n setPaneStatus('hidden');\n }\n\n if (props.onValidate) {\n fireNonCancelableEvent(props.onValidate, { annotations });\n }\n }, [annotations, props.onValidate]);\n\n const languageLabel = customLanguageLabel ?? getLanguageLabel(language);\n\n const errorCount = annotations.filter(a => a.type === 'error').length;\n const warningCount = annotations.filter(a => a.type === 'warning').length;\n const currentAnnotations = useMemo(() => annotations.filter(a => a.type === paneStatus), [annotations, paneStatus]);\n\n /*\n * Callbacks\n */\n\n const onEditorKeydown = useCallback(\n (e: React.KeyboardEvent) => {\n if (editor && e.target === editor.container && e.keyCode === KeyCode.enter) {\n e.stopPropagation();\n e.preventDefault();\n editor.focus();\n }\n },\n [editor]\n );\n\n const onTabFocus = useCallback(() => setTabFocused(true), []);\n const onTabBlur = useCallback(() => setTabFocused(false), []);\n\n const onErrorPaneToggle = useCallback(() => {\n setPaneStatus(paneStatus !== 'error' ? 'error' : 'hidden');\n }, [paneStatus]);\n\n const onWarningPaneToggle = useCallback(() => {\n setPaneStatus(paneStatus !== 'warning' ? 'warning' : 'hidden');\n }, [paneStatus]);\n\n const onPaneClose = () => {\n setPaneStatus('hidden');\n };\n\n const onAnnotationClick = ({ row = 0, column = 0 }: Ace.Annotation) => {\n if (!editor) {\n return;\n }\n editor.focus();\n editor.gotoLine(row + 1, column, false);\n setHighlightedAnnotation(undefined);\n };\n\n const onAnnotationClear = useCallback(() => {\n setHighlightedAnnotation(undefined);\n }, []);\n\n const [isPreferencesModalVisible, setPreferencesModalVisible] = useState(false);\n const onPreferencesOpen = () => setPreferencesModalVisible(true);\n const onPreferencesConfirm = (p: CodeEditorProps.Preferences) => {\n fireNonCancelableEvent(props.onPreferencesChange, p);\n setPreferencesModalVisible(false);\n };\n const onPreferencesDismiss = () => setPreferencesModalVisible(false);\n\n const isPaneVisible = paneStatus !== 'hidden';\n\n return (\n <div\n {...baseProps}\n className={clsx(styles['code-editor'], baseProps.className, { [styles['code-editor-refresh']]: isRefresh })}\n ref={mergedRef}\n >\n {loading && (\n <LoadingScreen>\n <InternalLiveRegion tagName=\"span\">\n {i18n('i18nStrings.loadingState', i18nStrings?.loadingState)}\n </InternalLiveRegion>\n </LoadingScreen>\n )}\n\n {!ace && !loading && (\n <ErrorScreen\n recoveryText={i18n('i18nStrings.errorStateRecovery', i18nStrings?.errorStateRecovery)}\n onRecoveryClick={props.onRecoveryClick}\n >\n {i18n('i18nStrings.errorState', i18nStrings?.errorState)}\n </ErrorScreen>\n )}\n\n {ace && !loading && (\n <>\n <ResizableBox\n height={Math.max(editorHeight, 20)}\n minHeight={20}\n onResize={height => {\n setEditorHeight(height);\n onResize();\n fireNonCancelableEvent(onEditorContentResize, { height });\n }}\n handleAriaLabel={i18n('i18nStrings.resizeHandleAriaLabel', i18nStrings?.resizeHandleAriaLabel)}\n handleTooltipText={i18n('i18nStrings.resizeHandleTooltipText', i18nStrings?.resizeHandleTooltipText)}\n >\n <div\n ref={editorRef}\n className={clsx(styles.editor, styles.ace, isRefresh && styles['editor-refresh'])}\n onKeyDown={onEditorKeydown}\n tabIndex={0}\n role=\"group\"\n aria-label={i18n('i18nStrings.editorGroupAriaLabel', i18nStrings?.editorGroupAriaLabel)}\n />\n </ResizableBox>\n <div\n role=\"group\"\n aria-label={i18n('i18nStrings.statusBarGroupAriaLabel', i18nStrings?.statusBarGroupAriaLabel)}\n >\n <StatusBar\n languageLabel={languageLabel}\n cursorPosition={i18n(\n 'i18nStrings.cursorPosition',\n i18nStrings?.cursorPosition?.(cursorPosition.row + 1, cursorPosition.column + 1),\n format => format({ row: cursorPosition.row + 1, column: cursorPosition.column + 1 })\n )}\n errorCount={errorCount}\n warningCount={warningCount}\n paneStatus={paneStatus}\n onErrorPaneToggle={onErrorPaneToggle}\n onWarningPaneToggle={onWarningPaneToggle}\n onTabFocus={onTabFocus}\n onTabBlur={onTabBlur}\n errorsTabRef={errorsTabRef}\n warningsTabRef={warningsTabRef}\n i18nStrings={i18nStrings}\n isTabFocused={isTabFocused}\n paneId={isPaneVisible ? paneId : undefined}\n onPreferencesOpen={onPreferencesOpen}\n isRefresh={isRefresh}\n />\n <Pane\n id={paneId}\n paneStatus={paneStatus}\n visible={isPaneVisible}\n annotations={currentAnnotations}\n highlighted={highlightedAnnotation}\n onAnnotationClick={onAnnotationClick}\n onAnnotationClear={onAnnotationClear}\n onClose={onPaneClose}\n cursorPositionLabel={i18n(\n 'i18nStrings.cursorPosition',\n i18nStrings?.cursorPosition,\n format => (row, column) => format({ row, column })\n )}\n closeButtonAriaLabel={i18n('i18nStrings.paneCloseButtonAriaLabel', i18nStrings?.paneCloseButtonAriaLabel)}\n handleAriaLabel={i18n('i18nStrings.resizeHandleAriaLabel', i18nStrings?.resizeHandleAriaLabel)}\n handleTooltipText={i18n('i18nStrings.resizeHandleTooltipText', i18nStrings?.resizeHandleTooltipText)}\n />\n </div>\n {isPreferencesModalVisible && (\n <PreferencesModal\n getModalRoot={getModalRoot}\n removeModalRoot={removeModalRoot}\n onConfirm={onPreferencesConfirm}\n onDismiss={onPreferencesDismiss}\n themes={themes ?? DEFAULT_AVAILABLE_THEMES}\n preferences={preferences}\n defaultTheme={defaultTheme}\n i18nStrings={{\n header: i18n('i18nStrings.preferencesModalHeader', i18nStrings?.preferencesModalHeader),\n cancel: i18n('i18nStrings.preferencesModalCancel', i18nStrings?.preferencesModalCancel),\n confirm: i18n('i18nStrings.preferencesModalConfirm', i18nStrings?.preferencesModalConfirm),\n wrapLines: i18n('i18nStrings.preferencesModalWrapLines', i18nStrings?.preferencesModalWrapLines),\n theme: i18n('i18nStrings.preferencesModalTheme', i18nStrings?.preferencesModalTheme),\n lightThemes: i18n('i18nStrings.preferencesModalLightThemes', i18nStrings?.preferencesModalLightThemes),\n darkThemes: i18n('i18nStrings.preferencesModalDarkThemes', i18nStrings?.preferencesModalDarkThemes),\n themeFilteringAriaLabel: i18n(\n 'i18nStrings.preferencesModalThemeFilteringAriaLabel',\n i18nStrings?.preferencesModalThemeFilteringAriaLabel\n ),\n themeFilteringPlaceholder: i18n(\n 'i18nStrings.preferencesModalThemeFilteringPlaceholder',\n i18nStrings?.preferencesModalThemeFilteringPlaceholder\n ),\n themeFilteringClearAriaLabel: i18nStrings?.preferencesModalThemeFilteringClearAriaLabel,\n }}\n />\n )}\n </>\n )}\n </div>\n );\n});\n\napplyDisplayName(CodeEditor, 'CodeEditor');\nexport default CodeEditor;\n"]}
@@ -137,6 +137,8 @@ export declare namespace CodeEditorProps {
137
137
  preferencesModalThemeFilteringPlaceholder?: string;
138
138
  preferencesModalThemeFilteringAriaLabel?: string;
139
139
  preferencesModalThemeFilteringClearAriaLabel?: string;
140
+ resizeHandleAriaLabel?: string;
141
+ resizeHandleTooltipText?: string;
140
142
  }
141
143
  interface ResizeDetail {
142
144
  height: number;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/code-editor/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,WAAW,eAAgB,SAAQ,kBAAkB,EAAE,qBAAqB,EAAE,cAAc;IAChG;;OAEG;IACH,GAAG,EAAE,GAAG,CAAC;IAET;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC;IAEnC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IAEnE;;;;OAIG;IACH,eAAe,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IAE1E;;OAEG;IACH,UAAU,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAEvE;;;;;;;;;;;;;OAaG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IAEnD;;;;OAIG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC,eAAe,CAAC;IAEzC;;;;OAIG;IACH,mBAAmB,EAAE,y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AAwB,CAAC,EAAE,MAAM,CAAC;QAElC,sBAAsB,CAAC,EAAE,MAAM,CAAC;QAChC,sBAAsB,CAAC,EAAE,MAAM,CAAC;QAChC,uBAAuB,CAAC,EAAE,MAAM,CAAC;QACjC,yBAAyB,CAAC,EAAE,MAAM,CAAC;QACnC,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC/B,2BAA2B,CAAC,EAAE,MAAM,CAAC;QACrC,0BAA0B,CAAC,EAAE,MAAM,CAAC;QAEpC,yCAAyC,CAAC,EAAE,MAAM,CAAC;QACnD,uCAAuC,CAAC,EAAE,MAAM,CAAC;QACjD,4CAA4C,CAAC,EAAE,MAAM,CAAC;QAEtD,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;KAClC;IACD,UAAiB,YAAY;QAC3B,MAAM,EAAE,MAAM,CAAC;KAChB;IACD,UAAiB,YAAY;QAC3B,KAAK,EAAE,MAAM,CAAC;KACf;IAED,UAAiB,cAAc;QAC7B,WAAW,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC;KAC/B;IAED,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/code-editor/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Ace } from 'ace-builds';\n\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { BaseModalProps } from '../modal/interfaces';\nimport { AceModes } from './ace-modes';\nimport { DarkThemes, LightThemes } from './ace-themes';\n\nexport interface CodeEditorProps extends BaseComponentProps, FormFieldControlProps, BaseModalProps {\n /**\n * The ace object.\n */\n ace: any;\n\n /**\n * Specifies the content that's displayed in the code editor.\n */\n value: string;\n\n /**\n * Specifies the programming language. You can use any of the programming languages supported by the `ace` object that you provide.\n * Alternatively, this can be used to set a language that is not supported by the default `language` list. Make sure you've added the highlighting support for this language to the Ace instance.\n * For more info on custom languages, see the [Code editor API](/components/code-editor?tabId=api) page.\n */\n language: CodeEditorProps.Language;\n\n /**\n * Specifies a custom label language. If set, it overrides the default language label.\n */\n languageLabel?: string;\n\n /**\n * An event handler called when the value changes.\n * The event `detail` contains the current value of the code editor content.\n * **Deprecated** Replaced by `onDelayedChange`.\n */\n onChange?: NonCancelableEventHandler<CodeEditorProps.ChangeDetail>;\n\n /**\n * An event handler called when the value changes.\n * The event `detail` contains the current value of the code editor content.\n * A user interaction can cause multiple change events to be emitted by the Ace editor. They are batched together into a single `onDelayedChange` event to avoid bugs when controlling the `value` field.\n */\n onDelayedChange?: NonCancelableEventHandler<CodeEditorProps.ChangeDetail>;\n\n /**\n * Annotations returned from Ace syntax checker after code validation.\n */\n onValidate?: NonCancelableEventHandler<CodeEditorProps.ValidateDetail>;\n\n /**\n * Specifies the component preferences.\n *\n * If set to `undefined`, the component uses the following default value:\n *\n * ```\n * {\n * wrapLines: true,\n * theme: 'dawn'\n * }\n * ```\n *\n * You can use any theme provided by Ace.\n */\n preferences?: Partial<CodeEditorProps.Preferences>;\n\n /**\n * List of Ace themes available for selection in preferences dialog. Make sure you include at least one light and at\n * least one dark theme. If not set explicitly, it will render all Ace themes available for selection, except\n * \"cloud_editor\" and \"cloud_editor_dark\".\n */\n themes?: CodeEditorProps.AvailableThemes;\n\n /**\n * Called when any of the preferences change.\n * The event `detail` contains the value of all the preferences as submitted by the user.\n *\n */\n onPreferencesChange: NonCancelableEventHandler<CodeEditorProps.Preferences>;\n\n /**\n * Renders the code editor in a loading state.\n */\n loading?: boolean;\n\n /**\n * Called when the user clicks the recovery button in the error state.\n * Use this to retry loading the code editor or to provide another option for the user to recover from the error.\n */\n onRecoveryClick?: NonCancelableEventHandler<void>;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * The object should contain, among others:\n *\n * * `loadingState` - Specifies the text to display while the component is loading.\n * * `errorState` - Specifies the text to display if there is an error loading Ace.\n * * `errorStateRecovery`: Specifies the text for the recovery button that's displayed next to the error text.\n * Use the `recoveryClick` event to do a recovery action (for example, retrying the request).\n * @i18n\n */\n i18nStrings?: CodeEditorProps.I18nStrings;\n\n /**\n * Specifies the height of the code editor document.\n */\n editorContentHeight?: number;\n\n /**\n * Called when the user resizes the editor by dragging the resize icon.\n * The event `detail` contains the new height of the editor in pixels.\n */\n onEditorContentResize?: NonCancelableEventHandler<CodeEditorProps.ResizeDetail>;\n\n /**\n * Adds `aria-label` to the code editor's textarea element.\n */\n ariaLabel?: string;\n}\n\n// Prevents typescript from collapsing a string union type into a string type while still allowing any string.\n// This leads to more helpful editor suggestions for known values.\n// See: https://github.com/microsoft/TypeScript/issues/29729\ntype LiteralUnion<LiteralType, BaseType extends string> = LiteralType | (BaseType & { _?: never });\n\ntype BuiltInLanguage = (typeof AceModes)[number]['value'];\n\nexport namespace CodeEditorProps {\n export type Language = LiteralUnion<BuiltInLanguage, string>;\n export type Theme = (typeof LightThemes)[number]['value'] | (typeof DarkThemes)[number]['value'];\n\n export interface AvailableThemes {\n light: ReadonlyArray<string>;\n dark: ReadonlyArray<string>;\n }\n\n export interface Preferences {\n wrapLines: boolean;\n theme: Theme;\n }\n\n export interface I18nStrings {\n loadingState?: string;\n errorState?: string;\n errorStateRecovery?: string;\n\n editorGroupAriaLabel?: string;\n statusBarGroupAriaLabel?: string;\n\n cursorPosition?: (row: number, column: number) => string;\n errorsTab?: string;\n warningsTab?: string;\n preferencesButtonAriaLabel?: string;\n paneCloseButtonAriaLabel?: string;\n\n preferencesModalHeader?: string;\n preferencesModalCancel?: string;\n preferencesModalConfirm?: string;\n preferencesModalWrapLines?: string;\n preferencesModalTheme?: string;\n preferencesModalLightThemes?: string;\n preferencesModalDarkThemes?: string;\n\n preferencesModalThemeFilteringPlaceholder?: string;\n preferencesModalThemeFilteringAriaLabel?: string;\n preferencesModalThemeFilteringClearAriaLabel?: string;\n }\n export interface ResizeDetail {\n height: number;\n }\n export interface ChangeDetail {\n value: string;\n }\n\n export interface ValidateDetail {\n annotations: Ace.Annotation[];\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the code editor control.\n */\n focus(): void;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/code-editor/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Ace } from 'ace-builds';\n\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { BaseModalProps } from '../modal/interfaces';\nimport { AceModes } from './ace-modes';\nimport { DarkThemes, LightThemes } from './ace-themes';\n\nexport interface CodeEditorProps extends BaseComponentProps, FormFieldControlProps, BaseModalProps {\n /**\n * The ace object.\n */\n ace: any;\n\n /**\n * Specifies the content that's displayed in the code editor.\n */\n value: string;\n\n /**\n * Specifies the programming language. You can use any of the programming languages supported by the `ace` object that you provide.\n * Alternatively, this can be used to set a language that is not supported by the default `language` list. Make sure you've added the highlighting support for this language to the Ace instance.\n * For more info on custom languages, see the [Code editor API](/components/code-editor?tabId=api) page.\n */\n language: CodeEditorProps.Language;\n\n /**\n * Specifies a custom label language. If set, it overrides the default language label.\n */\n languageLabel?: string;\n\n /**\n * An event handler called when the value changes.\n * The event `detail` contains the current value of the code editor content.\n * **Deprecated** Replaced by `onDelayedChange`.\n */\n onChange?: NonCancelableEventHandler<CodeEditorProps.ChangeDetail>;\n\n /**\n * An event handler called when the value changes.\n * The event `detail` contains the current value of the code editor content.\n * A user interaction can cause multiple change events to be emitted by the Ace editor. They are batched together into a single `onDelayedChange` event to avoid bugs when controlling the `value` field.\n */\n onDelayedChange?: NonCancelableEventHandler<CodeEditorProps.ChangeDetail>;\n\n /**\n * Annotations returned from Ace syntax checker after code validation.\n */\n onValidate?: NonCancelableEventHandler<CodeEditorProps.ValidateDetail>;\n\n /**\n * Specifies the component preferences.\n *\n * If set to `undefined`, the component uses the following default value:\n *\n * ```\n * {\n * wrapLines: true,\n * theme: 'dawn'\n * }\n * ```\n *\n * You can use any theme provided by Ace.\n */\n preferences?: Partial<CodeEditorProps.Preferences>;\n\n /**\n * List of Ace themes available for selection in preferences dialog. Make sure you include at least one light and at\n * least one dark theme. If not set explicitly, it will render all Ace themes available for selection, except\n * \"cloud_editor\" and \"cloud_editor_dark\".\n */\n themes?: CodeEditorProps.AvailableThemes;\n\n /**\n * Called when any of the preferences change.\n * The event `detail` contains the value of all the preferences as submitted by the user.\n *\n */\n onPreferencesChange: NonCancelableEventHandler<CodeEditorProps.Preferences>;\n\n /**\n * Renders the code editor in a loading state.\n */\n loading?: boolean;\n\n /**\n * Called when the user clicks the recovery button in the error state.\n * Use this to retry loading the code editor or to provide another option for the user to recover from the error.\n */\n onRecoveryClick?: NonCancelableEventHandler<void>;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * The object should contain, among others:\n *\n * * `loadingState` - Specifies the text to display while the component is loading.\n * * `errorState` - Specifies the text to display if there is an error loading Ace.\n * * `errorStateRecovery`: Specifies the text for the recovery button that's displayed next to the error text.\n * Use the `recoveryClick` event to do a recovery action (for example, retrying the request).\n * @i18n\n */\n i18nStrings?: CodeEditorProps.I18nStrings;\n\n /**\n * Specifies the height of the code editor document.\n */\n editorContentHeight?: number;\n\n /**\n * Called when the user resizes the editor by dragging the resize icon.\n * The event `detail` contains the new height of the editor in pixels.\n */\n onEditorContentResize?: NonCancelableEventHandler<CodeEditorProps.ResizeDetail>;\n\n /**\n * Adds `aria-label` to the code editor's textarea element.\n */\n ariaLabel?: string;\n}\n\n// Prevents typescript from collapsing a string union type into a string type while still allowing any string.\n// This leads to more helpful editor suggestions for known values.\n// See: https://github.com/microsoft/TypeScript/issues/29729\ntype LiteralUnion<LiteralType, BaseType extends string> = LiteralType | (BaseType & { _?: never });\n\ntype BuiltInLanguage = (typeof AceModes)[number]['value'];\n\nexport namespace CodeEditorProps {\n export type Language = LiteralUnion<BuiltInLanguage, string>;\n export type Theme = (typeof LightThemes)[number]['value'] | (typeof DarkThemes)[number]['value'];\n\n export interface AvailableThemes {\n light: ReadonlyArray<string>;\n dark: ReadonlyArray<string>;\n }\n\n export interface Preferences {\n wrapLines: boolean;\n theme: Theme;\n }\n\n export interface I18nStrings {\n loadingState?: string;\n errorState?: string;\n errorStateRecovery?: string;\n\n editorGroupAriaLabel?: string;\n statusBarGroupAriaLabel?: string;\n\n cursorPosition?: (row: number, column: number) => string;\n errorsTab?: string;\n warningsTab?: string;\n preferencesButtonAriaLabel?: string;\n paneCloseButtonAriaLabel?: string;\n\n preferencesModalHeader?: string;\n preferencesModalCancel?: string;\n preferencesModalConfirm?: string;\n preferencesModalWrapLines?: string;\n preferencesModalTheme?: string;\n preferencesModalLightThemes?: string;\n preferencesModalDarkThemes?: string;\n\n preferencesModalThemeFilteringPlaceholder?: string;\n preferencesModalThemeFilteringAriaLabel?: string;\n preferencesModalThemeFilteringClearAriaLabel?: string;\n\n resizeHandleAriaLabel?: string;\n resizeHandleTooltipText?: string;\n }\n export interface ResizeDetail {\n height: number;\n }\n export interface ChangeDetail {\n value: string;\n }\n\n export interface ValidateDetail {\n annotations: Ace.Annotation[];\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the code editor control.\n */\n focus(): void;\n }\n}\n"]}
@@ -9,10 +9,12 @@ interface PaneProps {
9
9
  highlighted?: Ace.Annotation;
10
10
  cursorPositionLabel?: (row: number, column: number) => string;
11
11
  closeButtonAriaLabel?: string;
12
+ handleAriaLabel?: string;
13
+ handleTooltipText?: string;
12
14
  onClose: () => void;
13
15
  onAnnotationClick: (annotation: Ace.Annotation) => void;
14
16
  onAnnotationClear: () => void;
15
17
  }
16
- export declare const Pane: ({ id, paneStatus, visible, annotations, highlighted, onClose, onAnnotationClick, onAnnotationClear, cursorPositionLabel, closeButtonAriaLabel, }: PaneProps) => JSX.Element | null;
18
+ export declare const Pane: ({ id, paneStatus, visible, annotations, highlighted, onClose, onAnnotationClick, onAnnotationClear, cursorPositionLabel, closeButtonAriaLabel, handleAriaLabel, handleTooltipText, }: PaneProps) => JSX.Element | null;
17
19
  export {};
18
20
  //# sourceMappingURL=pane.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pane.d.ts","sourceRoot":"","sources":["../../../src/code-editor/pane.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAOjC,OAAO,EAAqB,UAAU,EAAE,MAAM,QAAQ,CAAC;AAQvD,UAAU,SAAS;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,UAAU,CAAC;IAEvB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC;IAC9B,WAAW,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC;IAE7B,mBAAmB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9D,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,iBAAiB,EAAE,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,KAAK,IAAI,CAAC;IACxD,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,IAAI,qJAWd,SAAS,uBAwFX,CAAC"}
1
+ {"version":3,"file":"pane.d.ts","sourceRoot":"","sources":["../../../src/code-editor/pane.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAOjC,OAAO,EAAqB,UAAU,EAAE,MAAM,QAAQ,CAAC;AAQvD,UAAU,SAAS;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,UAAU,CAAC;IAEvB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC;IAC9B,WAAW,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC;IAE7B,mBAAmB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9D,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,iBAAiB,EAAE,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,KAAK,IAAI,CAAC;IACxD,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,IAAI,yLAad,SAAS,uBA8FX,CAAC"}
@@ -11,7 +11,7 @@ import styles from './styles.css.js';
11
11
  const ANNOTATION_ITEM_HEIGHT = 31;
12
12
  const PANE_ANNOTATIONS_PADDING = 12;
13
13
  const MIN_HEIGHT = 3 * ANNOTATION_ITEM_HEIGHT + 2 * PANE_ANNOTATIONS_PADDING;
14
- export const Pane = ({ id, paneStatus, visible, annotations, highlighted, onClose, onAnnotationClick, onAnnotationClear, cursorPositionLabel, closeButtonAriaLabel, }) => {
14
+ export const Pane = ({ id, paneStatus, visible, annotations, highlighted, onClose, onAnnotationClick, onAnnotationClear, cursorPositionLabel, closeButtonAriaLabel, handleAriaLabel, handleTooltipText, }) => {
15
15
  const [paneHeight, setPaneHeight] = useState(MIN_HEIGHT);
16
16
  const listRef = useRef(null);
17
17
  useEffect(() => {
@@ -46,7 +46,7 @@ export const Pane = ({ id, paneStatus, visible, annotations, highlighted, onClos
46
46
  return null;
47
47
  }
48
48
  return (React.createElement("div", { id: id, className: styles.pane, onKeyDown: onEscKeyDown, role: "tabpanel", "aria-labelledby": ariaLabelledBy },
49
- React.createElement(ResizableBox, { height: paneHeight, minHeight: MIN_HEIGHT, onResize: newHeight => setPaneHeight(newHeight) },
49
+ React.createElement(ResizableBox, { height: paneHeight, minHeight: MIN_HEIGHT, onResize: newHeight => setPaneHeight(newHeight), handleAriaLabel: handleAriaLabel, handleTooltipText: handleTooltipText },
50
50
  React.createElement(FocusLock, { className: styles['focus-lock'], autoFocus: true, restoreFocus: true },
51
51
  React.createElement("div", { className: styles.pane__list, tabIndex: -1 },
52
52
  React.createElement("table", { className: styles.pane__table, role: "presentation" },
@@ -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,CAAC,GAAG,sBAAsB,GAAG,CAAC,GAAG,wBAAwB,CAAC;AAkB7E,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EACnB,EAAE,EACF,UAAU,EACV,OAAO,EACP,WAAW,EACX,WAAW,EACX,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,GACV,EAAE,EAAE;IACd,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,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,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,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,CAAC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ffect, 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"]}