@kolking/react-ui 1.0.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/LICENSE +21 -0
- package/README.md +131 -0
- package/dist/Input-Lz3ft8Tp.js +96 -0
- package/dist/ValidationTooltip-BgSwl0hJ.js +30 -0
- package/dist/_commonjsHelpers-B52_cu2H.js +26 -0
- package/dist/components/Button/Button.d.ts +26 -0
- package/dist/components/Button/Button.js +62 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.js +4 -0
- package/dist/components/Dialog/Dialog.d.ts +10 -0
- package/dist/components/Dialog/Dialog.js +57 -0
- package/dist/components/Dialog/DialogFocusTrap.d.ts +2 -0
- package/dist/components/Dialog/DialogFocusTrap.js +765 -0
- package/dist/components/Dialog/index.d.ts +3 -0
- package/dist/components/Dialog/index.js +12 -0
- package/dist/components/Dialog/useDialog.d.ts +19 -0
- package/dist/components/Dialog/useDialog.js +52 -0
- package/dist/components/Dialog/withDialog.d.ts +11 -0
- package/dist/components/Dialog/withDialog.js +23 -0
- package/dist/components/Fields/Checkbox.d.ts +13 -0
- package/dist/components/Fields/Checkbox.js +28 -0
- package/dist/components/Fields/Field.d.ts +20 -0
- package/dist/components/Fields/Field.js +52 -0
- package/dist/components/Fields/Input.d.ts +11 -0
- package/dist/components/Fields/Input.js +9 -0
- package/dist/components/Fields/Quantity.d.ts +7 -0
- package/dist/components/Fields/Quantity.js +61 -0
- package/dist/components/Fields/Radio.d.ts +11 -0
- package/dist/components/Fields/Radio.js +23 -0
- package/dist/components/Fields/Select.d.ts +7 -0
- package/dist/components/Fields/Select.js +21 -0
- package/dist/components/Fields/Textarea.d.ts +12 -0
- package/dist/components/Fields/Textarea.js +185 -0
- package/dist/components/Fields/ValidationTooltip.d.ts +2 -0
- package/dist/components/Fields/ValidationTooltip.js +6 -0
- package/dist/components/Fields/index.d.ts +8 -0
- package/dist/components/Fields/index.js +20 -0
- package/dist/components/Flex/Flex.d.ts +22 -0
- package/dist/components/Flex/Flex.js +36 -0
- package/dist/components/Flex/index.d.ts +1 -0
- package/dist/components/Flex/index.js +4 -0
- package/dist/components/Heading/Heading.d.ts +12 -0
- package/dist/components/Heading/Heading.js +57 -0
- package/dist/components/Heading/index.d.ts +1 -0
- package/dist/components/Heading/index.js +4 -0
- package/dist/components/Icon/Icon.d.ts +16 -0
- package/dist/components/Icon/Icon.js +125 -0
- package/dist/components/Icon/icons.d.ts +2 -0
- package/dist/components/Icon/icons.js +91 -0
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/components/Icon/index.js +4 -0
- package/dist/components/Menu/Menu.d.ts +9 -0
- package/dist/components/Menu/Menu.js +77 -0
- package/dist/components/Menu/MenuContext.d.ts +8 -0
- package/dist/components/Menu/MenuContext.js +5 -0
- package/dist/components/Menu/MenuItem.d.ts +7 -0
- package/dist/components/Menu/MenuItem.js +50 -0
- package/dist/components/Menu/index.d.ts +2 -0
- package/dist/components/Menu/index.js +6 -0
- package/dist/components/Notice/Notice.d.ts +15 -0
- package/dist/components/Notice/Notice.js +56 -0
- package/dist/components/Notice/index.d.ts +1 -0
- package/dist/components/Notice/index.js +4 -0
- package/dist/components/Progress/ProgressBar.d.ts +21 -0
- package/dist/components/Progress/ProgressBar.js +47 -0
- package/dist/components/Progress/ProgressCircular.d.ts +25 -0
- package/dist/components/Progress/ProgressCircular.js +71 -0
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/Progress/index.js +6 -0
- package/dist/components/Segmented/Segmented.d.ts +9 -0
- package/dist/components/Segmented/Segmented.js +46 -0
- package/dist/components/Segmented/index.d.ts +1 -0
- package/dist/components/Segmented/index.js +4 -0
- package/dist/components/Spinner/Spinner.d.ts +13 -0
- package/dist/components/Spinner/Spinner.js +31 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Spinner/index.js +4 -0
- package/dist/components/Tooltip/Tooltip.d.ts +14 -0
- package/dist/components/Tooltip/Tooltip.js +78 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Tooltip/index.js +4 -0
- package/dist/floating-ui.react-KLg1MUz0.js +22334 -0
- package/dist/index-DyIdU--j.js +45 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.esm-Dkuk1b-q.js +211 -0
- package/dist/index.js +54 -0
- package/dist/styles/_theme-default.scss +142 -0
- package/dist/styles/_theme.scss +40 -0
- package/dist/styles/_utils.scss +118 -0
- package/dist/styles/style.css +1 -0
- package/dist/styles.module-CUhWny5T.js +11 -0
- package/dist/utils/helpers.d.ts +13 -0
- package/dist/utils/helpers.js +34 -0
- package/package.json +79 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as i, jsxs as h, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as M, useCallback as N } from "react";
|
|
3
|
+
import { u as P } from "../../floating-ui.react-KLg1MUz0.js";
|
|
4
|
+
import { c as v } from "../../index-DyIdU--j.js";
|
|
5
|
+
import { MenuContext as w } from "./MenuContext.js";
|
|
6
|
+
import { cssProps as A } from "../../utils/helpers.js";
|
|
7
|
+
import { s as n } from "../../styles.module-CUhWny5T.js";
|
|
8
|
+
function a(t) {
|
|
9
|
+
return typeof t == "string" ? /* @__PURE__ */ i("span", { children: t }) : t;
|
|
10
|
+
}
|
|
11
|
+
const D = ({
|
|
12
|
+
size: t,
|
|
13
|
+
scheme: p = "default",
|
|
14
|
+
icon: c,
|
|
15
|
+
title: s,
|
|
16
|
+
children: r,
|
|
17
|
+
className: u,
|
|
18
|
+
style: f,
|
|
19
|
+
onClick: e,
|
|
20
|
+
...d
|
|
21
|
+
}) => {
|
|
22
|
+
const { active: x, setOpen: o, getItemProps: l } = M(w), { ref: b, index: y } = P(), m = y === x, I = N(
|
|
23
|
+
(g) => {
|
|
24
|
+
o(!1), e == null || e(g);
|
|
25
|
+
},
|
|
26
|
+
[o, e]
|
|
27
|
+
);
|
|
28
|
+
return /* @__PURE__ */ i(
|
|
29
|
+
"button",
|
|
30
|
+
{
|
|
31
|
+
...d,
|
|
32
|
+
ref: b,
|
|
33
|
+
type: "button",
|
|
34
|
+
role: "menuitem",
|
|
35
|
+
"data-menu": "item",
|
|
36
|
+
"data-active": m,
|
|
37
|
+
tabIndex: m ? 0 : -1,
|
|
38
|
+
className: v(n.menuitem, n[p], u),
|
|
39
|
+
style: { ...f, ...A({ size: t }) },
|
|
40
|
+
...l({ onClick: I }),
|
|
41
|
+
children: r ? a(r) : /* @__PURE__ */ h(j, { children: [
|
|
42
|
+
c,
|
|
43
|
+
s && a(s)
|
|
44
|
+
] })
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
D as MenuItem
|
|
50
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
type Scheme = 'info' | 'warning' | 'error' | 'success' | 'neutral';
|
|
3
|
+
export type NoticeProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
error?: unknown;
|
|
5
|
+
scheme?: Scheme;
|
|
6
|
+
variant?: 'default' | 'plain';
|
|
7
|
+
layout?: 'horizontal' | 'vertical';
|
|
8
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
icon?: React.ReactElement | null;
|
|
10
|
+
accessory?: React.ReactNode;
|
|
11
|
+
margin?: React.CSSProperties['margin'];
|
|
12
|
+
padding?: React.CSSProperties['padding'];
|
|
13
|
+
};
|
|
14
|
+
export declare const Notice: ({ error, scheme, layout, variant, size, icon, accessory, margin, padding, className, style, children, ...props }: NoticeProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { c as v } from "../../index-DyIdU--j.js";
|
|
3
|
+
import { cssProps as p, getErrorMessage as y } from "../../utils/helpers.js";
|
|
4
|
+
import { Icon as w } from "../Icon/Icon.js";
|
|
5
|
+
const h = "Notice_info_tgW7c", z = "Notice_error_ClIfR", j = "Notice_success_-vXfu", x = "Notice_warning_zFUFN", C = "Notice_neutral_Vryzr", F = "Notice_container_d9QoU", I = "Notice_content_cvC5c", k = "Notice_message_hI1yz", M = "Notice_accessory_AjvqC", Q = "Notice_vertical_DsMZQ", U = "Notice_plain_l9FV5", c = {
|
|
6
|
+
info: h,
|
|
7
|
+
error: z,
|
|
8
|
+
success: j,
|
|
9
|
+
warning: x,
|
|
10
|
+
neutral: C,
|
|
11
|
+
container: F,
|
|
12
|
+
content: I,
|
|
13
|
+
message: k,
|
|
14
|
+
accessory: M,
|
|
15
|
+
vertical: Q,
|
|
16
|
+
plain: U
|
|
17
|
+
}, a = {
|
|
18
|
+
info: "info-circle",
|
|
19
|
+
warning: "warning",
|
|
20
|
+
error: "error-circle",
|
|
21
|
+
success: "checkmark-circle",
|
|
22
|
+
neutral: "info-outline"
|
|
23
|
+
}, E = ({
|
|
24
|
+
error: n,
|
|
25
|
+
scheme: o = n ? "error" : "neutral",
|
|
26
|
+
layout: t = "horizontal",
|
|
27
|
+
variant: l = "default",
|
|
28
|
+
size: _,
|
|
29
|
+
icon: s,
|
|
30
|
+
accessory: r,
|
|
31
|
+
margin: N,
|
|
32
|
+
padding: m,
|
|
33
|
+
className: d,
|
|
34
|
+
style: f,
|
|
35
|
+
children: g,
|
|
36
|
+
...u
|
|
37
|
+
}) => /* @__PURE__ */ i(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
...u,
|
|
41
|
+
"data-notice": o,
|
|
42
|
+
"data-layout": t,
|
|
43
|
+
className: v(c.container, c[o], c[t], c[l], d),
|
|
44
|
+
style: { ...f, ...p({ size: _, margin: N, padding: m }) },
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ i("div", { className: c.content, children: [
|
|
47
|
+
s !== void 0 ? s : a[o] && /* @__PURE__ */ e(w, { name: a[o] }),
|
|
48
|
+
/* @__PURE__ */ e("div", { className: c.message, children: n ? y(n) : g })
|
|
49
|
+
] }),
|
|
50
|
+
r && /* @__PURE__ */ e("div", { className: c.accessory, children: r })
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
export {
|
|
55
|
+
E as Notice
|
|
56
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Notice';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type ProgressBarProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
value: number | null;
|
|
4
|
+
width?: string | number;
|
|
5
|
+
height?: string | number;
|
|
6
|
+
color?: string;
|
|
7
|
+
trackColor?: string;
|
|
8
|
+
margin?: React.CSSProperties['margin'];
|
|
9
|
+
minWidth?: React.CSSProperties['minWidth'];
|
|
10
|
+
maxWidth?: React.CSSProperties['maxWidth'];
|
|
11
|
+
};
|
|
12
|
+
export declare const ProgressBar: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
13
|
+
value: number | null;
|
|
14
|
+
width?: string | number;
|
|
15
|
+
height?: string | number;
|
|
16
|
+
color?: string;
|
|
17
|
+
trackColor?: string;
|
|
18
|
+
margin?: React.CSSProperties["margin"];
|
|
19
|
+
minWidth?: React.CSSProperties["minWidth"];
|
|
20
|
+
maxWidth?: React.CSSProperties["maxWidth"];
|
|
21
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import f from "react";
|
|
3
|
+
import { c as _ } from "../../index-DyIdU--j.js";
|
|
4
|
+
import { cssProps as u, clamp as v } from "../../utils/helpers.js";
|
|
5
|
+
const P = "Progress_progress_LSrhF", w = "Progress_bar_ywPS-", e = {
|
|
6
|
+
progress: P,
|
|
7
|
+
bar: w
|
|
8
|
+
}, R = f.forwardRef(
|
|
9
|
+
({
|
|
10
|
+
value: s,
|
|
11
|
+
width: o,
|
|
12
|
+
height: t,
|
|
13
|
+
color: i,
|
|
14
|
+
trackColor: p,
|
|
15
|
+
minWidth: n,
|
|
16
|
+
maxWidth: m,
|
|
17
|
+
margin: c,
|
|
18
|
+
style: l,
|
|
19
|
+
className: g,
|
|
20
|
+
...d
|
|
21
|
+
}, b) => {
|
|
22
|
+
const r = s ? v(s, 0, 100) : void 0;
|
|
23
|
+
return /* @__PURE__ */ a(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
...d,
|
|
27
|
+
ref: b,
|
|
28
|
+
role: "progressbar",
|
|
29
|
+
"aria-valuemin": 0,
|
|
30
|
+
"aria-valuemax": 100,
|
|
31
|
+
"aria-valuenow": r,
|
|
32
|
+
"aria-label": r ? `${r} percent` : "indeterminate",
|
|
33
|
+
"data-progress": "bar",
|
|
34
|
+
"data-progress-value": r ?? "indeterminate",
|
|
35
|
+
className: _(e.progress, g),
|
|
36
|
+
style: {
|
|
37
|
+
...l,
|
|
38
|
+
...u({ width: o, height: t, color: i, trackColor: p, minWidth: n, maxWidth: m, margin: c })
|
|
39
|
+
},
|
|
40
|
+
children: /* @__PURE__ */ a("span", { className: e.bar, style: { width: `${r}%` } })
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
export {
|
|
46
|
+
R as ProgressBar
|
|
47
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type ProgressCircularProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
min?: number;
|
|
4
|
+
max?: number;
|
|
5
|
+
value: number | null;
|
|
6
|
+
size?: string | number;
|
|
7
|
+
countdown?: boolean;
|
|
8
|
+
thickness?: number;
|
|
9
|
+
linecap?: 'round';
|
|
10
|
+
color?: string;
|
|
11
|
+
trackColor?: string;
|
|
12
|
+
margin?: React.CSSProperties['margin'];
|
|
13
|
+
};
|
|
14
|
+
export declare const ProgressCircular: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
15
|
+
min?: number;
|
|
16
|
+
max?: number;
|
|
17
|
+
value: number | null;
|
|
18
|
+
size?: string | number;
|
|
19
|
+
countdown?: boolean;
|
|
20
|
+
thickness?: number;
|
|
21
|
+
linecap?: "round";
|
|
22
|
+
color?: string;
|
|
23
|
+
trackColor?: string;
|
|
24
|
+
margin?: React.CSSProperties["margin"];
|
|
25
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsxs as c, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import j from "react";
|
|
3
|
+
import { c as N } from "../../index-DyIdU--j.js";
|
|
4
|
+
import { cssProps as k, clamp as w } from "../../utils/helpers.js";
|
|
5
|
+
const b = "Progress_inner_Zoiac", h = "Progress_container_tFVew", x = "Progress_range_uqjFb", y = "Progress_progress_MHEjj", C = "Progress_track_jWvrX", a = {
|
|
6
|
+
inner: b,
|
|
7
|
+
container: h,
|
|
8
|
+
range: x,
|
|
9
|
+
progress: y,
|
|
10
|
+
track: C
|
|
11
|
+
};
|
|
12
|
+
function F(r, s, e) {
|
|
13
|
+
return e !== void 0 ? ((e - r) / (s - r) * 100).toString() : e;
|
|
14
|
+
}
|
|
15
|
+
const H = j.forwardRef(
|
|
16
|
+
({
|
|
17
|
+
min: r = 0,
|
|
18
|
+
max: s = 100,
|
|
19
|
+
value: e,
|
|
20
|
+
size: i,
|
|
21
|
+
countdown: l,
|
|
22
|
+
thickness: g,
|
|
23
|
+
linecap: u,
|
|
24
|
+
color: d,
|
|
25
|
+
trackColor: p,
|
|
26
|
+
margin: m,
|
|
27
|
+
className: _,
|
|
28
|
+
style: f,
|
|
29
|
+
children: t,
|
|
30
|
+
...v
|
|
31
|
+
}, P) => {
|
|
32
|
+
const o = e !== null ? w(e, r, s) : void 0;
|
|
33
|
+
return /* @__PURE__ */ c(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
...v,
|
|
37
|
+
ref: P,
|
|
38
|
+
role: "progressbar",
|
|
39
|
+
"aria-valuemin": r,
|
|
40
|
+
"aria-valuemax": s,
|
|
41
|
+
"aria-valuenow": o,
|
|
42
|
+
"data-progress": "circular",
|
|
43
|
+
"data-countdown": l,
|
|
44
|
+
"data-progress-value": o ?? "indeterminate",
|
|
45
|
+
className: N(a.container, _),
|
|
46
|
+
style: {
|
|
47
|
+
...f,
|
|
48
|
+
...k({
|
|
49
|
+
size: i,
|
|
50
|
+
thickness: g,
|
|
51
|
+
linecap: u,
|
|
52
|
+
color: d,
|
|
53
|
+
trackColor: p,
|
|
54
|
+
margin: m,
|
|
55
|
+
value: F(r, s, o)
|
|
56
|
+
})
|
|
57
|
+
},
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ c("svg", { "aria-hidden": !0, className: a.progress, children: [
|
|
60
|
+
/* @__PURE__ */ n("circle", { fill: "none", className: a.track }),
|
|
61
|
+
/* @__PURE__ */ n("circle", { fill: "none", className: a.range })
|
|
62
|
+
] }),
|
|
63
|
+
t && /* @__PURE__ */ n("div", { className: a.inner, children: t })
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
export {
|
|
70
|
+
H as ProgressCircular
|
|
71
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type SegmentedProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {
|
|
2
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
+
items: React.ReactNode[];
|
|
4
|
+
selected: number;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
margin?: React.CSSProperties['margin'];
|
|
7
|
+
onSelect: (index: number) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const Segmented: ({ size, items, selected, disabled, margin, className, style, onSelect, ...props }: SegmentedProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { c as p } from "../../index-DyIdU--j.js";
|
|
3
|
+
import { cssProps as i } from "../../utils/helpers.js";
|
|
4
|
+
const h = "Segmented_segmented_UOs8Z", S = {
|
|
5
|
+
segmented: h
|
|
6
|
+
}, u = ({
|
|
7
|
+
size: o,
|
|
8
|
+
items: n,
|
|
9
|
+
selected: t,
|
|
10
|
+
disabled: m,
|
|
11
|
+
margin: r,
|
|
12
|
+
className: g,
|
|
13
|
+
style: c,
|
|
14
|
+
onSelect: a,
|
|
15
|
+
...d
|
|
16
|
+
}) => /* @__PURE__ */ s(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
...d,
|
|
20
|
+
"data-segmented": t,
|
|
21
|
+
className: p(S.segmented, g),
|
|
22
|
+
style: {
|
|
23
|
+
...c,
|
|
24
|
+
...i({
|
|
25
|
+
size: o,
|
|
26
|
+
margin: r,
|
|
27
|
+
length: n.length.toString(),
|
|
28
|
+
selected: t.toString()
|
|
29
|
+
})
|
|
30
|
+
},
|
|
31
|
+
children: n.map((l, e) => /* @__PURE__ */ s(
|
|
32
|
+
"button",
|
|
33
|
+
{
|
|
34
|
+
type: "button",
|
|
35
|
+
disabled: m,
|
|
36
|
+
"data-selected": e === t,
|
|
37
|
+
onClick: () => e !== t && a(e),
|
|
38
|
+
children: l
|
|
39
|
+
},
|
|
40
|
+
e
|
|
41
|
+
))
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
export {
|
|
45
|
+
u as Segmented
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Segmented';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type SpinnerProps = React.HTMLAttributes<HTMLSpanElement> & {
|
|
3
|
+
size?: string | number;
|
|
4
|
+
color?: string;
|
|
5
|
+
overlay?: boolean;
|
|
6
|
+
overlayColor?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const Spinner: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & {
|
|
9
|
+
size?: string | number;
|
|
10
|
+
color?: string;
|
|
11
|
+
overlay?: boolean;
|
|
12
|
+
overlayColor?: string;
|
|
13
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import m from "react";
|
|
3
|
+
import { c as d } from "../../index-DyIdU--j.js";
|
|
4
|
+
import { cssProps as _ } from "../../utils/helpers.js";
|
|
5
|
+
const f = "Spinner_container_CGGmW", g = "Spinner_spinner_vU3LR", S = "Spinner_track_y1d33", k = "Spinner_range_BVoTJ", n = {
|
|
6
|
+
container: f,
|
|
7
|
+
spinner: g,
|
|
8
|
+
track: S,
|
|
9
|
+
range: k
|
|
10
|
+
}, N = m.forwardRef(
|
|
11
|
+
({ size: e, color: a, overlay: s, overlayColor: i, className: t, style: c, ...o }, l) => /* @__PURE__ */ r(
|
|
12
|
+
"span",
|
|
13
|
+
{
|
|
14
|
+
...o,
|
|
15
|
+
ref: l,
|
|
16
|
+
role: "status",
|
|
17
|
+
"aria-label": "loading",
|
|
18
|
+
"data-spinner": !0,
|
|
19
|
+
"data-overlay": s,
|
|
20
|
+
className: d(n.container, t),
|
|
21
|
+
style: { ...c, ..._({ size: e, color: a, overlayColor: i }) },
|
|
22
|
+
children: /* @__PURE__ */ p("svg", { "aria-hidden": !0, viewBox: "0 0 100 100", className: n.spinner, children: [
|
|
23
|
+
/* @__PURE__ */ r("circle", { fill: "none", className: n.track }),
|
|
24
|
+
/* @__PURE__ */ r("circle", { fill: "none", className: n.range })
|
|
25
|
+
] })
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
);
|
|
29
|
+
export {
|
|
30
|
+
N as Spinner
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Spinner';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Placement } from '@floating-ui/react';
|
|
3
|
+
type Trigger = 'hover' | 'focus' | 'click' | 'hover focus' | 'hover click' | 'focus click' | 'hover focus click';
|
|
4
|
+
export type TooltipProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'content' | 'children'> & {
|
|
5
|
+
trigger?: Trigger;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
placement?: Placement;
|
|
8
|
+
content: React.ReactNode;
|
|
9
|
+
children: React.JSX.Element;
|
|
10
|
+
minWidth?: React.CSSProperties['minWidth'];
|
|
11
|
+
maxWidth?: React.CSSProperties['maxWidth'];
|
|
12
|
+
};
|
|
13
|
+
export declare const Tooltip: ({ trigger, placement, content, disabled, minWidth, maxWidth, className, children, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsxs as d, Fragment as E, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import M, { useRef as m, useState as g, useEffect as P } from "react";
|
|
3
|
+
import { c as S } from "../../index-DyIdU--j.js";
|
|
4
|
+
import { a as b, c as j, d as C, e as U, k as W, l as q, g as A, m as B, F as D, n as H, o as I, f as V, p as $, q as z, b as G } from "../../floating-ui.react-KLg1MUz0.js";
|
|
5
|
+
const J = "Tooltip_tooltip_u1Uix", K = "Tooltip_arrow_NBFiV", L = "Tooltip_content_lfpfM", i = {
|
|
6
|
+
tooltip: J,
|
|
7
|
+
arrow: K,
|
|
8
|
+
content: L
|
|
9
|
+
}, ee = ({
|
|
10
|
+
trigger: a = "hover focus",
|
|
11
|
+
placement: c = "top",
|
|
12
|
+
content: h,
|
|
13
|
+
disabled: l,
|
|
14
|
+
minWidth: w,
|
|
15
|
+
maxWidth: R,
|
|
16
|
+
className: F,
|
|
17
|
+
children: t,
|
|
18
|
+
..._
|
|
19
|
+
}) => {
|
|
20
|
+
const f = m(null), u = m(null), [p, v] = g(!1), [x, O] = g(!1), { refs: n, context: e, floatingStyles: N } = b({
|
|
21
|
+
open: p,
|
|
22
|
+
placement: c,
|
|
23
|
+
onOpenChange: v,
|
|
24
|
+
whileElementsMounted: G,
|
|
25
|
+
middleware: [
|
|
26
|
+
I(8),
|
|
27
|
+
V(),
|
|
28
|
+
$(),
|
|
29
|
+
z(({ placement: o, rects: s }) => (O(
|
|
30
|
+
s.floating.width < s.reference.width && (o.endsWith("-start") || o.endsWith("-end"))
|
|
31
|
+
), { element: f, padding: 8 }))
|
|
32
|
+
]
|
|
33
|
+
}), { getReferenceProps: T, getFloatingProps: k } = j([
|
|
34
|
+
C(e),
|
|
35
|
+
U(e, { role: "tooltip" }),
|
|
36
|
+
W(e, { move: !1, enabled: a.includes("hover") }),
|
|
37
|
+
q(e, { enabled: a.includes("focus") }),
|
|
38
|
+
A(e, { enabled: a.includes("click") })
|
|
39
|
+
]), y = B([
|
|
40
|
+
n.setReference,
|
|
41
|
+
"ref" in t ? t.ref : null
|
|
42
|
+
]);
|
|
43
|
+
return P(() => {
|
|
44
|
+
var s;
|
|
45
|
+
const o = (s = n.domReference.current) == null ? void 0 : s.closest("[data-floating-root]");
|
|
46
|
+
!l && o && (u.current = o);
|
|
47
|
+
}, [n, l]), l ? t : /* @__PURE__ */ d(E, { children: [
|
|
48
|
+
M.cloneElement(t, T({ ref: y, ...t.props })),
|
|
49
|
+
p && /* @__PURE__ */ r(D, { root: u, children: /* @__PURE__ */ d(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
..._,
|
|
53
|
+
ref: n.setFloating,
|
|
54
|
+
"data-tooltip": c,
|
|
55
|
+
className: S(i.tooltip, F),
|
|
56
|
+
style: { ...N, minWidth: w, maxWidth: R },
|
|
57
|
+
...k(),
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ r(
|
|
60
|
+
H,
|
|
61
|
+
{
|
|
62
|
+
width: 12,
|
|
63
|
+
height: 6,
|
|
64
|
+
ref: f,
|
|
65
|
+
context: e,
|
|
66
|
+
className: i.arrow,
|
|
67
|
+
staticOffset: x ? 8 : null
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ r("div", { className: i.content, children: h })
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
) })
|
|
74
|
+
] });
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
ee as Tooltip
|
|
78
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Tooltip';
|