@kolking/react-ui 1.8.14 → 1.8.16
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/components/Badge/Badge.js +13 -12
- package/dist/components/Dialog/withDialog.d.ts +3 -2
- package/dist/components/Dialog/withDialog.js +16 -16
- package/dist/components/Fields/Field.d.ts +3 -2
- package/dist/components/Fields/Field.js +33 -32
- package/dist/components/Icon/Icon.js +115 -112
- package/dist/components/Icon/icons.d.ts +1 -1
- package/dist/components/Icon/icons.js +3 -0
- package/dist/components/Segmented/Segmented.d.ts +1 -1
- package/dist/components/Segmented/Segmented.js +44 -40
- package/dist/components/Tag/Tag.js +16 -13
- package/dist/styles/_theme-default.scss +4 -2
- package/dist/styles/style.css +1 -1
- package/dist/utils/colors.d.ts +1 -1
- package/dist/utils/colors.js +2 -1
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as h } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as _, useLayoutEffect as w, useEffect as l } from "react";
|
|
3
3
|
import E from "classnames";
|
|
4
|
-
import { wrapNode as P, cssProps as
|
|
5
|
-
const
|
|
6
|
-
badge:
|
|
7
|
-
appear:
|
|
4
|
+
import { wrapNode as P, cssProps as H } from "../../utils/helpers.js";
|
|
5
|
+
const M = "Badge_badge_-mEE7", k = "Badge_appear_LbxbS", x = "Badge_accent_BIYve", L = "Badge_gray_7jA-J", I = "Badge_brown_x1GS7", R = "Badge_red_zPgCR", S = "Badge_orange_EoLmF", X = "Badge_yellow_qvbb6", j = "Badge_green_XX-1c", v = "Badge_teal_VHoFK", C = "Badge_cyan_1ksBn", F = "Badge_blue_YulfT", K = "Badge_indigo_2KXUy", N = "Badge_purple_o55fQ", O = "Badge_pink_T5H--", g = {
|
|
6
|
+
badge: M,
|
|
7
|
+
appear: k,
|
|
8
|
+
accent: x,
|
|
8
9
|
gray: L,
|
|
9
10
|
brown: I,
|
|
10
11
|
red: R,
|
|
@@ -16,9 +17,9 @@ const x = "Badge_badge_-mEE7", H = "Badge_appear_LbxbS", L = "Badge_gray_7jA-J",
|
|
|
16
17
|
blue: F,
|
|
17
18
|
indigo: K,
|
|
18
19
|
purple: N,
|
|
19
|
-
|
|
20
|
+
pink: O
|
|
20
21
|
};
|
|
21
|
-
function
|
|
22
|
+
function T(a) {
|
|
22
23
|
const n = _();
|
|
23
24
|
return l(() => {
|
|
24
25
|
n.current = a;
|
|
@@ -34,7 +35,7 @@ const A = ({
|
|
|
34
35
|
style: f,
|
|
35
36
|
...y
|
|
36
37
|
}) => {
|
|
37
|
-
const e = !o, p =
|
|
38
|
+
const e = !o, p = T(e), t = _(null);
|
|
38
39
|
if (w(() => {
|
|
39
40
|
var r;
|
|
40
41
|
p && !e && ((r = t.current) == null || r.classList.add(g.appear));
|
|
@@ -43,12 +44,12 @@ const A = ({
|
|
|
43
44
|
const r = t.current.clientHeight, d = t.current.parentElement, i = d ? Math.min(
|
|
44
45
|
parseInt(getComputedStyle(d).getPropertyValue("border-radius")),
|
|
45
46
|
d.clientHeight / 2
|
|
46
|
-
) : 0,
|
|
47
|
-
t.current.style.setProperty("--offset", `${
|
|
47
|
+
) : 0, b = i * (1 - Math.sin(45 * Math.PI / 180)), m = (1 + Math.min(i / r, 1)) * (r / 4);
|
|
48
|
+
t.current.style.setProperty("--offset", `${b - m}px`);
|
|
48
49
|
}
|
|
49
50
|
}, [e, s]), e)
|
|
50
51
|
return null;
|
|
51
|
-
const
|
|
52
|
+
const B = typeof o == "number" && c > 0 && o > c;
|
|
52
53
|
return /* @__PURE__ */ h(
|
|
53
54
|
"div",
|
|
54
55
|
{
|
|
@@ -57,8 +58,8 @@ const A = ({
|
|
|
57
58
|
"data-badge": n,
|
|
58
59
|
"data-placement": s,
|
|
59
60
|
className: E(g.badge, g[n], u),
|
|
60
|
-
style: { ...f, ...
|
|
61
|
-
children: P(
|
|
61
|
+
style: { ...f, ...H({ size: a }) },
|
|
62
|
+
children: P(B ? `${c}+` : o, "span")
|
|
62
63
|
}
|
|
63
64
|
);
|
|
64
65
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { DialogProps } from './Dialog';
|
|
3
3
|
import { DialogOptions, DialogType } from './useDialog';
|
|
4
|
-
type
|
|
4
|
+
type PartialDialogProps = Omit<DialogProps, 'children' | 'ref' | 'requestClose'>;
|
|
5
|
+
type ComponentProps<T, R> = PartialDialogProps & DialogOptions<T, R> & {
|
|
5
6
|
children: (dialog: DialogType<T, R>) => React.ReactNode;
|
|
6
7
|
};
|
|
7
8
|
export type WithDialogProps<T extends object, R> = T & {
|
|
8
9
|
dialog: DialogType<T, R>;
|
|
9
10
|
};
|
|
10
|
-
export declare function withDialog<T extends object, R>(Component: React.ComponentType<WithDialogProps<T, R
|
|
11
|
+
export declare function withDialog<T extends object, R>(Component: React.ComponentType<WithDialogProps<T, R>>, withProps?: PartialDialogProps): React.ComponentType<ComponentProps<T, R>>;
|
|
11
12
|
export {};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Dialog as
|
|
3
|
-
import { useDialog as
|
|
4
|
-
function
|
|
5
|
-
function
|
|
6
|
-
children:
|
|
7
|
-
defaultOpen:
|
|
1
|
+
import { jsxs as d, Fragment as g, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as f } from "./Dialog.js";
|
|
3
|
+
import { useDialog as u } from "./useDialog.js";
|
|
4
|
+
function j(t, i) {
|
|
5
|
+
function a({
|
|
6
|
+
children: n,
|
|
7
|
+
defaultOpen: p,
|
|
8
8
|
onShow: e,
|
|
9
|
-
onConfirm:
|
|
10
|
-
onCancel:
|
|
11
|
-
...
|
|
9
|
+
onConfirm: s,
|
|
10
|
+
onCancel: l,
|
|
11
|
+
...m
|
|
12
12
|
}) {
|
|
13
|
-
const
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
|
|
16
|
-
/* @__PURE__ */
|
|
13
|
+
const o = u({ defaultOpen: p, onShow: e, onConfirm: s, onCancel: l }), c = { ...i, ...m, ...o.props };
|
|
14
|
+
return /* @__PURE__ */ d(g, { children: [
|
|
15
|
+
n(o),
|
|
16
|
+
/* @__PURE__ */ r(f, { ...c, children: o.data && /* @__PURE__ */ r(t, { ...o.data, dialog: o }) })
|
|
17
17
|
] });
|
|
18
18
|
}
|
|
19
|
-
return
|
|
19
|
+
return a;
|
|
20
20
|
}
|
|
21
21
|
export {
|
|
22
|
-
|
|
22
|
+
j as withDialog
|
|
23
23
|
};
|
|
@@ -2,6 +2,7 @@ import { default as React } from 'react';
|
|
|
2
2
|
export interface FieldConfig {
|
|
3
3
|
id?: string;
|
|
4
4
|
label?: React.ReactNode;
|
|
5
|
+
labelId?: string;
|
|
5
6
|
labelAccessory?: React.ReactNode;
|
|
6
7
|
help?: React.ReactNode;
|
|
7
8
|
required?: boolean;
|
|
@@ -14,7 +15,7 @@ export type FieldLabelProps = React.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
|
14
15
|
required?: boolean;
|
|
15
16
|
};
|
|
16
17
|
export declare const FieldLabel: ({ label, required, className, children, ...props }: FieldLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export type FieldDescriptionProps = React.HTMLAttributes<
|
|
18
|
+
export type FieldDescriptionProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
18
19
|
export declare const FieldDescription: ({ className, children, ...props }: FieldDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
export type FieldProps = React.HTMLAttributes<HTMLDivElement> & FieldConfig;
|
|
20
|
-
export declare const Field: ({ id, label, labelAccessory, help, required, minWidth, maxWidth, className, children, style, ...props }: FieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const Field: ({ id, label, labelId, labelAccessory, help, required, minWidth, maxWidth, className, children, style, ...props }: FieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,53 +1,54 @@
|
|
|
1
|
-
import { jsxs as i, jsx as
|
|
1
|
+
import { jsxs as i, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import d from "classnames";
|
|
3
|
-
import
|
|
4
|
-
import { cssProps as
|
|
5
|
-
const
|
|
6
|
-
field:
|
|
7
|
-
header:
|
|
8
|
-
label:
|
|
9
|
-
accessory:
|
|
10
|
-
description:
|
|
11
|
-
},
|
|
12
|
-
/* @__PURE__ */
|
|
3
|
+
import p from "react";
|
|
4
|
+
import { cssProps as u } from "../../utils/helpers.js";
|
|
5
|
+
const b = "styles_field_hqzKT", N = "styles_header_Iwsz6", F = "styles_label_zRVTS", v = "styles_accessory_S4ccn", x = "styles_description_fZnNW", t = {
|
|
6
|
+
field: b,
|
|
7
|
+
header: N,
|
|
8
|
+
label: F,
|
|
9
|
+
accessory: v,
|
|
10
|
+
description: x
|
|
11
|
+
}, z = ({ label: e, required: s, className: l, children: r, ...c }) => /* @__PURE__ */ i("div", { "data-field-header": !0, className: t.header, children: [
|
|
12
|
+
/* @__PURE__ */ a(
|
|
13
13
|
"label",
|
|
14
14
|
{
|
|
15
15
|
...c,
|
|
16
16
|
"data-field-label": !0,
|
|
17
17
|
"data-required": s,
|
|
18
|
-
className: d(
|
|
18
|
+
className: d(t.label, l),
|
|
19
19
|
children: e
|
|
20
20
|
}
|
|
21
21
|
),
|
|
22
|
-
|
|
23
|
-
] }),
|
|
22
|
+
p.Children.toArray(r).length > 0 && /* @__PURE__ */ a("div", { "data-field-accessory": !0, className: t.accessory, children: r })
|
|
23
|
+
] }), j = ({ className: e, children: s, ...l }) => /* @__PURE__ */ a("small", { ...l, "data-field-description": !0, className: d(t.description, e), children: s }), g = ({
|
|
24
24
|
id: e,
|
|
25
25
|
label: s,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
labelId: l,
|
|
27
|
+
labelAccessory: r,
|
|
28
|
+
help: c,
|
|
29
|
+
required: o,
|
|
30
|
+
minWidth: n,
|
|
31
|
+
maxWidth: f,
|
|
32
|
+
className: m,
|
|
33
|
+
children: y,
|
|
34
|
+
style: h,
|
|
35
|
+
..._
|
|
35
36
|
}) => /* @__PURE__ */ i(
|
|
36
37
|
"div",
|
|
37
38
|
{
|
|
38
|
-
...
|
|
39
|
+
..._,
|
|
39
40
|
"data-field": e || !0,
|
|
40
|
-
className: d(
|
|
41
|
-
style: { ...
|
|
41
|
+
className: d(t.field, m),
|
|
42
|
+
style: { ...h, ...u({ minWidth: n, maxWidth: f }) },
|
|
42
43
|
children: [
|
|
43
|
-
s && /* @__PURE__ */
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
s && /* @__PURE__ */ a(z, { id: l, htmlFor: e, label: s, required: o, children: r }),
|
|
45
|
+
y,
|
|
46
|
+
c && /* @__PURE__ */ a(j, { children: c })
|
|
46
47
|
]
|
|
47
48
|
}
|
|
48
49
|
);
|
|
49
50
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
g as Field,
|
|
52
|
+
j as FieldDescription,
|
|
53
|
+
z as FieldLabel
|
|
53
54
|
};
|