@fuf-stack/megapixels 0.17.1 → 1.0.0-next.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.
Files changed (32) hide show
  1. package/README.md +3 -1
  2. package/dist/DataTable/index.d.mts +1 -1
  3. package/dist/DataTable/index.mjs +1 -2
  4. package/dist/{DataTable-Dw8152NO.mjs → DataTable-Ml6QySfA.mjs} +588 -444
  5. package/dist/DataTable-Ml6QySfA.mjs.map +1 -0
  6. package/dist/Filter/index.d.mts +1 -1
  7. package/dist/Filter/index.mjs +1 -2
  8. package/dist/{Filter-DcWQ5wx8.mjs → Filter-DXRC8M5M.mjs} +138 -83
  9. package/dist/Filter-DXRC8M5M.mjs.map +1 -0
  10. package/dist/Notification/index.d.mts +1 -1
  11. package/dist/Notification/index.mjs +1 -2
  12. package/dist/{Notification-kqOpVaUX.mjs → Notification-Dei4OOE6.mjs} +4 -4
  13. package/dist/{Notification-kqOpVaUX.mjs.map → Notification-Dei4OOE6.mjs.map} +1 -1
  14. package/dist/VirtualList/index.d.mts +1 -1
  15. package/dist/VirtualList/index.mjs +1 -2
  16. package/dist/VirtualList-sPPTnS7m.mjs +193 -0
  17. package/dist/VirtualList-sPPTnS7m.mjs.map +1 -0
  18. package/dist/{index-Qx3v5aZj.d.mts → index-B_ebAhwH.d.mts} +86 -67
  19. package/dist/{index-Qx3v5aZj.d.mts.map → index-B_ebAhwH.d.mts.map} +1 -1
  20. package/dist/{index-S3U3aT9O.d.mts → index-Bs5iWkFO.d.mts} +241 -160
  21. package/dist/{index-S3U3aT9O.d.mts.map → index-Bs5iWkFO.d.mts.map} +1 -1
  22. package/dist/{index-C8qpzima.d.mts → index-ClWVkO3I.d.mts} +2 -2
  23. package/dist/{index-C8qpzima.d.mts.map → index-ClWVkO3I.d.mts.map} +1 -1
  24. package/dist/{index-CKkcWwQs.d.mts → index-Dv6cWC7j.d.mts} +34 -15
  25. package/dist/{index-CKkcWwQs.d.mts.map → index-Dv6cWC7j.d.mts.map} +1 -1
  26. package/dist/index.d.mts +4 -4
  27. package/dist/index.mjs +4 -4
  28. package/package.json +13 -13
  29. package/dist/DataTable-Dw8152NO.mjs.map +0 -1
  30. package/dist/Filter-DcWQ5wx8.mjs.map +0 -1
  31. package/dist/VirtualList-GX38PUeR.mjs +0 -154
  32. package/dist/VirtualList-GX38PUeR.mjs.map +0 -1
