opus-toolkit-components 0.3.9 → 0.4.1
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.
|
@@ -54,6 +54,28 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.dark-card{background-color:#24135f;co
|
|
|
54
54
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
|
55
55
|
|
|
56
56
|
|
|
57
|
+
/***/ }),
|
|
58
|
+
|
|
59
|
+
/***/ 705:
|
|
60
|
+
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
61
|
+
|
|
62
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
63
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
64
|
+
/* harmony export */ });
|
|
65
|
+
/* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(354);
|
|
66
|
+
/* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
67
|
+
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(314);
|
|
68
|
+
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
69
|
+
// Imports
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
|
|
73
|
+
// Module
|
|
74
|
+
___CSS_LOADER_EXPORT___.push([module.id, `table thead th:first-of-type{border-top-left-radius:8px}table thead th:last-of-type{border-top-right-radius:8px}table tr:last-of-type td:first-of-type{border-bottom-left-radius:8px}table tr:last-of-type td:last-of-type{border-bottom-right-radius:8px}`, "",{"version":3,"sources":["webpack://./src/components/Tables/table.scss"],"names":[],"mappings":"AAGY,6BACI,0BAAA,CAEJ,4BACI,2BAAA,CAOA,uCACI,6BAAA,CAEJ,sCACI,8BAAA","sourcesContent":["table {\r\n thead {\r\n th {\r\n &:first-of-type {\r\n border-top-left-radius: 8px;\r\n }\r\n &:last-of-type {\r\n border-top-right-radius: 8px;\r\n }\r\n }\r\n }\r\n tr {\r\n &:last-of-type {\r\n td {\r\n &:first-of-type {\r\n border-bottom-left-radius: 8px;\r\n }\r\n &:last-of-type {\r\n border-bottom-right-radius: 8px;\r\n }\r\n }\r\n } \r\n } \r\n}"],"sourceRoot":""}]);
|
|
75
|
+
// Exports
|
|
76
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
|
77
|
+
|
|
78
|
+
|
|
57
79
|
/***/ }),
|
|
58
80
|
|
|
59
81
|
/***/ 314:
|
|
@@ -548,7 +570,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
548
570
|
Dropdown: () => (/* reexport */ Dropdown),
|
|
549
571
|
Input: () => (/* reexport */ Inputs_Input),
|
|
550
572
|
RadioButton: () => (/* reexport */ RadioButton),
|
|
551
|
-
Table: () => (/* reexport */
|
|
573
|
+
Table: () => (/* reexport */ DynamicTable)
|
|
552
574
|
});
|
|
553
575
|
|
|
554
576
|
// EXTERNAL MODULE: external "react"
|
|
@@ -872,41 +894,121 @@ function DatePicker(_ref) {
|
|
|
872
894
|
}
|
|
873
895
|
;// ./src/components/Forms/Radios/RadioButton.js
|
|
874
896
|
|
|
875
|
-
|
|
897
|
+
const RadioButtonGroup = _ref => {
|
|
876
898
|
let {
|
|
899
|
+
label,
|
|
900
|
+
options = [{
|
|
901
|
+
value: 'single',
|
|
902
|
+
label: 'Single'
|
|
903
|
+
}, {
|
|
904
|
+
value: 'married',
|
|
905
|
+
label: 'Married'
|
|
906
|
+
}, {
|
|
907
|
+
value: 'divorced',
|
|
908
|
+
label: 'Divorced'
|
|
909
|
+
}, {
|
|
910
|
+
value: 'other',
|
|
911
|
+
label: 'Other'
|
|
912
|
+
}],
|
|
877
913
|
name,
|
|
878
|
-
value,
|
|
879
|
-
checked,
|
|
880
914
|
onChange,
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
915
|
+
className = '',
|
|
916
|
+
isValid = true,
|
|
917
|
+
errorMessage = `${label} is required`,
|
|
918
|
+
required = false
|
|
885
919
|
} = _ref;
|
|
886
|
-
|
|
887
|
-
const
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
920
|
+
const [selectedValue, setSelectedValue] = (0,external_react_.useState)('');
|
|
921
|
+
const handleChange = item => {
|
|
922
|
+
setSelectedValue(item.value);
|
|
923
|
+
const event = {
|
|
924
|
+
target: {
|
|
925
|
+
name: name,
|
|
926
|
+
value: item.value
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
if (onChange) {
|
|
930
|
+
onChange(event);
|
|
931
|
+
}
|
|
932
|
+
};
|
|
933
|
+
return /*#__PURE__*/external_react_default().createElement("div", {
|
|
934
|
+
className: "flex flex-col mb-4"
|
|
935
|
+
}, /*#__PURE__*/external_react_default().createElement("label", {
|
|
936
|
+
className: "text-greyLight700 mb-2 flex items-center"
|
|
937
|
+
}, label, required && /*#__PURE__*/external_react_default().createElement("span", {
|
|
938
|
+
className: "text-utilRed1000 ml-1"
|
|
939
|
+
}, "*")), /*#__PURE__*/external_react_default().createElement("div", {
|
|
940
|
+
className: "flex space-x-4"
|
|
941
|
+
}, options.map(option => /*#__PURE__*/external_react_default().createElement("label", {
|
|
942
|
+
key: option.value,
|
|
943
|
+
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
944
|
}, /*#__PURE__*/external_react_default().createElement("input", {
|
|
896
945
|
type: "radio",
|
|
897
946
|
name: name,
|
|
898
|
-
value: value,
|
|
899
|
-
checked:
|
|
900
|
-
onChange:
|
|
901
|
-
className:
|
|
902
|
-
}),
|
|
903
|
-
|
|
947
|
+
value: option.value,
|
|
948
|
+
checked: selectedValue === option.value,
|
|
949
|
+
onChange: () => handleChange(option),
|
|
950
|
+
className: "hidden"
|
|
951
|
+
}), option.label))), !isValid && /*#__PURE__*/external_react_default().createElement("span", {
|
|
952
|
+
className: "text-utilRed1000 text-sm mt-1"
|
|
953
|
+
}, errorMessage));
|
|
954
|
+
};
|
|
955
|
+
RadioButtonGroup.displayName = 'RadioButtonGroup';
|
|
956
|
+
/* harmony default export */ const RadioButton = (RadioButtonGroup);
|
|
957
|
+
// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/components/Tables/table.scss
|
|
958
|
+
var table = __webpack_require__(705);
|
|
959
|
+
;// ./src/components/Tables/table.scss
|
|
960
|
+
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
var table_options = {};
|
|
972
|
+
|
|
973
|
+
table_options.styleTagTransform = (styleTagTransform_default());
|
|
974
|
+
table_options.setAttributes = (setAttributesWithoutAttributes_default());
|
|
975
|
+
table_options.insert = insertBySelector_default().bind(null, "head");
|
|
976
|
+
table_options.domAPI = (styleDomAPI_default());
|
|
977
|
+
table_options.insertStyleElement = (insertStyleElement_default());
|
|
978
|
+
|
|
979
|
+
var table_update = injectStylesIntoStyleTag_default()(table/* default */.A, table_options);
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
/* harmony default export */ const Tables_table = (table/* default */.A && table/* default */.A.locals ? table/* default */.A.locals : undefined);
|
|
985
|
+
|
|
904
986
|
;// ./src/components/Tables/Table.js
|
|
905
987
|
|
|
906
|
-
|
|
988
|
+
|
|
989
|
+
function DynamicTable(_ref) {
|
|
990
|
+
let {
|
|
991
|
+
data = [],
|
|
992
|
+
// Array defining columns and rendering logic
|
|
993
|
+
rows = [],
|
|
994
|
+
// Array defining rows
|
|
995
|
+
className = "",
|
|
996
|
+
rowKeyExtractor = (row, index) => index // Function to extract unique keys for rows
|
|
997
|
+
} = _ref;
|
|
907
998
|
return /*#__PURE__*/external_react_default().createElement("table", {
|
|
908
|
-
|
|
909
|
-
}, /*#__PURE__*/external_react_default().createElement("thead", null, /*#__PURE__*/external_react_default().createElement("tr",
|
|
999
|
+
className: `w-full table-auto text-left border-collapse ${className}`
|
|
1000
|
+
}, /*#__PURE__*/external_react_default().createElement("thead", null, /*#__PURE__*/external_react_default().createElement("tr", {
|
|
1001
|
+
className: "bg-greyBaseDark900"
|
|
1002
|
+
}, data.map(column => /*#__PURE__*/external_react_default().createElement("th", {
|
|
1003
|
+
key: column.key,
|
|
1004
|
+
className: "border-b border-gray-300 py-2 px-4 text-sm font-normal text-greyDark1000"
|
|
1005
|
+
}, column.header)))), /*#__PURE__*/external_react_default().createElement("tbody", null, rows.map((row, index) => /*#__PURE__*/external_react_default().createElement("tr", {
|
|
1006
|
+
key: rowKeyExtractor(row, index),
|
|
1007
|
+
className: `${index % 2 === 0 ? "bg-greyLight100" : "bg-greyLight50"} hover:bg-greyLight500`
|
|
1008
|
+
}, data.map(column => /*#__PURE__*/external_react_default().createElement("td", {
|
|
1009
|
+
key: column.key,
|
|
1010
|
+
className: "p-4 text-sm text-greyLight700"
|
|
1011
|
+
}, column.render ? column.render(row) : row[column.key]))))));
|
|
910
1012
|
}
|
|
911
1013
|
;// ./node_modules/@react-aria/utils/dist/platform.mjs
|
|
912
1014
|
/*
|
|
@@ -9117,7 +9219,7 @@ function Dropdown(_ref) {
|
|
|
9117
9219
|
const newSelectedItem = items.find(item => item.value === value) || null;
|
|
9118
9220
|
setSelectedItem(newSelectedItem);
|
|
9119
9221
|
}, [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-
|
|
9222
|
+
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
9223
|
const handleSelect = item => {
|
|
9122
9224
|
setSelectedItem(item);
|
|
9123
9225
|
const event = {
|
|
@@ -9135,7 +9237,7 @@ function Dropdown(_ref) {
|
|
|
9135
9237
|
}, /*#__PURE__*/external_react_default().createElement("label", {
|
|
9136
9238
|
className: "flex items-center"
|
|
9137
9239
|
}, label, required && /*#__PURE__*/external_react_default().createElement("span", {
|
|
9138
|
-
className: "ml-1 text-
|
|
9240
|
+
className: "ml-1 text-utilRed1000"
|
|
9139
9241
|
}, "*"), " "), /*#__PURE__*/external_react_default().createElement("div", null, /*#__PURE__*/external_react_default().createElement(It, {
|
|
9140
9242
|
className: inputClasses,
|
|
9141
9243
|
onClick: () => setIsOpen(prev => !prev)
|
|
@@ -9164,7 +9266,7 @@ function Dropdown(_ref) {
|
|
|
9164
9266
|
className: `block w-full px-4 py-2 text-left text-sm text-greyLight700 ${active ? 'bg-greyLight100 text-greyLight700' : ''} hover:bg-greyLight100`
|
|
9165
9267
|
}, item.label);
|
|
9166
9268
|
})))), !isValid && /*#__PURE__*/external_react_default().createElement("span", {
|
|
9167
|
-
className: "text-
|
|
9269
|
+
className: "text-utilRed1000 text-sm"
|
|
9168
9270
|
}, errorMessage));
|
|
9169
9271
|
}
|
|
9170
9272
|
;// ./src/index.js
|
|
@@ -9180,4 +9282,4 @@ function Dropdown(_ref) {
|
|
|
9180
9282
|
/******/ })()
|
|
9181
9283
|
;
|
|
9182
9284
|
});
|
|
9183
|
-
//# sourceMappingURL=main.
|
|
9285
|
+
//# sourceMappingURL=main.1caabab9a1a894e98031.js.map
|