@dfds-ui/forms 2.0.26 → 2.0.27-alpha.75891023

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/cjs/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from './password-field/PasswordField';
10
10
  export * from './radio';
11
11
  export * from './rating';
12
12
  export * from './select-field/AsyncSelectField';
13
+ export * from './select-field/CreatableSelectField';
13
14
  export * from './select-field/NativeSelectField';
14
15
  export * from './select-field/SelectField';
15
16
  export * from './switch/index';
package/cjs/index.js CHANGED
@@ -135,6 +135,17 @@ Object.keys(_AsyncSelectField).forEach(function (key) {
135
135
  }
136
136
  });
137
137
  });
138
+ var _CreatableSelectField = require("./select-field/CreatableSelectField");
139
+ Object.keys(_CreatableSelectField).forEach(function (key) {
140
+ if (key === "default" || key === "__esModule") return;
141
+ if (key in exports && exports[key] === _CreatableSelectField[key]) return;
142
+ Object.defineProperty(exports, key, {
143
+ enumerable: true,
144
+ get: function get() {
145
+ return _CreatableSelectField[key];
146
+ }
147
+ });
148
+ });
138
149
  var _NativeSelectField = require("./select-field/NativeSelectField");
139
150
  Object.keys(_NativeSelectField).forEach(function (key) {
140
151
  if (key === "default" || key === "__esModule") return;
@@ -0,0 +1,165 @@
1
+ import React from 'react';
2
+ import { CreatableProps } from 'react-select/creatable';
3
+ import { ActionMeta, createFilter, GroupBase, MultiValue, OptionsOrGroups, SingleValue } from 'react-select';
4
+ import { BaseFieldProps } from '../types';
5
+ declare type Size = 'small' | 'medium' | 'large';
6
+ export declare type CreatableSelectFieldProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = BaseFieldProps & CreatableProps<Option, IsMulti, Group> & {
7
+ assistiveText?: string;
8
+ autoFocus?: boolean;
9
+ className?: string;
10
+ components?: any;
11
+ defaultValue?: SingleValue<Option>;
12
+ errorMessage?: string;
13
+ /**
14
+ * Configuration object passed to react-select createFilter function to create [custom filter
15
+ * logic](https://react-select.com/advanced#custom-filter-logic)
16
+ * @param ignoreCase - boolean (optional)
17
+ * @param ignoreAccents - boolean (optional)
18
+ * @param stringify (obj: any) => string (optional)
19
+ * @param trim - boolean (optional)
20
+ * @param matchForm - 'any' | 'start'
21
+ */
22
+ filterConfig?: Parameters<typeof createFilter>[0];
23
+ /**
24
+ * Indicates that the Select can be cleared after selecting an Option.
25
+ *
26
+ * Setting this to true will display a small dismiss cross when a value is selected
27
+ */
28
+ isClearable?: boolean;
29
+ isMulti?: boolean;
30
+ isSearchable?: boolean;
31
+ menuIsOpen?: boolean;
32
+ menuPlacement?: 'bottom' | 'auto' | 'top';
33
+ onBlur?: (value: any) => void;
34
+ onChange?: (newValue: SingleValue<Option> | MultiValue<Option>, actionMeta: ActionMeta<Option>) => void;
35
+ onSelect?: (value: SingleValue<Option> | MultiValue<Option>) => void;
36
+ options?: OptionsOrGroups<Option, GroupBase<Option>>;
37
+ placeholder?: string;
38
+ prefix?: React.ReactNode;
39
+ styles?: any;
40
+ suffix?: React.ReactNode;
41
+ value?: SingleValue<Option> | MultiValue<Option>;
42
+ visualSize?: Size;
43
+ };
44
+ declare const CreatableSelectFieldInner: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>({ assistiveText, components, defaultValue, disabled, errorMessage, filterConfig, help, helpPlacement, hideAsterisk, isClearable, isMulti, isSearchable, label, name, onBlur, onChange, onSelect, options, placeholder, required, styles, value, visualSize, ...rest }: CreatableSelectFieldProps<Option, IsMulti, Group>, ref: React.ForwardedRef<any>) => JSX.Element;
45
+ export declare const CreatableSelectField: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(props: BaseFieldProps & Omit<Pick<import("react-select/dist/declarations/src/Select").Props<Option, IsMulti, Group>, "id" | "name" | "value" | "form" | "className" | "autoFocus" | "aria-errormessage" | "aria-invalid" | "aria-label" | "aria-labelledby" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "theme" | "ariaLiveMessages" | "classNamePrefix" | "delimiter" | "formatOptionLabel" | "hideSelectedOptions" | "inputValue" | "inputId" | "instanceId" | "isClearable" | "isOptionSelected" | "menuPortalTarget" | "onInputChange" | "onMenuOpen" | "onMenuClose" | "onMenuScrollToTop" | "onMenuScrollToBottom"> & Partial<Pick<import("react-select/dist/declarations/src/Select").Props<Option, IsMulti, Group>, "tabIndex" | "options" | "placeholder" | "aria-live" | "components" | "isOptionDisabled" | "isRtl" | "styles" | "isDisabled" | "isMulti" | "controlShouldRenderValue" | "menuPlacement" | "menuPosition" | "loadingMessage" | "noOptionsMessage" | "backspaceRemovesValue" | "blurInputOnSelect" | "captureMenuScroll" | "closeMenuOnSelect" | "closeMenuOnScroll" | "escapeClearsValue" | "filterOption" | "formatGroupLabel" | "getOptionLabel" | "getOptionValue" | "isLoading" | "isSearchable" | "minMenuHeight" | "maxMenuHeight" | "menuIsOpen" | "menuShouldBlockScroll" | "menuShouldScrollIntoView" | "openMenuOnFocus" | "openMenuOnClick" | "pageSize" | "screenReaderStatus" | "tabSelectsValue">> & Partial<Pick<{
46
+ 'aria-live': string;
47
+ backspaceRemovesValue: boolean;
48
+ blurInputOnSelect: boolean;
49
+ captureMenuScroll: boolean;
50
+ closeMenuOnSelect: boolean;
51
+ closeMenuOnScroll: boolean;
52
+ components: {};
53
+ controlShouldRenderValue: boolean;
54
+ escapeClearsValue: boolean;
55
+ filterOption: (option: import("react-select/dist/declarations/src/filters").FilterOptionOption<unknown>, rawInput: string) => boolean;
56
+ formatGroupLabel: <Option_1, Group_1 extends GroupBase<Option_1>>(group: Group_1) => string;
57
+ getOptionLabel: <Option_2>(option: Option_2) => string;
58
+ getOptionValue: <Option_3>(option: Option_3) => string;
59
+ isDisabled: boolean;
60
+ isLoading: boolean;
61
+ isMulti: boolean;
62
+ isRtl: boolean;
63
+ isSearchable: boolean;
64
+ isOptionDisabled: <Option_4>(option: Option_4) => boolean;
65
+ loadingMessage: () => string;
66
+ maxMenuHeight: number;
67
+ minMenuHeight: number;
68
+ menuIsOpen: boolean;
69
+ menuPlacement: string;
70
+ menuPosition: string;
71
+ menuShouldBlockScroll: boolean;
72
+ menuShouldScrollIntoView: boolean;
73
+ noOptionsMessage: () => string;
74
+ openMenuOnFocus: boolean;
75
+ openMenuOnClick: boolean;
76
+ options: never[];
77
+ pageSize: number;
78
+ placeholder: string;
79
+ screenReaderStatus: ({ count }: {
80
+ count: number;
81
+ }) => string;
82
+ styles: {};
83
+ tabIndex: number;
84
+ tabSelectsValue: boolean;
85
+ }, never>>, "value" | "onChange" | "inputValue" | "menuIsOpen" | "onInputChange" | "onMenuOpen" | "onMenuClose"> & Partial<Pick<import("react-select/dist/declarations/src/Select").Props<Option, IsMulti, Group>, "id" | "name" | "value" | "form" | "className" | "autoFocus" | "aria-errormessage" | "aria-invalid" | "aria-label" | "aria-labelledby" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "theme" | "ariaLiveMessages" | "classNamePrefix" | "delimiter" | "formatOptionLabel" | "hideSelectedOptions" | "inputValue" | "inputId" | "instanceId" | "isClearable" | "isOptionSelected" | "menuPortalTarget" | "onInputChange" | "onMenuOpen" | "onMenuClose" | "onMenuScrollToTop" | "onMenuScrollToBottom"> & Partial<Pick<import("react-select/dist/declarations/src/Select").Props<Option, IsMulti, Group>, "tabIndex" | "options" | "placeholder" | "aria-live" | "components" | "isOptionDisabled" | "isRtl" | "styles" | "isDisabled" | "isMulti" | "controlShouldRenderValue" | "menuPlacement" | "menuPosition" | "loadingMessage" | "noOptionsMessage" | "backspaceRemovesValue" | "blurInputOnSelect" | "captureMenuScroll" | "closeMenuOnSelect" | "closeMenuOnScroll" | "escapeClearsValue" | "filterOption" | "formatGroupLabel" | "getOptionLabel" | "getOptionValue" | "isLoading" | "isSearchable" | "minMenuHeight" | "maxMenuHeight" | "menuIsOpen" | "menuShouldBlockScroll" | "menuShouldScrollIntoView" | "openMenuOnFocus" | "openMenuOnClick" | "pageSize" | "screenReaderStatus" | "tabSelectsValue">> & Partial<Pick<{
86
+ 'aria-live': string;
87
+ backspaceRemovesValue: boolean;
88
+ blurInputOnSelect: boolean;
89
+ captureMenuScroll: boolean;
90
+ closeMenuOnSelect: boolean;
91
+ closeMenuOnScroll: boolean;
92
+ components: {};
93
+ controlShouldRenderValue: boolean;
94
+ escapeClearsValue: boolean;
95
+ filterOption: (option: import("react-select/dist/declarations/src/filters").FilterOptionOption<unknown>, rawInput: string) => boolean;
96
+ formatGroupLabel: <Option_1, Group_1 extends GroupBase<Option_1>>(group: Group_1) => string;
97
+ getOptionLabel: <Option_2>(option: Option_2) => string;
98
+ getOptionValue: <Option_3>(option: Option_3) => string;
99
+ isDisabled: boolean;
100
+ isLoading: boolean;
101
+ isMulti: boolean;
102
+ isRtl: boolean;
103
+ isSearchable: boolean;
104
+ isOptionDisabled: <Option_4>(option: Option_4) => boolean;
105
+ loadingMessage: () => string;
106
+ maxMenuHeight: number;
107
+ minMenuHeight: number;
108
+ menuIsOpen: boolean;
109
+ menuPlacement: string;
110
+ menuPosition: string;
111
+ menuShouldBlockScroll: boolean;
112
+ menuShouldScrollIntoView: boolean;
113
+ noOptionsMessage: () => string;
114
+ openMenuOnFocus: boolean;
115
+ openMenuOnClick: boolean;
116
+ options: never[];
117
+ pageSize: number;
118
+ placeholder: string;
119
+ screenReaderStatus: ({ count }: {
120
+ count: number;
121
+ }) => string;
122
+ styles: {};
123
+ tabIndex: number;
124
+ tabSelectsValue: boolean;
125
+ }, never>>> & import("react-select/dist/declarations/src/useStateManager").StateManagerAdditionalProps<Option> & import("react-select/dist/declarations/src/useCreatable").CreatableAdditionalProps<Option, Group> & {
126
+ assistiveText?: string | undefined;
127
+ autoFocus?: boolean | undefined;
128
+ className?: string | undefined;
129
+ components?: any;
130
+ defaultValue?: SingleValue<Option> | undefined;
131
+ errorMessage?: string | undefined;
132
+ /**
133
+ * Configuration object passed to react-select createFilter function to create [custom filter
134
+ * logic](https://react-select.com/advanced#custom-filter-logic)
135
+ * @param ignoreCase - boolean (optional)
136
+ * @param ignoreAccents - boolean (optional)
137
+ * @param stringify (obj: any) => string (optional)
138
+ * @param trim - boolean (optional)
139
+ * @param matchForm - 'any' | 'start'
140
+ */
141
+ filterConfig?: Parameters<typeof createFilter>[0];
142
+ /**
143
+ * Indicates that the Select can be cleared after selecting an Option.
144
+ *
145
+ * Setting this to true will display a small dismiss cross when a value is selected
146
+ */
147
+ isClearable?: boolean | undefined;
148
+ isMulti?: boolean | undefined;
149
+ isSearchable?: boolean | undefined;
150
+ menuIsOpen?: boolean | undefined;
151
+ menuPlacement?: "auto" | "top" | "bottom" | undefined;
152
+ onBlur?: ((value: any) => void) | undefined;
153
+ onChange?: ((newValue: MultiValue<Option> | SingleValue<Option>, actionMeta: ActionMeta<Option>) => void) | undefined;
154
+ onSelect?: ((value: MultiValue<Option> | SingleValue<Option>) => void) | undefined;
155
+ options?: OptionsOrGroups<Option, GroupBase<Option>> | undefined;
156
+ placeholder?: string | undefined;
157
+ prefix?: React.ReactNode;
158
+ styles?: any;
159
+ suffix?: React.ReactNode;
160
+ value?: MultiValue<Option> | SingleValue<Option> | undefined;
161
+ visualSize?: Size | undefined;
162
+ } & {
163
+ ref?: React.ForwardedRef<any> | undefined;
164
+ }) => ReturnType<typeof CreatableSelectFieldInner>;
165
+ export default CreatableSelectField;