@umami/react-zen 1.0.3 → 1.0.5

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/index.js CHANGED
@@ -33,6 +33,7 @@ var toolbar = require('@base-ui/react/toolbar');
33
33
  var accordion = require('@base-ui/react/accordion');
34
34
  var avatar = require('@base-ui/react/avatar');
35
35
  var useEmblaCarousel = require('embla-carousel-react');
36
+ var RechartsPrimitive = require('recharts');
36
37
  var collapsible = require('@base-ui/react/collapsible');
37
38
  var react = require('@base-ui/react');
38
39
  var cmdk = require('cmdk');
@@ -76,6 +77,7 @@ function _interopNamespace(e) {
76
77
  var lucide_react_star__namespace = /*#__PURE__*/_interopNamespace(lucide_react_star);
77
78
  var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
78
79
  var useEmblaCarousel__default = /*#__PURE__*/_interopDefault(useEmblaCarousel);
80
+ var RechartsPrimitive__namespace = /*#__PURE__*/_interopNamespace(RechartsPrimitive);
79
81
  var ResizablePrimitive__namespace = /*#__PURE__*/_interopNamespace(ResizablePrimitive);
80
82
 
81
83
  var __defProp = Object.defineProperty;
@@ -5507,11 +5509,16 @@ function useToast() {
5507
5509
  return { toast, toasts };
5508
5510
  }
5509
5511
  var sizeMap2 = {
5510
- xs: "w-3 h-3",
5511
- sm: "w-4 h-4",
5512
- md: "w-5 h-5",
5513
- lg: "w-6 h-6",
5514
- xl: "w-8 h-8"
5512
+ xs: "size-3",
5513
+ // 12px
5514
+ sm: "size-3.5",
5515
+ // 14px
5516
+ md: "size-4",
5517
+ // 16px
5518
+ lg: "size-4.5",
5519
+ // 18px
5520
+ xl: "size-5"
5521
+ // 20px
5515
5522
  };
5516
5523
  var strokeWidthMap = {
5517
5524
  "0.5": "stroke-[0.5]",
@@ -5753,7 +5760,7 @@ function ListSection({ title, className, children, ...props }) {
5753
5760
  "aria-labelledby": title ? titleId : void 0,
5754
5761
  ...props,
5755
5762
  "data-slot": "list-section",
5756
- className: cn.cn("flex flex-col", className),
5763
+ className: cn.cn("flex flex-col not-first:mt-4", className),
5757
5764
  children: [
5758
5765
  title && /* @__PURE__ */ jsxRuntime.jsx(
5759
5766
  "div",
@@ -7149,6 +7156,244 @@ function CarouselNext({
7149
7156
  }
7150
7157
  );
7151
7158
  }
7159
+ var THEMES = { light: "", dark: ".dark" };
7160
+ var INITIAL_DIMENSION = { width: 320, height: 200 };
7161
+ var ChartContext = React4__namespace.createContext(null);
7162
+ function useChart() {
7163
+ const context = React4__namespace.useContext(ChartContext);
7164
+ if (!context) {
7165
+ throw new Error("useChart must be used within a <ChartContainer />");
7166
+ }
7167
+ return context;
7168
+ }
7169
+ function ChartContainer({
7170
+ id,
7171
+ className,
7172
+ children,
7173
+ config,
7174
+ initialDimension = INITIAL_DIMENSION,
7175
+ ...props
7176
+ }) {
7177
+ const uniqueId = React4__namespace.useId();
7178
+ const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
7179
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxRuntime.jsxs(
7180
+ "div",
7181
+ {
7182
+ "data-slot": "chart",
7183
+ "data-chart": chartId,
7184
+ className: cn.cn(
7185
+ "flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
7186
+ className
7187
+ ),
7188
+ ...props,
7189
+ children: [
7190
+ /* @__PURE__ */ jsxRuntime.jsx(ChartStyle, { id: chartId, config }),
7191
+ /* @__PURE__ */ jsxRuntime.jsx(
7192
+ RechartsPrimitive__namespace.ResponsiveContainer,
7193
+ {
7194
+ initialDimension,
7195
+ children
7196
+ }
7197
+ )
7198
+ ]
7199
+ }
7200
+ ) });
7201
+ }
7202
+ var ChartStyle = ({ id, config }) => {
7203
+ const colorConfig = Object.entries(config).filter(
7204
+ ([, config2]) => config2.theme ?? config2.color
7205
+ );
7206
+ if (!colorConfig.length) {
7207
+ return null;
7208
+ }
7209
+ return /* @__PURE__ */ jsxRuntime.jsx(
7210
+ "style",
7211
+ {
7212
+ dangerouslySetInnerHTML: {
7213
+ __html: Object.entries(THEMES).map(
7214
+ ([theme, prefix]) => `
7215
+ ${prefix} [data-chart=${id}] {
7216
+ ${colorConfig.map(([key, itemConfig]) => {
7217
+ const color = itemConfig.theme?.[theme] ?? itemConfig.color;
7218
+ return color ? ` --color-${key}: ${color};` : null;
7219
+ }).join("\n")}
7220
+ }
7221
+ `
7222
+ ).join("\n")
7223
+ }
7224
+ }
7225
+ );
7226
+ };
7227
+ var ChartTooltip = RechartsPrimitive__namespace.Tooltip;
7228
+ function ChartTooltipContent({
7229
+ active,
7230
+ payload,
7231
+ className,
7232
+ indicator = "dot",
7233
+ hideLabel = false,
7234
+ hideIndicator = false,
7235
+ label,
7236
+ labelFormatter,
7237
+ labelClassName,
7238
+ formatter,
7239
+ color,
7240
+ nameKey,
7241
+ labelKey
7242
+ }) {
7243
+ const { config } = useChart();
7244
+ const tooltipLabel = React4__namespace.useMemo(() => {
7245
+ if (hideLabel || !payload?.length) {
7246
+ return null;
7247
+ }
7248
+ const [item] = payload;
7249
+ const key = `${labelKey ?? item?.dataKey ?? item?.name ?? "value"}`;
7250
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
7251
+ const value = !labelKey && typeof label === "string" ? config[label]?.label ?? label : itemConfig?.label;
7252
+ if (labelFormatter) {
7253
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn.cn("font-medium", labelClassName), children: labelFormatter(value, payload) });
7254
+ }
7255
+ if (!value) {
7256
+ return null;
7257
+ }
7258
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn.cn("font-medium", labelClassName), children: value });
7259
+ }, [
7260
+ label,
7261
+ labelFormatter,
7262
+ payload,
7263
+ hideLabel,
7264
+ labelClassName,
7265
+ config,
7266
+ labelKey
7267
+ ]);
7268
+ if (!active || !payload?.length) {
7269
+ return null;
7270
+ }
7271
+ const nestLabel = payload.length === 1 && indicator !== "dot";
7272
+ return /* @__PURE__ */ jsxRuntime.jsxs(
7273
+ "div",
7274
+ {
7275
+ className: cn.cn(
7276
+ "grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
7277
+ className
7278
+ ),
7279
+ children: [
7280
+ !nestLabel ? tooltipLabel : null,
7281
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-1.5", children: payload.filter((item) => item.type !== "none").map((item, index) => {
7282
+ const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`;
7283
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
7284
+ const indicatorColor = color ?? item.payload?.fill ?? item.color;
7285
+ return /* @__PURE__ */ jsxRuntime.jsx(
7286
+ "div",
7287
+ {
7288
+ className: cn.cn(
7289
+ "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
7290
+ indicator === "dot" && "items-center"
7291
+ ),
7292
+ children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7293
+ itemConfig?.icon ? /* @__PURE__ */ jsxRuntime.jsx(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsxRuntime.jsx(
7294
+ "div",
7295
+ {
7296
+ className: cn.cn(
7297
+ "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
7298
+ {
7299
+ "h-2.5 w-2.5": indicator === "dot",
7300
+ "w-1": indicator === "line",
7301
+ "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
7302
+ "my-0.5": nestLabel && indicator === "dashed"
7303
+ }
7304
+ ),
7305
+ style: {
7306
+ "--color-bg": indicatorColor,
7307
+ "--color-border": indicatorColor
7308
+ }
7309
+ }
7310
+ ),
7311
+ /* @__PURE__ */ jsxRuntime.jsxs(
7312
+ "div",
7313
+ {
7314
+ className: cn.cn(
7315
+ "flex flex-1 justify-between leading-none",
7316
+ nestLabel ? "items-end" : "items-center"
7317
+ ),
7318
+ children: [
7319
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-1.5", children: [
7320
+ nestLabel ? tooltipLabel : null,
7321
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: itemConfig?.label ?? item.name })
7322
+ ] }),
7323
+ item.value != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono font-medium text-foreground tabular-nums", children: typeof item.value === "number" ? item.value.toLocaleString() : String(item.value) })
7324
+ ]
7325
+ }
7326
+ )
7327
+ ] })
7328
+ },
7329
+ index
7330
+ );
7331
+ }) })
7332
+ ]
7333
+ }
7334
+ );
7335
+ }
7336
+ var ChartLegend = RechartsPrimitive__namespace.Legend;
7337
+ function ChartLegendContent({
7338
+ className,
7339
+ hideIcon = false,
7340
+ payload,
7341
+ verticalAlign = "bottom",
7342
+ nameKey
7343
+ }) {
7344
+ const { config } = useChart();
7345
+ if (!payload?.length) {
7346
+ return null;
7347
+ }
7348
+ return /* @__PURE__ */ jsxRuntime.jsx(
7349
+ "div",
7350
+ {
7351
+ className: cn.cn(
7352
+ "flex items-center justify-center gap-4",
7353
+ verticalAlign === "top" ? "pb-3" : "pt-3",
7354
+ className
7355
+ ),
7356
+ children: payload.filter((item) => item.type !== "none").map((item, index) => {
7357
+ const key = `${nameKey ?? item.dataKey ?? "value"}`;
7358
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
7359
+ return /* @__PURE__ */ jsxRuntime.jsxs(
7360
+ "div",
7361
+ {
7362
+ className: cn.cn(
7363
+ "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
7364
+ ),
7365
+ children: [
7366
+ itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsxRuntime.jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsxRuntime.jsx(
7367
+ "div",
7368
+ {
7369
+ className: "h-2 w-2 shrink-0 rounded-[2px]",
7370
+ style: {
7371
+ backgroundColor: item.color
7372
+ }
7373
+ }
7374
+ ),
7375
+ itemConfig?.label
7376
+ ]
7377
+ },
7378
+ index
7379
+ );
7380
+ })
7381
+ }
7382
+ );
7383
+ }
7384
+ function getPayloadConfigFromPayload(config, payload, key) {
7385
+ if (typeof payload !== "object" || payload === null) {
7386
+ return void 0;
7387
+ }
7388
+ const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
7389
+ let configLabelKey = key;
7390
+ if (key in payload && typeof payload[key] === "string") {
7391
+ configLabelKey = payload[key];
7392
+ } else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
7393
+ configLabelKey = payloadPayload[key];
7394
+ }
7395
+ return configLabelKey in config ? config[configLabelKey] : config[key];
7396
+ }
7152
7397
  var codeBlockVariants = classVarianceAuthority.cva(
7153
7398
  "group/code-block relative flex w-full min-w-0 flex-col overflow-hidden rounded-lg text-sm has-[>[data-slot=code-block-content]:focus-visible]:ring-3 has-[>[data-slot=code-block-content]:focus-visible]:ring-ring/50 data-[size=sm]:text-xs",
7154
7399
  {
@@ -8729,6 +8974,183 @@ function InputOTPSeparator({ ...props }) {
8729
8974
  }
8730
8975
  );
8731
8976
  }
8977
+ function ItemGroup({ className, ...props }) {
8978
+ return /* @__PURE__ */ jsxRuntime.jsx(
8979
+ "div",
8980
+ {
8981
+ role: "list",
8982
+ "data-slot": "item-group",
8983
+ className: cn.cn(
8984
+ "group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2",
8985
+ className
8986
+ ),
8987
+ ...props
8988
+ }
8989
+ );
8990
+ }
8991
+ function ItemSeparator({
8992
+ className,
8993
+ ...props
8994
+ }) {
8995
+ return /* @__PURE__ */ jsxRuntime.jsx(
8996
+ Separator,
8997
+ {
8998
+ "data-slot": "item-separator",
8999
+ orientation: "horizontal",
9000
+ className: cn.cn("my-2", className),
9001
+ ...props
9002
+ }
9003
+ );
9004
+ }
9005
+ var itemVariants = classVarianceAuthority.cva(
9006
+ "group/item flex w-full flex-wrap items-center rounded-md border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted",
9007
+ {
9008
+ variants: {
9009
+ variant: {
9010
+ default: "border-transparent",
9011
+ outline: "border-border",
9012
+ muted: "border-transparent bg-muted/50"
9013
+ },
9014
+ size: {
9015
+ default: "gap-3.5 px-4 py-3.5",
9016
+ sm: "gap-2.5 px-3 py-2.5",
9017
+ xs: "gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0"
9018
+ }
9019
+ },
9020
+ defaultVariants: {
9021
+ variant: "default",
9022
+ size: "default"
9023
+ }
9024
+ }
9025
+ );
9026
+ function Item({
9027
+ className,
9028
+ variant = "default",
9029
+ size = "default",
9030
+ render,
9031
+ ...props
9032
+ }) {
9033
+ return useRender.useRender({
9034
+ defaultTagName: "div",
9035
+ props: mergeProps.mergeProps(
9036
+ {
9037
+ className: cn.cn(itemVariants({ variant, size, className }))
9038
+ },
9039
+ props
9040
+ ),
9041
+ render,
9042
+ state: {
9043
+ slot: "item",
9044
+ variant,
9045
+ size
9046
+ }
9047
+ });
9048
+ }
9049
+ var itemMediaVariants = classVarianceAuthority.cva(
9050
+ "flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none",
9051
+ {
9052
+ variants: {
9053
+ variant: {
9054
+ default: "bg-transparent",
9055
+ icon: "[&_svg:not([class*='size-'])]:size-4",
9056
+ image: "size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover"
9057
+ }
9058
+ },
9059
+ defaultVariants: {
9060
+ variant: "default"
9061
+ }
9062
+ }
9063
+ );
9064
+ function ItemMedia({
9065
+ className,
9066
+ variant = "default",
9067
+ ...props
9068
+ }) {
9069
+ return /* @__PURE__ */ jsxRuntime.jsx(
9070
+ "div",
9071
+ {
9072
+ "data-slot": "item-media",
9073
+ "data-variant": variant,
9074
+ className: cn.cn(itemMediaVariants({ variant, className })),
9075
+ ...props
9076
+ }
9077
+ );
9078
+ }
9079
+ function ItemContent({ className, ...props }) {
9080
+ return /* @__PURE__ */ jsxRuntime.jsx(
9081
+ "div",
9082
+ {
9083
+ "data-slot": "item-content",
9084
+ className: cn.cn(
9085
+ "flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none",
9086
+ className
9087
+ ),
9088
+ ...props
9089
+ }
9090
+ );
9091
+ }
9092
+ function ItemTitle({ className, ...props }) {
9093
+ return /* @__PURE__ */ jsxRuntime.jsx(
9094
+ "div",
9095
+ {
9096
+ "data-slot": "item-title",
9097
+ className: cn.cn(
9098
+ "line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4",
9099
+ className
9100
+ ),
9101
+ ...props
9102
+ }
9103
+ );
9104
+ }
9105
+ function ItemDescription({ className, ...props }) {
9106
+ return /* @__PURE__ */ jsxRuntime.jsx(
9107
+ "p",
9108
+ {
9109
+ "data-slot": "item-description",
9110
+ className: cn.cn(
9111
+ "line-clamp-2 text-left text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
9112
+ className
9113
+ ),
9114
+ ...props
9115
+ }
9116
+ );
9117
+ }
9118
+ function ItemActions({ className, ...props }) {
9119
+ return /* @__PURE__ */ jsxRuntime.jsx(
9120
+ "div",
9121
+ {
9122
+ "data-slot": "item-actions",
9123
+ className: cn.cn("flex items-center gap-2", className),
9124
+ ...props
9125
+ }
9126
+ );
9127
+ }
9128
+ function ItemHeader({ className, ...props }) {
9129
+ return /* @__PURE__ */ jsxRuntime.jsx(
9130
+ "div",
9131
+ {
9132
+ "data-slot": "item-header",
9133
+ className: cn.cn(
9134
+ "flex basis-full items-center justify-between gap-2",
9135
+ className
9136
+ ),
9137
+ ...props
9138
+ }
9139
+ );
9140
+ }
9141
+ function ItemFooter({ className, ...props }) {
9142
+ return /* @__PURE__ */ jsxRuntime.jsx(
9143
+ "div",
9144
+ {
9145
+ "data-slot": "item-footer",
9146
+ className: cn.cn(
9147
+ "flex basis-full items-center justify-between gap-2",
9148
+ className
9149
+ ),
9150
+ ...props
9151
+ }
9152
+ );
9153
+ }
8732
9154
  function Kbd({ className, ...props }) {
8733
9155
  return /* @__PURE__ */ jsxRuntime.jsx(
8734
9156
  "kbd",
@@ -9595,7 +10017,7 @@ function TooltipProvider({
9595
10017
  }
9596
10018
  );
9597
10019
  }
9598
- function Tooltip({ ...props }) {
10020
+ function Tooltip2({ ...props }) {
9599
10021
  return /* @__PURE__ */ jsxRuntime.jsx(tooltip.Tooltip.Root, { "data-slot": "tooltip", ...props });
9600
10022
  }
9601
10023
  function TooltipTrigger({ ...props }) {
@@ -10089,7 +10511,7 @@ function SidebarMenuButton({
10089
10511
  children: tooltip
10090
10512
  };
10091
10513
  }
10092
- return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
10514
+ return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
10093
10515
  comp,
10094
10516
  /* @__PURE__ */ jsxRuntime.jsx(
10095
10517
  TooltipContent,
@@ -10506,6 +10928,12 @@ exports.CarouselContent = CarouselContent;
10506
10928
  exports.CarouselItem = CarouselItem;
10507
10929
  exports.CarouselNext = CarouselNext;
10508
10930
  exports.CarouselPrevious = CarouselPrevious;
10931
+ exports.ChartContainer = ChartContainer;
10932
+ exports.ChartLegend = ChartLegend;
10933
+ exports.ChartLegendContent = ChartLegendContent;
10934
+ exports.ChartStyle = ChartStyle;
10935
+ exports.ChartTooltip = ChartTooltip;
10936
+ exports.ChartTooltipContent = ChartTooltipContent;
10509
10937
  exports.Checkbox = Checkbox;
10510
10938
  exports.CheckboxGroup = CheckboxGroup;
10511
10939
  exports.Code = Code;
@@ -10647,6 +11075,16 @@ exports.InputOTP = InputOTP;
10647
11075
  exports.InputOTPGroup = InputOTPGroup;
10648
11076
  exports.InputOTPSeparator = InputOTPSeparator;
10649
11077
  exports.InputOTPSlot = InputOTPSlot;
11078
+ exports.Item = Item;
11079
+ exports.ItemActions = ItemActions;
11080
+ exports.ItemContent = ItemContent;
11081
+ exports.ItemDescription = ItemDescription;
11082
+ exports.ItemFooter = ItemFooter;
11083
+ exports.ItemGroup = ItemGroup;
11084
+ exports.ItemHeader = ItemHeader;
11085
+ exports.ItemMedia = ItemMedia;
11086
+ exports.ItemSeparator = ItemSeparator;
11087
+ exports.ItemTitle = ItemTitle;
10650
11088
  exports.Kbd = Kbd;
10651
11089
  exports.KbdGroup = KbdGroup;
10652
11090
  exports.Label = Label;
@@ -10788,7 +11226,7 @@ exports.ToolbarButton = ToolbarButton;
10788
11226
  exports.ToolbarGroup = ToolbarGroup;
10789
11227
  exports.ToolbarLink = ToolbarLink;
10790
11228
  exports.ToolbarSeparator = ToolbarSeparator;
10791
- exports.Tooltip = Tooltip;
11229
+ exports.Tooltip = Tooltip2;
10792
11230
  exports.TooltipContent = TooltipContent;
10793
11231
  exports.TooltipProvider = TooltipProvider;
10794
11232
  exports.TooltipTrigger = TooltipTrigger;