@epilot/spark-ui 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion.cjs +3 -6
- package/dist/components/accordion.cjs.map +1 -1
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +3 -6
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.cjs +2 -5
- package/dist/components/alert-dialog.cjs.map +1 -1
- package/dist/components/alert-dialog.js +2 -5
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/bar-chart.cjs +1 -1
- package/dist/components/bar-chart.js +2 -2
- package/dist/components/battery-progress-row.cjs +14 -11
- package/dist/components/battery-progress-row.cjs.map +1 -1
- package/dist/components/battery-progress-row.d.cts +2 -10
- package/dist/components/battery-progress-row.d.ts +2 -10
- package/dist/components/battery-progress-row.js +14 -11
- package/dist/components/battery-progress-row.js.map +1 -1
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/button.cjs +6 -6
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +3 -3
- package/dist/components/button.d.ts +3 -3
- package/dist/components/button.js +6 -6
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.cjs +4 -5
- package/dist/components/calendar.cjs.map +1 -1
- package/dist/components/calendar.js +4 -5
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/callout.cjs +18 -14
- package/dist/components/callout.cjs.map +1 -1
- package/dist/components/callout.d.cts +10 -4
- package/dist/components/callout.d.ts +10 -4
- package/dist/components/callout.js +18 -15
- package/dist/components/callout.js.map +1 -1
- package/dist/components/device-card.cjs +2 -6
- package/dist/components/device-card.cjs.map +1 -1
- package/dist/components/device-card.d.cts +3 -3
- package/dist/components/device-card.d.ts +3 -3
- package/dist/components/device-card.js +2 -6
- package/dist/components/device-card.js.map +1 -1
- package/dist/components/dialog.cjs +2 -5
- package/dist/components/dialog.cjs.map +1 -1
- package/dist/components/dialog.js +2 -5
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +4 -13
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/dropdown-menu.js +4 -13
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty-state.cjs +5 -5
- package/dist/components/empty-state.cjs.map +1 -1
- package/dist/components/empty-state.d.cts +3 -3
- package/dist/components/empty-state.d.ts +3 -3
- package/dist/components/empty-state.js +5 -5
- package/dist/components/empty-state.js.map +1 -1
- package/dist/components/icon.cjs +2 -3
- package/dist/components/icon.cjs.map +1 -1
- package/dist/components/icon.d.cts +0 -3
- package/dist/components/icon.d.ts +0 -3
- package/dist/components/icon.js +2 -3
- package/dist/components/icon.js.map +1 -1
- package/dist/components/info-block.d.cts +1 -1
- package/dist/components/info-block.d.ts +1 -1
- package/dist/components/input-otp.cjs +1 -1
- package/dist/components/input-otp.js +1 -1
- package/dist/components/input.cjs +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/line-chart.cjs +3 -3
- package/dist/components/line-chart.js +4 -4
- package/dist/components/list.cjs.map +1 -1
- package/dist/components/list.js.map +1 -1
- package/dist/components/marker.d.cts +1 -1
- package/dist/components/marker.d.ts +1 -1
- package/dist/components/message-scroller.cjs +3 -3
- package/dist/components/message-scroller.cjs.map +1 -1
- package/dist/components/message-scroller.js +3 -3
- package/dist/components/message-scroller.js.map +1 -1
- package/dist/components/metering-row.cjs +3 -3
- package/dist/components/metering-row.cjs.map +1 -1
- package/dist/components/metering-row.d.cts +3 -3
- package/dist/components/metering-row.d.ts +3 -3
- package/dist/components/metering-row.js +3 -3
- package/dist/components/metering-row.js.map +1 -1
- package/dist/components/money-saved-block.cjs +2 -5
- package/dist/components/money-saved-block.cjs.map +1 -1
- package/dist/components/money-saved-block.js +2 -5
- package/dist/components/money-saved-block.js.map +1 -1
- package/dist/components/on-off-button.cjs +2 -5
- package/dist/components/on-off-button.cjs.map +1 -1
- package/dist/components/on-off-button.js +2 -5
- package/dist/components/on-off-button.js.map +1 -1
- package/dist/components/page-header.cjs +2 -2
- package/dist/components/page-header.cjs.map +1 -1
- package/dist/components/page-header.d.cts +1 -1
- package/dist/components/page-header.d.ts +1 -1
- package/dist/components/page-header.js +2 -2
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/period-tabs.cjs +3 -6
- package/dist/components/period-tabs.cjs.map +1 -1
- package/dist/components/period-tabs.js +3 -6
- package/dist/components/period-tabs.js.map +1 -1
- package/dist/components/pill.cjs +2 -5
- package/dist/components/pill.cjs.map +1 -1
- package/dist/components/pill.js +2 -5
- package/dist/components/pill.js.map +1 -1
- package/dist/components/power-history-chart.cjs +3 -3
- package/dist/components/power-history-chart.js +4 -4
- package/dist/components/power-history.cjs +1 -1
- package/dist/components/power-history.js +1 -1
- package/dist/components/power-network.cjs +2 -5
- package/dist/components/power-network.cjs.map +1 -1
- package/dist/components/power-network.js +2 -5
- package/dist/components/power-network.js.map +1 -1
- package/dist/components/sankey-chart.cjs +56 -71
- package/dist/components/sankey-chart.cjs.map +1 -1
- package/dist/components/sankey-chart.js +56 -71
- package/dist/components/sankey-chart.js.map +1 -1
- package/dist/components/schedule-list.cjs +3 -9
- package/dist/components/schedule-list.cjs.map +1 -1
- package/dist/components/schedule-list.js +3 -9
- package/dist/components/schedule-list.js.map +1 -1
- package/dist/components/select.cjs +6 -18
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.js +6 -18
- package/dist/components/select.js.map +1 -1
- package/dist/components/sheet.cjs +2 -5
- package/dist/components/sheet.cjs.map +1 -1
- package/dist/components/sheet.js +2 -5
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/slider.cjs +9 -3
- package/dist/components/slider.cjs.map +1 -1
- package/dist/components/slider.js +9 -3
- package/dist/components/slider.js.map +1 -1
- package/dist/components/smart-toggle-button.cjs +2 -5
- package/dist/components/smart-toggle-button.cjs.map +1 -1
- package/dist/components/smart-toggle-button.js +2 -5
- package/dist/components/smart-toggle-button.js.map +1 -1
- package/dist/components/solar-forecast-chart.cjs +8 -9
- package/dist/components/solar-forecast-chart.cjs.map +1 -1
- package/dist/components/solar-forecast-chart.d.cts +2 -2
- package/dist/components/solar-forecast-chart.d.ts +2 -2
- package/dist/components/solar-forecast-chart.js +9 -10
- package/dist/components/solar-forecast-chart.js.map +1 -1
- package/dist/components/stepper.cjs +3 -9
- package/dist/components/stepper.cjs.map +1 -1
- package/dist/components/stepper.js +3 -9
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/tabs.cjs +2 -2
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.js +2 -2
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.cjs +1 -1
- package/dist/components/textarea.js +1 -1
- package/dist/components/toast.cjs +9 -12
- package/dist/components/toast.cjs.map +1 -1
- package/dist/components/toast.js +9 -12
- package/dist/components/toast.js.map +1 -1
- package/dist/components/tooltip.cjs +2 -5
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/tooltip.js +2 -5
- package/dist/components/tooltip.js.map +1 -1
- package/dist/styles/index.css +0 -2
- package/package.json +3 -10
- package/dist/icons/index.cjs +0 -7
- package/dist/icons/index.d.cts +0 -4
- package/dist/icons/index.d.ts +0 -4
- package/dist/icons/index.js +0 -3
- package/dist/icons/material-symbol.cjs +0 -106
- package/dist/icons/material-symbol.cjs.map +0 -1
- package/dist/icons/material-symbol.d.cts +0 -21
- package/dist/icons/material-symbol.d.ts +0 -21
- package/dist/icons/material-symbol.js +0 -102
- package/dist/icons/material-symbol.js.map +0 -1
- package/dist/styles/material-symbol.css +0 -25
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
4
|
-
const require_icons_material_symbol = require("../icons/material-symbol.cjs");
|
|
5
|
-
let _base_ui_react_accordion = require("@base-ui/react/accordion");
|
|
6
4
|
let react = require("react");
|
|
7
5
|
react = require_chunk.__toESM(react);
|
|
6
|
+
let _base_ui_react_accordion = require("@base-ui/react/accordion");
|
|
7
|
+
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let cnfast = require("cnfast");
|
|
10
10
|
//#region src/components/accordion.tsx
|
|
@@ -30,10 +30,7 @@ function AccordionTrigger({ className, children, ...props }) {
|
|
|
30
30
|
"data-slot": "accordion-trigger",
|
|
31
31
|
className: (0, cnfast.cn)("flex min-h-[2.75rem] flex-1 cursor-pointer items-center justify-between gap-4 py-3 text-left font-medium text-gray-12", "rounded-[inherit] focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden", "disabled:pointer-events-none disabled:opacity-50", "group-data-[variant=outline]/accordion:px-4 group-data-[variant=soft]/accordion:px-4 group-data-[variant=surface]/accordion:px-4", "[&[data-panel-open]>:last-child]:rotate-180", className),
|
|
32
32
|
...props,
|
|
33
|
-
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
34
|
-
className: "shrink-0 text-gray-11 transition-transform duration-200 motion-reduce:transition-none",
|
|
35
|
-
name: "expand_more"
|
|
36
|
-
})]
|
|
33
|
+
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_epilot_spark_icons.KeyboardArrowDown, { className: "shrink-0 text-gray-11 transition-transform duration-200 motion-reduce:transition-none" })]
|
|
37
34
|
})
|
|
38
35
|
});
|
|
39
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.cjs","names":["AccordionPrimitive","
|
|
1
|
+
{"version":3,"file":"accordion.cjs","names":["AccordionPrimitive","KeyboardArrowDown"],"sources":["../../src/components/accordion.tsx"],"sourcesContent":["import { Accordion as AccordionPrimitive } from '@base-ui/react/accordion'\nimport { KeyboardArrowDown } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\n\ntype AccordionVariant = 'ghost' | 'soft' | 'surface' | 'outline'\n\ntype AccordionProps = React.ComponentProps<typeof AccordionPrimitive.Root> & {\n /**\n * Container chrome (neutral):\n * - `ghost` — no border/fill, just the trigger + spacing;\n * - `soft` (default) — separate soft-tinted rounded cards, 2px gap between them;\n * - `surface` — items glued into one bordered panel with an opaque fill;\n * - `outline` — the same glued bordered panel, but no fill (transparent).\n * A `variant` prop, NOT the ambient `data-style` knob — that would cascade into\n * the panel content. Spacing + scaling still come from the ambient knobs.\n */\n variant?: AccordionVariant\n}\n\nfunction Accordion({ className, variant = 'soft', ...props }: AccordionProps) {\n return (\n <AccordionPrimitive.Root\n data-slot=\"accordion\"\n // group/accordion + data-variant drive every item/trigger's per-variant\n // chrome; soft stacks its separate cards with a gap (below).\n data-variant={variant}\n className={cn(\n 'group/accordion',\n // soft = separate cards → stack them with a small (2px) gap. surface/outline\n // glue their items into one bordered panel (default block, no gap).\n 'data-[variant=soft]:flex data-[variant=soft]:flex-col data-[variant=soft]:gap-[calc(var(--spark-layout-gap)*0.5)]',\n className,\n )}\n {...props}\n />\n )\n}\n\ntype AccordionItemProps = React.ComponentProps<typeof AccordionPrimitive.Item>\n\nfunction AccordionItem({ className, ...props }: AccordionItemProps) {\n return (\n <AccordionPrimitive.Item\n data-slot=\"accordion-item\"\n className={cn(\n // NEUTRAL container chrome per the accordion variant (group/accordion) — mirrors\n // ListItem's group-data-[variant=X]/list: block (list.tsx); keep both in sync if\n // this pattern changes. ghost carries no chrome. Radius = rounded-lg (tracks the\n // radius knob but never goes fully round). No text underline / per-item separator\n // anymore.\n\n // soft (default): each item is its own borderless soft-tinted rounded card;\n // the root separates them with a 2px gap (the gap IS the separator).\n 'group-data-[variant=soft]/accordion:rounded-lg group-data-[variant=soft]/accordion:bg-gray-a2 dark:group-data-[variant=soft]/accordion:bg-gray-a3',\n // surface + outline share ONE glued-panel frame: full thin border around the\n // stack (sides on all, top on each as divider/frame, bottom on the last),\n // first/last round the outer corners. surface fills it (opaque bg); outline\n // leaves it transparent.\n 'group-data-[variant=surface]/accordion:bg-gray-2',\n 'group-data-[variant=surface]/accordion:border-x group-data-[variant=surface]/accordion:border-t group-data-[variant=surface]/accordion:border-gray-a6 group-data-[variant=surface]/accordion:first:rounded-t-lg group-data-[variant=surface]/accordion:last:rounded-b-lg group-data-[variant=surface]/accordion:last:border-b',\n 'group-data-[variant=outline]/accordion:border-x group-data-[variant=outline]/accordion:border-t group-data-[variant=outline]/accordion:border-gray-a6 group-data-[variant=outline]/accordion:first:rounded-t-lg group-data-[variant=outline]/accordion:last:rounded-b-lg group-data-[variant=outline]/accordion:last:border-b',\n className,\n )}\n {...props}\n />\n )\n}\n\ntype AccordionTriggerProps = React.ComponentProps<\n typeof AccordionPrimitive.Trigger\n>\n\nfunction AccordionTrigger({\n className,\n children,\n ...props\n}: AccordionTriggerProps) {\n return (\n <AccordionPrimitive.Header className=\"flex rounded-[inherit]\">\n <AccordionPrimitive.Trigger\n data-slot=\"accordion-trigger\"\n className={cn(\n // WCAG 2.5.5: min 44px touch target — a HARD floor (min-h-[2.75rem], not\n // min-h-11, which scales below 44px under dense/scaled knobs). py/text still\n // scale with the spacing + scaling knobs, growing the target past 44px.\n // No text underline (was hover:underline).\n 'flex min-h-[2.75rem] flex-1 cursor-pointer items-center justify-between gap-4 py-3 text-left font-medium text-gray-12',\n // focus ring: rounded-[inherit] (relayed through Header, above) so it matches\n // the item's own corner — sits flush against it with zero inset, same idiom as\n // ListItem's full-bleed row (list.tsx).\n 'rounded-[inherit] focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden',\n 'disabled:pointer-events-none disabled:opacity-50',\n // horizontal padding sits INSIDE the chrome (soft/surface/outline); ghost\n // keeps the label flush (\"just plain text and spacing\").\n 'group-data-[variant=outline]/accordion:px-4 group-data-[variant=soft]/accordion:px-4 group-data-[variant=surface]/accordion:px-4',\n // chevron (last child) flips when open\n '[&[data-panel-open]>:last-child]:rotate-180',\n className,\n )}\n {...props}\n >\n {children}\n <KeyboardArrowDown className=\"shrink-0 text-gray-11 transition-transform duration-200 motion-reduce:transition-none\" />\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n )\n}\n\ntype AccordionContentProps = React.ComponentProps<\n typeof AccordionPrimitive.Panel\n>\n\nfunction AccordionContent({\n className,\n children,\n ...props\n}: AccordionContentProps) {\n return (\n <AccordionPrimitive.Panel\n data-slot=\"accordion-content\"\n // Base UI sets --accordion-panel-height + starting/ending styles on the\n // panel; the height transition replaces the radix keyframe animation.\n className=\"h-(--accordion-panel-height) overflow-hidden text-sm text-gray-11 transition-[height] duration-200 ease-out data-ending-style:h-0 data-starting-style:h-0 motion-reduce:transition-none\"\n {...props}\n >\n {/* padding aligns with the trigger: flush for ghost, inside the chrome otherwise */}\n <div\n className={cn(\n 'pb-4 group-data-[variant=outline]/accordion:px-4 group-data-[variant=soft]/accordion:px-4 group-data-[variant=surface]/accordion:px-4',\n className,\n )}\n >\n {children}\n </div>\n </AccordionPrimitive.Panel>\n )\n}\n\nexport { Accordion, AccordionContent, AccordionItem, AccordionTrigger }\nexport type { AccordionProps, AccordionVariant }\n"],"mappings":";;;;;;;;;;AAoBA,SAAS,UAAU,EAAE,WAAW,UAAU,QAAQ,GAAG,SAAyB;CAC5E,OACE,iBAAA,GAAA,kBAAA,KAACA,yBAAAA,UAAmB,MAApB;EACE,aAAU;EAGV,gBAAc;EACd,YAAA,GAAA,OAAA,IACE,mBAGA,qHACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAIA,SAAS,cAAc,EAAE,WAAW,GAAG,SAA6B;CAClE,OACE,iBAAA,GAAA,kBAAA,KAACA,yBAAAA,UAAmB,MAApB;EACE,aAAU;EACV,YAAA,GAAA,OAAA,IASE,qJAKA,oDACA,iUACA,iUACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAMA,SAAS,iBAAiB,EACxB,WACA,UACA,GAAG,SACqB;CACxB,OACE,iBAAA,GAAA,kBAAA,KAACA,yBAAAA,UAAmB,QAApB;EAA2B,WAAU;YACnC,iBAAA,GAAA,kBAAA,MAACA,yBAAAA,UAAmB,SAApB;GACE,aAAU;GACV,YAAA,GAAA,OAAA,IAKE,yHAIA,mGACA,oDAGA,oIAEA,+CACA,SACF;GACA,GAAI;aApBN,CAsBG,UACD,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,mBAAD,EAAmB,WAAU,wFAAyF,CAAA,CAC5F;;CACH,CAAA;AAE/B;AAMA,SAAS,iBAAiB,EACxB,WACA,UACA,GAAG,SACqB;CACxB,OACE,iBAAA,GAAA,kBAAA,KAACD,yBAAAA,UAAmB,OAApB;EACE,aAAU;EAGV,WAAU;EACV,GAAI;YAGJ,iBAAA,GAAA,kBAAA,KAAC,OAAD;GACE,YAAA,GAAA,OAAA,IACE,yIACA,SACF;GAEC;EACE,CAAA;CACmB,CAAA;AAE9B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
4
3
|
import * as React$1 from "react";
|
|
4
|
+
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
5
5
|
|
|
6
6
|
//#region src/components/accordion.d.ts
|
|
7
7
|
type AccordionVariant = 'ghost' | 'soft' | 'surface' | 'outline';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
|
-
import { MaterialSymbol } from "../icons/material-symbol.js";
|
|
4
|
-
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
5
3
|
import "react";
|
|
4
|
+
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
5
|
+
import { KeyboardArrowDown } from "@epilot/spark-icons";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/accordion.tsx
|
|
8
8
|
function Accordion({ className, variant = "soft", ...props }) {
|
|
@@ -27,10 +27,7 @@ function AccordionTrigger({ className, children, ...props }) {
|
|
|
27
27
|
"data-slot": "accordion-trigger",
|
|
28
28
|
className: cn("flex min-h-[2.75rem] flex-1 cursor-pointer items-center justify-between gap-4 py-3 text-left font-medium text-gray-12", "rounded-[inherit] focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden", "disabled:pointer-events-none disabled:opacity-50", "group-data-[variant=outline]/accordion:px-4 group-data-[variant=soft]/accordion:px-4 group-data-[variant=surface]/accordion:px-4", "[&[data-panel-open]>:last-child]:rotate-180", className),
|
|
29
29
|
...props,
|
|
30
|
-
children: [children, /* @__PURE__ */ jsx(
|
|
31
|
-
className: "shrink-0 text-gray-11 transition-transform duration-200 motion-reduce:transition-none",
|
|
32
|
-
name: "expand_more"
|
|
33
|
-
})]
|
|
30
|
+
children: [children, /* @__PURE__ */ jsx(KeyboardArrowDown, { className: "shrink-0 text-gray-11 transition-transform duration-200 motion-reduce:transition-none" })]
|
|
34
31
|
})
|
|
35
32
|
});
|
|
36
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.js","names":["AccordionPrimitive"],"sources":["../../src/components/accordion.tsx"],"sourcesContent":["import { Accordion as AccordionPrimitive } from '@base-ui/react/accordion'\nimport
|
|
1
|
+
{"version":3,"file":"accordion.js","names":["AccordionPrimitive"],"sources":["../../src/components/accordion.tsx"],"sourcesContent":["import { Accordion as AccordionPrimitive } from '@base-ui/react/accordion'\nimport { KeyboardArrowDown } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\n\ntype AccordionVariant = 'ghost' | 'soft' | 'surface' | 'outline'\n\ntype AccordionProps = React.ComponentProps<typeof AccordionPrimitive.Root> & {\n /**\n * Container chrome (neutral):\n * - `ghost` — no border/fill, just the trigger + spacing;\n * - `soft` (default) — separate soft-tinted rounded cards, 2px gap between them;\n * - `surface` — items glued into one bordered panel with an opaque fill;\n * - `outline` — the same glued bordered panel, but no fill (transparent).\n * A `variant` prop, NOT the ambient `data-style` knob — that would cascade into\n * the panel content. Spacing + scaling still come from the ambient knobs.\n */\n variant?: AccordionVariant\n}\n\nfunction Accordion({ className, variant = 'soft', ...props }: AccordionProps) {\n return (\n <AccordionPrimitive.Root\n data-slot=\"accordion\"\n // group/accordion + data-variant drive every item/trigger's per-variant\n // chrome; soft stacks its separate cards with a gap (below).\n data-variant={variant}\n className={cn(\n 'group/accordion',\n // soft = separate cards → stack them with a small (2px) gap. surface/outline\n // glue their items into one bordered panel (default block, no gap).\n 'data-[variant=soft]:flex data-[variant=soft]:flex-col data-[variant=soft]:gap-[calc(var(--spark-layout-gap)*0.5)]',\n className,\n )}\n {...props}\n />\n )\n}\n\ntype AccordionItemProps = React.ComponentProps<typeof AccordionPrimitive.Item>\n\nfunction AccordionItem({ className, ...props }: AccordionItemProps) {\n return (\n <AccordionPrimitive.Item\n data-slot=\"accordion-item\"\n className={cn(\n // NEUTRAL container chrome per the accordion variant (group/accordion) — mirrors\n // ListItem's group-data-[variant=X]/list: block (list.tsx); keep both in sync if\n // this pattern changes. ghost carries no chrome. Radius = rounded-lg (tracks the\n // radius knob but never goes fully round). No text underline / per-item separator\n // anymore.\n\n // soft (default): each item is its own borderless soft-tinted rounded card;\n // the root separates them with a 2px gap (the gap IS the separator).\n 'group-data-[variant=soft]/accordion:rounded-lg group-data-[variant=soft]/accordion:bg-gray-a2 dark:group-data-[variant=soft]/accordion:bg-gray-a3',\n // surface + outline share ONE glued-panel frame: full thin border around the\n // stack (sides on all, top on each as divider/frame, bottom on the last),\n // first/last round the outer corners. surface fills it (opaque bg); outline\n // leaves it transparent.\n 'group-data-[variant=surface]/accordion:bg-gray-2',\n 'group-data-[variant=surface]/accordion:border-x group-data-[variant=surface]/accordion:border-t group-data-[variant=surface]/accordion:border-gray-a6 group-data-[variant=surface]/accordion:first:rounded-t-lg group-data-[variant=surface]/accordion:last:rounded-b-lg group-data-[variant=surface]/accordion:last:border-b',\n 'group-data-[variant=outline]/accordion:border-x group-data-[variant=outline]/accordion:border-t group-data-[variant=outline]/accordion:border-gray-a6 group-data-[variant=outline]/accordion:first:rounded-t-lg group-data-[variant=outline]/accordion:last:rounded-b-lg group-data-[variant=outline]/accordion:last:border-b',\n className,\n )}\n {...props}\n />\n )\n}\n\ntype AccordionTriggerProps = React.ComponentProps<\n typeof AccordionPrimitive.Trigger\n>\n\nfunction AccordionTrigger({\n className,\n children,\n ...props\n}: AccordionTriggerProps) {\n return (\n <AccordionPrimitive.Header className=\"flex rounded-[inherit]\">\n <AccordionPrimitive.Trigger\n data-slot=\"accordion-trigger\"\n className={cn(\n // WCAG 2.5.5: min 44px touch target — a HARD floor (min-h-[2.75rem], not\n // min-h-11, which scales below 44px under dense/scaled knobs). py/text still\n // scale with the spacing + scaling knobs, growing the target past 44px.\n // No text underline (was hover:underline).\n 'flex min-h-[2.75rem] flex-1 cursor-pointer items-center justify-between gap-4 py-3 text-left font-medium text-gray-12',\n // focus ring: rounded-[inherit] (relayed through Header, above) so it matches\n // the item's own corner — sits flush against it with zero inset, same idiom as\n // ListItem's full-bleed row (list.tsx).\n 'rounded-[inherit] focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden',\n 'disabled:pointer-events-none disabled:opacity-50',\n // horizontal padding sits INSIDE the chrome (soft/surface/outline); ghost\n // keeps the label flush (\"just plain text and spacing\").\n 'group-data-[variant=outline]/accordion:px-4 group-data-[variant=soft]/accordion:px-4 group-data-[variant=surface]/accordion:px-4',\n // chevron (last child) flips when open\n '[&[data-panel-open]>:last-child]:rotate-180',\n className,\n )}\n {...props}\n >\n {children}\n <KeyboardArrowDown className=\"shrink-0 text-gray-11 transition-transform duration-200 motion-reduce:transition-none\" />\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n )\n}\n\ntype AccordionContentProps = React.ComponentProps<\n typeof AccordionPrimitive.Panel\n>\n\nfunction AccordionContent({\n className,\n children,\n ...props\n}: AccordionContentProps) {\n return (\n <AccordionPrimitive.Panel\n data-slot=\"accordion-content\"\n // Base UI sets --accordion-panel-height + starting/ending styles on the\n // panel; the height transition replaces the radix keyframe animation.\n className=\"h-(--accordion-panel-height) overflow-hidden text-sm text-gray-11 transition-[height] duration-200 ease-out data-ending-style:h-0 data-starting-style:h-0 motion-reduce:transition-none\"\n {...props}\n >\n {/* padding aligns with the trigger: flush for ghost, inside the chrome otherwise */}\n <div\n className={cn(\n 'pb-4 group-data-[variant=outline]/accordion:px-4 group-data-[variant=soft]/accordion:px-4 group-data-[variant=surface]/accordion:px-4',\n className,\n )}\n >\n {children}\n </div>\n </AccordionPrimitive.Panel>\n )\n}\n\nexport { Accordion, AccordionContent, AccordionItem, AccordionTrigger }\nexport type { AccordionProps, AccordionVariant }\n"],"mappings":";;;;;;;AAoBA,SAAS,UAAU,EAAE,WAAW,UAAU,QAAQ,GAAG,SAAyB;CAC5E,OACE,oBAACA,YAAmB,MAApB;EACE,aAAU;EAGV,gBAAc;EACd,WAAW,GACT,mBAGA,qHACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAIA,SAAS,cAAc,EAAE,WAAW,GAAG,SAA6B;CAClE,OACE,oBAACA,YAAmB,MAApB;EACE,aAAU;EACV,WAAW,GAST,qJAKA,oDACA,iUACA,iUACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAMA,SAAS,iBAAiB,EACxB,WACA,UACA,GAAG,SACqB;CACxB,OACE,oBAACA,YAAmB,QAApB;EAA2B,WAAU;YACnC,qBAACA,YAAmB,SAApB;GACE,aAAU;GACV,WAAW,GAKT,yHAIA,mGACA,oDAGA,oIAEA,+CACA,SACF;GACA,GAAI;aApBN,CAsBG,UACD,oBAAC,mBAAD,EAAmB,WAAU,wFAAyF,CAAA,CAC5F;;CACH,CAAA;AAE/B;AAMA,SAAS,iBAAiB,EACxB,WACA,UACA,GAAG,SACqB;CACxB,OACE,oBAACA,YAAmB,OAApB;EACE,aAAU;EAGV,WAAU;EACV,GAAI;YAGJ,oBAAC,OAAD;GACE,WAAW,GACT,yIACA,SACF;GAEC;EACE,CAAA;CACmB,CAAA;AAE9B"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
4
|
-
const require_icons_material_symbol = require("../icons/material-symbol.cjs");
|
|
5
4
|
const require_components_button = require("./button.cjs");
|
|
6
5
|
let react = require("react");
|
|
7
6
|
react = require_chunk.__toESM(react);
|
|
7
|
+
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let _base_ui_react_alert_dialog = require("@base-ui/react/alert-dialog");
|
|
10
10
|
let cnfast = require("cnfast");
|
|
@@ -114,10 +114,7 @@ function AlertDialogCancel({ className, size = "default", styleVariant, color, c
|
|
|
114
114
|
variant: "tertiary"
|
|
115
115
|
}), "absolute top-2.5 right-2 rounded-full", className),
|
|
116
116
|
...props,
|
|
117
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
118
|
-
className: "[--spark-icon-size:calc(20px*var(--spark-scaling,1))]",
|
|
119
|
-
name: "close"
|
|
120
|
-
})
|
|
117
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_epilot_spark_icons.Close, { className: "[--spark-icon-size:calc(20px*var(--spark-scaling,1))]" })
|
|
121
118
|
});
|
|
122
119
|
}
|
|
123
120
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog.cjs","names":["AlertDialogPrimitive","Button","buttonVariants","MaterialSymbol"],"sources":["../../src/components/alert-dialog.tsx"],"sourcesContent":["import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog'\nimport * as React from 'react'\nimport { MaterialSymbol } from '../icons/material-symbol'\nimport { cn } from '../utils/cn'\nimport { Button, type ButtonProps } from './button'\nimport { buttonVariants } from './button'\n\nfunction AlertDialog(\n props: React.ComponentProps<typeof AlertDialogPrimitive.Root>,\n) {\n return <AlertDialogPrimitive.Root {...props} />\n}\n\nfunction AlertDialogTrigger(\n props: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>,\n) {\n return (\n <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />\n )\n}\n\nfunction AlertDialogPortal(\n props: React.ComponentProps<typeof AlertDialogPrimitive.Portal>,\n) {\n return (\n <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" {...props} />\n )\n}\n\nfunction AlertDialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Backdrop>) {\n return (\n <AlertDialogPrimitive.Backdrop\n data-slot=\"alert-dialog-overlay\"\n className={cn(\n 'fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none',\n className,\n )}\n data-overlay=\"true\"\n {...props}\n />\n )\n}\n\ninterface AlertDialogContentProps extends React.ComponentProps<\n typeof AlertDialogPrimitive.Popup\n> {\n size?: 'default' | 'sm'\n}\n\nfunction AlertDialogContent({\n className,\n size = 'default',\n ...props\n}: AlertDialogContentProps) {\n return (\n <AlertDialogPrimitive.Popup\n data-slot=\"alert-dialog-content\"\n data-size={size}\n className={cn(\n 'group/alert-dialog-content fixed top-(--spark-viewport-center-y,50%) left-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-6 rounded-lg bg-gray-2 p-4 text-gray shadow-lg transition-[top,opacity,translate,scale] duration-200 data-[size=default]:max-w-lg data-[size=sm]:max-w-64 motion-reduce:transition-none data-[size=default]:sm:max-w-lg',\n // enter/exit: fade + zoom + a slight upward offset (was animate-in/out)\n 'data-starting-style:translate-y-[-52%] data-starting-style:scale-95 data-starting-style:opacity-0',\n 'data-ending-style:translate-y-[-52%] data-ending-style:scale-95 data-ending-style:opacity-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogHeader({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-dialog-header\"\n className={cn(\n 'grid grid-rows-[auto_1fr] place-items-center gap-1 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogFooter({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-dialog-footer\"\n className={cn(\n 'flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogMedia({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-dialog-media\"\n className={cn(\n 'inline-flex size-4 h-7 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {\n return (\n <AlertDialogPrimitive.Title\n data-slot=\"alert-dialog-title\"\n className={cn(\n 'text-lg font-bold text-gray sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {\n return (\n <AlertDialogPrimitive.Description\n data-slot=\"alert-dialog-description\"\n className={cn('text-sm text-balance text-gray-light', className)}\n {...props}\n />\n )\n}\n\ninterface AlertDialogActionProps\n extends\n React.ComponentProps<typeof AlertDialogPrimitive.Close>,\n Pick<ButtonProps, 'size' | 'styleVariant' | 'color'> {}\n\n// Base UI has no Action primitive; the confirm button composes Close (radix\n// Action also closed on click) — run the action in onClick. A prop-less Button\n// is the primary look (solid accent), so the confirm just forwards style/color.\nfunction AlertDialogAction({\n className,\n size = 'default',\n styleVariant,\n color,\n ...props\n}: AlertDialogActionProps) {\n return (\n <Button\n size={size}\n styleVariant={styleVariant}\n color={color}\n render={\n <AlertDialogPrimitive.Close\n data-slot=\"alert-dialog-action\"\n className={className}\n {...props}\n />\n }\n />\n )\n}\n\ninterface AlertDialogCancelProps\n extends\n React.ComponentProps<typeof AlertDialogPrimitive.Close>,\n Pick<ButtonProps, 'size' | 'styleVariant' | 'color'> {}\n\n// No children = the ready-made corner X (label is the consumer's, via aria-label);\n// with children it renders as a Button (default surface/neutral, the old secondary\n// look); with a render prop it stays the bare primitive (the consumer supplies the button)\nfunction AlertDialogCancel({\n className,\n size = 'default',\n styleVariant,\n color,\n children,\n ...props\n}: AlertDialogCancelProps) {\n if (children) {\n // Default to the surface/neutral (secondary) look unless the caller pins a\n // style/color of its own.\n const hasLook = styleVariant !== undefined || color !== undefined\n return (\n <Button\n size={size}\n styleVariant={hasLook ? styleVariant : 'surface'}\n color={hasLook ? color : 'neutral'}\n render={\n <AlertDialogPrimitive.Close\n data-slot=\"alert-dialog-cancel\"\n className={className}\n {...props}\n >\n {children}\n </AlertDialogPrimitive.Close>\n }\n />\n )\n }\n\n if (props.render) {\n return (\n <AlertDialogPrimitive.Close\n data-slot=\"alert-dialog-cancel\"\n className={className}\n {...props}\n />\n )\n }\n\n return (\n <AlertDialogPrimitive.Close\n data-slot=\"alert-dialog-cancel\"\n className={cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n 'absolute top-2.5 right-2 rounded-full',\n className,\n )}\n {...props}\n >\n <MaterialSymbol\n className=\"[--spark-icon-size:calc(20px*var(--spark-scaling,1))]\"\n name=\"close\"\n />\n </AlertDialogPrimitive.Close>\n )\n}\n\nexport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogMedia,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger,\n}\nexport type { AlertDialogContentProps }\n"],"mappings":";;;;;;;;;;;AAOA,SAAS,YACP,OACA;CACA,OAAO,iBAAA,GAAA,kBAAA,KAACA,4BAAAA,YAAqB,MAAtB,EAA2B,GAAI,MAAQ,CAAA;AAChD;AAEA,SAAS,mBACP,OACA;CACA,OACE,iBAAA,GAAA,kBAAA,KAACA,4BAAAA,YAAqB,SAAtB;EAA8B,aAAU;EAAuB,GAAI;CAAQ,CAAA;AAE/E;AAEA,SAAS,kBACP,OACA;CACA,OACE,iBAAA,GAAA,kBAAA,KAACA,4BAAAA,YAAqB,QAAtB;EAA6B,aAAU;EAAsB,GAAI;CAAQ,CAAA;AAE7E;AAEA,SAAS,mBAAmB,EAC1B,WACA,GAAG,SAC0D;CAC7D,OACE,iBAAA,GAAA,kBAAA,KAACA,4BAAAA,YAAqB,UAAtB;EACE,aAAU;EACV,YAAA,GAAA,OAAA,IACE,wOACA,SACF;EACA,gBAAa;EACb,GAAI;CACL,CAAA;AAEL;AAQA,SAAS,mBAAmB,EAC1B,WACA,OAAO,WACP,GAAG,SACuB;CAC1B,OACE,iBAAA,GAAA,kBAAA,KAACA,4BAAAA,YAAqB,OAAtB;EACE,aAAU;EACV,aAAW;EACX,YAAA,GAAA,OAAA,IACE,sWAEA,qGACA,+FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SAC2B;CAC9B,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,aAAU;EACV,YAAA,GAAA,OAAA,IACE,oZACA,SACF;EACA,GAAI;CACL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,kBAAA,KAACD,4BAAAA,YAAqB,OAAtB;IACE,aAAU;IACC;IACX,GAAI;IAEH;GACyB,CAAA;EAE/B,CAAA;CAEL;CAEA,IAAI,MAAM,QACR,OACE,iBAAA,GAAA,kBAAA,KAACA,4BAAAA,YAAqB,OAAtB;EACE,aAAU;EACC;EACX,GAAI;CACL,CAAA;CAIL,OACE,iBAAA,GAAA,kBAAA,KAACA,4BAAAA,YAAqB,OAAtB;EACE,aAAU;EACV,YAAA,GAAA,OAAA,IACEE,0BAAAA,eAAe;GAAE,MAAM;GAAQ,SAAS;EAAW,CAAC,GACpD,yCACA,SACF;EACA,GAAI;YAEJ,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,gBAAD;GACE,WAAU;GACV,MAAK;EACN,CAAA;CACyB,CAAA;AAEhC"}
|
|
1
|
+
{"version":3,"file":"alert-dialog.cjs","names":["AlertDialogPrimitive","Button","buttonVariants","Close"],"sources":["../../src/components/alert-dialog.tsx"],"sourcesContent":["import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog'\nimport { Close } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { Button, type ButtonProps } from './button'\nimport { buttonVariants } from './button'\n\nfunction AlertDialog(\n props: React.ComponentProps<typeof AlertDialogPrimitive.Root>,\n) {\n return <AlertDialogPrimitive.Root {...props} />\n}\n\nfunction AlertDialogTrigger(\n props: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>,\n) {\n return (\n <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />\n )\n}\n\nfunction AlertDialogPortal(\n props: React.ComponentProps<typeof AlertDialogPrimitive.Portal>,\n) {\n return (\n <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" {...props} />\n )\n}\n\nfunction AlertDialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Backdrop>) {\n return (\n <AlertDialogPrimitive.Backdrop\n data-slot=\"alert-dialog-overlay\"\n className={cn(\n 'fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none',\n className,\n )}\n data-overlay=\"true\"\n {...props}\n />\n )\n}\n\ninterface AlertDialogContentProps extends React.ComponentProps<\n typeof AlertDialogPrimitive.Popup\n> {\n size?: 'default' | 'sm'\n}\n\nfunction AlertDialogContent({\n className,\n size = 'default',\n ...props\n}: AlertDialogContentProps) {\n return (\n <AlertDialogPrimitive.Popup\n data-slot=\"alert-dialog-content\"\n data-size={size}\n className={cn(\n 'group/alert-dialog-content fixed top-(--spark-viewport-center-y,50%) left-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-6 rounded-lg bg-gray-2 p-4 text-gray shadow-lg transition-[top,opacity,translate,scale] duration-200 data-[size=default]:max-w-lg data-[size=sm]:max-w-64 motion-reduce:transition-none data-[size=default]:sm:max-w-lg',\n // enter/exit: fade + zoom + a slight upward offset (was animate-in/out)\n 'data-starting-style:translate-y-[-52%] data-starting-style:scale-95 data-starting-style:opacity-0',\n 'data-ending-style:translate-y-[-52%] data-ending-style:scale-95 data-ending-style:opacity-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogHeader({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-dialog-header\"\n className={cn(\n 'grid grid-rows-[auto_1fr] place-items-center gap-1 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogFooter({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-dialog-footer\"\n className={cn(\n 'flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogMedia({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-dialog-media\"\n className={cn(\n 'inline-flex size-4 h-7 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {\n return (\n <AlertDialogPrimitive.Title\n data-slot=\"alert-dialog-title\"\n className={cn(\n 'text-lg font-bold text-gray sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {\n return (\n <AlertDialogPrimitive.Description\n data-slot=\"alert-dialog-description\"\n className={cn('text-sm text-balance text-gray-light', className)}\n {...props}\n />\n )\n}\n\ninterface AlertDialogActionProps\n extends\n React.ComponentProps<typeof AlertDialogPrimitive.Close>,\n Pick<ButtonProps, 'size' | 'styleVariant' | 'color'> {}\n\n// Base UI has no Action primitive; the confirm button composes Close (radix\n// Action also closed on click) — run the action in onClick. A prop-less Button\n// is the primary look (solid accent), so the confirm just forwards style/color.\nfunction AlertDialogAction({\n className,\n size = 'default',\n styleVariant,\n color,\n ...props\n}: AlertDialogActionProps) {\n return (\n <Button\n size={size}\n styleVariant={styleVariant}\n color={color}\n render={\n <AlertDialogPrimitive.Close\n data-slot=\"alert-dialog-action\"\n className={className}\n {...props}\n />\n }\n />\n )\n}\n\ninterface AlertDialogCancelProps\n extends\n React.ComponentProps<typeof AlertDialogPrimitive.Close>,\n Pick<ButtonProps, 'size' | 'styleVariant' | 'color'> {}\n\n// No children = the ready-made corner X (label is the consumer's, via aria-label);\n// with children it renders as a Button (default surface/neutral, the old secondary\n// look); with a render prop it stays the bare primitive (the consumer supplies the button)\nfunction AlertDialogCancel({\n className,\n size = 'default',\n styleVariant,\n color,\n children,\n ...props\n}: AlertDialogCancelProps) {\n if (children) {\n // Default to the surface/neutral (secondary) look unless the caller pins a\n // style/color of its own.\n const hasLook = styleVariant !== undefined || color !== undefined\n return (\n <Button\n size={size}\n styleVariant={hasLook ? styleVariant : 'surface'}\n color={hasLook ? color : 'neutral'}\n render={\n <AlertDialogPrimitive.Close\n data-slot=\"alert-dialog-cancel\"\n className={className}\n {...props}\n >\n {children}\n </AlertDialogPrimitive.Close>\n }\n />\n )\n }\n\n if (props.render) {\n return (\n <AlertDialogPrimitive.Close\n data-slot=\"alert-dialog-cancel\"\n className={className}\n {...props}\n />\n )\n }\n\n return (\n <AlertDialogPrimitive.Close\n data-slot=\"alert-dialog-cancel\"\n className={cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n 'absolute top-2.5 right-2 rounded-full',\n className,\n )}\n {...props}\n >\n <Close className=\"[--spark-icon-size:calc(20px*var(--spark-scaling,1))]\" />\n </AlertDialogPrimitive.Close>\n )\n}\n\nexport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogMedia,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger,\n}\nexport type { AlertDialogContentProps }\n"],"mappings":";;;;;;;;;;;AAOA,SAAS,YACP,OACA;CACA,OAAO,iBAAA,GAAA,kBAAA,KAACA,4BAAAA,YAAqB,MAAtB,EAA2B,GAAI,MAAQ,CAAA;AAChD;AAEA,SAAS,mBACP,OACA;CACA,OACE,iBAAA,GAAA,kBAAA,KAACA,4BAAAA,YAAqB,SAAtB;EAA8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
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
|
-
import { MaterialSymbol } from "../icons/material-symbol.js";
|
|
4
3
|
import { Button, buttonVariants } from "./button.js";
|
|
5
4
|
import "react";
|
|
5
|
+
import { Close } from "@epilot/spark-icons";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { AlertDialog as AlertDialog$1 } from "@base-ui/react/alert-dialog";
|
|
8
8
|
//#region src/components/alert-dialog.tsx
|
|
@@ -111,10 +111,7 @@ function AlertDialogCancel({ className, size = "default", styleVariant, color, c
|
|
|
111
111
|
variant: "tertiary"
|
|
112
112
|
}), "absolute top-2.5 right-2 rounded-full", className),
|
|
113
113
|
...props,
|
|
114
|
-
children: /* @__PURE__ */ jsx(
|
|
115
|
-
className: "[--spark-icon-size:calc(20px*var(--spark-scaling,1))]",
|
|
116
|
-
name: "close"
|
|
117
|
-
})
|
|
114
|
+
children: /* @__PURE__ */ jsx(Close, { className: "[--spark-icon-size:calc(20px*var(--spark-scaling,1))]" })
|
|
118
115
|
});
|
|
119
116
|
}
|
|
120
117
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog.js","names":["AlertDialogPrimitive"],"sources":["../../src/components/alert-dialog.tsx"],"sourcesContent":["import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog'\nimport
|
|
1
|
+
{"version":3,"file":"alert-dialog.js","names":["AlertDialogPrimitive"],"sources":["../../src/components/alert-dialog.tsx"],"sourcesContent":["import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog'\nimport { Close } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { Button, type ButtonProps } from './button'\nimport { buttonVariants } from './button'\n\nfunction AlertDialog(\n props: React.ComponentProps<typeof AlertDialogPrimitive.Root>,\n) {\n return <AlertDialogPrimitive.Root {...props} />\n}\n\nfunction AlertDialogTrigger(\n props: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>,\n) {\n return (\n <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />\n )\n}\n\nfunction AlertDialogPortal(\n props: React.ComponentProps<typeof AlertDialogPrimitive.Portal>,\n) {\n return (\n <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" {...props} />\n )\n}\n\nfunction AlertDialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Backdrop>) {\n return (\n <AlertDialogPrimitive.Backdrop\n data-slot=\"alert-dialog-overlay\"\n className={cn(\n 'fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none',\n className,\n )}\n data-overlay=\"true\"\n {...props}\n />\n )\n}\n\ninterface AlertDialogContentProps extends React.ComponentProps<\n typeof AlertDialogPrimitive.Popup\n> {\n size?: 'default' | 'sm'\n}\n\nfunction AlertDialogContent({\n className,\n size = 'default',\n ...props\n}: AlertDialogContentProps) {\n return (\n <AlertDialogPrimitive.Popup\n data-slot=\"alert-dialog-content\"\n data-size={size}\n className={cn(\n 'group/alert-dialog-content fixed top-(--spark-viewport-center-y,50%) left-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-6 rounded-lg bg-gray-2 p-4 text-gray shadow-lg transition-[top,opacity,translate,scale] duration-200 data-[size=default]:max-w-lg data-[size=sm]:max-w-64 motion-reduce:transition-none data-[size=default]:sm:max-w-lg',\n // enter/exit: fade + zoom + a slight upward offset (was animate-in/out)\n 'data-starting-style:translate-y-[-52%] data-starting-style:scale-95 data-starting-style:opacity-0',\n 'data-ending-style:translate-y-[-52%] data-ending-style:scale-95 data-ending-style:opacity-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogHeader({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-dialog-header\"\n className={cn(\n 'grid grid-rows-[auto_1fr] place-items-center gap-1 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogFooter({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-dialog-footer\"\n className={cn(\n 'flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogMedia({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-dialog-media\"\n className={cn(\n 'inline-flex size-4 h-7 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {\n return (\n <AlertDialogPrimitive.Title\n data-slot=\"alert-dialog-title\"\n className={cn(\n 'text-lg font-bold text-gray sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {\n return (\n <AlertDialogPrimitive.Description\n data-slot=\"alert-dialog-description\"\n className={cn('text-sm text-balance text-gray-light', className)}\n {...props}\n />\n )\n}\n\ninterface AlertDialogActionProps\n extends\n React.ComponentProps<typeof AlertDialogPrimitive.Close>,\n Pick<ButtonProps, 'size' | 'styleVariant' | 'color'> {}\n\n// Base UI has no Action primitive; the confirm button composes Close (radix\n// Action also closed on click) — run the action in onClick. A prop-less Button\n// is the primary look (solid accent), so the confirm just forwards style/color.\nfunction AlertDialogAction({\n className,\n size = 'default',\n styleVariant,\n color,\n ...props\n}: AlertDialogActionProps) {\n return (\n <Button\n size={size}\n styleVariant={styleVariant}\n color={color}\n render={\n <AlertDialogPrimitive.Close\n data-slot=\"alert-dialog-action\"\n className={className}\n {...props}\n />\n }\n />\n )\n}\n\ninterface AlertDialogCancelProps\n extends\n React.ComponentProps<typeof AlertDialogPrimitive.Close>,\n Pick<ButtonProps, 'size' | 'styleVariant' | 'color'> {}\n\n// No children = the ready-made corner X (label is the consumer's, via aria-label);\n// with children it renders as a Button (default surface/neutral, the old secondary\n// look); with a render prop it stays the bare primitive (the consumer supplies the button)\nfunction AlertDialogCancel({\n className,\n size = 'default',\n styleVariant,\n color,\n children,\n ...props\n}: AlertDialogCancelProps) {\n if (children) {\n // Default to the surface/neutral (secondary) look unless the caller pins a\n // style/color of its own.\n const hasLook = styleVariant !== undefined || color !== undefined\n return (\n <Button\n size={size}\n styleVariant={hasLook ? styleVariant : 'surface'}\n color={hasLook ? color : 'neutral'}\n render={\n <AlertDialogPrimitive.Close\n data-slot=\"alert-dialog-cancel\"\n className={className}\n {...props}\n >\n {children}\n </AlertDialogPrimitive.Close>\n }\n />\n )\n }\n\n if (props.render) {\n return (\n <AlertDialogPrimitive.Close\n data-slot=\"alert-dialog-cancel\"\n className={className}\n {...props}\n />\n )\n }\n\n return (\n <AlertDialogPrimitive.Close\n data-slot=\"alert-dialog-cancel\"\n className={cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n 'absolute top-2.5 right-2 rounded-full',\n className,\n )}\n {...props}\n >\n <Close className=\"[--spark-icon-size:calc(20px*var(--spark-scaling,1))]\" />\n </AlertDialogPrimitive.Close>\n )\n}\n\nexport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogMedia,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger,\n}\nexport type { AlertDialogContentProps }\n"],"mappings":";;;;;;;;AAOA,SAAS,YACP,OACA;CACA,OAAO,oBAACA,cAAqB,MAAtB,EAA2B,GAAI,MAAQ,CAAA;AAChD;AAEA,SAAS,mBACP,OACA;CACA,OACE,oBAACA,cAAqB,SAAtB;EAA8B,aAAU;EAAuB,GAAI;CAAQ,CAAA;AAE/E;AAEA,SAAS,kBACP,OACA;CACA,OACE,oBAACA,cAAqB,QAAtB;EAA6B,aAAU;EAAsB,GAAI;CAAQ,CAAA;AAE7E;AAEA,SAAS,mBAAmB,EAC1B,WACA,GAAG,SAC0D;CAC7D,OACE,oBAACA,cAAqB,UAAtB;EACE,aAAU;EACV,WAAW,GACT,wOACA,SACF;EACA,gBAAa;EACb,GAAI;CACL,CAAA;AAEL;AAQA,SAAS,mBAAmB,EAC1B,WACA,OAAO,WACP,GAAG,SACuB;CAC1B,OACE,oBAACA,cAAqB,OAAtB;EACE,aAAU;EACV,aAAW;EACX,WAAW,GACT,sWAEA,qGACA,+FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SAC2B;CAC9B,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,oZACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SAC2B;CAC9B,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,+JACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,iBAAiB,EACxB,WACA,GAAG,SAC2B;CAC9B,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,iKACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,iBAAiB,EACxB,WACA,GAAG,SACuD;CAC1D,OACE,oBAACA,cAAqB,OAAtB;EACE,aAAU;EACV,WAAW,GACT,2JACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,uBAAuB,EAC9B,WACA,GAAG,SAC6D;CAChE,OACE,oBAACA,cAAqB,aAAtB;EACE,aAAU;EACV,WAAW,GAAG,wCAAwC,SAAS;EAC/D,GAAI;CACL,CAAA;AAEL;AAUA,SAAS,kBAAkB,EACzB,WACA,OAAO,WACP,cACA,OACA,GAAG,SACsB;CACzB,OACE,oBAAC,QAAD;EACQ;EACQ;EACP;EACP,QACE,oBAACA,cAAqB,OAAtB;GACE,aAAU;GACC;GACX,GAAI;EACL,CAAA;CAEJ,CAAA;AAEL;AAUA,SAAS,kBAAkB,EACzB,WACA,OAAO,WACP,cACA,OACA,UACA,GAAG,SACsB;CACzB,IAAI,UAAU;EAGZ,MAAM,UAAU,iBAAiB,KAAA,KAAa,UAAU,KAAA;EACxD,OACE,oBAAC,QAAD;GACQ;GACN,cAAc,UAAU,eAAe;GACvC,OAAO,UAAU,QAAQ;GACzB,QACE,oBAACA,cAAqB,OAAtB;IACE,aAAU;IACC;IACX,GAAI;IAEH;GACyB,CAAA;EAE/B,CAAA;CAEL;CAEA,IAAI,MAAM,QACR,OACE,oBAACA,cAAqB,OAAtB;EACE,aAAU;EACC;EACX,GAAI;CACL,CAAA;CAIL,OACE,oBAACA,cAAqB,OAAtB;EACE,aAAU;EACV,WAAW,GACT,eAAe;GAAE,MAAM;GAAQ,SAAS;EAAW,CAAC,GACpD,yCACA,SACF;EACA,GAAI;YAEJ,oBAAC,OAAD,EAAO,WAAU,wDAAyD,CAAA;CAChD,CAAA;AAEhC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_hooks_use_reduced_motion = require("../hooks/use-reduced-motion.cjs");
|
|
4
3
|
const require_utils_format = require("../utils/format.cjs");
|
|
5
4
|
const require_utils_chart_scale = require("../utils/chart-scale.cjs");
|
|
5
|
+
const require_hooks_use_reduced_motion = require("../hooks/use-reduced-motion.cjs");
|
|
6
6
|
const require_components_chart = require("./chart.cjs");
|
|
7
7
|
const require_components_series_legend = require("./series-legend.cjs");
|
|
8
8
|
const require_components_typography = require("./typography.cjs");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "../utils/cn.js";
|
|
3
|
-
import { useReducedMotion } from "../hooks/use-reduced-motion.js";
|
|
4
2
|
import { localeNumberFormat } from "../utils/format.js";
|
|
5
3
|
import { buildYAxisScale, formatYAxisTick, measureYAxisGutter } from "../utils/chart-scale.js";
|
|
4
|
+
import { cn } from "../utils/cn.js";
|
|
5
|
+
import { useReducedMotion } from "../hooks/use-reduced-motion.js";
|
|
6
6
|
import { ChartTooltipCard, clampTooltipPosition, useMeasuredSize } from "./chart.js";
|
|
7
7
|
import { SeriesLegend } from "./series-legend.js";
|
|
8
8
|
import { SectionTitle } from "./typography.js";
|
|
@@ -4,6 +4,7 @@ const require_components_badge = require("./badge.cjs");
|
|
|
4
4
|
const require_components_icon = require("./icon.cjs");
|
|
5
5
|
const require_components_progress = require("./progress.cjs");
|
|
6
6
|
let react = require("react");
|
|
7
|
+
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
7
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
9
|
let cnfast = require("cnfast");
|
|
9
10
|
//#region src/components/battery-progress-row.tsx
|
|
@@ -23,25 +24,27 @@ const BatteryProgressRow = ({ className, soc, children, ...rest }) => {
|
|
|
23
24
|
})
|
|
24
25
|
});
|
|
25
26
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
const BATTERY_BY_LEVEL = [
|
|
28
|
+
_epilot_spark_icons.Battery0Bar,
|
|
29
|
+
_epilot_spark_icons.Battery1Bar,
|
|
30
|
+
_epilot_spark_icons.Battery2Bar,
|
|
31
|
+
_epilot_spark_icons.Battery3Bar,
|
|
32
|
+
_epilot_spark_icons.Battery4Bar,
|
|
33
|
+
_epilot_spark_icons.Battery5Bar,
|
|
34
|
+
_epilot_spark_icons.Battery6Bar
|
|
35
|
+
];
|
|
34
36
|
const BatteryProgressRowIcon = ({ className, icon: overrideIcon, ...rest }) => {
|
|
35
37
|
const { soc } = useBatteryProgressRowContext();
|
|
36
38
|
const clampedSoc = Math.min(Math.max(soc, 0), 100);
|
|
37
39
|
const batteryLevel = Math.min(Math.floor(clampedSoc / (100 / 7)), 6);
|
|
38
|
-
const
|
|
40
|
+
const fallback = clampedSoc === 100 ? _epilot_spark_icons.BatteryFull : BATTERY_BY_LEVEL[batteryLevel] ?? _epilot_spark_icons.Battery0Bar;
|
|
41
|
+
const Glyph = overrideIcon ?? fallback;
|
|
39
42
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_icon.Icon, {
|
|
40
43
|
...rest,
|
|
41
44
|
className,
|
|
42
45
|
color: "success",
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
size: "large",
|
|
47
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Glyph, {})
|
|
45
48
|
});
|
|
46
49
|
};
|
|
47
50
|
const BatteryProgressRowContent = ({ className, ...rest }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"battery-progress-row.cjs","names":["Icon","Badge","Progress"],"sources":["../../src/components/battery-progress-row.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"battery-progress-row.cjs","names":["Battery0Bar","Battery1Bar","Battery2Bar","Battery3Bar","Battery4Bar","Battery5Bar","Battery6Bar","BatteryFull","Icon","Badge","Progress"],"sources":["../../src/components/battery-progress-row.tsx"],"sourcesContent":["import {\n Battery0Bar,\n Battery1Bar,\n Battery2Bar,\n Battery3Bar,\n Battery4Bar,\n Battery5Bar,\n Battery6Bar,\n BatteryFull,\n type SparkIcon,\n} from '@epilot/spark-icons'\nimport { createContext, useContext } from 'react'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\nimport { Badge, type SparkBadgeColor } from './badge'\nimport { Icon } from './icon'\nimport { Progress } from './progress'\n\ninterface BatteryProgressRowContextValue {\n soc: number\n}\n\nconst BatteryProgressRowContext =\n createContext<BatteryProgressRowContextValue | null>(null)\n\nfunction useBatteryProgressRowContext() {\n const context = useContext(BatteryProgressRowContext)\n if (!context) {\n throw new Error(\n 'BatteryProgressRow.* must be rendered inside <BatteryProgressRow>',\n )\n }\n return context\n}\n\nconst BatteryProgressRow = ({\n className,\n soc,\n children,\n ...rest\n}: React.ComponentProps<'div'> & { soc: number }) => {\n return (\n <BatteryProgressRowContext.Provider value={{ soc }}>\n <div className={cn('flex items-center gap-3', className)} {...rest}>\n {children}\n </div>\n </BatteryProgressRowContext.Provider>\n )\n}\n\nconst BATTERY_BY_LEVEL = [\n Battery0Bar,\n Battery1Bar,\n Battery2Bar,\n Battery3Bar,\n Battery4Bar,\n Battery5Bar,\n Battery6Bar,\n] as const\n\nconst BatteryProgressRowIcon = ({\n className,\n icon: overrideIcon,\n ...rest\n}: React.ComponentProps<'span'> & { icon?: SparkIcon }) => {\n const { soc } = useBatteryProgressRowContext()\n const clampedSoc = Math.min(Math.max(soc, 0), 100)\n const batteryLevel = Math.min(Math.floor(clampedSoc / (100 / 7)), 6)\n const fallback: SparkIcon =\n clampedSoc === 100\n ? BatteryFull\n : (BATTERY_BY_LEVEL[batteryLevel] ?? Battery0Bar)\n const Glyph = overrideIcon ?? fallback\n\n return (\n <Icon {...rest} className={className} color=\"success\" size=\"large\">\n <Glyph />\n </Icon>\n )\n}\n\nconst BatteryProgressRowContent = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn('flex min-w-0 flex-1 flex-col gap-1.5', className)}\n {...rest}\n />\n )\n}\n\nconst BatteryProgressRowHeader = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn('flex items-center justify-between gap-2', className)}\n {...rest}\n />\n )\n}\n\nconst toneToBadgeColor: Record<Tone, SparkBadgeColor> = {\n success: 'success',\n warning: 'warning',\n error: 'danger',\n accent: 'accent',\n neutral: 'neutral',\n}\n\nconst BatteryProgressRowStateBadge = ({\n className,\n children,\n tone = 'neutral',\n ...rest\n}: Omit<React.ComponentProps<'span'>, 'color'> & { tone?: Tone }) => {\n if (children === null || children === undefined) return null\n return (\n <Badge\n color={toneToBadgeColor[tone]}\n className={cn('w-fit', className)}\n {...rest}\n >\n {children}\n </Badge>\n )\n}\n\nconst BatteryProgressRowChargingPower = ({\n className,\n children,\n ...rest\n}: React.ComponentProps<'span'>) => {\n if (children === null || children === undefined) return null\n return (\n <span\n className={cn(\n 'ml-auto text-lg leading-tight font-bold text-gray tabular-nums',\n className,\n )}\n {...rest}\n >\n {children}\n </span>\n )\n}\n\n/**\n * Linear progress bar bound to the row's `soc`.\n */\nconst BatteryProgressRowProgressBar = ({\n className,\n ...rest\n}: Omit<React.ComponentProps<typeof Progress>, 'value' | 'max'>) => {\n const { soc } = useBatteryProgressRowContext()\n return <Progress className={className} max={100} value={soc} {...rest} />\n}\n\nconst BatteryProgressRowFooter = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn(\n 'flex justify-between text-xs text-gray-light tabular-nums',\n className,\n )}\n {...rest}\n />\n )\n}\n\nconst BatteryProgressRowMinSoc = ({\n className,\n children,\n ...rest\n}: React.ComponentProps<'span'>) => {\n if (children === null || children === undefined) return null\n return (\n <span className={cn(className)} {...rest}>\n {children}\n </span>\n )\n}\n\n/**\n * Current state-of-charge label, rendered as `{soc}%`. Reads from context.\n */\nconst BatteryProgressRowSoc = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => {\n const { soc } = useBatteryProgressRowContext()\n return (\n <span className={cn(className)} {...rest}>\n {`${soc}%`}\n </span>\n )\n}\n\nexport {\n BatteryProgressRow,\n BatteryProgressRowIcon,\n BatteryProgressRowContent,\n BatteryProgressRowHeader,\n BatteryProgressRowStateBadge,\n BatteryProgressRowChargingPower,\n BatteryProgressRowProgressBar,\n BatteryProgressRowFooter,\n BatteryProgressRowMinSoc,\n BatteryProgressRowSoc,\n}\n"],"mappings":";;;;;;;;;;AAsBA,MAAM,6BAAA,GAAA,MAAA,eACiD,IAAI;AAE3D,SAAS,+BAA+B;CACtC,MAAM,WAAA,GAAA,MAAA,YAAqB,yBAAyB;CACpD,IAAI,CAAC,SACH,MAAM,IAAI,MACR,mEACF;CAEF,OAAO;AACT;AAEA,MAAM,sBAAsB,EAC1B,WACA,KACA,UACA,GAAG,WACgD;CACnD,OACE,iBAAA,GAAA,kBAAA,KAAC,0BAA0B,UAA3B;EAAoC,OAAO,EAAE,IAAI;YAC/C,iBAAA,GAAA,kBAAA,KAAC,OAAD;GAAK,YAAA,GAAA,OAAA,IAAc,2BAA2B,SAAS;GAAG,GAAI;GAC3D;EACE,CAAA;CAC6B,CAAA;AAExC;AAEA,MAAM,mBAAmB;CACvBA,oBAAAA;CACAC,oBAAAA;CACAC,oBAAAA;CACAC,oBAAAA;CACAC,oBAAAA;CACAC,oBAAAA;CACAC,oBAAAA;AACF;AAEA,MAAM,0BAA0B,EAC9B,WACA,MAAM,cACN,GAAG,WACsD;CACzD,MAAM,EAAE,QAAQ,6BAA6B;CAC7C,MAAM,aAAa,KAAK,IAAI,KAAK,IAAI,KAAK,CAAC,GAAG,GAAG;CACjD,MAAM,eAAe,KAAK,IAAI,KAAK,MAAM,cAAc,MAAM,EAAE,GAAG,CAAC;CACnE,MAAM,WACJ,eAAe,MACXC,oBAAAA,cACC,iBAAiB,iBAAiBP,oBAAAA;CACzC,MAAM,QAAQ,gBAAgB;CAE9B,OACE,iBAAA,GAAA,kBAAA,KAACQ,wBAAAA,MAAD;EAAM,GAAI;EAAiB;EAAW,OAAM;EAAU,MAAK;YACzD,iBAAA,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,OAAA,IACE,6DACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,MAAM,4BAA4B,EAChC,WACA,UACA,GAAG,WAC+B;CAClC,IAAI,aAAa,QAAQ,aAAa,KAAA,GAAW,OAAO;CACxD,OACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EAAM,YAAA,GAAA,OAAA,IAAc,SAAS;EAAG,GAAI;EACjC;CACG,CAAA;AAEV;;;;AAKA,MAAM,yBAAyB,EAC7B,WACA,GAAG,WAC+B;CAClC,MAAM,EAAE,QAAQ,6BAA6B;CAC7C,OACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EAAM,YAAA,GAAA,OAAA,IAAc,SAAS;EAAG,GAAI;YACjC,GAAG,IAAI;CACJ,CAAA;AAEV"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { MaterialSymbolIconName } from "../icons/material-symbol.cjs";
|
|
4
3
|
import { Tone } from "../lib/tones.cjs";
|
|
5
4
|
import { Progress } from "./progress.cjs";
|
|
5
|
+
import { SparkIcon } from "@epilot/spark-icons";
|
|
6
6
|
|
|
7
7
|
//#region src/components/battery-progress-row.d.ts
|
|
8
8
|
declare const BatteryProgressRow: ({
|
|
@@ -13,20 +13,12 @@ declare const BatteryProgressRow: ({
|
|
|
13
13
|
}: React.ComponentProps<"div"> & {
|
|
14
14
|
soc: number;
|
|
15
15
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
/**
|
|
17
|
-
* Battery icon. Auto-selects its variant from the row's `soc`.
|
|
18
|
-
*
|
|
19
|
-
* @param className - Optional className to apply to the icon to further style it
|
|
20
|
-
* @param icon - The icon to render (defaults to auto-selecting based on the row's `soc`)
|
|
21
|
-
* @param ...rest - Additional props to pass to the span
|
|
22
|
-
* @returns A React component that renders a battery icon
|
|
23
|
-
*/
|
|
24
16
|
declare const BatteryProgressRowIcon: ({
|
|
25
17
|
className,
|
|
26
18
|
icon: overrideIcon,
|
|
27
19
|
...rest
|
|
28
20
|
}: React.ComponentProps<"span"> & {
|
|
29
|
-
icon?:
|
|
21
|
+
icon?: SparkIcon;
|
|
30
22
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
31
23
|
declare const BatteryProgressRowContent: ({
|
|
32
24
|
className,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { MaterialSymbolIconName } from "../icons/material-symbol.js";
|
|
4
3
|
import { Tone } from "../lib/tones.js";
|
|
5
4
|
import { Progress } from "./progress.js";
|
|
5
|
+
import { SparkIcon } from "@epilot/spark-icons";
|
|
6
6
|
|
|
7
7
|
//#region src/components/battery-progress-row.d.ts
|
|
8
8
|
declare const BatteryProgressRow: ({
|
|
@@ -13,20 +13,12 @@ declare const BatteryProgressRow: ({
|
|
|
13
13
|
}: React.ComponentProps<"div"> & {
|
|
14
14
|
soc: number;
|
|
15
15
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
/**
|
|
17
|
-
* Battery icon. Auto-selects its variant from the row's `soc`.
|
|
18
|
-
*
|
|
19
|
-
* @param className - Optional className to apply to the icon to further style it
|
|
20
|
-
* @param icon - The icon to render (defaults to auto-selecting based on the row's `soc`)
|
|
21
|
-
* @param ...rest - Additional props to pass to the span
|
|
22
|
-
* @returns A React component that renders a battery icon
|
|
23
|
-
*/
|
|
24
16
|
declare const BatteryProgressRowIcon: ({
|
|
25
17
|
className,
|
|
26
18
|
icon: overrideIcon,
|
|
27
19
|
...rest
|
|
28
20
|
}: React.ComponentProps<"span"> & {
|
|
29
|
-
icon?:
|
|
21
|
+
icon?: SparkIcon;
|
|
30
22
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
31
23
|
declare const BatteryProgressRowContent: ({
|
|
32
24
|
className,
|
|
@@ -4,6 +4,7 @@ import { Badge } from "./badge.js";
|
|
|
4
4
|
import { Icon } from "./icon.js";
|
|
5
5
|
import { Progress } from "./progress.js";
|
|
6
6
|
import { createContext, useContext } from "react";
|
|
7
|
+
import { Battery0Bar, Battery1Bar, Battery2Bar, Battery3Bar, Battery4Bar, Battery5Bar, Battery6Bar, BatteryFull } from "@epilot/spark-icons";
|
|
7
8
|
import { jsx } from "react/jsx-runtime";
|
|
8
9
|
//#region src/components/battery-progress-row.tsx
|
|
9
10
|
const BatteryProgressRowContext = createContext(null);
|
|
@@ -22,25 +23,27 @@ const BatteryProgressRow = ({ className, soc, children, ...rest }) => {
|
|
|
22
23
|
})
|
|
23
24
|
});
|
|
24
25
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
const BATTERY_BY_LEVEL = [
|
|
27
|
+
Battery0Bar,
|
|
28
|
+
Battery1Bar,
|
|
29
|
+
Battery2Bar,
|
|
30
|
+
Battery3Bar,
|
|
31
|
+
Battery4Bar,
|
|
32
|
+
Battery5Bar,
|
|
33
|
+
Battery6Bar
|
|
34
|
+
];
|
|
33
35
|
const BatteryProgressRowIcon = ({ className, icon: overrideIcon, ...rest }) => {
|
|
34
36
|
const { soc } = useBatteryProgressRowContext();
|
|
35
37
|
const clampedSoc = Math.min(Math.max(soc, 0), 100);
|
|
36
38
|
const batteryLevel = Math.min(Math.floor(clampedSoc / (100 / 7)), 6);
|
|
37
|
-
const
|
|
39
|
+
const fallback = clampedSoc === 100 ? BatteryFull : BATTERY_BY_LEVEL[batteryLevel] ?? Battery0Bar;
|
|
40
|
+
const Glyph = overrideIcon ?? fallback;
|
|
38
41
|
return /* @__PURE__ */ jsx(Icon, {
|
|
39
42
|
...rest,
|
|
40
43
|
className,
|
|
41
44
|
color: "success",
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
size: "large",
|
|
46
|
+
children: /* @__PURE__ */ jsx(Glyph, {})
|
|
44
47
|
});
|
|
45
48
|
};
|
|
46
49
|
const BatteryProgressRowContent = ({ className, ...rest }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"battery-progress-row.js","names":[],"sources":["../../src/components/battery-progress-row.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"battery-progress-row.js","names":[],"sources":["../../src/components/battery-progress-row.tsx"],"sourcesContent":["import {\n Battery0Bar,\n Battery1Bar,\n Battery2Bar,\n Battery3Bar,\n Battery4Bar,\n Battery5Bar,\n Battery6Bar,\n BatteryFull,\n type SparkIcon,\n} from '@epilot/spark-icons'\nimport { createContext, useContext } from 'react'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\nimport { Badge, type SparkBadgeColor } from './badge'\nimport { Icon } from './icon'\nimport { Progress } from './progress'\n\ninterface BatteryProgressRowContextValue {\n soc: number\n}\n\nconst BatteryProgressRowContext =\n createContext<BatteryProgressRowContextValue | null>(null)\n\nfunction useBatteryProgressRowContext() {\n const context = useContext(BatteryProgressRowContext)\n if (!context) {\n throw new Error(\n 'BatteryProgressRow.* must be rendered inside <BatteryProgressRow>',\n )\n }\n return context\n}\n\nconst BatteryProgressRow = ({\n className,\n soc,\n children,\n ...rest\n}: React.ComponentProps<'div'> & { soc: number }) => {\n return (\n <BatteryProgressRowContext.Provider value={{ soc }}>\n <div className={cn('flex items-center gap-3', className)} {...rest}>\n {children}\n </div>\n </BatteryProgressRowContext.Provider>\n )\n}\n\nconst BATTERY_BY_LEVEL = [\n Battery0Bar,\n Battery1Bar,\n Battery2Bar,\n Battery3Bar,\n Battery4Bar,\n Battery5Bar,\n Battery6Bar,\n] as const\n\nconst BatteryProgressRowIcon = ({\n className,\n icon: overrideIcon,\n ...rest\n}: React.ComponentProps<'span'> & { icon?: SparkIcon }) => {\n const { soc } = useBatteryProgressRowContext()\n const clampedSoc = Math.min(Math.max(soc, 0), 100)\n const batteryLevel = Math.min(Math.floor(clampedSoc / (100 / 7)), 6)\n const fallback: SparkIcon =\n clampedSoc === 100\n ? BatteryFull\n : (BATTERY_BY_LEVEL[batteryLevel] ?? Battery0Bar)\n const Glyph = overrideIcon ?? fallback\n\n return (\n <Icon {...rest} className={className} color=\"success\" size=\"large\">\n <Glyph />\n </Icon>\n )\n}\n\nconst BatteryProgressRowContent = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn('flex min-w-0 flex-1 flex-col gap-1.5', className)}\n {...rest}\n />\n )\n}\n\nconst BatteryProgressRowHeader = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn('flex items-center justify-between gap-2', className)}\n {...rest}\n />\n )\n}\n\nconst toneToBadgeColor: Record<Tone, SparkBadgeColor> = {\n success: 'success',\n warning: 'warning',\n error: 'danger',\n accent: 'accent',\n neutral: 'neutral',\n}\n\nconst BatteryProgressRowStateBadge = ({\n className,\n children,\n tone = 'neutral',\n ...rest\n}: Omit<React.ComponentProps<'span'>, 'color'> & { tone?: Tone }) => {\n if (children === null || children === undefined) return null\n return (\n <Badge\n color={toneToBadgeColor[tone]}\n className={cn('w-fit', className)}\n {...rest}\n >\n {children}\n </Badge>\n )\n}\n\nconst BatteryProgressRowChargingPower = ({\n className,\n children,\n ...rest\n}: React.ComponentProps<'span'>) => {\n if (children === null || children === undefined) return null\n return (\n <span\n className={cn(\n 'ml-auto text-lg leading-tight font-bold text-gray tabular-nums',\n className,\n )}\n {...rest}\n >\n {children}\n </span>\n )\n}\n\n/**\n * Linear progress bar bound to the row's `soc`.\n */\nconst BatteryProgressRowProgressBar = ({\n className,\n ...rest\n}: Omit<React.ComponentProps<typeof Progress>, 'value' | 'max'>) => {\n const { soc } = useBatteryProgressRowContext()\n return <Progress className={className} max={100} value={soc} {...rest} />\n}\n\nconst BatteryProgressRowFooter = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn(\n 'flex justify-between text-xs text-gray-light tabular-nums',\n className,\n )}\n {...rest}\n />\n )\n}\n\nconst BatteryProgressRowMinSoc = ({\n className,\n children,\n ...rest\n}: React.ComponentProps<'span'>) => {\n if (children === null || children === undefined) return null\n return (\n <span className={cn(className)} {...rest}>\n {children}\n </span>\n )\n}\n\n/**\n * Current state-of-charge label, rendered as `{soc}%`. Reads from context.\n */\nconst BatteryProgressRowSoc = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => {\n const { soc } = useBatteryProgressRowContext()\n return (\n <span className={cn(className)} {...rest}>\n {`${soc}%`}\n </span>\n )\n}\n\nexport {\n BatteryProgressRow,\n BatteryProgressRowIcon,\n BatteryProgressRowContent,\n BatteryProgressRowHeader,\n BatteryProgressRowStateBadge,\n BatteryProgressRowChargingPower,\n BatteryProgressRowProgressBar,\n BatteryProgressRowFooter,\n BatteryProgressRowMinSoc,\n BatteryProgressRowSoc,\n}\n"],"mappings":";;;;;;;;;AAsBA,MAAM,4BACJ,cAAqD,IAAI;AAE3D,SAAS,+BAA+B;CACtC,MAAM,UAAU,WAAW,yBAAyB;CACpD,IAAI,CAAC,SACH,MAAM,IAAI,MACR,mEACF;CAEF,OAAO;AACT;AAEA,MAAM,sBAAsB,EAC1B,WACA,KACA,UACA,GAAG,WACgD;CACnD,OACE,oBAAC,0BAA0B,UAA3B;EAAoC,OAAO,EAAE,IAAI;YAC/C,oBAAC,OAAD;GAAK,WAAW,GAAG,2BAA2B,SAAS;GAAG,GAAI;GAC3D;EACE,CAAA;CAC6B,CAAA;AAExC;AAEA,MAAM,mBAAmB;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,0BAA0B,EAC9B,WACA,MAAM,cACN,GAAG,WACsD;CACzD,MAAM,EAAE,QAAQ,6BAA6B;CAC7C,MAAM,aAAa,KAAK,IAAI,KAAK,IAAI,KAAK,CAAC,GAAG,GAAG;CACjD,MAAM,eAAe,KAAK,IAAI,KAAK,MAAM,cAAc,MAAM,EAAE,GAAG,CAAC;CACnE,MAAM,WACJ,eAAe,MACX,cACC,iBAAiB,iBAAiB;CACzC,MAAM,QAAQ,gBAAgB;CAE9B,OACE,oBAAC,MAAD;EAAM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oBAAC,QAAD;EAAM,WAAW,GAAG,SAAS;EAAG,GAAI;EACjC;CACG,CAAA;AAEV;;;;AAKA,MAAM,yBAAyB,EAC7B,WACA,GAAG,WAC+B;CAClC,MAAM,EAAE,QAAQ,6BAA6B;CAC7C,OACE,oBAAC,QAAD;EAAM,WAAW,GAAG,SAAS;EAAG,GAAI;YACjC,GAAG,IAAI;CACJ,CAAA;AAEV"}
|
|
@@ -10,7 +10,7 @@ declare function BubbleGroup({
|
|
|
10
10
|
...props
|
|
11
11
|
}: React$1.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
declare const bubbleVariants: (props?: ({
|
|
13
|
-
variant?: "
|
|
13
|
+
variant?: "secondary" | "destructive" | "default" | "outline" | "ghost" | "muted" | "tinted" | null | undefined;
|
|
14
14
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
15
|
declare function Bubble({
|
|
16
16
|
variant,
|
|
@@ -10,7 +10,7 @@ declare function BubbleGroup({
|
|
|
10
10
|
...props
|
|
11
11
|
}: React$1.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
declare const bubbleVariants: (props?: ({
|
|
13
|
-
variant?: "
|
|
13
|
+
variant?: "secondary" | "destructive" | "default" | "outline" | "ghost" | "muted" | "tinted" | null | undefined;
|
|
14
14
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
15
|
declare function Bubble({
|
|
16
16
|
variant,
|