UNPKG

coducer

Version:

This will help you in Accordion, BreadCrumb, Button, Creatable Select, Select, Formik Date Field, Formik Field, Formik PhoneNumber, Formik Time Field, Input Field, Loader, Modal, NavBarMenu, Notify, Pill, Toggle Switch

994 lines (969 loc) 28.5 kB
// src/index.ts import "bootstrap/dist/css/bootstrap.min.css"; // src/Accordion/Accordion.tsx import { Accordion as BootStrapAccordion } from "react-bootstrap"; import { jsx, jsxs } from "react/jsx-runtime"; var Accordion = ({ accordionText, children, className = "", icon, rightHeader }) => { return /* @__PURE__ */ jsx("div", { className: `${className}`, children: /* @__PURE__ */ jsx(BootStrapAccordion, { children: /* @__PURE__ */ jsx( BootStrapAccordion.Item, { eventKey: "", className: "", id: accordionText, children: /* @__PURE__ */ jsxs("div", { className: " ", children: [ /* @__PURE__ */ jsx(BootStrapAccordion.Header, { id: accordionText, children: /* @__PURE__ */ jsxs("div", { className: " d-flex align-items-center", id: accordionText, children: [ icon && /* @__PURE__ */ jsx("div", { className: "accodion_icon d-flex align-items-center justify-content-center", children: icon || "" }), /* @__PURE__ */ jsxs("div", { className: "accodion_text ", children: [ accordionText, " " ] }), rightHeader && /* @__PURE__ */ jsx("div", { children: rightHeader }) ] }) }), /* @__PURE__ */ jsx(BootStrapAccordion.Body, { "data-testid": "Test Content", children: /* @__PURE__ */ jsx("div", { children }) }) ] }) }, "" ) }) }); }; // src/BreadCrumb/BreadCrumb.tsx import { Link } from "react-router-dom"; import React from "react"; import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime"; var BreadCrumb = ({ breadCrumb }) => { return /* @__PURE__ */ jsx2("div", { children: breadCrumb?.map((item, index) => /* @__PURE__ */ jsxs2(React.Fragment, { children: [ item?.isTitle && /* @__PURE__ */ jsx2("h4", { className: "fw-semibold Bread_crumb_title cursor-pointer mb-1", children: item.title }), item?.isSubTitle && /* @__PURE__ */ jsx2("h6", { className: "fw-semibold Bread_crumb_title mb-0 cursor-pointer", children: item.title }), item?.breadCrumb?.length && item?.breadCrumb?.map( (data, index2) => data.url ? /* @__PURE__ */ jsxs2( Link, { to: data.url, className: "text-decoration-none link_title", children: [ data.title, /* @__PURE__ */ jsx2("span", { className: "ps-1 pe-1", children: "/" }) ] }, index2 ) : /* @__PURE__ */ jsxs2("div", { className: "link_title", children: [ data.title, /* @__PURE__ */ jsx2("span", { className: "ps-1 pe-1", children: "/" }) ] }) ) ] }, index)) }); }; // src/Button/Button.tsx import { Button as BootStrapButton } from "react-bootstrap"; import { Spinner } from "react-bootstrap"; import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime"; var Button = ({ text, variant, type, onClick, onDoubleClick, className = "", isDisabled, isLoading, prefixIconChildren, sufixIconChildren }) => { return /* @__PURE__ */ jsx3("div", { "data-testid": text, children: /* @__PURE__ */ jsx3( BootStrapButton, { type, className, onDoubleClick: onDoubleClick && onDoubleClick, onClick: onClick && onClick, disabled: isDisabled || isLoading, id: text, variant, "data-testid": `button-${text}`, children: /* @__PURE__ */ jsxs3("h6", { className: `m-0 fw-normal`, children: [ prefixIconChildren, isLoading ? /* @__PURE__ */ jsxs3("span", { children: [ /* @__PURE__ */ jsx3(Spinner, { size: "sm" }), " ", /* @__PURE__ */ jsx3("span", { className: "ms-2", children: text }) ] }) : text, sufixIconChildren ] }) } ) }); }; // src/CustomCreatableSelect/CustomCreatableSelect.tsx import { useState } from "react"; import CreatableSelect from "react-select/creatable"; // src/CustomStyles/CustomStyles.tsx var CustomStyles = { option: (styles, { isFocused, isSelected }) => { return { ...styles, backgroundColor: isSelected ? "var(--textprimary)" : isFocused ? "var(--hoverColor)" : void 0, color: isSelected ? "var(--bgColor)" : isFocused ? "var(--textprimary)" : void 0 }; }, control: (provided) => ({ ...provided, backgroundColor: "var(--bgColor)", minHeight: "48px", height: "54px" }), menuList: (styles) => ({ ...styles, backgroundColor: "var(--bgColor)" }) }; // src/CustomCreatableSelect/CustomCreatableSelect.tsx import { jsx as jsx4 } from "react/jsx-runtime"; var CustomCreatableSelect = ({ className, placeholder, field, form, options, isDisabled, isMulti = false, isClearable = true, callback, displayName = "Create", maxLength = 25 }) => { const [inputValue, setInputValue] = useState(""); const onChange = (option) => { form?.setFieldValue( field?.name ?? "", isMulti ? option?.map((item) => item?.value) : option?.value ); if (callback) { callback(isMulti ? option : [option]); } }; const getValue = () => { if (options?.length) { if (field?.value?.length) { const isMultiOption = options?.filter( (option) => field?.value?.indexOf(option?.value) >= 0 || field?.value?.indexOf(option?.label) >= 0 ); const isNotMultiOption = options?.find( (option) => option?.value === field?.value || option?.label === field?.value ); return isMulti ? isMultiOption?.length > 0 ? [ ...new Set( isMultiOption?.map((item) => item?.label).concat(field?.value) ) ]?.map((item) => ({ label: item, value: item })) : field?.value?.map((item) => ({ label: item, value: item })) : isNotMultiOption?.value ? isNotMultiOption : { label: field?.value, value: field?.value }; } } else { if (field?.value?.length) { return isMulti ? field?.value?.map((item) => ({ label: item, value: item })) : { label: field?.value, value: field?.value }; } else { return isMulti ? [] : null; } } }; const onInputChange = (input) => { if (input.length > maxLength) { setInputValue(input.substr(0, maxLength)); } else { setInputValue(input); } }; const inputId = `customCreatableSelect_${field?.name}`; return /* @__PURE__ */ jsx4( CreatableSelect, { className, name: field?.name, defaultValue: getValue() || "", onChange, placeholder, options, isMulti, isDisabled, isClearable, value: getValue(), styles: CustomStyles, classNamePrefix: "select-wrapper", id: inputId, "data-testid": inputId, inputId: field?.name, formatCreateLabel: (inputText) => `${displayName} "${inputText}"`, onInputChange, inputValue } ); }; // src/CustomSelect/CustomSelect.tsx import Select from "react-select"; import { jsx as jsx5 } from "react/jsx-runtime"; var CustomSelect = ({ className = "", placeholder = "Select...", field, form, id, isDisabled, options, isMulti = false, value, isClearable = true, onFieldUpdate }) => { const onChange = (option) => { if (onFieldUpdate) { onFieldUpdate(option); } form?.setFieldValue( field?.name ?? "", isMulti ? option?.map((item) => item?.value) : option?.value ); }; const getValue = (options2, isMulti2, field2, value2) => { if (!options2) { return isMulti2 ? [] : ""; } if (!field2?.value) { if (isMulti2) { return options2.filter( (option) => Array.isArray(value2) ? value2.some( (val) => val.value === option.value || val.label === option.label ) : false ) || ""; } else { return options2.find( (option) => typeof value2 === "object" ? option?.value === value2?.value || option?.label === value2?.label : option?.value === value2 || option?.label === value2 ) || ""; } } if (isMulti2) { return options2.filter( (option) => field2.value?.some( (val) => val === option.value || val === option.label ) ) || ""; } else { return options2.find( (option) => option?.value === field2.value || typeof value2 === "object" && option?.label === value2?.label || typeof value2 === "string" && option?.label === value2 ) || ""; } }; return /* @__PURE__ */ jsx5( Select, { className, name: field?.name, id, value: getValue(options, isMulti, field, value), onChange, placeholder, options, isMulti, isDisabled, isClearable, styles: CustomStyles, classNamePrefix: "custom_select_input", "data-testid": "customSelect", inputId: field?.name } ); }; // src/FormikField/FormikField.tsx import { Field } from "formik"; // src/InputField/CustomInputField.tsx import { getIn } from "formik"; import { FormGroup, FormLabel } from "react-bootstrap"; import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime"; var isRequiredField = (validationSchema, name) => { return !!getIn(validationSchema?.describe().fields, name)?.tests?.find( (obj) => obj.name === "required" || obj.name === "min" || obj.name === "max" ); }; var CustomInputField = ({ validationSchema, label, field, error, children, inputId }) => { return /* @__PURE__ */ jsxs4(FormGroup, { controlId: inputId, className: "", children: [ /* @__PURE__ */ jsxs4(FormLabel, { className: "form_label", children: [ label || "", " ", isRequiredField(validationSchema, field.name) && "*" ] }), /* @__PURE__ */ jsx6("div", { children }), error && /* @__PURE__ */ jsx6("small", { className: `form-text text-danger form_error`, children: error }) ] }); }; // src/InputField/InputField.tsx import { getIn as getIn2 } from "formik"; import { FormControl, FormGroup as FormGroup2, FormLabel as FormLabel2, InputGroup } from "react-bootstrap"; import { AiFillEye, AiFillEyeInvisible } from "react-icons/ai"; import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime"; var isRequiredField2 = (validationSchema, name) => { return !!getIn2(validationSchema.describe().fields, name)?.tests?.find( (obj) => obj.name === "required" || obj.name === "min" || obj.name === "max" ); }; var InputField = ({ validationSchema, label, type = "text", field, isValid, autoFocus, error, placeholder, disabled = false, isPassword, setPasswordIcon, passwordIcon, maxLength, rightIcon, icon, onBlur, as = "input", isAuth = false, onChange, unit, value }) => { return /* @__PURE__ */ jsxs5(FormGroup2, { controlId: field.name, className: " position-relative", children: [ /* @__PURE__ */ jsxs5(FormLabel2, { className: "form_label", children: [ label, " ", isRequiredField2(validationSchema, field.name) && "*" ] }), /* @__PURE__ */ jsx7( FormControl, { type, as, autoFocus: !!autoFocus, value: value ? value : field.value, onChange: onChange ? onChange : field.onChange, isInvalid: !isValid, placeholder, disabled, maxLength, autoComplete: "none", onBlur, onFocus: onBlur } ), isPassword && /* @__PURE__ */ jsx7(Fragment, { children: passwordIcon ? /* @__PURE__ */ jsx7( "span", { className: isAuth ? "auth-eye-icon-css" : "eye-icon-css", "data-testid": "password-eye-icon", onClick: () => setPasswordIcon && setPasswordIcon(!passwordIcon), children: /* @__PURE__ */ jsx7(AiFillEye, { color: "var(--textLight)" }) } ) : /* @__PURE__ */ jsx7( "span", { className: isAuth ? "auth-eye-icon-css" : "eye-icon-css", "data-testid": "password-eye-invisible-icon", onClick: () => setPasswordIcon && setPasswordIcon(!passwordIcon), children: /* @__PURE__ */ jsx7(AiFillEyeInvisible, { color: "var(--textLight)" }) } ) }), unit && /* @__PURE__ */ jsx7(InputGroup.Text, { className: "unit-css", children: unit }), rightIcon && /* @__PURE__ */ jsx7("span", { style: { position: "absolute", right: 25, top: 100 }, children: icon }), error && /* @__PURE__ */ jsx7("small", { className: `form-text text-danger form_error`, children: error }) ] }); }; // src/FormikField/FormikField.tsx import { jsx as jsx8 } from "react/jsx-runtime"; var FormikField = ({ validationSchema, errors, label, type, name, autoFocus, placeholder, disabled, as, isPassword, setPasswordIcon, passwordIcon, maxLength, rightIcon, icon, onBlur, isAuth = false, onChange, unit, value }) => { return /* @__PURE__ */ jsx8(Field, { name, autoComplete: "none", children: ({ field }) => /* @__PURE__ */ jsx8( InputField, { validationSchema, label, error: errors[name], type, autoFocus, field, isValid: !errors[name], placeholder, disabled, as, isPassword, setPasswordIcon, passwordIcon, maxLength: maxLength || 250, isAuth, rightIcon, icon, onBlur, onChange, unit, value } ) }); }; // src/FormikPhoneNumber/FormikPhoneNumber.tsx import { Field as Field2 } from "formik"; import PhoneInput, { isValidPhoneNumber } from "react-phone-number-input"; import "react-phone-number-input/style.css"; import { jsx as jsx9 } from "react/jsx-runtime"; var FormikPhoneNumber = ({ name, label, errors, validationSchema, isDisabled, onChange, isInternational = true, value }) => { return /* @__PURE__ */ jsx9(Field2, { name, children: ({ field, form }) => /* @__PURE__ */ jsx9( CustomInputField, { validationSchema, label, error: errors, field, inputId: "label", children: /* @__PURE__ */ jsx9( PhoneInput, { disabled: isDisabled, defaultCountry: "IN", placeholder: "Enter phone number", name: field.name, international: isInternational, className: "form-control autocomplete", countryCallingCodeEditable: false, value: value ? `${value}` : `${field?.value}`, onChange: (value2) => { if (value2?.length) { if (!isValidPhoneNumber(value2)) { form.setFieldError(name, "Invalid Phone Number"); } else { form.setFieldError(name, ""); if (onChange) { return onChange(value2); } form.setFieldValue(name, value2); } } else { form.setFieldError(name, "Invalid Phone Number"); } } } ) } ) }); }; // src/FormikTimeField/FormikTimeField.tsx import { Field as Field3 } from "formik"; import moment from "moment"; import TimePicker from "rc-time-picker"; import "rc-time-picker/assets/index.css"; import { jsx as jsx10 } from "react/jsx-runtime"; var FormikTimeField = ({ name, label, errors, validationSchema, isDisabled, value, use12Hours, onChange }) => { const inputId = `formikDateField_${name}`; return /* @__PURE__ */ jsx10(Field3, { name, children: ({ field, form }) => { const defaultValue = moment( value || form.values[name] || "00:00", use12Hours ? "h:mm a" : "HH:mm" ); return /* @__PURE__ */ jsx10( CustomInputField, { validationSchema, label, error: errors || "", field, inputId, children: /* @__PURE__ */ jsx10( TimePicker, { id: inputId, showSecond: false, defaultValue, className: "form-control xxx", onChange: (newValue) => onChange ? onChange(newValue.format(use12Hours ? "h:mm a" : "HH:mm")) : form.setFieldValue( name, newValue.format(use12Hours ? "h:mm a" : "HH:mm") ), disabled: isDisabled, format: use12Hours ? "h:mm a" : "HH:mm", use12Hours, "data-testid": "Time" } ) } ); } }); }; // src/Modal/Context.tsx import { createContext, useState as useState3, useContext } from "react"; // src/Modal/Modal.tsx import { useEffect, useState as useState2 } from "react"; import { Modal as BootstrapModal } from "react-bootstrap"; import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime"; var Modal = ({ show = false, onHide, title, children, className = "", size = "sm", fullscreen, onClose }) => { const [modalShow, setModalShow] = useState2(false); useEffect(() => { setModalShow(show); }, [show]); return /* @__PURE__ */ jsxs6( BootstrapModal, { show: modalShow, onHide: () => { setModalShow(false); onHide && onHide(); onClose && onClose(); }, centered: true, className, fullscreen, size, keyboard: false, backdrop: "static", "data-testid": "close-button", children: [ (title || (onClose ? true : false)) && /* @__PURE__ */ jsx11( BootstrapModal.Header, { "data-testid": "close-button", closeButton: onClose ? true : false, children: title && /* @__PURE__ */ jsx11(BootstrapModal.Title, { "data-testid": "Test Title", children: title }) } ), /* @__PURE__ */ jsx11(BootstrapModal.Body, { "data-testid": "Test Content", children }) ] } ); }; // src/Modal/Context.tsx import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime"; var ModalContext = createContext(void 0); var ModalProvider = ({ children }) => { const hideModal = () => { setModalContent(null); setModalProps(initialModalProps); }; const initialModalProps = { show: false, onHide: hideModal, children: /* @__PURE__ */ jsx12(Fragment2, {}), size: "sm" }; const [modalContent, setModalContent] = useState3(null); const [modalProps, setModalProps] = useState3(initialModalProps); const showModal = (content, ModalProps = {}) => { const mergedModalProps = { ...modalProps, show: true, ...ModalProps }; setModalContent(content); setModalProps(mergedModalProps); }; return /* @__PURE__ */ jsxs7(ModalContext.Provider, { value: { showModal, hideModal }, children: [ children, modalContent && /* @__PURE__ */ jsx12("div", { className: "modal-wrapper", onClick: hideModal, children: /* @__PURE__ */ jsx12("div", { className: "modal-content", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx12(Modal, { ...modalProps, children: modalContent }) }) }) ] }); }; var useModal = ({ style, content }) => { const context = useContext(ModalContext); if (!context) { throw new Error("useModal must be used within a ModalProvider"); } const triggerModal = () => { if (content) { context.showModal(content, style); } else { context.hideModal(); } }; return triggerModal; }; // src/Loader/Loader.tsx import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime"; var Loader = () => { return /* @__PURE__ */ jsx13(Modal, { show: true, size: "sm", children: /* @__PURE__ */ jsx13("div", { className: " d-flex justify-content-center align-items-center", children: /* @__PURE__ */ jsxs8( "section", { className: " position-relative", style: { width: "150px", height: "150px" }, children: [ /* @__PURE__ */ jsx13("div", { className: "loader", "data-testid": "loader" }), /* @__PURE__ */ jsxs8("div", { className: "loading loading06", children: [ /* @__PURE__ */ jsx13("span", { "data-text": "L", children: "L" }), /* @__PURE__ */ jsx13("span", { "data-text": "O", children: "O" }), /* @__PURE__ */ jsx13("span", { "data-text": "A", children: "A" }), /* @__PURE__ */ jsx13("span", { "data-text": "D", children: "D" }), /* @__PURE__ */ jsx13("span", { "data-text": "I", children: "I" }), /* @__PURE__ */ jsx13("span", { "data-text": "N", children: "N" }), /* @__PURE__ */ jsx13("span", { "data-text": "G", children: "G" }), /* @__PURE__ */ jsx13("span", { "data-text": ".", children: "." }), /* @__PURE__ */ jsx13("span", { "data-text": ".", children: "." }), /* @__PURE__ */ jsx13("span", { "data-text": ".", children: "." }) ] }) ] } ) }) }); }; // src/NavBarMenu/NavBarMenuItems.tsx import { Nav } from "react-bootstrap"; import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime"; var NavBarMenuItems = ({ url, text, subMenu, isRadius, menu, icon }) => { return /* @__PURE__ */ jsxs9( Nav.Link, { href: url, className: isRadius ? `is_radius ${menu === text ? "active" : ""}` : `header-css ${subMenu === text ? "active" : ""}`, id: text, children: [ icon && /* @__PURE__ */ jsx14("span", { className: "nav-icon", children: icon }), "\xA0", text ] } ); }; // src/Notify/Notify.tsx import { toast } from "react-toastify"; var Notify = ({ message, type, position = "top-right", autoClose = 3e3 }) => { const getIconAndBgColor = () => { let bgColor; let color; switch (type) { case "SUCCESS": bgColor = `var(--success)`; return { bgColor }; case "ERROR": bgColor = "var(--danger)"; return { bgColor }; case "LOADING": bgColor = "white"; color = "black"; return { bgColor, color }; } }; toast(message, { position, style: { background: getIconAndBgColor()?.bgColor, borderRadius: "50px", color: getIconAndBgColor()?.color ?? "#fff", width: "fit-content", textWrap: "wrap" }, autoClose, closeButton: false, hideProgressBar: true, containerId: message }); }; // src/Notify/ToastProvider.tsx import { ToastContainer } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; import { jsx as jsx15 } from "react/jsx-runtime"; var ToastProvider = () => { return /* @__PURE__ */ jsx15(ToastContainer, {}); }; // src/Util/index.ts import fileDownload from "js-file-download"; var BuildQueryParams = (params) => { if (params) { const queryParams = []; Object.keys(params).forEach((key) => { const value = params[key]; if (value !== null && value !== void 0) { if (Array.isArray(value)) { value.forEach((item) => { if (item !== null && item !== void 0 && item.toString().length) { queryParams.push( `${encodeURIComponent(key)}=${encodeURIComponent(item)}` ); } }); } else { if (value !== null && value !== void 0 && value.toString().length) { queryParams.push( `${encodeURIComponent(key)}=${encodeURIComponent(value)}` ); } } } }); return queryParams.join("&"); } return ""; }; var ToPascalCase = (data) => { return data.toLowerCase().split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" "); }; var ToHexColor = (str) => { let hash = 0; for (let i = 0; i < str.length; i++) { hash = str.charCodeAt(i) + ((hash << 5) - hash); } const color = (hash & 16777215).toString(16).toUpperCase(); return "#" + "00000".substring(0, 6 - color.length) + color; }; var RemoveNullValues = (obj) => { let isEmpty = true; for (const key in obj) { if (obj[key] === null) { delete obj[key]; } else if (typeof obj[key] === "object") { RemoveNullValues(obj[key]); if (Object.keys(obj[key]).length === 0) { delete obj[key]; } else { isEmpty = false; } } else { if (obj[key] === "true") { obj[key] = true; } else if (obj[key] === "false") { obj[key] = false; } isEmpty = false; } } if (isEmpty) { return {}; } else { return obj; } }; var IsNullOrUndefinedOrEmpty = async (value) => { return new Promise((resolve) => { resolve(value === void 0 || value === null || value.trim() === ""); }); }; var ToBase64 = (file) => new Promise((resolve, reject) => { const reader = new FileReader(); reader.readAsDataURL(file); reader.onload = () => resolve(reader.result); reader.onerror = reject; }); var DownloadFile = (data, fileName, fileExtension) => { const mimeTypes = { xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", pdf: "application/pdf", html: "text/html", zip: "application/zip", jpeg: "image/jpeg", txt: "text/plain", fvu: "text/plain", csv: "text/csv" }; const fileType = mimeTypes[fileExtension.toLowerCase()]; fileDownload(data, fileName, fileType); }; // src/Pill/Pill.tsx import { jsx as jsx16 } from "react/jsx-runtime"; var Pill = ({ pillText, pillColorClassName }) => { return /* @__PURE__ */ jsx16( "span", { className: `fw-semibold rounded-3 pill_view ${pillColorClassName} `, id: pillText, children: ToPascalCase(pillText.replaceAll("_", " ").replaceAll("-", " ")) } ); }; // src/Table/Context.tsx import { createContext as createContext2, useContext as useContext2, useEffect as useEffect2, useState as useState4 } from "react"; import { jsx as jsx17 } from "react/jsx-runtime"; var TableContext = createContext2( void 0 ); var TableProvider = ({ getData, children }) => { const [data, setData] = useState4([]); const [meta, setMeta] = useState4(null); useEffect2(() => { const fetchData = async () => { try { const { data: data2, meta: meta2 } = await getData(); setData(data2); setMeta(meta2); } catch (error) { console.error("Error fetching data:", error); } }; fetchData(); }, [getData]); return /* @__PURE__ */ jsx17(TableContext.Provider, { value: { data, meta }, children: children({ data, meta }) }); }; var useTableContext = () => { const context = useContext2(TableContext); if (!context) { throw new Error("useTableContext must be used within a TableProvider"); } return context; }; // src/ToggleSwitch/ToggleSwitch.tsx import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime"; var ToggleSwitch = ({ textOff, textOn, isSwitchDefault = false, onChange, className, isDisabled, checked }) => { const getSwitchClasses = (isSwitchDefault2) => { if (isSwitchDefault2) { return "toggle_switch switch_default"; } else { return "toggle_switch switch_custom"; } }; const getOnClasses = (isSwitchDefault2) => { if (isSwitchDefault2) { return "on_default"; } else { return "on"; } }; const getOffClasses = (isSwitchDefault2) => { if (isSwitchDefault2) { return "off_default"; } else { return "off"; } }; return /* @__PURE__ */ jsx18("div", { className: ` ${className}`, children: /* @__PURE__ */ jsxs10("label", { className: "common_toggle_switch", children: [ /* @__PURE__ */ jsx18( "input", { type: "checkbox", id: "togBtn", disabled: isDisabled, checked, onChange, "data-testid": "toggle_switch_input" } ), /* @__PURE__ */ jsxs10("div", { className: getSwitchClasses(isSwitchDefault), children: [ /* @__PURE__ */ jsx18("div", { className: `pe-4 fw-semibold ${getOnClasses(isSwitchDefault)}`, children: textOn }), /* @__PURE__ */ jsx18( "div", { className: `ps-4 pe-1 fw-semibold ${getOffClasses( isSwitchDefault )}`, children: textOff } ) ] }) ] }) }); }; export { Accordion, BreadCrumb, BuildQueryParams, Button, CustomCreatableSelect, CustomInputField, CustomSelect, CustomStyles, DownloadFile, FormikField, FormikPhoneNumber, FormikTimeField, InputField, IsNullOrUndefinedOrEmpty, Loader, Modal, ModalProvider, NavBarMenuItems, Notify, Pill, RemoveNullValues, TableProvider, ToBase64, ToHexColor, ToPascalCase, ToastProvider, ToggleSwitch, useModal, useTableContext };