@reportportal/ui-kit 0.0.1-alpha.7 → 0.0.1-alpha.8
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 +197 -3
- package/dist/baseIconButton-7bc53dec.js +25 -0
- package/dist/baseIconButton.js +7 -0
- package/dist/bubblesLoader-a7e709d4.js +17 -0
- package/dist/bubblesLoader.js +1 -1
- package/dist/button-497b4d19.js +62 -0
- package/dist/button.js +1 -1
- package/dist/{checkbox-fdc44740.js → checkbox-1e21cf3e.js} +16 -16
- package/dist/checkbox.js +1 -1
- package/dist/components/button/button.d.ts +0 -1
- package/dist/components/button/index.d.ts +2 -2
- package/dist/components/dropdown/constants.d.ts +4 -0
- package/dist/components/dropdown/dropdown.d.ts +0 -1
- 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 +7 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/modal/modal.d.ts +3 -1
- 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/themeProvider/themeProvider.d.ts +2 -1
- package/dist/dropdown-e07f2a71.js +212 -0
- package/dist/dropdown.js +3 -4
- package/dist/fieldNumber-46fe79b9.js +127 -0
- package/dist/fieldNumber.js +2 -3
- package/dist/fieldText-65a50d9d.js +101 -0
- package/dist/fieldText.js +2 -2
- package/dist/index-2bee4457.js +131 -0
- package/dist/index.js +31 -25
- package/dist/modal.js +14 -126
- package/dist/style.css +1 -1
- package/dist/systemMessage-1ced6079.js +30 -0
- package/dist/systemMessage.js +1 -1
- package/dist/themeProvider-46c2be7b.js +23 -0
- package/dist/themeProvider.js +4 -3
- package/dist/toggle-707ecb74.js +67 -0
- package/dist/toggle.js +1 -1
- package/package.json +28 -5
- package/dist/bubblesLoader-9bec3797.js +0 -17
- package/dist/button-d4944dbc.js +0 -64
- package/dist/clear-4963efcd.js +0 -5
- package/dist/components/icon/icon.d.ts +0 -11
- package/dist/components/icon/icons.d.ts +0 -21
- package/dist/components/icon/index.d.ts +0 -3
- package/dist/dropdown-45e7bc7d.js +0 -204
- package/dist/fieldNumber-27e69676.js +0 -132
- package/dist/fieldText-c7085849.js +0 -99
- package/dist/icon-71262f5c.js +0 -26
- package/dist/icon.js +0 -9
- package/dist/systemMessage-62c3133d.js +0 -30
- package/dist/themeProvider-5800417e.js +0 -19
- package/dist/toggle-5b3d8333.js +0 -67
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { c as a } from "./bind-06a7ff84.js";
|
|
3
|
+
const n = "_bubble_kn4ln_1", c = "_bubbles_kn4ln_1", r = {
|
|
4
|
+
"bubbles-loader": "_bubbles-loader_kn4ln_1",
|
|
5
|
+
"color-topaz": "_color-topaz_kn4ln_4",
|
|
6
|
+
bubble: n,
|
|
7
|
+
bubbles: c
|
|
8
|
+
}, s = a.bind(r), _ = 7, i = ({
|
|
9
|
+
color: b = "topaz",
|
|
10
|
+
className: o
|
|
11
|
+
}) => /* @__PURE__ */ l("div", { className: s("bubbles-loader", o, { [`color-${b}`]: b }), children: Array(_).fill(void 0).map((t, e) => (
|
|
12
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
13
|
+
/* @__PURE__ */ l("div", { className: s("bubble") }, e)
|
|
14
|
+
)) });
|
|
15
|
+
export {
|
|
16
|
+
i as B
|
|
17
|
+
};
|
package/dist/bubblesLoader.js
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsxs as z, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as h } from "react";
|
|
3
|
+
import { c as l } from "./bind-06a7ff84.js";
|
|
4
|
+
const u = "_button_3xwzb_1", f = "_primary_3xwzb_19", g = "_disabled_3xwzb_24", y = "_ghost_3xwzb_36", N = "_danger_3xwzb_54", B = "_text_3xwzb_70", $ = "_icon_3xwzb_116", j = {
|
|
5
|
+
button: u,
|
|
6
|
+
primary: f,
|
|
7
|
+
disabled: g,
|
|
8
|
+
ghost: y,
|
|
9
|
+
danger: N,
|
|
10
|
+
text: B,
|
|
11
|
+
"width-wide-content": "_width-wide-content_3xwzb_106",
|
|
12
|
+
"width-parent": "_width-parent_3xwzb_111",
|
|
13
|
+
icon: $,
|
|
14
|
+
"icon-start": "_icon-start_3xwzb_122",
|
|
15
|
+
"icon-end": "_icon-end_3xwzb_126"
|
|
16
|
+
}, c = l.bind(j), q = h(
|
|
17
|
+
({
|
|
18
|
+
variant: t = "primary",
|
|
19
|
+
icon: e,
|
|
20
|
+
iconPlace: n = "start",
|
|
21
|
+
adjustWidthOn: o = "content",
|
|
22
|
+
type: r = "button",
|
|
23
|
+
children: i,
|
|
24
|
+
disabled: s = !1,
|
|
25
|
+
onClick: a,
|
|
26
|
+
title: b,
|
|
27
|
+
className: w,
|
|
28
|
+
...x
|
|
29
|
+
}, d) => {
|
|
30
|
+
const m = c("button", t, w, {
|
|
31
|
+
disabled: s,
|
|
32
|
+
[`width-${o}`]: o
|
|
33
|
+
}), _ = t === "text" && e;
|
|
34
|
+
return /* @__PURE__ */ z(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
ref: d,
|
|
38
|
+
type: r,
|
|
39
|
+
disabled: s,
|
|
40
|
+
className: m,
|
|
41
|
+
onClick: a,
|
|
42
|
+
title: b,
|
|
43
|
+
...x,
|
|
44
|
+
children: [
|
|
45
|
+
_ && /* @__PURE__ */ p(
|
|
46
|
+
"i",
|
|
47
|
+
{
|
|
48
|
+
className: c("icon", {
|
|
49
|
+
[`icon-${n}`]: n
|
|
50
|
+
}),
|
|
51
|
+
children: _
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
i
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
export {
|
|
61
|
+
q as B
|
|
62
|
+
};
|
package/dist/button.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { jsxs as u, jsx as
|
|
1
|
+
import { jsxs as u, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { c as x } from "./bind-06a7ff84.js";
|
|
3
3
|
import { useRef as d } from "react";
|
|
4
|
-
import { K as
|
|
5
|
-
const m = "
|
|
4
|
+
import { K as _ } from "./keyCodes-f63c0e11.js";
|
|
5
|
+
const m = "_checkbox_l76v2_1", f = "_disabled_l76v2_11", y = "_input_l76v2_16", C = "_control_l76v2_23", E = "_children_l76v2_77", D = {
|
|
6
6
|
checkbox: m,
|
|
7
7
|
disabled: f,
|
|
8
|
-
input:
|
|
9
|
-
control:
|
|
10
|
-
children:
|
|
11
|
-
}, e = x.bind(
|
|
12
|
-
children:
|
|
8
|
+
input: y,
|
|
9
|
+
control: C,
|
|
10
|
+
children: E
|
|
11
|
+
}, e = x.bind(D), j = ({
|
|
12
|
+
children: l,
|
|
13
13
|
disabled: c = !1,
|
|
14
|
-
onChange:
|
|
14
|
+
onChange: p,
|
|
15
15
|
className: b,
|
|
16
16
|
value: s,
|
|
17
17
|
...h
|
|
18
18
|
}) => {
|
|
19
19
|
const o = d(null), k = (n) => {
|
|
20
20
|
var a, i;
|
|
21
|
-
const { keyCode:
|
|
22
|
-
if (
|
|
21
|
+
const { keyCode: r } = n;
|
|
22
|
+
if (r === _.SPACE_KEY_CODE) {
|
|
23
23
|
n.preventDefault(), (a = o.current) == null || a.click();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
r === _.ENTER_KEY_CODE && (n.preventDefault(), (i = o.current) == null || i.click());
|
|
27
27
|
};
|
|
28
28
|
return /* @__PURE__ */ u(
|
|
29
29
|
"label",
|
|
@@ -33,7 +33,7 @@ const m = "_checkbox_1ggpr_1", f = "_disabled_1ggpr_12", g = "_input_1ggpr_17",
|
|
|
33
33
|
disabled: c
|
|
34
34
|
}),
|
|
35
35
|
children: [
|
|
36
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ t(
|
|
37
37
|
"input",
|
|
38
38
|
{
|
|
39
39
|
ref: o,
|
|
@@ -42,12 +42,12 @@ const m = "_checkbox_1ggpr_1", f = "_disabled_1ggpr_12", g = "_input_1ggpr_17",
|
|
|
42
42
|
onKeyDown: k,
|
|
43
43
|
className: e("input"),
|
|
44
44
|
disabled: c,
|
|
45
|
-
onChange:
|
|
45
|
+
onChange: p,
|
|
46
46
|
checked: s,
|
|
47
47
|
...h
|
|
48
48
|
}
|
|
49
49
|
),
|
|
50
|
-
/* @__PURE__ */
|
|
50
|
+
/* @__PURE__ */ t(
|
|
51
51
|
"span",
|
|
52
52
|
{
|
|
53
53
|
"aria-labelledby": "rp-ui-kit-checkbox-label",
|
|
@@ -58,7 +58,7 @@ const m = "_checkbox_1ggpr_1", f = "_disabled_1ggpr_12", g = "_input_1ggpr_17",
|
|
|
58
58
|
})
|
|
59
59
|
}
|
|
60
60
|
),
|
|
61
|
-
|
|
61
|
+
l && /* @__PURE__ */ t("span", { className: e("children", { disabled: c }), children: l })
|
|
62
62
|
]
|
|
63
63
|
}
|
|
64
64
|
);
|
package/dist/checkbox.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { KeyCodes } from '../../common/constants/keyCodes';
|
|
2
2
|
export declare const OPEN_DROPDOWN_KEY_CODES: KeyCodes[];
|
|
3
3
|
export declare const CLOSE_DROPDOWN_KEY_CODES: KeyCodes[];
|
|
4
|
+
export declare enum EventName {
|
|
5
|
+
ON_KEY_DOWN = "onKeyDown",
|
|
6
|
+
ON_CLICK = "onClick"
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ChangeEventHandler, ComponentPropsWithRef, FC, FocusEventHandler, KeyboardEventHandler } from 'react';
|
|
2
|
+
export interface FieldTextFlexProps extends ComponentPropsWithRef<'textarea'> {
|
|
3
|
+
value: string;
|
|
4
|
+
readonly?: boolean;
|
|
5
|
+
error?: string;
|
|
6
|
+
touched?: boolean;
|
|
7
|
+
label?: string;
|
|
8
|
+
helpText?: string;
|
|
9
|
+
onChange?: ChangeEventHandler<HTMLTextAreaElement>;
|
|
10
|
+
onFocus?: FocusEventHandler<HTMLTextAreaElement>;
|
|
11
|
+
onBlur?: FocusEventHandler<HTMLTextAreaElement>;
|
|
12
|
+
onKeyUp?: KeyboardEventHandler<HTMLTextAreaElement>;
|
|
13
|
+
}
|
|
14
|
+
export declare const FieldTextFlex: FC<FieldTextFlexProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC, MouseEventHandler, ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
export interface BaseIconButtonProps extends HTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
7
|
+
}
|
|
8
|
+
export declare const BaseIconButton: FC<BaseIconButtonProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { BaseIconButton } from './baseIconButton';
|
|
2
|
+
export { default as ClearIcon } from './svg/clear.svg';
|
|
3
|
+
export { default as CloseIcon } from './svg/close.svg';
|
|
4
|
+
export { default as PlusIcon } from './svg/plus.svg';
|
|
5
|
+
export { default as MinusIcon } from './svg/minus.svg';
|
|
6
|
+
export { default as DeleteIcon } from './svg/delete.svg';
|
|
7
|
+
export { default as DropdownIcon } from './svg/dropdown.svg';
|
|
@@ -6,6 +6,6 @@ export { ThemeProvider } from './themeProvider';
|
|
|
6
6
|
export { Modal } from './modal';
|
|
7
7
|
export { Dropdown } from './dropdown';
|
|
8
8
|
export { Toggle } from './toggle';
|
|
9
|
-
export { Icon } from './icon';
|
|
10
9
|
export { FieldNumber } from './fieldNumber';
|
|
11
10
|
export { BubblesLoader } from './bubblesLoader';
|
|
11
|
+
export * from './icons';
|
|
@@ -3,17 +3,19 @@ import { ButtonProps } from '../button';
|
|
|
3
3
|
import { ModalSize } from './modalFooter';
|
|
4
4
|
type ModalOverlay = 'default' | 'light-cyan';
|
|
5
5
|
interface ModalProps {
|
|
6
|
+
onClose: () => void;
|
|
6
7
|
title?: ReactNode;
|
|
7
8
|
headerNode?: ReactNode;
|
|
8
9
|
children?: ReactNode;
|
|
9
10
|
footerNode?: ReactNode;
|
|
10
11
|
className?: string;
|
|
12
|
+
zIndex?: number;
|
|
11
13
|
size?: ModalSize;
|
|
12
14
|
overlay?: ModalOverlay;
|
|
13
15
|
allowCloseOutside?: boolean;
|
|
14
16
|
okButton?: ButtonProps;
|
|
15
17
|
cancelButton?: ButtonProps;
|
|
16
|
-
|
|
18
|
+
scrollable?: boolean;
|
|
17
19
|
}
|
|
18
20
|
export declare const Modal: FC<ModalProps>;
|
|
19
21
|
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 {};
|
|
@@ -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,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
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { D as r } from "./dropdown-
|
|
1
|
+
import { D as r } from "./dropdown-e07f2a71.js";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
3
|
import "react";
|
|
4
4
|
import "./bind-06a7ff84.js";
|
|
5
|
-
import "react-
|
|
5
|
+
import "@floating-ui/react-dom";
|
|
6
6
|
import "downshift";
|
|
7
7
|
import "rc-scrollbars";
|
|
8
8
|
import "./useOnClickOutside-c332f7d3.js";
|
|
9
9
|
import "./keyCodes-f63c0e11.js";
|
|
10
|
-
import "./
|
|
11
|
-
import "./clear-4963efcd.js";
|
|
10
|
+
import "./baseIconButton-7bc53dec.js";
|
|
12
11
|
export {
|
|
13
12
|
r as Dropdown,
|
|
14
13
|
r as default
|