opus-toolkit-components 0.2.6 → 0.2.8
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.
|
@@ -585,21 +585,21 @@ const Accordion = _ref => {
|
|
|
585
585
|
setInternalActiveIndex(activeIndex);
|
|
586
586
|
}
|
|
587
587
|
}, [activeIndex]);
|
|
588
|
-
return /*#__PURE__*/
|
|
588
|
+
return /*#__PURE__*/external_react_default().createElement("div", {
|
|
589
589
|
className: "accordion rounded-md"
|
|
590
|
-
}, /*#__PURE__*/
|
|
590
|
+
}, /*#__PURE__*/external_react_default().createElement("div", {
|
|
591
591
|
className: "accordion-item border-2 rounded-lg border-gray-200",
|
|
592
592
|
key: index
|
|
593
|
-
}, /*#__PURE__*/
|
|
593
|
+
}, /*#__PURE__*/external_react_default().createElement("div", {
|
|
594
594
|
className: "accordion-header flex justify-between p-2",
|
|
595
595
|
onClick: toggle // Handle both internal and external toggles
|
|
596
596
|
,
|
|
597
597
|
style: {
|
|
598
598
|
cursor: "pointer"
|
|
599
599
|
}
|
|
600
|
-
}, /*#__PURE__*/
|
|
601
|
-
className: "text-
|
|
602
|
-
}, title), /*#__PURE__*/
|
|
600
|
+
}, /*#__PURE__*/external_react_default().createElement("h2", {
|
|
601
|
+
className: "text-1xl text-gray-800"
|
|
602
|
+
}, title), /*#__PURE__*/external_react_default().createElement("div", null, isActive ? "-" : "+"))), isActive && /*#__PURE__*/external_react_default().createElement("div", {
|
|
603
603
|
className: "accordion-body p-2"
|
|
604
604
|
}, children));
|
|
605
605
|
};
|
|
@@ -9020,18 +9020,19 @@ function Dropdown(_ref) {
|
|
|
9020
9020
|
onChange,
|
|
9021
9021
|
value
|
|
9022
9022
|
} = _ref;
|
|
9023
|
+
const [selectedItem, setSelectedItem] = (0,external_react_.useState)(null); // Initialize to null
|
|
9024
|
+
|
|
9023
9025
|
const inputClasses = `inline-flex w-full justify-center gap-x-1.5 rounded-md bg-white border px-4 py-3 text-md font-normal text-gray-900 ${isValid ? 'border-slate-500' : 'border-rose-500'}`;
|
|
9024
|
-
const handleSelect =
|
|
9026
|
+
const handleSelect = item => {
|
|
9027
|
+
setSelectedItem(item); // Store the whole item
|
|
9028
|
+
|
|
9025
9029
|
// Create a synthetic event
|
|
9026
9030
|
const event = {
|
|
9027
9031
|
target: {
|
|
9028
9032
|
name: name,
|
|
9029
|
-
value:
|
|
9033
|
+
value: item.value // Use the value of the selected item
|
|
9030
9034
|
}
|
|
9031
9035
|
};
|
|
9032
|
-
|
|
9033
|
-
// Log the synthetic event
|
|
9034
|
-
console.log('Synthetic event:', event);
|
|
9035
9036
|
onChange(event); // Pass the synthetic event object
|
|
9036
9037
|
};
|
|
9037
9038
|
return /*#__PURE__*/external_react_default().createElement(rn, {
|
|
@@ -9040,7 +9041,7 @@ function Dropdown(_ref) {
|
|
|
9040
9041
|
name: name
|
|
9041
9042
|
}, /*#__PURE__*/external_react_default().createElement("label", null, label), /*#__PURE__*/external_react_default().createElement("div", null, /*#__PURE__*/external_react_default().createElement(It, {
|
|
9042
9043
|
className: inputClasses
|
|
9043
|
-
}, placeholder, /*#__PURE__*/external_react_default().createElement(esm_ChevronDownIcon, {
|
|
9044
|
+
}, selectedItem ? selectedItem.label : placeholder, " ", /*#__PURE__*/external_react_default().createElement(esm_ChevronDownIcon, {
|
|
9044
9045
|
"aria-hidden": "true",
|
|
9045
9046
|
className: "-mr-1 h-5 w-5 text-gray-400"
|
|
9046
9047
|
}))), /*#__PURE__*/external_react_default().createElement(gt, {
|
|
@@ -9055,7 +9056,10 @@ function Dropdown(_ref) {
|
|
|
9055
9056
|
active
|
|
9056
9057
|
} = _ref2;
|
|
9057
9058
|
return /*#__PURE__*/external_react_default().createElement("button", {
|
|
9058
|
-
|
|
9059
|
+
type: "button" // Prevent form submission
|
|
9060
|
+
,
|
|
9061
|
+
onClick: () => handleSelect(item) // Pass the whole item to handleSelect
|
|
9062
|
+
,
|
|
9059
9063
|
className: `block w-full px-4 py-2 text-left text-sm text-gray-700 ${active ? 'bg-gray-100 text-gray-900' : ''}`
|
|
9060
9064
|
}, item.label);
|
|
9061
9065
|
})))), !isValid && /*#__PURE__*/external_react_default().createElement("span", {
|
|
@@ -9075,4 +9079,4 @@ function Dropdown(_ref) {
|
|
|
9075
9079
|
/******/ })()
|
|
9076
9080
|
;
|
|
9077
9081
|
});
|
|
9078
|
-
//# sourceMappingURL=main.
|
|
9082
|
+
//# sourceMappingURL=main.f7add52064e292b6638b.js.map
|