@l3mpire/ui 2.16.3 → 2.17.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 +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.js +134 -122
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +120 -108
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -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) {
|
|
5251
|
+
function formatFilterValue(value, dynamicOptions) {
|
|
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,9 +5267,17 @@ function formatFilterValue(value) {
|
|
|
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
|
-
|
|
5270
|
+
const resolved = resolveDynamic(String(value[0]), dynamicOptions);
|
|
5271
|
+
return resolved;
|
|
5271
5272
|
}
|
|
5272
|
-
return String(value);
|
|
5273
|
+
return resolveDynamic(String(value), dynamicOptions);
|
|
5274
|
+
}
|
|
5275
|
+
function resolveDynamic(raw, dynamicOptions) {
|
|
5276
|
+
if (dynamicOptions) {
|
|
5277
|
+
const match = dynamicOptions.find((o) => o.value === raw);
|
|
5278
|
+
if (match) return match.label;
|
|
5279
|
+
}
|
|
5280
|
+
return raw;
|
|
5273
5281
|
}
|
|
5274
5282
|
function getBadgeCount(value) {
|
|
5275
5283
|
if (Array.isArray(value) && value.length > 1 && typeof value[0] === "string") {
|
|
@@ -5320,6 +5328,23 @@ function updateNodeInTree(nodes, id, updater) {
|
|
|
5320
5328
|
return node;
|
|
5321
5329
|
});
|
|
5322
5330
|
}
|
|
5331
|
+
function toggleGroupLogicInTree(nodes, id) {
|
|
5332
|
+
const idx = nodes.findIndex((n) => n.id === id);
|
|
5333
|
+
if (idx >= 0) {
|
|
5334
|
+
const current = nodes[idx].logicOperator ?? "and";
|
|
5335
|
+
const next = current === "and" ? "or" : "and";
|
|
5336
|
+
return nodes.map(
|
|
5337
|
+
(n, i) => i === 0 ? n : { ...n, logicOperator: next }
|
|
5338
|
+
);
|
|
5339
|
+
}
|
|
5340
|
+
return nodes.map((node) => {
|
|
5341
|
+
if (isFilterGroup(node)) {
|
|
5342
|
+
const updated = toggleGroupLogicInTree(node.children, id);
|
|
5343
|
+
if (updated !== node.children) return { ...node, children: updated };
|
|
5344
|
+
}
|
|
5345
|
+
return node;
|
|
5346
|
+
});
|
|
5347
|
+
}
|
|
5323
5348
|
function removeNodeFromTree(nodes, id) {
|
|
5324
5349
|
const result = [];
|
|
5325
5350
|
for (const node of nodes) {
|
|
@@ -6503,7 +6528,6 @@ var PresetTagsValueInput = ({
|
|
|
6503
6528
|
PresetTagsValueInput.displayName = "PresetTagsValueInput";
|
|
6504
6529
|
|
|
6505
6530
|
// src/components/ui/filter/value-inputs/select-value-input.tsx
|
|
6506
|
-
import { Icon as Icon28 } from "@l3mpire/icons";
|
|
6507
6531
|
import { jsx as jsx47, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
6508
6532
|
var DynamicOptionRow = ({
|
|
6509
6533
|
option,
|
|
@@ -6540,14 +6564,6 @@ var DynamicOptionRow = ({
|
|
|
6540
6564
|
) })
|
|
6541
6565
|
}
|
|
6542
6566
|
),
|
|
6543
|
-
option.icon && /* @__PURE__ */ jsx47(
|
|
6544
|
-
Icon28,
|
|
6545
|
-
{
|
|
6546
|
-
icon: option.icon,
|
|
6547
|
-
size: "sm",
|
|
6548
|
-
className: "shrink-0 mt-[1px] text-[var(--color-interactive-text-primary-dark-default,var(--color-primary))]"
|
|
6549
|
-
}
|
|
6550
|
-
),
|
|
6551
6567
|
/* @__PURE__ */ jsxs42("span", { className: "flex-1 flex flex-col gap-2xs min-w-0", children: [
|
|
6552
6568
|
/* @__PURE__ */ jsx47("span", { className: "text-sm font-regular leading-sm text-[var(--color-foreground)] truncate", children: option.label }),
|
|
6553
6569
|
option.description && /* @__PURE__ */ jsx47("span", { className: "text-xs font-regular leading-xs text-[var(--color-muted-foreground)]", children: option.description })
|
|
@@ -6555,7 +6571,6 @@ var DynamicOptionRow = ({
|
|
|
6555
6571
|
]
|
|
6556
6572
|
}
|
|
6557
6573
|
);
|
|
6558
|
-
var DynamicOptionsDivider = () => /* @__PURE__ */ jsx47("div", { className: "h-px bg-[var(--color-dropdown-border)] mx-xs my-xs" });
|
|
6559
6574
|
var SingleSelectValueInput = ({
|
|
6560
6575
|
value,
|
|
6561
6576
|
onChange,
|
|
@@ -6586,7 +6601,6 @@ var SingleSelectValueInput = ({
|
|
|
6586
6601
|
},
|
|
6587
6602
|
opt.value
|
|
6588
6603
|
)),
|
|
6589
|
-
dynamicOptions && dynamicOptions.length > 0 && options.length > 0 && /* @__PURE__ */ jsx47(DynamicOptionsDivider, {}),
|
|
6590
6604
|
options.map((opt) => /* @__PURE__ */ jsx47(
|
|
6591
6605
|
"button",
|
|
6592
6606
|
{
|
|
@@ -6774,7 +6788,7 @@ ValueInput.displayName = "ValueInput";
|
|
|
6774
6788
|
import * as React44 from "react";
|
|
6775
6789
|
import * as PopoverPrimitive6 from "@radix-ui/react-popover";
|
|
6776
6790
|
import {
|
|
6777
|
-
Icon as
|
|
6791
|
+
Icon as Icon28,
|
|
6778
6792
|
faChevronLeftOutline as faChevronLeftOutline3,
|
|
6779
6793
|
faChevronRightOutline as faChevronRightOutline3,
|
|
6780
6794
|
faMagnifyingGlassOutline,
|
|
@@ -6792,7 +6806,7 @@ var AdvancedFilterFooter = ({ onClick, count }) => /* @__PURE__ */ jsxs44(Fragme
|
|
|
6792
6806
|
className: "flex items-center gap-base p-base rounded-base cursor-pointer transition-colors hover:bg-[var(--color-dropdown-item-hover)]",
|
|
6793
6807
|
children: [
|
|
6794
6808
|
/* @__PURE__ */ jsx50(
|
|
6795
|
-
|
|
6809
|
+
Icon28,
|
|
6796
6810
|
{
|
|
6797
6811
|
icon: faFilterOutline3,
|
|
6798
6812
|
size: "sm",
|
|
@@ -6894,7 +6908,7 @@ var PropertySelector = ({
|
|
|
6894
6908
|
/* @__PURE__ */ jsxs44("div", { className: "flex flex-col gap-xs", children: [
|
|
6895
6909
|
/* @__PURE__ */ jsxs44("div", { className: "flex items-center gap-base px-md py-base border border-[var(--color-input)] rounded-md", children: [
|
|
6896
6910
|
/* @__PURE__ */ jsx50(
|
|
6897
|
-
|
|
6911
|
+
Icon28,
|
|
6898
6912
|
{
|
|
6899
6913
|
icon: faMagnifyingGlassOutline,
|
|
6900
6914
|
size: "sm",
|
|
@@ -6926,7 +6940,7 @@ var PropertySelector = ({
|
|
|
6926
6940
|
className: "flex items-center gap-base p-base rounded-base cursor-pointer transition-colors hover:bg-[var(--color-dropdown-item-hover)]",
|
|
6927
6941
|
children: [
|
|
6928
6942
|
/* @__PURE__ */ jsx50(
|
|
6929
|
-
|
|
6943
|
+
Icon28,
|
|
6930
6944
|
{
|
|
6931
6945
|
icon: prop.icon,
|
|
6932
6946
|
size: "sm",
|
|
@@ -6953,7 +6967,7 @@ var PropertySelector = ({
|
|
|
6953
6967
|
className: "flex items-center gap-base p-base rounded-base cursor-pointer transition-colors hover:bg-[var(--color-dropdown-item-hover)]",
|
|
6954
6968
|
children: [
|
|
6955
6969
|
/* @__PURE__ */ jsx50(
|
|
6956
|
-
|
|
6970
|
+
Icon28,
|
|
6957
6971
|
{
|
|
6958
6972
|
icon: g.groupIcon,
|
|
6959
6973
|
size: "sm",
|
|
@@ -6963,7 +6977,7 @@ var PropertySelector = ({
|
|
|
6963
6977
|
/* @__PURE__ */ jsx50("span", { className: "flex-1 text-sm font-regular leading-sm text-[var(--color-dropdown-item-text)] text-left truncate", children: g.groupLabel }),
|
|
6964
6978
|
/* @__PURE__ */ jsx50("span", { className: "text-xs font-semibold leading-xs text-[var(--color-muted-foreground)]", children: g.count }),
|
|
6965
6979
|
/* @__PURE__ */ jsx50(
|
|
6966
|
-
|
|
6980
|
+
Icon28,
|
|
6967
6981
|
{
|
|
6968
6982
|
icon: faChevronRightOutline3,
|
|
6969
6983
|
size: "xs",
|
|
@@ -6992,7 +7006,7 @@ var PropertySelector = ({
|
|
|
6992
7006
|
className: "flex items-center gap-base p-base rounded-base cursor-pointer transition-colors hover:bg-[var(--color-dropdown-item-hover)]",
|
|
6993
7007
|
children: [
|
|
6994
7008
|
/* @__PURE__ */ jsx50(
|
|
6995
|
-
|
|
7009
|
+
Icon28,
|
|
6996
7010
|
{
|
|
6997
7011
|
icon: faChevronLeftOutline3,
|
|
6998
7012
|
size: "sm",
|
|
@@ -7005,7 +7019,7 @@ var PropertySelector = ({
|
|
|
7005
7019
|
),
|
|
7006
7020
|
/* @__PURE__ */ jsxs44("div", { className: "flex items-center gap-base px-md py-base border border-[var(--color-input)] rounded-md", children: [
|
|
7007
7021
|
/* @__PURE__ */ jsx50(
|
|
7008
|
-
|
|
7022
|
+
Icon28,
|
|
7009
7023
|
{
|
|
7010
7024
|
icon: faMagnifyingGlassOutline,
|
|
7011
7025
|
size: "sm",
|
|
@@ -7036,7 +7050,7 @@ var PropertySelector = ({
|
|
|
7036
7050
|
className: "flex items-center gap-base p-base rounded-base cursor-pointer transition-colors hover:bg-[var(--color-dropdown-item-hover)]",
|
|
7037
7051
|
children: [
|
|
7038
7052
|
/* @__PURE__ */ jsx50(
|
|
7039
|
-
|
|
7053
|
+
Icon28,
|
|
7040
7054
|
{
|
|
7041
7055
|
icon: prop.icon,
|
|
7042
7056
|
size: "sm",
|
|
@@ -7068,7 +7082,7 @@ PropertySelector.displayName = "PropertySelector";
|
|
|
7068
7082
|
|
|
7069
7083
|
// src/components/ui/filter/kebab-menu.tsx
|
|
7070
7084
|
import * as PopoverPrimitive7 from "@radix-ui/react-popover";
|
|
7071
|
-
import { Icon as
|
|
7085
|
+
import { Icon as Icon29, faArrowRightOutline as faArrowRightOutline2, faTrashOutline } from "@l3mpire/icons";
|
|
7072
7086
|
import { jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
7073
7087
|
var KebabMenu = ({
|
|
7074
7088
|
onConvertToAdvanced,
|
|
@@ -7103,7 +7117,7 @@ var KebabMenu = ({
|
|
|
7103
7117
|
className: "flex items-center gap-base p-base rounded-base cursor-pointer transition-colors hover:bg-[var(--color-dropdown-item-hover)]",
|
|
7104
7118
|
children: [
|
|
7105
7119
|
/* @__PURE__ */ jsx51(
|
|
7106
|
-
|
|
7120
|
+
Icon29,
|
|
7107
7121
|
{
|
|
7108
7122
|
icon: faArrowRightOutline2,
|
|
7109
7123
|
size: "sm",
|
|
@@ -7126,7 +7140,7 @@ var KebabMenu = ({
|
|
|
7126
7140
|
className: "flex items-center gap-base p-base rounded-base cursor-pointer transition-colors hover:bg-[var(--color-dropdown-item-hover)]",
|
|
7127
7141
|
children: [
|
|
7128
7142
|
/* @__PURE__ */ jsx51(
|
|
7129
|
-
|
|
7143
|
+
Icon29,
|
|
7130
7144
|
{
|
|
7131
7145
|
icon: faTrashOutline,
|
|
7132
7146
|
size: "sm",
|
|
@@ -7146,7 +7160,7 @@ KebabMenu.displayName = "KebabMenu";
|
|
|
7146
7160
|
// src/components/ui/filter/filter-editor.tsx
|
|
7147
7161
|
import * as React45 from "react";
|
|
7148
7162
|
import * as PopoverPrimitive8 from "@radix-ui/react-popover";
|
|
7149
|
-
import { Icon as
|
|
7163
|
+
import { Icon as Icon30 } from "@l3mpire/icons";
|
|
7150
7164
|
import { jsx as jsx52, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
7151
7165
|
var FilterEditor = ({
|
|
7152
7166
|
propertyDef,
|
|
@@ -7210,7 +7224,7 @@ var FilterEditor = ({
|
|
|
7210
7224
|
children: [
|
|
7211
7225
|
/* @__PURE__ */ jsxs46("div", { className: "flex items-center gap-base px-base pt-base pb-xs border-b border-[var(--color-border)]", children: [
|
|
7212
7226
|
/* @__PURE__ */ jsx52(
|
|
7213
|
-
|
|
7227
|
+
Icon30,
|
|
7214
7228
|
{
|
|
7215
7229
|
icon: propertyDef.icon,
|
|
7216
7230
|
size: "sm",
|
|
@@ -7337,7 +7351,7 @@ var InteractiveFilterChip = ({
|
|
|
7337
7351
|
setValueOpen(false);
|
|
7338
7352
|
};
|
|
7339
7353
|
const hasOperator = !!condition.operator;
|
|
7340
|
-
const displayValue = formatFilterValue(condition.value);
|
|
7354
|
+
const displayValue = formatFilterValue(condition.value, propertyDef.dynamicOptions);
|
|
7341
7355
|
const hasValue = hasOperator && displayValue != null;
|
|
7342
7356
|
const badgeCount = getBadgeCount(condition.value);
|
|
7343
7357
|
return /* @__PURE__ */ jsxs47(
|
|
@@ -7473,11 +7487,11 @@ InteractiveFilterChip.displayName = "InteractiveFilterChip";
|
|
|
7473
7487
|
|
|
7474
7488
|
// src/components/ui/filter/filter-system.tsx
|
|
7475
7489
|
import * as React54 from "react";
|
|
7476
|
-
import { Icon as
|
|
7490
|
+
import { Icon as Icon37, faPlusOutline as faPlusOutline5 } from "@l3mpire/icons";
|
|
7477
7491
|
|
|
7478
7492
|
// src/components/ui/filter/advanced-chip.tsx
|
|
7479
7493
|
import * as React47 from "react";
|
|
7480
|
-
import { Icon as
|
|
7494
|
+
import { Icon as Icon31, faXmarkOutline as faXmarkOutline3, faFilterOutline as faFilterOutline4 } from "@l3mpire/icons";
|
|
7481
7495
|
import { jsx as jsx54, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
7482
7496
|
var btnBase = [
|
|
7483
7497
|
"flex items-center justify-center",
|
|
@@ -7503,7 +7517,7 @@ var AdvancedChip = React47.forwardRef(
|
|
|
7503
7517
|
...props,
|
|
7504
7518
|
children: [
|
|
7505
7519
|
/* @__PURE__ */ jsx54(
|
|
7506
|
-
|
|
7520
|
+
Icon31,
|
|
7507
7521
|
{
|
|
7508
7522
|
icon: faFilterOutline4,
|
|
7509
7523
|
size: "sm",
|
|
@@ -7529,7 +7543,7 @@ var AdvancedChip = React47.forwardRef(
|
|
|
7529
7543
|
"rounded-r-md -ml-px"
|
|
7530
7544
|
),
|
|
7531
7545
|
"aria-label": "Clear all advanced filters",
|
|
7532
|
-
children: /* @__PURE__ */ jsx54(
|
|
7546
|
+
children: /* @__PURE__ */ jsx54(Icon31, { icon: faXmarkOutline3, size: "sm", className: "text-[var(--color-foreground)]" })
|
|
7533
7547
|
}
|
|
7534
7548
|
)
|
|
7535
7549
|
] })
|
|
@@ -7539,18 +7553,18 @@ AdvancedChip.displayName = "AdvancedChip";
|
|
|
7539
7553
|
// src/components/ui/filter/advanced-popover.tsx
|
|
7540
7554
|
import * as React51 from "react";
|
|
7541
7555
|
import * as PopoverPrimitive12 from "@radix-ui/react-popover";
|
|
7542
|
-
import { Icon as
|
|
7556
|
+
import { Icon as Icon35, faPlusOutline as faPlusOutline3, faChevronDownOutline as faChevronDownOutline3, faXmarkOutline as faXmarkOutline4 } from "@l3mpire/icons";
|
|
7543
7557
|
|
|
7544
7558
|
// src/components/ui/filter/advanced-row.tsx
|
|
7545
7559
|
import * as React49 from "react";
|
|
7546
7560
|
import * as PopoverPrimitive11 from "@radix-ui/react-popover";
|
|
7547
|
-
import { Icon as
|
|
7561
|
+
import { Icon as Icon33, faRefreshOutline, faChevronDownOutline as faChevronDownOutline2 } from "@l3mpire/icons";
|
|
7548
7562
|
|
|
7549
7563
|
// src/components/ui/filter/filter-node-actions.tsx
|
|
7550
7564
|
import * as React48 from "react";
|
|
7551
7565
|
import * as PopoverPrimitive10 from "@radix-ui/react-popover";
|
|
7552
7566
|
import {
|
|
7553
|
-
Icon as
|
|
7567
|
+
Icon as Icon32,
|
|
7554
7568
|
faEllipsisOutline as faEllipsisOutline2,
|
|
7555
7569
|
faCopyOutline,
|
|
7556
7570
|
faTrashOutline as faTrashOutline2,
|
|
@@ -7591,7 +7605,7 @@ var FilterNodeActions = ({
|
|
|
7591
7605
|
className: "shrink-0 flex items-center justify-center p-sm rounded-md cursor-pointer transition-colors hover:bg-[var(--color-accent)]",
|
|
7592
7606
|
"aria-label": "More actions",
|
|
7593
7607
|
children: /* @__PURE__ */ jsx55(
|
|
7594
|
-
|
|
7608
|
+
Icon32,
|
|
7595
7609
|
{
|
|
7596
7610
|
icon: faEllipsisOutline2,
|
|
7597
7611
|
size: "sm",
|
|
@@ -7627,7 +7641,7 @@ var FilterNodeActions = ({
|
|
|
7627
7641
|
),
|
|
7628
7642
|
children: [
|
|
7629
7643
|
/* @__PURE__ */ jsx55(
|
|
7630
|
-
|
|
7644
|
+
Icon32,
|
|
7631
7645
|
{
|
|
7632
7646
|
icon: item.icon,
|
|
7633
7647
|
size: "sm",
|
|
@@ -7694,7 +7708,7 @@ var AdvancedRow = ({
|
|
|
7694
7708
|
const handleValueChange = (val) => {
|
|
7695
7709
|
onUpdate({ ...condition, value: val });
|
|
7696
7710
|
};
|
|
7697
|
-
const displayValue = formatFilterValue(condition.value);
|
|
7711
|
+
const displayValue = formatFilterValue(condition.value, propertyDef.dynamicOptions);
|
|
7698
7712
|
const badgeCount = getBadgeCount(condition.value);
|
|
7699
7713
|
const hasValue = displayValue != null;
|
|
7700
7714
|
return /* @__PURE__ */ jsxs50("div", { className: "flex items-center gap-base w-full min-w-0", children: [
|
|
@@ -7713,15 +7727,15 @@ var AdvancedRow = ({
|
|
|
7713
7727
|
),
|
|
7714
7728
|
children: [
|
|
7715
7729
|
connector,
|
|
7716
|
-
/* @__PURE__ */ jsx56(
|
|
7730
|
+
/* @__PURE__ */ jsx56(Icon33, { icon: faRefreshOutline, size: "xs", className: "text-[var(--color-foreground)]" })
|
|
7717
7731
|
]
|
|
7718
7732
|
}
|
|
7719
7733
|
),
|
|
7720
7734
|
/* @__PURE__ */ jsxs50(PopoverPrimitive11.Root, { open: propertyOpen, onOpenChange: setPropertyOpen, children: [
|
|
7721
7735
|
/* @__PURE__ */ jsx56(PopoverPrimitive11.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs50("button", { type: "button", className: cn(selectBtnStyle, "min-w-0"), children: [
|
|
7722
|
-
/* @__PURE__ */ jsx56(
|
|
7736
|
+
/* @__PURE__ */ jsx56(Icon33, { icon: propertyDef.icon, size: "sm", className: "shrink-0 text-[var(--color-muted-foreground)]" }),
|
|
7723
7737
|
/* @__PURE__ */ jsx56("span", { className: "text-sm font-regular leading-sm text-[var(--color-foreground)] whitespace-nowrap truncate", children: propertyDef.label }),
|
|
7724
|
-
/* @__PURE__ */ jsx56(
|
|
7738
|
+
/* @__PURE__ */ jsx56(Icon33, { icon: faChevronDownOutline2, size: "xs", className: "shrink-0 text-[var(--color-foreground)]" })
|
|
7725
7739
|
] }) }),
|
|
7726
7740
|
/* @__PURE__ */ jsx56(PopoverPrimitive11.Portal, { children: /* @__PURE__ */ jsx56(
|
|
7727
7741
|
PopoverPrimitive11.Content,
|
|
@@ -7749,7 +7763,7 @@ var AdvancedRow = ({
|
|
|
7749
7763
|
p.id === condition.propertyId && "bg-[var(--color-dropdown-item-hover)]"
|
|
7750
7764
|
),
|
|
7751
7765
|
children: [
|
|
7752
|
-
/* @__PURE__ */ jsx56(
|
|
7766
|
+
/* @__PURE__ */ jsx56(Icon33, { icon: p.icon, size: "sm", className: "shrink-0 text-[var(--color-dropdown-item-icon)]" }),
|
|
7753
7767
|
/* @__PURE__ */ jsx56("span", { className: "text-sm font-regular leading-sm text-[var(--color-dropdown-item-text)] truncate", children: p.label })
|
|
7754
7768
|
]
|
|
7755
7769
|
},
|
|
@@ -7761,7 +7775,7 @@ var AdvancedRow = ({
|
|
|
7761
7775
|
/* @__PURE__ */ jsxs50(PopoverPrimitive11.Root, { open: operatorOpen, onOpenChange: setOperatorOpen, children: [
|
|
7762
7776
|
/* @__PURE__ */ jsx56(PopoverPrimitive11.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs50("button", { type: "button", className: cn(selectBtnStyle, "min-w-0"), children: [
|
|
7763
7777
|
/* @__PURE__ */ jsx56("span", { className: "text-sm font-regular leading-sm text-[var(--color-foreground)] whitespace-nowrap truncate text-left", children: condition.operator ?? "Select" }),
|
|
7764
|
-
/* @__PURE__ */ jsx56(
|
|
7778
|
+
/* @__PURE__ */ jsx56(Icon33, { icon: faChevronDownOutline2, size: "xs", className: "shrink-0 text-[var(--color-foreground)]" })
|
|
7765
7779
|
] }) }),
|
|
7766
7780
|
/* @__PURE__ */ jsx56(PopoverPrimitive11.Portal, { children: /* @__PURE__ */ jsx56(
|
|
7767
7781
|
PopoverPrimitive11.Content,
|
|
@@ -7812,7 +7826,7 @@ var AdvancedRow = ({
|
|
|
7812
7826
|
badgeCount - 1
|
|
7813
7827
|
] }),
|
|
7814
7828
|
/* @__PURE__ */ jsx56(
|
|
7815
|
-
|
|
7829
|
+
Icon33,
|
|
7816
7830
|
{
|
|
7817
7831
|
icon: faChevronDownOutline2,
|
|
7818
7832
|
size: "xs",
|
|
@@ -7868,7 +7882,7 @@ AdvancedRow.displayName = "AdvancedRow";
|
|
|
7868
7882
|
|
|
7869
7883
|
// src/components/ui/filter/advanced-group.tsx
|
|
7870
7884
|
import * as React50 from "react";
|
|
7871
|
-
import { Icon as
|
|
7885
|
+
import { Icon as Icon34, faRefreshOutline as faRefreshOutline2, faPlusOutline as faPlusOutline2 } from "@l3mpire/icons";
|
|
7872
7886
|
import { jsx as jsx57, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
7873
7887
|
var AdvancedGroup = ({
|
|
7874
7888
|
connector,
|
|
@@ -7897,7 +7911,7 @@ var AdvancedGroup = ({
|
|
|
7897
7911
|
),
|
|
7898
7912
|
children: [
|
|
7899
7913
|
connector,
|
|
7900
|
-
/* @__PURE__ */ jsx57(
|
|
7914
|
+
/* @__PURE__ */ jsx57(Icon34, { icon: faRefreshOutline2, size: "xs", className: "text-[var(--color-foreground)]" })
|
|
7901
7915
|
]
|
|
7902
7916
|
}
|
|
7903
7917
|
) }),
|
|
@@ -7919,7 +7933,7 @@ var AdvancedGroup = ({
|
|
|
7919
7933
|
type: "button",
|
|
7920
7934
|
className: "flex items-center gap-sm px-base py-sm text-sm font-semibold leading-sm text-[var(--color-muted-foreground)] cursor-pointer transition-colors rounded-md hover:bg-[var(--color-accent)] hover:text-[var(--color-foreground)] w-fit",
|
|
7921
7935
|
children: [
|
|
7922
|
-
/* @__PURE__ */ jsx57(
|
|
7936
|
+
/* @__PURE__ */ jsx57(Icon34, { icon: faPlusOutline2, size: "sm" }),
|
|
7923
7937
|
"Add filter"
|
|
7924
7938
|
]
|
|
7925
7939
|
}
|
|
@@ -8031,12 +8045,7 @@ var AdvancedPopover = ({
|
|
|
8031
8045
|
}
|
|
8032
8046
|
};
|
|
8033
8047
|
const toggleLogicOp = (id) => {
|
|
8034
|
-
onFiltersChange(
|
|
8035
|
-
updateNodeInTree(filters, id, (n) => ({
|
|
8036
|
-
...n,
|
|
8037
|
-
logicOperator: (n.logicOperator ?? "and") === "and" ? "or" : "and"
|
|
8038
|
-
}))
|
|
8039
|
-
);
|
|
8048
|
+
onFiltersChange(toggleGroupLogicInTree(filters, id));
|
|
8040
8049
|
};
|
|
8041
8050
|
const handleGroupChildrenChange = (groupId, children2) => {
|
|
8042
8051
|
onFiltersChange(
|
|
@@ -8139,7 +8148,7 @@ var AdvancedPopover = ({
|
|
|
8139
8148
|
open: addSelectorOpen,
|
|
8140
8149
|
onOpenChange: setAddSelectorOpen,
|
|
8141
8150
|
children: /* @__PURE__ */ jsxs52("button", { type: "button", className: cn(ghostBtn, "text-[var(--color-foreground)]"), children: [
|
|
8142
|
-
/* @__PURE__ */ jsx58(
|
|
8151
|
+
/* @__PURE__ */ jsx58(Icon35, { icon: faPlusOutline3, size: "sm", className: "text-[var(--color-foreground)]" }),
|
|
8143
8152
|
"Add filter"
|
|
8144
8153
|
] })
|
|
8145
8154
|
}
|
|
@@ -8151,7 +8160,7 @@ var AdvancedPopover = ({
|
|
|
8151
8160
|
onClick: handleAddGroup,
|
|
8152
8161
|
className: cn(ghostBtn, "text-[var(--color-foreground)]"),
|
|
8153
8162
|
children: [
|
|
8154
|
-
/* @__PURE__ */ jsx58(
|
|
8163
|
+
/* @__PURE__ */ jsx58(Icon35, { icon: faPlusOutline3, size: "sm", className: "text-[var(--color-foreground)]" }),
|
|
8155
8164
|
"Add filters group"
|
|
8156
8165
|
]
|
|
8157
8166
|
}
|
|
@@ -8164,7 +8173,7 @@ var AdvancedPopover = ({
|
|
|
8164
8173
|
onClick: handleClearAll,
|
|
8165
8174
|
className: cn(ghostBtn, "text-[var(--color-destructive,#ef4444)]"),
|
|
8166
8175
|
children: [
|
|
8167
|
-
/* @__PURE__ */ jsx58(
|
|
8176
|
+
/* @__PURE__ */ jsx58(Icon35, { icon: faXmarkOutline4, size: "sm", className: "text-[var(--color-destructive,#ef4444)]" }),
|
|
8168
8177
|
"Clear filters"
|
|
8169
8178
|
]
|
|
8170
8179
|
}
|
|
@@ -8215,7 +8224,7 @@ var DraftRow = ({
|
|
|
8215
8224
|
children: [
|
|
8216
8225
|
/* @__PURE__ */ jsx58("span", { className: "text-sm font-regular leading-sm text-[var(--color-muted-foreground)] whitespace-nowrap", children: "Select property" }),
|
|
8217
8226
|
/* @__PURE__ */ jsx58(
|
|
8218
|
-
|
|
8227
|
+
Icon35,
|
|
8219
8228
|
{
|
|
8220
8229
|
icon: faChevronDownOutline3,
|
|
8221
8230
|
size: "xs",
|
|
@@ -8233,7 +8242,7 @@ var DraftRow = ({
|
|
|
8233
8242
|
// src/components/ui/filter/summary-chip.tsx
|
|
8234
8243
|
import * as React52 from "react";
|
|
8235
8244
|
import * as PopoverPrimitive13 from "@radix-ui/react-popover";
|
|
8236
|
-
import { Icon as
|
|
8245
|
+
import { Icon as Icon36, faFilterOutline as faFilterOutline6, faPlusOutline as faPlusOutline4, faChevronDownOutline as faChevronDownOutline4, faXmarkOutline as faXmarkOutline5 } from "@l3mpire/icons";
|
|
8237
8246
|
import { jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
8238
8247
|
var ghostBtn2 = [
|
|
8239
8248
|
"flex items-center gap-sm px-base py-sm",
|
|
@@ -8328,12 +8337,7 @@ var SummaryChip = ({
|
|
|
8328
8337
|
}
|
|
8329
8338
|
};
|
|
8330
8339
|
const toggleLogicOp = (id) => {
|
|
8331
|
-
onFiltersChange(
|
|
8332
|
-
updateNodeInTree(filters, id, (n) => ({
|
|
8333
|
-
...n,
|
|
8334
|
-
logicOperator: (n.logicOperator ?? "and") === "and" ? "or" : "and"
|
|
8335
|
-
}))
|
|
8336
|
-
);
|
|
8340
|
+
onFiltersChange(toggleGroupLogicInTree(filters, id));
|
|
8337
8341
|
};
|
|
8338
8342
|
const handleGroupChildrenChange = (groupId, newChildren) => {
|
|
8339
8343
|
onFiltersChange(
|
|
@@ -8411,7 +8415,7 @@ var SummaryChip = ({
|
|
|
8411
8415
|
className
|
|
8412
8416
|
),
|
|
8413
8417
|
children: [
|
|
8414
|
-
/* @__PURE__ */ jsx59(
|
|
8418
|
+
/* @__PURE__ */ jsx59(Icon36, { icon: faFilterOutline6, size: "sm", className: "shrink-0 text-[var(--color-foreground)]" }),
|
|
8415
8419
|
/* @__PURE__ */ jsx59("span", { className: "text-sm font-semibold leading-sm whitespace-nowrap text-[var(--color-foreground)]", children: "Filters" }),
|
|
8416
8420
|
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 }) })
|
|
8417
8421
|
]
|
|
@@ -8452,13 +8456,13 @@ var SummaryChip = ({
|
|
|
8452
8456
|
open: addSelectorOpen,
|
|
8453
8457
|
onOpenChange: setAddSelectorOpen,
|
|
8454
8458
|
children: /* @__PURE__ */ jsxs53("button", { type: "button", className: cn(ghostBtn2, "text-[var(--color-foreground)]"), children: [
|
|
8455
|
-
/* @__PURE__ */ jsx59(
|
|
8459
|
+
/* @__PURE__ */ jsx59(Icon36, { icon: faPlusOutline4, size: "sm", className: "text-[var(--color-foreground)]" }),
|
|
8456
8460
|
"Add filter"
|
|
8457
8461
|
] })
|
|
8458
8462
|
}
|
|
8459
8463
|
),
|
|
8460
8464
|
/* @__PURE__ */ jsxs53("button", { type: "button", onClick: handleAddGroup, className: cn(ghostBtn2, "text-[var(--color-foreground)]"), children: [
|
|
8461
|
-
/* @__PURE__ */ jsx59(
|
|
8465
|
+
/* @__PURE__ */ jsx59(Icon36, { icon: faPlusOutline4, size: "sm", className: "text-[var(--color-foreground)]" }),
|
|
8462
8466
|
"Add filters group"
|
|
8463
8467
|
] })
|
|
8464
8468
|
] }),
|
|
@@ -8472,7 +8476,7 @@ var SummaryChip = ({
|
|
|
8472
8476
|
},
|
|
8473
8477
|
className: cn(ghostBtn2, "text-[var(--color-destructive,#ef4444)]"),
|
|
8474
8478
|
children: [
|
|
8475
|
-
/* @__PURE__ */ jsx59(
|
|
8479
|
+
/* @__PURE__ */ jsx59(Icon36, { icon: faXmarkOutline5, size: "sm", className: "text-[var(--color-destructive,#ef4444)]" }),
|
|
8476
8480
|
"Clear filters"
|
|
8477
8481
|
]
|
|
8478
8482
|
}
|
|
@@ -8509,7 +8513,7 @@ var DraftRow2 = ({ properties, onSelect, open: openProp, onOpenChange }) => {
|
|
|
8509
8513
|
),
|
|
8510
8514
|
children: [
|
|
8511
8515
|
/* @__PURE__ */ jsx59("span", { className: "text-sm font-regular leading-sm text-[var(--color-muted-foreground)] whitespace-nowrap", children: "Select property" }),
|
|
8512
|
-
/* @__PURE__ */ jsx59(
|
|
8516
|
+
/* @__PURE__ */ jsx59(Icon36, { icon: faChevronDownOutline4, size: "xs", className: "shrink-0 text-[var(--color-foreground)]" })
|
|
8513
8517
|
]
|
|
8514
8518
|
}
|
|
8515
8519
|
) })
|
|
@@ -8626,7 +8630,8 @@ var FilterSystem = ({
|
|
|
8626
8630
|
};
|
|
8627
8631
|
const getPropertyDef = (propertyId) => properties.find((p) => p.id === propertyId);
|
|
8628
8632
|
const hasAdvanced = filterState.advancedFilters.length > 0;
|
|
8629
|
-
const isMinimal = mode === "minimal";
|
|
8633
|
+
const isMinimal = mode === "minimal" || mode === "icon";
|
|
8634
|
+
const isIconOnly = mode === "icon";
|
|
8630
8635
|
const handleOpenAdvanced = () => {
|
|
8631
8636
|
setPropertySelectorOpen(false);
|
|
8632
8637
|
requestAnimationFrame(() => {
|
|
@@ -8639,7 +8644,6 @@ var FilterSystem = ({
|
|
|
8639
8644
|
};
|
|
8640
8645
|
const advancedFilterCount = filterState.advancedFilters.length;
|
|
8641
8646
|
const showAdvancedChip = hasAdvanced || advancedOpen;
|
|
8642
|
-
const showSummaryChip = totalCount > 0 || summaryOpen;
|
|
8643
8647
|
return /* @__PURE__ */ jsxs54(FilterBar, { ref: containerRef, className, children: [
|
|
8644
8648
|
/* @__PURE__ */ jsxs54(FilterBarLeft, { className: "flex-nowrap flex-1 min-w-0 overflow-x-auto scrollbar-none outline-none [&>*]:shrink-0", children: [
|
|
8645
8649
|
children,
|
|
@@ -8653,38 +8657,32 @@ var FilterSystem = ({
|
|
|
8653
8657
|
iconOnly: isMinimal
|
|
8654
8658
|
}
|
|
8655
8659
|
),
|
|
8656
|
-
isMinimal ? /* @__PURE__ */
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
onAdvancedFilter: handleOpenAdvanced,
|
|
8683
|
-
advancedFilterCount,
|
|
8684
|
-
children: /* @__PURE__ */ jsx60(FilterBarButton, { iconOnly: true })
|
|
8685
|
-
}
|
|
8686
|
-
)
|
|
8687
|
-
] }) : (
|
|
8660
|
+
isMinimal ? /* @__PURE__ */ jsx60(Fragment5, { children: /* @__PURE__ */ jsx60(
|
|
8661
|
+
SummaryChip,
|
|
8662
|
+
{
|
|
8663
|
+
count: totalCount,
|
|
8664
|
+
filters: [...filterState.basicFilters, ...filterState.advancedFilters],
|
|
8665
|
+
properties,
|
|
8666
|
+
onFiltersChange: (nodes) => {
|
|
8667
|
+
onFilterStateChange({
|
|
8668
|
+
...filterState,
|
|
8669
|
+
basicFilters: [],
|
|
8670
|
+
advancedFilters: nodes
|
|
8671
|
+
});
|
|
8672
|
+
},
|
|
8673
|
+
onClearAll: handleClearAll,
|
|
8674
|
+
open: summaryOpen,
|
|
8675
|
+
onOpenChange: setSummaryOpen,
|
|
8676
|
+
children: /* @__PURE__ */ jsx60(
|
|
8677
|
+
FilterBarButton,
|
|
8678
|
+
{
|
|
8679
|
+
iconOnly: isIconOnly,
|
|
8680
|
+
count: totalCount > 0 ? totalCount : void 0,
|
|
8681
|
+
title: buildFilterSummary(filterState.basicFilters, filterState.advancedFilters.length, properties)
|
|
8682
|
+
}
|
|
8683
|
+
)
|
|
8684
|
+
}
|
|
8685
|
+
) }) : (
|
|
8688
8686
|
/* ── DEFAULT MODE ────────────────────────────────────── */
|
|
8689
8687
|
/* @__PURE__ */ jsxs54(Fragment5, { children: [
|
|
8690
8688
|
showAdvancedChip && /* @__PURE__ */ jsx60(
|
|
@@ -8738,20 +8736,20 @@ var FilterSystem = ({
|
|
|
8738
8736
|
{
|
|
8739
8737
|
type: "button",
|
|
8740
8738
|
className: "shrink-0 inline-flex items-center justify-center size-8 rounded-md border border-[var(--color-btn-outlined-neutral-border-default)] bg-gradient-to-t from-[var(--color-btn-outlined-neutral-bg-default)] from-[10%] to-[var(--color-btn-outlined-neutral-bg-gradient-to-default)] shadow-sm cursor-pointer transition-colors hover:from-[var(--color-btn-outlined-neutral-bg-hover)] hover:to-[var(--color-btn-outlined-neutral-bg-gradient-to-hover)]",
|
|
8741
|
-
children: /* @__PURE__ */ jsx60(
|
|
8739
|
+
children: /* @__PURE__ */ jsx60(Icon37, { icon: faPlusOutline5, size: "sm", className: "text-[var(--color-foreground)]" })
|
|
8742
8740
|
}
|
|
8743
8741
|
) : /* @__PURE__ */ jsx60(FilterBarButton, {})
|
|
8744
8742
|
}
|
|
8745
8743
|
)
|
|
8746
8744
|
] })
|
|
8747
8745
|
),
|
|
8748
|
-
totalCount > 0 && /* @__PURE__ */ jsx60(
|
|
8746
|
+
totalCount > 0 && !isIconOnly && /* @__PURE__ */ jsx60(
|
|
8749
8747
|
"button",
|
|
8750
8748
|
{
|
|
8751
8749
|
type: "button",
|
|
8752
8750
|
onClick: handleClearAll,
|
|
8753
|
-
className: "shrink-0 flex items-center gap-sm px-base py-sm min-h-[32px] max-h-[32px] rounded-md cursor-pointer transition-colors hover:bg-
|
|
8754
|
-
children:
|
|
8751
|
+
className: "shrink-0 flex items-center gap-sm px-base py-sm min-h-[32px] max-h-[32px] rounded-md cursor-pointer transition-colors text-btn-ghost-brand-text-default hover:bg-btn-ghost-brand-bg-hover hover:text-btn-ghost-brand-text-hover active:bg-btn-ghost-brand-bg-pressed active:text-btn-ghost-brand-text-pressed",
|
|
8752
|
+
children: /* @__PURE__ */ jsx60("span", { className: "text-sm font-semibold leading-sm", children: "Clear" })
|
|
8755
8753
|
}
|
|
8756
8754
|
)
|
|
8757
8755
|
] }),
|
|
@@ -8759,6 +8757,20 @@ var FilterSystem = ({
|
|
|
8759
8757
|
] });
|
|
8760
8758
|
};
|
|
8761
8759
|
FilterSystem.displayName = "FilterSystem";
|
|
8760
|
+
function buildFilterSummary(filters, advancedCount, properties) {
|
|
8761
|
+
if (filters.length === 0 && advancedCount === 0) return void 0;
|
|
8762
|
+
const lines = [];
|
|
8763
|
+
for (const f of filters) {
|
|
8764
|
+
const prop = properties.find((p) => p.id === f.propertyId);
|
|
8765
|
+
if (!prop) continue;
|
|
8766
|
+
const val = formatFilterValue(f.value, prop.dynamicOptions);
|
|
8767
|
+
lines.push(val ? `${prop.label} ${f.operator} ${val}` : `${prop.label} ${f.operator ?? ""}`);
|
|
8768
|
+
}
|
|
8769
|
+
if (advancedCount > 0) {
|
|
8770
|
+
lines.push(`+ ${advancedCount} advanced filter${advancedCount > 1 ? "s" : ""}`);
|
|
8771
|
+
}
|
|
8772
|
+
return lines.join("\n");
|
|
8773
|
+
}
|
|
8762
8774
|
export {
|
|
8763
8775
|
AdvancedChip,
|
|
8764
8776
|
AdvancedPopover,
|