@payloadcms/ui 3.29.0-canary.0 → 3.29.0-canary.2

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 (164) hide show
  1. package/dist/elements/BulkUpload/FormsManager/index.js +2 -2
  2. package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
  3. package/dist/elements/BulkUpload/index.d.ts.map +1 -1
  4. package/dist/elements/BulkUpload/index.js +2 -4
  5. package/dist/elements/BulkUpload/index.js.map +1 -1
  6. package/dist/elements/Collapsible/provider.d.ts.map +1 -1
  7. package/dist/elements/Collapsible/provider.js +3 -5
  8. package/dist/elements/Collapsible/provider.js.map +1 -1
  9. package/dist/elements/DocumentDrawer/Provider.d.ts.map +1 -1
  10. package/dist/elements/DocumentDrawer/Provider.js +3 -3
  11. package/dist/elements/DocumentDrawer/Provider.js.map +1 -1
  12. package/dist/elements/Drawer/index.d.ts.map +1 -1
  13. package/dist/elements/Drawer/index.js +3 -5
  14. package/dist/elements/Drawer/index.js.map +1 -1
  15. package/dist/elements/EditMany/DrawerContent.js +1 -1
  16. package/dist/elements/EditMany/DrawerContent.js.map +1 -1
  17. package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts.map +1 -1
  18. package/dist/elements/LeaveWithoutSaving/usePreventLeave.js +2 -1
  19. package/dist/elements/LeaveWithoutSaving/usePreventLeave.js.map +1 -1
  20. package/dist/elements/ListDrawer/Provider.js +3 -3
  21. package/dist/elements/ListDrawer/Provider.js.map +1 -1
  22. package/dist/elements/LoadingOverlay/index.js +3 -3
  23. package/dist/elements/LoadingOverlay/index.js.map +1 -1
  24. package/dist/elements/Nav/context.d.ts.map +1 -1
  25. package/dist/elements/Nav/context.js +2 -4
  26. package/dist/elements/Nav/context.js.map +1 -1
  27. package/dist/elements/StepNav/context.d.ts.map +1 -1
  28. package/dist/elements/StepNav/context.js +3 -5
  29. package/dist/elements/StepNav/context.js.map +1 -1
  30. package/dist/elements/Table/RelationshipProvider/index.d.ts.map +1 -1
  31. package/dist/elements/Table/RelationshipProvider/index.js +3 -5
  32. package/dist/elements/Table/RelationshipProvider/index.js.map +1 -1
  33. package/dist/elements/TableColumns/RenderDefaultCell/index.d.ts.map +1 -1
  34. package/dist/elements/TableColumns/RenderDefaultCell/index.js +2 -4
  35. package/dist/elements/TableColumns/RenderDefaultCell/index.js.map +1 -1
  36. package/dist/elements/TableColumns/context.d.ts.map +1 -1
  37. package/dist/elements/TableColumns/context.js +2 -2
  38. package/dist/elements/TableColumns/context.js.map +1 -1
  39. package/dist/elements/TableColumns/index.js +1 -1
  40. package/dist/elements/TableColumns/index.js.map +1 -1
  41. package/dist/elements/Toasts/fieldErrors.d.ts.map +1 -1
  42. package/dist/elements/Toasts/fieldErrors.js +2 -2
  43. package/dist/elements/Toasts/fieldErrors.js.map +1 -1
  44. package/dist/exports/client/{CodeEditor-TQ5ADFPC.js → CodeEditor-J4IKAVAK.js} +2 -2
  45. package/dist/exports/client/{DatePicker-HHQ6TPOW.js → DatePicker-DMHV2M2L.js} +2 -2
  46. package/dist/exports/client/{chunk-IMEQ6NKQ.js → chunk-3AA2TJQ5.js} +2 -2
  47. package/dist/exports/client/{chunk-IMEQ6NKQ.js.map → chunk-3AA2TJQ5.js.map} +3 -3
  48. package/dist/exports/client/{chunk-LMYT7O7U.js → chunk-PKQOCWZD.js} +2 -2
  49. package/dist/exports/client/{chunk-LMYT7O7U.js.map → chunk-PKQOCWZD.js.map} +3 -3
  50. package/dist/exports/client/index.js +23 -23
  51. package/dist/exports/client/index.js.map +4 -4
  52. package/dist/fields/Blocks/BlockRow.d.ts.map +1 -1
  53. package/dist/fields/Blocks/BlockRow.js +26 -20
  54. package/dist/fields/Blocks/BlockRow.js.map +1 -1
  55. package/dist/fields/Group/provider.d.ts.map +1 -1
  56. package/dist/fields/Group/provider.js +3 -5
  57. package/dist/fields/Group/provider.js.map +1 -1
  58. package/dist/fields/Row/provider.d.ts.map +1 -1
  59. package/dist/fields/Row/provider.js +3 -5
  60. package/dist/fields/Row/provider.js.map +1 -1
  61. package/dist/fields/Tabs/Tab/index.d.ts +1 -0
  62. package/dist/fields/Tabs/Tab/index.d.ts.map +1 -1
  63. package/dist/fields/Tabs/Tab/index.js +29 -25
  64. package/dist/fields/Tabs/Tab/index.js.map +1 -1
  65. package/dist/fields/Tabs/Tab/index.scss +4 -0
  66. package/dist/fields/Tabs/index.d.ts +1 -1
  67. package/dist/fields/Tabs/index.d.ts.map +1 -1
  68. package/dist/fields/Tabs/index.js +285 -194
  69. package/dist/fields/Tabs/index.js.map +1 -1
  70. package/dist/fields/Tabs/index.scss +8 -0
  71. package/dist/fields/Tabs/provider.d.ts.map +1 -1
  72. package/dist/fields/Tabs/provider.js +3 -5
  73. package/dist/fields/Tabs/provider.js.map +1 -1
  74. package/dist/forms/Form/context.d.ts.map +1 -1
  75. package/dist/forms/Form/context.js +9 -25
  76. package/dist/forms/Form/context.js.map +1 -1
  77. package/dist/forms/Form/index.d.ts.map +1 -1
  78. package/dist/forms/Form/index.js +8 -8
  79. package/dist/forms/Form/index.js.map +1 -1
  80. package/dist/forms/RowLabel/Context/index.d.ts.map +1 -1
  81. package/dist/forms/RowLabel/Context/index.js +2 -2
  82. package/dist/forms/RowLabel/Context/index.js.map +1 -1
  83. package/dist/forms/RowLabel/index.d.ts.map +1 -1
  84. package/dist/forms/RowLabel/index.js +2 -2
  85. package/dist/forms/RowLabel/index.js.map +1 -1
  86. package/dist/forms/RowLabel/types.d.ts +1 -1
  87. package/dist/forms/RowLabel/types.d.ts.map +1 -1
  88. package/dist/forms/RowLabel/types.js.map +1 -1
  89. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.d.ts.map +1 -1
  90. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js +17 -1
  91. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js.map +1 -1
  92. package/dist/hooks/useQueues.js +3 -3
  93. package/dist/hooks/useQueues.js.map +1 -1
  94. package/dist/providers/Actions/index.d.ts.map +1 -1
  95. package/dist/providers/Actions/index.js +3 -5
  96. package/dist/providers/Actions/index.js.map +1 -1
  97. package/dist/providers/Auth/index.d.ts.map +1 -1
  98. package/dist/providers/Auth/index.js +3 -5
  99. package/dist/providers/Auth/index.js.map +1 -1
  100. package/dist/providers/ClientFunction/index.d.ts.map +1 -1
  101. package/dist/providers/ClientFunction/index.js +4 -4
  102. package/dist/providers/ClientFunction/index.js.map +1 -1
  103. package/dist/providers/Config/index.d.ts.map +1 -1
  104. package/dist/providers/Config/index.js +3 -5
  105. package/dist/providers/Config/index.js.map +1 -1
  106. package/dist/providers/DocumentEvents/index.d.ts.map +1 -1
  107. package/dist/providers/DocumentEvents/index.js +3 -5
  108. package/dist/providers/DocumentEvents/index.js.map +1 -1
  109. package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
  110. package/dist/providers/DocumentInfo/index.js +3 -5
  111. package/dist/providers/DocumentInfo/index.js.map +1 -1
  112. package/dist/providers/EditDepth/index.d.ts.map +1 -1
  113. package/dist/providers/EditDepth/index.js +3 -5
  114. package/dist/providers/EditDepth/index.js.map +1 -1
  115. package/dist/providers/EntityVisibility/index.d.ts.map +1 -1
  116. package/dist/providers/EntityVisibility/index.js +3 -5
  117. package/dist/providers/EntityVisibility/index.js.map +1 -1
  118. package/dist/providers/ListQuery/context.d.ts.map +1 -1
  119. package/dist/providers/ListQuery/context.js +2 -2
  120. package/dist/providers/ListQuery/context.js.map +1 -1
  121. package/dist/providers/ListQuery/index.js +1 -1
  122. package/dist/providers/ListQuery/index.js.map +1 -1
  123. package/dist/providers/Locale/index.d.ts.map +1 -1
  124. package/dist/providers/Locale/index.js +5 -9
  125. package/dist/providers/Locale/index.js.map +1 -1
  126. package/dist/providers/Operation/index.d.ts.map +1 -1
  127. package/dist/providers/Operation/index.js +3 -5
  128. package/dist/providers/Operation/index.js.map +1 -1
  129. package/dist/providers/Params/index.d.ts.map +1 -1
  130. package/dist/providers/Params/index.js +3 -5
  131. package/dist/providers/Params/index.js.map +1 -1
  132. package/dist/providers/Preferences/index.d.ts.map +1 -1
  133. package/dist/providers/Preferences/index.js +3 -5
  134. package/dist/providers/Preferences/index.js.map +1 -1
  135. package/dist/providers/RouteCache/index.d.ts.map +1 -1
  136. package/dist/providers/RouteCache/index.js +3 -5
  137. package/dist/providers/RouteCache/index.js.map +1 -1
  138. package/dist/providers/RouteTransition/index.d.ts.map +1 -1
  139. package/dist/providers/RouteTransition/index.js +2 -4
  140. package/dist/providers/RouteTransition/index.js.map +1 -1
  141. package/dist/providers/SearchParams/index.d.ts.map +1 -1
  142. package/dist/providers/SearchParams/index.js +3 -5
  143. package/dist/providers/SearchParams/index.js.map +1 -1
  144. package/dist/providers/Selection/index.d.ts.map +1 -1
  145. package/dist/providers/Selection/index.js +3 -5
  146. package/dist/providers/Selection/index.js.map +1 -1
  147. package/dist/providers/ServerFunctions/index.js +2 -2
  148. package/dist/providers/ServerFunctions/index.js.map +1 -1
  149. package/dist/providers/Theme/index.d.ts.map +1 -1
  150. package/dist/providers/Theme/index.js +3 -5
  151. package/dist/providers/Theme/index.js.map +1 -1
  152. package/dist/providers/Translation/index.d.ts.map +1 -1
  153. package/dist/providers/Translation/index.js +3 -5
  154. package/dist/providers/Translation/index.js.map +1 -1
  155. package/dist/providers/UploadEdits/index.d.ts.map +1 -1
  156. package/dist/providers/UploadEdits/index.js +2 -4
  157. package/dist/providers/UploadEdits/index.js.map +1 -1
  158. package/dist/providers/UploadHandlers/index.d.ts.map +1 -1
  159. package/dist/providers/UploadHandlers/index.js +3 -3
  160. package/dist/providers/UploadHandlers/index.js.map +1 -1
  161. package/dist/styles.css +1 -1
  162. package/package.json +4 -4
  163. /package/dist/exports/client/{CodeEditor-TQ5ADFPC.js.map → CodeEditor-J4IKAVAK.js.map} +0 -0
  164. /package/dist/exports/client/{DatePicker-HHQ6TPOW.js.map → DatePicker-DMHV2M2L.js.map} +0 -0
