@uxf/ui 11.118.0 → 11.118.2
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.
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.SynchronousOptions = SynchronousOptions;
|
|
37
|
+
exports.OnlyForE2ETests = OnlyForE2ETests;
|
|
37
38
|
exports.AsynchronousOptions = AsynchronousOptions;
|
|
38
39
|
const react_1 = __importStar(require("react"));
|
|
39
40
|
const action_1 = require("../utils/action");
|
|
@@ -56,6 +57,46 @@ function SynchronousOptions() {
|
|
|
56
57
|
option.label,
|
|
57
58
|
isSelected && " (selected)")), value: value })));
|
|
58
59
|
}
|
|
60
|
+
const FRUITS = [
|
|
61
|
+
{ id: "apple", label: "Apple" },
|
|
62
|
+
{ id: "banana", label: "Banana" },
|
|
63
|
+
{ id: "cherry", label: "Cherry" },
|
|
64
|
+
{ id: "mango", label: "Mango" },
|
|
65
|
+
];
|
|
66
|
+
const COUNTRIES = [
|
|
67
|
+
{ id: "cz", label: "Czech Republic" },
|
|
68
|
+
{ id: "sk", label: "Slovakia" },
|
|
69
|
+
{ id: "de", label: "Germany" },
|
|
70
|
+
{ id: "at", label: "Austria" },
|
|
71
|
+
];
|
|
72
|
+
const COLORS = [
|
|
73
|
+
{ id: "red", label: "Red" },
|
|
74
|
+
{ id: "green", label: "Green" },
|
|
75
|
+
{ id: "blue", label: "Blue" },
|
|
76
|
+
{ id: "yellow", label: "Yellow" },
|
|
77
|
+
];
|
|
78
|
+
const SIZES = [
|
|
79
|
+
{ id: "xs", label: "Extra Small" },
|
|
80
|
+
{ id: "sm", label: "Small" },
|
|
81
|
+
{ id: "md", label: "Medium" },
|
|
82
|
+
{ id: "lg", label: "Large" },
|
|
83
|
+
];
|
|
84
|
+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
85
|
+
const e2eLoadOptions = (data) => async (query) => {
|
|
86
|
+
await delay(300);
|
|
87
|
+
return data.filter((option) => !query || option.label.toLowerCase().includes(query.toLowerCase()));
|
|
88
|
+
};
|
|
89
|
+
function OnlyForE2ETests() {
|
|
90
|
+
const [fruit, setFruit] = (0, react_1.useState)(null);
|
|
91
|
+
const [country, setCountry] = (0, react_1.useState)(null);
|
|
92
|
+
const [color, setColor] = (0, react_1.useState)(null);
|
|
93
|
+
const [size, setSize] = (0, react_1.useState)(null);
|
|
94
|
+
return (react_1.default.createElement("div", { className: "space-y-4 p-4" },
|
|
95
|
+
react_1.default.createElement(index_1.Combobox, { isClearable: true, label: "Fruit", loadOptions: e2eLoadOptions(FRUITS), name: "fruit", onChange: setFruit, placeholder: "Select fruit...", value: fruit }),
|
|
96
|
+
react_1.default.createElement(index_1.Combobox, { isClearable: true, label: "Country", loadOptions: e2eLoadOptions(COUNTRIES), name: "country", onChange: setCountry, placeholder: "Select country...", value: country }),
|
|
97
|
+
react_1.default.createElement(index_1.Combobox, { isClearable: true, label: "Color", loadOptions: e2eLoadOptions(COLORS), name: "color", onChange: setColor, placeholder: "Select color...", value: color }),
|
|
98
|
+
react_1.default.createElement(index_1.Combobox, { isClearable: true, label: "Size", loadOptions: e2eLoadOptions(SIZES), name: "size", onChange: setSize, placeholder: "Select size...", value: size })));
|
|
99
|
+
}
|
|
59
100
|
function AsynchronousOptions() {
|
|
60
101
|
const [value, setValue] = (0, react_1.useState)(null);
|
|
61
102
|
const onChange = (0, action_1.action)("onChange", setValue);
|