koval-ui 0.12.25 → 0.12.27

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
@@ -12,6 +12,7 @@ import { FormHTMLAttributes } from 'react';
12
12
  import { ForwardedRef } from 'react';
13
13
  import { ForwardRefExoticComponent } from 'react';
14
14
  import { HTMLAttributes } from 'react';
15
+ import { HTMLInputAutoCompleteAttribute } from 'react';
15
16
  import { ImgHTMLAttributes } from 'react';
16
17
  import { InputHTMLAttributes } from 'react';
17
18
  import { InvalidEvent } from 'react';
@@ -129,21 +130,14 @@ declare type CallbackPropsInteractive = {
129
130
  * Provide default checked state for non-controlled CheckboxInput.
130
131
  * Setting this prop enables non-controlled mode.
131
132
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#additional_attributes
132
- * @see https://naspersclassifieds.atlassian.net/wiki/spaces/NDS/pages/57169350329/RFC+Nexus+Input+API#Uncontrolled-input
133
133
  */
134
134
  defaultChecked?: InputHTMLAttributes<HTMLInputElement>['checked'];
135
135
  /**
136
136
  * Provide checked state for controlled CheckboxInput.
137
137
  * Setting this prop enables controlled mode.
138
138
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#additional_attributes
139
- * @see https://naspersclassifieds.atlassian.net/wiki/spaces/NDS/pages/57169350329/RFC+Nexus+Input+API#Controllable-state
140
139
  */
141
140
  checked?: InputHTMLAttributes<HTMLInputElement>['checked'];
142
- /**
143
- * Disable input.
144
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#disabled
145
- */
146
- disabled?: InputHTMLAttributes<HTMLInputElement>['disabled'];
147
141
  /**
148
142
  * Set on change callback to get Event object.
149
143
  * @see https://reactjs.org/docs/events.html#form-events
@@ -176,21 +170,19 @@ declare type CallbackPropsTextual<TElement = HTMLInputElement> = {
176
170
  * Provide value for controlled TextInput.
177
171
  * Setting this prop enables controlled mode.
178
172
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
179
- * @see https://naspersclassifieds.atlassian.net/wiki/spaces/NDS/pages/57169350329/RFC+Nexus+Input+API#Controllable-state
180
173
  */
181
174
  value?: InputHTMLAttributes<TElement>['value'];
182
175
  /**
183
176
  * Provide value for non-controlled TextInput.
184
177
  * Setting this prop enables non-controlled mode.
185
178
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
186
- * @see https://naspersclassifieds.atlassian.net/wiki/spaces/NDS/pages/57169350329/RFC+Nexus+Input+API#Uncontrolled-input
187
179
  */
188
180
  defaultValue?: InputHTMLAttributes<TElement>['defaultValue'];
189
181
  /**
190
- * Disable input.
191
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#disabled
182
+ * Makes the element not mutable, meaning the user can not edit the control
183
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly
192
184
  */
193
- disabled?: InputHTMLAttributes<TElement>['disabled'];
185
+ readOnly?: InputHTMLAttributes<HTMLInputElement>['readOnly'];
194
186
  /**
195
187
  * Set on change callback to get Event object.
196
188
  * @see https://reactjs.org/docs/events.html#form-events
@@ -475,7 +467,7 @@ export declare const InputCheckbox: ForwardRefExoticComponent<DataAttributes & A
475
467
  id?: string | undefined;
476
468
  role?: AriaRole | undefined;
477
469
  className?: string | undefined;
478
- } & NativePropsInteractive & CallbackPropsInteractive & ValidationProps & {
470
+ } & NativeProps_2 & CallbackPropsInteractive & ValidationProps & {
479
471
  label?: string | undefined;
480
472
  } & RefAttributes<HTMLInputElement>>;
481
473
 
@@ -483,7 +475,7 @@ export declare const InputColor: ForwardRefExoticComponent<DataAttributes & Aria
483
475
  id?: string | undefined;
484
476
  role?: AriaRole | undefined;
485
477
  className?: string | undefined;
486
- } & NativePropsInteractive & CallbackPropsTextual & Omit<ValidationProps, "validatorFn"> & {
478
+ } & NativeProps_2 & CallbackPropsTextual & Omit<ValidationProps, "validatorFn"> & {
487
479
  /**
488
480
  * Set text for placeholder.
489
481
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder
@@ -519,7 +511,6 @@ id?: string | undefined;
519
511
  role?: AriaRole | undefined;
520
512
  className?: string | undefined;
521
513
  } & {
522
- validation?: "error" | "valid" | "inProgress" | undefined;
523
514
  label?: string | undefined;
524
515
  children: ReactElement<ChildProps & unknown>[];
525
516
  name: string;
@@ -551,7 +542,7 @@ export declare const InputRadio: ForwardRefExoticComponent<DataAttributes & Aria
551
542
  id?: string | undefined;
552
543
  role?: AriaRole | undefined;
553
544
  className?: string | undefined;
554
- } & NativePropsInteractive & CallbackPropsInteractive & Omit<ValidationProps, "validatorFn"> & {
545
+ } & NativeProps_2 & CallbackPropsInteractive & Omit<ValidationProps, "validatorFn"> & {
555
546
  label?: string | undefined;
556
547
  } & RefAttributes<HTMLInputElement>>;
557
548
 
@@ -571,7 +562,15 @@ export declare const InputText: ForwardRefExoticComponent<DataAttributes & AriaA
571
562
  id?: string | undefined;
572
563
  role?: AriaRole | undefined;
573
564
  className?: string | undefined;
574
- } & NativePropsTextual & CallbackPropsTextual & ValidationProps & {
565
+ } & NativeProps_2 & {
566
+ inputMode?: "none" | "search" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
567
+ placeholder?: string | undefined;
568
+ autoComplete?: HTMLInputAutoCompleteAttribute | undefined;
569
+ maxLength?: number | undefined;
570
+ minLength?: number | undefined;
571
+ pattern?: string | undefined;
572
+ size?: number | undefined;
573
+ } & CallbackPropsTextual & ValidationProps & {
575
574
  /**
576
575
  * Define a type of TextInput. Allows developer to optionally set one from supported
577
576
  * text-like input types instead of default 'text'.
@@ -692,7 +691,30 @@ declare type NativeProps = {
692
691
  noValidate?: FormHTMLAttributes<HTMLFormElement>['noValidate'];
693
692
  };
694
693
 
695
- declare type NativePropsInteractive = Omit<NativePropsTextual, 'inputMode' | 'pattern' | 'readOnly' | 'minLength' | 'maxLength' | 'autoComplete' | 'placeholder' | 'size'>;
694
+ declare type NativeProps_2 = {
695
+ /**
696
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
697
+ */
698
+ name?: InputHTMLAttributes<HTMLInputElement>['name'];
699
+ /**
700
+ * Set native HTML `required` attribute.
701
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required
702
+ */
703
+ required?: InputHTMLAttributes<HTMLInputElement>['required'];
704
+ /**
705
+ * Provides substitute for native autofocus functionality.
706
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
707
+ * @see https://github.com/facebook/react/issues/11851#issuecomment-351672131
708
+ */
709
+ autoFocus?: InputHTMLAttributes<HTMLInputElement>['autoFocus'];
710
+ /**
711
+ * Disable input.
712
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#disabled
713
+ */
714
+ disabled?: InputHTMLAttributes<HTMLInputElement>['disabled'];
715
+ /** Set native HTML `form` attribute. */
716
+ form?: InputHTMLAttributes<HTMLInputElement>['form'];
717
+ };
696
718
 
