@commercetools-uikit/creatable-select-input 0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339

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.
@@ -0,0 +1,323 @@
1
+ import type { ComponentType, ReactNode } from 'react';
2
+ import { type ActionMeta, type GroupBase, type CommonPropsAndClassName, type MenuPlacement, type MenuPosition } from 'react-select';
3
+ import { type CreatableProps } from 'react-select/creatable';
4
+ type TValue = {
5
+ value: string;
6
+ label?: ReactNode;
7
+ };
8
+ type TOptions = TValue[] | {
9
+ options: TValue[];
10
+ }[];
11
+ type TCustomEvent = {
12
+ target: {
13
+ id?: string;
14
+ name?: string;
15
+ value?: unknown;
16
+ };
17
+ persist?: () => void;
18
+ };
19
+ type ReactSelectCreatableProps = CreatableProps<unknown, boolean, GroupBase<unknown>>;
20
+ export type TCreatableSelectInputProps = {
21
+ /**
22
+ * Horizontal size limit of the input fields.
23
+ */
24
+ horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
25
+ /**
26
+ * Indicates the input field has an error
27
+ */
28
+ hasError?: boolean;
29
+ /**
30
+ * Indicates the input field has a warning
31
+ */
32
+ hasWarning?: boolean;
33
+ /**
34
+ * Disables the select input as it is read-only
35
+ */
36
+ isReadOnly?: boolean;
37
+ /**
38
+ * Icon to display on the left of the placeholder text and selected value. Has no effect when `isMulti` is enabled.
39
+ */
40
+ iconLeft?: ReactNode;
41
+ /**
42
+ * Aria label (for assistive tech)
43
+ * <br>
44
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
45
+ */
46
+ 'aria-label'?: ReactSelectCreatableProps['aria-label'];
47
+ /**
48
+ * HTML ID of an element that should be used as the label (for assistive tech)
49
+ * <br>
50
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
51
+ */
52
+ 'aria-labelledby'?: ReactSelectCreatableProps['aria-labelledby'];
53
+ /**
54
+ * Indicate if the value entered in the input is invalid.
55
+ * <br>
56
+ * [Props from React select was used](https://react-select.com/props)
57
+ */
58
+ 'aria-invalid'?: ReactSelectCreatableProps['aria-invalid'];
59
+ /**
60
+ * HTML ID of an element containing an error message related to the input.
61
+ * <br>
62
+ * [Props from React select was used](https://react-select.com/props)
63
+ */
64
+ 'aria-errormessage'?: ReactSelectCreatableProps['aria-errormessage'];
65
+ /**
66
+ * Focus the control when it is mounted
67
+ */
68
+ isAutofocussed?: boolean;
69
+ /**
70
+ * Remove the currently focused option when the user presses backspace
71
+ * <br>
72
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
73
+ */
74
+ backspaceRemovesValue?: ReactSelectCreatableProps['backspaceRemovesValue'];
75
+ /**
76
+ * Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
77
+ * <br>
78
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
79
+ */
80
+ components?: ReactSelectCreatableProps['components'];
81
+ /**
82
+ * Custom method to filter whether an option should be displayed in the menu
83
+ * <br>
84
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
85
+ */
86
+ filterOption?: ReactSelectCreatableProps['filterOption'];
87
+ /**
88
+ * The id of the search input
89
+ * <br>
90
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
91
+ */
92
+ id?: ReactSelectCreatableProps['inputId'];
93
+ /**
94
+ * The value of the search input
95
+ * <br>
96
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
97
+ */
98
+ inputValue?: ReactSelectCreatableProps['inputValue'];
99
+ /**
100
+ * The id to set on the SelectContainer component
101
+ * <br>
102
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
103
+ */
104
+ containerId?: ReactSelectCreatableProps['id'];
105
+ /**
106
+ * Is the select value clearable
107
+ * <br>
108
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
109
+ */
110
+ isClearable?: ReactSelectCreatableProps['isClearable'];
111
+ /**
112
+ * Is the select disabled
113
+ * <br>
114
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
115
+ */
116
+ isDisabled?: ReactSelectCreatableProps['isDisabled'];
117
+ /**
118
+ * Override the built-in logic to detect whether an option is disabled
119
+ * <br>
120
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
121
+ */
122
+ isOptionDisabled?: ReactSelectCreatableProps['isOptionDisabled'];
123
+ /**
124
+ * Support multiple selected options
125
+ * <br>
126
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
127
+ */
128
+ isMulti?: ReactSelectCreatableProps['isMulti'];
129
+ /**
130
+ * Whether to enable search functionality
131
+ * <br>
132
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
133
+ */
134
+ isSearchable?: ReactSelectCreatableProps['isSearchable'];
135
+ /**
136
+ * Maximum height of the menu before scrolling
137
+ * <br>
138
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
139
+ */
140
+ maxMenuHeight?: ReactSelectCreatableProps['maxMenuHeight'];
141
+ /**
142
+ * Dom element to portal the select menu to
143
+ * <br>
144
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
145
+ */
146
+ menuPortalTarget?: ReactSelectCreatableProps['menuPortalTarget'];
147
+ /**
148
+ * z-index value for the menu portal
149
+ * <br>
150
+ * Use in conjunction with `menuPortalTarget`
151
+ */
152
+ menuPortalZIndex?: number;
153
+ /**
154
+ * whether the menu should block scroll while open
155
+ * <br>
156
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
157
+ */
158
+ menuShouldBlockScroll?: ReactSelectCreatableProps['menuShouldBlockScroll'];
159
+ /**
160
+ * Whether the menu should close after a value is selected. Defaults to `true`.
161
+ * <br>
162
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
163
+ */
164
+ closeMenuOnSelect?: ReactSelectCreatableProps['closeMenuOnSelect'];
165
+ /**
166
+ * Name of the HTML Input (optional - without this, no input will be rendered)
167
+ * <br>
168
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
169
+ */
170
+ name?: ReactSelectCreatableProps['name'];
171
+ /**
172
+ * Can be used to render a custom value when there are no options (either because of no search results, or all options have been used, or there were none in the first place). Gets called with `{ inputValue: String }`. `inputValue` will be an empty string when no search text is present.
173
+ * <br>
174
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
175
+ */
176
+ noOptionsMessage?: ReactSelectCreatableProps['noOptionsMessage'];
177
+ /**
178
+ * Handle blur events on the control
179
+ */
180
+ onBlur?: (event: TCustomEvent) => void;
181
+ /**
182
+ * Called with a fake event when value changes. The event's `target.name` will be the `name` supplied in props. The event's `target.value` will hold the value. The value will be the selected option, or an array of options in case `isMulti` is `true`.
183
+ */
184
+ onChange?: (event: TCustomEvent, info: ActionMeta<unknown>) => void;
185
+ /**
186
+ * Handle focus events on the control
187
+ * <br>
188
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
189
+ */
190
+ onFocus?: ReactSelectCreatableProps['onFocus'];
191
+ /**
192
+ * Handle change events on the input
193
+ * <br>
194
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
195
+ */
196
+ onInputChange?: ReactSelectCreatableProps['onInputChange'];
197
+ /**
198
+ * Array of options that populate the select menu
199
+ */
200
+ options?: TOptions;
201
+ /**
202
+ * Determines if option groups will be separated by a divider
203
+ */
204
+ showOptionGroupDivider?: boolean;
205
+ /**
206
+ * Placeholder text for the select value
207
+ * <br>
208
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
209
+ */
210
+ placeholder?: ReactSelectCreatableProps['placeholder'];
211
+ /**
212
+ * Use this property to reduce the paddings of the component for a ui compact variant
213
+ */
214
+ isCondensed?: boolean;
215
+ /**
216
+ * Sets the tabIndex attribute on the input
217
+ * <br>
218
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
219
+ */
220
+ tabIndex?: ReactSelectCreatableProps['tabIndex'];
221
+ /**
222
+ * Select the currently focused option when the user presses tab
223
+ * <br>
224
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
225
+ */
226
+ tabSelectsValue?: ReactSelectCreatableProps['tabSelectsValue'];
227
+ /**
228
+ * The value of the select; reflected by the selected option
229
+ * <br>
230
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
231
+ */
232
+ value?: ReactSelectCreatableProps['value'];
233
+ /**
234
+ * Allow options to be created while the isLoading prop is true. Useful to prevent the "create new ..." option being displayed while async results are still being loaded.
235
+ * <br>
236
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
237
+ */
238
+ allowCreateWhileLoading?: ReactSelectCreatableProps['allowCreateWhileLoading'];
239
+ /**
240
+ * Gets the label for the "create new ..." option in the menu. Is given the current input value.
241
+ * <br>
242
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
243
+ */
244
+ formatCreateLabel?: ReactSelectCreatableProps['formatCreateLabel'];
245
+ /**
246
+ * Determines whether the "create new ..." option should be displayed based on the current input value, select value and options array.
247
+ * <br>
248
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
249
+ */
250
+ isValidNewOption?: ReactSelectCreatableProps['isValidNewOption'];
251
+ /**
252
+ * Returns the data for the new option when it is created. Used to display the value, and is passed to onChange.
253
+ * <br>
254
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
255
+ */
256
+ getNewOptionData?: ReactSelectCreatableProps['getNewOptionData'];
257
+ /**
258
+ * If provided, this will be called with the input value when a new option is created, and onChange will not be called. Use this when you need more control over what happens when new options are created.
259
+ * <br>
260
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
261
+ */
262
+ onCreateOption?: ReactSelectCreatableProps['onCreateOption'];
263
+ /**
264
+ * Sets the position of the createOption element in your options list.
265
+ * <br>
266
+ * [Props from React select was used](https://react-select.com/props#creatable-props)
267
+ */
268
+ createOptionPosition?: ReactSelectCreatableProps['createOptionPosition'];
269
+ };
270
+ declare const CreatableSelectInput: {
271
+ ({ value, isSearchable, menuPortalZIndex, ...props }: TCreatableSelectInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
272
+ displayName: string;
273
+ isTouched(touched: unknown): boolean;
274
+ /**
275
+ * Expose react-select components for customization purposes.
276
+ */
277
+ ClearIndicator: {
278
+ (props: import("@commercetools-uikit/select-utils").TClearIndicatorProps): import("@emotion/react/jsx-runtime").JSX.Element;
279
+ displayName: string;
280
+ };
281
+ Control: <Option_1, IsMulti_1 extends boolean, Group_1 extends GroupBase<Option_1>>(props: import("react-select").ControlProps<Option_1, IsMulti_1, Group_1>) => import("@emotion/react").jsx.JSX.Element;
282
+ CrossIcon: ComponentType<import("react").SVGProps<SVGSVGElement> & {
283
+ size?: number;
284
+ }>;
285
+ DownChevron: ComponentType<import("react").SVGProps<SVGSVGElement> & {
286
+ size?: number;
287
+ }>;
288
+ DropdownIndicator: {
289
+ (props: import("react-select").DropdownIndicatorProps): import("@emotion/react/jsx-runtime").JSX.Element;
290
+ displayName: string;
291
+ };
292
+ Group: <Option_3, IsMulti_3 extends boolean, Group_3 extends GroupBase<Option_3>>(props: import("react-select").GroupProps<Option_3, IsMulti_3, Group_3>) => import("@emotion/react").jsx.JSX.Element;
293
+ GroupHeading: <Option_4, IsMulti_4 extends boolean, Group_4 extends GroupBase<Option_4>>(props: import("react-select").GroupHeadingProps<Option_4, IsMulti_4, Group_4>) => import("@emotion/react").jsx.JSX.Element;
294
+ IndicatorSeparator: <Option_6, IsMulti_6 extends boolean, Group_6 extends GroupBase<Option_6>>(props: import("react-select").IndicatorSeparatorProps<Option_6, IsMulti_6, Group_6>) => import("@emotion/react").jsx.JSX.Element;
295
+ IndicatorsContainer: <Option_5, IsMulti_5 extends boolean, Group_5 extends GroupBase<Option_5>>(props: import("react-select").IndicatorsContainerProps<Option_5, IsMulti_5, Group_5>) => import("@emotion/react").jsx.JSX.Element;
296
+ Input: <Option_7, IsMulti_7 extends boolean, Group_7 extends GroupBase<Option_7>>(props: import("react-select").InputProps<Option_7, IsMulti_7, Group_7>) => import("@emotion/react").jsx.JSX.Element;
297
+ LoadingIndicator: <Option_8, IsMulti_8 extends boolean, Group_8 extends GroupBase<Option_8>>({ innerProps, isRtl, size, ...restProps }: import("react-select").LoadingIndicatorProps<Option_8, IsMulti_8, Group_8>) => import("@emotion/react").jsx.JSX.Element;
298
+ LoadingMessage: <Option_12, IsMulti_12 extends boolean, Group_12 extends GroupBase<Option_12>>({ children, innerProps, ...restProps }: import("react-select").NoticeProps<Option_12, IsMulti_12, Group_12>) => import("@emotion/react").jsx.JSX.Element;
299
+ Menu: <Option_9, IsMulti_9 extends boolean, Group_9 extends GroupBase<Option_9>>(props: import("react-select").MenuProps<Option_9, IsMulti_9, Group_9>) => import("@emotion/react").jsx.JSX.Element;
300
+ MenuList: <Option_10, IsMulti_10 extends boolean, Group_10 extends GroupBase<Option_10>>(props: import("react-select").MenuListProps<Option_10, IsMulti_10, Group_10>) => import("@emotion/react").jsx.JSX.Element;
301
+ MenuPortal: ComponentType<CommonPropsAndClassName<unknown, false, GroupBase<unknown>> & {
302
+ appendTo: HTMLElement | undefined;
303
+ children: ReactNode;
304
+ controlElement: HTMLDivElement | null;
305
+ innerProps: JSX.IntrinsicElements["div"];
306
+ menuPlacement: MenuPlacement;
307
+ menuPosition: MenuPosition;
308
+ }>;
309
+ MultiValue: <Option_14, IsMulti_14 extends boolean, Group_14 extends GroupBase<Option_14>>(props: import("react-select").MultiValueProps<Option_14, IsMulti_14, Group_14>) => import("@emotion/react").jsx.JSX.Element;
310
+ MultiValueContainer: <Option_15, IsMulti_15 extends boolean, Group_15 extends GroupBase<Option_15>>({ children, innerProps, }: import("react-select").MultiValueGenericProps<Option_15, IsMulti_15, Group_15>) => import("@emotion/react").jsx.JSX.Element;
311
+ MultiValueLabel: <Option_15, IsMulti_15 extends boolean, Group_15 extends GroupBase<Option_15>>({ children, innerProps, }: import("react-select").MultiValueGenericProps<Option_15, IsMulti_15, Group_15>) => import("@emotion/react").jsx.JSX.Element;
312
+ MultiValueRemove: {
313
+ (props: import("@commercetools-uikit/select-utils").TTagRemoveProps): import("@emotion/react/jsx-runtime").JSX.Element;
314
+ displayName: string;
315
+ };
316
+ NoOptionsMessage: <Option_13, IsMulti_13 extends boolean, Group_13 extends GroupBase<Option_13>>({ children, innerProps, ...restProps }: import("react-select").NoticeProps<Option_13, IsMulti_13, Group_13>) => import("@emotion/react").jsx.JSX.Element;
317
+ Option: <Option_16, IsMulti_16 extends boolean, Group_16 extends GroupBase<Option_16>>(props: import("react-select").OptionProps<Option_16, IsMulti_16, Group_16>) => import("@emotion/react").jsx.JSX.Element;
318
+ Placeholder: <Option_17, IsMulti_17 extends boolean, Group_17 extends GroupBase<Option_17>>(props: import("react-select").PlaceholderProps<Option_17, IsMulti_17, Group_17>) => import("@emotion/react").jsx.JSX.Element;
319
+ SelectContainer: <Option_18, IsMulti_18 extends boolean, Group_18 extends GroupBase<Option_18>>(props: import("react-select").ContainerProps<Option_18, IsMulti_18, Group_18>) => import("@emotion/react").jsx.JSX.Element;
320
+ SingleValue: <Option_19, IsMulti_19 extends boolean, Group_19 extends GroupBase<Option_19>>(props: import("react-select").SingleValueProps<Option_19, IsMulti_19, Group_19>) => import("@emotion/react").jsx.JSX.Element;
321
+ ValueContainer: <Option_20, IsMulti_20 extends boolean, Group_20 extends GroupBase<Option_20>>(props: import("react-select").ValueContainerProps<Option_20, IsMulti_20, Group_20>) => import("@emotion/react").jsx.JSX.Element;
322
+ };
323
+ export default CreatableSelectInput;
@@ -0,0 +1 @@
1
+ export type { TCreatableSelectInputProps } from "./creatable-select-input.js";
@@ -0,0 +1,3 @@
1
+ export { default } from "./creatable-select-input.js";
2
+ export { default as version } from "./version.js";
3
+ export * from "./export-types.js";
@@ -0,0 +1,2 @@
1
+ declare const _default: "__@UI_KIT_PACKAGE/VERSION_OF_RELEASE__";
2
+ export default _default;
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@commercetools-uikit/creatable-select-input",
3
+ "description": "An input component getting a selection from the user, and where options can also be created by the user.",
4
+ "version": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
5
+ "bugs": "https://github.com/commercetools/ui-kit/issues",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/commercetools/ui-kit.git",
9
+ "directory": "packages/components/inputs/creatable-select-input"
10
+ },
11
+ "homepage": "https://uikit.commercetools.com",
12
+ "keywords": [
13
+ "javascript",
14
+ "typescript",
15
+ "design-system",
16
+ "react",
17
+ "uikit"
18
+ ],
19
+ "license": "MIT",
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "sideEffects": false,
24
+ "main": "dist/commercetools-uikit-creatable-select-input.cjs.js",
25
+ "module": "dist/commercetools-uikit-creatable-select-input.esm.js",
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "dependencies": {
30
+ "@babel/runtime": "^7.20.13",
31
+ "@babel/runtime-corejs3": "^7.20.13",
32
+ "@commercetools-uikit/constraints": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
33
+ "@commercetools-uikit/design-system": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
34
+ "@commercetools-uikit/icons": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
35
+ "@commercetools-uikit/select-utils": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
36
+ "@commercetools-uikit/spacings": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
37
+ "@commercetools-uikit/text": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
38
+ "@commercetools-uikit/utils": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
39
+ "@emotion/react": "^11.10.5",
40
+ "@emotion/styled": "^11.10.5",
41
+ "lodash": "4.17.21",
42
+ "prop-types": "15.8.1",
43
+ "react-select": "5.10.1"
44
+ },
45
+ "devDependencies": {
46
+ "react": "17.0.2",
47
+ "react-dom": "17.0.2",
48
+ "react-intl": "^6.3.2"
49
+ },
50
+ "peerDependencies": {
51
+ "react": "17.x",
52
+ "react-dom": "17.x",
53
+ "react-intl": "6.x"
54
+ }
55
+ }