@up42/up-components 5.7.1 → 5.8.0

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.
@@ -65,6 +65,7 @@ export { copyToClipboard } from './utils/helpers/copyToClipboard';
65
65
  export { formatNumber } from './utils/helpers/formatNumber';
66
66
  export { formatDate } from './utils/helpers/formatDate';
67
67
  export { formatFileSize } from './utils/helpers/formatFileSize';
68
+ export { generateQueryKey } from './utils/helpers/generateQueryKey';
68
69
  export { useQueryParams } from './utils/hooks/useQueryParams';
69
70
  export { useRemotePagination, type PaginatedResponse } from './utils/hooks/useRemotePagination';
70
71
  export { useCursorPagination, type CursorPaginatedResponse } from './utils/hooks/useCursorPagination';
@@ -0,0 +1,17 @@
1
+ type Key = string | number | Record<string, unknown> | undefined;
2
+ type QueryKey = readonly unknown[];
3
+ /**
4
+ * Generates a consistent React Query key builder for a given domain.
5
+ *
6
+ * @example
7
+ * const queryKey = generateQueryKey('MY_DOMAIN')
8
+ * useQuery(queryKey('list')) // → ['MY_DOMAIN', 'list']
9
+ * useQuery(queryKey('details', id)) // → ['MY_DOMAIN', 'details', id]
10
+ *
11
+ * @param domain - The root domain for the query key (e.g. 'USER', 'DASHBOARD')
12
+ * @returns A function that builds query keys. Undefined values are filtered out.
13
+ *
14
+ * Documentation: https://up-components.up42.com/?path=/docs/utils--docs#generatequerykey
15
+ */
16
+ export declare const generateQueryKey: <Domain extends string>(domain: Exclude<Domain, "">) => (service: string, ...keys: Key[]) => QueryKey;
17
+ export {};
package/dist/index.d.ts CHANGED
@@ -5678,6 +5678,23 @@ declare const formatNumber: (number: string | number, options?: Intl.NumberForma
5678
5678
  */
5679
5679
  declare const formatFileSize: (value: number) => string;
5680
5680
 
5681
+ type Key = string | number | Record<string, unknown> | undefined;
5682
+ type QueryKey = readonly unknown[];
5683
+ /**
5684
+ * Generates a consistent React Query key builder for a given domain.
5685
+ *
5686
+ * @example
5687
+ * const queryKey = generateQueryKey('MY_DOMAIN')
5688
+ * useQuery(queryKey('list')) // → ['MY_DOMAIN', 'list']
5689
+ * useQuery(queryKey('details', id)) // → ['MY_DOMAIN', 'details', id]
5690
+ *
5691
+ * @param domain - The root domain for the query key (e.g. 'USER', 'DASHBOARD')
5692
+ * @returns A function that builds query keys. Undefined values are filtered out.
5693
+ *
5694
+ * Documentation: https://up-components.up42.com/?path=/docs/utils--docs#generatequerykey
5695
+ */
5696
+ declare const generateQueryKey: <Domain extends string>(domain: Exclude<Domain, "">) => (service: string, ...keys: Key[]) => QueryKey;
5697
+
5681
5698
  /**
5682
5699
  * Returns query parameter values from a string or an array of strings.
5683
5700
  *
@@ -5842,5 +5859,5 @@ type ContextState = {
5842
5859
  */
5843
5860
  declare const useAlert: () => ContextState;
5844
5861
 
5845
- export { Alert, Avatar, Badge, Banner, Button, Checkbox, CodeBlock, CodeInline, CodeSnippet, ContactBox, ControlButton, CopyButton, DataGrid, DateTime, Divider, DocumentationPopover, EditTagsButton, EmptyState, FeatureCard, FeatureCardHeader, FeatureCardHeaderActions, FeatureFlagCheckbox, FormCheckbox, FormDatePicker, FormDateRangePicker, FormDateRangePickerList, FormDateTimePicker, FormInput, FormRadio, FormSelect, FormSwitch, GridContainer, GridItem, Icon, Illustration, InfoCard, InfoModal, InfoPopover, Input, Link, Loading, Logo, NotFound, PageContainer, PageHeader, Popover, Radio, Select, Slider, StatusLight, Switch, Tab, TabGroup, Table, TableBody, TableCell, TableContainer, TableFooter, TableHead, TablePagination, TableRow, TableSortLabel, Tabs, Tag, TagsList, ToggleButton, Typography, UpComponentsProvider, capitalize, copyToClipboard, formatDate, formatFileSize, formatNumber, theme, useAlert, useCursorPagination, useDebounce, useQueryParams, useRemotePagination, useToggle };
5862
+ export { Alert, Avatar, Badge, Banner, Button, Checkbox, CodeBlock, CodeInline, CodeSnippet, ContactBox, ControlButton, CopyButton, DataGrid, DateTime, Divider, DocumentationPopover, EditTagsButton, EmptyState, FeatureCard, FeatureCardHeader, FeatureCardHeaderActions, FeatureFlagCheckbox, FormCheckbox, FormDatePicker, FormDateRangePicker, FormDateRangePickerList, FormDateTimePicker, FormInput, FormRadio, FormSelect, FormSwitch, GridContainer, GridItem, Icon, Illustration, InfoCard, InfoModal, InfoPopover, Input, Link, Loading, Logo, NotFound, PageContainer, PageHeader, Popover, Radio, Select, Slider, StatusLight, Switch, Tab, TabGroup, Table, TableBody, TableCell, TableContainer, TableFooter, TableHead, TablePagination, TableRow, TableSortLabel, Tabs, Tag, TagsList, ToggleButton, Typography, UpComponentsProvider, capitalize, copyToClipboard, formatDate, formatFileSize, formatNumber, generateQueryKey, theme, useAlert, useCursorPagination, useDebounce, useQueryParams, useRemotePagination, useToggle };
5846
5863
  export type { AlertProps, AvatarProps, BadgeProps, BannerProps, ButtonProps, CheckboxProps, CodeBlockProps, CodeInlineProps, CodeSnippetItemProps, CodeSnippetProps, ContactBoxProps, ControlButtonProps, CopyButtonProps, CreateAlertProps, CreateSnackbarProps, CursorPaginatedResponse, DatePickerDateType, DateRange, DateTimeProps, DividerProps, DocumentationPopoverProps, EditTagsButtonProps, EmptyStateProps, FeatureCardHeaderActionsProps, FeatureCardHeaderProps, FeatureCardProps, FeatureFlagCheckboxProps, FormCheckboxProps, FormDatePickerProps, FormDateRangePickerListProps, FormDateRangePickerProps, FormDateTimePickerProps, FormInputProps, FormRadioProps, FormSelectProps, FormSwitchProps, GridContainerProps, GridItemProps, IconAction, IconProps$1 as IconProps, IllustrationProps, InfoCardProps, InfoModalProps, InfoPopoverProps, InputProps, LinkProps, LoadingProps, LogoProps, MenuAction, NotFoundProps, PageContainerProps, PageHeaderProps, PaginatedResponse, PopoverProps, RadioProps, SelectProps, SliderProps, StatusLightProps, SwitchProps, TabGroupProps, TabProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TableSortLabelProps, TabsProps, TagItem, TagProps, TagsListProps, ToggleButtonProps, TypographyProps, UseToggleResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@up42/up-components",
3
- "version": "5.7.1",
3
+ "version": "5.8.0",
4
4
  "description": "UP42 Component Library",
5
5
  "author": "Axel Fuhrmann axel.fuhrmann@up42.com",
6
6
  "license": "ISC",