@umami/react-zen 1.0.3 → 1.0.4

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;
@@ -5753,7 +5755,7 @@ function ListSection({ title, className, children, ...props }) {
5753
5755
  "aria-labelledby": title ? titleId : void 0,
5754
5756
  ...props,
5755
5757
  "data-slot": "list-section",
5756
- className: cn.cn("flex flex-col", className),
5758
+ className: cn.cn("flex flex-col not-first:mt-4", className),
5757
5759
  children: [
5758
5760
  title && /* @__PURE__ */ jsxRuntime.jsx(
5759
5761
  "div",
@@ -7149,6 +7151,244 @@ function CarouselNext({
7149
7151
  }
7150
7152
  );
7151
7153
  }
7154
+ var THEMES = { light: "", dark: ".dark" };
7155
+ var INITIAL_DIMENSION = { width: 320, height: 200 };
7156
+ var ChartContext = React4__namespace.createContext(null);
7157
+ function useChart() {
7158
+ const context = React4__namespace.useContext(ChartContext);
7159
+ if (!context) {
7160
+ throw new Error("useChart must be used within a <ChartContainer />");
7161
+ }
7162
+ return context;
7163
+ }
7164
+ function ChartContainer({
7165
+ id,
7166
+ className,
7167
+ children,
7168
+ config,
7169
+ initialDimension = INITIAL_DIMENSION,
7170
+ ...props
7171
+ }) {
7172
+ const uniqueId = React4__namespace.useId();
7173
+ const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
7174
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxRuntime.jsxs(
7175
+ "div",
7176
+ {
7177
+ "data-slot": "chart",
7178
+ "data-chart": chartId,
7179
+ className: cn.cn(
7180
+ "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",
7181
+ className
7182
+ ),
7183
+ ...props,
7184
+ children: [
7185
+ /* @__PURE__ */ jsxRuntime.jsx(ChartStyle, { id: chartId, config }),
7186
+ /* @__PURE__ */ jsxRuntime.jsx(
7187
+ RechartsPrimitive__namespace.ResponsiveContainer,
7188
+ {
7189
+ initialDimension,
7190
+ children
7191
+ }
7192
+ )
7193
+ ]
7194
+ }
7195
+ ) });
7196
+ }
7197
+ var ChartStyle = ({ id, config }) => {
7198
+ const colorConfig = Object.entries(config).filter(
7199
+ ([, config2]) => config2.theme ?? config2.color
7200
+ );
7201
+ if (!colorConfig.length) {
7202
+ return null;
7203
+ }
7204
+ return /* @__PURE__ */ jsxRuntime.jsx(
7205
+ "style",
7206
+ {
7207
+ dangerouslySetInnerHTML: {
7208
+ __html: Object.entries(THEMES).map(
7209
+ ([theme, prefix]) => `
7210
+ ${prefix} [data-chart=${id}] {
7211
+ ${colorConfig.map(([key, itemConfig]) => {
7212
+ const color = itemConfig.theme?.[theme] ?? itemConfig.color;
7213
+ return color ? ` --color-${key}: ${color};` : null;
7214
+ }).join("\n")}
7215
+ }
7216
+ `
7217
+ ).join("\n")
7218
+ }
7219
+ }
7220
+ );
7221
+ };
7222
+ var ChartTooltip = RechartsPrimitive__namespace.Tooltip;
7223
+ function ChartTooltipContent({
7224
+ active,
7225
+ payload,
7226
+ className,
7227
+ indicator = "dot",
7228
+ hideLabel = false,
7229
+ hideIndicator = false,
7230
+ label,
7231
+ labelFormatter,
7232
+ labelClassName,
7233
+ formatter,
7234
+ color,
7235
+ nameKey,
7236
+ labelKey
7237
+ }) {
7238
+ const { config } = useChart();
7239
+ const tooltipLabel = React4__namespace.useMemo(() => {
7240
+ if (hideLabel || !payload?.length) {
7241
+ return null;
7242
+ }
7243
+ const [item] = payload;
7244
+ const key = `${labelKey ?? item?.dataKey ?? item?.name ?? "value"}`;
7245
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
7246
+ const value = !labelKey && typeof label === "string" ? config[label]?.label ?? label : itemConfig?.label;
7247
+ if (labelFormatter) {
7248
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn.cn("font-medium", labelClassName), children: labelFormatter(value, payload) });
7249
+ }
7250
+ if (!value) {
7251
+ return null;
7252
+ }
7253
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn.cn("font-medium", labelClassName), children: value });
7254
+ }, [
7255
+ label,
7256
+ labelFormatter,
7257
+ payload,
7258
+ hideLabel,
7259
+ labelClassName,
7260
+ config,
7261
+ labelKey
7262
+ ]);
7263
+ if (!active || !payload?.length) {
7264
+ return null;
7265
+ }
7266
+ const nestLabel = payload.length === 1 && indicator !== "dot";
7267
+ return /* @__PURE__ */ jsxRuntime.jsxs(
7268
+ "div",
7269
+ {
7270
+ className: cn.cn(
7271
+ "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",
7272
+ className
7273
+ ),
7274
+ children: [
7275
+ !nestLabel ? tooltipLabel : null,
7276
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-1.5", children: payload.filter((item) => item.type !== "none").map((item, index) => {
7277
+ const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`;
7278
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
7279
+ const indicatorColor = color ?? item.payload?.fill ?? item.color;
7280
+ return /* @__PURE__ */ jsxRuntime.jsx(
7281
+ "div",
7282
+ {
7283
+ className: cn.cn(
7284
+ "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
7285
+ indicator === "dot" && "items-center"
7286
+ ),
7287
+ children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7288
+ itemConfig?.icon ? /* @__PURE__ */ jsxRuntime.jsx(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsxRuntime.jsx(
7289
+ "div",
7290
+ {
7291
+ className: cn.cn(
7292
+ "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
7293
+ {
7294
+ "h-2.5 w-2.5": indicator === "dot",
7295
+ "w-1": indicator === "line",
7296
+ "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
7297
+ "my-0.5": nestLabel && indicator === "dashed"
7298
+ }
7299
+ ),
7300
+ style: {
7301
+ "--color-bg": indicatorColor,
7302
+ "--color-border": indicatorColor
7303
+ }
7304
+ }
7305
+ ),
7306
+ /* @__PURE__ */ jsxRuntime.jsxs(
7307
+ "div",
7308
+ {
7309
+ className: cn.cn(
7310
+ "flex flex-1 justify-between leading-none",
7311
+ nestLabel ? "items-end" : "items-center"
7312
+ ),
7313
+ children: [
7314
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-1.5", children: [
7315
+ nestLabel ? tooltipLabel : null,
7316
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: itemConfig?.label ?? item.name })
7317
+ ] }),
7318
+ 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) })
7319
+ ]
7320
+ }
7321
+ )
7322
+ ] })
7323
+ },
7324
+ index
7325
+ );
7326
+ }) })
7327
+ ]
7328
+ }
7329
+ );
7330
+ }
7331
+ var ChartLegend = RechartsPrimitive__namespace.Legend;
7332
+ function ChartLegendContent({
7333
+ className,
7334
+ hideIcon = false,
7335
+ payload,
7336
+ verticalAlign = "bottom",
7337
+ nameKey
7338
+ }) {
7339
+ const { config } = useChart();
7340
+ if (!payload?.length) {
7341
+ return null;
7342
+ }
7343
+ return /* @__PURE__ */ jsxRuntime.jsx(
7344
+ "div",
7345
+ {
7346
+ className: cn.cn(
7347
+ "flex items-center justify-center gap-4",
7348
+ verticalAlign === "top" ? "pb-3" : "pt-3",
7349
+ className
7350
+ ),
7351
+ children: payload.filter((item) => item.type !== "none").map((item, index) => {
7352
+ const key = `${nameKey ?? item.dataKey ?? "value"}`;
7353
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
7354
+ return /* @__PURE__ */ jsxRuntime.jsxs(
7355
+ "div",
7356
+ {
7357
+ className: cn.cn(
7358
+ "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
7359
+ ),
7360
+ children: [
7361
+ itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsxRuntime.jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsxRuntime.jsx(
7362
+ "div",
7363
+ {
7364
+ className: "h-2 w-2 shrink-0 rounded-[2px]",
7365
+ style: {
7366
+ backgroundColor: item.color
7367
+ }
7368
+ }
7369
+ ),
7370
+ itemConfig?.label
7371
+ ]
7372
+ },
7373
+ index
7374
+ );
7375
+ })
7376
+ }
7377
+ );
7378
+ }
7379
+ function getPayloadConfigFromPayload(config, payload, key) {
7380
+ if (typeof payload !== "object" || payload === null) {
7381
+ return void 0;
7382
+ }
7383
+ const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
7384
+ let configLabelKey = key;
7385
+ if (key in payload && typeof payload[key] === "string") {
7386
+ configLabelKey = payload[key];
7387
+ } else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
7388
+ configLabelKey = payloadPayload[key];
7389
+ }
7390
+ return configLabelKey in config ? config[configLabelKey] : config[key];
7391
+ }
7152
7392
  var codeBlockVariants = classVarianceAuthority.cva(
7153
7393
  "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
7394
  {
@@ -8729,6 +8969,183 @@ function InputOTPSeparator({ ...props }) {
8729
8969
  }
8730
8970
  );
8731
8971
  }
8972
+ function ItemGroup({ className, ...props }) {
8973
+ return /* @__PURE__ */ jsxRuntime.jsx(
8974
+ "div",
8975
+ {
8976
+ role: "list",
8977
+ "data-slot": "item-group",
8978
+ className: cn.cn(
8979
+ "group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2",
8980
+ className
8981
+ ),
8982
+ ...props
8983
+ }
8984
+ );
8985
+ }
8986
+ function ItemSeparator({
8987
+ className,
8988
+ ...props
8989
+ }) {
8990
+ return /* @__PURE__ */ jsxRuntime.jsx(
8991
+ Separator,
8992
+ {
8993
+ "data-slot": "item-separator",
8994
+ orientation: "horizontal",
8995
+ className: cn.cn("my-2", className),
8996
+ ...props
8997
+ }
8998
+ );
8999
+ }
9000
+ var itemVariants = classVarianceAuthority.cva(
9001
+ "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",
9002
+ {
9003
+ variants: {
9004
+ variant: {
9005
+ default: "border-transparent",
9006
+ outline: "border-border",
9007
+ muted: "border-transparent bg-muted/50"
9008
+ },
9009
+ size: {
9010
+ default: "gap-3.5 px-4 py-3.5",
9011
+ sm: "gap-2.5 px-3 py-2.5",
9012
+ xs: "gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0"
9013
+ }
9014
+ },
9015
+ defaultVariants: {
9016
+ variant: "default",
9017
+ size: "default"
9018
+ }
9019
+ }
9020
+ );
9021
+ function Item({
9022
+ className,
9023
+ variant = "default",
9024
+ size = "default",
9025
+ render,
9026
+ ...props
9027
+ }) {
9028
+ return useRender.useRender({
9029
+ defaultTagName: "div",
9030
+ props: mergeProps.mergeProps(
9031
+ {
9032
+ className: cn.cn(itemVariants({ variant, size, className }))
9033
+ },
9034
+ props
9035
+ ),
9036
+ render,
9037
+ state: {
9038
+ slot: "item",
9039
+ variant,
9040
+ size
9041
+ }
9042
+ });
9043
+ }
9044
+ var itemMediaVariants = classVarianceAuthority.cva(
9045
+ "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",
9046
+ {
9047
+ variants: {
9048
+ variant: {
9049
+ default: "bg-transparent",
9050
+ icon: "[&_svg:not([class*='size-'])]:size-4",
9051
+ 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"
9052
+ }
9053
+ },
9054
+ defaultVariants: {
9055
+ variant: "default"
9056
+ }
9057
+ }
9058
+ );
9059
+ function ItemMedia({
9060
+ className,
9061
+ variant = "default",
9062
+ ...props
9063
+ }) {
9064
+ return /* @__PURE__ */ jsxRuntime.jsx(
9065
+ "div",
9066
+ {
9067
+ "data-slot": "item-media",
9068
+ "data-variant": variant,
9069
+ className: cn.cn(itemMediaVariants({ variant, className })),
9070
+ ...props
9071
+ }
9072
+ );
9073
+ }
9074
+ function ItemContent({ className, ...props }) {
9075
+ return /* @__PURE__ */ jsxRuntime.jsx(
9076
+ "div",
9077
+ {
9078
+ "data-slot": "item-content",
9079
+ className: cn.cn(
9080
+ "flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none",
9081
+ className
9082
+ ),
9083
+ ...props
9084
+ }
9085
+ );
9086
+ }
9087
+ function ItemTitle({ className, ...props }) {
9088
+ return /* @__PURE__ */ jsxRuntime.jsx(
9089
+ "div",
9090
+ {
9091
+ "data-slot": "item-title",
9092
+ className: cn.cn(
9093
+ "line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4",
9094
+ className
9095
+ ),
9096
+ ...props
9097
+ }
9098
+ );
9099
+ }
9100
+ function ItemDescription({ className, ...props }) {
9101
+ return /* @__PURE__ */ jsxRuntime.jsx(
9102
+ "p",
9103
+ {
9104
+ "data-slot": "item-description",
9105
+ className: cn.cn(
9106
+ "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",
9107
+ className
9108
+ ),
9109
+ ...props
9110
+ }
9111
+ );
9112
+ }
9113
+ function ItemActions({ className, ...props }) {
9114
+ return /* @__PURE__ */ jsxRuntime.jsx(
9115
+ "div",
9116
+ {
9117
+ "data-slot": "item-actions",
9118
+ className: cn.cn("flex items-center gap-2", className),
9119
+ ...props
9120
+ }
9121
+ );
9122
+ }
9123
+ function ItemHeader({ className, ...props }) {
9124
+ return /* @__PURE__ */ jsxRuntime.jsx(
9125
+ "div",
9126
+ {
9127
+ "data-slot": "item-header",
9128
+ className: cn.cn(
9129
+ "flex basis-full items-center justify-between gap-2",
9130
+ className
9131
+ ),
9132
+ ...props
9133
+ }
9134
+ );
9135
+ }
9136
+ function ItemFooter({ className, ...props }) {
9137
+ return /* @__PURE__ */ jsxRuntime.jsx(
9138
+ "div",
9139
+ {
9140
+ "data-slot": "item-footer",
9141
+ className: cn.cn(
9142
+ "flex basis-full items-center justify-between gap-2",
9143
+ className
9144
+ ),
9145
+ ...props
9146
+ }
9147
+ );
9148
+ }
8732
9149
  function Kbd({ className, ...props }) {
8733
9150
  return /* @__PURE__ */ jsxRuntime.jsx(
8734
9151
  "kbd",
@@ -9595,7 +10012,7 @@ function TooltipProvider({
9595
10012
  }
9596
10013
  );
9597
10014
  }
9598
- function Tooltip({ ...props }) {
10015
+ function Tooltip2({ ...props }) {
9599
10016
  return /* @__PURE__ */ jsxRuntime.jsx(tooltip.Tooltip.Root, { "data-slot": "tooltip", ...props });
9600
10017
  }
9601
10018
  function TooltipTrigger({ ...props }) {
@@ -10089,7 +10506,7 @@ function SidebarMenuButton({
10089
10506
  children: tooltip
10090
10507
  };
10091
10508
  }
10092
- return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
10509
+ return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
10093
10510
  comp,
10094
10511
  /* @__PURE__ */ jsxRuntime.jsx(
10095
10512
  TooltipContent,
@@ -10506,6 +10923,12 @@ exports.CarouselContent = CarouselContent;
10506
10923
  exports.CarouselItem = CarouselItem;
10507
10924
  exports.CarouselNext = CarouselNext;
10508
10925
  exports.CarouselPrevious = CarouselPrevious;
10926
+ exports.ChartContainer = ChartContainer;
10927
+ exports.ChartLegend = ChartLegend;
10928
+ exports.ChartLegendContent = ChartLegendContent;
10929
+ exports.ChartStyle = ChartStyle;
10930
+ exports.ChartTooltip = ChartTooltip;
10931
+ exports.ChartTooltipContent = ChartTooltipContent;
10509
10932
  exports.Checkbox = Checkbox;
10510
10933
  exports.CheckboxGroup = CheckboxGroup;
10511
10934
  exports.Code = Code;
@@ -10647,6 +11070,16 @@ exports.InputOTP = InputOTP;
10647
11070
  exports.InputOTPGroup = InputOTPGroup;
10648
11071
  exports.InputOTPSeparator = InputOTPSeparator;
10649
11072
  exports.InputOTPSlot = InputOTPSlot;
11073
+ exports.Item = Item;
11074
+ exports.ItemActions = ItemActions;
11075
+ exports.ItemContent = ItemContent;
11076
+ exports.ItemDescription = ItemDescription;
11077
+ exports.ItemFooter = ItemFooter;
11078
+ exports.ItemGroup = ItemGroup;
11079
+ exports.ItemHeader = ItemHeader;
11080
+ exports.ItemMedia = ItemMedia;
11081
+ exports.ItemSeparator = ItemSeparator;
11082
+ exports.ItemTitle = ItemTitle;
10650
11083
  exports.Kbd = Kbd;
10651
11084
  exports.KbdGroup = KbdGroup;
10652
11085
  exports.Label = Label;
@@ -10788,7 +11221,7 @@ exports.ToolbarButton = ToolbarButton;
10788
11221
  exports.ToolbarGroup = ToolbarGroup;
10789
11222
  exports.ToolbarLink = ToolbarLink;
10790
11223
  exports.ToolbarSeparator = ToolbarSeparator;
10791
- exports.Tooltip = Tooltip;
11224
+ exports.Tooltip = Tooltip2;
10792
11225
  exports.TooltipContent = TooltipContent;
10793
11226
  exports.TooltipProvider = TooltipProvider;
10794
11227
  exports.TooltipTrigger = TooltipTrigger;