Skip to content

Commit 37273c5

Browse files
devongovettsnowystingerLFDanLuMichael Jordan
authored
NumberField fixes (#1509)
* Fix double border between input and buttons * Fix disabled focus and hover states for stepper buttons * Update stepper disabled state as you type * Adjust behavior of step to match slider and native number input * Allow incrementing/decrementing values that are near the min/max step value * Replace "spin button number field" with just "number field" * Improve focus behavior for stepper buttons * Fix forward delete of plusSign * Fix typing minus sign in some locales * making focused invalid numberfield stay red * Fix issue where we couldn't type a negative number * giving proper padding right to valid/invalid/loadable quiet textfields moved the styles so they are more specific than the isQuiet padding right styles * fixing numberfield quiet mobile stepper button active styles * Implement fallback support for reverting invalid composition events For browsers that don't support input events level 2 * Fix typing symbols from non-default numbering systems e.g. latin decimal point in arabic * Support normal negative numbers in accounting format * Remove horizontal scrolling as an incr/decr method * fix react 17 * Make active state go around full component rather than just input on touch * Set inputMode according to the OS * Fix sign display polyfill with number parser in Safari * Numberfield fixes: remove aria-roledescription on iOS and replace hyphen with minus sign (#1517) * Slight cleanup and add comment about minus sign Co-authored-by: Rob Snow <[email protected]> Co-authored-by: Daniel <[email protected]> Co-authored-by: Michael Jordan <[email protected]>
1 parent 3706c6a commit 37273c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+719
-459
lines changed

packages/@adobe/spectrum-css-temp/components/stepper/index.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ governing permissions and limitations under the License.
103103
border-end-end-radius: var(--spectrum-stepper-border-radius-reset);
104104
}
105105

106+
.spectrum-Stepper-button {
107+
border-inline-start-style: none;
108+
}
109+
106110
&.spectrum-Stepper--isMobile {
107111
grid-template-rows: auto;
108112
grid-template-columns: auto 1fr auto;
@@ -114,8 +118,7 @@ governing permissions and limitations under the License.
114118
border-end-start-radius: var(--spectrum-stepper-border-radius-reset);
115119
border-end-end-radius: var(--spectrum-stepper-border-radius-reset);
116120
}
117-
.spectrum-Stepper-button--stepUp,
118-
.spectrum-Stepper-button--stepDown {
121+
.spectrum-Stepper-button {
119122
block-size: var(--spectrum-textfield-height);
120123
inline-size: var(--spectrum-actionbutton-min-width);
121124
border-block-start-style: solid;
@@ -128,6 +131,8 @@ governing permissions and limitations under the License.
128131
border-end-end-radius: var(--spectrum-border-radius);
129132
}
130133
.spectrum-Stepper-button--stepDown {
134+
border-inline-start-style: solid;
135+
border-inline-end-style: none;
131136
border-start-start-radius: var(--spectrum-border-radius);
132137
border-start-end-radius: var(--spectrum-stepper-border-radius-reset);
133138
border-end-start-radius: var(--spectrum-border-radius);

packages/@adobe/spectrum-css-temp/components/stepper/skin.css

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,6 @@ governing permissions and limitations under the License.
4848
}
4949
}
5050
}
51-
.spectrum-Stepper.spectrum-Stepper--isHovered {
52-
.spectrum-Stepper-button {
53-
border-color: var(--spectrum-actionbutton-border-color-hover);
54-
55-
&:disabled,
56-
&.is-disabled {
57-
border-color: var(--spectrum-textfield-border-color-disabled);
58-
}
59-
}
60-
}
6151

