@boxcustodia/library 2.0.0-alpha.8 → 2.0.0-alpha.9

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.
package/dist/index.d.ts CHANGED
@@ -214,7 +214,9 @@ export declare type BaseEntity = {
214
214
  createdAt: Date;
215
215
  };
216
216
 
217
- declare type BaseProps = {
217
+ declare type BaseProps = FormPrimitive.Props;
218
+
219
+ declare type BaseProps_2 = {
218
220
  icon?: React.ReactNode;
219
221
  rounded?: TagVariant["rounded"];
220
222
  } & StyleProps & React.HTMLAttributes<HTMLDivElement>;
@@ -348,19 +350,14 @@ export { CheckboxPrimitive }
348
350
  declare interface CheckboxProps extends Omit<CheckboxPrimitive.Root.Props, "children"> {
349
351
  children?: ReactNode;
350
352
  label?: ReactNode;
351
- description?: ReactNode;
352
- error?: FieldErrorProp;
353
353
  tooltip?: ReactNode;
354
354
  indicatorProps?: CheckboxPrimitive.Indicator.Props;
355
355
  controlFirst?: boolean;
356
- invalid?: boolean;
357
- touched?: boolean;
358
- dirty?: boolean;
359
356
  }
360
357
 
361
358
  export declare function CheckboxRoot({ className, ...props }: CheckboxPrimitive.Root.Props): React_2.ReactElement;
362
359
 
363
- declare function CheckboxSingle({ children, label, description, error, tooltip, className, indicatorProps, controlFirst, required, name, invalid, touched, dirty, ...props }: CheckboxProps): React_2.ReactElement;
360
+ declare function CheckboxSingle({ className, indicatorProps, label, children, tooltip, controlFirst, required, id, ...props }: CheckboxProps): React_2.ReactElement;
364
361
 
365
362
  export declare type ClassName = string | undefined;
366
363
 
@@ -368,7 +365,7 @@ export declare const click: (element: HTMLElement) => void;
368
365
 
369
366
  export declare type ClickEvent = React.MouseEvent<HTMLButtonElement, MouseEvent>;
370
367
 
371
- declare type ClosableProps = BaseProps & {
368
+ declare type ClosableProps = BaseProps_2 & {
372
369
  closable: true;
373
370
  onClose: () => void;
374
371
  };
@@ -667,7 +664,9 @@ declare interface ExtendedProps_2 {
667
664
  */
668
665
  export declare const extractInitials: (string: string) => string;
669
666
 
670
- export declare function Field({ label, required, tooltip, description, error, controlFirst, children, className, invalid: invalidProp, ...props }: FieldProps): JSX.Element;
667
+ export declare function Field({ label, description, error, required, tooltip, inline, children, className, labelProps, descriptionProps, errorProps, ...rootProps }: FieldProps): JSX.Element;
668
+
669
+ export declare const FieldControl: typeof FieldPrimitive.Control;
671
670
 
672
671
  export declare function FieldDescription({ className, ...props }: FieldPrimitive.Description.Props): JSX.Element;
673
672
 
@@ -675,27 +674,51 @@ export declare function FieldError({ className, ...props }: FieldPrimitive.Error
675
674
 
676
675
  export declare type FieldErrorItem = {
677
676
  message: ReactNode;
678
- match: NonNullable<FieldErrorMatch>;
677
+ match?: NonNullable<FieldErrorMatch>;
679
678
  };
680
679
 
681
680
  export declare type FieldErrorMatch = FieldPrimitive.Error.Props["match"];
682
681
 
683
682
  export declare type FieldErrorProp = string | FieldErrorItem | FieldErrorItem[];
684
683
 
684
+ export declare function FieldItem({ className, ...props }: FieldPrimitive.Item.Props): JSX.Element;
685
+
685
686
  export declare function FieldLabel({ className, ...props }: FieldPrimitive.Label.Props): JSX.Element;
686
687
 
687
688
  export { FieldPrimitive }
688
689
 
689
- export declare interface FieldProps extends FieldPrimitive.Root.Props {
690
+ export declare interface FieldProps extends Omit<FieldPrimitive.Root.Props, "children"> {
691
+ /** Text rendered inside `FieldLabel`. */
690
692
  label?: ReactNode;
691
- required?: boolean;
692
- tooltip?: ReactNode;
693
+ /** Helper text rendered below the control. */
693
694
  description?: ReactNode;
695
+ /**
696
+ * Error message(s) rendered below the control:
697
+ * - `string` → always renders once the field is invalid.
698
+ * - `{ message, match }` → renders only when the `ValidityState` key matches.
699
+ * - `FieldErrorItem[]` → multiple errors with individual matches.
700
+ */
694
701
  error?: FieldErrorProp;
695
- controlFirst?: boolean;
702
+ /** Shows a red asterisk after the label text. */
703
+ required?: boolean;
704
+ /** Renders an info icon with a tooltip next to the label. */
705
+ tooltip?: ReactNode;
706
+ /**
707
+ * Renders the control before the label on the same row.
708
+ * Use for single checkboxes and switches.
709
+ */
710
+ inline?: boolean;
711
+ children?: ReactNode;
712
+ labelProps?: FieldPrimitive.Label.Props;
713
+ descriptionProps?: FieldPrimitive.Description.Props;
714
+ errorProps?: Omit<FieldPrimitive.Error.Props, "match" | "children">;
696
715
  }
697
716
 
698
- export declare function FieldRoot({ className, ...props }: FieldPrimitive.Root.Props): JSX.Element;
717
+ export declare function FieldRoot({ className, required, ...props }: FieldPrimitive.Root.Props & {
718
+ required?: boolean;
719
+ }): JSX.Element;
720
+
721
+ export declare const FieldValidity: typeof FieldPrimitive.Validity;
699
722
 
700
723
  declare type FileError = {
701
724
  file: File;
@@ -735,10 +758,15 @@ export declare const FileTypeGroups: Record<string, FileTypeValue[]>;
735
758
 
736
759
  export declare type FileTypeValue = (typeof FileType)[keyof typeof FileType];
737
760
 
738
- export declare function Form({ className, ...props }: FormPrimitive.Props): default_2.ReactElement;
761
+ export declare function Form({ onSubmit, onFormSubmit, className, ...props }: FormProps): default_2.ReactElement;
739
762
 
740
763
  export { FormPrimitive }
741
764
 
765
+ export declare interface FormProps extends Omit<BaseProps, "onSubmit" | "onFormSubmit"> {
766
+ onSubmit?: BaseProps["onFormSubmit"];
767
+ onFormSubmit?: BaseProps["onFormSubmit"];
768
+ }
769
+
742
770
  export declare interface GenericMenuProps {
743
771
  trigger: default_2.ReactNode;
744
772
  items: MenuItemType[];
@@ -773,25 +801,14 @@ declare type HotkeyOptions = {
773
801
 
774
802
  export declare type ID = string | number;
775
803
 
776
- export declare function Input({ className, label, tooltip, description, error, required, name, invalid, touched, dirty, ...inputProps }: InputProps): JSX.Element;
804
+ export declare function Input({ className, nativeInput, onChange, ...props }: InputProps): JSX.Element;
777
805
 
778
806
  export { InputPrimitive }
779
807
 
780
- export declare interface InputProps extends InputRootProps {
781
- label?: ReactNode;
782
- tooltip?: ReactNode;
783
- description?: ReactNode;
784
- error?: FieldErrorProp;
785
- invalid?: boolean;
786
- touched?: boolean;
787
- dirty?: boolean;
788
- }
789
-
790
- export declare function InputRoot({ className, onChange, ...props }: InputRootProps): JSX.Element;
791
-
792
- export declare interface InputRootProps extends Omit<InputPrimitive.Props, "onChange" | "size"> {
808
+ export declare type InputProps = Omit<InputPrimitive.Props, "size" | "onChange"> & {
793
809
  onChange?: (value: string, event: ChangeEvent<HTMLInputElement>) => void;
794
- }
810
+ nativeInput?: boolean;
811
+ };
795
812
 
796
813
  declare interface ItemTimeline {
797
814
  content?: ReactNode;
@@ -1022,7 +1039,7 @@ declare type Mutation<TArgs extends any[], TReturn> = (...args: TArgs) => Promis
1022
1039
 
1023
1040
  declare type NavigationProps = Pick<CalendarNavigationProps, "goNextProps" | "goBackProps" | "changeViewProps">;
1024
1041
 
1025
- declare type NonClosableProps = BaseProps & {
1042
+ declare type NonClosableProps = BaseProps_2 & {
1026
1043
  closable?: false;
1027
1044
  onClose?: never;
1028
1045
  };
@@ -1056,27 +1073,15 @@ declare interface PaginationOptionProps extends ButtonHTMLAttributes<HTMLButtonE
1056
1073
  isActive?: boolean;
1057
1074
  }
1058
1075
 
1059
- export declare function Password({ label, tooltip, description, error, required, name, invalid, touched, dirty, ...passwordProps }: PasswordProps): JSX.Element;
1076
+ export declare function PasswordRoot({ className, showIcon, hideIcon, onShow, onHide, toggleable, onChange, ...rest }: PasswordRootProps): JSX.Element;
1060
1077
 
1061
- export declare interface PasswordProps extends PasswordRootProps {
1062
- label?: ReactNode;
1063
- tooltip?: ReactNode;
1064
- description?: ReactNode;
1065
- error?: FieldErrorProp;
1066
- invalid?: boolean;
1067
- touched?: boolean;
1068
- dirty?: boolean;
1069
- }
1070
-
1071
- export declare function PasswordRoot({ className, showIcon, hideIcon, onShow, onHide, toggleable, ...rest }: PasswordRootProps): JSX.Element;
1072
-
1073
- export declare interface PasswordRootProps extends InputRootProps {
1078
+ export declare type PasswordRootProps = Omit<InputProps, "unstyled" | "nativeInput"> & {
1074
1079
  showIcon?: ReactNode;
1075
1080
  hideIcon?: ReactNode;
1076
1081
  onShow?: () => void;
1077
1082
  onHide?: () => void;
1078
1083
  toggleable?: boolean;
1079
- }
1084
+ };
1080
1085
 
1081
1086
  export declare const Popover: (props: Props_14) => JSX.Element;
1082
1087