@appcircle/mosaic 1.2.0 → 1.3.0

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.
@@ -77,20 +77,34 @@ export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "className"
77
77
  /** The four words these two buttons say. Override for a non-English UI. */
78
78
  labels?: Partial<InputLabels>;
79
79
  /**
80
- * A live character count under the field, when `maxLength` is set.
80
+ * A live count under the field, when `maxLength` is set: characters, or whatever `countOf` counts.
81
81
  *
82
82
  * **Opt-in here, and on by default in `Textarea`.** The reason for a count is the same in both -
83
83
  * `maxLength` stops accepting keystrokes without saying anything - but the fields are not: a
84
84
  * one-line box is usually limited at a length nobody is going to reach (a name at 31, a key at
85
85
  * 64), and a counter under every one of those is noise under a field that will never be full.
86
86
  * Ask for it where the limit is part of what is being written and the reader is working up to
87
- * it - a store listing's keywords at 100 characters, which sits under three textareas that all
88
- * count (2026-09-19).
87
+ * it - a store listing's keywords, which sits under three textareas that all count (2026-09-19).
88
+ * The App Store counts those keywords in bytes; see `countOf`.
89
89
  *
90
90
  * Only a controlled field can be counted: an uncontrolled one's length is not knowable without
91
91
  * holding state here, which is the thing this component does not do.
92
92
  */
93
93
  showCount?: boolean;
94
+ /**
95
+ * What the count counts, when the limit is not in characters. Defaults to the value's length.
96
+ *
97
+ * A store can limit a field in something else: the App Store counts the keywords in UTF-8 bytes,
98
+ * where `ş` is two of them, so a character count under-reports and the store rejects a value
99
+ * the field said would fit. Pass `(value) => new TextEncoder().encode(value).length` there.
100
+ *
101
+ * It changes only the number shown. `maxLength` is still the browser's and counts characters,
102
+ * so holding the value to a byte limit stays with the caller; a value past the limit counts
103
+ * past it (`120 / 100`) rather than being cut. For the same reason `countOf` must never count
104
+ * less than the value's length: the browser stops typing at `maxLength` characters whatever the
105
+ * count says, so a unit smaller than a character (a grapheme, a word) would stop at `7 / 30`.
106
+ */
107
+ countOf?: (value: string) => number;
94
108
  className?: string;
95
109
  };
96
110
  /**
@@ -184,20 +198,34 @@ export declare const Input: import("react").ForwardRefExoticComponent<Omit<Input
184
198
  /** The four words these two buttons say. Override for a non-English UI. */
185
199
  labels?: Partial<InputLabels>;
186
200
  /**
187
- * A live character count under the field, when `maxLength` is set.
201
+ * A live count under the field, when `maxLength` is set: characters, or whatever `countOf` counts.
188
202
  *
189
203
  * **Opt-in here, and on by default in `Textarea`.** The reason for a count is the same in both -
190
204
  * `maxLength` stops accepting keystrokes without saying anything - but the fields are not: a
191
205
  * one-line box is usually limited at a length nobody is going to reach (a name at 31, a key at
192
206
  * 64), and a counter under every one of those is noise under a field that will never be full.
193
207
  * Ask for it where the limit is part of what is being written and the reader is working up to
194
- * it - a store listing's keywords at 100 characters, which sits under three textareas that all
195
- * count (2026-09-19).
208
+ * it - a store listing's keywords, which sits under three textareas that all count (2026-09-19).
209
+ * The App Store counts those keywords in bytes; see `countOf`.
196
210
  *
197
211
  * Only a controlled field can be counted: an uncontrolled one's length is not knowable without
198
212
  * holding state here, which is the thing this component does not do.
199
213
  */
200
214
  showCount?: boolean;
215
+ /**
216
+ * What the count counts, when the limit is not in characters. Defaults to the value's length.
217
+ *
218
+ * A store can limit a field in something else: the App Store counts the keywords in UTF-8 bytes,
219
+ * where `ş` is two of them, so a character count under-reports and the store rejects a value
220
+ * the field said would fit. Pass `(value) => new TextEncoder().encode(value).length` there.
221
+ *
222
+ * It changes only the number shown. `maxLength` is still the browser's and counts characters,
223
+ * so holding the value to a byte limit stays with the caller; a value past the limit counts
224
+ * past it (`120 / 100`) rather than being cut. For the same reason `countOf` must never count
225
+ * less than the value's length: the browser stops typing at `maxLength` characters whatever the
226
+ * count says, so a unit smaller than a character (a grapheme, a word) would stop at `7 / 30`.
227
+ */
228
+ countOf?: (value: string) => number;
201
229
  className?: string;
202
230
  } & import("react").RefAttributes<HTMLInputElement>>;
203
231
  //# sourceMappingURL=Input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["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