@veeqo/transfigure 0.0.1 → 0.0.3

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 (150) hide show
  1. package/README.md +2 -53
  2. package/dist/BusinessLogic/mocks.d.ts +3 -3
  3. package/dist/BusinessLogic/types.d.ts +3 -2
  4. package/dist/components/Filters/ActiveFilters/Categories/index.d.ts +2 -0
  5. package/dist/components/Filters/ActiveFilters/Variants/ActiveAsyncCheckboxFilter/ActiveAsyncCheckboxFilter.d.ts +8 -0
  6. package/dist/components/Filters/ActiveFilters/Variants/ActiveAsyncCheckboxFilter/index.d.ts +1 -0
  7. package/dist/components/Filters/ActiveFilters/Variants/ActiveAsyncRadioFilter/ActiveAsyncRadioFilter.d.ts +8 -0
  8. package/dist/components/Filters/ActiveFilters/Variants/ActiveAsyncRadioFilter/index.d.ts +1 -0
  9. package/dist/components/Filters/{Fields → ActiveFilters/Variants/ActiveFilterNumberRangeTag}/FilterNumberRangeFilter/FilterNumberRangeFilter.d.ts +1 -1
  10. package/dist/components/Filters/ActiveFilters/Variants/index.d.ts +5 -0
  11. package/dist/components/Filters/ActiveFilters/index.d.ts +2 -3
  12. package/dist/components/Filters/Fields/index.d.ts +0 -6
  13. package/dist/components/Filters/{Fields/FilterGroup → FilterGroup}/FilterGroup.d.ts +1 -1
  14. package/dist/components/Filters/FilterGroup/index.d.ts +1 -0
  15. package/dist/components/Filters/index.d.ts +1 -0
  16. package/dist/components/TableControls/TableControls.d.ts +1 -0
  17. package/dist/components/TableControls/index.d.ts +1 -0
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +75 -75
  21. package/dist/index10.js +3 -12
  22. package/dist/index11.cjs +1 -1
  23. package/dist/index11.js +19 -19
  24. package/dist/index12.cjs +1 -1
  25. package/dist/index12.js +42 -21
  26. package/dist/index13.cjs +1 -1
  27. package/dist/index13.js +23 -38
  28. package/dist/index14.cjs +1 -1
  29. package/dist/index14.js +39 -37
  30. package/dist/index15.cjs +1 -1
  31. package/dist/index15.js +36 -54
  32. package/dist/index16.cjs +1 -1
  33. package/dist/index16.js +32 -46
  34. package/dist/index17.cjs +1 -1
  35. package/dist/index17.js +50 -42
  36. package/dist/index18.cjs +1 -1
  37. package/dist/index18.js +39 -50
  38. package/dist/index19.cjs +1 -1
  39. package/dist/index19.js +59 -37
  40. package/dist/index20.cjs +1 -1
  41. package/dist/index20.js +53 -37
  42. package/dist/index21.cjs +1 -1
  43. package/dist/index21.js +45 -53
  44. package/dist/index22.cjs +1 -1
  45. package/dist/index22.js +43 -33
  46. package/dist/index23.cjs +1 -1
  47. package/dist/index23.js +56 -57
  48. package/dist/index24.cjs +1 -1
  49. package/dist/index24.js +57 -18
  50. package/dist/index25.cjs +1 -1
  51. package/dist/index25.js +38 -31
  52. package/dist/index26.cjs +1 -1
  53. package/dist/index26.js +55 -39
  54. package/dist/index27.cjs +1 -1
  55. package/dist/index27.js +52 -34
  56. package/dist/index28.cjs +1 -1
  57. package/dist/index28.js +81 -47
  58. package/dist/index29.cjs +1 -1
  59. package/dist/index29.js +36 -107
  60. package/dist/index3.js +1 -3
  61. package/dist/index30.cjs +1 -1
  62. package/dist/index30.js +31 -31
  63. package/dist/index31.cjs +1 -1
  64. package/dist/index31.js +10 -30
  65. package/dist/index32.cjs +1 -1
  66. package/dist/index32.js +40 -14
  67. package/dist/index33.js +49 -48
  68. package/dist/index34.js +12 -11
  69. package/dist/index35.js +104 -39
  70. package/dist/index36.cjs +1 -1
  71. package/dist/index36.js +47 -24
  72. package/dist/index37.cjs +1 -1
  73. package/dist/index37.js +43 -22
  74. package/dist/index38.cjs +1 -1
  75. package/dist/index38.js +22 -27
  76. package/dist/index39.cjs +1 -1
  77. package/dist/index39.js +67 -26
  78. package/dist/index4.js +1 -8
  79. package/dist/index40.js +71 -21
  80. package/dist/index41.cjs +1 -1
  81. package/dist/index41.js +31 -18
  82. package/dist/index42.js +2 -8
  83. package/dist/index43.js +13 -1
  84. package/dist/index45.js +14 -12
  85. package/dist/index48.js +1 -3
  86. package/dist/index5.js +2 -9
  87. package/dist/index50.js +3 -12
  88. package/dist/index51.js +8 -42
  89. package/dist/index52.js +20 -35
  90. package/dist/index53.js +16 -25
  91. package/dist/index54.js +18 -27
  92. package/dist/index55.js +31 -36
  93. package/dist/index57.js +22 -32
  94. package/dist/index58.js +14 -15
  95. package/dist/index59.js +2 -10
  96. package/dist/index6.js +8 -40
  97. package/dist/index60.cjs +1 -1
  98. package/dist/index60.js +226 -209
  99. package/dist/index61.js +5 -9
  100. package/dist/index62.js +3 -9
  101. package/dist/index65.js +1 -6
  102. package/dist/index66.js +1 -4
  103. package/dist/index67.js +1 -3
  104. package/dist/index69.js +28 -23
  105. package/dist/index75.cjs +1 -1
  106. package/dist/index75.js +2 -4
  107. package/dist/index76.js +26 -16
  108. package/dist/index77.cjs +1 -19
  109. package/dist/index77.js +14 -29
  110. package/dist/index78.cjs +19 -1
  111. package/dist/index78.js +24 -16
  112. package/dist/index79.cjs +1 -1
  113. package/dist/index79.js +22 -9
  114. package/dist/index80.cjs +78 -10
  115. package/dist/index80.js +92 -13
  116. package/dist/index81.cjs +10 -78
  117. package/dist/index81.js +13 -94
  118. package/dist/index83.cjs +1 -80
  119. package/dist/index83.js +35 -96
  120. package/dist/index84.cjs +1 -1
  121. package/dist/index84.js +62 -35
  122. package/dist/index85.js +1 -3
  123. package/dist/index86.cjs +80 -7
  124. package/dist/index86.js +93 -10
  125. package/dist/index87.cjs +7 -0
  126. package/dist/index87.js +12 -0
  127. package/dist/index9.cjs +1 -1
  128. package/dist/index9.js +99 -84
  129. package/dist/mobx/Filters/Filters.d.ts +5 -0
  130. package/dist/mocks/internal/mockUseStores/index.d.ts +1 -0
  131. package/dist/mocks/internal/mockUseStores/mockUseStores.d.ts +6 -0
  132. package/dist/types.d.ts +1 -1
  133. package/package.json +4 -5
  134. package/dist/components/Filters/Fields/AsyncInlineCheckboxFilter/AsyncInlineCheckboxFilter.d.ts +0 -8
  135. package/dist/components/Filters/Fields/AsyncInlineCheckboxFilter/index.d.ts +0 -1
  136. package/dist/components/Filters/Fields/AsyncInlineRadioFilter/AsyncInlineRadioFilter.d.ts +0 -8
  137. package/dist/components/Filters/Fields/AsyncInlineRadioFilter/index.d.ts +0 -1
  138. package/dist/components/Filters/Fields/FilterGroup/index.d.ts +0 -1
  139. package/dist/components/Table/Table.d.ts +0 -1
  140. /package/dist/components/Filters/{Fields → ActiveFilters/Categories}/FilterArrayField/FilterArrayField.d.ts +0 -0
  141. /package/dist/components/Filters/{Fields → ActiveFilters/Categories}/FilterArrayField/index.d.ts +0 -0
  142. /package/dist/components/Filters/{Fields → ActiveFilters/Categories}/FilterField/FilterField.d.ts +0 -0
  143. /package/dist/components/Filters/{Fields → ActiveFilters/Categories}/FilterField/index.d.ts +0 -0
  144. /package/dist/components/Filters/ActiveFilters/{ActiveFilterArrayTag → Variants/ActiveFilterArrayTag}/ActiveFilterArrayTag.d.ts +0 -0
  145. /package/dist/components/Filters/ActiveFilters/{ActiveFilterArrayTag → Variants/ActiveFilterArrayTag}/index.d.ts +0 -0
  146. /package/dist/components/Filters/ActiveFilters/{ActiveFilterDateRangeTag → Variants/ActiveFilterDateRangeTag}/ActiveFilterDateRangeTag.d.ts +0 -0
  147. /package/dist/components/Filters/ActiveFilters/{ActiveFilterDateRangeTag → Variants/ActiveFilterDateRangeTag}/index.d.ts +0 -0
  148. /package/dist/components/Filters/ActiveFilters/{ActiveFilterNumberRangeTag → Variants/ActiveFilterNumberRangeTag}/ActiveFilterNumberRangeTag.d.ts +0 -0
  149. /package/dist/components/Filters/{Fields → ActiveFilters/Variants/ActiveFilterNumberRangeTag}/FilterNumberRangeFilter/index.d.ts +0 -0
  150. /package/dist/components/Filters/ActiveFilters/{ActiveFilterNumberRangeTag → Variants/ActiveFilterNumberRangeTag}/index.d.ts +0 -0
