@kakadu/components 6.6.1 → 6.7.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,5 +1,4 @@
1
1
  import React from 'react';
2
2
  import { type DefaultAtomElementType, type AtomElementType, type AtomProperties } from './atom';
3
- type BoxProperties<Type extends AtomElementType = DefaultAtomElementType> = AtomProperties<Type>;
3
+ export type BoxProperties<Type extends AtomElementType = DefaultAtomElementType> = AtomProperties<Type>;
4
4
  export default function Box<Type extends AtomElementType = DefaultAtomElementType>({ as, className, ...properties }: BoxProperties<Type>): React.JSX.Element;
5
- export {};
@@ -4,6 +4,8 @@ export type SelectOption<Type extends string = string> = {
4
4
  readonly value: Type;
5
5
  readonly label: ReactNode | string;
6
6
  readonly disabled?: boolean;
7
+ } | {
8
+ type: 'separator';
7
9
  };
8
10
  export type SelectProperties<Type extends string = string> = Omit<InputLabelControllerProperties & HTMLProps<HTMLSelectElement>, 'onChange'> & {
9
11
  readonly options: Array<SelectOption<Type>>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../jsx-runtime-BB_1_6y_.js"),r=require("react"),S=require("@kuma-ui/core"),$=require("../icons/chevron-up.js"),p=require("./input.js");function B({label:h,options:I,error:l,warning:u,information:c,footnote:q,className:E,onChange:t,...d}){const o=r.useId(),m=`${o}-error`,x=`${o}-warning`,v=`${o}-information`,s=!!l,i=!s&&!!u,b=!s&&!i&&!!c,g=s?m:i?x:b?v:void 0,{value:n}=d,[k,f]=r.useState(""),y=n??k;r.useEffect(()=>{f(typeof n=="string"?n:"")},[n]);const R=r.useCallback(e=>{const{value:j}=e.target;f(j),t==null||t(j,e)},[t]);return a.jsxRuntimeExports.jsxs(p.InputLabel,{label:h,error:l,errorId:m,warning:u,warningId:x,information:c,informationId:v,footnote:q,children:[a.jsxRuntimeExports.jsx("select",{...d,value:y,"aria-invalid":s,"data-warning":i,"data-information":b,"aria-describedby":g,className:S.cx(p.inputStyles,"kakadu-components-1997515934",E),onChange:R,children:I.map(e=>a.jsxRuntimeExports.jsx("option",{value:e.value,disabled:e.disabled,children:e.label},e.value))}),a.jsxRuntimeExports.jsx($.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 t=require("../jsx-runtime-BB_1_6y_.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,34 +1,37 @@
1
- import { j as n } from "../jsx-runtime-B4hRZ52C.mjs";
2
- import { useId as S, useState as w, useEffect as E, useCallback as V } from "react";
3
- import { cx as $ } from "@kuma-ui/core";
1
+ import { j as e } from "../jsx-runtime-B4hRZ52C.mjs";
2
+ import { useId as S, useState as $, useEffect as w, useCallback as E } from "react";
3
+ import { cx as V } from "@kuma-ui/core";
4
4
  import N from "../icons/chevron-up.mjs";
5
5
  import { InputLabel as L, inputStyles as R } from "./input.mjs";
6
6
  function D({
7
- label: b,
8
- options: h,
9
- error: l,
10
- warning: i,
11
- information: c,
12
- footnote: I,
13
- className: j,
14
- onChange: e,
15
- ...d
7
+ label: h,
8
+ options: b,
9
+ error: i,
10
+ warning: c,
11
+ information: d,
12
+ footnote: j,
13
+ className: I,
14
+ onChange: t,
15
+ ...u
16
16
  }) {
17
- const o = S(), u = `${o}-error`, m = `${o}-warning`, f = `${o}-information`, t = !!l, r = !t && !!i, p = !t && !r && !!c, k = t ? u : r ? m : p ? f : void 0, {
18
- value: s
19
- } = d, [g, v] = w(""), y = s ?? g;
20
- E(() => {
21
- v(typeof s == "string" ? s : "");
22
- }, [s]);
23
- const B = V((a) => {
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
+ value: r
19
+ } = u, [k, x] = $(""), g = r ?? k;
20
+ w(() => {
21
+ x(typeof r == "string" ? r : "");
22
+ }, [r]);
23
+ const B = E((a) => {
24
24
  const {
25
- value: x
25
+ value: n
26
26
  } = a.target;
27
- v(x), e == null || e(x, a);
28
- }, [e]);
29
- return /* @__PURE__ */ n.jsxs(L, { label: b, error: l, errorId: u, warning: i, warningId: m, information: c, informationId: f, footnote: I, children: [
30
- /* @__PURE__ */ n.jsx("select", { ...d, value: y, "aria-invalid": t, "data-warning": r, "data-information": p, "aria-describedby": k, className: $(R, "kakadu-components-1997515934", j), onChange: B, children: h.map((a) => /* @__PURE__ */ n.jsx("option", { value: a.value, disabled: a.disabled, children: a.label }, a.value)) }),
31
- /* @__PURE__ */ n.jsx(N, { width: 14, height: 14, className: "kakadu-components-158931186" })
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" ? (
31
+ // eslint-disable-next-line react/no-array-index-key
32
+ /* @__PURE__ */ e.jsx("hr", {}, `separator-${n}`)
33
+ ) : 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" })
32
35
  ] });
33
36
  }
34
37
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kakadu/components",
3
- "version": "6.6.1",
3
+ "version": "6.7.0",
4
4
  "description": "Kakadu components library",
5
5
  "license": "MIT",
6
6
  "main": "./build/index.js",