soda-heroui 0.11.16 → 0.11.18

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.
Files changed (63) hide show
  1. package/dist/components/AutoRefresh.cjs +4 -4
  2. package/dist/components/AutoRefresh.d.ts +1 -1
  3. package/dist/components/AutoRefresh.js +4 -4
  4. package/dist/components/EnumSelect.d.ts +1 -1
  5. package/dist/components/FormAutocomplete.d.ts +1 -1
  6. package/dist/components/FormCalendar.cjs +1 -1
  7. package/dist/components/FormCalendar.d.ts +1 -1
  8. package/dist/components/FormCalendar.js +1 -1
  9. package/dist/components/FormCheckbox.d.ts +1 -1
  10. package/dist/components/FormCheckboxGroup.d.ts +1 -1
  11. package/dist/components/FormDateInput.cjs +1 -1
  12. package/dist/components/FormDateInput.d.ts +1 -1
  13. package/dist/components/FormDateInput.js +1 -1
  14. package/dist/components/FormDatePicker.cjs +1 -1
  15. package/dist/components/FormDatePicker.d.ts +1 -1
  16. package/dist/components/FormDatePicker.js +1 -1
  17. package/dist/components/FormDateRangePicker.cjs +1 -1
  18. package/dist/components/FormDateRangePicker.d.ts +1 -1
  19. package/dist/components/FormDateRangePicker.js +1 -1
  20. package/dist/components/FormInput.d.ts +1 -1
  21. package/dist/components/FormInputOtp.d.ts +1 -1
  22. package/dist/components/FormNumberInput.d.ts +1 -1
  23. package/dist/components/FormPagination.d.ts +1 -1
  24. package/dist/components/FormProvider.cjs +1 -1
  25. package/dist/components/FormProvider.js +1 -1
  26. package/dist/components/FormRadioGroup.d.ts +1 -1
  27. package/dist/components/FormRangeCalendar.cjs +1 -1
  28. package/dist/components/FormRangeCalendar.d.ts +1 -1
  29. package/dist/components/FormRangeCalendar.js +1 -1
  30. package/dist/components/FormSelect.cjs +1 -1
  31. package/dist/components/FormSelect.d.ts +1 -1
  32. package/dist/components/FormSelect.js +1 -1
  33. package/dist/components/FormSwitch.d.ts +1 -1
  34. package/dist/components/FormTextarea.d.ts +1 -1
  35. package/dist/components/FormTimeInput.cjs +1 -1
  36. package/dist/components/FormTimeInput.d.ts +1 -1
  37. package/dist/components/FormTimeInput.js +1 -1
  38. package/dist/utils/range.d.ts +1 -1
  39. package/dist/utils/time.d.ts +1 -1
  40. package/package.json +11 -11
  41. package/src/components/AutoRefresh.tsx +1 -1
  42. package/src/components/EnumSelect.tsx +46 -46
  43. package/src/components/ErrorMessage.tsx +1 -1
  44. package/src/components/FormAutocomplete.tsx +1 -1
  45. package/src/components/FormCalendar.tsx +1 -1
  46. package/src/components/FormCheckbox.tsx +1 -1
  47. package/src/components/FormCheckboxGroup.tsx +1 -1
  48. package/src/components/FormDateInput.tsx +1 -1
  49. package/src/components/FormDatePicker.tsx +1 -1
  50. package/src/components/FormDateRangePicker.tsx +1 -1
  51. package/src/components/FormInput.tsx +1 -1
  52. package/src/components/FormInputOtp.tsx +1 -1
  53. package/src/components/FormNumberInput.tsx +1 -1
  54. package/src/components/FormPagination.tsx +1 -1
  55. package/src/components/FormProvider.tsx +1 -1
  56. package/src/components/FormRadioGroup.tsx +1 -1
  57. package/src/components/FormRangeCalendar.tsx +1 -1
  58. package/src/components/FormSelect.tsx +62 -62
  59. package/src/components/FormSwitch.tsx +1 -1
  60. package/src/components/FormTextarea.tsx +1 -1
  61. package/src/components/FormTimeInput.tsx +1 -1
  62. package/src/utils/range.ts +1 -1
  63. package/src/utils/time.ts +1 -1
