@gooddata/sdk-ui-kit 11.13.0-alpha.1 → 11.13.0-alpha.3

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 (183) hide show
  1. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableBulkActions.d.ts.map +1 -1
  2. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableBulkActions.js +2 -2
  3. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableBulkActions.js.map +1 -1
  4. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableCheckbox.js +1 -1
  5. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableCheckbox.js.map +1 -1
  6. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableDropdownItem.d.ts +1 -2
  7. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableDropdownItem.d.ts.map +1 -1
  8. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableDropdownItem.js +3 -3
  9. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableDropdownItem.js.map +1 -1
  10. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableFilter.d.ts.map +1 -1
  11. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableFilter.js +2 -1
  12. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableFilter.js.map +1 -1
  13. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableToolbar.js +2 -2
  14. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableToolbar.js.map +1 -1
  15. package/esm/@ui/UiAsyncTable/types.d.ts +3 -0
  16. package/esm/@ui/UiAsyncTable/types.d.ts.map +1 -1
  17. package/esm/@ui/UiBadge/UiBadge.d.ts +0 -1
  18. package/esm/@ui/UiBadge/UiBadge.d.ts.map +1 -1
  19. package/esm/@ui/UiBadge/UiBadge.js +0 -1
  20. package/esm/@ui/UiBadge/UiBadge.js.map +1 -1
  21. package/esm/@ui/UiButton/UiButton.d.ts.map +1 -1
  22. package/esm/@ui/UiButton/UiButton.js +1 -1
  23. package/esm/@ui/UiButton/UiButton.js.map +1 -1
  24. package/esm/@ui/UiCheckbox/UiCheckbox.d.ts.map +1 -1
  25. package/esm/@ui/UiCheckbox/UiCheckbox.js +9 -1
  26. package/esm/@ui/UiCheckbox/UiCheckbox.js.map +1 -1
  27. package/esm/@ui/UiPaginationButton/UiPaginationButton.d.ts +85 -0
  28. package/esm/@ui/UiPaginationButton/UiPaginationButton.d.ts.map +1 -0
  29. package/esm/@ui/UiPaginationButton/UiPaginationButton.js +28 -0
  30. package/esm/@ui/UiPaginationButton/UiPaginationButton.js.map +1 -0
  31. package/esm/ChartSorting/ChartSorting.d.ts +0 -4
  32. package/esm/ChartSorting/ChartSorting.d.ts.map +1 -1
  33. package/esm/ChartSorting/ChartSorting.js +1 -4
  34. package/esm/ChartSorting/ChartSorting.js.map +1 -1
  35. package/esm/ColorPicker/ColorPicker.d.ts +1 -4
  36. package/esm/ColorPicker/ColorPicker.d.ts.map +1 -1
  37. package/esm/ColorPicker/ColorPicker.js +6 -7
  38. package/esm/ColorPicker/ColorPicker.js.map +1 -1
  39. package/esm/DocumentHeader/DocumentHeader.d.ts +1 -1
  40. package/esm/DocumentHeader/DocumentHeader.d.ts.map +1 -1
  41. package/esm/DocumentHeader/DocumentHeader.js +1 -1
  42. package/esm/DocumentHeader/DocumentHeader.js.map +1 -1
  43. package/esm/DocumentHeader/index.d.ts +1 -1
  44. package/esm/DocumentHeader/index.d.ts.map +1 -1
  45. package/esm/DocumentHeader/index.js +2 -1
  46. package/esm/DocumentHeader/index.js.map +1 -1
  47. package/esm/Dropdown/DropdownButton.js +1 -1
  48. package/esm/Dropdown/DropdownButton.js.map +1 -1
  49. package/esm/FilterLabel/FilterLabel.d.ts +1 -4
  50. package/esm/FilterLabel/FilterLabel.d.ts.map +1 -1
  51. package/esm/FilterLabel/FilterLabel.js +7 -7
  52. package/esm/FilterLabel/FilterLabel.js.map +1 -1
  53. package/esm/Form/InputWithNumberFormat.d.ts +2 -39
  54. package/esm/Form/InputWithNumberFormat.d.ts.map +1 -1
  55. package/esm/Form/InputWithNumberFormat.js +33 -50
  56. package/esm/Form/InputWithNumberFormat.js.map +1 -1
  57. package/esm/Header/Header.d.ts +1 -2
  58. package/esm/Header/Header.d.ts.map +1 -1
  59. package/esm/Header/Header.js +7 -7
  60. package/esm/Header/Header.js.map +1 -1
  61. package/esm/Header/HeaderDataMenu.d.ts +0 -1
  62. package/esm/Header/HeaderDataMenu.d.ts.map +1 -1
  63. package/esm/Header/HeaderDataMenu.js +1 -1
  64. package/esm/Header/HeaderDataMenu.js.map +1 -1
  65. package/esm/Header/HeaderHelp.d.ts +0 -1
  66. package/esm/Header/HeaderHelp.d.ts.map +1 -1
  67. package/esm/Header/HeaderHelp.js +1 -1
  68. package/esm/Header/HeaderHelp.js.map +1 -1
  69. package/esm/Header/HeaderMenu.d.ts +1 -2
  70. package/esm/Header/HeaderMenu.d.ts.map +1 -1
  71. package/esm/Header/HeaderMenu.js +4 -4
  72. package/esm/Header/HeaderMenu.js.map +1 -1
  73. package/esm/Header/HeaderWorkspacePicker.d.ts +0 -1
  74. package/esm/Header/HeaderWorkspacePicker.d.ts.map +1 -1
  75. package/esm/Header/HeaderWorkspacePicker.js +1 -1
  76. package/esm/Header/HeaderWorkspacePicker.js.map +1 -1
  77. package/esm/Header/HeaderWorkspacePickerItem.d.ts +0 -1
  78. package/esm/Header/HeaderWorkspacePickerItem.d.ts.map +1 -1
  79. package/esm/Header/HeaderWorkspacePickerItem.js +1 -1
  80. package/esm/Header/HeaderWorkspacePickerItem.js.map +1 -1
  81. package/esm/List/InsightListItem.d.ts +1 -4
  82. package/esm/List/InsightListItem.d.ts.map +1 -1
  83. package/esm/List/InsightListItem.js +3 -6
  84. package/esm/List/InsightListItem.js.map +1 -1
  85. package/esm/List/LegacyInvertableList.d.ts +0 -1
  86. package/esm/List/LegacyInvertableList.d.ts.map +1 -1
  87. package/esm/List/LegacyInvertableList.js +3 -4
  88. package/esm/List/LegacyInvertableList.js.map +1 -1
  89. package/esm/List/LegacyMultiSelectList.d.ts +1 -2
  90. package/esm/List/LegacyMultiSelectList.d.ts.map +1 -1
  91. package/esm/List/LegacyMultiSelectList.js +7 -12
  92. package/esm/List/LegacyMultiSelectList.js.map +1 -1
  93. package/esm/List/LegacyMultiSelectListItem.d.ts +0 -6
  94. package/esm/List/LegacyMultiSelectListItem.d.ts.map +1 -1
  95. package/esm/List/LegacyMultiSelectListItem.js +1 -2
  96. package/esm/List/LegacyMultiSelectListItem.js.map +1 -1
  97. package/esm/List/MultiSelectList.d.ts +1 -5
  98. package/esm/List/MultiSelectList.d.ts.map +1 -1
  99. package/esm/List/MultiSelectList.js +6 -6
  100. package/esm/List/MultiSelectList.js.map +1 -1
  101. package/esm/List/index.d.ts +2 -2
  102. package/esm/List/index.d.ts.map +1 -1
  103. package/esm/List/index.js +2 -2
  104. package/esm/List/index.js.map +1 -1
  105. package/esm/Overlay/ErrorOverlay.d.ts.map +1 -1
  106. package/esm/Overlay/ErrorOverlay.js +4 -4
  107. package/esm/Overlay/ErrorOverlay.js.map +1 -1
  108. package/esm/SettingWidget/StylingSettingWidget/StylingSettingWidget.d.ts +2 -2
  109. package/esm/SettingWidget/StylingSettingWidget/StylingSettingWidget.d.ts.map +1 -1
  110. package/esm/SettingWidget/StylingSettingWidget/StylingSettingWidget.js +2 -6
  111. package/esm/SettingWidget/StylingSettingWidget/StylingSettingWidget.js.map +1 -1
  112. package/esm/index.d.ts +2 -0
  113. package/esm/index.d.ts.map +1 -1
  114. package/esm/index.js +1 -0
  115. package/esm/index.js.map +1 -1
  116. package/esm/measureNumberFormat/MeasureNumberFormat.d.ts +1 -2
  117. package/esm/measureNumberFormat/MeasureNumberFormat.d.ts.map +1 -1
  118. package/esm/measureNumberFormat/MeasureNumberFormat.js +6 -6
  119. package/esm/measureNumberFormat/MeasureNumberFormat.js.map +1 -1
  120. package/esm/measureNumberFormat/customFormatDialog/CustomFormatDialog.js +4 -4
  121. package/esm/measureNumberFormat/customFormatDialog/CustomFormatDialog.js.map +1 -1
  122. package/esm/measureNumberFormat/customFormatDialog/DocumentationLink.d.ts +3 -7
  123. package/esm/measureNumberFormat/customFormatDialog/DocumentationLink.d.ts.map +1 -1
  124. package/esm/measureNumberFormat/customFormatDialog/DocumentationLink.js +2 -3
  125. package/esm/measureNumberFormat/customFormatDialog/DocumentationLink.js.map +1 -1
  126. package/esm/measureNumberFormat/customFormatDialog/FormatInput.d.ts +3 -7
  127. package/esm/measureNumberFormat/customFormatDialog/FormatInput.d.ts.map +1 -1
  128. package/esm/measureNumberFormat/customFormatDialog/FormatInput.js +4 -5
  129. package/esm/measureNumberFormat/customFormatDialog/FormatInput.js.map +1 -1
  130. package/esm/measureNumberFormat/customFormatDialog/formatTemplatesDropdown/DropdownItem.d.ts +2 -2
  131. package/esm/measureNumberFormat/customFormatDialog/formatTemplatesDropdown/DropdownItem.d.ts.map +1 -1
  132. package/esm/measureNumberFormat/customFormatDialog/formatTemplatesDropdown/DropdownItem.js +2 -3
  133. package/esm/measureNumberFormat/customFormatDialog/formatTemplatesDropdown/DropdownItem.js.map +1 -1
  134. package/esm/measureNumberFormat/customFormatDialog/formatTemplatesDropdown/DropdownToggleButton.d.ts +2 -2
  135. package/esm/measureNumberFormat/customFormatDialog/formatTemplatesDropdown/DropdownToggleButton.d.ts.map +1 -1
  136. package/esm/measureNumberFormat/customFormatDialog/formatTemplatesDropdown/DropdownToggleButton.js +1 -2
  137. package/esm/measureNumberFormat/customFormatDialog/formatTemplatesDropdown/DropdownToggleButton.js.map +1 -1
  138. package/esm/measureNumberFormat/customFormatDialog/formatTemplatesDropdown/FormatTemplatesDropdown.js +2 -2
  139. package/esm/measureNumberFormat/customFormatDialog/formatTemplatesDropdown/FormatTemplatesDropdown.js.map +1 -1
  140. package/esm/measureNumberFormat/customFormatDialog/previewSection/ExtendedPreview.js +1 -1
  141. package/esm/measureNumberFormat/customFormatDialog/previewSection/ExtendedPreview.js.map +1 -1
  142. package/esm/measureNumberFormat/customFormatDialog/previewSection/Preview.d.ts +2 -7
  143. package/esm/measureNumberFormat/customFormatDialog/previewSection/Preview.d.ts.map +1 -1
  144. package/esm/measureNumberFormat/customFormatDialog/previewSection/Preview.js +3 -3
  145. package/esm/measureNumberFormat/customFormatDialog/previewSection/Preview.js.map +1 -1
  146. package/esm/measureNumberFormat/customFormatDialog/shared/PreviewRows.d.ts +1 -2
  147. package/esm/measureNumberFormat/customFormatDialog/shared/PreviewRows.d.ts.map +1 -1
  148. package/esm/measureNumberFormat/customFormatDialog/shared/PreviewRows.js +1 -2
  149. package/esm/measureNumberFormat/customFormatDialog/shared/PreviewRows.js.map +1 -1
  150. package/esm/measureNumberFormat/hooks/useCurrencyFormatDefaults.d.ts +21 -0
  151. package/esm/measureNumberFormat/hooks/useCurrencyFormatDefaults.d.ts.map +1 -0
  152. package/esm/measureNumberFormat/hooks/useCurrencyFormatDefaults.js +49 -0
  153. package/esm/measureNumberFormat/hooks/useCurrencyFormatDefaults.js.map +1 -0
  154. package/esm/measureNumberFormat/hooks/useMetricTypePresets.d.ts +115 -0
  155. package/esm/measureNumberFormat/hooks/useMetricTypePresets.d.ts.map +1 -0
  156. package/esm/measureNumberFormat/hooks/useMetricTypePresets.js +113 -0
  157. package/esm/measureNumberFormat/hooks/useMetricTypePresets.js.map +1 -0
  158. package/esm/measureNumberFormat/index.d.ts +7 -0
  159. package/esm/measureNumberFormat/index.d.ts.map +1 -1
  160. package/esm/measureNumberFormat/index.js +7 -1
  161. package/esm/measureNumberFormat/index.js.map +1 -1
  162. package/esm/measureNumberFormat/presets/currencyPresets.d.ts +34 -0
  163. package/esm/measureNumberFormat/presets/currencyPresets.d.ts.map +1 -0
  164. package/esm/measureNumberFormat/presets/currencyPresets.js +53 -0
  165. package/esm/measureNumberFormat/presets/currencyPresets.js.map +1 -0
  166. package/esm/measureNumberFormat/presets/standardPresets.d.ts +34 -0
  167. package/esm/measureNumberFormat/presets/standardPresets.d.ts.map +1 -0
  168. package/esm/measureNumberFormat/presets/standardPresets.js +71 -0
  169. package/esm/measureNumberFormat/presets/standardPresets.js.map +1 -0
  170. package/esm/measureNumberFormat/presets/templates.d.ts +60 -0
  171. package/esm/measureNumberFormat/presets/templates.d.ts.map +1 -0
  172. package/esm/measureNumberFormat/presets/templates.js +183 -0
  173. package/esm/measureNumberFormat/presets/templates.js.map +1 -0
  174. package/esm/measureNumberFormat/validation/currencyFormatValidator.d.ts +55 -0
  175. package/esm/measureNumberFormat/validation/currencyFormatValidator.d.ts.map +1 -0
  176. package/esm/measureNumberFormat/validation/currencyFormatValidator.js +118 -0
  177. package/esm/measureNumberFormat/validation/currencyFormatValidator.js.map +1 -0
  178. package/esm/sdk-ui-kit.d.ts +437 -59
  179. package/package.json +9 -9
  180. package/src/@ui/UiPaginationButton/UiPaginationButton.scss +56 -0
  181. package/src/@ui/index.scss +1 -0
  182. package/styles/css/main.css +40 -0
  183. package/styles/css/main.css.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ExtendedPreview.js","sourceRoot":"","sources":["../../../../src/measureNumberFormat/customFormatDialog/previewSection/ExtendedPreview.tsx"],"names":[],"mappings":";AAAA,qCAAqC;AAErC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAI9C,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAOnD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,eAAe,CAAC,EAAE,MAAM,EAAE,UAAU,EAAyB;IACtG,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAEzD,MAAM,mBAAmB,GAAG,WAAW,CAAC,GAAS,EAAE;QAC/C,WAAW,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACH,eAAK,SAAS,EAAC,4EAA4E,aACvF,eACI,SAAS,EAAE,EAAE,CAAC,yEAAyE,EAAE;oBACrF,MAAM,EAAE,QAAQ;iBACnB,CAAC,EACF,OAAO,EAAE,mBAAmB,aAE5B,cAAK,SAAS,EAAC,0DAA0D,GAAG,EAC5E,yBACI,KAAC,gBAAgB,IAAC,EAAE,EAAC,wDAAwD,GAAG,GAC7E,IACL,EACL,QAAQ,CAAC,CAAC,CAAC,KAAC,WAAW,IAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAI,CAAC,CAAC,CAAC,IAAI,IACxE,CACT,CAAC;AACN,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"ExtendedPreview.js","sourceRoot":"","sources":["../../../../src/measureNumberFormat/customFormatDialog/previewSection/ExtendedPreview.tsx"],"names":[],"mappings":";AAAA,qCAAqC;AAErC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAI9C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAOvD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,eAAe,CAAC,EAAE,MAAM,EAAE,UAAU,EAAyB;IACtG,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAEzD,MAAM,mBAAmB,GAAG,WAAW,CAAC,GAAS,EAAE;QAC/C,WAAW,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACH,eAAK,SAAS,EAAC,4EAA4E,aACvF,eACI,SAAS,EAAE,EAAE,CAAC,yEAAyE,EAAE;oBACrF,MAAM,EAAE,QAAQ;iBACnB,CAAC,EACF,OAAO,EAAE,mBAAmB,aAE5B,cAAK,SAAS,EAAC,0DAA0D,GAAG,EAC5E,yBACI,KAAC,gBAAgB,IAAC,EAAE,EAAC,wDAAwD,GAAG,GAC7E,IACL,EACL,QAAQ,CAAC,CAAC,CAAC,KAAC,WAAW,IAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAI,CAAC,CAAC,CAAC,IAAI,IACxE,CACT,CAAC;AACN,CAAC,CAAC,CAAC"}
