@instructure/ui-number-input 8.13.1-snapshot.2 → 8.13.1-snapshot.27

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.
@@ -226,6 +226,7 @@ let NumberInput = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
226
226
  showArrows: true,
227
227
  size: 'medium',
228
228
  display: 'block',
229
+ textAlign: 'start',
229
230
  inputRef: event => {},
230
231
  onFocus: event => {},
231
232
  onBlur: event => {},
@@ -128,7 +128,12 @@ const propTypes = {
128
128
  /**
129
129
  * The inputMode attribute of the underlying `input` element can be one of ['numeric', 'decimal', 'tel']
130
130
  */
131
- inputMode: PropTypes.oneOf(['numeric', 'decimal', 'tel'])
131
+ inputMode: PropTypes.oneOf(['numeric', 'decimal', 'tel']),
132
+
133
+ /**
134
+ * The text alignment of the input.
135
+ */
136
+ textAlign: PropTypes.oneOf(['start', 'center'])
132
137
  };
133
- const allowedProps = ['renderLabel', 'id', 'interaction', 'messages', 'placeholder', 'isRequired', 'showArrows', 'size', 'value', 'width', 'display', 'inputRef', 'onFocus', 'onBlur', 'onChange', 'onDecrement', 'onIncrement', 'onKeyDown', 'inputMode'];
138
+ const allowedProps = ['renderLabel', 'id', 'interaction', 'messages', 'placeholder', 'isRequired', 'showArrows', 'size', 'value', 'width', 'display', 'inputRef', 'onFocus', 'onBlur', 'onChange', 'onDecrement', 'onIncrement', 'onKeyDown', 'inputMode', 'textAlign'];
134
139
  export { propTypes, allowedProps };
@@ -33,7 +33,8 @@
33
33
  * @return {Object} The final style object, which will be used in the component
34
34
  */