6252
.spectrum-Stepper-button.spectrum-Stepper-button--isQuiet {
6353
background-color: unset;
@@ -69,14 +59,23 @@ governing permissions and limitations under the License.
6959
.spectrum-Stepper {
7060
.spectrum-Stepper-button {
7161
border-color: var(--spectrum-textfield-border-color);
62+
}
63+
64+
&.is-hovered {
65+
.spectrum-Stepper-button {
66+
border-color: var(--spectrum-actionbutton-border-color-hover);
67+
}
68+
}
7269

70+
.spectrum-Stepper-button {
7371
&:disabled,
7472
&.is-disabled {
7573
border-color: var(--spectrum-textfield-border-color-disabled);
7674
}
7775
}
7876

79-
&:focus {
77+
&:focus,
78+
&:active {
8079
.spectrum-Stepper-button {
8180
border-color: var(--spectrum-textfield-border-color-key-focus);
8281
}
@@ -106,6 +105,10 @@ governing permissions and limitations under the License.
106105
border-color: var(--spectrum-textfield-border-color-key-focus);
107106
}
108107

108+
.spectrum-Stepper-input {
109+
border-color: var(--spectrum-textfield-border-color-key-focus);
110+
}
111+
109112
&.focus-ring {
110113
&:invalid,
111114
&.is-invalid {
@@ -118,6 +121,10 @@ governing permissions and limitations under the License.
118121
.spectrum-Stepper-button {
119122
border-color: var(--spectrum-textfield-border-color-error);
120123
}
124+
125+
.spectrum-Stepper-input {
126+
border-color: var(--spectrum-textfield-border-color-error);
127+
}
121128
}
122129
}
123130

@@ -226,6 +233,15 @@ governing permissions and limitations under the License.
226233
&.is-disabled {
227234
border-color: var(--spectrum-textfield-quiet-border-color-disabled);
228235
}
236+
237+
&.is-active {
238+
border-color: var(--spectrum-actionbutton-border-color-hover);
239+
color: var(--spectrum-actionbutton-text-color-hover);
240+
241+
.spectrum-Stepper-icon {
242+
fill: var(--spectrum-actionbutton-icon-color-hover);
243+
}
244+
}
229245
}
230246

231247
&:focus {

packages/@adobe/spectrum-css-temp/components/textfield/index.css

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,6 @@ governing permissions and limitations under the License.
155155
box-shadow: none;
156156
}
157157

158-
.spectrum-Textfield--valid & {
159-
padding-inline-end: calc(var(--spectrum-textfield-padding-x) + var(--spectrum-icon-checkmark-medium-width) + var(--spectrum-textfield-icon-margin-left));
160-
}
161-
162-
.spectrum-Textfield--invalid & {
163-
padding-inline-end: calc(var(--spectrum-textfield-padding-x) + var(--spectrum-icon-alert-medium-width) + var(--spectrum-textfield-icon-margin-left));
164-
}
165-
166-
.spectrum-Textfield--loadable & {
167-
padding-inline-end: calc(var(--spectrum-textfield-padding-x) + var(--spectrum-icon-alert-medium-width) + var(--spectrum-textfield-icon-margin-left));
168-
}
169-
170158
.spectrum-Textfield--multiline & {
171159
height: var(--spectrum-textfield-multiline-height);
172160
min-height: var(--spectrum-textfield-multiline-min-height);
@@ -188,6 +176,18 @@ governing permissions and limitations under the License.
188176
resize: none;
189177
overflow-y: hidden;
190178
}
179+
180+
.spectrum-Textfield--valid & {
181+
padding-inline-end: calc(var(--spectrum-textfield-padding-x) + var(--spectrum-icon-checkmark-medium-width) + var(--spectrum-textfield-icon-margin-left));
182+
}
183+
184+
.spectrum-Textfield--invalid & {
185+
padding-inline-end: calc(var(--spectrum-textfield-padding-x) + var(--spectrum-icon-alert-medium-width) + var(--spectrum-textfield-icon-margin-left));
186+
}
187+
188+
.spectrum-Textfield--loadable & {
189+
padding-inline-end: calc(var(--spectrum-textfield-padding-x) + var(--spectrum-icon-alert-medium-width) + var(--spectrum-textfield-icon-margin-left));
190+
}
191191
}
192192

193193
.spectrum-Textfield-validationIcon {

packages/@react-aria/button/src/useButton.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export function useButton(props: AriaButtonProps<ElementType>, ref: RefObject<an
5454
onPressStart,
5555
onPressEnd,
5656
onPressChange,
57+
// @ts-ignore - undocumented
58+
preventFocusOnPress,
5759
// @ts-ignore
5860
onClick: deprecatedOnClick,
5961
href,
@@ -81,6 +83,7 @@ export function useButton(props: AriaButtonProps<ElementType>, ref: RefObject<an
8183
onPressChange,
8284
onPress,
8385
isDisabled,
86+
preventFocusOnPress,
8487
ref
8588
});
8689

@@ -90,14 +93,13 @@ export function useButton(props: AriaButtonProps<ElementType>, ref: RefObject<an
9093

9194
return {
9295
isPressed, // Used to indicate press state for visual
93-
buttonProps: mergeProps(buttonProps, {
96+
buttonProps: mergeProps(additionalProps, buttonProps, {
9497
'aria-haspopup': props['aria-haspopup'],
9598
'aria-expanded': props['aria-expanded'],
9699
'aria-controls': props['aria-controls'],
97100
'aria-pressed': props['aria-pressed'],
98101
disabled: isDisabled,
99102
type,
100-
...(additionalProps || {}),
101103
onClick: (e) => {
102104
if (deprecatedOnClick) {
103105
deprecatedOnClick(e);
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"Decrement": "نقصان",
3-
"Enter a number": "أدخل رقماً",
43
"Increment": "زيادة",
5-
"Spin button number field": "Spin button number field"
4+
"Number field": "Number field"
65
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"Decrement": "Стъпка на намаление",
3-
"Enter a number": "Въведете число",
43
"Increment": "Стъпка на увеличение",
5-
"Spin button number field": "Spin button number field"
4+
"Number field": "Number field"
65
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"Decrement": "Snížení",
3-
"Enter a number": "Zadejte číslo",
43
"Increment": "Zvýšení",
5-
"Spin button number field": "Spin button number field"
4+
"Number field": "Number field"
65
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"Decrement": "Reduktion",
3-
"Enter a number": "Skriv et tal",
43
"Increment": "Forøgelse",
5-
"Spin button number field": "Spin button number field"
4+
"Number field": "Number field"
65
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"Decrement": "Verringern",
3-
"Enter a number": "Zahl eingeben",
43
"Increment": "Erhöhen",
5-
"Spin button number field": "Spin button number field"
4+
"Number field": "Number field"
65
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"Decrement": "Μείωση",
3-
"Enter a number": "Εισαγωγή αριθμού",
43
"Increment": "Προσαύξηση",
5-
"Spin button number field": "Spin button number field"
4+
"Number field": "Number field"
65
}

0 commit comments

Comments
 (0)