@reportportal/ui-kit 0.0.1-alpha.1 → 0.0.1-alpha.11
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/LICENSE +201 -201
- package/README.md +229 -3
- package/dist/baseIconButton-7bc53dec.js +25 -0
- package/dist/baseIconButton.js +7 -0
- package/dist/bind-06a7ff84.js +41 -0
- package/dist/bubblesLoader-a7e709d4.js +17 -0
- package/dist/bubblesLoader.js +7 -0
- package/dist/button-7fb84fde.js +62 -0
- package/dist/button.js +3 -3
- package/dist/checkbox-6777be17.js +73 -0
- package/dist/checkbox.js +4 -3
- package/dist/common/constants/keyCodes.d.ts +24 -0
- package/dist/common/hooks/index.d.ts +2 -0
- package/dist/common/hooks/useOnClickOutside.d.ts +2 -0
- package/dist/common/hooks/useWindowResize.d.ts +4 -0
- package/dist/components/bubblesLoader/bubblesLoader.d.ts +7 -0
- package/dist/components/bubblesLoader/index.d.ts +3 -0
- package/dist/components/button/button.d.ts +6 -7
- package/dist/components/button/index.d.ts +2 -1
- package/dist/components/checkbox/checkbox.d.ts +5 -7
- package/dist/components/dropdown/constants.d.ts +7 -0
- package/dist/components/dropdown/dropdown.d.ts +23 -0
- package/dist/components/dropdown/dropdownOption/dropdownOption.d.ts +3 -0
- package/dist/components/dropdown/dropdownOption/index.d.ts +3 -0
- package/dist/components/dropdown/index.d.ts +3 -0
- package/dist/components/dropdown/types.d.ts +20 -0
- package/dist/components/dropdown/utils.d.ts +4 -0
- package/dist/components/fieldNumber/constants.d.ts +4 -0
- package/dist/components/fieldNumber/fieldNumber.d.ts +18 -0
- package/dist/components/fieldNumber/index.d.ts +3 -0
- package/dist/components/fieldText/fieldText.d.ts +24 -0
- package/dist/components/fieldText/index.d.ts +3 -0
- package/dist/components/fieldTextFlex/fieldTextFlex.d.ts +14 -0
- package/dist/components/fieldTextFlex/index.d.ts +3 -0
- package/dist/components/icons/baseIconButton/baseIconButton.d.ts +8 -0
- package/dist/components/icons/baseIconButton/index.d.ts +4 -0
- package/dist/components/icons/index.d.ts +12 -0
- package/dist/components/index.d.ts +13 -0
- package/dist/components/modal/index.d.ts +4 -0
- package/dist/components/modal/modal.d.ts +21 -0
- package/dist/components/modal/modalContent/index.d.ts +1 -0
- package/dist/components/modal/modalContent/modalContent.d.ts +6 -0
- package/dist/components/modal/modalFooter/index.d.ts +2 -0
- package/dist/components/modal/modalFooter/modalFooter.d.ts +12 -0
- package/dist/components/modal/modalHeader/index.d.ts +1 -0
- package/dist/components/modal/modalHeader/modalHeader.d.ts +8 -0
- package/dist/components/pagination/index.d.ts +4 -0
- package/dist/components/pagination/itemsCounter/index.d.ts +1 -0
- package/dist/components/pagination/itemsCounter/itemCounter.d.ts +9 -0
- package/dist/components/pagination/pageControls/activePage/activePage.d.ts +12 -0
- package/dist/components/pagination/pageControls/activePage/index.d.ts +1 -0
- package/dist/components/pagination/pageControls/activePage/pageSelector/index.d.ts +1 -0
- package/dist/components/pagination/pageControls/activePage/pageSelector/pageSelector.d.ts +10 -0
- package/dist/components/pagination/pageControls/index.d.ts +1 -0
- package/dist/components/pagination/pageControls/pageControls.d.ts +16 -0
- package/dist/components/pagination/pageControls/pageNavigator/bar/bar.d.ts +11 -0
- package/dist/components/pagination/pageControls/pageNavigator/bar/index.d.ts +1 -0
- package/dist/components/pagination/pageControls/pageNavigator/index.d.ts +1 -0
- package/dist/components/pagination/pageControls/pageNavigator/pageNavigator.d.ts +11 -0
- package/dist/components/pagination/pageSizeControl/index.d.ts +1 -0
- package/dist/components/pagination/pageSizeControl/pageSizeControl.d.ts +10 -0
- package/dist/components/pagination/pageSizeControl/sizeSelector/index.d.ts +1 -0
- package/dist/components/pagination/pageSizeControl/sizeSelector/sizeSelector.d.ts +8 -0
- package/dist/components/pagination/pagination.d.ts +22 -0
- package/dist/components/pagination/types.d.ts +2 -0
- package/dist/components/popover/index.d.ts +1 -0
- package/dist/components/popover/popover.d.ts +18 -0
- package/dist/components/radio/index.d.ts +4 -0
- package/dist/components/radio/radio.d.ts +16 -0
- package/dist/components/radio/radioGroup.d.ts +8 -0
- package/dist/components/table/index.d.ts +3 -0
- package/dist/components/table/table.d.ts +3 -0
- package/dist/components/table/types.d.ts +49 -0
- package/dist/components/table/utils.d.ts +3 -0
- package/dist/components/themeProvider/themeProvider.d.ts +2 -1
- package/dist/components/toggle/index.d.ts +3 -0
- package/dist/components/toggle/toggle.d.ts +11 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/tooltip.d.ts +13 -0
- package/dist/dropdown-e07f2a71.js +212 -0
- package/dist/dropdown.js +14 -0
- package/dist/fieldNumber-46fe79b9.js +127 -0
- package/dist/fieldNumber.js +10 -0
- package/dist/fieldText-d80b29ba.js +102 -0
- package/dist/fieldText.js +9 -0
- package/dist/fieldTextFlex-5bddf46a.js +67 -0
- package/dist/fieldTextFlex.js +8 -0
- package/dist/index-bb9b62ef.js +131 -0
- package/dist/index.js +56 -11
- package/dist/keyCodes-f63c0e11.js +4 -0
- package/dist/modal.js +16 -0
- package/dist/pagination-5449cd03.js +346 -0
- package/dist/pagination.js +15 -0
- package/dist/popover.js +95 -0
- package/dist/radio-fd49a09c.js +76 -0
- package/dist/radio.js +9 -0
- package/dist/style.css +1 -1
- package/dist/systemMessage-1ced6079.js +30 -0
- package/dist/systemMessage.js +5 -6
- package/dist/table-231fd19c.js +138 -0
- package/dist/table.js +11 -0
- package/dist/themeProvider-46c2be7b.js +23 -0
- package/dist/themeProvider.js +3 -3
- package/dist/toggle-707ecb74.js +67 -0
- package/dist/toggle.js +9 -0
- package/dist/tooltip.js +70 -0
- package/dist/useOnClickOutside-c332f7d3.js +16 -0
- package/package.json +93 -64
- package/dist/bind-e1346f99.js +0 -44
- package/dist/button-9e154905.js +0 -1867
- package/dist/checkbox-ae12c5f5.js +0 -74
- package/dist/constants/key-codes.d.ts +0 -4
- package/dist/jsx-runtime-2962e83b.js +0 -631
- package/dist/systemMessage-5dc0f1e6.js +0 -30
- package/dist/themeProvider-4c0ab2a2.js +0 -19
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ItemCounter } from './itemCounter';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ChangePage } from '../../types';
|
|
3
|
+
interface ActivePageProps {
|
|
4
|
+
activePage: number;
|
|
5
|
+
totalPages: number;
|
|
6
|
+
pageText: string;
|
|
7
|
+
goToText: string;
|
|
8
|
+
goActionText: string;
|
|
9
|
+
changePage: ChangePage;
|
|
10
|
+
}
|
|
11
|
+
export declare const ActivePage: FC<ActivePageProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ActivePage } from './activePage';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PageSelector } from './pageSelector';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ChangePage } from '../../../types';
|
|
3
|
+
interface PageSelectorProps {
|
|
4
|
+
pageText: string;
|
|
5
|
+
goActionText: string;
|
|
6
|
+
totalPages: number;
|
|
7
|
+
selectPage: ChangePage;
|
|
8
|
+
}
|
|
9
|
+
export declare const PageSelector: FC<PageSelectorProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PageControls } from './pageControls';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ChangePage } from '../types';
|
|
3
|
+
type PageControlsCaptions = {
|
|
4
|
+
page: string;
|
|
5
|
+
goTo: string;
|
|
6
|
+
goAction: string;
|
|
7
|
+
of: string;
|
|
8
|
+
};
|
|
9
|
+
export interface PageControlsProps {
|
|
10
|
+
activePage: number;
|
|
11
|
+
totalPages: number;
|
|
12
|
+
changePage: ChangePage;
|
|
13
|
+
captions: PageControlsCaptions;
|
|
14
|
+
}
|
|
15
|
+
export declare const PageControls: FC<PageControlsProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Bar } from './bar';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PageNavigator } from './pageNavigator';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ChangePage } from '../../types';
|
|
3
|
+
export interface PageNavigatorProps {
|
|
4
|
+
activePage: number;
|
|
5
|
+
totalPages: number;
|
|
6
|
+
changePage: ChangePage;
|
|
7
|
+
captions: {
|
|
8
|
+
goTo: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare const PageNavigator: FC<PageNavigatorProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PageSizeControl } from './pageSizeControl';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ChangePageSize } from '../types';
|
|
3
|
+
interface PageSizeControlProps {
|
|
4
|
+
size: number;
|
|
5
|
+
sizeOptions: number[];
|
|
6
|
+
perPageText: string;
|
|
7
|
+
changeSize: ChangePageSize;
|
|
8
|
+
}
|
|
9
|
+
export declare const PageSizeControl: FC<PageSizeControlProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SizeSelector } from './sizeSelector';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ChangePageSize, ChangePage } from './types';
|
|
3
|
+
type PaginationCaptions = {
|
|
4
|
+
items?: string;
|
|
5
|
+
of?: string;
|
|
6
|
+
page?: string;
|
|
7
|
+
goTo?: string;
|
|
8
|
+
goAction?: string;
|
|
9
|
+
perPage?: string;
|
|
10
|
+
};
|
|
11
|
+
export interface PaginationProps {
|
|
12
|
+
activePage: number;
|
|
13
|
+
totalPages: number;
|
|
14
|
+
pageSize: number;
|
|
15
|
+
totalItems: number;
|
|
16
|
+
pageSizeOptions: number[];
|
|
17
|
+
changePage: ChangePage;
|
|
18
|
+
changePageSize: ChangePageSize;
|
|
19
|
+
captions?: PaginationCaptions;
|
|
20
|
+
}
|
|
21
|
+
export declare const Pagination: FC<PaginationProps>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Popover } from './popover';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { Placement } from '@floating-ui/react';
|
|
3
|
+
interface PopoverProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
content: ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
placement?: Placement;
|
|
8
|
+
fallbackPlacements?: Placement[];
|
|
9
|
+
title?: string;
|
|
10
|
+
arrowOffset?: number;
|
|
11
|
+
safeZone?: number;
|
|
12
|
+
arrowColor?: string;
|
|
13
|
+
dataAutomationId?: string;
|
|
14
|
+
isOpened?: boolean;
|
|
15
|
+
setIsOpened?: (isOpened: boolean) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const Popover: FC<PopoverProps>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChangeEventHandler, HTMLAttributes, ReactNode, FC } from 'react';
|
|
2
|
+
export type RadioValue = string | number;
|
|
3
|
+
export type RadioOption = {
|
|
4
|
+
value: RadioValue;
|
|
5
|
+
label: string;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
};
|
|
8
|
+
export interface RadioProps extends HTMLAttributes<HTMLInputElement> {
|
|
9
|
+
option: RadioOption;
|
|
10
|
+
value?: RadioValue;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
15
|
+
}
|
|
16
|
+
export declare const Radio: FC<RadioProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { RadioProps } from './index';
|
|
3
|
+
import { RadioOption } from './radio';
|
|
4
|
+
interface RadioGroupProps extends Omit<RadioProps, 'option'> {
|
|
5
|
+
options: RadioOption[];
|
|
6
|
+
}
|
|
7
|
+
export declare const RadioGroup: FC<RadioGroupProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface Column {
|
|
3
|
+
key: string;
|
|
4
|
+
header: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PrimaryColumn extends Column {
|
|
7
|
+
primary: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface FixedColumn extends Column {
|
|
10
|
+
width: string | number;
|
|
11
|
+
align?: 'left' | 'center' | 'right';
|
|
12
|
+
}
|
|
13
|
+
export interface RowConfigs {
|
|
14
|
+
size?: 'small' | 'medium' | 'large';
|
|
15
|
+
}
|
|
16
|
+
export interface DetailedCellData {
|
|
17
|
+
content: string | number;
|
|
18
|
+
component: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export interface RowData {
|
|
21
|
+
id: string | number;
|
|
22
|
+
[key: string]: DetailedCellData | RowConfigs | string | number | any;
|
|
23
|
+
rowConfigs?: RowConfigs;
|
|
24
|
+
}
|
|
25
|
+
export declare enum SortDirection {
|
|
26
|
+
ASC = "asc",
|
|
27
|
+
DESC = "desc"
|
|
28
|
+
}
|
|
29
|
+
export interface SortConfig {
|
|
30
|
+
key: string;
|
|
31
|
+
direction: SortDirection;
|
|
32
|
+
}
|
|
33
|
+
export interface TableComponentProps {
|
|
34
|
+
data: RowData[];
|
|
35
|
+
primaryColumn: Column;
|
|
36
|
+
fixedColumns: FixedColumn[];
|
|
37
|
+
rowActionMenu?: ReactNode;
|
|
38
|
+
selectable?: boolean;
|
|
39
|
+
className?: string;
|
|
40
|
+
headerClassName?: string;
|
|
41
|
+
rowClassName?: string;
|
|
42
|
+
selectedRowIds?: (string | number)[];
|
|
43
|
+
sortingDirection?: SortDirection;
|
|
44
|
+
sortingColumn?: Column;
|
|
45
|
+
sortableColumns?: string[];
|
|
46
|
+
onChangeSorting?: (sortConfig?: SortConfig) => void;
|
|
47
|
+
onToggleRowSelection?: (id: string | number) => void;
|
|
48
|
+
onToggleAllRowsSelection?: () => void;
|
|
49
|
+
}
|
|
@@ -7,6 +7,7 @@ interface IThemeProviderProps {
|
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
theme?: ThemeKey;
|
|
9
9
|
customThemes?: ITheme;
|
|
10
|
+
className?: string;
|
|
10
11
|
}
|
|
11
|
-
export declare function ThemeProvider({ children, theme, customThemes, }: IThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function ThemeProvider({ children, theme, customThemes, className, }: IThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChangeEventHandler, FC, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
interface ToggleProps extends HTMLAttributes<HTMLInputElement> {
|
|
3
|
+
value: boolean;
|
|
4
|
+
title?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
9
|
+
}
|
|
10
|
+
export declare const Toggle: FC<ToggleProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tooltip } from './tooltip';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { Placement } from '@floating-ui/react-dom';
|
|
3
|
+
interface TooltipProps {
|
|
4
|
+
content: ReactNode;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
dynamicWidth?: boolean;
|
|
8
|
+
width?: number;
|
|
9
|
+
placement?: Placement;
|
|
10
|
+
dataAutomationId?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const Tooltip: FC<TooltipProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { jsx as a, jsxs as L } from "react/jsx-runtime";
|
|
2
|
+
import * as R from "react";
|
|
3
|
+
import { forwardRef as F, useState as Y, useRef as B } from "react";
|
|
4
|
+
import { c as A } from "./bind-06a7ff84.js";
|
|
5
|
+
import { useFloating as ee, offset as te, flip as ne } from "@floating-ui/react-dom";
|
|
6
|
+
import { useSelect as x } from "downshift";
|
|
7
|
+
import { Scrollbars as de } from "rc-scrollbars";
|
|
8
|
+
import { u as oe } from "./useOnClickOutside-c332f7d3.js";
|
|
9
|
+
import { K as f } from "./keyCodes-f63c0e11.js";
|
|
10
|
+
import { B as se } from "./baseIconButton-7bc53dec.js";
|
|
11
|
+
const ae = (t) => /* @__PURE__ */ R.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ R.createElement("path", { d: "M14.2174 5.82426C14.3736 5.66805 14.3736 5.41479 14.2174 5.25858L14.0759 5.11716C13.9197 4.96095 13.6665 4.96095 13.5103 5.11716L8.16726 10.4602L2.82426 5.11716C2.66805 4.96095 2.41479 4.96095 2.25858 5.11716L2.11716 5.25858C1.96095 5.41479 1.96095 5.66805 2.11716 5.82426L7.89176 11.5989C8.04797 11.7551 8.30124 11.7551 8.45745 11.5989L8.88171 11.1746L8.87436 11.1673L14.2174 5.82426Z", fill: "#A2AAB5" })), le = "_disabled_nx3fh_13", re = "_hidden_nx3fh_17", ie = "_selected_nx3fh_23", ce = "_hover_nx3fh_26", _e = {
|
|
12
|
+
"dropdown-option": "_dropdown-option_nx3fh_1",
|
|
13
|
+
disabled: le,
|
|
14
|
+
hidden: re,
|
|
15
|
+
selected: ie,
|
|
16
|
+
hover: ce,
|
|
17
|
+
"single-option": "_single-option_nx3fh_39",
|
|
18
|
+
"sub-option": "_sub-option_nx3fh_45"
|
|
19
|
+
}, P = A.bind(_e), he = F(
|
|
20
|
+
(t, n) => {
|
|
21
|
+
const {
|
|
22
|
+
option: { value: s, disabled: i, hidden: O, label: l, title: d, groupRef: E },
|
|
23
|
+
selected: D,
|
|
24
|
+
onChange: p,
|
|
25
|
+
render: g,
|
|
26
|
+
highlightHovered: b,
|
|
27
|
+
onMouseEnter: w
|
|
28
|
+
} = t, N = () => {
|
|
29
|
+
p && p(s);
|
|
30
|
+
};
|
|
31
|
+
return /* @__PURE__ */ a(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: P("dropdown-option", {
|
|
35
|
+
selected: D,
|
|
36
|
+
disabled: i,
|
|
37
|
+
hidden: O,
|
|
38
|
+
hover: b
|
|
39
|
+
}),
|
|
40
|
+
title: i && d || void 0,
|
|
41
|
+
onClick: N,
|
|
42
|
+
ref: n,
|
|
43
|
+
onMouseEnter: w,
|
|
44
|
+
children: /* @__PURE__ */ a("div", { className: P("single-option", { "sub-option": !!E }), children: g ? g(t) : l })
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
), fe = [
|
|
49
|
+
f.ENTER_KEY_CODE,
|
|
50
|
+
f.SPACE_KEY_CODE,
|
|
51
|
+
f.ARROW_DOWN_KEY_CODE
|
|
52
|
+
], ge = [f.ESCAPE_KEY_CODE, f.TAB_KEY_CODE];
|
|
53
|
+
var h = /* @__PURE__ */ ((t) => (t.ON_KEY_DOWN = "onKeyDown", t.ON_CLICK = "onClick", t))(h || {});
|
|
54
|
+
const pe = (t, n) => t.map(({ value: s }) => s).indexOf(n), we = (t, n) => (t % n + n) % n, v = (t, n = 0, s = 1) => {
|
|
55
|
+
if (!t[n].disabled)
|
|
56
|
+
return n;
|
|
57
|
+
const i = t.length;
|
|
58
|
+
return v(
|
|
59
|
+
t,
|
|
60
|
+
we(n + s, i),
|
|
61
|
+
s
|
|
62
|
+
);
|
|
63
|
+
}, me = (t, n) => v(t, n), ue = (t, n) => v(t, n, -1), Ce = "_container_3wi7d_1", Oe = "_icon_3wi7d_7", Ee = "_arrow_3wi7d_13", De = "_dropdown_3wi7d_19", be = "_disabled_3wi7d_36", Ne = "_value_3wi7d_43", xe = "_error_3wi7d_46", ve = "_touched_3wi7d_46", Ke = "_opened_3wi7d_50", ye = "_placeholder_3wi7d_72", Ie = "_ghost_3wi7d_108", ke = {
|
|
64
|
+
container: Ce,
|
|
65
|
+
icon: Oe,
|
|
66
|
+
arrow: Ee,
|
|
67
|
+
dropdown: De,
|
|
68
|
+
"transparent-background": "_transparent-background_3wi7d_33",
|
|
69
|
+
disabled: be,
|
|
70
|
+
value: Ne,
|
|
71
|
+
error: xe,
|
|
72
|
+
touched: ve,
|
|
73
|
+
opened: Ke,
|
|
74
|
+
placeholder: ye,
|
|
75
|
+
"mobile-disabled": "_mobile-disabled_3wi7d_87",
|
|
76
|
+
"select-list": "_select-list_3wi7d_92",
|
|
77
|
+
ghost: Ie
|
|
78
|
+
}, _ = A.bind(ke), $e = ({
|
|
79
|
+
value: t = "",
|
|
80
|
+
options: n = [],
|
|
81
|
+
disabled: s = !1,
|
|
82
|
+
error: i,
|
|
83
|
+
onChange: O,
|
|
84
|
+
onFocus: l,
|
|
85
|
+
onBlur: d,
|
|
86
|
+
mobileDisabled: E,
|
|
87
|
+
title: D,
|
|
88
|
+
touched: p = !1,
|
|
89
|
+
icon: g,
|
|
90
|
+
variant: b,
|
|
91
|
+
placeholder: w = "",
|
|
92
|
+
renderOption: N,
|
|
93
|
+
transparentBackground: T = !1,
|
|
94
|
+
className: W,
|
|
95
|
+
toggleButtonClassName: H
|
|
96
|
+
}) => {
|
|
97
|
+
const [r, c] = Y(!1), K = B(null), [M, m] = Y(null), { refs: y, floatingStyles: $ } = ee({
|
|
98
|
+
middleware: [
|
|
99
|
+
te(5),
|
|
100
|
+
ne({
|
|
101
|
+
fallbackPlacements: ["bottom", "top"]
|
|
102
|
+
})
|
|
103
|
+
]
|
|
104
|
+
});
|
|
105
|
+
oe(K, () => {
|
|
106
|
+
r && (c(!1), d == null || d());
|
|
107
|
+
});
|
|
108
|
+
const I = (e) => {
|
|
109
|
+
e.disabled || (O(e.value), c((o) => !o));
|
|
110
|
+
}, j = () => n.find(({ value: e }) => e === t), k = pe(n, t), {
|
|
111
|
+
getToggleButtonProps: V,
|
|
112
|
+
getMenuProps: U,
|
|
113
|
+
getItemProps: Z,
|
|
114
|
+
setHighlightedIndex: u,
|
|
115
|
+
highlightedIndex: S,
|
|
116
|
+
selectedItem: C
|
|
117
|
+
} = x({
|
|
118
|
+
items: n,
|
|
119
|
+
itemToString: (e) => (e != null && e.label ? String(e.label) : w) || "",
|
|
120
|
+
selectedItem: j(),
|
|
121
|
+
isOpen: r,
|
|
122
|
+
circularNavigation: !0,
|
|
123
|
+
defaultHighlightedIndex: k,
|
|
124
|
+
onHighlightedIndexChange: (e) => {
|
|
125
|
+
switch (e.type) {
|
|
126
|
+
case x.stateChangeTypes.MenuKeyDownArrowUp:
|
|
127
|
+
return m(h.ON_KEY_DOWN), u(ue(n, e.highlightedIndex)), e;
|
|
128
|
+
case x.stateChangeTypes.MenuKeyDownArrowDown:
|
|
129
|
+
return m(h.ON_KEY_DOWN), u(me(n, e.highlightedIndex)), e;
|
|
130
|
+
default:
|
|
131
|
+
return e;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}), q = () => {
|
|
135
|
+
s || (c((e) => !e), r ? d == null || d() : l == null || l(), m(h.ON_CLICK));
|
|
136
|
+
}, z = () => {
|
|
137
|
+
if (!t && t !== !1)
|
|
138
|
+
return w;
|
|
139
|
+
let e = t;
|
|
140
|
+
return n.forEach((o) => {
|
|
141
|
+
o.value === t && (e = o.label);
|
|
142
|
+
}), e;
|
|
143
|
+
}, G = (e) => {
|
|
144
|
+
const { keyCode: o } = e;
|
|
145
|
+
fe.includes(o) && !r && (e.preventDefault(), u(k), c(!0), l == null || l(), m(h.ON_KEY_DOWN));
|
|
146
|
+
}, J = (e) => {
|
|
147
|
+
const { keyCode: o } = e;
|
|
148
|
+
if (o === f.ENTER_KEY_CODE) {
|
|
149
|
+
const X = n[S];
|
|
150
|
+
I(X), c(!1), d == null || d();
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
ge.includes(o) && (e.stopPropagation(), c(!1), d == null || d());
|
|
154
|
+
}, Q = () => n.map((e, o) => /* @__PURE__ */ a(
|
|
155
|
+
he,
|
|
156
|
+
{
|
|
157
|
+
...Z({
|
|
158
|
+
item: e,
|
|
159
|
+
index: o
|
|
160
|
+
}),
|
|
161
|
+
selected: e.value === ((C == null ? void 0 : C.value) ?? C),
|
|
162
|
+
option: e,
|
|
163
|
+
highlightHovered: S === o && M !== h.ON_CLICK,
|
|
164
|
+
render: N,
|
|
165
|
+
onChange: e.disabled ? null : () => I(e),
|
|
166
|
+
onMouseEnter: () => u(o)
|
|
167
|
+
},
|
|
168
|
+
e.value
|
|
169
|
+
));
|
|
170
|
+
return /* @__PURE__ */ L("div", { ref: K, className: _("container", W), title: D, children: [
|
|
171
|
+
/* @__PURE__ */ L(
|
|
172
|
+
"button",
|
|
173
|
+
{
|
|
174
|
+
disabled: s,
|
|
175
|
+
...V({
|
|
176
|
+
className: _("dropdown", b, H, {
|
|
177
|
+
"transparent-background": T,
|
|
178
|
+
opened: r,
|
|
179
|
+
disabled: s,
|
|
180
|
+
error: i,
|
|
181
|
+
touched: p,
|
|
182
|
+
"mobile-disabled": E
|
|
183
|
+
}),
|
|
184
|
+
onClick: q,
|
|
185
|
+
onKeyDown: G,
|
|
186
|
+
ref: y.setReference
|
|
187
|
+
}),
|
|
188
|
+
children: [
|
|
189
|
+
g && /* @__PURE__ */ a("span", { className: _("icon"), children: g }),
|
|
190
|
+
/* @__PURE__ */ a("span", { className: _("value", { placeholder: !t }), children: z() }),
|
|
191
|
+
/* @__PURE__ */ a(se, { className: _("arrow"), tabIndex: -1, children: /* @__PURE__ */ a(ae, {}) })
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
r && /* @__PURE__ */ a(
|
|
196
|
+
"div",
|
|
197
|
+
{
|
|
198
|
+
style: $,
|
|
199
|
+
className: _("select-list", { opened: r }),
|
|
200
|
+
...U({
|
|
201
|
+
onKeyDown: J,
|
|
202
|
+
ref: y.setFloating
|
|
203
|
+
}),
|
|
204
|
+
children: /* @__PURE__ */ a(de, { autoHeight: !0, autoHeightMax: 216, hideTracksWhenNotNeeded: !0, children: Q() })
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
] });
|
|
208
|
+
};
|
|
209
|
+
export {
|
|
210
|
+
$e as D,
|
|
211
|
+
ae as S
|
|
212
|
+
};
|
package/dist/dropdown.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { D as r } from "./dropdown-e07f2a71.js";
|
|
2
|
+
import "react/jsx-runtime";
|
|
3
|
+
import "react";
|
|
4
|
+
import "./bind-06a7ff84.js";
|
|
5
|
+
import "@floating-ui/react-dom";
|
|
6
|
+
import "downshift";
|
|
7
|
+
import "rc-scrollbars";
|
|
8
|
+
import "./useOnClickOutside-c332f7d3.js";
|
|
9
|
+
import "./keyCodes-f63c0e11.js";
|
|
10
|
+
import "./baseIconButton-7bc53dec.js";
|
|
11
|
+
export {
|
|
12
|
+
r as Dropdown,
|
|
13
|
+
r as default
|
|
14
|
+
};
|