@up42/up-components 5.2.0 → 5.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import { ButtonProps, SxProps, Theme } from '@mui/material';
1
2
  import React from 'react';
2
3
  export type EditTagsButtonProps = {
3
4
  tags: string[];
@@ -6,5 +7,7 @@ export type EditTagsButtonProps = {
6
7
  label?: string;
7
8
  tooltip?: string;
8
9
  isUpdatingTags?: boolean;
10
+ sx?: SxProps<Theme>;
11
+ variant?: ButtonProps['variant'];
9
12
  };
10
- export declare function EditTagsButton({ tags, tagPool, onSave, label, tooltip, isUpdatingTags }: EditTagsButtonProps): React.JSX.Element;
13
+ export declare function EditTagsButton({ tags, tagPool, onSave, label, tooltip, isUpdatingTags, sx, variant, }: EditTagsButtonProps): React.JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
- export declare const MoreTags: ({ tags }: {
2
+ export declare const MoreTags: React.MemoExoticComponent<({ tags, handleClick, }: {
3
3
  tags: string[];
4
- }) => React.JSX.Element | null;
4
+ handleClick?: ((e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void) | undefined;
5
+ }) => React.JSX.Element | null>;
@@ -3,6 +3,8 @@ type TagsProps = {
3
3
  tags: string[];
4
4
  setHiddenTagCount: (count: number) => void;
5
5
  hiddenTagCount: number;
6
+ parentContainerRef: React.MutableRefObject<HTMLDivElement | null>;
7
+ hasEditButton: boolean;
6
8
  };
7
- export declare const Tags: ({ tags, setHiddenTagCount, hiddenTagCount }: TagsProps) => React.JSX.Element;
9
+ export declare const Tags: React.MemoExoticComponent<({ tags, setHiddenTagCount, hiddenTagCount, parentContainerRef, hasEditButton }: TagsProps) => React.JSX.Element>;
8
10
  export {};
@@ -1,7 +1,11 @@
1
1
  import React from 'react';
2
+ import { SxProps, Theme } from '@mui/material';
2
3
  export type TagsListProps = {
3
4
  tags: string[];
4
5
  onTagsUpdate?: (tags: string[]) => Promise<void>;
5
6
  isUpdatingTags?: boolean;
7
+ sx?: SxProps<Theme>;
8
+ editTagsButtonSx?: SxProps<Theme>;
9
+ onMoreTagsClick?: (e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
6
10
  };
7
- export declare const TagsList: ({ tags: tagsProp, onTagsUpdate, isUpdatingTags }: TagsListProps) => React.JSX.Element;
11
+ export declare const TagsList: React.MemoExoticComponent<({ tags, onTagsUpdate, isUpdatingTags, sx, editTagsButtonSx, onMoreTagsClick, }: TagsListProps) => React.JSX.Element>;
@@ -0,0 +1,33 @@
1
+ /// <reference types="react" />
2
+ type UseCalculateTagsOverflowProps = {
3
+ tags: string[];
4
+ parentContainerRef: React.MutableRefObject<HTMLDivElement | null>;
5
+ tagsMeasurementRef: React.MutableRefObject<HTMLDivElement | null>;
6
+ hiddenTagCount: number;
7
+ setHiddenTagCount: (count: number) => void;
8
+ hasEditButton: boolean;
9
+ };
10
+ type UseCalculateTagsOverflowReturn = {
11
+ measurementContainerWidth: number;
12
+ visibleTags: string[];
13
+ };
14
+ export declare const TAG_GAP: string;
15
+ /**
16
+ * @description Custom hook that handles the business logic for calculating tag overflow and visibility.
17
+ *
18
+ * This hook manages:
19
+ * - Container width measurement for responsive behavior
20
+ * - Hidden tags calculation based on available space
21
+ * - State management for measurement and visibility
22
+ * - Window and container resize handling with debounced ResizeObserver handler
23
+ *
24
+ * @param tags - The array of tag strings to display
25
+ * @param parentContainerRef - Reference to the parent container for width measurement
26
+ * @param tagsMeasurementRef - Reference to the measurement container for width measurement
27
+ * @param hiddenTagCount - Current number of hidden tags
28
+ * @param setHiddenTagCount - Function to update the number of hidden tags
29
+ * @param hasEditButton - Whether an edit button is present (affects space calculation)
30
+ * @returns Object containing the values defined in the UseTagsOverflowReturn type
31
+ */
32
+ export declare const useCalculateTagsOverflow: ({ tags, setHiddenTagCount, hiddenTagCount, parentContainerRef, tagsMeasurementRef, hasEditButton, }: UseCalculateTagsOverflowProps) => UseCalculateTagsOverflowReturn;
33
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { default as tokens } from '@up42/design-system-tokens/dist/json/tokens.json';
2
2
  import * as _mui_material from '@mui/material';
3
- import { BoxProps, TextFieldProps, AvatarProps as AvatarProps$1, GridProps, ContainerProps, CheckboxProps as CheckboxProps$1, RadioProps as RadioProps$1, RadioGroupProps, SwitchProps as SwitchProps$1, SelectProps as SelectProps$1, SliderProps as SliderProps$1, LinkProps as LinkProps$1, TabsProps as TabsProps$1, TabProps as TabProps$1, CardProps, ModalProps, AlertProps as AlertProps$1, SxProps, Theme, IconButtonProps, SvgIconProps, BadgeProps as BadgeProps$1, ChipProps, DividerProps as DividerProps$1, SnackbarProps } from '@mui/material';
3
+ import { BoxProps, TextFieldProps, AvatarProps as AvatarProps$1, GridProps, ContainerProps, CheckboxProps as CheckboxProps$1, RadioProps as RadioProps$1, RadioGroupProps, SwitchProps as SwitchProps$1, SelectProps as SelectProps$1, SliderProps as SliderProps$1, LinkProps as LinkProps$1, TabsProps as TabsProps$1, TabProps as TabProps$1, CardProps, ModalProps, AlertProps as AlertProps$1, SxProps, Theme, IconButtonProps, SvgIconProps, BadgeProps as BadgeProps$1, ChipProps, DividerProps as DividerProps$1, ButtonProps as ButtonProps$2, SnackbarProps } from '@mui/material';
4
4
  export * from '@mui/material';
5
5
  import { ThemeProviderProps } from '@mui/material/styles/ThemeProvider';
6
6
  import * as React from 'react';
@@ -5325,8 +5325,11 @@ type TagsListProps = {
5325
5325
  tags: string[];
5326
5326
  onTagsUpdate?: (tags: string[]) => Promise<void>;
5327
5327
  isUpdatingTags?: boolean;
5328
+ sx?: SxProps<Theme>;
5329
+ editTagsButtonSx?: SxProps<Theme>;
5330
+ onMoreTagsClick?: (e: React__default.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
5328
5331
  };
5329
- declare const TagsList: ({ tags: tagsProp, onTagsUpdate, isUpdatingTags }: TagsListProps) => React__default.JSX.Element;
5332
+ declare const TagsList: React__default.MemoExoticComponent<({ tags, onTagsUpdate, isUpdatingTags, sx, editTagsButtonSx, onMoreTagsClick, }: TagsListProps) => React__default.JSX.Element>;
5330
5333
 
5331
5334
  type EditTagsButtonProps = {
5332
5335
  tags: string[];
@@ -5335,8 +5338,10 @@ type EditTagsButtonProps = {
5335
5338
  label?: string;
5336
5339
  tooltip?: string;
5337
5340
  isUpdatingTags?: boolean;
5341
+ sx?: SxProps<Theme>;
5342
+ variant?: ButtonProps$2['variant'];
5338
5343
  };
5339
- declare function EditTagsButton({ tags, tagPool, onSave, label, tooltip, isUpdatingTags }: EditTagsButtonProps): React__default.JSX.Element;
5344
+ declare function EditTagsButton({ tags, tagPool, onSave, label, tooltip, isUpdatingTags, sx, variant, }: EditTagsButtonProps): React__default.JSX.Element;
5340
5345
 
5341
5346
  type FeatureFlagCheckboxProps = {
5342
5347
  label: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@up42/up-components",
3
- "version": "5.2.0",
3
+ "version": "5.2.2",
4
4
  "description": "UP42 Component Library",
5
5
  "author": "Axel Fuhrmann axel.fuhrmann@up42.com",
6
6
  "license": "ISC",
@@ -125,5 +125,10 @@
125
125
  "tag": true
126
126
  }
127
127
  },
128
- "packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
128
+ "packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39",
129
+ "pnpm": {
130
+ "overrides": {
131
+ "tmp": ">=0.2.4"
132
+ }
133
+ }
129
134
  }