35
35
  const generateStyle = (componentTheme, props, state) => {
36
- const size = props.size;
36
+ const size = props.size,
37
+ textAlign = props.textAlign;
37
38
  const interaction = state.interaction,
38
39
  hasFocus = state.hasFocus,
39
40
  invalid = state.invalid;
@@ -134,7 +135,7 @@ const generateStyle = (componentTheme, props, state) => {
134
135
  input: {
135
136
  label: 'numberInput_input',
136
137
  all: 'initial',
137
- textAlign: 'start',
138
+ textAlign: textAlign,
138
139
  direction: 'inherit',
139
140
  WebkitFontSmoothing: 'antialiased',
140
141
  MozOsxFontSmoothing: 'grayscale',
@@ -150,6 +151,7 @@ const generateStyle = (componentTheme, props, state) => {
150
151
  color: componentTheme.color,
151
152
  background: componentTheme.background,
152
153
  padding: componentTheme.padding,
154
+ textyAlign: textAlign,
153
155
  '&::placeholder': {
154
156
  color: componentTheme.placeholderColor
155
157
  }
@@ -228,6 +228,7 @@ let NumberInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
228
228
  showArrows: true,
229
229
  size: 'medium',
230
230
  display: 'block',
231
+ textAlign: 'start',
231
232
  inputRef: event => {},
232
233
  onFocus: event => {},
233
234
  onBlur: event => {},
@@ -139,8 +139,13 @@ const propTypes = {
139
139
  /**
140
140
  * The inputMode attribute of the underlying `input` element can be one of ['numeric', 'decimal', 'tel']
141
141
  */
142
- inputMode: _propTypes.default.oneOf(['numeric', 'decimal', 'tel'])
142
+ inputMode: _propTypes.default.oneOf(['numeric', 'decimal', 'tel']),
143
+
144
+ /**
145
+ * The text alignment of the input.
146
+ */
147
+ textAlign: _propTypes.default.oneOf(['start', 'center'])
143
148
  };
144
149
  exports.propTypes = propTypes;
145
- const allowedProps = ['renderLabel', 'id', 'interaction', 'messages', 'placeholder', 'isRequired', 'showArrows', 'size', 'value', 'width', 'display', 'inputRef', 'onFocus', 'onBlur', 'onChange', 'onDecrement', 'onIncrement', 'onKeyDown', 'inputMode'];
150
+ const allowedProps = ['renderLabel', 'id', 'interaction', 'messages', 'placeholder', 'isRequired', 'showArrows', 'size', 'value', 'width', 'display', 'inputRef', 'onFocus', 'onBlur', 'onChange', 'onDecrement', 'onIncrement', 'onKeyDown', 'inputMode', 'textAlign'];
146
151
  exports.allowedProps = allowedProps;
@@ -40,7 +40,8 @@ exports.default = void 0;
40
40
  * @return {Object} The final style object, which will be used in the component
41
41
  */
42
42
  const generateStyle = (componentTheme, props, state) => {
43
- const size = props.size;
43
+ const size = props.size,
44
+ textAlign = props.textAlign;
44
45
  const interaction = state.interaction,
45
46
  hasFocus = state.hasFocus,
46
47
  invalid = state.invalid;
@@ -141,7 +142,7 @@ const generateStyle = (componentTheme, props, state) => {
141
142
  input: {
142
143
  label: 'numberInput_input',
143
144
  all: 'initial',
144
- textAlign: 'start',
145
+ textAlign: textAlign,
145
146
  direction: 'inherit',
146
147
  WebkitFontSmoothing: 'antialiased',
147
148
  MozOsxFontSmoothing: 'grayscale',
@@ -157,6 +158,7 @@ const generateStyle = (componentTheme, props, state) => {
157
158
  color: componentTheme.color,
158
159
  background: componentTheme.background,
159
160
  padding: componentTheme.padding,
161
+ textyAlign: textAlign,
160
162
  '&::placeholder': {
161
163
  color: componentTheme.placeholderColor
162
164
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-number-input",
3
- "version": "8.13.1-snapshot.2+249897ee7",
3
+ "version": "8.13.1-snapshot.27+37d3bca26",
4
4
  "description": "A UI component library made by Instructure Inc.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "homepage": "https://instructure.github.io/instructure-ui/",
@@ -24,21 +24,21 @@
24
24
  "ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
25
25
  },
26
26
  "devDependencies": {
27
- "@instructure/ui-babel-preset": "8.13.1-snapshot.2+249897ee7",
28
- "@instructure/ui-test-locator": "8.13.1-snapshot.2+249897ee7",
29
- "@instructure/ui-test-utils": "8.13.1-snapshot.2+249897ee7",
30
- "@instructure/ui-themes": "8.13.1-snapshot.2+249897ee7"
27
+ "@instructure/ui-babel-preset": "8.13.1-snapshot.27+37d3bca26",
28
+ "@instructure/ui-test-locator": "8.13.1-snapshot.27+37d3bca26",
29
+ "@instructure/ui-test-utils": "8.13.1-snapshot.27+37d3bca26",
30
+ "@instructure/ui-themes": "8.13.1-snapshot.27+37d3bca26"
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.13.10",
34
- "@instructure/emotion": "8.13.1-snapshot.2+249897ee7",
35
- "@instructure/shared-types": "8.13.1-snapshot.2+249897ee7",
36
- "@instructure/ui-form-field": "8.13.1-snapshot.2+249897ee7",
37
- "@instructure/ui-icons": "8.13.1-snapshot.2+249897ee7",
38
- "@instructure/ui-react-utils": "8.13.1-snapshot.2+249897ee7",
39
- "@instructure/ui-testable": "8.13.1-snapshot.2+249897ee7",
40
- "@instructure/ui-utils": "8.13.1-snapshot.2+249897ee7",
41
- "@instructure/uid": "8.13.1-snapshot.2+249897ee7",
34
+ "@instructure/emotion": "8.13.1-snapshot.27+37d3bca26",
35
+ "@instructure/shared-types": "8.13.1-snapshot.27+37d3bca26",
36
+ "@instructure/ui-form-field": "8.13.1-snapshot.27+37d3bca26",
37
+ "@instructure/ui-icons": "8.13.1-snapshot.27+37d3bca26",
38
+ "@instructure/ui-react-utils": "8.13.1-snapshot.27+37d3bca26",
39
+ "@instructure/ui-testable": "8.13.1-snapshot.27+37d3bca26",
40
+ "@instructure/ui-utils": "8.13.1-snapshot.27+37d3bca26",
41
+ "@instructure/uid": "8.13.1-snapshot.27+37d3bca26",
42
42
  "keycode": "^2",
43
43
  "prop-types": "^15"
44
44
  },
@@ -49,5 +49,5 @@
49
49
  "access": "public"
50
50
  },
51
51
  "sideEffects": false,
52
- "gitHead": "249897ee75a61c9436fca89f11473c0ece4c3e15"
52
+ "gitHead": "37d3bca26e420d33639ba518b2443e450ec3df3b"
53
53
  }
@@ -72,6 +72,7 @@ class NumberInput extends Component<NumberInputProps, NumberInputState> {
72
72
  showArrows: true,
73
73
  size: 'medium',
74
74
  display: 'block',
75
+ textAlign: 'start',
75
76
  // @ts-expect-error ts-migrate(6133) FIXME: 'event' is declared but its value is never read.
76
77
  inputRef: (event) => {},
77
78
  // @ts-expect-error ts-migrate(6133) FIXME: 'event' is declared but its value is never read.
@@ -55,6 +55,7 @@ type NumberInputOwnProps = {
55
55
  onIncrement?: (...args: any[]) => any
56
56
  onKeyDown?: (...args: any[]) => any
57
57
  inputMode?: 'numeric' | 'decimal' | 'tel'
58
+ textAlign?: 'start' | 'center'
58
59
  }
59
60
 
60
61
  type NumberInputState = {
@@ -173,7 +174,11 @@ const propTypes: PropValidators<PropKeys> = {
173
174
  /**
174
175
  * The inputMode attribute of the underlying `input` element can be one of ['numeric', 'decimal', 'tel']
175
176
  */
176
- inputMode: PropTypes.oneOf(['numeric', 'decimal', 'tel'])
177
+ inputMode: PropTypes.oneOf(['numeric', 'decimal', 'tel']),
178
+ /**
179
+ * The text alignment of the input.
180
+ */
181
+ textAlign: PropTypes.oneOf(['start', 'center'])
177
182
  }
178
183
 
179
184
  const allowedProps: AllowedPropKeys = [
@@ -195,7 +200,8 @@ const allowedProps: AllowedPropKeys = [
195
200
  'onDecrement',
196
201
  'onIncrement',
197
202
  'onKeyDown',
198
- 'inputMode'
203
+ 'inputMode',
204
+ 'textAlign'
199
205
  ]
200
206
 
201
207
  export type {
@@ -44,7 +44,7 @@ const generateStyle = (
44
44
  props: NumberInputProps,
45
45
  state: NumberInputStyleProps
46
46
  ): NumberInputStyle => {
47
- const { size } = props
47
+ const { size, textAlign } = props
48
48
  const { interaction, hasFocus, invalid } = state
49
49
 
50
50
  const disabledStyles =
@@ -153,7 +153,7 @@ const generateStyle = (
153
153
  input: {
154
154
  label: 'numberInput_input',
155
155
  all: 'initial',
156
- textAlign: 'start',
156
+ textAlign: textAlign,
157
157
  direction: 'inherit',
158
158
  WebkitFontSmoothing: 'antialiased',
159
159
  MozOsxFontSmoothing: 'grayscale',
@@ -169,6 +169,7 @@ const generateStyle = (
169
169
  color: componentTheme.color,
170
170
  background: componentTheme.background,
171
171
  padding: componentTheme.padding,
172
+ textyAlign: textAlign,
172
173
  '&::placeholder': { color: componentTheme.placeholderColor }
173
174
  }
174
175
  }
@@ -1,7 +1,23 @@
1
1
  {
2
2
  "extends": "../../tsconfig.build.json",
3
3
  "compilerOptions": {
4
- "outDir": "./types"
4
+ "outDir": "./types",
5
+ "rootDir": "./src",
6
+ "composite": true
5
7
  },
6
- "include": ["src/**/*"]
8
+ "include": ["src"],
9
+ "references": [
10
+ { "path": "../ui-babel-preset/tsconfig.build.json" },
11
+ { "path": "../ui-test-locator/tsconfig.build.json" },
12
+ { "path": "../ui-test-utils/tsconfig.build.json" },
13
+ { "path": "../ui-themes/tsconfig.build.json" },
14
+ { "path": "../emotion/tsconfig.build.json" },
15
+ { "path": "../shared-types/tsconfig.build.json" },
16
+ { "path": "../ui-form-field/tsconfig.build.json" },
17
+ { "path": "../ui-icons/tsconfig.build.json" },
18
+ { "path": "../ui-react-utils/tsconfig.build.json" },
19
+ { "path": "../ui-testable/tsconfig.build.json" },
20
+ { "path": "../ui-utils/tsconfig.build.json" },
21
+ { "path": "../uid/tsconfig.build.json" }
22
+ ]
7
23
  }