@payloadcms/ui 3.65.0-canary.3 → 3.65.0-internal.098b771

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.
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/fields/Relationship/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type {\n ClientCollectionConfig,\n ClientConfig,\n CollectionSlug,\n FilterOptionsResult,\n LabelFunction,\n StaticDescription,\n StaticLabel,\n} from 'payload'\n\nexport type Option = {\n allowEdit: boolean\n label: string\n options?: Option[]\n relationTo?: string\n value: number | string\n}\n\nexport type OptionGroup = {\n label: string\n options: Option[]\n}\n\nexport type PolymorphicRelationValue = {\n relationTo: string\n value: number | string\n}\n\nexport type MonomorphicRelationValue = number | string\n\nexport type Value =\n | MonomorphicRelationValue\n | MonomorphicRelationValue[]\n | PolymorphicRelationValue\n | PolymorphicRelationValue[]\n\ntype CLEAR = {\n exemptValues?: PolymorphicRelationValue | PolymorphicRelationValue[]\n type: 'CLEAR'\n}\n\ntype UPDATE = {\n collection: ClientCollectionConfig\n config: ClientConfig\n doc: any\n i18n: I18nClient\n type: 'UPDATE'\n}\n\ntype ADD = {\n collection: ClientCollectionConfig\n config: ClientConfig\n docs: any[]\n i18n: I18nClient\n ids?: (number | string)[]\n sort?: boolean\n type: 'ADD'\n}\n\ntype REMOVE = {\n collection: ClientCollectionConfig\n config: ClientConfig\n i18n: I18nClient\n id: string\n type: 'REMOVE'\n}\n\nexport type Action = ADD | CLEAR | REMOVE | UPDATE\n\nexport type HasManyValueUnion =\n | {\n hasMany: false\n value?: PolymorphicRelationValue\n }\n | {\n hasMany: true\n value?: PolymorphicRelationValue[]\n }\n\nexport type UpdateResults = (\n args: {\n filterOptions?: FilterOptionsResult\n lastFullyLoadedRelation?: number\n lastLoadedPage: Record<string, number>\n onSuccess?: () => void\n search?: string\n sort?: boolean\n } & HasManyValueUnion,\n) => void\n\nexport type RelationshipInputProps = {\n readonly AfterInput?: React.ReactNode\n readonly allowCreate?: boolean\n readonly allowEdit?: boolean\n readonly appearance?: 'drawer' | 'select'\n readonly BeforeInput?: React.ReactNode\n readonly className?: string\n readonly Description?: React.ReactNode\n readonly description?: StaticDescription\n readonly Error?: React.ReactNode\n readonly filterOptions?: FilterOptionsResult\n readonly formatDisplayedOptions?: (options: OptionGroup[]) => Option[] | OptionGroup[]\n readonly isSortable?: boolean\n readonly Label?: React.ReactNode\n readonly label?: StaticLabel\n readonly localized?: boolean\n readonly maxResultsPerRequest?: number\n readonly maxRows?: number\n readonly minRows?: number\n readonly path: string\n readonly placeholder?: LabelFunction | string\n readonly readOnly?: boolean\n readonly relationTo: string[]\n readonly required?: boolean\n readonly showError?: boolean\n readonly sortOptions?: Partial<Record<CollectionSlug, string>>\n readonly style?: React.CSSProperties\n} & SharedRelationshipInputProps\n\ntype SharedRelationshipInputProps =\n | {\n readonly hasMany: false\n readonly initialValue?: null | PolymorphicRelationValue\n readonly onChange: (value: PolymorphicRelationValue) => void\n readonly value?: null | PolymorphicRelationValue\n }\n | {\n readonly hasMany: true\n readonly initialValue?: null | PolymorphicRelationValue[]\n readonly onChange: (value: PolymorphicRelationValue[]) => void\n readonly value?: null | PolymorphicRelationValue[]\n }\n"],"mappings":"AA2FA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/fields/Relationship/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type {\n ClientCollectionConfig,\n ClientConfig,\n CollectionSlug,\n FilterOptionsResult,\n LabelFunction,\n StaticDescription,\n StaticLabel,\n ValueWithRelation,\n} from 'payload'\n\nexport type Option = {\n allowEdit: boolean\n label: string\n options?: Option[]\n relationTo?: string\n value: number | string\n}\n\nexport type OptionGroup = {\n label: string\n options: Option[]\n}\n\nexport type MonomorphicRelationValue = number | string\n\nexport type Value =\n | MonomorphicRelationValue\n | MonomorphicRelationValue[]\n | ValueWithRelation\n | ValueWithRelation[]\n\ntype CLEAR = {\n exemptValues?: ValueWithRelation | ValueWithRelation[]\n type: 'CLEAR'\n}\n\ntype UPDATE = {\n collection: ClientCollectionConfig\n config: ClientConfig\n doc: any\n i18n: I18nClient\n type: 'UPDATE'\n}\n\ntype ADD = {\n collection: ClientCollectionConfig\n config: ClientConfig\n docs: any[]\n i18n: I18nClient\n ids?: (number | string)[]\n sort?: boolean\n type: 'ADD'\n}\n\ntype REMOVE = {\n collection: ClientCollectionConfig\n config: ClientConfig\n i18n: I18nClient\n id: string\n type: 'REMOVE'\n}\n\nexport type Action = ADD | CLEAR | REMOVE | UPDATE\n\nexport type HasManyValueUnion =\n | {\n hasMany: false\n value?: ValueWithRelation\n }\n | {\n hasMany: true\n value?: ValueWithRelation[]\n }\n\nexport type UpdateResults = (\n args: {\n filterOptions?: FilterOptionsResult\n lastFullyLoadedRelation?: number\n lastLoadedPage: Record<string, number>\n onSuccess?: () => void\n search?: string\n sort?: boolean\n } & HasManyValueUnion,\n) => void\n\nexport type RelationshipInputProps = {\n readonly AfterInput?: React.ReactNode\n readonly allowCreate?: boolean\n readonly allowEdit?: boolean\n readonly appearance?: 'drawer' | 'select'\n readonly BeforeInput?: React.ReactNode\n readonly className?: string\n readonly Description?: React.ReactNode\n readonly description?: StaticDescription\n readonly Error?: React.ReactNode\n readonly filterOptions?: FilterOptionsResult\n readonly formatDisplayedOptions?: (options: OptionGroup[]) => Option[] | OptionGroup[]\n readonly isSortable?: boolean\n readonly Label?: React.ReactNode\n readonly label?: StaticLabel\n readonly localized?: boolean\n readonly maxResultsPerRequest?: number\n readonly maxRows?: number\n readonly minRows?: number\n readonly path: string\n readonly placeholder?: LabelFunction | string\n readonly readOnly?: boolean\n readonly relationTo: string[]\n readonly required?: boolean\n readonly showError?: boolean\n readonly sortOptions?: Partial<Record<CollectionSlug, string>>\n readonly style?: React.CSSProperties\n} & SharedRelationshipInputProps\n\ntype SharedRelationshipInputProps =\n | {\n readonly hasMany: false\n readonly initialValue?: null | ValueWithRelation\n readonly onChange: (value: ValueWithRelation) => void\n readonly value?: null | ValueWithRelation\n }\n | {\n readonly hasMany: true\n readonly initialValue?: null | ValueWithRelation[]\n readonly onChange: (value: ValueWithRelation[]) => void\n readonly value?: null | ValueWithRelation[]\n }\n"],"mappings":"AAuFA","ignoreList":[]}
@@ -3,8 +3,15 @@ import React from 'react';
3
3
  export declare const DocumentEventsProvider: React.FC<{
4
4
  children: React.ReactNode;
5
5
  }>;
