opus-toolkit-components 0.2.5 → 0.2.6
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,23 @@ const Accordion = _ref => {
|
|
|
585
585
|
setInternalActiveIndex(activeIndex);
|
|
586
586
|
}
|
|
587
587
|
}, [activeIndex]);
|
|
588
|
-
return /*#__PURE__*/
|
|
589
|
-
className: "accordion"
|
|
590
|
-
}, /*#__PURE__*/
|
|
591
|
-
className: "accordion-item border-2 rounded-lg border-gray-200
|
|
588
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
589
|
+
className: "accordion rounded-md"
|
|
590
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
591
|
+
className: "accordion-item border-2 rounded-lg border-gray-200",
|
|
592
592
|
key: index
|
|
593
|
-
}, /*#__PURE__*/
|
|
594
|
-
className: "accordion-header flex
|
|
593
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
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
|
-
cursor:
|
|
598
|
+
cursor: "pointer"
|
|
599
599
|
}
|
|
600
|
-
}, /*#__PURE__*/
|
|
601
|
-
className: "
|
|
602
|
-
}, /*#__PURE__*/
|
|
600
|
+
}, /*#__PURE__*/React.createElement("h2", {
|
|
601
|
+
className: "text-2xl text-gray-800"
|
|
602
|
+
}, title), /*#__PURE__*/React.createElement("div", null, isActive ? "-" : "+"))), isActive && /*#__PURE__*/React.createElement("div", {
|
|
603
|
+
className: "accordion-body p-2"
|
|
604
|
+
}, children));
|
|
603
605
|
};
|
|
604
606
|
/* harmony default export */ const Accordions_Accordion = (Accordion);
|
|
605
607
|
// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js
|
|
@@ -746,27 +748,41 @@ function DatePicker(_ref) {
|
|
|
746
748
|
initialDate = '',
|
|
747
749
|
label = 'Select a Date:',
|
|
748
750
|
isValid = true,
|
|
749
|
-
errorMessage = "Error message"
|
|
751
|
+
errorMessage = "Error message",
|
|
752
|
+
name = 'date',
|
|
753
|
+
// Add name prop for form identification
|
|
754
|
+
onChange,
|
|
755
|
+
// Add onChange prop for passing event to parent
|
|
756
|
+
value
|
|
750
757
|
} = _ref;
|
|
751
|
-
const [selectedDate, setSelectedDate] = (0,external_react_.useState)(initialDate);
|
|
758
|
+
const [selectedDate, setSelectedDate] = (0,external_react_.useState)(value || initialDate);
|
|
752
759
|
(0,external_react_.useEffect)(() => {
|
|
753
|
-
|
|
754
|
-
|
|
760
|
+
if (value !== undefined) {
|
|
761
|
+
setSelectedDate(value); // Sync with controlled prop if it's passed
|
|
762
|
+
} else {
|
|
763
|
+
setSelectedDate(initialDate); // Fallback to initial date if uncontrolled
|
|
764
|
+
}
|
|
765
|
+
}, [value, initialDate]);
|
|
755
766
|
const handleDateChange = e => {
|
|
756
767
|
setSelectedDate(e.target.value);
|
|
768
|
+
if (onChange) {
|
|
769
|
+
onChange(e); // Pass the full event object to the parent component
|
|
770
|
+
}
|
|
757
771
|
};
|
|
758
772
|
const inputClasses = `rounded-md bg-white border px-4 py-3 text-md font-normal text-gray-900 ${isValid ? 'border-slate-400' : 'border-rose-500'}`;
|
|
759
|
-
return /*#__PURE__*/
|
|
773
|
+
return /*#__PURE__*/external_react_default().createElement("div", {
|
|
760
774
|
className: "flex flex-col mb-4"
|
|
761
|
-
}, /*#__PURE__*/
|
|
775
|
+
}, /*#__PURE__*/external_react_default().createElement("label", {
|
|
762
776
|
htmlFor: "date"
|
|
763
|
-
}, label), /*#__PURE__*/
|
|
777
|
+
}, label), /*#__PURE__*/external_react_default().createElement("input", {
|
|
764
778
|
type: "date",
|
|
765
779
|
id: "date",
|
|
780
|
+
name: name // Pass the name to identify the input in the event
|
|
781
|
+
,
|
|
766
782
|
value: selectedDate,
|
|
767
783
|
onChange: handleDateChange,
|
|
768
784
|
className: inputClasses
|
|
769
|
-
}), !isValid && /*#__PURE__*/
|
|
785
|
+
}), !isValid && /*#__PURE__*/external_react_default().createElement("span", {
|
|
770
786
|
className: "text-rose-500 text-sm"
|
|
771
787
|
}, errorMessage));
|
|
772
788
|
}
|
|
@@ -8994,28 +9010,6 @@ const ForwardRef = /*#__PURE__*/ external_react_.forwardRef(ChevronDownIcon);
|
|
|
8994
9010
|
|
|
8995
9011
|
|
|
8996
9012
|
|
|
8997
|
-
|
|
8998
|
-
/*
|
|
8999
|
-
|
|
9000
|
-
Usage Example:
|
|
9001
|
-
|
|
9002
|
-
import Dropdown from './Dropdown';
|
|
9003
|
-
|
|
9004
|
-
const menuItems = [
|
|
9005
|
-
{ label: 'Account settings', value: 'settings' },
|
|
9006
|
-
{ label: 'Support', value: 'support' },
|
|
9007
|
-
{ label: 'License', value: 'license' },
|
|
9008
|
-
{ label: 'Sign out', value: 'signOut', onClick: () => alert('Signed out!') },
|
|
9009
|
-
];
|
|
9010
|
-
|
|
9011
|
-
function App() {
|
|
9012
|
-
return <Dropdown items={menuItems} />;
|
|
9013
|
-
}
|
|
9014
|
-
|
|
9015
|
-
export default App;
|
|
9016
|
-
|
|
9017
|
-
*/
|
|
9018
|
-
|
|
9019
9013
|
function Dropdown(_ref) {
|
|
9020
9014
|
let {
|
|
9021
9015
|
items,
|
|
@@ -9023,20 +9017,22 @@ function Dropdown(_ref) {
|
|
|
9023
9017
|
isValid = true,
|
|
9024
9018
|
placeholder = "Example Placeholder",
|
|
9025
9019
|
name,
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
onChange
|
|
9020
|
+
onChange,
|
|
9021
|
+
value
|
|
9029
9022
|
} = _ref;
|
|
9030
9023
|
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'}`;
|
|
9031
|
-
const
|
|
9032
|
-
//
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
|
|
9039
|
-
|
|
9024
|
+
const handleSelect = selectedValue => {
|
|
9025
|
+
// Create a synthetic event
|
|
9026
|
+
const event = {
|
|
9027
|
+
target: {
|
|
9028
|
+
name: name,
|
|
9029
|
+
value: selectedValue
|
|
9030
|
+
}
|
|
9031
|
+
};
|
|
9032
|
+
|
|
9033
|
+
// Log the synthetic event
|
|
9034
|
+
console.log('Synthetic event:', event);
|
|
9035
|
+
onChange(event); // Pass the synthetic event object
|
|
9040
9036
|
};
|
|
9041
9037
|
return /*#__PURE__*/external_react_default().createElement(rn, {
|
|
9042
9038
|
as: "div",
|
|
@@ -9044,7 +9040,7 @@ function Dropdown(_ref) {
|
|
|
9044
9040
|
name: name
|
|
9045
9041
|
}, /*#__PURE__*/external_react_default().createElement("label", null, label), /*#__PURE__*/external_react_default().createElement("div", null, /*#__PURE__*/external_react_default().createElement(It, {
|
|
9046
9042
|
className: inputClasses
|
|
9047
|
-
},
|
|
9043
|
+
}, placeholder, /*#__PURE__*/external_react_default().createElement(esm_ChevronDownIcon, {
|
|
9048
9044
|
"aria-hidden": "true",
|
|
9049
9045
|
className: "-mr-1 h-5 w-5 text-gray-400"
|
|
9050
9046
|
}))), /*#__PURE__*/external_react_default().createElement(gt, {
|
|
@@ -9059,13 +9055,12 @@ function Dropdown(_ref) {
|
|
|
9059
9055
|
active
|
|
9060
9056
|
} = _ref2;
|
|
9061
9057
|
return /*#__PURE__*/external_react_default().createElement("button", {
|
|
9062
|
-
onClick: () =>
|
|
9063
|
-
,
|
|
9058
|
+
onClick: () => handleSelect(item.value),
|
|
9064
9059
|
className: `block w-full px-4 py-2 text-left text-sm text-gray-700 ${active ? 'bg-gray-100 text-gray-900' : ''}`
|
|
9065
9060
|
}, item.label);
|
|
9066
9061
|
})))), !isValid && /*#__PURE__*/external_react_default().createElement("span", {
|
|
9067
9062
|
className: "text-rose-500 text-sm"
|
|
9068
|
-
}
|
|
9063
|
+
}));
|
|
9069
9064
|
}
|
|
9070
9065
|
;// ./src/index.js
|
|
9071
9066
|
|
|
@@ -9080,4 +9075,4 @@ function Dropdown(_ref) {
|
|
|
9080
9075
|
/******/ })()
|
|
9081
9076
|
;
|
|
9082
9077
|
});
|
|
9083
|
-
//# sourceMappingURL=main.
|
|
9078
|
+
//# sourceMappingURL=main.800321707204c2a59f90.js.map
|