@stackone/malachite 2.82.0 → 2.83.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.
@@ -1,15 +1,15 @@
1
1
  import { MENU_SPECS as r } from "./floatingMenuGeometry.js";
2
2
  import { injectStyleSheet as d } from "./injectStyleSheet.js";
3
3
  import { ensureOverlayStyles as S } from "./portalOverlay.js";
4
- import { SELECTED_ROW_BACKGROUND as s, SELECTED_ROW_FOREGROUND as h } from "./selectedRow.js";
5
- const w = {
4
+ import { SELECTED_ROW_FOREGROUND as s, SELECTED_ROW_BACKGROUND as h } from "./selectedRow.js";
5
+ const A = {
6
6
  small: { icon: 16, iconBox: "text-[16px] [&_svg]:size-[16px]!" },
7
7
  xsmall: { icon: 11, iconBox: "text-[11px] [&_svg]:size-[11px]!" }
8
8
  }, m = {
9
9
  minWidth: 0,
10
10
  overflow: "hidden",
11
11
  textOverflow: "ellipsis"
12
- }, A = {
12
+ }, C = {
13
13
  position: "absolute",
14
14
  width: 1,
15
15
  height: 1,
@@ -22,13 +22,13 @@ const w = {
22
22
  fontSize: "var(--malachite-font-size-small, 13px)",
23
23
  color: "var(--malachite-text-dimmed, rgb(161, 161, 161))",
24
24
  userSelect: "none"
25
- }, g = {
25
+ }, E = {
26
26
  ...u,
27
27
  color: "var(--malachite-text-secondary, rgb(123, 123, 123))",
28
28
  overflow: "hidden",
29
29
  textOverflow: "ellipsis",
30
30
  whiteSpace: "nowrap"
31
- }, $ = { color: "inherit", fontSize: "inherit" }, C = {
31
+ }, N = { color: "inherit", fontSize: "inherit" }, $ = {
32
32
  ...m,
33
33
  display: "flex",
34
34
  flexDirection: "column",
@@ -37,18 +37,18 @@ const w = {
37
37
  ...m,
38
38
  whiteSpace: "normal",
39
39
  fontSize: "var(--malachite-font-size-xsmall, 11px)"
40
- }, x = {
40
+ }, g = {
41
41
  ...i,
42
42
  color: "var(--malachite-text-secondary, rgb(123, 123, 123))"
43
- }, E = { ...i, color: "inherit" }, c = "malachite-actionmenu-item-description", D = (e) => e.danger === "hover" ? i : e.danger || e.current ? E : x, N = {
43
+ }, x = { ...i, color: "inherit" }, c = "malachite-actionmenu-item-description", D = (e) => e.danger === "hover" ? i : e.danger || e.current ? x : g, Y = {
44
44
  display: "inline-flex",
45
45
  flexShrink: 0,
46
46
  width: 14,
47
47
  marginLeft: "auto"
48
- }, _ = { display: "inline-flex", flexShrink: 0 }, Y = {
48
+ }, _ = { display: "inline-flex", flexShrink: 0 }, M = {
49
49
  ..._,
50
50
  color: "var(--malachite-text-dimmed, rgb(161, 161, 161))"
51
- }, l = "malachite-actionmenu-item-icon", a = "malachite-actionmenu-item", T = "data-malachite-actionmenu-tag", k = { display: "inline-flex", flexShrink: 0 }, M = { [T]: "" }, f = [
51
+ }, l = "malachite-actionmenu-item-icon", a = "malachite-actionmenu-item", T = "data-malachite-actionmenu-tag", k = { display: "inline-flex", flexShrink: 0 }, H = { [T]: "" }, f = [
52
52
  `.${a} { background: transparent; }`,
53
53
  `.${a}:not(:disabled):hover { background: var(--malachite-card-dimmed-background, rgb(247, 247, 247)); }`,
54
54
  `.${a}:focus-visible { outline: 2px solid var(--malachite-text-primary, rgb(10, 10, 10)); outline-offset: -2px; }`
@@ -56,20 +56,20 @@ const w = {
56
56
  `${t} { color: var(--malachite-text-primary, rgb(10, 10, 10)); }`,
57
57
  `${t}[data-tone="muted"] { color: var(--malachite-text-secondary, rgb(123, 123, 123)); }`,
58
58
  `${t} > .${l} { color: var(--malachite-text-dimmed, rgb(161, 161, 161)); }`,
59
- `${t}[aria-current] { color: ${h}; background: ${s}; }`,
59
+ `${t}[aria-current] { color: ${s}; background: ${h}; }`,
60
60
  `${n} { color: var(--malachite-text-destructive, rgb(237, 53, 54)); background: var(--malachite-error-background-glass, rgba(197, 63, 63, 0.08)); }`,
61
61
  `${n} > .${l} { color: inherit; }`,
62
62
  `${t}:not([aria-current]) .${c} { color: var(--malachite-text-secondary, rgb(123, 123, 123)); }`,
63
63
  `${n} .${c} { color: inherit; }`
64
- ], b = () => d("malachite-actionmenu-danger-hover-styles", v), H = () => (S(), b(), d("malachite-actionmenu-item-styles", f)), p = {
64
+ ], b = () => d("malachite-actionmenu-danger-hover-styles", v), z = () => (S(), b(), d("malachite-actionmenu-item-styles", f)), p = {
65
65
  default: "var(--malachite-text-primary, rgb(10, 10, 10))",
66
66
  muted: "var(--malachite-text-secondary, rgb(123, 123, 123))"
67
- }, y = (e, o) => {
67
+ }, O = (e, o) => {
68
68
  if (e.danger === !0)
69
69
  return "var(--malachite-text-destructive, rgb(237, 53, 54))";
70
70
  if (e.danger !== "hover")
71
- return e.current ? h : p[o];
72
- }, z = (e, o = "default") => e.type === "text" ? g : e.type === "divider" ? {
71
+ return e.current ? s : p[o];
72
+ }, G = (e, o = "default") => e.type === "text" ? E : e.type === "divider" ? {
73
73
  height: 1,
74
74
  background: "var(--malachite-card-border, rgb(232, 232, 232))",
75
75
  margin: "4px 0"
@@ -81,8 +81,8 @@ const w = {
81
81
  borderRadius: 8,
82
82
  fontSize: "var(--malachite-font-size-small, 13px)",
83
83
  fontWeight: 400,
84
- color: y(e, o),
85
- background: e.current && e.danger !== "hover" ? s : void 0,
84
+ color: O(e, o),
85
+ background: e.current && e.danger !== "hover" ? h : void 0,
86
86
  cursor: e.disabled ? "not-allowed" : "pointer",
87
87
  opacity: e.disabled ? 0.5 : 1,
88
88
  userSelect: "none",
@@ -93,7 +93,11 @@ const w = {
93
93
  textDecoration: "none",
94
94
  boxSizing: "border-box",
95
95
  width: "100%"
96
- }, G = (e) => ({
96
+ }, y = {
97
+ display: "flex",
98
+ flexDirection: "column",
99
+ gap: 2
100
+ }, P = (e) => ({
97
101
  position: "fixed",
98
102
  top: (e == null ? void 0 : e.top) ?? 0,
99
103
  left: (e == null ? void 0 : e.left) ?? 0,
@@ -105,33 +109,32 @@ const w = {
105
109
  borderRadius: r.options.radius,
106
110
  boxShadow: r.options.shadow,
107
111
  padding: r.options.padding,
108
- display: "flex",
109
- flexDirection: "column",
110
- gap: 2,
112
+ ...y,
111
113
  visibility: e ? "visible" : "hidden",
112
114
  opacity: e ? 1 : 0
113
115
  });
114
116
  export {
115
- N as CHECK_SLOT_STYLE,
117
+ Y as CHECK_SLOT_STYLE,
116
118
  c as DESCRIPTION_CLASS,
117
119
  u as EMPTY_ITEM_STYLE,
118
120
  a as ITEM_CLASS,
119
121
  l as ITEM_ICON_CLASS,
120
122
  _ as ITEM_ICON_LAYOUT,
121
- Y as ITEM_ICON_STYLE,
122
- C as ITEM_TEXT_STYLE,
123
+ M as ITEM_ICON_STYLE,
124
+ $ as ITEM_TEXT_STYLE,
123
125
  m as LABEL_STYLE,
126
+ y as MENU_COLUMN_STYLE,
124
127
  T as TAG_HOST_ATTR,
125
- M as TAG_HOST_PROPS,
128
+ H as TAG_HOST_PROPS,
126
129
  k as TAG_HOST_STYLE,
127
- $ as TEXT_ITEM_LABEL_STYLE,
128
- g as TEXT_ITEM_STYLE,
129
- w as TRIGGER_SIZES,
130
- A as VISUALLY_HIDDEN_STYLE,
130
+ N as TEXT_ITEM_LABEL_STYLE,
131
+ E as TEXT_ITEM_STYLE,
132
+ A as TRIGGER_SIZES,
133
+ C as VISUALLY_HIDDEN_STYLE,
131
134
  D as descriptionStyle,
132
- H as ensureActionMenuStyles,
135
+ z as ensureActionMenuStyles,
133
136
  b as ensureDangerOnHoverStyles,
134
- z as itemStyle,
135
- G as menuStyle
137
+ G as itemStyle,
138
+ P as menuStyle
136
139
  };
137
140
  //# sourceMappingURL=actionMenuStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"actionMenuStyles.js","sources":["../../src/components/actionMenuStyles.ts"],"sourcesContent":["import type React from 'react';\nimport type { ActionMenuItem } from './actionMenuTypes';\nimport { MENU_SPECS, type MenuGeometry } from './floatingMenuGeometry';\nimport { injectStyleSheet } from './injectStyleSheet';\nimport { ensureOverlayStyles } from './portalOverlay';\nimport { SELECTED_ROW_BACKGROUND, SELECTED_ROW_FOREGROUND } from './selectedRow';\n\nexport const TRIGGER_SIZES: Record<'small' | 'xsmall', { icon: number; iconBox: string }> = {\n small: { icon: 16, iconBox: 'text-[16px] [&_svg]:size-[16px]!' },\n xsmall: { icon: 11, iconBox: 'text-[11px] [&_svg]:size-[11px]!' },\n};\n\nexport const LABEL_STYLE: React.CSSProperties = {\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n};\n\n// Not `sr-only`: the menu portals outside the shadow root's stylesheet.\nexport const VISUALLY_HIDDEN_STYLE: React.CSSProperties = {\n position: 'absolute',\n width: 1,\n height: 1,\n margin: -1,\n overflow: 'hidden',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n};\n\nexport const EMPTY_ITEM_STYLE: React.CSSProperties = {\n padding: '6px 10px',\n fontSize: 'var(--malachite-font-size-small, 13px)',\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n userSelect: 'none',\n};\n\nexport const TEXT_ITEM_STYLE: React.CSSProperties = {\n ...EMPTY_ITEM_STYLE,\n color: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n};\n\nexport const TEXT_ITEM_LABEL_STYLE: React.CSSProperties = { color: 'inherit', fontSize: 'inherit' };\n\nexport const ITEM_TEXT_STYLE: React.CSSProperties = {\n ...LABEL_STYLE,\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n};\n\nconst DESCRIPTION_BASE: React.CSSProperties = {\n ...LABEL_STYLE,\n whiteSpace: 'normal',\n fontSize: 'var(--malachite-font-size-xsmall, 11px)',\n};\n\nconst DESCRIPTION_STYLE: React.CSSProperties = {\n ...DESCRIPTION_BASE,\n color: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n};\n\nconst ROW_DESCRIPTION_STYLE: React.CSSProperties = { ...DESCRIPTION_BASE, color: 'inherit' };\n\nexport const DESCRIPTION_CLASS = 'malachite-actionmenu-item-description';\n\nexport const descriptionStyle = (item: ActionItem): React.CSSProperties => {\n if (item.danger === 'hover') {\n return DESCRIPTION_BASE;\n }\n return item.danger || item.current ? ROW_DESCRIPTION_STYLE : DESCRIPTION_STYLE;\n};\n\nexport const CHECK_SLOT_STYLE: React.CSSProperties = {\n display: 'inline-flex',\n flexShrink: 0,\n width: 14,\n marginLeft: 'auto',\n};\n\nexport const ITEM_ICON_LAYOUT: React.CSSProperties = { display: 'inline-flex', flexShrink: 0 };\n\nexport const ITEM_ICON_STYLE: React.CSSProperties = {\n ...ITEM_ICON_LAYOUT,\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n};\n\nexport const ITEM_ICON_CLASS = 'malachite-actionmenu-item-icon';\n\nexport const ITEM_CLASS = 'malachite-actionmenu-item';\n\nexport const TAG_HOST_ATTR = 'data-malachite-actionmenu-tag' as const;\n\nexport const TAG_HOST_STYLE: React.CSSProperties = { display: 'inline-flex', flexShrink: 0 };\n\nexport const TAG_HOST_PROPS = { [TAG_HOST_ATTR]: '' };\n\nconst ITEM_RULES = [\n `.${ITEM_CLASS} { background: transparent; }`,\n `.${ITEM_CLASS}:not(:disabled):hover { background: var(--malachite-card-dimmed-background, rgb(247, 247, 247)); }`,\n `.${ITEM_CLASS}:focus-visible { outline: 2px solid var(--malachite-text-primary, rgb(10, 10, 10)); outline-offset: -2px; }`,\n];\n\nconst DANGER_ON_HOVER = `.${ITEM_CLASS}[data-danger=\"hover\"]`;\nconst DANGER_ON_HOVER_ACTIVE = `${DANGER_ON_HOVER}:not(:disabled):is(:hover, :focus-visible)`;\n\nconst DANGER_ON_HOVER_RULES = [\n `${DANGER_ON_HOVER} { color: var(--malachite-text-primary, rgb(10, 10, 10)); }`,\n `${DANGER_ON_HOVER}[data-tone=\"muted\"] { color: var(--malachite-text-secondary, rgb(123, 123, 123)); }`,\n `${DANGER_ON_HOVER} > .${ITEM_ICON_CLASS} { color: var(--malachite-text-dimmed, rgb(161, 161, 161)); }`,\n `${DANGER_ON_HOVER}[aria-current] { color: ${SELECTED_ROW_FOREGROUND}; background: ${SELECTED_ROW_BACKGROUND}; }`,\n `${DANGER_ON_HOVER_ACTIVE} { color: var(--malachite-text-destructive, rgb(237, 53, 54)); background: var(--malachite-error-background-glass, rgba(197, 63, 63, 0.08)); }`,\n `${DANGER_ON_HOVER_ACTIVE} > .${ITEM_ICON_CLASS} { color: inherit; }`,\n `${DANGER_ON_HOVER}:not([aria-current]) .${DESCRIPTION_CLASS} { color: var(--malachite-text-secondary, rgb(123, 123, 123)); }`,\n `${DANGER_ON_HOVER_ACTIVE} .${DESCRIPTION_CLASS} { color: inherit; }`,\n];\n\nexport const ensureDangerOnHoverStyles = (): CSSStyleSheet | null =>\n injectStyleSheet('malachite-actionmenu-danger-hover-styles', DANGER_ON_HOVER_RULES);\n\nexport const ensureActionMenuStyles = (): CSSStyleSheet | null => {\n ensureOverlayStyles();\n ensureDangerOnHoverStyles();\n return injectStyleSheet('malachite-actionmenu-item-styles', ITEM_RULES);\n};\n\nexport type ActionMenuTone = 'default' | 'muted';\n\nconst ITEM_TEXT: Record<ActionMenuTone, string> = {\n default: 'var(--malachite-text-primary, rgb(10, 10, 10))',\n muted: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n};\n\ntype ActionItem = Exclude<ActionMenuItem, { type: 'text' } | { type: 'divider' }>;\n\nconst actionItemColor = (item: ActionItem, tone: ActionMenuTone): string | undefined => {\n if (item.danger === true) {\n return 'var(--malachite-text-destructive, rgb(237, 53, 54))';\n }\n if (item.danger === 'hover') {\n return undefined;\n }\n if (item.current) {\n return SELECTED_ROW_FOREGROUND;\n }\n return ITEM_TEXT[tone];\n};\n\nexport const itemStyle = (\n item: ActionMenuItem,\n tone: ActionMenuTone = 'default',\n): React.CSSProperties => {\n if (item.type === 'text') {\n return TEXT_ITEM_STYLE;\n }\n if (item.type === 'divider') {\n return {\n height: 1,\n background: 'var(--malachite-card-border, rgb(232, 232, 232))',\n margin: '4px 0',\n };\n }\n return {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n padding: '6px 10px',\n borderRadius: 8,\n fontSize: 'var(--malachite-font-size-small, 13px)',\n fontWeight: 400,\n color: actionItemColor(item, tone),\n background: item.current && item.danger !== 'hover' ? SELECTED_ROW_BACKGROUND : undefined,\n cursor: item.disabled ? 'not-allowed' : 'pointer',\n opacity: item.disabled ? 0.5 : 1,\n userSelect: 'none',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n border: 'none',\n textAlign: 'left',\n textDecoration: 'none',\n boxSizing: 'border-box',\n width: '100%',\n };\n};\n\nexport const menuStyle = (position: MenuGeometry | null): React.CSSProperties => ({\n position: 'fixed',\n top: position?.top ?? 0,\n left: position?.left ?? 0,\n width: position?.width,\n maxHeight: position?.maxHeight,\n overflowY: 'auto',\n background: MENU_SPECS.options.background,\n border: MENU_SPECS.options.border,\n borderRadius: MENU_SPECS.options.radius,\n boxShadow: MENU_SPECS.options.shadow,\n padding: MENU_SPECS.options.padding,\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n visibility: position ? 'visible' : 'hidden',\n opacity: position ? 1 : 0,\n});\n"],"names":["TRIGGER_SIZES","LABEL_STYLE","VISUALLY_HIDDEN_STYLE","EMPTY_ITEM_STYLE","TEXT_ITEM_STYLE","TEXT_ITEM_LABEL_STYLE","ITEM_TEXT_STYLE","DESCRIPTION_BASE","DESCRIPTION_STYLE","ROW_DESCRIPTION_STYLE","DESCRIPTION_CLASS","descriptionStyle","item","CHECK_SLOT_STYLE","ITEM_ICON_LAYOUT","ITEM_ICON_STYLE","ITEM_ICON_CLASS","ITEM_CLASS","TAG_HOST_ATTR","TAG_HOST_STYLE","TAG_HOST_PROPS","ITEM_RULES","DANGER_ON_HOVER","DANGER_ON_HOVER_ACTIVE","DANGER_ON_HOVER_RULES","SELECTED_ROW_FOREGROUND","SELECTED_ROW_BACKGROUND","ensureDangerOnHoverStyles","injectStyleSheet","ensureActionMenuStyles","ensureOverlayStyles","ITEM_TEXT","actionItemColor","tone","itemStyle","menuStyle","position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WA,EAAK,WAAW,UAAUc,IAA0B;AAAA,EAChF,QAAQd,EAAK,WAAW,gBAAgB;AAAA,EACxC,SAASA,EAAK,WAAW,MAAM;AAAA,EAC/B,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,WAAW;AAAA,EACX,OAAO;AAAA,GAIFuB,IAAY,CAACC,OAAwD;AAAA,EAC9E,UAAU;AAAA,EACV,MAAKA,KAAA,gBAAAA,EAAU,QAAO;AAAA,EACtB,OAAMA,KAAA,gBAAAA,EAAU,SAAQ;AAAA,EACxB,OAAOA,KAAA,gBAAAA,EAAU;AAAA,EACjB,WAAWA,KAAA,gBAAAA,EAAU;AAAA,EACrB,WAAW;AAAA,EACX,YAAYC,EAAW,QAAQ;AAAA,EAC/B,QAAQA,EAAW,QAAQ;AAAA,EAC3B,cAAcA,EAAW,QAAQ;AAAA,EACjC,WAAWA,EAAW,QAAQ;AAAA,EAC9B,SAASA,EAAW,QAAQ;AAAA,EAC5B,SAAS;AAAA,EACT,eAAe;AAAA,EACf,KAAK;AAAA,EACL,YAAYD,IAAW,YAAY;AAAA,EACnC,SAASA,IAAW,IAAI;AAC5B;"}
1
+ {"version":3,"file":"actionMenuStyles.js","sources":["../../src/components/actionMenuStyles.ts"],"sourcesContent":["import type React from 'react';\nimport type { ActionMenuItem } from './actionMenuTypes';\nimport { MENU_SPECS, type MenuGeometry } from './floatingMenuGeometry';\nimport { injectStyleSheet } from './injectStyleSheet';\nimport { ensureOverlayStyles } from './portalOverlay';\nimport { SELECTED_ROW_BACKGROUND, SELECTED_ROW_FOREGROUND } from './selectedRow';\n\nexport const TRIGGER_SIZES: Record<'small' | 'xsmall', { icon: number; iconBox: string }> = {\n small: { icon: 16, iconBox: 'text-[16px] [&_svg]:size-[16px]!' },\n xsmall: { icon: 11, iconBox: 'text-[11px] [&_svg]:size-[11px]!' },\n};\n\nexport const LABEL_STYLE: React.CSSProperties = {\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n};\n\n// Not `sr-only`: the menu portals outside the shadow root's stylesheet.\nexport const VISUALLY_HIDDEN_STYLE: React.CSSProperties = {\n position: 'absolute',\n width: 1,\n height: 1,\n margin: -1,\n overflow: 'hidden',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n};\n\nexport const EMPTY_ITEM_STYLE: React.CSSProperties = {\n padding: '6px 10px',\n fontSize: 'var(--malachite-font-size-small, 13px)',\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n userSelect: 'none',\n};\n\nexport const TEXT_ITEM_STYLE: React.CSSProperties = {\n ...EMPTY_ITEM_STYLE,\n color: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n};\n\nexport const TEXT_ITEM_LABEL_STYLE: React.CSSProperties = { color: 'inherit', fontSize: 'inherit' };\n\nexport const ITEM_TEXT_STYLE: React.CSSProperties = {\n ...LABEL_STYLE,\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n};\n\nconst DESCRIPTION_BASE: React.CSSProperties = {\n ...LABEL_STYLE,\n whiteSpace: 'normal',\n fontSize: 'var(--malachite-font-size-xsmall, 11px)',\n};\n\nconst DESCRIPTION_STYLE: React.CSSProperties = {\n ...DESCRIPTION_BASE,\n color: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n};\n\nconst ROW_DESCRIPTION_STYLE: React.CSSProperties = { ...DESCRIPTION_BASE, color: 'inherit' };\n\nexport const DESCRIPTION_CLASS = 'malachite-actionmenu-item-description';\n\nexport const descriptionStyle = (item: ActionItem): React.CSSProperties => {\n if (item.danger === 'hover') {\n return DESCRIPTION_BASE;\n }\n return item.danger || item.current ? ROW_DESCRIPTION_STYLE : DESCRIPTION_STYLE;\n};\n\nexport const CHECK_SLOT_STYLE: React.CSSProperties = {\n display: 'inline-flex',\n flexShrink: 0,\n width: 14,\n marginLeft: 'auto',\n};\n\nexport const ITEM_ICON_LAYOUT: React.CSSProperties = { display: 'inline-flex', flexShrink: 0 };\n\nexport const ITEM_ICON_STYLE: React.CSSProperties = {\n ...ITEM_ICON_LAYOUT,\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n};\n\nexport const ITEM_ICON_CLASS = 'malachite-actionmenu-item-icon';\n\nexport const ITEM_CLASS = 'malachite-actionmenu-item';\n\nexport const TAG_HOST_ATTR = 'data-malachite-actionmenu-tag' as const;\n\nexport const TAG_HOST_STYLE: React.CSSProperties = { display: 'inline-flex', flexShrink: 0 };\n\nexport const TAG_HOST_PROPS = { [TAG_HOST_ATTR]: '' };\n\nconst ITEM_RULES = [\n `.${ITEM_CLASS} { background: transparent; }`,\n `.${ITEM_CLASS}:not(:disabled):hover { background: var(--malachite-card-dimmed-background, rgb(247, 247, 247)); }`,\n `.${ITEM_CLASS}:focus-visible { outline: 2px solid var(--malachite-text-primary, rgb(10, 10, 10)); outline-offset: -2px; }`,\n];\n\nconst DANGER_ON_HOVER = `.${ITEM_CLASS}[data-danger=\"hover\"]`;\nconst DANGER_ON_HOVER_ACTIVE = `${DANGER_ON_HOVER}:not(:disabled):is(:hover, :focus-visible)`;\n\nconst DANGER_ON_HOVER_RULES = [\n `${DANGER_ON_HOVER} { color: var(--malachite-text-primary, rgb(10, 10, 10)); }`,\n `${DANGER_ON_HOVER}[data-tone=\"muted\"] { color: var(--malachite-text-secondary, rgb(123, 123, 123)); }`,\n `${DANGER_ON_HOVER} > .${ITEM_ICON_CLASS} { color: var(--malachite-text-dimmed, rgb(161, 161, 161)); }`,\n `${DANGER_ON_HOVER}[aria-current] { color: ${SELECTED_ROW_FOREGROUND}; background: ${SELECTED_ROW_BACKGROUND}; }`,\n `${DANGER_ON_HOVER_ACTIVE} { color: var(--malachite-text-destructive, rgb(237, 53, 54)); background: var(--malachite-error-background-glass, rgba(197, 63, 63, 0.08)); }`,\n `${DANGER_ON_HOVER_ACTIVE} > .${ITEM_ICON_CLASS} { color: inherit; }`,\n `${DANGER_ON_HOVER}:not([aria-current]) .${DESCRIPTION_CLASS} { color: var(--malachite-text-secondary, rgb(123, 123, 123)); }`,\n `${DANGER_ON_HOVER_ACTIVE} .${DESCRIPTION_CLASS} { color: inherit; }`,\n];\n\nexport const ensureDangerOnHoverStyles = (): CSSStyleSheet | null =>\n injectStyleSheet('malachite-actionmenu-danger-hover-styles', DANGER_ON_HOVER_RULES);\n\nexport const ensureActionMenuStyles = (): CSSStyleSheet | null => {\n ensureOverlayStyles();\n ensureDangerOnHoverStyles();\n return injectStyleSheet('malachite-actionmenu-item-styles', ITEM_RULES);\n};\n\nexport type ActionMenuTone = 'default' | 'muted';\n\nconst ITEM_TEXT: Record<ActionMenuTone, string> = {\n default: 'var(--malachite-text-primary, rgb(10, 10, 10))',\n muted: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n};\n\ntype ActionItem = Exclude<ActionMenuItem, { type: 'text' } | { type: 'divider' }>;\n\nconst actionItemColor = (item: ActionItem, tone: ActionMenuTone): string | undefined => {\n if (item.danger === true) {\n return 'var(--malachite-text-destructive, rgb(237, 53, 54))';\n }\n if (item.danger === 'hover') {\n return undefined;\n }\n if (item.current) {\n return SELECTED_ROW_FOREGROUND;\n }\n return ITEM_TEXT[tone];\n};\n\nexport const itemStyle = (\n item: ActionMenuItem,\n tone: ActionMenuTone = 'default',\n): React.CSSProperties => {\n if (item.type === 'text') {\n return TEXT_ITEM_STYLE;\n }\n if (item.type === 'divider') {\n return {\n height: 1,\n background: 'var(--malachite-card-border, rgb(232, 232, 232))',\n margin: '4px 0',\n };\n }\n return {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n padding: '6px 10px',\n borderRadius: 8,\n fontSize: 'var(--malachite-font-size-small, 13px)',\n fontWeight: 400,\n color: actionItemColor(item, tone),\n background: item.current && item.danger !== 'hover' ? SELECTED_ROW_BACKGROUND : undefined,\n cursor: item.disabled ? 'not-allowed' : 'pointer',\n opacity: item.disabled ? 0.5 : 1,\n userSelect: 'none',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n border: 'none',\n textAlign: 'left',\n textDecoration: 'none',\n boxSizing: 'border-box',\n width: '100%',\n };\n};\n\n// The menu's rows, and a set of choices among them, stack the same way.\nexport const MENU_COLUMN_STYLE: React.CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n};\n\nexport const menuStyle = (position: MenuGeometry | null): React.CSSProperties => ({\n position: 'fixed',\n top: position?.top ?? 0,\n left: position?.left ?? 0,\n width: position?.width,\n maxHeight: position?.maxHeight,\n overflowY: 'auto',\n background: MENU_SPECS.options.background,\n border: MENU_SPECS.options.border,\n borderRadius: MENU_SPECS.options.radius,\n boxShadow: MENU_SPECS.options.shadow,\n padding: MENU_SPECS.options.padding,\n ...MENU_COLUMN_STYLE,\n visibility: position ? 'visible' : 'hidden',\n opacity: position ? 1 : 0,\n});\n"],"names":["TRIGGER_SIZES","LABEL_STYLE","VISUALLY_HIDDEN_STYLE","EMPTY_ITEM_STYLE","TEXT_ITEM_STYLE","TEXT_ITEM_LABEL_STYLE","ITEM_TEXT_STYLE","DESCRIPTION_BASE","DESCRIPTION_STYLE","ROW_DESCRIPTION_STYLE","DESCRIPTION_CLASS","descriptionStyle","item","CHECK_SLOT_STYLE","ITEM_ICON_LAYOUT","ITEM_ICON_STYLE","ITEM_ICON_CLASS","ITEM_CLASS","TAG_HOST_ATTR","TAG_HOST_STYLE","TAG_HOST_PROPS","ITEM_RULES","DANGER_ON_HOVER","DANGER_ON_HOVER_ACTIVE","DANGER_ON_HOVER_RULES","SELECTED_ROW_FOREGROUND","SELECTED_ROW_BACKGROUND","ensureDangerOnHoverStyles","injectStyleSheet","ensureActionMenuStyles","ensureOverlayStyles","ITEM_TEXT","actionItemColor","tone","itemStyle","MENU_COLUMN_STYLE","menuStyle","position","MENU_SPECS"],"mappings":";;;;AAOO,MAAMA,IAA+E;AAAA,EACxF,OAAO,EAAE,MAAM,I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EACxC,SAASA,EAAK,WAAW,MAAM;AAAA,EAC/B,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,WAAW;AAAA,EACX,OAAO;AAAA,GAKFuB,IAAyC;AAAA,EAClD,SAAS;AAAA,EACT,eAAe;AAAA,EACf,KAAK;AACT,GAEaC,IAAY,CAACC,OAAwD;AAAA,EAC9E,UAAU;AAAA,EACV,MAAKA,KAAA,gBAAAA,EAAU,QAAO;AAAA,EACtB,OAAMA,KAAA,gBAAAA,EAAU,SAAQ;AAAA,EACxB,OAAOA,KAAA,gBAAAA,EAAU;AAAA,EACjB,WAAWA,KAAA,gBAAAA,EAAU;AAAA,EACrB,WAAW;AAAA,EACX,YAAYC,EAAW,QAAQ;AAAA,EAC/B,QAAQA,EAAW,QAAQ;AAAA,EAC3B,cAAcA,EAAW,QAAQ;AAAA,EACjC,WAAWA,EAAW,QAAQ;AAAA,EAC9B,SAASA,EAAW,QAAQ;AAAA,EAC5B,GAAGH;AAAA,EACH,YAAYE,IAAW,YAAY;AAAA,EACnC,SAASA,IAAW,IAAI;AAC5B;"}
package/dist/index.d.ts CHANGED
@@ -150,6 +150,8 @@ export declare type ActionMenuItem = {
150
150
  current?: boolean;
151
151
  /** One of a set of choices: a `menuitemradio` with a check while true. */
152
152
  checked?: boolean;
153
+ /** On a choice (`checked` set): names its set; only consecutive choices sharing it are grouped. */
154
+ group?: string;
153
155
  /** A quieter second line, read as the item's description. */
154
156
  description?: default_2.ReactNode;
155
157
  } | {
@@ -1240,7 +1242,7 @@ export declare interface ConfirmationDialogProps {
1240
1242
  message: string;
1241
1243
  };
1242
1244
  /**
1243
- * Requires this exact phrase to be typed before the confirm action enables — for a
1245
+ * Requires this phrase, ends trimmed, to be typed before the confirm action enables — for a
1244
1246
  * consequence severe enough that a single click should not be able to cause it.
1245
1247
  */
1246
1248
  confirmPhrase?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackone/malachite",
3
- "version": "2.82.0",
3
+ "version": "2.83.1",
4
4
  "description": "StackOne's themeable React component library — Shadow DOM isolated, scoped Tailwind, theme-token driven.",
5
5
  "license": "MIT",
6
6
  "author": "StackOne",