asma-ui-core 3.102.0 → 3.103.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.
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/custom/module/header-layout/ToolbarActionGroup.js +30 -30
- package/dist/components/data-display/badge/StyledBadge.js +30 -34
- package/dist/components/data-display/virtualized-list/VirtualizedList.js +16 -15
- package/dist/components/feedback/dialog/StyledDialog.js +71 -62
- package/dist/components/feedback/dialog/StyledDialogTitle.js +25 -14
- package/dist/components/feedback/dialog/dialogTitleContext.js +5 -0
- package/dist/components/miscellaneous/StyledFormControlLabel.js +14 -14
- package/dist/components/navigation/link/StyledLink.js +25 -18
- package/dist/components/navigation/link/StyledLink.module.js +6 -5
- package/dist/components/navigation/menu/StyledMenu.js +15 -18
- package/dist/components/navigation/menu/StyledMenu.module.js +4 -0
- package/dist/components/navigation/menu/StyledMenuItem.js +49 -23
- package/dist/components/navigation/menu/StyledMenuList.js +41 -25
- package/dist/src/components/feedback/dialog/StyledDialog.d.ts +2 -0
- package/dist/src/components/feedback/dialog/StyledDialogTitle.d.ts +4 -1
- package/dist/src/components/feedback/dialog/dialogTitleContext.d.ts +15 -0
- package/dist/src/components/navigation/link/StyledLink.d.ts +3 -2
- package/dist/src/components/navigation/menu/StyledMenuItem.d.ts +9 -5
- package/dist/src/table/components/columns/dndHandleColumn.d.ts +2 -1
- package/dist/src/table/components/columns/expandColumn.d.ts +1 -1
- package/dist/src/table/components/columns/showTextColumn.d.ts +1 -1
- package/dist/table/components/columns/dndHandleColumn.js +20 -18
- package/dist/table/components/columns/expandColumn.js +15 -15
- package/dist/table/components/columns/showTextColumn.js +20 -19
- package/dist/table/helpers/injectColumns.js +8 -8
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
var l = {
|
|
2
|
-
"styled-link": "_styled-
|
|
3
|
-
"styled-link-disabled": "_styled-link-
|
|
4
|
-
"styled-link-
|
|
5
|
-
"styled-link-
|
|
6
|
-
"styled-link-
|
|
2
|
+
"styled-link": "_styled-link_1au3b_1",
|
|
3
|
+
"styled-link-disabled": "_styled-link-disabled_1au3b_14",
|
|
4
|
+
"styled-link-button": "_styled-link-button_1au3b_30",
|
|
5
|
+
"styled-link-xs": "_styled-link-xs_1au3b_35",
|
|
6
|
+
"styled-link-small": "_styled-link-small_1au3b_40",
|
|
7
|
+
"styled-link-large": "_styled-link-large_1au3b_45"
|
|
7
8
|
};
|
|
8
9
|
export {
|
|
9
10
|
l as default
|
|
@@ -1,36 +1,33 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { StyledPopover as
|
|
3
|
-
import { StyledMenuList as
|
|
1
|
+
import { cn as c } from "../../../helpers/cn.js";
|
|
2
|
+
import { StyledPopover as x } from "../../utils/popover/StyledPopover.js";
|
|
3
|
+
import { StyledMenuList as N } from "./StyledMenuList.js";
|
|
4
4
|
import { jsx as o } from "react/jsx-runtime";
|
|
5
|
-
var
|
|
6
|
-
border: "1px solid var(--colors-delta-300)",
|
|
7
|
-
boxShadow: "0px 2px 4px 0px rgba(34, 33, 51, 0.15)"
|
|
8
|
-
}, h = ({ open: p, anchorEl: m, onClose: t, anchorOrigin: l, transformOrigin: i, id: d, className: s, sx: x, classes: a, slotProps: e, autoFocus: n = !0, onClick: y, children: b, keepMounted: f }) => /* @__PURE__ */ o(c, {
|
|
5
|
+
var S = { border: "1px solid var(--colors-delta-300)" }, w = ({ open: p, anchorEl: m, onClose: t, anchorOrigin: l, transformOrigin: i, id: s, className: d, sx: n, classes: a, slotProps: e, autoFocus: y = !0, onClick: f, children: u, keepMounted: b }) => /* @__PURE__ */ o(x, {
|
|
9
6
|
open: p,
|
|
10
7
|
anchorEl: m,
|
|
11
8
|
onClose: t,
|
|
12
9
|
tabIntoContent: !1,
|
|
13
10
|
anchorOrigin: l,
|
|
14
11
|
transformOrigin: i,
|
|
15
|
-
id:
|
|
16
|
-
className:
|
|
17
|
-
sx:
|
|
18
|
-
keepMounted:
|
|
12
|
+
id: s,
|
|
13
|
+
className: d,
|
|
14
|
+
sx: n,
|
|
15
|
+
keepMounted: b,
|
|
19
16
|
slotProps: { paper: {
|
|
20
|
-
className:
|
|
21
|
-
sx: [
|
|
17
|
+
className: c("rounded", a?.paper, e?.paper?.className),
|
|
18
|
+
sx: [S, e?.paper?.sx],
|
|
22
19
|
style: e?.paper?.style
|
|
23
20
|
} },
|
|
24
|
-
children: /* @__PURE__ */ o(
|
|
25
|
-
autoFocus:
|
|
21
|
+
children: /* @__PURE__ */ o(N, {
|
|
22
|
+
autoFocus: y,
|
|
26
23
|
className: a?.list,
|
|
27
|
-
onClick:
|
|
24
|
+
onClick: f,
|
|
28
25
|
onKeyDown: (r) => {
|
|
29
26
|
r.key === "Tab" && r.target.getAttribute("role") === "menuitem" && t?.(r, "tabKeyDown");
|
|
30
27
|
},
|
|
31
|
-
children:
|
|
28
|
+
children: u
|
|
32
29
|
})
|
|
33
30
|
});
|
|
34
31
|
export {
|
|
35
|
-
|
|
32
|
+
w as StyledMenu
|
|
36
33
|
};
|
|
@@ -1,25 +1,51 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { resolveSx as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
1
|
+
import { cn as i } from "../../../helpers/cn.js";
|
|
2
|
+
import { resolveSx as w } from "../../../helpers/sx.js";
|
|
3
|
+
import { StyledCheckbox as D } from "../../inputs/checkbox/base-ui/StyledCheckbox.js";
|
|
4
|
+
import { StyledTooltip as g } from "../../data-display/tooltip/StyledTooltip.js";
|
|
5
|
+
import { Children as k, isValidElement as A } from "react";
|
|
6
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
7
|
+
var p = {
|
|
8
|
+
en: "Already added",
|
|
9
|
+
no: "Allerede lagt til"
|
|
10
|
+
}, E = () => (typeof document > "u" ? "" : document.documentElement.lang).toLowerCase().startsWith("en") ? p.en : p.no, c = (r) => {
|
|
11
|
+
let t = !1;
|
|
12
|
+
return k.forEach(r, (o) => {
|
|
13
|
+
if (t || !A(o)) return;
|
|
14
|
+
if (o.type === D) {
|
|
15
|
+
const e = o.props;
|
|
16
|
+
t = e.checked === !0 && e.disabled === !0;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const a = o.props.children;
|
|
20
|
+
a !== void 0 && c(a) && (t = !0);
|
|
21
|
+
}), t;
|
|
22
|
+
}, j = ({ children: r, onClick: t, onMouseDown: o, onMouseUp: a, disabled: e, selected: l, dense: f, tooltip: y, className: v, classes: d, sx: x, "data-test": h, "data-testid": b, value: _ }) => {
|
|
23
|
+
const s = /* @__PURE__ */ u("li", {
|
|
24
|
+
role: "menuitem",
|
|
25
|
+
"aria-disabled": e ? !0 : void 0,
|
|
26
|
+
tabIndex: -1,
|
|
27
|
+
"data-test": h,
|
|
28
|
+
"data-testid": b,
|
|
29
|
+
onClick: e ? void 0 : t,
|
|
30
|
+
onMouseDown: e ? void 0 : o,
|
|
31
|
+
onMouseUp: e ? void 0 : a,
|
|
32
|
+
onKeyDown: (n) => {
|
|
33
|
+
e || (n.key === "Enter" || n.key === " ") && (n.preventDefault(), t?.(n));
|
|
34
|
+
},
|
|
35
|
+
className: i("box-border flex items-center px-4 text-base outline-none focus-visible:shadow-[inset_3px_0_var(--colors-focus-ring)]", f ? "min-h-8 py-1" : "min-h-10 py-2", "asma-pressable asma-touch-target", e ? "cursor-not-allowed text-delta-300 aria-disabled:text-delta-300" : i("cursor-pointer text-delta-700", !l && "hover:bg-delta-50"), l && i("bg-gama-50", d?.selected), d?.root, v),
|
|
36
|
+
style: {
|
|
37
|
+
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
38
|
+
...w(x)
|
|
39
|
+
},
|
|
40
|
+
children: r
|
|
41
|
+
}), m = y ?? (c(r) ? E() : void 0);
|
|
42
|
+
return m ? /* @__PURE__ */ u(g, {
|
|
43
|
+
title: m,
|
|
44
|
+
arrow: !0,
|
|
45
|
+
placement: "top",
|
|
46
|
+
children: s
|
|
47
|
+
}) : s;
|
|
48
|
+
};
|
|
23
49
|
export {
|
|
24
|
-
|
|
50
|
+
j as StyledMenuItem
|
|
25
51
|
};
|
|
@@ -1,44 +1,60 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { consumerOverrides as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { cn as S } from "../../../helpers/cn.js";
|
|
2
|
+
import { consumerOverrides as v } from "../../../helpers/classOverride.js";
|
|
3
|
+
import L from "./StyledMenu.module.js";
|
|
4
|
+
import { useEffect as I, useLayoutEffect as M, useRef as R } from "react";
|
|
5
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
6
|
+
var p = '[role="menu"], [role="listbox"]', u = '[role="menuitem"]', b = (o) => Array.from(o.childNodes).flatMap((r) => r instanceof HTMLElement ? r.hidden ? [] : r.matches(p) ? [null] : r.matches(u) ? [r] : r.querySelector(u) ? b(r) : [null] : r.textContent?.trim() ? [null] : []), y = (o) => o ? Array.from(o.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')) : [], H = ({ children: o, id: r, role: h = "menu", className: a, autoFocus: f, disablePadding: E, onClick: A, onKeyDown: w }) => {
|
|
7
|
+
const i = R(null), c = v(a, "padding");
|
|
8
|
+
M(() => {
|
|
9
|
+
const e = i.current;
|
|
10
|
+
if (!e) return;
|
|
11
|
+
const t = () => {
|
|
12
|
+
const n = b(e);
|
|
13
|
+
Array.from(e.querySelectorAll(u)).filter((l) => l.closest(p) === e).forEach((l) => l.removeAttribute("data-menu-separator")), n.forEach((l, g) => l?.toggleAttribute("data-menu-separator", !!n[g + 1]));
|
|
14
|
+
};
|
|
15
|
+
t();
|
|
16
|
+
const s = new MutationObserver(t);
|
|
17
|
+
return s.observe(e, {
|
|
18
|
+
childList: !0,
|
|
19
|
+
subtree: !0,
|
|
20
|
+
attributes: !0,
|
|
21
|
+
attributeFilter: ["hidden"]
|
|
22
|
+
}), () => s.disconnect();
|
|
23
|
+
}, []), I(() => {
|
|
24
|
+
f && y(i.current)[0]?.focus();
|
|
25
|
+
}, [f]);
|
|
26
|
+
const x = (e) => {
|
|
27
|
+
if (w?.(e), ![
|
|
12
28
|
"ArrowDown",
|
|
13
29
|
"ArrowUp",
|
|
14
30
|
"Home",
|
|
15
31
|
"End"
|
|
16
32
|
].includes(e.key)) return;
|
|
17
33
|
e.preventDefault();
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
const
|
|
21
|
-
let n =
|
|
22
|
-
e.key === "ArrowDown" ? n = (
|
|
34
|
+
const t = y(i.current);
|
|
35
|
+
if (t.length === 0) return;
|
|
36
|
+
const s = t.findIndex((l) => l === document.activeElement);
|
|
37
|
+
let n = s;
|
|
38
|
+
e.key === "ArrowDown" ? n = (s + 1) % t.length : e.key === "ArrowUp" ? n = (s - 1 + t.length) % t.length : e.key === "Home" ? n = 0 : e.key === "End" && (n = t.length - 1), t[n]?.focus();
|
|
23
39
|
}, m = {
|
|
24
|
-
id:
|
|
25
|
-
className:
|
|
40
|
+
id: r,
|
|
41
|
+
className: S(L.list, "m-0 list-none outline-none", !c && "px-0", !c && (E ? "py-0" : "py-2"), a),
|
|
26
42
|
style: { fontFamily: "Roboto, Helvetica, Arial, sans-serif" },
|
|
27
|
-
onClick:
|
|
28
|
-
onKeyDown:
|
|
43
|
+
onClick: A,
|
|
44
|
+
onKeyDown: x
|
|
29
45
|
};
|
|
30
|
-
return
|
|
31
|
-
ref:
|
|
46
|
+
return h === "listbox" ? /* @__PURE__ */ d("ul", {
|
|
47
|
+
ref: i,
|
|
32
48
|
...m,
|
|
33
49
|
role: "listbox",
|
|
34
50
|
children: o
|
|
35
|
-
}) : /* @__PURE__ */
|
|
36
|
-
ref:
|
|
51
|
+
}) : /* @__PURE__ */ d("ul", {
|
|
52
|
+
ref: i,
|
|
37
53
|
...m,
|
|
38
54
|
role: "menu",
|
|
39
55
|
children: o
|
|
40
56
|
});
|
|
41
57
|
};
|
|
42
58
|
export {
|
|
43
|
-
|
|
59
|
+
H as StyledMenuList
|
|
44
60
|
};
|
|
@@ -55,6 +55,8 @@ export interface IStyledDialogProps {
|
|
|
55
55
|
dialogLabel?: ReactNode;
|
|
56
56
|
/** @figmaProp header Title (Page title 24 SemiBold, delta-800) */
|
|
57
57
|
dialogTitle?: ReactNode;
|
|
58
|
+
/** Accessible name when the dialog has no visible title. */
|
|
59
|
+
ariaLabel?: string;
|
|
58
60
|
dialogHeaderNode?: ReactNode;
|
|
59
61
|
}
|
|
60
62
|
/**
|
|
@@ -5,6 +5,9 @@ interface DialogTitleProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* MUI-free dialog title: a semantic `<h2>` with the previous SCSS metrics as Tailwind. TASK-101.
|
|
8
|
+
*
|
|
9
|
+
* Adopts the id its enclosing `StyledDialog` offers, so the dialog is named by this visible title
|
|
10
|
+
* rather than by its test hook (WCAG 4.1.2). An explicit `id` from the caller always wins.
|
|
8
11
|
*/
|
|
9
|
-
export declare const StyledDialogTitle: ({ children, className, sx, style, classes: _classes, ...rest }: DialogTitleProps) => JSX.Element | null;
|
|
12
|
+
export declare const StyledDialogTitle: ({ children, className, sx, style, id, classes: _classes, ...rest }: DialogTitleProps) => JSX.Element | null;
|
|
10
13
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lets a `<StyledDialogTitle>` child name the dialog that contains it.
|
|
3
|
+
*
|
|
4
|
+
* `StyledDialog` can point `aria-labelledby` at its own `dialogTitle` prop directly, but a large
|
|
5
|
+
* share of consumers render the title as a child instead (e.g. advoca's privacy-consent modal).
|
|
6
|
+
* Without this, those dialogs fall back to having no accessible name at all — WCAG 4.1.2 requires
|
|
7
|
+
* the dialog to be named by its visible title, not by a test hook.
|
|
8
|
+
*/
|
|
9
|
+
export interface StyledDialogTitleContextValue {
|
|
10
|
+
/** `id` the title adopts so the dialog can reference it. */
|
|
11
|
+
titleId: string;
|
|
12
|
+
/** Registers the title's actual id, including an explicit caller-supplied id. */
|
|
13
|
+
setTitleId: (titleId: string | undefined) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const StyledDialogTitleContext: import('react').Context<StyledDialogTitleContextValue | null>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { default as React, AnchorHTMLAttributes, ReactNode } from 'react';
|
|
1
|
+
import { default as React, AnchorHTMLAttributes, MouseEvent, ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* @figmaNode wXrXt5uKNNzV2DnQCgyYZH#14472-14569 (Design-System · "Link")
|
|
4
4
|
*
|
|
@@ -6,7 +6,8 @@ import { default as React, AnchorHTMLAttributes, ReactNode } from 'react';
|
|
|
6
6
|
* Disabled = delta-300; Focused/Pressed adds a 1px gama-400 rounded indicator (radius 4, px4/py2).
|
|
7
7
|
* State is derived at runtime from `:hover`/`:focus`/`disabled`, not a prop.
|
|
8
8
|
*/
|
|
9
|
-
export type StyledLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
9
|
+
export type StyledLinkProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'onClick'> & {
|
|
10
|
+
onClick?: (event: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;
|
|
10
11
|
/** @figmaProp State = true→"Disabled" (renders a non-interactive <span>, delta-300) */
|
|
11
12
|
disabled?: boolean;
|
|
12
13
|
/** @figmaProp Size = small→"Base" (14/20) | large→"Medium" (16/24); xs (12/20) = none (no DS size) */
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { MouseEvent, ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* @figmaNode wXrXt5uKNNzV2DnQCgyYZH#16073-
|
|
4
|
-
* Figma "Menus item" (h40, label 16px text-icon/body).
|
|
5
|
-
* Disabled) ← native hover + `selected`/`disabled`; **Type** (Only Label/Icon/Checkbox/Check mark)
|
|
6
|
-
* is expressed via `children`. Selected bg = `gama-50`, hover bg = `delta-50`.
|
|
3
|
+
* @figmaNode wXrXt5uKNNzV2DnQCgyYZH#16073-21583
|
|
4
|
+
* Figma "Menus item" (h40, label 16px text-icon/body). Hover gray `#f0f2f4`, separator `#d3d8df`.
|
|
7
5
|
*/
|
|
8
6
|
export interface StyledMenuItemProps {
|
|
9
7
|
/** @figmaProp content — Type (Only Label / Icon / Checkbox / Check mark) via composition */
|
|
@@ -18,6 +16,12 @@ export interface StyledMenuItemProps {
|
|
|
18
16
|
selected?: boolean;
|
|
19
17
|
/** Compact vertical padding (MUI `MenuItem` `dense` parity, DEC-003). */
|
|
20
18
|
dense?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Hover/focus hint. Optional. When omitted, a checked and disabled checkbox (an option that is
|
|
21
|
+
* already selected and cannot be picked again) gets "Allerede lagt til", or "Already added" when
|
|
22
|
+
* `<html lang>` is English. Pass this to use another phrase, such as "Already in use".
|
|
23
|
+
*/
|
|
24
|
+
tooltip?: ReactNode;
|
|
21
25
|
value?: unknown;
|
|
22
26
|
className?: string;
|
|
23
27
|
classes?: {
|
|
@@ -32,4 +36,4 @@ export interface StyledMenuItemProps {
|
|
|
32
36
|
* Native `role="menuitem"` (replaces MUI `MenuItem`). Enter/Space activate; a disabled item stays
|
|
33
37
|
* focusable but non-interactive (MUI parity). Public props preserved (DEC-003). TASK-303.
|
|
34
38
|
*/
|
|
35
|
-
export declare const StyledMenuItem: ({ children, onClick, onMouseDown, onMouseUp, disabled, selected, dense, className, classes, sx, "data-test": dataTest, "data-testid": dataTestId, value: _value, }: StyledMenuItemProps) => JSX.Element;
|
|
39
|
+
export declare const StyledMenuItem: ({ children, onClick, onMouseDown, onMouseUp, disabled, selected, dense, tooltip, className, classes, sx, "data-test": dataTest, "data-testid": dataTestId, value: _value, }: StyledMenuItemProps) => JSX.Element;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Arguments } from '@dnd-kit/sortable/dist/hooks/useSortable';
|
|
2
2
|
import { FC } from 'react';
|
|
3
3
|
import { ColumnDef } from '../../types';
|
|
4
|
-
export declare function generateDndHandleColumn<TData>(custom_props?: ColumnDef<TData, unknown>, rowHeight?: number): ColumnDef<TData, unknown>;
|
|
4
|
+
export declare function generateDndHandleColumn<TData>(custom_props?: ColumnDef<TData, unknown>, rowHeight?: number, locale?: 'en' | 'no'): ColumnDef<TData, unknown>;
|
|
5
5
|
export declare const RowDragHandleCell: FC<Partial<Omit<Arguments, 'id'>> & {
|
|
6
|
+
ariaLabel?: string;
|
|
6
7
|
rowId: string;
|
|
7
8
|
rowHeight?: number;
|
|
8
9
|
}>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ColumnDef } from '../../types';
|
|
2
|
-
export declare function generateExpandColumn<TData>(isFixed: boolean, rowHeight?: number): ColumnDef<TData, unknown>;
|
|
2
|
+
export declare function generateExpandColumn<TData>(isFixed: boolean, rowHeight?: number, locale?: 'en' | 'no'): ColumnDef<TData, unknown>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ColumnDef } from '../../types';
|
|
2
|
-
export declare function generateShowFullTextColumn<TData>(isFixed: boolean, rowHeight?: number): ColumnDef<TData, unknown>;
|
|
2
|
+
export declare function generateShowFullTextColumn<TData>(isFixed: boolean, rowHeight?: number, locale?: 'en' | 'no'): ColumnDef<TData, unknown>;
|
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
import { DND_HANDLE_COLUMN_ID as
|
|
2
|
-
import { DotsHorizontalIcon as
|
|
3
|
-
import
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { useSortable as
|
|
6
|
-
function
|
|
1
|
+
import { DND_HANDLE_COLUMN_ID as n } from "../../types.js";
|
|
2
|
+
import { DotsHorizontalIcon as d } from "../../shared-components/DotsHorizontalIcon.js";
|
|
3
|
+
import s from "clsx";
|
|
4
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
5
|
+
import { useSortable as m } from "@dnd-kit/sortable";
|
|
6
|
+
function p(r, t, l) {
|
|
7
7
|
return {
|
|
8
8
|
enableHiding: !1,
|
|
9
9
|
enableSorting: !1,
|
|
10
10
|
header: () => null,
|
|
11
|
-
cell: ({ row: e }) => /* @__PURE__ */
|
|
11
|
+
cell: ({ row: e }) => /* @__PURE__ */ a(u, {
|
|
12
|
+
ariaLabel: l === "no" ? `Endre rekkefølge på rad ${e.index + 1}` : `Reorder row ${e.index + 1}`,
|
|
12
13
|
rowId: e.id,
|
|
13
14
|
rowHeight: t
|
|
14
15
|
}),
|
|
15
16
|
minSize: 50,
|
|
16
17
|
size: 50,
|
|
17
18
|
...r,
|
|
18
|
-
id:
|
|
19
|
+
id: n
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
|
-
var
|
|
22
|
-
const { attributes:
|
|
23
|
-
id:
|
|
22
|
+
var u = ({ ariaLabel: r, rowId: t, rowHeight: l, ...e }) => {
|
|
23
|
+
const { attributes: i, listeners: o } = m({
|
|
24
|
+
id: t,
|
|
24
25
|
...e
|
|
25
26
|
});
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
...l,
|
|
27
|
+
return /* @__PURE__ */ a("div", {
|
|
28
28
|
...i,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
...o,
|
|
30
|
+
"aria-label": r,
|
|
31
|
+
style: { height: l ?? "auto" },
|
|
32
|
+
children: /* @__PURE__ */ a(d, {
|
|
31
33
|
width: 24,
|
|
32
34
|
height: 24,
|
|
33
|
-
className:
|
|
35
|
+
className: s(e.disabled ? "cursor-not-allowed text-delta-300" : "cursor-grab text-delta-800")
|
|
34
36
|
})
|
|
35
37
|
});
|
|
36
38
|
};
|
|
37
39
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
u as RowDragHandleCell,
|
|
41
|
+
p as generateDndHandleColumn
|
|
40
42
|
};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { EXPAND_COLUMN_ID as
|
|
2
|
-
import { ChevronDownIcon as
|
|
3
|
-
import { jsx as
|
|
1
|
+
import { EXPAND_COLUMN_ID as a } from "../../types.js";
|
|
2
|
+
import { ChevronDownIcon as d } from "../../shared-components/ChevronDownIcon.js";
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
4
|
import "@tanstack/react-table";
|
|
5
|
-
function
|
|
5
|
+
function x(t, o, i) {
|
|
6
6
|
return {
|
|
7
|
-
id:
|
|
7
|
+
id: a,
|
|
8
8
|
minSize: 50,
|
|
9
9
|
maxSize: 50,
|
|
10
10
|
size: 50,
|
|
11
11
|
enableHiding: !1,
|
|
12
12
|
enableSorting: !1,
|
|
13
13
|
header: () => null,
|
|
14
|
-
cell: ({ cell:
|
|
15
|
-
const
|
|
16
|
-
return
|
|
14
|
+
cell: ({ cell: n }) => {
|
|
15
|
+
const e = n.row.getIsExpanded();
|
|
16
|
+
return n.row.getCanExpand() ? /* @__PURE__ */ r("button", {
|
|
17
17
|
type: "button",
|
|
18
|
-
"aria-label": n ?
|
|
19
|
-
"aria-expanded":
|
|
18
|
+
"aria-label": i === "no" ? e ? `Skjul rad ${n.row.index + 1}` : `Utvid rad ${n.row.index + 1}` : e ? `Collapse row ${n.row.index + 1}` : `Expand row ${n.row.index + 1}`,
|
|
19
|
+
"aria-expanded": e,
|
|
20
20
|
className: "flex w-full items-center justify-center border-0 bg-transparent p-0 outline-none focus:outline-none",
|
|
21
|
-
onClick: () =>
|
|
21
|
+
onClick: () => n.row.getToggleExpandedHandler()(),
|
|
22
22
|
style: { height: o ?? "auto" },
|
|
23
|
-
children: /* @__PURE__ */
|
|
23
|
+
children: /* @__PURE__ */ r(d, {
|
|
24
24
|
className: "block size-6 shrink-0",
|
|
25
25
|
width: 24,
|
|
26
26
|
height: 24,
|
|
27
27
|
style: {
|
|
28
|
-
transform:
|
|
28
|
+
transform: e ? "rotate(180deg)" : "rotate(0deg)",
|
|
29
29
|
transformBox: "fill-box",
|
|
30
30
|
transformOrigin: "center",
|
|
31
31
|
transitionProperty: "transform",
|
|
@@ -35,9 +35,9 @@ function f(r, o) {
|
|
|
35
35
|
})
|
|
36
36
|
}) : null;
|
|
37
37
|
},
|
|
38
|
-
fixedLeft:
|
|
38
|
+
fixedLeft: t
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
export {
|
|
42
|
-
|
|
42
|
+
x as generateExpandColumn
|
|
43
43
|
};
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import { SHOW_FULL_TEXT_ID as
|
|
2
|
-
import { ChevronDownIcon as
|
|
3
|
-
import { StyledButton as
|
|
4
|
-
import { jsx as
|
|
5
|
-
function
|
|
1
|
+
import { SHOW_FULL_TEXT_ID as l } from "../../types.js";
|
|
2
|
+
import { ChevronDownIcon as s } from "../../shared-components/ChevronDownIcon.js";
|
|
3
|
+
import { StyledButton as d } from "../../shared-components/button/StyledButton.js";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
function c(e, o, n) {
|
|
6
6
|
return {
|
|
7
|
-
id:
|
|
7
|
+
id: l,
|
|
8
8
|
minSize: 38,
|
|
9
9
|
maxSize: 38,
|
|
10
10
|
size: 38,
|
|
11
11
|
enableHiding: !1,
|
|
12
12
|
enableSorting: !1,
|
|
13
13
|
header: () => null,
|
|
14
|
-
cell: (
|
|
15
|
-
info:
|
|
16
|
-
|
|
14
|
+
cell: (a) => /* @__PURE__ */ r(u, {
|
|
15
|
+
info: a,
|
|
16
|
+
locale: n,
|
|
17
|
+
rowHeight: o
|
|
17
18
|
}),
|
|
18
19
|
fixedLeft: e
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
|
-
function u({ info: e, rowHeight:
|
|
22
|
-
const
|
|
23
|
-
return /* @__PURE__ */
|
|
22
|
+
function u({ info: e, locale: o, rowHeight: n }) {
|
|
23
|
+
const a = e.row.getCanExpand(), i = e.row.isExpanded();
|
|
24
|
+
return /* @__PURE__ */ r("div", {
|
|
24
25
|
className: "flex w-full items-center justify-center",
|
|
25
|
-
style: { height:
|
|
26
|
-
children: /* @__PURE__ */
|
|
26
|
+
style: { height: n ?? "auto" },
|
|
27
|
+
children: /* @__PURE__ */ r(d, {
|
|
27
28
|
dataTest: "expand-text-button",
|
|
28
|
-
"aria-label":
|
|
29
|
+
"aria-label": o === "no" ? i ? `Skjul full tekst for rad ${e.row.index + 1}` : `Vis full tekst for rad ${e.row.index + 1}` : i ? `Collapse full text for row ${e.row.index + 1}` : `Show full text for row ${e.row.index + 1}`,
|
|
29
30
|
size: "small",
|
|
30
31
|
variant: "textGray",
|
|
31
32
|
onClick: (t) => {
|
|
32
|
-
t.stopPropagation(),
|
|
33
|
+
t.stopPropagation(), a && e.row.getToggleExpandedHandler()(), e.row.toggleExpand();
|
|
33
34
|
},
|
|
34
35
|
onMouseDown: (t) => {
|
|
35
36
|
t.preventDefault(), t.stopPropagation();
|
|
@@ -37,12 +38,12 @@ function u({ info: e, rowHeight: r }) {
|
|
|
37
38
|
onMouseUp: (t) => {
|
|
38
39
|
t.preventDefault(), t.stopPropagation();
|
|
39
40
|
},
|
|
40
|
-
startIcon: /* @__PURE__ */
|
|
41
|
+
startIcon: /* @__PURE__ */ r(s, {
|
|
41
42
|
className: "block size-5 shrink-0",
|
|
42
43
|
width: 20,
|
|
43
44
|
height: 20,
|
|
44
45
|
style: {
|
|
45
|
-
transform:
|
|
46
|
+
transform: i ? "rotate(180deg)" : "rotate(0deg)",
|
|
46
47
|
transformBox: "fill-box",
|
|
47
48
|
transformOrigin: "center",
|
|
48
49
|
transitionProperty: "transform",
|
|
@@ -55,5 +56,5 @@ function u({ info: e, rowHeight: r }) {
|
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
export {
|
|
58
|
-
|
|
59
|
+
c as generateShowFullTextColumn
|
|
59
60
|
};
|
|
@@ -4,17 +4,17 @@ import { generateExpandColumn as h } from "../components/columns/expandColumn.js
|
|
|
4
4
|
import { generateActionsColumn as x } from "../components/columns/action-column/actionColumn.js";
|
|
5
5
|
import { generateDndHandleColumn as _ } from "../components/columns/dndHandleColumn.js";
|
|
6
6
|
import { generateShowFullTextColumn as A } from "../components/columns/showTextColumn.js";
|
|
7
|
-
var T = (
|
|
8
|
-
const { actions:
|
|
9
|
-
return !n.find((o) => o.id === "actions") && (
|
|
10
|
-
headerPin:
|
|
11
|
-
actions:
|
|
12
|
-
customActionsNode:
|
|
7
|
+
var T = (r) => {
|
|
8
|
+
const { actions: m, customActionsNode: d, headerPin: s = !0, enableRowSelection: u, expandArrow: f, enableDnd: c, customDndColumnProps: a, rowHeight: e, textExpandArrow: l, customActionsColumnProps: p, rowActionsState: C, locale: t } = r, n = [...r.columns], i = n.some((o) => o.fixedLeft === !0);
|
|
9
|
+
return !n.find((o) => o.id === "actions") && (m || d || s) && n.push(x({
|
|
10
|
+
headerPin: s,
|
|
11
|
+
actions: m,
|
|
12
|
+
customActionsNode: d,
|
|
13
13
|
rowHeight: e,
|
|
14
14
|
customActionsColumnProps: p,
|
|
15
15
|
rowActionsState: C,
|
|
16
|
-
locale:
|
|
17
|
-
})),
|
|
16
|
+
locale: t
|
|
17
|
+
})), l && !n.find((o) => o.id === "show-full-text") && n.unshift(A(i, e, t)), f && !l && !n.find((o) => o.id === "expand-column-id") && n.unshift(h(i, e, t)), c && !n.find((o) => o.id === "dnd-handle") && n.unshift(_(a, e, t)), u && !n.find((o) => o.id === "select") && n.unshift(D(i, e, t)), n;
|
|
18
18
|
};
|
|
19
19
|
export {
|
|
20
20
|
T as injectColumns
|