wimui 0.55.0 → 0.56.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.
@@ -1,19 +1,19 @@
1
1
  "use client";
2
2
  import e from "./anchor.module.js";
3
- import { useLayoutEffect as t, useRef as n, useState as r } from "react";
4
- import i from "classnames";
5
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
3
+ import { useCallback as t, useEffect as n, useLayoutEffect as r, useRef as i, useState as a } from "react";
4
+ import o from "classnames";
5
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
6
  //#region src/components/navigation/Anchor/Anchor.tsx
7
- var s = ({ items: s = [], bounds: c = 5, offset: l = 0, direction: u = "vertical", className: d, style: f }) => {
8
- let [p, m] = r(""), [h, g] = r({}), _ = n(null), v = (e, t) => {
7
+ var l = ({ items: l = [], bounds: u = 5, offset: d = 0, direction: f = "vertical", className: p, style: m }) => {
8
+ let [h, g] = a(""), [_, v] = a({}), y = i(null), b = (e, t) => {
9
9
  e.preventDefault();
10
10
  let n = t.replace("#", ""), r = document.getElementById(n);
11
11
  r && (window.scrollTo({
12
- top: r.offsetTop - l,
12
+ top: r.offsetTop - d,
13
13
  behavior: "smooth"
14
- }), m(t));
14
+ }), g(t));
15
15
  };
