@purpurds/text-field 5.3.0 → 5.4.1

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.
@@ -1,6 +1,6 @@
1
1
  import { default as React, ComponentPropsWithoutRef, HTMLInputTypeAttribute, ReactNode } from 'react';
2
2
 
3
- export type TextFieldProps = ComponentPropsWithoutRef<"input"> & {
3
+ type TextFieldBaseProps = {
4
4
  ["data-testid"]?: string;
5
5
  className?: string;
6
6
  /**
@@ -47,51 +47,26 @@ export type TextFieldProps = ComponentPropsWithoutRef<"input"> & {
47
47
  */
48
48
  valid?: boolean;
49
49
  };
50
- export declare const TextField: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
51
- "data-testid"?: string | undefined;
52
- className?: string | undefined;
50
+ type TextFieldClearProps = {
53
51
  /**
54
- * Use to display e.g. a button after the text field.
55
- *
56
- * _NOTE: Should ideally only be used by other purpur components!_
57
- */
58
- afterField?: ReactNode;
59
- /**
60
- * Use to display e.g. an icon at the end inside of the text field.
61
- *
62
- * _NOTE: Should ideally only be used by other purpur components!_
63
- */
64
- endAdornment?: ReactNode;
65
- /**
66
- * Use to render error message below the text field. The text field renders with error appearance.
52
+ * An accessible label for the clear button.
67
53
  * */
68
- errorText?: string | undefined;
54
+ clearButtonAllyLabel: string;
69
55
  /**
70
- * Use to give context about the field's input. Renders below the field.
56
+ * Event handler called when the clear button is clicked.
71
57
  * */
72
- helperText?: string | undefined;
58
+ onClear: () => void;
59
+ } | {
73
60
  /**
74
- * The label of the text field.
61
+ * An accessible label for the clear button.
75
62
  * */
76
- label?: string | undefined;
77
- /**
78
- * Use to render a spinner at the end inside of the text field.
79
- */
80
- loading?: boolean | undefined;
81
- /**
82
- * Use to display e.g. an icon at the start inside of the text field.
83
- *
84
- * _NOTE: Should ideally only be used by other purpur components!_
85
- */
86
- startAdornment?: ReactNode;
63
+ clearButtonAllyLabel?: never;
87
64
  /**
88
- * Use to set the type of the field.
89
- */
90
- type?: "number" | "search" | "text" | "email" | "password" | "tel" | undefined;
91
- /**
92
- * Use to render text field with valid appearance. A check
93
- * icon will render at the start inside of the input.
94
- */
95
- valid?: boolean | undefined;
96
- } & React.RefAttributes<HTMLInputElement>>;
65
+ * Event handler called when the clear button is clicked.
66
+ * */
67
+ onClear?: never;
68
+ };
69
+ export type TextFieldProps = ComponentPropsWithoutRef<"input"> & TextFieldBaseProps & TextFieldClearProps;
70
+ export declare const TextField: React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLInputElement>>;
71
+ export {};
97
72
  //# sourceMappingURL=text-field.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"text-field.d.ts","sourceRoot":"","sources":["../src/text-field.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,wBAAwB,EAGxB,sBAAsB,EACtB,SAAS,EAEV,MAAM,OAAO,CAAC;AAUf,MAAM,MAAM,cAAc,GAAG,wBAAwB,CAAC,OAAO,CAAC,GAAG;IAC/D,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;SAEK;IACL,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;SAEK;IACL,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;SAEK;IACL,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CACZ,sBAAsB,EACtB,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAC5D,CA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