@@ -1,11 +1,12 @@
1
+ import { useStyling } from "@fuf-stack/pixels/StylingProvider";
2
+ import { tv } from "@fuf-stack/pixel-utils";
1
3
  import { Suspense, createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
2
- import { tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
3
4
  import Button$1, { Button } from "@fuf-stack/pixels/Button";
4
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
5
6
  import Menu$1 from "@fuf-stack/pixels/Menu";
6
7
  import createDebug from "debug";
7
- import Form from "@fuf-stack/uniform/Form";
8
8
  import { any, array, boolean, object, refineArray, string, stringToJSON, veto } from "@fuf-stack/veto";
9
+ import Form from "@fuf-stack/uniform/Form";
9
10
  import { Label } from "@fuf-stack/pixels/Label";
10
11
  import { useFormContext } from "@fuf-stack/uniform/hooks/useFormContext";
11
12
  import { FaSliders } from "react-icons/fa6";
@@ -17,6 +18,39 @@ import { motion } from "@fuf-stack/pixel-motion";
17
18
  import Input from "@fuf-stack/uniform/Input";
18
19
  import Switch from "@fuf-stack/uniform/Switch";
19
20
  import Checkboxes from "@fuf-stack/uniform/Checkboxes";
21
+ //#region src/Filter/filterVariants.ts
22
+ /** Styling slots for Filter */
23
+ const filterVariants = tv({ slots: {
24
+ /** Active filter chip */
25
+ activeFilterLabel: "h-8 cursor-pointer rounded-md dark:text-foreground",
26
+ /** Add-filter menu trigger */
27
+ addFilterMenuButton: "",
28
+ /** Add-filter menu option */
29
+ addFilterMenuItem: "",
30
+ /** Filter search and actions container */
31
+ base: "flex flex-auto flex-col",
32
+ /** Filter editor body */
33
+ filterModalBody: "",
34
+ /** Filter editor actions */
35
+ filterModalFooter: "justify-between",
36
+ /** Filter editor heading */
37
+ filterModalHeader: "flex items-center gap-3 text-default-700",
38
+ /** Search and active filter row */
39
+ form: "mb-3 flex flex-wrap gap-3",
40
+ /** Editable search input */
41
+ searchInput: "",
42
+ /** Bordered search input surface */
43
+ searchInputWrapper: "",
44
+ /** Animated search reveal container */
45
+ searchMotionDiv: "flex w-72 gap-2",
46
+ /** Search reveal button */
47
+ searchShowButton: "",
48
+ /** Search submit button */
49
+ searchSubmitButton: "",
50
+ /** Search controls container */
51
+ searchWrapper: "flex items-center"
52
+ } });
53
+ //#endregion
20
54
  //#region src/Filter/hooks/useFilterValidation.ts
21
55
  /**
22
56
  * useFilterValidation
@@ -44,7 +78,7 @@ const useFilterValidation = (filters, withSearch) => {
44
78
  }, [filters, withSearch]);
45
79
  };
46
80
  //#endregion
47
- //#region src/Filter/Subcomponents/FiltersContext.tsx
81
+ //#region src/Filter/subcomponents/FiltersContext.tsx
48
82
  /**
49
83
  * FiltersContext
50
84
  *
@@ -105,7 +139,7 @@ const FiltersContextProvider = ({ children, config }) => {
105
139
  const getFilterValueByName = useCallback((name) => {
106
140
  return filterValue[name];
107
141
  }, [filterValue]);
108
- /** Open the filter edit modal for the given filter name. */
142
+ /** Open the filter edit modal for the given filter name */
109
143
  const showFilterModal = useCallback((name) => {
110
144
  const prev = getFilterValueByName(name);
111
145
  setCurrentModalFilter({
@@ -114,7 +148,7 @@ const FiltersContextProvider = ({ children, config }) => {
114
148
  previousValue: prev
115
149
  });
116
150
  }, [getFilterValueByName]);
117
- /** Close the filter edit modal. Rollback un-applied edits to controlled state. */
151
+ /** Close the filter edit modal. Rollback un-applied edits to controlled state */
118
152
  const closeFilterModal = useCallback(() => {
119
153
  if (currentModalFilter?.name) {
120
154
  const fieldName = getFilterFormFieldName(currentModalFilter.name);
@@ -271,26 +305,34 @@ const useFilters = () => {
271
305
  return ctx;
272
306
  };
273
307
  //#endregion
274
- //#region src/Filter/Subcomponents/ActiveFilters.tsx
308
+ //#region src/Filter/subcomponents/ActiveFilters.tsx
309
+ /** Layout of the edit action inside an active filter label */
310
+ const activeFilterTriggerVariants = tv({ base: "flex items-center gap-2" });
311
+ /** Active filter labels with separate edit and removal actions */
275
312
  const ActiveFilters = ({ className = void 0 }) => {
313
+ const styling = useStyling();
276
314
  const { activeFilters, getFilterValueByName, getFilterInstanceByName, hasError, removeFilter, showFilterModal } = useFilters();
315
+ const triggerClassName = styling.resolve(activeFilterTriggerVariants);
277
316
  return /* @__PURE__ */ jsx(Fragment$1, { children: activeFilters.map((name) => {
278
317
  const instance = getFilterInstanceByName(name);
279
318
  const value = getFilterValueByName(name);
280
319
  const DisplayComponent = instance.components.Display;
281
- return /* @__PURE__ */ jsx("button", {
282
- "aria-label": `Open ${name} filter`,
283
- onClick: () => {
284
- showFilterModal(name);
285
- },
286
- type: "button",
287
- children: /* @__PURE__ */ jsxs(Label, {
288
- className,
289
- color: hasError(name) ? "danger" : "primary",
290
- onClose: () => {
291
- removeFilter(name);
292
- },
293
- variant: "flat",
320
+ const handleOpen = () => {
321
+ showFilterModal(name);
322
+ };
323
+ const handleRemove = () => {
324
+ removeFilter(name);
325
+ };
326
+ return /* @__PURE__ */ jsx(Label, {
327
+ className,
328
+ color: hasError(name) ? "danger" : "primary",
329
+ onClose: handleRemove,
330
+ variant: "flat",
331
+ children: /* @__PURE__ */ jsxs("button", {
332
+ "aria-label": `Open ${name} filter`,
333
+ className: triggerClassName,
334
+ onClick: handleOpen,
335
+ type: "button",
294
336
  children: [instance.icon, /* @__PURE__ */ jsx(DisplayComponent, {
295
337
  config: instance.config,
296
338
  value
@@ -300,14 +342,14 @@ const ActiveFilters = ({ className = void 0 }) => {
300
342
  }) });
301
343
  };
302
344
  //#endregion
303
- //#region src/Filter/Subcomponents/AddFilterMenu.tsx
345
+ //#region src/Filter/subcomponents/AddFilterMenu.tsx
304
346
  /**
305
347
  * AddFilterMenu
306
348
  *
307
349
  * Renders a menu trigger that opens a list of addable filters. Selecting an
308
350
  * item triggers the parent to seed a default value and open the modal.
309
351
  */
310
- const AddFilterMenu = ({ classNames = {}, disableAnimation = false, portalContainer = void 0 }) => {
352
+ const AddFilterMenu = ({ className: classNames = {}, disableAnimation = false, portalContainer = void 0 }) => {
311
353
  const { unusedFilters, addFilter, getFilterInstanceByName } = useFilters();
312
354
  const menuItems = unusedFilters.map((name) => {
313
355
  const instance = getFilterInstanceByName(name);
@@ -342,13 +384,17 @@ const AddFilterMenu = ({ classNames = {}, disableAnimation = false, portalContai
342
384
  });
343
385
  };
344
386
  //#endregion
345
- //#region src/Filter/Subcomponents/FilterModal.tsx
346
- const FilterModal = ({ classNames = {}, disableAnimation = false, portalContainer = void 0, remoteFormId = void 0 }) => {
387
+ //#region src/Filter/subcomponents/FilterModal.tsx
388
+ /** Modal editor for the active filter and its apply/remove actions */
389
+ const FilterModal = ({ className: classNames = {}, disableAnimation = false, portalContainer = void 0, remoteFormId = void 0 }) => {
347
390
  const { closeFilterModal, getFilterFormFieldName, getFilterInstanceByName, modalFilterName, removeFilter } = useFilters();
348
391
  if (!modalFilterName) return null;
349
392
  const instance = getFilterInstanceByName(modalFilterName);
350
393
  const config = instance.config;
351
394
  const FormComponent = instance.components.Form;
395
+ const handleRemove = () => {
396
+ removeFilter(modalFilterName);
397
+ };
352
398
  return /* @__PURE__ */ jsx(Modal, {
353
399
  className: {
354
400
  body: classNames.body,
@@ -359,9 +405,7 @@ const FilterModal = ({ classNames = {}, disableAnimation = false, portalContaine
359
405
  footer: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button$1, {
360
406
  ariaLabel: "Remove filter",
361
407
  color: "danger",
362
- onClick: () => {
363
- removeFilter(modalFilterName);
364
- },
408
+ onClick: handleRemove,
365
409
  testId: "remove_filter_button",
366
410
  variant: "flat",
367
411
  children: "Remove"
@@ -382,27 +426,34 @@ const FilterModal = ({ classNames = {}, disableAnimation = false, portalContaine
382
426
  });
383
427
  };
384
428
  //#endregion
385
- //#region src/Filter/Subcomponents/SearchInput.tsx
429
+ //#region src/Filter/subcomponents/SearchInput.tsx
386
430
  /**
387
431
  * SearchInput
388
432
  *
389
433
  * By default renders only a search button. When clicked, the text input animates in
390
434
  * and a trailing submit button is shown.
391
435
  */
392
- const SearchInput = ({ classNames = {}, config }) => {
436
+ const SearchInput = ({ className: classNames = {}, config }) => {
393
437
  const { formState, setFocus, triggerSubmit } = useFormContext();
394
438
  const isInitiallyVisible = !!formState?.defaultValues?.search;
395
439
  const [isVisible, setIsVisible] = useState(isInitiallyVisible);
396
440
  const placeholder = typeof config === "object" ? config.placeholder : void 0;
441
+ const handleShow = () => {
442
+ setIsVisible(true);
443
+ };
444
+ const handleAnimationComplete = () => {
445
+ if (!isInitiallyVisible) setFocus("search");
446
+ };
447
+ const handleClear = () => {
448
+ triggerSubmit();
449
+ };
397
450
  return /* @__PURE__ */ jsxs("div", {
398
451
  className: classNames.searchWrapper,
399
452
  children: [!isVisible && /* @__PURE__ */ jsx(Button, {
400
453
  ariaLabel: "Show search input",
401
454
  className: classNames.searchShowButton,
402
455
  icon: /* @__PURE__ */ jsx(FaSearch, {}),
403
- onClick: () => {
404
- setIsVisible(true);
405
- },
456
+ onClick: handleShow,
406
457
  size: "sm",
407
458
  testId: "show_search_input_button",
408
459
  variant: "bordered"
@@ -410,9 +461,7 @@ const SearchInput = ({ classNames = {}, config }) => {
410
461
  animate: { opacity: 1 },
411
462
  className: classNames.searchMotionDiv,
412
463
  initial: !isInitiallyVisible ? { opacity: .5 } : false,
413
- onAnimationComplete: () => {
414
- if (!isInitiallyVisible) setFocus("search");
415
- },
464
+ onAnimationComplete: handleAnimationComplete,
416
465
  transition: {
417
466
  duration: .3,
418
467
  ease: "circOut"
@@ -427,9 +476,7 @@ const SearchInput = ({ classNames = {}, config }) => {
427
476
  placeholder,
428
477
  size: "sm",
429
478
  name: "search",
430
- onClear: () => {
431
- triggerSubmit();
432
- }
479
+ onClear: handleClear
433
480
  }), /* @__PURE__ */ jsx(SubmitButton, {
434
481
  className: classNames.searchSubmitButton,
435
482
  color: "primary",
@@ -443,61 +490,27 @@ const SearchInput = ({ classNames = {}, config }) => {
443
490
  });
444
491
  };
445
492
  //#endregion
446
- //#region src/Filter/Filter.tsx
447
- const debug = createDebug("megapixels:Filter");
448
- const filterVariants = tv({ slots: {
449
- base: "flex flex-auto flex-col",
450
- addFilterMenuButton: "",
451
- addFilterMenuItem: "",
452
- activeFilterLabel: "h-8 cursor-pointer rounded-md dark:text-foreground",
453
- filterModalBody: "",
454
- filterModalHeader: "flex items-center gap-3 text-default-700",
455
- filterModalFooter: "justify-between",
456
- form: "mb-3 flex flex-wrap gap-3",
457
- searchInput: "",
458
- searchInputWrapper: "",
459
- searchMotionDiv: "flex w-72 gap-2",
460
- searchShowButton: "",
461
- searchSubmitButton: "",
462
- searchWrapper: "flex items-center"
463
- } });
464
- /**
465
- * Renders the filter UI bound to a single ex-forms `Form`.
466
- * The form is the source of truth during user interaction; the committed
467
- * state is controlled by the parent via `values`/`onChange`.
468
- */
469
- const Filter = ({ children = void 0, className = void 0, config, disableAnimation = false, formName = "filterComponentForm", onChange, portalContainer = void 0, values }) => {
493
+ //#region src/Filter/subcomponents/FilterControl.tsx
494
+ const debug$1 = createDebug("megapixels:Filter");
495
+ /** Search, active filter actions and modal editing inside their bound form */
496
+ const FilterControl = ({ children = void 0, className: classNames, config, disableAnimation = void 0, formName = void 0, onChange, portalContainer = void 0, validation, values }) => {
470
497
  const handleSubmit = (nextValues) => {
471
- debug("handleSubmit", { nextValues });
498
+ debug$1("handleSubmit", { nextValues });
472
499
  onChange(nextValues);
473
500
  };
474
- const validation = useFilterValidation(config.filters, Boolean(config.search));
475
- const { data: valuesValidated, errors, success } = validation.validate(values);
476
- const variants = filterVariants();
477
- const classNames = variantsToClassNames(variants, className, "base");
478
- debug("render", {
479
- props: {
480
- config,
481
- values
482
- },
483
- validation: {
484
- errors,
485
- success,
486
- valuesValidated
487
- }
488
- });
489
501
  return /* @__PURE__ */ jsxs("div", {
490
502
  className: classNames.base,
503
+ "data-component": "filter",
491
504
  children: [/* @__PURE__ */ jsxs(Form, {
492
505
  className: { form: classNames.form },
493
506
  debug: { disable: true },
494
- initialValues: valuesValidated ?? {},
507
+ initialValues: values ?? {},
495
508
  name: formName,
496
509
  onSubmit: handleSubmit,
497
510
  remoteFormId: formName,
498
511
  validation,
499
512
  children: [config.search ? /* @__PURE__ */ jsx(SearchInput, {
500
- classNames: {
513
+ className: {
501
514
  searchInput: classNames.searchInput,
502
515
  searchInputWrapper: classNames.searchInputWrapper,
503
516
  searchMotionDiv: classNames.searchMotionDiv,
@@ -511,7 +524,7 @@ const Filter = ({ children = void 0, className = void 0, config, disableAnimatio
511
524
  children: [
512
525
  /* @__PURE__ */ jsx(ActiveFilters, { className: classNames.activeFilterLabel }),
513
526
  /* @__PURE__ */ jsx(AddFilterMenu, {
514
- classNames: {
527
+ className: {
515
528
  addFilterMenuButton: classNames.addFilterMenuButton,
516
529
  addFilterMenuItem: classNames.addFilterMenuItem
517
530
  },
@@ -519,7 +532,7 @@ const Filter = ({ children = void 0, className = void 0, config, disableAnimatio
519
532
  portalContainer
520
533
  }),
521
534
  /* @__PURE__ */ jsx(FilterModal, {
522
- classNames: {
535
+ className: {
523
536
  body: classNames.filterModalBody,
524
537
  footer: classNames.filterModalFooter,
525
538
  header: classNames.filterModalHeader
@@ -530,7 +543,49 @@ const Filter = ({ children = void 0, className = void 0, config, disableAnimatio
530
543
  })
531
544
  ]
532
545
  })]
533
- }), children?.(valuesValidated ?? {})]
546
+ }), children?.(values ?? {})]
547
+ });
548
+ };
549
+ //#endregion
550
+ //#region src/Filter/Filter.tsx
551
+ const debug = createDebug("megapixels:Filter");
552
+ /**
553
+ * Configurable search and filter controls for narrowing a result set
554
+ *
555
+ * Shows active filters with actions to add, edit and remove them using the
556
+ * configured filter registry and validation schemas
557
+ *
558
+ * Edits stay in the form until submission, which commits changes through
559
+ * `onChange`. The parent controls committed state through `values`
560
+ * Optional render-prop children receive the resolved search and filter values
561
+ */
562
+ const Filter = ({ children = void 0, className = void 0, config, disableAnimation = false, formName = "filterComponentForm", onChange, portalContainer = void 0, values }) => {
563
+ const styling = useStyling();
564
+ const validation = useFilterValidation(config.filters, Boolean(config.search));
565
+ const { data: valuesValidated, errors, success } = validation.validate(values);
566
+ const variants = styling.resolve(filterVariants);
567
+ const classNames = styling.variantsToClassNames(variants, className, "base");
568
+ debug("render", {
569
+ props: {
570
+ config,
571
+ values
572
+ },
573
+ validation: {
574
+ errors,
575
+ success,
576
+ valuesValidated
577
+ }
578
+ });
579
+ return /* @__PURE__ */ jsx(FilterControl, {
580
+ className: classNames,
581
+ config,
582
+ disableAnimation,
583
+ formName,
584
+ onChange,
585
+ portalContainer,
586
+ validation,
587
+ values: valuesValidated ?? {},
588
+ children
534
589
  });
535
590
  };
536
591
  //#endregion
@@ -741,4 +796,4 @@ var Filter_default = Filter;
741
796
  //#endregion
742
797
  export { filterVariants as i, filters as n, createFilter as r, Filter_default as t };
743
798
 
744
- //# sourceMappingURL=Filter-DcWQ5wx8.mjs.map
799
+ //# sourceMappingURL=Filter-DXRC8M5M.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Filter-DXRC8M5M.mjs","names":["Menu","Button","debug","Display","Form","config","validate","boolean","validate","Form"],"sources":["../src/Filter/filterVariants.ts","../src/Filter/hooks/useFilterValidation.ts","../src/Filter/subcomponents/FiltersContext.tsx","../src/Filter/subcomponents/ActiveFilters.tsx","../src/Filter/subcomponents/AddFilterMenu.tsx","../src/Filter/subcomponents/FilterModal.tsx","../src/Filter/subcomponents/SearchInput.tsx","../src/Filter/subcomponents/FilterControl.tsx","../src/Filter/Filter.tsx","../src/Filter/filters/createFilter.ts","../src/Filter/filters/boolean/Display.tsx","../src/Filter/filters/boolean/Form.tsx","../src/Filter/filters/boolean/schema.ts","../src/Filter/filters/boolean/boolean.ts","../src/Filter/filters/checkboxes/Display.tsx","../src/Filter/filters/checkboxes/Form.tsx","../src/Filter/filters/checkboxes/schema.ts","../src/Filter/filters/checkboxes/checkboxes.ts","../src/Filter/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\n/** Styling slots for Filter */\nexport const filterVariants = tv({\n slots: {\n /** Active filter chip */\n activeFilterLabel: 'h-8 cursor-pointer rounded-md dark:text-foreground',\n /** Add-filter menu trigger */\n addFilterMenuButton: '',\n /** Add-filter menu option */\n addFilterMenuItem: '',\n /** Filter search and actions container */\n base: 'flex flex-auto flex-col',\n /** Filter editor body */\n filterModalBody: '',\n /** Filter editor actions */\n filterModalFooter: 'justify-between',\n /** Filter editor heading */\n filterModalHeader: 'flex items-center gap-3 text-default-700',\n /** Search and active filter row */\n form: 'mb-3 flex flex-wrap gap-3',\n /** Editable search input */\n searchInput: '',\n /** Bordered search input surface */\n searchInputWrapper: '',\n /** Animated search reveal container */\n searchMotionDiv: 'flex w-72 gap-2',\n /** Search reveal button */\n searchShowButton: '',\n /** Search submit button */\n searchSubmitButton: '',\n /** Search controls container */\n searchWrapper: 'flex items-center',\n },\n});\n\nexport type VariantProps = TVProps<typeof filterVariants>;\n\nexport type ClassName = TVClassName<typeof filterVariants>;\n\nexport type FilterClassNames = Record<\n keyof ReturnType<typeof filterVariants>,\n string\n>;\n\nexport default filterVariants;\n","import type { VetoInstance, VetoRawShape, VetoTypeAny } from '@fuf-stack/veto';\nimport type { FilterInstance } from '../filters/types';\n\nimport { useMemo } from 'react';\n\nimport { object, string, stringToJSON, veto } from '@fuf-stack/veto';\n\n/**\n * useFilterValidation\n *\n * Builds a composite validation schema from all provided filter definitions\n * under \"filter\" and optionally includes a \"search\" string field.\n * Memoized by inputs.\n */\nexport const useFilterValidation = (\n filters: FilterInstance<unknown, unknown>[],\n withSearch?: boolean,\n) => {\n return useMemo<VetoInstance>(() => {\n // build filter validation\n let filterSchema: Record<string, VetoTypeAny> = {};\n filters.forEach((f) => {\n filterSchema = {\n ...filterSchema,\n [f.name]: f.validation(f.config) as VetoTypeAny,\n };\n });\n\n const validationSchema: VetoRawShape = {\n // filter validation\n filter: stringToJSON()\n .pipe(object(filterSchema))\n .or(object(filterSchema))\n .optional()\n .nullable()\n // transform null to undefined\n .transform((val: unknown) => {\n return val ?? undefined;\n }),\n // optional search validation\n ...(withSearch\n ? { search: string({ min: 0 }).nullable().optional() }\n : {}),\n };\n\n return veto(validationSchema);\n }, [filters, withSearch]);\n};\n\nexport default useFilterValidation;\n","import type { ReactNode } from 'react';\nimport type { FilterInstance, FiltersConfiguration } from '../filters/types';\n\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { useFormContext } from '@fuf-stack/uniform/hooks/useFormContext';\n\ninterface FiltersContextValue {\n /** Active filters (names only) */\n activeFilters: string[];\n /** Seed default value and open modal for a filter usage */\n addFilter: (name: string) => void;\n /** Close the modal */\n closeFilterModal: () => void;\n /** Build fully-qualified form field path for a filter name */\n getFilterFormFieldName: (name: string) => string;\n /** Get filter instance by name */\n getFilterInstanceByName: (name: string) => FilterInstance<unknown, unknown>;\n /** Get current form value for a given filter name */\n getFilterValueByName: (name: string) => unknown;\n /** Validation helper for a specific filter field */\n hasError: (name: string) => boolean;\n /** Name of the current filter that has its modal open */\n modalFilterName: string | undefined;\n /** Remove a filter from the form */\n removeFilter: (name: string) => void;\n /** Open the modal for a given filter name */\n showFilterModal: (name: string) => void;\n /** Filters that are not active (names only) */\n unusedFilters: string[];\n}\n\n/**\n * FiltersContext\n *\n * Central state for the filter UI with a clear boundary:\n * - The parent component controls committed filter values (via value/onChange)\n * - The form acts as an edit buffer (used by the modal)\n *\n * Design:\n * - activeFilters/unusedFilters are names-only and derived from the controlled\n * form state\n * - getFilterInstanceByName gives access to the concrete registry entry to\n * retrieve the correct Form/Display components\n * - add seeds defaults in the form and opens the modal\n * - remove un-registers the form field; if the removed filter is currently\n * open in the modal, the modal is closed without rollback\n * - on a new successful form submit (Apply), the modal closes without rollback\n * by subscribing to ex-forms submit state\n */\nconst FiltersContext = createContext<FiltersContextValue | undefined>(\n undefined,\n);\n\nexport const FiltersContextProvider = ({\n children,\n config,\n}: {\n children: ReactNode;\n config: FiltersConfiguration;\n}) => {\n // ex-forms integration:\n // - setValue/unregister/getFieldState: core helpers to manipulate and validate fields\n // - formState: we subscribe to submit-success to auto-close the modal after Apply\n const {\n formState,\n getFieldState,\n setValue,\n triggerSubmit,\n unregister,\n watch,\n } = useFormContext();\n\n /**\n * currentModalFilter\n *\n * Single source of truth for the filter edit modal and its rollback snapshot.\n * - name: which filter's modal is currently open (null when closed)\n * - hadValue/previousValue: snapshot of the controlled value taken when the\n * modal is opened; used to restore state if the user cancels/closes without\n * applying.\n *\n * Lifecycle semantics:\n * - showFilterModal(name): capture snapshot (current controlled value) and open\n * the modal for that filter.\n * - closeFilterModal(): if a snapshot exists, roll back un-applied edits by\n * restoring the previous value (setValue) or removing the field (unregister)\n * when it did not exist before; then clear currentModalFilter.\n * - On successful submit (Apply): close and clear currentModalFilter WITHOUT rollback\n * so edits remain committed.\n * - removeFilter(name): unregisters the field; when removing the filter that is\n * currently open, close the modal WITHOUT rollback (since removal is explicit).\n */\n const [currentModalFilter, setCurrentModalFilter] = useState<{\n name: string;\n hadValue: boolean;\n previousValue: unknown;\n } | null>(null);\n\n // read current filter values from the form as the live edit buffer\n const filterValue = watch('filter', {});\n\n /**\n * getFilterFormFieldName\n *\n * Returns the fully-qualified field path for a given filter name,\n * e.g., `${filterUrlParam}.status`.\n */\n const getFilterFormFieldName = useCallback((name: string) => {\n return `filter.${name}`;\n }, []);\n\n /**\n * getFilterValueByName\n *\n * Returns the committed value for a filter from the controlled state.\n */\n const getFilterValueByName = useCallback(\n (name: string) => {\n return (filterValue as Record<string, unknown>)[name];\n },\n [filterValue],\n );\n\n /** Open the filter edit modal for the given filter name */\n const showFilterModal = useCallback(\n (name: string) => {\n const prev = getFilterValueByName(name);\n setCurrentModalFilter({\n name,\n hadValue: typeof prev !== 'undefined',\n previousValue: prev,\n });\n },\n [getFilterValueByName],\n );\n\n /** Close the filter edit modal. Rollback un-applied edits to controlled state */\n const closeFilterModal = useCallback(() => {\n if (currentModalFilter?.name) {\n const fieldName = getFilterFormFieldName(currentModalFilter.name);\n // if the filter had a value, set it back to the previous value,\n // otherwise unregister the field\n if (currentModalFilter.hadValue) {\n setValue(fieldName, currentModalFilter.previousValue);\n } else {\n unregister(fieldName);\n }\n }\n setCurrentModalFilter(null);\n }, [getFilterFormFieldName, currentModalFilter, setValue, unregister]);\n\n /**\n * Auto-close on submit success\n *\n * Close the modal only on new successful submissions. We track the last\n * submitCount and only react when it changes AND the form reports a\n * successful submit. This prevents closing when `isSubmitSuccessful` remains\n * true without a new submit event.\n */\n const lastSubmitCountRef = useRef<number>(0);\n useEffect(() => {\n if (\n formState.submitCount !== lastSubmitCountRef.current &&\n formState.isSubmitSuccessful\n ) {\n // on successful submit, close without rollback\n setCurrentModalFilter(null);\n }\n lastSubmitCountRef.current = formState.submitCount;\n }, [\n formState.submitCount,\n formState.isSubmitSuccessful,\n setCurrentModalFilter,\n ]);\n\n /**\n * activeFilters\n *\n * Filter names derived from the controlled form state. A filter is considered\n * active when a field exists at `filter.<name>`. Newly added filters become\n * active immediately (seeded default), and will be rolled back on cancel.\n */\n const activeFilters = useMemo(() => {\n return config\n .filter((f) => {\n // keep compatibility with the shared Node 16.0 lint target, which\n // predates Object.hasOwn\n // eslint-disable-next-line prefer-object-has-own\n return Object.prototype.hasOwnProperty.call(filterValue ?? {}, f.name);\n })\n .map((f) => {\n return f.name;\n });\n }, [config, filterValue]);\n\n /**\n * unusedFilters\n *\n * Complement of activeFilters (names without a corresponding `filter.<name>`\n * field in the controlled form state).\n */\n const unusedFilters = useMemo(() => {\n return config\n .filter((f) => {\n // eslint-disable-next-line prefer-object-has-own\n return !Object.prototype.hasOwnProperty.call(filterValue ?? {}, f.name);\n })\n .map((f) => {\n return f.name;\n });\n }, [config, filterValue]);\n\n /**\n * getRegistryFilterByName\n *\n * Looks up the concrete registry entry for a filter by name, enabling access\n * to typed Form/Display components and other registry-level metadata.\n */\n const getFilterInstanceByName = useCallback(\n (name: string) => {\n return config.find((f) => {\n return f.name === name;\n }) as FilterInstance<unknown, unknown>;\n },\n [config],\n );\n\n /**\n * addFilter\n *\n * Seeds the filter with its registry default value inside the form and opens\n * the modal for immediate editing. No URL writes happen here.\n */\n const addFilter = useCallback(\n (name: string) => {\n const inst = getFilterInstanceByName(name);\n showFilterModal(name);\n setValue(getFilterFormFieldName(name), inst.defaultValue);\n },\n [\n getFilterFormFieldName,\n getFilterInstanceByName,\n setValue,\n showFilterModal,\n ],\n );\n\n /**\n * removeFilter\n *\n * Unregisters the filter field from the form. This immediately removes the\n * filter from the active list since derived state watches the form. It\n * closes the modal without rollback if the removed filter is currently open.\n */\n const removeFilter = useCallback(\n (name: string) => {\n // unregister form field\n unregister(getFilterFormFieldName(name));\n // close filter modal if open\n if (currentModalFilter?.name === name) {\n // explicit removal: close without rollback\n setCurrentModalFilter(null);\n }\n // trigger form submit (to update filter state)\n triggerSubmit();\n },\n [\n getFilterFormFieldName,\n currentModalFilter,\n setCurrentModalFilter,\n triggerSubmit,\n unregister,\n ],\n );\n\n /**\n * hasError\n *\n * Helper that checks the ex-forms field state for a specific filter and\n * reports whether the field is currently invalid.\n */\n const hasError = useCallback(\n (name: string) => {\n return getFieldState(getFilterFormFieldName(name)).invalid;\n },\n [getFieldState, getFilterFormFieldName],\n );\n\n const contextValue: FiltersContextValue = useMemo(() => {\n return {\n activeFilters,\n addFilter,\n closeFilterModal,\n getFilterFormFieldName,\n getFilterValueByName,\n getFilterInstanceByName,\n hasError,\n modalFilterName: currentModalFilter?.name,\n removeFilter,\n showFilterModal,\n unusedFilters,\n };\n }, [\n activeFilters,\n addFilter,\n closeFilterModal,\n getFilterFormFieldName,\n getFilterValueByName,\n getFilterInstanceByName,\n hasError,\n currentModalFilter,\n removeFilter,\n showFilterModal,\n unusedFilters,\n ]);\n\n return (\n <FiltersContext.Provider value={contextValue}>\n {children}\n </FiltersContext.Provider>\n );\n};\n\n/**\n * useFilters\n *\n * Convenience hook to consume the FiltersContext. Throws a descriptive error\n * when used outside of a FiltersContextProvider to make integration mistakes\n * obvious during development.\n */\nexport const useFilters = (): FiltersContextValue => {\n const ctx = useContext(FiltersContext);\n if (!ctx) {\n throw new Error('useFilters must be used within FiltersContextProvider');\n }\n return ctx;\n};\n\nexport default FiltersContext;\n","import { tv } from '@fuf-stack/pixel-utils';\nimport { Label } from '@fuf-stack/pixels/Label';\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { useFilters } from './FiltersContext';\n\n/** Layout of the edit action inside an active filter label */\nconst activeFilterTriggerVariants = tv({\n base: \"flex items-center gap-2\",\n});\n\ninterface ActiveFiltersProps {\n /** CSS class name */\n className?: string;\n}\n\n/** Active filter labels with separate edit and removal actions */\nconst ActiveFilters = ({ className = undefined }: ActiveFiltersProps) => {\n const styling = useStyling();\n const {\n activeFilters,\n getFilterValueByName,\n getFilterInstanceByName,\n hasError,\n removeFilter,\n showFilterModal,\n } = useFilters();\n\n // className for the edit action\n const triggerClassName = styling.resolve(activeFilterTriggerVariants);\n\n return (\n <>\n {activeFilters.map((name) => {\n const instance = getFilterInstanceByName(name);\n const value = getFilterValueByName(name);\n\n // get the display component from the instance\n const DisplayComponent = instance.components.Display;\n\n // open this filter for editing\n const handleOpen = () => {\n showFilterModal(name);\n };\n\n // remove this filter without opening its editor\n const handleRemove = () => {\n removeFilter(name);\n };\n\n return (\n <Label\n key={name}\n className={className}\n color={hasError(name) ? 'danger' : 'primary'}\n onClose={handleRemove}\n variant=\"flat\"\n >\n <button\n aria-label={`Open ${name} filter`}\n className={triggerClassName}\n onClick={handleOpen}\n type=\"button\"\n >\n {instance.icon}\n <DisplayComponent config={instance.config} value={value} />\n </button>\n </Label>\n );\n })}\n </>\n );\n};\n\nexport default ActiveFilters;\n","import { FaSliders } from 'react-icons/fa6';\n\nimport Menu from '@fuf-stack/pixels/Menu';\n\nimport { useFilters } from './FiltersContext';\n\ninterface AddFilterMenuProps {\n /** CSS class name map for slots */\n className?: Partial<{\n addFilterMenuItem: string;\n addFilterMenuButton: string;\n }>;\n /** disables the menu open/close animation */\n disableAnimation?: boolean;\n /** container the menu popover portal is rendered into (defaults to document.body) */\n portalContainer?: HTMLElement;\n}\n\n/**\n * AddFilterMenu\n *\n * Renders a menu trigger that opens a list of addable filters. Selecting an\n * item triggers the parent to seed a default value and open the modal.\n */\nconst AddFilterMenu = ({\n className: classNames = {},\n disableAnimation = false,\n portalContainer = undefined,\n}: AddFilterMenuProps) => {\n const { unusedFilters, addFilter, getFilterInstanceByName } = useFilters();\n\n const menuItems = unusedFilters.map((name) => {\n const instance = getFilterInstanceByName(name);\n const config = instance.config as { text?: string };\n const label = config?.text ?? name;\n return {\n key: name,\n icon: instance.icon,\n label,\n onClick: () => {\n addFilter(name);\n },\n };\n });\n\n return (\n <Menu\n className={{\n item: classNames.addFilterMenuItem,\n trigger: classNames.addFilterMenuButton,\n }}\n disableAnimation={disableAnimation}\n isDisabled={!menuItems.length}\n items={menuItems}\n placement=\"bottom-start\"\n portalContainer={portalContainer}\n triggerButtonProps={{\n 'aria-label': 'Add Filter',\n 'data-testid': 'add_filter_button',\n disableRipple: true,\n size: 'sm',\n variant: 'bordered',\n }}\n >\n <FaSliders />\n Filter\n </Menu>\n );\n};\n\nexport default AddFilterMenu;\n","import { Suspense } from 'react';\nimport { PiSlidersHorizontalBold } from 'react-icons/pi';\n\nimport Button from '@fuf-stack/pixels/Button';\nimport Modal from '@fuf-stack/pixels/Modal';\nimport SubmitButton from '@fuf-stack/uniform/SubmitButton';\n\nimport { useFilters } from './FiltersContext';\n\ninterface FilterModalProps {\n /** CSS class name */\n className?: Partial<{\n header: string;\n footer: string;\n body: string;\n }>;\n /** disables the modal open/close animation */\n disableAnimation?: boolean;\n /** container the modal portal is rendered into (defaults to document.body) */\n portalContainer?: HTMLElement;\n /** id of the Form this modal's SubmitButton belongs to. The footer is\n * portalled OUTSIDE the form's DOM subtree, so the button associates with the\n * form via the native `form` attribute (see SubmitButton `remoteFormId`). */\n remoteFormId?: string;\n}\n\n/** Modal editor for the active filter and its apply/remove actions */\nconst FilterModal = ({\n className: classNames = {},\n disableAnimation = false,\n portalContainer = undefined,\n remoteFormId = undefined,\n}: FilterModalProps) => {\n const {\n closeFilterModal,\n getFilterFormFieldName,\n getFilterInstanceByName,\n modalFilterName,\n removeFilter,\n } = useFilters();\n\n // don't render if no filter is open\n if (!modalFilterName) {\n return null;\n }\n\n const instance = getFilterInstanceByName(modalFilterName);\n const config = instance.config as { text?: string };\n\n // get the form component from the instance\n const FormComponent = instance.components.Form;\n\n // removing the edited filter also closes its modal\n const handleRemove = () => {\n removeFilter(modalFilterName);\n };\n\n return (\n <Modal\n className={{\n body: classNames.body,\n footer: classNames.footer,\n header: classNames.header,\n }}\n disableAnimation={disableAnimation}\n footer={\n <>\n <Button\n ariaLabel=\"Remove filter\"\n color=\"danger\"\n onClick={handleRemove}\n testId=\"remove_filter_button\"\n variant=\"flat\"\n >\n Remove\n </Button>\n <SubmitButton\n ariaLabel=\"Apply filter\"\n remoteFormId={remoteFormId}\n testId=\"apply_filter_button\"\n >\n Apply Filter\n </SubmitButton>\n </>\n }\n header={\n <>\n {instance.icon ?? <PiSlidersHorizontalBold />}\n <div>{`${config?.text ?? modalFilterName} Filter`}</div>\n </>\n }\n isOpen\n onClose={closeFilterModal}\n portalContainer={portalContainer}\n >\n <Suspense>\n <FormComponent\n config={config}\n fieldName={getFilterFormFieldName(modalFilterName)}\n />\n </Suspense>\n </Modal>\n );\n};\n\nexport default FilterModal;\n","import { useState } from 'react';\nimport { FaSearch } from 'react-icons/fa';\n\nimport { motion } from '@fuf-stack/pixel-motion';\nimport { Button } from '@fuf-stack/pixels/Button';\nimport { useFormContext } from '@fuf-stack/uniform/hooks/useFormContext';\nimport Input from '@fuf-stack/uniform/Input';\nimport SubmitButton from '@fuf-stack/uniform/SubmitButton';\n\nexport type SearchConfiguration =\n | boolean\n | {\n /** Placeholder shown in the search input */\n placeholder?: string;\n };\n\ninterface SearchInputProps {\n /** Slots class names passed from parent variants */\n className?: Partial<{\n searchWrapper: string;\n searchShowButton: string;\n searchMotionDiv: string;\n searchInput: string;\n searchInputWrapper: string;\n searchSubmitButton: string;\n }>;\n /** Search configuration */\n config: SearchConfiguration;\n}\n\n/**\n * SearchInput\n *\n * By default renders only a search button. When clicked, the text input animates in\n * and a trailing submit button is shown.\n */\nconst SearchInput = ({\n className: classNames = {},\n config,\n}: SearchInputProps) => {\n const { formState, setFocus, triggerSubmit } = useFormContext();\n\n // auto-open if there is an initial or externally set search value\n const isInitiallyVisible = !!formState?.defaultValues?.search;\n const [isVisible, setIsVisible] = useState(isInitiallyVisible);\n\n const placeholder =\n typeof config === 'object' ? config.placeholder : undefined;\n\n // reveal the search field before moving focus into it\n const handleShow = () => {\n setIsVisible(true);\n };\n\n // wait until the reveal finishes so focus does not interrupt the animation\n const handleAnimationComplete = () => {\n if (!isInitiallyVisible) {\n setFocus('search');\n }\n };\n\n // clearing commits the empty search immediately\n const handleClear = () => {\n triggerSubmit();\n };\n\n return (\n <div className={classNames.searchWrapper}>\n {!isVisible && (\n <Button\n ariaLabel=\"Show search input\"\n className={classNames.searchShowButton}\n icon={<FaSearch />}\n onClick={handleShow}\n size=\"sm\"\n testId=\"show_search_input_button\"\n variant=\"bordered\"\n />\n )}\n {isVisible ? (\n <motion.div\n key=\"search-input\"\n animate={{ opacity: 1 }}\n className={classNames.searchMotionDiv}\n // if the input was not initially visible, animate in\n initial={!isInitiallyVisible ? { opacity: 0.5 } : false}\n onAnimationComplete={handleAnimationComplete}\n transition={{\n duration: 0.3,\n ease: 'circOut',\n }}\n >\n <Input\n className={{\n input: classNames.searchInput,\n inputWrapper: classNames.searchInputWrapper,\n }}\n clearable\n debounceDelay={0}\n placeholder={placeholder}\n size=\"sm\"\n name=\"search\"\n // submit on clear\n onClear={handleClear}\n />\n <SubmitButton\n className={classNames.searchSubmitButton}\n color=\"primary\"\n icon={<FaSearch />}\n size=\"sm\"\n testId=\"submit_search_button\"\n ariaLabel=\"Submit search\"\n // eslint-disable-next-line react/no-children-prop\n children={null}\n />\n </motion.div>\n ) : null}\n </div>\n );\n};\n\nexport default SearchInput;\n","import type { FilterChildRenderFn, FilterProps } from '../Filter';\nimport type { FilterClassNames } from '../filterVariants';\nimport type { useFilterValidation } from '../hooks/useFilterValidation';\n\nimport createDebug from 'debug';\n\nimport Form from '@fuf-stack/uniform/Form';\n\nimport ActiveFilters from './ActiveFilters';\nimport AddFilterMenu from './AddFilterMenu';\nimport FilterModal from './FilterModal';\nimport { FiltersContextProvider } from './FiltersContext';\nimport SearchInput from './SearchInput';\n\nconst debug = createDebug('megapixels:Filter');\n\ninterface FilterControlProps extends Omit<FilterProps, 'className' | 'values'> {\n /** Resolved CSS class names */\n className: FilterClassNames;\n /** Combined filter and search schema */\n validation: ReturnType<typeof useFilterValidation>;\n /** Parsed values used to initialize the form and render children */\n values: Parameters<FilterChildRenderFn>[0];\n}\n\n/** Search, active filter actions and modal editing inside their bound form */\nconst FilterControl = ({\n children = undefined,\n className: classNames,\n config,\n disableAnimation = undefined,\n formName = undefined,\n onChange,\n portalContainer = undefined,\n validation,\n values,\n}: FilterControlProps) => {\n // commit validated form values to the controlled owner\n const handleSubmit = (nextValues: Record<string, unknown>) => {\n debug('handleSubmit', { nextValues });\n onChange(nextValues);\n };\n\n return (\n <div className={classNames.base} data-component=\"filter\">\n {/* bound search and filter form */}\n <Form\n className={{ form: classNames.form }}\n // disable debug mode for now\n debug={{ disable: true }}\n initialValues={values ?? {}}\n name={formName}\n onSubmit={handleSubmit}\n // the FilterModal footer's SubmitButton is portalled OUTSIDE this form's\n // dOM subtree, so it associates with the form via the native `form`\n // attribute (SubmitButton `remoteFormId`) instead of DOM descent\n remoteFormId={formName}\n validation={validation}\n >\n {/* optional search */}\n {config.search ? (\n <SearchInput\n className={{\n searchInput: classNames.searchInput,\n searchInputWrapper: classNames.searchInputWrapper,\n searchMotionDiv: classNames.searchMotionDiv,\n searchShowButton: classNames.searchShowButton,\n searchSubmitButton: classNames.searchSubmitButton,\n searchWrapper: classNames.searchWrapper,\n }}\n config={config.search}\n />\n ) : null}\n {/* active filters, add menu and modal editing */}\n <FiltersContextProvider config={config.filters}>\n <ActiveFilters className={classNames.activeFilterLabel} />\n <AddFilterMenu\n className={{\n addFilterMenuButton: classNames.addFilterMenuButton,\n addFilterMenuItem: classNames.addFilterMenuItem,\n }}\n disableAnimation={disableAnimation}\n portalContainer={portalContainer}\n />\n <FilterModal\n className={{\n body: classNames.filterModalBody,\n footer: classNames.filterModalFooter,\n header: classNames.filterModalHeader,\n }}\n disableAnimation={disableAnimation}\n portalContainer={portalContainer}\n remoteFormId={formName}\n />\n </FiltersContextProvider>\n </Form>\n {/* controlled results */}\n {children?.(values ?? {})}\n </div>\n );\n};\n\nexport default FilterControl;\n","import type { VetoInput } from '@fuf-stack/veto';\nimport type { ReactNode } from 'react';\nimport type { FiltersConfiguration } from './filters/types';\nimport type { ClassName } from './filterVariants';\nimport type { SearchConfiguration } from './subcomponents/SearchInput';\n\nimport createDebug from 'debug';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { filterVariants } from './filterVariants';\nimport { useFilterValidation } from './hooks/useFilterValidation';\nimport FilterControl from './subcomponents/FilterControl';\n\nexport { filterVariants } from './filterVariants';\n\nconst debug = createDebug('megapixels:Filter');\n\nexport interface FilterValues {\n filter?: string | Record<string, unknown> | null;\n search?: string;\n}\n\nexport type FilterChildRenderFn = (values: {\n search?: string;\n filter?: Record<string, unknown>;\n}) => ReactNode;\n\nexport interface FilterProps {\n /** Optional render-prop that receives the resolved, controlled values */\n children?: FilterChildRenderFn;\n /** CSS class name */\n className?: ClassName;\n /** Configuration of the filter */\n config: {\n /**\n * Declarative filter configuration. Each entry ties a logical name to a\n * registry filter type and (optionally) per-usage config overrides.\n */\n filters: FiltersConfiguration;\n /** Optional configuration for search field */\n search?: SearchConfiguration;\n };\n /** Disables the add-filter menu and modal open/close animations */\n disableAnimation?: boolean;\n /** Uniform form instance name. Defaults to \"filterComponentForm\". */\n formName?: string;\n /** Controlled setter invoked on submit with the next canonical values */\n onChange: (nextValues: FilterValues) => void;\n /**\n * Container the add-filter menu and filter modal portals render into.\n * Defaults to document.body; set this to keep portals scoped to a parent\n * (e.g. for embedding or deterministic snapshot tests).\n */\n portalContainer?: HTMLElement;\n /** Controlled committed state: the canonical `search` and `filter` values */\n values: FilterValues;\n}\n\n/**\n * Configurable search and filter controls for narrowing a result set\n *\n * Shows active filters with actions to add, edit and remove them using the\n * configured filter registry and validation schemas\n *\n * Edits stay in the form until submission, which commits changes through\n * `onChange`. The parent controls committed state through `values`\n * Optional render-prop children receive the resolved search and filter values\n */\nconst Filter = ({\n children = undefined,\n className = undefined,\n config,\n disableAnimation = false,\n formName = 'filterComponentForm',\n onChange,\n portalContainer = undefined,\n values,\n}: FilterProps) => {\n const styling = useStyling();\n\n // combine filter schemas with the optional search field\n const validation = useFilterValidation(\n config.filters,\n Boolean(config.search),\n );\n\n // validate controlled values are valid\n const {\n data: valuesValidated,\n errors,\n success,\n } = validation.validate(values as VetoInput);\n\n // classNames from slots\n const variants = styling.resolve(filterVariants);\n const classNames = styling.variantsToClassNames(variants, className, 'base');\n\n debug('render', {\n props: { config, values },\n validation: { errors, success, valuesValidated },\n });\n\n return (\n <FilterControl\n className={classNames}\n config={config}\n disableAnimation={disableAnimation}\n formName={formName}\n onChange={onChange}\n portalContainer={portalContainer}\n validation={validation}\n values={valuesValidated ?? {}}\n >\n {children}\n </FilterControl>\n );\n};\n\nexport default Filter;\n","import type { FilterDefinition, FilterFactory } from './types';\n\n/**\n * createFilter\n *\n * Builds a filter factory from a static FilterDefinition. The returned factory\n * accepts a usage descriptor (name/icon and optional partial config) and\n * produces a concrete FilterInstance with:\n * - merged config (shallow: definition.defaults.config overlaid by overrides)\n * - Form/Display components\n * - validate function (forwarded from the definition)\n * - defaultValue (forwarded from the definition)\n * - name and icon for UI integration\n *\n * @typeParam Config - Configuration object shape for the filter\n * @typeParam Value - Runtime value type for the filter\n * @param definition - Static description of the filter (components, defaults, validate)\n * @returns FilterFactory that creates FilterInstance<Config, Value>\n */\nconst createFilter = <Config, Value>(\n definition: FilterDefinition<Config, Value>,\n): FilterFactory<Config, Value> => {\n return ({ name, icon, config }) => {\n return {\n components: definition.components,\n config: { ...definition.defaults.config, ...(config ?? {}) },\n defaultValue: definition.defaults.value,\n icon,\n name,\n validation: definition.validation,\n };\n };\n};\n\nexport default createFilter;\n","import type { FilterDisplayProps } from '../types';\nimport type { Config, Value } from './schema';\n\n/**\n * Read-only presentation for the boolean filter.\n * Displays human-readable text based on the current boolean `value`\n * and the provided `config` strings.\n */\nconst Display = ({\n value,\n config: { text, textPrefix, textNoWord },\n}: FilterDisplayProps<Config, Value>) => {\n if (typeof value === 'boolean') {\n return (\n <>\n {`${value ? textPrefix : `${textPrefix} ${textNoWord ?? 'no'}`} ${text}`}\n </>\n );\n }\n return <>{`${text}...`}</>;\n};\n\nexport default Display;\n","import type { FilterFormProps } from '../types';\nimport type { Config } from './schema';\n\nimport Switch from '@fuf-stack/uniform/Switch';\n\n/**\n * Renders the form control for the boolean filter.\n * Uses a `Switch` to toggle the boolean value and composes\n * the label from the provided `config` and `fieldName`.\n */\nconst Form = ({\n fieldName,\n config: { text, textPrefix },\n}: FilterFormProps<Config>) => {\n return <Switch label={`${textPrefix} ${text}`} name={fieldName} />;\n};\n\nexport default Form;\n","import type { vInfer } from '@fuf-stack/veto';\n\nimport { boolean, object, string } from '@fuf-stack/veto';\n\n/** configuration of the filter */\nexport const config = object({\n /**\n * Human‑readable label used in the UI (e.g. in the chip and modal header).\n * Examples: \"Magical\", \"Haunted\"\n */\n text: string(),\n /**\n * Optional word shown before the label when building sentence‑like chips.\n * Examples: \"is\" → \"is Magical\"\n */\n textPrefix: string().optional(),\n /**\n * Optional negation word used when a boolean value is false.\n * Examples: \"not\" → \"is not Magical\"\n */\n textNoWord: string().optional(),\n});\n\n/** validate the filter value */\nexport const validate = (_config?: Config) => {\n return boolean().optional();\n};\n\nexport type Config = vInfer<typeof config>;\nexport type Value = vInfer<ReturnType<typeof validate>>;\n","/* eslint-disable import-x/prefer-default-export */\n\nimport type { Config, Value } from './schema';\n\nimport createFilter from '../createFilter';\nimport Display from './Display';\nimport Form from './Form';\nimport { validate } from './schema';\n\n/**\n * Boolean filter definition for the Filter system.\n * Provides Display and Form components, default value/config, and validation.\n *\n * Defaults:\n * - value: true\n * - config: { text: 'Active', textPrefix: 'is', textNoWord: 'no' }\n *\n * @see Display\n * @see Form\n * @see validate\n */\nexport const boolean = createFilter<Config, Value>({\n components: { Display, Form },\n defaults: {\n value: true,\n config: { text: 'Active', textPrefix: 'is', textNoWord: 'no' },\n },\n validation: validate,\n});\n","import type { FilterDisplayProps } from '../types';\nimport type { Config, Value } from './schema';\n\n/**\n * Read-only presentation for the checkboxes filter.\n * Resolves and displays selected option labels based on `value` and `config`.\n * Supports string, ReactNode, and function labels (mode: 'display').\n */\nconst Display = ({\n value,\n config: { text, options },\n}: FilterDisplayProps<Config, Value>) => {\n if (value && value.length > 0) {\n return (\n <span className=\"flex items-center gap-1\">\n {text} is\n {value.map((val) => {\n const option = options.find((op) => {\n return op.value === val;\n });\n const label = option?.label ?? val;\n const resolvedLabel =\n typeof label === 'function' ? label('display') : label;\n return <span key={val}>{resolvedLabel}</span>;\n })}\n </span>\n );\n }\n return `${text} is ...`;\n};\n\nexport default Display;\n","import type { FilterFormProps } from '../types';\nimport type { Config } from './schema';\n\nimport Checkboxes from '@fuf-stack/uniform/Checkboxes';\n\n/**\n * Renders the form control for the checkboxes filter.\n * Uses a `Checkboxes` to select multiple options.\n * Resolves function labels with 'form' mode.\n */\nconst Form = ({ fieldName, config }: FilterFormProps<Config>) => {\n const resolvedOptions = config.options.map((option) => {\n return {\n ...option,\n label:\n typeof option.label === 'function'\n ? option.label('form')\n : option.label,\n };\n });\n\n return <Checkboxes name={fieldName} options={resolvedOptions} />;\n};\n\nexport default Form;\n","import type { vInfer } from '@fuf-stack/veto';\nimport type { ReactNode } from 'react';\n\nimport { any, array, object, refineArray, string } from '@fuf-stack/veto';\n\n/** configuration of the filter */\nexport const config = object({\n /**\n * Human‑readable label used in the UI (e.g. label and modal header).\n * Example: \"Snacks\", \"Mood\"\n */\n text: string(),\n /**\n * Options rendered as multiple checkboxes. Each option needs a `label`\n * (what the user sees) and a `value` (what is written into the form state).\n * Label can be a string, React node, or a function that receives mode\n * ('form' or 'display') and returns a React node.\n */\n options: array(object({ label: any(), value: string() })),\n});\n\n/** Type-safe Config that overrides label to support ReactNode or function */\nexport type Config = Omit<vInfer<typeof config>, 'options'> & {\n options: {\n label: ReactNode | ((mode: 'form' | 'display') => ReactNode);\n value: string;\n }[];\n};\n\n/** validate the filter value */\nexport const validate = (cfg?: Config) => {\n return refineArray(array(string()).optional())({\n unique: true,\n custom: (values, ctx) => {\n if (!cfg) {\n return;\n }\n values.forEach((value) => {\n if (\n !cfg.options.find((option) => {\n return option?.value === value;\n })\n ) {\n ctx.addIssue({\n code: 'custom',\n message: `Invalid value: ${value}`,\n });\n }\n });\n },\n });\n};\n\nexport type Value = vInfer<ReturnType<typeof validate>>;\n","/* eslint-disable import-x/prefer-default-export */\n\nimport type { Config, Value } from './schema';\n\nimport createFilter from '../createFilter';\nimport Display from './Display';\nimport Form from './Form';\nimport { validate } from './schema';\n\n/**\n * Checkboxes filter definition for the Filter system.\n * Provides Display and Form components, default value/config, and validation.\n *\n * Defaults:\n * - value: []\n * - config: { text: 'Options', options: [] }\n *\n * @see Display\n * @see Form\n * @see validate\n */\nexport const checkboxes = createFilter<Config, Value>({\n components: { Display, Form },\n defaults: { value: [], config: { text: 'Options', options: [] } },\n validation: validate,\n});\n","import Filter from './Filter';\nimport { boolean } from './filters/boolean/boolean';\nimport { checkboxes } from './filters/checkboxes/checkboxes';\n\n// export types\nexport type * from './filters/types';\n\n// export helpers\nexport { default as createFilter } from './filters/createFilter';\n\n// export all filters\nexport const filters = {\n boolean,\n checkboxes,\n};\n\n// export everything from the Filter component (types and filterVariants)\nexport * from './Filter';\n\n// export the Filter component as default\nexport default Filter;\n\nexport { filterVariants } from './filterVariants';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKA,MAAa,iBAAiB,GAAG,EAC/B,OAAO;;CAEL,mBAAmB;;CAEnB,qBAAqB;;CAErB,mBAAmB;;CAEnB,MAAM;;CAEN,iBAAiB;;CAEjB,mBAAmB;;CAEnB,mBAAmB;;CAEnB,MAAM;;CAEN,aAAa;;CAEb,oBAAoB;;CAEpB,iBAAiB;;CAEjB,kBAAkB;;CAElB,oBAAoB;;CAEpB,eAAe;AACjB,EACF,CAAC;;;;;;;;;;ACtBD,MAAa,uBACX,SACA,eACG;CACH,OAAO,cAA4B;EAEjC,IAAI,eAA4C,CAAC;EACjD,QAAQ,SAAS,MAAM;GACrB,eAAe;IACb,GAAG;KACF,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM;GACjC;EACF,CAAC;EAED,MAAM,mBAAiC;GAErC,QAAQ,aAAa,CAAC,CACnB,KAAK,OAAO,YAAY,CAAC,CAAC,CAC1B,GAAG,OAAO,YAAY,CAAC,CAAC,CACxB,SAAS,CAAC,CACV,SAAS,CAAC,CAEV,WAAW,QAAiB;IAC3B,OAAO,OAAO,KAAA;GAChB,CAAC;GAEH,GAAI,aACA,EAAE,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,IACnD,CAAC;EACP;EAEA,OAAO,KAAK,gBAAgB;CAC9B,GAAG,CAAC,SAAS,UAAU,CAAC;AAC1B;;;;;;;;;;;;;;;;;;;;;ACWA,MAAM,iBAAiB,cACrB,KAAA,CACF;AAEA,MAAa,0BAA0B,EACrC,UACA,aAII;C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;KACN,SAAS,kBAAkB;IAC7B,CAAC;GAEL,CAAC;EACH;CACF,CAAC;AACH;;;AExCA,MAAa,UAAU;CACrB,SAAA;CACA,YDQwB,aAA4B;EACpD,YAAY;GAAE;GAAS,MAAA;EAAK;EAC5B,UAAU;GAAE,OAAO,CAAC;GAAG,QAAQ;IAAE,MAAM;IAAW,SAAS,CAAC;GAAE;EAAE;EAChE,YAAY;CACd,CCZE;AACF;AAMA,IAAA,iBAAe"}
@@ -1,2 +1,2 @@
1
- import { a as notification, i as NotificationRenderProps, n as NotificationHostProps, r as NotificationOptions, t as NotificationHost } from "../index-C8qpzima.mjs";
1
+ import { a as notification, i as NotificationRenderProps, n as NotificationHostProps, r as NotificationOptions, t as NotificationHost } from "../index-ClWVkO3I.mjs";
2
2
  export { NotificationHost, type NotificationHostProps, type NotificationOptions, type NotificationRenderProps, notification as default, notification };
@@ -1,2 +1 @@
1
- import { n as NotificationHost, r as notification, t as Notification_default } from "../Notification-kqOpVaUX.mjs";
2
- export { NotificationHost, Notification_default as default, notification };
1
+ export { n as NotificationHost, t as default, r as notification } from "../Notification-Dei4OOE6.mjs";
@@ -36,10 +36,10 @@ const resolveOptions = (options, renderProps) => {
36
36
  const show = (showToast, message, options) => {
37
37
  const idHolder = {};
38
38
  const id = showToast(message, resolveOptions(options, {
39
- modal: renderPropsModal,
40
39
  closeNotification: () => {
41
40
  if (idHolder.id !== void 0) toast.close(idHolder.id);
42
- }
41
+ },
42
+ modal: renderPropsModal
43
43
  }));
44
44
  idHolder.id = id;
45
45
  return id;
@@ -114,7 +114,7 @@ const notification = {
114
114
  //#endregion
115
115
  //#region src/Notification/NotificationHost.tsx
116
116
  /**
117
- * Mounts the Toaster and ModalHost.
117
+ * Application host for toast notifications and their related dialogs
118
118
  *
119
119
  * Use once at the top level of your app:
120
120
  *
@@ -135,4 +135,4 @@ var Notification_default = notification;
135
135
  //#endregion
136
136
  export { NotificationHost as n, notification as r, Notification_default as t };
137
137
 
138
- //# sourceMappingURL=Notification-kqOpVaUX.mjs.map
138
+ //# sourceMappingURL=Notification-Dei4OOE6.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Notification-kqOpVaUX.mjs","names":[],"sources":["../src/Notification/notification.tsx","../src/Notification/NotificationHost.tsx","../src/Notification/index.ts"],"sourcesContent":["import type { ModalStoreApi } from '@fuf-stack/pixels/Modal';\nimport type { ToastOptions } from '@fuf-stack/pixels/Toast';\nimport type { ReactNode } from 'react';\n\nimport { modal } from '@fuf-stack/pixels/Modal';\nimport { toast } from '@fuf-stack/pixels/Toast';\n\n/**\n * Props passed to function-based render props on a notification (e.g.\n * `endContent`), exposing helpers usable while rendering.\n */\nexport interface NotificationRenderProps {\n /** Closes the notification this render function belongs to. */\n closeNotification: () => void;\n /** Imperative modal API for opening/closing a modal from a notification. */\n modal: ModalStoreApi;\n}\n\n/** Options accepted by every `notification.<variant>()` call */\nexport interface NotificationOptions extends Omit<ToastOptions, 'endContent'> {\n /**\n * The notification's end content. Either a node rendered directly, or a\n * render function that receives the {@link NotificationRenderProps} (incl. a\n * `modal` API to open a modal) and returns the node to render.\n */\n endContent?: ReactNode | ((props: NotificationRenderProps) => ReactNode);\n}\n\n// Modal API exposed to render props. The exposed `modal.open` elevates the\n// modal above the Toaster so it stacks on top of the notification it was opened\n// from: the Toaster sits at z-60 (see NotificationHost) while HeroUI defaults\n// the modal z-index (on its `wrapper` + `backdrop` slots) to z-50, so we raise\n// both to z-70 via the `className` slot.\nconst renderPropsModal: ModalStoreApi = {\n ...modal,\n open: (options) => {\n return modal.open({\n className: { backdrop: 'z-[70]', wrapper: 'z-[70]' },\n ...options,\n });\n },\n};\n\n/**\n * Maps `NotificationOptions` to `ToastOptions` by resolving `endContent`:\n * a render function receives the render props and its returned node is used.\n */\nconst resolveOptions = (\n options: NotificationOptions | undefined,\n renderProps: NotificationRenderProps,\n): ToastOptions | undefined => {\n if (!options) {\n return undefined;\n }\n // Pull `endContent` out so the remaining options pass through unchanged.\n const { endContent, ...toastOptions } = options;\n\n return {\n ...toastOptions,\n // `ToastOptions.endContent` only accepts a node, so resolve the\n // render-function form down to one (a plain node passes through as-is).\n endContent:\n typeof endContent === 'function' ? endContent(renderProps) : endContent,\n };\n};\n\n/**\n * Shows a notification via the given toast method, wiring up the render props.\n *\n * The toast id is only known after the toast is shown, but the `endContent`\n * render function runs before that — so we stash the id in a holder that the\n * `closeNotification` closure reads when invoked (always after the id is set).\n */\nconst show = (\n showToast: (message: ReactNode, options?: ToastOptions) => string | number,\n message: ReactNode,\n options?: NotificationOptions,\n) => {\n const idHolder: { id?: string | number } = {};\n const renderProps: NotificationRenderProps = {\n modal: renderPropsModal,\n closeNotification: () => {\n if (idHolder.id !== undefined) {\n toast.close(idHolder.id);\n }\n },\n };\n const id = showToast(message, resolveOptions(options, renderProps));\n idHolder.id = id;\n return id;\n};\n\n/**\n * Imperative API for showing notifications: `default` / `info` / `warn` /\n * `success` / `error` show a notification (each returns an id), and `close`\n * dismisses one by id.\n *\n * Besides a plain node, `endContent` may be a render function that receives\n * the {@link NotificationRenderProps} — including a `modal` API and a\n * `closeNotification` helper that dismisses this notification — and returns\n * the node to render, e.g. to open a modal showing details that do not fit\n * into the notification itself.\n *\n * Requires a `<NotificationHost />` to be mounted in the React tree.\n *\n * @example\n * ```tsx\n * notification.error('A request failed.', {\n * title: 'Request failed',\n * endContent: ({ modal, closeNotification }) => (\n * <>\n * <Button onClick={() => modal.open({ content: details })}>More</Button>\n * <Button onClick={closeNotification}>Dismiss</Button>\n * </>\n * ),\n * });\n * ```\n */\nconst notification = {\n /**\n * Show a default notification.\n * @returns The toast id which can be passed to `notification.close()`\n */\n default: (message: ReactNode, options?: NotificationOptions) => {\n return show(toast.default, message, options);\n },\n /**\n * Show an info notification.\n * @returns The toast id which can be passed to `notification.close()`\n */\n info: (message: ReactNode, options?: NotificationOptions) => {\n return show(toast.info, message, options);\n },\n /**\n * Show a warning notification.\n * @returns The toast id which can be passed to `notification.close()`\n */\n warn: (message: ReactNode, options?: NotificationOptions) => {\n return show(toast.warn, message, options);\n },\n /**\n * Show a success notification.\n * @returns The toast id which can be passed to `notification.close()`\n */\n success: (message: ReactNode, options?: NotificationOptions) => {\n return show(toast.success, message, options);\n },\n /**\n * Show an error notification.\n * @returns The toast id which can be passed to `notification.close()`\n */\n error: (message: ReactNode, options?: NotificationOptions) => {\n return show(toast.error, message, options);\n },\n /** Close a notification by its id */\n close: (id: string | number) => {\n toast.close(id);\n },\n};\n\nexport default notification;\n","import type { CSSProperties } from 'react';\n\nimport { ModalHost } from '@fuf-stack/pixels/Modal';\nimport { Toaster } from '@fuf-stack/pixels/Toast';\n\nexport interface NotificationHostProps {\n /**\n * Width applied to all toasts. A number is treated as pixels; a string is\n * used verbatim (e.g. `'600px'`, `'40rem'`). Sets Sonner's `--width` CSS\n * variable on the Toaster.\n */\n width?: number | string;\n}\n\n/**\n * Mounts the Toaster and ModalHost.\n *\n * Use once at the top level of your app:\n *\n * ```tsx\n * <NotificationHost />\n * ```\n */\nconst NotificationHost = ({ width = 600 }: NotificationHostProps) => {\n // Stacking layers (see notification.tsx for the modal side):\n // 1. normal app-level modal — HeroUI default z-50\n // 2. notification / Toaster — z-60 (this), so notifications appear ABOVE\n // a normal modal that is already open\n // 3. modal opened FROM a notification — z-70 (set in notification.tsx),\n // so it appears above the notification again\n // Sonner defaults the Toaster to z-index 999999999, so we override it here.\n // `--width` is passed inline because Sonner sets its default `--width` inline\n // on the same element, which beats class-based overrides.\n const toasterStyle = {\n zIndex: 60,\n ...(width != null && {\n '--width': typeof width === 'number' ? `${width}px` : width,\n }),\n } as CSSProperties;\n return (\n <>\n <Toaster style={toasterStyle} />\n <ModalHost />\n </>\n );\n};\n\nexport default NotificationHost;\n","import notification from './notification';\nimport NotificationHost from './NotificationHost';\n\nexport type {\n NotificationOptions,\n NotificationRenderProps,\n} from './notification';\nexport type { NotificationHostProps } from './NotificationHost';\n\nexport { NotificationHost, notification };\nexport default notification;\n"],"mappings":";;;;AAiCA,MAAM,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GAAG,MAAM,MAAM,MACxD;CACF;CACA,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,SAAD,EAAS,OAAO,aAAe,CAAA,GAC/B,oBAAC,WAAD,CAAY,CAAA,CACZ,EAAA,CAAA;AAEN;;;ACnCA,IAAA,uBAAe"}
1
+ {"version":3,"file":"Notification-Dei4OOE6.mjs","names":[],"sources":["../src/Notification/notification.tsx","../src/Notification/NotificationHost.tsx","../src/Notification/index.ts"],"sourcesContent":["import type { ModalStoreApi } from '@fuf-stack/pixels/Modal';\nimport type { ToastOptions } from '@fuf-stack/pixels/Toast';\nimport type { ReactNode } from 'react';\n\nimport { modal } from '@fuf-stack/pixels/Modal';\nimport { toast } from '@fuf-stack/pixels/Toast';\n\n/**\n * Props passed to function-based render props on a notification (e.g.\n * `endContent`), exposing helpers usable while rendering.\n */\nexport interface NotificationRenderProps {\n /** Closes the notification this render function belongs to. */\n closeNotification: () => void;\n /** Imperative modal API for opening/closing a modal from a notification. */\n modal: ModalStoreApi;\n}\n\n/** Options accepted by every `notification.<variant>()` call */\nexport interface NotificationOptions extends Omit<ToastOptions, 'endContent'> {\n /**\n * The notification's end content. Either a node rendered directly, or a\n * render function that receives the {@link NotificationRenderProps} (incl. a\n * `modal` API to open a modal) and returns the node to render.\n */\n endContent?: ReactNode | ((props: NotificationRenderProps) => ReactNode);\n}\n\n// Modal API exposed to render props. The exposed `modal.open` elevates the\n// modal above the Toaster so it stacks on top of the notification it was opened\n// from: the Toaster sits at z-60 (see NotificationHost) while Pixels defaults\n// the modal z-index (on its `wrapper` + `backdrop` slots) to z-50, so we raise\n// both to z-70 via the `className` slot.\nconst renderPropsModal: ModalStoreApi = {\n ...modal,\n open: (options) => {\n return modal.open({\n className: { backdrop: 'z-[70]', wrapper: 'z-[70]' },\n ...options,\n });\n },\n};\n\n/**\n * Maps `NotificationOptions` to `ToastOptions` by resolving `endContent`:\n * a render function receives the render props and its returned node is used.\n */\nconst resolveOptions = (\n options: NotificationOptions | undefined,\n renderProps: NotificationRenderProps,\n): ToastOptions | undefined => {\n if (!options) {\n return undefined;\n }\n // Pull `endContent` out so the remaining options pass through unchanged.\n const { endContent, ...toastOptions } = options;\n\n return {\n ...toastOptions,\n // `ToastOptions.endContent` only accepts a node, so resolve the\n // render-function form down to one (a plain node passes through as-is).\n endContent:\n typeof endContent === 'function' ? endContent(renderProps) : endContent,\n };\n};\n\n/**\n * Shows a notification via the given toast method, wiring up the render props.\n *\n * The toast id is only known after the toast is shown, but the `endContent`\n * render function runs before that — so we stash the id in a holder that the\n * `closeNotification` closure reads when invoked (always after the id is set).\n */\nconst show = (\n showToast: (message: ReactNode, options?: ToastOptions) => string | number,\n message: ReactNode,\n options?: NotificationOptions,\n) => {\n const idHolder: { id?: string | number } = {};\n const renderProps: NotificationRenderProps = {\n closeNotification: () => {\n if (idHolder.id !== undefined) {\n toast.close(idHolder.id);\n }\n },\n modal: renderPropsModal,\n };\n const id = showToast(message, resolveOptions(options, renderProps));\n idHolder.id = id;\n return id;\n};\n\n/**\n * Imperative API for showing notifications: `default` / `info` / `warn` /\n * `success` / `error` show a notification (each returns an id), and `close`\n * dismisses one by id.\n *\n * Besides a plain node, `endContent` may be a render function that receives\n * the {@link NotificationRenderProps} — including a `modal` API and a\n * `closeNotification` helper that dismisses this notification — and returns\n * the node to render, e.g. to open a modal showing details that do not fit\n * into the notification itself.\n *\n * Requires a `<NotificationHost />` to be mounted in the React tree.\n *\n * @example\n * ```tsx\n * notification.error('A request failed.', {\n * title: 'Request failed',\n * endContent: ({ modal, closeNotification }) => (\n * <>\n * <Button onClick={() => modal.open({ content: details })}>More</Button>\n * <Button onClick={closeNotification}>Dismiss</Button>\n * </>\n * ),\n * });\n * ```\n */\nconst notification = {\n /**\n * Show a default notification.\n * @returns The toast id which can be passed to `notification.close()`\n */\n default: (message: ReactNode, options?: NotificationOptions) => {\n return show(toast.default, message, options);\n },\n /**\n * Show an info notification.\n * @returns The toast id which can be passed to `notification.close()`\n */\n info: (message: ReactNode, options?: NotificationOptions) => {\n return show(toast.info, message, options);\n },\n /**\n * Show a warning notification.\n * @returns The toast id which can be passed to `notification.close()`\n */\n warn: (message: ReactNode, options?: NotificationOptions) => {\n return show(toast.warn, message, options);\n },\n /**\n * Show a success notification.\n * @returns The toast id which can be passed to `notification.close()`\n */\n success: (message: ReactNode, options?: NotificationOptions) => {\n return show(toast.success, message, options);\n },\n /**\n * Show an error notification.\n * @returns The toast id which can be passed to `notification.close()`\n */\n error: (message: ReactNode, options?: NotificationOptions) => {\n return show(toast.error, message, options);\n },\n /** Close a notification by its id */\n close: (id: string | number) => {\n toast.close(id);\n },\n};\n\nexport default notification;\n","import type { CSSProperties } from 'react';\n\nimport { ModalHost } from '@fuf-stack/pixels/Modal';\nimport { Toaster } from '@fuf-stack/pixels/Toast';\n\nexport interface NotificationHostProps {\n /**\n * Width applied to all toasts. A number is treated as pixels; a string is\n * used verbatim (e.g. `'600px'`, `'40rem'`). Sets Sonner's `--width` CSS\n * variable on the Toaster.\n */\n width?: number | string;\n}\n\n/**\n * Application host for toast notifications and their related dialogs\n *\n * Use once at the top level of your app:\n *\n * ```tsx\n * <NotificationHost />\n * ```\n */\nconst NotificationHost = ({ width = 600 }: NotificationHostProps) => {\n // toasts sit above normal modals, notification-owned modals use z-70\n // Sonner defines width inline, so its override must also be inline\n const toasterStyle = {\n zIndex: 60,\n ...(width != null && {\n '--width': typeof width === 'number' ? `${width}px` : width,\n }),\n } as CSSProperties;\n\n return (\n <>\n <Toaster style={toasterStyle} />\n <ModalHost />\n </>\n );\n};\n\nexport default NotificationHost;\n","import notification from './notification';\nimport NotificationHost from './NotificationHost';\n\nexport type {\n NotificationOptions,\n NotificationRenderProps,\n} from './notification';\nexport type { NotificationHostProps } from './NotificationHost';\n\nexport { NotificationHost, notification };\nexport default notification;\n"],"mappings":";;;;AAiCA,MAAM,mBAAkC;CACtC,GAAG;CACH,OAAO,YAAY;EACjB,OAAO,MAAM,KAAK;GAChB,WAAW;IAAE,UAAU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AAS,OAAO,aAAe,CAAA,GAC/B,oBAAC,WAAD,CAAY,CAAA,CACZ,EAAA,CAAA;AAEN;;;AC7BA,IAAA,uBAAe"}
@@ -1,2 +1,2 @@
1
- import { n as VirtualListProps, r as virtualListVariants, t as VirtualList } from "../index-CKkcWwQs.mjs";
1
+ import { n as VirtualListProps, r as virtualListVariants, t as VirtualList } from "../index-Dv6cWC7j.mjs";
2
2
  export { VirtualList, VirtualList as default, type VirtualListProps, virtualListVariants };
@@ -1,2 +1 @@
1
- import { n as VirtualList, r as virtualListVariants, t as VirtualList_default } from "../VirtualList-GX38PUeR.mjs";
2
- export { VirtualList, VirtualList_default as default, virtualListVariants };
1
+ export { n as VirtualList, t as default, r as virtualListVariants } from "../VirtualList-sPPTnS7m.mjs";