haze-ui 1.12.0 → 1.12.2

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 (98) hide show
  1. package/README.md +36 -24
  2. package/dist/components/Checkbox/Checkbox.js +13 -20
  3. package/dist/components/Checkbox/CheckboxCore.js +23 -0
  4. package/dist/components/ColorPicker/ColorPicker.js +13 -42
  5. package/dist/components/ColorPicker/ColorPickerCore.js +36 -0
  6. package/dist/components/DateRangePicker/DateRangePicker.js +17 -35
  7. package/dist/components/DateRangePicker/DateRangePickerCore.js +31 -0
  8. package/dist/components/Datepicker/Datepicker.js +15 -39
  9. package/dist/components/Datepicker/DatepickerCore.js +42 -0
  10. package/dist/components/Input/Input.js +11 -22
  11. package/dist/components/Input/InputCore.js +26 -0
  12. package/dist/components/NumberInput/NumberInput.js +16 -53
  13. package/dist/components/NumberInput/NumberInputCore.js +56 -0
  14. package/dist/components/OTPInput/OTPInput.js +11 -45
  15. package/dist/components/OTPInput/OTPInputCore.js +43 -0
  16. package/dist/components/PasswordInput/PasswordInput.js +14 -29
  17. package/dist/components/PasswordInput/PasswordInputCore.js +30 -0
  18. package/dist/components/Radio/RadioGroup.js +12 -21
  19. package/dist/components/Radio/RadioGroupCore.js +24 -0
  20. package/dist/components/Rating/Rating.js +14 -46
  21. package/dist/components/Rating/RatingCore.js +48 -0
  22. package/dist/components/Segmented/Segmented.js +12 -37
  23. package/dist/components/Segmented/SegmentedCore.js +39 -0
  24. package/dist/components/Select/Select.js +12 -23
  25. package/dist/components/Select/SelectCore.js +27 -0
  26. package/dist/components/Slider/Slider.js +10 -15
  27. package/dist/components/Slider/SliderCore.js +19 -0
  28. package/dist/components/Switch/Switch.js +11 -38
  29. package/dist/components/Switch/SwitchCore.js +42 -0
  30. package/dist/components/TagInput/TagInput.js +18 -72
  31. package/dist/components/TagInput/TagInputCore.js +68 -0
  32. package/dist/components/Textarea/Textarea.js +11 -22
  33. package/dist/components/Textarea/TextareaCore.js +26 -0
  34. package/dist/components/TimePicker/TimePicker.js +10 -15
  35. package/dist/components/TimePicker/TimePickerCore.js +18 -0
  36. package/dist/css/checkbox.css +1 -1
  37. package/dist/css/color-picker.css +1 -1
  38. package/dist/css/date-range-picker.css +1 -1
  39. package/dist/css/datepicker.css +1 -1
  40. package/dist/css/input.css +1 -1
  41. package/dist/css/number-input.css +1 -1
  42. package/dist/css/otp-input.css +1 -1
  43. package/dist/css/password-input.css +1 -1
  44. package/dist/css/radio.css +1 -1
  45. package/dist/css/rating.css +1 -1
  46. package/dist/css/segmented.css +1 -1
  47. package/dist/css/select.css +1 -1
  48. package/dist/css/slider.css +1 -1
  49. package/dist/css/switch.css +1 -1
  50. package/dist/css/tag-input.css +1 -1
  51. package/dist/css/textarea.css +1 -1
  52. package/dist/css/time-picker.css +1 -1
  53. package/dist/form/FormItem.js +32 -32
  54. package/dist/haze-ui.css +17 -17
  55. package/dist/index.js +138 -122
  56. package/dist/types/components/Checkbox/CheckboxCore.d.ts +12 -0
  57. package/dist/types/components/Checkbox/index.d.ts +2 -0
  58. package/dist/types/components/ColorPicker/ColorPickerCore.d.ts +8 -0
  59. package/dist/types/components/ColorPicker/index.d.ts +2 -0
  60. package/dist/types/components/DateRangePicker/DateRangePickerCore.d.ts +11 -0
  61. package/dist/types/components/DateRangePicker/index.d.ts +2 -0
  62. package/dist/types/components/Datepicker/DatepickerCore.d.ts +12 -0
  63. package/dist/types/components/Datepicker/index.d.ts +2 -0
  64. package/dist/types/components/Input/InputCore.d.ts +13 -0
  65. package/dist/types/components/Input/index.d.ts +2 -0
  66. package/dist/types/components/NumberInput/NumberInputCore.d.ts +15 -0
  67. package/dist/types/components/NumberInput/index.d.ts +2 -0
  68. package/dist/types/components/OTPInput/OTPInputCore.d.ts +8 -0
  69. package/dist/types/components/OTPInput/index.d.ts +2 -0
  70. package/dist/types/components/PasswordInput/PasswordInputCore.d.ts +9 -0
  71. package/dist/types/components/PasswordInput/index.d.ts +2 -0
  72. package/dist/types/components/Radio/RadioContext.d.ts +1 -2
  73. package/dist/types/components/Radio/RadioGroupCore.d.ts +10 -0
  74. package/dist/types/components/Radio/index.d.ts +2 -0
  75. package/dist/types/components/Rating/RatingCore.d.ts +9 -0
  76. package/dist/types/components/Rating/index.d.ts +2 -0
  77. package/dist/types/components/Segmented/Segmented.d.ts +1 -6
  78. package/dist/types/components/Segmented/SegmentedCore.d.ts +15 -0
  79. package/dist/types/components/Segmented/index.d.ts +2 -0
  80. package/dist/types/components/Select/SelectCore.d.ts +13 -0
  81. package/dist/types/components/Select/index.d.ts +2 -0
  82. package/dist/types/components/Slider/SliderCore.d.ts +11 -0
  83. package/dist/types/components/Slider/index.d.ts +2 -0
  84. package/dist/types/components/Switch/Switch.d.ts +1 -1
  85. package/dist/types/components/Switch/SwitchCore.d.ts +12 -0
  86. package/dist/types/components/Switch/index.d.ts +2 -0
  87. package/dist/types/components/TagInput/TagInputCore.d.ts +20 -0
  88. package/dist/types/components/TagInput/index.d.ts +2 -0
  89. package/dist/types/components/Textarea/TextareaCore.d.ts +12 -0
  90. package/dist/types/components/Textarea/index.d.ts +2 -0
  91. package/dist/types/components/TimePicker/TimePickerCore.d.ts +9 -0
  92. package/dist/types/components/TimePicker/index.d.ts +2 -0
  93. package/dist/types/form/FormItem.d.ts +23 -12
  94. package/dist/types/form/index.d.ts +1 -2
  95. package/dist/types/index.d.ts +35 -35
  96. package/package.json +15 -15
  97. package/dist/form/useFormControl.js +0 -54
  98. package/dist/types/form/useFormControl.d.ts +0 -32
