@upbound/monarch-blocks 0.4.0 → 0.5.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.
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as React from 'react';
2
2
  import { k as CompileResult, t as CelValidationMeta, d as CelFilterCondition, f as CelFilterSchema, V as ValidationIssue, g as CelFilterTree, P as PillActiveSurface, u as CelFilterType, h as CelOperator, v as CelFilterShape, C as CelColumnDefinition, w as CelEmitOn, D as DateCelValue, M as MapKeyCelValue, l as MultiTextCelValue, m as RelativeDurationPreset, c as CelFilterBarProps } from './types-BULiU2qC.js';
3
3
  export { a as CelColumnOption, b as CelConditionValue, e as CelFilterGroup, i as CelRestrictedOptionSelectPayload, j as CheckboxCelValue, R as RadioCelValue, n as isCelFilterCondition, o as isCelFilterGroup, p as isCheckboxCelValue, q as isDateCelValue, r as isMapKeyCelValue, s as isMultiTextCelValue } from './types-BULiU2qC.js';
4
4
 
@@ -198,6 +198,6 @@ declare function readMultiTextCelValue(value: unknown): MultiTextCelValue;
198
198
  declare const RELATIVE_DURATION_PRESET_VALUES: readonly ["24h", "168h", "720h"];
199
199
  declare function isRelativeDurationPreset(value: string): value is RelativeDurationPreset;
200
200
 
201
- declare function CelFilterBar({ tree, onChange, schema, onCompileResultChange, onRestrictedOptionSelect, showClearButton, className, }: CelFilterBarProps): react_jsx_runtime.JSX.Element;
201
+ declare function CelFilterBar({ tree, onChange, schema, onCompileResultChange, onRestrictedOptionSelect, showClearButton, className, }: CelFilterBarProps): React.JSX.Element;
202
202
 
203
203
  export { CelColumnDefinition, CelFilterBar, CelFilterBarProps, CelFilterCondition, CelFilterSchema, CelFilterTree, CelOperator, CompileResult, DateCelValue, MapKeyCelValue, MultiTextCelValue, PillActiveSurface, RELATIVE_DURATION_PRESET_VALUES, RelativeDurationPreset, ValidationIssue, allowsMultipleConditions, appendCondition, applyDisplayRules, applyOperatorChange, calendarDayEndInstant, calendarDayStartInstant, celStringLiteral, compileCelFilterTree, computeIsEmitReady, createCelNodeId, createDefaultCondition, createEmptyCelFilterTree, dateBoundaryForOperator, denormalizeColumnIdWithReservedNames, denormalizeColumnsWithReservedNames, escapeCelString, formatCalendarDateUtc, formatInstantLabel, getAllowedOperators, getColumnEmitOn, getDefaultOperator, getOperatorLabel, getQuantifierLabel, isDateRangeOperator, isDateRelativeOperator, isDateWindowOperator, isEndOfDayTimestamp, isEndOfMinuteTimestamp, isMultiTextColumn, isRealCalendarDay, isRelativeDateCelValue, isRelativeDurationPreset, isStartOfDayTimestamp, mergeContextualIntoCelTree, normalizeColumnsWithReservedNames, parseCalendarDate, readDateCelValue, readMapKeyCelValue, readMultiTextCelValue, readTimeOfDay, removeConditionById, replaceCondition, resolveColumnDefinition, resolveFilterShape, startInstantFromEndOfDay, startInstantFromEndOfMinute, validateCondition, withTimeOfDay };
@@ -1218,6 +1218,7 @@ function CelFilterBar({
1218
1218
  (_a = onCompileResultChangeRef.current) == null ? void 0 : _a.call(onCompileResultChangeRef, __spreadProps(__spreadValues({}, displayResult), { isEmitReady }));
1219
1219
  }, [displayResult, isEmitReady]);
1220
1220
  const conditions = tree.root.children.filter(isCelFilterCondition);
