@flytedan/flytebot-design-system 0.65.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 = () => {
@@ -5967,12 +5980,13 @@ function isZeroDelta(delta) {
5967
5980
  const match = delta.match(/[\d.]+/);
5968
5981
  return match !== null && parseFloat(match[0]) === 0;
5969
5982
  }
5970
- function StatTile({ label, value, sub, delta, invert = false, loading = false, compact: compact3 = false, className = "", ...rest }) {
5983
+ function StatTile(props) {
5984
+ const { label, value, sub, delta, invert = false, loading = false, compact: compact3 = false, className = "", ...rest } = props;
5971
5985
  const isDecrease = delta?.startsWith("-") ?? false;
5972
5986
  const isZero = isZeroDelta(delta);
5973
5987
  const isGood = invert ? isDecrease : !isDecrease;
5974
5988
  const deltaToneClass = isZero ? "fd-stat-delta-neutral" : isGood ? "fd-stat-delta-up" : "fd-stat-delta-down";
5975
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: ["fd-stat", compact3 ? "fd-stat-compact" : "", className].filter(Boolean).join(" "), ...rest, children: [
5989
+ const content = /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
5976
5990
  loading ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "fd-skel fd-skel-text", style: { display: "block", height: compact3 ? 20 : 28, width: "62%" } }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "fd-stat-top", children: [
5977
5991
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "fd-stat-figure", children: value }),
5978
5992
  delta ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "fd-stat-delta " + deltaToneClass, children: [
@@ -5984,6 +5998,12 @@ function StatTile({ label, value, sub, delta, invert = false, loading = false, c
5984
5998
  !loading && sub ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "fd-stat-sub", children: sub }) : null,
5985
5999
  loading ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "fd-skel fd-skel-text", style: { display: "block", height: 10, width: "40%", marginTop: 8 } }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "fd-stat-label", style: { display: "block" }, children: label })
5986
6000
  ] });
6001
+ const classes = (...extra) => ["fd-stat", ...extra, compact3 ? "fd-stat-compact" : "", className].filter(Boolean).join(" ");
6002
+ if (rest.onPress) {
6003
+ const { onPress, pressed, disabled = false, ...buttonRest } = rest;
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 });
6005
+ }
6006
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: classes(), ...rest, children: content });
5987
6007
  }
5988
6008
 
5989
6009
  // src/components/data/CodeBlock.tsx