@tmlmobilidade/ui 20250617.1337.21 → 20250617.1608.33
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/index.d.ts
CHANGED
|
@@ -205,6 +205,7 @@ interface MultiSelectProps {
|
|
|
205
205
|
className?: string;
|
|
206
206
|
data: DataItem[];
|
|
207
207
|
description?: string;
|
|
208
|
+
disabled?: boolean;
|
|
208
209
|
error?: string;
|
|
209
210
|
fullWidth?: boolean;
|
|
210
211
|
label?: string;
|
|
@@ -213,7 +214,7 @@ interface MultiSelectProps {
|
|
|
213
214
|
searchable?: boolean;
|
|
214
215
|
selected: string[];
|
|
215
216
|
}
|
|
216
|
-
declare function MultiSelect({ data, description, error, label, maxHeight, onChange, searchable, selected, }: MultiSelectProps): react_jsx_runtime.JSX.Element;
|
|
217
|
+
declare function MultiSelect({ data, description, disabled, error, label, maxHeight, onChange, searchable, selected, }: MultiSelectProps): react_jsx_runtime.JSX.Element;
|
|
217
218
|
|
|
218
219
|
interface SegmentedControlProps extends SegmentedControlProps$1 {
|
|
219
220
|
fullWidth?: boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from '../../../../_virtual/jsx-runtime.js';
|
|
2
|
-
import { useCombobox, Pill, Combobox, Group, CheckIcon, PillsInput } from '@mantine/core';
|
|
2
|
+
import { useCombobox, Pill, Combobox, Group, CheckIcon, PillsInput, ScrollArea } from '@mantine/core';
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import styles from './styles.module.css.js';
|
|
5
5
|
|
|
6
|
-
function MultiSelect({ data, description, error, label, maxHeight, onChange, searchable = true, selected, }) {
|
|
6
|
+
function MultiSelect({ data, description, disabled, error, label, maxHeight, onChange, searchable = true, selected, }) {
|
|
7
7
|
const combobox = useCombobox({
|
|
8
8
|
onDropdownClose: () => combobox.resetSelectedOption(),
|
|
9
9
|
onDropdownOpen: () => combobox.updateSelectedOptionIndex('active'),
|
|
@@ -45,7 +45,7 @@ function MultiSelect({ data, description, error, label, maxHeight, onChange, sea
|
|
|
45
45
|
const isSelected = value.some(selectedItem => selectedItem.value === item.value);
|
|
46
46
|
return (jsxRuntimeExports.jsx(Combobox.Option, { active: isSelected, onClick: () => handleValueSelect(item), value: item.value, children: jsxRuntimeExports.jsxs(Group, { gap: "sm", children: [isSelected ? jsxRuntimeExports.jsx(CheckIcon, { size: 12 }) : null, item.icon && jsxRuntimeExports.jsx("span", { children: item.icon }), jsxRuntimeExports.jsx("span", { children: item.label })] }) }, item.value));
|
|
47
47
|
});
|
|
48
|
-
return (jsxRuntimeExports.jsxs(Combobox, { onOptionSubmit: handleOptionSubmit, store: combobox, withinPortal: false, classNames: {
|
|
48
|
+
return (jsxRuntimeExports.jsxs(Combobox, { disabled: disabled, onOptionSubmit: handleOptionSubmit, store: combobox, withinPortal: false, classNames: {
|
|
49
49
|
dropdown: styles.dropdown,
|
|
50
50
|
option: styles.option,
|
|
51
51
|
}, children: [jsxRuntimeExports.jsx(Combobox.DropdownTarget, { children: jsxRuntimeExports.jsx(PillsInput, { "data-focus": combobox.dropdownOpened, description: description, error: error, label: label, onClick: () => combobox.openDropdown(), classNames: {
|
|
@@ -53,7 +53,7 @@ function MultiSelect({ data, description, error, label, maxHeight, onChange, sea
|
|
|
53
53
|
error: styles.error,
|
|
54
54
|
input: styles.input,
|
|
55
55
|
label: styles.label,
|
|
56
|
-
}, children: jsxRuntimeExports.jsxs(Pill.Group, { children: [values, jsxRuntimeExports.jsx(Combobox.EventsTarget, { children: jsxRuntimeExports.jsx(PillsInput.Field, { onBlur: () => combobox.closeDropdown(), onFocus: () => combobox.openDropdown(), placeholder: searchable ? 'Search values' : 'Select values', readOnly: !searchable, value: searchable ? search : '', onChange: (event) => {
|
|
56
|
+
}, children: jsxRuntimeExports.jsxs(Pill.Group, { children: [values, jsxRuntimeExports.jsx(Combobox.EventsTarget, { children: jsxRuntimeExports.jsx(PillsInput.Field, { disabled: disabled, onBlur: () => combobox.closeDropdown(), onFocus: () => combobox.openDropdown(), placeholder: searchable ? 'Search values' : 'Select values', readOnly: !searchable, value: searchable ? search : '', onChange: (event) => {
|
|
57
57
|
if (searchable) {
|
|
58
58
|
combobox.updateSelectedOptionIndex();
|
|
59
59
|
setSearch(event.currentTarget.value);
|
|
@@ -66,7 +66,7 @@ function MultiSelect({ data, description, error, label, maxHeight, onChange, sea
|
|
|
66
66
|
handleValueRemove(lastItem);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
} }) })] }) }) }), jsxRuntimeExports.jsx(Combobox.Dropdown, { className: styles.dropdownWrapper, style: { maxHeight }, children: jsxRuntimeExports.jsx(Combobox.Options, { children: options.length > 0 ? options : jsxRuntimeExports.jsx(Combobox.Empty, { children: "Nothing found..." }) }) })] }));
|
|
69
|
+
} }) })] }) }) }), jsxRuntimeExports.jsx(Combobox.Dropdown, { className: styles.dropdownWrapper, style: { maxHeight }, children: jsxRuntimeExports.jsx(Combobox.Options, { children: jsxRuntimeExports.jsx(ScrollArea.Autosize, { mah: 200, type: "scroll", children: options.length > 0 ? options : jsxRuntimeExports.jsx(Combobox.Empty, { children: "Nothing found..." }) }) }) })] }));
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
export { MultiSelect as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/common/MultiSelect/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/common/MultiSelect/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;AAyBc,SAAU,WAAW,CAAC,EACnC,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,KAAK,EACL,KAAK,EACL,SAAS,EACT,QAAQ,EACR,UAAU,GAAG,IAAI,EACjB,QAAQ,GACU,EAAA;IAClB,MAAM,QAAQ,GAAG,WAAW,CAAC;AA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