@reportportal/ui-kit 0.0.1-alpha.4 → 0.0.1-alpha.6
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/bubblesLoader-9bec3797.js +17 -0
- package/dist/bubblesLoader.js +7 -0
- package/dist/checkbox-fdc44740.js +68 -0
- package/dist/checkbox.js +2 -2
- package/dist/clear-4963efcd.js +5 -0
- package/dist/common/constants/keyCodes.d.ts +24 -0
- package/dist/components/bubblesLoader/bubblesLoader.d.ts +7 -0
- package/dist/components/bubblesLoader/index.d.ts +3 -0
- package/dist/components/checkbox/checkbox.d.ts +0 -1
- package/dist/components/dropdown/constants.d.ts +3 -0
- package/dist/components/dropdown/dropdown.d.ts +24 -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/icon/icon.d.ts +11 -0
- package/dist/components/icon/icons.d.ts +21 -0
- package/dist/components/icon/index.d.ts +3 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/toggle/index.d.ts +3 -0
- package/dist/components/toggle/toggle.d.ts +11 -0
- package/dist/dropdown-45e7bc7d.js +204 -0
- package/dist/dropdown.js +15 -0
- package/dist/fieldNumber-8417cd65.js +132 -0
- package/dist/fieldNumber.js +11 -0
- package/dist/fieldText-c7085849.js +99 -0
- package/dist/fieldText.js +2 -1
- package/dist/icon-71262f5c.js +26 -0
- package/dist/icon.js +9 -0
- package/dist/index.js +27 -13
- package/dist/keyCodes-f63c0e11.js +4 -0
- package/dist/modal.js +90 -99
- package/dist/style.css +1 -1
- package/dist/toggle-5b3d8333.js +67 -0
- package/dist/toggle.js +9 -0
- package/dist/useOnClickOutside-c332f7d3.js +16 -0
- package/package.json +69 -66
- package/dist/checkbox-7736509c.js +0 -70
- package/dist/common/constants/key-codes.d.ts +0 -5
- package/dist/fieldText-9621b0b7.js +0 -99
- package/dist/key-codes-abbe7725.js +0 -4
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { c as r } from "./bind-06a7ff84.js";
|
|
3
|
+
const a = "_bubble_1wrm9_1", c = "_bubbles_1wrm9_1", _ = {
|
|
4
|
+
"bubbles-loader": "_bubbles-loader_1wrm9_1",
|
|
5
|
+
"color-topaz": "_color-topaz_1wrm9_4",
|
|
6
|
+
bubble: a,
|
|
7
|
+
bubbles: c
|
|
8
|
+
}, l = r.bind(_), t = 7, i = ({
|
|
9
|
+
color: b = "topaz",
|
|
10
|
+
className: o
|
|
11
|
+
}) => /* @__PURE__ */ s("div", { className: l("bubbles-loader", o, { [`color-${b}`]: b }), children: Array(t).fill(void 0).map((m, e) => (
|
|
12
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
13
|
+
/* @__PURE__ */ s("div", { className: l("bubble") }, e)
|
|
14
|
+
)) });
|
|
15
|
+
export {
|
|
16
|
+
i as B
|
|
17
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsxs as u, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { c as x } from "./bind-06a7ff84.js";
|
|
3
|
+
import { useRef as d } from "react";
|
|
4
|
+
import { K as p } from "./keyCodes-f63c0e11.js";
|
|
5
|
+
const m = "_checkbox_1ggpr_1", f = "_disabled_1ggpr_12", g = "_input_1ggpr_17", y = "_control_1ggpr_24", C = "_children_1ggpr_78", E = {
|
|
6
|
+
checkbox: m,
|
|
7
|
+
disabled: f,
|
|
8
|
+
input: g,
|
|
9
|
+
control: y,
|
|
10
|
+
children: C
|
|
11
|
+
}, e = x.bind(E), j = ({
|
|
12
|
+
children: t,
|
|
13
|
+
disabled: c = !1,
|
|
14
|
+
onChange: _,
|
|
15
|
+
className: b,
|
|
16
|
+
value: s,
|
|
17
|
+
...h
|
|
18
|
+
}) => {
|
|
19
|
+
const o = d(null), k = (n) => {
|
|
20
|
+
var a, i;
|
|
21
|
+
const { keyCode: l } = n;
|
|
22
|
+
if (l === p.SPACE_KEY_CODE) {
|
|
23
|
+
n.preventDefault(), (a = o.current) == null || a.click();
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
l === p.ENTER_KEY_CODE && (n.preventDefault(), (i = o.current) == null || i.click());
|
|
27
|
+
};
|
|
28
|
+
return /* @__PURE__ */ u(
|
|
29
|
+
"label",
|
|
30
|
+
{
|
|
31
|
+
id: "rp-ui-kit-checkbox-label",
|
|
32
|
+
className: e("checkbox", b, {
|
|
33
|
+
disabled: c
|
|
34
|
+
}),
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ r(
|
|
37
|
+
"input",
|
|
38
|
+
{
|
|
39
|
+
ref: o,
|
|
40
|
+
tabIndex: 0,
|
|
41
|
+
type: "checkbox",
|
|
42
|
+
onKeyDown: k,
|
|
43
|
+
className: e("input"),
|
|
44
|
+
disabled: c,
|
|
45
|
+
onChange: _,
|
|
46
|
+
checked: s,
|
|
47
|
+
...h
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ r(
|
|
51
|
+
"span",
|
|
52
|
+
{
|
|
53
|
+
"aria-labelledby": "rp-ui-kit-checkbox-label",
|
|
54
|
+
role: "checkbox",
|
|
55
|
+
"aria-checked": s,
|
|
56
|
+
className: e("control", {
|
|
57
|
+
disabled: c
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
t && /* @__PURE__ */ r("span", { className: e("children", { disabled: c }), children: t })
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
j as C
|
|
68
|
+
};
|
package/dist/checkbox.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as r } from "./checkbox-
|
|
1
|
+
import { C as r } from "./checkbox-fdc44740.js";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
3
|
import "./bind-06a7ff84.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import "./
|
|
5
|
+
import "./keyCodes-f63c0e11.js";
|
|
6
6
|
export {
|
|
7
7
|
r as Checkbox,
|
|
8
8
|
r as default
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
const l = (t) => /* @__PURE__ */ e.createElement("svg", { width: 17, height: 17, viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ e.createElement("rect", { width: 16.2089, height: 16.1568, rx: 8.07842, fill: "#A2AAB5" }), /* @__PURE__ */ e.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.14768 5.14645C4.95077 5.34171 4.95077 5.65829 5.14768 5.85355L7.49578 8.18198L5.35655 10.3033C5.15963 10.4986 5.15963 10.8151 5.35655 11.0104C5.55346 11.2057 5.87271 11.2057 6.06962 11.0104L8.20886 8.88909L10.1392 10.8033C10.3361 10.9986 10.6554 10.9986 10.8523 10.8033C11.0492 10.608 11.0492 10.2915 10.8523 10.0962L8.92193 8.18198L11.0612 6.06065C11.2581 5.86539 11.2581 5.54881 11.0612 5.35355C10.8643 5.15828 10.545 5.15828 10.3481 5.35355L8.20886 7.47487L5.86076 5.14645C5.66385 4.95118 5.34459 4.95118 5.14768 5.14645Z", fill: "white" }));
|
|
3
|
+
export {
|
|
4
|
+
l as S
|
|
5
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare enum KeyCodes {
|
|
2
|
+
BACKSPACE_KEY_CODE = 8,
|
|
3
|
+
TAB_KEY_CODE = 9,
|
|
4
|
+
ENTER_KEY_CODE = 13,
|
|
5
|
+
ESCAPE_KEY_CODE = 27,
|
|
6
|
+
SPACE_KEY_CODE = 32,
|
|
7
|
+
ARROW_LEFT_KEY_CODE = 37,
|
|
8
|
+
ARROW_UP_KEY_CODE = 38,
|
|
9
|
+
ARROW_RIGHT_KEY_CODE = 39,
|
|
10
|
+
ARROW_DOWN_KEY_CODE = 40,
|
|
11
|
+
DELETE_KEY_CODE = 46,
|
|
12
|
+
NUMBER_START_KEY_CODE = 48,
|
|
13
|
+
NUMBER_END_KEY_CODE = 57,
|
|
14
|
+
NUM_LOCK_0_KEY_CODE = 96,
|
|
15
|
+
NUM_LOCK_1_KEY_CODE = 97,
|
|
16
|
+
NUM_LOCK_2_KEY_CODE = 98,
|
|
17
|
+
NUM_LOCK_3_KEY_CODE = 99,
|
|
18
|
+
NUM_LOCK_4_KEY_CODE = 100,
|
|
19
|
+
NUM_LOCK_5_KEY_CODE = 101,
|
|
20
|
+
NUM_LOCK_6_KEY_CODE = 102,
|
|
21
|
+
NUM_LOCK_7_KEY_CODE = 103,
|
|
22
|
+
NUM_LOCK_8_KEY_CODE = 104,
|
|
23
|
+
NUM_LOCK_9_KEY_CODE = 105
|
|
24
|
+
}
|
|
@@ -4,7 +4,6 @@ interface CheckboxProps extends HTMLAttributes<HTMLInputElement> {
|
|
|
4
4
|
children?: ReactNode;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
className?: string;
|
|
7
|
-
dataAutomationId?: string;
|
|
8
7
|
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
9
8
|
}
|
|
10
9
|
export declare const Checkbox: FC<CheckboxProps>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode, FC } from 'react';
|
|
2
|
+
import { DropdownVariant, RenderDropdownOption, DropdownOptionType, DropdownValue } from './types';
|
|
3
|
+
interface DropdownProps {
|
|
4
|
+
options: DropdownOptionType[];
|
|
5
|
+
value: DropdownValue;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
error?: string;
|
|
8
|
+
mobileDisabled?: boolean;
|
|
9
|
+
title?: string;
|
|
10
|
+
touched?: boolean;
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
variant?: DropdownVariant;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
defaultWidth?: boolean;
|
|
15
|
+
transparentBackground?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
toggleButtonClassName?: string;
|
|
18
|
+
onChange: (value: DropdownValue) => void;
|
|
19
|
+
onFocus?: () => void;
|
|
20
|
+
onBlur?: () => void;
|
|
21
|
+
renderOption?: RenderDropdownOption;
|
|
22
|
+
}
|
|
23
|
+
export declare const Dropdown: FC<DropdownProps>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MouseEventHandler, ReactNode } from 'react';
|
|
2
|
+
export type DropdownVariant = 'default' | 'ghost';
|
|
3
|
+
export type DropdownValue = string | boolean | number;
|
|
4
|
+
export type RenderDropdownOption = (props: DropdownOptionProps) => ReactNode;
|
|
5
|
+
export type DropdownOptionType = {
|
|
6
|
+
value: DropdownValue;
|
|
7
|
+
label: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
hidden?: boolean;
|
|
10
|
+
title?: string;
|
|
11
|
+
groupRef?: string;
|
|
12
|
+
};
|
|
13
|
+
export interface DropdownOptionProps {
|
|
14
|
+
selected?: boolean;
|
|
15
|
+
onChange?: (value: DropdownValue) => void;
|
|
16
|
+
highlightHovered?: boolean;
|
|
17
|
+
render?: RenderDropdownOption;
|
|
18
|
+
onMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
|
19
|
+
option: DropdownOptionType;
|
|
20
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DropdownValue, DropdownOptionType } from './types';
|
|
2
|
+
export declare const calculateDefaultIndex: (options: DropdownOptionType[], selectedValue: DropdownValue) => number;
|
|
3
|
+
export declare const calculateNextIndex: (options: DropdownOptionType[], index?: number) => number;
|
|
4
|
+
export declare const calculatePrevIndex: (options: DropdownOptionType[], index?: number) => number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC, HTMLAttributes, FocusEventHandler } from 'react';
|
|
2
|
+
type FieldNumberValue = number | string;
|
|
3
|
+
interface FieldNumberProps extends Omit<HTMLAttributes<HTMLInputElement>, 'onChange' | 'onFocus'> {
|
|
4
|
+
onChange: (value: number | string) => void;
|
|
5
|
+
value?: FieldNumberValue;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
label?: string;
|
|
9
|
+
postfix?: string;
|
|
10
|
+
min?: number;
|
|
11
|
+
max?: number;
|
|
12
|
+
title?: string;
|
|
13
|
+
error?: string;
|
|
14
|
+
touched?: boolean;
|
|
15
|
+
onFocus?: () => void | FocusEventHandler<HTMLInputElement>;
|
|
16
|
+
}
|
|
17
|
+
export declare const FieldNumber: FC<FieldNumberProps>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC, MouseEventHandler } from 'react';
|
|
2
|
+
import { icons } from './icons';
|
|
3
|
+
type IconName = keyof typeof icons;
|
|
4
|
+
interface IconProps {
|
|
5
|
+
icon: IconName;
|
|
6
|
+
className?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
onClick?: MouseEventHandler<HTMLSpanElement>;
|
|
9
|
+
}
|
|
10
|
+
export declare const Icon: FC<IconProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const icons: {
|
|
3
|
+
clear: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
4
|
+
title?: string | undefined;
|
|
5
|
+
}>;
|
|
6
|
+
close: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
7
|
+
title?: string | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
dropdown: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
10
|
+
title?: string | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
delete: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
13
|
+
title?: string | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
plus: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
16
|
+
title?: string | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
minus: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
19
|
+
title?: string | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
@@ -4,3 +4,8 @@ export { SystemMessage } from './systemMessage';
|
|
|
4
4
|
export { FieldText } from './fieldText';
|
|
5
5
|
export { ThemeProvider } from './themeProvider';
|
|
6
6
|
export { Modal } from './modal';
|
|
7
|
+
export { Dropdown } from './dropdown';
|
|
8
|
+
export { Toggle } from './toggle';
|
|
9
|
+
export { Icon } from './icon';
|
|
10
|
+
export { FieldNumber } from './fieldNumber';
|
|
11
|
+
export { BubblesLoader } from './bubblesLoader';
|
|
@@ -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,204 @@
|
|
|
1
|
+
import { jsx as d, jsxs as R } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Q, useState as X, useRef as S } from "react";
|
|
3
|
+
import { c as H } from "./bind-06a7ff84.js";
|
|
4
|
+
import { Manager as Z, Reference as U, Popper as F } from "react-popper";
|
|
5
|
+
import { useSelect as N } from "downshift";
|
|
6
|
+
import { Scrollbars as B } from "rc-scrollbars";
|
|
7
|
+
import { u as ee } from "./useOnClickOutside-c332f7d3.js";
|
|
8
|
+
import { K as u } from "./keyCodes-f63c0e11.js";
|
|
9
|
+
import { I as ne } from "./icon-71262f5c.js";
|
|
10
|
+
const te = "_disabled_ev7l2_13", oe = "_hidden_ev7l2_17", de = "_selected_ev7l2_23", re = "_hover_ev7l2_26", le = {
|
|
11
|
+
"dropdown-option": "_dropdown-option_ev7l2_1",
|
|
12
|
+
disabled: te,
|
|
13
|
+
hidden: oe,
|
|
14
|
+
selected: de,
|
|
15
|
+
hover: re,
|
|
16
|
+
"single-option": "_single-option_ev7l2_39",
|
|
17
|
+
"sub-option": "_sub-option_ev7l2_45"
|
|
18
|
+
}, T = H.bind(le), se = Q(
|
|
19
|
+
(t, n) => {
|
|
20
|
+
const {
|
|
21
|
+
option: { value: l, disabled: a, hidden: m, label: i, title: r, groupRef: b },
|
|
22
|
+
selected: w,
|
|
23
|
+
onChange: g,
|
|
24
|
+
render: f,
|
|
25
|
+
highlightHovered: E,
|
|
26
|
+
onMouseEnter: p
|
|
27
|
+
} = t, C = () => {
|
|
28
|
+
g && g(l);
|
|
29
|
+
};
|
|
30
|
+
return /* @__PURE__ */ d(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
className: T("dropdown-option", {
|
|
34
|
+
selected: w,
|
|
35
|
+
disabled: a,
|
|
36
|
+
hidden: m,
|
|
37
|
+
hover: E
|
|
38
|
+
}),
|
|
39
|
+
title: a && r || void 0,
|
|
40
|
+
onClick: C,
|
|
41
|
+
ref: n,
|
|
42
|
+
onMouseEnter: p,
|
|
43
|
+
children: /* @__PURE__ */ d("div", { className: T("single-option", { "sub-option": !!b }), children: f ? f(t) : i })
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
), ae = [
|
|
48
|
+
u.ENTER_KEY_CODE,
|
|
49
|
+
u.SPACE_KEY_CODE,
|
|
50
|
+
u.ARROW_DOWN_KEY_CODE
|
|
51
|
+
], ie = [u.ESCAPE_KEY_CODE, u.TAB_KEY_CODE], ce = (t, n) => t.map(({ value: l }) => l).indexOf(n), _e = (t, n) => (t % n + n) % n, x = (t, n = 0, l = 1) => {
|
|
52
|
+
if (!t[n].disabled)
|
|
53
|
+
return n;
|
|
54
|
+
const a = t.length;
|
|
55
|
+
return x(t, _e(n + l, a));
|
|
56
|
+
}, he = (t, n) => x(t, n), ue = (t, n) => x(t, n, -1), fe = "_container_1d54v_1", ge = "_icon_1d54v_10", pe = "_arrow_1d54v_16", ve = "_dropdown_1d54v_22", me = "_disabled_1d54v_39", be = "_error_1d54v_43", we = "_touched_1d54v_43", Ee = "_opened_1d54v_47", Ce = "_placeholder_1d54v_72", De = "_value_1d54v_75", Oe = "_ghost_1d54v_113", Ne = {
|
|
57
|
+
container: fe,
|
|
58
|
+
"default-width": "_default-width_1d54v_6",
|
|
59
|
+
icon: ge,
|
|
60
|
+
arrow: pe,
|
|
61
|
+
dropdown: ve,
|
|
62
|
+
"transparent-background": "_transparent-background_1d54v_36",
|
|
63
|
+
disabled: me,
|
|
64
|
+
error: be,
|
|
65
|
+
touched: we,
|
|
66
|
+
opened: Ee,
|
|
67
|
+
placeholder: Ce,
|
|
68
|
+
value: De,
|
|
69
|
+
"mobile-disabled": "_mobile-disabled_1d54v_87",
|
|
70
|
+
"select-list": "_select-list_1d54v_92",
|
|
71
|
+
ghost: Oe
|
|
72
|
+
}, h = H.bind(Ne), Pe = ({
|
|
73
|
+
value: t = "",
|
|
74
|
+
options: n = [],
|
|
75
|
+
disabled: l = !1,
|
|
76
|
+
error: a,
|
|
77
|
+
onChange: m,
|
|
78
|
+
onFocus: i,
|
|
79
|
+
onBlur: r,
|
|
80
|
+
mobileDisabled: b,
|
|
81
|
+
title: w,
|
|
82
|
+
touched: g = !1,
|
|
83
|
+
icon: f,
|
|
84
|
+
variant: E,
|
|
85
|
+
placeholder: p = "",
|
|
86
|
+
defaultWidth: C = !0,
|
|
87
|
+
renderOption: M,
|
|
88
|
+
transparentBackground: P = !1,
|
|
89
|
+
className: Y,
|
|
90
|
+
toggleButtonClassName: A
|
|
91
|
+
}) => {
|
|
92
|
+
const [c, _] = X(!1), y = S(null), s = S(null);
|
|
93
|
+
ee(y, () => {
|
|
94
|
+
c && (_(!1), r && r());
|
|
95
|
+
});
|
|
96
|
+
const I = (e) => {
|
|
97
|
+
e.disabled || (m(e.value), _((o) => !o));
|
|
98
|
+
}, W = () => n.find(({ value: e }) => e === t), K = ce(n, t), {
|
|
99
|
+
getToggleButtonProps: $,
|
|
100
|
+
getMenuProps: j,
|
|
101
|
+
getItemProps: V,
|
|
102
|
+
setHighlightedIndex: v,
|
|
103
|
+
highlightedIndex: k,
|
|
104
|
+
selectedItem: D
|
|
105
|
+
} = N({
|
|
106
|
+
items: n,
|
|
107
|
+
itemToString: (e) => (e != null && e.label ? String(e.label) : p) || "",
|
|
108
|
+
selectedItem: W(),
|
|
109
|
+
isOpen: c,
|
|
110
|
+
circularNavigation: !0,
|
|
111
|
+
defaultHighlightedIndex: K,
|
|
112
|
+
onHighlightedIndexChange: (e) => {
|
|
113
|
+
switch (e.type) {
|
|
114
|
+
case N.stateChangeTypes.MenuKeyDownArrowUp:
|
|
115
|
+
return v(ue(n, e.highlightedIndex)), e;
|
|
116
|
+
case N.stateChangeTypes.MenuKeyDownArrowDown:
|
|
117
|
+
return v(he(n, e.highlightedIndex)), e;
|
|
118
|
+
default:
|
|
119
|
+
return e;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}), L = () => {
|
|
123
|
+
l || (s != null && s.current && s.current(), _((e) => !e), c ? r && r() : i && i());
|
|
124
|
+
}, q = () => {
|
|
125
|
+
if (!t && t !== !1)
|
|
126
|
+
return p;
|
|
127
|
+
let e = t;
|
|
128
|
+
return n.forEach((o) => {
|
|
129
|
+
o.value === t && (e = o.label);
|
|
130
|
+
}), e;
|
|
131
|
+
}, z = (e) => {
|
|
132
|
+
const { keyCode: o } = e;
|
|
133
|
+
ae.includes(o) && !c && (e.preventDefault(), v(K), s != null && s.current && s.current(), _(!0), i && i());
|
|
134
|
+
}, G = (e) => {
|
|
135
|
+
const { keyCode: o } = e;
|
|
136
|
+
if (o === u.ENTER_KEY_CODE) {
|
|
137
|
+
const O = n[k];
|
|
138
|
+
I(O), _(!1), r && r();
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
ie.includes(o) && (e.stopPropagation(), _(!1), r && r());
|
|
142
|
+
}, J = () => n.map((e, o) => /* @__PURE__ */ d(
|
|
143
|
+
se,
|
|
144
|
+
{
|
|
145
|
+
...V({
|
|
146
|
+
item: e,
|
|
147
|
+
index: o
|
|
148
|
+
}),
|
|
149
|
+
selected: e.value === (D == null ? void 0 : D.value),
|
|
150
|
+
option: e,
|
|
151
|
+
highlightHovered: k === o,
|
|
152
|
+
render: M,
|
|
153
|
+
onChange: e.disabled ? null : () => I(e),
|
|
154
|
+
onMouseEnter: () => v(o)
|
|
155
|
+
},
|
|
156
|
+
e.value
|
|
157
|
+
));
|
|
158
|
+
return /* @__PURE__ */ d(Z, { children: /* @__PURE__ */ R(
|
|
159
|
+
"div",
|
|
160
|
+
{
|
|
161
|
+
ref: y,
|
|
162
|
+
className: h("container", { "default-width": C }, Y),
|
|
163
|
+
title: w,
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ d(U, { children: ({ ref: e }) => /* @__PURE__ */ R(
|
|
166
|
+
"button",
|
|
167
|
+
{
|
|
168
|
+
...$({
|
|
169
|
+
ref: e,
|
|
170
|
+
tabIndex: l ? -1 : 0,
|
|
171
|
+
className: h("dropdown", E, A, {
|
|
172
|
+
"transparent-background": P,
|
|
173
|
+
opened: c,
|
|
174
|
+
disabled: l,
|
|
175
|
+
error: a,
|
|
176
|
+
touched: g,
|
|
177
|
+
"mobile-disabled": b
|
|
178
|
+
}),
|
|
179
|
+
onClick: L,
|
|
180
|
+
onKeyDown: z
|
|
181
|
+
}),
|
|
182
|
+
children: [
|
|
183
|
+
f && /* @__PURE__ */ d("span", { className: h("icon"), children: f }),
|
|
184
|
+
/* @__PURE__ */ d("span", { className: h("value", { placeholder: !t }), children: q() }),
|
|
185
|
+
/* @__PURE__ */ d(ne, { icon: "dropdown", className: h("arrow") })
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
) }),
|
|
189
|
+
/* @__PURE__ */ d(F, { placement: "bottom-start", children: ({ ref: e, style: o, update: O }) => (s.current = O, /* @__PURE__ */ d(
|
|
190
|
+
"div",
|
|
191
|
+
{
|
|
192
|
+
className: h("select-list", { opened: c }),
|
|
193
|
+
style: o,
|
|
194
|
+
...j({ ref: e, onKeyDown: G }),
|
|
195
|
+
children: /* @__PURE__ */ d(B, { autoHeight: !0, autoHeightMax: 216, hideTracksWhenNotNeeded: !0, children: J() })
|
|
196
|
+
}
|
|
197
|
+
)) })
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
) });
|
|
201
|
+
};
|
|
202
|
+
export {
|
|
203
|
+
Pe as D
|
|
204
|
+
};
|
package/dist/dropdown.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { D as r } from "./dropdown-45e7bc7d.js";
|
|
2
|
+
import "react/jsx-runtime";
|
|
3
|
+
import "react";
|
|
4
|
+
import "./bind-06a7ff84.js";
|
|
5
|
+
import "react-popper";
|
|
6
|
+
import "downshift";
|
|
7
|
+
import "rc-scrollbars";
|
|
8
|
+
import "./useOnClickOutside-c332f7d3.js";
|
|
9
|
+
import "./keyCodes-f63c0e11.js";
|
|
10
|
+
import "./icon-71262f5c.js";
|
|
11
|
+
import "./clear-4963efcd.js";
|
|
12
|
+
export {
|
|
13
|
+
r as Dropdown,
|
|
14
|
+
r as default
|
|
15
|
+
};
|