@malloydata/malloy-explorer 0.0.269-dev250430234249 → 0.0.271-dev250506000031

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.
@@ -3351,13 +3351,19 @@ function MalloyExplorerProvider({
3351
3351
  topValues
3352
3352
  }) {
3353
3353
  const rootQuery = useQueryBuilder(source, query);
3354
+ const [currentNestView, setCurrentNestView] = React__namespace.useState(null);
3355
+ const [currentNestQueryPanel, setCurrentNestQueryPanel] = React__namespace.useState(null);
3354
3356
  return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, {
3355
3357
  children: /* @__PURE__ */ jsxRuntime.jsx(QueryEditorContext.Provider, {
3356
3358
  value: {
3357
3359
  source,
3358
3360
  rootQuery,
3359
3361
  setQuery,
3360
- topValues
3362
+ topValues,
3363
+ currentNestQueryPanel,
3364
+ onCurrentNestQueryPanelChange: setCurrentNestQueryPanel,
3365
+ currentNestView,
3366
+ onCurrentNestViewChange: setCurrentNestView
3361
3367
  },
3362
3368
  children
3363
3369
  })
@@ -3836,10 +3842,10 @@ function Icon({
3836
3842
  return null;
3837
3843
  }
3838
3844
  return /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {
3839
- ..._stylex.props(styles$M.main, colorVariants$3[color], SMALL_ICONS.includes(name) && styles$M.scaleUp, customStyle)
3845
+ ..._stylex.props(styles$N.main, colorVariants$3[color], SMALL_ICONS.includes(name) && styles$N.scaleUp, customStyle)
3840
3846
  });
3841
3847
  }
3842
- const styles$M = {
3848
+ const styles$N = {
3843
3849
  main: {
3844
3850
  display: "mly1rg5ohu",
3845
3851
  width: "mly1kky2od",
@@ -3912,17 +3918,17 @@ function Badge({
3912
3918
  customStyle
3913
3919
  }) {
3914
3920
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
3915
- ..._stylex.props(styles$L.main, colorVariants$2[color], customStyle),
3921
+ ..._stylex.props(styles$M.main, colorVariants$2[color], customStyle),
3916
3922
  children: [icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, {
3917
3923
  color,
3918
3924
  name: icon
3919
3925
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
3920
- ..._stylex.props(fontStyles.badge, styles$L.label),
3926
+ ..._stylex.props(fontStyles.badge, styles$M.label),
3921
3927
  children: label
3922
3928
  })]
3923
3929
  });
3924
3930
  }
3925
- const styles$L = {
3931
+ const styles$M = {
3926
3932
  main: {
3927
3933
  display: "mly3nfvp2",
3928
3934
  height: "mly1qx5ct2",
@@ -4004,10 +4010,10 @@ function Divider({
4004
4010
  customStyle
4005
4011
  }) {
4006
4012
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
4007
- ..._stylex.props(styles$K.main, orientationVariants[orientation], customStyle)
4013
+ ..._stylex.props(styles$L.main, orientationVariants[orientation], customStyle)
4008
4014
  });
4009
4015
  }
4010
- const styles$K = {
4016
+ const styles$L = {
4011
4017
  main: {
4012
4018
  background: "mly1xnbgy5",
4013
4019
  backgroundAttachment: null,
@@ -4808,19 +4814,12 @@ function Button({
4808
4814
  icon,
4809
4815
  label,
4810
4816
  tooltip,
4811
- onClick,
4812
4817
  isDisabled = false,
4813
4818
  customStyle,
4814
4819
  ...props2
4815
4820
  }) {
4816
4821
  const button = /* @__PURE__ */ jsxRuntime.jsxs("button", {
4817
- ..._stylex.props(styles$J.main, colorVariants$1[variant], sizeVariants$1[size2], customStyle),
4818
- ...onClick && {
4819
- onClick: (e) => {
4820
- e.preventDefault();
4821
- onClick(e);
4822
- }
4823
- },
4822
+ ..._stylex.props(styles$K.main, colorVariants$1[variant], sizeVariants$1[size2], customStyle),
4824
4823
  type: "button",
4825
4824
  disabled: isDisabled,
4826
4825
  ...props2,
@@ -4830,9 +4829,9 @@ function Button({
4830
4829
  },
4831
4830
  children: [icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, {
4832
4831
  name: icon,
4833
- customStyle: styles$J.icon
4832
+ customStyle: styles$K.icon
4834
4833
  }), label && /* @__PURE__ */ jsxRuntime.jsx("div", {
4835
- ..._stylex.props(variant === "primary" ? fontStyles.emphasized : fontStyles.body, styles$J.label),
4834
+ ..._stylex.props(variant === "primary" ? fontStyles.emphasized : fontStyles.body, styles$K.label),
4836
4835
  children: label
4837
4836
  })]
4838
4837
  }), isDisabled && /* @__PURE__ */ jsxRuntime.jsx("div", {
@@ -4859,7 +4858,7 @@ function Button({
4859
4858
  return button;
4860
4859
  }
4861
4860
  }
4862
- const styles$J = {
4861
+ const styles$K = {
4863
4862
  main: {
4864
4863
  display: "mly3nfvp2",
4865
4864
  flexDirection: "mlydt5ytf",
@@ -5110,7 +5109,7 @@ function Token({
5110
5109
  }) {
5111
5110
  const isInteractive = onClick !== void 0 || asButtonTrigger;
5112
5111
  const token2 = /* @__PURE__ */ jsxRuntime.jsxs("div", {
5113
- ..._stylex.props(tokenStyles.main, tokenColorVariants[color], tokenSizeVariants[size2], !isInteractive && styles$I.nonInteractive, customStyle),
5112
+ ..._stylex.props(tokenStyles.main, tokenColorVariants[color], tokenSizeVariants[size2], !isInteractive && styles$J.nonInteractive, customStyle),
5114
5113
  ...dragProps == null ? void 0 : dragProps.attributes,
5115
5114
  ...dragProps == null ? void 0 : dragProps.listeners,
5116
5115
  children: [icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, {
@@ -5147,7 +5146,7 @@ function Token({
5147
5146
  })]
5148
5147
  }) : token2;
5149
5148
  }
5150
- const styles$I = {
5149
+ const styles$J = {
5151
5150
  nonInteractive: {
5152
5151
  cursor: "mlyt0e3qv",
5153
5152
  background: "mly1np9qvj",
@@ -5171,7 +5170,7 @@ function TokenGroup({
5171
5170
  }) {
5172
5171
  const count2 = React__namespace.Children.count(children);
5173
5172
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
5174
- ..._stylex.props(styles$H.main, customStyle),
5173
+ ..._stylex.props(styles$I.main, customStyle),
5175
5174
  children: React__namespace.Children.map(children, (child, index2) => /* @__PURE__ */ React__namespace.cloneElement(child, {
5176
5175
  customStyle: {
5177
5176
  ...child.props.customStyle,
@@ -5182,16 +5181,16 @@ function TokenGroup({
5182
5181
  });
5183
5182
  }
5184
5183
  const getChildStyle = (index2, count2) => {
5185
- if (count2 === 1) return styles$H.onlyChild;
5186
- if (index2 === 0) return styles$H.firstChild;
5187
- if (index2 === count2 - 1) return styles$H.lastChild;
5188
- return styles$H.innerChild;
5184
+ if (count2 === 1) return styles$I.onlyChild;
5185
+ if (index2 === 0) return styles$I.firstChild;
5186
+ if (index2 === count2 - 1) return styles$I.lastChild;
5187
+ return styles$I.innerChild;
5189
5188
  };
5190
5189
  const getTokenColor = (child, groupColor) => {
5191
5190
  const childColor = child.props.color;
5192
5191
  return childColor === void 0 ? groupColor : childColor;
5193
5192
  };
5194
- const styles$H = {
5193
+ const styles$I = {
5195
5194
  main: {
5196
5195
  display: "mlyrvj5dj",
5197
5196
  gridAutoFlow: "mly1mt1orb",
@@ -5263,7 +5262,7 @@ function ErrorIcon({
5263
5262
  },
5264
5263
  children: /* @__PURE__ */ jsxRuntime.jsx(Icon, {
5265
5264
  name: "warning",
5266
- customStyle: styles$G.errorIcon
5265
+ customStyle: styles$H.errorIcon
5267
5266
  })
5268
5267
  })
5269
5268
  }), /* @__PURE__ */ jsxRuntime.jsx(TooltipPortal, {
@@ -5276,7 +5275,7 @@ function ErrorIcon({
5276
5275
  })]
5277
5276
  });
5278
5277
  }
5279
- const styles$G = {
5278
+ const styles$H = {
5280
5279
  errorIcon: {
5281
5280
  color: "mly1e2nbdu",
5282
5281
  $$css: true
@@ -5321,22 +5320,22 @@ function EditableToken({
5321
5320
  className: "mly78zum5 mly6s0dn4"
5322
5321
  },
5323
5322
  children: [/* @__PURE__ */ jsxRuntime.jsxs("div", {
5324
- ..._stylex.props(tokenStyles.main, tokenColorVariants[color], tokenSizeVariants[size2], isFocused && styles$F.focused, !!errorMessage && styles$F.hasError, customStyle),
5323
+ ..._stylex.props(tokenStyles.main, tokenColorVariants[color], tokenSizeVariants[size2], isFocused && styles$G.focused, !!errorMessage && styles$G.hasError, customStyle),
5325
5324
  children: [icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, {
5326
5325
  name: icon,
5327
- customStyle: styles$F.icon
5326
+ customStyle: styles$G.icon
5328
5327
  }), /* @__PURE__ */ jsxRuntime.jsxs("span", {
5329
5328
  ...{
5330
5329
  className: "mlywz0xwf"
5331
5330
  },
5332
5331
  children: [/* @__PURE__ */ jsxRuntime.jsx("span", {
5333
- ..._stylex.props(fontStyles.body, styles$F.placeholder),
5332
+ ..._stylex.props(fontStyles.body, styles$G.placeholder),
5334
5333
  style: {
5335
5334
  whiteSpaceCollapse: "preserve"
5336
5335
  },
5337
5336
  children: value
5338
5337
  }), /* @__PURE__ */ jsxRuntime.jsx("input", {
5339
- ..._stylex.props(styles$F.input, fontStyles.body),
5338
+ ..._stylex.props(styles$G.input, fontStyles.body),
5340
5339
  ref: inputRef,
5341
5340
  pattern: type === "number" ? "^-?[0-9.]*$" : void 0,
5342
5341
  value,
@@ -5361,7 +5360,7 @@ function EditableToken({
5361
5360
  })]
5362
5361
  });
5363
5362
  }
5364
- const styles$F = {
5363
+ const styles$G = {
5365
5364
  focused: {
5366
5365
  background: "mlyotlr4g",
5367
5366
  backgroundAttachment: null,
@@ -7703,12 +7702,12 @@ function TextInput({
7703
7702
  }
7704
7703
  };
7705
7704
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
7706
- ..._stylex.props(styles$E.main, isFocused && styles$E.focused, sizeVariants[size2], customStyle),
7705
+ ..._stylex.props(styles$F.main, isFocused && styles$F.focused, sizeVariants[size2], customStyle),
7707
7706
  children: [icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, {
7708
7707
  name: icon,
7709
7708
  color: "secondary"
7710
7709
  }), /* @__PURE__ */ jsxRuntime.jsx("input", {
7711
- ..._stylex.props(fontStyles.body, styles$E.input),
7710
+ ..._stylex.props(fontStyles.body, styles$F.input),
7712
7711
  value,
7713
7712
  placeholder,
7714
7713
  onChange: handleChange,
@@ -7716,7 +7715,7 @@ function TextInput({
7716
7715
  onBlur: handleBlur,
7717
7716
  onKeyDown
7718
7717
  }), hasClear && /* @__PURE__ */ jsxRuntime.jsx("button", {
7719
- ..._stylex.props(fontStyles.supporting, styles$E.actionButton, value === "" && styles$E.hidden),
7718
+ ..._stylex.props(fontStyles.supporting, styles$F.actionButton, value === "" && styles$F.hidden),
7720
7719
  ref: buttonRef,
7721
7720
  onClick: () => onChange(""),
7722
7721
  tabIndex: 0,
@@ -7724,7 +7723,7 @@ function TextInput({
7724
7723
  })]
7725
7724
  });
7726
7725
  }
7727
- const styles$E = {
7726
+ const styles$F = {
7728
7727
  main: {
7729
7728
  display: "mly78zum5",
7730
7729
  alignItems: "mly6s0dn4",
@@ -7933,7 +7932,7 @@ function SelectorToken({
7933
7932
  onValueChange: handleValueChange,
7934
7933
  required: true,
7935
7934
  children: [/* @__PURE__ */ jsxRuntime.jsxs(Trigger$3, {
7936
- ..._stylex.props(tokenStyles.main, styles$D.selectTrigger, tokenColorVariants[color], tokenSizeVariants[size2], fontStyles.body, tokenStyles.label, customStyle),
7935
+ ..._stylex.props(tokenStyles.main, styles$E.selectTrigger, tokenColorVariants[color], tokenSizeVariants[size2], fontStyles.body, tokenStyles.label, customStyle),
7937
7936
  children: [icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, {
7938
7937
  name: icon,
7939
7938
  customStyle: tokenStyles.icon
@@ -7962,7 +7961,7 @@ function SelectorToken({
7962
7961
  size: "compact",
7963
7962
  icon: "search",
7964
7963
  hasClear: true,
7965
- customStyle: styles$D.searchInput,
7964
+ customStyle: styles$E.searchInput,
7966
7965
  onKeyDown: (event) => {
7967
7966
  const excludedKeys = ["ArrowUp", "ArrowDown"];
7968
7967
  if (!excludedKeys.includes(event.key)) {
@@ -7995,21 +7994,21 @@ function SelectItem({
7995
7994
  ...props2
7996
7995
  }) {
7997
7996
  return /* @__PURE__ */ jsxRuntime.jsxs(Item$1, {
7998
- ..._stylex.props(fontStyles.body, styles$D.selectItem),
7997
+ ..._stylex.props(fontStyles.body, styles$E.selectItem),
7999
7998
  value,
8000
7999
  ...props2,
8001
8000
  children: [value === selectedValue ? /* @__PURE__ */ jsxRuntime.jsx(Icon, {
8002
8001
  name: "radioChecked",
8003
- customStyle: styles$D.radioChecked
8002
+ customStyle: styles$E.radioChecked
8004
8003
  }) : /* @__PURE__ */ jsxRuntime.jsx(Icon, {
8005
8004
  name: "radioUnchecked",
8006
- customStyle: styles$D.radioUnchecked
8005
+ customStyle: styles$E.radioUnchecked
8007
8006
  }), /* @__PURE__ */ jsxRuntime.jsx(ItemText, {
8008
8007
  children
8009
8008
  })]
8010
8009
  });
8011
8010
  }
8012
- const styles$D = {
8011
+ const styles$E = {
8013
8012
  selectTrigger: {
8014
8013
  whiteSpace: "mlyuxw1ft",
8015
8014
  overflow: "mlyb3r6kr",
@@ -8099,7 +8098,7 @@ function Card({
8099
8098
  customStyle
8100
8099
  }) {
8101
8100
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
8102
- ..._stylex.props(styles$C.container, customStyle),
8101
+ ..._stylex.props(styles$D.container, customStyle),
8103
8102
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
8104
8103
  ...{
8105
8104
  className: "mly1717udv"
@@ -8113,7 +8112,7 @@ function Card({
8113
8112
  })]
8114
8113
  });
8115
8114
  }
8116
- const styles$C = {
8115
+ const styles$D = {
8117
8116
  container: {
8118
8117
  display: "mly78zum5",
8119
8118
  flexDirection: "mlydt5ytf",
@@ -8204,10 +8203,10 @@ function CollapsibleListItem({
8204
8203
  className: "mly78zum5 mlydt5ytf mly1iyjqo2 mlyb3r6kr"
8205
8204
  },
8206
8205
  children: [/* @__PURE__ */ jsxRuntime.jsx("span", {
8207
- ..._stylex.props(fontStyles.body, styles$B.label),
8206
+ ..._stylex.props(fontStyles.body, styles$C.label),
8208
8207
  children: label
8209
8208
  }), sublabel && /* @__PURE__ */ jsxRuntime.jsx("span", {
8210
- ..._stylex.props(fontStyles.supporting, styles$B.sublabel),
8209
+ ..._stylex.props(fontStyles.supporting, styles$C.sublabel),
8211
8210
  children: sublabel
8212
8211
  })]
8213
8212
  })]
@@ -8219,7 +8218,7 @@ function CollapsibleListItem({
8219
8218
  })]
8220
8219
  });
8221
8220
  }
8222
- const styles$B = {
8221
+ const styles$C = {
8223
8222
  label: {
8224
8223
  flexGrow: "mly1iyjqo2",
8225
8224
  fontWeight: "mly1xlr1w8",
@@ -19033,7 +19032,7 @@ function Spinner({
19033
19032
  } = SIZES[size2];
19034
19033
  const frameSize = diameter + border * 2;
19035
19034
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
19036
- ..._stylex.props(styles$A.root, customStyle),
19035
+ ..._stylex.props(styles$B.root, customStyle),
19037
19036
  children: /* @__PURE__ */ jsxRuntime.jsx("span", {
19038
19037
  "aria-valuetext": "Loading",
19039
19038
  ...{
@@ -19053,7 +19052,7 @@ function Spinner({
19053
19052
  })
19054
19053
  });
19055
19054
  }
19056
- const styles$A = {
19055
+ const styles$B = {
19057
19056
  root: {
19058
19057
  alignItems: "mly6s0dn4",
19059
19058
  display: "mly3nfvp2",
@@ -23451,7 +23450,7 @@ const Popover = ({
23451
23450
  })
23452
23451
  });
23453
23452
  };
23454
- const styles$z = {
23453
+ const styles$A = {
23455
23454
  wrapper: {
23456
23455
  position: "mly1n2onr6",
23457
23456
  $$css: true
@@ -23503,7 +23502,7 @@ const SelectDropdown = ({
23503
23502
  setOpen(false);
23504
23503
  };
23505
23504
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
23506
- ..._stylex.props(styles$z.wrapper, customStyle),
23505
+ ..._stylex.props(styles$A.wrapper, customStyle),
23507
23506
  children: [/* @__PURE__ */ jsxRuntime.jsxs("button", {
23508
23507
  type: "button",
23509
23508
  autoFocus,
@@ -23571,7 +23570,7 @@ function SelectList({
23571
23570
  const [hoveredIndex, setHoveredIndex] = React.useState(null);
23572
23571
  return /* @__PURE__ */ jsxRuntime.jsx(ScrollableArea, {
23573
23572
  children: /* @__PURE__ */ jsxRuntime.jsx("div", {
23574
- ..._stylex.props(styles$z.selectListDiv, customStyle),
23573
+ ..._stylex.props(styles$A.selectListDiv, customStyle),
23575
23574
  children: options.reduce((result, option2, index2) => {
23576
23575
  const isSelected = value !== void 0 && valueEqual(value, option2.value);
23577
23576
  if (option2.divider) {
@@ -23603,8 +23602,8 @@ function SelectList({
23603
23602
  }), /* @__PURE__ */ jsxRuntime.jsx(Icon, {
23604
23603
  name: "checkmark",
23605
23604
  customStyle: {
23606
- ...styles$z.checkIcon,
23607
- ...isSelected ? styles$z.checkIconSelected : void 0
23605
+ ...styles$A.checkIcon,
23606
+ ...isSelected ? styles$A.checkIconSelected : void 0
23608
23607
  }
23609
23608
  }), /* @__PURE__ */ jsxRuntime.jsx("span", {
23610
23609
  ...{
@@ -23626,17 +23625,18 @@ function DatePicker({
23626
23625
  setValue,
23627
23626
  units,
23628
23627
  maxLevel,
23629
- customStyle
23628
+ customStyle,
23629
+ forwardRef
23630
23630
  }) {
23631
23631
  const [date, setDate] = React.useState(value);
23632
23632
  const calendar2 = getCalendar(date);
23633
23633
  const [pickLevel, setPickLevel] = React.useState(units);
23634
- const yearBucket = Math.floor(hooks(date).year() / 10) * 10;
23634
+ const yearBucket = Math.floor(hooks.utc(date).year() / 10) * 10;
23635
23635
  React.useEffect(() => {
23636
23636
  setDate(value);
23637
23637
  }, [value]);
23638
23638
  const setYear = (year) => {
23639
- const newDate = hooks(date).year(year).toDate();
23639
+ const newDate = hooks.utc(date).year(year).toDate();
23640
23640
  setDate(newDate);
23641
23641
  setValue(newDate);
23642
23642
  };
@@ -23660,12 +23660,12 @@ function DatePicker({
23660
23660
  1: {
23661
23661
  className: "mly1247r65 mlyfvyar9 mlymcgfsh mly36usyh mly78zum5 mly6s0dn4 mlyl56j7k mly8fuzfi mly1v5ugh9 mly1fcty0u mly1ypdohk mly6mezaz mly1sxf85j mlyt89l8w mly1fxp9ov mly6wxqrg mly10bk7bj"
23662
23662
  }
23663
- }[!!(hooks(date).year() === yearBucket + offset2) << 0],
23663
+ }[!!(hooks.utc(date).year() === yearBucket + offset2) << 0],
23664
23664
  children: yearBucket + offset2
23665
23665
  });
23666
23666
  };
23667
23667
  const setMonth2 = (month) => {
23668
- const newDate = hooks(date).month(month).toDate();
23668
+ const newDate = hooks.utc(date).month(month).toDate();
23669
23669
  setDate(newDate);
23670
23670
  setValue(newDate);
23671
23671
  };
@@ -23678,13 +23678,13 @@ function DatePicker({
23678
23678
  setValue(dateOfFirstDayOfWeek);
23679
23679
  };
23680
23680
  const setQuarter = (quarter) => {
23681
- const newDate = hooks(date).quarter(quarter + 1).toDate();
23681
+ const newDate = hooks.utc(date).quarter(quarter + 1).toDate();
23682
23682
  setDate(newDate);
23683
23683
  setValue(newDate);
23684
23684
  };
23685
23685
  const monthButton = (month) => {
23686
23686
  const click = () => setMonth2(month);
23687
- const isSelected = hooks(date).month() === month && hooks(date).year() === hooks(value).year();
23687
+ const isSelected = hooks.utc(date).month() === month && hooks.utc(date).year() === hooks.utc(value).year();
23688
23688
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
23689
23689
  onClick: click,
23690
23690
  ...{
@@ -23700,7 +23700,7 @@ function DatePicker({
23700
23700
  };
23701
23701
  const quarterButton = (quarter) => {
23702
23702
  const click = () => setQuarter(quarter);
23703
- const isSelected = hooks(date).quarter() - 1 === quarter && hooks(date).year() === hooks(value).year();
23703
+ const isSelected = hooks.utc(date).quarter() - 1 === quarter && hooks.utc(date).year() === hooks.utc(value).year();
23704
23704
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
23705
23705
  onClick: click,
23706
23706
  ...{
@@ -23715,7 +23715,8 @@ function DatePicker({
23715
23715
  });
23716
23716
  };
23717
23717
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
23718
- ..._stylex.props(styles$y.outer, customStyle),
23718
+ ..._stylex.props(styles$z.outer, customStyle),
23719
+ ref: forwardRef,
23719
23720
  children: [/* @__PURE__ */ jsxRuntime.jsxs("div", {
23720
23721
  ...{
23721
23722
  className: "mly78zum5 mly1q0g3np mly1qughib mly1nejdyq mlyu06os2"
@@ -23730,13 +23731,13 @@ function DatePicker({
23730
23731
  icon: "chevronLeft",
23731
23732
  onClick: () => {
23732
23733
  if (pickLevel === "day" || pickLevel === "week") {
23733
- setDate(hooks(date).subtract(1, "month").toDate());
23734
+ setDate(hooks.utc(date).subtract(1, "month").toDate());
23734
23735
  } else if (pickLevel === "month" || pickLevel === "quarter") {
23735
- setDate(hooks(date).subtract(1, "year").toDate());
23736
+ setDate(hooks.utc(date).subtract(1, "year").toDate());
23736
23737
  } else if (pickLevel === "year") {
23737
- setDate(hooks(date).subtract(10, "years").toDate());
23738
+ setDate(hooks.utc(date).subtract(10, "years").toDate());
23738
23739
  } else {
23739
- setDay(hooks(date).subtract(1, "days").toDate());
23740
+ setDay(hooks.utc(date).subtract(1, "days").toDate());
23740
23741
  }
23741
23742
  }
23742
23743
  })
@@ -23755,10 +23756,10 @@ function DatePicker({
23755
23756
  setPickLevel(maxLevel);
23756
23757
  }
23757
23758
  },
23758
- children: [(pickLevel === "day" || pickLevel === "week") && hooks(date).format("MMMM YYYY"), (pickLevel === "month" || pickLevel === "quarter") && hooks(date).format("YYYY"), pickLevel === "year" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
23759
+ children: [(pickLevel === "day" || pickLevel === "week") && hooks.utc(date).format("MMMM YYYY"), (pickLevel === "month" || pickLevel === "quarter") && hooks.utc(date).format("YYYY"), pickLevel === "year" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
23759
23760
  children: [yearBucket, "-", yearBucket + 9]
23760
23761
  }), (pickLevel === "hour" || pickLevel === "minute" || pickLevel === "second") && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
23761
- children: hooks(date).format("MMMM D, YYYY")
23762
+ children: hooks.utc(date).format("MMMM D, YYYY")
23762
23763
  })]
23763
23764
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
23764
23765
  ...{
@@ -23770,13 +23771,13 @@ function DatePicker({
23770
23771
  icon: "chevronRight",
23771
23772
  onClick: () => {
23772
23773
  if (pickLevel === "day" || pickLevel === "week") {
23773
- setDate(hooks(date).add(1, "month").toDate());
23774
+ setDate(hooks.utc(date).add(1, "month").toDate());
23774
23775
  } else if (pickLevel === "month" || pickLevel === "quarter") {
23775
- setDate(hooks(date).add(1, "year").toDate());
23776
+ setDate(hooks.utc(date).add(1, "year").toDate());
23776
23777
  } else if (pickLevel === "year") {
23777
- setDate(hooks(date).add(10, "years").toDate());
23778
+ setDate(hooks.utc(date).add(10, "years").toDate());
23778
23779
  } else {
23779
- setDay(hooks(date).add(1, "days").toDate());
23780
+ setDay(hooks.utc(date).add(1, "days").toDate());
23780
23781
  }
23781
23782
  }
23782
23783
  })
@@ -23983,25 +23984,25 @@ function DatePicker({
23983
23984
  },
23984
23985
  children: [/* @__PURE__ */ jsxRuntime.jsx(NumberInput, {
23985
23986
  label: "Hours",
23986
- value: parseInt(hooks(date).format("hh")),
23987
+ value: parseInt(hooks.utc(date).format("hh")),
23987
23988
  setValue: (hour12) => {
23988
- const amPm = hooks(date).hour() >= 12 ? "PM" : "AM";
23989
- const newHour24 = parseInt(hooks(`${hour12} ${amPm}`, ["hh A"]).format("H"));
23990
- setValue(hooks(date).hour(newHour24).toDate());
23989
+ const amPm = hooks.utc(date).hour() >= 12 ? "PM" : "AM";
23990
+ const newHour24 = parseInt(hooks.utc(`${hour12} ${amPm}`, ["hh A"]).format("H"));
23991
+ setValue(hooks.utc(date).hour(newHour24).toDate());
23991
23992
  },
23992
23993
  width: "40px"
23993
23994
  }), (units === "minute" || units === "second") && /* @__PURE__ */ jsxRuntime.jsx(NumberInput, {
23994
23995
  label: "Minutes",
23995
- value: hooks(date).minutes(),
23996
+ value: hooks.utc(date).minutes(),
23996
23997
  setValue: (minute) => {
23997
- setValue(hooks(date).minute(minute).toDate());
23998
+ setValue(hooks.utc(date).minute(minute).toDate());
23998
23999
  },
23999
24000
  width: "40px"
24000
24001
  }), units === "second" && /* @__PURE__ */ jsxRuntime.jsx(NumberInput, {
24001
24002
  label: "Seconds",
24002
- value: hooks(date).seconds(),
24003
+ value: hooks.utc(date).seconds(),
24003
24004
  setValue: (second) => {
24004
- setValue(hooks(date).second(second).toDate());
24005
+ setValue(hooks.utc(date).second(second).toDate());
24005
24006
  },
24006
24007
  width: "40px"
24007
24008
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
@@ -24011,11 +24012,11 @@ function DatePicker({
24011
24012
  flexDirection: "column"
24012
24013
  },
24013
24014
  children: /* @__PURE__ */ jsxRuntime.jsx(SelectDropdown, {
24014
- value: hooks(date).hour() >= 12 ? "PM" : "AM",
24015
+ value: hooks.utc(date).hour() >= 12 ? "PM" : "AM",
24015
24016
  onChange: (amPm) => {
24016
- const hour12 = parseInt(hooks(date).format("h"));
24017
- const newHour24 = parseInt(hooks(`${hour12} ${amPm}`, ["hh A"]).format("H"));
24018
- setValue(hooks(date).hour(newHour24).toDate());
24017
+ const hour12 = parseInt(hooks.utc(date).format("h"));
24018
+ const newHour24 = parseInt(hooks.utc(`${hour12} ${amPm}`, ["hh A"]).format("H"));
24019
+ setValue(hooks.utc(date).hour(newHour24).toDate());
24019
24020
  },
24020
24021
  options: [{
24021
24022
  value: "AM",
@@ -24030,7 +24031,7 @@ function DatePicker({
24030
24031
  })]
24031
24032
  });
24032
24033
  }
24033
- const styles$y = {
24034
+ const styles$z = {
24034
24035
  outer: {
24035
24036
  userSelect: "mly87ps6o",
24036
24037
  fontSize: "mlymhiqyu",
@@ -24039,7 +24040,7 @@ const styles$y = {
24039
24040
  }
24040
24041
  };
24041
24042
  function getCalendar(date) {
24042
- const firstDayOfMonth = hooks(date).date(1);
24043
+ const firstDayOfMonth = hooks.utc(date).date(1);
24043
24044
  const dow = firstDayOfMonth.day();
24044
24045
  const daysInMonth2 = firstDayOfMonth.daysInMonth();
24045
24046
  const daysInPreviousMonth = firstDayOfMonth.clone().subtract(1, "day").daysInMonth();
@@ -24116,7 +24117,7 @@ function Banner({
24116
24117
  className: "mly1q4ynmn mlyh8yej3 mly5yr21d mly78zum5 mlydt5ytf mly1kmqopl mly16zck5j"
24117
24118
  },
24118
24119
  children: [/* @__PURE__ */ jsxRuntime.jsxs("div", {
24119
- ..._stylex.props(styles$x.header, variantColors[variant], children ? styles$x.headerWithContent : null),
24120
+ ..._stylex.props(styles$y.header, variantColors[variant], children ? styles$y.headerWithContent : null),
24120
24121
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
24121
24122
  ...{
24122
24123
  className: "mly1qx5ct2 mly78zum5 mlyl56j7k mly6s0dn4"
@@ -24129,22 +24130,22 @@ function Banner({
24129
24130
  className: "mly78zum5 mlydt5ytf mlyb3r6kr"
24130
24131
  },
24131
24132
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
24132
- ..._stylex.props(styles$x.title, fontStyles.emphasized),
24133
+ ..._stylex.props(styles$y.title, fontStyles.emphasized),
24133
24134
  children: title
24134
24135
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
24135
- ..._stylex.props(styles$x.description, fontStyles.supporting),
24136
+ ..._stylex.props(styles$y.description, fontStyles.supporting),
24136
24137
  children: description
24137
24138
  })]
24138
24139
  })]
24139
24140
  }), children && /* @__PURE__ */ jsxRuntime.jsx("div", {
24140
- ..._stylex.props(styles$x.content, fontStyles.body),
24141
+ ..._stylex.props(styles$y.content, fontStyles.body),
24141
24142
  children: /* @__PURE__ */ jsxRuntime.jsx(ScrollableArea, {
24142
24143
  children
24143
24144
  })
24144
24145
  })]
24145
24146
  });
24146
24147
  }
24147
- const styles$x = {
24148
+ const styles$y = {
24148
24149
  header: {
24149
24150
  borderRadius: "mly1q4ynmn",
24150
24151
  borderStartStartRadius: null,
@@ -24286,14 +24287,14 @@ function AccordionList({
24286
24287
  onExpandedItemChange: handleExpandedItemChange
24287
24288
  },
24288
24289
  children: /* @__PURE__ */ jsxRuntime.jsx("div", {
24289
- ..._stylex.props(styles$w.main, customStyle),
24290
+ ..._stylex.props(styles$x.main, customStyle),
24290
24291
  children: React__namespace.Children.map(children, (child) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
24291
24292
  children: [child, /* @__PURE__ */ jsxRuntime.jsx(Divider, {})]
24292
24293
  }))
24293
24294
  })
24294
24295
  });
24295
24296
  }
24296
- const styles$w = {
24297
+ const styles$x = {
24297
24298
  main: {
24298
24299
  display: "mly78zum5",
24299
24300
  flexDirection: "mlydt5ytf",
@@ -24330,10 +24331,10 @@ function AccordionListItem({
24330
24331
  className: "mly78zum5 mlydt5ytf mlyb3r6kr mly1iyjqo2"
24331
24332
  },
24332
24333
  children: [/* @__PURE__ */ jsxRuntime.jsx("span", {
24333
- ..._stylex.props(fontStyles.body, styles$v.label),
24334
+ ..._stylex.props(fontStyles.body, styles$w.label),
24334
24335
  children: label
24335
24336
  }), sublabel && /* @__PURE__ */ jsxRuntime.jsx("span", {
24336
- ..._stylex.props(fontStyles.supporting, styles$v.sublabel),
24337
+ ..._stylex.props(fontStyles.supporting, styles$w.sublabel),
24337
24338
  children: sublabel
24338
24339
  })]
24339
24340
  }), badge && badge, endIcon && endIcon]
@@ -24345,7 +24346,7 @@ function AccordionListItem({
24345
24346
  })]
24346
24347
  });
24347
24348
  }
24348
- const styles$v = {
24349
+ const styles$w = {
24349
24350
  label: {
24350
24351
  flexGrow: "mly1iyjqo2",
24351
24352
  fontWeight: "mly1xlr1w8",
@@ -25136,40 +25137,6 @@ var MenuArrow = React__namespace.forwardRef(
25136
25137
  MenuArrow.displayName = ARROW_NAME$1;
25137
25138
  var SUB_NAME = "MenuSub";
25138
25139
  var [MenuSubProvider, useMenuSubContext] = createMenuContext(SUB_NAME);
25139
- var MenuSub = (props2) => {
25140
- const { __scopeMenu, children, open = false, onOpenChange } = props2;
25141
- const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu);
25142
- const popperScope = usePopperScope(__scopeMenu);
25143
- const [trigger, setTrigger] = React__namespace.useState(null);
25144
- const [content, setContent] = React__namespace.useState(null);
25145
- const handleOpenChange = useCallbackRef$1(onOpenChange);
25146
- React__namespace.useEffect(() => {
25147
- if (parentMenuContext.open === false) handleOpenChange(false);
25148
- return () => handleOpenChange(false);
25149
- }, [parentMenuContext.open, handleOpenChange]);
25150
- return /* @__PURE__ */ jsxRuntime.jsx(Root2$4, { ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
25151
- MenuProvider,
25152
- {
25153
- scope: __scopeMenu,
25154
- open,
25155
- onOpenChange: handleOpenChange,
25156
- content,
25157
- onContentChange: setContent,
25158
- children: /* @__PURE__ */ jsxRuntime.jsx(
25159
- MenuSubProvider,
25160
- {
25161
- scope: __scopeMenu,
25162
- contentId: useId(),
25163
- triggerId: useId(),
25164
- trigger,
25165
- onTriggerChange: setTrigger,
25166
- children
25167
- }
25168
- )
25169
- }
25170
- ) });
25171
- };
25172
- MenuSub.displayName = SUB_NAME;
25173
25140
  var SUB_TRIGGER_NAME$1 = "MenuSubTrigger";
25174
25141
  var MenuSubTrigger = React__namespace.forwardRef(
25175
25142
  (props2, forwardedRef) => {
@@ -25390,7 +25357,6 @@ var RadioItem = MenuRadioItem;
25390
25357
  var ItemIndicator = MenuItemIndicator;
25391
25358
  var Separator = MenuSeparator;
25392
25359
  var Arrow2 = MenuArrow;
25393
- var Sub = MenuSub;
25394
25360
  var SubTrigger = MenuSubTrigger;
25395
25361
  var SubContent = MenuSubContent;
25396
25362
  var DROPDOWN_MENU_NAME = "DropdownMenu";
@@ -25529,14 +25495,14 @@ var DropdownMenuGroup = React__namespace.forwardRef(
25529
25495
  );
25530
25496
  DropdownMenuGroup.displayName = GROUP_NAME;
25531
25497
  var LABEL_NAME = "DropdownMenuLabel";
25532
- var DropdownMenuLabel$1 = React__namespace.forwardRef(
25498
+ var DropdownMenuLabel = React__namespace.forwardRef(
25533
25499
  (props2, forwardedRef) => {
25534
25500
  const { __scopeDropdownMenu, ...labelProps } = props2;
25535
25501
  const menuScope = useMenuScope(__scopeDropdownMenu);
25536
25502
  return /* @__PURE__ */ jsxRuntime.jsx(Label, { ...menuScope, ...labelProps, ref: forwardedRef });
25537
25503
  }
25538
25504
  );
25539
- DropdownMenuLabel$1.displayName = LABEL_NAME;
25505
+ DropdownMenuLabel.displayName = LABEL_NAME;
25540
25506
  var ITEM_NAME = "DropdownMenuItem";
25541
25507
  var DropdownMenuItem$1 = React__namespace.forwardRef(
25542
25508
  (props2, forwardedRef) => {
@@ -25590,16 +25556,6 @@ var DropdownMenuArrow = React__namespace.forwardRef(
25590
25556
  }
25591
25557
  );
25592
25558
  DropdownMenuArrow.displayName = ARROW_NAME;
25593
- var DropdownMenuSub = (props2) => {
25594
- const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props2;
25595
- const menuScope = useMenuScope(__scopeDropdownMenu);
25596
- const [open = false, setOpen] = useControllableState({
25597
- prop: openProp,
25598
- defaultProp: defaultOpen,
25599
- onChange: onOpenChange
25600
- });
25601
- return /* @__PURE__ */ jsxRuntime.jsx(Sub, { ...menuScope, open, onOpenChange: setOpen, children });
25602
- };
25603
25559
  var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
25604
25560
  var DropdownMenuSubTrigger = React__namespace.forwardRef((props2, forwardedRef) => {
25605
25561
  const { __scopeDropdownMenu, ...subTriggerProps } = props2;
@@ -25636,11 +25592,7 @@ var Root2$1 = DropdownMenu$1;
25636
25592
  var Trigger$1 = DropdownMenuTrigger;
25637
25593
  var Portal2 = DropdownMenuPortal;
25638
25594
  var Content2 = DropdownMenuContent;
25639
- var Label2 = DropdownMenuLabel$1;
25640
25595
  var Item2 = DropdownMenuItem$1;
25641
- var Sub2 = DropdownMenuSub;
25642
- var SubTrigger2 = DropdownMenuSubTrigger;
25643
- var SubContent2 = DropdownMenuSubContent;
25644
25596
  function DropdownMenu({
25645
25597
  trigger,
25646
25598
  tooltip,
@@ -25679,7 +25631,7 @@ function DropdownMenu({
25679
25631
  children: trigger
25680
25632
  }), /* @__PURE__ */ jsxRuntime.jsx(Portal2, {
25681
25633
  children: /* @__PURE__ */ jsxRuntime.jsx(Content2, {
25682
- ..._stylex.props(fontStyles.body, styles$u.content),
25634
+ ..._stylex.props(fontStyles.body, styles$v.content),
25683
25635
  side: "bottom",
25684
25636
  align: "start",
25685
25637
  sideOffset: 4,
@@ -25706,79 +25658,22 @@ function DropdownMenuItem({
25706
25658
  disabled,
25707
25659
  children: [icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, {
25708
25660
  name: icon,
25709
- customStyle: styles$u.icon
25661
+ customStyle: styles$v.icon
25710
25662
  }), /* @__PURE__ */ jsxRuntime.jsxs("div", {
25711
25663
  ...{
25712
25664
  className: "mly78zum5 mlydt5ytf mly1iyjqo2"
25713
25665
  },
25714
25666
  children: [/* @__PURE__ */ jsxRuntime.jsx("span", {
25715
- ..._stylex.props(fontStyles.body, styles$u.label),
25667
+ ..._stylex.props(fontStyles.body, styles$v.label),
25716
25668
  children: label
25717
25669
  }), sublabel && /* @__PURE__ */ jsxRuntime.jsx("span", {
25718
- ..._stylex.props(fontStyles.supporting, styles$u.sublabel),
25670
+ ..._stylex.props(fontStyles.supporting, styles$v.sublabel),
25719
25671
  children: sublabel
25720
25672
  })]
25721
25673
  })]
25722
25674
  });
25723
25675
  }
25724
- function DropdownSubMenuItem({
25725
- icon,
25726
- label,
25727
- sublabel,
25728
- disabled,
25729
- children,
25730
- open,
25731
- onOpenChange
25732
- }) {
25733
- const isControlled = open !== void 0 && onOpenChange !== void 0;
25734
- return /* @__PURE__ */ jsxRuntime.jsxs(Sub2, {
25735
- ...isControlled && {
25736
- open
25737
- },
25738
- children: [/* @__PURE__ */ jsxRuntime.jsxs(SubTrigger2, {
25739
- ...{
25740
- className: "mly78zum5 mly6s0dn4 mlye8ttls mly167g77z mly1kogg8i mly1ypdohk mly1a2a7pz mly1bw6wve mly5ezrf1 mly15rdse5 mly1z060rf mly5deeek mly1jacekv mly7ouyw2 mly7h4d18"
25741
- },
25742
- disabled,
25743
- ...isControlled && {
25744
- onClick: () => onOpenChange(!open)
25745
- },
25746
- children: [icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, {
25747
- name: icon,
25748
- customStyle: styles$u.icon
25749
- }), /* @__PURE__ */ jsxRuntime.jsxs("div", {
25750
- ...{
25751
- className: "mly78zum5 mlydt5ytf mly1iyjqo2"
25752
- },
25753
- children: [/* @__PURE__ */ jsxRuntime.jsx("span", {
25754
- ..._stylex.props(fontStyles.body, styles$u.label),
25755
- children: label
25756
- }), sublabel && /* @__PURE__ */ jsxRuntime.jsx("span", {
25757
- ..._stylex.props(fontStyles.supporting, styles$u.sublabel),
25758
- children: sublabel
25759
- })]
25760
- }), !isControlled && /* @__PURE__ */ jsxRuntime.jsx(Icon, {
25761
- name: "chevronRight",
25762
- customStyle: styles$u.icon
25763
- })]
25764
- }), /* @__PURE__ */ jsxRuntime.jsx(SubContent2, {
25765
- ...{
25766
- className: "mly78zum5 mlydt5ytf mly1q4ynmn mlyotlr4g mly17fq3gk mlyfawy5m"
25767
- },
25768
- sideOffset: 5,
25769
- children: React__namespace.Children.map(children, (child) => child)
25770
- })]
25771
- });
25772
- }
25773
- function DropdownMenuLabel({
25774
- label
25775
- }) {
25776
- return /* @__PURE__ */ jsxRuntime.jsx(Label2, {
25777
- ..._stylex.props(fontStyles.supporting, styles$u.menuLabel),
25778
- children: label
25779
- });
25780
- }
25781
- const styles$u = {
25676
+ const styles$v = {
25782
25677
  content: {
25783
25678
  display: "mly78zum5",
25784
25679
  flexDirection: "mlydt5ytf",
@@ -25814,19 +25709,6 @@ const styles$u = {
25814
25709
  paddingBottom: null,
25815
25710
  $$css: true
25816
25711
  },
25817
- menuLabel: {
25818
- padding: "mlydqdrvq",
25819
- paddingInline: null,
25820
- paddingStart: null,
25821
- paddingLeft: null,
25822
- paddingEnd: null,
25823
- paddingRight: null,
25824
- paddingBlock: null,
25825
- paddingTop: null,
25826
- paddingBottom: null,
25827
- color: "mly9dwj6z",
25828
- $$css: true
25829
- },
25830
25712
  icon: {
25831
25713
  color: "mly1mguc6l",
25832
25714
  $$css: true
@@ -25849,7 +25731,9 @@ function QueryActionBar({
25849
25731
  const {
25850
25732
  rootQuery,
25851
25733
  setQuery,
25852
- source
25734
+ source,
25735
+ onCurrentNestQueryPanelChange,
25736
+ onCurrentNestViewChange
25853
25737
  } = React.useContext(QueryEditorContext);
25854
25738
  const {
25855
25739
  onCollapse
@@ -25861,6 +25745,10 @@ function QueryActionBar({
25861
25745
  runQuery(source, rootQuery.build());
25862
25746
  }
25863
25747
  };
25748
+ const focusMainQueryPanel = () => {
25749
+ onCurrentNestViewChange == null ? void 0 : onCurrentNestViewChange(null);
25750
+ onCurrentNestQueryPanelChange == null ? void 0 : onCurrentNestQueryPanelChange(null);
25751
+ };
25864
25752
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
25865
25753
  ...{
25866
25754
  className: "mly78zum5 mly1qughib mly6s0dn4 mlye8ttls"
@@ -25872,7 +25760,7 @@ function QueryActionBar({
25872
25760
  children: [/* @__PURE__ */ jsxRuntime.jsx(Icon, {
25873
25761
  name: "filterSliders"
25874
25762
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
25875
- ..._stylex.props(fontStyles.largeBody, styles$t.title),
25763
+ ..._stylex.props(fontStyles.largeBody, styles$u.title),
25876
25764
  children: "Query"
25877
25765
  })]
25878
25766
  }), /* @__PURE__ */ jsxRuntime.jsxs("div", {
@@ -25880,7 +25768,10 @@ function QueryActionBar({
25880
25768
  className: "mly78zum5 mly167g77z"
25881
25769
  },
25882
25770
  children: [/* @__PURE__ */ jsxRuntime.jsx(Button, {
25883
- onClick: () => setQuery == null ? void 0 : setQuery(void 0),
25771
+ onClick: () => {
25772
+ focusMainQueryPanel();
25773
+ setQuery == null ? void 0 : setQuery(void 0);
25774
+ },
25884
25775
  isDisabled: !rootQuery || (rootQuery == null ? void 0 : rootQuery.isEmpty()),
25885
25776
  label: "Clear",
25886
25777
  variant: "flat",
@@ -25914,13 +25805,13 @@ function QueryActionBar({
25914
25805
  })]
25915
25806
  });
25916
25807
  }
25917
- const styles$t = {
25808
+ const styles$u = {
25918
25809
  title: {
25919
25810
  fontWeight: "mly1xlr1w8",
25920
25811
  $$css: true
25921
25812
  }
25922
25813
  };
25923
- const styles$s = {
25814
+ const styles$t = {
25924
25815
  labelWithIcon: {
25925
25816
  display: "mly78zum5",
25926
25817
  alignItems: "mly6s0dn4",
@@ -30039,32 +29930,32 @@ function BadgeForField({
30039
29930
  label: "view",
30040
29931
  icon: "view_filled",
30041
29932
  color: "purple",
30042
- customStyle: styles$r.noBackground
29933
+ customStyle: styles$s.noBackground
30043
29934
  });
30044
29935
  } else if (field.kind === "dimension") {
30045
29936
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, {
30046
29937
  label: "dimension",
30047
29938
  icon: fieldToIcon(field),
30048
29939
  color: "cyan",
30049
- customStyle: styles$r.noBackground
29940
+ customStyle: styles$s.noBackground
30050
29941
  });
30051
29942
  } else if (field.kind === "measure") {
30052
29943
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, {
30053
29944
  label: "measure",
30054
29945
  icon: fieldToIcon(field),
30055
29946
  color: "green",
30056
- customStyle: styles$r.noBackground
29947
+ customStyle: styles$s.noBackground
30057
29948
  });
30058
29949
  } else if (field.kind === "join") {
30059
29950
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, {
30060
29951
  label: "join",
30061
29952
  icon: fieldToIcon(field),
30062
29953
  color: "gray",
30063
- customStyle: styles$r.noBackground
29954
+ customStyle: styles$s.noBackground
30064
29955
  });
30065
29956
  }
30066
29957
  }
30067
- const styles$r = {
29958
+ const styles$s = {
30068
29959
  noBackground: {
30069
29960
  backgroundColor: "mlyjbqb8w",
30070
29961
  $$css: true
@@ -30093,7 +29984,7 @@ function Visualization$1({
30093
29984
  onClick: () => setRenderer(viz)
30094
29985
  }));
30095
29986
  const tokens2 = [/* @__PURE__ */ jsxRuntime.jsx(SelectorToken, {
30096
- customStyle: styles$q.first,
29987
+ customStyle: styles$r.first,
30097
29988
  icon: `viz_${currentRenderer}`,
30098
29989
  value: currentRenderer,
30099
29990
  items: vizes,
@@ -30103,7 +29994,7 @@ function Visualization$1({
30103
29994
  children: tokens2
30104
29995
  });
30105
29996
  }
30106
- const styles$q = {
29997
+ const styles$r = {
30107
29998
  first: {
30108
29999
  flexGrow: "mly1iyjqo2",
30109
30000
  justifyContent: "mlylqzeqv",
@@ -30132,7 +30023,7 @@ function ViewAttributeTable({
30132
30023
  }) {
30133
30024
  const dimensions = viewInfo.schema.fields.filter((f2) => f2.kind === "dimension");
30134
30025
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
30135
- ..._stylex.props(styles$p.attributeTableContainer, style),
30026
+ ..._stylex.props(styles$q.attributeTableContainer, style),
30136
30027
  children: /* @__PURE__ */ jsxRuntime.jsx(ScrollableArea, {
30137
30028
  children: /* @__PURE__ */ jsxRuntime.jsx("table", {
30138
30029
  ...{
@@ -30172,9 +30063,9 @@ function ViewAttributeTableRow({
30172
30063
  className: "mlydpxx8g"
30173
30064
  },
30174
30065
  children: [/* @__PURE__ */ jsxRuntime.jsx("td", {
30175
- ..._stylex.props(styles$p.attributeTableKeyCell, fontStyles.supporting),
30066
+ ..._stylex.props(styles$q.attributeTableKeyCell, fontStyles.supporting),
30176
30067
  children: /* @__PURE__ */ jsxRuntime.jsx("div", {
30177
- ..._stylex.props(styles$p.attributeTableKeyCellContent, fontStyles.supporting),
30068
+ ..._stylex.props(styles$q.attributeTableKeyCellContent, fontStyles.supporting),
30178
30069
  children: attribute
30179
30070
  })
30180
30071
  }), /* @__PURE__ */ jsxRuntime.jsx("td", {
@@ -30185,7 +30076,7 @@ function ViewAttributeTableRow({
30185
30076
  })]
30186
30077
  });
30187
30078
  }
30188
- const styles$p = {
30079
+ const styles$q = {
30189
30080
  attributeTableContainer: {
30190
30081
  padding: "mlye8ttls",
30191
30082
  paddingInline: null,
@@ -30333,7 +30224,7 @@ function HoverText({
30333
30224
  asChild: true,
30334
30225
  children: /* @__PURE__ */ jsxRuntime.jsx("div", {
30335
30226
  ref: textRef,
30336
- ..._stylex.props(styles$o.text, fontStyles.supporting),
30227
+ ..._stylex.props(styles$p.text, fontStyles.supporting),
30337
30228
  children: text2
30338
30229
  })
30339
30230
  }), /* @__PURE__ */ jsxRuntime.jsx(Portal$4, {
@@ -30341,7 +30232,7 @@ function HoverText({
30341
30232
  side,
30342
30233
  align,
30343
30234
  children: /* @__PURE__ */ jsxRuntime.jsx("pre", {
30344
- ..._stylex.props(styles$o.hoverText, fontStyles.tooltipText),
30235
+ ..._stylex.props(styles$p.hoverText, fontStyles.tooltipText),
30345
30236
  children: text2
30346
30237
  })
30347
30238
  })
@@ -30350,7 +30241,7 @@ function HoverText({
30350
30241
  })
30351
30242
  });
30352
30243
  }
30353
- const styles$o = {
30244
+ const styles$p = {
30354
30245
  text: {
30355
30246
  overflow: "mlyb3r6kr",
30356
30247
  overflowX: null,
@@ -30403,11 +30294,11 @@ function HoverCard({
30403
30294
  customStyle
30404
30295
  }) {
30405
30296
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
30406
- ..._stylex.props(styles$n.container, fontStyles.body, customStyle),
30297
+ ..._stylex.props(styles$o.container, fontStyles.body, customStyle),
30407
30298
  children
30408
30299
  });
30409
30300
  }
30410
- const styles$n = {
30301
+ const styles$o = {
30411
30302
  container: {
30412
30303
  boxShadow: "mly5n1uv4",
30413
30304
  backgroundColor: "mly12peec7",
@@ -30452,7 +30343,7 @@ function FieldHoverCard({
30452
30343
  details = /* @__PURE__ */ jsxRuntime.jsx(ViewAttributeTable, {
30453
30344
  viewInfo: field,
30454
30345
  isCompact: true,
30455
- style: styles$m.viewAttributeTable
30346
+ style: styles$n.viewAttributeTable
30456
30347
  });
30457
30348
  } else if (field.kind === "dimension") {
30458
30349
  details = /* @__PURE__ */ jsxRuntime.jsx(TopValuesTable, {
@@ -30461,7 +30352,7 @@ function FieldHoverCard({
30461
30352
  });
30462
30353
  }
30463
30354
  return /* @__PURE__ */ jsxRuntime.jsxs(HoverCard, {
30464
- customStyle: styles$m.container,
30355
+ customStyle: styles$n.container,
30465
30356
  children: [/* @__PURE__ */ jsxRuntime.jsxs("div", {
30466
30357
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
30467
30358
  ...{
@@ -30471,10 +30362,10 @@ function FieldHoverCard({
30471
30362
  field
30472
30363
  })
30473
30364
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
30474
- ..._stylex.props(fontStyles.supporting, styles$m.path),
30365
+ ..._stylex.props(fontStyles.supporting, styles$n.path),
30475
30366
  children: pathString
30476
30367
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
30477
- ..._stylex.props(fontStyles.emphasized, styles$m.title),
30368
+ ..._stylex.props(fontStyles.emphasized, styles$n.title),
30478
30369
  children: field.name
30479
30370
  }), description && /* @__PURE__ */ jsxRuntime.jsx(HoverText, {
30480
30371
  text: description
@@ -30484,7 +30375,7 @@ function FieldHoverCard({
30484
30375
  })]
30485
30376
  });
30486
30377
  }
30487
- const styles$m = {
30378
+ const styles$n = {
30488
30379
  container: {
30489
30380
  width: "mlybl57os",
30490
30381
  maxHeight: "mlyq3t0pi",
@@ -30776,10 +30667,10 @@ const PillInput = ({
30776
30667
  commitValue();
30777
30668
  });
30778
30669
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
30779
- ..._stylex.props(fontStyles.body, styles$l.main),
30670
+ ..._stylex.props(fontStyles.body, styles$m.main),
30780
30671
  children: /* @__PURE__ */ jsxRuntime.jsx(ScrollableArea, {
30781
30672
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
30782
- ..._stylex.props(styles$l.content, customStyle),
30673
+ ..._stylex.props(styles$m.content, customStyle),
30783
30674
  onKeyUp,
30784
30675
  onClick: () => {
30785
30676
  var _a2;
@@ -30846,7 +30737,7 @@ const Pill = ({
30846
30737
  onClick,
30847
30738
  tabIndex: 0,
30848
30739
  ref: forwardRef,
30849
- ..._stylex.props(styles$l.pill, colorVariants[color]),
30740
+ ..._stylex.props(styles$m.pill, colorVariants[color]),
30850
30741
  children: [children, /* @__PURE__ */ jsxRuntime.jsx("div", {
30851
30742
  title: "Remove",
30852
30743
  ...{
@@ -30861,7 +30752,7 @@ const Pill = ({
30861
30752
  })]
30862
30753
  });
30863
30754
  };
30864
- const styles$l = {
30755
+ const styles$m = {
30865
30756
  main: {
30866
30757
  borderRadius: "mly12oqio5",
30867
30758
  borderStartStartRadius: null,
@@ -31045,7 +30936,7 @@ function ValueList({
31045
30936
  children: (stringSearchResults == null ? void 0 : stringSearchResults.length) ? stringSearchResults.map((value) => /* @__PURE__ */ jsxRuntime.jsxs("div", {
31046
30937
  role: "menuitem",
31047
30938
  tabIndex: -1,
31048
- ..._stylex.props(addMenuStyles.item, styles$k.valueItem),
30939
+ ..._stylex.props(addMenuStyles.item, styles$l.valueItem),
31049
30940
  onClick: () => onClick(value),
31050
30941
  children: [/* @__PURE__ */ jsxRuntime.jsx(Value, {
31051
30942
  value
@@ -31069,10 +30960,10 @@ function Value({
31069
30960
  label: value.fieldValue ?? "∅",
31070
30961
  icon: "filter",
31071
30962
  color: "purple",
31072
- customStyle: styles$k.token
30963
+ customStyle: styles$l.token
31073
30964
  });
31074
30965
  }
31075
- const styles$k = {
30966
+ const styles$l = {
31076
30967
  valueItem: {
31077
30968
  height: "mly1qx5ct2",
31078
30969
  paddingTop: "mly1y1aw1k",
@@ -31248,7 +31139,7 @@ const StringFilterCore = ({
31248
31139
  setSearchValue("");
31249
31140
  }
31250
31141
  },
31251
- customStyle: styles$j.valueList
31142
+ customStyle: styles$k.valueList
31252
31143
  })
31253
31144
  })]
31254
31145
  }) : currentFilter.operator === "~" ? /* @__PURE__ */ jsxRuntime.jsx(StringEditor, {
@@ -31316,7 +31207,7 @@ function stringFilterChangeType(filter, type) {
31316
31207
  };
31317
31208
  }
31318
31209
  }
31319
- const styles$j = {
31210
+ const styles$k = {
31320
31211
  valueList: {
31321
31212
  maxHeight: "mly3d5gib",
31322
31213
  width: "mly1hfn5x7",
@@ -31600,15 +31491,16 @@ const DateInput = ({
31600
31491
  onFocus,
31601
31492
  onBlur,
31602
31493
  isActive,
31603
- customStyle
31494
+ customStyle,
31495
+ forwardRef
31604
31496
  }) => {
31605
31497
  const format2 = formats[units];
31606
- const [tempValue, setTempValue] = React.useState(hooks(value).format(format2));
31498
+ const [tempValue, setTempValue] = React.useState(hooks.utc(value).format(format2));
31607
31499
  React.useEffect(() => {
31608
- setTempValue(hooks(value).format(format2));
31500
+ setTempValue(hooks.utc(value).format(format2));
31609
31501
  }, [value, format2]);
31610
31502
  return /* @__PURE__ */ jsxRuntime.jsx("input", {
31611
- ..._stylex.props(customStyle, isActive ? styles$i.active : null),
31503
+ ..._stylex.props(customStyle, isActive ? styles$j.active : null),
31612
31504
  type: "text",
31613
31505
  placeholder: placeholder || format2,
31614
31506
  value: tempValue,
@@ -31619,13 +31511,14 @@ const DateInput = ({
31619
31511
  setTempValue(raw2);
31620
31512
  const regex = regexps[units];
31621
31513
  if (raw2.match(regex)) {
31622
- const m = hooks(raw2, format2);
31514
+ const m = hooks.utc(raw2, format2);
31623
31515
  if (m.isValid()) {
31624
31516
  setValue(m.toDate());
31625
31517
  }
31626
31518
  }
31627
31519
  },
31628
- autoFocus
31520
+ autoFocus,
31521
+ ref: forwardRef
31629
31522
  });
31630
31523
  };
31631
31524
  function guessUnits(moment2, isDateTime) {
@@ -31642,7 +31535,7 @@ function guessUnits(moment2, isDateTime) {
31642
31535
  }
31643
31536
  return isDateTime ? "second" : "day";
31644
31537
  }
31645
- const styles$i = {
31538
+ const styles$j = {
31646
31539
  active: {
31647
31540
  backgroundColor: "mly1vzefiq",
31648
31541
  $$css: true
@@ -31655,7 +31548,7 @@ function typeFromFilter(filter) {
31655
31548
  return filter.operator;
31656
31549
  }
31657
31550
  function unitsFromFilter(filter, isDateTime) {
31658
- if (filter.operator === "last" || filter.operator === "next") {
31551
+ if (filter.operator === "last" || filter.operator === "next" || filter.operator === "in_last") {
31659
31552
  return filter.units;
31660
31553
  } else if (filter.operator === "to") {
31661
31554
  return guessUnits(filter.fromMoment, isDateTime);
@@ -31697,11 +31590,14 @@ const DateTimeFilterCore = ({
31697
31590
  value: type,
31698
31591
  onChange: changeType,
31699
31592
  options: [{
31700
- value: "last",
31593
+ value: "in_last",
31701
31594
  label: "last"
31595
+ }, {
31596
+ value: "last",
31597
+ label: "last complete"
31702
31598
  }, {
31703
31599
  value: "next",
31704
- label: "next"
31600
+ label: "next complete"
31705
31601
  }, {
31706
31602
  value: "after",
31707
31603
  label: "after"
@@ -31728,6 +31624,7 @@ const DateTimeFilterCore = ({
31728
31624
  };
31729
31625
  function getTopEditorRow(currentFilter, updateFilter, units, setUnits, maxLevel) {
31730
31626
  switch (currentFilter.operator) {
31627
+ case "in_last":
31731
31628
  case "last":
31732
31629
  case "next":
31733
31630
  return /* @__PURE__ */ jsxRuntime.jsx(NUnitFilter, {
@@ -31973,12 +31870,12 @@ function DoubleDateFilter({
31973
31870
  function createTemporalLiteral(date, units) {
31974
31871
  return {
31975
31872
  moment: "literal",
31976
- literal: hooks(date).format(formats[units])
31873
+ literal: hooks.utc(date).format(formats[units])
31977
31874
  };
31978
31875
  }
31979
31876
  function extractDateFromMoment(momentObj) {
31980
31877
  if (momentObj && momentObj.moment === "literal") {
31981
- return hooks(momentObj.literal).toDate();
31878
+ return hooks.utc(momentObj.literal).toDate();
31982
31879
  }
31983
31880
  return /* @__PURE__ */ new Date();
31984
31881
  }
@@ -31987,6 +31884,7 @@ function dateTimeFilterChangeType(filter, type, units) {
31987
31884
  let fromMoment = createTemporalLiteral(/* @__PURE__ */ new Date(), units);
31988
31885
  let toMoment = createTemporalLiteral(/* @__PURE__ */ new Date(), units);
31989
31886
  switch (filter.operator) {
31887
+ case "in_last":
31990
31888
  case "last":
31991
31889
  case "next":
31992
31890
  n = filter.n;
@@ -32006,6 +31904,7 @@ function dateTimeFilterChangeType(filter, type, units) {
32006
31904
  break;
32007
31905
  }
32008
31906
  switch (type) {
31907
+ case "in_last":
32009
31908
  case "last":
32010
31909
  case "next":
32011
31910
  return {
@@ -32191,12 +32090,17 @@ function FilterPopover({
32191
32090
  setFilter,
32192
32091
  trigger,
32193
32092
  anchor,
32194
- layoutProps
32093
+ layoutProps,
32094
+ onOpenChange
32195
32095
  }) {
32196
32096
  const [open, setOpen] = React.useState(false);
32097
+ const handleOpenChange = (open2) => {
32098
+ setOpen(open2);
32099
+ onOpenChange == null ? void 0 : onOpenChange(open2);
32100
+ };
32197
32101
  return /* @__PURE__ */ jsxRuntime.jsxs(Root2$2, {
32198
32102
  open,
32199
- onOpenChange: setOpen,
32103
+ onOpenChange: handleOpenChange,
32200
32104
  modal: true,
32201
32105
  children: [anchor ? /* @__PURE__ */ jsxRuntime.jsx(Anchor2$1, {
32202
32106
  asChild: true,
@@ -32215,7 +32119,7 @@ function FilterPopover({
32215
32119
  filter,
32216
32120
  path,
32217
32121
  onFilterApply: setFilter,
32218
- onOpenChange: setOpen
32122
+ onOpenChange: handleOpenChange
32219
32123
  })
32220
32124
  })
32221
32125
  })]
@@ -32236,7 +32140,7 @@ function FieldList({
32236
32140
  const groups2 = [];
32237
32141
  const lcSearch = search.toLocaleLowerCase();
32238
32142
  const buildGroups = (types22, path, name, fields2) => {
32239
- const filteredFields = sortFieldInfos(fields2).filter((field) => field.kind !== "join").filter((field) => !isArrayOrRecord(field)).filter((field) => field.name.toLocaleLowerCase().includes(lcSearch) && types22.includes(field.kind)).filter((field) => filter ? filter(view, field, path) : true);
32143
+ const filteredFields = sortFieldInfos(fields2).filter((field) => field.kind !== "join").filter((field) => field.name.toLocaleLowerCase().includes(lcSearch) && types22.includes(field.kind)).filter((field) => filter ? filter(view, field, path) : true);
32240
32144
  const joins = fields2.filter((field) => field.kind === "join");
32241
32145
  const arraysAndRecords = fields2.filter(isArrayOrRecord);
32242
32146
  if (filteredFields.length) {
@@ -32276,7 +32180,7 @@ function FieldList({
32276
32180
  ..._stylex.props(customStyle),
32277
32181
  children: groups.length ? groups.map((group) => /* @__PURE__ */ jsxRuntime.jsxs("div", {
32278
32182
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
32279
- ..._stylex.props(addMenuStyles.item, styles$h.fieldItem),
32183
+ ..._stylex.props(addMenuStyles.item, styles$i.fieldItem),
32280
32184
  "data-disabled": "true",
32281
32185
  children: group.name
32282
32186
  }), group.fields.map((field) => isFilterOperation && (field.kind === "dimension" || field.kind === "measure") ? /* @__PURE__ */ jsxRuntime.jsx(FilterPopover, {
@@ -32286,7 +32190,7 @@ function FieldList({
32286
32190
  anchor: /* @__PURE__ */ jsxRuntime.jsx("div", {
32287
32191
  role: "menuitem",
32288
32192
  tabIndex: -1,
32289
- ..._stylex.props(addMenuStyles.item, styles$h.fieldItem),
32193
+ ..._stylex.props(addMenuStyles.item, styles$i.fieldItem),
32290
32194
  children: /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, {
32291
32195
  asChild: true,
32292
32196
  children: /* @__PURE__ */ jsxRuntime.jsx(FieldToken, {
@@ -32313,7 +32217,7 @@ function FieldList({
32313
32217
  }, group.name + ":" + field.name) : /* @__PURE__ */ jsxRuntime.jsx("div", {
32314
32218
  role: "menuitem",
32315
32219
  tabIndex: -1,
32316
- ..._stylex.props(addMenuStyles.item, styles$h.fieldItem),
32220
+ ..._stylex.props(addMenuStyles.item, styles$i.fieldItem),
32317
32221
  children: /* @__PURE__ */ jsxRuntime.jsx(FieldToken, {
32318
32222
  field,
32319
32223
  onClick: () => onAddOperation(field, group.path),
@@ -32336,7 +32240,7 @@ function FieldList({
32336
32240
  })
32337
32241
  });
32338
32242
  }
32339
- const styles$h = {
32243
+ const styles$i = {
32340
32244
  fieldItem: {
32341
32245
  height: "mly1qx5ct2",
32342
32246
  paddingTop: "mly1y1aw1k",
@@ -32354,7 +32258,7 @@ function FieldMenu({
32354
32258
  }) {
32355
32259
  const [search, setSearch] = React.useState("");
32356
32260
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
32357
- ..._stylex.props(addMenuStyles.content, styles$g.content),
32261
+ ..._stylex.props(addMenuStyles.content, styles$h.content),
32358
32262
  role: "menu",
32359
32263
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
32360
32264
  ..._stylex.props(addMenuStyles.item),
@@ -32380,7 +32284,7 @@ function FieldMenu({
32380
32284
  })]
32381
32285
  });
32382
32286
  }
32383
- const styles$g = {
32287
+ const styles$h = {
32384
32288
  content: {
32385
32289
  maxHeight: "mly3d5gib",
32386
32290
  $$css: true
@@ -32395,14 +32299,12 @@ function segmentHasOrderBy(segment, name) {
32395
32299
  function segmentNestNo(segment, name) {
32396
32300
  return segment.operations.items.reduce((acc, operation) => {
32397
32301
  if (operation instanceof QB.ASTNestViewOperation) {
32398
- if (name) {
32302
+ {
32399
32303
  if (operation.name === name) {
32400
32304
  do {
32401
32305
  acc += 1;
32402
32306
  } while (segment.hasFieldNamed(`${name} ${acc}`));
32403
32307
  }
32404
- } else {
32405
- return acc + 1;
32406
32308
  }
32407
32309
  }
32408
32310
  return acc;
@@ -32466,7 +32368,7 @@ function OperationActionTitle({
32466
32368
  return !(segment == null ? void 0 : segment.hasField(field.name, path)) && isNotAnnotatedFilteredField(field);
32467
32369
  };
32468
32370
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
32469
- ..._stylex.props(styles$s.title, hoverStyles.main),
32371
+ ..._stylex.props(styles$t.title, hoverStyles.main),
32470
32372
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
32471
32373
  children: title
32472
32374
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
@@ -33036,7 +32938,7 @@ function SortableOperations({
33036
32938
  fields,
33037
32939
  ...props2
33038
32940
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
33039
- ..._stylex.props(styles$s.tokenContainer),
32941
+ ..._stylex.props(styles$t.tokenContainer),
33040
32942
  children: /* @__PURE__ */ jsxRuntime.jsx(DndContext, {
33041
32943
  sensors,
33042
32944
  collisionDetection: closestCenter,
@@ -33186,10 +33088,10 @@ function FilterOperations({
33186
33088
  }
33187
33089
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
33188
33090
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
33189
- ..._stylex.props(styles$s.title),
33091
+ ..._stylex.props(styles$t.title),
33190
33092
  children: "filter by"
33191
33093
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
33192
- ..._stylex.props(styles$s.tokenContainer),
33094
+ ..._stylex.props(styles$t.tokenContainer),
33193
33095
  children: filters.map((filterOperation, key2) => {
33194
33096
  return /* @__PURE__ */ jsxRuntime.jsx(ErrorElement, {
33195
33097
  fallback: /* @__PURE__ */ jsxRuntime.jsxs("div", {
@@ -33396,7 +33298,7 @@ const parsedToLabels = (parsed, filterString) => {
33396
33298
  const {
33397
33299
  not
33398
33300
  } = temporalClause;
33399
- op = `is${not ? " not" : ""} last`;
33301
+ op = `is${not ? " not" : ""} last complete`;
33400
33302
  value = temporalClause.n + " " + temporalClause.units;
33401
33303
  }
33402
33304
  break;
@@ -33405,7 +33307,7 @@ const parsedToLabels = (parsed, filterString) => {
33405
33307
  const {
33406
33308
  not
33407
33309
  } = temporalClause;
33408
- op = `is${not ? " not" : ""} nest`;
33310
+ op = `is${not ? " not" : ""} next complete`;
33409
33311
  value = temporalClause.n + " " + temporalClause.units;
33410
33312
  }
33411
33313
  break;
@@ -33453,7 +33355,7 @@ function LimitOperation({
33453
33355
  }
33454
33356
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
33455
33357
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
33456
- ..._stylex.props(styles$s.title),
33358
+ ..._stylex.props(styles$t.title),
33457
33359
  children: "limit"
33458
33360
  }), /* @__PURE__ */ jsxRuntime.jsxs("div", {
33459
33361
  ..._stylex.props(hoverStyles.main),
@@ -33503,10 +33405,10 @@ function OrderByOperations({
33503
33405
  }
33504
33406
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
33505
33407
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
33506
- ..._stylex.props(styles$s.title),
33408
+ ..._stylex.props(styles$t.title),
33507
33409
  children: "order by"
33508
33410
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
33509
- ..._stylex.props(styles$s.tokenContainer),
33411
+ ..._stylex.props(styles$t.tokenContainer),
33510
33412
  children: orderBys.map((orderBy) => {
33511
33413
  const {
33512
33414
  fieldReference
@@ -33580,13 +33482,19 @@ function CollapsiblePanel({
33580
33482
  icon,
33581
33483
  defaultOpen = true,
33582
33484
  controls,
33583
- collapsedControls
33485
+ collapsedControls,
33486
+ isFocused = false
33584
33487
  }) {
33585
33488
  const [isExpanded, setIsExpanded] = React.useState(defaultOpen);
33586
33489
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
33587
33490
  ...{
33588
- className: "mlyzkdzjc mly1sxf85j mly1717udv"
33589
- },
33491
+ 0: {
33492
+ className: "mlygbc89k mly1sxf85j mly1717udv"
33493
+ },
33494
+ 1: {
33495
+ className: "mly1sxf85j mly1717udv mlybwr872"
33496
+ }
33497
+ }[!!isFocused << 0],
33590
33498
  children: [/* @__PURE__ */ jsxRuntime.jsxs("div", {
33591
33499
  ...{
33592
33500
  className: "mlyrvj5dj mly1mt1orb mly52fmzj mlylqzeqv mlyfawy5m mly167g77z mly6s0dn4"
@@ -33597,7 +33505,7 @@ function CollapsiblePanel({
33597
33505
  },
33598
33506
  children: [icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, {
33599
33507
  name: icon,
33600
- customStyle: styles$f.icon
33508
+ customStyle: styles$g.icon
33601
33509
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
33602
33510
  ...{
33603
33511
  className: "mlyuxw1ft mlyb3r6kr mlylyipyv mlyehqz9p mly1ghz6dp"
@@ -33634,7 +33542,7 @@ function CollapsiblePanel({
33634
33542
  })]
33635
33543
  });
33636
33544
  }
33637
- const styles$f = {
33545
+ const styles$g = {
33638
33546
  icon: {
33639
33547
  $$css: true
33640
33548
  }
@@ -33657,7 +33565,7 @@ function AddItem({
33657
33565
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
33658
33566
  role: "menuitem",
33659
33567
  tabIndex: -1,
33660
- ..._stylex.props(addMenuStyles.item, addMenuStyles.clickable, open ? styles$e.open : null),
33568
+ ..._stylex.props(addMenuStyles.item, addMenuStyles.clickable, open ? styles$f.open : null),
33661
33569
  onClick: doOnClick,
33662
33570
  "data-disabled": disabled ? "true" : void 0,
33663
33571
  children: [/* @__PURE__ */ jsxRuntime.jsxs("div", {
@@ -33681,7 +33589,7 @@ function AddItem({
33681
33589
  }) : null]
33682
33590
  });
33683
33591
  }
33684
- const styles$e = {
33592
+ const styles$f = {
33685
33593
  open: {
33686
33594
  background: "mly16o7sp0",
33687
33595
  backgroundAttachment: null,
@@ -33756,10 +33664,10 @@ function AddFieldItem({
33756
33664
  onAddOperation,
33757
33665
  isFilterOperation,
33758
33666
  search,
33759
- customStyle: styles$d.list
33667
+ customStyle: styles$e.list
33760
33668
  });
33761
33669
  }
33762
- const styles$d = {
33670
+ const styles$e = {
33763
33671
  list: {
33764
33672
  width: "mlyqyf9gi",
33765
33673
  $$css: true
@@ -33963,7 +33871,7 @@ function AddMenu({
33963
33871
  value: search,
33964
33872
  onChange: setSearch,
33965
33873
  placeholder: "Search...",
33966
- customStyle: styles$c.search
33874
+ customStyle: styles$d.search
33967
33875
  })
33968
33876
  }), /* @__PURE__ */ jsxRuntime.jsx(Divider, {}), /* @__PURE__ */ jsxRuntime.jsxs("div", {
33969
33877
  ...{
@@ -34084,7 +33992,7 @@ function AddMenu({
34084
33992
  })]
34085
33993
  });
34086
33994
  }
34087
- const styles$c = {
33995
+ const styles$d = {
34088
33996
  search: {
34089
33997
  width: "mlyh8yej3",
34090
33998
  $$css: true
@@ -34099,7 +34007,7 @@ function NestOperations({
34099
34007
  return null;
34100
34008
  }
34101
34009
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
34102
- ..._stylex.props(styles$s.tokenContainer),
34010
+ ..._stylex.props(styles$t.tokenContainer),
34103
34011
  children: nests.map((nest) => /* @__PURE__ */ jsxRuntime.jsx(NestOperation, {
34104
34012
  rootQuery,
34105
34013
  view,
@@ -34113,9 +34021,31 @@ function NestOperation({
34113
34021
  nest
34114
34022
  }) {
34115
34023
  const {
34116
- setQuery
34024
+ setQuery,
34025
+ currentNestQueryPanel,
34026
+ onCurrentNestQueryPanelChange,
34027
+ onCurrentNestViewChange
34117
34028
  } = React.useContext(QueryEditorContext);
34118
34029
  const [renameOpen, setRenameOpen] = React.useState(false);
34030
+ const panelRef = React__namespace.useRef(null);
34031
+ const isCurrentNestQueryPanelFocused = currentNestQueryPanel !== null && panelRef.current == currentNestQueryPanel;
34032
+ React__namespace.useEffect(() => {
34033
+ if (isCurrentNestQueryPanelFocused) {
34034
+ onCurrentNestViewChange == null ? void 0 : onCurrentNestViewChange(nest.view);
34035
+ }
34036
+ }, [nest, isCurrentNestQueryPanelFocused, onCurrentNestViewChange]);
34037
+ const focusCurrentNestQueryPanel = () => {
34038
+ onCurrentNestQueryPanelChange == null ? void 0 : onCurrentNestQueryPanelChange(panelRef.current);
34039
+ onCurrentNestViewChange == null ? void 0 : onCurrentNestViewChange(nest.view);
34040
+ };
34041
+ const focusParentQueryPanel = () => {
34042
+ const currentPanel = panelRef.current;
34043
+ const parent = findParentNestQueryPanel(currentPanel);
34044
+ onCurrentNestQueryPanelChange == null ? void 0 : onCurrentNestQueryPanelChange(parent);
34045
+ if (parent === null) {
34046
+ onCurrentNestViewChange == null ? void 0 : onCurrentNestViewChange(null);
34047
+ }
34048
+ };
34119
34049
  const defaultOpen = nest.view.definition.node.kind === "segment" && nest.view.definition.node.operations.length === 0;
34120
34050
  const getControls = (nest2) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
34121
34051
  children: [/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, {
@@ -34129,6 +34059,7 @@ function NestOperation({
34129
34059
  icon: "clear",
34130
34060
  label: "Delete Query",
34131
34061
  onClick: () => {
34062
+ focusParentQueryPanel();
34132
34063
  nest2.delete();
34133
34064
  setQuery == null ? void 0 : setQuery(rootQuery.build());
34134
34065
  }
@@ -34143,29 +34074,41 @@ function NestOperation({
34143
34074
  view: nest2.view
34144
34075
  })]
34145
34076
  });
34146
- return /* @__PURE__ */ jsxRuntime.jsxs("div", {
34077
+ return /* @__PURE__ */ jsxRuntime.jsx("div", {
34147
34078
  ...{
34148
34079
  className: "mlyj3b58b mly1yf7rl7 mly1xmf6yo mlyh8yej3"
34149
34080
  },
34150
- children: [/* @__PURE__ */ jsxRuntime.jsx(CollapsiblePanel, {
34151
- title: nest.name,
34152
- icon: viewToVisualizationIcon(nest.view),
34153
- defaultOpen,
34154
- controls: getControls(nest),
34155
- collapsedControls: getControls(nest),
34156
- children: /* @__PURE__ */ jsxRuntime.jsx(View, {
34081
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
34082
+ ref: panelRef,
34083
+ onPointerDownCapture: focusCurrentNestQueryPanel,
34084
+ "data-nest-panel": true,
34085
+ children: [/* @__PURE__ */ jsxRuntime.jsx(CollapsiblePanel, {
34086
+ title: nest.name,
34087
+ icon: viewToVisualizationIcon(nest.view),
34088
+ defaultOpen,
34089
+ controls: getControls(nest),
34090
+ collapsedControls: getControls(nest),
34091
+ isFocused: isCurrentNestQueryPanelFocused,
34092
+ children: /* @__PURE__ */ jsxRuntime.jsx(View, {
34093
+ rootQuery,
34094
+ view: nest.view
34095
+ })
34096
+ }), /* @__PURE__ */ jsxRuntime.jsx(RenameDialog, {
34157
34097
  rootQuery,
34158
- view: nest.view
34159
- })
34160
- }), /* @__PURE__ */ jsxRuntime.jsx(RenameDialog, {
34161
- rootQuery,
34162
- view,
34163
- target: nest,
34164
- open: renameOpen,
34165
- setOpen: setRenameOpen
34166
- })]
34098
+ view,
34099
+ target: nest,
34100
+ open: renameOpen,
34101
+ setOpen: setRenameOpen
34102
+ })]
34103
+ })
34167
34104
  }, nest.name);
34168
34105
  }
34106
+ function findParentNestQueryPanel(element2) {
34107
+ if (!element2 || !element2.parentElement) return null;
34108
+ const parentElement = element2.parentElement;
34109
+ if (parentElement.dataset.nestPanel !== void 0) return parentElement;
34110
+ return findParentNestQueryPanel(parentElement);
34111
+ }
34169
34112
  function Operations({
34170
34113
  rootQuery,
34171
34114
  view,
@@ -34296,11 +34239,11 @@ function CollapsingView({
34296
34239
  })]
34297
34240
  }), !collapsed && /* @__PURE__ */ jsxRuntime.jsx(ViewAttributeTable, {
34298
34241
  viewInfo: viewDef.getViewInfo(),
34299
- style: styles$b.preview
34242
+ style: styles$c.preview
34300
34243
  })]
34301
34244
  });
34302
34245
  }
34303
- const styles$b = {
34246
+ const styles$c = {
34304
34247
  preview: {
34305
34248
  height: "mlyt7dq6l",
34306
34249
  maxHeight: "mly1hkcv85",
@@ -34332,87 +34275,101 @@ function Query({
34332
34275
  query,
34333
34276
  setQuery
34334
34277
  }) {
34335
- return /* @__PURE__ */ jsxRuntime.jsxs(CollapsiblePanel, {
34336
- title: "Main query",
34337
- controls: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
34338
- children: [/* @__PURE__ */ jsxRuntime.jsx(DropdownMenu, {
34339
- trigger: /* @__PURE__ */ jsxRuntime.jsx(Button, {
34340
- variant: "flat",
34341
- icon: "meatballs",
34342
- size: "compact",
34343
- tooltip: "More Actions"
34344
- }),
34345
- children: setQuery ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
34346
- children: [/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, {
34347
- icon: "clear",
34348
- label: "Clear query",
34349
- onClick: () => {
34350
- setQuery == null ? void 0 : setQuery(void 0);
34351
- },
34352
- disabled: rootQuery.isEmpty()
34353
- }), /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, {
34354
- icon: "nest",
34355
- label: "Nest query",
34356
- onClick: () => {
34357
- if (rootQuery.definition instanceof QB.ASTArrowQueryDefinition) {
34358
- rootQuery.definition.view.convertToNest("Nest");
34359
- }
34360
- setQuery == null ? void 0 : setQuery(rootQuery.build());
34361
- },
34362
- disabled: rootQuery.isEmpty() || !(rootQuery.definition instanceof QB.ASTArrowQueryDefinition)
34363
- })]
34364
- }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
34365
- }), query.definition instanceof QB.ASTArrowQueryDefinition ? /* @__PURE__ */ jsxRuntime.jsx(AddMenu, {
34366
- rootQuery,
34367
- view: query.definition
34368
- }) : null]
34369
- }),
34370
- collapsedControls: /* @__PURE__ */ jsxRuntime.jsx(Icon, {
34371
- name: viewToVisualizationIcon(query)
34372
- }),
34373
- children: [query.definition instanceof QB.ASTArrowQueryDefinition ? /* @__PURE__ */ jsxRuntime.jsxs("div", {
34374
- style: {
34375
- display: "flex",
34376
- flexDirection: "column",
34377
- gap: 8
34378
- },
34379
- children: [!query.isEmpty() && /* @__PURE__ */ jsxRuntime.jsx(Visualization$1, {
34380
- rootQuery,
34381
- view: query
34382
- }), /* @__PURE__ */ jsxRuntime.jsx(ViewDefinition, {
34383
- rootQuery,
34384
- view: query.definition,
34385
- viewDef: query.definition.view
34386
- })]
34387
- }) : null, query.isEmpty() ? /* @__PURE__ */ jsxRuntime.jsx("div", {
34388
- ...{
34389
- className: "mly78zum5 mlyl56j7k mly6s0dn4 mlyng8ra"
34390
- },
34391
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
34392
- ...{
34393
- className: "mly78zum5 mly6s0dn4"
34278
+ const {
34279
+ currentNestQueryPanel,
34280
+ onCurrentNestQueryPanelChange,
34281
+ onCurrentNestViewChange
34282
+ } = React__namespace.useContext(QueryEditorContext);
34283
+ const focusMainQueryPanel = () => {
34284
+ onCurrentNestQueryPanelChange == null ? void 0 : onCurrentNestQueryPanelChange(null);
34285
+ onCurrentNestViewChange == null ? void 0 : onCurrentNestViewChange(null);
34286
+ };
34287
+ return /* @__PURE__ */ jsxRuntime.jsx("div", {
34288
+ onPointerDownCapture: focusMainQueryPanel,
34289
+ children: /* @__PURE__ */ jsxRuntime.jsxs(CollapsiblePanel, {
34290
+ title: "Main query",
34291
+ isFocused: !currentNestQueryPanel,
34292
+ controls: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
34293
+ children: [/* @__PURE__ */ jsxRuntime.jsx(DropdownMenu, {
34294
+ trigger: /* @__PURE__ */ jsxRuntime.jsx(Button, {
34295
+ variant: "flat",
34296
+ icon: "meatballs",
34297
+ size: "compact",
34298
+ tooltip: "More Actions"
34299
+ }),
34300
+ children: setQuery ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
34301
+ children: [/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, {
34302
+ icon: "clear",
34303
+ label: "Clear query",
34304
+ onClick: () => {
34305
+ focusMainQueryPanel();
34306
+ setQuery == null ? void 0 : setQuery(void 0);
34307
+ },
34308
+ disabled: rootQuery.isEmpty()
34309
+ }), /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, {
34310
+ icon: "nest",
34311
+ label: "Nest query",
34312
+ onClick: () => {
34313
+ if (rootQuery.definition instanceof QB.ASTArrowQueryDefinition) {
34314
+ rootQuery.definition.view.convertToNest("Nest");
34315
+ }
34316
+ setQuery == null ? void 0 : setQuery(rootQuery.build());
34317
+ },
34318
+ disabled: rootQuery.isEmpty() || !(rootQuery.definition instanceof QB.ASTArrowQueryDefinition)
34319
+ })]
34320
+ }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
34321
+ }), query.definition instanceof QB.ASTArrowQueryDefinition ? /* @__PURE__ */ jsxRuntime.jsx(AddMenu, {
34322
+ rootQuery,
34323
+ view: query.definition
34324
+ }) : null]
34325
+ }),
34326
+ collapsedControls: /* @__PURE__ */ jsxRuntime.jsx(Icon, {
34327
+ name: viewToVisualizationIcon(query)
34328
+ }),
34329
+ children: [query.definition instanceof QB.ASTArrowQueryDefinition ? /* @__PURE__ */ jsxRuntime.jsxs("div", {
34330
+ style: {
34331
+ display: "flex",
34332
+ flexDirection: "column",
34333
+ gap: 8
34394
34334
  },
34395
- children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
34396
- children: "Click"
34397
- }), /* @__PURE__ */ jsxRuntime.jsx(Icon, {
34398
- name: "insert"
34399
- }), /* @__PURE__ */ jsxRuntime.jsx("div", {
34400
- children: "to get started"
34335
+ children: [!query.isEmpty() && /* @__PURE__ */ jsxRuntime.jsx(Visualization$1, {
34336
+ rootQuery,
34337
+ view: query
34338
+ }), /* @__PURE__ */ jsxRuntime.jsx(ViewDefinition, {
34339
+ rootQuery,
34340
+ view: query.definition,
34341
+ viewDef: query.definition.view
34401
34342
  })]
34402
- })
34403
- }) : null]
34404
- });
34405
- }
34406
- function Source({
34407
- rootQuery
34408
- }) {
34409
- if (rootQuery.definition instanceof QB.ASTArrowQueryDefinition) {
34410
- return /* @__PURE__ */ jsxRuntime.jsx("div", {
34411
- ..._stylex.props(styles$s.queryCard, styles$a.content),
34412
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
34413
- ..._stylex.props(styles$s.labelWithIcon),
34414
- children: [/* @__PURE__ */ jsxRuntime.jsx(Icon, {
34415
- name: "database"
34343
+ }) : null, query.isEmpty() ? /* @__PURE__ */ jsxRuntime.jsx("div", {
34344
+ ...{
34345
+ className: "mly78zum5 mlyl56j7k mly6s0dn4 mlyng8ra"
34346
+ },
34347
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
34348
+ ...{
34349
+ className: "mly78zum5 mly6s0dn4"
34350
+ },
34351
+ children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
34352
+ children: "Click"
34353
+ }), /* @__PURE__ */ jsxRuntime.jsx(Icon, {
34354
+ name: "insert"
34355
+ }), /* @__PURE__ */ jsxRuntime.jsx("div", {
34356
+ children: "to get started"
34357
+ })]
34358
+ })
34359
+ }) : null]
34360
+ })
34361
+ });
34362
+ }
34363
+ function Source({
34364
+ rootQuery
34365
+ }) {
34366
+ if (rootQuery.definition instanceof QB.ASTArrowQueryDefinition) {
34367
+ return /* @__PURE__ */ jsxRuntime.jsx("div", {
34368
+ ..._stylex.props(styles$t.queryCard, styles$b.content),
34369
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
34370
+ ..._stylex.props(styles$t.labelWithIcon),
34371
+ children: [/* @__PURE__ */ jsxRuntime.jsx(Icon, {
34372
+ name: "database"
34416
34373
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
34417
34374
  ...{
34418
34375
  className: "mlyb3r6kr mlylyipyv"
@@ -34424,7 +34381,7 @@ function Source({
34424
34381
  }
34425
34382
  return null;
34426
34383
  }
34427
- const styles$a = {
34384
+ const styles$b = {
34428
34385
  content: {
34429
34386
  display: "mlyrvj5dj",
34430
34387
  gridAutoFlow: "mly1mt1orb",
@@ -34435,12 +34392,145 @@ const styles$a = {
34435
34392
  $$css: true
34436
34393
  }
34437
34394
  };
34395
+ function DateLiteralEditor({
34396
+ value,
34397
+ setValue,
34398
+ customStyle
34399
+ }) {
34400
+ const [errorMessage, setErrorMessage] = React.useState("");
34401
+ const [open, setOpen] = React.useState(false);
34402
+ const input = React.useRef(null);
34403
+ const picker = React.useRef(null);
34404
+ const isDate2 = value.kind === "date_literal";
34405
+ const date = isDate2 ? value.date_value : value.timestamp_value;
34406
+ const units = isDate2 ? "day" : "second";
34407
+ const onSetValue = (date2) => {
34408
+ if (date2) {
34409
+ setErrorMessage("");
34410
+ if (isDate2) {
34411
+ setValue({
34412
+ kind: "date_literal",
34413
+ date_value: hooks.utc(date2).format(formats["day"])
34414
+ });
34415
+ } else {
34416
+ setValue({
34417
+ kind: "timestamp_literal",
34418
+ timestamp_value: hooks.utc(date2).format(formats["second"])
34419
+ });
34420
+ }
34421
+ } else {
34422
+ setErrorMessage("Invalid date");
34423
+ }
34424
+ };
34425
+ useClickOutside([input, picker], () => {
34426
+ setOpen(false);
34427
+ });
34428
+ return /* @__PURE__ */ jsxRuntime.jsxs(Root2$2, {
34429
+ open,
34430
+ onOpenChange: () => {
34431
+ },
34432
+ children: [/* @__PURE__ */ jsxRuntime.jsx(Trigger$2, {
34433
+ asChild: true,
34434
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", {
34435
+ ..._stylex.props(tokenStyles.main, styles$a.wrapper, customStyle),
34436
+ children: /* @__PURE__ */ jsxRuntime.jsx(DateInput, {
34437
+ value: hooks.utc(date).toDate(),
34438
+ setValue: onSetValue,
34439
+ units,
34440
+ onFocus: () => setOpen(true),
34441
+ customStyle: {
34442
+ ...styles$a.input,
34443
+ ...isDate2 ? styles$a.dateInput : styles$a.timestampInput
34444
+ },
34445
+ forwardRef: input
34446
+ })
34447
+ })
34448
+ }), errorMessage && /* @__PURE__ */ jsxRuntime.jsx(ErrorIcon, {
34449
+ errorMessage
34450
+ }), /* @__PURE__ */ jsxRuntime.jsx(Portal$2, {
34451
+ children: /* @__PURE__ */ jsxRuntime.jsx(Content2$2, {
34452
+ align: "center",
34453
+ asChild: true,
34454
+ children: /* @__PURE__ */ jsxRuntime.jsx(DatePicker, {
34455
+ value: hooks.utc(date).toDate(),
34456
+ setValue: onSetValue,
34457
+ units,
34458
+ maxLevel: units,
34459
+ customStyle: styles$a.datePicker,
34460
+ forwardRef: picker
34461
+ })
34462
+ })
34463
+ })]
34464
+ });
34465
+ }
34466
+ const styles$a = {
34467
+ input: {
34468
+ border: "mly1gs6z28",
34469
+ borderWidth: null,
34470
+ borderInlineWidth: null,
34471
+ borderInlineStartWidth: null,
34472
+ borderLeftWidth: null,
34473
+ borderInlineEndWidth: null,
34474
+ borderRightWidth: null,
34475
+ borderBlockWidth: null,
34476
+ borderTopWidth: null,
34477
+ borderBottomWidth: null,
34478
+ borderStyle: null,
34479
+ borderInlineStyle: null,
34480
+ borderInlineStartStyle: null,
34481
+ borderLeftStyle: null,
34482
+ borderInlineEndStyle: null,
34483
+ borderRightStyle: null,
34484
+ borderBlockStyle: null,
34485
+ borderTopStyle: null,
34486
+ borderBottomStyle: null,
34487
+ borderColor: null,
34488
+ borderInlineColor: null,
34489
+ borderInlineStartColor: null,
34490
+ borderLeftColor: null,
34491
+ borderInlineEndColor: null,
34492
+ borderRightColor: null,
34493
+ borderBlockColor: null,
34494
+ borderTopColor: null,
34495
+ borderBottomColor: null,
34496
+ height: "mlyd7y6wv",
34497
+ backgroundColor: "mlyjbqb8w mlytw1abo",
34498
+ $$css: true
34499
+ },
34500
+ dateInput: {
34501
+ width: "mly869kya",
34502
+ $$css: true
34503
+ },
34504
+ timestampInput: {
34505
+ width: "mlynrytzq",
34506
+ $$css: true
34507
+ },
34508
+ wrapper: {
34509
+ $$css: true
34510
+ },
34511
+ datePicker: {
34512
+ display: "mly78zum5",
34513
+ flexDirection: "mlydt5ytf",
34514
+ boxShadow: "mly5n1uv4",
34515
+ backgroundColor: "mly12peec7",
34516
+ borderRadius: "mlyur7f20",
34517
+ borderStartStartRadius: null,
34518
+ borderStartEndRadius: null,
34519
+ borderEndStartRadius: null,
34520
+ borderEndEndRadius: null,
34521
+ borderTopLeftRadius: null,
34522
+ borderTopRightRadius: null,
34523
+ borderBottomLeftRadius: null,
34524
+ borderBottomRightRadius: null,
34525
+ width: "mly1hfn5x7",
34526
+ $$css: true
34527
+ }
34528
+ };
34438
34529
  function LiteralValueEditor({
34439
34530
  value,
34440
34531
  setValue,
34441
34532
  customStyle
34442
34533
  }) {
34443
- const [errorMessage, setErrorMessage] = React__namespace.useState("");
34444
34534
  if (!value) {
34445
34535
  return null;
34446
34536
  }
@@ -34455,31 +34545,18 @@ function LiteralValueEditor({
34455
34545
  label: "false",
34456
34546
  value: "false"
34457
34547
  }],
34458
- onChange: (value2) => setValue(value2 === "true"),
34548
+ onChange: (value2) => setValue({
34549
+ kind: "boolean_literal",
34550
+ boolean_value: value2 === "true"
34551
+ }),
34459
34552
  customStyle
34460
34553
  });
34461
34554
  case "date_literal":
34462
- return /* @__PURE__ */ jsxRuntime.jsxs("div", {
34463
- ...{
34464
- className: "mly78zum5"
34465
- },
34466
- children: [/* @__PURE__ */ jsxRuntime.jsx("input", {
34467
- value: value.date_value.split(" ")[0],
34468
- type: "date",
34469
- onChange: (event) => {
34470
- if (event.target.valueAsDate) {
34471
- setErrorMessage("");
34472
- setValue({
34473
- date: event.target.valueAsDate,
34474
- granularity: "day"
34475
- });
34476
- } else {
34477
- setErrorMessage("Invalid date");
34478
- }
34479
- }
34480
- }), errorMessage && /* @__PURE__ */ jsxRuntime.jsx(ErrorIcon, {
34481
- errorMessage
34482
- })]
34555
+ case "timestamp_literal":
34556
+ return /* @__PURE__ */ jsxRuntime.jsx(DateLiteralEditor, {
34557
+ value,
34558
+ setValue,
34559
+ customStyle
34483
34560
  });
34484
34561
  case "null_literal":
34485
34562
  return /* @__PURE__ */ jsxRuntime.jsx(Token, {
@@ -34489,42 +34566,28 @@ function LiteralValueEditor({
34489
34566
  return /* @__PURE__ */ jsxRuntime.jsx(EditableToken, {
34490
34567
  value: value.number_value,
34491
34568
  type: "number",
34492
- onChange: (value2) => setValue(value2),
34569
+ onChange: (value2) => setValue({
34570
+ kind: "number_literal",
34571
+ number_value: value2
34572
+ }),
34493
34573
  customStyle
34494
34574
  });
34495
34575
  case "string_literal":
34496
34576
  return /* @__PURE__ */ jsxRuntime.jsx(EditableToken, {
34497
34577
  value: value.string_value,
34498
- onChange: (value2) => setValue(value2),
34578
+ onChange: (value2) => setValue({
34579
+ kind: "string_literal",
34580
+ string_value: value2
34581
+ }),
34499
34582
  customStyle
34500
34583
  });
34501
- case "timestamp_literal":
34502
- return /* @__PURE__ */ jsxRuntime.jsxs("div", {
34503
- ...{
34504
- className: "mly78zum5"
34505
- },
34506
- children: [/* @__PURE__ */ jsxRuntime.jsx("input", {
34507
- value: value.timestamp_value,
34508
- type: "date",
34509
- onChange: (event) => {
34510
- if (event.target.valueAsDate) {
34511
- setErrorMessage("");
34512
- setValue({
34513
- date: event.target.valueAsDate,
34514
- granularity: "second"
34515
- });
34516
- } else {
34517
- setErrorMessage("Invalid date");
34518
- }
34519
- }
34520
- }), errorMessage && /* @__PURE__ */ jsxRuntime.jsx(ErrorIcon, {
34521
- errorMessage
34522
- })]
34523
- });
34524
34584
  case "filter_expression_literal":
34525
34585
  return /* @__PURE__ */ jsxRuntime.jsx(EditableToken, {
34526
34586
  value: value.filter_expression_value,
34527
- onChange: (value2) => setValue(value2),
34587
+ onChange: (value2) => setValue({
34588
+ kind: "filter_expression_literal",
34589
+ filter_expression_value: value2
34590
+ }),
34528
34591
  customStyle
34529
34592
  });
34530
34593
  }
@@ -35569,15 +35632,21 @@ function flattenFieldsTree(fields, path = []) {
35569
35632
  case "measure":
35570
35633
  case "dimension":
35571
35634
  if (field.type.kind === "array_type" && field.type.element_type.kind === "record_type") {
35572
- return flattenFieldsTree(field.type.element_type.fields.map((dimension) => ({
35635
+ return [{
35636
+ path,
35637
+ field
35638
+ }, ...flattenFieldsTree(field.type.element_type.fields.map((dimension) => ({
35573
35639
  kind: field.kind,
35574
35640
  ...dimension
35575
- })), [...path, field.name]);
35641
+ })), [...path, field.name])];
35576
35642
  } else if (field.type.kind === "record_type") {
35577
- return flattenFieldsTree(field.type.fields.map((dimension) => ({
35643
+ return [{
35644
+ path,
35645
+ field
35646
+ }, ...flattenFieldsTree(field.type.fields.map((dimension) => ({
35578
35647
  kind: field.kind,
35579
35648
  ...dimension
35580
- })), [...path, field.name]);
35649
+ })), [...path, field.name])];
35581
35650
  }
35582
35651
  return [{
35583
35652
  path,
@@ -35619,64 +35688,46 @@ function groupFieldItemsByKind(items) {
35619
35688
  return acc;
35620
35689
  }, {}));
35621
35690
  }
35622
- const getNestName = (segment, rename = "Nest") => {
35623
- const nestNo = segmentNestNo(segment);
35624
- return nestNo > 1 ? `${rename} ${nestNo}` : rename;
35625
- };
35626
35691
  const FIELD_KIND_TO_TITLE = {
35627
35692
  view: "Views",
35628
35693
  measure: "Measures",
35629
35694
  dimension: "Dimensions"
35630
35695
  };
35631
- function useNestOperations(rootQuery) {
35632
- const nestOperations = React.useMemo(() => {
35633
- if (rootQuery) {
35634
- const queryDef = rootQuery.definition;
35635
- if (queryDef instanceof QB.ASTArrowQueryDefinition) {
35636
- return extractNestOperations(queryDef.view);
35637
- }
35638
- }
35639
- return [];
35640
- }, [rootQuery]);
35641
- return nestOperations;
35642
- }
35643
- const extractNestOperations = (view, nestOperations = []) => {
35644
- if (view instanceof QB.ASTArrowViewDefinition) {
35645
- return extractNestOperations(view.view, nestOperations);
35646
- } else if (view instanceof QB.ASTSegmentViewDefinition) {
35647
- view.operations.items.filter((operation) => operation instanceof QB.ASTNestViewOperation).forEach((operation) => {
35648
- const nestView = operation.view.definition;
35649
- nestOperations.push({
35650
- name: operation.name,
35651
- view: nestView
35652
- });
35653
- extractNestOperations(nestView, nestOperations);
35654
- });
35655
- return nestOperations;
35656
- } else if (view instanceof QB.ASTRefinementViewDefinition) {
35657
- return extractNestOperations(view.refinement, nestOperations);
35658
- }
35659
- return nestOperations;
35660
- };
35661
35696
  function useOperations(view, field, path) {
35697
+ const dimensionFields = React.useMemo(() => {
35698
+ const {
35699
+ fields
35700
+ } = getInputSchemaFromViewParent(view);
35701
+ return new Set(flattenFieldsTree(fields).filter(({
35702
+ field: field2
35703
+ }) => field2.kind === "dimension").map(({
35704
+ field: field2
35705
+ }) => field2.name));
35706
+ }, [view]);
35707
+ const measureFields = React.useMemo(() => {
35708
+ const {
35709
+ fields
35710
+ } = getInputSchemaFromViewParent(view);
35711
+ return new Set(flattenFieldsTree(fields).filter(({
35712
+ field: field2
35713
+ }) => field2.kind === "measure").map(({
35714
+ field: field2
35715
+ }) => field2.name));
35716
+ }, [view]);
35662
35717
  const isGroupByAllowed = React.useMemo(() => {
35663
35718
  if (!view) {
35664
35719
  return false;
35665
35720
  }
35666
- const fieldName = field.name;
35667
- const inputSchemaFields = getInputSchemaFromViewParent(view).fields;
35668
- const filteredFieldItems = flattenFieldsTree(inputSchemaFields).filter((item) => item.field.kind === "dimension");
35669
- return filteredFieldItems.some((item) => item.field.name === fieldName && item.path.join(".") === path.join("."));
35670
- }, [view, field, path]);
35721
+ const segment = getSegmentIfPresent(view);
35722
+ return dimensionFields.has(field.name) && !(segment == null ? void 0 : segment.hasField(field.name, path)) && isNotAnnotatedFilteredField(field);
35723
+ }, [view, field, path, dimensionFields]);
35671
35724
  const isAggregateAllowed = React.useMemo(() => {
35672
35725
  if (!view) {
35673
35726
  return false;
35674
35727
  }
35675
- const fieldName = field.name;
35676
- const inputSchemaFields = getInputSchemaFromViewParent(view).fields;
35677
- const filteredFieldItems = flattenFieldsTree(inputSchemaFields).filter((item) => item.field.kind === "measure");
35678
- return filteredFieldItems.some((item) => item.field.name === fieldName && item.path.join(".") === path.join("."));
35679
- }, [view, field, path]);
35728
+ const segment = getSegmentIfPresent(view);
35729
+ return measureFields.has(field.name) && !(segment == null ? void 0 : segment.hasField(field.name, path)) && isNotAnnotatedFilteredField(field);
35730
+ }, [view, field, path, measureFields]);
35680
35731
  const isFilterAllowed = React.useMemo(() => {
35681
35732
  if (!view) {
35682
35733
  return false;
@@ -35703,280 +35754,115 @@ function useOperations(view, field, path) {
35703
35754
  }
35704
35755
  const FILTERABLE_TYPES = ["string_type", "boolean_type", "number_type", "date_type", "timestamp_type"];
35705
35756
  const ORDERABLE_TYPES = ["string_type", "number_type", "boolean_type", "date_type", "timestamp_type"];
35706
- function OperationDropdownMenuItems({
35707
- view,
35757
+ function FieldTokenWithActions({
35708
35758
  field,
35709
35759
  path,
35710
- withEmptyNest = false
35760
+ viewDef
35711
35761
  }) {
35712
35762
  const {
35713
35763
  rootQuery,
35714
- setQuery
35764
+ setQuery,
35765
+ currentNestView
35715
35766
  } = React.useContext(QueryEditorContext);
35767
+ const view = currentNestView ?? viewDef;
35716
35768
  const {
35717
35769
  isGroupByAllowed,
35718
35770
  isAggregateAllowed,
35719
35771
  isFilterAllowed,
35720
35772
  isOrderByAllowed
35721
35773
  } = useOperations(view, field, path);
35722
- const handleMenuItemClick = (event, operation) => {
35774
+ const [isFilterPopoverOpen, setIsFilterPopoverOpen] = React.useState();
35775
+ const handleAddOperationAction = (operation, filter) => {
35723
35776
  if (field.kind === "dimension" || field.kind === "measure") {
35724
- const segment = view.getOrAddDefaultSegment();
35725
- const currentView = withEmptyNest ? segment.addEmptyNest(getNestName(segment)).view : view;
35726
- const currentSegment = currentView.getOrAddDefaultSegment();
35727
35777
  if (operation === "groupBy" && isGroupByAllowed) {
35728
- addGroupBy(currentView, field, path);
35778
+ addGroupBy(view, field, path);
35729
35779
  } else if (operation === "aggregate" && isAggregateAllowed) {
35730
- addAggregate(currentView, field, path);
35780
+ addAggregate(view, field, path);
35731
35781
  } else if (operation === "orderBy" && isOrderByAllowed) {
35732
- currentSegment.addOrderBy(field.name, "asc");
35782
+ const segment = view.getOrAddDefaultSegment();
35783
+ segment.addOrderBy(field.name, "asc");
35784
+ } else if (operation === "filter" && isFilterAllowed && filter) {
35785
+ const segment = view.getOrAddDefaultSegment();
35786
+ if (field.kind === "dimension") {
35787
+ segment.addWhere(field.name, path, filter);
35788
+ } else {
35789
+ segment.addHaving(field.name, path, filter);
35790
+ }
35733
35791
  }
35734
35792
  setQuery == null ? void 0 : setQuery(rootQuery == null ? void 0 : rootQuery.build());
35735
35793
  }
35736
35794
  };
35737
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
35738
- children: field.kind === "measure" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
35739
- children: [/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, {
35740
- icon: "aggregate",
35741
- label: "Aggregate",
35742
- disabled: !isAggregateAllowed,
35743
- onClick: (event) => handleMenuItemClick(event, "aggregate")
35744
- }), /* @__PURE__ */ jsxRuntime.jsx(FilterDropdownSubmenuItem, {
35745
- view,
35746
- isFilterAllowed,
35747
- field,
35748
- path
35749
- }), /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, {
35750
- icon: "orderBy",
35751
- label: "Order by",
35752
- disabled: !isOrderByAllowed,
35753
- onClick: (event) => handleMenuItemClick(event, "orderBy")
35754
- })]
35755
- }) : field.kind === "dimension" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
35756
- children: [/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, {
35757
- icon: "groupBy",
35758
- label: "Group by",
35759
- disabled: !isGroupByAllowed,
35760
- onClick: (event) => handleMenuItemClick(event, "groupBy")
35761
- }), /* @__PURE__ */ jsxRuntime.jsx(FilterDropdownSubmenuItem, {
35762
- view,
35763
- isFilterAllowed,
35764
- field,
35765
- path
35766
- }), /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, {
35767
- icon: "orderBy",
35768
- label: "Order by",
35769
- disabled: !isOrderByAllowed,
35770
- onClick: (event) => handleMenuItemClick(event, "orderBy")
35771
- })]
35772
- }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
35773
- });
35774
- }
35775
- function FilterDropdownSubmenuItem({
35776
- view,
35777
- isFilterAllowed,
35778
- field,
35779
- path
35780
- }) {
35781
- const {
35782
- rootQuery,
35783
- setQuery
35784
- } = React.useContext(QueryEditorContext);
35785
- const [isOpen, setIsOpen] = React.useState(false);
35786
- const handleFilterSet = (filter) => {
35787
- const segment = view.getOrAddDefaultSegment();
35788
- if (field.kind === "dimension") {
35789
- segment.addWhere(field.name, path, filter);
35790
- } else {
35791
- segment.addHaving(field.name, path, filter);
35792
- }
35793
- setQuery == null ? void 0 : setQuery(rootQuery == null ? void 0 : rootQuery.build());
35794
- };
35795
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownSubMenuItem, {
35796
- icon: "filter",
35797
- label: "Filter",
35798
- disabled: !isFilterAllowed,
35799
- open: isOpen,
35800
- onOpenChange: setIsOpen,
35801
- children: /* @__PURE__ */ jsxRuntime.jsx(FilterDialog, {
35802
- fieldInfo: field,
35803
- path,
35804
- onFilterApply: handleFilterSet,
35805
- onOpenChange: setIsOpen
35806
- })
35807
- });
35808
- }
35809
- function NestFieldDropdownMenu({
35810
- view,
35811
- field,
35812
- path,
35813
- trigger,
35814
- onOpenChange
35815
- }) {
35816
- const {
35817
- rootQuery,
35818
- setQuery
35819
- } = React.useContext(QueryEditorContext);
35820
- const nestOperations = useNestOperations(rootQuery);
35821
- const nestViewWithinNestQuery = (operation) => {
35822
- const segment = operation.view.getOrAddDefaultSegment();
35823
- const {
35824
- fields
35825
- } = operation.view.getOutputSchema();
35826
- let rename;
35827
- if (fields.find((f2) => f2.name === field.name)) {
35828
- rename = findUniqueFieldName(fields, field.name);
35829
- }
35830
- segment.addNest(field.name, rename);
35831
- setQuery == null ? void 0 : setQuery(rootQuery == null ? void 0 : rootQuery.build());
35832
- };
35833
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu, {
35834
- trigger,
35835
- onOpenChange,
35836
- children: nestOperations.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
35837
- children: [/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, {
35838
- label: "Add to new nested query as..."
35839
- }), /* @__PURE__ */ jsxRuntime.jsx(OperationDropdownMenuItems, {
35840
- view,
35841
- field,
35842
- path,
35843
- withEmptyNest: true
35844
- })]
35845
- }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
35846
- children: [/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, {
35847
- label: "Add to nested query..."
35848
- }), nestOperations.map((operation, index2) => {
35849
- return field.kind === "view" ? /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, {
35850
- label: operation.name,
35851
- onClick: () => nestViewWithinNestQuery(operation)
35852
- }, index2) : /* @__PURE__ */ jsxRuntime.jsxs(DropdownSubMenuItem, {
35853
- label: operation.name,
35854
- children: [/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, {
35855
- label: `Add to ${operation.name} query as...`
35856
- }), /* @__PURE__ */ jsxRuntime.jsx(OperationDropdownMenuItems, {
35857
- view: operation.view.parent.as.View(),
35858
- field,
35859
- path
35860
- })]
35861
- }, index2);
35862
- })]
35863
- })
35864
- });
35865
- }
35866
- function AddFieldDropdownMenu({
35867
- view,
35868
- field,
35869
- path,
35870
- ...props2
35871
- }) {
35872
- return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, {
35873
- ...props2,
35874
- children: [/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, {
35875
- label: "Add to main query as..."
35876
- }), /* @__PURE__ */ jsxRuntime.jsx(OperationDropdownMenuItems, {
35877
- view,
35878
- field,
35879
- path
35880
- })]
35881
- });
35882
- }
35883
- function FieldTokenWithActions({
35884
- field,
35885
- path
35886
- }) {
35887
- const {
35888
- rootQuery,
35889
- setQuery
35890
- } = React.useContext(QueryEditorContext);
35891
- const [isAddFieldMenuOpen, setIsAddFieldMenuOpen] = React.useState();
35892
- const [isNestFieldMenuOpen, setIsNestFieldMenuOpen] = React.useState();
35893
- const nestViews = useNestOperations(rootQuery);
35894
- const viewDef = rootQuery == null ? void 0 : rootQuery.definition;
35895
- if (!(viewDef instanceof QB.ASTArrowQueryDefinition)) {
35896
- return null;
35897
- }
35898
- const hasAddFieldMenu = field.kind === "measure" || field.kind === "dimension";
35899
- const hasNestFieldMenu = field.kind === "measure" || field.kind === "dimension" || field.kind === "view" && nestViews.length > 0;
35900
- const addViewToMainQuery = () => {
35901
- if (field.kind === "view") {
35902
- if (rootQuery == null ? void 0 : rootQuery.isEmpty()) {
35903
- rootQuery == null ? void 0 : rootQuery.setView(field.name);
35904
- } else {
35905
- addNest(viewDef, field);
35906
- }
35795
+ const handleSetView = () => {
35796
+ if (field.kind === "view" && (rootQuery == null ? void 0 : rootQuery.isEmpty())) {
35797
+ rootQuery == null ? void 0 : rootQuery.setView(field.name);
35907
35798
  setQuery == null ? void 0 : setQuery(rootQuery == null ? void 0 : rootQuery.build());
35908
35799
  }
35909
35800
  };
35910
- const nestViewWithinMainQuery = () => {
35801
+ const handleAddView = () => {
35911
35802
  if (field.kind === "view") {
35912
- addNest(viewDef, field);
35803
+ addNest(view, field);
35913
35804
  setQuery == null ? void 0 : setQuery(rootQuery == null ? void 0 : rootQuery.build());
35914
35805
  }
35915
35806
  };
35916
- const hoverActions = () => {
35917
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
35918
- children: [hasAddFieldMenu ? /* @__PURE__ */ jsxRuntime.jsx(AddFieldDropdownMenu, {
35919
- view: viewDef,
35920
- field,
35807
+ return /* @__PURE__ */ jsxRuntime.jsx(FieldToken, {
35808
+ field,
35809
+ hoverActions: field.kind === "view" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
35810
+ children: [/* @__PURE__ */ jsxRuntime.jsx(ActionButton, {
35811
+ icon: "insert",
35812
+ disabled: !(rootQuery == null ? void 0 : rootQuery.isEmpty()),
35813
+ onClick: handleSetView,
35814
+ tooltip: "Add view"
35815
+ }), /* @__PURE__ */ jsxRuntime.jsx(ActionButton, {
35816
+ icon: "nest",
35817
+ onClick: handleAddView,
35818
+ tooltip: "Add as new nested query"
35819
+ })]
35820
+ }) : field.kind === "measure" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
35821
+ children: [/* @__PURE__ */ jsxRuntime.jsx(ActionButton, {
35822
+ icon: "aggregate",
35823
+ tooltip: "Add as aggregate",
35824
+ disabled: !isAggregateAllowed,
35825
+ onClick: () => handleAddOperationAction("aggregate")
35826
+ }), /* @__PURE__ */ jsxRuntime.jsx(FilterPopover, {
35827
+ fieldInfo: field,
35921
35828
  path,
35922
- trigger: /* @__PURE__ */ jsxRuntime.jsx(Button, {
35923
- variant: "flat",
35924
- size: "compact",
35925
- icon: "insert",
35926
- tooltip: "Add to main query"
35829
+ setFilter: (filter) => handleAddOperationAction("filter", filter),
35830
+ trigger: /* @__PURE__ */ jsxRuntime.jsx(ActionButton, {
35831
+ icon: "filter",
35832
+ tooltip: "Add as filter",
35833
+ disabled: !isFilterAllowed
35927
35834
  }),
35928
- onOpenChange: (open) => setIsAddFieldMenuOpen(open)
35929
- }) : /* @__PURE__ */ jsxRuntime.jsx(Button, {
35930
- variant: "flat",
35931
- size: "compact",
35932
- icon: "insert",
35933
- onClick: addViewToMainQuery,
35934
- tooltip: "Add to main query"
35935
- }), hasNestFieldMenu ? /* @__PURE__ */ jsxRuntime.jsx(NestFieldDropdownMenu, {
35936
- view: viewDef,
35937
- field,
35835
+ onOpenChange: setIsFilterPopoverOpen
35836
+ }), /* @__PURE__ */ jsxRuntime.jsx(ActionButton, {
35837
+ icon: "orderBy",
35838
+ tooltip: "Add as order by",
35839
+ disabled: !isOrderByAllowed,
35840
+ onClick: () => handleAddOperationAction("orderBy")
35841
+ })]
35842
+ }) : field.kind === "dimension" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
35843
+ children: [/* @__PURE__ */ jsxRuntime.jsx(ActionButton, {
35844
+ icon: "groupBy",
35845
+ tooltip: "Add as group by",
35846
+ disabled: !isGroupByAllowed,
35847
+ onClick: () => handleAddOperationAction("groupBy")
35848
+ }), /* @__PURE__ */ jsxRuntime.jsx(FilterPopover, {
35849
+ fieldInfo: field,
35938
35850
  path,
35939
- trigger: /* @__PURE__ */ jsxRuntime.jsx(Button, {
35940
- variant: "flat",
35941
- size: "compact",
35942
- icon: "nest",
35943
- tooltip: "Add to nested query"
35851
+ setFilter: (filter) => handleAddOperationAction("filter", filter),
35852
+ trigger: /* @__PURE__ */ jsxRuntime.jsx(ActionButton, {
35853
+ icon: "filter",
35854
+ tooltip: "Add as filter",
35855
+ disabled: !isFilterAllowed
35944
35856
  }),
35945
- onOpenChange: (open) => setIsNestFieldMenuOpen(open)
35946
- }) : /* @__PURE__ */ jsxRuntime.jsx(Button, {
35947
- variant: "flat",
35948
- size: "compact",
35949
- icon: "nest",
35950
- onClick: nestViewWithinMainQuery,
35951
- tooltip: "Add to nested query"
35857
+ onOpenChange: setIsFilterPopoverOpen
35858
+ }), /* @__PURE__ */ jsxRuntime.jsx(ActionButton, {
35859
+ icon: "orderBy",
35860
+ tooltip: "Add as order by",
35861
+ disabled: !isOrderByAllowed,
35862
+ onClick: () => handleAddOperationAction("orderBy")
35952
35863
  })]
35953
- });
35954
- };
35955
- return hasAddFieldMenu ? /* @__PURE__ */ jsxRuntime.jsx(AddFieldDropdownMenu, {
35956
- view: viewDef,
35957
- field,
35958
- path,
35959
- trigger: /* @__PURE__ */ jsxRuntime.jsx(FieldToken, {
35960
- field,
35961
- hoverActionsVisible: isAddFieldMenuOpen || isNestFieldMenuOpen,
35962
- hoverActions: hoverActions(),
35963
- asButtonTrigger: true
35964
- }),
35965
- onOpenChange: (open) => setIsAddFieldMenuOpen(open),
35966
- tooltip: /* @__PURE__ */ jsxRuntime.jsx(FieldHoverCard, {
35967
- field,
35968
- path
35969
- }),
35970
- tooltipProps: {
35971
- side: "right",
35972
- align: "start",
35973
- alignOffset: 28
35974
- }
35975
- }) : /* @__PURE__ */ jsxRuntime.jsx(FieldToken, {
35976
- field,
35977
- onClick: addViewToMainQuery,
35978
- hoverActions: hoverActions(),
35979
- hoverActionsVisible: isAddFieldMenuOpen || isNestFieldMenuOpen,
35864
+ }) : null,
35865
+ hoverActionsVisible: isFilterPopoverOpen,
35980
35866
  tooltip: /* @__PURE__ */ jsxRuntime.jsx(FieldHoverCard, {
35981
35867
  field,
35982
35868
  path
@@ -35988,6 +35874,13 @@ function FieldTokenWithActions({
35988
35874
  }
35989
35875
  });
35990
35876
  }
35877
+ function ActionButton(props2) {
35878
+ return /* @__PURE__ */ jsxRuntime.jsx(Button, {
35879
+ variant: "flat",
35880
+ size: "compact",
35881
+ ...props2
35882
+ });
35883
+ }
35991
35884
  const FIELD_KIND_ORDER = ["dimension", "measure", "view"];
35992
35885
  function SearchResultList({
35993
35886
  source,
@@ -35999,6 +35892,13 @@ function SearchResultList({
35999
35892
  items: groupFieldItemsByPath(source, group.items)
36000
35893
  }));
36001
35894
  }, [source, items]);
35895
+ const {
35896
+ rootQuery
35897
+ } = React__namespace.useContext(QueryEditorContext);
35898
+ const viewDef = rootQuery == null ? void 0 : rootQuery.definition;
35899
+ if (!(viewDef instanceof QB.ASTArrowQueryDefinition)) {
35900
+ return null;
35901
+ }
36002
35902
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
36003
35903
  ...{
36004
35904
  className: "mly78zum5 mlydt5ytf mly1cy8zhl mlyou54vl mlye8ttls mly10cdfl8"
@@ -36033,7 +35933,8 @@ function SearchResultList({
36033
35933
  path
36034
35934
  }) => /* @__PURE__ */ jsxRuntime.jsx(FieldTokenWithActions, {
36035
35935
  field,
36036
- path
35936
+ path,
35937
+ viewDef
36037
35938
  }, [...path, field.name].join(".")))))
36038
35939
  })]
36039
35940
  }, group))]
@@ -36076,6 +35977,13 @@ function FieldGroupList({
36076
35977
  group
36077
35978
  }) => group === fieldGroupType)) == null ? void 0 : _a2.items) ?? [];
36078
35979
  }, [fieldGroupsByKindByPath, fieldGroupType]);
35980
+ const {
35981
+ rootQuery
35982
+ } = React__namespace.useContext(QueryEditorContext);
35983
+ const viewDef = rootQuery == null ? void 0 : rootQuery.definition;
35984
+ if (!(viewDef instanceof QB.ASTArrowQueryDefinition)) {
35985
+ return null;
35986
+ }
36079
35987
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
36080
35988
  ...{
36081
35989
  className: "mly78zum5 mlydt5ytf mly167g77z"
@@ -36090,7 +35998,8 @@ function FieldGroupList({
36090
35998
  path
36091
35999
  }) => /* @__PURE__ */ jsxRuntime.jsx(FieldTokenWithActions, {
36092
36000
  field,
36093
- path
36001
+ path,
36002
+ viewDef
36094
36003
  }, [...path, field.name].join(".")))
36095
36004
  }, item.groupPath.join(".")))
36096
36005
  })