@cloudscape-design/components-themeable 3.0.648 → 3.0.650
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/app-layout/constants.scss +5 -0
- package/lib/internal/scss/app-layout/drawer/styles.scss +2 -7
- package/lib/internal/scss/app-layout/split-panel/styles.scss +1 -0
- package/lib/internal/scss/form-field/styles.scss +4 -0
- package/lib/internal/scss/progress-bar/styles.scss +4 -0
- package/lib/internal/scss/property-filter/styles.scss +5 -0
- package/lib/internal/template/app-layout/split-panel/styles.css.js +2 -2
- package/lib/internal/template/app-layout/split-panel/styles.scoped.css +3 -2
- package/lib/internal/template/app-layout/split-panel/styles.selectors.js +2 -2
- package/lib/internal/template/cards/index.d.ts.map +1 -1
- package/lib/internal/template/cards/index.js +6 -6
- package/lib/internal/template/cards/index.js.map +1 -1
- package/lib/internal/template/cards/interfaces.d.ts +1 -1
- package/lib/internal/template/cards/interfaces.js.map +1 -1
- package/lib/internal/template/form-field/internal.js +1 -1
- package/lib/internal/template/form-field/internal.js.map +1 -1
- package/lib/internal/template/form-field/styles.css.js +24 -23
- package/lib/internal/template/form-field/styles.scoped.css +40 -37
- package/lib/internal/template/form-field/styles.selectors.js +24 -23
- package/lib/internal/template/internal/direction.d.ts +1 -1
- package/lib/internal/template/internal/direction.d.ts.map +1 -1
- package/lib/internal/template/internal/direction.js +3 -0
- package/lib/internal/template/internal/direction.js.map +1 -1
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/internal/environment.json +1 -1
- package/lib/internal/template/mixed-line-bar-chart/bar-series.d.ts +2 -1
- package/lib/internal/template/mixed-line-bar-chart/bar-series.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/bar-series.js +6 -3
- package/lib/internal/template/mixed-line-bar-chart/bar-series.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/chart-container.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/chart-container.js +3 -3
- package/lib/internal/template/mixed-line-bar-chart/chart-container.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/data-series.d.ts +2 -1
- package/lib/internal/template/mixed-line-bar-chart/data-series.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/data-series.js +2 -2
- package/lib/internal/template/mixed-line-bar-chart/data-series.js.map +1 -1
- package/lib/internal/template/progress-bar/index.d.ts.map +1 -1
- package/lib/internal/template/progress-bar/index.js +1 -1
- package/lib/internal/template/progress-bar/index.js.map +1 -1
- package/lib/internal/template/progress-bar/internal.d.ts +2 -1
- package/lib/internal/template/progress-bar/internal.d.ts.map +1 -1
- package/lib/internal/template/progress-bar/internal.js +2 -2
- package/lib/internal/template/progress-bar/internal.js.map +1 -1
- package/lib/internal/template/progress-bar/styles.css.js +19 -18
- package/lib/internal/template/progress-bar/styles.scoped.css +36 -32
- package/lib/internal/template/progress-bar/styles.selectors.js +19 -18
- package/lib/internal/template/property-filter/index.d.ts.map +1 -1
- package/lib/internal/template/property-filter/index.js +8 -2
- package/lib/internal/template/property-filter/index.js.map +1 -1
- package/lib/internal/template/property-filter/interfaces.d.ts +5 -0
- package/lib/internal/template/property-filter/interfaces.d.ts.map +1 -1
- package/lib/internal/template/property-filter/interfaces.js.map +1 -1
- package/lib/internal/template/property-filter/styles.css.js +32 -31
- package/lib/internal/template/property-filter/styles.scoped.css +41 -33
- package/lib/internal/template/property-filter/styles.selectors.js +32 -31
- package/lib/internal/template/table/interfaces.d.ts +13 -11
- package/lib/internal/template/table/interfaces.d.ts.map +1 -1
- package/lib/internal/template/table/interfaces.js.map +1 -1
- package/lib/internal/template/table/internal.d.ts.map +1 -1
- package/lib/internal/template/table/internal.js +9 -4
- package/lib/internal/template/table/internal.js.map +1 -1
- package/lib/internal/template/table/selection/interfaces.d.ts +1 -0
- package/lib/internal/template/table/selection/interfaces.d.ts.map +1 -1
- package/lib/internal/template/table/selection/interfaces.js.map +1 -1
- package/lib/internal/template/table/selection/use-selection.d.ts +5 -4
- package/lib/internal/template/table/selection/use-selection.d.ts.map +1 -1
- package/lib/internal/template/table/selection/use-selection.js +55 -36
- package/lib/internal/template/table/selection/use-selection.js.map +1 -1
- package/lib/internal/template/table/thead.d.ts +1 -1
- package/lib/internal/template/table/thead.d.ts.map +1 -1
- package/lib/internal/template/table/thead.js +1 -1
- package/lib/internal/template/table/thead.js.map +1 -1
- package/lib/internal/template/test-utils/dom/progress-bar/index.d.ts +1 -0
- package/lib/internal/template/test-utils/dom/progress-bar/index.js +3 -0
- package/lib/internal/template/test-utils/dom/progress-bar/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/property-filter/index.d.ts +4 -0
- package/lib/internal/template/test-utils/dom/property-filter/index.js +6 -0
- package/lib/internal/template/test-utils/dom/property-filter/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/progress-bar/index.d.ts +1 -0
- package/lib/internal/template/test-utils/selectors/progress-bar/index.js +3 -0
- package/lib/internal/template/test-utils/selectors/progress-bar/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/property-filter/index.d.ts +4 -0
- package/lib/internal/template/test-utils/selectors/property-filter/index.js +6 -0
- package/lib/internal/template/test-utils/selectors/property-filter/index.js.map +1 -1
- package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -100,11 +100,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
100
100
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
101
101
|
SPDX-License-Identifier: Apache-2.0
|
|
102
102
|
*/
|
|
103
|
-
.awsui_error-icon-shake-
|
|
104
|
-
.awsui_warning-icon-shake-
|
|
105
|
-
animation: awsui_awsui-motion-shake-
|
|
103
|
+
.awsui_error-icon-shake-wrapper_14mhv_sqprx_103:not(#\9),
|
|
104
|
+
.awsui_warning-icon-shake-wrapper_14mhv_sqprx_104:not(#\9) {
|
|
105
|
+
animation: awsui_awsui-motion-shake-horizontally_14mhv_sqprx_1 var(--motion-duration-refresh-only-medium-0rwzu1, 165ms);
|
|
106
106
|
}
|
|
107
|
-
@keyframes awsui_awsui-motion-shake-
|
|
107
|
+
@keyframes awsui_awsui-motion-shake-horizontally_14mhv_sqprx_1 {
|
|
108
108
|
0% {
|
|
109
109
|
transform: translateX(-5px);
|
|
110
110
|
animation-timing-function: linear;
|
|
@@ -118,22 +118,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
@media (prefers-reduced-motion: reduce) {
|
|
121
|
-
.awsui_error-icon-shake-
|
|
122
|
-
.awsui_warning-icon-shake-
|
|
121
|
+
.awsui_error-icon-shake-wrapper_14mhv_sqprx_103:not(#\9),
|
|
122
|
+
.awsui_warning-icon-shake-wrapper_14mhv_sqprx_104:not(#\9) {
|
|
123
123
|
animation: none;
|
|
124
124
|
transition: none;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
.awsui-motion-disabled .awsui_error-icon-shake-
|
|
127
|
+
.awsui-motion-disabled .awsui_error-icon-shake-wrapper_14mhv_sqprx_103:not(#\9), .awsui-mode-entering .awsui_error-icon-shake-wrapper_14mhv_sqprx_103:not(#\9), .awsui-motion-disabled .awsui_warning-icon-shake-wrapper_14mhv_sqprx_104:not(#\9), .awsui-mode-entering .awsui_warning-icon-shake-wrapper_14mhv_sqprx_104:not(#\9) {
|
|
128
128
|
animation: none;
|
|
129
129
|
transition: none;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
.awsui_error-icon-scale-
|
|
133
|
-
.awsui_warning-icon-scale-
|
|
134
|
-
animation: awsui_awsui-motion-scale-
|
|
132
|
+
.awsui_error-icon-scale-wrapper_14mhv_sqprx_134:not(#\9),
|
|
133
|
+
.awsui_warning-icon-scale-wrapper_14mhv_sqprx_135:not(#\9) {
|
|
134
|
+
animation: awsui_awsui-motion-scale-popup_14mhv_sqprx_1 var(--motion-duration-refresh-only-medium-0rwzu1, 165ms) var(--motion-easing-refresh-only-a-liv5su, cubic-bezier(0, 0, 0, 1));
|
|
135
135
|
}
|
|
136
|
-
@keyframes awsui_awsui-motion-scale-
|
|
136
|
+
@keyframes awsui_awsui-motion-scale-popup_14mhv_sqprx_1 {
|
|
137
137
|
0% {
|
|
138
138
|
transform: scale(0.95);
|
|
139
139
|
}
|
|
@@ -142,22 +142,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
@media (prefers-reduced-motion: reduce) {
|
|
145
|
-
.awsui_error-icon-scale-
|
|
146
|
-
.awsui_warning-icon-scale-
|
|
145
|
+
.awsui_error-icon-scale-wrapper_14mhv_sqprx_134:not(#\9),
|
|
146
|
+
.awsui_warning-icon-scale-wrapper_14mhv_sqprx_135:not(#\9) {
|
|
147
147
|
animation: none;
|
|
148
148
|
transition: none;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
.awsui-motion-disabled .awsui_error-icon-scale-
|
|
151
|
+
.awsui-motion-disabled .awsui_error-icon-scale-wrapper_14mhv_sqprx_134:not(#\9), .awsui-mode-entering .awsui_error-icon-scale-wrapper_14mhv_sqprx_134:not(#\9), .awsui-motion-disabled .awsui_warning-icon-scale-wrapper_14mhv_sqprx_135:not(#\9), .awsui-mode-entering .awsui_warning-icon-scale-wrapper_14mhv_sqprx_135:not(#\9) {
|
|
152
152
|
animation: none;
|
|
153
153
|
transition: none;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
.
|
|
157
|
-
.
|
|
158
|
-
animation: awsui_awsui-motion-fade-in-
|
|
156
|
+
.awsui_warning_14mhv_sqprx_104:not(#\9),
|
|
157
|
+
.awsui_error_14mhv_sqprx_103:not(#\9) {
|
|
158
|
+
animation: awsui_awsui-motion-fade-in-0_14mhv_sqprx_1 var(--motion-duration-refresh-only-medium-0rwzu1, 165ms) var(--motion-easing-refresh-only-a-liv5su, cubic-bezier(0, 0, 0, 1));
|
|
159
159
|
}
|
|
160
|
-
@keyframes awsui_awsui-motion-fade-in-
|
|
160
|
+
@keyframes awsui_awsui-motion-fade-in-0_14mhv_sqprx_1 {
|
|
161
161
|
from {
|
|
162
162
|
opacity: 0;
|
|
163
163
|
}
|
|
@@ -166,18 +166,18 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
@media (prefers-reduced-motion: reduce) {
|
|
169
|
-
.
|
|
170
|
-
.
|
|
169
|
+
.awsui_warning_14mhv_sqprx_104:not(#\9),
|
|
170
|
+
.awsui_error_14mhv_sqprx_103:not(#\9) {
|
|
171
171
|
animation: none;
|
|
172
172
|
transition: none;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
.awsui-motion-disabled .
|
|
175
|
+
.awsui-motion-disabled .awsui_warning_14mhv_sqprx_104:not(#\9), .awsui-mode-entering .awsui_warning_14mhv_sqprx_104:not(#\9), .awsui-motion-disabled .awsui_error_14mhv_sqprx_103:not(#\9), .awsui-mode-entering .awsui_error_14mhv_sqprx_103:not(#\9) {
|
|
176
176
|
animation: none;
|
|
177
177
|
transition: none;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
.
|
|
180
|
+
.awsui_root_14mhv_sqprx_186:not(#\9) {
|
|
181
181
|
border-collapse: separate;
|
|
182
182
|
border-spacing: 0;
|
|
183
183
|
box-sizing: border-box;
|
|
@@ -214,7 +214,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
214
214
|
box-sizing: border-box;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
.
|
|
217
|
+
.awsui_label_14mhv_sqprx_222:not(#\9) {
|
|
218
218
|
box-sizing: border-box;
|
|
219
219
|
color: var(--color-text-form-label-3ubxwt, #16191f);
|
|
220
220
|
display: inline;
|
|
@@ -223,44 +223,47 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
223
223
|
font-weight: var(--font-display-label-weight-2njs7q, 400);
|
|
224
224
|
margin-inline-end: var(--space-xs-xf5ch3, 8px);
|
|
225
225
|
}
|
|
226
|
-
.
|
|
226
|
+
.awsui_label_14mhv_sqprx_222:not(#\9):only-child {
|
|
227
227
|
margin-block: 0;
|
|
228
228
|
margin-inline: 0;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
.
|
|
231
|
+
.awsui_info_14mhv_sqprx_236:not(#\9) {
|
|
232
232
|
display: inline-flex;
|
|
233
233
|
padding-inline-start: var(--space-xs-xf5ch3, 8px);
|
|
234
234
|
border-inline-start: var(--border-divider-section-width-wl9k66, 1px) solid var(--color-border-divider-default-in8dkg, #eaeded);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
.
|
|
238
|
-
.
|
|
237
|
+
.awsui_description_14mhv_sqprx_242:not(#\9),
|
|
238
|
+
.awsui_constraint_14mhv_sqprx_243:not(#\9) {
|
|
239
239
|
color: var(--color-text-form-secondary-rh78tu, #687078);
|
|
240
240
|
font-size: var(--font-size-body-s-533prh, 12px);
|
|
241
241
|
line-height: var(--line-height-body-s-n0pazd, 16px);
|
|
242
242
|
letter-spacing: var(--letter-spacing-body-s-nkvets, normal);
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
.
|
|
246
|
-
.awsui_constraint-has-validation-
|
|
245
|
+
.awsui_hints_14mhv_sqprx_250:not(#\9),
|
|
246
|
+
.awsui_constraint-has-validation-text_14mhv_sqprx_251:not(#\9) {
|
|
247
247
|
padding-block-start: var(--space-xxs-9rrxti, 4px);
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
.awsui_secondary-
|
|
250
|
+
.awsui_secondary-control_14mhv_sqprx_255:not(#\9) {
|
|
251
251
|
/* used in test-utils */
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
.
|
|
254
|
+
.awsui_controls_14mhv_sqprx_259:not(#\9):not(.awsui_label-hidden_14mhv_sqprx_259) {
|
|
255
255
|
padding-block-start: var(--space-xxs-9rrxti, 4px);
|
|
256
256
|
}
|
|
257
|
+
.awsui_label-wrapper_14mhv_sqprx_262:not(#\9):empty + .awsui_controls_14mhv_sqprx_259 {
|
|
258
|
+
padding-block-start: 0;
|
|
259
|
+
}
|
|
257
260
|
|
|
258
|
-
.
|
|
261
|
+
.awsui_control_14mhv_sqprx_259:not(#\9) {
|
|
259
262
|
min-inline-size: 0;
|
|
260
263
|
word-break: break-word;
|
|
261
264
|
}
|
|
262
265
|
|
|
263
|
-
.
|
|
266
|
+
.awsui_error_14mhv_sqprx_103:not(#\9) {
|
|
264
267
|
color: var(--color-text-status-error-ofc4yr, #d13212);
|
|
265
268
|
font-size: var(--font-size-body-s-533prh, 12px);
|
|
266
269
|
line-height: var(--line-height-body-s-n0pazd, 16px);
|
|
@@ -269,7 +272,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
269
272
|
align-items: flex-start;
|
|
270
273
|
}
|
|
271
274
|
|
|
272
|
-
.
|
|
275
|
+
.awsui_warning_14mhv_sqprx_104:not(#\9) {
|
|
273
276
|
color: var(--color-text-status-warning-azn00c, #906806);
|
|
274
277
|
font-size: var(--font-size-body-s-533prh, 12px);
|
|
275
278
|
line-height: var(--line-height-body-s-n0pazd, 16px);
|
|
@@ -278,12 +281,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
278
281
|
align-items: flex-start;
|
|
279
282
|
}
|
|
280
283
|
|
|
281
|
-
.
|
|
282
|
-
.
|
|
284
|
+
.awsui_error__message_14mhv_sqprx_289:not(#\9),
|
|
285
|
+
.awsui_warning__message_14mhv_sqprx_290:not(#\9) {
|
|
283
286
|
margin-inline-start: var(--space-xxs-9rrxti, 4px);
|
|
284
287
|
}
|
|
285
288
|
|
|
286
|
-
.awsui_visually-
|
|
289
|
+
.awsui_visually-hidden_14mhv_sqprx_294:not(#\9) {
|
|
287
290
|
position: absolute !important;
|
|
288
291
|
inset-block-start: -9999px !important;
|
|
289
292
|
inset-inline-start: -9999px !important;
|
|
@@ -2,28 +2,29 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"error-icon-shake-wrapper": "awsui_error-icon-shake-
|
|
6
|
-
"warning-icon-shake-wrapper": "awsui_warning-icon-shake-
|
|
7
|
-
"awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-
|
|
8
|
-
"error-icon-scale-wrapper": "awsui_error-icon-scale-
|
|
9
|
-
"warning-icon-scale-wrapper": "awsui_warning-icon-scale-
|
|
10
|
-
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-
|
|
11
|
-
"warning": "
|
|
12
|
-
"error": "
|
|
13
|
-
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-
|
|
14
|
-
"root": "
|
|
15
|
-
"label": "
|
|
16
|
-
"info": "
|
|
17
|
-
"description": "
|
|
18
|
-
"constraint": "
|
|
19
|
-
"hints": "
|
|
20
|
-
"constraint-has-validation-text": "awsui_constraint-has-validation-
|
|
21
|
-
"secondary-control": "awsui_secondary-
|
|
22
|
-
"controls": "
|
|
23
|
-
"label-hidden": "awsui_label-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
5
|
+
"error-icon-shake-wrapper": "awsui_error-icon-shake-wrapper_14mhv_sqprx_103",
|
|
6
|
+
"warning-icon-shake-wrapper": "awsui_warning-icon-shake-wrapper_14mhv_sqprx_104",
|
|
7
|
+
"awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-horizontally_14mhv_sqprx_1",
|
|
8
|
+
"error-icon-scale-wrapper": "awsui_error-icon-scale-wrapper_14mhv_sqprx_134",
|
|
9
|
+
"warning-icon-scale-wrapper": "awsui_warning-icon-scale-wrapper_14mhv_sqprx_135",
|
|
10
|
+
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_14mhv_sqprx_1",
|
|
11
|
+
"warning": "awsui_warning_14mhv_sqprx_104",
|
|
12
|
+
"error": "awsui_error_14mhv_sqprx_103",
|
|
13
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_14mhv_sqprx_1",
|
|
14
|
+
"root": "awsui_root_14mhv_sqprx_186",
|
|
15
|
+
"label": "awsui_label_14mhv_sqprx_222",
|
|
16
|
+
"info": "awsui_info_14mhv_sqprx_236",
|
|
17
|
+
"description": "awsui_description_14mhv_sqprx_242",
|
|
18
|
+
"constraint": "awsui_constraint_14mhv_sqprx_243",
|
|
19
|
+
"hints": "awsui_hints_14mhv_sqprx_250",
|
|
20
|
+
"constraint-has-validation-text": "awsui_constraint-has-validation-text_14mhv_sqprx_251",
|
|
21
|
+
"secondary-control": "awsui_secondary-control_14mhv_sqprx_255",
|
|
22
|
+
"controls": "awsui_controls_14mhv_sqprx_259",
|
|
23
|
+
"label-hidden": "awsui_label-hidden_14mhv_sqprx_259",
|
|
24
|
+
"label-wrapper": "awsui_label-wrapper_14mhv_sqprx_262",
|
|
25
|
+
"control": "awsui_control_14mhv_sqprx_259",
|
|
26
|
+
"error__message": "awsui_error__message_14mhv_sqprx_289",
|
|
27
|
+
"warning__message": "awsui_warning__message_14mhv_sqprx_290",
|
|
28
|
+
"visually-hidden": "awsui_visually-hidden_14mhv_sqprx_294"
|
|
28
29
|
};
|
|
29
30
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function getIsRtl(element: HTMLElement | SVGElement): boolean;
|
|
1
|
+
export declare function getIsRtl(element: null | HTMLElement | SVGElement): boolean;
|
|
2
2
|
export declare function getOffsetInlineStart(element: HTMLElement): number;
|
|
3
3
|
/**
|
|
4
4
|
* The scrollLeft value will be a negative number if the direction is RTL and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../../src/internal/direction.ts"],"names":[],"mappings":"AAGA,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../../src/internal/direction.ts"],"names":[],"mappings":"AAGA,wBAAgB,QAAQ,CAAC,OAAO,EAAE,IAAI,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAK1E;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,UAGxD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,UAExD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,UAEpE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU;;;;;;;EAoB7E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,UAIhD"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
export function getIsRtl(element) {
|
|
4
|
+
if (!element) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
4
7
|
return getComputedStyle(element).direction === 'rtl';
|
|
5
8
|
}
|
|
6
9
|
export function getOffsetInlineStart(element) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"direction.js","sourceRoot":"","sources":["../../../src/internal/direction.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,UAAU,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"direction.js","sourceRoot":"","sources":["../../../src/internal/direction.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM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AkB,CAAC,MAAM,CAAC;IAChD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CAAC;QACxC,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,WAAW,GAAG,kBAAkB,CAAC,KAAK;QACjE,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC;IAC5B,MAAM,cAAc,GAAG,gBAAgB,GAAG,UAAU,CAAC;IAErD,OAAO;QACL,SAAS;QACT,UAAU;QACV,eAAe;QACf,aAAa;QACb,gBAAgB;QAChB,cAAc;KACf,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAiB;IAC/C,OAAO,KAAK,CAAC,MAAM,YAAY,WAAW,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;QAClE,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,WAAW,GAAG,KAAK,CAAC,KAAK;QACpD,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;AAClB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function getIsRtl(element: null | HTMLElement | SVGElement): boolean {\n if (!element) {\n return false;\n }\n return getComputedStyle(element).direction === 'rtl';\n}\n\nexport function getOffsetInlineStart(element: HTMLElement) {\n const offsetParentWidth = element.offsetParent?.clientWidth ?? 0;\n return getIsRtl(element) ? offsetParentWidth - element.offsetWidth - element.offsetLeft : element.offsetLeft;\n}\n\n/**\n * The scrollLeft value will be a negative number if the direction is RTL and\n * needs to be converted to a positive value for direction independent scroll\n * computations. Additionally, the scrollLeft value can be a decimal value on\n * systems using display scaling requiring the floor and ceiling calls.\n */\nexport function getScrollInlineStart(element: HTMLElement) {\n return getIsRtl(element) ? Math.floor(element.scrollLeft) * -1 : Math.ceil(element.scrollLeft);\n}\n\n/**\n * The clientX position needs to be converted so it is relative to the right of\n * the document in order for computations to yield the same result in both\n * element directions.\n */\nexport function getLogicalClientX(event: PointerEvent, IsRtl: boolean) {\n return IsRtl ? document.documentElement.clientWidth - event.clientX : event.clientX;\n}\n\n/**\n * The getBoundingClientRect() function returns values relative to the top left\n * corner of the document regardless of document direction. The left/right position\n * will be transformed to insetInlineStart based on element direction in order to\n * support direction agnostic position computation.\n */\nexport function getLogicalBoundingClientRect(element: HTMLElement | SVGElement) {\n const boundingClientRect = element.getBoundingClientRect();\n\n const blockSize = boundingClientRect.height;\n const inlineSize = boundingClientRect.width;\n const insetBlockStart = boundingClientRect.top;\n const insetBlockEnd = boundingClientRect.bottom;\n const insetInlineStart = getIsRtl(element)\n ? document.documentElement.clientWidth - boundingClientRect.right\n : boundingClientRect.left;\n const insetInlineEnd = insetInlineStart + inlineSize;\n\n return {\n blockSize,\n inlineSize,\n insetBlockStart,\n insetBlockEnd,\n insetInlineStart,\n insetInlineEnd,\n };\n}\n\n/**\n * The pageX position needs to be converted so it is relative to the right of\n * the document in order for computations to yield the same result in both\n * element directions.\n */\nexport function getLogicalPageX(event: MouseEvent) {\n return event.target instanceof HTMLElement && getIsRtl(event.target)\n ? document.documentElement.clientWidth - event.pageX\n : event.pageX;\n}\n"]}
|
|
@@ -16,6 +16,7 @@ export interface BarSeriesProps<T> {
|
|
|
16
16
|
dimmed: boolean;
|
|
17
17
|
highlightedGroupIndex: number | null;
|
|
18
18
|
stackedBarValues?: StackedBarValues;
|
|
19
|
+
isRtl?: boolean;
|
|
19
20
|
}
|
|
20
|
-
export default function BarSeries<T extends ChartDataTypes>({ axis, series, color, xScale, yScale, highlighted, dimmed, highlightedGroupIndex, totalSeriesCount, seriesIndex, plotSize, chartAreaClipPath, stackedBarValues, }: BarSeriesProps<T>): JSX.Element;
|
|
21
|
+
export default function BarSeries<T extends ChartDataTypes>({ axis, series, color, xScale, yScale, highlighted, dimmed, highlightedGroupIndex, totalSeriesCount, seriesIndex, plotSize, chartAreaClipPath, stackedBarValues, isRtl, }: BarSeriesProps<T>): JSX.Element;
|
|
21
22
|
//# sourceMappingURL=bar-series.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-series.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/bar-series.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAyB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAKlE,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;IAEhB,MAAM,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAEhD,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IAEpB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAE1B,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAE1B,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGrC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"bar-series.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/bar-series.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAyB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAKlE,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;IAEhB,MAAM,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAEhD,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IAEpB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAE1B,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAE1B,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGrC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAEpC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,CAAC,SAAS,cAAc,EAAE,EAC1D,IAAI,EACJ,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,WAAW,EACX,MAAM,EACN,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,GACN,EAAE,cAAc,CAAC,CAAC,CAAC,eAiInB"}
|
|
@@ -6,7 +6,7 @@ import { matchesX, getKeyValue } from './utils';
|
|
|
6
6
|
import styles from './styles.css.js';
|
|
7
7
|
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
8
8
|
import { createOneSideRoundedRectPath } from './create-one-side-rounded-rect-path';
|
|
9
|
-
export default function BarSeries({ axis, series, color, xScale, yScale, highlighted, dimmed, highlightedGroupIndex, totalSeriesCount, seriesIndex, plotSize, chartAreaClipPath, stackedBarValues, }) {
|
|
9
|
+
export default function BarSeries({ axis, series, color, xScale, yScale, highlighted, dimmed, highlightedGroupIndex, totalSeriesCount, seriesIndex, plotSize, chartAreaClipPath, stackedBarValues, isRtl, }) {
|
|
10
10
|
const isRefresh = useVisualRefresh();
|
|
11
11
|
const isStacked = !!stackedBarValues;
|
|
12
12
|
const isVertical = axis === 'x';
|
|
@@ -81,7 +81,7 @@ export default function BarSeries({ axis, series, color, xScale, yScale, highlig
|
|
|
81
81
|
height: height - heightOffset,
|
|
82
82
|
}
|
|
83
83
|
: {
|
|
84
|
-
x: y - height + heightOffset / 2,
|
|
84
|
+
x: y - (!isRtl ? height : 0) + heightOffset / 2,
|
|
85
85
|
y: x + widthOffset / 2,
|
|
86
86
|
width: height - heightOffset,
|
|
87
87
|
height: width - widthOffset,
|
|
@@ -100,9 +100,12 @@ export default function BarSeries({ axis, series, color, xScale, yScale, highlig
|
|
|
100
100
|
else if (isVertical) {
|
|
101
101
|
side = isRoundedStart ? 'bottom' : 'top';
|
|
102
102
|
}
|
|
103
|
-
else {
|
|
103
|
+
else if (!isRtl) {
|
|
104
104
|
side = isRoundedStart ? 'left' : 'right';
|
|
105
105
|
}
|
|
106
|
+
else {
|
|
107
|
+
side = isRoundedStart ? 'right' : 'left';
|
|
108
|
+
}
|
|
106
109
|
if (side === 'all') {
|
|
107
110
|
return React.createElement("rect", Object.assign({ key: i }, placement, styleProps, { rx: rx }));
|
|
108
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-series.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/bar-series.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAKxB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAoB,MAAM,SAAS,CAAC;AAClE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAyBnF,MAAM,CAAC,OAAO,UAAU,SAAS,CAA2B,EAC1D,IAAI,EACJ,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,WAAW,EACX,MAAM,EACN,qBAAqB,EACr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c,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;SAC1C;QAED,IAAI,IAAI,KAAK,KAAK,EAAE;YAClB,OAAO,4CAAM,GAAG,EAAE,CAAC,IAAM,SAAS,EAAM,UAAU,IAAE,EAAE,EAAE,EAAE,IAAI,CAAC;SAChE;QACD,IAAI,IAAI,KAAK,MAAM,EAAE;YACnB,OAAO,4CAAM,GAAG,EAAE,CAAC,IAAM,SAAS,EAAM,UAAU,IAAE,EAAE,EAAE,CAAC,IAAI,CAAC;SAC/D;QACD,OAAO,4CAAM,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,4BAA4B,CAAC,SAAS,EAAE,EAAE,EAAE,IAAI,CAAC,IAAM,UAAU,EAAI,CAAC;IAChG,CAAC,CAAC,CACA,CACL,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { ScaleContinuousNumeric, ScaleTime } from '../internal/vendor/d3-scale';\n\nimport { ChartScale, NumericChartScale } from '../internal/components/cartesian-chart/scales';\nimport { ChartDataTypes, MixedLineBarChartProps } from './interfaces';\nimport { matchesX, getKeyValue, StackedBarValues } from './utils';\nimport styles from './styles.css.js';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { createOneSideRoundedRectPath } from './create-one-side-rounded-rect-path';\n\nexport interface BarSeriesProps<T> {\n axis: 'x' | 'y';\n\n series: MixedLineBarChartProps.BarDataSeries<T>;\n\n color: string;\n totalSeriesCount: number;\n seriesIndex: number;\n\n xScale: ChartScale;\n yScale: NumericChartScale;\n\n plotSize: number;\n chartAreaClipPath: string;\n\n highlighted: boolean;\n dimmed: boolean;\n highlightedGroupIndex: number | null;\n\n // Contains values to be used for stacked bars.\n stackedBarValues?: StackedBarValues;\n}\n\nexport default function BarSeries<T extends ChartDataTypes>({\n axis,\n series,\n color,\n xScale,\n yScale,\n highlighted,\n dimmed,\n highlightedGroupIndex,\n totalSeriesCount,\n seriesIndex,\n plotSize,\n chartAreaClipPath,\n stackedBarValues,\n}: BarSeriesProps<T>) {\n const isRefresh = useVisualRefresh();\n const isStacked = !!stackedBarValues;\n const isVertical = axis === 'x';\n\n const xCoordinates = (() => {\n if (series.type !== 'bar' || !xScale.isCategorical()) {\n return [];\n }\n\n const yContinuosScale: ScaleContinuousNumeric<number, number> | ScaleTime<number, number> = yScale.d3Scale;\n const xPoints = (series.data as ReadonlyArray<MixedLineBarChartProps.Datum<ChartDataTypes>>).map(\n ({ x }) => xScale.d3Scale(x) || NaN\n );\n\n const zeroY = yScale.d3Scale(0) ?? NaN;\n const baseY = isFinite(zeroY) ? Math.min(plotSize, zeroY) : plotSize;\n\n let barWidth = xScale.d3Scale.bandwidth();\n\n const PADDING = 4;\n const MINWIDTH = 4;\n\n if (!isStacked && totalSeriesCount > 1) {\n // Regular grouped bars\n barWidth = (barWidth - (totalSeriesCount - 1) * PADDING) / totalSeriesCount;\n barWidth = Math.max(barWidth, MINWIDTH);\n }\n\n return xPoints.map((x, i) => {\n const d = series.data[i];\n const key = getKeyValue(d.x);\n let barX = x;\n let yValue = d.y;\n let isRoundedStart = !isStacked;\n let isRoundedEnd = !isStacked;\n\n // Stacked bars\n if (isStacked) {\n const allXValues = stackedBarValues.get(key) ?? new Map();\n yValue = allXValues.get(seriesIndex) ?? 0;\n const allXValuesSorted = Array.from(allXValues.values()).sort((a, b) => a - b);\n isRoundedStart = yValue === allXValuesSorted[0];\n isRoundedEnd = yValue === allXValuesSorted[allXValuesSorted.length - 1];\n }\n // Regular grouped bars\n else if (totalSeriesCount > 1) {\n barX += seriesIndex * (barWidth + PADDING);\n }\n\n // Account for negative values growing \"down\" instead of \"up\"\n yValue = yValue < 0 ? yValue - d.y : yValue;\n\n return {\n x: barX,\n y: yContinuosScale(yValue) ?? NaN,\n width: barWidth,\n height: Math.abs((yContinuosScale(d.y) ?? NaN) - baseY),\n isRoundedStart,\n isRoundedEnd,\n };\n });\n })();\n\n const highlightedXValue = highlightedGroupIndex !== null ? xScale.domain[highlightedGroupIndex] : null;\n\n return (\n <g\n aria-label={series.title}\n clipPath={`url(#${chartAreaClipPath})`}\n className={clsx(styles.series, styles['series--bar'], {\n [styles['series--highlighted']]: highlighted,\n [styles['series--dimmed']]: dimmed,\n })}\n >\n {xCoordinates.map(({ x, y, width, height, isRoundedStart, isRoundedEnd }, i) => {\n if (!isFinite(x) || !isFinite(height)) {\n return;\n }\n\n // Create margins between stacked series but only when series data is not too small.\n const baseHeightOffset = isStacked ? 3 : 0;\n const isSmallBar = height < 4;\n const heightOffset = isSmallBar ? 0 : baseHeightOffset;\n const widthOffset = 2;\n\n const rx = isRefresh ? (isSmallBar ? 2 : 4) : 0;\n const placement = isVertical\n ? {\n x: x + widthOffset / 2,\n y: y + heightOffset / 2,\n width: width - widthOffset,\n height: height - heightOffset,\n }\n : {\n x: y - height + heightOffset / 2,\n y: x + widthOffset / 2,\n width: height - heightOffset,\n height: width - widthOffset,\n };\n\n const className = clsx(styles.series__rect, {\n [styles['series--dimmed']]: highlightedXValue !== null && !matchesX(highlightedXValue, series.data[i].x),\n });\n const styleProps = { fill: color, className };\n\n let side: 'left' | 'right' | 'top' | 'bottom' | 'all' | 'none' = 'none';\n if (isRoundedStart && isRoundedEnd) {\n side = 'all';\n } else if (!isRoundedStart && !isRoundedEnd) {\n side = 'none';\n } else if (isVertical) {\n side = isRoundedStart ? 'bottom' : 'top';\n } else {\n side = isRoundedStart ? 'left' : 'right';\n }\n\n if (side === 'all') {\n return <rect key={i} {...placement} {...styleProps} rx={rx} />;\n }\n if (side === 'none') {\n return <rect key={i} {...placement} {...styleProps} rx={0} />;\n }\n return <path key={i} d={createOneSideRoundedRectPath(placement, rx, side)} {...styleProps} />;\n })}\n </g>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bar-series.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/bar-series.tsx"],"names":[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Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { ScaleContinuousNumeric, ScaleTime } from '../internal/vendor/d3-scale';\n\nimport { ChartScale, NumericChartScale } from '../internal/components/cartesian-chart/scales';\nimport { ChartDataTypes, MixedLineBarChartProps } from './interfaces';\nimport { matchesX, getKeyValue, StackedBarValues } from './utils';\nimport styles from './styles.css.js';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { createOneSideRoundedRectPath } from './create-one-side-rounded-rect-path';\n\nexport interface BarSeriesProps<T> {\n axis: 'x' | 'y';\n\n series: MixedLineBarChartProps.BarDataSeries<T>;\n\n color: string;\n totalSeriesCount: number;\n seriesIndex: number;\n\n xScale: ChartScale;\n yScale: NumericChartScale;\n\n plotSize: number;\n chartAreaClipPath: string;\n\n highlighted: boolean;\n dimmed: boolean;\n highlightedGroupIndex: number | null;\n\n // Contains values to be used for stacked bars.\n stackedBarValues?: StackedBarValues;\n\n isRtl?: boolean;\n}\n\nexport default function BarSeries<T extends ChartDataTypes>({\n axis,\n series,\n color,\n xScale,\n yScale,\n highlighted,\n dimmed,\n highlightedGroupIndex,\n totalSeriesCount,\n seriesIndex,\n plotSize,\n chartAreaClipPath,\n stackedBarValues,\n isRtl,\n}: BarSeriesProps<T>) {\n const isRefresh = useVisualRefresh();\n const isStacked = !!stackedBarValues;\n const isVertical = axis === 'x';\n\n const xCoordinates = (() => {\n if (series.type !== 'bar' || !xScale.isCategorical()) {\n return [];\n }\n\n const yContinuosScale: ScaleContinuousNumeric<number, number> | ScaleTime<number, number> = yScale.d3Scale;\n const xPoints = (series.data as ReadonlyArray<MixedLineBarChartProps.Datum<ChartDataTypes>>).map(\n ({ x }) => xScale.d3Scale(x) || NaN\n );\n\n const zeroY = yScale.d3Scale(0) ?? NaN;\n const baseY = isFinite(zeroY) ? Math.min(plotSize, zeroY) : plotSize;\n\n let barWidth = xScale.d3Scale.bandwidth();\n\n const PADDING = 4;\n const MINWIDTH = 4;\n\n if (!isStacked && totalSeriesCount > 1) {\n // Regular grouped bars\n barWidth = (barWidth - (totalSeriesCount - 1) * PADDING) / totalSeriesCount;\n barWidth = Math.max(barWidth, MINWIDTH);\n }\n\n return xPoints.map((x, i) => {\n const d = series.data[i];\n const key = getKeyValue(d.x);\n let barX = x;\n let yValue = d.y;\n let isRoundedStart = !isStacked;\n let isRoundedEnd = !isStacked;\n\n // Stacked bars\n if (isStacked) {\n const allXValues = stackedBarValues.get(key) ?? new Map();\n yValue = allXValues.get(seriesIndex) ?? 0;\n const allXValuesSorted = Array.from(allXValues.values()).sort((a, b) => a - b);\n isRoundedStart = yValue === allXValuesSorted[0];\n isRoundedEnd = yValue === allXValuesSorted[allXValuesSorted.length - 1];\n }\n // Regular grouped bars\n else if (totalSeriesCount > 1) {\n barX += seriesIndex * (barWidth + PADDING);\n }\n\n // Account for negative values growing \"down\" instead of \"up\"\n yValue = yValue < 0 ? yValue - d.y : yValue;\n\n return {\n x: barX,\n y: yContinuosScale(yValue) ?? NaN,\n width: barWidth,\n height: Math.abs((yContinuosScale(d.y) ?? NaN) - baseY),\n isRoundedStart,\n isRoundedEnd,\n };\n });\n })();\n\n const highlightedXValue = highlightedGroupIndex !== null ? xScale.domain[highlightedGroupIndex] : null;\n\n return (\n <g\n aria-label={series.title}\n clipPath={`url(#${chartAreaClipPath})`}\n className={clsx(styles.series, styles['series--bar'], {\n [styles['series--highlighted']]: highlighted,\n [styles['series--dimmed']]: dimmed,\n })}\n >\n {xCoordinates.map(({ x, y, width, height, isRoundedStart, isRoundedEnd }, i) => {\n if (!isFinite(x) || !isFinite(height)) {\n return;\n }\n\n // Create margins between stacked series but only when series data is not too small.\n const baseHeightOffset = isStacked ? 3 : 0;\n const isSmallBar = height < 4;\n const heightOffset = isSmallBar ? 0 : baseHeightOffset;\n const widthOffset = 2;\n\n const rx = isRefresh ? (isSmallBar ? 2 : 4) : 0;\n const placement = isVertical\n ? {\n x: x + widthOffset / 2,\n y: y + heightOffset / 2,\n width: width - widthOffset,\n height: height - heightOffset,\n }\n : {\n x: y - (!isRtl ? height : 0) + heightOffset / 2,\n y: x + widthOffset / 2,\n width: height - heightOffset,\n height: width - widthOffset,\n };\n\n const className = clsx(styles.series__rect, {\n [styles['series--dimmed']]: highlightedXValue !== null && !matchesX(highlightedXValue, series.data[i].x),\n });\n const styleProps = { fill: color, className };\n\n let side: 'left' | 'right' | 'top' | 'bottom' | 'all' | 'none' = 'none';\n if (isRoundedStart && isRoundedEnd) {\n side = 'all';\n } else if (!isRoundedStart && !isRoundedEnd) {\n side = 'none';\n } else if (isVertical) {\n side = isRoundedStart ? 'bottom' : 'top';\n } else if (!isRtl) {\n side = isRoundedStart ? 'left' : 'right';\n } else {\n side = isRoundedStart ? 'right' : 'left';\n }\n\n if (side === 'all') {\n return <rect key={i} {...placement} {...styleProps} rx={rx} />;\n }\n if (side === 'none') {\n return <rect key={i} {...placement} {...styleProps} rx={0} />;\n }\n return <path key={i} d={createOneSideRoundedRectPath(placement, rx, side)} {...styleProps} />;\n })}\n </g>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-container.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/chart-container.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,SAAS,EAAmB,MAAM,cAAc,CAAC;AAGvH,OAAyB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AASrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAaxF,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,cAAc;IAC3D,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,aAAa,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;IAErD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,i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sBAAsB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAC5D,eAAe,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;IAC9D,WAAW,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAEtD,0BAA0B,CAAC,EAAE,sBAAsB,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC;CACnF;AAuBD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,SAAS,cAAc,EAAE,EAC/D,SAAS,EACT,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,iBAA4B,EAC5B,WAAmB,EACnB,cAAsB,EACtB,UAAU,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,MAAM,EACN,MAAM,EACN,SAAS,EACT,cAAc,EACd,eAAe,EACf,WAAgB,EAChB,0BAA0B,EAC1B,GAAG,KAAK,EACT,EAAE,mBAAmB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"chart-container.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/chart-container.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,SAAS,EAAmB,MAAM,cAAc,CAAC;AAGvH,OAAyB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AASrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAaxF,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,cAAc;IAC3D,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,aAAa,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;I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E,sBAAsB,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IAClD,cAAc,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAC5D,eAAe,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;IAC9D,WAAW,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAEtD,0BAA0B,CAAC,EAAE,sBAAsB,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC;CACnF;AAuBD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,SAAS,cAAc,EAAE,EAC/D,SAAS,EACT,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,iBAA4B,EAC5B,WAAmB,EACnB,cAAsB,EACtB,UAAU,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,MAAM,EACN,MAAM,EACN,SAAS,EACT,cAAc,EACd,eAAe,EACf,WAAgB,EAChB,0BAA0B,EAC1B,GAAG,KAAK,EACT,EAAE,mBAAmB,CAAC,CAAC,CAAC,eA6gBxB"}
|
|
@@ -51,7 +51,7 @@ export default function ChartContainer(_a) {
|
|
|
51
51
|
const containerRefObject = useRef(null);
|
|
52
52
|
const containerRef = useMergeRefs(containerMeasureRef, containerRefObject);
|
|
53
53
|
const popoverRef = useRef(null);
|
|
54
|
-
const isRtl =
|
|
54
|
+
const isRtl = getIsRtl(containerRefObject.current);
|
|
55
55
|
const xDomain = (props.xDomain || computeDomainX(series, xScaleType));
|
|
56
56
|
const yDomain = (props.yDomain || computeDomainY(series, yScaleType, stackedBars));
|
|
57
57
|
const linesOnly = series.every(({ series }) => series.type === 'line' || series.type === 'threshold');
|
|
@@ -85,7 +85,7 @@ export default function ChartContainer(_a) {
|
|
|
85
85
|
}
|
|
86
86
|
const bottomAxisProps = !horizontalBars
|
|
87
87
|
? getXAxisProps(plotWidth, !isRtl ? [0, plotWidth] : [plotWidth, 0])
|
|
88
|
-
: getYAxisProps(plotWidth, [0, plotWidth]);
|
|
88
|
+
: getYAxisProps(plotWidth, !isRtl ? [0, plotWidth] : [plotWidth, 0]);
|
|
89
89
|
const blockEndLabelsProps = useBLockEndLabels(Object.assign({}, bottomAxisProps));
|
|
90
90
|
const plotMeasureRef = useRef(null);
|
|
91
91
|
const measuredHeight = useHeightMeasure(() => plotMeasureRef.current, !fitHeight);
|
|
@@ -341,7 +341,7 @@ export default function ChartContainer(_a) {
|
|
|
341
341
|
React.createElement(InlineStartLabels, { axis: y, ticks: leftAxisProps.ticks, scale: leftAxisProps.scale, tickFormatter: leftAxisProps.tickFormatter, title: leftAxisProps.title, ariaRoleDescription: leftAxisProps.ariaRoleDescription, maxLabelsWidth: maxInlineStartLabelsWidth, plotWidth: plotWidth, plotHeight: plotHeight }),
|
|
342
342
|
horizontalBars && (React.createElement(VerticalGridLines, { scale: yAxisProps.scale, ticks: yAxisProps.ticks, height: plotHeight })),
|
|
343
343
|
emphasizeBaselineAxis && linesOnly && (React.createElement(EmphasizedBaseline, { axis: x, scale: yAxisProps.scale, width: plotWidth, height: plotHeight })),
|
|
344
|
-
React.createElement(DataSeries, { axis: x, plotWidth: plotWidth, plotHeight: plotHeight, highlightedSeries: highlightedSeries !== null && highlightedSeries !== void 0 ? highlightedSeries : null, highlightedGroupIndex: highlightedGroupIndex, stackedBars: stackedBars, isGroupNavigation: isGroupNavigation, visibleSeries: visibleSeries, xScale: xAxisProps.scale, yScale: yAxisProps.scale }),
|
|
344
|
+
React.createElement(DataSeries, { axis: x, plotWidth: plotWidth, plotHeight: plotHeight, highlightedSeries: highlightedSeries !== null && highlightedSeries !== void 0 ? highlightedSeries : null, highlightedGroupIndex: highlightedGroupIndex, stackedBars: stackedBars, isGroupNavigation: isGroupNavigation, visibleSeries: visibleSeries, xScale: xAxisProps.scale, yScale: yAxisProps.scale, isRtl: !!isRtl }),
|
|
345
345
|
emphasizeBaselineAxis && !linesOnly && (React.createElement(EmphasizedBaseline, { axis: x, scale: yAxisProps.scale, width: plotWidth, height: plotHeight })),
|
|
346
346
|
React.createElement(VerticalMarker, { key: verticalLineX || '', height: plotHeight, showPoints: highlightedPoint === null, showLine: !isGroupNavigation, points: verticalMarkers, ref: verticalMarkerRef }),
|
|
347
347
|
highlightedPoint && (React.createElement(HighlightedPoint, { ref: highlightedPointRef, point: point, role: "button", ariaLabel: activeAriaLabel, ariaHasPopup: true, ariaExpanded: isPopoverPinned })),
|