@instructure/ui-text-input 11.7.3 → 11.7.4-pr-snapshot-1781695314229
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 +11 -0
- package/LICENSE.md +1 -0
- package/{lib/TextInput/v2/props.js → babel.config.cjs} +12 -7
- package/es/TextInput/v1/index.js +5 -4
- package/es/TextInput/v2/index.js +3 -3
- package/es/TextInput/v2/styles.js +3 -1
- package/es/exports/a.js +1 -1
- package/es/exports/b.js +1 -1
- package/package.json +15 -20
- package/src/TextInput/v1/index.tsx +4 -3
- package/src/TextInput/v2/index.tsx +3 -2
- package/src/TextInput/v2/styles.ts +4 -2
- package/src/exports/a.ts +1 -1
- package/src/exports/b.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/TextInput/v1/index.d.ts +1 -0
- package/types/TextInput/v1/index.d.ts.map +1 -1
- package/types/TextInput/v2/index.d.ts +1 -0
- package/types/TextInput/v2/index.d.ts.map +1 -1
- package/types/TextInput/v2/styles.d.ts +1 -1
- package/types/TextInput/v2/styles.d.ts.map +1 -1
- package/types/exports/a.d.ts +1 -1
- package/types/exports/a.d.ts.map +1 -1
- package/types/exports/b.d.ts +1 -1
- package/types/exports/b.d.ts.map +1 -1
- package/lib/TextInput/v1/index.js +0 -329
- package/lib/TextInput/v1/props.js +0 -31
- package/lib/TextInput/v1/styles.js +0 -224
- package/lib/TextInput/v1/theme.js +0 -80
- package/lib/TextInput/v2/index.js +0 -266
- package/lib/TextInput/v2/styles.js +0 -230
- package/lib/exports/a.js +0 -12
- package/lib/exports/b.js +0 -12
- package/lib/package.json +0 -1
|
@@ -7,6 +7,7 @@ tags: form, field
|
|
|
7
7
|
---
|
|
8
8
|
**/
|
|
9
9
|
declare class TextInput extends Component<TextInputProps, TextInputState> {
|
|
10
|
+
static displayName: string;
|
|
10
11
|
static readonly componentId = "TextInput";
|
|
11
12
|
static allowedProps: readonly (keyof {
|
|
12
13
|
renderLabel?: import("@instructure/shared-types").Renderable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/TextInput/v1/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAY,SAAS,EAAE,MAAM,OAAO,CAAA;AAmB3C,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,mBAAmB,EACpB,MAAM,SAAS,CAAA;AAGhB;;;;;GAKG;AACH,cAEM,SAAU,SAAQ,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;IAC/D,MAAM,CAAC,QAAQ,CAAC,WAAW,eAAc;IAEzC,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;SAAe;IAElC,MAAM,CAAC,YAAY;;;;;;;;;MAUlB;gBAEW,KAAK,EAAE,cAAc;IAUjC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,OAAO,CAAC,MAAM,CAAgC;IAC9C,OAAO,CAAC,aAAa,CAA+B;IAEpD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;IAEpC,OAAO,CAAC,cAAc,CAAkC;IAExD,SAAS,GAAI,IAAI,OAAO,GAAG,IAAI,UAQ9B;IAED,iBAAiB;IAejB,oBAAoB;IAMpB,kBAAkB,CAAC,SAAS,EAAE,cAAc;IAmB5C,wBAAwB;IA6BxB,cAAc,QAAO,mBAAmB,CAavC;IAED,KAAK;IAIL,IAAI,WAAW,0DAEd;IAED,IAAI,WAAW,YAEd;IAED,IAAI,OAAO,YAOV;IAED,IAAI,OAAO,YAEV;IAED,IAAI,KAAK,uBAER;IAED,IAAI,EAAE,WAEL;IAED,cAAc,GAAI,MAAM,gBAAgB,GAAG,IAAI,UAM9C;IAED,YAAY,EAAE,KAAK,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAIvD;IAED,UAAU,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAg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OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;IAEpC,OAAO,CAAC,cAAc,CAAkC;IAExD,SAAS,GAAI,IAAI,OAAO,GAAG,IAAI,UAQ9B;IAED,iBAAiB;IAWjB,oBAAoB;IAMpB,kBAAkB;IAIlB,gBAAgB,CAAC,eAAe,EAAE,UAAU;IAsB5C,cAAc,QAAO,mBAAmB,CAavC;IAED,KAAK;IAIL,IAAI,WAAW,0DAEd;IAED,IAAI,WAAW,YAEd;IAED,IAAI,OAAO,YAOV;IAED,IAAI,OAAO,YAEV;IAED,IAAI,KAAK,uBAER;IAED,IAAI,EAAE,WAEL;IAED,cAAc,GAAI,MAAM,gBAAgB,GAAG,IAAI,UAM9C;IAED,YAAY,EAAE,KAAK,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAIvD;IAED,UAAU,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAIpD;IAED,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAIrD;IAED,WAAW;IA8CX,MAAM;CAgEP;AAED,eAAe,SAAS,CAAA;AACxB,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NewComponentTypes, SharedTokens } from '@instructure/ui-themes';
|
|
2
|
-
import { TextInputProps, TextInputStyle, TextInputStyleProps } from './props';
|
|
2
|
+
import { TextInputProps, TextInputStyle, TextInputStyleProps } from './props.js';
|
|
3
3
|
/**
|
|
4
4
|
* ---
|
|
5
5
|
* private: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/TextInput/v2/styles.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/TextInput/v2/styles.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAGhF;;;;;;;;;;GAUG;AACH,QAAA,MAAM,aAAa,GACjB,gBAAgB,UAAU,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,EAC1D,OAAO,cAAc,EACrB,cAAc,YAAY,EAC1B,OAAO,mBAAmB,KACzB,cAoLF,CAAA;AAED,eAAe,aAAa,CAAA"}
|
package/types/exports/a.d.ts
CHANGED
package/types/exports/a.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../../src/exports/a.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../../src/exports/a.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA"}
|
package/types/exports/b.d.ts
CHANGED
package/types/exports/b.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"b.d.ts","sourceRoot":"","sources":["../../src/exports/b.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"b.d.ts","sourceRoot":"","sources":["../../src/exports/b.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.TextInput = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
10
|
-
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
11
|
-
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
12
|
-
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
13
|
-
var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
|
|
14
|
-
var _addEventListener = require("@instructure/ui-dom-utils/lib/addEventListener.js");
|
|
15
|
-
var _getCSSStyleDeclaration = require("@instructure/ui-dom-utils/lib/getCSSStyleDeclaration.js");
|
|
16
|
-
var _v11_ = require("@instructure/ui-form-field/v11_6");
|
|
17
|
-
var _emotion = require("@instructure/emotion");
|
|
18
|
-
var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
|
|
19
|
-
var _styles = _interopRequireDefault(require("./styles"));
|
|
20
|
-
var _theme = _interopRequireDefault(require("./theme"));
|
|
21
|
-
var _props = require("./props");
|
|
22
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
23
|
-
var _dec, _dec2, _class;
|
|
24
|
-
/*
|
|
25
|
-
* The MIT License (MIT)
|
|
26
|
-
*
|
|
27
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
28
|
-
*
|
|
29
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
30
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
31
|
-
* in the Software without restriction, including without limitation the rights
|
|
32
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
33
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
34
|
-
* furnished to do so, subject to the following conditions:
|
|
35
|
-
*
|
|
36
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
37
|
-
* copies or substantial portions of the Software.
|
|
38
|
-
*
|
|
39
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
40
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
41
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
42
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
43
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
44
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
45
|
-
* SOFTWARE.
|
|
46
|
-
*/
|
|
47
|
-
/**
|
|
48
|
-
---
|
|
49
|
-
category: components
|
|
50
|
-
tags: form, field
|
|
51
|
-
---
|
|
52
|
-
**/
|
|
53
|
-
let TextInput = exports.TextInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = class TextInput extends _react.Component {
|
|
54
|
-
static displayName = "TextInput";
|
|
55
|
-
static componentId = 'TextInput';
|
|
56
|
-
static allowedProps = _props.allowedProps;
|
|
57
|
-
static defaultProps = {
|
|
58
|
-
type: 'text',
|
|
59
|
-
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
60
|
-
interaction: undefined,
|
|
61
|
-
isRequired: false,
|
|
62
|
-
display: 'block',
|
|
63
|
-
shouldNotWrap: false,
|
|
64
|
-
size: 'medium',
|
|
65
|
-
textAlign: 'start',
|
|
66
|
-
messages: []
|
|
67
|
-
};
|
|
68
|
-
constructor(props) {
|
|
69
|
-
super(props);
|
|
70
|
-
this.state = {
|
|
71
|
-
hasFocus: false,
|
|
72
|
-
afterElementHasWidth: undefined
|
|
73
|
-
};
|
|
74
|
-
this._defaultId = props.deterministicId();
|
|
75
|
-
this._messagesId = props.deterministicId('TextInput-messages');
|
|
76
|
-
}
|
|
77
|
-
ref = null;
|
|
78
|
-
_input = null;
|
|
79
|
-
_afterElement = null;
|
|
80
|
-
_defaultId;
|
|
81
|
-
_messagesId;
|
|
82
|
-
_focusListener = null;
|
|
83
|
-
handleRef = el => {
|
|
84
|
-
const {
|
|
85
|
-
elementRef
|
|
86
|
-
} = this.props;
|
|
87
|
-
this.ref = el;
|
|
88
|
-
if (typeof elementRef === 'function') {
|
|
89
|
-
elementRef(el);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
componentDidMount() {
|
|
93
|
-
if (this._input) {
|
|
94
|
-
this._focusListener = (0, _addEventListener.addEventListener)(this._input, 'focus', this.handleFocus);
|
|
95
|
-
this.setState({
|
|
96
|
-
afterElementHasWidth: this.getElementHasWidth(this._afterElement)
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
this.adjustAfterElementHeight();
|
|
100
|
-
this.props.makeStyles?.(this.makeStyleProps());
|
|
101
|
-
}
|
|
102
|
-
componentWillUnmount() {
|
|
103
|
-
if (this._focusListener) {
|
|
104
|
-
this._focusListener.remove();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
componentDidUpdate(prevProps) {
|
|
108
|
-
if (prevProps.renderAfterInput !== this.props.renderAfterInput) {
|
|
109
|
-
this.setState({
|
|
110
|
-
afterElementHasWidth: this.getElementHasWidth(this._afterElement)
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
if ((0, _getInteraction.getInteraction)({
|
|
114
|
-
props: prevProps
|
|
115
|
-
}) !== 'disabled' && (0, _getInteraction.getInteraction)({
|
|
116
|
-
props: this.props
|
|
117
|
-
}) === 'disabled') {
|
|
118
|
-
this.setState({
|
|
119
|
-
hasFocus: false
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
this.props.makeStyles?.(this.makeStyleProps());
|
|
123
|
-
}
|
|
124
|
-
adjustAfterElementHeight() {
|
|
125
|
-
const afterElementChild = this._afterElement?.firstElementChild;
|
|
126
|
-
|
|
127
|
-
// Check if the child is a button, then get the button's first child (the content span)
|
|
128
|
-
const buttonContentSpan = afterElementChild?.tagName === 'BUTTON' ? afterElementChild.firstElementChild : null;
|
|
129
|
-
|
|
130
|
-
// This is a necessary workaround for DateInput2 because it uses a Popover, which has a nested Button as an afterElement
|
|
131
|
-
// Check if the child is a Popover's inner span containing a button, then get the button's first child (the content span)
|
|
132
|
-
const popoverContentSpan = afterElementChild?.tagName === 'SPAN' && afterElementChild.firstElementChild?.tagName === 'BUTTON' ? afterElementChild.firstElementChild.firstElementChild : null;
|
|
133
|
-
const targetSpan = buttonContentSpan ?? popoverContentSpan;
|
|
134
|
-
if (targetSpan) {
|
|
135
|
-
// Set the height to 36px (the height of a medium TextInput) to avoid layout shift when the afterElement content changes
|
|
136
|
-
// this temporary workaround is necessary because otherwise the layout breaks, later on IconButton's default height will be adjusted to the TextInput size
|
|
137
|
-
// so this workaround will not be needed anymore
|
|
138
|
-
targetSpan.style.height = '36px';
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
makeStyleProps = () => {
|
|
142
|
-
const {
|
|
143
|
-
interaction
|
|
144
|
-
} = this;
|
|
145
|
-
const {
|
|
146
|
-
hasFocus,
|
|
147
|
-
afterElementHasWidth
|
|
148
|
-
} = this.state;
|
|
149
|
-
const beforeElement = this.props.renderBeforeInput ? (0, _callRenderProp.callRenderProp)(this.props.renderBeforeInput) : null;
|
|
150
|
-
return {
|
|
151
|
-
disabled: interaction === 'disabled',
|
|
152
|
-
invalid: this.invalid,
|
|
153
|
-
focused: hasFocus,
|
|
154
|
-
afterElementHasWidth: afterElementHasWidth,
|
|
155
|
-
beforeElementExists: !!beforeElement
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
focus() {
|
|
159
|
-
this._input?.focus();
|
|
160
|
-
}
|
|
161
|
-
get interaction() {
|
|
162
|
-
return (0, _getInteraction.getInteraction)({
|
|
163
|
-
props: this.props
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
get hasMessages() {
|
|
167
|
-
return !!this.props.messages && this.props.messages.length > 0;
|
|
168
|
-
}
|
|
169
|
-
get invalid() {
|
|
170
|
-
return !!this.props.messages && this.props.messages.findIndex(message => {
|
|
171
|
-
return message.type === 'error' || message.type === 'newError';
|
|
172
|
-
}) >= 0;
|
|
173
|
-
}
|
|
174
|
-
get focused() {
|
|
175
|
-
return (0, _isActiveElement.isActiveElement)(this._input);
|
|
176
|
-
}
|
|
177
|
-
get value() {
|
|
178
|
-
return this._input?.value;
|
|
179
|
-
}
|
|
180
|
-
get id() {
|
|
181
|
-
return this.props.id || this._defaultId;
|
|
182
|
-
}
|
|
183
|
-
handleInputRef = node => {
|
|
184
|
-
this._input = node;
|
|
185
|
-
if (typeof this.props.inputRef === 'function') {
|
|
186
|
-
this.props.inputRef(node);
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
handleChange = event => {
|
|
190
|
-
if (typeof this.props.onChange === 'function') {
|
|
191
|
-
this.props.onChange(event, event.target.value);
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
handleBlur = event => {
|
|
195
|
-
if (typeof this.props.onBlur === 'function') {
|
|
196
|
-
this.props.onBlur(event);
|
|
197
|
-
}
|
|
198
|
-
this.setState({
|
|
199
|
-
hasFocus: false
|
|
200
|
-
});
|
|
201
|
-
};
|
|
202
|
-
handleFocus = event => {
|
|
203
|
-
if (typeof this.props.onFocus === 'function') {
|
|
204
|
-
this.props.onFocus(event);
|
|
205
|
-
}
|
|
206
|
-
this.setState({
|
|
207
|
-
hasFocus: true
|
|
208
|
-
});
|
|
209
|
-
};
|
|
210
|
-
renderInput() {
|
|
211
|
-
const {
|
|
212
|
-
type,
|
|
213
|
-
size,
|
|
214
|
-
htmlSize,
|
|
215
|
-
display,
|
|
216
|
-
textAlign,
|
|
217
|
-
placeholder,
|
|
218
|
-
value,
|
|
219
|
-
defaultValue,
|
|
220
|
-
isRequired,
|
|
221
|
-
onFocus,
|
|
222
|
-
...rest
|
|
223
|
-
} = this.props;
|
|
224
|
-
const props = (0, _passthroughProps.passthroughProps)(rest);
|
|
225
|
-
const {
|
|
226
|
-
interaction
|
|
227
|
-
} = this;
|
|
228
|
-
let descriptionIds = '';
|
|
229
|
-
if (props['aria-describedby']) {
|
|
230
|
-
descriptionIds = `${props['aria-describedby']}`;
|
|
231
|
-
}
|
|
232
|
-
return (0, _jsxRuntime.jsx)("input", {
|
|
233
|
-
...props,
|
|
234
|
-
css: this.props.styles?.textInput,
|
|
235
|
-
defaultValue: defaultValue,
|
|
236
|
-
value: value,
|
|
237
|
-
placeholder: placeholder,
|
|
238
|
-
ref: this.handleInputRef,
|
|
239
|
-
type: type,
|
|
240
|
-
id: this.id,
|
|
241
|
-
required: isRequired,
|
|
242
|
-
"aria-invalid": this.invalid ? 'true' : undefined,
|
|
243
|
-
disabled: interaction === 'disabled',
|
|
244
|
-
readOnly: interaction === 'readonly',
|
|
245
|
-
"aria-describedby": descriptionIds !== '' ? descriptionIds : undefined,
|
|
246
|
-
size: htmlSize,
|
|
247
|
-
onChange: this.handleChange,
|
|
248
|
-
onBlur: this.handleBlur
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
getElementHasWidth(element) {
|
|
252
|
-
if (!element) {
|
|
253
|
-
return undefined;
|
|
254
|
-
}
|
|
255
|
-
const computedStyle = (0, _getCSSStyleDeclaration.getCSSStyleDeclaration)(element);
|
|
256
|
-
if (!computedStyle) {
|
|
257
|
-
return undefined;
|
|
258
|
-
}
|
|
259
|
-
const {
|
|
260
|
-
width,
|
|
261
|
-
paddingInlineStart,
|
|
262
|
-
paddingInlineEnd
|
|
263
|
-
} = computedStyle;
|
|
264
|
-
if (width === 'auto' || width === '') {
|
|
265
|
-
// This is a workaround for an edge-case, when the TextInput's parent
|
|
266
|
-
// is hidden on load, so the element is not visible either.
|
|
267
|
-
// In this case the computed width is going to be either 'auto' or '',
|
|
268
|
-
// so we assume it has width so that the padding won't be removed.
|
|
269
|
-
return true;
|
|
270
|
-
}
|
|
271
|
-
const elementWidth = parseFloat(width) - parseFloat(paddingInlineStart) - parseFloat(paddingInlineEnd);
|
|
272
|
-
return elementWidth > 0;
|
|
273
|
-
}
|
|
274
|
-
render() {
|
|
275
|
-
const {
|
|
276
|
-
width,
|
|
277
|
-
display,
|
|
278
|
-
renderLabel,
|
|
279
|
-
renderBeforeInput,
|
|
280
|
-
renderAfterInput,
|
|
281
|
-
messages,
|
|
282
|
-
inputContainerRef,
|
|
283
|
-
isRequired,
|
|
284
|
-
styles
|
|
285
|
-
} = this.props;
|
|
286
|
-
const beforeElement = renderBeforeInput ? (0, _callRenderProp.callRenderProp)(renderBeforeInput) : null;
|
|
287
|
-
const afterElement = renderAfterInput ? (0, _callRenderProp.callRenderProp)(renderAfterInput) : null;
|
|
288
|
-
const renderBeforeOrAfter = !!beforeElement || !!afterElement || renderBeforeInput !== undefined || renderAfterInput !== undefined;
|
|
289
|
-
const rawLabel = (0, _callRenderProp.callRenderProp)(renderLabel);
|
|
290
|
-
const label = (0, _hasVisibleChildren.hasVisibleChildren)(rawLabel) ? (0, _jsxRuntime.jsxs)(_react.Fragment, {
|
|
291
|
-
children: [rawLabel, isRequired && (0, _jsxRuntime.jsxs)("span", {
|
|
292
|
-
css: this.invalid ? styles?.requiredInvalid : {},
|
|
293
|
-
"aria-hidden": true,
|
|
294
|
-
children: [' ', "*"]
|
|
295
|
-
})]
|
|
296
|
-
}) : rawLabel;
|
|
297
|
-
return (0, _jsxRuntime.jsx)(_v11_.FormField, {
|
|
298
|
-
id: this.id,
|
|
299
|
-
label: label,
|
|
300
|
-
messagesId: this._messagesId,
|
|
301
|
-
messages: messages,
|
|
302
|
-
inline: display === 'inline-block',
|
|
303
|
-
width: width,
|
|
304
|
-
inputContainerRef: inputContainerRef,
|
|
305
|
-
layout: this.props.layout,
|
|
306
|
-
elementRef: this.handleRef,
|
|
307
|
-
margin: this.props.margin,
|
|
308
|
-
"data-cid": "TextInput",
|
|
309
|
-
children: (0, _jsxRuntime.jsx)("span", {
|
|
310
|
-
css: styles?.facade,
|
|
311
|
-
children: renderBeforeOrAfter ? (0, _jsxRuntime.jsxs)("span", {
|
|
312
|
-
css: styles?.layout,
|
|
313
|
-
children: [beforeElement, (0, _jsxRuntime.jsxs)("span", {
|
|
314
|
-
css: styles?.inputLayout,
|
|
315
|
-
children: [this.renderInput(), afterElement && (0, _jsxRuntime.jsx)("span", {
|
|
316
|
-
css: styles?.afterElement,
|
|
317
|
-
ref: e => {
|
|
318
|
-
this._afterElement = e;
|
|
319
|
-
},
|
|
320
|
-
children: afterElement
|
|
321
|
-
})]
|
|
322
|
-
})]
|
|
323
|
-
}) : (/* If no prepended or appended content, don't render Flex layout */
|
|
324
|
-
this.renderInput())
|
|
325
|
-
})
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
}) || _class) || _class);
|
|
329
|
-
var _default = exports.default = TextInput;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.allowedProps = void 0;
|
|
7
|
-
/*
|
|
8
|
-
* The MIT License (MIT)
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
-
*
|
|
12
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
* in the Software without restriction, including without limitation the rights
|
|
15
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
* furnished to do so, subject to the following conditions:
|
|
18
|
-
*
|
|
19
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
* copies or substantial portions of the Software.
|
|
21
|
-
*
|
|
22
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
* SOFTWARE.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
const allowedProps = exports.allowedProps = ['renderLabel', 'type', 'id', 'value', 'defaultValue', 'interaction', 'messages', 'size', 'textAlign', 'width', 'htmlSize', 'display', 'shouldNotWrap', 'placeholder', 'isRequired', 'elementRef', 'inputRef', 'inputContainerRef', 'renderBeforeInput', 'renderAfterInput', 'onChange', 'onBlur', 'onFocus', 'margin'];
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
/*
|
|
8
|
-
* The MIT License (MIT)
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
-
*
|
|
12
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
* in the Software without restriction, including without limitation the rights
|
|
15
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
* furnished to do so, subject to the following conditions:
|
|
18
|
-
*
|
|
19
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
* copies or substantial portions of the Software.
|
|
21
|
-
*
|
|
22
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
* SOFTWARE.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* ---
|
|
33
|
-
* private: true
|
|
34
|
-
* ---
|
|
35
|
-
* Generates the style object from the theme and provided additional information
|
|
36
|
-
* @param {Object} componentTheme The theme variable object.
|
|
37
|
-
* @param {Object} props the props of the component, the style is applied to
|
|
38
|
-
* @param {Object} state the state of the component, the style is applied to
|
|
39
|
-
* @return {Object} The final style object, which will be used in the component
|
|
40
|
-
*/
|
|
41
|
-
const generateStyle = (componentTheme, props, state) => {
|
|
42
|
-
const {
|
|
43
|
-
size,
|
|
44
|
-
textAlign,
|
|
45
|
-
shouldNotWrap
|
|
46
|
-
} = props;
|
|
47
|
-
const {
|
|
48
|
-
disabled,
|
|
49
|
-
invalid,
|
|
50
|
-
focused,
|
|
51
|
-
afterElementHasWidth,
|
|
52
|
-
beforeElementExists
|
|
53
|
-
} = state;
|
|
54
|
-
const sizeVariants = {
|
|
55
|
-
small: {
|
|
56
|
-
fontSize: componentTheme.smallFontSize,
|
|
57
|
-
height: `calc(${componentTheme.smallHeight} - (2 * ${componentTheme.borderWidth}))`,
|
|
58
|
-
lineHeight: `calc(${componentTheme.smallHeight} - (2 * ${componentTheme.borderWidth}))`
|
|
59
|
-
},
|
|
60
|
-
medium: {
|
|
61
|
-
fontSize: componentTheme.mediumFontSize,
|
|
62
|
-
height: `calc(${componentTheme.mediumHeight} - (2 * ${componentTheme.borderWidth}))`,
|
|
63
|
-
lineHeight: `calc(${componentTheme.mediumHeight} - (2 * ${componentTheme.borderWidth}))`
|
|
64
|
-
},
|
|
65
|
-
large: {
|
|
66
|
-
fontSize: componentTheme.largeFontSize,
|
|
67
|
-
height: `calc(${componentTheme.largeHeight} - (2 * ${componentTheme.borderWidth}))`,
|
|
68
|
-
lineHeight: `calc(${componentTheme.largeHeight} - (2 * ${componentTheme.borderWidth}))`
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
const disabledStyle = disabled ? {
|
|
72
|
-
cursor: 'not-allowed',
|
|
73
|
-
pointerEvents: 'none',
|
|
74
|
-
opacity: '0.5'
|
|
75
|
-
} : {};
|
|
76
|
-
const focusedStyle = focused ? {
|
|
77
|
-
opacity: 1,
|
|
78
|
-
transform: 'scale(1)'
|
|
79
|
-
} : {
|
|
80
|
-
opacity: 0,
|
|
81
|
-
transform: 'scale(0.95)'
|
|
82
|
-
};
|
|
83
|
-
const invalidStyle = invalid ? {
|
|
84
|
-
borderColor: componentTheme.errorBorderColor
|
|
85
|
-
} : {};
|
|
86
|
-
const invalidAndFocusedStyle = invalid && focused ? {
|
|
87
|
-
borderColor: componentTheme.errorBorderColor
|
|
88
|
-
} : {};
|
|
89
|
-
const inputStyle = {
|
|
90
|
-
all: 'initial',
|
|
91
|
-
'&::-ms-clear': {
|
|
92
|
-
display: 'none'
|
|
93
|
-
},
|
|
94
|
-
width: '100%',
|
|
95
|
-
WebkitFontSmoothing: 'antialiased',
|
|
96
|
-
MozOsxFontSmoothing: 'grayscale',
|
|
97
|
-
appearance: 'none',
|
|
98
|
-
margin: 0,
|
|
99
|
-
display: 'block',
|
|
100
|
-
boxSizing: 'border-box',
|
|
101
|
-
outline: 'none',
|
|
102
|
-
fontFamily: componentTheme.fontFamily,
|
|
103
|
-
fontWeight: componentTheme.fontWeight,
|
|
104
|
-
color: componentTheme.color,
|
|
105
|
-
padding: `0 ${componentTheme.padding}`,
|
|
106
|
-
background: 'transparent',
|
|
107
|
-
border: 'none',
|
|
108
|
-
verticalAlign: 'baseline',
|
|
109
|
-
'&[autocomplete="off"]::-webkit-contacts-auto-fill-button': {
|
|
110
|
-
display: 'none !important'
|
|
111
|
-
},
|
|
112
|
-
'&:focus': {
|
|
113
|
-
boxShadow: 'initial'
|
|
114
|
-
},
|
|
115
|
-
'&::placeholder': {
|
|
116
|
-
color: componentTheme.placeholderColor
|
|
117
|
-
},
|
|
118
|
-
...sizeVariants[size],
|
|
119
|
-
textAlign: textAlign
|
|
120
|
-
};
|
|
121
|
-
const viewBase = {
|
|
122
|
-
boxSizing: 'border-box',
|
|
123
|
-
fontFamily: componentTheme.fontFamily,
|
|
124
|
-
maxWidth: '100%',
|
|
125
|
-
overflow: 'visible',
|
|
126
|
-
unicodeBidi: 'isolate'
|
|
127
|
-
};
|
|
128
|
-
const flexBase = {
|
|
129
|
-
...viewBase,
|
|
130
|
-
display: 'flex',
|
|
131
|
-
alignItems: 'center',
|
|
132
|
-
justifyContent: 'flex-start',
|
|
133
|
-
flexDirection: 'row'
|
|
134
|
-
};
|
|
135
|
-
return {
|
|
136
|
-
requiredInvalid: {
|
|
137
|
-
color: componentTheme.requiredInvalidColor
|
|
138
|
-
},
|
|
139
|
-
textInput: {
|
|
140
|
-
label: 'textInput',
|
|
141
|
-
...inputStyle,
|
|
142
|
-
'&:is(input)[type]': inputStyle,
|
|
143
|
-
'&:-webkit-any(input)[type]': inputStyle
|
|
144
|
-
},
|
|
145
|
-
facade: {
|
|
146
|
-
label: 'textInput__facade',
|
|
147
|
-
position: 'relative',
|
|
148
|
-
display: 'block',
|
|
149
|
-
boxSizing: 'border-box',
|
|
150
|
-
border: `${componentTheme.borderWidth} ${componentTheme.borderStyle} ${componentTheme.borderColor}`,
|
|
151
|
-
borderRadius: componentTheme.borderRadius,
|
|
152
|
-
background: componentTheme.background,
|
|
153
|
-
color: componentTheme.color,
|
|
154
|
-
'&::before': {
|
|
155
|
-
content: '""',
|
|
156
|
-
pointerEvents: 'none',
|
|
157
|
-
position: 'absolute',
|
|
158
|
-
display: 'block',
|
|
159
|
-
boxSizing: 'border-box',
|
|
160
|
-
top: '-0.25rem',
|
|
161
|
-
bottom: '-0.25rem',
|
|
162
|
-
left: '-0.25rem',
|
|
163
|
-
right: '-0.25rem',
|
|
164
|
-
border: `${componentTheme.focusOutlineWidth} ${componentTheme.focusOutlineStyle} ${componentTheme.focusOutlineColor}`,
|
|
165
|
-
borderRadius: `calc(${componentTheme.borderRadius} * 1.5)`,
|
|
166
|
-
transition: 'all 0.2s',
|
|
167
|
-
...focusedStyle,
|
|
168
|
-
// properties to transition on :focus
|
|
169
|
-
...invalidAndFocusedStyle
|
|
170
|
-
},
|
|
171
|
-
...disabledStyle,
|
|
172
|
-
...invalidStyle
|
|
173
|
-
},
|
|
174
|
-
layout: {
|
|
175
|
-
label: 'textInput__layout',
|
|
176
|
-
...viewBase,
|
|
177
|
-
display: 'flex',
|
|
178
|
-
alignItems: 'center',
|
|
179
|
-
justifyContent: 'flex-start',
|
|
180
|
-
flexDirection: 'row',
|
|
181
|
-
...(!shouldNotWrap && {
|
|
182
|
-
flexWrap: 'wrap'
|
|
183
|
-
}),
|
|
184
|
-
...(beforeElementExists && {
|
|
185
|
-
paddingInlineStart: componentTheme.padding
|
|
186
|
-
})
|
|
187
|
-
},
|
|
188
|
-
inputLayout: {
|
|
189
|
-
label: 'textInput__inputLayout',
|
|
190
|
-
flexGrow: 1,
|
|
191
|
-
...flexBase
|
|
192
|
-
},
|
|
193
|
-
afterElement: {
|
|
194
|
-
// the next couple lines (until the `label`) is needed so the IconButton looks OK inside the TextInput
|
|
195
|
-
// explanation: if the content inside is not a button or a popover (which could contain a button) it should have some padding on the right
|
|
196
|
-
// lineHeight is only needed if it is not popover or button
|
|
197
|
-
'& > :not(button):not([data-position^="Popover"])': {
|
|
198
|
-
marginRight: componentTheme.padding,
|
|
199
|
-
...(sizeVariants[size] && {
|
|
200
|
-
lineHeight: sizeVariants[size].lineHeight
|
|
201
|
-
})
|
|
202
|
-
},
|
|
203
|
-
display: 'flex',
|
|
204
|
-
alignItems: 'center',
|
|
205
|
-
// Spread all sizeVariants except lineHeight (handled above)
|
|
206
|
-
...(sizeVariants[size] ?
|
|
207
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
208
|
-
(({
|
|
209
|
-
lineHeight,
|
|
210
|
-
...rest
|
|
211
|
-
}) => rest)(sizeVariants[size]) : {}),
|
|
212
|
-
label: 'textInput__afterElement',
|
|
213
|
-
...viewBase,
|
|
214
|
-
borderRadius: componentTheme.borderRadius,
|
|
215
|
-
flexShrink: 0,
|
|
216
|
-
// we only override the padding once the width is calculated,
|
|
217
|
-
// it needs the padding on render
|
|
218
|
-
...(afterElementHasWidth === false && {
|
|
219
|
-
paddingInlineEnd: 0
|
|
220
|
-
})
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
};
|
|
224
|
-
var _default = exports.default = generateStyle;
|