@payloadcms/ui 3.0.0-beta.101 → 3.0.0-beta.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/index.js.map +2 -2
- package/dist/fields/Array/index.d.ts +11 -3
- package/dist/fields/Array/index.d.ts.map +1 -1
- package/dist/fields/Array/index.js.map +1 -1
- package/dist/fields/Blocks/index.d.ts +8 -2
- package/dist/fields/Blocks/index.d.ts.map +1 -1
- package/dist/fields/Blocks/index.js.map +1 -1
- package/dist/fields/Checkbox/index.d.ts +15 -3
- package/dist/fields/Checkbox/index.d.ts.map +1 -1
- package/dist/fields/Checkbox/index.js.map +1 -1
- package/dist/fields/Code/index.d.ts +9 -2
- package/dist/fields/Code/index.d.ts.map +1 -1
- package/dist/fields/Code/index.js.map +1 -1
- package/dist/fields/Collapsible/index.d.ts +6 -2
- package/dist/fields/Collapsible/index.d.ts.map +1 -1
- package/dist/fields/Collapsible/index.js.map +1 -1
- package/dist/fields/DateTime/index.d.ts +9 -2
- package/dist/fields/DateTime/index.d.ts.map +1 -1
- package/dist/fields/DateTime/index.js.map +1 -1
- package/dist/fields/Email/index.d.ts +10 -2
- package/dist/fields/Email/index.d.ts.map +1 -1
- package/dist/fields/Email/index.js.map +1 -1
- package/dist/fields/Group/index.d.ts +8 -3
- package/dist/fields/Group/index.d.ts.map +1 -1
- package/dist/fields/Group/index.js.map +1 -1
- package/dist/fields/JSON/index.d.ts +8 -2
- package/dist/fields/JSON/index.d.ts.map +1 -1
- package/dist/fields/JSON/index.js.map +1 -1
- package/dist/fields/Number/index.d.ts +9 -2
- package/dist/fields/Number/index.d.ts.map +1 -1
- package/dist/fields/Number/index.js.map +1 -1
- package/dist/fields/Point/index.d.ts +10 -3
- package/dist/fields/Point/index.d.ts.map +1 -1
- package/dist/fields/Point/index.js.map +1 -1
- package/dist/fields/RadioGroup/Radio/index.d.ts +2 -2
- package/dist/fields/RadioGroup/Radio/index.d.ts.map +1 -1
- package/dist/fields/RadioGroup/Radio/index.js.map +1 -1
- package/dist/fields/RadioGroup/index.d.ts +10 -2
- package/dist/fields/RadioGroup/index.d.ts.map +1 -1
- package/dist/fields/RadioGroup/index.js.map +1 -1
- package/dist/fields/Relationship/index.d.ts +8 -2
- package/dist/fields/Relationship/index.d.ts.map +1 -1
- package/dist/fields/Relationship/index.js.map +1 -1
- package/dist/fields/RichText/index.d.ts +2 -2
- package/dist/fields/RichText/index.d.ts.map +1 -1
- package/dist/fields/RichText/index.js.map +1 -1
- package/dist/fields/Row/index.d.ts +9 -2
- package/dist/fields/Row/index.d.ts.map +1 -1
- package/dist/fields/Row/index.js.map +1 -1
- package/dist/fields/Select/index.d.ts +10 -2
- package/dist/fields/Select/index.d.ts.map +1 -1
- package/dist/fields/Select/index.js.map +1 -1
- package/dist/fields/Tabs/index.d.ts +6 -2
- package/dist/fields/Tabs/index.d.ts.map +1 -1
- package/dist/fields/Tabs/index.js.map +1 -1
- package/dist/fields/Text/index.d.ts +10 -2
- package/dist/fields/Text/index.d.ts.map +1 -1
- package/dist/fields/Text/index.js.map +1 -1
- package/dist/fields/Textarea/index.d.ts +11 -2
- package/dist/fields/Textarea/index.d.ts.map +1 -1
- package/dist/fields/Textarea/index.js.map +1 -1
- package/dist/fields/Upload/index.d.ts +3 -3
- package/dist/fields/Upload/index.d.ts.map +1 -1
- package/dist/fields/Upload/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","React","useCallback","useEffect","useState","useFieldProps","useField","withCondition","useConfig","useLocale","isFieldRTL","TextInput","TextFieldComponent","props","$","field","t0","inputRef","readOnly","readOnlyFromTopLevelProps","validate","name","_path","pathFromProps","admin","t1","hasMany","label","localized","maxLength","maxRows","minLength","minRows","required","t2","undefined","className","description","placeholder","readOnlyFromAdmin","rtl","style","width","readOnlyFromProps","locale","config","t3","localization","localizationConfig","t4","value","options","memoizedValidate","path","pathFromContext","readOnlyFromContext","t5","t6","formInitializing","formProcessing","setValue","showError","value_0","disabled","renderRTL","fieldLocalized","fieldRTL","t7","Symbol","for","valueToRender","setValueToRender","t8","selectedOption","newValue","Array","isArray","map","option","handleHasManyChange","t9","t10","val","index","id","toString","t11","e","target","_jsx","afterInput","components","beforeInput","Description","Error","Label","onChange","TextField"],"sources":["../../../src/fields/Text/index.tsx"],"sourcesContent":["'use client'\nimport type { TextFieldProps } from 'payload'\n\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { Option } from '../../elements/ReactSelect/types.js'\nimport type { TextInputProps } from './types.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { isFieldRTL } from '../shared/index.js'\nimport './index.scss'\nimport { TextInput } from './Input.js'\n\nexport { TextInput, TextInputProps }\n\nconst TextFieldComponent: React.FC<TextFieldProps> = (props) => {\n const {\n field,\n field: {\n name,\n _path: pathFromProps,\n admin: {\n className,\n description,\n placeholder,\n readOnly: readOnlyFromAdmin,\n rtl,\n style,\n width,\n } = {},\n hasMany,\n label,\n localized,\n maxLength,\n maxRows,\n minLength,\n minRows,\n required,\n },\n inputRef,\n readOnly: readOnlyFromTopLevelProps,\n validate,\n } = props\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const locale = useLocale()\n\n const {\n config: { localization: localizationConfig },\n } = useConfig()\n\n const memoizedValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, maxLength, minLength, required })\n }\n },\n [validate, minLength, maxLength, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, path, setValue, showError, value } = useField({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const renderRTL = isFieldRTL({\n fieldLocalized: localized,\n fieldRTL: rtl,\n locale,\n localizationConfig: localizationConfig || undefined,\n })\n\n const [valueToRender, setValueToRender] = useState<\n { id: string; label: string; value: { value: number } }[]\n >([]) // Only for hasMany\n\n const handleHasManyChange = useCallback(\n (selectedOption) => {\n if (!disabled) {\n let newValue\n if (!selectedOption) {\n newValue = []\n } else if (Array.isArray(selectedOption)) {\n newValue = selectedOption.map((option) => option.value?.value || option.value)\n } else {\n newValue = [selectedOption.value?.value || selectedOption.value]\n }\n\n setValue(newValue)\n }\n },\n [disabled, setValue],\n )\n\n // useEffect update valueToRender:\n useEffect(() => {\n if (hasMany && Array.isArray(value)) {\n setValueToRender(\n value.map((val, index) => {\n return {\n id: `${val}${index}`, // append index to avoid duplicate keys but allow duplicate numbers\n label: `${val}`,\n value: {\n // React-select automatically uses \"label-value\" as a key, so we will get that react duplicate key warning if we just pass in the value as multiple values can be the same. So we need to append the index to the toString() of the value to avoid that warning, as it uses that as the key.\n toString: () => `${val}${index}`,\n value: val?.value || val,\n },\n }\n }),\n )\n }\n }, [value, hasMany])\n\n return (\n <TextInput\n afterInput={field?.admin?.components?.afterInput}\n beforeInput={field?.admin?.components?.beforeInput}\n className={className}\n Description={field?.admin?.components?.Description}\n description={description}\n Error={field?.admin?.components?.Error}\n field={field}\n hasMany={hasMany}\n inputRef={inputRef}\n Label={field?.admin?.components?.Label}\n label={label}\n maxRows={maxRows}\n minRows={minRows}\n onChange={\n hasMany\n ? handleHasManyChange\n : (e) => {\n setValue(e.target.value)\n }\n }\n path={path}\n placeholder={placeholder}\n readOnly={disabled}\n required={required}\n rtl={renderRTL}\n showError={showError}\n style={style}\n value={(value as string) || ''}\n valueToRender={valueToRender as Option[]}\n width={width}\n />\n )\n}\n\nexport const TextField = withCondition(TextFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,OAAOC,KAAA,IAASC,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AAS,KAAA,EAAAmE,UAAA,EAAAI,KAAA;IAAApE,KAAA;IAAAG,OAAA;IAAAE,OAAA;IAAAgE,QAAA,EAKLV,GAII;IAAAjC,IAAA;IAAAf,WAAA;IAAApB,QAAA,EAII6C,QAAA;IAAA9B,QAAA;IAAAO,GAAA,EAELwB,SAAA;IAAAH,SAAA;IAAApB,KAAA;IAAAS,KAAA,EAGEA,OAAC,IAAoB;IAAAoB,aAAA;IAAA5B;EAAA,C;CAKlC;AAEA,OAAO,MAAMuD,SAAA,GAAY1F,aAAA,CAAcK,kBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","React","useCallback","useEffect","useState","useFieldProps","useField","withCondition","useConfig","useLocale","isFieldRTL","TextInput","TextFieldComponent","props","$","field","t0","inputRef","readOnly","readOnlyFromTopLevelProps","validate","name","_path","pathFromProps","admin","t1","hasMany","label","localized","maxLength","maxRows","minLength","minRows","required","t2","undefined","className","description","placeholder","readOnlyFromAdmin","rtl","style","width","readOnlyFromProps","locale","config","t3","localization","localizationConfig","t4","value","options","memoizedValidate","path","pathFromContext","readOnlyFromContext","t5","t6","formInitializing","formProcessing","setValue","showError","value_0","disabled","renderRTL","fieldLocalized","fieldRTL","t7","Symbol","for","valueToRender","setValueToRender","t8","selectedOption","newValue","Array","isArray","map","option","handleHasManyChange","t9","t10","val","index","id","toString","t11","e","target","_jsx","afterInput","components","beforeInput","Description","Error","Label","onChange","TextField"],"sources":["../../../src/fields/Text/index.tsx"],"sourcesContent":["'use client'\nimport type { TextFieldClientComponent } from 'payload'\n\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { Option } from '../../elements/ReactSelect/types.js'\nimport type { TextInputProps } from './types.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { isFieldRTL } from '../shared/index.js'\nimport './index.scss'\nimport { TextInput } from './Input.js'\n\nexport { TextInput, TextInputProps }\n\nconst TextFieldComponent: TextFieldClientComponent = (props) => {\n const {\n field,\n field: {\n name,\n _path: pathFromProps,\n admin: {\n className,\n description,\n placeholder,\n readOnly: readOnlyFromAdmin,\n rtl,\n style,\n width,\n } = {},\n hasMany,\n label,\n localized,\n maxLength,\n maxRows,\n minLength,\n minRows,\n required,\n },\n inputRef,\n readOnly: readOnlyFromTopLevelProps,\n validate,\n } = props\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const locale = useLocale()\n\n const {\n config: { localization: localizationConfig },\n } = useConfig()\n\n const memoizedValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, maxLength, minLength, required })\n }\n },\n [validate, minLength, maxLength, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, path, setValue, showError, value } = useField({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const renderRTL = isFieldRTL({\n fieldLocalized: localized,\n fieldRTL: rtl,\n locale,\n localizationConfig: localizationConfig || undefined,\n })\n\n const [valueToRender, setValueToRender] = useState<\n { id: string; label: string; value: { value: number } }[]\n >([]) // Only for hasMany\n\n const handleHasManyChange = useCallback(\n (selectedOption) => {\n if (!disabled) {\n let newValue\n if (!selectedOption) {\n newValue = []\n } else if (Array.isArray(selectedOption)) {\n newValue = selectedOption.map((option) => option.value?.value || option.value)\n } else {\n newValue = [selectedOption.value?.value || selectedOption.value]\n }\n\n setValue(newValue)\n }\n },\n [disabled, setValue],\n )\n\n // useEffect update valueToRender:\n useEffect(() => {\n if (hasMany && Array.isArray(value)) {\n setValueToRender(\n value.map((val, index) => {\n return {\n id: `${val}${index}`, // append index to avoid duplicate keys but allow duplicate numbers\n label: `${val}`,\n value: {\n // React-select automatically uses \"label-value\" as a key, so we will get that react duplicate key warning if we just pass in the value as multiple values can be the same. So we need to append the index to the toString() of the value to avoid that warning, as it uses that as the key.\n toString: () => `${val}${index}`,\n value: val?.value || val,\n },\n }\n }),\n )\n }\n }, [value, hasMany])\n\n return (\n <TextInput\n afterInput={field?.admin?.components?.afterInput}\n beforeInput={field?.admin?.components?.beforeInput}\n className={className}\n Description={field?.admin?.components?.Description}\n description={description}\n Error={field?.admin?.components?.Error}\n field={field}\n hasMany={hasMany}\n inputRef={inputRef}\n Label={field?.admin?.components?.Label}\n label={label}\n maxRows={maxRows}\n minRows={minRows}\n onChange={\n hasMany\n ? handleHasManyChange\n : (e) => {\n setValue(e.target.value)\n }\n }\n path={path}\n placeholder={placeholder}\n readOnly={disabled}\n required={required}\n rtl={renderRTL}\n showError={showError}\n style={style}\n value={(value as string) || ''}\n valueToRender={valueToRender as Option[]}\n width={width}\n />\n )\n}\n\nexport const TextField = withCondition(TextFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAKxD,SAASC,aAAa,QAAQ;AAC9B,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAS,QAAQ;AAC1B,SAASC,SAAS,QAAQ;AAC1B,SAASC,UAAU,QAAQ;AAC3B,OAAO;AACP,SAASC,SAAS,QAAQ;AAE1B,SAASA,SAAS;AAElB,MAAMC,kBAAA,GAA+CC,KAAA;EAAA,MAAAC,CAAA,GAAAd,EAAA;EACnD;IAAAe,KAAA;IAAAA,KAAA,EAAAC,EAAA;IAAAC,QAAA;IAAAC,QAAA,EAAAC,yBAAA;IAAAC;EAAA,IA0BIP,KAAA;EAxBK;IAAAQ,IAAA;IAAAC,KAAA,EAAAC,aAAA;IAAAC,KAAA,EAAAC,EAAA;IAAAC,OAAA;IAAAC,KAAA;IAA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b0B,GAAA,GAAA5D,OAAA,GACIqD,mBAAA,GAAAQ,CAAA;MAEE3B,QAAA,CAAS2B,CAAA,CAAAC,MAAA,CAAAtC,KAAc;IAAA,CACzB;IAAApC,CAAA,OAAAY,OAAA;IAAAZ,CAAA,OAAAiE,mBAAA;IAAAjE,CAAA,OAAA8C,QAAA;IAAA9C,CAAA,OAAAwE,GAAA;EAAA;IAAAA,GAAA,GAAAxE,CAAA;EAAA;EAAA,OAnBR2E,IAAA,CAAA9E,SAAA;IAAA+E,UAAA,EACc3E,KAAA,EAAAS,KAAA,EAAAmE,UAAA,EAAAD,UAAA;IAAAE,WAAA,EACC7E,KAAA,EAAAS,KAAA,EAAAmE,UAAA,EAAAC,WAAA;IAAAxD,SAAA;IAAAyD,WAAA,EAEA9E,KAAA,EAAAS,KAAA,EAAAmE,UAAA,EAAAE,WAAA;IAAAxD,WAAA;IAAAyD,KAAA,EAEN/E,KAAA,EAAAS,KAAA,EAAAmE,UAAA,EAAAG,KAAA;IAAA/E,KAAA;IAAAW,OAAA;IAAAT,QAAA;IAAA8E,KAAA,EAIAhF,KAAA,EAAAS,KAAA,EAAAmE,UAAA,EAAAI,KAAA;IAAApE,KAAA;IAAAG,OAAA;IAAAE,OAAA;IAAAgE,QAAA,EAKLV,GAII;IAAAjC,IAAA;IAAAf,WAAA;IAAApB,QAAA,EAII6C,QAAA;IAAA9B,QAAA;IAAAO,GAAA,EAELwB,SAAA;IAAAH,SAAA;IAAApB,KAAA;IAAAS,KAAA,EAGEA,OAAC,IAAoB;IAAAoB,aAAA;IAAA5B;EAAA,C;CAKlC;AAEA,OAAO,MAAMuD,SAAA,GAAY1F,aAAA,CAAcK,kBAAA","ignoreList":[]}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TextareaFieldValidation } from 'payload';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { TextAreaInputProps } from './types.js';
|
|
4
4
|
import './index.scss';
|
|
5
5
|
import { TextareaInput } from './Input.js';
|
|
6
6
|
export { TextareaInput, TextAreaInputProps };
|
|
7
|
-
export declare const TextareaField: React.FC<
|
|
7
|
+
export declare const TextareaField: React.FC<{
|
|
8
|
+
readonly inputRef?: React.Ref<HTMLInputElement>;
|
|
9
|
+
readonly onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
10
|
+
readonly validate?: TextareaFieldValidation;
|
|
11
|
+
} & {
|
|
12
|
+
readonly descriptionProps?: import("payload").FieldDescriptionClientProps<Omit<import("payload").TextareaFieldClient, "type"> & Partial<Pick<import("payload").TextareaFieldClient, "type">>>;
|
|
13
|
+
readonly errorProps?: import("payload").FieldErrorClientProps<Omit<import("payload").TextareaFieldClient, "type"> & Partial<Pick<import("payload").TextareaFieldClient, "type">>>;
|
|
14
|
+
readonly field: Omit<import("payload").TextareaFieldClient, "type"> & Partial<Pick<import("payload").TextareaFieldClient, "type">>;
|
|
15
|
+
readonly labelProps?: import("payload").FieldLabelClientProps<Omit<import("payload").TextareaFieldClient, "type"> & Partial<Pick<import("payload").TextareaFieldClient, "type">>>;
|
|
16
|
+
} & import("payload").FormFieldBase>;
|
|
8
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Textarea/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Textarea/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgC,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAGpF,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAQpD,OAAO,cAAc,CAAA;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAA;AA+F5C,eAAO,MAAM,aAAa;;;;;;;;;oCAAwC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","getTranslation","React","useCallback","useFieldProps","useField","withCondition","useConfig","useTranslation","isFieldRTL","TextareaInput","TextareaFieldComponent","props","$","descriptionProps","errorProps","field","t0","labelProps","locale","readOnly","readOnlyFromTopLevelProps","validate","name","_path","pathFromProps","admin","t1","label","localized","maxLength","minLength","required","t2","undefined","className","description","placeholder","readOnlyFromAdmin","rows","rtl","style","width","readOnlyFromProps","i18n","config","t3","localization","isRTL","fieldLocalized","fieldRTL","localizationConfig","t4","value","options","memoizedValidate","path","pathFromContext","readOnlyFromContext","t5","t6","formInitializing","formProcessing","setValue","showError","value_0","disabled","t7","e","target","_jsx","afterInput","components","beforeInput","Description","Error","Label","onChange","TextareaField"],"sources":["../../../src/fields/Textarea/index.tsx"],"sourcesContent":["'use client'\nimport type {
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","React","useCallback","useFieldProps","useField","withCondition","useConfig","useTranslation","isFieldRTL","TextareaInput","TextareaFieldComponent","props","$","descriptionProps","errorProps","field","t0","labelProps","locale","readOnly","readOnlyFromTopLevelProps","validate","name","_path","pathFromProps","admin","t1","label","localized","maxLength","minLength","required","t2","undefined","className","description","placeholder","readOnlyFromAdmin","rows","rtl","style","width","readOnlyFromProps","i18n","config","t3","localization","isRTL","fieldLocalized","fieldRTL","localizationConfig","t4","value","options","memoizedValidate","path","pathFromContext","readOnlyFromContext","t5","t6","formInitializing","formProcessing","setValue","showError","value_0","disabled","t7","e","target","_jsx","afterInput","components","beforeInput","Description","Error","Label","onChange","TextareaField"],"sources":["../../../src/fields/Textarea/index.tsx"],"sourcesContent":["'use client'\nimport type { TextareaFieldClientComponent, TextareaFieldValidation } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\n\nimport type { TextAreaInputProps } from './types.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { isFieldRTL } from '../shared/index.js'\nimport './index.scss'\nimport { TextareaInput } from './Input.js'\n\nexport { TextareaInput, TextAreaInputProps }\n\nconst TextareaFieldComponent: TextareaFieldClientComponent = (props) => {\n const {\n descriptionProps,\n errorProps,\n field,\n field: {\n name,\n _path: pathFromProps,\n admin: {\n className,\n description,\n placeholder,\n readOnly: readOnlyFromAdmin,\n rows,\n rtl,\n style,\n width,\n } = {},\n label,\n localized,\n maxLength,\n minLength,\n required,\n },\n labelProps,\n locale,\n readOnly: readOnlyFromTopLevelProps,\n validate,\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const { i18n } = useTranslation()\n\n const {\n config: { localization },\n } = useConfig()\n\n const isRTL = isFieldRTL({\n fieldLocalized: localized,\n fieldRTL: rtl,\n locale,\n localizationConfig: localization || undefined,\n })\n\n const memoizedValidate: TextareaFieldValidation = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, maxLength, minLength, required })\n }\n },\n [validate, required, maxLength, minLength],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, path, setValue, showError, value } = useField<string>({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n return (\n <TextareaInput\n afterInput={field?.admin?.components?.afterInput}\n beforeInput={field?.admin?.components?.beforeInput}\n className={className}\n Description={field?.admin?.components?.Description}\n description={description}\n descriptionProps={descriptionProps}\n Error={field?.admin?.components?.Error}\n errorProps={errorProps}\n Label={field?.admin?.components?.Label}\n label={label}\n labelProps={labelProps}\n onChange={(e) => {\n setValue(e.target.value)\n }}\n path={path}\n placeholder={getTranslation(placeholder, i18n)}\n readOnly={disabled}\n required={required}\n rows={rows}\n rtl={isRTL}\n showError={showError}\n style={style}\n value={value}\n width={width}\n />\n )\n}\n\nexport const TextareaField = withCondition(TextareaFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,WAAW,QAAQ;AAInC,SAASC,aAAa,QAAQ;AAC9B,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,QAAQ;AAC3B,OAAO;AACP,SAASC,aAAa,QAAQ;AAE9B,SAASA,aAAa;AAEtB,MAAMC,sBAAA,GAAuDC,KAAA;EAAA,MAAAC,CAAA,GAAAb,EAAA;EAC3D;IAAAc,gBAAA;IAAAC,UAAA;IAAAC,KAAA;IAAAA,KAAA,EAAAC,EAAA;IAAAC,UAAA;IAAAC,MAAA;IAAAC,QAAA,EAAAC,yBAAA;IAAAC;EAAA,IA2BIV,KAAA;EAvBK;IAAAW,IAAA;IAAAC,KAAA,EAAAC,aAAA;IAAAC,KAAA,EAAAC,EAAA;IAAAC,KAAA;IAAAC,SAAA;IAAAC,SAAA;IAAAC,SAAA;IAAAC;EAAA,IAAAf,EAkBN;EAAA,IAAAgB,EAAA;EAAA,IAAApB,CAAA,QAAAc,EAAA;IAfQM,EAAA,GAAAN,EASD,KAAAO,SAAA,QATCP,EASD;IAAAd,CAAA,MAAAc,EAAA;IAAAd,CAAA,MAAAoB,EAAA;EAAA;IAAAA,EAAA,GAAApB,CAAA;EAAA;EATC;IAAAsB,SAAA;IAAAC,WAAA;IAAAC,WAAA;IAAAjB,QAAA,EAAAkB,iBAAA;IAAAC,IAAA;IAAAC,GAAA;IAAAC,KAAA;IAAAC;EAAA,IAAAT,EASD;EAaV,MAAAU,iBAAA,GAA0BtB,yBAA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A,GAAgBxE,aAAA,CAAcK,sBAAA","ignoreList":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UploadFieldClientProps } from 'payload';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import './index.scss';
|
|
4
4
|
export { UploadInput } from './Input.js';
|
|
5
5
|
export type { UploadInputProps } from './Input.js';
|
|
6
6
|
export declare const baseClass = "upload";
|
|
7
|
-
export declare function UploadComponent(props:
|
|
8
|
-
export declare const UploadField: React.FC<
|
|
7
|
+
export declare function UploadComponent(props: UploadFieldClientProps): React.JSX.Element;
|
|
8
|
+
export declare const UploadField: React.FC<UploadFieldClientProps>;
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Upload/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Upload/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAErD,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,cAAc,CAAA;AAGrB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,eAAO,MAAM,SAAS,WAAW,CAAA;AAEjC,wBAAgB,eAAe,CAAC,KAAK,EAAE,sBAAsB,qBAqE5D;AAED,eAAO,MAAM,WAAW,kCAAiC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","React","useField","withCondition","useConfig","UploadInput","baseClass","UploadComponent","props","$","field","t0","readOnly","readOnlyFromTopLevelProps","validate","_path","admin","t1","hasMany","label","maxRows","relationTo","required","t2","undefined","className","isSortable","readOnlyFromAdmin","style","width","readOnlyFromProps","config","t3","value","options","memoizedValidate","t4","path","filterOptions","formInitializing","formProcessing","readOnlyFromField","setValue","showError","value_0","disabled","t5","components","Description","t6","description","t7","Error","t8","Label","t9","routes","api","serverURL","_jsx","onChange","UploadField"],"sources":["../../../src/fields/Upload/index.tsx"],"sourcesContent":["'use client'\n\nimport type {
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","React","useField","withCondition","useConfig","UploadInput","baseClass","UploadComponent","props","$","field","t0","readOnly","readOnlyFromTopLevelProps","validate","_path","admin","t1","hasMany","label","maxRows","relationTo","required","t2","undefined","className","isSortable","readOnlyFromAdmin","style","width","readOnlyFromProps","config","t3","value","options","memoizedValidate","t4","path","filterOptions","formInitializing","formProcessing","readOnlyFromField","setValue","showError","value_0","disabled","t5","components","Description","t6","description","t7","Error","t8","Label","t9","routes","api","serverURL","_jsx","onChange","UploadField"],"sources":["../../../src/fields/Upload/index.tsx"],"sourcesContent":["'use client'\n\nimport type { UploadFieldClientProps } from 'payload'\n\nimport React from 'react'\n\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport './index.scss'\nimport { UploadInput } from './Input.js'\n\nexport { UploadInput } from './Input.js'\nexport type { UploadInputProps } from './Input.js'\n\nexport const baseClass = 'upload'\n\nexport function UploadComponent(props: UploadFieldClientProps) {\n const {\n field: {\n _path,\n admin: { className, isSortable, readOnly: readOnlyFromAdmin, style, width } = {},\n hasMany,\n label,\n maxRows,\n relationTo,\n required,\n },\n field,\n readOnly: readOnlyFromTopLevelProps,\n validate,\n } = props\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const { config } = useConfig()\n\n const memoizedValidate = React.useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n const {\n filterOptions,\n formInitializing,\n formProcessing,\n path,\n readOnly: readOnlyFromField,\n setValue,\n showError,\n value,\n } = useField<string | string[]>({\n path: _path,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromField || formProcessing || formInitializing\n\n return (\n <UploadInput\n api={config.routes.api}\n className={className}\n Description={field?.admin?.components?.Description}\n description={field?.admin?.description}\n Error={field?.admin?.components?.Error}\n field={field}\n filterOptions={filterOptions}\n hasMany={hasMany}\n isSortable={isSortable}\n Label={field?.admin?.components?.Label}\n label={label}\n maxRows={maxRows}\n onChange={setValue}\n path={path}\n readOnly={disabled}\n relationTo={relationTo}\n required={required}\n serverURL={config.serverURL}\n showError={showError}\n style={style}\n value={value}\n width={width}\n />\n )\n}\n\nexport const UploadField = withCondition(UploadComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,OAAOC,KAAA,MAAW;AAElB,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAS,QAAQ;AAC1B,OAAO;AACP,SAASC,WAAW,QAAQ;AAE5B,SAASA,WAAW,QAAQ;AAG5B,OAAO,MAAMC,SAAA,GAAY;AAEzB,OAAO,SAAAC,gBAAAC,KAAA;EAAA,MAAAC,CAAA,GAAAT,EAAA;EACL;IAAAU,KAAA,EAAAC,EAAA;IAAAD,KAAA;IAAAE,QAAA,EAAAC,yBAAA;IAAAC;EAAA,IAaIN,KAAA;EAZK;IAAAO,KAAA;IAAAC,KAAA,EAAAC,EAAA;IAAAC,OAAA;IAAAC,KAAA;IAAAC,OAAA;IAAAC,UAAA;IAAAC;EAAA,IAAAX,EAQN;EAAA,IAAAY,EAAA;EAAA,IAAAd,CAAA,QAAAQ,EAAA;IANQM,EAAA,GAAAN,EAAyE,KAAAO,SAAA,QAAzEP,EAAyE;IAAAR,CAAA,MAAAQ,EAAA;IAAAR,CAAA,MAAAc,EAAA;EAAA;IAAAA,EAAA,GAAAd,CAAA;EAAA;EAAzE;IAAAgB,SAAA;IAAAC,UAAA;IAAAd,QAAA,EAAAe,iB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GC3B,MAAA,CAAA2B,SAAA;MAAAf,SAAA;MAAAf,KAAA;MAAAK,KAAA,EAGJA,OAAA;MAAAJ;IAAA,C;;;;;;;;;;;;;;;;;;;;;;;;;;;SArBT0B,E;;AA2BJ,OAAO,MAAMM,WAAA,GAAc1D,aAAA,CAAcI,eAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/ui",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.103",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"ts-essentials": "7.0.3",
|
|
110
110
|
"use-context-selector": "2.0.0",
|
|
111
111
|
"uuid": "10.0.0",
|
|
112
|
-
"@payloadcms/translations": "3.0.0-beta.
|
|
112
|
+
"@payloadcms/translations": "3.0.0-beta.103"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
115
|
"@babel/cli": "^7.24.5",
|
|
@@ -127,14 +127,14 @@
|
|
|
127
127
|
"esbuild": "0.23.1",
|
|
128
128
|
"esbuild-sass-plugin": "3.3.1",
|
|
129
129
|
"eslint-plugin-react-compiler": "0.0.0-experimental-72f06b2-20240822",
|
|
130
|
-
"
|
|
131
|
-
"
|
|
130
|
+
"payload": "3.0.0-beta.103",
|
|
131
|
+
"@payloadcms/eslint-config": "3.0.0-beta.97"
|
|
132
132
|
},
|
|
133
133
|
"peerDependencies": {
|
|
134
134
|
"next": "^15.0.0-canary.104",
|
|
135
135
|
"react": "^19.0.0 || ^19.0.0-rc-06d0b89e-20240801",
|
|
136
136
|
"react-dom": "^19.0.0 || ^19.0.0-rc-06d0b89e-20240801",
|
|
137
|
-
"payload": "3.0.0-beta.
|
|
137
|
+
"payload": "3.0.0-beta.103"
|
|
138
138
|
},
|
|
139
139
|
"engines": {
|
|
140
140
|
"node": "^18.20.2 || >=20.9.0"
|