asma-ui-core 3.75.0 → 3.76.0

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.
@@ -2,13 +2,17 @@ declare const translations: {
2
2
  en: {
3
3
  column_reorder: string;
4
4
  column_hidden: string;
5
+ column_reorder_and_hidden: string;
5
6
  reset_order: string;
7
+ column_order_reset: string;
6
8
  column_settings: string;
7
9
  };
8
10
  no: {
9
11
  column_reorder: string;
10
12
  column_hidden: string;
13
+ column_reorder_and_hidden: string;
11
14
  reset_order: string;
15
+ column_order_reset: string;
12
16
  column_settings: string;
13
17
  };
14
18
  };
@@ -1,111 +1,114 @@
1
+ import { message as v } from "../../../../../components/feedback/snack-bar/message.js";
1
2
  import { StyledPopover as D } from "../../../../../components/utils/popover/StyledPopover.js";
2
3
  import { INTERNAL_COLUMN_IDS as S } from "../../../../types.js";
3
- import { cn as N } from "../../../../helpers/cn.js";
4
+ import { cn as _ } from "../../../../helpers/cn.js";
4
5
  import { StyledCheckbox as T } from "../../../../shared-components/StyledCheckbox.js";
5
6
  import { StyledTooltip as A } from "../../../../shared-components/tooltip/index.js";
6
7
  import { useToggleMenuVisibility as L } from "../../../../hooks/useToggleMenuVisibility.hook.js";
7
- import { PinIcon as _ } from "../../../../shared-components/PinIcon.js";
8
+ import { PinIcon as k } from "../../../../shared-components/PinIcon.js";
8
9
  import m from "./TableActions.module.js";
