@kolking/react-ui 1.4.0 → 1.6.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/{Input-DE1QkW7S.js → Input-D46mAsdt.js} +39 -29
- package/dist/ValidationTooltip-D8d9O6Re.js +31 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +11 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +40 -0
- package/dist/components/Breadcrumbs/index.d.ts +1 -0
- package/dist/components/Breadcrumbs/index.js +4 -0
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Dialog/Dialog.d.ts +14 -5
- package/dist/components/Dialog/Dialog.js +67 -49
- package/dist/components/Dialog/useDialog.d.ts +2 -1
- package/dist/components/Dialog/useDialog.js +29 -42
- package/dist/components/Dialog/withDialog.d.ts +1 -1
- package/dist/components/Fields/Checkbox.js +1 -1
- package/dist/components/Fields/Field.d.ts +1 -1
- package/dist/components/Fields/Field.js +28 -27
- package/dist/components/Fields/Input.d.ts +2 -0
- package/dist/components/Fields/Input.js +2 -2
- package/dist/components/Fields/Numeric.d.ts +4 -0
- package/dist/components/Fields/Numeric.js +62 -0
- package/dist/components/Fields/Radio.js +1 -1
- package/dist/components/Fields/Range.d.ts +20 -0
- package/dist/components/Fields/Range.js +54 -0
- package/dist/components/Fields/Select.js +1 -1
- package/dist/components/Fields/Switch.d.ts +13 -0
- package/dist/components/Fields/Switch.js +36 -0
- package/dist/components/Fields/Textarea.js +1 -1
- package/dist/components/Fields/ValidationTooltip.d.ts +1 -1
- package/dist/components/Fields/ValidationTooltip.js +3 -2
- package/dist/components/Fields/index.d.ts +3 -1
- package/dist/components/Fields/index.js +20 -16
- package/dist/components/Flex/Flex.d.ts +1 -1
- package/dist/components/Flex/Flex.js +24 -23
- package/dist/components/Menu/Menu.d.ts +6 -2
- package/dist/components/Menu/Menu.js +57 -51
- package/dist/components/Menu/MenuContext.d.ts +1 -0
- package/dist/components/Menu/MenuItem.d.ts +2 -3
- package/dist/components/Menu/MenuItem.js +23 -29
- package/dist/components/Segmented/Segmented.js +22 -19
- package/dist/components/ToggleButton/ToggleButton.d.ts +5 -0
- package/dist/components/ToggleButton/ToggleButton.js +16 -0
- package/dist/components/ToggleButton/ToggleGroup.d.ts +12 -0
- package/dist/components/ToggleButton/ToggleGroup.js +43 -0
- package/dist/components/ToggleButton/index.d.ts +2 -0
- package/dist/components/ToggleButton/index.js +6 -0
- package/dist/components/Tooltip/Tooltip.d.ts +2 -1
- package/dist/components/Tooltip/Tooltip.js +59 -56
- package/dist/index.d.ts +2 -0
- package/dist/index.js +62 -52
- package/dist/styles/_theme-default.scss +23 -21
- package/dist/styles/style.css +1 -1
- package/dist/styles.module-D1F3R7Vi.js +11 -0
- package/dist/utils/helpers.d.ts +2 -3
- package/dist/utils/helpers.js +20 -22
- package/package.json +2 -1
- package/dist/ValidationTooltip-BgSwl0hJ.js +0 -30
- package/dist/components/Dialog/DialogFocusTrap.d.ts +0 -2
- package/dist/components/Dialog/DialogFocusTrap.js +0 -17
- package/dist/components/Fields/Quantity.d.ts +0 -7
- package/dist/components/Fields/Quantity.js +0 -61
- package/dist/styles.module-CUhWny5T.js +0 -11
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsxs as p, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import b from "classnames";
|
|
3
|
+
import f, { useRef as y, useImperativeHandle as _, useCallback as c } from "react";
|
|
4
|
+
import { Icon as i } from "../Icon/Icon.js";
|
|
5
|
+
import { Button as o } from "../Button/Button.js";
|
|
6
|
+
import { I as h } from "../../Input-D46mAsdt.js";
|
|
7
|
+
const v = "styles_numeric_dzUSE", w = "styles_increase_5S-Jo", E = "styles_decrease_j8UR6", s = {
|
|
8
|
+
numeric: v,
|
|
9
|
+
increase: w,
|
|
10
|
+
decrease: E
|
|
11
|
+
}, j = f.forwardRef(
|
|
12
|
+
({ className: l, ...a }, u) => {
|
|
13
|
+
const e = y(null);
|
|
14
|
+
_(u, () => e.current);
|
|
15
|
+
const m = c(() => {
|
|
16
|
+
var n, r;
|
|
17
|
+
(n = e.current) == null || n.stepUp(), (r = e.current) == null || r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
18
|
+
}, []), d = c(() => {
|
|
19
|
+
var n, r;
|
|
20
|
+
(n = e.current) == null || n.stepDown(), (r = e.current) == null || r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
21
|
+
}, []);
|
|
22
|
+
return /* @__PURE__ */ p(
|
|
23
|
+
h,
|
|
24
|
+
{
|
|
25
|
+
...a,
|
|
26
|
+
ref: e,
|
|
27
|
+
type: "number",
|
|
28
|
+
wrapperType: "numeric",
|
|
29
|
+
className: b(s.numeric, l),
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ t(
|
|
32
|
+
o,
|
|
33
|
+
{
|
|
34
|
+
type: "button",
|
|
35
|
+
variant: "secondary",
|
|
36
|
+
"aria-label": "Increase",
|
|
37
|
+
disabled: a.disabled,
|
|
38
|
+
className: s.increase,
|
|
39
|
+
icon: /* @__PURE__ */ t(i, { name: "triangle-up" }),
|
|
40
|
+
onClick: m
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ t(
|
|
44
|
+
o,
|
|
45
|
+
{
|
|
46
|
+
type: "button",
|
|
47
|
+
variant: "secondary",
|
|
48
|
+
"aria-label": "Decrease",
|
|
49
|
+
disabled: a.disabled,
|
|
50
|
+
className: s.decrease,
|
|
51
|
+
icon: /* @__PURE__ */ t(i, { name: "triangle-down" }),
|
|
52
|
+
onClick: d
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
export {
|
|
61
|
+
j as Numeric
|
|
62
|
+
};
|
|
@@ -2,7 +2,7 @@ import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
|
2
2
|
import c from "classnames";
|
|
3
3
|
import f from "react";
|
|
4
4
|
import { cssProps as n } from "../../utils/helpers.js";
|
|
5
|
-
import { I as u, s } from "../../Input-
|
|
5
|
+
import { I as u, s } from "../../Input-D46mAsdt.js";
|
|
6
6
|
const I = f.forwardRef(
|
|
7
7
|
({ size: r, error: t, label: a, className: e, style: i, required: d, ...m }, p) => /* @__PURE__ */ l(
|
|
8
8
|
"label",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseInputProps } from './Input';
|
|
3
|
+
type TickMarksProps = {
|
|
4
|
+
ticks: number | (string | number)[];
|
|
5
|
+
};
|
|
6
|
+
export type RangeProps = Omit<BaseInputProps, 'min' | 'max' | 'value' | 'defaultValue'> & {
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
value?: number;
|
|
10
|
+
defaultValue?: number;
|
|
11
|
+
ticks?: TickMarksProps['ticks'];
|
|
12
|
+
};
|
|
13
|
+
export declare const Range: React.ForwardRefExoticComponent<Omit<BaseInputProps, "max" | "min" | "defaultValue" | "value"> & {
|
|
14
|
+
min?: number;
|
|
15
|
+
max?: number;
|
|
16
|
+
value?: number;
|
|
17
|
+
defaultValue?: number;
|
|
18
|
+
ticks?: TickMarksProps["ticks"];
|
|
19
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsxs as g, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import R from "classnames";
|
|
3
|
+
import w, { useRef as x, useState as T, useEffect as j, useCallback as P } from "react";
|
|
4
|
+
import { V } from "../../ValidationTooltip-D8d9O6Re.js";
|
|
5
|
+
import { cssProps as A, wrapNode as E } from "../../utils/helpers.js";
|
|
6
|
+
const J = "styles_range_j9iED", D = "styles_range_thumb_6aftN", F = "styles_range_wrapper_LTcAf", H = "styles_range_track_HdlJx", L = "styles_ticks_YaeJb", n = {
|
|
7
|
+
range: J,
|
|
8
|
+
range_thumb: D,
|
|
9
|
+
range_wrapper: F,
|
|
10
|
+
range_track: H,
|
|
11
|
+
ticks: L
|
|
12
|
+
};
|
|
13
|
+
function f(r, a, e, s) {
|
|
14
|
+
r == null || r.style.setProperty("--progress", `${(s - a) / (e - a)}`);
|
|
15
|
+
}
|
|
16
|
+
const M = ({ ticks: r }) => {
|
|
17
|
+
const a = typeof r == "number" ? [...Array(r)] : r;
|
|
18
|
+
return a.length < 2 ? null : /* @__PURE__ */ t("ul", { "data-range-ticks": !0, className: n.ticks, children: a.map((e, s) => /* @__PURE__ */ t("li", { children: e !== void 0 && /* @__PURE__ */ t("small", { children: e }) }, s)) });
|
|
19
|
+
}, B = w.forwardRef(
|
|
20
|
+
({ size: r, height: a, error: e, ticks: s, className: m, style: y, children: u, onChange: c, ...i }, h) => {
|
|
21
|
+
const { min: l = 0, max: o = 100, defaultValue: v = 50, value: p = v } = i, d = x(null), [k, b] = T(null);
|
|
22
|
+
j(() => {
|
|
23
|
+
f(d.current, l, o, p);
|
|
24
|
+
}, [l, o, p]);
|
|
25
|
+
const N = P(
|
|
26
|
+
(_) => {
|
|
27
|
+
f(d.current, l, o, parseFloat(_.currentTarget.value)), c == null || c(_);
|
|
28
|
+
},
|
|
29
|
+
[l, o, c]
|
|
30
|
+
);
|
|
31
|
+
return /* @__PURE__ */ g(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
ref: d,
|
|
35
|
+
"data-input": "range",
|
|
36
|
+
"data-disabled": i.disabled,
|
|
37
|
+
"data-invalid": e ? !0 : void 0,
|
|
38
|
+
className: R(n.range, m),
|
|
39
|
+
style: { ...y, ...A({ size: r, height: a }) },
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ g("div", { className: n.range_wrapper, children: [
|
|
42
|
+
/* @__PURE__ */ t("div", { "data-range-track": !0, className: n.range_track }),
|
|
43
|
+
/* @__PURE__ */ t("div", { ref: b, "data-range-thumb": !0, className: n.range_thumb, children: u !== void 0 && E(u, "small") }),
|
|
44
|
+
/* @__PURE__ */ t(V, { content: e, placement: "top", anchor: k, children: /* @__PURE__ */ t("input", { ...i, ref: h, type: "range", onChange: N }) })
|
|
45
|
+
] }),
|
|
46
|
+
s !== void 0 && /* @__PURE__ */ t(M, { ticks: s })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
export {
|
|
53
|
+
B as Range
|
|
54
|
+
};
|
|
@@ -2,7 +2,7 @@ import { jsx as e } from "react/jsx-runtime";
|
|
|
2
2
|
import l from "classnames";
|
|
3
3
|
import c from "react";
|
|
4
4
|
import { cssProps as m } from "../../utils/helpers.js";
|
|
5
|
-
import { V as d, s as f } from "../../ValidationTooltip-
|
|
5
|
+
import { V as d, s as f } from "../../ValidationTooltip-D8d9O6Re.js";
|
|
6
6
|
const y = c.forwardRef(
|
|
7
7
|
({ size: o, error: t, className: s, style: a, ...r }, i) => /* @__PURE__ */ e(d, { content: t, children: /* @__PURE__ */ e(
|
|
8
8
|
"select",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseInputProps } from './Input';
|
|
3
|
+
export type SwitchProps = BaseInputProps & {
|
|
4
|
+
label?: React.ReactNode;
|
|
5
|
+
checkedColor?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const Switch: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & {
|
|
8
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
9
|
+
error?: string;
|
|
10
|
+
} & {
|
|
11
|
+
label?: React.ReactNode;
|
|
12
|
+
checkedColor?: string;
|
|
13
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import m from "react";
|
|
3
|
+
import h from "classnames";
|
|
4
|
+
import { cssProps as u } from "../../utils/helpers.js";
|
|
5
|
+
import { V as f } from "../../ValidationTooltip-D8d9O6Re.js";
|
|
6
|
+
const _ = "styles_label_p-D4Y", w = "styles_input_VteBP", s = {
|
|
7
|
+
switch: "styles_switch_UNvH8",
|
|
8
|
+
label: _,
|
|
9
|
+
input: w
|
|
10
|
+
}, V = m.forwardRef(
|
|
11
|
+
({ size: a, error: i, label: e, required: l, checkedColor: o, className: c, style: n, ...r }, p) => /* @__PURE__ */ d(
|
|
12
|
+
"label",
|
|
13
|
+
{
|
|
14
|
+
"data-input": "switch",
|
|
15
|
+
"data-required": l,
|
|
16
|
+
className: h(s.switch, c),
|
|
17
|
+
style: { ...n, ...u({ size: a, checkedColor: o }) },
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ t(f, { content: i, children: /* @__PURE__ */ t(
|
|
20
|
+
"input",
|
|
21
|
+
{
|
|
22
|
+
...r,
|
|
23
|
+
ref: p,
|
|
24
|
+
type: "checkbox",
|
|
25
|
+
"data-invalid": i ? !0 : void 0,
|
|
26
|
+
className: s.input
|
|
27
|
+
}
|
|
28
|
+
) }),
|
|
29
|
+
e && /* @__PURE__ */ t("div", { className: s.label, children: e })
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
export {
|
|
35
|
+
V as Switch
|
|
36
|
+
};
|
|
@@ -3,7 +3,7 @@ import c from "classnames";
|
|
|
3
3
|
import d from "react";
|
|
4
4
|
import f from "react-textarea-autosize";
|
|
5
5
|
import { cssProps as l } from "../../utils/helpers.js";
|
|
6
|
-
import { V as x, s as u } from "../../ValidationTooltip-
|
|
6
|
+
import { V as x, s as u } from "../../ValidationTooltip-D8d9O6Re.js";
|
|
7
7
|
const _ = d.forwardRef(
|
|
8
8
|
({ autosize: t = !0, size: e, error: o, className: s, style: m, ...a }, i) => {
|
|
9
9
|
const n = t ? f : "textarea", p = t ? { minRows: 2, ...a } : a;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TooltipProps } from '../Tooltip';
|
|
2
|
-
export declare const ValidationTooltip: (props: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const ValidationTooltip: ({ className, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
+
import "classnames";
|
|
2
3
|
import "../Tooltip/Tooltip.js";
|
|
3
|
-
import { V as
|
|
4
|
+
import { V as m } from "../../ValidationTooltip-D8d9O6Re.js";
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
+
m as ValidationTooltip
|
|
6
7
|
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export * from './Checkbox';
|
|
2
2
|
export * from './Field';
|
|
3
3
|
export * from './Input';
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './Numeric';
|
|
5
5
|
export * from './Radio';
|
|
6
|
+
export * from './Range';
|
|
6
7
|
export * from './Select';
|
|
8
|
+
export * from './Switch';
|
|
7
9
|
export * from './Textarea';
|
|
8
10
|
export * from './ValidationTooltip';
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import { Checkbox as
|
|
2
|
-
import { Field as p, FieldDescription as
|
|
3
|
-
import { I as f } from "../../Input-
|
|
4
|
-
import {
|
|
5
|
-
import { Radio as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { Checkbox as e } from "./Checkbox.js";
|
|
2
|
+
import { Field as p, FieldDescription as x, FieldLabel as i } from "./Field.js";
|
|
3
|
+
import { I as f } from "../../Input-D46mAsdt.js";
|
|
4
|
+
import { Numeric as l } from "./Numeric.js";
|
|
5
|
+
import { Radio as d } from "./Radio.js";
|
|
6
|
+
import { Range as s } from "./Range.js";
|
|
7
|
+
import { Select as b } from "./Select.js";
|
|
8
|
+
import { Switch as u } from "./Switch.js";
|
|
9
|
+
import { Textarea as R } from "./Textarea.js";
|
|
10
|
+
import { V as T } from "../../ValidationTooltip-D8d9O6Re.js";
|
|
9
11
|
export {
|
|
10
|
-
|
|
12
|
+
e as Checkbox,
|
|
11
13
|
p as Field,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
x as FieldDescription,
|
|
15
|
+
i as FieldLabel,
|
|
14
16
|
f as Input,
|
|
15
|
-
l as
|
|
16
|
-
|
|
17
|
-
s as
|
|
18
|
-
b as
|
|
19
|
-
|
|
17
|
+
l as Numeric,
|
|
18
|
+
d as Radio,
|
|
19
|
+
s as Range,
|
|
20
|
+
b as Select,
|
|
21
|
+
u as Switch,
|
|
22
|
+
R as Textarea,
|
|
23
|
+
T as ValidationTooltip
|
|
20
24
|
};
|
|
@@ -19,4 +19,4 @@ export declare const Flex: <T extends React.ElementType = "div">(props: {
|
|
|
19
19
|
wrap?: React.CSSProperties["flexWrap"];
|
|
20
20
|
marginStart?: React.CSSProperties["marginBlockStart"];
|
|
21
21
|
marginEnd?: React.CSSProperties["marginBlockEnd"];
|
|
22
|
-
} & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "direction" | "as" | "align" | "wrap" | "justify" | "
|
|
22
|
+
} & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "direction" | "as" | "align" | "wrap" | "justify" | "marginStart" | "marginEnd" | "gap"> & React.RefAttributes<unknown>) => React.ReactElement | null;
|
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
2
|
import d from "classnames";
|
|
3
|
-
import { fixedForwardRef as i, cssProps as
|
|
4
|
-
const
|
|
5
|
-
flex:
|
|
3
|
+
import { fixedForwardRef as i, cssProps as F } from "../../utils/helpers.js";
|
|
4
|
+
const u = "Flex_flex_GBHBA", w = {
|
|
5
|
+
flex: u
|
|
6
6
|
};
|
|
7
|
-
function
|
|
8
|
-
as:
|
|
7
|
+
function y({
|
|
8
|
+
as: o,
|
|
9
9
|
direction: e = "row",
|
|
10
|
-
gap:
|
|
11
|
-
align:
|
|
10
|
+
gap: r,
|
|
11
|
+
align: t,
|
|
12
12
|
justify: s,
|
|
13
|
-
wrap:
|
|
14
|
-
marginStart:
|
|
15
|
-
marginEnd:
|
|
16
|
-
className:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
wrap: l,
|
|
14
|
+
marginStart: f,
|
|
15
|
+
marginEnd: n,
|
|
16
|
+
className: x,
|
|
17
|
+
style: m,
|
|
18
|
+
...c
|
|
19
|
+
}, a) {
|
|
20
|
+
return /* @__PURE__ */ p(
|
|
21
|
+
o ?? "div",
|
|
21
22
|
{
|
|
22
|
-
...
|
|
23
|
-
ref:
|
|
23
|
+
...c,
|
|
24
|
+
ref: a,
|
|
24
25
|
"data-flex": e,
|
|
25
|
-
className: d(
|
|
26
|
+
className: d(w.flex, x),
|
|
26
27
|
style: {
|
|
27
|
-
...
|
|
28
|
-
...
|
|
28
|
+
...m,
|
|
29
|
+
...F({ gap: r, align: t, justify: s, direction: e, wrap: l, marginStart: f, marginEnd: n })
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
);
|
|
32
33
|
}
|
|
33
|
-
const
|
|
34
|
+
const v = i(y);
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
+
v as Flex
|
|
36
37
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { Placement } from '@floating-ui/react';
|
|
3
|
-
export type MenuProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
export type MenuProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {
|
|
4
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
5
|
placement?: Placement;
|
|
5
6
|
trigger: React.JSX.Element;
|
|
6
7
|
minWidth?: React.CSSProperties['minWidth'];
|
|
7
8
|
maxWidth?: React.CSSProperties['maxWidth'];
|
|
9
|
+
minHeight?: React.CSSProperties['minHeight'];
|
|
10
|
+
maxHeight?: React.CSSProperties['maxHeight'];
|
|
11
|
+
onSelect?: (index: number) => void;
|
|
8
12
|
};
|
|
9
|
-
export declare const Menu: ({ placement, trigger, minWidth, maxWidth, className, children, ...props }: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const Menu: ({ size, placement, trigger, minWidth, maxWidth, minHeight, maxHeight, className, children, onSelect, ...props }: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,78 +1,84 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { flushSync as
|
|
4
|
-
import { useFloating as
|
|
5
|
-
import
|
|
6
|
-
import { MenuContext as
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsxs as B, Fragment as L, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import O, { useState as r, useRef as p, useMemo as W, useEffect as _ } from "react";
|
|
3
|
+
import { flushSync as b } from "react-dom";
|
|
4
|
+
import { useFloating as k, offset as A, flip as D, size as H, autoUpdate as U, useInteractions as q, useDismiss as G, useRole as J, useClick as K, useListNavigation as Q, FloatingPortal as T, FloatingFocusManager as V, FloatingList as X } from "@floating-ui/react";
|
|
5
|
+
import Y from "classnames";
|
|
6
|
+
import { MenuContext as Z } from "./MenuContext.js";
|
|
7
|
+
import { cssProps as $ } from "../../utils/helpers.js";
|
|
8
|
+
import { s as ee } from "../../styles.module-D1F3R7Vi.js";
|
|
9
|
+
const me = ({
|
|
10
|
+
size: g,
|
|
11
|
+
placement: h = "bottom-start",
|
|
10
12
|
trigger: a,
|
|
11
|
-
minWidth:
|
|
12
|
-
maxWidth:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
minWidth: R,
|
|
14
|
+
maxWidth: v,
|
|
15
|
+
minHeight: x,
|
|
16
|
+
maxHeight: F,
|
|
17
|
+
className: P,
|
|
18
|
+
children: y,
|
|
19
|
+
onSelect: l,
|
|
20
|
+
...z
|
|
16
21
|
}) => {
|
|
17
|
-
const [
|
|
18
|
-
open:
|
|
19
|
-
placement:
|
|
22
|
+
const [m, c] = r(!1), [i, M] = r(null), [w, C] = r({}), u = p([]), f = p(null), { refs: o, context: e, floatingStyles: E } = k({
|
|
23
|
+
open: m,
|
|
24
|
+
placement: h,
|
|
20
25
|
onOpenChange: c,
|
|
21
|
-
whileElementsMounted:
|
|
26
|
+
whileElementsMounted: U,
|
|
22
27
|
middleware: [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
A(5),
|
|
29
|
+
D({ padding: 10 }),
|
|
30
|
+
H({
|
|
26
31
|
padding: 10,
|
|
27
|
-
apply({ rects: n, availableWidth: s, availableHeight:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
apply({ rects: n, availableWidth: s, availableHeight: j }) {
|
|
33
|
+
b(() => {
|
|
34
|
+
C({
|
|
35
|
+
minHeight: x,
|
|
36
|
+
minWidth: R ?? n.reference.width,
|
|
37
|
+
maxWidth: v ?? s,
|
|
38
|
+
maxHeight: F ?? j
|
|
33
39
|
});
|
|
34
40
|
});
|
|
35
41
|
}
|
|
36
42
|
})
|
|
37
43
|
]
|
|
38
|
-
}), { getReferenceProps:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
listRef:
|
|
44
|
+
}), { getReferenceProps: I, getFloatingProps: N, getItemProps: d } = q([
|
|
45
|
+
G(e),
|
|
46
|
+
J(e, { role: "menu" }),
|
|
47
|
+
K(e, { event: "mousedown" }),
|
|
48
|
+
Q(e, {
|
|
49
|
+
listRef: u,
|
|
44
50
|
loop: !0,
|
|
45
51
|
activeIndex: i,
|
|
46
|
-
onNavigate:
|
|
52
|
+
onNavigate: M
|
|
47
53
|
})
|
|
48
|
-
]), S =
|
|
49
|
-
() => ({ active: i, setOpen: c, getItemProps:
|
|
50
|
-
[i,
|
|
54
|
+
]), S = W(
|
|
55
|
+
() => ({ active: i, setOpen: c, getItemProps: d, onSelect: l }),
|
|
56
|
+
[i, d, l]
|
|
51
57
|
);
|
|
52
|
-
return
|
|
58
|
+
return _(() => {
|
|
53
59
|
var s;
|
|
54
60
|
const n = (s = o.domReference.current) == null ? void 0 : s.closest("[data-floating-root]");
|
|
55
|
-
n && (
|
|
56
|
-
}, [o]), /* @__PURE__ */
|
|
57
|
-
|
|
61
|
+
n && (f.current = n);
|
|
62
|
+
}, [o]), /* @__PURE__ */ B(L, { children: [
|
|
63
|
+
O.cloneElement(a, {
|
|
58
64
|
ref: o.setReference,
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
...I(a.props),
|
|
66
|
+
"data-menu-trigger": !0
|
|
61
67
|
}),
|
|
62
|
-
/* @__PURE__ */ t(
|
|
68
|
+
/* @__PURE__ */ t(Z.Provider, { value: S, children: m && /* @__PURE__ */ t(T, { root: f, children: /* @__PURE__ */ t(V, { context: e, modal: !1, initialFocus: -1, children: /* @__PURE__ */ t(
|
|
63
69
|
"div",
|
|
64
70
|
{
|
|
65
|
-
...
|
|
71
|
+
...z,
|
|
72
|
+
...N(),
|
|
66
73
|
ref: o.setFloating,
|
|
67
|
-
"data-menu":
|
|
68
|
-
className:
|
|
69
|
-
style: { ...
|
|
70
|
-
|
|
71
|
-
children: /* @__PURE__ */ t(K, { elementsRef: m, children: v })
|
|
74
|
+
"data-menu": !0,
|
|
75
|
+
className: Y(ee.menu, P),
|
|
76
|
+
style: { ...E, ...w, ...$({ size: g }) },
|
|
77
|
+
children: /* @__PURE__ */ t(X, { elementsRef: u, children: y })
|
|
72
78
|
}
|
|
73
79
|
) }) }) })
|
|
74
80
|
] });
|
|
75
81
|
};
|
|
76
82
|
export {
|
|
77
|
-
|
|
83
|
+
me as Menu
|
|
78
84
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export type MenuItemProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
2
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
1
|
+
export type MenuItemProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'title'> & {
|
|
3
2
|
scheme?: 'default' | 'negative' | 'positive' | 'warning';
|
|
4
3
|
icon?: React.ReactElement;
|
|
5
4
|
title?: React.ReactNode;
|
|
6
5
|
};
|
|
7
|
-
export declare const MenuItem: ({
|
|
6
|
+
export declare const MenuItem: ({ scheme, icon, title, children, className, onClick, ...props }: MenuItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,50 +1,44 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { useListItem as
|
|
4
|
-
import
|
|
1
|
+
import { jsx as I, jsxs as g, Fragment as h } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as j, useCallback as y } from "react";
|
|
3
|
+
import { useListItem as M } from "@floating-ui/react";
|
|
4
|
+
import N from "classnames";
|
|
5
5
|
import { MenuContext as w } from "./MenuContext.js";
|
|
6
|
-
import {
|
|
7
|
-
import { s as
|
|
8
|
-
|
|
9
|
-
return typeof t == "string" ? /* @__PURE__ */ i("span", { children: t }) : t;
|
|
10
|
-
}
|
|
11
|
-
const D = ({
|
|
12
|
-
size: t,
|
|
6
|
+
import { wrapNode as n } from "../../utils/helpers.js";
|
|
7
|
+
import { s as i } from "../../styles.module-D1F3R7Vi.js";
|
|
8
|
+
const B = ({
|
|
13
9
|
scheme: p = "default",
|
|
14
|
-
icon:
|
|
10
|
+
icon: u,
|
|
15
11
|
title: r,
|
|
16
12
|
children: s,
|
|
17
13
|
className: f,
|
|
18
|
-
|
|
19
|
-
onClick: e,
|
|
14
|
+
onClick: t,
|
|
20
15
|
...d
|
|
21
16
|
}) => {
|
|
22
|
-
const { active:
|
|
23
|
-
(
|
|
24
|
-
o(!1), e == null || e(
|
|
17
|
+
const { active: c, setOpen: o, getItemProps: x, onSelect: e } = j(w), { ref: b, index: m } = M(), a = m === c, l = y(
|
|
18
|
+
(v) => {
|
|
19
|
+
o(!1), e == null || e(m), t == null || t(v);
|
|
25
20
|
},
|
|
26
|
-
[o, e]
|
|
21
|
+
[m, o, e, t]
|
|
27
22
|
);
|
|
28
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ I(
|
|
29
24
|
"button",
|
|
30
25
|
{
|
|
31
26
|
...d,
|
|
32
27
|
ref: b,
|
|
33
28
|
type: "button",
|
|
34
29
|
role: "menuitem",
|
|
35
|
-
"data-menu":
|
|
36
|
-
"data-active":
|
|
37
|
-
tabIndex:
|
|
38
|
-
className:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
r && a(r)
|
|
30
|
+
"data-menu-item": !0,
|
|
31
|
+
"data-active": a,
|
|
32
|
+
tabIndex: a ? 0 : -1,
|
|
33
|
+
className: N(i.menuitem, i[p], f),
|
|
34
|
+
...x({ onClick: l }),
|
|
35
|
+
children: s ? n(s, "span") : /* @__PURE__ */ g(h, { children: [
|
|
36
|
+
u,
|
|
37
|
+
r !== void 0 && n(r, "span")
|
|
44
38
|
] })
|
|
45
39
|
}
|
|
46
40
|
);
|
|
47
41
|
};
|
|
48
42
|
export {
|
|
49
|
-
|
|
43
|
+
B as MenuItem
|
|
50
44
|
};
|