@vygruppen/spor-react 2.3.3 → 2.4.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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +16 -0
- package/dist/{CountryCodeSelect-WGG2Z3VI.mjs → CountryCodeSelect-5DBHKSF3.mjs} +2 -2
- package/dist/{chunk-QXVLVC2K.mjs → chunk-D5OFVN6X.mjs} +406 -269
- package/dist/index.d.ts +207 -64
- package/dist/index.js +468 -310
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/input/Autosuggest.tsx +102 -0
- package/src/input/Combobox.tsx +105 -0
- package/src/input/FormErrorMessage.tsx +1 -1
- package/src/input/InfoSelect.tsx +12 -8
- package/src/input/ListBox.tsx +169 -80
- package/src/input/NumericStepper.tsx +1 -1
- package/src/input/PhoneNumberInput.tsx +1 -1
- package/src/input/Popover.tsx +39 -32
- package/src/input/index.tsx +3 -1
- package/src/loader/DarkSpinner.tsx +2 -2
- package/src/theme/components/listbox.ts +4 -4
package/src/input/Popover.tsx
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Box } from "@chakra-ui/react";
|
2
|
-
import React, { useRef } from "react";
|
2
|
+
import React, { forwardRef, useRef } from "react";
|
3
3
|
import {
|
4
4
|
AriaPopoverProps,
|
5
5
|
DismissButton,
|
@@ -33,38 +33,45 @@ type PopoverProps = {
|
|
33
33
|
*
|
34
34
|
* Used to render accessible popover content, like a dropdown menu or a card select. Should not be used directly, but as a part of Spor components.
|
35
35
|
*/
|
36
|
-
export const Popover = (
|
37
|
-
|
38
|
-
state,
|
39
|
-
triggerRef,
|
40
|
-
offset = 0,
|
41
|
-
crossOffset = 0,
|
42
|
-
placement = "bottom",
|
43
|
-
}: PopoverProps) => {
|
44
|
-
const popoverRef = useRef<HTMLDivElement>(null);
|
45
|
-
const { popoverProps, underlayProps } = usePopover(
|
36
|
+
export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
37
|
+
(
|
46
38
|
{
|
39
|
+
children,
|
40
|
+
state,
|
47
41
|
triggerRef,
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
placement,
|
42
|
+
offset = 0,
|
43
|
+
crossOffset = 0,
|
44
|
+
placement = "bottom",
|
52
45
|
},
|
53
|
-
|
54
|
-
)
|
46
|
+
ref
|
47
|
+
) => {
|
48
|
+
const internalRef = useRef<HTMLDivElement>(null);
|
49
|
+
const popoverRef = ref ?? (internalRef as any);
|
55
50
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
51
|
+
const { popoverProps, underlayProps } = usePopover(
|
52
|
+
{
|
53
|
+
triggerRef,
|
54
|
+
popoverRef,
|
55
|
+
offset,
|
56
|
+
crossOffset,
|
57
|
+
placement,
|
58
|
+
},
|
59
|
+
state
|
60
|
+
);
|
61
|
+
|
62
|
+
return (
|
63
|
+
<Overlay>
|
64
|
+
<Box {...underlayProps} position="fixed" inset="0" />
|
65
|
+
<Box
|
66
|
+
{...popoverProps}
|
67
|
+
ref={popoverRef}
|
68
|
+
minWidth={triggerRef.current?.clientWidth ?? "auto"}
|
69
|
+
>
|
70
|
+
<DismissButton onDismiss={state.close} />
|
71
|
+
{children}
|
72
|
+
<DismissButton onDismiss={state.close} />
|
73
|
+
</Box>
|
74
|
+
</Overlay>
|
75
|
+
);
|
76
|
+
}
|
77
|
+
);
|
package/src/input/index.tsx
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
export { FormHelperText, InputGroup } from "@chakra-ui/react";
|
2
2
|
export type { InputGroupProps } from "@chakra-ui/react";
|
3
3
|
export * from "./AttachedInputs";
|
4
|
+
export * from "./Autosuggest";
|
4
5
|
export * from "./CardSelect";
|
5
6
|
export * from "./Checkbox";
|
6
7
|
export * from "./CheckboxGroup";
|
7
8
|
export * from "./ChoiceChip";
|
8
|
-
export * from "./
|
9
|
+
export * from "./Combobox";
|
9
10
|
export * from "./FormControl";
|
10
11
|
export * from "./FormErrorMessage";
|
11
12
|
export * from "./FormLabel";
|
@@ -14,6 +15,7 @@ export * from "./Input";
|
|
14
15
|
export * from "./InputElement";
|
15
16
|
export * from "./ListBox";
|
16
17
|
export * from "./NativeSelect";
|
18
|
+
export * from "./NumericStepper";
|
17
19
|
export * from "./PasswordInput";
|
18
20
|
export * from "./PhoneNumberInput";
|
19
21
|
export * from "./Radio";
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { Box, BoxProps, Center } from "@chakra-ui/react";
|
2
1
|
import { spinnerDarkData } from "@vygruppen/spor-loader";
|
3
2
|
import React from "react";
|
3
|
+
import { Box, BoxProps, Center } from "..";
|
4
4
|
import { ClientOnly } from "./ClientOnly";
|
5
5
|
import Lottie from "./Lottie";
|
6
6
|
|
@@ -34,7 +34,7 @@ export const DarkSpinner = ({
|
|
34
34
|
</ClientOnly>
|
35
35
|
</Box>
|
36
36
|
{children && (
|
37
|
-
<Box
|
37
|
+
<Box marginTop={3} fontWeight="bold">
|
38
38
|
{children}
|
39
39
|
</Box>
|
40
40
|
)}
|
@@ -31,19 +31,19 @@ const config = helpers.defineMultiStyleConfig({
|
|
31
31
|
},
|
32
32
|
_focus: {
|
33
33
|
outline: "none",
|
34
|
-
|
34
|
+
backgroundColor: mode("mint", "darkTeal")(props),
|
35
35
|
},
|
36
36
|
_selected: {
|
37
|
-
|
37
|
+
backgroundColor: mode("pine", "pine")(props),
|
38
38
|
color: mode("white", "white")(props),
|
39
39
|
},
|
40
40
|
},
|
41
41
|
label: {},
|
42
42
|
description: {
|
43
43
|
fontSize: ["mobile.xs", "desktop.xs"],
|
44
|
-
color: "dimGrey",
|
44
|
+
color: mode("dimGrey", "silver")(props),
|
45
45
|
"[aria-selected='true'] &": {
|
46
|
-
color: "lightGrey",
|
46
|
+
color: mode("lightGrey", "platinum")(props),
|
47
47
|
},
|
48
48
|
},
|
49
49
|
}),
|