@carto/ps-react-ui 1.2.6 → 1.3.0

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.
@@ -10,7 +10,8 @@ export * from './list/types';
10
10
  export { SectionContainer } from './section-container/section-container.component';
11
11
  export * from './section-container/types';
12
12
  export { SimpleSelect } from './selects/simple-select/simple-select.component';
13
- export { AutocompleteSelect } from './selects/autocomplete-select/autocomplete-select.component';
13
+ export { AutocompleteSelect } from './selects/autocomplete/autocomplete-select/autocomplete-select.component';
14
+ export { AutocompleteSelectSimple } from './selects/autocomplete/autocomplete-select-simple/autocomplete-select-simple.component';
14
15
  export { createOptionsFromArray } from './selects/simple-select/create-options-from-array.utils';
15
16
  export * from './selects/types';
16
17
  export { Table } from './table/table.component';
@@ -1,4 +1,4 @@
1
- import { AutocompleteSelectProps } from '../types';
1
+ import { AutocompleteSelectProps } from '../../types';
2
2
  /**
3
3
  * AutocompleteSelect component
4
4
  *
@@ -22,16 +22,12 @@ import { AutocompleteSelectProps } from '../types';
22
22
  * ```jsx
23
23
  * <AutocompleteSelect
24
24
  * options={[
25
- * { value: '1', label: 'Option 1' },
26
- * { value: '2', label: 'Option 2' },
25
+ * { value: '1', label: 'Option 1', group: 'Group 1' },
26
+ * { value: '2', label: 'Option 2', group: 'Group 1' },
27
27
  * ]}
28
28
  * hasAll={true}
29
29
  * grouped={true}
30
30
  * label='Select'
31
- * divisionType={{
32
- * singular: 'option',
33
- * plural: 'options',
34
- * }}
35
31
  * placeholder='Select'
36
32
  * selectAllLabel='Select all'
37
33
  * size='small'
@@ -40,4 +36,4 @@ import { AutocompleteSelectProps } from '../types';
40
36
  * />;
41
37
  * ```
42
38
  */
43
- export declare function AutocompleteSelect({ options, grouped, hasAll, label, placeholder, selectAllLabel, size, value, onChange, ...props }: AutocompleteSelectProps): JSX.Element;
39
+ export declare function AutocompleteSelect({ options, grouped, hasAll, label, placeholder, selectAllLabel, size, texts, value, RenderInputProps, onChange, ...props }: AutocompleteSelectProps): JSX.Element;
@@ -0,0 +1,35 @@
1
+ import { AutocompleteSelectSimpleProps } from '../../types';
2
+ /**
3
+ * AutocompleteSelectSimple component
4
+ *
5
+ * @param {AutocompleteSelectSimpleProps} props - Material UI Autocomplete props
6
+ *
7
+ * @defaultValues
8
+ *
9
+ * | Prop | Value |
10
+ * | --- | --- |
11
+ * | `grouped` | `false` |
12
+ * | `placeholder` | `'Select'` |
13
+ * | `size` | `'small'` |
14
+ *
15
+ * @remarks
16
+ * The AutocompleteSelectSimple component is a wrapper around the Material UI Autocomplete component. More information about the props can be found here: https://v4.mui.com/api/autocomplete
17
+ *
18
+ * @example
19
+ *
20
+ * ```jsx
21
+ * <AutocompleteSelectSimple
22
+ * options={[
23
+ * { value: '1', label: 'Option 1', group: 'Group 1' },
24
+ * { value: '2', label: 'Option 2', group: 'Group 1' },
25
+ * ]}
26
+ * grouped={true}
27
+ * label='Select'
28
+ * placeholder='Select'
29
+ * size='small'
30
+ * value={value}
31
+ * onChange={onChange}
32
+ * />;
33
+ * ```
34
+ */
35
+ export declare function AutocompleteSelectSimple({ options, grouped, label, placeholder, size, value, onChange, ...props }: AutocompleteSelectSimpleProps): JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { OptionProps } from '../../types';
2
+ export declare function AutocompleteSelectOption({ option, state: { selected }, simple, }: OptionProps): JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import type { ChangeEvent, ReactNode } from 'react';
2
2
  import type { SelectProps } from '@material-ui/core/Select';
3
3
  import { AutocompleteChangeDetails, AutocompleteChangeReason, AutocompleteProps, AutocompleteRenderOptionState, Value } from '@material-ui/lab';
4
+ import { TextFieldProps } from '@material-ui/core';
4
5
  export interface SelectOption {
5
6
  label: string;
6
7
  value: string | number;
@@ -13,11 +14,23 @@ export interface SimpleSelectProps extends SelectProps {
13
14
  export interface OptionProps<T = SelectOption> {
14
15
  option: T;
15
16
  state: AutocompleteRenderOptionState;
17
+ simple?: boolean;
16
18
  }
17
19
  export interface AutocompleteSelectProps<T = SelectOption, Multiple extends boolean | undefined = true, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined> extends Omit<AutocompleteProps<T, Multiple, DisableClearable, FreeSolo>, 'onChange' | 'renderInput'> {
18
20
  grouped?: boolean;
19
21
  hasAll?: boolean;
20
22
  label?: ReactNode;
21
23
  selectAllLabel?: string;
24
+ RenderInputProps?: TextFieldProps;
25
+ texts?: {
26
+ renderTags: {
27
+ selected: string;
28
+ };
29
+ };
30
+ onChange: (event: ChangeEvent<unknown>, options: Value<T, Multiple, DisableClearable, FreeSolo>, reason: AutocompleteChangeReason, detail?: AutocompleteChangeDetails<T>) => void;
31
+ }
32
+ export interface AutocompleteSelectSimpleProps<T = SelectOption, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined> extends Omit<AutocompleteProps<T, Multiple, DisableClearable, FreeSolo>, 'onChange' | 'renderInput'> {
33
+ grouped?: boolean;
34
+ label?: ReactNode;
22
35
  onChange: (event: ChangeEvent<unknown>, options: Value<T, Multiple, DisableClearable, FreeSolo>, reason: AutocompleteChangeReason, detail?: AutocompleteChangeDetails<T>) => void;
23
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carto/ps-react-ui",
3
- "version": "1.2.6",
3
+ "version": "1.3.0",
4
4
  "description": "CARTO's Professional Service React UI library",
5
5
  "files": [
6
6
  "dist"
@@ -1,2 +0,0 @@
1
- import { OptionProps } from '../types';
2
- export declare function AutocompleteSelectOption({ option, state: { selected }, }: OptionProps): JSX.Element;