@campfire-interactive/ui 0.4.0 → 0.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.
- package/dist/index.d.ts +12 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -169,6 +169,15 @@ interface FilterSelect {
|
|
|
169
169
|
value: string;
|
|
170
170
|
label: React.ReactNode;
|
|
171
171
|
}[];
|
|
172
|
+
/**
|
|
173
|
+
* What the select reads when nothing is chosen. Defaults to "Any".
|
|
174
|
+
*
|
|
175
|
+
* Built from the label it was — `All ${label.toLowerCase()}` — which reads
|
|
176
|
+
* fine for "All statuses" and badly for everything else: the first two call
|
|
177
|
+
* sites produced "All area" and "All who". A caller that wants a plural
|
|
178
|
+
* passes one; the default is a word that works under any label.
|
|
179
|
+
*/
|
|
180
|
+
placeholder?: string;
|
|
172
181
|
}
|
|
173
182
|
interface FilterToggle {
|
|
174
183
|
id: string;
|
|
@@ -184,6 +193,8 @@ interface FilterBarProps {
|
|
|
184
193
|
onChange: (next: FilterValue) => void;
|
|
185
194
|
/** The button's label. Defaults to "Filters". */
|
|
186
195
|
label?: string;
|
|
196
|
+
/** The empty state of every select that does not name its own. Defaults to "Any". */
|
|
197
|
+
anyLabel?: string;
|
|
187
198
|
clearLabel?: string;
|
|
188
199
|
/** Announced on each chip's remove button — "Remove {{name}} filter". */
|
|
189
200
|
removeLabel?: (name: string) => string;
|
|
@@ -212,7 +223,7 @@ interface FilterBarProps {
|
|
|
212
223
|
* wants a different chip — "OEM: 3 selected" — and inventing it before there
|
|
213
224
|
* is a screen for it is how a shared component grows an API nobody uses.
|
|
214
225
|
*/
|
|
215
|
-
declare function FilterBar({ selects, toggles, value, onChange, label, clearLabel, removeLabel, className, }: FilterBarProps): react.JSX.Element;
|
|
226
|
+
declare function FilterBar({ selects, toggles, value, onChange, label, anyLabel, clearLabel, removeLabel, className, }: FilterBarProps): react.JSX.Element;
|
|
216
227
|
|
|
217
228
|
type InputSize = 'sm' | 'md' | 'lg';
|
|
218
229
|
/**
|
package/dist/index.js
CHANGED
|
@@ -504,6 +504,7 @@ function FilterBar({
|
|
|
504
504
|
value,
|
|
505
505
|
onChange,
|
|
506
506
|
label = "Filters",
|
|
507
|
+
anyLabel = "Any",
|
|
507
508
|
clearLabel = "Clear filters",
|
|
508
509
|
removeLabel = (name) => `Remove the ${name} filter`,
|
|
509
510
|
className
|
|
@@ -550,7 +551,7 @@ function FilterBar({
|
|
|
550
551
|
fullWidth: true,
|
|
551
552
|
"aria-label": s.label,
|
|
552
553
|
value: typeof value[s.id] === "string" ? value[s.id] : void 0,
|
|
553
|
-
placeholder:
|
|
554
|
+
placeholder: s.placeholder ?? anyLabel,
|
|
554
555
|
options: s.options,
|
|
555
556
|
onValueChange: (v) => set(s.id, v)
|
|
556
557
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campfire-interactive/ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Shared UI primitives for the Campfire Suite — Radix behavior, plain CSS styled entirely from the design tokens, no Tailwind required",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|