@kolking/react-ui 1.8.20 → 1.9.1

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.
Files changed (48) hide show
  1. package/dist/Thumbnails-BlXFynlF.js +38 -0
  2. package/dist/components/Avatar/Avatar.js +15 -15
  3. package/dist/components/Avatar/helpers.js +15 -16
  4. package/dist/components/Badge/Badge.js +28 -29
  5. package/dist/components/Button/Button.d.ts +1 -1
  6. package/dist/components/Dialog/Dialog.js +44 -44
  7. package/dist/components/Dialog/useDialog.d.ts +9 -6
  8. package/dist/components/Dialog/useDialog.js +20 -28
  9. package/dist/components/Fields/Checkbox.js +15 -15
  10. package/dist/components/Fields/Numeric.js +34 -36
  11. package/dist/components/Fields/Range.d.ts +1 -1
  12. package/dist/components/Fields/Range.js +33 -33
  13. package/dist/components/Flex/Flex.d.ts +1 -1
  14. package/dist/components/Gallery/Gallery.d.ts +11 -0
  15. package/dist/components/Gallery/Gallery.js +49 -0
  16. package/dist/components/Gallery/GalleryItem.d.ts +12 -0
  17. package/dist/components/Gallery/GalleryItem.js +41 -0
  18. package/dist/components/Gallery/index.d.ts +2 -0
  19. package/dist/components/Gallery/index.js +6 -0
  20. package/dist/components/Icon/Icon.js +125 -122
  21. package/dist/components/Icon/icons.d.ts +1 -1
  22. package/dist/components/Icon/icons.js +4 -0
  23. package/dist/components/Lightbox/Lightbox.d.ts +12 -0
  24. package/dist/components/Lightbox/Lightbox.js +166 -0
  25. package/dist/components/Lightbox/Thumbnail.d.ts +7 -0
  26. package/dist/components/Lightbox/Thumbnail.js +26 -0
  27. package/dist/components/Lightbox/Thumbnails.d.ts +11 -0
  28. package/dist/components/Lightbox/Thumbnails.js +8 -0
  29. package/dist/components/Lightbox/index.d.ts +1 -0
  30. package/dist/components/Lightbox/index.js +4 -0
  31. package/dist/components/Menu/Menu.js +44 -45
  32. package/dist/components/Menu/MenuItem.js +33 -33
  33. package/dist/components/Notice/Notice.js +58 -43
  34. package/dist/components/Popover/Popover.js +40 -41
  35. package/dist/components/Progress/ProgressBar.js +14 -14
  36. package/dist/components/Progress/ProgressCircular.js +15 -15
  37. package/dist/components/Segmented/Segmented.js +43 -47
  38. package/dist/components/Tag/Tag.d.ts +1 -1
  39. package/dist/components/ToggleButton/ToggleButton.d.ts +1 -1
  40. package/dist/components/ToggleButton/ToggleGroup.js +42 -40
  41. package/dist/components/Tooltip/Tooltip.js +30 -31
  42. package/dist/index.d.ts +3 -1
  43. package/dist/index.js +71 -63
  44. package/dist/styles/style.css +1 -1
  45. package/dist/styles.module-D0C-vMZX.js +7 -0
  46. package/dist/utils/helpers.d.ts +3 -1
  47. package/dist/utils/helpers.js +30 -19
  48. package/package.json +41 -32
