haze-ui 1.24.0 → 1.24.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.
- package/dist/components/ChatInput/ChatInput.js +1 -1
- package/dist/components/Combobox/Combobox.js +36 -38
- package/dist/components/Command/Command.js +2 -2
- package/dist/components/StreamingText/StreamingText.js +11 -12
- package/dist/components/TagInput/TagInputCore.js +1 -1
- package/dist/utils/floating.js +20 -22
- package/package.json +16 -16
|
@@ -9,7 +9,7 @@ var o = "haze-ChatInput__wrapper", s = "haze-ChatInput__textarea", c = "haze-Cha
|
|
|
9
9
|
function l({ value: l, onSend: u, placeholder: d = "Type a message...", disabled: f, maxLength: p, className: m }) {
|
|
10
10
|
let [h, g] = a(l, ""), _ = i(null), v = r(() => {
|
|
11
11
|
let e = h.trim();
|
|
12
|
-
|
|
12
|
+
e && !f && (u?.(e), g(""), _.current && (_.current.style.height = "auto"));
|
|
13
13
|
}, [
|
|
14
14
|
h,
|
|
15
15
|
f,
|
|
@@ -4,62 +4,60 @@ import { FloatingPanel as t, useFloating as n } from "../../utils/floating.js";
|
|
|
4
4
|
import r from "./ComboboxOption.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
8
|
-
import { useControl as
|
|
7
|
+
import { useId as o, useRef as s, useState as c } from "react";
|
|
8
|
+
import { useControl as l } from "react-use-control";
|
|
9
9
|
//#region src/lib/components/Combobox/Combobox.tsx
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
let [
|
|
13
|
-
open:
|
|
14
|
-
setOpen:
|
|
15
|
-
triggerRef:
|
|
16
|
-
panelRef:
|
|
10
|
+
var u = "haze-Combobox__wrapper", d = "haze-Combobox__input", f = "haze-Combobox__listbox";
|
|
11
|
+
function p({ value: p, open: m, options: h, placeholder: g, className: _ }) {
|
|
12
|
+
let [v, y] = l(p, ""), [b, x] = c(""), [S, C] = l(m, !1), [w, T] = c(-1), [E, D] = c(b), O = o(), k = s(null), A = s(null), j = n({
|
|
13
|
+
open: S,
|
|
14
|
+
setOpen: C,
|
|
15
|
+
triggerRef: k,
|
|
16
|
+
panelRef: A,
|
|
17
17
|
animated: !0
|
|
18
|
-
}),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
let t = g.find((t) => t.value === e)?.label ?? e;
|
|
25
|
-
S(t), w(!1), O.current?.focus();
|
|
18
|
+
}), M = h.filter((e) => e.label.toLowerCase().includes(b.toLowerCase()));
|
|
19
|
+
b !== E && (D(b), T(-1));
|
|
20
|
+
let N = (e) => {
|
|
21
|
+
y(e);
|
|
22
|
+
let t = h.find((t) => t.value === e)?.label ?? e;
|
|
23
|
+
x(t), C(!1), k.current?.focus();
|
|
26
24
|
};
|
|
27
25
|
return /* @__PURE__ */ a("div", {
|
|
28
|
-
className: e([
|
|
26
|
+
className: e([u, _]),
|
|
29
27
|
children: [/* @__PURE__ */ i("input", {
|
|
30
|
-
ref:
|
|
28
|
+
ref: k,
|
|
31
29
|
role: "combobox",
|
|
32
|
-
style:
|
|
33
|
-
"aria-expanded":
|
|
34
|
-
"aria-controls":
|
|
30
|
+
style: j.triggerStyle,
|
|
31
|
+
"aria-expanded": S,
|
|
32
|
+
"aria-controls": O,
|
|
35
33
|
"aria-autocomplete": "list",
|
|
36
|
-
className:
|
|
37
|
-
value:
|
|
38
|
-
placeholder:
|
|
34
|
+
className: d,
|
|
35
|
+
value: b,
|
|
36
|
+
placeholder: g,
|
|
39
37
|
onChange: (e) => {
|
|
40
|
-
|
|
38
|
+
x(e.target.value), C(!0);
|
|
41
39
|
},
|
|
42
|
-
onFocus: () =>
|
|
43
|
-
onClick: () =>
|
|
40
|
+
onFocus: () => C(!0),
|
|
41
|
+
onClick: () => C(!0),
|
|
44
42
|
onKeyDown: (e) => {
|
|
45
|
-
e.key === "ArrowDown" ? (e.preventDefault(),
|
|
43
|
+
e.key === "ArrowDown" ? (e.preventDefault(), T((e) => Math.min(e + 1, M.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), T((e) => Math.max(e - 1, 0))) : e.key === "Enter" && w >= 0 && M[w] ? (e.preventDefault(), N(M[w].value)) : e.key === "Escape" && C(!1);
|
|
46
44
|
}
|
|
47
45
|
}), /* @__PURE__ */ i(t, {
|
|
48
|
-
ref:
|
|
49
|
-
behavior:
|
|
46
|
+
ref: A,
|
|
47
|
+
behavior: j,
|
|
50
48
|
placement: "bottom-span",
|
|
51
|
-
id:
|
|
49
|
+
id: O,
|
|
52
50
|
role: "listbox",
|
|
53
|
-
visualClass:
|
|
54
|
-
children:
|
|
51
|
+
visualClass: f,
|
|
52
|
+
children: M.map((e, t) => /* @__PURE__ */ i(r, {
|
|
55
53
|
value: e.value,
|
|
56
|
-
highlighted: t ===
|
|
57
|
-
selected: e.value ===
|
|
58
|
-
onSelect:
|
|
54
|
+
highlighted: t === w,
|
|
55
|
+
selected: e.value === v,
|
|
56
|
+
onSelect: N,
|
|
59
57
|
children: e.label
|
|
60
58
|
}, e.value))
|
|
61
59
|
})]
|
|
62
60
|
});
|
|
63
61
|
}
|
|
64
62
|
//#endregion
|
|
65
|
-
export {
|
|
63
|
+
export { p as default };
|
|
@@ -79,7 +79,7 @@ function y({ children: t, className: a }) {
|
|
|
79
79
|
var b = "haze-Command__itemStyle";
|
|
80
80
|
function x({ children: t, className: n, onSelect: r }) {
|
|
81
81
|
let { query: a } = p();
|
|
82
|
-
return
|
|
82
|
+
return a && !(typeof t == "string" ? t : "").toLowerCase().includes(a.toLowerCase()) ? null : /* @__PURE__ */ i("div", {
|
|
83
83
|
role: "option",
|
|
84
84
|
tabIndex: -1,
|
|
85
85
|
onClick: r,
|
|
@@ -88,7 +88,7 @@ function x({ children: t, className: n, onSelect: r }) {
|
|
|
88
88
|
},
|
|
89
89
|
className: e([b, n]),
|
|
90
90
|
children: t
|
|
91
|
-
})
|
|
91
|
+
});
|
|
92
92
|
}
|
|
93
93
|
//#endregion
|
|
94
94
|
export { _ as CommandInput, x as CommandItem, y as CommandList, h as default };
|
|
@@ -6,29 +6,28 @@ import { useEffect as r, useRef as i, useState as a } from "react";
|
|
|
6
6
|
//#region src/lib/components/StreamingText/StreamingText.tsx
|
|
7
7
|
var o = "haze-StreamingText__wrapper", s = "haze-StreamingText__cursor";
|
|
8
8
|
function c({ text: c, speed: l = 20, onComplete: u, showCursor: d = !0, className: f }) {
|
|
9
|
-
let [p, m] = a(""), h = i(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
g.current = !0, u?.();
|
|
9
|
+
let [p, m] = a(""), h = i(!1), [g, _] = a(c);
|
|
10
|
+
c !== g && (_(c), m(""));
|
|
11
|
+
let v = p.length >= c.length;
|
|
12
|
+
return r(() => {
|
|
13
|
+
if (v) {
|
|
14
|
+
h.current || (h.current = !0, u?.());
|
|
16
15
|
return;
|
|
17
16
|
}
|
|
17
|
+
h.current = !1;
|
|
18
18
|
let e = setTimeout(() => {
|
|
19
|
-
|
|
19
|
+
m(c.slice(0, p.length + 1));
|
|
20
20
|
}, l);
|
|
21
21
|
return () => clearTimeout(e);
|
|
22
22
|
}, [
|
|
23
|
+
v,
|
|
23
24
|
p,
|
|
24
25
|
c,
|
|
25
26
|
l,
|
|
26
27
|
u
|
|
27
|
-
])
|
|
28
|
-
let _ = h.current >= c.length;
|
|
29
|
-
return /* @__PURE__ */ n("span", {
|
|
28
|
+
]), /* @__PURE__ */ n("span", {
|
|
30
29
|
className: e([o, f]),
|
|
31
|
-
children: [p, d && !
|
|
30
|
+
children: [p, d && !v && /* @__PURE__ */ t("span", { className: e([s]) })]
|
|
32
31
|
});
|
|
33
32
|
}
|
|
34
33
|
//#endregion
|
|
@@ -19,7 +19,7 @@ function f({ value: f, onChange: p, placeholder: m, maxTags: h, disabled: g, cla
|
|
|
19
19
|
}, [f]);
|
|
20
20
|
let E = r((e) => {
|
|
21
21
|
let t = e.trim();
|
|
22
|
-
|
|
22
|
+
t && !f.includes(t) && (h && f.length >= h || (p([...f, t]), S("")));
|
|
23
23
|
}, [
|
|
24
24
|
f,
|
|
25
25
|
h,
|
package/dist/utils/floating.js
CHANGED
|
@@ -39,39 +39,37 @@ var p = "haze-floating__floatingNative", m = "haze-floating__floatingAnchored",
|
|
|
39
39
|
right: F
|
|
40
40
|
};
|
|
41
41
|
function z({ open: e, setOpen: n, triggerRef: r, panelRef: i, animated: g, collision: _ }) {
|
|
42
|
-
let v = `--haze-floating-${s().replace(/[^a-zA-Z0-9]/g, "")}`, y = d(), b = f(), [x, S] = l(!e);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, [e]);
|
|
46
|
-
let C = c(!1), [w, T] = l(!1), E = c(null), D = c(-Infinity), O = c(-Infinity), k = c(null);
|
|
42
|
+
let v = `--haze-floating-${s().replace(/[^a-zA-Z0-9]/g, "")}`, y = d(), b = f(), [x, S] = l(!e), [C, w] = l(e);
|
|
43
|
+
e !== C && (w(e), e && S(!1));
|
|
44
|
+
let T = c(!1), [E, D] = l(!1), O = c(null), k = c(-Infinity), A = c(-Infinity), j = c(null);
|
|
47
45
|
o(() => {
|
|
48
46
|
let r = i.current;
|
|
49
47
|
if (!r || !y) return;
|
|
50
|
-
r !==
|
|
48
|
+
r !== O.current && (O.current = r, T.current = !1, D(!1));
|
|
51
49
|
let a = !0, o = () => {
|
|
52
|
-
|
|
50
|
+
j.current = { el: r }, r.hidePopover();
|
|
53
51
|
}, s = () => {
|
|
54
|
-
if (
|
|
52
|
+
if (T.current && r === i.current) {
|
|
55
53
|
if (g) {
|
|
56
54
|
let e = () => {
|
|
57
|
-
|
|
55
|
+
a && T.current && r === i.current && o();
|
|
58
56
|
}, n = t(r);
|
|
59
57
|
n ? n.then(e) : e();
|
|
60
58
|
} else o();
|
|
61
59
|
}
|
|
62
60
|
}, c = (t) => {
|
|
63
61
|
let i = t.newState;
|
|
64
|
-
if (
|
|
62
|
+
if (T.current = i === "open", D(T.current), i === "closed") {
|
|
65
63
|
g && S(!0);
|
|
66
|
-
let t =
|
|
67
|
-
if (
|
|
64
|
+
let t = j.current?.el === r;
|
|
65
|
+
if (j.current = null, t) {
|
|
68
66
|
e && r.showPopover();
|
|
69
67
|
return;
|
|
70
68
|
}
|
|
71
|
-
e && (performance.now() -
|
|
69
|
+
e && (performance.now() - k.current < u && (A.current = performance.now()), k.current = -Infinity, n(!1));
|
|
72
70
|
} else e || s();
|
|
73
71
|
};
|
|
74
|
-
return r.addEventListener("toggle", c), e ?
|
|
72
|
+
return r.addEventListener("toggle", c), e ? T.current || r.showPopover() : s(), () => {
|
|
75
73
|
a = !1, r.removeEventListener("toggle", c);
|
|
76
74
|
};
|
|
77
75
|
}, [
|
|
@@ -111,11 +109,11 @@ function z({ open: e, setOpen: n, triggerRef: r, panelRef: i, animated: g, colli
|
|
|
111
109
|
x,
|
|
112
110
|
i
|
|
113
111
|
]);
|
|
114
|
-
let
|
|
115
|
-
e && (
|
|
116
|
-
}, [e]),
|
|
117
|
-
if (performance.now() -
|
|
118
|
-
|
|
112
|
+
let M = a(() => {
|
|
113
|
+
e && (k.current = performance.now());
|
|
114
|
+
}, [e]), N = a(() => {
|
|
115
|
+
if (performance.now() - A.current < u) {
|
|
116
|
+
A.current = -Infinity;
|
|
119
117
|
return;
|
|
120
118
|
}
|
|
121
119
|
n((e) => !e);
|
|
@@ -124,14 +122,14 @@ function z({ open: e, setOpen: n, triggerRef: r, panelRef: i, animated: g, colli
|
|
|
124
122
|
open: e,
|
|
125
123
|
native: y,
|
|
126
124
|
anchored: b,
|
|
127
|
-
shown: y ?
|
|
125
|
+
shown: y ? E : e,
|
|
128
126
|
dataState: g ? e ? "open" : "closed" : void 0,
|
|
129
127
|
exited: g ? x : !e,
|
|
130
128
|
collision: _,
|
|
131
129
|
anchorName: v,
|
|
132
130
|
triggerStyle: b ? { anchorName: v } : void 0,
|
|
133
|
-
onTriggerPointerDown:
|
|
134
|
-
onTriggerClick:
|
|
131
|
+
onTriggerPointerDown: M,
|
|
132
|
+
onTriggerClick: N,
|
|
135
133
|
panelAttrs: {
|
|
136
134
|
popover: y ? "auto" : void 0,
|
|
137
135
|
style: b ? { "--haze-floating-anchor": v } : void 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "haze-ui",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React UI component library powered by react-use-control and Linaria",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"react-f0rm": ">=0.7.0 <2.0.0"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"react-use-control": "^1.
|
|
75
|
+
"react-use-control": "^1.6.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@axe-core/playwright": "^4.13.0",
|
|
@@ -80,25 +80,25 @@
|
|
|
80
80
|
"@babel/preset-env": "^8.0.2",
|
|
81
81
|
"@babel/preset-typescript": "^8.0.1",
|
|
82
82
|
"@faker-js/faker": "^10.6.0",
|
|
83
|
-
"@for-fun/event-emitter": "^1.0
|
|
83
|
+
"@for-fun/event-emitter": "^1.1.0",
|
|
84
84
|
"@linaria/core": "^8.2.0",
|
|
85
|
-
"@native-router/core": "^1.
|
|
86
|
-
"@native-router/react": "^1.
|
|
85
|
+
"@native-router/core": "^1.16.1",
|
|
86
|
+
"@native-router/react": "^1.15.0",
|
|
87
87
|
"@playwright/test": "^1.62.1",
|
|
88
88
|
"@size-limit/file": "^13.0.3",
|
|
89
89
|
"@testing-library/jest-dom": "^7.0.1",
|
|
90
90
|
"@testing-library/react": "^16.3.3",
|
|
91
|
-
"@testing-library/user-event": "^14.6.
|
|
91
|
+
"@testing-library/user-event": "^14.6.7",
|
|
92
92
|
"@types/culori": "^4.0.1",
|
|
93
93
|
"@types/jest-axe": "^3.5.9",
|
|
94
|
-
"@types/node": "^26.4.
|
|
94
|
+
"@types/node": "^26.4.1",
|
|
95
95
|
"@types/ramda": "^0.32.0",
|
|
96
96
|
"@types/react": "^19.2.18",
|
|
97
|
-
"@types/react-dom": "^19.2.
|
|
97
|
+
"@types/react-dom": "^19.2.7",
|
|
98
98
|
"@vitejs/plugin-react": "^6.1.1",
|
|
99
|
-
"@vitest/coverage-v8": "
|
|
100
|
-
"@wyw-in-js/babel-preset": "^2.
|
|
101
|
-
"@wyw-in-js/vite": "^2.
|
|
99
|
+
"@vitest/coverage-v8": "5.0.0",
|
|
100
|
+
"@wyw-in-js/babel-preset": "^2.5.1",
|
|
101
|
+
"@wyw-in-js/vite": "^2.5.1",
|
|
102
102
|
"babel-plugin-transform-jsx-class": "^0.1.3",
|
|
103
103
|
"babel-plugin-transform-jsx-condition": "^0.1.3",
|
|
104
104
|
"commitizen": "^4.3.2",
|
|
@@ -113,24 +113,24 @@
|
|
|
113
113
|
"jsdom": "^30.0.1",
|
|
114
114
|
"json-schema-faker": "^0.6.3",
|
|
115
115
|
"lint-staged": "^17.4.1",
|
|
116
|
-
"lucide-react": "^1.
|
|
116
|
+
"lucide-react": "^1.41.0",
|
|
117
117
|
"prettier": "^3.9.6",
|
|
118
118
|
"qss": "^3.0.0",
|
|
119
119
|
"ramda": "^0.32.0",
|
|
120
120
|
"react": "^19.2.8",
|
|
121
121
|
"react-dom": "^19.2.8",
|
|
122
|
-
"react-f0rm": "^1.
|
|
122
|
+
"react-f0rm": "^1.1.1",
|
|
123
123
|
"react-icons": "^5.7.0",
|
|
124
|
-
"react-toolroom": "^
|
|
124
|
+
"react-toolroom": "^1.1.0",
|
|
125
125
|
"rollup-plugin-type-as-json-schema": "^0.2.6",
|
|
126
126
|
"semantic-release": "^25.0.9",
|
|
127
127
|
"size-limit": "^13.0.3",
|
|
128
128
|
"terser": "^5.51.2",
|
|
129
129
|
"tools-config": "^0.3.1",
|
|
130
|
-
"tsc-alias": "^1.9.
|
|
130
|
+
"tsc-alias": "^1.9.4",
|
|
131
131
|
"typescript": "^6.0.3",
|
|
132
132
|
"vite": "^8.2.2",
|
|
133
|
-
"vitest": "^
|
|
133
|
+
"vitest": "^5.0.0"
|
|
134
134
|
},
|
|
135
135
|
"size-limit": [
|
|
136
136
|
{
|