react-input-material 0.0.761 → 0.0.763
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/Checkbox/harness.js +1 -0
- package/package.json +2 -1
- package/dist/components/Checkbox/harness.d.ts +0 -9
- package/dist/components/Checkbox/index.d.ts +0 -43
- package/dist/components/Checkbox/type.d.ts +0 -26
- package/dist/components/FileInput/harness.d.ts +0 -18
- package/dist/components/FileInput/helper.d.ts +0 -51
- package/dist/components/FileInput/index.d.ts +0 -40
- package/dist/components/FileInput/type.d.ts +0 -115
- package/dist/components/Inputs/harness.d.ts +0 -5
- package/dist/components/Inputs/index.d.ts +0 -29
- package/dist/components/Inputs/type.d.ts +0 -79
- package/dist/components/Interval/harness.d.ts +0 -5
- package/dist/components/Interval/index.d.ts +0 -25
- package/dist/components/Interval/type.d.ts +0 -85
- package/dist/components/TextInput/harness.d.ts +0 -9
- package/dist/components/TextInput/helper.d.ts +0 -38
- package/dist/components/TextInput/index.d.ts +0 -44
- package/dist/components/TextInput/type.d.ts +0 -201
- package/dist/components/Wrapper/WrapConfigurations.d.ts +0 -37
- package/dist/components/Wrapper/WrapStrict.d.ts +0 -14
- package/dist/components/Wrapper/WrapThemeProvider.d.ts +0 -18
- package/dist/components/Wrapper/WrapTooltip.d.ts +0 -16
- package/dist/helper.d.ts +0 -164
- package/dist/index.d.ts +0 -16
- package/dist/type.d.ts +0 -143
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";if("undefined"!=typeof module&&null!==module&&"undefined"!==eval("typeof require")&&null!==eval("require")&&"main"in eval("require")&&"undefined"!==eval("typeof require.main")&&null!==eval("require.main")){var ORIGINAL_MAIN_MODULE=module;module!==eval("require.main")&&"paths"in module&&"paths"in eval("require.main")&&"undefined"!=typeof __dirname&&null!==__dirname&&(module.paths=eval("require.main.paths").concat(module.paths.filter(function(path){return eval("require.main.paths").includes(path)})))}if(null==window)var window="undefined"==typeof global||null===global?{}:global;!function(e,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var t=n();for(var i in t)("object"==typeof exports?exports:e)[i]=t[i]}}(this,function(){return function(){var e={d:function(n,t){for(var i in t)e.o(t,i)&&!e.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},o:function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};e.r(n),e.d(n,{checkboxInput:function(){return t}});var t=function(e){var n=e.locator("input");return{main:e,inputNode:n,check:n.check.bind(n),uncheck:n.uncheck.bind(n),setChecked:n.setChecked.bind(n),isChecked:function(){return n.isChecked()}}};return n.default=t,n}()});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-input-material",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.763",
|
|
4
4
|
"description": "Reusable material design based input field with support for (richt-)text, code, selections, numbers, dates and so on.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"form-field",
|
|
@@ -402,6 +402,7 @@
|
|
|
402
402
|
},
|
|
403
403
|
"generic": {
|
|
404
404
|
"entry": {
|
|
405
|
+
"./components/Checkbox/harness": "./components/Checkbox/harness",
|
|
405
406
|
"./components/Checkbox/import.module": "./implementations/rmwc/Checkbox/import.module",
|
|
406
407
|
"./components/Checkbox/index": "./components/Checkbox/index",
|
|
407
408
|
"./components/Checkbox/type": "./components/Checkbox/type",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Locator } from 'playwright-core';
|
|
2
|
-
export declare const checkboxInput: (parent: Locator) => {
|
|
3
|
-
main: Locator;
|
|
4
|
-
inputNode: Locator;
|
|
5
|
-
check: () => Promise<void>;
|
|
6
|
-
uncheck: () => Promise<void>;
|
|
7
|
-
isChecked: () => Promise<boolean>;
|
|
8
|
-
};
|
|
9
|
-
export default checkboxInput;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { ForwardRefRenderFunction } from 'react';
|
|
2
|
-
import { Adapter, Component, DefaultProperties, ModelState, Props } from './type';
|
|
3
|
-
/**
|
|
4
|
-
* Derives validation state from provided properties and state.
|
|
5
|
-
* @param properties - Current component properties.
|
|
6
|
-
* @param currentState - Current component state.
|
|
7
|
-
* @returns Whether component is in an aggregated valid or invalid state.
|
|
8
|
-
*/
|
|
9
|
-
export declare function determineValidationState(properties: DefaultProperties, currentState: Partial<ModelState>): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Wrapper component for checkboxes to validate.
|
|
12
|
-
* @property displayName - Descriptive name for component to show in web
|
|
13
|
-
* developer tools.
|
|
14
|
-
* Dataflow:
|
|
15
|
-
* 1. On-Render all states are merged with given properties into a normalized
|
|
16
|
-
* property object.
|
|
17
|
-
* 2. Properties, corresponding state values and sub node instances are saved
|
|
18
|
-
* into a "ref" object (to make them accessible from the outside for example
|
|
19
|
-
* for wrapper like web-components).
|
|
20
|
-
* 3. Event handler saves corresponding data modifications into state and
|
|
21
|
-
* normalized properties object.
|
|
22
|
-
* 4. All state changes except selection changes trigger an "onChange" event
|
|
23
|
-
* which delivers the consolidated properties object (with latest
|
|
24
|
-
* modifications included).
|
|
25
|
-
* @param props - Given components properties.
|
|
26
|
-
* @param reference - Reference object to forward internal state.
|
|
27
|
-
* @returns React elements.
|
|
28
|
-
*/
|
|
29
|
-
export declare const CheckboxInner: ForwardRefRenderFunction<Adapter, Props>;
|
|
30
|
-
/**
|
|
31
|
-
* Wrapping web component compatible react component.
|
|
32
|
-
* @property defaultModelState - Initial model state.
|
|
33
|
-
* @property defaultProperties - Initial property configuration.
|
|
34
|
-
* @property propTypes - Triggers reacts runtime property value checks.
|
|
35
|
-
* @property strict - Indicates whether we should wrap render output in reacts
|
|
36
|
-
* strict component.
|
|
37
|
-
* @property wrapped - Wrapped component.
|
|
38
|
-
* @param props - Given components properties.
|
|
39
|
-
* @param reference - Reference object to forward internal state.
|
|
40
|
-
* @returns React elements.
|
|
41
|
-
*/
|
|
42
|
-
export declare const Checkbox: Component<typeof CheckboxInner>;
|
|
43
|
-
export default Checkbox;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ComponentAdapter, ValidationMapping } from 'web-component-wrapper/type';
|
|
2
|
-
import { BaseModel, Component as BaseComponent, ModelState as BaseModelState, Properties as BaseProperties, State as BaseState, ValueState as BaseValueState } from '../../type';
|
|
3
|
-
export interface Properties extends BaseProperties<boolean | null> {
|
|
4
|
-
default?: boolean;
|
|
5
|
-
checked: boolean;
|
|
6
|
-
id: string;
|
|
7
|
-
}
|
|
8
|
-
export interface Model extends BaseModel<boolean | null> {
|
|
9
|
-
default?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export type ModelState = BaseModelState;
|
|
12
|
-
export type ValueState = BaseValueState<boolean>;
|
|
13
|
-
export type Props = Partial<Omit<Properties, 'model'>> & {
|
|
14
|
-
model?: (Partial<Omit<Model, 'state'>> & {
|
|
15
|
-
state?: Partial<ModelState>;
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
export type DefaultProperties = Omit<Props, 'model'> & {
|
|
19
|
-
model: Model;
|
|
20
|
-
};
|
|
21
|
-
export type State = BaseState<boolean>;
|
|
22
|
-
export type Adapter = ComponentAdapter<Properties, Omit<State, 'value'>>;
|
|
23
|
-
export type Component<ComponentType> = BaseComponent<boolean, ComponentType, Props, ModelState, DefaultProperties, Adapter>;
|
|
24
|
-
export declare const propertyTypes: ValidationMapping;
|
|
25
|
-
export declare const defaultModel: Model;
|
|
26
|
-
export declare const defaultProperties: DefaultProperties;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { FirstParameter } from 'clientnode';
|
|
2
|
-
import { FileChooser, Locator, Page } from 'playwright-core';
|
|
3
|
-
export declare const fileInput: (parent: Locator) => {
|
|
4
|
-
main: Locator;
|
|
5
|
-
inputNode: Locator;
|
|
6
|
-
nameInput: {
|
|
7
|
-
main: Locator;
|
|
8
|
-
inputNode: Locator;
|
|
9
|
-
getOptions: () => Promise<string[]>;
|
|
10
|
-
fill: (valueRepresentation: string) => Promise<void>;
|
|
11
|
-
inputValue: () => Promise<string | null>;
|
|
12
|
-
};
|
|
13
|
-
openFileChooser: () => Promise<void>;
|
|
14
|
-
getFileChooser: (page: Page) => Promise<FileChooser>;
|
|
15
|
-
fillFiles: (page: Page, files: FirstParameter<FileChooser["setFiles"]>) => Promise<void>;
|
|
16
|
-
getFiles: () => Promise<string>;
|
|
17
|
-
};
|
|
18
|
-
export default fileInput;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { ElementType } from 'react';
|
|
2
|
-
import { Props } from '../TextInput/type';
|
|
3
|
-
import { DefaultProperties as DefaultProperties, ModelState as ModelState, Value, RepresentationType as RepresentationType, Properties } from './type';
|
|
4
|
-
export declare const CSS_CLASS_NAMES: Record<string, string>;
|
|
5
|
-
export declare const IMAGE_CONTENT_TYPE_REGULAR_EXPRESSION: RegExp;
|
|
6
|
-
export declare const TEXT_CONTENT_TYPE_REGULAR_EXPRESSION: RegExp;
|
|
7
|
-
export declare const EMBEDABLE_TEXT_CONTENT_TYPE_REGULAR_EXPRESSION: RegExp;
|
|
8
|
-
export declare const VIDEO_CONTENT_TYPE_REGULAR_EXPRESSION: RegExp;
|
|
9
|
-
/**
|
|
10
|
-
* Generates properties for nested text input to edit file name.
|
|
11
|
-
* @param prototype - Base properties to extend from.
|
|
12
|
-
* @param properties - Actual properties to derive from.
|
|
13
|
-
* @param properties.name - Name of filename input field.
|
|
14
|
-
* @param properties.value - Current edited file value.
|
|
15
|
-
* @returns Input properties.
|
|
16
|
-
*/
|
|
17
|
-
export declare const preserveStaticFileBaseNameInputGenerator: <Type extends Value = Value, MediaTag extends ElementType = "div">(prototype: Props<string>, { name, value }: Properties<Type, MediaTag>) => Props<string>;
|
|
18
|
-
/**
|
|
19
|
-
* Determines files content type for given file input properties.
|
|
20
|
-
* @param properties - File input properties to analyze.
|
|
21
|
-
* @returns The determined content type.
|
|
22
|
-
*/
|
|
23
|
-
export declare const determineContentType: <Type extends Value = Value>(properties: Properties<Type>) => null | string;
|
|
24
|
-
/**
|
|
25
|
-
* Determines which type of file we have to present.
|
|
26
|
-
* @param contentType - File type to derive representation type from.
|
|
27
|
-
* @returns Representative string for given content type.
|
|
28
|
-
*/
|
|
29
|
-
export declare const determineRepresentationType: (contentType: string) => RepresentationType;
|
|
30
|
-
/**
|
|
31
|
-
* Derives validation state from provided properties and state.
|
|
32
|
-
* @param properties - Current component properties.
|
|
33
|
-
* @param invalidName - Determines if edited file name is invalid or not.
|
|
34
|
-
* @param currentState - Current component state.
|
|
35
|
-
* @returns Boolean indicating Whether component is in an aggregated valid or
|
|
36
|
-
* invalid state.
|
|
37
|
-
*/
|
|
38
|
-
export declare const determineValidationState: <Type extends Value = Value, P extends DefaultProperties<Type> = DefaultProperties<Type>>(properties: P, invalidName: boolean, currentState: ModelState) => boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Derive base46 string from given file value.
|
|
41
|
-
* @param value - File to derive string from.
|
|
42
|
-
* @returns A promise holding base64 string.
|
|
43
|
-
*/
|
|
44
|
-
export declare const deriveBase64String: <Type extends Value = Value>(value: Type) => Promise<string>;
|
|
45
|
-
/**
|
|
46
|
-
* Read text from given binary data with given encoding.
|
|
47
|
-
* @param blob - Binary data object.
|
|
48
|
-
* @param encoding - Encoding for reading file correctly.
|
|
49
|
-
* @returns A promise holding parsed text as string.
|
|
50
|
-
*/
|
|
51
|
-
export declare const readBinaryDataIntoText: (blob: Blob, encoding?: string) => Promise<string>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ForwardedRef, ReactElement } from 'react';
|
|
2
|
-
import { AdapterWithReferences, Component, Props, Value } from './type';
|
|
3
|
-
export { CSS_CLASS_NAMES, IMAGE_CONTENT_TYPE_REGULAR_EXPRESSION, TEXT_CONTENT_TYPE_REGULAR_EXPRESSION, EMBEDABLE_TEXT_CONTENT_TYPE_REGULAR_EXPRESSION, VIDEO_CONTENT_TYPE_REGULAR_EXPRESSION, determineRepresentationType, determineValidationState, deriveBase64String, readBinaryDataIntoText, preserveStaticFileBaseNameInputGenerator } from './helper';
|
|
4
|
-
/**
|
|
5
|
-
* Validatable checkbox wrapper component.
|
|
6
|
-
* @property displayName - Descriptive name for component to show in web
|
|
7
|
-
* developer tools.
|
|
8
|
-
* Dataflow:
|
|
9
|
-
* 1. On-Render all states are merged with given properties into a normalized
|
|
10
|
-
* property object.
|
|
11
|
-
* 2. Properties, corresponding state values and sub node instances are saved
|
|
12
|
-
* into a "ref" object (to make them accessible from the outside for example
|
|
13
|
-
* for wrapper like web-components).
|
|
14
|
-
* 3. Event handler saves corresponding data modifications into state and
|
|
15
|
-
* normalized properties object.
|
|
16
|
-
* 4. All state changes except selection changes trigger an "onChange" event
|
|
17
|
-
* which delivers the consolidated properties object (with latest
|
|
18
|
-
* modifications included).
|
|
19
|
-
* @param props - Given components properties.
|
|
20
|
-
* @param reference - Reference object to forward internal state.
|
|
21
|
-
* @returns React elements.
|
|
22
|
-
*/
|
|
23
|
-
export declare const FileInputInner: {
|
|
24
|
-
<Type extends Value = Value>(props: Props<Type>, reference?: ForwardedRef<AdapterWithReferences<Type>>): ReactElement;
|
|
25
|
-
displayName: string;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Wrapping web component compatible react component.
|
|
29
|
-
* @property defaultModelState - Initial model state.
|
|
30
|
-
* @property defaultProperties - Initial property configuration.
|
|
31
|
-
* @property propTypes - Triggers reacts runtime property value checks.
|
|
32
|
-
* @property strict - Indicates whether we should wrap render output in reacts
|
|
33
|
-
* strict component.
|
|
34
|
-
* @property wrapped - Wrapped component.
|
|
35
|
-
* @param props - Given components properties.
|
|
36
|
-
* @param reference - Reference object to forward internal state.
|
|
37
|
-
* @returns React elements.
|
|
38
|
-
*/
|
|
39
|
-
export declare const FileInput: Component<typeof FileInputInner>;
|
|
40
|
-
export default FileInput;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { Mapping, ValueOf } from 'clientnode';
|
|
2
|
-
import BasePropertyTypes, { Requireable } from 'clientnode/property-types';
|
|
3
|
-
import { ElementType, ForwardRefExoticComponent, ReactElement, ReactNode, RefAttributes, RefObject } from 'react';
|
|
4
|
-
import { ComponentAdapter, ValidationMapping } from 'web-component-wrapper/type';
|
|
5
|
-
import { Adapter as TextInputAdapter, Model as TextInputModel, Props as TextInputProps, PartialModel as PartialTextInputModel } from '../TextInput/type';
|
|
6
|
-
import { BaseModel, ModelState as BaseModelState, Pattern, Properties as BaseProperties, State as BaseState, StaticWebComponent, ValueState as BaseValueState } from '../../type';
|
|
7
|
-
import { MediaCardReference } from '../../implementations/type';
|
|
8
|
-
export declare enum RepresentationType {
|
|
9
|
-
BINARY = "binary",
|
|
10
|
-
IMAGE = "image",
|
|
11
|
-
EMBEDABLE_TEXT = "embedableText",
|
|
12
|
-
TEXT = "text",
|
|
13
|
-
VIDEO = "video"
|
|
14
|
-
}
|
|
15
|
-
export type BlobType = Blob | Buffer | string;
|
|
16
|
-
export interface Value {
|
|
17
|
-
blob?: Partial<BlobType>;
|
|
18
|
-
hash?: string;
|
|
19
|
-
name?: string;
|
|
20
|
-
source?: string;
|
|
21
|
-
url?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface ValueState<Type extends Value = Value> extends BaseValueState<Type, ModelState> {
|
|
24
|
-
attachBlobProperty: boolean;
|
|
25
|
-
}
|
|
26
|
-
export interface ModelState extends BaseModelState {
|
|
27
|
-
invalidMaximumSize: boolean;
|
|
28
|
-
invalidMinimumSize: boolean;
|
|
29
|
-
invalidContentTypePattern: boolean;
|
|
30
|
-
invalidInvertedContentTypePattern: boolean;
|
|
31
|
-
invalidName: boolean;
|
|
32
|
-
}
|
|
33
|
-
export interface Model<Type extends Value = Value> extends Omit<BaseModel<null | Type>, 'default'> {
|
|
34
|
-
default?: Mapping<Type>;
|
|
35
|
-
contentTypePattern?: Pattern;
|
|
36
|
-
invertedContentTypePattern?: Pattern;
|
|
37
|
-
maximumSize: number;
|
|
38
|
-
minimumSize: number;
|
|
39
|
-
fileName: TextInputModel<string>;
|
|
40
|
-
state?: ModelState;
|
|
41
|
-
}
|
|
42
|
-
export interface ChildrenOptions<P, Type extends Value = Value> {
|
|
43
|
-
declaration: string;
|
|
44
|
-
invalid: boolean;
|
|
45
|
-
properties: P;
|
|
46
|
-
value?: null | Type;
|
|
47
|
-
}
|
|
48
|
-
export interface Properties<Type extends Value = Value, MediaTag extends ElementType = 'div'> extends BaseProperties<null | Type>, ModelState {
|
|
49
|
-
default?: Mapping<Type>;
|
|
50
|
-
children?: (options: ChildrenOptions<Properties<Type, MediaTag>, Type>) => ReactNode;
|
|
51
|
-
fileInputClassNames?: Array<string>;
|
|
52
|
-
imageClassNames?: Array<string>;
|
|
53
|
-
contentTypePattern: Array<RegExp | string> | null | RegExp | string;
|
|
54
|
-
invertedContentTypePattern: Array<RegExp | string> | null | RegExp | string;
|
|
55
|
-
contentTypePatternText: string;
|
|
56
|
-
invertedContentTypePatternText: string;
|
|
57
|
-
maximumSizeText: string;
|
|
58
|
-
minimumSizeText: string;
|
|
59
|
-
deleteButton: ReactNode;
|
|
60
|
-
downloadButton: ReactNode;
|
|
61
|
-
editButton: ReactNode;
|
|
62
|
-
newButton: ReactNode;
|
|
63
|
-
encoding: string;
|
|
64
|
-
generateFileNameInputProperties: (prototype: TextInputProps<string>, properties: Properties<Type, MediaTag>) => TextInputProps<string> | null;
|
|
65
|
-
model: Model<Type>;
|
|
66
|
-
outlined: boolean;
|
|
67
|
-
sourceToBlobOptions?: {
|
|
68
|
-
endings?: 'native' | 'transparent';
|
|
69
|
-
type?: string;
|
|
70
|
-
};
|
|
71
|
-
hashingConfiguration: {
|
|
72
|
-
binaryString: boolean;
|
|
73
|
-
prefix: string;
|
|
74
|
-
readChunkSizeInByte: number;
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
export type Props<Type extends Value = Value> = Partial<Omit<Properties<Type>, 'model'>> & {
|
|
78
|
-
model?: (Partial<Omit<Model<Type>, 'fileName' | 'state'>> & {
|
|
79
|
-
fileName?: PartialTextInputModel<string>;
|
|
80
|
-
state?: Partial<ModelState>;
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
export type DefaultProperties<Type extends Value = Value> = Omit<Props<Type>, 'model'> & {
|
|
84
|
-
model: Model<Type>;
|
|
85
|
-
};
|
|
86
|
-
export type PropertyTypes = {
|
|
87
|
-
[key in keyof Properties]: ValueOf<typeof BasePropertyTypes>;
|
|
88
|
-
};
|
|
89
|
-
export declare const renderProperties: Array<string>;
|
|
90
|
-
export interface State<Type extends Value = Value> extends BaseState<Type> {
|
|
91
|
-
modelState: ModelState;
|
|
92
|
-
}
|
|
93
|
-
export type Adapter<Type extends Value = Value> = ComponentAdapter<Properties<Type>, Omit<State<Type>, 'value'> & {
|
|
94
|
-
value?: null | Type;
|
|
95
|
-
}>;
|
|
96
|
-
export interface AdapterWithReferences<Type extends Value = Value> extends Adapter<Type> {
|
|
97
|
-
references: {
|
|
98
|
-
fileInput: RefObject<HTMLInputElement | null>;
|
|
99
|
-
mediaCard: RefObject<MediaCardReference | null>;
|
|
100
|
-
nameInput: RefObject<TextInputAdapter<string> | null>;
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
export interface Component<Type> extends Omit<ForwardRefExoticComponent<Props>, 'propTypes'>, StaticWebComponent<Type, ModelState, DefaultProperties> {
|
|
104
|
-
<T extends Value = Value>(props: Props<T> & RefAttributes<Adapter<T>>): ReactElement;
|
|
105
|
-
}
|
|
106
|
-
export declare const dedicatedPropertyTypes: ValidationMapping;
|
|
107
|
-
export declare const modelPropertyTypes: ValidationMapping;
|
|
108
|
-
export declare const modelStatePropertyTypes: {
|
|
109
|
-
[key in keyof ModelState]: Requireable<boolean | symbol>;
|
|
110
|
-
};
|
|
111
|
-
export declare const propertyTypes: ValidationMapping;
|
|
112
|
-
export declare const defaultModelState: ModelState;
|
|
113
|
-
export declare const defaultModel: Model;
|
|
114
|
-
export declare const defaultFileNameInputProperties: TextInputProps<string>;
|
|
115
|
-
export declare const defaultProperties: DefaultProperties;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Mapping } from 'clientnode';
|
|
2
|
-
import { ForwardedRef, ReactElement } from 'react';
|
|
3
|
-
import { Props as TextInputProps } from '../TextInput/type';
|
|
4
|
-
import { Adapter, Component, PropertiesItem, Props } from './type';
|
|
5
|
-
/**
|
|
6
|
-
* Generic inputs wrapper component.
|
|
7
|
-
* @property displayName - Descriptive name for component to show in web
|
|
8
|
-
* developer tools.
|
|
9
|
-
* @param props - Given components properties.
|
|
10
|
-
* @param reference - Reference object to forward internal state.
|
|
11
|
-
* @returns React elements.
|
|
12
|
-
*/
|
|
13
|
-
export declare const InputsInner: {
|
|
14
|
-
<T = unknown, P extends PropertiesItem<T> = TextInputProps<T>, State = Mapping<unknown>>(props: Props<T, P>, reference?: ForwardedRef<Adapter<T, P>>): ReactElement;
|
|
15
|
-
displayName: string;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Wrapping web component compatible react component.
|
|
19
|
-
* @property defaultProperties - Initial property configuration.
|
|
20
|
-
* @property propTypes - Triggers reacts runtime property value checks.
|
|
21
|
-
* @property strict - Indicates whether we should wrap render output in reacts
|
|
22
|
-
* strict component.
|
|
23
|
-
* @property wrapped - Wrapped component.
|
|
24
|
-
* @param props - Given components properties.
|
|
25
|
-
* @param reference - Reference object to forward internal state.
|
|
26
|
-
* @returns React elements.
|
|
27
|
-
*/
|
|
28
|
-
export declare const Inputs: Component<typeof InputsInner>;
|
|
29
|
-
export default Inputs;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { ValueOf } from 'clientnode';
|
|
2
|
-
import BasePropertyTypes from 'clientnode/property-types';
|
|
3
|
-
import { ForwardRefExoticComponent, ReactElement, ReactNode, RefAttributes, MutableRefObject as RefObject } from 'react';
|
|
4
|
-
import { ComponentAdapter, ValidationMapping } from 'web-component-wrapper/type';
|
|
5
|
-
import { Properties as TextInputProperties, Props as TextInputProps } from '../TextInput/type';
|
|
6
|
-
import { BaseModel, ModelState as BaseModelState, Properties as BaseProperties, State as BaseState, StaticWebComponent } from '../../type';
|
|
7
|
-
export interface PropertiesItem<T, TS = unknown> {
|
|
8
|
-
model?: {
|
|
9
|
-
state?: TS;
|
|
10
|
-
value?: T;
|
|
11
|
-
};
|
|
12
|
-
value?: T;
|
|
13
|
-
}
|
|
14
|
-
export interface CreateOptions<T, IP> {
|
|
15
|
-
index: number;
|
|
16
|
-
properties: IP;
|
|
17
|
-
values?: Array<T> | null;
|
|
18
|
-
}
|
|
19
|
-
export interface CreateItemOptions<T, P extends PropertiesItem<T>, IP> extends CreateOptions<T, IP> {
|
|
20
|
-
item: Partial<P>;
|
|
21
|
-
}
|
|
22
|
-
export interface CreatePrototypeOptions<T, P extends PropertiesItem<T>, IP> extends CreateItemOptions<T, P, IP> {
|
|
23
|
-
lastValue: null | T | undefined;
|
|
24
|
-
}
|
|
25
|
-
export interface ModelState extends BaseModelState {
|
|
26
|
-
invalidMaximumNumber: boolean;
|
|
27
|
-
invalidMinimumNumber: boolean;
|
|
28
|
-
}
|
|
29
|
-
export interface Model<T, P extends PropertiesItem<T> = PropertiesItem<T>> extends BaseModel<Array<P> | null> {
|
|
30
|
-
default?: Array<P> | null;
|
|
31
|
-
maximumNumber: number;
|
|
32
|
-
minimumNumber: number;
|
|
33
|
-
state?: ModelState;
|
|
34
|
-
writable: boolean;
|
|
35
|
-
}
|
|
36
|
-
export interface ChildrenOptions<T, P extends PropertiesItem<T>, IP> {
|
|
37
|
-
index: number;
|
|
38
|
-
inputsProperties: IP;
|
|
39
|
-
properties: Partial<P>;
|
|
40
|
-
}
|
|
41
|
-
export interface Properties<T = unknown, P extends PropertiesItem<T> = BaseProperties<T>> extends ModelState, Omit<BaseProperties<Array<P> | null>, 'onChangeValue'> {
|
|
42
|
-
default?: T;
|
|
43
|
-
addIcon: string;
|
|
44
|
-
removeIcon: string;
|
|
45
|
-
children: (options: ChildrenOptions<T, P, this>) => ReactNode;
|
|
46
|
-
createItem: (options: CreateItemOptions<T, P, this>) => P;
|
|
47
|
-
createPrototype: (options: CreatePrototypeOptions<T, P, this>) => P;
|
|
48
|
-
maximumNumber: number;
|
|
49
|
-
minimumNumber: number;
|
|
50
|
-
model: Model<T, P>;
|
|
51
|
-
onChangeValue: (values: Array<T> | null, event: unknown, properties: this) => void;
|
|
52
|
-
value: Array<P> | null;
|
|
53
|
-
writable: boolean;
|
|
54
|
-
}
|
|
55
|
-
export type PartialModel<T = unknown, P extends PropertiesItem<T> = BaseProperties<T>> = Partial<Omit<Model<T, P>, 'state'> & {
|
|
56
|
-
state?: Partial<ModelState>;
|
|
57
|
-
}>;
|
|
58
|
-
export type Props<T = unknown, P extends PropertiesItem<T> = BaseProperties<T>> = Partial<Omit<Properties<T, P>, 'model' | 'value'>> & {
|
|
59
|
-
model?: PartialModel<T, P>;
|
|
60
|
-
value?: Array<Partial<P>> | Array<T> | null;
|
|
61
|
-
};
|
|
62
|
-
export type DefaultProperties<T = string, P extends PropertiesItem<T> = TextInputProps<T>> = Partial<Omit<Properties<T, P>, 'default' | 'model' | 'value'>> & {
|
|
63
|
-
model: Model<T, P>;
|
|
64
|
-
};
|
|
65
|
-
export type PropertyTypes<T = unknown, P extends PropertiesItem<T> = BaseProperties<T>> = {
|
|
66
|
-
[key in keyof Properties<P>]: ValueOf<typeof BasePropertyTypes>;
|
|
67
|
-
};
|
|
68
|
-
export type State<T = unknown> = BaseState<Array<null | T | undefined>>;
|
|
69
|
-
export type Adapter<T = unknown, P extends PropertiesItem<T> = BaseProperties<T>> = ComponentAdapter<Properties<T, P>, State<T>>;
|
|
70
|
-
export type AdapterWithReferences<T = unknown, P extends PropertiesItem<T> = BaseProperties<T>, RefType = unknown> = Adapter<T, P> & {
|
|
71
|
-
references: Array<RefObject<RefType>>;
|
|
72
|
-
};
|
|
73
|
-
export interface Component<Type> extends Omit<ForwardRefExoticComponent<Props>, 'propTypes'>, StaticWebComponent<Type, ModelState, DefaultProperties> {
|
|
74
|
-
<T = string, P extends PropertiesItem<T> = TextInputProperties<T>>(props: Props<T, P> & RefAttributes<Adapter<T, P>>): ReactElement;
|
|
75
|
-
}
|
|
76
|
-
export declare const propertyTypes: ValidationMapping;
|
|
77
|
-
export declare const renderProperties: Array<string>;
|
|
78
|
-
export declare const defaultModel: Model<string, TextInputProperties<string>>;
|
|
79
|
-
export declare const defaultProperties: DefaultProperties;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ForwardedRef, ReactElement } from 'react';
|
|
2
|
-
import { Adapter, Component, Props } from './type';
|
|
3
|
-
/**
|
|
4
|
-
* Generic interval start, end input wrapper component.
|
|
5
|
-
* @param props - Component properties.
|
|
6
|
-
* @param reference - Mutable reference bound to created component instance.
|
|
7
|
-
* @returns React elements.
|
|
8
|
-
*/
|
|
9
|
-
export declare const IntervalInner: {
|
|
10
|
-
(props: Props, reference?: ForwardedRef<Adapter>): ReactElement;
|
|
11
|
-
displayName: string;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Wrapping web component compatible react component.
|
|
15
|
-
* @property defaultProperties - Initial property configuration.
|
|
16
|
-
* @property propTypes - Triggers reacts runtime property value checks.
|
|
17
|
-
* @property strict - Indicates whether we should wrap render output in reacts
|
|
18
|
-
* strict component.
|
|
19
|
-
* @property wrapped - Wrapped component.
|
|
20
|
-
* @param props - Given components properties.
|
|
21
|
-
* @param reference - Reference object to forward internal state.
|
|
22
|
-
* @returns React elements.
|
|
23
|
-
*/
|
|
24
|
-
export declare const Interval: Component<typeof IntervalInner>;
|
|
25
|
-
export default Interval;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { ValueOf } from 'clientnode';
|
|
2
|
-
import BasePropertyTypes from 'clientnode/property-types';
|
|
3
|
-
import { MutableRefObject as RefObject } from 'react';
|
|
4
|
-
import { GenericEvent } from 'react-generic-tools/type';
|
|
5
|
-
import { ComponentAdapter, PropertiesValidationMap } from 'web-component-wrapper/type';
|
|
6
|
-
import { IconProperties } from '../../implementations/type';
|
|
7
|
-
import { Component as BaseComponent, ModelState as BaseModelState } from '../../type';
|
|
8
|
-
import { AdapterWithReferences as TextInputAdapterWithReferences, Model as TextInputModel, Properties as TextInputProperties, Props as TextInputProps } from '../TextInput/type';
|
|
9
|
-
export type DateTimeRepresentation = number | string;
|
|
10
|
-
export interface Value {
|
|
11
|
-
end?: DateTimeRepresentation | null;
|
|
12
|
-
start?: DateTimeRepresentation | null;
|
|
13
|
-
}
|
|
14
|
-
export type IntervalTextInputModel = Omit<TextInputModel<DateTimeRepresentation | null>, 'maximum' | 'minimum'> & {
|
|
15
|
-
maximum: DateTimeRepresentation;
|
|
16
|
-
minimum: DateTimeRepresentation;
|
|
17
|
-
};
|
|
18
|
-
export type IntervalTextInputProps = Omit<TextInputProps<DateTimeRepresentation | null>, 'maximum' | 'minimum'> & {
|
|
19
|
-
maximum: DateTimeRepresentation;
|
|
20
|
-
minimum: DateTimeRepresentation;
|
|
21
|
-
};
|
|
22
|
-
export interface Configuration {
|
|
23
|
-
end: Partial<IntervalTextInputModel> | Partial<IntervalTextInputProps>;
|
|
24
|
-
start: Partial<IntervalTextInputModel> | Partial<IntervalTextInputProps>;
|
|
25
|
-
}
|
|
26
|
-
export type ModelState = BaseModelState;
|
|
27
|
-
export interface Model {
|
|
28
|
-
name: string;
|
|
29
|
-
state?: ModelState;
|
|
30
|
-
value: {
|
|
31
|
-
end: IntervalTextInputModel;
|
|
32
|
-
start: IntervalTextInputModel;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export interface Properties extends Omit<TextInputProperties<DateTimeRepresentation | null>, 'icon' | 'model' | 'onChange' | 'onChangeValue' | 'value'> {
|
|
36
|
-
icon: IconProperties;
|
|
37
|
-
model: Model;
|
|
38
|
-
onChange: (properties: this, event?: GenericEvent) => void;
|
|
39
|
-
onChangeValue: (value: Value | null, event?: GenericEvent) => void;
|
|
40
|
-
value: Configuration;
|
|
41
|
-
}
|
|
42
|
-
type PartialValue = Partial<Omit<TextInputModel<DateTimeRepresentation | null>, 'value'>> & {
|
|
43
|
-
value: DateTimeRepresentation | null;
|
|
44
|
-
};
|
|
45
|
-
export type PartialModel = Partial<Omit<Properties['model'], 'state' | 'value'>> & {
|
|
46
|
-
value?: {
|
|
47
|
-
end?: PartialValue;
|
|
48
|
-
start?: PartialValue;
|
|
49
|
-
};
|
|
50
|
-
state?: Partial<ModelState>;
|
|
51
|
-
};
|
|
52
|
-
export type Props = Omit<TextInputProps<DateTimeRepresentation | null>, 'icon' | 'model' | 'onChange' | 'onChangeValue' | 'value'> & Partial<{
|
|
53
|
-
end: Partial<Omit<TextInputProps<DateTimeRepresentation | null>, 'maximum' | 'minimum'> & {
|
|
54
|
-
maximum: DateTimeRepresentation;
|
|
55
|
-
minimum: DateTimeRepresentation;
|
|
56
|
-
}>;
|
|
57
|
-
start: Partial<Omit<TextInputProps<DateTimeRepresentation | null>, 'maximum' | 'minimum'> & {
|
|
58
|
-
maximum: DateTimeRepresentation;
|
|
59
|
-
minimum: DateTimeRepresentation;
|
|
60
|
-
}>;
|
|
61
|
-
icon: IconProperties | string;
|
|
62
|
-
model?: PartialModel;
|
|
63
|
-
onChange: Properties['onChange'];
|
|
64
|
-
onChangeValue: Properties['onChangeValue'];
|
|
65
|
-
value?: Configuration | Value | null;
|
|
66
|
-
}>;
|
|
67
|
-
export type DefaultProperties = Omit<Props, 'model'> & {
|
|
68
|
-
model: Model;
|
|
69
|
-
};
|
|
70
|
-
export type PropertyTypes = {
|
|
71
|
-
[key in keyof Properties]: ValueOf<typeof BasePropertyTypes>;
|
|
72
|
-
};
|
|
73
|
-
export type Adapter = ComponentAdapter<Properties, {
|
|
74
|
-
value?: Value | null;
|
|
75
|
-
}>;
|
|
76
|
-
export interface AdapterWithReferences extends Adapter {
|
|
77
|
-
references: {
|
|
78
|
-
end: RefObject<TextInputAdapterWithReferences<DateTimeRepresentation | null> | null>;
|
|
79
|
-
start: RefObject<TextInputAdapterWithReferences<DateTimeRepresentation | null> | null>;
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
export type Component<ComponentType> = BaseComponent<Configuration | Value | null, ComponentType, Props, ModelState, DefaultProperties, Adapter>;
|
|
83
|
-
export declare const propertyTypes: PropertiesValidationMap;
|
|
84
|
-
export declare const defaultProperties: DefaultProperties;
|
|
85
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Locator } from 'playwright-core';
|
|
2
|
-
export declare const textInput: (parent: Locator) => {
|
|
3
|
-
main: Locator;
|
|
4
|
-
inputNode: Locator;
|
|
5
|
-
getOptions: () => Promise<string[]>;
|
|
6
|
-
fill: (valueRepresentation: string) => Promise<void>;
|
|
7
|
-
inputValue: () => Promise<string | null>;
|
|
8
|
-
};
|
|
9
|
-
export default textInput;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { EditorOptions } from '@tiptap/core';
|
|
2
|
-
import { KeyboardEvent } from 'react';
|
|
3
|
-
import Dummy from 'react-generic-dummy';
|
|
4
|
-
import UseAnimationsType from 'react-useanimations';
|
|
5
|
-
import LockAnimation from 'react-useanimations/lib/lock';
|
|
6
|
-
import PlusToXAnimation from 'react-useanimations/lib/plusToX';
|
|
7
|
-
import { DefaultProperties as DefaultProperties, ModelState as ModelState } from './type';
|
|
8
|
-
export declare const IS_BROWSER: boolean;
|
|
9
|
-
export declare const UseAnimations: (null | typeof Dummy | typeof UseAnimationsType | undefined);
|
|
10
|
-
export declare const lockAnimation: null | typeof LockAnimation | undefined;
|
|
11
|
-
export declare const plusToXAnimation: null | typeof PlusToXAnimation | undefined;
|
|
12
|
-
export declare const CSS_CLASS_NAMES: Record<string, string>;
|
|
13
|
-
export declare const CODE_EDITOR_OPTIONS: {};
|
|
14
|
-
export declare const CURRENT_UTC_BUILD_TIMESTAMP: number;
|
|
15
|
-
export declare const TIPTAP_DEFAULT_OPTIONS: Partial<EditorOptions>;
|
|
16
|
-
/**
|
|
17
|
-
* Derives validation state from provided properties and state.
|
|
18
|
-
* @param properties - Current component properties.
|
|
19
|
-
* @param currentState - Current component state.
|
|
20
|
-
* @returns Boolean indicating whether component is in an aggregated valid or
|
|
21
|
-
* invalid state.
|
|
22
|
-
*/
|
|
23
|
-
export declare const determineValidationState: <T>(properties: DefaultProperties<T>, currentState: Partial<ModelState>) => boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Avoid propagating the enter key event since this usually sends a form which
|
|
26
|
-
* is not intended when working in a text field.
|
|
27
|
-
* @param event - Keyboard event.
|
|
28
|
-
*/
|
|
29
|
-
export declare function preventEnterKeyPropagation(event: KeyboardEvent): void;
|
|
30
|
-
/**
|
|
31
|
-
* Indicates whether a provided query is matching currently provided
|
|
32
|
-
* suggestion.
|
|
33
|
-
* @param suggestion - Candidate to match again.
|
|
34
|
-
* @param query - Search query to check for matching.
|
|
35
|
-
* @returns Boolean result whether provided suggestion matches given query or
|
|
36
|
-
* not.
|
|
37
|
-
*/
|
|
38
|
-
export declare function suggestionMatches(suggestion: string, query?: null | string): boolean;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ForwardedRef, ReactElement } from 'react';
|
|
2
|
-
import { AdapterWithReferences, Component, DataTransformation, Props } from './type';
|
|
3
|
-
export { CODE_EDITOR_OPTIONS, CSS_CLASS_NAMES, determineValidationState, preventEnterKeyPropagation, suggestionMatches, TIPTAP_DEFAULT_OPTIONS } from './helper';
|
|
4
|
-
export declare const INPUT_TRANSFORMER: DataTransformation;
|
|
5
|
-
/**
|
|
6
|
-
* Generic text input wrapper component which automatically determines a useful
|
|
7
|
-
* input field depending on given model specification.
|
|
8
|
-
* Dataflow:
|
|
9
|
-
* 1. On-Render all states are merged with given properties into a normalized
|
|
10
|
-
* property object.
|
|
11
|
-
* 2. Properties, corresponding state values and sub node instances are saved
|
|
12
|
-
* into a "ref" object (to make them accessible from the outside for example
|
|
13
|
-
* for wrapper like web-components).
|
|
14
|
-
* 3. Event handler saves corresponding data modifications into state and
|
|
15
|
-
* normalized properties object.
|
|
16
|
-
* 4. All state changes except selection changes trigger an "onChange" event
|
|
17
|
-
* which delivers the consolidated properties object (with latest
|
|
18
|
-
* modifications included).
|
|
19
|
-
* @property displayName - Descriptive name for component to show in web
|
|
20
|
-
* developer tools.
|
|
21
|
-
* @param props - Given components properties.
|
|
22
|
-
* @param reference - Reference object to forward internal state.
|
|
23
|
-
* @returns React elements.
|
|
24
|
-
*/
|
|
25
|
-
export declare const TextInputInner: {
|
|
26
|
-
<Type = unknown>(props: Props<Type>, reference?: ForwardedRef<AdapterWithReferences<Type>>): ReactElement;
|
|
27
|
-
displayName: string;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Wrapping web component compatible react component.
|
|
31
|
-
* @property defaultModelState - Initial model state.
|
|
32
|
-
* @property defaultProperties - Initial property configuration.
|
|
33
|
-
* @property locales - Defines input formatting locales.
|
|
34
|
-
* @property propTypes - Triggers reacts runtime property value checks.
|
|
35
|
-
* @property strict - Indicates whether we should wrap render output in reacts
|
|
36
|
-
* strict component.
|
|
37
|
-
* @property transformer - Text input data transformation specifications.
|
|
38
|
-
* @property wrapped - Wrapped component.
|
|
39
|
-
* @param props - Given components properties.
|
|
40
|
-
* @param reference - Reference object to forward internal state.
|
|
41
|
-
* @returns React elements.
|
|
42
|
-
*/
|
|
43
|
-
export declare const TextInput: Component<typeof TextInputInner>;
|
|
44
|
-
export default TextInput;
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { LanguageSupport } from '@codemirror/language';
|
|
2
|
-
import { JSONContent } from '@tiptap/core';
|
|
3
|
-
import { Mapping, PlainObject, RecursivePartial, ValueOf } from 'clientnode';
|
|
4
|
-
import BasePropertyTypes, { Requireable } from 'clientnode/property-types';
|
|
5
|
-
import { FocusEvent as ReactFocusEvent, ForwardRefExoticComponent, KeyboardEvent, MouseEvent, ReactElement, ReactNode, RefAttributes, MutableRefObject as RefObject } from 'react';
|
|
6
|
-
import { GenericEvent } from 'react-generic-tools/type';
|
|
7
|
-
import { ComponentAdapter, ValidationMapping } from 'web-component-wrapper/type';
|
|
8
|
-
import { ChainedCommands, type EditorOptions, Extensions } from '@tiptap/core';
|
|
9
|
-
import { EditorEvents } from '@tiptap/react';
|
|
10
|
-
import { StarterKitOptions } from '@tiptap/starter-kit';
|
|
11
|
-
import { IconProperties, InputReference, SelectProperties, TextAreaProperties, TextFieldProperties } from '../../implementations/type';
|
|
12
|
-
import { BaseModel, CursorState, NormalizedSelection, ModelState as BaseModelState, Properties as BaseProperties, Selection, State as BaseState, StaticWebComponent, ValueState as BaseValueState } from '../../type';
|
|
13
|
-
import { Reference as InputEventMapperReference } from './InputEventMapperWrapper';
|
|
14
|
-
export type Transformer<T = unknown> = (value: T, transformer: DataTransformation, configuration: DefaultProperties<T>) => string;
|
|
15
|
-
export interface FormatSpecification<T = unknown> {
|
|
16
|
-
options?: PlainObject;
|
|
17
|
-
transform?: Transformer<T>;
|
|
18
|
-
}
|
|
19
|
-
export interface FormatSpecifications<T = unknown> {
|
|
20
|
-
final: FormatSpecification<T>;
|
|
21
|
-
intermediate?: FormatSpecification<T>;
|
|
22
|
-
}
|
|
23
|
-
export interface DataTransformSpecification<T = unknown, InputType = number | string> {
|
|
24
|
-
format?: FormatSpecifications<T>;
|
|
25
|
-
parse?: (value: InputType, transformer: DataTransformation, configuration: DefaultProperties<T>) => T;
|
|
26
|
-
type?: NativeType;
|
|
27
|
-
}
|
|
28
|
-
export interface DateTransformSpecification extends DataTransformSpecification<number | string, Date | number | string> {
|
|
29
|
-
useISOString: boolean;
|
|
30
|
-
}
|
|
31
|
-
export type DataTransformation = {
|
|
32
|
-
boolean: DataTransformSpecification<boolean>;
|
|
33
|
-
currency: DataTransformSpecification<number, string>;
|
|
34
|
-
date: DateTransformSpecification;
|
|
35
|
-
'date-local': DataTransformSpecification<number | string, Date | number | string>;
|
|
36
|
-
datetime: DataTransformSpecification<number | string, Date | number | string>;
|
|
37
|
-
'datetime-local': DataTransformSpecification<number | string, Date | number | string>;
|
|
38
|
-
time: DataTransformSpecification<number | string, Date | number | string>;
|
|
39
|
-
'time-local': DataTransformSpecification<number | string, Date | number | string>;
|
|
40
|
-
float: DataTransformSpecification<number, string>;
|
|
41
|
-
integer: DataTransformSpecification<number, string>;
|
|
42
|
-
number: DataTransformSpecification<number, number>;
|
|
43
|
-
string?: DataTransformSpecification;
|
|
44
|
-
} & {
|
|
45
|
-
[key in Exclude<NativeType, ('date' | 'date-local' | 'datetime' | 'datetime-local' | 'time' | 'time-local' | 'number')>]?: DataTransformSpecification;
|
|
46
|
-
};
|
|
47
|
-
export interface EditorReference {
|
|
48
|
-
input: RefObject<InputEventMapperReference | null>;
|
|
49
|
-
}
|
|
50
|
-
export interface EditorProperties extends Omit<NonNullable<TextAreaProperties>, 'onChange' | 'textarea' | 'value'> {
|
|
51
|
-
id: string;
|
|
52
|
-
value: number | string;
|
|
53
|
-
minimumLength: number;
|
|
54
|
-
maximumLength: number;
|
|
55
|
-
rows: number;
|
|
56
|
-
onChange: (value: string, contentTree?: JSONContent) => void;
|
|
57
|
-
}
|
|
58
|
-
export interface RichTextEditorButtonProps {
|
|
59
|
-
action: (command: ChainedCommands) => ChainedCommands;
|
|
60
|
-
activeIndicator?: string;
|
|
61
|
-
enabledIndicator?: null | ((command: ChainedCommands) => ChainedCommands);
|
|
62
|
-
checkedIconName?: string;
|
|
63
|
-
iconName: string;
|
|
64
|
-
label?: string;
|
|
65
|
-
}
|
|
66
|
-
export interface TiptapProperties extends Omit<EditorProperties, 'onBlur' | 'onFocus'> {
|
|
67
|
-
onBlur: (event: EditorEvents['focus']) => void;
|
|
68
|
-
onFocus: (event: EditorEvents['focus']) => void;
|
|
69
|
-
editor: {
|
|
70
|
-
options?: Partial<EditorOptions>;
|
|
71
|
-
extensions?: Extensions;
|
|
72
|
-
starterKitOptions?: Partial<StarterKitOptions>;
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
export type TiptapProps = Partial<TiptapProperties>;
|
|
76
|
-
export interface CodeMirrorProperties extends Omit<EditorProperties, 'onBlur' | 'onFocus'> {
|
|
77
|
-
onBlur: (event: ReactFocusEvent<HTMLDivElement>) => void;
|
|
78
|
-
onFocus: (event: ReactFocusEvent<HTMLDivElement>) => void;
|
|
79
|
-
editor: {
|
|
80
|
-
mode?: LanguageSupport;
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
export type CodeMirrorProps = Partial<CodeMirrorProperties>;
|
|
84
|
-
export interface ModelState extends BaseModelState {
|
|
85
|
-
invalidMaximum: boolean;
|
|
86
|
-
invalidMinimum: boolean;
|
|
87
|
-
invalidMaximumLength: boolean;
|
|
88
|
-
invalidMinimumLength: boolean;
|
|
89
|
-
invalidInvertedPattern: boolean;
|
|
90
|
-
invalidPattern: boolean;
|
|
91
|
-
}
|
|
92
|
-
export interface Model<T = unknown> extends BaseModel<T> {
|
|
93
|
-
default?: T;
|
|
94
|
-
state?: ModelState;
|
|
95
|
-
}
|
|
96
|
-
export type PartialModel<T = unknown> = Partial<Omit<Model<T>, 'state'>> & {
|
|
97
|
-
state?: Partial<ModelState>;
|
|
98
|
-
};
|
|
99
|
-
export interface ValueState<T = unknown, MS = BaseModelState> extends BaseValueState<T, MS> {
|
|
100
|
-
representation?: ReactNode;
|
|
101
|
-
}
|
|
102
|
-
export type NativeType = ('date' | 'datetime-local' | 'time' | 'week' | 'month' | 'number' | 'range' | 'text');
|
|
103
|
-
export type Type = ('date-local' | 'datetime' | 'time-local' | 'boolean' | 'currency' | 'float' | 'integer' | 'string' | NativeType);
|
|
104
|
-
export interface ChildrenOptions<P, T> {
|
|
105
|
-
index: number;
|
|
106
|
-
normalizedSelection?: NormalizedSelection | null;
|
|
107
|
-
properties: P;
|
|
108
|
-
query: string;
|
|
109
|
-
suggestion: ReactNode | string;
|
|
110
|
-
value: T;
|
|
111
|
-
}
|
|
112
|
-
export interface SuggestionCreatorOptions<P> {
|
|
113
|
-
abortController: AbortController;
|
|
114
|
-
properties: P;
|
|
115
|
-
query: string;
|
|
116
|
-
}
|
|
117
|
-
export type EditorType = ('code' | 'code(css)' | 'code(cascadingstylesheet)' | 'code(cascadingstylesheets)' | 'code(style)' | 'code(styles)' | 'code(script)' | 'code(js)' | 'code(jsx)' | 'code(javascript)' | 'code(ts)' | 'code(tsx)' | 'code(typescript)' | 'plain' | 'text' | 'richtext');
|
|
118
|
-
export interface Properties<Type = unknown> extends ModelState, BaseProperties<Type> {
|
|
119
|
-
default?: Type;
|
|
120
|
-
align: 'end' | 'start';
|
|
121
|
-
children: (options: ChildrenOptions<this, Type>) => null | ReactElement;
|
|
122
|
-
cursor: Partial<CursorState> | null;
|
|
123
|
-
editor: EditorType;
|
|
124
|
-
editorIsActive: boolean;
|
|
125
|
-
editorIsInitiallyActive: boolean;
|
|
126
|
-
hidden?: boolean;
|
|
127
|
-
leadingIcon: string | (IconProperties & {
|
|
128
|
-
tooltip?: string;
|
|
129
|
-
});
|
|
130
|
-
trailingIcon: string | (IconProperties & {
|
|
131
|
-
tooltip?: string;
|
|
132
|
-
});
|
|
133
|
-
domNodeProperties: Partial<CodeMirrorProps | SelectProperties<Type> | TiptapProps | TextAreaProperties | TextFieldProperties | Mapping<unknown>>;
|
|
134
|
-
attributes?: Mapping<boolean | number | string>;
|
|
135
|
-
invertedPattern: Array<RegExp | string> | null | RegExp | string;
|
|
136
|
-
invertedPatternText: string;
|
|
137
|
-
labels: Selection;
|
|
138
|
-
maximumLengthText: string;
|
|
139
|
-
minimumLengthText: string;
|
|
140
|
-
maximumText: string;
|
|
141
|
-
minimumText: string;
|
|
142
|
-
model: Model<Type>;
|
|
143
|
-
onChangeEditorIsActive: (isActive: boolean, event: MouseEvent | undefined, properties: this) => void;
|
|
144
|
-
onKeyDown: (event: KeyboardEvent, properties: this) => void;
|
|
145
|
-
onKeyUp: (event: KeyboardEvent, properties: this) => void;
|
|
146
|
-
onSelect: (event: GenericEvent, properties: this) => void;
|
|
147
|
-
onSelectionChange: (event: GenericEvent, properties: this) => void;
|
|
148
|
-
pattern: Array<RegExp | string> | null | RegExp | string;
|
|
149
|
-
patternText: string;
|
|
150
|
-
placeholder: string;
|
|
151
|
-
representation: ReactNode | string;
|
|
152
|
-
rows: number;
|
|
153
|
-
searchSelection: boolean;
|
|
154
|
-
selectableEditor: boolean;
|
|
155
|
-
step: number;
|
|
156
|
-
suggestionCreator?: (options: SuggestionCreatorOptions<this>) => Properties['selection'] | Promise<Properties['selection']>;
|
|
157
|
-
suggestSelection: boolean;
|
|
158
|
-
transformer: RecursivePartial<DataTransformSpecification<Type, Date | number | string>>;
|
|
159
|
-
}
|
|
160
|
-
export type Props<T = unknown> = Partial<Omit<Properties<T>, 'model'>> & {
|
|
161
|
-
model?: PartialModel<T>;
|
|
162
|
-
};
|
|
163
|
-
export type DefaultProperties<T = string> = Omit<Props<T>, 'model'> & {
|
|
164
|
-
model: Model<T>;
|
|
165
|
-
};
|
|
166
|
-
export type PropertyTypes<T = unknown> = {
|
|
167
|
-
[key in keyof Properties<T>]: ValueOf<typeof BasePropertyTypes>;
|
|
168
|
-
};
|
|
169
|
-
export interface State<T = unknown> extends BaseState<T> {
|
|
170
|
-
cursor: CursorState;
|
|
171
|
-
editorIsActive: boolean;
|
|
172
|
-
hidden?: boolean;
|
|
173
|
-
modelState: ModelState;
|
|
174
|
-
representation?: ReactNode | string;
|
|
175
|
-
selectionIsUnstable: boolean;
|
|
176
|
-
showDeclaration: boolean;
|
|
177
|
-
}
|
|
178
|
-
export type Adapter<T = unknown> = ComponentAdapter<Properties<T>, Omit<State<T>, 'representation' | 'selectionIsUnstable' | 'value'> & {
|
|
179
|
-
representation?: ReactNode | string;
|
|
180
|
-
value?: null | T;
|
|
181
|
-
}>;
|
|
182
|
-
export interface AdapterWithReferences<T = unknown> extends Adapter<T> {
|
|
183
|
-
references: {
|
|
184
|
-
input: RefObject<InputReference | InputEventMapperReference | null>;
|
|
185
|
-
menu: RefObject<unknown>;
|
|
186
|
-
wrapper: RefObject<HTMLDivElement | null>;
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
export interface Component<Type> extends Omit<ForwardRefExoticComponent<Props>, 'propTypes'>, StaticWebComponent<Type, ModelState, DefaultProperties> {
|
|
190
|
-
<T = unknown>(props: Props<T> & RefAttributes<Adapter<T>>): ReactElement;
|
|
191
|
-
locales: Array<string>;
|
|
192
|
-
transformer: DataTransformation;
|
|
193
|
-
}
|
|
194
|
-
export declare const modelStatePropertyTypes: {
|
|
195
|
-
[key in keyof ModelState]: Requireable<boolean | symbol>;
|
|
196
|
-
};
|
|
197
|
-
export declare const propertyTypes: ValidationMapping;
|
|
198
|
-
export declare const renderProperties: Array<string>;
|
|
199
|
-
export declare const defaultModelState: ModelState;
|
|
200
|
-
export declare const defaultInputModel: Model<string>;
|
|
201
|
-
export declare const defaultProperties: DefaultProperties;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ThemePropT } from '@rmwc/types';
|
|
2
|
-
import { AnyFunction, FirstParameter } from 'clientnode';
|
|
3
|
-
import { FunctionComponent, ReactElement } from 'react';
|
|
4
|
-
import { ConfigurationProperties } from '../../type';
|
|
5
|
-
/**
|
|
6
|
-
* Wraps a theme provider, strict wrapper and tooltip to given element if
|
|
7
|
-
* corresponding configurations are provided.
|
|
8
|
-
* @param properties - Component provided properties.
|
|
9
|
-
* @param properties.children - Component or string to wrap.
|
|
10
|
-
* @param properties.strict - Indicates whether to render in strict mode.
|
|
11
|
-
* @param properties.themeConfiguration - Optional theme configurations.
|
|
12
|
-
* @param properties.tooltip - Optional tooltip to show on hover.
|
|
13
|
-
* @param properties.wrap - Instead of injecting a div tag, wrap a child
|
|
14
|
-
* component by merging the theme styles directly onto it. Useful when you
|
|
15
|
-
* don't want to mess with layout.
|
|
16
|
-
* @returns Wrapped content.
|
|
17
|
-
*/
|
|
18
|
-
export declare const WrapConfigurations: FunctionComponent<ConfigurationProperties & {
|
|
19
|
-
children: ReactElement;
|
|
20
|
-
}>;
|
|
21
|
-
/**
|
|
22
|
-
* Component factory to dynamically create a wrapped component.
|
|
23
|
-
* @param WrappedComponent - Component to wrap.
|
|
24
|
-
* @param options - Options configure wrapping.
|
|
25
|
-
* @param options.withReference - Indicates whether to add a mutable reference
|
|
26
|
-
* to wrapping component.
|
|
27
|
-
* @param options.withThemeWrapper - Indicates whether all theme configurations
|
|
28
|
-
* should be provided.
|
|
29
|
-
* @returns Created wrapped component.
|
|
30
|
-
*/
|
|
31
|
-
export declare function createWrapConfigurationsComponent<Type extends AnyFunction = AnyFunction, Reference = unknown>(WrappedComponent: Type, options?: {
|
|
32
|
-
withReference?: boolean | null;
|
|
33
|
-
withThemeWrapper?: boolean;
|
|
34
|
-
}): FunctionComponent<FirstParameter<Type> & ConfigurationProperties & {
|
|
35
|
-
theme?: ThemePropT;
|
|
36
|
-
}>;
|
|
37
|
-
export default WrapConfigurations;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Generic strict wrapper component.
|
|
4
|
-
* @param properties - Provided component properties.
|
|
5
|
-
* @param properties.children - Components to wrap.
|
|
6
|
-
* @param properties.strict - Indicates whether to wrap with strict indicating
|
|
7
|
-
* component.
|
|
8
|
-
* @returns React component.
|
|
9
|
-
*/
|
|
10
|
-
export declare const WrapStrict: FunctionComponent<{
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
strict: boolean;
|
|
13
|
-
}>;
|
|
14
|
-
export default WrapStrict;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent, ReactElement } from 'react';
|
|
2
|
-
import { ThemeProviderProps } from '@rmwc/theme';
|
|
3
|
-
/**
|
|
4
|
-
* Wraps a theme provider to given element if a configuration is provided.
|
|
5
|
-
* @param properties - Component provided properties.
|
|
6
|
-
* @param properties.children - Component or string to wrap.
|
|
7
|
-
* @param properties.configuration - Potential theme provider configuration.
|
|
8
|
-
* @param properties.wrap - Instead of injecting a div tag, wrap a child
|
|
9
|
-
* component by merging the theme styles directly onto it. Useful when you
|
|
10
|
-
* don't want to mess with layout.
|
|
11
|
-
* @returns Wrapped content.
|
|
12
|
-
*/
|
|
13
|
-
export declare const WrapThemeProvider: FunctionComponent<{
|
|
14
|
-
children: ReactElement;
|
|
15
|
-
configuration?: ThemeProviderProps['options'];
|
|
16
|
-
wrap?: boolean;
|
|
17
|
-
}>;
|
|
18
|
-
export default WrapThemeProvider;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent, ReactElement } from 'react';
|
|
2
|
-
import { Properties } from '../../type';
|
|
3
|
-
export declare const isDummy: boolean;
|
|
4
|
-
/**
|
|
5
|
-
* Wraps given component with a tooltip component with given tooltip
|
|
6
|
-
* configuration.
|
|
7
|
-
* @param properties - Component provided properties.
|
|
8
|
-
* @param properties.children - Component or string to wrap.
|
|
9
|
-
* @param properties.value - Tooltip value.
|
|
10
|
-
* @returns Wrapped given content.
|
|
11
|
-
*/
|
|
12
|
-
export declare const WrapTooltip: FunctionComponent<{
|
|
13
|
-
children: ReactElement;
|
|
14
|
-
value?: Properties['tooltip'] | null;
|
|
15
|
-
}>;
|
|
16
|
-
export default WrapTooltip;
|
package/dist/helper.d.ts
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { Mapping } from 'clientnode';
|
|
2
|
-
import { NullSymbol, UndefinedSymbol } from 'clientnode/property-types';
|
|
3
|
-
import { ReactNode, useState } from 'react';
|
|
4
|
-
import { BaseProperties, BaseProps, DefaultBaseProperties, DefaultProperties, ModelState, NormalizedSelection, Selection, ValueState } from './type';
|
|
5
|
-
import { DateTimeRepresentation } from './components/Interval/type';
|
|
6
|
-
import { DefaultProperties as TextInputDefaultProperties, DataTransformation as TextInputDataTransformation, Props as TextInputProps } from './components/TextInput/type';
|
|
7
|
-
/**
|
|
8
|
-
* Removes all none serializable values from given data structure.
|
|
9
|
-
* @param object - Mapping of values to slice.
|
|
10
|
-
*/
|
|
11
|
-
export declare const slicePropertiesForState: (object: Mapping) => void;
|
|
12
|
-
/**
|
|
13
|
-
* Removes all none serializable values from given data structure recursively.
|
|
14
|
-
* @param properties - Mapping of values to slice.
|
|
15
|
-
* @returns Nothing.
|
|
16
|
-
*/
|
|
17
|
-
export declare const slicePropertiesForStateRecursively: (properties: unknown) => object | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* Creates a mocked a state setter. Useful to dynamically convert a component
|
|
20
|
-
* from uncontrolled to controlled one.
|
|
21
|
-
* @param value - Parameter for state setter.
|
|
22
|
-
* @returns Resulting value of the "useState" hook.
|
|
23
|
-
*/
|
|
24
|
-
export declare const createDummyStateSetter: <Type = unknown>(value: Type) => ReturnType<typeof useState>[1];
|
|
25
|
-
/**
|
|
26
|
-
* Consolidates properties not found in properties but in state into
|
|
27
|
-
* properties.
|
|
28
|
-
* @param properties - To consolidate.
|
|
29
|
-
* @param state - To search values in.
|
|
30
|
-
* @returns Consolidated properties.
|
|
31
|
-
*/
|
|
32
|
-
export declare const deriveMissingPropertiesFromState: <Properties extends BaseProps = BaseProps, State extends ValueState = ValueState>(properties: Properties, state: State) => Properties;
|
|
33
|
-
/**
|
|
34
|
-
* Creates a hybrid a state setter which only triggers when model state changes
|
|
35
|
-
* occur. Useful to dynamically convert a component from uncontrolled to
|
|
36
|
-
* controlled while model state should be uncontrolled either.
|
|
37
|
-
* @param setValueState - Value setter to wrap.
|
|
38
|
-
* @param currentValueState - Last known value state to provide to setter when
|
|
39
|
-
* called.
|
|
40
|
-
* @returns Wrapped given method.
|
|
41
|
-
*/
|
|
42
|
-
export declare const wrapStateSetter: <Type = unknown>(setValueState: (value: Type | ((value: Type) => Type)) => void, currentValueState: Type) => ReturnType<typeof useState>[1];
|
|
43
|
-
/**
|
|
44
|
-
* Renders given template string against all properties in current
|
|
45
|
-
* instance.
|
|
46
|
-
* @param template - Template to render.
|
|
47
|
-
* @param scope - Scope to render given template again.
|
|
48
|
-
* @returns Evaluated template or an empty string if something goes wrong.
|
|
49
|
-
*/
|
|
50
|
-
export declare const renderMessage: <Scope extends object = object>(template: unknown, scope: Scope) => string;
|
|
51
|
-
/**
|
|
52
|
-
* Triggered when a value state changes like validation or focusing.
|
|
53
|
-
* @param properties - Properties to search in.
|
|
54
|
-
* @param name - Event callback name to search for in given properties.
|
|
55
|
-
* @param synchronous - Indicates whether to trigger callback immediately or
|
|
56
|
-
* later. Controlled components should call synchronously and uncontrolled
|
|
57
|
-
* otherwise as long as callbacks are called in a state setter context.
|
|
58
|
-
* @param parameters - Additional arguments to forward to callback.
|
|
59
|
-
*/
|
|
60
|
-
export declare const triggerCallbackIfExists: <P extends Omit<BaseProperties, "model"> & {
|
|
61
|
-
model: unknown;
|
|
62
|
-
}>(properties: P, name: string, synchronous?: boolean, ...parameters: Array<unknown>) => void;
|
|
63
|
-
/**
|
|
64
|
-
* Translate known symbols in a copied and return properties object.
|
|
65
|
-
* @param properties - Object to translate.
|
|
66
|
-
* @returns Transformed properties.
|
|
67
|
-
*/
|
|
68
|
-
export declare const translateKnownSymbols: <Type = unknown>(properties: Mapping<typeof NullSymbol | Type | typeof UndefinedSymbol>) => Mapping<Type>;
|
|
69
|
-
/**
|
|
70
|
-
* Determines initial value representation as string.
|
|
71
|
-
* @param properties - Components properties.
|
|
72
|
-
* @param defaultProperties - Components default properties.
|
|
73
|
-
* @param value - Current value to represent.
|
|
74
|
-
* @param transformer - To apply to given value.
|
|
75
|
-
* @param selection - Data mapping of allowed values.
|
|
76
|
-
* @returns Determined initial representation.
|
|
77
|
-
*/
|
|
78
|
-
export declare function determineInitialRepresentation<T = unknown, P extends TextInputProps<T> = TextInputProps<T>, DP extends TextInputDefaultProperties<T> = TextInputDefaultProperties<T>>(properties: P, defaultProperties: DP, value: null | T, transformer: TextInputDataTransformation, selection?: NormalizedSelection | null): string;
|
|
79
|
-
/**
|
|
80
|
-
* Determines initial value depending on given properties.
|
|
81
|
-
* @param properties - Components properties.
|
|
82
|
-
* @param defaultValue - Internal fallback value.
|
|
83
|
-
* @param alternateValue - Alternate value to respect.
|
|
84
|
-
* @returns Determined value.
|
|
85
|
-
*/
|
|
86
|
-
export declare const determineInitialValue: <Type = unknown, DefaultType = unknown>(properties: BaseProps & {
|
|
87
|
-
default?: DefaultType;
|
|
88
|
-
model?: {
|
|
89
|
-
default?: DefaultType;
|
|
90
|
-
};
|
|
91
|
-
}, defaultValue?: Type, alternateValue?: Type) => null | Type;
|
|
92
|
-
/**
|
|
93
|
-
* Derives current validation state from given value.
|
|
94
|
-
* @param properties - Input configuration.
|
|
95
|
-
* @param currentState - Current validation state.
|
|
96
|
-
* @param validators - Mapping from validation state key to corresponding
|
|
97
|
-
* validator function.
|
|
98
|
-
* @returns A boolean indicating if validation state has changed.
|
|
99
|
-
*/
|
|
100
|
-
export declare const determineValidationState: <Type = unknown, P extends DefaultProperties<Type> = DefaultProperties<Type>, MS extends Partial<ModelState> = Partial<ModelState>>(properties: P, currentState: MS, validators?: Mapping<() => boolean>) => boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Synchronizes property, state and model configuration:
|
|
103
|
-
* Properties overwrites default properties which overwrites default model
|
|
104
|
-
* properties.
|
|
105
|
-
* @param properties - Properties to merge.
|
|
106
|
-
* @param defaultModel - Default model to merge.
|
|
107
|
-
* @returns Merged properties.
|
|
108
|
-
*/
|
|
109
|
-
export declare const mapPropertiesIntoModel: <P extends BaseProps = BaseProps, DP extends DefaultBaseProperties = DefaultBaseProperties>(properties: P, defaultModel: DP["model"]) => DP;
|
|
110
|
-
/**
|
|
111
|
-
* Calculate external properties (a set of all configurable properties).
|
|
112
|
-
* @param properties - Properties to merge.
|
|
113
|
-
* @returns External properties object.
|
|
114
|
-
*/
|
|
115
|
-
export declare const getConsolidatedProperties: <P extends BaseProps, R extends BaseProperties>(properties: P) => R;
|
|
116
|
-
/**
|
|
117
|
-
* Determine normalized labels and values for selection and auto-complete
|
|
118
|
-
* components.
|
|
119
|
-
* @param selection - Selection component property configuration.
|
|
120
|
-
* @returns Normalized sorted listed of labels and values.
|
|
121
|
-
*/
|
|
122
|
-
export declare function getLabelAndValues(selection?: NormalizedSelection | null): [Array<ReactNode | string>, Array<unknown>];
|
|
123
|
-
/**
|
|
124
|
-
* Determine representation for given value while respecting existing labels.
|
|
125
|
-
* @param value - To represent.
|
|
126
|
-
* @param selection - Selection component property configuration.
|
|
127
|
-
* @returns Determined representation.
|
|
128
|
-
*/
|
|
129
|
-
export declare function getRepresentationFromValueSelection(value: unknown, selection?: NormalizedSelection | null): null | string;
|
|
130
|
-
/**
|
|
131
|
-
* Determine value from provided representation (for example user inputs).
|
|
132
|
-
* @param label - To search a value for.
|
|
133
|
-
* @param selection - Selection component property configuration.
|
|
134
|
-
* @returns Determined value.
|
|
135
|
-
*/
|
|
136
|
-
export declare function getValueFromSelection<T>(label: ReactNode | string, selection: NormalizedSelection | null | undefined): T;
|
|
137
|
-
/**
|
|
138
|
-
* Normalize given selection. NOTE: It is important to have an ordered list
|
|
139
|
-
* to map values to labels and the other way around in a deterministic way.
|
|
140
|
-
* @param selection - Selection component property configuration.
|
|
141
|
-
* @param labels - Additional labels to take into account (for example provided
|
|
142
|
-
* via a content management system).
|
|
143
|
-
* @returns Determined normalized sorted selection configuration.
|
|
144
|
-
*/
|
|
145
|
-
export declare function normalizeSelection(selection?: Selection | null, labels?: Selection | null): NormalizedSelection | null | undefined;
|
|
146
|
-
/**
|
|
147
|
-
* Applies configured value transformations.
|
|
148
|
-
* @param configuration - Input configuration.
|
|
149
|
-
* @param value - Value to transform.
|
|
150
|
-
* @param transformer - To apply to given value.
|
|
151
|
-
* @param trim - Indicates whether to trim strings or not.
|
|
152
|
-
* @returns Transformed value.
|
|
153
|
-
*/
|
|
154
|
-
export declare const parseValue: <T = unknown, P extends TextInputDefaultProperties<T> = TextInputDefaultProperties<T>, InputType = T>(configuration: P, value: InputType | undefined, transformer: TextInputDataTransformation, trim?: boolean) => T;
|
|
155
|
-
/**
|
|
156
|
-
* Represents configured value as string.
|
|
157
|
-
* @param configuration - Input configuration.
|
|
158
|
-
* @param value - To represent.
|
|
159
|
-
* @param transformerMapping - To apply to given value.
|
|
160
|
-
* @param final - Specifies whether it is a final representation.
|
|
161
|
-
* @returns Transformed value.
|
|
162
|
-
*/
|
|
163
|
-
export declare function formatValue<T = unknown, P extends TextInputDefaultProperties<T> = TextInputDefaultProperties<T>>(configuration: P, value: null | T, transformerMapping: TextInputDataTransformation, final?: boolean): string;
|
|
164
|
-
export declare const formatDateTimeAsConfigured: (value?: DateTimeRepresentation | Date | null) => DateTimeRepresentation | null | undefined;
|
package/dist/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export { Checkbox } from './components/Checkbox';
|
|
2
|
-
export { FileInput } from './components/FileInput';
|
|
3
|
-
export { Interval } from './components/Interval';
|
|
4
|
-
export { Inputs } from './components/Inputs';
|
|
5
|
-
export { TextInput } from './components/TextInput';
|
|
6
|
-
export { WrapConfigurations } from './components/Wrapper/WrapConfigurations';
|
|
7
|
-
export { WrapStrict } from './components/Wrapper/WrapStrict';
|
|
8
|
-
export { WrapThemeProvider } from './components/Wrapper/WrapThemeProvider';
|
|
9
|
-
export { WrapTooltip } from './components/Wrapper/WrapTooltip';
|
|
10
|
-
export * from './helper';
|
|
11
|
-
export * from './type';
|
|
12
|
-
export * as CheckboxTypes from './components/Checkbox/type';
|
|
13
|
-
export * as FileInputTypes from './components/FileInput/type';
|
|
14
|
-
export * as IntervalTypes from './components/Interval/type';
|
|
15
|
-
export * as InputsTypes from './components/Inputs/type';
|
|
16
|
-
export * as TextInputTypes from './components/TextInput/type';
|
package/dist/type.d.ts
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { Mapping, Primitive } from 'clientnode';
|
|
2
|
-
import { Requireable } from 'clientnode/property-types';
|
|
3
|
-
import { ComponentClass, FocusEvent, ForwardRefExoticComponent, FunctionComponent, MouseEvent, ReactElement, RefAttributes } from 'react';
|
|
4
|
-
import { GenericEvent } from 'react-generic-tools/type';
|
|
5
|
-
import { ComponentAdapter, StaticWebComponent as StaticBaseWebComponent, ValidationMapping } from 'web-component-wrapper/type';
|
|
6
|
-
import { ThemeProviderProps } from '@rmwc/theme';
|
|
7
|
-
export interface CursorState {
|
|
8
|
-
end: number;
|
|
9
|
-
start: number;
|
|
10
|
-
}
|
|
11
|
-
export declare const PrimitiveTypes: readonly ["boolean", "DateTime", "integer", "number", "string"];
|
|
12
|
-
export type PrimitiveType = typeof PrimitiveTypes[number];
|
|
13
|
-
export type Type = boolean | number | string;
|
|
14
|
-
export type TypeSpecification = Array<TypeSpecification> | Type;
|
|
15
|
-
export interface SelectionOption {
|
|
16
|
-
label: string;
|
|
17
|
-
value: Primitive;
|
|
18
|
-
}
|
|
19
|
-
export type NormalizedSelection = Array<SelectionOption>;
|
|
20
|
-
export type ModelSelection = Array<Primitive> | Mapping | NormalizedSelection;
|
|
21
|
-
export type Selection = Array<[Primitive, string]> | ModelSelection;
|
|
22
|
-
export interface CommonBaseModel<Type = unknown> {
|
|
23
|
-
declaration: string;
|
|
24
|
-
description: string;
|
|
25
|
-
name: string;
|
|
26
|
-
emptyEqualsNull: boolean;
|
|
27
|
-
maximum: number | string;
|
|
28
|
-
minimum: number | string;
|
|
29
|
-
maximumLength: number;
|
|
30
|
-
minimumLength: number;
|
|
31
|
-
type: TypeSpecification;
|
|
32
|
-
trim: boolean;
|
|
33
|
-
value?: Type;
|
|
34
|
-
}
|
|
35
|
-
export interface ModelState {
|
|
36
|
-
dirty: boolean;
|
|
37
|
-
pristine: boolean;
|
|
38
|
-
touched: boolean;
|
|
39
|
-
untouched: boolean;
|
|
40
|
-
focused: boolean;
|
|
41
|
-
visited: boolean;
|
|
42
|
-
invalid: boolean;
|
|
43
|
-
valid: boolean;
|
|
44
|
-
invalidRequired: boolean;
|
|
45
|
-
}
|
|
46
|
-
export type Pattern = Array<RegExp | string> | RegExp | string;
|
|
47
|
-
export interface BaseModel<T = unknown> extends CommonBaseModel<T> {
|
|
48
|
-
pattern?: Pattern;
|
|
49
|
-
invertedPattern?: Pattern;
|
|
50
|
-
selection?: ModelSelection;
|
|
51
|
-
mutable: boolean;
|
|
52
|
-
writable: boolean;
|
|
53
|
-
nullable: boolean;
|
|
54
|
-
state?: ModelState;
|
|
55
|
-
}
|
|
56
|
-
export interface BaseProperties<T = unknown> extends CommonBaseModel<T>, ModelState {
|
|
57
|
-
className: Array<string> | string;
|
|
58
|
-
styles: Mapping;
|
|
59
|
-
themeConfiguration: ThemeProviderProps['options'];
|
|
60
|
-
disabled: boolean;
|
|
61
|
-
enforceUncontrolled: boolean;
|
|
62
|
-
id?: string;
|
|
63
|
-
label: string;
|
|
64
|
-
name: string;
|
|
65
|
-
initialValue: T;
|
|
66
|
-
model: BaseModel<T>;
|
|
67
|
-
required: boolean;
|
|
68
|
-
requiredText: string;
|
|
69
|
-
componentProperties: Mapping<unknown>;
|
|
70
|
-
domNodeProperties: Mapping<unknown>;
|
|
71
|
-
selection?: Selection;
|
|
72
|
-
showDeclaration: boolean;
|
|
73
|
-
showInitialValidationState: boolean;
|
|
74
|
-
showValidationState: boolean;
|
|
75
|
-
tooltip: string;
|
|
76
|
-
triggerInitialPropertiesConsolidation: boolean;
|
|
77
|
-
}
|
|
78
|
-
export type BaseProps<T = unknown> = Partial<Omit<BaseProperties<T>, 'model'>> & {
|
|
79
|
-
model?: (Partial<Omit<BaseModel<T>, 'state'>> & {
|
|
80
|
-
state?: Partial<ModelState>;
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
export type DefaultBaseProperties<T = unknown> = Omit<BaseProps<T>, 'model'> & {
|
|
84
|
-
model: BaseModel<T>;
|
|
85
|
-
};
|
|
86
|
-
export interface TypedProperties<T = unknown> extends BaseProperties<T> {
|
|
87
|
-
initialValue: T;
|
|
88
|
-
model: BaseModel<T>;
|
|
89
|
-
onBlur: (event: GenericEvent | undefined, properties: this) => void;
|
|
90
|
-
onChange: (properties: this, event?: GenericEvent) => void;
|
|
91
|
-
onChangeShowDeclaration: (show: boolean, event: GenericEvent | undefined, properties: this) => void;
|
|
92
|
-
onChangeState: (state: ModelState, event: GenericEvent | undefined, properties: this) => void;
|
|
93
|
-
onChangeValue: (value: T, event: GenericEvent | undefined, properties: this) => void;
|
|
94
|
-
onClick: (event: MouseEvent, properties: this) => void;
|
|
95
|
-
onFocus: (event: FocusEvent, properties: this) => void;
|
|
96
|
-
onTouch: (event: GenericEvent, properties: this) => void;
|
|
97
|
-
}
|
|
98
|
-
export type Properties<T = unknown> = TypedProperties<T> & CommonBaseModel<T>;
|
|
99
|
-
export type Props<T = unknown> = Partial<Omit<Properties<T>, 'model'>> & {
|
|
100
|
-
model?: (Partial<Omit<BaseModel<T>, 'state'>> & {
|
|
101
|
-
state?: Partial<ModelState>;
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
export type DefaultProperties<T = unknown> = Omit<Props<T>, 'model'> & {
|
|
105
|
-
model: BaseModel<T>;
|
|
106
|
-
};
|
|
107
|
-
export interface State<T = unknown> {
|
|
108
|
-
modelState?: ModelState;
|
|
109
|
-
value?: null | T;
|
|
110
|
-
}
|
|
111
|
-
export interface ValueState<T = unknown, MS = ModelState> {
|
|
112
|
-
modelState: MS;
|
|
113
|
-
value: null | T;
|
|
114
|
-
}
|
|
115
|
-
export interface EditorState {
|
|
116
|
-
editorIsActive: boolean;
|
|
117
|
-
selectionIsUnstable: boolean;
|
|
118
|
-
}
|
|
119
|
-
export interface StaticWebComponent<Type, MS = ModelState, DP = DefaultProperties<Type>> extends StaticBaseWebComponent<Type> {
|
|
120
|
-
defaultModelState: MS;
|
|
121
|
-
defaultProperties: DP;
|
|
122
|
-
strict: boolean;
|
|
123
|
-
}
|
|
124
|
-
export type StaticComponent<Type, P = Props, MS = ModelState, DP = DefaultProperties<Type>> = Omit<ComponentClass<P>, 'propTypes'> & StaticWebComponent<Type, MS, DP>;
|
|
125
|
-
export type StaticFunctionComponent<Type, P = Props, MS = ModelState, DP = DefaultProperties<Type>> = Omit<FunctionComponent<P>, 'propTypes'> & StaticComponent<Type, P, MS, DP>;
|
|
126
|
-
export interface Component<ValueType, ComponentType, P = Props<ValueType>, MS = ModelState, DP = DefaultProperties<ValueType>, A = ComponentAdapter<P>> extends Omit<ForwardRefExoticComponent<P>, 'propTypes'>, StaticWebComponent<ComponentType, MS, DP> {
|
|
127
|
-
(props: P & RefAttributes<A>): ReactElement;
|
|
128
|
-
}
|
|
129
|
-
export declare const baseModelPropertyTypes: ValidationMapping;
|
|
130
|
-
export declare const modelStatePropertyTypes: {
|
|
131
|
-
[key in keyof ModelState]: Requireable<boolean | symbol>;
|
|
132
|
-
};
|
|
133
|
-
export declare const modelPropertyTypes: ValidationMapping;
|
|
134
|
-
export declare const propertyTypes: ValidationMapping;
|
|
135
|
-
export declare const defaultModelState: ModelState;
|
|
136
|
-
export declare const defaultModel: BaseModel<string>;
|
|
137
|
-
export declare const defaultProperties: DefaultProperties;
|
|
138
|
-
export interface ConfigurationProperties {
|
|
139
|
-
strict?: boolean;
|
|
140
|
-
themeConfiguration?: ThemeProviderProps['options'];
|
|
141
|
-
tooltip?: Properties['tooltip'];
|
|
142
|
-
wrap?: boolean;
|
|
143
|
-
}
|