@l3mpire/ui 2.21.1 → 2.22.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.mjs CHANGED
@@ -6834,8 +6834,8 @@ import {
6834
6834
  faMagnifyingGlassOutline,
6835
6835
  faFilterOutline as faFilterOutline3
6836
6836
  } from "@l3mpire/icons";
6837
- import { Fragment as Fragment4, jsx as jsx50, jsxs as jsxs44 } from "react/jsx-runtime";
6838
- var AdvancedFilterFooter = ({ onClick, count }) => /* @__PURE__ */ jsxs44(Fragment4, { children: [
6837
+ import { jsx as jsx50, jsxs as jsxs44 } from "react/jsx-runtime";
6838
+ var AdvancedFilterFooter = ({ onClick, count }) => /* @__PURE__ */ jsxs44("div", { className: "shrink-0 flex flex-col", children: [
6839
6839
  /* @__PURE__ */ jsx50("div", { className: "h-px bg-dropdown-border mx-xs" }),
6840
6840
  /* @__PURE__ */ jsxs44(
6841
6841
  "button",
@@ -6886,9 +6886,21 @@ var PropertySelector = ({
6886
6886
  setSearch("");
6887
6887
  }
6888
6888
  }, [open]);
6889
+ const pinnedGroupIds = React44.useMemo(() => {
6890
+ const set = /* @__PURE__ */ new Set();
6891
+ for (const p of properties) {
6892
+ if (p.groupPinned) set.add(p.group);
6893
+ }
6894
+ return set;
6895
+ }, [properties]);
6896
+ const pinnedProperties = React44.useMemo(
6897
+ () => properties.filter((p) => pinnedGroupIds.has(p.group)),
6898
+ [properties, pinnedGroupIds]
6899
+ );
6889
6900
  const groups = React44.useMemo(() => {
6890
6901
  const map = /* @__PURE__ */ new Map();
6891
6902
  for (const prop of properties) {
6903
+ if (pinnedGroupIds.has(prop.group)) continue;
6892
6904
  const existing = map.get(prop.group);
6893
6905
  if (existing) {
6894
6906
  existing.count++;
@@ -6902,12 +6914,14 @@ var PropertySelector = ({
6902
6914
  }
6903
6915
  }
6904
6916
  return Array.from(map.values());
6905
- }, [properties]);
6906
- const globalSearchResults = React44.useMemo(() => {
6907
- if (!search || activeGroup) return [];
6917
+ }, [properties, pinnedGroupIds]);
6918
+ const filteredPinnedProperties = React44.useMemo(() => {
6919
+ if (!search || activeGroup) return pinnedProperties;
6908
6920
  const lower = search.toLowerCase();
6909
- return properties.filter((p) => p.label.toLowerCase().includes(lower));
6910
- }, [properties, search, activeGroup]);
6921
+ return pinnedProperties.filter(
6922
+ (p) => p.label.toLowerCase().includes(lower)
6923
+ );
6924
+ }, [pinnedProperties, search, activeGroup]);
6911
6925
  const filteredGroups = React44.useMemo(() => {
6912
6926
  if (!search || activeGroup) return groups;
6913
6927
  const lower = search.toLowerCase();
@@ -6925,7 +6939,13 @@ var PropertySelector = ({
6925
6939
  return groupProps.filter((p) => p.label.toLowerCase().includes(lower));
6926
6940
  }, [properties, activeGroup, search]);
6927
6941
  const activeGroupInfo = groups.find((g) => g.group === activeGroup);
6928
- const showGlobalResults = search.length > 0 && !activeGroup && globalSearchResults.length > 0;
6942
+ const nonPinnedSearchResults = React44.useMemo(() => {
6943
+ if (!search || activeGroup) return [];
6944
+ const lower = search.toLowerCase();
6945
+ return properties.filter(
6946
+ (p) => !pinnedGroupIds.has(p.group) && p.label.toLowerCase().includes(lower)
6947
+ );
6948
+ }, [properties, search, activeGroup, pinnedGroupIds]);
6929
6949
  return /* @__PURE__ */ jsxs44(PopoverPrimitive6.Root, { open, onOpenChange, children: [
6930
6950
  /* @__PURE__ */ jsx50(PopoverPrimitive6.Trigger, { asChild: true, children }),
6931
6951
  /* @__PURE__ */ jsx50(PopoverPrimitive6.Portal, { children: /* @__PURE__ */ jsxs44(
@@ -6935,18 +6955,18 @@ var PropertySelector = ({
6935
6955
  align: "start",
6936
6956
  onCloseAutoFocus: (e) => e.preventDefault(),
6937
6957
  className: cn(
6938
- "z-50 flex flex-col gap-xs overflow-clip p-xs",
6958
+ "z-50 flex flex-col gap-xs overflow-hidden p-xs",
6939
6959
  "bg-dropdown-bg border border-dropdown-border rounded-md shadow-lg",
6940
6960
  "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
6941
6961
  "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
6942
6962
  "data-[side=bottom]:slide-in-from-top-2",
6943
- "min-w-[230px]"
6963
+ "min-w-[230px] max-h-[360px]"
6944
6964
  ),
6945
6965
  children: [
6946
6966
  activeGroup === null ? (
6947
- /* ── Level 1: Search + Categories ───────────────────────── */
6948
- /* @__PURE__ */ jsxs44("div", { className: "flex flex-col gap-xs", children: [
6949
- /* @__PURE__ */ jsxs44("div", { className: "flex items-center gap-base px-md py-base border border-input rounded-md", children: [
6967
+ /* ── Level 1: Search + (pinned props) + Categories ──────── */
6968
+ /* @__PURE__ */ jsxs44("div", { className: "flex flex-col gap-xs flex-1 min-h-0", children: [
6969
+ /* @__PURE__ */ jsxs44("div", { className: "shrink-0 flex items-center gap-base px-md py-base border border-input rounded-md", children: [
6950
6970
  /* @__PURE__ */ jsx50(
6951
6971
  Icon28,
6952
6972
  {
@@ -6967,9 +6987,8 @@ var PropertySelector = ({
6967
6987
  }
6968
6988
  )
6969
6989
  ] }),
6970
- showGlobalResults ? (
6971
- /* ── Global search results (flat property list) ─────── */
6972
- /* @__PURE__ */ jsx50("div", { className: "flex flex-col max-h-[300px] overflow-y-auto", children: globalSearchResults.map((prop) => /* @__PURE__ */ jsxs44(
6990
+ /* @__PURE__ */ jsxs44("div", { className: "flex flex-col flex-1 min-h-0 overflow-y-auto", children: [
6991
+ filteredPinnedProperties.map((prop) => /* @__PURE__ */ jsxs44(
6973
6992
  "button",
6974
6993
  {
6975
6994
  type: "button",
@@ -6987,15 +7006,39 @@ var PropertySelector = ({
6987
7006
  className: "shrink-0 text-dropdown-item-icon"
6988
7007
  }
6989
7008
  ),
6990
- /* @__PURE__ */ jsx50("span", { className: "flex-1 text-sm font-regular leading-sm text-dropdown-item-text text-left truncate", children: prop.label }),
6991
- /* @__PURE__ */ jsx50("span", { className: "text-xs font-regular leading-xs text-muted-foreground", children: prop.groupLabel })
7009
+ /* @__PURE__ */ jsx50("span", { className: "flex-1 text-sm font-regular leading-sm text-dropdown-item-text text-left truncate", children: prop.label })
6992
7010
  ]
6993
7011
  },
6994
7012
  prop.id
6995
- )) })
6996
- ) : (
6997
- /* ── Group list ─────────────────────────────────────── */
6998
- /* @__PURE__ */ jsxs44("div", { className: "flex flex-col", children: [
7013
+ )),
7014
+ search ? (
7015
+ /* ── Flat matches across non-pinned groups ────────── */
7016
+ nonPinnedSearchResults.map((prop) => /* @__PURE__ */ jsxs44(
7017
+ "button",
7018
+ {
7019
+ type: "button",
7020
+ onClick: () => {
7021
+ onSelect(prop);
7022
+ onOpenChange?.(false);
7023
+ },
7024
+ className: "flex items-center gap-base p-base rounded-base cursor-pointer transition-colors hover:bg-dropdown-item-hover",
7025
+ children: [
7026
+ /* @__PURE__ */ jsx50(
7027
+ Icon28,
7028
+ {
7029
+ icon: prop.icon,
7030
+ size: "sm",
7031
+ className: "shrink-0 text-dropdown-item-icon"
7032
+ }
7033
+ ),
7034
+ /* @__PURE__ */ jsx50("span", { className: "flex-1 text-sm font-regular leading-sm text-dropdown-item-text text-left truncate", children: prop.label }),
7035
+ /* @__PURE__ */ jsx50("span", { className: "text-xs font-regular leading-xs text-muted-foreground", children: prop.groupLabel })
7036
+ ]
7037
+ },
7038
+ prop.id
7039
+ ))
7040
+ ) : (
7041
+ /* ── Category list ────────────────────────────────── */
6999
7042
  filteredGroups.map((g) => /* @__PURE__ */ jsxs44(
7000
7043
  "button",
7001
7044
  {
@@ -7027,14 +7070,14 @@ var PropertySelector = ({
7027
7070
  ]
7028
7071
  },
7029
7072
  g.group
7030
- )),
7031
- filteredGroups.length === 0 && /* @__PURE__ */ jsx50("span", { className: "p-base text-sm text-muted-foreground", children: "No results" })
7032
- ] })
7033
- )
7073
+ ))
7074
+ ),
7075
+ filteredPinnedProperties.length === 0 && (search ? nonPinnedSearchResults.length === 0 : filteredGroups.length === 0) && /* @__PURE__ */ jsx50("span", { className: "p-base text-sm text-muted-foreground", children: "No results" })
7076
+ ] })
7034
7077
  ] })
7035
7078
  ) : (
7036
7079
  /* ── Level 2: Properties ─────────────────────────────────── */
7037
- /* @__PURE__ */ jsxs44("div", { className: "flex flex-col gap-xs", children: [
7080
+ /* @__PURE__ */ jsxs44("div", { className: "flex flex-col gap-xs flex-1 min-h-0", children: [
7038
7081
  /* @__PURE__ */ jsxs44(
7039
7082
  "button",
7040
7083
  {
@@ -7043,7 +7086,7 @@ var PropertySelector = ({
7043
7086
  setActiveGroup(null);
7044
7087
  setSearch("");
7045
7088
  },
7046
- className: "flex items-center gap-base p-base rounded-base cursor-pointer transition-colors hover:bg-dropdown-item-hover",
7089
+ className: "shrink-0 flex items-center gap-base p-base rounded-base cursor-pointer transition-colors hover:bg-dropdown-item-hover",
7047
7090
  children: [
7048
7091
  /* @__PURE__ */ jsx50(
7049
7092
  Icon28,
@@ -7057,7 +7100,7 @@ var PropertySelector = ({
7057
7100
  ]
7058
7101
  }
7059
7102
  ),
7060
- /* @__PURE__ */ jsxs44("div", { className: "flex items-center gap-base px-md py-base border border-input rounded-md", children: [
7103
+ /* @__PURE__ */ jsxs44("div", { className: "shrink-0 flex items-center gap-base px-md py-base border border-input rounded-md", children: [
7061
7104
  /* @__PURE__ */ jsx50(
7062
7105
  Icon28,
7063
7106
  {
@@ -7078,7 +7121,7 @@ var PropertySelector = ({
7078
7121
  }
7079
7122
  )
7080
7123
  ] }),
7081
- /* @__PURE__ */ jsxs44("div", { className: "flex flex-col max-h-[300px] overflow-y-auto", children: [
7124
+ /* @__PURE__ */ jsxs44("div", { className: "flex flex-col flex-1 min-h-0 overflow-y-auto", children: [
7082
7125
  filteredProperties.map((prop) => /* @__PURE__ */ jsxs44(
7083
7126
  "button",
7084
7127
  {
@@ -7740,6 +7783,19 @@ var AdvancedRow = ({
7740
7783
  const [operatorOpen, setOperatorOpen] = React49.useState(false);
7741
7784
  const [propertyOpen, setPropertyOpen] = React49.useState(false);
7742
7785
  const [valueOpen, setValueOpen] = React49.useState(false);
7786
+ const { pinnedProperties, unpinnedProperties } = React49.useMemo(() => {
7787
+ const pinnedGroups = /* @__PURE__ */ new Set();
7788
+ for (const p of properties) {
7789
+ if (p.groupPinned) pinnedGroups.add(p.group);
7790
+ }
7791
+ const pinned = [];
7792
+ const unpinned = [];
7793
+ for (const p of properties) {
7794
+ if (pinnedGroups.has(p.group)) pinned.push(p);
7795
+ else unpinned.push(p);
7796
+ }
7797
+ return { pinnedProperties: pinned, unpinnedProperties: unpinned };
7798
+ }, [properties]);
7743
7799
  const handleOperatorSelect = (op) => {
7744
7800
  if (isNoValueOperator(op)) {
7745
7801
  onUpdate({ ...condition, operator: op, value: null });
@@ -7776,7 +7832,7 @@ var AdvancedRow = ({
7776
7832
  /* @__PURE__ */ jsx56("span", { className: "text-sm font-regular leading-sm text-foreground whitespace-nowrap truncate", children: propertyDef.label }),
7777
7833
  /* @__PURE__ */ jsx56(Icon33, { icon: faChevronDownOutline2, size: "xs", className: "shrink-0 text-foreground" })
7778
7834
  ] }) }),
7779
- /* @__PURE__ */ jsx56(PopoverPrimitive11.Portal, { children: /* @__PURE__ */ jsx56(
7835
+ /* @__PURE__ */ jsx56(PopoverPrimitive11.Portal, { children: /* @__PURE__ */ jsxs50(
7780
7836
  PopoverPrimitive11.Content,
7781
7837
  {
7782
7838
  sideOffset: 4,
@@ -7788,26 +7844,49 @@ var AdvancedRow = ({
7788
7844
  "data-[state=closed]:animate-out data-[state=closed]:fade-out-0",
7789
7845
  "min-w-[200px]"
7790
7846
  ),
7791
- children: properties.map((p) => /* @__PURE__ */ jsxs50(
7792
- "button",
7793
- {
7794
- type: "button",
7795
- onClick: () => {
7796
- onPropertyChange(p);
7797
- setPropertyOpen(false);
7847
+ children: [
7848
+ pinnedProperties.map((p) => /* @__PURE__ */ jsxs50(
7849
+ "button",
7850
+ {
7851
+ type: "button",
7852
+ onClick: () => {
7853
+ onPropertyChange(p);
7854
+ setPropertyOpen(false);
7855
+ },
7856
+ className: cn(
7857
+ "flex items-center gap-base p-base rounded-base cursor-pointer transition-colors text-left",
7858
+ "hover:bg-dropdown-item-hover",
7859
+ p.id === condition.propertyId && "bg-dropdown-item-hover"
7860
+ ),
7861
+ children: [
7862
+ /* @__PURE__ */ jsx56(Icon33, { icon: p.icon, size: "sm", className: "shrink-0 text-dropdown-item-icon" }),
7863
+ /* @__PURE__ */ jsx56("span", { className: "text-sm font-regular leading-sm text-dropdown-item-text truncate", children: p.label })
7864
+ ]
7798
7865
  },
7799
- className: cn(
7800
- "flex items-center gap-base p-base rounded-base cursor-pointer transition-colors text-left",
7801
- "hover:bg-dropdown-item-hover",
7802
- p.id === condition.propertyId && "bg-dropdown-item-hover"
7803
- ),
7804
- children: [
7805
- /* @__PURE__ */ jsx56(Icon33, { icon: p.icon, size: "sm", className: "shrink-0 text-dropdown-item-icon" }),
7806
- /* @__PURE__ */ jsx56("span", { className: "text-sm font-regular leading-sm text-dropdown-item-text truncate", children: p.label })
7807
- ]
7808
- },
7809
- p.id
7810
- ))
7866
+ p.id
7867
+ )),
7868
+ unpinnedProperties.map((p) => /* @__PURE__ */ jsxs50(
7869
+ "button",
7870
+ {
7871
+ type: "button",
7872
+ onClick: () => {
7873
+ onPropertyChange(p);
7874
+ setPropertyOpen(false);
7875
+ },
7876
+ className: cn(
7877
+ "flex items-center gap-base p-base rounded-base cursor-pointer transition-colors text-left",
7878
+ "hover:bg-dropdown-item-hover",
7879
+ p.id === condition.propertyId && "bg-dropdown-item-hover"
7880
+ ),
7881
+ children: [
7882
+ /* @__PURE__ */ jsx56(Icon33, { icon: p.icon, size: "sm", className: "shrink-0 text-dropdown-item-icon" }),
7883
+ /* @__PURE__ */ jsx56("span", { className: "text-sm font-regular leading-sm text-dropdown-item-text truncate", children: p.label }),
7884
+ /* @__PURE__ */ jsx56("span", { className: "ml-auto text-xs font-regular leading-xs text-muted-foreground", children: p.groupLabel })
7885
+ ]
7886
+ },
7887
+ p.id
7888
+ ))
7889
+ ]
7811
7890
  }
7812
7891
  ) })
7813
7892
  ] }),
@@ -8690,7 +8769,7 @@ function useFilterBarMode(ref, override, breakpoint = DEFAULT_BREAKPOINT) {
8690
8769
  }
8691
8770
 
8692
8771
  // src/components/ui/filter/filter-system.tsx
8693
- import { Fragment as Fragment5, jsx as jsx60, jsxs as jsxs54 } from "react/jsx-runtime";
8772
+ import { Fragment as Fragment4, jsx as jsx60, jsxs as jsxs54 } from "react/jsx-runtime";
8694
8773
  var FilterSystem = ({
8695
8774
  properties,
8696
8775
  filterState,
@@ -8809,7 +8888,7 @@ var FilterSystem = ({
8809
8888
  iconOnly: isMinimal
8810
8889
  }
8811
8890
  ),
8812
- isMinimal ? /* @__PURE__ */ jsx60(Fragment5, { children: /* @__PURE__ */ jsx60(
8891
+ isMinimal ? /* @__PURE__ */ jsx60(Fragment4, { children: /* @__PURE__ */ jsx60(
8813
8892
  SummaryChip,
8814
8893
  {
8815
8894
  count: totalCount,
@@ -8837,7 +8916,7 @@ var FilterSystem = ({
8837
8916
  }
8838
8917
  ) }) : (
8839
8918
  /* ── DEFAULT MODE ────────────────────────────────────── */
8840
- /* @__PURE__ */ jsxs54(Fragment5, { children: [
8919
+ /* @__PURE__ */ jsxs54(Fragment4, { children: [
8841
8920
  showAdvancedChip && /* @__PURE__ */ jsx60(
8842
8921
  AdvancedPopover,
8843
8922
  {