@epilot/spark-ui 0.14.0 → 0.15.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 +1 -1
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/attachment.d.cts +2 -2
- package/dist/components/attachment.d.ts +2 -2
- package/dist/components/bar-chart.js +1 -1
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/callout.d.cts +1 -1
- package/dist/components/callout.d.ts +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 +2 -1
- package/dist/components/input-otp.cjs.map +1 -1
- package/dist/components/input-otp.d.cts +2 -1
- package/dist/components/input-otp.d.ts +2 -1
- package/dist/components/input-otp.js +2 -1
- package/dist/components/input-otp.js.map +1 -1
- package/dist/components/line-chart.cjs +1 -1
- package/dist/components/line-chart.js +2 -2
- package/dist/components/message-scroller.cjs +1 -1
- package/dist/components/message-scroller.js +1 -1
- package/dist/components/page-header.d.cts +1 -1
- package/dist/components/page-header.d.ts +1 -1
- package/dist/components/power-history-chart.cjs +1 -1
- package/dist/components/power-history-chart.js +2 -2
- package/dist/components/power-history.cjs +1 -1
- package/dist/components/power-history.js +1 -1
- package/dist/components/power-network.cjs +1 -1
- package/dist/components/power-network.js +1 -1
- package/dist/components/reparent.cjs +23 -9
- package/dist/components/reparent.cjs.map +1 -1
- package/dist/components/reparent.d.cts +1 -0
- package/dist/components/reparent.d.ts +1 -0
- package/dist/components/reparent.js +23 -9
- package/dist/components/reparent.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
4
4
|
const require_icons_material_symbol = require("../icons/material-symbol.cjs");
|
|
5
|
-
let _base_ui_react_accordion = require("@base-ui/react/accordion");
|
|
6
5
|
let react = require("react");
|
|
7
6
|
react = require_chunk.__toESM(react);
|
|
7
|
+
let _base_ui_react_accordion = require("@base-ui/react/accordion");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let cnfast = require("cnfast");
|
|
10
10
|
//#region src/components/accordion.tsx
|
|
@@ -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
3
|
import { MaterialSymbol } from "../icons/material-symbol.js";
|
|
4
|
-
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
5
4
|
import "react";
|
|
5
|
+
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/accordion.tsx
|
|
8
8
|
function Accordion({ className, variant = "soft", ...props }) {
|
|
@@ -7,7 +7,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
7
7
|
|
|
8
8
|
//#region src/components/attachment.d.ts
|
|
9
9
|
declare const attachmentVariants: (props?: ({
|
|
10
|
-
size?: "
|
|
10
|
+
size?: "default" | "sm" | "xs" | null | undefined;
|
|
11
11
|
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
13
|
declare function Attachment({
|
|
@@ -20,7 +20,7 @@ declare function Attachment({
|
|
|
20
20
|
state?: 'idle' | 'uploading' | 'processing' | 'error' | 'done';
|
|
21
21
|
}): import("react/jsx-runtime").JSX.Element;
|
|
22
22
|
declare const attachmentMediaVariants: (props?: ({
|
|
23
|
-
variant?: "
|
|
23
|
+
variant?: "image" | "icon" | null | undefined;
|
|
24
24
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
25
25
|
declare function AttachmentMedia({
|
|
26
26
|
className,
|
|
@@ -7,7 +7,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
7
7
|
|
|
8
8
|
//#region src/components/attachment.d.ts
|
|
9
9
|
declare const attachmentVariants: (props?: ({
|
|
10
|
-
size?: "
|
|
10
|
+
size?: "default" | "sm" | "xs" | null | undefined;
|
|
11
11
|
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
13
|
declare function Attachment({
|
|
@@ -20,7 +20,7 @@ declare function Attachment({
|
|
|
20
20
|
state?: 'idle' | 'uploading' | 'processing' | 'error' | 'done';
|
|
21
21
|
}): import("react/jsx-runtime").JSX.Element;
|
|
22
22
|
declare const attachmentMediaVariants: (props?: ({
|
|
23
|
-
variant?: "
|
|
23
|
+
variant?: "image" | "icon" | null | undefined;
|
|
24
24
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
25
25
|
declare function AttachmentMedia({
|
|
26
26
|
className,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "../utils/cn.js";
|
|
3
2
|
import { useReducedMotion } from "../hooks/use-reduced-motion.js";
|
|
3
|
+
import { cn } from "../utils/cn.js";
|
|
4
4
|
import { localeNumberFormat } from "../utils/format.js";
|
|
5
5
|
import { buildYAxisScale, formatYAxisTick, measureYAxisGutter } from "../utils/chart-scale.js";
|
|
6
6
|
import { ChartTooltipCard, clampTooltipPosition, useMeasuredSize } from "./chart.js";
|
|
@@ -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" | "ghost" | "outline" | "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" | "ghost" | "outline" | "muted" | "tinted" | null | undefined;
|
|
14
14
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
15
|
declare function Bubble({
|
|
16
16
|
variant,
|
|
@@ -7,9 +7,9 @@ import { VariantProps } from "class-variance-authority";
|
|
|
7
7
|
|
|
8
8
|
//#region src/components/button.d.ts
|
|
9
9
|
declare const buttonVariants: (props?: ({
|
|
10
|
-
variant?: "
|
|
10
|
+
variant?: "primary" | "secondary" | "tertiary" | "bare" | "destructive" | null | undefined;
|
|
11
11
|
color?: "accent" | "neutral" | "danger" | null | undefined;
|
|
12
|
-
size?: "
|
|
12
|
+
size?: "small" | "default" | "medium" | "icon-small" | "icon" | "icon-medium" | null | undefined;
|
|
13
13
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
14
14
|
type SparkButtonColor = 'accent' | 'neutral' | 'danger';
|
|
15
15
|
interface ButtonProps extends Omit<React$1.ComponentProps<typeof Button$1>, 'ref'>, Omit<VariantProps<typeof buttonVariants>, 'variant' | 'color'> {
|
|
@@ -7,9 +7,9 @@ import { VariantProps } from "class-variance-authority";
|
|
|
7
7
|
|
|
8
8
|
//#region src/components/button.d.ts
|
|
9
9
|
declare const buttonVariants: (props?: ({
|
|
10
|
-
variant?: "
|
|
10
|
+
variant?: "primary" | "secondary" | "tertiary" | "bare" | "destructive" | null | undefined;
|
|
11
11
|
color?: "accent" | "neutral" | "danger" | null | undefined;
|
|
12
|
-
size?: "
|
|
12
|
+
size?: "small" | "default" | "medium" | "icon-small" | "icon" | "icon-medium" | null | undefined;
|
|
13
13
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
14
14
|
type SparkButtonColor = 'accent' | 'neutral' | 'danger';
|
|
15
15
|
interface ButtonProps extends Omit<React$1.ComponentProps<typeof Button$1>, 'ref'>, Omit<VariantProps<typeof buttonVariants>, 'variant' | 'color'> {
|
|
@@ -8,7 +8,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
8
8
|
//#region src/components/callout.d.ts
|
|
9
9
|
type CalloutVariant = 'error' | 'info' | 'neutral' | 'success' | 'warning';
|
|
10
10
|
declare const calloutVariants: (props?: ({
|
|
11
|
-
variant?: "neutral" | "success" | "warning" | "
|
|
11
|
+
variant?: "neutral" | "success" | "warning" | "info" | "error" | null | undefined;
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
13
|
interface CalloutProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof calloutVariants> {
|
|
14
14
|
/** Overrides the variant's default icon; the variant's color is kept. `false` renders no icon. */
|
|
@@ -8,7 +8,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
8
8
|
//#region src/components/callout.d.ts
|
|
9
9
|
type CalloutVariant = 'error' | 'info' | 'neutral' | 'success' | 'warning';
|
|
10
10
|
declare const calloutVariants: (props?: ({
|
|
11
|
-
variant?: "neutral" | "success" | "warning" | "
|
|
11
|
+
variant?: "neutral" | "success" | "warning" | "info" | "error" | null | undefined;
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
13
|
interface CalloutProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof calloutVariants> {
|
|
14
14
|
/** Overrides the variant's default icon; the variant's color is kept. `false` renders no icon. */
|
|
@@ -5,7 +5,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/info-block.d.ts
|
|
7
7
|
declare const InfoBlock: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
8
|
-
variant?: "
|
|
8
|
+
variant?: "bare" | "default" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React$1.RefAttributes<HTMLDivElement>>;
|
|
10
10
|
declare const InfoBlockIcon: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
declare const InfoBlockContent: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
@@ -5,7 +5,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/info-block.d.ts
|
|
7
7
|
declare const InfoBlock: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
8
|
-
variant?: "
|
|
8
|
+
variant?: "bare" | "default" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React$1.RefAttributes<HTMLDivElement>>;
|
|
10
10
|
declare const InfoBlockIcon: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
declare const InfoBlockContent: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
@@ -85,13 +85,14 @@ const slotVariants = (0, class_variance_authority.cva)("flex w-11 min-w-0 items-
|
|
|
85
85
|
}
|
|
86
86
|
]
|
|
87
87
|
});
|
|
88
|
-
function InputOtp({ length = 6, className, id: idProp, onComplete, slotAriaLabel = (index) => `
|
|
88
|
+
function InputOtp({ length = 6, className, id: idProp, onComplete, slotAriaLabel = (index) => `Character ${index + 1}`, validationType = "alphanumeric", ...props }) {
|
|
89
89
|
const { field, id, ariaDescribedBy, inputStyle, inputColor } = require_components_field.useFieldControl({ id: idProp });
|
|
90
90
|
const chrome = field?.labelPosition === "inset" ? "inset" : "box";
|
|
91
91
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_otp_field.OTPField.Root, {
|
|
92
92
|
"data-slot": "input-otp",
|
|
93
93
|
length,
|
|
94
94
|
id,
|
|
95
|
+
validationType,
|
|
95
96
|
onValueComplete: onComplete,
|
|
96
97
|
className: (0, cnfast.cn)("flex items-center gap-2", className),
|
|
97
98
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-otp.cjs","names":["GHOST_UNDERLINE","boxChrome","useFieldControl","OTPField"],"sources":["../../src/components/input-otp.tsx"],"sourcesContent":["import { OTPField, type OTPFieldRootProps } from '@base-ui/react/otp-field'\nimport { cva } from 'class-variance-authority'\nimport { boxChrome, GHOST_UNDERLINE } from '../lib/input-box-variants'\nimport { cn } from '../utils/cn'\nimport { useFieldControl } from './field'\n\n// One code box per slot. Mirrors Input's box/underline carrier model so the\n// slots read like the rest of the input family across every style/color knob.\nconst slotVariants = cva(\n 'flex w-11 min-w-0 items-center justify-center bg-transparent text-center text-base font-medium text-gray tabular-nums outline-hidden transition-all group-data-[invalid=true]/field:text-error placeholder:text-gray-disabled disabled:cursor-not-allowed disabled:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none',\n {\n variants: {\n chrome: {\n // inside an inset field the shell is the box; slots keep the classic\n // underline (the pre-knob default look)\n inset: GHOST_UNDERLINE,\n box: 'h-11 rounded-lg',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'brand',\n class: boxChrome.soft.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'gray',\n class: boxChrome.soft.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: boxChrome.surface.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: boxChrome.surface.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: boxChrome.outlined.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: boxChrome.outlined.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'brand',\n class: boxChrome.ghost.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'gray',\n class: boxChrome.ghost.gray,\n },\n { chrome: 'inset', inputColor: 'brand', class: 'border-b-input' },\n { chrome: 'inset', inputColor: 'gray', class: 'border-b-input-gray' },\n ],\n },\n)\n\ninterface InputOtpProps extends Pick<\n OTPFieldRootProps,\n 'value'
|
|
1
|
+
{"version":3,"file":"input-otp.cjs","names":["GHOST_UNDERLINE","boxChrome","useFieldControl","OTPField"],"sources":["../../src/components/input-otp.tsx"],"sourcesContent":["import { OTPField, type OTPFieldRootProps } from '@base-ui/react/otp-field'\nimport { cva } from 'class-variance-authority'\nimport { boxChrome, GHOST_UNDERLINE } from '../lib/input-box-variants'\nimport { cn } from '../utils/cn'\nimport { useFieldControl } from './field'\n\n// One code box per slot. Mirrors Input's box/underline carrier model so the\n// slots read like the rest of the input family across every style/color knob.\nconst slotVariants = cva(\n 'flex w-11 min-w-0 items-center justify-center bg-transparent text-center text-base font-medium text-gray tabular-nums outline-hidden transition-all group-data-[invalid=true]/field:text-error placeholder:text-gray-disabled disabled:cursor-not-allowed disabled:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none',\n {\n variants: {\n chrome: {\n // inside an inset field the shell is the box; slots keep the classic\n // underline (the pre-knob default look)\n inset: GHOST_UNDERLINE,\n box: 'h-11 rounded-lg',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'brand',\n class: boxChrome.soft.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'gray',\n class: boxChrome.soft.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: boxChrome.surface.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: boxChrome.surface.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: boxChrome.outlined.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: boxChrome.outlined.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'brand',\n class: boxChrome.ghost.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'gray',\n class: boxChrome.ghost.gray,\n },\n { chrome: 'inset', inputColor: 'brand', class: 'border-b-input' },\n { chrome: 'inset', inputColor: 'gray', class: 'border-b-input-gray' },\n ],\n },\n)\n\ninterface InputOtpProps extends Pick<\n OTPFieldRootProps,\n | 'value'\n | 'defaultValue'\n | 'onValueChange'\n | 'disabled'\n | 'className'\n | 'id'\n | 'validationType'\n> {\n /** Number of code slots. */\n length?: number\n /** Fired when every slot is filled. */\n onComplete?: OTPFieldRootProps['onValueComplete']\n /** Accessible name per slot (for localization). */\n slotAriaLabel?: (index: number) => string\n}\n\nfunction InputOtp({\n length = 6,\n className,\n id: idProp,\n onComplete,\n slotAriaLabel = (index) => `Character ${index + 1}`,\n validationType = 'alphanumeric',\n ...props\n}: InputOtpProps) {\n const { field, id, ariaDescribedBy, inputStyle, inputColor } =\n useFieldControl({ id: idProp })\n const chrome = field?.labelPosition === 'inset' ? 'inset' : 'box'\n\n return (\n <OTPField.Root\n data-slot=\"input-otp\"\n length={length}\n id={id}\n validationType={validationType}\n onValueComplete={onComplete}\n className={cn('flex items-center gap-2', className)}\n {...props}\n >\n {Array.from({ length }, (_, index) => (\n <OTPField.Input\n key={index}\n // the first slot is named by the Field label (Base UI ignores\n // aria-label there); the rest get a positional name for a11y\n aria-label={index === 0 ? undefined : slotAriaLabel(index)}\n aria-describedby={index === 0 ? ariaDescribedBy : undefined}\n className={slotVariants({ chrome, inputStyle, inputColor })}\n />\n ))}\n </OTPField.Root>\n )\n}\n\nexport { InputOtp }\nexport type { InputOtpProps }\n"],"mappings":";;;;;;;;;AAQA,MAAM,gBAAA,GAAA,yBAAA,KACJ,+UACA;CACE,UAAU;EACR,QAAQ;GAGN,OAAOA,+BAAAA;GACP,KAAK;EACP;EACA,YAAY;GAAE,MAAM;GAAI,SAAS;GAAI,UAAU;GAAI,OAAO;EAAG;EAC7D,YAAY;GAAE,OAAO;GAAI,MAAM;EAAG;CACpC;CACA,kBAAkB;EAChB;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOC,+BAAAA,UAAU,KAAK;EACxB;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOA,+BAAAA,UAAU,KAAK;EACxB;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOA,+BAAAA,UAAU,QAAQ;EAC3B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOA,+BAAAA,UAAU,QAAQ;EAC3B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOA,+BAAAA,UAAU,SAAS;EAC5B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOA,+BAAAA,UAAU,SAAS;EAC5B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOA,+BAAAA,UAAU,MAAM;EACzB;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOA,+BAAAA,UAAU,MAAM;EACzB;EACA;GAAE,QAAQ;GAAS,YAAY;GAAS,OAAO;EAAiB;EAChE;GAAE,QAAQ;GAAS,YAAY;GAAQ,OAAO;EAAsB;CACtE;AACF,CACF;AAoBA,SAAS,SAAS,EAChB,SAAS,GACT,WACA,IAAI,QACJ,YACA,iBAAiB,UAAU,aAAa,QAAQ,KAChD,iBAAiB,gBACjB,GAAG,SACa;CAChB,MAAM,EAAE,OAAO,IAAI,iBAAiB,YAAY,eAC9CC,yBAAAA,gBAAgB,EAAE,IAAI,OAAO,CAAC;CAChC,MAAM,SAAS,OAAO,kBAAkB,UAAU,UAAU;CAE5D,OACE,iBAAA,GAAA,kBAAA,KAACC,yBAAAA,SAAS,MAAV;EACE,aAAU;EACF;EACJ;EACY;EAChB,iBAAiB;EACjB,YAAA,GAAA,OAAA,IAAc,2BAA2B,SAAS;EAClD,GAAI;YAEH,MAAM,KAAK,EAAE,OAAO,IAAI,GAAG,UAC1B,iBAAA,GAAA,kBAAA,KAACA,yBAAAA,SAAS,OAAV;GAIE,cAAY,UAAU,IAAI,KAAA,IAAY,cAAc,KAAK;GACzD,oBAAkB,UAAU,IAAI,kBAAkB,KAAA;GAClD,WAAW,aAAa;IAAE;IAAQ;IAAY;GAAW,CAAC;EAC3D,GANM,KAMN,CACF;CACY,CAAA;AAEnB"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { OTPFieldRootProps } from "@base-ui/react/otp-field";
|
|
4
4
|
|
|
5
5
|
//#region src/components/input-otp.d.ts
|
|
6
|
-
interface InputOtpProps extends Pick<OTPFieldRootProps, 'value' | 'defaultValue' | 'onValueChange' | 'disabled' | 'className' | 'id'> {
|
|
6
|
+
interface InputOtpProps extends Pick<OTPFieldRootProps, 'value' | 'defaultValue' | 'onValueChange' | 'disabled' | 'className' | 'id' | 'validationType'> {
|
|
7
7
|
/** Number of code slots. */
|
|
8
8
|
length?: number;
|
|
9
9
|
/** Fired when every slot is filled. */
|
|
@@ -17,6 +17,7 @@ declare function InputOtp({
|
|
|
17
17
|
id: idProp,
|
|
18
18
|
onComplete,
|
|
19
19
|
slotAriaLabel,
|
|
20
|
+
validationType,
|
|
20
21
|
...props
|
|
21
22
|
}: InputOtpProps): import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
//#endregion
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { OTPFieldRootProps } from "@base-ui/react/otp-field";
|
|
4
4
|
|
|
5
5
|
//#region src/components/input-otp.d.ts
|
|
6
|
-
interface InputOtpProps extends Pick<OTPFieldRootProps, 'value' | 'defaultValue' | 'onValueChange' | 'disabled' | 'className' | 'id'> {
|
|
6
|
+
interface InputOtpProps extends Pick<OTPFieldRootProps, 'value' | 'defaultValue' | 'onValueChange' | 'disabled' | 'className' | 'id' | 'validationType'> {
|
|
7
7
|
/** Number of code slots. */
|
|
8
8
|
length?: number;
|
|
9
9
|
/** Fired when every slot is filled. */
|
|
@@ -17,6 +17,7 @@ declare function InputOtp({
|
|
|
17
17
|
id: idProp,
|
|
18
18
|
onComplete,
|
|
19
19
|
slotAriaLabel,
|
|
20
|
+
validationType,
|
|
20
21
|
...props
|
|
21
22
|
}: InputOtpProps): import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
//#endregion
|
|
@@ -84,13 +84,14 @@ const slotVariants = cva("flex w-11 min-w-0 items-center justify-center bg-trans
|
|
|
84
84
|
}
|
|
85
85
|
]
|
|
86
86
|
});
|
|
87
|
-
function InputOtp({ length = 6, className, id: idProp, onComplete, slotAriaLabel = (index) => `
|
|
87
|
+
function InputOtp({ length = 6, className, id: idProp, onComplete, slotAriaLabel = (index) => `Character ${index + 1}`, validationType = "alphanumeric", ...props }) {
|
|
88
88
|
const { field, id, ariaDescribedBy, inputStyle, inputColor } = useFieldControl({ id: idProp });
|
|
89
89
|
const chrome = field?.labelPosition === "inset" ? "inset" : "box";
|
|
90
90
|
return /* @__PURE__ */ jsx(OTPField.Root, {
|
|
91
91
|
"data-slot": "input-otp",
|
|
92
92
|
length,
|
|
93
93
|
id,
|
|
94
|
+
validationType,
|
|
94
95
|
onValueComplete: onComplete,
|
|
95
96
|
className: cn("flex items-center gap-2", className),
|
|
96
97
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-otp.js","names":[],"sources":["../../src/components/input-otp.tsx"],"sourcesContent":["import { OTPField, type OTPFieldRootProps } from '@base-ui/react/otp-field'\nimport { cva } from 'class-variance-authority'\nimport { boxChrome, GHOST_UNDERLINE } from '../lib/input-box-variants'\nimport { cn } from '../utils/cn'\nimport { useFieldControl } from './field'\n\n// One code box per slot. Mirrors Input's box/underline carrier model so the\n// slots read like the rest of the input family across every style/color knob.\nconst slotVariants = cva(\n 'flex w-11 min-w-0 items-center justify-center bg-transparent text-center text-base font-medium text-gray tabular-nums outline-hidden transition-all group-data-[invalid=true]/field:text-error placeholder:text-gray-disabled disabled:cursor-not-allowed disabled:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none',\n {\n variants: {\n chrome: {\n // inside an inset field the shell is the box; slots keep the classic\n // underline (the pre-knob default look)\n inset: GHOST_UNDERLINE,\n box: 'h-11 rounded-lg',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'brand',\n class: boxChrome.soft.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'gray',\n class: boxChrome.soft.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: boxChrome.surface.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: boxChrome.surface.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: boxChrome.outlined.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: boxChrome.outlined.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'brand',\n class: boxChrome.ghost.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'gray',\n class: boxChrome.ghost.gray,\n },\n { chrome: 'inset', inputColor: 'brand', class: 'border-b-input' },\n { chrome: 'inset', inputColor: 'gray', class: 'border-b-input-gray' },\n ],\n },\n)\n\ninterface InputOtpProps extends Pick<\n OTPFieldRootProps,\n 'value'
|
|
1
|
+
{"version":3,"file":"input-otp.js","names":[],"sources":["../../src/components/input-otp.tsx"],"sourcesContent":["import { OTPField, type OTPFieldRootProps } from '@base-ui/react/otp-field'\nimport { cva } from 'class-variance-authority'\nimport { boxChrome, GHOST_UNDERLINE } from '../lib/input-box-variants'\nimport { cn } from '../utils/cn'\nimport { useFieldControl } from './field'\n\n// One code box per slot. Mirrors Input's box/underline carrier model so the\n// slots read like the rest of the input family across every style/color knob.\nconst slotVariants = cva(\n 'flex w-11 min-w-0 items-center justify-center bg-transparent text-center text-base font-medium text-gray tabular-nums outline-hidden transition-all group-data-[invalid=true]/field:text-error placeholder:text-gray-disabled disabled:cursor-not-allowed disabled:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none',\n {\n variants: {\n chrome: {\n // inside an inset field the shell is the box; slots keep the classic\n // underline (the pre-knob default look)\n inset: GHOST_UNDERLINE,\n box: 'h-11 rounded-lg',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'brand',\n class: boxChrome.soft.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'gray',\n class: boxChrome.soft.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: boxChrome.surface.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: boxChrome.surface.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: boxChrome.outlined.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: boxChrome.outlined.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'brand',\n class: boxChrome.ghost.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'gray',\n class: boxChrome.ghost.gray,\n },\n { chrome: 'inset', inputColor: 'brand', class: 'border-b-input' },\n { chrome: 'inset', inputColor: 'gray', class: 'border-b-input-gray' },\n ],\n },\n)\n\ninterface InputOtpProps extends Pick<\n OTPFieldRootProps,\n | 'value'\n | 'defaultValue'\n | 'onValueChange'\n | 'disabled'\n | 'className'\n | 'id'\n | 'validationType'\n> {\n /** Number of code slots. */\n length?: number\n /** Fired when every slot is filled. */\n onComplete?: OTPFieldRootProps['onValueComplete']\n /** Accessible name per slot (for localization). */\n slotAriaLabel?: (index: number) => string\n}\n\nfunction InputOtp({\n length = 6,\n className,\n id: idProp,\n onComplete,\n slotAriaLabel = (index) => `Character ${index + 1}`,\n validationType = 'alphanumeric',\n ...props\n}: InputOtpProps) {\n const { field, id, ariaDescribedBy, inputStyle, inputColor } =\n useFieldControl({ id: idProp })\n const chrome = field?.labelPosition === 'inset' ? 'inset' : 'box'\n\n return (\n <OTPField.Root\n data-slot=\"input-otp\"\n length={length}\n id={id}\n validationType={validationType}\n onValueComplete={onComplete}\n className={cn('flex items-center gap-2', className)}\n {...props}\n >\n {Array.from({ length }, (_, index) => (\n <OTPField.Input\n key={index}\n // the first slot is named by the Field label (Base UI ignores\n // aria-label there); the rest get a positional name for a11y\n aria-label={index === 0 ? undefined : slotAriaLabel(index)}\n aria-describedby={index === 0 ? ariaDescribedBy : undefined}\n className={slotVariants({ chrome, inputStyle, inputColor })}\n />\n ))}\n </OTPField.Root>\n )\n}\n\nexport { InputOtp }\nexport type { InputOtpProps }\n"],"mappings":";;;;;;;;AAQA,MAAM,eAAe,IACnB,+UACA;CACE,UAAU;EACR,QAAQ;GAGN,OAAO;GACP,KAAK;EACP;EACA,YAAY;GAAE,MAAM;GAAI,SAAS;GAAI,UAAU;GAAI,OAAO;EAAG;EAC7D,YAAY;GAAE,OAAO;GAAI,MAAM;EAAG;CACpC;CACA,kBAAkB;EAChB;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,KAAK;EACxB;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,KAAK;EACxB;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,QAAQ;EAC3B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,QAAQ;EAC3B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,SAAS;EAC5B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,SAAS;EAC5B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,MAAM;EACzB;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,MAAM;EACzB;EACA;GAAE,QAAQ;GAAS,YAAY;GAAS,OAAO;EAAiB;EAChE;GAAE,QAAQ;GAAS,YAAY;GAAQ,OAAO;EAAsB;CACtE;AACF,CACF;AAoBA,SAAS,SAAS,EAChB,SAAS,GACT,WACA,IAAI,QACJ,YACA,iBAAiB,UAAU,aAAa,QAAQ,KAChD,iBAAiB,gBACjB,GAAG,SACa;CAChB,MAAM,EAAE,OAAO,IAAI,iBAAiB,YAAY,eAC9C,gBAAgB,EAAE,IAAI,OAAO,CAAC;CAChC,MAAM,SAAS,OAAO,kBAAkB,UAAU,UAAU;CAE5D,OACE,oBAAC,SAAS,MAAV;EACE,aAAU;EACF;EACJ;EACY;EAChB,iBAAiB;EACjB,WAAW,GAAG,2BAA2B,SAAS;EAClD,GAAI;YAEH,MAAM,KAAK,EAAE,OAAO,IAAI,GAAG,UAC1B,oBAAC,SAAS,OAAV;GAIE,cAAY,UAAU,IAAI,KAAA,IAAY,cAAc,KAAK;GACzD,oBAAkB,UAAU,IAAI,kBAAkB,KAAA;GAClD,WAAW,aAAa;IAAE;IAAQ;IAAY;GAAW,CAAC;EAC3D,GANM,KAMN,CACF;CACY,CAAA;AAEnB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
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_hooks_use_chart_zoom = require("../hooks/use-chart-zoom.cjs");
|
|
4
5
|
const require_hooks_use_reduced_motion = require("../hooks/use-reduced-motion.cjs");
|
|
5
6
|
const require_utils_format = require("../utils/format.cjs");
|
|
6
7
|
const require_utils_chart_scale = require("../utils/chart-scale.cjs");
|
|
7
8
|
const require_components_chart = require("./chart.cjs");
|
|
8
|
-
const require_hooks_use_chart_zoom = require("../hooks/use-chart-zoom.cjs");
|
|
9
9
|
const require_utils_chart_time_ticks = require("../utils/chart-time-ticks.cjs");
|
|
10
10
|
let react = require("react");
|
|
11
11
|
react = require_chunk.__toESM(react);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { useAnimatedChartDomain, useChartZoom } from "../hooks/use-chart-zoom.js";
|
|
3
3
|
import { useReducedMotion } from "../hooks/use-reduced-motion.js";
|
|
4
|
+
import { cn } from "../utils/cn.js";
|
|
4
5
|
import { localeNumberFormat } from "../utils/format.js";
|
|
5
6
|
import { buildYAxisScale, formatYAxisTick } from "../utils/chart-scale.js";
|
|
6
7
|
import { ChartTooltipCard, ChartZoomResetButton, clampTooltipPosition, useMeasuredSize } from "./chart.js";
|
|
7
|
-
import { useAnimatedChartDomain, useChartZoom } from "../hooks/use-chart-zoom.js";
|
|
8
8
|
import { buildTimeTicks } from "../utils/chart-time-ticks.js";
|
|
9
9
|
import * as React$1 from "react";
|
|
10
10
|
import { useCallback, useMemo } from "react";
|
|
@@ -1,9 +1,9 @@
|
|
|
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_hooks_use_reduced_motion = require("../hooks/use-reduced-motion.cjs");
|
|
4
5
|
const require_icons_material_symbol = require("../icons/material-symbol.cjs");
|
|
5
6
|
const require_components_button = require("./button.cjs");
|
|
6
|
-
const require_hooks_use_reduced_motion = require("../hooks/use-reduced-motion.cjs");
|
|
7
7
|
const require_lib_message_animations = require("../lib/message-animations.cjs");
|
|
8
8
|
let react = require("react");
|
|
9
9
|
react = require_chunk.__toESM(react);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useReducedMotion } from "../hooks/use-reduced-motion.js";
|
|
2
3
|
import { cn } from "../utils/cn.js";
|
|
3
4
|
import { MaterialSymbol } from "../icons/material-symbol.js";
|
|
4
5
|
import { Button } from "./button.js";
|
|
5
|
-
import { useReducedMotion } from "../hooks/use-reduced-motion.js";
|
|
6
6
|
import { MESSAGE_ANIMATIONS } from "../lib/message-animations.js";
|
|
7
7
|
import * as React$1 from "react";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -6,7 +6,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
6
6
|
|
|
7
7
|
//#region src/components/page-header.d.ts
|
|
8
8
|
declare const PageHeader: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLElement> & React$1.RefAttributes<HTMLElement>>;
|
|
9
|
-
declare const PageHeaderBackButton: React$1.ForwardRefExoticComponent<Omit<ButtonProps, "color" | "
|
|
9
|
+
declare const PageHeaderBackButton: React$1.ForwardRefExoticComponent<Omit<ButtonProps, "color" | "styleVariant" | "size"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
10
10
|
declare const PageHeaderTitle: ({
|
|
11
11
|
className,
|
|
12
12
|
...props
|
|
@@ -6,7 +6,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
6
6
|
|
|
7
7
|
//#region src/components/page-header.d.ts
|
|
8
8
|
declare const PageHeader: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLElement> & React$1.RefAttributes<HTMLElement>>;
|
|
9
|
-
declare const PageHeaderBackButton: React$1.ForwardRefExoticComponent<Omit<ButtonProps, "color" | "
|
|
9
|
+
declare const PageHeaderBackButton: React$1.ForwardRefExoticComponent<Omit<ButtonProps, "color" | "styleVariant" | "size"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
10
10
|
declare const PageHeaderTitle: ({
|
|
11
11
|
className,
|
|
12
12
|
...props
|
|
@@ -1,6 +1,7 @@
|
|
|
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_hooks_use_chart_zoom = require("../hooks/use-chart-zoom.cjs");
|
|
4
5
|
const require_hooks_use_reduced_motion = require("../hooks/use-reduced-motion.cjs");
|
|
5
6
|
require("../utils/chars.cjs");
|
|
6
7
|
const require_utils_format = require("../utils/format.cjs");
|
|
@@ -8,7 +9,6 @@ const require_utils_chart_scale = require("../utils/chart-scale.cjs");
|
|
|
8
9
|
const require_components_chart = require("./chart.cjs");
|
|
9
10
|
const require_components_series_legend = require("./series-legend.cjs");
|
|
10
11
|
const require_components_typography = require("./typography.cjs");
|
|
11
|
-
const require_hooks_use_chart_zoom = require("../hooks/use-chart-zoom.cjs");
|
|
12
12
|
const require_utils_chart_time_ticks = require("../utils/chart-time-ticks.cjs");
|
|
13
13
|
let react = require("react");
|
|
14
14
|
react = require_chunk.__toESM(react);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { useAnimatedChartDomain, useChartZoom } from "../hooks/use-chart-zoom.js";
|
|
3
3
|
import { useReducedMotion } from "../hooks/use-reduced-motion.js";
|
|
4
|
+
import { cn } from "../utils/cn.js";
|
|
4
5
|
import "../utils/chars.js";
|
|
5
6
|
import { twoDecimalFormat } from "../utils/format.js";
|
|
6
7
|
import { buildYAxisScale, formatYAxisTick, measureYAxisGutter } from "../utils/chart-scale.js";
|
|
7
8
|
import { ChartTooltipCard, ChartZoomResetButton, clampTooltipPosition, useMeasuredSize } from "./chart.js";
|
|
8
9
|
import { SeriesLegend } from "./series-legend.js";
|
|
9
10
|
import { SectionTitle } from "./typography.js";
|
|
10
|
-
import { useAnimatedChartDomain, useChartZoom } from "../hooks/use-chart-zoom.js";
|
|
11
11
|
import { buildTimeTicks } from "../utils/chart-time-ticks.js";
|
|
12
12
|
import * as React$1 from "react";
|
|
13
13
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
const require_hooks_use_container_width = require("../hooks/use-container-width.cjs");
|
|
2
3
|
require("../utils/chars.cjs");
|
|
3
4
|
const require_utils_format = require("../utils/format.cjs");
|
|
4
5
|
const require_components_series_legend = require("./series-legend.cjs");
|
|
5
6
|
const require_components_typography = require("./typography.cjs");
|
|
6
7
|
const require_components_line_chart = require("./line-chart.cjs");
|
|
7
|
-
const require_hooks_use_container_width = require("../hooks/use-container-width.cjs");
|
|
8
8
|
let react = require("react");
|
|
9
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
10
|
//#region src/components/power-history.tsx
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useContainerWidth } from "../hooks/use-container-width.js";
|
|
2
3
|
import "../utils/chars.js";
|
|
3
4
|
import { oneDecimalFormat } from "../utils/format.js";
|
|
4
5
|
import { SeriesLegend } from "./series-legend.js";
|
|
5
6
|
import { SectionTitle } from "./typography.js";
|
|
6
7
|
import { LineChart } from "./line-chart.js";
|
|
7
|
-
import { useContainerWidth } from "../hooks/use-container-width.js";
|
|
8
8
|
import { useCallback, useMemo, useState } from "react";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/components/power-history.tsx
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_icons_material_symbol = require("../icons/material-symbol.cjs");
|
|
4
3
|
const require_hooks_use_reduced_motion = require("../hooks/use-reduced-motion.cjs");
|
|
4
|
+
const require_icons_material_symbol = require("../icons/material-symbol.cjs");
|
|
5
5
|
const require_components_typography = require("./typography.cjs");
|
|
6
6
|
const require_components_number_flow = require("./number-flow.cjs");
|
|
7
7
|
const require_components_skeleton = require("./skeleton.cjs");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useReducedMotion } from "../hooks/use-reduced-motion.js";
|
|
2
3
|
import { cn } from "../utils/cn.js";
|
|
3
4
|
import { MaterialSymbol } from "../icons/material-symbol.js";
|
|
4
|
-
import { useReducedMotion } from "../hooks/use-reduced-motion.js";
|
|
5
5
|
import { SectionTitle } from "./typography.js";
|
|
6
6
|
import NumberFlow from "./number-flow.js";
|
|
7
7
|
import { Skeleton } from "./skeleton.js";
|
|
@@ -9,6 +9,7 @@ let react_dom = require("react-dom");
|
|
|
9
9
|
const supportsMoveBefore = typeof Element !== "undefined" && "moveBefore" in Element.prototype;
|
|
10
10
|
function useReparent() {
|
|
11
11
|
const [host, setHost] = react.useState(null);
|
|
12
|
+
const [parkCount, setParkCount] = react.useState(0);
|
|
12
13
|
react.useEffect(() => {
|
|
13
14
|
const el = document.createElement("div");
|
|
14
15
|
el.style.display = "contents";
|
|
@@ -16,15 +17,25 @@ function useReparent() {
|
|
|
16
17
|
return () => el.remove();
|
|
17
18
|
}, []);
|
|
18
19
|
const park = react.useCallback(() => {
|
|
19
|
-
if (supportsMoveBefore
|
|
20
|
-
|
|
20
|
+
if (!supportsMoveBefore || !host?.isConnected) return;
|
|
21
|
+
if (host.parentElement === document.body) return;
|
|
22
|
+
try {
|
|
21
23
|
document.body.moveBefore(host, null);
|
|
24
|
+
} catch {
|
|
25
|
+
return;
|
|
22
26
|
}
|
|
27
|
+
host.style.display = "none";
|
|
28
|
+
setParkCount((count) => count + 1);
|
|
23
29
|
}, [host]);
|
|
24
30
|
return react.useMemo(() => ({
|
|
25
31
|
host,
|
|
26
|
-
park
|
|
27
|
-
|
|
32
|
+
park,
|
|
33
|
+
parkCount
|
|
34
|
+
}), [
|
|
35
|
+
host,
|
|
36
|
+
park,
|
|
37
|
+
parkCount
|
|
38
|
+
]);
|
|
28
39
|
}
|
|
29
40
|
function ReparentContent({ handle, children }) {
|
|
30
41
|
if (!handle.host) return null;
|
|
@@ -32,14 +43,17 @@ function ReparentContent({ handle, children }) {
|
|
|
32
43
|
}
|
|
33
44
|
function ReparentSlot({ handle, ...props }) {
|
|
34
45
|
const ref = react.useRef(null);
|
|
35
|
-
const host = handle
|
|
46
|
+
const { host, parkCount } = handle;
|
|
36
47
|
react.useLayoutEffect(() => {
|
|
37
48
|
const slot = ref.current;
|
|
38
|
-
if (!slot || !host) return;
|
|
49
|
+
if (!slot || !host || host.parentElement === slot) return;
|
|
39
50
|
host.style.display = "contents";
|
|
40
|
-
if (supportsMoveBefore && host.isConnected
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
if (supportsMoveBefore && host.isConnected === slot.isConnected) try {
|
|
52
|
+
slot.moveBefore(host, null);
|
|
53
|
+
return;
|
|
54
|
+
} catch {}
|
|
55
|
+
slot.appendChild(host);
|
|
56
|
+
}, [host, parkCount]);
|
|
43
57
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
44
58
|
"data-slot": "reparent-slot",
|
|
45
59
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reparent.cjs","names":["React"],"sources":["../../src/components/reparent.tsx"],"sourcesContent":["import * as React from 'react'\nimport { createPortal } from 'react-dom'\n\n// moveBefore ships in Chrome/Edge 133+, Firefox 144+; Safari has no state-preserving move\nconst supportsMoveBefore =\n typeof Element !== 'undefined' && 'moveBefore' in Element.prototype\n\ntype MovableElement = Element & {\n moveBefore: (node: Node, child: Node | null) => void\n}\n\ninterface ReparentHandle {\n host: HTMLElement | null\n park: () => void\n}\n\n// host created after mount so server and client hydrate the same (empty) markup\nfunction useReparent(): ReparentHandle {\n const [host, setHost] = React.useState<HTMLElement | null>(null)\n React.useEffect(() => {\n const el = document.createElement('div')\n el.style.display = 'contents'\n setHost(el)\n return () => el.remove()\n }, [])\n const park = React.useCallback(() => {\n if (supportsMoveBefore
|
|
1
|
+
{"version":3,"file":"reparent.cjs","names":["React"],"sources":["../../src/components/reparent.tsx"],"sourcesContent":["import * as React from 'react'\nimport { createPortal } from 'react-dom'\n\n// moveBefore ships in Chrome/Edge 133+, Firefox 144+; Safari has no state-preserving move\nconst supportsMoveBefore =\n typeof Element !== 'undefined' && 'moveBefore' in Element.prototype\n\ntype MovableElement = Element & {\n moveBefore: (node: Node, child: Node | null) => void\n}\n\ninterface ReparentHandle {\n host: HTMLElement | null\n park: () => void\n parkCount?: number\n}\n\n// host created after mount so server and client hydrate the same (empty) markup\nfunction useReparent(): ReparentHandle {\n const [host, setHost] = React.useState<HTMLElement | null>(null)\n const [parkCount, setParkCount] = React.useState(0)\n React.useEffect(() => {\n const el = document.createElement('div')\n el.style.display = 'contents'\n setHost(el)\n return () => el.remove()\n }, [])\n const park = React.useCallback(() => {\n if (!supportsMoveBefore || !host?.isConnected) return\n if (host.parentElement === document.body) return\n try {\n ;(document.body as unknown as MovableElement).moveBefore(host, null)\n } catch {\n return\n }\n host.style.display = 'none'\n // re-runs every slot's adopt effect, so a park with no layout swap still recovers\n setParkCount((count) => count + 1)\n }, [host])\n return React.useMemo(\n () => ({ host, park, parkCount }),\n [host, park, parkCount],\n )\n}\n\nfunction ReparentContent({\n handle,\n children,\n}: {\n handle: ReparentHandle\n children: React.ReactNode\n}) {\n if (!handle.host) return null\n return createPortal(children, handle.host)\n}\n\ninterface ReparentSlotProps extends React.ComponentProps<'div'> {\n handle: ReparentHandle\n}\n\nfunction ReparentSlot({ handle, ...props }: ReparentSlotProps) {\n const ref = React.useRef<HTMLDivElement>(null)\n const { host, parkCount } = handle\n React.useLayoutEffect(() => {\n const slot = ref.current\n if (!slot || !host || host.parentElement === slot) return\n host.style.display = 'contents'\n // moveBefore throws unless node and new parent are both connected or both detached\n if (supportsMoveBefore && host.isConnected === slot.isConnected) {\n try {\n ;(slot as unknown as MovableElement).moveBefore(host, null)\n return\n } catch {}\n }\n slot.appendChild(host)\n }, [host, parkCount])\n return <div data-slot=\"reparent-slot\" ref={ref} {...props} />\n}\n\nexport { ReparentContent, ReparentSlot, supportsMoveBefore, useReparent }\nexport type { ReparentHandle, ReparentSlotProps }\n"],"mappings":";;;;;;;;AAIA,MAAM,qBACJ,OAAO,YAAY,eAAe,gBAAgB,QAAQ;AAa5D,SAAS,cAA8B;CACrC,MAAM,CAAC,MAAM,WAAWA,MAAM,SAA6B,IAAI;CAC/D,MAAM,CAAC,WAAW,gBAAgBA,MAAM,SAAS,CAAC;CAClD,MAAM,gBAAgB;EACpB,MAAM,KAAK,SAAS,cAAc,KAAK;EACvC,GAAG,MAAM,UAAU;EACnB,QAAQ,EAAE;EACV,aAAa,GAAG,OAAO;CACzB,GAAG,CAAC,CAAC;CACL,MAAM,OAAOA,MAAM,kBAAkB;EACnC,IAAI,CAAC,sBAAsB,CAAC,MAAM,aAAa;EAC/C,IAAI,KAAK,kBAAkB,SAAS,MAAM;EAC1C,IAAI;GACD,SAAU,KAAmC,WAAW,MAAM,IAAI;EACrE,QAAQ;GACN;EACF;EACA,KAAK,MAAM,UAAU;EAErB,cAAc,UAAU,QAAQ,CAAC;CACnC,GAAG,CAAC,IAAI,CAAC;CACT,OAAOA,MAAM,eACJ;EAAE;EAAM;EAAM;CAAU,IAC/B;EAAC;EAAM;EAAM;CAAS,CACxB;AACF;AAEA,SAAS,gBAAgB,EACvB,QACA,YAIC;CACD,IAAI,CAAC,OAAO,MAAM,OAAO;CACzB,QAAA,GAAA,UAAA,cAAoB,UAAU,OAAO,IAAI;AAC3C;AAMA,SAAS,aAAa,EAAE,QAAQ,GAAG,SAA4B;CAC7D,MAAM,MAAMA,MAAM,OAAuB,IAAI;CAC7C,MAAM,EAAE,MAAM,cAAc;CAC5B,MAAM,sBAAsB;EAC1B,MAAM,OAAO,IAAI;EACjB,IAAI,CAAC,QAAQ,CAAC,QAAQ,KAAK,kBAAkB,MAAM;EACnD,KAAK,MAAM,UAAU;EAErB,IAAI,sBAAsB,KAAK,gBAAgB,KAAK,aAClD,IAAI;GACD,KAAoC,WAAW,MAAM,IAAI;GAC1D;EACF,QAAQ,CAAC;EAEX,KAAK,YAAY,IAAI;CACvB,GAAG,CAAC,MAAM,SAAS,CAAC;CACpB,OAAO,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAAK,aAAU;EAAqB;EAAK,GAAI;CAAQ,CAAA;AAC9D"}
|
|
@@ -6,6 +6,7 @@ import { createPortal } from "react-dom";
|
|
|
6
6
|
const supportsMoveBefore = typeof Element !== "undefined" && "moveBefore" in Element.prototype;
|
|
7
7
|
function useReparent() {
|
|
8
8
|
const [host, setHost] = React$1.useState(null);
|
|
9
|
+
const [parkCount, setParkCount] = React$1.useState(0);
|
|
9
10
|
React$1.useEffect(() => {
|
|
10
11
|
const el = document.createElement("div");
|
|
11
12
|
el.style.display = "contents";
|
|
@@ -13,15 +14,25 @@ function useReparent() {
|
|
|
13
14
|
return () => el.remove();
|
|
14
15
|
}, []);
|
|
15
16
|
const park = React$1.useCallback(() => {
|
|
16
|
-
if (supportsMoveBefore
|
|
17
|
-
|
|
17
|
+
if (!supportsMoveBefore || !host?.isConnected) return;
|
|
18
|
+
if (host.parentElement === document.body) return;
|
|
19
|
+
try {
|
|
18
20
|
document.body.moveBefore(host, null);
|
|
21
|
+
} catch {
|
|
22
|
+
return;
|
|
19
23
|
}
|
|
24
|
+
host.style.display = "none";
|
|
25
|
+
setParkCount((count) => count + 1);
|
|
20
26
|
}, [host]);
|
|
21
27
|
return React$1.useMemo(() => ({
|
|
22
28
|
host,
|
|
23
|
-
park
|
|
24
|
-
|
|
29
|
+
park,
|
|
30
|
+
parkCount
|
|
31
|
+
}), [
|
|
32
|
+
host,
|
|
33
|
+
park,
|
|
34
|
+
parkCount
|
|
35
|
+
]);
|
|
25
36
|
}
|
|
26
37
|
function ReparentContent({ handle, children }) {
|
|
27
38
|
if (!handle.host) return null;
|
|
@@ -29,14 +40,17 @@ function ReparentContent({ handle, children }) {
|
|
|
29
40
|
}
|
|
30
41
|
function ReparentSlot({ handle, ...props }) {
|
|
31
42
|
const ref = React$1.useRef(null);
|
|
32
|
-
const host = handle
|
|
43
|
+
const { host, parkCount } = handle;
|
|
33
44
|
React$1.useLayoutEffect(() => {
|
|
34
45
|
const slot = ref.current;
|
|
35
|
-
if (!slot || !host) return;
|
|
46
|
+
if (!slot || !host || host.parentElement === slot) return;
|
|
36
47
|
host.style.display = "contents";
|
|
37
|
-
if (supportsMoveBefore && host.isConnected
|
|
38
|
-
|
|
39
|
-
|
|
48
|
+
if (supportsMoveBefore && host.isConnected === slot.isConnected) try {
|
|
49
|
+
slot.moveBefore(host, null);
|
|
50
|
+
return;
|
|
51
|
+
} catch {}
|
|
52
|
+
slot.appendChild(host);
|
|
53
|
+
}, [host, parkCount]);
|
|
40
54
|
return /* @__PURE__ */ jsx("div", {
|
|
41
55
|
"data-slot": "reparent-slot",
|
|
42
56
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reparent.js","names":["React"],"sources":["../../src/components/reparent.tsx"],"sourcesContent":["import * as React from 'react'\nimport { createPortal } from 'react-dom'\n\n// moveBefore ships in Chrome/Edge 133+, Firefox 144+; Safari has no state-preserving move\nconst supportsMoveBefore =\n typeof Element !== 'undefined' && 'moveBefore' in Element.prototype\n\ntype MovableElement = Element & {\n moveBefore: (node: Node, child: Node | null) => void\n}\n\ninterface ReparentHandle {\n host: HTMLElement | null\n park: () => void\n}\n\n// host created after mount so server and client hydrate the same (empty) markup\nfunction useReparent(): ReparentHandle {\n const [host, setHost] = React.useState<HTMLElement | null>(null)\n React.useEffect(() => {\n const el = document.createElement('div')\n el.style.display = 'contents'\n setHost(el)\n return () => el.remove()\n }, [])\n const park = React.useCallback(() => {\n if (supportsMoveBefore
|
|
1
|
+
{"version":3,"file":"reparent.js","names":["React"],"sources":["../../src/components/reparent.tsx"],"sourcesContent":["import * as React from 'react'\nimport { createPortal } from 'react-dom'\n\n// moveBefore ships in Chrome/Edge 133+, Firefox 144+; Safari has no state-preserving move\nconst supportsMoveBefore =\n typeof Element !== 'undefined' && 'moveBefore' in Element.prototype\n\ntype MovableElement = Element & {\n moveBefore: (node: Node, child: Node | null) => void\n}\n\ninterface ReparentHandle {\n host: HTMLElement | null\n park: () => void\n parkCount?: number\n}\n\n// host created after mount so server and client hydrate the same (empty) markup\nfunction useReparent(): ReparentHandle {\n const [host, setHost] = React.useState<HTMLElement | null>(null)\n const [parkCount, setParkCount] = React.useState(0)\n React.useEffect(() => {\n const el = document.createElement('div')\n el.style.display = 'contents'\n setHost(el)\n return () => el.remove()\n }, [])\n const park = React.useCallback(() => {\n if (!supportsMoveBefore || !host?.isConnected) return\n if (host.parentElement === document.body) return\n try {\n ;(document.body as unknown as MovableElement).moveBefore(host, null)\n } catch {\n return\n }\n host.style.display = 'none'\n // re-runs every slot's adopt effect, so a park with no layout swap still recovers\n setParkCount((count) => count + 1)\n }, [host])\n return React.useMemo(\n () => ({ host, park, parkCount }),\n [host, park, parkCount],\n )\n}\n\nfunction ReparentContent({\n handle,\n children,\n}: {\n handle: ReparentHandle\n children: React.ReactNode\n}) {\n if (!handle.host) return null\n return createPortal(children, handle.host)\n}\n\ninterface ReparentSlotProps extends React.ComponentProps<'div'> {\n handle: ReparentHandle\n}\n\nfunction ReparentSlot({ handle, ...props }: ReparentSlotProps) {\n const ref = React.useRef<HTMLDivElement>(null)\n const { host, parkCount } = handle\n React.useLayoutEffect(() => {\n const slot = ref.current\n if (!slot || !host || host.parentElement === slot) return\n host.style.display = 'contents'\n // moveBefore throws unless node and new parent are both connected or both detached\n if (supportsMoveBefore && host.isConnected === slot.isConnected) {\n try {\n ;(slot as unknown as MovableElement).moveBefore(host, null)\n return\n } catch {}\n }\n slot.appendChild(host)\n }, [host, parkCount])\n return <div data-slot=\"reparent-slot\" ref={ref} {...props} />\n}\n\nexport { ReparentContent, ReparentSlot, supportsMoveBefore, useReparent }\nexport type { ReparentHandle, ReparentSlotProps }\n"],"mappings":";;;;;AAIA,MAAM,qBACJ,OAAO,YAAY,eAAe,gBAAgB,QAAQ;AAa5D,SAAS,cAA8B;CACrC,MAAM,CAAC,MAAM,WAAWA,QAAM,SAA6B,IAAI;CAC/D,MAAM,CAAC,WAAW,gBAAgBA,QAAM,SAAS,CAAC;CAClD,QAAM,gBAAgB;EACpB,MAAM,KAAK,SAAS,cAAc,KAAK;EACvC,GAAG,MAAM,UAAU;EACnB,QAAQ,EAAE;EACV,aAAa,GAAG,OAAO;CACzB,GAAG,CAAC,CAAC;CACL,MAAM,OAAOA,QAAM,kBAAkB;EACnC,IAAI,CAAC,sBAAsB,CAAC,MAAM,aAAa;EAC/C,IAAI,KAAK,kBAAkB,SAAS,MAAM;EAC1C,IAAI;GACD,SAAU,KAAmC,WAAW,MAAM,IAAI;EACrE,QAAQ;GACN;EACF;EACA,KAAK,MAAM,UAAU;EAErB,cAAc,UAAU,QAAQ,CAAC;CACnC,GAAG,CAAC,IAAI,CAAC;CACT,OAAOA,QAAM,eACJ;EAAE;EAAM;EAAM;CAAU,IAC/B;EAAC;EAAM;EAAM;CAAS,CACxB;AACF;AAEA,SAAS,gBAAgB,EACvB,QACA,YAIC;CACD,IAAI,CAAC,OAAO,MAAM,OAAO;CACzB,OAAO,aAAa,UAAU,OAAO,IAAI;AAC3C;AAMA,SAAS,aAAa,EAAE,QAAQ,GAAG,SAA4B;CAC7D,MAAM,MAAMA,QAAM,OAAuB,IAAI;CAC7C,MAAM,EAAE,MAAM,cAAc;CAC5B,QAAM,sBAAsB;EAC1B,MAAM,OAAO,IAAI;EACjB,IAAI,CAAC,QAAQ,CAAC,QAAQ,KAAK,kBAAkB,MAAM;EACnD,KAAK,MAAM,UAAU;EAErB,IAAI,sBAAsB,KAAK,gBAAgB,KAAK,aAClD,IAAI;GACD,KAAoC,WAAW,MAAM,IAAI;GAC1D;EACF,QAAQ,CAAC;EAEX,KAAK,YAAY,IAAI;CACvB,GAAG,CAAC,MAAM,SAAS,CAAC;CACpB,OAAO,oBAAC,OAAD;EAAK,aAAU;EAAqB;EAAK,GAAI;CAAQ,CAAA;AAC9D"}
|