@headless-adminapp/app 0.0.17-alpha.54 → 0.0.17-alpha.56

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 (219) hide show
  1. package/app/AppProvider.js +24 -32
  2. package/app/AuthWrapper.js +13 -9
  3. package/app/LayoutProvider.js +34 -39
  4. package/app/context.js +5 -2
  5. package/app/hooks/index.js +17 -1
  6. package/app/hooks/useAppContext.js +7 -4
  7. package/app/index.js +11 -4
  8. package/auth/AuthProvider.js +27 -36
  9. package/auth/context.d.ts +1 -1
  10. package/auth/context.js +5 -2
  11. package/auth/hooks/index.js +18 -2
  12. package/auth/hooks/useAuthSession.js +7 -4
  13. package/auth/hooks/useIsSkipAuthCheck.js +7 -4
  14. package/auth/hooks/useLogout.js +11 -8
  15. package/auth/index.js +23 -4
  16. package/auth/types.js +2 -1
  17. package/board/BoardColumnDataResolver.js +23 -20
  18. package/board/BoardColumnProvider.js +14 -10
  19. package/board/context.d.ts +2 -2
  20. package/board/context.js +6 -3
  21. package/board/hooks/index.js +15 -6
  22. package/board/hooks/useBoardColumnConfig.js +7 -4
  23. package/board/hooks/useBoardColumnData.d.ts +3 -1
  24. package/board/hooks/useBoardColumnData.js +7 -4
  25. package/board/hooks/useBoardColumnDataState.js +7 -4
  26. package/board/hooks/useBoardConfig.js +7 -4
  27. package/board/hooks/useBoardSchema.js +6 -3
  28. package/board/hooks/useSearchText.js +10 -7
  29. package/board/types.js +2 -1
  30. package/board/utils.js +4 -1
  31. package/builders/CommandBuilder/CommandBuilder.js +13 -10
  32. package/builders/CommandBuilder/DefaultCommandBuilder.js +30 -23
  33. package/builders/CommandBuilder/FormCommandBuilder.js +29 -38
  34. package/builders/CommandBuilder/SubgridCommandBuilder.js +27 -36
  35. package/builders/CommandBuilder/ViewCommandBuilder.js +29 -38
  36. package/builders/CommandBuilder/index.js +5 -1
  37. package/builders/CommandBuilder/utils.js +7 -3
  38. package/builders/SchemaExperienceBuilder.js +55 -31
  39. package/builders/index.js +7 -2
  40. package/builders/utils.js +59 -44
  41. package/command/hooks/index.js +18 -2
  42. package/command/hooks/useBaseCommandHandlerContext.js +29 -25
  43. package/command/hooks/useCommands.js +9 -6
  44. package/command/index.js +18 -2
  45. package/command/types.js +2 -1
  46. package/command/utils/index.js +41 -13
  47. package/components/ScrollView/index.js +11 -4
  48. package/components/ScrollbarWithMoreDataRequest/index.js +14 -11
  49. package/dataform/DataFormProvider/DataResolver.js +81 -89
  50. package/dataform/DataFormProvider/InitialValueResolver.js +22 -20
  51. package/dataform/DataFormProvider/ReadonlyInfoResolver.js +14 -12
  52. package/dataform/DataFormProvider/index.js +26 -32
  53. package/dataform/context.js +5 -2
  54. package/dataform/hooks/index.js +29 -13
  55. package/dataform/hooks/useFormInstance.js +6 -3
  56. package/dataform/hooks/useFormIsDirty.js +6 -3
  57. package/dataform/hooks/useFormIsReadonly.js +7 -4
  58. package/dataform/hooks/useFormNotifications.js +12 -9
  59. package/dataform/hooks/useFormRecord.js +7 -4
  60. package/dataform/hooks/useFormSave.js +40 -46
  61. package/dataform/hooks/useFormSchema.js +7 -4
  62. package/dataform/hooks/useLoadFormGridPage.js +19 -25
  63. package/dataform/hooks/useMainFormCommands.js +37 -30
  64. package/dataform/hooks/useProcessFlowSteps.js +27 -23
  65. package/dataform/hooks/useRecordId.js +7 -4
  66. package/dataform/hooks/useRecordTitle.js +12 -9
  67. package/dataform/hooks/useSelectedForm.js +7 -4
  68. package/dataform/index.js +23 -4
  69. package/dataform/utils/defaultParameters.js +16 -6
  70. package/dataform/utils/index.js +90 -56
  71. package/dataform/utils/saveRecord.js +99 -104
  72. package/datagrid/DataGridProvider/DataResolver.js +36 -34
  73. package/datagrid/DataGridProvider/index.js +31 -32
  74. package/datagrid/DataGridProvider/transformViewColumns.js +17 -6
  75. package/datagrid/DataGridProvider/utils.js +13 -5
  76. package/datagrid/column-filter/constants.js +5 -2
  77. package/datagrid/column-filter/index.js +7 -2
  78. package/datagrid/column-filter/types.js +2 -1
  79. package/datagrid/column-filter/utils.js +13 -3
  80. package/datagrid/context.d.ts +1 -1
  81. package/datagrid/context.js +5 -2
  82. package/datagrid/hooks/index.js +36 -20
  83. package/datagrid/hooks/useChangeView.js +10 -7
  84. package/datagrid/hooks/useGridColumnFilter.js +14 -8
  85. package/datagrid/hooks/useGridColumns.js +7 -4
  86. package/datagrid/hooks/useGridCommands.js +7 -4
  87. package/datagrid/hooks/useGridData.js +7 -4
  88. package/datagrid/hooks/useGridDataState.js +7 -4
  89. package/datagrid/hooks/useGridExtraFilter.js +7 -4
  90. package/datagrid/hooks/useGridOptions.js +4 -1
  91. package/datagrid/hooks/useGridPagination.js +4 -1
  92. package/datagrid/hooks/useGridRefresh.js +10 -7
  93. package/datagrid/hooks/useGridSchema.js +7 -4
  94. package/datagrid/hooks/useGridSelection.js +10 -7
  95. package/datagrid/hooks/useGridSorting.js +10 -7
  96. package/datagrid/hooks/useGridViewLookupData.js +7 -4
  97. package/datagrid/hooks/useLoadMainGridPage.js +12 -9
  98. package/datagrid/hooks/useMainGridCommands.js +62 -54
  99. package/datagrid/hooks/useMaxRecords.js +7 -4
  100. package/datagrid/hooks/useOpenRecord.js +20 -17
  101. package/datagrid/hooks/useSearchText.js +10 -7
  102. package/datagrid/hooks/useSelectedView.js +7 -4
  103. package/datagrid/hooks/useSubGridCommands.js +34 -23
  104. package/datagrid/index.js +27 -5
  105. package/defaults.js +5 -2
  106. package/dialog/DialogProvider.js +10 -6
  107. package/dialog/context.d.ts +1 -1
  108. package/dialog/context.js +5 -2
  109. package/dialog/hooks/index.js +24 -8
  110. package/dialog/hooks/useCloseDialog.js +10 -7
  111. package/dialog/hooks/useDialogItem.d.ts +1 -1
  112. package/dialog/hooks/useDialogItem.js +7 -4
  113. package/dialog/hooks/useDialogItems.d.ts +1 -1
  114. package/dialog/hooks/useDialogItems.js +7 -4
  115. package/dialog/hooks/useOpenAlertDialog.js +16 -8
  116. package/dialog/hooks/useOpenConfirmDialog.js +18 -9
  117. package/dialog/hooks/useOpenDialog.js +18 -11
  118. package/dialog/hooks/useOpenErrorDialog.js +16 -8
  119. package/dialog/hooks/useOpenPromptDialog.js +18 -9
  120. package/dialog/index.js +22 -3
  121. package/form/FormValidationStringContext.js +9 -5
  122. package/form/index.js +7 -1
  123. package/hooks/index.js +24 -6
  124. package/hooks/useDebouncedValue.js +11 -8
  125. package/hooks/useElementLayout.js +7 -4
  126. package/hooks/useIsMobile.js +12 -6
  127. package/hooks/useItemsWithKey.js +8 -5
  128. package/hooks/useStorageState.js +7 -5
  129. package/hooks/useSystemColorScheme.js +7 -4
  130. package/insights/InsightsProvider.js +13 -10
  131. package/insights/context.d.ts +1 -1
  132. package/insights/context.js +5 -2
  133. package/insights/hooks/index.js +7 -4
  134. package/insights/index.js +20 -2
  135. package/locale/LocaleProvider.js +12 -8
  136. package/locale/context.js +5 -2
  137. package/locale/index.js +23 -4
  138. package/locale/useCurrencySymbol.js +10 -8
  139. package/locale/useLocale.js +7 -4
  140. package/locale/utils.js +8 -3
  141. package/metadata/MetadataProvider.js +21 -17
  142. package/metadata/context.d.ts +1 -1
  143. package/metadata/context.js +5 -2
  144. package/metadata/hooks/index.js +24 -8
  145. package/metadata/hooks/useAppStore.js +7 -4
  146. package/metadata/hooks/useExperienceStore.js +7 -4
  147. package/metadata/hooks/useExperienceView.js +11 -17
  148. package/metadata/hooks/useExperienceViewCommands.js +14 -20
  149. package/metadata/hooks/useExperienceViewLookup.js +10 -16
  150. package/metadata/hooks/useExperienceViewSubgridCommands.js +14 -20
  151. package/metadata/hooks/useMetadata.js +11 -8
  152. package/metadata/hooks/useSchema.js +6 -3
  153. package/metadata/index.js +22 -3
  154. package/mutable/context.js +25 -17
  155. package/mutable/index.js +27 -3
  156. package/mutable/state.js +10 -6
  157. package/mutable/type.js +2 -1
  158. package/mutable/utils.js +12 -8
  159. package/navigation/hooks/index.js +17 -1
  160. package/navigation/hooks/useOpenForm.js +14 -11
  161. package/navigation/index.js +17 -1
  162. package/package.json +4 -12
  163. package/progress-indicator/ProgressIndicatorProvider.js +16 -12
  164. package/progress-indicator/context.js +5 -2
  165. package/progress-indicator/hooks/index.js +17 -1
  166. package/progress-indicator/hooks/useProgressIndicator.d.ts +1 -1
  167. package/progress-indicator/hooks/useProgressIndicator.js +7 -4
  168. package/progress-indicator/index.js +22 -3
  169. package/providers/PageEntityFormProvider/index.js +7 -4
  170. package/providers/PageEntityViewProvider/index.js +7 -4
  171. package/recordset/RecordSetProvider.js +16 -12
  172. package/recordset/context.d.ts +1 -1
  173. package/recordset/context.js +5 -2
  174. package/recordset/hooks/index.js +19 -3
  175. package/recordset/hooks/useRecordSetResult.js +22 -29
  176. package/recordset/hooks/useRecordSetSetter.js +9 -6
  177. package/recordset/hooks/useRecordSetVisibility.js +10 -7
  178. package/recordset/index.js +22 -3
  179. package/route/RouteProvider.js +18 -14
  180. package/route/context.js +9 -6
  181. package/route/hooks/index.js +22 -6
  182. package/route/hooks/useBasePath.js +7 -4
  183. package/route/hooks/useIsRouteActive.js +7 -4
  184. package/route/hooks/usePathname.js +7 -4
  185. package/route/hooks/useRouteResolver.js +7 -4
  186. package/route/hooks/useRouter.js +7 -4
  187. package/route/hooks/useSearchParams.js +7 -4
  188. package/route/index.js +20 -2
  189. package/route/types.js +2 -1
  190. package/store/ClientAppStore.js +12 -21
  191. package/store/ComponentStore.js +6 -4
  192. package/store/EventManager.js +20 -32
  193. package/store/SchemaExperienceStore.js +186 -217
  194. package/store/index.js +20 -4
  195. package/toast-notification/ToastNotificationProvider.js +10 -6
  196. package/toast-notification/context.d.ts +1 -1
  197. package/toast-notification/context.js +5 -2
  198. package/toast-notification/hooks/index.js +19 -3
  199. package/toast-notification/hooks/useCloseToastNotification.js +10 -7
  200. package/toast-notification/hooks/useOpenToastNotification.js +18 -11
  201. package/toast-notification/hooks/useToastNotificationItems.d.ts +1 -1
  202. package/toast-notification/hooks/useToastNotificationItems.js +7 -4
  203. package/toast-notification/index.js +22 -3
  204. package/transport/InMemoryDataService/index.js +59 -78
  205. package/transport/RestDataService/index.js +72 -91
  206. package/transport/context.js +9 -15
  207. package/transport/hooks/index.js +18 -2
  208. package/transport/hooks/useDataService.js +7 -4
  209. package/transport/hooks/useFileService.js +7 -4
  210. package/transport/hooks/useRetriveRecords.d.ts +1 -1
  211. package/transport/hooks/useRetriveRecords.js +25 -31
  212. package/transport/index.js +20 -2
  213. package/utils/calculateColumnWidths.js +5 -2
  214. package/utils/color.js +4 -1
  215. package/utils/getAttributeFormattedValue.js +38 -40
  216. package/utils/index.js +18 -2
  217. package/widget/context.js +5 -2
  218. package/widget/hooks/index.js +7 -4
  219. package/widget/index.js +5 -1
