@vygruppen/spor-react 12.12.0 → 12.13.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 +12 -12
- package/.turbo/turbo-postinstall.log +1 -1
- package/CHANGELOG.md +16 -0
- package/dist/index.cjs +7 -9
- 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 +7 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/input/Input.tsx +2 -0
- package/src/input/NumericStepper.tsx +4 -14
- 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.0",
|
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",
|
package/src/input/Input.tsx
CHANGED
@@ -65,6 +65,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
65
65
|
helperText,
|
66
66
|
errorText,
|
67
67
|
required,
|
68
|
+
hidden,
|
68
69
|
...props
|
69
70
|
},
|
70
71
|
ref,
|
@@ -78,6 +79,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
78
79
|
invalid={invalid}
|
79
80
|
helperText={helperText}
|
80
81
|
required={required}
|
82
|
+
hidden={hidden}
|
81
83
|
errorText={errorText}
|
82
84
|
id={props.id}
|
83
85
|
label={
|
@@ -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>
|