@@ -33,13 +33,13 @@ const AutoRefresh = ({ children, onRefresh, ...rest })=>{
33
33
  if ("development" === process.env.NODE_ENV) return children;
34
34
  function onPress(e) {
35
35
  var _e_target_parentElement;
36
- const closeButton = null == (_e_target_parentElement = e.target.parentElement) ? void 0 : _e_target_parentElement.querySelector(`[aria-label="\u{5173}\u{95ED}"]`);
36
+ const closeButton = null == (_e_target_parentElement = e.target.parentElement) ? void 0 : _e_target_parentElement.querySelector(`[aria-label="关闭"]`);
37
37
  null == closeButton || closeButton.click();
38
38
  null == onRefresh || onRefresh();
39
39
  }
40
40
  (0, external_soda_hooks_namespaceObject.useAutoRefresh)(()=>(0, react_namespaceObject.addToast)({
41
- title: "\u68C0\u6D4B\u5230\u9875\u9762\u66F4\u65B0",
42
- description: "\u4E3A\u4E86\u6700\u4F73\u7684\u4F53\u9A8C\uFF0C\u8BF7\u5237\u65B0\u9875\u9762",
41
+ title: "检测到页面更新",
42
+ description: "为了最佳的体验,请刷新页面",
43
43
  color: "warning",
44
44
  timeout: 1 / 0,
45
45
  endContent: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.Button, {
@@ -47,7 +47,7 @@ const AutoRefresh = ({ children, onRefresh, ...rest })=>{
47
47
  size: "sm",
48
48
  variant: "flat",
49
49
  onPress: onPress,
50
- children: "\u5237\u65B0"
50
+ children: "刷新"
51
51
  }),
52
52
  ...rest
53
53
  }));
@@ -1,5 +1,5 @@
1
- import { FC, ReactNode } from "react";
2
1
  import { addToast } from "@heroui/react";
2
+ import { FC, ReactNode } from "react";
3
3
  import { FirstParameter } from "soda-type";
4
4
  export interface AutoRefreshProps extends FirstParameter<typeof addToast> {
5
5
  onRefresh?: () => void;
@@ -5,13 +5,13 @@ const AutoRefresh = ({ children, onRefresh, ...rest })=>{
5
5
  if ("development" === process.env.NODE_ENV) return children;
6
6
  function onPress(e) {
7
7
  var _e_target_parentElement;
8
- const closeButton = null == (_e_target_parentElement = e.target.parentElement) ? void 0 : _e_target_parentElement.querySelector(`[aria-label="\u{5173}\u{95ED}"]`);
8
+ const closeButton = null == (_e_target_parentElement = e.target.parentElement) ? void 0 : _e_target_parentElement.querySelector(`[aria-label="关闭"]`);
9
9
  null == closeButton || closeButton.click();
10
10
  null == onRefresh || onRefresh();
11
11
  }
12
12
  useAutoRefresh(()=>addToast({
13
- title: "\u68C0\u6D4B\u5230\u9875\u9762\u66F4\u65B0",
14
- description: "\u4E3A\u4E86\u6700\u4F73\u7684\u4F53\u9A8C\uFF0C\u8BF7\u5237\u65B0\u9875\u9762",
13
+ title: "检测到页面更新",
14
+ description: "为了最佳的体验,请刷新页面",
15
15
  color: "warning",
16
16
  timeout: 1 / 0,
17
17
  endContent: /*#__PURE__*/ jsx(Button, {
@@ -19,7 +19,7 @@ const AutoRefresh = ({ children, onRefresh, ...rest })=>{
19
19
  size: "sm",
20
20
  variant: "flat",
21
21
  onPress: onPress,
22
- children: "\u5237\u65B0"
22
+ children: "刷新"
23
23
  }),
24
24
  ...rest
25
25
  }));
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
1
  import { EnumOption } from "deepsea-tools";
2
+ import { ReactNode } from "react";
3
3
  import { StrictOmit, ValueOf } from "soda-type";
4
4
  import { FormSelectProps, SelectionMode } from "./FormSelect";
5
5
  export interface EnumSelectProps<T extends Record<string, string>, Mode extends SelectionMode = "single", FieldValue extends (Mode extends "multiple" ? ValueOf<T>[] : ValueOf<T>) | null | undefined = (Mode extends "multiple" ? ValueOf<T>[] : ValueOf<T>) | null | undefined> extends StrictOmit<FormSelectProps<Mode, FieldValue, EnumOption<T>>, "children" | "items"> {
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
1
  import { Autocomplete, AutocompleteProps } from "@heroui/react";
2
+ import { ReactNode } from "react";
3
3
  import { FieldComponentProps } from "soda-tanstack-form";
4
4
  export interface FormAutocompleteProps<FieldValue extends string | null | undefined = string | null | undefined, RenderItem extends object = object> extends FieldComponentProps<typeof Autocomplete<RenderItem>, FieldValue> {
5
5
  component?: <T extends object>(props: AutocompleteProps<T>) => ReactNode;
@@ -28,8 +28,8 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  FormCalendar: ()=>FormCalendar
29
29
  });
30
30
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
- const external_react_namespaceObject = require("react");
32
31
  const react_namespaceObject = require("@heroui/react");
32
+ const external_react_namespaceObject = require("react");
33
33
  const external_FormProvider_cjs_namespaceObject = require("./FormProvider.cjs");
34
34
  const getFieldProps_cjs_namespaceObject = require("../utils/getFieldProps.cjs");
35
35
  const time_cjs_namespaceObject = require("../utils/time.cjs");
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
1
  import { Calendar, CalendarProps, DateValue } from "@heroui/react";
2
+ import { ReactNode } from "react";
3
3
  import { FieldComponentProps } from "soda-tanstack-form";
4
4
  import { StrictOmit } from "soda-type";
5
5
  import { EmptyValue } from "./FormProvider";
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { useContext } from "react";
4
3
  import { Calendar } from "@heroui/react";
4
+ import { useContext } from "react";
5
5
  import { FormContext } from "./FormProvider.js";
6
6
  import { getFieldProps } from "../utils/getFieldProps.js";
7
7
  import { getFieldValue, getOnChange } from "../utils/time.js";
@@ -1,5 +1,5 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from "react";
2
1
  import { As, CheckboxProps, MergeWithAs } from "@heroui/react";
2
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
3
3
  import { Field } from "soda-tanstack-form";
4
4
  export type FormCheckboxProps<FieldValue extends boolean | null | undefined = boolean | null | undefined, AsComponent extends As = "input"> = MergeWithAs<ComponentPropsWithoutRef<"input">, ComponentPropsWithoutRef<AsComponent>, CheckboxProps, AsComponent> & {
5
5
  field: Field<FieldValue>;
@@ -1,5 +1,5 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from "react";
2
1
  import { As, CheckboxGroupProps, MergeWithAs } from "@heroui/react";
2
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
3
3
  import { Field } from "soda-tanstack-form";
4
4
  export type FormCheckboxGroupProps<FieldValue extends string[] | null | undefined = string[] | null | undefined, AsComponent extends As = "div"> = MergeWithAs<ComponentPropsWithoutRef<"div">, ComponentPropsWithoutRef<AsComponent>, CheckboxGroupProps, AsComponent> & {
5
5
  field: Field<FieldValue>;
@@ -28,8 +28,8 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  FormDateInput: ()=>FormDateInput
29
29
  });
30
30
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
- const external_react_namespaceObject = require("react");
32
31
  const react_namespaceObject = require("@heroui/react");
32
+ const external_react_namespaceObject = require("react");
33
33
  const external_FormProvider_cjs_namespaceObject = require("./FormProvider.cjs");
34
34
  const getFieldProps_cjs_namespaceObject = require("../utils/getFieldProps.cjs");
35
35
  const time_cjs_namespaceObject = require("../utils/time.cjs");
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
1
  import { DateInput, DateInputProps, DateValue } from "@heroui/react";
2
+ import { ReactNode } from "react";
3
3
  import { FieldComponentProps } from "soda-tanstack-form";
4
4
  import { StrictOmit } from "soda-type";
5
5
  import { EmptyValue } from "./FormProvider";
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { useContext } from "react";
4
3
  import { DateInput } from "@heroui/react";
4
+ import { useContext } from "react";
5
5
  import { FormContext } from "./FormProvider.js";
6
6
  import { getFieldProps } from "../utils/getFieldProps.js";
7
7
  import { getFieldValue, getOnChange } from "../utils/time.js";
@@ -28,8 +28,8 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  FormDatePicker: ()=>FormDatePicker
29
29
  });
30
30
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
- const external_react_namespaceObject = require("react");
32
31
  const react_namespaceObject = require("@heroui/react");
32
+ const external_react_namespaceObject = require("react");
33
33
  const external_FormProvider_cjs_namespaceObject = require("./FormProvider.cjs");
34
34
  const getFieldProps_cjs_namespaceObject = require("../utils/getFieldProps.cjs");
35
35
  const time_cjs_namespaceObject = require("../utils/time.cjs");
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
1
  import { DatePicker, DatePickerProps, DateValue } from "@heroui/react";
2
+ import { ReactNode } from "react";
3
3
  import { FieldComponentProps } from "soda-tanstack-form";
4
4
  import { StrictOmit } from "soda-type";
5
5
  import { EmptyValue } from "./FormProvider";
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { useContext } from "react";
4
3
  import { DatePicker } from "@heroui/react";
4
+ import { useContext } from "react";
5
5
  import { FormContext } from "./FormProvider.js";
6
6
  import { getFieldProps } from "../utils/getFieldProps.js";
7
7
  import { getFieldValue, getOnChange } from "../utils/time.js";
@@ -28,8 +28,8 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  FormDateRangePicker: ()=>FormDateRangePicker
29
29
  });
