@veeqo/transfigure 0.0.21 → 0.0.22

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 (256) hide show
  1. package/dist/components/Filters/ActiveFilters/Variants/common/ActiveFilterFooter/ActiveFilterFooter.d.ts +6 -0
  2. package/dist/components/Filters/ActiveFilters/Variants/common/ActiveFilterFooter/index.d.ts +1 -0
  3. package/dist/components/Filters/ActiveFilters/Variants/common/ActiveFilterHeader/ActiveFilterHeader.d.ts +5 -0
  4. package/dist/components/Filters/ActiveFilters/Variants/common/ActiveFilterHeader/index.d.ts +1 -0
  5. package/dist/components/Filters/ActiveFilters/Variants/common/index.d.ts +2 -0
  6. package/dist/components/Filters/ActiveFilters/Variants/index.d.ts +3 -1
  7. package/dist/components/Filters/ActiveFilters/index.d.ts +0 -1
  8. package/dist/components/RefreshButton/RefreshButton.d.ts +2 -1
  9. package/dist/components/RefreshButton/{usePollListOrders.d.ts → usePollData.d.ts} +1 -1
  10. package/dist/components/Views/PillNotifications/constants.d.ts +25 -0
  11. package/dist/components/Views/PillNotifications/variants/DraftPill/DraftPill.d.ts +5 -0
  12. package/dist/components/Views/PillNotifications/variants/DraftPill/index.d.ts +1 -0
  13. package/dist/components/Views/PillNotifications/variants/UnsavedChangesPill/UnsavedChangesPill.d.ts +7 -0
  14. package/dist/components/Views/PillNotifications/variants/UnsavedChangesPill/index.d.ts +1 -0
  15. package/dist/components/Views/PillNotifications/variants/styled.d.ts +324 -0
  16. package/dist/components/Views/index.d.ts +1 -1
  17. package/dist/context/ModalContext/mocks/mockUseModal.d.ts +4 -4
  18. package/dist/hooks/useViewCountsHook/useViewCountsHook.d.ts +1 -1
  19. package/dist/hooks/useViews/mocks.d.ts +2 -0
  20. package/dist/hooks/useViews/useViews.d.ts +1 -2
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +121 -119
  23. package/dist/index100.cjs +1 -1
  24. package/dist/index100.js +2 -36
  25. package/dist/index101.cjs +1 -1
  26. package/dist/index101.js +36 -19
  27. package/dist/index102.cjs +1 -1
  28. package/dist/index102.js +25 -7
  29. package/dist/index103.cjs +13 -1
  30. package/dist/index103.js +16 -63
  31. package/dist/index104.cjs +1 -1
  32. package/dist/index104.js +18 -29
  33. package/dist/index105.cjs +1 -1
  34. package/dist/index105.js +8 -63
  35. package/dist/index106.cjs +1 -13
  36. package/dist/index106.js +63 -16
  37. package/dist/index107.cjs +1 -1
  38. package/dist/index107.js +30 -42
  39. package/dist/index108.cjs +1 -7
  40. package/dist/index108.js +63 -10
  41. package/dist/index109.cjs +1 -0
  42. package/dist/index109.js +49 -0
  43. package/dist/index11.cjs +1 -1
  44. package/dist/index11.js +1 -1
  45. package/dist/index110.cjs +7 -0
  46. package/dist/index110.js +12 -0
  47. package/dist/index111.cjs +1 -0
  48. package/dist/index111.js +44 -0
  49. package/dist/index12.cjs +1 -1
  50. package/dist/index12.js +1 -1
  51. package/dist/index13.cjs +1 -1
  52. package/dist/index13.js +14 -14
  53. package/dist/index14.cjs +1 -1
  54. package/dist/index14.js +36 -41
  55. package/dist/index15.cjs +1 -1
  56. package/dist/index15.js +33 -37
  57. package/dist/index16.cjs +1 -1
  58. package/dist/index16.js +49 -32
  59. package/dist/index17.cjs +1 -1
  60. package/dist/index17.js +38 -48
  61. package/dist/index18.cjs +1 -1
  62. package/dist/index18.js +27 -28
  63. package/dist/index19.cjs +1 -1
  64. package/dist/index19.js +37 -38
  65. package/dist/index2.cjs +1 -1
  66. package/dist/index2.js +2 -2
  67. package/dist/index20.cjs +1 -1
  68. package/dist/index20.js +36 -37
  69. package/dist/index21.cjs +1 -1
  70. package/dist/index21.js +20 -21
  71. package/dist/index22.cjs +1 -1
  72. package/dist/index22.js +7 -46
  73. package/dist/index23.cjs +1 -1
  74. package/dist/index23.js +12 -61
  75. package/dist/index24.cjs +1 -1
  76. package/dist/index24.js +36 -35
  77. package/dist/index25.cjs +1 -1
  78. package/dist/index25.js +55 -34
  79. package/dist/index26.cjs +1 -1
  80. package/dist/index26.js +34 -52
  81. package/dist/index27.cjs +1 -1
  82. package/dist/index27.js +54 -51
  83. package/dist/index28.cjs +1 -1
  84. package/dist/index28.js +50 -81
  85. package/dist/index29.cjs +1 -1
  86. package/dist/index29.js +80 -33
  87. package/dist/index3.cjs +1 -1
  88. package/dist/index3.js +2 -2
  89. package/dist/index30.cjs +1 -1
  90. package/dist/index30.js +37 -33
  91. package/dist/index31.cjs +1 -1
  92. package/dist/index31.js +33 -10
  93. package/dist/index32.cjs +1 -1
  94. package/dist/index32.js +10 -40
  95. package/dist/index33.cjs +1 -1
  96. package/dist/index33.js +39 -102
  97. package/dist/index34.cjs +1 -1
  98. package/dist/index34.js +103 -19
  99. package/dist/index35.cjs +1 -1
  100. package/dist/index35.js +17 -135
  101. package/dist/index36.cjs +1 -1
  102. package/dist/index36.js +135 -49
  103. package/dist/index37.cjs +1 -1
  104. package/dist/index37.js +51 -50
  105. package/dist/index38.cjs +1 -1
  106. package/dist/index38.js +31 -49
  107. package/dist/index39.cjs +1 -1
  108. package/dist/index39.js +48 -71
  109. package/dist/index4.cjs +1 -1
  110. package/dist/index4.js +2 -2
  111. package/dist/index40.cjs +1 -1
  112. package/dist/index40.js +58 -79
  113. package/dist/index41.cjs +1 -1
  114. package/dist/index41.js +81 -41
  115. package/dist/index42.cjs +1 -1
  116. package/dist/index42.js +48 -5
  117. package/dist/index43.cjs +1 -1
  118. package/dist/index43.js +5 -42
  119. package/dist/index44.cjs +1 -1
  120. package/dist/index44.js +42 -25
  121. package/dist/index45.cjs +1 -1
  122. package/dist/index45.js +30 -19
  123. package/dist/index46.cjs +1 -1
  124. package/dist/index46.js +19 -8
  125. package/dist/index47.cjs +1 -1
  126. package/dist/index47.js +7 -22
  127. package/dist/index48.cjs +1 -1
  128. package/dist/index48.js +23 -2
  129. package/dist/index49.cjs +1 -1
  130. package/dist/index49.js +2 -4
  131. package/dist/index5.cjs +1 -1
  132. package/dist/index5.js +2 -2
  133. package/dist/index50.cjs +1 -1
  134. package/dist/index50.js +4 -11
  135. package/dist/index51.cjs +1 -1
  136. package/dist/index51.js +10 -12
  137. package/dist/index52.cjs +1 -1
  138. package/dist/index52.js +12 -11
  139. package/dist/index53.cjs +1 -1
  140. package/dist/index53.js +11 -184
  141. package/dist/index54.cjs +1 -1
  142. package/dist/index54.js +183 -25
  143. package/dist/index55.cjs +1 -1
  144. package/dist/index55.js +26 -24
  145. package/dist/index56.cjs +1 -1
  146. package/dist/index56.js +19 -22
  147. package/dist/index57.cjs +1 -1
  148. package/dist/index57.js +25 -90
  149. package/dist/index58.cjs +1 -1
  150. package/dist/index58.js +93 -8
  151. package/dist/index59.cjs +1 -1
  152. package/dist/index59.js +8 -51
  153. package/dist/index6.cjs +1 -1
  154. package/dist/index6.js +4 -4
  155. package/dist/index60.cjs +1 -1
  156. package/dist/index60.js +50 -60
  157. package/dist/index61.cjs +1 -1
  158. package/dist/index61.js +61 -18
  159. package/dist/index62.cjs +1 -1
  160. package/dist/index62.js +16 -23
  161. package/dist/index63.cjs +1 -1
  162. package/dist/index63.js +25 -315
  163. package/dist/index64.cjs +1 -1
  164. package/dist/index64.js +311 -55
  165. package/dist/index65.cjs +1 -1
  166. package/dist/index65.js +50 -47
  167. package/dist/index66.cjs +1 -1
  168. package/dist/index66.js +51 -32
  169. package/dist/index67.cjs +1 -1
  170. package/dist/index67.js +30 -24
  171. package/dist/index68.cjs +1 -1
  172. package/dist/index68.js +32 -4
  173. package/dist/index69.cjs +1 -1
  174. package/dist/index69.js +4 -9
  175. package/dist/index70.cjs +1 -1
  176. package/dist/index70.js +9 -17
  177. package/dist/index71.cjs +1 -1
  178. package/dist/index71.js +14 -16
  179. package/dist/index72.cjs +1 -1
  180. package/dist/index72.js +18 -47
  181. package/dist/index73.cjs +1 -1
  182. package/dist/index73.js +48 -21
  183. package/dist/index74.cjs +1 -1
  184. package/dist/index74.js +21 -2
  185. package/dist/index75.cjs +1 -1
  186. package/dist/index75.js +2 -9
  187. package/dist/index76.cjs +1 -3
  188. package/dist/index76.js +8 -13
  189. package/dist/index77.cjs +3 -1
  190. package/dist/index77.js +13 -8
  191. package/dist/index78.cjs +1 -1
  192. package/dist/index78.js +7 -141
  193. package/dist/index79.cjs +1 -1
  194. package/dist/index79.js +142 -18
  195. package/dist/index80.cjs +1 -8
  196. package/dist/index80.js +19 -12
  197. package/dist/index81.cjs +8 -1
  198. package/dist/index81.js +12 -41
  199. package/dist/index82.cjs +1 -1
  200. package/dist/index82.js +40 -8
  201. package/dist/index83.cjs +1 -1
  202. package/dist/index83.js +9 -18
  203. package/dist/index84.cjs +1 -1
  204. package/dist/index84.js +31 -13
  205. package/dist/index85.cjs +1 -104
  206. package/dist/index85.js +27 -118
  207. package/dist/index86.cjs +1 -1
  208. package/dist/index86.js +14 -67
  209. package/dist/index87.cjs +19 -1
  210. package/dist/index87.js +24 -29
  211. package/dist/index88.cjs +1 -1
  212. package/dist/index88.js +21 -2
  213. package/dist/index89.cjs +12 -1
  214. package/dist/index89.js +16 -41
  215. package/dist/index90.cjs +80 -1
  216. package/dist/index90.js +103 -11
  217. package/dist/index91.cjs +1 -1
  218. package/dist/index91.js +13 -24
  219. package/dist/index92.cjs +100 -15
  220. package/dist/index92.js +115 -19
  221. package/dist/index93.cjs +1 -1
  222. package/dist/index93.js +65 -30
  223. package/dist/index94.cjs +1 -1
  224. package/dist/index94.js +29 -29
  225. package/dist/index95.cjs +1 -1
  226. package/dist/index95.js +2 -22
  227. package/dist/index96.cjs +1 -80
  228. package/dist/index96.js +41 -96
  229. package/dist/index97.cjs +1 -12
  230. package/dist/index97.js +11 -16
  231. package/dist/index98.cjs +1 -1
  232. package/dist/index98.js +17 -14
  233. package/dist/index99.cjs +1 -1
  234. package/dist/index99.js +24 -2
  235. package/dist/mobx/Filters/tests/Filters.arrayFilters.test.d.ts +1 -0
  236. package/dist/mobx/Filters/tests/Filters.clearOperations.test.d.ts +1 -0
  237. package/dist/mobx/Filters/tests/Filters.dateRangeFilters.test.d.ts +1 -0
  238. package/dist/mobx/Filters/tests/Filters.hasUnsavedChanges.test.d.ts +1 -0
  239. package/dist/mobx/Filters/tests/Filters.numberRangeFilters.test.d.ts +1 -0
  240. package/dist/mobx/Filters/tests/Filters.pagination.test.d.ts +1 -0
  241. package/dist/mobx/Filters/tests/Filters.textFilters.test.d.ts +1 -0
  242. package/dist/mobx/Filters/tests/Filters.urlHandling.test.d.ts +1 -0
  243. package/dist/mobx/Filters/tests/Filters.views.test.d.ts +1 -0
  244. package/dist/mobx/Notifications/Notifications.d.ts +7 -8
  245. package/dist/mobx/Notifications/Notifications.test.d.ts +1 -0
  246. package/dist/mobx/Notifications/index.d.ts +1 -0
  247. package/dist/mobx/NumberRangeFilter/NumberRangeFilter.test.d.ts +1 -0
  248. package/dist/mobx/RangeFilter/RangeFilter.test.d.ts +1 -0
  249. package/dist/mobx/Views/Views.test.d.ts +1 -0
  250. package/package.json +1 -1
  251. package/dist/components/Views/PillNotifications/InfoPill.d.ts +0 -1
  252. package/dist/components/Views/PillNotifications/styled.d.ts +0 -34
  253. package/dist/components/Views/UnsavedChanges/UnsavedChanges.d.ts +0 -5
  254. package/dist/components/Views/UnsavedChanges/index.d.ts +0 -1
  255. /package/dist/components/Filters/ActiveFilters/{ActiveFilterTag → Variants/ActiveFilterTag}/ActiveFilterTag.d.ts +0 -0
  256. /package/dist/components/Filters/ActiveFilters/{ActiveFilterTag → Variants/ActiveFilterTag}/index.d.ts +0 -0
