@epilot/spark-ui 1.0.0-alpha.4 → 1.0.0-alpha.6
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/accent-colors-Ch2J0EEY.js +13 -0
- package/dist/accent-colors-Ch2J0EEY.js.map +1 -0
- package/dist/accent-colors-CjHCf8fH.cjs +18 -0
- package/dist/accent-colors-CjHCf8fH.cjs.map +1 -0
- package/dist/components/accordion.cjs +3 -3
- package/dist/components/accordion.cjs.map +1 -1
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +3 -3
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/attachment.d.cts +1 -1
- package/dist/components/attachment.d.ts +1 -1
- package/dist/components/badge.cjs +12 -7
- package/dist/components/badge.cjs.map +1 -1
- package/dist/components/badge.d.cts +5 -1
- package/dist/components/badge.d.ts +5 -1
- package/dist/components/badge.js +12 -7
- package/dist/components/badge.js.map +1 -1
- package/dist/components/bar-chart.cjs +12 -9
- package/dist/components/bar-chart.cjs.map +1 -1
- package/dist/components/bar-chart.js +12 -9
- package/dist/components/bar-chart.js.map +1 -1
- package/dist/components/battery-progress-row.cjs +10 -16
- package/dist/components/battery-progress-row.cjs.map +1 -1
- package/dist/components/battery-progress-row.d.cts +1 -1
- package/dist/components/battery-progress-row.d.ts +2 -2
- package/dist/components/battery-progress-row.js +10 -16
- package/dist/components/battery-progress-row.js.map +1 -1
- package/dist/components/breadcrumbs.cjs +1 -1
- package/dist/components/breadcrumbs.cjs.map +1 -1
- package/dist/components/breadcrumbs.js +1 -1
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/button.cjs +5 -2
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +7 -6
- package/dist/components/button.d.ts +7 -6
- package/dist/components/button.js +5 -2
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.cjs +3 -2
- package/dist/components/calendar.cjs.map +1 -1
- package/dist/components/calendar.d.cts +5 -1
- package/dist/components/calendar.d.ts +5 -1
- package/dist/components/calendar.js +3 -2
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/callout.d.cts +1 -1
- package/dist/components/callout.d.ts +1 -1
- package/dist/components/card.d.cts +1 -1
- package/dist/components/card.d.ts +1 -1
- package/dist/components/chart.cjs +1 -1
- package/dist/components/chart.cjs.map +1 -1
- package/dist/components/chart.js +1 -1
- package/dist/components/chart.js.map +1 -1
- package/dist/components/checkbox.cjs +30 -23
- package/dist/components/checkbox.cjs.map +1 -1
- package/dist/components/checkbox.d.cts +5 -1
- package/dist/components/checkbox.d.ts +5 -1
- package/dist/components/checkbox.js +30 -23
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/circular-gauge.d.ts +1 -1
- package/dist/components/day-of-week-picker.cjs +2 -2
- package/dist/components/day-of-week-picker.cjs.map +1 -1
- package/dist/components/day-of-week-picker.js +2 -2
- package/dist/components/day-of-week-picker.js.map +1 -1
- package/dist/components/device-card.d.ts +1 -1
- package/dist/components/donut-chart.cjs +3 -3
- package/dist/components/donut-chart.cjs.map +1 -1
- package/dist/components/donut-chart.js +3 -3
- package/dist/components/donut-chart.js.map +1 -1
- package/dist/components/energy-bar-chart.d.ts +1 -1
- package/dist/components/energy-breakdown.cjs +1 -1
- package/dist/components/energy-breakdown.cjs.map +1 -1
- package/dist/components/energy-breakdown.js +1 -1
- package/dist/components/energy-breakdown.js.map +1 -1
- package/dist/components/feed-in-hero.d.ts +1 -1
- package/dist/components/field.cjs +1 -1
- package/dist/components/field.d.cts +1 -1
- package/dist/components/field.d.ts +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/info-block.d.cts +1 -1
- package/dist/components/info-block.d.ts +1 -1
- package/dist/components/input-group.cjs +1 -1
- package/dist/components/input-group.js +1 -1
- package/dist/components/input-otp.cjs +1 -1
- package/dist/components/input-otp.js +1 -1
- package/dist/components/input.cjs +1 -1
- package/dist/components/input.d.cts +1 -1
- package/dist/components/input.d.ts +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/line-chart.cjs +11 -9
- package/dist/components/line-chart.cjs.map +1 -1
- package/dist/components/line-chart.js +11 -9
- package/dist/components/line-chart.js.map +1 -1
- package/dist/components/list.cjs +1 -1
- 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/metering-row.d.ts +1 -1
- package/dist/components/money-saved-block.cjs +1 -1
- package/dist/components/money-saved-block.cjs.map +1 -1
- package/dist/components/money-saved-block.js +1 -1
- package/dist/components/money-saved-block.js.map +1 -1
- package/dist/components/number-flow.d.ts +1 -1
- package/dist/components/power-history-chart.cjs +9 -7
- package/dist/components/power-history-chart.cjs.map +1 -1
- package/dist/components/power-history-chart.js +9 -7
- package/dist/components/power-history-chart.js.map +1 -1
- package/dist/components/power-history.cjs +1 -1
- package/dist/components/power-history.cjs.map +1 -1
- package/dist/components/power-history.js +1 -1
- package/dist/components/power-history.js.map +1 -1
- package/dist/components/power-network.cjs +36 -11
- package/dist/components/power-network.cjs.map +1 -1
- package/dist/components/power-network.js +36 -11
- package/dist/components/power-network.js.map +1 -1
- package/dist/components/progress.cjs +1 -1
- package/dist/components/progress.cjs.map +1 -1
- package/dist/components/progress.js +1 -1
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio-card-group.cjs +26 -1
- package/dist/components/radio-card-group.cjs.map +1 -1
- package/dist/components/radio-card-group.js +26 -1
- package/dist/components/radio-card-group.js.map +1 -1
- package/dist/components/radio.cjs +11 -4
- package/dist/components/radio.cjs.map +1 -1
- package/dist/components/radio.d.cts +15 -3
- package/dist/components/radio.d.ts +15 -3
- package/dist/components/radio.js +11 -4
- package/dist/components/radio.js.map +1 -1
- package/dist/components/sankey-chart.cjs +4 -4
- package/dist/components/sankey-chart.cjs.map +1 -1
- package/dist/components/sankey-chart.d.ts +1 -1
- package/dist/components/sankey-chart.js +4 -4
- package/dist/components/sankey-chart.js.map +1 -1
- package/dist/components/schedule-list.cjs +3 -3
- package/dist/components/schedule-list.cjs.map +1 -1
- package/dist/components/schedule-list.js +3 -3
- package/dist/components/schedule-list.js.map +1 -1
- package/dist/components/segmented-control.cjs +2 -2
- package/dist/components/segmented-control.cjs.map +1 -1
- package/dist/components/segmented-control.d.cts +1 -1
- package/dist/components/segmented-control.d.ts +1 -1
- package/dist/components/segmented-control.js +2 -2
- package/dist/components/segmented-control.js.map +1 -1
- package/dist/components/select.cjs +1 -1
- package/dist/components/select.d.cts +1 -1
- package/dist/components/select.d.ts +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/series-legend.cjs +1 -1
- package/dist/components/series-legend.cjs.map +1 -1
- package/dist/components/series-legend.js +1 -1
- package/dist/components/series-legend.js.map +1 -1
- package/dist/components/slider.cjs +6 -19
- package/dist/components/slider.cjs.map +1 -1
- package/dist/components/slider.d.cts +0 -13
- package/dist/components/slider.d.ts +0 -13
- package/dist/components/slider.js +6 -19
- package/dist/components/slider.js.map +1 -1
- package/dist/components/stepper.cjs +2 -2
- package/dist/components/stepper.cjs.map +1 -1
- package/dist/components/stepper.js +2 -2
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch.cjs +8 -3
- package/dist/components/switch.cjs.map +1 -1
- package/dist/components/switch.d.cts +9 -4
- package/dist/components/switch.d.ts +9 -4
- package/dist/components/switch.js +8 -3
- package/dist/components/switch.js.map +1 -1
- package/dist/components/tabs.cjs +4 -4
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.js +4 -4
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/theme.cjs +1 -1
- package/dist/components/theme.d.cts +1 -1
- package/dist/components/theme.d.ts +1 -1
- package/dist/components/theme.js +1 -1
- package/dist/components/time-picker.cjs +1 -1
- package/dist/components/time-picker.cjs.map +1 -1
- package/dist/components/time-picker.js +1 -1
- package/dist/components/time-picker.js.map +1 -1
- package/dist/hooks/use-reduced-motion.cjs +22 -0
- package/dist/hooks/use-reduced-motion.cjs.map +1 -0
- package/dist/hooks/use-reduced-motion.d.cts +7 -0
- package/dist/hooks/use-reduced-motion.d.ts +7 -0
- package/dist/hooks/use-reduced-motion.js +20 -0
- package/dist/hooks/use-reduced-motion.js.map +1 -0
- package/dist/{input-box-variants-Dr1K7uYE.js → input-box-variants-DcajYXvo.js} +1 -1
- package/dist/{input-box-variants-Dr1K7uYE.js.map → input-box-variants-DcajYXvo.js.map} +1 -1
- package/dist/{input-box-variants-BMDdwvqg.cjs → input-box-variants-ZCtgs-1S.cjs} +1 -1
- package/dist/{input-box-variants-BMDdwvqg.cjs.map → input-box-variants-ZCtgs-1S.cjs.map} +1 -1
- package/dist/{number-flow-DSbucQ_K.d.ts → number-flow-D9zsxH0-.d.ts} +1 -1
- package/dist/styles/index.css +4 -2
- package/dist/styles/spark-default.css +78 -0
- package/dist/{theme-C19BbKfO.js → theme-8PDO9E0S.js} +1 -1
- package/dist/{theme-C19BbKfO.js.map → theme-8PDO9E0S.js.map} +1 -1
- package/dist/{theme-CfFWrMEF.cjs → theme-ClRJhexF.cjs} +1 -1
- package/dist/{theme-CfFWrMEF.cjs.map → theme-ClRJhexF.cjs.map} +1 -1
- package/dist/{theme-types-DoROIXpi.d.ts → theme-types-BDdoRxXa.d.ts} +2 -3
- package/dist/{theme-types-r20EJfEC.d.cts → theme-types-BwSJKdsB.d.cts} +2 -3
- package/dist/{tones-DyCkL71h.d.ts → tones-PXJGlSpe.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,6 @@ import { Badge } from "./badge.js";
|
|
|
5
5
|
import { Progress } from "./progress.js";
|
|
6
6
|
import { createContext, useContext } from "react";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
import { cva } from "class-variance-authority";
|
|
9
8
|
//#region src/components/battery-progress-row.tsx
|
|
10
9
|
const BatteryProgressRowContext = createContext(null);
|
|
11
10
|
function useBatteryProgressRowContext() {
|
|
@@ -57,23 +56,18 @@ const BatteryProgressRowHeader = ({ className, ...rest }) => {
|
|
|
57
56
|
...rest
|
|
58
57
|
});
|
|
59
58
|
};
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
defaultVariants: { tone: "neutral" }
|
|
69
|
-
});
|
|
70
|
-
const BatteryProgressRowStateBadge = ({ className, children, tone, ...rest }) => {
|
|
59
|
+
const toneToBadgeColor = {
|
|
60
|
+
success: "success",
|
|
61
|
+
warning: "warning",
|
|
62
|
+
error: "danger",
|
|
63
|
+
accent: "accent",
|
|
64
|
+
neutral: "neutral"
|
|
65
|
+
};
|
|
66
|
+
const BatteryProgressRowStateBadge = ({ className, children, tone = "neutral", ...rest }) => {
|
|
71
67
|
if (children === null || children === void 0) return null;
|
|
72
68
|
return /* @__PURE__ */ jsx(Badge, {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
className
|
|
76
|
-
}),
|
|
69
|
+
color: toneToBadgeColor[tone],
|
|
70
|
+
className: cn("w-fit", className),
|
|
77
71
|
...rest,
|
|
78
72
|
children
|
|
79
73
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"battery-progress-row.js","names":[],"sources":["../../src/components/battery-progress-row.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"battery-progress-row.js","names":[],"sources":["../../src/components/battery-progress-row.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport {\n MaterialSymbol,\n type MaterialSymbolIconName,\n} from '../icons/material-symbol'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\nimport { Badge, type SparkBadgeColor } from './badge'\nimport { Progress } from './progress'\n\ninterface BatteryProgressRowContextValue {\n soc: number\n}\n\nconst BatteryProgressRowContext =\n createContext<BatteryProgressRowContextValue | null>(null)\n\nfunction useBatteryProgressRowContext() {\n const context = useContext(BatteryProgressRowContext)\n if (!context) {\n throw new Error(\n 'BatteryProgressRow.* must be rendered inside <BatteryProgressRow>',\n )\n }\n return context\n}\n\nconst BatteryProgressRow = ({\n className,\n soc,\n children,\n ...rest\n}: React.ComponentProps<'div'> & { soc: number }) => {\n return (\n <BatteryProgressRowContext.Provider value={{ soc }}>\n <div className={cn('flex items-center gap-3', className)} {...rest}>\n {children}\n </div>\n </BatteryProgressRowContext.Provider>\n )\n}\n\n/**\n * Battery icon. Auto-selects its variant from the row's `soc`.\n *\n * @param className - Optional className to apply to the icon to further style it\n * @param icon - The icon to render (defaults to auto-selecting based on the row's `soc`)\n * @param ...rest - Additional props to pass to the span\n * @returns A React component that renders a battery icon\n */\nconst BatteryProgressRowIcon = ({\n className,\n icon: overrideIcon,\n ...rest\n}: React.ComponentProps<'span'> & { icon?: MaterialSymbolIconName }) => {\n const { soc } = useBatteryProgressRowContext()\n const clampedSoc = Math.min(Math.max(soc, 0), 100)\n const batteryLevel = Math.min(Math.floor(clampedSoc / (100 / 7)), 6)\n const iconName: MaterialSymbolIconName =\n clampedSoc === 100\n ? 'battery_full'\n : (`battery_${batteryLevel}_bar` as MaterialSymbolIconName)\n\n return (\n <span\n className={cn(\n 'flex size-10 shrink-0 items-center justify-center rounded-xl bg-base-success-soft text-success',\n className,\n )}\n {...rest}\n >\n <MaterialSymbol className=\"text-[18px]\" name={overrideIcon ?? iconName} />\n </span>\n )\n}\n\nconst BatteryProgressRowContent = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn('flex min-w-0 flex-1 flex-col gap-1.5', className)}\n {...rest}\n />\n )\n}\n\nconst BatteryProgressRowHeader = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn('flex items-center justify-between gap-2', className)}\n {...rest}\n />\n )\n}\n\nconst toneToBadgeColor: Record<Tone, SparkBadgeColor> = {\n success: 'success',\n warning: 'warning',\n error: 'danger',\n accent: 'accent',\n neutral: 'neutral',\n}\n\nconst BatteryProgressRowStateBadge = ({\n className,\n children,\n tone = 'neutral',\n ...rest\n}: Omit<React.ComponentProps<'span'>, 'color'> & { tone?: Tone }) => {\n if (children === null || children === undefined) return null\n return (\n <Badge\n color={toneToBadgeColor[tone]}\n className={cn('w-fit', className)}\n {...rest}\n >\n {children}\n </Badge>\n )\n}\n\nconst BatteryProgressRowChargingPower = ({\n className,\n children,\n ...rest\n}: React.ComponentProps<'span'>) => {\n if (children === null || children === undefined) return null\n return (\n <span\n className={cn(\n 'ml-auto text-lg leading-tight font-bold text-gray tabular-nums',\n className,\n )}\n {...rest}\n >\n {children}\n </span>\n )\n}\n\n/**\n * Linear progress bar bound to the row's `soc`.\n */\nconst BatteryProgressRowProgressBar = ({\n className,\n ...rest\n}: Omit<React.ComponentProps<typeof Progress>, 'value' | 'max'>) => {\n const { soc } = useBatteryProgressRowContext()\n return <Progress className={className} max={100} value={soc} {...rest} />\n}\n\nconst BatteryProgressRowFooter = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn(\n 'flex justify-between text-xs text-gray-light tabular-nums',\n className,\n )}\n {...rest}\n />\n )\n}\n\nconst BatteryProgressRowMinSoc = ({\n className,\n children,\n ...rest\n}: React.ComponentProps<'span'>) => {\n if (children === null || children === undefined) return null\n return (\n <span className={cn(className)} {...rest}>\n {children}\n </span>\n )\n}\n\n/**\n * Current state-of-charge label, rendered as `{soc}%`. Reads from context.\n */\nconst BatteryProgressRowSoc = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => {\n const { soc } = useBatteryProgressRowContext()\n return (\n <span className={cn(className)} {...rest}>\n {`${soc}%`}\n </span>\n )\n}\n\nexport {\n BatteryProgressRow,\n BatteryProgressRowIcon,\n BatteryProgressRowContent,\n BatteryProgressRowHeader,\n BatteryProgressRowStateBadge,\n BatteryProgressRowChargingPower,\n BatteryProgressRowProgressBar,\n BatteryProgressRowFooter,\n BatteryProgressRowMinSoc,\n BatteryProgressRowSoc,\n}\n"],"mappings":";;;;;;;;AAcA,MAAM,4BACJ,cAAqD,KAAK;AAE5D,SAAS,+BAA+B;CACtC,MAAM,UAAU,WAAW,0BAA0B;AACrD,KAAI,CAAC,QACH,OAAM,IAAI,MACR,oEACD;AAEH,QAAO;;AAGT,MAAM,sBAAsB,EAC1B,WACA,KACA,UACA,GAAG,WACgD;AACnD,QACE,oBAAC,0BAA0B,UAA3B;EAAoC,OAAO,EAAE,KAAK;YAChD,oBAAC,OAAD;GAAK,WAAW,GAAG,2BAA2B,UAAU;GAAE,GAAI;GAC3D;GACG,CAAA;EAC6B,CAAA;;;;;;;;;;AAYzC,MAAM,0BAA0B,EAC9B,WACA,MAAM,cACN,GAAG,WACmE;CACtE,MAAM,EAAE,QAAQ,8BAA8B;CAC9C,MAAM,aAAa,KAAK,IAAI,KAAK,IAAI,KAAK,EAAE,EAAE,IAAI;CAClD,MAAM,eAAe,KAAK,IAAI,KAAK,MAAM,cAAc,MAAM,GAAG,EAAE,EAAE;CACpE,MAAM,WACJ,eAAe,MACX,iBACC,WAAW,aAAa;AAE/B,QACE,oBAAC,QAAD;EACE,WAAW,GACT,kGACA,UACD;EACD,GAAI;YAEJ,oBAAC,gBAAD;GAAgB,WAAU;GAAc,MAAM,gBAAgB;GAAY,CAAA;EACrE,CAAA;;AAIX,MAAM,6BAA6B,EACjC,WACA,GAAG,WAC8B;AACjC,QACE,oBAAC,OAAD;EACE,WAAW,GAAG,wCAAwC,UAAU;EAChE,GAAI;EACJ,CAAA;;AAIN,MAAM,4BAA4B,EAChC,WACA,GAAG,WAC8B;AACjC,QACE,oBAAC,OAAD;EACE,WAAW,GAAG,2CAA2C,UAAU;EACnE,GAAI;EACJ,CAAA;;AAIN,MAAM,mBAAkD;CACtD,SAAS;CACT,SAAS;CACT,OAAO;CACP,QAAQ;CACR,SAAS;CACV;AAED,MAAM,gCAAgC,EACpC,WACA,UACA,OAAO,WACP,GAAG,WACgE;AACnE,KAAI,aAAa,QAAQ,aAAa,KAAA,EAAW,QAAO;AACxD,QACE,oBAAC,OAAD;EACE,OAAO,iBAAiB;EACxB,WAAW,GAAG,SAAS,UAAU;EACjC,GAAI;EAEH;EACK,CAAA;;AAIZ,MAAM,mCAAmC,EACvC,WACA,UACA,GAAG,WAC+B;AAClC,KAAI,aAAa,QAAQ,aAAa,KAAA,EAAW,QAAO;AACxD,QACE,oBAAC,QAAD;EACE,WAAW,GACT,kEACA,UACD;EACD,GAAI;EAEH;EACI,CAAA;;;;;AAOX,MAAM,iCAAiC,EACrC,WACA,GAAG,WAC+D;CAClE,MAAM,EAAE,QAAQ,8BAA8B;AAC9C,QAAO,oBAAC,UAAD;EAAqB;EAAW,KAAK;EAAK,OAAO;EAAK,GAAI;EAAQ,CAAA;;AAG3E,MAAM,4BAA4B,EAChC,WACA,GAAG,WAC8B;AACjC,QACE,oBAAC,OAAD;EACE,WAAW,GACT,6DACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,MAAM,4BAA4B,EAChC,WACA,UACA,GAAG,WAC+B;AAClC,KAAI,aAAa,QAAQ,aAAa,KAAA,EAAW,QAAO;AACxD,QACE,oBAAC,QAAD;EAAM,WAAW,GAAG,UAAU;EAAE,GAAI;EACjC;EACI,CAAA;;;;;AAOX,MAAM,yBAAyB,EAC7B,WACA,GAAG,WAC+B;CAClC,MAAM,EAAE,QAAQ,8BAA8B;AAC9C,QACE,oBAAC,QAAD;EAAM,WAAW,GAAG,UAAU;EAAE,GAAI;YACjC,GAAG,IAAI;EACH,CAAA"}
|
|
@@ -34,7 +34,7 @@ const BreadcrumbsLink = ({ className, render, ...rest }) => {
|
|
|
34
34
|
return (0, _base_ui_react_use_render.useRender)({
|
|
35
35
|
defaultTagName: "a",
|
|
36
36
|
render,
|
|
37
|
-
props: (0, _base_ui_react_merge_props.mergeProps)({ className: (0, cnfast.cn)("transition-colors hover:text-gray", className) }, rest)
|
|
37
|
+
props: (0, _base_ui_react_merge_props.mergeProps)({ className: (0, cnfast.cn)("rounded-xs transition-colors hover:text-gray focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden", className) }, rest)
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
/** Current page marker — the trailing breadcrumb the user is on. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.cjs","names":[],"sources":["../../src/components/breadcrumbs.tsx"],"sourcesContent":["import { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport { cn } from '../utils/cn'\n\nconst Breadcrumbs = ({\n className,\n 'aria-label': ariaLabel = 'Breadcrumb',\n ...rest\n}: React.ComponentProps<'nav'>) => {\n return <nav aria-label={ariaLabel} className={cn(className)} {...rest} />\n}\n\nconst BreadcrumbsList = ({\n className,\n ...rest\n}: React.ComponentProps<'ol'>) => {\n return (\n <ol\n className={cn(\n 'flex flex-wrap items-center gap-1.5 text-sm text-gray-light',\n className,\n )}\n {...rest}\n />\n )\n}\n\nconst BreadcrumbsItem = ({\n className,\n ...rest\n}: React.ComponentProps<'li'>) => {\n return <li className={cn('flex items-center gap-1.5', className)} {...rest} />\n}\n\n/**\n * Link inside a breadcrumb. Pass `render` to render any router-specific link\n * component (TanStack `Link`, Next `Link`, plain `<a>`, …) and inherit the\n * breadcrumb link styling. Without `render` it renders as a plain anchor.\n */\nconst BreadcrumbsLink = ({\n className,\n render,\n ...rest\n}: useRender.ComponentProps<'a'>) => {\n return useRender({\n defaultTagName: 'a',\n render,\n props: mergeProps<'a'>(\n {
|
|
1
|
+
{"version":3,"file":"breadcrumbs.cjs","names":[],"sources":["../../src/components/breadcrumbs.tsx"],"sourcesContent":["import { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport { cn } from '../utils/cn'\n\nconst Breadcrumbs = ({\n className,\n 'aria-label': ariaLabel = 'Breadcrumb',\n ...rest\n}: React.ComponentProps<'nav'>) => {\n return <nav aria-label={ariaLabel} className={cn(className)} {...rest} />\n}\n\nconst BreadcrumbsList = ({\n className,\n ...rest\n}: React.ComponentProps<'ol'>) => {\n return (\n <ol\n className={cn(\n 'flex flex-wrap items-center gap-1.5 text-sm text-gray-light',\n className,\n )}\n {...rest}\n />\n )\n}\n\nconst BreadcrumbsItem = ({\n className,\n ...rest\n}: React.ComponentProps<'li'>) => {\n return <li className={cn('flex items-center gap-1.5', className)} {...rest} />\n}\n\n/**\n * Link inside a breadcrumb. Pass `render` to render any router-specific link\n * component (TanStack `Link`, Next `Link`, plain `<a>`, …) and inherit the\n * breadcrumb link styling. Without `render` it renders as a plain anchor.\n */\nconst BreadcrumbsLink = ({\n className,\n render,\n ...rest\n}: useRender.ComponentProps<'a'>) => {\n return useRender({\n defaultTagName: 'a',\n render,\n props: mergeProps<'a'>(\n {\n className: cn(\n 'rounded-xs transition-colors hover:text-gray focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden',\n className,\n ),\n },\n rest,\n ),\n })\n}\n\n/** Current page marker — the trailing breadcrumb the user is on. */\nconst BreadcrumbsPage = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => {\n return (\n <span\n aria-current=\"page\"\n className={cn('font-medium text-gray', className)}\n {...rest}\n />\n )\n}\n\n/** Visual separator between breadcrumb items. Defaults to \"/\". */\nconst BreadcrumbsSeparator = ({\n children,\n className,\n ...rest\n}: React.ComponentProps<'span'>) => {\n return (\n <span aria-hidden=\"true\" className={cn(className)} {...rest}>\n {children ?? '/'}\n </span>\n )\n}\n\nexport {\n Breadcrumbs,\n BreadcrumbsList,\n BreadcrumbsItem,\n BreadcrumbsLink,\n BreadcrumbsPage,\n BreadcrumbsSeparator,\n}\n"],"mappings":";;;;;;;;AAIA,MAAM,eAAe,EACnB,WACA,cAAc,YAAY,cAC1B,GAAG,WAC8B;AACjC,QAAO,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAAK,cAAY;EAAW,YAAA,GAAA,OAAA,IAAc,UAAU;EAAE,GAAI;EAAQ,CAAA;;AAG3E,MAAM,mBAAmB,EACvB,WACA,GAAG,WAC6B;AAChC,QACE,iBAAA,GAAA,kBAAA,KAAC,MAAD;EACE,YAAA,GAAA,OAAA,IACE,+DACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,MAAM,mBAAmB,EACvB,WACA,GAAG,WAC6B;AAChC,QAAO,iBAAA,GAAA,kBAAA,KAAC,MAAD;EAAI,YAAA,GAAA,OAAA,IAAc,6BAA6B,UAAU;EAAE,GAAI;EAAQ,CAAA;;;;;;;AAQhF,MAAM,mBAAmB,EACvB,WACA,QACA,GAAG,WACgC;AACnC,SAAA,GAAA,0BAAA,WAAiB;EACf,gBAAgB;EAChB;EACA,QAAA,GAAA,2BAAA,YACE,EACE,YAAA,GAAA,OAAA,IACE,8HACA,UACD,EACF,EACD,KACD;EACF,CAAC;;;AAIJ,MAAM,mBAAmB,EACvB,WACA,GAAG,WAC+B;AAClC,QACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EACE,gBAAa;EACb,YAAA,GAAA,OAAA,IAAc,yBAAyB,UAAU;EACjD,GAAI;EACJ,CAAA;;;AAKN,MAAM,wBAAwB,EAC5B,UACA,WACA,GAAG,WAC+B;AAClC,QACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EAAM,eAAY;EAAO,YAAA,GAAA,OAAA,IAAc,UAAU;EAAE,GAAI;YACpD,YAAY;EACR,CAAA"}
|
|
@@ -32,7 +32,7 @@ const BreadcrumbsLink = ({ className, render, ...rest }) => {
|
|
|
32
32
|
return useRender({
|
|
33
33
|
defaultTagName: "a",
|
|
34
34
|
render,
|
|
35
|
-
props: mergeProps({ className: cn("transition-colors hover:text-gray", className) }, rest)
|
|
35
|
+
props: mergeProps({ className: cn("rounded-xs transition-colors hover:text-gray focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden", className) }, rest)
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
38
|
/** Current page marker — the trailing breadcrumb the user is on. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.js","names":[],"sources":["../../src/components/breadcrumbs.tsx"],"sourcesContent":["import { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport { cn } from '../utils/cn'\n\nconst Breadcrumbs = ({\n className,\n 'aria-label': ariaLabel = 'Breadcrumb',\n ...rest\n}: React.ComponentProps<'nav'>) => {\n return <nav aria-label={ariaLabel} className={cn(className)} {...rest} />\n}\n\nconst BreadcrumbsList = ({\n className,\n ...rest\n}: React.ComponentProps<'ol'>) => {\n return (\n <ol\n className={cn(\n 'flex flex-wrap items-center gap-1.5 text-sm text-gray-light',\n className,\n )}\n {...rest}\n />\n )\n}\n\nconst BreadcrumbsItem = ({\n className,\n ...rest\n}: React.ComponentProps<'li'>) => {\n return <li className={cn('flex items-center gap-1.5', className)} {...rest} />\n}\n\n/**\n * Link inside a breadcrumb. Pass `render` to render any router-specific link\n * component (TanStack `Link`, Next `Link`, plain `<a>`, …) and inherit the\n * breadcrumb link styling. Without `render` it renders as a plain anchor.\n */\nconst BreadcrumbsLink = ({\n className,\n render,\n ...rest\n}: useRender.ComponentProps<'a'>) => {\n return useRender({\n defaultTagName: 'a',\n render,\n props: mergeProps<'a'>(\n {
|
|
1
|
+
{"version":3,"file":"breadcrumbs.js","names":[],"sources":["../../src/components/breadcrumbs.tsx"],"sourcesContent":["import { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport { cn } from '../utils/cn'\n\nconst Breadcrumbs = ({\n className,\n 'aria-label': ariaLabel = 'Breadcrumb',\n ...rest\n}: React.ComponentProps<'nav'>) => {\n return <nav aria-label={ariaLabel} className={cn(className)} {...rest} />\n}\n\nconst BreadcrumbsList = ({\n className,\n ...rest\n}: React.ComponentProps<'ol'>) => {\n return (\n <ol\n className={cn(\n 'flex flex-wrap items-center gap-1.5 text-sm text-gray-light',\n className,\n )}\n {...rest}\n />\n )\n}\n\nconst BreadcrumbsItem = ({\n className,\n ...rest\n}: React.ComponentProps<'li'>) => {\n return <li className={cn('flex items-center gap-1.5', className)} {...rest} />\n}\n\n/**\n * Link inside a breadcrumb. Pass `render` to render any router-specific link\n * component (TanStack `Link`, Next `Link`, plain `<a>`, …) and inherit the\n * breadcrumb link styling. Without `render` it renders as a plain anchor.\n */\nconst BreadcrumbsLink = ({\n className,\n render,\n ...rest\n}: useRender.ComponentProps<'a'>) => {\n return useRender({\n defaultTagName: 'a',\n render,\n props: mergeProps<'a'>(\n {\n className: cn(\n 'rounded-xs transition-colors hover:text-gray focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden',\n className,\n ),\n },\n rest,\n ),\n })\n}\n\n/** Current page marker — the trailing breadcrumb the user is on. */\nconst BreadcrumbsPage = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => {\n return (\n <span\n aria-current=\"page\"\n className={cn('font-medium text-gray', className)}\n {...rest}\n />\n )\n}\n\n/** Visual separator between breadcrumb items. Defaults to \"/\". */\nconst BreadcrumbsSeparator = ({\n children,\n className,\n ...rest\n}: React.ComponentProps<'span'>) => {\n return (\n <span aria-hidden=\"true\" className={cn(className)} {...rest}>\n {children ?? '/'}\n </span>\n )\n}\n\nexport {\n Breadcrumbs,\n BreadcrumbsList,\n BreadcrumbsItem,\n BreadcrumbsLink,\n BreadcrumbsPage,\n BreadcrumbsSeparator,\n}\n"],"mappings":";;;;;;AAIA,MAAM,eAAe,EACnB,WACA,cAAc,YAAY,cAC1B,GAAG,WAC8B;AACjC,QAAO,oBAAC,OAAD;EAAK,cAAY;EAAW,WAAW,GAAG,UAAU;EAAE,GAAI;EAAQ,CAAA;;AAG3E,MAAM,mBAAmB,EACvB,WACA,GAAG,WAC6B;AAChC,QACE,oBAAC,MAAD;EACE,WAAW,GACT,+DACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,MAAM,mBAAmB,EACvB,WACA,GAAG,WAC6B;AAChC,QAAO,oBAAC,MAAD;EAAI,WAAW,GAAG,6BAA6B,UAAU;EAAE,GAAI;EAAQ,CAAA;;;;;;;AAQhF,MAAM,mBAAmB,EACvB,WACA,QACA,GAAG,WACgC;AACnC,QAAO,UAAU;EACf,gBAAgB;EAChB;EACA,OAAO,WACL,EACE,WAAW,GACT,8HACA,UACD,EACF,EACD,KACD;EACF,CAAC;;;AAIJ,MAAM,mBAAmB,EACvB,WACA,GAAG,WAC+B;AAClC,QACE,oBAAC,QAAD;EACE,gBAAa;EACb,WAAW,GAAG,yBAAyB,UAAU;EACjD,GAAI;EACJ,CAAA;;;AAKN,MAAM,wBAAwB,EAC5B,UACA,WACA,GAAG,WAC+B;AAClC,QACE,oBAAC,QAAD;EAAM,eAAY;EAAO,WAAW,GAAG,UAAU;EAAE,GAAI;YACpD,YAAY;EACR,CAAA"}
|
|
@@ -12,7 +12,7 @@ declare function BubbleGroup({
|
|
|
12
12
|
...props
|
|
13
13
|
}: React$1.ComponentProps<'div'>): _$react_jsx_runtime0.JSX.Element;
|
|
14
14
|
declare const bubbleVariants: (props?: ({
|
|
15
|
-
variant?: "
|
|
15
|
+
variant?: "default" | "ghost" | "outline" | "secondary" | "destructive" | "muted" | "tinted" | null | undefined;
|
|
16
16
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
17
17
|
declare function Bubble({
|
|
18
18
|
variant,
|
|
@@ -12,7 +12,7 @@ declare function BubbleGroup({
|
|
|
12
12
|
...props
|
|
13
13
|
}: React$1.ComponentProps<'div'>): _$react_jsx_runtime0.JSX.Element;
|
|
14
14
|
declare const bubbleVariants: (props?: ({
|
|
15
|
-
variant?: "
|
|
15
|
+
variant?: "default" | "ghost" | "outline" | "secondary" | "destructive" | "muted" | "tinted" | null | undefined;
|
|
16
16
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
17
17
|
declare function Bubble({
|
|
18
18
|
variant,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const require_chunk = require("../chunk-aJGBMT86.cjs");
|
|
5
|
+
const require_accent_colors = require("../accent-colors-CjHCf8fH.cjs");
|
|
5
6
|
let react = require("react");
|
|
6
7
|
react = require_chunk.__toESM(react);
|
|
7
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -35,10 +36,12 @@ const buttonVariants = (0, class_variance_authority.cva)("group/button inline-fl
|
|
|
35
36
|
defaultVariants: { size: "default" }
|
|
36
37
|
});
|
|
37
38
|
const buttonRecipe = "bg-(--spark-style-bg,var(--spark-9)) text-(--spark-style-fg,var(--spark-contrast)) hover:bg-(--spark-style-bg-hover,var(--spark-10)) shadow-[inset_0_0_0_var(--spark-style-border-width,1px)_var(--spark-style-border,transparent)]";
|
|
38
|
-
function Button({ className, styleVariant, color, size, variant: _variant, ...props }) {
|
|
39
|
+
function Button({ className, styleVariant, color, size, render, nativeButton, variant: _variant, ...props }) {
|
|
39
40
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_button.Button, {
|
|
40
41
|
"data-style": styleVariant !== void 0 || color !== void 0 ? styleVariant ?? "solid" : void 0,
|
|
41
|
-
"data-accent-color": color
|
|
42
|
+
"data-accent-color": color ? require_accent_colors.accentByColor[color] : void 0,
|
|
43
|
+
nativeButton: nativeButton ?? render === void 0,
|
|
44
|
+
render,
|
|
42
45
|
className: (0, cnfast.cn)(buttonVariants({
|
|
43
46
|
size,
|
|
44
47
|
color
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.cjs","names":["ButtonPrimitive"],"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 type {
|
|
1
|
+
{"version":3,"file":"button.cjs","names":["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 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(--spark-9)) text-(--spark-style-fg,var(--spark-contrast)) hover:bg-(--spark-style-bg-hover,var(--spark-10))',\n secondary:\n 'bg-gray-2 text-gray-a11 shadow-[inset_0_0_0_1px_var(--color-gray-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-red-a3 text-red-a11 hover:bg-red-a4 focus-visible:ring-base-error-solid',\n },\n color: {\n accent: '',\n neutral: '',\n danger: 'focus-visible:ring-base-error-solid',\n },\n size: {\n small: 'h-9 px-3 text-sm [&_svg:not([class*=size-])]:size-4',\n default: 'h-10 px-3 [&_svg:not([class*=size-])]:size-5',\n medium: 'h-11 px-4 [&_svg:not([class*=size-])]:size-6',\n 'icon-small': 'size-9 [&_svg:not([class*=size-])]:size-4',\n icon: 'size-10 [&_svg:not([class*=size-])]:size-5',\n 'icon-medium': 'size-11 [&_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(--spark-9)) text-(--spark-style-fg,var(--spark-contrast)) hover:bg-(--spark-style-bg-hover,var(--spark-10)) shadow-[inset_0_0_0_var(--spark-style-border-width,1px)_var(--spark-style-border,transparent)]'\n\nexport type SparkButtonColor = 'accent' | 'neutral' | 'danger'\n\nexport interface ButtonProps\n extends\n React.ComponentProps<typeof ButtonPrimitive>,\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 * (`accent | neutral | danger`) instead. The `variant` axis on\n * `buttonVariants` exists only for class-string callers.\n */\n variant?: never\n}\n\nfunction Button({\n className,\n styleVariant,\n color,\n size,\n render,\n nativeButton,\n variant: _variant,\n ...props\n}: ButtonProps) {\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 {...props}\n />\n )\n}\n\nButton.displayName = 'Button'\n\nexport { Button, buttonVariants }\n"],"mappings":";;;;;;;;;;;;AASA,MAAM,kBAAA,GAAA,yBAAA,KACJ,6cACA;CACE,UAAU;EACR,SAAS;GACP,SACE;GACF,WACE;GACF,UAAU;GACV,MAAM;GACN,aACE;GACH;EACD,OAAO;GACL,QAAQ;GACR,SAAS;GACT,QAAQ;GACT;EACD,MAAM;GACJ,OAAO;GACP,SAAS;GACT,QAAQ;GACR,cAAc;GACd,MAAM;GACN,eAAe;GAChB;EACF;CACD,iBAAiB,EACf,MAAM,WACP;CACF,CACF;AAED,MAAM,eACJ;AAmBF,SAAS,OAAO,EACd,WACA,cACA,OACA,MACA,QACA,cACA,SAAS,UACT,GAAG,SACW;AAKd,QACE,iBAAA,GAAA,kBAAA,KAACA,sBAAAA,QAAD;EACE,cANY,iBAAiB,KAAA,KAAa,UAAU,KAAA,IAC3B,gBAAgB,UAAW,KAAA;EAMpD,qBALoB,QAAQC,sBAAAA,cAAc,SAAS,KAAA;EAMnD,cAAc,gBAAgB,WAAW,KAAA;EACjC;EACR,YAAA,GAAA,OAAA,IAAc,eAAe;GAAE;GAAM;GAAO,CAAC,EAAE,cAAc,UAAU;EACvE,GAAI;EACJ,CAAA;;AAIN,OAAO,cAAc"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { u as SparkStyle } from "../theme-types-BwSJKdsB.cjs";
|
|
4
4
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import * as _$class_variance_authority_types0 from "class-variance-authority/types";
|
|
@@ -10,13 +10,12 @@ import { VariantProps } from "class-variance-authority";
|
|
|
10
10
|
//#region src/components/button.d.ts
|
|
11
11
|
declare const buttonVariants: (props?: ({
|
|
12
12
|
variant?: "primary" | "secondary" | "tertiary" | "bare" | "destructive" | null | undefined;
|
|
13
|
-
color?: "
|
|
14
|
-
size?: "small" | "default" | "
|
|
13
|
+
color?: "neutral" | "accent" | "danger" | null | undefined;
|
|
14
|
+
size?: "small" | "default" | "icon" | "medium" | "icon-small" | "icon-medium" | null | undefined;
|
|
15
15
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
16
|
+
type SparkButtonColor = 'accent' | 'neutral' | 'danger';
|
|
16
17
|
interface ButtonProps extends React$1.ComponentProps<typeof Button$1>, Omit<VariantProps<typeof buttonVariants>, 'variant' | 'color'> {
|
|
17
|
-
/** Visual weight. Overrides the ambient theme style ([data-style]) for this button. */
|
|
18
18
|
styleVariant?: SparkStyle;
|
|
19
|
-
/** Which scale paints the button; `neutral`/`danger` re-point the accent scale. */
|
|
20
19
|
color?: SparkButtonColor;
|
|
21
20
|
/**
|
|
22
21
|
* @deprecated Not a `<Button>` prop and silently ignored -- use `styleVariant`
|
|
@@ -31,6 +30,8 @@ declare function Button({
|
|
|
31
30
|
styleVariant,
|
|
32
31
|
color,
|
|
33
32
|
size,
|
|
33
|
+
render,
|
|
34
|
+
nativeButton,
|
|
34
35
|
variant: _variant,
|
|
35
36
|
...props
|
|
36
37
|
}: ButtonProps): _$react_jsx_runtime0.JSX.Element;
|
|
@@ -38,5 +39,5 @@ declare namespace Button {
|
|
|
38
39
|
var displayName: string;
|
|
39
40
|
}
|
|
40
41
|
//#endregion
|
|
41
|
-
export { Button, ButtonProps, buttonVariants };
|
|
42
|
+
export { Button, ButtonProps, SparkButtonColor, buttonVariants };
|
|
42
43
|
//# sourceMappingURL=button.d.cts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { u as SparkStyle } from "../theme-types-BDdoRxXa.js";
|
|
4
4
|
import * as React$1 from "react";
|
|
5
5
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
6
|
import { Button as Button$1 } from "@base-ui/react/button";
|
|
@@ -10,13 +10,12 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
|
|
|
10
10
|
//#region src/components/button.d.ts
|
|
11
11
|
declare const buttonVariants: (props?: ({
|
|
12
12
|
variant?: "primary" | "secondary" | "tertiary" | "bare" | "destructive" | null | undefined;
|
|
13
|
-
color?: "
|
|
14
|
-
size?: "small" | "default" | "
|
|
13
|
+
color?: "neutral" | "accent" | "danger" | null | undefined;
|
|
14
|
+
size?: "small" | "default" | "icon" | "medium" | "icon-small" | "icon-medium" | null | undefined;
|
|
15
15
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
16
|
+
type SparkButtonColor = 'accent' | 'neutral' | 'danger';
|
|
16
17
|
interface ButtonProps extends React$1.ComponentProps<typeof Button$1>, Omit<VariantProps<typeof buttonVariants>, 'variant' | 'color'> {
|
|
17
|
-
/** Visual weight. Overrides the ambient theme style ([data-style]) for this button. */
|
|
18
18
|
styleVariant?: SparkStyle;
|
|
19
|
-
/** Which scale paints the button; `neutral`/`danger` re-point the accent scale. */
|
|
20
19
|
color?: SparkButtonColor;
|
|
21
20
|
/**
|
|
22
21
|
* @deprecated Not a `<Button>` prop and silently ignored -- use `styleVariant`
|
|
@@ -31,6 +30,8 @@ declare function Button({
|
|
|
31
30
|
styleVariant,
|
|
32
31
|
color,
|
|
33
32
|
size,
|
|
33
|
+
render,
|
|
34
|
+
nativeButton,
|
|
34
35
|
variant: _variant,
|
|
35
36
|
...props
|
|
36
37
|
}: ButtonProps): _$react_jsx_runtime0.JSX.Element;
|
|
@@ -38,5 +39,5 @@ declare namespace Button {
|
|
|
38
39
|
var displayName: string;
|
|
39
40
|
}
|
|
40
41
|
//#endregion
|
|
41
|
-
export { Button, ButtonProps, buttonVariants };
|
|
42
|
+
export { Button, ButtonProps, SparkButtonColor, buttonVariants };
|
|
42
43
|
//# sourceMappingURL=button.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { cn } from "../utils/cn.js";
|
|
4
|
+
import { t as accentByColor } from "../accent-colors-Ch2J0EEY.js";
|
|
4
5
|
import "react";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
7
|
import { Button as Button$1 } from "@base-ui/react/button";
|
|
@@ -32,10 +33,12 @@ const buttonVariants = cva("group/button inline-flex cursor-pointer items-center
|
|
|
32
33
|
defaultVariants: { size: "default" }
|
|
33
34
|
});
|
|
34
35
|
const buttonRecipe = "bg-(--spark-style-bg,var(--spark-9)) text-(--spark-style-fg,var(--spark-contrast)) hover:bg-(--spark-style-bg-hover,var(--spark-10)) shadow-[inset_0_0_0_var(--spark-style-border-width,1px)_var(--spark-style-border,transparent)]";
|
|
35
|
-
function Button({ className, styleVariant, color, size, variant: _variant, ...props }) {
|
|
36
|
+
function Button({ className, styleVariant, color, size, render, nativeButton, variant: _variant, ...props }) {
|
|
36
37
|
return /* @__PURE__ */ jsx(Button$1, {
|
|
37
38
|
"data-style": styleVariant !== void 0 || color !== void 0 ? styleVariant ?? "solid" : void 0,
|
|
38
|
-
"data-accent-color": color
|
|
39
|
+
"data-accent-color": color ? accentByColor[color] : void 0,
|
|
40
|
+
nativeButton: nativeButton ?? render === void 0,
|
|
41
|
+
render,
|
|
39
42
|
className: cn(buttonVariants({
|
|
40
43
|
size,
|
|
41
44
|
color
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":["ButtonPrimitive"],"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 type {
|
|
1
|
+
{"version":3,"file":"button.js","names":["ButtonPrimitive"],"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 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(--spark-9)) text-(--spark-style-fg,var(--spark-contrast)) hover:bg-(--spark-style-bg-hover,var(--spark-10))',\n secondary:\n 'bg-gray-2 text-gray-a11 shadow-[inset_0_0_0_1px_var(--color-gray-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-red-a3 text-red-a11 hover:bg-red-a4 focus-visible:ring-base-error-solid',\n },\n color: {\n accent: '',\n neutral: '',\n danger: 'focus-visible:ring-base-error-solid',\n },\n size: {\n small: 'h-9 px-3 text-sm [&_svg:not([class*=size-])]:size-4',\n default: 'h-10 px-3 [&_svg:not([class*=size-])]:size-5',\n medium: 'h-11 px-4 [&_svg:not([class*=size-])]:size-6',\n 'icon-small': 'size-9 [&_svg:not([class*=size-])]:size-4',\n icon: 'size-10 [&_svg:not([class*=size-])]:size-5',\n 'icon-medium': 'size-11 [&_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(--spark-9)) text-(--spark-style-fg,var(--spark-contrast)) hover:bg-(--spark-style-bg-hover,var(--spark-10)) shadow-[inset_0_0_0_var(--spark-style-border-width,1px)_var(--spark-style-border,transparent)]'\n\nexport type SparkButtonColor = 'accent' | 'neutral' | 'danger'\n\nexport interface ButtonProps\n extends\n React.ComponentProps<typeof ButtonPrimitive>,\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 * (`accent | neutral | danger`) instead. The `variant` axis on\n * `buttonVariants` exists only for class-string callers.\n */\n variant?: never\n}\n\nfunction Button({\n className,\n styleVariant,\n color,\n size,\n render,\n nativeButton,\n variant: _variant,\n ...props\n}: ButtonProps) {\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 {...props}\n />\n )\n}\n\nButton.displayName = 'Button'\n\nexport { Button, buttonVariants }\n"],"mappings":";;;;;;;;;AASA,MAAM,iBAAiB,IACrB,6cACA;CACE,UAAU;EACR,SAAS;GACP,SACE;GACF,WACE;GACF,UAAU;GACV,MAAM;GACN,aACE;GACH;EACD,OAAO;GACL,QAAQ;GACR,SAAS;GACT,QAAQ;GACT;EACD,MAAM;GACJ,OAAO;GACP,SAAS;GACT,QAAQ;GACR,cAAc;GACd,MAAM;GACN,eAAe;GAChB;EACF;CACD,iBAAiB,EACf,MAAM,WACP;CACF,CACF;AAED,MAAM,eACJ;AAmBF,SAAS,OAAO,EACd,WACA,cACA,OACA,MACA,QACA,cACA,SAAS,UACT,GAAG,SACW;AAKd,QACE,oBAACA,UAAD;EACE,cANY,iBAAiB,KAAA,KAAa,UAAU,KAAA,IAC3B,gBAAgB,UAAW,KAAA;EAMpD,qBALoB,QAAQ,cAAc,SAAS,KAAA;EAMnD,cAAc,gBAAgB,WAAW,KAAA;EACjC;EACR,WAAW,GAAG,eAAe;GAAE;GAAM;GAAO,CAAC,EAAE,cAAc,UAAU;EACvE,GAAI;EACJ,CAAA;;AAIN,OAAO,cAAc"}
|
|
@@ -9,7 +9,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
9
9
|
let _daypicker_react = require("@daypicker/react");
|
|
10
10
|
let cnfast = require("cnfast");
|
|
11
11
|
//#region src/components/calendar.tsx
|
|
12
|
-
function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
|
|
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
14
|
className: (0, cnfast.cn)("p-3", className),
|
|
15
15
|
classNames: {
|
|
@@ -37,7 +37,7 @@ function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
|
|
|
37
37
|
range_start: "range-start",
|
|
38
38
|
range_end: "range-end",
|
|
39
39
|
selected: "rounded-full",
|
|
40
|
-
today: "relative bg-base-gray-soft text-gray 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-base-accent-solid after:content-[\"\"]",
|
|
40
|
+
today: (0, cnfast.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-base-accent-solid after:content-[\"\"]"),
|
|
41
41
|
outside: "outside text-gray-light opacity-50 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",
|
|
@@ -48,6 +48,7 @@ function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
|
|
|
48
48
|
className: (0, cnfast.cn)("text-[20px]", orientation === "up" && "rotate-90", orientation === "down" && "-rotate-90"),
|
|
49
49
|
name: orientation === "right" ? "chevron_right" : "chevron_left"
|
|
50
50
|
}) },
|
|
51
|
+
fixedWeeks,
|
|
51
52
|
showOutsideDays,
|
|
52
53
|
...props
|
|
53
54
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.cjs","names":["DayPicker","buttonVariants","MaterialSymbol"],"sources":["../../src/components/calendar.tsx"],"sourcesContent":["import { DayPicker } from '@daypicker/react'\nimport * as React from 'react'\nimport { MaterialSymbol } from '../icons/material-symbol'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\n\ntype CalendarProps = React.ComponentProps<typeof DayPicker
|
|
1
|
+
{"version":3,"file":"calendar.cjs","names":["DayPicker","buttonVariants","MaterialSymbol"],"sources":["../../src/components/calendar.tsx"],"sourcesContent":["import { DayPicker } from '@daypicker/react'\nimport * as React from 'react'\nimport { MaterialSymbol } from '../icons/material-symbol'\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',\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',\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-10 outranks tertiary's hover:bg-gray-a3 — selected days\n // darken like a solid button instead of washing out gray under white text\n 'size-10 shrink-0 rounded-full p-0 font-normal text-gray in-aria-selected:rounded-full in-aria-selected:bg-base-accent-solid in-aria-selected:text-accent-contrast hover:in-aria-selected:bg-spark-10 hover:in-aria-selected:text-accent-contrast',\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-base-accent-solid after:content-[\"\"]',\n ),\n outside:\n 'outside text-gray-light opacity-50 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 <MaterialSymbol\n className={cn(\n 'text-[20px]',\n orientation === 'up' && 'rotate-90',\n orientation === 'down' && '-rotate-90',\n )}\n name={orientation === 'right' ? 'chevron_right' : 'chevron_left'}\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;AAChB,QACE,iBAAA,GAAA,kBAAA,KAACA,iBAAAA,WAAD;EACE,YAAA,GAAA,OAAA,IAAc,OAAO,UAAU;EAC/B,YAAY;GACV,QAAQ;GACR,OAAO;GACP,eAAe;GACf,eAAe;GACf,kBAAA,GAAA,OAAA,IACEC,0BAAAA,eAAe;IAAE,MAAM;IAAQ,SAAS;IAAY,CAAC,EACrD,6DACD;GACD,cAAA,GAAA,OAAA,IACEA,0BAAAA,eAAe;IAAE,MAAM;IAAQ,SAAS;IAAY,CAAC,EACrD,8DACD;GACD,YAAY;GACZ,UAAU;GACV,SACE;GACF,MAAM;GACN,MAAA,GAAA,OAAA,IACE,2IACA,MAAM,SAAS,UACX,yKACA,wCACL;GACD,aAAA,GAAA,OAAA,IACEA,0BAAAA,eAAe;IAAE,MAAM;IAAQ,SAAS;IAAY,CAAC,EAGrD,mPACD;GACD,aAAa;GACb,WAAW;GACX,UAAU;GACV,QAAA,GAAA,OAAA,IACE,wCACA,gBACE,kLACH;GACD,SACE;GACF,UAAU;GACV,cAAc;GACd,QAAQ;GACR,GAAG;GACJ;EACD,YAAY,EACV,UAAU,EAAE,kBACV,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,gBAAD;GACE,YAAA,GAAA,OAAA,IACE,eACA,gBAAgB,QAAQ,aACxB,gBAAgB,UAAU,aAC3B;GACD,MAAM,gBAAgB,UAAU,kBAAkB;GAClD,CAAA,EAEL;EACW;EACK;EACjB,GAAI;EACJ,CAAA"}
|
|
@@ -5,11 +5,15 @@ import * as React$1 from "react";
|
|
|
5
5
|
import { DayPicker } from "@daypicker/react";
|
|
6
6
|
|
|
7
7
|
//#region src/components/calendar.d.ts
|
|
8
|
-
type CalendarProps = React$1.ComponentProps<typeof DayPicker
|
|
8
|
+
type CalendarProps = React$1.ComponentProps<typeof DayPicker> & {
|
|
9
|
+
showTodayDot?: boolean;
|
|
10
|
+
};
|
|
9
11
|
declare function Calendar({
|
|
10
12
|
className,
|
|
11
13
|
classNames,
|
|
12
14
|
showOutsideDays,
|
|
15
|
+
fixedWeeks,
|
|
16
|
+
showTodayDot,
|
|
13
17
|
...props
|
|
14
18
|
}: CalendarProps): _$react_jsx_runtime0.JSX.Element;
|
|
15
19
|
//#endregion
|
|
@@ -5,11 +5,15 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
5
5
|
import { DayPicker } from "@daypicker/react";
|
|
6
6
|
|
|
7
7
|
//#region src/components/calendar.d.ts
|
|
8
|
-
type CalendarProps = React$1.ComponentProps<typeof DayPicker
|
|
8
|
+
type CalendarProps = React$1.ComponentProps<typeof DayPicker> & {
|
|
9
|
+
showTodayDot?: boolean;
|
|
10
|
+
};
|
|
9
11
|
declare function Calendar({
|
|
10
12
|
className,
|
|
11
13
|
classNames,
|
|
12
14
|
showOutsideDays,
|
|
15
|
+
fixedWeeks,
|
|
16
|
+
showTodayDot,
|
|
13
17
|
...props
|
|
14
18
|
}: CalendarProps): _$react_jsx_runtime0.JSX.Element;
|
|
15
19
|
//#endregion
|
|
@@ -6,7 +6,7 @@ import "react";
|
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { DayPicker } from "@daypicker/react";
|
|
8
8
|
//#region src/components/calendar.tsx
|
|
9
|
-
function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
|
|
9
|
+
function Calendar({ className, classNames, showOutsideDays = true, fixedWeeks = true, showTodayDot = true, ...props }) {
|
|
10
10
|
return /* @__PURE__ */ jsx(DayPicker, {
|
|
11
11
|
className: cn("p-3", className),
|
|
12
12
|
classNames: {
|
|
@@ -34,7 +34,7 @@ function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
|
|
|
34
34
|
range_start: "range-start",
|
|
35
35
|
range_end: "range-end",
|
|
36
36
|
selected: "rounded-full",
|
|
37
|
-
today: "relative bg-base-gray-soft text-gray 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-base-accent-solid after:content-[\"\"]",
|
|
37
|
+
today: 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-base-accent-solid after:content-[\"\"]"),
|
|
38
38
|
outside: "outside text-gray-light opacity-50 aria-selected:bg-base-gray-soft aria-selected:text-gray-light",
|
|
39
39
|
disabled: "text-gray-light opacity-50",
|
|
40
40
|
range_middle: "aria-selected:bg-base-gray-soft aria-selected:text-gray",
|
|
@@ -45,6 +45,7 @@ function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
|
|
|
45
45
|
className: cn("text-[20px]", orientation === "up" && "rotate-90", orientation === "down" && "-rotate-90"),
|
|
46
46
|
name: orientation === "right" ? "chevron_right" : "chevron_left"
|
|
47
47
|
}) },
|
|
48
|
+
fixedWeeks,
|
|
48
49
|
showOutsideDays,
|
|
49
50
|
...props
|
|
50
51
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","names":[],"sources":["../../src/components/calendar.tsx"],"sourcesContent":["import { DayPicker } from '@daypicker/react'\nimport * as React from 'react'\nimport { MaterialSymbol } from '../icons/material-symbol'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\n\ntype CalendarProps = React.ComponentProps<typeof DayPicker
|
|
1
|
+
{"version":3,"file":"calendar.js","names":[],"sources":["../../src/components/calendar.tsx"],"sourcesContent":["import { DayPicker } from '@daypicker/react'\nimport * as React from 'react'\nimport { MaterialSymbol } from '../icons/material-symbol'\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',\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',\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-10 outranks tertiary's hover:bg-gray-a3 — selected days\n // darken like a solid button instead of washing out gray under white text\n 'size-10 shrink-0 rounded-full p-0 font-normal text-gray in-aria-selected:rounded-full in-aria-selected:bg-base-accent-solid in-aria-selected:text-accent-contrast hover:in-aria-selected:bg-spark-10 hover:in-aria-selected:text-accent-contrast',\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-base-accent-solid after:content-[\"\"]',\n ),\n outside:\n 'outside text-gray-light opacity-50 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 <MaterialSymbol\n className={cn(\n 'text-[20px]',\n orientation === 'up' && 'rotate-90',\n orientation === 'down' && '-rotate-90',\n )}\n name={orientation === 'right' ? 'chevron_right' : 'chevron_left'}\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;AAChB,QACE,oBAAC,WAAD;EACE,WAAW,GAAG,OAAO,UAAU;EAC/B,YAAY;GACV,QAAQ;GACR,OAAO;GACP,eAAe;GACf,eAAe;GACf,iBAAiB,GACf,eAAe;IAAE,MAAM;IAAQ,SAAS;IAAY,CAAC,EACrD,6DACD;GACD,aAAa,GACX,eAAe;IAAE,MAAM;IAAQ,SAAS;IAAY,CAAC,EACrD,8DACD;GACD,YAAY;GACZ,UAAU;GACV,SACE;GACF,MAAM;GACN,KAAK,GACH,2IACA,MAAM,SAAS,UACX,yKACA,wCACL;GACD,YAAY,GACV,eAAe;IAAE,MAAM;IAAQ,SAAS;IAAY,CAAC,EAGrD,mPACD;GACD,aAAa;GACb,WAAW;GACX,UAAU;GACV,OAAO,GACL,wCACA,gBACE,kLACH;GACD,SACE;GACF,UAAU;GACV,cAAc;GACd,QAAQ;GACR,GAAG;GACJ;EACD,YAAY,EACV,UAAU,EAAE,kBACV,oBAAC,gBAAD;GACE,WAAW,GACT,eACA,gBAAgB,QAAQ,aACxB,gBAAgB,UAAU,aAC3B;GACD,MAAM,gBAAgB,UAAU,kBAAkB;GAClD,CAAA,EAEL;EACW;EACK;EACjB,GAAI;EACJ,CAAA"}
|
|
@@ -9,7 +9,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
9
9
|
//#region src/components/callout.d.ts
|
|
10
10
|
type CalloutVariant = 'error' | 'info' | 'success' | 'warning';
|
|
11
11
|
declare const calloutVariants: (props?: ({
|
|
12
|
-
variant?: "
|
|
12
|
+
variant?: "success" | "warning" | "error" | "info" | null | undefined;
|
|
13
13
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
14
14
|
interface CalloutProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof calloutVariants> {}
|
|
15
15
|
declare const CalloutTitle: ({
|
|
@@ -9,7 +9,7 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
|
|
|
9
9
|
//#region src/components/callout.d.ts
|
|
10
10
|
type CalloutVariant = 'error' | 'info' | 'success' | 'warning';
|
|
11
11
|
declare const calloutVariants: (props?: ({
|
|
12
|
-
variant?: "
|
|
12
|
+
variant?: "success" | "warning" | "error" | "info" | null | undefined;
|
|
13
13
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
14
14
|
interface CalloutProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof calloutVariants> {}
|
|
15
15
|
declare const CalloutTitle: ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { n as
|
|
3
|
+
import { n as SparkCardVariant, t as SparkCardColor } from "../theme-types-BwSJKdsB.cjs";
|
|
4
4
|
import * as React$1 from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/components/card.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { n as
|
|
3
|
+
import { n as SparkCardVariant, t as SparkCardColor } from "../theme-types-BDdoRxXa.js";
|
|
4
4
|
import * as React$1 from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/components/card.d.ts
|
|
@@ -63,7 +63,7 @@ function clampTooltipPosition({ anchorX, anchorY, width, height, tipWidth, tipHe
|
|
|
63
63
|
function ChartTooltipCard({ label, rows, className }) {
|
|
64
64
|
if (rows.length === 0) return null;
|
|
65
65
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
66
|
-
className: (0, cnfast.cn)("grid min-w-40 gap-1.5 rounded-lg border border-
|
|
66
|
+
className: (0, cnfast.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),
|
|
67
67
|
children: [label !== void 0 && label !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
68
68
|
className: "font-medium text-gray",
|
|
69
69
|
children: label
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.cjs","names":[],"sources":["../../src/components/chart.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { cn } from '../utils/cn'\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 dot (e.g. `var(--orange-a9)`). */\n color: string\n value: React.ReactNode\n}\n\nexport interface ChartTooltipCardProps {\n label?: React.ReactNode\n rows: ChartTooltipRow[]\n className?: string\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-
|
|
1
|
+
{"version":3,"file":"chart.cjs","names":[],"sources":["../../src/components/chart.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { cn } from '../utils/cn'\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 dot (e.g. `var(--orange-a9)`). */\n color: string\n value: React.ReactNode\n}\n\nexport interface ChartTooltipCardProps {\n label?: React.ReactNode\n rows: ChartTooltipRow[]\n className?: string\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 <span\n className=\"size-2 shrink-0 rounded-[2px]\"\n style={{ backgroundColor: row.color }}\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":";;;;;;;;;;;;;AA+BA,SAAgB,kBAAyC;CACvD,MAAM,OAAA,GAAA,MAAA,QAAgB,KAAK;CAC3B,MAAM,CAAC,MAAM,YAAA,GAAA,MAAA,UAAoB;EAAE,OAAO;EAAG,QAAQ;EAAG,CAAC;AAEzD,EAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,UAAU,IAAI;AACpB,MAAI,CAAC,QAAS;EAEd,MAAM,iBAAiB,IAAI,gBAAgB,YAAY;GACrD,MAAM,QAAQ,QAAQ;AACtB,OAAI,CAAC,MAAO;AACZ,WAAQ;IACN,OAAO,MAAM,YAAY;IACzB,QAAQ,MAAM,YAAY;IAC3B,CAAC;IACF;AAEF,iBAAe,QAAQ,QAAQ;AAC/B,eAAa,eAAe,YAAY;IACvC,EAAE,CAAC;AAEN,QAAO,CAAC,KAAK,KAAK;;;;;;AA6BpB,SAAgB,qBAAqB,EACnC,SACA,SACA,OACA,QACA,UACA,WACA,MAAM,IACN,MAAM,GACN,YAAY,WACsC;CAClD,MAAM,UAAU,KAAK,IAAI,KAAK,QAAQ,WAAW,IAAI;CACrD,MAAM,SAAS,KAAK,IAAI,KAAK,SAAS,YAAY,IAAI;AAEtD,KAAI,cAAc,UAAU;EAE1B,MAAM,QAAQ,UAAU;EACxB,MAAM,OACJ,QAAQ,WAAW,OAAO,QAAQ,QAAQ,UAAU,MAAM;AAC5D,SAAO;GACL,MAAM,KAAK,IAAI,KAAK,IAAI,MAAM,IAAI,EAAE,QAAQ;GAC5C,KAAK,KAAK,IAAI,KAAK,IAAI,SAAS,IAAI,EAAE,OAAO;GAC9C;;CAGH,MAAM,QAAQ,UAAU,MAAM;CAC9B,MAAM,aAAa,SAAS,MAAM,QAAQ,UAAU;AACpD,QAAO;EACL,MAAM,KAAK,IAAI,KAAK,IAAI,UAAU,WAAW,GAAG,IAAI,EAAE,QAAQ;EAC9D,KAAK,KAAK,IAAI,KAAK,IAAI,YAAY,IAAI,EAAE,OAAO;EACjD;;;;;;;AAQH,SAAgB,iBAAiB,EAC/B,OACA,MACA,aACwB;AACxB,KAAI,KAAK,WAAW,EAAG,QAAO;AAE9B,QACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;EACE,YAAA,GAAA,OAAA,IACE,+GACA,UACD;YAJH,CAMG,UAAU,KAAA,KAAa,UAAU,QAChC,iBAAA,GAAA,kBAAA,KAAC,OAAD;GAAK,WAAU;aAAyB;GAAY,CAAA,EAEtD,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,CACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;MACE,WAAU;MACV,OAAO,EAAE,iBAAiB,IAAI,OAAO;MACrC,CAAA,EACD,IAAI,MACA;QACP,iBAAA,GAAA,kBAAA,KAAC,QAAD;KAAM,WAAU;eACb,IAAI;KACA,CAAA,CACH;MAbC,IAAI,IAaL,CACN;GACE,CAAA,CACF"}
|
package/dist/components/chart.js
CHANGED
|
@@ -60,7 +60,7 @@ function clampTooltipPosition({ anchorX, anchorY, width, height, tipWidth, tipHe
|
|
|
60
60
|
function ChartTooltipCard({ label, rows, className }) {
|
|
61
61
|
if (rows.length === 0) return null;
|
|
62
62
|
return /* @__PURE__ */ jsxs("div", {
|
|
63
|
-
className: cn("grid min-w-40 gap-1.5 rounded-lg border border-
|
|
63
|
+
className: 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),
|
|
64
64
|
children: [label !== void 0 && label !== null && /* @__PURE__ */ jsx("div", {
|
|
65
65
|
className: "font-medium text-gray",
|
|
66
66
|
children: label
|