@l3mpire/ui 2.19.0 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -282,6 +282,7 @@ interface SelectProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>
282
282
  errorMessage?: string;
283
283
  placeholder?: string;
284
284
  value?: string;
285
+ /** @deprecated Use `tags` instead for multi-select display. */
285
286
  multiCount?: number;
286
287
  tags?: string[];
287
288
  onTagRemove?: (tag: string) => void;
package/dist/index.d.ts CHANGED
@@ -282,6 +282,7 @@ interface SelectProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>
282
282
  errorMessage?: string;
283
283
  placeholder?: string;
284
284
  value?: string;
285
+ /** @deprecated Use `tags` instead for multi-select display. */
285
286
  multiCount?: number;
286
287
  tags?: string[];
287
288
  onTagRemove?: (tag: string) => void;
package/dist/index.js CHANGED
@@ -2783,11 +2783,6 @@ var Select = React20.forwardRef(
2783
2783
  children: hasValue ? value : placeholder
2784
2784
  }
2785
2785
  ),
2786
- !hasTags && multiCount != null && multiCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "shrink-0 text-xs leading-normal text-select-text-multi", children: [
2787
- "+",
2788
- multiCount,
2789
- " others"
2790
- ] }),
2791
2786
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2792
2787
  import_icons14.Icon,
