@planningcenter/tapestry 4.10.0-rc.12 → 4.10.0-rc.13

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 (47) hide show
  1. package/dist/components/DataTable/CollectionEditorsLazy.d.ts.map +1 -1
  2. package/dist/components/DataTable/CollectionEditorsLazy.js +5 -5
  3. package/dist/components/DataTable/CollectionEditorsLazy.js.map +1 -1
  4. package/dist/components/DataTable/CollectionEditorsStatic.d.ts +1 -1
  5. package/dist/components/DataTable/CollectionEditorsStatic.d.ts.map +1 -1
  6. package/dist/components/DataTable/CollectionEditorsStatic.js +5 -5
  7. package/dist/components/DataTable/CollectionEditorsStatic.js.map +1 -1
  8. package/dist/components/DataTable/FilterTypes.d.ts +17 -8
  9. package/dist/components/DataTable/FilterTypes.d.ts.map +1 -1
  10. package/dist/components/DataTable/collectionFilter.d.ts +13 -10
  11. package/dist/components/DataTable/collectionFilter.d.ts.map +1 -1
  12. package/dist/components/DataTable/collectionFilter.js +4 -3
  13. package/dist/components/DataTable/collectionFilter.js.map +1 -1
  14. package/dist/components/DataTable/dateFilter.d.ts +5 -3
  15. package/dist/components/DataTable/dateFilter.d.ts.map +1 -1
  16. package/dist/components/DataTable/dateFilter.js +2 -2
  17. package/dist/components/DataTable/dateFilter.js.map +1 -1
  18. package/dist/components/DataTable/dayFilter.d.ts +4 -3
  19. package/dist/components/DataTable/dayFilter.d.ts.map +1 -1
  20. package/dist/components/DataTable/dayFilter.js +2 -2
  21. package/dist/components/DataTable/dayFilter.js.map +1 -1
  22. package/dist/components/DataTable/filterKeys.d.ts +1 -1
  23. package/dist/components/DataTable/filterKeys.d.ts.map +1 -1
  24. package/dist/components/DataTable/index.d.ts +8 -3
  25. package/dist/components/DataTable/index.d.ts.map +1 -1
  26. package/dist/components/DataTable/numberFilter.d.ts +7 -3
  27. package/dist/components/DataTable/numberFilter.d.ts.map +1 -1
  28. package/dist/components/DataTable/numberFilter.js +19 -6
  29. package/dist/components/DataTable/numberFilter.js.map +1 -1
  30. package/dist/components/DataTable/presenceFilter.d.ts +4 -1
  31. package/dist/components/DataTable/presenceFilter.d.ts.map +1 -1
  32. package/dist/components/DataTable/presenceFilter.js +2 -2
  33. package/dist/components/DataTable/presenceFilter.js.map +1 -1
  34. package/dist/components/DataTable/textFilter.d.ts +3 -1
  35. package/dist/components/DataTable/textFilter.d.ts.map +1 -1
  36. package/dist/components/DataTable/textFilter.js +4 -4
  37. package/dist/components/DataTable/textFilter.js.map +1 -1
  38. package/dist/components/DataTable/useSearchFilter.d.ts +1 -1
  39. package/dist/components/DataTable/utils.d.ts +1 -0
  40. package/dist/components/DataTable/utils.d.ts.map +1 -1
  41. package/dist/components/DataTable/utils.js +1 -1
  42. package/dist/components/DataTable/utils.js.map +1 -1
  43. package/dist/reactRender.css +1854 -1854
  44. package/dist/reactRender.css.map +1 -1
  45. package/dist/reactRenderLegacy.css +1854 -1854
  46. package/dist/reactRenderLegacy.css.map +1 -1
  47. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"CollectionEditorsLazy.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/CollectionEditorsLazy.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAgD,MAAM,OAAO,CAAA;AAGpE,OAAO,KAAK,EACV,2BAA2B,EAG5B,MAAM,2BAA2B,CAAA;AAsBlC,wBAAgB,0BAA0B,CAAC,EACzC,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,KAAK,GACN,EAAE,2BAA2B,qBA4C7B;AA+FD,wBAAgB,OAAO,sBAOtB;AAED,wBAAgB,SAAS,sBAMxB"}
1
+ {"version":3,"file":"CollectionEditorsLazy.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/CollectionEditorsLazy.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAgD,MAAM,OAAO,CAAA;AAGpE,OAAO,KAAK,EACV,2BAA2B,EAG5B,MAAM,2BAA2B,CAAA;AAsBlC,wBAAgB,0BAA0B,CAAC,EACzC,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,KAAK,GACN,EAAE,2BAA2B,qBA4C7B;AAyFD,wBAAgB,OAAO,sBAOtB;AAED,wBAAgB,SAAS,sBAMxB"}
@@ -24,16 +24,16 @@ function CollectionFilterEditorLazy({ config, onChange, operator, value, filter,
24
24
  });
25
25
  return onChange({ label: newLabel, value: newValue }, { complete: !isEmptyValue(newValue) });
26
26
  }, [resolvedOptions, onChange, value, label]);
27
- const Editor = getLazyEditor({ display, multiple });
27
+ const Editor = getLazyEditor(display);
28
28
  return (React__default.createElement(Editor, { error: error, loading: loading, query: query, setQuery: setQuery, value: value, onCommit: onCommit, options: resolvedOptions, multiple: multiple, operator: operator, filterLabel: filter.label, filterName: filter.name }));
29
29
  }