package/dist/index19.js CHANGED
@@ -1,39 +1,61 @@
1
- import { jsxs as n, jsx as s } from "react/jsx-runtime";
2
- import { useMemo as u } from "react";
3
- import { observer as b } from "mobx-react";
4
- import { Stack as F, ChoiceList as x, Skeleton as y, theme as A, Text as d } from "@veeqo/ui";
5
- import L from "swr/immutable";
6
- import { getAsyncOptions as O } from "./index66.js";
7
- import { getFetcherFunction as S } from "./index67.js";
8
- const R = b(({
9
- field: t,
10
- editedValue: c,
11
- setEditedValue: a
12
- }) => {
13
- var o, i;
14
- const l = u(() => {
15
- var e;
16
- return S({
17
- fetcherName: (e = t.fetchAsyncFilterOptions) == null ? void 0 : e.fetcher
18
- });
19
- }, [(o = t.fetchAsyncFilterOptions) == null ? void 0 : o.fetcher]), {
20
- isLoading: m,
21
- isValidating: h,
22
- data: p,
23
- error: f
24
- } = L((i = t.fetchAsyncFilterOptions) == null ? void 0 : i.URL, l), r = m || h, g = O({
25
- data: p,
26
- config: t.fetchAsyncFilterOptions
27
- });
28
- return /* @__PURE__ */ n(F, { spacing: "xs", alignX: "stretch", children: [
29
- /* @__PURE__ */ s(x, { allowMultiple: !0, title: t.label, options: g, selected: c, onChange: (e) => a(e) }),
30
- r && /* @__PURE__ */ s(y, { width: "200px", height: A.sizes[5], "aria-busy": !0, "aria-label": `Loading ${t.label} filters` }),
31
- !r && f && /* @__PURE__ */ n(d, { variant: "errorSmall", children: [
32
- "Error: failed to load filter for ",
33
- t.label
34
- ] })
35
- ] });
36
- });
1
+ import { jsx as n, jsxs as u } from "react/jsx-runtime";
2
+ import { useState as v, useEffect as C } from "react";
3
+ import { observer as S } from "mobx-react";
4
+ import { FilterTag as b, BaseContainer as a, theme as o, Stack as k, Button as c, DateRangePicker as P } from "@veeqo/ui";
5
+ import { RangeFilter as g } from "./index62.js";
6
+ import { useBusinessLogic as w } from "./index7.js";
7
+ import { useStores as x } from "./index56.js";
8
+ const G = S(
9
+ ({ filterData: i }) => {
10
+ const { DEFAULT_DATE_PRESET: d, DEFAULT_DATE_RANGE: p } = w(), {
11
+ Filters: { dateRangeFilters: s, clearRangeFilter: m, setRangeFilter: f }
12
+ } = x(), t = s.get(i.id), [e, l] = v(s.get(i.id)), F = () => {
13
+ const r = new g();
14
+ return r.setFilterType(t == null ? void 0 : t.filterType), l(r), r;
15
+ };
16
+ C(() => {
17
+ if (!t) return;
18
+ const r = new g();
19
+ r.setFilterType(t.filterType), t.gte && t.lte && r.setDates(t.gte, t.lte), l(r);
20
+ }, [t]);
21
+ const h = () => {
22
+ m(i.id);
23
+ }, y = () => {
24
+ t && (e != null && e.filterType) && f({
25
+ dates: { start: e.gte, end: e.lte },
26
+ key: e.filterType,
27
+ range: t
28
+ });
29
+ }, R = (e == null ? void 0 : e.filterSelection) || d, T = (r) => {
30
+ r && (e || F(), e == null || e.setFilterType(r.value));
31
+ }, A = (r) => {
32
+ !r || !e || e.setDates(r.start, r.end);
33
+ }, E = e ? e.selectedRange : p;
34
+ return /* @__PURE__ */ n(
35
+ b,
36
+ {
37
+ shouldCloseOnClickAway: !0,
38
+ header: /* @__PURE__ */ n("div", { children: "Edit filter (style and semant me pls)" }),
39
+ label: i.label,
40
+ text: (t == null ? void 0 : t.filterLabel) || "",
41
+ content: /* @__PURE__ */ n(a, { style: { padding: o.sizes.md }, children: /* @__PURE__ */ n(
42
+ P,
43
+ {
44
+ "aria-label": `date range for ${i.label}`,
45
+ selectedPreset: R,
46
+ setSelectedPreset: T,
47
+ selectedRange: E,
48
+ setSelectedRange: A
49
+ }
50
+ ) }),
51
+ footer: /* @__PURE__ */ n(a, { style: { padding: o.sizes.sm, width: "200px" }, children: /* @__PURE__ */ u(k, { direction: "horizontal", alignX: "end", children: [
52
+ /* @__PURE__ */ n(c, { variant: "default", size: "sm", onClick: h, children: "Clear" }),
53
+ /* @__PURE__ */ n(c, { variant: "primary", size: "sm", onClick: y, children: "Apply" })
54
+ ] }) })
55
+ }
56
+ );
57
+ }
58
+ );
37
59
  export {
38
- R as AsyncInlineCheckboxFilter
60
+ G as ActiveFilterDateRangeTag
39
61
  };
