@instructure/ui-number-input 11.6.0 → 11.6.1-snapshot-129
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/CHANGELOG.md +40 -299
- package/es/NumberInput/{index.js → v1/index.js} +2 -2
- package/es/NumberInput/v2/index.js +292 -0
- package/es/NumberInput/v2/props.js +26 -0
- package/es/NumberInput/v2/styles.js +208 -0
- package/es/{index.js → exports/a.js} +1 -1
- package/{src/index.ts → es/exports/b.js} +1 -2
- package/lib/NumberInput/{index.js → v1/index.js} +7 -7
- package/lib/NumberInput/v2/index.js +301 -0
- package/lib/NumberInput/v2/props.js +31 -0
- package/lib/NumberInput/v2/styles.js +214 -0
- package/lib/{index.js → exports/a.js} +2 -2
- package/lib/exports/b.js +12 -0
- package/package.json +41 -19
- package/src/NumberInput/{index.tsx → v1/index.tsx} +2 -2
- package/src/NumberInput/{props.ts → v1/props.ts} +4 -1
- package/src/NumberInput/v2/README.md +205 -0
- package/src/NumberInput/v2/index.tsx +382 -0
- package/src/NumberInput/v2/props.ts +240 -0
- package/src/NumberInput/v2/styles.ts +219 -0
- package/src/exports/a.ts +25 -0
- package/src/exports/b.ts +25 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/NumberInput/{index.d.ts → v1/index.d.ts} +1 -1
- package/types/NumberInput/v1/index.d.ts.map +1 -0
- package/types/NumberInput/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/NumberInput/v1/props.d.ts.map +1 -0
- package/types/NumberInput/v1/styles.d.ts.map +1 -0
- package/types/NumberInput/v1/theme.d.ts.map +1 -0
- package/types/NumberInput/v2/index.d.ts +104 -0
- package/types/NumberInput/v2/index.d.ts.map +1 -0
- package/types/NumberInput/v2/props.d.ts +127 -0
- package/types/NumberInput/v2/props.d.ts.map +1 -0
- package/types/NumberInput/v2/styles.d.ts +22 -0
- package/types/NumberInput/v2/styles.d.ts.map +1 -0
- package/types/exports/a.d.ts +3 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +3 -0
- package/types/exports/b.d.ts.map +1 -0
- package/types/NumberInput/index.d.ts.map +0 -1
- package/types/NumberInput/props.d.ts.map +0 -1
- package/types/NumberInput/styles.d.ts.map +0 -1
- package/types/NumberInput/theme.d.ts.map +0 -1
- package/types/index.d.ts +0 -3
- package/types/index.d.ts.map +0 -1
- /package/es/NumberInput/{props.js → v1/props.js} +0 -0
- /package/es/NumberInput/{styles.js → v1/styles.js} +0 -0
- /package/es/NumberInput/{theme.js → v1/theme.js} +0 -0
- /package/lib/NumberInput/{props.js → v1/props.js} +0 -0
- /package/lib/NumberInput/{styles.js → v1/styles.js} +0 -0
- /package/lib/NumberInput/{theme.js → v1/theme.js} +0 -0
- /package/src/NumberInput/{README.md → v1/README.md} +0 -0
- /package/src/NumberInput/{styles.ts → v1/styles.ts} +0 -0
- /package/src/NumberInput/{theme.ts → v1/theme.ts} +0 -0
- /package/types/NumberInput/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/NumberInput/{theme.d.ts → v1/theme.d.ts} +0 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import React from 'react'
|
|
26
|
+
import type { InputHTMLAttributes } from 'react'
|
|
27
|
+
|
|
28
|
+
import type {
|
|
29
|
+
OtherHTMLAttributes,
|
|
30
|
+
PickPropsWithExceptions
|
|
31
|
+
} from '@instructure/shared-types'
|
|
32
|
+
import type {
|
|
33
|
+
ComponentStyle,
|
|
34
|
+
Spacing,
|
|
35
|
+
ThemeOverrideValue
|
|
36
|
+
} from '@instructure/emotion'
|
|
37
|
+
import type {
|
|
38
|
+
FormFieldOwnProps,
|
|
39
|
+
FormMessage
|
|
40
|
+
} from '@instructure/ui-form-field/latest'
|
|
41
|
+
import type {
|
|
42
|
+
InteractionType,
|
|
43
|
+
WithDeterministicIdProps
|
|
44
|
+
} from '@instructure/ui-react-utils'
|
|
45
|
+
import { Renderable } from '@instructure/shared-types'
|
|
46
|
+
|
|
47
|
+
type NumberInputOwnProps = {
|
|
48
|
+
/**
|
|
49
|
+
* The form field label.
|
|
50
|
+
*/
|
|
51
|
+
renderLabel: Renderable
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The id of the input. One is generated if not supplied.
|
|
55
|
+
*/
|
|
56
|
+
id?: string
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Specifies if interaction with the input is enabled, disabled, or readonly.
|
|
60
|
+
* When "disabled", the input changes visibly to indicate that it cannot
|
|
61
|
+
* receive user interactions. When "readonly" the input still cannot receive
|
|
62
|
+
* user interactions but it keeps the same styles as if it were enabled.
|
|
63
|
+
*/
|
|
64
|
+
interaction?: InteractionType
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Array of objects with shape: `{
|
|
68
|
+
* text: ReactNode,
|
|
69
|
+
* type: One of: ['newError', 'error', 'hint', 'success', 'screenreader-only']
|
|
70
|
+
* }`
|
|
71
|
+
*/
|
|
72
|
+
messages?: FormMessage[]
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* HTML placeholder text to display when the input has no value. This
|
|
76
|
+
* should be hint text, not a label replacement.
|
|
77
|
+
* Not visible when `disabled` or `readonly`
|
|
78
|
+
*/
|
|
79
|
+
placeholder?: string
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Whether or not the text input is required.
|
|
83
|
+
*/
|
|
84
|
+
isRequired?: boolean
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Whether or not to display the up/down arrow buttons.
|
|
88
|
+
* They are not visible when `readonly`
|
|
89
|
+
*/
|
|
90
|
+
showArrows?: boolean
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The size of the input.
|
|
94
|
+
*/
|
|
95
|
+
size?: 'medium' | 'large'
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The value of the input (should be accompanied by an `onChange` prop).
|
|
99
|
+
*/
|
|
100
|
+
value?: string | number
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The width of the input.
|
|
104
|
+
*/
|
|
105
|
+
width?: string
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The display of the root element.
|
|
109
|
+
*/
|
|
110
|
+
display?: 'inline-block' | 'block'
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* A function that provides a reference to the actual input element.
|
|
114
|
+
*/
|
|
115
|
+
inputRef?: (element: HTMLInputElement | null) => void
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Callback fired when input receives focus.
|
|
119
|
+
*/
|
|
120
|
+
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Callback fired when the input loses focus.
|
|
124
|
+
*/
|
|
125
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Callback executed when the input fires a change event.
|
|
129
|
+
* @param {Object} event - the event object
|
|
130
|
+
* @param {string} value - the string value of the input
|
|
131
|
+
*/
|
|
132
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: string) => void
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Called when the down arrow button is clicked, or the down arrow key is
|
|
136
|
+
* pressed.
|
|
137
|
+
*/
|
|
138
|
+
onDecrement?: (
|
|
139
|
+
event:
|
|
140
|
+
| React.KeyboardEvent<HTMLInputElement>
|
|
141
|
+
| React.MouseEvent<HTMLButtonElement>
|
|
142
|
+
) => void
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Called when the up arrow button is clicked, or the up arrow key is
|
|
146
|
+
* pressed.
|
|
147
|
+
*/
|
|
148
|
+
onIncrement?: (
|
|
149
|
+
event:
|
|
150
|
+
| React.KeyboardEvent<HTMLInputElement>
|
|
151
|
+
| React.MouseEvent<HTMLButtonElement>
|
|
152
|
+
) => void
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Callback fired when a key is pressed.
|
|
156
|
+
*/
|
|
157
|
+
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The inputMode attribute of the underlying `input` element can be one of ['numeric', 'decimal', 'tel']
|
|
161
|
+
*/
|
|
162
|
+
inputMode?: 'numeric' | 'decimal' | 'tel'
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* The text alignment of the input.
|
|
166
|
+
*/
|
|
167
|
+
textAlign?: 'start' | 'center'
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* sets the input type to string and allows string as value
|
|
171
|
+
*/
|
|
172
|
+
allowStringValue?: boolean
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Sets the icons to be rendered for increase and decrease buttons
|
|
176
|
+
*/
|
|
177
|
+
renderIcons?: {
|
|
178
|
+
increase: Renderable
|
|
179
|
+
decrease: Renderable
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Margin around the component. Accepts a `Spacing` token. See token values and example usage in [this guide](https://instructure.design/#layout-spacing).
|
|
183
|
+
*/
|
|
184
|
+
margin?: Spacing
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
type PropKeys = keyof NumberInputOwnProps
|
|
188
|
+
|
|
189
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
190
|
+
|
|
191
|
+
type NumberInputProps =
|
|
192
|
+
// pickProps passes through FormField.allowedProps, except the ones set manually
|
|
193
|
+
PickPropsWithExceptions<
|
|
194
|
+
FormFieldOwnProps,
|
|
195
|
+
'label' | 'inline' | 'id' | 'elementRef'
|
|
196
|
+
> &
|
|
197
|
+
NumberInputOwnProps & {
|
|
198
|
+
themeOverride?: ThemeOverrideValue
|
|
199
|
+
} & OtherHTMLAttributes<
|
|
200
|
+
NumberInputOwnProps,
|
|
201
|
+
InputHTMLAttributes<NumberInputOwnProps & Element>
|
|
202
|
+
> &
|
|
203
|
+
WithDeterministicIdProps
|
|
204
|
+
|
|
205
|
+
type NumberInputStyle = ComponentStyle<
|
|
206
|
+
| 'numberInput'
|
|
207
|
+
| 'arrowContainer'
|
|
208
|
+
| 'arrow'
|
|
209
|
+
| 'inputWidth'
|
|
210
|
+
| 'inputContainer'
|
|
211
|
+
| 'input'
|
|
212
|
+
>
|
|
213
|
+
const allowedProps: AllowedPropKeys = [
|
|
214
|
+
'renderLabel',
|
|
215
|
+
'id',
|
|
216
|
+
'interaction',
|
|
217
|
+
'messages',
|
|
218
|
+
'placeholder',
|
|
219
|
+
'isRequired',
|
|
220
|
+
'showArrows',
|
|
221
|
+
'size',
|
|
222
|
+
'value',
|
|
223
|
+
'width',
|
|
224
|
+
'display',
|
|
225
|
+
'inputRef',
|
|
226
|
+
'onFocus',
|
|
227
|
+
'onBlur',
|
|
228
|
+
'onChange',
|
|
229
|
+
'onDecrement',
|
|
230
|
+
'onIncrement',
|
|
231
|
+
'onKeyDown',
|
|
232
|
+
'inputMode',
|
|
233
|
+
'textAlign',
|
|
234
|
+
'allowStringValue',
|
|
235
|
+
'renderIcons',
|
|
236
|
+
'margin'
|
|
237
|
+
]
|
|
238
|
+
|
|
239
|
+
export type { NumberInputProps, NumberInputStyle }
|
|
240
|
+
export { allowedProps }
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import type { NumberInputProps, NumberInputStyle } from './props'
|
|
26
|
+
import type { NewComponentTypes, SharedTokens } from '@instructure/ui-themes'
|
|
27
|
+
import { calcFocusOutlineStyles } from '@instructure/emotion'
|
|
28
|
+
|
|
29
|
+
type StyleParams = {
|
|
30
|
+
size: NumberInputProps['size']
|
|
31
|
+
textAlign: NumberInputProps['textAlign']
|
|
32
|
+
interaction: NumberInputProps['interaction']
|
|
33
|
+
invalid: boolean
|
|
34
|
+
success: boolean
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* ---
|
|
39
|
+
* private: true
|
|
40
|
+
* ---
|
|
41
|
+
* Generates the style object from the theme and provided additional information
|
|
42
|
+
* @param componentTheme The theme variable object.
|
|
43
|
+
* @param params Additional parameters to customize the style.
|
|
44
|
+
* @param sharedTokens Shared token object that stores common values for the theme.
|
|
45
|
+
* @return The final style object, which will be used in the component
|
|
46
|
+
*/
|
|
47
|
+
const generateStyle = (
|
|
48
|
+
componentTheme: NewComponentTypes['TextInput'],
|
|
49
|
+
params: StyleParams,
|
|
50
|
+
sharedTokens: SharedTokens
|
|
51
|
+
): NumberInputStyle => {
|
|
52
|
+
const { size, textAlign, interaction, success, invalid } = params
|
|
53
|
+
|
|
54
|
+
const containerInteractionStates = {
|
|
55
|
+
...(interaction === 'enabled' && {
|
|
56
|
+
backgroundColor: componentTheme.backgroundColor,
|
|
57
|
+
borderColor: componentTheme.borderColor,
|
|
58
|
+
...(success && {
|
|
59
|
+
borderColor: componentTheme.successBorderColor
|
|
60
|
+
}),
|
|
61
|
+
...(invalid && {
|
|
62
|
+
borderColor: componentTheme.errorBorderColor
|
|
63
|
+
}),
|
|
64
|
+
'&:hover': {
|
|
65
|
+
backgroundColor: componentTheme.backgroundHoverColor,
|
|
66
|
+
borderColor: componentTheme.borderHoverColor,
|
|
67
|
+
...(success && {
|
|
68
|
+
borderColor: componentTheme.successBorderColor
|
|
69
|
+
}),
|
|
70
|
+
...(invalid && {
|
|
71
|
+
borderColor: componentTheme.errorBorderColor
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
}),
|
|
75
|
+
...(interaction === 'readonly' && {
|
|
76
|
+
backgroundColor: componentTheme.backgroundReadonlyColor,
|
|
77
|
+
borderColor: componentTheme.borderReadonlyColor
|
|
78
|
+
}),
|
|
79
|
+
...(interaction === 'disabled' && {
|
|
80
|
+
cursor: 'not-allowed',
|
|
81
|
+
pointerEvents: 'none',
|
|
82
|
+
backgroundColor: componentTheme.backgroundDisabledColor,
|
|
83
|
+
borderColor: componentTheme.borderDisabledColor
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
const arrowInteractionStates = {
|
|
87
|
+
...(interaction === 'enabled' && {
|
|
88
|
+
backgroundColor: componentTheme.arrowsBackgroundColor,
|
|
89
|
+
borderColor: componentTheme.arrowsBorderColor,
|
|
90
|
+
'&:hover': {
|
|
91
|
+
backgroundColor: componentTheme.arrowsBackgroundHoverColor,
|
|
92
|
+
borderColor: componentTheme.arrowsBorderHoverColor
|
|
93
|
+
},
|
|
94
|
+
'&:active': {
|
|
95
|
+
backgroundColor: componentTheme.arrowsBackgroundActiveColor,
|
|
96
|
+
borderColor: componentTheme.arrowsBorderActiveColor
|
|
97
|
+
}
|
|
98
|
+
}),
|
|
99
|
+
...(interaction === 'disabled' && {
|
|
100
|
+
cursor: 'not-allowed',
|
|
101
|
+
pointerEvents: 'none',
|
|
102
|
+
backgroundColor: componentTheme.arrowsBackgroundDisabledColor,
|
|
103
|
+
borderColor: componentTheme.arrowsBorderDisabledColor
|
|
104
|
+
})
|
|
105
|
+
// arrow buttons are not rendered in the `readOnly` state
|
|
106
|
+
}
|
|
107
|
+
const inputInteractionStates = {
|
|
108
|
+
...(interaction === 'enabled' && {
|
|
109
|
+
color: componentTheme.textColor,
|
|
110
|
+
'&::placeholder': {
|
|
111
|
+
color: componentTheme.placeholderColor
|
|
112
|
+
},
|
|
113
|
+
'&:hover::placeholder': {
|
|
114
|
+
color: componentTheme.placeholderHoverColor
|
|
115
|
+
}
|
|
116
|
+
// placeholder is not rendered in the `readOnly` and `disabled` state
|
|
117
|
+
}),
|
|
118
|
+
...(interaction === 'readonly' && {
|
|
119
|
+
color: componentTheme.textReadonlyColor
|
|
120
|
+
}),
|
|
121
|
+
...(interaction === 'disabled' && {
|
|
122
|
+
color: componentTheme.textDisabledColor
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const inputStyle = {
|
|
127
|
+
all: 'initial',
|
|
128
|
+
textAlign: textAlign,
|
|
129
|
+
direction: 'inherit',
|
|
130
|
+
WebkitFontSmoothing: 'antialiased',
|
|
131
|
+
MozOsxFontSmoothing: 'grayscale',
|
|
132
|
+
appearance: 'none',
|
|
133
|
+
lineHeight: 1,
|
|
134
|
+
margin: '0',
|
|
135
|
+
flex: 1,
|
|
136
|
+
minWidth: '0.0625rem',
|
|
137
|
+
boxSizing: 'border-box',
|
|
138
|
+
fontFamily: 'inherit',
|
|
139
|
+
fontSize: 'inherit',
|
|
140
|
+
fontWeight: 'inherit',
|
|
141
|
+
...(size === 'medium'
|
|
142
|
+
? {
|
|
143
|
+
padding: componentTheme.paddingHorizontalMd
|
|
144
|
+
}
|
|
145
|
+
: {
|
|
146
|
+
padding: componentTheme.paddingHorizontalLg
|
|
147
|
+
}),
|
|
148
|
+
...inputInteractionStates
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const focusOutline = calcFocusOutlineStyles(sharedTokens.focusOutline, {
|
|
152
|
+
focusWithin: true
|
|
153
|
+
})
|
|
154
|
+
return {
|
|
155
|
+
numberInput: {
|
|
156
|
+
label: 'numberInput'
|
|
157
|
+
},
|
|
158
|
+
arrowContainer: {
|
|
159
|
+
label: 'numberInput_arrowContainer',
|
|
160
|
+
flex: `0 0 ${componentTheme.arrowsContainerWidth}`,
|
|
161
|
+
display: 'flex',
|
|
162
|
+
flexDirection: 'column'
|
|
163
|
+
},
|
|
164
|
+
arrow: {
|
|
165
|
+
label: 'numberInput_arrow',
|
|
166
|
+
cursor: 'pointer',
|
|
167
|
+
userSelect: 'none',
|
|
168
|
+
textAlign: 'center',
|
|
169
|
+
flex: 1,
|
|
170
|
+
display: 'flex',
|
|
171
|
+
justifyContent: 'center',
|
|
172
|
+
alignItems: 'center',
|
|
173
|
+
borderTop: 'none',
|
|
174
|
+
borderInlineEnd: 'none',
|
|
175
|
+
borderInlineStart: `${componentTheme.borderWidth} solid`,
|
|
176
|
+
borderBottom: `${componentTheme.borderWidth} solid`,
|
|
177
|
+
'&:last-child': { borderBottom: 'none' },
|
|
178
|
+
...arrowInteractionStates
|
|
179
|
+
},
|
|
180
|
+
inputWidth: {
|
|
181
|
+
label: 'numberInput_inputWidth',
|
|
182
|
+
display: 'block',
|
|
183
|
+
position: 'relative'
|
|
184
|
+
},
|
|
185
|
+
inputContainer: {
|
|
186
|
+
label: 'numberInput_inputContainer',
|
|
187
|
+
display: 'flex',
|
|
188
|
+
margin: '0',
|
|
189
|
+
boxSizing: 'border-box',
|
|
190
|
+
overflow: 'hidden',
|
|
191
|
+
fontFamily: componentTheme.fontFamily,
|
|
192
|
+
fontWeight: componentTheme.fontWeight,
|
|
193
|
+
border: `${componentTheme.borderWidth} solid`,
|
|
194
|
+
borderRadius: componentTheme.borderRadius,
|
|
195
|
+
...containerInteractionStates,
|
|
196
|
+
...focusOutline,
|
|
197
|
+
...(size === 'medium'
|
|
198
|
+
? {
|
|
199
|
+
fontSize: componentTheme.fontSizeMd,
|
|
200
|
+
height: componentTheme.heightMd
|
|
201
|
+
}
|
|
202
|
+
: {
|
|
203
|
+
fontSize: componentTheme.fontSizeLg,
|
|
204
|
+
height: componentTheme.heightLg
|
|
205
|
+
})
|
|
206
|
+
},
|
|
207
|
+
input: {
|
|
208
|
+
label: 'numberInput_input',
|
|
209
|
+
...inputStyle,
|
|
210
|
+
'&:is(input)[type]': inputStyle,
|
|
211
|
+
'&:-webkit-any(input)[type]': inputStyle,
|
|
212
|
+
'&::-webkit-inner-spin-button': { display: 'none' },
|
|
213
|
+
'&::-webkit-outer-spin-button': { display: 'none' },
|
|
214
|
+
'&:is(input)[type="number"]': { MozAppearance: 'textfield' }
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export default generateStyle
|
package/src/exports/a.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
export { NumberInput } from '../NumberInput/v1'
|
|
25
|
+
export type { NumberInputProps } from '../NumberInput/v1/props'
|
package/src/exports/b.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
export { NumberInput } from '../NumberInput/v2'
|
|
25
|
+
export type { NumberInputProps } from '../NumberInput/v2/props'
|