@fuf-stack/megapixels 0.9.15 → 0.10.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,375 +0,0 @@
1
- import * as _fuf_stack_veto_dist_types_d_BDYR8HZ30 from "@fuf-stack/veto/dist/types.d-BDYR8HZ3";
2
- import { vInfer } from "@fuf-stack/veto";
3
- import { ReactNode } from "react";
4
- import * as tailwind_variants0 from "tailwind-variants";
5
- import * as react_jsx_runtime0 from "react/jsx-runtime";
6
- import { TVClassName } from "@fuf-stack/pixel-utils";
7
-
8
- //#region src/Filter/filters/checkboxes/schema.d.ts
9
- /** configuration of the filter */
10
- declare const config$1: _fuf_stack_veto_dist_types_d_BDYR8HZ30.q<{
11
- /**
12
- * Human‑readable label used in the UI (e.g. label and modal header).
13
- * Example: "Snacks", "Mood"
14
- */
15
- text: _fuf_stack_veto_dist_types_d_BDYR8HZ30.h;
16
- /**
17
- * Options rendered as multiple checkboxes. Each option needs a `label`
18
- * (what the user sees) and a `value` (what is written into the form state).
19
- * Label can be a string, React node, or a function that receives mode
20
- * ('form' or 'display') and returns a React node.
21
- */
22
- options: _fuf_stack_veto_dist_types_d_BDYR8HZ30.c<_fuf_stack_veto_dist_types_d_BDYR8HZ30.q<{
23
- label: _fuf_stack_veto_dist_types_d_BDYR8HZ30.Z;
24
- value: _fuf_stack_veto_dist_types_d_BDYR8HZ30.h;
25
- }, "strict", _fuf_stack_veto_dist_types_d_BDYR8HZ30.a, {
26
- value: string;
27
- label?: any;
28
- }, {
29
- value: string;
30
- label?: any;
31
- }>, "many">;
32
- }, "strict", _fuf_stack_veto_dist_types_d_BDYR8HZ30.a, {
33
- text: string;
34
- options: {
35
- value: string;
36
- label?: any;
37
- }[];
38
- }, {
39
- text: string;
40
- options: {
41
- value: string;
42
- label?: any;
43
- }[];
44
- }>;
45
- /** Type-safe Config that overrides label to support ReactNode or function */
46
- type Config = Omit<vInfer<typeof config$1>, 'options'> & {
47
- options: {
48
- label: ReactNode | ((mode: 'form' | 'display') => ReactNode);
49
- value: string;
50
- }[];
51
- };
52
- //#endregion
53
- //#region src/Filter/filters/types.d.ts
54
- /**
55
- * FilterDefinition
56
- *
57
- * Declarative description of a filter. A FilterDefinition is not used
58
- * directly by the UI. Instead, it is passed to `createFilter` to produce a
59
- * concrete, runtime `FilterInstance` for a specific usage (with name/icon and
60
- * optional config overrides).
61
- *
62
- * @typeParam Config - The configuration object shape for this filter
63
- * @typeParam Value - The runtime value type produced/consumed by this filter
64
- */
65
- interface FilterDefinition<Config, Value> {
66
- components: {
67
- /**
68
- * Display component rendered inside the filter chip. Receives the current
69
- * filter `value` and the merged `config`.
70
- */
71
- Display: (props: {
72
- value: Value;
73
- config: Config;
74
- }) => ReactNode;
75
- /**
76
- * Form component rendered inside the modal. Receives the fully-qualified
77
- * field name and the merged, validated `config`.
78
- */
79
- Form: (props: {
80
- fieldName: string;
81
- config: Config;
82
- }) => ReactNode;
83
- };
84
- defaults: {
85
- /** Baseline configuration for the filter; can be overridden per usage */config: Config; /** Initial form value seeded when a filter is added */
86
- value: Value;
87
- };
88
- /**
89
- * Validation factory returning an ex-validator schema for the value shape.
90
- * Receives the (merged) `config` so the schema can depend on configuration.
91
- */
92
- validation: (config?: Config) => unknown;
93
- }
94
- /**
95
- * FilterFactory
96
- *
97
- * A filter exports a factory that, given name/icon and optional config
98
- * overrides, returns a concrete FilterInstance with merged config and a
99
- * computed defaultValue.
100
- *
101
- * @typeParam Config - Configuration object shape for the filter
102
- * @typeParam Value - Runtime value type for the filter
103
- */
104
- type FilterFactory<Config, Value> = (args: {
105
- /** Per-usage configuration overrides merged with `defaults.config` */config?: Partial<Config>; /** Optional icon element shown in menus/labels */
106
- icon?: ReactNode; /** Logical field name under `filter.{name}` */
107
- name: string;
108
- }) => FilterInstance<Config, Value>;
109
- /**
110
- * FilterInstance
111
- *
112
- * Runtime instance created by merging a filter's defaults with usage
113
- * overrides and attaching name/icon for UI.
114
- *
115
- * This is the only shape used by the rendering layer and context.
116
- *
117
- * @typeParam Config - Effective configuration object shape
118
- * @typeParam Value - Effective value type for the filter
119
- */
120
- interface FilterInstance<Config, Value> {
121
- /** UI components (Form/Display) provided by the filter */
122
- components: FilterDefinition<Config, Value>['components'];
123
- /** Merged configuration (`defaults.config` overlaid with per-usage overrides) */
124
- config: Config;
125
- /** Initial form value to seed when adding this filter */
126
- defaultValue: Value;
127
- /** Optional icon element used in menus/labels */
128
- icon?: ReactNode;
129
- /** Logical field name under `filter.{name}` */
130
- name: string;
131
- /** ex-validator schema factory for the value; typically closure over config */
132
- validation: (config?: Config) => unknown;
133
- }
134
- /**
135
- * FiltersConfiguration
136
- *
137
- * Top-level collection of instantiated filters used by the Filter component
138
- * and FiltersContext. Each entry is a concrete FilterInstance (already created
139
- * via a filter factory), carrying its merged config, default value, UI
140
- * components, and validate function.
141
- */
142
- type FiltersConfiguration = FilterInstance<any, any>[];
143
- /**
144
- * FilterDisplayProps
145
- *
146
- * Props provided to a filter's Display component. Derived from an active
147
- * FilterInstance at runtime.
148
- *
149
- * @typeParam Config - Effective configuration type for the instance
150
- * @typeParam Value - Effective value type for the instance
151
- */
152
- interface FilterDisplayProps<Config, Value> {
153
- /** Merged configuration for the filter instance */
154
- config: Config;
155
- /** Current (possibly partial) value for the filter instance */
156
- value: Value;
157
- }
158
- /**
159
- * FilterFormProps
160
- *
161
- * Props provided to a filter's Form component. The `fieldName` is the
162
- * fully-qualified path in the host form, and the `config` is the instance's
163
- * merged configuration.
164
- *
165
- * @typeParam Config - Effective configuration type for the instance
166
- */
167
- interface FilterFormProps<Config> {
168
- /** Merged configuration for the filter instance */
169
- config: Config;
170
- /** Fully-qualified form field path (e.g., `filter.status`) */
171
- fieldName: string;
172
- }
173
- //#endregion
174
- //#region src/Filter/Subcomponents/SearchInput.d.ts
175
- type SearchConfiguration = boolean | {
176
- /** Placeholder shown in the search input */placeholder?: string;
177
- };
178
- //#endregion
179
- //#region src/Filter/Filter.d.ts
180
- declare const filterVariants: tailwind_variants0.TVReturnType<{
181
- [key: string]: {
182
- [key: string]: tailwind_variants0.ClassValue | {
183
- base?: tailwind_variants0.ClassValue;
184
- addFilterMenuButton?: tailwind_variants0.ClassValue;
185
- addFilterMenuItem?: tailwind_variants0.ClassValue;
186
- activeFilterLabel?: tailwind_variants0.ClassValue;
187
- filterModalBody?: tailwind_variants0.ClassValue;
188
- filterModalHeader?: tailwind_variants0.ClassValue;
189
- filterModalFooter?: tailwind_variants0.ClassValue;
190
- form?: tailwind_variants0.ClassValue;
191
- searchInput?: tailwind_variants0.ClassValue;
192
- searchInputWrapper?: tailwind_variants0.ClassValue;
193
- searchMotionDiv?: tailwind_variants0.ClassValue;
194
- searchShowButton?: tailwind_variants0.ClassValue;
195
- searchSubmitButton?: tailwind_variants0.ClassValue;
196
- searchWrapper?: tailwind_variants0.ClassValue;
197
- };
198
- };
199
- } | {
200
- [x: string]: {
201
- [x: string]: tailwind_variants0.ClassValue | {
202
- base?: tailwind_variants0.ClassValue;
203
- addFilterMenuButton?: tailwind_variants0.ClassValue;
204
- addFilterMenuItem?: tailwind_variants0.ClassValue;
205
- activeFilterLabel?: tailwind_variants0.ClassValue;
206
- filterModalBody?: tailwind_variants0.ClassValue;
207
- filterModalHeader?: tailwind_variants0.ClassValue;
208
- filterModalFooter?: tailwind_variants0.ClassValue;
209
- form?: tailwind_variants0.ClassValue;
210
- searchInput?: tailwind_variants0.ClassValue;
211
- searchInputWrapper?: tailwind_variants0.ClassValue;
212
- searchMotionDiv?: tailwind_variants0.ClassValue;
213
- searchShowButton?: tailwind_variants0.ClassValue;
214
- searchSubmitButton?: tailwind_variants0.ClassValue;
215
- searchWrapper?: tailwind_variants0.ClassValue;
216
- };
217
- };
218
- } | {}, {
219
- base: string;
220
- addFilterMenuButton: string;
221
- addFilterMenuItem: string;
222
- activeFilterLabel: string;
223
- filterModalBody: string;
224
- filterModalHeader: string;
225
- filterModalFooter: string;
226
- form: string;
227
- searchInput: string;
228
- searchInputWrapper: string;
229
- searchMotionDiv: string;
230
- searchShowButton: string;
231
- searchSubmitButton: string;
232
- searchWrapper: string;
233
- }, undefined, {
234
- [key: string]: {
235
- [key: string]: tailwind_variants0.ClassValue | {
236
- base?: tailwind_variants0.ClassValue;
237
- addFilterMenuButton?: tailwind_variants0.ClassValue;
238
- addFilterMenuItem?: tailwind_variants0.ClassValue;
239
- activeFilterLabel?: tailwind_variants0.ClassValue;
240
- filterModalBody?: tailwind_variants0.ClassValue;
241
- filterModalHeader?: tailwind_variants0.ClassValue;
242
- filterModalFooter?: tailwind_variants0.ClassValue;
243
- form?: tailwind_variants0.ClassValue;
244
- searchInput?: tailwind_variants0.ClassValue;
245
- searchInputWrapper?: tailwind_variants0.ClassValue;
246
- searchMotionDiv?: tailwind_variants0.ClassValue;
247
- searchShowButton?: tailwind_variants0.ClassValue;
248
- searchSubmitButton?: tailwind_variants0.ClassValue;
249
- searchWrapper?: tailwind_variants0.ClassValue;
250
- };
251
- };
252
- } | {}, {
253
- base: string;
254
- addFilterMenuButton: string;
255
- addFilterMenuItem: string;
256
- activeFilterLabel: string;
257
- filterModalBody: string;
258
- filterModalHeader: string;
259
- filterModalFooter: string;
260
- form: string;
261
- searchInput: string;
262
- searchInputWrapper: string;
263
- searchMotionDiv: string;
264
- searchShowButton: string;
265
- searchSubmitButton: string;
266
- searchWrapper: string;
267
- }, tailwind_variants0.TVReturnType<unknown, {
268
- base: string;
269
- addFilterMenuButton: string;
270
- addFilterMenuItem: string;
271
- activeFilterLabel: string;
272
- filterModalBody: string;
273
- filterModalHeader: string;
274
- filterModalFooter: string;
275
- form: string;
276
- searchInput: string;
277
- searchInputWrapper: string;
278
- searchMotionDiv: string;
279
- searchShowButton: string;
280
- searchSubmitButton: string;
281
- searchWrapper: string;
282
- }, undefined, unknown, unknown, undefined>>;
283
- type ClassName = TVClassName<typeof filterVariants>;
284
- interface FilterValues {
285
- search?: string;
286
- filter?: string | Record<string, unknown> | null;
287
- }
288
- type FilterChildRenderFn = (values: {
289
- search?: string;
290
- filter?: Record<string, unknown>;
291
- }) => ReactNode;
292
- /**
293
- * Filter
294
- *
295
- * Controlled, form-driven filter UI.
296
- *
297
- * Responsibilities
298
- * - Derives initial form values from the controlled `values` prop
299
- * - Builds a composite validation schema from the filter registry (and optional search)
300
- * - Exposes ergonomic UI: active filters list, add/remove actions, and per-filter modal
301
- * - Commits changes by invoking the controlled `onChange` callback on submit
302
- *
303
- * Structure
304
- * - Owns an ex-forms `Form` that wraps the entire filter experience
305
- * - Optionally renders a search input bound to the `search` field
306
- * - Renders ActiveFilters, AddFilterMenu, and FilterModal inside a shared context
307
- * - Optionally renders children as a render-prop with the resolved `values`
308
- */
309
- interface FilterProps {
310
- /** Optional render-prop that receives the resolved, controlled values */
311
- children?: FilterChildRenderFn;
312
- /** CSS class name */
313
- className?: ClassName;
314
- /** Configuration of the filter */
315
- config: {
316
- /**
317
- * Declarative filter configuration. Each entry ties a logical name to a
318
- * registry filter type and (optionally) per-usage config overrides.
319
- */
320
- filters: FiltersConfiguration; /** Optional configuration for search field */
321
- search?: SearchConfiguration;
322
- };
323
- /** ex-forms form instance name. Defaults to "filterComponentForm". */
324
- formName?: string;
325
- /** Controlled setter invoked on submit with the next canonical values */
326
- onChange: (nextValues: FilterValues) => void;
327
- /** Controlled committed state: the canonical `search` and `filter` values */
328
- values: FilterValues;
329
- }
330
- /**
331
- * Renders the filter UI bound to a single ex-forms `Form`.
332
- * The form is the source of truth during user interaction; the committed
333
- * state is controlled by the parent via `values`/`onChange`.
334
- */
335
- declare const Filter: ({
336
- children,
337
- className,
338
- config,
339
- formName,
340
- onChange,
341
- values
342
- }: FilterProps) => react_jsx_runtime0.JSX.Element;
343
- //#endregion
344
- //#region src/Filter/filters/createFilter.d.ts
345
- /**
346
- * createFilter
347
- *
348
- * Builds a filter factory from a static FilterDefinition. The returned factory
349
- * accepts a usage descriptor (name/icon and optional partial config) and
350
- * produces a concrete FilterInstance with:
351
- * - merged config (shallow: definition.defaults.config overlaid by overrides)
352
- * - Form/Display components
353
- * - validate function (forwarded from the definition)
354
- * - defaultValue (forwarded from the definition)
355
- * - name and icon for UI integration
356
- *
357
- * @typeParam Config - Configuration object shape for the filter
358
- * @typeParam Value - Runtime value type for the filter
359
- * @param definition - Static description of the filter (components, defaults, validate)
360
- * @returns FilterFactory that creates FilterInstance<Config, Value>
361
- */
362
- declare const createFilter: <Config, Value>(definition: FilterDefinition<Config, Value>) => FilterFactory<Config, Value>;
363
- //#endregion
364
- //#region src/Filter/index.d.ts
365
- declare const filters: {
366
- boolean: FilterFactory<{
367
- text: string;
368
- textPrefix?: string | undefined;
369
- textNoWord?: string | undefined;
370
- }, boolean | undefined>;
371
- checkboxes: FilterFactory<Config, string[]>;
372
- };
373
- //#endregion
374
- export { FilterProps as a, FilterDefinition as c, FilterFormProps as d, FilterInstance as f, FilterChildRenderFn as i, FilterDisplayProps as l, createFilter as n, FilterValues as o, FiltersConfiguration as p, Filter as r, filterVariants as s, filters as t, FilterFactory as u };
375
- //# sourceMappingURL=index-DhAXVjv5.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-DhAXVjv5.d.cts","names":[],"sources":["../src/Filter/filters/checkboxes/schema.ts","../src/Filter/filters/types.ts","../src/Filter/Subcomponents/SearchInput.tsx","../src/Filter/Filter.tsx","../src/Filter/filters/createFilter.ts","../src/Filter/index.ts"],"mappings":";;;;;;;;;cAMa,QAAA,yCAAM,CAAA;;;;;QAajB,sCAAA,CAAA,CAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAGU,MAAA,GAAS,IAAA,CAAK,MAAA,QAAc,QAAA;EACtC,OAAA;IACE,KAAA,EAAO,SAAA,KAAc,IAAA,yBAA6B,SAAA;IAClD,KAAA;EAAA;AAAA;;;;;;;;;;AAnBJ;;;;UCOiB,gBAAA;EACf,UAAA;;;;;IAKE,OAAA,GAAU,KAAA;MAAS,KAAA,EAAO,KAAA;MAAO,MAAA,EAAQ,MAAA;IAAA,MA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