2793
2788
  {
@@ -7662,6 +7657,7 @@ var import_icons36 = require("@l3mpire/icons");
7662
7657
  // src/components/ui/filter/advanced-row.tsx
7663
7658
  var React49 = __toESM(require("react"));
7664
7659
  var PopoverPrimitive11 = __toESM(require("@radix-ui/react-popover"));
7660
+ var TooltipPrimitive3 = __toESM(require("@radix-ui/react-tooltip"));
7665
7661
  var import_icons34 = require("@l3mpire/icons");
7666
7662
 
7667
7663
  // src/components/ui/filter/filter-node-actions.tsx
@@ -7809,25 +7805,20 @@ var AdvancedRow = ({
7809
7805
  const badgeCount = getBadgeCount(condition.value);
7810
7806
  const hasValue = displayValue != null;
7811
7807
  return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex items-center gap-base w-full min-w-0", children: [
7812
- connector === "Where" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "shrink-0 w-[64px] flex items-center justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "text-xs font-semibold leading-xs text-[var(--color-muted-foreground)]", children: "Where" }) }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
7813
- "button",
7814
- {
7815
- type: "button",
7816
- onClick: onConnectorToggle,
7817
- className: cn(
7818
- "shrink-0 flex items-center justify-center gap-xs",
7819
- "min-w-[64px] min-h-[32px] max-h-[32px] px-base py-sm",
7820
- "bg-gradient-to-t from-[var(--color-btn-outlined-neutral-bg-default)] from-[10%] to-[var(--color-btn-outlined-neutral-bg-gradient-to-default)]",
7821
- "border border-[var(--color-btn-outlined-neutral-border-default)] rounded-base shadow-sm",
7822
- "cursor-pointer transition-colors text-xs font-semibold leading-xs text-[var(--color-foreground)]",
7823
- "hover:from-[var(--color-btn-outlined-neutral-bg-hover)] hover:to-[var(--color-btn-outlined-neutral-bg-gradient-to-hover)]"
7824
- ),
7825
- children: [
7826
- connector,
7827
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_icons34.Icon, { icon: import_icons34.faRefreshOutline, size: "xs", className: "text-[var(--color-foreground)]" })
7828
- ]
7829
- }
7830
- ),
7808
+ connector === "Where" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "shrink-0 w-[64px] flex items-center justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "text-xs font-semibold leading-xs text-[var(--color-muted-foreground)]", children: "Where" }) }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "shrink-0 w-[64px] flex items-center justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipPrimitive3.Provider, { delayDuration: 200, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(TooltipPrimitive3.Root, { children: [
7809
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipPrimitive3.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "text-xs font-semibold leading-xs text-[var(--color-muted-foreground)] cursor-default", children: connector }) }),
7810
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipPrimitive3.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
7811
+ TooltipPrimitive3.Content,
7812
+ {
7813
+ sideOffset: 4,
7814
+ 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 data-[state=delayed-open]:animate-[tooltip-in_150ms_ease-out] data-[state=closed]:animate-[tooltip-out_100ms_ease-in]",
7815
+ children: [
7816
+ '"Or" operator coming soon',
7817
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipPrimitive3.Arrow, { className: "fill-tooltip-default-bg" })
7818
+ ]
7819
+ }
7820
+ ) })
7821
+ ] }) }) }),
7831
7822
  /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(PopoverPrimitive11.Root, { open: propertyOpen, onOpenChange: setPropertyOpen, children: [
7832
7823
  /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(PopoverPrimitive11.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("button", { type: "button", className: cn(selectBtnStyle, "min-w-0"), children: [
7833
7824
  /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_icons34.Icon, { icon: propertyDef.icon, size: "sm", className: "shrink-0 text-[var(--color-muted-foreground)]" }),
@@ -7921,14 +7912,19 @@ var AdvancedRow = ({
7921
7912
  );
7922
7913
  }
7923
7914
  const dateWide = inputType === "DatePicker" || inputType === "DateRange";
7915
+ const isMulti = inputType === "MultiSelect" || inputType === "MultiRelationPicker";
7916
+ const multiTags = isMulti && Array.isArray(condition.value) ? condition.value.map((v) => {
7917
+ const dyn = propertyDef.dynamicOptions?.find((o) => o.value === v);
7918
+ return dyn ? dyn.label : v;
7919
+ }) : null;
7924
7920
  return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(PopoverPrimitive11.Root, { open: valueOpen, onOpenChange: setValueOpen, children: [
7925
7921
  /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(PopoverPrimitive11.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
7926
7922
  "button",
7927
7923
  {
7928
7924
  type: "button",
7929
- className: cn(selectBtnStyle, "flex-1 min-w-[80px] justify-between"),
7925
+ className: cn(selectBtnStyle, "flex-1 min-w-[80px] justify-between overflow-hidden"),
7930
7926
  children: [
7931
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
7927
+ multiTags && multiTags.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ValueTagRow, { tags: multiTags }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
7932
7928
  "span",
7933
7929
  {
7934
7930
  className: cn(
@@ -7939,20 +7935,14 @@ var AdvancedRow = ({
7939
7935
  children: hasValue ? displayValue : "Select a value"
7940
7936
  }
7941
7937
  ),
7942
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "flex items-center gap-xs shrink-0", children: [
7943
- badgeCount != null && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "text-xs font-semibold leading-xs text-[var(--color-muted-foreground)]", children: [
7944
- "+",
7945
- badgeCount - 1
7946
- ] }),
7947
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
7948
- import_icons34.Icon,
7949
- {
7950
- icon: import_icons34.faChevronDownOutline,
7951
- size: "xs",
7952
- className: "text-[var(--color-foreground)]"
7953
- }
7954
- )
7955
- ] })
7938
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
7939
+ import_icons34.Icon,
7940
+ {
7941
+ icon: import_icons34.faChevronDownOutline,
7942
+ size: "xs",
7943
+ className: "shrink-0 text-[var(--color-foreground)]"
7944
+ }
7945
+ )
7956
7946
  ]
7957
7947
  }
7958
7948
  ) }),
@@ -7998,9 +7988,85 @@ var AdvancedRow = ({
7998
7988
  ] });
7999
7989
  };
8000
7990
  AdvancedRow.displayName = "AdvancedRow";
7991
+ var tagChip = cn(
7992
+ "inline-flex items-center shrink-0 px-sm rounded-base",
7993
+ "bg-tag-neutral-bg text-tag-neutral-text",
7994
+ "text-xs font-semibold leading-xs whitespace-nowrap",
7995
+ "h-5"
7996
+ );
7997
+ function ValueTagRow({ tags }) {
7998
+ const containerRef = React49.useRef(null);
7999
+ const measureRef = React49.useRef(null);
8000
+ const [visibleCount, setVisibleCount] = React49.useState(tags.length);
8001
+ React49.useLayoutEffect(() => {
8002
+ const container = containerRef.current;
8003
+ const measureRow = measureRef.current;
8004
+ if (!container || !measureRow) return;
8005
+ const measure = () => {
8006
+ const containerWidth = container.getBoundingClientRect().width;
8007
+ const chips = Array.from(measureRow.children);
8008
+ const overflowBadgeWidth = 32;
8009
+ let usedWidth = 0;
8010
+ let count = 0;
8011
+ for (const chip of chips) {
8012
+ const chipWidth = chip.getBoundingClientRect().width;
8013
+ const gap = count > 0 ? 4 : 0;
8014
+ const projected = usedWidth + gap + chipWidth;
8015
+ const remaining = tags.length - (count + 1);
8016
+ const total = projected + (remaining > 0 ? 4 + overflowBadgeWidth : 0);
8017
+ if (total <= containerWidth) {
8018
+ usedWidth = projected;
8019
+ count++;
8020
+ } else {
8021
+ break;
8022
+ }
8023
+ }
8024
+ setVisibleCount(Math.max(1, count));
8025
+ };
8026
+ measure();
8027
+ const observer = new ResizeObserver(measure);
8028
+ observer.observe(container);
8029
+ return () => observer.disconnect();
8030
+ }, [tags]);
8031
+ const overflowCount = tags.length - visibleCount;
8032
+ const overflowTags = tags.slice(visibleCount);
8033
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex flex-1 items-center gap-xs min-w-0 overflow-hidden relative", children: [
8034
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
8035
+ "div",
8036
+ {
8037
+ ref: measureRef,
8038
+ "aria-hidden": true,
8039
+ className: "absolute flex items-center gap-xs pointer-events-none",
8040
+ style: { visibility: "hidden", whiteSpace: "nowrap", top: 0, left: 0 },
8041
+ children: tags.map((t) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: tagChip, children: t }, t))
8042
+ }
8043
+ ),
8044
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { ref: containerRef, className: "flex flex-1 items-center gap-xs overflow-hidden", children: [
8045
+ tags.slice(0, visibleCount).map((t) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: tagChip, children: t }, t)),
8046
+ overflowCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipPrimitive3.Provider, { delayDuration: 200, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(TooltipPrimitive3.Root, { children: [
8047
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipPrimitive3.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: cn(tagChip, "cursor-default bg-filter-chip-badge-bg text-filter-chip-badge-text"), children: [
8048
+ "+",
8049
+ overflowCount
8050
+ ] }) }),
8051
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipPrimitive3.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
8052
+ TooltipPrimitive3.Content,
8053
+ {
8054
+ sideOffset: 4,
8055
+ className: "z-50 px-base py-sm rounded-md shadow-lg bg-tooltip-default-bg text-tooltip-default-text text-xs font-regular leading-xs flex flex-col gap-xs data-[state=delayed-open]:animate-[tooltip-in_150ms_ease-out] data-[state=closed]:animate-[tooltip-out_100ms_ease-in]",
8056
+ children: [
8057
+ overflowTags.map((t) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { children: t }, t)),
8058
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipPrimitive3.Arrow, { className: "fill-tooltip-default-bg" })
8059
+ ]
8060
+ }
8061
+ ) })
8062
+ ] }) })
8063
+ ] })
8064
+ ] });
8065
+ }
8001
8066
 
