@vygruppen/spor-react 12.12.1 → 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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vygruppen/spor-react",
3
3
  "type": "module",
4
- "version": "12.12.1",
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/eslint-config": "1.2.3",
72
- "@vygruppen/tsconfig": "0.1.1"
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",
@@ -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
- visibility={value <= minValue ? "hidden" : "visible"}
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={!showZero && value === 0 ? undefined : idProp}
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
- visibility={value >= maxValue ? "hidden" : "visible"}
183
- disabled={disabled}
173
+ disabled={disabled || value >= maxValue}
184
174
  id={value >= maxValue ? undefined : idProp}
185
175
  />
186
176
  </Field>
@@ -77,6 +77,7 @@ export const buttonRecipe = defineRecipe({
77
77
  },
78
78
  floating: {
79
79
  color: "floating.text",
80
+ background: "floating.surface",
80
81
  border: "sm",
81
82
  borderColor: "floating.outline",
82
83
  boxShadow: