@kakadu/components 6.13.2 → 6.14.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/build/components/checkbox.d.ts +1 -1
- package/build/components/checkbox.js +1 -1
- package/build/components/checkbox.mjs +58 -57
- package/build/components/combobox.js +1 -1
- package/build/components/combobox.mjs +82 -82
- package/build/components/input.d.ts +4 -2
- package/build/components/input.js +2 -2
- package/build/components/input.mjs +45 -44
- package/build/components/select.d.ts +1 -1
- package/build/components/select.js +1 -1
- package/build/components/select.mjs +18 -17
- package/build/components.css +1 -1
- package/package.json +1 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { j as e } from "../jsx-runtime-z6PQ6F3d.mjs";
|
|
2
|
-
import { useRef as P, useId as
|
|
2
|
+
import { useRef as P, useId as he, useState as T, useLayoutEffect as xe, useMemo as H, useEffect as je, useCallback as h } from "react";
|
|
3
3
|
import { cx as o } from "@kuma-ui/core";
|
|
4
4
|
import _ from "../utilities/copy-to-clipboard.mjs";
|
|
5
|
-
import { buttonResetStyles as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import { buttonResetStyles as be, overflowProtectionStyles as te } from "../theme.mjs";
|
|
6
|
+
import ye from "../icons/sparkle.mjs";
|
|
7
|
+
import ge from "./button-tooltip.mjs";
|
|
8
8
|
import R from "./text-button.mjs";
|
|
9
9
|
import { Span as F, Paragraph as A } from "./text.mjs";
|
|
10
|
-
import
|
|
10
|
+
import Ne from "./collapsible.mjs";
|
|
11
11
|
import ee from "./click-ripples.mjs";
|
|
12
12
|
import ne from "./hover-gradient.mjs";
|
|
13
|
-
import { useCreateNotification as
|
|
14
|
-
const
|
|
15
|
-
function
|
|
13
|
+
import { useCreateNotification as ve } from "./notification.mjs";
|
|
14
|
+
const Ce = "kakadu-components-922159086", Se = "kakadu-components-25448712", M = "kakadu-components-3308836726", V = "kakadu-components-4056037255", Ee = o(V, "kakadu-components-3245407458"), Ie = o(V, "kakadu-components-1117160492"), Be = o(V, "kakadu-components-821835704");
|
|
15
|
+
function we({
|
|
16
16
|
as: d,
|
|
17
17
|
className: l,
|
|
18
18
|
...m
|
|
19
19
|
}) {
|
|
20
20
|
return /* @__PURE__ */ e.jsx(F, { as: d ?? "span", ...m, className: o("kakadu-components-2675681525", l) });
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function Le({
|
|
23
23
|
label: d,
|
|
24
24
|
error: l,
|
|
25
25
|
errorId: m,
|
|
@@ -34,18 +34,18 @@ function we({
|
|
|
34
34
|
...k
|
|
35
35
|
}) {
|
|
36
36
|
const j = !!l, i = !!c, b = !!r, f = !!a;
|
|
37
|
-
return /* @__PURE__ */ e.jsx("label", { ...k, className: o(
|
|
38
|
-
/* @__PURE__ */ e.jsx(F, { className: o(te,
|
|
37
|
+
return /* @__PURE__ */ e.jsx("label", { ...k, className: o(Ce, p), children: /* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-3146929190", children: [
|
|
38
|
+
/* @__PURE__ */ e.jsx(F, { className: o(te, Se), children: /* @__PURE__ */ e.jsx("span", { children: d }) }),
|
|
39
39
|
/* @__PURE__ */ e.jsxs("span", { className: "kakadu-components-3298764637", children: [
|
|
40
40
|
u,
|
|
41
|
-
f ? /* @__PURE__ */ e.jsx(
|
|
41
|
+
f ? /* @__PURE__ */ e.jsx(we, { children: a }) : null,
|
|
42
42
|
S
|
|
43
43
|
] }),
|
|
44
|
-
j || i || b ? /* @__PURE__ */ e.jsx("div", { className: "kakadu-components-2927674627", children: j ? /* @__PURE__ */ e.jsx(A, { id: m, className:
|
|
44
|
+
j || i || b ? /* @__PURE__ */ e.jsx("div", { className: "kakadu-components-2927674627", children: j ? /* @__PURE__ */ e.jsx(A, { id: m, className: Ee, children: l instanceof Error ? l.message : l }) : i ? /* @__PURE__ */ e.jsx(A, { id: x, className: Ie, children: c instanceof Error ? c.message : c }) : b ? /* @__PURE__ */ e.jsx(A, { id: C, className: Be, children: r instanceof Error ? r.message : r }) : null }) : null
|
|
45
45
|
] }) });
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
function
|
|
47
|
+
const Pe = 40, $ = "kakadu-components-4233741488";
|
|
48
|
+
function Ue({
|
|
49
49
|
ref: d,
|
|
50
50
|
type: l,
|
|
51
51
|
label: m,
|
|
@@ -62,18 +62,19 @@ function Ge({
|
|
|
62
62
|
onChange: i,
|
|
63
63
|
children: b,
|
|
64
64
|
className: f,
|
|
65
|
+
labelClassName: ae,
|
|
65
66
|
...y
|
|
66
67
|
}) {
|
|
67
|
-
const O = P(null), W = P(null), E = P(null), z =
|
|
68
|
+
const O = P(null), W = P(null), E = P(null), z = ve(), I = he(), D = `${I}-error`, G = `${I}-warning`, U = `${I}-information`, {
|
|
68
69
|
value: g,
|
|
69
|
-
disabled:
|
|
70
|
-
} = y, [
|
|
71
|
-
|
|
72
|
-
typeof s == "string" && E.current &&
|
|
70
|
+
disabled: se
|
|
71
|
+
} = y, [oe, q] = T(""), s = g ?? oe, [le, ce] = T(), re = l === "textarea" || !!j;
|
|
72
|
+
xe(() => {
|
|
73
|
+
typeof s == "string" && E.current && ce(E.current.scrollHeight);
|
|
73
74
|
}, [s]);
|
|
74
75
|
const B = H(() => typeof s == "string" ? `${s} `.split(`
|
|
75
|
-
`) : [], [s]),
|
|
76
|
-
|
|
76
|
+
`) : [], [s]), ie = H(() => B.length, [B]), N = !!c, w = !N && !!x, L = !!r, J = N ? D : w ? G : L ? U : void 0;
|
|
77
|
+
je(() => {
|
|
77
78
|
q(typeof g == "string" ? g : "");
|
|
78
79
|
}, [g]);
|
|
79
80
|
const K = h((n) => {
|
|
@@ -81,7 +82,7 @@ function Ge({
|
|
|
81
82
|
value: t
|
|
82
83
|
} = n.target;
|
|
83
84
|
q(t), i == null || i(t, n);
|
|
84
|
-
}, [i]),
|
|
85
|
+
}, [i]), de = h(() => {
|
|
85
86
|
typeof s == "string" && (_(s), z({
|
|
86
87
|
type: "success",
|
|
87
88
|
children: "Copied to clipboard."
|
|
@@ -93,55 +94,55 @@ function Ge({
|
|
|
93
94
|
const Z = (Y = Object.getOwnPropertyDescriptor(t instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype, "value")) == null ? void 0 : Y.set;
|
|
94
95
|
if (Z) {
|
|
95
96
|
Z.call(t, n);
|
|
96
|
-
const
|
|
97
|
+
const fe = new Event("input", {
|
|
97
98
|
bubbles: !0
|
|
98
99
|
});
|
|
99
|
-
t.dispatchEvent(
|
|
100
|
+
t.dispatchEvent(fe), t.focus();
|
|
100
101
|
return;
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
throw new Error("Unable to set value.");
|
|
104
|
-
}, []),
|
|
105
|
+
}, []), me = h(() => {
|
|
105
106
|
v("");
|
|
106
|
-
}, [v]), [
|
|
107
|
+
}, [v]), [pe, ue] = T(""), Q = !!a && pe !== a, ke = h(() => {
|
|
107
108
|
if (a) {
|
|
108
109
|
try {
|
|
109
110
|
v(a);
|
|
110
111
|
} catch {
|
|
111
112
|
_(a);
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
+
ue(a);
|
|
114
115
|
}
|
|
115
116
|
}, [a, v]), X = H(() => p.length, [p]);
|
|
116
|
-
return /* @__PURE__ */ e.jsxs(
|
|
117
|
-
/* @__PURE__ */ e.jsx(
|
|
118
|
-
/* @__PURE__ */ e.jsx(
|
|
119
|
-
/* @__PURE__ */ e.jsx(
|
|
117
|
+
return /* @__PURE__ */ e.jsxs(Le, { ref: d, label: m, error: c, errorId: D, warning: x, warningId: G, information: r, informationId: U, footnote: C, attachments: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
118
|
+
/* @__PURE__ */ e.jsx(Ne, { isCollapsed: !Q, children: Q ? /* @__PURE__ */ e.jsxs("button", { type: "button", className: o(be, te, "kakadu-components-4141839293"), onClick: ke, children: [
|
|
119
|
+
/* @__PURE__ */ e.jsx(ge, { label: "Apply suggestion" }),
|
|
120
|
+
/* @__PURE__ */ e.jsx(ye, { width: 13, height: 13, className: "kakadu-components-1417828741" }),
|
|
120
121
|
/* @__PURE__ */ e.jsx(F, { className: "kakadu-components-1384720019", children: a }),
|
|
121
122
|
/* @__PURE__ */ e.jsx(ee, { className: "kakadu-components-2744733744" }),
|
|
122
123
|
/* @__PURE__ */ e.jsx(ne, {})
|
|
123
124
|
] }) : null }),
|
|
124
125
|
S
|
|
125
126
|
] }), style: {
|
|
126
|
-
"--button-padding": `calc(${
|
|
127
|
-
}, children: [
|
|
127
|
+
"--button-padding": `calc(${Pe * ((u ? 1 : 0) + (k ? 1 : 0) + X)}px + 6px)`
|
|
128
|
+
}, className: ae, children: [
|
|
128
129
|
/* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-3146929190", children: [
|
|
129
|
-
|
|
130
|
+
re ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
130
131
|
/* @__PURE__ */ e.jsxs("span", { ref: E, "aria-hidden": !0, className: o(M, f, "kakadu-components-2033521835"), children: [
|
|
131
132
|
B.map((n, t) => (
|
|
132
133
|
// eslint-disable-next-line react/no-array-index-key
|
|
133
134
|
/* @__PURE__ */ e.jsxs("span", { children: [
|
|
134
135
|
n,
|
|
135
|
-
|
|
136
|
+
ie > 1 ? /* @__PURE__ */ e.jsx("br", {}) : null
|
|
136
137
|
] }, t)
|
|
137
138
|
)),
|
|
138
139
|
" "
|
|
139
140
|
] }),
|
|
140
141
|
/* @__PURE__ */ e.jsx("textarea", { ...y, ref: W, rows: y.rows ?? 1, "aria-invalid": N, "data-warning": w, "data-information": L, "aria-describedby": J, value: s, className: o(M, f, "kakadu-components-2119524139"), style: {
|
|
141
|
-
minHeight:
|
|
142
|
+
minHeight: le
|
|
142
143
|
}, onChange: K })
|
|
143
144
|
] }) : /* @__PURE__ */ e.jsx("input", { ...y, ref: O, type: l ?? "text", value: s, "aria-invalid": N, "data-warning": w, "data-information": L, "aria-describedby": J, className: o(M, f), onChange: K }),
|
|
144
|
-
|
|
145
|
+
se ? null : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
145
146
|
/* @__PURE__ */ e.jsx(ee, { className: "kakadu-components-616311160" }),
|
|
146
147
|
/* @__PURE__ */ e.jsx(ne, { className: "kakadu-components-1962999040" })
|
|
147
148
|
] })
|
|
@@ -158,16 +159,16 @@ function Ge({
|
|
|
158
159
|
},
|
|
159
160
|
n.label + t
|
|
160
161
|
)),
|
|
161
|
-
u ? /* @__PURE__ */ e.jsx(R, { iconLeft: "copy", label: "Copy", tooltip: "Copy", className: $, onClick:
|
|
162
|
-
k ? /* @__PURE__ */ e.jsx(R, { iconLeft: "times", label: "Clear", tooltip: "Clear", className: $, onClick:
|
|
162
|
+
u ? /* @__PURE__ */ e.jsx(R, { iconLeft: "copy", label: "Copy", tooltip: "Copy", className: $, onClick: de }) : null,
|
|
163
|
+
k ? /* @__PURE__ */ e.jsx(R, { iconLeft: "times", label: "Clear", tooltip: "Clear", className: $, onClick: me }) : null
|
|
163
164
|
] }) : null,
|
|
164
165
|
b
|
|
165
166
|
] });
|
|
166
167
|
}
|
|
167
168
|
export {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
we as InputAttachment,
|
|
170
|
+
Le as InputLabel,
|
|
171
|
+
Ue as default,
|
|
172
|
+
Ee as errorParagraph,
|
|
172
173
|
M as inputStyles
|
|
173
174
|
};
|
|
@@ -11,4 +11,4 @@ export type SelectProperties<Type extends string = string> = Omit<InputLabelCont
|
|
|
11
11
|
readonly options: Array<SelectOption<Type>>;
|
|
12
12
|
readonly onChange?: (value: Type, event: ChangeEvent<HTMLSelectElement>) => void;
|
|
13
13
|
};
|
|
14
|
-
export default function Select<Type extends string = string>({ label, options, error, warning, information, footnote, className, onChange, ...properties }: SelectProperties<Type>): React.JSX.Element;
|
|
14
|
+
export default function Select<Type extends string = string>({ label, options, error, warning, information, footnote, className, labelClassName, onChange, ...properties }: SelectProperties<Type>): React.JSX.Element;
|
|
@@ -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 s=require("../jsx-runtime-CZa898vN.js"),l=require("react"),S=require("@kuma-ui/core"),B=require("../icons/chevron-up.js"),f=require("./input.js");function _({label:h,options:y,error:i,warning:c,information:d,footnote:E,className:I,labelClassName:q,onChange:t,...x}){const o=l.useId(),m=`${o}-error`,p=`${o}-warning`,j=`${o}-information`,a=!!i,u=!a&&!!c,v=!a&&!u&&!!d,R=a?m:u?p:v?j:void 0,{value:n}=x,[$,b]=l.useState(""),g=n??$;l.useEffect(()=>{b(typeof n=="string"?n:"")},[n]);const k=l.useCallback(e=>{const{value:r}=e.target;b(r),t==null||t(r,e)},[t]);return s.jsxRuntimeExports.jsxs(f.InputLabel,{label:h,error:i,errorId:m,warning:c,warningId:p,information:d,informationId:j,footnote:E,className:q,children:[s.jsxRuntimeExports.jsx("select",{...x,value:g,"aria-invalid":a,"data-warning":u,"data-information":v,"aria-describedby":R,className:S.cx(f.inputStyles,"kakadu-components-1997515934",I),onChange:k,children:y.map((e,r)=>"type"in e?e.type==="separator"?s.jsxRuntimeExports.jsx("hr",{},`separator-${r}`):null:s.jsxRuntimeExports.jsx("option",{value:e.value,disabled:e.disabled,children:e.label},e.value))}),s.jsxRuntimeExports.jsx(B.default,{width:14,height:14,className:"kakadu-components-158931186"})]})}exports.default=_;
|
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
import { j as e } from "../jsx-runtime-z6PQ6F3d.mjs";
|
|
2
|
-
import { useId as
|
|
2
|
+
import { useId as $, useState as w, useEffect as E, useCallback as N } from "react";
|
|
3
3
|
import { cx as V } from "@kuma-ui/core";
|
|
4
|
-
import
|
|
5
|
-
import { InputLabel as
|
|
6
|
-
function
|
|
4
|
+
import L from "../icons/chevron-up.mjs";
|
|
5
|
+
import { InputLabel as R, inputStyles as U } from "./input.mjs";
|
|
6
|
+
function F({
|
|
7
7
|
label: h,
|
|
8
8
|
options: b,
|
|
9
|
-
error:
|
|
10
|
-
warning:
|
|
9
|
+
error: c,
|
|
10
|
+
warning: i,
|
|
11
11
|
information: d,
|
|
12
12
|
footnote: j,
|
|
13
13
|
className: I,
|
|
14
|
-
|
|
14
|
+
labelClassName: y,
|
|
15
|
+
onChange: s,
|
|
15
16
|
...u
|
|
16
17
|
}) {
|
|
17
|
-
const l =
|
|
18
|
+
const l = $(), m = `${l}-error`, f = `${l}-warning`, p = `${l}-information`, t = !!c, o = !t && !!i, v = !t && !o && !!d, k = t ? m : o ? f : v ? p : void 0, {
|
|
18
19
|
value: r
|
|
19
|
-
} = u, [
|
|
20
|
-
|
|
20
|
+
} = u, [g, x] = w(""), B = r ?? g;
|
|
21
|
+
E(() => {
|
|
21
22
|
x(typeof r == "string" ? r : "");
|
|
22
23
|
}, [r]);
|
|
23
|
-
const
|
|
24
|
+
const S = N((a) => {
|
|
24
25
|
const {
|
|
25
26
|
value: n
|
|
26
27
|
} = a.target;
|
|
27
|
-
x(n),
|
|
28
|
-
}, [
|
|
29
|
-
return /* @__PURE__ */ e.jsxs(
|
|
30
|
-
/* @__PURE__ */ e.jsx("select", { ...u, value:
|
|
28
|
+
x(n), s == null || s(n, a);
|
|
29
|
+
}, [s]);
|
|
30
|
+
return /* @__PURE__ */ e.jsxs(R, { label: h, error: c, errorId: m, warning: i, warningId: f, information: d, informationId: p, footnote: j, className: y, children: [
|
|
31
|
+
/* @__PURE__ */ e.jsx("select", { ...u, value: B, "aria-invalid": t, "data-warning": o, "data-information": v, "aria-describedby": k, className: V(U, "kakadu-components-1997515934", I), onChange: S, children: b.map((a, n) => "type" in a ? a.type === "separator" ? (
|
|
31
32
|
// eslint-disable-next-line react/no-array-index-key
|
|
32
33
|
/* @__PURE__ */ e.jsx("hr", {}, `separator-${n}`)
|
|
33
34
|
) : null : /* @__PURE__ */ e.jsx("option", { value: a.value, disabled: a.disabled, children: a.label }, a.value)) }),
|
|
34
|
-
/* @__PURE__ */ e.jsx(
|
|
35
|
+
/* @__PURE__ */ e.jsx(L, { width: 14, height: 14, className: "kakadu-components-158931186" })
|
|
35
36
|
] });
|
|
36
37
|
}
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
+
F as default
|
|
39
40
|
};
|