8002
8067
  // src/components/ui/filter/advanced-group.tsx
8003
8068
  var React50 = __toESM(require("react"));
8069
+ var TooltipPrimitive4 = __toESM(require("@radix-ui/react-tooltip"));
8004
8070
  var import_icons35 = require("@l3mpire/icons");
8005
8071
  var import_jsx_runtime57 = require("react/jsx-runtime");
8006
8072
  var AdvancedGroup = ({
@@ -8015,25 +8081,20 @@ var AdvancedGroup = ({
8015
8081
  }) => {
8016
8082
  const [addOpen, setAddOpen] = React50.useState(false);
8017
8083
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex items-start gap-base w-full min-w-0", children: [
8018
- connector === "Where" ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "shrink-0 w-[64px] flex items-center justify-end pt-base", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "text-xs font-semibold leading-xs text-[var(--color-muted-foreground)]", children: "Where" }) }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "shrink-0 w-[64px] flex items-center justify-end pt-base", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
8019
- "button",
8020
- {
8021
- type: "button",
8022
- onClick: onConnectorToggle,
8023
- className: cn(
8024
- "flex items-center justify-center gap-xs",
8025
- "min-w-[64px] min-h-[32px] max-h-[32px] px-base py-sm",
8026
- "bg-gradient-to-t from-[var(--color-btn-outlined-neutral-bg-default)] from-[10%] to-[var(--color-btn-outlined-neutral-bg-gradient-to-default)]",
8027
- "border border-[var(--color-btn-outlined-neutral-border-default)] rounded-base shadow-sm",
8028
- "cursor-pointer transition-colors text-xs font-semibold leading-xs text-[var(--color-foreground)]",
8029
- "hover:from-[var(--color-btn-outlined-neutral-bg-hover)] hover:to-[var(--color-btn-outlined-neutral-bg-gradient-to-hover)]"
8030
- ),
8031
- children: [
8032
- connector,
8033
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_icons35.Icon, { icon: import_icons35.faRefreshOutline, size: "xs", className: "text-[var(--color-foreground)]" })
8034
- ]
8035
- }
8036
- ) }),
8084
+ connector === "Where" ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "shrink-0 w-[64px] flex items-center justify-end pt-base", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "text-xs font-semibold leading-xs text-[var(--color-muted-foreground)]", children: "Where" }) }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "shrink-0 w-[64px] flex items-center justify-end pt-base", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipPrimitive4.Provider, { delayDuration: 200, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(TooltipPrimitive4.Root, { children: [
8085
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipPrimitive4.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "text-xs font-semibold leading-xs text-[var(--color-muted-foreground)] cursor-default", children: connector }) }),
8086
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipPrimitive4.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
8087
+ TooltipPrimitive4.Content,
8088
+ {
8089
+ sideOffset: 4,
8090
+ 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 data-[state=delayed-open]:animate-[tooltip-in_150ms_ease-out] data-[state=closed]:animate-[tooltip-out_100ms_ease-in]",
8091
+ children: [
8092
+ '"Or" operator coming soon',
8093
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipPrimitive4.Arrow, { className: "fill-tooltip-default-bg" })
8094
+ ]
8095
+ }
8096
+ ) })
8097
+ ] }) }) }),
8037
8098
  /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("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: [
8038
8099
  children,
8039
8100
  onAddFilter && properties && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
@@ -8363,7 +8424,7 @@ var DraftRow = ({
8363
8424
  // src/components/ui/filter/summary-chip.tsx
8364
8425
  var React52 = __toESM(require("react"));
8365
8426
  var PopoverPrimitive13 = __toESM(require("@radix-ui/react-popover"));
8366
- var TooltipPrimitive3 = __toESM(require("@radix-ui/react-tooltip"));
8427
+ var TooltipPrimitive5 = __toESM(require("@radix-ui/react-tooltip"));
8367
8428
  var import_icons37 = require("@l3mpire/icons");
8368
8429
  var import_jsx_runtime59 = require("react/jsx-runtime");
8369
8430
  var ghostBtn2 = [
@@ -8545,16 +8606,16 @@ var SummaryChip = ({
8545
8606
  }
8546
8607
  );
8547
8608
  const hasTooltip = tooltipContent && !open;
8548
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipPrimitive3.Provider, { delayDuration: 300, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipPrimitive3.Root, { open: hasTooltip ? void 0 : false, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(PopoverPrimitive13.Root, { open, onOpenChange: setOpen, children: [
8549
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipPrimitive3.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(PopoverPrimitive13.Trigger, { asChild: true, children: trigger }) }),
8550
- hasTooltip && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipPrimitive3.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
8551
- TooltipPrimitive3.Content,
8609
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipPrimitive5.Provider, { delayDuration: 300, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipPrimitive5.Root, { open: hasTooltip ? void 0 : false, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(PopoverPrimitive13.Root, { open, onOpenChange: setOpen, children: [
8610
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipPrimitive5.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(PopoverPrimitive13.Trigger, { asChild: true, children: trigger }) }),
8611
+ hasTooltip && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipPrimitive5.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
8612
+ TooltipPrimitive5.Content,
8552
8613
  {
8553
8614
  sideOffset: 4,
8554
8615
  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]",
8555
8616
  children: [
8556
8617
  tooltipContent,
8557
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipPrimitive3.Arrow, { className: "fill-tooltip-default-bg" })
8618
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipPrimitive5.Arrow, { className: "fill-tooltip-default-bg" })
8558
8619
  ]
8559
8620
  }
8560
8621
  ) }),