@vygruppen/spor-react 12.12.1 → 12.13.1
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/.turbo/turbo-postinstall.log +1 -1
- package/CHANGELOG.md +18 -0
- package/dist/index.cjs +13 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -4
- package/dist/index.d.ts +1 -4
- package/dist/index.mjs +12 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/input/CountryCodeSelect.tsx +1 -1
- package/src/input/NumericStepper.tsx +4 -14
- package/src/input/Popover.tsx +8 -1
- package/src/theme/recipes/button.ts +1 -0
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vygruppen/spor-react",
|
3
3
|
"type": "module",
|
4
|
-
"version": "12.
|
4
|
+
"version": "12.13.1",
|
5
5
|
"exports": {
|
6
6
|
".": {
|
7
7
|
"types": "./dist/index.d.ts",
|
@@ -68,8 +68,8 @@
|
|
68
68
|
"vitest": "^0.26.3",
|
69
69
|
"vitest-axe": "^0.1.0",
|
70
70
|
"vitest-canvas-mock": "^0.2.2",
|
71
|
-
"@vygruppen/
|
72
|
-
"@vygruppen/
|
71
|
+
"@vygruppen/tsconfig": "0.1.1",
|
72
|
+
"@vygruppen/eslint-config": "1.2.3"
|
73
73
|
},
|
74
74
|
"peerDependencies": {
|
75
75
|
"react": ">=18.0.0 <19.0.0",
|
@@ -58,7 +58,7 @@ export const CountryCodeSelect = forwardRef<
|
|
58
58
|
sideRadiusVariant={"rightSideSquare"}
|
59
59
|
>
|
60
60
|
{callingCodes.items.map((code) => (
|
61
|
-
<SelectItem
|
61
|
+
<SelectItem key={code.label} item={code}>
|
62
62
|
{code.label}
|
63
63
|
</SelectItem>
|
64
64
|
))}
|
@@ -35,8 +35,6 @@ export type NumericStepperProps = FieldBaseProps &
|
|
35
35
|
withInput?: boolean;
|
36
36
|
/** The amount to increase/decrease when pressing +/- */
|
37
37
|
stepSize?: number;
|
38
|
-
/** Whether to show the number input when value is zero */
|
39
|
-
showZero?: boolean;
|
40
38
|
/** Name added to the aria-label of subtract and add buttons. */
|
41
39
|
ariaLabelContext?: { singular: string; plural: string };
|
42
40
|
} & Omit<BoxProps, "onChange">;
|
@@ -80,7 +78,6 @@ export const NumericStepper = React.forwardRef<
|
|
80
78
|
disabled,
|
81
79
|
withInput = true,
|
82
80
|
stepSize = 1,
|
83
|
-
showZero = false,
|
84
81
|
ariaLabelContext = { singular: "", plural: "" },
|
85
82
|
...rest
|
86
83
|
} = props;
|
@@ -118,8 +115,7 @@ export const NumericStepper = React.forwardRef<
|
|
118
115
|
focusOnAddButton();
|
119
116
|
}
|
120
117
|
}}
|
121
|
-
|
122
|
-
disabled={disabled}
|
118
|
+
disabled={disabled || value <= minValue}
|
123
119
|
id={value <= minValue ? undefined : idProp}
|
124
120
|
/>
|
125
121
|
{withInput ? (
|
@@ -129,10 +125,9 @@ export const NumericStepper = React.forwardRef<
|
|
129
125
|
name={nameProp}
|
130
126
|
value={value}
|
131
127
|
disabled={disabled}
|
132
|
-
id={
|
128
|
+
id={value === 0 ? undefined : idProp}
|
133
129
|
css={styles.input}
|
134
130
|
width={`${Math.max(value.toString().length + 1, 3)}ch`}
|
135
|
-
visibility={!showZero && value === 0 ? "hidden" : "visible"}
|
136
131
|
aria-live="assertive"
|
137
132
|
aria-label={
|
138
133
|
ariaLabelContext.plural === ""
|
@@ -145,17 +140,13 @@ export const NumericStepper = React.forwardRef<
|
|
145
140
|
return;
|
146
141
|
}
|
147
142
|
onChange(Math.max(Math.min(numericInput, maxValue), minValue));
|
148
|
-
if (
|
149
|
-
!showZero &&
|
150
|
-
Math.max(Math.min(numericInput, maxValue), minValue) === 0
|
151
|
-
) {
|
143
|
+
if (Math.max(Math.min(numericInput, maxValue), minValue) === 0) {
|
152
144
|
focusOnAddButton();
|
153
145
|
}
|
154
146
|
}}
|
155
147
|
/>
|
156
148
|
) : (
|
157
149
|
<Text
|
158
|
-
visibility={!showZero && value === 0 ? "hidden" : "visible"}
|
159
150
|
aria-live="assertive"
|
160
151
|
paddingX="0.95rem"
|
161
152
|
aria-label={
|
@@ -179,8 +170,7 @@ export const NumericStepper = React.forwardRef<
|
|
179
170
|
),
|
180
171
|
)}
|
181
172
|
onClick={() => onChange(Math.min(value + clampedStepSize, maxValue))}
|
182
|
-
|
183
|
-
disabled={disabled}
|
173
|
+
disabled={disabled || value >= maxValue}
|
184
174
|
id={value >= maxValue ? undefined : idProp}
|
185
175
|
/>
|
186
176
|
</Field>
|
package/src/input/Popover.tsx
CHANGED
@@ -7,6 +7,7 @@ import {
|
|
7
7
|
Overlay,
|
8
8
|
usePopover,
|
9
9
|
} from "react-aria";
|
10
|
+
import ReactDOM from "react-dom";
|
10
11
|
import { OverlayTriggerState } from "react-stately";
|
11
12
|
|
12
13
|
type PopoverProps = {
|
@@ -54,7 +55,7 @@ type PopoverProps = {
|
|
54
55
|
/**
|
55
56
|
* Internal popover component.
|
56
57
|
*
|
57
|
-
* Used to render accessible popover content,
|
58
|
+
* Used to render accessible popover content, only used in ComboBox.
|
58
59
|
*/
|
59
60
|
export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
60
61
|
(
|
@@ -95,6 +96,8 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
95
96
|
{...popoverProps}
|
96
97
|
ref={popoverRef}
|
97
98
|
minWidth={triggerRef.current?.clientWidth ?? "auto"}
|
99
|
+
position="absolute"
|
100
|
+
zIndex={1400}
|
98
101
|
>
|
99
102
|
<DismissButton onDismiss={state.close} />
|
100
103
|
{children}
|
@@ -103,6 +106,10 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
103
106
|
);
|
104
107
|
|
105
108
|
if (isNonModal) {
|
109
|
+
// Render in a portal to ensure it does not take up semantic space
|
110
|
+
if (globalThis.window !== undefined && typeof document !== "undefined") {
|
111
|
+
return ReactDOM.createPortal(popoverBox, document.body);
|
112
|
+
}
|
106
113
|
return popoverBox;
|
107
114
|
}
|
108
115
|
return (
|