30
30
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
- const external_react_namespaceObject = require("react");
32
31
  const react_namespaceObject = require("@heroui/react");
32
+ const external_react_namespaceObject = require("react");
33
33
  const external_FormProvider_cjs_namespaceObject = require("./FormProvider.cjs");
34
34
  const getFieldProps_cjs_namespaceObject = require("../utils/getFieldProps.cjs");
35
35
  const range_cjs_namespaceObject = require("../utils/range.cjs");
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
1
  import { DateRangePicker, DateRangePickerProps, DateValue } from "@heroui/react";
2
+ import { ReactNode } from "react";
3
3
  import { FieldComponentProps } from "soda-tanstack-form";
4
4
  import { StrictOmit } from "soda-type";
5
5
  import { EmptyValue } from "./FormProvider";
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { useContext } from "react";
4
3
  import { DateRangePicker } from "@heroui/react";
4
+ import { useContext } from "react";
5
5
  import { FormContext } from "./FormProvider.js";
6
6
  import { getFieldProps } from "../utils/getFieldProps.js";
7
7
  import { getFieldRangeValue, getOnRangeChange } from "../utils/range.js";
@@ -1,5 +1,5 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from "react";
2
1
  import { As, InputProps, MergeWithAs } from "@heroui/react";
2
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
3
3
  import { Field } from "soda-tanstack-form";
