@gooddata/sdk-ui-kit 11.13.0-alpha.2 → 11.13.0-alpha.4

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 (45) hide show
  1. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableCheckbox.js +1 -1
  2. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableCheckbox.js.map +1 -1
  3. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableToolbar.js +2 -2
  4. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableToolbar.js.map +1 -1
  5. package/esm/@ui/UiCheckbox/UiCheckbox.d.ts.map +1 -1
  6. package/esm/@ui/UiCheckbox/UiCheckbox.js +9 -1
  7. package/esm/@ui/UiCheckbox/UiCheckbox.js.map +1 -1
  8. package/esm/Dropdown/DropdownButton.js +1 -1
  9. package/esm/Dropdown/DropdownButton.js.map +1 -1
  10. package/esm/Dropdown/DropdownInvertableSelect.d.ts.map +1 -1
  11. package/esm/Dropdown/DropdownInvertableSelect.js +1 -1
  12. package/esm/Dropdown/DropdownInvertableSelect.js.map +1 -1
  13. package/esm/Dropdown/DropdownList.d.ts.map +1 -1
  14. package/esm/Dropdown/DropdownList.js +6 -2
  15. package/esm/Dropdown/DropdownList.js.map +1 -1
  16. package/esm/List/InvertableSelect/InvertableSelect.d.ts +3 -1
  17. package/esm/List/InvertableSelect/InvertableSelect.d.ts.map +1 -1
  18. package/esm/List/InvertableSelect/InvertableSelect.js +18 -4
  19. package/esm/List/InvertableSelect/InvertableSelect.js.map +1 -1
  20. package/esm/List/InvertableSelect/InvertableSelectSearchBar.d.ts +3 -1
  21. package/esm/List/InvertableSelect/InvertableSelectSearchBar.d.ts.map +1 -1
  22. package/esm/List/InvertableSelect/InvertableSelectSearchBar.js +2 -3
  23. package/esm/List/InvertableSelect/InvertableSelectSearchBar.js.map +1 -1
  24. package/esm/measureNumberFormat/hooks/useMetricTypePresets.d.ts +115 -0
  25. package/esm/measureNumberFormat/hooks/useMetricTypePresets.d.ts.map +1 -0
  26. package/esm/measureNumberFormat/hooks/useMetricTypePresets.js +113 -0
  27. package/esm/measureNumberFormat/hooks/useMetricTypePresets.js.map +1 -0
  28. package/esm/measureNumberFormat/index.d.ts +4 -1
  29. package/esm/measureNumberFormat/index.d.ts.map +1 -1
  30. package/esm/measureNumberFormat/index.js +4 -1
  31. package/esm/measureNumberFormat/index.js.map +1 -1
  32. package/esm/measureNumberFormat/presets/currencyPresets.d.ts +7 -1
  33. package/esm/measureNumberFormat/presets/currencyPresets.d.ts.map +1 -1
  34. package/esm/measureNumberFormat/presets/currencyPresets.js +18 -7
  35. package/esm/measureNumberFormat/presets/currencyPresets.js.map +1 -1
  36. package/esm/measureNumberFormat/presets/standardPresets.d.ts +34 -0
  37. package/esm/measureNumberFormat/presets/standardPresets.d.ts.map +1 -0
  38. package/esm/measureNumberFormat/presets/standardPresets.js +71 -0
  39. package/esm/measureNumberFormat/presets/standardPresets.js.map +1 -0
  40. package/esm/measureNumberFormat/presets/templates.d.ts +60 -0
  41. package/esm/measureNumberFormat/presets/templates.d.ts.map +1 -0
  42. package/esm/measureNumberFormat/presets/templates.js +183 -0
  43. package/esm/measureNumberFormat/presets/templates.js.map +1 -0
  44. package/esm/sdk-ui-kit.d.ts +231 -2
  45. package/package.json +9 -9
