@upbound/monarch-blocks 0.3.0 → 0.4.1

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
 
@@ -50,6 +50,18 @@ declare function compileCelFilterTree(tree: CelFilterTree, schema: CelFilterSche
50
50
  /** Which end of a day/minute an instant represents. */
51
51
  type DateBoundary = 'start' | 'end';
52
52
  declare function calendarDayStartInstant(instant: string): string;
53
+ /** Derives inclusive end-of-day RFC3339 from a stored start instant. */
54
+ declare function calendarDayEndInstant(startInstant: string): string;
55
+ declare function startInstantFromEndOfDay(endInstant: string): string;
56
+ /** Strips the `:59.999` an inclusive minute bound was expanded with. */
57
+ declare function startInstantFromEndOfMinute(endInstant: string): string;
58
+ declare function isEndOfDayTimestamp(instant: string): boolean;
59
+ declare function isStartOfDayTimestamp(instant: string): boolean;
60
+ /**
61
+ * True for an instant expanded to the end of its minute. End-of-day is also
62
+ * end-of-minute, so callers that distinguish the two must test for day first.
63
+ */
64
+ declare function isEndOfMinuteTimestamp(instant: string): boolean;
53
65
  /**
54
66
  * True when the date portion names a day that exists. `Date` rolls impossible
55
67
  * days over silently — Feb 31 becomes Mar 3 rather than failing — so a
@@ -124,6 +136,8 @@ declare function getDefaultOperator(filterType: CelFilterType): CelOperator;
124
136
  declare function applyOperatorChange(condition: CelFilterCondition, newOperator: CelOperator, shape: CelFilterShape | undefined): CelFilterCondition;
125
137
  /** Maps parsed CEL aliases back to schema column ids when building the filter tree. */
126
138
  declare function denormalizeColumnIdWithReservedNames(columnId: string): string;
139
+ /** Rewrites reserved schema column references in a CEL expression before parsing. */
140
+ declare function normalizeColumnsWithReservedNames(expression: string): string;
127
141
  /** Rewrites CEL aliases back to schema column names for API requests and external consumers. */
128
142
  declare function denormalizeColumnsWithReservedNames(expression: string): string;
129
143
 
@@ -184,6 +198,6 @@ declare function readMultiTextCelValue(value: unknown): MultiTextCelValue;
184
198
  declare const RELATIVE_DURATION_PRESET_VALUES: readonly ["24h", "168h", "720h"];
185
199
  declare function isRelativeDurationPreset(value: string): value is RelativeDurationPreset;
186
200
 
187
- 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;
188
202
 
189
- export { CelColumnDefinition, CelFilterBar, CelFilterBarProps, CelFilterCondition, CelFilterSchema, CelFilterTree, CelOperator, CompileResult, DateCelValue, MapKeyCelValue, MultiTextCelValue, PillActiveSurface, RELATIVE_DURATION_PRESET_VALUES, RelativeDurationPreset, ValidationIssue, allowsMultipleConditions, appendCondition, applyDisplayRules, applyOperatorChange, calendarDayStartInstant, celStringLiteral, compileCelFilterTree, computeIsEmitReady, createCelNodeId, createDefaultCondition, createEmptyCelFilterTree, dateBoundaryForOperator, denormalizeColumnIdWithReservedNames, denormalizeColumnsWithReservedNames, escapeCelString, formatCalendarDateUtc, formatInstantLabel, getAllowedOperators, getColumnEmitOn, getDefaultOperator, getOperatorLabel, getQuantifierLabel, isDateRangeOperator, isDateRelativeOperator, isDateWindowOperator, isMultiTextColumn, isRealCalendarDay, isRelativeDateCelValue, isRelativeDurationPreset, mergeContextualIntoCelTree, parseCalendarDate, readDateCelValue, readMapKeyCelValue, readMultiTextCelValue, readTimeOfDay, removeConditionById, replaceCondition, resolveColumnDefinition, resolveFilterShape, validateCondition, withTimeOfDay };
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 };
@@ -292,6 +292,26 @@ function inclusiveEndInstant(instant, granularity) {
292
292
  const match = CALENDAR_DAY_PATTERN.exec(instant);
293
293
  return match ? `${match[1]}T23:59:59.999Z` : instant;
294
294
  }
