@malloydata/malloy-explorer 0.0.269-dev250430213122 → 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.
package/dist/esm/index.js CHANGED
@@ -17,7 +17,7 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
17
17
  import * as React from "react";
18
18
  import React__default, { useLayoutEffect, useEffect, useMemo, useState, useRef, createElement, useContext, useCallback, createContext, memo, useReducer } from "react";
19
19
  import * as QB from "@malloydata/malloy-query-builder";
20
- import { ASTArrowQueryDefinition, ASTSegmentViewDefinition, ASTRefinementViewDefinition, ASTLimitViewOperation, ASTNestViewOperation, ASTOrderByViewOperation, ASTAggregateViewOperation, ASTGroupByViewOperation, ASTWhereViewOperation, ASTHavingViewOperation, ASTArrowViewDefinition } from "@malloydata/malloy-query-builder";
20
+ import { ASTArrowQueryDefinition, ASTSegmentViewDefinition, ASTRefinementViewDefinition, ASTOrderByViewOperation, ASTLimitViewOperation, ASTNestViewOperation, ASTAggregateViewOperation, ASTGroupByViewOperation, ASTWhereViewOperation, ASTHavingViewOperation, ASTArrowViewDefinition } from "@malloydata/malloy-query-builder";
21
21
  import { Tag } from "@malloydata/malloy-tag";
22
22
  import * as render from "@malloydata/render";
23
23
  import "@malloydata/render/webcomponent";