@@ -1,13 +1,8 @@
1
- import { WrappedComponentProps } from "react-intl";
2
1
  import { ISeparators } from "@gooddata/sdk-ui";
3
- interface ICustomFormatPreviewOwnProps {
2
+ interface ICustomFormatPreviewProps {
4
3
  format: string;
5
4
  separators?: ISeparators;
6
5
  }
7
- type ICustomFormatPreviewProps = ICustomFormatPreviewOwnProps & WrappedComponentProps;
8
6
  export declare const Preview: import("react").NamedExoticComponent<ICustomFormatPreviewProps>;
9
- declare const _default: import("react").FC<import("react-intl").WithIntlProps<ICustomFormatPreviewProps>> & {
10
- WrappedComponent: import("react").ComponentType<ICustomFormatPreviewProps>;
11
- };
12
- export default _default;
7
+ export {};
13
8
  //# sourceMappingURL=Preview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../../../src/measureNumberFormat/customFormatDialog/previewSection/Preview.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAc,MAAM,YAAY,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAQ/C,UAAU,4BAA4B;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,WAAW,CAAC;CAC5B;AAED,KAAK,yBAAyB,GAAG,4BAA4B,GAAG,qBAAqB,CAAC;AAEtF,eAAO,MAAM,OAAO,iEAqClB,CAAC;;;;AAEH,wBAAmC"}
1
+ {"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../../../src/measureNumberFormat/customFormatDialog/previewSection/Preview.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAQ/C,UAAU,yBAAyB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,WAAW,CAAC;CAC5B;AAED,eAAO,MAAM,OAAO,iEAsClB,CAAC"}
@@ -1,18 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // (C) 2020-2025 GoodData Corporation
3
3
  import { memo, useCallback, useState } from "react";
4
- import { injectIntl } from "react-intl";
4
+ import { useIntl } from "react-intl";
5
5
  import { ExtendedPreview } from "./ExtendedPreview.js";
6
6
  import { InputWithNumberFormat } from "../../../Form/index.js";
7
7
  import { FormattedPreview } from "../shared/FormattedPreview.js";
8
8
  const DEFAULT_PREVIEW_VALUE = -1234.5678;
9
9
  export const Preview = memo(function Preview(props) {
10
10
  const [preview, setPreview] = useState(DEFAULT_PREVIEW_VALUE);
11
- const { format, separators, intl } = props;
11
+ const intl = useIntl();
12
+ const { format, separators } = props;
12
13
  const onPreviewChange = useCallback((value) => {
13
14
  setPreview(typeof value === "number" ? value : parseFloat(value) || 0);
14
15
  }, []);
15
16
  return (_jsxs("div", { className: "gd-measure-custom-format-dialog-section gd-measure-custom-format-dialog-section-preview", children: [_jsx("span", { className: "gd-measure-custom-format-dialog-section-title", children: intl.formatMessage({ id: "measureNumberCustomFormatDialog.preview" }) }), _jsxs("div", { className: "gd-measure-custom-format-dialog-preview", children: [_jsx(InputWithNumberFormat, { className: "s-custom-format-dialog-preview-input gd-measure-custom-format-dialog-preview-input", value: preview, isSmall: true, autofocus: false, onChange: onPreviewChange, separators: separators }), _jsx(FormattedPreview, { previewNumber: preview, format: format, separators: separators, className: "s-custom-format-dialog-preview-formatted gd-measure-custom-format-dialog-preview-string" })] }), _jsx(ExtendedPreview, { format: format, separators: separators })] }));
16
17
  });
17
- export default injectIntl(Preview);
18
18
  //# sourceMappingURL=Preview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Preview.js","sourceRoot":"","sources":["../../../../src/measureNumberFormat/customFormatDialog/previewSection/Preview.tsx"],"names":[],"mappings":";AAAA,qCAAqC;AAErC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAyB,UAAU,EAAE,MAAM,YAAY,CAAC;AAI/D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,qBAAqB,GAAG,CAAC,SAAS,CAAC;AASzC,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,OAAO,CAAC,KAAgC;IACzE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAS,qBAAqB,CAAC,CAAC;IAEtE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAE3C,MAAM,eAAe,GAAG,WAAW,CAAC,CAAC,KAAsB,EAAQ,EAAE;QACjE,UAAU,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACH,eACI,SAAS,EACL,yFAAyF,aAG7F,eAAM,SAAS,EAAE,+CAA+C,YAC3D,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,yCAAyC,EAAE,CAAC,GACnE,EACP,eAAK,SAAS,EAAE,yCAAyC,aACrD,KAAC,qBAAqB,IAClB,SAAS,EAAC,oFAAoF,EAC9F,KAAK,EAAE,OAAO,EACd,OAAO,QACP,SAAS,EAAE,KAAK,EAChB,QAAQ,EAAE,eAAe,EACzB,UAAU,EAAE,UAAU,GACxB,EACF,KAAC,gBAAgB,IACb,aAAa,EAAE,OAAO,EACtB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,SAAS,EAAC,yFAAyF,GACrG,IACA,EACN,KAAC,eAAe,IAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAI,IACzD,CACT,CAAC;AACN,CAAC,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"Preview.js","sourceRoot":"","sources":["../../../../src/measureNumberFormat/customFormatDialog/previewSection/Preview.tsx"],"names":[],"mappings":";AAAA,qCAAqC;AAErC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,qBAAqB,GAAG,CAAC,SAAS,CAAC;AAOzC,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,OAAO,CAAC,KAAgC;IACzE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAS,qBAAqB,CAAC,CAAC;IACtE,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IAEvB,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAErC,MAAM,eAAe,GAAG,WAAW,CAAC,CAAC,KAAsB,EAAQ,EAAE;QACjE,UAAU,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACH,eACI,SAAS,EACL,yFAAyF,aAG7F,eAAM,SAAS,EAAE,+CAA+C,YAC3D,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,yCAAyC,EAAE,CAAC,GACnE,EACP,eAAK,SAAS,EAAE,yCAAyC,aACrD,KAAC,qBAAqB,IAClB,SAAS,EAAC,oFAAoF,EAC9F,KAAK,EAAE,OAAO,EACd,OAAO,QACP,SAAS,EAAE,KAAK,EAChB,QAAQ,EAAE,eAAe,EACzB,UAAU,EAAE,UAAU,GACxB,EACF,KAAC,gBAAgB,IACb,aAAa,EAAE,OAAO,EACtB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,SAAS,EAAC,yFAAyF,GACrG,IACA,EACN,KAAC,eAAe,IAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAI,IACzD,CACT,CAAC;AACN,CAAC,CAAC,CAAC"}
@@ -4,6 +4,5 @@ export interface IPreviewNumberRowsProps {
4
4
  format: string;
5
5
  separators?: ISeparators;
6
6
  }
7
- declare function PreviewRows({ previewNumbers, format, separators, }: IPreviewNumberRowsProps): import("react/jsx-runtime").JSX.Element;
8
- export default PreviewRows;
7
+ export declare function PreviewRows({ previewNumbers, format, separators, }: IPreviewNumberRowsProps): import("react/jsx-runtime").JSX.Element;
9
8
  //# sourceMappingURL=PreviewRows.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PreviewRows.d.ts","sourceRoot":"","sources":["../../../../src/measureNumberFormat/customFormatDialog/shared/PreviewRows.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA0B/C,MAAM,WAAW,uBAAuB;IACpC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,WAAW,CAAC;CAC5B;AAED,iBAAS,WAAW,CAAC,EACjB,cAAkD,EAClD,MAAM,EACN,UAAU,GACb,EAAE,uBAAuB,2CAazB;AAED,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"PreviewRows.d.ts","sourceRoot":"","sources":["../../../../src/measureNumberFormat/customFormatDialog/shared/PreviewRows.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA0B/C,MAAM,WAAW,uBAAuB;IACpC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,WAAW,CAAC;CAC5B;AAED,wBAAgB,WAAW,CAAC,EACxB,cAAkD,EAClD,MAAM,EACN,UAAU,GACb,EAAE,uBAAuB,2CAazB"}
@@ -3,8 +3,7 @@ import { FormattedPreview } from "./FormattedPreview.js";
3
3
  function PreviewNumberRow({ previewNumber, format, separators }) {
4
4
  return (_jsxs("div", { className: "gd-measure-format-extended-preview-row", children: [_jsx("div", { className: "gd-measure-format-extended-preview-number", children: _jsx("span", { children: previewNumber }) }), _jsx(FormattedPreview, { previewNumber: previewNumber, format: format, separators: separators, className: "s-number-format-preview-formatted gd-measure-format-extended-preview-formatted" })] }));
5
5
  }
6
- function PreviewRows({ previewNumbers = [0, 1.234, 1234.567, 1234567.891], format, separators, }) {
6
+ export function PreviewRows({ previewNumbers = [0, 1.234, 1234.567, 1234567.891], format, separators, }) {
7
7
  return (_jsx(_Fragment, { children: previewNumbers.map((previewNumber) => (_jsx(PreviewNumberRow, { previewNumber: previewNumber, separators: separators, format: format }, previewNumber))) }));
8
8
  }
9
- export default PreviewRows;
10
9
  //# sourceMappingURL=PreviewRows.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PreviewRows.js","sourceRoot":"","sources":["../../../../src/measureNumberFormat/customFormatDialog/shared/PreviewRows.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAQzD,SAAS,gBAAgB,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAA0B;IACnF,OAAO,CACH,eAAK,SAAS,EAAC,wCAAwC,aACnD,cAAK,SAAS,EAAC,2CAA2C,YACtD,yBAAO,aAAa,GAAQ,GAC1B,EACN,KAAC,gBAAgB,IACb,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,SAAS,EAAC,gFAAgF,GAC5F,IACA,CACT,CAAC;AACN,CAAC;AAQD,SAAS,WAAW,CAAC,EACjB,cAAc,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,EAClD,MAAM,EACN,UAAU,GACY;IACtB,OAAO,CACH,4BACK,cAAc,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,CACnC,KAAC,gBAAgB,IACb,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EAEtB,MAAM,EAAE,MAAM,IADT,aAAa,CAEpB,CACL,CAAC,GACH,CACN,CAAC;AACN,CAAC;AAED,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"PreviewRows.js","sourceRoot":"","sources":["../../../../src/measureNumberFormat/customFormatDialog/shared/PreviewRows.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAQzD,SAAS,gBAAgB,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAA0B;IACnF,OAAO,CACH,eAAK,SAAS,EAAC,wCAAwC,aACnD,cAAK,SAAS,EAAC,2CAA2C,YACtD,yBAAO,aAAa,GAAQ,GAC1B,EACN,KAAC,gBAAgB,IACb,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,SAAS,EAAC,gFAAgF,GAC5F,IACA,CACT,CAAC;AACN,CAAC;AAQD,MAAM,UAAU,WAAW,CAAC,EACxB,cAAc,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,EAClD,MAAM,EACN,UAAU,GACY;IACtB,OAAO,CACH,4BACK,cAAc,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,CACnC,KAAC,gBAAgB,IACb,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EAEtB,MAAM,EAAE,MAAM,IADT,aAAa,CAEpB,CACL,CAAC,GACH,CACN,CAAC;AACN,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { MetricType } from "@gooddata/sdk-model";
2
+ /** @internal */
3
+ export interface UseCurrencyFormatDefaultsConfig {
4
+ metricType?: MetricType;
5
+ normalizedFormat: string | null;
6
+ currencyFormatOverride?: string | null;
7
+ presetFormats: string[];
8
+ hasInheritPreset: boolean;
9
+ onFormatChange: (format: string | null) => void;
10
+ shouldBootstrap: boolean;
11
+ fallbackFormat?: string;
12
+ }
13
+ /**
14
+ * @internal
15
+ *
16
+ * Ensures that currency metrics default to a meaningful preset instead of falling back to custom formats.
17
+ * - When no format is set yet, it applies the inherited override or the standard currency preset.
18
+ * - When switching to currency with an incompatible format, it coerces the format to a supported preset.
19
+ */
20
+ export declare function useCurrencyFormatDefaults({ metricType, normalizedFormat, currencyFormatOverride, presetFormats, hasInheritPreset, onFormatChange, shouldBootstrap, fallbackFormat, }: UseCurrencyFormatDefaultsConfig): void;
21
+ //# sourceMappingURL=useCurrencyFormatDefaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCurrencyFormatDefaults.d.ts","sourceRoot":"","sources":["../../../src/measureNumberFormat/hooks/useCurrencyFormatDefaults.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAItD,gBAAgB;AAChB,MAAM,WAAW,+BAA+B;IAC5C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,EACtC,UAAU,EACV,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,cAAwC,GAC3C,EAAE,+BAA+B,QAkCjC"}
@@ -0,0 +1,49 @@
1
+ // (C) 2025 GoodData Corporation
2
+ import { useEffect, useRef } from "react";
3
+ const DEFAULT_CURRENCY_FORMAT = "$#,##0.00";
4
+ /**
5
+ * @internal
6
+ *
7
+ * Ensures that currency metrics default to a meaningful preset instead of falling back to custom formats.
8
+ * - When no format is set yet, it applies the inherited override or the standard currency preset.
9
+ * - When switching to currency with an incompatible format, it coerces the format to a supported preset.
10
+ */
11
+ export function useCurrencyFormatDefaults({ metricType, normalizedFormat, currencyFormatOverride, presetFormats, hasInheritPreset, onFormatChange, shouldBootstrap, fallbackFormat = DEFAULT_CURRENCY_FORMAT, }) {
12
+ const previousMetricType = usePreviousMetricType(metricType);
13
+ useEffect(() => {
14
+ if (metricType !== "CURRENCY" || !shouldBootstrap) {
15
+ return;
16
+ }
17
+ onFormatChange(resolveDefaultFormat(currencyFormatOverride, fallbackFormat));
18
+ }, [currencyFormatOverride, fallbackFormat, metricType, onFormatChange, shouldBootstrap]);
19
+ useEffect(() => {
20
+ if (metricType !== "CURRENCY" || previousMetricType === "CURRENCY") {
21
+ return;
22
+ }
23
+ const matchesCurrencyPreset = normalizedFormat === null ? hasInheritPreset : presetFormats.includes(normalizedFormat);
24
+ if (matchesCurrencyPreset) {
25
+ return;
26
+ }
27
+ onFormatChange(resolveDefaultFormat(currencyFormatOverride, fallbackFormat));
28
+ }, [
29
+ currencyFormatOverride,
30
+ fallbackFormat,
31
+ hasInheritPreset,
32
+ metricType,
33
+ normalizedFormat,
34
+ onFormatChange,
35
+ presetFormats,
36
+ previousMetricType,
37
+ ]);
38
+ }
39
+ function resolveDefaultFormat(currencyFormatOverride, fallbackFormat) {
40
+ return currencyFormatOverride ? null : fallbackFormat;
41
+ }
42
+ function usePreviousMetricType(metricType) {
43
+ const ref = useRef(undefined);
44
+ useEffect(() => {
45
+ ref.current = metricType;
46
+ }, [metricType]);
47
+ return ref.current;
48
+ }
49
+ //# sourceMappingURL=useCurrencyFormatDefaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCurrencyFormatDefaults.js","sourceRoot":"","sources":["../../../src/measureNumberFormat/hooks/useCurrencyFormatDefaults.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAI1C,MAAM,uBAAuB,GAAG,WAAW,CAAC;AAc5C;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,EACtC,UAAU,EACV,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,cAAc,GAAG,uBAAuB,GACV;IAC9B,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAE7D,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,UAAU,KAAK,UAAU,IAAI,CAAC,eAAe,EAAE,CAAC;YAChD,OAAO;QACX,CAAC;QAED,cAAc,CAAC,oBAAoB,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC,CAAC;IACjF,CAAC,EAAE,CAAC,sBAAsB,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC;IAE1F,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,UAAU,KAAK,UAAU,IAAI,kBAAkB,KAAK,UAAU,EAAE,CAAC;YACjE,OAAO;QACX,CAAC;QAED,MAAM,qBAAqB,GACvB,gBAAgB,KAAK,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QAE5F,IAAI,qBAAqB,EAAE,CAAC;YACxB,OAAO;QACX,CAAC;QAED,cAAc,CAAC,oBAAoB,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC,CAAC;IACjF,CAAC,EAAE;QACC,sBAAsB;QACtB,cAAc;QACd,gBAAgB;QAChB,UAAU;QACV,gBAAgB;QAChB,cAAc;QACd,aAAa;QACb,kBAAkB;KACrB,CAAC,CAAC;AACP,CAAC;AAED,SAAS,oBAAoB,CAAC,sBAAiD,EAAE,cAAsB;IACnG,OAAO,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC;AAC1D,CAAC;AAED,SAAS,qBAAqB,CAAC,UAAkC;IAC7D,MAAM,GAAG,GAAG,MAAM,CAAyB,SAAS,CAAC,CAAC;IACtD,SAAS,CAAC,GAAG,EAAE;QACX,GAAG,CAAC,OAAO,GAAG,UAAU,CAAC;IAC7B,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IACjB,OAAO,GAAG,CAAC,OAAO,CAAC;AACvB,CAAC"}
@@ -0,0 +1,115 @@
1
+ import type { MetricType } from "@gooddata/sdk-model";
2
+ import { type IFormatPreset, type IFormatTemplate } from "../typings.js";
3
+ /**
4
+ * Configuration for the useMetricTypePresets hook.
5
+ * @internal
6
+ */
7
+ export interface UseMetricTypePresetsConfig {
8
+ /**
9
+ * The metric type. When "CURRENCY", currency-specific presets are shown.
10
+ * When undefined, standard numeric presets are shown.
11
+ */
12
+ metricType?: MetricType;
13
+ /**
14
+ * The currency format override from workspace settings.
15
+ * When set and metricType is "CURRENCY", an "inherit" preset is added.
16
+ */
17
+ currencyFormatOverride?: string | null;
18
+ /**
19
+ * Function to format localized messages (e.g., from react-intl).
20
+ */
21
+ formatMessage: (descriptor: {
22
+ id: string;
23
+ }) => string;
24
+ /**
25
+ * Optional prefix for preset message IDs.
26
+ * Default: "metricComponent.numberFormat.preset"
27
+ *
28
+ * Use this to customize the translation keys for presets.
29
+ * For example, set to "measure_number_format.preset" for Analytical Designer compatibility.
30
+ */
31
+ presetMessageIdPrefix?: string;
32
+ /**
33
+ * Optional prefix for template message IDs.
34
+ * Default: "metricComponent.numberFormat.template"
35
+ *
36
+ * Use this to customize the translation keys for templates.
37
+ * For example, set to "measure_number_format.template" for Analytical Designer compatibility.
38
+ */
39
+ templateMessageIdPrefix?: string;
40
+ }
41
+ /**
42
+ * Result from the useMetricTypePresets hook.
43
+ * @internal
44
+ */
45
+ export interface UseMetricTypePresetsResult {
46
+ /**
47
+ * Format presets based on metric type.
48
+ * For CURRENCY: currency presets with optional inherit preset.
49
+ * For other types: standard numeric presets.
50
+ */
51
+ presets: IFormatPreset[];
52
+ /**
53
+ * Format templates. For CURRENCY metrics, currency templates are excluded
54
+ * from the general list (they're already in presets).
55
+ */
56
+ templates: IFormatTemplate[];
57
+ /**
58
+ * The inherit preset if available (only for CURRENCY with override).
59
+ */
60
+ inheritPreset: IFormatPreset | null;
61
+ }
62
+ /**
63
+ * Hook that creates format presets and templates based on metric type.
64
+ *
65
+ * This hook encapsulates the logic for building format options that respect:
66
+ * - Metric type (CURRENCY vs standard)
67
+ * - Currency format override (creates "inherit" preset)
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * const { presets, templates, inheritPreset } = useMetricTypePresets({
72
+ * metricType: "CURRENCY",
73
+ * currencyFormatOverride: "$#,##0.00",
74
+ * formatMessage: (d) => intl.formatMessage(d),
75
+ * });
76
+ * ```
77
+ *
78
+ * @example
79
+ * ```tsx
80
+ * // With custom message ID prefixes (e.g., for Analytical Designer)
81
+ * const { presets, templates } = useMetricTypePresets({
82
+ * metricType: undefined,
83
+ * formatMessage: (d) => intl.formatMessage(d),
84
+ * presetMessageIdPrefix: "measure_number_format.preset",
85
+ * templateMessageIdPrefix: "measure_number_format.template",
86
+ * });
87
+ * ```
88
+ *
89
+ * @internal
90
+ */
91
+ export declare function useMetricTypePresets({ metricType, currencyFormatOverride, formatMessage, presetMessageIdPrefix, templateMessageIdPrefix, }: UseMetricTypePresetsConfig): UseMetricTypePresetsResult;
92
+ /**
93
+ * Hook that creates standard numeric format presets.
94
+ * Use this when you don't need metric type awareness.
95
+ *
96
+ * @param formatMessage - Function to format localized messages
97
+ * @returns Array of standard format presets
98
+ * @internal
99
+ */
100
+ export declare function useStandardPresets(formatMessage: (descriptor: {
101
+ id: string;
102
+ }) => string): IFormatPreset[];
103
+ /**
104
+ * Hook that creates all format templates.
105
+ * Use this when you need templates without metric type filtering.
106
+ *
107
+ * @param formatMessage - Function to format localized messages
108
+ * @param excludeCurrencyTemplates - Whether to exclude currency-specific templates
109
+ * @returns Array of format templates
110
+ * @internal
111
+ */
112
+ export declare function useFormatTemplates(formatMessage: (descriptor: {
113
+ id: string;
114
+ }) => string, excludeCurrencyTemplates?: boolean): IFormatTemplate[];
115
+ //# sourceMappingURL=useMetricTypePresets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMetricTypePresets.d.ts","sourceRoot":"","sources":["../../../src/measureNumberFormat/hooks/useMetricTypePresets.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKtD,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAEzE;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvC;;OAEG;IACH,aAAa,EAAE,CAAC,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;IAEtD;;;;;;OAMG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACvC;;;;OAIG;IACH,OAAO,EAAE,aAAa,EAAE,CAAC;IAEzB;;;OAGG;IACH,SAAS,EAAE,eAAe,EAAE,CAAC;IAE7B;;OAEG;IACH,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,oBAAoB,CAAC,EACjC,UAAU,EACV,sBAAsB,EACtB,aAAa,EACb,qBAAsD,EACtD,uBAAiD,GACpD,EAAE,0BAA0B,GAAG,0BAA0B,CA8DzD;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,CAAC,UAAU,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,KAAK,MAAM,GAAG,aAAa,EAAE,CAEzG;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAC9B,aAAa,EAAE,CAAC,UAAU,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,KAAK,MAAM,EACrD,wBAAwB,UAAQ,GACjC,eAAe,EAAE,CAQnB"}
@@ -0,0 +1,113 @@
1
+ // (C) 2025 GoodData Corporation
2
+ import { useMemo } from "react";
3
+ import { createCurrencyPresets } from "../presets/currencyPresets.js";
4
+ import { DEFAULT_STANDARD_PRESET_PREFIX, createStandardPresets } from "../presets/standardPresets.js";
5
+ import { CURRENCY_TEMPLATE_IDS, DEFAULT_TEMPLATE_PREFIX, createAllTemplates } from "../presets/templates.js";
6
+ /**
7
+ * Hook that creates format presets and templates based on metric type.
8
+ *
9
+ * This hook encapsulates the logic for building format options that respect:
10
+ * - Metric type (CURRENCY vs standard)
11
+ * - Currency format override (creates "inherit" preset)
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * const { presets, templates, inheritPreset } = useMetricTypePresets({
16
+ * metricType: "CURRENCY",
17
+ * currencyFormatOverride: "$#,##0.00",
18
+ * formatMessage: (d) => intl.formatMessage(d),
19
+ * });
20
+ * ```
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * // With custom message ID prefixes (e.g., for Analytical Designer)
25
+ * const { presets, templates } = useMetricTypePresets({
26
+ * metricType: undefined,
27
+ * formatMessage: (d) => intl.formatMessage(d),
28
+ * presetMessageIdPrefix: "measure_number_format.preset",
29
+ * templateMessageIdPrefix: "measure_number_format.template",
30
+ * });
31
+ * ```
32
+ *
33
+ * @internal
34
+ */
35
+ export function useMetricTypePresets({ metricType, currencyFormatOverride, formatMessage, presetMessageIdPrefix = DEFAULT_STANDARD_PRESET_PREFIX, templateMessageIdPrefix = DEFAULT_TEMPLATE_PREFIX, }) {
36
+ // Standard numeric presets
37
+ const standardPresets = useMemo(() => createStandardPresets(formatMessage, presetMessageIdPrefix), [formatMessage, presetMessageIdPrefix]);
38
+ // Base currency presets
39
+ const baseCurrencyPresets = useMemo(() => createCurrencyPresets(formatMessage, presetMessageIdPrefix), [formatMessage, presetMessageIdPrefix]);
40
+ // Currency presets, excluding the override format if it matches a preset
41
+ const currencyPresets = useMemo(() => {
42
+ if (!currencyFormatOverride) {
43
+ return baseCurrencyPresets;
44
+ }
45
+ return baseCurrencyPresets.filter((preset) => preset.format !== currencyFormatOverride);
46
+ }, [baseCurrencyPresets, currencyFormatOverride]);
47
+ // Inherit preset - only for CURRENCY when override exists
48
+ const inheritPreset = useMemo(() => {
49
+ if (metricType === "CURRENCY" && currencyFormatOverride) {
50
+ return {
51
+ name: formatMessage({ id: `${presetMessageIdPrefix}.inherit` }),
52
+ localIdentifier: "inherit",
53
+ format: currencyFormatOverride,
54
+ previewNumber: 1000.12,
55
+ };
56
+ }
57
+ return null;
58
+ }, [metricType, currencyFormatOverride, formatMessage, presetMessageIdPrefix]);
59
+ // Final presets based on metric type
60
+ const presets = useMemo(() => {
61
+ if (metricType === "CURRENCY") {
62
+ if (inheritPreset) {
63
+ return [inheritPreset, ...currencyPresets];
64
+ }
65
+ return currencyPresets;
66
+ }
67
+ return standardPresets;
68
+ }, [metricType, standardPresets, currencyPresets, inheritPreset]);
69
+ // Templates - for CURRENCY, show ONLY currency templates
70
+ const templates = useMemo(() => {
71
+ if (metricType === "CURRENCY") {
72
+ // For CURRENCY metrics, show only currency-specific templates
73
+ return createAllTemplates(formatMessage, templateMessageIdPrefix).filter((t) => CURRENCY_TEMPLATE_IDS.includes(t.localIdentifier));
74
+ }
75
+ // For non-CURRENCY, show all templates
76
+ return createAllTemplates(formatMessage, templateMessageIdPrefix);
77
+ }, [metricType, formatMessage, templateMessageIdPrefix]);
78
+ return {
79
+ presets,
80
+ templates,
81
+ inheritPreset,
82
+ };
83
+ }
84
+ /**
85
+ * Hook that creates standard numeric format presets.
86
+ * Use this when you don't need metric type awareness.
87
+ *
88
+ * @param formatMessage - Function to format localized messages
89
+ * @returns Array of standard format presets
90
+ * @internal
91
+ */
92
+ export function useStandardPresets(formatMessage) {
93
+ return useMemo(() => createStandardPresets(formatMessage), [formatMessage]);
94
+ }
95
+ /**
96
+ * Hook that creates all format templates.
97
+ * Use this when you need templates without metric type filtering.
98
+ *
99
+ * @param formatMessage - Function to format localized messages
100
+ * @param excludeCurrencyTemplates - Whether to exclude currency-specific templates
101
+ * @returns Array of format templates
102
+ * @internal
103
+ */
104
+ export function useFormatTemplates(formatMessage, excludeCurrencyTemplates = false) {
105
+ return useMemo(() => {
106
+ const allTemplates = createAllTemplates(formatMessage);
107
+ if (excludeCurrencyTemplates) {
108
+ return allTemplates.filter((t) => !CURRENCY_TEMPLATE_IDS.includes(t.localIdentifier));
109
+ }
110
+ return allTemplates;
111
+ }, [formatMessage, excludeCurrencyTemplates]);
112
+ }
113
+ //# sourceMappingURL=useMetricTypePresets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMetricTypePresets.js","sourceRoot":"","sources":["../../../src/measureNumberFormat/hooks/useMetricTypePresets.ts"],"names":[],"mappings":"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"}
@@ -1,4 +1,11 @@
1
1
  export * from "./typings.js";
2
2
  export type { IMeasureNumberFormatOwnProps } from "./MeasureNumberFormat.js";
3
3
  export { MeasureNumberFormat } from "./MeasureNumberFormat.js";
4
+ export { validateCurrencyFormat, isCurrencyFormat, type CurrencyFormatValidationErrorCode, type ICurrencyFormatValidationError, type ICurrencyFormatValidationOptions, type ICurrencyFormatValidationResult, } from "./validation/currencyFormatValidator.js";
5
+ export { useCurrencyFormatDefaults } from "./hooks/useCurrencyFormatDefaults.js";
6
+ export type { UseCurrencyFormatDefaultsConfig } from "./hooks/useCurrencyFormatDefaults.js";
7
+ export { createCurrencyPresets, CURRENCY_PRESET_DEFINITIONS, DEFAULT_CURRENCY_PRESET_PREFIX, type ICurrencyPresetDefinition, } from "./presets/currencyPresets.js";
8
+ export { createStandardPresets, STANDARD_PRESET_DEFINITIONS, DEFAULT_STANDARD_PRESET_PREFIX, type IStandardPresetDefinition, } from "./presets/standardPresets.js";
9
+ export { createTemplates, createAllTemplates, STANDARD_TEMPLATE_DEFINITIONS, CURRENCY_TEMPLATE_DEFINITIONS, ADVANCED_TEMPLATE_DEFINITIONS, CURRENCY_TEMPLATE_IDS, DEFAULT_TEMPLATE_PREFIX, type ITemplateDefinition, } from "./presets/templates.js";
10
+ export { useMetricTypePresets, useStandardPresets, useFormatTemplates, type UseMetricTypePresetsConfig, type UseMetricTypePresetsResult, } from "./hooks/useMetricTypePresets.js";
4
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/measureNumberFormat/index.ts"],"names":[],"mappings":"AAEA,cAAc,cAAc,CAAC;AAC7B,YAAY,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/measureNumberFormat/index.ts"],"names":[],"mappings":"AAEA,cAAc,cAAc,CAAC;AAC7B,YAAY,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,KAAK,iCAAiC,EACtC,KAAK,8BAA8B,EACnC,KAAK,gCAAgC,EACrC,KAAK,+BAA+B,GACvC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,YAAY,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAC5F,OAAO,EACH,qBAAqB,EACrB,2BAA2B,EAC3B,8BAA8B,EAC9B,KAAK,yBAAyB,GACjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACH,qBAAqB,EACrB,2BAA2B,EAC3B,8BAA8B,EAC9B,KAAK,yBAAyB,GACjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACH,eAAe,EACf,kBAAkB,EAClB,6BAA6B,EAC7B,6BAA6B,EAC7B,6BAA6B,EAC7B,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,mBAAmB,GAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACH,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,GAClC,MAAM,iCAAiC,CAAC"}
@@ -1,4 +1,10 @@
1
- // (C) 2020-2024 GoodData Corporation
1
+ // (C) 2020-2025 GoodData Corporation
2
2
  export * from "./typings.js";
3
3
  export { MeasureNumberFormat } from "./MeasureNumberFormat.js";
4
+ export { validateCurrencyFormat, isCurrencyFormat, } from "./validation/currencyFormatValidator.js";
5
+ export { useCurrencyFormatDefaults } from "./hooks/useCurrencyFormatDefaults.js";
6
+ export { createCurrencyPresets, CURRENCY_PRESET_DEFINITIONS, DEFAULT_CURRENCY_PRESET_PREFIX, } from "./presets/currencyPresets.js";
7
+ export { createStandardPresets, STANDARD_PRESET_DEFINITIONS, DEFAULT_STANDARD_PRESET_PREFIX, } from "./presets/standardPresets.js";
8
+ export { createTemplates, createAllTemplates, STANDARD_TEMPLATE_DEFINITIONS, CURRENCY_TEMPLATE_DEFINITIONS, ADVANCED_TEMPLATE_DEFINITIONS, CURRENCY_TEMPLATE_IDS, DEFAULT_TEMPLATE_PREFIX, } from "./presets/templates.js";
9
+ export { useMetricTypePresets, useStandardPresets, useFormatTemplates, } from "./hooks/useMetricTypePresets.js";
4
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/measureNumberFormat/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/measureNumberFormat/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACH,sBAAsB,EACtB,gBAAgB,GAKnB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,EACH,qBAAqB,EACrB,2BAA2B,EAC3B,8BAA8B,GAEjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACH,qBAAqB,EACrB,2BAA2B,EAC3B,8BAA8B,GAEjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACH,eAAe,EACf,kBAAkB,EAClB,6BAA6B,EAC7B,6BAA6B,EAC7B,6BAA6B,EAC7B,qBAAqB,EACrB,uBAAuB,GAE1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACH,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,GAGrB,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { type IFormatPreset } from "../typings.js";
2
+ /**
3
+ * Base currency preset definitions without localized names.
4
+ * @internal
5
+ */
6
+ export interface ICurrencyPresetDefinition {
7
+ localIdentifier: string;
8
+ format: string;
9
+ previewNumber: number;
10
+ messageId: string;
11
+ }
12
+ /**
13
+ * Base currency preset definitions.
14
+ * These are the raw preset data that can be used to create localized presets.
15
+ * @internal
16
+ */
17
+ export declare const CURRENCY_PRESET_DEFINITIONS: readonly ICurrencyPresetDefinition[];
18
+ /**
19
+ * Default message ID prefix for currency preset definitions.
20
+ * @internal
21
+ */
22
+ export declare const DEFAULT_CURRENCY_PRESET_PREFIX = "metricComponent.numberFormat.preset";
23
+ /**
24
+ * Creates localized currency format presets.
25
+ *
26
+ * @param formatMessage - Function to format localized messages (e.g., from react-intl)
27
+ * @param messageIdPrefix - Optional prefix for message IDs (default: "metricComponent.numberFormat.preset")
28
+ * @returns Array of currency format presets with localized names
29
+ * @internal
30
+ */
31
+ export declare function createCurrencyPresets(formatMessage: (descriptor: {
32
+ id: string;
33
+ }) => string, messageIdPrefix?: string): IFormatPreset[];
34
+ //# sourceMappingURL=currencyPresets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"currencyPresets.d.ts","sourceRoot":"","sources":["../../../src/measureNumberFormat/presets/currencyPresets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACtC,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,SAAS,yBAAyB,EAmBlE,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,8BAA8B,wCAAwC,CAAC;AAEpF;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACjC,aAAa,EAAE,CAAC,UAAU,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,KAAK,MAAM,EACrD,eAAe,GAAE,MAAuC,GACzD,aAAa,EAAE,CAYjB"}
@@ -0,0 +1,53 @@
1
+ // (C) 2025 GoodData Corporation
2
+ /**
3
+ * Base currency preset definitions.
4
+ * These are the raw preset data that can be used to create localized presets.
5
+ * @internal
6
+ */
7
+ export const CURRENCY_PRESET_DEFINITIONS = [
8
+ {
9
+ localIdentifier: "currency",
10
+ format: "$#,##0.00",
11
+ previewNumber: 1000.12,
12
+ messageId: "metricComponent.numberFormat.preset.currency",
13
+ },
14
+ {
15
+ localIdentifier: "currency-single-decimal",
16
+ format: "$#,##0.0",
17
+ previewNumber: 1000.12,
18
+ messageId: "metricComponent.numberFormat.preset.currency1",
19
+ },
20
+ {
21
+ localIdentifier: "currency-rounded",
22
+ format: "$#,##0",
23
+ previewNumber: 1000.12,
24
+ messageId: "metricComponent.numberFormat.preset.currencyRounded",
25
+ },
26
+ ];
27
+ /**
28
+ * Default message ID prefix for currency preset definitions.
29
+ * @internal
30
+ */
31
+ export const DEFAULT_CURRENCY_PRESET_PREFIX = "metricComponent.numberFormat.preset";
32
+ /**
33
+ * Creates localized currency format presets.
34
+ *
35
+ * @param formatMessage - Function to format localized messages (e.g., from react-intl)
36
+ * @param messageIdPrefix - Optional prefix for message IDs (default: "metricComponent.numberFormat.preset")
37
+ * @returns Array of currency format presets with localized names
38
+ * @internal
39
+ */
40
+ export function createCurrencyPresets(formatMessage, messageIdPrefix = DEFAULT_CURRENCY_PRESET_PREFIX) {
41
+ return CURRENCY_PRESET_DEFINITIONS.map((definition) => {
42
+ // Extract the key part from the default message ID (e.g., "currency" from "metricComponent.numberFormat.preset.currency")
43
+ const keyPart = definition.messageId.replace(`${DEFAULT_CURRENCY_PRESET_PREFIX}.`, "");
44
+ const messageId = `${messageIdPrefix}.${keyPart}`;
45
+ return {
46
+ name: formatMessage({ id: messageId }),
47
+ localIdentifier: definition.localIdentifier,
48
+ format: definition.format,
49
+ previewNumber: definition.previewNumber,
50
+ };
51
+ });
52
+ }
53
+ //# sourceMappingURL=currencyPresets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"currencyPresets.js","sourceRoot":"","sources":["../../../src/measureNumberFormat/presets/currencyPresets.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAehC;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAyC;IAC7E;QACI,eAAe,EAAE,UAAU;QAC3B,MAAM,EAAE,WAAW;QACnB,aAAa,EAAE,OAAO;QACtB,SAAS,EAAE,8CAA8C;KAC5D;IACD;QACI,eAAe,EAAE,yBAAyB;QAC1C,MAAM,EAAE,UAAU;QAClB,aAAa,EAAE,OAAO;QACtB,SAAS,EAAE,+CAA+C;KAC7D;IACD;QACI,eAAe,EAAE,kBAAkB;QACnC,MAAM,EAAE,QAAQ;QAChB,aAAa,EAAE,OAAO;QACtB,SAAS,EAAE,qDAAqD;KACnE;CACK,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,qCAAqC,CAAC;AAEpF;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACjC,aAAqD,EACrD,kBAA0B,8BAA8B;IAExD,OAAO,2BAA2B,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;QAClD,0HAA0H;QAC1H,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,8BAA8B,GAAG,EAAE,EAAE,CAAC,CAAC;QACvF,MAAM,SAAS,GAAG,GAAG,eAAe,IAAI,OAAO,EAAE,CAAC;QAClD,OAAO;YACH,IAAI,EAAE,aAAa,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;YACtC,eAAe,EAAE,UAAU,CAAC,eAAe;YAC3C,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,aAAa,EAAE,UAAU,CAAC,aAAa;SAC1C,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { type IFormatPreset } from "../typings.js";
2
+ /**
3
+ * Base standard preset definition without localized name.
4
+ * @internal
5
+ */
6
+ export interface IStandardPresetDefinition {
7
+ localIdentifier: string;
8
+ format: string;
9
+ previewNumber: number;
10
+ messageId: string;
11
+ }
12
+ /**
13
+ * Standard numeric preset definitions.
14
+ * These are the raw preset data that can be used to create localized presets.
15
+ * @internal
16
+ */
17
+ export declare const STANDARD_PRESET_DEFINITIONS: readonly IStandardPresetDefinition[];
18
+ /**
19
+ * Default message ID prefix for standard preset definitions.
20
+ * @internal
21
+ */
22
+ export declare const DEFAULT_STANDARD_PRESET_PREFIX = "metricComponent.numberFormat.preset";
23
+ /**
24
+ * Creates localized standard format presets.
25
+ *
26
+ * @param formatMessage - Function to format localized messages (e.g., from react-intl)
27
+ * @param messageIdPrefix - Optional prefix for message IDs (default: "metricComponent.numberFormat.preset")
28
+ * @returns Array of standard format presets with localized names
29
+ * @internal
30
+ */
31
+ export declare function createStandardPresets(formatMessage: (descriptor: {
32
+ id: string;
33
+ }) => string, messageIdPrefix?: string): IFormatPreset[];
34
+ //# sourceMappingURL=standardPresets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standardPresets.d.ts","sourceRoot":"","sources":["../../../src/measureNumberFormat/presets/standardPresets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACtC,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,SAAS,yBAAyB,EAqClE,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,8BAA8B,wCAAwC,CAAC;AAEpF;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACjC,aAAa,EAAE,CAAC,UAAU,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,KAAK,MAAM,EACrD,eAAe,GAAE,MAAuC,GACzD,aAAa,EAAE,CAYjB"}