@l3mpire/ui 2.12.0 → 2.13.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/USAGE.md CHANGED
@@ -956,6 +956,29 @@ import {
956
956
 
957
957
  **Advanced filter shortcut:** the PropertySelector footer shows an "Advanced filter · N rule(s)" item. Clicking it closes the property selector and opens the advanced popover directly in its initial empty state — where the user picks the first property inline via a "Where | [Select property ▾]" draft row. When no advanced filters exist yet, clicking this shortcut makes the AdvancedChip appear with the popover already open; closing without adding a filter removes the chip automatically.
958
958
 
959
+ **Dynamic options ("Me", "Unassigned", …):** enum/tags/relation properties accept a `dynamicOptions` array. Each entry is `{ value, label, description?, icon? }` and is rendered at the top of the SingleSelect / MultiSelect dropdown with a divider separating it from the regular options. The `value` is a sentinel string stored on `FilterCondition.value` — the DS only renders, the consuming app resolves it at query time (e.g. `"__me__"` → `currentUser.id`). This keeps session/business logic out of the DS while still getting a consistent visual treatment.
960
+
961
+ ```tsx
962
+ {
963
+ id: "contact_owner",
964
+ label: "Contact owner",
965
+ type: "enum",
966
+ icon: faUserOutline,
967
+ group: "contact",
968
+ groupLabel: "Contact",
969
+ options: ["Quentin", "Simon", "Philippe"],
970
+ dynamicOptions: [
971
+ {
972
+ value: "__me__",
973
+ label: "Me",
974
+ description: "This value is dynamically applied to the current user",
975
+ icon: faBoltOutline,
976
+ },
977
+ { value: "__deactivated__", label: "All deactivated and removed owners", icon: faBoltOutline },
978
+ ],
979
+ }
980
+ ```
981
+
959
982
  | Utility | Purpose |
960
983
  |---|---|
961
984
  | `OPERATORS_BY_TYPE` | Operators for each DataType |
package/dist/index.d.mts CHANGED
@@ -676,12 +676,28 @@ declare const FilterChip: React.ForwardRefExoticComponent<FilterChipProps & Reac
676
676
  type DataType = "text" | "number" | "date" | "enum" | "tags" | "boolean" | "relation";
677
677
  type TextOperator = "contains" | "does not contain" | "is" | "is not" | "starts with" | "ends with" | "is empty" | "is not empty";
678
678
  type NumberOperator = "=" | "≠" | ">" | "<" | "≥" | "≤" | "is between" | "is empty" | "is not empty";
679
- type DateOperator = "is" | "is before" | "is after" | "is on or before" | "is on or after" | "is between" | "is relative" | "is empty" | "is not empty";
679
+ type DateOperator = "is" | "is before" | "is after" | "is on or before" | "is on or after" | "is between" | "is empty" | "is not empty";
680
680
  type EnumOperator = "is" | "is not" | "is any of" | "is none of" | "is empty" | "is not empty";
681
681
  type TagsOperator = "contains" | "does not contain" | "contains any of" | "contains all of" | "is empty" | "is not empty";
682
682
  type BooleanOperator = "is true" | "is false";
683
683
  type RelationOperator = "is" | "is not" | "is any of" | "is none of" | "is empty" | "is not empty";
684
684
  type OperatorType = TextOperator | NumberOperator | DateOperator | EnumOperator | TagsOperator | BooleanOperator | RelationOperator;
685
+ /**
686
+ * A "smart" / dynamic option shown at the top of a relation or enum selector
687
+ * (e.g. "Me", "My team", "Unassigned"). The value is a sentinel string that
688
+ * the consuming app resolves at query time (e.g. `__me__` → `currentUser.id`).
689
+ *
690
+ * The design system only handles the rendering (icon + label + description +
691
+ * divider above the regular options). Resolving the sentinels is an app
692
+ * concern.
693
+ */
694
+ interface DynamicOption {
695
+ /** Sentinel value stored on FilterCondition.value (e.g. "__me__"). */
696
+ value: string;
697
+ label: string;
698
+ description?: string;
699
+ icon?: _l3mpire_icons.IconDefinition;
700
+ }
685
701
  interface PropertyDefinition {
686
702
  id: string;
687
703
  label: string;
@@ -690,6 +706,12 @@ interface PropertyDefinition {
690
706
  group: string;
691
707
  groupLabel: string;
692
708
  options?: string[];
709
+ /**
710
+ * Dynamic/smart options rendered at the top of the value selector with a
711
+ * divider. Only used for enum, tags, and relation types. The app resolves
712
+ * the sentinel values at query time.
713
+ */
714
+ dynamicOptions?: DynamicOption[];
693
715
  relationConfig?: {
694
716
  entity: string;
695
717
  displayProperty: string;
@@ -814,6 +836,8 @@ interface ValueInputProps {
814
836
  onChange: (value: FilterValue) => void;
815
837
  onSubmit?: () => void;
816
838
  options?: string[];
839
+ /** Dynamic/smart entries rendered at the top with a divider. */
840
+ dynamicOptions?: DynamicOption[];
817
841
  className?: string;
818
842
  }
819
843
  declare const ValueInput: React.FC<ValueInputProps>;
package/dist/index.d.ts CHANGED
@@ -676,12 +676,28 @@ declare const FilterChip: React.ForwardRefExoticComponent<FilterChipProps & Reac
676
676
  type DataType = "text" | "number" | "date" | "enum" | "tags" | "boolean" | "relation";
677
677
  type TextOperator = "contains" | "does not contain" | "is" | "is not" | "starts with" | "ends with" | "is empty" | "is not empty";
678
678
  type NumberOperator = "=" | "≠" | ">" | "<" | "≥" | "≤" | "is between" | "is empty" | "is not empty";
679
- type DateOperator = "is" | "is before" | "is after" | "is on or before" | "is on or after" | "is between" | "is relative" | "is empty" | "is not empty";
679
+ type DateOperator = "is" | "is before" | "is after" | "is on or before" | "is on or after" | "is between" | "is empty" | "is not empty";
680
680
  type EnumOperator = "is" | "is not" | "is any of" | "is none of" | "is empty" | "is not empty";
681
681
  type TagsOperator = "contains" | "does not contain" | "contains any of" | "contains all of" | "is empty" | "is not empty";
682
682
  type BooleanOperator = "is true" | "is false";
683
683
  type RelationOperator = "is" | "is not" | "is any of" | "is none of" | "is empty" | "is not empty";
684
684
  type OperatorType = TextOperator | NumberOperator | DateOperator | EnumOperator | TagsOperator | BooleanOperator | RelationOperator;
685
+ /**
686
+ * A "smart" / dynamic option shown at the top of a relation or enum selector
687
+ * (e.g. "Me", "My team", "Unassigned"). The value is a sentinel string that
688
+ * the consuming app resolves at query time (e.g. `__me__` → `currentUser.id`).
689
+ *
690
+ * The design system only handles the rendering (icon + label + description +
691
+ * divider above the regular options). Resolving the sentinels is an app
692
+ * concern.
693
+ */
694
+ interface DynamicOption {
695
+ /** Sentinel value stored on FilterCondition.value (e.g. "__me__"). */
696
+ value: string;
697
+ label: string;
698
+ description?: string;
699
+ icon?: _l3mpire_icons.IconDefinition;
700
+ }
685
701
  interface PropertyDefinition {
686
702
  id: string;
687
703
  label: string;
@@ -690,6 +706,12 @@ interface PropertyDefinition {
690
706
  group: string;
691
707
  groupLabel: string;
692
708
  options?: string[];
709
+ /**
710
+ * Dynamic/smart options rendered at the top of the value selector with a
711
+ * divider. Only used for enum, tags, and relation types. The app resolves
712
+ * the sentinel values at query time.
713
+ */
714
+ dynamicOptions?: DynamicOption[];
693
715
  relationConfig?: {
694
716
  entity: string;
695
717
  displayProperty: string;
@@ -814,6 +836,8 @@ interface ValueInputProps {
814
836
  onChange: (value: FilterValue) => void;
815
837
  onSubmit?: () => void;
816
838
  options?: string[];
839
+ /** Dynamic/smart entries rendered at the top with a divider. */
840
+ dynamicOptions?: DynamicOption[];
817
841
  className?: string;
818
842
  }
819
843
  declare const ValueInput: React.FC<ValueInputProps>;