4
4
  export type FormInputProps<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "input"> = MergeWithAs<ComponentPropsWithoutRef<"input">, ComponentPropsWithoutRef<AsComponent>, InputProps, AsComponent> & {
5
5
  field: Field<FieldValue>;
@@ -1,5 +1,5 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from "react";
2
1
  import { As, InputOtpProps, MergeWithAs } from "@heroui/react";
2
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
3
3
  import { Field } from "soda-tanstack-form";
4
4
  export type FormInputOtpProps<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "input"> = MergeWithAs<ComponentPropsWithoutRef<"input">, ComponentPropsWithoutRef<AsComponent>, InputOtpProps, AsComponent> & {
5
5
  field: Field<FieldValue>;
@@ -1,5 +1,5 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from "react";
2
1
  import { As, MergeWithAs, NumberInputProps } from "@heroui/react";
2
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
3
3
  import { Field } from "soda-tanstack-form";
4
4
  export type FormNumberInputProps<FieldValue extends number | null | undefined = number | null | undefined, AsComponent extends As = "input"> = MergeWithAs<ComponentPropsWithoutRef<"input">, ComponentPropsWithoutRef<AsComponent>, NumberInputProps, AsComponent> & {
5
5
  field: Field<FieldValue>;
@@ -1,5 +1,5 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from "react";
2
1
  import { As, MergeWithAs, PaginationProps } from "@heroui/react";
2
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
3
3
  import { Field } from "soda-tanstack-form";
4
4
  export type FormPaginationProps<FieldValue extends number | null | undefined = number | null | undefined, AsComponent extends As = "nav"> = MergeWithAs<ComponentPropsWithoutRef<"nav">, ComponentPropsWithoutRef<AsComponent>, PaginationProps, AsComponent> & {
5
5
  field: Field<FieldValue>;
@@ -30,8 +30,8 @@ __webpack_require__.d(__webpack_exports__, {
30
30
  getEmptyValue: ()=>getEmptyValue
31
31
  });
32
32
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
33
- const external_react_namespaceObject = require("react");
34
33
  const external_deepsea_tools_namespaceObject = require("deepsea-tools");
34
+ const external_react_namespaceObject = require("react");
35
35
  function getEmptyValue(value) {
36
36
  return "undefined" === value ? void 0 : null;
37
37
  }
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { createContext, useContext } from "react";
4
3
  import { assign as external_deepsea_tools_assign } from "deepsea-tools";
4
+ import { createContext, useContext } from "react";
5
5
  function getEmptyValue(value) {
6
6
  return "undefined" === value ? void 0 : null;
7
7
  }
@@ -1,5 +1,5 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from "react";
2
1
  import { As, MergeWithAs, RadioGroupProps } from "@heroui/react";
2
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
3
3
  import { Field } from "soda-tanstack-form";
4
4
  export type FormRadioGroupProps<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "div"> = MergeWithAs<ComponentPropsWithoutRef<"div">, ComponentPropsWithoutRef<AsComponent>, RadioGroupProps, AsComponent> & {
5
5
  field: Field<FieldValue>;
@@ -28,8 +28,8 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  FormRangeCalendar: ()=>FormRangeCalendar
29
29
  });
30
30
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
- const external_react_namespaceObject = require("react");
32
31
  const react_namespaceObject = require("@heroui/react");
32
+ const external_react_namespaceObject = require("react");
33
33
  const external_FormProvider_cjs_namespaceObject = require("./FormProvider.cjs");
34
34
  const getFieldProps_cjs_namespaceObject = require("../utils/getFieldProps.cjs");
35
35
  const range_cjs_namespaceObject = require("../utils/range.cjs");
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
1
  import { DateValue, RangeCalendar, RangeCalendarProps } from "@heroui/react";
2
+ import { ReactNode } from "react";
3
3
  import { FieldComponentProps } from "soda-tanstack-form";
4
4
  import { StrictOmit } from "soda-type";
5
5
  import { EmptyValue } from "./FormProvider";
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { useContext } from "react";
4
3
  import { RangeCalendar } from "@heroui/react";
4
+ import { useContext } from "react";
5
5
  import { FormContext } from "./FormProvider.js";
6
6
  import { getFieldProps } from "../utils/getFieldProps.js";
7
7
  import { getFieldRangeValue, getOnRangeChange } from "../utils/range.js";
@@ -28,9 +28,9 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  FormSelect: ()=>FormSelect
29
29
  });
30
30
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
- const external_react_namespaceObject = require("react");
32
31
  const react_namespaceObject = require("@heroui/react");
33
32
  const external_deepsea_tools_namespaceObject = require("deepsea-tools");
33
+ const external_react_namespaceObject = require("react");
34
34
  const getFieldProps_cjs_namespaceObject = require("../utils/getFieldProps.cjs");
35
35
  const external_FormProvider_cjs_namespaceObject = require("./FormProvider.cjs");
36
36
  function FormSelect({ field, emptyValue, component: Select2 = react_namespaceObject.Select, selectionMode, labelPlacement, classNames: { base, label, ...restClassNames } = {}, ...rest }) {
@@ -1,6 +1,6 @@
1
- import { ReactNode } from "react";
2
1
  import { Select, SelectProps } from "@heroui/react";
3
2
  import { Key } from "@react-types/shared";
3
+ import { ReactNode } from "react";
4
4
  import { FieldComponentProps } from "soda-tanstack-form";
5
5
  import { StrictOmit } from "soda-type";
6
6
  import { EmptyValue } from "./FormProvider";
@@ -1,8 +1,8 @@
1
1
  "use client"
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { useContext } from "react";
4
3
  import { Select } from "@heroui/react";
5
4
  import { clsx, isNonNullable } from "deepsea-tools";
5
+ import { useContext } from "react";
6
6
  import { getFieldProps } from "../utils/getFieldProps.js";
7
7
  import { FormContext, getEmptyValue } from "./FormProvider.js";
8
8
  function FormSelect({ field, emptyValue, component: Select2 = Select, selectionMode, labelPlacement, classNames: { base, label, ...restClassNames } = {}, ...rest }) {
@@ -1,5 +1,5 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from "react";
2
1
  import { As, MergeWithAs, SwitchProps } from "@heroui/react";
2
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
3
3
  import { Field } from "soda-tanstack-form";
4
4
  export type FormSwitchProps<FieldValue extends boolean | null | undefined = boolean | null | undefined, AsComponent extends As = "input"> = MergeWithAs<ComponentPropsWithoutRef<"input">, ComponentPropsWithoutRef<AsComponent>, SwitchProps, AsComponent> & {
5
5
  field: Field<FieldValue>;
@@ -1,5 +1,5 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from "react";
2
1
  import { As, MergeWithAs, TextAreaProps } from "@heroui/react";
2
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
3
3
  import { Field } from "soda-tanstack-form";
4
4
  export type FormTextareaProps<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "textarea"> = MergeWithAs<ComponentPropsWithoutRef<"input">, ComponentPropsWithoutRef<AsComponent>, TextAreaProps, AsComponent> & {
5
5
  field: Field<FieldValue>;
@@ -28,8 +28,8 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  FormTimeInput: ()=>FormTimeInput
29
29
  });
30
30
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
- const external_react_namespaceObject = require("react");
32
31
  const react_namespaceObject = require("@heroui/react");
32
+ const external_react_namespaceObject = require("react");
33
33
  const external_FormProvider_cjs_namespaceObject = require("./FormProvider.cjs");
34
34
  const getFieldProps_cjs_namespaceObject = require("../utils/getFieldProps.cjs");
35
35
  const time_cjs_namespaceObject = require("../utils/time.cjs");
@@ -1,6 +1,6 @@
1
- import { ReactNode } from "react";
2
1
  import { TimeInput, TimeInputProps } from "@heroui/react";
3
2
  import { CalendarDateTime, Time, ZonedDateTime } from "@internationalized/date";
3
+ import { ReactNode } from "react";
4
4
  import { FieldComponentProps } from "soda-tanstack-form";
5
5
  import { StrictOmit } from "soda-type";
6
6
  import { EmptyValue } from "./FormProvider";
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { useContext } from "react";
4
3
  import { TimeInput } from "@heroui/react";
4
+ import { useContext } from "react";
5
5
  import { FormContext } from "./FormProvider.js";
6
6
  import { getFieldProps } from "../utils/getFieldProps.js";
7
7
  import { getFieldValue, getOnChange } from "../utils/time.js";
@@ -1,5 +1,5 @@
1
- import { SetStateAction } from "react";
2
1
  import { DateValue, RangeValue } from "@heroui/react";
2
+ import { SetStateAction } from "react";
3
3
  import { Field } from "soda-tanstack-form";
4
4
  import { EmptyValue } from "../components/FormProvider";
5
5
  import { DefaultTime } from "./getTimeValue";
@@ -1,5 +1,5 @@
1
- import { SetStateAction } from "react";
2
1
  import { CalendarDate, CalendarDateTime, Time, ZonedDateTime } from "@internationalized/date";
2
+ import { SetStateAction } from "react";
3
3
  import { Field } from "soda-tanstack-form";
4
4
  import { EmptyValue } from "../components/FormProvider";
5
5
  import { DefaultTime } from "./getTimeValue";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soda-heroui",
3
- "version": "0.11.16",
3
+ "version": "0.11.18",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
@@ -35,20 +35,20 @@
35
35
  },
36
36
  "homepage": "https://github.com/1adybug/deepsea/tree/main/packages/soda-heroui",
37
37
  "dependencies": {
38
- "@internationalized/date": "^3.8.2",
39
- "@tanstack/react-form": "^1.19.0",
40
- "soda-type": "6.7.0",
41
- "deepsea-tools": "5.42.2",
42
- "soda-hooks": "6.14.6",
43
- "soda-tanstack-form": "0.2.5"
38
+ "@internationalized/date": "^3.10.0",
39
+ "@tanstack/react-form": "^1.23.6",
40
+ "deepsea-tools": "5.42.3",
41
+ "soda-hooks": "6.15.1",
42
+ "soda-tanstack-form": "0.3.1",
43
+ "soda-type": "6.7.1"
44
44
  },
45
45
  "devDependencies": {
46
- "@ianvs/prettier-plugin-sort-imports": "^4.6.0",
47
- "@react-types/shared": "^3.31.0",
46
+ "@ianvs/prettier-plugin-sort-imports": "^4.7.0",
47
+ "@react-types/shared": "^3.32.1",
48
48
  "glob": "^11.0.3",
49
49
  "prettier": "^3.6.2",
50
- "prettier-plugin-organize-imports": "^4.2.0",
51
- "typescript": "^5.9.2"
50
+ "prettier-plugin-organize-imports": "^4.3.0",
51
+ "typescript": "^5.9.3"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@types/node": ">=20",
@@ -1,5 +1,5 @@
1
- import { FC, ReactNode } from "react"
2
1
  import { Button, PressEvent, addToast } from "@heroui/react"
2
+ import { FC, ReactNode } from "react"
3
3
  import { useAutoRefresh } from "soda-hooks"
4
4
  import { FirstParameter } from "soda-type"
5
5
 
@@ -1,46 +1,46 @@
1
- "use client"
2
-
3
- import { ReactNode } from "react"
4
- import { SelectItem } from "@heroui/react"
5
- import { EnumOption, getEnumOptions } from "deepsea-tools"
6
- import { StrictOmit, ValueOf } from "soda-type"
7
-
8
- import { FormSelect, FormSelectProps, SelectionMode } from "./FormSelect"
9
-
10
- export interface EnumSelectProps<
11
- T extends Record<string, string>,
12
- Mode extends SelectionMode = "single",
13
- FieldValue extends (Mode extends "multiple" ? ValueOf<T>[] : ValueOf<T>) | null | undefined =
14
- | (Mode extends "multiple" ? ValueOf<T>[] : ValueOf<T>)
15
- | null
16
- | undefined,
17
- > extends StrictOmit<FormSelectProps<Mode, FieldValue, EnumOption<T>>, "children" | "items"> {
18
- enumObject: T
19
- }
20
-
21
- export function EnumSelect<
22
- T extends Record<string, string>,
23
- Mode extends SelectionMode = "single",
24
- FieldValue extends (Mode extends "multiple" ? ValueOf<T>[] : ValueOf<T>) | null | undefined =
25
- | (Mode extends "multiple" ? ValueOf<T>[] : ValueOf<T>)
26
- | null
27
- | undefined,
28
- >({ enumObject, ...rest }: EnumSelectProps<T, Mode, FieldValue>): ReactNode {
29
- return (
30
- <FormSelect items={getEnumOptions(enumObject)} {...rest}>
31
- {({ label, value }) => <SelectItem key={value}>{label}</SelectItem>}
32
- </FormSelect>
33
- )
34
- }
35
-
36
- export function createEnumSelect<T extends Record<string, string>>(enumObject: T) {
37
- return function FormSelect<
38
- Mode extends SelectionMode = "single",
39
- FieldValue extends (Mode extends "multiple" ? ValueOf<T>[] : ValueOf<T>) | null | undefined =
40
- | (Mode extends "multiple" ? ValueOf<T>[] : ValueOf<T>)
41
- | null
42
- | undefined,
43
- >(props: StrictOmit<EnumSelectProps<T, Mode, FieldValue>, "enumObject">) {
44
- return <EnumSelect enumObject={enumObject} {...props} />
45
- }
46
- }
1
+ "use client"
2
+
3
+ import { SelectItem } from "@heroui/react"
4
+ import { EnumOption, getEnumOptions } from "deepsea-tools"
5
+ import { ReactNode } from "react"
6
+ import { StrictOmit, ValueOf } from "soda-type"
7
+
8
+ import { FormSelect, FormSelectProps, SelectionMode } from "./FormSelect"
9
+
10
+ export interface EnumSelectProps<
11
+ T extends Record<string, string>,
12
+ Mode extends SelectionMode = "single",
13
+ FieldValue extends (Mode extends "multiple" ? ValueOf<T>[] : ValueOf<T>) | null | undefined =
14
+ | (Mode extends "multiple" ? ValueOf<T>[] : ValueOf<T>)
15
+ | null
16
+ | undefined,
17
+ > extends StrictOmit<FormSelectProps<Mode, FieldValue, EnumOption<T>>, "children" | "items"> {
18
+ enumObject: T
19
+ }
20
+
21
+ export function EnumSelect<
22
+ T extends Record<string, string>,
23
+ Mode extends SelectionMode = "single",
24
+ FieldValue extends (Mode extends "multiple" ? ValueOf<T>[] : ValueOf<T>) | null | undefined =
25
+ | (Mode extends "multiple" ? ValueOf<T>[] : ValueOf<T>)
26
+ | null
27
+ | undefined,
28
+ >({ enumObject, ...rest }: EnumSelectProps<T, Mode, FieldValue>): ReactNode {
29
+ return (
30
+ <FormSelect items={getEnumOptions(enumObject)} {...rest}>
31
+ {({ label, value }) => <SelectItem key={value}>{label}</SelectItem>}
32
+ </FormSelect>
33
+ )
34
+ }
35
+
36
+ export function createEnumSelect<T extends Record<string, string>>(enumObject: T) {
37
+ return function FormSelect<
38
+ Mode extends SelectionMode = "single",
39
+ FieldValue extends (Mode extends "multiple" ? ValueOf<T>[] : ValueOf<T>) | null | undefined =
40
+ | (Mode extends "multiple" ? ValueOf<T>[] : ValueOf<T>)
41
+ | null
42
+ | undefined,
43
+ >(props: StrictOmit<EnumSelectProps<T, Mode, FieldValue>, "enumObject">) {
44
+ return <EnumSelect enumObject={enumObject} {...props} />
45
+ }
46
+ }
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { ComponentProps, FC } from "react"
4
3
  import { isNonNullable } from "deepsea-tools"
4
+ import { ComponentProps, FC } from "react"
5
5
 
6
6
  export interface ErrorMessageItem {
7
7
  message: string
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { Key, ReactNode } from "react"
4
3
  import { Autocomplete, AutocompleteProps } from "@heroui/react"
4
+ import { Key, ReactNode } from "react"
5
5
  import { FieldComponentProps } from "soda-tanstack-form"
6
6
 
7
7
  import { getFieldProps } from "../utils/getFieldProps"
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { ReactNode, useContext } from "react"
4
3
  import { Calendar, CalendarProps, DateValue } from "@heroui/react"
4
+ import { ReactNode, useContext } from "react"
5
5
  import { FieldComponentProps } from "soda-tanstack-form"
6
6
  import { StrictOmit } from "soda-type"
7
7
 
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { ComponentPropsWithoutRef, ReactNode } from "react"
4
3
  import { As, Checkbox, CheckboxProps, MergeWithAs } from "@heroui/react"
4
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
5
5
  import { Field } from "soda-tanstack-form"
6
6
 
7
7
  import { getFieldProps } from "../utils/getFieldProps"
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { ComponentPropsWithoutRef, ReactNode } from "react"
4
3
  import { As, CheckboxGroup, CheckboxGroupProps, MergeWithAs } from "@heroui/react"
4
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
5
5
  import { Field } from "soda-tanstack-form"
6
6
 
7
7
  import { getFieldProps } from "../utils/getFieldProps"
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { ReactNode, useContext } from "react"
4
3
  import { DateInput, DateInputProps, DateValue } from "@heroui/react"
4
+ import { ReactNode, useContext } from "react"
5
5
  import { FieldComponentProps } from "soda-tanstack-form"
6
6
  import { StrictOmit } from "soda-type"
7
7
 
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { ReactNode, useContext } from "react"
4
3
  import { DatePicker, DatePickerProps, DateValue } from "@heroui/react"
4
+ import { ReactNode, useContext } from "react"
5
5
  import { FieldComponentProps } from "soda-tanstack-form"
6
6
  import { StrictOmit } from "soda-type"
7
7
 
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { ReactNode, useContext } from "react"
4
3
  import { DateRangePicker, DateRangePickerProps, DateValue } from "@heroui/react"
4
+ import { ReactNode, useContext } from "react"
5
5
  import { Field, FieldComponentProps } from "soda-tanstack-form"
6
6
  import { StrictOmit } from "soda-type"
7
7
 
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { ComponentPropsWithoutRef, ReactNode } from "react"
4
3
  import { As, Input, InputProps, MergeWithAs } from "@heroui/react"
4
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
5
5
  import { Field } from "soda-tanstack-form"
6
6
 
7
7
  import { getFieldProps } from "../utils/getFieldProps"
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { ComponentPropsWithoutRef, ReactNode } from "react"
4
3
  import { As, InputOtp, InputOtpProps, MergeWithAs } from "@heroui/react"
4
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
5
5
  import { Field } from "soda-tanstack-form"
6
6
 
7
7
  import { getFieldProps } from "../utils/getFieldProps"
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { ComponentPropsWithoutRef, ReactNode } from "react"
4
3
  import { As, MergeWithAs, NumberInput, NumberInputProps } from "@heroui/react"
4
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
5
5
  import { Field } from "soda-tanstack-form"
6
6
 
7
7
  import { getFieldProps } from "../utils/getFieldProps"
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { ComponentPropsWithoutRef, ReactNode } from "react"
4
3
  import { As, MergeWithAs, Pagination, PaginationProps } from "@heroui/react"
4
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
5
5
  import { Field } from "soda-tanstack-form"
6
6
 
7
7
  import { getFieldProps } from "../utils/getFieldProps"
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { FC, ReactNode, createContext, useContext } from "react"
4
3
  import { assign } from "deepsea-tools"
4
+ import { FC, ReactNode, createContext, useContext } from "react"
5
5
 
6
6
  export type EmptyValue = "null" | "undefined"
7
7
 
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { ComponentPropsWithoutRef, ReactNode } from "react"
4
3
  import { As, MergeWithAs, RadioGroup, RadioGroupProps } from "@heroui/react"
4
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
5
5
  import { Field } from "soda-tanstack-form"
6
6
 
7
7
  import { getFieldProps } from "../utils/getFieldProps"
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { ReactNode, useContext } from "react"
4
3
  import { DateValue, RangeCalendar, RangeCalendarProps } from "@heroui/react"
4
+ import { ReactNode, useContext } from "react"
5
5
  import { Field, FieldComponentProps } from "soda-tanstack-form"
6
6
  import { StrictOmit } from "soda-type"
7
7
 
@@ -1,62 +1,62 @@
1
- "use client"
2
-
3
- import { ReactNode, useContext } from "react"
4
- import { Select, SelectProps } from "@heroui/react"
5
- import { Key } from "@react-types/shared"
6
- import { clsx, isNonNullable } from "deepsea-tools"
7
- import { FieldComponentProps } from "soda-tanstack-form"
8
- import { StrictOmit } from "soda-type"
9
-
10
- import { getFieldProps } from "../utils/getFieldProps"
11
- import { EmptyValue, FormContext, getEmptyValue } from "./FormProvider"
12
-
13
- export type SelectionMode = "single" | "multiple"
14
-
15
- export type SelectLabelPlacement = "inside" | "outside" | "outside-left" | "outside-top"
16
-
17
- export interface FormSelectProps<
18
- Mode extends SelectionMode = "single",
19
- Value extends (Mode extends "multiple" ? Key[] : Key) | null | undefined = (Mode extends "multiple" ? Key[] : Key) | null | undefined,
20
- RenderItem extends object = object,
21
- > extends StrictOmit<FieldComponentProps<typeof Select<RenderItem>, Value>, "selectionMode" | "labelPlacement"> {
22
- labelPlacement?: SelectLabelPlacement
23
- selectionMode?: Mode
24
- emptyValue?: EmptyValue
25
- component?: <RenderItem extends object>(props: SelectProps<RenderItem>) => ReactNode
26
- }
27
-
28
- export function FormSelect<
29
- Mode extends SelectionMode = "single",
30
- Value extends (Mode extends "multiple" ? Key[] : Key) | null | undefined = (Mode extends "multiple" ? Key[] : Key) | null | undefined,
31
- RenderItem extends object = object,
32
- >({
33
- field,
34
- emptyValue,
35
- component: Select2 = Select,
36
- selectionMode,
37
- labelPlacement,
38
- classNames: { base, label, ...restClassNames } = {},
39
- ...rest
40
- }: FormSelectProps<Mode, Value, RenderItem>): ReactNode {
41
- const context = useContext(FormContext)
42
- emptyValue ??= context.emptyValue
43
-
44
- return (
45
- <Select2<RenderItem>
46
- classNames={{
47
- base: clsx(labelPlacement === "outside-top" && "flex flex-col", base),
48
- label: clsx(labelPlacement === "outside-top" && "pb-2", label),
49
- ...restClassNames,
50
- }}
51
- selectedKeys={isNonNullable(field.state.value) ? (selectionMode === "multiple" ? (field.state.value as Key[]) : [field.state.value as Key]) : []}
52
- onSelectionChange={keys => {
53
- const value = Array.from(keys)
54
- field.handleChange((selectionMode === "multiple" ? value : (value.at(0) ?? getEmptyValue(emptyValue))) as Value)
55
- }}
56
- selectionMode={selectionMode}
57
- labelPlacement={labelPlacement === "outside-top" ? "outside-left" : labelPlacement}
58
- {...getFieldProps(field)}
59
- {...rest}
60
- />
61
- )
62
- }
1
+ "use client"
2
+
3
+ import { Select, SelectProps } from "@heroui/react"
4
+ import { Key } from "@react-types/shared"
5
+ import { clsx, isNonNullable } from "deepsea-tools"
6
+ import { ReactNode, useContext } from "react"
7
+ import { FieldComponentProps } from "soda-tanstack-form"
8
+ import { StrictOmit } from "soda-type"
9
+
10
+ import { getFieldProps } from "../utils/getFieldProps"
11
+ import { EmptyValue, FormContext, getEmptyValue } from "./FormProvider"
12
+
13
+ export type SelectionMode = "single" | "multiple"
14
+
15
+ export type SelectLabelPlacement = "inside" | "outside" | "outside-left" | "outside-top"
16
+
17
+ export interface FormSelectProps<
18
+ Mode extends SelectionMode = "single",
19
+ Value extends (Mode extends "multiple" ? Key[] : Key) | null | undefined = (Mode extends "multiple" ? Key[] : Key) | null | undefined,
20
+ RenderItem extends object = object,
21
+ > extends StrictOmit<FieldComponentProps<typeof Select<RenderItem>, Value>, "selectionMode" | "labelPlacement"> {
22
+ labelPlacement?: SelectLabelPlacement
23
+ selectionMode?: Mode
24
+ emptyValue?: EmptyValue
25
+ component?: <RenderItem extends object>(props: SelectProps<RenderItem>) => ReactNode
26
+ }
27
+
28
+ export function FormSelect<
29
+ Mode extends SelectionMode = "single",
30
+ Value extends (Mode extends "multiple" ? Key[] : Key) | null | undefined = (Mode extends "multiple" ? Key[] : Key) | null | undefined,
31
+ RenderItem extends object = object,
32
+ >({
33
+ field,
34
+ emptyValue,
35
+ component: Select2 = Select,
36
+ selectionMode,
37
+ labelPlacement,
38
+ classNames: { base, label, ...restClassNames } = {},
39
+ ...rest
40
+ }: FormSelectProps<Mode, Value, RenderItem>): ReactNode {
41
+ const context = useContext(FormContext)
42
+ emptyValue ??= context.emptyValue
43
+
44
+ return (
45
+ <Select2<RenderItem>
46
+ classNames={{
47
+ base: clsx(labelPlacement === "outside-top" && "flex flex-col", base),
48
+ label: clsx(labelPlacement === "outside-top" && "pb-2", label),
49
+ ...restClassNames,
50
+ }}
51
+ selectedKeys={isNonNullable(field.state.value) ? (selectionMode === "multiple" ? (field.state.value as Key[]) : [field.state.value as Key]) : []}
52
+ onSelectionChange={keys => {
53
+ const value = Array.from(keys)
54
+ field.handleChange((selectionMode === "multiple" ? value : (value.at(0) ?? getEmptyValue(emptyValue))) as Value)
55
+ }}
56
+ selectionMode={selectionMode}
57
+ labelPlacement={labelPlacement === "outside-top" ? "outside-left" : labelPlacement}
58
+ {...getFieldProps(field)}
59
+ {...rest}
60
+ />
61
+ )
62
+ }
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { ComponentPropsWithoutRef, ReactNode } from "react"
4
3
  import { As, MergeWithAs, Switch, SwitchProps } from "@heroui/react"
4
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
5
5
  import { Field } from "soda-tanstack-form"
6
6
 
7
7
  import { getFieldProps } from "../utils/getFieldProps"
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- import { ComponentPropsWithoutRef, ReactNode } from "react"
4
3
  import { As, MergeWithAs, TextAreaProps, Textarea } from "@heroui/react"
4
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
5
5
  import { Field } from "soda-tanstack-form"
6
6
 
7
7
  import { getFieldProps } from "../utils/getFieldProps"
@@ -1,8 +1,8 @@
1
1
  "use client"
2
2
 
3
- import { ReactNode, useContext } from "react"
4
3
  import { TimeInput, TimeInputProps } from "@heroui/react"
5
4
  import { CalendarDateTime, Time, ZonedDateTime } from "@internationalized/date"
5
+ import { ReactNode, useContext } from "react"
6
6
  import { FieldComponentProps } from "soda-tanstack-form"
7
7
  import { StrictOmit } from "soda-type"
8
8
 
@@ -1,6 +1,6 @@
1
- import { SetStateAction } from "react"
2
1
  import { DateValue, RangeValue } from "@heroui/react"
3
2
  import { isNonNullable } from "deepsea-tools"
3
+ import { SetStateAction } from "react"
4
4
  import { Field } from "soda-tanstack-form"
5
5
 
6
6
  import { EmptyValue, getEmptyValue } from "@/components/FormProvider"
package/src/utils/time.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { SetStateAction } from "react"
2
1
  import { CalendarDate, CalendarDateTime, Time, ZonedDateTime } from "@internationalized/date"
3
2
  import { isNonNullable } from "deepsea-tools"
3
+ import { SetStateAction } from "react"
4
4
  import { Field } from "soda-tanstack-form"
5
5
 
6
6
  import { EmptyValue, getEmptyValue } from "@/components/FormProvider"