react-input-material 0.0.409 → 0.0.412
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/components/FileInput.js +1 -1
- package/components/FileInput.styles.css +2 -2
- package/components/GenericInput.js +1 -1
- package/components/GenericInput.module.css +14 -0
- package/components/GenericInput.styles.css +1 -1
- package/components/GenericInput.tsx +5 -5
- package/components/Inputs.js +1 -1
- package/components/Inputs.styles.css +1 -1
- package/components/Inputs.tsx +8 -6
- package/components/Interval.js +1 -1
- package/components/Interval.styles.css +1 -1
- package/components/RequireableCheckbox.js +1 -1
- package/index.js +1 -1
- package/index.styles.css +2 -2
- package/package.json +1 -1
- package/type.d.ts +42 -36
package/package.json
CHANGED
package/type.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface GenericEvent<T = unknown> extends SyntheticEvent {
|
|
|
23
23
|
}
|
|
24
24
|
export interface TestEnvironment {
|
|
25
25
|
container: HTMLDivElement | null;
|
|
26
|
-
render: <T = HTMLElement>(
|
|
26
|
+
render: <T = HTMLElement>(component: ReactElement) => null | T;
|
|
27
27
|
}
|
|
28
28
|
export interface CursorState {
|
|
29
29
|
end: number;
|
|
@@ -102,14 +102,14 @@ export declare type DefaultBaseProperties = Omit<BaseProps, 'model'> & {
|
|
|
102
102
|
export interface TypedProperties<T = unknown> extends BaseProperties {
|
|
103
103
|
initialValue: null | T;
|
|
104
104
|
model: Model<T>;
|
|
105
|
-
onBlur: (
|
|
106
|
-
onChange: (
|
|
107
|
-
onChangeShowDeclaration: (
|
|
108
|
-
onChangeState: (
|
|
109
|
-
onChangeValue: (
|
|
110
|
-
onClick: (
|
|
111
|
-
onFocus: (
|
|
112
|
-
onTouch: (
|
|
105
|
+
onBlur: (event: GenericEvent | undefined, properties: this) => void;
|
|
106
|
+
onChange: (properties: this, event?: GenericEvent) => void;
|
|
107
|
+
onChangeShowDeclaration: (show: boolean, event: GenericEvent | undefined, properties: this) => void;
|
|
108
|
+
onChangeState: (state: ModelState, event: GenericEvent | undefined, properties: this) => void;
|
|
109
|
+
onChangeValue: (value: null | T, event: GenericEvent | undefined, properties: this) => void;
|
|
110
|
+
onClick: (event: MouseEvent, properties: this) => void;
|
|
111
|
+
onFocus: (event: FocusEvent, properties: this) => void;
|
|
112
|
+
onTouch: (event: GenericEvent, properties: this) => void;
|
|
113
113
|
}
|
|
114
114
|
export declare type Properties<T = unknown> = TypedProperties<T> & CommonModel<T>;
|
|
115
115
|
export declare type Props<T = unknown> = Partial<Omit<Properties<T>, 'model'>> & {
|
|
@@ -138,11 +138,11 @@ export interface StaticWebComponent<MS = ModelState, DP = DefaultProperties> ext
|
|
|
138
138
|
export declare type StaticComponent<P = Props, MS = ModelState, DP = DefaultProperties> = Omit<ComponentClass<P>, 'propTypes'> & StaticWebComponent<MS, DP>;
|
|
139
139
|
export declare type StaticFunctionComponent<P = Props, MS = ModelState, DP = DefaultProperties> = Omit<FunctionComponent<P>, 'propTypes'> & StaticComponent<P, MS, DP>;
|
|
140
140
|
export interface InputComponent<P = Props, MS = ModelState, DP = DefaultProperties, A = ComponentAdapter<P>> extends Omit<ForwardRefExoticComponent<P>, 'propTypes'>, StaticWebComponent<MS, DP> {
|
|
141
|
-
(
|
|
141
|
+
(props: P & RefAttributes<A>): ReactElement;
|
|
142
142
|
}
|
|
143
143
|
export declare const baseModelPropertyTypes: ValidationMapping;
|
|
144
144
|
export declare const modelStatePropertyTypes: {
|
|
145
|
-
[
|
|
145
|
+
[key in keyof ModelState]: Requireable<boolean | symbol>;
|
|
146
146
|
};
|
|
147
147
|
export declare const modelPropertyTypes: ValidationMapping;
|
|
148
148
|
export declare const propertyTypes: ValidationMapping;
|
|
@@ -193,7 +193,7 @@ export declare type InputDataTransformation = {
|
|
|
193
193
|
number: DataTransformSpecification<number, number>;
|
|
194
194
|
string?: DataTransformSpecification<unknown>;
|
|
195
195
|
} & {
|
|
196
|
-
[
|
|
196
|
+
[key in Exclude<NativeInputType, 'date' | 'datetime-local' | 'time' | 'number'>]?: DataTransformSpecification<unknown>;
|
|
197
197
|
};
|
|
198
198
|
export declare type NormalizedSelection = Array<Omit<FormattedSelectionOption, 'value'> & {
|
|
199
199
|
value: unknown;
|
|
@@ -233,7 +233,7 @@ export interface SuggestionCreatorOptions<P> {
|
|
|
233
233
|
}
|
|
234
234
|
export interface InputProperties<T = unknown> extends InputModelState, Properties<T> {
|
|
235
235
|
align: 'end' | 'start';
|
|
236
|
-
children: (
|
|
236
|
+
children: (options: InputChildrenOptions<this, T>) => null | ReactElement;
|
|
237
237
|
cursor: CursorState;
|
|
238
238
|
editor: ('code' | 'code(css)' | 'code(script)' | 'plain' | 'text' | 'richtext(raw)' | 'richtext(simple)' | 'richtext(normal)' | 'richtext(advanced)');
|
|
239
239
|
editorIsActive: boolean;
|
|
@@ -249,11 +249,11 @@ export interface InputProperties<T = unknown> extends InputModelState, Propertie
|
|
|
249
249
|
minimumLengthText: string;
|
|
250
250
|
minimumText: string;
|
|
251
251
|
model: InputModel<T>;
|
|
252
|
-
onChangeEditorIsActive: (
|
|
253
|
-
onKeyDown: (
|
|
254
|
-
onKeyUp: (
|
|
255
|
-
onSelect: (
|
|
256
|
-
onSelectionChange: (
|
|
252
|
+
onChangeEditorIsActive: (isActive: boolean, event: MouseEvent | undefined, properties: this) => void;
|
|
253
|
+
onKeyDown: (event: KeyboardEvent, properties: this) => void;
|
|
254
|
+
onKeyUp: (event: KeyboardEvent, properties: this) => void;
|
|
255
|
+
onSelect: (event: GenericEvent, properties: this) => void;
|
|
256
|
+
onSelectionChange: (event: GenericEvent, properties: this) => void;
|
|
257
257
|
outlined: boolean;
|
|
258
258
|
patternText: string;
|
|
259
259
|
placeholder: string;
|
|
@@ -262,7 +262,7 @@ export interface InputProperties<T = unknown> extends InputModelState, Propertie
|
|
|
262
262
|
searchSelection: boolean;
|
|
263
263
|
selectableEditor: boolean;
|
|
264
264
|
step: number;
|
|
265
|
-
suggestionCreator?: (
|
|
265
|
+
suggestionCreator?: (options: SuggestionCreatorOptions<this>) => InputProperties['selection'] | Promise<InputProperties['selection']>;
|
|
266
266
|
suggestSelection: boolean;
|
|
267
267
|
trailingIcon: string | (IconOptions & {
|
|
268
268
|
tooltip?: string | TooltipProps;
|
|
@@ -276,7 +276,7 @@ export declare type DefaultInputProperties<T = string> = Omit<InputProps<T>, 'mo
|
|
|
276
276
|
model: InputModel<T>;
|
|
277
277
|
};
|
|
278
278
|
export declare type InputPropertyTypes<T = unknown> = {
|
|
279
|
-
[
|
|
279
|
+
[key in keyof InputProperties<T>]: ValueOf<typeof PropertyTypes>;
|
|
280
280
|
};
|
|
281
281
|
export interface InputState<T = unknown> extends State<T> {
|
|
282
282
|
cursor: CursorState;
|
|
@@ -309,12 +309,12 @@ export interface TinyMCEOptions extends RawTinyMCEOptions {
|
|
|
309
309
|
target?: undefined;
|
|
310
310
|
}
|
|
311
311
|
export interface GenericInputComponent extends Omit<ForwardRefExoticComponent<InputProps>, 'propTypes'>, StaticWebComponent<InputModelState, DefaultInputProperties> {
|
|
312
|
-
<T = string>(
|
|
312
|
+
<T = string>(props: InputProps<T> & RefAttributes<InputAdapter<T>>): ReactElement;
|
|
313
313
|
locales: Array<string>;
|
|
314
314
|
transformer: InputDataTransformation;
|
|
315
315
|
}
|
|
316
316
|
export declare const inputModelStatePropertyTypes: {
|
|
317
|
-
[
|
|
317
|
+
[key in keyof InputModelState]: Requireable<boolean | symbol>;
|
|
318
318
|
};
|
|
319
319
|
export declare const inputPropertyTypes: PropertiesValidationMap;
|
|
320
320
|
export declare const inputRenderProperties: Array<string>;
|
|
@@ -353,7 +353,7 @@ export interface FileInputChildrenOptions<P> {
|
|
|
353
353
|
value?: FileValue | null;
|
|
354
354
|
}
|
|
355
355
|
export interface FileInputProperties extends Properties<FileValue>, FileInputModelState {
|
|
356
|
-
children: (
|
|
356
|
+
children: (options: FileInputChildrenOptions<this>) => null | ReactElement;
|
|
357
357
|
contentTypePattern: Array<RegExp | string> | null | RegExp | string;
|
|
358
358
|
invertedContentTypePattern: Array<RegExp | string> | null | RegExp | string;
|
|
359
359
|
contentTypePatternText: string;
|
|
@@ -365,7 +365,7 @@ export interface FileInputProperties extends Properties<FileValue>, FileInputMod
|
|
|
365
365
|
editButton: ReactElement | string;
|
|
366
366
|
newButton: ReactElement | string;
|
|
367
367
|
encoding: string;
|
|
368
|
-
generateFileNameInputProperties: (
|
|
368
|
+
generateFileNameInputProperties: (prototype: InputProps<string>, properties: this & {
|
|
369
369
|
value: FileValue & {
|
|
370
370
|
name: string;
|
|
371
371
|
};
|
|
@@ -385,7 +385,7 @@ export declare type DefaultFileInputProperties = Omit<FileInputProps, 'model'> &
|
|
|
385
385
|
model: FileInputModel;
|
|
386
386
|
};
|
|
387
387
|
export declare type FileInputPropertyTypes = {
|
|
388
|
-
[
|
|
388
|
+
[key in keyof FileInputProperties]: ValueOf<typeof PropertyTypes>;
|
|
389
389
|
};
|
|
390
390
|
export interface FileInputState extends State<FileValue> {
|
|
391
391
|
modelState: FileInputModelState;
|
|
@@ -404,7 +404,7 @@ export interface FileInputAdapterWithReferences extends FileInputAdapter {
|
|
|
404
404
|
}
|
|
405
405
|
export declare type FileInputComponent = InputComponent<FileInputProps, FileInputModelState, DefaultFileInputProperties, FileInputAdapter>;
|
|
406
406
|
export declare const fileInputModelStatePropertyTypes: {
|
|
407
|
-
[
|
|
407
|
+
[key in keyof FileInputModelState]: Requireable<boolean | symbol>;
|
|
408
408
|
};
|
|
409
409
|
export declare const fileInputPropertyTypes: PropertiesValidationMap;
|
|
410
410
|
export declare const defaultFileInputModelState: FileInputModelState;
|
|
@@ -418,12 +418,17 @@ export interface InputsPropertiesItem<T, TS = unknown> {
|
|
|
418
418
|
};
|
|
419
419
|
value?: null | T;
|
|
420
420
|
}
|
|
421
|
-
export interface
|
|
421
|
+
export interface InputsCreateOptions<T, IP> {
|
|
422
422
|
index: number;
|
|
423
423
|
properties: IP;
|
|
424
|
-
prototype: Partial<P>;
|
|
425
424
|
values: Array<null | T | undefined> | null;
|
|
426
425
|
}
|
|
426
|
+
export interface InputsCreateItemOptions<T, P extends InputsPropertiesItem<T>, IP> extends InputsCreateOptions<T, IP> {
|
|
427
|
+
item: Partial<P>;
|
|
428
|
+
}
|
|
429
|
+
export interface InputsCreatePrototypeOptions<T, P extends InputsPropertiesItem<T>, IP> extends InputsCreateItemOptions<T, P, IP> {
|
|
430
|
+
lastValue: null | T | undefined;
|
|
431
|
+
}
|
|
427
432
|
export interface InputsModelState extends ModelState {
|
|
428
433
|
invalidMaximumNumber: boolean;
|
|
429
434
|
invalidMinimumNumber: boolean;
|
|
@@ -442,12 +447,13 @@ export interface InputsChildrenOptions<T, P extends InputsPropertiesItem<T>, IP>
|
|
|
442
447
|
export interface InputsProperties<T = unknown, P extends InputsPropertiesItem<T> = Properties<T>> extends InputsModelState, Omit<Properties<Array<P>>, 'onChangeValue'> {
|
|
443
448
|
addIcon: IconOptions;
|
|
444
449
|
removeIcon: IconOptions;
|
|
445
|
-
children: (
|
|
446
|
-
|
|
450
|
+
children: (options: InputsChildrenOptions<T, P, this>) => ReactElement;
|
|
451
|
+
createItem: (options: InputsCreateItemOptions<T, P, this>) => P;
|
|
452
|
+
createPrototype: (options: InputsCreatePrototypeOptions<T, P, this>) => P;
|
|
447
453
|
maximumNumber: number;
|
|
448
454
|
minimumNumber: number;
|
|
449
455
|
model: InputsModel<T, P>;
|
|
450
|
-
onChangeValue: (
|
|
456
|
+
onChangeValue: (values: Array<null | T> | null, event: GenericEvent | unknown, properties: this) => void;
|
|
451
457
|
value: Array<P> | null;
|
|
452
458
|
writable: boolean;
|
|
453
459
|
}
|
|
@@ -459,7 +465,7 @@ export declare type DefaultInputsProperties<T = string, P extends InputsProperti
|
|
|
459
465
|
model: InputsModel<T, P>;
|
|
460
466
|
};
|
|
461
467
|
export declare type InputsPropertyTypes<T = unknown, P extends InputsPropertiesItem<T> = Properties<T>> = {
|
|
462
|
-
[
|
|
468
|
+
[key in keyof InputsProperties<P>]: ValueOf<typeof PropertyTypes>;
|
|
463
469
|
};
|
|
464
470
|
export declare type InputsState<T = unknown> = State<Array<null | T | undefined>>;
|
|
465
471
|
export declare type InputsAdapter<T = unknown, P extends InputsPropertiesItem<T> = Properties<T>> = ComponentAdapter<InputsProperties<T, P>, InputsState<T>>;
|
|
@@ -467,7 +473,7 @@ export declare type InputsAdapterWithReferences<T = unknown, P extends InputsPro
|
|
|
467
473
|
references: Array<MutableRefObject<RefType>>;
|
|
468
474
|
};
|
|
469
475
|
export interface InputsComponent extends Omit<ForwardRefExoticComponent<InputsProps>, 'propTypes'>, StaticWebComponent<InputsModelState, DefaultInputsProperties> {
|
|
470
|
-
<T = string, P extends InputsPropertiesItem<T> = InputProperties<T>>(
|
|
476
|
+
<T = string, P extends InputsPropertiesItem<T> = InputProperties<T>>(props: InputsProps<T, P> & RefAttributes<InputsAdapter<T, P>>): ReactElement;
|
|
471
477
|
}
|
|
472
478
|
export declare const inputsPropertyTypes: PropertiesValidationMap;
|
|
473
479
|
export declare const inputsRenderProperties: Array<string>;
|
|
@@ -493,8 +499,8 @@ export interface IntervalModel {
|
|
|
493
499
|
export interface IntervalProperties extends Omit<InputProperties<number>, 'icon' | 'model' | 'onChange' | 'onChangeValue' | 'value'> {
|
|
494
500
|
icon: IconOptions;
|
|
495
501
|
model: IntervalModel;
|
|
496
|
-
onChange: (
|
|
497
|
-
onChangeValue: (
|
|
502
|
+
onChange: (properties: this, event?: GenericEvent) => void;
|
|
503
|
+
onChangeValue: (value: null | IntervalValue, event?: GenericEvent) => void;
|
|
498
504
|
value: IntervalConfiguration;
|
|
499
505
|
}
|
|
500
506
|
export declare type IntervalProps = Omit<InputProps<number>, 'icon' | 'model' | 'onChange' | 'onChangeValue' | 'value'> & Partial<{
|
|
@@ -510,7 +516,7 @@ export declare type DefaultIntervalProperties = Omit<IntervalProps, 'model'> & {
|
|
|
510
516
|
model: IntervalModel;
|
|
511
517
|
};
|
|
512
518
|
export declare type IntervalPropertyTypes = {
|
|
513
|
-
[
|
|
519
|
+
[key in keyof IntervalProperties]: ValueOf<typeof PropertyTypes>;
|
|
514
520
|
};
|
|
515
521
|
export declare type IntervalAdapter = ComponentAdapter<IntervalProperties, {
|
|
516
522
|
value?: IntervalValue | null;
|