@kakadu/components 6.10.1 → 6.11.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/build/components/button.js +1 -1
- package/build/components/button.mjs +59 -59
- package/build/components/code.d.ts +8 -0
- package/build/components/code.js +6 -0
- package/build/components/code.mjs +7836 -0
- package/build/components/combobox.js +1 -1
- package/build/components/combobox.mjs +89 -78
- package/build/components/icon-button.js +1 -1
- package/build/components/icon-button.mjs +1 -1
- package/build/components/text.js +1 -1
- package/build/components/text.mjs +1 -1
- package/build/components.css +1 -1
- package/build/index.d.ts +2 -0
- package/build/index.js +1 -1
- package/build/index.mjs +242 -239
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("../jsx-runtime-CZa898vN.js"),e=require("react"),_=require("@kuma-ui/core"),se=require("../hooks/use-synchronized-value.js"),ne=require("../icons/icon.js"),re=require("../icons/chevron-up.js"),oe=require("../utilities/search.js"),Y=require("../utilities/listeners.js"),ae=require("./input.js"),T=require("./text.js"),X=require("./flex.js"),ce=require("./skeleton.js"),ue=Y.default(n=>{window.addEventListener("mousemove",n,{capture:!0})},n=>{window.removeEventListener("mousemove",n,{capture:!0})}),ie=Y.default(n=>{window.addEventListener("keydown",n,{capture:!0})},n=>{window.removeEventListener("keydown",n,{capture:!0})});function F(){const{value:n,setValue:d}=se.default("isKeyboardNavigating");return e.useMemo(()=>({isKeyboardNavigating:n,setIsKeyboardNavigating:d}),[n,d])}function q(n){return"text"in n?n.text:n.label}const B="kakadu-components-1144794361",D="kakadu-components-2911184744";function le({ref:n,isSelected:d,id:V,value:o,label:k,onSelect:j,onHover:w}){const{isKeyboardNavigating:m}=F(),I=e.useCallback(()=>{j(o)},[j,o]),u=e.useCallback(r=>{m||r.movementX===0&&r.movementY===0||w(o)},[m,w,o]),b=e.useRef(null);e.useEffect(()=>{const r=b.current;d&&r&&m&&setTimeout(()=>{r.scrollIntoView({behavior:"smooth",block:"nearest"})},0)},[d,m]);const a=e.useCallback(r=>{b.current=r,n&&(n.current=r)},[n]);return f.jsxRuntimeExports.jsx("li",{ref:a,id:V,role:"option","aria-selected":d,tabIndex:-1,className:_.cx(B,"kakadu-components-4130497639",m?"kakadu-components-962373561":"kakadu-components-1109598791"),onClick:I,onMouseMove:u,children:f.jsxRuntimeExports.jsx(T.Span,{className:_.cx(D,typeof k=="string"&&"kakadu-components-154286052"),children:k})})}function fe({isLoading:n,id:d,activeOptionId:V,selectedValue:o,options:k,onSelect:j,onHover:w}){const m=e.useRef(null);e.useEffect(()=>{const a=m.current;a&&a.scrollIntoView({behavior:"smooth",block:"nearest"})},[]);const I=e.useRef(null),{isKeyboardNavigating:u}=F(),b=e.useRef(u);return b.current=u,e.useLayoutEffect(()=>{const a=m.current;if(a&&k.length>0){if(b.current){const r=I.current;if(r){r.scrollIntoView({block:"nearest"});return}}a.scrollTo({top:0})}},[k]),f.jsxRuntimeExports.jsxs("ul",{ref:m,id:d,role:"listbox","aria-label":"Options",tabIndex:-1,className:"kakadu-components-3718330689",children:[k.length===0?n?null:f.jsxRuntimeExports.jsxs(X.default,{"aria-atomic":!0,as:"li",role:"status","aria-live":"polite",direction:"row",preset:"start",gap:.5,className:B,children:[f.jsxRuntimeExports.jsx(ne.default,{size:15,type:"exclamationTriangle"}),f.jsxRuntimeExports.jsx(T.Span,{className:D,children:"No results."})]}):k.map((a,r)=>f.jsxRuntimeExports.jsx(le,{...a,ref:a.value===o?I:void 0,id:a.value===o?V:void 0,isSelected:a.value===o,onSelect:j,onHover:w},q(a)+r)),n?f.jsxRuntimeExports.jsx(X.default,{as:"li",alignment:"center",className:B,children:f.jsxRuntimeExports.jsx(T.Span,{className:_.cx(D,"kakadu-components-2015848015"),children:f.jsxRuntimeExports.jsx(ce.SkeletonInstance,{width:"100%",height:"1.3em"})})}):null]})}function de({isLoading:n,shouldFilterOptions:d=!0,label:V,options:o,error:k,warning:j,information:w,footnote:m,className:I,onChange:u,onSelect:b,...a}){const r=e.useRef(null),H=e.useId(),P=e.useId(),[R,K]=e.useState(!1),$=e.useCallback(()=>{K(!0)},[]),G=e.useCallback(t=>{var s;(s=r.current)!=null&&s.contains(t.relatedTarget)||K(!1)},[]),[E,i]=e.useState(!1);e.useEffect(()=>{i(R)},[R]),e.useEffect(()=>{var s;if(!E)return;const t=(s=r.current)==null?void 0:s.control;return()=>{t==null||t.scrollIntoView({behavior:"smooth",block:"nearest"})}},[E]);const[A,y]=e.useState(""),{value:p}=a,[v,O]=e.useState(p),[C,J]=e.useState(p),z=e.useRef(C),l=e.useCallback(t=>{J(t),z.current=t},[]);e.useEffect(()=>{O(p),l(p)},[p,l]),e.useEffect(()=>{if(p===void 0)return;const t=o.find(s=>s.value===p);t&&y(q(t))},[o,p]),e.useEffect(()=>{p===void 0&&y("")},[p]);const Q=e.useCallback(()=>{v&&(y(""),l(void 0))},[v,l]),W=e.useCallback((t,s)=>{y(t),u==null||u(t,s),i(!0),O(void 0)},[u]),Z=e.useCallback(t=>{var s;(s=r.current)!=null&&s.contains(t.target)&&i(!0)},[]),g=e.useCallback(t=>{const s=t==null?void 0:t.value;l(s),t?y(q(t)):(y(""),u==null||u("")),b==null||b(s)},[l,u,b]),ee=e.useCallback(t=>{const s=o.find(N=>N.value===t);g(s),O(t),i(!1)},[o,g]),te=e.useCallback(t=>{l(t)},[l]),M=e.useDeferredValue(A),x=e.useMemo(()=>!d||v?o:oe.default(M,o,q),[d,v,o,M]);e.useEffect(()=>{!v&&M.length>0&&x.length>0&&!x.some(t=>C===t.value)&&l(x[0].value)},[v,M,x,C,l]);const{setIsKeyboardNavigating:S}=F();return e.useEffect(()=>{if(R)return ue(t=>{t.movementX===0&&t.movementY===0||S(!1)})},[R,S]),e.useEffect(()=>{if(R)return ie(t=>{var U;let s;const N=x.length,L=x.findIndex(c=>c.value===z.current),h=()=>{t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()};switch(t.key){case"Enter":{const c=x[L];c&&(h(),S(!0),i(!1),g(c),O(c.value));break}case"Escape":{if(E)h(),v?l(void 0):g(void 0),i(!1);else if(v)h(),i(!0),g(void 0);else{h(),K(!1);const c=document.activeElement;c instanceof HTMLElement&&((U=r.current)!=null&&U.contains(c))&&c.blur()}return}case"ArrowDown":{h(),E&&(s=L+1),i(!0);break}case"ArrowUp":{h(),E&&(s=L-1,s<0&&(s=N-1)),i(!0);break}case"Home":{i(!0),s=0;break}case"End":{i(!0),s=N-1;break}case"Backspace":{x.some(c=>c.value===v)&&(h(),g(void 0),i(!0));break}}if(s!==void 0&&(h(),S(!0),N>0)){const c=x[s%N];c&&l(c.value)}})},[R,x,S,i,g,O,E,v,l]),f.jsxRuntimeExports.jsx(ae.default,{...a,ref:r,role:"combobox",autoComplete:"off","aria-controls":H,"aria-expanded":E,"aria-activedescendant":E?P:void 0,label:V,value:A,error:k,warning:j,information:w,footnote:m,attachments:E?f.jsxRuntimeExports.jsx(fe,{isLoading:n,id:H,activeOptionId:P,selectedValue:C,options:x,onSelect:ee,onHover:te}):null,className:_.cx(I,"kakadu-components-1230689972"),onMouseDown:Z,onChange:W,onBeforeInput:Q,onFocus:$,onBlur:G,children:f.jsxRuntimeExports.jsx(re.default,{width:14,height:14,className:"kakadu-components-158931186"})})}exports.default=de;exports.getComboboxOptionString=q;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as l } from "../jsx-runtime-z6PQ6F3d.mjs";
|
|
2
|
-
import { useRef as L, useId as Q, useState as S, useCallback as d, useEffect as
|
|
2
|
+
import { useRef as L, useId as Q, useState as S, useCallback as d, useEffect as x, useDeferredValue as ce, useMemo as Z, useLayoutEffect as ie } from "react";
|
|
3
3
|
import { cx as T } from "@kuma-ui/core";
|
|
4
4
|
import ue from "../hooks/use-synchronized-value.mjs";
|
|
5
5
|
import le from "../icons/icon.mjs";
|
|
@@ -10,43 +10,43 @@ import fe from "./input.mjs";
|
|
|
10
10
|
import { Span as P } from "./text.mjs";
|
|
11
11
|
import W from "./flex.mjs";
|
|
12
12
|
import { SkeletonInstance as ve } from "./skeleton.mjs";
|
|
13
|
-
const pe = _((
|
|
14
|
-
window.addEventListener("mousemove",
|
|
13
|
+
const pe = _((r) => {
|
|
14
|
+
window.addEventListener("mousemove", r, {
|
|
15
15
|
capture: !0
|
|
16
16
|
});
|
|
17
|
-
}, (
|
|
18
|
-
window.removeEventListener("mousemove",
|
|
17
|
+
}, (r) => {
|
|
18
|
+
window.removeEventListener("mousemove", r, {
|
|
19
19
|
capture: !0
|
|
20
20
|
});
|
|
21
|
-
}), be = _((
|
|
22
|
-
window.addEventListener("keydown",
|
|
21
|
+
}), be = _((r) => {
|
|
22
|
+
window.addEventListener("keydown", r, {
|
|
23
23
|
capture: !0
|
|
24
24
|
});
|
|
25
|
-
}, (
|
|
26
|
-
window.removeEventListener("keydown",
|
|
25
|
+
}, (r) => {
|
|
26
|
+
window.removeEventListener("keydown", r, {
|
|
27
27
|
capture: !0
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
function X() {
|
|
31
31
|
const {
|
|
32
|
-
value:
|
|
32
|
+
value: r,
|
|
33
33
|
setValue: m
|
|
34
34
|
} = ue("isKeyboardNavigating");
|
|
35
35
|
return Z(() => ({
|
|
36
|
-
isKeyboardNavigating:
|
|
36
|
+
isKeyboardNavigating: r,
|
|
37
37
|
setIsKeyboardNavigating: m
|
|
38
|
-
}), [
|
|
38
|
+
}), [r, m]);
|
|
39
39
|
}
|
|
40
|
-
function F(
|
|
41
|
-
return "text" in
|
|
40
|
+
function F(r) {
|
|
41
|
+
return "text" in r ? r.text : r.label;
|
|
42
42
|
}
|
|
43
43
|
const z = "kakadu-components-1144794361", U = "kakadu-components-2911184744";
|
|
44
44
|
function ke({
|
|
45
|
-
ref:
|
|
45
|
+
ref: r,
|
|
46
46
|
isSelected: m,
|
|
47
47
|
id: K,
|
|
48
48
|
value: o,
|
|
49
|
-
label:
|
|
49
|
+
label: h,
|
|
50
50
|
onSelect: y,
|
|
51
51
|
onHover: N
|
|
52
52
|
}) {
|
|
@@ -54,13 +54,13 @@ function ke({
|
|
|
54
54
|
isKeyboardNavigating: f
|
|
55
55
|
} = X(), V = d(() => {
|
|
56
56
|
y(o);
|
|
57
|
-
}, [y, o]), c = d((
|
|
58
|
-
f ||
|
|
57
|
+
}, [y, o]), c = d((n) => {
|
|
58
|
+
f || n.movementX === 0 && n.movementY === 0 || N(o);
|
|
59
59
|
}, [f, N, o]), p = L(null);
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
m &&
|
|
63
|
-
|
|
60
|
+
x(() => {
|
|
61
|
+
const n = p.current;
|
|
62
|
+
m && n && f && setTimeout(() => {
|
|
63
|
+
n.scrollIntoView({
|
|
64
64
|
behavior: "smooth",
|
|
65
65
|
block: "nearest"
|
|
66
66
|
});
|
|
@@ -68,24 +68,24 @@ function ke({
|
|
|
68
68
|
}, [m, f]);
|
|
69
69
|
const s = d(
|
|
70
70
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
71
|
-
(
|
|
72
|
-
p.current =
|
|
71
|
+
(n) => {
|
|
72
|
+
p.current = n, r && (r.current = n);
|
|
73
73
|
},
|
|
74
|
-
[
|
|
74
|
+
[r]
|
|
75
75
|
);
|
|
76
|
-
return /* @__PURE__ */ l.jsx("li", { ref: s, id: K, role: "option", "aria-selected": m, tabIndex: -1, className: T(z, "kakadu-components-4130497639", f ? "kakadu-components-962373561" : "kakadu-components-1109598791"), onClick: V, onMouseMove: c, children: /* @__PURE__ */ l.jsx(P, { className: T(U, typeof
|
|
76
|
+
return /* @__PURE__ */ l.jsx("li", { ref: s, id: K, role: "option", "aria-selected": m, tabIndex: -1, className: T(z, "kakadu-components-4130497639", f ? "kakadu-components-962373561" : "kakadu-components-1109598791"), onClick: V, onMouseMove: c, children: /* @__PURE__ */ l.jsx(P, { className: T(U, typeof h == "string" && "kakadu-components-154286052"), children: h }) });
|
|
77
77
|
}
|
|
78
78
|
function xe({
|
|
79
|
-
isLoading:
|
|
79
|
+
isLoading: r,
|
|
80
80
|
id: m,
|
|
81
81
|
activeOptionId: K,
|
|
82
82
|
selectedValue: o,
|
|
83
|
-
options:
|
|
83
|
+
options: h,
|
|
84
84
|
onSelect: y,
|
|
85
85
|
onHover: N
|
|
86
86
|
}) {
|
|
87
87
|
const f = L(null);
|
|
88
|
-
|
|
88
|
+
x(() => {
|
|
89
89
|
const s = f.current;
|
|
90
90
|
s && s.scrollIntoView({
|
|
91
91
|
behavior: "smooth",
|
|
@@ -97,11 +97,11 @@ function xe({
|
|
|
97
97
|
} = X(), p = L(c);
|
|
98
98
|
return p.current = c, ie(() => {
|
|
99
99
|
const s = f.current;
|
|
100
|
-
if (s &&
|
|
100
|
+
if (s && h.length > 0) {
|
|
101
101
|
if (p.current) {
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
|
|
102
|
+
const n = V.current;
|
|
103
|
+
if (n) {
|
|
104
|
+
n.scrollIntoView({
|
|
105
105
|
block: "nearest"
|
|
106
106
|
});
|
|
107
107
|
return;
|
|
@@ -111,11 +111,11 @@ function xe({
|
|
|
111
111
|
top: 0
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
}, [
|
|
115
|
-
|
|
114
|
+
}, [h]), /* @__PURE__ */ l.jsxs("ul", { ref: f, id: m, role: "listbox", "aria-label": "Options", tabIndex: -1, className: "kakadu-components-3718330689", children: [
|
|
115
|
+
h.length === 0 ? r ? null : /* @__PURE__ */ l.jsxs(W, { "aria-atomic": !0, as: "li", role: "status", "aria-live": "polite", direction: "row", preset: "start", gap: 0.5, className: z, children: [
|
|
116
116
|
/* @__PURE__ */ l.jsx(le, { size: 15, type: "exclamationTriangle" }),
|
|
117
117
|
/* @__PURE__ */ l.jsx(P, { className: U, children: "No results." })
|
|
118
|
-
] }) :
|
|
118
|
+
] }) : h.map((s, n) => /* @__PURE__ */ l.jsx(
|
|
119
119
|
ke,
|
|
120
120
|
{
|
|
121
121
|
...s,
|
|
@@ -125,17 +125,17 @@ function xe({
|
|
|
125
125
|
onSelect: y,
|
|
126
126
|
onHover: N
|
|
127
127
|
},
|
|
128
|
-
F(s) +
|
|
128
|
+
F(s) + n
|
|
129
129
|
)),
|
|
130
|
-
|
|
130
|
+
r ? /* @__PURE__ */ l.jsx(W, { as: "li", alignment: "center", className: z, children: /* @__PURE__ */ l.jsx(P, { className: T(U, "kakadu-components-2015848015"), children: /* @__PURE__ */ l.jsx(ve, { width: "100%", height: "1.3em" }) }) }) : null
|
|
131
131
|
] });
|
|
132
132
|
}
|
|
133
133
|
function Me({
|
|
134
|
-
isLoading:
|
|
134
|
+
isLoading: r,
|
|
135
135
|
shouldFilterOptions: m = !0,
|
|
136
136
|
label: K,
|
|
137
137
|
options: o,
|
|
138
|
-
error:
|
|
138
|
+
error: h,
|
|
139
139
|
warning: y,
|
|
140
140
|
information: N,
|
|
141
141
|
footnote: f,
|
|
@@ -144,110 +144,121 @@ function Me({
|
|
|
144
144
|
onSelect: p,
|
|
145
145
|
...s
|
|
146
146
|
}) {
|
|
147
|
-
const
|
|
147
|
+
const n = L(null), Y = Q(), q = Q(), [j, H] = S(!1), $ = d(() => {
|
|
148
148
|
H(!0);
|
|
149
149
|
}, []), ee = d((e) => {
|
|
150
|
-
var
|
|
151
|
-
(
|
|
152
|
-
}, []), [
|
|
153
|
-
|
|
150
|
+
var t;
|
|
151
|
+
(t = n.current) != null && t.contains(e.relatedTarget) || H(!1);
|
|
152
|
+
}, []), [g, i] = S(!1);
|
|
153
|
+
x(() => {
|
|
154
154
|
i(j);
|
|
155
|
-
}, [j])
|
|
155
|
+
}, [j]), x(() => {
|
|
156
|
+
var t;
|
|
157
|
+
if (!g)
|
|
158
|
+
return;
|
|
159
|
+
const e = (t = n.current) == null ? void 0 : t.control;
|
|
160
|
+
return () => {
|
|
161
|
+
e == null || e.scrollIntoView({
|
|
162
|
+
behavior: "smooth",
|
|
163
|
+
block: "nearest"
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
}, [g]);
|
|
156
167
|
const [C, E] = S(""), {
|
|
157
168
|
value: b
|
|
158
169
|
} = s, [k, M] = S(b), [B, te] = S(b), G = L(B), u = d((e) => {
|
|
159
170
|
te(e), G.current = e;
|
|
160
171
|
}, []);
|
|
161
|
-
|
|
172
|
+
x(() => {
|
|
162
173
|
M(b), u(b);
|
|
163
|
-
}, [b, u]),
|
|
174
|
+
}, [b, u]), x(() => {
|
|
164
175
|
if (b === void 0)
|
|
165
176
|
return;
|
|
166
|
-
const e = o.find((
|
|
177
|
+
const e = o.find((t) => t.value === b);
|
|
167
178
|
e && E(F(e));
|
|
168
|
-
}, [o, b]),
|
|
179
|
+
}, [o, b]), x(() => {
|
|
169
180
|
b === void 0 && E("");
|
|
170
181
|
}, [b]);
|
|
171
|
-
const
|
|
182
|
+
const re = d(() => {
|
|
172
183
|
k && (E(""), u(void 0));
|
|
173
|
-
}, [k, u]),
|
|
174
|
-
E(e), c == null || c(e,
|
|
184
|
+
}, [k, u]), ne = d((e, t) => {
|
|
185
|
+
E(e), c == null || c(e, t), i(!0), M(void 0);
|
|
175
186
|
}, [c]), oe = d((e) => {
|
|
176
|
-
var
|
|
177
|
-
(
|
|
187
|
+
var t;
|
|
188
|
+
(t = n.current) != null && t.contains(e.target) && i(!0);
|
|
178
189
|
}, []), I = d((e) => {
|
|
179
|
-
const
|
|
180
|
-
u(
|
|
190
|
+
const t = e == null ? void 0 : e.value;
|
|
191
|
+
u(t), e ? E(F(e)) : (E(""), c == null || c("")), p == null || p(t);
|
|
181
192
|
}, [u, c, p]), se = d((e) => {
|
|
182
|
-
const
|
|
183
|
-
I(
|
|
193
|
+
const t = o.find((O) => O.value === e);
|
|
194
|
+
I(t), M(e), i(!1);
|
|
184
195
|
}, [o, I]), ae = d((e) => {
|
|
185
196
|
u(e);
|
|
186
197
|
}, [u]), D = ce(C), v = Z(() => !m || k ? o : me(D, o, F), [m, k, o, D]);
|
|
187
|
-
|
|
198
|
+
x(() => {
|
|
188
199
|
!k && D.length > 0 && v.length > 0 && !v.some((e) => B === e.value) && u(v[0].value);
|
|
189
200
|
}, [k, D, v, B, u]);
|
|
190
201
|
const {
|
|
191
202
|
setIsKeyboardNavigating: R
|
|
192
203
|
} = X();
|
|
193
|
-
return
|
|
204
|
+
return x(() => {
|
|
194
205
|
if (j)
|
|
195
206
|
return pe((e) => {
|
|
196
207
|
e.movementX === 0 && e.movementY === 0 || R(!1);
|
|
197
208
|
});
|
|
198
|
-
}, [j, R]),
|
|
209
|
+
}, [j, R]), x(() => {
|
|
199
210
|
if (j)
|
|
200
211
|
return be((e) => {
|
|
201
212
|
var J;
|
|
202
|
-
let
|
|
203
|
-
const O = v.length, A = v.findIndex((a) => a.value === G.current),
|
|
213
|
+
let t;
|
|
214
|
+
const O = v.length, A = v.findIndex((a) => a.value === G.current), w = () => {
|
|
204
215
|
e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation();
|
|
205
216
|
};
|
|
206
217
|
switch (e.key) {
|
|
207
218
|
case "Enter": {
|
|
208
219
|
const a = v[A];
|
|
209
|
-
a && (
|
|
220
|
+
a && (w(), R(!0), i(!1), I(a), M(a.value));
|
|
210
221
|
break;
|
|
211
222
|
}
|
|
212
223
|
case "Escape": {
|
|
213
|
-
if (
|
|
214
|
-
|
|
224
|
+
if (g)
|
|
225
|
+
w(), k ? u(void 0) : I(void 0), i(!1);
|
|
215
226
|
else if (k)
|
|
216
|
-
|
|
227
|
+
w(), i(!0), I(void 0);
|
|
217
228
|
else {
|
|
218
|
-
|
|
229
|
+
w(), H(!1);
|
|
219
230
|
const a = document.activeElement;
|
|
220
|
-
a instanceof HTMLElement && ((J =
|
|
231
|
+
a instanceof HTMLElement && ((J = n.current) != null && J.contains(a)) && a.blur();
|
|
221
232
|
}
|
|
222
233
|
return;
|
|
223
234
|
}
|
|
224
235
|
case "ArrowDown": {
|
|
225
|
-
|
|
236
|
+
w(), g && (t = A + 1), i(!0);
|
|
226
237
|
break;
|
|
227
238
|
}
|
|
228
239
|
case "ArrowUp": {
|
|
229
|
-
|
|
240
|
+
w(), g && (t = A - 1, t < 0 && (t = O - 1)), i(!0);
|
|
230
241
|
break;
|
|
231
242
|
}
|
|
232
243
|
case "Home": {
|
|
233
|
-
i(!0),
|
|
244
|
+
i(!0), t = 0;
|
|
234
245
|
break;
|
|
235
246
|
}
|
|
236
247
|
case "End": {
|
|
237
|
-
i(!0),
|
|
248
|
+
i(!0), t = O - 1;
|
|
238
249
|
break;
|
|
239
250
|
}
|
|
240
251
|
case "Backspace": {
|
|
241
|
-
v.some((a) => a.value === k) && (
|
|
252
|
+
v.some((a) => a.value === k) && (w(), I(void 0), i(!0));
|
|
242
253
|
break;
|
|
243
254
|
}
|
|
244
255
|
}
|
|
245
|
-
if (
|
|
246
|
-
const a = v[
|
|
256
|
+
if (t !== void 0 && (w(), R(!0), O > 0)) {
|
|
257
|
+
const a = v[t % O];
|
|
247
258
|
a && u(a.value);
|
|
248
259
|
}
|
|
249
260
|
});
|
|
250
|
-
}, [j, v, R, i, I, M,
|
|
261
|
+
}, [j, v, R, i, I, M, g, k, u]), /* @__PURE__ */ l.jsx(fe, { ...s, ref: n, role: "combobox", autoComplete: "off", "aria-controls": Y, "aria-expanded": g, "aria-activedescendant": g ? q : void 0, label: K, value: C, error: h, warning: y, information: N, footnote: f, attachments: g ? /* @__PURE__ */ l.jsx(xe, { isLoading: r, id: Y, activeOptionId: q, selectedValue: B, options: v, onSelect: se, onHover: ae }) : null, className: T(V, "kakadu-components-1230689972"), onMouseDown: oe, onChange: ne, onBeforeInput: re, onFocus: $, onBlur: ee, children: /* @__PURE__ */ l.jsx(de, { width: 14, height: 14, className: "kakadu-components-158931186" }) });
|
|
251
262
|
}
|
|
252
263
|
export {
|
|
253
264
|
Me as default,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-CZa898vN.js"),t=require("react"),o=require("@kuma-ui/core"),d=require("../icons/icon.js"),p=require("../theme.js"),D=require("./theme-setter.js"),c=require("./button.js"),z=require("./button-tooltip.js"),A=require("./click-ripples.js"),E=require("./hover-gradient.js"),C=require("./skeleton.js"),M=require("./atom.js"),O=["default","success","warning","danger"];function V({ref:b,icon:s,variant:u="default",label:f,tooltipPosition:g,href:k,target:q,rel:w,disabled:_,isLoading:h,isSkeleton:r,isSkeletonAnimated:v=!0,className:B,...I}){const j=t.useId(),N=D.useIsDarkTheme(),n=k!==void 0&&!r,[a,T]=t.useState(s),[R,m]=t.useState(!1),S=t.useRef(s),i=t.useRef(null);t.useEffect(()=>{S.current=s},[s]);const l=t.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]);t.useEffect(()=>{if(a===s){m(y=>y&&!1);return}m(!0),l(),i.current=setTimeout(()=>{m(!1),T(S.current)},370)},[a,s,l]),t.useEffect(()=>()=>{l()},[l]);const x=!!_||!!h||!!r;return e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-4096632152",children:[e.jsxRuntimeExports.jsxs(M.default,{...I,reference:b,as:n?"a":"button",type:n?void 0:"button",href:n?k:void 0,target:n?q:void 0,rel:n?w:void 0,"aria-label":f,"aria-describedby":j,disabled:n?void 0:x,inert:n?x:void 0,className:o.cx(p.buttonResetStyles,p.effectStyles,p.overlayEffectStyles,"kakadu-components-4200638658",u==="default"&&o.cx(c.buttonSecondaryStyles,"kakadu-components-1561784812"),u==="success"&&o.cx(c.buttonSuccessStyles,"kakadu-components-1398421429"),u==="warning"&&o.cx(c.buttonWarningStyles,"kakadu-components-1872098090"),u==="danger"&&o.cx(c.buttonDangerStyles,"kakadu-components-2064536093"),r&&"kakadu-components-2662775151",B),children:[e.jsxRuntimeExports.jsxs("span",{"data-theme":u==="default"?N?"dark":"light":"dark",className:"kakadu-components-3040141419",children:[e.jsxRuntimeExports.jsx(d.default,{width:16,height:16,type:a,className:o.cx(d.iconShadowStyles,"kakadu-components-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-CZa898vN.js"),t=require("react"),o=require("@kuma-ui/core"),d=require("../icons/icon.js"),p=require("../theme.js"),D=require("./theme-setter.js"),c=require("./button.js"),z=require("./button-tooltip.js"),A=require("./click-ripples.js"),E=require("./hover-gradient.js"),C=require("./skeleton.js"),M=require("./atom.js"),O=["default","success","warning","danger"];function V({ref:b,icon:s,variant:u="default",label:f,tooltipPosition:g,href:k,target:q,rel:w,disabled:_,isLoading:h,isSkeleton:r,isSkeletonAnimated:v=!0,className:B,...I}){const j=t.useId(),N=D.useIsDarkTheme(),n=k!==void 0&&!r,[a,T]=t.useState(s),[R,m]=t.useState(!1),S=t.useRef(s),i=t.useRef(null);t.useEffect(()=>{S.current=s},[s]);const l=t.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]);t.useEffect(()=>{if(a===s){m(y=>y&&!1);return}m(!0),l(),i.current=setTimeout(()=>{m(!1),T(S.current)},370)},[a,s,l]),t.useEffect(()=>()=>{l()},[l]);const x=!!_||!!h||!!r;return e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-4096632152",children:[e.jsxRuntimeExports.jsxs(M.default,{...I,reference:b,as:n?"a":"button",type:n?void 0:"button",href:n?k:void 0,target:n?q:void 0,rel:n?w:void 0,"aria-label":f,"aria-describedby":j,disabled:n?void 0:x,inert:n?x:void 0,className:o.cx(p.buttonResetStyles,p.effectStyles,p.overlayEffectStyles,"kakadu-components-4200638658",u==="default"&&o.cx(c.buttonSecondaryStyles,"kakadu-components-1561784812"),u==="success"&&o.cx(c.buttonSuccessStyles,"kakadu-components-1398421429"),u==="warning"&&o.cx(c.buttonWarningStyles,"kakadu-components-1872098090"),u==="danger"&&o.cx(c.buttonDangerStyles,"kakadu-components-2064536093"),r&&"kakadu-components-2662775151",B),children:[e.jsxRuntimeExports.jsxs("span",{"data-theme":u==="default"?N?"dark":"light":"dark",className:"kakadu-components-3040141419",children:[e.jsxRuntimeExports.jsx(d.default,{width:16,height:16,type:a,className:o.cx(d.iconShadowStyles,"kakadu-components-4212103964",R&&"kakadu-components-2360250719")}),a===s?null:e.jsxRuntimeExports.jsx(d.default,{width:16,height:16,type:s,className:o.cx(d.iconShadowStyles,"kakadu-components-1224061930",R&&"kakadu-components-2519520784")})]}),e.jsxRuntimeExports.jsx(c.ButtonLoader,{isLoading:h,size:14}),e.jsxRuntimeExports.jsx(z.default,{id:j,label:f,position:g}),x?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(A.default,{size:50}),e.jsxRuntimeExports.jsx(E.default,{size:50,className:u==="default"?E.normalBlendStyles:void 0})]})]}),r?e.jsxRuntimeExports.jsx("div",{className:"kakadu-components-3422055155",children:e.jsxRuntimeExports.jsx(C.SkeletonInstance,{width:"100%",height:"100%",isAnimated:v})}):null]})}exports.default=V;exports.iconButtonVariants=O;
|
|
@@ -49,7 +49,7 @@ function ie({
|
|
|
49
49
|
return /* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-4096632152", children: [
|
|
50
50
|
/* @__PURE__ */ e.jsxs(X, { ...D, reference: w, as: s ? "a" : "button", type: s ? void 0 : "button", href: s ? p : void 0, target: s ? I : void 0, rel: s ? v : void 0, "aria-label": d, "aria-describedby": k, disabled: s ? void 0 : l, inert: s ? l : void 0, className: o(F, G, H, "kakadu-components-4200638658", n === "default" && o(W, "kakadu-components-1561784812"), n === "success" && o(q, "kakadu-components-1398421429"), n === "warning" && o(J, "kakadu-components-1872098090"), n === "danger" && o(K, "kakadu-components-2064536093"), a && "kakadu-components-2662775151", T), children: [
|
|
51
51
|
/* @__PURE__ */ e.jsxs("span", { "data-theme": n === "default" ? z ? "dark" : "light" : "dark", className: "kakadu-components-3040141419", children: [
|
|
52
|
-
/* @__PURE__ */ e.jsx(S, { width: 16, height: 16, type: r, className: o(b, "kakadu-components-
|
|
52
|
+
/* @__PURE__ */ e.jsx(S, { width: 16, height: 16, type: r, className: o(b, "kakadu-components-4212103964", h && "kakadu-components-2360250719") }),
|
|
53
53
|
r === t ? null : /* @__PURE__ */ e.jsx(S, { width: 16, height: 16, type: t, className: o(b, "kakadu-components-1224061930", h && "kakadu-components-2519520784") })
|
|
54
54
|
] }),
|
|
55
55
|
/* @__PURE__ */ e.jsx(V, { isLoading: f, size: 14 }),
|
package/build/components/text.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("../jsx-runtime-CZa898vN.js"),a=require("@kuma-ui/core"),j=require("../theme.js"),c=require("./atom.js"),r="kakadu-components-1538322784",x="kakadu-components-739732526",m="h1";function l({reference:t,as:e,className:n,...o}){return s.jsxRuntimeExports.jsx(c.default,{reference:t,as:e??m,...o,className:a.cx(j.overflowProtectionStyles,r,"kakadu-components-3658929198",x,n)})}function f({as:t,id:e,children:n,className:o,...k}){return s.jsxRuntimeExports.jsx(l,{as:t??"h1",id:e,...k,className:a.cx(o),children:s.jsxRuntimeExports.jsx("a",{href:`#${e}`,className:"kakadu-components-1038708690",children:n})})}const u=a.cx("kakadu-components-162258071",x);function p({as:t,className:e,...n}){return s.jsxRuntimeExports.jsx(c.default,{as:t??"span",...n,className:a.cx(u,e)})}function i({as:t,className:e,...n}){return s.jsxRuntimeExports.jsx(c.default,{as:t??"p",...n,className:a.cx(u,"kakadu-components-3547863283",e)})}function S({as:t,className:e,...n}){return s.jsxRuntimeExports.jsx(i,{as:t??"small",...n,className:a.cx("kakadu-components-1696055534",e)})}function g({as:t,className:e,...n}){return s.jsxRuntimeExports.jsx(p,{as:t??"span",...n,className:a.cx("kakadu-components-1329768068",e)})}function d({as:t,width:e="text",className:n,...o}){return s.jsxRuntimeExports.jsx(c.default,{as:t??"div",...o,className:a.cx("kakadu-components-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("../jsx-runtime-CZa898vN.js"),a=require("@kuma-ui/core"),j=require("../theme.js"),c=require("./atom.js"),r="kakadu-components-1538322784",x="kakadu-components-739732526",m="h1";function l({reference:t,as:e,className:n,...o}){return s.jsxRuntimeExports.jsx(c.default,{reference:t,as:e??m,...o,className:a.cx(j.overflowProtectionStyles,r,"kakadu-components-3658929198",x,n)})}function f({as:t,id:e,children:n,className:o,...k}){return s.jsxRuntimeExports.jsx(l,{as:t??"h1",id:e,...k,className:a.cx(o),children:s.jsxRuntimeExports.jsx("a",{href:`#${e}`,className:"kakadu-components-1038708690",children:n})})}const u=a.cx("kakadu-components-162258071",x);function p({as:t,className:e,...n}){return s.jsxRuntimeExports.jsx(c.default,{as:t??"span",...n,className:a.cx(u,e)})}function i({as:t,className:e,...n}){return s.jsxRuntimeExports.jsx(c.default,{as:t??"p",...n,className:a.cx(u,"kakadu-components-3547863283",e)})}function S({as:t,className:e,...n}){return s.jsxRuntimeExports.jsx(i,{as:t??"small",...n,className:a.cx("kakadu-components-1696055534",e)})}function g({as:t,className:e,...n}){return s.jsxRuntimeExports.jsx(p,{as:t??"span",...n,className:a.cx("kakadu-components-1329768068",e)})}function d({as:t,width:e="text",className:n,...o}){return s.jsxRuntimeExports.jsx(c.default,{as:t??"div",...o,className:a.cx("kakadu-components-3670692279",e==="wide"&&"kakadu-components-81067145",e==="page"&&"kakadu-components-2433581593",e==="text"&&"kakadu-components-958855245",e==="content"&&"kakadu-components-797764377",n)})}function E(t){const{className:e}=t;return s.jsxRuntimeExports.jsx(d,{...t,className:a.cx("kakadu-components-3757870586",e)})}exports.AnchorHeading=f;exports.Footnote=S;exports.Heading=l;exports.Hero=E;exports.Label=g;exports.Paragraph=i;exports.Span=p;exports.default=d;exports.defaultHeadingElementType=m;exports.spanStyles=u;exports.textShadowStyles=r;
|
|
@@ -55,7 +55,7 @@ function f({
|
|
|
55
55
|
className: s,
|
|
56
56
|
...e
|
|
57
57
|
}) {
|
|
58
|
-
return /* @__PURE__ */ o.jsx(c, { as: n ?? "div", ...e, className: t("kakadu-components-
|
|
58
|
+
return /* @__PURE__ */ o.jsx(c, { as: n ?? "div", ...e, className: t("kakadu-components-3670692279", a === "wide" && "kakadu-components-81067145", a === "page" && "kakadu-components-2433581593", a === "text" && "kakadu-components-958855245", a === "content" && "kakadu-components-797764377", s) });
|
|
59
59
|
}
|
|
60
60
|
function v(n) {
|
|
61
61
|
const {
|