@tmlmobilidade/ui 20250210.1115.1 → 20250226.1358.59
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/cjs/index.js +25 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/components/common/Combobox/index.d.ts +1 -0
- package/dist/cjs/types/src/components/common/Tree/index.d.ts +1 -0
- package/dist/cjs/types/src/components/common/index.d.ts +1 -0
- package/dist/esm/index.js +14 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/components/common/Combobox/index.d.ts +1 -0
- package/dist/esm/types/src/components/common/Tree/index.d.ts +1 -0
- package/dist/esm/types/src/components/common/index.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/styles.css +48 -29
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
@@ -1032,6 +1032,7 @@ var styles$k = {"wrapper":"styles-module_wrapper__7zsRX","input":"styles-module_
|
|
1032
1032
|
function parseComboboxItem(item) {
|
1033
1033
|
if (typeof item === 'string') {
|
1034
1034
|
return {
|
1035
|
+
icon: null,
|
1035
1036
|
label: item,
|
1036
1037
|
value: item,
|
1037
1038
|
};
|
@@ -1054,7 +1055,6 @@ function ComboboxComponent(props) {
|
|
1054
1055
|
}, [multiple, props.value]);
|
1055
1056
|
// Helper functions
|
1056
1057
|
const getValue = (val) => typeof val === 'string' ? val : val.value;
|
1057
|
-
const getLabel = (val) => typeof val === 'string' ? val : val.label;
|
1058
1058
|
/**
|
1059
1059
|
* Resets the value based on initialValue or default state.
|
1060
1060
|
*/
|
@@ -1139,10 +1139,10 @@ function ComboboxComponent(props) {
|
|
1139
1139
|
function renderValues() {
|
1140
1140
|
if (multiple && Array.isArray(value)) {
|
1141
1141
|
return value.map((item) => {
|
1142
|
-
const itemData = data.find(dataItem => getValue(dataItem) === item);
|
1142
|
+
const itemData = parseComboboxItem(data.find(dataItem => getValue(dataItem) === item) || '');
|
1143
1143
|
if (!itemData)
|
1144
1144
|
return null;
|
1145
|
-
return (jsxRuntimeExports.jsx(core.Pill, { className: styles$k.pill, onRemove: () => removeValue(item), withRemoveButton: true, children: jsxRuntimeExports.jsx("span", { children:
|
1145
|
+
return (jsxRuntimeExports.jsx(core.Pill, { className: styles$k.pill, onRemove: () => removeValue(item), withRemoveButton: true, children: jsxRuntimeExports.jsxs(core.Group, { gap: "sm", children: [itemData.icon && jsxRuntimeExports.jsx("span", { className: styles$k.icon, children: itemData.icon }), jsxRuntimeExports.jsx("span", { children: itemData.label })] }) }, item));
|
1146
1146
|
});
|
1147
1147
|
}
|
1148
1148
|
return null;
|
@@ -1150,10 +1150,13 @@ function ComboboxComponent(props) {
|
|
1150
1150
|
// Render Combobox Options
|
1151
1151
|
function renderOptions() {
|
1152
1152
|
const filtered = filterData();
|
1153
|
-
return (jsxRuntimeExports.jsx(reactViewportList.ViewportList, { itemMargin: maxHeight, items: filtered, children: item =>
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1153
|
+
return (jsxRuntimeExports.jsx(reactViewportList.ViewportList, { itemMargin: maxHeight, items: filtered, children: (item) => {
|
1154
|
+
const itemData = parseComboboxItem(item);
|
1155
|
+
return (jsxRuntimeExports.jsx(core.Combobox.Option, { value: itemData.value, active: Array.isArray(value)
|
1156
|
+
&& value.some(v => getValue(v) === itemData.value), children: jsxRuntimeExports.jsxs(core.Group, { gap: "sm", children: [multiple
|
1157
|
+
&& Array.isArray(value)
|
1158
|
+
&& value.some(v => getValue(v) === itemData.value) && jsxRuntimeExports.jsx(core.CheckIcon, { size: 12 }), jsxRuntimeExports.jsxs(core.Group, { gap: "sm", children: [itemData.icon && jsxRuntimeExports.jsx("span", { className: styles$k.icon, children: itemData.icon }), jsxRuntimeExports.jsx("span", { children: itemData.label })] })] }) }, itemData.value));
|
1159
|
+
} }));
|
1157
1160
|
}
|
1158
1161
|
// Render Input Field
|
1159
1162
|
function renderInput() {
|
@@ -1170,14 +1173,14 @@ function ComboboxComponent(props) {
|
|
1170
1173
|
}
|
1171
1174
|
} }) }), jsxRuntimeExports.jsx("div", { className: styles$k.pillClearButton, children: renderClearButton() })] }) }) }));
|
1172
1175
|
}
|
1173
|
-
const itemData = data.find(dataItem => getValue(dataItem) === value);
|
1176
|
+
const itemData = parseComboboxItem(data.find(dataItem => getValue(dataItem) === value) || '');
|
1174
1177
|
return (jsxRuntimeExports.jsx(core.Combobox.Target, { children: searchable ? (jsxRuntimeExports.jsx(core.InputBase, { className: styles$k.input, onChange: handleSearchChange, onClick: () => combobox.openDropdown(), onFocus: () => combobox.openDropdown(), placeholder: "Search value", rightSection: renderClearButton(), type: "text", value: search, onBlur: () => {
|
1175
1178
|
combobox.closeDropdown();
|
1176
|
-
setSearch(itemData ?
|
1179
|
+
setSearch(itemData ? itemData.label : '');
|
1177
1180
|
}, rightSectionPointerEvents: value === null ? 'none' : 'all' })) : (jsxRuntimeExports.jsx(core.InputBase, { className: styles$k.input, component: "button", onClick: () => combobox.openDropdown(), onFocus: () => combobox.openDropdown(), rightSection: renderClearButton(), type: "button", onBlur: () => {
|
1178
1181
|
combobox.closeDropdown();
|
1179
1182
|
setSearch(value?.toString() || '');
|
1180
|
-
}, rightSectionPointerEvents: value === null ? 'none' : 'all', pointer: true, children: itemData ?
|
1183
|
+
}, rightSectionPointerEvents: value === null ? 'none' : 'all', pointer: true, children: itemData ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("span", { className: styles$k.icon, children: itemData.icon }), itemData.label] })) : (jsxRuntimeExports.jsx(core.Input.Placeholder, { className: styles$k.placeholder, children: "Pick value" })) })) }));
|
1181
1184
|
}
|
1182
1185
|
return (jsxRuntimeExports.jsxs("div", { className: cn(styles$k.wrapper, className), style: { width: fullWidth ? '100%' : undefined }, children: [label && jsxRuntimeExports.jsx("label", { className: styles$k.label, children: label }), description && jsxRuntimeExports.jsx("p", { className: styles$k.description, children: description }), error && jsxRuntimeExports.jsx("p", { className: styles$k.error, children: error }), jsxRuntimeExports.jsxs(core.Combobox, { store: combobox, withinPortal: false, onOptionSubmit: (val) => {
|
1183
1186
|
updateValue(val);
|
@@ -1797,6 +1800,18 @@ function useScreenSize() {
|
|
1797
1800
|
return screenSize;
|
1798
1801
|
}
|
1799
1802
|
|
1803
|
+
Object.defineProperty(exports, "Tree", {
|
1804
|
+
enumerable: true,
|
1805
|
+
get: function () { return core.Tree; }
|
1806
|
+
});
|
1807
|
+
Object.defineProperty(exports, "getTreeExpandedState", {
|
1808
|
+
enumerable: true,
|
1809
|
+
get: function () { return core.getTreeExpandedState; }
|
1810
|
+
});
|
1811
|
+
Object.defineProperty(exports, "useTree", {
|
1812
|
+
enumerable: true,
|
1813
|
+
get: function () { return core.useTree; }
|
1814
|
+
});
|
1800
1815
|
exports.ActionIcon = ActionIcon;
|
1801
1816
|
exports.Badge = Badge;
|
1802
1817
|
exports.Button = Button;
|