295
+ function calendarDayEndInstant(startInstant) {
296
+ return inclusiveEndInstant(startInstant, "day");
297
+ }
298
+ function startInstantFromEndOfDay(endInstant) {
299
+ const match = CALENDAR_DAY_PATTERN.exec(endInstant);
300
+ return match ? `${match[1]}T00:00:00Z` : endInstant;
301
+ }
302
+ function startInstantFromEndOfMinute(endInstant) {
303
+ const match = MINUTE_PATTERN.exec(endInstant);
304
+ return match ? `${match[1]}:00.000Z` : endInstant;
305
+ }
306
+ function isEndOfDayTimestamp(instant) {
307
+ return /T23:59:59(\.\d+)?Z$/.test(instant);
308
+ }
309
+ function isStartOfDayTimestamp(instant) {
310
+ return /T00:00:00(\.0+)?Z$/.test(instant);
311
+ }
312
+ function isEndOfMinuteTimestamp(instant) {
313
+ return /T\d{2}:\d{2}:59(\.\d+)?Z$/.test(instant);
314
+ }
295
315
  function isRealCalendarDay(instant) {
296
316
  const match = /^(\d{4})-(\d{2})-(\d{2})/.exec(instant);
297
317
  if (!match) {
@@ -720,6 +740,15 @@ function denormalizeColumnIdWithReservedNames(columnId) {
720
740
  var _a;
721
741
  return (_a = CEL_IDENTIFIER_TO_COLUMN_ID[columnId]) != null ? _a : columnId;
722
742
  }
743
+ function normalizeColumnsWithReservedNames(expression) {
744
+ return Object.entries(RESERVED_COLUMN_CEL_IDENTIFIERS).reduce(
745
+ (normalized, [columnId, celIdentifier]) => normalized.replace(
746
+ new RegExp(`\\b${escapeRegExp(columnId)}\\b${RESERVED_FIELD_OPERATOR_PATTERN}`, "g"),
747
+ celIdentifier
748
+ ),
749
+ expression
750
+ );
751
+ }
723
752
  function denormalizeColumnsWithReservedNames(expression) {
724
753
  return Object.entries(RESERVED_COLUMN_CEL_IDENTIFIERS).reduce(
725
754
  (denormalized, [columnId, celIdentifier]) => denormalized.replace(
@@ -1817,6 +1846,7 @@ export {
1817
1846
  appendCondition,
1818
1847
  applyDisplayRules,
1819
1848
  applyOperatorChange,
1849
+ calendarDayEndInstant,
1820
1850
  calendarDayStartInstant,
1821
1851
  celStringLiteral,
1822
1852
  compileCelFilterTree,
@@ -1842,13 +1872,17 @@ export {
1842
1872
  isDateRangeOperator,
1843
1873
  isDateRelativeOperator,
1844
1874
  isDateWindowOperator,
1875
+ isEndOfDayTimestamp,
1876
+ isEndOfMinuteTimestamp,
1845
1877
  isMapKeyCelValue,
1846
1878
  isMultiTextCelValue,
1847
1879
  isMultiTextColumn,
1848
1880
  isRealCalendarDay,
1849
1881
  isRelativeDateCelValue,
1850
1882
  isRelativeDurationPreset,
1883
+ isStartOfDayTimestamp,
1851
1884
  mergeContextualIntoCelTree,
1885
+ normalizeColumnsWithReservedNames,
1852
1886
  parseCalendarDate,
1853
1887
  readDateCelValue,
1854
1888
  readMapKeyCelValue,
@@ -1858,6 +1892,8 @@ export {
1858
1892
  replaceCondition,
1859
1893
  resolveColumnDefinition,
1860
1894
  resolveFilterShape,
1895
+ startInstantFromEndOfDay,
1896
+ startInstantFromEndOfMinute,
1861
1897
  validateCondition,
1862
1898
  withTimeOfDay
1863
1899
  };