@f-ewald/components 1.45.0 → 1.46.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/custom-elements.json +361 -73
- package/dist/app-shell.d.ts.map +1 -1
- package/dist/app-shell.js +4 -0
- package/dist/app-shell.js.map +1 -1
- package/dist/calendar-day.d.ts +0 -2
- package/dist/calendar-day.d.ts.map +1 -1
- package/dist/calendar-day.js +3 -30
- package/dist/calendar-day.js.map +1 -1
- package/dist/calendar-timeline-base.d.ts +4 -0
- package/dist/calendar-timeline-base.d.ts.map +1 -1
- package/dist/calendar-timeline-base.js +31 -2
- package/dist/calendar-timeline-base.js.map +1 -1
- package/dist/calendar-week.d.ts +0 -2
- package/dist/calendar-week.d.ts.map +1 -1
- package/dist/calendar-week.js +5 -32
- package/dist/calendar-week.js.map +1 -1
- package/dist/cron-schedule.d.ts.map +1 -1
- package/dist/cron-schedule.js +4 -2
- package/dist/cron-schedule.js.map +1 -1
- package/dist/dag-graph.d.ts +25 -1
- package/dist/dag-graph.d.ts.map +1 -1
- package/dist/dag-graph.js +133 -20
- package/dist/dag-graph.js.map +1 -1
- package/dist/distribution-chart.d.ts +1 -0
- package/dist/distribution-chart.d.ts.map +1 -1
- package/dist/distribution-chart.js +23 -2
- package/dist/distribution-chart.js.map +1 -1
- package/dist/multi-select.d.ts.map +1 -1
- package/dist/multi-select.js +1 -1
- package/dist/multi-select.js.map +1 -1
- package/dist/price-history-chart.d.ts.map +1 -1
- package/dist/price-history-chart.js +12 -7
- package/dist/price-history-chart.js.map +1 -1
- package/dist/range-slider.d.ts.map +1 -1
- package/dist/range-slider.js +1 -1
- package/dist/range-slider.js.map +1 -1
- package/dist/ui-checkbox.d.ts.map +1 -1
- package/dist/ui-checkbox.js +1 -1
- package/dist/ui-checkbox.js.map +1 -1
- package/dist/utils/calendar.d.ts +14 -1
- package/dist/utils/calendar.d.ts.map +1 -1
- package/dist/utils/calendar.js +17 -2
- package/dist/utils/calendar.js.map +1 -1
- package/dist/utils/cron.d.ts.map +1 -1
- package/dist/utils/cron.js +19 -10
- package/dist/utils/cron.js.map +1 -1
- package/dist/utils/dag-layout.d.ts +23 -6
- package/dist/utils/dag-layout.d.ts.map +1 -1
- package/dist/utils/dag-layout.js +32 -10
- package/dist/utils/dag-layout.js.map +1 -1
- package/dist/utils/layer-stack.d.ts +2 -0
- package/dist/utils/layer-stack.d.ts.map +1 -1
- package/dist/utils/layer-stack.js +4 -0
- package/dist/utils/layer-stack.js.map +1 -1
- package/docs/dag-graph.md +5 -2
- package/llms.txt +5 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distribution-chart.js","sourceRoot":"","sources":["../src/distribution-chart.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAsBrC,2FAA2F;AAC3F,MAAM,KAAK,GAAG,GAAG,CAAC;AAClB,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AAEzD,8EAA8E;AAC9E,MAAM,qBAAqB,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAE3E;;;;;;;;;;;GAWG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UA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AC,KAAK,CAAC;UAC3B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC;;KAEnC,CAAC;IACJ,CAAC;CACF,CAAA;AA7La;IAAX,QAAQ,EAAE;iDAAa;AAEQ;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDAAkC;AAEjC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uDAAgD;AAE3B;IAAnD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;mDAAe;AAEjD;IAAhB,KAAK,EAAE;gDAA+C;AACtC;IAAhB,KAAK,EAAE;mDAA0B;AACjB;IAAhB,KAAK,EAAE;iDAAsC;AAE7B;IAAhB,KAAK,EAAE;iDAAoB;AAEX;IAAhB,KAAK,EAAE;kDAAuC;AA/GpC,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CA8R7B","sourcesContent":["import { LitElement, css, html, nothing, svg } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { scaleLinear } from \"d3-scale\";\nimport { line, area } from \"d3-shape\";\nimport { max } from \"d3-array\";\nimport { tokens } from \"./tokens.js\";\n\ninterface DistributionPoint {\n x: number;\n y: number;\n}\n\ninterface DistributionData {\n points: DistributionPoint[];\n unit: string;\n label: string;\n min: number;\n max: number;\n mean: number;\n}\n\nexport interface DistributionValue {\n /** Short label shown on the chart marker, e.g. 'A'. Empty string = show raw value instead. */\n label: string;\n value: number;\n}\n\n/** Fixed SVG height in CSS pixels — the coordinate system is always 1 user-unit = 1 px. */\nconst SVG_H = 130;\nconst PAD = { top: 22, right: 12, bottom: 18, left: 12 };\n\n/** Default marker colors (indigo/amber/teal/rose 600s), assigned in order. */\nconst DEFAULT_MARKER_COLORS = [\"#4f46e5\", \"#d97706\", \"#0d9488\", \"#e11d48\"];\n\n/**\n * Renders a KDE distribution curve for a named metric with one or more value\n * markers. The SVG viewBox is kept in sync with the element's pixel width via\n * ResizeObserver so that font sizes and stroke widths are always in real pixels\n * regardless of container width.\n *\n * Pass `fontSize` to control all text size (default 10). Pass a single\n * `{label:'', value}` for a single-value display or multiple\n * `{label:'A'|'B'|...}` entries to compare several values.\n *\n * @element distribution-chart\n */\n@customElement(\"distribution-chart\")\nexport class DistributionChart extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n width: 100%;\n }\n .wrap {\n padding: 0.25rem 0 0.5rem;\n }\n svg {\n display: block;\n overflow: visible;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .curve {\n fill: none;\n stroke: var(--ui-primary, #4f46e5);\n stroke-width: 1.5;\n stroke-linejoin: round;\n }\n .fill {\n fill: url(#dist-fill-grad);\n }\n .fill-start {\n stop-color: var(--ui-primary, #4f46e5);\n }\n .crosshair {\n stroke: var(--ui-text-muted, #64748b);\n }\n .chart-label {\n fill: var(--ui-text-muted, #64748b);\n }\n .skeleton {\n background: linear-gradient(\n 90deg,\n var(--ui-surface-muted, #f8fafc) 25%,\n var(--ui-border, #e2e8f0) 50%,\n var(--ui-surface-muted, #f8fafc) 75%\n );\n background-size: 200% 100%;\n animation: shimmer 1.4s infinite;\n border-radius: var(--ui-radius-sm, 0.25rem);\n height: 6.25rem;\n }\n @keyframes shimmer {\n 0% {\n background-position: 200% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n }\n .error {\n font-size: var(--ui-font-size-sm, 0.75rem);\n color: var(--ui-danger, #dc2626);\n padding: 0.5rem 0;\n }\n .legend {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem 0.75rem;\n padding: 0.25rem 0 0.25rem 0.5rem;\n }\n .legend-item {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n color: var(--ui-text-muted, #64748b);\n }\n .legend-dot {\n display: inline-block;\n width: 0.5rem;\n height: 0.5rem;\n border-radius: var(--ui-radius-circle, 50%);\n flex: 0 0 auto;\n }\n @media (prefers-reduced-motion: reduce) {\n .skeleton {\n animation: none;\n }\n }\n `,\n ];\n\n /** Metric name, fetched from `/api/distribution/<metric>` on change. */\n @property() metric = \"\";\n /** One or more values to mark on the distribution curve. */\n @property({ attribute: false }) values: DistributionValue[] = [];\n /** Colors assigned to markers in order. Defaults to indigo/amber/teal/rose 600s. */\n @property({ attribute: false }) markerColors: string[] = DEFAULT_MARKER_COLORS;\n /** Target font size in CSS pixels (default 10). Always renders at this size regardless of container width. */\n @property({ type: Number, attribute: \"font-size\" }) fontSize = 10;\n\n @state() private _data: DistributionData | null = null;\n @state() private _loading = false;\n @state() private _error: string | null = null;\n /** Measured element width in CSS pixels. 0 until ResizeObserver fires. */\n @state() private _width = 0;\n /** Inner x coordinate (px) of the current hover position, or null when not hovering. */\n @state() private _hoverX: number | null = null;\n\n private _fetchedFor = \"\";\n private _ro: ResizeObserver | null = null;\n\n override connectedCallback() {\n super.connectedCallback();\n this._maybeFetch();\n }\n\n override firstUpdated() {\n this._ro = new ResizeObserver((entries) => {\n const w = Math.floor(entries[0].contentRect.width);\n if (w > 0 && w !== this._width) this._width = w;\n });\n this._ro.observe(this);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this._ro?.disconnect();\n this._ro = null;\n }\n\n override updated(changed: Map<string, unknown>) {\n if (changed.has(\"metric\")) this._maybeFetch();\n }\n\n private _maybeFetch() {\n if (!this.metric || this._fetchedFor === this.metric) return;\n this._fetchedFor = this.metric;\n this._loading = true;\n this._error = null;\n fetch(`/api/distribution/${encodeURIComponent(this.metric)}`)\n .then((r) => {\n if (!r.ok) throw new Error(`HTTP ${r.status}`);\n return r.json() as Promise<DistributionData>;\n })\n .then((data) => {\n this._data = data;\n this._loading = false;\n })\n .catch((err: unknown) => {\n this._error = err instanceof Error ? err.message : \"Failed to load\";\n this._loading = false;\n });\n }\n\n private _renderSvg(data: DistributionData) {\n if (this._width === 0) return nothing;\n\n const innerW = this._width - PAD.left - PAD.right;\n const innerH = SVG_H - PAD.top - PAD.bottom;\n const fs = this.fontSize;\n\n const pts = data.points;\n const maxY = max(pts, (p) => p.y) ?? 1;\n\n const xScale = scaleLinear().domain([pts[0].x, pts[pts.length - 1].x]).range([0, innerW]);\n const yScale = scaleLinear().domain([0, maxY]).range([innerH, 0]);\n\n const lineFn = line<DistributionPoint>()\n .x((p) => xScale(p.x))\n .y((p) => yScale(p.y));\n\n const areaFn = area<DistributionPoint>()\n .x((p) => xScale(p.x))\n .y0(innerH)\n .y1((p) => yScale(p.y));\n\n const curvePath = lineFn(pts) ?? \"\";\n const fillPath = areaFn(pts) ?? \"\";\n\n const minLabel = data.min.toLocaleString(\"en-US\", { maximumFractionDigits: 0 });\n const maxLabel = data.max.toLocaleString(\"en-US\", { maximumFractionDigits: 0 });\n\n const hasLabels = this.values.some((v) => v.label !== \"\");\n\n const markers = this.values\n .filter((v) => v.value >= pts[0].x && v.value <= pts[pts.length - 1].x)\n .map((v, i) => {\n const color = this.markerColors[i % this.markerColors.length];\n const mx = xScale(v.value);\n const labelText = hasLabels\n ? v.label\n : `${v.value.toLocaleString(\"en-US\", { maximumFractionDigits: 0 })} ${data.unit}`;\n return svg`\n <line stroke=${color} stroke-width=\"1.5\" stroke-dasharray=\"4 3\"\n x1=${mx} y1=${0} x2=${mx} y2=${innerH} />\n <text font-size=${fs} font-weight=\"600\" fill=${color} text-anchor=\"middle\"\n x=${mx} y=${-fs * 0.4}>${labelText}</text>\n `;\n });\n\n const crosshair = this._hoverX != null ? (() => {\n const hx = Math.max(0, Math.min(innerW, this._hoverX!));\n const hVal = xScale.invert(hx);\n const hLabel = `${Math.round(hVal).toLocaleString(\"en-US\")} ${data.unit}`;\n // Keep label anchor away from edges so it doesn't clip\n const anchor = hx < innerW * 0.2 ? \"start\" : hx > innerW * 0.8 ? \"end\" : \"middle\";\n const lx = hx < innerW * 0.2 ? 0 : hx > innerW * 0.8 ? innerW : hx;\n return svg`\n <line class=\"crosshair\" stroke-width=\"1\" x1=${hx} y1=${0} x2=${hx} y2=${innerH} />\n <text class=\"chart-label\" font-size=${fs} font-weight=\"500\"\n text-anchor=${anchor} x=${lx} y=${-fs * 0.4}>${hLabel}</text>\n `;\n })() : nothing;\n\n const markerSummary = this.values.length > 0\n ? ` Markers: ${this.values\n .map((value) => `${value.label || \"value\"} ${value.value.toLocaleString(\"en-US\")} ${data.unit}`)\n .join(\", \")}.`\n : \"\";\n const summary =\n `${data.label}: ${data.min.toLocaleString(\"en-US\")} to ${data.max.toLocaleString(\"en-US\")} ${data.unit}, ` +\n `mean ${data.mean.toLocaleString(\"en-US\")} ${data.unit}.${markerSummary}`;\n\n return svg`\n <svg viewBox=\"0 0 ${this._width} ${SVG_H}\" width=${this._width} height=${SVG_H}\n role=\"img\" aria-label=${summary}\n style=\"cursor:crosshair\"\n @mousemove=${(e: MouseEvent) => {\n const innerX = e.offsetX - PAD.left;\n this._hoverX = (innerX >= 0 && innerX <= innerW) ? innerX : null;\n }}\n @mouseleave=${() => { this._hoverX = null; }}>\n <defs>\n <linearGradient id=\"dist-fill-grad\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop class=\"fill-start\" offset=\"0%\" stop-opacity=\"0.28\"/>\n <stop class=\"fill-start\" offset=\"100%\" stop-opacity=\"0\"/>\n </linearGradient>\n </defs>\n <g transform=\"translate(${PAD.left},${PAD.top})\">\n <path class=\"fill\" d=${fillPath} />\n <path class=\"curve\" d=${curvePath} />\n ${markers}\n ${crosshair}\n <text class=\"chart-label\" font-size=${fs} text-anchor=\"start\" x=${0} y=${innerH + fs * 1.4}>${minLabel}</text>\n <text class=\"chart-label\" font-size=${fs} text-anchor=\"end\" x=${innerW} y=${innerH + fs * 1.4}>${maxLabel}</text>\n <text class=\"chart-label\" font-size=${fs} text-anchor=\"middle\" x=${innerW / 2} y=${innerH + fs * 1.4}>${data.unit}</text>\n </g>\n </svg>\n `;\n }\n\n private _renderLegend(data: DistributionData) {\n const hasLabels = this.values.some((v) => v.label !== \"\");\n if (!hasLabels) return nothing;\n return html`\n <div class=\"legend\">\n ${this.values.map((v, i) => {\n const color = this.markerColors[i % this.markerColors.length];\n const formatted = v.value.toLocaleString(\"en-US\", { maximumFractionDigits: 0 });\n return html`\n <span class=\"legend-item\">\n <span class=\"legend-dot\" style=\"background:${color}\"></span>\n ${v.label}: ${formatted} ${data.unit}\n </span>\n `;\n })}\n </div>\n `;\n }\n\n override render() {\n if (this._loading || this._width === 0) return html`<div class=\"wrap\"><div class=\"skeleton\"></div></div>`;\n if (this._error) return html`<div class=\"wrap\"><div class=\"error\">Could not load distribution</div></div>`;\n if (!this._data) return nothing;\n return html`\n <div class=\"wrap\">\n ${this._renderSvg(this._data)}\n ${this._renderLegend(this._data)}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"distribution-chart\": DistributionChart;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"distribution-chart.js","sourceRoot":"","sources":["../src/distribution-chart.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAsBrC,2FAA2F;AAC3F,MAAM,KAAK,GAAG,GAAG,CAAC;AAClB,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,KA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AAS,EAAE,WAAW,EAAE,CAAC;mDAAe;AAEjD;IAAhB,KAAK,EAAE;gDAA+C;AACtC;IAAhB,KAAK,EAAE;mDAA0B;AACjB;IAAhB,KAAK,EAAE;iDAAsC;AAE7B;IAAhB,KAAK,EAAE;iDAAoB;AAEX;IAAhB,KAAK,EAAE;kDAAuC;AApHpC,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CA+S7B","sourcesContent":["import { LitElement, css, html, nothing, svg } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { scaleLinear } from \"d3-scale\";\nimport { line, area } from \"d3-shape\";\nimport { max } from \"d3-array\";\nimport { tokens } from \"./tokens.js\";\n\ninterface DistributionPoint {\n x: number;\n y: number;\n}\n\ninterface DistributionData {\n points: DistributionPoint[];\n unit: string;\n label: string;\n min: number;\n max: number;\n mean: number;\n}\n\nexport interface DistributionValue {\n /** Short label shown on the chart marker, e.g. 'A'. Empty string = show raw value instead. */\n label: string;\n value: number;\n}\n\n/** Fixed SVG height in CSS pixels — the coordinate system is always 1 user-unit = 1 px. */\nconst SVG_H = 130;\nconst PAD = { top: 22, right: 12, bottom: 18, left: 12 };\n\n/** Default marker colors (indigo/amber/teal/rose 600s), assigned in order. */\nconst DEFAULT_MARKER_COLORS = [\"#4f46e5\", \"#d97706\", \"#0d9488\", \"#e11d48\"];\n\n/**\n * Renders a KDE distribution curve for a named metric with one or more value\n * markers. The SVG viewBox is kept in sync with the element's pixel width via\n * ResizeObserver so that font sizes and stroke widths are always in real pixels\n * regardless of container width.\n *\n * Pass `fontSize` to control all text size (default 10). Pass a single\n * `{label:'', value}` for a single-value display or multiple\n * `{label:'A'|'B'|...}` entries to compare several values.\n *\n * @element distribution-chart\n */\n@customElement(\"distribution-chart\")\nexport class DistributionChart extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n width: 100%;\n }\n .wrap {\n padding: 0.25rem 0 0.5rem;\n }\n svg {\n display: block;\n overflow: visible;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .curve {\n fill: none;\n stroke: var(--ui-primary, #4f46e5);\n stroke-width: 1.5;\n stroke-linejoin: round;\n }\n .fill {\n fill: url(#dist-fill-grad);\n }\n .fill-start {\n stop-color: var(--ui-primary, #4f46e5);\n }\n .crosshair {\n stroke: var(--ui-text-muted, #64748b);\n }\n .chart-label {\n fill: var(--ui-text-muted, #64748b);\n }\n .skeleton {\n background: linear-gradient(\n 90deg,\n var(--ui-surface-muted, #f8fafc) 25%,\n var(--ui-border, #e2e8f0) 50%,\n var(--ui-surface-muted, #f8fafc) 75%\n );\n background-size: 200% 100%;\n animation: shimmer 1.4s infinite;\n border-radius: var(--ui-radius-sm, 0.25rem);\n height: 6.25rem;\n }\n @keyframes shimmer {\n 0% {\n background-position: 200% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n }\n .error {\n font-size: var(--ui-font-size-sm, 0.75rem);\n color: var(--ui-danger, #dc2626);\n padding: 0.5rem 0;\n }\n .empty {\n font-size: var(--ui-font-size-sm, 0.75rem);\n color: var(--ui-text-muted, #64748b);\n padding: 0.5rem 0;\n }\n .legend {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem 0.75rem;\n padding: 0.25rem 0 0.25rem 0.5rem;\n }\n .legend-item {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n color: var(--ui-text-muted, #64748b);\n }\n .legend-dot {\n display: inline-block;\n width: 0.5rem;\n height: 0.5rem;\n border-radius: var(--ui-radius-circle, 50%);\n flex: 0 0 auto;\n }\n @media (prefers-reduced-motion: reduce) {\n .skeleton {\n animation: none;\n }\n }\n `,\n ];\n\n /** Metric name, fetched from `/api/distribution/<metric>` on change. */\n @property() metric = \"\";\n /** One or more values to mark on the distribution curve. */\n @property({ attribute: false }) values: DistributionValue[] = [];\n /** Colors assigned to markers in order. Defaults to indigo/amber/teal/rose 600s. */\n @property({ attribute: false }) markerColors: string[] = DEFAULT_MARKER_COLORS;\n /** Target font size in CSS pixels (default 10). Always renders at this size regardless of container width. */\n @property({ type: Number, attribute: \"font-size\" }) fontSize = 10;\n\n @state() private _data: DistributionData | null = null;\n @state() private _loading = false;\n @state() private _error: string | null = null;\n /** Measured element width in CSS pixels. 0 until ResizeObserver fires. */\n @state() private _width = 0;\n /** Inner x coordinate (px) of the current hover position, or null when not hovering. */\n @state() private _hoverX: number | null = null;\n\n private _fetchedFor = \"\";\n private _abort: AbortController | null = null;\n private _ro: ResizeObserver | null = null;\n\n override connectedCallback() {\n super.connectedCallback();\n this._maybeFetch();\n }\n\n override firstUpdated() {\n this._ro = new ResizeObserver((entries) => {\n const w = Math.floor(entries[0].contentRect.width);\n if (w > 0 && w !== this._width) this._width = w;\n });\n this._ro.observe(this);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this._ro?.disconnect();\n this._ro = null;\n this._abort?.abort();\n this._abort = null;\n this._fetchedFor = \"\";\n }\n\n override updated(changed: Map<string, unknown>) {\n if (changed.has(\"metric\")) this._maybeFetch();\n }\n\n private _maybeFetch() {\n if (this._fetchedFor === this.metric) return;\n this._abort?.abort();\n this._abort = null;\n this._fetchedFor = this.metric;\n if (!this.metric) return;\n const controller = new AbortController();\n this._abort = controller;\n this._loading = true;\n this._error = null;\n fetch(`/api/distribution/${encodeURIComponent(this.metric)}`, { signal: controller.signal })\n .then((r) => {\n if (!r.ok) throw new Error(`HTTP ${r.status}`);\n return r.json() as Promise<DistributionData>;\n })\n .then((data) => {\n if (controller.signal.aborted) return;\n this._data = data;\n this._loading = false;\n })\n .catch((err: unknown) => {\n if (controller.signal.aborted) return;\n this._error = err instanceof Error ? err.message : \"Failed to load\";\n this._loading = false;\n });\n }\n\n private _renderSvg(data: DistributionData) {\n if (this._width === 0) return nothing;\n\n const innerW = this._width - PAD.left - PAD.right;\n const innerH = SVG_H - PAD.top - PAD.bottom;\n const fs = this.fontSize;\n\n const pts = data.points;\n const maxY = max(pts, (p) => p.y) ?? 1;\n\n const xScale = scaleLinear().domain([pts[0].x, pts[pts.length - 1].x]).range([0, innerW]);\n const yScale = scaleLinear().domain([0, maxY]).range([innerH, 0]);\n\n const lineFn = line<DistributionPoint>()\n .x((p) => xScale(p.x))\n .y((p) => yScale(p.y));\n\n const areaFn = area<DistributionPoint>()\n .x((p) => xScale(p.x))\n .y0(innerH)\n .y1((p) => yScale(p.y));\n\n const curvePath = lineFn(pts) ?? \"\";\n const fillPath = areaFn(pts) ?? \"\";\n\n const minLabel = data.min.toLocaleString(\"en-US\", { maximumFractionDigits: 0 });\n const maxLabel = data.max.toLocaleString(\"en-US\", { maximumFractionDigits: 0 });\n\n const hasLabels = this.values.some((v) => v.label !== \"\");\n\n const markers = this.values\n .filter((v) => v.value >= pts[0].x && v.value <= pts[pts.length - 1].x)\n .map((v, i) => {\n const color = this.markerColors[i % this.markerColors.length];\n const mx = xScale(v.value);\n const labelText = hasLabels\n ? v.label\n : `${v.value.toLocaleString(\"en-US\", { maximumFractionDigits: 0 })} ${data.unit}`;\n return svg`\n <line stroke=${color} stroke-width=\"1.5\" stroke-dasharray=\"4 3\"\n x1=${mx} y1=${0} x2=${mx} y2=${innerH} />\n <text font-size=${fs} font-weight=\"600\" fill=${color} text-anchor=\"middle\"\n x=${mx} y=${-fs * 0.4}>${labelText}</text>\n `;\n });\n\n const crosshair = this._hoverX != null ? (() => {\n const hx = Math.max(0, Math.min(innerW, this._hoverX!));\n const hVal = xScale.invert(hx);\n const hLabel = `${Math.round(hVal).toLocaleString(\"en-US\")} ${data.unit}`;\n // Keep label anchor away from edges so it doesn't clip\n const anchor = hx < innerW * 0.2 ? \"start\" : hx > innerW * 0.8 ? \"end\" : \"middle\";\n const lx = hx < innerW * 0.2 ? 0 : hx > innerW * 0.8 ? innerW : hx;\n return svg`\n <line class=\"crosshair\" stroke-width=\"1\" x1=${hx} y1=${0} x2=${hx} y2=${innerH} />\n <text class=\"chart-label\" font-size=${fs} font-weight=\"500\"\n text-anchor=${anchor} x=${lx} y=${-fs * 0.4}>${hLabel}</text>\n `;\n })() : nothing;\n\n const markerSummary = this.values.length > 0\n ? ` Markers: ${this.values\n .map((value) => `${value.label || \"value\"} ${value.value.toLocaleString(\"en-US\")} ${data.unit}`)\n .join(\", \")}.`\n : \"\";\n const summary =\n `${data.label}: ${data.min.toLocaleString(\"en-US\")} to ${data.max.toLocaleString(\"en-US\")} ${data.unit}, ` +\n `mean ${data.mean.toLocaleString(\"en-US\")} ${data.unit}.${markerSummary}`;\n\n return svg`\n <svg viewBox=\"0 0 ${this._width} ${SVG_H}\" width=${this._width} height=${SVG_H}\n role=\"img\" aria-label=${summary}\n style=\"cursor:crosshair\"\n @mousemove=${(e: MouseEvent) => {\n const innerX = e.offsetX - PAD.left;\n this._hoverX = (innerX >= 0 && innerX <= innerW) ? innerX : null;\n }}\n @mouseleave=${() => { this._hoverX = null; }}>\n <defs>\n <linearGradient id=\"dist-fill-grad\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop class=\"fill-start\" offset=\"0%\" stop-opacity=\"0.28\"/>\n <stop class=\"fill-start\" offset=\"100%\" stop-opacity=\"0\"/>\n </linearGradient>\n </defs>\n <g transform=\"translate(${PAD.left},${PAD.top})\">\n <path class=\"fill\" d=${fillPath} />\n <path class=\"curve\" d=${curvePath} />\n ${markers}\n ${crosshair}\n <text class=\"chart-label\" font-size=${fs} text-anchor=\"start\" x=${0} y=${innerH + fs * 1.4}>${minLabel}</text>\n <text class=\"chart-label\" font-size=${fs} text-anchor=\"end\" x=${innerW} y=${innerH + fs * 1.4}>${maxLabel}</text>\n <text class=\"chart-label\" font-size=${fs} text-anchor=\"middle\" x=${innerW / 2} y=${innerH + fs * 1.4}>${data.unit}</text>\n </g>\n </svg>\n `;\n }\n\n private _renderLegend(data: DistributionData) {\n const hasLabels = this.values.some((v) => v.label !== \"\");\n if (!hasLabels) return nothing;\n return html`\n <div class=\"legend\">\n ${this.values.map((v, i) => {\n const color = this.markerColors[i % this.markerColors.length];\n const formatted = v.value.toLocaleString(\"en-US\", { maximumFractionDigits: 0 });\n return html`\n <span class=\"legend-item\">\n <span class=\"legend-dot\" style=\"background:${color}\"></span>\n ${v.label}: ${formatted} ${data.unit}\n </span>\n `;\n })}\n </div>\n `;\n }\n\n override render() {\n if (this._loading || this._width === 0) return html`<div class=\"wrap\"><div class=\"skeleton\"></div></div>`;\n if (this._error) return html`<div class=\"wrap\"><div class=\"error\">Could not load distribution</div></div>`;\n if (!this._data) return nothing;\n if (this._data.points.length < 2) return html`<div class=\"wrap\"><div class=\"empty\">No distribution data</div></div>`;\n return html`\n <div class=\"wrap\">\n ${this._renderSvg(this._data)}\n ${this._renderLegend(this._data)}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"distribution-chart\": DistributionChart;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-select.d.ts","sourceRoot":"","sources":["../src/multi-select.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIV,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAOb;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,MAAM,CAAC;AAErD,kCAAkC;AAClC,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,qBACa,WAAY,SAAQ,UA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C,UAAU,UAAS;IAC/D,0EAA0E;IAC9C,GAAG,SAAK;IACpC;;;;OAIG;IAC0B,OAAO,EAAE,kBAAkB,CAAc;IACtE;;;;OAIG;IACoD,WAAW,SAAK;IACvE;;;;;OAKG;IACmD,SAAS,UAAS;IAE/D,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,aAAa,CAAS;IA2B9B,oBAAoB,IAAI,IAAI,CAapC;IAED,UAAmB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAmB3D;IAED,UAAmB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CA2BxD;IAED,8EAA8E;IAC9E,iBAAiB,IAAI,IAAI,CAGxB;IAED,4EAA4E;IAC5E,oBAAoB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAG5C;IAED,+EAA+E;IAC/E,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,IAAI,CAUrE;IAsaD,0EAA0E;IAC1E,OAAO,CAAC,iBAAiB;IAgCzB,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,WAAW;IAyBnB,OAAO,CAAC,mBAAmB;IAsC3B,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,gBAAgB;IA4BxB,OAAO,CAAC,oBAAoB;IA2B5B,OAAO,CAAC,iBAAiB;IAWhB,MAAM,sBAUd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
|
package/dist/multi-select.js
CHANGED
|
@@ -1265,7 +1265,7 @@ __decorate([
|
|
|
1265
1265
|
property()
|
|
1266
1266
|
], MultiSelect.prototype, "placeholder", void 0);
|
|
1267
1267
|
__decorate([
|
|
1268
|
-
property({ type: Boolean })
|
|
1268
|
+
property({ type: Boolean, reflect: true })
|
|
1269
1269
|
], MultiSelect.prototype, "disabled", void 0);
|
|
1270
1270
|
__decorate([
|
|
1271
1271
|
property({ type: Boolean })
|
package/dist/multi-select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-select.js","sourceRoot":"","sources":["../src/multi-select.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,UAAU,EACV,GAAG,EACH,IAAI,EACJ,OAAO,GAGR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,IAAI,aAAa,GAAG,CAAC,CAAC;AAsBtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QAkZL,2CAA2C;QACX,YAAO,GAAwB,EAAE,CAAC;QAClE;;;WAGG;QAC6B,WAAM,GAAa,EAAE,CAAC;QACtD,+DAA+D;QACnD,SAAI,GAAG,EAAE,CAAC;QACtB,+CAA+C;QACnC,UAAK,GAAG,EAAE,CAAC;QACvB,0DAA0D;QAC9C,gBAAW,GAAG,gBAAgB,CAAC;QAC3C,uEAAuE;QAC1C,aAAQ,GAAG,KAAK,CAAC;QAC9C,gEAAgE;QACnC,aAAQ,GAAG,KAAK,CAAC;QAC9C;;;WAGG;QACyC,eAAU,GAAG,KAAK,CAAC;QAC/D,0EAA0E;QAC9C,QAAG,GAAG,CAAC,CAAC;QACpC;;;;WAIG;QAC0B,YAAO,GAAuB,UAAU,CAAC;QACtE;;;;WAIG;QACoD,gBAAW,GAAG,CAAC,CAAC;QACvE;;;;;WAKG;QACmD,cAAS,GAAG,KAAK,CAAC;QAEv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B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAkB;AAKF;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAoB;AAEnC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAS;AAMP;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAA0C;AAMf;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;gDAAiB;AAOjB;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;8CAAmB;AAEvD;IAAhB,KAAK,EAAE;0CAAuB;AACd;IAAhB,KAAK,EAAE;iDAA2B;AAClB;IAAhB,KAAK,EAAE;2CAAsC;AAC7B;IAAhB,KAAK,EAAE;kDAA+B;AAjc5B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAkrCvB","sourcesContent":["import {\n LitElement,\n css,\n html,\n nothing,\n type PropertyValues,\n type TemplateResult,\n} from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { iconCheckCircle, iconChevronRight, iconX } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nlet instanceCount = 0;\n\n/**\n * Presentation variant of {@link MultiSelect}.\n *\n * - `\"dropdown\"` (default): a compact trigger that opens a listbox popover.\n * - `\"list\"`: a persistently visible, bordered list surface with no popover.\n */\nexport type MultiSelectVariant = \"dropdown\" | \"list\";\n\n/** A single selectable option. */\nexport interface MultiSelectOption {\n value: string;\n label: string;\n /** Optional pre-rendered icon template displayed before the label. */\n icon?: TemplateResult;\n /** Square icon size in pixels. Defaults to 16 when `icon` is set. */\n iconSize?: number;\n /** When true, the option can neither be selected nor removed via the UI. */\n disabled?: boolean;\n}\n\n/**\n * A form-associated multi-select: a trigger showing a compact summary of the\n * current selection, opening a multi-selectable listbox popover, with an\n * optional removable-chip list of the chosen values. A drop-in generic\n * replacement for a native `<select multiple>` — set `name` on the element\n * itself and each\n * selected value is submitted as a repeated `name=value` entry, matching native\n * multiple-select semantics; `new FormData(form).getAll(name)` and\n * `form.reset()` work unchanged.\n *\n * The trigger visually follows `form-select`: a `2rem` field showing the\n * `placeholder` when empty, the single selected label when one value is chosen,\n * and `N selected` when several are. Set `show-chips` to additionally render\n * the selected values as compact chips below the trigger, each with an\n * accessible `32px` remove control; chips are off by default and the region\n * reserves no space while nothing is selected. Like `form-select`, the host is\n * `display: block` and fills its container by default; constrain the host\n * (`multi-select { display: inline-block; }`) to shrink it to its content\n * instead.\n *\n * Set `searchable` to replace the button trigger with an editable combobox that\n * infix-filters the predefined options by case-insensitive label. Typed text is\n * only a query: `values` changes exclusively when options are toggled, and an\n * uncommitted query is discarded when the list closes.\n *\n * The `variant` chooses between two presentations, and `searchable` applies to\n * both:\n *\n * - `\"dropdown\"` (default) is the popover form described above: a compact\n * trigger (button, or search combobox when `searchable`) that opens a\n * multi-selectable listbox on demand, closes on outside click / Escape, and\n * shows a chevron.\n * - `\"list\"` renders the options as a persistently visible, bordered surface\n * with no popover, no chevron, and no `open` host state; it never registers\n * outside-click listeners. Its scroll viewport is sized to roughly\n * `visibleRows` `2rem` rows (see `visible-rows`). When not `searchable` the\n * `listbox` itself is focusable and drives Arrow/Home/End/Enter/Space keyboard\n * navigation via `aria-activedescendant`; when `searchable` a `2rem` search\n * field sits above the list and owns navigation, and Escape only clears the\n * query instead of hiding the list.\n *\n * @element multi-select\n * @fires change - Fired with `{ values: string[] }` (a copied array) when a\n * value is added or removed through the UI. Programmatic `values` assignments\n * do not fire it.\n */\n@customElement(\"multi-select\")\nexport class MultiSelect extends LitElement {\n static formAssociated = true;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n position: relative;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n }\n .control {\n position: relative;\n }\n button.trigger {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.25rem;\n width: 100%;\n height: 2rem;\n box-sizing: border-box;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n }\n button.trigger:hover:not(:disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n button.trigger:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n button.trigger:focus-visible {\n outline: none;\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .trigger-label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .trigger-label.placeholder {\n color: var(--ui-text-muted, #64748b);\n }\n .search-trigger {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.25rem;\n width: 100%;\n height: 2rem;\n box-sizing: border-box;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n cursor: text;\n }\n .search-trigger:hover:not(.disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .search-trigger:not(.disabled):focus-within {\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .search-trigger.disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n input.search-input {\n min-width: 0;\n flex: 1;\n box-sizing: border-box;\n padding: 0.5rem 0 0.5rem 0.75rem;\n color: inherit;\n background: transparent;\n border: 0;\n outline: 0;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n }\n input.search-input::placeholder {\n color: var(--ui-text-muted, #64748b);\n font-weight: var(--ui-font-weight-medium, 500);\n opacity: 1;\n }\n .chevron {\n display: flex;\n flex: 0 0 auto;\n margin-right: 0.75rem;\n color: var(--ui-text-muted, #64748b);\n pointer-events: none;\n transform: rotate(90deg);\n transition: transform 150ms ease;\n }\n button.trigger .chevron {\n margin-right: 0;\n }\n :host([open]) .chevron {\n transform: rotate(-90deg);\n }\n ul.options {\n position: absolute;\n top: 100%;\n left: 0;\n z-index: 10;\n min-width: 100%;\n max-height: 40vh;\n overflow-y: auto;\n scrollbar-gutter: stable;\n margin: 0.25rem 0 0;\n padding: 0.25rem 0;\n list-style: none;\n white-space: nowrap;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n }\n ul.options::-webkit-scrollbar {\n width: 0.75rem;\n }\n ul.options::-webkit-scrollbar-thumb {\n background: var(--ui-border, #e2e8f0);\n border: 0.25rem solid transparent;\n border-radius: var(--ui-radius-pill, 9999px);\n background-clip: padding-box;\n }\n .list-control {\n display: flex;\n flex-direction: column;\n }\n .search-field {\n display: flex;\n align-items: center;\n width: 100%;\n height: 2rem;\n box-sizing: border-box;\n margin-bottom: 0.25rem;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n cursor: text;\n }\n .search-field:not(.disabled):focus-within {\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .search-field.disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n input.list-search {\n padding-right: 0.75rem;\n }\n ul.options.persistent {\n position: static;\n z-index: auto;\n min-width: 0;\n max-height: none;\n margin: 0;\n box-sizing: border-box;\n border-radius: var(--ui-radius, 0.5rem);\n box-shadow: none;\n }\n ul.options.persistent.disabled {\n cursor: not-allowed;\n opacity: 0.6;\n pointer-events: none;\n }\n ul.options.persistent:focus-visible {\n outline: none;\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n li {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n }\n li.active,\n li:hover:not([aria-disabled=\"true\"]) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n li[aria-selected=\"true\"] {\n font-weight: var(--ui-font-weight-semibold, 600);\n color: var(--ui-primary, #4f46e5);\n }\n li[aria-disabled=\"true\"] {\n cursor: not-allowed;\n color: var(--ui-text-muted, #64748b);\n opacity: 0.6;\n }\n .check {\n display: inline-flex;\n flex: 0 0 auto;\n width: 14px;\n height: 14px;\n align-items: center;\n justify-content: center;\n color: var(--ui-primary, #4f46e5);\n }\n .check.hidden {\n visibility: hidden;\n }\n .check > svg {\n width: 100%;\n height: 100%;\n }\n .option-content {\n display: inline-flex;\n min-width: 0;\n flex: 1;\n align-items: center;\n gap: 0.5rem;\n }\n .option-icon {\n display: inline-flex;\n width: var(--multi-select-icon-size);\n height: var(--multi-select-icon-size);\n flex: 0 0 var(--multi-select-icon-size);\n align-items: center;\n justify-content: center;\n }\n .option-icon > svg {\n width: 100%;\n height: 100%;\n }\n .option-label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n li.no-options {\n display: block;\n padding: 0.5rem 0.75rem;\n color: var(--ui-text-muted, #64748b);\n cursor: default;\n font-style: italic;\n }\n .chips {\n display: flex;\n flex-wrap: wrap;\n gap: 0.25rem;\n margin-top: 0.25rem;\n /* Pin the chips row to the control's resolved width (0 width +\n min-width 100%) so a long selected label ellipsizes instead of\n contributing its content width and widening the control. */\n width: 0;\n min-width: 100%;\n box-sizing: border-box;\n }\n .chip {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n max-width: 100%;\n box-sizing: border-box;\n padding-left: 0.5rem;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface-muted, #f8fafc);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n }\n .chip-label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n }\n .chip-remove {\n display: inline-flex;\n flex: 0 0 auto;\n width: 2rem;\n height: 2rem;\n align-items: center;\n justify-content: center;\n padding: 0;\n color: var(--ui-text-muted, #64748b);\n background: transparent;\n border: 0;\n border-radius: var(--ui-radius-sm, 0.25rem);\n cursor: pointer;\n }\n .chip-remove:hover:not(:disabled) {\n color: var(--ui-danger, #dc2626);\n }\n .chip-remove:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .chip-remove:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .chip-remove > svg {\n width: 18px;\n height: 18px;\n }\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n @media (prefers-reduced-motion: reduce) {\n .chevron {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n button.trigger:focus-visible,\n .search-trigger:not(.disabled):focus-within,\n .search-field:not(.disabled):focus-within,\n ul.options.persistent:focus-visible,\n .chip-remove:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n button.trigger:disabled,\n .search-trigger.disabled,\n .search-field.disabled,\n ul.options.persistent.disabled,\n .chip-remove:disabled,\n li[aria-disabled=\"true\"] {\n color: GrayText;\n opacity: 1;\n }\n li.active,\n li:hover:not([aria-disabled=\"true\"]) {\n color: HighlightText;\n background: Highlight;\n }\n li[aria-selected=\"true\"] {\n color: Highlight;\n }\n li.active[aria-selected=\"true\"],\n li[aria-selected=\"true\"]:hover {\n color: HighlightText;\n }\n .chip {\n border-color: CanvasText;\n }\n }\n `,\n ];\n\n /** The full list of selectable options. */\n @property({ attribute: false }) options: MultiSelectOption[] = [];\n /**\n * The currently selected values. Programmatic assignments are deduplicated\n * while preserving order and never fire `change`.\n */\n @property({ attribute: false }) values: string[] = [];\n /** Form control name; each selected value submits under it. */\n @property() name = \"\";\n /** Accessible label applied to the trigger. */\n @property() label = \"\";\n /** Text shown on the trigger when nothing is selected. */\n @property() placeholder = \"Select options\";\n /** Disables the whole control, preventing the popover from opening. */\n @property({ type: Boolean }) disabled = false;\n /** Marks the control as required for native form validation. */\n @property({ type: Boolean }) required = false;\n /**\n * Enables editable, case-insensitive infix filtering by option label.\n * Typed text never becomes a selected value.\n */\n @property({ type: Boolean, reflect: true }) searchable = false;\n /** Maximum number of selectable values; `0` (default) means unlimited. */\n @property({ type: Number }) max = 0;\n /**\n * Presentation variant. `\"dropdown\"` (default) opens a popover listbox;\n * `\"list\"` renders a persistently visible, bordered list surface. Reflected\n * so consumers can style by `[variant=\"list\"]`.\n */\n @property({ reflect: true }) variant: MultiSelectVariant = \"dropdown\";\n /**\n * Number of `2rem` rows the `list` variant's scroll viewport shows before it\n * scrolls, mirroring a native `<select size>`. Normalized to an integer of at\n * least `1` (default `5`); ignored by the `dropdown` variant.\n */\n @property({ type: Number, attribute: \"visible-rows\" }) visibleRows = 5;\n /**\n * When true, the selected values are also rendered as removable chips below\n * the trigger, each with an accessible `32px` remove control. Off by default:\n * the trigger already summarizes the selection, and values can be toggled off\n * in the listbox. Applies to both variants.\n */\n @property({ type: Boolean, attribute: \"show-chips\" }) showChips = false;\n\n @state() private _open = false;\n @state() private _activeIndex = -1;\n @state() private _query: string | null = null;\n @state() private _formDisabled = false;\n\n #internals = this.attachInternals();\n #defaultValues: string[] | null = null;\n #listboxPointerDown = false;\n #suppressNextBlur = false;\n #restoringSearchFocus = false;\n #searchSelection: [number | null, number | null] | null = null;\n #isComposing = false;\n #compositionJustEnded = false;\n #compositionEndTimer: ReturnType<typeof setTimeout> | null = null;\n #blurTimer: ReturnType<typeof setTimeout> | null = null;\n readonly #listboxId = `multi-select-listbox-${++instanceCount}`;\n\n /** Whether the host or an ancestor fieldset currently disables the control. */\n get #isDisabled(): boolean {\n return this.disabled || this._formDisabled;\n }\n\n /** `visibleRows` normalized to a whole number of rows, at least `1`. */\n get #rows(): number {\n const raw = this.visibleRows;\n if (!Number.isFinite(raw)) return 5;\n const floored = Math.floor(raw);\n return floored < 1 ? 1 : floored;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n if (this.#blurTimer) clearTimeout(this.#blurTimer);\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#blurTimer = null;\n this.#compositionEndTimer = null;\n this.#listboxPointerDown = false;\n this.#suppressNextBlur = false;\n this.#searchSelection = null;\n this.#isComposing = false;\n this.#compositionJustEnded = false;\n this.#close();\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.hasUpdated && this.#defaultValues === null) {\n this.#defaultValues = this.#dedupe(this.values);\n }\n if (changed.has(\"values\")) {\n const deduped = this.#dedupe(this.values);\n if (\n deduped.length !== this.values.length ||\n deduped.some((value, index) => value !== this.values[index])\n ) {\n this.values = deduped;\n }\n }\n if (\n (changed.has(\"disabled\") || changed.has(\"searchable\") || changed.has(\"variant\")) &&\n (this.#isDisabled || changed.has(\"searchable\") || changed.has(\"variant\"))\n ) {\n this.#close();\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(\"_open\")) {\n this.toggleAttribute(\"open\", this._open);\n if (this._open) {\n window.addEventListener(\"mousedown\", this.#onWindowMousedown, true);\n } else {\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n }\n }\n if (changed.has(\"values\") || changed.has(\"name\")) this.#syncFormValue();\n if (\n changed.has(\"values\") ||\n changed.has(\"required\") ||\n changed.has(\"disabled\") ||\n changed.has(\"_formDisabled\")\n ) {\n this.#syncValidity();\n }\n if (\n (changed.has(\"_activeIndex\") || changed.has(\"_query\") || changed.has(\"options\")) &&\n (this._open || this.variant === \"list\") &&\n this._activeIndex >= 0\n ) {\n this.renderRoot\n .querySelector<HTMLElement>(`#${this.#listboxId}-option-${this._activeIndex}`)\n ?.scrollIntoView({ block: \"nearest\", inline: \"nearest\" });\n }\n }\n\n /** Restores the selection captured at first render, per the form contract. */\n formResetCallback(): void {\n this.values = this.#defaultValues ? [...this.#defaultValues] : [];\n this.#close();\n }\n\n /** Mirrors an ancestor fieldset's disabled state and closes the popover. */\n formDisabledCallback(disabled: boolean): void {\n this._formDisabled = disabled;\n if (disabled) this.#close();\n }\n\n /** Restores the selection from the saved form state on navigation/autofill. */\n formStateRestoreCallback(state: string | File | FormData | null): void {\n if (typeof state !== \"string\") return;\n try {\n const parsed: unknown = JSON.parse(state);\n if (Array.isArray(parsed)) {\n this.values = parsed.filter((item): item is string => typeof item === \"string\");\n }\n } catch {\n /* ignore malformed restore state */\n }\n }\n\n #syncFormValue(): void {\n const values = this.values;\n if (!this.name || values.length === 0) {\n this.#internals.setFormValue(null);\n return;\n }\n const data = new FormData();\n for (const value of values) data.append(this.name, value);\n this.#internals.setFormValue(data, JSON.stringify(values));\n }\n\n #syncValidity(): void {\n const anchor = this.#anchorElement();\n if (this.#isDisabled) {\n this.#internals.setValidity({});\n return;\n }\n if (this.required && this.values.length === 0) {\n this.#internals.setValidity(\n { valueMissing: true },\n \"Please select at least one option.\",\n anchor ?? undefined,\n );\n } else {\n this.#internals.setValidity({});\n }\n }\n\n #anchorElement(): HTMLElement | null {\n return this.renderRoot.querySelector<HTMLElement>(\n \"button.trigger, input.search-input, ul.persistent\",\n );\n }\n\n #dedupe(values: readonly string[]): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n for (const value of values) {\n if (seen.has(value)) continue;\n seen.add(value);\n result.push(value);\n }\n return result;\n }\n\n /** First option matching `value`, so duplicate values resolve deterministically. */\n #optionByValue(value: string): MultiSelectOption | undefined {\n return this.options.find((option) => option.value === value);\n }\n\n #labelFor(value: string): string {\n return this.#optionByValue(value)?.label ?? value;\n }\n\n #summaryText(): string {\n if (this.values.length === 0) return this.placeholder;\n if (this.values.length === 1) return this.#labelFor(this.values[0]);\n return `${this.values.length} selected`;\n }\n\n #liveText(): string {\n if (this.values.length === 0) return \"No options selected\";\n if (this.values.length === 1) return `${this.#labelFor(this.values[0])} selected`;\n return `${this.values.length} options selected`;\n }\n\n #visibleOptions(): MultiSelectOption[] {\n if (!this.searchable || this._query === null) return this.options;\n const needle = this._query.trim().toLocaleLowerCase();\n if (!needle) return this.options;\n return this.options.filter((option) =>\n option.label.toLocaleLowerCase().includes(needle),\n );\n }\n\n /** Whether `value` is currently at the selection cap and cannot be added. */\n #atCap(value: string): boolean {\n return (\n this.max > 0 && this.values.length >= this.max && !this.values.includes(value)\n );\n }\n\n #isOptionDisabled(option: MultiSelectOption): boolean {\n return Boolean(option.disabled) || this.#atCap(option.value) || this.#isDisabled;\n }\n\n #toggleOption(option: MultiSelectOption): void {\n if (this.#isDisabled || option.disabled) return;\n if (this.values.includes(option.value)) {\n this.#commit(this.values.filter((value) => value !== option.value));\n return;\n }\n if (this.#atCap(option.value)) return;\n this.#commit([...this.values, option.value]);\n }\n\n #removeValue(value: string): void {\n if (this.#isDisabled) return;\n if (!this.values.includes(value)) return;\n this.#commit(this.values.filter((existing) => existing !== value));\n }\n\n #commit(next: string[]): void {\n this.values = this.#dedupe(next);\n this.dispatchEvent(\n new CustomEvent(\"change\", {\n detail: { values: [...this.values] },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n #onWindowMousedown = (e: MouseEvent): void => {\n if (!e.composedPath().includes(this)) this.#close();\n };\n\n #onFocusOut = (e: FocusEvent): void => {\n if (this.#listboxPointerDown || this.#suppressNextBlur) return;\n const next = e.relatedTarget;\n // Focus leaving to body/null (e.g. a pointer press on a non-focusable\n // element inside the component) is handled by the outside-mousedown\n // listener; only a genuine Tab-out to another element closes here.\n if (!(next instanceof Node)) return;\n if (this === next || this.renderRoot.contains(next)) return;\n this.#close();\n };\n\n #toggle(): void {\n if (this.#isDisabled) return;\n if (this._open) this.#close();\n else this.#open();\n }\n\n #open(): void {\n if (this.#isDisabled) return;\n this._query = null;\n this._open = true;\n this._activeIndex = this.#initialActiveIndex();\n }\n\n #close(): void {\n this._open = false;\n this._query = null;\n this._activeIndex = -1;\n this.#searchSelection = null;\n }\n\n #initialActiveIndex(): number {\n const options = this.#visibleOptions();\n if (options.length === 0) return -1;\n if (this._query !== null) return 0;\n const selectedIndex = options.findIndex((option) =>\n this.values.includes(option.value),\n );\n return selectedIndex >= 0 ? selectedIndex : 0;\n }\n\n #moveActive(delta: number): void {\n const options = this.#visibleOptions();\n if (options.length === 0) return;\n const n = options.length;\n this._activeIndex = (this._activeIndex + delta + n) % n;\n }\n\n #toggleActive(): void {\n const options = this.#visibleOptions();\n const option = options[this._activeIndex] ?? options[0];\n if (option) this.#toggleOption(option);\n }\n\n #onTriggerKeydown(e: KeyboardEvent): void {\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!this._open) {\n this.#open();\n return;\n }\n if (e.key === \"ArrowDown\") this.#moveActive(1);\n else if (e.key === \"ArrowUp\") this.#moveActive(-1);\n else this.#toggleActive();\n } else if ((e.key === \"Home\" || e.key === \"End\") && this._open) {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Escape\" && this._open) {\n e.preventDefault();\n this.#close();\n }\n }\n\n #onSearchFocus(e: FocusEvent): void {\n if (this.#isDisabled) return;\n if (this.#blurTimer) {\n clearTimeout(this.#blurTimer);\n this.#blurTimer = null;\n }\n if (!this._open) this.#open();\n if (!this.#restoringSearchFocus) (e.currentTarget as HTMLInputElement).select();\n }\n\n #onSearchClick(): void {\n if (!this._open) this.#open();\n }\n\n #onSearchMousedown(e: MouseEvent): void {\n if (e.button !== 0) e.preventDefault();\n }\n\n /** Seeds the active option when the persistent (non-searchable) list focuses. */\n #onListFocus(): void {\n if (this.#isDisabled || this.searchable) return;\n if (this._activeIndex < 0) this._activeIndex = this.#initialActiveIndex();\n }\n\n /** Keyboard navigation for the focusable, non-searchable persistent list. */\n #onListKeydown(e: KeyboardEvent): void {\n if (this.#isDisabled || this.searchable) return;\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n if (this._activeIndex < 0) this._activeIndex = this.#initialActiveIndex();\n else this.#moveActive(e.key === \"ArrowDown\" ? 1 : -1);\n } else if (e.key === \"Home\" || e.key === \"End\") {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n this.#toggleActive();\n }\n // Escape intentionally does nothing: the list is never hidden.\n }\n\n /** Infix-filters the persistent list as the searchable-list query changes. */\n #onListSearchInput(e: InputEvent): void {\n this._query = (e.currentTarget as HTMLInputElement).value;\n const options = this.#visibleOptions();\n this._activeIndex = options.length > 0 ? 0 : -1;\n }\n\n /** Keyboard navigation for the search field above a searchable persistent list. */\n #onListSearchKeydown(e: KeyboardEvent): void {\n if (e.isComposing || e.keyCode === 229 || this.#isComposing || this.#compositionJustEnded) {\n return;\n }\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n this.#moveActive(e.key === \"ArrowDown\" ? 1 : -1);\n } else if (e.key === \"Home\" || e.key === \"End\") {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n this.#toggleActive();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n this._query = null;\n const options = this.#visibleOptions();\n this._activeIndex = options.length > 0 ? 0 : -1;\n } else if (\n e.key === \"Backspace\" &&\n (e.currentTarget as HTMLInputElement).value === \"\" &&\n this.values.length > 0\n ) {\n e.preventDefault();\n this.#removeValue(this.values[this.values.length - 1]);\n }\n }\n\n #onSearchInput(e: InputEvent): void {\n this._query = (e.currentTarget as HTMLInputElement).value;\n this._open = true;\n const options = this.#visibleOptions();\n this._activeIndex = options.length > 0 ? 0 : -1;\n }\n\n #onSearchKeydown(e: KeyboardEvent): void {\n if (e.isComposing || e.keyCode === 229 || this.#isComposing || this.#compositionJustEnded) {\n return;\n }\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n if (!this._open) {\n this.#open();\n return;\n }\n this.#moveActive(e.key === \"ArrowDown\" ? 1 : -1);\n } else if ((e.key === \"Home\" || e.key === \"End\") && this._open) {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Enter\" && this._open) {\n e.preventDefault();\n this.#toggleActive();\n } else if (e.key === \"Escape\" && this._open) {\n e.preventDefault();\n this.#close();\n } else if (\n e.key === \"Backspace\" &&\n (e.currentTarget as HTMLInputElement).value === \"\" &&\n this.values.length > 0\n ) {\n e.preventDefault();\n this.#removeValue(this.values[this.values.length - 1]);\n }\n }\n\n #onSearchBlur(): void {\n if (this.#blurTimer) clearTimeout(this.#blurTimer);\n this.#blurTimer = setTimeout(() => {\n this.#blurTimer = null;\n if (!this._open) return;\n if (!this.#listboxPointerDown && !this.#suppressNextBlur) this.#close();\n });\n }\n\n #focusSearchInput(e: MouseEvent): void {\n if (\n e.button !== 0 ||\n this.#isDisabled ||\n e.composedPath()[0] instanceof HTMLInputElement\n ) {\n return;\n }\n e.preventDefault();\n const input = this.renderRoot.querySelector<HTMLInputElement>(\"input.search-input\");\n if (!this._open) this.#open();\n input?.focus();\n input?.select();\n }\n\n #onCompositionStart(): void {\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#compositionEndTimer = null;\n this.#compositionJustEnded = false;\n this.#isComposing = true;\n }\n\n #onCompositionEnd(): void {\n this.#isComposing = false;\n this.#compositionJustEnded = true;\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#compositionEndTimer = setTimeout(() => {\n this.#compositionJustEnded = false;\n this.#compositionEndTimer = null;\n });\n }\n\n #onListboxMousedown(e: MouseEvent): void {\n if (e.button !== 0) return;\n this.#listboxPointerDown = true;\n this.#suppressNextBlur = true;\n const input = this.renderRoot.querySelector<HTMLInputElement>(\"input.search-input\");\n this.#searchSelection = input ? [input.selectionStart, input.selectionEnd] : null;\n window.addEventListener(\n \"mouseup\",\n () => {\n this.#listboxPointerDown = false;\n if (this._open) {\n const searchInput =\n this.renderRoot.querySelector<HTMLInputElement>(\"input.search-input\");\n if (searchInput) {\n this.#restoringSearchFocus = true;\n searchInput.focus({ preventScroll: true });\n this.#restoringSearchFocus = false;\n const [start, end] = this.#searchSelection ?? [null, null];\n if (start !== null && end !== null) searchInput.setSelectionRange(start, end);\n }\n }\n this.#searchSelection = null;\n setTimeout(() => {\n this.#suppressNextBlur = false;\n });\n },\n { capture: true, once: true },\n );\n }\n\n #onOptionMousedown(e: MouseEvent, option: MultiSelectOption): void {\n if (e.button !== 0) return;\n const optionElement = e.currentTarget as HTMLElement;\n const listbox = optionElement.parentElement;\n if (listbox) {\n const scrollbarWidth = listbox.offsetWidth - listbox.clientWidth;\n const bounds = listbox.getBoundingClientRect();\n const isRtl = getComputedStyle(listbox).direction === \"rtl\";\n const inScrollbarGutter = isRtl\n ? e.clientX <= bounds.left + scrollbarWidth\n : e.clientX >= bounds.right - scrollbarWidth;\n if (scrollbarWidth > 0 && inScrollbarGutter) return;\n }\n e.preventDefault();\n if (this.#isOptionDisabled(option)) return;\n this.#toggleOption(option);\n if (this.variant === \"list\" && !this.searchable && !this.#isDisabled) {\n this.renderRoot\n .querySelector<HTMLElement>(\"ul.persistent\")\n ?.focus({ preventScroll: true });\n }\n }\n\n #optionIconSize(option: MultiSelectOption): number {\n const size = option.iconSize ?? 16;\n return Number.isFinite(size) && size > 0 ? size : 16;\n }\n\n #renderOptionIcon(option: MultiSelectOption) {\n if (!option.icon) return nothing;\n return html`\n <span\n class=\"option-icon\"\n style=${`--multi-select-icon-size: ${this.#optionIconSize(option)}px`}\n aria-hidden=\"true\"\n >\n ${option.icon}\n </span>\n `;\n }\n\n /** The shared `<li role=\"option\">` items for both variants' listboxes. */\n private renderOptionItems(options: MultiSelectOption[]) {\n return html`\n ${options.map((option, index) => {\n const selected = this.values.includes(option.value);\n const disabled = this.#isOptionDisabled(option);\n return html`\n <li\n id=${`${this.#listboxId}-option-${index}`}\n role=\"option\"\n aria-selected=${selected}\n aria-disabled=${disabled ? \"true\" : nothing}\n class=${index === this._activeIndex ? \"active\" : \"\"}\n @mousedown=${(e: MouseEvent) => this.#onOptionMousedown(e, option)}\n >\n <span class=\"check ${selected ? \"\" : \"hidden\"}\" aria-hidden=\"true\">\n ${iconCheckCircle(14)}\n </span>\n <span class=\"option-content\">\n ${this.#renderOptionIcon(option)}\n <span class=\"option-label\">${option.label}</span>\n </span>\n </li>\n `;\n })}\n ${options.length === 0\n ? html`<li class=\"no-options\" role=\"presentation\">\n <span role=\"status\">No options found</span>\n </li>`\n : nothing}\n `;\n }\n\n private renderListbox() {\n if (!this._open) return nothing;\n const options = this.#visibleOptions();\n return html`\n <ul\n id=${this.#listboxId}\n class=\"options\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n aria-label=${this.label ? `${this.label} options` : \"Options\"}\n @mousedown=${(e: MouseEvent) => this.#onListboxMousedown(e)}\n >\n ${this.renderOptionItems(options)}\n </ul>\n `;\n }\n\n private renderChips() {\n if (!this.showChips || this.values.length === 0) return nothing;\n return html`\n <div class=\"chips\">\n ${this.values.map((value) => {\n const label = this.#labelFor(value);\n return html`\n <span class=\"chip\">\n <span class=\"chip-label\">${label}</span>\n <button\n type=\"button\"\n class=\"chip-remove\"\n aria-label=${`Remove ${label}`}\n ?disabled=${this.#isDisabled}\n @click=${() => this.#removeValue(value)}\n >\n ${iconX(18)}\n </button>\n </span>\n `;\n })}\n </div>\n `;\n }\n\n private renderSearchTrigger() {\n const activeDescendant =\n this._open && this._activeIndex >= 0\n ? `${this.#listboxId}-option-${this._activeIndex}`\n : nothing;\n return html`\n <div\n class=\"search-trigger ${this.#isDisabled ? \"disabled\" : \"\"}\"\n @mousedown=${(e: MouseEvent) => this.#focusSearchInput(e)}\n >\n <input\n type=\"text\"\n class=\"search-input\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n aria-expanded=${this._open}\n aria-controls=${this.#listboxId}\n aria-activedescendant=${activeDescendant}\n aria-label=${this.label || \"Select options\"}\n placeholder=${this.#summaryText()}\n autocomplete=\"off\"\n ?disabled=${this.#isDisabled}\n .value=${this._query ?? \"\"}\n @mousedown=${(e: MouseEvent) => this.#onSearchMousedown(e)}\n @focus=${(e: FocusEvent) => this.#onSearchFocus(e)}\n @click=${() => this.#onSearchClick()}\n @input=${(e: InputEvent) => this.#onSearchInput(e)}\n @compositionstart=${() => this.#onCompositionStart()}\n @compositionend=${() => this.#onCompositionEnd()}\n @keydown=${(e: KeyboardEvent) => this.#onSearchKeydown(e)}\n @blur=${() => this.#onSearchBlur()}\n />\n <span class=\"chevron\">${iconChevronRight(14)}</span>\n </div>\n `;\n }\n\n private renderButtonTrigger() {\n const activeDescendant =\n this._open && this._activeIndex >= 0\n ? `${this.#listboxId}-option-${this._activeIndex}`\n : nothing;\n const empty = this.values.length === 0;\n return html`\n <button\n type=\"button\"\n class=\"trigger\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded=${this._open}\n aria-controls=${this.#listboxId}\n aria-activedescendant=${activeDescendant}\n aria-label=${this.label || nothing}\n ?disabled=${this.#isDisabled}\n @click=${() => this.#toggle()}\n @keydown=${(e: KeyboardEvent) => this.#onTriggerKeydown(e)}\n >\n <span class=\"trigger-label ${empty ? \"placeholder\" : \"\"}\">${this.#summaryText()}</span>\n <span class=\"chevron\">${iconChevronRight(14)}</span>\n </button>\n `;\n }\n\n private renderListSearch() {\n const activeDescendant =\n this._activeIndex >= 0 ? `${this.#listboxId}-option-${this._activeIndex}` : nothing;\n return html`\n <div class=\"search-field ${this.#isDisabled ? \"disabled\" : \"\"}\">\n <input\n type=\"text\"\n class=\"search-input list-search\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n aria-expanded=\"true\"\n aria-controls=${this.#listboxId}\n aria-activedescendant=${activeDescendant}\n aria-label=${this.label || \"Select options\"}\n placeholder=${this.#summaryText()}\n autocomplete=\"off\"\n ?disabled=${this.#isDisabled}\n .value=${this._query ?? \"\"}\n @input=${(e: InputEvent) => this.#onListSearchInput(e)}\n @compositionstart=${() => this.#onCompositionStart()}\n @compositionend=${() => this.#onCompositionEnd()}\n @keydown=${(e: KeyboardEvent) => this.#onListSearchKeydown(e)}\n />\n </div>\n `;\n }\n\n private renderPersistentList() {\n const options = this.#visibleOptions();\n const focusable = !this.searchable && !this.#isDisabled;\n const activeDescendant =\n !this.searchable && this._activeIndex >= 0 && options.length > 0\n ? `${this.#listboxId}-option-${this._activeIndex}`\n : nothing;\n return html`\n <ul\n id=${this.#listboxId}\n class=\"options persistent ${this.#isDisabled ? \"disabled\" : \"\"}\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n aria-label=${this.label ? `${this.label} options` : \"Options\"}\n aria-disabled=${this.#isDisabled ? \"true\" : nothing}\n tabindex=${focusable ? \"0\" : nothing}\n aria-activedescendant=${activeDescendant}\n style=${`height: calc(${this.#rows} * 2rem + 0.5rem + 2px)`}\n @mousedown=${(e: MouseEvent) => this.#onListboxMousedown(e)}\n @focus=${() => this.#onListFocus()}\n @keydown=${(e: KeyboardEvent) => this.#onListKeydown(e)}\n >\n ${this.renderOptionItems(options)}\n </ul>\n `;\n }\n\n private renderListVariant() {\n return html`\n <div class=\"control list-control\">\n ${this.searchable ? this.renderListSearch() : nothing}\n ${this.renderPersistentList()}\n </div>\n ${this.renderChips()}\n <span class=\"sr-only\" aria-live=\"polite\">${this.#liveText()}</span>\n `;\n }\n\n override render() {\n if (this.variant === \"list\") return this.renderListVariant();\n return html`\n <div class=\"control\" @focusout=${(e: FocusEvent) => this.#onFocusOut(e)}>\n ${this.searchable ? this.renderSearchTrigger() : this.renderButtonTrigger()}\n ${this.renderListbox()}\n </div>\n ${this.renderChips()}\n <span class=\"sr-only\" aria-live=\"polite\">${this.#liveText()}</span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"multi-select\": MultiSelect;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"multi-select.js","sourceRoot":"","sources":["../src/multi-select.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,UAAU,EACV,GAAG,EACH,IAAI,EACJ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AC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAS;AAMP;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAA0C;AAMf;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;gDAAiB;AAOjB;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;8CAAmB;AAEvD;IAAhB,KAAK,EAAE;0CAAuB;AACd;IAAhB,KAAK,EAAE;iDAA2B;AAClB;IAAhB,KAAK,EAAE;2CAAsC;AAC7B;IAAhB,KAAK,EAAE;kDAA+B;AAjc5B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAkrCvB","sourcesContent":["import {\n LitElement,\n css,\n html,\n nothing,\n type PropertyValues,\n type TemplateResult,\n} from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { iconCheckCircle, iconChevronRight, iconX } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nlet instanceCount = 0;\n\n/**\n * Presentation variant of {@link MultiSelect}.\n *\n * - `\"dropdown\"` (default): a compact trigger that opens a listbox popover.\n * - `\"list\"`: a persistently visible, bordered list surface with no popover.\n */\nexport type MultiSelectVariant = \"dropdown\" | \"list\";\n\n/** A single selectable option. */\nexport interface MultiSelectOption {\n value: string;\n label: string;\n /** Optional pre-rendered icon template displayed before the label. */\n icon?: TemplateResult;\n /** Square icon size in pixels. Defaults to 16 when `icon` is set. */\n iconSize?: number;\n /** When true, the option can neither be selected nor removed via the UI. */\n disabled?: boolean;\n}\n\n/**\n * A form-associated multi-select: a trigger showing a compact summary of the\n * current selection, opening a multi-selectable listbox popover, with an\n * optional removable-chip list of the chosen values. A drop-in generic\n * replacement for a native `<select multiple>` — set `name` on the element\n * itself and each\n * selected value is submitted as a repeated `name=value` entry, matching native\n * multiple-select semantics; `new FormData(form).getAll(name)` and\n * `form.reset()` work unchanged.\n *\n * The trigger visually follows `form-select`: a `2rem` field showing the\n * `placeholder` when empty, the single selected label when one value is chosen,\n * and `N selected` when several are. Set `show-chips` to additionally render\n * the selected values as compact chips below the trigger, each with an\n * accessible `32px` remove control; chips are off by default and the region\n * reserves no space while nothing is selected. Like `form-select`, the host is\n * `display: block` and fills its container by default; constrain the host\n * (`multi-select { display: inline-block; }`) to shrink it to its content\n * instead.\n *\n * Set `searchable` to replace the button trigger with an editable combobox that\n * infix-filters the predefined options by case-insensitive label. Typed text is\n * only a query: `values` changes exclusively when options are toggled, and an\n * uncommitted query is discarded when the list closes.\n *\n * The `variant` chooses between two presentations, and `searchable` applies to\n * both:\n *\n * - `\"dropdown\"` (default) is the popover form described above: a compact\n * trigger (button, or search combobox when `searchable`) that opens a\n * multi-selectable listbox on demand, closes on outside click / Escape, and\n * shows a chevron.\n * - `\"list\"` renders the options as a persistently visible, bordered surface\n * with no popover, no chevron, and no `open` host state; it never registers\n * outside-click listeners. Its scroll viewport is sized to roughly\n * `visibleRows` `2rem` rows (see `visible-rows`). When not `searchable` the\n * `listbox` itself is focusable and drives Arrow/Home/End/Enter/Space keyboard\n * navigation via `aria-activedescendant`; when `searchable` a `2rem` search\n * field sits above the list and owns navigation, and Escape only clears the\n * query instead of hiding the list.\n *\n * @element multi-select\n * @fires change - Fired with `{ values: string[] }` (a copied array) when a\n * value is added or removed through the UI. Programmatic `values` assignments\n * do not fire it.\n */\n@customElement(\"multi-select\")\nexport class MultiSelect extends LitElement {\n static formAssociated = true;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n position: relative;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n }\n .control {\n position: relative;\n }\n button.trigger {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.25rem;\n width: 100%;\n height: 2rem;\n box-sizing: border-box;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n }\n button.trigger:hover:not(:disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n button.trigger:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n button.trigger:focus-visible {\n outline: none;\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .trigger-label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .trigger-label.placeholder {\n color: var(--ui-text-muted, #64748b);\n }\n .search-trigger {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.25rem;\n width: 100%;\n height: 2rem;\n box-sizing: border-box;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n cursor: text;\n }\n .search-trigger:hover:not(.disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .search-trigger:not(.disabled):focus-within {\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .search-trigger.disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n input.search-input {\n min-width: 0;\n flex: 1;\n box-sizing: border-box;\n padding: 0.5rem 0 0.5rem 0.75rem;\n color: inherit;\n background: transparent;\n border: 0;\n outline: 0;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n }\n input.search-input::placeholder {\n color: var(--ui-text-muted, #64748b);\n font-weight: var(--ui-font-weight-medium, 500);\n opacity: 1;\n }\n .chevron {\n display: flex;\n flex: 0 0 auto;\n margin-right: 0.75rem;\n color: var(--ui-text-muted, #64748b);\n pointer-events: none;\n transform: rotate(90deg);\n transition: transform 150ms ease;\n }\n button.trigger .chevron {\n margin-right: 0;\n }\n :host([open]) .chevron {\n transform: rotate(-90deg);\n }\n ul.options {\n position: absolute;\n top: 100%;\n left: 0;\n z-index: 10;\n min-width: 100%;\n max-height: 40vh;\n overflow-y: auto;\n scrollbar-gutter: stable;\n margin: 0.25rem 0 0;\n padding: 0.25rem 0;\n list-style: none;\n white-space: nowrap;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n }\n ul.options::-webkit-scrollbar {\n width: 0.75rem;\n }\n ul.options::-webkit-scrollbar-thumb {\n background: var(--ui-border, #e2e8f0);\n border: 0.25rem solid transparent;\n border-radius: var(--ui-radius-pill, 9999px);\n background-clip: padding-box;\n }\n .list-control {\n display: flex;\n flex-direction: column;\n }\n .search-field {\n display: flex;\n align-items: center;\n width: 100%;\n height: 2rem;\n box-sizing: border-box;\n margin-bottom: 0.25rem;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n cursor: text;\n }\n .search-field:not(.disabled):focus-within {\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .search-field.disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n input.list-search {\n padding-right: 0.75rem;\n }\n ul.options.persistent {\n position: static;\n z-index: auto;\n min-width: 0;\n max-height: none;\n margin: 0;\n box-sizing: border-box;\n border-radius: var(--ui-radius, 0.5rem);\n box-shadow: none;\n }\n ul.options.persistent.disabled {\n cursor: not-allowed;\n opacity: 0.6;\n pointer-events: none;\n }\n ul.options.persistent:focus-visible {\n outline: none;\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n li {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n }\n li.active,\n li:hover:not([aria-disabled=\"true\"]) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n li[aria-selected=\"true\"] {\n font-weight: var(--ui-font-weight-semibold, 600);\n color: var(--ui-primary, #4f46e5);\n }\n li[aria-disabled=\"true\"] {\n cursor: not-allowed;\n color: var(--ui-text-muted, #64748b);\n opacity: 0.6;\n }\n .check {\n display: inline-flex;\n flex: 0 0 auto;\n width: 14px;\n height: 14px;\n align-items: center;\n justify-content: center;\n color: var(--ui-primary, #4f46e5);\n }\n .check.hidden {\n visibility: hidden;\n }\n .check > svg {\n width: 100%;\n height: 100%;\n }\n .option-content {\n display: inline-flex;\n min-width: 0;\n flex: 1;\n align-items: center;\n gap: 0.5rem;\n }\n .option-icon {\n display: inline-flex;\n width: var(--multi-select-icon-size);\n height: var(--multi-select-icon-size);\n flex: 0 0 var(--multi-select-icon-size);\n align-items: center;\n justify-content: center;\n }\n .option-icon > svg {\n width: 100%;\n height: 100%;\n }\n .option-label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n li.no-options {\n display: block;\n padding: 0.5rem 0.75rem;\n color: var(--ui-text-muted, #64748b);\n cursor: default;\n font-style: italic;\n }\n .chips {\n display: flex;\n flex-wrap: wrap;\n gap: 0.25rem;\n margin-top: 0.25rem;\n /* Pin the chips row to the control's resolved width (0 width +\n min-width 100%) so a long selected label ellipsizes instead of\n contributing its content width and widening the control. */\n width: 0;\n min-width: 100%;\n box-sizing: border-box;\n }\n .chip {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n max-width: 100%;\n box-sizing: border-box;\n padding-left: 0.5rem;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface-muted, #f8fafc);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n }\n .chip-label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n }\n .chip-remove {\n display: inline-flex;\n flex: 0 0 auto;\n width: 2rem;\n height: 2rem;\n align-items: center;\n justify-content: center;\n padding: 0;\n color: var(--ui-text-muted, #64748b);\n background: transparent;\n border: 0;\n border-radius: var(--ui-radius-sm, 0.25rem);\n cursor: pointer;\n }\n .chip-remove:hover:not(:disabled) {\n color: var(--ui-danger, #dc2626);\n }\n .chip-remove:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .chip-remove:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .chip-remove > svg {\n width: 18px;\n height: 18px;\n }\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n @media (prefers-reduced-motion: reduce) {\n .chevron {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n button.trigger:focus-visible,\n .search-trigger:not(.disabled):focus-within,\n .search-field:not(.disabled):focus-within,\n ul.options.persistent:focus-visible,\n .chip-remove:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n button.trigger:disabled,\n .search-trigger.disabled,\n .search-field.disabled,\n ul.options.persistent.disabled,\n .chip-remove:disabled,\n li[aria-disabled=\"true\"] {\n color: GrayText;\n opacity: 1;\n }\n li.active,\n li:hover:not([aria-disabled=\"true\"]) {\n color: HighlightText;\n background: Highlight;\n }\n li[aria-selected=\"true\"] {\n color: Highlight;\n }\n li.active[aria-selected=\"true\"],\n li[aria-selected=\"true\"]:hover {\n color: HighlightText;\n }\n .chip {\n border-color: CanvasText;\n }\n }\n `,\n ];\n\n /** The full list of selectable options. */\n @property({ attribute: false }) options: MultiSelectOption[] = [];\n /**\n * The currently selected values. Programmatic assignments are deduplicated\n * while preserving order and never fire `change`.\n */\n @property({ attribute: false }) values: string[] = [];\n /** Form control name; each selected value submits under it. */\n @property() name = \"\";\n /** Accessible label applied to the trigger. */\n @property() label = \"\";\n /** Text shown on the trigger when nothing is selected. */\n @property() placeholder = \"Select options\";\n /** Disables the whole control, preventing the popover from opening. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n /** Marks the control as required for native form validation. */\n @property({ type: Boolean }) required = false;\n /**\n * Enables editable, case-insensitive infix filtering by option label.\n * Typed text never becomes a selected value.\n */\n @property({ type: Boolean, reflect: true }) searchable = false;\n /** Maximum number of selectable values; `0` (default) means unlimited. */\n @property({ type: Number }) max = 0;\n /**\n * Presentation variant. `\"dropdown\"` (default) opens a popover listbox;\n * `\"list\"` renders a persistently visible, bordered list surface. Reflected\n * so consumers can style by `[variant=\"list\"]`.\n */\n @property({ reflect: true }) variant: MultiSelectVariant = \"dropdown\";\n /**\n * Number of `2rem` rows the `list` variant's scroll viewport shows before it\n * scrolls, mirroring a native `<select size>`. Normalized to an integer of at\n * least `1` (default `5`); ignored by the `dropdown` variant.\n */\n @property({ type: Number, attribute: \"visible-rows\" }) visibleRows = 5;\n /**\n * When true, the selected values are also rendered as removable chips below\n * the trigger, each with an accessible `32px` remove control. Off by default:\n * the trigger already summarizes the selection, and values can be toggled off\n * in the listbox. Applies to both variants.\n */\n @property({ type: Boolean, attribute: \"show-chips\" }) showChips = false;\n\n @state() private _open = false;\n @state() private _activeIndex = -1;\n @state() private _query: string | null = null;\n @state() private _formDisabled = false;\n\n #internals = this.attachInternals();\n #defaultValues: string[] | null = null;\n #listboxPointerDown = false;\n #suppressNextBlur = false;\n #restoringSearchFocus = false;\n #searchSelection: [number | null, number | null] | null = null;\n #isComposing = false;\n #compositionJustEnded = false;\n #compositionEndTimer: ReturnType<typeof setTimeout> | null = null;\n #blurTimer: ReturnType<typeof setTimeout> | null = null;\n readonly #listboxId = `multi-select-listbox-${++instanceCount}`;\n\n /** Whether the host or an ancestor fieldset currently disables the control. */\n get #isDisabled(): boolean {\n return this.disabled || this._formDisabled;\n }\n\n /** `visibleRows` normalized to a whole number of rows, at least `1`. */\n get #rows(): number {\n const raw = this.visibleRows;\n if (!Number.isFinite(raw)) return 5;\n const floored = Math.floor(raw);\n return floored < 1 ? 1 : floored;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n if (this.#blurTimer) clearTimeout(this.#blurTimer);\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#blurTimer = null;\n this.#compositionEndTimer = null;\n this.#listboxPointerDown = false;\n this.#suppressNextBlur = false;\n this.#searchSelection = null;\n this.#isComposing = false;\n this.#compositionJustEnded = false;\n this.#close();\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.hasUpdated && this.#defaultValues === null) {\n this.#defaultValues = this.#dedupe(this.values);\n }\n if (changed.has(\"values\")) {\n const deduped = this.#dedupe(this.values);\n if (\n deduped.length !== this.values.length ||\n deduped.some((value, index) => value !== this.values[index])\n ) {\n this.values = deduped;\n }\n }\n if (\n (changed.has(\"disabled\") || changed.has(\"searchable\") || changed.has(\"variant\")) &&\n (this.#isDisabled || changed.has(\"searchable\") || changed.has(\"variant\"))\n ) {\n this.#close();\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(\"_open\")) {\n this.toggleAttribute(\"open\", this._open);\n if (this._open) {\n window.addEventListener(\"mousedown\", this.#onWindowMousedown, true);\n } else {\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n }\n }\n if (changed.has(\"values\") || changed.has(\"name\")) this.#syncFormValue();\n if (\n changed.has(\"values\") ||\n changed.has(\"required\") ||\n changed.has(\"disabled\") ||\n changed.has(\"_formDisabled\")\n ) {\n this.#syncValidity();\n }\n if (\n (changed.has(\"_activeIndex\") || changed.has(\"_query\") || changed.has(\"options\")) &&\n (this._open || this.variant === \"list\") &&\n this._activeIndex >= 0\n ) {\n this.renderRoot\n .querySelector<HTMLElement>(`#${this.#listboxId}-option-${this._activeIndex}`)\n ?.scrollIntoView({ block: \"nearest\", inline: \"nearest\" });\n }\n }\n\n /** Restores the selection captured at first render, per the form contract. */\n formResetCallback(): void {\n this.values = this.#defaultValues ? [...this.#defaultValues] : [];\n this.#close();\n }\n\n /** Mirrors an ancestor fieldset's disabled state and closes the popover. */\n formDisabledCallback(disabled: boolean): void {\n this._formDisabled = disabled;\n if (disabled) this.#close();\n }\n\n /** Restores the selection from the saved form state on navigation/autofill. */\n formStateRestoreCallback(state: string | File | FormData | null): void {\n if (typeof state !== \"string\") return;\n try {\n const parsed: unknown = JSON.parse(state);\n if (Array.isArray(parsed)) {\n this.values = parsed.filter((item): item is string => typeof item === \"string\");\n }\n } catch {\n /* ignore malformed restore state */\n }\n }\n\n #syncFormValue(): void {\n const values = this.values;\n if (!this.name || values.length === 0) {\n this.#internals.setFormValue(null);\n return;\n }\n const data = new FormData();\n for (const value of values) data.append(this.name, value);\n this.#internals.setFormValue(data, JSON.stringify(values));\n }\n\n #syncValidity(): void {\n const anchor = this.#anchorElement();\n if (this.#isDisabled) {\n this.#internals.setValidity({});\n return;\n }\n if (this.required && this.values.length === 0) {\n this.#internals.setValidity(\n { valueMissing: true },\n \"Please select at least one option.\",\n anchor ?? undefined,\n );\n } else {\n this.#internals.setValidity({});\n }\n }\n\n #anchorElement(): HTMLElement | null {\n return this.renderRoot.querySelector<HTMLElement>(\n \"button.trigger, input.search-input, ul.persistent\",\n );\n }\n\n #dedupe(values: readonly string[]): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n for (const value of values) {\n if (seen.has(value)) continue;\n seen.add(value);\n result.push(value);\n }\n return result;\n }\n\n /** First option matching `value`, so duplicate values resolve deterministically. */\n #optionByValue(value: string): MultiSelectOption | undefined {\n return this.options.find((option) => option.value === value);\n }\n\n #labelFor(value: string): string {\n return this.#optionByValue(value)?.label ?? value;\n }\n\n #summaryText(): string {\n if (this.values.length === 0) return this.placeholder;\n if (this.values.length === 1) return this.#labelFor(this.values[0]);\n return `${this.values.length} selected`;\n }\n\n #liveText(): string {\n if (this.values.length === 0) return \"No options selected\";\n if (this.values.length === 1) return `${this.#labelFor(this.values[0])} selected`;\n return `${this.values.length} options selected`;\n }\n\n #visibleOptions(): MultiSelectOption[] {\n if (!this.searchable || this._query === null) return this.options;\n const needle = this._query.trim().toLocaleLowerCase();\n if (!needle) return this.options;\n return this.options.filter((option) =>\n option.label.toLocaleLowerCase().includes(needle),\n );\n }\n\n /** Whether `value` is currently at the selection cap and cannot be added. */\n #atCap(value: string): boolean {\n return (\n this.max > 0 && this.values.length >= this.max && !this.values.includes(value)\n );\n }\n\n #isOptionDisabled(option: MultiSelectOption): boolean {\n return Boolean(option.disabled) || this.#atCap(option.value) || this.#isDisabled;\n }\n\n #toggleOption(option: MultiSelectOption): void {\n if (this.#isDisabled || option.disabled) return;\n if (this.values.includes(option.value)) {\n this.#commit(this.values.filter((value) => value !== option.value));\n return;\n }\n if (this.#atCap(option.value)) return;\n this.#commit([...this.values, option.value]);\n }\n\n #removeValue(value: string): void {\n if (this.#isDisabled) return;\n if (!this.values.includes(value)) return;\n this.#commit(this.values.filter((existing) => existing !== value));\n }\n\n #commit(next: string[]): void {\n this.values = this.#dedupe(next);\n this.dispatchEvent(\n new CustomEvent(\"change\", {\n detail: { values: [...this.values] },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n #onWindowMousedown = (e: MouseEvent): void => {\n if (!e.composedPath().includes(this)) this.#close();\n };\n\n #onFocusOut = (e: FocusEvent): void => {\n if (this.#listboxPointerDown || this.#suppressNextBlur) return;\n const next = e.relatedTarget;\n // Focus leaving to body/null (e.g. a pointer press on a non-focusable\n // element inside the component) is handled by the outside-mousedown\n // listener; only a genuine Tab-out to another element closes here.\n if (!(next instanceof Node)) return;\n if (this === next || this.renderRoot.contains(next)) return;\n this.#close();\n };\n\n #toggle(): void {\n if (this.#isDisabled) return;\n if (this._open) this.#close();\n else this.#open();\n }\n\n #open(): void {\n if (this.#isDisabled) return;\n this._query = null;\n this._open = true;\n this._activeIndex = this.#initialActiveIndex();\n }\n\n #close(): void {\n this._open = false;\n this._query = null;\n this._activeIndex = -1;\n this.#searchSelection = null;\n }\n\n #initialActiveIndex(): number {\n const options = this.#visibleOptions();\n if (options.length === 0) return -1;\n if (this._query !== null) return 0;\n const selectedIndex = options.findIndex((option) =>\n this.values.includes(option.value),\n );\n return selectedIndex >= 0 ? selectedIndex : 0;\n }\n\n #moveActive(delta: number): void {\n const options = this.#visibleOptions();\n if (options.length === 0) return;\n const n = options.length;\n this._activeIndex = (this._activeIndex + delta + n) % n;\n }\n\n #toggleActive(): void {\n const options = this.#visibleOptions();\n const option = options[this._activeIndex] ?? options[0];\n if (option) this.#toggleOption(option);\n }\n\n #onTriggerKeydown(e: KeyboardEvent): void {\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!this._open) {\n this.#open();\n return;\n }\n if (e.key === \"ArrowDown\") this.#moveActive(1);\n else if (e.key === \"ArrowUp\") this.#moveActive(-1);\n else this.#toggleActive();\n } else if ((e.key === \"Home\" || e.key === \"End\") && this._open) {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Escape\" && this._open) {\n e.preventDefault();\n this.#close();\n }\n }\n\n #onSearchFocus(e: FocusEvent): void {\n if (this.#isDisabled) return;\n if (this.#blurTimer) {\n clearTimeout(this.#blurTimer);\n this.#blurTimer = null;\n }\n if (!this._open) this.#open();\n if (!this.#restoringSearchFocus) (e.currentTarget as HTMLInputElement).select();\n }\n\n #onSearchClick(): void {\n if (!this._open) this.#open();\n }\n\n #onSearchMousedown(e: MouseEvent): void {\n if (e.button !== 0) e.preventDefault();\n }\n\n /** Seeds the active option when the persistent (non-searchable) list focuses. */\n #onListFocus(): void {\n if (this.#isDisabled || this.searchable) return;\n if (this._activeIndex < 0) this._activeIndex = this.#initialActiveIndex();\n }\n\n /** Keyboard navigation for the focusable, non-searchable persistent list. */\n #onListKeydown(e: KeyboardEvent): void {\n if (this.#isDisabled || this.searchable) return;\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n if (this._activeIndex < 0) this._activeIndex = this.#initialActiveIndex();\n else this.#moveActive(e.key === \"ArrowDown\" ? 1 : -1);\n } else if (e.key === \"Home\" || e.key === \"End\") {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n this.#toggleActive();\n }\n // Escape intentionally does nothing: the list is never hidden.\n }\n\n /** Infix-filters the persistent list as the searchable-list query changes. */\n #onListSearchInput(e: InputEvent): void {\n this._query = (e.currentTarget as HTMLInputElement).value;\n const options = this.#visibleOptions();\n this._activeIndex = options.length > 0 ? 0 : -1;\n }\n\n /** Keyboard navigation for the search field above a searchable persistent list. */\n #onListSearchKeydown(e: KeyboardEvent): void {\n if (e.isComposing || e.keyCode === 229 || this.#isComposing || this.#compositionJustEnded) {\n return;\n }\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n this.#moveActive(e.key === \"ArrowDown\" ? 1 : -1);\n } else if (e.key === \"Home\" || e.key === \"End\") {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n this.#toggleActive();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n this._query = null;\n const options = this.#visibleOptions();\n this._activeIndex = options.length > 0 ? 0 : -1;\n } else if (\n e.key === \"Backspace\" &&\n (e.currentTarget as HTMLInputElement).value === \"\" &&\n this.values.length > 0\n ) {\n e.preventDefault();\n this.#removeValue(this.values[this.values.length - 1]);\n }\n }\n\n #onSearchInput(e: InputEvent): void {\n this._query = (e.currentTarget as HTMLInputElement).value;\n this._open = true;\n const options = this.#visibleOptions();\n this._activeIndex = options.length > 0 ? 0 : -1;\n }\n\n #onSearchKeydown(e: KeyboardEvent): void {\n if (e.isComposing || e.keyCode === 229 || this.#isComposing || this.#compositionJustEnded) {\n return;\n }\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n if (!this._open) {\n this.#open();\n return;\n }\n this.#moveActive(e.key === \"ArrowDown\" ? 1 : -1);\n } else if ((e.key === \"Home\" || e.key === \"End\") && this._open) {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Enter\" && this._open) {\n e.preventDefault();\n this.#toggleActive();\n } else if (e.key === \"Escape\" && this._open) {\n e.preventDefault();\n this.#close();\n } else if (\n e.key === \"Backspace\" &&\n (e.currentTarget as HTMLInputElement).value === \"\" &&\n this.values.length > 0\n ) {\n e.preventDefault();\n this.#removeValue(this.values[this.values.length - 1]);\n }\n }\n\n #onSearchBlur(): void {\n if (this.#blurTimer) clearTimeout(this.#blurTimer);\n this.#blurTimer = setTimeout(() => {\n this.#blurTimer = null;\n if (!this._open) return;\n if (!this.#listboxPointerDown && !this.#suppressNextBlur) this.#close();\n });\n }\n\n #focusSearchInput(e: MouseEvent): void {\n if (\n e.button !== 0 ||\n this.#isDisabled ||\n e.composedPath()[0] instanceof HTMLInputElement\n ) {\n return;\n }\n e.preventDefault();\n const input = this.renderRoot.querySelector<HTMLInputElement>(\"input.search-input\");\n if (!this._open) this.#open();\n input?.focus();\n input?.select();\n }\n\n #onCompositionStart(): void {\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#compositionEndTimer = null;\n this.#compositionJustEnded = false;\n this.#isComposing = true;\n }\n\n #onCompositionEnd(): void {\n this.#isComposing = false;\n this.#compositionJustEnded = true;\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#compositionEndTimer = setTimeout(() => {\n this.#compositionJustEnded = false;\n this.#compositionEndTimer = null;\n });\n }\n\n #onListboxMousedown(e: MouseEvent): void {\n if (e.button !== 0) return;\n this.#listboxPointerDown = true;\n this.#suppressNextBlur = true;\n const input = this.renderRoot.querySelector<HTMLInputElement>(\"input.search-input\");\n this.#searchSelection = input ? [input.selectionStart, input.selectionEnd] : null;\n window.addEventListener(\n \"mouseup\",\n () => {\n this.#listboxPointerDown = false;\n if (this._open) {\n const searchInput =\n this.renderRoot.querySelector<HTMLInputElement>(\"input.search-input\");\n if (searchInput) {\n this.#restoringSearchFocus = true;\n searchInput.focus({ preventScroll: true });\n this.#restoringSearchFocus = false;\n const [start, end] = this.#searchSelection ?? [null, null];\n if (start !== null && end !== null) searchInput.setSelectionRange(start, end);\n }\n }\n this.#searchSelection = null;\n setTimeout(() => {\n this.#suppressNextBlur = false;\n });\n },\n { capture: true, once: true },\n );\n }\n\n #onOptionMousedown(e: MouseEvent, option: MultiSelectOption): void {\n if (e.button !== 0) return;\n const optionElement = e.currentTarget as HTMLElement;\n const listbox = optionElement.parentElement;\n if (listbox) {\n const scrollbarWidth = listbox.offsetWidth - listbox.clientWidth;\n const bounds = listbox.getBoundingClientRect();\n const isRtl = getComputedStyle(listbox).direction === \"rtl\";\n const inScrollbarGutter = isRtl\n ? e.clientX <= bounds.left + scrollbarWidth\n : e.clientX >= bounds.right - scrollbarWidth;\n if (scrollbarWidth > 0 && inScrollbarGutter) return;\n }\n e.preventDefault();\n if (this.#isOptionDisabled(option)) return;\n this.#toggleOption(option);\n if (this.variant === \"list\" && !this.searchable && !this.#isDisabled) {\n this.renderRoot\n .querySelector<HTMLElement>(\"ul.persistent\")\n ?.focus({ preventScroll: true });\n }\n }\n\n #optionIconSize(option: MultiSelectOption): number {\n const size = option.iconSize ?? 16;\n return Number.isFinite(size) && size > 0 ? size : 16;\n }\n\n #renderOptionIcon(option: MultiSelectOption) {\n if (!option.icon) return nothing;\n return html`\n <span\n class=\"option-icon\"\n style=${`--multi-select-icon-size: ${this.#optionIconSize(option)}px`}\n aria-hidden=\"true\"\n >\n ${option.icon}\n </span>\n `;\n }\n\n /** The shared `<li role=\"option\">` items for both variants' listboxes. */\n private renderOptionItems(options: MultiSelectOption[]) {\n return html`\n ${options.map((option, index) => {\n const selected = this.values.includes(option.value);\n const disabled = this.#isOptionDisabled(option);\n return html`\n <li\n id=${`${this.#listboxId}-option-${index}`}\n role=\"option\"\n aria-selected=${selected}\n aria-disabled=${disabled ? \"true\" : nothing}\n class=${index === this._activeIndex ? \"active\" : \"\"}\n @mousedown=${(e: MouseEvent) => this.#onOptionMousedown(e, option)}\n >\n <span class=\"check ${selected ? \"\" : \"hidden\"}\" aria-hidden=\"true\">\n ${iconCheckCircle(14)}\n </span>\n <span class=\"option-content\">\n ${this.#renderOptionIcon(option)}\n <span class=\"option-label\">${option.label}</span>\n </span>\n </li>\n `;\n })}\n ${options.length === 0\n ? html`<li class=\"no-options\" role=\"presentation\">\n <span role=\"status\">No options found</span>\n </li>`\n : nothing}\n `;\n }\n\n private renderListbox() {\n if (!this._open) return nothing;\n const options = this.#visibleOptions();\n return html`\n <ul\n id=${this.#listboxId}\n class=\"options\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n aria-label=${this.label ? `${this.label} options` : \"Options\"}\n @mousedown=${(e: MouseEvent) => this.#onListboxMousedown(e)}\n >\n ${this.renderOptionItems(options)}\n </ul>\n `;\n }\n\n private renderChips() {\n if (!this.showChips || this.values.length === 0) return nothing;\n return html`\n <div class=\"chips\">\n ${this.values.map((value) => {\n const label = this.#labelFor(value);\n return html`\n <span class=\"chip\">\n <span class=\"chip-label\">${label}</span>\n <button\n type=\"button\"\n class=\"chip-remove\"\n aria-label=${`Remove ${label}`}\n ?disabled=${this.#isDisabled}\n @click=${() => this.#removeValue(value)}\n >\n ${iconX(18)}\n </button>\n </span>\n `;\n })}\n </div>\n `;\n }\n\n private renderSearchTrigger() {\n const activeDescendant =\n this._open && this._activeIndex >= 0\n ? `${this.#listboxId}-option-${this._activeIndex}`\n : nothing;\n return html`\n <div\n class=\"search-trigger ${this.#isDisabled ? \"disabled\" : \"\"}\"\n @mousedown=${(e: MouseEvent) => this.#focusSearchInput(e)}\n >\n <input\n type=\"text\"\n class=\"search-input\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n aria-expanded=${this._open}\n aria-controls=${this.#listboxId}\n aria-activedescendant=${activeDescendant}\n aria-label=${this.label || \"Select options\"}\n placeholder=${this.#summaryText()}\n autocomplete=\"off\"\n ?disabled=${this.#isDisabled}\n .value=${this._query ?? \"\"}\n @mousedown=${(e: MouseEvent) => this.#onSearchMousedown(e)}\n @focus=${(e: FocusEvent) => this.#onSearchFocus(e)}\n @click=${() => this.#onSearchClick()}\n @input=${(e: InputEvent) => this.#onSearchInput(e)}\n @compositionstart=${() => this.#onCompositionStart()}\n @compositionend=${() => this.#onCompositionEnd()}\n @keydown=${(e: KeyboardEvent) => this.#onSearchKeydown(e)}\n @blur=${() => this.#onSearchBlur()}\n />\n <span class=\"chevron\">${iconChevronRight(14)}</span>\n </div>\n `;\n }\n\n private renderButtonTrigger() {\n const activeDescendant =\n this._open && this._activeIndex >= 0\n ? `${this.#listboxId}-option-${this._activeIndex}`\n : nothing;\n const empty = this.values.length === 0;\n return html`\n <button\n type=\"button\"\n class=\"trigger\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded=${this._open}\n aria-controls=${this.#listboxId}\n aria-activedescendant=${activeDescendant}\n aria-label=${this.label || nothing}\n ?disabled=${this.#isDisabled}\n @click=${() => this.#toggle()}\n @keydown=${(e: KeyboardEvent) => this.#onTriggerKeydown(e)}\n >\n <span class=\"trigger-label ${empty ? \"placeholder\" : \"\"}\">${this.#summaryText()}</span>\n <span class=\"chevron\">${iconChevronRight(14)}</span>\n </button>\n `;\n }\n\n private renderListSearch() {\n const activeDescendant =\n this._activeIndex >= 0 ? `${this.#listboxId}-option-${this._activeIndex}` : nothing;\n return html`\n <div class=\"search-field ${this.#isDisabled ? \"disabled\" : \"\"}\">\n <input\n type=\"text\"\n class=\"search-input list-search\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n aria-expanded=\"true\"\n aria-controls=${this.#listboxId}\n aria-activedescendant=${activeDescendant}\n aria-label=${this.label || \"Select options\"}\n placeholder=${this.#summaryText()}\n autocomplete=\"off\"\n ?disabled=${this.#isDisabled}\n .value=${this._query ?? \"\"}\n @input=${(e: InputEvent) => this.#onListSearchInput(e)}\n @compositionstart=${() => this.#onCompositionStart()}\n @compositionend=${() => this.#onCompositionEnd()}\n @keydown=${(e: KeyboardEvent) => this.#onListSearchKeydown(e)}\n />\n </div>\n `;\n }\n\n private renderPersistentList() {\n const options = this.#visibleOptions();\n const focusable = !this.searchable && !this.#isDisabled;\n const activeDescendant =\n !this.searchable && this._activeIndex >= 0 && options.length > 0\n ? `${this.#listboxId}-option-${this._activeIndex}`\n : nothing;\n return html`\n <ul\n id=${this.#listboxId}\n class=\"options persistent ${this.#isDisabled ? \"disabled\" : \"\"}\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n aria-label=${this.label ? `${this.label} options` : \"Options\"}\n aria-disabled=${this.#isDisabled ? \"true\" : nothing}\n tabindex=${focusable ? \"0\" : nothing}\n aria-activedescendant=${activeDescendant}\n style=${`height: calc(${this.#rows} * 2rem + 0.5rem + 2px)`}\n @mousedown=${(e: MouseEvent) => this.#onListboxMousedown(e)}\n @focus=${() => this.#onListFocus()}\n @keydown=${(e: KeyboardEvent) => this.#onListKeydown(e)}\n >\n ${this.renderOptionItems(options)}\n </ul>\n `;\n }\n\n private renderListVariant() {\n return html`\n <div class=\"control list-control\">\n ${this.searchable ? this.renderListSearch() : nothing}\n ${this.renderPersistentList()}\n </div>\n ${this.renderChips()}\n <span class=\"sr-only\" aria-live=\"polite\">${this.#liveText()}</span>\n `;\n }\n\n override render() {\n if (this.variant === \"list\") return this.renderListVariant();\n return html`\n <div class=\"control\" @focusout=${(e: FocusEvent) => this.#onFocusOut(e)}>\n ${this.searchable ? this.renderSearchTrigger() : this.renderButtonTrigger()}\n ${this.renderListbox()}\n </div>\n ${this.renderChips()}\n <span class=\"sr-only\" aria-live=\"polite\">${this.#liveText()}</span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"multi-select\": MultiSelect;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price-history-chart.d.ts","sourceRoot":"","sources":["../src/price-history-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"price-history-chart.d.ts","sourceRoot":"","sources":["../src/price-history-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AAQjD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAsBD;;;;;;;;;;GAUG;AACH,qBACa,iBAAkB,SAAQ,UAAU;IACpB,OAAO,EAAE,UAAU,EAAE,CAAM;IACjB,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAU;IAC5B,UAAU,SAAK;IAE7D,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,WAAW,CAAuB;IAEnD,OAAO,CAAC,GAAG,CAA+B;IAEjC,iBAAiB,SAOzB;IAEQ,oBAAoB,SAI5B;IAED,OAAO,KAAK,WAAW,GAItB;IAED,OAAO,KAAK,KAAK,GAEhB;IAED,OAAgB,MAAM,4BAiDpB;IAEF,OAAO,CAAC,aAAa;IA8CZ,MAAM,yCAoFd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,qBAAqB,EAAE,iBAAiB,CAAC;KAC1C;CACF"}
|
|
@@ -10,6 +10,11 @@ import { scaleTime, scaleLinear } from "d3-scale";
|
|
|
10
10
|
import { line, area } from "d3-shape";
|
|
11
11
|
import { min, max } from "d3-array";
|
|
12
12
|
import { tokens } from "./tokens.js";
|
|
13
|
+
import { parseIsoDate } from "./utils/calendar.js";
|
|
14
|
+
/** Reads a date-only `"YYYY-MM-DD"` as local midnight (not UTC); any other string goes through `Date`. */
|
|
15
|
+
function toDate(date) {
|
|
16
|
+
return parseIsoDate(date) ?? new Date(date);
|
|
17
|
+
}
|
|
13
18
|
function fmtMoney(n) {
|
|
14
19
|
return `$${n.toLocaleString("en-US")}`;
|
|
15
20
|
}
|
|
@@ -58,7 +63,7 @@ let PriceHistoryChart = class PriceHistoryChart extends LitElement {
|
|
|
58
63
|
get validPoints() {
|
|
59
64
|
return this.history
|
|
60
65
|
.filter((h) => h.price != null && h.date != null)
|
|
61
|
-
.sort((a, b) =>
|
|
66
|
+
.sort((a, b) => toDate(a.date).getTime() - toDate(b.date).getTime());
|
|
62
67
|
}
|
|
63
68
|
get showY() {
|
|
64
69
|
return this.yLabels === "always" || (this.yLabels === "auto" && this._width >= 260);
|
|
@@ -128,7 +133,7 @@ let PriceHistoryChart = class PriceHistoryChart extends LitElement {
|
|
|
128
133
|
const plotH = Math.max(H - MT - MB, 1);
|
|
129
134
|
const bottomY = MT + plotH;
|
|
130
135
|
const prices = points.map((p) => p.price);
|
|
131
|
-
const dates = points.map((p) =>
|
|
136
|
+
const dates = points.map((p) => toDate(p.date));
|
|
132
137
|
const minPrice = min(prices);
|
|
133
138
|
const maxPrice = max(prices);
|
|
134
139
|
const pad = (maxPrice - minPrice) * 0.05 || maxPrice * 0.05;
|
|
@@ -139,15 +144,15 @@ let PriceHistoryChart = class PriceHistoryChart extends LitElement {
|
|
|
139
144
|
.domain([minPrice - pad, maxPrice + pad])
|
|
140
145
|
.range([bottomY, MT]);
|
|
141
146
|
const lineFn = line()
|
|
142
|
-
.x((p) => xScale(
|
|
147
|
+
.x((p) => xScale(toDate(p.date)))
|
|
143
148
|
.y((p) => yScale(p.price));
|
|
144
149
|
const areaFn = area()
|
|
145
|
-
.x((p) => xScale(
|
|
150
|
+
.x((p) => xScale(toDate(p.date)))
|
|
146
151
|
.y0(bottomY)
|
|
147
152
|
.y1((p) => yScale(p.price));
|
|
148
153
|
const plotted = points.map((p) => ({
|
|
149
154
|
...p,
|
|
150
|
-
x: xScale(
|
|
155
|
+
x: xScale(toDate(p.date)),
|
|
151
156
|
y: yScale(p.price),
|
|
152
157
|
}));
|
|
153
158
|
return { points, plotted, H, MT, ML, MR, plotW, plotH, bottomY, minPrice, maxPrice, xScale, yScale, lineFn, areaFn };
|
|
@@ -162,7 +167,7 @@ let PriceHistoryChart = class PriceHistoryChart extends LitElement {
|
|
|
162
167
|
const hIdx = this._hoveredIdx;
|
|
163
168
|
const hovPt = hIdx !== null ? plotted[hIdx] : null;
|
|
164
169
|
const tooltipEl = hovPt ? (() => {
|
|
165
|
-
const tipText = `${fmtMoney(hovPt.price)} · ${hovPt.date ?
|
|
170
|
+
const tipText = `${fmtMoney(hovPt.price)} · ${hovPt.date ? toDate(hovPt.date).toLocaleDateString("en-US", { month: "short", year: "numeric" }) : ""} · ${hovPt.eventType}`;
|
|
166
171
|
const tipW = Math.min(tipText.length * 6.5 + 16, this._width - ML - MR);
|
|
167
172
|
const tipH = 24;
|
|
168
173
|
const tipGap = 8;
|
|
@@ -200,7 +205,7 @@ let PriceHistoryChart = class PriceHistoryChart extends LitElement {
|
|
|
200
205
|
}) : [];
|
|
201
206
|
const firstPoint = points[0];
|
|
202
207
|
const lastPoint = points[points.length - 1];
|
|
203
|
-
const formatDate = (date) =>
|
|
208
|
+
const formatDate = (date) => toDate(date).toLocaleDateString("en-US", { month: "short", year: "numeric" });
|
|
204
209
|
const summary = `${points.length} price points from ${formatDate(firstPoint.date)} at ${fmtMoney(firstPoint.price)} ` +
|
|
205
210
|
`to ${formatDate(lastPoint.date)} at ${fmtMoney(lastPoint.price)}.`;
|
|
206
211
|
return html `
|