@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.
- package/COMPONENTS.md +11 -9
- package/dist/components/AccessPills.js +99 -0
- package/dist/components/AccessPills.js.map +1 -0
- package/dist/components/Alert.js +100 -75
- package/dist/components/Alert.js.map +1 -1
- package/dist/components/Button.js +75 -73
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Modal.js +75 -74
- package/dist/components/Modal.js.map +1 -1
- package/dist/components/PopoverParts.js +35 -35
- package/dist/components/PopoverParts.js.map +1 -1
- package/dist/components/Search.js +30 -29
- package/dist/components/Search.js.map +1 -1
- package/dist/components/StatusPill.js +61 -0
- package/dist/components/StatusPill.js.map +1 -0
- package/dist/components/Surface.js +138 -133
- package/dist/components/Surface.js.map +1 -1
- package/dist/components/Toolbar.js +40 -33
- package/dist/components/Toolbar.js.map +1 -1
- package/dist/components/Typography/EllipsisText.js +27 -25
- package/dist/components/Typography/EllipsisText.js.map +1 -1
- package/dist/components/Typography/MarkdownBlock.js +36 -28
- package/dist/components/Typography/MarkdownBlock.js.map +1 -1
- package/dist/components/Typography/Text.js +24 -22
- package/dist/components/Typography/Text.js.map +1 -1
- package/dist/components/WizardLayout.js +81 -67
- package/dist/components/WizardLayout.js.map +1 -1
- package/dist/index.d.ts +74 -0
- package/dist/index.js +361 -357
- package/dist/index.js.map +1 -1
- package/dist/tailwind.css.js +1 -1
- package/package.json +1 -1
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { composeRefs as
|
|
6
|
-
import { CONTROL_TEXT_SIZE_CLASS as
|
|
7
|
-
import { controlWidthStyle as
|
|
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
|
-
},
|
|
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:
|
|
21
|
-
className:
|
|
22
|
-
width:
|
|
23
|
-
style:
|
|
24
|
-
clearable:
|
|
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] =
|
|
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)]",
|
|
38
|
-
return /* @__PURE__ */
|
|
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 ${
|
|
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:
|
|
44
|
+
boxShadow: F,
|
|
44
45
|
borderColor: x ? "var(--malachite-control-border-hover, rgba(0, 175, 102, 0.4))" : void 0,
|
|
45
|
-
...
|
|
46
|
-
|
|
46
|
+
...G($),
|
|
47
|
+
...E
|
|
47
48
|
},
|
|
48
49
|
children: [
|
|
49
|
-
/* @__PURE__ */ a(
|
|
50
|
+
/* @__PURE__ */ a(L, { size: q, className: `${O} shrink-0` }),
|
|
50
51
|
/* @__PURE__ */ a(
|
|
51
52
|
"input",
|
|
52
53
|
{
|
|
53
|
-
ref:
|
|
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:
|
|
65
|
-
className: `flex-1 bg-transparent border-none outline-none ${
|
|
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:
|
|
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(
|
|
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
|
-
|
|
85
|
-
|
|
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","jsx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AAA;AAAA,MAC3B;AAAA,IAAA;AAAA,EAAA;AAIhB,CAAC;"}
|
|
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":";;;;;;;;AAaA,MAAMA,IAAkB,wDAIlBC,IAA2C;AAAA,EAC7C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACX,GAEMC,IAAY,IA6BZC,IAAY,CAACC,MAA4BA,EAAM,eAAA,GAG/CC,KAASC,EAA0C,SACrD;AAAA,EACI,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,SAAAC,IAAU;AAAA,EACV,UAAAC,IAAW;AAAA,EACX,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,WAAAC,IAAY;AAAA,EACZ,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAcC;AAAA,EACd,mBAAmBC;AACvB,GACAC,GACF;AACE,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAS,EAAK,GACtCC,IAAWC,EAAyB,IAAI,GACxCC,IAAcC,EAAQ,MAAMC,EAAYR,GAAKI,CAAQ,GAAG,CAACJ,CAAG,CAAC,GAC7DS,IAAWd,KAAaX,EAAM,SAAS,KAAK,CAACM,GAE7CoB,IAAQ,MAAM;;AAChB,IAAAzB,EAAS,EAAE,GACXW,KAAA,QAAAA,MACAe,IAAAP,EAAS,YAAT,QAAAO,EAAkB;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;AAAA,YACA,WAAAC;AAAA,YACA,WAAW,kDAAkDF,MAAa,SAASZ,IAAkBgD,EAAwBtC,CAAI,CAAC,qDAAqDgC,CAAqB;AAAA,UAAA;AAAA,QAAA;AAAA,QAE/MV,KACG,gBAAAc;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,MAAK;AAAA,YACL,cAAW;AAAA,YACX,aAAa3C;AAAA,YACb,SAAS8B;AAAA,YACT,WAAW,qMAAqMgB,CAAU;AAAA,YAE1N,UAAA,gBAAAH,EAACI,GAAA,EAAY,MAAM,GAAA,CAAI;AAAA,UAAA;AAAA,QAAA;AAAA,MAC3B;AAAA,IAAA;AAAA,EAAA;AAIhB,CAAC;"}
|
|
@@ -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","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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
|
|
2
|
-
import
|
|
3
|
-
import { paintOnChild as
|
|
4
|
-
import { DisclosureArrow as
|
|
5
|
-
import { FOCUS_RING_INSET as
|
|
6
|
-
import { resolveRel as
|
|
7
|
-
import { safeHref as
|
|
8
|
-
import { isRenderableNode as
|
|
9
|
-
import { FOREGROUND_RESET as
|
|
10
|
-
const
|
|
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
|
-
},
|
|
18
|
+
}, re = {
|
|
16
19
|
success: "var(--malachite-tag-success-foreground)",
|
|
17
20
|
error: "var(--malachite-tag-error-foreground)"
|
|
18
|
-
},
|
|
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:
|
|
24
|
-
selection:
|
|
26
|
+
selected: n,
|
|
27
|
+
selection: d,
|
|
25
28
|
tone: s = "default",
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
42
|
+
U,
|
|
39
43
|
r ? "border-b border-solid border-[var(--malachite-card-border)]" : "",
|
|
40
|
-
|
|
41
|
-
].filter(Boolean).join(" "),
|
|
42
|
-
N ? `appearance-none ${
|
|
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(" "),
|
|
45
|
-
backgroundImage: `linear-gradient(${
|
|
46
|
-
color:
|
|
47
|
-
boxShadow: `inset 2px 0 0 ${
|
|
48
|
-
...
|
|
49
|
-
} : {},
|
|
50
|
-
color:
|
|
51
|
-
"--malachite-ctx-text-primary":
|
|
52
|
-
} : {}, ...
|
|
53
|
-
role:
|
|
54
|
-
"aria-checked":
|
|
55
|
-
"aria-current":
|
|
56
|
-
"aria-label":
|
|
57
|
-
"aria-labelledby":
|
|
58
|
-
"aria-disabled":
|
|
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 (
|
|
61
|
-
return
|
|
62
|
-
if (
|
|
63
|
-
const
|
|
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:
|
|
67
|
-
target:
|
|
68
|
-
rel:
|
|
69
|
-
onClick:
|
|
70
|
-
className: `${
|
|
71
|
-
role:
|
|
72
|
-
"aria-checked":
|
|
73
|
-
"aria-current":
|
|
74
|
-
"aria-label":
|
|
75
|
-
"aria-labelledby":
|
|
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
|
-
) :
|
|
82
|
+
) : l ? /* @__PURE__ */ o(
|
|
79
83
|
"button",
|
|
80
84
|
{
|
|
81
85
|
type: "button",
|
|
82
|
-
onClick:
|
|
86
|
+
onClick: l,
|
|
83
87
|
disabled: e,
|
|
84
|
-
className: `${
|
|
85
|
-
role:
|
|
86
|
-
"aria-checked":
|
|
87
|
-
"aria-current":
|
|
88
|
-
"aria-label":
|
|
89
|
-
"aria-labelledby":
|
|
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", ...
|
|
99
|
+
/* @__PURE__ */ o("div", { className: "flex-1 min-w-0", ...A, children: a })
|
|
96
100
|
);
|
|
97
|
-
return /* @__PURE__ */
|
|
101
|
+
return /* @__PURE__ */ _(
|
|
98
102
|
"div",
|
|
99
103
|
{
|
|
100
104
|
className: [
|
|
101
|
-
|
|
105
|
+
D,
|
|
102
106
|
"flex items-center",
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
S,
|
|
108
|
+
$ ? "group/row" : "",
|
|
109
|
+
f
|
|
105
110
|
].filter(Boolean).join(" "),
|
|
106
|
-
style:
|
|
111
|
+
style: g,
|
|
107
112
|
children: [
|
|
108
|
-
|
|
113
|
+
H,
|
|
109
114
|
/* @__PURE__ */ o(
|
|
110
115
|
"div",
|
|
111
116
|
{
|
|
112
|
-
className: `shrink-0 flex items-center ${
|
|
113
|
-
children:
|
|
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
|
|
125
|
+
return h && !e ? /* @__PURE__ */ o(
|
|
121
126
|
"a",
|
|
122
127
|
{
|
|
123
|
-
href:
|
|
124
|
-
target:
|
|
125
|
-
rel:
|
|
126
|
-
onClick:
|
|
127
|
-
className: `${
|
|
128
|
-
style:
|
|
129
|
-
role:
|
|
130
|
-
"aria-checked":
|
|
131
|
-
"aria-current":
|
|
132
|
-
"aria-label":
|
|
133
|
-
"aria-labelledby":
|
|
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
|
-
) :
|
|
141
|
+
) : l ? /* @__PURE__ */ o(
|
|
137
142
|
"button",
|
|
138
143
|
{
|
|
139
144
|
type: "button",
|
|
140
|
-
onClick:
|
|
145
|
+
onClick: l,
|
|
141
146
|
disabled: e,
|
|
142
|
-
className:
|
|
143
|
-
style:
|
|
144
|
-
role:
|
|
145
|
-
"aria-checked":
|
|
146
|
-
"aria-current":
|
|
147
|
-
"aria-label":
|
|
148
|
-
"aria-labelledby":
|
|
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:
|
|
152
|
-
},
|
|
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:
|
|
159
|
-
stickyTopOffset:
|
|
163
|
+
sticky: n = !1,
|
|
164
|
+
stickyTopOffset: d = 0,
|
|
160
165
|
divider: s = !1,
|
|
161
|
-
tone:
|
|
162
|
-
"aria-label":
|
|
163
|
-
className:
|
|
164
|
-
style:
|
|
166
|
+
tone: m = "default",
|
|
167
|
+
"aria-label": f,
|
|
168
|
+
className: C = "",
|
|
169
|
+
style: c
|
|
165
170
|
}) => {
|
|
166
|
-
const
|
|
167
|
-
return /* @__PURE__ */
|
|
168
|
-
/* @__PURE__ */
|
|
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 ${
|
|
172
|
-
style:
|
|
173
|
-
onClick:
|
|
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:
|
|
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 ${
|
|
185
|
+
className: `appearance-none bg-transparent border-0 p-0 flex items-center cursor-pointer ${B}`,
|
|
181
186
|
"aria-expanded": r,
|
|
182
|
-
"aria-controls":
|
|
183
|
-
"aria-label":
|
|
184
|
-
onClick: (
|
|
185
|
-
|
|
187
|
+
"aria-controls": l,
|
|
188
|
+
"aria-label": f,
|
|
189
|
+
onClick: (u) => {
|
|
190
|
+
u.stopPropagation(), b();
|
|
186
191
|
},
|
|
187
|
-
children: /* @__PURE__ */ o(
|
|
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:
|
|
199
|
+
r && /* @__PURE__ */ o("div", { id: l, children: a })
|
|
195
200
|
] });
|
|
196
201
|
},
|
|
197
|
-
{ Controls:
|
|
198
|
-
),
|
|
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":
|
|
204
|
-
"aria-labelledby":
|
|
208
|
+
"aria-label": n,
|
|
209
|
+
"aria-labelledby": d,
|
|
205
210
|
className: s = "",
|
|
206
|
-
style:
|
|
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:
|
|
216
|
+
style: { boxShadow: te, ...M, ...m },
|
|
212
217
|
role: e,
|
|
213
|
-
"aria-label":
|
|
214
|
-
"aria-labelledby":
|
|
218
|
+
"aria-label": n,
|
|
219
|
+
"aria-labelledby": d,
|
|
215
220
|
children: t
|
|
216
221
|
}
|
|
217
222
|
);
|
|
218
|
-
|
|
219
|
-
|
|
223
|
+
F.Row = j;
|
|
224
|
+
F.ExpandableRow = ie;
|
|
220
225
|
export {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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
|