package/dist/index20.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),b=require("react"),m=require("mobx-react"),t=require("@veeqo/ui"),p=require("swr/immutable"),y=require("./index66.cjs"),F=require("./index67.cjs"),x=e=>e&&e.__esModule?e:{default:e},A=x(p),q=m.observer(({field:e,editedValue:c,setEditedValue:a})=>{var i,o;const l=b.useMemo(()=>{var r;return F.getFetcherFunction({fetcherName:(r=e.fetchAsyncFilterOptions)==null?void 0:r.fetcher})},[(i=e.fetchAsyncFilterOptions)==null?void 0:i.fetcher]),{isLoading:u,isValidating:h,data:g,error:d}=A.default((o=e.fetchAsyncFilterOptions)==null?void 0:o.URL,l),s=u||h,f=y.getAsyncOptions({data:g,config:e.fetchAsyncFilterOptions});return n.jsxs(t.Stack,{spacing:"xs",alignX:"stretch",children:[n.jsx(t.ChoiceList,{title:e.label,options:f,selected:[c],onChange:r=>a(`${r[0]}`)}),s&&n.jsx(t.Skeleton,{width:"200px",height:t.theme.sizes[5],"aria-busy":!0,"aria-label":`Loading ${e.label} filters`}),!s&&d&&n.jsxs(t.Text,{variant:"errorSmall",children:["Error: failed to load filter for ",e.label]})]})});exports.AsyncInlineRadioFilter=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("react"),b=require("mobx-react"),r=require("@veeqo/ui"),F=require("./index61.cjs"),R=require("./index84.cjs"),h=require("./index56.cjs"),x=b.observer(({filterData:i})=>{const{Filters:{numberRangeFilters:o,clearNumberRangeFilter:u,setNumberRangeFilter:d}}=h.useStores(),e=o.get(i.id),[s,a]=l.useState(e),c=l.useCallback(()=>{const n=new F.NumberRangeFilter({filterId:i.id});return e&&(e.gte&&n.setGte(e.gte),e.lte&&n.setLte(e.lte)),n},[i.id,e]);l.useEffect(()=>{const n=c();a(n)},[c,e]);const g=()=>{u(i.id)},m=()=>{!e||!s||d({numberRange:e,lte:s.lte,gte:s.gte})};return t.jsx(r.FilterTag,{shouldCloseOnClickAway:!0,header:t.jsx("div",{children:"Edit filter (style and semant me pls)"}),label:i.label,text:(e==null?void 0:e.filterLabel)||"Loading...",content:t.jsx(r.BaseContainer,{style:{padding:r.theme.sizes.md},children:t.jsx(R.FilterNumberRangeFilter,{data:i,editedValue:s,setEditedValue:a})}),footer:t.jsx(r.BaseContainer,{style:{padding:r.theme.sizes.sm,width:"200px"},children:t.jsxs(r.Stack,{direction:"horizontal",alignX:"end",children:[t.jsx(r.Button,{variant:"default",size:"sm",onClick:g,children:"Clear"}),t.jsx(r.Button,{variant:"primary",size:"sm",onClick:m,children:"Apply"})]})})})});exports.ActiveFilterNumberRangeTag=x;
package/dist/index20.js CHANGED
@@ -1,39 +1,55 @@
1
- import { jsxs as n, jsx as s } from "react/jsx-runtime";
2
- import { useMemo as u } from "react";
3
- import { observer as F } from "mobx-react";
4
- import { Stack as b, ChoiceList as y, Skeleton as d, theme as x, Text as A } from "@veeqo/ui";
5
- import L from "swr/immutable";
6
- import { getAsyncOptions as O } from "./index66.js";
7
- import { getFetcherFunction as S } from "./index67.js";
8
- const w = F(({
9
- field: t,
10
- editedValue: c,
11
- setEditedValue: a
12
- }) => {
13
- var o, i;
14
- const l = u(() => {
15
- var e;
16
- return S({
17
- fetcherName: (e = t.fetchAsyncFilterOptions) == null ? void 0 : e.fetcher
18
- });
19
- }, [(o = t.fetchAsyncFilterOptions) == null ? void 0 : o.fetcher]), {
20
- isLoading: m,
21
- isValidating: h,
22
- data: p,
23
- error: f
24
- } = L((i = t.fetchAsyncFilterOptions) == null ? void 0 : i.URL, l), r = m || h, g = O({
25
- data: p,
26
- config: t.fetchAsyncFilterOptions
27
- });
28
- return /* @__PURE__ */ n(b, { spacing: "xs", alignX: "stretch", children: [
29
- /* @__PURE__ */ s(y, { title: t.label, options: g, selected: [c], onChange: (e) => a(`${e[0]}`) }),
30
- r && /* @__PURE__ */ s(d, { width: "200px", height: x.sizes[5], "aria-busy": !0, "aria-label": `Loading ${t.label} filters` }),
31
- !r && f && /* @__PURE__ */ n(A, { variant: "errorSmall", children: [
32
- "Error: failed to load filter for ",
33
- t.label
34
- ] })
35
- ] });
36
- });
1
+ import { jsx as t, jsxs as F } from "react/jsx-runtime";
2
+ import { useState as b, useCallback as f, useEffect as h } from "react";
3
+ import { observer as R } from "mobx-react";
4
+ import { FilterTag as v, BaseContainer as o, theme as a, Stack as y, Button as d } from "@veeqo/ui";
5
+ import { NumberRangeFilter as C } from "./index61.js";
6
+ import { FilterNumberRangeFilter as N } from "./index84.js";
7
+ import { useStores as w } from "./index56.js";
8
+ const j = R(
9
+ ({ filterData: r }) => {
10
+ const {
11
+ Filters: { numberRangeFilters: m, clearNumberRangeFilter: c, setNumberRangeFilter: u }
12
+ } = w(), e = m.get(r.id), [n, l] = b(e), s = f(() => {
13
+ const i = new C({ filterId: r.id });
14
+ return e && (e.gte && i.setGte(e.gte), e.lte && i.setLte(e.lte)), i;
15
+ }, [r.id, e]);
16
+ h(() => {
17
+ const i = s();
18
+ l(i);
19
+ }, [s, e]);
20
+ const g = () => {
21
+ c(r.id);
22
+ }, p = () => {
23
+ !e || !n || u({
24
+ numberRange: e,
25
+ // update the original value
26
+ lte: n.lte,
27
+ gte: n.gte
28
+ });
29
+ };
30
+ return /* @__PURE__ */ t(
31
+ v,
32
+ {
33
+ shouldCloseOnClickAway: !0,
34
+ header: /* @__PURE__ */ t("div", { children: "Edit filter (style and semant me pls)" }),
35
+ label: r.label,
36
+ text: (e == null ? void 0 : e.filterLabel) || "Loading...",
37
+ content: /* @__PURE__ */ t(o, { style: { padding: a.sizes.md }, children: /* @__PURE__ */ t(
38
+ N,
39
+ {
40
+ data: r,
41
+ editedValue: n,
42
+ setEditedValue: l
43
+ }
44
+ ) }),
45
+ footer: /* @__PURE__ */ t(o, { style: { padding: a.sizes.sm, width: "200px" }, children: /* @__PURE__ */ F(y, { direction: "horizontal", alignX: "end", children: [
46
+ /* @__PURE__ */ t(d, { variant: "default", size: "sm", onClick: g, children: "Clear" }),
47
+ /* @__PURE__ */ t(d, { variant: "primary", size: "sm", onClick: p, children: "Apply" })
48
+ ] }) })
49
+ }
50
+ );
51
+ }
52
+ );
37
53
  export {
38
- w as AsyncInlineRadioFilter
54
+ j as ActiveFilterNumberRangeTag
39
55
  };