9
- import f from "./HeaderActionMenu.module.js";
10
- import { DotsHorizontalIcon as k } from "../../../../shared-components/DotsHorizontalIcon.js";
11
- import { useTranslations as H } from "../../../../hooks/useTranslations.js";
12
- import { StyledButton as I } from "../../../../shared-components/button/StyledButton.js";
13
- import { compact as O } from "../../../../../helpers/arrays.js";
14
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
15
- import { DndContext as R, PointerSensor as V, closestCenter as E, useSensor as M, useSensors as P } from "@dnd-kit/core";
16
- import { restrictToParentElement as w, restrictToVerticalAxis as z } from "@dnd-kit/modifiers";
17
- import { SortableContext as W, arrayMove as j, useSortable as U, verticalListSortingStrategy as B } from "@dnd-kit/sortable";
18
- import { CSS as Y } from "@dnd-kit/utilities";
19
- function $({ id: n, disabled: p, children: u }) {
20
- const { attributes: d, listeners: h, setNodeRef: b, transform: g, transition: s } = U({
10
+ import d from "./HeaderActionMenu.module.js";
11
+ import { DotsHorizontalIcon as H } from "../../../../shared-components/DotsHorizontalIcon.js";
12
+ import { useTranslations as I } from "../../../../hooks/useTranslations.js";
13
+ import { StyledButton as O } from "../../../../shared-components/button/StyledButton.js";
14
+ import { compact as R } from "../../../../../helpers/arrays.js";
15
+ import { jsx as o, jsxs as f } from "react/jsx-runtime";
16
+ import { DndContext as V, PointerSensor as E, closestCenter as M, useSensor as P, useSensors as w } from "@dnd-kit/core";
17
+ import { restrictToParentElement as W, restrictToVerticalAxis as z } from "@dnd-kit/modifiers";
18
+ import { SortableContext as j, arrayMove as U, useSortable as B, verticalListSortingStrategy as Y } from "@dnd-kit/sortable";
19
+ import { CSS as $ } from "@dnd-kit/utilities";
20
+ function q({ id: n, disabled: p, children: u }) {
21
+ const { attributes: c, listeners: h, setNodeRef: b, transform: g, transition: l } = B({
21
22
  id: n,
22
23
  disabled: p
23
24
  });
24
- return /* @__PURE__ */ i("div", {
25
+ return /* @__PURE__ */ o("div", {
25
26
  ref: b,
26
27
  style: {
27
- transform: Y.Transform.toString(g),
28
- transition: s
28
+ transform: $.Transform.toString(g),
29
+ transition: l
29
30
  },
31
+ className: d["drag-item"],
30
32
  children: u({
31
- attributes: d,
33
+ attributes: c,
32
34
  listeners: h
33
35
  })
34
36
  });
35
37
  }
36
- function ce({ headerData: n, locale: p }) {
37
- const { anchorEl: u, open: d, handleClose: h, handleOpen: b } = L(), g = n.table.getAllLeafColumns().some((e) => e.getCanHide() && !e.getIsVisible() && !S.includes(e.id)), s = n.table.getAllLeafColumns(), y = (e) => {
38
- const { active: o, over: t } = e;
39
- !o || !t || o.id === t.id || s.find((r) => r.id === t.id)?.columnDef.fixedLeft || s.find((r) => r.id === t.id)?.columnDef.fixedRight || n.table.setColumnOrder((r) => {
40
- const l = O(r ?? []).length ? r : n.table.getAllLeafColumns().map((C) => C.id);
41
- return j(l, l.indexOf(o.id), l.indexOf(t.id));
38
+ function fe({ headerData: n, locale: p }) {
39
+ const { anchorEl: u, open: c, handleClose: h, handleOpen: b } = L(), g = n.table.getAllLeafColumns().some((e) => e.getCanHide() && !e.getIsVisible() && !S.includes(e.id)), l = n.table.getAllLeafColumns(), y = (e) => {
40
+ const { active: r, over: t } = e;
41
+ !r || !t || r.id === t.id || l.find((i) => i.id === t.id)?.columnDef.fixedLeft || l.find((i) => i.id === t.id)?.columnDef.fixedRight || n.table.setColumnOrder((i) => {
42
+ const a = R(i ?? []).length ? i : n.table.getAllLeafColumns().map((C) => C.id);
43
+ return U(a, a.indexOf(r.id), a.indexOf(t.id));
42
44
  });
43
- }, v = P(M(V, { activationConstraint: { distance: 8 } })), c = H(p), x = s.filter((e) => !S.includes(e.id) && !!e.columnDef.header);
44
- return /* @__PURE__ */ a("div", {
45
+ }, N = w(P(E, { activationConstraint: { distance: 8 } })), s = I(p), x = l.filter((e) => !S.includes(e.id) && !!e.columnDef.header);
46
+ return /* @__PURE__ */ f("div", {
45
47
  className: m["actions-header-wrapper"],
46
- children: [/* @__PURE__ */ a("button", {
48
+ children: [/* @__PURE__ */ f("button", {
47
49
  type: "button",
48
- "aria-label": c.column_settings,
50
+ "aria-label": s.column_settings,
49
51
  "aria-haspopup": "true",
50
- "aria-expanded": d,
52
+ "aria-expanded": c,
51
53
  className: m["actions-header"],
52
54
  onClick: b,
53
- children: [/* @__PURE__ */ i(_, { className: m["pin-icon"] }), g && /* @__PURE__ */ i("div", { className: m["pin-indicator"] })]
54
- }), /* @__PURE__ */ a(D, {
55
+ children: [/* @__PURE__ */ o(k, { className: m["pin-icon"] }), g && /* @__PURE__ */ o("div", { className: m["pin-indicator"] })]
56
+ }), /* @__PURE__ */ f(D, {
55
57
  anchorEl: u,
56
58
  anchorOrigin: {
57
59
  horizontal: "left",
58
60
  vertical: "bottom"
59
61
  },
60
- open: d,
62
+ open: c,
61
63
  onClose: h,
62
64
  slotProps: { paper: { sx: {
63
- maxHeight: "calc(7 * 36px)",
65
+ maxHeight: "calc(7 * 40px)",
64
66
  overflowY: "auto",
65
67
  scrollbarWidth: "thin"
66
68
  } } },
67
- children: [/* @__PURE__ */ i(R, {
68
- modifiers: [z, w],
69
+ children: [/* @__PURE__ */ o(V, {
70
+ modifiers: [z, W],
69
71
  onDragEnd: y,
70
- collisionDetection: (e) => E(e).filter((o) => {
71
- const t = x.find((r) => r.id === o.id);
72
+ collisionDetection: (e) => M(e).filter((r) => {
73
+ const t = x.find((i) => i.id === r.id);
72
74
  return !t?.columnDef.fixedLeft && !t?.columnDef.fixedRight;
73
75
  }),
74
- sensors: v,
75
- children: /* @__PURE__ */ i(W, {
76
+ sensors: N,
77
+ children: /* @__PURE__ */ o(j, {
76
78
  items: x.map((e) => e.id),
77
- strategy: B,
79
+ strategy: Y,
78
80
  children: x.map((e) => {
79
- const o = !!e.columnDef.fixedLeft || !!e.columnDef.fixedRight, t = e.columnDef.enableHiding === !1, r = o || t ? /* @__PURE__ */ a("div", { children: [o && c.column_reorder, t && c.column_hidden] }) : null;
80
- return /* @__PURE__ */ i($, {
81
+ const r = !!e.columnDef.fixedLeft || !!e.columnDef.fixedRight, t = e.columnDef.enableHiding === !1;
82
+ let i = null;
83
+ return r && t ? i = s.column_reorder_and_hidden : r ? i = s.column_reorder : t && (i = s.column_hidden), /* @__PURE__ */ o(q, {
81
84
  id: e.id,
82
- disabled: o,
83
- children: ({ listeners: l, attributes: C }) => /* @__PURE__ */ i(A, {
84
- title: r,
85
+ disabled: r,
86
+ children: ({ listeners: a, attributes: C }) => /* @__PURE__ */ o(A, {
87
+ title: i,
85
88
  arrow: !0,
86
- children: /* @__PURE__ */ a("button", {
89
+ children: /* @__PURE__ */ f("button", {
87
90
  type: "button",
88
91
  onClick: () => {
89
92
  t || e.toggleVisibility(!e.getIsVisible());
90
93
  },
91
- className: f["table-action-item"],
94
+ className: d["table-action-item"],
92
95
  children: [
93
- /* @__PURE__ */ i(k, {
96
+ /* @__PURE__ */ o(H, {
94
97
  width: 20,
95
98
  height: 20,
96
99
  ...C,
97
- ...l,
100
+ ...a,
98
101
  style: {
99
102
  touchAction: "none",
100
103
  WebkitUserSelect: "none",
101
104
  userSelect: "none",
102
105
  WebkitTouchCallout: "none"
103
106
  },
104
- className: N(f["drag-icon"], o ? f["drag-icon--disabled"] : f["drag-icon--enabled"])
107
+ className: _(d["drag-icon"], r ? d["drag-icon--disabled"] : d["drag-icon--enabled"])
105
108
  }),
106
- /* @__PURE__ */ i("span", {
109
+ /* @__PURE__ */ o("span", {
107
110
  className: "px-2",
108
- children: /* @__PURE__ */ i(T, {
111
+ children: /* @__PURE__ */ o(T, {
109
112
  readOnly: t,
110
113
  dataTest: `${e.id}-column-visibility-checkbox`,
111
114
  size: "small",
@@ -115,7 +118,7 @@ function ce({ headerData: n, locale: p }) {
115
118
  className: "pointer-events-none"
116
119
  })
117
120
  }),
118
- /* @__PURE__ */ i("span", {
121
+ /* @__PURE__ */ o("span", {
119
122
  className: "font-roboto text-base text-delta-700",
120
123
  children: e.columnDef.pinnedHeaderText ?? (typeof e.columnDef.header == "string" ? e.columnDef.header : e.id)
121
124
  })
@@ -125,19 +128,21 @@ function ce({ headerData: n, locale: p }) {
125
128
  }, e.id);
126
129
  })
127
130
  })
128
- }), /* @__PURE__ */ i("div", {
131
+ }), /* @__PURE__ */ o("div", {
129
132
  className: "pb-2 pl-2",
130
- children: /* @__PURE__ */ i(I, {
133
+ children: /* @__PURE__ */ o(O, {
131
134
  dataTest: "reset-order-button",
132
135
  variant: "text",
133
- size: "small",
134
- onClick: () => n.table.resetColumnOrder(),
135
- children: c.reset_order
136
+ className: "h-10",
137
+ onClick: () => {
138
+ n.table.resetColumnOrder(), v.info(s.column_order_reset);
139
+ },
140
+ children: s.reset_order
136
141
  })
137
142
  })]
138
143
  })]
139
144
  });
140
145
  }
141
146
  export {
142
- ce as HeaderActionMenu
147
+ fe as HeaderActionMenu
143
148
  };
@@ -1,9 +1,10 @@
1
- var e = {
2
- "table-action-item": "_table-action-item_ejh2p_1",
3
- "drag-icon": "_drag-icon_ejh2p_18",
4
- "drag-icon--disabled": "_drag-icon--disabled_ejh2p_23",
5
- "drag-icon--enabled": "_drag-icon--enabled_ejh2p_28"
1
+ var a = {
2
+ "table-action-item": "_table-action-item_r3frh_1",
3
+ "drag-item": "_drag-item_r3frh_18",
4
+ "drag-icon": "_drag-icon_r3frh_22",
5
+ "drag-icon--disabled": "_drag-icon--disabled_r3frh_27",
6
+ "drag-icon--enabled": "_drag-icon--enabled_r3frh_32"
6
7
  };
7
8
  export {
8
- e as default
9
+ a as default
9
10
  };
@@ -1,20 +1,24 @@
1
- import { useMemo as o } from "react";
1
+ import { useMemo as r } from "react";
2
2
  var n = {
3
3
  en: {
4
4
  column_reorder: "This column is fixed and can’t be reordered.",
5
5
  column_hidden: "This column is fixed and can’t be hidden.",
6
+ column_reorder_and_hidden: "This column is fixed and can’t be reordered or hidden.",
6
7
  reset_order: "Reset order",
8
+ column_order_reset: "Column order reset",
7
9
  column_settings: "Column settings"
8
10
  },
9
11
  no: {
10
12
  column_reorder: "Denne kolonnen er fast og kan ikke flyttes.",
11
13
  column_hidden: "Denne kolonnen er fast og kan ikke skjules.",
14
+ column_reorder_and_hidden: "Denne kolonnen er fast og kan ikke flyttes eller skjules.",
12
15
  reset_order: "Tilbakestill rekkefølge",
16
+ column_order_reset: "Kolonnerekkefølgen er tilbakestilt",
13
17
  column_settings: "Kolonneinnstillinger"
14
18
  }
15
19
  };
16
20
  function s(e = "en") {
17
- return o(() => n[e] ?? n.en, [e]);
21
+ return r(() => n[e] ?? n.en, [e]);
18
22
  }
19
23
  export {
20
24
  s as useTranslations
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.75.0",
6
+ "version": "3.76.0",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",