@veeqo/transfigure 2.2.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/dist/api/types.d.ts +4 -0
  2. package/dist/constants/viewConstants.d.ts +2 -0
  3. package/dist/hooks/index.d.ts +1 -0
  4. package/dist/hooks/useCreateEmptyDraftView/index.d.ts +1 -0
  5. package/dist/hooks/useCreateEmptyDraftView/useCreateEmptyDraftView.d.ts +3 -0
  6. package/dist/hooks/usePersistUnsavedChanges/usePersistUnsavedChanges.d.ts +1 -0
  7. package/dist/index.cjs +1 -1
  8. package/dist/index.js +72 -70
  9. package/dist/index100.cjs +1 -1
  10. package/dist/index100.js +9 -48
  11. package/dist/index101.cjs +1 -1
  12. package/dist/index101.js +8 -28
  13. package/dist/index102.cjs +1 -1
  14. package/dist/index102.js +48 -19
  15. package/dist/index103.cjs +1 -19
  16. package/dist/index103.js +28 -23
  17. package/dist/index104.cjs +19 -1
  18. package/dist/index104.js +23 -17
  19. package/dist/index105.cjs +1 -1
  20. package/dist/index105.js +15 -7
  21. package/dist/index106.cjs +1 -12
  22. package/dist/index106.js +18 -16
  23. package/dist/index107.cjs +12 -1
  24. package/dist/index107.js +16 -24
  25. package/dist/index108.cjs +1 -80
  26. package/dist/index108.js +21 -98
  27. package/dist/index109.cjs +1 -1
  28. package/dist/index109.js +23 -18
  29. package/dist/index11.cjs +1 -1
  30. package/dist/index11.js +1 -1
  31. package/dist/index110.cjs +80 -1
  32. package/dist/index110.js +98 -8
  33. package/dist/index111.cjs +1 -1
  34. package/dist/index111.js +17 -59
  35. package/dist/index112.cjs +1 -1
  36. package/dist/index112.js +7 -29
  37. package/dist/index113.cjs +1 -13
  38. package/dist/index113.js +60 -16
  39. package/dist/index114.cjs +1 -1
  40. package/dist/index114.js +30 -2
  41. package/dist/index115.cjs +13 -1
  42. package/dist/index115.js +15 -24
  43. package/dist/index116.cjs +1 -1
  44. package/dist/index116.js +2 -36
  45. package/dist/index117.cjs +1 -1
  46. package/dist/index117.js +36 -5
  47. package/dist/index118.cjs +1 -1
  48. package/dist/index118.js +25 -62
  49. package/dist/index119.cjs +1 -7
  50. package/dist/index119.js +5 -10
  51. package/dist/index120.cjs +7 -1
  52. package/dist/index120.js +10 -47
  53. package/dist/index121.cjs +1 -0
  54. package/dist/index121.js +65 -0
  55. package/dist/index122.cjs +1 -0
  56. package/dist/index122.js +49 -0
  57. package/dist/index13.cjs +1 -1
  58. package/dist/index13.js +2 -2
  59. package/dist/index14.cjs +1 -1
  60. package/dist/index14.js +1 -1
  61. package/dist/index15.cjs +1 -1
  62. package/dist/index15.js +1 -1
  63. package/dist/index16.cjs +1 -1
  64. package/dist/index16.js +1 -1
  65. package/dist/index17.cjs +1 -1
  66. package/dist/index17.js +1 -1
  67. package/dist/index19.cjs +1 -1
  68. package/dist/index19.js +4 -4
  69. package/dist/index20.cjs +1 -1
  70. package/dist/index20.js +3 -3
  71. package/dist/index21.cjs +1 -1
  72. package/dist/index21.js +2 -2
  73. package/dist/index22.cjs +1 -1
  74. package/dist/index22.js +3 -3
  75. package/dist/index23.cjs +1 -1
  76. package/dist/index23.js +2 -2
  77. package/dist/index26.cjs +1 -1
  78. package/dist/index26.js +3 -3
  79. package/dist/index27.cjs +1 -1
  80. package/dist/index27.js +3 -3
  81. package/dist/index28.cjs +1 -1
  82. package/dist/index28.js +1 -1
  83. package/dist/index29.cjs +1 -1
  84. package/dist/index29.js +2 -2
  85. package/dist/index30.cjs +1 -1
  86. package/dist/index30.js +2 -2
  87. package/dist/index31.cjs +1 -1
  88. package/dist/index31.js +3 -3
  89. package/dist/index32.cjs +1 -1
  90. package/dist/index32.js +1 -1
  91. package/dist/index33.cjs +1 -1
  92. package/dist/index33.js +1 -1
  93. package/dist/index34.cjs +1 -1
  94. package/dist/index34.js +1 -1
  95. package/dist/index36.cjs +1 -1
  96. package/dist/index36.js +35 -35
  97. package/dist/index37.cjs +1 -1
  98. package/dist/index37.js +10 -10
  99. package/dist/index38.cjs +1 -1
  100. package/dist/index38.js +40 -37
  101. package/dist/index39.cjs +1 -1
  102. package/dist/index39.js +1 -1
  103. package/dist/index40.cjs +1 -1
  104. package/dist/index40.js +3 -3
  105. package/dist/index41.cjs +1 -1
  106. package/dist/index41.js +4 -4
  107. package/dist/index42.cjs +1 -1
  108. package/dist/index42.js +2 -2
  109. package/dist/index44.cjs +1 -1
  110. package/dist/index44.js +4 -4
  111. package/dist/index46.cjs +1 -1
  112. package/dist/index46.js +3 -3
  113. package/dist/index47.cjs +1 -1
  114. package/dist/index47.js +1 -1
  115. package/dist/index57.cjs +1 -1
  116. package/dist/index57.js +33 -33
  117. package/dist/index58.cjs +1 -1
  118. package/dist/index58.js +2 -2
  119. package/dist/index59.cjs +1 -1
  120. package/dist/index59.js +10 -23
  121. package/dist/index60.cjs +1 -1
  122. package/dist/index60.js +19 -22
  123. package/dist/index61.cjs +1 -1
  124. package/dist/index61.js +25 -97
  125. package/dist/index62.cjs +1 -1
  126. package/dist/index62.js +97 -8
  127. package/dist/index63.cjs +1 -1
  128. package/dist/index63.js +8 -33
  129. package/dist/index64.cjs +1 -1
  130. package/dist/index64.js +33 -63
  131. package/dist/index65.cjs +1 -1
  132. package/dist/index65.js +59 -19
  133. package/dist/index66.cjs +1 -1
  134. package/dist/index66.js +23 -18
  135. package/dist/index67.cjs +1 -1
  136. package/dist/index67.js +16 -29
  137. package/dist/index68.cjs +1 -1
  138. package/dist/index68.js +30 -59
  139. package/dist/index69.cjs +1 -1
  140. package/dist/index69.js +61 -349
  141. package/dist/index7.cjs +1 -1
  142. package/dist/index7.js +4 -4
  143. package/dist/index70.cjs +1 -1
  144. package/dist/index70.js +372 -53
  145. package/dist/index71.cjs +1 -1
  146. package/dist/index71.js +48 -47
  147. package/dist/index72.cjs +1 -1
  148. package/dist/index72.js +51 -32
  149. package/dist/index73.cjs +1 -1
  150. package/dist/index73.js +40 -24
  151. package/dist/index74.cjs +1 -1
  152. package/dist/index74.js +26 -32
  153. package/dist/index75.cjs +1 -1
  154. package/dist/index75.js +38 -4
  155. package/dist/index76.cjs +1 -1
  156. package/dist/index76.js +4 -13
  157. package/dist/index77.cjs +1 -1
  158. package/dist/index77.js +12 -16
  159. package/dist/index78.cjs +1 -1
  160. package/dist/index78.js +14 -16
  161. package/dist/index79.cjs +1 -1
  162. package/dist/index79.js +18 -65
  163. package/dist/index80.cjs +1 -1
  164. package/dist/index80.js +66 -24
  165. package/dist/index81.cjs +1 -1
  166. package/dist/index81.js +24 -21
  167. package/dist/index82.cjs +1 -1
  168. package/dist/index82.js +19 -6
  169. package/dist/index83.cjs +1 -1
  170. package/dist/index83.js +7 -2
  171. package/dist/index84.cjs +1 -1
  172. package/dist/index84.js +2 -9
  173. package/dist/index85.cjs +1 -3
  174. package/dist/index85.js +8 -13
  175. package/dist/index86.cjs +3 -1
  176. package/dist/index86.js +13 -8
  177. package/dist/index87.cjs +1 -1
  178. package/dist/index87.js +7 -115
  179. package/dist/index88.cjs +1 -1
  180. package/dist/index88.js +2 -2
  181. package/dist/index90.cjs +1 -1
  182. package/dist/index90.js +117 -2
  183. package/dist/index91.cjs +1 -1
  184. package/dist/index91.js +2 -5
  185. package/dist/index92.cjs +1 -1
  186. package/dist/index92.js +5 -13
  187. package/dist/index93.cjs +1 -104
  188. package/dist/index93.js +12 -119
  189. package/dist/index94.cjs +1 -1
  190. package/dist/index94.js +13 -68
  191. package/dist/index95.cjs +104 -1
  192. package/dist/index95.js +118 -27
  193. package/dist/index96.cjs +1 -1
  194. package/dist/index96.js +68 -2
  195. package/dist/index97.cjs +1 -1
  196. package/dist/index97.js +26 -39
  197. package/dist/index98.cjs +1 -1
  198. package/dist/index98.js +2 -11
  199. package/dist/index99.cjs +1 -1
  200. package/dist/index99.js +40 -14
  201. package/dist/mobx/Filters/Filters.d.ts +12 -1
  202. package/dist/mobx/Views/Views.d.ts +1 -0
  203. package/dist/storybookHelpers/StoryWrapper.d.ts +1 -1
  204. package/dist/utils/createEmptyTransformedView/createEmptyTransformedView.d.ts +6 -0
  205. package/dist/utils/createEmptyTransformedView/createEmptyTransformedView.test.d.ts +1 -0
  206. package/dist/utils/createEmptyTransformedView/index.d.ts +1 -0
  207. package/dist/utils/index.d.ts +1 -1
  208. package/dist/utils/sortUtils/index.d.ts +2 -0
  209. package/dist/utils/sortUtils/sortUtils.d.ts +11 -0
  210. package/dist/utils/sortUtils/sortUtils.test.d.ts +1 -0
  211. package/package.json +1 -1
  212. package/dist/utils/createAllView/createAllView.d.ts +0 -3
  213. package/dist/utils/createAllView/index.d.ts +0 -1
  214. /package/dist/{utils/createAllView/createAllView.test.d.ts → hooks/useCreateEmptyDraftView/useCreateEmptyDraftView.test.d.ts} +0 -0