16
- t(() => {
16
+ r(() => {
17
17
  let e = () => {
18
18
  let e = (t, n) => {
19
19
  let r = [];
@@ -23,43 +23,44 @@ var s = ({ items: s = [], bounds: c = 5, offset: l = 0, direction: u = "vertical
23
23
  parentHref: n
24
24
  }), t.children && (r = r.concat(e(t.children, n || t.href)));
25
25
  }), r;
26
- }, t = e(s), n = "", r = window.scrollY || document.documentElement.scrollTop, i = document.documentElement.scrollHeight, a = document.documentElement.clientHeight;
26
+ }, t = e(l), n = "", r = window.scrollY || document.documentElement.scrollTop, i = document.documentElement.scrollHeight, a = document.documentElement.clientHeight;
27
27
  if (r > 0 && Math.ceil(r + a) >= i && t.length > 0) {
28
28
  let e = t[t.length - 1];
29
- n = u === "horizontal" && e.parentHref ? e.parentHref : e.href;
29
+ n = f === "horizontal" && e.parentHref ? e.parentHref : e.href;
30
30
  } else for (let e of t) {
31
31
  let t = e.href.replace("#", ""), r = document.getElementById(t);
32
32
  if (r) {
33
- if (r.getBoundingClientRect().top <= l + c) n = u === "horizontal" && e.parentHref ? e.parentHref : e.href;
33
+ if (r.getBoundingClientRect().top <= d + u) n = f === "horizontal" && e.parentHref ? e.parentHref : e.href;
34
34
  else break;
35
35
  }
36
36
  }
37
- n && n !== p && m(n);
37
+ n && n !== h && g(n);
38
38
  };
39
39
  return window.addEventListener("scroll", e), e(), () => window.removeEventListener("scroll", e);
40
40
  }, [
41
- s,
42
41
  l,
43
- c,
44
- p,
45
- u
46
- ]), t(() => {
47
- if (!p || !_.current) return;
48
- let t = _.current.querySelector(`a[href="${p}"]`);
42
+ d,
43
+ u,
44
+ h,
45
+ f
46
+ ]);
47
+ let x = t(() => {
48
+ if (!h || !y.current) return;
49
+ let t = y.current.querySelector(`a[href="${h}"]`);
49
50
  if (t) {
50
- let n = _.current.getBoundingClientRect();
51
- if (u === "vertical") {
51
+ let n = y.current.getBoundingClientRect();
52
+ if (f === "vertical") {
52
53
  let e = t.getBoundingClientRect();
53
- g({
54
+ v({
54
55
  top: e.top - n.top,
55
56
  height: e.height,
56
57
  opacity: 1
57
58
  });
58
59
  } else {
59
- let r = _.current.querySelector(`.${e.list}`);
60
+ let r = y.current.querySelector(`.${e.list}`);
60
61
  if (r) {
61
62
  let e = t.getBoundingClientRect(), i = r.getBoundingClientRect(), a = e.left - i.left + r.scrollLeft, o = a - i.width / 2 + e.width / 2, s = r.scrollWidth - i.width, c = Math.max(0, Math.min(o, s)), l = a - c + (i.left - n.left);
62
- g({
63
+ v({
63
64
  left: l,
64
65
  width: e.width,
65
66
  opacity: 1
@@ -69,41 +70,49 @@ var s = ({ items: s = [], bounds: c = 5, offset: l = 0, direction: u = "vertical
69
70
  });
70
71
  } else {
71
72
  let e = t.getBoundingClientRect();
72
- g({
73
- left: e.left - _.current.getBoundingClientRect().left,
73
+ v({
74
+ left: e.left - y.current.getBoundingClientRect().left,
74
75
  width: e.width,
75
76
  opacity: 1
76
77
  });
77
78
  }
78
79
  }
79
- } else g({ opacity: 0 });
80
- }, [p, u]);
81
- let y = (t) => /* @__PURE__ */ a("ul", {
82
- className: i(e.list, e[u]),
83
- children: t.map((t) => /* @__PURE__ */ o("li", {
84
- className: i(e.item, p === t.href && e.active),
85
- children: [/* @__PURE__ */ a("a", {
80
+ } else v({ opacity: 0 });
81
+ }, [h, f]);
82
+ r(() => {
83
+ x();
84
+ }, [x]), n(() => {
85
+ let e = y.current;
86
+ if (!e || typeof ResizeObserver > "u") return;
87
+ let t = new ResizeObserver(() => x());
88
+ return t.observe(e), e.querySelectorAll("a").forEach((e) => t.observe(e)), () => t.disconnect();
89
+ }, [x, l]);
90
+ let S = (t) => /* @__PURE__ */ s("ul", {
91
+ className: o(e.list, e[f]),
92
+ children: t.map((t) => /* @__PURE__ */ c("li", {
93
+ className: o(e.item, h === t.href && e.active),
94
+ children: [/* @__PURE__ */ s("a", {
86
95
  href: t.href,
87
96
  className: e.link,
88
- "aria-current": p === t.href ? "location" : void 0,
89
- onClick: (e) => v(e, t.href),
97
+ "aria-current": h === t.href ? "location" : void 0,
98
+ onClick: (e) => b(e, t.href),
90
99
  title: typeof t.title == "string" ? t.title : void 0,
91
100
  children: t.title
92
- }), t.children && u === "vertical" && y(t.children)]
101
+ }), t.children && f === "vertical" && S(t.children)]
93
102
  }, t.key))
94
103
  });
95
- return /* @__PURE__ */ o("div", {
96
- className: i("wim-anchor", e.root, e[u], d),
97
- style: f,
98
- ref: _,
99
- children: [/* @__PURE__ */ a("div", {
104
+ return /* @__PURE__ */ c("div", {
105
+ className: o("wim-anchor", e.root, e[f], p),
106
+ style: m,
107
+ ref: y,
108
+ children: [/* @__PURE__ */ s("div", {
100
109
  className: e.ink,
101
- children: /* @__PURE__ */ a("span", {
110
+ children: /* @__PURE__ */ s("span", {
102
111
  className: e.inkBall,
103
- style: h
112
+ style: _
104
113
  })
105
- }), y(s)]
114
+ }), S(l)]
106
115
  });
107
116
  };
108
117
  //#endregion
109
- export { s as Anchor, s as default };
118
+ export { l as Anchor, l as default };
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## What this is
6
6
 
7
- **wimui** v0.55.0 — a React 19 component library: 228 documented components across 10 categories, with design tokens, dark mode, i18n (en/ja/pt-BR) and WAI-ARIA compliant a11y. Peer deps: react ^19, react-dom ^19 (plus optional peers for specific components — see package.json).
7
+ **wimui** v0.56.1 — a React 19 component library: 228 documented components across 10 categories, with design tokens, dark mode, i18n (en/ja/pt-BR) and WAI-ARIA compliant a11y. Peer deps: react ^19, react-dom ^19 (plus optional peers for specific components — see package.json).
8
8
 
9
9
  ## Install & required setup
10
10
 
@@ -1260,12 +1260,25 @@ text to take a name from, and the icon name is not used as one.
1260
1260
  - `src: string` — URL or data URL of the image to crop
1261
1261
  - `aspectRatio: number` = 1 — Aspect ratio (width / height); 1 produces a square
1262
1262
  - `circular: boolean` = false — Whether to display a circular crop area (for profile images)
1263
- - `onCrop: (dataUrl: string) => void` — Callback when the crop result is finalized
1263
+ - `onCrop: (dataUrl: string, detail: ImageCropDetail) => void` — Called with the cropped image as a data URL once the crop is confirmed. The second argument
1264
+ describes the crop (offset, zoom, rotation, frame and output size) so it can be redone elsewhere.
1264
1265
  - `showRotation: boolean` = true — Whether to show the rotation button
1265
1266
  - `showZoom: boolean` = true — Whether to show the zoom slider
1266
1267
  - `showApplyButton: boolean` = true — Whether to show the apply button
1267
1268
  - `applyLabel: string` — Label of the apply button
1268
- - `onApply: (dataUrl: string) => void` — Callback when the crop is applied (after confirming in the dialog)
1269
+ - `onApply: (dataUrl: string, detail: ImageCropDetail) => void` — Called with the cropped image and the crop detail when the crop is applied (after confirming in the dialog)
1270
+ - `onCropError: (error: Error, detail: ImageCropDetail) => void` — Called instead of onCrop and onApply when the image cannot be produced, with the crop detail.
1271
+ The usual cause is an image from another origin drawn without CORS approval: the browser then
1272
+ refuses to read the canvas. Set crossOrigin and serve the image with CORS headers, or crop on
1273
+ the server from the detail.
1274
+ - `maxOutputSize: number` — Upper bound, in px, for the longer side of the output image. The crop is taken at the
1275
+ resolution of the source image; without a bound a large photo produces a large data URL.
1276
+ - `outputType: "image/png" | "image/jpeg" | "image/webp"` = "image/png" — Image format of the output. "image/png" keeps transparency where the image does not cover the frame.
1277
+ @default "image/png"
1278
+ - `outputQuality: number` = 0.92 — Quality from 0 to 1 for "image/jpeg" and "image/webp". Ignored for "image/png".
1279
+ @default 0.92
1280
+ - `crossOrigin: "anonymous" | "use-credentials"` — CORS mode used to load the image. Needed to crop an image served from another origin;
1281
+ the server must send matching CORS headers or the image will not load at all.
1269
1282
  - **InlineEdit** — A component that allows users to switch between a view-only mode and an editable mode in-place. (aka Editable Text)
1270
1283
  - `value: string` — Current text (controlled)
1271
1284
  - `defaultValue: string` — Initial text (uncontrolled)
@@ -1936,7 +1949,8 @@ When a function is passed, it is called as (error, errorInfo, reset) => ReactNod
1936
1949
  @default "dark"
1937
1950
  - `blur: "none" | "sm" | "md" | "lg"` = "sm" — Strength of the backdrop blur effect.
1938
1951
  @default "sm"
1939
- - `message: string` — Loading message displayed below the indicator.
1952
+ - `message: string` — Loading message displayed below the indicator. Without a message (and without children),
1953
+ a built-in "Loading" text is read to assistive technology in its place.
1940
1954
  - `fixed: boolean` = false — Whether to use position: fixed (covers the whole screen).
1941
1955
 
1942
1956
  When `false` (the default) the overlay is `position: absolute`, so it covers
package/dist/llms.txt CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## What this is
6
6
 
7
- **wimui** v0.55.0 — a React 19 component library: 228 documented components across 10 categories, with design tokens, dark mode, i18n (en/ja/pt-BR) and WAI-ARIA compliant a11y. Peer deps: react ^19, react-dom ^19 (plus optional peers for specific components — see package.json).
7
+ **wimui** v0.56.1 — a React 19 component library: 228 documented components across 10 categories, with design tokens, dark mode, i18n (en/ja/pt-BR) and WAI-ARIA compliant a11y. Peer deps: react ^19, react-dom ^19 (plus optional peers for specific components — see package.json).
8
8
 
9
9
  ## Install & required setup
10
10