@nlabs/gothamjs
Version:
Platform
1 lines • 16.2 kB
JavaScript
"use strict";(self.webpackChunk_nlabs_gothamjs=self.webpackChunk_nlabs_gothamjs||[]).push([[927],{"./src/components/ErrorMessage/ErrorMessage.stories.tsx":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Primary:function(){return Primary},__namedExportsOrder:function(){return __namedExportsOrder}});const meta={component:__webpack_require__("./src/components/ErrorMessage/ErrorMessage.tsx").K};__webpack_exports__.default=meta;const Primary={args:{message:"This is an error message"}},__namedExportsOrder=["Primary"];Primary.parameters={...Primary.parameters,docs:{...Primary.parameters?.docs,source:{originalSource:"{\n args: {\n message: 'This is an error message'\n }\n}",...Primary.parameters?.docs?.source}}}},"./src/components/ErrorMessage/ErrorMessage.tsx":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{K:function(){return ErrorMessage}});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../lex/node_modules/react/index.js"),_utils_colorUtils__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/utils/colorUtils.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("../lex/node_modules/react/jsx-runtime.js");const ErrorMessage=({color:color,message:message})=>{if(!message)return null;const errorClasses=(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(()=>(0,_utils_colorUtils__WEBPACK_IMPORTED_MODULE_1__.jr)(color),[color]);return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("p",{className:`absolute -bottom-5 left-5 text-xs ${errorClasses}`,children:message})};ErrorMessage.__docgenInfo={description:"",methods:[],displayName:"ErrorMessage",props:{color:{required:!1,tsType:{name:"union",raw:"'primary' | 'secondary' | 'tertiary' | 'link' | 'neutral' | 'white' | 'black' | 'error' | 'warning' | 'success' | 'info' | 'transparent'",elements:[{name:"literal",value:"'primary'"},{name:"literal",value:"'secondary'"},{name:"literal",value:"'tertiary'"},{name:"literal",value:"'link'"},{name:"literal",value:"'neutral'"},{name:"literal",value:"'white'"},{name:"literal",value:"'black'"},{name:"literal",value:"'error'"},{name:"literal",value:"'warning'"},{name:"literal",value:"'success'"},{name:"literal",value:"'info'"},{name:"literal",value:"'transparent'"}]},description:""},message:{required:!1,tsType:{name:"string"},description:""}}}},"./src/utils/colorUtils.ts":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{IR:function(){return getTextClasses},TL:function(){return getOutlineClasses},jr:function(){return getErrorClasses},kX:function(){return getPlaceholderClasses},nw:function(){return getBorderClasses},oj:function(){return getCheckedClasses},rt:function(){return getBackgroundClasses},v1:function(){return gothamColors}});const gothamColors=["primary","secondary","tertiary","link","neutral","black","white","error","warning","success","info"],getTextClasses=(color,options={})=>{const{hasFocus:hasFocus=!1,hasHover:hasHover=!1}=options,classes=[];return"primary"===color?(classes.push("text-primary dark:text-primary-dark"),hasHover&&classes.push("hover:text-primary-700 dark:hover:text-primary-dark-300"),hasFocus&&classes.push("focus:text-primary-700 dark:focus:text-primary-dark-300")):"secondary"===color?(classes.push("text-secondary dark:text-secondary-dark"),hasHover&&classes.push("hover:text-secondary-700 dark:hover:text-secondary-dark-300"),hasFocus&&classes.push("focus:text-secondary-700 dark:focus:text-secondary-dark-300")):"tertiary"===color?(classes.push("text-tertiary dark:text-tertiary-dark"),hasHover&&classes.push("hover:text-tertiary-700 dark:hover:text-tertiary-dark-300"),hasFocus&&classes.push("focus:text-tertiary-700 dark:focus:text-tertiary-dark-300")):"link"===color?(classes.push("text-link dark:text-link-dark"),hasHover&&classes.push("hover:text-link-700 dark:hover:text-link-dark-300"),hasFocus&&classes.push("focus:text-link-700 dark:focus:text-link-dark-300")):"neutral"===color?(classes.push("text-neutral dark:text-neutral-dark"),hasHover&&classes.push("hover:text-neutral-700 dark:hover:text-neutral-dark-300"),hasFocus&&classes.push("focus:text-neutral-700 dark:focus:text-neutral-dark-300")):"white"===color?(classes.push("text-white dark:text-white-dark"),hasHover&&classes.push("hover:text-white-300 dark:hover:text-white-dark-300"),hasFocus&&classes.push("focus:text-white-700 dark:focus:text-white-dark-700")):"error"===color?(classes.push("text-error dark:text-error-dark"),hasHover&&classes.push("hover:text-error-700 dark:hover:text-error-dark-300"),hasFocus&&classes.push("focus:text-error-700 dark:focus:text-error-dark-300")):"warning"===color?(classes.push("text-warning dark:text-warning-dark"),hasHover&&classes.push("hover:text-warning-700 dark:hover:text-warning-dark-300")):"success"===color?(classes.push("text-success dark:text-success-dark"),hasHover&&classes.push("hover:text-success-700 dark:hover:text-success-dark-300"),hasFocus&&classes.push("focus:text-success-700 dark:focus:text-success-dark-300")):"info"===color?(classes.push("text-info dark:text-info-dark"),hasHover&&classes.push("hover:text-info-700 dark:hover:text-info-dark-300"),hasFocus&&classes.push("focus:text-info-700 dark:focus:text-info-dark-300")):(classes.push("text-black dark:text-white"),hasHover&&classes.push("hover:text-black dark:hover:text-black-dark"),hasFocus&&classes.push("focus:text-black-900 dark:focus:text-black-dark-900")),classes.join(" ")},getPlaceholderClasses=(color,options={})=>{const{hasFocus:hasFocus=!1,hasHover:hasHover=!1}=options,classes=[];return"primary"===color?(classes.push("placeholder:text-primary dark:placeholder:text-primary-dark"),hasHover&&classes.push("hover:placeholder:text-primary-700 dark:hover:placeholder:text-primary-dark-300"),hasFocus&&classes.push("focus:placeholder:text-primary-700 dark:focus:placeholder:text-primary-dark-300")):"secondary"===color?(classes.push("placeholder:text-secondary dark:placeholder:text-secondary-dark"),hasHover&&classes.push("hover:placeholder:text-secondary-700 dark:hover:placeholder:text-secondary-dark-300"),hasFocus&&classes.push("focus:placeholder:text-secondary-700 dark:focus:placeholder:text-secondary-dark-300")):"tertiary"===color?(classes.push("placeholder:text-tertiary dark:placeholder:text-tertiary-dark"),hasHover&&classes.push("hover:placeholder:text-tertiary-700 dark:hover:placeholder:text-tertiary-dark-300"),hasFocus&&classes.push("focus:placeholder:text-tertiary-700 dark:focus:placeholder:text-tertiary-dark-300")):"link"===color?(classes.push("placeholder:text-link dark:placeholder:text-link-dark"),hasHover&&classes.push("hover:placeholder:text-link-700 dark:hover:placeholder:text-link-dark-300"),hasFocus&&classes.push("focus:placeholder:text-link-700 dark:focus:placeholder:text-link-dark-300")):"neutral"===color?(classes.push("placeholder:text-neutral dark:placeholder:text-neutral-dark"),hasHover&&classes.push("hover:placeholder:text-neutral-700 dark:hover:placeholder:text-neutral-dark-300"),hasFocus&&classes.push("focus:placeholder:text-neutral-700 dark:focus:placeholder:text-neutral-dark-300")):"white"===color?(classes.push("placeholder:text-white dark:placeholder:text-black"),hasHover&&classes.push("hover:placeholder:text-white-700 dark:hover:placeholder:text-black-dark-300"),hasFocus&&classes.push("focus:placeholder:text-white-700 dark:focus:placeholder:text-black-dark-300")):"error"===color?(classes.push("placeholder:text-error dark:placeholder:text-error-dark"),hasHover&&classes.push("hover:placeholder:text-error-700 dark:hover:placeholder:text-error-dark-300"),hasFocus&&classes.push("focus:placeholder:text-error-700 dark:focus:placeholder:text-error-dark-300")):"warning"===color?(classes.push("placeholder:text-warning dark:placeholder:text-warning-dark"),hasHover&&classes.push("hover:placeholder:text-warning-700 dark:hover:placeholder:text-warning-dark-300")):"success"===color?(classes.push("placeholder:text-success dark:placeholder:text-success-dark"),hasHover&&classes.push("hover:placeholder:text-success-700 dark:hover:placeholder:text-success-dark-300"),hasFocus&&classes.push("focus:placeholder:text-success-700 dark:focus:placeholder:text-success-dark-300")):"info"===color?(classes.push("placeholder:text-info dark:placeholder:text-info-dark"),hasHover&&classes.push("hover:placeholder:text-info-700 dark:hover:placeholder:text-info-dark-300"),hasFocus&&classes.push("focus:placeholder:text-info-700 dark:focus:placeholder:text-info-dark-300")):(classes.push("placeholder:text-black dark:placeholder:text-white"),hasHover&&classes.push("hover:placeholder:text-black dark:hover:placeholder:text-white"),hasFocus&&classes.push("focus:placeholder:text-black dark:focus:placeholder:text-white")),classes.join(" ")},getErrorClasses=errorColor=>"error"===errorColor?"text-error dark:text-error-dark":"warning"===errorColor?"text-warning dark:text-warning-dark":"success"===errorColor?"text-success dark:text-success-dark":"text-info dark:text-info-dark",getBorderClasses=(color,options={})=>{const{hasFocus:hasFocus=!1,hasHover:hasHover=!1}=options,classes=[];return"primary"===color?(classes.push("border-primary dark:border-primary-dark"),hasHover&&classes.push("hover:border-primary-700 dark:hover:border-primary-dark-300"),hasFocus&&classes.push("focus:border-primary-700 dark:focus:border-primary-dark-300")):"secondary"===color?(classes.push("border-secondary dark:border-secondary-dark"),hasHover&&classes.push("hover:border-secondary-700 dark:hover:border-secondary-dark-300"),hasFocus&&classes.push("focus:border-secondary-700 dark:focus:border-secondary-dark-300")):"tertiary"===color?(classes.push("border-tertiary dark:border-tertiary-dark"),hasHover&&classes.push("hover:border-tertiary-700 dark:hover:border-tertiary-dark-300"),hasFocus&&classes.push("focus:border-tertiary-700 dark:focus:border-tertiary-dark-300")):"error"===color?(classes.push("border-error dark:border-error-dark"),hasHover&&classes.push("hover:border-error-700 dark:hover:border-error-dark-300"),hasFocus&&classes.push("focus:border-error-700 dark:focus:border-error-dark-300")):"warning"===color?(classes.push("border-warning dark:border-warning-dark"),hasHover&&classes.push("hover:border-warning-700 dark:hover:border-warning-dark-300"),hasFocus&&classes.push("focus:border-warning-700 dark:focus:border-warning-dark-300")):"success"===color?(classes.push("border-success dark:border-success-dark"),hasHover&&classes.push("hover:border-success-700 dark:hover:border-success-dark-300"),hasFocus&&classes.push("focus:border-success-700 dark:focus:border-success-dark-300")):"info"===color?(classes.push("border-info dark:border-info-dark"),hasHover&&classes.push("hover:border-info-700 dark:hover:border-info-dark-300"),hasFocus&&classes.push("focus:border-info-700 dark:focus:border-info-dark-300")):(classes.push("border-black dark:border-white"),hasHover&&classes.push("hover:border-black dark:hover:border-white"),hasFocus&&classes.push("focus:border-black dark:focus:border-white")),classes.join(" ")},getOutlineClasses=(color,options={})=>{const{hasFocus:hasFocus=!1,hasHover:hasHover=!1}=options,classes=[];return"primary"===color?(classes.push("outline-primary dark:outline-primary-dark"),hasHover&&classes.push("hover:outline-primary-700 dark:hover:outline-primary-dark-300"),hasFocus&&classes.push("focus:outline-primary-700 dark:focus:outline-primary-dark-300")):"secondary"===color?(classes.push("outline-secondary dark:outline-secondary-dark"),hasHover&&classes.push("hover:outline-secondary-700 dark:hover:outline-secondary-dark-300"),hasFocus&&classes.push("focus:outline-secondary-700 dark:focus:outline-secondary-dark-300")):"tertiary"===color?(classes.push("outline-tertiary dark:outline-tertiary-dark"),hasHover&&classes.push("hover:outline-tertiary-700 dark:hover:outline-tertiary-dark-300"),hasFocus&&classes.push("focus:outline-tertiary-700 dark:focus:outline-tertiary-dark-300")):"error"===color?(classes.push("outline-error dark:outline-error-dark"),hasHover&&classes.push("hover:outline-error-700 dark:hover:outline-error-dark-300"),hasFocus&&classes.push("focus:outline-error-700 dark:focus:outline-error-dark-300")):"warning"===color?(classes.push("outline-warning dark:outline-warning-dark"),hasHover&&classes.push("hover:outline-warning-700 dark:hover:outline-warning-dark-300"),hasFocus&&classes.push("focus:outline-warning-700 dark:focus:outline-warning-dark-300")):"success"===color?(classes.push("outline-success dark:outline-success-dark"),hasHover&&classes.push("hover:outline-success-700 dark:hover:outline-success-dark-300"),hasFocus&&classes.push("focus:outline-success-700 dark:focus:outline-success-dark-300")):"info"===color?(classes.push("outline-info dark:outline-info-dark"),hasHover&&classes.push("hover:outline-info-700 dark:hover:outline-info-dark-300"),hasFocus&&classes.push("focus:outline-info-700 dark:focus:outline-info-dark-300")):(classes.push("outline-black dark:outline-white"),hasHover&&classes.push("hover:outline-black dark:hover:outline-white"),hasFocus&&classes.push("focus:outline-black dark:focus:outline-white")),classes.join(" ")},getCheckedClasses=color=>{const classes=[];return"primary"===color?classes.push("checked:border-primary-700 dark:checked:border-primary-dark-300 checked:bg-primary-700 dark:checked:bg-primary-dark-300"):"secondary"===color?classes.push("checked:border-secondary-700 dark:checked:border-secondary-dark-300 checked:bg-secondary-700 dark:checked:bg-secondary-dark-300"):"tertiary"===color?classes.push("checked:border-tertiary-700 dark:checked:border-tertiary-dark-300 checked:bg-tertiary-700 dark:checked:bg-tertiary-dark-300"):"neutral"===color?classes.push("checked:border-neutral-700 dark:checked:border-neutral-dark-300 checked:bg-neutral-700 dark:checked:bg-neutral-dark-300"):"error"===color?classes.push("checked:border-error-700 dark:checked:border-error-dark-300 checked:bg-error-700 dark:checked:bg-error-dark-300"):"warning"===color?classes.push("checked:border-warning-700 dark:checked:border-warning-dark-300 checked:bg-warning-700 dark:checked:bg-warning-dark-300"):"success"===color?classes.push("checked:border-success-700 dark:checked:border-success-dark-300 checked:bg-success-700 dark:checked:bg-success-dark-300"):"white"===color?classes.push("checked:border-white-700 dark:checked:border-black-dark-300 checked:bg-white-700 dark:checked:bg-black-dark-300"):"black"===color&&classes.push("checked:border-black-700 dark:checked:border-white-dark-300 checked:bg-black-700 dark:checked:bg-white-dark-300"),classes.join(" ")},getBackgroundClasses=(color,options={})=>{const{hasFocus:hasFocus=!1,hasHover:hasHover=!1}=options,classes=[];return"primary"===color?(classes.push("bg-primary dark:bg-primary-dark"),hasHover&&classes.push("hover:bg-primary-700 dark:hover:bg-primary-dark-300"),hasFocus&&classes.push("focus:bg-primary-700 dark:focus:bg-primary-dark-300")):"secondary"===color?(classes.push("bg-secondary dark:bg-secondary-dark"),hasHover&&classes.push("hover:bg-secondary-700 dark:hover:bg-secondary-dark-300"),hasFocus&&classes.push("focus:bg-secondary-700 dark:focus:bg-secondary-dark-300")):"tertiary"===color?(classes.push("bg-tertiary dark:bg-tertiary-dark"),hasHover&&classes.push("hover:bg-tertiary-700 dark:hover:bg-tertiary-dark-300"),hasFocus&&classes.push("focus:bg-tertiary-700 dark:focus:bg-tertiary-dark-300")):"neutral"===color?(classes.push("bg-neutral dark:bg-neutral-dark"),hasHover&&classes.push("hover:bg-neutral-700 dark:hover:bg-neutral-dark-300"),hasFocus&&classes.push("focus:bg-neutral-700 dark:focus:bg-neutral-dark-300")):"white"===color?(classes.push("bg-white dark:bg-black"),hasHover&&classes.push("hover:bg-white-700 dark:hover:bg-black-dark-300"),hasFocus&&classes.push("focus:bg-white-700 dark:focus:bg-black-dark-300")):"black"===color?(classes.push("bg-black dark:bg-white"),hasHover&&classes.push("hover:bg-black-700 dark:hover:bg-white-dark-300"),hasFocus&&classes.push("focus:bg-black-700 dark:focus:bg-white-dark-300")):"transparent"===color&&classes.push("bg-transparent"),classes.join(" ")}}}]);