package/dist/index21.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("react"),L=require("mobx-react"),O=require("lodash/debounce"),s=require("@veeqo/ui"),R=require("swr/immutable"),j=require("./index66.cjs"),C=require("./index67.cjs"),V=require("./index7.cjs"),k=require("./index56.cjs"),d=e=>e&&e.__esModule?e:{default:e},E=d(O),v=d(R),B=L.observer(({field:e})=>{var l,u;const{FILTERS_DEBOUCE_INTERVAL_MS:h}=V.useBusinessLogic(),g=o.useMemo(()=>{var t;return C.getFetcherFunction({fetcherName:(t=e.fetchAsyncFilterOptions)==null?void 0:t.fetcher})},[(l=e.fetchAsyncFilterOptions)==null?void 0:l.fetcher]),{isLoading:F,isValidating:b,data:S,error:f}=v.default((u=e.fetchAsyncFilterOptions)==null?void 0:u.URL,g),i=F||b,{Filters:{setFilter:c,filters:m}}=k.useStores(),p=m.get(e.id),[y,a]=o.useState(p),q=o.useCallback(E.default((t,r)=>{c(t,r)},h),[c]),x=t=>{const r=`${t[0]}`;a(r),q(e.id,r)},_=()=>{a(""),c(e.id,"")},A=j.getAsyncOptions({data:S,config:e.fetchAsyncFilterOptions});return n.jsxs(s.Stack,{spacing:"xs",alignX:"stretch",children:[n.jsx(s.Button,{variant:"link",onClick:_,children:"Clear"}),n.jsx(s.ChoiceList,{title:e.label,options:A,selected:[y],onChange:t=>x(t)}),i&&n.jsx(s.Skeleton,{width:"200px",height:s.theme.sizes[5],"aria-busy":!0,"aria-label":`Loading ${e.label} filters`}),!i&&f&&n.jsxs(s.Text,{variant:"errorSmall",children:["Error: failed to load filter for ",e.label]})]})});exports.AsyncRadioFilter=B;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),p=require("react"),d=require("mobx-react"),t=require("@veeqo/ui"),m=require("swr/immutable"),x=require("./index66.cjs"),y=require("./index67.cjs"),F=e=>e&&e.__esModule?e:{default:e},A=F(m),q=d.observer(({field:e,editedValue:o,setEditedValue:a})=>{var i,c;const l=p.useMemo(()=>{var r;return y.getFetcherFunction({fetcherName:(r=e.fetchAsyncFilterOptions)==null?void 0:r.fetcher})},[(i=e.fetchAsyncFilterOptions)==null?void 0:i.fetcher]),{isLoading:u,isValidating:h,data:g,error:b}=A.default((c=e.fetchAsyncFilterOptions)==null?void 0:c.URL,l),n=u||h,f=x.getAsyncOptions({data:g,config:e.fetchAsyncFilterOptions});return s.jsxs(t.Stack,{spacing:"xs",alignX:"stretch",children:[s.jsx(t.ChoiceList,{allowMultiple:!0,title:e.label,options:f,selected:o,onChange:r=>a(r)}),n&&s.jsx(t.Skeleton,{width:"200px",height:t.theme.sizes[5],"aria-busy":!0,"aria-label":`Loading ${e.label} filters`}),!n&&b&&s.jsxs(t.Text,{variant:"errorSmall",children:["Error: failed to load filter for ",e.label]})]})});exports.ActiveAsyncCheckboxFilter=q;
package/dist/index21.js CHANGED
@@ -1,55 +1,47 @@
1
- import { jsxs as l, jsx as s } from "react/jsx-runtime";
2
- import { useMemo as C, useState as O, useCallback as x } from "react";
3
- import { observer as V } from "mobx-react";
4
- import k from "lodash/debounce";
5
- import { Stack as E, Button as R, ChoiceList as v, Skeleton as B, theme as I, Text as T } from "@veeqo/ui";
6
- import _ from "swr/immutable";
7
- import { getAsyncOptions as j } from "./index66.js";
8
- import { getFetcherFunction as w } from "./index67.js";
9
- import { useBusinessLogic as M } from "./index7.js";
10
- import { useStores as N } from "./index56.js";
11
- const K = V(({
12
- field: t
13
- }) => {
14
- var c, a;
15
- const {
16
- FILTERS_DEBOUCE_INTERVAL_MS: m
17
- } = M(), h = C(() => {
18
- var e;
19
- return w({
20
- fetcherName: (e = t.fetchAsyncFilterOptions) == null ? void 0 : e.fetcher
21
- });
22
- }, [(c = t.fetchAsyncFilterOptions) == null ? void 0 : c.fetcher]), {
23
- isLoading: u,
24
- isValidating: p,
25
- data: f,
26
- error: g
27
- } = _((a = t.fetchAsyncFilterOptions) == null ? void 0 : a.URL, h), n = u || p, {
28
- Filters: {
29
- setFilter: o,
30
- filters: d
31
- }
32
- } = N(), F = d.get(t.id), [b, i] = O(F), S = x(k((e, r) => {
33
- o(e, r);
34
- }, m), [o]), L = (e) => {
35
- const r = `${e[0]}`;
36
- i(r), S(t.id, r);
37
- }, y = () => {
38
- i(""), o(t.id, "");
39
- }, A = j({
40
- data: f,
41
- config: t.fetchAsyncFilterOptions
42
- });
43
- return /* @__PURE__ */ l(E, { spacing: "xs", alignX: "stretch", children: [
44
- /* @__PURE__ */ s(R, { variant: "link", onClick: y, children: "Clear" }),
45
- /* @__PURE__ */ s(v, { title: t.label, options: A, selected: [b], onChange: (e) => L(e) }),
46
- n && /* @__PURE__ */ s(B, { width: "200px", height: I.sizes[5], "aria-busy": !0, "aria-label": `Loading ${t.label} filters` }),
47
- !n && g && /* @__PURE__ */ l(T, { variant: "errorSmall", children: [
48
- "Error: failed to load filter for ",
49
- t.label
50
- ] })
51
- ] });
52
- });
1
+ import { jsxs as s, jsx as n } from "react/jsx-runtime";
2
+ import { useMemo as u } from "react";
3
+ import { observer as b } from "mobx-react";
4
+ import { Stack as F, ChoiceList as x, Skeleton as y, theme as A, Text as d } from "@veeqo/ui";
5
+ import L from "swr/immutable";
6
+ import { getAsyncOptions as O } from "./index66.js";
7
+ import { getFetcherFunction as S } from "./index67.js";
8
+ const z = b(
9
+ ({ field: t, editedValue: c, setEditedValue: a }) => {
10
+ var o, i;
11
+ const l = u(() => {
12
+ var e;
13
+ return S({ fetcherName: (e = t.fetchAsyncFilterOptions) == null ? void 0 : e.fetcher });
14
+ }, [(o = t.fetchAsyncFilterOptions) == null ? void 0 : o.fetcher]), { isLoading: m, isValidating: h, data: p, error: f } = L(
15
+ (i = t.fetchAsyncFilterOptions) == null ? void 0 : i.URL,
16
+ l
17
+ ), r = m || h, g = O({ data: p, config: t.fetchAsyncFilterOptions });
18
+ return /* @__PURE__ */ s(F, { spacing: "xs", alignX: "stretch", children: [
19
+ /* @__PURE__ */ n(
20
+ x,
21
+ {
22
+ allowMultiple: !0,
23
+ title: t.label,
24
+ options: g,
25
+ selected: c,
26
+ onChange: (e) => a(e)
27
+ }
28
+ ),
29
+ r && /* @__PURE__ */ n(
30
+ y,
31
+ {
32
+ width: "200px",
33
+ height: A.sizes[5],
34
+ "aria-busy": !0,
35
+ "aria-label": `Loading ${t.label} filters`
36
+ }
37
+ ),
38
+ !r && f && /* @__PURE__ */ s(d, { variant: "errorSmall", children: [
39
+ "Error: failed to load filter for ",
40
+ t.label
41
+ ] })
42
+ ] });
43
+ }
44
+ );
53
45
  export {
54
- K as AsyncRadioFilter
46
+ z as ActiveAsyncCheckboxFilter
55
47
  };
