asma-ui-core 3.137.0 → 3.137.2

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.
@@ -13,7 +13,7 @@ import { Skeleton as N } from "../../../mui-compat/Skeleton.js";
13
13
  import { forwardRef as ae, useEffect as ie, useId as ne } from "react";
14
14
  import { jsx as t, jsxs as S } from "react/jsx-runtime";
15
15
  var ve = ae((V, D) => {
16
- const { options: d, dataTest: z, value: r, readOnly: i, multiple: n, title: A, titleSize: L, width: T = "full", disabled: x, onChange: p, required: R, error: b, helperText: C, disableHelperText: $, valueKey: B = "value", labelKey: E = "label", renderLabel: o, getOptionTooltip: I, loading: H, size: w, locale: q = "en", clearSelectionLabel: G } = V, K = ne(), { show: W, role: F } = ee("DynamicInteractiveChipGroup", b, C, !$), { containerRef: f, wrapDisabled: y } = le({ dependencyList: [d, d.length] });
16
+ const { options: d, dataTest: z, value: r, readOnly: a, multiple: n, title: A, titleSize: L, width: T = "full", disabled: x, onChange: p, required: R, error: b, helperText: C, disableHelperText: $, valueKey: B = "value", labelKey: E = "label", renderLabel: o, getOptionTooltip: I, loading: H, size: w, locale: q = "en", clearSelectionLabel: G } = V, K = ne(), { show: W, role: F } = ee("DynamicInteractiveChipGroup", b, C, !$, a), { containerRef: f, wrapDisabled: y } = le({ dependencyList: [d, d.length] });
17
17
  ie(() => {
18
18
  f.current && (f.current.inert = !0);
19
19
  }, [f]);
@@ -22,14 +22,14 @@ var ve = ae((V, D) => {
22
22
  return l == null ? "" : typeof l == "string" || typeof l == "number" || typeof l == "boolean" ? String(l) : e == null ? "" : m(e);
23
23
  }, s = (e, l) => g(e) === g(l), J = n ? Array.isArray(r) && r.length > 0 : r != null, M = (e) => {
24
24
  if (!n) {
25
- const a = s(e, r) ? null : e;
26
- if (a === null) return;
27
- p(a);
25
+ const i = s(e, r) ? null : e;
26
+ if (i === null) return;
27
+ p(i);
28
28
  return;
29
29
  }
30
30
  const l = r ?? [];
31
- p(l.find((a) => s(a, e)) ? l.filter((a) => !s(a, e)) : [...l, e]);
32
- }, u = i ? d.filter((e) => !!(n ? r?.find((l) => s(l, e)) : s(r, e))) : d, P = u.findIndex((e) => !(typeof e == "object" && e?.disabled) && !i);
31
+ p(l.find((i) => s(i, e)) ? l.filter((i) => !s(i, e)) : [...l, e]);
32
+ }, u = a ? d.filter((e) => !!(n ? r?.find((l) => s(l, e)) : s(r, e))) : d, P = u.findIndex((e) => !(typeof e == "object" && e?.disabled) && !a);
33
33
  return /* @__PURE__ */ S("div", {
34
34
  "data-testid": `${z}-dynamic-radio-group`,
35
35
  className: "relative flex flex-col gap-y-1",
@@ -47,7 +47,7 @@ var ve = ae((V, D) => {
47
47
  style: { width: "100%" },
48
48
  children: u.map((e) => /* @__PURE__ */ t(O, {
49
49
  className: "w-fit",
50
- readOnly: i,
50
+ readOnly: a,
51
51
  type: n ? "checkbox" : "radio",
52
52
  dataTest: `ic-${c(e)}-hidden`,
53
53
  label: o ? o(e) : m(e)
@@ -63,15 +63,15 @@ var ve = ae((V, D) => {
63
63
  /* @__PURE__ */ t(N, { className: "h-[32px] w-[60px]" })
64
64
  ]
65
65
  }) : u?.length ? u.map((e, l) => {
66
- const a = !!(n ? r?.find((U) => s(U, e)) : s(r, e)), Q = I ? I(e) : null;
67
- if (i && !a) return null;
68
- const h = typeof e == "object" ? !!e?.disabled : !1, k = !h && !i && l === P ? D : void 0;
66
+ const i = !!(n ? r?.find((U) => s(U, e)) : s(r, e)), Q = I ? I(e) : null;
67
+ if (a && !i) return null;
68
+ const h = typeof e == "object" ? !!e?.disabled : !1, k = !h && !a && l === P ? D : void 0;
69
69
  return /* @__PURE__ */ t(X, {
70
70
  title: Q,
71
71
  arrow: !0,
72
72
  children: /* @__PURE__ */ t("span", {
73
73
  className: v(h && "cursor-not-allowed"),
74
- children: i && !y ? /* @__PURE__ */ t(_, {
74
+ children: a && !y ? /* @__PURE__ */ t(_, {
75
75
  ref: k,
76
76
  disabled: !!x || h,
77
77
  classes: { root: "min-h-[32px] h-full" },
@@ -86,10 +86,10 @@ var ve = ae((V, D) => {
86
86
  label: "block whitespace-normal break-words overflow-visible"
87
87
  } : { root: "min-h-[32px] h-full" },
88
88
  className: "w-fit",
89
- readOnly: i,
89
+ readOnly: a,
90
90
  type: n ? "checkbox" : "radio",
91
91
  dataTest: `ic-${c(e)}`,
92
- checked: a,
92
+ checked: i,
93
93
  size: w,
94
94
  onClick: () => M(e),
95
95
  label: o ? o(e) : m(e)
@@ -98,7 +98,7 @@ var ve = ae((V, D) => {
98
98
  }, c(e));
99
99
  }) : /* @__PURE__ */ t("span", { children: "-" })
100
100
  }),
101
- !R && J && !i && !x && /* @__PURE__ */ t(Z, {
101
+ !R && J && !a && !x && /* @__PURE__ */ t(Z, {
102
102
  dataTest: "clear-selection-btn",
103
103
  variant: "text",
104
104
  startIcon: w === "medium" ? /* @__PURE__ */ t(j, {
@@ -2,7 +2,7 @@ declare const translations: {
2
2
  en: {
3
3
  column_reorder: string;
4
4
  column_hidden: string;
5
- column_reorder_and_hidden: string;
5
+ column_unhideable: string;
6
6
  reset_columns: string;
7
7
  columns_reset: string;
8
8
  column_settings: string;
@@ -11,7 +11,7 @@ declare const translations: {
11
11
  no: {
12
12
  column_reorder: string;
13
13
  column_hidden: string;
14
- column_reorder_and_hidden: string;
14
+ column_unhideable: string;
15
15
  reset_columns: string;
16
16
  columns_reset: string;
17
17
  column_settings: string;
@@ -1,157 +1,174 @@
1
- import { cn as v } from "../../../../../helpers/cn.js";
2
- import { StyledBadge as N } from "../../../../../components/data-display/badge/StyledBadge.js";
3
- import { PinIcon as _ } from "../../../../../components/icons/pin-icon/PinIcon.js";
4
- import { StyledPopover as T } from "../../../../../components/utils/popover/StyledPopover.js";
5
- import { message as D } from "../../../../../components/feedback/snack-bar/message.js";
6
- import { INTERNAL_COLUMN_IDS as L } from "../../../../types.js";
7
- import { hasChangedColumnLayout as k } from "../../../../custom-features/order-columns/columnLayout.js";
8
- import { StyledCheckbox as A } from "../../../../shared-components/StyledCheckbox.js";
9
- import { StyledTooltip as I } from "../../../../shared-components/tooltip/index.js";
10
- import { useToggleMenuVisibility as H } from "../../../../hooks/useToggleMenuVisibility.hook.js";
1
+ import { cn as k } from "../../../../../helpers/cn.js";
2
+ import { StyledBadge as R } from "../../../../../components/data-display/badge/StyledBadge.js";
3
+ import { PinIcon as w } from "../../../../../components/icons/pin-icon/PinIcon.js";
4
+ import { StyledPopover as A } from "../../../../../components/utils/popover/StyledPopover.js";
5
+ import { message as O } from "../../../../../components/feedback/snack-bar/message.js";
6
+ import { INTERNAL_COLUMN_IDS as H } from "../../../../types.js";
7
+ import { hasChangedColumnLayout as M } from "../../../../custom-features/order-columns/columnLayout.js";
8
+ import { StyledCheckbox as P } from "../../../../shared-components/StyledCheckbox.js";
9
+ import { StyledTooltip as y } from "../../../../shared-components/tooltip/index.js";
10
+ import { useToggleMenuVisibility as E } from "../../../../hooks/useToggleMenuVisibility.hook.js";
11
11
  import f from "./TableActions.module.js";
12
- import d from "./HeaderActionMenu.module.js";
13
- import { DotsHorizontalIcon as O } from "../../../../shared-components/DotsHorizontalIcon.js";
14
- import { headerLabelText as R } from "../../../../helpers/headerLabel.js";
15
- import { useTranslations as w } from "../../../../hooks/useTranslations.js";
16
- import { StyledButton as E } from "../../../../shared-components/button/StyledButton.js";
17
- import { compact as M } from "../../../../../helpers/arrays.js";
18
- import { jsx as i, jsxs as u } from "react/jsx-runtime";
19
- import { DndContext as P, PointerSensor as V, closestCenter as W, useSensor as z, useSensors as B } from "@dnd-kit/core";
20
- import { restrictToParentElement as j, restrictToVerticalAxis as U } from "@dnd-kit/modifiers";
21
- import { SortableContext as Y, arrayMove as $, useSortable as q, verticalListSortingStrategy as F } from "@dnd-kit/sortable";
22
- import { CSS as G } from "@dnd-kit/utilities";
23
- function J({ id: n, disabled: p, children: h }) {
24
- const { attributes: c, listeners: b, setNodeRef: g, transform: m, transition: l } = q({
25
- id: n,
12
+ import s from "./HeaderActionMenu.module.js";
13
+ import { DotsHorizontalIcon as V } from "../../../../shared-components/DotsHorizontalIcon.js";
14
+ import { headerLabelText as W } from "../../../../helpers/headerLabel.js";
15
+ import { useTranslations as z } from "../../../../hooks/useTranslations.js";
16
+ import { StyledButton as B } from "../../../../shared-components/button/StyledButton.js";
17
+ import { compact as $ } from "../../../../../helpers/arrays.js";
18
+ import { useId as j } from "react";
19
+ import { jsx as t, jsxs as u } from "react/jsx-runtime";
20
+ import { DndContext as U, PointerSensor as F, closestCenter as Y, useSensor as q, useSensors as G } from "@dnd-kit/core";
21
+ import { restrictToParentElement as J, restrictToVerticalAxis as K } from "@dnd-kit/modifiers";
22
+ import { SortableContext as Q, arrayMove as X, useSortable as Z, verticalListSortingStrategy as ee } from "@dnd-kit/sortable";
23
+ import { CSS as te } from "@dnd-kit/utilities";
24
+ function oe({ id: r, disabled: p, children: h }) {
25
+ const { attributes: d, listeners: b, setNodeRef: g, transform: x, transition: c } = Z({
26
+ id: r,
26
27
  disabled: p
27
28
  });
28
- return /* @__PURE__ */ i("div", {
29
+ return /* @__PURE__ */ t("div", {
29
30
  ref: g,
30
31
  style: {
31
- transform: G.Transform.toString(m),
32
- transition: l
32
+ transform: te.Transform.toString(x),
33
+ transition: c
33
34
  },
34
- className: d["drag-item"],
35
+ className: s["drag-item"],
35
36
  children: h({
36
- attributes: c,
37
+ attributes: d,
37
38
  listeners: b
38
39
  })
39
40
  });
40
41
  }
41
- function xe({ headerData: n, locale: p }) {
42
- const { anchorEl: h, open: c, handleClose: b, handleOpen: g } = H(), m = k(n.table), l = n.table.getAllLeafColumns(), S = (e) => {
43
- const { active: r, over: t } = e;
44
- !r || !t || r.id === t.id || l.find((o) => o.id === t.id)?.columnDef.fixedLeft || l.find((o) => o.id === t.id)?.columnDef.fixedRight || n.table.setColumnOrder((o) => {
45
- const a = M(o ?? []).length ? o : n.table.getAllLeafColumns().map((C) => C.id);
46
- return $(a, a.indexOf(r.id), a.indexOf(t.id));
42
+ var ie = (r) => {
43
+ r.target.closest('label, [role="button"]') || r.preventDefault();
44
+ };
45
+ function Ie({ headerData: r, locale: p }) {
46
+ const { anchorEl: h, open: d, handleClose: b, handleOpen: g } = E(), x = j(), c = M(r.table), C = r.table.getAllLeafColumns(), N = (e) => {
47
+ const { active: l, over: o } = e;
48
+ !l || !o || l.id === o.id || C.find((i) => i.id === o.id)?.columnDef.fixedLeft || C.find((i) => i.id === o.id)?.columnDef.fixedRight || r.table.setColumnOrder((i) => {
49
+ const a = $(i ?? []).length ? i : r.table.getAllLeafColumns().map((m) => m.id);
50
+ return X(a, a.indexOf(l.id), a.indexOf(o.id));
47
51
  });
48
- }, y = B(z(V, { activationConstraint: { distance: 8 } })), s = w(p), x = l.filter((e) => !L.includes(e.id) && !!e.columnDef.header);
52
+ }, _ = G(q(F, { activationConstraint: { distance: 8 } })), n = z(p), S = C.filter((e) => !H.includes(e.id) && !!e.columnDef.header);
49
53
  return /* @__PURE__ */ u("div", {
50
54
  className: f["actions-header-wrapper"],
51
55
  children: [/* @__PURE__ */ u("button", {
52
56
  type: "button",
53
- "aria-label": m ? s.column_settings_changed : s.column_settings,
57
+ "aria-label": c ? n.column_settings_changed : n.column_settings,
54
58
  "aria-haspopup": "true",
55
- "aria-expanded": c,
56
- tabIndex: n.table.options.meta?.hideHeader ? -1 : void 0,
59
+ "aria-expanded": d,
60
+ tabIndex: r.table.options.meta?.hideHeader ? -1 : void 0,
57
61
  className: f["actions-header"],
58
62
  onClick: g,
59
- children: [/* @__PURE__ */ i(_, { className: f["pin-icon"] }), m && /* @__PURE__ */ i(N, {
63
+ children: [/* @__PURE__ */ t(w, { className: f["pin-icon"] }), c && /* @__PURE__ */ t(R, {
60
64
  dataTest: "column-settings-dot",
61
65
  variant: "dot",
62
66
  purpose: "filter",
63
67
  className: f["pin-dot"]
64
68
  })]
65
- }), /* @__PURE__ */ u(T, {
69
+ }), /* @__PURE__ */ u(A, {
66
70
  anchorEl: h,
67
71
  anchorOrigin: {
68
72
  horizontal: "left",
69
73
  vertical: "bottom"
70
74
  },
71
- open: c,
75
+ open: d,
72
76
  onClose: b,
73
77
  slotProps: { paper: { sx: {
74
78
  maxHeight: "calc(7 * 40px)",
75
79
  overflowY: "auto",
76
80
  scrollbarWidth: "thin"
77
81
  } } },
78
- children: [/* @__PURE__ */ i(P, {
79
- modifiers: [U, j],
80
- onDragEnd: S,
81
- collisionDetection: (e) => W(e).filter((r) => {
82
- const t = x.find((o) => o.id === r.id);
83
- return !t?.columnDef.fixedLeft && !t?.columnDef.fixedRight;
82
+ children: [/* @__PURE__ */ t(U, {
83
+ modifiers: [K, J],
84
+ onDragEnd: N,
85
+ collisionDetection: (e) => Y(e).filter((l) => {
86
+ const o = S.find((i) => i.id === l.id);
87
+ return !o?.columnDef.fixedLeft && !o?.columnDef.fixedRight;
84
88
  }),
85
- sensors: y,
86
- children: /* @__PURE__ */ i(Y, {
87
- items: x.map((e) => e.id),
88
- strategy: F,
89
- children: x.map((e) => {
90
- const r = !!e.columnDef.fixedLeft || !!e.columnDef.fixedRight, t = e.columnDef.enableHiding === !1;
91
- let o = null;
92
- return r && t ? o = s.column_reorder_and_hidden : r ? o = s.column_reorder : t && (o = s.column_hidden), /* @__PURE__ */ i(J, {
89
+ sensors: _,
90
+ children: /* @__PURE__ */ t(Q, {
91
+ items: S.map((e) => e.id),
92
+ strategy: ee,
93
+ children: S.map((e, l) => {
94
+ const o = !!e.columnDef.fixedLeft || !!e.columnDef.fixedRight, i = e.columnDef.enableHiding === !1, a = o ? n.column_reorder : null;
95
+ let m = null;
96
+ i && (m = o ? n.column_hidden : n.column_unhideable);
97
+ const D = W(e.columnDef) ?? e.id, v = `${x}-column-${l}-name`;
98
+ return /* @__PURE__ */ t(oe, {
93
99
  id: e.id,
94
- disabled: r,
95
- children: ({ listeners: a, attributes: C }) => /* @__PURE__ */ i(I, {
96
- title: o,
97
- arrow: !0,
98
- children: /* @__PURE__ */ u("button", {
99
- type: "button",
100
- onClick: () => {
101
- t || e.toggleVisibility(!e.getIsVisible());
102
- },
103
- className: d["table-action-item"],
104
- children: [
105
- /* @__PURE__ */ i(O, {
106
- width: 20,
107
- height: 20,
108
- ...C,
109
- ...a,
110
- style: {
111
- touchAction: "none",
112
- WebkitUserSelect: "none",
113
- userSelect: "none",
114
- WebkitTouchCallout: "none"
115
- },
116
- className: v(d["drag-icon"], r ? d["drag-icon--disabled"] : d["drag-icon--enabled"])
117
- }),
118
- /* @__PURE__ */ i("span", {
119
- className: "px-2",
120
- children: /* @__PURE__ */ i(A, {
121
- readOnly: t,
100
+ disabled: o,
101
+ children: ({ listeners: L, attributes: T }) => /* @__PURE__ */ u("div", {
102
+ role: "presentation",
103
+ className: s["table-action-item"],
104
+ onMouseDown: ie,
105
+ children: [
106
+ /* @__PURE__ */ t(y, {
107
+ title: m,
108
+ arrow: !0,
109
+ children: /* @__PURE__ */ t("span", {
110
+ className: "px-1",
111
+ children: /* @__PURE__ */ t(P, {
112
+ readOnly: i,
122
113
  dataTest: `${e.id}-column-visibility-checkbox`,
123
114
  size: "small",
124
115
  disableRipple: !0,
125
116
  checked: e.getIsVisible(),
126
117
  hideWrapper: !0,
127
- className: "pointer-events-none"
118
+ className: s["column-checkbox"],
119
+ "aria-labelledby": v,
120
+ "aria-readonly": i || void 0,
121
+ onChange: (re, I) => {
122
+ i || e.toggleVisibility(I);
123
+ }
124
+ })
125
+ })
126
+ }),
127
+ /* @__PURE__ */ t(y, {
128
+ title: a,
129
+ arrow: !0,
130
+ children: /* @__PURE__ */ t("span", {
131
+ className: s["drag-slot"],
132
+ children: /* @__PURE__ */ t(V, {
133
+ width: 20,
134
+ height: 20,
135
+ ...T,
136
+ ...L,
137
+ style: {
138
+ touchAction: "none",
139
+ WebkitUserSelect: "none",
140
+ userSelect: "none",
141
+ WebkitTouchCallout: "none"
142
+ },
143
+ className: k(s["drag-icon"], o ? s["drag-icon--disabled"] : s["drag-icon--enabled"])
128
144
  })
129
- }),
130
- /* @__PURE__ */ i("span", {
131
- className: "font-roboto text-base text-delta-700",
132
- children: R(e.columnDef) ?? e.id
133
145
  })
134
- ]
135
- })
146
+ }),
147
+ /* @__PURE__ */ t("span", {
148
+ id: v,
149
+ className: "font-roboto text-base text-delta-700",
150
+ children: D
151
+ })
152
+ ]
136
153
  })
137
154
  }, e.id);
138
155
  })
139
156
  })
140
- }), /* @__PURE__ */ i("div", {
157
+ }), /* @__PURE__ */ t("div", {
141
158
  className: "pb-2 pl-2",
142
- children: /* @__PURE__ */ i(E, {
159
+ children: /* @__PURE__ */ t(B, {
143
160
  dataTest: "reset-order-button",
144
161
  variant: "text",
145
162
  className: "h-10",
146
163
  onClick: () => {
147
- n.table.resetColumnSettings(), D.info(s.columns_reset, { closeButton: !0 });
164
+ r.table.resetColumnSettings(), O.info(n.columns_reset, { closeButton: !0 });
148
165
  },
149
- children: s.reset_columns
166
+ children: n.reset_columns
150
167
  })
151
168
  })]
152
169
  })]
153
170
  });
154
171
  }
155
172
  export {
156
- xe as HeaderActionMenu
173
+ Ie as HeaderActionMenu
157
174
  };
@@ -1,9 +1,11 @@
1
1
  var a = {
2
- "table-action-item": "_table-action-item_qha7l_1",
3
- "drag-item": "_drag-item_qha7l_18",
4
- "drag-icon": "_drag-icon_qha7l_22",
5
- "drag-icon--disabled": "_drag-icon--disabled_qha7l_27",
6
- "drag-icon--enabled": "_drag-icon--enabled_qha7l_32"
2
+ "table-action-item": "_table-action-item_1u7jy_1",
3
+ "drag-item": "_drag-item_1u7jy_19",
4
+ "column-checkbox": "_column-checkbox_1u7jy_23",
5
+ "drag-slot": "_drag-slot_1u7jy_28",
6
+ "drag-icon": "_drag-icon_1u7jy_33",
7
+ "drag-icon--disabled": "_drag-icon--disabled_1u7jy_38",
8
+ "drag-icon--enabled": "_drag-icon--enabled_1u7jy_43"
7
9
  };
8
10
  export {
9
11
  a as default
@@ -3,7 +3,7 @@ var e = {
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
+ column_unhideable: "This column can’t be hidden.",
7
7
  reset_columns: "Reset columns",
8
8
  columns_reset: "Columns reset",
9
9
  column_settings: "Column settings",
@@ -12,7 +12,7 @@ var e = {
12
12
  no: {
13
13
  column_reorder: "Denne kolonnen er fast og kan ikke flyttes.",
14
14
  column_hidden: "Denne kolonnen er fast og kan ikke skjules.",
15
- column_reorder_and_hidden: "Denne kolonnen er fast og kan ikke flyttes eller skjules.",
15
+ column_unhideable: "Denne kolonnen kan ikke skjules.",
16
16
  reset_columns: "Tilbakestill kolonner",
17
17
  columns_reset: "Kolonnene er tilbakestilt",
18
18
  column_settings: "Kolonneinnstillinger",
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.137.0",
6
+ "version": "3.137.2",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",