@stackone/malachite 2.69.0 → 2.71.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.
@@ -1,56 +1,57 @@
1
- import { jsxs as M, jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as T, useState as Z, useRef as A, useMemo as B } from "react";
3
- import D from "./CustomIcons/DismissIcon.js";
4
- import P from "./CustomIcons/SearchIcon.js";
5
- import { composeRefs as z } from "./composeRefs.js";
6
- import { CONTROL_TEXT_SIZE_CLASS as G } from "./controlTextSize.js";
7
- import { controlWidthStyle as L } from "./controlWidth.js";
1
+ import { jsxs as A, jsx as a } from "react/jsx-runtime";
2
+ import { forwardRef as B, useState as D, useRef as M, useMemo as Z } from "react";
3
+ import z from "./CustomIcons/DismissIcon.js";
4
+ import L from "./CustomIcons/SearchIcon.js";
5
+ import { composeRefs as P } from "./composeRefs.js";
6
+ import { CONTROL_TEXT_SIZE_CLASS as X } from "./controlTextSize.js";
7
+ import { controlWidthStyle as G } from "./controlWidth.js";
8
8
  import { FOCUS_RING as U } from "./focusRing.js";
9
- const W = {
9
+ const W = "text-[length:var(--malachite-font-size-medium,14px)]", Y = {
10
10
  small: "h-[var(--malachite-control-height-small,28px)] gap-[6px] px-[10px] rounded-[var(--malachite-radius-10,10px)]",
11
11
  medium: "h-[var(--malachite-control-height-medium,32px)] gap-[10px] px-[10px] rounded-xl",
12
12
  large: "h-[var(--malachite-control-height-large,42px)] gap-[12px] px-[12px] rounded-[var(--malachite-radius-xxl,14px)]"
13
- }, X = 15, q = (c) => c.preventDefault(), te = T(function({
13
+ }, q = 15, H = (c) => c.preventDefault(), oe = B(function({
14
14
  value: s,
15
15
  onChange: n,
16
16
  placeholder: i,
17
17
  size: p = "large",
18
18
  variant: g = "default",
19
+ textSize: S = "control",
19
20
  disabled: t = !1,
20
- autoFocus: S = !1,
21
- className: C = "",
22
- width: y,
23
- style: $,
24
- clearable: E = !1,
21
+ autoFocus: C = !1,
22
+ className: y = "",
23
+ width: $,
24
+ style: E,
25
+ clearable: I = !1,
25
26
  onClear: o,
26
27
  onKeyDown: l,
27
28
  "aria-label": m,
28
29
  "aria-labelledby": d
29
30
  }, h) {
30
- const [x, u] = Z(!1), f = A(null), I = B(() => z(h, f), [h]), b = E && s.length > 0 && !t, v = () => {
31
+ const [x, u] = D(!1), f = M(null), _ = Z(() => P(h, f), [h]), b = I && s.length > 0 && !t, v = () => {
31
32
  var e;
32
33
  n(""), o == null || o(), (e = f.current) == null || e.focus();
33
34
  }, k = (e) => {
34
35
  l == null || l(e);
35
36
  const j = e.nativeEvent.isComposing || e.nativeEvent.keyCode === 229;
36
37
  e.key !== "Escape" || e.defaultPrevented || j || !b || (e.preventDefault(), e.stopPropagation(), v());
37
- }, r = g === "muted", w = r ? "bg-[var(--malachite-card-border)]" : "bg-[var(--malachite-card-background)]", N = r ? "border-transparent" : "border-[var(--malachite-card-border)]", R = t ? "" : "hover:border-[var(--malachite-text-placeholder)]", _ = r ? "text-[var(--malachite-text-secondary)]" : "text-[var(--malachite-text-placeholder)]", F = r ? "placeholder:text-[var(--malachite-text-secondary)]" : "placeholder:text-[var(--malachite-text-placeholder)]", O = r ? "none" : x ? "var(--malachite-shadow-accent, 0px 1px 0px 0px rgba(0, 175, 102, 0.15))" : "0px 1px 1px 0px rgba(0, 0, 0, 0.15)";
38
- return /* @__PURE__ */ M(
38
+ }, r = g === "muted", w = r ? "bg-[var(--malachite-card-border)]" : "bg-[var(--malachite-card-background)]", N = r ? "border-transparent" : "border-[var(--malachite-card-border)]", R = t ? "" : "hover:border-[var(--malachite-text-placeholder)]", O = r ? "text-[var(--malachite-text-secondary)]" : "text-[var(--malachite-text-placeholder)]", T = r ? "placeholder:text-[var(--malachite-text-secondary)]" : "placeholder:text-[var(--malachite-text-placeholder)]", F = r ? "none" : x ? "var(--malachite-shadow-accent, 0px 1px 0px 0px rgba(0, 175, 102, 0.15))" : "0px 1px 1px 0px rgba(0, 0, 0, 0.15)";
39
+ return /* @__PURE__ */ A(
39
40
  "div",
40
41
  {
41
- className: `w-full ${w} border border-solid ${N} ${R} transition-colors flex items-center ${W[p]} ${t ? "opacity-60 cursor-not-allowed" : ""} ${C}`,
42
+ className: `w-full ${w} border border-solid ${N} ${R} transition-colors flex items-center ${Y[p]} ${t ? "opacity-60 cursor-not-allowed" : ""} ${y}`,
42
43
  style: {
43
- boxShadow: O,
44
+ boxShadow: F,
44
45
  borderColor: x ? "var(--malachite-control-border-hover, rgba(0, 175, 102, 0.4))" : void 0,
45
- ...L(y),
46
- ...$
46
+ ...G($),
47
+ ...E
47
48
  },
48
49
  children: [
49
- /* @__PURE__ */ a(P, { size: X, className: `${_} shrink-0` }),
50
+ /* @__PURE__ */ a(L, { size: q, className: `${O} shrink-0` }),
50
51
  /* @__PURE__ */ a(
51
52
  "input",
52
53
  {
53
- ref: I,
54
+ ref: _,
54
55
  type: "text",
55
56
  value: s,
56
57
  onChange: (e) => n(e.target.value),
@@ -61,8 +62,8 @@ const W = {
61
62
  "aria-label": d ? m : m ?? i ?? "Search",
62
63
  "aria-labelledby": d,
63
64
  disabled: t,
64
- autoFocus: S,
65
- className: `flex-1 bg-transparent border-none outline-none ${G[p]} font-medium text-[var(--malachite-text-primary)] ${F} placeholder:font-medium disabled:cursor-not-allowed min-w-0`
65
+ autoFocus: C,
66
+ className: `flex-1 bg-transparent border-none outline-none ${S === "body" ? W : X[p]} font-medium text-[var(--malachite-text-primary)] ${T} placeholder:font-medium disabled:cursor-not-allowed min-w-0`
66
67
  }
67
68
  ),
68
69
  b && /* @__PURE__ */ a(
@@ -70,10 +71,10 @@ const W = {
70
71
  {
71
72
  type: "button",
72
73
  "aria-label": "Clear search",
73
- onMouseDown: q,
74
+ onMouseDown: H,
74
75
  onClick: v,
75
76
  className: `shrink-0 flex items-center justify-center w-6 h-6 -mr-[5px] bg-transparent border-none rounded text-[var(--malachite-text-placeholder)] hover:text-[var(--malachite-text-primary)] cursor-pointer ${U}`,
76
- children: /* @__PURE__ */ a(D, { size: 10 })
77
+ children: /* @__PURE__ */ a(z, { size: 10 })
77
78
  }
78
79
  )
79
80
  ]
@@ -81,7 +82,7 @@ const W = {
81
82
  );
82
83
  });
83
84
  export {
84
- te as Search,
85
- te as default
85
+ oe as Search,
86
+ oe as default
86
87
  };
87
88
  //# sourceMappingURL=Search.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Search.js","sources":["../../src/components/Search.tsx"],"sourcesContent":["import React, { forwardRef, useMemo, useRef, useState } from 'react';\nimport DismissIcon from './CustomIcons/DismissIcon';\nimport SearchIcon from './CustomIcons/SearchIcon';\nimport { composeRefs } from './composeRefs';\nimport { CONTROL_TEXT_SIZE_CLASS } from './controlTextSize';\nimport { controlWidthStyle } from './controlWidth';\nimport { FOCUS_RING } from './focusRing';\n\nexport type SearchSize = 'small' | 'medium' | 'large';\nexport type SearchVariant = 'default' | 'muted';\n\n// Figma \"Search Element - Standard\": Small 28px, Medium 32px, Large 42px, with the radius\n// tracking the tier (10/12/14) and the icon staying 15px throughout.\nconst SIZE_CLASSES: Record<SearchSize, string> = {\n small: 'h-[var(--malachite-control-height-small,28px)] gap-[6px] px-[10px] rounded-[var(--malachite-radius-10,10px)]',\n medium: 'h-[var(--malachite-control-height-medium,32px)] gap-[10px] px-[10px] rounded-xl',\n large: 'h-[var(--malachite-control-height-large,42px)] gap-[12px] px-[12px] rounded-[var(--malachite-radius-xxl,14px)]',\n};\n\nconst ICON_SIZE = 15;\n\nexport interface SearchProps {\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n /** 'large' (42px) for form inputs; 'medium' (32px) for toolbars; 'small' (28px) in a table. */\n size?: SearchSize;\n variant?: SearchVariant;\n disabled?: boolean;\n autoFocus?: boolean;\n className?: string;\n width?: string | number;\n style?: React.CSSProperties;\n /**\n * Shows a clear button while the field has text, and lets Escape clear it. Either way focus\n * stays in the field, and Escape that clears is not also passed to a surrounding panel.\n */\n clearable?: boolean;\n /** Called after `onChange('')` when the clear button or Escape empties the field. */\n onClear?: () => void;\n /** Runs before Search's own Escape handling; call `preventDefault()` to skip it. */\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n /** The field's accessible name. Falls back to the placeholder, then \"Search\". */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\nconst keepFocus = (event: React.MouseEvent) => event.preventDefault();\n\n/** Forwards a ref to the input, so a consumer can focus the field. */\nconst Search = forwardRef<HTMLInputElement, SearchProps>(function Search(\n {\n value,\n onChange,\n placeholder,\n size = 'large',\n variant = 'default',\n disabled = false,\n autoFocus = false,\n className = '',\n width,\n style,\n clearable = false,\n onClear,\n onKeyDown,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n },\n ref,\n) {\n const [focused, setFocused] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n const setInputRef = useMemo(() => composeRefs(ref, inputRef), [ref]);\n const canClear = clearable && value.length > 0 && !disabled;\n\n const clear = () => {\n onChange('');\n onClear?.();\n inputRef.current?.focus();\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n // Escape mid-composition cancels the IME's candidate text, not the query.\n const composing = event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229;\n if (event.key !== 'Escape' || event.defaultPrevented || composing || !canClear) {\n return;\n }\n // Both, as Dropdown does: an ancestor's own onKeyDown runs before the escape layers.\n event.preventDefault();\n event.stopPropagation();\n clear();\n };\n const isMuted = variant === 'muted';\n\n // Muted variant: a borderless search that sits on a surface (no shadow). Default:\n // white field with border + subtle shadow. Both keep a visible focus border.\n // The fill is the Border colour by design; the dimmed grey vanishes on a sunken page.\n const bgClass = isMuted\n ? 'bg-[var(--malachite-card-border)]'\n : 'bg-[var(--malachite-card-background)]';\n const restingBorderClass = isMuted\n ? 'border-transparent'\n : 'border-[var(--malachite-card-border)]';\n // Hover darkens the border; focus (inline below) takes precedence.\n const hoverBorderClass = disabled ? '' : 'hover:border-[var(--malachite-text-placeholder)]';\n const iconColorClass = isMuted\n ? 'text-[var(--malachite-text-secondary)]'\n : 'text-[var(--malachite-text-placeholder)]';\n const placeholderColorClass = isMuted\n ? 'placeholder:text-[var(--malachite-text-secondary)]'\n : 'placeholder:text-[var(--malachite-text-placeholder)]';\n const boxShadow = isMuted\n ? 'none'\n : focused\n ? 'var(--malachite-shadow-accent, 0px 1px 0px 0px rgba(0, 175, 102, 0.15))'\n : '0px 1px 1px 0px rgba(0, 0, 0, 0.15)';\n\n return (\n <div\n className={`w-full ${bgClass} border border-solid ${restingBorderClass} ${hoverBorderClass} transition-colors flex items-center ${SIZE_CLASSES[size]} ${disabled ? 'opacity-60 cursor-not-allowed' : ''} ${className}`}\n style={{\n boxShadow,\n borderColor: focused\n ? 'var(--malachite-control-border-hover, rgba(0, 175, 102, 0.4))'\n : undefined,\n ...controlWidthStyle(width),\n ...style,\n }}\n >\n <SearchIcon size={ICON_SIZE} className={`${iconColorClass} shrink-0`} />\n <input\n ref={setInputRef}\n type=\"text\"\n value={value}\n onChange={(e) => onChange(e.target.value)}\n onKeyDown={handleKeyDown}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n placeholder={placeholder}\n aria-label={ariaLabelledBy ? ariaLabel : (ariaLabel ?? placeholder ?? 'Search')}\n aria-labelledby={ariaLabelledBy}\n disabled={disabled}\n autoFocus={autoFocus}\n className={`flex-1 bg-transparent border-none outline-none ${CONTROL_TEXT_SIZE_CLASS[size]} font-medium text-[var(--malachite-text-primary)] ${placeholderColorClass} placeholder:font-medium disabled:cursor-not-allowed min-w-0`}\n />\n {canClear && (\n <button\n type=\"button\"\n aria-label=\"Clear search\"\n onMouseDown={keepFocus}\n onClick={clear}\n className={`shrink-0 flex items-center justify-center w-6 h-6 -mr-[5px] bg-transparent border-none rounded text-[var(--malachite-text-placeholder)] hover:text-[var(--malachite-text-primary)] cursor-pointer ${FOCUS_RING}`}\n >\n <DismissIcon size={10} />\n </button>\n )}\n </div>\n );\n});\n\nexport default Search;\nexport { Search };\n"],"names":["SIZE_CLASSES","ICON_SIZE","keepFocus","event","Search","forwardRef","value","onChange","placeholder","size","variant","disabled","autoFocus","className","width","style","clearable","onClear","onKeyDown","ariaLabel","ariaLabelledBy","ref","focused","setFocused","useState","inputRef","useRef","setInputRef","useMemo","composeRefs","canClear","clear","_a","handleKeyDown","composing","isMuted","bgClass","restingBorderClass","hoverBorderClass","iconColorClass","placeholderColorClass","boxShadow","jsxs","controlWidthStyle","jsx","SearchIcon","CONTROL_TEXT_SIZE_CLASS","FOCUS_RING","DismissIcon"],"mappings":"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"}
1
+ {"version":3,"file":"Search.js","sources":["../../src/components/Search.tsx"],"sourcesContent":["import React, { forwardRef, useMemo, useRef, useState } from 'react';\nimport DismissIcon from './CustomIcons/DismissIcon';\nimport SearchIcon from './CustomIcons/SearchIcon';\nimport { composeRefs } from './composeRefs';\nimport { CONTROL_TEXT_SIZE_CLASS } from './controlTextSize';\nimport { controlWidthStyle } from './controlWidth';\nimport { FOCUS_RING } from './focusRing';\n\nexport type SearchSize = 'small' | 'medium' | 'large';\nexport type SearchVariant = 'default' | 'muted';\n/** `body` is the 14px body step at any size. */\nexport type SearchTextSize = 'control' | 'body';\n\nconst BODY_TEXT_CLASS = 'text-[length:var(--malachite-font-size-medium,14px)]';\n\n// Figma \"Search Element - Standard\": Small 28px, Medium 32px, Large 42px, with the radius\n// tracking the tier (10/12/14) and the icon staying 15px throughout.\nconst SIZE_CLASSES: Record<SearchSize, string> = {\n small: 'h-[var(--malachite-control-height-small,28px)] gap-[6px] px-[10px] rounded-[var(--malachite-radius-10,10px)]',\n medium: 'h-[var(--malachite-control-height-medium,32px)] gap-[10px] px-[10px] rounded-xl',\n large: 'h-[var(--malachite-control-height-large,42px)] gap-[12px] px-[12px] rounded-[var(--malachite-radius-xxl,14px)]',\n};\n\nconst ICON_SIZE = 15;\n\nexport interface SearchProps {\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n /** 'large' (42px) for form inputs; 'medium' (32px) for toolbars; 'small' (28px) in a table. */\n size?: SearchSize;\n variant?: SearchVariant;\n textSize?: SearchTextSize;\n disabled?: boolean;\n autoFocus?: boolean;\n className?: string;\n width?: string | number;\n style?: React.CSSProperties;\n /**\n * Shows a clear button while the field has text, and lets Escape clear it. Either way focus\n * stays in the field, and Escape that clears is not also passed to a surrounding panel.\n */\n clearable?: boolean;\n /** Called after `onChange('')` when the clear button or Escape empties the field. */\n onClear?: () => void;\n /** Runs before Search's own Escape handling; call `preventDefault()` to skip it. */\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n /** The field's accessible name. Falls back to the placeholder, then \"Search\". */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\nconst keepFocus = (event: React.MouseEvent) => event.preventDefault();\n\n/** Forwards a ref to the input, so a consumer can focus the field. */\nconst Search = forwardRef<HTMLInputElement, SearchProps>(function Search(\n {\n value,\n onChange,\n placeholder,\n size = 'large',\n variant = 'default',\n textSize = 'control',\n disabled = false,\n autoFocus = false,\n className = '',\n width,\n style,\n clearable = false,\n onClear,\n onKeyDown,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n },\n ref,\n) {\n const [focused, setFocused] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n const setInputRef = useMemo(() => composeRefs(ref, inputRef), [ref]);\n const canClear = clearable && value.length > 0 && !disabled;\n\n const clear = () => {\n onChange('');\n onClear?.();\n inputRef.current?.focus();\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n // Escape mid-composition cancels the IME's candidate text, not the query.\n const composing = event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229;\n if (event.key !== 'Escape' || event.defaultPrevented || composing || !canClear) {\n return;\n }\n // Both, as Dropdown does: an ancestor's own onKeyDown runs before the escape layers.\n event.preventDefault();\n event.stopPropagation();\n clear();\n };\n const isMuted = variant === 'muted';\n\n // Muted variant: a borderless search that sits on a surface (no shadow). Default:\n // white field with border + subtle shadow. Both keep a visible focus border.\n // The fill is the Border colour by design; the dimmed grey vanishes on a sunken page.\n const bgClass = isMuted\n ? 'bg-[var(--malachite-card-border)]'\n : 'bg-[var(--malachite-card-background)]';\n const restingBorderClass = isMuted\n ? 'border-transparent'\n : 'border-[var(--malachite-card-border)]';\n // Hover darkens the border; focus (inline below) takes precedence.\n const hoverBorderClass = disabled ? '' : 'hover:border-[var(--malachite-text-placeholder)]';\n const iconColorClass = isMuted\n ? 'text-[var(--malachite-text-secondary)]'\n : 'text-[var(--malachite-text-placeholder)]';\n const placeholderColorClass = isMuted\n ? 'placeholder:text-[var(--malachite-text-secondary)]'\n : 'placeholder:text-[var(--malachite-text-placeholder)]';\n const boxShadow = isMuted\n ? 'none'\n : focused\n ? 'var(--malachite-shadow-accent, 0px 1px 0px 0px rgba(0, 175, 102, 0.15))'\n : '0px 1px 1px 0px rgba(0, 0, 0, 0.15)';\n\n return (\n <div\n className={`w-full ${bgClass} border border-solid ${restingBorderClass} ${hoverBorderClass} transition-colors flex items-center ${SIZE_CLASSES[size]} ${disabled ? 'opacity-60 cursor-not-allowed' : ''} ${className}`}\n style={{\n boxShadow,\n borderColor: focused\n ? 'var(--malachite-control-border-hover, rgba(0, 175, 102, 0.4))'\n : undefined,\n ...controlWidthStyle(width),\n ...style,\n }}\n >\n <SearchIcon size={ICON_SIZE} className={`${iconColorClass} shrink-0`} />\n <input\n ref={setInputRef}\n type=\"text\"\n value={value}\n onChange={(e) => onChange(e.target.value)}\n onKeyDown={handleKeyDown}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n placeholder={placeholder}\n aria-label={ariaLabelledBy ? ariaLabel : (ariaLabel ?? placeholder ?? 'Search')}\n aria-labelledby={ariaLabelledBy}\n disabled={disabled}\n autoFocus={autoFocus}\n className={`flex-1 bg-transparent border-none outline-none ${textSize === 'body' ? BODY_TEXT_CLASS : CONTROL_TEXT_SIZE_CLASS[size]} font-medium text-[var(--malachite-text-primary)] ${placeholderColorClass} placeholder:font-medium disabled:cursor-not-allowed min-w-0`}\n />\n {canClear && (\n <button\n type=\"button\"\n aria-label=\"Clear search\"\n onMouseDown={keepFocus}\n onClick={clear}\n className={`shrink-0 flex items-center justify-center w-6 h-6 -mr-[5px] bg-transparent border-none rounded text-[var(--malachite-text-placeholder)] hover:text-[var(--malachite-text-primary)] cursor-pointer ${FOCUS_RING}`}\n >\n <DismissIcon size={10} />\n </button>\n )}\n </div>\n );\n});\n\nexport default Search;\nexport { Search };\n"],"names":["BODY_TEXT_CLASS","SIZE_CLASSES","ICON_SIZE","keepFocus","event","Search","forwardRef","value","onChange","placeholder","size","variant","textSize","disabled","autoFocus","className","width","style","clearable","onClear","onKeyDown","ariaLabel","ariaLabelledBy","ref","focused","setFocused","useState","inputRef","useRef","setInputRef","useMemo","composeRefs","canClear","clear","_a","handleKeyDown","composing","isMuted","bgClass","restingBorderClass","hoverBorderClass","iconColorClass","placeholderColorClass","boxShadow","jsxs","controlWidthStyle","jsx","SearchIcon","CONTROL_TEXT_SIZE_CLASS","FOCUS_RING","DismissIcon"],"mappings":"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"}
@@ -0,0 +1,61 @@
1
+ import { jsxs as o, jsx as r, Fragment as p } from "react/jsx-runtime";
2
+ import u from "./CustomIcons/CheckCircleFilled.js";
3
+ import x from "./CustomIcons/ErrorCircleFilled.js";
4
+ import g from "./CustomIcons/InfoCircleFilled.js";
5
+ import f from "./CustomIcons/WarningCircleFilled.js";
6
+ import h from "./Spinner.js";
7
+ const b = {
8
+ success: "bg-[var(--malachite-alert-success-background)] text-[var(--malachite-alert-success-foreground)] supports-[color:color-mix(in_srgb,red,red)]:text-[color-mix(in_srgb,var(--malachite-alert-success-foreground)_70%,var(--malachite-text-primary))]",
9
+ neutral: "bg-[var(--malachite-alert-info-background)] text-[var(--malachite-alert-info-foreground)]",
10
+ warning: "bg-[var(--malachite-alert-warning-background)] text-[var(--malachite-alert-warning-foreground)] supports-[color:color-mix(in_srgb,red,red)]:text-[color-mix(in_srgb,var(--malachite-alert-warning-foreground)_70%,var(--malachite-text-primary))]",
11
+ error: "bg-[var(--malachite-alert-error-background)] text-[var(--malachite-alert-error-foreground)] supports-[color:color-mix(in_srgb,red,red)]:text-[color-mix(in_srgb,var(--malachite-alert-error-foreground)_70%,var(--malachite-text-primary))]"
12
+ }, v = {
13
+ success: u,
14
+ neutral: g,
15
+ warning: f,
16
+ error: x
17
+ }, _ = "border border-solid border-[var(--malachite-card-border)] supports-[color:color-mix(in_srgb,red,red)]:border-[color-mix(in_srgb,currentColor_24%,transparent)]", F = ({
18
+ label: n,
19
+ detail: l,
20
+ tone: i = "neutral",
21
+ icon: s,
22
+ busy: e = !1,
23
+ live: a = !1,
24
+ "aria-label": c,
25
+ "aria-labelledby": t,
26
+ className: m = ""
27
+ }) => {
28
+ const d = v[i];
29
+ return /* @__PURE__ */ o(
30
+ "span",
31
+ {
32
+ role: a ? "status" : void 0,
33
+ "aria-label": a && !t ? c : void 0,
34
+ "aria-labelledby": a ? t : void 0,
35
+ "aria-busy": e || void 0,
36
+ className: `inline-flex items-center gap-[6px] h-[28px] max-w-full min-w-0 pl-[8px] pr-[10px] rounded-full overflow-hidden whitespace-nowrap text-[12px] font-medium ${_} ${b[i]} ${m}`,
37
+ children: [
38
+ /* @__PURE__ */ r(
39
+ "span",
40
+ {
41
+ "aria-hidden": "true",
42
+ className: `inline-flex shrink-0 items-center justify-center size-[16px] ${e ? "" : "[&_svg]:size-full!"}`,
43
+ children: e ? /* @__PURE__ */ r(h, { size: "xxxsmall" }) : s ?? /* @__PURE__ */ r(d, { size: 16 })
44
+ }
45
+ ),
46
+ /* @__PURE__ */ o("span", { className: "min-w-0 overflow-hidden text-ellipsis", children: [
47
+ n,
48
+ l ? /* @__PURE__ */ o(p, { children: [
49
+ " · ",
50
+ /* @__PURE__ */ r("span", { className: "font-mono", children: l })
51
+ ] }) : null
52
+ ] })
53
+ ]
54
+ }
55
+ );
56
+ };
57
+ export {
58
+ F as StatusPill,
59
+ F as default
60
+ };
61
+ //# sourceMappingURL=StatusPill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatusPill.js","sources":["../../src/components/StatusPill.tsx"],"sourcesContent":["import React from 'react';\nimport CheckCircleFilled, { type IconProps } from './CustomIcons/CheckCircleFilled';\nimport ErrorCircleFilled from './CustomIcons/ErrorCircleFilled';\nimport InfoCircleFilled from './CustomIcons/InfoCircleFilled';\nimport WarningCircleFilled from './CustomIcons/WarningCircleFilled';\nimport Spinner from './Spinner';\n\nexport type StatusPillTone = 'success' | 'neutral' | 'warning' | 'error';\n\nexport interface StatusPillProps {\n label: string;\n /** Set in the mono face after a `·`. */\n detail?: string;\n tone?: StatusPillTone;\n icon?: React.ReactNode;\n busy?: boolean;\n /** Makes it a `status` live region. Off by default, as on `Alert`. */\n live?: boolean;\n /** Names the live region; only applies with `live`. */\n 'aria-label'?: string;\n /** Only applies with `live`. */\n 'aria-labelledby'?: string;\n className?: string;\n}\n\n// Text leans 30% toward the primary colour so every tone holds 4.5:1 on its tint.\nconst TONE_CLASSES: Record<StatusPillTone, string> = {\n success:\n 'bg-[var(--malachite-alert-success-background)] text-[var(--malachite-alert-success-foreground)] supports-[color:color-mix(in_srgb,red,red)]:text-[color-mix(in_srgb,var(--malachite-alert-success-foreground)_70%,var(--malachite-text-primary))]',\n neutral:\n 'bg-[var(--malachite-alert-info-background)] text-[var(--malachite-alert-info-foreground)]',\n warning:\n 'bg-[var(--malachite-alert-warning-background)] text-[var(--malachite-alert-warning-foreground)] supports-[color:color-mix(in_srgb,red,red)]:text-[color-mix(in_srgb,var(--malachite-alert-warning-foreground)_70%,var(--malachite-text-primary))]',\n error: 'bg-[var(--malachite-alert-error-background)] text-[var(--malachite-alert-error-foreground)] supports-[color:color-mix(in_srgb,red,red)]:text-[color-mix(in_srgb,var(--malachite-alert-error-foreground)_70%,var(--malachite-text-primary))]',\n};\n\nconst TONE_ICONS: Record<StatusPillTone, React.FC<IconProps>> = {\n success: CheckCircleFilled,\n neutral: InfoCircleFilled,\n warning: WarningCircleFilled,\n error: ErrorCircleFilled,\n};\n\nconst BORDER =\n 'border border-solid border-[var(--malachite-card-border)] supports-[color:color-mix(in_srgb,red,red)]:border-[color-mix(in_srgb,currentColor_24%,transparent)]';\n\nconst StatusPill: React.FC<StatusPillProps> = ({\n label,\n detail,\n tone = 'neutral',\n icon,\n busy = false,\n live = false,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className = '',\n}) => {\n const ToneIcon = TONE_ICONS[tone];\n\n return (\n <span\n role={live ? 'status' : undefined}\n aria-label={live && !ariaLabelledBy ? ariaLabel : undefined}\n aria-labelledby={live ? ariaLabelledBy : undefined}\n aria-busy={busy || undefined}\n className={`inline-flex items-center gap-[6px] h-[28px] max-w-full min-w-0 pl-[8px] pr-[10px] rounded-full overflow-hidden whitespace-nowrap text-[12px] font-medium ${BORDER} ${TONE_CLASSES[tone]} ${className}`}\n >\n <span\n aria-hidden=\"true\"\n className={`inline-flex shrink-0 items-center justify-center size-[16px] ${busy ? '' : '[&_svg]:size-full!'}`}\n >\n {busy ? <Spinner size=\"xxxsmall\" /> : (icon ?? <ToneIcon size={16} />)}\n </span>\n <span className=\"min-w-0 overflow-hidden text-ellipsis\">\n {label}\n {detail ? (\n <>\n {' · '}\n <span className=\"font-mono\">{detail}</span>\n </>\n ) : null}\n </span>\n </span>\n );\n};\n\nexport default StatusPill;\nexport { StatusPill };\n"],"names":["TONE_CLASSES","TONE_ICONS","CheckCircleFilled","InfoCircleFilled","WarningCircleFilled","ErrorCircleFilled","BORDER","StatusPill","label","detail","tone","icon","busy","live","ariaLabel","ariaLabelledBy","className","ToneIcon","jsxs","jsx","Spinner","Fragment"],"mappings":";;;;;;AA0BA,MAAMA,IAA+C;AAAA,EACjD,SACI;AAAA,EACJ,SACI;AAAA,EACJ,SACI;AAAA,EACJ,OAAO;AACX,GAEMC,IAA0D;AAAA,EAC5D,SAASC;AAAA,EACT,SAASC;AAAA,EACT,SAASC;AAAA,EACT,OAAOC;AACX,GAEMC,IACF,kKAEEC,IAAwC,CAAC;AAAA,EAC3C,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,MAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,MAAAC,IAAO;AAAA,EACP,cAAcC;AAAA,EACd,mBAAmBC;AAAA,EACnB,WAAAC,IAAY;AAChB,MAAM;AACF,QAAMC,IAAWhB,EAAWS,CAAI;AAEhC,SACI,gBAAAQ;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,MAAML,IAAO,WAAW;AAAA,MACxB,cAAYA,KAAQ,CAACE,IAAiBD,IAAY;AAAA,MAClD,mBAAiBD,IAAOE,IAAiB;AAAA,MACzC,aAAWH,KAAQ;AAAA,MACnB,WAAW,4JAA4JN,CAAM,IAAIN,EAAaU,CAAI,CAAC,IAAIM,CAAS;AAAA,MAEhN,UAAA;AAAA,QAAA,gBAAAG;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,eAAY;AAAA,YACZ,WAAW,gEAAgEP,IAAO,KAAK,oBAAoB;AAAA,YAE1G,UAAAA,IAAO,gBAAAO,EAACC,GAAA,EAAQ,MAAK,YAAW,IAAMT,KAAQ,gBAAAQ,EAACF,GAAA,EAAS,MAAM,GAAA,CAAI;AAAA,UAAA;AAAA,QAAA;AAAA,QAEvE,gBAAAC,EAAC,QAAA,EAAK,WAAU,yCACX,UAAA;AAAA,UAAAV;AAAA,UACAC,IACG,gBAAAS,EAAAG,GAAA,EACK,UAAA;AAAA,YAAA;AAAA,YACD,gBAAAF,EAAC,QAAA,EAAK,WAAU,aAAa,UAAAV,EAAA,CAAO;AAAA,UAAA,EAAA,CACxC,IACA;AAAA,QAAA,EAAA,CACR;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
@@ -1,227 +1,232 @@
1
- import { jsx as o, jsxs as k } from "react/jsx-runtime";
2
- import P from "react";
3
- import { paintOnChild as U } from "./asChild.js";
4
- import { DisclosureArrow as W } from "./DisclosureArrow.js";
5
- import { FOCUS_RING_INSET as A } from "./focusRing.js";
6
- import { resolveRel as $ } from "./linkRel.js";
7
- import { safeHref as X } from "./safeHref.js";
8
- import { isRenderableNode as H } from "./renderableNode.js";
9
- import { FOREGROUND_RESET as z, SELECTED_TEXT_CONTEXT as K, SELECTED_ROW_ACCENT as V, SELECTED_ROW_FOREGROUND as q, SELECTED_ROW_BACKGROUND as D } from "./selectedRow.js";
10
- const J = {
1
+ import { jsx as o, jsxs as _ } from "react/jsx-runtime";
2
+ import z from "react";
3
+ import { paintOnChild as K } from "./asChild.js";
4
+ import { DisclosureArrow as V } from "./DisclosureArrow.js";
5
+ import { FOCUS_RING_INSET as B } from "./focusRing.js";
6
+ import { resolveRel as L } from "./linkRel.js";
7
+ import { safeHref as q } from "./safeHref.js";
8
+ import { isRenderableNode as J } from "./renderableNode.js";
9
+ import { FOREGROUND_RESET as M, SELECTED_TEXT_CONTEXT as Q, SELECTED_ROW_ACCENT as Y, SELECTED_ROW_FOREGROUND as Z, SELECTED_ROW_BACKGROUND as I } from "./selectedRow.js";
10
+ const ee = {
11
+ none: "",
12
+ compact: "px-[16px] py-[8px]"
13
+ }, ae = {
11
14
  default: "",
12
15
  muted: "bg-[var(--malachite-card-dimmed-background)]",
13
16
  success: "bg-[var(--malachite-tag-success-background)]",
14
17
  error: "bg-[var(--malachite-tag-error-background)]"
15
- }, M = {
18
+ }, re = {
16
19
  success: "var(--malachite-tag-success-foreground)",
17
20
  error: "var(--malachite-tag-error-foreground)"
18
- }, Q = "opacity-0 transition-opacity group-[:hover]/row:opacity-100 group-focus-within/row:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100", Y = "0px 0px 4px 0px rgba(0,0,0,0.08), 0px 4px 4px 0px rgba(0,0,0,0.08), 0px 4px 10px 0px rgba(0,0,0,0.05)", L = (t) => {
21
+ }, oe = "opacity-0 transition-opacity group-[:hover]/row:opacity-100 group-focus-within/row:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100", te = "0px 0px 4px 0px rgba(0,0,0,0.08), 0px 4px 4px 0px rgba(0,0,0,0.08), 0px 4px 10px 0px rgba(0,0,0,0.05)", j = (t) => {
19
22
  const {
20
23
  children: a,
21
24
  divider: r = !1,
22
25
  disabled: e = !1,
23
- selected: i,
24
- selection: b,
26
+ selected: n,
27
+ selection: d,
25
28
  tone: s = "default",
26
- className: u = "",
27
- style: g
28
- } = t, d = t.asChild === !0, {
29
- onClick: n,
30
- href: E,
31
- target: c,
32
- rel: y,
33
- trailing: S,
34
- revealTrailing: _,
35
- role: l
36
- } = d ? {} : t, p = X(E), f = d ? void 0 : t["aria-label"], h = d ? void 0 : t["aria-labelledby"], N = !!(n || p), I = e && (N || d) ? "" : "transition-colors hover:bg-[var(--malachite-buttonlist-hover-background)]", j = s !== "default", O = [
29
+ inset: m = "none",
30
+ className: f = "",
31
+ style: C
32
+ } = t, c = t.asChild === !0, {
33
+ onClick: l,
34
+ href: b,
35
+ target: u,
36
+ rel: O,
37
+ trailing: T,
38
+ revealTrailing: $,
39
+ role: i
40
+ } = c ? {} : t, h = q(b), x = c ? void 0 : t["aria-label"], v = c ? void 0 : t["aria-labelledby"], N = !!(l || h), P = e && (N || c) ? "" : "transition-colors hover:bg-[var(--malachite-buttonlist-hover-background)]", G = s !== "default", U = ae[s], w = !c && J(T), S = ee[m], W = S && !w ? "" : "p-0", D = [
37
41
  "w-full text-left border-0",
38
- J[s],
42
+ U,
39
43
  r ? "border-b border-solid border-[var(--malachite-card-border)]" : "",
40
- I
41
- ].filter(Boolean).join(" "), w = [
42
- N ? `appearance-none ${j ? "" : "bg-transparent"} p-0 ${A}` : "",
44
+ P
45
+ ].filter(Boolean).join(" "), R = [
46
+ N ? `appearance-none ${G ? "" : "bg-transparent"} ${W} ${B}` : "",
43
47
  N && !e ? "cursor-pointer" : ""
44
- ].filter(Boolean).join(" "), C = [O, w, u].filter(Boolean).join(" "), F = i === !0 && (b ? b === "highlight" : l !== "checkbox") ? {
45
- backgroundImage: `linear-gradient(${D}, ${D})`,
46
- color: q,
47
- boxShadow: `inset 2px 0 0 ${V}`,
48
- ...K
49
- } : {}, R = M[s], x = { ...R ? {
50
- color: R,
51
- "--malachite-ctx-text-primary": R
52
- } : {}, ...F, ...g }, m = l === "checkbox" && i === "mixed" ? "mixed" : l === "radio" || l === "checkbox" ? i === !0 : void 0, v = m === void 0 && i === !0 ? !0 : void 0, T = {
53
- role: l,
54
- "aria-checked": m,
55
- "aria-current": v,
56
- "aria-label": f,
57
- "aria-labelledby": h,
58
- "aria-disabled": l && e ? !0 : void 0
48
+ ].filter(Boolean).join(" "), y = [D, R, w ? "" : S, f].filter(Boolean).join(" "), X = n === !0 && (d ? d === "highlight" : i !== "checkbox") ? {
49
+ backgroundImage: `linear-gradient(${I}, ${I})`,
50
+ color: Z,
51
+ boxShadow: `inset 2px 0 0 ${Y}`,
52
+ ...Q
53
+ } : {}, k = re[s], g = { ...k ? {
54
+ color: k,
55
+ "--malachite-ctx-text-primary": k
56
+ } : {}, ...X, ...C }, p = i === "checkbox" && n === "mixed" ? "mixed" : i === "radio" || i === "checkbox" ? n === !0 : void 0, E = p === void 0 && n === !0 ? !0 : void 0, A = {
57
+ role: i,
58
+ "aria-checked": p,
59
+ "aria-current": E,
60
+ "aria-label": x,
61
+ "aria-labelledby": v,
62
+ "aria-disabled": i && e ? !0 : void 0
59
63
  };
60
- if (d)
61
- return U(a, C, x);
62
- if (H(S)) {
63
- const G = p && !e ? /* @__PURE__ */ o(
64
+ if (c)
65
+ return K(a, y, g);
66
+ if (w) {
67
+ const H = h && !e ? /* @__PURE__ */ o(
64
68
  "a",
65
69
  {
66
- href: p,
67
- target: c,
68
- rel: $(y, c),
69
- onClick: n,
70
- className: `${w} border-0 flex-1 min-w-0 text-left no-underline text-inherit`,
71
- role: l,
72
- "aria-checked": m,
73
- "aria-current": v,
74
- "aria-label": f,
75
- "aria-labelledby": h,
70
+ href: h,
71
+ target: u,
72
+ rel: L(O, u),
73
+ onClick: l,
74
+ className: `${R} border-0 flex-1 min-w-0 text-left no-underline text-inherit`,
75
+ role: i,
76
+ "aria-checked": p,
77
+ "aria-current": E,
78
+ "aria-label": x,
79
+ "aria-labelledby": v,
76
80
  children: a
77
81
  }
78
- ) : n ? /* @__PURE__ */ o(
82
+ ) : l ? /* @__PURE__ */ o(
79
83
  "button",
80
84
  {
81
85
  type: "button",
82
- onClick: n,
86
+ onClick: l,
83
87
  disabled: e,
84
- className: `${w} border-0 flex-1 min-w-0 text-left`,
85
- role: l,
86
- "aria-checked": m,
87
- "aria-current": v,
88
- "aria-label": f,
89
- "aria-labelledby": h,
88
+ className: `${R} border-0 flex-1 min-w-0 text-left`,
89
+ role: i,
90
+ "aria-checked": p,
91
+ "aria-current": E,
92
+ "aria-label": x,
93
+ "aria-labelledby": v,
90
94
  children: a
91
95
  }
92
96
  ) : (
93
97
  // The set goes here, not on the wrapper: `radio` and `checkbox` make their
94
98
  // descendants presentational, which would bury a control in the trailing slot.
95
- /* @__PURE__ */ o("div", { className: "flex-1 min-w-0", ...T, children: a })
99
+ /* @__PURE__ */ o("div", { className: "flex-1 min-w-0", ...A, children: a })
96
100
  );
97
- return /* @__PURE__ */ k(
101
+ return /* @__PURE__ */ _(
98
102
  "div",
99
103
  {
100
104
  className: [
101
- O,
105
+ D,
102
106
  "flex items-center",
103
- _ ? "group/row" : "",
104
- u
107
+ S,
108
+ $ ? "group/row" : "",
109
+ f
105
110
  ].filter(Boolean).join(" "),
106
- style: x,
111
+ style: g,
107
112
  children: [
108
- G,
113
+ H,
109
114
  /* @__PURE__ */ o(
110
115
  "div",
111
116
  {
112
- className: `shrink-0 flex items-center ${_ ? Q : ""}`,
113
- children: S
117
+ className: `shrink-0 flex items-center ${$ ? oe : ""}`,
118
+ children: T
114
119
  }
115
120
  )
116
121
  ]
117
122
  }
118
123
  );
119
124
  }
120
- return p && !e ? /* @__PURE__ */ o(
125
+ return h && !e ? /* @__PURE__ */ o(
121
126
  "a",
122
127
  {
123
- href: p,
124
- target: c,
125
- rel: $(y, c),
126
- onClick: n,
127
- className: `${C} no-underline text-inherit`,
128
- style: x,
129
- role: l,
130
- "aria-checked": m,
131
- "aria-current": v,
132
- "aria-label": f,
133
- "aria-labelledby": h,
128
+ href: h,
129
+ target: u,
130
+ rel: L(O, u),
131
+ onClick: l,
132
+ className: `${y} no-underline text-inherit`,
133
+ style: g,
134
+ role: i,
135
+ "aria-checked": p,
136
+ "aria-current": E,
137
+ "aria-label": x,
138
+ "aria-labelledby": v,
134
139
  children: a
135
140
  }
136
- ) : n ? /* @__PURE__ */ o(
141
+ ) : l ? /* @__PURE__ */ o(
137
142
  "button",
138
143
  {
139
144
  type: "button",
140
- onClick: n,
145
+ onClick: l,
141
146
  disabled: e,
142
- className: C,
143
- style: x,
144
- role: l,
145
- "aria-checked": m,
146
- "aria-current": v,
147
- "aria-label": f,
148
- "aria-labelledby": h,
147
+ className: y,
148
+ style: g,
149
+ role: i,
150
+ "aria-checked": p,
151
+ "aria-current": E,
152
+ "aria-label": x,
153
+ "aria-labelledby": v,
149
154
  children: a
150
155
  }
151
- ) : /* @__PURE__ */ o("div", { className: C, style: x, ...T, children: a });
152
- }, Z = ({ children: t, className: a = "", style: r }) => /* @__PURE__ */ o("div", { className: a, style: r, onClick: (e) => e.stopPropagation(), children: t }), me = 39, ee = Object.assign(
156
+ ) : /* @__PURE__ */ o("div", { className: y, style: g, ...A, children: a });
157
+ }, le = ({ children: t, className: a = "", style: r }) => /* @__PURE__ */ o("div", { className: a, style: r, onClick: (e) => e.stopPropagation(), children: t }), ve = 39, ie = Object.assign(
153
158
  ({
154
159
  header: t,
155
160
  children: a,
156
161
  expanded: r,
157
162
  onToggle: e,
158
- sticky: i = !1,
159
- stickyTopOffset: b = 0,
163
+ sticky: n = !1,
164
+ stickyTopOffset: d = 0,
160
165
  divider: s = !1,
161
- tone: u = "default",
162
- "aria-label": g,
163
- className: d = "",
164
- style: n
166
+ tone: m = "default",
167
+ "aria-label": f,
168
+ className: C = "",
169
+ style: c
165
170
  }) => {
166
- const E = P.useId(), c = e ? () => e(!r) : void 0;
167
- return /* @__PURE__ */ k(L, { divider: s, tone: u, className: d, style: n, children: [
168
- /* @__PURE__ */ k(
171
+ const l = z.useId(), b = e ? () => e(!r) : void 0;
172
+ return /* @__PURE__ */ _(j, { divider: s, tone: m, className: C, style: c, children: [
173
+ /* @__PURE__ */ _(
169
174
  "div",
170
175
  {
171
- className: `group flex items-center w-full ${c ? "cursor-pointer" : ""} ${i && r ? "sticky z-[1] bg-[var(--malachite-card-background)]" : ""}`,
172
- style: i && r ? { top: b } : void 0,
173
- onClick: c,
176
+ className: `group flex items-center w-full ${b ? "cursor-pointer" : ""} ${n && r ? "sticky z-[1] bg-[var(--malachite-card-background)]" : ""}`,
177
+ style: n && r ? { top: d } : void 0,
178
+ onClick: b,
174
179
  role: "presentation",
175
180
  children: [
176
- /* @__PURE__ */ o("span", { className: "shrink-0 flex items-center pl-[16px] pr-[12px]", children: c && /* @__PURE__ */ o(
181
+ /* @__PURE__ */ o("span", { className: "shrink-0 flex items-center pl-[16px] pr-[12px]", children: b && /* @__PURE__ */ o(
177
182
  "button",
178
183
  {
179
184
  type: "button",
180
- className: `appearance-none bg-transparent border-0 p-0 flex items-center cursor-pointer ${A}`,
185
+ className: `appearance-none bg-transparent border-0 p-0 flex items-center cursor-pointer ${B}`,
181
186
  "aria-expanded": r,
182
- "aria-controls": E,
183
- "aria-label": g,
184
- onClick: (y) => {
185
- y.stopPropagation(), c();
187
+ "aria-controls": l,
188
+ "aria-label": f,
189
+ onClick: (u) => {
190
+ u.stopPropagation(), b();
186
191
  },
187
- children: /* @__PURE__ */ o(W, { expanded: r })
192
+ children: /* @__PURE__ */ o(V, { expanded: r })
188
193
  }
189
194
  ) }),
190
195
  t
191
196
  ]
192
197
  }
193
198
  ),
194
- r && /* @__PURE__ */ o("div", { id: E, children: a })
199
+ r && /* @__PURE__ */ o("div", { id: l, children: a })
195
200
  ] });
196
201
  },
197
- { Controls: Z }
198
- ), B = ({
202
+ { Controls: le }
203
+ ), F = ({
199
204
  children: t,
200
205
  padding: a = !1,
201
206
  overflow: r = "hidden",
202
207
  role: e,
203
- "aria-label": i,
204
- "aria-labelledby": b,
208
+ "aria-label": n,
209
+ "aria-labelledby": d,
205
210
  className: s = "",
206
- style: u
211
+ style: m
207
212
  }) => /* @__PURE__ */ o(
208
213
  "div",
209
214
  {
210
215
  className: `w-full rounded-[var(--malachite-radius-xxl,14px)] ${r === "clip" ? "overflow-clip" : r === "visible" ? "overflow-visible" : "overflow-hidden"} bg-[var(--malachite-card-background)] border border-solid border-[var(--malachite-card-border)] ${a ? "py-3 px-4" : ""} ${s}`,
211
- style: { boxShadow: Y, ...z, ...u },
216
+ style: { boxShadow: te, ...M, ...m },
212
217
  role: e,
213
- "aria-label": i,
214
- "aria-labelledby": b,
218
+ "aria-label": n,
219
+ "aria-labelledby": d,
215
220
  children: t
216
221
  }
217
222
  );
218
- B.Row = L;
219
- B.ExpandableRow = ee;
223
+ F.Row = j;
224
+ F.ExpandableRow = ie;
220
225
  export {
221
- me as EXPANDABLE_ROW_LEAD_PX,
222
- B as Surface,
223
- ee as SurfaceExpandableRow,
224
- L as SurfaceRow,
225
- B as default
226
+ ve as EXPANDABLE_ROW_LEAD_PX,
227
+ F as Surface,
228
+ ie as SurfaceExpandableRow,
229
+ j as SurfaceRow,
230
+ F as default
226
231
  };
227
232
  //# sourceMappingURL=Surface.js.map