@kolking/react-ui 1.0.0 → 1.2.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-Lz3ft8Tp.js → Input-DE1QkW7S.js} +1 -1
- package/dist/components/Badge/Badge.d.ts +9 -0
- package/dist/components/Badge/Badge.js +56 -0
- package/dist/components/Badge/index.d.ts +1 -0
- package/dist/components/Badge/index.js +4 -0
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.js +5 -5
- package/dist/components/Dialog/Dialog.js +1 -1
- package/dist/components/Dialog/DialogFocusTrap.js +9 -757
- package/dist/components/Fields/Checkbox.js +7 -7
- package/dist/components/Fields/Field.js +10 -10
- package/dist/components/Fields/Input.js +2 -2
- package/dist/components/Fields/Quantity.js +18 -18
- package/dist/components/Fields/Radio.js +5 -5
- package/dist/components/Fields/Select.js +6 -6
- package/dist/components/Fields/Textarea.js +18 -177
- package/dist/components/Fields/index.js +1 -1
- package/dist/components/Flex/Flex.js +7 -7
- package/dist/components/Heading/Heading.js +1 -1
- package/dist/components/Icon/Icon.js +1 -1
- package/dist/components/Menu/Menu.js +41 -40
- package/dist/components/Menu/MenuItem.js +10 -10
- package/dist/components/Notice/Notice.js +1 -1
- package/dist/components/Progress/ProgressBar.js +5 -5
- package/dist/components/Progress/ProgressCircular.js +1 -1
- package/dist/components/Segmented/Segmented.js +10 -10
- package/dist/components/Spinner/Spinner.js +4 -4
- package/dist/components/Tooltip/Tooltip.js +37 -37
- package/dist/index.d.ts +1 -0
- package/dist/index.js +54 -52
- package/dist/styles/style.css +1 -1
- package/package.json +1 -1
- package/dist/_commonjsHelpers-B52_cu2H.js +0 -26
- package/dist/floating-ui.react-KLg1MUz0.js +0 -22334
- package/dist/index-DyIdU--j.js +0 -45
- package/dist/index.esm-Dkuk1b-q.js +0 -211
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as f, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import u from "classnames";
|
|
3
3
|
import _ from "react";
|
|
4
4
|
import { cssProps as m } from "./utils/helpers.js";
|
|
5
5
|
import { s as t, V as h } from "./ValidationTooltip-BgSwl0hJ.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type BadgeProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
+
value?: number | string | boolean;
|
|
5
|
+
maxValue?: number;
|
|
6
|
+
placement?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | null;
|
|
7
|
+
scheme?: 'gray' | 'red' | 'yellow' | 'orange' | 'green' | 'teal' | 'cyan' | 'blue' | 'indigo' | 'purple' | 'brown' | 'accent';
|
|
8
|
+
};
|
|
9
|
+
export declare const Badge: ({ size, value, maxValue, placement, scheme, className, style, ...props }: BadgeProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as B } from "react/jsx-runtime";
|
|
2
|
+
import b from "classnames";
|
|
3
|
+
import { useRef as m, useEffect as h } from "react";
|
|
4
|
+
import { cssProps as w } from "../../utils/helpers.js";
|
|
5
|
+
const E = "Badge_badge_-mEE7", M = "Badge_gray_7jA-J", P = "Badge_red_zPgCR", x = "Badge_orange_EoLmF", H = "Badge_yellow_qvbb6", I = "Badge_green_XX-1c", R = "Badge_teal_VHoFK", X = "Badge_cyan_1ksBn", j = "Badge_blue_YulfT", C = "Badge_indigo_2KXUy", F = "Badge_purple_o55fQ", K = "Badge_brown_x1GS7", O = "Badge_accent_BIYve", d = {
|
|
6
|
+
badge: E,
|
|
7
|
+
gray: M,
|
|
8
|
+
red: P,
|
|
9
|
+
orange: x,
|
|
10
|
+
yellow: H,
|
|
11
|
+
green: I,
|
|
12
|
+
teal: R,
|
|
13
|
+
cyan: X,
|
|
14
|
+
blue: j,
|
|
15
|
+
indigo: C,
|
|
16
|
+
purple: F,
|
|
17
|
+
brown: K,
|
|
18
|
+
accent: O
|
|
19
|
+
}, q = ({
|
|
20
|
+
size: i,
|
|
21
|
+
value: t,
|
|
22
|
+
maxValue: n = 99,
|
|
23
|
+
placement: o = "top-right",
|
|
24
|
+
scheme: s = "red",
|
|
25
|
+
className: l,
|
|
26
|
+
style: _,
|
|
27
|
+
...p
|
|
28
|
+
}) => {
|
|
29
|
+
const r = !t, e = m(null);
|
|
30
|
+
if (h(() => {
|
|
31
|
+
if (!r && o && e.current) {
|
|
32
|
+
const c = e.current.clientHeight, a = e.current.parentElement, g = a ? Math.min(
|
|
33
|
+
parseInt(getComputedStyle(a).getPropertyValue("border-radius")),
|
|
34
|
+
a.clientHeight / 2
|
|
35
|
+
) : 0, u = g * (1 - Math.sin(45 * Math.PI / 180)), y = (1 + Math.min(g / c, 1)) * (c / 4);
|
|
36
|
+
e.current.style.setProperty("--offset", `${u - y}px`);
|
|
37
|
+
}
|
|
38
|
+
}, [r, o]), r)
|
|
39
|
+
return null;
|
|
40
|
+
const f = typeof t == "number" && n > 0 && t > n;
|
|
41
|
+
return /* @__PURE__ */ B(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
...p,
|
|
45
|
+
ref: e,
|
|
46
|
+
"data-badge": s,
|
|
47
|
+
"data-placement": o,
|
|
48
|
+
className: b(d.badge, d[s], l),
|
|
49
|
+
style: { ..._, ...w({ size: i }) },
|
|
50
|
+
children: f ? `${n}+` : t
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
q as Badge
|
|
56
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Badge';
|
|
@@ -23,4 +23,4 @@ export declare const Button: <T extends React.ElementType = "button">(props: {
|
|
|
23
23
|
title?: React.ReactNode;
|
|
24
24
|
icon?: React.ReactElement;
|
|
25
25
|
iconPosition?: "start" | "end";
|
|
26
|
-
} & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "title" | "size" | "as" | "
|
|
26
|
+
} & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "title" | "size" | "as" | "scheme" | "icon" | "minWidth" | "maxWidth" | "variant" | "busy" | "iconPosition"> & React.RefAttributes<unknown>) => React.ReactElement | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as u, jsx as v, Fragment as B } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import b from "classnames";
|
|
3
3
|
import { fixedForwardRef as w, wrapNode as d, cssProps as x } from "../../utils/helpers.js";
|
|
4
4
|
import { Spinner as N } from "../Spinner/Spinner.js";
|
|
5
5
|
const h = "Button_button_WuG2z", y = {
|
|
@@ -29,8 +29,8 @@ function A({
|
|
|
29
29
|
icon: n,
|
|
30
30
|
iconPosition: i = "start",
|
|
31
31
|
children: o,
|
|
32
|
-
className:
|
|
33
|
-
style:
|
|
32
|
+
className: g,
|
|
33
|
+
style: c,
|
|
34
34
|
...s
|
|
35
35
|
}, f) {
|
|
36
36
|
return /* @__PURE__ */ u(
|
|
@@ -43,8 +43,8 @@ function A({
|
|
|
43
43
|
"data-scheme": a,
|
|
44
44
|
"aria-disabled": s.disabled,
|
|
45
45
|
"aria-live": t ? "polite" : void 0,
|
|
46
|
-
className: b(y.button, y[`${r}-${a}`],
|
|
47
|
-
style: { ...
|
|
46
|
+
className: b(y.button, y[`${r}-${a}`], g),
|
|
47
|
+
style: { ...c, ...x({ size: p, minWidth: m, maxWidth: l }) },
|
|
48
48
|
children: [
|
|
49
49
|
o ? d(o, "span") : /* @__PURE__ */ u(B, { children: [
|
|
50
50
|
i === "start" && n,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import d from "react";
|
|
3
|
-
import
|
|
3
|
+
import l from "classnames";
|
|
4
4
|
import { Icon as g } from "../Icon/Icon.js";
|
|
5
5
|
import { Button as m } from "../Button/Button.js";
|
|
6
6
|
import { DialogFocusTrap as f } from "./DialogFocusTrap.js";
|