6
+ /**
7
+ * The useDocumentEvents hook provides a way of subscribing to cross-document events,
8
+ * such as updates made to nested documents within a drawer.
9
+ * This hook will report document events that are outside the scope of the document currently being edited.
10
+ *
11
+ * @link https://payloadcms.com/docs/admin/react-hooks#usedocumentevents
12
+ */
6
13
  export declare const useDocumentEvents: () => {
7
- mostRecentUpdate: any;
8
- reportUpdate: (doc: DocumentEvent) => any;
14
+ mostRecentUpdate: DocumentEvent | null;
15
+ reportUpdate: (event: DocumentEvent) => void;
9
16
  };
10
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/DocumentEvents/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,OAAO,KAAuC,MAAM,OAAO,CAAA;AAO3D,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAI1E,CAAA;AAED,eAAO,MAAM,iBAAiB;;wBATR,aAAa;CASgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/DocumentEvents/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,OAAO,KAAuC,MAAM,OAAO,CAAA;AAU3D,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAI1E,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;sBApBV,aAAa,GAAG,IAAI;kBACxB,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI;CAmBK,CAAA"}
@@ -5,7 +5,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import React, { createContext, use, useState } from 'react';
6
6
  const Context = /*#__PURE__*/createContext({
7
7
  mostRecentUpdate: null,
8
- reportUpdate: doc => null
8
+ reportUpdate: () => null
9
9
  });
10
10
  export const DocumentEventsProvider = t0 => {
11
11
  const $ = _c(3);
@@ -30,5 +30,12 @@ export const DocumentEventsProvider = t0 => {
30
30
  }
31
31
  return t1;
32
32
  };