@@ -1,54 +1,54 @@
1
- import { jsxs as _, jsx as a } from "react/jsx-runtime";
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 E } from "../../ValidationTooltip-N4SQpl9r.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
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 f(r, t, e, s) {
14
- r == null || r.style.setProperty("--progress", `${(s - t) / (e - t)}`);
13
+ function _(a, r, t, n) {
14
+ a?.style.setProperty("--progress", `${(n - r) / (t - r)}`);
15
15
  }
16
- const M = ({ ticks: r }) => {
17
- const t = typeof r == "number" ? [...Array(r)] : r;
18
- return t.length < 2 ? null : /* @__PURE__ */ a("ul", { "data-range-ticks": !0, className: n.ticks, children: t.map((e, s) => /* @__PURE__ */ a("li", { children: e !== void 0 && /* @__PURE__ */ a("small", { children: e }) }, s)) });
19
- }, B = R.forwardRef(
20
- ({ size: r, height: t, 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);
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
- f(d.current, l, o, p);
24
- }, [l, o, p]);
23
+ _(i.current, l, o, g);
24
+ }, [l, o, g]);
25
25
  const w = P(
26
- (g) => {
27
- f(d.current, l, o, parseFloat(g.currentTarget.value)), c == null || c(g);
26
+ (m) => {
27
+ _(i.current, l, o, parseFloat(m.currentTarget.value)), u?.(m);
28
28
  },
29
- [l, o, c]
29
+ [l, o, u]
30
30
  );
31
- return /* @__PURE__ */ _(
31
+ return /* @__PURE__ */ p(
32
32
  "div",
33
33
  {
34
- ref: d,
34
+ ref: i,
35
35
  "data-range": !0,
36
- "data-disabled": i.disabled,
37
- "data-invalid": e ? !0 : void 0,
38
- className: N(n.range, m),
39
- style: { ...y, ...V({ size: r, height: t }) },
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__ */ _("div", { "data-range-wrapper": !0, className: n.range_wrapper, children: [
42
- /* @__PURE__ */ a("div", { "data-range-track": !0, className: n.range_track }),
43
- /* @__PURE__ */ a("div", { ref: b, "data-range-thumb": !0, className: n.range_thumb, children: u !== void 0 && A(u, "small") }),
44
- /* @__PURE__ */ a(E, { content: e, placement: "top", anchor: k, children: /* @__PURE__ */ a("input", { ...i, ref: h, type: "range", onChange: w }) })
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
- s !== void 0 && /* @__PURE__ */ a(M, { ticks: s })
46
+ n !== void 0 && /* @__PURE__ */ e(L, { ticks: n })
47
47
  ]
48
48
  }
49
49
  );
50
50
  }
51
51
  );
52
52
  export {
53
- B as Range
53
+ z as Range
54
54
  };
@@ -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" | "marginStart" | "marginEnd" | "gap"> & React.RefAttributes<unknown>) => React.ReactElement | null;
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,49 @@
1
+ import { jsx as b } 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: o,
9
+ loop: l = !1,
10
+ cols: e = "auto",
11
+ itemSize: n,
12
+ objectFit: m,
13
+ marginStart: u,
14
+ marginEnd: a,
15
+ className: c,
16
+ style: i,
17
+ children: f,
18
+ ...p
19
+ }) => {
20
+ const t = C(null), [s, g] = v(e === "auto" ? 1 : e);
21
+ return w(() => {
22
+ const r = new ResizeObserver((y) => {
23
+ const d = window.getComputedStyle(y[0].target).gridTemplateColumns;
24
+ g(d.split(" ").length);
25
+ });
26
+ return t.current && (e === "auto" ? r.observe(t.current) : r.unobserve(t.current)), () => {
27
+ r.disconnect();
28
+ };
29
+ }, [e]), /* @__PURE__ */ b(
30
+ x,
31
+ {
32
+ ...p,
33
+ ref: t,
34
+ loop: l,
35
+ cols: s,
36
+ "data-gallery": !0,
37
+ "data-gallery-cols": s,
38
+ className: j(S.gallery, c),
39
+ style: {
40
+ ...i,
41
+ ...R({ gap: o, marginStart: u, marginEnd: a, itemSize: n, imageObjectFit: m })
42
+ },
43
+ children: f
44
+ }
45
+ );
46
+ };
47
+ export {
48
+ O as Gallery
49
+ };
@@ -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
+ };
@@ -0,0 +1,2 @@
1
+ export * from './Gallery';
2
+ export * from './GalleryItem';
@@ -0,0 +1,6 @@
1
+ import { Gallery as l } from "./Gallery.js";
2
+ import { GalleryItem as m } from "./GalleryItem.js";
3
+ export {
4
+ l as Gallery,
5
+ m as GalleryItem
6
+ };