@payloadcms/ui 3.54.0-internal.90cf7d5 → 3.54.0
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/elements/FolderView/FolderTypeField/index.d.ts.map +1 -1
- package/dist/elements/FolderView/FolderTypeField/index.js +26 -28
- package/dist/elements/FolderView/FolderTypeField/index.js.map +1 -1
- package/dist/exports/client/index.js +12 -12
- package/dist/exports/client/index.js.map +3 -3
- package/dist/providers/Auth/index.d.ts.map +1 -1
- package/dist/providers/Auth/index.js +5 -3
- package/dist/providers/Auth/index.js.map +1 -1
- package/dist/providers/Root/index.js +3 -1
- package/dist/providers/Root/index.js.map +1 -1
- package/dist/providers/ToastContainer/index.d.ts +4 -1
- package/dist/providers/ToastContainer/index.d.ts.map +1 -1
- package/dist/providers/ToastContainer/index.js +15 -2
- package/dist/providers/ToastContainer/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/elements/FolderView/FolderTypeField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAgB,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAE3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAWzB,eAAO,MAAM,eAAe,4CAGzB;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/elements/FolderView/FolderTypeField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAgB,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAE3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAWzB,eAAO,MAAM,eAAe,4CAGzB;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,sBAAsB,sBAyHhD,CAAA"}
|
|
@@ -94,34 +94,32 @@ export const FolderTypeField = ({
|
|
|
94
94
|
}
|
|
95
95
|
}, [readOnly, disabled, hasMany, setValue, onChangeFromProps]);
|
|
96
96
|
const styles = React.useMemo(() => mergeFieldStyles(field), [field]);
|
|
97
|
-
return /*#__PURE__*/_jsx(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
value: value
|
|
124
|
-
})
|
|
97
|
+
return /*#__PURE__*/_jsx(SelectInput, {
|
|
98
|
+
AfterInput: AfterInput,
|
|
99
|
+
BeforeInput: BeforeInput,
|
|
100
|
+
className: className,
|
|
101
|
+
Description: Description,
|
|
102
|
+
description: t('folder:folderTypeDescription'),
|
|
103
|
+
Error: Error,
|
|
104
|
+
filterOption: selectFilterOptions ? ({
|
|
105
|
+
value
|
|
106
|
+
}) => selectFilterOptions?.some(option => (typeof option === 'string' ? option : option.value) === value) : undefined,
|
|
107
|
+
hasMany: hasMany,
|
|
108
|
+
isClearable: isClearable,
|
|
109
|
+
isSortable: isSortable,
|
|
110
|
+
Label: Label,
|
|
111
|
+
label: label,
|
|
112
|
+
localized: localized,
|
|
113
|
+
name: name,
|
|
114
|
+
onChange: onChange,
|
|
115
|
+
options: options,
|
|
116
|
+
path: path,
|
|
117
|
+
placeholder: placeholder,
|
|
118
|
+
readOnly: readOnly || disabled,
|
|
119
|
+
required: required || Array.isArray(folderType) && folderType.length > 0,
|
|
120
|
+
showError: showError,
|
|
121
|
+
style: styles,
|
|
122
|
+
value: value
|
|
125
123
|
});
|
|
126
124
|
};
|
|
127
125
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","mergeFieldStyles","formatOptions","SelectInput","useField","useFolder","useTranslation","FolderTypeField","options","allSelectOptions","props","field","name","admin","className","isClearable","isSortable","placeholder","hasMany","label","localized","required","onChange","onChangeFromProps","path","pathFromProps","readOnly","validate","t","folderType","useMemo","length","filter","option","value","includes","memoizedValidate","useCallback","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","selectFilterOptions","setValue","showError","potentiallyStalePath","selectedOption","newValue","Array","isArray","map","styles","_jsx","description","filterOption","some","undefined","style"],"sources":["../../../../src/elements/FolderView/FolderTypeField/index.tsx"],"sourcesContent":["import type { Option, OptionObject, SelectFieldClientProps } from 'payload'\n\nimport React from 'react'\n\nimport type { ReactSelectAdapterProps } from '../../ReactSelect/types.js'\n\nimport { mergeFieldStyles } from '../../../fields/mergeFieldStyles.js'\nimport { formatOptions } from '../../../fields/Select/index.js'\nimport { SelectInput } from '../../../fields/Select/Input.js'\nimport { useField } from '../../../forms/useField/index.js'\nimport { useFolder } from '../../../providers/Folders/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\n\nexport const FolderTypeField = ({\n options: allSelectOptions,\n ...props\n}: { options: Option[] } & SelectFieldClientProps) => {\n const {\n field,\n field: {\n name,\n admin: {\n className,\n isClearable = true,\n isSortable = true,\n placeholder,\n } = {} as SelectFieldClientProps['field']['admin'],\n hasMany = false,\n label,\n localized,\n required,\n },\n onChange: onChangeFromProps,\n path: pathFromProps,\n readOnly,\n validate,\n } = props\n const { t } = useTranslation()\n\n const { folderType } = useFolder()\n\n const options = React.useMemo(() => {\n if (!folderType || folderType.length === 0) {\n return formatOptions(allSelectOptions)\n }\n return formatOptions(\n allSelectOptions.filter((option) => {\n if (typeof option === 'object' && option.value) {\n return folderType.includes(option.value)\n }\n return true\n }),\n )\n }, [allSelectOptions, folderType])\n\n const memoizedValidate = React.useCallback(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n return validate(value, { ...validationOptions, hasMany, options, required })\n }\n },\n [validate, required, hasMany, options],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled,\n path,\n selectFilterOptions,\n setValue,\n showError,\n value,\n } = useField({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const onChange: ReactSelectAdapterProps['onChange'] = React.useCallback(\n (selectedOption: OptionObject | OptionObject[]) => {\n if (!readOnly || disabled) {\n let newValue: string | string[] = null\n if (selectedOption && hasMany) {\n if (Array.isArray(selectedOption) && selectedOption.length > 0) {\n newValue = selectedOption.map((option) => option.value)\n } else {\n newValue = null\n }\n } else if (selectedOption && !Array.isArray(selectedOption)) {\n newValue = selectedOption.value\n }\n\n if (typeof onChangeFromProps === 'function') {\n onChangeFromProps(newValue)\n }\n\n setValue(newValue)\n }\n },\n [readOnly, disabled, hasMany, setValue, onChangeFromProps],\n )\n\n const styles = React.useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","mergeFieldStyles","formatOptions","SelectInput","useField","useFolder","useTranslation","FolderTypeField","options","allSelectOptions","props","field","name","admin","className","isClearable","isSortable","placeholder","hasMany","label","localized","required","onChange","onChangeFromProps","path","pathFromProps","readOnly","validate","t","folderType","useMemo","length","filter","option","value","includes","memoizedValidate","useCallback","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","selectFilterOptions","setValue","showError","potentiallyStalePath","selectedOption","newValue","Array","isArray","map","styles","_jsx","description","filterOption","some","undefined","style"],"sources":["../../../../src/elements/FolderView/FolderTypeField/index.tsx"],"sourcesContent":["import type { Option, OptionObject, SelectFieldClientProps } from 'payload'\n\nimport React from 'react'\n\nimport type { ReactSelectAdapterProps } from '../../ReactSelect/types.js'\n\nimport { mergeFieldStyles } from '../../../fields/mergeFieldStyles.js'\nimport { formatOptions } from '../../../fields/Select/index.js'\nimport { SelectInput } from '../../../fields/Select/Input.js'\nimport { useField } from '../../../forms/useField/index.js'\nimport { useFolder } from '../../../providers/Folders/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\n\nexport const FolderTypeField = ({\n options: allSelectOptions,\n ...props\n}: { options: Option[] } & SelectFieldClientProps) => {\n const {\n field,\n field: {\n name,\n admin: {\n className,\n isClearable = true,\n isSortable = true,\n placeholder,\n } = {} as SelectFieldClientProps['field']['admin'],\n hasMany = false,\n label,\n localized,\n required,\n },\n onChange: onChangeFromProps,\n path: pathFromProps,\n readOnly,\n validate,\n } = props\n const { t } = useTranslation()\n\n const { folderType } = useFolder()\n\n const options = React.useMemo(() => {\n if (!folderType || folderType.length === 0) {\n return formatOptions(allSelectOptions)\n }\n return formatOptions(\n allSelectOptions.filter((option) => {\n if (typeof option === 'object' && option.value) {\n return folderType.includes(option.value)\n }\n return true\n }),\n )\n }, [allSelectOptions, folderType])\n\n const memoizedValidate = React.useCallback(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n return validate(value, { ...validationOptions, hasMany, options, required })\n }\n },\n [validate, required, hasMany, options],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled,\n path,\n selectFilterOptions,\n setValue,\n showError,\n value,\n } = useField({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const onChange: ReactSelectAdapterProps['onChange'] = React.useCallback(\n (selectedOption: OptionObject | OptionObject[]) => {\n if (!readOnly || disabled) {\n let newValue: string | string[] = null\n if (selectedOption && hasMany) {\n if (Array.isArray(selectedOption) && selectedOption.length > 0) {\n newValue = selectedOption.map((option) => option.value)\n } else {\n newValue = null\n }\n } else if (selectedOption && !Array.isArray(selectedOption)) {\n newValue = selectedOption.value\n }\n\n if (typeof onChangeFromProps === 'function') {\n onChangeFromProps(newValue)\n }\n\n setValue(newValue)\n }\n },\n [readOnly, disabled, hasMany, setValue, onChangeFromProps],\n )\n\n const styles = React.useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <SelectInput\n AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n className={className}\n Description={Description}\n description={t('folder:folderTypeDescription')}\n Error={Error}\n filterOption={\n selectFilterOptions\n ? ({ value }) =>\n selectFilterOptions?.some(\n (option) => (typeof option === 'string' ? option : option.value) === value,\n )\n : undefined\n }\n hasMany={hasMany}\n isClearable={isClearable}\n isSortable={isSortable}\n Label={Label}\n label={label}\n localized={localized}\n name={name}\n onChange={onChange}\n options={options}\n path={path}\n placeholder={placeholder}\n readOnly={readOnly || disabled}\n required={required || (Array.isArray(folderType) && folderType.length > 0)}\n showError={showError}\n style={styles}\n value={value as string | string[]}\n />\n )\n}\n"],"mappings":";AAEA,OAAOA,KAAA,MAAW;AAIlB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,aAAa,QAAQ;AAC9B,SAASC,WAAW,QAAQ;AAC5B,SAASC,QAAQ,QAAQ;AACzB,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,eAAA,GAAkBA,CAAC;EAC9BC,OAAA,EAASC,gBAAgB;EACzB,GAAGC;AAAA,CAC4C;EAC/C,MAAM;IACJC,KAAK;IACLA,KAAA,EAAO;MACLC,IAAI;MACJC,KAAA,EAAO;QACLC,SAAS;QACTC,WAAA,GAAc,IAAI;QAClBC,UAAA,GAAa,IAAI;QACjBC;MAAW,CACZ,GAAG,CAAC,CAA6C;MAClDC,OAAA,GAAU,KAAK;MACfC,KAAK;MACLC,SAAS;MACTC;IAAQ,CACT;IACDC,QAAA,EAAUC,iBAAiB;IAC3BC,IAAA,EAAMC,aAAa;IACnBC,QAAQ;IACRC;EAAQ,CACT,GAAGjB,KAAA;EACJ,MAAM;IAAEkB;EAAC,CAAE,GAAGtB,cAAA;EAEd,MAAM;IAAEuB;EAAU,CAAE,GAAGxB,SAAA;EAEvB,MAAMG,OAAA,GAAUR,KAAA,CAAM8B,OAAO,CAAC;IAC5B,IAAI,CAACD,UAAA,IAAcA,UAAA,CAAWE,MAAM,KAAK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