@holmdigital/components 1.2.2 → 1.2.4
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/dist/Button/Button.js +3 -3
- package/dist/Button/Button.mjs +1 -1
- package/dist/Dialog/Dialog.js +14 -1
- package/dist/Dialog/Dialog.mjs +1 -1
- package/dist/Modal/Modal.js +14 -1
- package/dist/Modal/Modal.mjs +2 -2
- package/dist/Select/Select.js +2 -2
- package/dist/Select/Select.mjs +1 -1
- package/dist/{chunk-NDYRGXQ6.mjs → chunk-7V2LETZ6.mjs} +3 -3
- package/dist/{chunk-LZ42XDDI.mjs → chunk-HIGQ6URZ.mjs} +14 -1
- package/dist/{chunk-HALLFO25.mjs → chunk-Z4AIS75A.mjs} +1 -1
- package/dist/{chunk-V2JYAFB7.mjs → chunk-ZWBZ6YD3.mjs} +2 -2
- package/dist/index.js +19 -6
- package/dist/index.mjs +11 -11
- package/package.json +3 -1
package/dist/Button/Button.js
CHANGED
|
@@ -70,10 +70,10 @@ var Button = (0, import_react.forwardRef)(
|
|
|
70
70
|
};
|
|
71
71
|
const sizes = {
|
|
72
72
|
small: {
|
|
73
|
-
padding: "0.
|
|
73
|
+
padding: "0.5rem 0.75rem",
|
|
74
74
|
fontSize: "0.875rem",
|
|
75
|
-
minHeight: "
|
|
76
|
-
//
|
|
75
|
+
minHeight: "44px"
|
|
76
|
+
// Touch target safe (EN 301 549 9.2.5.5)
|
|
77
77
|
},
|
|
78
78
|
medium: {
|
|
79
79
|
padding: "0.5rem 1rem",
|
package/dist/Button/Button.mjs
CHANGED
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -47,6 +47,7 @@ var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
|
47
47
|
var Dialog = (0, import_react.forwardRef)(
|
|
48
48
|
({ isOpen, onClose, title, children, variant = "default", description, className, ...props }, ref) => {
|
|
49
49
|
const dialogRef = (0, import_react.useRef)(null);
|
|
50
|
+
const scrollLockRef = (0, import_react.useRef)(false);
|
|
50
51
|
(0, import_react.useImperativeHandle)(ref, () => dialogRef.current);
|
|
51
52
|
(0, import_react.useEffect)(() => {
|
|
52
53
|
const dialog = dialogRef.current;
|
|
@@ -54,14 +55,26 @@ var Dialog = (0, import_react.forwardRef)(
|
|
|
54
55
|
if (isOpen) {
|
|
55
56
|
if (!dialog.open) {
|
|
56
57
|
dialog.showModal();
|
|
57
|
-
|
|
58
|
+
if (!scrollLockRef.current) {
|
|
59
|
+
document.body.style.overflow = "hidden";
|
|
60
|
+
scrollLockRef.current = true;
|
|
61
|
+
}
|
|
58
62
|
}
|
|
59
63
|
} else {
|
|
60
64
|
if (dialog.open) {
|
|
61
65
|
dialog.close();
|
|
66
|
+
}
|
|
67
|
+
if (scrollLockRef.current) {
|
|
62
68
|
document.body.style.overflow = "";
|
|
69
|
+
scrollLockRef.current = false;
|
|
63
70
|
}
|
|
64
71
|
}
|
|
72
|
+
return () => {
|
|
73
|
+
if (scrollLockRef.current) {
|
|
74
|
+
document.body.style.overflow = "";
|
|
75
|
+
scrollLockRef.current = false;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
65
78
|
}, [isOpen]);
|
|
66
79
|
(0, import_react.useEffect)(() => {
|
|
67
80
|
const dialog = dialogRef.current;
|
package/dist/Dialog/Dialog.mjs
CHANGED
package/dist/Modal/Modal.js
CHANGED
|
@@ -50,6 +50,7 @@ var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
|
50
50
|
var Dialog = (0, import_react.forwardRef)(
|
|
51
51
|
({ isOpen, onClose, title, children, variant = "default", description, className, ...props }, ref) => {
|
|
52
52
|
const dialogRef = (0, import_react.useRef)(null);
|
|
53
|
+
const scrollLockRef = (0, import_react.useRef)(false);
|
|
53
54
|
(0, import_react.useImperativeHandle)(ref, () => dialogRef.current);
|
|
54
55
|
(0, import_react.useEffect)(() => {
|
|
55
56
|
const dialog = dialogRef.current;
|
|
@@ -57,14 +58,26 @@ var Dialog = (0, import_react.forwardRef)(
|
|
|
57
58
|
if (isOpen) {
|
|
58
59
|
if (!dialog.open) {
|
|
59
60
|
dialog.showModal();
|
|
60
|
-
|
|
61
|
+
if (!scrollLockRef.current) {
|
|
62
|
+
document.body.style.overflow = "hidden";
|
|
63
|
+
scrollLockRef.current = true;
|
|
64
|
+
}
|
|
61
65
|
}
|
|
62
66
|
} else {
|
|
63
67
|
if (dialog.open) {
|
|
64
68
|
dialog.close();
|
|
69
|
+
}
|
|
70
|
+
if (scrollLockRef.current) {
|
|
65
71
|
document.body.style.overflow = "";
|
|
72
|
+
scrollLockRef.current = false;
|
|
66
73
|
}
|
|
67
74
|
}
|
|
75
|
+
return () => {
|
|
76
|
+
if (scrollLockRef.current) {
|
|
77
|
+
document.body.style.overflow = "";
|
|
78
|
+
scrollLockRef.current = false;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
68
81
|
}, [isOpen]);
|
|
69
82
|
(0, import_react.useEffect)(() => {
|
|
70
83
|
const dialog = dialogRef.current;
|
package/dist/Modal/Modal.mjs
CHANGED
package/dist/Select/Select.js
CHANGED
|
@@ -109,10 +109,10 @@ var SelectTrigger = ({ children, className = "", placeholder = "Select..." }) =>
|
|
|
109
109
|
var SelectContent = ({ children }) => {
|
|
110
110
|
const context = (0, import_react.useContext)(SelectContext);
|
|
111
111
|
(0, import_react.useEffect)(() => {
|
|
112
|
-
if (context
|
|
112
|
+
if (context) {
|
|
113
113
|
context.optionsRef.current = [];
|
|
114
114
|
}
|
|
115
|
-
}, [context?.isOpen]);
|
|
115
|
+
}, [context?.isOpen, children]);
|
|
116
116
|
if (!context || !context.isOpen) return null;
|
|
117
117
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
118
118
|
"div",
|
package/dist/Select/Select.mjs
CHANGED
|
@@ -46,10 +46,10 @@ var Button = forwardRef(
|
|
|
46
46
|
};
|
|
47
47
|
const sizes = {
|
|
48
48
|
small: {
|
|
49
|
-
padding: "0.
|
|
49
|
+
padding: "0.5rem 0.75rem",
|
|
50
50
|
fontSize: "0.875rem",
|
|
51
|
-
minHeight: "
|
|
52
|
-
//
|
|
51
|
+
minHeight: "44px"
|
|
52
|
+
// Touch target safe (EN 301 549 9.2.5.5)
|
|
53
53
|
},
|
|
54
54
|
medium: {
|
|
55
55
|
padding: "0.5rem 1rem",
|
|
@@ -23,6 +23,7 @@ var CloseIcon = () => /* @__PURE__ */ jsxs(
|
|
|
23
23
|
var Dialog = forwardRef(
|
|
24
24
|
({ isOpen, onClose, title, children, variant = "default", description, className, ...props }, ref) => {
|
|
25
25
|
const dialogRef = useRef(null);
|
|
26
|
+
const scrollLockRef = useRef(false);
|
|
26
27
|
useImperativeHandle(ref, () => dialogRef.current);
|
|
27
28
|
useEffect(() => {
|
|
28
29
|
const dialog = dialogRef.current;
|
|
@@ -30,14 +31,26 @@ var Dialog = forwardRef(
|
|
|
30
31
|
if (isOpen) {
|
|
31
32
|
if (!dialog.open) {
|
|
32
33
|
dialog.showModal();
|
|
33
|
-
|
|
34
|
+
if (!scrollLockRef.current) {
|
|
35
|
+
document.body.style.overflow = "hidden";
|
|
36
|
+
scrollLockRef.current = true;
|
|
37
|
+
}
|
|
34
38
|
}
|
|
35
39
|
} else {
|
|
36
40
|
if (dialog.open) {
|
|
37
41
|
dialog.close();
|
|
42
|
+
}
|
|
43
|
+
if (scrollLockRef.current) {
|
|
38
44
|
document.body.style.overflow = "";
|
|
45
|
+
scrollLockRef.current = false;
|
|
39
46
|
}
|
|
40
47
|
}
|
|
48
|
+
return () => {
|
|
49
|
+
if (scrollLockRef.current) {
|
|
50
|
+
document.body.style.overflow = "";
|
|
51
|
+
scrollLockRef.current = false;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
41
54
|
}, [isOpen]);
|
|
42
55
|
useEffect(() => {
|
|
43
56
|
const dialog = dialogRef.current;
|
|
@@ -82,10 +82,10 @@ var SelectTrigger = ({ children, className = "", placeholder = "Select..." }) =>
|
|
|
82
82
|
var SelectContent = ({ children }) => {
|
|
83
83
|
const context = useContext(SelectContext);
|
|
84
84
|
useEffect(() => {
|
|
85
|
-
if (context
|
|
85
|
+
if (context) {
|
|
86
86
|
context.optionsRef.current = [];
|
|
87
87
|
}
|
|
88
|
-
}, [context?.isOpen]);
|
|
88
|
+
}, [context?.isOpen, children]);
|
|
89
89
|
if (!context || !context.isOpen) return null;
|
|
90
90
|
return /* @__PURE__ */ jsx(
|
|
91
91
|
"div",
|
package/dist/index.js
CHANGED
|
@@ -111,10 +111,10 @@ var Button = (0, import_react.forwardRef)(
|
|
|
111
111
|
};
|
|
112
112
|
const sizes = {
|
|
113
113
|
small: {
|
|
114
|
-
padding: "0.
|
|
114
|
+
padding: "0.5rem 0.75rem",
|
|
115
115
|
fontSize: "0.875rem",
|
|
116
|
-
minHeight: "
|
|
117
|
-
//
|
|
116
|
+
minHeight: "44px"
|
|
117
|
+
// Touch target safe (EN 301 549 9.2.5.5)
|
|
118
118
|
},
|
|
119
119
|
medium: {
|
|
120
120
|
padding: "0.5rem 1rem",
|
|
@@ -261,6 +261,7 @@ var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
|
261
261
|
var Dialog = (0, import_react3.forwardRef)(
|
|
262
262
|
({ isOpen, onClose, title, children, variant = "default", description, className, ...props }, ref) => {
|
|
263
263
|
const dialogRef = (0, import_react3.useRef)(null);
|
|
264
|
+
const scrollLockRef = (0, import_react3.useRef)(false);
|
|
264
265
|
(0, import_react3.useImperativeHandle)(ref, () => dialogRef.current);
|
|
265
266
|
(0, import_react3.useEffect)(() => {
|
|
266
267
|
const dialog = dialogRef.current;
|
|
@@ -268,14 +269,26 @@ var Dialog = (0, import_react3.forwardRef)(
|
|
|
268
269
|
if (isOpen) {
|
|
269
270
|
if (!dialog.open) {
|
|
270
271
|
dialog.showModal();
|
|
271
|
-
|
|
272
|
+
if (!scrollLockRef.current) {
|
|
273
|
+
document.body.style.overflow = "hidden";
|
|
274
|
+
scrollLockRef.current = true;
|
|
275
|
+
}
|
|
272
276
|
}
|
|
273
277
|
} else {
|
|
274
278
|
if (dialog.open) {
|
|
275
279
|
dialog.close();
|
|
280
|
+
}
|
|
281
|
+
if (scrollLockRef.current) {
|
|
276
282
|
document.body.style.overflow = "";
|
|
283
|
+
scrollLockRef.current = false;
|
|
277
284
|
}
|
|
278
285
|
}
|
|
286
|
+
return () => {
|
|
287
|
+
if (scrollLockRef.current) {
|
|
288
|
+
document.body.style.overflow = "";
|
|
289
|
+
scrollLockRef.current = false;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
279
292
|
}, [isOpen]);
|
|
280
293
|
(0, import_react3.useEffect)(() => {
|
|
281
294
|
const dialog = dialogRef.current;
|
|
@@ -944,10 +957,10 @@ var SelectTrigger = ({ children, className = "", placeholder = "Select..." }) =>
|
|
|
944
957
|
var SelectContent = ({ children }) => {
|
|
945
958
|
const context = (0, import_react12.useContext)(SelectContext);
|
|
946
959
|
(0, import_react12.useEffect)(() => {
|
|
947
|
-
if (context
|
|
960
|
+
if (context) {
|
|
948
961
|
context.optionsRef.current = [];
|
|
949
962
|
}
|
|
950
|
-
}, [context?.isOpen]);
|
|
963
|
+
}, [context?.isOpen, children]);
|
|
951
964
|
if (!context || !context.isOpen) return null;
|
|
952
965
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
953
966
|
"div",
|
package/dist/index.mjs
CHANGED
|
@@ -6,41 +6,41 @@ import {
|
|
|
6
6
|
SelectContent,
|
|
7
7
|
SelectItem,
|
|
8
8
|
SelectTrigger
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZWBZ6YD3.mjs";
|
|
10
10
|
import {
|
|
11
11
|
SkipLink
|
|
12
12
|
} from "./chunk-MKKQLWGK.mjs";
|
|
13
13
|
import {
|
|
14
14
|
Switch
|
|
15
15
|
} from "./chunk-5RKBS475.mjs";
|
|
16
|
+
import {
|
|
17
|
+
ToastProvider,
|
|
18
|
+
useToast
|
|
19
|
+
} from "./chunk-2MJRKHPL.mjs";
|
|
16
20
|
import {
|
|
17
21
|
Tooltip,
|
|
18
22
|
TooltipContent,
|
|
19
23
|
TooltipProvider,
|
|
20
24
|
TooltipTrigger
|
|
21
25
|
} from "./chunk-C5M6C7KT.mjs";
|
|
22
|
-
import {
|
|
23
|
-
ToastProvider,
|
|
24
|
-
useToast
|
|
25
|
-
} from "./chunk-2MJRKHPL.mjs";
|
|
26
26
|
import {
|
|
27
27
|
Button
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import {
|
|
30
|
-
Checkbox
|
|
31
|
-
} from "./chunk-NOE5QKC2.mjs";
|
|
28
|
+
} from "./chunk-7V2LETZ6.mjs";
|
|
32
29
|
import {
|
|
33
30
|
FormField
|
|
34
31
|
} from "./chunk-PLT5CAFO.mjs";
|
|
32
|
+
import {
|
|
33
|
+
Checkbox
|
|
34
|
+
} from "./chunk-NOE5QKC2.mjs";
|
|
35
35
|
import {
|
|
36
36
|
Heading
|
|
37
37
|
} from "./chunk-2RP6SWY7.mjs";
|
|
38
38
|
import {
|
|
39
39
|
Modal
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-Z4AIS75A.mjs";
|
|
41
41
|
import {
|
|
42
42
|
Dialog
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-HIGQ6URZ.mjs";
|
|
44
44
|
import {
|
|
45
45
|
NavigationMenu
|
|
46
46
|
} from "./chunk-GK4BYT56.mjs";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holmdigital/components",
|
|
3
3
|
"author": "Holm Digital AB",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.4",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public",
|
|
@@ -83,6 +83,8 @@
|
|
|
83
83
|
"build": "tsup src/index.ts src/Button/Button.tsx src/FormField/FormField.tsx src/Dialog/Dialog.tsx src/Modal/Modal.tsx src/SkipLink/SkipLink.tsx src/NavigationMenu/NavigationMenu.tsx src/Checkbox/Checkbox.tsx src/RadioGroup/RadioGroup.tsx src/Select/Select.tsx src/Switch/Switch.tsx src/Toast/Toast.tsx src/Tooltip/Tooltip.tsx src/Heading/Heading.tsx --format cjs,esm --dts --clean --external react",
|
|
84
84
|
"dev": "tsup src/index.ts src/Button/Button.tsx src/FormField/FormField.tsx src/Dialog/Dialog.tsx src/Modal/Modal.tsx src/SkipLink/SkipLink.tsx src/NavigationMenu/NavigationMenu.tsx src/Checkbox/Checkbox.tsx src/RadioGroup/RadioGroup.tsx src/Select/Select.tsx src/Switch/Switch.tsx src/Toast/Toast.tsx src/Tooltip/Tooltip.tsx src/Heading/Heading.tsx --format cjs,esm --dts --watch --external react",
|
|
85
85
|
"lint": "eslint src --ext .ts,.tsx",
|
|
86
|
+
"test": "vitest",
|
|
87
|
+
"test:ci": "vitest run",
|
|
86
88
|
"storybook": "storybook dev -p 6006",
|
|
87
89
|
"build-storybook": "storybook build"
|
|
88
90
|
},
|