@@ -0,0 +1,13 @@
1
+ import type { ComponentPropsWithoutRef } from 'react';
2
+ type InputCoreProps = {
3
+ value: string;
4
+ onChange: (value: string) => void;
5
+ /** Native change event passthrough — invoked with the DOM event after
6
+ * `onChange`. Kept out of `rest` on purpose so the controlled `onChange`
7
+ * callback above can never be overridden by a spread. */
8
+ onNativeChange?: ComponentPropsWithoutRef<'input'>['onChange'];
9
+ size?: 'sm' | 'md' | 'lg';
10
+ className?: string;
11
+ } & Omit<ComponentPropsWithoutRef<'input'>, 'value' | 'onChange' | 'size'>;
12
+ export default function InputCore({ value, onChange, onNativeChange, size, className, ...rest }: InputCoreProps): import("react").JSX.Element;
13
+ export type { InputCoreProps };
@@ -1,2 +1,4 @@
1
1
  export { default as Input } from './Input';
2
2
  export type { InputProps } from './Input';
3
+ export { default as InputCore } from './InputCore';
4
+ export type { InputCoreProps } from './InputCore';
@@ -0,0 +1,15 @@
1
+ import type { ComponentPropsWithoutRef } from 'react';
2
+ type NumberInputCoreProps = {
3
+ value: number;
4
+ onChange: (value: number) => void;
5
+ /** Native change event passthrough — invoked with the DOM event after
6
+ * `onChange`, so a spread can never override the controlled callback. */
7
+ onNativeChange?: ComponentPropsWithoutRef<'input'>['onChange'];
8
+ min?: number;
9
+ max?: number;
10
+ step?: number;
11
+ size?: 'sm' | 'md' | 'lg';
12
+ className?: string;
13
+ } & Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'value' | 'onChange' | 'size'>;
14
+ export default function NumberInputCore({ value, onChange, onNativeChange, min, max, step, size, className, ...rest }: NumberInputCoreProps): import("react").JSX.Element;
15
+ export type { NumberInputCoreProps };
@@ -1,2 +1,4 @@
1
1
  export { default as NumberInput } from './NumberInput';
2
2
  export type { NumberInputProps } from './NumberInput';
3
+ export { default as NumberInputCore } from './NumberInputCore';
4
+ export type { NumberInputCoreProps } from './NumberInputCore';
@@ -0,0 +1,8 @@
1
+ type OTPInputCoreProps = {
2
+ length?: number;
3
+ value: string;
4
+ onChange: (value: string) => void;
5
+ className?: string;
6
+ };
7
+ export default function OTPInputCore({ length, value, onChange, className, }: OTPInputCoreProps): import("react").JSX.Element;
8
+ export type { OTPInputCoreProps };
@@ -1,2 +1,4 @@
1
1
  export { default as OTPInput } from './OTPInput';
2
2
  export type { OTPInputProps } from './OTPInput';