@@ -1,18 +1,25 @@
1
- import { useCallback } from 'react';
2
- import { v4 as uuid } from 'uuid';
3
- import { useContextSetValue } from '../../mutable/context';
4
- import { DialogContext } from '../context';
5
- import { useCloseDialog } from './useCloseDialog';
6
- export function useOpenDialog() {
7
- const setValue = useContextSetValue(DialogContext);
8
- const closeDialog = useCloseDialog();
9
- const openDialog = useCallback((options) => {
10
- const id = uuid();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useOpenDialog = useOpenDialog;
4
+ const react_1 = require("react");
5
+ const uuid_1 = require("uuid");
6
+ const context_1 = require("../../mutable/context");
7
+ const context_2 = require("../context");
8
+ const useCloseDialog_1 = require("./useCloseDialog");
9
+ function useOpenDialog() {
10
+ const setValue = (0, context_1.useContextSetValue)(context_2.DialogContext);
11
+ const closeDialog = (0, useCloseDialog_1.useCloseDialog)();
12
+ const openDialog = (0, react_1.useCallback)((options) => {
13
+ const id = (0, uuid_1.v4)();
11
14
  setValue((state) => {
12
15
  return {
13
16
  items: [
14
17
  ...state.items,
15
- Object.assign({ id, isOpen: true }, options),
18
+ {
19
+ id,
20
+ isOpen: true,
21
+ ...options,
22
+ },
16
23
  ],
17
24
  };
18
25
  });
@@ -1,13 +1,21 @@
1
- import { useCallback } from 'react';
2
- import { useOpenDialog } from './useOpenDialog';
3
- export function useOpenErrorDialog() {
4
- const openDialog = useOpenDialog();
5
- const openErrorDialog = useCallback((options) => {
6
- const { close } = openDialog(Object.assign(Object.assign({ type: 'error' }, options), { onDismiss: () => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useOpenErrorDialog = useOpenErrorDialog;
4
+ const react_1 = require("react");
5
+ const useOpenDialog_1 = require("./useOpenDialog");
6
+ function useOpenErrorDialog() {
7
+ const openDialog = (0, useOpenDialog_1.useOpenDialog)();
8
+ const openErrorDialog = (0, react_1.useCallback)((options) => {
9
+ const { close } = openDialog({
10
+ type: 'error',
11
+ ...options,
12
+ onDismiss: () => {
7
13
  close();
8
- }, onConfirm: () => {
14
+ },
15
+ onConfirm: () => {
9
16
  close();
10
- } }));
17
+ },
18
+ });
11
19
  }, [openDialog]);
12
20
  return openErrorDialog;
13
21
  }
@@ -1,22 +1,31 @@
1
- import { useCallback } from 'react';
2
- import { useOpenDialog } from './useOpenDialog';
3
- export function useOpenPromptDialog() {
4
- const openDialog = useOpenDialog();
5
- const openPromptDialog = useCallback((options) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useOpenPromptDialog = useOpenPromptDialog;
4
+ const react_1 = require("react");
5
+ const useOpenDialog_1 = require("./useOpenDialog");
6
+ function useOpenPromptDialog() {
7
+ const openDialog = (0, useOpenDialog_1.useOpenDialog)();
8
+ const openPromptDialog = (0, react_1.useCallback)((options) => {
6
9
  return new Promise((resolve) => {
7
- const { close } = openDialog(Object.assign(Object.assign({ type: 'prompt' }, options), { onDismiss: () => {
10
+ const { close } = openDialog({
11
+ type: 'prompt',
12
+ ...options,
13
+ onDismiss: () => {
8
14
  if (!options.allowDismiss) {
9
15
  return;
10
16
  }
11
17
  close();
12
18
  resolve(null);
13
- }, onConfirm: (result) => {
19
+ },
20
+ onConfirm: (result) => {
14
21
  close();
15
22
  resolve(result);
16
- }, onCancel: () => {
23
+ },
24
+ onCancel: () => {
17
25
  close();
18
26
  resolve(null);
19
- } }));
27
+ },
28
+ });
20
29
  });
21
30
  }, [openDialog]);
22
31
  return openPromptDialog;
package/dialog/index.js CHANGED
@@ -1,3 +1,22 @@
1
- export { DialogContext, } from './context';
2
- export { DialogProvider } from './DialogProvider';
3
- export * from './hooks';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.DialogProvider = exports.DialogContext = void 0;
18
+ var context_1 = require("./context");
19
+ Object.defineProperty(exports, "DialogContext", { enumerable: true, get: function () { return context_1.DialogContext; } });
20
+ var DialogProvider_1 = require("./DialogProvider");
21
+ Object.defineProperty(exports, "DialogProvider", { enumerable: true, get: function () { return DialogProvider_1.DialogProvider; } });
22
+ __exportStar(require("./hooks"), exports);
@@ -1,5 +1,9 @@
1
- import { createContext, useContext } from 'react';
2
- export const defaultFormValidationStrings = {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormValidationStringContext = exports.defaultFormValidationStrings = void 0;
4
+ exports.useFormValidationStrings = useFormValidationStrings;
5
+ const react_1 = require("react");
6
+ exports.defaultFormValidationStrings = {
3
7
  required: 'Required field must be filled in.',
4
8
  maxLength: 'Maximum length exceeded.',
5
9
  minLength: 'Minimum length not met.',
@@ -9,8 +13,8 @@ export const defaultFormValidationStrings = {
9
13
  atLeastOneRowRequired: 'At least one row required.',
10
14
  fileSizeExceeded: 'File size exceeded.',
11
15
  };
12
- export const FormValidationStringContext = createContext(defaultFormValidationStrings);
13
- export function useFormValidationStrings() {
14
- const context = useContext(FormValidationStringContext);
16
+ exports.FormValidationStringContext = (0, react_1.createContext)(exports.defaultFormValidationStrings);
17
+ function useFormValidationStrings() {
18
+ const context = (0, react_1.useContext)(exports.FormValidationStringContext);
15
19
  return context;
16
20
  }
package/form/index.js CHANGED
@@ -1 +1,7 @@
1
- export { FormValidationStringContext, defaultFormValidationStrings, useFormValidationStrings, } from './FormValidationStringContext';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useFormValidationStrings = exports.defaultFormValidationStrings = exports.FormValidationStringContext = void 0;
4
+ var FormValidationStringContext_1 = require("./FormValidationStringContext");
5
+ Object.defineProperty(exports, "FormValidationStringContext", { enumerable: true, get: function () { return FormValidationStringContext_1.FormValidationStringContext; } });
6
+ Object.defineProperty(exports, "defaultFormValidationStrings", { enumerable: true, get: function () { return FormValidationStringContext_1.defaultFormValidationStrings; } });
7
+ Object.defineProperty(exports, "useFormValidationStrings", { enumerable: true, get: function () { return FormValidationStringContext_1.useFormValidationStrings; } });
package/hooks/index.js CHANGED
@@ -1,6 +1,24 @@
1
- export * from './useDebouncedValue';
2
- export * from './useElementLayout';
3
- export * from './useIsMobile';
4
- export * from './useStorageState';
5
- export * from './useSystemColorScheme';
6
- export { useItemsWithKey } from './useItemsWithKey';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.useItemsWithKey = void 0;
18
+ __exportStar(require("./useDebouncedValue"), exports);
19
+ __exportStar(require("./useElementLayout"), exports);
20
+ __exportStar(require("./useIsMobile"), exports);
21
+ __exportStar(require("./useStorageState"), exports);
22
+ __exportStar(require("./useSystemColorScheme"), exports);
23
+ var useItemsWithKey_1 = require("./useItemsWithKey");
24
+ Object.defineProperty(exports, "useItemsWithKey", { enumerable: true, get: function () { return useItemsWithKey_1.useItemsWithKey; } });
@@ -1,11 +1,14 @@
1
- import { useEffect, useRef, useState } from 'react';
2
- export function useDebouncedValue(value, wait, options = { leading: false }) {
3
- const [_value, setValue] = useState(value);
4
- const mountedRef = useRef(false);
5
- const timeoutRef = useRef(null);
6
- const cooldownRef = useRef(false);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDebouncedValue = useDebouncedValue;
4
+ const react_1 = require("react");
5
+ function useDebouncedValue(value, wait, options = { leading: false }) {
6
+ const [_value, setValue] = (0, react_1.useState)(value);
7
+ const mountedRef = (0, react_1.useRef)(false);
8
+ const timeoutRef = (0, react_1.useRef)(null);
9
+ const cooldownRef = (0, react_1.useRef)(false);
7
10
  const cancel = () => window.clearTimeout(timeoutRef.current);
8
- useEffect(() => {
11
+ (0, react_1.useEffect)(() => {
9
12
  if (mountedRef.current) {
10
13
  if (!cooldownRef.current && options.leading) {
11
14
  cooldownRef.current = true;
@@ -20,7 +23,7 @@ export function useDebouncedValue(value, wait, options = { leading: false }) {
20
23
  }
21
24
  }
22
25
  }, [value, options.leading, wait]);
23
- useEffect(() => {
26
+ (0, react_1.useEffect)(() => {
24
27
  mountedRef.current = true;
25
28
  return cancel;
26
29
  }, []);
@@ -1,7 +1,10 @@
1
- import { useLayoutEffect, useState } from 'react';
2
- export function useElementSize(elementRef, interval) {
3
- const [size, setSize] = useState({ width: 0, height: 0 });
4
- useLayoutEffect(() => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useElementSize = useElementSize;
4
+ const react_1 = require("react");
5
+ function useElementSize(elementRef, interval) {
6
+ const [size, setSize] = (0, react_1.useState)({ width: 0, height: 0 });
7
+ (0, react_1.useLayoutEffect)(() => {
5
8
  function updateSize() {
6
9
  if (elementRef.current) {
7
10
  const element = elementRef.current;
@@ -1,12 +1,18 @@
1
- import debounce from 'lodash/debounce';
2
- import { useLayoutEffect, useState } from 'react';
3
- export function useIsMobile() {
4
- const [isMobile, setIsMobile] = useState(false);
5
- useLayoutEffect(() => {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useIsMobile = useIsMobile;
7
+ const debounce_1 = __importDefault(require("lodash/debounce"));
8
+ const react_1 = require("react");
9
+ function useIsMobile() {
10
+ const [isMobile, setIsMobile] = (0, react_1.useState)(false);
11
+ (0, react_1.useLayoutEffect)(() => {
6
12
  const updateSize = () => {
7
13
  setIsMobile(window.innerWidth < 768);
8
14
  };
9
- window.addEventListener('resize', debounce(updateSize, 250));
15
+ window.addEventListener('resize', (0, debounce_1.default)(updateSize, 250));
10
16
  updateSize();
11
17
  return () => window.removeEventListener('resize', updateSize);
12
18
  }, []);
@@ -1,10 +1,13 @@
1
- import { createItemsWithKey } from '@headless-adminapp/core/utils';
2
- import { useMemo } from 'react';
3
- export function useItemsWithKey(value) {
4
- return useMemo(() => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useItemsWithKey = useItemsWithKey;
4
+ const utils_1 = require("@headless-adminapp/core/utils");
5
+ const react_1 = require("react");
6
+ function useItemsWithKey(value) {
7
+ return (0, react_1.useMemo)(() => {
5
8
  if (!value) {
6
9
  return value;
7
10
  }
8
- return createItemsWithKey(value);
11
+ return (0, utils_1.createItemsWithKey)(value);
9
12
  }, [value]);
10
13
  }
@@ -1,4 +1,7 @@
1
- import { useCallback, useState } from 'react';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useStorageState = useStorageState;
4
+ const react_1 = require("react");
2
5
  function getStorageValue(key, store) {
3
6
  const value = store.getItem(key);
4
7
  if (value) {
@@ -9,10 +12,9 @@ function getStorageValue(key, store) {
9
12
  function setStorageValue(key, value, store) {
10
13
  store.setItem(key, JSON.stringify(value));
11
14
  }
12
- export function useStorageState(initialState, key, store = localStorage) {
13
- var _a;
14
- const [state, setState] = useState((_a = getStorageValue(key, store)) !== null && _a !== void 0 ? _a : initialState);
15
- const setStoredState = useCallback((value) => {
15
+ function useStorageState(initialState, key, store = localStorage) {
16
+ const [state, setState] = (0, react_1.useState)(getStorageValue(key, store) ?? initialState);
17
+ const setStoredState = (0, react_1.useCallback)((value) => {
16
18
  setState((prevState) => {
17
19
  const finalState = value instanceof Function ? value(prevState) : value;
18
20
  setStorageValue(key, finalState, store);
@@ -1,4 +1,7 @@
1
- import { useEffect, useState } from 'react';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSystemColorScheme = useSystemColorScheme;
4
+ const react_1 = require("react");
2
5
  const isSystemDarkMode = () => {
3
6
  if (typeof window === 'undefined') {
4
7
  return false;
@@ -6,9 +9,9 @@ const isSystemDarkMode = () => {
6
9
  return (window.matchMedia &&
7
10
  window.matchMedia('(prefers-color-scheme: dark)').matches);
8
11
  };
9
- export function useSystemColorScheme() {
10
- const [systemColorScheme, setSystemColorScheme] = useState(isSystemDarkMode() ? 'dark' : 'light');
11
- useEffect(() => {
12
+ function useSystemColorScheme() {
13
+ const [systemColorScheme, setSystemColorScheme] = (0, react_1.useState)(isSystemDarkMode() ? 'dark' : 'light');
14
+ (0, react_1.useEffect)(() => {
12
15
  setSystemColorScheme(isSystemDarkMode() ? 'dark' : 'light');
13
16
  const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
14
17
  const handleChange = (e) => {
@@ -1,24 +1,27 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useCallback, useEffect, useRef } from 'react';
3
- import { useCreateContextStore } from '../mutable';
4
- import { InsightsContext } from './context';
5
- export function InsightsProvider({ children, experience, insightLookup, onInsightSelect, }) {
6
- const onInsightSelectRef = useRef(onInsightSelect);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InsightsProvider = InsightsProvider;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const mutable_1 = require("../mutable");
7
+ const context_1 = require("./context");
8
+ function InsightsProvider({ children, experience, insightLookup, onInsightSelect, }) {
9
+ const onInsightSelectRef = (0, react_1.useRef)(onInsightSelect);
7
10
  onInsightSelectRef.current = onInsightSelect;
8
- const onInsightSelectInternal = useCallback((id) => {
11
+ const onInsightSelectInternal = (0, react_1.useCallback)((id) => {
9
12
  onInsightSelectRef.current(id);
10
13
  }, [onInsightSelectRef]);
11
- const insightsValues = useCreateContextStore({
14
+ const insightsValues = (0, mutable_1.useCreateContextStore)({
12
15
  experience,
13
16
  data: experience.defaultData,
14
17
  insightLookup: insightLookup,
15
18
  onInsightSelect: onInsightSelectInternal,
16
19
  });
17
- useEffect(() => {
20
+ (0, react_1.useEffect)(() => {
18
21
  insightsValues.setValue({
19
22
  experience,
20
23
  data: experience.defaultData,
21
24
  });
22
25
  }, [experience, insightsValues]);
23
- return (_jsx(InsightsContext.Provider, { value: insightsValues, children: children }));
26
+ return ((0, jsx_runtime_1.jsx)(context_1.InsightsContext.Provider, { value: insightsValues, children: children }));
24
27
  }
@@ -1,2 +1,2 @@
1
1
  import { InsightsState } from '@headless-adminapp/core/experience/insights';
2
- export declare const InsightsContext: import("react").Context<import("../mutable").ContextValue<InsightsState<import("@headless-adminapp/core/schema").SchemaAttributes>>>;
2
+ export declare const InsightsContext: import("react").Context<import("../mutable/context").ContextValue<InsightsState<import("@headless-adminapp/core/schema").SchemaAttributes>>>;
@@ -1,2 +1,5 @@
1
- import { createContext } from '../mutable/context';
2
- export const InsightsContext = createContext();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InsightsContext = void 0;
4
+ const context_1 = require("../mutable/context");
5
+ exports.InsightsContext = (0, context_1.createContext)();
@@ -1,5 +1,8 @@
1
- import { useContextSelector } from '../../mutable';
2
- import { InsightsContext } from '../context';
3
- export function useInsightsState() {
4
- return useContextSelector(InsightsContext, (state) => state);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useInsightsState = useInsightsState;
4
+ const mutable_1 = require("../../mutable");
5
+ const context_1 = require("../context");
6
+ function useInsightsState() {
7
+ return (0, mutable_1.useContextSelector)(context_1.InsightsContext, (state) => state);
5
8
  }
package/insights/index.js CHANGED
@@ -1,2 +1,20 @@
1
- export { InsightsContext } from './context';
2
- export * from './hooks';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.InsightsContext = void 0;
18
+ var context_1 = require("./context");
19
+ Object.defineProperty(exports, "InsightsContext", { enumerable: true, get: function () { return context_1.InsightsContext; } });
20
+ __exportStar(require("./hooks"), exports);
@@ -1,10 +1,14 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { getLocale } from '@headless-adminapp/core/experience/locale';
3
- import { useMemo } from 'react';
4
- import { LocaleContext } from './context';
5
- export const LocaleProvider = ({ children, locale = 'en-US', timezone = 'UTC', options, }) => {
6
- const localeState = useMemo(() => {
7
- return getLocale(locale, timezone, options);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LocaleProvider = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const locale_1 = require("@headless-adminapp/core/experience/locale");
6
+ const react_1 = require("react");
7
+ const context_1 = require("./context");
8
+ const LocaleProvider = ({ children, locale = 'en-US', timezone = 'UTC', options, }) => {
9
+ const localeState = (0, react_1.useMemo)(() => {
10
+ return (0, locale_1.getLocale)(locale, timezone, options);
8
11
  }, [locale, timezone, options]);
9
- return (_jsx(LocaleContext.Provider, { value: localeState, children: children }));
12
+ return ((0, jsx_runtime_1.jsx)(context_1.LocaleContext.Provider, { value: localeState, children: children }));
10
13
  };
14
+ exports.LocaleProvider = LocaleProvider;
package/locale/context.js CHANGED
@@ -1,2 +1,5 @@
1
- import { createContext } from 'react';
2
- export const LocaleContext = createContext(null);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LocaleContext = void 0;
4
+ const react_1 = require("react");
5
+ exports.LocaleContext = (0, react_1.createContext)(null);
package/locale/index.js CHANGED
@@ -1,4 +1,23 @@
1
- export { LocaleContext } from './context';
2
- export * from './useLocale';
3
- export * from './useCurrencySymbol';
4
- export { LocaleProvider } from './LocaleProvider';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.LocaleProvider = exports.LocaleContext = void 0;
18
+ var context_1 = require("./context");
19
+ Object.defineProperty(exports, "LocaleContext", { enumerable: true, get: function () { return context_1.LocaleContext; } });
20
+ __exportStar(require("./useLocale"), exports);
21
+ __exportStar(require("./useCurrencySymbol"), exports);
22
+ var LocaleProvider_1 = require("./LocaleProvider");
23
+ Object.defineProperty(exports, "LocaleProvider", { enumerable: true, get: function () { return LocaleProvider_1.LocaleProvider; } });
@@ -1,10 +1,12 @@
1
- import { getCurrencySymbol } from '@headless-adminapp/core/experience/locale/utils';
2
- import { useMemo } from 'react';
3
- import { useLocale } from './useLocale';
4
- export function useCurrencySymbol() {
5
- const locale = useLocale();
6
- return useMemo(() => {
7
- var _a;
8
- return getCurrencySymbol(locale.locale, (_a = locale.currency.currency) !== null && _a !== void 0 ? _a : 'USD');
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCurrencySymbol = useCurrencySymbol;
4
+ const utils_1 = require("@headless-adminapp/core/experience/locale/utils");
5
+ const react_1 = require("react");
6
+ const useLocale_1 = require("./useLocale");
7
+ function useCurrencySymbol() {
8
+ const locale = (0, useLocale_1.useLocale)();
9
+ return (0, react_1.useMemo)(() => {
10
+ return (0, utils_1.getCurrencySymbol)(locale.locale, locale.currency.currency ?? 'USD');
9
11
  }, [locale]);
10
12
  }
@@ -1,7 +1,10 @@
1
- import { useContext } from 'react';
2
- import { LocaleContext } from './context';
3
- export function useLocale() {
4
- const context = useContext(LocaleContext);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useLocale = useLocale;
4
+ const react_1 = require("react");
5
+ const context_1 = require("./context");
6
+ function useLocale() {
7
+ const context = (0, react_1.useContext)(context_1.LocaleContext);
5
8
  if (!context) {
6
9
  throw new Error('useLocale must be used within a LocaleProvider');
7
10
  }
package/locale/utils.js CHANGED
@@ -1,4 +1,9 @@
1
- export function localizedLabel(language, value, fallback) {
2
- var _a, _b, _c, _d, _e;
3
- return ((_e = (_d = (_b = (_a = value.localizedLabels) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : (_c = fallback === null || fallback === void 0 ? void 0 : fallback.localizedLabels) === null || _c === void 0 ? void 0 : _c[language]) !== null && _d !== void 0 ? _d : value.label) !== null && _e !== void 0 ? _e : fallback === null || fallback === void 0 ? void 0 : fallback.label);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.localizedLabel = localizedLabel;
4
+ function localizedLabel(language, value, fallback) {
5
+ return (value.localizedLabels?.[language] ??
6
+ fallback?.localizedLabels?.[language] ??
7
+ value.label ??
8
+ fallback?.label);
4
9
  }
@@ -1,32 +1,36 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { PageType } from '@headless-adminapp/core/experience/app';
3
- import { SchemaStore, } from '@headless-adminapp/core/store';
4
- import { IconPlaceholder } from '@headless-adminapp/icons';
5
- import { useCreateContextStore } from '../mutable/context';
6
- import { ClientAppStore, SchemaExperienceStore } from '../store';
7
- import { MetadataContext } from './context';
8
- export const defaultAppStore = new ClientAppStore();
9
- export const defaultSchemaStore = new SchemaStore();
10
- export const defaultExperienceStore = new SchemaExperienceStore({
11
- schemaStore: defaultSchemaStore,
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MetadataProvider = exports.defaultExperienceStore = exports.defaultSchemaStore = exports.defaultAppStore = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const app_1 = require("@headless-adminapp/core/experience/app");
6
+ const store_1 = require("@headless-adminapp/core/store");
7
+ const icons_1 = require("@headless-adminapp/icons");
8
+ const context_1 = require("../mutable/context");
9
+ const store_2 = require("../store");
10
+ const context_2 = require("./context");
11
+ exports.defaultAppStore = new store_2.ClientAppStore();
12
+ exports.defaultSchemaStore = new store_1.SchemaStore();
13
+ exports.defaultExperienceStore = new store_2.SchemaExperienceStore({
14
+ schemaStore: exports.defaultSchemaStore,
12
15
  });
13
- defaultAppStore.register({
16
+ exports.defaultAppStore.register({
14
17
  id: 'default',
15
18
  title: 'Demo App',
16
19
  navItems: [],
17
20
  defaultPage: {
18
21
  label: 'Home',
19
22
  link: '/home',
20
- type: PageType.Custom,
21
- icon: IconPlaceholder,
23
+ type: app_1.PageType.Custom,
24
+ icon: icons_1.IconPlaceholder,
22
25
  },
23
26
  logo: {},
24
27
  });
25
- export const MetadataProvider = ({ children, experienceStore = defaultExperienceStore, schemaStore = defaultSchemaStore, appStore = defaultAppStore, }) => {
26
- const contextValue = useCreateContextStore({
28
+ const MetadataProvider = ({ children, experienceStore = exports.defaultExperienceStore, schemaStore = exports.defaultSchemaStore, appStore = exports.defaultAppStore, }) => {
29
+ const contextValue = (0, context_1.useCreateContextStore)({
27
30
  experienceStore,
28
31
  schemaStore,
29
32
  appStore,
30
33
  });
31
- return (_jsx(MetadataContext.Provider, { value: contextValue, children: children }));
34
+ return ((0, jsx_runtime_1.jsx)(context_2.MetadataContext.Provider, { value: contextValue, children: children }));
32
35
  };
36
+ exports.MetadataProvider = MetadataProvider;
@@ -4,4 +4,4 @@ export interface MetadataContextState {
4
4
  schemaStore: ISchemaStore;
5
5
  experienceStore: ISchemaExperienceStore;
6
6
  }
7
- export declare const MetadataContext: import("react").Context<import("../mutable").ContextValue<MetadataContextState>>;
7
+ export declare const MetadataContext: import("react").Context<import("../mutable/context").ContextValue<MetadataContextState>>;