@weasel-js/ui 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/ActionsBar-CAjrj_Pt.js +48 -0
- package/dist/chunks/{ActionsBar-CzU6Of3B.js.map → ActionsBar-CAjrj_Pt.js.map} +1 -1
- package/dist/chunks/{Callout-CxxrEcSb.js → Callout-DlirfLJl.js} +1 -1
- package/dist/chunks/{Callout-CxxrEcSb.js.map → Callout-DlirfLJl.js.map} +1 -1
- package/dist/chunks/{Checkbox-Cf6YHVWV.js → Checkbox-B3Z_u7k0.js} +1 -1
- package/dist/chunks/{Checkbox-Cf6YHVWV.js.map → Checkbox-B3Z_u7k0.js.map} +1 -1
- package/dist/chunks/{ColorField-sGLnThpB.js → ColorField-B4Hd2qqS.js} +1 -1
- package/dist/chunks/{ColorField-sGLnThpB.js.map → ColorField-B4Hd2qqS.js.map} +1 -1
- package/dist/chunks/{ComboBox-EnV1IytN.js → ComboBox-tbmgND-F.js} +2 -2
- package/dist/chunks/{ComboBox-EnV1IytN.js.map → ComboBox-tbmgND-F.js.map} +1 -1
- package/dist/chunks/{CurveEditor-DAb2EMyR.js → CurveEditor-CSKqAXMp.js} +1 -1
- package/dist/chunks/{CurveEditor-DAb2EMyR.js.map → CurveEditor-CSKqAXMp.js.map} +1 -1
- package/dist/chunks/{Dialog-CQymDCAl.js → Dialog-BFuakycR.js} +1 -1
- package/dist/chunks/{Dialog-CQymDCAl.js.map → Dialog-BFuakycR.js.map} +1 -1
- package/dist/chunks/{Field-BHSu2F3E.js → Field-DPxmJzZz.js} +1 -1
- package/dist/chunks/{Field-BHSu2F3E.js.map → Field-DPxmJzZz.js.map} +1 -1
- package/dist/chunks/{GradientEditor-Co9aGyRe.js → GradientEditor-3pYXGAPg.js} +3 -3
- package/dist/chunks/{GradientEditor-Co9aGyRe.js.map → GradientEditor-3pYXGAPg.js.map} +1 -1
- package/dist/chunks/{Input-qk44ESKC.js → Input-Dg_CYXg4.js} +2 -2
- package/dist/chunks/{Input-qk44ESKC.js.map → Input-Dg_CYXg4.js.map} +1 -1
- package/dist/chunks/{NumberField-CYhQeWoM.js → NumberField-BhxUgi43.js} +2 -2
- package/dist/chunks/{NumberField-CYhQeWoM.js.map → NumberField-BhxUgi43.js.map} +1 -1
- package/dist/chunks/OptionsBar-hQN-wfd-.js +52 -0
- package/dist/chunks/OptionsBar-hQN-wfd-.js.map +1 -0
- package/dist/chunks/{PointPlotter-EkbCBK9j.js → PointPlotter-DCSjvpN0.js} +2 -2
- package/dist/chunks/{PointPlotter-EkbCBK9j.js.map → PointPlotter-DCSjvpN0.js.map} +1 -1
- package/dist/chunks/{Powerline-Bg9M5oBK.js → Powerline-DkOTPnUV.js} +1 -1
- package/dist/chunks/{Powerline-Bg9M5oBK.js.map → Powerline-DkOTPnUV.js.map} +1 -1
- package/dist/chunks/{Prefs-DZjXp2Ln.js → Prefs-C4HfuTvm.js} +10 -10
- package/dist/chunks/{Prefs-DZjXp2Ln.js.map → Prefs-C4HfuTvm.js.map} +1 -1
- package/dist/chunks/{RadioGroup-rL2i3afr.js → RadioGroup-Bg3Rqxe2.js} +2 -2
- package/dist/chunks/{RadioGroup-rL2i3afr.js.map → RadioGroup-Bg3Rqxe2.js.map} +1 -1
- package/dist/chunks/{RangeSlider-DPldYd4O.js → RangeSlider-BvM_DGSr.js} +1 -1
- package/dist/chunks/{RangeSlider-DPldYd4O.js.map → RangeSlider-BvM_DGSr.js.map} +1 -1
- package/dist/chunks/{ResizeHandle-DR8X229y.js → ResizeHandle-BUkW2kZC.js} +1 -1
- package/dist/chunks/{ResizeHandle-DR8X229y.js.map → ResizeHandle-BUkW2kZC.js.map} +1 -1
- package/dist/chunks/{Select-vSeAbspK.js → Select-DC0AjrEe.js} +2 -2
- package/dist/chunks/{Select-vSeAbspK.js.map → Select-DC0AjrEe.js.map} +1 -1
- package/dist/chunks/{SelectionPanel-1mmALQba.js → SelectionPanel-DoTdisRY.js} +6 -6
- package/dist/chunks/{SelectionPanel-1mmALQba.js.map → SelectionPanel-DoTdisRY.js.map} +1 -1
- package/dist/chunks/{Sidebar-CigrFvpL.js → Sidebar-B8qig3BQ.js} +1 -1
- package/dist/chunks/{Sidebar-CigrFvpL.js.map → Sidebar-B8qig3BQ.js.map} +1 -1
- package/dist/chunks/{SidebarPanel-C0w16BrF.js → SidebarPanel-LOt2c-wb.js} +1 -1
- package/dist/chunks/{SidebarPanel-C0w16BrF.js.map → SidebarPanel-LOt2c-wb.js.map} +1 -1
- package/dist/chunks/{StatusBar-lt_Ok6WK.js → StatusBar-Cg2LzdAm.js} +1 -1
- package/dist/chunks/{StatusBar-lt_Ok6WK.js.map → StatusBar-Cg2LzdAm.js.map} +1 -1
- package/dist/chunks/{Switch-BYj762hm.js → Switch-I4putUAY.js} +1 -1
- package/dist/chunks/{Switch-BYj762hm.js.map → Switch-I4putUAY.js.map} +1 -1
- package/dist/chunks/{Tabs-DOW5jtnq.js → Tabs-irZuG_PN.js} +1 -1
- package/dist/chunks/{Tabs-DOW5jtnq.js.map → Tabs-irZuG_PN.js.map} +1 -1
- package/dist/chunks/{Toast-DLM2AsTz.js → Toast-BGYP8Pw0.js} +1 -1
- package/dist/chunks/{Toast-DLM2AsTz.js.map → Toast-BGYP8Pw0.js.map} +1 -1
- package/dist/chunks/ToggleBar-BP1zFcvg.js +74 -0
- package/dist/chunks/ToggleBar-BP1zFcvg.js.map +1 -0
- package/dist/chunks/{ToolButton-5L1sAlJC.js → ToolButton-DUeg8fPN.js} +1 -1
- package/dist/chunks/{ToolButton-5L1sAlJC.js.map → ToolButton-DUeg8fPN.js.map} +1 -1
- package/dist/chunks/{ToolGroup-BAthcF5H.js → ToolGroup-D0CvyQhQ.js} +1 -1
- package/dist/chunks/{ToolGroup-BAthcF5H.js.map → ToolGroup-D0CvyQhQ.js.map} +1 -1
- package/dist/chunks/{ToolOptionsBar-D4xmXa_a.js → ToolOptionsBar-N_MQcSo4.js} +1 -1
- package/dist/chunks/{ToolOptionsBar-D4xmXa_a.js.map → ToolOptionsBar-N_MQcSo4.js.map} +1 -1
- package/dist/chunks/{ToolPalette-BDkvV3pJ.js → ToolPalette-BipoMdZz.js} +3 -3
- package/dist/chunks/{ToolPalette-BDkvV3pJ.js.map → ToolPalette-BipoMdZz.js.map} +1 -1
- package/dist/chunks/useRovingTabIndex-DBZtq4IH.js +65 -0
- package/dist/chunks/useRovingTabIndex-DBZtq4IH.js.map +1 -0
- package/dist/components/ActionsBar/ActionsBar.d.ts.map +1 -1
- package/dist/components/ActionsBar/index.js +1 -1
- package/dist/components/Callout/index.js +1 -1
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/ColorField/index.js +1 -1
- package/dist/components/ComboBox/index.js +1 -1
- package/dist/components/CurveEditor/index.js +1 -1
- package/dist/components/Dialog/index.js +1 -1
- package/dist/components/Field/index.js +1 -1
- package/dist/components/GradientEditor/index.js +1 -1
- package/dist/components/Input/index.js +1 -1
- package/dist/components/NumberField/index.js +1 -1
- package/dist/components/OptionsBar/OptionsBar.d.ts.map +1 -1
- package/dist/components/OptionsBar/index.js +1 -1
- package/dist/components/PointPlotter/index.js +1 -1
- package/dist/components/Powerline/index.js +1 -1
- package/dist/components/Prefs/index.js +1 -1
- package/dist/components/RadioGroup/index.js +1 -1
- package/dist/components/RangeSlider/index.js +1 -1
- package/dist/components/ResizeHandle/index.js +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/SelectionPanel/index.js +1 -1
- package/dist/components/Sidebar/index.js +1 -1
- package/dist/components/SidebarPanel/index.js +1 -1
- package/dist/components/StatusBar/index.js +1 -1
- package/dist/components/Switch/index.js +1 -1
- package/dist/components/Tabs/index.js +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/ToggleBar/ToggleBar.d.ts.map +1 -1
- package/dist/components/ToggleBar/index.js +1 -1
- package/dist/components/ToolButton/index.js +1 -1
- package/dist/components/ToolGroup/index.js +1 -1
- package/dist/components/ToolOptionsBar/index.js +1 -1
- package/dist/components/ToolPalette/index.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -37
- package/dist/index.js.map +1 -1
- package/dist/useRovingTabIndex.d.ts +52 -0
- package/dist/useRovingTabIndex.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/chunks/ActionsBar-CzU6Of3B.js +0 -94
- package/dist/chunks/OptionsBar-CHOP_CiW.js +0 -98
- package/dist/chunks/OptionsBar-CHOP_CiW.js.map +0 -1
- package/dist/chunks/ToggleBar-Defj6Asn.js +0 -129
- package/dist/chunks/ToggleBar-Defj6Asn.js.map +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { t as e } from "./useRovingTabIndex-DBZtq4IH.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
var n = {
|
|
5
|
+
root: "_root_13y7a_6",
|
|
6
|
+
segment: "_segment_13y7a_28",
|
|
7
|
+
segmentSelected: "_segmentSelected_13y7a_75",
|
|
8
|
+
size_sm: "_size_sm_13y7a_133",
|
|
9
|
+
variant_minimal: "_variant_minimal_13y7a_146"
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/components/ActionsBar/ActionsBar.tsx
|
|
13
|
+
function r(r) {
|
|
14
|
+
let { items: i, ariaLabel: a, className: o, height: s, size: c, variant: l } = r, u = (e) => {
|
|
15
|
+
let t = i[e];
|
|
16
|
+
t.disabled || t.onAction();
|
|
17
|
+
}, d = e({
|
|
18
|
+
items: i,
|
|
19
|
+
itemClassName: n.segment,
|
|
20
|
+
onActivate: u
|
|
21
|
+
}), f = s === void 0 ? void 0 : { "--wzl-tb-height": `${s}px` }, p = [
|
|
22
|
+
n.root,
|
|
23
|
+
c && n[`size_${c}`],
|
|
24
|
+
l && n[`variant_${l}`],
|
|
25
|
+
o
|
|
26
|
+
].filter(Boolean).join(" ");
|
|
27
|
+
return /* @__PURE__ */ t("div", {
|
|
28
|
+
ref: d.rootRef,
|
|
29
|
+
className: p,
|
|
30
|
+
role: "toolbar",
|
|
31
|
+
"aria-label": a,
|
|
32
|
+
style: f,
|
|
33
|
+
children: i.map((e, r) => /* @__PURE__ */ t("button", {
|
|
34
|
+
type: "button",
|
|
35
|
+
"aria-label": e.ariaLabel,
|
|
36
|
+
disabled: e.disabled,
|
|
37
|
+
tabIndex: d.tabIndexFor(r),
|
|
38
|
+
className: n.segment,
|
|
39
|
+
onClick: () => u(r),
|
|
40
|
+
onKeyDown: d.onKeyDown(r),
|
|
41
|
+
children: e.label
|
|
42
|
+
}, e.value))
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { r as t };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=ActionsBar-CAjrj_Pt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionsBar-CzU6Of3B.js","names":[],"sources":["../../src/components/ActionsBar/ActionsBar.module.css","../../src/components/ActionsBar/ActionsBar.tsx"],"sourcesContent":["/* Aqua-glass segmented control. The track is a pill-shaped well; the\n selected segment becomes a tinted glass cylinder that reads as the same\n \"lozenge\" family as the standalone Button. Visual params come from the\n `--btn-*` custom properties (see Button.module.css) so the Button Lab\n can tune both surfaces with one set of sliders. */\n.root {\n display: inline-flex;\n height: var(--wzl-tb-height, 28px);\n padding: 2px;\n background: linear-gradient(\n 180deg,\n rgba(0, 0, 0, 0.18) 0%,\n rgba(0, 0, 0, 0.05) 100%\n );\n border-radius: 999px;\n /* Clip segments to the track outline so interior corners read crisp and\n the selected segment's glass treatment doesn't paint over the rounded\n outer pixels. */\n overflow: hidden;\n box-shadow:\n inset 0 1px 2px rgba(0, 0, 0, 0.4),\n 0 1px 0 rgba(255, 255, 255, 0.06);\n user-select: none;\n -webkit-user-select: none;\n touch-action: none;\n}\n\n.segment {\n position: relative;\n flex: 1 1 0;\n min-width: 0;\n padding: 0 12px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: none;\n margin: 0;\n font-family: var(--wzl-font-ui);\n font-weight: 300;\n font-size: var(--btn-fontsize, 14px);\n line-height: 1;\n color: var(--wzl-fg-muted);\n cursor: pointer;\n /* Only round the outer corners of the bar — middle segments stay square\n so the seams between them don't render as facing parentheses. */\n border-radius: 0;\n isolation: isolate;\n overflow: hidden;\n transition: color var(--wzl-motion-fast);\n}\n\n.segment:first-child {\n border-radius: 999px 0 0 999px;\n}\n\n.segment:last-child {\n border-radius: 0 999px 999px 0;\n}\n\n.segment:only-child {\n border-radius: 999px;\n}\n\n.segment:focus-visible {\n outline: 2px solid var(--wzl-accent);\n outline-offset: -2px;\n}\n\n.segment:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.segment:hover:not(:disabled):not(.segmentSelected) {\n color: var(--wzl-fg);\n}\n\n/* Selected segment — full Aqua glass cylinder. Mirrors Button.variant_primary. */\n.segmentSelected {\n background: linear-gradient(\n 180deg,\n color-mix(in srgb, var(--wzl-accent) var(--btn-top-alpha, 45%), transparent) 0%,\n color-mix(in srgb, var(--wzl-accent) var(--btn-upper-alpha, 70%), transparent) calc(var(--btn-equator, 52%) - var(--btn-equator-spread, 12%)),\n color-mix(in srgb, var(--wzl-accent) var(--btn-equator-tint, 95%), white) var(--btn-equator, 52%),\n var(--wzl-accent) calc(var(--btn-equator, 52%) + var(--btn-equator-spread, 12%) * 1.6),\n color-mix(in srgb, var(--wzl-accent) var(--btn-base-tint, 70%), black) 100%\n );\n backdrop-filter: blur(var(--btn-blur, 6px)) saturate(var(--btn-saturate, 1.3));\n -webkit-backdrop-filter: blur(var(--btn-blur, 6px)) saturate(var(--btn-saturate, 1.3));\n color: var(--wzl-fg-on-accent);\n text-shadow:\n 0 1px 0 rgba(0, 0, 0, var(--btn-text-shadow, 0.35)),\n var(--btn-text-inset-x, 0px) var(--btn-text-inset-y, 1px) 0 rgba(0, 0, 0, var(--btn-text-inset, 0.55)),\n 0 0 6px rgba(0, 0, 0, calc(var(--btn-text-shadow, 0.35) * 0.5));\n box-shadow:\n inset 0 1px 0 rgba(255, 255, 255, var(--btn-inset-hi, 0.42)),\n inset 0 -1px 2px rgba(0, 0, 0, var(--btn-inset-lo, 0.3)),\n 0 0 0 1px rgba(0, 0, 0, var(--btn-rim, 0.22)),\n 0 1px 2px rgba(0, 0, 0, var(--btn-drop-near, 0.3)),\n 0 2px 4px rgba(0, 0, 0, calc(var(--btn-drop-far, 0.18) * 0.8));\n}\n\n/* Specular gloss on the selected segment. Top corners inherit the\n segment's radius so they hug the upper edge cleanly; bottom corners\n are flattened so the gloss ends in a straight line at the equator\n instead of two little curves that read as `)(` brackets. */\n.segmentSelected::before {\n content: '';\n position: absolute;\n inset: 1px 1px var(--btn-gloss-bottom, 50%) 1px;\n border-radius: inherit;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n background: linear-gradient(\n 180deg,\n rgba(255, 255, 255, var(--btn-gloss-top, 0.42)) 0%,\n rgba(255, 255, 255, var(--btn-gloss-mid, 0.12)) 60%,\n rgba(255, 255, 255, 0) 100%\n );\n pointer-events: none;\n z-index: 1;\n}\n\n.segmentSelected > * {\n position: relative;\n z-index: 2;\n}\n\n/* Small variant — ~60% of the default height, with proportionally reduced\n padding and font. Sized for dense surfaces (lab control panels, inline\n filters, etc.). */\n.size_sm {\n height: 17px;\n padding: 1px;\n}\n\n.size_sm .segment {\n padding: 0 8px;\n font-size: 11px;\n}\n\n/* Minimal variant — strips the pill track, glass selected state, inset\n shadows, and outer padding. Used in dense diagnostic surfaces (dispatch\n trace, lab inspectors) where the bar must read as plain text controls. */\n.variant_minimal {\n height: auto;\n padding: 0;\n background: none;\n border-radius: 0;\n box-shadow: none;\n gap: 2px;\n}\n\n.variant_minimal .segment {\n padding: 0 4px;\n font-size: 11px;\n font-weight: 400;\n line-height: 1.4;\n border-radius: 2px;\n color: var(--wzl-fg-muted);\n transition: none;\n}\n\n.variant_minimal .segment:first-child,\n.variant_minimal .segment:last-child,\n.variant_minimal .segment:only-child {\n border-radius: 2px;\n}\n\n.variant_minimal .segment:hover:not(:disabled):not(.segmentSelected) {\n color: var(--wzl-fg);\n background: rgba(255, 255, 255, 0.06);\n}\n\n.variant_minimal .segmentSelected {\n background: none;\n backdrop-filter: none;\n -webkit-backdrop-filter: none;\n color: var(--wzl-accent-fg, var(--wzl-accent));\n text-shadow: none;\n box-shadow: none;\n font-weight: 500;\n}\n\n.variant_minimal .segmentSelected::before {\n content: none;\n}\n","import { useRef, type CSSProperties, type KeyboardEvent as ReactKeyboardEvent, type ReactElement, type ReactNode } from 'react';\nimport s from './ActionsBar.module.css';\n\nexport type ActionsBarItem<V extends string | number = string> = {\n value: V;\n label?: ReactNode;\n ariaLabel?: string;\n disabled?: boolean;\n onAction: () => void;\n};\n\nexport type ActionsBarSize = 'sm' | 'md';\nexport type ActionsBarVariant = 'default' | 'minimal';\n\nexport type ActionsBarProps<V extends string | number = string> = {\n items: readonly ActionsBarItem<V>[];\n ariaLabel?: string;\n className?: string;\n height?: number;\n size?: ActionsBarSize;\n variant?: ActionsBarVariant;\n};\n\nfunction firstEnabledIndex(items: readonly ActionsBarItem<string | number>[]): number {\n for (let i = 0; i < items.length; i++) if (!items[i].disabled) return i;\n return -1;\n}\n\nfunction lastEnabledIndex(items: readonly ActionsBarItem<string | number>[]): number {\n for (let i = items.length - 1; i >= 0; i--) if (!items[i].disabled) return i;\n return -1;\n}\n\nfunction nextEnabledIndex(items: readonly ActionsBarItem<string | number>[], from: number): number {\n const n = items.length;\n for (let k = 1; k <= n; k++) {\n const i = (from + k + n) % n;\n if (!items[i].disabled) return i;\n }\n return from;\n}\n\nfunction prevEnabledIndex(items: readonly ActionsBarItem<string | number>[], from: number): number {\n const n = items.length;\n for (let k = 1; k <= n; k++) {\n const i = (from - k + n) % n;\n if (!items[i].disabled) return i;\n }\n return from;\n}\n\nexport function ActionsBar<V extends string | number = string>(props: ActionsBarProps<V>): ReactElement {\n const { items, ariaLabel, className, height, size, variant } = props;\n const rootRef = useRef<HTMLDivElement | null>(null);\n\n const tabStopIndex = firstEnabledIndex(items);\n\n const fire = (index: number) => {\n const item = items[index];\n if (item.disabled) return;\n item.onAction();\n };\n\n const focusSegment = (index: number) => {\n const root = rootRef.current;\n if (!root) return;\n const buttons = root.querySelectorAll<HTMLButtonElement>(`.${s.segment}`);\n buttons[index]?.focus();\n };\n\n const handleKeyDown = (index: number) => (e: ReactKeyboardEvent<HTMLButtonElement>) => {\n let nextIndex = -1;\n switch (e.key) {\n case 'ArrowLeft':\n case 'ArrowUp':\n nextIndex = prevEnabledIndex(items, index);\n break;\n case 'ArrowRight':\n case 'ArrowDown':\n nextIndex = nextEnabledIndex(items, index);\n break;\n case 'Home':\n nextIndex = firstEnabledIndex(items);\n break;\n case 'End':\n nextIndex = lastEnabledIndex(items);\n break;\n case ' ':\n case 'Enter':\n e.preventDefault();\n fire(index);\n return;\n default:\n return;\n }\n if (nextIndex < 0 || nextIndex === index) return;\n e.preventDefault();\n focusSegment(nextIndex);\n };\n\n const style: CSSProperties | undefined = height !== undefined\n ? ({ ['--wzl-tb-height' as string]: `${height}px` } as CSSProperties)\n : undefined;\n\n const rootCls = [\n s.root,\n size && s[`size_${size}`],\n variant && s[`variant_${variant}`],\n className,\n ].filter(Boolean).join(' ');\n\n return (\n <div\n ref={rootRef}\n className={rootCls}\n role=\"toolbar\"\n aria-label={ariaLabel}\n style={style}\n >\n {items.map((item, i) => (\n <button\n key={item.value}\n type=\"button\"\n aria-label={item.ariaLabel}\n disabled={item.disabled}\n tabIndex={i === tabStopIndex ? 0 : -1}\n className={s.segment}\n onClick={() => fire(i)}\n onKeyDown={handleKeyDown(i)}\n >\n {item.label}\n </button>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;ACuBA,SAAS,EAAkB,GAA2D;AACpF,MAAK,IAAI,IAAI,GAAG,IAAI,EAAM,QAAQ,IAAK,KAAI,CAAC,EAAM,GAAG,SAAU,QAAO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A,MAAY,KAAK,MAAc,MACnC,EAAE,gBAAgB,EAClB,EAAa,EAAU;IAGnB,IAAmC,MAAW,KAAA,IAEhD,KAAA,IADC,EAAG,mBAA8B,GAAG,EAAO,KAAK;AAUrD,QACE,kBAAC,OAAD;EACE,KAAK;EACL,WAVY;GACd,EAAE;GACF,KAAQ,EAAE,QAAQ;GAClB,KAAW,EAAE,WAAW;GACxB;GACD,CAAC,OAAO,QAAQ,CAAC,KAAK,IAKR;EACX,MAAK;EACL,cAAY;EACL;YAEN,EAAM,KAAK,GAAM,MAChB,kBAAC,UAAD;GAEE,MAAK;GACL,cAAY,EAAK;GACjB,UAAU,EAAK;GACf,UAAU,MAAM,IAAe,IAAI;GACnC,WAAW,EAAE;GACb,eAAe,EAAK,EAAE;GACtB,WAAW,EAAc,EAAE;aAE1B,EAAK;GACC,EAVF,EAAK,MAUH,CACT;EACE,CAAA"}
|
|
1
|
+
{"version":3,"file":"ActionsBar-CAjrj_Pt.js","names":[],"sources":["../../src/components/ActionsBar/ActionsBar.module.css","../../src/components/ActionsBar/ActionsBar.tsx"],"sourcesContent":["/* Aqua-glass segmented control. The track is a pill-shaped well; the\n selected segment becomes a tinted glass cylinder that reads as the same\n \"lozenge\" family as the standalone Button. Visual params come from the\n `--btn-*` custom properties (see Button.module.css) so the Button Lab\n can tune both surfaces with one set of sliders. */\n.root {\n display: inline-flex;\n height: var(--wzl-tb-height, 28px);\n padding: 2px;\n background: linear-gradient(\n 180deg,\n rgba(0, 0, 0, 0.18) 0%,\n rgba(0, 0, 0, 0.05) 100%\n );\n border-radius: 999px;\n /* Clip segments to the track outline so interior corners read crisp and\n the selected segment's glass treatment doesn't paint over the rounded\n outer pixels. */\n overflow: hidden;\n box-shadow:\n inset 0 1px 2px rgba(0, 0, 0, 0.4),\n 0 1px 0 rgba(255, 255, 255, 0.06);\n user-select: none;\n -webkit-user-select: none;\n touch-action: none;\n}\n\n.segment {\n position: relative;\n flex: 1 1 0;\n min-width: 0;\n padding: 0 12px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: none;\n margin: 0;\n font-family: var(--wzl-font-ui);\n font-weight: 300;\n font-size: var(--btn-fontsize, 14px);\n line-height: 1;\n color: var(--wzl-fg-muted);\n cursor: pointer;\n /* Only round the outer corners of the bar — middle segments stay square\n so the seams between them don't render as facing parentheses. */\n border-radius: 0;\n isolation: isolate;\n overflow: hidden;\n transition: color var(--wzl-motion-fast);\n}\n\n.segment:first-child {\n border-radius: 999px 0 0 999px;\n}\n\n.segment:last-child {\n border-radius: 0 999px 999px 0;\n}\n\n.segment:only-child {\n border-radius: 999px;\n}\n\n.segment:focus-visible {\n outline: 2px solid var(--wzl-accent);\n outline-offset: -2px;\n}\n\n.segment:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.segment:hover:not(:disabled):not(.segmentSelected) {\n color: var(--wzl-fg);\n}\n\n/* Selected segment — full Aqua glass cylinder. Mirrors Button.variant_primary. */\n.segmentSelected {\n background: linear-gradient(\n 180deg,\n color-mix(in srgb, var(--wzl-accent) var(--btn-top-alpha, 45%), transparent) 0%,\n color-mix(in srgb, var(--wzl-accent) var(--btn-upper-alpha, 70%), transparent) calc(var(--btn-equator, 52%) - var(--btn-equator-spread, 12%)),\n color-mix(in srgb, var(--wzl-accent) var(--btn-equator-tint, 95%), white) var(--btn-equator, 52%),\n var(--wzl-accent) calc(var(--btn-equator, 52%) + var(--btn-equator-spread, 12%) * 1.6),\n color-mix(in srgb, var(--wzl-accent) var(--btn-base-tint, 70%), black) 100%\n );\n backdrop-filter: blur(var(--btn-blur, 6px)) saturate(var(--btn-saturate, 1.3));\n -webkit-backdrop-filter: blur(var(--btn-blur, 6px)) saturate(var(--btn-saturate, 1.3));\n color: var(--wzl-fg-on-accent);\n text-shadow:\n 0 1px 0 rgba(0, 0, 0, var(--btn-text-shadow, 0.35)),\n var(--btn-text-inset-x, 0px) var(--btn-text-inset-y, 1px) 0 rgba(0, 0, 0, var(--btn-text-inset, 0.55)),\n 0 0 6px rgba(0, 0, 0, calc(var(--btn-text-shadow, 0.35) * 0.5));\n box-shadow:\n inset 0 1px 0 rgba(255, 255, 255, var(--btn-inset-hi, 0.42)),\n inset 0 -1px 2px rgba(0, 0, 0, var(--btn-inset-lo, 0.3)),\n 0 0 0 1px rgba(0, 0, 0, var(--btn-rim, 0.22)),\n 0 1px 2px rgba(0, 0, 0, var(--btn-drop-near, 0.3)),\n 0 2px 4px rgba(0, 0, 0, calc(var(--btn-drop-far, 0.18) * 0.8));\n}\n\n/* Specular gloss on the selected segment. Top corners inherit the\n segment's radius so they hug the upper edge cleanly; bottom corners\n are flattened so the gloss ends in a straight line at the equator\n instead of two little curves that read as `)(` brackets. */\n.segmentSelected::before {\n content: '';\n position: absolute;\n inset: 1px 1px var(--btn-gloss-bottom, 50%) 1px;\n border-radius: inherit;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n background: linear-gradient(\n 180deg,\n rgba(255, 255, 255, var(--btn-gloss-top, 0.42)) 0%,\n rgba(255, 255, 255, var(--btn-gloss-mid, 0.12)) 60%,\n rgba(255, 255, 255, 0) 100%\n );\n pointer-events: none;\n z-index: 1;\n}\n\n.segmentSelected > * {\n position: relative;\n z-index: 2;\n}\n\n/* Small variant — ~60% of the default height, with proportionally reduced\n padding and font. Sized for dense surfaces (lab control panels, inline\n filters, etc.). */\n.size_sm {\n height: 17px;\n padding: 1px;\n}\n\n.size_sm .segment {\n padding: 0 8px;\n font-size: 11px;\n}\n\n/* Minimal variant — strips the pill track, glass selected state, inset\n shadows, and outer padding. Used in dense diagnostic surfaces (dispatch\n trace, lab inspectors) where the bar must read as plain text controls. */\n.variant_minimal {\n height: auto;\n padding: 0;\n background: none;\n border-radius: 0;\n box-shadow: none;\n gap: 2px;\n}\n\n.variant_minimal .segment {\n padding: 0 4px;\n font-size: 11px;\n font-weight: 400;\n line-height: 1.4;\n border-radius: 2px;\n color: var(--wzl-fg-muted);\n transition: none;\n}\n\n.variant_minimal .segment:first-child,\n.variant_minimal .segment:last-child,\n.variant_minimal .segment:only-child {\n border-radius: 2px;\n}\n\n.variant_minimal .segment:hover:not(:disabled):not(.segmentSelected) {\n color: var(--wzl-fg);\n background: rgba(255, 255, 255, 0.06);\n}\n\n.variant_minimal .segmentSelected {\n background: none;\n backdrop-filter: none;\n -webkit-backdrop-filter: none;\n color: var(--wzl-accent-fg, var(--wzl-accent));\n text-shadow: none;\n box-shadow: none;\n font-weight: 500;\n}\n\n.variant_minimal .segmentSelected::before {\n content: none;\n}\n","import { type CSSProperties, type ReactElement, type ReactNode } from 'react';\nimport s from './ActionsBar.module.css';\nimport { useRovingTabIndex } from '../../useRovingTabIndex';\n\nexport type ActionsBarItem<V extends string | number = string> = {\n value: V;\n label?: ReactNode;\n ariaLabel?: string;\n disabled?: boolean;\n onAction: () => void;\n};\n\nexport type ActionsBarSize = 'sm' | 'md';\nexport type ActionsBarVariant = 'default' | 'minimal';\n\nexport type ActionsBarProps<V extends string | number = string> = {\n items: readonly ActionsBarItem<V>[];\n ariaLabel?: string;\n className?: string;\n height?: number;\n size?: ActionsBarSize;\n variant?: ActionsBarVariant;\n};\n\nexport function ActionsBar<V extends string | number = string>(props: ActionsBarProps<V>): ReactElement {\n const { items, ariaLabel, className, height, size, variant } = props;\n\n const fire = (index: number) => {\n const item = items[index];\n if (item.disabled) return;\n item.onAction();\n };\n\n const roving = useRovingTabIndex({ items, itemClassName: s.segment, onActivate: fire });\n\n const style: CSSProperties | undefined = height !== undefined\n ? ({ ['--wzl-tb-height' as string]: `${height}px` } as CSSProperties)\n : undefined;\n\n const rootCls = [\n s.root,\n size && s[`size_${size}`],\n variant && s[`variant_${variant}`],\n className,\n ].filter(Boolean).join(' ');\n\n return (\n <div\n ref={roving.rootRef}\n className={rootCls}\n role=\"toolbar\"\n aria-label={ariaLabel}\n style={style}\n >\n {items.map((item, i) => (\n <button\n key={item.value}\n type=\"button\"\n aria-label={item.ariaLabel}\n disabled={item.disabled}\n tabIndex={roving.tabIndexFor(i)}\n className={s.segment}\n onClick={() => fire(i)}\n onKeyDown={roving.onKeyDown(i)}\n >\n {item.label}\n </button>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;ACwBA,SAAgB,EAA+C,GAAyC;CACtG,IAAM,EAAE,UAAO,cAAW,cAAW,WAAQ,SAAM,eAAY,GAEzD,KAAQ,MAAkB;EAC9B,IAAM,IAAO,EAAM;AACf,IAAK,YACT,EAAK,UAAU;IAGX,IAAS,EAAkB;EAAE;EAAO,eAAe,EAAE;EAAS,YAAY;EAAM,CAAC,EAEjF,IAAmC,MAAW,KAAA,IAEhD,KAAA,IADC,EAAG,mBAA8B,GAAG,EAAO,KAAK,EAG/C,IAAU;EACd,EAAE;EACF,KAAQ,EAAE,QAAQ;EAClB,KAAW,EAAE,WAAW;EACxB;EACD,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;AAE3B,QACE,kBAAC,OAAD;EACE,KAAK,EAAO;EACZ,WAAW;EACX,MAAK;EACL,cAAY;EACL;YAEN,EAAM,KAAK,GAAM,MAChB,kBAAC,UAAD;GAEE,MAAK;GACL,cAAY,EAAK;GACjB,UAAU,EAAK;GACf,UAAU,EAAO,YAAY,EAAE;GAC/B,WAAW,EAAE;GACb,eAAe,EAAK,EAAE;GACtB,WAAW,EAAO,UAAU,EAAE;aAE7B,EAAK;GACC,EAVF,EAAK,MAUH,CACT;EACE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Callout-CxxrEcSb.js","names":[],"sources":["../../src/components/Callout/Callout.module.css","../../src/components/Callout/Callout.tsx"],"sourcesContent":[".anchor {\n position: fixed;\n pointer-events: none;\n}\n\n.popover {\n /* Above Dialog overlay (1000) and ToastRegion (1100) — RAC sets no z-index. */\n z-index: 1200;\n --callout-accent: var(--wzl-accent-strong);\n background: var(--wzl-surface);\n border: 1px solid var(--callout-accent);\n border-radius: var(--wzl-radius-md);\n box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);\n color: var(--wzl-fg);\n font-family: var(--wzl-font-ui);\n max-width: 320px;\n transition: opacity var(--wzl-motion-fast);\n}\n\n.popover[data-entering],\n.popover[data-exiting] {\n opacity: 0;\n}\n\n.toneWarning {\n --callout-accent: var(--wzl-warning, #d99a3f);\n}\n\n.toneDanger {\n --callout-accent: var(--wzl-danger, #d94a3f);\n}\n\n.arrow svg {\n display: block;\n fill: var(--wzl-surface);\n stroke: var(--callout-accent);\n stroke-width: 1;\n}\n\n.arrow[data-placement='bottom'] svg {\n transform: rotate(180deg);\n}\n\n.arrow[data-placement='left'] svg {\n transform: rotate(-90deg);\n}\n\n.arrow[data-placement='right'] svg {\n transform: rotate(90deg);\n}\n\n.dialog {\n outline: none;\n max-height: inherit;\n display: flex;\n flex-direction: column;\n}\n\n.header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 12px 0;\n}\n\n.title {\n margin: 0;\n flex: 1;\n font-size: 13px;\n font-weight: 600;\n}\n\n.close {\n flex: 0 0 auto;\n background: none;\n border: none;\n color: var(--wzl-fg-muted);\n font-size: 16px;\n line-height: 1;\n padding: 2px 4px;\n cursor: pointer;\n border-radius: var(--wzl-radius-sm);\n}\n\n.close:hover {\n color: var(--wzl-fg);\n}\n\n.body {\n padding: 8px 12px 10px;\n font-size: 13px;\n line-height: 1.4;\n overflow-y: auto;\n}\n\n.footer {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n padding: 0 12px 10px;\n}\n","import { useCallback, useEffect, useId, useRef, type ReactNode, type RefObject } from 'react';\nimport { createPortal } from 'react-dom';\nimport {\n DialogTrigger,\n Popover as RACPopover,\n OverlayArrow,\n Dialog as RACDialog,\n Heading,\n type PopoverProps as RACPopoverProps,\n} from 'react-aria-components';\nimport s from './Callout.module.css';\n\nexport type CalloutTone = 'info' | 'warning' | 'danger';\n\n/**\n * Composition wrapper for press-to-open callouts:\n * `<CalloutTrigger><Pressable>…</Pressable><Callout>…</Callout></CalloutTrigger>`.\n * Re-exported RAC DialogTrigger — non-RAC trigger elements must be wrapped\n * in `<Pressable>` from react-aria-components.\n * In composed mode, put `defaultOpen` on `CalloutTrigger`, not `Callout` —\n * RAC detaches to local open state on the trigger, not the popover.\n */\nexport { DialogTrigger as CalloutTrigger };\n\nexport type CalloutProps = Omit<\n RACPopoverProps,\n 'children' | 'className' | 'isNonModal' | 'triggerRef'\n> & {\n children?: ReactNode;\n className?: string;\n /** Optional heading rendered above the body. */\n title?: ReactNode;\n /** Footer slot — typically action buttons. */\n footer?: ReactNode;\n /** Accent tone for border + arrow. Default `info`. */\n tone?: CalloutTone;\n /**\n * `true` — blocks interaction with the rest of the app until dismissed;\n * inner dialog is `role=\"alertdialog\"`. `false` (default) — non-blocking:\n * the app stays interactive; Esc / outside click / close button dismiss.\n */\n modal?: boolean;\n /**\n * Show the × button. Defaults to `!modal`. In programmatic\n * `triggerRef`/`anchorRect` modes the close button requires either\n * controlled open (`isOpen` + `onOpenChange`) or `onDismiss`; with only\n * `defaultOpen` it has no open-state setter to call and cannot close.\n */\n showCloseButton?: boolean;\n /**\n * The user asked for this callout to go away — the × button or Escape.\n *\n * Distinct from `onOpenChange`, which a non-modal popover *also* fires when\n * interaction or focus merely leaves it. On a canvas that's every click on\n * the artwork, so a consumer that pins `isOpen` and treats `onOpenChange`\n * as dismissal retires messages nobody read. Use this instead: it fires\n * only on a deliberate act, and never on incidental focus loss.\n */\n onDismiss?: () => void;\n /** Anchor to an arbitrary element (programmatic use, with `isOpen`). */\n triggerRef?: RefObject<Element | null>;\n /**\n * Anchor to a client-coordinate rect — e.g. a scene node's on-screen box.\n * The callout re-anchors whenever this rect changes, so a consumer that\n * recomputes it on pan, zoom, or scene edits keeps the arrow on its target.\n * Takes precedence over `triggerRef`.\n */\n anchorRect?: { x: number; y: number; width: number; height: number };\n};\n\nconst toneClass: Record<CalloutTone, string> = {\n info: s.toneInfo,\n warning: s.toneWarning,\n danger: s.toneDanger,\n};\n\n/**\n * Anchored callout with an arrow pointing at its source — a trigger\n * element, an arbitrary `triggerRef`, or a client-space `anchorRect`.\n * Wraps React Aria Popover + Dialog; positioning, collision flipping,\n * dismissal, and focus behavior come from the underlying primitives.\n */\nexport function Callout(props: CalloutProps) {\n const {\n children,\n className,\n title,\n footer,\n tone = 'info',\n modal = false,\n showCloseButton,\n onDismiss,\n triggerRef,\n anchorRect,\n placement = 'top',\n offset = 12,\n maxHeight = 400,\n onOpenChange,\n shouldCloseOnInteractOutside,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n ...rest\n } = props;\n const anchorRef = useRef<HTMLSpanElement>(null);\n const showClose = showCloseButton ?? !modal;\n // Escape is a dismissal like the × is. It can't ride on a React `onKeyDown`:\n // RAC's Dialog runs its props through filterDOMProps, which drops handlers\n // it doesn't know, so the listener goes on the section itself. RAC's own\n // Escape handling is untouched — this only adds the signal.\n const onDismissRef = useRef(onDismiss);\n onDismissRef.current = onDismiss;\n const escapeListener = useRef((e: KeyboardEvent) => {\n if (e.key === 'Escape') onDismissRef.current?.();\n });\n const listeningTo = useRef<HTMLElement | null>(null);\n const dialogRef = useCallback((node: HTMLElement | null) => {\n listeningTo.current?.removeEventListener('keydown', escapeListener.current);\n listeningTo.current = node;\n node?.addEventListener('keydown', escapeListener.current);\n }, []);\n const titleId = useId();\n // RAC positions on open and recomputes on scroll, resize, and a\n // ResizeObserver on the anchor — none of which fire when `anchorRect` is\n // merely *translated*, as it is when a consumer tracks a scene node across a\n // pan. (Zoom happens to work, since scaling also changes the anchor's size.)\n // Nudging RAC's own resize listener is the supported way to make it\n // recompute; there's no public updatePosition on Popover.\n useEffect(() => {\n if (anchorRect === undefined || typeof window === 'undefined') return;\n window.dispatchEvent(new Event('resize'));\n }, [anchorRect?.x, anchorRect?.y, anchorRect?.width, anchorRect?.height]);\n // RAC's popover role-heuristic misses alertdialog; label the outer role\n // it stamps. Upstream: react-spectrum Popover.mjs querySelector('[role=dialog]').\n const popoverAriaLabelledby =\n modal && title !== undefined ? titleId : ariaLabelledby;\n const popoverAriaLabel = modal ? ariaLabel : undefined;\n return (\n <>\n {/* Harmless while closed — RAC reads the ref only when the popover is open. */}\n {anchorRect !== undefined &&\n createPortal(\n <span\n ref={anchorRef}\n data-callout-anchor=\"\"\n className={s.anchor}\n aria-hidden=\"true\"\n // Dynamic geometry — inline style is the mechanism here, not styling.\n style={{\n left: anchorRect.x,\n top: anchorRect.y,\n width: anchorRect.width,\n height: anchorRect.height,\n }}\n />,\n document.body,\n )}\n <RACPopover\n {...rest}\n triggerRef={anchorRect !== undefined ? anchorRef : triggerRef}\n isNonModal={!modal}\n placement={placement}\n offset={offset}\n maxHeight={maxHeight}\n onOpenChange={onOpenChange}\n shouldCloseOnInteractOutside={\n shouldCloseOnInteractOutside ?? (modal ? () => false : undefined)\n }\n aria-label={popoverAriaLabel}\n aria-labelledby={popoverAriaLabelledby}\n className={[s.popover, toneClass[tone], className].filter(Boolean).join(' ')}\n >\n <OverlayArrow className={s.arrow}>\n <svg width={12} height={12} viewBox=\"0 0 12 12\" aria-hidden=\"true\">\n <path d=\"M0 0 L6 6 L12 0\" />\n </svg>\n </OverlayArrow>\n <RACDialog\n role={modal ? 'alertdialog' : 'dialog'}\n className={s.dialog}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n ref={dialogRef}\n >\n {({ close }) => (\n <>\n {(title !== undefined || showClose) && (\n <header className={s.header}>\n {title !== undefined && (\n <Heading id={titleId} slot=\"title\" className={s.title}>\n {title}\n </Heading>\n )}\n {showClose && (\n <button\n type=\"button\"\n className={s.close}\n onClick={() => {\n // `close()` resolves OverlayTriggerStateContext, only\n // provided by DialogTrigger (composed mode). In\n // triggerRef/anchorRect modes there is no such\n // context, so `close()` is a no-op there — the\n // controlled-open fallback below does the work.\n close();\n onOpenChange?.(false);\n onDismiss?.();\n }}\n aria-label=\"Close callout\"\n >\n ×\n </button>\n )}\n </header>\n )}\n <div className={s.body}>{children}</div>\n {footer !== undefined && <footer className={s.footer}>{footer}</footer>}\n </>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AAY,MAAe,KAAA,IAAwB,IAAZ;EACvC,YAAY,CAAC;EACF;EACH;EACG;EACG;EACd,8BACE,MAAiC,UAAc,KAAQ,KAAA;EAEzD,cAAY;EACZ,mBAAiB;EACjB,WAAW;GAAC,EAAE;GAAS,EAAU;GAAO;GAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;YAb9E,CAeE,kBAAC,GAAD;GAAc,WAAW,EAAE;aACzB,kBAAC,OAAD;IAAK,OAAO;IAAI,QAAQ;IAAI,SAAQ;IAAY,eAAY;cAC1D,kBAAC,QAAD,EAAM,GAAE,mBAAoB,CAAA;IACxB,CAAA;GACO,CAAA,EACf,kBAAC,GAAD;GACE,MAAM,IAAQ,gBAAgB;GAC9B,WAAW,EAAE;GACb,cAAY;GACZ,mBAAiB;GACjB,KAAK;cAEH,EAAE,eACF,kBAAA,GAAA,EAAA,UAAA;KACI,MAAU,KAAA,KAAa,MACvB,kBAAC,UAAD;KAAQ,WAAW,EAAE;eAArB,CACG,MAAU,KAAA,KACT,kBAAC,GAAD;MAAS,IAAI;MAAS,MAAK;MAAQ,WAAW,EAAE;gBAC7C;MACO,CAAA,EAEX,KACC,kBAAC,UAAD;MACE,MAAK;MACL,WAAW,EAAE;MACb,eAAe;AAQb,OAFA,GAAO,EACP,IAAe,GAAM,EACrB,KAAa;;MAEf,cAAW;gBACZ;MAEQ,CAAA,CAEJ;;IAEX,kBAAC,OAAD;KAAK,WAAW,EAAE;KAAO;KAAe,CAAA;IACvC,MAAW,KAAA,KAAa,kBAAC,UAAD;KAAQ,WAAW,EAAE;eAAS;KAAgB,CAAA;IACtE,EAAA,CAAA;GAEK,CAAA,CACD;IACZ,EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"Callout-DlirfLJl.js","names":[],"sources":["../../src/components/Callout/Callout.module.css","../../src/components/Callout/Callout.tsx"],"sourcesContent":[".anchor {\n position: fixed;\n pointer-events: none;\n}\n\n.popover {\n /* Above Dialog overlay (1000) and ToastRegion (1100) — RAC sets no z-index. */\n z-index: 1200;\n --callout-accent: var(--wzl-accent-strong);\n background: var(--wzl-surface);\n border: 1px solid var(--callout-accent);\n border-radius: var(--wzl-radius-md);\n box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);\n color: var(--wzl-fg);\n font-family: var(--wzl-font-ui);\n max-width: 320px;\n transition: opacity var(--wzl-motion-fast);\n}\n\n.popover[data-entering],\n.popover[data-exiting] {\n opacity: 0;\n}\n\n.toneWarning {\n --callout-accent: var(--wzl-warning, #d99a3f);\n}\n\n.toneDanger {\n --callout-accent: var(--wzl-danger, #d94a3f);\n}\n\n.arrow svg {\n display: block;\n fill: var(--wzl-surface);\n stroke: var(--callout-accent);\n stroke-width: 1;\n}\n\n.arrow[data-placement='bottom'] svg {\n transform: rotate(180deg);\n}\n\n.arrow[data-placement='left'] svg {\n transform: rotate(-90deg);\n}\n\n.arrow[data-placement='right'] svg {\n transform: rotate(90deg);\n}\n\n.dialog {\n outline: none;\n max-height: inherit;\n display: flex;\n flex-direction: column;\n}\n\n.header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 12px 0;\n}\n\n.title {\n margin: 0;\n flex: 1;\n font-size: 13px;\n font-weight: 600;\n}\n\n.close {\n flex: 0 0 auto;\n background: none;\n border: none;\n color: var(--wzl-fg-muted);\n font-size: 16px;\n line-height: 1;\n padding: 2px 4px;\n cursor: pointer;\n border-radius: var(--wzl-radius-sm);\n}\n\n.close:hover {\n color: var(--wzl-fg);\n}\n\n.body {\n padding: 8px 12px 10px;\n font-size: 13px;\n line-height: 1.4;\n overflow-y: auto;\n}\n\n.footer {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n padding: 0 12px 10px;\n}\n","import { useCallback, useEffect, useId, useRef, type ReactNode, type RefObject } from 'react';\nimport { createPortal } from 'react-dom';\nimport {\n DialogTrigger,\n Popover as RACPopover,\n OverlayArrow,\n Dialog as RACDialog,\n Heading,\n type PopoverProps as RACPopoverProps,\n} from 'react-aria-components';\nimport s from './Callout.module.css';\n\nexport type CalloutTone = 'info' | 'warning' | 'danger';\n\n/**\n * Composition wrapper for press-to-open callouts:\n * `<CalloutTrigger><Pressable>…</Pressable><Callout>…</Callout></CalloutTrigger>`.\n * Re-exported RAC DialogTrigger — non-RAC trigger elements must be wrapped\n * in `<Pressable>` from react-aria-components.\n * In composed mode, put `defaultOpen` on `CalloutTrigger`, not `Callout` —\n * RAC detaches to local open state on the trigger, not the popover.\n */\nexport { DialogTrigger as CalloutTrigger };\n\nexport type CalloutProps = Omit<\n RACPopoverProps,\n 'children' | 'className' | 'isNonModal' | 'triggerRef'\n> & {\n children?: ReactNode;\n className?: string;\n /** Optional heading rendered above the body. */\n title?: ReactNode;\n /** Footer slot — typically action buttons. */\n footer?: ReactNode;\n /** Accent tone for border + arrow. Default `info`. */\n tone?: CalloutTone;\n /**\n * `true` — blocks interaction with the rest of the app until dismissed;\n * inner dialog is `role=\"alertdialog\"`. `false` (default) — non-blocking:\n * the app stays interactive; Esc / outside click / close button dismiss.\n */\n modal?: boolean;\n /**\n * Show the × button. Defaults to `!modal`. In programmatic\n * `triggerRef`/`anchorRect` modes the close button requires either\n * controlled open (`isOpen` + `onOpenChange`) or `onDismiss`; with only\n * `defaultOpen` it has no open-state setter to call and cannot close.\n */\n showCloseButton?: boolean;\n /**\n * The user asked for this callout to go away — the × button or Escape.\n *\n * Distinct from `onOpenChange`, which a non-modal popover *also* fires when\n * interaction or focus merely leaves it. On a canvas that's every click on\n * the artwork, so a consumer that pins `isOpen` and treats `onOpenChange`\n * as dismissal retires messages nobody read. Use this instead: it fires\n * only on a deliberate act, and never on incidental focus loss.\n */\n onDismiss?: () => void;\n /** Anchor to an arbitrary element (programmatic use, with `isOpen`). */\n triggerRef?: RefObject<Element | null>;\n /**\n * Anchor to a client-coordinate rect — e.g. a scene node's on-screen box.\n * The callout re-anchors whenever this rect changes, so a consumer that\n * recomputes it on pan, zoom, or scene edits keeps the arrow on its target.\n * Takes precedence over `triggerRef`.\n */\n anchorRect?: { x: number; y: number; width: number; height: number };\n};\n\nconst toneClass: Record<CalloutTone, string> = {\n info: s.toneInfo,\n warning: s.toneWarning,\n danger: s.toneDanger,\n};\n\n/**\n * Anchored callout with an arrow pointing at its source — a trigger\n * element, an arbitrary `triggerRef`, or a client-space `anchorRect`.\n * Wraps React Aria Popover + Dialog; positioning, collision flipping,\n * dismissal, and focus behavior come from the underlying primitives.\n */\nexport function Callout(props: CalloutProps) {\n const {\n children,\n className,\n title,\n footer,\n tone = 'info',\n modal = false,\n showCloseButton,\n onDismiss,\n triggerRef,\n anchorRect,\n placement = 'top',\n offset = 12,\n maxHeight = 400,\n onOpenChange,\n shouldCloseOnInteractOutside,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n ...rest\n } = props;\n const anchorRef = useRef<HTMLSpanElement>(null);\n const showClose = showCloseButton ?? !modal;\n // Escape is a dismissal like the × is. It can't ride on a React `onKeyDown`:\n // RAC's Dialog runs its props through filterDOMProps, which drops handlers\n // it doesn't know, so the listener goes on the section itself. RAC's own\n // Escape handling is untouched — this only adds the signal.\n const onDismissRef = useRef(onDismiss);\n onDismissRef.current = onDismiss;\n const escapeListener = useRef((e: KeyboardEvent) => {\n if (e.key === 'Escape') onDismissRef.current?.();\n });\n const listeningTo = useRef<HTMLElement | null>(null);\n const dialogRef = useCallback((node: HTMLElement | null) => {\n listeningTo.current?.removeEventListener('keydown', escapeListener.current);\n listeningTo.current = node;\n node?.addEventListener('keydown', escapeListener.current);\n }, []);\n const titleId = useId();\n // RAC positions on open and recomputes on scroll, resize, and a\n // ResizeObserver on the anchor — none of which fire when `anchorRect` is\n // merely *translated*, as it is when a consumer tracks a scene node across a\n // pan. (Zoom happens to work, since scaling also changes the anchor's size.)\n // Nudging RAC's own resize listener is the supported way to make it\n // recompute; there's no public updatePosition on Popover.\n useEffect(() => {\n if (anchorRect === undefined || typeof window === 'undefined') return;\n window.dispatchEvent(new Event('resize'));\n }, [anchorRect?.x, anchorRect?.y, anchorRect?.width, anchorRect?.height]);\n // RAC's popover role-heuristic misses alertdialog; label the outer role\n // it stamps. Upstream: react-spectrum Popover.mjs querySelector('[role=dialog]').\n const popoverAriaLabelledby =\n modal && title !== undefined ? titleId : ariaLabelledby;\n const popoverAriaLabel = modal ? ariaLabel : undefined;\n return (\n <>\n {/* Harmless while closed — RAC reads the ref only when the popover is open. */}\n {anchorRect !== undefined &&\n createPortal(\n <span\n ref={anchorRef}\n data-callout-anchor=\"\"\n className={s.anchor}\n aria-hidden=\"true\"\n // Dynamic geometry — inline style is the mechanism here, not styling.\n style={{\n left: anchorRect.x,\n top: anchorRect.y,\n width: anchorRect.width,\n height: anchorRect.height,\n }}\n />,\n document.body,\n )}\n <RACPopover\n {...rest}\n triggerRef={anchorRect !== undefined ? anchorRef : triggerRef}\n isNonModal={!modal}\n placement={placement}\n offset={offset}\n maxHeight={maxHeight}\n onOpenChange={onOpenChange}\n shouldCloseOnInteractOutside={\n shouldCloseOnInteractOutside ?? (modal ? () => false : undefined)\n }\n aria-label={popoverAriaLabel}\n aria-labelledby={popoverAriaLabelledby}\n className={[s.popover, toneClass[tone], className].filter(Boolean).join(' ')}\n >\n <OverlayArrow className={s.arrow}>\n <svg width={12} height={12} viewBox=\"0 0 12 12\" aria-hidden=\"true\">\n <path d=\"M0 0 L6 6 L12 0\" />\n </svg>\n </OverlayArrow>\n <RACDialog\n role={modal ? 'alertdialog' : 'dialog'}\n className={s.dialog}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n ref={dialogRef}\n >\n {({ close }) => (\n <>\n {(title !== undefined || showClose) && (\n <header className={s.header}>\n {title !== undefined && (\n <Heading id={titleId} slot=\"title\" className={s.title}>\n {title}\n </Heading>\n )}\n {showClose && (\n <button\n type=\"button\"\n className={s.close}\n onClick={() => {\n // `close()` resolves OverlayTriggerStateContext, only\n // provided by DialogTrigger (composed mode). In\n // triggerRef/anchorRect modes there is no such\n // context, so `close()` is a no-op there — the\n // controlled-open fallback below does the work.\n close();\n onOpenChange?.(false);\n onDismiss?.();\n }}\n aria-label=\"Close callout\"\n >\n ×\n </button>\n )}\n </header>\n )}\n <div className={s.body}>{children}</div>\n {footer !== undefined && <footer className={s.footer}>{footer}</footer>}\n </>\n )}\n </RACDialog>\n </RACPopover>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;GCsEM,IAAyC;CAC7C,MAAM,EAAE;CACR,SAAS,EAAE;CACX,QAAQ,EAAE;CACX;AAQD,SAAgB,EAAQ,GAAqB;CAC3C,IAAM,EACJ,aACA,cACA,UACA,WACA,UAAO,QACP,WAAQ,IACR,oBACA,cACA,eACA,eACA,eAAY,OACZ,YAAS,IACT,eAAY,KACZ,iBACA,iCACA,cAAc,GACd,mBAAmB,GACnB,GAAG,MACD,GACE,IAAY,EAAwB,KAAK,EACzC,IAAY,KAAmB,CAAC,GAKhC,IAAe,EAAO,EAAU;AACtC,GAAa,UAAU;CACvB,IAAM,IAAiB,GAAQ,MAAqB;AAClD,EAAI,EAAE,QAAQ,YAAU,EAAa,WAAW;GAChD,EACI,IAAc,EAA2B,KAAK,EAC9C,IAAY,GAAa,MAA6B;AAG1D,EAFA,EAAY,SAAS,oBAAoB,WAAW,EAAe,QAAQ,EAC3E,EAAY,UAAU,GACtB,GAAM,iBAAiB,WAAW,EAAe,QAAQ;IACxD,EAAE,CAAC,EACA,IAAU,GAAO;AAOvB,SAAgB;AACV,QAAe,KAAA,KAAa,OAAO,SAAW,OAClD,OAAO,cAAc,IAAI,MAAM,SAAS,CAAC;IACxC;EAAC,GAAY;EAAG,GAAY;EAAG,GAAY;EAAO,GAAY;EAAO,CAAC;CAGzE,IAAM,IACJ,KAAS,MAAU,KAAA,IAAY,IAAU,GACrC,IAAmB,IAAQ,IAAY,KAAA;AAC7C,QACE,kBAAA,GAAA,EAAA,UAAA,CAEG,MAAe,KAAA,KACd,EACE,kBAAC,QAAD;EACE,KAAK;EACL,uBAAoB;EACpB,WAAW,EAAE;EACb,eAAY;EAEZ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"version":3,"file":"Checkbox-
|
|
1
|
+
{"version":3,"file":"Checkbox-B3Z_u7k0.js","names":[],"sources":["../../src/components/Checkbox/Checkbox.module.css","../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":[".checkbox {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n cursor: pointer;\n font-family: var(--wzl-font-ui);\n font-size: 13px;\n color: var(--wzl-fg);\n user-select: none;\n -webkit-user-select: none;\n}\n\n.checkbox[data-disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.box {\n position: relative;\n flex: 0 0 auto;\n width: 14px;\n height: 14px;\n background: var(--wzl-surface-sunken);\n border: 1px solid var(--wzl-border-strong);\n border-radius: var(--wzl-radius-sm);\n transition: background-color var(--wzl-motion-fast), border-color var(--wzl-motion-fast), box-shadow var(--wzl-motion-fast);\n}\n\n.checkbox[data-focus-visible] .box {\n box-shadow: 0 0 0 2px var(--wzl-focus-ring);\n}\n\n.checkbox[data-hovered]:not([data-disabled]) .box {\n border-color: var(--wzl-fg-muted);\n}\n\n.checkbox[data-selected] .box,\n.checkbox[data-indeterminate] .box {\n background: var(--wzl-accent-strong);\n border-color: var(--wzl-accent-strong);\n}\n\n.checkbox[data-invalid] .box {\n border-color: var(--wzl-danger, #ff5b5b);\n}\n\n.checkmark {\n position: absolute;\n inset: 0;\n color: var(--wzl-fg-on-accent);\n opacity: 0;\n pointer-events: none;\n}\n\n.checkbox[data-selected] .checkmark,\n.checkbox[data-indeterminate] .checkmark {\n opacity: 1;\n}\n\n.label {\n line-height: 1.2;\n}\n","import { forwardRef, type ReactNode, type Ref } from 'react';\nimport {\n Checkbox as RACCheckbox,\n type CheckboxProps as RACCheckboxProps,\n} from 'react-aria-components';\nimport s from './Checkbox.module.css';\n\nexport type CheckboxProps = Omit<RACCheckboxProps, 'children' | 'className'> & {\n children?: ReactNode;\n className?: string;\n};\n\n/**\n * Single checkbox wrapping React Aria's Checkbox. Supports indeterminate\n * via `isIndeterminate`. The label is supplied as children.\n */\nexport const Checkbox = forwardRef(function Checkbox(\n props: CheckboxProps,\n ref: Ref<HTMLLabelElement>,\n) {\n const { children, className, ...rest } = props;\n return (\n <RACCheckbox\n {...rest}\n ref={ref}\n className={[s.checkbox, className].filter(Boolean).join(' ')}\n >\n {({ isIndeterminate }) => (\n <>\n <span className={s.box}>\n <svg className={s.checkmark} viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n {isIndeterminate ? (\n <line x1=\"3\" y1=\"7\" x2=\"11\" y2=\"7\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" />\n ) : (\n <polyline\n points=\"3,7.5 6,10.5 11,4.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n )}\n </svg>\n </span>\n {children !== undefined && <span className={s.label}>{children}</span>}\n </>\n )}\n </RACCheckbox>\n );\n});\n"],"mappings":";;;;;;;;GCgBa,IAAW,EAAW,SACjC,GACA,GACA;CACA,IAAM,EAAE,aAAU,cAAW,GAAG,MAAS;AACzC,QACE,kBAAC,GAAD;EACE,GAAI;EACC;EACL,WAAW,CAAC,EAAE,UAAU,EAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;aAE1D,EAAE,yBACF,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,QAAD;GAAM,WAAW,EAAE;aACjB,kBAAC,OAAD;IAAK,WAAW,EAAE;IAAW,SAAQ;IAAY,eAAY;cAC1D,IACC,kBAAC,QAAD;KAAM,IAAG;KAAI,IAAG;KAAI,IAAG;KAAK,IAAG;KAAI,QAAO;KAAe,aAAY;KAAI,eAAc;KAAU,CAAA,GAEjG,kBAAC,YAAD;KACE,QAAO;KACP,MAAK;KACL,QAAO;KACP,aAAY;KACZ,eAAc;KACd,gBAAe;KACf,CAAA;IAEA,CAAA;GACD,CAAA,EACN,MAAa,KAAA,KAAa,kBAAC,QAAD;GAAM,WAAW,EAAE;GAAQ;GAAgB,CAAA,CACrE,EAAA,CAAA;EAEO,CAAA;EAEhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorField-
|
|
1
|
+
{"version":3,"file":"ColorField-B4Hd2qqS.js","names":[],"sources":["../../src/components/ColorField/ColorField.module.css","../../src/components/ColorField/ColorField.tsx"],"sourcesContent":[".root {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n}\n\n.chip {\n position: relative;\n display: inline-flex;\n border-radius: 4px;\n overflow: hidden;\n}\n\n.color {\n inline-size: 28px;\n block-size: 20px;\n padding: 0;\n border: 1px solid var(--wzl-border, #444);\n border-radius: 4px;\n background: none;\n cursor: pointer;\n}\n\n/* Indeterminate (mixed) presentation: checkerboard overlay atop the\n * swatch. pointer-events: none so the input stays clickable. */\n.root[data-mixed] .chip::after {\n content: '';\n position: absolute;\n inset: 1px;\n border-radius: 3px;\n pointer-events: none;\n background: repeating-conic-gradient(\n var(--wzl-border, #666) 0% 25%,\n var(--wzl-surface, #2e2f36) 0% 50%\n )\n 50% / 8px 8px;\n}\n\n.alphaRange {\n flex: 1;\n min-inline-size: 48px;\n accent-color: var(--wzl-accent, #7ab8d4);\n}\n\n.alphaRange:disabled {\n opacity: 0.45;\n}\n\n.alphaReadout {\n min-inline-size: 3ch;\n text-align: end;\n font-size: 11px;\n opacity: 0.7;\n}\n","import { useState } from 'react';\nimport { toHex8, getAlpha01, withAlpha01 } from '@weasel-js/core';\nimport s from './ColorField.module.css';\n\nexport interface ColorFieldProps {\n /** Current color, `#rrggbb` or `#rrggbbaa`. Omit when `mixed`. */\n value?: string;\n /** Indeterminate presentation (multi-selection with differing colors):\n * checkered chip, empty value. The first color edit produces a real\n * value; the opacity slider stays disabled until then (an alpha-only\n * edit would otherwise commit a value composed against the\n * placeholder black). */\n mixed?: boolean;\n /** Show the opacity slider; emitted values are `#rrggbbaa`. */\n alpha?: boolean;\n /** Live value during interaction (picker drag, slider drag). Optional —\n * wire it for live preview; omit it for commit-only consumers. */\n onInput?: (hex: string) => void;\n /** Committed value — picker close (blur) or slider release. One call\n * per user gesture; pair with an undoable write. */\n onChange: (hex: string) => void;\n 'aria-label'?: string;\n className?: string;\n}\n\n/**\n * Compact color editor: native color input + optional opacity slider.\n * Commit semantics are gesture-based (see `onChange`) because native\n * color/range inputs fire `change` continuously during interaction —\n * commit-on-change would emit one undo entry per tick.\n */\nexport function ColorField(props: ColorFieldProps) {\n const { value, mixed = false, alpha = false, onInput, onChange, className } = props;\n const hex8 = toHex8(value ?? '#000000');\n const rgb6 = hex8.slice(0, 7);\n const alpha01 = getAlpha01(hex8);\n const alphaPct = Math.round(alpha01 * 100);\n\n // Drafts track the control during a gesture (the committed prop only\n // updates after onChange), then reset to follow the prop again.\n const [colorDraft, setColorDraft] = useState<string | null>(null);\n const [alphaDraft, setAlphaDraft] = useState<number | null>(null);\n const visibleRgb = colorDraft ?? rgb6;\n const visibleAlphaPct = alphaDraft ?? alphaPct;\n\n const compose = (rgb: string, a01: number): string =>\n alpha ? withAlpha01(rgb, a01) : rgb;\n\n // Mixed with no color edit yet: the alpha slider has nothing real to\n // compose against (rgb6 is the placeholder black), so keep it disabled\n // until the first color edit lands.\n const alphaLocked = mixed && colorDraft === null;\n\n // Commit only when a gesture actually changed something — blur with no\n // preceding input must not emit (it would create a no-op undo entry).\n const commit = (rgb: string, a01: number): void => {\n if (colorDraft === null && alphaDraft === null) return;\n onChange(compose(rgb, a01));\n setColorDraft(null);\n setAlphaDraft(null);\n };\n\n return (\n <span\n className={[s.root, className].filter(Boolean).join(' ')}\n {...(mixed && colorDraft === null ? { 'data-mixed': '' } : {})}\n >\n <span className={s.chip}>\n <input\n className={s.color}\n type=\"color\"\n value={visibleRgb}\n aria-label={props['aria-label'] ?? 'Color'}\n onInput={(e) => {\n const rgb = (e.target as HTMLInputElement).value;\n setColorDraft(rgb);\n onInput?.(compose(rgb, visibleAlphaPct / 100));\n }}\n onBlur={() => commit(visibleRgb, visibleAlphaPct / 100)}\n />\n </span>\n {alpha && (\n <>\n <input\n className={s.alphaRange}\n type=\"range\"\n min={0}\n max={100}\n step={1}\n value={visibleAlphaPct}\n disabled={alphaLocked}\n aria-label={props['aria-label'] ? `${props['aria-label']} opacity` : 'Opacity'}\n onInput={(e) => {\n const pct = Number((e.target as HTMLInputElement).value);\n setAlphaDraft(pct);\n onInput?.(compose(visibleRgb, pct / 100));\n }}\n onPointerUp={() => commit(visibleRgb, visibleAlphaPct / 100)}\n onPointerCancel={() => commit(visibleRgb, visibleAlphaPct / 100)}\n onKeyUp={() => commit(visibleRgb, visibleAlphaPct / 100)}\n onBlur={() => commit(visibleRgb, visibleAlphaPct / 100)}\n />\n <span className={s.alphaReadout} aria-hidden=\"true\">{visibleAlphaPct}</span>\n </>\n )}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;AC+BA,SAAgB,EAAW,GAAwB;CACjD,IAAM,EAAE,UAAO,WAAQ,IAAO,WAAQ,IAAO,YAAS,aAAU,iBAAc,GACxE,IAAO,EAAO,KAAS,UAAU,EACjC,IAAO,EAAK,MAAM,GAAG,EAAE,EACvB,IAAU,EAAW,EAAK,EAC1B,IAAW,KAAK,MAAM,IAAU,IAAI,EAIpC,CAAC,GAAY,KAAiB,EAAwB,KAAK,EAC3D,CAAC,GAAY,KAAiB,EAAwB,KAAK,EAC3D,IAAa,KAAc,GAC3B,IAAkB,KAAc,GAEhC,KAAW,GAAa,MAC5B,IAAQ,EAAY,GAAK,EAAI,GAAG,GAK5B,IAAc,KAAS,MAAe,MAItC,KAAU,GAAa,MAAsB;AAC7C,QAAe,QAAQ,MAAe,SAC1C,EAAS,EAAQ,GAAK,EAAI,CAAC,EAC3B,EAAc,KAAK,EACnB,EAAc,KAAK;;AAGrB,QACE,kBAAC,QAAD;EACE,WAAW,CAAC,EAAE,MAAM,EAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;EACxD,GAAK,KAAS,MAAe,OAAO,EAAE,cAAc,IAAI,GAAG,EAAE;YAF/D,CAIE,kBAAC,QAAD;GAAM,WAAW,EAAE;aACjB,kBAAC,SAAD;IACE,WAAW,EAAE;IACb,MAAK;IACL,OAAO;IACP,cAAY,EAAM,iBAAiB;IACnC,UAAU,MAAM;KACd,IAAM,IAAO,EAAE,OAA4B;AAE3C,KADA,EAAc,EAAI,EAClB,IAAU,EAAQ,GAAK,IAAkB,IAAI,CAAC;;IAEhD,cAAc,EAAO,GAAY,IAAkB,IAAI;IACvD,CAAA;GACG,CAAA,EACN,KACC,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,SAAD;GACE,WAAW,EAAE;GACb,MAAK;GACL,KAAK;GACL,KAAK;GACL,MAAM;GACN,OAAO;GACP,UAAU;GACV,cAAY,EAAM,gBAAgB,GAAG,EAAM,cAAc,YAAY;GACrE,UAAU,MAAM;IACd,IAAM,IAAM,OAAQ,EAAE,OAA4B,MAAM;AAExD,IADA,EAAc,EAAI,EAClB,IAAU,EAAQ,GAAY,IAAM,IAAI,CAAC;;GAE3C,mBAAmB,EAAO,GAAY,IAAkB,IAAI;GAC5D,uBAAuB,EAAO,GAAY,IAAkB,IAAI;GAChE,eAAe,EAAO,GAAY,IAAkB,IAAI;GACxD,cAAc,EAAO,GAAY,IAAkB,IAAI;GACvD,CAAA,EACF,kBAAC,QAAD;GAAM,WAAW,EAAE;GAAc,eAAY;aAAQ;GAAuB,CAAA,CAC3E,EAAA,CAAA,CAEA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e } from "./Field-
|
|
1
|
+
import { n as e } from "./Field-DPxmJzZz.js";
|
|
2
2
|
import { Button as t, ComboBox as n, FieldError as r, Input as i, Label as a, ListBox as o, ListBoxItem as s, Popover as c, Text as l } from "react-aria-components";
|
|
3
3
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
4
4
|
var f = {
|
|
@@ -85,4 +85,4 @@ function m({ className: e, ...t }) {
|
|
|
85
85
|
//#endregion
|
|
86
86
|
export { m as n, p as t };
|
|
87
87
|
|
|
88
|
-
//# sourceMappingURL=ComboBox-
|
|
88
|
+
//# sourceMappingURL=ComboBox-tbmgND-F.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboBox-
|
|
1
|
+
{"version":3,"file":"ComboBox-tbmgND-F.js","names":[],"sources":["../../src/components/ComboBox/ComboBox.module.css","../../src/components/ComboBox/ComboBox.tsx"],"sourcesContent":[".field {\n display: flex;\n flex-direction: column;\n width: 100%;\n min-width: 0;\n gap: 4px;\n}\n\n.frame {\n display: flex;\n align-items: stretch;\n height: 24px;\n background: var(--wzl-surface-sunken);\n border: 1px solid var(--wzl-border);\n border-radius: var(--wzl-radius-sm);\n color: var(--wzl-fg);\n font-family: var(--wzl-font-ui);\n font-size: 13px;\n line-height: 1;\n overflow: hidden;\n transition: border-color var(--wzl-motion-fast), box-shadow var(--wzl-motion-fast);\n}\n\n.frame:focus-within {\n border-color: var(--wzl-focus-ring);\n box-shadow: 0 0 0 1px var(--wzl-focus-ring);\n}\n\n.field[data-invalid] .frame {\n border-color: var(--wzl-danger, #ff5b5b);\n}\n\n.field[data-disabled] .frame {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.frame input {\n flex: 1;\n min-width: 0;\n background: transparent;\n border: none;\n outline: none;\n color: inherit;\n font: inherit;\n padding: 0 8px;\n}\n\n.frame input::placeholder {\n color: var(--wzl-fg-subtle);\n}\n\n.openButton {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 22px;\n background: transparent;\n border: none;\n border-left: 1px solid var(--wzl-border);\n color: var(--wzl-fg-muted);\n cursor: pointer;\n padding: 0;\n}\n\n.openButton[data-hovered]:not([data-disabled]) {\n color: var(--wzl-fg);\n}\n\n.openButton svg {\n width: 10px;\n height: 10px;\n}\n\n.popover {\n min-width: var(--trigger-width);\n outline: none;\n}\n\n.listbox {\n background: var(--wzl-surface-raised);\n border: 1px solid var(--wzl-border);\n border-radius: var(--wzl-radius-md);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);\n padding: 4px;\n max-height: 280px;\n overflow: auto;\n outline: none;\n font-family: var(--wzl-font-ui);\n font-size: 13px;\n}\n\n.option {\n display: flex;\n align-items: center;\n padding: 4px 8px;\n border-radius: 3px;\n cursor: pointer;\n color: var(--wzl-fg);\n outline: none;\n}\n\n.option[data-focused] {\n background: color-mix(in srgb, var(--wzl-fg) 10%, transparent);\n}\n\n.option[data-selected] {\n font-weight: 500;\n}\n\n.option[data-disabled] {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n.empty {\n padding: 6px 8px;\n color: var(--wzl-fg-subtle);\n font-size: 12px;\n}\n","import type { ReactNode } from 'react';\nimport {\n ComboBox as RACComboBox,\n Label,\n Input as RACInput,\n Button as RACButton,\n Popover as RACPopover,\n ListBox as RACListBox,\n ListBoxItem as RACListBoxItem,\n Text,\n FieldError,\n type ComboBoxProps as RACComboBoxProps,\n type ListBoxItemProps as RACListBoxItemProps,\n type ValidationResult,\n} from 'react-aria-components';\nimport { fieldClasses } from '../Field/Field';\nimport s from './ComboBox.module.css';\n\nexport type ComboBoxOption = {\n value: string;\n label: ReactNode;\n textValue?: string;\n isDisabled?: boolean;\n};\n\ntype Key = string | number;\n\nexport type ComboBoxProps<T extends Key = string> = Omit<RACComboBoxProps<object>, 'children' | 'className' | 'selectedKey' | 'defaultSelectedKey' | 'onSelectionChange'> & {\n label?: ReactNode;\n description?: ReactNode;\n errorMessage?: ReactNode | ((v: ValidationResult) => ReactNode);\n placeholder?: string;\n options?: ReadonlyArray<ComboBoxOption & { value: T }>;\n children?: ReactNode;\n selectedKey?: T | null;\n defaultSelectedKey?: T;\n onSelectionChange?: (key: T | null) => void;\n emptyLabel?: ReactNode;\n className?: string;\n};\n\n/**\n * Filterable single-select wrapping React Aria's ComboBox. The user can\n * type to filter; selection commits to `onSelectionChange`. When no value\n * is in the input, selection clears (key becomes null).\n */\nexport function ComboBox<T extends Key = string>(props: ComboBoxProps<T>) {\n const {\n label,\n description,\n errorMessage,\n placeholder,\n options,\n children,\n selectedKey,\n defaultSelectedKey,\n onSelectionChange,\n emptyLabel = 'No matches',\n className,\n ...rest\n } = props;\n\n return (\n <RACComboBox\n {...rest}\n selectedKey={selectedKey ?? undefined}\n defaultSelectedKey={defaultSelectedKey}\n onSelectionChange={onSelectionChange ? (k) => onSelectionChange(k as T | null) : undefined}\n className={[s.field, fieldClasses.root, className].filter(Boolean).join(' ')}\n >\n {label !== undefined && <Label className={fieldClasses.label}>{label}</Label>}\n <div className={s.frame}>\n <RACInput placeholder={placeholder} />\n <RACButton className={s.openButton} aria-label=\"Show options\">\n <svg viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M2 4 L5 7 L8 4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n </RACButton>\n </div>\n {description !== undefined && (\n <Text slot=\"description\" className={fieldClasses.hint}>\n {description}\n </Text>\n )}\n <FieldError className={fieldClasses.error}>{errorMessage}</FieldError>\n <RACPopover className={s.popover}>\n <RACListBox className={s.listbox} renderEmptyState={() => <div className={s.empty}>{emptyLabel}</div>}>\n {options !== undefined\n ? options.map((o) => (\n <ComboBoxItem key={String(o.value)} id={o.value} textValue={o.textValue} isDisabled={o.isDisabled}>\n {o.label}\n </ComboBoxItem>\n ))\n : children}\n </RACListBox>\n </RACPopover>\n </RACComboBox>\n );\n}\n\nexport type ComboBoxItemProps = Omit<RACListBoxItemProps, 'className'> & {\n className?: string;\n};\n\nexport function ComboBoxItem({ className, ...rest }: ComboBoxItemProps) {\n return <RACListBoxItem {...rest} className={[s.option, className].filter(Boolean).join(' ')} />;\n}\n"],"mappings":";;;;;;;;;;;;;;AC8CA,SAAgB,EAAiC,GAAyB;CACxE,IAAM,EACJ,UACA,gBACA,iBACA,gBACA,YACA,aACA,gBACA,uBACA,sBACA,gBAAa,cACb,cACA,GAAG,MACD;AAEJ,QACE,kBAAC,GAAD;EACE,GAAI;EACJ,aAAa,KAAe,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