@epam/ai-dial-ui-kit 0.4.0-rc.8 → 0.4.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/dial-ui-kit.cjs.js +2 -62
- package/dist/dial-ui-kit.es.js +4253 -42725
- package/dist/index.css +1 -1
- package/dist/src/components/AutocompleteInput/AutocompleteInputValue.d.ts +2 -0
- package/dist/src/components/Breadcrumb/BreadcrumbItem.d.ts +2 -2
- package/dist/src/components/Breadcrumb/constants.d.ts +4 -1
- package/dist/src/components/Checkbox/Checkbox.d.ts +2 -2
- package/dist/src/components/CollapsibleSidebar/CollapsibleSidebar.d.ts +2 -2
- package/dist/src/components/FileManager/FileManager.d.ts +62 -14
- package/dist/src/components/FileManager/FileManagerContext.d.ts +64 -0
- package/dist/src/components/FileManager/FileManagerProvider.d.ts +18 -0
- package/dist/src/components/FileManager/components/FileManagerBulkActionsToolbar/FileManagerBulkActionsToolbar.d.ts +53 -0
- package/dist/src/components/FileManager/components/FileManagerBulkActionsToolbar/constants.d.ts +3 -0
- package/dist/src/components/FileManager/components/FileManagerDeleteConfirmationPopup/FileManagerDeleteConfirmationPopup.d.ts +26 -0
- package/dist/src/components/FileManager/components/FileManagerItemIcon/FileManagerItemIcon.d.ts +46 -0
- package/dist/src/components/FileManager/components/FileManagerItemName/FileManagerItemName.d.ts +48 -0
- package/dist/src/components/FileManager/components/FileManagerItemNameInput/FileManagerItemNameInput.d.ts +65 -0
- package/dist/src/components/FileManager/components/FileManagerNavigationPanel/FileManagerNavigationPanel.d.ts +2 -0
- package/dist/src/components/FileManager/components/FileManagerToolbar/DialFileManagerToolbar.d.ts +27 -24
- package/dist/src/components/FileManager/components/FoldersTree/FoldersTree.d.ts +23 -3
- package/dist/src/components/FileManager/constants.d.ts +1 -1
- package/dist/src/components/FileManager/hooks/__tests__/use-current-path.spec.d.ts +1 -0
- package/dist/src/components/FileManager/hooks/__tests__/use-file-clipboard.spec.d.ts +1 -0
- package/dist/src/components/FileManager/hooks/__tests__/use-file-delete.spec.d.ts +1 -0
- package/dist/src/components/FileManager/hooks/__tests__/use-file-download.spec.d.ts +1 -0
- package/dist/src/components/FileManager/hooks/__tests__/use-show-hidden-files.spec.d.ts +1 -0
- package/dist/src/components/FileManager/hooks/use-collapse-tree.d.ts +9 -0
- package/dist/src/components/FileManager/hooks/use-current-path.d.ts +10 -0
- package/dist/src/components/FileManager/hooks/use-file-clipboard.d.ts +20 -0
- package/dist/src/components/FileManager/hooks/use-file-delete.d.ts +12 -0
- package/dist/src/components/FileManager/hooks/use-file-download.d.ts +7 -0
- package/dist/src/components/FileManager/hooks/use-file-manager-context.d.ts +5 -0
- package/dist/src/components/FileManager/hooks/use-item-renaming.d.ts +13 -0
- package/dist/src/components/FileManager/hooks/use-show-hidden-files.d.ts +5 -0
- package/dist/src/components/FileManager/utils.d.ts +1 -0
- package/dist/src/components/Grid/Grid.d.ts +9 -1
- package/dist/src/components/Grid/comparators/base-column-comparator.spec.d.ts +1 -0
- package/dist/src/components/Grid/constants.d.ts +0 -1
- package/dist/src/components/Grid/renderers/DateCellRenderer.d.ts +32 -0
- package/dist/src/components/Grid/renderers/constants.d.ts +3 -0
- package/dist/src/components/Grid/renderers/utils.d.ts +2 -0
- package/dist/src/components/Grid/renderers/utils.spec.d.ts +1 -0
- package/dist/src/components/Input/Input.d.ts +4 -1
- package/dist/src/components/InputPopup/InputPopup.d.ts +6 -2
- package/dist/src/components/NoDataContent/NoDataContent.d.ts +3 -0
- package/dist/src/components/Search/Search.d.ts +2 -0
- package/dist/src/components/Select/MultiSelectTags.d.ts +2 -2
- package/dist/src/components/Select/Select.d.ts +39 -22
- package/dist/src/components/Select/constants.d.ts +1 -2
- package/dist/src/components/SelectField/SelectField.d.ts +5 -0
- package/dist/src/components/Steps/tests/utils.spec.d.ts +1 -0
- package/dist/src/components/Tab/Tab.d.ts +1 -4
- package/dist/src/components/Tabs/Tabs.d.ts +27 -14
- package/dist/src/components/Tag/Tag.d.ts +2 -2
- package/dist/src/components/Tooltip/Tooltip.d.ts +2 -2
- package/dist/src/components/Tooltip/TooltipContent.d.ts +5 -2
- package/dist/src/components/Tooltip/TooltipTrigger.d.ts +6 -4
- package/dist/src/hooks/use-editable-item.d.ts +64 -0
- package/dist/src/hooks/use-flexible-actions.d.ts +86 -0
- package/dist/src/hooks/use-is-mobile-screen.d.ts +15 -0
- package/dist/src/hooks/use-screen-type.d.ts +19 -0
- package/dist/src/index.d.ts +10 -6
- package/dist/src/models/dropdown.d.ts +2 -2
- package/dist/src/models/file.d.ts +3 -0
- package/dist/src/models/select.d.ts +1 -0
- package/dist/src/models/tab.d.ts +1 -0
- package/dist/src/types/file-manager.d.ts +19 -0
- package/dist/src/types/flexible-actions.d.ts +4 -0
- package/dist/src/types/item.d.ts +4 -0
- package/dist/src/types/screen.d.ts +6 -0
- package/dist/src/types/select.d.ts +8 -0
- package/dist/src/types/tab.d.ts +4 -0
- package/dist/src/utils/merge-classes.spec.d.ts +1 -0
- package/dist/src/utils/mobile.d.ts +35 -0
- package/package.json +8 -8
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { FC, ReactNode, MouseEvent } from 'react';
|
|
2
2
|
import { SelectOption } from '../../models/select';
|
|
3
|
+
import { SelectSize, SelectVariant } from '../../types/select';
|
|
3
4
|
export interface DialSelectProps {
|
|
4
5
|
options: SelectOption[];
|
|
5
6
|
multiple?: boolean;
|
|
7
|
+
size?: SelectSize;
|
|
8
|
+
variant?: SelectVariant;
|
|
6
9
|
value?: string | string[];
|
|
10
|
+
prefix?: string;
|
|
7
11
|
defaultValue?: string | string[];
|
|
8
12
|
placeholder?: string;
|
|
9
13
|
searchable?: boolean;
|
|
@@ -16,8 +20,12 @@ export interface DialSelectProps {
|
|
|
16
20
|
disabled?: boolean;
|
|
17
21
|
cssClass?: string;
|
|
18
22
|
closable?: boolean;
|
|
23
|
+
header?: ReactNode | (() => ReactNode);
|
|
24
|
+
footer?: ReactNode | (() => ReactNode);
|
|
19
25
|
onClose?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
20
26
|
onChange?: (next: string | string[]) => void;
|
|
27
|
+
inlineSearch?: boolean;
|
|
28
|
+
onFooterClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
21
29
|
}
|
|
22
30
|
/**
|
|
23
31
|
* A versatile select supporting single and multiple selections.
|
|
@@ -27,35 +35,44 @@ export interface DialSelectProps {
|
|
|
27
35
|
* - In the list, the selected option is indicated by a LEFT border and tinted background
|
|
28
36
|
* (no check icon).
|
|
29
37
|
*
|
|
38
|
+
* Multiple mode uses checkboxes (including Select All with indeterminate state).
|
|
39
|
+
*
|
|
40
|
+
* Search:
|
|
41
|
+
* - `searchable`: shows a plain input in the overlay header that filters options.
|
|
42
|
+
* - `inlineSearch` (single mode only): the trigger renders a plain input; typing filters options;
|
|
43
|
+
* when closed, the input shows the selected label.
|
|
44
|
+
*
|
|
30
45
|
* @example
|
|
31
46
|
* ```tsx
|
|
32
|
-
* <DialSelect
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* ]}
|
|
37
|
-
* multiple
|
|
38
|
-
* />
|
|
47
|
+
* <DialSelect options={[{ value: 'option-1', label: 'Option 1' }]} />
|
|
48
|
+
* <DialSelect searchable options={[{ value: 'a', label: 'Alpha' }, { value: 'b', label: 'Beta' }]} />
|
|
49
|
+
* <DialSelect multiple selectAll options={[{ value: '1', label: 'One' }, { value: '2', label: 'Two' }]} />
|
|
50
|
+
* <DialSelect inlineSearch options={[{ value: 'r', label: 'Relax-Name' }, { value: 'rep2', label: 'rep2' }]} />
|
|
39
51
|
* ```
|
|
40
52
|
*
|
|
41
|
-
* Multiple mode uses checkboxes (including Select All with indeterminate state).
|
|
42
|
-
*
|
|
43
53
|
* @param options - Array of options to select from.
|
|
44
54
|
* @param [multiple] - Whether multiple selections are allowed.
|
|
55
|
+
* @param [size=SelectSize.Md] - Size of the control.
|
|
56
|
+
* @param [variant=SelectVariant.Primary] - Visual variant.
|
|
45
57
|
* @param [value] - Controlled selected value(s).
|
|
58
|
+
* @param [prefix] - Prefix for selected value(s).
|
|
46
59
|
* @param [defaultValue] - Uncontrolled initial selected value(s).
|
|
47
|
-
* @param [placeholder] - Placeholder text when no selection is made.
|
|
48
|
-
* @param [searchable] -
|
|
49
|
-
* @param [searchPlaceholder] -
|
|
50
|
-
* @param [selectAll] -
|
|
51
|
-
* @param [selectAllLabel] - Label for the "Select All" checkbox.
|
|
52
|
-
* @param [emptyStateTitle] - Title text when there are no options
|
|
53
|
-
* @param [emptyStateDescription] -
|
|
54
|
-
* @param [emptyStateIcon] -
|
|
55
|
-
* @param [disabled] -
|
|
56
|
-
* @param [cssClass] - Additional CSS classes
|
|
57
|
-
* @param [closable] -
|
|
58
|
-
* @param [
|
|
59
|
-
* @param [
|
|
60
|
+
* @param [placeholder="Select..."] - Placeholder text when no selection is made.
|
|
61
|
+
* @param [searchable=false] - Show a search field in the overlay header.
|
|
62
|
+
* @param [searchPlaceholder] - Placeholder for the search input (overlay/inline).
|
|
63
|
+
* @param [selectAll=false] - Show a "Select All" checkbox in multiple mode.
|
|
64
|
+
* @param [selectAllLabel="Select all"] - Label for the "Select All" checkbox.
|
|
65
|
+
* @param [emptyStateTitle="No options available"] - Title text when there are no options.
|
|
66
|
+
* @param [emptyStateDescription] - Description text when there are no options.
|
|
67
|
+
* @param [emptyStateIcon] - Icon to display when there are no options.
|
|
68
|
+
* @param [disabled=false] - Disable the control.
|
|
69
|
+
* @param [cssClass] - Additional CSS classes for the trigger.
|
|
70
|
+
* @param [closable=false] - Show a close button in the dropdown header.
|
|
71
|
+
* @param [header] - Custom node/function rendered above the options.
|
|
72
|
+
* @param [footer] - Custom node/function rendered below the options.
|
|
73
|
+
* @param [onClose] - Called when the dropdown close button is clicked.
|
|
74
|
+
* @param [onChange] - Called when the selection changes.
|
|
75
|
+
* @param [inlineSearch=false] - Render a plain input inside trigger (single mode only).
|
|
76
|
+
* @param [onFooterClick] - Called when the footer element is clicked. When provided, automatically closes the dropdown.
|
|
60
77
|
*/
|
|
61
78
|
export declare const DialSelect: FC<DialSelectProps>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export declare const selectTriggerBaseClasses = "dial-input flex
|
|
1
|
+
export declare const selectTriggerBaseClasses = "dial-input flex w-full items-center justify-between gap-2 dial-small";
|
|
2
2
|
export declare const selectOverlayBaseClasses = "w-full rounded";
|
|
3
3
|
export declare const selectOptionBaseClasses = "flex w-full items-center justify-between gap-2 px-3 h-[34px] dial-small text-primary truncate hover:bg-accent-primary-alpha focus:bg-accent-primary-alpha focus:outline-none";
|
|
4
4
|
export declare const selectOptionSelectedClasses = "bg-accent-primary-alpha";
|
|
5
5
|
export declare const selectOptionSingleSelectedClasses = "bg-accent-primary-alpha border-l border-accent-primary border-1";
|
|
6
6
|
export declare const selectOptionDisabledClasses = "opacity-75";
|
|
7
7
|
export declare const selectChevronIcon: import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare const selectCheckIcon: import("react/jsx-runtime").JSX.Element;
|
|
@@ -25,6 +25,11 @@ export interface DialSelectFieldProps extends Omit<DialSelectProps, 'cssClass'>,
|
|
|
25
25
|
* onChange={(v) => setTransport(v as string)}
|
|
26
26
|
* />
|
|
27
27
|
*
|
|
28
|
+
* @params - Component properties extending:
|
|
29
|
+
* - {@link DialSelectProps} for select options and props, except for cssClass
|
|
30
|
+
* - {@link DialFormItemProps} for form item props, except for htmlFor
|
|
31
|
+
* - {@link DialFieldLabelProps} for label props, except for label, children, value
|
|
32
|
+
*
|
|
28
33
|
* @param selectCssClass CSS class for the select element
|
|
29
34
|
* @param containerCssClass CSS class for the form item container
|
|
30
35
|
* @param emptyStateTitle Title to show when there are no options
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,6 @@ import { FC } from 'react';
|
|
|
3
3
|
export interface DialTabProps {
|
|
4
4
|
tab: TabModel;
|
|
5
5
|
active: boolean;
|
|
6
|
-
disabled?: boolean;
|
|
7
6
|
invalid?: boolean;
|
|
8
7
|
horizontal?: boolean;
|
|
9
8
|
cssClass?: string;
|
|
@@ -24,10 +23,8 @@ export interface DialTabProps {
|
|
|
24
23
|
* />
|
|
25
24
|
* ```
|
|
26
25
|
*
|
|
27
|
-
* @param tab - The tab model containing its `id`
|
|
26
|
+
* @param tab - The tab model containing its `id`, `name`, [`disabled`], [`invalid`].
|
|
28
27
|
* @param active - Whether the tab is currently active.
|
|
29
|
-
* @param [disabled=false] - Whether the tab is disabled and non-interactive.
|
|
30
|
-
* @param [invalid=false] - Whether the tab is marked as invalid, displaying an error icon.
|
|
31
28
|
* @param [horizontal=false] - Whether the tab is displayed in horizontal orientation.
|
|
32
29
|
* @param [cssClass] - Additional CSS classes applied to the tab element.
|
|
33
30
|
* @param onClick - Callback fired when the tab is clicked. Receives the tab’s `id`.
|
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { TabModel } from '../../models/tab';
|
|
3
|
-
import { TabOrientation } from '../../types/tab';
|
|
3
|
+
import { SmallScreenThreshold, TabOrientation } from '../../types/tab';
|
|
4
4
|
export interface DialTabsProps {
|
|
5
5
|
tabs: TabModel[];
|
|
6
6
|
activeTab: string;
|
|
7
7
|
onClick: (id: string) => void;
|
|
8
8
|
orientation?: TabOrientation;
|
|
9
|
+
smallScreenThreshold?: SmallScreenThreshold;
|
|
10
|
+
smallScreenContainerCssClass?: string;
|
|
11
|
+
smallScreenDropdownItemCssClass?: string;
|
|
9
12
|
}
|
|
10
13
|
/**
|
|
11
|
-
* A responsive and overflow-aware tabs component that adapts
|
|
12
|
-
*
|
|
13
|
-
* the component automatically adds a dropdown button for accessing hidden tabs and enables smooth horizontal scrolling.
|
|
14
|
+
* A responsive and overflow-aware tabs component that automatically adapts its layout
|
|
15
|
+
* between a scrollable tab bar and a dropdown menu on smaller screens.
|
|
14
16
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
+
* When there are too many tabs to fit in a single line, it introduces a dropdown button
|
|
18
|
+
* for accessing hidden tabs and ensures smooth horizontal scrolling. The component also
|
|
19
|
+
* automatically keeps the active tab in view.
|
|
17
20
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
21
|
+
* Supports both horizontal and vertical orientations and dynamically adjusts layout
|
|
22
|
+
* based on screen size and available space.
|
|
23
|
+
*
|
|
24
|
+
* On larger screens, tabs are displayed according to the `orientation` prop
|
|
25
|
+
* (horizontal or vertical). On smaller screens (mobile or tablet), the tabs collapse
|
|
26
|
+
* into a dropdown menu for better usability.
|
|
20
27
|
*
|
|
21
28
|
* @example
|
|
22
29
|
* ```tsx
|
|
@@ -32,15 +39,21 @@ export interface DialTabsProps {
|
|
|
32
39
|
* />
|
|
33
40
|
* ```
|
|
34
41
|
*
|
|
35
|
-
* @param tabs - Array of tab models to render. Each tab
|
|
42
|
+
* @param tabs - Array of tab models to render. Each tab must include an `id` and a display `name`.
|
|
36
43
|
* @param activeTab - The identifier of the currently active tab.
|
|
37
44
|
* @param onClick - Callback fired when a tab is selected. Receives the tab's `id` as an argument.
|
|
38
|
-
* @param [orientation=TabOrientation.Horizontal] -
|
|
45
|
+
* @param [orientation=TabOrientation.Horizontal] - Layout direction of the tabs. Uses the {@link TabOrientation} enum.
|
|
46
|
+
* @param [smallScreenThreshold=SmallScreenThreshold.Tablet] - Defines the screen size threshold
|
|
47
|
+
* below which tabs collapse into a dropdown. Uses the {@link SmallScreenThreshold} enum.
|
|
48
|
+
* When set to `Tablet`, both mobile and tablet screens will trigger dropdown mode.
|
|
49
|
+
* @param [smallScreenContainerCssClass] - Optional CSS class applied to the dropdown container
|
|
50
|
+
* in small-screen (collapsed) mode.
|
|
51
|
+
* @param [smallScreenDropdownItemCssClass] - Optional CSS class applied to individual dropdown
|
|
52
|
+
* items in small-screen mode.
|
|
39
53
|
*
|
|
40
54
|
* @remarks
|
|
41
|
-
* - Automatically detects overflow
|
|
42
|
-
*
|
|
43
|
-
* -
|
|
44
|
-
* - Switches to a dedicated dropdown interface on mobile and tablet screens via the `useIsTabletScreen` hook.
|
|
55
|
+
* - Automatically detects horizontal overflow via `ResizeObserver` and shows a dropdown when needed.
|
|
56
|
+
* - Smoothly scrolls to keep the active tab visible when navigating.
|
|
57
|
+
* - Switches layout responsively based on `smallScreenThreshold`.
|
|
45
58
|
*/
|
|
46
59
|
export declare const DialTabs: FC<DialTabsProps>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TagVariant } from '../../types/tag';
|
|
2
|
-
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { FC, MouseEvent, ReactNode } from 'react';
|
|
3
3
|
export interface DialTagProps {
|
|
4
4
|
tag: string;
|
|
5
5
|
cssClass?: string;
|
|
6
|
-
remove?: (event:
|
|
6
|
+
remove?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
7
7
|
variant?: TagVariant;
|
|
8
8
|
iconBefore?: ReactNode;
|
|
9
9
|
bordered?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { DialTooltipContainerOptions } from './TooltipContext';
|
|
3
|
-
export interface
|
|
3
|
+
export interface DialTooltipProps extends DialTooltipContainerOptions {
|
|
4
4
|
hideTooltip?: boolean;
|
|
5
5
|
tooltip: ReactNode;
|
|
6
6
|
children: ReactNode;
|
|
@@ -28,4 +28,4 @@ export interface Props extends DialTooltipContainerOptions {
|
|
|
28
28
|
* @param [open] - Controlled open state for the tooltip
|
|
29
29
|
* @param [onOpenChange] - Callback fired when the tooltip open state changes
|
|
30
30
|
*/
|
|
31
|
-
export declare const DialTooltip: FC<
|
|
31
|
+
export declare const DialTooltip: FC<DialTooltipProps>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { HTMLProps } from 'react';
|
|
1
|
+
import { CSSProperties, FC, HTMLProps } from 'react';
|
|
2
|
+
export interface Props extends HTMLProps<HTMLDivElement> {
|
|
3
|
+
style?: CSSProperties;
|
|
4
|
+
}
|
|
2
5
|
/**
|
|
3
6
|
* The content area of a tooltip that displays the tooltip information
|
|
4
7
|
*
|
|
5
8
|
* @param children - The content to display inside the tooltip
|
|
6
9
|
* @param [style] - Additional inline styles for the tooltip content
|
|
7
10
|
*/
|
|
8
|
-
export declare const DialTooltipContent:
|
|
11
|
+
export declare const DialTooltipContent: FC<Props>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { HTMLProps } from 'react';
|
|
1
|
+
import { FC, HTMLProps } from 'react';
|
|
2
|
+
interface TooltipTriggerProps extends HTMLProps<HTMLElement> {
|
|
3
|
+
asChild?: boolean;
|
|
4
|
+
}
|
|
2
5
|
/**
|
|
3
6
|
* The trigger element for a tooltip that can be clicked or hovered
|
|
4
7
|
*
|
|
5
8
|
* @param children - The element that will trigger the tooltip
|
|
6
9
|
* @param [asChild=false] - Whether to render as a child element instead of wrapping in a span
|
|
7
10
|
*/
|
|
8
|
-
export declare const DialTooltipTrigger:
|
|
9
|
-
|
|
10
|
-
}, "ref"> & import('react').RefAttributes<HTMLElement>>;
|
|
11
|
+
export declare const DialTooltipTrigger: FC<TooltipTriggerProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export interface UseEditableItemOptions {
|
|
2
|
+
value: string;
|
|
3
|
+
isEditing: boolean;
|
|
4
|
+
onValidate?: (value: string) => string | null;
|
|
5
|
+
onSave?: (value: string) => void;
|
|
6
|
+
onCancel?: () => void;
|
|
7
|
+
restoreOnCancel?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface UseEditableItemResult {
|
|
10
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
11
|
+
value: string;
|
|
12
|
+
onChange: (newValue?: string) => void;
|
|
13
|
+
invalid: boolean;
|
|
14
|
+
invalidMessage: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A React hook that manages the behavior of an inline-editable text input.
|
|
18
|
+
* It provides validation handling, cancel/restore logic, auto-focus behavior,
|
|
19
|
+
* keyboard shortcuts, and outside-click detection.
|
|
20
|
+
*
|
|
21
|
+
* @param {Object} options - Hook configuration options.
|
|
22
|
+
* @param {string} options.value - Initial value for the editable input.
|
|
23
|
+
* @param {boolean} options.isEditing - Whether the item is currently in edit mode.
|
|
24
|
+
* @param {(value: string) => string | null} [options.onValidate] - Optional validation function returning an error message or `null` if valid.
|
|
25
|
+
* @param {(value: string) => void} [options.onSave] - Callback invoked when saving a valid value.
|
|
26
|
+
* @param {() => void} [options.onCancel] - Callback invoked when canceling editing.
|
|
27
|
+
* @param {boolean} [options.restoreOnCancel=true] - Whether to restore the original value on cancel.
|
|
28
|
+
*
|
|
29
|
+
* @returns {Object} An object containing state and handlers for editable input.
|
|
30
|
+
* @returns {React.RefObject<HTMLInputElement>} return.inputRef - Ref to the editable input element.
|
|
31
|
+
* @returns {string} return.value - Current input value.
|
|
32
|
+
* @returns {(newValue?: string) => void} return.onChange - Change handler for the input value.
|
|
33
|
+
* @returns {boolean} return.invalid - Whether the current value is invalid.
|
|
34
|
+
* @returns {string} return.invalidMessage - Validation error message, if any.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* const {
|
|
39
|
+
* inputRef,
|
|
40
|
+
* value,
|
|
41
|
+
* onChange,
|
|
42
|
+
* invalid,
|
|
43
|
+
* invalidMessage
|
|
44
|
+
* } = useEditableItem({
|
|
45
|
+
* value: 'example.txt',
|
|
46
|
+
* isEditing,
|
|
47
|
+
* onValidate: (v) => v.trim() ? null : 'Name cannot be empty',
|
|
48
|
+
* onSave: (v) => console.log('Saved', v),
|
|
49
|
+
* onCancel: () => console.log('Canceled'),
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* return (
|
|
53
|
+
* <input
|
|
54
|
+
* ref={inputRef}
|
|
55
|
+
* value={value}
|
|
56
|
+
* onChange={(e) => onChange(e.target.value)}
|
|
57
|
+
* aria-invalid={invalid}
|
|
58
|
+
* />
|
|
59
|
+
* {invalid && <span>{invalidMessage}</span>}
|
|
60
|
+
* );
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function useEditableItem({ value: initialValue, isEditing, restoreOnCancel, onValidate, onSave, onCancel, }: UseEditableItemOptions): UseEditableItemResult;
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { FlexibleActionsDirection } from '../types/flexible-actions';
|
|
2
|
+
interface UseFlexibleActionsOptions<T> {
|
|
3
|
+
actions: T[];
|
|
4
|
+
direction?: FlexibleActionsDirection;
|
|
5
|
+
moreButtonWidth?: number;
|
|
6
|
+
actionsGap?: number;
|
|
7
|
+
containerPadding?: number;
|
|
8
|
+
dependencies?: unknown[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A responsive layout hook that automatically determines how many action buttons
|
|
12
|
+
* can fit within a container and moves overflowing ones into a hidden list (e.g. a dropdown).
|
|
13
|
+
*
|
|
14
|
+
* It measures each action's width and dynamically recalculates visible and hidden actions
|
|
15
|
+
* whenever the container resizes or dependencies change.
|
|
16
|
+
*
|
|
17
|
+
* This hook is reusable for toolbars or action strips that can have:
|
|
18
|
+
* - a **left fixed section** (e.g., selection info),
|
|
19
|
+
* - a **right fixed section** (e.g., metadata or pagination),
|
|
20
|
+
* - and a **flexible central section** where actions may overflow.
|
|
21
|
+
*
|
|
22
|
+
* @template T - Type of the action item. Each action must have a unique `key` property.
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} options - Hook configuration options.
|
|
25
|
+
* @param {T[]} options.actions - Array of all available actions.
|
|
26
|
+
* @param {FlexibleActionsDirection} [options.direction=FlexibleActionsDirection.Normal] -
|
|
27
|
+
* Defines the fill direction:
|
|
28
|
+
* - `Normal`: Fills actions from left to right.
|
|
29
|
+
* - `Reverse`: Fills actions from right to left (useful when the "More" button is on the right).
|
|
30
|
+
* @param {number} [options.moreButtonWidth=BASE_ICON_SIZE] - Reserved width for the “more” or overflow button.
|
|
31
|
+
* @param {number} [options.actionsGap=8] - Horizontal gap (in pixels) between action buttons.
|
|
32
|
+
* @param {number} [options.containerPadding=8] - Horizontal padding (in pixels) inside the container.
|
|
33
|
+
* @param {unknown[]} [options.dependencies=[]] - Dependency array to trigger recalculation when external layout-affecting
|
|
34
|
+
* values (like screen size or visibility) change.
|
|
35
|
+
*
|
|
36
|
+
* @returns Result object containing the calculated visible and hidden actions and all relevant refs.
|
|
37
|
+
*
|
|
38
|
+
* @property {T[]} visibleActions - Actions that currently fit into the available width.
|
|
39
|
+
* @property {T[]} hiddenActions - Actions that do not fit and should be rendered inside a dropdown.
|
|
40
|
+
*
|
|
41
|
+
* @property {Object} refs - A set of refs used for layout measurement.
|
|
42
|
+
* @property {RefObject<HTMLDivElement>} refs.containerRef - Ref for the outer container. Must wrap the entire toolbar area.
|
|
43
|
+
* @property {RefObject<HTMLDivElement>} refs.measureRef - Ref for a hidden measurement container (used to measure action widths).
|
|
44
|
+
* @property {RefObject<HTMLDivElement>} refs.leftSectionRef - Ref for the left fixed section (optional).
|
|
45
|
+
* @property {RefObject<HTMLDivElement>} refs.rightSectionRef - Ref for the right fixed section (optional).
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // Example usage inside a toolbar component:
|
|
49
|
+
* const { visibleActions, hiddenActions, refs } = useFlexibleActions({
|
|
50
|
+
* actions,
|
|
51
|
+
* direction: FlexibleActionsDirection.Reverse,
|
|
52
|
+
* dependencies: [isMobile],
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* return (
|
|
56
|
+
* <>
|
|
57
|
+
* <div ref={refs.measureRef} className="invisible absolute top-0 left-0 flex gap-2">
|
|
58
|
+
* {actions.map(a => <ActionButton key={a.key} {...a} />)}
|
|
59
|
+
* </div>
|
|
60
|
+
*
|
|
61
|
+
* <div ref={refs.containerRef} className="flex justify-between items-center">
|
|
62
|
+
* <div ref={refs.leftSectionRef}>Left section</div>
|
|
63
|
+
*
|
|
64
|
+
* <div className="flex gap-2 items-center">
|
|
65
|
+
* {hiddenActions.length > 0 && <MoreMenu items={hiddenActions} />}
|
|
66
|
+
* {visibleActions.map(a => <ActionButton key={a.key} {...a} />)}
|
|
67
|
+
* </div>
|
|
68
|
+
*
|
|
69
|
+
* <div ref={refs.rightSectionRef}>Right section</div>
|
|
70
|
+
* </div>
|
|
71
|
+
* </>
|
|
72
|
+
* );
|
|
73
|
+
*/
|
|
74
|
+
export declare function useFlexibleActions<T extends {
|
|
75
|
+
key: string;
|
|
76
|
+
}>({ actions, direction, moreButtonWidth, actionsGap, containerPadding, dependencies, }: UseFlexibleActionsOptions<T>): {
|
|
77
|
+
visibleActions: T[];
|
|
78
|
+
hiddenActions: T[];
|
|
79
|
+
refs: {
|
|
80
|
+
containerRef: import('react').RefObject<HTMLDivElement | null>;
|
|
81
|
+
measureRef: import('react').RefObject<HTMLDivElement | null>;
|
|
82
|
+
leftSectionRef: import('react').RefObject<HTMLDivElement | null>;
|
|
83
|
+
rightSectionRef: import('react').RefObject<HTMLDivElement | null>;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A React hook that determines whether the current window size matches a mobile screen width.
|
|
3
|
+
*
|
|
4
|
+
* It initializes based on the current screen size using `isSmallScreen()` and updates its value
|
|
5
|
+
* whenever the window is resized.
|
|
6
|
+
*
|
|
7
|
+
* @returns {boolean} `true` if the viewport width matches the mobile breakpoint, otherwise `false`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const isMobile = useIsMobileScreen();
|
|
11
|
+
* if (isMobile) {
|
|
12
|
+
* console.log('Mobile layout active');
|
|
13
|
+
* }
|
|
14
|
+
*/
|
|
15
|
+
export declare const useIsMobileScreen: () => boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A React hook that determines the current screen type based on the viewport width.
|
|
3
|
+
*
|
|
4
|
+
* It uses `getScreenType()` to categorize the screen as `Desktop`, `Tablet`, or `Mobile`,
|
|
5
|
+
* and automatically updates the value when the window is resized.
|
|
6
|
+
*
|
|
7
|
+
* This hook is useful for implementing responsive layouts that adapt
|
|
8
|
+
* their UI or behavior depending on screen type.
|
|
9
|
+
*
|
|
10
|
+
* @returns {ScreenType} The current screen type (`Desktop`, `Tablet`, `Mobile`, or `Undefined` for SSR).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const screenType = useScreenType();
|
|
14
|
+
*
|
|
15
|
+
* if (screenType === ScreenType.Desktop) {
|
|
16
|
+
* console.log('Desktop layout active');
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
export declare const useScreenType: () => import('../types/screen').ScreenType;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ export { DialFormItem } from './components/FormItem/FormItem';
|
|
|
18
18
|
export { DialSharedEntityIndicator } from './components/SharedEntityIndicator/SharedEntityIndicator';
|
|
19
19
|
export { DialFileName } from './components/FileName/FileName';
|
|
20
20
|
export { DialFolderName } from './components/FolderName/FolderName';
|
|
21
|
+
export { DialDateCellRenderer } from './components/Grid/renderers/DateCellRenderer';
|
|
21
22
|
export { DialTabs } from './components/Tabs/Tabs';
|
|
22
|
-
export { DialTab } from './components/Tab/Tab';
|
|
23
23
|
export { DialBreadcrumb } from './components/Breadcrumb/Breadcrumb';
|
|
24
24
|
export { DialBreadcrumbItem } from './components/Breadcrumb/BreadcrumbItem';
|
|
25
25
|
export { DialButton } from './components/Button/Button';
|
|
@@ -33,8 +33,6 @@ export { DialPopup } from './components/Popup/Popup';
|
|
|
33
33
|
export { DialConfirmationPopup } from './components/ConfirmationPopup/ConfirmationPopup';
|
|
34
34
|
export { DialRadioGroupPopupField } from './components/RadioGroupPopupField/RadioGroupPopupField';
|
|
35
35
|
export { DialFormPopup } from './components/FormPopup/FormPopup';
|
|
36
|
-
export { DialFileManagerNavigationPanel } from './components/FileManager/components/FileManagerNavigationPanel/FileManagerNavigationPanel';
|
|
37
|
-
export { DialFileManager } from './components/FileManager/FileManager';
|
|
38
36
|
export { DialInput } from './components/Input/Input';
|
|
39
37
|
export type { DialInputProps } from './components/Input/Input';
|
|
40
38
|
export { DialNumberInputField } from './components/InputField/InputField';
|
|
@@ -56,14 +54,20 @@ export { ButtonVariant } from './types/button';
|
|
|
56
54
|
export { RadioGroupOrientation } from './types/radio-group';
|
|
57
55
|
export { PopupSize } from './types/popup';
|
|
58
56
|
export { ConfirmationPopupVariant } from './types/confirmation-popup';
|
|
59
|
-
export { DropdownType } from './types/dropdown';
|
|
57
|
+
export { DropdownType, DropdownTrigger, DropdownItemType, } from './types/dropdown';
|
|
60
58
|
export { SearchSize } from './types/search';
|
|
61
59
|
export { TagVariant } from './types/tag';
|
|
62
60
|
export { TabOrientation } from './types/tab';
|
|
63
61
|
export type { DialBreadcrumbPathItem } from './models/breadcrumb';
|
|
64
62
|
export { FormItemOrientation } from './types/form-item';
|
|
65
|
-
export {
|
|
63
|
+
export { SelectSize, SelectVariant } from './types/select';
|
|
64
|
+
export { DialFileManagerTabs, DialFileManagerActions, type DialCopiedItem, type DialDeletedItem, } from './types/file-manager';
|
|
65
|
+
export { FlexibleActionsDirection } from './types/flexible-actions';
|
|
66
|
+
export { DialItemType } from './types/item';
|
|
66
67
|
export { useDialFileManagerTabs } from './components/FileManager/hooks/use-file-manager-tabs';
|
|
68
|
+
export { useEditableItem } from './hooks/use-editable-item';
|
|
69
|
+
export { FileManagerProvider } from './components/FileManager/FileManagerProvider';
|
|
70
|
+
export { useFileManagerContext } from './components/FileManager/hooks/use-file-manager-context';
|
|
67
71
|
export { StepStatus } from './models/step';
|
|
68
72
|
export type { Step } from './models/step';
|
|
69
73
|
export type { RadioButtonWithContent } from './models/radio';
|
|
@@ -72,5 +76,5 @@ export type { TabModel } from './models/tab';
|
|
|
72
76
|
export type { DropdownItem } from './models/dropdown';
|
|
73
77
|
export type { DialModifiedEntity } from './models/base-entity';
|
|
74
78
|
export type { DialFile } from './models/file';
|
|
75
|
-
export
|
|
79
|
+
export { DialFileNodeType, DialFilePermission, DialFileResourceType, } from './models/file';
|
|
76
80
|
export { mergeClasses } from './utils/merge-classes';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DropdownItemType } from '../types/dropdown';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { ReactNode, MouseEvent } from 'react';
|
|
3
3
|
export interface DropdownItem {
|
|
4
4
|
key: string;
|
|
5
5
|
label?: ReactNode;
|
|
@@ -9,6 +9,6 @@ export interface DropdownItem {
|
|
|
9
9
|
type?: DropdownItemType;
|
|
10
10
|
onClick?: (info: {
|
|
11
11
|
key: string;
|
|
12
|
-
domEvent:
|
|
12
|
+
domEvent: MouseEvent;
|
|
13
13
|
}) => void;
|
|
14
14
|
}
|
package/dist/src/models/tab.d.ts
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
|
+
import { DialFileNodeType } from '../models/file';
|
|
1
2
|
export declare enum DialFileManagerTabs {
|
|
2
3
|
MyFiles = "my_files",
|
|
3
4
|
Shared = "shared",
|
|
4
5
|
Organization = "organization"
|
|
5
6
|
}
|
|
7
|
+
export declare enum DialFileManagerActions {
|
|
8
|
+
Copy = "copy",
|
|
9
|
+
Cut = "cut",
|
|
10
|
+
Paste = "paste",
|
|
11
|
+
Rename = "rename",
|
|
12
|
+
Download = "download",
|
|
13
|
+
Delete = "delete"
|
|
14
|
+
}
|
|
15
|
+
export interface DialCopiedItem {
|
|
16
|
+
sourceUrl: string;
|
|
17
|
+
destinationUrl: string;
|
|
18
|
+
overwrite?: boolean;
|
|
19
|
+
nodeType: DialFileNodeType;
|
|
20
|
+
}
|
|
21
|
+
export interface DialDeletedItem {
|
|
22
|
+
sourceUrl: string;
|
|
23
|
+
nodeType: DialFileNodeType;
|
|
24
|
+
}
|
package/dist/src/types/tab.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|