@l3mpire/ui 2.18.1 → 2.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -5211,7 +5211,7 @@ var DEFAULT_OPERATOR_BY_TYPE = {
5211
5211
  text: "contains",
5212
5212
  number: "=",
5213
5213
  date: "is between",
5214
- enum: "is",
5214
+ enum: "is any of",
5215
5215
  tags: "contains",
5216
5216
  boolean: "is true",
5217
5217
  relation: "is"
@@ -5248,7 +5248,7 @@ function getValueInputType(type, operator) {
5248
5248
  return ["is any of", "is none of"].includes(operator) ? "MultiRelationPicker" : "RelationPicker";
5249
5249
  return null;
5250
5250
  }
5251
- function formatFilterValue(value, dynamicOptions) {
5251
+ function formatFilterValue(value, dynamicOptions, full) {
5252
5252
  if (value == null) return void 0;
5253
5253
  if (typeof value === "boolean") return value ? "Yes" : "No";
5254
5254
  if (value instanceof Date) {
@@ -5267,6 +5267,9 @@ function formatFilterValue(value, dynamicOptions) {
5267
5267
  const fmt = (d) => d.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
5268
5268
  return `${fmt(value[0])} \u2013 ${value[1] instanceof Date ? fmt(value[1]) : "\u2026"}`;
5269
5269
  }
5270
+ if (full) {
5271
+ return value.map((v) => resolveDynamic(String(v), dynamicOptions)).join(", ");
5272
+ }
5270
5273
  const resolved = resolveDynamic(String(value[0]), dynamicOptions);
5271
5274
  return resolved;
5272
5275
  }
@@ -5407,7 +5410,7 @@ var FilterBar = React38.forwardRef(
5407
5410
  {
5408
5411
  ref,
5409
5412
  className: cn(
5410
- "flex items-center justify-between w-full",
5413
+ "flex items-start justify-between w-full",
5411
5414
  className
5412
5415
  ),
5413
5416
  role: "toolbar",
@@ -6460,7 +6463,9 @@ var DateCalendarValueInput = ({
6460
6463
  if (isRange) {
6461
6464
  if (Array.isArray(value) && value.length === 2) {
6462
6465
  const [from, to] = value;
6463
- return { from, to };
6466
+ if (from instanceof Date) {
6467
+ return { from, to: to instanceof Date ? to : void 0 };
6468
+ }
6464
6469
  }
6465
6470
  return void 0;
6466
6471
  }
@@ -6475,7 +6480,7 @@ var DateCalendarValueInput = ({
6475
6480
  if (range.from && range.to) {
6476
6481
  onChange([range.from, range.to]);
6477
6482
  } else if (range.from) {
6478
- onChange([range.from, range.from]);
6483
+ onChange([range.from, null]);
6479
6484
  }
6480
6485
  }
6481
6486
  };
@@ -6645,7 +6650,6 @@ var MultiSelectValueInput = ({
6645
6650
  },
6646
6651
  opt.value
6647
6652
  )),
6648
- dynamicOptions && dynamicOptions.length > 0 && options.length > 0 && /* @__PURE__ */ jsx47(DynamicOptionsDivider, {}),
6649
6653
  options.map((opt) => {
6650
6654
  const isSelected = selected.includes(opt);
6651
6655
  return /* @__PURE__ */ jsxs42(
@@ -7561,7 +7565,7 @@ import { Icon as Icon35, faPlusOutline as faPlusOutline3, faChevronDownOutline a
7561
7565
  // src/components/ui/filter/advanced-row.tsx
7562
7566
  import * as React49 from "react";
7563
7567
  import * as PopoverPrimitive11 from "@radix-ui/react-popover";
7564
- import { Icon as Icon33, faRefreshOutline, faChevronDownOutline as faChevronDownOutline2 } from "@l3mpire/icons";
7568
+ import { Icon as Icon33, faChevronDownOutline as faChevronDownOutline2 } from "@l3mpire/icons";
7565
7569
 
7566
7570
  // src/components/ui/filter/filter-node-actions.tsx
7567
7571
  import * as React48 from "react";
@@ -7715,23 +7719,20 @@ var AdvancedRow = ({
7715
7719
  const badgeCount = getBadgeCount(condition.value);
7716
7720
  const hasValue = displayValue != null;
7717
7721
  return /* @__PURE__ */ jsxs50("div", { className: "flex items-center gap-base w-full min-w-0", children: [
7718
- connector === "Where" ? /* @__PURE__ */ jsx56("div", { className: "shrink-0 w-[64px] flex items-center justify-end", children: /* @__PURE__ */ jsx56("span", { className: "text-xs font-semibold leading-xs text-[var(--color-muted-foreground)]", children: "Where" }) }) : /* @__PURE__ */ jsxs50(
7722
+ connector === "Where" ? /* @__PURE__ */ jsx56("div", { className: "shrink-0 w-[64px] flex items-center justify-end", children: /* @__PURE__ */ jsx56("span", { className: "text-xs font-semibold leading-xs text-[var(--color-muted-foreground)]", children: "Where" }) }) : /* @__PURE__ */ jsx56(
7719
7723
  "button",
7720
7724
  {
7721
7725
  type: "button",
7722
- onClick: onConnectorToggle,
7726
+ disabled: true,
7727
+ title: "Coming soon",
7723
7728
  className: cn(
7724
- "shrink-0 flex items-center justify-center gap-xs",
7729
+ "shrink-0 flex items-center justify-center",
7725
7730
  "min-w-[64px] min-h-[32px] max-h-[32px] px-base py-sm",
7726
7731
  "bg-gradient-to-t from-[var(--color-btn-outlined-neutral-bg-default)] from-[10%] to-[var(--color-btn-outlined-neutral-bg-gradient-to-default)]",
7727
7732
  "border border-[var(--color-btn-outlined-neutral-border-default)] rounded-base shadow-sm",
7728
- "cursor-pointer transition-colors text-xs font-semibold leading-xs text-[var(--color-foreground)]",
7729
- "hover:from-[var(--color-btn-outlined-neutral-bg-hover)] hover:to-[var(--color-btn-outlined-neutral-bg-gradient-to-hover)]"
7733
+ "text-xs font-semibold leading-xs text-[var(--color-foreground)] opacity-60 cursor-not-allowed"
7730
7734
  ),
7731
- children: [
7732
- connector,
7733
- /* @__PURE__ */ jsx56(Icon33, { icon: faRefreshOutline, size: "xs", className: "text-[var(--color-foreground)]" })
7734
- ]
7735
+ children: connector
7735
7736
  }
7736
7737
  ),
7737
7738
  /* @__PURE__ */ jsxs50(PopoverPrimitive11.Root, { open: propertyOpen, onOpenChange: setPropertyOpen, children: [
@@ -7841,6 +7842,7 @@ var AdvancedRow = ({
7841
7842
  "text-sm font-regular leading-sm whitespace-nowrap truncate text-left",
7842
7843
  hasValue ? "text-[var(--color-foreground)]" : "text-[var(--color-muted-foreground)]"
7843
7844
  ),
7845
+ title: hasValue ? displayValue : void 0,
7844
7846
  children: hasValue ? displayValue : "Select a value"
7845
7847
  }
7846
7848
  ),
@@ -7906,7 +7908,7 @@ AdvancedRow.displayName = "AdvancedRow";
7906
7908
 
7907
7909
  // src/components/ui/filter/advanced-group.tsx
7908
7910
  import * as React50 from "react";
7909
- import { Icon as Icon34, faRefreshOutline as faRefreshOutline2, faPlusOutline as faPlusOutline2 } from "@l3mpire/icons";
7911
+ import { Icon as Icon34, faPlusOutline as faPlusOutline2 } from "@l3mpire/icons";
7910
7912
  import { jsx as jsx57, jsxs as jsxs51 } from "react/jsx-runtime";
7911
7913
  var AdvancedGroup = ({
7912
7914
  connector,
@@ -7920,23 +7922,20 @@ var AdvancedGroup = ({
7920
7922
  }) => {
7921
7923
  const [addOpen, setAddOpen] = React50.useState(false);
7922
7924
  return /* @__PURE__ */ jsxs51("div", { className: "flex items-start gap-base w-full min-w-0", children: [
7923
- connector === "Where" ? /* @__PURE__ */ jsx57("div", { className: "shrink-0 w-[64px] flex items-center justify-end pt-base", children: /* @__PURE__ */ jsx57("span", { className: "text-xs font-semibold leading-xs text-[var(--color-muted-foreground)]", children: "Where" }) }) : /* @__PURE__ */ jsx57("div", { className: "shrink-0 w-[64px] flex items-center justify-end pt-base", children: /* @__PURE__ */ jsxs51(
7925
+ connector === "Where" ? /* @__PURE__ */ jsx57("div", { className: "shrink-0 w-[64px] flex items-center justify-end pt-base", children: /* @__PURE__ */ jsx57("span", { className: "text-xs font-semibold leading-xs text-[var(--color-muted-foreground)]", children: "Where" }) }) : /* @__PURE__ */ jsx57("div", { className: "shrink-0 w-[64px] flex items-center justify-end pt-base", children: /* @__PURE__ */ jsx57(
7924
7926
  "button",
7925
7927
  {
7926
7928
  type: "button",
7927
- onClick: onConnectorToggle,
7929
+ disabled: true,
7930
+ title: "Coming soon",
7928
7931
  className: cn(
7929
- "flex items-center justify-center gap-xs",
7932
+ "flex items-center justify-center",
7930
7933
  "min-w-[64px] min-h-[32px] max-h-[32px] px-base py-sm",
7931
7934
  "bg-gradient-to-t from-[var(--color-btn-outlined-neutral-bg-default)] from-[10%] to-[var(--color-btn-outlined-neutral-bg-gradient-to-default)]",
7932
7935
  "border border-[var(--color-btn-outlined-neutral-border-default)] rounded-base shadow-sm",
7933
- "cursor-pointer transition-colors text-xs font-semibold leading-xs text-[var(--color-foreground)]",
7934
- "hover:from-[var(--color-btn-outlined-neutral-bg-hover)] hover:to-[var(--color-btn-outlined-neutral-bg-gradient-to-hover)]"
7936
+ "text-xs font-semibold leading-xs text-[var(--color-foreground)] opacity-60 cursor-not-allowed"
7935
7937
  ),
7936
- children: [
7937
- connector,
7938
- /* @__PURE__ */ jsx57(Icon34, { icon: faRefreshOutline2, size: "xs", className: "text-[var(--color-foreground)]" })
7939
- ]
7938
+ children: connector
7940
7939
  }
7941
7940
  ) }),
7942
7941
  /* @__PURE__ */ jsxs51("div", { className: "flex-1 min-w-0 flex flex-col gap-base p-base border border-[var(--color-border)] rounded-md bg-[var(--color-secondary,var(--color-accent))]", children: [
@@ -8268,6 +8267,7 @@ var DraftRow = ({
8268
8267
  // src/components/ui/filter/summary-chip.tsx
8269
8268
  import * as React52 from "react";
8270
8269
  import * as PopoverPrimitive13 from "@radix-ui/react-popover";
8270
+ import * as TooltipPrimitive3 from "@radix-ui/react-tooltip";
8271
8271
  import { Icon as Icon36, faFilterOutline as faFilterOutline6, faPlusOutline as faPlusOutline4, faChevronDownOutline as faChevronDownOutline4, faXmarkOutline as faXmarkOutline5 } from "@l3mpire/icons";
8272
8272
  import { jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
8273
8273
  var ghostBtn2 = [
@@ -8286,7 +8286,8 @@ var SummaryChip = ({
8286
8286
  className,
8287
8287
  open: openProp,
8288
8288
  onOpenChange,
8289
- collisionBoundary
8289
+ collisionBoundary,
8290
+ tooltipContent
8290
8291
  }) => {
8291
8292
  const [uncontrolledOpen, setUncontrolledOpen] = React52.useState(false);
8292
8293
  const isControlled = openProp !== void 0;
@@ -8427,24 +8428,37 @@ var SummaryChip = ({
8427
8428
  node.id
8428
8429
  );
8429
8430
  };
8430
- return /* @__PURE__ */ jsxs53(PopoverPrimitive13.Root, { open, onOpenChange: setOpen, children: [
8431
- /* @__PURE__ */ jsx59(PopoverPrimitive13.Trigger, { asChild: true, children: children ?? /* @__PURE__ */ jsxs53(
8432
- "button",
8431
+ const trigger = children ?? /* @__PURE__ */ jsxs53(
8432
+ "button",
8433
+ {
8434
+ type: "button",
8435
+ className: cn(
8436
+ "inline-flex items-center gap-sm px-base py-sm",
8437
+ "min-h-[32px] max-h-[32px]",
8438
+ "bg-gradient-to-t from-[var(--color-btn-outlined-neutral-bg-default)] from-[10%] to-[var(--color-btn-outlined-neutral-bg-gradient-to-default)]",
8439
+ "border border-[var(--color-btn-outlined-neutral-border-default)] rounded-md shadow-sm",
8440
+ "cursor-pointer transition-colors",
8441
+ "hover:from-[var(--color-btn-outlined-neutral-bg-hover)] hover:to-[var(--color-btn-outlined-neutral-bg-gradient-to-hover)]",
8442
+ className
8443
+ ),
8444
+ children: [
8445
+ /* @__PURE__ */ jsx59(Icon36, { icon: faFilterOutline6, size: "sm", className: "shrink-0 text-[var(--color-foreground)]" }),
8446
+ /* @__PURE__ */ jsx59("span", { className: "text-sm font-semibold leading-sm whitespace-nowrap text-[var(--color-foreground)]", children: "Filters" }),
8447
+ count > 0 && /* @__PURE__ */ jsx59("span", { className: "flex items-center p-2xs rounded-xs bg-filter-chip-badge-bg", children: /* @__PURE__ */ jsx59("span", { className: "text-[10px] font-semibold leading-2xs text-filter-chip-badge-text", children: count }) })
8448
+ ]
8449
+ }
8450
+ );
8451
+ const hasTooltip = tooltipContent && !open;
8452
+ return /* @__PURE__ */ jsx59(TooltipPrimitive3.Provider, { delayDuration: 300, children: /* @__PURE__ */ jsx59(TooltipPrimitive3.Root, { open: hasTooltip ? void 0 : false, children: /* @__PURE__ */ jsxs53(PopoverPrimitive13.Root, { open, onOpenChange: setOpen, children: [
8453
+ /* @__PURE__ */ jsx59(TooltipPrimitive3.Trigger, { asChild: true, children: /* @__PURE__ */ jsx59(PopoverPrimitive13.Trigger, { asChild: true, children: trigger }) }),
8454
+ hasTooltip && /* @__PURE__ */ jsx59(TooltipPrimitive3.Portal, { children: /* @__PURE__ */ jsxs53(
8455
+ TooltipPrimitive3.Content,
8433
8456
  {
8434
- type: "button",
8435
- className: cn(
8436
- "inline-flex items-center gap-sm px-base py-sm",
8437
- "min-h-[32px] max-h-[32px]",
8438
- "bg-gradient-to-t from-[var(--color-btn-outlined-neutral-bg-default)] from-[10%] to-[var(--color-btn-outlined-neutral-bg-gradient-to-default)]",
8439
- "border border-[var(--color-btn-outlined-neutral-border-default)] rounded-md shadow-sm",
8440
- "cursor-pointer transition-colors",
8441
- "hover:from-[var(--color-btn-outlined-neutral-bg-hover)] hover:to-[var(--color-btn-outlined-neutral-bg-gradient-to-hover)]",
8442
- className
8443
- ),
8457
+ sideOffset: 4,
8458
+ className: "z-50 px-base py-sm rounded-md shadow-lg bg-tooltip-default-bg text-tooltip-default-text text-sm font-regular leading-sm max-w-[320px] data-[state=delayed-open]:animate-[tooltip-in_150ms_ease-out] data-[state=closed]:animate-[tooltip-out_100ms_ease-in]",
8444
8459
  children: [
8445
- /* @__PURE__ */ jsx59(Icon36, { icon: faFilterOutline6, size: "sm", className: "shrink-0 text-[var(--color-foreground)]" }),
8446
- /* @__PURE__ */ jsx59("span", { className: "text-sm font-semibold leading-sm whitespace-nowrap text-[var(--color-foreground)]", children: "Filters" }),
8447
- count > 0 && /* @__PURE__ */ jsx59("span", { className: "flex items-center p-2xs rounded-xs bg-filter-chip-badge-bg", children: /* @__PURE__ */ jsx59("span", { className: "text-[10px] font-semibold leading-2xs text-filter-chip-badge-text", children: count }) })
8460
+ tooltipContent,
8461
+ /* @__PURE__ */ jsx59(TooltipPrimitive3.Arrow, { className: "fill-tooltip-default-bg" })
8448
8462
  ]
8449
8463
  }
8450
8464
  ) }),
@@ -8513,7 +8527,7 @@ var SummaryChip = ({
8513
8527
  ]
8514
8528
  }
8515
8529
  ) })
8516
- ] });
8530
+ ] }) }) });
8517
8531
  };
8518
8532
  SummaryChip.displayName = "SummaryChip";
8519
8533
  var DraftRow2 = ({ properties, onSelect, open: openProp, onOpenChange }) => {
@@ -8675,7 +8689,7 @@ var FilterSystem = ({
8675
8689
  const advancedFilterCount = filterState.advancedFilters.length;
8676
8690
  const showAdvancedChip = hasAdvanced || advancedOpen;
8677
8691
  return /* @__PURE__ */ jsxs54(FilterBar, { ref: containerRef, className, children: [
8678
- /* @__PURE__ */ jsxs54(FilterBarLeft, { className: "flex-nowrap flex-1 min-w-0 overflow-x-auto scrollbar-none outline-none [&>*]:shrink-0", children: [
8692
+ /* @__PURE__ */ jsxs54(FilterBarLeft, { className: "flex-wrap flex-1 min-w-0", children: [
8679
8693
  children,
8680
8694
  sortFields && filterState.sort && /* @__PURE__ */ jsx60(
8681
8695
  SortButton,
@@ -8704,12 +8718,12 @@ var FilterSystem = ({
8704
8718
  open: summaryOpen,
8705
8719
  onOpenChange: setSummaryOpen,
8706
8720
  collisionBoundary,
8721
+ tooltipContent: totalCount > 0 ? buildFilterTooltip([...filterState.basicFilters, ...filterState.advancedFilters], properties) : void 0,
8707
8722
  children: /* @__PURE__ */ jsx60(
8708
8723
  FilterBarButton,
8709
8724
  {
8710
8725
  iconOnly: isIconOnly,
8711
- count: totalCount > 0 ? totalCount : void 0,
8712
- title: buildFilterSummary(filterState.basicFilters, filterState.advancedFilters.length, properties)
8726
+ count: totalCount > 0 ? totalCount : void 0
8713
8727
  }
8714
8728
  )
8715
8729
  }
@@ -8786,23 +8800,46 @@ var FilterSystem = ({
8786
8800
  }
8787
8801
  )
8788
8802
  ] }),
8789
- actions && /* @__PURE__ */ jsx60(FilterBarRight, { className: "shrink-0 -ml-2xl pl-2xl relative z-10 bg-[linear-gradient(to_right,transparent_0px,var(--filter-bar-bg,var(--color-background,#fff))_24px)]", children: actions })
8803
+ actions && /* @__PURE__ */ jsx60(FilterBarRight, { className: "shrink-0", children: actions })
8790
8804
  ] });
8791
8805
  };
8792
8806
  FilterSystem.displayName = "FilterSystem";
8793
- function buildFilterSummary(filters, advancedCount, properties) {
8794
- if (filters.length === 0 && advancedCount === 0) return void 0;
8795
- const lines = [];
8796
- for (const f of filters) {
8797
- const prop = properties.find((p) => p.id === f.propertyId);
8798
- if (!prop) continue;
8799
- const val = formatFilterValue(f.value, prop.dynamicOptions);
8800
- lines.push(val ? `${prop.label} ${f.operator} ${val}` : `${prop.label} ${f.operator ?? ""}`);
8801
- }
8802
- if (advancedCount > 0) {
8803
- lines.push(`+ ${advancedCount} advanced filter${advancedCount > 1 ? "s" : ""}`);
8804
- }
8805
- return lines.join("\n");
8807
+ function buildFilterTooltip(nodes, properties) {
8808
+ const renderNodes = (items, depth) => {
8809
+ const result = [];
8810
+ for (let i = 0; i < items.length; i++) {
8811
+ const node = items[i];
8812
+ const connector = i > 0 ? (node.logicOperator ?? "and").toUpperCase() : null;
8813
+ if ("children" in node && node.type === "group") {
8814
+ if (connector) {
8815
+ result.push(
8816
+ /* @__PURE__ */ jsx60("div", { style: { paddingLeft: depth * 8 }, children: /* @__PURE__ */ jsx60("span", { className: "opacity-50 text-xs", children: connector }) }, `${node.id}-conn`)
8817
+ );
8818
+ }
8819
+ result.push(...renderNodes(node.children, depth + 1));
8820
+ } else {
8821
+ const f = node;
8822
+ const prop = properties.find((p) => p.id === f.propertyId);
8823
+ if (!prop) continue;
8824
+ const val = formatFilterValue(f.value, prop.dynamicOptions, true);
8825
+ result.push(
8826
+ /* @__PURE__ */ jsxs54("div", { style: { paddingLeft: depth * 8 }, children: [
8827
+ connector && /* @__PURE__ */ jsxs54("span", { className: "opacity-50 text-xs", children: [
8828
+ connector,
8829
+ " "
8830
+ ] }),
8831
+ /* @__PURE__ */ jsx60("span", { className: "font-semibold", children: prop.label }),
8832
+ " ",
8833
+ /* @__PURE__ */ jsx60("span", { className: "opacity-60", children: f.operator }),
8834
+ " ",
8835
+ val && /* @__PURE__ */ jsx60("span", { children: val })
8836
+ ] }, f.id)
8837
+ );
8838
+ }
8839
+ }
8840
+ return result;
8841
+ };
8842
+ return /* @__PURE__ */ jsx60("div", { className: "flex flex-col gap-2xs", children: renderNodes(nodes, 0) });
8806
8843
  }
8807
8844
  export {
8808
8845
  AdvancedChip,