{"version":3,"file":"index.js","sources":["../../../../../../../legos/text-field/new-password/new-password.theme.ts","../../../../../../../legos/text-field/new-password/new-password-error-message.ccm.css.ts","../../../../../../../legos/text-field/new-password/new-password-error-message.tsx","../../../../../../../legos/text-field/new-password/new-password.tsx","../../../../../../../legos/text-field/new-password/confirm-password.tsx"],"sourcesContent":["import { createUseThemeHook } from 'legos/theme';\n\ndeclare module 'legos/theme' {\n interface BulkLegoTheme {\n newpassword: NewPasswordTheme;\n }\n}\n\nexport interface NewPasswordTheme {\n neutral: string;\n negative: string;\n positive: string;\n labelColor: string;\n}\n\nconst [NewPasswordThemeProvider, useNewPasswordTheme] = createUseThemeHook(\n 'newpassword',\n (global): NewPasswordTheme => ({\n neutral: global.neutral.color200,\n negative: global.negative.color500,\n positive: global.positive.color500,\n labelColor: global.neutral.color700\n })\n);\n\nexport { NewPasswordThemeProvider, useNewPasswordTheme };\n","\nimport { ComponentCreator, createComponentCreator, styleInject } from 'packages/css-component-modules';\n\nconst _css = `.PasswordMessage_2b2ef4ead4e23f4c{color:var(--color_45c0f58f3d5b05b4)}.DefaultIcon_8f5ac13970851b4d,.InvalidIcon_ade51793329c1202,.ValidIcon_c70829a659cbd140{display:inline-block;width:14px;height:14px;vertical-align:middle;margin-right:2px}`;\nstyleInject(_css)\n\n/** PasswordMessage Props */\nexport type PasswordMessageCCM = {\n /** PasswordMessage Component Custom Properties */\n '$color': string;\n\n /** PasswordMessage Modifier Flags */\n // No modifiers classes found\n};\n/** Base PasswordMessage component */\nexport const PasswordMessage: ComponentCreator = createComponentCreator({\n \"name\": \"PasswordMessage\",\n \"base\": \"PasswordMessage_2b2ef4ead4e23f4c\",\n \"prop\": {\n \"$color\": \"--color_45c0f58f3d5b05b4\"\n },\n \"mod\": {}\n});\n\n\n/** InvalidIcon Props */\nexport type InvalidIconCCM = {\n /** InvalidIcon Component Custom Properties */\n // No custom properties found\n\n /** InvalidIcon Modifier Flags */\n // No modifiers classes found\n};\n/** Base InvalidIcon component */\nexport const InvalidIcon: ComponentCreator = createComponentCreator({\n \"name\": \"InvalidIcon\",\n \"base\": \"InvalidIcon_ade51793329c1202\",\n \"prop\": {},\n \"mod\": {}\n});\n\n\n/** ValidIcon Props */\nexport type ValidIconCCM = {\n /** ValidIcon Component Custom Properties */\n // No custom properties found\n\n /** ValidIcon Modifier Flags */\n // No modifiers classes found\n};\n/** Base ValidIcon component */\nexport const ValidIcon: ComponentCreator = createComponentCreator({\n \"name\": \"ValidIcon\",\n \"base\": \"ValidIcon_c70829a659cbd140\",\n \"prop\": {},\n \"mod\": {}\n});\n\n\n/** DefaultIcon Props */\nexport type DefaultIconCCM = {\n /** DefaultIcon Component Custom Properties */\n // No custom properties found\n\n /** DefaultIcon Modifier Flags */\n // No modifiers classes found\n};\n/** Base DefaultIcon component */\nexport const DefaultIcon: ComponentCreator = createComponentCreator({\n \"name\": \"DefaultIcon\",\n \"base\": \"DefaultIcon_8f5ac13970851b4d\",\n \"prop\": {},\n \"mod\": {}\n});\n\n","import { createElement, FC, PropsWithoutRef, ReactNode } from 'react';\nimport { useNewPasswordTheme } from './new-password.theme';\nimport {\n PasswordMessage,\n InvalidIcon,\n InvalidIconCCM,\n ValidIcon,\n ValidIconCCM,\n DefaultIcon,\n DefaultIconCCM\n} from './new-password-error-message.ccm.css';\n\nconst Invalid: FC<\n Partial & PropsWithoutRef\n> = () => {\n const theme = useNewPasswordTheme();\n return (\n \n Invalid\n \n \n );\n};\n\nconst Valid: FC<\n Partial & PropsWithoutRef\n> = () => {\n const theme = useNewPasswordTheme();\n return (\n \n Valid\n \n \n );\n};\n\nconst Default: FC<\n Partial & PropsWithoutRef\n> = () => {\n const theme = useNewPasswordTheme();\n return (\n \n Default\n \n \n );\n};\n\nexport interface NewPasswordErrorMessageProps {\n values?: any;\n constraint?: string;\n children: ReactNode;\n}\n\nexport const NewPasswordErrorMessage: FC = ({\n values,\n constraint,\n children\n}) => {\n const theme = useNewPasswordTheme();\n const findIcon = (values: any, constraint: string) => {\n const isInvalid =\n values.error === 'required' ||\n (values.error && values.error.split(',').includes(constraint));\n\n if (!isInvalid) {\n return ;\n }\n\n if (values.touched) {\n return ;\n }\n\n return ;\n };\n return (\n \n {constraint && findIcon(values, constraint)}\n {children}\n \n );\n};\n","import {\n patternValidator,\n Message,\n minLengthError,\n minLengthValidator,\n maxLengthValidator,\n validateAllErrors,\n TextField,\n maxLengthError\n} from 'legos/text-field/base-field';\nimport { createElement, FC, ReactNode, useMemo } from 'react';\nimport { NewPasswordErrorMessage } from './new-password-error-message';\n\nexport interface NewPasswordFieldProps {\n /** The name of this form field, unique in the current form context */\n name: string;\n /** Label node to display to the user for this field */\n label: ReactNode;\n /** Should display the password in plain text */\n showPlainText?: boolean;\n /** Message to display password constraints */\n passwordConstraintMessage: ReactNode;\n /** Error to show when the field does not have at least one number */\n errorOneNumberMessage: ReactNode;\n /** Error to show when the field does not have at least one UPPERCASE letter */\n errorOneUppercaseLetterMessage: ReactNode;\n /** Error to show when the field does not have at least one lower letter */\n errorOneLowercaseLetterMessage: ReactNode;\n /** Error to show when the field does not meet the min-length requirement */\n errorMinLengthMessage: ReactNode;\n /** Error to show when the field does not meet the max-length requirement */\n errorMaxLengthMessage?: ReactNode;\n /** A hash of error messages to show the user that occurred after a failed form submission */\n submitErrorMessages?: { [submitErrorName: string]: ReactNode };\n}\n\nconst pwdConstraintOneNumber = 'oneNumber';\nconst pwdConstraintOneUppercaseLetter = 'oneUpperCaseLetter';\nconst pwdConstraintOneLowercaseLetter = 'oneLowerCaseLetter';\n\nexport const NewPasswordField: FC = ({\n name,\n label,\n showPlainText,\n passwordConstraintMessage,\n errorOneNumberMessage,\n errorOneUppercaseLetterMessage,\n errorOneLowercaseLetterMessage,\n errorMinLengthMessage,\n errorMaxLengthMessage,\n submitErrorMessages\n}) => {\n const validate = useMemo(\n () =>\n validateAllErrors(\n // Must be >= 8\n minLengthValidator(8),\n // Must be <= 60\n maxLengthValidator(60),\n // Must have 1 number\n patternValidator(/[0-9]/, pwdConstraintOneNumber),\n // Must have 1 uppercase letter\n patternValidator(/(?=.*[A-Z])/, pwdConstraintOneUppercaseLetter),\n // Must have 1 lowercase letter\n patternValidator(/(?=.*[a-z])/, pwdConstraintOneLowercaseLetter)\n ),\n []\n );\n\n return (\n \n \n \n \n \n {(props: object) => (\n \n )}\n \n \n {(props: object) => (\n \n )}\n \n \n {(props: object) => (\n \n )}\n \n \n {(props: object) => (\n \n )}\n \n \n {(props: object) => (\n \n )}\n \n {submitErrorMessages &&\n Object.entries(submitErrorMessages).map(([error, node]) => (\n \n ))}\n \n );\n};\n","import {\n mismatchValidator,\n Message,\n TextField\n} from 'legos/text-field/base-field';\nimport { createElement, FC, useMemo, ReactNode } from 'react';\n\nexport interface ConfirmPasswordFieldProps {\n /** The name of this form field, unique in the current form context */\n name: string;\n /** Label node to display to the user for this field */\n label: ReactNode;\n /** The name of the new password field with which value should match */\n passwordField: string;\n /** Error to show when the value does not match with the password field */\n errorPasswordMismatchMessage: ReactNode;\n /** Should display the password in plain text */\n showPlainText?: boolean;\n}\n\nexport const ConfirmPasswordField: FC = ({\n name,\n label,\n showPlainText,\n passwordField,\n errorPasswordMismatchMessage\n}) => {\n const mismatchError = 'mismatch';\n\n const validate = useMemo(\n () => mismatchValidator(passwordField, mismatchError),\n [passwordField]\n );\n\n return (\n \n \n \n );\n};\n"],"names":["NewPasswordThemeProvider","useNewPasswordTheme","createUseThemeHook","global","neutral","color200","negative","color500","positive","labelColor","color700","styleInject","PasswordMessage","createComponentCreator","name","base","prop","$color","mod","InvalidIcon","ValidIcon","DefaultIcon","Invalid","theme","createElement","svg","xmlns","viewBox","fill","stroke","strokeWidth","d","Valid","Default","NewPasswordErrorMessage","values","constraint","children","div","error","split","includes","touched","findIcon","label","showPlainText","passwordConstraintMessage","errorOneNumberMessage","errorOneUppercaseLetterMessage","errorOneLowercaseLetterMessage","errorMinLengthMessage","errorMaxLengthMessage","submitErrorMessages","validate","useMemo","validateAllErrors","minLengthValidator","maxLengthValidator","patternValidator","TextField","autoComplete","type","multiMessages","required","Message","props","minLengthError","maxLengthError","Object","entries","map","node","key","submitError","dirtySinceLastSubmit","passwordField","errorPasswordMismatchMessage","mismatchValidator"],"mappings":"8gBAeOA,EAA0BC,GAAuBC,EACtD,cACCC,KACCC,QAASD,EAAOC,QAAQC,SACxBC,SAAUH,EAAOG,SAASC,SAC1BC,SAAUL,EAAOK,SAASD,SAC1BE,WAAYN,EAAOC,QAAQM,4CCjB/BC,EADa,qPAYN,MAAMC,EAAwDC,EAAuB,CAC1FC,KAAQ,kBACRC,KAAQ,mCACRC,KAAQ,CACNC,OAAU,4BAEZC,IAAO,KAaIC,EAAgDN,EAAuB,CAClFC,KAAQ,cACRC,KAAQ,+BACRC,KAAQ,GACRE,IAAO,KAaIE,EAA4CP,EAAuB,CAC9EC,KAAQ,YACRC,KAAQ,6BACRC,KAAQ,GACRE,IAAO,KAaIG,EAAgDR,EAAuB,CAClFC,KAAQ,cACRC,KAAQ,+BACRC,KAAQ,GACRE,IAAO,KC5DHI,EAEF,KACF,MAAMC,EAAQtB,IACd,OACEuB,EAACL,EAAYM,KAAIC,MAAM,6BAA6BC,QAAQ,aAC1DH,0BACAA,UACEI,KAAML,EAAMjB,SACZuB,OAAQN,EAAMjB,SACdwB,YAAY,KACZC,EAAE,8qBAMJC,EAEF,KACF,MAAMT,EAAQtB,IACd,OACEuB,EAACJ,EAAUK,KAAIC,MAAM,6BAA6BC,QAAQ,aACxDH,wBACAA,UACEI,KAAML,EAAMf,SACZqB,OAAQN,EAAMf,SACdsB,YAAY,KACZC,EAAE,6bAMJE,EAEF,KACF,MAAMV,EAAQtB,IACd,OACEuB,EAACH,EAAYI,KAAIC,MAAM,6BAA6BC,QAAQ,aAC1DH,0BACAA,UACEI,KAAML,EAAMnB,QACZyB,OAAQN,EAAMnB,QACd0B,YAAY,KACZC,EAAE,mSAYGG,EAA4D,EACvEC,OAAAA,EACAC,WAAAA,EACAC,SAAAA,MAEA,MAAMd,EAAQtB,IA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