@epilot/spark-ui 0.20.1 → 0.21.0
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 +5 -5
- package/dist/components/accordion.cjs.map +1 -1
- package/dist/components/alert-dialog.cjs +9 -9
- package/dist/components/alert-dialog.cjs.map +1 -1
- package/dist/components/attachment.cjs +10 -10
- package/dist/components/attachment.cjs.map +1 -1
- package/dist/components/attachment.d.cts +2 -2
- package/dist/components/attachment.d.ts +2 -2
- package/dist/components/autocomplete.cjs +12 -12
- package/dist/components/autocomplete.cjs.map +1 -1
- package/dist/components/avatar.cjs +2 -2
- package/dist/components/avatar.cjs.map +1 -1
- package/dist/components/avatar.js +1 -1
- package/dist/components/badge.cjs +2 -2
- package/dist/components/badge.cjs.map +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/bar-chart.cjs +3 -3
- package/dist/components/bar-chart.cjs.map +1 -1
- package/dist/components/box.cjs +2 -2
- package/dist/components/box.cjs.map +1 -1
- package/dist/components/box.js +1 -1
- package/dist/components/breadcrumbs.cjs +7 -7
- package/dist/components/breadcrumbs.cjs.map +1 -1
- package/dist/components/bubble.cjs +5 -5
- package/dist/components/bubble.cjs.map +1 -1
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/button-group.cjs +5 -5
- package/dist/components/button-group.cjs.map +1 -1
- package/dist/components/button-group.js +1 -1
- package/dist/components/button.cjs +2 -2
- package/dist/components/button.cjs.map +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/calendar.cjs +8 -8
- package/dist/components/calendar.cjs.map +1 -1
- package/dist/components/callout.cjs +7 -7
- package/dist/components/callout.cjs.map +1 -1
- package/dist/components/callout.d.cts +1 -1
- package/dist/components/callout.d.ts +1 -1
- package/dist/components/card.cjs +16 -16
- package/dist/components/card.cjs.map +1 -1
- package/dist/components/card.js +2 -2
- package/dist/components/card.js.map +1 -1
- package/dist/components/chart.cjs +2 -2
- package/dist/components/chart.cjs.map +1 -1
- package/dist/components/checkbox.cjs +2 -2
- package/dist/components/checkbox.cjs.map +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/circular-gauge.cjs +3 -3
- package/dist/components/circular-gauge.cjs.map +1 -1
- package/dist/components/day-of-week-picker.cjs +4 -4
- package/dist/components/day-of-week-picker.cjs.map +1 -1
- package/dist/components/dialog.cjs +8 -8
- package/dist/components/dialog.cjs.map +1 -1
- package/dist/components/drawer.cjs +8 -8
- package/dist/components/drawer.cjs.map +1 -1
- package/dist/components/dropdown-menu.cjs +10 -10
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/entity-card.cjs +11 -11
- package/dist/components/entity-card.cjs.map +1 -1
- package/dist/components/field.cjs +15 -15
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/hero-metric.cjs +4 -4
- package/dist/components/hero-metric.cjs.map +1 -1
- package/dist/components/icon.cjs +2 -2
- package/dist/components/icon.cjs.map +1 -1
- package/dist/components/icon.js +1 -1
- package/dist/components/info-block.cjs +9 -9
- package/dist/components/info-block.cjs.map +1 -1
- package/dist/components/info-block.d.cts +1 -1
- package/dist/components/info-block.d.ts +1 -1
- package/dist/components/input-date.cjs +2 -2
- package/dist/components/input-date.cjs.map +1 -1
- package/dist/components/input-group.cjs +5 -5
- package/dist/components/input-group.cjs.map +1 -1
- package/dist/components/input-group.d.cts +1 -1
- package/dist/components/input-group.d.ts +1 -1
- package/dist/components/input-otp.cjs +3 -3
- package/dist/components/input-otp.cjs.map +1 -1
- package/dist/components/input-otp.js +1 -1
- package/dist/components/input.cjs +3 -3
- package/dist/components/input.cjs.map +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/label.cjs +2 -2
- package/dist/components/label.cjs.map +1 -1
- package/dist/components/layout.cjs +2 -2
- package/dist/components/layout.cjs.map +1 -1
- package/dist/components/line-chart.cjs +4 -4
- package/dist/components/line-chart.cjs.map +1 -1
- package/dist/components/list.cjs +10 -10
- package/dist/components/list.cjs.map +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/list.js.map +1 -1
- package/dist/components/marker.cjs +4 -4
- package/dist/components/marker.cjs.map +1 -1
- package/dist/components/marker.d.cts +1 -1
- package/dist/components/marker.d.ts +1 -1
- package/dist/components/message-scroller.cjs +7 -7
- 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/message.cjs +7 -7
- package/dist/components/message.cjs.map +1 -1
- package/dist/components/page-header.cjs +5 -5
- package/dist/components/page-header.cjs.map +1 -1
- package/dist/components/page-header.d.cts +1 -1
- package/dist/components/page-header.d.ts +1 -1
- package/dist/components/period-tabs.cjs +6 -6
- package/dist/components/period-tabs.cjs.map +1 -1
- package/dist/components/pill.cjs +2 -2
- package/dist/components/pill.cjs.map +1 -1
- package/dist/components/pill.js +1 -1
- package/dist/components/popover.cjs +2 -2
- package/dist/components/popover.cjs.map +1 -1
- package/dist/components/power-history-chart.cjs +2 -2
- package/dist/components/power-history-chart.cjs.map +1 -1
- package/dist/components/power-network.cjs +9 -9
- package/dist/components/power-network.cjs.map +1 -1
- package/dist/components/progress.cjs +2 -2
- package/dist/components/progress.cjs.map +1 -1
- package/dist/components/radio-card-group.cjs +3 -3
- package/dist/components/radio-card-group.cjs.map +1 -1
- package/dist/components/radio.cjs +3 -3
- package/dist/components/radio.cjs.map +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/sankey-chart.cjs +2 -2
- package/dist/components/sankey-chart.cjs.map +1 -1
- package/dist/components/schedule-editor.cjs +9 -9
- package/dist/components/schedule-editor.cjs.map +1 -1
- package/dist/components/schedule-list.cjs +10 -10
- package/dist/components/schedule-list.cjs.map +1 -1
- package/dist/components/scroll-area.cjs +3 -3
- package/dist/components/scroll-area.cjs.map +1 -1
- package/dist/components/segmented-control.cjs +4 -4
- package/dist/components/segmented-control.cjs.map +1 -1
- package/dist/components/select.cjs +12 -12
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/separator.cjs +3 -3
- package/dist/components/separator.cjs.map +1 -1
- package/dist/components/series-legend.cjs +4 -4
- package/dist/components/series-legend.cjs.map +1 -1
- package/dist/components/sheet.cjs +8 -8
- package/dist/components/sheet.cjs.map +1 -1
- package/dist/components/skeleton.cjs +3 -3
- package/dist/components/skeleton.cjs.map +1 -1
- package/dist/components/slider.cjs +11 -11
- package/dist/components/slider.cjs.map +1 -1
- package/dist/components/solar-forecast-chart.cjs +2 -2
- package/dist/components/solar-forecast-chart.cjs.map +1 -1
- package/dist/components/sortable-list.cjs +3 -3
- package/dist/components/sortable-list.cjs.map +1 -1
- package/dist/components/spinner.cjs +2 -2
- package/dist/components/spinner.cjs.map +1 -1
- package/dist/components/stat-card.cjs +8 -8
- package/dist/components/stat-card.cjs.map +1 -1
- package/dist/components/stepper.cjs +2 -2
- package/dist/components/stepper.cjs.map +1 -1
- package/dist/components/switch.cjs +3 -3
- package/dist/components/switch.cjs.map +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/table.cjs +8 -8
- package/dist/components/table.cjs.map +1 -1
- package/dist/components/tabs.cjs +7 -7
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/textarea.cjs +3 -3
- package/dist/components/textarea.cjs.map +1 -1
- package/dist/components/textarea.js +1 -1
- package/dist/components/theme.cjs +2 -2
- package/dist/components/theme.cjs.map +1 -1
- package/dist/components/theme.js +1 -1
- package/dist/components/thumbnail.cjs +3 -3
- package/dist/components/thumbnail.cjs.map +1 -1
- package/dist/components/time-picker.cjs +3 -3
- package/dist/components/time-picker.cjs.map +1 -1
- package/dist/components/toast.cjs +7 -7
- package/dist/components/toast.cjs.map +1 -1
- package/dist/components/tooltip.cjs +3 -3
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/typography.cjs +6 -6
- package/dist/components/typography.cjs.map +1 -1
- package/dist/components/wizard-layout.cjs +8 -8
- package/dist/components/wizard-layout.cjs.map +1 -1
- package/dist/lib/input-box-variants.cjs +9 -9
- package/dist/lib/input-box-variants.cjs.map +1 -1
- package/dist/styles/spark-default.css +11 -0
- package/dist/utils/cn.cjs +2 -2
- package/dist/utils/cn.d.cts +1 -1
- package/dist/utils/cn.d.ts +1 -1
- package/dist/utils/cn.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group.cjs","names":["React","accentByColor","ButtonPrimitive"],"sources":["../../src/components/button-group.tsx"],"sourcesContent":["'use client'\n\nimport { Button as ButtonPrimitive } from '@base-ui/react/button'\nimport * as React from 'react'\nimport { accentByColor } from '../lib/accent-colors'\nimport type { SparkAccentColor } from '../lib/accent-colors'\nimport type { SparkStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\n\n// Button's chrome recipe (`buttonRecipe` in button.tsx), minus its `hover:`\n// half -- hover belongs on segments, not the shared group chrome. Shared with\n// button-group-pill.tsx.\nexport const buttonGroupRecipe =\n 'bg-(--spark-style-bg,var(--color-primary)) text-(--spark-style-fg,var(--color-primary-foreground)) shadow-[inset_0_0_0_var(--spark-style-border-width,1px)_var(--spark-style-border,transparent)]'\n\nexport function buttonGroupSizeClasses(size: 'small' | 'default') {\n return size === 'small'\n ? 'h-9 text-sm [&_svg:not([class*=size-])]:size-4'\n : 'h-10 text-base [&_svg:not([class*=size-])]:size-5'\n}\n\ninterface ButtonGroupProps extends React.HTMLAttributes<HTMLDivElement> {\n styleVariant?: SparkStyle\n color?: SparkAccentColor\n size?: 'small' | 'default'\n}\n\n/**\n * A layout group, not a toolbar: segments are independent tab stops in DOM\n * order (no roving tabindex). Pass `aria-label` when segments don't\n * self-describe (e.g. icon-only segments). For a fully-rounded status pill,\n * use `ButtonGroupPill` instead.\n */\nconst ButtonGroup = React.forwardRef<HTMLDivElement, ButtonGroupProps>(\n function ButtonGroup(\n {\n className,\n styleVariant = 'soft',\n color = 'neutral',\n size = 'default',\n ...props\n },\n ref,\n ) {\n return (\n <div\n data-slot=\"button-group\"\n role=\"group\"\n data-style={styleVariant}\n data-accent-color={accentByColor[color]}\n className={cn(\n 'isolate inline-flex items-stretch overflow-hidden rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))]',\n buttonGroupSizeClasses(size),\n buttonGroupRecipe,\n className,\n )}\n ref={ref}\n {...props}\n />\n )\n },\n)\n\nButtonGroup.displayName = 'ButtonGroup'\n\ninterface ButtonGroupButtonProps extends Omit<\n React.ComponentProps<typeof ButtonPrimitive>,\n 'ref'\n> {}\n\nconst ButtonGroupButton = React.forwardRef<\n HTMLButtonElement,\n ButtonGroupButtonProps\n>(function ButtonGroupButton(\n { className, render, nativeButton, ...props },\n ref,\n) {\n return (\n <ButtonPrimitive\n data-slot=\"button-group-button\"\n nativeButton={nativeButton ?? render === undefined}\n render={render}\n className={cn(\n 'inline-flex cursor-pointer items-center gap-2 px-3 font-medium whitespace-nowrap',\n 'transition-colors hover:bg-(--spark-style-bg-hover,var(--color-primary-hover)) motion-reduce:transition-none',\n 'focus-visible:inset-ring-2 focus-visible:outline-hidden',\n 'disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0',\n className,\n )}\n ref={ref}\n {...props}\n />\n )\n})\n\nButtonGroupButton.displayName = 'ButtonGroupButton'\n\nconst ButtonGroupText = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(function ButtonGroupText({ className, ...props }, ref) {\n return (\n <span\n data-slot=\"button-group-text\"\n className={cn(\n 'inline-flex items-center gap-2 px-3 font-medium whitespace-nowrap select-none',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0',\n className,\n )}\n ref={ref}\n {...props}\n />\n )\n})\n\nButtonGroupText.displayName = 'ButtonGroupText'\n\nconst ButtonGroupSeparator = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(function ButtonGroupSeparator({ className, ...props }, ref) {\n return (\n <div\n data-slot=\"button-group-separator\"\n aria-hidden=\"true\"\n className={cn(\n 'h-4 w-px shrink-0 self-center bg-current opacity-25',\n className,\n )}\n ref={ref}\n {...props}\n />\n )\n})\n\nButtonGroupSeparator.displayName = 'ButtonGroupSeparator'\n\nexport { ButtonGroup, ButtonGroupButton, ButtonGroupSeparator, ButtonGroupText }\nexport type { ButtonGroupProps, ButtonGroupButtonProps }\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,oBACX;AAEF,SAAgB,uBAAuB,MAA2B;CAChE,OAAO,SAAS,UACZ,mDACA;AACN;;;;;;;AAcA,MAAM,cAAcA,MAAM,WACxB,SAAS,YACP,EACE,WACA,eAAe,QACf,QAAQ,WACR,OAAO,WACP,GAAG,SAEL,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,aAAU;EACV,MAAK;EACL,cAAY;EACZ,qBAAmBC,0BAAAA,cAAc;EACjC,YAAA,GAAA,
|
|
1
|
+
{"version":3,"file":"button-group.cjs","names":["React","accentByColor","ButtonPrimitive"],"sources":["../../src/components/button-group.tsx"],"sourcesContent":["'use client'\n\nimport { Button as ButtonPrimitive } from '@base-ui/react/button'\nimport * as React from 'react'\nimport { accentByColor } from '../lib/accent-colors'\nimport type { SparkAccentColor } from '../lib/accent-colors'\nimport type { SparkStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\n\n// Button's chrome recipe (`buttonRecipe` in button.tsx), minus its `hover:`\n// half -- hover belongs on segments, not the shared group chrome. Shared with\n// button-group-pill.tsx.\nexport const buttonGroupRecipe =\n 'bg-(--spark-style-bg,var(--color-primary)) text-(--spark-style-fg,var(--color-primary-foreground)) shadow-[inset_0_0_0_var(--spark-style-border-width,1px)_var(--spark-style-border,transparent)]'\n\nexport function buttonGroupSizeClasses(size: 'small' | 'default') {\n return size === 'small'\n ? 'h-9 text-sm [&_svg:not([class*=size-])]:size-4'\n : 'h-10 text-base [&_svg:not([class*=size-])]:size-5'\n}\n\ninterface ButtonGroupProps extends React.HTMLAttributes<HTMLDivElement> {\n styleVariant?: SparkStyle\n color?: SparkAccentColor\n size?: 'small' | 'default'\n}\n\n/**\n * A layout group, not a toolbar: segments are independent tab stops in DOM\n * order (no roving tabindex). Pass `aria-label` when segments don't\n * self-describe (e.g. icon-only segments). For a fully-rounded status pill,\n * use `ButtonGroupPill` instead.\n */\nconst ButtonGroup = React.forwardRef<HTMLDivElement, ButtonGroupProps>(\n function ButtonGroup(\n {\n className,\n styleVariant = 'soft',\n color = 'neutral',\n size = 'default',\n ...props\n },\n ref,\n ) {\n return (\n <div\n data-slot=\"button-group\"\n role=\"group\"\n data-style={styleVariant}\n data-accent-color={accentByColor[color]}\n className={cn(\n 'isolate inline-flex items-stretch overflow-hidden rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))]',\n buttonGroupSizeClasses(size),\n buttonGroupRecipe,\n className,\n )}\n ref={ref}\n {...props}\n />\n )\n },\n)\n\nButtonGroup.displayName = 'ButtonGroup'\n\ninterface ButtonGroupButtonProps extends Omit<\n React.ComponentProps<typeof ButtonPrimitive>,\n 'ref'\n> {}\n\nconst ButtonGroupButton = React.forwardRef<\n HTMLButtonElement,\n ButtonGroupButtonProps\n>(function ButtonGroupButton(\n { className, render, nativeButton, ...props },\n ref,\n) {\n return (\n <ButtonPrimitive\n data-slot=\"button-group-button\"\n nativeButton={nativeButton ?? render === undefined}\n render={render}\n className={cn(\n 'inline-flex cursor-pointer items-center gap-2 px-3 font-medium whitespace-nowrap',\n 'transition-colors hover:bg-(--spark-style-bg-hover,var(--color-primary-hover)) motion-reduce:transition-none',\n 'focus-visible:inset-ring-2 focus-visible:outline-hidden',\n 'disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0',\n className,\n )}\n ref={ref}\n {...props}\n />\n )\n})\n\nButtonGroupButton.displayName = 'ButtonGroupButton'\n\nconst ButtonGroupText = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(function ButtonGroupText({ className, ...props }, ref) {\n return (\n <span\n data-slot=\"button-group-text\"\n className={cn(\n 'inline-flex items-center gap-2 px-3 font-medium whitespace-nowrap select-none',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0',\n className,\n )}\n ref={ref}\n {...props}\n />\n )\n})\n\nButtonGroupText.displayName = 'ButtonGroupText'\n\nconst ButtonGroupSeparator = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(function ButtonGroupSeparator({ className, ...props }, ref) {\n return (\n <div\n data-slot=\"button-group-separator\"\n aria-hidden=\"true\"\n className={cn(\n 'h-4 w-px shrink-0 self-center bg-current opacity-25',\n className,\n )}\n ref={ref}\n {...props}\n />\n )\n})\n\nButtonGroupSeparator.displayName = 'ButtonGroupSeparator'\n\nexport { ButtonGroup, ButtonGroupButton, ButtonGroupSeparator, ButtonGroupText }\nexport type { ButtonGroupProps, ButtonGroupButtonProps }\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,oBACX;AAEF,SAAgB,uBAAuB,MAA2B;CAChE,OAAO,SAAS,UACZ,mDACA;AACN;;;;;;;AAcA,MAAM,cAAcA,MAAM,WACxB,SAAS,YACP,EACE,WACA,eAAe,QACf,QAAQ,WACR,OAAO,WACP,GAAG,SAEL,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,aAAU;EACV,MAAK;EACL,cAAY;EACZ,qBAAmBC,0BAAAA,cAAc;EACjC,YAAA,GAAA,GAAA,IACE,sHACA,uBAAuB,IAAI,GAC3B,mBACA,SACF;EACK;EACL,GAAI;CACL,CAAA;AAEL,CACF;AAEA,YAAY,cAAc;AAO1B,MAAM,oBAAoBD,MAAM,WAG9B,SAAS,kBACT,EAAE,WAAW,QAAQ,cAAc,GAAG,SACtC,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,KAACE,sBAAAA,QAAD;EACE,aAAU;EACV,cAAc,gBAAgB,WAAW,KAAA;EACjC;EACR,YAAA,GAAA,GAAA,IACE,oFACA,gHACA,2DACA,+GACA,gDACA,SACF;EACK;EACL,GAAI;CACL,CAAA;AAEL,CAAC;AAED,kBAAkB,cAAc;AAEhC,MAAM,kBAAkBF,MAAM,WAG5B,SAAS,gBAAgB,EAAE,WAAW,GAAG,SAAS,KAAK;CACvD,OACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IACE,iFACA,gDACA,SACF;EACK;EACL,GAAI;CACL,CAAA;AAEL,CAAC;AAED,gBAAgB,cAAc;AAE9B,MAAM,uBAAuBA,MAAM,WAGjC,SAAS,qBAAqB,EAAE,WAAW,GAAG,SAAS,KAAK;CAC5D,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,aAAU;EACV,eAAY;EACZ,YAAA,GAAA,GAAA,IACE,uDACA,SACF;EACK;EACL,GAAI;CACL,CAAA;AAEL,CAAC;AAED,qBAAqB,cAAc"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { cn } from "../utils/cn.js";
|
|
4
3
|
import { accentByColor } from "../lib/accent-colors.js";
|
|
4
|
+
import { cn } from "../utils/cn.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { Button } from "@base-ui/react/button";
|
|
@@ -8,7 +8,7 @@ react = require_chunk.__toESM(react);
|
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let _base_ui_react_button = require("@base-ui/react/button");
|
|
10
10
|
let class_variance_authority = require("class-variance-authority");
|
|
11
|
-
let
|
|
11
|
+
let cn = require("cn");
|
|
12
12
|
//#region src/components/button.tsx
|
|
13
13
|
const buttonVariants = (0, class_variance_authority.cva)("group/button touch-target inline-flex cursor-pointer items-center justify-center gap-2 rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))] text-base font-medium whitespace-nowrap transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
14
14
|
variants: {
|
|
@@ -44,7 +44,7 @@ const Button = react.forwardRef(function Button({ className, styleVariant, color
|
|
|
44
44
|
"data-accent-color": color ? require_lib_accent_colors.accentByColor[color] : void 0,
|
|
45
45
|
nativeButton: nativeButton ?? render === void 0,
|
|
46
46
|
render,
|
|
47
|
-
className: (0,
|
|
47
|
+
className: (0, cn.cn)(buttonVariants({
|
|
48
48
|
size,
|
|
49
49
|
color
|
|
50
50
|
}), buttonRecipe, className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.cjs","names":["React","ButtonPrimitive","accentByColor"],"sources":["../../src/components/button.tsx"],"sourcesContent":["'use client'\n\nimport { Button as ButtonPrimitive } from '@base-ui/react/button'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\nimport { accentByColor } from '../lib/accent-colors'\nimport type { SparkStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\n\nconst buttonVariants = cva(\n 'group/button touch-target inline-flex cursor-pointer items-center justify-center gap-2 rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))] text-base font-medium whitespace-nowrap transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n primary:\n 'bg-(--spark-style-bg,var(--color-primary)) text-(--spark-style-fg,var(--color-primary-foreground)) hover:bg-(--spark-style-bg-hover,var(--color-primary-hover))',\n secondary:\n 'bg-gray-2 text-gray-a11 shadow-[inset_0_0_0_1px_var(--neutral-a7)] hover:bg-gray-a3',\n tertiary: 'bg-transparent text-gray-a11 hover:bg-gray-a3',\n bare: 'rounded-none! text-gray-12 outline-hidden!',\n destructive:\n 'bg-destructive-soft text-destructive-soft-foreground hover:bg-destructive-soft-hover focus-visible:ring-destructive',\n },\n color: {\n accent: '',\n primary: '',\n neutral: '',\n danger: 'focus-visible:ring-destructive',\n destructive: 'focus-visible:ring-destructive',\n },\n size: {\n small:\n 'h-9 px-3 text-sm [--spark-icon-size:16px] [&_svg:not([class*=size-])]:size-4',\n default:\n 'h-10 px-3 [--spark-icon-size:20px] [&_svg:not([class*=size-])]:size-5',\n medium:\n 'h-11 px-4 [--spark-icon-size:24px] [&_svg:not([class*=size-])]:size-6',\n 'icon-small':\n 'size-9 [--spark-icon-size:16px] [&_svg:not([class*=size-])]:size-4',\n icon: 'size-10 [--spark-icon-size:20px] [&_svg:not([class*=size-])]:size-5',\n 'icon-medium':\n 'size-11 [--spark-icon-size:24px] [&_svg:not([class*=size-])]:size-6',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n },\n)\n\nconst buttonRecipe =\n 'bg-(--spark-style-bg,var(--color-primary)) text-(--spark-style-fg,var(--color-primary-foreground)) hover:bg-(--spark-style-bg-hover,var(--color-primary-hover)) shadow-[inset_0_0_0_var(--spark-style-border-width,1px)_var(--spark-style-border,transparent)]'\n\n/** Preferred: `primary` | `neutral` | `destructive`. `accent` / `danger` stay as aliases. */\nexport type SparkButtonColor =\n | 'primary'\n | 'accent'\n | 'neutral'\n | 'destructive'\n | 'danger'\n\nexport interface ButtonProps\n extends\n Omit<React.ComponentProps<typeof ButtonPrimitive>, 'ref'>,\n Omit<VariantProps<typeof buttonVariants>, 'variant' | 'color'> {\n styleVariant?: SparkStyle\n color?: SparkButtonColor\n /**\n * @deprecated Not a `<Button>` prop and silently ignored -- use `styleVariant`\n * (`solid | soft | surface | ghost | outline`) and `color`\n * (`primary | neutral | destructive`) instead. The `variant` axis on\n * `buttonVariants` exists only for class-string callers.\n */\n variant?: never\n}\n\n// forwardRef keeps refs working for React 18 consumers (ref-as-prop is 19-only)\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n className,\n styleVariant,\n color,\n size,\n render,\n nativeButton,\n variant: _variant,\n ...props\n },\n ref,\n) {\n const hasLook = styleVariant !== undefined || color !== undefined\n const dataStyle = hasLook ? (styleVariant ?? 'solid') : undefined\n const dataAccentColor = color ? accentByColor[color] : undefined\n\n return (\n <ButtonPrimitive\n data-style={dataStyle}\n data-accent-color={dataAccentColor}\n nativeButton={nativeButton ?? render === undefined}\n render={render}\n className={cn(buttonVariants({ size, color }), buttonRecipe, className)}\n ref={ref}\n {...props}\n />\n )\n})\n\nButton.displayName = 'Button'\n\nexport { Button, buttonVariants }\n"],"mappings":";;;;;;;;;;;;AASA,MAAM,kBAAA,GAAA,yBAAA,KACJ,0dACA;CACE,UAAU;EACR,SAAS;GACP,SACE;GACF,WACE;GACF,UAAU;GACV,MAAM;GACN,aACE;EACJ;EACA,OAAO;GACL,QAAQ;GACR,SAAS;GACT,SAAS;GACT,QAAQ;GACR,aAAa;EACf;EACA,MAAM;GACJ,OACE;GACF,SACE;GACF,QACE;GACF,cACE;GACF,MAAM;GACN,eACE;EACJ;CACF;CACA,iBAAiB,EACf,MAAM,UACR;AACF,CACF;AAEA,MAAM,eACJ;AA0BF,MAAM,SAASA,MAAM,WAA2C,SAAS,OACvE,EACE,WACA,cACA,OACA,MACA,QACA,cACA,SAAS,UACT,GAAG,SAEL,KACA;CAKA,OACE,iBAAA,GAAA,kBAAA,KAACC,sBAAAA,QAAD;EACE,cANY,iBAAiB,KAAA,KAAa,UAAU,KAAA,IAC3B,gBAAgB,UAAW,KAAA;EAMpD,qBALoB,QAAQC,0BAAAA,cAAc,SAAS,KAAA;EAMnD,cAAc,gBAAgB,WAAW,KAAA;EACjC;EACR,YAAA,GAAA,
|
|
1
|
+
{"version":3,"file":"button.cjs","names":["React","ButtonPrimitive","accentByColor"],"sources":["../../src/components/button.tsx"],"sourcesContent":["'use client'\n\nimport { Button as ButtonPrimitive } from '@base-ui/react/button'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\nimport { accentByColor } from '../lib/accent-colors'\nimport type { SparkStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\n\nconst buttonVariants = cva(\n 'group/button touch-target inline-flex cursor-pointer items-center justify-center gap-2 rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))] text-base font-medium whitespace-nowrap transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n primary:\n 'bg-(--spark-style-bg,var(--color-primary)) text-(--spark-style-fg,var(--color-primary-foreground)) hover:bg-(--spark-style-bg-hover,var(--color-primary-hover))',\n secondary:\n 'bg-gray-2 text-gray-a11 shadow-[inset_0_0_0_1px_var(--neutral-a7)] hover:bg-gray-a3',\n tertiary: 'bg-transparent text-gray-a11 hover:bg-gray-a3',\n bare: 'rounded-none! text-gray-12 outline-hidden!',\n destructive:\n 'bg-destructive-soft text-destructive-soft-foreground hover:bg-destructive-soft-hover focus-visible:ring-destructive',\n },\n color: {\n accent: '',\n primary: '',\n neutral: '',\n danger: 'focus-visible:ring-destructive',\n destructive: 'focus-visible:ring-destructive',\n },\n size: {\n small:\n 'h-9 px-3 text-sm [--spark-icon-size:16px] [&_svg:not([class*=size-])]:size-4',\n default:\n 'h-10 px-3 [--spark-icon-size:20px] [&_svg:not([class*=size-])]:size-5',\n medium:\n 'h-11 px-4 [--spark-icon-size:24px] [&_svg:not([class*=size-])]:size-6',\n 'icon-small':\n 'size-9 [--spark-icon-size:16px] [&_svg:not([class*=size-])]:size-4',\n icon: 'size-10 [--spark-icon-size:20px] [&_svg:not([class*=size-])]:size-5',\n 'icon-medium':\n 'size-11 [--spark-icon-size:24px] [&_svg:not([class*=size-])]:size-6',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n },\n)\n\nconst buttonRecipe =\n 'bg-(--spark-style-bg,var(--color-primary)) text-(--spark-style-fg,var(--color-primary-foreground)) hover:bg-(--spark-style-bg-hover,var(--color-primary-hover)) shadow-[inset_0_0_0_var(--spark-style-border-width,1px)_var(--spark-style-border,transparent)]'\n\n/** Preferred: `primary` | `neutral` | `destructive`. `accent` / `danger` stay as aliases. */\nexport type SparkButtonColor =\n | 'primary'\n | 'accent'\n | 'neutral'\n | 'destructive'\n | 'danger'\n\nexport interface ButtonProps\n extends\n Omit<React.ComponentProps<typeof ButtonPrimitive>, 'ref'>,\n Omit<VariantProps<typeof buttonVariants>, 'variant' | 'color'> {\n styleVariant?: SparkStyle\n color?: SparkButtonColor\n /**\n * @deprecated Not a `<Button>` prop and silently ignored -- use `styleVariant`\n * (`solid | soft | surface | ghost | outline`) and `color`\n * (`primary | neutral | destructive`) instead. The `variant` axis on\n * `buttonVariants` exists only for class-string callers.\n */\n variant?: never\n}\n\n// forwardRef keeps refs working for React 18 consumers (ref-as-prop is 19-only)\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n className,\n styleVariant,\n color,\n size,\n render,\n nativeButton,\n variant: _variant,\n ...props\n },\n ref,\n) {\n const hasLook = styleVariant !== undefined || color !== undefined\n const dataStyle = hasLook ? (styleVariant ?? 'solid') : undefined\n const dataAccentColor = color ? accentByColor[color] : undefined\n\n return (\n <ButtonPrimitive\n data-style={dataStyle}\n data-accent-color={dataAccentColor}\n nativeButton={nativeButton ?? render === undefined}\n render={render}\n className={cn(buttonVariants({ size, color }), buttonRecipe, className)}\n ref={ref}\n {...props}\n />\n )\n})\n\nButton.displayName = 'Button'\n\nexport { Button, buttonVariants }\n"],"mappings":";;;;;;;;;;;;AASA,MAAM,kBAAA,GAAA,yBAAA,KACJ,0dACA;CACE,UAAU;EACR,SAAS;GACP,SACE;GACF,WACE;GACF,UAAU;GACV,MAAM;GACN,aACE;EACJ;EACA,OAAO;GACL,QAAQ;GACR,SAAS;GACT,SAAS;GACT,QAAQ;GACR,aAAa;EACf;EACA,MAAM;GACJ,OACE;GACF,SACE;GACF,QACE;GACF,cACE;GACF,MAAM;GACN,eACE;EACJ;CACF;CACA,iBAAiB,EACf,MAAM,UACR;AACF,CACF;AAEA,MAAM,eACJ;AA0BF,MAAM,SAASA,MAAM,WAA2C,SAAS,OACvE,EACE,WACA,cACA,OACA,MACA,QACA,cACA,SAAS,UACT,GAAG,SAEL,KACA;CAKA,OACE,iBAAA,GAAA,kBAAA,KAACC,sBAAAA,QAAD;EACE,cANY,iBAAiB,KAAA,KAAa,UAAU,KAAA,IAC3B,gBAAgB,UAAW,KAAA;EAMpD,qBALoB,QAAQC,0BAAAA,cAAc,SAAS,KAAA;EAMnD,cAAc,gBAAgB,WAAW,KAAA;EACjC;EACR,YAAA,GAAA,GAAA,IAAc,eAAe;GAAE;GAAM;EAAM,CAAC,GAAG,cAAc,SAAS;EACjE;EACL,GAAI;CACL,CAAA;AAEL,CAAC;AAED,OAAO,cAAc"}
|
|
@@ -7,8 +7,8 @@ import { VariantProps } from "class-variance-authority";
|
|
|
7
7
|
|
|
8
8
|
//#region src/components/button.d.ts
|
|
9
9
|
declare const buttonVariants: (props?: ({
|
|
10
|
-
variant?: "
|
|
11
|
-
color?: "
|
|
10
|
+
variant?: "secondary" | "destructive" | "primary" | "tertiary" | "bare" | null | undefined;
|
|
11
|
+
color?: "accent" | "destructive" | "neutral" | "primary" | "danger" | null | undefined;
|
|
12
12
|
size?: "small" | "default" | "medium" | "icon-small" | "icon" | "icon-medium" | null | undefined;
|
|
13
13
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
14
14
|
/** Preferred: `primary` | `neutral` | `destructive`. `accent` / `danger` stay as aliases. */
|
|
@@ -7,8 +7,8 @@ import { VariantProps } from "class-variance-authority";
|
|
|
7
7
|
|
|
8
8
|
//#region src/components/button.d.ts
|
|
9
9
|
declare const buttonVariants: (props?: ({
|
|
10
|
-
variant?: "
|
|
11
|
-
color?: "
|
|
10
|
+
variant?: "secondary" | "destructive" | "primary" | "tertiary" | "bare" | null | undefined;
|
|
11
|
+
color?: "accent" | "destructive" | "neutral" | "primary" | "danger" | null | undefined;
|
|
12
12
|
size?: "small" | "default" | "medium" | "icon-small" | "icon" | "icon-medium" | null | undefined;
|
|
13
13
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
14
14
|
/** Preferred: `primary` | `neutral` | `destructive`. `accent` / `danger` stay as aliases. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { cn } from "../utils/cn.js";
|
|
4
3
|
import { accentByColor } from "../lib/accent-colors.js";
|
|
4
|
+
import { cn } from "../utils/cn.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { Button as Button$1 } from "@base-ui/react/button";
|
|
@@ -7,21 +7,21 @@ react = require_chunk.__toESM(react);
|
|
|
7
7
|
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let _daypicker_react = require("@daypicker/react");
|
|
10
|
-
let
|
|
10
|
+
let cn = require("cn");
|
|
11
11
|
//#region src/components/calendar.tsx
|
|
12
12
|
function Calendar({ className, classNames, showOutsideDays = true, fixedWeeks = true, showTodayDot = true, ...props }) {
|
|
13
13
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_daypicker_react.DayPicker, {
|
|
14
|
-
className: (0,
|
|
14
|
+
className: (0, cn.cn)("p-3", className),
|
|
15
15
|
classNames: {
|
|
16
16
|
months: "relative",
|
|
17
17
|
month: "flex flex-col gap-2",
|
|
18
18
|
month_caption: "flex h-10 items-center justify-center",
|
|
19
19
|
caption_label: "text-sm font-bold text-gray",
|
|
20
|
-
button_previous: (0,
|
|
20
|
+
button_previous: (0, cn.cn)(require_components_button.buttonVariants({
|
|
21
21
|
size: "icon",
|
|
22
22
|
variant: "tertiary"
|
|
23
23
|
}), "absolute top-0 left-0 z-10 text-gray-light hover:text-gray [[data-high-contrast]_&]:text-gray-a12"),
|
|
24
|
-
button_next: (0,
|
|
24
|
+
button_next: (0, cn.cn)(require_components_button.buttonVariants({
|
|
25
25
|
size: "icon",
|
|
26
26
|
variant: "tertiary"
|
|
27
27
|
}), "absolute top-0 right-0 z-10 text-gray-light hover:text-gray [[data-high-contrast]_&]:text-gray-a12"),
|
|
@@ -29,15 +29,15 @@ function Calendar({ className, classNames, showOutsideDays = true, fixedWeeks =
|
|
|
29
29
|
weekdays: "flex w-full justify-between",
|
|
30
30
|
weekday: "mt-0.5 flex h-10 w-10 items-center justify-center rounded-full text-sm font-bold text-gray",
|
|
31
31
|
week: "mt-1 flex w-full justify-between",
|
|
32
|
-
day: (0,
|
|
33
|
-
day_button: (0,
|
|
32
|
+
day: (0, cn.cn)("relative mx-0.5 flex h-10 w-10 items-center justify-center rounded-full p-0 text-center text-sm focus-within:relative focus-within:z-20", props.mode === "range" ? "[&:has(>.range-end)]:rounded-r-full [&:has(>.range-start)]:rounded-l-full first:[&:has([aria-selected])]:rounded-l-full last:[&:has([aria-selected])]:rounded-r-full" : "[&:has([aria-selected])]:rounded-full"),
|
|
33
|
+
day_button: (0, cn.cn)(require_components_button.buttonVariants({
|
|
34
34
|
size: "icon",
|
|
35
35
|
variant: "tertiary"
|
|
36
36
|
}), "size-10 shrink-0 rounded-full p-0 font-normal text-gray in-aria-selected:rounded-full in-aria-selected:bg-(--spark-style-bg,var(--color-primary)) in-aria-selected:text-(--spark-style-fg,var(--color-primary-foreground)) hover:in-aria-selected:bg-(--spark-style-bg-hover,var(--color-primary-hover)) [[data-high-contrast]_[data-outside]:not([data-disabled])_&]:text-gray-a12 [[data-outside]:not([data-disabled])_&]:text-gray-light"),
|
|
37
37
|
range_start: "range-start",
|
|
38
38
|
range_end: "range-end",
|
|
39
39
|
selected: "rounded-full",
|
|
40
|
-
today: (0,
|
|
40
|
+
today: (0, cn.cn)("relative bg-base-gray-soft text-gray", showTodayDot && "after:absolute after:right-0 after:-bottom-1 after:left-0 after:m-auto after:inline-flex after:h-1 after:w-1 after:rounded-full after:bg-(--spark-style-bg,var(--color-primary)) after:content-[\"\"]"),
|
|
41
41
|
outside: "outside aria-selected:bg-base-gray-soft aria-selected:text-gray-light",
|
|
42
42
|
disabled: "text-gray-light opacity-50",
|
|
43
43
|
range_middle: "aria-selected:bg-base-gray-soft aria-selected:text-gray",
|
|
@@ -45,7 +45,7 @@ function Calendar({ className, classNames, showOutsideDays = true, fixedWeeks =
|
|
|
45
45
|
...classNames
|
|
46
46
|
},
|
|
47
47
|
components: { Chevron: ({ orientation }) => {
|
|
48
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(orientation === "right" ? _epilot_spark_icons.ChevronRight : _epilot_spark_icons.ChevronLeft, { className: (0,
|
|
48
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(orientation === "right" ? _epilot_spark_icons.ChevronRight : _epilot_spark_icons.ChevronLeft, { className: (0, cn.cn)("[--spark-icon-size:20px]", orientation === "up" && "rotate-90", orientation === "down" && "-rotate-90") });
|
|
49
49
|
} },
|
|
50
50
|
fixedWeeks,
|
|
51
51
|
showOutsideDays,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.cjs","names":["DayPicker","buttonVariants","ChevronRight","ChevronLeft"],"sources":["../../src/components/calendar.tsx"],"sourcesContent":["import { DayPicker } from '@daypicker/react'\nimport { ChevronLeft, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\n\ntype CalendarProps = React.ComponentProps<typeof DayPicker> & {\n showTodayDot?: boolean\n}\n\n// Pass `locale` (from '@daypicker/react/locale') for localized month/weekday\n// names — the library ships no language default.\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n fixedWeeks = true,\n showTodayDot = true,\n ...props\n}: CalendarProps) {\n return (\n <DayPicker\n className={cn('p-3', className)}\n classNames={{\n months: 'relative',\n month: 'flex flex-col gap-2',\n month_caption: 'flex h-10 items-center justify-center',\n caption_label: 'text-sm font-bold text-gray',\n button_previous: cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n 'absolute top-0 left-0 z-10 text-gray-light hover:text-gray [[data-high-contrast]_&]:text-gray-a12',\n ),\n button_next: cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n 'absolute top-0 right-0 z-10 text-gray-light hover:text-gray [[data-high-contrast]_&]:text-gray-a12',\n ),\n month_grid: 'w-full border-collapse',\n weekdays: 'flex w-full justify-between',\n weekday:\n 'mt-0.5 flex h-10 w-10 items-center justify-center rounded-full text-sm font-bold text-gray',\n week: 'mt-1 flex w-full justify-between',\n day: cn(\n 'relative mx-0.5 flex h-10 w-10 items-center justify-center rounded-full p-0 text-center text-sm focus-within:relative focus-within:z-20',\n props.mode === 'range'\n ? '[&:has(>.range-end)]:rounded-r-full [&:has(>.range-start)]:rounded-l-full first:[&:has([aria-selected])]:rounded-l-full last:[&:has([aria-selected])]:rounded-r-full'\n : '[&:has([aria-selected])]:rounded-full',\n ),\n day_button: cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n // hover:…:bg-(--spark-style-bg-hover) outranks tertiary's hover:bg-gray-a3 —\n // selected days darken like a solid button instead of washing out gray\n 'size-10 shrink-0 rounded-full p-0 font-normal text-gray in-aria-selected:rounded-full in-aria-selected:bg-(--spark-style-bg,var(--color-primary)) in-aria-selected:text-(--spark-style-fg,var(--color-primary-foreground)) hover:in-aria-selected:bg-(--spark-style-bg-hover,var(--color-primary-hover)) [[data-high-contrast]_[data-outside]:not([data-disabled])_&]:text-gray-a12 [[data-outside]:not([data-disabled])_&]:text-gray-light',\n ),\n range_start: 'range-start',\n range_end: 'range-end',\n selected: 'rounded-full',\n today: cn(\n 'relative bg-base-gray-soft text-gray',\n showTodayDot &&\n 'after:absolute after:right-0 after:-bottom-1 after:left-0 after:m-auto after:inline-flex after:h-1 after:w-1 after:rounded-full after:bg-(--spark-style-bg,var(--color-primary)) after:content-[\"\"]',\n ),\n outside:\n 'outside aria-selected:bg-base-gray-soft aria-selected:text-gray-light',\n disabled: 'text-gray-light opacity-50',\n range_middle: 'aria-selected:bg-base-gray-soft aria-selected:text-gray',\n hidden: 'invisible',\n ...classNames,\n }}\n components={{\n Chevron: ({ orientation }) => {\n const Glyph = orientation === 'right' ? ChevronRight : ChevronLeft\n return (\n <Glyph\n className={cn(\n '[--spark-icon-size:20px]',\n orientation === 'up' && 'rotate-90',\n orientation === 'down' && '-rotate-90',\n )}\n />\n )\n },\n }}\n fixedWeeks={fixedWeeks}\n showOutsideDays={showOutsideDays}\n {...props}\n />\n )\n}\n\nexport { Calendar }\nexport type { CalendarProps }\n"],"mappings":";;;;;;;;;;;AAYA,SAAS,SAAS,EAChB,WACA,YACA,kBAAkB,MAClB,aAAa,MACb,eAAe,MACf,GAAG,SACa;CAChB,OACE,iBAAA,GAAA,kBAAA,KAACA,iBAAAA,WAAD;EACE,YAAA,GAAA,
|
|
1
|
+
{"version":3,"file":"calendar.cjs","names":["DayPicker","buttonVariants","ChevronRight","ChevronLeft"],"sources":["../../src/components/calendar.tsx"],"sourcesContent":["import { DayPicker } from '@daypicker/react'\nimport { ChevronLeft, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\n\ntype CalendarProps = React.ComponentProps<typeof DayPicker> & {\n showTodayDot?: boolean\n}\n\n// Pass `locale` (from '@daypicker/react/locale') for localized month/weekday\n// names — the library ships no language default.\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n fixedWeeks = true,\n showTodayDot = true,\n ...props\n}: CalendarProps) {\n return (\n <DayPicker\n className={cn('p-3', className)}\n classNames={{\n months: 'relative',\n month: 'flex flex-col gap-2',\n month_caption: 'flex h-10 items-center justify-center',\n caption_label: 'text-sm font-bold text-gray',\n button_previous: cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n 'absolute top-0 left-0 z-10 text-gray-light hover:text-gray [[data-high-contrast]_&]:text-gray-a12',\n ),\n button_next: cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n 'absolute top-0 right-0 z-10 text-gray-light hover:text-gray [[data-high-contrast]_&]:text-gray-a12',\n ),\n month_grid: 'w-full border-collapse',\n weekdays: 'flex w-full justify-between',\n weekday:\n 'mt-0.5 flex h-10 w-10 items-center justify-center rounded-full text-sm font-bold text-gray',\n week: 'mt-1 flex w-full justify-between',\n day: cn(\n 'relative mx-0.5 flex h-10 w-10 items-center justify-center rounded-full p-0 text-center text-sm focus-within:relative focus-within:z-20',\n props.mode === 'range'\n ? '[&:has(>.range-end)]:rounded-r-full [&:has(>.range-start)]:rounded-l-full first:[&:has([aria-selected])]:rounded-l-full last:[&:has([aria-selected])]:rounded-r-full'\n : '[&:has([aria-selected])]:rounded-full',\n ),\n day_button: cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n // hover:…:bg-(--spark-style-bg-hover) outranks tertiary's hover:bg-gray-a3 —\n // selected days darken like a solid button instead of washing out gray\n 'size-10 shrink-0 rounded-full p-0 font-normal text-gray in-aria-selected:rounded-full in-aria-selected:bg-(--spark-style-bg,var(--color-primary)) in-aria-selected:text-(--spark-style-fg,var(--color-primary-foreground)) hover:in-aria-selected:bg-(--spark-style-bg-hover,var(--color-primary-hover)) [[data-high-contrast]_[data-outside]:not([data-disabled])_&]:text-gray-a12 [[data-outside]:not([data-disabled])_&]:text-gray-light',\n ),\n range_start: 'range-start',\n range_end: 'range-end',\n selected: 'rounded-full',\n today: cn(\n 'relative bg-base-gray-soft text-gray',\n showTodayDot &&\n 'after:absolute after:right-0 after:-bottom-1 after:left-0 after:m-auto after:inline-flex after:h-1 after:w-1 after:rounded-full after:bg-(--spark-style-bg,var(--color-primary)) after:content-[\"\"]',\n ),\n outside:\n 'outside aria-selected:bg-base-gray-soft aria-selected:text-gray-light',\n disabled: 'text-gray-light opacity-50',\n range_middle: 'aria-selected:bg-base-gray-soft aria-selected:text-gray',\n hidden: 'invisible',\n ...classNames,\n }}\n components={{\n Chevron: ({ orientation }) => {\n const Glyph = orientation === 'right' ? ChevronRight : ChevronLeft\n return (\n <Glyph\n className={cn(\n '[--spark-icon-size:20px]',\n orientation === 'up' && 'rotate-90',\n orientation === 'down' && '-rotate-90',\n )}\n />\n )\n },\n }}\n fixedWeeks={fixedWeeks}\n showOutsideDays={showOutsideDays}\n {...props}\n />\n )\n}\n\nexport { Calendar }\nexport type { CalendarProps }\n"],"mappings":";;;;;;;;;;;AAYA,SAAS,SAAS,EAChB,WACA,YACA,kBAAkB,MAClB,aAAa,MACb,eAAe,MACf,GAAG,SACa;CAChB,OACE,iBAAA,GAAA,kBAAA,KAACA,iBAAAA,WAAD;EACE,YAAA,GAAA,GAAA,IAAc,OAAO,SAAS;EAC9B,YAAY;GACV,QAAQ;GACR,OAAO;GACP,eAAe;GACf,eAAe;GACf,kBAAA,GAAA,GAAA,IACEC,0BAAAA,eAAe;IAAE,MAAM;IAAQ,SAAS;GAAW,CAAC,GACpD,mGACF;GACA,cAAA,GAAA,GAAA,IACEA,0BAAAA,eAAe;IAAE,MAAM;IAAQ,SAAS;GAAW,CAAC,GACpD,oGACF;GACA,YAAY;GACZ,UAAU;GACV,SACE;GACF,MAAM;GACN,MAAA,GAAA,GAAA,IACE,2IACA,MAAM,SAAS,UACX,yKACA,uCACN;GACA,aAAA,GAAA,GAAA,IACEA,0BAAAA,eAAe;IAAE,MAAM;IAAQ,SAAS;GAAW,CAAC,GAGpD,6aACF;GACA,aAAa;GACb,WAAW;GACX,UAAU;GACV,QAAA,GAAA,GAAA,IACE,wCACA,gBACE,uMACJ;GACA,SACE;GACF,UAAU;GACV,cAAc;GACd,QAAQ;GACR,GAAG;EACL;EACA,YAAY,EACV,UAAU,EAAE,kBAAkB;GAE5B,OACE,iBAAA,GAAA,kBAAA,KAFY,gBAAgB,UAAUC,oBAAAA,eAAeC,oBAAAA,aAErD,EACE,YAAA,GAAA,GAAA,IACE,4BACA,gBAAgB,QAAQ,aACxB,gBAAgB,UAAU,YAC5B,EACD,CAAA;EAEL,EACF;EACY;EACK;EACjB,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -7,7 +7,7 @@ react = require_chunk.__toESM(react);
|
|
|
7
7
|
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let class_variance_authority = require("class-variance-authority");
|
|
10
|
-
let
|
|
10
|
+
let cn = require("cn");
|
|
11
11
|
//#region src/components/callout.tsx
|
|
12
12
|
const calloutVariants = (0, class_variance_authority.cva)("group/callout flex w-full items-start gap-2 rounded-lg px-4 py-3 text-sm transition-colors duration-150 ease-out motion-reduce:transition-none", {
|
|
13
13
|
variants: { variant: {
|
|
@@ -43,12 +43,12 @@ const CALLOUT_ICONS = {
|
|
|
43
43
|
};
|
|
44
44
|
const CalloutTitle = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
45
45
|
"data-slot": "callout-title",
|
|
46
|
-
className: (0,
|
|
46
|
+
className: (0, cn.cn)("text-base leading-5 font-semibold", className),
|
|
47
47
|
...props
|
|
48
48
|
});
|
|
49
49
|
const CalloutDescription = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
50
50
|
"data-slot": "callout-description",
|
|
51
|
-
className: (0,
|
|
51
|
+
className: (0, cn.cn)("text-sm", className),
|
|
52
52
|
...props
|
|
53
53
|
});
|
|
54
54
|
const CalloutVariantContext = react.createContext("info");
|
|
@@ -61,7 +61,7 @@ const CALLOUT_ACTION_COLORS = {
|
|
|
61
61
|
};
|
|
62
62
|
const CalloutActions = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
63
63
|
"data-slot": "callout-actions",
|
|
64
|
-
className: (0,
|
|
64
|
+
className: (0, cn.cn)("mt-2 flex flex-wrap items-center gap-2 [&_[data-slot=callout-action]]:mt-0", className),
|
|
65
65
|
...props
|
|
66
66
|
});
|
|
67
67
|
const CalloutAction = ({ className, align = "start", primary = false, ...props }) => {
|
|
@@ -71,7 +71,7 @@ const CalloutAction = ({ className, align = "start", primary = false, ...props }
|
|
|
71
71
|
size: "small",
|
|
72
72
|
styleVariant: primary ? "solid" : "surface",
|
|
73
73
|
color: primary ? "primary" : "neutral",
|
|
74
|
-
className: (0,
|
|
74
|
+
className: (0, cn.cn)("mt-2 w-fit", {
|
|
75
75
|
"self-start": align === "start",
|
|
76
76
|
"self-end": align === "end"
|
|
77
77
|
}, !primary && CALLOUT_ACTION_COLORS[calloutVariant], className),
|
|
@@ -85,9 +85,9 @@ const Callout = ({ variant = "info", icon, className, children, ...props }) => {
|
|
|
85
85
|
value: variant ?? "info",
|
|
86
86
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
87
87
|
"data-slot": "callout",
|
|
88
|
-
className: (0,
|
|
88
|
+
className: (0, cn.cn)(calloutVariants({ variant }), className),
|
|
89
89
|
...props,
|
|
90
|
-
children: [Glyph ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Glyph, { className: (0,
|
|
90
|
+
children: [Glyph ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Glyph, { className: (0, cn.cn)("[--spark-icon-size:calc(20px*var(--spark-scaling,1))]", variantIcon.className) }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
91
91
|
className: "flex w-full min-w-0 flex-col gap-1",
|
|
92
92
|
children
|
|
93
93
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callout.cjs","names":["Cancel","CheckCircle","Warning","Info","React","Button"],"sources":["../../src/components/callout.tsx"],"sourcesContent":["import {\n Cancel,\n CheckCircle,\n Info,\n Warning,\n type SparkIcon,\n} from '@epilot/spark-icons'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { Button, type ButtonProps } from './button'\n\ntype CalloutVariant = 'error' | 'info' | 'neutral' | 'success' | 'warning'\n\nconst calloutVariants = cva(\n 'group/callout flex w-full items-start gap-2 rounded-lg px-4 py-3 text-sm transition-colors duration-150 ease-out motion-reduce:transition-none',\n {\n variants: {\n variant: {\n error: 'bg-error-soft text-error-soft-foreground',\n success: 'bg-success-soft text-success-soft-foreground',\n warning: 'bg-warning-soft text-warning-soft-foreground',\n info: 'bg-base-info-soft text-info',\n neutral: 'bg-base-gray-soft text-gray',\n },\n },\n defaultVariants: {\n variant: 'info',\n },\n },\n)\n\nconst CALLOUT_ICONS: Record<\n CalloutVariant,\n { icon: SparkIcon; className: string }\n> = {\n error: { icon: Cancel, className: 'text-error-soft-foreground' },\n success: { icon: CheckCircle, className: 'text-success-soft-foreground' },\n warning: { icon: Warning, className: 'text-warning-soft-foreground' },\n info: { icon: Info, className: 'text-info-light' },\n neutral: { icon: Info, className: 'text-gray-light' },\n}\n\ninterface CalloutProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof calloutVariants> {\n /** Overrides the variant's default icon; the variant's color is kept. `false` renders no icon. */\n icon?: SparkIcon | false\n}\n\nconst CalloutTitle = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => (\n <span\n data-slot=\"callout-title\"\n className={cn('text-base leading-5 font-semibold', className)}\n {...props}\n />\n)\n\nconst CalloutDescription = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLParagraphElement>) => (\n <p\n data-slot=\"callout-description\"\n className={cn('text-sm', className)}\n {...props}\n />\n)\n\nconst CalloutVariantContext = React.createContext<CalloutVariant>('info')\n\nconst CALLOUT_ACTION_COLORS: Record<CalloutVariant, string> = {\n error:\n 'bg-error-soft text-error-soft-foreground hover:bg-error-soft-hover focus-visible:bg-error-soft-hover',\n success:\n 'bg-success-soft text-success-soft-foreground hover:bg-success-soft-hover focus-visible:bg-success-soft-hover',\n warning:\n 'bg-warning-soft text-warning-soft-foreground hover:bg-warning-soft-hover focus-visible:bg-warning-soft-hover',\n info: 'bg-base-info-soft text-info hover:bg-blue-a4 focus-visible:bg-blue-a4',\n neutral:\n 'bg-base-gray-soft text-gray hover:bg-gray-a4 focus-visible:bg-gray-a4',\n}\n\nconst CalloutActions = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"callout-actions\"\n className={cn(\n 'mt-2 flex flex-wrap items-center gap-2 [&_[data-slot=callout-action]]:mt-0',\n className,\n )}\n {...props}\n />\n)\n\ntype CalloutActionType = Omit<ButtonProps, 'styleVariant' | 'color'> & {\n align?: 'start' | 'end'\n primary?: boolean\n}\n\nconst CalloutAction = ({\n className,\n align = 'start',\n primary = false,\n ...props\n}: CalloutActionType) => {\n const calloutVariant = React.useContext(CalloutVariantContext)\n\n return (\n <Button\n data-slot=\"callout-action\"\n size=\"small\"\n styleVariant={primary ? 'solid' : 'surface'}\n color={primary ? 'primary' : 'neutral'}\n className={cn(\n 'mt-2 w-fit',\n { 'self-start': align === 'start', 'self-end': align === 'end' },\n !primary && CALLOUT_ACTION_COLORS[calloutVariant],\n className,\n )}\n {...props}\n />\n )\n}\n\nconst Callout = ({\n variant = 'info',\n icon,\n className,\n children,\n ...props\n}: CalloutProps) => {\n const variantIcon = CALLOUT_ICONS[variant ?? 'info']\n const Glyph = icon === false ? null : (icon ?? variantIcon.icon)\n\n return (\n <CalloutVariantContext.Provider value={variant ?? 'info'}>\n <div\n data-slot=\"callout\"\n className={cn(calloutVariants({ variant }), className)}\n {...props}\n >\n {Glyph ? (\n <Glyph\n className={cn(\n '[--spark-icon-size:calc(20px*var(--spark-scaling,1))]',\n variantIcon.className,\n )}\n />\n ) : null}\n <div className=\"flex w-full min-w-0 flex-col gap-1\">{children}</div>\n </div>\n </CalloutVariantContext.Provider>\n )\n}\n\nexport {\n Callout,\n CalloutAction,\n CalloutActions,\n CalloutDescription,\n CalloutTitle,\n calloutVariants,\n}\nexport type { CalloutProps, CalloutVariant }\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,mBAAA,GAAA,yBAAA,KACJ,kJACA;CACE,UAAU,EACR,SAAS;EACP,OAAO;EACP,SAAS;EACT,SAAS;EACT,MAAM;EACN,SAAS;CACX,EACF;CACA,iBAAiB,EACf,SAAS,OACX;AACF,CACF;AAEA,MAAM,gBAGF;CACF,OAAO;EAAE,MAAMA,oBAAAA;EAAQ,WAAW;CAA6B;CAC/D,SAAS;EAAE,MAAMC,oBAAAA;EAAa,WAAW;CAA+B;CACxE,SAAS;EAAE,MAAMC,oBAAAA;EAAS,WAAW;CAA+B;CACpE,MAAM;EAAE,MAAMC,oBAAAA;EAAM,WAAW;CAAkB;CACjD,SAAS;EAAE,MAAMA,oBAAAA;EAAM,WAAW;CAAkB;AACtD;AAUA,MAAM,gBAAgB,EACpB,WACA,GAAG,YAEH,iBAAA,GAAA,kBAAA,KAAC,QAAD;CACE,aAAU;CACV,YAAA,GAAA,
|
|
1
|
+
{"version":3,"file":"callout.cjs","names":["Cancel","CheckCircle","Warning","Info","React","Button"],"sources":["../../src/components/callout.tsx"],"sourcesContent":["import {\n Cancel,\n CheckCircle,\n Info,\n Warning,\n type SparkIcon,\n} from '@epilot/spark-icons'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { Button, type ButtonProps } from './button'\n\ntype CalloutVariant = 'error' | 'info' | 'neutral' | 'success' | 'warning'\n\nconst calloutVariants = cva(\n 'group/callout flex w-full items-start gap-2 rounded-lg px-4 py-3 text-sm transition-colors duration-150 ease-out motion-reduce:transition-none',\n {\n variants: {\n variant: {\n error: 'bg-error-soft text-error-soft-foreground',\n success: 'bg-success-soft text-success-soft-foreground',\n warning: 'bg-warning-soft text-warning-soft-foreground',\n info: 'bg-base-info-soft text-info',\n neutral: 'bg-base-gray-soft text-gray',\n },\n },\n defaultVariants: {\n variant: 'info',\n },\n },\n)\n\nconst CALLOUT_ICONS: Record<\n CalloutVariant,\n { icon: SparkIcon; className: string }\n> = {\n error: { icon: Cancel, className: 'text-error-soft-foreground' },\n success: { icon: CheckCircle, className: 'text-success-soft-foreground' },\n warning: { icon: Warning, className: 'text-warning-soft-foreground' },\n info: { icon: Info, className: 'text-info-light' },\n neutral: { icon: Info, className: 'text-gray-light' },\n}\n\ninterface CalloutProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof calloutVariants> {\n /** Overrides the variant's default icon; the variant's color is kept. `false` renders no icon. */\n icon?: SparkIcon | false\n}\n\nconst CalloutTitle = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => (\n <span\n data-slot=\"callout-title\"\n className={cn('text-base leading-5 font-semibold', className)}\n {...props}\n />\n)\n\nconst CalloutDescription = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLParagraphElement>) => (\n <p\n data-slot=\"callout-description\"\n className={cn('text-sm', className)}\n {...props}\n />\n)\n\nconst CalloutVariantContext = React.createContext<CalloutVariant>('info')\n\nconst CALLOUT_ACTION_COLORS: Record<CalloutVariant, string> = {\n error:\n 'bg-error-soft text-error-soft-foreground hover:bg-error-soft-hover focus-visible:bg-error-soft-hover',\n success:\n 'bg-success-soft text-success-soft-foreground hover:bg-success-soft-hover focus-visible:bg-success-soft-hover',\n warning:\n 'bg-warning-soft text-warning-soft-foreground hover:bg-warning-soft-hover focus-visible:bg-warning-soft-hover',\n info: 'bg-base-info-soft text-info hover:bg-blue-a4 focus-visible:bg-blue-a4',\n neutral:\n 'bg-base-gray-soft text-gray hover:bg-gray-a4 focus-visible:bg-gray-a4',\n}\n\nconst CalloutActions = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"callout-actions\"\n className={cn(\n 'mt-2 flex flex-wrap items-center gap-2 [&_[data-slot=callout-action]]:mt-0',\n className,\n )}\n {...props}\n />\n)\n\ntype CalloutActionType = Omit<ButtonProps, 'styleVariant' | 'color'> & {\n align?: 'start' | 'end'\n primary?: boolean\n}\n\nconst CalloutAction = ({\n className,\n align = 'start',\n primary = false,\n ...props\n}: CalloutActionType) => {\n const calloutVariant = React.useContext(CalloutVariantContext)\n\n return (\n <Button\n data-slot=\"callout-action\"\n size=\"small\"\n styleVariant={primary ? 'solid' : 'surface'}\n color={primary ? 'primary' : 'neutral'}\n className={cn(\n 'mt-2 w-fit',\n { 'self-start': align === 'start', 'self-end': align === 'end' },\n !primary && CALLOUT_ACTION_COLORS[calloutVariant],\n className,\n )}\n {...props}\n />\n )\n}\n\nconst Callout = ({\n variant = 'info',\n icon,\n className,\n children,\n ...props\n}: CalloutProps) => {\n const variantIcon = CALLOUT_ICONS[variant ?? 'info']\n const Glyph = icon === false ? null : (icon ?? variantIcon.icon)\n\n return (\n <CalloutVariantContext.Provider value={variant ?? 'info'}>\n <div\n data-slot=\"callout\"\n className={cn(calloutVariants({ variant }), className)}\n {...props}\n >\n {Glyph ? (\n <Glyph\n className={cn(\n '[--spark-icon-size:calc(20px*var(--spark-scaling,1))]',\n variantIcon.className,\n )}\n />\n ) : null}\n <div className=\"flex w-full min-w-0 flex-col gap-1\">{children}</div>\n </div>\n </CalloutVariantContext.Provider>\n )\n}\n\nexport {\n Callout,\n CalloutAction,\n CalloutActions,\n CalloutDescription,\n CalloutTitle,\n calloutVariants,\n}\nexport type { CalloutProps, CalloutVariant }\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,mBAAA,GAAA,yBAAA,KACJ,kJACA;CACE,UAAU,EACR,SAAS;EACP,OAAO;EACP,SAAS;EACT,SAAS;EACT,MAAM;EACN,SAAS;CACX,EACF;CACA,iBAAiB,EACf,SAAS,OACX;AACF,CACF;AAEA,MAAM,gBAGF;CACF,OAAO;EAAE,MAAMA,oBAAAA;EAAQ,WAAW;CAA6B;CAC/D,SAAS;EAAE,MAAMC,oBAAAA;EAAa,WAAW;CAA+B;CACxE,SAAS;EAAE,MAAMC,oBAAAA;EAAS,WAAW;CAA+B;CACpE,MAAM;EAAE,MAAMC,oBAAAA;EAAM,WAAW;CAAkB;CACjD,SAAS;EAAE,MAAMA,oBAAAA;EAAM,WAAW;CAAkB;AACtD;AAUA,MAAM,gBAAgB,EACpB,WACA,GAAG,YAEH,iBAAA,GAAA,kBAAA,KAAC,QAAD;CACE,aAAU;CACV,YAAA,GAAA,GAAA,IAAc,qCAAqC,SAAS;CAC5D,GAAI;AACL,CAAA;AAGH,MAAM,sBAAsB,EAC1B,WACA,GAAG,YAEH,iBAAA,GAAA,kBAAA,KAAC,KAAD;CACE,aAAU;CACV,YAAA,GAAA,GAAA,IAAc,WAAW,SAAS;CAClC,GAAI;AACL,CAAA;AAGH,MAAM,wBAAwBC,MAAM,cAA8B,MAAM;AAExE,MAAM,wBAAwD;CAC5D,OACE;CACF,SACE;CACF,SACE;CACF,MAAM;CACN,SACE;AACJ;AAEA,MAAM,kBAAkB,EACtB,WACA,GAAG,YAEH,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,aAAU;CACV,YAAA,GAAA,GAAA,IACE,8EACA,SACF;CACA,GAAI;AACL,CAAA;AAQH,MAAM,iBAAiB,EACrB,WACA,QAAQ,SACR,UAAU,OACV,GAAG,YACoB;CACvB,MAAM,iBAAiBA,MAAM,WAAW,qBAAqB;CAE7D,OACE,iBAAA,GAAA,kBAAA,KAACC,0BAAAA,QAAD;EACE,aAAU;EACV,MAAK;EACL,cAAc,UAAU,UAAU;EAClC,OAAO,UAAU,YAAY;EAC7B,YAAA,GAAA,GAAA,IACE,cACA;GAAE,cAAc,UAAU;GAAS,YAAY,UAAU;EAAM,GAC/D,CAAC,WAAW,sBAAsB,iBAClC,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,MAAM,WAAW,EACf,UAAU,QACV,MACA,WACA,UACA,GAAG,YACe;CAClB,MAAM,cAAc,cAAc,WAAW;CAC7C,MAAM,QAAQ,SAAS,QAAQ,OAAQ,QAAQ,YAAY;CAE3D,OACE,iBAAA,GAAA,kBAAA,KAAC,sBAAsB,UAAvB;EAAgC,OAAO,WAAW;YAChD,iBAAA,GAAA,kBAAA,MAAC,OAAD;GACE,aAAU;GACV,YAAA,GAAA,GAAA,IAAc,gBAAgB,EAAE,QAAQ,CAAC,GAAG,SAAS;GACrD,GAAI;aAHN,CAKG,QACC,iBAAA,GAAA,kBAAA,KAAC,OAAD,EACE,YAAA,GAAA,GAAA,IACE,yDACA,YAAY,SACd,EACD,CAAA,IACC,MACJ,iBAAA,GAAA,kBAAA,KAAC,OAAD;IAAK,WAAU;IAAsC;GAAc,CAAA,CAChE;;CACyB,CAAA;AAEpC"}
|
|
@@ -8,7 +8,7 @@ import { SparkIcon } from "@epilot/spark-icons";
|
|
|
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?: "
|
|
11
|
+
variant?: "error" | "success" | "warning" | "info" | "neutral" | 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?: "
|
|
11
|
+
variant?: "error" | "success" | "warning" | "info" | "neutral" | 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. */
|
package/dist/components/card.cjs
CHANGED
|
@@ -7,16 +7,16 @@ react = require_chunk.__toESM(react);
|
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
8
|
let class_variance_authority = require("class-variance-authority");
|
|
9
9
|
let _base_ui_react_use_render = require("@base-ui/react/use-render");
|
|
10
|
-
let
|
|
10
|
+
let cn = require("cn");
|
|
11
11
|
//#region src/components/card.tsx
|
|
12
12
|
const cardVariants = (0, class_variance_authority.cva)("relative flex w-full flex-col gap-1 py-3", {
|
|
13
13
|
variants: { variant: {
|
|
14
|
-
ambient: (0,
|
|
15
|
-
soft: (0,
|
|
16
|
-
surface: (0,
|
|
17
|
-
outline: (0,
|
|
18
|
-
ghost: (0,
|
|
19
|
-
solid: (0,
|
|
14
|
+
ambient: (0, cn.cn)(require_lib_container_chrome.containerChrome.ambient, require_lib_container_chrome.containerPaddingX.ambient),
|
|
15
|
+
soft: (0, cn.cn)(require_lib_container_chrome.containerChrome.soft, require_lib_container_chrome.containerPaddingX.soft),
|
|
16
|
+
surface: (0, cn.cn)(require_lib_container_chrome.containerChrome.surface, require_lib_container_chrome.containerPaddingX.surface),
|
|
17
|
+
outline: (0, cn.cn)(require_lib_container_chrome.containerChrome.outline, require_lib_container_chrome.containerPaddingX.outline),
|
|
18
|
+
ghost: (0, cn.cn)(require_lib_container_chrome.containerChrome.ghost, require_lib_container_chrome.containerPaddingX.ghost),
|
|
19
|
+
solid: (0, cn.cn)(require_lib_container_chrome.containerChrome.solid, require_lib_container_chrome.containerPaddingX.solid)
|
|
20
20
|
} },
|
|
21
21
|
defaultVariants: { variant: "ambient" }
|
|
22
22
|
});
|
|
@@ -29,9 +29,9 @@ const Card = react.forwardRef(({ className, variant, color, radius = "lg", eleva
|
|
|
29
29
|
props: {
|
|
30
30
|
"data-slot": "card",
|
|
31
31
|
"data-variant": variant,
|
|
32
|
-
"data-card-color": color
|
|
32
|
+
"data-card-color": color,
|
|
33
33
|
"data-elevated": elevated ? "" : void 0,
|
|
34
|
-
className: (0,
|
|
34
|
+
className: (0, cn.cn)(cardVariants({ variant }), require_lib_container_chrome.radiusClasses[radius], elevated && "bg-(--spark-elevated) [background-image:linear-gradient(var(--spark-card-bg,transparent),var(--spark-card-bg,transparent))] shadow-(--spark-card-shadow,var(--spark-shadow-1))", interactive && require_lib_container_chrome.containerInteractiveClasses(resolved, elevated), className),
|
|
35
35
|
ref,
|
|
36
36
|
...props
|
|
37
37
|
}
|
|
@@ -39,43 +39,43 @@ const Card = react.forwardRef(({ className, variant, color, radius = "lg", eleva
|
|
|
39
39
|
});
|
|
40
40
|
Card.displayName = "Card";
|
|
41
41
|
const CardHeader = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
42
|
-
className: (0,
|
|
42
|
+
className: (0, cn.cn)("flex items-center gap-4", className),
|
|
43
43
|
ref,
|
|
44
44
|
...props
|
|
45
45
|
}));
|
|
46
46
|
CardHeader.displayName = "CardHeader";
|
|
47
47
|
const CardIcon = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
48
|
-
className: (0,
|
|
48
|
+
className: (0, cn.cn)("flex shrink-0 items-center justify-center text-(--spark-card-icon,var(--spark-a11))", className),
|
|
49
49
|
ref,
|
|
50
50
|
...props
|
|
51
51
|
}));
|
|
52
52
|
CardIcon.displayName = "CardIcon";
|
|
53
53
|
const CardTitle = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
54
|
-
className: (0,
|
|
54
|
+
className: (0, cn.cn)("text-base leading-5 font-medium text-(--spark-card-fg,var(--neutral-a12))", className),
|
|
55
55
|
ref,
|
|
56
56
|
...props
|
|
57
57
|
}));
|
|
58
58
|
CardTitle.displayName = "CardTitle";
|
|
59
59
|
const CardDescription = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
60
|
-
className: (0,
|
|
60
|
+
className: (0, cn.cn)("text-sm leading-5 text-(--spark-card-fg-muted,var(--neutral-a11))", className),
|
|
61
61
|
ref,
|
|
62
62
|
...props
|
|
63
63
|
}));
|
|
64
64
|
CardDescription.displayName = "CardDescription";
|
|
65
65
|
const CardContent = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
66
|
-
className: (0,
|
|
66
|
+
className: (0, cn.cn)("", className),
|
|
67
67
|
ref,
|
|
68
68
|
...props
|
|
69
69
|
}));
|
|
70
70
|
CardContent.displayName = "CardContent";
|
|
71
71
|
const CardFooter = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
72
|
-
className: (0,
|
|
72
|
+
className: (0, cn.cn)("flex items-center justify-end gap-2 pt-2 text-(--spark-card-fg,var(--neutral-a12))", className),
|
|
73
73
|
ref,
|
|
74
74
|
...props
|
|
75
75
|
}));
|
|
76
76
|
CardFooter.displayName = "CardFooter";
|
|
77
77
|
const CardSkeleton = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
78
|
-
className: (0,
|
|
78
|
+
className: (0, cn.cn)("relative flex w-full items-center gap-4 rounded-lg bg-spark-a3 p-4 opacity-80", className),
|
|
79
79
|
ref,
|
|
80
80
|
...props,
|
|
81
81
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "size-10 shrink-0 animate-pulse rounded-full bg-base-gray-soft motion-reduce:animate-none" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.cjs","names":["containerChrome","containerPaddingX","React","radiusClasses","containerInteractiveClasses"],"sources":["../../src/components/card.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport {\n containerChrome,\n containerElevated,\n containerInteractiveClasses,\n containerPaddingX,\n radiusClasses,\n type ContainerRadius,\n} from '../lib/container-chrome'\nimport type { SparkCardColor, SparkCardVariant } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\n\ntype CardRadius = ContainerRadius\n\nconst cardVariants = cva('relative flex w-full flex-col gap-1 py-3', {\n variants: {\n variant: {\n ambient: cn(containerChrome.ambient, containerPaddingX.ambient),\n soft: cn(containerChrome.soft, containerPaddingX.soft),\n surface: cn(containerChrome.surface, containerPaddingX.surface),\n outline: cn(containerChrome.outline, containerPaddingX.outline),\n ghost: cn(containerChrome.ghost, containerPaddingX.ghost),\n solid: cn(containerChrome.solid, containerPaddingX.solid),\n },\n },\n defaultVariants: {\n variant: 'ambient',\n },\n})\n\ninterface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Container chrome scoped to this card — NOT the ambient `data-style` knob\n * (that drives controls and would cascade into the card's content). Unset →\n * follows the app-level `[data-card-variant]` knob (default soft-neutral).\n */\n variant?: SparkCardVariant\n /** Chrome palette. `neutral` (default) tracks the app neutral; `accent` tints with the brand accent. */\n color?: SparkCardColor\n /** Corner radius, as a named step. Unset → `lg`, today's fixed behaviour. */\n radius?: CardRadius\n /**\n * Lift the card off an arbitrary backdrop (a photo, not the flat app canvas):\n * an opaque `--spark-elevated` fill plus a shadow, so no `variant`/`color`\n * combination — including a translucent one like `soft` — can bleed it through.\n */\n elevated?: boolean\n /**\n * Base UI polymorphism. Pass `<a href/>` or `<button/>` to make the whole\n * card interactive (hover tint, focus ring, disabled styles). Omit → static.\n */\n render?: useRender.RenderProp\n}\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(\n (\n { className, variant, color, radius = 'lg', elevated, render, ...props },\n ref,\n ) => {\n const interactive = render != null\n const resolved = variant ?? 'ambient'\n return useRender({\n defaultTagName: 'div',\n render,\n props: {\n 'data-slot': 'card',\n 'data-variant': variant,\n 'data-card-color': color
|
|
1
|
+
{"version":3,"file":"card.cjs","names":["containerChrome","containerPaddingX","React","radiusClasses","containerInteractiveClasses"],"sources":["../../src/components/card.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport {\n containerChrome,\n containerElevated,\n containerInteractiveClasses,\n containerPaddingX,\n radiusClasses,\n type ContainerRadius,\n} from '../lib/container-chrome'\nimport type { SparkCardColor, SparkCardVariant } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\n\ntype CardRadius = ContainerRadius\n\nconst cardVariants = cva('relative flex w-full flex-col gap-1 py-3', {\n variants: {\n variant: {\n ambient: cn(containerChrome.ambient, containerPaddingX.ambient),\n soft: cn(containerChrome.soft, containerPaddingX.soft),\n surface: cn(containerChrome.surface, containerPaddingX.surface),\n outline: cn(containerChrome.outline, containerPaddingX.outline),\n ghost: cn(containerChrome.ghost, containerPaddingX.ghost),\n solid: cn(containerChrome.solid, containerPaddingX.solid),\n },\n },\n defaultVariants: {\n variant: 'ambient',\n },\n})\n\ninterface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Container chrome scoped to this card — NOT the ambient `data-style` knob\n * (that drives controls and would cascade into the card's content). Unset →\n * follows the app-level `[data-card-variant]` knob (default soft-neutral).\n */\n variant?: SparkCardVariant\n /** Chrome palette. `neutral` (default) tracks the app neutral; `accent` tints with the brand accent. */\n color?: SparkCardColor\n /** Corner radius, as a named step. Unset → `lg`, today's fixed behaviour. */\n radius?: CardRadius\n /**\n * Lift the card off an arbitrary backdrop (a photo, not the flat app canvas):\n * an opaque `--spark-elevated` fill plus a shadow, so no `variant`/`color`\n * combination — including a translucent one like `soft` — can bleed it through.\n */\n elevated?: boolean\n /**\n * Base UI polymorphism. Pass `<a href/>` or `<button/>` to make the whole\n * card interactive (hover tint, focus ring, disabled styles). Omit → static.\n */\n render?: useRender.RenderProp\n}\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(\n (\n { className, variant, color, radius = 'lg', elevated, render, ...props },\n ref,\n ) => {\n const interactive = render != null\n const resolved = variant ?? 'ambient'\n return useRender({\n defaultTagName: 'div',\n render,\n props: {\n 'data-slot': 'card',\n 'data-variant': variant,\n 'data-card-color': color,\n 'data-elevated': elevated ? '' : undefined,\n className: cn(\n cardVariants({ variant }),\n radiusClasses[radius],\n elevated && containerElevated,\n interactive && containerInteractiveClasses(resolved, elevated),\n className,\n ),\n ref,\n ...props,\n },\n })\n },\n)\n\nCard.displayName = 'Card'\n\nconst CardHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn('flex items-center gap-4', className)}\n ref={ref}\n {...props}\n />\n))\n\nCardHeader.displayName = 'CardHeader'\n\nconst CardIcon = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n 'flex shrink-0 items-center justify-center text-(--spark-card-icon,var(--spark-a11))',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nCardIcon.displayName = 'CardIcon'\n\nconst CardTitle = React.forwardRef<\n HTMLHeadingElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h3\n className={cn(\n 'text-base leading-5 font-medium text-(--spark-card-fg,var(--neutral-a12))',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nCardTitle.displayName = 'CardTitle'\n\nconst CardDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <p\n className={cn(\n 'text-sm leading-5 text-(--spark-card-fg-muted,var(--neutral-a11))',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nCardDescription.displayName = 'CardDescription'\n\nconst CardContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div className={cn('', className)} ref={ref} {...props} />\n))\n\nCardContent.displayName = 'CardContent'\n\nconst CardFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n 'flex items-center justify-end gap-2 pt-2 text-(--spark-card-fg,var(--neutral-a12))',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nCardFooter.displayName = 'CardFooter'\n\nconst CardSkeleton = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n 'relative flex w-full items-center gap-4 rounded-lg bg-spark-a3 p-4 opacity-80',\n className,\n )}\n ref={ref}\n {...props}\n >\n <div className=\"size-10 shrink-0 animate-pulse rounded-full bg-base-gray-soft motion-reduce:animate-none\" />\n <div className=\"flex flex-1 flex-col gap-y-2\">\n <div className=\"h-5 w-1/3 max-w-32 animate-pulse rounded-md bg-base-gray-soft motion-reduce:animate-none\" />\n <div className=\"h-4 w-1/2 max-w-48 animate-pulse rounded-md bg-base-gray-soft motion-reduce:animate-none\" />\n </div>\n </div>\n))\n\nCardSkeleton.displayName = 'CardSkeleton'\n\nexport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardIcon,\n CardSkeleton,\n CardTitle,\n}\nexport type { CardProps, CardRadius }\n"],"mappings":";;;;;;;;;;;AAgBA,MAAM,gBAAA,GAAA,yBAAA,KAAmB,4CAA4C;CACnE,UAAU,EACR,SAAS;EACP,UAAA,GAAA,GAAA,IAAYA,6BAAAA,gBAAgB,SAASC,6BAAAA,kBAAkB,OAAO;EAC9D,OAAA,GAAA,GAAA,IAASD,6BAAAA,gBAAgB,MAAMC,6BAAAA,kBAAkB,IAAI;EACrD,UAAA,GAAA,GAAA,IAAYD,6BAAAA,gBAAgB,SAASC,6BAAAA,kBAAkB,OAAO;EAC9D,UAAA,GAAA,GAAA,IAAYD,6BAAAA,gBAAgB,SAASC,6BAAAA,kBAAkB,OAAO;EAC9D,QAAA,GAAA,GAAA,IAAUD,6BAAAA,gBAAgB,OAAOC,6BAAAA,kBAAkB,KAAK;EACxD,QAAA,GAAA,GAAA,IAAUD,6BAAAA,gBAAgB,OAAOC,6BAAAA,kBAAkB,KAAK;CAC1D,EACF;CACA,iBAAiB,EACf,SAAS,UACX;AACF,CAAC;AA0BD,MAAM,OAAOC,MAAM,YAEf,EAAE,WAAW,SAAS,OAAO,SAAS,MAAM,UAAU,QAAQ,GAAG,SACjE,QACG;CACH,MAAM,cAAc,UAAU;CAC9B,MAAM,WAAW,WAAW;CAC5B,QAAA,GAAA,0BAAA,WAAiB;EACf,gBAAgB;EAChB;EACA,OAAO;GACL,aAAa;GACb,gBAAgB;GAChB,mBAAmB;GACnB,iBAAiB,WAAW,KAAK,KAAA;GACjC,YAAA,GAAA,GAAA,IACE,aAAa,EAAE,QAAQ,CAAC,GACxBC,6BAAAA,cAAc,SACd,YAAA,kLACA,eAAeC,6BAAAA,4BAA4B,UAAU,QAAQ,GAC7D,SACF;GACA;GACA,GAAG;EACL;CACF,CAAC;AACH,CACF;AAEA,KAAK,cAAc;AAEnB,MAAM,aAAaF,MAAM,YAGtB,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IAAc,2BAA2B,SAAS;CAC7C;CACL,GAAI;AACL,CAAA,CACF;AAED,WAAW,cAAc;AAEzB,MAAM,WAAWA,MAAM,YAGpB,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IACE,uFACA,SACF;CACK;CACL,GAAI;AACL,CAAA,CACF;AAED,SAAS,cAAc;AAEvB,MAAM,YAAYA,MAAM,YAGrB,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAC,MAAD;CACE,YAAA,GAAA,GAAA,IACE,6EACA,SACF;CACK;CACL,GAAI;AACL,CAAA,CACF;AAED,UAAU,cAAc;AAExB,MAAM,kBAAkBA,MAAM,YAG3B,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAC,KAAD;CACE,YAAA,GAAA,GAAA,IACE,qEACA,SACF;CACK;CACL,GAAI;AACL,CAAA,CACF;AAED,gBAAgB,cAAc;AAE9B,MAAM,cAAcA,MAAM,YAGvB,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAC,OAAD;CAAK,YAAA,GAAA,GAAA,IAAc,IAAI,SAAS;CAAQ;CAAK,GAAI;AAAQ,CAAA,CAC1D;AAED,YAAY,cAAc;AAE1B,MAAM,aAAaA,MAAM,YAGtB,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IACE,sFACA,SACF;CACK;CACL,GAAI;AACL,CAAA,CACF;AAED,WAAW,cAAc;AAEzB,MAAM,eAAeA,MAAM,YAGxB,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,MAAC,OAAD;CACE,YAAA,GAAA,GAAA,IACE,iFACA,SACF;CACK;CACL,GAAI;WANN,CAQE,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAK,WAAU,2FAA4F,CAAA,GAC3G,iBAAA,GAAA,kBAAA,MAAC,OAAD;EAAK,WAAU;YAAf,CACE,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAK,WAAU,2FAA4F,CAAA,GAC3G,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAK,WAAU,2FAA4F,CAAA,CACxG;GACF;EACN;AAED,aAAa,cAAc"}
|
package/dist/components/card.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "../utils/cn.js";
|
|
3
2
|
import { containerChrome, containerInteractiveClasses, containerPaddingX, radiusClasses } from "../lib/container-chrome.js";
|
|
3
|
+
import { cn } from "../utils/cn.js";
|
|
4
4
|
import * as React$1 from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
@@ -26,7 +26,7 @@ const Card = React$1.forwardRef(({ className, variant, color, radius = "lg", ele
|
|
|
26
26
|
props: {
|
|
27
27
|
"data-slot": "card",
|
|
28
28
|
"data-variant": variant,
|
|
29
|
-
"data-card-color": color
|
|
29
|
+
"data-card-color": color,
|
|
30
30
|
"data-elevated": elevated ? "" : void 0,
|
|
31
31
|
className: cn(cardVariants({ variant }), radiusClasses[radius], elevated && "bg-(--spark-elevated) [background-image:linear-gradient(var(--spark-card-bg,transparent),var(--spark-card-bg,transparent))] shadow-(--spark-card-shadow,var(--spark-shadow-1))", interactive && containerInteractiveClasses(resolved, elevated), className),
|
|
32
32
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","names":["React"],"sources":["../../src/components/card.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport {\n containerChrome,\n containerElevated,\n containerInteractiveClasses,\n containerPaddingX,\n radiusClasses,\n type ContainerRadius,\n} from '../lib/container-chrome'\nimport type { SparkCardColor, SparkCardVariant } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\n\ntype CardRadius = ContainerRadius\n\nconst cardVariants = cva('relative flex w-full flex-col gap-1 py-3', {\n variants: {\n variant: {\n ambient: cn(containerChrome.ambient, containerPaddingX.ambient),\n soft: cn(containerChrome.soft, containerPaddingX.soft),\n surface: cn(containerChrome.surface, containerPaddingX.surface),\n outline: cn(containerChrome.outline, containerPaddingX.outline),\n ghost: cn(containerChrome.ghost, containerPaddingX.ghost),\n solid: cn(containerChrome.solid, containerPaddingX.solid),\n },\n },\n defaultVariants: {\n variant: 'ambient',\n },\n})\n\ninterface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Container chrome scoped to this card — NOT the ambient `data-style` knob\n * (that drives controls and would cascade into the card's content). Unset →\n * follows the app-level `[data-card-variant]` knob (default soft-neutral).\n */\n variant?: SparkCardVariant\n /** Chrome palette. `neutral` (default) tracks the app neutral; `accent` tints with the brand accent. */\n color?: SparkCardColor\n /** Corner radius, as a named step. Unset → `lg`, today's fixed behaviour. */\n radius?: CardRadius\n /**\n * Lift the card off an arbitrary backdrop (a photo, not the flat app canvas):\n * an opaque `--spark-elevated` fill plus a shadow, so no `variant`/`color`\n * combination — including a translucent one like `soft` — can bleed it through.\n */\n elevated?: boolean\n /**\n * Base UI polymorphism. Pass `<a href/>` or `<button/>` to make the whole\n * card interactive (hover tint, focus ring, disabled styles). Omit → static.\n */\n render?: useRender.RenderProp\n}\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(\n (\n { className, variant, color, radius = 'lg', elevated, render, ...props },\n ref,\n ) => {\n const interactive = render != null\n const resolved = variant ?? 'ambient'\n return useRender({\n defaultTagName: 'div',\n render,\n props: {\n 'data-slot': 'card',\n 'data-variant': variant,\n 'data-card-color': color
|
|
1
|
+
{"version":3,"file":"card.js","names":["React"],"sources":["../../src/components/card.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport {\n containerChrome,\n containerElevated,\n containerInteractiveClasses,\n containerPaddingX,\n radiusClasses,\n type ContainerRadius,\n} from '../lib/container-chrome'\nimport type { SparkCardColor, SparkCardVariant } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\n\ntype CardRadius = ContainerRadius\n\nconst cardVariants = cva('relative flex w-full flex-col gap-1 py-3', {\n variants: {\n variant: {\n ambient: cn(containerChrome.ambient, containerPaddingX.ambient),\n soft: cn(containerChrome.soft, containerPaddingX.soft),\n surface: cn(containerChrome.surface, containerPaddingX.surface),\n outline: cn(containerChrome.outline, containerPaddingX.outline),\n ghost: cn(containerChrome.ghost, containerPaddingX.ghost),\n solid: cn(containerChrome.solid, containerPaddingX.solid),\n },\n },\n defaultVariants: {\n variant: 'ambient',\n },\n})\n\ninterface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Container chrome scoped to this card — NOT the ambient `data-style` knob\n * (that drives controls and would cascade into the card's content). Unset →\n * follows the app-level `[data-card-variant]` knob (default soft-neutral).\n */\n variant?: SparkCardVariant\n /** Chrome palette. `neutral` (default) tracks the app neutral; `accent` tints with the brand accent. */\n color?: SparkCardColor\n /** Corner radius, as a named step. Unset → `lg`, today's fixed behaviour. */\n radius?: CardRadius\n /**\n * Lift the card off an arbitrary backdrop (a photo, not the flat app canvas):\n * an opaque `--spark-elevated` fill plus a shadow, so no `variant`/`color`\n * combination — including a translucent one like `soft` — can bleed it through.\n */\n elevated?: boolean\n /**\n * Base UI polymorphism. Pass `<a href/>` or `<button/>` to make the whole\n * card interactive (hover tint, focus ring, disabled styles). Omit → static.\n */\n render?: useRender.RenderProp\n}\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(\n (\n { className, variant, color, radius = 'lg', elevated, render, ...props },\n ref,\n ) => {\n const interactive = render != null\n const resolved = variant ?? 'ambient'\n return useRender({\n defaultTagName: 'div',\n render,\n props: {\n 'data-slot': 'card',\n 'data-variant': variant,\n 'data-card-color': color,\n 'data-elevated': elevated ? '' : undefined,\n className: cn(\n cardVariants({ variant }),\n radiusClasses[radius],\n elevated && containerElevated,\n interactive && containerInteractiveClasses(resolved, elevated),\n className,\n ),\n ref,\n ...props,\n },\n })\n },\n)\n\nCard.displayName = 'Card'\n\nconst CardHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn('flex items-center gap-4', className)}\n ref={ref}\n {...props}\n />\n))\n\nCardHeader.displayName = 'CardHeader'\n\nconst CardIcon = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n 'flex shrink-0 items-center justify-center text-(--spark-card-icon,var(--spark-a11))',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nCardIcon.displayName = 'CardIcon'\n\nconst CardTitle = React.forwardRef<\n HTMLHeadingElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h3\n className={cn(\n 'text-base leading-5 font-medium text-(--spark-card-fg,var(--neutral-a12))',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nCardTitle.displayName = 'CardTitle'\n\nconst CardDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <p\n className={cn(\n 'text-sm leading-5 text-(--spark-card-fg-muted,var(--neutral-a11))',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nCardDescription.displayName = 'CardDescription'\n\nconst CardContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div className={cn('', className)} ref={ref} {...props} />\n))\n\nCardContent.displayName = 'CardContent'\n\nconst CardFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n 'flex items-center justify-end gap-2 pt-2 text-(--spark-card-fg,var(--neutral-a12))',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nCardFooter.displayName = 'CardFooter'\n\nconst CardSkeleton = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n 'relative flex w-full items-center gap-4 rounded-lg bg-spark-a3 p-4 opacity-80',\n className,\n )}\n ref={ref}\n {...props}\n >\n <div className=\"size-10 shrink-0 animate-pulse rounded-full bg-base-gray-soft motion-reduce:animate-none\" />\n <div className=\"flex flex-1 flex-col gap-y-2\">\n <div className=\"h-5 w-1/3 max-w-32 animate-pulse rounded-md bg-base-gray-soft motion-reduce:animate-none\" />\n <div className=\"h-4 w-1/2 max-w-48 animate-pulse rounded-md bg-base-gray-soft motion-reduce:animate-none\" />\n </div>\n </div>\n))\n\nCardSkeleton.displayName = 'CardSkeleton'\n\nexport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardIcon,\n CardSkeleton,\n CardTitle,\n}\nexport type { CardProps, CardRadius }\n"],"mappings":";;;;;;;;AAgBA,MAAM,eAAe,IAAI,4CAA4C;CACnE,UAAU,EACR,SAAS;EACP,SAAS,GAAG,gBAAgB,SAAS,kBAAkB,OAAO;EAC9D,MAAM,GAAG,gBAAgB,MAAM,kBAAkB,IAAI;EACrD,SAAS,GAAG,gBAAgB,SAAS,kBAAkB,OAAO;EAC9D,SAAS,GAAG,gBAAgB,SAAS,kBAAkB,OAAO;EAC9D,OAAO,GAAG,gBAAgB,OAAO,kBAAkB,KAAK;EACxD,OAAO,GAAG,gBAAgB,OAAO,kBAAkB,KAAK;CAC1D,EACF;CACA,iBAAiB,EACf,SAAS,UACX;AACF,CAAC;AA0BD,MAAM,OAAOA,QAAM,YAEf,EAAE,WAAW,SAAS,OAAO,SAAS,MAAM,UAAU,QAAQ,GAAG,SACjE,QACG;CACH,MAAM,cAAc,UAAU;CAC9B,MAAM,WAAW,WAAW;CAC5B,OAAO,UAAU;EACf,gBAAgB;EAChB;EACA,OAAO;GACL,aAAa;GACb,gBAAgB;GAChB,mBAAmB;GACnB,iBAAiB,WAAW,KAAK,KAAA;GACjC,WAAW,GACT,aAAa,EAAE,QAAQ,CAAC,GACxB,cAAc,SACd,YAAA,kLACA,eAAe,4BAA4B,UAAU,QAAQ,GAC7D,SACF;GACA;GACA,GAAG;EACL;CACF,CAAC;AACH,CACF;AAEA,KAAK,cAAc;AAEnB,MAAM,aAAaA,QAAM,YAGtB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,OAAD;CACE,WAAW,GAAG,2BAA2B,SAAS;CAC7C;CACL,GAAI;AACL,CAAA,CACF;AAED,WAAW,cAAc;AAEzB,MAAM,WAAWA,QAAM,YAGpB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,OAAD;CACE,WAAW,GACT,uFACA,SACF;CACK;CACL,GAAI;AACL,CAAA,CACF;AAED,SAAS,cAAc;AAEvB,MAAM,YAAYA,QAAM,YAGrB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,MAAD;CACE,WAAW,GACT,6EACA,SACF;CACK;CACL,GAAI;AACL,CAAA,CACF;AAED,UAAU,cAAc;AAExB,MAAM,kBAAkBA,QAAM,YAG3B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,KAAD;CACE,WAAW,GACT,qEACA,SACF;CACK;CACL,GAAI;AACL,CAAA,CACF;AAED,gBAAgB,cAAc;AAE9B,MAAM,cAAcA,QAAM,YAGvB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,OAAD;CAAK,WAAW,GAAG,IAAI,SAAS;CAAQ;CAAK,GAAI;AAAQ,CAAA,CAC1D;AAED,YAAY,cAAc;AAE1B,MAAM,aAAaA,QAAM,YAGtB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,OAAD;CACE,WAAW,GACT,sFACA,SACF;CACK;CACL,GAAI;AACL,CAAA,CACF;AAED,WAAW,cAAc;AAEzB,MAAM,eAAeA,QAAM,YAGxB,EAAE,WAAW,GAAG,SAAS,QAC1B,qBAAC,OAAD;CACE,WAAW,GACT,iFACA,SACF;CACK;CACL,GAAI;WANN,CAQE,oBAAC,OAAD,EAAK,WAAU,2FAA4F,CAAA,GAC3G,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,OAAD,EAAK,WAAU,2FAA4F,CAAA,GAC3G,oBAAC,OAAD,EAAK,WAAU,2FAA4F,CAAA,CACxG;GACF;EACN;AAED,aAAa,cAAc"}
|
|
@@ -5,7 +5,7 @@ const require_components_button = require("./button.cjs");
|
|
|
5
5
|
let react = require("react");
|
|
6
6
|
react = require_chunk.__toESM(react);
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
-
let
|
|
8
|
+
let cn = require("cn");
|
|
9
9
|
//#region src/components/chart.tsx
|
|
10
10
|
function ChartZoomResetButton({ label, onReset }) {
|
|
11
11
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
|
|
@@ -74,7 +74,7 @@ function clampTooltipPosition({ anchorX, anchorY, width, height, tipWidth, tipHe
|
|
|
74
74
|
function ChartTooltipCard({ label, rows, className }) {
|
|
75
75
|
if (rows.length === 0) return null;
|
|
76
76
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
77
|
-
className: (0,
|
|
77
|
+
className: (0, cn.cn)("grid min-w-40 gap-1.5 rounded-lg border border-gray-a6 bg-gray-1 px-3 py-2 text-xs shadow-lg shadow-gray-a3", className),
|
|
78
78
|
children: [label !== void 0 && label !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
79
79
|
className: "font-medium text-gray",
|
|
80
80
|
children: label
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.cjs","names":["Button"],"sources":["../../src/components/chart.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { cn } from '../utils/cn'\nimport { Button } from './button'\n\nexport type ChartConfig = Record<\n string,\n {\n label?: React.ReactNode\n color?: string\n }\n>\n\nexport interface ChartTooltipRow {\n key: string\n label: React.ReactNode\n /** CSS color value for the legend swatch (e.g. `var(--orange-a9)`). */\n color: string\n value: React.ReactNode\n /** Swatch shape: `dot` (default) for solid series, `dashed-line` for dashed ones. */\n marker?: 'dot' | 'dashed-line'\n}\n\nexport interface ChartTooltipCardProps {\n label?: React.ReactNode\n rows: ChartTooltipRow[]\n className?: string\n}\n\ninterface ChartZoomResetButtonProps {\n label: string\n onReset: () => void\n}\n\nexport function ChartZoomResetButton({\n label,\n onReset,\n}: ChartZoomResetButtonProps) {\n return (\n <Button\n className=\"absolute top-2 right-2 z-20 h-11 bg-gray-1 text-gray hover:bg-gray-2\"\n color=\"neutral\"\n onClick={onReset}\n styleVariant=\"surface\"\n type=\"button\"\n >\n {label}\n </Button>\n )\n}\n\n/**\n * Tracks an element's rendered size via ResizeObserver. The element must stay\n * mounted (e.g. an always-rendered, possibly-hidden tooltip wrapper) so the ref\n * is attached when the observer is set up.\n */\nexport function useMeasuredSize<T extends HTMLElement>() {\n const ref = useRef<T>(null)\n const [size, setSize] = useState({ width: 0, height: 0 })\n\n useEffect(() => {\n const element = ref.current\n if (!element) return\n\n const resizeObserver = new ResizeObserver((entries) => {\n const entry = entries[0]\n if (!entry) return\n setSize({\n width: entry.contentRect.width,\n height: entry.contentRect.height,\n })\n })\n\n resizeObserver.observe(element)\n return () => resizeObserver.disconnect()\n }, [])\n\n return [ref, size] as const\n}\n\ninterface ClampTooltipArgs {\n /** Anchor point (chart-local px) the tooltip should sit at, horizontally centred. */\n anchorX: number\n anchorY: number\n /** Chart bounds (px). */\n width: number\n height: number\n /** Measured tooltip size (px). */\n tipWidth: number\n tipHeight: number\n /** Gap between the anchor and the tooltip. */\n gap?: number\n /** Minimum distance kept from every chart edge. */\n pad?: number\n /**\n * `above` (default): centred above the anchor, flipped below if it would clip\n * the top — good for bars. `beside`: offset to the side of the anchor so it\n * never sits on top of the hovered point/line — good for line/area charts.\n */\n placement?: 'above' | 'beside'\n}\n\n/**\n * Positions a tooltip relative to an anchor while keeping it fully inside the\n * chart: clamped on every edge, flipped above/below or left/right as needed.\n */\nexport function clampTooltipPosition({\n anchorX,\n anchorY,\n width,\n height,\n tipWidth,\n tipHeight,\n gap = 12,\n pad = 8,\n placement = 'above',\n}: ClampTooltipArgs): { left: number; top: number } {\n const maxLeft = Math.max(pad, width - tipWidth - pad)\n const maxTop = Math.max(pad, height - tipHeight - pad)\n\n if (placement === 'beside') {\n // Prefer the right of the anchor; flip to the left if it would overflow.\n const right = anchorX + gap\n const left =\n right + tipWidth + pad <= width ? right : anchorX - gap - tipWidth\n return {\n left: Math.min(Math.max(left, pad), maxLeft),\n top: Math.min(Math.max(anchorY, pad), maxTop),\n }\n }\n\n const above = anchorY - gap - tipHeight\n const desiredTop = above >= pad ? above : anchorY + gap\n return {\n left: Math.min(Math.max(anchorX - tipWidth / 2, pad), maxLeft),\n top: Math.min(Math.max(desiredTop, pad), maxTop),\n }\n}\n\n/**\n * Card-style multi-series tooltip body: an optional header plus one\n * coloured-dot row per series. Rendered inside `@visx/tooltip` by the chart\n * components so every chart shares the same tooltip look.\n */\nexport function ChartTooltipCard({\n label,\n rows,\n className,\n}: ChartTooltipCardProps) {\n if (rows.length === 0) return null\n\n return (\n <div\n className={cn(\n 'grid min-w-40 gap-1.5 rounded-lg border border-gray-a6 bg-gray-1 px-3 py-2 text-xs shadow-lg shadow-gray-a3',\n className,\n )}\n >\n {label !== undefined && label !== null && (\n <div className=\"font-medium text-gray\">{label}</div>\n )}\n <div className=\"grid gap-1.5\">\n {rows.map((row) => (\n <div\n key={row.key}\n className=\"flex items-center justify-between gap-4\"\n >\n <span className=\"flex items-center gap-1.5 text-gray-light\">\n {row.marker === 'dashed-line' ? (\n <span\n aria-hidden=\"true\"\n className=\"w-3 shrink-0 border-t-2 border-dashed\"\n style={{ borderColor: row.color }}\n />\n ) : (\n <span\n aria-hidden=\"true\"\n className=\"size-2 shrink-0 rounded-[2px]\"\n style={{ backgroundColor: row.color }}\n />\n )}\n {row.label}\n </span>\n <span className=\"font-medium whitespace-nowrap text-gray tabular-nums\">\n {row.value}\n </span>\n </div>\n ))}\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;AAkCA,SAAgB,qBAAqB,EACnC,OACA,WAC4B;CAC5B,OACE,iBAAA,GAAA,kBAAA,KAACA,0BAAAA,QAAD;EACE,WAAU;EACV,OAAM;EACN,SAAS;EACT,cAAa;EACb,MAAK;YAEJ;CACK,CAAA;AAEZ;;;;;;AAOA,SAAgB,kBAAyC;CACvD,MAAM,OAAA,GAAA,MAAA,QAAgB,IAAI;CAC1B,MAAM,CAAC,MAAM,YAAA,GAAA,MAAA,UAAoB;EAAE,OAAO;EAAG,QAAQ;CAAE,CAAC;CAExD,CAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,UAAU,IAAI;EACpB,IAAI,CAAC,SAAS;EAEd,MAAM,iBAAiB,IAAI,gBAAgB,YAAY;GACrD,MAAM,QAAQ,QAAQ;GACtB,IAAI,CAAC,OAAO;GACZ,QAAQ;IACN,OAAO,MAAM,YAAY;IACzB,QAAQ,MAAM,YAAY;GAC5B,CAAC;EACH,CAAC;EAED,eAAe,QAAQ,OAAO;EAC9B,aAAa,eAAe,WAAW;CACzC,GAAG,CAAC,CAAC;CAEL,OAAO,CAAC,KAAK,IAAI;AACnB;;;;;AA4BA,SAAgB,qBAAqB,EACnC,SACA,SACA,OACA,QACA,UACA,WACA,MAAM,IACN,MAAM,GACN,YAAY,WACsC;CAClD,MAAM,UAAU,KAAK,IAAI,KAAK,QAAQ,WAAW,GAAG;CACpD,MAAM,SAAS,KAAK,IAAI,KAAK,SAAS,YAAY,GAAG;CAErD,IAAI,cAAc,UAAU;EAE1B,MAAM,QAAQ,UAAU;EACxB,MAAM,OACJ,QAAQ,WAAW,OAAO,QAAQ,QAAQ,UAAU,MAAM;EAC5D,OAAO;GACL,MAAM,KAAK,IAAI,KAAK,IAAI,MAAM,GAAG,GAAG,OAAO;GAC3C,KAAK,KAAK,IAAI,KAAK,IAAI,SAAS,GAAG,GAAG,MAAM;EAC9C;CACF;CAEA,MAAM,QAAQ,UAAU,MAAM;CAC9B,MAAM,aAAa,SAAS,MAAM,QAAQ,UAAU;CACpD,OAAO;EACL,MAAM,KAAK,IAAI,KAAK,IAAI,UAAU,WAAW,GAAG,GAAG,GAAG,OAAO;EAC7D,KAAK,KAAK,IAAI,KAAK,IAAI,YAAY,GAAG,GAAG,MAAM;CACjD;AACF;;;;;;AAOA,SAAgB,iBAAiB,EAC/B,OACA,MACA,aACwB;CACxB,IAAI,KAAK,WAAW,GAAG,OAAO;CAE9B,OACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;EACE,YAAA,GAAA,
|
|
1
|
+
{"version":3,"file":"chart.cjs","names":["Button"],"sources":["../../src/components/chart.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { cn } from '../utils/cn'\nimport { Button } from './button'\n\nexport type ChartConfig = Record<\n string,\n {\n label?: React.ReactNode\n color?: string\n }\n>\n\nexport interface ChartTooltipRow {\n key: string\n label: React.ReactNode\n /** CSS color value for the legend swatch (e.g. `var(--orange-a9)`). */\n color: string\n value: React.ReactNode\n /** Swatch shape: `dot` (default) for solid series, `dashed-line` for dashed ones. */\n marker?: 'dot' | 'dashed-line'\n}\n\nexport interface ChartTooltipCardProps {\n label?: React.ReactNode\n rows: ChartTooltipRow[]\n className?: string\n}\n\ninterface ChartZoomResetButtonProps {\n label: string\n onReset: () => void\n}\n\nexport function ChartZoomResetButton({\n label,\n onReset,\n}: ChartZoomResetButtonProps) {\n return (\n <Button\n className=\"absolute top-2 right-2 z-20 h-11 bg-gray-1 text-gray hover:bg-gray-2\"\n color=\"neutral\"\n onClick={onReset}\n styleVariant=\"surface\"\n type=\"button\"\n >\n {label}\n </Button>\n )\n}\n\n/**\n * Tracks an element's rendered size via ResizeObserver. The element must stay\n * mounted (e.g. an always-rendered, possibly-hidden tooltip wrapper) so the ref\n * is attached when the observer is set up.\n */\nexport function useMeasuredSize<T extends HTMLElement>() {\n const ref = useRef<T>(null)\n const [size, setSize] = useState({ width: 0, height: 0 })\n\n useEffect(() => {\n const element = ref.current\n if (!element) return\n\n const resizeObserver = new ResizeObserver((entries) => {\n const entry = entries[0]\n if (!entry) return\n setSize({\n width: entry.contentRect.width,\n height: entry.contentRect.height,\n })\n })\n\n resizeObserver.observe(element)\n return () => resizeObserver.disconnect()\n }, [])\n\n return [ref, size] as const\n}\n\ninterface ClampTooltipArgs {\n /** Anchor point (chart-local px) the tooltip should sit at, horizontally centred. */\n anchorX: number\n anchorY: number\n /** Chart bounds (px). */\n width: number\n height: number\n /** Measured tooltip size (px). */\n tipWidth: number\n tipHeight: number\n /** Gap between the anchor and the tooltip. */\n gap?: number\n /** Minimum distance kept from every chart edge. */\n pad?: number\n /**\n * `above` (default): centred above the anchor, flipped below if it would clip\n * the top — good for bars. `beside`: offset to the side of the anchor so it\n * never sits on top of the hovered point/line — good for line/area charts.\n */\n placement?: 'above' | 'beside'\n}\n\n/**\n * Positions a tooltip relative to an anchor while keeping it fully inside the\n * chart: clamped on every edge, flipped above/below or left/right as needed.\n */\nexport function clampTooltipPosition({\n anchorX,\n anchorY,\n width,\n height,\n tipWidth,\n tipHeight,\n gap = 12,\n pad = 8,\n placement = 'above',\n}: ClampTooltipArgs): { left: number; top: number } {\n const maxLeft = Math.max(pad, width - tipWidth - pad)\n const maxTop = Math.max(pad, height - tipHeight - pad)\n\n if (placement === 'beside') {\n // Prefer the right of the anchor; flip to the left if it would overflow.\n const right = anchorX + gap\n const left =\n right + tipWidth + pad <= width ? right : anchorX - gap - tipWidth\n return {\n left: Math.min(Math.max(left, pad), maxLeft),\n top: Math.min(Math.max(anchorY, pad), maxTop),\n }\n }\n\n const above = anchorY - gap - tipHeight\n const desiredTop = above >= pad ? above : anchorY + gap\n return {\n left: Math.min(Math.max(anchorX - tipWidth / 2, pad), maxLeft),\n top: Math.min(Math.max(desiredTop, pad), maxTop),\n }\n}\n\n/**\n * Card-style multi-series tooltip body: an optional header plus one\n * coloured-dot row per series. Rendered inside `@visx/tooltip` by the chart\n * components so every chart shares the same tooltip look.\n */\nexport function ChartTooltipCard({\n label,\n rows,\n className,\n}: ChartTooltipCardProps) {\n if (rows.length === 0) return null\n\n return (\n <div\n className={cn(\n 'grid min-w-40 gap-1.5 rounded-lg border border-gray-a6 bg-gray-1 px-3 py-2 text-xs shadow-lg shadow-gray-a3',\n className,\n )}\n >\n {label !== undefined && label !== null && (\n <div className=\"font-medium text-gray\">{label}</div>\n )}\n <div className=\"grid gap-1.5\">\n {rows.map((row) => (\n <div\n key={row.key}\n className=\"flex items-center justify-between gap-4\"\n >\n <span className=\"flex items-center gap-1.5 text-gray-light\">\n {row.marker === 'dashed-line' ? (\n <span\n aria-hidden=\"true\"\n className=\"w-3 shrink-0 border-t-2 border-dashed\"\n style={{ borderColor: row.color }}\n />\n ) : (\n <span\n aria-hidden=\"true\"\n className=\"size-2 shrink-0 rounded-[2px]\"\n style={{ backgroundColor: row.color }}\n />\n )}\n {row.label}\n </span>\n <span className=\"font-medium whitespace-nowrap text-gray tabular-nums\">\n {row.value}\n </span>\n </div>\n ))}\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;AAkCA,SAAgB,qBAAqB,EACnC,OACA,WAC4B;CAC5B,OACE,iBAAA,GAAA,kBAAA,KAACA,0BAAAA,QAAD;EACE,WAAU;EACV,OAAM;EACN,SAAS;EACT,cAAa;EACb,MAAK;YAEJ;CACK,CAAA;AAEZ;;;;;;AAOA,SAAgB,kBAAyC;CACvD,MAAM,OAAA,GAAA,MAAA,QAAgB,IAAI;CAC1B,MAAM,CAAC,MAAM,YAAA,GAAA,MAAA,UAAoB;EAAE,OAAO;EAAG,QAAQ;CAAE,CAAC;CAExD,CAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,UAAU,IAAI;EACpB,IAAI,CAAC,SAAS;EAEd,MAAM,iBAAiB,IAAI,gBAAgB,YAAY;GACrD,MAAM,QAAQ,QAAQ;GACtB,IAAI,CAAC,OAAO;GACZ,QAAQ;IACN,OAAO,MAAM,YAAY;IACzB,QAAQ,MAAM,YAAY;GAC5B,CAAC;EACH,CAAC;EAED,eAAe,QAAQ,OAAO;EAC9B,aAAa,eAAe,WAAW;CACzC,GAAG,CAAC,CAAC;CAEL,OAAO,CAAC,KAAK,IAAI;AACnB;;;;;AA4BA,SAAgB,qBAAqB,EACnC,SACA,SACA,OACA,QACA,UACA,WACA,MAAM,IACN,MAAM,GACN,YAAY,WACsC;CAClD,MAAM,UAAU,KAAK,IAAI,KAAK,QAAQ,WAAW,GAAG;CACpD,MAAM,SAAS,KAAK,IAAI,KAAK,SAAS,YAAY,GAAG;CAErD,IAAI,cAAc,UAAU;EAE1B,MAAM,QAAQ,UAAU;EACxB,MAAM,OACJ,QAAQ,WAAW,OAAO,QAAQ,QAAQ,UAAU,MAAM;EAC5D,OAAO;GACL,MAAM,KAAK,IAAI,KAAK,IAAI,MAAM,GAAG,GAAG,OAAO;GAC3C,KAAK,KAAK,IAAI,KAAK,IAAI,SAAS,GAAG,GAAG,MAAM;EAC9C;CACF;CAEA,MAAM,QAAQ,UAAU,MAAM;CAC9B,MAAM,aAAa,SAAS,MAAM,QAAQ,UAAU;CACpD,OAAO;EACL,MAAM,KAAK,IAAI,KAAK,IAAI,UAAU,WAAW,GAAG,GAAG,GAAG,OAAO;EAC7D,KAAK,KAAK,IAAI,KAAK,IAAI,YAAY,GAAG,GAAG,MAAM;CACjD;AACF;;;;;;AAOA,SAAgB,iBAAiB,EAC/B,OACA,MACA,aACwB;CACxB,IAAI,KAAK,WAAW,GAAG,OAAO;CAE9B,OACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;EACE,YAAA,GAAA,GAAA,IACE,+GACA,SACF;YAJF,CAMG,UAAU,KAAA,KAAa,UAAU,QAChC,iBAAA,GAAA,kBAAA,KAAC,OAAD;GAAK,WAAU;aAAyB;EAAW,CAAA,GAErD,iBAAA,GAAA,kBAAA,KAAC,OAAD;GAAK,WAAU;aACZ,KAAK,KAAK,QACT,iBAAA,GAAA,kBAAA,MAAC,OAAD;IAEE,WAAU;cAFZ,CAIE,iBAAA,GAAA,kBAAA,MAAC,QAAD;KAAM,WAAU;eAAhB,CACG,IAAI,WAAW,gBACd,iBAAA,GAAA,kBAAA,KAAC,QAAD;MACE,eAAY;MACZ,WAAU;MACV,OAAO,EAAE,aAAa,IAAI,MAAM;KACjC,CAAA,IAED,iBAAA,GAAA,kBAAA,KAAC,QAAD;MACE,eAAY;MACZ,WAAU;MACV,OAAO,EAAE,iBAAiB,IAAI,MAAM;KACrC,CAAA,GAEF,IAAI,KACD;QACN,iBAAA,GAAA,kBAAA,KAAC,QAAD;KAAM,WAAU;eACb,IAAI;IACD,CAAA,CACH;MAtBE,IAAI,GAsBN,CACN;EACE,CAAA,CACF;;AAET"}
|