Files
klz-cables.com/.pnpm-store/v10/files/06/65efb3cff8aa93ed2d84f13fb57d28bbc250b9260f4ea5d258e8c08e713e186d0e1357dfe5a9655c45a9abdf19effd782c25228813cd7777bcd5f647b3e856
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

103 lines
3.1 KiB
Plaintext

'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { getTranslation } from '@payloadcms/translations';
import React, { useCallback, useMemo } from 'react';
import { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js';
import { FieldDescription } from '../../fields/FieldDescription/index.js';
import { FieldError } from '../../fields/FieldError/index.js';
import { useField } from '../../forms/useField/index.js';
import { withCondition } from '../../forms/withCondition/index.js';
import { useTranslation } from '../../providers/Translation/index.js';
import { FieldLabel } from '../FieldLabel/index.js';
import { mergeFieldStyles } from '../mergeFieldStyles.js';
import { fieldBaseClass } from '../shared/index.js';
import './index.scss';
const EmailFieldComponent = props => {
const {
field,
field: {
admin: {
autoComplete,
className,
description,
placeholder
} = {},
label,
localized,
required
} = {},
path: pathFromProps,
readOnly,
validate
} = props;
const {
i18n
} = useTranslation();
const memoizedValidate = useCallback((value, options) => {
if (typeof validate === 'function') {
return validate(value, {
...options,
required
});
}
}, [validate, required]);
const {
customComponents: {
AfterInput,
BeforeInput,
Description,
Error,
Label
} = {},
disabled,
path,
setValue,
showError,
value: value_0
} = useField({
potentiallyStalePath: pathFromProps,
validate: memoizedValidate
});
const styles = useMemo(() => mergeFieldStyles(field), [field]);
return /*#__PURE__*/_jsxs("div", {
className: [fieldBaseClass, 'email', className, showError && 'error', (readOnly || disabled) && 'read-only'].filter(Boolean).join(' '),
style: styles,
children: [/*#__PURE__*/_jsx(RenderCustomComponent, {
CustomComponent: Label,
Fallback: /*#__PURE__*/_jsx(FieldLabel, {
label: label,
localized: localized,
path: path,
required: required
})
}), /*#__PURE__*/_jsxs("div", {
className: `${fieldBaseClass}__wrap`,
children: [/*#__PURE__*/_jsx(RenderCustomComponent, {
CustomComponent: Error,
Fallback: /*#__PURE__*/_jsx(FieldError, {
path: path,
showError: showError
})
}), BeforeInput, /*#__PURE__*/_jsx("input", {
autoComplete: autoComplete,
disabled: readOnly || disabled,
id: `field-${path.replace(/\./g, '__')}`,
name: path,
onChange: setValue,
placeholder: getTranslation(placeholder, i18n),
required: required,
type: "email",
value: value_0 || ''
}), AfterInput]
}), /*#__PURE__*/_jsx(RenderCustomComponent, {
CustomComponent: Description,
Fallback: /*#__PURE__*/_jsx(FieldDescription, {
description: description,
path: path
})
})]
});
};
export const EmailField = withCondition(EmailFieldComponent);
//# sourceMappingURL=index.js.map