@up42/up-components 5.2.1 → 5.3.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.
@@ -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,10 @@ 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
+ /**
14
+ * Documentation: https://up-components.up42.com/?path=/docs/data-entry-edittagsbutton--docs
15
+ */
16
+ export declare const EditTagsButton: React.ForwardRefExoticComponent<EditTagsButtonProps & React.RefAttributes<unknown>>;
@@ -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>;
@@ -1,8 +1,11 @@
1
1
  import React from 'react';
2
+ import { TagItem } from './TagsList';
2
3
  type TagsProps = {
3
- tags: string[];
4
+ tags: TagItem[];
4
5
  setHiddenTagCount: (count: number) => void;
5
6
  hiddenTagCount: number;
7
+ parentContainerRef: React.MutableRefObject<HTMLDivElement | null>;
8
+ hasEditButton: boolean;
6
9
  };
7
- export declare const Tags: ({ tags, setHiddenTagCount, hiddenTagCount }: TagsProps) => React.JSX.Element;
10
+ export declare const Tags: React.MemoExoticComponent<({ tags, setHiddenTagCount, hiddenTagCount, parentContainerRef, hasEditButton }: TagsProps) => React.JSX.Element>;
8
11
  export {};
@@ -1,7 +1,15 @@
1
1
  import React from 'react';
2
+ import { SxProps, Theme } from '@mui/material';
3
+ export type TagItem = {
4
+ label: string;
5
+ onDelete?: (e: unknown) => void;
6
+ };
2
7
  export type TagsListProps = {
3
- tags: string[];
8
+ tags: string[] | TagItem[];
4
9
  onTagsUpdate?: (tags: string[]) => Promise<void>;
5
10
  isUpdatingTags?: boolean;
11
+ sx?: SxProps<Theme>;
12
+ editTagsButtonSx?: SxProps<Theme>;
13
+ onMoreTagsClick?: (e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
6
14
  };
7
- export declare const TagsList: ({ tags: tagsProp, onTagsUpdate, isUpdatingTags }: TagsListProps) => React.JSX.Element;
15
+ export declare const TagsList: React.MemoExoticComponent<({ tags, onTagsUpdate, isUpdatingTags, sx, editTagsButtonSx, onMoreTagsClick, }: TagsListProps) => React.JSX.Element>;
@@ -0,0 +1,34 @@
1
+ /// <reference types="react" />
2
+ import { TagItem } from './TagsList';
3
+ type UseCalculateTagsOverflowProps = {
4
+ tags: TagItem[];
5
+ parentContainerRef: React.MutableRefObject<HTMLDivElement | null>;
6
+ tagsMeasurementRef: React.MutableRefObject<HTMLDivElement | null>;
7
+ hiddenTagCount: number;
8
+ setHiddenTagCount: (count: number) => void;
9
+ hasEditButton: boolean;
10
+ };
11
+ type UseCalculateTagsOverflowReturn = {
12
+ measurementContainerWidth: number;
13
+ visibleTags: TagItem[];
14
+ };
15
+ export declare const TAG_GAP: string;
16
+ /**
17
+ * @description Custom hook that handles the business logic for calculating tag overflow and visibility.
18
+ *
19
+ * This hook manages:
20
+ * - Container width measurement for responsive behavior
21
+ * - Hidden tags calculation based on available space
22
+ * - State management for measurement and visibility
23
+ * - Window and container resize handling with debounced ResizeObserver handler
24
+ *
25
+ * @param tags - The array of tag objects to display
26
+ * @param parentContainerRef - Reference to the parent container for width measurement
27
+ * @param tagsMeasurementRef - Reference to the measurement container for width measurement
28
+ * @param hiddenTagCount - Current number of hidden tags
29
+ * @param setHiddenTagCount - Function to update the number of hidden tags
30
+ * @param hasEditButton - Whether an edit button is present (affects space calculation)
31
+ * @returns Object containing the values defined in the UseTagsOverflowReturn type
32
+ */
33
+ export declare const useCalculateTagsOverflow: ({ tags, setHiddenTagCount, hiddenTagCount, parentContainerRef, tagsMeasurementRef, hasEditButton, }: UseCalculateTagsOverflowProps) => UseCalculateTagsOverflowReturn;
34
+ export {};
@@ -49,7 +49,7 @@ export { FeatureCard, type FeatureCardProps } from './components/FeatureCard/Fea
49
49
  export { FeatureCardHeader, type FeatureCardHeaderProps } from './components/FeatureCardHeader/FeatureCardHeader';
50
50
  export { FeatureCardHeaderActions, type IconAction, type MenuAction, type FeatureCardHeaderActionsProps, } from './components/FeatureCardHeaderActions/FeatureCardHeaderActions';
51
51
  export { StatusLight, type StatusLightProps } from './components/StatusLight/StatusLight';
52
- export { TagsList, type TagsListProps } from './components/TagsList/TagsList';
52
+ export { TagsList, type TagsListProps, type TagItem } from './components/TagsList/TagsList';
53
53
  export { EditTagsButton, type EditTagsButtonProps } from './components/EditTagsButton/EditTagsButton';
54
54
  export { FeatureFlagCheckbox, type FeatureFlagCheckboxProps, } from './components/FeatureFlagCheckbox/FeatureFlagCheckbox';
55
55
  export { DocumentationPopover, type DocumentationPopoverProps, } from './components/DocumentationPopover/DocumentationPopover';