3
+ export { default as OTPInputCore } from './OTPInputCore';
4
+ export type { OTPInputCoreProps } from './OTPInputCore';
@@ -0,0 +1,9 @@
1
+ type PasswordInputCoreProps = {
2
+ value: string;
3
+ onChange: (value: string) => void;
4
+ placeholder?: string;
5
+ disabled?: boolean;
6
+ className?: string;
7
+ };
8
+ export default function PasswordInputCore({ value, onChange, placeholder, disabled, className, }: PasswordInputCoreProps): import("react").JSX.Element;
9
+ export type { PasswordInputCoreProps };
@@ -1,2 +1,4 @@
1
1
  export { default as PasswordInput } from './PasswordInput';
2
2
  export type { PasswordInputProps } from './PasswordInput';
3
+ export { default as PasswordInputCore } from './PasswordInputCore';
4
+ export type { PasswordInputCoreProps } from './PasswordInputCore';
@@ -1,8 +1,7 @@
1
- import type { Dispatch, SetStateAction } from 'react';
2
1
  type RadioContextValue = {
3
2
  name: string;
4
3
  value: string;
5
- setValue: Dispatch<SetStateAction<string>>;
4
+ setValue: (value: string) => void;
6
5
  };
7
6
  export declare const RadioProvider: import("react").Provider<RadioContextValue | undefined>;
8
7
  export declare function useRadioContext(): RadioContextValue | undefined;
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ type RadioGroupCoreProps = {
3
+ value: string;
4
+ onChange: (value: string) => void;
5
+ name?: string;
6
+ className?: string;
7
+ children: ReactNode;
8
+ };
9
+ export default function RadioGroupCore({ value, onChange, name, className, children, }: RadioGroupCoreProps): import("react").JSX.Element;
10
+ export type { RadioGroupCoreProps };
@@ -2,3 +2,5 @@ export { default as Radio } from './Radio';
2
2
  export type { RadioProps } from './Radio';
3
3
  export { default as RadioGroup } from './RadioGroup';
4
4
  export type { RadioGroupProps } from './RadioGroup';
5
+ export { default as RadioGroupCore } from './RadioGroupCore';
6
+ export type { RadioGroupCoreProps } from './RadioGroupCore';
@@ -0,0 +1,9 @@
1
+ type RatingCoreProps = {
2
+ value: number;
3
+ onChange: (value: number) => void;
4
+ count?: number;
5
+ allowHalf?: boolean;
6
+ className?: string;
7
+ };
8
+ export default function RatingCore({ value, onChange, count, allowHalf, className, }: RatingCoreProps): import("react").JSX.Element;
9
+ export type { RatingCoreProps };
@@ -1,2 +1,4 @@
1
1
  export { default as Rating } from './Rating';
2
2
  export type { RatingProps } from './Rating';
3
+ export { default as RatingCore } from './RatingCore';
4
+ export type { RatingCoreProps } from './RatingCore';
@@ -1,10 +1,5 @@
1
- import type { ReactNode } from 'react';
2
1
  import type { Control } from 'react-use-control';
3
- type SegmentedOption = string | {
4
- value: string;
5
- label: ReactNode;
6
- disabled?: boolean;
7
- };
2
+ import type { SegmentedOption } from './SegmentedCore';
8
3
  type SegmentedProps = {
9
4
  options: SegmentedOption[];
10
5
  value?: Control<string> | string;
@@ -0,0 +1,15 @@
1
+ import type { ReactNode } from 'react';
2
+ type SegmentedOption = string | {
3
+ value: string;
4
+ label: ReactNode;
5
+ disabled?: boolean;
6
+ };
7
+ type SegmentedCoreProps = {
8
+ options: SegmentedOption[];
9
+ value: string;
10
+ onChange: (value: string) => void;
11
+ size?: 'sm' | 'md' | 'lg';
12
+ className?: string;
13
+ };
14
+ export default function SegmentedCore({ options, value, onChange, size, className, }: SegmentedCoreProps): import("react").JSX.Element;
15
+ export type { SegmentedCoreProps, SegmentedOption };
@@ -1,2 +1,4 @@
1
1
  export { default as Segmented } from './Segmented';
2
2
  export type { SegmentedProps, SegmentedOption } from './Segmented';
3
+ export { default as SegmentedCore } from './SegmentedCore';
4
+ export type { SegmentedCoreProps, SegmentedOption as SegmentedCoreOption } from './SegmentedCore';
@@ -0,0 +1,13 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ type SelectCoreProps = {
3
+ value: string;
4
+ onChange: (value: string) => void;
5
+ /** Native change event passthrough — invoked with the DOM event after
6
+ * `onChange`, so a spread can never override the controlled callback. */
7
+ onNativeChange?: ComponentPropsWithoutRef<'select'>['onChange'];
8
+ size?: 'sm' | 'md' | 'lg';
9
+ children: ReactNode;
10
+ className?: string;
11
+ } & Omit<ComponentPropsWithoutRef<'select'>, 'value' | 'onChange' | 'size'>;
12
+ export default function SelectCore({ value, onChange, onNativeChange, size, className, children, ...rest }: SelectCoreProps): import("react").JSX.Element;
13
+ export type { SelectCoreProps };
@@ -1,4 +1,6 @@
1
1
  export { default as Select } from './Select';
2
2
  export type { SelectProps } from './Select';
3
+ export { default as SelectCore } from './SelectCore';
4
+ export type { SelectCoreProps } from './SelectCore';
3
5
  export { default as Option } from './Option';
4
6
  export type { OptionProps } from './Option';
@@ -0,0 +1,11 @@
1
+ import type { ComponentPropsWithoutRef } from 'react';
2
+ type SliderCoreProps = {
3
+ value: number;
4
+ onChange: (value: number) => void;
5
+ /** Native change event passthrough — invoked with the DOM event after
6
+ * `onChange`, so a spread can never override the controlled callback. */
7
+ onNativeChange?: ComponentPropsWithoutRef<'input'>['onChange'];
8
+ className?: string;
9
+ } & Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'value' | 'onChange'>;
10
+ export default function SliderCore({ value, onChange, onNativeChange, className, ...rest }: SliderCoreProps): import("react").JSX.Element;
11
+ export type { SliderCoreProps };
@@ -1,2 +1,4 @@
1
1
  export { default as Slider } from './Slider';
2
2
  export type { SliderProps } from './Slider';
3
+ export { default as SliderCore } from './SliderCore';
4
+ export type { SliderCoreProps } from './SliderCore';
@@ -3,6 +3,6 @@ import type { Control } from 'react-use-control';
3
3
  type SwitchProps = {
4
4
  checked?: Control<boolean> | boolean;
5
5
  size?: 'sm' | 'md' | 'lg';
6
- } & Omit<ComponentPropsWithoutRef<'button'>, 'type' | 'checked'>;
6
+ } & Omit<ComponentPropsWithoutRef<'button'>, 'type' | 'checked' | 'onChange'>;
7
7
  export default function Switch({ checked: checkedControl, size, className, onClick, ...rest }: SwitchProps): import("react").JSX.Element;