package/dist/index36.js CHANGED
@@ -1,57 +1,57 @@
1
1
  import { jsxs as H, Fragment as U, jsx as s } from "react/jsx-runtime";
2
- import { useState as $, useRef as z, useMemo as S } from "react";
2
+ import { useState as $, useRef as z, useMemo as L } from "react";
3
3
  import { ViewTab as G, Loader as J, theme as K } from "@veeqo/ui";
4
4
  import { observer as Q } from "mobx-react";
5
- import { useCustomViews as X } from "./index66.js";
6
- import { useViews as Z } from "./index63.js";
5
+ import { useCustomViews as X } from "./index67.js";
6
+ import { useViews as Z } from "./index64.js";
7
7
  import { PillNotifications as b } from "./index40.js";
8
8
  import { ViewDropdowns as ee } from "./index43.js";
9
9
  import { useDropdownManager as oe } from "./index57.js";
10
- import { useViewCounts as ie } from "./index100.js";
10
+ import { useViewCounts as ie } from "./index102.js";
11
11
  import { useBusinessLogic as te } from "./index8.js";
12
- import { useStores as re } from "./index62.js";
13
- import { Confirmation as se } from "./index101.js";
14
- const ve = Q(({ view: e }) => {
15
- const { VIEW_TYPE: L, IS_VIEWS_READONLY: n, SEARCH_FILTER_ID: c } = te(), {
16
- Filters: { activeViewId: d, initFiltersFromView: f, discardChanges: m, initFromUrl: u, filters: T, setFilter: x },
17
- Views: { draftViewsMap: E },
12
+ import { useStores as re } from "./index63.js";
13
+ import { Confirmation as se } from "./index103.js";
14
+ const Ce = Q(({ view: e }) => {
15
+ const { VIEW_TYPE: T, IS_VIEWS_READONLY: n, SEARCH_FILTER_ID: c } = te(), {
16
+ Filters: { activeViewId: d, initFiltersFromView: f, discardChanges: m, initFromUrl: u, filters: x, setFilter: E },
17
+ Views: { draftViewsMap: w },
18
18
  Notifications: { notify: F }
19
- } = re(), { viewsMap: w, defaultCustomViewId: y, isLoading: N } = Z(), { isLoading: A } = X({ type: L }), { viewCounts: I, isLoadingViewCounts: R } = ie(e.id), [i, _] = $(null), k = (o) => {
20
- const D = T.get(c);
21
- if (w.has(o)) {
22
- const r = w.get(o);
19
+ } = re(), { viewsMap: p, defaultCustomViewId: y, isLoading: N } = Z(), { isLoading: A } = X({ type: T }), { viewCounts: I, isLoadingViewCounts: R } = ie(e.id), [t, _] = $(null), k = (i) => {
20
+ const S = x.get(c);
21
+ if (p.has(i)) {
22
+ const r = p.get(i);
23
23
  r && (f(r), m(!0), u());
24
24
  } else {
25
- const r = E.get(o);
25
+ const r = w.get(i);
26
26
  r ? (f(r), m(!0), u()) : F({
27
27
  type: "error",
28
28
  text: "Failed to load view"
29
29
  });
30
30
  }
31
- D && x(c, D);
32
- }, a = (e == null ? void 0 : e.id) === d, t = e.originalView !== void 0, p = e.originalView === void 0, M = I, l = (e == null ? void 0 : e.label) || "", P = N || A, V = z(!1);
33
- !P && !V.current && a && e.id === y && i && (V.current = !0, i && d === e.id && window.requestAnimationFrame(() => {
34
- var o;
35
- (o = i.parentElement) == null || o.scrollBy({
31
+ S && E(c, S);
32
+ }, a = (e == null ? void 0 : e.id) === d, o = w.has(e.id), h = !o, M = I, l = (e == null ? void 0 : e.label) || "", P = N || A, V = z(!1);
33
+ !P && !V.current && a && e.id === y && t && (V.current = !0, t && d === e.id && window.requestAnimationFrame(() => {
34
+ var i;
35
+ (i = t.parentElement) == null || i.scrollBy({
36
36
  behavior: "smooth",
37
- left: i.offsetLeft
37
+ left: t.offsetLeft
38
38
  });
39
39
  }));
40
- const h = S(() => t ? "draft" : e.editable ? "saved" : "fixed", [t, e.editable]), {
40
+ const g = L(() => o ? "draft" : e.editable ? "saved" : "fixed", [o, e.editable]), {
41
41
  actions: {
42
42
  create: { handleSaveDraft: j },
43
- menu: { toggleDropdown: g },
44
- delete: { closeDeleteConfirmation: B, handleDelete: O, handleDeleteDraftView: v }
43
+ menu: { toggleDropdown: C },
44
+ delete: { closeDeleteConfirmation: B, handleDelete: O, handleDeleteDraftView: D }
45
45
  },
46
46
  state: { shouldShowDeleteConfirmation: W },
47
47
  actions: Y,
48
- state: C
49
- } = oe(e), q = S(() => {
48
+ state: v
49
+ } = oe(e), q = L(() => {
50
50
  if (!n) {
51
- if (p) return g;
52
- if (t) return v;
51
+ if (h) return C;
52
+ if (o) return D;
53
53
  }
54
- }, [v, t, p, g, n]);
54
+ }, [D, o, h, C, n]);
55
55
  return /* @__PURE__ */ H(U, { children: [
56
56
  /* @__PURE__ */ s(
57
57
  G,
@@ -62,7 +62,7 @@ const ve = Q(({ view: e }) => {
62
62
  active: a,
63
63
  id: e == null ? void 0 : e.id,
64
64
  name: l,
65
- type: n ? void 0 : h,
65
+ type: n ? void 0 : g,
66
66
  count: R ? /* @__PURE__ */ s(
67
67
  J,
68
68
  {
@@ -77,7 +77,7 @@ const ve = Q(({ view: e }) => {
77
77
  ariaContext: "orders",
78
78
  ref: _,
79
79
  "aria-controls": "options-dropdown",
80
- "aria-expanded": C.shouldShowDropdown,
80
+ "aria-expanded": v.shouldShowDropdown,
81
81
  "aria-haspopup": "dialog"
82
82
  },
83
83
  e == null ? void 0 : e.id
@@ -94,16 +94,16 @@ const ve = Q(({ view: e }) => {
94
94
  /* @__PURE__ */ s(
95
95
  b,
96
96
  {
97
- tabType: h,
97
+ tabType: g,
98
98
  isActive: a,
99
99
  initialViewName: l,
100
- shouldShowCreateViewNotification: t,
100
+ shouldShowCreateViewNotification: o,
101
101
  handleSaveDraft: j
102
102
  }
103
103
  ),
104
- !n && /* @__PURE__ */ s(ee, { referenceElement: i, tab: e, ...Y, ...C })
104
+ !n && /* @__PURE__ */ s(ee, { referenceElement: t, tab: e, ...Y, ...v })
105
105
  ] });
106
106
  });
107
107
  export {
108
- ve as ViewTab
108
+ Ce as ViewTab
109
109
  };
package/dist/index37.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("@veeqo/ui"),r=require("./index58.cjs"),n=({hideActionsPopover:i})=>{const{duplicateView:s}=r.useDuplicateActiveView(),c=()=>{s(),i()};return t.jsx(e.Button,{style:{width:"100%"},iconSlot:t.jsx(e.AddIcon,{width:e.theme.sizes.sm,height:e.theme.sizes.sm,color:e.theme.colors.neutral.ink.base}),variant:"flat",onClick:c,children:"Create View"})};exports.CreateView=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("@veeqo/ui"),n=require("./index59.cjs"),o=({hideActionsPopover:r})=>{const{createEmptyDraftView:i}=n.useCreateEmptyDraftView(),s=()=>{i(),r()};return t.jsx(e.Button,{style:{width:"100%"},iconSlot:t.jsx(e.AddIcon,{width:e.theme.sizes.sm,height:e.theme.sizes.sm,color:e.theme.colors.neutral.ink.base}),variant:"flat",onClick:s,children:"Create View"})};exports.CreateView=o;
package/dist/index37.js CHANGED
@@ -1,21 +1,21 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { Button as s, AddIcon as c, theme as e } from "@veeqo/ui";
3
- import { useDuplicateActiveView as n } from "./index58.js";
4
- const d = ({ hideActionsPopover: i }) => {
5
- const { duplicateView: o } = n(), r = () => {
6
- o(), i();
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { Button as s, AddIcon as n, theme as t } from "@veeqo/ui";
3
+ import { useCreateEmptyDraftView as a } from "./index59.js";
4
+ const h = ({ hideActionsPopover: r }) => {
5
+ const { createEmptyDraftView: o } = a(), i = () => {
6
+ o(), r();
7
7
  };
8
- return /* @__PURE__ */ t(
8
+ return /* @__PURE__ */ e(
9
9
  s,
10
10
  {
11
11
  style: { width: "100%" },
12
- iconSlot: /* @__PURE__ */ t(c, { width: e.sizes.sm, height: e.sizes.sm, color: e.colors.neutral.ink.base }),
12
+ iconSlot: /* @__PURE__ */ e(n, { width: t.sizes.sm, height: t.sizes.sm, color: t.colors.neutral.ink.base }),
13
13
  variant: "flat",
14
- onClick: r,
14
+ onClick: i,
15
15
  children: "Create View"
16
16
  }
17
17
  );
18
18
  };
19
19
  export {
20
- d as CreateView
20
+ h as CreateView
21
21
  };
package/dist/index38.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("./index66.cjs"),f=require("./index45.cjs"),D=require("./index8.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;
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("./index67.cjs"),D=require("./index45.cjs"),_=require("./index8.cjs"),q=require("./index63.cjs"),u=60,E=({tab:n,viewName:w,shouldShowDropdown:p,onCloseDropdown:v,onDelete:g,onSave:x,headerText:S,e2ePrefix:a,activeOption:j})=>{const{VIEW_TYPE:C}=_.useBusinessLogic(),{Views:{draftViewsMap:b}}=q.useStores(),{canDeleteCustomViews:d,canUpdateCustomViews:r,canShareCustomViews:l,defaultCustomViewId:m}=I.useCustomViews({type:C}),y=n.id===m,{handleSubmit:V,control:c,formState:h}=o.useForm({mode:"onChange",defaultValues:{viewName:w,isDefault:n.id===m,shareOption:j.key}}),k=Object.values(D.SHARING_OPTIONS).map(s=>({key:s.key,value:s.key,label:s.text}));if(!p)return null;const T=!b.has(n.id);return e.jsx("form",{onSubmit:V(x),children:e.jsxs(t.Card,{style:{width:"400px"},title:S,subtitle:"Any filters you've applied and your chosen sort direction will be stored in this view",onClose:v,renderFooter:()=>d||r||l?e.jsxs(t.Stack,{direction:"horizontal",alignX:"end",children:[d&&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&&T||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:u,hint:`${i.length} / ${u} 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:f=>l&&s(f),options:k,selected:i})})]}),e.jsx(o.Controller,{name:"isDefault",control:c,render:({onChange:s,value:i})=>e.jsx(t.Checkbox,{disabled:y,name:"makeViewDefault",label:"Make default view",checked:i,onChange:s,hint:"This will be the view this page will always open on"})})]})]})})};exports.EditDropdown=E;exports.VIEWS_TITLE_MAX_CHAR_LIMIT=u;
package/dist/index38.js CHANGED
@@ -1,50 +1,53 @@
1
- import { jsx as e, jsxs as a } 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 p } from "@veeqo/ui";
3
- import { useForm as L, Controller as d } from "react-hook-form";
4
- import { useCustomViews as j } from "./index66.js";
1
+ import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
+ import { Card as O, Alert as _, Stack as c, TextField as $, Text as A, SegmentedControl as E, Checkbox as L, Button as p } from "@veeqo/ui";
3
+ import { useForm as M, Controller as d } from "react-hook-form";
4
+ import { useCustomViews as j } from "./index67.js";
5
5
  import { SHARING_OPTIONS as F } from "./index45.js";
6
- import { useBusinessLogic as M } from "./index8.js";
7
- const w = 60, z = ({
8
- tab: n,
6
+ import { useBusinessLogic as X } from "./index8.js";
7
+ import { useStores as B } from "./index63.js";
8
+ const w = 60, J = ({
9
+ tab: s,
9
10
  viewName: v,
10
- shouldShowDropdown: g,
11
- onCloseDropdown: f,
11
+ shouldShowDropdown: f,
12
+ onCloseDropdown: g,
12
13
  onDelete: b,
13
14
  onSave: y,
14
15
  headerText: C,
15
- e2ePrefix: s,
16
+ e2ePrefix: a,
16
17
  activeOption: S
17
18
  }) => {
18
- const { VIEW_TYPE: V } = M(), { canDeleteCustomViews: m, canUpdateCustomViews: o, canShareCustomViews: r, defaultCustomViewId: u } = j({
19
+ const { VIEW_TYPE: V } = X(), {
20
+ Views: { draftViewsMap: k }
21
+ } = B(), { canDeleteCustomViews: m, canUpdateCustomViews: o, canShareCustomViews: r, defaultCustomViewId: u } = j({
19
22
  type: V
20
- }), k = n.id === u, { handleSubmit: D, control: l, formState: h } = L({
23
+ }), D = s.id === u, { handleSubmit: T, control: l, formState: h } = M({
21
24
  mode: "onChange",
22
25
  defaultValues: {
23
26
  viewName: v,
24
- isDefault: n.id === u,
27
+ isDefault: s.id === u,
25
28
  shareOption: S.key
26
29
  }
27
- }), T = Object.values(F).map((t) => ({
30
+ }), I = Object.values(F).map((t) => ({
28
31
  key: t.key,
29
32
  value: t.key,
30
33
  label: t.text
31
34
  }));
32
- if (!g) return null;
33
- const I = n.originalView === void 0;
34
- return /* @__PURE__ */ e("form", { onSubmit: D(y), children: /* @__PURE__ */ a(
35
- x,
35
+ if (!f) return null;
36
+ const N = !k.has(s.id);
37
+ return /* @__PURE__ */ e("form", { onSubmit: T(y), children: /* @__PURE__ */ n(
38
+ O,
36
39
  {
37
40
  style: { width: "400px" },
38
41
  title: C,
39
42
  subtitle: "Any filters you've applied and your chosen sort direction will be stored in this view",
40
- onClose: f,
41
- renderFooter: () => m || o || r ? /* @__PURE__ */ a(c, { direction: "horizontal", alignX: "end", children: [
43
+ onClose: g,
44
+ renderFooter: () => m || o || r ? /* @__PURE__ */ n(c, { direction: "horizontal", alignX: "end", children: [
42
45
  m && /* @__PURE__ */ e(
43
46
  p,
44
47
  {
45
48
  variant: "destructive",
46
49
  onClick: b,
47
- className: `act-react-listing-custom-view-${s}-delete`,
50
+ className: `act-react-listing-custom-view-${a}-delete`,
48
51
  children: "Delete"
49
52
  }
50
53
  ),
@@ -53,38 +56,38 @@ const w = 60, z = ({
53
56
  {
54
57
  variant: "primary",
55
58
  type: "submit",
56
- className: `act-react-listing-custom-view-${s}-save`,
57
- disabled: !h.isDirty && I || h.isSubmitting,
59
+ className: `act-react-listing-custom-view-${a}-save`,
60
+ disabled: !h.isDirty && N || h.isSubmitting,
58
61
  children: "Save"
59
62
  }
60
63
  )
61
64
  ] }) : null,
62
- className: `act-react-listing-custom-view-${s}`,
65
+ className: `act-react-listing-custom-view-${a}`,
63
66
  children: [
64
67
  !o && /* @__PURE__ */ e(
65
- O,
68
+ _,
66
69
  {
67
70
  variant: "warning",
68
71
  title: "You need permission to edit this view",
69
72
  message: "This is a company shared view"
70
73
  }
71
74
  ),
72
- /* @__PURE__ */ a(c, { alignX: "stretch", children: [
75
+ /* @__PURE__ */ n(c, { alignX: "stretch", children: [
73
76
  /* @__PURE__ */ e(
74
77
  d,
75
78
  {
76
79
  name: "viewName",
77
80
  control: l,
78
81
  render: ({ onChange: t, value: i }) => /* @__PURE__ */ e(
79
- _,
82
+ $,
80
83
  {
81
84
  id: "view-name",
82
- className: `act-react-listing-custom-view-${s}-field`,
85
+ className: `act-react-listing-custom-view-${a}-field`,
83
86
  label: "View name",
84
87
  placeholder: "View name",
85
88
  value: i,
86
89
  onChange: t,
87
- disabled: !n.editable,
90
+ disabled: !s.editable,
88
91
  maxLength: w,
89
92
  hint: `${i.length} / ${w} characters`,
90
93
  required: !0
@@ -92,18 +95,18 @@ const w = 60, z = ({
92
95
  )
93
96
  }
94
97
  ),
95
- /* @__PURE__ */ a(c, { children: [
96
- /* @__PURE__ */ e($, { variant: "inputLabel", children: "Sharing options" }),
98
+ /* @__PURE__ */ n(c, { children: [
99
+ /* @__PURE__ */ e(A, { variant: "inputLabel", children: "Sharing options" }),
97
100
  /* @__PURE__ */ e(
98
101
  d,
99
102
  {
100
103
  name: "shareOption",
101
104
  control: l,
102
105
  render: ({ onChange: t, value: i }) => /* @__PURE__ */ e(
103
- A,
106
+ E,
104
107
  {
105
- onChange: (N) => r && t(N),
106
- options: T,
108
+ onChange: (x) => r && t(x),
109
+ options: I,
107
110
  selected: i
108
111
  }
109
112
  )
@@ -116,9 +119,9 @@ const w = 60, z = ({
116
119
  name: "isDefault",
117
120
  control: l,
118
121
  render: ({ onChange: t, value: i }) => /* @__PURE__ */ e(
119
- E,
122
+ L,
120
123
  {
121
- disabled: k,
124
+ disabled: D,
122
125
  name: "makeViewDefault",
123
126
  label: "Make default view",
124
127
  checked: i,
@@ -134,6 +137,6 @@ const w = 60, z = ({
134
137
  ) });
135
138
  };
136
139
  export {
137
- z as EditDropdown,
140
+ J as EditDropdown,
138
141
  w as VIEWS_TITLE_MAX_CHAR_LIMIT
139
142
  };
package/dist/index39.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index103.cjs"),g=require("./index53.cjs"),j=require("./index52.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("./index104.cjs"),g=require("./index53.cjs"),j=require("./index52.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;
package/dist/index39.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsxs as t, jsx as i, Fragment as f } from "react/jsx-runtime";
2
- import { MenuItems as M, Item as l, Divider as h } from "./index103.js";
2
+ import { MenuItems as M, Item as l, Divider as h } from "./index104.js";
3
3
  import { useModal as k } from "./index53.js";
4
4
  import { ModalId as T } from "./index52.js";
5
5
  const N = ({
package/dist/index40.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),P=require("mobx-react"),g=require("./index63.cjs"),o=require("framer-motion"),m=require("./index62.cjs"),v=require("./index102.cjs"),f=require("./index42.cjs"),h=P.observer(({tabType:s,isActive:r,shouldShowCreateViewNotification:a,handleSaveDraft:i})=>{var t;const{Filters:{hasUnsavedChanges:c,discardChanges:l,activeViewId:n}}=m.useStores(),{viewsMap:u}=g.useViews(),d=n&&((t=u.get(n))==null?void 0:t.label);return e.jsxs(e.Fragment,{children:[e.jsx(o.AnimatePresence,{children:s==="draft"&&r&&a&&e.jsx(v.DraftPill,{onClick:i})}),e.jsx(o.AnimatePresence,{children:c&&r&&s==="saved"&&e.jsx(f.UnsavedChangesPill,{viewName:d,onDiscard:()=>l(),onSaveDraft:i})})]})});exports.PillNotifications=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),P=require("mobx-react"),g=require("./index64.cjs"),o=require("framer-motion"),m=require("./index63.cjs"),v=require("./index108.cjs"),f=require("./index42.cjs"),h=P.observer(({tabType:s,isActive:r,shouldShowCreateViewNotification:a,handleSaveDraft:i})=>{var t;const{Filters:{hasUnsavedChanges:c,discardChanges:l,activeViewId:n}}=m.useStores(),{viewsMap:u}=g.useViews(),d=n&&((t=u.get(n))==null?void 0:t.label);return e.jsxs(e.Fragment,{children:[e.jsx(o.AnimatePresence,{children:s==="draft"&&r&&a&&e.jsx(v.DraftPill,{onClick:i})}),e.jsx(o.AnimatePresence,{children:c&&r&&s==="saved"&&e.jsx(f.UnsavedChangesPill,{viewName:d,onDiscard:()=>l(),onSaveDraft:i})})]})});exports.PillNotifications=h;
package/dist/index40.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { jsxs as f, Fragment as p, jsx as r } from "react/jsx-runtime";
2
2
  import { observer as h } from "mobx-react";
3
- import { useViews as v } from "./index63.js";
3
+ import { useViews as v } from "./index64.js";
4
4
  import { AnimatePresence as n } from "framer-motion";
5
- import { useStores as g } from "./index62.js";
6
- import { DraftPill as w } from "./index102.js";
5
+ import { useStores as g } from "./index63.js";
6
+ import { DraftPill as w } from "./index108.js";
7
7
  import { UnsavedChangesPill as C } from "./index42.js";
8
8
  const U = h(
9
9
  ({
package/dist/index41.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),n=require("react"),m=require("./index99.cjs"),g=require("./index66.cjs"),S=require("./index63.cjs"),b=require("./index4.cjs"),y=require("./index8.cjs"),V=require("./index62.cjs"),p=require("./index12.cjs"),q=()=>{const{VIEW_TYPE:u}=y.useBusinessLogic(),{sortedCustomViews:s,isLoading:a}=S.useViews(),{mutate:c}=g.useCustomViews({type:u}),[l,t]=n.useState(s);n.useEffect(()=>{t(s)},[s]);const{Notifications:{notify:w}}=V.useStores(),d=async o=>{t(o);const r=o.map(e=>e.id);try{await b.patchCurrentUser({user_setting_attributes:{custom_view_positions:{order:r}}}),await c(e=>({...e,settings:{...e.settings,custom_view_positions:{...e.settings.custom_view_positions,order:r}}}),{revalidate:!1})}catch{t(s),w({type:"error",text:"Failed to update order of views"})}};return a||!s.length?null:i.jsx(p.ErrorBoundary,{children:i.jsx(m.LegacySortableViews,{views:l,onChange:d,className:"act-sortable-views"})})};exports.SortableViews=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),n=require("react"),m=require("./index105.cjs"),g=require("./index67.cjs"),S=require("./index64.cjs"),b=require("./index4.cjs"),y=require("./index8.cjs"),V=require("./index63.cjs"),p=require("./index12.cjs"),q=()=>{const{VIEW_TYPE:u}=y.useBusinessLogic(),{sortedCustomViews:s,isLoading:a}=S.useViews(),{mutate:c}=g.useCustomViews({type:u}),[l,t]=n.useState(s);n.useEffect(()=>{t(s)},[s]);const{Notifications:{notify:w}}=V.useStores(),d=async o=>{t(o);const r=o.map(e=>e.id);try{await b.patchCurrentUser({user_setting_attributes:{custom_view_positions:{order:r}}}),await c(e=>({...e,settings:{...e.settings,custom_view_positions:{...e.settings.custom_view_positions,order:r}}}),{revalidate:!1})}catch{t(s),w({type:"error",text:"Failed to update order of views"})}};return a||!s.length?null:i.jsx(p.ErrorBoundary,{children:i.jsx(m.LegacySortableViews,{views:l,onChange:d,className:"act-sortable-views"})})};exports.SortableViews=q;
package/dist/index41.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import { useState as f, useEffect as l } from "react";
3
- import { LegacySortableViews as w } from "./index99.js";
4
- import { useCustomViews as d } from "./index66.js";
5
- import { useViews as g } from "./index63.js";
3
+ import { LegacySortableViews as w } from "./index105.js";
4
+ import { useCustomViews as d } from "./index67.js";
5
+ import { useViews as g } from "./index64.js";
6
6
  import { patchCurrentUser as _ } from "./index4.js";
7
7
  import { useBusinessLogic as S } from "./index8.js";
8
- import { useStores as b } from "./index62.js";
8
+ import { useStores as b } from "./index63.js";
9
9
  import { ErrorBoundary as v } from "./index12.js";
10
10
  const T = () => {
11
11
  const { VIEW_TYPE: m } = S(), { sortedCustomViews: s, isLoading: a } = g(), { mutate: n } = d({ type: m }), [u, e] = f(s);
package/dist/index42.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("@veeqo/ui"),c=require("mobx-react"),l=require("./index61.cjs"),n=require("./index108.cjs"),d=i.theme.colors.secondary.blue.base,h=c.observer(({onDiscard:r,viewName:s,onSaveDraft:a})=>{const{saveChanges:o,isSubmitting:t}=l.usePersistUnsavedChanges();return e.jsx(n.Notification,{children:e.jsx(n.Container,{children:e.jsxs(i.Stack,{direction:"horizontal",alignY:"center",children:[e.jsx(i.AttentionIcon,{role:"img","aria-label":"attention",color:d}),e.jsxs(n.Wrap,{children:[e.jsx(n.Text,{variant:"body",margin:"0 4px 0 0",children:"You have unsaved changes to"}),s&&e.jsxs(n.Bold,{variant:"bodyBoldDark",children:["'",s,"'"]})]}),e.jsx(i.Button,{onClick:r,size:"sm",children:"Discard changes"}),e.jsxs(i.ActionMenu,{ctaProps:{children:"Save changes",variant:"primary"},children:[e.jsx(i.ActionMenu.Item,{onAction:a,isDisabled:t,children:e.jsx(n.Text,{variant:"body",children:"Create new view"})}),e.jsx(i.ActionMenu.Item,{onAction:o,isDisabled:t,children:e.jsxs(i.Stack,{direction:"horizontal",spacing:1,alignY:"center",children:[e.jsx(n.Text,{variant:"body",children:"Save changes to"}),e.jsx(n.Text,{variant:"bodyBold",children:s})]})})]})]})})})});exports.UnsavedChangesPill=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("@veeqo/ui"),c=require("mobx-react"),l=require("./index62.cjs"),n=require("./index110.cjs"),d=i.theme.colors.secondary.blue.base,h=c.observer(({onDiscard:r,viewName:s,onSaveDraft:a})=>{const{saveChanges:o,isSubmitting:t}=l.usePersistUnsavedChanges();return e.jsx(n.Notification,{children:e.jsx(n.Container,{children:e.jsxs(i.Stack,{direction:"horizontal",alignY:"center",children:[e.jsx(i.AttentionIcon,{role:"img","aria-label":"attention",color:d}),e.jsxs(n.Wrap,{children:[e.jsx(n.Text,{variant:"body",margin:"0 4px 0 0",children:"You have unsaved changes to"}),s&&e.jsxs(n.Bold,{variant:"bodyBoldDark",children:["'",s,"'"]})]}),e.jsx(i.Button,{onClick:r,size:"sm",children:"Discard changes"}),e.jsxs(i.ActionMenu,{ctaProps:{children:"Save changes",variant:"primary"},children:[e.jsx(i.ActionMenu.Item,{onAction:a,isDisabled:t,children:e.jsx(n.Text,{variant:"body",children:"Create new view"})}),e.jsx(i.ActionMenu.Item,{onAction:o,isDisabled:t,children:e.jsxs(i.Stack,{direction:"horizontal",spacing:1,alignY:"center",children:[e.jsx(n.Text,{variant:"body",children:"Save changes to"}),e.jsx(n.Text,{variant:"bodyBold",children:s})]})})]})]})})})});exports.UnsavedChangesPill=h;
package/dist/index42.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { jsx as n, jsxs as e } from "react/jsx-runtime";
2
2
  import { Stack as a, AttentionIcon as d, theme as h, Button as m, ActionMenu as o } from "@veeqo/ui";
3
3
  import { observer as g } from "mobx-react";
4
- import { usePersistUnsavedChanges as v } from "./index61.js";
5
- import { Notification as b, Container as p, Wrap as u, Text as i, Bold as y } from "./index108.js";
4
+ import { usePersistUnsavedChanges as v } from "./index62.js";
5
+ import { Notification as b, Container as p, Wrap as u, Text as i, Bold as y } from "./index110.js";
6
6
  const C = h.colors.secondary.blue.base, S = g(({ onDiscard: c, viewName: r, onSaveDraft: l }) => {
7
7
  const { saveChanges: s, isSubmitting: t } = v();
8
8
  return /* @__PURE__ */ n(b, { children: /* @__PURE__ */ n(p, { children: /* @__PURE__ */ e(a, { direction: "horizontal", alignY: "center", children: [
package/dist/index44.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),m=require("mobx-react"),i=require("@veeqo/ui"),u=require("./index106.cjs"),q=require("./index41.cjs"),f=require("./index63.cjs"),p=require("./index64.cjs"),v=require("./index37.cjs"),c=require("./index36.cjs"),b=require("./index8.cjs"),C=require("./index62.cjs"),a=require("./index12.cjs"),L=m.observer(({className:l,appearance:d})=>{const{IS_VIEWS_READONLY:r}=b.useBusinessLogic(),{Views:{draftViewsList:w}}=C.useStores(),{viewsArray:x,fixedViews:V}=f.useViews(),[n,o]=t.useState(!1),[h,j]=t.useState(null),S=()=>o(!1);return p.useViewUrlChange(),e.jsxs(e.Fragment,{children:[e.jsxs(i.ViewsContainer,{onClickMenu:r?void 0:()=>o(!0),ariaMenuControls:r?void 0:"views-menu",ariaMenuExpanded:r?!1:n,ref:j,className:l,appearance:d,children:[x.map(s=>e.jsx(a.ErrorBoundary,{children:e.jsx(c.ViewTab,{view:s})},s.id)),w.map(s=>e.jsx(a.ErrorBoundary,{children:e.jsx(c.ViewTab,{view:s})},s.id))]}),!r&&n&&e.jsx(i.Popover,{id:"views-menu",anchorElement:h,placement:"bottom",onShouldClose:()=>o(!1),children:e.jsxs(i.Card.Surface,{children:[e.jsx(u.FixedViews,{children:V.map(s=>e.jsx(i.Text,{variant:"placeholder",children:s.label},s.id||s.label))}),e.jsx(q.SortableViews,{}),e.jsx(u.Divider,{}),e.jsx(v.CreateView,{hideActionsPopover:S})]})})]})});exports.ViewsList=L;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),m=require("mobx-react"),i=require("@veeqo/ui"),u=require("./index107.cjs"),q=require("./index41.cjs"),f=require("./index64.cjs"),p=require("./index65.cjs"),v=require("./index37.cjs"),c=require("./index36.cjs"),b=require("./index8.cjs"),C=require("./index63.cjs"),a=require("./index12.cjs"),L=m.observer(({className:l,appearance:d})=>{const{IS_VIEWS_READONLY:r}=b.useBusinessLogic(),{Views:{draftViewsList:w}}=C.useStores(),{viewsArray:x,fixedViews:V}=f.useViews(),[n,o]=t.useState(!1),[h,j]=t.useState(null),S=()=>o(!1);return p.useViewUrlChange(),e.jsxs(e.Fragment,{children:[e.jsxs(i.ViewsContainer,{onClickMenu:r?void 0:()=>o(!0),ariaMenuControls:r?void 0:"views-menu",ariaMenuExpanded:r?!1:n,ref:j,className:l,appearance:d,children:[x.map(s=>e.jsx(a.ErrorBoundary,{children:e.jsx(c.ViewTab,{view:s})},s.id)),w.map(s=>e.jsx(a.ErrorBoundary,{children:e.jsx(c.ViewTab,{view:s})},s.id))]}),!r&&n&&e.jsx(i.Popover,{id:"views-menu",anchorElement:h,placement:"bottom",onShouldClose:()=>o(!1),children:e.jsxs(i.Card.Surface,{children:[e.jsx(u.FixedViews,{children:V.map(s=>e.jsx(i.Text,{variant:"placeholder",children:s.label},s.id||s.label))}),e.jsx(q.SortableViews,{}),e.jsx(u.Divider,{}),e.jsx(v.CreateView,{hideActionsPopover:S})]})})]})});exports.ViewsList=L;
package/dist/index44.js CHANGED
@@ -2,14 +2,14 @@ import { jsxs as s, Fragment as V, jsx as e } from "react/jsx-runtime";
2
2
  import { useState as n } from "react";
3
3
  import { observer as v } from "mobx-react";
4
4
  import { ViewsContainer as S, Popover as x, Card as C, Text as L } from "@veeqo/ui";
5
- import { FixedViews as A, Divider as E } from "./index106.js";
5
+ import { FixedViews as A, Divider as E } from "./index107.js";
6
6
  import { SortableViews as b } from "./index41.js";
7
- import { useViews as M } from "./index63.js";
8
- import { useViewUrlChange as T } from "./index64.js";
7
+ import { useViews as M } from "./index64.js";
8
+ import { useViewUrlChange as T } from "./index65.js";
9
9
  import { CreateView as g } from "./index37.js";
10
10
  import { ViewTab as m } from "./index36.js";
11
11
  import { useBusinessLogic as R } from "./index8.js";
12
- import { useStores as j } from "./index62.js";
12
+ import { useStores as j } from "./index63.js";
13
13
  import { ErrorBoundary as l } from "./index12.js";
14
14
  const q = v(({ className: a, appearance: d }) => {
15
15
  const { IS_VIEWS_READONLY: r } = R(), {
package/dist/index46.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),C=require("./index87.cjs"),i=require("@veeqo/ui"),I=require("mobx-react"),N=require("./index8.cjs"),_=require("./index53.cjs"),j=require("./index62.cjs"),O=require("./index63.cjs"),g=require("./index52.cjs"),w=I.observer(({columnDefinitions:T,pinnedRightColumnIds:a=[],pinnedLeftColumnIds:l=[]})=>{var b;const{DEFAULT_HIDDEN_COLUMNS:E,DEFAULT_VISIBLE_COLUMNS:S}=N.useBusinessLogic(),t=[...l,...a],c=E.filter(s=>!t.includes(s)),r=S.filter(s=>!t.includes(s)),A=[...c,...r],{closeModal:L,isModalOpen:f,openModal:p}=_.useModal(),{Filters:{activeViewId:n},Views:{draftViewsMap:q}}=j.useStores(),{viewsMap:x,isLoading:D}=O.useViews();if(!n||D)return null;const e=x.get(n),u=Array.isArray((b=e==null?void 0:e.columns)==null?void 0:b.columnIds),d=u?e.columns.columnIds.filter(s=>!t.includes(s)):r,h=u?A.filter(s=>!d.includes(s)):c,m=q.has(n),M=!(e!=null&&e.editable),v=M||m,B=m?"Please create a view to use table management":M?"Please choose a custom view to use table management":"Table management";return o.jsxs(o.Fragment,{children:[o.jsx(i.Tooltip,{text:B,children:o.jsx(i.Button,{"aria-label":"Open table management",onClick:()=>p(g.ModalId.ORDERS_TABLE_MANAGEMENT),size:"sm",iconSlot:o.jsx(i.ListBoardIcon,{}),disabled:v})}),f(g.ModalId.ORDERS_TABLE_MANAGEMENT)&&o.jsx(C.TableManagementModal,{pinnedRightColumnIds:a,pinnedLeftColumnIds:l,visibleColumns:d,hiddenColumns:h,columnDefinitions:T,onClose:L})]})});exports.TableManagement=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),C=require("./index90.cjs"),i=require("@veeqo/ui"),I=require("mobx-react"),N=require("./index8.cjs"),_=require("./index53.cjs"),j=require("./index63.cjs"),O=require("./index64.cjs"),g=require("./index52.cjs"),w=I.observer(({columnDefinitions:T,pinnedRightColumnIds:a=[],pinnedLeftColumnIds:l=[]})=>{var b;const{DEFAULT_HIDDEN_COLUMNS:E,DEFAULT_VISIBLE_COLUMNS:S}=N.useBusinessLogic(),t=[...l,...a],c=E.filter(s=>!t.includes(s)),r=S.filter(s=>!t.includes(s)),A=[...c,...r],{closeModal:L,isModalOpen:f,openModal:p}=_.useModal(),{Filters:{activeViewId:n},Views:{draftViewsMap:q}}=j.useStores(),{viewsMap:x,isLoading:D}=O.useViews();if(!n||D)return null;const e=x.get(n),u=Array.isArray((b=e==null?void 0:e.columns)==null?void 0:b.columnIds),d=u?e.columns.columnIds.filter(s=>!t.includes(s)):r,h=u?A.filter(s=>!d.includes(s)):c,m=q.has(n),M=!(e!=null&&e.editable),v=M||m,B=m?"Please create a view to use table management":M?"Please choose a custom view to use table management":"Table management";return o.jsxs(o.Fragment,{children:[o.jsx(i.Tooltip,{text:B,children:o.jsx(i.Button,{"aria-label":"Open table management",onClick:()=>p(g.ModalId.ORDERS_TABLE_MANAGEMENT),size:"sm",iconSlot:o.jsx(i.ListBoardIcon,{}),disabled:v})}),f(g.ModalId.ORDERS_TABLE_MANAGEMENT)&&o.jsx(C.TableManagementModal,{pinnedRightColumnIds:a,pinnedLeftColumnIds:l,visibleColumns:d,hiddenColumns:h,columnDefinitions:T,onClose:L})]})});exports.TableManagement=w;
package/dist/index46.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { jsxs as v, Fragment as B, jsx as s } from "react/jsx-runtime";
2
- import { TableManagementModal as I } from "./index87.js";
2
+ import { TableManagementModal as I } from "./index90.js";
3
3
  import { Tooltip as O, Button as w, ListBoardIcon as x } from "@veeqo/ui";
4
4
  import { observer as F } from "mobx-react";
5
5
  import { useBusinessLogic as P } from "./index8.js";
6
6
  import { useModal as U } from "./index53.js";
7
- import { useStores as y } from "./index62.js";
8
- import { useViews as R } from "./index63.js";
7
+ import { useStores as y } from "./index63.js";
8
+ import { useViews as R } from "./index64.js";
9
9
  import { ModalId as p } from "./index52.js";
10
10
  const Q = F(
11
11
  ({ columnDefinitions: f, pinnedRightColumnIds: i = [], pinnedLeftColumnIds: l = [] }) => {
package/dist/index47.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),h=require("./index88.cjs"),e=require("@veeqo/ui"),o=require("./index89.cjs"),d=require("./index62.cjs"),m=({isLoading:a,refetch:n,trackMetricClick:s,tooltipText:l="Refresh data",buttonProps:i={size:"sm",variant:"default"}})=>{const{hasChanges:r,acknowledgeButtonClick:u}=h.usePollData(),{Notifications:{notify:c}}=d.useStores(),f=async()=>{try{await n(),await u(),s==null||s()}catch{c({type:"error",text:"Failed to refresh data"})}};return t.jsxs(e.Tooltip,{className:o.default.refreshTooltip,text:l,children:[t.jsx(e.Button,{className:o.default.refreshButton,onClick:f,loading:a,disabled:a,iconSlot:t.jsx(e.RefreshIcon,{color:e.theme.colors.neutral.ink.base}),"aria-label":r?"refresh table with changes":"refresh table","aria-live":"polite",...i}),t.jsx(e.Indicator,{className:o.default.refreshIndicator,color:"red",size:"xs",style:{opacity:r?1:0}})]})};exports.RefreshButton=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),h=require("./index88.cjs"),e=require("@veeqo/ui"),o=require("./index89.cjs"),d=require("./index63.cjs"),m=({isLoading:a,refetch:n,trackMetricClick:s,tooltipText:l="Refresh data",buttonProps:i={size:"sm",variant:"default"}})=>{const{hasChanges:r,acknowledgeButtonClick:u}=h.usePollData(),{Notifications:{notify:c}}=d.useStores(),f=async()=>{try{await n(),await u(),s==null||s()}catch{c({type:"error",text:"Failed to refresh data"})}};return t.jsxs(e.Tooltip,{className:o.default.refreshTooltip,text:l,children:[t.jsx(e.Button,{className:o.default.refreshButton,onClick:f,loading:a,disabled:a,iconSlot:t.jsx(e.RefreshIcon,{color:e.theme.colors.neutral.ink.base}),"aria-label":r?"refresh table with changes":"refresh table","aria-live":"polite",...i}),t.jsx(e.Indicator,{className:o.default.refreshIndicator,color:"red",size:"xs",style:{opacity:r?1:0}})]})};exports.RefreshButton=m;
package/dist/index47.js CHANGED
@@ -2,7 +2,7 @@ import { jsxs as m, jsx as o } from "react/jsx-runtime";
2
2
  import { usePollData as c } from "./index88.js";
3
3
  import { Tooltip as d, Button as p, RefreshIcon as u, theme as y, Indicator as x } from "@veeqo/ui";
4
4
  import t from "./index89.js";
5
- import { useStores as b } from "./index62.js";
5
+ import { useStores as b } from "./index63.js";
6
6
  const j = ({
7
7
  isLoading: s,
8
8
  refetch: a,
package/dist/index57.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),f=require("./index80.cjs"),Y=require("./index79.cjs"),k=require("./index66.cjs"),G=require("./index58.cjs"),H=require("./index61.cjs"),W=require("./index63.cjs"),n=require("./index45.cjs"),N=require("./index4.cjs"),$=require("./index3.cjs"),B=require("./index8.cjs"),b=require("./index62.cjs"),j=require("./index6.cjs"),z=require("./index5.cjs"),J=e=>{const{VIEW_TYPE:u}=B.useBusinessLogic(),{duplicateView:q}=G.useDuplicateActiveView(),{getActiveViewInAPIFormat:E}=H.usePersistUnsavedChanges(),{canDeleteCustomViews:O,defaultCustomViewId:L,canUpdateCustomViews:M,mutate:x}=k.useCustomViews({type:u}),{mutate:p,viewsMap:d,viewsArray:t}=W.useViews(),[g,a]=w.useState(!1),[A,h]=w.useState(!1),[D,l]=w.useState(!1),[F,S]=w.useState(!1),{Views:{removeDraftViewById:m,draftViewsMap:R},Filters:{initFiltersFromView:r,updateUrl:c,setActiveViewId:V},Notifications:{notify:o}}=b.useStores();return{actions:{delete:{handleDeleteDraftView:()=>{if(!e.originalView)throw Error("No draft view found");m(e.id);const s=d.get(L);if(s)s&&r(s);else{const i=d.get(f.ALL_VIEW_ID);i?r(i):t!=null&&t[0]&&r(t[0])}c()},handleDelete:async()=>{try{if(O){await $.deleteCustomView(Number(e.id)),await p();const s=d.get(f.ALL_VIEW_ID);s?r(s):t!=null&&t[0]&&r(t[0]),c(),A&&h(!1),D&&l(D),o({type:"success",text:`'${e.label}' has been deleted`})}else o({type:"info",text:"You require additional user permissions to delete a company shared view"})}catch{o({type:"error",text:"Failed to delete view"})}},handleShowDeleteConfirmation:()=>{if(R.has(e.id)){m(e.id),e.originalView?V(e.originalView.id):d.has(f.ALL_VIEW_ID)?V(f.ALL_VIEW_ID):t!=null&&t[0]&&V(t[0].id);return}O?h(!0):o({type:"info",text:"You require additional user permissions to delete a company shared view"})},closeDeleteConfirmation:()=>h(!1)},edit:{handleShowEditDropdown:()=>{a(!1),l(!0)},closeEditDropdown:()=>l(!1)},menu:{handleSave:async s=>{try{const{viewName:i,shareOption:C,isDefault:y}=s,v=C==="company"?n.SHARING_OPTIONS.COMPANY:n.SHARING_OPTIONS.PERSONAL,_={attributes:{title:i,shared:v.key===n.SHARING_OPTIONS.COMPANY.key}};await z.patchCustomView(e.id,_),y&&(await N.patchCurrentUser({user_setting_attributes:{default_custom_view:{id:Number(e.id),type:u}}}),await x()),await p(),c(),o({type:"success",text:`'${i}' view updated`}),l(!1)}catch{o({type:"error",text:"Failed to save view"})}},handleDuplicate:()=>{q(),a(!1)},handleMakeDefault:async()=>{try{await N.patchCurrentUser({user_setting_attributes:{default_custom_view:{id:Number(e.id),type:u}}}),o({type:"success",text:`'${e.label}' is now your default view`}),a(!1)}catch{o({type:"error",text:"Failed to set default view"})}},openDropdown:()=>a(!0),closeDropdown:()=>a(!1),toggleDropdown:()=>a(!g)},create:{handleCreate:async s=>{try{const{viewName:i,shareOption:C,isDefault:y}=s,v=C==="company"?n.SHARING_OPTIONS.COMPANY:n.SHARING_OPTIONS.PERSONAL,{arg:_}=E(),{data:I}=await j.createCustomView({attributes:{..._,title:i,shared:v.key===n.SHARING_OPTIONS.COMPANY.key}}),P=t.map(U=>U.id);P.push(I.id),await N.patchCurrentUser({user_setting_attributes:{custom_view_positions:{order:P},...y?{default_custom_view:{id:Number(I.id),type:u}}:{}}}),await p(),m(e.id);const T=Y.viewsAdapter({view:I,canUpdateCustomViews:M});r(T),c(),S(!1),o({type:"success",text:`New view '${i}' created`})}catch(i){console.log(i),o({type:"error",text:"Failed to save draft view"})}},closeCreateDropdown:()=>S(!1),handleSaveDraft:async()=>{S(!0)}}},state:{shouldShowDropdown:g,shouldShowEditDropdown:D,shouldShowCreateDropdown:F,shouldShowDeleteConfirmation:A}}};exports.useDropdownManager=J;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),f=require("./index93.cjs"),Y=require("./index80.cjs"),k=require("./index67.cjs"),G=require("./index58.cjs"),H=require("./index62.cjs"),W=require("./index64.cjs"),r=require("./index45.cjs"),N=require("./index4.cjs"),$=require("./index3.cjs"),B=require("./index8.cjs"),b=require("./index63.cjs"),j=require("./index6.cjs"),z=require("./index5.cjs"),J=e=>{const{VIEW_TYPE:u}=B.useBusinessLogic(),{duplicateView:E}=G.useDuplicateActiveView(),{getActiveViewInAPIFormat:L}=H.usePersistUnsavedChanges(),{canDeleteCustomViews:O,defaultCustomViewId:M,canUpdateCustomViews:x,mutate:F}=k.useCustomViews({type:u}),{mutate:h,viewsMap:d,viewsArray:t}=W.useViews(),[g,a]=w.useState(!1),[A,p]=w.useState(!1),[D,l]=w.useState(!1),[R,S]=w.useState(!1),{Views:{removeDraftViewById:m,draftViewsMap:P},Filters:{initFiltersFromView:n,updateUrl:c,setActiveViewId:V},Notifications:{notify:o}}=b.useStores();return{actions:{delete:{handleDeleteDraftView:()=>{if(!P.has(e.id))throw Error("No draft view found");m(e.id);const s=d.get(M);if(s)s&&n(s);else{const i=d.get(f.ALL_VIEW_ID);i?n(i):t!=null&&t[0]&&n(t[0])}c()},handleDelete:async()=>{try{if(O){await $.deleteCustomView(Number(e.id)),await h();const s=d.get(f.ALL_VIEW_ID);s?n(s):t!=null&&t[0]&&n(t[0]),c(),A&&p(!1),D&&l(D),o({type:"success",text:`'${e.label}' has been deleted`})}else o({type:"info",text:"You require additional user permissions to delete a company shared view"})}catch{o({type:"error",text:"Failed to delete view"})}},handleShowDeleteConfirmation:()=>{if(P.has(e.id)){m(e.id),e.originalView?V(e.originalView.id):d.has(f.ALL_VIEW_ID)?V(f.ALL_VIEW_ID):t!=null&&t[0]&&V(t[0].id);return}O?p(!0):o({type:"info",text:"You require additional user permissions to delete a company shared view"})},closeDeleteConfirmation:()=>p(!1)},edit:{handleShowEditDropdown:()=>{a(!1),l(!0)},closeEditDropdown:()=>l(!1)},menu:{handleSave:async s=>{try{const{viewName:i,shareOption:C,isDefault:y}=s,v=C==="company"?r.SHARING_OPTIONS.COMPANY:r.SHARING_OPTIONS.PERSONAL,_={attributes:{title:i,shared:v.key===r.SHARING_OPTIONS.COMPANY.key}};await z.patchCustomView(e.id,_),y&&(await N.patchCurrentUser({user_setting_attributes:{default_custom_view:{id:Number(e.id),type:u}}}),await F()),await h(),c(),o({type:"success",text:`'${i}' view updated`}),l(!1)}catch{o({type:"error",text:"Failed to save view"})}},handleDuplicate:()=>{E(),a(!1)},handleMakeDefault:async()=>{try{await N.patchCurrentUser({user_setting_attributes:{default_custom_view:{id:Number(e.id),type:u}}}),o({type:"success",text:`'${e.label}' is now your default view`}),a(!1)}catch{o({type:"error",text:"Failed to set default view"})}},openDropdown:()=>a(!0),closeDropdown:()=>a(!1),toggleDropdown:()=>a(!g)},create:{handleCreate:async s=>{try{const{viewName:i,shareOption:C,isDefault:y}=s,v=C==="company"?r.SHARING_OPTIONS.COMPANY:r.SHARING_OPTIONS.PERSONAL,{arg:_}=L(),{data:I}=await j.createCustomView({attributes:{..._,title:i,shared:v.key===r.SHARING_OPTIONS.COMPANY.key}}),q=t.map(U=>U.id);q.push(I.id),await N.patchCurrentUser({user_setting_attributes:{custom_view_positions:{order:q},...y?{default_custom_view:{id:Number(I.id),type:u}}:{}}}),await h(),m(e.id);const T=Y.viewsAdapter({view:I,canUpdateCustomViews:x});n(T),c(),S(!1),o({type:"success",text:`New view '${i}' created`})}catch(i){console.log(i),o({type:"error",text:"Failed to save draft view"})}},closeCreateDropdown:()=>S(!1),handleSaveDraft:async()=>{S(!0)}}},state:{shouldShowDropdown:g,shouldShowEditDropdown:D,shouldShowCreateDropdown:R,shouldShowDeleteConfirmation:A}}};exports.useDropdownManager=J;