@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.
@@ -1,25 +1,25 @@
1
1
  import { j as e } from "../jsx-runtime-z6PQ6F3d.mjs";
2
- import { useRef as P, useId as fe, useState as T, useLayoutEffect as he, useMemo as H, useEffect as xe, useCallback as h } from "react";
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 je, overflowProtectionStyles as te } from "../theme.mjs";
6
- import be from "../icons/sparkle.mjs";
7
- import ye from "./button-tooltip.mjs";
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 ge from "./collapsible.mjs";
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 Ne } from "./notification.mjs";
14
- const ve = "kakadu-components-922159086", Ce = "kakadu-components-25448712", M = "kakadu-components-3308836726", V = "kakadu-components-4056037255", Se = o(V, "kakadu-components-3245407458"), Ee = o(V, "kakadu-components-1117160492"), Ie = o(V, "kakadu-components-821835704");
15
- function Be({
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 we({
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(ve, p), children: /* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-3146929190", children: [
38
- /* @__PURE__ */ e.jsx(F, { className: o(te, Ce), children: /* @__PURE__ */ e.jsx("span", { children: d }) }),
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(Be, { children: a }) : null,
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: Se, children: l instanceof Error ? l.message : l }) : i ? /* @__PURE__ */ e.jsx(A, { id: x, className: Ee, children: c instanceof Error ? c.message : c }) : b ? /* @__PURE__ */ e.jsx(A, { id: C, className: Ie, children: r instanceof Error ? r.message : r }) : null }) : null
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 Le = 40, $ = "kakadu-components-4233741488";
48
- function Ge({
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 = Ne(), I = fe(), D = `${I}-error`, G = `${I}-warning`, U = `${I}-information`, {
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: ae
70
- } = y, [se, q] = T(""), s = g ?? se, [oe, le] = T(), ce = l === "textarea" || !!j;
71
- he(() => {
72
- typeof s == "string" && E.current && le(E.current.scrollHeight);
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]), re = H(() => B.length, [B]), N = !!c, w = !N && !!x, L = !!r, J = N ? D : w ? G : L ? U : void 0;
76
- xe(() => {
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]), ie = h(() => {
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 ke = new Event("input", {
97
+ const fe = new Event("input", {
97
98
  bubbles: !0
98
99
  });
99
- t.dispatchEvent(ke), t.focus();
100
+ t.dispatchEvent(fe), t.focus();
100
101
  return;
101
102
  }
102
103
  }
103
104
  throw new Error("Unable to set value.");
104
- }, []), de = h(() => {
105
+ }, []), me = h(() => {
105
106
  v("");
106
- }, [v]), [me, pe] = T(""), Q = !!a && me !== a, ue = h(() => {
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
- pe(a);
114
+ ue(a);
114
115
  }
115
116
  }, [a, v]), X = H(() => p.length, [p]);
116
- return /* @__PURE__ */ e.jsxs(we, { 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: [
117
- /* @__PURE__ */ e.jsx(ge, { isCollapsed: !Q, children: Q ? /* @__PURE__ */ e.jsxs("button", { type: "button", className: o(je, te, "kakadu-components-4141839293"), onClick: ue, children: [
118
- /* @__PURE__ */ e.jsx(ye, { label: "Apply suggestion" }),
119
- /* @__PURE__ */ e.jsx(be, { width: 13, height: 13, className: "kakadu-components-1417828741" }),
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(${Le * ((u ? 1 : 0) + (k ? 1 : 0) + X)}px + 6px)`
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
- ce ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
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
- re > 1 ? /* @__PURE__ */ e.jsx("br", {}) : null
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: oe
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
- ae ? null : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
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: ie }) : null,
162
- k ? /* @__PURE__ */ e.jsx(R, { iconLeft: "times", label: "Clear", tooltip: "Clear", className: $, onClick: de }) : null
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
- Be as InputAttachment,
169
- we as InputLabel,
170
- Ge as default,
171
- Se as errorParagraph,
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 t=require("../jsx-runtime-CZa898vN.js"),o=require("react"),k=require("@kuma-ui/core"),S=require("../icons/chevron-up.js"),f=require("./input.js");function B({label:h,options:y,error:i,warning:c,information:d,footnote:E,className:I,onChange:s,...x}){const l=o.useId(),m=`${l}-error`,p=`${l}-warning`,j=`${l}-information`,a=!!i,u=!a&&!!c,v=!a&&!u&&!!d,q=a?m:u?p:v?j:void 0,{value:n}=x,[R,b]=o.useState(""),$=n??R;o.useEffect(()=>{b(typeof n=="string"?n:"")},[n]);const g=o.useCallback(e=>{const{value:r}=e.target;b(r),s==null||s(r,e)},[s]);return t.jsxRuntimeExports.jsxs(f.InputLabel,{label:h,error:i,errorId:m,warning:c,warningId:p,information:d,informationId:j,footnote:E,children:[t.jsxRuntimeExports.jsx("select",{...x,value:$,"aria-invalid":a,"data-warning":u,"data-information":v,"aria-describedby":q,className:k.cx(f.inputStyles,"kakadu-components-1997515934",I),onChange:g,children:y.map((e,r)=>"type"in e?e.type==="separator"?t.jsxRuntimeExports.jsx("hr",{},`separator-${r}`):null:t.jsxRuntimeExports.jsx("option",{value:e.value,disabled:e.disabled,children:e.label},e.value))}),t.jsxRuntimeExports.jsx(S.default,{width:14,height:14,className:"kakadu-components-158931186"})]})}exports.default=B;
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 S, useState as $, useEffect as w, useCallback as E } from "react";
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 N from "../icons/chevron-up.mjs";
5
- import { InputLabel as L, inputStyles as R } from "./input.mjs";
6
- function D({
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: i,
10
- warning: c,
9
+ error: c,
10
+ warning: i,
11
11
  information: d,
12
12
  footnote: j,
13
13
  className: I,
14
- onChange: t,
14
+ labelClassName: y,
15
+ onChange: s,
15
16
  ...u
16
17
  }) {
17
- const l = S(), m = `${l}-error`, f = `${l}-warning`, p = `${l}-information`, s = !!i, o = !s && !!c, v = !s && !o && !!d, y = s ? m : o ? f : v ? p : void 0, {
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, [k, x] = $(""), g = r ?? k;
20
- w(() => {
20
+ } = u, [g, x] = w(""), B = r ?? g;
21
+ E(() => {
21
22
  x(typeof r == "string" ? r : "");
22
23
  }, [r]);
23
- const B = E((a) => {
24
+ const S = N((a) => {
24
25
  const {
25
26
  value: n
26
27
  } = a.target;
27
- x(n), t == null || t(n, a);
28
- }, [t]);
29
- return /* @__PURE__ */ e.jsxs(L, { label: h, error: i, errorId: m, warning: c, warningId: f, information: d, informationId: p, footnote: j, children: [
30
- /* @__PURE__ */ e.jsx("select", { ...u, value: g, "aria-invalid": s, "data-warning": o, "data-information": v, "aria-describedby": y, className: V(R, "kakadu-components-1997515934", I), onChange: B, children: b.map((a, n) => "type" in a ? a.type === "separator" ? (
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(N, { width: 14, height: 14, className: "kakadu-components-158931186" })
35
+ /* @__PURE__ */ e.jsx(L, { width: 14, height: 14, className: "kakadu-components-158931186" })
35
36
  ] });
36
37
  }
37
38
  export {
38
- D as default
39
+ F as default
39
40
  };