@kolking/react-ui 1.8.19 → 1.9.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-D46mAsdt.js → Input-BG84zXZH.js} +1 -1
- package/dist/Thumbnails-BlXFynlF.js +38 -0
- package/dist/ValidationTooltip-N4SQpl9r.js +32 -0
- package/dist/components/Avatar/Avatar.js +12 -12
- package/dist/components/Badge/Badge.js +28 -29
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Dialog/Dialog.js +44 -44
- package/dist/components/Dialog/useDialog.d.ts +1 -1
- package/dist/components/Dialog/useDialog.js +21 -29
- package/dist/components/Fields/Checkbox.d.ts +1 -1
- package/dist/components/Fields/Checkbox.js +1 -1
- package/dist/components/Fields/Input.d.ts +1 -1
- package/dist/components/Fields/Input.js +2 -2
- package/dist/components/Fields/Numeric.js +34 -36
- package/dist/components/Fields/Radio.d.ts +1 -1
- package/dist/components/Fields/Radio.js +1 -1
- package/dist/components/Fields/Range.d.ts +1 -1
- package/dist/components/Fields/Range.js +33 -33
- package/dist/components/Fields/Select.d.ts +1 -1
- package/dist/components/Fields/Select.js +1 -1
- package/dist/components/Fields/Switch.d.ts +1 -1
- package/dist/components/Fields/Switch.js +1 -1
- package/dist/components/Fields/Textarea.d.ts +1 -1
- package/dist/components/Fields/Textarea.js +1 -1
- package/dist/components/Fields/ValidationTooltip.d.ts +1 -1
- package/dist/components/Fields/ValidationTooltip.js +1 -1
- package/dist/components/Fields/index.js +2 -2
- package/dist/components/Flex/Flex.d.ts +1 -1
- package/dist/components/Gallery/Gallery.d.ts +11 -0
- package/dist/components/Gallery/Gallery.js +48 -0
- package/dist/components/Gallery/GalleryItem.d.ts +12 -0
- package/dist/components/Gallery/GalleryItem.js +41 -0
- package/dist/components/Gallery/index.d.ts +2 -0
- package/dist/components/Gallery/index.js +6 -0
- package/dist/components/Icon/Icon.js +125 -122
- package/dist/components/Icon/icons.d.ts +1 -1
- package/dist/components/Icon/icons.js +4 -0
- package/dist/components/Lightbox/Lightbox.d.ts +12 -0
- package/dist/components/Lightbox/Lightbox.js +150 -0
- package/dist/components/Lightbox/Thumbnail.d.ts +7 -0
- package/dist/components/Lightbox/Thumbnail.js +26 -0
- package/dist/components/Lightbox/Thumbnails.d.ts +11 -0
- package/dist/components/Lightbox/Thumbnails.js +8 -0
- package/dist/components/Lightbox/index.d.ts +1 -0
- package/dist/components/Lightbox/index.js +4 -0
- package/dist/components/Menu/Menu.js +44 -45
- package/dist/components/Menu/MenuItem.js +33 -33
- package/dist/components/Popover/Popover.js +40 -41
- package/dist/components/Segmented/Segmented.js +43 -47
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/components/ToggleButton/ToggleButton.d.ts +1 -1
- package/dist/components/ToggleButton/ToggleGroup.js +42 -40
- package/dist/components/Tooltip/Tooltip.js +30 -31
- package/dist/index.d.ts +3 -1
- package/dist/index.js +71 -63
- package/dist/styles/style.css +1 -1
- package/dist/styles.module-D0C-vMZX.js +7 -0
- package/dist/utils/helpers.d.ts +3 -1
- package/dist/utils/helpers.js +30 -19
- package/package.json +31 -32
- package/dist/ValidationTooltip-D8d9O6Re.js +0 -31
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as p, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import N from "classnames";
|
|
3
3
|
import R, { useRef as x, useState as T, useEffect as j, useCallback as P } from "react";
|
|
4
4
|
import { cssProps as V, wrapNode as A } from "../../utils/helpers.js";
|
|
5
|
-
import { V as
|
|
6
|
-
const
|
|
7
|
-
range:
|
|
8
|
-
range_thumb:
|
|
9
|
-
range_wrapper:
|
|
10
|
-
range_track:
|
|
11
|
-
ticks:
|
|
5
|
+
import { V as C } from "../../ValidationTooltip-N4SQpl9r.js";
|
|
6
|
+
const E = "styles_range_j9iED", J = "styles_range_thumb_6aftN", D = "styles_range_wrapper_LTcAf", F = "styles_range_track_HdlJx", H = "styles_ticks_YaeJb", s = {
|
|
7
|
+
range: E,
|
|
8
|
+
range_thumb: J,
|
|
9
|
+
range_wrapper: D,
|
|
10
|
+
range_track: F,
|
|
11
|
+
ticks: H
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
|
|
13
|
+
function _(a, r, t, n) {
|
|
14
|
+
a?.style.setProperty("--progress", `${(n - r) / (t - r)}`);
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
},
|
|
20
|
-
({ size:
|
|
21
|
-
const { min: l = 0, max: o = 100, defaultValue: v = 50, value:
|
|
16
|
+
const L = ({ ticks: a }) => {
|
|
17
|
+
const r = typeof a == "number" ? [...Array(a)] : a;
|
|
18
|
+
return r.length < 2 ? null : /* @__PURE__ */ e("ul", { "data-range-ticks": !0, className: s.ticks, children: r.map((t, n) => /* @__PURE__ */ e("li", { children: t !== void 0 && /* @__PURE__ */ e("small", { children: t }) }, n)) });
|
|
19
|
+
}, z = R.forwardRef(
|
|
20
|
+
({ size: a, height: r, error: t, ticks: n, className: f, style: h, children: d, onChange: u, ...c }, y) => {
|
|
21
|
+
const { min: l = 0, max: o = 100, defaultValue: v = 50, value: g = v } = c, i = x(null), [k, b] = T(null);
|
|
22
22
|
j(() => {
|
|
23
|
-
|
|
24
|
-
}, [l, o,
|
|
23
|
+
_(i.current, l, o, g);
|
|
24
|
+
}, [l, o, g]);
|
|
25
25
|
const w = P(
|
|
26
|
-
(
|
|
27
|
-
|
|
26
|
+
(m) => {
|
|
27
|
+
_(i.current, l, o, parseFloat(m.currentTarget.value)), u?.(m);
|
|
28
28
|
},
|
|
29
|
-
[l, o,
|
|
29
|
+
[l, o, u]
|
|
30
30
|
);
|
|
31
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ p(
|
|
32
32
|
"div",
|
|
33
33
|
{
|
|
34
|
-
ref:
|
|
34
|
+
ref: i,
|
|
35
35
|
"data-range": !0,
|
|
36
|
-
"data-disabled":
|
|
37
|
-
"data-invalid":
|
|
38
|
-
className: N(
|
|
39
|
-
style: { ...
|
|
36
|
+
"data-disabled": c.disabled,
|
|
37
|
+
"data-invalid": t ? !0 : void 0,
|
|
38
|
+
className: N(s.range, f),
|
|
39
|
+
style: { ...h, ...V({ size: a, height: r }) },
|
|
40
40
|
children: [
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ p("div", { "data-range-wrapper": !0, className: s.range_wrapper, children: [
|
|
42
|
+
/* @__PURE__ */ e("div", { "data-range-track": !0, className: s.range_track }),
|
|
43
|
+
/* @__PURE__ */ e("div", { ref: b, "data-range-thumb": !0, className: s.range_thumb, children: d !== void 0 && A(d, "small") }),
|
|
44
|
+
/* @__PURE__ */ e(C, { content: t, placement: "top", anchor: k, children: /* @__PURE__ */ e("input", { ...c, ref: y, type: "range", onChange: w }) })
|
|
45
45
|
] }),
|
|
46
|
-
|
|
46
|
+
n !== void 0 && /* @__PURE__ */ e(L, { ticks: n })
|
|
47
47
|
]
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
);
|
|
52
52
|
export {
|
|
53
|
-
|
|
53
|
+
z as Range
|
|
54
54
|
};
|
|
@@ -3,5 +3,5 @@ import { BaseInputProps } from './Input';
|
|
|
3
3
|
export type SelectProps = BaseInputProps<React.SelectHTMLAttributes<HTMLSelectElement>>;
|
|
4
4
|
export declare const Select: React.ForwardRefExoticComponent<Omit<React.SelectHTMLAttributes<HTMLSelectElement>, "size"> & {
|
|
5
5
|
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
6
|
-
error?: string;
|
|
6
|
+
error?: string | boolean;
|
|
7
7
|
} & React.RefAttributes<HTMLSelectElement>>;
|
|
@@ -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-N4SQpl9r.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",
|
|
@@ -6,7 +6,7 @@ export type SwitchProps = BaseInputProps & {
|
|
|
6
6
|
};
|
|
7
7
|
export declare const Switch: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & {
|
|
8
8
|
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
9
|
-
error?: string;
|
|
9
|
+
error?: string | boolean;
|
|
10
10
|
} & {
|
|
11
11
|
label?: React.ReactNode;
|
|
12
12
|
checkedColor?: string;
|
|
@@ -2,7 +2,7 @@ import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
|
2
2
|
import m from "react";
|
|
3
3
|
import h from "classnames";
|
|
4
4
|
import { cssProps as u } from "../../utils/helpers.js";
|
|
5
|
-
import { V as f } from "../../ValidationTooltip-
|
|
5
|
+
import { V as f } from "../../ValidationTooltip-N4SQpl9r.js";
|
|
6
6
|
const _ = "styles_label_p-D4Y", w = "styles_input_VteBP", s = {
|
|
7
7
|
switch: "styles_switch_UNvH8",
|
|
8
8
|
label: _,
|
|
@@ -6,7 +6,7 @@ export type TextareaProps = BaseInputProps<TextareaAutosizeProps> & {
|
|
|
6
6
|
};
|
|
7
7
|
export declare const Textarea: React.ForwardRefExoticComponent<Omit<TextareaAutosizeProps, "size"> & {
|
|
8
8
|
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
9
|
-
error?: string;
|
|
9
|
+
error?: string | boolean;
|
|
10
10
|
} & {
|
|
11
11
|
autosize?: boolean;
|
|
12
12
|
} & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -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-N4SQpl9r.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: ({ className, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const ValidationTooltip: ({ content, className, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Checkbox as e } from "./Checkbox.js";
|
|
2
2
|
import { Field as p, FieldDescription as x, FieldLabel as i } from "./Field.js";
|
|
3
|
-
import { I as f } from "../../Input-
|
|
3
|
+
import { I as f } from "../../Input-BG84zXZH.js";
|
|
4
4
|
import { Numeric as l } from "./Numeric.js";
|
|
5
5
|
import { Radio as d } from "./Radio.js";
|
|
6
6
|
import { Range as s } from "./Range.js";
|
|
7
7
|
import { Select as b } from "./Select.js";
|
|
8
8
|
import { Switch as u } from "./Switch.js";
|
|
9
9
|
import { Textarea as R } from "./Textarea.js";
|
|
10
|
-
import { V as T } from "../../ValidationTooltip-
|
|
10
|
+
import { V as T } from "../../ValidationTooltip-N4SQpl9r.js";
|
|
11
11
|
export {
|
|
12
12
|
e as Checkbox,
|
|
13
13
|
p as Field,
|
|
@@ -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>>, "
|
|
22
|
+
} & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "as" | "align" | "wrap" | "justify" | "marginStart" | "marginEnd" | "direction" | "gap"> & React.RefAttributes<unknown>) => React.ReactElement | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CompositeProps } from '@floating-ui/react';
|
|
3
|
+
export type GalleryProps = React.HTMLAttributes<HTMLDivElement> & Omit<CompositeProps, 'cols'> & {
|
|
4
|
+
cols?: number | 'auto';
|
|
5
|
+
gap?: React.CSSProperties['gap'];
|
|
6
|
+
itemSize?: React.CSSProperties['width'];
|
|
7
|
+
objectFit?: React.CSSProperties['objectFit'];
|
|
8
|
+
marginStart?: React.CSSProperties['marginBlockStart'];
|
|
9
|
+
marginEnd?: React.CSSProperties['marginBlockEnd'];
|
|
10
|
+
};
|
|
11
|
+
export declare const Gallery: ({ gap, loop, cols, itemSize, objectFit: imageObjectFit, marginStart, marginEnd, className, style, children, ...props }: GalleryProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as C, useState as v, useEffect as w } from "react";
|
|
3
|
+
import j from "classnames";
|
|
4
|
+
import { Composite as x } from "@floating-ui/react";
|
|
5
|
+
import { cssProps as R } from "../../utils/helpers.js";
|
|
6
|
+
import { s as S } from "../../styles.module-D0C-vMZX.js";
|
|
7
|
+
const O = ({
|
|
8
|
+
gap: s,
|
|
9
|
+
loop: o = !1,
|
|
10
|
+
cols: e = "auto",
|
|
11
|
+
itemSize: n,
|
|
12
|
+
objectFit: m,
|
|
13
|
+
marginStart: l,
|
|
14
|
+
marginEnd: u,
|
|
15
|
+
className: a,
|
|
16
|
+
style: c,
|
|
17
|
+
children: i,
|
|
18
|
+
...f
|
|
19
|
+
}) => {
|
|
20
|
+
const t = C(null), [p, g] = v(e === "auto" ? 1 : e);
|
|
21
|
+
return w(() => {
|
|
22
|
+
const r = new ResizeObserver((y) => {
|
|
23
|
+
const b = window.getComputedStyle(y[0].target).gridTemplateColumns;
|
|
24
|
+
g(b.split(" ").length);
|
|
25
|
+
});
|
|
26
|
+
return t.current && (e === "auto" ? r.observe(t.current) : r.unobserve(t.current)), () => {
|
|
27
|
+
r.disconnect();
|
|
28
|
+
};
|
|
29
|
+
}, [e]), /* @__PURE__ */ d(
|
|
30
|
+
x,
|
|
31
|
+
{
|
|
32
|
+
...f,
|
|
33
|
+
ref: t,
|
|
34
|
+
loop: o,
|
|
35
|
+
cols: p,
|
|
36
|
+
"data-gallery": !0,
|
|
37
|
+
className: j(S.gallery, a),
|
|
38
|
+
style: {
|
|
39
|
+
...c,
|
|
40
|
+
...R({ gap: s, marginStart: l, marginEnd: u, itemSize: n, imageObjectFit: m })
|
|
41
|
+
},
|
|
42
|
+
children: i
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
O as Gallery
|
|
48
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CompositeItemProps } from '@floating-ui/react';
|
|
3
|
+
type BaseProps = React.HTMLAttributes<HTMLDivElement> & CompositeItemProps;
|
|
4
|
+
export type GalleryItemProps = (BaseProps & {
|
|
5
|
+
index?: undefined;
|
|
6
|
+
onSelect?: undefined;
|
|
7
|
+
}) | (Omit<BaseProps, 'onSelect'> & {
|
|
8
|
+
index: number;
|
|
9
|
+
onSelect?: (index: number) => void;
|
|
10
|
+
});
|
|
11
|
+
export declare const GalleryItem: ({ index, children, className, onClick, onSelect, onKeyDown, ...props }: GalleryItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as s } from "react";
|
|
3
|
+
import { CompositeItem as y } from "@floating-ui/react";
|
|
4
|
+
import n from "classnames";
|
|
5
|
+
import { s as u } from "../../styles.module-D0C-vMZX.js";
|
|
6
|
+
const I = ({
|
|
7
|
+
index: o,
|
|
8
|
+
children: l,
|
|
9
|
+
className: e,
|
|
10
|
+
onClick: t,
|
|
11
|
+
onSelect: m,
|
|
12
|
+
onKeyDown: a,
|
|
13
|
+
...p
|
|
14
|
+
}) => {
|
|
15
|
+
const c = s(
|
|
16
|
+
(r) => {
|
|
17
|
+
m?.(o), t?.(r);
|
|
18
|
+
},
|
|
19
|
+
[o, t, m]
|
|
20
|
+
), f = s(
|
|
21
|
+
(r) => {
|
|
22
|
+
(r.code === "Enter" || r.code === "Space") && m?.(o), a?.(r);
|
|
23
|
+
},
|
|
24
|
+
[o, a, m]
|
|
25
|
+
);
|
|
26
|
+
return /* @__PURE__ */ i(
|
|
27
|
+
y,
|
|
28
|
+
{
|
|
29
|
+
...p,
|
|
30
|
+
role: "button",
|
|
31
|
+
"data-gallery-image": o,
|
|
32
|
+
className: n(u.item, e),
|
|
33
|
+
onClick: c,
|
|
34
|
+
onKeyDown: f,
|
|
35
|
+
children: l
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
I as GalleryItem
|
|
41
|
+
};
|