package/dist/index22.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),p=require("mobx-react"),i=require("react"),x=require("lodash/debounce"),o=require("@veeqo/ui"),F=require("./index7.cjs"),_=require("./index56.cjs"),q=e=>e&&e.__esModule?e:{default:e},k=q(x),j=p.observer(({field:e})=>{var u;const{FILTERS_DEBOUCE_INTERVAL_MS:l}=F.useBusinessLogic(),{Filters:{setArrayFilter:r,arrayFilters:a}}=_.useStores();if(!((u=e.options)!=null&&u.length))return null;const d=a.get(e.id)||[],[b,c]=i.useState(d),S=i.useCallback(k.default((t,s)=>{r(t,s)},l),[r]),g=t=>{const s=t.map(C=>`${C}`);c(s),S(e.id,s)},h=()=>{c([]),r(e.id,[])};return n.jsxs(o.Stack,{spacing:"xs",children:[n.jsx(o.Button,{variant:"link",onClick:h,children:"Clear"}),n.jsx(o.ChoiceList,{allowMultiple:!0,title:e.label,options:e.options,selected:b,onChange:t=>g(t)})]})});exports.CheckboxFilter=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),b=require("react"),m=require("mobx-react"),t=require("@veeqo/ui"),p=require("swr/immutable"),y=require("./index66.cjs"),F=require("./index67.cjs"),A=e=>e&&e.__esModule?e:{default:e},x=A(p),q=m.observer(({field:e,editedValue:o,setEditedValue:a})=>{var n,c;const l=b.useMemo(()=>{var r;return F.getFetcherFunction({fetcherName:(r=e.fetchAsyncFilterOptions)==null?void 0:r.fetcher})},[(n=e.fetchAsyncFilterOptions)==null?void 0:n.fetcher]),{isLoading:u,isValidating:h,data:g,error:d}=x.default((c=e.fetchAsyncFilterOptions)==null?void 0:c.URL,l),i=u||h,f=y.getAsyncOptions({data:g,config:e.fetchAsyncFilterOptions});return s.jsxs(t.Stack,{spacing:"xs",alignX:"stretch",children:[s.jsx(t.ChoiceList,{title:e.label,options:f,selected:[o],onChange:r=>a(`${r[0]}`)}),i&&s.jsx(t.Skeleton,{width:"200px",height:t.theme.sizes[5],"aria-busy":!0,"aria-label":`Loading ${e.label} filters`}),!i&&d&&s.jsxs(t.Text,{variant:"errorSmall",children:["Error: failed to load filter for ",e.label]})]})});exports.ActiveAsyncRadioFilter=q;
package/dist/index22.js CHANGED
@@ -1,36 +1,46 @@
1
- import { jsxs as C, jsx as l } from "react/jsx-runtime";
1
+ import { jsxs as s, jsx as n } from "react/jsx-runtime";
2
+ import { useMemo as u } from "react";
2
3
  import { observer as F } from "mobx-react";
