opus-toolkit-components 0.3.5 → 0.3.7
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.
|
@@ -784,15 +784,19 @@ const Input = /*#__PURE__*/(0,external_react_.forwardRef)((_ref, ref) => {
|
|
|
784
784
|
// Icon component
|
|
785
785
|
iconPosition = 'left',
|
|
786
786
|
// Icon position: left or right
|
|
787
|
-
isAnimated = false
|
|
787
|
+
isAnimated = false,
|
|
788
|
+
// Add animation class when focused
|
|
789
|
+
required = false // Required field indicator
|
|
788
790
|
} = _ref;
|
|
789
|
-
const inputClasses = `${className} flex items-center rounded-md bg-white border ${isValid ? 'border-greyLight500' : 'border-utilRed1000'}
|
|
791
|
+
const inputClasses = `${className} flex items-center rounded-md bg-white border ${isValid ? 'border-greyLight500' : 'border-utilRed1000'} p-2 text-md font-normal text-gray-900 focus:outline-none focus:border-blue-500 focus:ring-0`;
|
|
790
792
|
const iconClasses = `h-5 w-5 ${isAnimated ? 'transition-transform duration-200 group-focus-within:scale-125' : ''} text-gray-400`;
|
|
791
793
|
return /*#__PURE__*/external_react_default().createElement("div", {
|
|
792
794
|
className: "flex flex-col mb-4"
|
|
793
795
|
}, /*#__PURE__*/external_react_default().createElement("label", {
|
|
794
|
-
className: "text-greyLight1000 mb-1"
|
|
795
|
-
}, label
|
|
796
|
+
className: "text-greyLight1000 mb-1 flex items-center"
|
|
797
|
+
}, label, required && /*#__PURE__*/external_react_default().createElement("span", {
|
|
798
|
+
className: "text-utilRed1000 ml-1"
|
|
799
|
+
}, "*")), /*#__PURE__*/external_react_default().createElement("div", {
|
|
796
800
|
className: `${inputClasses} relative`
|
|
797
801
|
}, Icon && iconPosition === 'left' && /*#__PURE__*/external_react_default().createElement("span", {
|
|
798
802
|
className: "absolute left-3 flex items-center pointer-events-none"
|
|
@@ -805,7 +809,8 @@ const Input = /*#__PURE__*/(0,external_react_.forwardRef)((_ref, ref) => {
|
|
|
805
809
|
name: name,
|
|
806
810
|
placeholder: placeholder,
|
|
807
811
|
onChange: onChange,
|
|
808
|
-
value: value
|
|
812
|
+
value: value,
|
|
813
|
+
required: required // Set HTML required attribute
|
|
809
814
|
}), Icon && iconPosition === 'right' && /*#__PURE__*/external_react_default().createElement("span", {
|
|
810
815
|
className: "absolute right-3 flex items-center pointer-events-none"
|
|
811
816
|
}, /*#__PURE__*/external_react_default().createElement(Icon, {
|
|
@@ -9089,12 +9094,16 @@ function Dropdown(_ref) {
|
|
|
9089
9094
|
items,
|
|
9090
9095
|
label = 'Test Label',
|
|
9091
9096
|
isValid = true,
|
|
9097
|
+
required = false,
|
|
9098
|
+
// New prop for required field
|
|
9092
9099
|
placeholder = 'Example Placeholder',
|
|
9093
9100
|
name,
|
|
9094
9101
|
className = '',
|
|
9095
9102
|
onChange,
|
|
9096
9103
|
value,
|
|
9097
|
-
Icon
|
|
9104
|
+
Icon,
|
|
9105
|
+
// Left-aligned icon
|
|
9106
|
+
errorMessage = 'This field is required' // Default error message for required validation
|
|
9098
9107
|
} = _ref;
|
|
9099
9108
|
const initialSelectedItem = items.find(item => item.value === value) || null;
|
|
9100
9109
|
const [selectedItem, setSelectedItem] = (0,external_react_.useState)(initialSelectedItem);
|
|
@@ -9103,7 +9112,7 @@ function Dropdown(_ref) {
|
|
|
9103
9112
|
const newSelectedItem = items.find(item => item.value === value) || null;
|
|
9104
9113
|
setSelectedItem(newSelectedItem);
|
|
9105
9114
|
}, [value, items]);
|
|
9106
|
-
const inputClasses = `inline-flex w-full justify-between items-center rounded-md bg-white text-md font-normal border
|
|
9115
|
+
const inputClasses = `inline-flex w-full justify-between items-center rounded-md bg-white text-md font-normal border p-2 text-greyLight700 ${isValid ? 'border-greyLight500' : 'border-utilRed'} ${className}`;
|
|
9107
9116
|
const handleSelect = item => {
|
|
9108
9117
|
setSelectedItem(item);
|
|
9109
9118
|
const event = {
|
|
@@ -9118,7 +9127,11 @@ function Dropdown(_ref) {
|
|
|
9118
9127
|
as: "div",
|
|
9119
9128
|
className: "relative inline-block text-left",
|
|
9120
9129
|
name: name
|
|
9121
|
-
}, /*#__PURE__*/external_react_default().createElement("label",
|
|
9130
|
+
}, /*#__PURE__*/external_react_default().createElement("label", {
|
|
9131
|
+
className: "flex items-center"
|
|
9132
|
+
}, label, required && /*#__PURE__*/external_react_default().createElement("span", {
|
|
9133
|
+
className: "ml-1 text-utilRed"
|
|
9134
|
+
}, "*"), " "), /*#__PURE__*/external_react_default().createElement("div", null, /*#__PURE__*/external_react_default().createElement(It, {
|
|
9122
9135
|
className: inputClasses,
|
|
9123
9136
|
onClick: () => setIsOpen(prev => !prev)
|
|
9124
9137
|
}, /*#__PURE__*/external_react_default().createElement("div", {
|
|
@@ -9147,7 +9160,7 @@ function Dropdown(_ref) {
|
|
|
9147
9160
|
}, item.label);
|
|
9148
9161
|
})))), !isValid && /*#__PURE__*/external_react_default().createElement("span", {
|
|
9149
9162
|
className: "text-utilRed text-sm"
|
|
9150
|
-
},
|
|
9163
|
+
}, errorMessage));
|
|
9151
9164
|
}
|
|
9152
9165
|
;// ./src/index.js
|
|
9153
9166
|
|
|
@@ -9162,4 +9175,4 @@ function Dropdown(_ref) {
|
|
|
9162
9175
|
/******/ })()
|
|
9163
9176
|
;
|
|
9164
9177
|
});
|
|
9165
|
-
//# sourceMappingURL=main.
|
|
9178
|
+
//# sourceMappingURL=main.6a096fe22842caaa5fe4.js.map
|