8
8
  export type { SwitchProps };
@@ -0,0 +1,12 @@
1
+ import type { ComponentPropsWithoutRef } from 'react';
2
+ type SwitchCoreProps = {
3
+ checked: boolean;
4
+ onChange: (checked: boolean) => void;
5
+ /** Native click event passthrough — invoked with the DOM event after
6
+ * `onChange`, so a spread can never override the controlled callback. */
7
+ onNativeClick?: ComponentPropsWithoutRef<'button'>['onClick'];
8
+ size?: 'sm' | 'md' | 'lg';
9
+ className?: string;
10
+ } & Omit<ComponentPropsWithoutRef<'button'>, 'type' | 'checked' | 'onChange'>;
11
+ export default function SwitchCore({ checked, onChange, onNativeClick, size, className, ...rest }: SwitchCoreProps): import("react").JSX.Element;
12
+ export type { SwitchCoreProps };
@@ -1,2 +1,4 @@
1
1
  export { default as Switch } from './Switch';
2
2
  export type { SwitchProps } from './Switch';
3
+ export { default as SwitchCore } from './SwitchCore';
4
+ export type { SwitchCoreProps } from './SwitchCore';
@@ -0,0 +1,20 @@
1
+ type TagInputCoreProps = {
2
+ value: string[];
3
+ onChange: (value: string[]) => void;
4
+ placeholder?: string;
5
+ maxTags?: number;
6
+ disabled?: boolean;
7
+ className?: string;
8
+ /**
9
+ * 字段 id(FormItem 桥生成):必须挂到内部可聚焦的 input 上而非根
10
+ * div,<label htmlFor> 与错误 span 的 aria 链路才能接到焦点元素——
11
+ * 根 div 不聚焦,挂那里等于断链。
12
+ */
13
+ id?: string;
14
+ /** 由 FormItem 桥传入,随字段错误态变化,透传给内部 input。 */
15
+ 'aria-invalid'?: boolean;
16
+ /** 指向 FormItem 渲染的错误 span(id={errorId}),透传给内部 input。 */
17
+ 'aria-describedby'?: string;
18
+ };
19
+ export default function TagInputCore({ value: tags, onChange, placeholder, maxTags, disabled, className, id, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedby, }: TagInputCoreProps): import("react").JSX.Element;
20
+ export type { TagInputCoreProps };
@@ -1,2 +1,4 @@
1
1
  export { default as TagInput } from './TagInput';
2
2
  export type { TagInputProps } from './TagInput';
3
+ export { default as TagInputCore } from './TagInputCore';
4
+ export type { TagInputCoreProps } from './TagInputCore';
@@ -0,0 +1,12 @@
1
+ import type { ComponentPropsWithoutRef } from 'react';
2
+ type TextareaCoreProps = {
3
+ value: string;
4
+ onChange: (value: string) => void;
5
+ /** Native change event passthrough — invoked with the DOM event after
6
+ * `onChange`, so a spread can never override the controlled callback. */
7
+ onNativeChange?: ComponentPropsWithoutRef<'textarea'>['onChange'];
8
+ size?: 'sm' | 'md' | 'lg';
9
+ className?: string;
10
+ } & Omit<ComponentPropsWithoutRef<'textarea'>, 'value' | 'onChange' | 'size'>;
11
+ export default function TextareaCore({ value, onChange, onNativeChange, size, className, ...rest }: TextareaCoreProps): import("react").JSX.Element;
12
+ export type { TextareaCoreProps };
@@ -1,2 +1,4 @@
1
1
  export { default as Textarea } from './Textarea';
