@payloadcms/ui 3.0.0-canary.23fcb9e → 3.0.0-canary.294ea5c

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.
Files changed (140) hide show
  1. package/dist/elements/AddNewRelation/index.d.ts.map +1 -0
  2. package/dist/{fields/Relationship/AddNew → elements/AddNewRelation}/index.js +98 -82
  3. package/dist/elements/AddNewRelation/index.js.map +1 -0
  4. package/dist/elements/AddNewRelation/index.scss +42 -0
  5. package/dist/elements/AddNewRelation/types.d.ts +11 -0
  6. package/dist/elements/AddNewRelation/types.d.ts.map +1 -0
  7. package/dist/elements/AddNewRelation/types.js.map +1 -0
  8. package/dist/elements/AddNewRelation/useRelatedCollections.d.ts.map +1 -0
  9. package/dist/{fields/Relationship/AddNew → elements/AddNewRelation}/useRelatedCollections.js +1 -1
  10. package/dist/elements/AddNewRelation/useRelatedCollections.js.map +1 -0
  11. package/dist/elements/AppHeader/index.js +41 -80
  12. package/dist/elements/AppHeader/index.js.map +1 -1
  13. package/dist/elements/Autosave/index.js +148 -231
  14. package/dist/elements/Autosave/index.js.map +1 -1
  15. package/dist/elements/Button/index.js +86 -218
  16. package/dist/elements/Button/index.js.map +1 -1
  17. package/dist/elements/Collapsible/index.js +44 -62
  18. package/dist/elements/Collapsible/index.js.map +1 -1
  19. package/dist/elements/Collapsible/index.scss +15 -28
  20. package/dist/elements/CopyToClipboard/index.js +20 -54
  21. package/dist/elements/CopyToClipboard/index.js.map +1 -1
  22. package/dist/elements/DocumentDrawer/DrawerContent.js +1 -1
  23. package/dist/elements/DocumentDrawer/DrawerContent.js.map +1 -1
  24. package/dist/elements/DocumentDrawer/index.js +1 -1
  25. package/dist/elements/DocumentDrawer/index.js.map +1 -1
  26. package/dist/elements/Dropzone/index.js +59 -119
  27. package/dist/elements/Dropzone/index.js.map +1 -1
  28. package/dist/elements/EditMany/index.js +124 -230
  29. package/dist/elements/EditMany/index.js.map +1 -1
  30. package/dist/elements/EditUpload/index.js +133 -206
  31. package/dist/elements/EditUpload/index.js.map +1 -1
  32. package/dist/elements/FileDetails/DraggableFileDetails/index.d.ts +20 -0
  33. package/dist/elements/FileDetails/DraggableFileDetails/index.d.ts.map +1 -0
  34. package/dist/elements/FileDetails/DraggableFileDetails/index.js +116 -0
  35. package/dist/elements/FileDetails/DraggableFileDetails/index.js.map +1 -0
  36. package/dist/elements/FileDetails/DraggableFileDetails/index.scss +33 -0
  37. package/dist/elements/FileDetails/StaticFileDetails/index.d.ts +17 -0
  38. package/dist/elements/FileDetails/StaticFileDetails/index.d.ts.map +1 -0
  39. package/dist/elements/FileDetails/StaticFileDetails/index.js +71 -0
  40. package/dist/elements/FileDetails/StaticFileDetails/index.js.map +1 -0
  41. package/dist/elements/FileDetails/{index.scss → StaticFileDetails/index.scss} +1 -1
  42. package/dist/elements/FileDetails/index.d.ts +19 -4
  43. package/dist/elements/FileDetails/index.d.ts.map +1 -1
  44. package/dist/elements/FileDetails/index.js +11 -62
  45. package/dist/elements/FileDetails/index.js.map +1 -1
  46. package/dist/elements/ListControls/index.d.ts.map +1 -1
  47. package/dist/elements/ListControls/index.js +91 -192
  48. package/dist/elements/ListControls/index.js.map +1 -1
  49. package/dist/elements/ListDrawer/DrawerContent.d.ts.map +1 -1
  50. package/dist/elements/ListDrawer/DrawerContent.js +42 -31
  51. package/dist/elements/ListDrawer/DrawerContent.js.map +1 -1
  52. package/dist/elements/ListDrawer/index.d.ts.map +1 -1
  53. package/dist/elements/ListDrawer/index.js.map +1 -1
  54. package/dist/elements/ListDrawer/types.d.ts +4 -1
  55. package/dist/elements/ListDrawer/types.d.ts.map +1 -1
  56. package/dist/elements/ListDrawer/types.js.map +1 -1
  57. package/dist/elements/Nav/context.js +47 -83
  58. package/dist/elements/Nav/context.js.map +1 -1
  59. package/dist/elements/SaveButton/index.js +30 -81
  60. package/dist/elements/SaveButton/index.js.map +1 -1
  61. package/dist/elements/SaveDraftButton/index.js +54 -116
  62. package/dist/elements/SaveDraftButton/index.js.map +1 -1
  63. package/dist/elements/SearchFilter/index.js +21 -77
  64. package/dist/elements/SearchFilter/index.js.map +1 -1
  65. package/dist/elements/SelectMany/index.d.ts +6 -0
  66. package/dist/elements/SelectMany/index.d.ts.map +1 -0
  67. package/dist/elements/SelectMany/index.js +29 -0
  68. package/dist/elements/SelectMany/index.js.map +1 -0
  69. package/dist/elements/Upload/index.js +130 -280
  70. package/dist/elements/Upload/index.js.map +1 -1
  71. package/dist/exports/client/{CodeEditor-C4FLUUO7.js → CodeEditor-MTP455NO.js} +2 -2
  72. package/dist/exports/client/chunk-NJHSEGFB.js +14 -0
  73. package/dist/exports/client/{chunk-UGBVRIVY.js.map → chunk-NJHSEGFB.js.map} +2 -2
  74. package/dist/exports/client/index.d.ts +1 -1
  75. package/dist/exports/client/index.d.ts.map +1 -1
  76. package/dist/exports/client/index.js +13 -13
  77. package/dist/exports/client/index.js.map +4 -4
  78. package/dist/fields/Relationship/index.d.ts.map +1 -1
  79. package/dist/fields/Relationship/index.js +319 -507
  80. package/dist/fields/Relationship/index.js.map +1 -1
  81. package/dist/fields/Upload/HasMany/index.d.ts +4 -0
  82. package/dist/fields/Upload/HasMany/index.d.ts.map +1 -0
  83. package/dist/fields/Upload/HasMany/index.js +238 -0
  84. package/dist/fields/Upload/HasMany/index.js.map +1 -0
  85. package/dist/fields/Upload/HasMany/index.scss +71 -0
  86. package/dist/fields/Upload/{Input.d.ts → HasOne/Input.d.ts} +1 -1
  87. package/dist/fields/Upload/HasOne/Input.d.ts.map +1 -0
  88. package/dist/fields/Upload/{Input.js → HasOne/Input.js} +12 -12
  89. package/dist/fields/Upload/HasOne/Input.js.map +1 -0
  90. package/dist/fields/Upload/HasOne/index.d.ts +12 -0
  91. package/dist/fields/Upload/HasOne/index.d.ts.map +1 -0
  92. package/dist/fields/Upload/HasOne/index.js +131 -0
  93. package/dist/fields/Upload/HasOne/index.js.map +1 -0
  94. package/dist/fields/Upload/{index.scss → HasOne/index.scss} +1 -1
  95. package/dist/fields/Upload/index.d.ts +4 -4
  96. package/dist/fields/Upload/index.d.ts.map +1 -1
  97. package/dist/fields/Upload/index.js +84 -98
  98. package/dist/fields/Upload/index.js.map +1 -1
  99. package/dist/forms/Submit/index.js +12 -28
  100. package/dist/forms/Submit/index.js.map +1 -1
  101. package/dist/forms/buildStateFromSchema/addFieldStatePromise.d.ts.map +1 -1
  102. package/dist/forms/buildStateFromSchema/addFieldStatePromise.js +1 -27
  103. package/dist/forms/buildStateFromSchema/addFieldStatePromise.js.map +1 -1
  104. package/dist/hooks/useDelay.js +15 -48
  105. package/dist/hooks/useDelay.js.map +1 -1
  106. package/dist/hooks/useDelayedRender.js +32 -71
  107. package/dist/hooks/useDelayedRender.js.map +1 -1
  108. package/dist/hooks/useIntersect.js +14 -20
  109. package/dist/hooks/useIntersect.js.map +1 -1
  110. package/dist/providers/Config/createClientConfig/collections.d.ts.map +1 -1
  111. package/dist/providers/Config/createClientConfig/collections.js +8 -6
  112. package/dist/providers/Config/createClientConfig/collections.js.map +1 -1
  113. package/dist/providers/ListInfo/index.d.ts +6 -0
  114. package/dist/providers/ListInfo/index.d.ts.map +1 -1
  115. package/dist/providers/ListInfo/index.js.map +1 -1
  116. package/dist/providers/Preferences/index.js +1 -3
  117. package/dist/providers/Preferences/index.js.map +1 -1
  118. package/dist/providers/Selection/index.d.ts +5 -3
  119. package/dist/providers/Selection/index.d.ts.map +1 -1
  120. package/dist/providers/Selection/index.js +102 -190
  121. package/dist/providers/Selection/index.js.map +1 -1
  122. package/dist/scss/app.scss +6 -6
  123. package/dist/scss/type.scss +4 -4
  124. package/dist/styles.css +1 -1
  125. package/package.json +8 -8
  126. package/dist/exports/client/chunk-UGBVRIVY.js +0 -14
  127. package/dist/fields/Relationship/AddNew/index.d.ts.map +0 -1
  128. package/dist/fields/Relationship/AddNew/index.js.map +0 -1
  129. package/dist/fields/Relationship/AddNew/index.scss +0 -28
  130. package/dist/fields/Relationship/AddNew/types.d.ts +0 -12
  131. package/dist/fields/Relationship/AddNew/types.d.ts.map +0 -1
  132. package/dist/fields/Relationship/AddNew/types.js.map +0 -1
  133. package/dist/fields/Relationship/AddNew/useRelatedCollections.d.ts.map +0 -1
  134. package/dist/fields/Relationship/AddNew/useRelatedCollections.js.map +0 -1
  135. package/dist/fields/Upload/Input.d.ts.map +0 -1
  136. package/dist/fields/Upload/Input.js.map +0 -1
  137. /package/dist/{fields/Relationship/AddNew → elements/AddNewRelation}/index.d.ts +0 -0
  138. /package/dist/{fields/Relationship/AddNew → elements/AddNewRelation}/types.js +0 -0
  139. /package/dist/{fields/Relationship/AddNew → elements/AddNewRelation}/useRelatedCollections.d.ts +0 -0
  140. /package/dist/exports/client/{CodeEditor-C4FLUUO7.js.map → CodeEditor-MTP455NO.js.map} +0 -0
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
 
