@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.
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/types/components/EditTagsButton/EditTagsButton.d.ts +7 -1
- package/dist/cjs/types/components/TagsList/MoreTags.d.ts +3 -2
- package/dist/cjs/types/components/TagsList/Tags.d.ts +5 -2
- package/dist/cjs/types/components/TagsList/TagsList.d.ts +10 -2
- package/dist/cjs/types/components/TagsList/useCalculateTagsOverflow.d.ts +34 -0
- package/dist/cjs/types/components/TagsList/useCalculateTagsOverflow.test.d.ts +1 -0
- package/dist/cjs/types/index.d.ts +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/types/components/EditTagsButton/EditTagsButton.d.ts +7 -1
- package/dist/esm/types/components/TagsList/MoreTags.d.ts +3 -2
- package/dist/esm/types/components/TagsList/Tags.d.ts +5 -2
- package/dist/esm/types/components/TagsList/TagsList.d.ts +10 -2
- package/dist/esm/types/components/TagsList/useCalculateTagsOverflow.d.ts +34 -0
- package/dist/esm/types/components/TagsList/useCalculateTagsOverflow.test.d.ts +1 -0
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/index.d.ts +17 -5
- package/package.json +2 -2
|
@@ -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
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
|
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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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';
|
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';
|
|
@@ -5321,12 +5321,19 @@ type StatusLightProps = {
|
|
|
5321
5321
|
*/
|
|
5322
5322
|
declare const StatusLight: ({ label, variant, color, size, sx, }: StatusLightProps) => React__default.JSX.Element;
|
|
5323
5323
|
|
|
5324
|
+
type TagItem = {
|
|
5325
|
+
label: string;
|
|
5326
|
+
onDelete?: (e: unknown) => void;
|
|
5327
|
+
};
|
|
5324
5328
|
type TagsListProps = {
|
|
5325
|
-
tags: string[];
|
|
5329
|
+
tags: string[] | TagItem[];
|
|
5326
5330
|
onTagsUpdate?: (tags: string[]) => Promise<void>;
|
|
5327
5331
|
isUpdatingTags?: boolean;
|
|
5332
|
+
sx?: SxProps<Theme>;
|
|
5333
|
+
editTagsButtonSx?: SxProps<Theme>;
|
|
5334
|
+
onMoreTagsClick?: (e: React__default.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
|
|
5328
5335
|
};
|
|
5329
|
-
declare const TagsList: ({ tags
|
|
5336
|
+
declare const TagsList: React__default.MemoExoticComponent<({ tags, onTagsUpdate, isUpdatingTags, sx, editTagsButtonSx, onMoreTagsClick, }: TagsListProps) => React__default.JSX.Element>;
|
|
5330
5337
|
|
|
5331
5338
|
type EditTagsButtonProps = {
|
|
5332
5339
|
tags: string[];
|
|
@@ -5335,8 +5342,13 @@ type EditTagsButtonProps = {
|
|
|
5335
5342
|
label?: string;
|
|
5336
5343
|
tooltip?: string;
|
|
5337
5344
|
isUpdatingTags?: boolean;
|
|
5345
|
+
sx?: SxProps<Theme>;
|
|
5346
|
+
variant?: ButtonProps$2['variant'];
|
|
5338
5347
|
};
|
|
5339
|
-
|
|
5348
|
+
/**
|
|
5349
|
+
* Documentation: https://up-components.up42.com/?path=/docs/data-entry-edittagsbutton--docs
|
|
5350
|
+
*/
|
|
5351
|
+
declare const EditTagsButton: React__default.ForwardRefExoticComponent<EditTagsButtonProps & React__default.RefAttributes<unknown>>;
|
|
5340
5352
|
|
|
5341
5353
|
type FeatureFlagCheckboxProps = {
|
|
5342
5354
|
label: string;
|
|
@@ -5636,4 +5648,4 @@ type ContextState = {
|
|
|
5636
5648
|
declare const useAlert: () => ContextState;
|
|
5637
5649
|
|
|
5638
5650
|
export { Alert, Avatar, Badge, Banner, Button, Checkbox, 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, Radio, Select, Slider, StatusLight, Switch, Tab, TabGroup, Table, TableBody, TableCell, TableContainer, TableFooter, TableHead, TablePagination, TableRow, TableSortLabel, Tabs, Tag, TagsList, Typography, UpComponentsProvider, capitalize, copyToClipboard, formatDate, formatFileSize, formatNumber, theme, useAlert, useCursorPagination, useDebounce, useQueryParams, useRemotePagination, useToggle };
|
|
5639
|
-
export type { AlertProps, AvatarProps, BadgeProps, BannerProps, ButtonProps, CheckboxProps, 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, RadioProps, SelectProps, SliderProps, StatusLightProps, SwitchProps, TabGroupProps, TabProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TableSortLabelProps, TabsProps, TagProps, TagsListProps, TypographyProps, UseToggleResult };
|
|
5651
|
+
export type { AlertProps, AvatarProps, BadgeProps, BannerProps, ButtonProps, CheckboxProps, 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, RadioProps, SelectProps, SliderProps, StatusLightProps, SwitchProps, TabGroupProps, TabProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TableSortLabelProps, TabsProps, TagItem, TagProps, TagsListProps, TypographyProps, UseToggleResult };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@up42/up-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "UP42 Component Library",
|
|
5
5
|
"author": "Axel Fuhrmann axel.fuhrmann@up42.com",
|
|
6
6
|
"license": "ISC",
|
|
@@ -131,4 +131,4 @@
|
|
|
131
131
|
"tmp": ">=0.2.4"
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
}
|
|
134
|
+
}
|