@apolitical/component-library 6.6.0-SW.1 → 6.6.0-SW.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,7 @@ export declare const Checkbox: ({ className, disabled, element, functions: allFu
30
30
  multipleInputs?: {
31
31
  showCount?: boolean | undefined;
32
32
  label?: string | undefined;
33
+ defaultInputs?: number | undefined;
33
34
  maxInputs: number;
34
35
  hasButton?: false | import("../../../../../..").ButtonPropsType | undefined;
35
36
  } | undefined;
@@ -42,6 +43,7 @@ export declare const Checkbox: ({ className, disabled, element, functions: allFu
42
43
  required?: boolean | undefined;
43
44
  submitOnEnter?: boolean | undefined;
44
45
  styling?: {
46
+ autosizeToFit?: boolean | undefined;
45
47
  displayOptionsAsPills?: boolean | undefined;
46
48
  } | undefined;
47
49
  validation?: import("../../../form.types").IFieldValidation[] | undefined;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { IField, InputTypes, InputValues } from '../../../form.types';
3
- export declare const Input: ({ className, element, id, inputRef: ref, functions, name, placeholder, type, value, autoFocus, label, ...props }: IField) => React.DOMElement<{
2
+ import { IField, InputValues } from '../../../form.types';
3
+ export declare const Input: ({ className, element, id, inputRef: ref, functions, name, placeholder, type, value, autoFocus, label, styling, ...props }: IField) => React.DOMElement<{
4
4
  onChange: (e: React.FormEvent<HTMLInputElement>) => void;
5
5
  onMultiSelectSubmit?: ((arg1: import("../../../form.types").FormValues) => void) | undefined;
6
6
  onBlur?: (() => void) | undefined;
@@ -8,7 +8,6 @@ export declare const Input: ({ className, element, id, inputRef: ref, functions,
8
8
  onKeyInput?: (<T>(arg1: import("../../../form.types").FormValues) => Promise<T>) | undefined;
9
9
  onKeyDown?: ((e: React.KeyboardEvent<HTMLElement>) => void) | undefined;
10
10
  submitForm?: ((arg: import("../../../form.types").IFormValues) => void) | undefined;
11
- type: InputTypes;
12
11
  id: string | undefined;
13
12
  name: string | undefined;
14
13
  className: string;
@@ -44,6 +43,7 @@ export declare const Input: ({ className, element, id, inputRef: ref, functions,
44
43
  multipleInputs?: {
45
44
  showCount?: boolean | undefined;
46
45
  label?: string | undefined;
46
+ defaultInputs?: number | undefined;
47
47
  maxInputs: number;
48
48
  hasButton?: false | import("../../../../../..").ButtonPropsType | undefined;
49
49
  } | undefined;
@@ -54,9 +54,6 @@ export declare const Input: ({ className, element, id, inputRef: ref, functions,
54
54
  required?: boolean | undefined;
55
55
  shownValue?: InputValues | undefined;
56
56
  submitOnEnter?: boolean | undefined;
57
- styling?: {
58
- displayOptionsAsPills?: boolean | undefined;
59
- } | undefined;
60
57
  validation?: import("../../../form.types").IFieldValidation[] | undefined;
61
58
  ref: React.RefObject<HTMLInputElement>;
62
59
  }, HTMLInputElement>;
@@ -153,6 +153,8 @@ export interface IField {
153
153
  showCount?: boolean;
154
154
  /** The template text for each label */
155
155
  label?: string;
156
+ /** The number of inputs to show by default, without a remove button */
157
+ defaultInputs?: number;
156
158
  /** How many inputs can be added in total */
157
159
  maxInputs: number;
158
160
  /** Whether to add options with a button */
@@ -175,6 +177,8 @@ export interface IField {
175
177
  /** Whether hitting enter on the field should submit the form */
176
178
  submitOnEnter?: boolean;
177
179
  styling?: {
180
+ /** Whether the input should automatically resize to fit; only works on `textarea` types */
181
+ autosizeToFit?: boolean;
178
182
  /** Whether to display options for the multiselect as pills */
179
183
  displayOptionsAsPills?: boolean;
180
184
  };
@@ -265,7 +269,11 @@ export interface IFieldWrapper extends IField {
265
269
  /** The setter to amend the fields to validate; this is needed for multiple inputs, to give each input its own error handling */
266
270
  fieldData?: {
267
271
  fields: IField[];
268
- setFields: React.Dispatch<React.SetStateAction<IField[]>>;
272
+ multipleInputs: (string | undefined)[];
273
+ setFields: React.Dispatch<React.SetStateAction<{
274
+ fieldsToValidate: IField[];
275
+ multipleInputs: (string | undefined)[];
276
+ }>>;
269
277
  dispatch: React.Dispatch<IFormReducerAction>;
270
278
  };
271
279
  /** Optional siblings to render alongside component */
package/hooks/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './use-auto-resize';
1
2
  export { default as useCurrentPath } from './use-current-path';
2
3
  export { default as useEffectAfterMount } from './use-effect-after-mount';
3
4
  export { default as useElementWidth } from './use-element-width';
@@ -0,0 +1 @@
1
+ export { default as useAutoResize } from './use-auto-resize';
@@ -0,0 +1,3 @@
1
+ import { MutableRefObject } from 'react';
2
+ declare const _default: (shouldResize: boolean, inputRef?: MutableRefObject<HTMLTextAreaElement | HTMLInputElement | null>) => false | MutableRefObject<HTMLTextAreaElement | HTMLInputElement | null>;
3
+ export default _default;