112 lines
6.0 KiB
JavaScript
112 lines
6.0 KiB
JavaScript
|
"use strict";
|
||
|
exports.id = 9486;
|
||
|
exports.ids = [9486];
|
||
|
exports.modules = {
|
||
|
|
||
|
/***/ 9486:
|
||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
|
||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||
|
/* harmony export */ "Z": () => (/* binding */ FormCheckboxes)
|
||
|
/* harmony export */ });
|
||
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(997);
|
||
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
|
||
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6689);
|
||
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
||
|
// @ts-check
|
||
|
/**
|
||
|
* ==============================================================================
|
||
|
* Imports
|
||
|
* ==============================================================================
|
||
|
*/
|
||
|
|
||
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||
|
* ==============================================================================
|
||
|
* Main Component { Functional }
|
||
|
* ==============================================================================
|
||
|
* @param {Object} props - Server props
|
||
|
* @param {string} [props.name] - Name of checkbox group
|
||
|
* @param {{
|
||
|
* name?: string,
|
||
|
* title?: string,
|
||
|
* payload?: string,
|
||
|
* onChangeHandler?: (e:any, value:any) => void,
|
||
|
* default?: boolean,
|
||
|
* fixed?: boolean,
|
||
|
* jsx?: React.ReactNode,
|
||
|
* className?: string,
|
||
|
* }[]} props.checkBoxValues - array of objects
|
||
|
* @param {React.Dispatch<React.SetStateAction<string | null>>} [props.setAlert] - set an external alert dispatch
|
||
|
* @param {string} [props.labelColor] - Label color using tailwind syntax
|
||
|
* @param {boolean} [props.flexRow] - if the radio and label are stacked on each other or side-by-side
|
||
|
* @param {boolean} [props.baseText] - Font size regular
|
||
|
* @param {boolean} [props.smallText] - Font size smaller
|
||
|
* @param {string} [props.className] - Additional Class Names for wrapper
|
||
|
*/ function FormCheckboxes({ name , checkBoxValues , setAlert , labelColor , flexRow , baseText , smallText , className , }) {
|
||
|
/**
|
||
|
* Get Contexts
|
||
|
*
|
||
|
* @abstract { React.useContext }
|
||
|
*/ ////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/**
|
||
|
* Javascript Variables
|
||
|
*
|
||
|
* @abstract Non hook variables and functions
|
||
|
*/ ////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/**
|
||
|
* React Hooks
|
||
|
*
|
||
|
* @abstract { useState, useEffect, useRef, etc ... }
|
||
|
*/ ////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/**
|
||
|
* Function Return
|
||
|
*
|
||
|
* @abstract Main Function Return
|
||
|
*/ return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
|
||
|
className: "flex items-start gap-x-4" + (flexRow ? " flex-row flex-wrap gap-y-2 " : " flex-col gap-y-4 ") + (className ? className : ""),
|
||
|
children: checkBoxValues.map((value, index)=>{
|
||
|
const { payload , title , onChangeHandler , fixed , jsx } = value;
|
||
|
const chxName = value.name ? `${name}-${value.name}` : payload ? name + "-" + payload : name;
|
||
|
return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
|
||
|
className: "flex items-center" + (value.default && fixed ? " pointer-events-none" : "") + (smallText ? " gap-1 " : " gap-2 ") + (value?.className ? value.className : ""),
|
||
|
children: [
|
||
|
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("input", {
|
||
|
className: "m-0" + (smallText ? " w-4 h-4" : " w-5 h-5"),
|
||
|
type: "checkbox",
|
||
|
defaultChecked: value.default ? true : false,
|
||
|
name: chxName,
|
||
|
id: chxName,
|
||
|
onChange: (e)=>{
|
||
|
if (setAlert) setAlert(null);
|
||
|
if (onChangeHandler) onChangeHandler(e, value);
|
||
|
},
|
||
|
value: payload,
|
||
|
style: {
|
||
|
minWidth: "20px"
|
||
|
}
|
||
|
}),
|
||
|
jsx ? jsx : /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("label", {
|
||
|
htmlFor: chxName,
|
||
|
className: "m-0 " + (labelColor ? labelColor : "text-slate-800 dark:text-white/80") + (baseText || smallText ? " text-base" : " text-lg"),
|
||
|
children: title
|
||
|
})
|
||
|
]
|
||
|
}, index + 1);
|
||
|
})
|
||
|
});
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
|
||
|
|
||
|
|
||
|
/***/ })
|
||
|
|
||
|
};
|
||
|
;
|