1221
+ const containerRef = React.useRef(null);
1221
1222
  function handleAddFilter(columnId) {
1222
1223
  const condition = createDefaultCondition({ schema, columnId });
1223
1224
  onChange(appendCondition(tree, condition));
@@ -1232,8 +1233,8 @@ function CelFilterBar({
1232
1233
  onChange({ root: __spreadProps(__spreadValues({}, tree.root), { children: [] }) });
1233
1234
  editor.clearSuppress();
1234
1235
  }
1235
- return /* @__PURE__ */ jsxs("div", { "data-slot": "cel-filter-bar", className: cn("flex flex-wrap items-center gap-2", className), children: [
1236
- /* @__PURE__ */ jsx(CelAddFilterButton, { schema, conditions, onSelect: handleAddFilter }),
1236
+ return /* @__PURE__ */ jsxs("div", { "data-slot": "cel-filter-bar", className: cn("flex flex-wrap items-center gap-2", className), ref: containerRef, children: [
1237
+ /* @__PURE__ */ jsx(CelAddFilterButton, { schema, conditions, onSelect: handleAddFilter, container: containerRef }),
1237
1238
  conditions.map((condition) => {
1238
1239
  const columnDef = resolveColumnDefinition(condition, schema);
1239
1240
  if (!columnDef) return null;
@@ -1248,7 +1249,8 @@ function CelFilterBar({
1248
1249
  controller: editor.getController(condition.id),
1249
1250
  issues: displayResult.issues.filter((issue) => issue.nodeId === condition.id),
1250
1251
  onRemove: () => handleRemove(condition.id),
1251
- onRestrictedOptionSelect
1252
+ onRestrictedOptionSelect,
1253
+ container: containerRef
1252
1254
  },
1253
1255
  condition.id
1254
1256
  );
@@ -1259,7 +1261,8 @@ function CelFilterBar({
1259
1261
  function CelAddFilterButton({
1260
1262
  schema,
1261
1263
  conditions,
1262
- onSelect
1264
+ onSelect,
1265
+ container
1263
1266
  }) {
1264
1267
  var _a, _b;
1265
1268
  const usedSingleInstanceColumnIds = new Set(
@@ -1290,7 +1293,7 @@ function CelAddFilterButton({
1290
1293
  /* @__PURE__ */ jsx(Icon, { name: "plus", "data-icon": "inline-start" }),
1291
1294
  "Add filter"
1292
1295
  ] }),
1293
- /* @__PURE__ */ jsxs(ComboboxContent, { align: "start", className: "w-64", children: [
1296
+ /* @__PURE__ */ jsxs(ComboboxContent, { container, align: "start", className: "w-64", children: [
1294
1297
  /* @__PURE__ */ jsx(ComboboxInput, { showTrigger: false, placeholder: "Search filters\u2026" }),
1295
1298
  /* @__PURE__ */ jsx(ComboboxEmpty, { children: "No filters found." }),
1296
1299
  /* @__PURE__ */ jsx(ComboboxList, { children: (group) => /* @__PURE__ */ jsxs(ComboboxGroup, { items: group.items, children: [
@@ -1354,7 +1357,8 @@ function CelFilterPill({
1354
1357
  controller,
1355
1358
  issues,
1356
1359
  onRemove,
1357
- onRestrictedOptionSelect
1360
+ onRestrictedOptionSelect,
1361
+ container
1358
1362
  }) {
1359
1363
  var _a;
1360
1364
  const shape = (_a = resolveFilterShape(condition, schema)) != null ? _a : columnDef.filterType;
@@ -1371,7 +1375,8 @@ function CelFilterPill({
1371
1375
  controller,
1372
1376
  issues,
1373
1377
  onRemove,
1374
- onRestrictedOptionSelect
1378
+ onRestrictedOptionSelect,
1379
+ container
1375
1380
  }
1376
1381
  );
1377
1382
  }
@@ -1386,7 +1391,8 @@ function CelFilterPill({
1386
1391
  controller,
1387
1392
  issues,
1388
1393
  onRemove,
1389
- onRestrictedOptionSelect
1394
+ onRestrictedOptionSelect,
1395
+ container
1390
1396
  }
1391
1397
  );
1392
1398
  }
@@ -1496,7 +1502,8 @@ function CelCheckboxComboboxPill({
1496
1502
  controller,
1497
1503
  issues,
1498
1504
  onRemove,
1499
- onRestrictedOptionSelect
1505
+ onRestrictedOptionSelect,
1506
+ container
1500
1507
  }) {
1501
1508
  var _a;
1502
1509
  const options = (_a = columnDef.options) != null ? _a : [];
@@ -1555,7 +1562,7 @@ function CelCheckboxComboboxPill({
1555
1562
  ),
1556
1563
  /* @__PURE__ */ jsx(Button, { variant: "outline", size: "icon", "aria-label": `Remove ${columnDef.title} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx(Icon, { name: "xmark" }) })
1557
1564
  ] }),
1558
- /* @__PURE__ */ jsxs(ComboboxContent, { className: "min-w-64", collisionAvoidance: { side: "none", align: "shift" }, children: [
1565
+ /* @__PURE__ */ jsxs(ComboboxContent, { container, className: "min-w-64", collisionAvoidance: { side: "none", align: "shift" }, children: [
1559
1566
  /* @__PURE__ */ jsx(ComboboxInput, { showTrigger: false, placeholder: `Search ${columnDef.title.toLowerCase()}\u2026` }),
1560
1567
  selected.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
1561
1568
  /* @__PURE__ */ jsxs(ComboboxSelectedChips, { children: [
@@ -1584,7 +1591,8 @@ function CelRadioComboboxPill({
1584
1591
  controller,
1585
1592
  issues,
1586
1593
  onRemove,
1587
- onRestrictedOptionSelect
1594
+ onRestrictedOptionSelect,
1595
+ container
1588
1596
  }) {
1589
1597
  var _a, _b;
1590
1598
  const options = (_a = columnDef.options) != null ? _a : [];
@@ -1639,7 +1647,7 @@ function CelRadioComboboxPill({
1639
1647
  ),
1640
1648
  /* @__PURE__ */ jsx(Button, { variant: "outline", size: "icon", "aria-label": `Remove ${columnDef.title} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx(Icon, { name: "xmark" }) })
1641
1649
  ] }),
1642
- /* @__PURE__ */ jsxs(ComboboxContent, { className: "min-w-64", collisionAvoidance: { side: "none", align: "shift" }, children: [
1650
+ /* @__PURE__ */ jsxs(ComboboxContent, { container, className: "min-w-64", collisionAvoidance: { side: "none", align: "shift" }, children: [
1643
1651
  /* @__PURE__ */ jsx(ComboboxInput, { showTrigger: false, placeholder: `Search ${columnDef.title.toLowerCase()}\u2026` }),
1644
1652
  /* @__PURE__ */ jsxs(ComboboxEmpty, { children: [
1645
1653
  "No ",