@kakadu/components 6.6.1 → 6.7.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.
|
@@ -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,7 +4,7 @@ export declare function CheckboxIcon({ value, className, }: {
|
|
|
4
4
|
readonly value?: boolean;
|
|
5
5
|
readonly className?: string;
|
|
6
6
|
}): React.JSX.Element;
|
|
7
|
-
export type TextCheckboxProperties<Type extends boolean = boolean> = Omit<HTMLProps<HTMLInputElement>, 'value' | 'checked' | 'children' | 'onChange'> & {
|
|
7
|
+
export type TextCheckboxProperties<Type extends boolean = boolean> = Omit<HTMLProps<HTMLInputElement>, 'label' | 'value' | 'checked' | 'children' | 'onChange'> & {
|
|
8
8
|
readonly label: ReactNode;
|
|
9
9
|
readonly value?: boolean;
|
|
10
10
|
readonly children?: ReactNode;
|
|
@@ -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
|
|
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
|
|
2
|
-
import { useId as S, useState as
|
|
3
|
-
import { cx as
|
|
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:
|
|
8
|
-
options:
|
|
9
|
-
error:
|
|
10
|
-
warning:
|
|
11
|
-
information:
|
|
12
|
-
footnote:
|
|
13
|
-
className:
|
|
14
|
-
onChange:
|
|
15
|
-
...
|
|
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
|
|
18
|
-
value:
|
|
19
|
-
} =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}, [
|
|
23
|
-
const B =
|
|
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:
|
|
25
|
+
value: n
|
|
26
26
|
} = a.target;
|
|
27
|
-
|
|
28
|
-
}, [
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
|
|
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 {
|