2
2
  export type { TextareaProps } from './Textarea';
3
+ export { default as TextareaCore } from './TextareaCore';
4
+ export type { TextareaCoreProps } from './TextareaCore';
@@ -0,0 +1,9 @@
1
+ import type { ComponentPropsWithoutRef } from 'react';
2
+ type TimePickerCoreProps = {
3
+ value: string;
4
+ onChange: (value: string) => void;
5
+ placeholder?: string;
6
+ className?: string;
7
+ } & Omit<ComponentPropsWithoutRef<'input'>, 'value' | 'onChange' | 'type' | 'placeholder'>;
8
+ export default function TimePickerCore({ value, onChange, placeholder, className, ...rest }: TimePickerCoreProps): import("react").JSX.Element;
9
+ export type { TimePickerCoreProps };
@@ -1,2 +1,4 @@
1
1
  export { default as TimePicker } from './TimePicker';
2
2
  export type { TimePickerProps } from './TimePicker';
3
+ export { default as TimePickerCore } from './TimePickerCore';
4
+ export type { TimePickerCoreProps } from './TimePickerCore';
@@ -1,7 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { FieldError, FieldPath, FieldRules, Name, ValidationMode } from 'react-f0rm';
3
- import type { Control } from 'react-use-control';
4
- import type { FormInstance, PathValueOf } from './useFormControl';
2
+ import type { FieldError, FieldPath, FieldRules, Name, ValidationMode, FormInstance, PathValueOf } from 'react-f0rm';
5
3
  /**
6
4
  * Field-level validator, structurally compatible with react-f0rm's
7
5
  * `Validator`: return an error (string, FieldError, or an array mixing
@@ -14,7 +12,7 @@ export type FieldValidator = (value: any, meta: {
14
12
  }) => string | FieldError | (string | FieldError)[] | undefined | Promise<string | FieldError | (string | FieldError)[] | undefined>;
15
13
  /** Render binding handed to `FormItem`'s render-prop children. */