3
- import { c as _c } from "react/compiler-runtime";
4
3
  import { jsx as _jsx } from "react/jsx-runtime";
5
4
  import React, { useCallback, useRef } from 'react';
6
5
  import { useForm, useFormModified } from '../../forms/Form/context.js';
@@ -15,17 +14,14 @@ import { useOperation } from '../../providers/Operation/index.js';
15
14
  import { useTranslation } from '../../providers/Translation/index.js';
16
15
  const baseClass = 'save-draft';
17
16
  export const DefaultSaveDraftButton = () => {
18
- const $ = _c(22);
19
17
  const {
20
- config: t0
18
+ config: {
19
+ routes: {
20
+ api
21
+ },
22
+ serverURL
23
+ }
21
24
  } = useConfig();
22
- const {
23
- routes: t1,
24
- serverURL
25
- } = t0;
26
- const {
27
- api
28
- } = t1;
29
25
  const {
30
26
  id,
31
27
  collectionSlug,
@@ -44,113 +40,55 @@ export const DefaultSaveDraftButton = () => {
44
40
  submit
45
41
  } = useForm();
46
42
  const operation = useOperation();
47
- const forceDisable = operation === "update" && !modified;
48
- let t2;
49
- if ($[0] !== forceDisable || $[1] !== locale || $[2] !== collectionSlug || $[3] !== serverURL || $[4] !== api || $[5] !== id || $[6] !== globalSlug || $[7] !== submit) {
50
- t2 = async () => {
51
- if (forceDisable) {
52
- return;
53
- }
54
- const search = `?locale=${locale}&depth=0&fallback-locale=null&draft=true`;
55
- let action;
56
- let method = "POST";
57
- if (collectionSlug) {
58
- action = `${serverURL}${api}/${collectionSlug}${id ? `/${id}` : ""}${search}`;
59
- if (id) {
60
- method = "PATCH";
61
- }
62
- }
63
- if (globalSlug) {
64
- action = `${serverURL}${api}/globals/${globalSlug}${search}`;
65
- }
66
- await submit({
67
- action,
68
- method,
69
- overrides: {
70
- _status: "draft"
71
- },
72
- skipValidation: true
73
- });
74
- };
75
- $[0] = forceDisable;
76
- $[1] = locale;
77
- $[2] = collectionSlug;
78
- $[3] = serverURL;
79
- $[4] = api;
80
- $[5] = id;
81
- $[6] = globalSlug;
82
- $[7] = submit;
83
- $[8] = t2;
84
- } else {
85
- t2 = $[8];
86
- }
87
- const saveDraft = t2;
88
- let t3;
89
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
90
- t3 = ["s"];
91
- $[9] = t3;
92
- } else {
93
- t3 = $[9];
94
- }
95
- let t4;
96
- if ($[10] !== editDepth) {
97
- t4 = {
98
- cmdCtrlKey: true,
99
- editDepth,
100
- keyCodes: t3
101
- };
102
- $[10] = editDepth;
103
- $[11] = t4;
104
- } else {
105
- t4 = $[11];
106
- }
107
- let t5;
108
- if ($[12] !== forceDisable || $[13] !== ref) {
109
- t5 = e => {
110
- if (forceDisable) {}
111
- e.preventDefault();
112
- e.stopPropagation();
113
- if (ref?.current) {
114
- ref.current.click();
115
- }
116
- };
117
- $[12] = forceDisable;
118
- $[13] = ref;
119
- $[14] = t5;
120
- } else {
121
- t5 = $[14];
122
- }
123
- useHotkey(t4, t5);
124
- let t6;
125
- if ($[15] !== saveDraft) {
126
- t6 = () => void saveDraft();
127
- $[15] = saveDraft;
128
- $[16] = t6;
129
- } else {
130
- t6 = $[16];
131
- }
132
- let t7;
133
- if ($[17] !== t || $[18] !== forceDisable || $[19] !== t6 || $[20] !== ref) {
134
- t7 = _jsx(FormSubmit, {
135
- buttonId: "action-save-draft",
136
- buttonStyle: "secondary",
137
- className: baseClass,
138
- disabled: forceDisable,
139
- onClick: t6,
140
- ref,
141
- size: "medium",
142
- type: "button",
143
- children: t("version:saveDraft")
43
+ const forceDisable = operation === 'update' && !modified;
44
+ const saveDraft = useCallback(async () => {
45
+ if (forceDisable) return;
46
+ const search = `?locale=${locale}&depth=0&fallback-locale=null&draft=true`;
47
+ let action;
48
+ let method = 'POST';
49
+ if (collectionSlug) {
50
+ action = `${serverURL}${api}/${collectionSlug}${id ? `/${id}` : ''}${search}`;
51
+ if (id) method = 'PATCH';
52
+ }
53
+ if (globalSlug) {
54
+ action = `${serverURL}${api}/globals/${globalSlug}${search}`;
55
+ }
56
+ await submit({
57
+ action,
58
+ method,
59
+ overrides: {
60
+ _status: 'draft'
61
+ },
62
+ skipValidation: true
144
63
  });
145
- $[17] = t;
146
- $[18] = forceDisable;
147
- $[19] = t6;
148
- $[20] = ref;
149
- $[21] = t7;
150
- } else {
151
- t7 = $[21];
152
- }
153
- return t7;
64
+ }, [submit, collectionSlug, globalSlug, serverURL, api, locale, id, forceDisable]);
65
+ useHotkey({
66
+ cmdCtrlKey: true,
67
+ editDepth,
68
+ keyCodes: ['s']
69
+ }, e => {
70
+ if (forceDisable) {
71
+ // absorb the event
72
+ }
73
+ e.preventDefault();
74
+ e.stopPropagation();
75
+ if (ref?.current) {
76
+ ref.current.click();
77
+ }
78
+ });
79
+ return /*#__PURE__*/_jsx(FormSubmit, {
80
+ buttonId: "action-save-draft",
81
+ buttonStyle: "secondary",
82
+ className: baseClass,
83
+ disabled: forceDisable,
84
+ onClick: () => {
85
+ return void saveDraft();
86
+ },
87
+ ref: ref,
88
+ size: "medium",
89
+ type: "button",
90
+ children: t('version:saveDraft')
91
+ });
154
92
  };
155
93
  export const SaveDraftButton = ({
156
94
  CustomComponent
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","React","useCallback","useRef","useForm","useFormModified","FormSubmit","useHotkey","RenderComponent","useConfig","useDocumentInfo","useEditDepth","useLocale","useOperation","useTranslation","baseClass","DefaultSaveDraftButton","$","config","t0","routes","t1","serverURL","api","id","collectionSlug","globalSlug","modified","code","locale","ref","editDepth","t","submit","operation","forceDisable","t2","search","action","method","overrides","_status","skipValidation","saveDraft","t3","Symbol","for","t4","cmdCtrlKey","keyCodes","t5","e","preventDefault","stopPropagation","current","click","t6","t7","_jsx","buttonId","buttonStyle","className","disabled","onClick","size","type","children","SaveDraftButton","CustomComponent","mappedComponent"],"sources":["../../../src/elements/SaveDraftButton/index.tsx"],"sourcesContent":["'use client'\n\nimport type { MappedComponent } from 'payload'\n\nimport React, { useCallback, useRef } from 'react'\n\nimport { useForm, useFormModified } from '../../forms/Form/context.js'\nimport { FormSubmit } from '../../forms/Submit/index.js'\nimport { useHotkey } from '../../hooks/useHotkey.js'\nimport { RenderComponent } from '../../providers/Config/RenderComponent.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useEditDepth } from '../../providers/EditDepth/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useOperation } from '../../providers/Operation/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\n\nconst baseClass = 'save-draft'\n\nexport const DefaultSaveDraftButton: React.FC = () => {\n const {\n config: {\n routes: { api },\n serverURL,\n },\n } = useConfig()\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n const modified = useFormModified()\n const { code: locale } = useLocale()\n const ref = useRef<HTMLButtonElement>(null)\n const editDepth = useEditDepth()\n const { t } = useTranslation()\n const { submit } = useForm()\n const operation = useOperation()\n\n const forceDisable = operation === 'update' && !modified\n\n const saveDraft = useCallback(async () => {\n if (forceDisable) return\n\n const search = `?locale=${locale}&depth=0&fallback-locale=null&draft=true`\n let action\n let method = 'POST'\n\n if (collectionSlug) {\n action = `${serverURL}${api}/${collectionSlug}${id ? `/${id}` : ''}${search}`\n if (id) method = 'PATCH'\n }\n\n if (globalSlug) {\n action = `${serverURL}${api}/globals/${globalSlug}${search}`\n }\n\n await submit({\n action,\n method,\n overrides: {\n _status: 'draft',\n },\n skipValidation: true,\n })\n }, [submit, collectionSlug, globalSlug, serverURL, api, locale, id, forceDisable])\n\n useHotkey({ cmdCtrlKey: true, editDepth, keyCodes: ['s'] }, (e) => {\n if (forceDisable) {\n // absorb the event\n }\n\n e.preventDefault()\n e.stopPropagation()\n if (ref?.current) {\n ref.current.click()\n }\n })\n\n return (\n <FormSubmit\n buttonId=\"action-save-draft\"\n buttonStyle=\"secondary\"\n className={baseClass}\n disabled={forceDisable}\n onClick={() => {\n return void saveDraft()\n }}\n ref={ref}\n size=\"medium\"\n type=\"button\"\n >\n {t('version:saveDraft')}\n </FormSubmit>\n )\n}\n\ntype Props = {\n CustomComponent?: MappedComponent\n}\n\nexport const SaveDraftButton: React.FC<Props> = ({ CustomComponent }) => {\n if (CustomComponent) return <RenderComponent mappedComponent={CustomComponent} />\n return <DefaultSaveDraftButton />\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,OAAOC,KAAA,IAASC,WAAW,EAAEC,MAAM,QAAQ;AAE3C,SAASC,OAAO,EAAEC,eAAe,QAAQ;AACzC,SAASC,UAAU,QAAQ;AAC3B,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,YAAY,QAAQ;AAC7B,SAASC,SAAS,QAAQ;AAC1B,SAASC,YAAY,QAAQ;AAC7B,SAASC,cAAc,QAAQ;AAE/B,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,sBAAA,GAAmCA,CAAA;EAAA,MAAAC,CAAA,GAAAjB,EAAA;EAC9C;IAAAkB,MAAA,EAAAC;EAAA,IAKIV,SAAA;EAJM;IAAAW,MAAA,EAAAC,EAAA;IAAAC;EAAA,IAAAH,EAGP;EAFS;IAAAI;EAAA,IAAAF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0B,SAAA;IAQaa,EAAA,GAAAA,CAAA,UACKb,SAAA;IACd1B,CAAA,OAAA0B,SAAA;IAAA1B,CAAA,OAAAuC,EAAA;EAAA;IAAAA,EAAA,GAAAvC,CAAA;EAAA;EAAA,IAAAwC,EAAA;EAAA,IAAAxC,CAAA,SAAAe,CAAA,IAAAf,CAAA,SAAAkB,YAAA,IAAAlB,CAAA,SAAAuC,EAAA,IAAAvC,CAAA,SAAAa,GAAA;IAPF2B,EAAA,GAAAC,IAAA,CAAApD,UAAA;MAAAqD,QAAA,EACW;MAAAC,WAAA,EACG;MAAAC,SAAA,EAAA9C,SAAA;MAAA+C,QAAA,EAEF3B,YAAA;MAAA4B,OAAA,EACDP,EAET;MAAA1B,GAAA;MAAAkC,IAAA,EAEK;MAAAC,IAAA,EACA;MAAAC,QAAA,EAEJlC,CAAA,CAAE;IAAA,C;;;;;;;;;SAZLyB,E;CAeJ;AAMA,OAAO,MAAMU,eAAA,GAAmCA,CAAC;EAAEC;AAAe,CAAE;EAClE,IAAIA,eAAA,EAAiB,oBAAOV,IAAA,CAAClD,eAAA;IAAgB6D,eAAA,EAAiBD;;EAC9D,oBAAOV,IAAA,CAAC1C,sBAAA;AACV","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","useCallback","useRef","useForm","useFormModified","FormSubmit","useHotkey","RenderComponent","useConfig","useDocumentInfo","useEditDepth","useLocale","useOperation","useTranslation","baseClass","DefaultSaveDraftButton","config","routes","api","serverURL","id","collectionSlug","globalSlug","modified","code","locale","ref","editDepth","t","submit","operation","forceDisable","saveDraft","search","action","method","overrides","_status","skipValidation","cmdCtrlKey","keyCodes","e","preventDefault","stopPropagation","current","click","_jsx","buttonId","buttonStyle","className","disabled","onClick","size","type","SaveDraftButton","CustomComponent","mappedComponent"],"sources":["../../../src/elements/SaveDraftButton/index.tsx"],"sourcesContent":["'use client'\n\nimport type { MappedComponent } from 'payload'\n\nimport React, { useCallback, useRef } from 'react'\n\nimport { useForm, useFormModified } from '../../forms/Form/context.js'\nimport { FormSubmit } from '../../forms/Submit/index.js'\nimport { useHotkey } from '../../hooks/useHotkey.js'\nimport { RenderComponent } from '../../providers/Config/RenderComponent.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useEditDepth } from '../../providers/EditDepth/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useOperation } from '../../providers/Operation/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\n\nconst baseClass = 'save-draft'\n\nexport const DefaultSaveDraftButton: React.FC = () => {\n const {\n config: {\n routes: { api },\n serverURL,\n },\n } = useConfig()\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n const modified = useFormModified()\n const { code: locale } = useLocale()\n const ref = useRef<HTMLButtonElement>(null)\n const editDepth = useEditDepth()\n const { t } = useTranslation()\n const { submit } = useForm()\n const operation = useOperation()\n\n const forceDisable = operation === 'update' && !modified\n\n const saveDraft = useCallback(async () => {\n if (forceDisable) return\n\n const search = `?locale=${locale}&depth=0&fallback-locale=null&draft=true`\n let action\n let method = 'POST'\n\n if (collectionSlug) {\n action = `${serverURL}${api}/${collectionSlug}${id ? `/${id}` : ''}${search}`\n if (id) method = 'PATCH'\n }\n\n if (globalSlug) {\n action = `${serverURL}${api}/globals/${globalSlug}${search}`\n }\n\n await submit({\n action,\n method,\n overrides: {\n _status: 'draft',\n },\n skipValidation: true,\n })\n }, [submit, collectionSlug, globalSlug, serverURL, api, locale, id, forceDisable])\n\n useHotkey({ cmdCtrlKey: true, editDepth, keyCodes: ['s'] }, (e) => {\n if (forceDisable) {\n // absorb the event\n }\n\n e.preventDefault()\n e.stopPropagation()\n if (ref?.current) {\n ref.current.click()\n }\n })\n\n return (\n <FormSubmit\n buttonId=\"action-save-draft\"\n buttonStyle=\"secondary\"\n className={baseClass}\n disabled={forceDisable}\n onClick={() => {\n return void saveDraft()\n }}\n ref={ref}\n size=\"medium\"\n type=\"button\"\n >\n {t('version:saveDraft')}\n </FormSubmit>\n )\n}\n\ntype Props = {\n CustomComponent?: MappedComponent\n}\n\nexport const SaveDraftButton: React.FC<Props> = ({ CustomComponent }) => {\n if (CustomComponent) return <RenderComponent mappedComponent={CustomComponent} />\n return <DefaultSaveDraftButton />\n}\n"],"mappings":"AAAA;;;AAIA,OAAOA,KAAA,IAASC,WAAW,EAAEC,MAAM,QAAQ;AAE3C,SAASC,OAAO,EAAEC,eAAe,QAAQ;AACzC,SAASC,UAAU,QAAQ;AAC3B,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,YAAY,QAAQ;AAC7B,SAASC,SAAS,QAAQ;AAC1B,SAASC,YAAY,QAAQ;AAC7B,SAASC,cAAc,QAAQ;AAE/B,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,sBAAA,GAAmCA,CAAA;EAC9C,MAAM;IACJC,MAAA,EAAQ;MACNC,MAAA,EAAQ;QAAEC;MAAG,CAAE;MACfC;IAAS;EACV,CACF,GAAGX,SAAA;EACJ,MAAM;IAAEY,EAAE;IAAEC,cAAc;IAAEC;EAAU,CAAE,GAAGb,eAAA;EAC3C,MAAMc,QAAA,GAAWnB,eAAA;EACjB,MAAM;IAAEoB,IAAA,EAAMC;EAAM,CAAE,GAAGd,SAAA;EACzB,MAAMe,GAAA,GAAMxB,MAAA,CAA0B;EACtC,MAAMyB,SAAA,GAAYjB,YAAA;EAClB,MAAM;IAAEkB;EAAC,CAAE,GAAGf,cAAA;EACd,MAAM;IAAEgB;EAAM,CAAE,GAAG1B,OAAA;EACnB,MAAM2B,SAAA,GAAYlB,YAAA;EAElB,MAAMmB,YAAA,GAAeD,SAAA,KAAc,YAAY,CAACP,QAAA;EAEhD,MAAMS,SAAA,GAAY/B,WAAA,CAAY;IAC5B,IAAI8B,YAAA,EAAc;IAElB,MAAME,MAAA,GAAS,WAAWR,MAAA,0CAAg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iB,oBAAOT,IAAA,CAACvC,eAAA;IAAgBiD,eAAA,EAAiBD;;EAC9D,oBAAOT,IAAA,CAAC/B,sBAAA;AACV","ignoreList":[]}
@@ -1,13 +1,11 @@
1
1
  'use client';
2
2
 
3
- import { c as _c } from "react/compiler-runtime";
4
3
  import { jsx as _jsx } from "react/jsx-runtime";
5
4
  import React, { useEffect, useRef } from 'react';
6
5
  import { useDebounce } from '../../hooks/useDebounce.js';
7
6
  import './index.scss';
8
7
  const baseClass = 'search-filter';
9
8
  export const SearchFilter = props => {
10
- const $ = _c(16);
11
9
  const {
12
10
  handleChange,
13
11
  initialParams,
@@ -15,81 +13,27 @@ export const SearchFilter = props => {
15
13
  setValue,
16
14
  value
17
15
  } = props;
18
- const previousSearch = useRef(typeof initialParams?.search === "string" ? initialParams?.search : "");
16
+ const previousSearch = useRef(typeof initialParams?.search === 'string' ? initialParams?.search : '');
19
17
  const debouncedSearch = useDebounce(value, 300);
20
- let t0;
21
- if ($[0] !== debouncedSearch || $[1] !== handleChange) {
22
- t0 = () => {
23
- if (debouncedSearch !== previousSearch.current) {
24
- if (handleChange) {
25
- handleChange(debouncedSearch);
26
- }
27
- previousSearch.current = debouncedSearch;
28
- }
29
- };
30
- $[0] = debouncedSearch;
31
- $[1] = handleChange;
32
- $[2] = t0;
33
- } else {
34
- t0 = $[2];
35
- }
36
- let t1;
37
- if ($[3] !== debouncedSearch || $[4] !== previousSearch || $[5] !== handleChange) {
38
- t1 = [debouncedSearch, previousSearch, handleChange];
39
- $[3] = debouncedSearch;
40
- $[4] = previousSearch;
41
- $[5] = handleChange;
42
- $[6] = t1;
43
- } else {
44
- t1 = $[6];
45
- }
46
- useEffect(t0, t1);
47
- let t2;
48
- if ($[7] !== setValue) {
49
- t2 = () => () => setValue("");
50
- $[7] = setValue;
51
- $[8] = t2;
52
- } else {
53
- t2 = $[8];
54
- }
55
- let t3;
56
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
57
- t3 = [];
58
- $[9] = t3;
59
- } else {
60
- t3 = $[9];
61
- }
62
- useEffect(t2, t3);
63
- let t4;
64
- if ($[10] !== setValue) {
65
- t4 = e => setValue(e.target.value);
66
- $[10] = setValue;
67
- $[11] = t4;
68
- } else {
69
- t4 = $[11];
70
- }
71
- const t5 = value || "";
72
- let t6;
73
- if ($[12] !== label || $[13] !== t4 || $[14] !== t5) {
74
- t6 = _jsx("div", {
75
- className: baseClass,
76
- children: _jsx("input", {
77
- "aria-label": label,
78
- className: `${baseClass}__input`,
79
- id: "search-filter-input",
80
- onChange: t4,
81
- placeholder: label,
82
- type: "text",
83
- value: t5
84
- })
85
- });
86
- $[12] = label;
87
- $[13] = t4;
88
- $[14] = t5;
89
- $[15] = t6;
90
- } else {
91
- t6 = $[15];
92
- }
93
- return t6;
18
+ useEffect(() => {
19
+ if (debouncedSearch !== previousSearch.current) {
20
+ if (handleChange) handleChange(debouncedSearch);
21
+ previousSearch.current = debouncedSearch;
22
+ }
23
+ }, [debouncedSearch, previousSearch, handleChange]);
24
+ // Cleans up the search input when the component is unmounted
25
+ useEffect(() => () => setValue(''), []);
26
+ return /*#__PURE__*/_jsx("div", {
27
+ className: baseClass,
28
+ children: /*#__PURE__*/_jsx("input", {
29
+ "aria-label": label,
30
+ className: `${baseClass}__input`,
31
+ id: "search-filter-input",
32
+ onChange: e => setValue(e.target.value),
33
+ placeholder: label,
34
+ type: "text",
35
+ value: value || ''
36
+ })
37
+ });
94
38
  };
95
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","React","useEffect","useRef","useDebounce","baseClass","SearchFilter","props","$","handleChange","initialParams","label","setValue","value","previousSearch","search","debouncedSearch","t0","current","t1","t2","t3","Symbol","for","t4","e","target","t5","t6","_jsx","className","children","id","onChange","placeholder","type"],"sources":["../../../src/elements/SearchFilter/index.tsx"],"sourcesContent":["'use client'\nimport React, { useEffect, useRef } from 'react'\n\nexport type SearchFilterProps = {\n fieldName?: string\n handleChange?: (search: string) => void\n initialParams?: ParsedQs\n label: string\n setValue?: (arg: string) => void\n value?: string\n}\n\nimport type { ParsedQs } from 'qs-esm'\n\nimport { useDebounce } from '../../hooks/useDebounce.js'\nimport './index.scss'\n\nconst baseClass = 'search-filter'\n\nexport const SearchFilter: React.FC<SearchFilterProps> = (props) => {\n const { handleChange, initialParams, label, setValue, value } = props\n\n const previousSearch = useRef(\n typeof initialParams?.search === 'string' ? initialParams?.search : '',\n )\n\n const debouncedSearch = useDebounce(value, 300)\n\n useEffect(() => {\n if (debouncedSearch !== previousSearch.current) {\n if (handleChange) handleChange(debouncedSearch)\n\n previousSearch.current = debouncedSearch\n }\n }, [debouncedSearch, previousSearch, handleChange])\n\n // Cleans up the search input when the component is unmounted\n useEffect(() => () => setValue(''), [])\n\n return (\n <div className={baseClass}>\n <input\n aria-label={label}\n className={`${baseClass}__input`}\n id=\"search-filter-input\"\n onChange={(e) => setValue(e.target.value)}\n placeholder={label}\n type=\"text\"\n value={value || ''}\n />\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,IAASC,SAAS,EAAEC,MAAM,QAAQ;AAazC,SAASC,WAAW,QAAQ;AAC5B,OAAO;AAEP,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,YAAA,GAA4CC,KAAA;EAAA,MAAAC,CAAA,GAAAR,EAAA;EACvD;IAAAS,YAAA;IAAAC,aAAA;IAAAC,KAAA;IAAAC,QAAA;IAAAC;EAAA,IAAgEN,KAAA;EAEhE,MAAAO,cAAA,GAAuBX,MAAA,CACrB,OAAOO,aAAA,EAAAK,MAAA,KAA0B,WAAWL,aAAA,EAAAK,MAAA,GAAwB;EAGtE,MAAAC,eAAA,GAAwBZ,WAAA,CAAYS,KAAA,KAAO;EAAA,IAAAI,EAAA;EAAA,IAAAT,CAAA,QAAAQ,eAAA,IAAAR,CAAA,QAAAC,YAAA;IAEjCQ,EAAA,GAAAA,CAAA;MAAA,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AAAmB,EAAA,GAAAd,KAAA,IAAS;EAAA,IAAAe,EAAA;EAAA,IAAApB,CAAA,SAAAG,KAAA,IAAAH,CAAA,SAAAgB,EAAA,IAAAhB,CAAA,SAAAmB,EAAA;IARpBC,EAAA,GAAAC,IAAA,CAAC;MAAAC,SAAA,EAAAzB,SAAA;MAAA0B,QAAA,EACCF,IAAA,CAAC;QAAA,cACalB,KAAA;QAAAmB,SAAA,EACD,GAAAzB,SAAA,SAAqB;QAAA2B,EAAA,EAC7B;QAAAC,QAAA,EACOT,EAA8B;QAAAU,WAAA,EAC3BvB,KAAA;QAAAwB,IAAA,EACR;QAAAtB,KAAA,EACEc;MAAS,C;;;;;;;;;SARpBC,E;CAYJ","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","useEffect","useRef","useDebounce","baseClass","SearchFilter","props","handleChange","initialParams","label","setValue","value","previousSearch","search","debouncedSearch","current","_jsx","className","id","onChange","e","target","placeholder","type"],"sources":["../../../src/elements/SearchFilter/index.tsx"],"sourcesContent":["'use client'\nimport React, { useEffect, useRef } from 'react'\n\nexport type SearchFilterProps = {\n fieldName?: string\n handleChange?: (search: string) => void\n initialParams?: ParsedQs\n label: string\n setValue?: (arg: string) => void\n value?: string\n}\n\nimport type { ParsedQs } from 'qs-esm'\n\nimport { useDebounce } from '../../hooks/useDebounce.js'\nimport './index.scss'\n\nconst baseClass = 'search-filter'\n\nexport const SearchFilter: React.FC<SearchFilterProps> = (props) => {\n const { handleChange, initialParams, label, setValue, value } = props\n\n const previousSearch = useRef(\n typeof initialParams?.search === 'string' ? initialParams?.search : '',\n )\n\n const debouncedSearch = useDebounce(value, 300)\n\n useEffect(() => {\n if (debouncedSearch !== previousSearch.current) {\n if (handleChange) handleChange(debouncedSearch)\n\n previousSearch.current = debouncedSearch\n }\n }, [debouncedSearch, previousSearch, handleChange])\n\n // Cleans up the search input when the component is unmounted\n useEffect(() => () => setValue(''), [])\n\n return (\n <div className={baseClass}>\n <input\n aria-label={label}\n className={`${baseClass}__input`}\n id=\"search-filter-input\"\n onChange={(e) => setValue(e.target.value)}\n placeholder={label}\n type=\"text\"\n value={value || ''}\n />\n </div>\n )\n}\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,IAASC,SAAS,EAAEC,MAAM,QAAQ;AAazC,SAASC,WAAW,QAAQ;AAC5B,OAAO;AAEP,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,YAAA,GAA6CC,KAAA;EACxD,MAAM;IAAEC,YAAY;IAAEC,aAAa;IAAEC,KAAK;IAAEC,QAAQ;IAAEC;EAAK,CAAE,GAAGL,KAAA;EAEhE,MAAMM,cAAA,GAAiBV,MAAA,CACrB,OAAOM,aAAA,EAAeK,MAAA,KAAW,WAAWL,aAAA,EAAeK,MAAA,GAAS;EAGtE,MAAMC,eAAA,GAAkBX,WAAA,CAAYQ,KAAA,EAAO;EAE3CV,SAAA,CAAU;IACR,IAAIa,eAAA,KAAoBF,cAAA,CAAeG,OAAO,EAAE;MAC9C,IAAIR,YAAA,EAAcA,YAAA,CAAaO,eAAA;MAE/BF,cAAA,CAAeG,OAAO,GAAGD,eAAA;IAC3B;EACF,GAAG,CAACA,eAAA,EAAiBF,cAAA,EAAgBL,YAAA,CAAa;EAElD;EACAN,SAAA,CAAU,MAAM,MAAMS,QAAA,CAAS,KAAK,EAAE;EAEtC,oBACEM,IAAA,CAAC;IAAIC,SAAA,EAAWb,SAAA;cACd,aAAAY,IAAA,CAAC;MACC,cAAYP,KAAA;MACZQ,SAAA,EAAW,GAAGb,SAAA,SAAkB;MAChCc,EAAA,EAAG;MACHC,QAAA,EAAWC,CAAA,IAAMV,QAAA,CAASU,CAAA,CAAEC,MAAM,CAACV,KAAK;MACxCW,WAAA,EAAab,KAAA;MACbc,IAAA,EAAK;MACLZ,KAAA,EAAOA,KAAA,IAAS;;;AAIxB","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { useSelection } from '../../providers/Selection/index.js';
3
+ export declare const SelectMany: React.FC<{
4
+ onClick?: (ids: ReturnType<typeof useSelection>['selected']) => void;
5
+ }>;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/SelectMany/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AAIjE,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IAChC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,UAAU,CAAC,KAAK,IAAI,CAAA;CACrE,CAuBA,CAAA"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { useSelection } from '../../providers/Selection/index.js';
4
+ // import { useTranslation } from '../../providers/Translation/index.js'
5
+ import { Pill } from '../Pill/index.js';
6
+ export const SelectMany = props => {
7
+ const {
8
+ onClick
9
+ } = props;
10
+ const {
11
+ count,
12
+ selected
13
+ } = useSelection();
14
+ // const { t } = useTranslation()
15
+ if (!selected || !count) {
16
+ return null;
17
+ }
18
+ return /*#__PURE__*/_jsx(Pill, {
19
+ // className={`${baseClass}__toggle`}
20
+ onClick: () => {
21
+ if (typeof onClick === 'function') {
22
+ onClick(selected);
23
+ }
24
+ },
25
+ pillStyle: "white",
26
+ children: `Select ${count}`
27
+ });
28
+ };
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["React","useSelection","Pill","SelectMany","props","onClick","count","selected","_jsx","pillStyle"],"sources":["../../../src/elements/SelectMany/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport { useSelection } from '../../providers/Selection/index.js'\n// import { useTranslation } from '../../providers/Translation/index.js'\nimport { Pill } from '../Pill/index.js'\n\nexport const SelectMany: React.FC<{\n onClick?: (ids: ReturnType<typeof useSelection>['selected']) => void\n}> = (props) => {\n const { onClick } = props\n\n const { count, selected } = useSelection()\n // const { t } = useTranslation()\n\n if (!selected || !count) {\n return null\n }\n\n return (\n <Pill\n // className={`${baseClass}__toggle`}\n onClick={() => {\n if (typeof onClick === 'function') {\n onClick(selected)\n }\n }}\n pillStyle=\"white\"\n >\n {`Select ${count}`}\n </Pill>\n )\n}\n"],"mappings":";AAAA,OAAOA,KAAA,MAAW;AAElB,SAASC,YAAY,QAAQ;AAC7B;AACA,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,UAAA,GAEPC,KAAA;EACJ,MAAM;IAAEC;EAAO,CAAE,GAAGD,KAAA;EAEpB,MAAM;IAAEE,KAAK;IAAEC;EAAQ,CAAE,GAAGN,YAAA;EAC5B;EAEA,IAAI,CAACM,QAAA,IAAY,CAACD,KAAA,EAAO;IACvB,OAAO;EACT;EAEA,oBACEE,IAAA,CAACN,IAAA;IACC;IACAG,OAAA,EAASA,CAAA;MACP,IAAI,OAAOA,OAAA,KAAY,YAAY;QACjCA,OAAA,CAAQE,QAAA;MACV;IACF;IACAE,SAAA,EAAU;cAET,UAAUH,KAAA;;AAGjB","ignoreList":[]}