soda-heroui 0.0.1 → 0.0.3

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.
@@ -24,13 +24,12 @@ __export(ErrorMessage_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(ErrorMessage_exports);
26
26
  var import_deepsea_tools = require("deepsea-tools");
27
- var import_zod = require("zod");
28
27
  function getErrorMessage(error) {
29
28
  if (!(0, import_deepsea_tools.isNonNullable)(error))
30
29
  return [];
31
30
  if (typeof error === "string")
32
31
  return [error];
33
- if (error instanceof import_zod.ZodError)
32
+ if ("errors" in error && Array.isArray(error.errors))
34
33
  return error.errors.map((e) => e.message).filter((item, index, array) => array.indexOf(item) === index);
35
34
  return [error.message];
36
35
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/ErrorMessage.tsx"],
4
- "sourcesContent": ["\"use client\"\n\nimport { ComponentProps, FC } from \"react\"\nimport { isNonNullable } from \"deepsea-tools\"\nimport { ZodError } from \"zod\"\n\nexport interface ErrorMessageItem {\n message: string\n}\n\nexport interface ErrorMessageProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n data: (ErrorMessageItem | undefined)[]\n}\n\nfunction getErrorMessage(error: ErrorMessageItem | string | undefined): string[] {\n if (!isNonNullable(error)) return []\n if (typeof error === \"string\") return [error]\n if (error instanceof ZodError) return error.errors.map(e => e.message).filter((item, index, array) => array.indexOf(item) === index)\n return [error.message]\n}\n\nexport const ErrorMessage: FC<ErrorMessageProps> = props => {\n const { data, ...rest } = props\n const errors = data.flatMap(getErrorMessage).filter((item, index, array) => array.indexOf(item) === index)\n\n return (\n errors.length > 0 && (\n <div {...rest}>\n {errors.map((item, index) => (\n <div key={index}>{item}</div>\n ))}\n </div>\n )\n )\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,2BAA8B;AAC9B,iBAAyB;AAUzB,SAAS,gBAAgB,OAAwD;AAC7E,MAAI,KAAC,oCAAc,KAAK;AAAG,WAAO,CAAC;AACnC,MAAI,OAAO,UAAU;AAAU,WAAO,CAAC,KAAK;AAC5C,MAAI,iBAAiB;AAAU,WAAO,MAAM,OAAO,IAAI,OAAK,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,OAAO,UAAU,MAAM,QAAQ,IAAI,MAAM,KAAK;AACnI,SAAO,CAAC,MAAM,OAAO;AACzB;AAEO,IAAM,eAAsC,WAAS;AACxD,QAAM,EAAE,MAAM,GAAG,KAAK,IAAI;AAC1B,QAAM,SAAS,KAAK,QAAQ,eAAe,EAAE,OAAO,CAAC,MAAM,OAAO,UAAU,MAAM,QAAQ,IAAI,MAAM,KAAK;AAEzG,SACI,OAAO,SAAS,KACZ,oCAAC,SAAK,GAAG,QACJ,OAAO,IAAI,CAAC,MAAM,UACf,oCAAC,SAAI,KAAK,SAAQ,IAAK,CAC1B,CACL;AAGZ;",
4
+ "sourcesContent": ["\"use client\"\n\nimport { ComponentProps, FC } from \"react\"\nimport { isNonNullable } from \"deepsea-tools\"\n\nexport interface ErrorMessageItem {\n message: string\n}\n\nexport interface ErrorMessageProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n data: (ErrorMessageItem | undefined)[]\n}\n\nfunction getErrorMessage(error: ErrorMessageItem | string | undefined): string[] {\n if (!isNonNullable(error)) return []\n if (typeof error === \"string\") return [error]\n if (\"errors\" in error && Array.isArray(error.errors)) return error.errors.map(e => e.message).filter((item, index, array) => array.indexOf(item) === index)\n return [error.message]\n}\n\nexport const ErrorMessage: FC<ErrorMessageProps> = props => {\n const { data, ...rest } = props\n const errors = data.flatMap(getErrorMessage).filter((item, index, array) => array.indexOf(item) === index)\n\n return (\n errors.length > 0 && (\n <div {...rest}>\n {errors.map((item, index) => (\n <div key={index}>{item}</div>\n ))}\n </div>\n )\n )\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,2BAA8B;AAU9B,SAAS,gBAAgB,OAAwD;AAC7E,MAAI,KAAC,oCAAc,KAAK;AAAG,WAAO,CAAC;AACnC,MAAI,OAAO,UAAU;AAAU,WAAO,CAAC,KAAK;AAC5C,MAAI,YAAY,SAAS,MAAM,QAAQ,MAAM,MAAM;AAAG,WAAO,MAAM,OAAO,IAAI,OAAK,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,OAAO,UAAU,MAAM,QAAQ,IAAI,MAAM,KAAK;AAC1J,SAAO,CAAC,MAAM,OAAO;AACzB;AAEO,IAAM,eAAsC,WAAS;AACxD,QAAM,EAAE,MAAM,GAAG,KAAK,IAAI;AAC1B,QAAM,SAAS,KAAK,QAAQ,eAAe,EAAE,OAAO,CAAC,MAAM,OAAO,UAAU,MAAM,QAAQ,IAAI,MAAM,KAAK;AAEzG,SACI,OAAO,SAAS,KACZ,oCAAC,SAAK,GAAG,QACJ,OAAO,IAAI,CAAC,MAAM,UACf,oCAAC,SAAI,KAAK,SAAQ,IAAK,CAC1B,CACL;AAGZ;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from "react";
2
2
  import { Autocomplete } from "@heroui/react";
3
+ import { Key } from "@react-types/shared";
3
4
  import { FieldComponentProps } from "soda-tanstack-form";
4
- export interface FormAutocompleteProps<FieldValue extends string | undefined = string | undefined, T extends object = object> extends FieldComponentProps<typeof Autocomplete<T>, FieldValue> {
5
+ export interface FormAutocompleteProps<FieldValue extends Key | undefined = Key | undefined, T extends object = object> extends FieldComponentProps<typeof Autocomplete<T>, FieldValue> {
5
6
  }
6
- export declare function FormAutocomplete<FieldValue extends string | undefined = string | undefined, T extends object = object>({ field, ...rest }: FormAutocompleteProps<FieldValue, T>): ReactNode;
7
+ export declare function FormAutocomplete<FieldValue extends Key | undefined = Key | undefined, T extends object = object>({ field, ...rest }: FormAutocompleteProps<FieldValue, T>): ReactNode;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/FormAutocomplete.tsx"],
4
- "sourcesContent": ["\"use client\"\n\nimport { ReactNode } from \"react\"\nimport { Autocomplete } from \"@heroui/react\"\nimport { FieldComponentProps } from \"soda-tanstack-form\"\n\nimport { ErrorMessage } from \"./ErrorMessage\"\n\nexport interface FormAutocompleteProps<FieldValue extends string | undefined = string | undefined, T extends object = object>\n extends FieldComponentProps<typeof Autocomplete<T>, FieldValue> {}\n\nexport function FormAutocomplete<FieldValue extends string | undefined = string | undefined, T extends object = object>({\n field,\n ...rest\n}: FormAutocompleteProps<FieldValue, T>): ReactNode {\n return (\n <Autocomplete<T>\n selectedKey={field.state.value ?? null}\n onSelectionChange={value => field.handleChange((value ?? undefined) as FieldValue)}\n onBlur={field.handleBlur}\n errorMessage={<ErrorMessage data={field.state.meta.errors} />}\n isInvalid={field.state.meta.errors.some(Boolean)}\n {...rest}\n />\n )\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA6B;AAG7B,0BAA6B;AAKtB,SAAS,iBAAwG;AAAA,EACpH;AAAA,EACA,GAAG;AACP,GAAoD;AAChD,SACI;AAAA,IAAC;AAAA;AAAA,MACG,aAAa,MAAM,MAAM,SAAS;AAAA,MAClC,mBAAmB,WAAS,MAAM,aAAc,SAAS,MAAwB;AAAA,MACjF,QAAQ,MAAM;AAAA,MACd,cAAc,oCAAC,oCAAa,MAAM,MAAM,MAAM,KAAK,QAAQ;AAAA,MAC3D,WAAW,MAAM,MAAM,KAAK,OAAO,KAAK,OAAO;AAAA,MAC9C,GAAG;AAAA;AAAA,EACR;AAER;",
4
+ "sourcesContent": ["\"use client\"\n\nimport { ReactNode } from \"react\"\nimport { Autocomplete } from \"@heroui/react\"\nimport { Key } from \"@react-types/shared\"\nimport { FieldComponentProps } from \"soda-tanstack-form\"\n\nimport { ErrorMessage } from \"./ErrorMessage\"\n\nexport interface FormAutocompleteProps<FieldValue extends Key | undefined = Key | undefined, T extends object = object>\n extends FieldComponentProps<typeof Autocomplete<T>, FieldValue> {}\n\nexport function FormAutocomplete<FieldValue extends Key | undefined = Key | undefined, T extends object = object>({\n field,\n ...rest\n}: FormAutocompleteProps<FieldValue, T>): ReactNode {\n return (\n <Autocomplete<T>\n selectedKey={field.state.value ?? null}\n onSelectionChange={value => field.handleChange((value ?? undefined) as FieldValue)}\n onBlur={field.handleBlur}\n errorMessage={<ErrorMessage data={field.state.meta.errors} />}\n isInvalid={field.state.meta.errors.some(Boolean)}\n {...rest}\n />\n )\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA6B;AAI7B,0BAA6B;AAKtB,SAAS,iBAAkG;AAAA,EAC9G;AAAA,EACA,GAAG;AACP,GAAoD;AAChD,SACI;AAAA,IAAC;AAAA;AAAA,MACG,aAAa,MAAM,MAAM,SAAS;AAAA,MAClC,mBAAmB,WAAS,MAAM,aAAc,SAAS,MAAwB;AAAA,MACjF,QAAQ,MAAM;AAAA,MACd,cAAc,oCAAC,oCAAa,MAAM,MAAM,MAAM,KAAK,QAAQ;AAAA,MAC3D,WAAW,MAAM,MAAM,KAAK,OAAO,KAAK,OAAO;AAAA,MAC9C,GAAG;AAAA;AAAA,EACR;AAER;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,8 @@
1
1
  import { Select } from "@heroui/react";
2
+ import { Key } from "@react-types/shared";
2
3
  import { FieldComponentProps } from "soda-tanstack-form";
3
4
  import { StrictOmit } from "soda-type";
4
- export interface FormSelectProps<Value extends string | undefined = string | undefined, Multiple extends boolean = false, T extends object = object, FieldValue = Multiple extends true ? Value[] : Value> extends StrictOmit<FieldComponentProps<typeof Select<T>, FieldValue>, "multiple"> {
5
+ export interface FormSelectProps<Value extends Key | undefined = Key | undefined, Multiple extends boolean = false, T extends object = object, FieldValue = Multiple extends true ? Value[] : Value> extends StrictOmit<FieldComponentProps<typeof Select<T>, FieldValue>, "multiple"> {
5
6
  multiple?: Multiple;
6
7
  }
7
- export declare function FormSelect<Value extends string | undefined = string | undefined, Multiple extends boolean = false, T extends object = object, FieldValue = Multiple extends true ? Value[] : Value>({ field, multiple, ...rest }: FormSelectProps<Value, Multiple, T, FieldValue>): import("react/jsx-runtime").JSX.Element;
8
+ export declare function FormSelect<Value extends Key | undefined = Key | undefined, Multiple extends boolean = false, T extends object = object, FieldValue = Multiple extends true ? Value[] : Value>({ field, multiple, ...rest }: FormSelectProps<Value, Multiple, T, FieldValue>): import("react/jsx-runtime").JSX.Element;
@@ -30,7 +30,7 @@ function FormSelect({ field, multiple, ...rest }) {
30
30
  return /* @__PURE__ */ React.createElement(
31
31
  import_react.Select,
32
32
  {
33
- selectedKeys: Array.isArray(field.state.value) ? field.state.value.filter(import_deepsea_tools.isNonNullable) : typeof field.state.value === "string" ? [field.state.value] : [],
33
+ selectedKeys: Array.isArray(field.state.value) ? field.state.value.filter(import_deepsea_tools.isNonNullable) : (0, import_deepsea_tools.isNonNullable)(field.state.value) ? [field.state.value] : [],
34
34
  onSelectionChange: (keys) => {
35
35
  const value = Array.from(keys);
36
36
  field.handleChange(multiple ? value : value.at(0));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/FormSelect.tsx"],
4
- "sourcesContent": ["\"use client\"\n\nimport { Select } from \"@heroui/react\"\nimport { isNonNullable } from \"deepsea-tools\"\nimport { FieldComponentProps } from \"soda-tanstack-form\"\nimport { StrictOmit } from \"soda-type\"\n\nimport { ErrorMessage } from \"./ErrorMessage\"\n\nexport interface FormSelectProps<\n Value extends string | undefined = string | undefined,\n Multiple extends boolean = false,\n T extends object = object,\n FieldValue = Multiple extends true ? Value[] : Value,\n> extends StrictOmit<FieldComponentProps<typeof Select<T>, FieldValue>, \"multiple\"> {\n multiple?: Multiple\n}\n\nexport function FormSelect<\n Value extends string | undefined = string | undefined,\n Multiple extends boolean = false,\n T extends object = object,\n FieldValue = Multiple extends true ? Value[] : Value,\n>({ field, multiple, ...rest }: FormSelectProps<Value, Multiple, T, FieldValue>) {\n return (\n <Select<T>\n selectedKeys={\n Array.isArray(field.state.value) ? field.state.value.filter(isNonNullable) : typeof field.state.value === \"string\" ? [field.state.value] : []\n }\n onSelectionChange={keys => {\n const value = Array.from(keys) as string[]\n field.handleChange((multiple ? value : value.at(0)) as FieldValue)\n }}\n onBlur={field.handleBlur}\n errorMessage={<ErrorMessage data={field.state.meta.errors} />}\n isInvalid={field.state.meta.errors.some(Boolean)}\n {...rest}\n />\n )\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAuB;AACvB,2BAA8B;AAI9B,0BAA6B;AAWtB,SAAS,WAKd,EAAE,OAAO,UAAU,GAAG,KAAK,GAAoD;AAC7E,SACI;AAAA,IAAC;AAAA;AAAA,MACG,cACI,MAAM,QAAQ,MAAM,MAAM,KAAK,IAAI,MAAM,MAAM,MAAM,OAAO,kCAAa,IAAI,OAAO,MAAM,MAAM,UAAU,WAAW,CAAC,MAAM,MAAM,KAAK,IAAI,CAAC;AAAA,MAEhJ,mBAAmB,UAAQ;AACvB,cAAM,QAAQ,MAAM,KAAK,IAAI;AAC7B,cAAM,aAAc,WAAW,QAAQ,MAAM,GAAG,CAAC,CAAgB;AAAA,MACrE;AAAA,MACA,QAAQ,MAAM;AAAA,MACd,cAAc,oCAAC,oCAAa,MAAM,MAAM,MAAM,KAAK,QAAQ;AAAA,MAC3D,WAAW,MAAM,MAAM,KAAK,OAAO,KAAK,OAAO;AAAA,MAC9C,GAAG;AAAA;AAAA,EACR;AAER;",
4
+ "sourcesContent": ["\"use client\"\n\nimport { Select } from \"@heroui/react\"\nimport { Key } from \"@react-types/shared\"\nimport { isNonNullable } from \"deepsea-tools\"\nimport { FieldComponentProps } from \"soda-tanstack-form\"\nimport { StrictOmit } from \"soda-type\"\n\nimport { ErrorMessage } from \"./ErrorMessage\"\n\nexport interface FormSelectProps<\n Value extends Key | undefined = Key | undefined,\n Multiple extends boolean = false,\n T extends object = object,\n FieldValue = Multiple extends true ? Value[] : Value,\n> extends StrictOmit<FieldComponentProps<typeof Select<T>, FieldValue>, \"multiple\"> {\n multiple?: Multiple\n}\n\nexport function FormSelect<\n Value extends Key | undefined = Key | undefined,\n Multiple extends boolean = false,\n T extends object = object,\n FieldValue = Multiple extends true ? Value[] : Value,\n>({ field, multiple, ...rest }: FormSelectProps<Value, Multiple, T, FieldValue>) {\n return (\n <Select<T>\n selectedKeys={\n Array.isArray(field.state.value) ? field.state.value.filter(isNonNullable) : isNonNullable(field.state.value) ? [field.state.value] : []\n }\n onSelectionChange={keys => {\n const value = Array.from(keys) as string[]\n field.handleChange((multiple ? value : value.at(0)) as FieldValue)\n }}\n onBlur={field.handleBlur}\n errorMessage={<ErrorMessage data={field.state.meta.errors} />}\n isInvalid={field.state.meta.errors.some(Boolean)}\n {...rest}\n />\n )\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAuB;AAEvB,2BAA8B;AAI9B,0BAA6B;AAWtB,SAAS,WAKd,EAAE,OAAO,UAAU,GAAG,KAAK,GAAoD;AAC7E,SACI;AAAA,IAAC;AAAA;AAAA,MACG,cACI,MAAM,QAAQ,MAAM,MAAM,KAAK,IAAI,MAAM,MAAM,MAAM,OAAO,kCAAa,QAAI,oCAAc,MAAM,MAAM,KAAK,IAAI,CAAC,MAAM,MAAM,KAAK,IAAI,CAAC;AAAA,MAE3I,mBAAmB,UAAQ;AACvB,cAAM,QAAQ,MAAM,KAAK,IAAI;AAC7B,cAAM,aAAc,WAAW,QAAQ,MAAM,GAAG,CAAC,CAAgB;AAAA,MACrE;AAAA,MACA,QAAQ,MAAM;AAAA,MACd,cAAc,oCAAC,oCAAa,MAAM,MAAM,MAAM,KAAK,QAAQ;AAAA,MAC3D,WAAW,MAAM,MAAM,KAAK,OAAO,KAAK,OAAO;AAAA,MAC9C,GAAG;AAAA;AAAA,EACR;AAER;",
6
6
  "names": []
7
7
  }
@@ -1,12 +1,11 @@
1
1
  "use client";
2
2
 
3
3
  import { isNonNullable } from "deepsea-tools";
4
- import { ZodError } from "zod";
5
4
  import { jsx as _jsx } from "react/jsx-runtime";
6
5
  function getErrorMessage(error) {
7
6
  if (!isNonNullable(error)) return [];
8
7
  if (typeof error === "string") return [error];
9
- if (error instanceof ZodError) return error.errors.map(e => e.message).filter((item, index, array) => array.indexOf(item) === index);
8
+ if ("errors" in error && Array.isArray(error.errors)) return error.errors.map(e => e.message).filter((item, index, array) => array.indexOf(item) === index);
10
9
  return [error.message];
11
10
  }
12
11
  export const ErrorMessage = props => {
@@ -1 +1 @@
1
- {"version":3,"names":["isNonNullable","ZodError","jsx","_jsx","getErrorMessage","error","errors","map","e","message","filter","item","index","array","indexOf","ErrorMessage","props","data","rest","flatMap","length","children"],"sources":["../../../src/components/ErrorMessage.tsx"],"sourcesContent":["\"use client\"\n\nimport { ComponentProps, FC } from \"react\"\nimport { isNonNullable } from \"deepsea-tools\"\nimport { ZodError } from \"zod\"\n\nexport interface ErrorMessageItem {\n message: string\n}\n\nexport interface ErrorMessageProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n data: (ErrorMessageItem | undefined)[]\n}\n\nfunction getErrorMessage(error: ErrorMessageItem | string | undefined): string[] {\n if (!isNonNullable(error)) return []\n if (typeof error === \"string\") return [error]\n if (error instanceof ZodError) return error.errors.map(e => e.message).filter((item, index, array) => array.indexOf(item) === index)\n return [error.message]\n}\n\nexport const ErrorMessage: FC<ErrorMessageProps> = props => {\n const { data, ...rest } = props\n const errors = data.flatMap(getErrorMessage).filter((item, index, array) => array.indexOf(item) === index)\n\n return (\n errors.length > 0 && (\n <div {...rest}>\n {errors.map((item, index) => (\n <div key={index}>{item}</div>\n ))}\n </div>\n )\n )\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,SAASA,aAAa,QAAQ,eAAe;AAC7C,SAASC,QAAQ,QAAQ,KAAK;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAU9B,SAASC,eAAeA,CAACC,KAA4C,EAAY;EAC7E,IAAI,CAACL,aAAa,CAACK,KAAK,CAAC,EAAE,OAAO,EAAE;EACpC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE,OAAO,CAACA,KAAK,CAAC;EAC7C,IAAIA,KAAK,YAAYJ,QAAQ,EAAE,OAAOI,KAAK,CAACC,MAAM,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,CAAC,CAACC,MAAM,CAAC,CAACC,IAAI,EAAEC,KAAK,EAAEC,KAAK,KAAKA,KAAK,CAACC,OAAO,CAACH,IAAI,CAAC,KAAKC,KAAK,CAAC;EACpI,OAAO,CAACP,KAAK,CAACI,OAAO,CAAC;AAC1B;AAEA,OAAO,MAAMM,YAAmC,GAAGC,KAAK,IAAI;EACxD,MAAM;IAAEC,IAAI;IAAE,GAAGC;EAAK,CAAC,GAAGF,KAAK;EAC/B,MAAMV,MAAM,GAAGW,IAAI,CAACE,OAAO,CAACf,eAAe,CAAC,CAACM,MAAM,CAAC,CAACC,IAAI,EAAEC,KAAK,EAAEC,KAAK,KAAKA,KAAK,CAACC,OAAO,CAACH,IAAI,CAAC,KAAKC,KAAK,CAAC;EAE1G,OACIN,MAAM,CAACc,MAAM,GAAG,CAAC,iBACbjB,IAAA;IAAA,GAASe,IAAI;IAAAG,QAAA,EACRf,MAAM,CAACC,GAAG,CAAC,CAACI,IAAI,EAAEC,KAAK,kBACpBT,IAAA;MAAAkB,QAAA,EAAkBV;IAAI,GAAZC,KAAkB,CAC/B;EAAC,CACD,CACR;AAET,CAAC"}
1
+ {"version":3,"names":["isNonNullable","jsx","_jsx","getErrorMessage","error","Array","isArray","errors","map","e","message","filter","item","index","array","indexOf","ErrorMessage","props","data","rest","flatMap","length","children"],"sources":["../../../src/components/ErrorMessage.tsx"],"sourcesContent":["\"use client\"\n\nimport { ComponentProps, FC } from \"react\"\nimport { isNonNullable } from \"deepsea-tools\"\n\nexport interface ErrorMessageItem {\n message: string\n}\n\nexport interface ErrorMessageProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n data: (ErrorMessageItem | undefined)[]\n}\n\nfunction getErrorMessage(error: ErrorMessageItem | string | undefined): string[] {\n if (!isNonNullable(error)) return []\n if (typeof error === \"string\") return [error]\n if (\"errors\" in error && Array.isArray(error.errors)) return error.errors.map(e => e.message).filter((item, index, array) => array.indexOf(item) === index)\n return [error.message]\n}\n\nexport const ErrorMessage: FC<ErrorMessageProps> = props => {\n const { data, ...rest } = props\n const errors = data.flatMap(getErrorMessage).filter((item, index, array) => array.indexOf(item) === index)\n\n return (\n errors.length > 0 && (\n <div {...rest}>\n {errors.map((item, index) => (\n <div key={index}>{item}</div>\n ))}\n </div>\n )\n )\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,SAASA,aAAa,QAAQ,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAU7C,SAASC,eAAeA,CAACC,KAA4C,EAAY;EAC7E,IAAI,CAACJ,aAAa,CAACI,KAAK,CAAC,EAAE,OAAO,EAAE;EACpC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE,OAAO,CAACA,KAAK,CAAC;EAC7C,IAAI,QAAQ,IAAIA,KAAK,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAACG,MAAM,CAAC,EAAE,OAAOH,KAAK,CAACG,MAAM,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,CAAC,CAACC,MAAM,CAAC,CAACC,IAAI,EAAEC,KAAK,EAAEC,KAAK,KAAKA,KAAK,CAACC,OAAO,CAACH,IAAI,CAAC,KAAKC,KAAK,CAAC;EAC3J,OAAO,CAACT,KAAK,CAACM,OAAO,CAAC;AAC1B;AAEA,OAAO,MAAMM,YAAmC,GAAGC,KAAK,IAAI;EACxD,MAAM;IAAEC,IAAI;IAAE,GAAGC;EAAK,CAAC,GAAGF,KAAK;EAC/B,MAAMV,MAAM,GAAGW,IAAI,CAACE,OAAO,CAACjB,eAAe,CAAC,CAACQ,MAAM,CAAC,CAACC,IAAI,EAAEC,KAAK,EAAEC,KAAK,KAAKA,KAAK,CAACC,OAAO,CAACH,IAAI,CAAC,KAAKC,KAAK,CAAC;EAE1G,OACIN,MAAM,CAACc,MAAM,GAAG,CAAC,iBACbnB,IAAA;IAAA,GAASiB,IAAI;IAAAG,QAAA,EACRf,MAAM,CAACC,GAAG,CAAC,CAACI,IAAI,EAAEC,KAAK,kBACpBX,IAAA;MAAAoB,QAAA,EAAkBV;IAAI,GAAZC,KAAkB,CAC/B;EAAC,CACD,CACR;AAET,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from "react";
2
2
  import { Autocomplete } from "@heroui/react";
3
+ import { Key } from "@react-types/shared";
3
4
  import { FieldComponentProps } from "soda-tanstack-form";
4
- export interface FormAutocompleteProps<FieldValue extends string | undefined = string | undefined, T extends object = object> extends FieldComponentProps<typeof Autocomplete<T>, FieldValue> {
5
+ export interface FormAutocompleteProps<FieldValue extends Key | undefined = Key | undefined, T extends object = object> extends FieldComponentProps<typeof Autocomplete<T>, FieldValue> {
5
6
  }
6
- export declare function FormAutocomplete<FieldValue extends string | undefined = string | undefined, T extends object = object>({ field, ...rest }: FormAutocompleteProps<FieldValue, T>): ReactNode;
7
+ export declare function FormAutocomplete<FieldValue extends Key | undefined = Key | undefined, T extends object = object>({ field, ...rest }: FormAutocompleteProps<FieldValue, T>): ReactNode;
@@ -1 +1 @@
1
- {"version":3,"names":["Autocomplete","ErrorMessage","jsx","_jsx","FormAutocomplete","field","rest","selectedKey","state","value","onSelectionChange","handleChange","undefined","onBlur","handleBlur","errorMessage","data","meta","errors","isInvalid","some","Boolean"],"sources":["../../../src/components/FormAutocomplete.tsx"],"sourcesContent":["\"use client\"\n\nimport { ReactNode } from \"react\"\nimport { Autocomplete } from \"@heroui/react\"\nimport { FieldComponentProps } from \"soda-tanstack-form\"\n\nimport { ErrorMessage } from \"./ErrorMessage\"\n\nexport interface FormAutocompleteProps<FieldValue extends string | undefined = string | undefined, T extends object = object>\n extends FieldComponentProps<typeof Autocomplete<T>, FieldValue> {}\n\nexport function FormAutocomplete<FieldValue extends string | undefined = string | undefined, T extends object = object>({\n field,\n ...rest\n}: FormAutocompleteProps<FieldValue, T>): ReactNode {\n return (\n <Autocomplete<T>\n selectedKey={field.state.value ?? null}\n onSelectionChange={value => field.handleChange((value ?? undefined) as FieldValue)}\n onBlur={field.handleBlur}\n errorMessage={<ErrorMessage data={field.state.meta.errors} />}\n isInvalid={field.state.meta.errors.some(Boolean)}\n {...rest}\n />\n )\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,SAASA,YAAY,QAAQ,eAAe;AAG5C,SAASC,YAAY;AAAwB,SAAAC,GAAA,IAAAC,IAAA;AAK7C,OAAO,SAASC,gBAAgBA,CAAwF;EACpHC,KAAK;EACL,GAAGC;AAC+B,CAAC,EAAa;EAChD,oBACIH,IAAA,CAACH,YAAY;IACTO,WAAW,EAAEF,KAAK,CAACG,KAAK,CAACC,KAAK,IAAI,IAAK;IACvCC,iBAAiB,EAAED,KAAK,IAAIJ,KAAK,CAACM,YAAY,CAAEF,KAAK,IAAIG,SAAwB,CAAE;IACnFC,MAAM,EAAER,KAAK,CAACS,UAAW;IACzBC,YAAY,eAAEZ,IAAA,CAACF,YAAY;MAACe,IAAI,EAAEX,KAAK,CAACG,KAAK,CAACS,IAAI,CAACC;IAAO,CAAE,CAAE;IAC9DC,SAAS,EAAEd,KAAK,CAACG,KAAK,CAACS,IAAI,CAACC,MAAM,CAACE,IAAI,CAACC,OAAO,CAAE;IAAA,GAC7Cf;EAAI,CACX,CAAC;AAEV"}
1
+ {"version":3,"names":["Autocomplete","ErrorMessage","jsx","_jsx","FormAutocomplete","field","rest","selectedKey","state","value","onSelectionChange","handleChange","undefined","onBlur","handleBlur","errorMessage","data","meta","errors","isInvalid","some","Boolean"],"sources":["../../../src/components/FormAutocomplete.tsx"],"sourcesContent":["\"use client\"\n\nimport { ReactNode } from \"react\"\nimport { Autocomplete } from \"@heroui/react\"\nimport { Key } from \"@react-types/shared\"\nimport { FieldComponentProps } from \"soda-tanstack-form\"\n\nimport { ErrorMessage } from \"./ErrorMessage\"\n\nexport interface FormAutocompleteProps<FieldValue extends Key | undefined = Key | undefined, T extends object = object>\n extends FieldComponentProps<typeof Autocomplete<T>, FieldValue> {}\n\nexport function FormAutocomplete<FieldValue extends Key | undefined = Key | undefined, T extends object = object>({\n field,\n ...rest\n}: FormAutocompleteProps<FieldValue, T>): ReactNode {\n return (\n <Autocomplete<T>\n selectedKey={field.state.value ?? null}\n onSelectionChange={value => field.handleChange((value ?? undefined) as FieldValue)}\n onBlur={field.handleBlur}\n errorMessage={<ErrorMessage data={field.state.meta.errors} />}\n isInvalid={field.state.meta.errors.some(Boolean)}\n {...rest}\n />\n )\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,SAASA,YAAY,QAAQ,eAAe;AAI5C,SAASC,YAAY;AAAwB,SAAAC,GAAA,IAAAC,IAAA;AAK7C,OAAO,SAASC,gBAAgBA,CAAkF;EAC9GC,KAAK;EACL,GAAGC;AAC+B,CAAC,EAAa;EAChD,oBACIH,IAAA,CAACH,YAAY;IACTO,WAAW,EAAEF,KAAK,CAACG,KAAK,CAACC,KAAK,IAAI,IAAK;IACvCC,iBAAiB,EAAED,KAAK,IAAIJ,KAAK,CAACM,YAAY,CAAEF,KAAK,IAAIG,SAAwB,CAAE;IACnFC,MAAM,EAAER,KAAK,CAACS,UAAW;IACzBC,YAAY,eAAEZ,IAAA,CAACF,YAAY;MAACe,IAAI,EAAEX,KAAK,CAACG,KAAK,CAACS,IAAI,CAACC;IAAO,CAAE,CAAE;IAC9DC,SAAS,EAAEd,KAAK,CAACG,KAAK,CAACS,IAAI,CAACC,MAAM,CAACE,IAAI,CAACC,OAAO,CAAE;IAAA,GAC7Cf;EAAI,CACX,CAAC;AAEV"}
@@ -1,7 +1,8 @@
1
1
  import { Select } from "@heroui/react";
2
+ import { Key } from "@react-types/shared";
2
3
  import { FieldComponentProps } from "soda-tanstack-form";
3
4
  import { StrictOmit } from "soda-type";
4
- export interface FormSelectProps<Value extends string | undefined = string | undefined, Multiple extends boolean = false, T extends object = object, FieldValue = Multiple extends true ? Value[] : Value> extends StrictOmit<FieldComponentProps<typeof Select<T>, FieldValue>, "multiple"> {
5
+ export interface FormSelectProps<Value extends Key | undefined = Key | undefined, Multiple extends boolean = false, T extends object = object, FieldValue = Multiple extends true ? Value[] : Value> extends StrictOmit<FieldComponentProps<typeof Select<T>, FieldValue>, "multiple"> {
5
6
  multiple?: Multiple;
6
7
  }
7
- export declare function FormSelect<Value extends string | undefined = string | undefined, Multiple extends boolean = false, T extends object = object, FieldValue = Multiple extends true ? Value[] : Value>({ field, multiple, ...rest }: FormSelectProps<Value, Multiple, T, FieldValue>): import("react/jsx-runtime").JSX.Element;
8
+ export declare function FormSelect<Value extends Key | undefined = Key | undefined, Multiple extends boolean = false, T extends object = object, FieldValue = Multiple extends true ? Value[] : Value>({ field, multiple, ...rest }: FormSelectProps<Value, Multiple, T, FieldValue>): import("react/jsx-runtime").JSX.Element;
@@ -10,7 +10,7 @@ export function FormSelect({
10
10
  ...rest
11
11
  }) {
12
12
  return /*#__PURE__*/_jsx(Select, {
13
- selectedKeys: Array.isArray(field.state.value) ? field.state.value.filter(isNonNullable) : typeof field.state.value === "string" ? [field.state.value] : [],
13
+ selectedKeys: Array.isArray(field.state.value) ? field.state.value.filter(isNonNullable) : isNonNullable(field.state.value) ? [field.state.value] : [],
14
14
  onSelectionChange: keys => {
15
15
  const value = Array.from(keys);
16
16
  field.handleChange(multiple ? value : value.at(0));
@@ -1 +1 @@
1
- {"version":3,"names":["Select","isNonNullable","ErrorMessage","jsx","_jsx","FormSelect","field","multiple","rest","selectedKeys","Array","isArray","state","value","filter","onSelectionChange","keys","from","handleChange","at","onBlur","handleBlur","errorMessage","data","meta","errors","isInvalid","some","Boolean"],"sources":["../../../src/components/FormSelect.tsx"],"sourcesContent":["\"use client\"\n\nimport { Select } from \"@heroui/react\"\nimport { isNonNullable } from \"deepsea-tools\"\nimport { FieldComponentProps } from \"soda-tanstack-form\"\nimport { StrictOmit } from \"soda-type\"\n\nimport { ErrorMessage } from \"./ErrorMessage\"\n\nexport interface FormSelectProps<\n Value extends string | undefined = string | undefined,\n Multiple extends boolean = false,\n T extends object = object,\n FieldValue = Multiple extends true ? Value[] : Value,\n> extends StrictOmit<FieldComponentProps<typeof Select<T>, FieldValue>, \"multiple\"> {\n multiple?: Multiple\n}\n\nexport function FormSelect<\n Value extends string | undefined = string | undefined,\n Multiple extends boolean = false,\n T extends object = object,\n FieldValue = Multiple extends true ? Value[] : Value,\n>({ field, multiple, ...rest }: FormSelectProps<Value, Multiple, T, FieldValue>) {\n return (\n <Select<T>\n selectedKeys={\n Array.isArray(field.state.value) ? field.state.value.filter(isNonNullable) : typeof field.state.value === \"string\" ? [field.state.value] : []\n }\n onSelectionChange={keys => {\n const value = Array.from(keys) as string[]\n field.handleChange((multiple ? value : value.at(0)) as FieldValue)\n }}\n onBlur={field.handleBlur}\n errorMessage={<ErrorMessage data={field.state.meta.errors} />}\n isInvalid={field.state.meta.errors.some(Boolean)}\n {...rest}\n />\n )\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,MAAM,QAAQ,eAAe;AACtC,SAASC,aAAa,QAAQ,eAAe;AAI7C,SAASC,YAAY;AAAwB,SAAAC,GAAA,IAAAC,IAAA;AAW7C,OAAO,SAASC,UAAUA,CAKxB;EAAEC,KAAK;EAAEC,QAAQ;EAAE,GAAGC;AAAsD,CAAC,EAAE;EAC7E,oBACIJ,IAAA,CAACJ,MAAM;IACHS,YAAY,EACRC,KAAK,CAACC,OAAO,CAACL,KAAK,CAACM,KAAK,CAACC,KAAK,CAAC,GAAGP,KAAK,CAACM,KAAK,CAACC,KAAK,CAACC,MAAM,CAACb,aAAa,CAAC,GAAG,OAAOK,KAAK,CAACM,KAAK,CAACC,KAAK,KAAK,QAAQ,GAAG,CAACP,KAAK,CAACM,KAAK,CAACC,KAAK,CAAC,GAAG,EAC9I;IACDE,iBAAiB,EAAEC,IAAI,IAAI;MACvB,MAAMH,KAAK,GAAGH,KAAK,CAACO,IAAI,CAACD,IAAI,CAAa;MAC1CV,KAAK,CAACY,YAAY,CAAEX,QAAQ,GAAGM,KAAK,GAAGA,KAAK,CAACM,EAAE,CAAC,CAAC,CAAgB,CAAC;IACtE,CAAE;IACFC,MAAM,EAAEd,KAAK,CAACe,UAAW;IACzBC,YAAY,eAAElB,IAAA,CAACF,YAAY;MAACqB,IAAI,EAAEjB,KAAK,CAACM,KAAK,CAACY,IAAI,CAACC;IAAO,CAAE,CAAE;IAC9DC,SAAS,EAAEpB,KAAK,CAACM,KAAK,CAACY,IAAI,CAACC,MAAM,CAACE,IAAI,CAACC,OAAO,CAAE;IAAA,GAC7CpB;EAAI,CACX,CAAC;AAEV"}
1
+ {"version":3,"names":["Select","isNonNullable","ErrorMessage","jsx","_jsx","FormSelect","field","multiple","rest","selectedKeys","Array","isArray","state","value","filter","onSelectionChange","keys","from","handleChange","at","onBlur","handleBlur","errorMessage","data","meta","errors","isInvalid","some","Boolean"],"sources":["../../../src/components/FormSelect.tsx"],"sourcesContent":["\"use client\"\n\nimport { Select } from \"@heroui/react\"\nimport { Key } from \"@react-types/shared\"\nimport { isNonNullable } from \"deepsea-tools\"\nimport { FieldComponentProps } from \"soda-tanstack-form\"\nimport { StrictOmit } from \"soda-type\"\n\nimport { ErrorMessage } from \"./ErrorMessage\"\n\nexport interface FormSelectProps<\n Value extends Key | undefined = Key | undefined,\n Multiple extends boolean = false,\n T extends object = object,\n FieldValue = Multiple extends true ? Value[] : Value,\n> extends StrictOmit<FieldComponentProps<typeof Select<T>, FieldValue>, \"multiple\"> {\n multiple?: Multiple\n}\n\nexport function FormSelect<\n Value extends Key | undefined = Key | undefined,\n Multiple extends boolean = false,\n T extends object = object,\n FieldValue = Multiple extends true ? Value[] : Value,\n>({ field, multiple, ...rest }: FormSelectProps<Value, Multiple, T, FieldValue>) {\n return (\n <Select<T>\n selectedKeys={\n Array.isArray(field.state.value) ? field.state.value.filter(isNonNullable) : isNonNullable(field.state.value) ? [field.state.value] : []\n }\n onSelectionChange={keys => {\n const value = Array.from(keys) as string[]\n field.handleChange((multiple ? value : value.at(0)) as FieldValue)\n }}\n onBlur={field.handleBlur}\n errorMessage={<ErrorMessage data={field.state.meta.errors} />}\n isInvalid={field.state.meta.errors.some(Boolean)}\n {...rest}\n />\n )\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,MAAM,QAAQ,eAAe;AAEtC,SAASC,aAAa,QAAQ,eAAe;AAI7C,SAASC,YAAY;AAAwB,SAAAC,GAAA,IAAAC,IAAA;AAW7C,OAAO,SAASC,UAAUA,CAKxB;EAAEC,KAAK;EAAEC,QAAQ;EAAE,GAAGC;AAAsD,CAAC,EAAE;EAC7E,oBACIJ,IAAA,CAACJ,MAAM;IACHS,YAAY,EACRC,KAAK,CAACC,OAAO,CAACL,KAAK,CAACM,KAAK,CAACC,KAAK,CAAC,GAAGP,KAAK,CAACM,KAAK,CAACC,KAAK,CAACC,MAAM,CAACb,aAAa,CAAC,GAAGA,aAAa,CAACK,KAAK,CAACM,KAAK,CAACC,KAAK,CAAC,GAAG,CAACP,KAAK,CAACM,KAAK,CAACC,KAAK,CAAC,GAAG,EACzI;IACDE,iBAAiB,EAAEC,IAAI,IAAI;MACvB,MAAMH,KAAK,GAAGH,KAAK,CAACO,IAAI,CAACD,IAAI,CAAa;MAC1CV,KAAK,CAACY,YAAY,CAAEX,QAAQ,GAAGM,KAAK,GAAGA,KAAK,CAACM,EAAE,CAAC,CAAC,CAAgB,CAAC;IACtE,CAAE;IACFC,MAAM,EAAEd,KAAK,CAACe,UAAW;IACzBC,YAAY,eAAElB,IAAA,CAACF,YAAY;MAACqB,IAAI,EAAEjB,KAAK,CAACM,KAAK,CAACY,IAAI,CAACC;IAAO,CAAE,CAAE;IAC9DC,SAAS,EAAEpB,KAAK,CAACM,KAAK,CAACY,IAAI,CAACC,MAAM,CAACE,IAAI,CAACC,OAAO,CAAE;IAAA,GAC7CpB;EAAI,CACX,CAAC;AAEV"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soda-heroui",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -30,12 +30,13 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@internationalized/date": "^3.7.0",
33
- "zod": "^3.24.2",
34
- "deepsea-tools": "5.19.3",
35
- "soda-tanstack-form": "0.0.2",
33
+ "@tanstack/react-form": "^1.1.2",
34
+ "deepsea-tools": "5.20.0",
35
+ "soda-tanstack-form": "0.0.3",
36
36
  "soda-type": "6.0.2"
37
37
  },
38
38
  "devDependencies": {
39
+ "@react-types/shared": "^3.28.0",
39
40
  "typescript": "^5.8.2"
40
41
  },
41
42
  "scripts": {
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { ComponentProps, FC } from "react"
4
4
  import { isNonNullable } from "deepsea-tools"
5
- import { ZodError } from "zod"
6
5
 
7
6
  export interface ErrorMessageItem {
8
7
  message: string
@@ -15,7 +14,7 @@ export interface ErrorMessageProps extends Omit<ComponentProps<"div">, "children
15
14
  function getErrorMessage(error: ErrorMessageItem | string | undefined): string[] {
16
15
  if (!isNonNullable(error)) return []
17
16
  if (typeof error === "string") return [error]
18
- if (error instanceof ZodError) return error.errors.map(e => e.message).filter((item, index, array) => array.indexOf(item) === index)
17
+ if ("errors" in error && Array.isArray(error.errors)) return error.errors.map(e => e.message).filter((item, index, array) => array.indexOf(item) === index)
19
18
  return [error.message]
20
19
  }
21
20
 
@@ -2,14 +2,15 @@
2
2
 
3
3
  import { ReactNode } from "react"
4
4
  import { Autocomplete } from "@heroui/react"
5
+ import { Key } from "@react-types/shared"
5
6
  import { FieldComponentProps } from "soda-tanstack-form"
6
7
 
7
8
  import { ErrorMessage } from "./ErrorMessage"
8
9
 
9
- export interface FormAutocompleteProps<FieldValue extends string | undefined = string | undefined, T extends object = object>
10
+ export interface FormAutocompleteProps<FieldValue extends Key | undefined = Key | undefined, T extends object = object>
10
11
  extends FieldComponentProps<typeof Autocomplete<T>, FieldValue> {}
11
12
 
12
- export function FormAutocomplete<FieldValue extends string | undefined = string | undefined, T extends object = object>({
13
+ export function FormAutocomplete<FieldValue extends Key | undefined = Key | undefined, T extends object = object>({
13
14
  field,
14
15
  ...rest
15
16
  }: FormAutocompleteProps<FieldValue, T>): ReactNode {
@@ -1,6 +1,7 @@
1
1
  "use client"
2
2
 
3
3
  import { Select } from "@heroui/react"
4
+ import { Key } from "@react-types/shared"
4
5
  import { isNonNullable } from "deepsea-tools"
5
6
  import { FieldComponentProps } from "soda-tanstack-form"
6
7
  import { StrictOmit } from "soda-type"
@@ -8,7 +9,7 @@ import { StrictOmit } from "soda-type"
8
9
  import { ErrorMessage } from "./ErrorMessage"
9
10
 
10
11
  export interface FormSelectProps<
11
- Value extends string | undefined = string | undefined,
12
+ Value extends Key | undefined = Key | undefined,
12
13
  Multiple extends boolean = false,
13
14
  T extends object = object,
14
15
  FieldValue = Multiple extends true ? Value[] : Value,
@@ -17,7 +18,7 @@ export interface FormSelectProps<
17
18
  }
18
19
 
19
20
  export function FormSelect<
20
- Value extends string | undefined = string | undefined,
21
+ Value extends Key | undefined = Key | undefined,
21
22
  Multiple extends boolean = false,
22
23
  T extends object = object,
23
24
  FieldValue = Multiple extends true ? Value[] : Value,
@@ -25,7 +26,7 @@ export function FormSelect<
25
26
  return (
26
27
  <Select<T>
27
28
  selectedKeys={
28
- Array.isArray(field.state.value) ? field.state.value.filter(isNonNullable) : typeof field.state.value === "string" ? [field.state.value] : []
29
+ Array.isArray(field.state.value) ? field.state.value.filter(isNonNullable) : isNonNullable(field.state.value) ? [field.state.value] : []
29
30
  }
30
31
  onSelectionChange={keys => {
31
32
  const value = Array.from(keys) as string[]