@salt-ds/core 1.41.0 → 1.43.0
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/CHANGELOG.md +100 -0
- package/css/salt-core.css +133 -54
- package/dist-cjs/accordion/AccordionHeader.css.js +1 -1
- package/dist-cjs/border-layout/BorderLayout.js +1 -1
- package/dist-cjs/border-layout/BorderLayout.js.map +1 -1
- package/dist-cjs/button/Button.css.js +1 -1
- package/dist-cjs/button/Button.js +2 -2
- package/dist-cjs/button/Button.js.map +1 -1
- package/dist-cjs/card/Card.css.js +1 -1
- package/dist-cjs/card/Card.js.map +1 -1
- package/dist-cjs/combo-box/ComboBox.js +22 -20
- package/dist-cjs/combo-box/ComboBox.js.map +1 -1
- package/dist-cjs/dialog/Dialog.js +1 -0
- package/dist-cjs/dialog/Dialog.js.map +1 -1
- package/dist-cjs/dialog/DialogContent.css.js +1 -1
- package/dist-cjs/dialog/DialogContent.js +24 -4
- package/dist-cjs/dialog/DialogContent.js.map +1 -1
- package/dist-cjs/dialog/DialogHeader.css.js +1 -1
- package/dist-cjs/dialog/DialogHeader.js +15 -16
- package/dist-cjs/dialog/DialogHeader.js.map +1 -1
- package/dist-cjs/dropdown/Dropdown.css.js +1 -1
- package/dist-cjs/dropdown/Dropdown.js +3 -3
- package/dist-cjs/dropdown/Dropdown.js.map +1 -1
- package/dist-cjs/flex-item/FlexItem.js +2 -2
- package/dist-cjs/flex-item/FlexItem.js.map +1 -1
- package/dist-cjs/flex-layout/FlexLayout.js +2 -2
- package/dist-cjs/flex-layout/FlexLayout.js.map +1 -1
- package/dist-cjs/grid-item/GridItem.js +2 -2
- package/dist-cjs/grid-item/GridItem.js.map +1 -1
- package/dist-cjs/grid-layout/GridLayout.js +2 -2
- package/dist-cjs/grid-layout/GridLayout.js.map +1 -1
- package/dist-cjs/index.js +2 -0
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/interactable-card/InteractableCard.css.js +1 -1
- package/dist-cjs/link/Link.css.js +1 -1
- package/dist-cjs/link/Link.js +3 -0
- package/dist-cjs/link/Link.js.map +1 -1
- package/dist-cjs/link-card/LinkCard.css.js +1 -1
- package/dist-cjs/option/Option.js +5 -12
- package/dist-cjs/option/Option.js.map +1 -1
- package/dist-cjs/overlay/OverlayHeader.css.js +6 -0
- package/dist-cjs/overlay/OverlayHeader.css.js.map +1 -0
- package/dist-cjs/overlay/OverlayHeader.js +40 -0
- package/dist-cjs/overlay/OverlayHeader.js.map +1 -0
- package/dist-cjs/overlay/OverlayPanelCloseButton.css.js +1 -1
- package/dist-cjs/overlay/OverlayPanelContent.css.js +1 -1
- package/dist-cjs/overlay/OverlayPanelContent.js +26 -26
- package/dist-cjs/overlay/OverlayPanelContent.js.map +1 -1
- package/dist-cjs/pagination/PageButton.css.js +1 -1
- package/dist-cjs/pagination/PageButton.js +2 -3
- package/dist-cjs/pagination/PageButton.js.map +1 -1
- package/dist-cjs/pagination/Paginator.css.js +1 -1
- package/dist-cjs/pill-input/PillInput.css.js +1 -1
- package/dist-cjs/pill-input/PillInput.js +1 -0
- package/dist-cjs/pill-input/PillInput.js.map +1 -1
- package/dist-cjs/skip-link/SkipLink.css.js +1 -1
- package/dist-cjs/text/Text.css.js +1 -1
- package/dist-cjs/utils/useFloatingUI/useFloatingUI.js +3 -0
- package/dist-cjs/utils/useFloatingUI/useFloatingUI.js.map +1 -1
- package/dist-cjs/utils/usePreventScroll.js +233 -0
- package/dist-cjs/utils/usePreventScroll.js.map +1 -0
- package/dist-es/accordion/AccordionHeader.css.js +1 -1
- package/dist-es/border-layout/BorderLayout.js +2 -2
- package/dist-es/border-layout/BorderLayout.js.map +1 -1
- package/dist-es/button/Button.css.js +1 -1
- package/dist-es/button/Button.js +2 -2
- package/dist-es/button/Button.js.map +1 -1
- package/dist-es/card/Card.css.js +1 -1
- package/dist-es/card/Card.js.map +1 -1
- package/dist-es/combo-box/ComboBox.js +23 -21
- package/dist-es/combo-box/ComboBox.js.map +1 -1
- package/dist-es/dialog/Dialog.js +1 -0
- package/dist-es/dialog/Dialog.js.map +1 -1
- package/dist-es/dialog/DialogContent.css.js +1 -1
- package/dist-es/dialog/DialogContent.js +24 -4
- package/dist-es/dialog/DialogContent.js.map +1 -1
- package/dist-es/dialog/DialogHeader.css.js +1 -1
- package/dist-es/dialog/DialogHeader.js +14 -15
- package/dist-es/dialog/DialogHeader.js.map +1 -1
- package/dist-es/dropdown/Dropdown.css.js +1 -1
- package/dist-es/dropdown/Dropdown.js +3 -3
- package/dist-es/dropdown/Dropdown.js.map +1 -1
- package/dist-es/flex-item/FlexItem.js +2 -2
- package/dist-es/flex-item/FlexItem.js.map +1 -1
- package/dist-es/flex-layout/FlexLayout.js +2 -2
- package/dist-es/flex-layout/FlexLayout.js.map +1 -1
- package/dist-es/grid-item/GridItem.js +2 -2
- package/dist-es/grid-item/GridItem.js.map +1 -1
- package/dist-es/grid-layout/GridLayout.js +2 -2
- package/dist-es/grid-layout/GridLayout.js.map +1 -1
- package/dist-es/index.js +1 -0
- package/dist-es/index.js.map +1 -1
- package/dist-es/interactable-card/InteractableCard.css.js +1 -1
- package/dist-es/link/Link.css.js +1 -1
- package/dist-es/link/Link.js +3 -0
- package/dist-es/link/Link.js.map +1 -1
- package/dist-es/link-card/LinkCard.css.js +1 -1
- package/dist-es/option/Option.js +5 -12
- package/dist-es/option/Option.js.map +1 -1
- package/dist-es/overlay/OverlayHeader.css.js +4 -0
- package/dist-es/overlay/OverlayHeader.css.js.map +1 -0
- package/dist-es/overlay/OverlayHeader.js +38 -0
- package/dist-es/overlay/OverlayHeader.js.map +1 -0
- package/dist-es/overlay/OverlayPanelCloseButton.css.js +1 -1
- package/dist-es/overlay/OverlayPanelContent.css.js +1 -1
- package/dist-es/overlay/OverlayPanelContent.js +27 -27
- package/dist-es/overlay/OverlayPanelContent.js.map +1 -1
- package/dist-es/pagination/PageButton.css.js +1 -1
- package/dist-es/pagination/PageButton.js +2 -3
- package/dist-es/pagination/PageButton.js.map +1 -1
- package/dist-es/pagination/Paginator.css.js +1 -1
- package/dist-es/pill-input/PillInput.css.js +1 -1
- package/dist-es/pill-input/PillInput.js +1 -0
- package/dist-es/pill-input/PillInput.js.map +1 -1
- package/dist-es/skip-link/SkipLink.css.js +1 -1
- package/dist-es/text/Text.css.js +1 -1
- package/dist-es/utils/useFloatingUI/useFloatingUI.js +3 -0
- package/dist-es/utils/useFloatingUI/useFloatingUI.js.map +1 -1
- package/dist-es/utils/usePreventScroll.js +231 -0
- package/dist-es/utils/usePreventScroll.js.map +1 -0
- package/dist-types/border-layout/BorderLayout.d.ts +2 -3
- package/dist-types/card/Card.d.ts +1 -1
- package/dist-types/dialog/DialogHeader.d.ts +9 -1
- package/dist-types/link/Link.d.ts +11 -0
- package/dist-types/overlay/OverlayHeader.d.ts +20 -0
- package/dist-types/overlay/index.d.ts +1 -0
- package/dist-types/utils/useFloatingUI/useFloatingUI.d.ts +4 -0
- package/dist-types/utils/usePreventScroll.d.ts +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { createChainedFunction } from './createChainedFunction.js';
|
|
2
|
+
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect.js';
|
|
3
|
+
|
|
4
|
+
const visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
5
|
+
const nonTextInputTypes = /* @__PURE__ */ new Set([
|
|
6
|
+
"checkbox",
|
|
7
|
+
"radio",
|
|
8
|
+
"range",
|
|
9
|
+
"color",
|
|
10
|
+
"file",
|
|
11
|
+
"image",
|
|
12
|
+
"button",
|
|
13
|
+
"submit",
|
|
14
|
+
"reset"
|
|
15
|
+
]);
|
|
16
|
+
let preventScrollCount = 0;
|
|
17
|
+
let restore;
|
|
18
|
+
function usePreventScroll(options = {}) {
|
|
19
|
+
const { isDisabled } = options;
|
|
20
|
+
useIsomorphicLayoutEffect(() => {
|
|
21
|
+
if (isDisabled) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
preventScrollCount++;
|
|
25
|
+
if (preventScrollCount === 1) {
|
|
26
|
+
if (isIOS()) {
|
|
27
|
+
restore = preventScrollMobileSafari();
|
|
28
|
+
} else {
|
|
29
|
+
restore = preventScrollStandard();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return () => {
|
|
33
|
+
preventScrollCount--;
|
|
34
|
+
if (preventScrollCount === 0) {
|
|
35
|
+
restore();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}, [isDisabled]);
|
|
39
|
+
}
|
|
40
|
+
function preventScrollStandard() {
|
|
41
|
+
return createChainedFunction(
|
|
42
|
+
setStyle(
|
|
43
|
+
document.documentElement,
|
|
44
|
+
"paddingRight",
|
|
45
|
+
`${window.innerWidth - document.documentElement.clientWidth}px`
|
|
46
|
+
),
|
|
47
|
+
setStyle(document.documentElement, "overflow", "hidden")
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
function preventScrollMobileSafari() {
|
|
51
|
+
let scrollable;
|
|
52
|
+
let restoreScrollableStyles;
|
|
53
|
+
const onTouchStart = (e) => {
|
|
54
|
+
scrollable = getScrollParent(e.target, true);
|
|
55
|
+
if (scrollable === document.documentElement && scrollable === document.body) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (scrollable instanceof HTMLElement && window.getComputedStyle(scrollable).overscrollBehavior === "auto") {
|
|
59
|
+
restoreScrollableStyles = setStyle(
|
|
60
|
+
scrollable,
|
|
61
|
+
"overscrollBehavior",
|
|
62
|
+
"contain"
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const onTouchMove = (e) => {
|
|
67
|
+
if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (scrollable.scrollHeight === scrollable.clientHeight && scrollable.scrollWidth === scrollable.clientWidth) {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const onTouchEnd = () => {
|
|
76
|
+
if (restoreScrollableStyles) {
|
|
77
|
+
restoreScrollableStyles();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const onFocus = (e) => {
|
|
81
|
+
const target = e.target;
|
|
82
|
+
if (willOpenKeyboard(target)) {
|
|
83
|
+
setupStyles();
|
|
84
|
+
target.style.transform = "translateY(-2000px)";
|
|
85
|
+
requestAnimationFrame(() => {
|
|
86
|
+
target.style.transform = "";
|
|
87
|
+
if (visualViewport) {
|
|
88
|
+
if (visualViewport.height < window.innerHeight) {
|
|
89
|
+
requestAnimationFrame(() => {
|
|
90
|
+
scrollIntoView(target);
|
|
91
|
+
});
|
|
92
|
+
} else {
|
|
93
|
+
visualViewport.addEventListener(
|
|
94
|
+
"resize",
|
|
95
|
+
() => scrollIntoView(target),
|
|
96
|
+
{ once: true }
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
let restoreStyles = null;
|
|
104
|
+
const setupStyles = () => {
|
|
105
|
+
if (restoreStyles) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const onWindowScroll = () => {
|
|
109
|
+
window.scrollTo(0, 0);
|
|
110
|
+
};
|
|
111
|
+
const scrollX = window.pageXOffset;
|
|
112
|
+
const scrollY = window.pageYOffset;
|
|
113
|
+
restoreStyles = createChainedFunction(
|
|
114
|
+
addEvent(window, "scroll", onWindowScroll),
|
|
115
|
+
setStyle(
|
|
116
|
+
document.documentElement,
|
|
117
|
+
"paddingRight",
|
|
118
|
+
`${window.innerWidth - document.documentElement.clientWidth}px`
|
|
119
|
+
),
|
|
120
|
+
setStyle(document.documentElement, "overflow", "hidden"),
|
|
121
|
+
setStyle(document.body, "marginTop", `-${scrollY}px`),
|
|
122
|
+
() => {
|
|
123
|
+
window.scrollTo(scrollX, scrollY);
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
window.scrollTo(0, 0);
|
|
127
|
+
};
|
|
128
|
+
const removeEvents = createChainedFunction(
|
|
129
|
+
addEvent(document, "touchstart", onTouchStart, {
|
|
130
|
+
passive: false,
|
|
131
|
+
capture: true
|
|
132
|
+
}),
|
|
133
|
+
addEvent(document, "touchmove", onTouchMove, {
|
|
134
|
+
passive: false,
|
|
135
|
+
capture: true
|
|
136
|
+
}),
|
|
137
|
+
addEvent(document, "touchend", onTouchEnd, {
|
|
138
|
+
passive: false,
|
|
139
|
+
capture: true
|
|
140
|
+
}),
|
|
141
|
+
addEvent(document, "focus", onFocus, true)
|
|
142
|
+
);
|
|
143
|
+
return () => {
|
|
144
|
+
restoreScrollableStyles == null ? void 0 : restoreScrollableStyles();
|
|
145
|
+
restoreStyles == null ? void 0 : restoreStyles();
|
|
146
|
+
removeEvents();
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function setStyle(element, style, value) {
|
|
150
|
+
const cur = element.style[style];
|
|
151
|
+
element.style[style] = value;
|
|
152
|
+
return () => {
|
|
153
|
+
element.style[style] = cur;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function addEvent(target, event, handler, options) {
|
|
157
|
+
target.addEventListener(event, handler, options);
|
|
158
|
+
return () => {
|
|
159
|
+
target.removeEventListener(event, handler, options);
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function scrollIntoView(target) {
|
|
163
|
+
const root = document.scrollingElement || document.documentElement;
|
|
164
|
+
let nextTarget = target;
|
|
165
|
+
while (nextTarget && nextTarget !== root) {
|
|
166
|
+
const scrollable = getScrollParent(nextTarget);
|
|
167
|
+
if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== nextTarget) {
|
|
168
|
+
const scrollableTop = scrollable.getBoundingClientRect().top;
|
|
169
|
+
const targetTop = nextTarget.getBoundingClientRect().top;
|
|
170
|
+
if (targetTop > scrollableTop + nextTarget.clientHeight) {
|
|
171
|
+
scrollable.scrollTop += targetTop - scrollableTop;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
nextTarget = scrollable.parentElement;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function willOpenKeyboard(target) {
|
|
178
|
+
return target instanceof HTMLInputElement && !nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
|
|
179
|
+
}
|
|
180
|
+
function isScrollable(node, checkForOverflow) {
|
|
181
|
+
if (!node) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
const style = window.getComputedStyle(node);
|
|
185
|
+
let isScrollable2 = /(auto|scroll)/.test(
|
|
186
|
+
style.overflow + style.overflowX + style.overflowY
|
|
187
|
+
);
|
|
188
|
+
if (isScrollable2 && checkForOverflow) {
|
|
189
|
+
isScrollable2 = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;
|
|
190
|
+
}
|
|
191
|
+
return isScrollable2;
|
|
192
|
+
}
|
|
193
|
+
function getScrollParent(node, checkForOverflow) {
|
|
194
|
+
let scrollableNode = node;
|
|
195
|
+
if (isScrollable(scrollableNode, checkForOverflow)) {
|
|
196
|
+
scrollableNode = scrollableNode.parentElement;
|
|
197
|
+
}
|
|
198
|
+
while (scrollableNode && !isScrollable(scrollableNode, checkForOverflow)) {
|
|
199
|
+
scrollableNode = scrollableNode.parentElement;
|
|
200
|
+
}
|
|
201
|
+
return scrollableNode || document.scrollingElement || document.documentElement;
|
|
202
|
+
}
|
|
203
|
+
function testPlatform(re) {
|
|
204
|
+
var _a;
|
|
205
|
+
return typeof window !== "undefined" && window.navigator != null ? re.test(
|
|
206
|
+
// @ts-expect-error userAgentData is only supported in Chrome 90+
|
|
207
|
+
((_a = window.navigator.userAgentData) == null ? void 0 : _a.platform) || window.navigator.platform
|
|
208
|
+
) : false;
|
|
209
|
+
}
|
|
210
|
+
function cached(fn) {
|
|
211
|
+
if (process.env.NODE_ENV === "test") {
|
|
212
|
+
return fn;
|
|
213
|
+
}
|
|
214
|
+
let res = null;
|
|
215
|
+
return () => {
|
|
216
|
+
if (res == null) {
|
|
217
|
+
res = fn();
|
|
218
|
+
}
|
|
219
|
+
return res;
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
const isMac = cached(() => testPlatform(/^Mac/i));
|
|
223
|
+
const isIPhone = cached(() => testPlatform(/^iPhone/i));
|
|
224
|
+
const isIPad = cached(
|
|
225
|
+
() => testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
226
|
+
isMac() && navigator.maxTouchPoints > 1
|
|
227
|
+
);
|
|
228
|
+
const isIOS = cached(() => isIPhone() || isIPad());
|
|
229
|
+
|
|
230
|
+
export { usePreventScroll };
|
|
231
|
+
//# sourceMappingURL=usePreventScroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePreventScroll.js","sources":["../src/utils/usePreventScroll.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/**\n * Taken from https://github.com/adobe/react-spectrum/blob/cc08a8dbc95d3648eee47bc9b8e0ed48448e0da2/packages/%40react-aria/overlays/src/usePreventScroll.ts#L44 but refactored.\n * This hook currently doesn't use `useWindow` because in a desktop environment the main window is only the window they typically want locked.\n * If we need to in the future we can add an option to specify which window should be affected.\n */\n\nimport { createChainedFunction } from \"./createChainedFunction\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\ninterface PreventScrollOptions {\n /** Whether the scroll lock is disabled. */\n isDisabled?: boolean;\n}\n\nconst visualViewport = typeof document !== \"undefined\" && window.visualViewport;\n\n// HTML input types that do not cause the software keyboard to appear.\nconst nonTextInputTypes = new Set([\n \"checkbox\",\n \"radio\",\n \"range\",\n \"color\",\n \"file\",\n \"image\",\n \"button\",\n \"submit\",\n \"reset\",\n]);\n\n// The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position\nlet preventScrollCount = 0;\nlet restore: () => void;\n\n/**\n * Prevents scrolling on the document body on mount, and\n * restores it on unmount. Also ensures that content does not\n * shift due to the scrollbars disappearing.\n */\nexport function usePreventScroll(options: PreventScrollOptions = {}) {\n const { isDisabled } = options;\n\n useIsomorphicLayoutEffect(() => {\n if (isDisabled) {\n return;\n }\n\n preventScrollCount++;\n if (preventScrollCount === 1) {\n if (isIOS()) {\n restore = preventScrollMobileSafari();\n } else {\n restore = preventScrollStandard();\n }\n }\n\n return () => {\n preventScrollCount--;\n if (preventScrollCount === 0) {\n restore();\n }\n };\n }, [isDisabled]);\n}\n\n// For most browsers, all we need to do is set `overflow: hidden` on the root element, and\n// add some padding to prevent the page from shifting when the scrollbar is hidden.\nfunction preventScrollStandard() {\n return createChainedFunction(\n setStyle(\n document.documentElement,\n \"paddingRight\",\n `${window.innerWidth - document.documentElement.clientWidth}px`,\n ),\n setStyle(document.documentElement, \"overflow\", \"hidden\"),\n );\n}\n\n// Mobile Safari is a whole different beast. Even with overflow: hidden,\n// it still scrolls the page in many situations:\n//\n// 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.\n// 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of\n// it, so it becomes scrollable.\n// 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.\n// This may cause even fixed position elements to scroll off the screen.\n// 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always\n// scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.\n//\n// In order to work around these cases, and prevent scrolling without jankiness, we do a few things:\n//\n// 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling\n// on the window.\n// 2. Set `overscroll-behavior: contain` on nested scrollable regions so they do not scroll the page when at\n// the top or bottom. Work around a bug where this does not work when the element does not actually overflow\n// by preventing default in a `touchmove` event.\n// 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.\n// 4. When focusing an input, apply a transform to trick Safari into thinking the input is at the top\n// of the page, which prevents it from scrolling the page. After the input is focused, scroll the element\n// into view ourselves, without scrolling the whole page.\n// 5. Offset the body by the scroll position using a negative margin and scroll to the top. This should appear the\n// same visually, but makes the actual scroll position always zero. This is required to make all of the\n// above work or Safari will still try to scroll the page when focusing an input.\n// 6. As a last resort, handle window scroll events, and scroll back to the top. This can happen when attempting\n// to navigate to an input with the next/previous buttons that's outside a modal.\nfunction preventScrollMobileSafari() {\n let scrollable: Element;\n let restoreScrollableStyles: () => void;\n const onTouchStart = (e: TouchEvent) => {\n // Store the nearest scrollable parent element from the element that the user touched.\n scrollable = getScrollParent(e.target as Element, true);\n if (\n scrollable === document.documentElement &&\n scrollable === document.body\n ) {\n return;\n }\n\n // Prevent scrolling up when at the top and scrolling down when at the bottom\n // of a nested scrollable area, otherwise mobile Safari will start scrolling\n // the window instead.\n if (\n scrollable instanceof HTMLElement &&\n window.getComputedStyle(scrollable).overscrollBehavior === \"auto\"\n ) {\n restoreScrollableStyles = setStyle(\n scrollable,\n \"overscrollBehavior\",\n \"contain\",\n );\n }\n };\n\n const onTouchMove = (e: TouchEvent) => {\n // Prevent scrolling the window.\n if (\n !scrollable ||\n scrollable === document.documentElement ||\n scrollable === document.body\n ) {\n e.preventDefault();\n return;\n }\n\n // overscroll-behavior should prevent scroll chaining, but currently does not\n // if the element doesn't actually overflow. https://bugs.webkit.org/show_bug.cgi?id=243452\n // This checks that both the width and height do not overflow, otherwise we might\n // block horizontal scrolling too. In that case, adding `touch-action: pan-x` to\n // the element will prevent vertical page scrolling. We can't add that automatically\n // because it must be set before the touchstart event.\n if (\n scrollable.scrollHeight === scrollable.clientHeight &&\n scrollable.scrollWidth === scrollable.clientWidth\n ) {\n e.preventDefault();\n }\n };\n\n const onTouchEnd = () => {\n if (restoreScrollableStyles) {\n restoreScrollableStyles();\n }\n };\n\n const onFocus = (e: FocusEvent) => {\n const target = e.target as HTMLElement;\n if (willOpenKeyboard(target)) {\n setupStyles();\n\n // Apply a transform to trick Safari into thinking the input is at the top of the page\n // so it doesn't try to scroll it into view.\n target.style.transform = \"translateY(-2000px)\";\n requestAnimationFrame(() => {\n target.style.transform = \"\";\n\n // This will have prevented the browser from scrolling the focused element into view,\n // so we need to do this ourselves in a way that doesn't cause the whole page to scroll.\n if (visualViewport) {\n if (visualViewport.height < window.innerHeight) {\n // If the keyboard is already visible, do this after one additional frame\n // to wait for the transform to be removed.\n requestAnimationFrame(() => {\n scrollIntoView(target);\n });\n } else {\n // Otherwise, wait for the visual viewport to resize before scrolling so we can\n // measure the correct position to scroll to.\n visualViewport.addEventListener(\n \"resize\",\n () => scrollIntoView(target),\n { once: true },\n );\n }\n }\n });\n }\n };\n\n let restoreStyles: null | (() => void) = null;\n const setupStyles = () => {\n if (restoreStyles) {\n return;\n }\n\n const onWindowScroll = () => {\n // Last resort. If the window scrolled, scroll it back to the top.\n // It should always be at the top because the body will have a negative margin (see below).\n window.scrollTo(0, 0);\n };\n\n // Record the original scroll position so we can restore it.\n // Then apply a negative margin to the body to offset it by the scroll position. This will\n // enable us to scroll the window to the top, which is required for the rest of this to work.\n const scrollX = window.pageXOffset;\n const scrollY = window.pageYOffset;\n\n restoreStyles = createChainedFunction(\n addEvent(window, \"scroll\", onWindowScroll),\n setStyle(\n document.documentElement,\n \"paddingRight\",\n `${window.innerWidth - document.documentElement.clientWidth}px`,\n ),\n setStyle(document.documentElement, \"overflow\", \"hidden\"),\n setStyle(document.body, \"marginTop\", `-${scrollY}px`),\n () => {\n window.scrollTo(scrollX, scrollY);\n },\n );\n\n // Scroll to the top. The negative margin on the body will make this appear the same.\n window.scrollTo(0, 0);\n };\n\n const removeEvents = createChainedFunction(\n addEvent(document, \"touchstart\", onTouchStart, {\n passive: false,\n capture: true,\n }),\n addEvent(document, \"touchmove\", onTouchMove, {\n passive: false,\n capture: true,\n }),\n addEvent(document, \"touchend\", onTouchEnd, {\n passive: false,\n capture: true,\n }),\n addEvent(document, \"focus\", onFocus, true),\n );\n\n return () => {\n // Restore styles and scroll the page back to where it was.\n restoreScrollableStyles?.();\n restoreStyles?.();\n removeEvents();\n };\n}\n\n// Sets a CSS property on an element, and returns a function to revert it to the previous value.\nfunction setStyle(element: HTMLElement, style: string, value: string) {\n const cur = element.style[style as any];\n element.style[style as any] = value;\n\n return () => {\n element.style[style as any] = cur;\n };\n}\n\n// Adds an event listener to an element, and returns a function to remove it.\nfunction addEvent<K extends keyof GlobalEventHandlersEventMap>(\n target: Document | Window,\n event: K,\n handler: (this: Document | Window, ev: GlobalEventHandlersEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions,\n) {\n // internal function, so it's ok to ignore the difficult to fix type error\n // @ts-ignore\n target.addEventListener(event, handler, options);\n return () => {\n // @ts-ignore\n target.removeEventListener(event, handler, options);\n };\n}\n\nfunction scrollIntoView(target: Element) {\n const root = document.scrollingElement || document.documentElement;\n let nextTarget: Element | null = target;\n while (nextTarget && nextTarget !== root) {\n // Find the parent scrollable element and adjust the scroll position if the target is not already in view.\n const scrollable = getScrollParent(nextTarget);\n if (\n scrollable !== document.documentElement &&\n scrollable !== document.body &&\n scrollable !== nextTarget\n ) {\n const scrollableTop = scrollable.getBoundingClientRect().top;\n const targetTop = nextTarget.getBoundingClientRect().top;\n if (targetTop > scrollableTop + nextTarget.clientHeight) {\n scrollable.scrollTop += targetTop - scrollableTop;\n }\n }\n\n nextTarget = scrollable.parentElement;\n }\n}\n\nfunction willOpenKeyboard(target: Element) {\n return (\n (target instanceof HTMLInputElement &&\n !nonTextInputTypes.has(target.type)) ||\n target instanceof HTMLTextAreaElement ||\n (target instanceof HTMLElement && target.isContentEditable)\n );\n}\n\nfunction isScrollable(\n node: Element | null,\n checkForOverflow?: boolean,\n): boolean {\n if (!node) {\n return false;\n }\n const style = window.getComputedStyle(node);\n let isScrollable = /(auto|scroll)/.test(\n style.overflow + style.overflowX + style.overflowY,\n );\n\n if (isScrollable && checkForOverflow) {\n isScrollable =\n node.scrollHeight !== node.clientHeight ||\n node.scrollWidth !== node.clientWidth;\n }\n\n return isScrollable;\n}\n\nfunction getScrollParent(node: Element, checkForOverflow?: boolean): Element {\n let scrollableNode: Element | null = node;\n if (isScrollable(scrollableNode, checkForOverflow)) {\n scrollableNode = scrollableNode.parentElement;\n }\n\n while (scrollableNode && !isScrollable(scrollableNode, checkForOverflow)) {\n scrollableNode = scrollableNode.parentElement;\n }\n\n return (\n scrollableNode || document.scrollingElement || document.documentElement\n );\n}\n\nfunction testPlatform(re: RegExp) {\n return typeof window !== \"undefined\" && window.navigator != null\n ? re.test(\n // @ts-expect-error userAgentData is only supported in Chrome 90+\n window.navigator.userAgentData?.platform || window.navigator.platform,\n )\n : false;\n}\n\nfunction cached(fn: () => boolean) {\n if (process.env.NODE_ENV === \"test\") {\n return fn;\n }\n\n let res: boolean | null = null;\n return () => {\n if (res == null) {\n res = fn();\n }\n return res;\n };\n}\n\nconst isMac = cached(() => testPlatform(/^Mac/i));\n\nconst isIPhone = cached(() => testPlatform(/^iPhone/i));\n\nconst isIPad = cached(\n () =>\n testPlatform(/^iPad/i) ||\n // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.\n (isMac() && navigator.maxTouchPoints > 1),\n);\n\nconst isIOS = cached(() => isIPhone() || isIPad());\n"],"names":["isScrollable"],"mappings":";;;AA0BA,MAAM,cAAiB,GAAA,OAAO,QAAa,KAAA,WAAA,IAAe,MAAO,CAAA,cAAA;AAGjE,MAAM,iBAAA,uBAAwB,GAAI,CAAA;AAAA,EAChC,UAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;A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AQ,MAAO,CAAA,MAAM,QAAS,EAAA,IAAK,QAAQ,CAAA;;;;"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type ElementType, type ReactElement } from "react";
|
|
2
|
-
import type { BorderItemProps } from "../border-item";
|
|
1
|
+
import { type ElementType, type ReactElement, type ReactNode } from "react";
|
|
3
2
|
import { type GridLayoutProps } from "../grid-layout";
|
|
4
3
|
import { type PolymorphicComponentPropWithRef, type ResponsiveProp } from "../utils";
|
|
5
4
|
export declare type BorderLayoutProps<T extends ElementType> = PolymorphicComponentPropWithRef<T, {
|
|
@@ -18,7 +17,7 @@ export declare type BorderLayoutProps<T extends ElementType> = PolymorphicCompon
|
|
|
18
17
|
/**
|
|
19
18
|
* Border item components to be rendered.
|
|
20
19
|
*/
|
|
21
|
-
children:
|
|
20
|
+
children: ReactNode;
|
|
22
21
|
/**
|
|
23
22
|
* Defines the margin around the component. It can be specified as a number (which acts as a multiplier) or a string representing the margin value. Default is `0`.
|
|
24
23
|
*/
|
|
@@ -24,6 +24,6 @@ export interface CardProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
24
24
|
/**
|
|
25
25
|
* Styling variant. Defaults to "primary".
|
|
26
26
|
*/
|
|
27
|
-
variant?: "primary" | "secondary" | "tertiary";
|
|
27
|
+
variant?: "primary" | "secondary" | "tertiary" | "ghost";
|
|
28
28
|
}
|
|
29
29
|
export declare const Card: import("react").ForwardRefExoticComponent<CardProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { type ValidationStatus } from "@salt-ds/core";
|
|
1
2
|
import { type ComponentPropsWithoutRef, type ReactNode } from "react";
|
|
2
|
-
import { type ValidationStatus } from "../status-indicator";
|
|
3
3
|
export interface DialogHeaderProps extends ComponentPropsWithoutRef<"div"> {
|
|
4
4
|
/**
|
|
5
5
|
* The status of the Dialog
|
|
@@ -16,5 +16,13 @@ export interface DialogHeaderProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
16
16
|
* Displays the preheader just above the header
|
|
17
17
|
**/
|
|
18
18
|
preheader?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Description text is displayed just below the header
|
|
21
|
+
**/
|
|
22
|
+
description?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Actions to be displayed in header
|
|
25
|
+
*/
|
|
26
|
+
actions?: ReactNode;
|
|
19
27
|
}
|
|
20
28
|
export declare const DialogHeader: import("react").ForwardRefExoticComponent<DialogHeaderProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -9,11 +9,22 @@ import { type RenderPropsType } from "../utils";
|
|
|
9
9
|
* <LinkExample to="#link">Action</LinkExample>
|
|
10
10
|
*/
|
|
11
11
|
export interface LinkProps extends Omit<ComponentPropsWithoutRef<"a">, "color">, Pick<TextProps<"a">, "maxRows" | "styleAs" | "variant"> {
|
|
12
|
+
/**
|
|
13
|
+
* Icon component displayed for external links. Defaults to `ExternalIcon` from `SemanticIconProvider`.
|
|
14
|
+
*/
|
|
12
15
|
IconComponent?: ComponentType<IconProps> | null;
|
|
13
16
|
/**
|
|
14
17
|
* Render prop to enable customisation of anchor element.
|
|
15
18
|
*/
|
|
16
19
|
render?: RenderPropsType["render"];
|
|
17
20
|
color?: "inherit" | "primary" | "secondary" | "accent";
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* Either "default" or "never".
|
|
24
|
+
* Determines when underline should be applied to the link.
|
|
25
|
+
*
|
|
26
|
+
* @default "default".
|
|
27
|
+
*/
|
|
28
|
+
underline?: "default" | "never";
|
|
18
29
|
}
|
|
19
30
|
export declare const Link: import("react").ForwardRefExoticComponent<LinkProps & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from "react";
|
|
2
|
+
export interface OverlayHeaderProps extends ComponentPropsWithoutRef<"div"> {
|
|
3
|
+
/**
|
|
4
|
+
* Description text is displayed just below the header
|
|
5
|
+
**/
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Actions to be displayed in header
|
|
9
|
+
*/
|
|
10
|
+
actions?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Header text
|
|
13
|
+
*/
|
|
14
|
+
header?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Preheader text is displayed just above the header
|
|
17
|
+
**/
|
|
18
|
+
preheader?: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export declare const OverlayHeader: import("react").ForwardRefExoticComponent<OverlayHeaderProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -21,6 +21,10 @@ export interface FloatingComponentProps extends ComponentPropsWithoutRef<"div">
|
|
|
21
21
|
width?: number;
|
|
22
22
|
height?: number;
|
|
23
23
|
position?: Strategy;
|
|
24
|
+
/**
|
|
25
|
+
* Makes the page unscrollable when the floating component is open.
|
|
26
|
+
*/
|
|
27
|
+
lockScroll?: boolean;
|
|
24
28
|
}
|
|
25
29
|
declare const DefaultFloatingComponent: import("react").ForwardRefExoticComponent<FloatingComponentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
26
30
|
export interface FloatingComponentContextType {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface PreventScrollOptions {
|
|
2
|
+
/** Whether the scroll lock is disabled. */
|
|
3
|
+
isDisabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Prevents scrolling on the document body on mount, and
|
|
7
|
+
* restores it on unmount. Also ensures that content does not
|
|
8
|
+
* shift due to the scrollbars disappearing.
|
|
9
|
+
*/
|
|
10
|
+
export declare function usePreventScroll(options?: PreventScrollOptions): void;
|
|
11
|
+
export {};
|