@@ -121,6 +121,12 @@ export declare function AddGranteeBase({ appliedGrantees, addedGrantees, current
121
121
  */
122
122
  export declare type AddMessageType = (message: MessageDescriptor, options?: MessageParameters) => IMessage;
123
123
 
124
+ /**
125
+ * Advanced format template definitions (complex conditional formats).
126
+ * @internal
127
+ */
128
+ export declare const ADVANCED_TEMPLATE_DEFINITIONS: readonly ITemplateDefinition[];
129
+
124
130
  /**
125
131
  * @internal
126
132
  */
@@ -468,16 +474,54 @@ export declare function ContentDivider({ className }: {
468
474
  */
469
475
  export declare type CopyCodeOriginType = "keyboard" | "button";
470
476
 
477
+ /**
478
+ * Creates all localized format templates (standard + currency + advanced).
479
+ *
480
+ * @param formatMessage - Function to format localized messages (e.g., from react-intl)
481
+ * @param messageIdPrefix - Optional prefix for message IDs (default: "metricComponent.numberFormat.template")
482
+ * @returns Array of all format templates with localized names
483
+ * @internal
484
+ */
485
+ export declare function createAllTemplates(formatMessage: (descriptor: {
486
+ id: string;
487
+ }) => string, messageIdPrefix?: string): IFormatTemplate[];
488
+
471
489
  /**
472
490
  * Creates localized currency format presets.
473
491
  *
474
492
  * @param formatMessage - Function to format localized messages (e.g., from react-intl)
493
+ * @param messageIdPrefix - Optional prefix for message IDs (default: "metricComponent.numberFormat.preset")
475
494
  * @returns Array of currency format presets with localized names
476
495
  * @internal
477
496
  */
478
497
  export declare function createCurrencyPresets(formatMessage: (descriptor: {
479
498
  id: string;
480
- }) => string): IFormatPreset[];
499
+ }) => string, messageIdPrefix?: string): IFormatPreset[];
500
+
501
+ /**
502
+ * Creates localized standard format presets.
503
+ *
504
+ * @param formatMessage - Function to format localized messages (e.g., from react-intl)
505
+ * @param messageIdPrefix - Optional prefix for message IDs (default: "metricComponent.numberFormat.preset")
506
+ * @returns Array of standard format presets with localized names
507
+ * @internal
508
+ */
509
+ export declare function createStandardPresets(formatMessage: (descriptor: {
510
+ id: string;
511
+ }) => string, messageIdPrefix?: string): IFormatPreset[];
512
+
513
+ /**
514
+ * Creates localized format templates.
515
+ *
516
+ * @param formatMessage - Function to format localized messages (e.g., from react-intl)
517
+ * @param definitions - Template definitions to localize
518
+ * @param messageIdPrefix - Optional prefix for message IDs (default: "metricComponent.numberFormat.template")
519
+ * @returns Array of format templates with localized names
520
+ * @internal
521
+ */
522
+ export declare function createTemplates(formatMessage: (descriptor: {
523
+ id: string;
524
+ }) => string, definitions: readonly ITemplateDefinition[], messageIdPrefix?: string): IFormatTemplate[];
481
525
 
482
526
  /**
483
527
  * Base currency preset definitions.
@@ -486,6 +530,19 @@ export declare function createCurrencyPresets(formatMessage: (descriptor: {
486
530
  */
487
531
  export declare const CURRENCY_PRESET_DEFINITIONS: readonly ICurrencyPresetDefinition[];
488
532
 
533
+ /**
534
+ * Currency format template definitions.
535
+ * @internal
536
+ */
537
+ export declare const CURRENCY_TEMPLATE_DEFINITIONS: readonly ITemplateDefinition[];
538
+
539
+ /**
540
+ * Local identifiers of templates that are currency-specific.
541
+ * Used to filter templates when metric type is CURRENCY.
542
+ * @internal
543
+ */
544
+ export declare const CURRENCY_TEMPLATE_IDS: string[];
545
+
489
546
  /**
490
547
  * @alpha
491
548
  */
@@ -515,6 +572,12 @@ export declare class Datepicker extends PureComponent<IDatePickerOwnProps> {
515
572
  render(): JSX.Element;
516
573
  }
517
574
 
575
+ /**
576
+ * Default message ID prefix for currency preset definitions.
577
+ * @internal
578
+ */
579
+ export declare const DEFAULT_CURRENCY_PRESET_PREFIX = "metricComponent.numberFormat.preset";
580
+
518
581
  /**
519
582
  * @internal
520
583
  */
@@ -525,6 +588,18 @@ export declare const DEFAULT_ITEM_HEIGHT = 28;
525
588
  */
526
589
  export declare const DEFAULT_MOBILE_ITEM_HEIGHT = 40;
527
590
 
591
+ /**
592
+ * Default message ID prefix for standard preset definitions.
593
+ * @internal
594
+ */
595
+ export declare const DEFAULT_STANDARD_PRESET_PREFIX = "metricComponent.numberFormat.preset";
596
+
597
+ /**
598
+ * Default message ID prefix for template definitions.
599
+ * @internal
600
+ */
601
+ export declare const DEFAULT_TEMPLATE_PREFIX = "metricComponent.numberFormat.template";
602
+
528
603
  /**
529
604
  * Dummy theme metadata object which represents the default colors of GD.
530
605
  *
@@ -3631,6 +3706,7 @@ export declare interface IInvertableSelectProps<T> {
3631
3706
  searchString?: string;
3632
3707
  searchPlaceholder?: string;
3633
3708
  onSearch?: (search: string) => void;
3709
+ onEscKeyPress?: (e: KeyboardEvent_2) => void;
3634
3710
  error?: any;
3635
3711
  isLoading?: boolean;
3636
3712
  nextPageItemPlaceholdersCount?: number;
@@ -3720,6 +3796,7 @@ export declare interface IInvertableSelectRenderSearchBarProps {
3720
3796
  searchString?: string;
3721
3797
  searchPlaceholder?: string;
3722
3798
  onSearch: (searchString: string) => void;
3799
+ onEscKeyPress?: (e: KeyboardEvent_2) => void;
3723
3800
  }
3724
3801
 
3725
3802
  /**
@@ -3741,6 +3818,7 @@ export declare interface IInvertableSelectSearchBarProps {
3741
3818
  searchString?: string;
3742
3819
  searchPlaceholder?: string;
3743
3820
  onSearch: (searchString: string) => void;
3821
+ onEscKeyPress?: (e: KeyboardEvent_2) => void;
3744
3822
  }
3745
3823
 
3746
3824
  /**
@@ -4584,7 +4662,7 @@ export declare function InvertableSelectLimitWarning({ limit, selectedItemsCount
4584
4662
  /**
4585
4663
  * @internal
4586
4664
  */
4587
- export declare function InvertableSelectSearchBar({ className, isSmall, searchString, onSearch, searchPlaceholder, }: IInvertableSelectSearchBarProps): JSX.Element;
4665
+ export declare function InvertableSelectSearchBar({ className, isSmall, searchString, onSearch, onEscKeyPress, searchPlaceholder, }: IInvertableSelectSearchBarProps): JSX.Element;
4588
4666
 
4589
4667
  /**
4590
4668
  * @internal
@@ -5399,6 +5477,17 @@ export declare const isSpaceKey: (event: KeyboardEvent_2) => boolean;
5399
5477
  */
5400
5478
  export declare const isTabKey: (event: KeyboardEvent_2) => boolean;
5401
5479
 
5480
+ /**
5481
+ * Base standard preset definition without localized name.
5482
+ * @internal
5483
+ */
5484
+ export declare interface IStandardPresetDefinition {
5485
+ localIdentifier: string;
5486
+ format: string;
5487
+ previewNumber: number;
5488
+ messageId: string;
5489
+ }
5490
+
5402
5491
  /**
5403
5492
  * @internal
5404
5493
  */
@@ -5540,6 +5629,16 @@ export declare interface ITabsState {
5540
5629
  */
5541
5630
  export declare function Item({ checked, subMenu, disabled, className, children, style, onClick, }: IItemProps): JSX.Element;
5542
5631
 
5632
+ /**
5633
+ * Base template definition without localized name.
5634
+ * @internal
5635
+ */
5636
+ export declare interface ITemplateDefinition {
5637
+ localIdentifier: string;
5638
+ format: string;
5639
+ messageId: string;
5640
+ }
5641
+
5543
5642
  /**
5544
5643
  * @internal
5545
5644
  */
@@ -7047,6 +7146,19 @@ export declare const Spinner: NamedExoticComponent<ISpinnerProps>;
7047
7146
  */
7048
7147
  export declare type SpinnerSize = "large" | "small";
7049
7148
 
7149
+ /**
7150
+ * Standard numeric preset definitions.
7151
+ * These are the raw preset data that can be used to create localized presets.
7152
+ * @internal
7153
+ */
7154
+ export declare const STANDARD_PRESET_DEFINITIONS: readonly IStandardPresetDefinition[];
7155
+
7156
+ /**
7157
+ * Standard format template definitions (basic numeric formats).
7158
+ * @internal
7159
+ */
7160
+ export declare const STANDARD_TEMPLATE_DEFINITIONS: readonly ITemplateDefinition[];
7161
+
7050
7162
  /**
7051
7163
  * Properties for BEM modifiers.
7052
7164
  *
@@ -8324,6 +8436,19 @@ export declare function useFocusWithinContainer(idToFocus?: string | null): {
8324
8436
  containerRef: RefObject<HTMLElement | null>;
8325
8437
  };
8326
8438
 
8439
+ /**
8440
+ * Hook that creates all format templates.
8441
+ * Use this when you need templates without metric type filtering.
8442
+ *
8443
+ * @param formatMessage - Function to format localized messages
8444
+ * @param excludeCurrencyTemplates - Whether to exclude currency-specific templates
8445
+ * @returns Array of format templates
8446
+ * @internal
8447
+ */
8448
+ export declare function useFormatTemplates(formatMessage: (descriptor: {
8449
+ id: string;
8450
+ }) => string, excludeCurrencyTemplates?: boolean): IFormatTemplate[];
8451
+
8327
8452
  /**
8328
8453
  * Internal context hook used to provide header search drop-down state to the components.
8329
8454
  * @internal
@@ -8399,6 +8524,98 @@ export declare function useListWithActionsKeyboardNavigation<Item, Action extend
8399
8524
  */
8400
8525
  export declare const useMediaQuery: (mediaQueryName: keyof IMediaQueries) => boolean;
8401
8526
 
8527
+ /**
8528
+ * Hook that creates format presets and templates based on metric type.
8529
+ *
8530
+ * This hook encapsulates the logic for building format options that respect:
8531
+ * - Metric type (CURRENCY vs standard)
8532
+ * - Currency format override (creates "inherit" preset)
8533
+ *
8534
+ * @example
8535
+ * ```tsx
8536
+ * const { presets, templates, inheritPreset } = useMetricTypePresets({
8537
+ * metricType: "CURRENCY",
8538
+ * currencyFormatOverride: "$#,##0.00",
8539
+ * formatMessage: (d) => intl.formatMessage(d),
8540
+ * });
8541
+ * ```
8542
+ *
8543
+ * @example
8544
+ * ```tsx
8545
+ * // With custom message ID prefixes (e.g., for Analytical Designer)
8546
+ * const { presets, templates } = useMetricTypePresets({
8547
+ * metricType: undefined,
8548
+ * formatMessage: (d) => intl.formatMessage(d),
8549
+ * presetMessageIdPrefix: "measure_number_format.preset",
8550
+ * templateMessageIdPrefix: "measure_number_format.template",
8551
+ * });
8552
+ * ```
8553
+ *
8554
+ * @internal
8555
+ */
8556
+ export declare function useMetricTypePresets({ metricType, currencyFormatOverride, formatMessage, presetMessageIdPrefix, templateMessageIdPrefix, }: UseMetricTypePresetsConfig): UseMetricTypePresetsResult;
8557
+
8558
+ /**
8559
+ * Configuration for the useMetricTypePresets hook.
8560
+ * @internal
8561
+ */
8562
+ export declare interface UseMetricTypePresetsConfig {
8563
+ /**
8564
+ * The metric type. When "CURRENCY", currency-specific presets are shown.
8565
+ * When undefined, standard numeric presets are shown.
8566
+ */
8567
+ metricType?: MetricType;
8568
+ /**
8569
+ * The currency format override from workspace settings.
8570
+ * When set and metricType is "CURRENCY", an "inherit" preset is added.
8571
+ */
8572
+ currencyFormatOverride?: string | null;
8573
+ /**
8574
+ * Function to format localized messages (e.g., from react-intl).
8575
+ */
8576
+ formatMessage: (descriptor: {
8577
+ id: string;
8578
+ }) => string;
8579
+ /**
8580
+ * Optional prefix for preset message IDs.
8581
+ * Default: "metricComponent.numberFormat.preset"
8582
+ *
8583
+ * Use this to customize the translation keys for presets.
8584
+ * For example, set to "measure_number_format.preset" for Analytical Designer compatibility.
8585
+ */
8586
+ presetMessageIdPrefix?: string;
8587
+ /**
8588
+ * Optional prefix for template message IDs.
8589
+ * Default: "metricComponent.numberFormat.template"
8590
+ *
8591
+ * Use this to customize the translation keys for templates.
8592
+ * For example, set to "measure_number_format.template" for Analytical Designer compatibility.
8593
+ */
8594
+ templateMessageIdPrefix?: string;
8595
+ }
8596
+
8597
+ /**
8598
+ * Result from the useMetricTypePresets hook.
8599
+ * @internal
8600
+ */
8601
+ export declare interface UseMetricTypePresetsResult {
8602
+ /**
8603
+ * Format presets based on metric type.
8604
+ * For CURRENCY: currency presets with optional inherit preset.
8605
+ * For other types: standard numeric presets.
8606
+ */
8607
+ presets: IFormatPreset[];
8608
+ /**
8609
+ * Format templates. For CURRENCY metrics, currency templates are excluded
8610
+ * from the general list (they're already in presets).
8611
+ */
8612
+ templates: IFormatTemplate[];
8613
+ /**
8614
+ * The inherit preset if available (only for CURRENCY with override).
8615
+ */
8616
+ inheritPreset: IFormatPreset | null;
8617
+ }
8618
+
8402
8619
  /**
8403
8620
  * Hook to get current instance of the {@link OverlayController}
8404
8621
  *
@@ -8468,6 +8685,18 @@ export declare const useScrollContext: () => {
8468
8685
  scrollIntoView: (_element: HTMLElement, _bottomMargin?: number, _isElementInvisibleCheck?: isElementInvisibleType) => void;
8469
8686
  };
8470
8687
 
8688
+ /**
8689
+ * Hook that creates standard numeric format presets.
8690
+ * Use this when you don't need metric type awareness.
8691
+ *
8692
+ * @param formatMessage - Function to format localized messages
8693
+ * @returns Array of standard format presets
8694
+ * @internal
8695
+ */
8696
+ export declare function useStandardPresets(formatMessage: (descriptor: {
8697
+ id: string;
8698
+ }) => string): IFormatPreset[];
8699
+
8471
8700
  /**
8472
8701
  * @internal
8473
8702
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-kit",
3
- "version": "11.13.0-alpha.2",
3
+ "version": "11.13.0-alpha.4",
4
4
  "description": "GoodData SDK - UI Building Components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -76,11 +76,11 @@
76
76
  "tslib": "2.8.1",
77
77
  "unified": "^11.0.5",
78
78
  "uuid": "^11.1.0",
79
- "@gooddata/sdk-backend-spi": "11.13.0-alpha.2",
80
- "@gooddata/sdk-model": "11.13.0-alpha.2",
81
- "@gooddata/util": "11.13.0-alpha.2",
82
- "@gooddata/sdk-ui-theme-provider": "11.13.0-alpha.2",
83
- "@gooddata/sdk-ui": "11.13.0-alpha.2"
79
+ "@gooddata/sdk-backend-spi": "11.13.0-alpha.4",
80
+ "@gooddata/sdk-model": "11.13.0-alpha.4",
81
+ "@gooddata/sdk-ui": "11.13.0-alpha.4",
82
+ "@gooddata/sdk-ui-theme-provider": "11.13.0-alpha.4",
83
+ "@gooddata/util": "11.13.0-alpha.4"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@gooddata/stylelint-config": "^5.0.0",
@@ -130,9 +130,9 @@
130
130
  "typescript": "5.8.3",
131
131
  "vitest": "3.2.4",
132
132
  "vitest-dom": "0.1.1",
133
- "@gooddata/eslint-config": "11.13.0-alpha.2",
134
- "@gooddata/reference-workspace": "11.13.0-alpha.2",
135
- "@gooddata/sdk-backend-mockingbird": "11.13.0-alpha.2"
133
+ "@gooddata/eslint-config": "11.13.0-alpha.4",
134
+ "@gooddata/reference-workspace": "11.13.0-alpha.4",
135
+ "@gooddata/sdk-backend-mockingbird": "11.13.0-alpha.4"
136
136
  },
137
137
  "peerDependencies": {
138
138
  "react": "^18.0.0 || ^19.0.0",