16
14
  export type FormItemBinding<TValues, P extends FieldPath<TValues> | Name> = {
17
- /** id for the field control element (`<Input id={id}>`) */
15
+ /** id for the field control element (`<InputCore id={id}>`) */
18
16
  id: string;
19
17
  /** id of the error message element; pass as `aria-describedby` */
20
18
  errorId: string;
@@ -23,11 +21,16 @@ export type FormItemBinding<TValues, P extends FieldPath<TValues> | Name> = {
23
21
  /** every error registered for the field, in insertion order */
24
22
  errors: FieldError[];
25
23
  /** react-f0rm blur hook for this field — pass to the control's `onBlur`
26
- * (`<Input onBlur={onBlur}/>`) so blur-scheduled validation modes
24
+ * (`<InputCore onBlur={onBlur}/>`) so blur-scheduled validation modes
27
25
  * (`mode='onBlur' | 'onTouched' | 'all'`) fire when the field loses focus. */
28
26
  onBlur: () => void;
29
- /** Control bound to the field value — pass to a control prop */
30
- control: Control<PathValueOf<TValues, P>>;
27
+ /** Field value subscribed per-field — pass to a controlled core
28
+ * (`<InputCore value={value} onChange={onChange} />`). */
29
+ value: PathValueOf<TValues, P>;
30
+ /** react-f0rm's own field-change writer — pass to the core's `onChange`.
31
+ * It routes through the same mode-gated, re-validating pipeline as
32
+ * react-f0rm's built-in Field/Checkbox/Select. */
33
+ onChange: (next: PathValueOf<TValues, P>) => void;
31
34
  };
32
35
  export type FormItemProps<TValues extends Record<string, any> = any, P extends FieldPath<TValues> | Name = Name> = {
33
36
  form: FormInstance<TValues>;
@@ -62,14 +65,22 @@ export type FormItemProps<TValues extends Record<string, any> = any, P extends F
62
65
  children: (binding: FormItemBinding<TValues, P>) => ReactNode;
63
66
  };
64
67
  /**
65
- * Glue a single field of a react-f0rm form to a haze-ui control:
66
- * generates accessible ids, subscribes to the field's errors, and hands
67
- * both plus a `useFormControl` handle to the render-prop children.
68
+ * Glue a single field of a react-f0rm form to a haze-ui controlled core.
69
+ * The binding layer is react-f0rm's own headless `useField` hook — the
70
+ * same channel its built-in Field/Checkbox/Select use — so no adapter or
71
+ * state-bridge lives here. FormItem contributes only the view: label,
72
+ * error span and the id/aria convention.
68
73
  *
69
74
  * ```tsx
70
75
  * <FormItem form={form} name='email' label='Email'>
71
- * {({id, errorId, invalid, control}) => (
72
- * <Input id={id} value={control} aria-describedby={errorId} aria-invalid={invalid} />
76
+ * {({id, errorId, invalid, value, onChange}) => (
77
+ * <InputCore
78
+ * id={id}
79
+ * value={value}
80
+ * onChange={onChange}
81
+ * aria-describedby={errorId}
82
+ * aria-invalid={invalid}
83
+ * />
73
84
  * )}
74
85
  * </FormItem>
75
86
  * ```
@@ -1,4 +1,3 @@
1
- export { useFormControl } from './useFormControl';
2
- export type { FormInstance, PathValueOf } from './useFormControl';
3
1
  export { default as FormItem } from './FormItem';
4
2
  export type { FieldValidator, FormItemBinding, FormItemProps } from './FormItem';
3
+ export type { FormInstance, PathValueOf } from 'react-f0rm';
@@ -5,14 +5,14 @@ export { TOKEN_REGISTRY, COMPONENT_TOKENS } from './tokens/registry';
5
5
  export type { TokenDef } from './tokens/registry';
6
6
  export { Button } from './components/Button';
7
7
  export type { ButtonProps } from './components/Button';
8
- export { Input } from './components/Input';
9
- export type { InputProps } from './components/Input';
10
- export { Select, Option } from './components/Select';
11
- export type { SelectProps, OptionProps } from './components/Select';
12
- export { Checkbox } from './components/Checkbox';
13
- export type { CheckboxProps } from './components/Checkbox';
14
- export { Switch } from './components/Switch';
15
- export type { SwitchProps } from './components/Switch';
8
+ export { Input, InputCore } from './components/Input';
9
+ export type { InputProps, InputCoreProps } from './components/Input';
10
+ export { Select, Option, SelectCore } from './components/Select';
11
+ export type { SelectProps, OptionProps, SelectCoreProps } from './components/Select';
12
+ export { Checkbox, CheckboxCore } from './components/Checkbox';
13
+ export type { CheckboxProps, CheckboxCoreProps } from './components/Checkbox';
14
+ export { Switch, SwitchCore } from './components/Switch';
15
+ export type { SwitchProps, SwitchCoreProps } from './components/Switch';
16
16
  export { Badge } from './components/Badge';
17
17
  export type { BadgeProps } from './components/Badge';
18
18
  export { Dialog } from './components/Dialog';
@@ -23,12 +23,12 @@ export { Popover } from './components/Popover';
23
23
  export type { PopoverProps } from './components/Popover';
24
24
  export { Card } from './components/Card';
25
25
  export type { CardProps } from './components/Card';
26
- export { Radio, RadioGroup } from './components/Radio';
27
- export type { RadioProps, RadioGroupProps } from './components/Radio';
28
- export { Textarea } from './components/Textarea';
29
- export type { TextareaProps } from './components/Textarea';
30
- export { Slider } from './components/Slider';
31
- export type { SliderProps } from './components/Slider';
26
+ export { Radio, RadioGroup, RadioGroupCore } from './components/Radio';
27
+ export type { RadioProps, RadioGroupProps, RadioGroupCoreProps } from './components/Radio';
28
+ export { Textarea, TextareaCore } from './components/Textarea';
29
+ export type { TextareaProps, TextareaCoreProps } from './components/Textarea';
30
+ export { Slider, SliderCore } from './components/Slider';
31
+ export type { SliderProps, SliderCoreProps } from './components/Slider';
32
32
  export { Tabs, TabList, Tab, TabPanel } from './components/Tabs';
33
33
  export type { TabsProps, TabListProps, TabProps, TabPanelProps, } from './components/Tabs';
34
34
  export { Accordion, AccordionItem } from './components/Accordion';
@@ -53,8 +53,8 @@ export { Disclosure } from './components/Disclosure';
53
53
  export type { DisclosureProps } from './components/Disclosure';
54
54
  export { Menu, MenuItem, MenuDivider } from './components/Menu';
55
55
  export type { MenuProps, MenuItemProps } from './components/Menu';
56
- export { NumberInput } from './components/NumberInput';
57
- export type { NumberInputProps } from './components/NumberInput';
56
+ export { NumberInput, NumberInputCore } from './components/NumberInput';
57
+ export type { NumberInputProps, NumberInputCoreProps } from './components/NumberInput';
58
58
  export { FileInput } from './components/FileInput';
59
59
  export type { FileInputProps } from './components/FileInput';
60
60
  export { Toast, ToastContainer, useToast } from './components/Toast';
@@ -67,8 +67,8 @@ export { Table, TableHead, TableBody, TableRow, TableCell, } from './components/
67
67
  export type { TableProps, TableHeadProps, TableBodyProps, TableRowProps, TableCellProps, } from './components/Table';
68
68
  export { Carousel, CarouselSlide } from './components/Carousel';
69
69
  export type { CarouselProps, CarouselSlideProps } from './components/Carousel';
70
- export { Datepicker } from './components/Datepicker';
71
- export type { DatepickerProps } from './components/Datepicker';
70
+ export { Datepicker, DatepickerCore } from './components/Datepicker';
71
+ export type { DatepickerProps, DatepickerCoreProps } from './components/Datepicker';
72
72
  export { Tree } from './components/Tree';
73
73
  export type { TreeProps, TreeNodeData } from './components/Tree';
74
74
  export { Divider } from './components/Divider';
@@ -97,32 +97,32 @@ export { Transfer } from './components/Transfer';
97
97
  export type { TransferProps, TransferItem } from './components/Transfer';
98
98
  export { Upload } from './components/Upload';
99
99
  export type { UploadProps } from './components/Upload';
100
- export { ColorPicker } from './components/ColorPicker';
101
- export type { ColorPickerProps } from './components/ColorPicker';
102
- export { Rating } from './components/Rating';
103
- export type { RatingProps } from './components/Rating';
100
+ export { ColorPicker, ColorPickerCore } from './components/ColorPicker';
101
+ export type { ColorPickerProps, ColorPickerCoreProps } from './components/ColorPicker';
102
+ export { Rating, RatingCore } from './components/Rating';
103
+ export type { RatingProps, RatingCoreProps } from './components/Rating';
104
104
  export { Timeline, TimelineItem } from './components/Timeline';
105
105
  export type { TimelineProps, TimelineItemProps } from './components/Timeline';
106
106
  export { Title, Text, Paragraph } from './components/Typography';
107
107
  export type { TitleProps, TextProps, ParagraphProps } from './components/Typography';
108
108
  export { Stat, StatGroup } from './components/Stat';
109
109
  export type { StatProps, StatGroupProps } from './components/Stat';
110
- export { Segmented } from './components/Segmented';
111
- export type { SegmentedProps } from './components/Segmented';
110
+ export { Segmented, SegmentedCore } from './components/Segmented';
111
+ export type { SegmentedProps, SegmentedCoreProps } from './components/Segmented';
112
112
  export { Chip } from './components/Chip';
113
113
  export type { ChipProps } from './components/Chip';
114
114
  export { ScrollArea } from './components/ScrollArea';
115
115
  export type { ScrollAreaProps } from './components/ScrollArea';
116
- export { TimePicker } from './components/TimePicker';
117
- export type { TimePickerProps } from './components/TimePicker';
118
- export { DateRangePicker } from './components/DateRangePicker';
119
- export type { DateRangePickerProps } from './components/DateRangePicker';
120
- export { OTPInput } from './components/OTPInput';
121
- export type { OTPInputProps } from './components/OTPInput';
122
- export { PasswordInput } from './components/PasswordInput';
123
- export type { PasswordInputProps } from './components/PasswordInput';
124
- export { TagInput } from './components/TagInput';
125
- export type { TagInputProps } from './components/TagInput';
116
+ export { TimePicker, TimePickerCore } from './components/TimePicker';
117
+ export type { TimePickerProps, TimePickerCoreProps } from './components/TimePicker';
118
+ export { DateRangePicker, DateRangePickerCore } from './components/DateRangePicker';
119
+ export type { DateRangePickerProps, DateRangePickerCoreProps } from './components/DateRangePicker';
120
+ export { OTPInput, OTPInputCore } from './components/OTPInput';
121
+ export type { OTPInputProps, OTPInputCoreProps } from './components/OTPInput';
122
+ export { PasswordInput, PasswordInputCore } from './components/PasswordInput';
123
+ export type { PasswordInputProps, PasswordInputCoreProps } from './components/PasswordInput';
124
+ export { TagInput, TagInputCore } from './components/TagInput';
125
+ export type { TagInputProps, TagInputCoreProps } from './components/TagInput';
126
126
  export { InlineEdit } from './components/InlineEdit';
127
127
  export type { InlineEditProps } from './components/InlineEdit';
128
128
  export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from './components/DropdownMenu';
@@ -181,6 +181,6 @@ export { DiffViewer } from './components/DiffViewer';
181
181
  export type { DiffViewerProps, DiffLine } from './components/DiffViewer';
182
182
  export { LogViewer } from './components/LogViewer';
183
183
  export type { LogViewerProps, LogEntry, LogLevel } from './components/LogViewer';
184
- export { FormItem, useFormControl } from './form';
184
+ export { FormItem } from './form';
185
185
  export type { FieldValidator, FormItemBinding, FormItemProps, FormInstance, PathValueOf, } from './form';
186
186
  export { useControl } from 'react-use-control';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haze-ui",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
4
4
  "type": "module",
5
5
  "description": "A React UI component library powered by react-use-control and Linaria",
6
6
  "main": "./dist/index.js",
@@ -49,10 +49,10 @@
49
49
  "peerDependencies": {
50
50
  "@linaria/core": "^7.0.0 || ^8.0.0",
51
51
  "react": "^19.0.0",
52
- "react-f0rm": ">=0.3.0"
52
+ "react-f0rm": ">=0.7.0"
53
53
  },
54
54
  "dependencies": {
55
- "react-toolroom": "^0.11.0",
55
+ "react-toolroom": "^0.18.4",
56
56
  "react-use-control": "^1.3.2"
57
57
  },
58
58
  "devDependencies": {
@@ -62,20 +62,20 @@
62
62
  "@faker-js/faker": "^10.6.0",
63
63
  "@for-fun/event-emitter": "^1.0.1",
64
64
  "@linaria/core": "^8.2.0",
65
- "@native-router/core": "^1.8.0",
66
- "@native-router/react": "^1.6.1",
65
+ "@native-router/core": "^1.10.0",
66
+ "@native-router/react": "^1.9.0",
67
67
  "@testing-library/jest-dom": "^7.0.1",
68
- "@testing-library/react": "^16.3.2",
68
+ "@testing-library/react": "^16.3.3",
69
69
  "@testing-library/user-event": "^14.6.6",
70
70
  "@types/jest-axe": "^3.5.9",
71
- "@types/node": "^26.3.0",
71
+ "@types/node": "^26.4.0",
72
72
  "@types/ramda": "^0.32.0",
73
73
  "@types/react": "^19.2.18",
74
74
  "@types/react-dom": "^19.2.5",
75
- "@vitejs/plugin-react": "^6.1.0",
75
+ "@vitejs/plugin-react": "^6.1.1",
76
76
  "@vitest/coverage-v8": "4.1.11",
77
- "@wyw-in-js/babel-preset": "^2.4.3",
78
- "@wyw-in-js/vite": "^2.4.3",
77
+ "@wyw-in-js/babel-preset": "^2.4.4",
78
+ "@wyw-in-js/vite": "^2.4.4",
79
79
  "babel-plugin-transform-jsx-class": "^0.1.3",
80
80
  "babel-plugin-transform-jsx-condition": "^0.1.3",
81
81
  "commitizen": "^4.3.2",
@@ -88,19 +88,19 @@
88
88
  "jest-axe": "^11.0.0",
89
89
  "jsdom": "^30.0.1",
90
90
  "json-schema-faker": "^0.6.3",
91
- "lint-staged": "^17.3.0",
92
- "lucide-react": "^1.34.0",
91
+ "lint-staged": "^17.4.1",
92
+ "lucide-react": "^1.37.0",
93
93
  "prettier": "^3.9.6",
94
94
  "qss": "^3.0.0",
95
95
  "ramda": "^0.32.0",
96
96
  "react": "^19.2.8",
97
97
  "react-dom": "^19.2.8",
98
- "react-f0rm": "^0.6.0",
98
+ "react-f0rm": "^0.7.0",
99
99
  "react-icons": "^5.7.0",
100
100
  "rollup-plugin-type-as-json-schema": "^0.2.6",
101
101
  "semantic-release": "^25.0.9",
102
- "terser": "^5.51.0",
103
- "tools-config": "^0.3.0",
102
+ "terser": "^5.51.2",
103
+ "tools-config": "^0.3.1",
104
104
  "tsc-alias": "^1.9.2",
105
105
  "typescript": "^6.0.3",
106
106
  "vite": "^8.2.2",
@@ -1,54 +0,0 @@
1
- import { useControl as e, useThru as t } from "react-use-control";
2
- import { useMemo as n } from "react";
3
- import { getValueByPath as r, setValueByPath as i, useValueByPath as a } from "react-f0rm";
4
- //#region src/lib/form/useFormControl.ts
5
- var o = /* @__PURE__ */ new Map();
6
- function s(e) {
7
- let t = [], n = "", r = () => {
8
- t.push(n), n = "";
9
- };
10
- for (let i = 0; i < e.length; i++) {
11
- let a = e[i];
12
- if (a === ".") n !== "" && r();
13
- else if (a === "[") {
14
- n !== "" && r();
15
- let a = e[i + 1];
16
- if (a === "\"" || a === "'") {
17
- let n = e.indexOf(a, i + 2);
18
- if (n === -1) throw TypeError(`Unterminated quote in path: ${e}`);
19
- if (e[n + 1] !== "]") throw TypeError(`Expected "]" after quoted segment in path: ${e}`);
20
- t.push(e.slice(i + 2, n)), i = n + 1;
21
- } else {
22
- let n = e.indexOf("]", i + 1);
23
- if (n === -1) throw TypeError(`Unterminated bracket in path: ${e}`);
24
- let r = e.slice(i + 1, n);
25
- t.push(/^-?\d+$/.test(r) ? Number(r) : r), i = n;
26
- }
27
- } else n += a;
28
- }
29
- return (n !== "" || t.length === 0) && r(), t;
30
- }
31
- function c(e) {
32
- if (typeof e != "string") return {
33
- value: e,
34
- key: JSON.stringify(e)
35
- };
36
- let t = o.get(e);
37
- return t || (t = s(e), o.set(e, t)), {
38
- value: t,
39
- key: JSON.stringify(t)
40
- };
41
- }
42
- function l(e) {
43
- let t = typeof e == "string" ? e : JSON.stringify(e);
44
- return n(() => c(e), [t]);
45
- }
46
- function u(n, o) {
47
- let s = l(o), c = a(n, s), [, , u] = e();
48
- return t(u, () => [c, (e) => {
49
- let t = r(n, s), a = typeof e == "function" ? e(t) : e;
50
- i(n, s, a);
51
- }]);
52
- }
53
- //#endregion
54
- export { u as useFormControl };