@l3mpire/ui 2.19.1 → 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,22 +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.jsx)(
7813
- "button",
7814
- {
7815
- type: "button",
7816
- disabled: true,
7817
- title: "Coming soon",
7818
- className: cn(
7819
- "shrink-0 flex items-center justify-center",
7820
- "min-w-[64px] min-h-[32px] max-h-[32px] px-base py-sm",
7821
- "bg-gradient-to-t from-[var(--color-btn-outlined-neutral-bg-default)] from-[10%] to-[var(--color-btn-outlined-neutral-bg-gradient-to-default)]",
7822
- "border border-[var(--color-btn-outlined-neutral-border-default)] rounded-base shadow-sm",
7823
- "text-xs font-semibold leading-xs text-[var(--color-foreground)] opacity-60 cursor-not-allowed"
7824
- ),
7825
- children: connector
7826
- }
7827
- ),
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
+ ] }) }) }),
7828
7822
  /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(PopoverPrimitive11.Root, { open: propertyOpen, onOpenChange: setPropertyOpen, children: [
7829
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: [
7830
7824
  /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_icons34.Icon, { icon: propertyDef.icon, size: "sm", className: "shrink-0 text-[var(--color-muted-foreground)]" }),
@@ -7918,14 +7912,19 @@ var AdvancedRow = ({
7918
7912
  );
7919
7913
  }
7920
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;
7921
7920
  return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(PopoverPrimitive11.Root, { open: valueOpen, onOpenChange: setValueOpen, children: [
7922
7921
  /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(PopoverPrimitive11.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
7923
7922
  "button",
7924
7923
  {
7925
7924
  type: "button",
7926
- className: cn(selectBtnStyle, "flex-1 min-w-[80px] justify-between"),
7925
+ className: cn(selectBtnStyle, "flex-1 min-w-[80px] justify-between overflow-hidden"),
7927
7926
  children: [
7928
- /* @__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)(
7929
7928
  "span",
7930
7929
  {
7931
7930
  className: cn(
@@ -7936,20 +7935,14 @@ var AdvancedRow = ({
7936
7935
  children: hasValue ? displayValue : "Select a value"
7937
7936
  }
7938
7937
  ),
7939
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "flex items-center gap-xs shrink-0", children: [
7940
- badgeCount != null && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "text-xs font-semibold leading-xs text-[var(--color-muted-foreground)]", children: [
7941
- "+",
7942
- badgeCount - 1
7943
- ] }),
7944
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
7945
- import_icons34.Icon,
7946
- {
7947
- icon: import_icons34.faChevronDownOutline,
7948
- size: "xs",
7949
- className: "text-[var(--color-foreground)]"
7950
- }
7951
- )
7952
- ] })
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
+ )
7953
7946
  ]
7954
7947
  }
7955
7948
  ) }),
@@ -7995,9 +7988,85 @@ var AdvancedRow = ({
7995
7988
  ] });
7996
7989
  };
7997
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
+ }
7998
8066
 
7999
8067
  // src/components/ui/filter/advanced-group.tsx
8000
8068
  var React50 = __toESM(require("react"));
8069
+ var TooltipPrimitive4 = __toESM(require("@radix-ui/react-tooltip"));
8001
8070
  var import_icons35 = require("@l3mpire/icons");
8002
8071
  var import_jsx_runtime57 = require("react/jsx-runtime");
8003
8072
  var AdvancedGroup = ({
@@ -8012,22 +8081,20 @@ var AdvancedGroup = ({
8012
8081
  }) => {
8013
8082
  const [addOpen, setAddOpen] = React50.useState(false);
8014
8083
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex items-start gap-base w-full min-w-0", children: [
8015
- 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)(
8016
- "button",
8017
- {
8018
- type: "button",
8019
- disabled: true,
8020
- title: "Coming soon",
8021
- className: cn(
8022
- "flex items-center justify-center",
8023
- "min-w-[64px] min-h-[32px] max-h-[32px] px-base py-sm",
8024
- "bg-gradient-to-t from-[var(--color-btn-outlined-neutral-bg-default)] from-[10%] to-[var(--color-btn-outlined-neutral-bg-gradient-to-default)]",
8025
- "border border-[var(--color-btn-outlined-neutral-border-default)] rounded-base shadow-sm",
8026
- "text-xs font-semibold leading-xs text-[var(--color-foreground)] opacity-60 cursor-not-allowed"
8027
- ),
8028
- children: connector
8029
- }
8030
- ) }),
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
+ ] }) }) }),
8031
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: [
8032
8099
  children,
8033
8100
  onAddFilter && properties && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
@@ -8357,7 +8424,7 @@ var DraftRow = ({
8357
8424
  // src/components/ui/filter/summary-chip.tsx
8358
8425
  var React52 = __toESM(require("react"));
8359
8426
  var PopoverPrimitive13 = __toESM(require("@radix-ui/react-popover"));
8360
- var TooltipPrimitive3 = __toESM(require("@radix-ui/react-tooltip"));
8427
+ var TooltipPrimitive5 = __toESM(require("@radix-ui/react-tooltip"));
8361
8428
  var import_icons37 = require("@l3mpire/icons");
8362
8429
  var import_jsx_runtime59 = require("react/jsx-runtime");
8363
8430
  var ghostBtn2 = [
@@ -8539,16 +8606,16 @@ var SummaryChip = ({
8539
8606
  }
8540
8607
  );
8541
8608
  const hasTooltip = tooltipContent && !open;
8542
- 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: [
8543
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipPrimitive3.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(PopoverPrimitive13.Trigger, { asChild: true, children: trigger }) }),
8544
- hasTooltip && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipPrimitive3.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
8545
- 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,
8546
8613
  {
8547
8614
  sideOffset: 4,
8548
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]",
8549
8616
  children: [
8550
8617
  tooltipContent,
8551
- /* @__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" })
8552
8619
  ]
8553
8620
  }
8554
8621
  ) }),