@spark-web/text-input 1.1.0 → 1.2.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.
package/README.md CHANGED
@@ -7,7 +7,7 @@ Text input provides a way for inputting text. The component must be nested
7
7
  within a [`Field`](/package/field). See [`Field`](/package/field) for more
8
8
  details.
9
9
 
10
- ## Examples
10
+ ## Text Input
11
11
 
12
12
  ### Controlled
13
13
 
@@ -76,8 +76,29 @@ return (
76
76
  );
77
77
  ```
78
78
 
79
+ ## InputContainer
80
+
81
+ The `InputContainer` is used internally to handle some shared styling between
82
+ components that are wrapped in the `Field` component.
83
+
84
+ Typically input adornments (icons or buttons that _appear_ to be inside the
85
+ input) will be absolutely positioning above it and padding is applied to make
86
+ sure that text does not get obscured below the adornments.
87
+
88
+ On top of this, password managers will insert buttons above the input which can
89
+ get in the way of our adornments.
90
+
91
+ To get around these problems, we wrap the input and adornments with the
92
+ `InputContainer` and apply our own focus styles to an absolutely positioned
93
+ element that is an adjacent sibling of the input (when the input is focused).
94
+
95
+ The `InputContainer` also provides the border and background styles and has
96
+ slots to place the start and end adornments.
97
+
79
98
  ## Props
80
99
 
100
+ ### TextInput
101
+
81
102
  | Prop | Type | Default | Description |
82
103
  | ------------ | ----------------------------------------------------------------------------------- | ------- | -------------------------------------------------------------------------------------------- |
83
104
  | data? | [DataAttributeMap][data-attribute-map] | | Sets data attributes for the component. |
@@ -94,3 +115,12 @@ return (
94
115
  https://github.com/brighte-labs/spark-web/blob/e7f6f4285b4cfd876312cc89fbdd094039aa239a/packages/utils/src/internal/buildDataAttributes.ts#L1
95
116
  [adornment-children]:
96
117
  https://github.com/brighte-labs/spark-web/blob/d4da46200f2d6e5e9291d3c650eaaff7e53f411b/packages/text-input/src/childrenToAdornments.tsx#L12
118
+
119
+ ### InputContainer
120
+
121
+ | Prop | Type | Default | Description |
122
+ | --------------- | ----------------------------------- | ------- | ------------------------------- |
123
+ | startAdornment? | ReactElement\<InputAdornmentProps\> | | Slot to start render adornment. |
124
+ | endAdornment? | ReactElement\<InputAdornmentProps\> | | Slot to end render adornment. |
125
+
126
+ Extra props are passed into the underlying [`Box`](/package/box) component.
@@ -0,0 +1,10 @@
1
+ import type { BoxProps } from '@spark-web/box';
2
+ import type { ReactElement } from 'react';
3
+ import type { InputAdornmentProps } from './InputAdornment';
4
+ export declare type InputContainerProps = {
5
+ /** Slot to start render adornment. */
6
+ startAdornment?: ReactElement<InputAdornmentProps> | null;
7
+ /** Slot to end render adornment. */
8
+ endAdornment?: ReactElement<InputAdornmentProps> | null;
9
+ } & Omit<BoxProps, 'background' | 'position'>;
10
+ export declare const InputContainer: ({ children, startAdornment, endAdornment, ...boxProps }: InputContainerProps) => JSX.Element;