697
719
  declare type NativePropsNumeric = Omit<NativePropsTextual, 'inputMode' | 'pattern' | 'maxLength' | 'minLength'> & {
698
720
  min?: InputHTMLAttributes<HTMLInputElement>['min'];
@@ -708,13 +730,7 @@ declare type NativePropsNumeric = Omit<NativePropsTextual, 'inputMode' | 'patter
708
730
  step?: InputHTMLAttributes<HTMLInputElement>['step'];
709
731
  };
710
732
 
711
- declare type NativePropsTextual = {
712
- /**
713
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
714
- */
715
- name?: InputHTMLAttributes<HTMLInputElement>['name'];
716
- /** Set input id attribute. */
717
- id?: string;
733
+ declare type NativePropsTextual = NativeProps_2 & {
718
734
  /**
719
735
  * Provides a hint about the type of data that might be entered by the user while
720
736
  * editing the element or its contents. This allows the browser to display an
@@ -722,17 +738,6 @@ declare type NativePropsTextual = {
722
738
  * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inputMode
723
739
  */
724
740
  inputMode?: InputHTMLAttributes<HTMLInputElement>['inputMode'];
725
- /**
726
- * Set native HTML `required` attribute.
727
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required
728
- */
729
- required?: InputHTMLAttributes<HTMLInputElement>['required'];
730
- /**
731
- * Provides substitute for native autofocus functionality.
732
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
733
- * @see https://github.com/facebook/react/issues/11851#issuecomment-351672131
734
- */
735
- autoFocus?: InputHTMLAttributes<HTMLInputElement>['autoFocus'];
736
741
  /**
737
742
  * Set text for placeholder.
738
743
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder
@@ -753,23 +758,11 @@ declare type NativePropsTextual = {
753
758
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/minlength
754
759
  */
755
760
  minLength?: InputHTMLAttributes<HTMLInputElement>['minLength'];
756
- /** Set native HTML `form` attribute. */
757
- form?: InputHTMLAttributes<HTMLInputElement>['form'];
758
- /**
759
- * Set native ARIA role attribute
760
- * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/input_role
761
- */
762
- role?: InputHTMLAttributes<HTMLInputElement>['role'];
763
761
  /**
764
762
  * Pattern attribute specifies a regular expression the form control's value should match.
765
763
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern
766
764
  */
767
765
  pattern?: InputHTMLAttributes<HTMLInputElement>['pattern'];
768
- /**
769
- * Makes the element not mutable, meaning the user can not edit the control
770
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly
771
- */
772
- readOnly?: InputHTMLAttributes<HTMLInputElement>['readOnly'];
773
766
  /**
774
767
  * Define the width of the input in characters
775
768
  */
@@ -1012,7 +1005,6 @@ declare type Props_3 = DataAttributes & LibraryProps & {
1012
1005
  };
1013
1006
 
1014
1007
  declare type Props_4 = DataAttributes & LibraryProps & {
1015
- validation?: keyof typeof ValidationState;
1016
1008
  label?: string;
1017
1009
  children: ReactElement<ChildProps & unknown>[];
1018
1010
  name: string;
@@ -1093,7 +1085,7 @@ export declare const Select: ForwardRefExoticComponent<DataAttributes & AriaAttr
1093
1085
  id?: string | undefined;
1094
1086
  role?: AriaRole | undefined;
1095
1087
  className?: string | undefined;
1096
- } & NativePropsInteractive & Omit<CallbackPropsTextual<HTMLSelectElement>, "defaultValue"> & ValidationProps & {
1088
+ } & NativeProps_2 & Omit<CallbackPropsTextual<HTMLSelectElement>, "defaultValue"> & ValidationProps & {
1097
1089
  children?: ReactNode;
1098
1090
  prefix?: FC | undefined;
1099
1091
  multiple?: SelectHTMLAttributes<HTMLSelectElement>['multiple'];
@@ -1629,15 +1621,15 @@ export declare const useToastState: (id: string) => {
1629
1621
  };
1630
1622
 
1631
1623
  declare type ValidationProps = {
1624
+ /** Enable to re-run validation when any field in the form changes */
1625
+ revalidateOnFormChange?: boolean;
1626
+ /**
1627
+ * Provide callback function to validate input.
1628
+ * @see https://koval.support/inputs/input-validation
1629
+ */
1632
1630
  validatorFn?: (value: unknown, validityState: ValidityState, formState: FormState_2) => string | Promise<string>;
1633
1631
  };
1634
1632
 
1635
- declare enum ValidationState {
1636
- error = "error",
1637
- valid = "valid",
1638
- inProgress = "inProgress"
1639
- }
1640
-
1641
1633
  declare enum Variants {
1642
1634
  bordered = "bordered",
1643
1635
  plain = "plain"