@flytedan/flytebot-design-system 0.32.0 → 0.34.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.cts CHANGED
@@ -1188,17 +1188,30 @@ type FilterValue<F extends FilterField> = F extends FilterFieldText ? string : F
1188
1188
  interface FilterBarProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "onChange"> {
1189
1189
  /** Every filter a consumer can add. Order here is the order in the "add filter" list. */
1190
1190
  fields: FilterField[];
1191
- /** Straight off useServerTable — a value of undefined/""/false reads as "not set",
1191
+ /** The applied filters, and the single source of truth for them: FilterBar keeps no
1192
+ * copy. Straight off useServerTable — a value of undefined/""/false reads as "not set",
1192
1193
  * same convention that hook already uses for activeFilterCount. multiSelect/range/
1193
- * date values are objects instead (see isFieldSet). */
1194
+ * date values are objects instead (see isFieldSet). Every edit, and every paste that
1195
+ * settles later, is computed from this prop as it stands at that moment; a panel seeds
1196
+ * itself from it when it opens, and follows it if it changes while open. */
1194
1197
  filters: Record<string, unknown>;
1195
1198
  /** Fires on every value edit. Maps 1:1 onto useServerTable's setFilter(id, value).
1196
1199
  * FilterBar only ever calls this with a COMPLETE, valid value for the field — an
1197
- * emptied selection, a one-sided date range, an invalid numeric range or a cleared
1198
- * bound go through onFilterRemove (or nothing) instead. */
1200
+ * emptied selection, a one-sided date range, an invalid numeric range, number text
1201
+ * that isn't a valid value, or a cleared bound go through onFilterRemove (or nothing,
1202
+ * when the filter isn't set) instead.
1203
+ *
1204
+ * FilterBar is a controlled component: apply this to your state synchronously, so the
1205
+ * next render passes the new `filters`. Never apply it inside `startTransition` or
1206
+ * after a delay; React's rule for controlled inputs applies here too. Number fields
1207
+ * emit on every keystroke that leaves them valid, so defer the EXPENSIVE work instead:
1208
+ * debounce the request this triggers, or read the filters through useDeferredValue. A
1209
+ * host that keeps filters in the URL keeps them in memory as the source of truth and
1210
+ * syncs the URL from that. */
1199
1211
  onFilterChange: (key: string, value: unknown) => void;
1200
1212
  /** Fires when a chip's × is clicked, or when an edit leaves a field with no valid
1201
- * value. Maps 1:1 onto useServerTable's clearFilter(id). */
1213
+ * value; never for a key that isn't set in `filters`. Maps 1:1 onto useServerTable's
1214
+ * clearFilter(id). Apply it synchronously, exactly like onFilterChange. */
1202
1215
  onFilterRemove: (key: string) => void;
1203
1216
  /** Which edge the "add filter" popover aligns to. Default "left" — the trigger sits
1204
1217
  * at the end of a left-to-right chip row, so its menu opens under its left edge. */
@@ -1236,6 +1249,11 @@ declare function validateFilterValue(field: FilterField, value: unknown): Filter
1236
1249
  * values, only the transient "which field's popover/input is open right now" UI state
1237
1250
  * (`panel`), the same way SortMenu holds `open` but never sort state itself.
1238
1251
  *
1252
+ * It is a standard controlled component. `filters` is the single source of truth, and
1253
+ * the host applies onFilterChange/onFilterRemove to it synchronously (never inside
1254
+ * `startTransition`, never after a timeout), deferring only the expensive query that the
1255
+ * filters drive, with a debounce or useDeferredValue.
1256
+ *
1239
1257
  * Every floating surface — a field's edit panel and the "add filter" menu — is a real
1240
1258
  * Popover (or Menu-in-a-Popover) from this kit's own actions module: viewport clamping,
1241
1259
  * nested-layer handling, Escape, and focus-return-to-the-chip all come from there, so
package/dist/index.d.ts CHANGED
@@ -1188,17 +1188,30 @@ type FilterValue<F extends FilterField> = F extends FilterFieldText ? string : F
1188
1188
  interface FilterBarProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "onChange"> {
1189
1189
  /** Every filter a consumer can add. Order here is the order in the "add filter" list. */
1190
1190
  fields: FilterField[];
1191
- /** Straight off useServerTable — a value of undefined/""/false reads as "not set",
1191
+ /** The applied filters, and the single source of truth for them: FilterBar keeps no
1192
+ * copy. Straight off useServerTable — a value of undefined/""/false reads as "not set",
1192
1193
  * same convention that hook already uses for activeFilterCount. multiSelect/range/
1193
- * date values are objects instead (see isFieldSet). */
1194
+ * date values are objects instead (see isFieldSet). Every edit, and every paste that
1195
+ * settles later, is computed from this prop as it stands at that moment; a panel seeds
1196
+ * itself from it when it opens, and follows it if it changes while open. */
1194
1197
  filters: Record<string, unknown>;
1195
1198
  /** Fires on every value edit. Maps 1:1 onto useServerTable's setFilter(id, value).
1196
1199
  * FilterBar only ever calls this with a COMPLETE, valid value for the field — an
1197
- * emptied selection, a one-sided date range, an invalid numeric range or a cleared
1198
- * bound go through onFilterRemove (or nothing) instead. */
1200
+ * emptied selection, a one-sided date range, an invalid numeric range, number text
1201
+ * that isn't a valid value, or a cleared bound go through onFilterRemove (or nothing,
1202
+ * when the filter isn't set) instead.
1203
+ *
1204
+ * FilterBar is a controlled component: apply this to your state synchronously, so the
1205
+ * next render passes the new `filters`. Never apply it inside `startTransition` or
1206
+ * after a delay; React's rule for controlled inputs applies here too. Number fields
1207
+ * emit on every keystroke that leaves them valid, so defer the EXPENSIVE work instead:
1208
+ * debounce the request this triggers, or read the filters through useDeferredValue. A
1209
+ * host that keeps filters in the URL keeps them in memory as the source of truth and
1210
+ * syncs the URL from that. */
1199
1211
  onFilterChange: (key: string, value: unknown) => void;
1200
1212
  /** Fires when a chip's × is clicked, or when an edit leaves a field with no valid
1201
- * value. Maps 1:1 onto useServerTable's clearFilter(id). */
1213
+ * value; never for a key that isn't set in `filters`. Maps 1:1 onto useServerTable's
1214
+ * clearFilter(id). Apply it synchronously, exactly like onFilterChange. */
1202
1215
  onFilterRemove: (key: string) => void;
1203
1216
  /** Which edge the "add filter" popover aligns to. Default "left" — the trigger sits
1204
1217
  * at the end of a left-to-right chip row, so its menu opens under its left edge. */
@@ -1236,6 +1249,11 @@ declare function validateFilterValue(field: FilterField, value: unknown): Filter
1236
1249
  * values, only the transient "which field's popover/input is open right now" UI state
1237
1250
  * (`panel`), the same way SortMenu holds `open` but never sort state itself.
1238
1251
  *
1252
+ * It is a standard controlled component. `filters` is the single source of truth, and
1253
+ * the host applies onFilterChange/onFilterRemove to it synchronously (never inside
1254
+ * `startTransition`, never after a timeout), deferring only the expensive query that the
1255
+ * filters drive, with a debounce or useDeferredValue.
1256
+ *
1239
1257
  * Every floating surface — a field's edit panel and the "add filter" menu — is a real
1240
1258
  * Popover (or Menu-in-a-Popover) from this kit's own actions module: viewport clamping,
1241
1259
  * nested-layer handling, Escape, and focus-return-to-the-chip all come from there, so