@epilot/spark-ui 0.25.1 → 0.26.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.map +1 -1
- package/dist/components/accordion.d.cts +1 -1
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.cjs +5 -3
- package/dist/components/alert-dialog.cjs.map +1 -1
- package/dist/components/alert-dialog.d.cts +4 -1
- package/dist/components/alert-dialog.d.ts +4 -1
- package/dist/components/alert-dialog.js +5 -3
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/autocomplete.cjs +3 -2
- package/dist/components/autocomplete.cjs.map +1 -1
- package/dist/components/autocomplete.js +3 -2
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.js +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/banner.cjs +74 -0
- package/dist/components/banner.cjs.map +1 -0
- package/dist/components/banner.d.cts +27 -0
- package/dist/components/banner.d.ts +27 -0
- package/dist/components/banner.js +72 -0
- package/dist/components/banner.js.map +1 -0
- package/dist/components/box.js +1 -1
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/button-group.js +1 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js +1 -1
- package/dist/components/callout.cjs +1 -1
- package/dist/components/callout.cjs.map +1 -1
- package/dist/components/callout.js +1 -1
- package/dist/components/callout.js.map +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/data-list.cjs +39 -0
- package/dist/components/data-list.cjs.map +1 -0
- package/dist/components/data-list.d.cts +33 -0
- package/dist/components/data-list.d.ts +33 -0
- package/dist/components/data-list.js +35 -0
- package/dist/components/data-list.js.map +1 -0
- package/dist/components/dialog.cjs +5 -3
- package/dist/components/dialog.cjs.map +1 -1
- package/dist/components/dialog.d.cts +4 -1
- package/dist/components/dialog.d.ts +4 -1
- package/dist/components/dialog.js +5 -3
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/drawer.cjs +13 -3
- package/dist/components/drawer.cjs.map +1 -1
- package/dist/components/drawer.d.cts +4 -1
- package/dist/components/drawer.d.ts +4 -1
- package/dist/components/drawer.js +14 -4
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +5 -3
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/dropdown-menu.d.cts +1 -0
- package/dist/components/dropdown-menu.d.ts +1 -0
- package/dist/components/dropdown-menu.js +5 -3
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty-state.cjs +97 -25
- package/dist/components/empty-state.cjs.map +1 -1
- package/dist/components/empty-state.d.cts +28 -11
- package/dist/components/empty-state.d.ts +28 -11
- package/dist/components/empty-state.js +94 -26
- package/dist/components/empty-state.js.map +1 -1
- package/dist/components/energy-breakdown.cjs +1 -1
- package/dist/components/energy-breakdown.cjs.map +1 -1
- package/dist/components/energy-breakdown.js +1 -1
- package/dist/components/energy-breakdown.js.map +1 -1
- package/dist/components/entity-card.cjs +1 -1
- package/dist/components/entity-card.cjs.map +1 -1
- package/dist/components/entity-card.js +1 -1
- package/dist/components/entity-card.js.map +1 -1
- package/dist/components/field.cjs +4 -4
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/field.js +4 -4
- package/dist/components/field.js.map +1 -1
- package/dist/components/icon.js +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/kbd.cjs +14 -0
- package/dist/components/kbd.cjs.map +1 -0
- package/dist/components/kbd.d.cts +13 -0
- package/dist/components/kbd.d.ts +13 -0
- package/dist/components/kbd.js +13 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/marker.d.cts +1 -1
- package/dist/components/marker.d.ts +1 -1
- package/dist/components/message-scroller.cjs +2 -2
- package/dist/components/message-scroller.cjs.map +1 -1
- package/dist/components/message-scroller.js +2 -2
- package/dist/components/message-scroller.js.map +1 -1
- package/dist/components/pill.js +1 -1
- package/dist/components/popover.cjs +3 -2
- package/dist/components/popover.cjs.map +1 -1
- package/dist/components/popover.js +3 -2
- package/dist/components/popover.js.map +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/schedule-list.cjs +1 -1
- package/dist/components/schedule-list.cjs.map +1 -1
- package/dist/components/schedule-list.js +1 -1
- package/dist/components/schedule-list.js.map +1 -1
- package/dist/components/select.cjs +4 -3
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.js +4 -3
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +35 -17
- package/dist/components/separator.cjs.map +1 -1
- package/dist/components/separator.d.cts +1 -0
- package/dist/components/separator.d.ts +1 -0
- package/dist/components/separator.js +35 -17
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.cjs +4 -2
- package/dist/components/sheet.cjs.map +1 -1
- package/dist/components/sheet.d.cts +4 -1
- package/dist/components/sheet.d.ts +4 -1
- package/dist/components/sheet.js +4 -2
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/stat-card.cjs +1 -1
- package/dist/components/stat-card.cjs.map +1 -1
- package/dist/components/stat-card.js +1 -1
- package/dist/components/stat-card.js.map +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/textarea.cjs +1 -1
- package/dist/components/textarea.js +1 -1
- package/dist/components/theme.cjs +118 -24
- package/dist/components/theme.cjs.map +1 -1
- package/dist/components/theme.d.cts +7 -1
- package/dist/components/theme.d.ts +7 -1
- package/dist/components/theme.js +120 -27
- package/dist/components/theme.js.map +1 -1
- package/dist/components/toast.cjs +4 -3
- package/dist/components/toast.cjs.map +1 -1
- package/dist/components/toast.js +4 -3
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/toggle.cjs +1 -1
- package/dist/components/toggle.js +2 -2
- package/dist/components/tooltip.cjs +5 -3
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/tooltip.d.cts +1 -0
- package/dist/components/tooltip.d.ts +1 -0
- package/dist/components/tooltip.js +5 -3
- package/dist/components/tooltip.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-state.cjs","names":["Icon"],"sources":["../../src/components/empty-state.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport type
|
|
1
|
+
{"version":3,"file":"empty-state.cjs","names":["Icon"],"sources":["../../src/components/empty-state.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport {\n createContext,\n type HTMLAttributes,\n type ReactNode,\n useContext,\n} from 'react'\nimport { cn } from '../utils/cn'\nimport { Icon } from './icon'\n\nconst emptyStateVariants = cva('flex', {\n variants: {\n variant: {\n dashed: 'rounded-lg border border-dashed border-gray',\n ghost: '',\n },\n size: { default: '', sm: '' },\n layout: {\n stacked: 'flex-col items-center text-center',\n inline: 'flex-row items-start text-left',\n },\n },\n compoundVariants: [\n { layout: 'stacked', size: 'default', class: 'gap-4 px-6 py-12' },\n { layout: 'stacked', size: 'sm', class: 'gap-2 px-4 py-5' },\n { layout: 'inline', size: 'default', class: 'gap-4 p-6' },\n { layout: 'inline', size: 'sm', class: 'gap-3 px-4 py-3' },\n ],\n defaultVariants: {\n variant: 'dashed',\n size: 'default',\n layout: 'stacked',\n },\n})\n\ntype EmptyStateVariants = VariantProps<typeof emptyStateVariants>\n\n// A leftover `title` would otherwise compile and render as a tooltip, not a heading.\ninterface EmptyStateProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'title'>,\n Pick<EmptyStateVariants, 'variant'> {\n // null would switch off the compound cells and drop all padding and gap\n size?: NonNullable<EmptyStateVariants['size']>\n layout?: NonNullable<EmptyStateVariants['layout']>\n icon?: SparkIcon\n children: ReactNode\n}\n\nconst EmptyStateContext = createContext<{\n size: NonNullable<EmptyStateVariants['size']>\n layout: NonNullable<EmptyStateVariants['layout']>\n}>({ size: 'default', layout: 'stacked' })\n\nfunction EmptyStateTitle({\n className,\n ...props\n}: HTMLAttributes<HTMLHeadingElement>) {\n const { size } = useContext(EmptyStateContext)\n return (\n <h3\n data-slot=\"empty-state-title\"\n className={cn(\n 'text-gray',\n size === 'sm' ? 'text-sm font-semibold' : 'text-base font-bold',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyStateDescription({\n className,\n ...props\n}: HTMLAttributes<HTMLParagraphElement>) {\n const { size, layout } = useContext(EmptyStateContext)\n return (\n <p\n data-slot=\"empty-state-description\"\n className={cn(\n layout !== 'inline' && 'mx-auto',\n 'max-w-md text-gray-light',\n size === 'sm' ? 'text-xs' : 'text-sm',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyStateActions({\n className,\n ...props\n}: HTMLAttributes<HTMLDivElement>) {\n const { layout } = useContext(EmptyStateContext)\n return (\n <div\n data-slot=\"empty-state-actions\"\n className={cn(\n 'mt-2 flex flex-wrap gap-2',\n layout === 'stacked' && 'justify-center',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyState({\n children,\n className,\n icon: Glyph,\n layout = 'stacked',\n size = 'default',\n variant,\n ...props\n}: EmptyStateProps) {\n return (\n <EmptyStateContext.Provider value={{ size, layout }}>\n <div\n data-slot=\"empty-state\"\n className={cn(emptyStateVariants({ variant, size, layout }), className)}\n {...props}\n >\n {Glyph ? (\n <Icon size={size === 'sm' ? 'small' : 'xl'}>\n <Glyph />\n </Icon>\n ) : null}\n <div\n className={cn(\n 'flex flex-col gap-2',\n layout === 'inline' && 'min-w-0 flex-1',\n )}\n >\n {children}\n </div>\n </div>\n </EmptyStateContext.Provider>\n )\n}\n\nexport { EmptyState, EmptyStateActions, EmptySt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AA,kBAAA,KAAC,OAAD;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IACE,6BACA,WAAW,aAAa,kBACxB,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAClB,UACA,WACA,MAAM,OACN,SAAS,WACT,OAAO,WACP,SACA,GAAG,SACe;CAClB,OACE,iBAAA,GAAA,kBAAA,KAAC,kBAAkB,UAAnB;EAA4B,OAAO;GAAE;GAAM;EAAO;YAChD,iBAAA,GAAA,kBAAA,MAAC,OAAD;GACE,aAAU;GACV,YAAA,GAAA,GAAA,IAAc,mBAAmB;IAAE;IAAS;IAAM;GAAO,CAAC,GAAG,SAAS;GACtE,GAAI;aAHN,CAKG,QACC,iBAAA,GAAA,kBAAA,KAACA,wBAAAA,MAAD;IAAM,MAAM,SAAS,OAAO,UAAU;cACpC,iBAAA,GAAA,kBAAA,KAAC,OAAD,CAAQ,CAAA;GACJ,CAAA,IACJ,MACJ,iBAAA,GAAA,kBAAA,KAAC,OAAD;IACE,YAAA,GAAA,GAAA,IACE,uBACA,WAAW,YAAY,gBACzB;IAEC;GACE,CAAA,CACF;;CACqB,CAAA;AAEhC"}
|
|
@@ -1,26 +1,43 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { ReactNode } from "react";
|
|
3
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
4
4
|
import { VariantProps } from "class-variance-authority";
|
|
5
5
|
import { SparkIcon } from "@epilot/spark-icons";
|
|
6
6
|
|
|
7
7
|
//#region src/components/empty-state.d.ts
|
|
8
8
|
declare const emptyStateVariants: (props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "dashed" | "ghost" | null | undefined;
|
|
10
|
+
size?: "default" | "sm" | null | undefined;
|
|
11
|
+
layout?: "stacked" | "inline" | null | undefined;
|
|
10
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
type EmptyStateVariants = VariantProps<typeof emptyStateVariants>;
|
|
14
|
+
interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>, Pick<EmptyStateVariants, 'variant'> {
|
|
15
|
+
size?: NonNullable<EmptyStateVariants['size']>;
|
|
16
|
+
layout?: NonNullable<EmptyStateVariants['layout']>;
|
|
14
17
|
icon?: SparkIcon;
|
|
15
|
-
|
|
18
|
+
children: ReactNode;
|
|
16
19
|
}
|
|
20
|
+
declare function EmptyStateTitle({
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}: HTMLAttributes<HTMLHeadingElement>): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare function EmptyStateDescription({
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: HTMLAttributes<HTMLParagraphElement>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare function EmptyStateActions({
|
|
29
|
+
className,
|
|
30
|
+
...props
|
|
31
|
+
}: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
17
32
|
declare function EmptyState({
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
children,
|
|
34
|
+
className,
|
|
20
35
|
icon: Glyph,
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
layout,
|
|
37
|
+
size,
|
|
38
|
+
variant,
|
|
39
|
+
...props
|
|
23
40
|
}: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
24
41
|
//#endregion
|
|
25
|
-
export { EmptyState, type EmptyStateProps };
|
|
42
|
+
export { EmptyState, EmptyStateActions, EmptyStateDescription, type EmptyStateProps, EmptyStateTitle };
|
|
26
43
|
//# sourceMappingURL=empty-state.d.cts.map
|
|
@@ -1,26 +1,43 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { ReactNode } from "react";
|
|
3
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
4
4
|
import { SparkIcon } from "@epilot/spark-icons";
|
|
5
5
|
import { VariantProps } from "class-variance-authority";
|
|
6
6
|
|
|
7
7
|
//#region src/components/empty-state.d.ts
|
|
8
8
|
declare const emptyStateVariants: (props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "dashed" | "ghost" | null | undefined;
|
|
10
|
+
size?: "default" | "sm" | null | undefined;
|
|
11
|
+
layout?: "stacked" | "inline" | null | undefined;
|
|
10
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
type EmptyStateVariants = VariantProps<typeof emptyStateVariants>;
|
|
14
|
+
interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>, Pick<EmptyStateVariants, 'variant'> {
|
|
15
|
+
size?: NonNullable<EmptyStateVariants['size']>;
|
|
16
|
+
layout?: NonNullable<EmptyStateVariants['layout']>;
|
|
14
17
|
icon?: SparkIcon;
|
|
15
|
-
|
|
18
|
+
children: ReactNode;
|
|
16
19
|
}
|
|
20
|
+
declare function EmptyStateTitle({
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}: HTMLAttributes<HTMLHeadingElement>): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare function EmptyStateDescription({
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: HTMLAttributes<HTMLParagraphElement>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare function EmptyStateActions({
|
|
29
|
+
className,
|
|
30
|
+
...props
|
|
31
|
+
}: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
17
32
|
declare function EmptyState({
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
children,
|
|
34
|
+
className,
|
|
20
35
|
icon: Glyph,
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
layout,
|
|
37
|
+
size,
|
|
38
|
+
variant,
|
|
39
|
+
...props
|
|
23
40
|
}: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
24
41
|
//#endregion
|
|
25
|
-
export { EmptyState, type EmptyStateProps };
|
|
42
|
+
export { EmptyState, EmptyStateActions, EmptyStateDescription, type EmptyStateProps, EmptyStateTitle };
|
|
26
43
|
//# sourceMappingURL=empty-state.d.ts.map
|
|
@@ -1,38 +1,106 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { cn } from "../utils/cn.js";
|
|
2
3
|
import { Icon } from "./icon.js";
|
|
4
|
+
import { createContext, useContext } from "react";
|
|
3
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
6
|
import { cva } from "class-variance-authority";
|
|
5
7
|
//#region src/components/empty-state.tsx
|
|
6
|
-
const emptyStateVariants = cva("flex
|
|
7
|
-
variants: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const emptyStateVariants = cva("flex", {
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
dashed: "rounded-lg border border-dashed border-gray",
|
|
12
|
+
ghost: ""
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
default: "",
|
|
16
|
+
sm: ""
|
|
17
|
+
},
|
|
18
|
+
layout: {
|
|
19
|
+
stacked: "flex-col items-center text-center",
|
|
20
|
+
inline: "flex-row items-start text-left"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
compoundVariants: [
|
|
24
|
+
{
|
|
25
|
+
layout: "stacked",
|
|
26
|
+
size: "default",
|
|
27
|
+
class: "gap-4 px-6 py-12"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
layout: "stacked",
|
|
31
|
+
size: "sm",
|
|
32
|
+
class: "gap-2 px-4 py-5"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
layout: "inline",
|
|
36
|
+
size: "default",
|
|
37
|
+
class: "gap-4 p-6"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
layout: "inline",
|
|
41
|
+
size: "sm",
|
|
42
|
+
class: "gap-3 px-4 py-3"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
variant: "dashed",
|
|
47
|
+
size: "default",
|
|
48
|
+
layout: "stacked"
|
|
49
|
+
}
|
|
12
50
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
51
|
+
const EmptyStateContext = createContext({
|
|
52
|
+
size: "default",
|
|
53
|
+
layout: "stacked"
|
|
54
|
+
});
|
|
55
|
+
function EmptyStateTitle({ className, ...props }) {
|
|
56
|
+
const { size } = useContext(EmptyStateContext);
|
|
57
|
+
return /* @__PURE__ */ jsx("h3", {
|
|
58
|
+
"data-slot": "empty-state-title",
|
|
59
|
+
className: cn("text-gray", size === "sm" ? "text-sm font-semibold" : "text-base font-bold", className),
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function EmptyStateDescription({ className, ...props }) {
|
|
64
|
+
const { size, layout } = useContext(EmptyStateContext);
|
|
65
|
+
return /* @__PURE__ */ jsx("p", {
|
|
66
|
+
"data-slot": "empty-state-description",
|
|
67
|
+
className: cn(layout !== "inline" && "mx-auto", "max-w-md text-gray-light", size === "sm" ? "text-xs" : "text-sm", className),
|
|
68
|
+
...props
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function EmptyStateActions({ className, ...props }) {
|
|
72
|
+
const { layout } = useContext(EmptyStateContext);
|
|
73
|
+
return /* @__PURE__ */ jsx("div", {
|
|
74
|
+
"data-slot": "empty-state-actions",
|
|
75
|
+
className: cn("mt-2 flex flex-wrap gap-2", layout === "stacked" && "justify-center", className),
|
|
76
|
+
...props
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function EmptyState({ children, className, icon: Glyph, layout = "stacked", size = "default", variant, ...props }) {
|
|
80
|
+
return /* @__PURE__ */ jsx(EmptyStateContext.Provider, {
|
|
81
|
+
value: {
|
|
82
|
+
size,
|
|
83
|
+
layout
|
|
84
|
+
},
|
|
85
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
86
|
+
"data-slot": "empty-state",
|
|
87
|
+
className: cn(emptyStateVariants({
|
|
88
|
+
variant,
|
|
89
|
+
size,
|
|
90
|
+
layout
|
|
91
|
+
}), className),
|
|
92
|
+
...props,
|
|
93
|
+
children: [Glyph ? /* @__PURE__ */ jsx(Icon, {
|
|
94
|
+
size: size === "sm" ? "small" : "xl",
|
|
19
95
|
children: /* @__PURE__ */ jsx(Glyph, {})
|
|
20
|
-
}) : null,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
children: title
|
|
26
|
-
}), description && /* @__PURE__ */ jsx("p", {
|
|
27
|
-
className: "mx-auto max-w-md text-sm text-gray-light",
|
|
28
|
-
children: description
|
|
29
|
-
})]
|
|
30
|
-
}),
|
|
31
|
-
action
|
|
32
|
-
]
|
|
96
|
+
}) : null, /* @__PURE__ */ jsx("div", {
|
|
97
|
+
className: cn("flex flex-col gap-2", layout === "inline" && "min-w-0 flex-1"),
|
|
98
|
+
children
|
|
99
|
+
})]
|
|
100
|
+
})
|
|
33
101
|
});
|
|
34
102
|
}
|
|
35
103
|
//#endregion
|
|
36
|
-
export { EmptyState };
|
|
104
|
+
export { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateTitle };
|
|
37
105
|
|
|
38
106
|
//# sourceMappingURL=empty-state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-state.js","names":[],"sources":["../../src/components/empty-state.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport type
|
|
1
|
+
{"version":3,"file":"empty-state.js","names":[],"sources":["../../src/components/empty-state.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport {\n createContext,\n type HTMLAttributes,\n type ReactNode,\n useContext,\n} from 'react'\nimport { cn } from '../utils/cn'\nimport { Icon } from './icon'\n\nconst emptyStateVariants = cva('flex', {\n variants: {\n variant: {\n dashed: 'rounded-lg border border-dashed border-gray',\n ghost: '',\n },\n size: { default: '', sm: '' },\n layout: {\n stacked: 'flex-col items-center text-center',\n inline: 'flex-row items-start text-left',\n },\n },\n compoundVariants: [\n { layout: 'stacked', size: 'default', class: 'gap-4 px-6 py-12' },\n { layout: 'stacked', size: 'sm', class: 'gap-2 px-4 py-5' },\n { layout: 'inline', size: 'default', class: 'gap-4 p-6' },\n { layout: 'inline', size: 'sm', class: 'gap-3 px-4 py-3' },\n ],\n defaultVariants: {\n variant: 'dashed',\n size: 'default',\n layout: 'stacked',\n },\n})\n\ntype EmptyStateVariants = VariantProps<typeof emptyStateVariants>\n\n// A leftover `title` would otherwise compile and render as a tooltip, not a heading.\ninterface EmptyStateProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'title'>,\n Pick<EmptyStateVariants, 'variant'> {\n // null would switch off the compound cells and drop all padding and gap\n size?: NonNullable<EmptyStateVariants['size']>\n layout?: NonNullable<EmptyStateVariants['layout']>\n icon?: SparkIcon\n children: ReactNode\n}\n\nconst EmptyStateContext = createContext<{\n size: NonNullable<EmptyStateVariants['size']>\n layout: NonNullable<EmptyStateVariants['layout']>\n}>({ size: 'default', layout: 'stacked' })\n\nfunction EmptyStateTitle({\n className,\n ...props\n}: HTMLAttributes<HTMLHeadingElement>) {\n const { size } = useContext(EmptyStateContext)\n return (\n <h3\n data-slot=\"empty-state-title\"\n className={cn(\n 'text-gray',\n size === 'sm' ? 'text-sm font-semibold' : 'text-base font-bold',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyStateDescription({\n className,\n ...props\n}: HTMLAttributes<HTMLParagraphElement>) {\n const { size, layout } = useContext(EmptyStateContext)\n return (\n <p\n data-slot=\"empty-state-description\"\n className={cn(\n layout !== 'inline' && 'mx-auto',\n 'max-w-md text-gray-light',\n size === 'sm' ? 'text-xs' : 'text-sm',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyStateActions({\n className,\n ...props\n}: HTMLAttributes<HTMLDivElement>) {\n const { layout } = useContext(EmptyStateContext)\n return (\n <div\n data-slot=\"empty-state-actions\"\n className={cn(\n 'mt-2 flex flex-wrap gap-2',\n layout === 'stacked' && 'justify-center',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyState({\n children,\n className,\n icon: Glyph,\n layout = 'stacked',\n size = 'default',\n variant,\n ...props\n}: EmptyStateProps) {\n return (\n <EmptyStateContext.Provider value={{ size, layout }}>\n <div\n data-slot=\"empty-state\"\n className={cn(emptyStateVariants({ variant, size, layout }), className)}\n {...props}\n >\n {Glyph ? (\n <Icon size={size === 'sm' ? 'small' : 'xl'}>\n <Glyph />\n </Icon>\n ) : null}\n <div\n className={cn(\n 'flex flex-col gap-2',\n layout === 'inline' && 'min-w-0 flex-1',\n )}\n >\n {children}\n </div>\n </div>\n </EmptyStateContext.Provider>\n )\n}\n\nexport { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateTitle }\nexport type { EmptyStateProps }\n"],"mappings":";;;;;;;AAWA,MAAM,qBAAqB,IAAI,QAAQ;CACrC,UAAU;EACR,SAAS;GACP,QAAQ;GACR,OAAO;EACT;EACA,MAAM;GAAE,SAAS;GAAI,IAAI;EAAG;EAC5B,QAAQ;GACN,SAAS;GACT,QAAQ;EACV;CACF;CACA,kBAAkB;EAChB;GAAE,QAAQ;GAAW,MAAM;GAAW,OAAO;EAAmB;EAChE;GAAE,QAAQ;GAAW,MAAM;GAAM,OAAO;EAAkB;EAC1D;GAAE,QAAQ;GAAU,MAAM;GAAW,OAAO;EAAY;EACxD;GAAE,QAAQ;GAAU,MAAM;GAAM,OAAO;EAAkB;CAC3D;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;EACN,QAAQ;CACV;AACF,CAAC;AAgBD,MAAM,oBAAoB,cAGvB;CAAE,MAAM;CAAW,QAAQ;AAAU,CAAC;AAEzC,SAAS,gBAAgB,EACvB,WACA,GAAG,SACkC;CACrC,MAAM,EAAE,SAAS,WAAW,iBAAiB;CAC7C,OACE,oBAAC,MAAD;EACE,aAAU;EACV,WAAW,GACT,aACA,SAAS,OAAO,0BAA0B,uBAC1C,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,sBAAsB,EAC7B,WACA,GAAG,SACoC;CACvC,MAAM,EAAE,MAAM,WAAW,WAAW,iBAAiB;CACrD,OACE,oBAAC,KAAD;EACE,aAAU;EACV,WAAW,GACT,WAAW,YAAY,WACvB,4BACA,SAAS,OAAO,YAAY,WAC5B,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SAC8B;CACjC,MAAM,EAAE,WAAW,WAAW,iBAAiB;CAC/C,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,6BACA,WAAW,aAAa,kBACxB,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAClB,UACA,WACA,MAAM,OACN,SAAS,WACT,OAAO,WACP,SACA,GAAG,SACe;CAClB,OACE,oBAAC,kBAAkB,UAAnB;EAA4B,OAAO;GAAE;GAAM;EAAO;YAChD,qBAAC,OAAD;GACE,aAAU;GACV,WAAW,GAAG,mBAAmB;IAAE;IAAS;IAAM;GAAO,CAAC,GAAG,SAAS;GACtE,GAAI;aAHN,CAKG,QACC,oBAAC,MAAD;IAAM,MAAM,SAAS,OAAO,UAAU;cACpC,oBAAC,OAAD,CAAQ,CAAA;GACJ,CAAA,IACJ,MACJ,oBAAC,OAAD;IACE,WAAW,GACT,uBACA,WAAW,YAAY,gBACzB;IAEC;GACE,CAAA,CACF;;CACqB,CAAA;AAEhC"}
|
|
@@ -20,7 +20,7 @@ function EnergyBreakdown({ title, subtitle, items, centerSub = "kWh" }) {
|
|
|
20
20
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21
21
|
className: "flex flex-col gap-4 pt-3 pb-5",
|
|
22
22
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
23
|
-
className: "flex flex-col gap-
|
|
23
|
+
className: "flex flex-col gap-2",
|
|
24
24
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
25
25
|
className: "text-sm font-semibold text-gray",
|
|
26
26
|
children: title
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energy-breakdown.cjs","names":["formatThousands","integerFormat","oneDecimalFormat","twoDecimalFormat","DonutChart","formatEnergy"],"sources":["../../src/components/energy-breakdown.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { NARROW_NBSP } from '../utils/chars'\nimport {\n formatEnergy,\n formatThousands,\n integerFormat,\n oneDecimalFormat,\n twoDecimalFormat,\n} from '../utils/format'\nimport { DonutChart } from './donut-chart'\n\nexport type BreakdownItem = {\n label: string\n value: number\n color: string\n excludeFromCenterTotal?: boolean\n}\n\nexport type EnergyBreakdownProps = {\n title: string\n subtitle: string\n items: BreakdownItem[]\n centerSub?: string\n}\n\nfunction formatBreakdownCenter(v: number) {\n if (v >= 1000) return formatThousands(v)\n if (v >= 100) return integerFormat.format(v)\n if (v >= 10) return oneDecimalFormat.format(v)\n return twoDecimalFormat.format(v)\n}\n\nexport function EnergyBreakdown({\n title,\n subtitle,\n items,\n centerSub = 'kWh',\n}: EnergyBreakdownProps) {\n const sortedItems = useMemo(\n () => items.toSorted((a, b) => b.value - a.value),\n [items],\n )\n\n const total = items.reduce((s, i) => s + i.value, 0)\n const centerTotal = items\n .filter((i) => !i.excludeFromCenterTotal)\n .reduce((s, i) => s + i.value, 0)\n\n const dataEmpty = total === 0\n\n if (dataEmpty) return null\n\n return (\n <div className=\"flex flex-col gap-4 pt-3 pb-5\">\n <div className=\"flex flex-col gap-
|
|
1
|
+
{"version":3,"file":"energy-breakdown.cjs","names":["formatThousands","integerFormat","oneDecimalFormat","twoDecimalFormat","DonutChart","formatEnergy"],"sources":["../../src/components/energy-breakdown.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { NARROW_NBSP } from '../utils/chars'\nimport {\n formatEnergy,\n formatThousands,\n integerFormat,\n oneDecimalFormat,\n twoDecimalFormat,\n} from '../utils/format'\nimport { DonutChart } from './donut-chart'\n\nexport type BreakdownItem = {\n label: string\n value: number\n color: string\n excludeFromCenterTotal?: boolean\n}\n\nexport type EnergyBreakdownProps = {\n title: string\n subtitle: string\n items: BreakdownItem[]\n centerSub?: string\n}\n\nfunction formatBreakdownCenter(v: number) {\n if (v >= 1000) return formatThousands(v)\n if (v >= 100) return integerFormat.format(v)\n if (v >= 10) return oneDecimalFormat.format(v)\n return twoDecimalFormat.format(v)\n}\n\nexport function EnergyBreakdown({\n title,\n subtitle,\n items,\n centerSub = 'kWh',\n}: EnergyBreakdownProps) {\n const sortedItems = useMemo(\n () => items.toSorted((a, b) => b.value - a.value),\n [items],\n )\n\n const total = items.reduce((s, i) => s + i.value, 0)\n const centerTotal = items\n .filter((i) => !i.excludeFromCenterTotal)\n .reduce((s, i) => s + i.value, 0)\n\n const dataEmpty = total === 0\n\n if (dataEmpty) return null\n\n return (\n <div className=\"flex flex-col gap-4 pt-3 pb-5\">\n <div className=\"flex flex-col gap-2\">\n <span className=\"text-sm font-semibold text-gray\">{title}</span>\n <span className=\"text-xs text-gray-light\">{subtitle}</span>\n </div>\n\n <div className=\"flex items-center gap-6\">\n <DonutChart\n centerLabel={formatBreakdownCenter(centerTotal)}\n centerSub={centerSub}\n segments={sortedItems.map(({ value, color }) => ({ value, color }))}\n />\n\n <div className=\"flex flex-1 flex-col gap-3\">\n {sortedItems.map(({ label, value, color }) => {\n const pct = (value / total) * 100\n return (\n <div key={label} className=\"flex flex-col gap-1.5\">\n <div className=\"flex items-baseline justify-between gap-2\">\n <span className=\"min-w-0 truncate text-sm font-medium text-gray\">\n {label}\n </span>\n <span className=\"flex shrink-0 items-baseline gap-1.5 text-xs tabular-nums\">\n <span className=\"text-gray-light\">\n {formatEnergy(value)}\n </span>\n <span className=\"font-semibold text-gray\">\n {`${integerFormat.format(pct)}${NARROW_NBSP}%`}\n </span>\n </span>\n </div>\n <div className=\"h-1 w-full overflow-hidden rounded-full bg-gray-a4\">\n <div\n className=\"h-full rounded-full\"\n style={{ width: `${pct}%`, background: color }}\n />\n </div>\n </div>\n )\n })}\n </div>\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAyBA,SAAS,sBAAsB,GAAW;CACxC,IAAI,KAAK,KAAM,OAAOA,qBAAAA,gBAAgB,CAAC;CACvC,IAAI,KAAK,KAAK,OAAOC,qBAAAA,cAAc,OAAO,CAAC;CAC3C,IAAI,KAAK,IAAI,OAAOC,qBAAAA,iBAAiB,OAAO,CAAC;CAC7C,OAAOC,qBAAAA,iBAAiB,OAAO,CAAC;AAClC;AAEA,SAAgB,gBAAgB,EAC9B,OACA,UACA,OACA,YAAY,SACW;CACvB,MAAM,eAAA,GAAA,MAAA,eACE,MAAM,UAAU,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,GAChD,CAAC,KAAK,CACR;CAEA,MAAM,QAAQ,MAAM,QAAQ,GAAG,MAAM,IAAI,EAAE,OAAO,CAAC;CACnD,MAAM,cAAc,MACjB,QAAQ,MAAM,CAAC,EAAE,sBAAsB,EACvC,QAAQ,GAAG,MAAM,IAAI,EAAE,OAAO,CAAC;CAIlC,IAFkB,UAAU,GAEb,OAAO;CAEtB,OACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;EAAK,WAAU;YAAf,CACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;GAAK,WAAU;aAAf,CACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;IAAM,WAAU;cAAmC;GAAY,CAAA,GAC/D,iBAAA,GAAA,kBAAA,KAAC,QAAD;IAAM,WAAU;cAA2B;GAAe,CAAA,CACvD;MAEL,iBAAA,GAAA,kBAAA,MAAC,OAAD;GAAK,WAAU;aAAf,CACE,iBAAA,GAAA,kBAAA,KAACC,+BAAAA,YAAD;IACE,aAAa,sBAAsB,WAAW;IACnC;IACX,UAAU,YAAY,KAAK,EAAE,OAAO,aAAa;KAAE;KAAO;IAAM,EAAE;GACnE,CAAA,GAED,iBAAA,GAAA,kBAAA,KAAC,OAAD;IAAK,WAAU;cACZ,YAAY,KAAK,EAAE,OAAO,OAAO,YAAY;KAC5C,MAAM,MAAO,QAAQ,QAAS;KAC9B,OACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;MAAiB,WAAU;gBAA3B,CACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;OAAK,WAAU;iBAAf,CACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;QAAM,WAAU;kBACb;OACG,CAAA,GACN,iBAAA,GAAA,kBAAA,MAAC,QAAD;QAAM,WAAU;kBAAhB,CACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;SAAM,WAAU;mBACbC,qBAAAA,aAAa,KAAK;QACf,CAAA,GACN,iBAAA,GAAA,kBAAA,KAAC,QAAD;SAAM,WAAU;mBACb,GAAGJ,qBAAAA,cAAc,OAAO,GAAG;QACxB,CAAA,CACF;SACH;UACL,iBAAA,GAAA,kBAAA,KAAC,OAAD;OAAK,WAAU;iBACb,iBAAA,GAAA,kBAAA,KAAC,OAAD;QACE,WAAU;QACV,OAAO;SAAE,OAAO,GAAG,IAAI;SAAI,YAAY;QAAM;OAC9C,CAAA;MACE,CAAA,CACF;QApBK,KAoBL;IAET,CAAC;GACE,CAAA,CACF;IACF;;AAET"}
|
|
@@ -19,7 +19,7 @@ function EnergyBreakdown({ title, subtitle, items, centerSub = "kWh" }) {
|
|
|
19
19
|
return /* @__PURE__ */ jsxs("div", {
|
|
20
20
|
className: "flex flex-col gap-4 pt-3 pb-5",
|
|
21
21
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
22
|
-
className: "flex flex-col gap-
|
|
22
|
+
className: "flex flex-col gap-2",
|
|
23
23
|
children: [/* @__PURE__ */ jsx("span", {
|
|
24
24
|
className: "text-sm font-semibold text-gray",
|
|
25
25
|
children: title
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energy-breakdown.js","names":[],"sources":["../../src/components/energy-breakdown.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { NARROW_NBSP } from '../utils/chars'\nimport {\n formatEnergy,\n formatThousands,\n integerFormat,\n oneDecimalFormat,\n twoDecimalFormat,\n} from '../utils/format'\nimport { DonutChart } from './donut-chart'\n\nexport type BreakdownItem = {\n label: string\n value: number\n color: string\n excludeFromCenterTotal?: boolean\n}\n\nexport type EnergyBreakdownProps = {\n title: string\n subtitle: string\n items: BreakdownItem[]\n centerSub?: string\n}\n\nfunction formatBreakdownCenter(v: number) {\n if (v >= 1000) return formatThousands(v)\n if (v >= 100) return integerFormat.format(v)\n if (v >= 10) return oneDecimalFormat.format(v)\n return twoDecimalFormat.format(v)\n}\n\nexport function EnergyBreakdown({\n title,\n subtitle,\n items,\n centerSub = 'kWh',\n}: EnergyBreakdownProps) {\n const sortedItems = useMemo(\n () => items.toSorted((a, b) => b.value - a.value),\n [items],\n )\n\n const total = items.reduce((s, i) => s + i.value, 0)\n const centerTotal = items\n .filter((i) => !i.excludeFromCenterTotal)\n .reduce((s, i) => s + i.value, 0)\n\n const dataEmpty = total === 0\n\n if (dataEmpty) return null\n\n return (\n <div className=\"flex flex-col gap-4 pt-3 pb-5\">\n <div className=\"flex flex-col gap-
|
|
1
|
+
{"version":3,"file":"energy-breakdown.js","names":[],"sources":["../../src/components/energy-breakdown.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { NARROW_NBSP } from '../utils/chars'\nimport {\n formatEnergy,\n formatThousands,\n integerFormat,\n oneDecimalFormat,\n twoDecimalFormat,\n} from '../utils/format'\nimport { DonutChart } from './donut-chart'\n\nexport type BreakdownItem = {\n label: string\n value: number\n color: string\n excludeFromCenterTotal?: boolean\n}\n\nexport type EnergyBreakdownProps = {\n title: string\n subtitle: string\n items: BreakdownItem[]\n centerSub?: string\n}\n\nfunction formatBreakdownCenter(v: number) {\n if (v >= 1000) return formatThousands(v)\n if (v >= 100) return integerFormat.format(v)\n if (v >= 10) return oneDecimalFormat.format(v)\n return twoDecimalFormat.format(v)\n}\n\nexport function EnergyBreakdown({\n title,\n subtitle,\n items,\n centerSub = 'kWh',\n}: EnergyBreakdownProps) {\n const sortedItems = useMemo(\n () => items.toSorted((a, b) => b.value - a.value),\n [items],\n )\n\n const total = items.reduce((s, i) => s + i.value, 0)\n const centerTotal = items\n .filter((i) => !i.excludeFromCenterTotal)\n .reduce((s, i) => s + i.value, 0)\n\n const dataEmpty = total === 0\n\n if (dataEmpty) return null\n\n return (\n <div className=\"flex flex-col gap-4 pt-3 pb-5\">\n <div className=\"flex flex-col gap-2\">\n <span className=\"text-sm font-semibold text-gray\">{title}</span>\n <span className=\"text-xs text-gray-light\">{subtitle}</span>\n </div>\n\n <div className=\"flex items-center gap-6\">\n <DonutChart\n centerLabel={formatBreakdownCenter(centerTotal)}\n centerSub={centerSub}\n segments={sortedItems.map(({ value, color }) => ({ value, color }))}\n />\n\n <div className=\"flex flex-1 flex-col gap-3\">\n {sortedItems.map(({ label, value, color }) => {\n const pct = (value / total) * 100\n return (\n <div key={label} className=\"flex flex-col gap-1.5\">\n <div className=\"flex items-baseline justify-between gap-2\">\n <span className=\"min-w-0 truncate text-sm font-medium text-gray\">\n {label}\n </span>\n <span className=\"flex shrink-0 items-baseline gap-1.5 text-xs tabular-nums\">\n <span className=\"text-gray-light\">\n {formatEnergy(value)}\n </span>\n <span className=\"font-semibold text-gray\">\n {`${integerFormat.format(pct)}${NARROW_NBSP}%`}\n </span>\n </span>\n </div>\n <div className=\"h-1 w-full overflow-hidden rounded-full bg-gray-a4\">\n <div\n className=\"h-full rounded-full\"\n style={{ width: `${pct}%`, background: color }}\n />\n </div>\n </div>\n )\n })}\n </div>\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;AAyBA,SAAS,sBAAsB,GAAW;CACxC,IAAI,KAAK,KAAM,OAAO,gBAAgB,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Ac,OAAO,GAAG;QACxB,CAAA,CACF;SACH;UACL,oBAAC,OAAD;OAAK,WAAU;iBACb,oBAAC,OAAD;QACE,WAAU;QACV,OAAO;SAAE,OAAO,GAAG,IAAI;SAAI,YAAY;QAAM;OAC9C,CAAA;MACE,CAAA,CACF;QApBK,KAoBL;IAET,CAAC;GACE,CAAA,CACF;IACF;;AAET"}
|
|
@@ -43,7 +43,7 @@ const EntityCardIcon = ({ className, icon: Glyph, tone, ...rest }) => /* @__PURE
|
|
|
43
43
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Glyph, { className: "[--spark-icon-size:18px]" })
|
|
44
44
|
});
|
|
45
45
|
const EntityCardTitleColumn = ({ className, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
46
|
-
className: (0, cn.cn)("flex min-w-0 flex-1 flex-col gap-
|
|
46
|
+
className: (0, cn.cn)("flex min-w-0 flex-1 flex-col gap-1", className),
|
|
47
47
|
...rest
|
|
48
48
|
});
|
|
49
49
|
const EntityCardTitle = ({ className, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-card.cjs","names":[],"sources":["../../src/components/entity-card.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\n\nconst EntityCard = ({ className, ...rest }: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex flex-col overflow-hidden rounded-lg border border-gray bg-(--spark-background)',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardBody = ({\n className,\n active,\n ...rest\n}: React.ComponentProps<'button'> & { active?: boolean }) => (\n <button\n type=\"button\"\n className={cn(\n 'flex w-full cursor-pointer flex-col gap-3 p-4 text-left transition-colors hover:bg-gray-a2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus',\n active && 'bg-linear-to-br from-spark-9/10 to-spark-1/5 to-20%',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardHeader = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div className={cn('flex w-full items-center gap-3', className)} {...rest} />\n)\n\nconst EntityCardMeters = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex flex-col gap-2 border-t border-gray pt-3', className)}\n {...rest}\n />\n)\n\nconst iconToneVariants = cva(\n // max() pill escape (matches Icon): a tile stays rounded-md at low Roundness but\n // becomes a circle at large/full, same as it did pre-harmonization via clamping.\n 'flex size-11 shrink-0 items-center justify-center rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))]',\n {\n variants: {\n tone: {\n success: 'bg-success-soft text-success-soft-foreground',\n warning: 'bg-warning-soft text-warning-soft-foreground',\n error: 'bg-error-soft text-error-soft-foreground',\n accent: 'bg-primary-soft text-primary-soft-foreground',\n neutral: 'bg-base-gray-soft text-gray',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n)\n\nconst EntityCardIcon = ({\n className,\n icon: Glyph,\n tone,\n ...rest\n}: React.ComponentProps<'span'> & {\n icon: SparkIcon\n tone?: Tone\n}) => (\n <span className={iconToneVariants({ tone, className })} {...rest}>\n <Glyph className=\"[--spark-icon-size:18px]\" />\n </span>\n)\n\nconst EntityCardTitleColumn = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex min-w-0 flex-1 flex-col gap-
|
|
1
|
+
{"version":3,"file":"entity-card.cjs","names":[],"sources":["../../src/components/entity-card.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\n\nconst EntityCard = ({ className, ...rest }: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex flex-col overflow-hidden rounded-lg border border-gray bg-(--spark-background)',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardBody = ({\n className,\n active,\n ...rest\n}: React.ComponentProps<'button'> & { active?: boolean }) => (\n <button\n type=\"button\"\n className={cn(\n 'flex w-full cursor-pointer flex-col gap-3 p-4 text-left transition-colors hover:bg-gray-a2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus',\n active && 'bg-linear-to-br from-spark-9/10 to-spark-1/5 to-20%',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardHeader = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div className={cn('flex w-full items-center gap-3', className)} {...rest} />\n)\n\nconst EntityCardMeters = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex flex-col gap-2 border-t border-gray pt-3', className)}\n {...rest}\n />\n)\n\nconst iconToneVariants = cva(\n // max() pill escape (matches Icon): a tile stays rounded-md at low Roundness but\n // becomes a circle at large/full, same as it did pre-harmonization via clamping.\n 'flex size-11 shrink-0 items-center justify-center rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))]',\n {\n variants: {\n tone: {\n success: 'bg-success-soft text-success-soft-foreground',\n warning: 'bg-warning-soft text-warning-soft-foreground',\n error: 'bg-error-soft text-error-soft-foreground',\n accent: 'bg-primary-soft text-primary-soft-foreground',\n neutral: 'bg-base-gray-soft text-gray',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n)\n\nconst EntityCardIcon = ({\n className,\n icon: Glyph,\n tone,\n ...rest\n}: React.ComponentProps<'span'> & {\n icon: SparkIcon\n tone?: Tone\n}) => (\n <span className={iconToneVariants({ tone, className })} {...rest}>\n <Glyph className=\"[--spark-icon-size:18px]\" />\n </span>\n)\n\nconst EntityCardTitleColumn = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex min-w-0 flex-1 flex-col gap-1', className)}\n {...rest}\n />\n)\n\nconst EntityCardTitle = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn('truncate text-sm font-bold text-gray', className)}\n {...rest}\n />\n)\n\nconst stateToneVariants = cva(\n 'inline-flex items-center gap-1.5 text-xs font-medium',\n {\n variants: {\n tone: {\n success: 'text-success',\n warning: 'text-warning',\n error: 'text-error',\n accent: 'text-accent',\n neutral: 'text-gray-light',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n)\n\nconst dotToneVariants = cva('size-1.5 shrink-0 rounded-full', {\n variants: {\n tone: {\n success: 'bg-base-success-solid',\n warning: 'bg-base-warning-solid',\n error: 'bg-base-error-solid',\n accent: 'bg-primary',\n neutral: 'bg-base-gray-solid',\n },\n },\n defaultVariants: { tone: 'neutral' },\n})\n\nconst EntityCardState = ({\n className,\n tone,\n children,\n ...rest\n}: React.ComponentProps<'span'> & { tone?: Tone }) => (\n <span className={stateToneVariants({ tone, className })} {...rest}>\n <span className={dotToneVariants({ tone })} />\n <span className=\"truncate\">{children}</span>\n </span>\n)\n\nconst EntityCardDetail = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn('truncate text-xs text-gray-light tabular-nums', className)}\n {...rest}\n />\n)\n\nconst EntityCardValue = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn(\n 'ms-2 shrink-0 self-center text-lg leading-tight font-bold text-gray tabular-nums',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardControls = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex items-center gap-3 border-t border-gray bg-base-gray-surface px-4 py-3',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardFooter = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex items-center justify-center gap-1.5 border-t border-gray bg-base-gray-surface px-4 py-2 text-xs text-gray-light',\n className,\n )}\n {...rest}\n />\n)\n\nexport {\n EntityCard,\n EntityCardBody,\n EntityCardControls,\n EntityCardDetail,\n EntityCardFooter,\n EntityCardHeader,\n EntityCardIcon,\n EntityCardMeters,\n EntityCardState,\n EntityCardTitle,\n EntityCardTitleColumn,\n EntityCardValue,\n}\n"],"mappings":";;;;;;;;;AAMA,MAAM,cAAc,EAAE,WAAW,GAAG,WAClC,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IACE,uFACA,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,kBAAkB,EACtB,WACA,QACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,UAAD;CACE,MAAK;CACL,YAAA,GAAA,GAAA,IACE,yLACA,UAAU,uDACV,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,OAAD;CAAK,YAAA,GAAA,GAAA,IAAc,kCAAkC,SAAS;CAAG,GAAI;AAAO,CAAA;AAG9E,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IAAc,iDAAiD,SAAS;CACxE,GAAI;AACL,CAAA;AAGH,MAAM,oBAAA,GAAA,yBAAA,KAGJ,sHACA;CACE,UAAU,EACR,MAAM;EACJ,SAAS;EACT,SAAS;EACT,OAAO;EACP,QAAQ;EACR,SAAS;CACX,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CACF;AAEA,MAAM,kBAAkB,EACtB,WACA,MAAM,OACN,MACA,GAAG,WAKH,iBAAA,GAAA,kBAAA,KAAC,QAAD;CAAM,WAAW,iBAAiB;EAAE;EAAM;CAAU,CAAC;CAAG,GAAI;WAC1D,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAO,WAAU,2BAA4B,CAAA;AACzC,CAAA;AAGR,MAAM,yBAAyB,EAC7B,WACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IAAc,sCAAsC,SAAS;CAC7D,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;AACL,CAAA;AAGH,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IACE,wHACA,SACF;CACA,GAAI;AACL,CAAA"}
|
|
@@ -40,7 +40,7 @@ const EntityCardIcon = ({ className, icon: Glyph, tone, ...rest }) => /* @__PURE
|
|
|
40
40
|
children: /* @__PURE__ */ jsx(Glyph, { className: "[--spark-icon-size:18px]" })
|
|
41
41
|
});
|
|
42
42
|
const EntityCardTitleColumn = ({ className, ...rest }) => /* @__PURE__ */ jsx("div", {
|
|
43
|
-
className: cn("flex min-w-0 flex-1 flex-col gap-
|
|
43
|
+
className: cn("flex min-w-0 flex-1 flex-col gap-1", className),
|
|
44
44
|
...rest
|
|
45
45
|
});
|
|
46
46
|
const EntityCardTitle = ({ className, ...rest }) => /* @__PURE__ */ jsx("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-card.js","names":[],"sources":["../../src/components/entity-card.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\n\nconst EntityCard = ({ className, ...rest }: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex flex-col overflow-hidden rounded-lg border border-gray bg-(--spark-background)',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardBody = ({\n className,\n active,\n ...rest\n}: React.ComponentProps<'button'> & { active?: boolean }) => (\n <button\n type=\"button\"\n className={cn(\n 'flex w-full cursor-pointer flex-col gap-3 p-4 text-left transition-colors hover:bg-gray-a2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus',\n active && 'bg-linear-to-br from-spark-9/10 to-spark-1/5 to-20%',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardHeader = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div className={cn('flex w-full items-center gap-3', className)} {...rest} />\n)\n\nconst EntityCardMeters = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex flex-col gap-2 border-t border-gray pt-3', className)}\n {...rest}\n />\n)\n\nconst iconToneVariants = cva(\n // max() pill escape (matches Icon): a tile stays rounded-md at low Roundness but\n // becomes a circle at large/full, same as it did pre-harmonization via clamping.\n 'flex size-11 shrink-0 items-center justify-center rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))]',\n {\n variants: {\n tone: {\n success: 'bg-success-soft text-success-soft-foreground',\n warning: 'bg-warning-soft text-warning-soft-foreground',\n error: 'bg-error-soft text-error-soft-foreground',\n accent: 'bg-primary-soft text-primary-soft-foreground',\n neutral: 'bg-base-gray-soft text-gray',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n)\n\nconst EntityCardIcon = ({\n className,\n icon: Glyph,\n tone,\n ...rest\n}: React.ComponentProps<'span'> & {\n icon: SparkIcon\n tone?: Tone\n}) => (\n <span className={iconToneVariants({ tone, className })} {...rest}>\n <Glyph className=\"[--spark-icon-size:18px]\" />\n </span>\n)\n\nconst EntityCardTitleColumn = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex min-w-0 flex-1 flex-col gap-
|
|
1
|
+
{"version":3,"file":"entity-card.js","names":[],"sources":["../../src/components/entity-card.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\n\nconst EntityCard = ({ className, ...rest }: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex flex-col overflow-hidden rounded-lg border border-gray bg-(--spark-background)',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardBody = ({\n className,\n active,\n ...rest\n}: React.ComponentProps<'button'> & { active?: boolean }) => (\n <button\n type=\"button\"\n className={cn(\n 'flex w-full cursor-pointer flex-col gap-3 p-4 text-left transition-colors hover:bg-gray-a2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus',\n active && 'bg-linear-to-br from-spark-9/10 to-spark-1/5 to-20%',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardHeader = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div className={cn('flex w-full items-center gap-3', className)} {...rest} />\n)\n\nconst EntityCardMeters = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex flex-col gap-2 border-t border-gray pt-3', className)}\n {...rest}\n />\n)\n\nconst iconToneVariants = cva(\n // max() pill escape (matches Icon): a tile stays rounded-md at low Roundness but\n // becomes a circle at large/full, same as it did pre-harmonization via clamping.\n 'flex size-11 shrink-0 items-center justify-center rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))]',\n {\n variants: {\n tone: {\n success: 'bg-success-soft text-success-soft-foreground',\n warning: 'bg-warning-soft text-warning-soft-foreground',\n error: 'bg-error-soft text-error-soft-foreground',\n accent: 'bg-primary-soft text-primary-soft-foreground',\n neutral: 'bg-base-gray-soft text-gray',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n)\n\nconst EntityCardIcon = ({\n className,\n icon: Glyph,\n tone,\n ...rest\n}: React.ComponentProps<'span'> & {\n icon: SparkIcon\n tone?: Tone\n}) => (\n <span className={iconToneVariants({ tone, className })} {...rest}>\n <Glyph className=\"[--spark-icon-size:18px]\" />\n </span>\n)\n\nconst EntityCardTitleColumn = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn('flex min-w-0 flex-1 flex-col gap-1', className)}\n {...rest}\n />\n)\n\nconst EntityCardTitle = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn('truncate text-sm font-bold text-gray', className)}\n {...rest}\n />\n)\n\nconst stateToneVariants = cva(\n 'inline-flex items-center gap-1.5 text-xs font-medium',\n {\n variants: {\n tone: {\n success: 'text-success',\n warning: 'text-warning',\n error: 'text-error',\n accent: 'text-accent',\n neutral: 'text-gray-light',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n)\n\nconst dotToneVariants = cva('size-1.5 shrink-0 rounded-full', {\n variants: {\n tone: {\n success: 'bg-base-success-solid',\n warning: 'bg-base-warning-solid',\n error: 'bg-base-error-solid',\n accent: 'bg-primary',\n neutral: 'bg-base-gray-solid',\n },\n },\n defaultVariants: { tone: 'neutral' },\n})\n\nconst EntityCardState = ({\n className,\n tone,\n children,\n ...rest\n}: React.ComponentProps<'span'> & { tone?: Tone }) => (\n <span className={stateToneVariants({ tone, className })} {...rest}>\n <span className={dotToneVariants({ tone })} />\n <span className=\"truncate\">{children}</span>\n </span>\n)\n\nconst EntityCardDetail = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn('truncate text-xs text-gray-light tabular-nums', className)}\n {...rest}\n />\n)\n\nconst EntityCardValue = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => (\n <span\n className={cn(\n 'ms-2 shrink-0 self-center text-lg leading-tight font-bold text-gray tabular-nums',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardControls = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex items-center gap-3 border-t border-gray bg-base-gray-surface px-4 py-3',\n className,\n )}\n {...rest}\n />\n)\n\nconst EntityCardFooter = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => (\n <div\n className={cn(\n 'flex items-center justify-center gap-1.5 border-t border-gray bg-base-gray-surface px-4 py-2 text-xs text-gray-light',\n className,\n )}\n {...rest}\n />\n)\n\nexport {\n EntityCard,\n EntityCardBody,\n EntityCardControls,\n EntityCardDetail,\n EntityCardFooter,\n EntityCardHeader,\n EntityCardIcon,\n EntityCardMeters,\n EntityCardState,\n EntityCardTitle,\n EntityCardTitleColumn,\n EntityCardValue,\n}\n"],"mappings":";;;;;;AAMA,MAAM,cAAc,EAAE,WAAW,GAAG,WAClC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T,SAAS;EACT,OAAO;EACP,QAAQ;EACR,SAAS;CACX,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AAED,MAAM,mBAAmB,EACvB,WACA,MACA,UACA,GAAG,WAEH,qBAAC,QAAD;CAAM,WAAW,kBAAkB;EAAE;EAAM;CAAU,CAAC;CAAG,GAAI;WAA7D,CACE,oBAAC,QAAD,EAAM,WAAW,gBAAgB,EAAE,KAAK,CAAC,EAAI,CAAA,GAC7C,oBAAC,QAAD;EAAM,WAAU;EAAY;CAAe,CAAA,CACvC;;AAGR,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,oBAAC,QAAD;CACE,WAAW,GAAG,iDAAiD,SAAS;CACxE,GAAI;AACL,CAAA;AAGH,MAAM,mBAAmB,EACvB,WACA,GAAG,WAEH,oBAAC,QAAD;CACE,WAAW,GACT,oFACA,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,sBAAsB,EAC1B,WACA,GAAG,WAEH,oBAAC,OAAD;CACE,WAAW,GACT,+EACA,SACF;CACA,GAAI;AACL,CAAA;AAGH,MAAM,oBAAoB,EACxB,WACA,GAAG,WAEH,oBAAC,OAAD;CACE,WAAW,GACT,wHACA,SACF;CACA,GAAI;AACL,CAAA"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
5
|
+
const require_components_theme = require("./theme.cjs");
|
|
5
6
|
const require_components_separator = require("./separator.cjs");
|
|
6
7
|
const require_components_skeleton = require("./skeleton.cjs");
|
|
7
|
-
const require_components_theme = require("./theme.cjs");
|
|
8
8
|
let react = require("react");
|
|
9
9
|
react = require_chunk.__toESM(react);
|
|
10
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -190,7 +190,7 @@ function Field({ className, children, labelPosition: labelPositionProp, inputSty
|
|
|
190
190
|
function FieldContent({ className, ...props }) {
|
|
191
191
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
192
192
|
"data-slot": "field-content",
|
|
193
|
-
className: (0, cn.cn)("flex min-w-0 flex-1 flex-col gap-
|
|
193
|
+
className: (0, cn.cn)("flex min-w-0 flex-1 flex-col gap-1 leading-snug", className),
|
|
194
194
|
...props
|
|
195
195
|
});
|
|
196
196
|
}
|
|
@@ -255,7 +255,7 @@ function FieldDescription({ className, id, ...props }) {
|
|
|
255
255
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
256
256
|
"data-slot": "field-description",
|
|
257
257
|
id: id ?? field?.descriptionId,
|
|
258
|
-
className: (0, cn.cn)("
|
|
258
|
+
className: (0, cn.cn)("text-sm leading-normal text-gray-light", className),
|
|
259
259
|
...props
|
|
260
260
|
});
|
|
261
261
|
}
|
|
@@ -301,7 +301,7 @@ function FieldError({ className, children, errors, id, ...props }) {
|
|
|
301
301
|
role: "alert",
|
|
302
302
|
"data-slot": "field-error",
|
|
303
303
|
id: id ?? field?.errorId,
|
|
304
|
-
className: (0, cn.cn)("
|
|
304
|
+
className: (0, cn.cn)("text-sm font-normal text-error", className),
|
|
305
305
|
...props,
|
|
306
306
|
children: content
|
|
307
307
|
});
|