@flytedan/flytebot-design-system 0.66.0 → 0.67.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.cjs CHANGED
@@ -5003,6 +5003,7 @@ function isFieldSet(field, value) {
5003
5003
  switch (field.type) {
5004
5004
  case "text":
5005
5005
  case "select":
5006
+ case "fixed":
5006
5007
  return isSet(value);
5007
5008
  case "multiSelect": {
5008
5009
  const v = value;
@@ -5042,6 +5043,8 @@ function validateFilterValue(field, value) {
5042
5043
  switch (field.type) {
5043
5044
  case "text":
5044
5045
  return typeof value === "string" ? { ok: true } : { ok: false, reason: "Enter text" };
5046
+ case "fixed":
5047
+ return { ok: false, reason: "This filter is set from outside and cannot be edited" };
5045
5048
  case "select":
5046
5049
  return field.options.some((o) => o.value === value) ? { ok: true } : { ok: false, reason: "Pick one of the options" };
5047
5050
  case "multiSelect": {
@@ -5123,6 +5126,8 @@ function chipLabel(field, value) {
5123
5126
  switch (field.type) {
5124
5127
  case "text":
5125
5128
  return String(value ?? "");
5129
+ case "fixed":
5130
+ return field.valueLabel;
5126
5131
  case "select": {
5127
5132
  const chosen = field.options.find((o) => o.value === value);
5128
5133
  return chosen ? chosen.label : String(value ?? "");
@@ -5760,7 +5765,7 @@ function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, align
5760
5765
  target?.focus();
5761
5766
  }
5762
5767
  }, [panel]);
5763
- const addableFields = fields.filter((f) => !isFieldSet(f, filters[f.key]));
5768
+ const addableFields = fields.filter((f) => f.type !== "fixed" && !isFieldSet(f, filters[f.key]));
5764
5769
  const activeCount = activeFilterCount(fields, filters);
5765
5770
  const canAdd = addableFields.length > 0;
5766
5771
  const showCount = showActiveCount && activeCount > 0;
@@ -5854,6 +5859,14 @@ function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, align
5854
5859
  }
5855
5860
  const set = isFieldSet(field, value);
5856
5861
  if (!editing && !set) return null;
5862
+ if (field.type === "fixed") {
5863
+ const fixedText = field.label + ": " + field.valueLabel;
5864
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "fd-filterbar-chip", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "fd-tag fd-filterbar-fixed", role: "group", title: fixedText, "aria-label": fixedText, children: [
5865
+ field.icon ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("i", { className: "ph ph-" + field.icon, "aria-hidden": "true" }) : null,
5866
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "fd-tag-label", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(MiddleEllipsis, { text: field.icon ? field.valueLabel : fixedText }) }),
5867
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: "fd-tag-remove", "aria-label": "Remove " + fixedText, onClick: () => removeField(field), children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("i", { className: "ph ph-x", "aria-hidden": "true" }) })
5868
+ ] }) }, field.key);
5869
+ }
5857
5870
  const chipRef = editing ? editAnchorRef : void 0;
5858
5871
  const toggleOrClose = () => editing ? closeEditing() : startEditing(field.key);
5859
5872
  const remove = () => {
@@ -5987,7 +6000,7 @@ function StatTile(props) {
5987
6000
  ] });
5988
6001
  const classes = (...extra) => ["fd-stat", ...extra, compact3 ? "fd-stat-compact" : "", className].filter(Boolean).join(" ");
5989
6002
  if (rest.onPress) {
5990
- const { onPress, pressed = false, disabled = false, ...buttonRest } = rest;
6003
+ const { onPress, pressed, disabled = false, ...buttonRest } = rest;
5991
6004
  return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", className: classes("fd-stat-pressable"), "aria-pressed": pressed, disabled: disabled || loading, onClick: onPress, ...buttonRest, children: content });
5992
6005
  }
5993
6006
  return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: classes(), ...rest, children: content });