@uxf/ui 11.117.2 → 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.
package/button/button.stories.js
CHANGED
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Basic = Basic;
|
|
37
37
|
exports.Default = Default;
|
|
38
|
+
exports.OnlyForE2ETests = OnlyForE2ETests;
|
|
38
39
|
exports.LoadingButton = LoadingButton;
|
|
39
40
|
const button_1 = require("@uxf/ui/button");
|
|
40
41
|
const icon_1 = require("@uxf/ui/icon");
|
|
@@ -95,6 +96,16 @@ function Default() {
|
|
|
95
96
|
react_1.default.createElement(button_1.Button, { color: color, isFullWidth: true, onClick: onClick, size: size, variant: variant }, "Full width"),
|
|
96
97
|
react_1.default.createElement("hr", null))))))))))));
|
|
97
98
|
}
|
|
99
|
+
function OnlyForE2ETests() {
|
|
100
|
+
const onClick = console.log;
|
|
101
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-20" },
|
|
102
|
+
react_1.default.createElement("div", { "data-testid": "card-a" },
|
|
103
|
+
react_1.default.createElement(button_1.Button, { onClick: onClick }, "Confirm")),
|
|
104
|
+
react_1.default.createElement("div", { "data-testid": "card-b" },
|
|
105
|
+
react_1.default.createElement(button_1.Button, { onClick: onClick }, "Confirm")),
|
|
106
|
+
react_1.default.createElement("div", { "data-testid": "card-c" },
|
|
107
|
+
react_1.default.createElement(button_1.Button, { onClick: onClick }, "Confirm"))));
|
|
108
|
+
}
|
|
98
109
|
function LoadingButton() {
|
|
99
110
|
const clickHandler = () => new Promise((resolve) => setTimeout(resolve, 3000));
|
|
100
111
|
return (react_1.default.createElement("div", { className: "p-4" },
|
|
@@ -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);
|