@@ -3332,13 +3332,19 @@ function MalloyExplorerProvider({
3332
3332
  topValues
3333
3333
  }) {
3334
3334
  const rootQuery = useQueryBuilder(source, query);
3335
+ const [currentNestView, setCurrentNestView] = React.useState(null);
3336
+ const [currentNestQueryPanel, setCurrentNestQueryPanel] = React.useState(null);
3335
3337
  return /* @__PURE__ */ jsx(TooltipProvider, {
3336
3338
  children: /* @__PURE__ */ jsx(QueryEditorContext.Provider, {
3337
3339
  value: {
3338
3340
  source,
3339
3341
  rootQuery,
3340
3342
  setQuery,
3341
- topValues
3343
+ topValues,
3344
+ currentNestQueryPanel,
3345
+ onCurrentNestQueryPanelChange: setCurrentNestQueryPanel,
3346
+ currentNestView,
3347
+ onCurrentNestViewChange: setCurrentNestView
3342
3348
  },
3343
3349
  children
3344
3350
  })
@@ -3817,10 +3823,10 @@ function Icon({
3817
3823
  return null;
3818
3824
  }
3819
3825
  return /* @__PURE__ */ jsx(IconComponent, {
3820
- ..._stylex.props(styles$M.main, colorVariants$3[color], SMALL_ICONS.includes(name) && styles$M.scaleUp, customStyle)
3826
+ ..._stylex.props(styles$N.main, colorVariants$3[color], SMALL_ICONS.includes(name) && styles$N.scaleUp, customStyle)
3821
3827
  });
3822
3828
  }
3823
- const styles$M = {
3829
+ const styles$N = {
3824
3830
  main: {
3825
3831
  display: "mly1rg5ohu",
3826
3832
  width: "mly1kky2od",
@@ -3893,17 +3899,17 @@ function Badge({
3893
3899
  customStyle
3894
3900
  }) {
3895
3901
  return /* @__PURE__ */ jsxs("div", {
3896
- ..._stylex.props(styles$L.main, colorVariants$2[color], customStyle),
3902
+ ..._stylex.props(styles$M.main, colorVariants$2[color], customStyle),
3897
3903
  children: [icon && /* @__PURE__ */ jsx(Icon, {
3898
3904
  color,
3899
3905
  name: icon
3900
3906
  }), /* @__PURE__ */ jsx("div", {
3901
- ..._stylex.props(fontStyles.badge, styles$L.label),
3907
+ ..._stylex.props(fontStyles.badge, styles$M.label),
3902
3908
  children: label
3903
3909
  })]
3904
3910
  });
3905
3911
  }
3906
- const styles$L = {
3912
+ const styles$M = {
3907
3913
  main: {
3908
3914
  display: "mly3nfvp2",
3909
3915
  height: "mly1qx5ct2",
@@ -3985,10 +3991,10 @@ function Divider({
3985
3991
  customStyle
3986
3992
  }) {
3987
3993
  return /* @__PURE__ */ jsx("div", {
3988
- ..._stylex.props(styles$K.main, orientationVariants[orientation], customStyle)
3994
+ ..._stylex.props(styles$L.main, orientationVariants[orientation], customStyle)
3989
3995
  });
3990
3996
  }
3991
- const styles$K = {
3997
+ const styles$L = {
3992
3998
  main: {
3993
3999
  background: "mly1xnbgy5",
3994
4000
  backgroundAttachment: null,
@@ -4789,19 +4795,12 @@ function Button({
4789
4795
  icon,
4790
4796
  label,
4791
4797
  tooltip,
4792
- onClick,
4793
4798
  isDisabled = false,
4794
4799
  customStyle,
4795
4800
  ...props2
4796
4801
  }) {
4797
4802
  const button = /* @__PURE__ */ jsxs("button", {
4798
- ..._stylex.props(styles$J.main, colorVariants$1[variant], sizeVariants$1[size2], customStyle),
4799
- ...onClick && {
4800
- onClick: (e) => {
4801
- e.preventDefault();
4802
- onClick(e);
4803
- }
4804
- },
4803
+ ..._stylex.props(styles$K.main, colorVariants$1[variant], sizeVariants$1[size2], customStyle),
4805
4804
  type: "button",
4806
4805
  disabled: isDisabled,
4807
4806
  ...props2,
@@ -4811,9 +4810,9 @@ function Button({
4811
4810
  },
4812
4811
  children: [icon && /* @__PURE__ */ jsx(Icon, {
4813
4812
  name: icon,
4814
- customStyle: styles$J.icon
4813
+ customStyle: styles$K.icon
4815
4814
  }), label && /* @__PURE__ */ jsx("div", {
4816
- ..._stylex.props(variant === "primary" ? fontStyles.emphasized : fontStyles.body, styles$J.label),
4815
+ ..._stylex.props(variant === "primary" ? fontStyles.emphasized : fontStyles.body, styles$K.label),
4817
4816
  children: label
4818
4817
  })]
4819
4818
  }), isDisabled && /* @__PURE__ */ jsx("div", {
@@ -4840,7 +4839,7 @@ function Button({
4840
4839
  return button;
4841
4840
  }
4842
4841
  }
4843
- const styles$J = {
4842
+ const styles$K = {
4844
4843
  main: {
4845
4844
  display: "mly3nfvp2",
4846
4845
  flexDirection: "mlydt5ytf",
@@ -5091,7 +5090,7 @@ function Token({
5091
5090
  }) {
5092
5091
  const isInteractive = onClick !== void 0 || asButtonTrigger;
5093
5092
  const token2 = /* @__PURE__ */ jsxs("div", {
5094
- ..._stylex.props(tokenStyles.main, tokenColorVariants[color], tokenSizeVariants[size2], !isInteractive && styles$I.nonInteractive, customStyle),
5093
+ ..._stylex.props(tokenStyles.main, tokenColorVariants[color], tokenSizeVariants[size2], !isInteractive && styles$J.nonInteractive, customStyle),
5095
5094
  ...dragProps == null ? void 0 : dragProps.attributes,
5096
5095
  ...dragProps == null ? void 0 : dragProps.listeners,
5097
5096
  children: [icon && /* @__PURE__ */ jsx(Icon, {
@@ -5128,7 +5127,7 @@ function Token({
5128
5127
  })]
5129
5128
  }) : token2;
5130
5129
  }
5131
- const styles$I = {
5130
+ const styles$J = {
5132
5131
  nonInteractive: {
5133
5132
  cursor: "mlyt0e3qv",
5134
5133
  background: "mly1np9qvj",
@@ -5152,7 +5151,7 @@ function TokenGroup({
5152
5151
  }) {
5153
5152
  const count2 = React.Children.count(children);
5154
5153
  return /* @__PURE__ */ jsx("div", {
5155
- ..._stylex.props(styles$H.main, customStyle),
5154
+ ..._stylex.props(styles$I.main, customStyle),
5156
5155
  children: React.Children.map(children, (child, index2) => /* @__PURE__ */ React.cloneElement(child, {
5157
5156
  customStyle: {
5158
5157
  ...child.props.customStyle,
@@ -5163,16 +5162,16 @@ function TokenGroup({
5163
5162
  });
5164
5163
  }
5165
5164
  const getChildStyle = (index2, count2) => {
5166
- if (count2 === 1) return styles$H.onlyChild;
5167
- if (index2 === 0) return styles$H.firstChild;
5168
- if (index2 === count2 - 1) return styles$H.lastChild;
5169
- return styles$H.innerChild;
5165
+ if (count2 === 1) return styles$I.onlyChild;
5166
+ if (index2 === 0) return styles$I.firstChild;
5167
+ if (index2 === count2 - 1) return styles$I.lastChild;
5168
+ return styles$I.innerChild;
5170
5169
  };
5171
5170
  const getTokenColor = (child, groupColor) => {
5172
5171
  const childColor = child.props.color;
5173
5172
  return childColor === void 0 ? groupColor : childColor;
5174
5173
  };
5175
- const styles$H = {
5174
+ const styles$I = {
5176
5175
  main: {
5177
5176
  display: "mlyrvj5dj",
5178
5177
  gridAutoFlow: "mly1mt1orb",
@@ -5244,7 +5243,7 @@ function ErrorIcon({
5244
5243
  },
5245
5244
  children: /* @__PURE__ */ jsx(Icon, {
5246
5245
  name: "warning",
5247
- customStyle: styles$G.errorIcon
5246
+ customStyle: styles$H.errorIcon
5248
5247
  })
5249
5248
  })
5250
5249
  }), /* @__PURE__ */ jsx(TooltipPortal, {
@@ -5257,7 +5256,7 @@ function ErrorIcon({
5257
5256
  })]
5258
5257
  });
5259
5258
  }
5260
- const styles$G = {
5259
+ const styles$H = {
5261
5260
  errorIcon: {
5262
5261
  color: "mly1e2nbdu",
5263
5262
  $$css: true
@@ -5302,22 +5301,22 @@ function EditableToken({
5302
5301
  className: "mly78zum5 mly6s0dn4"
5303
5302
  },
5304
5303
  children: [/* @__PURE__ */ jsxs("div", {
5305
- ..._stylex.props(tokenStyles.main, tokenColorVariants[color], tokenSizeVariants[size2], isFocused && styles$F.focused, !!errorMessage && styles$F.hasError, customStyle),
5304
+ ..._stylex.props(tokenStyles.main, tokenColorVariants[color], tokenSizeVariants[size2], isFocused && styles$G.focused, !!errorMessage && styles$G.hasError, customStyle),
5306
5305
  children: [icon && /* @__PURE__ */ jsx(Icon, {
5307
5306
  name: icon,
5308
- customStyle: styles$F.icon
5307
+ customStyle: styles$G.icon
5309
5308
  }), /* @__PURE__ */ jsxs("span", {
5310
5309
  ...{
5311
5310
  className: "mlywz0xwf"
5312
5311
  },
5313
5312
  children: [/* @__PURE__ */ jsx("span", {
5314
- ..._stylex.props(fontStyles.body, styles$F.placeholder),
5313
+ ..._stylex.props(fontStyles.body, styles$G.placeholder),
5315
5314
  style: {
5316
5315
  whiteSpaceCollapse: "preserve"
5317
5316
  },
5318
5317
  children: value
5319
5318
  }), /* @__PURE__ */ jsx("input", {
5320
- ..._stylex.props(styles$F.input, fontStyles.body),
5319
+ ..._stylex.props(styles$G.input, fontStyles.body),
5321
5320
  ref: inputRef,
5322
5321
  pattern: type === "number" ? "^-?[0-9.]*$" : void 0,
5323
5322
  value,
@@ -5342,7 +5341,7 @@ function EditableToken({
5342
5341
  })]
5343
5342
  });
5344
5343
  }
5345
- const styles$F = {
5344
+ const styles$G = {
5346
5345
  focused: {
5347
5346
  background: "mlyotlr4g",
5348
5347
  backgroundAttachment: null,
@@ -7684,12 +7683,12 @@ function TextInput({
7684
7683
  }
7685
7684
  };
7686
7685
  return /* @__PURE__ */ jsxs("div", {
7687
- ..._stylex.props(styles$E.main, isFocused && styles$E.focused, sizeVariants[size2], customStyle),
7686
+ ..._stylex.props(styles$F.main, isFocused && styles$F.focused, sizeVariants[size2], customStyle),
7688
7687
  children: [icon && /* @__PURE__ */ jsx(Icon, {
7689
7688
  name: icon,
7690
7689
  color: "secondary"
7691
7690
  }), /* @__PURE__ */ jsx("input", {
7692
- ..._stylex.props(fontStyles.body, styles$E.input),
7691
+ ..._stylex.props(fontStyles.body, styles$F.input),
7693
7692
  value,
7694
7693
  placeholder,
7695
7694
  onChange: handleChange,
@@ -7697,7 +7696,7 @@ function TextInput({
7697
7696
  onBlur: handleBlur,
7698
7697
  onKeyDown
7699
7698
  }), hasClear && /* @__PURE__ */ jsx("button", {
7700
- ..._stylex.props(fontStyles.supporting, styles$E.actionButton, value === "" && styles$E.hidden),
7699
+ ..._stylex.props(fontStyles.supporting, styles$F.actionButton, value === "" && styles$F.hidden),
7701
7700
  ref: buttonRef,
7702
7701
  onClick: () => onChange(""),
7703
7702
  tabIndex: 0,
@@ -7705,7 +7704,7 @@ function TextInput({
7705
7704
  })]
7706
7705
  });
7707
7706
  }
7708
- const styles$E = {
7707
+ const styles$F = {
7709
7708
  main: {
7710
7709
  display: "mly78zum5",
7711
7710
  alignItems: "mly6s0dn4",
@@ -7914,7 +7913,7 @@ function SelectorToken({
7914
7913
  onValueChange: handleValueChange,
7915
7914
  required: true,
7916
7915
  children: [/* @__PURE__ */ jsxs(Trigger$3, {
7917
- ..._stylex.props(tokenStyles.main, styles$D.selectTrigger, tokenColorVariants[color], tokenSizeVariants[size2], fontStyles.body, tokenStyles.label, customStyle),
7916
+ ..._stylex.props(tokenStyles.main, styles$E.selectTrigger, tokenColorVariants[color], tokenSizeVariants[size2], fontStyles.body, tokenStyles.label, customStyle),
7918
7917
  children: [icon && /* @__PURE__ */ jsx(Icon, {
7919
7918
  name: icon,
7920
7919
  customStyle: tokenStyles.icon
@@ -7943,7 +7942,7 @@ function SelectorToken({
7943
7942
  size: "compact",
7944
7943
  icon: "search",
7945
7944
  hasClear: true,
7946
- customStyle: styles$D.searchInput,
7945
+ customStyle: styles$E.searchInput,
7947
7946
  onKeyDown: (event) => {
7948
7947
  const excludedKeys = ["ArrowUp", "ArrowDown"];
7949
7948
  if (!excludedKeys.includes(event.key)) {
@@ -7976,21 +7975,21 @@ function SelectItem({
7976
7975
  ...props2
7977
7976
  }) {
7978
7977
  return /* @__PURE__ */ jsxs(Item$1, {
7979
- ..._stylex.props(fontStyles.body, styles$D.selectItem),
7978
+ ..._stylex.props(fontStyles.body, styles$E.selectItem),
7980
7979
  value,
7981
7980
  ...props2,
7982
7981
  children: [value === selectedValue ? /* @__PURE__ */ jsx(Icon, {
7983
7982
  name: "radioChecked",
7984
- customStyle: styles$D.radioChecked
7983
+ customStyle: styles$E.radioChecked
7985
7984
  }) : /* @__PURE__ */ jsx(Icon, {
7986
7985
  name: "radioUnchecked",
7987
- customStyle: styles$D.radioUnchecked
7986
+ customStyle: styles$E.radioUnchecked
7988
7987
  }), /* @__PURE__ */ jsx(ItemText, {
7989
7988
  children
7990
7989
  })]
7991
7990
  });
7992
7991
  }
7993
- const styles$D = {
7992
+ const styles$E = {
7994
7993
  selectTrigger: {
7995
7994
  whiteSpace: "mlyuxw1ft",
7996
7995
  overflow: "mlyb3r6kr",
@@ -8080,7 +8079,7 @@ function Card({
8080
8079
  customStyle
8081
8080
  }) {
8082
8081
  return /* @__PURE__ */ jsxs("div", {
8083
- ..._stylex.props(styles$C.container, customStyle),
8082
+ ..._stylex.props(styles$D.container, customStyle),
8084
8083
  children: [/* @__PURE__ */ jsx("div", {
8085
8084
  ...{
8086
8085
  className: "mly1717udv"
@@ -8094,7 +8093,7 @@ function Card({
8094
8093
  })]
8095
8094
  });
8096
8095
  }
8097
- const styles$C = {
8096
+ const styles$D = {
8098
8097
  container: {
8099
8098
  display: "mly78zum5",
8100
8099
  flexDirection: "mlydt5ytf",
@@ -8185,10 +8184,10 @@ function CollapsibleListItem({
8185
8184
  className: "mly78zum5 mlydt5ytf mly1iyjqo2 mlyb3r6kr"
8186
8185
  },
8187
8186
  children: [/* @__PURE__ */ jsx("span", {
8188
- ..._stylex.props(fontStyles.body, styles$B.label),
8187
+ ..._stylex.props(fontStyles.body, styles$C.label),
8189
8188
  children: label
8190
8189
  }), sublabel && /* @__PURE__ */ jsx("span", {
8191
- ..._stylex.props(fontStyles.supporting, styles$B.sublabel),
8190
+ ..._stylex.props(fontStyles.supporting, styles$C.sublabel),
8192
8191
  children: sublabel
8193
8192
  })]
8194
8193
  })]
@@ -8200,7 +8199,7 @@ function CollapsibleListItem({
8200
8199
  })]
8201
8200
  });
8202
8201
  }
8203
- const styles$B = {
8202
+ const styles$C = {
8204
8203
  label: {
8205
8204
  flexGrow: "mly1iyjqo2",
8206
8205
  fontWeight: "mly1xlr1w8",
@@ -19014,7 +19013,7 @@ function Spinner({
19014
19013
  } = SIZES[size2];
19015
19014
  const frameSize = diameter + border * 2;
19016
19015
  return /* @__PURE__ */ jsx("div", {
19017
- ..._stylex.props(styles$A.root, customStyle),
19016
+ ..._stylex.props(styles$B.root, customStyle),
19018
19017
  children: /* @__PURE__ */ jsx("span", {
19019
19018
  "aria-valuetext": "Loading",
19020
19019
  ...{
@@ -19034,7 +19033,7 @@ function Spinner({
19034
19033
  })
19035
19034
  });
19036
19035
  }
19037
- const styles$A = {
19036
+ const styles$B = {
19038
19037
  root: {
19039
19038
  alignItems: "mly6s0dn4",
19040
19039
  display: "mly3nfvp2",
@@ -23432,7 +23431,7 @@ const Popover = ({
23432
23431
  })
23433
23432
  });
23434
23433
  };
23435
- const styles$z = {
23434
+ const styles$A = {
23436
23435
  wrapper: {
23437
23436
  position: "mly1n2onr6",
23438
23437
  $$css: true
@@ -23484,7 +23483,7 @@ const SelectDropdown = ({
23484
23483
  setOpen(false);
23485
23484
  };
23486
23485
  return /* @__PURE__ */ jsxs("div", {
23487
- ..._stylex.props(styles$z.wrapper, customStyle),
23486
+ ..._stylex.props(styles$A.wrapper, customStyle),
23488
23487
  children: [/* @__PURE__ */ jsxs("button", {
23489
23488
  type: "button",
23490
23489
  autoFocus,
@@ -23552,7 +23551,7 @@ function SelectList({
23552
23551
  const [hoveredIndex, setHoveredIndex] = useState(null);
23553
23552
  return /* @__PURE__ */ jsx(ScrollableArea, {
23554
23553
  children: /* @__PURE__ */ jsx("div", {
23555
- ..._stylex.props(styles$z.selectListDiv, customStyle),
23554
+ ..._stylex.props(styles$A.selectListDiv, customStyle),
23556
23555
  children: options.reduce((result, option2, index2) => {
23557
23556
  const isSelected = value !== void 0 && valueEqual(value, option2.value);
23558
23557
  if (option2.divider) {
@@ -23584,8 +23583,8 @@ function SelectList({
23584
23583
  }), /* @__PURE__ */ jsx(Icon, {
23585
23584
  name: "checkmark",
23586
23585
  customStyle: {
23587
- ...styles$z.checkIcon,
23588
- ...isSelected ? styles$z.checkIconSelected : void 0
23586
+ ...styles$A.checkIcon,
23587
+ ...isSelected ? styles$A.checkIconSelected : void 0
23589
23588
  }
23590
23589
  }), /* @__PURE__ */ jsx("span", {
23591
23590
  ...{
@@ -23607,17 +23606,18 @@ function DatePicker({
23607
23606
  setValue,
23608
23607
  units,
23609
23608
  maxLevel,
23610
- customStyle
23609
+ customStyle,
23610
+ forwardRef
23611
23611
  }) {
23612
23612
  const [date, setDate] = useState(value);
23613
23613
  const calendar2 = getCalendar(date);
23614
23614
  const [pickLevel, setPickLevel] = useState(units);
23615
- const yearBucket = Math.floor(hooks(date).year() / 10) * 10;
23615
+ const yearBucket = Math.floor(hooks.utc(date).year() / 10) * 10;
23616
23616
  useEffect(() => {
23617
23617
  setDate(value);
23618
23618
  }, [value]);
23619
23619
  const setYear = (year) => {
23620
- const newDate = hooks(date).year(year).toDate();
23620
+ const newDate = hooks.utc(date).year(year).toDate();
23621
23621
  setDate(newDate);
23622
23622
  setValue(newDate);
23623
23623
  };
@@ -23641,12 +23641,12 @@ function DatePicker({
23641
23641
  1: {
23642
23642
  className: "mly1247r65 mlyfvyar9 mlymcgfsh mly36usyh mly78zum5 mly6s0dn4 mlyl56j7k mly8fuzfi mly1v5ugh9 mly1fcty0u mly1ypdohk mly6mezaz mly1sxf85j mlyt89l8w mly1fxp9ov mly6wxqrg mly10bk7bj"
23643
23643
  }
23644
- }[!!(hooks(date).year() === yearBucket + offset2) << 0],
23644
+ }[!!(hooks.utc(date).year() === yearBucket + offset2) << 0],
23645
23645
  children: yearBucket + offset2
23646
23646
  });
23647
23647
  };
23648
23648
  const setMonth2 = (month) => {
23649
- const newDate = hooks(date).month(month).toDate();
23649
+ const newDate = hooks.utc(date).month(month).toDate();
23650
23650
  setDate(newDate);
23651
23651
  setValue(newDate);
23652
23652
  };
@@ -23659,13 +23659,13 @@ function DatePicker({
23659
23659
  setValue(dateOfFirstDayOfWeek);
23660
23660
  };
23661
23661
  const setQuarter = (quarter) => {
23662
- const newDate = hooks(date).quarter(quarter + 1).toDate();
23662
+ const newDate = hooks.utc(date).quarter(quarter + 1).toDate();
23663
23663
  setDate(newDate);
23664
23664
  setValue(newDate);
23665
23665
  };
23666
23666
  const monthButton = (month) => {
23667
23667
  const click = () => setMonth2(month);
23668
- const isSelected = hooks(date).month() === month && hooks(date).year() === hooks(value).year();
23668
+ const isSelected = hooks.utc(date).month() === month && hooks.utc(date).year() === hooks.utc(value).year();
23669
23669
  return /* @__PURE__ */ jsx("div", {
23670
23670
  onClick: click,
23671
23671
  ...{
@@ -23681,7 +23681,7 @@ function DatePicker({
23681
23681
  };
23682
23682
  const quarterButton = (quarter) => {
23683
23683
  const click = () => setQuarter(quarter);
23684
- const isSelected = hooks(date).quarter() - 1 === quarter && hooks(date).year() === hooks(value).year();
23684
+ const isSelected = hooks.utc(date).quarter() - 1 === quarter && hooks.utc(date).year() === hooks.utc(value).year();
23685
23685
  return /* @__PURE__ */ jsxs("div", {
23686
23686
  onClick: click,
23687
23687
  ...{
@@ -23696,7 +23696,8 @@ function DatePicker({
23696
23696
  });
23697
23697
  };
23698
23698
  return /* @__PURE__ */ jsxs("div", {
23699
- ..._stylex.props(styles$y.outer, customStyle),
23699
+ ..._stylex.props(styles$z.outer, customStyle),
23700
+ ref: forwardRef,
23700
23701
  children: [/* @__PURE__ */ jsxs("div", {
23701
23702
  ...{
23702
23703
  className: "mly78zum5 mly1q0g3np mly1qughib mly1nejdyq mlyu06os2"
@@ -23711,13 +23712,13 @@ function DatePicker({
23711
23712
  icon: "chevronLeft",
23712
23713
  onClick: () => {
23713
23714
  if (pickLevel === "day" || pickLevel === "week") {
23714
- setDate(hooks(date).subtract(1, "month").toDate());
23715
+ setDate(hooks.utc(date).subtract(1, "month").toDate());
23715
23716
  } else if (pickLevel === "month" || pickLevel === "quarter") {
23716
- setDate(hooks(date).subtract(1, "year").toDate());
23717
+ setDate(hooks.utc(date).subtract(1, "year").toDate());
23717
23718
  } else if (pickLevel === "year") {
23718
- setDate(hooks(date).subtract(10, "years").toDate());
23719
+ setDate(hooks.utc(date).subtract(10, "years").toDate());
23719
23720
  } else {
23720
- setDay(hooks(date).subtract(1, "days").toDate());
23721
+ setDay(hooks.utc(date).subtract(1, "days").toDate());
23721
23722
  }
23722
23723
  }
23723
23724
  })
@@ -23736,10 +23737,10 @@ function DatePicker({
23736
23737
  setPickLevel(maxLevel);
23737
23738
  }
23738
23739
  },
23739
- children: [(pickLevel === "day" || pickLevel === "week") && hooks(date).format("MMMM YYYY"), (pickLevel === "month" || pickLevel === "quarter") && hooks(date).format("YYYY"), pickLevel === "year" && /* @__PURE__ */ jsxs(Fragment, {
23740
+ children: [(pickLevel === "day" || pickLevel === "week") && hooks.utc(date).format("MMMM YYYY"), (pickLevel === "month" || pickLevel === "quarter") && hooks.utc(date).format("YYYY"), pickLevel === "year" && /* @__PURE__ */ jsxs(Fragment, {
23740
23741
  children: [yearBucket, "-", yearBucket + 9]
23741
23742
  }), (pickLevel === "hour" || pickLevel === "minute" || pickLevel === "second") && /* @__PURE__ */ jsx(Fragment, {
23742
- children: hooks(date).format("MMMM D, YYYY")
23743
+ children: hooks.utc(date).format("MMMM D, YYYY")
23743
23744
  })]
23744
23745
  }), /* @__PURE__ */ jsx("div", {
23745
23746
  ...{
@@ -23751,13 +23752,13 @@ function DatePicker({
23751
23752
  icon: "chevronRight",
23752
23753
  onClick: () => {
23753
23754
  if (pickLevel === "day" || pickLevel === "week") {
23754
- setDate(hooks(date).add(1, "month").toDate());
23755
+ setDate(hooks.utc(date).add(1, "month").toDate());
23755
23756
  } else if (pickLevel === "month" || pickLevel === "quarter") {
23756
- setDate(hooks(date).add(1, "year").toDate());
23757
+ setDate(hooks.utc(date).add(1, "year").toDate());
23757
23758
  } else if (pickLevel === "year") {
23758
- setDate(hooks(date).add(10, "years").toDate());
23759
+ setDate(hooks.utc(date).add(10, "years").toDate());
23759
23760
  } else {
23760
- setDay(hooks(date).add(1, "days").toDate());
23761
+ setDay(hooks.utc(date).add(1, "days").toDate());
23761
23762
  }
23762
23763
  }
23763
23764
  })
@@ -23964,25 +23965,25 @@ function DatePicker({
23964
23965
  },
23965
23966
  children: [/* @__PURE__ */ jsx(NumberInput, {
23966
23967
  label: "Hours",
23967
- value: parseInt(hooks(date).format("hh")),
23968
+ value: parseInt(hooks.utc(date).format("hh")),
23968
23969
  setValue: (hour12) => {
23969
- const amPm = hooks(date).hour() >= 12 ? "PM" : "AM";
23970
- const newHour24 = parseInt(hooks(`${hour12} ${amPm}`, ["hh A"]).format("H"));
23971
- setValue(hooks(date).hour(newHour24).toDate());
23970
+ const amPm = hooks.utc(date).hour() >= 12 ? "PM" : "AM";
23971
+ const newHour24 = parseInt(hooks.utc(`${hour12} ${amPm}`, ["hh A"]).format("H"));
23972
+ setValue(hooks.utc(date).hour(newHour24).toDate());
23972
23973
  },
23973
23974
  width: "40px"
23974
23975
  }), (units === "minute" || units === "second") && /* @__PURE__ */ jsx(NumberInput, {
23975
23976
  label: "Minutes",
23976
- value: hooks(date).minutes(),
23977
+ value: hooks.utc(date).minutes(),
23977
23978
  setValue: (minute) => {
23978
- setValue(hooks(date).minute(minute).toDate());
23979
+ setValue(hooks.utc(date).minute(minute).toDate());
23979
23980
  },
23980
23981
  width: "40px"
23981
23982
  }), units === "second" && /* @__PURE__ */ jsx(NumberInput, {
23982
23983
  label: "Seconds",
23983
- value: hooks(date).seconds(),
23984
+ value: hooks.utc(date).seconds(),
23984
23985
  setValue: (second) => {
23985
- setValue(hooks(date).second(second).toDate());
23986
+ setValue(hooks.utc(date).second(second).toDate());
23986
23987
  },
23987
23988
  width: "40px"
23988
23989
  }), /* @__PURE__ */ jsx("div", {
@@ -23992,11 +23993,11 @@ function DatePicker({
23992
23993
  flexDirection: "column"
23993
23994
  },
23994
23995
  children: /* @__PURE__ */ jsx(SelectDropdown, {
23995
- value: hooks(date).hour() >= 12 ? "PM" : "AM",
23996
+ value: hooks.utc(date).hour() >= 12 ? "PM" : "AM",
23996
23997
  onChange: (amPm) => {
23997
- const hour12 = parseInt(hooks(date).format("h"));
23998
- const newHour24 = parseInt(hooks(`${hour12} ${amPm}`, ["hh A"]).format("H"));
23999
- setValue(hooks(date).hour(newHour24).toDate());
23998
+ const hour12 = parseInt(hooks.utc(date).format("h"));
23999
+ const newHour24 = parseInt(hooks.utc(`${hour12} ${amPm}`, ["hh A"]).format("H"));
24000
+ setValue(hooks.utc(date).hour(newHour24).toDate());
24000
24001
  },
24001
24002
  options: [{
24002
24003
  value: "AM",
@@ -24011,7 +24012,7 @@ function DatePicker({
24011
24012
  })]
24012
24013
  });
24013
24014
  }
24014
- const styles$y = {
24015
+ const styles$z = {
24015
24016
  outer: {
24016
24017
  userSelect: "mly87ps6o",
24017
24018
  fontSize: "mlymhiqyu",
@@ -24020,7 +24021,7 @@ const styles$y = {
24020
24021
  }
24021
24022
  };
24022
24023
  function getCalendar(date) {
24023
- const firstDayOfMonth = hooks(date).date(1);
24024
+ const firstDayOfMonth = hooks.utc(date).date(1);
24024
24025
  const dow = firstDayOfMonth.day();
24025
24026
  const daysInMonth2 = firstDayOfMonth.daysInMonth();
24026
24027
  const daysInPreviousMonth = firstDayOfMonth.clone().subtract(1, "day").daysInMonth();
@@ -24097,7 +24098,7 @@ function Banner({
24097
24098
  className: "mly1q4ynmn mlyh8yej3 mly5yr21d mly78zum5 mlydt5ytf mly1kmqopl mly16zck5j"
24098
24099
  },
24099
24100
  children: [/* @__PURE__ */ jsxs("div", {
24100
- ..._stylex.props(styles$x.header, variantColors[variant], children ? styles$x.headerWithContent : null),
24101
+ ..._stylex.props(styles$y.header, variantColors[variant], children ? styles$y.headerWithContent : null),
24101
24102
  children: [/* @__PURE__ */ jsx("div", {
24102
24103
  ...{
24103
24104
  className: "mly1qx5ct2 mly78zum5 mlyl56j7k mly6s0dn4"
@@ -24110,22 +24111,22 @@ function Banner({
24110
24111
  className: "mly78zum5 mlydt5ytf mlyb3r6kr"
24111
24112
  },
24112
24113
  children: [/* @__PURE__ */ jsx("div", {
24113
- ..._stylex.props(styles$x.title, fontStyles.emphasized),
24114
+ ..._stylex.props(styles$y.title, fontStyles.emphasized),
24114
24115
  children: title
24115
24116
  }), /* @__PURE__ */ jsx("div", {
24116
- ..._stylex.props(styles$x.description, fontStyles.supporting),
24117
+ ..._stylex.props(styles$y.description, fontStyles.supporting),
24117
24118
  children: description
24118
24119
  })]
24119
24120
  })]
24120
24121
  }), children && /* @__PURE__ */ jsx("div", {
24121
- ..._stylex.props(styles$x.content, fontStyles.body),
24122
+ ..._stylex.props(styles$y.content, fontStyles.body),
24122
24123
  children: /* @__PURE__ */ jsx(ScrollableArea, {
24123
24124
  children
24124
24125
  })
24125
24126
  })]
24126
24127
  });
24127
24128
  }
24128
- const styles$x = {
24129
+ const styles$y = {
24129
24130
  header: {
24130
24131
  borderRadius: "mly1q4ynmn",
24131
24132
  borderStartStartRadius: null,
@@ -24267,14 +24268,14 @@ function AccordionList({
24267
24268
  onExpandedItemChange: handleExpandedItemChange
24268
24269
  },
24269
24270
  children: /* @__PURE__ */ jsx("div", {
24270
- ..._stylex.props(styles$w.main, customStyle),
24271
+ ..._stylex.props(styles$x.main, customStyle),
24271
24272
  children: React.Children.map(children, (child) => /* @__PURE__ */ jsxs(Fragment, {
24272
24273
  children: [child, /* @__PURE__ */ jsx(Divider, {})]
24273
24274
  }))
24274
24275
  })
24275
24276
  });
24276
24277
  }
24277
- const styles$w = {
24278
+ const styles$x = {
24278
24279
  main: {
24279
24280
  display: "mly78zum5",
24280
24281
  flexDirection: "mlydt5ytf",
@@ -24311,10 +24312,10 @@ function AccordionListItem({
24311
24312
  className: "mly78zum5 mlydt5ytf mlyb3r6kr mly1iyjqo2"
24312
24313
  },
24313
24314
  children: [/* @__PURE__ */ jsx("span", {
24314
- ..._stylex.props(fontStyles.body, styles$v.label),
24315
+ ..._stylex.props(fontStyles.body, styles$w.label),
24315
24316
  children: label
24316
24317
  }), sublabel && /* @__PURE__ */ jsx("span", {
24317
- ..._stylex.props(fontStyles.supporting, styles$v.sublabel),
24318
+ ..._stylex.props(fontStyles.supporting, styles$w.sublabel),
24318
24319
  children: sublabel
24319
24320
  })]
24320
24321
  }), badge && badge, endIcon && endIcon]
@@ -24326,7 +24327,7 @@ function AccordionListItem({
24326
24327
  })]
24327
24328
  });
24328
24329
  }
24329
- const styles$v = {
24330
+ const styles$w = {
24330
24331
  label: {
24331
24332
  flexGrow: "mly1iyjqo2",
24332
24333
  fontWeight: "mly1xlr1w8",
@@ -25117,40 +25118,6 @@ var MenuArrow = React.forwardRef(
25117
25118
  MenuArrow.displayName = ARROW_NAME$1;
25118
25119
  var SUB_NAME = "MenuSub";
25119
25120
  var [MenuSubProvider, useMenuSubContext] = createMenuContext(SUB_NAME);
25120
- var MenuSub = (props2) => {
25121
- const { __scopeMenu, children, open = false, onOpenChange } = props2;
25122
- const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu);
25123
- const popperScope = usePopperScope(__scopeMenu);
25124
- const [trigger, setTrigger] = React.useState(null);
25125
- const [content, setContent] = React.useState(null);
25126
- const handleOpenChange = useCallbackRef$1(onOpenChange);
25127
- React.useEffect(() => {
25128
- if (parentMenuContext.open === false) handleOpenChange(false);
25129
- return () => handleOpenChange(false);
25130
- }, [parentMenuContext.open, handleOpenChange]);
25131
- return /* @__PURE__ */ jsx(Root2$4, { ...popperScope, children: /* @__PURE__ */ jsx(
25132
- MenuProvider,
25133
- {
25134
- scope: __scopeMenu,
25135
- open,
25136
- onOpenChange: handleOpenChange,
25137
- content,
25138
- onContentChange: setContent,
25139
- children: /* @__PURE__ */ jsx(
25140
- MenuSubProvider,
25141
- {
25142
- scope: __scopeMenu,
25143
- contentId: useId(),
25144
- triggerId: useId(),
25145
- trigger,
25146
- onTriggerChange: setTrigger,
25147
- children
25148
- }
25149
- )
25150
- }
25151
- ) });
25152
- };
25153
- MenuSub.displayName = SUB_NAME;
25154
25121
  var SUB_TRIGGER_NAME$1 = "MenuSubTrigger";
25155
25122
  var MenuSubTrigger = React.forwardRef(
25156
25123
  (props2, forwardedRef) => {
@@ -25371,7 +25338,6 @@ var RadioItem = MenuRadioItem;
25371
25338
  var ItemIndicator = MenuItemIndicator;
25372
25339
  var Separator = MenuSeparator;
25373
25340
  var Arrow2 = MenuArrow;
25374
- var Sub = MenuSub;
25375
25341
  var SubTrigger = MenuSubTrigger;
25376
25342
  var SubContent = MenuSubContent;
25377
25343
  var DROPDOWN_MENU_NAME = "DropdownMenu";
@@ -25510,14 +25476,14 @@ var DropdownMenuGroup = React.forwardRef(
25510
25476
  );
25511
25477
  DropdownMenuGroup.displayName = GROUP_NAME;
25512
25478
  var LABEL_NAME = "DropdownMenuLabel";
25513
- var DropdownMenuLabel$1 = React.forwardRef(
25479
+ var DropdownMenuLabel = React.forwardRef(
25514
25480
  (props2, forwardedRef) => {
25515
25481
  const { __scopeDropdownMenu, ...labelProps } = props2;
25516
25482
  const menuScope = useMenuScope(__scopeDropdownMenu);
25517
25483
  return /* @__PURE__ */ jsx(Label, { ...menuScope, ...labelProps, ref: forwardedRef });
25518
25484
  }
25519
25485
  );
25520
- DropdownMenuLabel$1.displayName = LABEL_NAME;
25486
+ DropdownMenuLabel.displayName = LABEL_NAME;
25521
25487
  var ITEM_NAME = "DropdownMenuItem";
25522
25488
  var DropdownMenuItem$1 = React.forwardRef(
25523
25489
  (props2, forwardedRef) => {
@@ -25571,16 +25537,6 @@ var DropdownMenuArrow = React.forwardRef(
25571
25537
  }
25572
25538
  );
25573
25539
  DropdownMenuArrow.displayName = ARROW_NAME;
25574
- var DropdownMenuSub = (props2) => {
25575
- const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props2;
25576
- const menuScope = useMenuScope(__scopeDropdownMenu);
25577
- const [open = false, setOpen] = useControllableState({
25578
- prop: openProp,
25579
- defaultProp: defaultOpen,
25580
- onChange: onOpenChange
25581
- });
25582
- return /* @__PURE__ */ jsx(Sub, { ...menuScope, open, onOpenChange: setOpen, children });
25583
- };
25584
25540
  var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
25585
25541
  var DropdownMenuSubTrigger = React.forwardRef((props2, forwardedRef) => {
25586
25542
  const { __scopeDropdownMenu, ...subTriggerProps } = props2;
@@ -25617,11 +25573,7 @@ var Root2$1 = DropdownMenu$1;
25617
25573
  var Trigger$1 = DropdownMenuTrigger;
25618
25574
  var Portal2 = DropdownMenuPortal;
25619
25575
  var Content2 = DropdownMenuContent;
25620
- var Label2 = DropdownMenuLabel$1;
25621
25576
  var Item2 = DropdownMenuItem$1;
25622
- var Sub2 = DropdownMenuSub;
25623
- var SubTrigger2 = DropdownMenuSubTrigger;
25624
- var SubContent2 = DropdownMenuSubContent;
25625
25577
  function DropdownMenu({
25626
25578
  trigger,
25627
25579
  tooltip,
@@ -25660,7 +25612,7 @@ function DropdownMenu({
25660
25612
  children: trigger
25661
25613
  }), /* @__PURE__ */ jsx(Portal2, {
25662
25614
  children: /* @__PURE__ */ jsx(Content2, {
25663
- ..._stylex.props(fontStyles.body, styles$u.content),
25615
+ ..._stylex.props(fontStyles.body, styles$v.content),
25664
25616
  side: "bottom",
25665
25617
  align: "start",
25666
25618
  sideOffset: 4,
@@ -25687,79 +25639,22 @@ function DropdownMenuItem({
25687
25639
  disabled,
25688
25640
  children: [icon && /* @__PURE__ */ jsx(Icon, {
25689
25641
  name: icon,
25690
- customStyle: styles$u.icon
25642
+ customStyle: styles$v.icon
25691
25643
  }), /* @__PURE__ */ jsxs("div", {
25692
25644
  ...{
25693
25645
  className: "mly78zum5 mlydt5ytf mly1iyjqo2"
25694
25646
  },
25695
25647
  children: [/* @__PURE__ */ jsx("span", {
25696
- ..._stylex.props(fontStyles.body, styles$u.label),
25648
+ ..._stylex.props(fontStyles.body, styles$v.label),
25697
25649
  children: label
25698
25650
  }), sublabel && /* @__PURE__ */ jsx("span", {
25699
- ..._stylex.props(fontStyles.supporting, styles$u.sublabel),
25651
+ ..._stylex.props(fontStyles.supporting, styles$v.sublabel),
25700
25652
  children: sublabel
25701
25653
  })]
25702
25654
  })]
25703
25655
  });
25704
25656
  }
25705
- function DropdownSubMenuItem({
25706
- icon,
25707
- label,
25708
- sublabel,
25709
- disabled,
25710
- children,
25711
- open,
25712
- onOpenChange
25713
- }) {
25714
- const isControlled = open !== void 0 && onOpenChange !== void 0;
25715
- return /* @__PURE__ */ jsxs(Sub2, {
25716
- ...isControlled && {
25717
- open
25718
- },
25719
- children: [/* @__PURE__ */ jsxs(SubTrigger2, {
25720
- ...{
25721
- className: "mly78zum5 mly6s0dn4 mlye8ttls mly167g77z mly1kogg8i mly1ypdohk mly1a2a7pz mly1bw6wve mly5ezrf1 mly15rdse5 mly1z060rf mly5deeek mly1jacekv mly7ouyw2 mly7h4d18"
25722
- },
25723
- disabled,
25724
- ...isControlled && {
25725
- onClick: () => onOpenChange(!open)
25726
- },
25727
- children: [icon && /* @__PURE__ */ jsx(Icon, {
25728
- name: icon,
25729
- customStyle: styles$u.icon
25730
- }), /* @__PURE__ */ jsxs("div", {
25731
- ...{
25732
- className: "mly78zum5 mlydt5ytf mly1iyjqo2"
25733
- },
25734
- children: [/* @__PURE__ */ jsx("span", {
25735
- ..._stylex.props(fontStyles.body, styles$u.label),
25736
- children: label
25737
- }), sublabel && /* @__PURE__ */ jsx("span", {
25738
- ..._stylex.props(fontStyles.supporting, styles$u.sublabel),
25739
- children: sublabel
25740
- })]
25741
- }), !isControlled && /* @__PURE__ */ jsx(Icon, {
25742
- name: "chevronRight",
25743
- customStyle: styles$u.icon
25744
- })]
25745
- }), /* @__PURE__ */ jsx(SubContent2, {
25746
- ...{
25747
- className: "mly78zum5 mlydt5ytf mly1q4ynmn mlyotlr4g mly17fq3gk mlyfawy5m"
25748
- },
25749
- sideOffset: 5,
25750
- children: React.Children.map(children, (child) => child)
25751
- })]
25752
- });
25753
- }
25754
- function DropdownMenuLabel({
25755
- label
25756
- }) {
25757
- return /* @__PURE__ */ jsx(Label2, {
25758
- ..._stylex.props(fontStyles.supporting, styles$u.menuLabel),
25759
- children: label
25760
- });
25761
- }
25762
- const styles$u = {
25657
+ const styles$v = {
25763
25658
  content: {
25764
25659
  display: "mly78zum5",
25765
25660
  flexDirection: "mlydt5ytf",
@@ -25795,19 +25690,6 @@ const styles$u = {
25795
25690
  paddingBottom: null,
25796
25691
  $$css: true
25797
25692
  },
25798
- menuLabel: {
25799
- padding: "mlydqdrvq",
25800
- paddingInline: null,
25801
- paddingStart: null,
25802
- paddingLeft: null,
25803
- paddingEnd: null,
25804
- paddingRight: null,
25805
- paddingBlock: null,
25806
- paddingTop: null,
25807
- paddingBottom: null,
25808
- color: "mly9dwj6z",
25809
- $$css: true
25810
- },
25811
25693
  icon: {
25812
25694
  color: "mly1mguc6l",
25813
25695
  $$css: true
@@ -25830,7 +25712,9 @@ function QueryActionBar({
25830
25712
  const {
25831
25713
  rootQuery,
25832
25714
  setQuery,
25833
- source
25715
+ source,
25716
+ onCurrentNestQueryPanelChange,
25717
+ onCurrentNestViewChange
25834
25718
  } = useContext(QueryEditorContext);
25835
25719
  const {
25836
25720
  onCollapse
@@ -25842,6 +25726,10 @@ function QueryActionBar({
25842
25726
  runQuery(source, rootQuery.build());
25843
25727
  }
25844
25728
  };
25729
+ const focusMainQueryPanel = () => {
25730
+ onCurrentNestViewChange == null ? void 0 : onCurrentNestViewChange(null);
25731
+ onCurrentNestQueryPanelChange == null ? void 0 : onCurrentNestQueryPanelChange(null);
25732
+ };
25845
25733
  return /* @__PURE__ */ jsxs("div", {
25846
25734
  ...{
25847
25735
  className: "mly78zum5 mly1qughib mly6s0dn4 mlye8ttls"
@@ -25853,7 +25741,7 @@ function QueryActionBar({
25853
25741
  children: [/* @__PURE__ */ jsx(Icon, {
25854
25742
  name: "filterSliders"
25855
25743
  }), /* @__PURE__ */ jsx("div", {
25856
- ..._stylex.props(fontStyles.largeBody, styles$t.title),
25744
+ ..._stylex.props(fontStyles.largeBody, styles$u.title),
25857
25745
  children: "Query"
25858
25746
  })]
25859
25747
  }), /* @__PURE__ */ jsxs("div", {
@@ -25861,7 +25749,10 @@ function QueryActionBar({
25861
25749
  className: "mly78zum5 mly167g77z"
25862
25750
  },
25863
25751
  children: [/* @__PURE__ */ jsx(Button, {
25864
- onClick: () => setQuery == null ? void 0 : setQuery(void 0),
25752
+ onClick: () => {
25753
+ focusMainQueryPanel();
25754
+ setQuery == null ? void 0 : setQuery(void 0);
25755
+ },
25865
25756
  isDisabled: !rootQuery || (rootQuery == null ? void 0 : rootQuery.isEmpty()),
25866
25757
  label: "Clear",
25867
25758
  variant: "flat",
@@ -25895,13 +25786,13 @@ function QueryActionBar({
25895
25786
  })]
25896
25787
  });
25897
25788
  }
25898
- const styles$t = {
25789
+ const styles$u = {
25899
25790
  title: {
25900
25791
  fontWeight: "mly1xlr1w8",
25901
25792
  $$css: true
25902
25793
  }
25903
25794
  };
25904
- const styles$s = {
25795
+ const styles$t = {
25905
25796
  labelWithIcon: {
25906
25797
  display: "mly78zum5",
25907
25798
  alignItems: "mly6s0dn4",
@@ -30020,32 +29911,32 @@ function BadgeForField({
30020
29911
  label: "view",
30021
29912
  icon: "view_filled",
30022
29913
  color: "purple",
30023
- customStyle: styles$r.noBackground
29914
+ customStyle: styles$s.noBackground
30024
29915
  });
30025
29916
  } else if (field.kind === "dimension") {
30026
29917
  return /* @__PURE__ */ jsx(Badge, {
30027
29918
  label: "dimension",
30028
29919
  icon: fieldToIcon(field),
30029
29920
  color: "cyan",
30030
- customStyle: styles$r.noBackground
29921
+ customStyle: styles$s.noBackground
30031
29922
  });
30032
29923
  } else if (field.kind === "measure") {
30033
29924
  return /* @__PURE__ */ jsx(Badge, {
30034
29925
  label: "measure",
30035
29926
  icon: fieldToIcon(field),
30036
29927
  color: "green",
30037
- customStyle: styles$r.noBackground
29928
+ customStyle: styles$s.noBackground
30038
29929
  });
30039
29930
  } else if (field.kind === "join") {
30040
29931
  return /* @__PURE__ */ jsx(Badge, {
30041
29932
  label: "join",
30042
29933
  icon: fieldToIcon(field),
30043
29934
  color: "gray",
30044
- customStyle: styles$r.noBackground
29935
+ customStyle: styles$s.noBackground
30045
29936
  });
30046
29937
  }
30047
29938
  }
30048
- const styles$r = {
29939
+ const styles$s = {
30049
29940
  noBackground: {
30050
29941
  backgroundColor: "mlyjbqb8w",
30051
29942
  $$css: true
@@ -30074,7 +29965,7 @@ function Visualization$1({
30074
29965
  onClick: () => setRenderer(viz)
30075
29966
  }));
30076
29967
  const tokens2 = [/* @__PURE__ */ jsx(SelectorToken, {
30077
- customStyle: styles$q.first,
29968
+ customStyle: styles$r.first,
30078
29969
  icon: `viz_${currentRenderer}`,
30079
29970
  value: currentRenderer,
30080
29971
  items: vizes,
@@ -30084,7 +29975,7 @@ function Visualization$1({
30084
29975
  children: tokens2
30085
29976
  });
30086
29977
  }
30087
- const styles$q = {
29978
+ const styles$r = {
30088
29979
  first: {
30089
29980
  flexGrow: "mly1iyjqo2",
30090
29981
  justifyContent: "mlylqzeqv",
@@ -30113,7 +30004,7 @@ function ViewAttributeTable({
30113
30004
  }) {
30114
30005
  const dimensions = viewInfo.schema.fields.filter((f2) => f2.kind === "dimension");
30115
30006
  return /* @__PURE__ */ jsx("div", {
30116
- ..._stylex.props(styles$p.attributeTableContainer, style),
30007
+ ..._stylex.props(styles$q.attributeTableContainer, style),
30117
30008
  children: /* @__PURE__ */ jsx(ScrollableArea, {
30118
30009
  children: /* @__PURE__ */ jsx("table", {
30119
30010
  ...{
@@ -30153,9 +30044,9 @@ function ViewAttributeTableRow({
30153
30044
  className: "mlydpxx8g"
30154
30045
  },
30155
30046
  children: [/* @__PURE__ */ jsx("td", {
30156
- ..._stylex.props(styles$p.attributeTableKeyCell, fontStyles.supporting),
30047
+ ..._stylex.props(styles$q.attributeTableKeyCell, fontStyles.supporting),
30157
30048
  children: /* @__PURE__ */ jsx("div", {
30158
- ..._stylex.props(styles$p.attributeTableKeyCellContent, fontStyles.supporting),
30049
+ ..._stylex.props(styles$q.attributeTableKeyCellContent, fontStyles.supporting),
30159
30050
  children: attribute
30160
30051
  })
30161
30052
  }), /* @__PURE__ */ jsx("td", {
@@ -30166,7 +30057,7 @@ function ViewAttributeTableRow({
30166
30057
  })]
30167
30058
  });
30168
30059
  }
30169
- const styles$p = {
30060
+ const styles$q = {
30170
30061
  attributeTableContainer: {
30171
30062
  padding: "mlye8ttls",
30172
30063
  paddingInline: null,
@@ -30314,7 +30205,7 @@ function HoverText({
30314
30205
  asChild: true,
30315
30206
  children: /* @__PURE__ */ jsx("div", {
30316
30207
  ref: textRef,
30317
- ..._stylex.props(styles$o.text, fontStyles.supporting),
30208
+ ..._stylex.props(styles$p.text, fontStyles.supporting),
30318
30209
  children: text2
30319
30210
  })
30320
30211
  }), /* @__PURE__ */ jsx(Portal$4, {
@@ -30322,7 +30213,7 @@ function HoverText({
30322
30213
  side,
30323
30214
  align,
30324
30215
  children: /* @__PURE__ */ jsx("pre", {
30325
- ..._stylex.props(styles$o.hoverText, fontStyles.tooltipText),
30216
+ ..._stylex.props(styles$p.hoverText, fontStyles.tooltipText),
30326
30217
  children: text2
30327
30218
  })
30328
30219
  })
@@ -30331,7 +30222,7 @@ function HoverText({
30331
30222
  })
30332
30223
  });
30333
30224
  }
30334
- const styles$o = {
30225
+ const styles$p = {
30335
30226
  text: {
30336
30227
  overflow: "mlyb3r6kr",
30337
30228
  overflowX: null,
@@ -30384,11 +30275,11 @@ function HoverCard({
30384
30275
  customStyle
30385
30276
  }) {
30386
30277
  return /* @__PURE__ */ jsx("div", {
30387
- ..._stylex.props(styles$n.container, fontStyles.body, customStyle),
30278
+ ..._stylex.props(styles$o.container, fontStyles.body, customStyle),
30388
30279
  children
30389
30280
  });
30390
30281
  }
30391
- const styles$n = {
30282
+ const styles$o = {
30392
30283
  container: {
30393
30284
  boxShadow: "mly5n1uv4",
30394
30285
  backgroundColor: "mly12peec7",
@@ -30433,7 +30324,7 @@ function FieldHoverCard({
30433
30324
  details = /* @__PURE__ */ jsx(ViewAttributeTable, {
30434
30325
  viewInfo: field,
30435
30326
  isCompact: true,
30436
- style: styles$m.viewAttributeTable
30327
+ style: styles$n.viewAttributeTable
30437
30328
  });
30438
30329
  } else if (field.kind === "dimension") {
30439
30330
  details = /* @__PURE__ */ jsx(TopValuesTable, {
@@ -30442,7 +30333,7 @@ function FieldHoverCard({
30442
30333
  });
30443
30334
  }
30444
30335
  return /* @__PURE__ */ jsxs(HoverCard, {
30445
- customStyle: styles$m.container,
30336
+ customStyle: styles$n.container,
30446
30337
  children: [/* @__PURE__ */ jsxs("div", {
30447
30338
  children: [/* @__PURE__ */ jsx("div", {
30448
30339
  ...{
@@ -30452,10 +30343,10 @@ function FieldHoverCard({
30452
30343
  field
30453
30344
  })
30454
30345
  }), /* @__PURE__ */ jsx("div", {
30455
- ..._stylex.props(fontStyles.supporting, styles$m.path),
30346
+ ..._stylex.props(fontStyles.supporting, styles$n.path),
30456
30347
  children: pathString
30457
30348
  }), /* @__PURE__ */ jsx("div", {
30458
- ..._stylex.props(fontStyles.emphasized, styles$m.title),
30349
+ ..._stylex.props(fontStyles.emphasized, styles$n.title),
30459
30350
  children: field.name
30460
30351
  }), description && /* @__PURE__ */ jsx(HoverText, {
30461
30352
  text: description
@@ -30465,7 +30356,7 @@ function FieldHoverCard({
30465
30356
  })]
30466
30357
  });
30467
30358
  }
30468
- const styles$m = {
30359
+ const styles$n = {
30469
30360
  container: {
30470
30361
  width: "mlybl57os",
30471
30362
  maxHeight: "mlyq3t0pi",
@@ -30757,10 +30648,10 @@ const PillInput = ({
30757
30648
  commitValue();
30758
30649
  });
30759
30650
  return /* @__PURE__ */ jsx("div", {
30760
- ..._stylex.props(fontStyles.body, styles$l.main),
30651
+ ..._stylex.props(fontStyles.body, styles$m.main),
30761
30652
  children: /* @__PURE__ */ jsx(ScrollableArea, {
30762
30653
  children: /* @__PURE__ */ jsxs("div", {
30763
- ..._stylex.props(styles$l.content, customStyle),
30654
+ ..._stylex.props(styles$m.content, customStyle),
30764
30655
  onKeyUp,
30765
30656
  onClick: () => {
30766
30657
  var _a2;
@@ -30827,7 +30718,7 @@ const Pill = ({
30827
30718
  onClick,
30828
30719
  tabIndex: 0,
30829
30720
  ref: forwardRef,
30830
- ..._stylex.props(styles$l.pill, colorVariants[color]),
30721
+ ..._stylex.props(styles$m.pill, colorVariants[color]),
30831
30722
  children: [children, /* @__PURE__ */ jsx("div", {
30832
30723
  title: "Remove",
30833
30724
  ...{
@@ -30842,7 +30733,7 @@ const Pill = ({
30842
30733
  })]
30843
30734
  });
30844
30735
  };
30845
- const styles$l = {
30736
+ const styles$m = {
30846
30737
  main: {
30847
30738
  borderRadius: "mly12oqio5",
30848
30739
  borderStartStartRadius: null,
@@ -31026,7 +30917,7 @@ function ValueList({
31026
30917
  children: (stringSearchResults == null ? void 0 : stringSearchResults.length) ? stringSearchResults.map((value) => /* @__PURE__ */ jsxs("div", {
31027
30918
  role: "menuitem",
31028
30919
  tabIndex: -1,
31029
- ..._stylex.props(addMenuStyles.item, styles$k.valueItem),
30920
+ ..._stylex.props(addMenuStyles.item, styles$l.valueItem),
31030
30921
  onClick: () => onClick(value),
31031
30922
  children: [/* @__PURE__ */ jsx(Value, {
31032
30923
  value
@@ -31050,10 +30941,10 @@ function Value({
31050
30941
  label: value.fieldValue ?? "∅",
31051
30942
  icon: "filter",
31052
30943
  color: "purple",
31053
- customStyle: styles$k.token
30944
+ customStyle: styles$l.token
31054
30945
  });
31055
30946
  }
31056
- const styles$k = {
30947
+ const styles$l = {
31057
30948
  valueItem: {
31058
30949
  height: "mly1qx5ct2",
31059
30950
  paddingTop: "mly1y1aw1k",
@@ -31229,7 +31120,7 @@ const StringFilterCore = ({
31229
31120
  setSearchValue("");
31230
31121
  }
31231
31122
  },
31232
- customStyle: styles$j.valueList
31123
+ customStyle: styles$k.valueList
31233
31124
  })
31234
31125
  })]
31235
31126
  }) : currentFilter.operator === "~" ? /* @__PURE__ */ jsx(StringEditor, {
@@ -31297,7 +31188,7 @@ function stringFilterChangeType(filter, type) {
31297
31188
  };
31298
31189
  }
31299
31190
  }
31300
- const styles$j = {
31191
+ const styles$k = {
31301
31192
  valueList: {
31302
31193
  maxHeight: "mly3d5gib",
31303
31194
  width: "mly1hfn5x7",
@@ -31581,15 +31472,16 @@ const DateInput = ({
31581
31472
  onFocus,
31582
31473
  onBlur,
31583
31474
  isActive,
31584
- customStyle
31475
+ customStyle,
31476
+ forwardRef
31585
31477
  }) => {
31586
31478
  const format2 = formats[units];
31587
- const [tempValue, setTempValue] = useState(hooks(value).format(format2));
31479
+ const [tempValue, setTempValue] = useState(hooks.utc(value).format(format2));
31588
31480
  useEffect(() => {
31589
- setTempValue(hooks(value).format(format2));
31481
+ setTempValue(hooks.utc(value).format(format2));
31590
31482
  }, [value, format2]);
31591
31483
  return /* @__PURE__ */ jsx("input", {
31592
- ..._stylex.props(customStyle, isActive ? styles$i.active : null),
31484
+ ..._stylex.props(customStyle, isActive ? styles$j.active : null),
31593
31485
  type: "text",
31594
31486
  placeholder: placeholder || format2,
31595
31487
  value: tempValue,
@@ -31600,13 +31492,14 @@ const DateInput = ({
31600
31492
  setTempValue(raw2);
31601
31493
  const regex = regexps[units];
31602
31494
  if (raw2.match(regex)) {
31603
- const m = hooks(raw2, format2);
31495
+ const m = hooks.utc(raw2, format2);
31604
31496
  if (m.isValid()) {
31605
31497
  setValue(m.toDate());
31606
31498
  }
31607
31499
  }
31608
31500
  },
31609
- autoFocus
31501
+ autoFocus,
31502
+ ref: forwardRef
31610
31503
  });
31611
31504
  };
31612
31505
  function guessUnits(moment2, isDateTime) {
@@ -31623,7 +31516,7 @@ function guessUnits(moment2, isDateTime) {
31623
31516
  }
31624
31517
  return isDateTime ? "second" : "day";
31625
31518
  }
31626
- const styles$i = {
31519
+ const styles$j = {
31627
31520
  active: {
31628
31521
  backgroundColor: "mly1vzefiq",
31629
31522
  $$css: true
@@ -31636,7 +31529,7 @@ function typeFromFilter(filter) {
31636
31529
  return filter.operator;
31637
31530
  }
31638
31531
  function unitsFromFilter(filter, isDateTime) {
31639
- if (filter.operator === "last" || filter.operator === "next") {
31532
+ if (filter.operator === "last" || filter.operator === "next" || filter.operator === "in_last") {
31640
31533
  return filter.units;
31641
31534
  } else if (filter.operator === "to") {
31642
31535
  return guessUnits(filter.fromMoment, isDateTime);
@@ -31678,11 +31571,14 @@ const DateTimeFilterCore = ({
31678
31571
  value: type,
31679
31572
  onChange: changeType,
31680
31573
  options: [{
31681
- value: "last",
31574
+ value: "in_last",
31682
31575
  label: "last"
31576
+ }, {
31577
+ value: "last",
31578
+ label: "last complete"
31683
31579
  }, {
31684
31580
  value: "next",
31685
- label: "next"
31581
+ label: "next complete"
31686
31582
  }, {
31687
31583
  value: "after",
31688
31584
  label: "after"
@@ -31709,6 +31605,7 @@ const DateTimeFilterCore = ({
31709
31605
  };
31710
31606
  function getTopEditorRow(currentFilter, updateFilter, units, setUnits, maxLevel) {
31711
31607
  switch (currentFilter.operator) {
31608
+ case "in_last":
31712
31609
  case "last":
31713
31610
  case "next":
31714
31611
  return /* @__PURE__ */ jsx(NUnitFilter, {
@@ -31954,12 +31851,12 @@ function DoubleDateFilter({
31954
31851
  function createTemporalLiteral(date, units) {
31955
31852
  return {
31956
31853
  moment: "literal",
31957
- literal: hooks(date).format(formats[units])
31854
+ literal: hooks.utc(date).format(formats[units])
31958
31855
  };
31959
31856
  }
31960
31857
  function extractDateFromMoment(momentObj) {
31961
31858
  if (momentObj && momentObj.moment === "literal") {
31962
- return hooks(momentObj.literal).toDate();
31859
+ return hooks.utc(momentObj.literal).toDate();
31963
31860
  }
31964
31861
  return /* @__PURE__ */ new Date();
31965
31862
  }
@@ -31968,6 +31865,7 @@ function dateTimeFilterChangeType(filter, type, units) {
31968
31865
  let fromMoment = createTemporalLiteral(/* @__PURE__ */ new Date(), units);
31969
31866
  let toMoment = createTemporalLiteral(/* @__PURE__ */ new Date(), units);
31970
31867
  switch (filter.operator) {
31868
+ case "in_last":
31971
31869
  case "last":
31972
31870
  case "next":
31973
31871
  n = filter.n;
@@ -31987,6 +31885,7 @@ function dateTimeFilterChangeType(filter, type, units) {
31987
31885
  break;
31988
31886
  }
31989
31887
  switch (type) {
31888
+ case "in_last":
31990
31889
  case "last":
31991
31890
  case "next":
31992
31891
  return {
@@ -32172,12 +32071,17 @@ function FilterPopover({
32172
32071
  setFilter,
32173
32072
  trigger,
32174
32073
  anchor,
32175
- layoutProps
32074
+ layoutProps,
32075
+ onOpenChange
32176
32076
  }) {
32177
32077
  const [open, setOpen] = useState(false);
32078
+ const handleOpenChange = (open2) => {
32079
+ setOpen(open2);
32080
+ onOpenChange == null ? void 0 : onOpenChange(open2);
32081
+ };
32178
32082
  return /* @__PURE__ */ jsxs(Root2$2, {
32179
32083
  open,
32180
- onOpenChange: setOpen,
32084
+ onOpenChange: handleOpenChange,
32181
32085
  modal: true,
32182
32086
  children: [anchor ? /* @__PURE__ */ jsx(Anchor2$1, {
32183
32087
  asChild: true,
@@ -32196,7 +32100,7 @@ function FilterPopover({
32196
32100
  filter,
32197
32101
  path,
32198
32102
  onFilterApply: setFilter,
32199
- onOpenChange: setOpen
32103
+ onOpenChange: handleOpenChange
32200
32104
  })
32201
32105
  })
32202
32106
  })]
@@ -32217,7 +32121,7 @@ function FieldList({
32217
32121
  const groups2 = [];
32218
32122
  const lcSearch = search.toLocaleLowerCase();
32219
32123
  const buildGroups = (types22, path, name, fields2) => {
32220
- 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);
32124
+ 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);
32221
32125
  const joins = fields2.filter((field) => field.kind === "join");
32222
32126
  const arraysAndRecords = fields2.filter(isArrayOrRecord);
32223
32127
  if (filteredFields.length) {
@@ -32257,7 +32161,7 @@ function FieldList({
32257
32161
  ..._stylex.props(customStyle),
32258
32162
  children: groups.length ? groups.map((group) => /* @__PURE__ */ jsxs("div", {
32259
32163
  children: [/* @__PURE__ */ jsx("div", {
32260
- ..._stylex.props(addMenuStyles.item, styles$h.fieldItem),
32164
+ ..._stylex.props(addMenuStyles.item, styles$i.fieldItem),
32261
32165
  "data-disabled": "true",
32262
32166
  children: group.name
32263
32167
  }), group.fields.map((field) => isFilterOperation && (field.kind === "dimension" || field.kind === "measure") ? /* @__PURE__ */ jsx(FilterPopover, {
@@ -32267,7 +32171,7 @@ function FieldList({
32267
32171
  anchor: /* @__PURE__ */ jsx("div", {
32268
32172
  role: "menuitem",
32269
32173
  tabIndex: -1,
32270
- ..._stylex.props(addMenuStyles.item, styles$h.fieldItem),
32174
+ ..._stylex.props(addMenuStyles.item, styles$i.fieldItem),
32271
32175
  children: /* @__PURE__ */ jsx(PopoverTrigger, {
32272
32176
  asChild: true,
32273
32177
  children: /* @__PURE__ */ jsx(FieldToken, {
@@ -32294,7 +32198,7 @@ function FieldList({
32294
32198
  }, group.name + ":" + field.name) : /* @__PURE__ */ jsx("div", {
32295
32199
  role: "menuitem",
32296
32200
  tabIndex: -1,
32297
- ..._stylex.props(addMenuStyles.item, styles$h.fieldItem),
32201
+ ..._stylex.props(addMenuStyles.item, styles$i.fieldItem),
32298
32202
  children: /* @__PURE__ */ jsx(FieldToken, {
32299
32203
  field,
32300
32204
  onClick: () => onAddOperation(field, group.path),
@@ -32317,7 +32221,7 @@ function FieldList({
32317
32221
  })
32318
32222
  });
32319
32223
  }
32320
- const styles$h = {
32224
+ const styles$i = {
32321
32225
  fieldItem: {
32322
32226
  height: "mly1qx5ct2",
32323
32227
  paddingTop: "mly1y1aw1k",
@@ -32335,7 +32239,7 @@ function FieldMenu({
32335
32239
  }) {
32336
32240
  const [search, setSearch] = useState("");
32337
32241
  return /* @__PURE__ */ jsxs("div", {
32338
- ..._stylex.props(addMenuStyles.content, styles$g.content),
32242
+ ..._stylex.props(addMenuStyles.content, styles$h.content),
32339
32243
  role: "menu",
32340
32244
  children: [/* @__PURE__ */ jsx("div", {
32341
32245
  ..._stylex.props(addMenuStyles.item),
@@ -32361,7 +32265,7 @@ function FieldMenu({
32361
32265
  })]
32362
32266
  });
32363
32267
  }
32364
- const styles$g = {
32268
+ const styles$h = {
32365
32269
  content: {
32366
32270
  maxHeight: "mly3d5gib",
32367
32271
  $$css: true
@@ -32376,14 +32280,12 @@ function segmentHasOrderBy(segment, name) {
32376
32280
  function segmentNestNo(segment, name) {
32377
32281
  return segment.operations.items.reduce((acc, operation) => {
32378
32282
  if (operation instanceof ASTNestViewOperation) {
32379
- if (name) {
32283
+ {
32380
32284
  if (operation.name === name) {
32381
32285
  do {
32382
32286
  acc += 1;
32383
32287
  } while (segment.hasFieldNamed(`${name} ${acc}`));
32384
32288
  }
32385
- } else {
32386
- return acc + 1;
32387
32289
  }
32388
32290
  }
32389
32291
  return acc;
@@ -32447,7 +32349,7 @@ function OperationActionTitle({
32447
32349
  return !(segment == null ? void 0 : segment.hasField(field.name, path)) && isNotAnnotatedFilteredField(field);
32448
32350
  };
32449
32351
  return /* @__PURE__ */ jsxs("div", {
32450
- ..._stylex.props(styles$s.title, hoverStyles.main),
32352
+ ..._stylex.props(styles$t.title, hoverStyles.main),
32451
32353
  children: [/* @__PURE__ */ jsx("div", {
32452
32354
  children: title
32453
32355
  }), /* @__PURE__ */ jsx("div", {
@@ -33017,7 +32919,7 @@ function SortableOperations({
33017
32919
  fields,
33018
32920
  ...props2
33019
32921
  }), /* @__PURE__ */ jsx("div", {
33020
- ..._stylex.props(styles$s.tokenContainer),
32922
+ ..._stylex.props(styles$t.tokenContainer),
33021
32923
  children: /* @__PURE__ */ jsx(DndContext, {
33022
32924
  sensors,
33023
32925
  collisionDetection: closestCenter,
@@ -33167,10 +33069,10 @@ function FilterOperations({
33167
33069
  }
33168
33070
  return /* @__PURE__ */ jsxs("div", {
33169
33071
  children: [/* @__PURE__ */ jsx("div", {
33170
- ..._stylex.props(styles$s.title),
33072
+ ..._stylex.props(styles$t.title),
33171
33073
  children: "filter by"
33172
33074
  }), /* @__PURE__ */ jsx("div", {
33173
- ..._stylex.props(styles$s.tokenContainer),
33075
+ ..._stylex.props(styles$t.tokenContainer),
33174
33076
  children: filters.map((filterOperation, key2) => {
33175
33077
  return /* @__PURE__ */ jsx(ErrorElement, {
33176
33078
  fallback: /* @__PURE__ */ jsxs("div", {
@@ -33377,7 +33279,7 @@ const parsedToLabels = (parsed, filterString) => {
33377
33279
  const {
33378
33280
  not
33379
33281
  } = temporalClause;
33380
- op = `is${not ? " not" : ""} last`;
33282
+ op = `is${not ? " not" : ""} last complete`;
33381
33283
  value = temporalClause.n + " " + temporalClause.units;
33382
33284
  }
33383
33285
  break;
@@ -33386,7 +33288,7 @@ const parsedToLabels = (parsed, filterString) => {
33386
33288
  const {
33387
33289
  not
33388
33290
  } = temporalClause;
33389
- op = `is${not ? " not" : ""} nest`;
33291
+ op = `is${not ? " not" : ""} next complete`;
33390
33292
  value = temporalClause.n + " " + temporalClause.units;
33391
33293
  }
33392
33294
  break;
@@ -33434,7 +33336,7 @@ function LimitOperation({
33434
33336
  }
33435
33337
  return /* @__PURE__ */ jsxs("div", {
33436
33338
  children: [/* @__PURE__ */ jsx("div", {
33437
- ..._stylex.props(styles$s.title),
33339
+ ..._stylex.props(styles$t.title),
33438
33340
  children: "limit"
33439
33341
  }), /* @__PURE__ */ jsxs("div", {
33440
33342
  ..._stylex.props(hoverStyles.main),
@@ -33484,10 +33386,10 @@ function OrderByOperations({
33484
33386
  }
33485
33387
  return /* @__PURE__ */ jsxs("div", {
33486
33388
  children: [/* @__PURE__ */ jsx("div", {
33487
- ..._stylex.props(styles$s.title),
33389
+ ..._stylex.props(styles$t.title),
33488
33390
  children: "order by"
33489
33391
  }), /* @__PURE__ */ jsx("div", {
33490
- ..._stylex.props(styles$s.tokenContainer),
33392
+ ..._stylex.props(styles$t.tokenContainer),
33491
33393
  children: orderBys.map((orderBy) => {
33492
33394
  const {
33493
33395
  fieldReference
@@ -33561,13 +33463,19 @@ function CollapsiblePanel({
33561
33463
  icon,
33562
33464
  defaultOpen = true,
33563
33465
  controls,
33564
- collapsedControls
33466
+ collapsedControls,
33467
+ isFocused = false
33565
33468
  }) {
33566
33469
  const [isExpanded, setIsExpanded] = useState(defaultOpen);
33567
33470
  return /* @__PURE__ */ jsxs("div", {
33568
33471
  ...{
33569
- className: "mlyzkdzjc mly1sxf85j mly1717udv"
33570
- },
33472
+ 0: {
33473
+ className: "mlygbc89k mly1sxf85j mly1717udv"
33474
+ },
33475
+ 1: {
33476
+ className: "mly1sxf85j mly1717udv mlybwr872"
33477
+ }
33478
+ }[!!isFocused << 0],
33571
33479
  children: [/* @__PURE__ */ jsxs("div", {
33572
33480
  ...{
33573
33481
  className: "mlyrvj5dj mly1mt1orb mly52fmzj mlylqzeqv mlyfawy5m mly167g77z mly6s0dn4"
@@ -33578,7 +33486,7 @@ function CollapsiblePanel({
33578
33486
  },
33579
33487
  children: [icon && /* @__PURE__ */ jsx(Icon, {
33580
33488
  name: icon,
33581
- customStyle: styles$f.icon
33489
+ customStyle: styles$g.icon
33582
33490
  }), /* @__PURE__ */ jsx("div", {
33583
33491
  ...{
33584
33492
  className: "mlyuxw1ft mlyb3r6kr mlylyipyv mlyehqz9p mly1ghz6dp"
@@ -33615,7 +33523,7 @@ function CollapsiblePanel({
33615
33523
  })]
33616
33524
  });
33617
33525
  }
33618
- const styles$f = {
33526
+ const styles$g = {
33619
33527
  icon: {
33620
33528
  $$css: true
33621
33529
  }
@@ -33638,7 +33546,7 @@ function AddItem({
33638
33546
  children: /* @__PURE__ */ jsxs("div", {
33639
33547
  role: "menuitem",
33640
33548
  tabIndex: -1,
33641
- ..._stylex.props(addMenuStyles.item, addMenuStyles.clickable, open ? styles$e.open : null),
33549
+ ..._stylex.props(addMenuStyles.item, addMenuStyles.clickable, open ? styles$f.open : null),
33642
33550
  onClick: doOnClick,
33643
33551
  "data-disabled": disabled ? "true" : void 0,
33644
33552
  children: [/* @__PURE__ */ jsxs("div", {
@@ -33662,7 +33570,7 @@ function AddItem({
33662
33570
  }) : null]
33663
33571
  });
33664
33572
  }
33665
- const styles$e = {
33573
+ const styles$f = {
33666
33574
  open: {
33667
33575
  background: "mly16o7sp0",
33668
33576
  backgroundAttachment: null,
@@ -33737,10 +33645,10 @@ function AddFieldItem({
33737
33645
  onAddOperation,
33738
33646
  isFilterOperation,
33739
33647
  search,
33740
- customStyle: styles$d.list
33648
+ customStyle: styles$e.list
33741
33649
  });
33742
33650
  }
33743
- const styles$d = {
33651
+ const styles$e = {
33744
33652
  list: {
33745
33653
  width: "mlyqyf9gi",
33746
33654
  $$css: true
@@ -33944,7 +33852,7 @@ function AddMenu({
33944
33852
  value: search,
33945
33853
  onChange: setSearch,
33946
33854
  placeholder: "Search...",
33947
- customStyle: styles$c.search
33855
+ customStyle: styles$d.search
33948
33856
  })
33949
33857
  }), /* @__PURE__ */ jsx(Divider, {}), /* @__PURE__ */ jsxs("div", {
33950
33858
  ...{
@@ -34065,7 +33973,7 @@ function AddMenu({
34065
33973
  })]
34066
33974
  });
34067
33975
  }
34068
- const styles$c = {
33976
+ const styles$d = {
34069
33977
  search: {
34070
33978
  width: "mlyh8yej3",
34071
33979
  $$css: true
@@ -34080,7 +33988,7 @@ function NestOperations({
34080
33988
  return null;
34081
33989
  }
34082
33990
  return /* @__PURE__ */ jsx("div", {
34083
- ..._stylex.props(styles$s.tokenContainer),
33991
+ ..._stylex.props(styles$t.tokenContainer),
34084
33992
  children: nests.map((nest) => /* @__PURE__ */ jsx(NestOperation, {
34085
33993
  rootQuery,
34086
33994
  view,
@@ -34094,9 +34002,31 @@ function NestOperation({
34094
34002
  nest
34095
34003
  }) {
34096
34004
  const {
34097
- setQuery
34005
+ setQuery,
34006
+ currentNestQueryPanel,
34007
+ onCurrentNestQueryPanelChange,
34008
+ onCurrentNestViewChange
34098
34009
  } = useContext(QueryEditorContext);
34099
34010
  const [renameOpen, setRenameOpen] = useState(false);
34011
+ const panelRef = React.useRef(null);
34012
+ const isCurrentNestQueryPanelFocused = currentNestQueryPanel !== null && panelRef.current == currentNestQueryPanel;
34013
+ React.useEffect(() => {
34014
+ if (isCurrentNestQueryPanelFocused) {
34015
+ onCurrentNestViewChange == null ? void 0 : onCurrentNestViewChange(nest.view);
34016
+ }
34017
+ }, [nest, isCurrentNestQueryPanelFocused, onCurrentNestViewChange]);
34018
+ const focusCurrentNestQueryPanel = () => {
34019
+ onCurrentNestQueryPanelChange == null ? void 0 : onCurrentNestQueryPanelChange(panelRef.current);
34020
+ onCurrentNestViewChange == null ? void 0 : onCurrentNestViewChange(nest.view);
34021
+ };
34022
+ const focusParentQueryPanel = () => {
34023
+ const currentPanel = panelRef.current;
34024
+ const parent = findParentNestQueryPanel(currentPanel);
34025
+ onCurrentNestQueryPanelChange == null ? void 0 : onCurrentNestQueryPanelChange(parent);
34026
+ if (parent === null) {
34027
+ onCurrentNestViewChange == null ? void 0 : onCurrentNestViewChange(null);
34028
+ }
34029
+ };
34100
34030
  const defaultOpen = nest.view.definition.node.kind === "segment" && nest.view.definition.node.operations.length === 0;
34101
34031
  const getControls = (nest2) => /* @__PURE__ */ jsxs(Fragment, {
34102
34032
  children: [/* @__PURE__ */ jsxs(DropdownMenu, {
@@ -34110,6 +34040,7 @@ function NestOperation({
34110
34040
  icon: "clear",
34111
34041
  label: "Delete Query",
34112
34042
  onClick: () => {
34043
+ focusParentQueryPanel();
34113
34044
  nest2.delete();
34114
34045
  setQuery == null ? void 0 : setQuery(rootQuery.build());
34115
34046
  }
@@ -34124,29 +34055,41 @@ function NestOperation({
34124
34055
  view: nest2.view
34125
34056
  })]
34126
34057
  });
34127
- return /* @__PURE__ */ jsxs("div", {
34058
+ return /* @__PURE__ */ jsx("div", {
34128
34059
  ...{
34129
34060
  className: "mlyj3b58b mly1yf7rl7 mly1xmf6yo mlyh8yej3"
34130
34061
  },
34131
- children: [/* @__PURE__ */ jsx(CollapsiblePanel, {
34132
- title: nest.name,
34133
- icon: viewToVisualizationIcon(nest.view),
34134
- defaultOpen,
34135
- controls: getControls(nest),
34136
- collapsedControls: getControls(nest),
34137
- children: /* @__PURE__ */ jsx(View, {
34062
+ children: /* @__PURE__ */ jsxs("div", {
34063
+ ref: panelRef,
34064
+ onPointerDownCapture: focusCurrentNestQueryPanel,
34065
+ "data-nest-panel": true,
34066
+ children: [/* @__PURE__ */ jsx(CollapsiblePanel, {
34067
+ title: nest.name,
34068
+ icon: viewToVisualizationIcon(nest.view),
34069
+ defaultOpen,
34070
+ controls: getControls(nest),
34071
+ collapsedControls: getControls(nest),
34072
+ isFocused: isCurrentNestQueryPanelFocused,
34073
+ children: /* @__PURE__ */ jsx(View, {
34074
+ rootQuery,
34075
+ view: nest.view
34076
+ })
34077
+ }), /* @__PURE__ */ jsx(RenameDialog, {
34138
34078
  rootQuery,
34139
- view: nest.view
34140
- })
34141
- }), /* @__PURE__ */ jsx(RenameDialog, {
34142
- rootQuery,
34143
- view,
34144
- target: nest,
34145
- open: renameOpen,
34146
- setOpen: setRenameOpen
34147
- })]
34079
+ view,
34080
+ target: nest,
34081
+ open: renameOpen,
34082
+ setOpen: setRenameOpen
34083
+ })]
34084
+ })
34148
34085
  }, nest.name);
34149
34086
  }
34087
+ function findParentNestQueryPanel(element2) {
34088
+ if (!element2 || !element2.parentElement) return null;
34089
+ const parentElement = element2.parentElement;
34090
+ if (parentElement.dataset.nestPanel !== void 0) return parentElement;
34091
+ return findParentNestQueryPanel(parentElement);
34092
+ }
34150
34093
  function Operations({
34151
34094
  rootQuery,
34152
34095
  view,
@@ -34277,11 +34220,11 @@ function CollapsingView({
34277
34220
  })]
34278
34221
  }), !collapsed && /* @__PURE__ */ jsx(ViewAttributeTable, {
34279
34222
  viewInfo: viewDef.getViewInfo(),
34280
- style: styles$b.preview
34223
+ style: styles$c.preview
34281
34224
  })]
34282
34225
  });
34283
34226
  }
34284
- const styles$b = {
34227
+ const styles$c = {
34285
34228
  preview: {
34286
34229
  height: "mlyt7dq6l",
34287
34230
  maxHeight: "mly1hkcv85",
@@ -34313,75 +34256,89 @@ function Query({
34313
34256
  query,
34314
34257
  setQuery
34315
34258
  }) {
34316
- return /* @__PURE__ */ jsxs(CollapsiblePanel, {
34317
- title: "Main query",
34318
- controls: /* @__PURE__ */ jsxs(Fragment, {
34319
- children: [/* @__PURE__ */ jsx(DropdownMenu, {
34320
- trigger: /* @__PURE__ */ jsx(Button, {
34321
- variant: "flat",
34322
- icon: "meatballs",
34323
- size: "compact",
34324
- tooltip: "More Actions"
34325
- }),
34326
- children: setQuery ? /* @__PURE__ */ jsxs(Fragment, {
34327
- children: [/* @__PURE__ */ jsx(DropdownMenuItem, {
34328
- icon: "clear",
34329
- label: "Clear query",
34330
- onClick: () => {
34331
- setQuery == null ? void 0 : setQuery(void 0);
34332
- },
34333
- disabled: rootQuery.isEmpty()
34334
- }), /* @__PURE__ */ jsx(DropdownMenuItem, {
34335
- icon: "nest",
34336
- label: "Nest query",
34337
- onClick: () => {
34338
- if (rootQuery.definition instanceof ASTArrowQueryDefinition) {
34339
- rootQuery.definition.view.convertToNest("Nest");
34340
- }
34341
- setQuery == null ? void 0 : setQuery(rootQuery.build());
34342
- },
34343
- disabled: rootQuery.isEmpty() || !(rootQuery.definition instanceof ASTArrowQueryDefinition)
34344
- })]
34345
- }) : /* @__PURE__ */ jsx(Fragment, {})
34346
- }), query.definition instanceof ASTArrowQueryDefinition ? /* @__PURE__ */ jsx(AddMenu, {
34347
- rootQuery,
34348
- view: query.definition
34349
- }) : null]
34350
- }),
34351
- collapsedControls: /* @__PURE__ */ jsx(Icon, {
34352
- name: viewToVisualizationIcon(query)
34353
- }),
34354
- children: [query.definition instanceof ASTArrowQueryDefinition ? /* @__PURE__ */ jsxs("div", {
34355
- style: {
34356
- display: "flex",
34357
- flexDirection: "column",
34358
- gap: 8
34359
- },
34360
- children: [!query.isEmpty() && /* @__PURE__ */ jsx(Visualization$1, {
34361
- rootQuery,
34362
- view: query
34363
- }), /* @__PURE__ */ jsx(ViewDefinition, {
34364
- rootQuery,
34365
- view: query.definition,
34366
- viewDef: query.definition.view
34367
- })]
34368
- }) : null, query.isEmpty() ? /* @__PURE__ */ jsx("div", {
34369
- ...{
34370
- className: "mly78zum5 mlyl56j7k mly6s0dn4 mlyng8ra"
34371
- },
34372
- children: /* @__PURE__ */ jsxs("div", {
34373
- ...{
34374
- className: "mly78zum5 mly6s0dn4"
34259
+ const {
34260
+ currentNestQueryPanel,
34261
+ onCurrentNestQueryPanelChange,
34262
+ onCurrentNestViewChange
34263
+ } = React.useContext(QueryEditorContext);
34264
+ const focusMainQueryPanel = () => {
34265
+ onCurrentNestQueryPanelChange == null ? void 0 : onCurrentNestQueryPanelChange(null);
34266
+ onCurrentNestViewChange == null ? void 0 : onCurrentNestViewChange(null);
34267
+ };
34268
+ return /* @__PURE__ */ jsx("div", {
34269
+ onPointerDownCapture: focusMainQueryPanel,
34270
+ children: /* @__PURE__ */ jsxs(CollapsiblePanel, {
34271
+ title: "Main query",
34272
+ isFocused: !currentNestQueryPanel,
34273
+ controls: /* @__PURE__ */ jsxs(Fragment, {
34274
+ children: [/* @__PURE__ */ jsx(DropdownMenu, {
34275
+ trigger: /* @__PURE__ */ jsx(Button, {
34276
+ variant: "flat",
34277
+ icon: "meatballs",
34278
+ size: "compact",
34279
+ tooltip: "More Actions"
34280
+ }),
34281
+ children: setQuery ? /* @__PURE__ */ jsxs(Fragment, {
34282
+ children: [/* @__PURE__ */ jsx(DropdownMenuItem, {
34283
+ icon: "clear",
34284
+ label: "Clear query",
34285
+ onClick: () => {
34286
+ focusMainQueryPanel();
34287
+ setQuery == null ? void 0 : setQuery(void 0);
34288
+ },
34289
+ disabled: rootQuery.isEmpty()
34290
+ }), /* @__PURE__ */ jsx(DropdownMenuItem, {
34291
+ icon: "nest",
34292
+ label: "Nest query",
34293
+ onClick: () => {
34294
+ if (rootQuery.definition instanceof ASTArrowQueryDefinition) {
34295
+ rootQuery.definition.view.convertToNest("Nest");
34296
+ }
34297
+ setQuery == null ? void 0 : setQuery(rootQuery.build());
34298
+ },
34299
+ disabled: rootQuery.isEmpty() || !(rootQuery.definition instanceof ASTArrowQueryDefinition)
34300
+ })]
34301
+ }) : /* @__PURE__ */ jsx(Fragment, {})
34302
+ }), query.definition instanceof ASTArrowQueryDefinition ? /* @__PURE__ */ jsx(AddMenu, {
34303
+ rootQuery,
34304
+ view: query.definition
34305
+ }) : null]
34306
+ }),
34307
+ collapsedControls: /* @__PURE__ */ jsx(Icon, {
34308
+ name: viewToVisualizationIcon(query)
34309
+ }),
34310
+ children: [query.definition instanceof ASTArrowQueryDefinition ? /* @__PURE__ */ jsxs("div", {
34311
+ style: {
34312
+ display: "flex",
34313
+ flexDirection: "column",
34314
+ gap: 8
34375
34315
  },
34376
- children: [/* @__PURE__ */ jsx("div", {
34377
- children: "Click"
34378
- }), /* @__PURE__ */ jsx(Icon, {
34379
- name: "insert"
34380
- }), /* @__PURE__ */ jsx("div", {
34381
- children: "to get started"
34316
+ children: [!query.isEmpty() && /* @__PURE__ */ jsx(Visualization$1, {
34317
+ rootQuery,
34318
+ view: query
34319
+ }), /* @__PURE__ */ jsx(ViewDefinition, {
34320
+ rootQuery,
34321
+ view: query.definition,
34322
+ viewDef: query.definition.view
34382
34323
  })]
34383
- })
34384
- }) : null]
34324
+ }) : null, query.isEmpty() ? /* @__PURE__ */ jsx("div", {
34325
+ ...{
34326
+ className: "mly78zum5 mlyl56j7k mly6s0dn4 mlyng8ra"
34327
+ },
34328
+ children: /* @__PURE__ */ jsxs("div", {
34329
+ ...{
34330
+ className: "mly78zum5 mly6s0dn4"
34331
+ },
34332
+ children: [/* @__PURE__ */ jsx("div", {
34333
+ children: "Click"
34334
+ }), /* @__PURE__ */ jsx(Icon, {
34335
+ name: "insert"
34336
+ }), /* @__PURE__ */ jsx("div", {
34337
+ children: "to get started"
34338
+ })]
34339
+ })
34340
+ }) : null]
34341
+ })
34385
34342
  });
34386
34343
  }
34387
34344
  function Source({
@@ -34389,9 +34346,9 @@ function Source({
34389
34346
  }) {
34390
34347
  if (rootQuery.definition instanceof ASTArrowQueryDefinition) {
34391
34348
  return /* @__PURE__ */ jsx("div", {
34392
- ..._stylex.props(styles$s.queryCard, styles$a.content),
34349
+ ..._stylex.props(styles$t.queryCard, styles$b.content),
34393
34350
  children: /* @__PURE__ */ jsxs("div", {
34394
- ..._stylex.props(styles$s.labelWithIcon),
34351
+ ..._stylex.props(styles$t.labelWithIcon),
34395
34352
  children: [/* @__PURE__ */ jsx(Icon, {
34396
34353
  name: "database"
34397
34354
  }), /* @__PURE__ */ jsx("div", {
@@ -34405,7 +34362,7 @@ function Source({
34405
34362
  }
34406
34363
  return null;
34407
34364
  }
34408
- const styles$a = {
34365
+ const styles$b = {
34409
34366
  content: {
34410
34367
  display: "mlyrvj5dj",
34411
34368
  gridAutoFlow: "mly1mt1orb",
@@ -34416,12 +34373,145 @@ const styles$a = {
34416
34373
  $$css: true
34417
34374
  }
34418
34375
  };
34376
+ function DateLiteralEditor({
34377
+ value,
34378
+ setValue,
34379
+ customStyle
34380
+ }) {
34381
+ const [errorMessage, setErrorMessage] = useState("");
34382
+ const [open, setOpen] = useState(false);
34383
+ const input = useRef(null);
34384
+ const picker = useRef(null);
34385
+ const isDate2 = value.kind === "date_literal";
34386
+ const date = isDate2 ? value.date_value : value.timestamp_value;
34387
+ const units = isDate2 ? "day" : "second";
34388
+ const onSetValue = (date2) => {
34389
+ if (date2) {
34390
+ setErrorMessage("");
34391
+ if (isDate2) {
34392
+ setValue({
34393
+ kind: "date_literal",
34394
+ date_value: hooks.utc(date2).format(formats["day"])
34395
+ });
34396
+ } else {
34397
+ setValue({
34398
+ kind: "timestamp_literal",
34399
+ timestamp_value: hooks.utc(date2).format(formats["second"])
34400
+ });
34401
+ }
34402
+ } else {
34403
+ setErrorMessage("Invalid date");
34404
+ }
34405
+ };
34406
+ useClickOutside([input, picker], () => {
34407
+ setOpen(false);
34408
+ });
34409
+ return /* @__PURE__ */ jsxs(Root2$2, {
34410
+ open,
34411
+ onOpenChange: () => {
34412
+ },
34413
+ children: [/* @__PURE__ */ jsx(Trigger$2, {
34414
+ asChild: true,
34415
+ children: /* @__PURE__ */ jsx("div", {
34416
+ ..._stylex.props(tokenStyles.main, styles$a.wrapper, customStyle),
34417
+ children: /* @__PURE__ */ jsx(DateInput, {
34418
+ value: hooks.utc(date).toDate(),
34419
+ setValue: onSetValue,
34420
+ units,
34421
+ onFocus: () => setOpen(true),
34422
+ customStyle: {
34423
+ ...styles$a.input,
34424
+ ...isDate2 ? styles$a.dateInput : styles$a.timestampInput
34425
+ },
34426
+ forwardRef: input
34427
+ })
34428
+ })
34429
+ }), errorMessage && /* @__PURE__ */ jsx(ErrorIcon, {
34430
+ errorMessage
34431
+ }), /* @__PURE__ */ jsx(Portal$2, {
34432
+ children: /* @__PURE__ */ jsx(Content2$2, {
34433
+ align: "center",
34434
+ asChild: true,
34435
+ children: /* @__PURE__ */ jsx(DatePicker, {
34436
+ value: hooks.utc(date).toDate(),
34437
+ setValue: onSetValue,
34438
+ units,
34439
+ maxLevel: units,
34440
+ customStyle: styles$a.datePicker,
34441
+ forwardRef: picker
34442
+ })
34443
+ })
34444
+ })]
34445
+ });
34446
+ }
34447
+ const styles$a = {
34448
+ input: {
34449
+ border: "mly1gs6z28",
34450
+ borderWidth: null,
34451
+ borderInlineWidth: null,
34452
+ borderInlineStartWidth: null,
34453
+ borderLeftWidth: null,
34454
+ borderInlineEndWidth: null,
34455
+ borderRightWidth: null,
34456
+ borderBlockWidth: null,
34457
+ borderTopWidth: null,
34458
+ borderBottomWidth: null,
34459
+ borderStyle: null,
34460
+ borderInlineStyle: null,
34461
+ borderInlineStartStyle: null,
34462
+ borderLeftStyle: null,
34463
+ borderInlineEndStyle: null,
34464
+ borderRightStyle: null,
34465
+ borderBlockStyle: null,
34466
+ borderTopStyle: null,
34467
+ borderBottomStyle: null,
34468
+ borderColor: null,
34469
+ borderInlineColor: null,
34470
+ borderInlineStartColor: null,
34471
+ borderLeftColor: null,
34472
+ borderInlineEndColor: null,
34473
+ borderRightColor: null,
34474
+ borderBlockColor: null,
34475
+ borderTopColor: null,
34476
+ borderBottomColor: null,
34477
+ height: "mlyd7y6wv",
34478
+ backgroundColor: "mlyjbqb8w mlytw1abo",
34479
+ $$css: true
34480
+ },
34481
+ dateInput: {
34482
+ width: "mly869kya",
34483
+ $$css: true
34484
+ },
34485
+ timestampInput: {
34486
+ width: "mlynrytzq",
34487
+ $$css: true
34488
+ },
34489
+ wrapper: {
34490
+ $$css: true
34491
+ },
34492
+ datePicker: {
34493
+ display: "mly78zum5",
34494
+ flexDirection: "mlydt5ytf",
34495
+ boxShadow: "mly5n1uv4",
34496
+ backgroundColor: "mly12peec7",
34497
+ borderRadius: "mlyur7f20",
34498
+ borderStartStartRadius: null,
34499
+ borderStartEndRadius: null,
34500
+ borderEndStartRadius: null,
34501
+ borderEndEndRadius: null,
34502
+ borderTopLeftRadius: null,
34503
+ borderTopRightRadius: null,
34504
+ borderBottomLeftRadius: null,
34505
+ borderBottomRightRadius: null,
34506
+ width: "mly1hfn5x7",
34507
+ $$css: true
34508
+ }
34509
+ };
34419
34510
  function LiteralValueEditor({
34420
34511
  value,
34421
34512
  setValue,
34422
34513
  customStyle
34423
34514
  }) {
34424
- const [errorMessage, setErrorMessage] = React.useState("");
34425
34515
  if (!value) {
34426
34516
  return null;
34427
34517
  }
@@ -34436,31 +34526,18 @@ function LiteralValueEditor({
34436
34526
  label: "false",
34437
34527
  value: "false"
34438
34528
  }],
34439
- onChange: (value2) => setValue(value2 === "true"),
34529
+ onChange: (value2) => setValue({
34530
+ kind: "boolean_literal",
34531
+ boolean_value: value2 === "true"
34532
+ }),
34440
34533
  customStyle
34441
34534
  });
34442
34535
  case "date_literal":
34443
- return /* @__PURE__ */ jsxs("div", {
34444
- ...{
34445
- className: "mly78zum5"
34446
- },
34447
- children: [/* @__PURE__ */ jsx("input", {
34448
- value: value.date_value.split(" ")[0],
34449
- type: "date",
34450
- onChange: (event) => {
34451
- if (event.target.valueAsDate) {
34452
- setErrorMessage("");
34453
- setValue({
34454
- date: event.target.valueAsDate,
34455
- granularity: "day"
34456
- });
34457
- } else {
34458
- setErrorMessage("Invalid date");
34459
- }
34460
- }
34461
- }), errorMessage && /* @__PURE__ */ jsx(ErrorIcon, {
34462
- errorMessage
34463
- })]
34536
+ case "timestamp_literal":
34537
+ return /* @__PURE__ */ jsx(DateLiteralEditor, {
34538
+ value,
34539
+ setValue,
34540
+ customStyle
34464
34541
  });
34465
34542
  case "null_literal":
34466
34543
  return /* @__PURE__ */ jsx(Token, {
@@ -34470,42 +34547,28 @@ function LiteralValueEditor({
34470
34547
  return /* @__PURE__ */ jsx(EditableToken, {
34471
34548
  value: value.number_value,
34472
34549
  type: "number",
34473
- onChange: (value2) => setValue(value2),
34550
+ onChange: (value2) => setValue({
34551
+ kind: "number_literal",
34552
+ number_value: value2
34553
+ }),
34474
34554
  customStyle
34475
34555
  });
34476
34556
  case "string_literal":
34477
34557
  return /* @__PURE__ */ jsx(EditableToken, {
34478
34558
  value: value.string_value,
34479
- onChange: (value2) => setValue(value2),
34559
+ onChange: (value2) => setValue({
34560
+ kind: "string_literal",
34561
+ string_value: value2
34562
+ }),
34480
34563
  customStyle
34481
34564
  });
34482
- case "timestamp_literal":
34483
- return /* @__PURE__ */ jsxs("div", {
34484
- ...{
34485
- className: "mly78zum5"
34486
- },
34487
- children: [/* @__PURE__ */ jsx("input", {
34488
- value: value.timestamp_value,
34489
- type: "date",
34490
- onChange: (event) => {
34491
- if (event.target.valueAsDate) {
34492
- setErrorMessage("");
34493
- setValue({
34494
- date: event.target.valueAsDate,
34495
- granularity: "second"
34496
- });
34497
- } else {
34498
- setErrorMessage("Invalid date");
34499
- }
34500
- }
34501
- }), errorMessage && /* @__PURE__ */ jsx(ErrorIcon, {
34502
- errorMessage
34503
- })]
34504
- });
34505
34565
  case "filter_expression_literal":
34506
34566
  return /* @__PURE__ */ jsx(EditableToken, {
34507
34567
  value: value.filter_expression_value,
34508
- onChange: (value2) => setValue(value2),
34568
+ onChange: (value2) => setValue({
34569
+ kind: "filter_expression_literal",
34570
+ filter_expression_value: value2
34571
+ }),
34509
34572
  customStyle
34510
34573
  });
34511
34574
  }
@@ -34564,25 +34627,26 @@ function QueryEditor() {
34564
34627
  console.error("Missing <MalloyExplorerProvider>");
34565
34628
  return null;
34566
34629
  }
34567
- return /* @__PURE__ */ jsx(ScrollableArea, {
34568
- children: /* @__PURE__ */ jsxs("div", {
34569
- ..._stylex.props(fontStyles.body, styles$8.main),
34570
- children: [/* @__PURE__ */ jsx(Source, {
34571
- rootQuery
34572
- }), /* @__PURE__ */ jsx(Parameters, {
34573
- rootQuery
34574
- }), /* @__PURE__ */ jsx(Query, {
34575
- rootQuery,
34576
- query: rootQuery,
34577
- setQuery
34578
- })]
34579
- })
34630
+ return /* @__PURE__ */ jsxs("div", {
34631
+ ..._stylex.props(fontStyles.body, styles$8.main),
34632
+ children: [/* @__PURE__ */ jsx(Source, {
34633
+ rootQuery
34634
+ }), /* @__PURE__ */ jsx(Parameters, {
34635
+ rootQuery
34636
+ }), /* @__PURE__ */ jsx(Query, {
34637
+ rootQuery,
34638
+ query: rootQuery,
34639
+ setQuery
34640
+ })]
34580
34641
  });
34581
34642
  }
34582
34643
  const styles$8 = {
34583
34644
  main: {
34584
34645
  display: "mly78zum5",
34585
34646
  flexDirection: "mlydt5ytf",
34647
+ overflow: "mlyysyzu8",
34648
+ overflowX: null,
34649
+ overflowY: null,
34586
34650
  gap: "mly167g77z",
34587
34651
  rowGap: null,
34588
34652
  columnGap: null,
@@ -34603,13 +34667,11 @@ function QueryPanel({
34603
34667
  }) {
34604
34668
  return /* @__PURE__ */ jsxs("div", {
34605
34669
  ...{
34606
- className: "mly78zum5 mlydt5ytf mly2lah0s mlyh8yej3 mly5yr21d mlyotlr4g mly1roky18"
34670
+ className: "mly78zum5 mlydt5ytf mly5yr21d mlyotlr4g mly1roky18"
34607
34671
  },
34608
34672
  children: [/* @__PURE__ */ jsx(QueryActionBar, {
34609
34673
  runQuery
34610
- }), /* @__PURE__ */ jsx(ScrollableArea, {
34611
- children: /* @__PURE__ */ jsx(QueryEditor, {})
34612
- })]
34674
+ }), /* @__PURE__ */ jsx(QueryEditor, {})]
34613
34675
  });
34614
34676
  }
34615
34677
  function BookmarkedView({
@@ -35551,15 +35613,21 @@ function flattenFieldsTree(fields, path = []) {
35551
35613
  case "measure":
35552
35614
  case "dimension":
35553
35615
  if (field.type.kind === "array_type" && field.type.element_type.kind === "record_type") {
35554
- return flattenFieldsTree(field.type.element_type.fields.map((dimension) => ({
35616
+ return [{
35617
+ path,
35618
+ field
35619
+ }, ...flattenFieldsTree(field.type.element_type.fields.map((dimension) => ({
35555
35620
  kind: field.kind,
35556
35621
  ...dimension
35557
- })), [...path, field.name]);
35622
+ })), [...path, field.name])];
35558
35623
  } else if (field.type.kind === "record_type") {
35559
- return flattenFieldsTree(field.type.fields.map((dimension) => ({
35624
+ return [{
35625
+ path,
35626
+ field
35627
+ }, ...flattenFieldsTree(field.type.fields.map((dimension) => ({
35560
35628
  kind: field.kind,
35561
35629
  ...dimension
35562
- })), [...path, field.name]);
35630
+ })), [...path, field.name])];
35563
35631
  }
35564
35632
  return [{
35565
35633
  path,
@@ -35601,64 +35669,46 @@ function groupFieldItemsByKind(items) {
35601
35669
  return acc;
35602
35670
  }, {}));
35603
35671
  }
35604
- const getNestName = (segment, rename = "Nest") => {
35605
- const nestNo = segmentNestNo(segment);
35606
- return nestNo > 1 ? `${rename} ${nestNo}` : rename;
35607
- };
35608
35672
  const FIELD_KIND_TO_TITLE = {
35609
35673
  view: "Views",
35610
35674
  measure: "Measures",
35611
35675
  dimension: "Dimensions"
35612
35676
  };
35613
- function useNestOperations(rootQuery) {
35614
- const nestOperations = useMemo(() => {
35615
- if (rootQuery) {
35616
- const queryDef = rootQuery.definition;
35617
- if (queryDef instanceof ASTArrowQueryDefinition) {
35618
- return extractNestOperations(queryDef.view);
35619
- }
35620
- }
35621
- return [];
35622
- }, [rootQuery]);
35623
- return nestOperations;
35624
- }
35625
- const extractNestOperations = (view, nestOperations = []) => {
35626
- if (view instanceof ASTArrowViewDefinition) {
35627
- return extractNestOperations(view.view, nestOperations);
35628
- } else if (view instanceof ASTSegmentViewDefinition) {
35629
- view.operations.items.filter((operation) => operation instanceof ASTNestViewOperation).forEach((operation) => {
35630
- const nestView = operation.view.definition;
35631
- nestOperations.push({
35632
- name: operation.name,
35633
- view: nestView
35634
- });
35635
- extractNestOperations(nestView, nestOperations);
35636
- });
35637
- return nestOperations;
35638
- } else if (view instanceof ASTRefinementViewDefinition) {
35639
- return extractNestOperations(view.refinement, nestOperations);
35640
- }
35641
- return nestOperations;
35642
- };
35643
35677
  function useOperations(view, field, path) {
35678
+ const dimensionFields = useMemo(() => {
35679
+ const {
35680
+ fields
35681
+ } = getInputSchemaFromViewParent(view);
35682
+ return new Set(flattenFieldsTree(fields).filter(({
35683
+ field: field2
35684
+ }) => field2.kind === "dimension").map(({
35685
+ field: field2
35686
+ }) => field2.name));
35687
+ }, [view]);
35688
+ const measureFields = useMemo(() => {
35689
+ const {
35690
+ fields
35691
+ } = getInputSchemaFromViewParent(view);
35692
+ return new Set(flattenFieldsTree(fields).filter(({
35693
+ field: field2
35694
+ }) => field2.kind === "measure").map(({
35695
+ field: field2
35696
+ }) => field2.name));
35697
+ }, [view]);
35644
35698
  const isGroupByAllowed = useMemo(() => {
35645
35699
  if (!view) {
35646
35700
  return false;
35647
35701
  }
35648
- const fieldName = field.name;
35649
- const inputSchemaFields = getInputSchemaFromViewParent(view).fields;
35650
- const filteredFieldItems = flattenFieldsTree(inputSchemaFields).filter((item) => item.field.kind === "dimension");
35651
- return filteredFieldItems.some((item) => item.field.name === fieldName && item.path.join(".") === path.join("."));
35652
- }, [view, field, path]);
35702
+ const segment = getSegmentIfPresent(view);
35703
+ return dimensionFields.has(field.name) && !(segment == null ? void 0 : segment.hasField(field.name, path)) && isNotAnnotatedFilteredField(field);
35704
+ }, [view, field, path, dimensionFields]);
35653
35705
  const isAggregateAllowed = useMemo(() => {
35654
35706
  if (!view) {
35655
35707
  return false;
35656
35708
  }
35657
- const fieldName = field.name;
35658
- const inputSchemaFields = getInputSchemaFromViewParent(view).fields;
35659
- const filteredFieldItems = flattenFieldsTree(inputSchemaFields).filter((item) => item.field.kind === "measure");
35660
- return filteredFieldItems.some((item) => item.field.name === fieldName && item.path.join(".") === path.join("."));
35661
- }, [view, field, path]);
35709
+ const segment = getSegmentIfPresent(view);
35710
+ return measureFields.has(field.name) && !(segment == null ? void 0 : segment.hasField(field.name, path)) && isNotAnnotatedFilteredField(field);
35711
+ }, [view, field, path, measureFields]);
35662
35712
  const isFilterAllowed = useMemo(() => {
35663
35713
  if (!view) {
35664
35714
  return false;
@@ -35685,280 +35735,115 @@ function useOperations(view, field, path) {
35685
35735
  }
35686
35736
  const FILTERABLE_TYPES = ["string_type", "boolean_type", "number_type", "date_type", "timestamp_type"];
35687
35737
  const ORDERABLE_TYPES = ["string_type", "number_type", "boolean_type", "date_type", "timestamp_type"];
35688
- function OperationDropdownMenuItems({
35689
- view,
35738
+ function FieldTokenWithActions({
35690
35739
  field,
35691
35740
  path,
35692
- withEmptyNest = false
35741
+ viewDef
35693
35742
  }) {
35694
35743
  const {
35695
35744
  rootQuery,
35696
- setQuery
35745
+ setQuery,
35746
+ currentNestView
35697
35747
  } = React__default.useContext(QueryEditorContext);
35748
+ const view = currentNestView ?? viewDef;
35698
35749
  const {
35699
35750
  isGroupByAllowed,
35700
35751
  isAggregateAllowed,
35701
35752
  isFilterAllowed,
35702
35753
  isOrderByAllowed
35703
35754
  } = useOperations(view, field, path);
35704
- const handleMenuItemClick = (event, operation) => {
35755
+ const [isFilterPopoverOpen, setIsFilterPopoverOpen] = useState();
35756
+ const handleAddOperationAction = (operation, filter) => {
35705
35757
  if (field.kind === "dimension" || field.kind === "measure") {
35706
- const segment = view.getOrAddDefaultSegment();
35707
- const currentView = withEmptyNest ? segment.addEmptyNest(getNestName(segment)).view : view;
35708
- const currentSegment = currentView.getOrAddDefaultSegment();
35709
35758
  if (operation === "groupBy" && isGroupByAllowed) {
35710
- addGroupBy(currentView, field, path);
35759
+ addGroupBy(view, field, path);
35711
35760
  } else if (operation === "aggregate" && isAggregateAllowed) {
35712
- addAggregate(currentView, field, path);
35761
+ addAggregate(view, field, path);
35713
35762
  } else if (operation === "orderBy" && isOrderByAllowed) {
35714
- currentSegment.addOrderBy(field.name, "asc");
35763
+ const segment = view.getOrAddDefaultSegment();
35764
+ segment.addOrderBy(field.name, "asc");
35765
+ } else if (operation === "filter" && isFilterAllowed && filter) {
35766
+ const segment = view.getOrAddDefaultSegment();
35767
+ if (field.kind === "dimension") {
35768
+ segment.addWhere(field.name, path, filter);
35769
+ } else {
35770
+ segment.addHaving(field.name, path, filter);
35771
+ }
35715
35772
  }
35716
35773
  setQuery == null ? void 0 : setQuery(rootQuery == null ? void 0 : rootQuery.build());
35717
35774
  }
35718
35775
  };
35719
- return /* @__PURE__ */ jsx(Fragment, {
35720
- children: field.kind === "measure" ? /* @__PURE__ */ jsxs(Fragment, {
35721
- children: [/* @__PURE__ */ jsx(DropdownMenuItem, {
35722
- icon: "aggregate",
35723
- label: "Aggregate",
35724
- disabled: !isAggregateAllowed,
35725
- onClick: (event) => handleMenuItemClick(event, "aggregate")
35726
- }), /* @__PURE__ */ jsx(FilterDropdownSubmenuItem, {
35727
- view,
35728
- isFilterAllowed,
35729
- field,
35730
- path
35731
- }), /* @__PURE__ */ jsx(DropdownMenuItem, {
35732
- icon: "orderBy",
35733
- label: "Order by",
35734
- disabled: !isOrderByAllowed,
35735
- onClick: (event) => handleMenuItemClick(event, "orderBy")
35736
- })]
35737
- }) : field.kind === "dimension" ? /* @__PURE__ */ jsxs(Fragment, {
35738
- children: [/* @__PURE__ */ jsx(DropdownMenuItem, {
35739
- icon: "groupBy",
35740
- label: "Group by",
35741
- disabled: !isGroupByAllowed,
35742
- onClick: (event) => handleMenuItemClick(event, "groupBy")
35743
- }), /* @__PURE__ */ jsx(FilterDropdownSubmenuItem, {
35744
- view,
35745
- isFilterAllowed,
35746
- field,
35747
- path
35748
- }), /* @__PURE__ */ jsx(DropdownMenuItem, {
35749
- icon: "orderBy",
35750
- label: "Order by",
35751
- disabled: !isOrderByAllowed,
35752
- onClick: (event) => handleMenuItemClick(event, "orderBy")
35753
- })]
35754
- }) : /* @__PURE__ */ jsx(Fragment, {})
35755
- });
35756
- }
35757
- function FilterDropdownSubmenuItem({
35758
- view,
35759
- isFilterAllowed,
35760
- field,
35761
- path
35762
- }) {
35763
- const {
35764
- rootQuery,
35765
- setQuery
35766
- } = React__default.useContext(QueryEditorContext);
35767
- const [isOpen, setIsOpen] = useState(false);
35768
- const handleFilterSet = (filter) => {
35769
- const segment = view.getOrAddDefaultSegment();
35770
- if (field.kind === "dimension") {
35771
- segment.addWhere(field.name, path, filter);
35772
- } else {
35773
- segment.addHaving(field.name, path, filter);
35774
- }
35775
- setQuery == null ? void 0 : setQuery(rootQuery == null ? void 0 : rootQuery.build());
35776
- };
35777
- return /* @__PURE__ */ jsx(DropdownSubMenuItem, {
35778
- icon: "filter",
35779
- label: "Filter",
35780
- disabled: !isFilterAllowed,
35781
- open: isOpen,
35782
- onOpenChange: setIsOpen,
35783
- children: /* @__PURE__ */ jsx(FilterDialog, {
35784
- fieldInfo: field,
35785
- path,
35786
- onFilterApply: handleFilterSet,
35787
- onOpenChange: setIsOpen
35788
- })
35789
- });
35790
- }
35791
- function NestFieldDropdownMenu({
35792
- view,
35793
- field,
35794
- path,
35795
- trigger,
35796
- onOpenChange
35797
- }) {
35798
- const {
35799
- rootQuery,
35800
- setQuery
35801
- } = useContext(QueryEditorContext);
35802
- const nestOperations = useNestOperations(rootQuery);
35803
- const nestViewWithinNestQuery = (operation) => {
35804
- const segment = operation.view.getOrAddDefaultSegment();
35805
- const {
35806
- fields
35807
- } = operation.view.getOutputSchema();
35808
- let rename;
35809
- if (fields.find((f2) => f2.name === field.name)) {
35810
- rename = findUniqueFieldName(fields, field.name);
35811
- }
35812
- segment.addNest(field.name, rename);
35813
- setQuery == null ? void 0 : setQuery(rootQuery == null ? void 0 : rootQuery.build());
35814
- };
35815
- return /* @__PURE__ */ jsx(DropdownMenu, {
35816
- trigger,
35817
- onOpenChange,
35818
- children: nestOperations.length === 0 ? /* @__PURE__ */ jsxs(Fragment, {
35819
- children: [/* @__PURE__ */ jsx(DropdownMenuLabel, {
35820
- label: "Add to new nested query as..."
35821
- }), /* @__PURE__ */ jsx(OperationDropdownMenuItems, {
35822
- view,
35823
- field,
35824
- path,
35825
- withEmptyNest: true
35826
- })]
35827
- }) : /* @__PURE__ */ jsxs(Fragment, {
35828
- children: [/* @__PURE__ */ jsx(DropdownMenuLabel, {
35829
- label: "Add to nested query..."
35830
- }), nestOperations.map((operation, index2) => {
35831
- return field.kind === "view" ? /* @__PURE__ */ jsx(DropdownMenuItem, {
35832
- label: operation.name,
35833
- onClick: () => nestViewWithinNestQuery(operation)
35834
- }, index2) : /* @__PURE__ */ jsxs(DropdownSubMenuItem, {
35835
- label: operation.name,
35836
- children: [/* @__PURE__ */ jsx(DropdownMenuLabel, {
35837
- label: `Add to ${operation.name} query as...`
35838
- }), /* @__PURE__ */ jsx(OperationDropdownMenuItems, {
35839
- view: operation.view.parent.as.View(),
35840
- field,
35841
- path
35842
- })]
35843
- }, index2);
35844
- })]
35845
- })
35846
- });
35847
- }
35848
- function AddFieldDropdownMenu({
35849
- view,
35850
- field,
35851
- path,
35852
- ...props2
35853
- }) {
35854
- return /* @__PURE__ */ jsxs(DropdownMenu, {
35855
- ...props2,
35856
- children: [/* @__PURE__ */ jsx(DropdownMenuLabel, {
35857
- label: "Add to main query as..."
35858
- }), /* @__PURE__ */ jsx(OperationDropdownMenuItems, {
35859
- view,
35860
- field,
35861
- path
35862
- })]
35863
- });
35864
- }
35865
- function FieldTokenWithActions({
35866
- field,
35867
- path
35868
- }) {
35869
- const {
35870
- rootQuery,
35871
- setQuery
35872
- } = React__default.useContext(QueryEditorContext);
35873
- const [isAddFieldMenuOpen, setIsAddFieldMenuOpen] = useState();
35874
- const [isNestFieldMenuOpen, setIsNestFieldMenuOpen] = useState();
35875
- const nestViews = useNestOperations(rootQuery);
35876
- const viewDef = rootQuery == null ? void 0 : rootQuery.definition;
35877
- if (!(viewDef instanceof ASTArrowQueryDefinition)) {
35878
- return null;
35879
- }
35880
- const hasAddFieldMenu = field.kind === "measure" || field.kind === "dimension";
35881
- const hasNestFieldMenu = field.kind === "measure" || field.kind === "dimension" || field.kind === "view" && nestViews.length > 0;
35882
- const addViewToMainQuery = () => {
35883
- if (field.kind === "view") {
35884
- if (rootQuery == null ? void 0 : rootQuery.isEmpty()) {
35885
- rootQuery == null ? void 0 : rootQuery.setView(field.name);
35886
- } else {
35887
- addNest(viewDef, field);
35888
- }
35776
+ const handleSetView = () => {
35777
+ if (field.kind === "view" && (rootQuery == null ? void 0 : rootQuery.isEmpty())) {
35778
+ rootQuery == null ? void 0 : rootQuery.setView(field.name);
35889
35779
  setQuery == null ? void 0 : setQuery(rootQuery == null ? void 0 : rootQuery.build());
35890
35780
  }
35891
35781
  };
35892
- const nestViewWithinMainQuery = () => {
35782
+ const handleAddView = () => {
35893
35783
  if (field.kind === "view") {
35894
- addNest(viewDef, field);
35784
+ addNest(view, field);
35895
35785
  setQuery == null ? void 0 : setQuery(rootQuery == null ? void 0 : rootQuery.build());
35896
35786
  }
35897
35787
  };
35898
- const hoverActions = () => {
35899
- return /* @__PURE__ */ jsxs(Fragment, {
35900
- children: [hasAddFieldMenu ? /* @__PURE__ */ jsx(AddFieldDropdownMenu, {
35901
- view: viewDef,
35902
- field,
35788
+ return /* @__PURE__ */ jsx(FieldToken, {
35789
+ field,
35790
+ hoverActions: field.kind === "view" ? /* @__PURE__ */ jsxs(Fragment, {
35791
+ children: [/* @__PURE__ */ jsx(ActionButton, {
35792
+ icon: "insert",
35793
+ disabled: !(rootQuery == null ? void 0 : rootQuery.isEmpty()),
35794
+ onClick: handleSetView,
35795
+ tooltip: "Add view"
35796
+ }), /* @__PURE__ */ jsx(ActionButton, {
35797
+ icon: "nest",
35798
+ onClick: handleAddView,
35799
+ tooltip: "Add as new nested query"
35800
+ })]
35801
+ }) : field.kind === "measure" ? /* @__PURE__ */ jsxs(Fragment, {
35802
+ children: [/* @__PURE__ */ jsx(ActionButton, {
35803
+ icon: "aggregate",
35804
+ tooltip: "Add as aggregate",
35805
+ disabled: !isAggregateAllowed,
35806
+ onClick: () => handleAddOperationAction("aggregate")
35807
+ }), /* @__PURE__ */ jsx(FilterPopover, {
35808
+ fieldInfo: field,
35903
35809
  path,
35904
- trigger: /* @__PURE__ */ jsx(Button, {
35905
- variant: "flat",
35906
- size: "compact",
35907
- icon: "insert",
35908
- tooltip: "Add to main query"
35810
+ setFilter: (filter) => handleAddOperationAction("filter", filter),
35811
+ trigger: /* @__PURE__ */ jsx(ActionButton, {
35812
+ icon: "filter",
35813
+ tooltip: "Add as filter",
35814
+ disabled: !isFilterAllowed
35909
35815
  }),
35910
- onOpenChange: (open) => setIsAddFieldMenuOpen(open)
35911
- }) : /* @__PURE__ */ jsx(Button, {
35912
- variant: "flat",
35913
- size: "compact",
35914
- icon: "insert",
35915
- onClick: addViewToMainQuery,
35916
- tooltip: "Add to main query"
35917
- }), hasNestFieldMenu ? /* @__PURE__ */ jsx(NestFieldDropdownMenu, {
35918
- view: viewDef,
35919
- field,
35816
+ onOpenChange: setIsFilterPopoverOpen
35817
+ }), /* @__PURE__ */ jsx(ActionButton, {
35818
+ icon: "orderBy",
35819
+ tooltip: "Add as order by",
35820
+ disabled: !isOrderByAllowed,
35821
+ onClick: () => handleAddOperationAction("orderBy")
35822
+ })]
35823
+ }) : field.kind === "dimension" ? /* @__PURE__ */ jsxs(Fragment, {
35824
+ children: [/* @__PURE__ */ jsx(ActionButton, {
35825
+ icon: "groupBy",
35826
+ tooltip: "Add as group by",
35827
+ disabled: !isGroupByAllowed,
35828
+ onClick: () => handleAddOperationAction("groupBy")
35829
+ }), /* @__PURE__ */ jsx(FilterPopover, {
35830
+ fieldInfo: field,
35920
35831
  path,
35921
- trigger: /* @__PURE__ */ jsx(Button, {
35922
- variant: "flat",
35923
- size: "compact",
35924
- icon: "nest",
35925
- tooltip: "Add to nested query"
35832
+ setFilter: (filter) => handleAddOperationAction("filter", filter),
35833
+ trigger: /* @__PURE__ */ jsx(ActionButton, {
35834
+ icon: "filter",
35835
+ tooltip: "Add as filter",
35836
+ disabled: !isFilterAllowed
35926
35837
  }),
35927
- onOpenChange: (open) => setIsNestFieldMenuOpen(open)
35928
- }) : /* @__PURE__ */ jsx(Button, {
35929
- variant: "flat",
35930
- size: "compact",
35931
- icon: "nest",
35932
- onClick: nestViewWithinMainQuery,
35933
- tooltip: "Add to nested query"
35838
+ onOpenChange: setIsFilterPopoverOpen
35839
+ }), /* @__PURE__ */ jsx(ActionButton, {
35840
+ icon: "orderBy",
35841
+ tooltip: "Add as order by",
35842
+ disabled: !isOrderByAllowed,
35843
+ onClick: () => handleAddOperationAction("orderBy")
35934
35844
  })]
35935
- });
35936
- };
35937
- return hasAddFieldMenu ? /* @__PURE__ */ jsx(AddFieldDropdownMenu, {
35938
- view: viewDef,
35939
- field,
35940
- path,
35941
- trigger: /* @__PURE__ */ jsx(FieldToken, {
35942
- field,
35943
- hoverActionsVisible: isAddFieldMenuOpen || isNestFieldMenuOpen,
35944
- hoverActions: hoverActions(),
35945
- asButtonTrigger: true
35946
- }),
35947
- onOpenChange: (open) => setIsAddFieldMenuOpen(open),
35948
- tooltip: /* @__PURE__ */ jsx(FieldHoverCard, {
35949
- field,
35950
- path
35951
- }),
35952
- tooltipProps: {
35953
- side: "right",
35954
- align: "start",
35955
- alignOffset: 28
35956
- }
35957
- }) : /* @__PURE__ */ jsx(FieldToken, {
35958
- field,
35959
- onClick: addViewToMainQuery,
35960
- hoverActions: hoverActions(),
35961
- hoverActionsVisible: isAddFieldMenuOpen || isNestFieldMenuOpen,
35845
+ }) : null,
35846
+ hoverActionsVisible: isFilterPopoverOpen,
35962
35847
  tooltip: /* @__PURE__ */ jsx(FieldHoverCard, {
35963
35848
  field,
35964
35849
  path
@@ -35970,6 +35855,13 @@ function FieldTokenWithActions({
35970
35855
  }
35971
35856
  });
35972
35857
  }
35858
+ function ActionButton(props2) {
35859
+ return /* @__PURE__ */ jsx(Button, {
35860
+ variant: "flat",
35861
+ size: "compact",
35862
+ ...props2
35863
+ });
35864
+ }
35973
35865
  const FIELD_KIND_ORDER = ["dimension", "measure", "view"];
35974
35866
  function SearchResultList({
35975
35867
  source,
@@ -35981,6 +35873,13 @@ function SearchResultList({
35981
35873
  items: groupFieldItemsByPath(source, group.items)
35982
35874
  }));
35983
35875
  }, [source, items]);
35876
+ const {
35877
+ rootQuery
35878
+ } = React.useContext(QueryEditorContext);
35879
+ const viewDef = rootQuery == null ? void 0 : rootQuery.definition;
35880
+ if (!(viewDef instanceof ASTArrowQueryDefinition)) {
35881
+ return null;
35882
+ }
35984
35883
  return /* @__PURE__ */ jsxs("div", {
35985
35884
  ...{
35986
35885
  className: "mly78zum5 mlydt5ytf mly1cy8zhl mlyou54vl mlye8ttls mly10cdfl8"
@@ -36015,7 +35914,8 @@ function SearchResultList({
36015
35914
  path
36016
35915
  }) => /* @__PURE__ */ jsx(FieldTokenWithActions, {
36017
35916
  field,
36018
- path
35917
+ path,
35918
+ viewDef
36019
35919
  }, [...path, field.name].join(".")))))
36020
35920
  })]
36021
35921
  }, group))]
@@ -36058,6 +35958,13 @@ function FieldGroupList({
36058
35958
  group
36059
35959
  }) => group === fieldGroupType)) == null ? void 0 : _a2.items) ?? [];
36060
35960
  }, [fieldGroupsByKindByPath, fieldGroupType]);
35961
+ const {
35962
+ rootQuery
35963
+ } = React.useContext(QueryEditorContext);
35964
+ const viewDef = rootQuery == null ? void 0 : rootQuery.definition;
35965
+ if (!(viewDef instanceof ASTArrowQueryDefinition)) {
35966
+ return null;
35967
+ }
36061
35968
  return /* @__PURE__ */ jsx("div", {
36062
35969
  ...{
36063
35970
  className: "mly78zum5 mlydt5ytf mly167g77z"
@@ -36072,7 +35979,8 @@ function FieldGroupList({
36072
35979
  path
36073
35980
  }) => /* @__PURE__ */ jsx(FieldTokenWithActions, {
36074
35981
  field,
36075
- path
35982
+ path,
35983
+ viewDef
36076
35984
  }, [...path, field.name].join(".")))
36077
35985
  }, item.groupPath.join(".")))
36078
35986
  })
@@ -36311,7 +36219,7 @@ function ResizableCollapsiblePanel({
36311
36219
  width: `${width}px`
36312
36220
  },
36313
36221
  children: [children, /* @__PURE__ */ jsx(ResizeBar, {
36314
- width: initialWidth,
36222
+ width,
36315
36223
  minWidth,
36316
36224
  onWidthChange: setWidth
36317
36225
  })]