opus-toolkit-components 0.3.9 → 0.4.0
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.
|
@@ -872,35 +872,66 @@ function DatePicker(_ref) {
|
|
|
872
872
|
}
|
|
873
873
|
;// ./src/components/Forms/Radios/RadioButton.js
|
|
874
874
|
|
|
875
|
-
|
|
875
|
+
const RadioButtonGroup = _ref => {
|
|
876
876
|
let {
|
|
877
|
+
label,
|
|
878
|
+
options = [{
|
|
879
|
+
value: 'single',
|
|
880
|
+
label: 'Single'
|
|
881
|
+
}, {
|
|
882
|
+
value: 'married',
|
|
883
|
+
label: 'Married'
|
|
884
|
+
}, {
|
|
885
|
+
value: 'divorced',
|
|
886
|
+
label: 'Divorced'
|
|
887
|
+
}, {
|
|
888
|
+
value: 'other',
|
|
889
|
+
label: 'Other'
|
|
890
|
+
}],
|
|
877
891
|
name,
|
|
878
|
-
value,
|
|
879
|
-
checked,
|
|
880
892
|
onChange,
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
893
|
+
className = '',
|
|
894
|
+
isValid = true,
|
|
895
|
+
errorMessage = `${label} is required`,
|
|
896
|
+
required = false
|
|
885
897
|
} = _ref;
|
|
886
|
-
|
|
887
|
-
const
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
898
|
+
const [selectedValue, setSelectedValue] = (0,external_react_.useState)('');
|
|
899
|
+
const handleChange = item => {
|
|
900
|
+
setSelectedValue(item.value);
|
|
901
|
+
const event = {
|
|
902
|
+
target: {
|
|
903
|
+
name: name,
|
|
904
|
+
value: item.value
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
if (onChange) {
|
|
908
|
+
onChange(event);
|
|
909
|
+
}
|
|
910
|
+
};
|
|
911
|
+
return /*#__PURE__*/external_react_default().createElement("div", {
|
|
912
|
+
className: "flex flex-col mb-4"
|
|
913
|
+
}, /*#__PURE__*/external_react_default().createElement("label", {
|
|
914
|
+
className: "text-greyLight700 mb-2 flex items-center"
|
|
915
|
+
}, label, required && /*#__PURE__*/external_react_default().createElement("span", {
|
|
916
|
+
className: "text-utilRed1000 ml-1"
|
|
917
|
+
}, "*")), /*#__PURE__*/external_react_default().createElement("div", {
|
|
918
|
+
className: "flex space-x-4"
|
|
919
|
+
}, options.map(option => /*#__PURE__*/external_react_default().createElement("label", {
|
|
920
|
+
key: option.value,
|
|
921
|
+
className: `cursor-pointer py-2 px-4 border rounded-lg ${selectedValue === option.value ? 'bg-greyBaseDark900 text-greyBaseLight border-greyBaseDark900' : `bg-white text-greyLight700 ${!isValid && selectedValue === '' ? 'border-utilRed1000' : 'border-greyLight500'}`} transition duration-200`
|
|
895
922
|
}, /*#__PURE__*/external_react_default().createElement("input", {
|
|
896
923
|
type: "radio",
|
|
897
924
|
name: name,
|
|
898
|
-
value: value,
|
|
899
|
-
checked:
|
|
900
|
-
onChange:
|
|
901
|
-
className:
|
|
902
|
-
}),
|
|
903
|
-
|
|
925
|
+
value: option.value,
|
|
926
|
+
checked: selectedValue === option.value,
|
|
927
|
+
onChange: () => handleChange(option),
|
|
928
|
+
className: "hidden"
|
|
929
|
+
}), option.label))), !isValid && /*#__PURE__*/external_react_default().createElement("span", {
|
|
930
|
+
className: "text-utilRed1000 text-sm mt-1"
|
|
931
|
+
}, errorMessage));
|
|
932
|
+
};
|
|
933
|
+
RadioButtonGroup.displayName = 'RadioButtonGroup';
|
|
934
|
+
/* harmony default export */ const RadioButton = (RadioButtonGroup);
|
|
904
935
|
;// ./src/components/Tables/Table.js
|
|
905
936
|
|
|
906
937
|
function Table() {
|
|
@@ -9117,7 +9148,7 @@ function Dropdown(_ref) {
|
|
|
9117
9148
|
const newSelectedItem = items.find(item => item.value === value) || null;
|
|
9118
9149
|
setSelectedItem(newSelectedItem);
|
|
9119
9150
|
}, [value, items]);
|
|
9120
|
-
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-
|
|
9151
|
+
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-utilRed1000'} ${className}`;
|
|
9121
9152
|
const handleSelect = item => {
|
|
9122
9153
|
setSelectedItem(item);
|
|
9123
9154
|
const event = {
|
|
@@ -9135,7 +9166,7 @@ function Dropdown(_ref) {
|
|
|
9135
9166
|
}, /*#__PURE__*/external_react_default().createElement("label", {
|
|
9136
9167
|
className: "flex items-center"
|
|
9137
9168
|
}, label, required && /*#__PURE__*/external_react_default().createElement("span", {
|
|
9138
|
-
className: "ml-1 text-
|
|
9169
|
+
className: "ml-1 text-utilRed1000"
|
|
9139
9170
|
}, "*"), " "), /*#__PURE__*/external_react_default().createElement("div", null, /*#__PURE__*/external_react_default().createElement(It, {
|
|
9140
9171
|
className: inputClasses,
|
|
9141
9172
|
onClick: () => setIsOpen(prev => !prev)
|
|
@@ -9164,7 +9195,7 @@ function Dropdown(_ref) {
|
|
|
9164
9195
|
className: `block w-full px-4 py-2 text-left text-sm text-greyLight700 ${active ? 'bg-greyLight100 text-greyLight700' : ''} hover:bg-greyLight100`
|
|
9165
9196
|
}, item.label);
|
|
9166
9197
|
})))), !isValid && /*#__PURE__*/external_react_default().createElement("span", {
|
|
9167
|
-
className: "text-
|
|
9198
|
+
className: "text-utilRed1000 text-sm"
|
|
9168
9199
|
}, errorMessage));
|
|
9169
9200
|
}
|
|
9170
9201
|
;// ./src/index.js
|
|
@@ -9180,4 +9211,4 @@ function Dropdown(_ref) {
|
|
|
9180
9211
|
/******/ })()
|
|
9181
9212
|
;
|
|
9182
9213
|
});
|
|
9183
|
-
//# sourceMappingURL=main.
|
|
9214
|
+
//# sourceMappingURL=main.80f90d68be593e9d6d31.js.map
|