@@ -7,6 +7,7 @@ import { tabHasName, toKebabCase } from 'payload/shared';
7
7
  import React, { useCallback, useEffect, useState } from 'react';
8
8
  import { useCollapsible } from '../../elements/Collapsible/provider.js';
9
9
  import { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js';
10
+ import { useFormFields } from '../../forms/Form/index.js';
10
11
  import { RenderFields } from '../../forms/RenderFields/index.js';
11
12
  import { useField } from '../../forms/useField/index.js';
12
13
  import { withCondition } from '../../forms/withCondition/index.js';
@@ -15,9 +16,9 @@ import { usePreferences } from '../../providers/Preferences/index.js';
15
16
  import { useTranslation } from '../../providers/Translation/index.js';
16
17
  import { FieldDescription } from '../FieldDescription/index.js';
17
18
  import { fieldBaseClass } from '../shared/index.js';
18
- import './index.scss';
19
19
  import { TabsProvider } from './provider.js';
20
20
  import { TabComponent } from './Tab/index.js';
21
+ import './index.scss';
21
22
  const baseClass = 'tabs-field';
22
23
  export { TabsProvider };
23
24
  function generateTabPath({
@@ -35,7 +36,7 @@ function generateTabPath({
35
36
  return tabPath;
36
37
  }
37
38
  const TabsFieldComponent = props => {
38
- const $ = _c(75);
39
+ const $ = _c(89);
39
40
  const {
40
41
  field: t0,
41
42
  forceRender: t1,
@@ -88,99 +89,105 @@ const TabsFieldComponent = props => {
88
89
  const {
89
90
  isWithinCollapsible
90
91
  } = useCollapsible();
91
- const [activeTabIndex, setActiveTabIndex] = useState(0);
92
- const tabsPrefKey = `tabs-${indexPath}`;
93
92
  let t10;
94
- if ($[4] !== activeTabIndex || $[5] !== parentPath || $[6] !== tabs) {
95
- t10 = () => generateTabPath({
96
- activeTabConfig: tabs[activeTabIndex],
97
- path: parentPath
98
- });
99
- $[4] = activeTabIndex;
100
- $[5] = parentPath;
101
- $[6] = tabs;
102
- $[7] = t10;
93
+ if ($[4] !== tabs) {
94
+ t10 = t11 => {
95
+ const [fields] = t11;
96
+ return tabs.map((tab, index) => {
97
+ const id = tab?.id;
98
+ return {
99
+ index,
100
+ passesCondition: fields?.[id]?.passesCondition ?? true,
101
+ tab
102
+ };
103
+ });
104
+ };
105
+ $[4] = tabs;
106
+ $[5] = t10;
103
107
  } else {
104
- t10 = $[7];
108
+ t10 = $[5];
105
109
  }
106
- const [activeTabPath, setActiveTabPath] = useState(t10);
110
+ const tabStates = useFormFields(t10);
107
111
  let t11;
108
- if ($[8] !== activeTabIndex || $[9] !== activeTabPath || $[10] !== parentPath || $[11] !== tabs) {
109
- t11 = tabHasName(tabs[activeTabIndex]) ? activeTabPath : parentPath;
110
- $[8] = activeTabIndex;
111
- $[9] = activeTabPath;
112
- $[10] = parentPath;
113
- $[11] = tabs;
114
- $[12] = t11;
112
+ if ($[6] !== tabStates) {
113
+ t11 = () => tabStates.filter(_temp)?.[0]?.index ?? 0;
114
+ $[6] = tabStates;
115
+ $[7] = t11;
115
116
  } else {
116
- t11 = $[12];
117
+ t11 = $[7];
117
118
  }
118
- const activePathChildrenPath = t11;
119
+ const [activeTabIndex, setActiveTabIndex] = useState(t11);
120
+ const tabsPrefKey = `tabs-${indexPath}`;
119
121
  let t12;
120
- if ($[13] !== parentSchemaPath || $[14] !== tabs) {
122
+ if ($[8] !== activeTabIndex || $[9] !== parentPath || $[10] !== tabs) {
121
123
  t12 = () => generateTabPath({
122
- activeTabConfig: tabs[0],
123
- path: parentSchemaPath
124
+ activeTabConfig: tabs[activeTabIndex],
125
+ path: parentPath
124
126
  });
125
- $[13] = parentSchemaPath;
126
- $[14] = tabs;
127
- $[15] = t12;
127
+ $[8] = activeTabIndex;
128
+ $[9] = parentPath;
129
+ $[10] = tabs;
130
+ $[11] = t12;
128
131
  } else {
129
- t12 = $[15];
132
+ t12 = $[11];
130
133
  }
131
- const [activeTabSchemaPath, setActiveTabSchemaPath] = useState(t12);
134
+ const [activeTabPath, setActiveTabPath] = useState(t12);
132
135
  let t13;
133
- if ($[16] !== activeTabIndex || $[17] !== activeTabSchemaPath || $[18] !== parentSchemaPath || $[19] !== tabs) {
134
- t13 = tabHasName(tabs[activeTabIndex]) ? activeTabSchemaPath : parentSchemaPath;
135
- $[16] = activeTabIndex;
136
- $[17] = activeTabSchemaPath;
137
- $[18] = parentSchemaPath;
138
- $[19] = tabs;
139
- $[20] = t13;
136
+ if ($[12] !== parentSchemaPath || $[13] !== tabs) {
137
+ t13 = () => generateTabPath({
138
+ activeTabConfig: tabs[0],
139
+ path: parentSchemaPath
140
+ });
141
+ $[12] = parentSchemaPath;
142
+ $[13] = tabs;
143
+ $[14] = t13;
140
144
  } else {
141
- t13 = $[20];
145
+ t13 = $[14];
142
146
  }
143
- const activePathSchemaChildrenPath = t13;
147
+ const [activeTabSchemaPath, setActiveTabSchemaPath] = useState(t13);
144
148
  let t14;
149
+ if ($[15] !== activeTabIndex || $[16] !== activeTabPath || $[17] !== parentPath || $[18] !== tabs) {
150
+ t14 = tabHasName(tabs[activeTabIndex]) ? activeTabPath : parentPath;
151
+ $[15] = activeTabIndex;
152
+ $[16] = activeTabPath;
153
+ $[17] = parentPath;
154
+ $[18] = tabs;
155
+ $[19] = t14;
156
+ } else {
157
+ t14 = $[19];
158
+ }
159
+ const activePathChildrenPath = t14;
160
+ const activeTabInfo = tabStates[activeTabIndex];
161
+ const activeTabConfig = activeTabInfo?.tab;
145
162
  let t15;
146
- if ($[21] !== getPreference || $[22] !== parentPath || $[23] !== parentSchemaPath || $[24] !== path || $[25] !== preferencesKey || $[26] !== tabs || $[27] !== tabsPrefKey) {
147
- t14 = () => {
148
- if (preferencesKey) {
149
- const getInitialPref = async () => {
150
- const existingPreferences = await getPreference(preferencesKey);
151
- const initialIndex = path ? existingPreferences?.fields?.[path]?.tabIndex : existingPreferences?.fields?.[tabsPrefKey]?.tabIndex;
152
- const newIndex = initialIndex || 0;
153
- setActiveTabIndex(newIndex);
154
- setActiveTabPath(generateTabPath({
155
- activeTabConfig: tabs[newIndex],
156
- path: parentPath
157
- }));
158
- setActiveTabSchemaPath(generateTabPath({
159
- activeTabConfig: tabs[newIndex],
160
- path: parentSchemaPath
161
- }));
162
- };
163
- getInitialPref();
164
- }
165
- };
166
- t15 = [path, getPreference, preferencesKey, tabsPrefKey, tabs, parentPath, parentSchemaPath];
167
- $[21] = getPreference;
168
- $[22] = parentPath;
169
- $[23] = parentSchemaPath;
170
- $[24] = path;
171
- $[25] = preferencesKey;
172
- $[26] = tabs;
173
- $[27] = tabsPrefKey;
174
- $[28] = t14;
175
- $[29] = t15;
163
+ if ($[20] !== activeTabIndex || $[21] !== activeTabSchemaPath || $[22] !== parentSchemaPath || $[23] !== tabs) {
164
+ t15 = tabHasName(tabs[activeTabIndex]) ? activeTabSchemaPath : parentSchemaPath;
165
+ $[20] = activeTabIndex;
166
+ $[21] = activeTabSchemaPath;
167
+ $[22] = parentSchemaPath;
168
+ $[23] = tabs;
169
+ $[24] = t15;
176
170
  } else {
177
- t14 = $[28];
178
- t15 = $[29];
171
+ t15 = $[24];
179
172
  }
180
- useEffect(t14, t15);
173
+ const activePathSchemaChildrenPath = t15;
174
+ const activeTabDescription = activeTabConfig.admin?.description ?? activeTabConfig.description;
181
175
  let t16;
182
- if ($[30] !== getPreference || $[31] !== parentPath || $[32] !== parentSchemaPath || $[33] !== path || $[34] !== preferencesKey || $[35] !== setPreference || $[36] !== tabs || $[37] !== tabsPrefKey) {
183
- t16 = async incomingTabIndex => {
176
+ if ($[25] !== activeTabDescription || $[26] !== i18n) {
177
+ t16 = typeof activeTabDescription === "function" ? activeTabDescription({
178
+ t: i18n.t
179
+ }) : activeTabDescription;
180
+ $[25] = activeTabDescription;
181
+ $[26] = i18n;
182
+ $[27] = t16;
183
+ } else {
184
+ t16 = $[27];
185
+ }
186
+ const activeTabStaticDescription = t16;
187
+ const hasVisibleTabs = tabStates.some(_temp2);
188
+ let t17;
189
+ if ($[28] !== getPreference || $[29] !== parentPath || $[30] !== parentSchemaPath || $[31] !== path || $[32] !== preferencesKey || $[33] !== setPreference || $[34] !== tabs || $[35] !== tabsPrefKey) {
190
+ t17 = async incomingTabIndex => {
184
191
  setActiveTabIndex(incomingTabIndex);
185
192
  setActiveTabPath(generateTabPath({
186
193
  activeTabConfig: tabs[incomingTabIndex],
@@ -190,23 +197,23 @@ const TabsFieldComponent = props => {
190
197
  activeTabConfig: tabs[incomingTabIndex],
191
198
  path: parentSchemaPath
192
199
  }));
193
- const existingPreferences_0 = await getPreference(preferencesKey);
200
+ const existingPreferences = await getPreference(preferencesKey);
194
201
  if (preferencesKey) {
195
202
  setPreference(preferencesKey, {
196
- ...existingPreferences_0,
203
+ ...existingPreferences,
197
204
  ...(path ? {
198
205
  fields: {
199
- ...(existingPreferences_0?.fields || {}),
206
+ ...(existingPreferences?.fields || {}),
200
207
  [path]: {
201
- ...existingPreferences_0?.fields?.[path],
208
+ ...existingPreferences?.fields?.[path],
202
209
  tabIndex: incomingTabIndex
203
210
  }
204
211
  }
205
212
  } : {
206
213
  fields: {
207
- ...existingPreferences_0?.fields,
214
+ ...existingPreferences?.fields,
208
215
  [tabsPrefKey]: {
209
- ...existingPreferences_0?.fields?.[tabsPrefKey],
216
+ ...existingPreferences?.fields?.[tabsPrefKey],
210
217
  tabIndex: incomingTabIndex
211
218
  }
212
219
  }
@@ -214,132 +221,196 @@ const TabsFieldComponent = props => {
214
221
  });
215
222
  }
216
223
  };
217
- $[30] = getPreference;
218
- $[31] = parentPath;
219
- $[32] = parentSchemaPath;
220
- $[33] = path;
221
- $[34] = preferencesKey;
222
- $[35] = setPreference;
223
- $[36] = tabs;
224
- $[37] = tabsPrefKey;
225
- $[38] = t16;
224
+ $[28] = getPreference;
225
+ $[29] = parentPath;
226
+ $[30] = parentSchemaPath;
227
+ $[31] = path;
228
+ $[32] = preferencesKey;
229
+ $[33] = setPreference;
230
+ $[34] = tabs;
231
+ $[35] = tabsPrefKey;
232
+ $[36] = t17;
226
233
  } else {
227
- t16 = $[38];
234
+ t17 = $[36];
228
235
  }
229
- const handleTabChange = t16;
230
- const activeTabConfig = tabs[activeTabIndex];
231
- const activeTabDescription = activeTabConfig.admin?.description ?? activeTabConfig.description;
232
- let t17;
233
- if ($[39] !== activeTabDescription || $[40] !== i18n) {
234
- t17 = typeof activeTabDescription === "function" ? activeTabDescription({
235
- t: i18n.t
236
- }) : activeTabDescription;
237
- $[39] = activeTabDescription;
238
- $[40] = i18n;
239
- $[41] = t17;
236
+ const handleTabChange = t17;
237
+ let t18;
238
+ let t19;
239
+ if ($[37] !== getPreference || $[38] !== parentPath || $[39] !== parentSchemaPath || $[40] !== path || $[41] !== preferencesKey || $[42] !== tabs || $[43] !== tabsPrefKey) {
240
+ t18 = () => {
241
+ if (preferencesKey) {
242
+ const getInitialPref = async () => {
243
+ const existingPreferences_0 = await getPreference(preferencesKey);
244
+ const initialIndex = path ? existingPreferences_0?.fields?.[path]?.tabIndex : existingPreferences_0?.fields?.[tabsPrefKey]?.tabIndex;
245
+ const newIndex = initialIndex || 0;
246
+ setActiveTabIndex(newIndex);
247
+ setActiveTabPath(generateTabPath({
248
+ activeTabConfig: tabs[newIndex],
249
+ path: parentPath
250
+ }));
251
+ setActiveTabSchemaPath(generateTabPath({
252
+ activeTabConfig: tabs[newIndex],
253
+ path: parentSchemaPath
254
+ }));
255
+ };
256
+ getInitialPref();
257
+ }
258
+ };
259
+ t19 = [path, getPreference, preferencesKey, tabsPrefKey, tabs, parentPath, parentSchemaPath];
260
+ $[37] = getPreference;
261
+ $[38] = parentPath;
262
+ $[39] = parentSchemaPath;
263
+ $[40] = path;
264
+ $[41] = preferencesKey;
265
+ $[42] = tabs;
266
+ $[43] = tabsPrefKey;
267
+ $[44] = t18;
268
+ $[45] = t19;
240
269
  } else {
241
- t17 = $[41];
270
+ t18 = $[44];
271
+ t19 = $[45];
242
272
  }
243
- const activeTabStaticDescription = t17;
244
- const t18 = isWithinCollapsible && `${baseClass}--within-collapsible`;
245
- let t19;
246
- if ($[42] !== className || $[43] !== t18) {
247
- t19 = [fieldBaseClass, className, baseClass, t18].filter(Boolean);
248
- $[42] = className;
249
- $[43] = t18;
250
- $[44] = t19;
273
+ useEffect(t18, t19);
274
+ let t20;
275
+ if ($[46] !== activeTabInfo?.passesCondition || $[47] !== handleTabChange || $[48] !== tabStates) {
276
+ t20 = () => {
277
+ if (activeTabInfo?.passesCondition === false) {
278
+ const nextTab = tabStates.find(_temp3);
279
+ if (nextTab) {
280
+ handleTabChange(nextTab.index);
281
+ }
282
+ }
283
+ };
284
+ $[46] = activeTabInfo?.passesCondition;
285
+ $[47] = handleTabChange;
286
+ $[48] = tabStates;
287
+ $[49] = t20;
251
288
  } else {
252
- t19 = $[44];
289
+ t20 = $[49];
253
290
  }
254
- const t20 = t19.join(" ");
255
291
  let t21;
256
- if ($[45] !== activePathChildrenPath || $[46] !== activePathSchemaChildrenPath || $[47] !== activeTabConfig || $[48] !== activeTabIndex || $[49] !== activeTabPath || $[50] !== activeTabStaticDescription || $[51] !== forceRender || $[52] !== handleTabChange || $[53] !== indexPath || $[54] !== path || $[55] !== permissions || $[56] !== readOnly || $[57] !== t20 || $[58] !== tabs) {
257
- let t22;
258
- if ($[60] !== activeTabIndex || $[61] !== handleTabChange || $[62] !== path) {
259
- t22 = (tab, tabIndex) => _jsx(TabComponent, {
260
- isActive: activeTabIndex === tabIndex,
261
- parentPath: path,
262
- setIsActive: () => {
263
- handleTabChange(tabIndex);
264
- },
265
- tab
266
- }, tabIndex);
267
- $[60] = activeTabIndex;
268
- $[61] = handleTabChange;
269
- $[62] = path;
270
- $[63] = t22;
292
+ if ($[50] !== activeTabInfo || $[51] !== handleTabChange || $[52] !== tabStates) {
293
+ t21 = [activeTabInfo, tabStates, handleTabChange];
294
+ $[50] = activeTabInfo;
295
+ $[51] = handleTabChange;
296
+ $[52] = tabStates;
297
+ $[53] = t21;
298
+ } else {
299
+ t21 = $[53];
300
+ }
301
+ useEffect(t20, t21);
302
+ const t22 = isWithinCollapsible && `${baseClass}--within-collapsible`;
303
+ const t23 = !hasVisibleTabs && `${baseClass}--hidden`;
304
+ let t24;
305
+ if ($[54] !== className || $[55] !== t22 || $[56] !== t23) {
306
+ t24 = [fieldBaseClass, className, baseClass, t22, t23].filter(Boolean);
307
+ $[54] = className;
308
+ $[55] = t22;
309
+ $[56] = t23;
310
+ $[57] = t24;
311
+ } else {
312
+ t24 = $[57];
313
+ }
314
+ const t25 = t24.join(" ");
315
+ let t26;
316
+ if ($[58] !== activePathChildrenPath || $[59] !== activePathSchemaChildrenPath || $[60] !== activeTabConfig || $[61] !== activeTabIndex || $[62] !== activeTabInfo || $[63] !== activeTabPath || $[64] !== activeTabStaticDescription || $[65] !== forceRender || $[66] !== handleTabChange || $[67] !== indexPath || $[68] !== path || $[69] !== permissions || $[70] !== readOnly || $[71] !== t25 || $[72] !== tabStates) {
317
+ let t27;
318
+ if ($[74] !== activeTabIndex || $[75] !== handleTabChange || $[76] !== path) {
319
+ t27 = t28 => {
320
+ const {
321
+ index: index_0,
322
+ passesCondition: passesCondition_2,
323
+ tab: tab_0
324
+ } = t28;
325
+ return _jsx(TabComponent, {
326
+ hidden: !passesCondition_2,
327
+ isActive: activeTabIndex === index_0,
328
+ parentPath: path,
329
+ setIsActive: () => {
330
+ handleTabChange(index_0);
331
+ },
332
+ tab: tab_0
333
+ }, index_0);
334
+ };
335
+ $[74] = activeTabIndex;
336
+ $[75] = handleTabChange;
337
+ $[76] = path;
338
+ $[77] = t27;
271
339
  } else {
272
- t22 = $[63];
340
+ t27 = $[77];
273
341
  }
274
- let t23;
275
- if ($[64] !== activePathChildrenPath || $[65] !== activePathSchemaChildrenPath || $[66] !== activeTabConfig || $[67] !== activeTabIndex || $[68] !== activeTabPath || $[69] !== activeTabStaticDescription || $[70] !== forceRender || $[71] !== indexPath || $[72] !== permissions || $[73] !== readOnly) {
276
- t23 = activeTabConfig && _jsx(ActiveTabContent, {
342
+ let t28;
343
+ if ($[78] !== activePathChildrenPath || $[79] !== activePathSchemaChildrenPath || $[80] !== activeTabConfig || $[81] !== activeTabInfo || $[82] !== activeTabPath || $[83] !== activeTabStaticDescription || $[84] !== forceRender || $[85] !== indexPath || $[86] !== permissions || $[87] !== readOnly) {
344
+ t28 = activeTabConfig && _jsx(TabContent, {
277
345
  description: activeTabStaticDescription,
278
346
  fields: activeTabConfig.fields,
279
347
  forceRender,
280
- parentIndexPath: tabHasName(activeTabConfig) ? "" : `${indexPath ? indexPath + "-" : ""}` + String(activeTabIndex),
348
+ hidden: false,
349
+ parentIndexPath: tabHasName(activeTabConfig) ? "" : `${indexPath ? indexPath + "-" : ""}` + String(activeTabInfo.index),
281
350
  parentPath: activePathChildrenPath,
282
351
  parentSchemaPath: activePathSchemaChildrenPath,
283
352
  path: activeTabPath,
284
353
  permissions: permissions && typeof permissions === "object" && "name" in activeTabConfig ? permissions[activeTabConfig.name] && typeof permissions[activeTabConfig.name] === "object" && "fields" in permissions[activeTabConfig.name] ? permissions[activeTabConfig.name].fields : permissions[activeTabConfig.name] : permissions,
285
354
  readOnly
286
355
  });
287
- $[64] = activePathChildrenPath;
288
- $[65] = activePathSchemaChildrenPath;
289
- $[66] = activeTabConfig;
290
- $[67] = activeTabIndex;
291
- $[68] = activeTabPath;
292
- $[69] = activeTabStaticDescription;
293
- $[70] = forceRender;
294
- $[71] = indexPath;
295
- $[72] = permissions;
296
- $[73] = readOnly;
297
- $[74] = t23;
356
+ $[78] = activePathChildrenPath;
357
+ $[79] = activePathSchemaChildrenPath;
358
+ $[80] = activeTabConfig;
359
+ $[81] = activeTabInfo;
360
+ $[82] = activeTabPath;
361
+ $[83] = activeTabStaticDescription;
362
+ $[84] = forceRender;
363
+ $[85] = indexPath;
364
+ $[86] = permissions;
365
+ $[87] = readOnly;
366
+ $[88] = t28;
298
367
  } else {
299
- t23 = $[74];
368
+ t28 = $[88];
300
369
  }
301
- t21 = _jsx("div", {
302
- className: t20,
370
+ t26 = _jsx("div", {
371
+ className: t25,
303
372
  children: _jsxs(TabsProvider, {
304
373
  children: [_jsx("div", {
305
374
  className: `${baseClass}__tabs-wrap`,
306
375
  children: _jsx("div", {
307
376
  className: `${baseClass}__tabs`,
308
- children: tabs.map(t22)
377
+ children: tabStates.map(t27)
309
378
  })
310
379
  }), _jsx("div", {
311
380
  className: `${baseClass}__content-wrap`,
312
- children: t23
381
+ children: t28
313
382
  })]
314
383
  })
315
384
  });
316
- $[45] = activePathChildrenPath;
317
- $[46] = activePathSchemaChildrenPath;
318
- $[47] = activeTabConfig;
319
- $[48] = activeTabIndex;
320
- $[49] = activeTabPath;
321
- $[50] = activeTabStaticDescription;
322
- $[51] = forceRender;
323
- $[52] = handleTabChange;
324
- $[53] = indexPath;
325
- $[54] = path;
326
- $[55] = permissions;
327
- $[56] = readOnly;
328
- $[57] = t20;
329
- $[58] = tabs;
330
- $[59] = t21;
385
+ $[58] = activePathChildrenPath;
386
+ $[59] = activePathSchemaChildrenPath;
387
+ $[60] = activeTabConfig;
388
+ $[61] = activeTabIndex;
389
+ $[62] = activeTabInfo;
390
+ $[63] = activeTabPath;
391
+ $[64] = activeTabStaticDescription;
392
+ $[65] = forceRender;
393
+ $[66] = handleTabChange;
394
+ $[67] = indexPath;
395
+ $[68] = path;
396
+ $[69] = permissions;
397
+ $[70] = readOnly;
398
+ $[71] = t25;
399
+ $[72] = tabStates;
400
+ $[73] = t26;
331
401
  } else {
332
- t21 = $[59];
402
+ t26 = $[73];
333
403
  }
334
- return t21;
404
+ return t26;
335
405
  };
336
406
  export const TabsField = withCondition(TabsFieldComponent);
337
- function ActiveTabContent(t0) {
338
- const $ = _c(20);
407
+ function TabContent(t0) {
408
+ const $ = _c(21);
339
409
  const {
340
410
  description,
341
411
  fields,
342
412
  forceRender,
413
+ hidden,
343
414
  label,
344
415
  parentIndexPath,
345
416
  parentPath,
@@ -381,20 +452,22 @@ function ActiveTabContent(t0) {
381
452
  if (Field) {
382
453
  return Field;
383
454
  }
384
- const t4 = label && `${baseClass}__tabConfigLabel-${toKebabCase(getTranslation(label, i18n))}`;
385
- let t5;
386
- if ($[4] !== t4) {
387
- t5 = [`${baseClass}__tab`, t4].filter(Boolean);
455
+ const t4 = hidden && `${baseClass}__tab--hidden`;
456
+ const t5 = label && `${baseClass}__tabConfigLabel-${toKebabCase(getTranslation(label, i18n))}`;
457
+ let t6;
458
+ if ($[4] !== t4 || $[5] !== t5) {
459
+ t6 = [t4, `${baseClass}__tab`, t5].filter(Boolean);
388
460
  $[4] = t4;
389
461
  $[5] = t5;
462
+ $[6] = t6;
390
463
  } else {
391
- t5 = $[5];
464
+ t6 = $[6];
392
465
  }
393
- const t6 = t5.join(" ");
394
- let t7;
395
- if ($[6] !== AfterInput || $[7] !== BeforeInput || $[8] !== Description || $[9] !== description || $[10] !== fields || $[11] !== forceRender || $[12] !== parentIndexPath || $[13] !== parentPath || $[14] !== parentSchemaPath || $[15] !== path || $[16] !== permissions || $[17] !== readOnly || $[18] !== t6) {
396
- t7 = _jsxs("div", {
397
- className: t6,
466
+ const t7 = t6.join(" ");
467
+ let t8;
468
+ if ($[7] !== AfterInput || $[8] !== BeforeInput || $[9] !== Description || $[10] !== description || $[11] !== fields || $[12] !== forceRender || $[13] !== parentIndexPath || $[14] !== parentPath || $[15] !== parentSchemaPath || $[16] !== path || $[17] !== permissions || $[18] !== readOnly || $[19] !== t7) {
469
+ t8 = _jsxs("div", {
470
+ className: t7,
398
471
  children: [_jsx(RenderCustomComponent, {
399
472
  CustomComponent: Description,
400
473
  Fallback: _jsx(FieldDescription, {
@@ -412,23 +485,41 @@ function ActiveTabContent(t0) {
412
485
  readOnly
413
486
  }), AfterInput]
414
487
  });
415
- $[6] = AfterInput;
416
- $[7] = BeforeInput;
417
- $[8] = Description;
418
- $[9] = description;
419
- $[10] = fields;
420
- $[11] = forceRender;
421
- $[12] = parentIndexPath;
422
- $[13] = parentPath;
423
- $[14] = parentSchemaPath;
424
- $[15] = path;
425
- $[16] = permissions;
426
- $[17] = readOnly;
427
- $[18] = t6;
488
+ $[7] = AfterInput;
489
+ $[8] = BeforeInput;
490
+ $[9] = Description;
491
+ $[10] = description;
492
+ $[11] = fields;
493
+ $[12] = forceRender;
494
+ $[13] = parentIndexPath;
495
+ $[14] = parentPath;
496
+ $[15] = parentSchemaPath;
497
+ $[16] = path;
498
+ $[17] = permissions;
499
+ $[18] = readOnly;
428
500
  $[19] = t7;
501
+ $[20] = t8;
429
502
  } else {
430
- t7 = $[19];
503
+ t8 = $[20];
431
504
  }
432
- return t7;
505
+ return t8;
506
+ }
507
+ function _temp(t0) {
508
+ const {
509
+ passesCondition
510
+ } = t0;
511
+ return passesCondition;
512
+ }
513
+ function _temp2(t0) {
514
+ const {
515
+ passesCondition: passesCondition_0
516
+ } = t0;
517
+ return passesCondition_0;
518
+ }
519
+ function _temp3(t0) {
520
+ const {
521
+ passesCondition: passesCondition_1
522
+ } = t0;
523
+ return passesCondition_1;
433
524
  }
434
525
  //# sourceMappingURL=index.js.map