asma-ui-core 3.101.7 → 3.103.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.
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/custom/module/header-layout/ToolbarActionGroup.js +30 -30
- package/dist/components/inputs/input-field/StyledInputField.js +177 -150
- package/dist/components/inputs/input-field/StyledInputField.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/inputs/input-field/StyledInputField.d.ts +3 -2
- package/dist/src/components/navigation/menu/StyledMenuItem.d.ts +9 -5
- package/package.json +1 -1
|
@@ -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
|
};
|
|
@@ -87,8 +87,9 @@ export interface StyledInputFieldProps {
|
|
|
87
87
|
* own focus/value state to drive the shared field styling ([[field-styles]]); supports multiline,
|
|
88
88
|
* start/end adornments, an optional clear button, and error/helper text. Public props preserved
|
|
89
89
|
*
|
|
90
|
-
* ponytail: `variant` is accepted but always renders outlined
|
|
91
|
-
*
|
|
90
|
+
* ponytail: `variant` is accepted but always renders outlined — a known ceiling; Chromatic in CI is
|
|
91
|
+
* the visual gate. Multiline auto-grows between `minRows` and `maxRows` (a fixed `rows` pins the height)
|
|
92
|
+
* and scrolls once the content exceeds the cap; `readOnly` ignores the cap and shows the whole value.
|
|
92
93
|
*/
|
|
93
94
|
export declare const StyledInputField: ({ dataTest, label, value, defaultValue, onChange, onBlur, onFocus, error, helperText, reserveHelperText, expandHelperText, disabled, readOnly, required, allowClear, onClear, type, placeholder, name, id, autoComplete, autoFocus, multiline, rows, minRows, maxRows, size, fullWidth, className, style, sx, inputRef, slotProps, InputProps, onKeyDown, onClick, variant: _variant, }: StyledInputFieldProps) => JSX.Element;
|
|
94
95
|
export {};
|
|
@@ -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;
|