3
- import { useState as d, useCallback as S } from "react";
4
- import b from "lodash/debounce";
5
- import { Stack as g, Button as k, ChoiceList as x } from "@veeqo/ui";
6
- import { useBusinessLogic as V } from "./index7.js";
7
- import { useStores as E } from "./index56.js";
8
- const w = F(({
9
- field: e
10
- }) => {
11
- var n;
12
- const {
13
- FILTERS_DEBOUCE_INTERVAL_MS: i
14
- } = V(), {
15
- Filters: {
16
- setArrayFilter: o,
17
- arrayFilters: c
18
- }
19
- } = E();
20
- if (!((n = e.options) != null && n.length)) return null;
21
- const a = c.get(e.id) || [], [u, s] = d(a), m = S(b((t, r) => {
22
- o(t, r);
23
- }, i), [o]), p = (t) => {
24
- const r = t.map((h) => `${h}`);
25
- s(r), m(e.id, r);
26
- };
27
- return /* @__PURE__ */ C(g, { spacing: "xs", children: [
28
- /* @__PURE__ */ l(k, { variant: "link", onClick: () => {
29
- s([]), o(e.id, []);
30
- }, children: "Clear" }),
31
- /* @__PURE__ */ l(x, { allowMultiple: !0, title: e.label, options: e.options, selected: u, onChange: (t) => p(t) })
32
- ] });
33
- });
4
+ import { Stack as b, ChoiceList as y, Skeleton as A, theme as d, Text as x } from "@veeqo/ui";
5
+ import L from "swr/immutable";
6
+ import { getAsyncOptions as O } from "./index66.js";
7
+ import { getFetcherFunction as S } from "./index67.js";
8
+ const z = F(
9
+ ({ field: t, editedValue: c, setEditedValue: a }) => {
10
+ var o, i;
11
+ const l = u(() => {
12
+ var e;
13
+ return S({ fetcherName: (e = t.fetchAsyncFilterOptions) == null ? void 0 : e.fetcher });
14
+ }, [(o = t.fetchAsyncFilterOptions) == null ? void 0 : o.fetcher]), { isLoading: m, isValidating: h, data: p, error: f } = L(
15
+ (i = t.fetchAsyncFilterOptions) == null ? void 0 : i.URL,
16
+ l
17
+ ), r = m || h, g = O({ data: p, config: t.fetchAsyncFilterOptions });
18
+ return /* @__PURE__ */ s(b, { spacing: "xs", alignX: "stretch", children: [
19
+ /* @__PURE__ */ n(
20
+ y,
21
+ {
22
+ title: t.label,
23
+ options: g,
24
+ selected: [c],
25
+ onChange: (e) => a(`${e[0]}`)
26
+ }
27
+ ),
28
+ r && /* @__PURE__ */ n(
29
+ A,
30
+ {
31
+ width: "200px",
32
+ height: d.sizes[5],
33
+ "aria-busy": !0,
34
+ "aria-label": `Loading ${t.label} filters`
35
+ }
36
+ ),
37
+ !r && f && /* @__PURE__ */ s(x, { variant: "errorSmall", children: [
38
+ "Error: failed to load filter for ",
39
+ t.label
40
+ ] })
41
+ ] });
42
+ }
43
+ );
34
44
  export {
35
- w as CheckboxFilter
45
+ z as ActiveAsyncRadioFilter
36
46
  };
