@saasbase-io/core-elements 1.21.0 → 1.22.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/dist/components/renderers/_updated/field/_confirm-field.d.ts +14 -20
- package/dist/components/renderers/_updated/field/_email-field.d.ts +14 -15
- package/dist/components/renderers/_updated/field/_identifier-field.d.ts +14 -7
- package/dist/components/renderers/_updated/field/_name-field.d.ts +14 -31
- package/dist/components/renderers/_updated/field/_password-field.d.ts +14 -32
- package/dist/components/renderers/_updated/field/_phone-field.d.ts +14 -15
- package/dist/components/renderers/_updated/field/_username-field.d.ts +14 -31
- package/dist/components/renderers/_updated/field/field.types.d.ts +23 -7
- package/dist/index.js +80 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +719 -803
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from '../../../../../node_modules/lit';
|
|
2
|
-
import { ConfirmFieldContent, ConfirmFieldProps, ConfirmFieldVariant } from './field.types';
|
|
2
|
+
import { ConfirmFieldContent, ConfirmFieldProps, ConfirmFieldValidation, ConfirmFieldVariant } from './field.types';
|
|
3
3
|
/**
|
|
4
4
|
* A self-validating confirm password field for auth widget forms.
|
|
5
5
|
* @element sb-confirm-field
|
|
@@ -44,13 +44,11 @@ export declare class SbConfirmField extends LitElement implements ConfirmFieldPr
|
|
|
44
44
|
*/
|
|
45
45
|
static get validateEventName(): string;
|
|
46
46
|
/**
|
|
47
|
-
* A unique
|
|
48
|
-
* the `child-id` prop is not provided.
|
|
47
|
+
* A unique substring for fallback part IDs generated.
|
|
49
48
|
*/
|
|
50
49
|
seed: string;
|
|
51
50
|
/**
|
|
52
|
-
* The `id`
|
|
53
|
-
* child/part IDs.
|
|
51
|
+
* The `id` of the root part and the base of sub-part IDs.
|
|
54
52
|
*/
|
|
55
53
|
childId?: string;
|
|
56
54
|
/**
|
|
@@ -104,6 +102,11 @@ export declare class SbConfirmField extends LitElement implements ConfirmFieldPr
|
|
|
104
102
|
* When provided, the parent form cannot be submitted without this field.
|
|
105
103
|
*/
|
|
106
104
|
required?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Controls validation depth: `"default"` applies all rules, while `"simple"`
|
|
107
|
+
* only enforces the `required` check.
|
|
108
|
+
*/
|
|
109
|
+
validation: ConfirmFieldValidation;
|
|
107
110
|
/**
|
|
108
111
|
* Error message shown when the field is required but empty upon submission.
|
|
109
112
|
*/
|
|
@@ -191,25 +194,16 @@ export declare class SbConfirmField extends LitElement implements ConfirmFieldPr
|
|
|
191
194
|
*/
|
|
192
195
|
private _dispatchValidate;
|
|
193
196
|
/**
|
|
194
|
-
*
|
|
195
|
-
* fields and non-empty required fields, otherwise dispatching and displaying
|
|
196
|
-
* the required error.
|
|
197
|
-
*/
|
|
198
|
-
private _validateRequired;
|
|
199
|
-
/**
|
|
200
|
-
* Handles the match condition validation, obtaining the paired field's value,
|
|
201
|
-
* comparing it to the confirm field's value, dispatching and displaying the
|
|
202
|
-
* match error if the values do not match.
|
|
197
|
+
* Clears the invalid state and error, and dispatches a valid validate event.
|
|
203
198
|
*/
|
|
204
|
-
private
|
|
199
|
+
private _handleValidateSuccess;
|
|
205
200
|
/**
|
|
206
|
-
*
|
|
207
|
-
* validate event, indicating a successfully validated and valid confirm.
|
|
201
|
+
* Sets the invalid state and error, and dispatches an invalid validate event.
|
|
208
202
|
*/
|
|
209
|
-
private
|
|
203
|
+
private _handleValidateError;
|
|
210
204
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
205
|
+
* Validates the current value against the applicable rules in sequence,
|
|
206
|
+
* dispatches the validate event, and returns `true` if the value passes.
|
|
213
207
|
*/
|
|
214
208
|
private _validate;
|
|
215
209
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from '../../../../../node_modules/lit';
|
|
2
|
-
import { EmailFieldContent, EmailFieldProps } from './field.types';
|
|
2
|
+
import { EmailFieldContent, EmailFieldProps, EmailFieldValidation } from './field.types';
|
|
3
3
|
/**
|
|
4
4
|
* A self-validating email field for auth widget forms.
|
|
5
5
|
* @element sb-email-field
|
|
@@ -45,13 +45,11 @@ export declare class SbEmailField extends LitElement implements EmailFieldProps
|
|
|
45
45
|
*/
|
|
46
46
|
static get validateEventName(): string;
|
|
47
47
|
/**
|
|
48
|
-
* A unique
|
|
49
|
-
* the `child-id` prop is not provided.
|
|
48
|
+
* A unique substring for fallback part IDs generated.
|
|
50
49
|
*/
|
|
51
50
|
seed: string;
|
|
52
51
|
/**
|
|
53
|
-
* The `id`
|
|
54
|
-
* child/part IDs.
|
|
52
|
+
* The `id` of the root part and the base of sub-part IDs.
|
|
55
53
|
*/
|
|
56
54
|
childId?: string;
|
|
57
55
|
/**
|
|
@@ -96,6 +94,11 @@ export declare class SbEmailField extends LitElement implements EmailFieldProps
|
|
|
96
94
|
* When provided, the parent form cannot be submitted without this field.
|
|
97
95
|
*/
|
|
98
96
|
required?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Controls validation depth: `"default"` applies all rules, while `"simple"`
|
|
99
|
+
* only enforces the `required` check.
|
|
100
|
+
*/
|
|
101
|
+
validation: EmailFieldValidation;
|
|
99
102
|
/**
|
|
100
103
|
* Error message shown when the field is required but empty upon submission.
|
|
101
104
|
*/
|
|
@@ -182,20 +185,16 @@ export declare class SbEmailField extends LitElement implements EmailFieldProps
|
|
|
182
185
|
*/
|
|
183
186
|
private _dispatchValidate;
|
|
184
187
|
/**
|
|
185
|
-
*
|
|
186
|
-
* fields and non-empty required fields, otherwise dispatching and displaying
|
|
187
|
-
* the required error.
|
|
188
|
+
* Clears the invalid state and error, and dispatches a valid validate event.
|
|
188
189
|
*/
|
|
189
|
-
private
|
|
190
|
+
private _handleValidateSuccess;
|
|
190
191
|
/**
|
|
191
|
-
*
|
|
192
|
-
* non-required fields and non-empty fields that satisfy the pattern,
|
|
193
|
-
* otherwise dispatching and displaying the format error.
|
|
192
|
+
* Sets the invalid state and error, and dispatches an invalid validate event.
|
|
194
193
|
*/
|
|
195
|
-
private
|
|
194
|
+
private _handleValidateError;
|
|
196
195
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
196
|
+
* Validates the current value against the applicable rules in sequence,
|
|
197
|
+
* dispatches the validate event, and returns `true` if the value passes.
|
|
199
198
|
*/
|
|
200
199
|
private _validate;
|
|
201
200
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from '../../../../../node_modules/lit';
|
|
2
|
-
import { IdentifierFieldAutocomplete, IdentifierFieldContent, IdentifierFieldIdentifier, IdentifierFieldProps } from './field.types';
|
|
2
|
+
import { IdentifierFieldAutocomplete, IdentifierFieldContent, IdentifierFieldIdentifier, IdentifierFieldProps, IdentifierFieldValidation } from './field.types';
|
|
3
3
|
/**
|
|
4
4
|
* A self-validating identifier field for auth widget forms.
|
|
5
5
|
* @element sb-identifier-field
|
|
@@ -102,6 +102,11 @@ export declare class SbIdentifierField extends LitElement implements IdentifierF
|
|
|
102
102
|
* When provided, the parent form cannot be submitted without this field.
|
|
103
103
|
*/
|
|
104
104
|
required?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Controls validation depth: `"default"` applies all rules, while `"simple"`
|
|
107
|
+
* only enforces the `required` check.
|
|
108
|
+
*/
|
|
109
|
+
validation: IdentifierFieldValidation;
|
|
105
110
|
/**
|
|
106
111
|
* Error message shown when the field is required but empty upon submission.
|
|
107
112
|
*/
|
|
@@ -194,14 +199,16 @@ export declare class SbIdentifierField extends LitElement implements IdentifierF
|
|
|
194
199
|
*/
|
|
195
200
|
private _dispatchValidate;
|
|
196
201
|
/**
|
|
197
|
-
*
|
|
198
|
-
|
|
199
|
-
|
|
202
|
+
* Clears the invalid state and error, and dispatches a valid validate event.
|
|
203
|
+
*/
|
|
204
|
+
private _handleValidateSuccess;
|
|
205
|
+
/**
|
|
206
|
+
* Sets the invalid state and error, and dispatches an invalid validate event.
|
|
200
207
|
*/
|
|
201
|
-
private
|
|
208
|
+
private _handleValidateError;
|
|
202
209
|
/**
|
|
203
|
-
*
|
|
204
|
-
*
|
|
210
|
+
* Validates the current value against the applicable rules in sequence,
|
|
211
|
+
* dispatches the validate event, and returns `true` if the value passes.
|
|
205
212
|
*/
|
|
206
213
|
private _validate;
|
|
207
214
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from '../../../../../node_modules/lit';
|
|
2
|
-
import { NameFieldContent, NameFieldProps } from './field.types';
|
|
2
|
+
import { NameFieldContent, NameFieldProps, NameFieldValidation } from './field.types';
|
|
3
3
|
/**
|
|
4
4
|
* A self-validating name field for auth widget forms.
|
|
5
5
|
* @element sb-name-field
|
|
@@ -45,13 +45,11 @@ export declare class SbNameField extends LitElement implements NameFieldProps {
|
|
|
45
45
|
*/
|
|
46
46
|
static get validateEventName(): string;
|
|
47
47
|
/**
|
|
48
|
-
* A unique
|
|
49
|
-
* the `child-id` prop is not provided.
|
|
48
|
+
* A unique substring for fallback part IDs generated.
|
|
50
49
|
*/
|
|
51
50
|
seed: string;
|
|
52
51
|
/**
|
|
53
|
-
* The `id`
|
|
54
|
-
* child/part IDs.
|
|
52
|
+
* The `id` of the root part and the base of sub-part IDs.
|
|
55
53
|
*/
|
|
56
54
|
childId?: string;
|
|
57
55
|
/**
|
|
@@ -108,6 +106,11 @@ export declare class SbNameField extends LitElement implements NameFieldProps {
|
|
|
108
106
|
* The regex pattern for a valid name, used in place of `_PATTERN`.
|
|
109
107
|
*/
|
|
110
108
|
pattern?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Controls validation depth: `"default"` applies all rules, while `"simple"`
|
|
111
|
+
* only enforces the `required` check.
|
|
112
|
+
*/
|
|
113
|
+
validation: NameFieldValidation;
|
|
111
114
|
/**
|
|
112
115
|
* Error message shown when the field is required but empty upon submission.
|
|
113
116
|
*/
|
|
@@ -213,36 +216,16 @@ export declare class SbNameField extends LitElement implements NameFieldProps {
|
|
|
213
216
|
*/
|
|
214
217
|
private _dispatchValidate;
|
|
215
218
|
/**
|
|
216
|
-
*
|
|
217
|
-
* fields and non-empty required fields, otherwise dispatching and displaying
|
|
218
|
-
* the required error.
|
|
219
|
-
*/
|
|
220
|
-
private _validateRequired;
|
|
221
|
-
/**
|
|
222
|
-
* Handles the minlength condition validation, determining if a valid
|
|
223
|
-
* `minlength` prop was provided, dispatching and displaying the minlength
|
|
224
|
-
* error if the value is shorter than accepted.
|
|
225
|
-
*/
|
|
226
|
-
private _validateMinlength;
|
|
227
|
-
/**
|
|
228
|
-
* Handles the maxlength condition validation, determining if a valid
|
|
229
|
-
* `maxlength` prop was provided, dispatching and displaying the maxlength
|
|
230
|
-
* error if the value is longer than accepted.
|
|
231
|
-
*/
|
|
232
|
-
private _validateMaxlength;
|
|
233
|
-
/**
|
|
234
|
-
* Handles the format condition validation, testing against `_pattern`, and
|
|
235
|
-
* dispatching and displaying the format error for an invalid value.
|
|
219
|
+
* Clears the invalid state and error, and dispatches a valid validate event.
|
|
236
220
|
*/
|
|
237
|
-
private
|
|
221
|
+
private _handleValidateSuccess;
|
|
238
222
|
/**
|
|
239
|
-
*
|
|
240
|
-
* validate event, indicating a successfully validated and valid name.
|
|
223
|
+
* Sets the invalid state and error, and dispatches an invalid validate event.
|
|
241
224
|
*/
|
|
242
|
-
private
|
|
225
|
+
private _handleValidateError;
|
|
243
226
|
/**
|
|
244
|
-
*
|
|
245
|
-
*
|
|
227
|
+
* Validates the current value against the applicable rules in sequence,
|
|
228
|
+
* dispatches the validate event, and returns `true` if the value passes.
|
|
246
229
|
*/
|
|
247
230
|
private _validate;
|
|
248
231
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from '../../../../../node_modules/lit';
|
|
2
|
-
import { PasswordFieldContent, PasswordFieldProps, PasswordFieldRule, PasswordFieldVariant } from './field.types';
|
|
2
|
+
import { PasswordFieldContent, PasswordFieldProps, PasswordFieldRule, PasswordFieldValidation, PasswordFieldVariant } from './field.types';
|
|
3
3
|
/**
|
|
4
4
|
* A self-validating password field for auth widget forms.
|
|
5
5
|
* @element sb-password-field
|
|
@@ -45,13 +45,11 @@ export declare class SbPasswordField extends LitElement implements PasswordField
|
|
|
45
45
|
*/
|
|
46
46
|
static get validateEventName(): string;
|
|
47
47
|
/**
|
|
48
|
-
* A unique
|
|
49
|
-
* the `child-id` prop is not provided.
|
|
48
|
+
* A unique substring for fallback part IDs generated.
|
|
50
49
|
*/
|
|
51
50
|
seed: string;
|
|
52
51
|
/**
|
|
53
|
-
* The `id`
|
|
54
|
-
* child/part IDs.
|
|
52
|
+
* The `id` of the root part and the base of sub-part IDs.
|
|
55
53
|
*/
|
|
56
54
|
childId?: string;
|
|
57
55
|
/**
|
|
@@ -114,6 +112,11 @@ export declare class SbPasswordField extends LitElement implements PasswordField
|
|
|
114
112
|
* each rule, as well as an optional `error` message pairing.
|
|
115
113
|
*/
|
|
116
114
|
rules: PasswordFieldRule[];
|
|
115
|
+
/**
|
|
116
|
+
* Controls validation depth: `"default"` applies all rules, while `"simple"`
|
|
117
|
+
* only enforces the `required` check.
|
|
118
|
+
*/
|
|
119
|
+
validation: PasswordFieldValidation;
|
|
117
120
|
/**
|
|
118
121
|
* Error message shown when the field is required but empty upon submission.
|
|
119
122
|
*/
|
|
@@ -210,37 +213,16 @@ export declare class SbPasswordField extends LitElement implements PasswordField
|
|
|
210
213
|
*/
|
|
211
214
|
private _dispatchValidate;
|
|
212
215
|
/**
|
|
213
|
-
*
|
|
214
|
-
* fields and non-empty required fields, otherwise dispatching and displaying
|
|
215
|
-
* the required error.
|
|
216
|
-
*/
|
|
217
|
-
private _validateRequired;
|
|
218
|
-
/**
|
|
219
|
-
* Handles the minlength condition validation, determining if a valid
|
|
220
|
-
* `minlength` prop was provided, dispatching and displaying the minlength
|
|
221
|
-
* error if the value is shorter than accepted.
|
|
222
|
-
*/
|
|
223
|
-
private _validateMinlength;
|
|
224
|
-
/**
|
|
225
|
-
* Handles the maxlength condition validation, determining if a valid
|
|
226
|
-
* `maxlength` prop was provided, dispatching and displaying the maxlength
|
|
227
|
-
* error if the value is longer than accepted.
|
|
228
|
-
*/
|
|
229
|
-
private _validateMaxlength;
|
|
230
|
-
/**
|
|
231
|
-
* Handles the format condition validation, testing against each of the
|
|
232
|
-
* `rules` patterns, and dispatching and displaying the relevant or fallback
|
|
233
|
-
* format error(s) for an invalid value.
|
|
216
|
+
* Clears the invalid state and error, and dispatches a valid validate event.
|
|
234
217
|
*/
|
|
235
|
-
private
|
|
218
|
+
private _handleValidateSuccess;
|
|
236
219
|
/**
|
|
237
|
-
*
|
|
238
|
-
* validate event, indicating a successfully validated and valid password.
|
|
220
|
+
* Sets the invalid state and error, and dispatches an invalid validate event.
|
|
239
221
|
*/
|
|
240
|
-
private
|
|
222
|
+
private _handleValidateError;
|
|
241
223
|
/**
|
|
242
|
-
*
|
|
243
|
-
*
|
|
224
|
+
* Validates the current value against the applicable rules in sequence,
|
|
225
|
+
* dispatches the validate event, and returns `true` if the value passes.
|
|
244
226
|
*/
|
|
245
227
|
private _validate;
|
|
246
228
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from '../../../../../node_modules/lit';
|
|
2
|
-
import { PhoneFieldContent, PhoneFieldProps } from './field.types';
|
|
2
|
+
import { PhoneFieldContent, PhoneFieldProps, PhoneFieldValidation } from './field.types';
|
|
3
3
|
/**
|
|
4
4
|
* A self-validating phone field for auth widget forms.
|
|
5
5
|
* @element sb-phone-field
|
|
@@ -45,13 +45,11 @@ export declare class SbPhoneField extends LitElement implements PhoneFieldProps
|
|
|
45
45
|
*/
|
|
46
46
|
static get validateEventName(): string;
|
|
47
47
|
/**
|
|
48
|
-
* A unique
|
|
49
|
-
* the `child-id` prop is not provided.
|
|
48
|
+
* A unique substring for fallback part IDs generated.
|
|
50
49
|
*/
|
|
51
50
|
seed: string;
|
|
52
51
|
/**
|
|
53
|
-
* The `id`
|
|
54
|
-
* child/part IDs.
|
|
52
|
+
* The `id` of the root part and the base of sub-part IDs.
|
|
55
53
|
*/
|
|
56
54
|
childId?: string;
|
|
57
55
|
/**
|
|
@@ -96,6 +94,11 @@ export declare class SbPhoneField extends LitElement implements PhoneFieldProps
|
|
|
96
94
|
* When provided, the parent form cannot be submitted without this field.
|
|
97
95
|
*/
|
|
98
96
|
required?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Controls validation depth: `"default"` applies all rules, while `"simple"`
|
|
99
|
+
* only enforces the `required` check.
|
|
100
|
+
*/
|
|
101
|
+
validation: PhoneFieldValidation;
|
|
99
102
|
/**
|
|
100
103
|
* Error message shown when the field is required but empty upon submission.
|
|
101
104
|
*/
|
|
@@ -181,20 +184,16 @@ export declare class SbPhoneField extends LitElement implements PhoneFieldProps
|
|
|
181
184
|
*/
|
|
182
185
|
private _dispatchValidate;
|
|
183
186
|
/**
|
|
184
|
-
*
|
|
185
|
-
* fields and non-empty required fields, otherwise dispatching and displaying
|
|
186
|
-
* the required error.
|
|
187
|
+
* Clears the invalid state and error, and dispatches a valid validate event.
|
|
187
188
|
*/
|
|
188
|
-
private
|
|
189
|
+
private _handleValidateSuccess;
|
|
189
190
|
/**
|
|
190
|
-
*
|
|
191
|
-
* non-required fields and non-empty fields that satisfy the pattern,
|
|
192
|
-
* otherwise dispatching and displaying the format error.
|
|
191
|
+
* Sets the invalid state and error, and dispatches an invalid validate event.
|
|
193
192
|
*/
|
|
194
|
-
private
|
|
193
|
+
private _handleValidateError;
|
|
195
194
|
/**
|
|
196
|
-
*
|
|
197
|
-
*
|
|
195
|
+
* Validates the current value against the applicable rules in sequence,
|
|
196
|
+
* dispatches the validate event, and returns `true` if the value passes.
|
|
198
197
|
*/
|
|
199
198
|
private _validate;
|
|
200
199
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from '../../../../../node_modules/lit';
|
|
2
|
-
import { UsernameFieldContent, UsernameFieldProps } from './field.types';
|
|
2
|
+
import { UsernameFieldContent, UsernameFieldProps, UsernameFieldValidation } from './field.types';
|
|
3
3
|
/**
|
|
4
4
|
* A self-validating username field for auth widget forms.
|
|
5
5
|
* @element sb-username-field
|
|
@@ -45,13 +45,11 @@ export declare class SbUsernameField extends LitElement implements UsernameField
|
|
|
45
45
|
*/
|
|
46
46
|
static get validateEventName(): string;
|
|
47
47
|
/**
|
|
48
|
-
* A unique
|
|
49
|
-
* the `child-id` prop is not provided.
|
|
48
|
+
* A unique substring for fallback part IDs generated.
|
|
50
49
|
*/
|
|
51
50
|
seed: string;
|
|
52
51
|
/**
|
|
53
|
-
* The `id`
|
|
54
|
-
* child/part IDs.
|
|
52
|
+
* The `id` of the root part and the base of sub-part IDs.
|
|
55
53
|
*/
|
|
56
54
|
childId?: string;
|
|
57
55
|
/**
|
|
@@ -108,6 +106,11 @@ export declare class SbUsernameField extends LitElement implements UsernameField
|
|
|
108
106
|
* The regex pattern for a valid username, used in place of `_PATTERN`.
|
|
109
107
|
*/
|
|
110
108
|
pattern?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Controls validation depth: `"default"` applies all rules, while `"simple"`
|
|
111
|
+
* only enforces the `required` check.
|
|
112
|
+
*/
|
|
113
|
+
validation: UsernameFieldValidation;
|
|
111
114
|
/**
|
|
112
115
|
* Error message shown when the field is required but empty upon submission.
|
|
113
116
|
*/
|
|
@@ -213,36 +216,16 @@ export declare class SbUsernameField extends LitElement implements UsernameField
|
|
|
213
216
|
*/
|
|
214
217
|
private _dispatchValidate;
|
|
215
218
|
/**
|
|
216
|
-
*
|
|
217
|
-
* fields and non-empty required fields, otherwise dispatching and displaying
|
|
218
|
-
* the required error.
|
|
219
|
-
*/
|
|
220
|
-
private _validateRequired;
|
|
221
|
-
/**
|
|
222
|
-
* Handles the minlength condition validation, determining if a valid
|
|
223
|
-
* `minlength` prop was provided, dispatching and displaying the minlength
|
|
224
|
-
* error if the value is shorter than accepted.
|
|
225
|
-
*/
|
|
226
|
-
private _validateMinlength;
|
|
227
|
-
/**
|
|
228
|
-
* Handles the maxlength condition validation, determining if a valid
|
|
229
|
-
* `maxlength` prop was provided, dispatching and displaying the maxlength
|
|
230
|
-
* error if the value is longer than accepted.
|
|
231
|
-
*/
|
|
232
|
-
private _validateMaxlength;
|
|
233
|
-
/**
|
|
234
|
-
* Handles the format condition validation, testing against `_pattern`, and
|
|
235
|
-
* dispatching and displaying the format error for an invalid value.
|
|
219
|
+
* Clears the invalid state and error, and dispatches a valid validate event.
|
|
236
220
|
*/
|
|
237
|
-
private
|
|
221
|
+
private _handleValidateSuccess;
|
|
238
222
|
/**
|
|
239
|
-
*
|
|
240
|
-
* validate event, indicating a successfully validated and valid username.
|
|
223
|
+
* Sets the invalid state and error, and dispatches an invalid validate event.
|
|
241
224
|
*/
|
|
242
|
-
private
|
|
225
|
+
private _handleValidateError;
|
|
243
226
|
/**
|
|
244
|
-
*
|
|
245
|
-
*
|
|
227
|
+
* Validates the current value against the applicable rules in sequence,
|
|
228
|
+
* dispatches the validate event, and returns `true` if the value passes.
|
|
246
229
|
*/
|
|
247
230
|
private _validate;
|
|
248
231
|
/**
|
|
@@ -2,6 +2,7 @@ import { RtgInputAutocomplete, SbAuthIdentifier } from '../../../../types';
|
|
|
2
2
|
type BaseFieldValidateType = "success" | "required" | "format";
|
|
3
3
|
type BaseFieldValidateTypeWithLength = BaseFieldValidateType | "minlength" | "maxlength";
|
|
4
4
|
type BaseFieldContent = "split" | "group";
|
|
5
|
+
type BaseFieldValidation = "default" | "simple";
|
|
5
6
|
type BaseFieldProps = {
|
|
6
7
|
seed: string;
|
|
7
8
|
childId?: string;
|
|
@@ -15,6 +16,7 @@ type BaseFieldProps = {
|
|
|
15
16
|
caret?: boolean;
|
|
16
17
|
disabled?: boolean;
|
|
17
18
|
required?: boolean;
|
|
19
|
+
validation: BaseFieldValidation;
|
|
18
20
|
requiredError: string;
|
|
19
21
|
formatError: string;
|
|
20
22
|
};
|
|
@@ -26,29 +28,38 @@ type BaseFieldPropsWithLength = BaseFieldProps & {
|
|
|
26
28
|
};
|
|
27
29
|
export type EmailFieldValidateType = BaseFieldValidateType;
|
|
28
30
|
export type EmailFieldContent = BaseFieldContent;
|
|
29
|
-
export type
|
|
31
|
+
export type EmailFieldValidation = BaseFieldValidation;
|
|
32
|
+
export type EmailFieldProps = Omit<BaseFieldProps, "content" | "validation"> & {
|
|
30
33
|
content: EmailFieldContent;
|
|
34
|
+
validation: EmailFieldValidation;
|
|
31
35
|
};
|
|
32
36
|
export type PhoneFieldValidateType = BaseFieldValidateType;
|
|
33
37
|
export type PhoneFieldContent = BaseFieldContent;
|
|
34
|
-
export type
|
|
38
|
+
export type PhoneFieldValidation = BaseFieldValidation;
|
|
39
|
+
export type PhoneFieldProps = Omit<BaseFieldProps, "content" | "validation"> & {
|
|
35
40
|
content: PhoneFieldContent;
|
|
41
|
+
validation: PhoneFieldValidation;
|
|
36
42
|
};
|
|
37
43
|
export type UsernameFieldValidateType = BaseFieldValidateTypeWithLength;
|
|
38
44
|
export type UsernameFieldContent = BaseFieldContent;
|
|
39
|
-
export type
|
|
45
|
+
export type UsernameFieldValidation = BaseFieldValidation;
|
|
46
|
+
export type UsernameFieldProps = Omit<BaseFieldPropsWithLength, "content" | "validation"> & {
|
|
40
47
|
content: UsernameFieldContent;
|
|
41
48
|
pattern?: string;
|
|
49
|
+
validation: UsernameFieldValidation;
|
|
42
50
|
};
|
|
43
51
|
export type NameFieldValidateType = BaseFieldValidateTypeWithLength;
|
|
44
52
|
export type NameFieldContent = BaseFieldContent;
|
|
45
|
-
export type
|
|
53
|
+
export type NameFieldValidation = BaseFieldValidation;
|
|
54
|
+
export type NameFieldProps = Omit<BaseFieldPropsWithLength, "content" | "validation"> & {
|
|
46
55
|
content: NameFieldContent;
|
|
47
56
|
pattern?: string;
|
|
57
|
+
validation: NameFieldValidation;
|
|
48
58
|
};
|
|
49
59
|
export type PasswordFieldValidateType = BaseFieldValidateTypeWithLength;
|
|
50
60
|
export type PasswordFieldVariant = "toggle" | "simple";
|
|
51
61
|
export type PasswordFieldContent = BaseFieldContent;
|
|
62
|
+
export type PasswordFieldValidation = BaseFieldValidation;
|
|
52
63
|
export type PasswordFieldRuleName = "uppercase" | "lowercase" | "number" | "special";
|
|
53
64
|
export type PasswordFieldRule = {
|
|
54
65
|
name: PasswordFieldRuleName;
|
|
@@ -59,28 +70,33 @@ export type PasswordFieldRule = {
|
|
|
59
70
|
pattern: string;
|
|
60
71
|
error?: string;
|
|
61
72
|
};
|
|
62
|
-
export type PasswordFieldProps = Omit<BaseFieldPropsWithLength, "content"> & {
|
|
73
|
+
export type PasswordFieldProps = Omit<BaseFieldPropsWithLength, "content" | "validation"> & {
|
|
63
74
|
variant: PasswordFieldVariant;
|
|
64
75
|
content: PasswordFieldContent;
|
|
65
76
|
rules: PasswordFieldRule[];
|
|
77
|
+
validation: PasswordFieldValidation;
|
|
66
78
|
};
|
|
67
79
|
export type ConfirmFieldValidateType = Exclude<BaseFieldValidateType, "format"> | "match";
|
|
68
80
|
export type ConfirmFieldVariant = PasswordFieldVariant;
|
|
69
81
|
export type ConfirmFieldContent = BaseFieldContent;
|
|
70
|
-
export type
|
|
82
|
+
export type ConfirmFieldValidation = BaseFieldValidation;
|
|
83
|
+
export type ConfirmFieldProps = Omit<BaseFieldProps, "content" | "validation" | "formatError"> & {
|
|
71
84
|
variant: ConfirmFieldVariant;
|
|
72
85
|
content: ConfirmFieldContent;
|
|
73
86
|
pair: string;
|
|
87
|
+
validation: ConfirmFieldValidation;
|
|
74
88
|
matchError: string;
|
|
75
89
|
};
|
|
76
90
|
export type IdentifierFieldValidateType = Exclude<BaseFieldValidateType, "format">;
|
|
77
91
|
export type IdentifierFieldIdentifier = SbAuthIdentifier;
|
|
78
92
|
export type IdentifierFieldContent = BaseFieldContent;
|
|
79
93
|
export type IdentifierFieldAutocomplete = RtgInputAutocomplete;
|
|
80
|
-
export type
|
|
94
|
+
export type IdentifierFieldValidation = BaseFieldValidation;
|
|
95
|
+
export type IdentifierFieldProps = Omit<BaseFieldProps, "label" | "content" | "validation" | "formatError"> & {
|
|
81
96
|
label?: string;
|
|
82
97
|
identifiers: IdentifierFieldIdentifier[];
|
|
83
98
|
content: IdentifierFieldContent;
|
|
84
99
|
autocomplete?: IdentifierFieldAutocomplete;
|
|
100
|
+
validation: IdentifierFieldValidation;
|
|
85
101
|
};
|
|
86
102
|
export {};
|