package/dist/index31.js CHANGED
@@ -1,13 +1,36 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { observer as e } from "mobx-react";
3
- import { Stack as m } from "@veeqo/ui";
4
- import { useBusinessLogic as s } from "./index7.js";
5
- import { AdaptiveHeightContainer as p } from "./index91.js";
6
- import { FilterGroup as n } from "./index32.js";
7
- const u = e(() => {
8
- const { GROUP_MAP: t } = s();
9
- return /* @__PURE__ */ r(p, { style: { minWidth: "360px" }, children: /* @__PURE__ */ r(m, { alignX: "stretch", children: Array.from(t).map(([o, i]) => /* @__PURE__ */ r(n, { data: i }, o)) }) });
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { observer as s } from "mobx-react";
3
+ import { Dropdown as t, theme as i } from "@veeqo/ui";
4
+ import { VeeqoCommon as l } from "@veeqo/components";
5
+ import { FiltersList as d } from "./index32.js";
6
+ import { useStores as m } from "./index59.js";
7
+ const { Glyph: n } = l, b = s(() => {
8
+ const {
9
+ Filters: { isFiltersDropdownVisible: r, toggleFiltersDropdownVisible: e }
10
+ } = m();
11
+ return /* @__PURE__ */ o(
12
+ t,
13
+ {
14
+ id: "filters-dropdown",
15
+ ctaProps: {
16
+ iconSlot: /* @__PURE__ */ o(n, { name: "filter" }),
17
+ children: "Filters",
18
+ loading: !1,
19
+ // TODO needs implementing?
20
+ disabled: !1,
21
+ // TODO needs implementing?
22
+ className: "act-toggle-filter",
23
+ style: { borderRadius: i.radius.base }
24
+ },
25
+ style: {
26
+ padding: 0
27
+ },
28
+ shouldShow: r,
29
+ setShouldShow: e,
30
+ children: /* @__PURE__ */ o(d, {})
31
+ }
32
+ );
10
33
  });
11
34
  export {
12
- u as FiltersList
35
+ b as FiltersDropdown
13
36
  };
package/dist/index32.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("mobx-react"),n=require("@veeqo/ui"),c=require("@veeqo/components"),u=require("./index27.cjs"),t=require("./index46.cjs"),F=require("./index25.cjs"),a=require("./index29.cjs"),h=require("./index28.cjs"),p=require("./index26.cjs"),x=require("./index24.cjs"),y=require("./index23.cjs"),{Glyph:R}=c.VeeqoCommon,C=s.observer(({data:i})=>{const l=i.fields.filter(e=>e.filterType===t.FilterChoiceValue.TEXT||e.filterType===t.FilterChoiceValue.NUMBER),o=i.fields.filter(e=>e.filterType!==t.FilterChoiceValue.TEXT&&e.filterType!==t.FilterChoiceValue.NUMBER);return r.jsx(n.Accordion,{iconSlot:r.jsx(R,{name:"product-menu"}),label:i.label,children:r.jsxs(n.Stack,{children:[l.length>0?r.jsx(u.MultipleFieldFilter,{fields:l,groupId:i.id}):null,o.map(e=>{switch(e.filterType){case t.FilterChoiceValue.CHECKBOX:return e.fetchAsyncFilterOptions?r.jsx(y.AsyncCheckboxFilter,{field:e}):r.jsx(F.CheckboxFilter,{field:e});case t.FilterChoiceValue.RADIO:return e.fetchAsyncFilterOptions?r.jsx(x.AsyncRadioFilter,{field:e}):r.jsx(a.RadioFilter,{field:e});case t.FilterChoiceValue.DATE_RANGE:return r.jsx(p.DateRangeFilter,{field:e});case t.FilterChoiceValue.NUMBER_RANGE:return r.jsx(h.NumberRangeFilter,{field:e});default:return r.jsxs("div",{children:[e.id,": Unknown filter type: ",e.filterType]},e.id)}})]})})});exports.FilterGroup=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("mobx-react"),n=require("@veeqo/ui"),o=require("./index7.cjs"),u=require("./index99.cjs"),c=require("./index33.cjs"),a=s.observer(()=>{const{GROUP_MAP:t}=o.useBusinessLogic();return e.jsx(u.AdaptiveHeightContainer,{style:{minWidth:"360px"},children:e.jsx(n.Stack,{alignX:"stretch",children:Array.from(t).map(([r,i])=>e.jsx(c.FilterGroup,{data:i},r))})})});exports.FiltersList=a;
package/dist/index32.js CHANGED
@@ -1,43 +1,13 @@
1
- import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
- import { observer as m } from "mobx-react";
3
- import { Accordion as p, Stack as c } from "@veeqo/ui";
4
- import { VeeqoCommon as s } from "@veeqo/components";
5
- import { MultipleFieldFilter as f } from "./index27.js";
6
- import { FilterChoiceValue as t } from "./index46.js";
7
- import { CheckboxFilter as u } from "./index25.js";
8
- import { RadioFilter as F } from "./index29.js";
9
- import { NumberRangeFilter as a } from "./index28.js";
10
- import { DateRangeFilter as y } from "./index26.js";
11
- import { AsyncRadioFilter as T } from "./index24.js";
12
- import { AsyncCheckboxFilter as h } from "./index23.js";
13
- const { Glyph: R } = s, O = m(({ data: o }) => {
14
- const i = o.fields.filter(
15
- (r) => r.filterType === t.TEXT || r.filterType === t.NUMBER
16
- ), l = o.fields.filter(
17
- (r) => r.filterType !== t.TEXT && r.filterType !== t.NUMBER
18
- );
19
- return /* @__PURE__ */ e(p, { iconSlot: /* @__PURE__ */ e(R, { name: "product-menu" }), label: o.label, children: /* @__PURE__ */ n(c, { children: [
20
- i.length > 0 ? /* @__PURE__ */ e(f, { fields: i, groupId: o.id }) : null,
21
- l.map((r) => {
22
- switch (r.filterType) {
23
- case t.CHECKBOX:
24
- return r.fetchAsyncFilterOptions ? /* @__PURE__ */ e(h, { field: r }) : /* @__PURE__ */ e(u, { field: r });
25
- case t.RADIO:
26
- return r.fetchAsyncFilterOptions ? /* @__PURE__ */ e(T, { field: r }) : /* @__PURE__ */ e(F, { field: r });
27
- case t.DATE_RANGE:
28
- return /* @__PURE__ */ e(y, { field: r });
29
- case t.NUMBER_RANGE:
30
- return /* @__PURE__ */ e(a, { field: r });
31
- default:
32
- return /* @__PURE__ */ n("div", { children: [
33
- r.id,
34
- ": Unknown filter type: ",
35
- r.filterType
36
- ] }, r.id);
37
- }
38
- })
39
- ] }) });
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { observer as e } from "mobx-react";
3
+ import { Stack as m } from "@veeqo/ui";
4
+ import { useBusinessLogic as s } from "./index7.js";
5
+ import { AdaptiveHeightContainer as p } from "./index99.js";
6
+ import { FilterGroup as n } from "./index33.js";
7
+ const u = e(() => {
8
+ const { GROUP_MAP: t } = s();
9
+ return /* @__PURE__ */ r(p, { style: { minWidth: "360px" }, children: /* @__PURE__ */ r(m, { alignX: "stretch", children: Array.from(t).map(([o, i]) => /* @__PURE__ */ r(n, { data: i }, o)) }) });
40
10
  });
41
11
  export {
42
- O as FilterGroup
12
+ u as FiltersList
43
13
  };
package/dist/index33.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),a=require("react"),c=require("@veeqo/ui"),W=require("mobx-react"),Y=require("./index61.cjs"),z=require("./index59.cjs"),G=require("./index37.cjs"),J=require("./index40.cjs"),K=require("./index53.cjs"),Q=require("./index93.cjs"),X=require("./index7.cjs"),Z=require("./index58.cjs"),$=require("./index94.cjs"),b=W.observer(({view:e})=>{const{VIEW_TYPE:S,SEARCH_FILTER_ID:l}=X.useBusinessLogic(),{Filters:{activeViewId:d,initFiltersFromView:w,discardChanges:f,initFromUrl:m,filters:x,setFilter:L},Views:{draftViewsMap:T},Notifications:{notify:y}}=Z.useStores(),{viewsMap:V,defaultCustomViewId:F,isLoading:j}=z.useViews(),{isLoading:N}=Y.useCustomViews({type:S}),{viewCounts:E,isLoadingTableData:M}=Q.useViewCounts(e.id),[s,R]=a.useState(null),k=o=>{const q=x.get(l);if(V.has(o)){const n=V.get(o);n&&(w(n),f(!0),m())}else{const n=T.get(o);n?(w(n),f(!0),m()):y({type:"error",text:"Failed to load view"})}q&&L(l,q)},r=(e==null?void 0:e.id)===d,t=e.originalView!==void 0,h=e.originalView===void 0,P=E,u=(e==null?void 0:e.label)||"",A=j||N,g=a.useRef(!1);!A&&!g.current&&r&&e.id===F&&s&&(g.current=!0,s&&d===e.id&&window.requestAnimationFrame(()=>{var o;(o=s.parentElement)==null||o.scrollBy({behavior:"smooth",left:s.offsetLeft})}));const p=a.useMemo(()=>t?"draft":e.editable?"saved":"fixed",[t,e.editable]),{actions:{create:{handleSaveDraft:B},menu:{toggleDropdown:D},delete:{closeDeleteConfirmation:I,handleDelete:_,handleDeleteDraftView:C}},state:{shouldShowDeleteConfirmation:H},actions:O,state:v}=K.useDropdownManager(e),U=a.useMemo(()=>{if(h)return D;if(t)return C},[C,t,h,D]);return i.jsxs(i.Fragment,{children:[i.jsx(c.ViewTab,{colourPalette:c.theme.colors.secondary.blue,className:"act-react-listing-custom-view",active:r,id:e==null?void 0:e.id,name:u,type:p,count:M?i.jsx(c.Loader,{type:"ThreeDots",width:12,height:12,color:r?"#fff":c.theme.colors.neutral.ink.dark}):P,onClick:k,subAction:U,ariaContext:"orders",ref:R,"aria-controls":"options-dropdown","aria-expanded":v.shouldShowDropdown,"aria-haspopup":"dialog"},e==null?void 0:e.id),i.jsx($.Confirmation,{shouldShow:H,viewName:u,onCancel:I,onDelete:_}),i.jsx(G.PillNotifications,{tabType:p,isActive:r,initialViewName:u,shouldShowCreateViewNotification:t,handleSaveDraft:B}),i.jsx(J.ViewDropdowns,{referenceElement:s,tab:e,...O,...v})]})});exports.ViewTab=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("mobx-react"),n=require("@veeqo/ui"),c=require("@veeqo/components"),u=require("./index28.cjs"),t=require("./index47.cjs"),F=require("./index26.cjs"),a=require("./index30.cjs"),h=require("./index29.cjs"),p=require("./index27.cjs"),x=require("./index25.cjs"),y=require("./index24.cjs"),{Glyph:R}=c.VeeqoCommon,C=s.observer(({data:i})=>{const l=i.fields.filter(e=>e.filterType===t.FilterChoiceValue.TEXT||e.filterType===t.FilterChoiceValue.NUMBER),o=i.fields.filter(e=>e.filterType!==t.FilterChoiceValue.TEXT&&e.filterType!==t.FilterChoiceValue.NUMBER);return r.jsx(n.Accordion,{iconSlot:r.jsx(R,{name:"product-menu"}),label:i.label,children:r.jsxs(n.Stack,{children:[l.length>0?r.jsx(u.MultipleFieldFilter,{fields:l,groupId:i.id}):null,o.map(e=>{switch(e.filterType){case t.FilterChoiceValue.CHECKBOX:return e.fetchAsyncFilterOptions?r.jsx(y.AsyncCheckboxFilter,{field:e}):r.jsx(F.CheckboxFilter,{field:e});case t.FilterChoiceValue.RADIO:return e.fetchAsyncFilterOptions?r.jsx(x.AsyncRadioFilter,{field:e}):r.jsx(a.RadioFilter,{field:e});case t.FilterChoiceValue.DATE_RANGE:return r.jsx(p.DateRangeFilter,{field:e});case t.FilterChoiceValue.NUMBER_RANGE:return r.jsx(h.NumberRangeFilter,{field:e});default:return r.jsxs("div",{children:[e.id,": Unknown filter type: ",e.filterType]},e.id)}})]})})});exports.FilterGroup=C;
package/dist/index33.js CHANGED
@@ -1,106 +1,43 @@
1
- import { jsxs as W, Fragment as Y, jsx as s } from "react/jsx-runtime";
2
- import { useState as $, useRef as z, useMemo as C } from "react";
3
- import { ViewTab as G, theme as L, Loader as J } from "@veeqo/ui";
4
- import { observer as K } from "mobx-react";
5
- import { useCustomViews as Q } from "./index61.js";
6
- import { useViews as X } from "./index59.js";
7
- import { PillNotifications as Z } from "./index37.js";
8
- import { ViewDropdowns as b } from "./index40.js";
9
- import { useDropdownManager as ee } from "./index53.js";
10
- import { useViewCounts as oe } from "./index93.js";
11
- import { useBusinessLogic as ie } from "./index7.js";
12
- import { useStores as te } from "./index58.js";
13
- import { Confirmation as re } from "./index94.js";
14
- const ge = K(({ view: e }) => {
15
- const { VIEW_TYPE: S, SEARCH_FILTER_ID: l } = ie(), {
16
- Filters: { activeViewId: c, initFiltersFromView: d, discardChanges: f, initFromUrl: m, filters: T, setFilter: F },
17
- Views: { draftViewsMap: y },
18
- Notifications: { notify: x }
19
- } = te(), { viewsMap: u, defaultCustomViewId: E, isLoading: N } = X(), { isLoading: k } = Q({ type: S }), { viewCounts: A, isLoadingTableData: M } = oe(e.id), [i, R] = $(null), I = (o) => {
20
- const v = T.get(l);
21
- if (u.has(o)) {
22
- const r = u.get(o);
23
- r && (d(r), f(!0), m());
24
- } else {
25
- const r = y.get(o);
26
- r ? (d(r), f(!0), m()) : x({
27
- type: "error",
28
- text: "Failed to load view"
29
- });
30
- }
31
- v && F(l, v);
32
- }, n = (e == null ? void 0 : e.id) === c, t = e.originalView !== void 0, w = e.originalView === void 0, P = A, a = (e == null ? void 0 : e.label) || "", _ = N || k, p = z(!1);
33
- !_ && !p.current && n && e.id === E && i && (p.current = !0, i && c === e.id && window.requestAnimationFrame(() => {
34
- var o;
35
- (o = i.parentElement) == null || o.scrollBy({
36
- behavior: "smooth",
37
- left: i.offsetLeft
38
- });
39
- }));
40
- const h = C(() => t ? "draft" : e.editable ? "saved" : "fixed", [t, e.editable]), {
41
- actions: {
42
- create: { handleSaveDraft: j },
43
- menu: { toggleDropdown: V },
44
- delete: { closeDeleteConfirmation: B, handleDelete: q, handleDeleteDraftView: g }
45
- },
46
- state: { shouldShowDeleteConfirmation: H },
47
- actions: O,
48
- state: D
49
- } = ee(e), U = C(() => {
50
- if (w) return V;
51
- if (t) return g;
52
- }, [g, t, w, V]);
53
- return /* @__PURE__ */ W(Y, { children: [
54
- /* @__PURE__ */ s(
55
- G,
56
- {
57
- colourPalette: L.colors.secondary.blue,
58
- className: "act-react-listing-custom-view",
59
- active: n,
60
- id: e == null ? void 0 : e.id,
61
- name: a,
62
- type: h,
63
- count: M ? /* @__PURE__ */ s(
64
- J,
65
- {
66
- type: "ThreeDots",
67
- width: 12,
68
- height: 12,
69
- color: n ? "#fff" : L.colors.neutral.ink.dark
70
- }
71
- ) : P,
72
- onClick: I,
73
- subAction: U,
74
- ariaContext: "orders",
75
- ref: R,
76
- "aria-controls": "options-dropdown",
77
- "aria-expanded": D.shouldShowDropdown,
78
- "aria-haspopup": "dialog"
79
- },
80
- e == null ? void 0 : e.id
81
- ),
82
- /* @__PURE__ */ s(
83
- re,
84
- {
85
- shouldShow: H,
86
- viewName: a,
87
- onCancel: B,
88
- onDelete: q
1
+ import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
+ import { observer as m } from "mobx-react";
3
+ import { Accordion as p, Stack as c } from "@veeqo/ui";
4
+ import { VeeqoCommon as s } from "@veeqo/components";
5
+ import { MultipleFieldFilter as f } from "./index28.js";
6
+ import { FilterChoiceValue as t } from "./index47.js";
7
+ import { CheckboxFilter as u } from "./index26.js";
8
+ import { RadioFilter as F } from "./index30.js";
9
+ import { NumberRangeFilter as a } from "./index29.js";
10
+ import { DateRangeFilter as y } from "./index27.js";
11
+ import { AsyncRadioFilter as T } from "./index25.js";
12
+ import { AsyncCheckboxFilter as h } from "./index24.js";
13
+ const { Glyph: R } = s, O = m(({ data: o }) => {
14
+ const i = o.fields.filter(
15
+ (r) => r.filterType === t.TEXT || r.filterType === t.NUMBER
16
+ ), l = o.fields.filter(
17
+ (r) => r.filterType !== t.TEXT && r.filterType !== t.NUMBER
18
+ );
19
+ return /* @__PURE__ */ e(p, { iconSlot: /* @__PURE__ */ e(R, { name: "product-menu" }), label: o.label, children: /* @__PURE__ */ n(c, { children: [
20
+ i.length > 0 ? /* @__PURE__ */ e(f, { fields: i, groupId: o.id }) : null,
21
+ l.map((r) => {
22
+ switch (r.filterType) {
23
+ case t.CHECKBOX:
24
+ return r.fetchAsyncFilterOptions ? /* @__PURE__ */ e(h, { field: r }) : /* @__PURE__ */ e(u, { field: r });
25
+ case t.RADIO:
26
+ return r.fetchAsyncFilterOptions ? /* @__PURE__ */ e(T, { field: r }) : /* @__PURE__ */ e(F, { field: r });
27
+ case t.DATE_RANGE:
28
+ return /* @__PURE__ */ e(y, { field: r });
29
+ case t.NUMBER_RANGE:
30
+ return /* @__PURE__ */ e(a, { field: r });
31
+ default:
32
+ return /* @__PURE__ */ n("div", { children: [
33
+ r.id,
34
+ ": Unknown filter type: ",
35
+ r.filterType
36
+ ] }, r.id);
89
37
  }
90
- ),
91
- /* @__PURE__ */ s(
92
- Z,
93
- {
94
- tabType: h,
95
- isActive: n,
96
- initialViewName: a,
97
- shouldShowCreateViewNotification: t,
98
- handleSaveDraft: j
99
- }
100
- ),
101
- /* @__PURE__ */ s(b, { referenceElement: i, tab: e, ...O, ...D })
102
- ] });
38
+ })
39
+ ] }) });
103
40
  });
104
41
  export {
105
- ge as ViewTab
42
+ O as FilterGroup
106
43
  };
package/dist/index34.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("@veeqo/components"),t=require("@veeqo/ui"),r=require("./index54.cjs"),{Glyph:s}=c.VeeqoCommon,l=({hideActionsPopover:i})=>{const{duplicateView:o}=r.useDuplicateActiveView(),n=()=>{o(),i()};return e.jsx(t.Button,{style:{width:"100%"},iconSlot:e.jsx(s,{name:"add",size:"sm",color:t.theme.colors.neutral.ink.base}),variant:"flat",onClick:n,children:"Create View"})};exports.CreateView=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),c=require("react"),a=require("@veeqo/ui"),W=require("mobx-react"),Y=require("./index62.cjs"),z=require("./index60.cjs"),G=require("./index38.cjs"),J=require("./index41.cjs"),K=require("./index54.cjs"),Q=require("./index84.cjs"),X=require("./index7.cjs"),Z=require("./index59.cjs"),$=require("./index85.cjs"),b=W.observer(({view:e})=>{const{VIEW_TYPE:S,SEARCH_FILTER_ID:l}=X.useBusinessLogic(),{Filters:{activeViewId:d,initFiltersFromView:w,discardChanges:f,initFromUrl:m,filters:x,setFilter:L},Views:{draftViewsMap:y},Notifications:{notify:T}}=Z.useStores(),{viewsMap:V,defaultCustomViewId:F,isLoading:j}=z.useViews(),{isLoading:N}=Y.useCustomViews({type:S}),{viewCounts:E,isLoadingViewCounts:M}=Q.useViewCounts(e.id),[s,R]=c.useState(null),k=o=>{const q=x.get(l);if(V.has(o)){const n=V.get(o);n&&(w(n),f(!0),m())}else{const n=y.get(o);n?(w(n),f(!0),m()):T({type:"error",text:"Failed to load view"})}q&&L(l,q)},r=(e==null?void 0:e.id)===d,t=e.originalView!==void 0,h=e.originalView===void 0,P=E,u=(e==null?void 0:e.label)||"",A=j||N,g=c.useRef(!1);!A&&!g.current&&r&&e.id===F&&s&&(g.current=!0,s&&d===e.id&&window.requestAnimationFrame(()=>{var o;(o=s.parentElement)==null||o.scrollBy({behavior:"smooth",left:s.offsetLeft})}));const p=c.useMemo(()=>t?"draft":e.editable?"saved":"fixed",[t,e.editable]),{actions:{create:{handleSaveDraft:B},menu:{toggleDropdown:C},delete:{closeDeleteConfirmation:I,handleDelete:_,handleDeleteDraftView:D}},state:{shouldShowDeleteConfirmation:H},actions:O,state:v}=K.useDropdownManager(e),U=c.useMemo(()=>{if(h)return C;if(t)return D},[D,t,h,C]);return i.jsxs(i.Fragment,{children:[i.jsx(a.ViewTab,{colourPalette:a.theme.colors.secondary.blue,className:"act-react-listing-custom-view",active:r,id:e==null?void 0:e.id,name:u,type:p,count:M?i.jsx(a.Loader,{type:"ThreeDots",width:12,height:12,color:r?"#fff":a.theme.colors.neutral.ink.dark}):P,onClick:k,subAction:U,ariaContext:"orders",ref:R,"aria-controls":"options-dropdown","aria-expanded":v.shouldShowDropdown,"aria-haspopup":"dialog"},e==null?void 0:e.id),i.jsx($.Confirmation,{shouldShow:H,viewName:u,onCancel:I,onDelete:_}),i.jsx(G.PillNotifications,{tabType:p,isActive:r,initialViewName:u,shouldShowCreateViewNotification:t,handleSaveDraft:B}),i.jsx(J.ViewDropdowns,{referenceElement:s,tab:e,...O,...v})]})});exports.ViewTab=b;
package/dist/index34.js CHANGED
@@ -1,22 +1,106 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { VeeqoCommon as r } from "@veeqo/components";
3
- import { Button as n, theme as c } from "@veeqo/ui";
4
- import { useDuplicateActiveView as l } from "./index54.js";
5
- const { Glyph: m } = r, u = ({ hideActionsPopover: o }) => {
6
- const { duplicateView: t } = l(), i = () => {
7
- t(), o();
8
- };
9
- return /* @__PURE__ */ e(
10
- n,
11
- {
12
- style: { width: "100%" },
13
- iconSlot: /* @__PURE__ */ e(m, { name: "add", size: "sm", color: c.colors.neutral.ink.base }),
14
- variant: "flat",
15
- onClick: i,
16
- children: "Create View"
1
+ import { jsxs as W, Fragment as Y, jsx as s } from "react/jsx-runtime";
2
+ import { useState as $, useRef as z, useMemo as C } from "react";
3
+ import { ViewTab as G, theme as L, Loader as J } from "@veeqo/ui";
4
+ import { observer as K } from "mobx-react";
5
+ import { useCustomViews as Q } from "./index62.js";
6
+ import { useViews as X } from "./index60.js";
7
+ import { PillNotifications as Z } from "./index38.js";
8
+ import { ViewDropdowns as b } from "./index41.js";
9
+ import { useDropdownManager as ee } from "./index54.js";
10
+ import { useViewCounts as oe } from "./index84.js";
11
+ import { useBusinessLogic as ie } from "./index7.js";
12
+ import { useStores as te } from "./index59.js";
13
+ import { Confirmation as re } from "./index85.js";
14
+ const ge = K(({ view: e }) => {
15
+ const { VIEW_TYPE: S, SEARCH_FILTER_ID: l } = ie(), {
16
+ Filters: { activeViewId: c, initFiltersFromView: d, discardChanges: f, initFromUrl: m, filters: F, setFilter: T },
17
+ Views: { draftViewsMap: y },
18
+ Notifications: { notify: x }
19
+ } = te(), { viewsMap: u, defaultCustomViewId: E, isLoading: N } = X(), { isLoading: k } = Q({ type: S }), { viewCounts: A, isLoadingViewCounts: M } = oe(e.id), [i, R] = $(null), I = (o) => {
20
+ const v = F.get(l);
21
+ if (u.has(o)) {
22
+ const r = u.get(o);
23
+ r && (d(r), f(!0), m());
24
+ } else {
25
+ const r = y.get(o);
26
+ r ? (d(r), f(!0), m()) : x({
27
+ type: "error",
28
+ text: "Failed to load view"
29
+ });
17
30
  }
18
- );
19
- };
31
+ v && T(l, v);
32
+ }, n = (e == null ? void 0 : e.id) === c, t = e.originalView !== void 0, w = e.originalView === void 0, P = A, a = (e == null ? void 0 : e.label) || "", _ = N || k, p = z(!1);
33
+ !_ && !p.current && n && e.id === E && i && (p.current = !0, i && c === e.id && window.requestAnimationFrame(() => {
34
+ var o;
35
+ (o = i.parentElement) == null || o.scrollBy({
36
+ behavior: "smooth",
37
+ left: i.offsetLeft
38
+ });
39
+ }));
40
+ const h = C(() => t ? "draft" : e.editable ? "saved" : "fixed", [t, e.editable]), {
41
+ actions: {
42
+ create: { handleSaveDraft: j },
43
+ menu: { toggleDropdown: V },
44
+ delete: { closeDeleteConfirmation: B, handleDelete: q, handleDeleteDraftView: g }
45
+ },
46
+ state: { shouldShowDeleteConfirmation: H },
47
+ actions: O,
48
+ state: D
49
+ } = ee(e), U = C(() => {
50
+ if (w) return V;
51
+ if (t) return g;
52
+ }, [g, t, w, V]);
53
+ return /* @__PURE__ */ W(Y, { children: [
54
+ /* @__PURE__ */ s(
55
+ G,
56
+ {
57
+ colourPalette: L.colors.secondary.blue,
58
+ className: "act-react-listing-custom-view",
59
+ active: n,
60
+ id: e == null ? void 0 : e.id,
61
+ name: a,
62
+ type: h,
63
+ count: M ? /* @__PURE__ */ s(
64
+ J,
65
+ {
66
+ type: "ThreeDots",
67
+ width: 12,
68
+ height: 12,
69
+ color: n ? "#fff" : L.colors.neutral.ink.dark
70
+ }
71
+ ) : P,
72
+ onClick: I,
73
+ subAction: U,
74
+ ariaContext: "orders",
75
+ ref: R,
76
+ "aria-controls": "options-dropdown",
77
+ "aria-expanded": D.shouldShowDropdown,
78
+ "aria-haspopup": "dialog"
79
+ },
80
+ e == null ? void 0 : e.id
81
+ ),
82
+ /* @__PURE__ */ s(
83
+ re,
84
+ {
85
+ shouldShow: H,
86
+ viewName: a,
87
+ onCancel: B,
88
+ onDelete: q
89
+ }
90
+ ),
91
+ /* @__PURE__ */ s(
92
+ Z,
93
+ {
94
+ tabType: h,
95
+ isActive: n,
96
+ initialViewName: a,
97
+ shouldShowCreateViewNotification: t,
98
+ handleSaveDraft: j
99
+ }
100
+ ),
101
+ /* @__PURE__ */ s(b, { referenceElement: i, tab: e, ...O, ...D })
102
+ ] });
103
+ });
20
104
  export {
21
- u as CreateView
105
+ ge as ViewTab
22
106
  };
package/dist/index35.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("@veeqo/ui"),o=require("react-hook-form"),I=require("./index61.cjs"),f=require("./index42.cjs"),D=require("./index7.cjs"),d=60,_=({tab:n,viewName:w,shouldShowDropdown:v,onCloseDropdown:g,onDelete:p,onSave:x,headerText:j,e2ePrefix:a,activeOption:b})=>{const{VIEW_TYPE:C}=D.useBusinessLogic(),{canDeleteCustomViews:u,canUpdateCustomViews:r,canShareCustomViews:l,defaultCustomViewId:m}=I.useCustomViews({type:C}),S=n.id===m,{handleSubmit:y,control:c,formState:h}=o.useForm({mode:"onChange",defaultValues:{viewName:w,isDefault:n.id===m,shareOption:b.key}}),V=Object.values(f.SHARING_OPTIONS).map(s=>({key:s.key,value:s.key,label:s.text}));if(!v)return null;const k=n.originalView===void 0;return e.jsx("form",{onSubmit:y(x),children:e.jsxs(t.Card,{style:{width:"400px"},title:j,subtitle:"Active filters and sort direction will be saved in your view",onClose:g,renderFooter:()=>u||r||l?e.jsxs(t.Stack,{direction:"horizontal",alignX:"end",children:[u&&e.jsx(t.Button,{variant:"destructive",onClick:p,className:`act-react-listing-custom-view-${a}-delete`,children:"Delete"}),(r||l)&&e.jsx(t.Button,{variant:"primary",type:"submit",className:`act-react-listing-custom-view-${a}-save`,disabled:!h.isDirty&&k||h.isSubmitting,children:"Save"})]}):null,className:`act-react-listing-custom-view-${a}`,children:[!r&&e.jsx(t.Alert,{variant:"warning",title:"You need permission to edit this view",message:"This is a company shared view"}),e.jsxs(t.Stack,{children:[e.jsx(o.Controller,{name:"viewName",control:c,render:({onChange:s,value:i})=>e.jsx(t.TextField,{id:"view-name",className:`act-react-listing-custom-view-${a}-field`,label:"View name",placeholder:"View name",value:i,onChange:s,disabled:!n.editable,maxLength:d,hint:`${i.length} / ${d} characters`,required:!0})}),e.jsxs(t.Stack,{children:[e.jsx(t.Text,{variant:"inputLabel",children:"Sharing options"}),e.jsx("br",{}),e.jsx(o.Controller,{name:"shareOption",control:c,render:({onChange:s,value:i})=>e.jsx(t.SegmentedControl,{onChange:T=>l&&s(T),options:V,selected:i})})]}),e.jsx(o.Controller,{name:"isDefault",control:c,render:({onChange:s,value:i})=>e.jsx(t.Checkbox,{disabled:S,name:"makeViewDefault",label:"Make default view",checked:i,onChange:s,hint:"This will be the tab this page will always open on"})})]})]})})};exports.EditDropdown=_;exports.VIEWS_TITLE_MAX_CHAR_LIMIT=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("@veeqo/components"),t=require("@veeqo/ui"),r=require("./index55.cjs"),{Glyph:s}=c.VeeqoCommon,l=({hideActionsPopover:i})=>{const{duplicateView:o}=r.useDuplicateActiveView(),n=()=>{o(),i()};return e.jsx(t.Button,{style:{width:"100%"},iconSlot:e.jsx(s,{name:"add",size:"sm",color:t.theme.colors.neutral.ink.base}),variant:"flat",onClick:n,children:"Create View"})};exports.CreateView=l;
package/dist/index35.js CHANGED
@@ -1,140 +1,22 @@
1
- import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
- import { Card as x, Alert as O, Stack as c, TextField as _, Text as $, SegmentedControl as A, Checkbox as E, Button as w } from "@veeqo/ui";
3
- import { useForm as L, Controller as d } from "react-hook-form";
4
- import { useCustomViews as j } from "./index61.js";
5
- import { SHARING_OPTIONS as F } from "./index42.js";
6
- import { useBusinessLogic as M } from "./index7.js";
7
- const p = 60, z = ({
8
- tab: a,
9
- viewName: v,
10
- shouldShowDropdown: g,
11
- onCloseDropdown: b,
12
- onDelete: f,
13
- onSave: C,
14
- headerText: y,
15
- e2ePrefix: n,
16
- activeOption: S
17
- }) => {
18
- const { VIEW_TYPE: V } = M(), { canDeleteCustomViews: m, canUpdateCustomViews: o, canShareCustomViews: r, defaultCustomViewId: u } = j({
19
- type: V
20
- }), k = a.id === u, { handleSubmit: D, control: l, formState: h } = L({
21
- mode: "onChange",
22
- defaultValues: {
23
- viewName: v,
24
- isDefault: a.id === u,
25
- shareOption: S.key
26
- }
27
- }), T = Object.values(F).map((t) => ({
28
- key: t.key,
29
- value: t.key,
30
- label: t.text
31
- }));
32
- if (!g) return null;
33
- const I = a.originalView === void 0;
34
- return /* @__PURE__ */ e("form", { onSubmit: D(C), children: /* @__PURE__ */ s(
35
- x,
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { VeeqoCommon as r } from "@veeqo/components";
3
+ import { Button as n, theme as c } from "@veeqo/ui";
4
+ import { useDuplicateActiveView as l } from "./index55.js";
5
+ const { Glyph: m } = r, u = ({ hideActionsPopover: o }) => {
6
+ const { duplicateView: t } = l(), i = () => {
7
+ t(), o();
8
+ };
9
+ return /* @__PURE__ */ e(
10
+ n,
36
11
  {
37
- style: { width: "400px" },
38
- title: y,
39
- subtitle: "Active filters and sort direction will be saved in your view",
40
- onClose: b,
41
- renderFooter: () => m || o || r ? /* @__PURE__ */ s(c, { direction: "horizontal", alignX: "end", children: [
42
- m && /* @__PURE__ */ e(
43
- w,
44
- {
45
- variant: "destructive",
46
- onClick: f,
47
- className: `act-react-listing-custom-view-${n}-delete`,
48
- children: "Delete"
49
- }
50
- ),
51
- (o || r) && /* @__PURE__ */ e(
52
- w,
53
- {
54
- variant: "primary",
55
- type: "submit",
56
- className: `act-react-listing-custom-view-${n}-save`,
57
- disabled: !h.isDirty && I || h.isSubmitting,
58
- children: "Save"
59
- }
60
- )
61
- ] }) : null,
62
- className: `act-react-listing-custom-view-${n}`,
63
- children: [
64
- !o && /* @__PURE__ */ e(
65
- O,
66
- {
67
- variant: "warning",
68
- title: "You need permission to edit this view",
69
- message: "This is a company shared view"
70
- }
71
- ),
72
- /* @__PURE__ */ s(c, { children: [
73
- /* @__PURE__ */ e(
74
- d,
75
- {
76
- name: "viewName",
77
- control: l,
78
- render: ({ onChange: t, value: i }) => /* @__PURE__ */ e(
79
- _,
80
- {
81
- id: "view-name",
82
- className: `act-react-listing-custom-view-${n}-field`,
83
- label: "View name",
84
- placeholder: "View name",
85
- value: i,
86
- onChange: t,
87
- disabled: !a.editable,
88
- maxLength: p,
89
- hint: `${i.length} / ${p} characters`,
90
- required: !0
91
- }
92
- )
93
- }
94
- ),
95
- /* @__PURE__ */ s(c, { children: [
96
- /* @__PURE__ */ e($, { variant: "inputLabel", children: "Sharing options" }),
97
- /* @__PURE__ */ e("br", {}),
98
- /* @__PURE__ */ e(
99
- d,
100
- {
101
- name: "shareOption",
102
- control: l,
103
- render: ({ onChange: t, value: i }) => /* @__PURE__ */ e(
104
- A,
105
- {
106
- onChange: (N) => r && t(N),
107
- options: T,
108
- selected: i
109
- }
110
- )
111
- }
112
- )
113
- ] }),
114
- /* @__PURE__ */ e(
115
- d,
116
- {
117
- name: "isDefault",
118
- control: l,
119
- render: ({ onChange: t, value: i }) => /* @__PURE__ */ e(
120
- E,
121
- {
122
- disabled: k,
123
- name: "makeViewDefault",
124
- label: "Make default view",
125
- checked: i,
126
- onChange: t,
127
- hint: "This will be the tab this page will always open on"
128
- }
129
- )
130
- }
131
- )
132
- ] })
133
- ]
12
+ style: { width: "100%" },
13
+ iconSlot: /* @__PURE__ */ e(m, { name: "add", size: "sm", color: c.colors.neutral.ink.base }),
14
+ variant: "flat",
15
+ onClick: i,
16
+ children: "Create View"
134
17
  }
135
- ) });
18
+ );
136
19
  };
137
20
  export {
138
- z as EditDropdown,
139
- p as VIEWS_TITLE_MAX_CHAR_LIMIT
21
+ u as CreateView
140
22
  };
package/dist/index36.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index92.cjs"),g=require("./index49.cjs"),j=require("./index48.cjs"),M=({tab:i,onMakeDefault:l,onEdit:n,onDuplicate:s,onDelete:o,shouldShowDropdown:a,handleCloseDropdown:c})=>{const{openModal:r}=g.useModal(),d=()=>{r(j.ModalId.ORDERS_TABLE_MANAGEMENT),c()},m=i.label!=="Picking In Progress"&&i.editable,u=i.default!==!1&&i.editable,p=i.editable,b=i.editable;return a?e.jsxs(t.MenuItems,{children:[u&&e.jsx(t.Item,{onClick:l,className:"act-react-listing-custom-view-make-default-menu-item",children:"Make default view"}),b&&e.jsx(t.Item,{onClick:n,className:"act-react-listing-custom-view-edit-menu-item",role:"option",children:"Edit"}),e.jsx(t.Item,{onClick:s,className:"act-react-listing-custom-view-duplicate-menu-item",role:"option",children:"Duplicate"}),m&&e.jsx(t.Item,{onClick:o,className:"act-react-listing-custom-view-delete-menu-item",role:"option",children:"Delete"}),p&&e.jsxs(e.Fragment,{children:[e.jsx(t.Divider,{}),e.jsx(t.Item,{onClick:d,role:"option",children:"Table management"})]})]}):null};exports.OptionsDropdown=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("@veeqo/ui"),o=require("react-hook-form"),I=require("./index62.cjs"),f=require("./index43.cjs"),D=require("./index7.cjs"),d=60,_=({tab:n,viewName:w,shouldShowDropdown:p,onCloseDropdown:v,onDelete:g,onSave:x,headerText:j,e2ePrefix:a,activeOption:C})=>{const{VIEW_TYPE:S}=D.useBusinessLogic(),{canDeleteCustomViews:u,canUpdateCustomViews:r,canShareCustomViews:l,defaultCustomViewId:m}=I.useCustomViews({type:S}),b=n.id===m,{handleSubmit:y,control:c,formState:h}=o.useForm({mode:"onChange",defaultValues:{viewName:w,isDefault:n.id===m,shareOption:C.key}}),V=Object.values(f.SHARING_OPTIONS).map(s=>({key:s.key,value:s.key,label:s.text}));if(!p)return null;const k=n.originalView===void 0;return e.jsx("form",{onSubmit:y(x),children:e.jsxs(t.Card,{style:{width:"400px"},title:j,subtitle:"Any filters you've applied and your chosen sort direction will be stored in this view",onClose:v,renderFooter:()=>u||r||l?e.jsxs(t.Stack,{direction:"horizontal",alignX:"end",children:[u&&e.jsx(t.Button,{variant:"destructive",onClick:g,className:`act-react-listing-custom-view-${a}-delete`,children:"Delete"}),(r||l)&&e.jsx(t.Button,{variant:"primary",type:"submit",className:`act-react-listing-custom-view-${a}-save`,disabled:!h.isDirty&&k||h.isSubmitting,children:"Save"})]}):null,className:`act-react-listing-custom-view-${a}`,children:[!r&&e.jsx(t.Alert,{variant:"warning",title:"You need permission to edit this view",message:"This is a company shared view"}),e.jsxs(t.Stack,{alignX:"stretch",children:[e.jsx(o.Controller,{name:"viewName",control:c,render:({onChange:s,value:i})=>e.jsx(t.TextField,{id:"view-name",className:`act-react-listing-custom-view-${a}-field`,label:"View name",placeholder:"View name",value:i,onChange:s,disabled:!n.editable,maxLength:d,hint:`${i.length} / ${d} characters`,required:!0})}),e.jsxs(t.Stack,{children:[e.jsx(t.Text,{variant:"inputLabel",children:"Sharing options"}),e.jsx(o.Controller,{name:"shareOption",control:c,render:({onChange:s,value:i})=>e.jsx(t.SegmentedControl,{onChange:T=>l&&s(T),options:V,selected:i})})]}),e.jsx(o.Controller,{name:"isDefault",control:c,render:({onChange:s,value:i})=>e.jsx(t.Checkbox,{disabled:b,name:"makeViewDefault",label:"Make default view",checked:i,onChange:s,hint:"This will be the view this page will always open on"})})]})]})})};exports.EditDropdown=_;exports.VIEWS_TITLE_MAX_CHAR_LIMIT=d;