package/dist/index23.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),P=require("react"),q=require("mobx-react"),n=require("@veeqo/ui"),E=require("./index62.cjs"),b=require("./index7.cjs"),k=require("./index56.cjs"),v=q.observer(({field:s})=>{const{DEFAULT_DATE_PRESET:c,DEFAULT_DATE_RANGE:l}=b.useBusinessLogic(),{Filters:{dateRangeFilters:i,setRangeFilter:o,clearRangeFilter:g}}=k.useStores(),e=i.get(s.id),[u,R]=P.useState(!1),d=(e==null?void 0:e.filterSelection)||c,a=()=>{const t=new E.RangeFilter;i.set(s.id,t)},F=t=>{const T=t.value===n.DateRanges.TODAY&&e&&(e==null?void 0:e.filterType)===void 0;if(!t||T)return;if(!u){R(!0);return}if(!e){a();return}if(!e)return;const f=t.value;o({dates:{start:e.gte,end:e.lte},key:f,range:e})},S=t=>{if(t){if(!e){a();return}e.setDates(t.start,t.end)}},D=()=>{g(s.id)},h=e?e.selectedRange:l;return r.jsxs(n.Stack,{spacing:"xs",children:[r.jsx(n.Button,{variant:"link",onClick:D,children:"Clear"}),r.jsx(n.DateRangePicker,{"aria-label":`date range for ${s.label}`,selectedPreset:d,setSelectedPreset:F,selectedRange:h,setSelectedRange:S})]})});exports.DateRangeFilter=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),o=require("react"),L=require("mobx-react"),O=require("lodash/debounce"),s=require("@veeqo/ui"),j=require("swr/immutable"),k=require("./index66.cjs"),R=require("./index67.cjs"),V=require("./index7.cjs"),E=require("./index56.cjs"),h=e=>e&&e.__esModule?e:{default:e},M=h(O),v=h(j),B=L.observer(({field:e})=>{var l,u;const{FILTERS_DEBOUCE_INTERVAL_MS:d}=V.useBusinessLogic(),g=o.useMemo(()=>{var t;return R.getFetcherFunction({fetcherName:(t=e.fetchAsyncFilterOptions)==null?void 0:t.fetcher})},[(l=e.fetchAsyncFilterOptions)==null?void 0:l.fetcher]),{isLoading:b,isValidating:F,data:y,error:S}=v.default((u=e.fetchAsyncFilterOptions)==null?void 0:u.URL,g),i=b||F,{Filters:{setArrayFilter:c,arrayFilters:p}}=E.useStores(),m=p.get(e.id)||[],[x,a]=o.useState(m),f=o.useCallback(M.default((t,n)=>{c(t,n)},d),[c]),A=t=>{const n=t.map(C=>`${C}`);a(n),f(e.id,n)},q=()=>{a([]),c(e.id,[])},_=k.getAsyncOptions({data:y,config:e.fetchAsyncFilterOptions});return r.jsxs(s.Stack,{spacing:"xs",alignX:"stretch",children:[r.jsx(s.Button,{variant:"link",onClick:q,children:"Clear"}),r.jsx(s.ChoiceList,{allowMultiple:!0,title:e.label,options:_,selected:x,onChange:t=>A(t)}),i&&r.jsx(s.Skeleton,{width:"200px",height:s.theme.sizes[5],"aria-busy":!0,"aria-label":`Loading ${e.label} filters`}),!i&&S&&r.jsxs(s.Text,{variant:"errorSmall",children:["Error: failed to load filter for ",e.label]})]})});exports.AsyncCheckboxFilter=B;
package/dist/index23.js CHANGED
@@ -1,62 +1,61 @@
1
- import { jsxs as D, jsx as i } from "react/jsx-runtime";
2
- import { useState as S } from "react";
3
- import { observer as T } from "mobx-react";
4
- import { Stack as E, Button as P, DateRangePicker as k, DateRanges as A } from "@veeqo/ui";
5
- import { RangeFilter as v } from "./index62.js";
6
- import { useBusinessLogic as C } from "./index7.js";
7
- import { useStores as x } from "./index56.js";
8
- const U = T(({
9
- field: r
10
- }) => {
11
- const {
12
- DEFAULT_DATE_PRESET: a,
13
- DEFAULT_DATE_RANGE: o
14
- } = C(), {
15
- Filters: {
16
- dateRangeFilters: n,
17
- setRangeFilter: l,
18
- clearRangeFilter: c
19
- }
20
- } = x(), e = n.get(r.id), [g, d] = S(!1), R = (e == null ? void 0 : e.filterSelection) || a, s = () => {
21
- const t = new v();
22
- n.set(r.id, t);
23
- }, f = (t) => {
24
- const u = t.value === A.TODAY && e && (e == null ? void 0 : e.filterType) === void 0;
25
- if (!t || u) return;
26
- if (!g) {
27
- d(!0);
28
- return;
29
- }
30
- if (!e) {
31
- s();
32
- return;
33
- }
34
- if (!e) return;
35
- const h = t.value;
36
- l({
37
- dates: {
38
- start: e.gte,
39
- end: e.lte
40
- },
41
- key: h,
42
- range: e
43
- });
44
- }, m = (t) => {
45
- if (t) {
46
- if (!e) {
47
- s();
48
- return;
1
+ import { jsxs as l, jsx as s } from "react/jsx-runtime";
2
+ import { useMemo as x, useState as O, useCallback as k } from "react";
3
+ import { observer as V } from "mobx-react";
4
+ import E from "lodash/debounce";
5
+ import { Stack as R, Button as v, ChoiceList as w, Skeleton as B, theme as I, Text as M } from "@veeqo/ui";
6
+ import T from "swr/immutable";
7
+ import { getAsyncOptions as _ } from "./index66.js";
8
+ import { getFetcherFunction as j } from "./index67.js";
9
+ import { useBusinessLogic as N } from "./index7.js";
10
+ import { useStores as U } from "./index56.js";
11
+ const P = V(({ field: t }) => {
12
+ var c, a;
13
+ const { FILTERS_DEBOUCE_INTERVAL_MS: m } = N(), u = x(() => {
14
+ var e;
15
+ return j({ fetcherName: (e = t.fetchAsyncFilterOptions) == null ? void 0 : e.fetcher });
16
+ }, [(c = t.fetchAsyncFilterOptions) == null ? void 0 : c.fetcher]), { isLoading: h, isValidating: p, data: f, error: g } = T(
17
+ (a = t.fetchAsyncFilterOptions) == null ? void 0 : a.URL,
18
+ u
19
+ ), n = h || p, {
20
+ Filters: { setArrayFilter: o, arrayFilters: F }
21
+ } = U(), d = F.get(t.id) || [], [b, i] = O(d), y = k(
22
+ E((e, r) => {
23
+ o(e, r);
24
+ }, m),
25
+ [o]
26
+ ), S = (e) => {
27
+ const r = e.map((L) => `${L}`);
28
+ i(r), y(t.id, r);
29
+ }, A = () => {
30
+ i([]), o(t.id, []);
31
+ }, C = _({ data: f, config: t.fetchAsyncFilterOptions });
32
+ return /* @__PURE__ */ l(R, { spacing: "xs", alignX: "stretch", children: [
33
+ /* @__PURE__ */ s(v, { variant: "link", onClick: A, children: "Clear" }),
34
+ /* @__PURE__ */ s(
35
+ w,
36
+ {
37
+ allowMultiple: !0,
38
+ title: t.label,
39
+ options: C,
40
+ selected: b,
41
+ onChange: (e) => S(e)
49
42
  }
50
- e.setDates(t.start, t.end);
51
- }
52
- }, p = () => {
53
- c(r.id);
54
- }, F = e ? e.selectedRange : o;
55
- return /* @__PURE__ */ D(E, { spacing: "xs", children: [
56
- /* @__PURE__ */ i(P, { variant: "link", onClick: p, children: "Clear" }),
57
- /* @__PURE__ */ i(k, { "aria-label": `date range for ${r.label}`, selectedPreset: R, setSelectedPreset: f, selectedRange: F, setSelectedRange: m })
43
+ ),
44
+ n && /* @__PURE__ */ s(
45
+ B,
46
+ {
47
+ width: "200px",
48
+ height: I.sizes[5],
49
+ "aria-busy": !0,
50
+ "aria-label": `Loading ${t.label} filters`
51
+ }
52
+ ),
53
+ !n && g && /* @__PURE__ */ l(M, { variant: "errorSmall", children: [
54
+ "Error: failed to load filter for ",
55
+ t.label
56
+ ] })
58
57
  ] });
59
58
  });
60
59
  export {
61
- U as DateRangeFilter
60
+ P as AsyncCheckboxFilter
62
61
  };
package/dist/index24.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("mobx-react"),s=require("@veeqo/ui"),c=require("./index44.cjs"),u=require("./index19.cjs"),h=o.observer(({data:e,editedValue:r,setEditedValue:t})=>{var i;switch(e.filterType){case c.FilterChoiceValue.CHECKBOX:return e.fetchAsyncFilterOptions?n.jsx(u.AsyncInlineCheckboxFilter,{field:e,setEditedValue:t,editedValue:r}):n.jsx(s.ChoiceList,{allowMultiple:!0,title:e.label,options:(i=e.options)!=null&&i.length?e.options:[],selected:r,onChange:l=>t(l)});default:return null}});exports.FilterArrayField=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("react"),L=require("mobx-react"),O=require("lodash/debounce"),s=require("@veeqo/ui"),R=require("swr/immutable"),j=require("./index66.cjs"),C=require("./index67.cjs"),V=require("./index7.cjs"),k=require("./index56.cjs"),d=e=>e&&e.__esModule?e:{default:e},E=d(O),v=d(R),B=L.observer(({field:e})=>{var l,u;const{FILTERS_DEBOUCE_INTERVAL_MS:h}=V.useBusinessLogic(),g=o.useMemo(()=>{var t;return C.getFetcherFunction({fetcherName:(t=e.fetchAsyncFilterOptions)==null?void 0:t.fetcher})},[(l=e.fetchAsyncFilterOptions)==null?void 0:l.fetcher]),{isLoading:F,isValidating:b,data:S,error:f}=v.default((u=e.fetchAsyncFilterOptions)==null?void 0:u.URL,g),i=F||b,{Filters:{setFilter:c,filters:m}}=k.useStores(),p=m.get(e.id),[y,a]=o.useState(p),q=o.useCallback(E.default((t,r)=>{c(t,r)},h),[c]),x=t=>{const r=`${t[0]}`;a(r),q(e.id,r)},_=()=>{a(""),c(e.id,"")},A=j.getAsyncOptions({data:S,config:e.fetchAsyncFilterOptions});return n.jsxs(s.Stack,{spacing:"xs",alignX:"stretch",children:[n.jsx(s.Button,{variant:"link",onClick:_,children:"Clear"}),n.jsx(s.ChoiceList,{title:e.label,options:A,selected:[y],onChange:t=>x(t)}),i&&n.jsx(s.Skeleton,{width:"200px",height:s.theme.sizes[5],"aria-busy":!0,"aria-label":`Loading ${e.label} filters`}),!i&&f&&n.jsxs(s.Text,{variant:"errorSmall",children:["Error: failed to load filter for ",e.label]})]})});exports.AsyncRadioFilter=B;