@cloudscape-design/components 3.0.619 → 3.0.621
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/annotation-context/annotation/styles.css.js +24 -24
- package/annotation-context/annotation/styles.scoped.css +31 -31
- package/annotation-context/annotation/styles.selectors.js +24 -24
- package/app-layout/classic.d.ts.map +1 -1
- package/app-layout/classic.js +5 -16
- package/app-layout/classic.js.map +1 -1
- package/app-layout/content-wrapper/index.d.ts +1 -0
- package/app-layout/content-wrapper/index.d.ts.map +1 -1
- package/app-layout/content-wrapper/index.js +3 -3
- package/app-layout/content-wrapper/index.js.map +1 -1
- package/app-layout/notifications/styles.css.js +3 -3
- package/app-layout/notifications/styles.scoped.css +7 -7
- package/app-layout/notifications/styles.selectors.js +3 -3
- package/app-layout/utils/sticky-offsets.d.ts +4 -0
- package/app-layout/utils/sticky-offsets.d.ts.map +1 -0
- package/app-layout/utils/sticky-offsets.js +10 -0
- package/app-layout/utils/sticky-offsets.js.map +1 -0
- package/app-layout/visual-refresh/context.d.ts.map +1 -1
- package/app-layout/visual-refresh/context.js +1 -5
- package/app-layout/visual-refresh/context.js.map +1 -1
- package/app-layout/visual-refresh/main.d.ts.map +1 -1
- package/app-layout/visual-refresh/main.js +6 -4
- package/app-layout/visual-refresh/main.js.map +1 -1
- package/app-layout/visual-refresh/styles.css.js +81 -81
- package/app-layout/visual-refresh/styles.scoped.css +258 -294
- package/app-layout/visual-refresh/styles.selectors.js +81 -81
- package/container/use-sticky-header.d.ts +1 -5
- package/container/use-sticky-header.d.ts.map +1 -1
- package/container/use-sticky-header.js +7 -34
- package/container/use-sticky-header.js.map +1 -1
- package/flashbar/styles.css.js +47 -47
- package/flashbar/styles.scoped.css +171 -171
- package/flashbar/styles.selectors.js +47 -47
- package/header/internal.d.ts.map +1 -1
- package/header/internal.js +3 -1
- package/header/internal.js.map +1 -1
- package/header/styles.css.js +35 -34
- package/header/styles.scoped.css +55 -52
- package/header/styles.selectors.js +35 -34
- package/internal/components/dropdown/styles.css.js +20 -20
- package/internal/components/dropdown/styles.scoped.css +41 -41
- package/internal/components/dropdown/styles.selectors.js +20 -20
- package/internal/context/app-layout-context.d.ts +0 -3
- package/internal/context/app-layout-context.d.ts.map +1 -1
- package/internal/context/app-layout-context.js +1 -5
- package/internal/context/app-layout-context.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/generated/custom-css-properties/index.d.ts.map +1 -1
- package/internal/generated/custom-css-properties/index.js +43 -44
- package/internal/generated/custom-css-properties/index.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/internal/styles/global-vars.d.ts +6 -0
- package/internal/styles/global-vars.d.ts.map +1 -0
- package/internal/styles/global-vars.js +8 -0
- package/internal/styles/global-vars.js.map +1 -0
- package/mixed-line-bar-chart/bar-series.d.ts +3 -3
- package/mixed-line-bar-chart/bar-series.d.ts.map +1 -1
- package/mixed-line-bar-chart/bar-series.js +61 -17
- package/mixed-line-bar-chart/bar-series.js.map +1 -1
- package/mixed-line-bar-chart/create-one-side-rounded-rect-path.d.ts +7 -0
- package/mixed-line-bar-chart/create-one-side-rounded-rect-path.d.ts.map +1 -0
- package/mixed-line-bar-chart/create-one-side-rounded-rect-path.js +33 -0
- package/mixed-line-bar-chart/create-one-side-rounded-rect-path.js.map +1 -0
- package/mixed-line-bar-chart/data-series.d.ts.map +1 -1
- package/mixed-line-bar-chart/data-series.js +5 -5
- package/mixed-line-bar-chart/data-series.js.map +1 -1
- package/mixed-line-bar-chart/utils.d.ts +2 -9
- package/mixed-line-bar-chart/utils.d.ts.map +1 -1
- package/mixed-line-bar-chart/utils.js +19 -26
- package/mixed-line-bar-chart/utils.js.map +1 -1
- package/package.json +1 -1
- package/spinner/styles.css.js +13 -13
- package/spinner/styles.scoped.css +39 -39
- package/spinner/styles.selectors.js +13 -13
- package/split-panel/implementation.d.ts.map +1 -1
- package/split-panel/implementation.js +7 -7
- package/split-panel/implementation.js.map +1 -1
- package/split-panel/interfaces.d.ts +1 -0
- package/split-panel/interfaces.d.ts.map +1 -1
- package/split-panel/interfaces.js.map +1 -1
- package/split-panel/side.d.ts +1 -1
- package/split-panel/side.d.ts.map +1 -1
- package/split-panel/side.js +2 -5
- package/split-panel/side.js.map +1 -1
- package/table/sticky-scrollbar/sticky-scrollbar.d.ts.map +1 -1
- package/table/sticky-scrollbar/sticky-scrollbar.js +1 -7
- package/table/sticky-scrollbar/sticky-scrollbar.js.map +1 -1
- package/table/sticky-scrollbar/use-sticky-scrollbar.d.ts +2 -2
- package/table/sticky-scrollbar/use-sticky-scrollbar.d.ts.map +1 -1
- package/table/sticky-scrollbar/use-sticky-scrollbar.js +12 -30
- package/table/sticky-scrollbar/use-sticky-scrollbar.js.map +1 -1
- package/theming/index.d.ts +5 -0
- package/theming/index.d.ts.map +1 -1
- package/theming/index.js +8 -1
- package/theming/index.js.map +1 -1
|
@@ -100,51 +100,51 @@ 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
|
-
@keyframes awsui_spinner-
|
|
103
|
+
@keyframes awsui_spinner-rotator_1612d_oxpob_1 {
|
|
104
104
|
0% {
|
|
105
|
-
transform: rotate(var(--awsui-spinner-rotator-from-
|
|
105
|
+
transform: rotate(var(--awsui-spinner-rotator-from-ud5fvm));
|
|
106
106
|
}
|
|
107
107
|
100% {
|
|
108
|
-
transform: rotate(var(--awsui-spinner-rotator-to-
|
|
108
|
+
transform: rotate(var(--awsui-spinner-rotator-to-ud5fvm));
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
@keyframes awsui_spinner-line-
|
|
111
|
+
@keyframes awsui_spinner-line-left_1612d_oxpob_1 {
|
|
112
112
|
0% {
|
|
113
|
-
transform: rotate(var(--awsui-spinner-line-left-from-
|
|
113
|
+
transform: rotate(var(--awsui-spinner-line-left-from-ud5fvm));
|
|
114
114
|
}
|
|
115
115
|
50% {
|
|
116
|
-
transform: rotate(var(--awsui-spinner-line-left-to-
|
|
116
|
+
transform: rotate(var(--awsui-spinner-line-left-to-ud5fvm));
|
|
117
117
|
}
|
|
118
118
|
100% {
|
|
119
|
-
transform: rotate(var(--awsui-spinner-line-left-from-
|
|
119
|
+
transform: rotate(var(--awsui-spinner-line-left-from-ud5fvm));
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
@keyframes awsui_spinner-line-
|
|
122
|
+
@keyframes awsui_spinner-line-right_1612d_oxpob_1 {
|
|
123
123
|
0% {
|
|
124
|
-
transform: rotate(var(--awsui-spinner-line-right-from-
|
|
124
|
+
transform: rotate(var(--awsui-spinner-line-right-from-ud5fvm));
|
|
125
125
|
}
|
|
126
126
|
50% {
|
|
127
|
-
transform: rotate(var(--awsui-spinner-line-right-to-
|
|
127
|
+
transform: rotate(var(--awsui-spinner-line-right-to-ud5fvm));
|
|
128
128
|
}
|
|
129
129
|
100% {
|
|
130
|
-
transform: rotate(var(--awsui-spinner-line-right-from-
|
|
130
|
+
transform: rotate(var(--awsui-spinner-line-right-from-ud5fvm));
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
.
|
|
134
|
-
--awsui-spinner-rotator-from-
|
|
135
|
-
--awsui-spinner-rotator-to-
|
|
136
|
-
--awsui-spinner-line-left-from-
|
|
137
|
-
--awsui-spinner-line-left-to-
|
|
138
|
-
--awsui-spinner-line-right-from-
|
|
139
|
-
--awsui-spinner-line-right-to-
|
|
133
|
+
.awsui_root_1612d_oxpob_133:not(#\9) {
|
|
134
|
+
--awsui-spinner-rotator-from-ud5fvm: 0deg;
|
|
135
|
+
--awsui-spinner-rotator-to-ud5fvm: 360deg;
|
|
136
|
+
--awsui-spinner-line-left-from-ud5fvm: 0deg;
|
|
137
|
+
--awsui-spinner-line-left-to-ud5fvm: 120deg;
|
|
138
|
+
--awsui-spinner-line-right-from-ud5fvm: 90deg;
|
|
139
|
+
--awsui-spinner-line-right-to-ud5fvm: -30deg;
|
|
140
140
|
display: inline-block;
|
|
141
141
|
vertical-align: top;
|
|
142
142
|
/*stylelint-disable-next-line @cloudscape-design/no-motion-outside-of-mixin */
|
|
143
|
-
animation: awsui_spinner-
|
|
143
|
+
animation: awsui_spinner-rotator_1612d_oxpob_1 0.7s linear infinite;
|
|
144
144
|
box-sizing: border-box;
|
|
145
145
|
line-height: 0;
|
|
146
146
|
}
|
|
147
|
-
.
|
|
147
|
+
.awsui_root_1612d_oxpob_133.awsui_size-normal_1612d_oxpob_147:not(#\9) {
|
|
148
148
|
inline-size: var(--size-icon-normal-0m1722, 16px);
|
|
149
149
|
block-size: var(--size-icon-normal-0m1722, 16px);
|
|
150
150
|
padding-block: calc((var(--size-icon-normal-0m1722, 16px) - 12px) / 2);
|
|
@@ -152,7 +152,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
152
152
|
margin-block: calc((var(--line-height-body-m-30ar75, 20px) - var(--size-icon-normal-0m1722, 16px)) / 2);
|
|
153
153
|
box-sizing: border-box;
|
|
154
154
|
}
|
|
155
|
-
.
|
|
155
|
+
.awsui_root_1612d_oxpob_133.awsui_size-big_1612d_oxpob_155:not(#\9) {
|
|
156
156
|
inline-size: var(--size-icon-big-zkdryd, 32px);
|
|
157
157
|
block-size: var(--size-icon-big-zkdryd, 32px);
|
|
158
158
|
padding-block: calc((var(--size-icon-big-zkdryd, 32px) - 24px) / 2);
|
|
@@ -160,7 +160,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
160
160
|
margin-block: calc((var(--line-height-heading-xl-avbttk, 30px) - var(--size-icon-big-zkdryd, 32px)) / 2);
|
|
161
161
|
box-sizing: border-box;
|
|
162
162
|
}
|
|
163
|
-
.
|
|
163
|
+
.awsui_root_1612d_oxpob_133.awsui_size-large_1612d_oxpob_163:not(#\9) {
|
|
164
164
|
inline-size: var(--size-icon-large-bivhmh, 48px);
|
|
165
165
|
block-size: var(--size-icon-large-bivhmh, 48px);
|
|
166
166
|
padding-block: calc((var(--size-icon-large-bivhmh, 48px) - 36px) / 2);
|
|
@@ -168,32 +168,32 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
168
168
|
margin-block: calc((var(--line-height-display-l-8nioft, 48px) - var(--size-icon-large-bivhmh, 48px)) / 2);
|
|
169
169
|
box-sizing: border-box;
|
|
170
170
|
}
|
|
171
|
-
.
|
|
171
|
+
.awsui_root_1612d_oxpob_133.awsui_variant-normal_1612d_oxpob_171:not(#\9) {
|
|
172
172
|
color: currentColor;
|
|
173
173
|
}
|
|
174
|
-
.
|
|
174
|
+
.awsui_root_1612d_oxpob_133.awsui_variant-disabled_1612d_oxpob_174:not(#\9) {
|
|
175
175
|
color: var(--color-text-interactive-disabled-z7a3t4, #9ba7b6);
|
|
176
176
|
}
|
|
177
|
-
.
|
|
177
|
+
.awsui_root_1612d_oxpob_133.awsui_variant-inverted_1612d_oxpob_177:not(#\9) {
|
|
178
178
|
color: var(--color-text-inverted-70cpkk, #ffffff);
|
|
179
179
|
}
|
|
180
|
-
.
|
|
181
|
-
--awsui-spinner-rotator-from-
|
|
182
|
-
--awsui-spinner-rotator-to-
|
|
183
|
-
--awsui-spinner-line-left-from-
|
|
184
|
-
--awsui-spinner-line-left-to-
|
|
185
|
-
--awsui-spinner-line-right-from-
|
|
186
|
-
--awsui-spinner-line-right-to-
|
|
180
|
+
.awsui_root_1612d_oxpob_133:not(#\9):dir(rtl) {
|
|
181
|
+
--awsui-spinner-rotator-from-ud5fvm: 360deg;
|
|
182
|
+
--awsui-spinner-rotator-to-ud5fvm: 0deg;
|
|
183
|
+
--awsui-spinner-line-left-from-ud5fvm: 0deg;
|
|
184
|
+
--awsui-spinner-line-left-to-ud5fvm: -120deg;
|
|
185
|
+
--awsui-spinner-line-right-from-ud5fvm: -90deg;
|
|
186
|
+
--awsui-spinner-line-right-to-ud5fvm: 30deg;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
.
|
|
189
|
+
.awsui_circle_1612d_oxpob_189:not(#\9) {
|
|
190
190
|
display: inline-block;
|
|
191
191
|
inline-size: 50%;
|
|
192
192
|
block-size: 100%;
|
|
193
193
|
overflow: hidden;
|
|
194
194
|
position: relative;
|
|
195
195
|
}
|
|
196
|
-
.
|
|
196
|
+
.awsui_circle_1612d_oxpob_189:not(#\9):after {
|
|
197
197
|
position: absolute;
|
|
198
198
|
box-sizing: border-box;
|
|
199
199
|
content: "";
|
|
@@ -206,7 +206,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
206
206
|
border-inline-end-color: transparent;
|
|
207
207
|
border-block-end-color: transparent;
|
|
208
208
|
}
|
|
209
|
-
.
|
|
209
|
+
.awsui_circle_1612d_oxpob_189:not(#\9):after {
|
|
210
210
|
/*stylelint-disable-next-line @cloudscape-design/no-motion-outside-of-mixin */
|
|
211
211
|
animation: 1.5s ease-in-out infinite;
|
|
212
212
|
inset-block-start: 0;
|
|
@@ -214,13 +214,13 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
214
214
|
block-size: 100%;
|
|
215
215
|
inline-size: 200%;
|
|
216
216
|
}
|
|
217
|
-
.
|
|
217
|
+
.awsui_circle_1612d_oxpob_189.awsui_circle-left_1612d_oxpob_217:not(#\9):after {
|
|
218
218
|
inset-inline-start: 0;
|
|
219
219
|
/*stylelint-disable-next-line @cloudscape-design/no-motion-outside-of-mixin */
|
|
220
|
-
animation-name: awsui_spinner-line-
|
|
220
|
+
animation-name: awsui_spinner-line-left_1612d_oxpob_1;
|
|
221
221
|
}
|
|
222
|
-
.
|
|
222
|
+
.awsui_circle_1612d_oxpob_189.awsui_circle-right_1612d_oxpob_222:not(#\9):after {
|
|
223
223
|
inset-inline-start: -100%;
|
|
224
224
|
/*stylelint-disable-next-line @cloudscape-design/no-motion-outside-of-mixin */
|
|
225
|
-
animation-name: awsui_spinner-line-
|
|
225
|
+
animation-name: awsui_spinner-line-right_1612d_oxpob_1;
|
|
226
226
|
}
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"spinner-rotator": "awsui_spinner-
|
|
7
|
-
"size-normal": "awsui_size-
|
|
8
|
-
"size-big": "awsui_size-
|
|
9
|
-
"size-large": "awsui_size-
|
|
10
|
-
"variant-normal": "awsui_variant-
|
|
11
|
-
"variant-disabled": "awsui_variant-
|
|
12
|
-
"variant-inverted": "awsui_variant-
|
|
13
|
-
"circle": "
|
|
14
|
-
"circle-left": "awsui_circle-
|
|
15
|
-
"spinner-line-left": "awsui_spinner-line-
|
|
16
|
-
"circle-right": "awsui_circle-
|
|
17
|
-
"spinner-line-right": "awsui_spinner-line-
|
|
5
|
+
"root": "awsui_root_1612d_oxpob_133",
|
|
6
|
+
"spinner-rotator": "awsui_spinner-rotator_1612d_oxpob_1",
|
|
7
|
+
"size-normal": "awsui_size-normal_1612d_oxpob_147",
|
|
8
|
+
"size-big": "awsui_size-big_1612d_oxpob_155",
|
|
9
|
+
"size-large": "awsui_size-large_1612d_oxpob_163",
|
|
10
|
+
"variant-normal": "awsui_variant-normal_1612d_oxpob_171",
|
|
11
|
+
"variant-disabled": "awsui_variant-disabled_1612d_oxpob_174",
|
|
12
|
+
"variant-inverted": "awsui_variant-inverted_1612d_oxpob_177",
|
|
13
|
+
"circle": "awsui_circle_1612d_oxpob_189",
|
|
14
|
+
"circle-left": "awsui_circle-left_1612d_oxpob_217",
|
|
15
|
+
"spinner-line-left": "awsui_spinner-line-left_1612d_oxpob_1",
|
|
16
|
+
"circle-right": "awsui_circle-right_1612d_oxpob_222",
|
|
17
|
+
"spinner-line-right": "awsui_spinner-line-right_1612d_oxpob_1"
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAO5E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAiB/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAO5E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAiB/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,eAAO,MAAM,wBAAwB,qFA6OpC,CAAC"}
|
|
@@ -12,13 +12,13 @@ import { usePointerEvents } from '../app-layout/utils/use-pointer-events';
|
|
|
12
12
|
import { useKeyboardEvents } from '../app-layout/utils/use-keyboard-events';
|
|
13
13
|
import styles from './styles.css.js';
|
|
14
14
|
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
15
|
-
import { AppLayoutContext } from '../internal/context/app-layout-context';
|
|
16
15
|
import { Transition } from '../internal/components/transition';
|
|
17
16
|
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
18
17
|
import { useUniqueId } from '../internal/hooks/use-unique-id';
|
|
19
18
|
import { SplitPanelContentSide } from './side';
|
|
20
19
|
import { SplitPanelContentBottom } from './bottom';
|
|
21
20
|
import { useInternalI18n } from '../i18n/context';
|
|
21
|
+
import globalVars from '../internal/styles/global-vars';
|
|
22
22
|
export const SplitPanelImplementation = React.forwardRef((_a, __internalRootRef) => {
|
|
23
23
|
var { header, children, hidePreferencesButton = false, closeBehavior = 'collapse', i18nStrings } = _a, restProps = __rest(_a, ["header", "children", "hidePreferencesButton", "closeBehavior", "i18nStrings"]);
|
|
24
24
|
const isRefresh = useVisualRefresh();
|
|
@@ -40,10 +40,10 @@ export const SplitPanelImplementation = React.forwardRef((_a, __internalRootRef)
|
|
|
40
40
|
};
|
|
41
41
|
const onSliderPointerDown = usePointerEvents(sizeControlProps);
|
|
42
42
|
const onKeyDown = useKeyboardEvents(sizeControlProps);
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
const contentStyle = {
|
|
44
|
+
[globalVars.stickyVerticalTopOffset]: topOffset,
|
|
45
|
+
[globalVars.stickyVerticalBottomOffset]: bottomOffset,
|
|
46
|
+
};
|
|
47
47
|
const panelHeaderId = useUniqueId('split-panel-header');
|
|
48
48
|
const wrappedHeader = (React.createElement("div", { className: styles.header, style: appLayoutMaxWidth },
|
|
49
49
|
React.createElement("h2", { className: styles['header-text'], id: panelHeaderId }, header),
|
|
@@ -92,8 +92,8 @@ export const SplitPanelImplementation = React.forwardRef((_a, __internalRootRef)
|
|
|
92
92
|
return React.createElement(React.Fragment, null);
|
|
93
93
|
}
|
|
94
94
|
return (React.createElement(Transition, { in: isOpen !== null && isOpen !== void 0 ? isOpen : false }, (state, transitioningElementRef) => (React.createElement(React.Fragment, null,
|
|
95
|
-
position === 'side' && (React.createElement(SplitPanelContentSide, { resizeHandle: resizeHandle, baseProps: baseProps, isOpen: isOpen, splitPanelRef: mergedRef, cappedSize: size, onToggle: onToggle, openButtonAriaLabel: i18n('i18nStrings.openButtonAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.openButtonAriaLabel), toggleRef: refs.toggle, header: wrappedHeader, panelHeaderId: panelHeaderId },
|
|
96
|
-
position === 'bottom' && (React.createElement(SplitPanelContentBottom, { resizeHandle: resizeHandle, baseProps: baseProps, isOpen: isOpen, splitPanelRef: mergedRef, cappedSize: size, onToggle: onToggle, header: wrappedHeader, panelHeaderId: panelHeaderId, state: state, transitioningElementRef: transitioningElementRef, appLayoutMaxWidth: appLayoutMaxWidth },
|
|
95
|
+
position === 'side' && (React.createElement(SplitPanelContentSide, { style: contentStyle, resizeHandle: resizeHandle, baseProps: baseProps, isOpen: isOpen, splitPanelRef: mergedRef, cappedSize: size, onToggle: onToggle, openButtonAriaLabel: i18n('i18nStrings.openButtonAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.openButtonAriaLabel), toggleRef: refs.toggle, header: wrappedHeader, panelHeaderId: panelHeaderId }, children)),
|
|
96
|
+
position === 'bottom' && (React.createElement(SplitPanelContentBottom, { style: contentStyle, resizeHandle: resizeHandle, baseProps: baseProps, isOpen: isOpen, splitPanelRef: mergedRef, cappedSize: size, onToggle: onToggle, header: wrappedHeader, panelHeaderId: panelHeaderId, state: state, transitioningElementRef: transitioningElementRef, appLayoutMaxWidth: appLayoutMaxWidth }, children)),
|
|
97
97
|
isPreferencesOpen && (React.createElement(PreferencesModal, { visible: true, preferences: { position }, disabledSidePosition: position === 'bottom' && isForcedPosition, isRefresh: isRefresh, i18nStrings: {
|
|
98
98
|
header: i18n('i18nStrings.preferencesTitle', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesTitle),
|
|
99
99
|
confirm: i18n('i18nStrings.preferencesConfirm', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesConfirm),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yC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, { useState, useEffect, useLayoutEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\n\nimport { SplitPanelProps } from './interfaces';\nimport ResizeHandler from './icons/resize-handler';\nimport PreferencesModal from './preferences-modal';\nimport { usePointerEvents } from '../app-layout/utils/use-pointer-events';\nimport { useKeyboardEvents } from '../app-layout/utils/use-keyboard-events';\nimport { SizeControlProps } from '../app-layout/utils/interfaces';\n\nimport styles from './styles.css.js';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { AppLayoutContext } from '../internal/context/app-layout-context';\nimport { Transition } from '../internal/components/transition';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { SplitPanelContentSide } from './side';\nimport { SplitPanelContentBottom } from './bottom';\nimport { useInternalI18n } from '../i18n/context';\n\nexport { SplitPanelProps };\n\nexport const SplitPanelImplementation = React.forwardRef<HTMLElement, SplitPanelProps>(\n (\n { header, children, hidePreferencesButton = false, closeBehavior = 'collapse', i18nStrings, ...restProps },\n __internalRootRef\n ) => {\n const isRefresh = useVisualRefresh();\n\n const {\n position,\n topOffset,\n bottomOffset,\n rightOffset,\n contentWidthStyles,\n isOpen,\n isForcedPosition,\n onPreferencesChange,\n onResize,\n onToggle,\n size,\n relativeSize,\n setSplitPanelToggle,\n refs,\n } = useSplitPanelContext();\n const baseProps = getBaseProps(restProps);\n const i18n = useInternalI18n('split-panel');\n const [isPreferencesOpen, setPreferencesOpen] = useState<boolean>(false);\n\n const appLayoutMaxWidth = isRefresh && position === 'bottom' ? contentWidthStyles : undefined;\n\n const openButtonAriaLabel = i18n('i18nStrings.openButtonAriaLabel', i18nStrings?.openButtonAriaLabel);\n useEffect(() => {\n setSplitPanelToggle({ displayed: closeBehavior === 'collapse', ariaLabel: openButtonAriaLabel });\n }, [setSplitPanelToggle, openButtonAriaLabel, closeBehavior]);\n\n const splitPanelRefObject = useRef<HTMLDivElement>(null);\n\n const sizeControlProps: SizeControlProps = {\n position,\n panelRef: splitPanelRefObject,\n handleRef: refs.slider,\n onResize,\n };\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const wrappedChildren = (\n <AppLayoutContext.Provider\n value={{\n stickyOffsetTop: topOffset,\n stickyOffsetBottom: bottomOffset,\n }}\n >\n {children}\n </AppLayoutContext.Provider>\n );\n\n const panelHeaderId = useUniqueId('split-panel-header');\n\n const wrappedHeader = (\n <div className={styles.header} style={appLayoutMaxWidth}>\n <h2 className={styles['header-text']} id={panelHeaderId}>\n {header}\n </h2>\n <div className={styles['header-actions']}>\n {!hidePreferencesButton && isOpen && (\n <>\n <InternalButton\n className={styles['preferences-button']}\n iconName=\"settings\"\n variant=\"icon\"\n onClick={() => setPreferencesOpen(true)}\n formAction=\"none\"\n ariaLabel={i18n('i18nStrings.preferencesTitle', i18nStrings?.preferencesTitle)}\n ref={refs.preferences}\n />\n <span className={styles.divider} />\n </>\n )}\n\n {isOpen ? (\n <InternalButton\n className={styles['close-button']}\n iconName={\n isRefresh && closeBehavior === 'collapse'\n ? position === 'side'\n ? 'angle-right'\n : 'angle-down'\n : 'close'\n }\n variant=\"icon\"\n onClick={onToggle}\n formAction=\"none\"\n ariaLabel={i18n('i18nStrings.closeButtonAriaLabel', i18nStrings?.closeButtonAriaLabel)}\n ariaExpanded={isOpen}\n />\n ) : position === 'side' ? null : (\n <InternalButton\n className={styles['open-button']}\n iconName=\"angle-up\"\n variant=\"icon\"\n formAction=\"none\"\n ariaLabel={i18n('i18nStrings.openButtonAriaLabel', i18nStrings?.openButtonAriaLabel)}\n ref={refs.toggle}\n ariaExpanded={isOpen}\n />\n )}\n </div>\n </div>\n );\n\n const resizeHandle = (\n <div\n ref={refs.slider}\n role=\"slider\"\n tabIndex={0}\n aria-label={i18n('i18nStrings.resizeHandleAriaLabel', i18nStrings?.resizeHandleAriaLabel)}\n aria-valuemax={100}\n aria-valuemin={0}\n // Allows us to use the logical left/right keys to move the slider left/right,\n // but match aria keyboard behavior of using left/right to decrease/increase\n // the slider value.\n aria-valuenow={position === 'bottom' ? relativeSize : 100 - relativeSize}\n className={clsx(styles.slider, styles[`slider-${position}`])}\n onKeyDown={onKeyDown}\n onPointerDown={onSliderPointerDown}\n >\n <ResizeHandler className={clsx(styles['slider-icon'], styles[`slider-icon-${position}`])} />\n </div>\n );\n\n /*\n This effect forces the browser to recalculate the layout\n whenever the split panel might have moved.\n\n This is needed as a workaround for a bug in Safari, which does\n not automatically calculate the new position of the split panel\n _content_ when the split panel moves.\n */\n useLayoutEffect(() => {\n const root = splitPanelRefObject.current;\n\n if (root) {\n const property = 'transform';\n const temporaryValue = 'translateZ(0)';\n\n const valueBefore = root.style[property];\n root.style[property] = temporaryValue;\n\n // This line forces the browser to recalculate the layout\n void root.offsetHeight;\n\n root.style[property] = valueBefore;\n }\n }, [rightOffset, __internalRootRef]);\n\n const mergedRef = useMergeRefs(splitPanelRefObject, __internalRootRef);\n\n if (closeBehavior === 'hide' && !isOpen) {\n return <></>;\n }\n\n /**\n * The AppLayout factor moved the circular buttons out of the\n * SplitPanel and into the Tools component. This conditional\n * is still needed for the early return to prevent execution\n * of the following code.\n */\n if (isRefresh && !isOpen && position === 'side') {\n return <></>;\n }\n\n return (\n <Transition in={isOpen ?? false}>\n {(state, transitioningElementRef) => (\n <>\n {position === 'side' && (\n <SplitPanelContentSide\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n openButtonAriaLabel={i18n('i18nStrings.openButtonAriaLabel', i18nStrings?.openButtonAriaLabel)}\n toggleRef={refs.toggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n >\n {wrappedChildren}\n </SplitPanelContentSide>\n )}\n\n {position === 'bottom' && (\n <SplitPanelContentBottom\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n state={state}\n transitioningElementRef={transitioningElementRef}\n appLayoutMaxWidth={appLayoutMaxWidth}\n >\n {wrappedChildren}\n </SplitPanelContentBottom>\n )}\n {isPreferencesOpen && (\n <PreferencesModal\n visible={true}\n preferences={{ position }}\n disabledSidePosition={position === 'bottom' && isForcedPosition}\n isRefresh={isRefresh}\n i18nStrings={{\n header: i18n('i18nStrings.preferencesTitle', i18nStrings?.preferencesTitle),\n confirm: i18n('i18nStrings.preferencesConfirm', i18nStrings?.preferencesConfirm),\n cancel: i18n('i18nStrings.preferencesCancel', i18nStrings?.preferencesCancel),\n positionLabel: i18n('i18nStrings.preferencesPositionLabel', i18nStrings?.preferencesPositionLabel),\n positionDescription: i18n(\n 'i18nStrings.preferencesPositionDescription',\n i18nStrings?.preferencesPositionDescription\n ),\n positionBottom: i18n('i18nStrings.preferencesPositionBottom', i18nStrings?.preferencesPositionBottom),\n positionSide: i18n('i18nStrings.preferencesPositionSide', i18nStrings?.preferencesPositionSide),\n }}\n onConfirm={preferences => {\n onPreferencesChange({ ...preferences });\n setPreferencesOpen(false);\n }}\n onDismiss={() => {\n setPreferencesOpen(false);\n }}\n />\n )}\n </>\n )}\n </Transition>\n );\n }\n);\n"]}
|
|
1
|
+
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D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Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState, useEffect, useLayoutEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\n\nimport { SplitPanelProps } from './interfaces';\nimport ResizeHandler from './icons/resize-handler';\nimport PreferencesModal from './preferences-modal';\nimport { usePointerEvents } from '../app-layout/utils/use-pointer-events';\nimport { useKeyboardEvents } from '../app-layout/utils/use-keyboard-events';\nimport { SizeControlProps } from '../app-layout/utils/interfaces';\n\nimport styles from './styles.css.js';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { Transition } from '../internal/components/transition';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { SplitPanelContentSide } from './side';\nimport { SplitPanelContentBottom } from './bottom';\nimport { useInternalI18n } from '../i18n/context';\nimport globalVars from '../internal/styles/global-vars';\n\nexport { SplitPanelProps };\n\nexport const SplitPanelImplementation = React.forwardRef<HTMLElement, SplitPanelProps>(\n (\n { header, children, hidePreferencesButton = false, closeBehavior = 'collapse', i18nStrings, ...restProps },\n __internalRootRef\n ) => {\n const isRefresh = useVisualRefresh();\n\n const {\n position,\n topOffset,\n bottomOffset,\n rightOffset,\n contentWidthStyles,\n isOpen,\n isForcedPosition,\n onPreferencesChange,\n onResize,\n onToggle,\n size,\n relativeSize,\n setSplitPanelToggle,\n refs,\n } = useSplitPanelContext();\n const baseProps = getBaseProps(restProps);\n const i18n = useInternalI18n('split-panel');\n const [isPreferencesOpen, setPreferencesOpen] = useState<boolean>(false);\n\n const appLayoutMaxWidth = isRefresh && position === 'bottom' ? contentWidthStyles : undefined;\n\n const openButtonAriaLabel = i18n('i18nStrings.openButtonAriaLabel', i18nStrings?.openButtonAriaLabel);\n useEffect(() => {\n setSplitPanelToggle({ displayed: closeBehavior === 'collapse', ariaLabel: openButtonAriaLabel });\n }, [setSplitPanelToggle, openButtonAriaLabel, closeBehavior]);\n\n const splitPanelRefObject = useRef<HTMLDivElement>(null);\n\n const sizeControlProps: SizeControlProps = {\n position,\n panelRef: splitPanelRefObject,\n handleRef: refs.slider,\n onResize,\n };\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const contentStyle = {\n [globalVars.stickyVerticalTopOffset]: topOffset,\n [globalVars.stickyVerticalBottomOffset]: bottomOffset,\n };\n\n const panelHeaderId = useUniqueId('split-panel-header');\n\n const wrappedHeader = (\n <div className={styles.header} style={appLayoutMaxWidth}>\n <h2 className={styles['header-text']} id={panelHeaderId}>\n {header}\n </h2>\n <div className={styles['header-actions']}>\n {!hidePreferencesButton && isOpen && (\n <>\n <InternalButton\n className={styles['preferences-button']}\n iconName=\"settings\"\n variant=\"icon\"\n onClick={() => setPreferencesOpen(true)}\n formAction=\"none\"\n ariaLabel={i18n('i18nStrings.preferencesTitle', i18nStrings?.preferencesTitle)}\n ref={refs.preferences}\n />\n <span className={styles.divider} />\n </>\n )}\n\n {isOpen ? (\n <InternalButton\n className={styles['close-button']}\n iconName={\n isRefresh && closeBehavior === 'collapse'\n ? position === 'side'\n ? 'angle-right'\n : 'angle-down'\n : 'close'\n }\n variant=\"icon\"\n onClick={onToggle}\n formAction=\"none\"\n ariaLabel={i18n('i18nStrings.closeButtonAriaLabel', i18nStrings?.closeButtonAriaLabel)}\n ariaExpanded={isOpen}\n />\n ) : position === 'side' ? null : (\n <InternalButton\n className={styles['open-button']}\n iconName=\"angle-up\"\n variant=\"icon\"\n formAction=\"none\"\n ariaLabel={i18n('i18nStrings.openButtonAriaLabel', i18nStrings?.openButtonAriaLabel)}\n ref={refs.toggle}\n ariaExpanded={isOpen}\n />\n )}\n </div>\n </div>\n );\n\n const resizeHandle = (\n <div\n ref={refs.slider}\n role=\"slider\"\n tabIndex={0}\n aria-label={i18n('i18nStrings.resizeHandleAriaLabel', i18nStrings?.resizeHandleAriaLabel)}\n aria-valuemax={100}\n aria-valuemin={0}\n // Allows us to use the logical left/right keys to move the slider left/right,\n // but match aria keyboard behavior of using left/right to decrease/increase\n // the slider value.\n aria-valuenow={position === 'bottom' ? relativeSize : 100 - relativeSize}\n className={clsx(styles.slider, styles[`slider-${position}`])}\n onKeyDown={onKeyDown}\n onPointerDown={onSliderPointerDown}\n >\n <ResizeHandler className={clsx(styles['slider-icon'], styles[`slider-icon-${position}`])} />\n </div>\n );\n\n /*\n This effect forces the browser to recalculate the layout\n whenever the split panel might have moved.\n\n This is needed as a workaround for a bug in Safari, which does\n not automatically calculate the new position of the split panel\n _content_ when the split panel moves.\n */\n useLayoutEffect(() => {\n const root = splitPanelRefObject.current;\n\n if (root) {\n const property = 'transform';\n const temporaryValue = 'translateZ(0)';\n\n const valueBefore = root.style[property];\n root.style[property] = temporaryValue;\n\n // This line forces the browser to recalculate the layout\n void root.offsetHeight;\n\n root.style[property] = valueBefore;\n }\n }, [rightOffset, __internalRootRef]);\n\n const mergedRef = useMergeRefs(splitPanelRefObject, __internalRootRef);\n\n if (closeBehavior === 'hide' && !isOpen) {\n return <></>;\n }\n\n /**\n * The AppLayout factor moved the circular buttons out of the\n * SplitPanel and into the Tools component. This conditional\n * is still needed for the early return to prevent execution\n * of the following code.\n */\n if (isRefresh && !isOpen && position === 'side') {\n return <></>;\n }\n\n return (\n <Transition in={isOpen ?? false}>\n {(state, transitioningElementRef) => (\n <>\n {position === 'side' && (\n <SplitPanelContentSide\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n openButtonAriaLabel={i18n('i18nStrings.openButtonAriaLabel', i18nStrings?.openButtonAriaLabel)}\n toggleRef={refs.toggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n >\n {children}\n </SplitPanelContentSide>\n )}\n\n {position === 'bottom' && (\n <SplitPanelContentBottom\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n state={state}\n transitioningElementRef={transitioningElementRef}\n appLayoutMaxWidth={appLayoutMaxWidth}\n >\n {children}\n </SplitPanelContentBottom>\n )}\n {isPreferencesOpen && (\n <PreferencesModal\n visible={true}\n preferences={{ position }}\n disabledSidePosition={position === 'bottom' && isForcedPosition}\n isRefresh={isRefresh}\n i18nStrings={{\n header: i18n('i18nStrings.preferencesTitle', i18nStrings?.preferencesTitle),\n confirm: i18n('i18nStrings.preferencesConfirm', i18nStrings?.preferencesConfirm),\n cancel: i18n('i18nStrings.preferencesCancel', i18nStrings?.preferencesCancel),\n positionLabel: i18n('i18nStrings.preferencesPositionLabel', i18nStrings?.preferencesPositionLabel),\n positionDescription: i18n(\n 'i18nStrings.preferencesPositionDescription',\n i18nStrings?.preferencesPositionDescription\n ),\n positionBottom: i18n('i18nStrings.preferencesPositionBottom', i18nStrings?.preferencesPositionBottom),\n positionSide: i18n('i18nStrings.preferencesPositionSide', i18nStrings?.preferencesPositionSide),\n }}\n onConfirm={preferences => {\n onPreferencesChange({ ...preferences });\n setPreferencesOpen(false);\n }}\n onDismiss={() => {\n setPreferencesOpen(false);\n }}\n />\n )}\n </>\n )}\n </Transition>\n );\n }\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/split-panel/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,eAAgB,SAAQ,kBAAkB;IACzD;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,a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Root":"","sources":["../../../src/split-panel/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface SplitPanelProps extends BaseComponentProps {\n /**\n * Header of the split panel.\n */\n header: string;\n children: React.ReactNode;\n /**\n * Determines whether the split panel collapses or hides completely when closed.\n */\n closeBehavior?: 'collapse' | 'hide';\n /**\n * When set to `true`, the preferences button is not displayed.\n */\n hidePreferencesButton?: boolean;\n /**\n * An object containing all the necessary localized strings required by the component.\n * - `closeButtonAriaLabel` - The text of the panel close button aria label.\n * - `openButtonAriaLabel` - The text of the panel open button aria label.\n * - `preferencesTitle` - The text of the preferences modal header.\n * - `preferencesPositionLabel` - The text of the position preference label.\n * - `preferencesPositionDescription` - The text of the position preference description.\n * - `preferencesPositionSide` - The text of the side position preference label.\n * - `preferencesPositionBottom` - The text of the bottom position preference label.\n * - `preferencesConfirm` - The text of the preference modal confirm button.\n * - `preferencesCancel` - The text of the preference modal cancel button.\n * - `resizeHandleAriaLabel` - The label of the resize handle aria label.\n * @i18n\n */\n i18nStrings?: SplitPanelProps.I18nStrings;\n}\n\nexport namespace SplitPanelProps {\n export interface I18nStrings {\n closeButtonAriaLabel?: string;\n openButtonAriaLabel?: string;\n preferencesTitle?: string;\n preferencesPositionLabel?: string;\n preferencesPositionDescription?: string;\n preferencesPositionSide?: string;\n preferencesPositionBottom?: string;\n preferencesConfirm?: string;\n preferencesCancel?: string;\n resizeHandleAriaLabel?: string;\n }\n}\n\nexport interface SplitPanelContentProps {\n baseProps: BaseComponentProps;\n isOpen?: boolean;\n splitPanelRef?: React.Ref<any>;\n cappedSize: number;\n panelHeaderId: string;\n resizeHandle: React.ReactNode;\n header: React.ReactNode;\n children: React.ReactNode;\n onToggle: () => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/split-panel/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface SplitPanelProps extends BaseComponentProps {\n /**\n * Header of the split panel.\n */\n header: string;\n children: React.ReactNode;\n /**\n * Determines whether the split panel collapses or hides completely when closed.\n */\n closeBehavior?: 'collapse' | 'hide';\n /**\n * When set to `true`, the preferences button is not displayed.\n */\n hidePreferencesButton?: boolean;\n /**\n * An object containing all the necessary localized strings required by the component.\n * - `closeButtonAriaLabel` - The text of the panel close button aria label.\n * - `openButtonAriaLabel` - The text of the panel open button aria label.\n * - `preferencesTitle` - The text of the preferences modal header.\n * - `preferencesPositionLabel` - The text of the position preference label.\n * - `preferencesPositionDescription` - The text of the position preference description.\n * - `preferencesPositionSide` - The text of the side position preference label.\n * - `preferencesPositionBottom` - The text of the bottom position preference label.\n * - `preferencesConfirm` - The text of the preference modal confirm button.\n * - `preferencesCancel` - The text of the preference modal cancel button.\n * - `resizeHandleAriaLabel` - The label of the resize handle aria label.\n * @i18n\n */\n i18nStrings?: SplitPanelProps.I18nStrings;\n}\n\nexport namespace SplitPanelProps {\n export interface I18nStrings {\n closeButtonAriaLabel?: string;\n openButtonAriaLabel?: string;\n preferencesTitle?: string;\n preferencesPositionLabel?: string;\n preferencesPositionDescription?: string;\n preferencesPositionSide?: string;\n preferencesPositionBottom?: string;\n preferencesConfirm?: string;\n preferencesCancel?: string;\n resizeHandleAriaLabel?: string;\n }\n}\n\nexport interface SplitPanelContentProps {\n style: React.CSSProperties;\n baseProps: BaseComponentProps;\n isOpen?: boolean;\n splitPanelRef?: React.Ref<any>;\n cappedSize: number;\n panelHeaderId: string;\n resizeHandle: React.ReactNode;\n header: React.ReactNode;\n children: React.ReactNode;\n onToggle: () => void;\n}\n"]}
|
package/split-panel/side.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ interface SplitPanelContentSideProps extends SplitPanelContentProps {
|
|
|
5
5
|
openButtonAriaLabel?: string;
|
|
6
6
|
toggleRef: React.RefObject<ButtonProps.Ref>;
|
|
7
7
|
}
|
|
8
|
-
export declare function SplitPanelContentSide({ baseProps, splitPanelRef, toggleRef, header, children, resizeHandle, isOpen, cappedSize, openButtonAriaLabel, panelHeaderId, onToggle, }: SplitPanelContentSideProps): JSX.Element;
|
|
8
|
+
export declare function SplitPanelContentSide({ style, baseProps, splitPanelRef, toggleRef, header, children, resizeHandle, isOpen, cappedSize, openButtonAriaLabel, panelHeaderId, onToggle, }: SplitPanelContentSideProps): JSX.Element;
|
|
9
9
|
export {};
|
|
10
10
|
//# sourceMappingURL=side.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side.d.ts","sourceRoot":"","sources":["../../../src/split-panel/side.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAItD,UAAU,0BAA2B,SAAQ,sBAAsB;IACjE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;CAC7C;AAED,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,aAAa,EACb,SAAS,EACT,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,QAAQ,GACT,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"side.d.ts","sourceRoot":"","sources":["../../../src/split-panel/side.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAItD,UAAU,0BAA2B,SAAQ,sBAAsB;IACjE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;CAC7C;AAED,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,SAAS,EACT,aAAa,EACb,SAAS,EACT,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,QAAQ,GACT,EAAE,0BAA0B,eA8C5B"}
|
package/split-panel/side.js
CHANGED
|
@@ -6,15 +6,12 @@ import InternalButton from '../button/internal';
|
|
|
6
6
|
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
7
7
|
import styles from './styles.css.js';
|
|
8
8
|
import { useSplitPanelContext } from '../internal/context/split-panel-context';
|
|
9
|
-
export function SplitPanelContentSide({ baseProps, splitPanelRef, toggleRef, header, children, resizeHandle, isOpen, cappedSize, openButtonAriaLabel, panelHeaderId, onToggle, }) {
|
|
9
|
+
export function SplitPanelContentSide({ style, baseProps, splitPanelRef, toggleRef, header, children, resizeHandle, isOpen, cappedSize, openButtonAriaLabel, panelHeaderId, onToggle, }) {
|
|
10
10
|
const { topOffset, bottomOffset } = useSplitPanelContext();
|
|
11
11
|
const isRefresh = useVisualRefresh();
|
|
12
12
|
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles.drawer, styles.root, styles['position-side'], {
|
|
13
13
|
[styles['drawer-closed']]: !isOpen,
|
|
14
|
-
}), style: {
|
|
15
|
-
width: isOpen && isRefresh ? cappedSize : undefined,
|
|
16
|
-
maxWidth: isRefresh ? '100%' : undefined,
|
|
17
|
-
}, ref: splitPanelRef }),
|
|
14
|
+
}), style: Object.assign({ width: isOpen && isRefresh ? cappedSize : undefined, maxWidth: isRefresh ? '100%' : undefined }, style), ref: splitPanelRef }),
|
|
18
15
|
React.createElement("div", { className: clsx(styles['drawer-content-side']), style: {
|
|
19
16
|
top: topOffset,
|
|
20
17
|
bottom: bottomOffset,
|
package/split-panel/side.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side.js","sourceRoot":"","sources":["../../../src/split-panel/side.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAO/E,MAAM,UAAU,qBAAqB,CAAC,EACpC,SAAS,EACT,aAAa,EACb,SAAS,EACT,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,QAAQ,GACmB;IAC3B,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC3D,MAAM,SAAS,GAAG,gBAAgB,EAAE,CAAC;IACrC,OAAO,CACL,6CACM,SAAS,IACb,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE;YACxF,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,MAAM;SACnC,CAAC,EACF,KAAK,
|
|
1
|
+
{"version":3,"file":"side.js","sourceRoot":"","sources":["../../../src/split-panel/side.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EA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CACF,oBAAC,cAAc,IACb,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC,EAClE,QAAQ,EAAC,YAAY,EACrB,OAAO,EAAC,MAAM,EACd,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,mBAAmB,EAC9B,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,GACjC,CACH;YACD,6BAAK,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,iBAAe,CAAC,MAAM;gBAC1D,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,IAAG,MAAM,CAAO;gBACxE,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC,IAAG,QAAQ,CAAO,CACvE,CACF,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { ButtonProps } from '../button/interfaces';\nimport InternalButton from '../button/internal';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { SplitPanelContentProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\n\ninterface SplitPanelContentSideProps extends SplitPanelContentProps {\n openButtonAriaLabel?: string;\n toggleRef: React.RefObject<ButtonProps.Ref>;\n}\n\nexport function SplitPanelContentSide({\n style,\n baseProps,\n splitPanelRef,\n toggleRef,\n header,\n children,\n resizeHandle,\n isOpen,\n cappedSize,\n openButtonAriaLabel,\n panelHeaderId,\n onToggle,\n}: SplitPanelContentSideProps) {\n const { topOffset, bottomOffset } = useSplitPanelContext();\n const isRefresh = useVisualRefresh();\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.drawer, styles.root, styles['position-side'], {\n [styles['drawer-closed']]: !isOpen,\n })}\n style={{\n width: isOpen && isRefresh ? cappedSize : undefined,\n maxWidth: isRefresh ? '100%' : undefined,\n ...style,\n }}\n ref={splitPanelRef}\n >\n <div\n className={clsx(styles['drawer-content-side'])}\n style={{\n top: topOffset,\n bottom: bottomOffset,\n }}\n onClick={() => !isOpen && onToggle()}\n aria-labelledby={panelHeaderId}\n role=\"region\"\n >\n {isOpen ? (\n <div className={styles['slider-wrapper-side']}>{resizeHandle}</div>\n ) : (\n <InternalButton\n className={clsx(styles['open-button'], styles['open-button-side'])}\n iconName=\"angle-left\"\n variant=\"icon\"\n formAction=\"none\"\n ariaLabel={openButtonAriaLabel}\n ariaExpanded={isOpen}\n ref={isRefresh ? null : toggleRef}\n />\n )}\n <div className={styles['content-side']} aria-hidden={!isOpen}>\n <div className={clsx(styles['pane-header-wrapper-side'])}>{header}</div>\n <div className={clsx(styles['pane-content-wrapper-side'])}>{children}</div>\n </div>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sticky-scrollbar.d.ts","sourceRoot":"","sources":["../../../../src/table/sticky-scrollbar/sticky-scrollbar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"sticky-scrollbar.d.ts","sourceRoot":"","sources":["../../../../src/table/sticky-scrollbar/sticky-scrollbar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAQ1C,UAAU,oBAAoB;IAC5B,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC5C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC5C,QAAQ,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IAChD,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;;AAED,wBAA2C"}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import React, { forwardRef } from 'react';
|
|
4
4
|
import { useStickyScrollbar } from './use-sticky-scrollbar';
|
|
5
5
|
import { useMergeRefs } from '../../internal/hooks/use-merge-refs';
|
|
6
|
-
import { useAppLayoutContext } from '../../internal/context/app-layout-context';
|
|
7
6
|
import clsx from 'clsx';
|
|
8
7
|
import styles from './styles.css.js';
|
|
9
8
|
import { browserScrollbarSize } from '../../internal/utils/browser-scrollbar-size';
|
|
@@ -19,12 +18,7 @@ function StickyScrollbar({ wrapperRef, tableRef, onScroll, hasStickyColumns }, r
|
|
|
19
18
|
* overlay scrollbars (e.g. Mac).
|
|
20
19
|
*/
|
|
21
20
|
const offsetScrollbar = hasStickyColumns || browserScrollbarSize().height === 0;
|
|
22
|
-
|
|
23
|
-
* Use the appropriate AppLayout context (Classic or Visual Refresh) to determine
|
|
24
|
-
* the offsetBottom value to be used in the useStickyScrollbar hook.
|
|
25
|
-
*/
|
|
26
|
-
const { stickyOffsetBottom } = useAppLayoutContext();
|
|
27
|
-
useStickyScrollbar(scrollbarRef, scrollbarContentRef, tableRef, wrapperRef, stickyOffsetBottom, offsetScrollbar);
|
|
21
|
+
useStickyScrollbar(scrollbarRef, scrollbarContentRef, tableRef, wrapperRef, offsetScrollbar);
|
|
28
22
|
return (React.createElement("div", { ref: mergedRef, className: clsx(styles['sticky-scrollbar'], offsetScrollbar && styles['sticky-scrollbar-offset'], isVisualRefresh && styles['is-visual-refresh']), onScroll: onScroll },
|
|
29
23
|
React.createElement("div", { ref: scrollbarContentRef, className: styles['sticky-scrollbar-content'] })));
|
|
30
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sticky-scrollbar.js","sourceRoot":"","sources":["../../../../src/table/sticky-scrollbar/sticky-scrollbar.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C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AE,IAAI,CACb,MAAM,CAAC,kBAAkB,CAAC,EAC1B,eAAe,IAAI,MAAM,CAAC,yBAAyB,CAAC,EACpD,eAAe,IAAI,MAAM,CAAC,mBAAmB,CAAC,CAC/C,EACD,QAAQ,EAAE,QAAQ;QAElB,6BAAK,GAAG,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,CAAC,0BAA0B,CAAC,GAAI,CAC5E,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef } from 'react';\nimport { useStickyScrollbar } from './use-sticky-scrollbar';\nimport { useMergeRefs } from '../../internal/hooks/use-merge-refs';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport { browserScrollbarSize } from '../../internal/utils/browser-scrollbar-size';\nimport { useVisualRefresh } from '../../internal/hooks/use-visual-mode';\n\ninterface StickyScrollbarProps {\n wrapperRef: React.RefObject<HTMLDivElement>;\n tableRef: React.RefObject<HTMLTableElement>;\n onScroll?: React.UIEventHandler<HTMLDivElement>;\n hasStickyColumns?: boolean;\n}\n\nexport default forwardRef(StickyScrollbar);\n\nfunction StickyScrollbar(\n { wrapperRef, tableRef, onScroll, hasStickyColumns }: StickyScrollbarProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const isVisualRefresh = useVisualRefresh();\n const scrollbarRef = React.useRef<HTMLDivElement>(null);\n const scrollbarContentRef = React.useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(ref, scrollbarRef);\n\n /**\n * If the height of the scrollbar is 0, we're likely on a platform that uses\n * overlay scrollbars (e.g. Mac).\n */\n const offsetScrollbar = hasStickyColumns || browserScrollbarSize().height === 0;\n\n useStickyScrollbar(scrollbarRef, scrollbarContentRef, tableRef, wrapperRef, offsetScrollbar);\n return (\n <div\n ref={mergedRef}\n className={clsx(\n styles['sticky-scrollbar'],\n offsetScrollbar && styles['sticky-scrollbar-offset'],\n isVisualRefresh && styles['is-visual-refresh']\n )}\n onScroll={onScroll}\n >\n <div ref={scrollbarContentRef} className={styles['sticky-scrollbar-content']} />\n </div>\n );\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
export declare const updatePosition: (tableEl: HTMLElement | null, wrapperEl: HTMLElement | null, scrollbarEl: HTMLElement | null, scrollbarContentEl: HTMLElement | null,
|
|
3
|
-
export declare function useStickyScrollbar(scrollbarRef: RefObject<HTMLDivElement>, scrollbarContentRef: RefObject<HTMLDivElement>, tableRef: RefObject<HTMLTableElement>, wrapperRef: RefObject<HTMLDivElement>,
|
|
2
|
+
export declare const updatePosition: (tableEl: HTMLElement | null, wrapperEl: HTMLElement | null, scrollbarEl: HTMLElement | null, scrollbarContentEl: HTMLElement | null, inScrollableContainer: boolean) => void;
|
|
3
|
+
export declare function useStickyScrollbar(scrollbarRef: RefObject<HTMLDivElement>, scrollbarContentRef: RefObject<HTMLDivElement>, tableRef: RefObject<HTMLTableElement>, wrapperRef: RefObject<HTMLDivElement>, offsetScrollbar: boolean): void;
|
|
4
4
|
//# sourceMappingURL=use-sticky-scrollbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-sticky-scrollbar.d.ts","sourceRoot":"","sources":["../../../../src/table/sticky-scrollbar/use-sticky-scrollbar.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"use-sticky-scrollbar.d.ts","sourceRoot":"","sources":["../../../../src/table/sticky-scrollbar/use-sticky-scrollbar.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAC;AAQvD,eAAO,MAAM,cAAc,YAChB,WAAW,GAAG,IAAI,aAChB,WAAW,GAAG,IAAI,eAChB,WAAW,GAAG,IAAI,sBACX,WAAW,GAAG,IAAI,yBACf,OAAO,SAgD/B,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,SAAS,CAAC,cAAc,CAAC,EACvC,mBAAmB,EAAE,SAAS,CAAC,cAAc,CAAC,EAC9C,QAAQ,EAAE,SAAS,CAAC,gBAAgB,CAAC,EACrC,UAAU,EAAE,SAAS,CAAC,cAAc,CAAC,EACrC,eAAe,EAAE,OAAO,QAsDzB"}
|
|
@@ -6,8 +6,9 @@ import styles from './styles.css.js';
|
|
|
6
6
|
import { getContainingBlock, supportsStickyPosition } from '../../internal/utils/dom';
|
|
7
7
|
import { getOverflowParents } from '../../internal/utils/scrollable-containers';
|
|
8
8
|
import { browserScrollbarSize } from '../../internal/utils/browser-scrollbar-size';
|
|
9
|
+
import globalVars from '../../internal/styles/global-vars';
|
|
9
10
|
import { getLogicalBoundingClientRect } from '../../internal/direction.js';
|
|
10
|
-
export const updatePosition = (tableEl, wrapperEl, scrollbarEl, scrollbarContentEl,
|
|
11
|
+
export const updatePosition = (tableEl, wrapperEl, scrollbarEl, scrollbarContentEl, inScrollableContainer) => {
|
|
11
12
|
if (!tableEl || !scrollbarEl || !wrapperEl) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
@@ -24,10 +25,6 @@ export const updatePosition = (tableEl, wrapperEl, scrollbarEl, scrollbarContent
|
|
|
24
25
|
// that's why syncing it separately
|
|
25
26
|
if (!scrollbarEl.classList.contains(styles['sticky-scrollbar-visible'])) {
|
|
26
27
|
requestAnimationFrame(() => {
|
|
27
|
-
/**
|
|
28
|
-
* We don't need to use getScrollInlineStart here instead of scrollLeft because
|
|
29
|
-
* the negative value isn't being used in computation.
|
|
30
|
-
*/
|
|
31
28
|
scrollbarEl.scrollLeft = wrapperEl.scrollLeft;
|
|
32
29
|
});
|
|
33
30
|
}
|
|
@@ -48,24 +45,17 @@ export const updatePosition = (tableEl, wrapperEl, scrollbarEl, scrollbarContent
|
|
|
48
45
|
scrollbarContentEl.style.inlineSize = `${tableElRect.inlineSize}px`;
|
|
49
46
|
// when using sticky scrollbars in containers
|
|
50
47
|
// we agreed to ignore dynamic bottom calculations for footer overlap
|
|
51
|
-
scrollbarEl.style.insetBlockEnd =
|
|
48
|
+
scrollbarEl.style.insetBlockEnd = inScrollableContainer
|
|
49
|
+
? '0px'
|
|
50
|
+
: `var(${globalVars.stickyVerticalBottomOffset}, 0px)`;
|
|
52
51
|
}
|
|
53
52
|
};
|
|
54
|
-
export function useStickyScrollbar(scrollbarRef, scrollbarContentRef, tableRef, wrapperRef,
|
|
55
|
-
|
|
56
|
-
// unnecessarily overcomplicate the position logic. For now, we assume that a
|
|
57
|
-
// containing block, if present, is below the app layout and above the overflow
|
|
58
|
-
// parent, which is a pretty safe assumption.
|
|
59
|
-
const [hasContainingBlock, setHasContainingBlock] = useState(false);
|
|
60
|
-
// We don't take into account footer height when the overflow parent is child of document body.
|
|
61
|
-
// Because in this case, we think the footer is outside the overflow parent.
|
|
62
|
-
const [hasOverflowParent, setHasOverflowParent] = useState(false);
|
|
63
|
-
const consideredFooterHeight = hasContainingBlock || hasOverflowParent ? 0 : footerHeight;
|
|
53
|
+
export function useStickyScrollbar(scrollbarRef, scrollbarContentRef, tableRef, wrapperRef, offsetScrollbar) {
|
|
54
|
+
const [inScrollableContainer, setInScrollableContainer] = useState(false);
|
|
64
55
|
const wrapperEl = wrapperRef.current;
|
|
65
56
|
useEffect(() => {
|
|
66
57
|
if (wrapperEl && supportsStickyPosition()) {
|
|
67
|
-
|
|
68
|
-
setHasOverflowParent(!!getOverflowParents(wrapperEl)[0]);
|
|
58
|
+
setInScrollableContainer(!!getContainingBlock(wrapperEl) || !!getOverflowParents(wrapperEl)[0]);
|
|
69
59
|
}
|
|
70
60
|
}, [wrapperEl]);
|
|
71
61
|
// Update scrollbar position wrapper or table size change.
|
|
@@ -73,7 +63,7 @@ export function useStickyScrollbar(scrollbarRef, scrollbarContentRef, tableRef,
|
|
|
73
63
|
if (supportsStickyPosition() && wrapperRef.current && tableRef.current) {
|
|
74
64
|
const observer = new ResizeObserver(() => {
|
|
75
65
|
if (scrollbarContentRef.current) {
|
|
76
|
-
updatePosition(tableRef.current, wrapperRef.current, scrollbarRef.current, scrollbarContentRef.current,
|
|
66
|
+
updatePosition(tableRef.current, wrapperRef.current, scrollbarRef.current, scrollbarContentRef.current, inScrollableContainer);
|
|
77
67
|
}
|
|
78
68
|
});
|
|
79
69
|
// Scrollbar width must be in sync with wrapper width.
|
|
@@ -84,20 +74,12 @@ export function useStickyScrollbar(scrollbarRef, scrollbarContentRef, tableRef,
|
|
|
84
74
|
observer.disconnect();
|
|
85
75
|
};
|
|
86
76
|
}
|
|
87
|
-
}, [
|
|
88
|
-
scrollbarContentRef,
|
|
89
|
-
scrollbarRef,
|
|
90
|
-
tableRef,
|
|
91
|
-
wrapperRef,
|
|
92
|
-
consideredFooterHeight,
|
|
93
|
-
hasContainingBlock,
|
|
94
|
-
offsetScrollbar,
|
|
95
|
-
]);
|
|
77
|
+
}, [scrollbarContentRef, scrollbarRef, tableRef, wrapperRef, inScrollableContainer, offsetScrollbar]);
|
|
96
78
|
// Update scrollbar position when window resizes (vertically).
|
|
97
79
|
useEffect(() => {
|
|
98
80
|
if (supportsStickyPosition()) {
|
|
99
81
|
const resizeHandler = () => {
|
|
100
|
-
updatePosition(tableRef.current, wrapperRef.current, scrollbarRef.current, scrollbarContentRef.current,
|
|
82
|
+
updatePosition(tableRef.current, wrapperRef.current, scrollbarRef.current, scrollbarContentRef.current, inScrollableContainer);
|
|
101
83
|
};
|
|
102
84
|
resizeHandler();
|
|
103
85
|
window.addEventListener('resize', resizeHandler);
|
|
@@ -105,6 +87,6 @@ export function useStickyScrollbar(scrollbarRef, scrollbarContentRef, tableRef,
|
|
|
105
87
|
window.removeEventListener('resize', resizeHandler);
|
|
106
88
|
};
|
|
107
89
|
}
|
|
108
|
-
}, [tableRef, wrapperRef, scrollbarRef, scrollbarContentRef,
|
|
90
|
+
}, [tableRef, wrapperRef, scrollbarRef, scrollbarContentRef, inScrollableContainer]);
|
|
109
91
|
}
|
|
110
92
|
//# sourceMappingURL=use-sticky-scrollbar.js.map
|