33
+ /**
34
+ * The useDocumentEvents hook provides a way of subscribing to cross-document events,
35
+ * such as updates made to nested documents within a drawer.
36
+ * This hook will report document events that are outside the scope of the document currently being edited.
37
+ *
38
+ * @link https://payloadcms.com/docs/admin/react-hooks#usedocumentevents
39
+ */
33
40
  export const useDocumentEvents = () => use(Context);
34
41
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","React","createContext","use","useState","Context","mostRecentUpdate","reportUpdate","doc","DocumentEventsProvider","t0","$","children","t1","_jsx","value","useDocumentEvents"],"sources":["../../../src/providers/DocumentEvents/index.tsx"],"sourcesContent":["'use client'\nimport type { DocumentEvent } from 'payload'\n\nimport React, { createContext, use, useState } from 'react'\n\nconst Context = createContext({\n mostRecentUpdate: null,\n reportUpdate: (doc: DocumentEvent) => null,\n})\n\nexport const DocumentEventsProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {\n const [mostRecentUpdate, reportUpdate] = useState<DocumentEvent>(null)\n\n return <Context value={{ mostRecentUpdate, reportUpdate }}>{children}</Context>\n}\n\nexport const useDocumentEvents = () => use(Context)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,QAAQ,QAAQ;AAEpD,MAAMC,OAAA,gBAAUH,aAAA,CAAc;EAC5BI,gBAAA,EAAkB;EAClBC,YAAA,EAAeC,GAAA,IAAuB;AACxC;AAEA,OAAO,MAAMC,sBAAA,GAAkEC,EAAA;EAAA,MAAAC,CAAA,GAAAX,EAAA;EAAC;IAAAY;EAAA,IAAAF,EAAY;EAC1F,OAAAJ,gBAAA,EAAAC,YAAA,IAAyCH,QAAA,KAAwB;EAAA,IAAAS,EAAA;EAAA,IAAAF,CAAA,QAAAC,QAAA,IAAAD,CAAA,QAAAL,gBAAA;IAE1DO,EAAA,GAAAC,IAAA,CAAAT,OAAA;MAAAU,KAAA;QAAAT,gBAAA;QAAAC;MAAA;MAAAK;IAAA,C;;;;;;;SAAAC,E;CACT;AAEA,OAAO,MAAMG,iBAAA,GAAoBA,CAAA,KAAMb,GAAA,CAAIE,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","React","createContext","use","useState","Context","mostRecentUpdate","reportUpdate","DocumentEventsProvider","t0","$","children","t1","_jsx","value","useDocumentEvents"],"sources":["../../../src/providers/DocumentEvents/index.tsx"],"sourcesContent":["'use client'\nimport type { DocumentEvent } from 'payload'\n\nimport React, { createContext, use, useState } from 'react'\n\nconst Context = createContext<{\n mostRecentUpdate: DocumentEvent | null\n reportUpdate: (event: DocumentEvent) => void\n}>({\n mostRecentUpdate: null,\n reportUpdate: () => null,\n})\n\nexport const DocumentEventsProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {\n const [mostRecentUpdate, reportUpdate] = useState<DocumentEvent>(null)\n\n return <Context value={{ mostRecentUpdate, reportUpdate }}>{children}</Context>\n}\n\n/**\n * The useDocumentEvents hook provides a way of subscribing to cross-document events,\n * such as updates made to nested documents within a drawer.\n * This hook will report document events that are outside the scope of the document currently being edited.\n *\n * @link https://payloadcms.com/docs/admin/react-hooks#usedocumentevents\n */\nexport const useDocumentEvents = () => use(Context)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,QAAQ,QAAQ;AAEpD,MAAMC,OAAA,gBAAUH,aAAA,CAGb;EACDI,gBAAA,EAAkB;EAClBC,YAAA,EAAcA,CAAA,KAAM;AACtB;AAEA,OAAO,MAAMC,sBAAA,GAAkEC,EAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EAAC;IAAAW;EAAA,IAAAF,EAAY;EAC1F,OAAAH,gBAAA,EAAAC,YAAA,IAAyCH,QAAA,KAAwB;EAAA,IAAAQ,EAAA;EAAA,IAAAF,CAAA,QAAAC,QAAA,IAAAD,CAAA,QAAAJ,gBAAA;IAE1DM,EAAA,GAAAC,IAAA,CAAAR,OAAA;MAAAS,KAAA;QAAAR,gBAAA;QAAAC;MAAA;MAAAI;IAAA,C;;;;;;;SAAAC,E;CACT;AAEA;;;;;;;AAOA,OAAO,MAAMG,iBAAA,GAAoBA,CAAA,KAAMZ,GAAA,CAAIE,OAAA","ignoreList":[]}