react-input-material 0.0.403 → 0.0.406

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-input-material",
3
- "version": "0.0.403",
3
+ "version": "0.0.406",
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",
@@ -47,8 +47,8 @@
47
47
  "clear": "weboptimizer clear && (rm *.styles.css components/*.styles.css 2>/dev/null || true)",
48
48
  "document": "weboptimizer document",
49
49
  "lint": "yarn clear && weboptimizer lint",
50
- "prepare": "ln --force --symbolic react node_modules/@emotion/core && yarn build",
51
50
  "patch": "for path in patches/*.patch; do target_file_path=\"$(echo \"$path\" | sed --regexp-extended 's/patches\\/([^/]+).patch$/\\1/' | sed 's:\\+:/:g')\"; source_file_path=\"$path\"; echo \"Patch file \\\"$target_file_path\\\" with \\\"$source_file_path\\\".\"; patch --forward --input \"$source_file_path\" --reject-file - \"$target_file_path\"; done; true",
51
+ "prepare": "ln --force --symbolic react node_modules/@emotion/core && yarn build",
52
52
  "postinstall": "yarn patch || true",
53
53
  "serve": "weboptimizer serve",
54
54
  "serve:minimal": "weboptimizer serve '{__reference__: \"target:minimal\"}'",
package/type.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import PropertyTypes from 'clientnode/property-types';
2
2
  import { Mapping, PlainObject, RecursivePartial, ValueOf } from 'clientnode/type';
3
- import { ComponentClass, FocusEvent, ForwardRefExoticComponent, FunctionComponent, HTMLProps, KeyboardEvent, MouseEvent, MutableRefObject, ReactElement, RefAttributes, Requireable, SyntheticEvent } from 'react';
3
+ import { ComponentClass, FocusEvent, ForwardRefExoticComponent, FunctionComponent, HTMLProps, KeyboardEvent, MouseEvent, MutableRefObject, ReactElement, ReactNode, RefAttributes, Requireable, SyntheticEvent } from 'react';
4
4
  import CodeEditorType, { IAceEditorProps as CodeEditorProps } from 'react-ace';
5
5
  import { EditorOptions as RawTinyMCEOptions, Editor as RichTextEditor } from 'tinymce';
6
6
  import { ComponentAdapter, PropertiesValidationMap, StaticWebComponent as StaticBaseWebComponent, ValidationMapping } from 'web-component-wrapper/type';
@@ -9,7 +9,7 @@ import { MDCSelectFoundation } from '@material/select';
9
9
  import { MDCTextFieldFoundation } from '@material/textfield';
10
10
  import { CardMediaProps } from '@rmwc/card';
11
11
  import { MenuApi } from '@rmwc/menu';
12
- import { SelectProps } from '@rmwc/select';
12
+ import { FormattedOption as FormattedSelectionOption, SelectProps } from '@rmwc/select';
13
13
  import { TextFieldProps } from '@rmwc/textfield';
14
14
  import { ThemeProviderProps } from '@rmwc/theme';
15
15
  import { TooltipProps } from '@rmwc/tooltip';
@@ -168,16 +168,18 @@ export declare type CheckboxComponent = InputComponent<CheckboxProps, CheckboxMo
168
168
  export declare const checkboxPropertyTypes: PropertiesValidationMap;
169
169
  export declare const defaultCheckboxModel: CheckboxModel;
170
170
  export declare const defaultCheckboxProperties: DefaultCheckboxProperties;
171
+ export declare type Transformer<T = unknown> = (value: T, configuration: DefaultInputProperties<T>, transformer: InputDataTransformation) => string;
171
172
  export interface FormatSpecification<T = unknown> {
172
173
  options?: PlainObject;
173
- transform?: (_value: T, _configuration: DefaultInputProperties<T>, _transformer: InputDataTransformation) => string;
174
+ transform?: Transformer<T>;
175
+ }
176
+ export interface FormatSpecifications<T = unknown> {
177
+ final: FormatSpecification<T>;
178
+ intermediate?: FormatSpecification<T>;
174
179
  }
175
180
  export interface DataTransformSpecification<T = unknown, InputType = number | string> {
176
- format?: {
177
- final: FormatSpecification<T>;
178
- intermediate?: FormatSpecification<T>;
179
- };
180
- parse?: (_value: InputType, _configuration: DefaultInputProperties<T>, _transformer: InputDataTransformation) => T;
181
+ format?: FormatSpecifications<T>;
182
+ parse?: (value: InputType, configuration: DefaultInputProperties<T>, transformer: InputDataTransformation) => T;
181
183
  type?: NativeInputType;
182
184
  }
183
185
  export declare type InputDataTransformation = {
@@ -193,6 +195,9 @@ export declare type InputDataTransformation = {
193
195
  } & {
194
196
  [_key in Exclude<NativeInputType, 'date' | 'datetime-local' | 'time' | 'number'>]?: DataTransformSpecification<unknown>;
195
197
  };
198
+ export declare type NormalizedSelection = Array<Omit<FormattedSelectionOption, 'value'> & {
199
+ value: unknown;
200
+ }>;
196
201
  export interface InputTablePosition {
197
202
  column: number;
198
203
  row: number;
@@ -209,19 +214,16 @@ export interface InputModel<T = unknown> extends Model<T> {
209
214
  state: InputModelState;
210
215
  }
211
216
  export interface InputValueState<T = unknown, MS = ModelState> extends ValueState<T, MS> {
212
- representation?: string;
217
+ representation?: ReactNode | string;
213
218
  }
214
219
  export declare type NativeInputType = ('date' | 'datetime-local' | 'month' | 'number' | 'range' | 'text' | 'time' | 'week');
215
220
  export declare type GenericInputType = ('boolean' | 'currency' | 'float' | 'integer' | 'string' | NativeInputType);
216
221
  export interface InputChildrenOptions<P, T> {
217
222
  index: number;
218
- normalizedSelection: (SelectProps['options'] | Array<{
219
- label?: string;
220
- value: unknown;
221
- }>);
223
+ normalizedSelection: NormalizedSelection;
222
224
  properties: P;
223
225
  query: string;
224
- suggestion: string;
226
+ suggestion: ReactNode | string;
225
227
  value: T;
226
228
  }
227
229
  export interface SuggestionCreatorOptions<P> {
@@ -255,7 +257,7 @@ export interface InputProperties<T = unknown> extends InputModelState, Propertie
255
257
  outlined: boolean;
256
258
  patternText: string;
257
259
  placeholder: string;
258
- representation: string;
260
+ representation: ReactNode | string;
259
261
  rows: number;
260
262
  searchSelection: boolean;
261
263
  selectableEditor: boolean;
@@ -281,12 +283,12 @@ export interface InputState<T = unknown> extends State<T> {
281
283
  editorIsActive: boolean;
282
284
  hidden?: boolean;
283
285
  modelState: InputModelState;
284
- representation?: string;
286
+ representation?: ReactNode | string;
285
287
  selectionIsUnstable: boolean;
286
288
  showDeclaration: boolean;
287
289
  }
288
290
  export declare type InputAdapter<T = unknown> = ComponentAdapter<InputProperties<T>, Omit<InputState<T>, 'representation' | 'selectionIsUnstable' | 'value'> & {
289
- representation?: string;
291
+ representation?: ReactNode | string;
290
292
  value?: null | T;
291
293
  }>;
292
294
  export interface InputAdapterWithReferences<T = unknown> extends InputAdapter<T> {