@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
@@ -0,0 +1 @@
|
|
1
|
+
export { getTreeExpandedState, RenderTreeNodePayload, Tree, TreeNodeData, useTree } from '@mantine/core';
|
package/dist/esm/index.js
CHANGED
@@ -4,6 +4,7 @@ import React__default, { createContext, useState, useEffect, useMemo, useContext
|
|
4
4
|
import { clsx } from 'clsx';
|
5
5
|
import { DateTime } from 'luxon';
|
6
6
|
import { ActionIcon as ActionIcon$1, createTheme, TextInput, Textarea, PasswordInput as PasswordInput$1, Button as Button$1, MantineProvider, Menu as Menu$1, ColorSwatch, Badge as Badge$1, Checkbox as Checkbox$1, useCombobox, Combobox, Group, CheckIcon, PillsInput, Pill, InputBase, Input, SegmentedControl as SegmentedControl$1, Slider as Slider$1, Switch as Switch$1, Text as Text$1, Tooltip as Tooltip$1, Center, rem, Table, Accordion } from '@mantine/core';
|
7
|
+
export { Tree, getTreeExpandedState, useTree } from '@mantine/core';
|
7
8
|
import { DatesProvider, DateTimePicker as DateTimePicker$1 } from '@mantine/dates';
|
8
9
|
import { ModalsProvider, modals as modals$1 } from '@mantine/modals';
|
9
10
|
export * from '@mantine/modals';
|
@@ -1014,6 +1015,7 @@ var styles$k = {"wrapper":"styles-module_wrapper__7zsRX","input":"styles-module_
|
|
1014
1015
|
function parseComboboxItem(item) {
|
1015
1016
|
if (typeof item === 'string') {
|
1016
1017
|
return {
|
1018
|
+
icon: null,
|
1017
1019
|
label: item,
|
1018
1020
|
value: item,
|
1019
1021
|
};
|
@@ -1036,7 +1038,6 @@ function ComboboxComponent(props) {
|
|
1036
1038
|
}, [multiple, props.value]);
|
1037
1039
|
// Helper functions
|
1038
1040
|
const getValue = (val) => typeof val === 'string' ? val : val.value;
|
1039
|
-
const getLabel = (val) => typeof val === 'string' ? val : val.label;
|
1040
1041
|
/**
|
1041
1042
|
* Resets the value based on initialValue or default state.
|
1042
1043
|
*/
|
@@ -1121,10 +1122,10 @@ function ComboboxComponent(props) {
|
|
1121
1122
|
function renderValues() {
|
1122
1123
|
if (multiple && Array.isArray(value)) {
|
1123
1124
|
return value.map((item) => {
|
1124
|
-
const itemData = data.find(dataItem => getValue(dataItem) === item);
|
1125
|
+
const itemData = parseComboboxItem(data.find(dataItem => getValue(dataItem) === item) || '');
|
1125
1126
|
if (!itemData)
|
1126
1127
|
return null;
|
1127
|
-
return (jsxRuntimeExports.jsx(Pill, { className: styles$k.pill, onRemove: () => removeValue(item), withRemoveButton: true, children: jsxRuntimeExports.jsx("span", { children:
|
1128
|
+
return (jsxRuntimeExports.jsx(Pill, { className: styles$k.pill, onRemove: () => removeValue(item), withRemoveButton: true, children: jsxRuntimeExports.jsxs(Group, { gap: "sm", children: [itemData.icon && jsxRuntimeExports.jsx("span", { className: styles$k.icon, children: itemData.icon }), jsxRuntimeExports.jsx("span", { children: itemData.label })] }) }, item));
|
1128
1129
|
});
|
1129
1130
|
}
|
1130
1131
|
return null;
|
@@ -1132,10 +1133,13 @@ function ComboboxComponent(props) {
|
|
1132
1133
|
// Render Combobox Options
|
1133
1134
|
function renderOptions() {
|
1134
1135
|
const filtered = filterData();
|
1135
|
-
return (jsxRuntimeExports.jsx(ViewportList, { itemMargin: maxHeight, items: filtered, children: item =>
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1136
|
+
return (jsxRuntimeExports.jsx(ViewportList, { itemMargin: maxHeight, items: filtered, children: (item) => {
|
1137
|
+
const itemData = parseComboboxItem(item);
|
1138
|
+
return (jsxRuntimeExports.jsx(Combobox.Option, { value: itemData.value, active: Array.isArray(value)
|
1139
|
+
&& value.some(v => getValue(v) === itemData.value), children: jsxRuntimeExports.jsxs(Group, { gap: "sm", children: [multiple
|
1140
|
+
&& Array.isArray(value)
|
1141
|
+
&& value.some(v => getValue(v) === itemData.value) && jsxRuntimeExports.jsx(CheckIcon, { size: 12 }), jsxRuntimeExports.jsxs(Group, { gap: "sm", children: [itemData.icon && jsxRuntimeExports.jsx("span", { className: styles$k.icon, children: itemData.icon }), jsxRuntimeExports.jsx("span", { children: itemData.label })] })] }) }, itemData.value));
|
1142
|
+
} }));
|
1139
1143
|
}
|
1140
1144
|
// Render Input Field
|
1141
1145
|
function renderInput() {
|
@@ -1152,14 +1156,14 @@ function ComboboxComponent(props) {
|
|
1152
1156
|
}
|
1153
1157
|
} }) }), jsxRuntimeExports.jsx("div", { className: styles$k.pillClearButton, children: renderClearButton() })] }) }) }));
|
1154
1158
|
}
|
1155
|
-
const itemData = data.find(dataItem => getValue(dataItem) === value);
|
1159
|
+
const itemData = parseComboboxItem(data.find(dataItem => getValue(dataItem) === value) || '');
|
1156
1160
|
return (jsxRuntimeExports.jsx(Combobox.Target, { children: searchable ? (jsxRuntimeExports.jsx(InputBase, { className: styles$k.input, onChange: handleSearchChange, onClick: () => combobox.openDropdown(), onFocus: () => combobox.openDropdown(), placeholder: "Search value", rightSection: renderClearButton(), type: "text", value: search, onBlur: () => {
|
1157
1161
|
combobox.closeDropdown();
|
1158
|
-
setSearch(itemData ?
|
1162
|
+
setSearch(itemData ? itemData.label : '');
|
1159
1163
|
}, rightSectionPointerEvents: value === null ? 'none' : 'all' })) : (jsxRuntimeExports.jsx(InputBase, { className: styles$k.input, component: "button", onClick: () => combobox.openDropdown(), onFocus: () => combobox.openDropdown(), rightSection: renderClearButton(), type: "button", onBlur: () => {
|
1160
1164
|
combobox.closeDropdown();
|
1161
1165
|
setSearch(value?.toString() || '');
|
1162
|
-
}, rightSectionPointerEvents: value === null ? 'none' : 'all', pointer: true, children: itemData ?
|
1166
|
+
}, 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(Input.Placeholder, { className: styles$k.placeholder, children: "Pick value" })) })) }));
|
1163
1167
|
}
|
1164
1168
|
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(Combobox, { store: combobox, withinPortal: false, onOptionSubmit: (val) => {
|
1165
1169
|
updateValue(val);
|