30
- function getLazyEditor({ display, multiple, }) {
30
+ function getLazyEditor(display) {
31
31
  if (display === "combobox")
32
32
  return CollectionEditorComboboxLazy;
33
- if (multiple)
34
- return CollectionEditorCheckboxesLazy;
35
33
  if (display === "checkboxes")
36
- return CollectionEditorRadiosLazy; // TODO: This looks like it might be a mistake, should it be CollectionEditorCheckboxes? or at least allow for `radios` as an option?
34
+ return CollectionEditorCheckboxesLazy;
35
+ if (display === "radios")
36
+ return CollectionEditorRadiosLazy;
37
37
  return CollectionEditorSelectLazy;
38
38
  }
39
39
  function CollectionEditorCheckboxesLazy({ error, loading, ...props }) {
@@ -1 +1 @@
1
- {"version":3,"file":"CollectionEditorsLazy.js","sources":["../../../src/components/DataTable/CollectionEditorsLazy.tsx"],"sourcesContent":["import { ComboBoxItem } from \"@components/combo-box\"\nimport { LoadingSpinner } from \"@components/internal\"\nimport { useDebouncedValue } from \"@utilities/useDebouncedValue\"\nimport React, { Key, useCallback, useEffect, useState } from \"react\"\n\nimport styles from \"./CollectionEditorsLazy.module.css\"\nimport type {\n CollectionFilterEditorProps,\n CollectionFilterValue,\n CollectionOptionsLazy,\n} from \"./CollectionEditorsShared\"\nimport { CollectionEditorCombobox } from \"./CollectionEditorsShared\"\nimport {\n CollectionEditorCheckboxes,\n CollectionEditorRadios,\n CollectionEditorSelect,\n CollectionEditorStaticProps,\n} from \"./CollectionEditorsStatic\"\nimport { CollectionOption } from \"./collectionFilter\"\nimport type { ActiveFilterLabel } from \"./FilterTypes\"\nimport { useLazyOptions } from \"./useLazyOptions\"\nimport { isEmptyValue } from \"./utils\"\n\ntype CollectionEditorLazyProps = CollectionEditorStaticProps & {\n error: unknown\n loading: boolean\n query: string | undefined\n setQuery: (query: string | undefined) => void\n}\n\nconst DEBOUNCE_MS = 300\n\nexport function CollectionFilterEditorLazy({\n config,\n onChange,\n operator,\n value,\n filter,\n label,\n scope,\n}: CollectionFilterEditorProps) {\n const { display, multiple } = config\n const loadOptions = config.options as CollectionOptionsLazy\n const options = useCallback(\n (query?: string) => loadOptions(query, scope),\n [loadOptions, scope]\n )\n const [query, setQuery] = useState<string | undefined>()\n const debouncedQuery = useDebouncedValue(query, DEBOUNCE_MS)\n const {\n error,\n loading,\n options: resolvedOptions,\n } = useLazyOptions(options, debouncedQuery)\n const onCommit = useCallback(\n (newValue: CollectionFilterValue) => {\n const newLabel = findLabelFromOptions(resolvedOptions, newValue, {\n label,\n value,\n })\n return onChange(\n { label: newLabel, value: newValue },\n { complete: !isEmptyValue(newValue) }\n )\n },\n [resolvedOptions, onChange, value, label]\n )\n const Editor = getLazyEditor({ display, multiple })\n\n return (\n <Editor\n error={error}\n loading={loading}\n query={query}\n setQuery={setQuery}\n value={value}\n onCommit={onCommit}\n options={resolvedOptions}\n multiple={multiple}\n operator={operator}\n filterLabel={filter.label}\n filterName={filter.name}\n />\n )\n}\n\nfunction getLazyEditor({\n display,\n multiple,\n}: {\n display: string\n multiple: boolean\n}) {\n if (display === \"combobox\") return CollectionEditorComboboxLazy\n if (multiple) return CollectionEditorCheckboxesLazy\n if (display === \"checkboxes\") return CollectionEditorRadiosLazy // TODO: This looks like it might be a mistake, should it be CollectionEditorCheckboxes? or at least allow for `radios` as an option?\n return CollectionEditorSelectLazy\n}\n\nfunction CollectionEditorCheckboxesLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorCheckboxes {...props} />\n}\n\nfunction CollectionEditorRadiosLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorRadios {...props} />\n}\n\nfunction CollectionEditorSelectLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorSelect {...props} />\n}\n\nfunction CollectionEditorComboboxLazy({\n error,\n onCommit,\n options,\n query,\n loading,\n setQuery,\n ...props\n}: CollectionEditorLazyProps) {\n const [loadingState, setLoadingState] = useState<\n \"loading\" | \"filtering\" | \"idle\"\n >(loading ? \"loading\" : \"idle\")\n useEffect(() => {\n if (!loading) {\n setLoadingState(\"idle\")\n }\n }, [loading])\n\n return (\n <CollectionEditorCombobox\n {...props}\n loadingState={error ? \"error\" : loadingState}\n inputValue={query}\n onInputChange={(q: string) => {\n setLoadingState(\"filtering\")\n setQuery(q)\n }}\n onChange={(value: Key | Key[] | null) => {\n if (value === null) return\n\n const resolvedValue = Array.isArray(value)\n ? value.map(String)\n : String(value)\n onCommit(resolvedValue)\n }}\n items={options}\n renderEmptyState={error ? <LoadError /> : \"No results\"}\n >\n {(o) => {\n const option = o as CollectionOption\n return (\n <ComboBoxItem key={option.value} id={option.value}>\n {option.label}\n </ComboBoxItem>\n )\n }}\n </CollectionEditorCombobox>\n )\n}\n\nexport function Loading() {\n return (\n <div className={styles[\"loading\"]} role=\"status\">\n <span>Loading...</span>\n <LoadingSpinner />\n </div>\n )\n}\n\nexport function LoadError() {\n return (\n <div className={styles[\"load-error\"]} role=\"alert\">\n Error: Failed to load options\n </div>\n )\n}\n\nfunction findLabelFromOptions(\n options: CollectionOption[],\n value: CollectionFilterValue,\n previous: { label?: ActiveFilterLabel; value: CollectionFilterValue }\n) {\n const previousLabelByValue = buildPreviousLabelByValue(previous)\n const labelFor = (v: string) =>\n options.find((option) => option.value === v)?.label ??\n previousLabelByValue.get(v)\n\n return Array.isArray(value)\n ? value.map(labelFor).filter((label) => label !== undefined)\n : labelFor(value)\n}\n\nfunction buildPreviousLabelByValue(previous: {\n label?: ActiveFilterLabel\n value: CollectionFilterValue\n}): Map<string, string | undefined> {\n const previousValues = normalizeValueToArray(previous.value)\n const previousLabels = normalizeValueToArray(previous.label)\n return new Map(previousValues.map((v, index) => [v, previousLabels[index]]))\n}\n\nfunction normalizeValueToArray(value: string | string[] | undefined): string[] {\n if (value === undefined) return []\n return Array.isArray(value) ? value : [value]\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;AA8BA,MAAM,WAAW,GAAG,GAAG;SAEP,0BAA0B,CAAC,EACzC,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,KAAK,GACuB,EAAA;AAC5B,IAAA,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM;AACpC,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,OAAgC;IAC3D,MAAM,OAAO,GAAG,WAAW,CACzB,CAAC,KAAc,KAAK,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,EAC7C,CAAC,WAAW,EAAE,KAAK,CAAC,CACrB;IACD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAsB;IACxD,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,EAAE,WAAW,CAAC;AAC5D,IAAA,MAAM,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EAAE,eAAe,GACzB,GAAG,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC;AAC3C,IAAA,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,QAA+B,KAAI;A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AA,+BAAA,CAE5C;AAEV;AAEA,SAAS,oBAAoB,CAC3B,OAA2B,EAC3B,KAA4B,EAC5B,QAAqE,EAAA;AAErE,IAAA,MAAM,oBAAoB,GAAG,yBAAyB,CAAC,QAAQ,CAAC;IAChE,MAAM,QAAQ,GAAG,CAAC,CAAS,KACzB,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC,EAAE,KAAK;AACnD,QAAA,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;AAE7B,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK;AACxB,UAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,KAAK,SAAS;AAC3D,UAAE,QAAQ,CAAC,KAAK,CAAC;AACrB;AAEA,SAAS,yBAAyB,CAAC,QAGlC,EAAA;IACC,MAAM,cAAc,GAAG,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC5D,MAAM,cAAc,GAAG,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC5D,OAAO,IAAI,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC9E;AAEA,SAAS,qBAAqB,CAAC,KAAoC,EAAA;IACjE,IAAI,KAAK,KAAK,SAAS;AAAE,QAAA,OAAO,EAAE;AAClC,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC;AAC/C;;;;"}
1
+ {"version":3,"file":"CollectionEditorsLazy.js","sources":["../../../src/components/DataTable/CollectionEditorsLazy.tsx"],"sourcesContent":["import { ComboBoxItem } from \"@components/combo-box\"\nimport { LoadingSpinner } from \"@components/internal\"\nimport { useDebouncedValue } from \"@utilities/useDebouncedValue\"\nimport React, { Key, useCallback, useEffect, useState } from \"react\"\n\nimport styles from \"./CollectionEditorsLazy.module.css\"\nimport type {\n CollectionFilterEditorProps,\n CollectionFilterValue,\n CollectionOptionsLazy,\n} from \"./CollectionEditorsShared\"\nimport { CollectionEditorCombobox } from \"./CollectionEditorsShared\"\nimport {\n CollectionEditorCheckboxes,\n CollectionEditorRadios,\n CollectionEditorSelect,\n CollectionEditorStaticProps,\n} from \"./CollectionEditorsStatic\"\nimport type { CollectionDisplay, CollectionOption } from \"./collectionFilter\"\nimport type { ActiveFilterLabel } from \"./FilterTypes\"\nimport { useLazyOptions } from \"./useLazyOptions\"\nimport { isEmptyValue } from \"./utils\"\n\ntype CollectionEditorLazyProps = CollectionEditorStaticProps & {\n error: unknown\n loading: boolean\n query: string | undefined\n setQuery: (query: string | undefined) => void\n}\n\nconst DEBOUNCE_MS = 300\n\nexport function CollectionFilterEditorLazy({\n config,\n onChange,\n operator,\n value,\n filter,\n label,\n scope,\n}: CollectionFilterEditorProps) {\n const { display, multiple } = config\n const loadOptions = config.options as CollectionOptionsLazy\n const options = useCallback(\n (query?: string) => loadOptions(query, scope),\n [loadOptions, scope]\n )\n const [query, setQuery] = useState<string | undefined>()\n const debouncedQuery = useDebouncedValue(query, DEBOUNCE_MS)\n const {\n error,\n loading,\n options: resolvedOptions,\n } = useLazyOptions(options, debouncedQuery)\n const onCommit = useCallback(\n (newValue: CollectionFilterValue) => {\n const newLabel = findLabelFromOptions(resolvedOptions, newValue, {\n label,\n value,\n })\n return onChange(\n { label: newLabel, value: newValue },\n { complete: !isEmptyValue(newValue) }\n )\n },\n [resolvedOptions, onChange, value, label]\n )\n const Editor = getLazyEditor(display)\n\n return (\n <Editor\n error={error}\n loading={loading}\n query={query}\n setQuery={setQuery}\n value={value}\n onCommit={onCommit}\n options={resolvedOptions}\n multiple={multiple}\n operator={operator}\n filterLabel={filter.label}\n filterName={filter.name}\n />\n )\n}\n\nfunction getLazyEditor(display: CollectionDisplay) {\n if (display === \"combobox\") return CollectionEditorComboboxLazy\n if (display === \"checkboxes\") return CollectionEditorCheckboxesLazy\n if (display === \"radios\") return CollectionEditorRadiosLazy\n return CollectionEditorSelectLazy\n}\n\nfunction CollectionEditorCheckboxesLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorCheckboxes {...props} />\n}\n\nfunction CollectionEditorRadiosLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorRadios {...props} />\n}\n\nfunction CollectionEditorSelectLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorSelect {...props} />\n}\n\nfunction CollectionEditorComboboxLazy({\n error,\n onCommit,\n options,\n query,\n loading,\n setQuery,\n ...props\n}: CollectionEditorLazyProps) {\n const [loadingState, setLoadingState] = useState<\n \"loading\" | \"filtering\" | \"idle\"\n >(loading ? \"loading\" : \"idle\")\n useEffect(() => {\n if (!loading) {\n setLoadingState(\"idle\")\n }\n }, [loading])\n\n return (\n <CollectionEditorCombobox\n {...props}\n loadingState={error ? \"error\" : loadingState}\n inputValue={query}\n onInputChange={(q: string) => {\n setLoadingState(\"filtering\")\n setQuery(q)\n }}\n onChange={(value: Key | Key[] | null) => {\n if (value === null) return\n\n const resolvedValue = Array.isArray(value)\n ? value.map(String)\n : String(value)\n onCommit(resolvedValue)\n }}\n items={options}\n renderEmptyState={error ? <LoadError /> : \"No results\"}\n >\n {(o) => {\n const option = o as CollectionOption\n return (\n <ComboBoxItem key={option.value} id={option.value}>\n {option.label}\n </ComboBoxItem>\n )\n }}\n </CollectionEditorCombobox>\n )\n}\n\nexport function Loading() {\n return (\n <div className={styles[\"loading\"]} role=\"status\">\n <span>Loading...</span>\n <LoadingSpinner />\n </div>\n )\n}\n\nexport function LoadError() {\n return (\n <div className={styles[\"load-error\"]} role=\"alert\">\n Error: Failed to load options\n </div>\n )\n}\n\nfunction findLabelFromOptions(\n options: CollectionOption[],\n value: CollectionFilterValue,\n previous: { label?: ActiveFilterLabel; value: CollectionFilterValue }\n) {\n const previousLabelByValue = buildPreviousLabelByValue(previous)\n const labelFor = (v: string) =>\n options.find((option) => option.value === v)?.label ??\n previousLabelByValue.get(v)\n\n return Array.isArray(value)\n ? value.map(labelFor).filter((label) => label !== undefined)\n : labelFor(value)\n}\n\nfunction buildPreviousLabelByValue(previous: {\n label?: ActiveFilterLabel\n value: CollectionFilterValue\n}): Map<string, string | undefined> {\n const previousValues = normalizeValueToArray(previous.value)\n const previousLabels = normalizeValueToArray(previous.label)\n return new Map(previousValues.map((v, index) => [v, previousLabels[index]]))\n}\n\nfunction normalizeValueToArray(value: string | string[] | undefined): string[] {\n if (value === undefined) return []\n return Array.isArray(value) ? value : [value]\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;AA8BA,MAAM,WAAW,GAAG,GAAG;SAEP,0BAA0B,CAAC,EACzC,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,KAAK,GACuB,EAAA;AAC5B,IAAA,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM;AACpC,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,OAAgC;IAC3D,MAAM,OAAO,GAAG,WAAW,CACzB,CAAC,KAAc,KAAK,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,EAC7C,CAAC,WAAW,EAAE,KAAK,CAAC,CACrB;IACD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAsB;IACxD,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,EAAE,WAAW,CAAC;AAC5D,IAAA,MAAM,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EAAE,eAAe,GACzB,GAAG,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC;AAC3C,IAAA,MAAM,QA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,EAAA,EAAA,+BAAA,CAE5C;AAEV;AAEA,SAAS,oBAAoB,CAC3B,OAA2B,EAC3B,KAA4B,EAC5B,QAAqE,EAAA;AAErE,IAAA,MAAM,oBAAoB,GAAG,yBAAyB,CAAC,QAAQ,CAAC;IAChE,MAAM,QAAQ,GAAG,CAAC,CAAS,KACzB,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC,EAAE,KAAK;AACnD,QAAA,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;AAE7B,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK;AACxB,UAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,KAAK,SAAS;AAC3D,UAAE,QAAQ,CAAC,KAAK,CAAC;AACrB;AAEA,SAAS,yBAAyB,CAAC,QAGlC,EAAA;IACC,MAAM,cAAc,GAAG,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC5D,MAAM,cAAc,GAAG,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC5D,OAAO,IAAI,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC9E;AAEA,SAAS,qBAAqB,CAAC,KAAoC,EAAA;IACjE,IAAI,KAAK,KAAK,SAAS;AAAE,QAAA,OAAO,EAAE;AAClC,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC;AAC/C;;;;"}
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { CollectionEditorProps, CollectionFilterEditorProps, CollectionFilterValue } from "./CollectionEditorsShared";
3
- import { CollectionOption } from "./collectionFilter";
3
+ import type { CollectionOption } from "./collectionFilter";
4
4
  export type CollectionEditorStaticProps = CollectionEditorProps & {
5
5
  filterLabel: string;
6
6
  filterName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"CollectionEditorsStatic.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/CollectionEditorsStatic.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAc,MAAM,OAAO,CAAA;AAElC,OAAO,EAEL,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,EAEtB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,MAAM,MAAM,2BAA2B,GAAG,qBAAqB,GAAG;IAChE,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAA;IAChD,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAC5B,CAAA;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,GACP,EAAE,2BAA2B,qBAoB7B;AAeD,wBAAgB,0BAA0B,CAAC,EACzC,WAAW,EACX,QAAQ,EACR,OAAO,EACP,KAAK,GACN,EAAE,2BAA2B,qBAuB7B;AAED,wBAAgB,sBAAsB,CAAC,EACrC,WAAW,EACX,UAAU,EACV,QAAQ,EACR,OAAO,EACP,KAAK,GACN,EAAE,2BAA2B,qBAqB7B;AAED,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,GACT,EAAE,2BAA2B,qBAc7B"}
1
+ {"version":3,"file":"CollectionEditorsStatic.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/CollectionEditorsStatic.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAc,MAAM,OAAO,CAAA;AAElC,OAAO,EAEL,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,EAEtB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAqB,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAG7E,MAAM,MAAM,2BAA2B,GAAG,qBAAqB,GAAG;IAChE,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAA;IAChD,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAC5B,CAAA;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,GACP,EAAE,2BAA2B,qBAoB7B;AASD,wBAAgB,0BAA0B,CAAC,EACzC,WAAW,EACX,QAAQ,EACR,OAAO,EACP,KAAK,GACN,EAAE,2BAA2B,qBAuB7B;AAED,wBAAgB,sBAAsB,CAAC,EACrC,WAAW,EACX,UAAU,EACV,QAAQ,EACR,OAAO,EACP,KAAK,GACN,EAAE,2BAA2B,qBAqB7B;AAED,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,GACT,EAAE,2BAA2B,qBAc7B"}
@@ -12,16 +12,16 @@ function CollectionFilterEditorStatic({ config, onChange, operator, value, filte
12
12
  const { display, multiple } = config;
13
13
  const options = config.options;
14
14
  const onCommit = (value) => onChange({ label: undefined, value }, { complete: !isEmptyValue(value) });
15
- const Editor = getStaticEditor({ display, multiple });
15
+ const Editor = getStaticEditor(display);
16
16
  return (React__default.createElement(Editor, { value: value, onCommit: onCommit, options: options, multiple: multiple, operator: operator, filterLabel: filter.label, filterName: filter.name }));
17
17
  }
18
- function getStaticEditor({ display, multiple, }) {
18
+ function getStaticEditor(display) {
19
19
  if (display === "combobox")
20
20
  return CollectionEditorComboboxStatic;
21
- if (multiple)
22
- return CollectionEditorCheckboxes;
23
21
  if (display === "checkboxes")
24
- return CollectionEditorRadios; // TODO: This looks like it might be a mistake, should it be CollectionEditorCheckboxes? or at least allow for `radios` as an option?
22
+ return CollectionEditorCheckboxes;
23
+ if (display === "radios")
24
+ return CollectionEditorRadios;
25
25
  return CollectionEditorSelect;
26
26
  }
27
27
  function CollectionEditorCheckboxes({ filterLabel, onCommit, options, value, }) {
@@ -1 +1 @@
1
- {"version":3,"file":"CollectionEditorsStatic.js","sources":["../../../src/components/DataTable/CollectionEditorsStatic.tsx"],"sourcesContent":["import { Checkbox } from \"@components/checkbox\"\nimport { CheckboxGroup } from \"@components/checkbox-group\"\nimport { ComboBoxItem } from \"@components/combo-box\"\nimport { Radio } from \"@components/radio\"\nimport { RadioGroup } from \"@components/radio-group\"\nimport { Select } from \"@components/select\"\nimport React, { Key } from \"react\"\n\nimport {\n CollectionEditorCombobox,\n CollectionEditorProps,\n CollectionFilterEditorProps,\n CollectionFilterValue,\n orderByOptions,\n} from \"./CollectionEditorsShared\"\nimport { CollectionOption } from \"./collectionFilter\"\nimport { isEmptyValue } from \"./utils\"\n\nexport type CollectionEditorStaticProps = CollectionEditorProps & {\n filterLabel: string\n filterName: string\n onCommit: (value: CollectionFilterValue) => void\n options: CollectionOption[]\n}\n\nexport function CollectionFilterEditorStatic({\n config,\n onChange,\n operator,\n value,\n filter,\n}: CollectionFilterEditorProps) {\n const { display, multiple } = config\n const options = config.options as CollectionOption[]\n\n const onCommit = (value: CollectionFilterValue) =>\n onChange({ label: undefined, value }, { complete: !isEmptyValue(value) })\n\n const Editor = getStaticEditor({ display, multiple })\n\n return (\n <Editor\n value={value}\n onCommit={onCommit}\n options={options}\n multiple={multiple}\n operator={operator}\n filterLabel={filter.label}\n filterName={filter.name}\n />\n )\n}\n\nfunction getStaticEditor({\n display,\n multiple,\n}: {\n display: string\n multiple: boolean\n}) {\n if (display === \"combobox\") return CollectionEditorComboboxStatic\n if (multiple) return CollectionEditorCheckboxes\n if (display === \"checkboxes\") return CollectionEditorRadios // TODO: This looks like it might be a mistake, should it be CollectionEditorCheckboxes? or at least allow for `radios` as an option?\n return CollectionEditorSelect\n}\n\nexport function CollectionEditorCheckboxes({\n filterLabel,\n onCommit,\n options,\n value,\n}: CollectionEditorStaticProps) {\n const selected = Array.isArray(value) ? value : [value]\n const toggle = (optionValue: string, checked: boolean) => {\n const next = new Set(selected)\n if (checked) next.add(optionValue)\n else next.delete(optionValue)\n onCommit(orderByOptions(options, next))\n }\n\n return (\n <CheckboxGroup label={filterLabel}>\n {options.map((option, index) => (\n <Checkbox\n key={option.value}\n // eslint-disable-next-line jsx-a11y/no-autofocus -- the editor only ever renders inside a chip popover that just opened, per ARIA dialog practices\n autoFocus={index === 0}\n checked={selected.includes(option.value)}\n label={option.label}\n onChange={(e) => toggle(option.value, e.target.checked)}\n />\n ))}\n </CheckboxGroup>\n )\n}\n\nexport function CollectionEditorRadios({\n filterLabel,\n filterName,\n onCommit,\n options,\n value,\n}: CollectionEditorStaticProps) {\n const selected = Array.isArray(value) ? value[0] : value\n const focusIndex = Math.max(\n 0,\n options.findIndex((option) => option.value === selected)\n )\n return (\n <RadioGroup label={filterLabel}>\n {options.map((option, index) => (\n <Radio\n key={option.value}\n // eslint-disable-next-line jsx-a11y/no-autofocus -- the editor only ever renders inside a chip popover that just opened, per ARIA dialog practices\n autoFocus={index === focusIndex}\n checked={selected === option.value}\n label={option.label}\n name={filterName}\n onChange={() => onCommit(option.value)}\n />\n ))}\n </RadioGroup>\n )\n}\n\nexport function CollectionEditorSelect({\n value,\n operator,\n options,\n onCommit,\n}: CollectionEditorStaticProps) {\n const selected = Array.isArray(value) ? value[0] : value\n\n return (\n <Select\n // eslint-disable-next-line jsx-a11y/no-autofocus -- the editor only ever renders inside a chip popover that just opened, per ARIA dialog practices\n autoFocus\n hideLabel\n label={operator.label}\n options={options}\n value={selected}\n onChange={(e) => onCommit(e.target.value)}\n />\n )\n}\n\nfunction CollectionEditorComboboxStatic({\n onCommit,\n options,\n filterLabel,\n filterName,\n ...props\n}: CollectionEditorStaticProps) {\n return (\n <CollectionEditorCombobox\n {...props}\n onChange={(value: Key | Key[] | null) => {\n if (value === null) return\n\n const resolvedValue = Array.isArray(value)\n ? orderByOptions(options, new Set(value.map(String)))\n : String(value)\n\n onCommit(resolvedValue)\n }}\n >\n {options.map((option) => (\n <ComboBoxItem key={option.value} id={option.value}>\n {option.label}\n </ComboBoxItem>\n ))}\n </CollectionEditorCombobox>\n )\n}\n"],"names":["React"],"mappings":";;;;;;;;;;AAyBM,SAAU,4BAA4B,CAAC,EAC3C,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,GACsB,EAAA;AAC5B,IAAA,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM;AACpC,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,OAA6B;IAEpD,MAAM,QAAQ,GAAG,CAAC,KAA4B,KAC5C,QAAQ,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;IAE3E,MAAM,MAAM,GAAG,eAAe,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AAErD,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EACL,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,MAAM,CAAC,KAAK,EACzB,UAAU,EAAE,MAAM,CAAC,IAAI,EAAA,CACvB;AAEN;AAEA,SAAS,eAAe,CAAC,EACvB,OAAO,EACP,QAAQ,GAIT,EAAA;IACC,IAAI,OAAO,KAAK,UAAU;AAAE,QAAA,OAAO,8BAA8B;AACjE,IAAA,IAAI,QAAQ;AAAE,QAAA,OAAO,0BAA0B;IAC/C,IAAI,OAAO,KAAK,YAAY;QAAE,OAAO,sBAAsB,CAAA;AAC3D,IAAA,OAAO,sBAAsB;AAC/B;AAEM,SAAU,0BAA0B,CA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,KAAI;YACtC,IAAI,KAAK,KAAK,IAAI;gBAAE;AAEpB,YAAA,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK;AACvC,kBAAE,cAAc,CAAC,OAAO,EAAE,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACpD,kBAAE,MAAM,CAAC,KAAK,CAAC;YAEjB,QAAQ,CAAC,aAAa,CAAC;AACzB,QAAA,CAAC,EAAA,EAEA,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,MAClBA,cAAA,CAAA,aAAA,CAAC,YAAY,EAAA,EAAC,GAAG,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,KAAK,EAAA,EAC9C,MAAM,CAAC,KAAK,CACA,CAChB,CAAC,CACuB;AAE/B;;;;"}
1
+ {"version":3,"file":"CollectionEditorsStatic.js","sources":["../../../src/components/DataTable/CollectionEditorsStatic.tsx"],"sourcesContent":["import { Checkbox } from \"@components/checkbox\"\nimport { CheckboxGroup } from \"@components/checkbox-group\"\nimport { ComboBoxItem } from \"@components/combo-box\"\nimport { Radio } from \"@components/radio\"\nimport { RadioGroup } from \"@components/radio-group\"\nimport { Select } from \"@components/select\"\nimport React, { Key } from \"react\"\n\nimport {\n CollectionEditorCombobox,\n CollectionEditorProps,\n CollectionFilterEditorProps,\n CollectionFilterValue,\n orderByOptions,\n} from \"./CollectionEditorsShared\"\nimport type { CollectionDisplay, CollectionOption } from \"./collectionFilter\"\nimport { isEmptyValue } from \"./utils\"\n\nexport type CollectionEditorStaticProps = CollectionEditorProps & {\n filterLabel: string\n filterName: string\n onCommit: (value: CollectionFilterValue) => void\n options: CollectionOption[]\n}\n\nexport function CollectionFilterEditorStatic({\n config,\n onChange,\n operator,\n value,\n filter,\n}: CollectionFilterEditorProps) {\n const { display, multiple } = config\n const options = config.options as CollectionOption[]\n\n const onCommit = (value: CollectionFilterValue) =>\n onChange({ label: undefined, value }, { complete: !isEmptyValue(value) })\n\n const Editor = getStaticEditor(display)\n\n return (\n <Editor\n value={value}\n onCommit={onCommit}\n options={options}\n multiple={multiple}\n operator={operator}\n filterLabel={filter.label}\n filterName={filter.name}\n />\n )\n}\n\nfunction getStaticEditor(display: CollectionDisplay) {\n if (display === \"combobox\") return CollectionEditorComboboxStatic\n if (display === \"checkboxes\") return CollectionEditorCheckboxes\n if (display === \"radios\") return CollectionEditorRadios\n return CollectionEditorSelect\n}\n\nexport function CollectionEditorCheckboxes({\n filterLabel,\n onCommit,\n options,\n value,\n}: CollectionEditorStaticProps) {\n const selected = Array.isArray(value) ? value : [value]\n const toggle = (optionValue: string, checked: boolean) => {\n const next = new Set(selected)\n if (checked) next.add(optionValue)\n else next.delete(optionValue)\n onCommit(orderByOptions(options, next))\n }\n\n return (\n <CheckboxGroup label={filterLabel}>\n {options.map((option, index) => (\n <Checkbox\n key={option.value}\n // eslint-disable-next-line jsx-a11y/no-autofocus -- the editor only ever renders inside a chip popover that just opened, per ARIA dialog practices\n autoFocus={index === 0}\n checked={selected.includes(option.value)}\n label={option.label}\n onChange={(e) => toggle(option.value, e.target.checked)}\n />\n ))}\n </CheckboxGroup>\n )\n}\n\nexport function CollectionEditorRadios({\n filterLabel,\n filterName,\n onCommit,\n options,\n value,\n}: CollectionEditorStaticProps) {\n const selected = Array.isArray(value) ? value[0] : value\n const focusIndex = Math.max(\n 0,\n options.findIndex((option) => option.value === selected)\n )\n return (\n <RadioGroup label={filterLabel}>\n {options.map((option, index) => (\n <Radio\n key={option.value}\n // eslint-disable-next-line jsx-a11y/no-autofocus -- the editor only ever renders inside a chip popover that just opened, per ARIA dialog practices\n autoFocus={index === focusIndex}\n checked={selected === option.value}\n label={option.label}\n name={filterName}\n onChange={() => onCommit(option.value)}\n />\n ))}\n </RadioGroup>\n )\n}\n\nexport function CollectionEditorSelect({\n value,\n operator,\n options,\n onCommit,\n}: CollectionEditorStaticProps) {\n const selected = Array.isArray(value) ? value[0] : value\n\n return (\n <Select\n // eslint-disable-next-line jsx-a11y/no-autofocus -- the editor only ever renders inside a chip popover that just opened, per ARIA dialog practices\n autoFocus\n hideLabel\n label={operator.label}\n options={options}\n value={selected}\n onChange={(e) => onCommit(e.target.value)}\n />\n )\n}\n\nfunction CollectionEditorComboboxStatic({\n onCommit,\n options,\n filterLabel,\n filterName,\n ...props\n}: CollectionEditorStaticProps) {\n return (\n <CollectionEditorCombobox\n {...props}\n onChange={(value: Key | Key[] | null) => {\n if (value === null) return\n\n const resolvedValue = Array.isArray(value)\n ? orderByOptions(options, new Set(value.map(String)))\n : String(value)\n\n onCommit(resolvedValue)\n }}\n >\n {options.map((option) => (\n <ComboBoxItem key={option.value} id={option.value}>\n {option.label}\n </ComboBoxItem>\n ))}\n </CollectionEditorCombobox>\n )\n}\n"],"names":["React"],"mappings":";;;;;;;;;;AAyBM,SAAU,4BAA4B,CAAC,EAC3C,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,GACsB,EAAA;AAC5B,IAAA,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM;AACpC,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,OAA6B;IAEpD,MAAM,QAAQ,GAAG,CAAC,KAA4B,KAC5C,QAAQ,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;AAE3E,IAAA,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC;AAEvC,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EACL,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,MAAM,CAAC,KAAK,EACzB,UAAU,EAAE,MAAM,CAAC,IAAI,EAAA,CACvB;AAEN;AAEA,SA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C,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAA,CACzC;AAEN;AAEA,SAAS,8BAA8B,CAAC,EACtC,QAAQ,EACR,OAAO,EACP,WAAW,EACX,UAAU,EACV,GAAG,KAAK,EACoB,EAAA;IAC5B,QACEA,cAAA,CAAA,aAAA,CAAC,wBAAwB,EAAA,EAAA,GACnB,KAAK,EACT,QAAQ,EAAE,CAAC,KAAyB,KAAI;YACtC,IAAI,KAAK,KAAK,IAAI;gBAAE;AAEpB,YAAA,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK;AACvC,kBAAE,cAAc,CAAC,OAAO,EAAE,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACpD,kBAAE,MAAM,CAAC,KAAK,CAAC;YAEjB,QAAQ,CAAC,aAAa,CAAC;AACzB,QAAA,CAAC,EAAA,EAEA,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,MAClBA,cAAA,CAAA,aAAA,CAAC,YAAY,EAAA,EAAC,GAAG,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,KAAK,EAAA,EAC9C,MAAM,CAAC,KAAK,CACA,CAChB,CAAC,CACuB;AAE/B;;;;"}
@@ -1,4 +1,10 @@
1
1
  import type { ActiveFilterInstance } from "./ActiveFilterInstance";
2
+ import type { CollectionFilterValue } from "./CollectionEditorsShared";
3
+ import type { DateFilterValue } from "./dateFilter";
4
+ import type { DayFilterValue } from "./dayFilter";
5
+ import type { NumberFilterValue } from "./numberFilter";
6
+ import type { PresenceFilterValue } from "./presenceFilter";
7
+ import type { TextFilterValue } from "./textFilter";
2
8
  export interface FilterNodeBase {
3
9
  /** Extra search terms beyond the label. */
4
10
  keywords?: string[];
@@ -61,7 +67,7 @@ export interface FilterNodeGroup extends FilterNodeBase {
61
67
  renderChildrenInSubmenu?: boolean;
62
68
  }
63
69
  export type FilterNode = FilterNodeItem | FilterNodeGroup;
64
- /** Narrow a factory's operator set by name. `includes` keeps only the named operators, in the order given; `excludes` drops them. */
70
+ /** Narrow a factory's operator set by name. `includes` keeps only the named operators, in the order given; `excludes` drops them. The first remaining operator is the default for new filters. */
65
71
  export type OperatorSelection<Name extends string = string> = {
66
72
  excludes?: never;
67
73
  /** Keeps only these operators, in this order. Can't be combined with `excludes`. */
@@ -85,13 +91,19 @@ export type FilterChange = (updates: Partial<ActiveFilter>, state?: {
85
91
  complete?: boolean;
86
92
  }) => void;
87
93
  export type ActiveFilterLabel = string | string[] | undefined;
88
- export interface ActiveFilter<T = unknown> {
94
+ /**
95
+ * Every value a built-in filter can hold. Values follow the filter, not the
96
+ * operator: switching operators keeps the old value, and ranges can be
97
+ * partially filled.
98
+ */
99
+ export type ActiveFilterValue = CollectionFilterValue | DateFilterValue | DayFilterValue | NumberFilterValue | PresenceFilterValue | TextFilterValue;
100
+ export interface ActiveFilter<Value = ActiveFilterValue, OperatorName extends string = string> {
89
101
  /** The human-readable label for the applied filter, if available. */
90
102
  label?: ActiveFilterLabel;
91
103
  /** The HTML name of the applied filter. Connects to the name of the filter. */
92
104
  name: string;
93
105
  /** The operator used by the applied filter. Corresponds to the name of the operator in the filter configuration. */
94
- operator: string;
106
+ operator: OperatorName;
95
107
  /**
96
108
  * For scoped filters only: which of the parent's scopes is selected. The
97
109
  * `operator` and `value` then belong to the parent's `scopeFilter`, so both
@@ -103,11 +115,8 @@ export interface ActiveFilter<T = unknown> {
103
115
  * the chip renders without loading the scopes.
104
116
  */
105
117
  scopeLabel?: string;
106
- /**
107
- * The value of the applied filter. Can be of any type depending on the filter configuration.
108
- * TODO: Add more specific typing based on the operator and input type.
109
- */
110
- value: T;
118
+ /** The value of the applied filter. Its shape depends on the filter type. */
119
+ value: Value;
111
120
  }
112
121
  export type AddPendingFilterFn = (filter: ActiveFilter) => void;
113
122
  //# sourceMappingURL=FilterTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FilterTypes.d.ts","sourceRoot":"","sources":["../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AW,CAC3C,GACC,iBAAiB,CAAC,IAAI,CAAC,CAAA;AAEzB,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAA;AAEzE;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,CACzB,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,EAC9B,KAAK,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,KAC3B,IAAI,CAAA;AAET,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAA;AAE7D;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GACzB,qBAAqB,GACrB,eAAe,GACf,cAAc,GACd,iBAAiB,GACjB,mBAAmB,GACnB,eAAe,CAAA;AAEnB,MAAM,WAAW,YAAY,CAC3B,KAAK,GAAG,iBAAiB,EACzB,YAAY,SAAS,MAAM,GAAG,MAAM;IAEpC,qEAAqE;IACrE,KAAK,CAAC,EAAE,iBAAiB,CAAA;IACzB,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAA;IACZ,qHAAqH;IACrH,QAAQ,EAAE,YAAY,CAAA;IACtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,6EAA6E;IAC7E,KAAK,EAAE,KAAK,CAAA;CACb;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAA"}
@@ -1,10 +1,10 @@
1
- import type { CollectionOptions } from "./CollectionEditorsShared";
2
- import type { FilterItemConfig, FilterNodeItem } from "./FilterTypes";
1
+ import type { CollectionFilterValue, CollectionOptions } from "./CollectionEditorsShared";
2
+ import type { ActiveFilter, FilterItemConfig, FilterNodeItem } from "./FilterTypes";
3
3
  export type CollectionOption = {
4
4
  label: string;
5
5
  value: string;
6
6
  };
7
- export type CollectionDisplay = "checkboxes" | "combobox" | "select";
7
+ export type CollectionDisplay = "checkboxes" | "combobox" | "radios" | "select";
8
8
  export declare const COLLECTION_IS: {
9
9
  readonly inputType: {
10
10
  readonly type: "collection";
@@ -33,18 +33,21 @@ declare const ALL_COLLECTION_OPERATORS: ({
33
33
  readonly name: "not";
34
34
  })[];
35
35
  export type CollectionOperatorName = (typeof ALL_COLLECTION_OPERATORS)[number]["name"];
36
+ export type CollectionActiveFilter = ActiveFilter<CollectionFilterValue | undefined, CollectionOperatorName>;
36
37
  export type CollectionFilterConfig = FilterItemConfig<CollectionOperatorName> & {
38
+ /** How the editor presents the options. Defaults to `select`. */
39
+ display?: CollectionDisplay;
40
+ /** Allows picking more than one option. Only supported with the `combobox` display; `checkboxes` always allows multiple and `radios` never does. */
41
+ multiple?: boolean;
37
42
  /** The choices, or a function that loads them. A function receives the combobox's search query and, inside a `scopedFilter`, the chosen scope. */
38
43
  options: CollectionOptions;
39
44
  } & ({
40
- /** How the editor presents the options. `checkboxes` renders radios when `multiple` is false. Defaults to `select`. */
41
- display?: CollectionDisplay;
42
- /** Allows picking more than one option. Not supported with the `select` display. */
43
- multiple?: false;
45
+ display?: Exclude<CollectionDisplay, "combobox">;
46
+ multiple?: never;
44
47
  } | {
45
- display?: Exclude<CollectionDisplay, "select">;
46
- multiple: true;
48
+ display: "combobox";
49
+ multiple?: boolean;
47
50
  });
48
- export declare function collectionFilter({ display, excludes, includes, multiple, options, ...config }: CollectionFilterConfig): FilterNodeItem;
51
+ export declare function collectionFilter({ display, excludes, includes, multiple: multipleCombobox, options, ...config }: CollectionFilterConfig): FilterNodeItem;
49
52
  export {};
50
53
  //# sourceMappingURL=collectionFilter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collectionFilter.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/collectionFilter.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,2BAA2B,CAAA;AAElC,OA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TION_NOT];
18
18
  const DEFAULT_COLLECTION_OPERATORS = [COLLECTION_IS];
19
- function collectionFilter({ display = "select", excludes, includes, multiple = false, options, ...config }) {
19
+ function collectionFilter({ display = "select", excludes, includes, multiple: multipleCombobox = false, options, ...config }) {
20
+ const multiple = display === "checkboxes" || multipleCombobox;
20
21
  const filter = {
21
22
  ...config,
22
- createActiveFilterInstance: (activeFilter, operator) => new CollectionActiveFilter(filter, operator, activeFilter.value, activeFilter.label, activeFilter.scope, { display, multiple, options }),
23
+ createActiveFilterInstance: (activeFilter, operator) => new CollectionActiveFilterInstance(filter, operator, activeFilter.value, activeFilter.label, activeFilter.scope, { display, multiple, options }),
23
24
  operators: resolveOperators(ALL_COLLECTION_OPERATORS, {
24
25
  default: DEFAULT_COLLECTION_OPERATORS,
25
26
  excludes,
@@ -28,7 +29,7 @@ function collectionFilter({ display = "select", excludes, includes, multiple = f
28
29
  };
29
30
  return filter;
30
31
  }
31
- class CollectionActiveFilter extends ActiveFilterInstance {
32
+ class CollectionActiveFilterInstance extends ActiveFilterInstance {
32
33
  label;
33
34
  scope;
34
35
  config;
@@ -1 +1 @@
1
- {"version":3,"file":"collectionFilter.js","sources":["../../../src/components/DataTable/collectionFilter.tsx"],"sourcesContent":["import React from \"react\"\n\nimport { ActiveFilterInstance } from \"./ActiveFilterInstance\"\nimport { CollectionFilterEditorLazy } from \"./CollectionEditorsLazy\"\nimport type {\n CollectionFilterValue,\n CollectionOptions,\n} from \"./CollectionEditorsShared\"\nimport { CollectionFilterEditorStatic } from \"./CollectionEditorsStatic\"\nimport type {\n ActiveFilterLabel,\n FilterChange,\n FilterItemConfig,\n FilterNodeItem,\n Operator,\n} from \"./FilterTypes\"\nimport { resolveOperators } from \"./resolveOperators\"\n\n// A type alias (not an interface) so it satisfies `Select`'s `data-*` index signature.\nexport type CollectionOption = {\n label: string\n value: string\n}\n\nexport type CollectionDisplay = \"checkboxes\" | \"combobox\" | \"select\"\n\nexport const COLLECTION_IS = {\n inputType: { type: \"collection\" },\n label: \"is\",\n name: \"eq\",\n} as const satisfies Operator\nexport const COLLECTION_NOT = {\n inputType: { type: \"collection\" },\n label: \"is not\",\n name: \"not\",\n} as const satisfies Operator\n\nconst ALL_COLLECTION_OPERATORS = [COLLECTION_IS, COLLECTION_NOT]\nconst DEFAULT_COLLECTION_OPERATORS = [COLLECTION_IS]\n\nexport type CollectionOperatorName =\n (typeof ALL_COLLECTION_OPERATORS)[number][\"name\"]\n\nexport type CollectionFilterConfig =\n FilterItemConfig<CollectionOperatorName> & {\n /** The choices, or a function that loads them. A function receives the combobox's search query and, inside a `scopedFilter`, the chosen scope. */\n options: CollectionOptions\n } & (\n | {\n /** How the editor presents the options. `checkboxes` renders radios when `multiple` is false. Defaults to `select`. */\n display?: CollectionDisplay\n /** Allows picking more than one option. Not supported with the `select` display. */\n multiple?: false\n }\n | {\n display?: Exclude<CollectionDisplay, \"select\">\n multiple: true\n }\n )\n\nexport function collectionFilter({\n display = \"select\",\n excludes,\n includes,\n multiple = false,\n options,\n ...config\n}: CollectionFilterConfig): FilterNodeItem {\n const filter: FilterNodeItem = {\n ...config,\n createActiveFilterInstance: (activeFilter, operator) =>\n new CollectionActiveFilter(\n filter,\n operator,\n activeFilter.value as CollectionFilterValue,\n activeFilter.label,\n activeFilter.scope,\n { display, multiple, options }\n ),\n operators: resolveOperators(ALL_COLLECTION_OPERATORS, {\n default: DEFAULT_COLLECTION_OPERATORS,\n excludes,\n includes,\n }),\n }\n return filter\n}\n\nclass CollectionActiveFilter extends ActiveFilterInstance<CollectionFilterValue> {\n constructor(\n filter: FilterNodeItem,\n operator: FilterNodeItem[\"operators\"][number],\n value: CollectionFilterValue,\n private readonly label: ActiveFilterLabel,\n private readonly scope: string | undefined,\n private readonly config: {\n display: CollectionDisplay\n multiple: boolean\n options: CollectionOptions\n }\n ) {\n super(filter, operator, value)\n this.label = label\n }\n\n formatValue() {\n if (this.label) return Array.isArray(this.label) ? this.label : [this.label]\n const values = Array.isArray(this.value) ? this.value : [this.value]\n if (typeof this.config.options === \"function\") return [\"\"]\n return values\n .map(\n (value) =>\n (this.config.options as CollectionOption[]).find(\n (option) => option.value === value\n )?.label ?? value\n )\n .join(\", \")\n }\n\n renderEditor(onChange: FilterChange) {\n const hasLazyOptions = typeof this.config.options === \"function\"\n const Editor = hasLazyOptions\n ? CollectionFilterEditorLazy\n : CollectionFilterEditorStatic\n\n return (\n <Editor\n config={this.config}\n onChange={onChange}\n operator={this.operator}\n value={this.value}\n label={this.label}\n filter={this.filter}\n scope={this.scope}\n />\n )\n }\n}\n"],"names":["React"],"mappings":";;;;;;AA0BO,MAAM,aAAa,GAAG;AAC3B,IAAA,SAAS,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;AACjC,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,IAAI,EAAE,IAAI;;AAEL,MAAM,cAAc,GAAG;AAC5B,IAAA,SAAS,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;AACjC,IAAA,KAAK,EAAE,QAAQ;AACf,IAAA,IAAI,EAAE,KAAK;;AAGb,MAAM,wBAAwB,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC;AAChE,MAAM,4BAA4B,GAAG,CAAC,aAAa,CAAC;AAsB9C,SAAU,gBAAgB,CAAC,EAC/B,OAAO,GAAG,QAAQ,EAClB,QAAQ,EACR,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,GAAG,MAAM,EACc,EAAA;AACvB,IAAA,MAAM,MAAM,GAAmB;AAC7B,QAAA,GAAG,MAAM;AACT,QAAA,0BAA0B,EAAE,CAAC,YAAY,EAAE,QAAQ,KACjD,IAAI,sBAAsB,CACxB,MAAM,EACN,QAAQ,EACR,YAAY,CAAC,KAA8B,EAC3C,YAAY,CAAC,KAAK,EAClB,YAAY,CAAC,KAAK,EAClB,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAC/B;AACH,QAAA,SAAS,EAAE,gBAAgB,CAAC,wBAAwB,EAA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,UAAU;QAChE,MAAM,MAAM,GAAG;AACb,cAAE;cACA,4BAA4B;QAEhC,QACEA,6BAAC,MAAM,EAAA,EACL,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,KAAK,EAAE,IAAI,CAAC,KAAK,EAAA,CACjB;IAEN;AACD;;;;"}
1
+ {"version":3,"file":"collectionFilter.js","sources":["../../../src/components/DataTable/collectionFilter.tsx"],"sourcesContent":["import React from \"react\"\n\nimport { ActiveFilterInstance } from \"./ActiveFilterInstance\"\nimport { CollectionFilterEditorLazy } from \"./CollectionEditorsLazy\"\nimport type {\n CollectionFilterValue,\n CollectionOptions,\n} from \"./CollectionEditorsShared\"\nimport { CollectionFilterEditorStatic } from \"./CollectionEditorsStatic\"\nimport type {\n ActiveFilter,\n ActiveFilterLabel,\n FilterChange,\n FilterItemConfig,\n FilterNodeItem,\n Operator,\n} from \"./FilterTypes\"\nimport { resolveOperators } from \"./resolveOperators\"\n\n// A type alias (not an interface) so it satisfies `Select`'s `data-*` index signature.\nexport type CollectionOption = {\n label: string\n value: string\n}\n\nexport type CollectionDisplay = \"checkboxes\" | \"combobox\" | \"radios\" | \"select\"\n\nexport const COLLECTION_IS = {\n inputType: { type: \"collection\" },\n label: \"is\",\n name: \"eq\",\n} as const satisfies Operator\nexport const COLLECTION_NOT = {\n inputType: { type: \"collection\" },\n label: \"is not\",\n name: \"not\",\n} as const satisfies Operator\n\nconst ALL_COLLECTION_OPERATORS = [COLLECTION_IS, COLLECTION_NOT]\nconst DEFAULT_COLLECTION_OPERATORS = [COLLECTION_IS]\n\nexport type CollectionOperatorName =\n (typeof ALL_COLLECTION_OPERATORS)[number][\"name\"]\n\nexport type CollectionActiveFilter = ActiveFilter<\n CollectionFilterValue | undefined,\n CollectionOperatorName\n>\n\nexport type CollectionFilterConfig =\n FilterItemConfig<CollectionOperatorName> & {\n /** How the editor presents the options. Defaults to `select`. */\n display?: CollectionDisplay\n /** Allows picking more than one option. Only supported with the `combobox` display; `checkboxes` always allows multiple and `radios` never does. */\n multiple?: boolean\n /** The choices, or a function that loads them. A function receives the combobox's search query and, inside a `scopedFilter`, the chosen scope. */\n options: CollectionOptions\n } & (\n | { display?: Exclude<CollectionDisplay, \"combobox\">; multiple?: never }\n | { display: \"combobox\"; multiple?: boolean }\n )\n\nexport function collectionFilter({\n display = \"select\",\n excludes,\n includes,\n multiple: multipleCombobox = false,\n options,\n ...config\n}: CollectionFilterConfig): FilterNodeItem {\n const multiple = display === \"checkboxes\" || multipleCombobox\n const filter: FilterNodeItem = {\n ...config,\n createActiveFilterInstance: (activeFilter, operator) =>\n new CollectionActiveFilterInstance(\n filter,\n operator,\n activeFilter.value as CollectionFilterValue,\n activeFilter.label,\n activeFilter.scope,\n { display, multiple, options }\n ),\n operators: resolveOperators(ALL_COLLECTION_OPERATORS, {\n default: DEFAULT_COLLECTION_OPERATORS,\n excludes,\n includes,\n }),\n }\n return filter\n}\n\nclass CollectionActiveFilterInstance extends ActiveFilterInstance<CollectionFilterValue> {\n constructor(\n filter: FilterNodeItem,\n operator: FilterNodeItem[\"operators\"][number],\n value: CollectionFilterValue,\n private readonly label: ActiveFilterLabel,\n private readonly scope: string | undefined,\n private readonly config: {\n display: CollectionDisplay\n multiple: boolean\n options: CollectionOptions\n }\n ) {\n super(filter, operator, value)\n this.label = label\n }\n\n formatValue() {\n if (this.label) return Array.isArray(this.label) ? this.label : [this.label]\n const values = Array.isArray(this.value) ? this.value : [this.value]\n if (typeof this.config.options === \"function\") return [\"\"]\n return values\n .map(\n (value) =>\n (this.config.options as CollectionOption[]).find(\n (option) => option.value === value\n )?.label ?? value\n )\n .join(\", \")\n }\n\n renderEditor(onChange: FilterChange) {\n const hasLazyOptions = typeof this.config.options === \"function\"\n const Editor = hasLazyOptions\n ? CollectionFilterEditorLazy\n : CollectionFilterEditorStatic\n\n return (\n <Editor\n config={this.config}\n onChange={onChange}\n operator={this.operator}\n value={this.value}\n label={this.label}\n filter={this.filter}\n scope={this.scope}\n />\n )\n }\n}\n"],"names":["React"],"mappings":";;;;;;AA2BO,MAAM,aAAa,GAAG;AAC3B,IAAA,SAAS,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;AACjC,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,IAAI,EAAE,IAAI;;AAEL,MAAM,cAAc,GAAG;AAC5B,IAAA,SAAS,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;AACjC,IAAA,KAAK,EAAE,QAAQ;AACf,IAAA,IAAI,EAAE,KAAK;;AAGb,MAAM,wBAAwB,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC;AAChE,MAAM,4BAA4B,GAAG,CAAC,aAAa,CAAC;AAuB9C,SAAU,gBAAgB,CAAC,EAC/B,OAAO,GAAG,QAAQ,EAClB,QAAQ,EACR,QAAQ,EACR,QAAQ,EAAE,gBAAgB,GAAG,KAAK,EAClC,OAAO,EACP,GAAG,MAAM,EACc,EAAA;AACvB,IAAA,MAAM,QAAQ,GAAG,OAAO,KAAK,YAAY,IAAI,gBAAgB;AAC7D,IAAA,MAAM,MAAM,GAAmB;AAC7B,QAAA,GAAG,MAAM;AACT,QAAA,0BAA0B,EAAE,CAAC,YAAY,EAAE,QAAQ,KACjD,IAAI,8BAA8B,CAChC,MAAM,EACN,QAAQ,EACR,YAAY,CAAC,KAA8B,EAC3C,YAAY,CAAC,KAAK,EAClB,YAAY,CAAC,KAAK,EAClB,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAC/B;AACH,QAAA,SAAS,EAAE,gBAAgB,CAAC,wBAAwB,EAAE;AACpD,YAAA,OAAO,EAAE,4BAA4B;YACrC,QAAQ;YACR,QAAQ;SACT,CAAC;KACH;AACD,IAAA,OAAO,MAAM;A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AAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,KAAK,EAAE,IAAI,CAAC,KAAK,EAAA,CACjB;IAEN;AACD;;;;"}
@@ -1,7 +1,6 @@
1
1
  import { type DatePickerDateValue } from "../date-picker";
2
- import type { FilterItemConfig, FilterNodeItem } from "./FilterTypes";
3
- /** ISO `YYYY-MM-DD` strings; a pair for `between`. */
4
- export type DateFilterValue = string | [string, string];
2
+ import type { ActiveFilter, FilterItemConfig, FilterNodeItem } from "./FilterTypes";
3
+ type DateRange = [string | undefined, string | undefined];
5
4
  export declare const DATE_IS: {
6
5
  readonly inputType: {
7
6
  readonly type: "date";
@@ -82,6 +81,9 @@ declare const ALL_DATE_OPERATORS: ({
82
81
  readonly name: "between";
83
82
  })[];
84
83
  export type DateOperatorName = (typeof ALL_DATE_OPERATORS)[number]["name"];
84
+ /** An ISO `YYYY-MM-DD` string; a pair for `between`, either side of which may still be empty. */
85
+ export type DateFilterValue = string | DateRange | undefined;
86
+ export type DateActiveFilter = ActiveFilter<DateFilterValue, DateOperatorName>;
85
87
  /** Inclusive bounds on the dates the filter's pickers allow. */
86
88
  export interface DateLimits {
87
89
  /** Latest selectable date, as a `DateValue` or ISO date string. */
@@ -1 +1 @@
1
- {"version":3,"file":"dateFilter.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/dateFilter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAW9E,OAAO,KAAK,EAEV,gBAAgB,EAChB,cAAc,EAEf,MAAM,eAAe,CAAA;AAGtB,sDAAsD;AACtD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;A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;;;;CAIa,CAAA;AAC7B,eAAO,MAAM,GAAG;;;;;;CAIa,CAAA;AAC7B,eAAO,MAAM,UAAU;;;;;;CAIM,CAAA;AAE7B,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAA0C,CAAA;AAGlE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;AAE1E,iGAAiG;AACjG,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;AAE5D,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAA;AAuB9E,gEAAgE;AAChE,MAAM,WAAW,UAAU;IACzB,mEAAmE;IACnE,GAAG,CAAC,EAAE,mBAAmB,CAAA;IACzB,qEAAqE;IACrE,GAAG,CAAC,EAAE,mBAAmB,CAAA;CAC1B;AAcD,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,GAAG,EACH,GAAG,MAAM,EACV,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,UAAU,GAAG,cAAc,CAiBlE"}
@@ -66,7 +66,7 @@ function toValidDate(date, { max, min }) {
66
66
  function dateFilter({ excludes, includes, max, min, ...config }) {
67
67
  const filter = {
68
68
  ...config,
69
- createActiveFilterInstance: (activeFilter, operator) => new DateActiveFilter(filter, operator, activeFilter.value, { max, min }),
69
+ createActiveFilterInstance: (activeFilter, operator) => new DateActiveFilterInstance(filter, operator, activeFilter.value, { max, min }),
70
70
  operators: resolveOperators(ALL_DATE_OPERATORS, {
71
71
  default: DEFAULT_DATE_OPERATORS,
72
72
  excludes,
@@ -75,7 +75,7 @@ function dateFilter({ excludes, includes, max, min, ...config }) {
75
75
  };
76
76
  return filter;
77
77
  }
78
- class DateActiveFilter extends ActiveFilterInstance {
78
+ class DateActiveFilterInstance extends ActiveFilterInstance {
79
79
  limits;
80
80
  constructor(filter, operator, value, limits) {
81
81
  super(filter, operator, value);
@@ -1 +1 @@
1
- {"version":3,"file":"dateFilter.js","sources":["../../../src/components/DataTable/dateFilter.tsx"],"sourcesContent":["import { DatePicker, type DatePickerDateValue } from \"@components/date-picker\"\nimport { Flex } from \"@components/flex\"\nimport {\n DateFormatter,\n type DateValue,\n getLocalTimeZone,\n parseDate,\n} from \"@internationalized/date\"\nimport React from \"react\"\n\nimport { ActiveFilterInstance } from \"./ActiveFilterInstance\"\nimport type {\n FilterChange,\n FilterItemConfig,\n FilterNodeItem,\n Operator,\n} from \"./FilterTypes\"\nimport { resolveOperators } from \"./resolveOperators\"\n\n/** ISO `YYYY-MM-DD` strings; a pair for `between`. */\nexport type DateFilterValue = string | [string, string]\n\ntype DateRange = [string | undefined, string | undefined]\n\nexport const DATE_IS = {\n inputType: { type: \"date\" },\n label: \"is\",\n name: \"eq\",\n} as const satisfies Operator\nexport const LT = {\n inputType: { type: \"date\" },\n label: \"is before\",\n name: \"lt\",\n} as const satisfies Operator\nexport const GT = {\n inputType: { type: \"date\" },\n label: \"is after\",\n name: \"gt\",\n} as const satisfies Operator\nexport const LTE = {\n inputType: { type: \"date\" },\n label: \"is on or before\",\n name: \"lte\",\n} as const satisfies Operator\nexport const GTE = {\n inputType: { type: \"date\" },\n label: \"is on or after\",\n name: \"gte\",\n} as const satisfies Operator\nexport const DATE_RANGE = {\n inputType: { type: \"date-range\" },\n label: \"is between\",\n name: \"between\",\n} as const satisfies Operator\n\nconst ALL_DATE_OPERATORS = [DATE_IS, LT, GT, LTE, GTE, DATE_RANGE]\nconst DEFAULT_DATE_OPERATORS = [DATE_IS, LT, GT, DATE_RANGE]\n\nexport type DateOperatorName = (typeof ALL_DATE_OPERATORS)[number][\"name\"]\n\nconst formatter = new DateFormatter(\n new Intl.DateTimeFormat().resolvedOptions().locale,\n { dateStyle: \"medium\" }\n)\n\nconst formatDate = (iso: string) =>\n formatter.format(parseDate(iso).toDate(getLocalTimeZone()))\n\nconst toDateValue = (date: DatePickerDateValue) =>\n typeof date === \"string\" ? parseDate(date) : date\n\nfunction earlier(a?: DatePickerDateValue, b?: DatePickerDateValue) {\n if (a === undefined || b === undefined) return a ?? b\n return toDateValue(a).compare(toDateValue(b)) <= 0 ? a : b\n}\n\nfunction later(a?: DatePickerDateValue, b?: DatePickerDateValue) {\n if (a === undefined || b === undefined) return a ?? b\n return toDateValue(a).compare(toDateValue(b)) >= 0 ? a : b\n}\n\n/** Inclusive bounds on the dates the filter's pickers allow. */\nexport interface DateLimits {\n /** Latest selectable date, as a `DateValue` or ISO date string. */\n max?: DatePickerDateValue\n /** Earliest selectable date, as a `DateValue` or ISO date string. */\n min?: DatePickerDateValue\n}\n\n/**\n * The pickers only flag typed dates outside the limits as invalid, so the\n * editors clear the value rather than commit them.\n */\nfunction toValidDate(date: DateValue | null, { max, min }: DateLimits) {\n if (!date) return undefined\n const isWithinLimits =\n (min === undefined || date.compare(toDateValue(min)) >= 0) &&\n (max === undefined || date.compare(toDateValue(max)) <= 0)\n return isWithinLimits ? date.toString() : undefined\n}\n\nexport function dateFilter({\n excludes,\n includes,\n max,\n min,\n ...config\n}: FilterItemConfig<DateOperatorName> & DateLimits): FilterNodeItem {\n const filter: FilterNodeItem = {\n ...config,\n createActiveFilterInstance: (activeFilter, operator) =>\n new DateActiveFilter(\n filter,\n operator,\n activeFilter.value as DateFilterValue,\n { max, min }\n ),\n operators: resolveOperators(ALL_DATE_OPERATORS, {\n default: DEFAULT_DATE_OPERATORS,\n excludes,\n includes,\n }),\n }\n return filter\n}\n\nclass DateActiveFilter extends ActiveFilterInstance<DateFilterValue> {\n constructor(\n filter: FilterNodeItem,\n operator: Operator,\n value: DateFilterValue,\n readonly limits: DateLimits\n ) {\n super(filter, operator, value)\n }\n\n formatValue() {\n if (Array.isArray(this.value)) {\n const [start, end] = this.value\n if (start === undefined || end === undefined) {\n return [start, end].filter((date) => date !== undefined).map(formatDate)\n }\n return [formatDate(start), \"and\", formatDate(end)]\n }\n return this.value === undefined ? \"\" : formatDate(this.value)\n }\n\n renderEditor(onChange: FilterChange) {\n const { label } = this.operator\n\n if (this.operator.inputType.type === \"date-range\") {\n const range: DateRange = Array.isArray(this.value)\n ? this.value\n : [this.value, this.value]\n return (\n <DateRangeEditor\n label={label}\n max={this.limits.max}\n min={this.limits.min}\n value={range}\n onCommit={(value) => {\n const complete =\n value.length === 2 && value.every((v) => v !== undefined)\n onChange({ value }, { complete })\n }}\n />\n )\n }\n const single = Array.isArray(this.value) ? this.value[0] : this.value\n return (\n <DatePicker\n // eslint-disable-next-line jsx-a11y/no-autofocus -- the editor only ever renders inside a chip popover that just opened, per ARIA dialog practices\n autoFocus\n hideLabel\n // Uncontrolled so a typed date outside the limits stays visible\n // (and flagged invalid) after the value is cleared.\n defaultValue={single}\n label={label}\n max={this.limits.max}\n min={this.limits.min}\n onChange={(date) => {\n const value = toValidDate(date, this.limits)\n onChange({ value }, { complete: value !== undefined })\n }}\n />\n )\n }\n}\n\nfunction DateRangeEditor({\n label,\n max,\n min,\n onCommit,\n value: [start, end],\n}: DateLimits & {\n label: string\n onCommit: (value: DateRange) => void\n value: DateRange\n}) {\n const startLimits = { max: earlier(max, end), min }\n const endLimits = { max, min: later(min, start) }\n\n return (\n <Flex align=\"center\" gap={1}>\n <DatePicker\n // eslint-disable-next-line jsx-a11y/no-autofocus -- the editor only ever renders inside a chip popover that just opened, per ARIA dialog practices\n autoFocus\n hideLabel\n defaultValue={start}\n label={`${label} from`}\n max={startLimits.max}\n min={startLimits.min}\n onChange={(date) => onCommit([toValidDate(date, startLimits), end])}\n />\n <div>and</div>\n <DatePicker\n hideLabel\n defaultValue={end}\n label={`${label} to`}\n max={endLimits.max}\n min={endLimits.min}\n onChange={(date) => onCommit([start, toValidDate(date, endLimits)])}\n />\n </Flex>\n )\n}\n"],"names":["DateFormatter","parseDate","getLocalTimeZone","React"],"mappings":";;;;;;;;;AAwBO,MAAM,OAAO,GAAG;AACr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I,KAAK,QAAQ,CAAC,CAAC,KAAK,EAAE,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAA,CACnE,CACG;AAEX;;;;"}
1
+ {"version":3,"file":"dateFilter.js","sources":["../../../src/components/DataTable/dateFilter.tsx"],"sourcesContent":["import { DatePicker, type DatePickerDateValue } from \"@components/date-picker\"\nimport { Flex } from \"@components/flex\"\nimport {\n DateFormatter,\n type DateValue,\n getLocalTimeZone,\n parseDate,\n} from \"@internationalized/date\"\nimport React from \"react\"\n\nimport { ActiveFilterInstance } from \"./ActiveFilterInstance\"\nimport type {\n ActiveFilter,\n FilterChange,\n FilterItemConfig,\n FilterNodeItem,\n Operator,\n} from \"./FilterTypes\"\nimport { resolveOperators } from \"./resolveOperators\"\n\ntype DateRange = [string | undefined, string | undefined]\n\nexport const DATE_IS = {\n inputType: { type: \"date\" },\n label: \"is\",\n name: \"eq\",\n} as const satisfies Operator\nexport const LT = {\n inputType: { type: \"date\" },\n label: \"is before\",\n name: \"lt\",\n} as const satisfies Operator\nexport const GT = {\n inputType: { type: \"date\" },\n label: \"is after\",\n name: \"gt\",\n} as const satisfies Operator\nexport const LTE = {\n inputType: { type: \"date\" },\n label: \"is on or before\",\n name: \"lte\",\n} as const satisfies Operator\nexport const GTE = {\n inputType: { type: \"date\" },\n label: \"is on or after\",\n name: \"gte\",\n} as const satisfies Operator\nexport const DATE_RANGE = {\n inputType: { type: \"date-range\" },\n label: \"is between\",\n name: \"between\",\n} as const satisfies Operator\n\nconst ALL_DATE_OPERATORS = [DATE_IS, LT, GT, LTE, GTE, DATE_RANGE]\nconst DEFAULT_DATE_OPERATORS = [DATE_IS, LT, GT, DATE_RANGE]\n\nexport type DateOperatorName = (typeof ALL_DATE_OPERATORS)[number][\"name\"]\n\n/** An ISO `YYYY-MM-DD` string; a pair for `between`, either side of which may still be empty. */\nexport type DateFilterValue = string | DateRange | undefined\n\nexport type DateActiveFilter = ActiveFilter<DateFilterValue, DateOperatorName>\n\nconst formatter = new DateFormatter(\n new Intl.DateTimeFormat().resolvedOptions().locale,\n { dateStyle: \"medium\" }\n)\n\nconst formatDate = (iso: string) =>\n formatter.format(parseDate(iso).toDate(getLocalTimeZone()))\n\nconst toDateValue = (date: DatePickerDateValue) =>\n typeof date === \"string\" ? parseDate(date) : date\n\nfunction earlier(a?: DatePickerDateValue, b?: DatePickerDateValue) {\n if (a === undefined || b === undefined) return a ?? b\n return toDateValue(a).compare(toDateValue(b)) <= 0 ? a : b\n}\n\nfunction later(a?: DatePickerDateValue, b?: DatePickerDateValue) {\n if (a === undefined || b === undefined) return a ?? b\n return toDateValue(a).compare(toDateValue(b)) >= 0 ? a : b\n}\n\n/** Inclusive bounds on the dates the filter's pickers allow. */\nexport interface DateLimits {\n /** Latest selectable date, as a `DateValue` or ISO date string. */\n max?: DatePickerDateValue\n /** Earliest selectable date, as a `DateValue` or ISO date string. */\n min?: DatePickerDateValue\n}\n\n/**\n * The pickers only flag typed dates outside the limits as invalid, so the\n * editors clear the value rather than commit them.\n */\nfunction toValidDate(date: DateValue | null, { max, min }: DateLimits) {\n if (!date) return undefined\n const isWithinLimits =\n (min === undefined || date.compare(toDateValue(min)) >= 0) &&\n (max === undefined || date.compare(toDateValue(max)) <= 0)\n return isWithinLimits ? date.toString() : undefined\n}\n\nexport function dateFilter({\n excludes,\n includes,\n max,\n min,\n ...config\n}: FilterItemConfig<DateOperatorName> & DateLimits): FilterNodeItem {\n const filter: FilterNodeItem = {\n ...config,\n createActiveFilterInstance: (activeFilter, operator) =>\n new DateActiveFilterInstance(\n filter,\n operator,\n activeFilter.value as DateFilterValue,\n { max, min }\n ),\n operators: resolveOperators(ALL_DATE_OPERATORS, {\n default: DEFAULT_DATE_OPERATORS,\n excludes,\n includes,\n }),\n }\n return filter\n}\n\nclass DateActiveFilterInstance extends ActiveFilterInstance<DateFilterValue> {\n constructor(\n filter: FilterNodeItem,\n operator: Operator,\n value: DateFilterValue,\n readonly limits: DateLimits\n ) {\n super(filter, operator, value)\n }\n\n formatValue() {\n if (Array.isArray(this.value)) {\n const [start, end] = this.value\n if (start === undefined || end === undefined) {\n return [start, end].filter((date) => date !== undefined).map(formatDate)\n }\n return [formatDate(start), \"and\", formatDate(end)]\n }\n return this.value === undefined ? \"\" : formatDate(this.value)\n }\n\n renderEditor(onChange: FilterChange) {\n const { label } = this.operator\n\n if (this.operator.inputType.type === \"date-range\") {\n const range: DateRange = Array.isArray(this.value)\n ? this.value\n : [this.value, this.value]\n return (\n <DateRangeEditor\n label={label}\n max={this.limits.max}\n min={this.limits.min}\n value={range}\n onCommit={(value) => {\n const complete =\n value.length === 2 && value.every((v) => v !== undefined)\n onChange({ value }, { complete })\n }}\n />\n )\n }\n const single = Array.isArray(this.value) ? this.value[0] : this.value\n return (\n <DatePicker\n // eslint-disable-next-line jsx-a11y/no-autofocus -- the editor only ever renders inside a chip popover that just opened, per ARIA dialog practices\n autoFocus\n hideLabel\n // Uncontrolled so a typed date outside the limits stays visible\n // (and flagged invalid) after the value is cleared.\n defaultValue={single}\n label={label}\n max={this.limits.max}\n min={this.limits.min}\n onChange={(date) => {\n const value = toValidDate(date, this.limits)\n onChange({ value }, { complete: value !== undefined })\n }}\n />\n )\n }\n}\n\nfunction DateRangeEditor({\n label,\n max,\n min,\n onCommit,\n value: [start, end],\n}: DateLimits & {\n label: string\n onCommit: (value: DateRange) => void\n value: DateRange\n}) {\n const startLimits = { max: earlier(max, end), min }\n const endLimits = { max, min: later(min, start) }\n\n return (\n <Flex align=\"center\" gap={1}>\n <DatePicker\n // eslint-disable-next-line jsx-a11y/no-autofocus -- the editor only ever renders inside a chip popover that just opened, per ARIA dialog practices\n autoFocus\n hideLabel\n defaultValue={start}\n label={`${label} from`}\n max={startLimits.max}\n min={startLimits.min}\n onChange={(date) => onCommit([toValidDate(date, startLimits), end])}\n />\n <div>and</div>\n <DatePicker\n hideLabel\n defaultValue={end}\n label={`${label} to`}\n max={endLimits.max}\n min={endLimits.min}\n onChange={(date) => onCommit([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,KAAK,CAAA,GAAA,CAAK,EACpB,GAAG,EAAE,SAAS,CAAC,GAAG,EAClB,GAAG,EAAE,SAAS,CAAC,GAAG,EAClB,QAAQ,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,KAAK,EAAE,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAA,CACnE,CACG;AAEX;;;;"}
@@ -1,6 +1,4 @@
1
- import type { FilterItemConfig, FilterNodeItem } from "./FilterTypes";
2
- /** `MM-DD` strings with no year; a pair for `between`. */
3
- export type DayFilterValue = string | [string, string];
1
+ import type { ActiveFilter, FilterItemConfig, FilterNodeItem } from "./FilterTypes";
4
2
  export declare const DAY_IS: {
5
3
  readonly inputType: {
6
4
  readonly type: "day";
@@ -29,6 +27,9 @@ declare const DAY_OPERATORS: ({
29
27
  readonly name: "between";
30
28
  })[];
31
29
  export type DayOperatorName = (typeof DAY_OPERATORS)[number]["name"];
30
+ /** An `MM-DD` string with no year; a pair for `between`, either side of which may still be empty. */
31
+ export type DayFilterValue = string | [string | undefined, string | undefined] | undefined;
32
+ export type DayActiveFilter = ActiveFilter<DayFilterValue, DayOperatorName>;
32
33
  export declare function dayFilter({ excludes, includes, ...config }: FilterItemConfig<DayOperatorName>): FilterNodeItem;
33
34
  export {};
34
35
  //# sourceMappingURL=dayFilter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dayFilter.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/dayFilter.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,gBAAgB,EAChB,cAAc,EAEf,MAAM,eAAe,CAAA;AAGtB,0DAA0D;AAC1D,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAEtD,eAAO,MAAM,MAAM;;;;;;CAIU,CAAA;AAC7B,eAAO,MAAM,SAAS;;;;;;CAIO,CAAA;AAE7B,QAAA,MAAM,aAAa;;;;;;;;;;;;IAAsB,CAAA;AAEzC,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;AA2CpE,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,gBAAgB,CAAC,eAAe,CAAC,GAAG,cAAc,CAgBpD"}
1
+ {"version":3,"file":"dayFilter.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/dayFilter.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,YAAY,EAEZ,gBAAgB,EAChB,cAAc,EAEf,MAAM,eAAe,CAAA;AAGtB,eAAO,MAAM,MAAM;;;;;;CAIU,CAAA;AAC7B,eAAO,MAAM,SAAS;;;;;;CAIO,CAAA;AAE7B,QAAA,MAAM,aAAa;;;;;;;;;;;;IAAsB,CAAA;AAEzC,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpE,qGAAqG;AACrG,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,GACxC,SAAS,CAAA;AAEb,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;AA2C3E,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,gBAAgB,CAAC,eAAe,CAAC,GAAG,cAAc,CAgBpD"}
@@ -50,7 +50,7 @@ const dayOptions = (month) => Array.from({ length: month ? daysInMonth(month) :
50
50
  function dayFilter({ excludes, includes, ...config }) {
51
51
  const filter = {
52
52
  ...config,
53
- createActiveFilterInstance: (activeFilter, operator) => new DayActiveFilter(filter, operator, activeFilter.value),
53
+ createActiveFilterInstance: (activeFilter, operator) => new DayActiveFilterInstance(filter, operator, activeFilter.value),
54
54
  operators: resolveOperators(DAY_OPERATORS, {
55
55
  default: DAY_OPERATORS,
56
56
  excludes,
@@ -59,7 +59,7 @@ function dayFilter({ excludes, includes, ...config }) {
59
59
  };
60
60
  return filter;
61
61
  }
62
- class DayActiveFilter extends ActiveFilterInstance {
62
+ class DayActiveFilterInstance extends ActiveFilterInstance {
63
63
  formatValue() {
64
64
  if (Array.isArray(this.value)) {
65
65
  const [start, end] = this.value;
@@ -1 +1 @@
1
- {"version":3,"file":"dayFilter.js","sources":["../../../src/components/DataTable/dayFilter.tsx"],"sourcesContent":["import { Flex } from \"@components/flex\"\nimport { Select } from \"@components/select\"\nimport React, { useState } from \"react\"\n\nimport { ActiveFilterInstance } from \"./ActiveFilterInstance\"\nimport type {\n FilterChange,\n FilterItemConfig,\n FilterNodeItem,\n Operator,\n} from \"./FilterTypes\"\nimport { resolveOperators } from \"./resolveOperators\"\n\n/** `MM-DD` strings with no year; a pair for `between`. */\nexport type DayFilterValue = string | [string, string]\n\nexport const DAY_IS = {\n inputType: { type: \"day\" },\n label: \"is\",\n name: \"eq\",\n} as const satisfies Operator\nexport const DAY_RANGE = {\n inputType: { type: \"day-range\" },\n label: \"is between\",\n name: \"between\",\n} as const satisfies Operator\n\nconst DAY_OPERATORS = [DAY_IS, DAY_RANGE]\n\nexport type DayOperatorName = (typeof DAY_OPERATORS)[number][\"name\"]\n\n// A leap year, so Feb 29 is always selectable.\nconst REFERENCE_YEAR = 2000\n\nconst locale = new Intl.DateTimeFormat().resolvedOptions().locale\nconst dayFormatter = new Intl.DateTimeFormat(locale, {\n calendar: \"gregory\",\n day: \"numeric\",\n month: \"short\",\n})\nconst monthFormatter = new Intl.DateTimeFormat(locale, {\n calendar: \"gregory\",\n month: \"long\",\n})\n\nconst pad = (n: number) => String(n).padStart(2, \"0\")\n\nconst daysInMonth = (month: number) =>\n new Date(REFERENCE_YEAR, month, 0).getDate()\n\nconst parseDay = (value: string | undefined) => {\n const [month, day] = (value ?? \"\").split(\"-\").map(Number)\n return { day: day || undefined, month: month || undefined }\n}\n\nconst formatDay = (value: string) => {\n const { day, month } = parseDay(value)\n if (!month || !day) return \"\"\n return dayFormatter.format(new Date(REFERENCE_YEAR, month - 1, day))\n}\n\nconst monthOptions = Array.from({ length: 12 }, (_, index) => ({\n label: monthFormatter.format(new Date(REFERENCE_YEAR, index, 1)),\n value: String(index + 1),\n}))\n\nconst dayOptions = (month: number | undefined) =>\n Array.from({ length: month ? daysInMonth(month) : 31 }, (_, index) => ({\n label: String(index + 1),\n value: String(index + 1),\n }))\n\nexport function dayFilter({\n excludes,\n includes,\n ...config\n}: FilterItemConfig<DayOperatorName>): FilterNodeItem {\n const filter: FilterNodeItem = {\n ...config,\n createActiveFilterInstance: (activeFilter, operator) =>\n new DayActiveFilter(\n filter,\n operator,\n activeFilter.value as DayFilterValue\n ),\n operators: resolveOperators(DAY_OPERATORS, {\n default: DAY_OPERATORS,\n excludes,\n includes,\n }),\n }\n return filter\n}\n\nclass DayActiveFilter extends ActiveFilterInstance<DayFilterValue> {\n formatValue() {\n if (Array.isArray(this.value)) {\n const [start, end] = this.value\n if (start === undefined || end === undefined) {\n return [start, end].filter((day) => day !== undefined).map(formatDay)\n }\n return [formatDay(start), \"and\", formatDay(end)]\n }\n return this.value === undefined ? \"\" : formatDay(this.value)\n }\n\n renderEditor(onChange: FilterChange) {\n const { label } = this.operator\n\n if (this.operator.inputType.type === \"day-range\") {\n const [start, end] = Array.isArray(this.value)\n ? this.value\n : [this.value, this.value]\n return (\n <Flex gap={1}>\n <DayEditor\n focusOnOpen\n label={`${label} from`}\n value={start}\n onCommit={(day) =>\n onChange({ value: [day, end] }, { complete: end !== undefined })\n }\n />\n <div>and</div>\n <DayEditor\n label={`${label} to`}\n value={end}\n onCommit={(day) =>\n onChange(\n { value: [start, day] },\n { complete: start !== undefined }\n )\n }\n />\n </Flex>\n )\n }\n const single = Array.isArray(this.value) ? this.value[0] : this.value\n return (\n <DayEditor\n focusOnOpen\n label={label}\n value={single}\n onCommit={(day) => onChange({ value: day })}\n />\n )\n }\n}\n\nfunction DayEditor({\n focusOnOpen,\n label,\n onCommit,\n value,\n}: {\n focusOnOpen?: boolean\n label: string\n onCommit: (value: string) => void\n value: string | undefined\n}) {\n const [selection, setSelection] = useState(() => parseDay(value))\n\n const update = (next: typeof selection) => {\n const day =\n next.month && next.day\n ? Math.min(next.day, daysInMonth(next.month))\n : next.day\n setSelection({ ...next, day })\n if (next.month && day) onCommit(`${pad(next.month)}-${pad(day)}`)\n }\n\n return (\n <Flex gap={1}>\n <Select\n // eslint-disable-next-line jsx-a11y/no-autofocus -- the editor only ever renders inside a chip popover that just opened, per ARIA dialog practices\n autoFocus={focusOnOpen}\n hideLabel\n label={`${label} month`}\n options={monthOptions}\n placeholder=\"Month\"\n value={selection.month ? String(selection.month) : \"\"}\n onChange={(e) =>\n update({ ...selection, month: Number(e.target.value) || undefined })\n }\n />\n <Select\n hideLabel\n label={`${label} day`}\n options={dayOptions(selection.month)}\n placeholder=\"Day\"\n value={selection.day ? String(selection.day) : \"\"}\n onChange={(e) =>\n update({ ...selection, day: Number(e.target.value) || undefined })\n }\n />\n </Flex>\n )\n}\n"],"names":["React"],"mappings":";;;;;;AAgBO,MAAM,MAAM,GAAG;AACpB,IAAA,SAAS,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;AAC1B,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,IAAI,EAAE,IAAI;;AAEL,MAAM,SAAS,GAAG;AACvB,IAAA,SAAS,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;AAChC,IAAA,KAAK,EAAE,YAAY;AACnB,IAAA,IAAI,EAAE,SAAS;;AAGjB,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC;AAIzC;AACA,MAAM,cAAc,GAAG,IAAI;AAE3B,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,MAAM;AACjE,MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,cAAc,CA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AAA,EAAC,GAAG,EAAE,CAAC,EAAA;AACV,QAAAA,cAAA,CAAA,aAAA,CAAC;;;;AAEC,YAAA,SAAS,EAAE,WAAW,EACtB,SAAS,EAAA,IAAA,EACT,KAAK,EAAE,CAAA,EAAG,KAAK,CAAA,MAAA,CAAQ,EACvB,OAAO,EAAE,YAAY,EACrB,WAAW,EAAC,OAAO,EACnB,KAAK,EAAE,SAAS,CAAC,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE,EACrD,QAAQ,EAAE,CAAC,CAAC,KACV,MAAM,CAAC,EAAE,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,SAAS,EAAE,CAAC,EAAA,CAEtE;AACF,QAAAA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EACL,SAAS,EAAA,IAAA,EACT,KAAK,EAAE,CAAA,EAAG,KAAK,CAAA,IAAA,CAAM,EACrB,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,EACpC,WAAW,EAAC,KAAK,EACjB,KAAK,EAAE,SAAS,CAAC,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,EACjD,QAAQ,EAAE,CAAC,CAAC,KACV,MAAM,CAAC,EAAE,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,SAAS,EAAE,CAAC,EAAA,CAEpE,CACG;AAEX;;;;"}
1
+ {"version":3,"file":"dayFilter.js","sources":["../../../src/components/DataTable/dayFilter.tsx"],"sourcesContent":["import { Flex } from \"@components/flex\"\nimport { Select } from \"@components/select\"\nimport React, { useState } from \"react\"\n\nimport { ActiveFilterInstance } from \"./ActiveFilterInstance\"\nimport type {\n ActiveFilter,\n FilterChange,\n FilterItemConfig,\n FilterNodeItem,\n Operator,\n} from \"./FilterTypes\"\nimport { resolveOperators } from \"./resolveOperators\"\n\nexport const DAY_IS = {\n inputType: { type: \"day\" },\n label: \"is\",\n name: \"eq\",\n} as const satisfies Operator\nexport const DAY_RANGE = {\n inputType: { type: \"day-range\" },\n label: \"is between\",\n name: \"between\",\n} as const satisfies Operator\n\nconst DAY_OPERATORS = [DAY_IS, DAY_RANGE]\n\nexport type DayOperatorName = (typeof DAY_OPERATORS)[number][\"name\"]\n\n/** An `MM-DD` string with no year; a pair for `between`, either side of which may still be empty. */\nexport type DayFilterValue =\n | string\n | [string | undefined, string | undefined]\n | undefined\n\nexport type DayActiveFilter = ActiveFilter<DayFilterValue, DayOperatorName>\n\n// A leap year, so Feb 29 is always selectable.\nconst REFERENCE_YEAR = 2000\n\nconst locale = new Intl.DateTimeFormat().resolvedOptions().locale\nconst dayFormatter = new Intl.DateTimeFormat(locale, {\n calendar: \"gregory\",\n day: \"numeric\",\n month: \"short\",\n})\nconst monthFormatter = new Intl.DateTimeFormat(locale, {\n calendar: \"gregory\",\n month: \"long\",\n})\n\nconst pad = (n: number) => String(n).padStart(2, \"0\")\n\nconst daysInMonth = (month: number) =>\n new Date(REFERENCE_YEAR, month, 0).getDate()\n\nconst parseDay = (value: string | undefined) => {\n const [month, day] = (value ?? \"\").split(\"-\").map(Number)\n return { day: day || undefined, month: month || undefined }\n}\n\nconst formatDay = (value: string) => {\n const { day, month } = parseDay(value)\n if (!month || !day) return \"\"\n return dayFormatter.format(new Date(REFERENCE_YEAR, month - 1, day))\n}\n\nconst monthOptions = Array.from({ length: 12 }, (_, index) => ({\n label: monthFormatter.format(new Date(REFERENCE_YEAR, index, 1)),\n value: String(index + 1),\n}))\n\nconst dayOptions = (month: number | undefined) =>\n Array.from({ length: month ? daysInMonth(month) : 31 }, (_, index) => ({\n label: String(index + 1),\n value: String(index + 1),\n }))\n\nexport function dayFilter({\n excludes,\n includes,\n ...config\n}: FilterItemConfig<DayOperatorName>): FilterNodeItem {\n const filter: FilterNodeItem = {\n ...config,\n createActiveFilterInstance: (activeFilter, operator) =>\n new DayActiveFilterInstance(\n filter,\n operator,\n activeFilter.value as DayFilterValue\n ),\n operators: resolveOperators(DAY_OPERATORS, {\n default: DAY_OPERATORS,\n excludes,\n includes,\n }),\n }\n return filter\n}\n\nclass DayActiveFilterInstance extends ActiveFilterInstance<DayFilterValue> {\n formatValue() {\n if (Array.isArray(this.value)) {\n const [start, end] = this.value\n if (start === undefined || end === undefined) {\n return [start, end].filter((day) => day !== undefined).map(formatDay)\n }\n return [formatDay(start), \"and\", formatDay(end)]\n }\n return this.value === undefined ? \"\" : formatDay(this.value)\n }\n\n renderEditor(onChange: FilterChange) {\n const { label } = this.operator\n\n if (this.operator.inputType.type === \"day-range\") {\n const [start, end] = Array.isArray(this.value)\n ? this.value\n : [this.value, this.value]\n return (\n <Flex gap={1}>\n <DayEditor\n focusOnOpen\n label={`${label} from`}\n value={start}\n onCommit={(day) =>\n onChange({ value: [day, end] }, { complete: end !== undefined })\n }\n />\n <div>and</div>\n <DayEditor\n label={`${label} to`}\n value={end}\n onCommit={(day) =>\n onChange(\n { value: [start, day] },\n { complete: start !== undefined }\n )\n }\n />\n </Flex>\n )\n }\n const single = Array.isArray(this.value) ? this.value[0] : this.value\n return (\n <DayEditor\n focusOnOpen\n label={label}\n value={single}\n onCommit={(day) => onChange({ value: day })}\n />\n )\n }\n}\n\nfunction DayEditor({\n focusOnOpen,\n label,\n onCommit,\n value,\n}: {\n focusOnOpen?: boolean\n label: string\n onCommit: (value: string) => void\n value: string | undefined\n}) {\n const [selection, setSelection] = useState(() => parseDay(value))\n\n const update = (next: typeof selection) => {\n const day =\n next.month && next.day\n ? Math.min(next.day, daysInMonth(next.month))\n : next.day\n setSelection({ ...next, day })\n if (next.month && day) onCommit(`${pad(next.month)}-${pad(day)}`)\n }\n\n return (\n <Flex gap={1}>\n <Select\n // eslint-disable-next-line jsx-a11y/no-autofocus -- the editor only ever renders inside a chip popover that just opened, per ARIA dialog practices\n autoFocus={focusOnOpen}\n hideLabel\n label={`${label} month`}\n options={monthOptions}\n placeholder=\"Month\"\n value={selection.month ? String(selection.month) : \"\"}\n onChange={(e) =>\n update({ ...selection, month: Number(e.target.value) || undefined })\n }\n />\n <Select\n hideLabel\n label={`${label} day`}\n options={dayOptions(selection.month)}\n placeholder=\"Day\"\n value={selection.day ? String(selection.day) : \"\"}\n onChange={(e) =>\n update({ ...selection, day: Number(e.target.value) || undefined })\n }\n />\n </Flex>\n )\n}\n"],"names":["React"],"mappings":";;;;;;AAcO,MAAM,MAAM,GAAG;AACpB,IAAA,SAAS,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;AAC1B,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,IAAI,EAAE,IAAI;;AAEL,MAAM,SAAS,GAAG;AACvB,IAAA,SAAS,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;AAChC,IAAA,KAAK,EAAE,YAAY;AACnB,IAAA,IAAI,EAAE,SAAS;;AAGjB,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC;AAYzC;AACA,MAAM,cAAc,GAAG,IAAI;AAE3B,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,MAAM;AACjE,MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;AACnD,IAAA,QAAQ,EAAE,SAAS;AACnB,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,KAAK,EAAE,OAAO;AACf,CAAA,CAAC;AACF,MAAM,cAAc,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;AACrD,IAAA,QAAQ,EAAE,SAAS;AACnB,IAAA,KAAK,EAAE,MAAM;AACd,CAAA,CAAC;AAEF,MAAM,GAAG,GAAG,CAAC,CAAS,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAErD,MAAM,WAAW,GAAG,CAAC,KAAa,KAChC,IAAI,I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C,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,SAAS,EAAE,CAAC,EAAA,CAEtE;AACF,QAAAA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EACL,SAAS,EAAA,IAAA,EACT,KAAK,EAAE,CAAA,EAAG,KAAK,CAAA,IAAA,CAAM,EACrB,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,EACpC,WAAW,EAAC,KAAK,EACjB,KAAK,EAAE,SAAS,CAAC,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,EACjD,QAAQ,EAAE,CAAC,CAAC,KACV,MAAM,CAAC,EAAE,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,SAAS,EAAE,CAAC,EAAA,CAEpE,CACG;AAEX;;;;"}
@@ -2,5 +2,5 @@ import type { ActiveFilter } from "./FilterTypes";
2
2
  export declare function createFilterKey(filter: ActiveFilter): void;
3
3
  export declare function getFilterKey(filter: ActiveFilter): string | undefined;
4
4
  export declare function getFilterSequence(filter: ActiveFilter): number | undefined;
5
- export declare function keepFilterKey(oldFilter: ActiveFilter, newFilter: ActiveFilter): ActiveFilter<unknown>;
5
+ export declare function keepFilterKey(oldFilter: ActiveFilter, newFilter: ActiveFilter): ActiveFilter<import("./FilterTypes").ActiveFilterValue, string>;
6
6
  //# sourceMappingURL=filterKeys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filterKeys.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/filterKeys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAOjD,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,QAEnD;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,sBAGhD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,sBAErD;AAED,wBAAgB,aAAa,CAC3B,SAAS,EAAE,YAAY,EACvB,SAAS,EAAE,YAAY,yBAKxB"}
1
+ {"version":3,"file":"filterKeys.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/filterKeys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAOjD,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,QAEnD;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,sBAGhD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,sBAErD;AAED,wBAAgB,aAAa,CAC3B,SAAS,EAAE,YAAY,EACvB,SAAS,EAAE,YAAY,mEAKxB"}