@malloydata/malloy-explorer 0.0.271-dev250506000031 → 0.0.275-dev250512182350

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.
@@ -19,7 +19,6 @@ const jsxRuntime = require("react/jsx-runtime");
19
19
  const React = require("react");
20
20
  const QB = require("@malloydata/malloy-query-builder");
21
21
  const malloyTag = require("@malloydata/malloy-tag");
22
- const render = require("@malloydata/render");
23
22
  require("@malloydata/render/webcomponent");
24
23
  const ReactDOM = require("react-dom");
25
24
  function _interopNamespaceDefault(e) {
@@ -40,7 +39,6 @@ function _interopNamespaceDefault(e) {
40
39
  }
41
40
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
42
41
  const QB__namespace = /* @__PURE__ */ _interopNamespaceDefault(QB);
43
- const render__namespace = /* @__PURE__ */ _interopNamespaceDefault(render);
44
42
  const ReactDOM__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactDOM);
45
43
  function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
46
44
  return function handleEvent(event) {
@@ -8176,6 +8174,82 @@ const styles$D = {
8176
8174
  $$css: true
8177
8175
  }
8178
8176
  };
8177
+ function CollapsiblePanel({
8178
+ title,
8179
+ children,
8180
+ icon,
8181
+ defaultOpen = true,
8182
+ controls,
8183
+ collapsedControls,
8184
+ isFocused = false
8185
+ }) {
8186
+ const [isExpanded, setIsExpanded] = React.useState(defaultOpen);
8187
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", {
8188
+ ...{
8189
+ 0: {
8190
+ className: "mlygbc89k mly1sxf85j mly1717udv"
8191
+ },
8192
+ 1: {
8193
+ className: "mly1sxf85j mly1717udv mlybwr872"
8194
+ }
8195
+ }[!!isFocused << 0],
8196
+ children: [/* @__PURE__ */ jsxRuntime.jsxs("div", {
8197
+ ...{
8198
+ className: "mlyrvj5dj mly1mt1orb mly52fmzj mlylqzeqv mlyfawy5m mly167g77z mly6s0dn4"
8199
+ },
8200
+ children: [/* @__PURE__ */ jsxRuntime.jsxs("div", {
8201
+ ...{
8202
+ className: "mlyrvj5dj mly1mt1orb mlylqzeqv mly6s0dn4 mly167g77z"
8203
+ },
8204
+ children: [icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, {
8205
+ name: icon,
8206
+ customStyle: styles$C.icon
8207
+ }), /* @__PURE__ */ jsxRuntime.jsx("div", {
8208
+ ...{
8209
+ className: "mlyuxw1ft mlyb3r6kr mlylyipyv mlyehqz9p mly1ghz6dp mly117nqv4"
8210
+ },
8211
+ children: title
8212
+ })]
8213
+ }), /* @__PURE__ */ jsxRuntime.jsxs("div", {
8214
+ ...{
8215
+ className: "mly78zum5"
8216
+ },
8217
+ children: [isExpanded ? /* @__PURE__ */ jsxRuntime.jsx("div", {
8218
+ ...{
8219
+ className: "mly78zum5 mly6s0dn4 mly1jnr06f"
8220
+ },
8221
+ children: controls
8222
+ }) : /* @__PURE__ */ jsxRuntime.jsx("div", {
8223
+ ...{
8224
+ className: "mly78zum5 mly6s0dn4 mly1jnr06f"
8225
+ },
8226
+ children: collapsedControls
8227
+ }), /* @__PURE__ */ jsxRuntime.jsx(Button, {
8228
+ variant: "flat",
8229
+ size: "compact",
8230
+ onClick: () => setIsExpanded(!isExpanded),
8231
+ icon: isExpanded ? "chevronDown" : "chevronRight",
8232
+ tooltip: isExpanded ? "Collapse" : "Expand"
8233
+ })]
8234
+ })]
8235
+ }), /* @__PURE__ */ jsxRuntime.jsx("div", {
8236
+ ...{
8237
+ 0: {
8238
+ className: "mly1l4tkcb"
8239
+ },
8240
+ 1: {
8241
+ className: "mly1l4tkcb mly1s85apg"
8242
+ }
8243
+ }[!!!isExpanded << 0],
8244
+ children
8245
+ })]
8246
+ });
8247
+ }
8248
+ const styles$C = {
8249
+ icon: {
8250
+ $$css: true
8251
+ }
8252
+ };
8179
8253
  function CollapsibleListItem({
8180
8254
  label,
8181
8255
  sublabel,
@@ -8203,10 +8277,10 @@ function CollapsibleListItem({
8203
8277
  className: "mly78zum5 mlydt5ytf mly1iyjqo2 mlyb3r6kr"
8204
8278
  },
8205
8279
  children: [/* @__PURE__ */ jsxRuntime.jsx("span", {
8206
- ..._stylex.props(fontStyles.body, styles$C.label),
8280
+ ..._stylex.props(fontStyles.body, styles$B.label),
8207
8281
  children: label
8208
8282
  }), sublabel && /* @__PURE__ */ jsxRuntime.jsx("span", {
8209
- ..._stylex.props(fontStyles.supporting, styles$C.sublabel),
8283
+ ..._stylex.props(fontStyles.supporting, styles$B.sublabel),
8210
8284
  children: sublabel
8211
8285
  })]
8212
8286
  })]
@@ -8218,7 +8292,7 @@ function CollapsibleListItem({
8218
8292
  })]
8219
8293
  });
8220
8294
  }
8221
- const styles$C = {
8295
+ const styles$B = {
8222
8296
  label: {
8223
8297
  flexGrow: "mly1iyjqo2",
8224
8298
  fontWeight: "mly1xlr1w8",
@@ -19032,7 +19106,7 @@ function Spinner({
19032
19106
  } = SIZES[size2];
19033
19107
  const frameSize = diameter + border * 2;
19034
19108
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
19035
- ..._stylex.props(styles$B.root, customStyle),
19109
+ ..._stylex.props(styles$A.root, customStyle),
19036
19110
  children: /* @__PURE__ */ jsxRuntime.jsx("span", {
19037
19111
  "aria-valuetext": "Loading",
19038
19112
  ...{
@@ -19052,7 +19126,7 @@ function Spinner({
19052
19126
  })
19053
19127
  });
19054
19128
  }
19055
- const styles$B = {
19129
+ const styles$A = {
19056
19130
  root: {
19057
19131
  alignItems: "mly6s0dn4",
19058
19132
  display: "mly3nfvp2",
@@ -19515,7 +19589,7 @@ function invalidDate() {
19515
19589
  return this._invalidDate;
19516
19590
  }
19517
19591
  var defaultOrdinal = "%d", defaultDayOfMonthOrdinalParse = /\d{1,2}/;
19518
- function ordinal(number2) {
19592
+ function ordinal$1(number2) {
19519
19593
  return this._ordinal.replace("%d", number2);
19520
19594
  }
19521
19595
  var defaultRelativeTime = {
@@ -22644,7 +22718,7 @@ var proto$1 = Locale.prototype;
22644
22718
  proto$1.calendar = calendar;
22645
22719
  proto$1.longDateFormat = longDateFormat;
22646
22720
  proto$1.invalidDate = invalidDate;
22647
- proto$1.ordinal = ordinal;
22721
+ proto$1.ordinal = ordinal$1;
22648
22722
  proto$1.preparse = preParsePostFormat;
22649
22723
  proto$1.postformat = preParsePostFormat;
22650
22724
  proto$1.relativeTime = relativeTime;
@@ -23450,7 +23524,7 @@ const Popover = ({
23450
23524
  })
23451
23525
  });
23452
23526
  };
23453
- const styles$A = {
23527
+ const styles$z = {
23454
23528
  wrapper: {
23455
23529
  position: "mly1n2onr6",
23456
23530
  $$css: true
@@ -23502,7 +23576,7 @@ const SelectDropdown = ({
23502
23576
  setOpen(false);
23503
23577
  };
23504
23578
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
23505
- ..._stylex.props(styles$A.wrapper, customStyle),
23579
+ ..._stylex.props(styles$z.wrapper, customStyle),
23506
23580
  children: [/* @__PURE__ */ jsxRuntime.jsxs("button", {
23507
23581
  type: "button",
23508
23582
  autoFocus,
@@ -23570,7 +23644,7 @@ function SelectList({
23570
23644
  const [hoveredIndex, setHoveredIndex] = React.useState(null);
23571
23645
  return /* @__PURE__ */ jsxRuntime.jsx(ScrollableArea, {
23572
23646
  children: /* @__PURE__ */ jsxRuntime.jsx("div", {
23573
- ..._stylex.props(styles$A.selectListDiv, customStyle),
23647
+ ..._stylex.props(styles$z.selectListDiv, customStyle),
23574
23648
  children: options.reduce((result, option2, index2) => {
23575
23649
  const isSelected = value !== void 0 && valueEqual(value, option2.value);
23576
23650
  if (option2.divider) {
@@ -23602,8 +23676,8 @@ function SelectList({
23602
23676
  }), /* @__PURE__ */ jsxRuntime.jsx(Icon, {
23603
23677
  name: "checkmark",
23604
23678
  customStyle: {
23605
- ...styles$A.checkIcon,
23606
- ...isSelected ? styles$A.checkIconSelected : void 0
23679
+ ...styles$z.checkIcon,
23680
+ ...isSelected ? styles$z.checkIconSelected : void 0
23607
23681
  }
23608
23682
  }), /* @__PURE__ */ jsxRuntime.jsx("span", {
23609
23683
  ...{
@@ -23617,9 +23691,89 @@ function SelectList({
23617
23691
  })
23618
23692
  });
23619
23693
  }
23694
+ const formats = {
23695
+ second: "YYYY-MM-DD HH:mm:ss",
23696
+ minute: "YYYY-MM-DD HH:mm",
23697
+ hour: "YYYY-MM-DD HH:00",
23698
+ day: "YYYY-MM-DD",
23699
+ week: "YYYY-MM-DD-[WK]",
23700
+ month: "YYYY-MM",
23701
+ quarter: "YYYY-[Q]Q",
23702
+ year: "YYYY"
23703
+ };
23704
+ const regexps = {
23705
+ second: /\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d/,
23706
+ minute: /\d\d\d\d-\d\d-\d\d \d\d:\d\d/,
23707
+ hour: /\d\d\d\d-\d\d-\d\d \d\d:00/,
23708
+ day: /\d\d\d\d-\d\d-\d\d/,
23709
+ week: /\d\d\d\d-\d\d-\d\d-WK/,
23710
+ month: /\d\d\d\d-\d\d/,
23711
+ quarter: /\d\d\d\d-Q\d/,
23712
+ year: /\d\d\d\d/
23713
+ };
23714
+ const DateInput = ({
23715
+ value,
23716
+ setValue,
23717
+ placeholder,
23718
+ autoFocus,
23719
+ units,
23720
+ onFocus,
23721
+ onBlur,
23722
+ isActive,
23723
+ customStyle,
23724
+ forwardRef
23725
+ }) => {
23726
+ const format2 = formats[units];
23727
+ const [tempValue, setTempValue] = React.useState(hooks.utc(value).format(format2));
23728
+ React.useEffect(() => {
23729
+ setTempValue(hooks.utc(value).format(format2));
23730
+ }, [value, format2]);
23731
+ return /* @__PURE__ */ jsxRuntime.jsx("input", {
23732
+ ..._stylex.props(customStyle, isActive ? styles$y.active : null),
23733
+ type: "text",
23734
+ placeholder: placeholder || format2,
23735
+ value: tempValue,
23736
+ onFocus,
23737
+ onBlur,
23738
+ onChange: (event) => {
23739
+ const raw2 = event.target.value;
23740
+ setTempValue(raw2);
23741
+ const regex = regexps[units];
23742
+ if (raw2.match(regex)) {
23743
+ const m = hooks.utc(raw2, format2);
23744
+ if (m.isValid()) {
23745
+ setValue(m.toDate());
23746
+ }
23747
+ }
23748
+ },
23749
+ autoFocus,
23750
+ ref: forwardRef
23751
+ });
23752
+ };
23753
+ function guessUnits(moment2, isDateTime) {
23754
+ if (moment2.moment === "literal") {
23755
+ const {
23756
+ literal
23757
+ } = moment2;
23758
+ for (const unit in regexps) {
23759
+ const temporalUnit = unit;
23760
+ if (literal.match(regexps[temporalUnit])) {
23761
+ return temporalUnit;
23762
+ }
23763
+ }
23764
+ }
23765
+ return isDateTime ? "second" : "day";
23766
+ }
23767
+ const styles$y = {
23768
+ active: {
23769
+ backgroundColor: "mly1vzefiq",
23770
+ $$css: true
23771
+ }
23772
+ };
23620
23773
  function monthName(month) {
23621
23774
  return ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"][month];
23622
23775
  }
23776
+ const ordinal = Object.keys(formats);
23623
23777
  function DatePicker({
23624
23778
  value,
23625
23779
  setValue,
@@ -23632,6 +23786,13 @@ function DatePicker({
23632
23786
  const calendar2 = getCalendar(date);
23633
23787
  const [pickLevel, setPickLevel] = React.useState(units);
23634
23788
  const yearBucket = Math.floor(hooks.utc(date).year() / 10) * 10;
23789
+ React.useEffect(() => {
23790
+ const unitOrd = ordinal.findIndex((unit) => unit === units);
23791
+ const pickOrd = ordinal.findIndex((unit) => unit === pickLevel);
23792
+ if (pickOrd < unitOrd) {
23793
+ setPickLevel(units);
23794
+ }
23795
+ }, [units, pickLevel]);
23635
23796
  React.useEffect(() => {
23636
23797
  setDate(value);
23637
23798
  }, [value]);
@@ -23715,7 +23876,7 @@ function DatePicker({
23715
23876
  });
23716
23877
  };
23717
23878
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
23718
- ..._stylex.props(styles$z.outer, customStyle),
23879
+ ..._stylex.props(styles$x.outer, customStyle),
23719
23880
  ref: forwardRef,
23720
23881
  children: [/* @__PURE__ */ jsxRuntime.jsxs("div", {
23721
23882
  ...{
@@ -24031,7 +24192,7 @@ function DatePicker({
24031
24192
  })]
24032
24193
  });
24033
24194
  }
24034
- const styles$z = {
24195
+ const styles$x = {
24035
24196
  outer: {
24036
24197
  userSelect: "mly87ps6o",
24037
24198
  fontSize: "mlymhiqyu",
@@ -24117,7 +24278,7 @@ function Banner({
24117
24278
  className: "mly1q4ynmn mlyh8yej3 mly5yr21d mly78zum5 mlydt5ytf mly1kmqopl mly16zck5j"
24118
24279
  },
24119
24280
  children: [/* @__PURE__ */ jsxRuntime.jsxs("div", {
24120
- ..._stylex.props(styles$y.header, variantColors[variant], children ? styles$y.headerWithContent : null),
24281
+ ..._stylex.props(styles$w.header, variantColors[variant], children ? styles$w.headerWithContent : null),
24121
24282
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
24122
24283
  ...{
24123
24284
  className: "mly1qx5ct2 mly78zum5 mlyl56j7k mly6s0dn4"
@@ -24130,22 +24291,22 @@ function Banner({
24130
24291
  className: "mly78zum5 mlydt5ytf mlyb3r6kr"
24131
24292
  },
24132
24293
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
24133
- ..._stylex.props(styles$y.title, fontStyles.emphasized),
24294
+ ..._stylex.props(styles$w.title, fontStyles.emphasized),
24134
24295
  children: title
24135
24296
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
24136
- ..._stylex.props(styles$y.description, fontStyles.supporting),
24297
+ ..._stylex.props(styles$w.description, fontStyles.supporting),
24137
24298
  children: description
24138
24299
  })]
24139
24300
  })]
24140
24301
  }), children && /* @__PURE__ */ jsxRuntime.jsx("div", {
24141
- ..._stylex.props(styles$y.content, fontStyles.body),
24302
+ ..._stylex.props(styles$w.content, fontStyles.body),
24142
24303
  children: /* @__PURE__ */ jsxRuntime.jsx(ScrollableArea, {
24143
24304
  children
24144
24305
  })
24145
24306
  })]
24146
24307
  });
24147
24308
  }
24148
- const styles$y = {
24309
+ const styles$w = {
24149
24310
  header: {
24150
24311
  borderRadius: "mly1q4ynmn",
24151
24312
  borderStartStartRadius: null,
@@ -24287,14 +24448,14 @@ function AccordionList({
24287
24448
  onExpandedItemChange: handleExpandedItemChange
24288
24449
  },
24289
24450
  children: /* @__PURE__ */ jsxRuntime.jsx("div", {
24290
- ..._stylex.props(styles$x.main, customStyle),
24451
+ ..._stylex.props(styles$v.main, customStyle),
24291
24452
  children: React__namespace.Children.map(children, (child) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
24292
24453
  children: [child, /* @__PURE__ */ jsxRuntime.jsx(Divider, {})]
24293
24454
  }))
24294
24455
  })
24295
24456
  });
24296
24457
  }
24297
- const styles$x = {
24458
+ const styles$v = {
24298
24459
  main: {
24299
24460
  display: "mly78zum5",
24300
24461
  flexDirection: "mlydt5ytf",
@@ -24331,10 +24492,10 @@ function AccordionListItem({
24331
24492
  className: "mly78zum5 mlydt5ytf mlyb3r6kr mly1iyjqo2"
24332
24493
  },
24333
24494
  children: [/* @__PURE__ */ jsxRuntime.jsx("span", {
24334
- ..._stylex.props(fontStyles.body, styles$w.label),
24495
+ ..._stylex.props(fontStyles.body, styles$u.label),
24335
24496
  children: label
24336
24497
  }), sublabel && /* @__PURE__ */ jsxRuntime.jsx("span", {
24337
- ..._stylex.props(fontStyles.supporting, styles$w.sublabel),
24498
+ ..._stylex.props(fontStyles.supporting, styles$u.sublabel),
24338
24499
  children: sublabel
24339
24500
  })]
24340
24501
  }), badge && badge, endIcon && endIcon]
@@ -24346,7 +24507,7 @@ function AccordionListItem({
24346
24507
  })]
24347
24508
  });
24348
24509
  }
24349
- const styles$w = {
24510
+ const styles$u = {
24350
24511
  label: {
24351
24512
  flexGrow: "mly1iyjqo2",
24352
24513
  fontWeight: "mly1xlr1w8",
@@ -25631,7 +25792,7 @@ function DropdownMenu({
25631
25792
  children: trigger
25632
25793
  }), /* @__PURE__ */ jsxRuntime.jsx(Portal2, {
25633
25794
  children: /* @__PURE__ */ jsxRuntime.jsx(Content2, {
25634
- ..._stylex.props(fontStyles.body, styles$v.content),
25795
+ ..._stylex.props(fontStyles.body, styles$t.content),
25635
25796
  side: "bottom",
25636
25797
  align: "start",
25637
25798
  sideOffset: 4,
@@ -25658,22 +25819,22 @@ function DropdownMenuItem({
25658
25819
  disabled,
25659
25820
  children: [icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, {
25660
25821
  name: icon,
25661
- customStyle: styles$v.icon
25822
+ customStyle: styles$t.icon
25662
25823
  }), /* @__PURE__ */ jsxRuntime.jsxs("div", {
25663
25824
  ...{
25664
25825
  className: "mly78zum5 mlydt5ytf mly1iyjqo2"
25665
25826
  },
25666
25827
  children: [/* @__PURE__ */ jsxRuntime.jsx("span", {
25667
- ..._stylex.props(fontStyles.body, styles$v.label),
25828
+ ..._stylex.props(fontStyles.body, styles$t.label),
25668
25829
  children: label
25669
25830
  }), sublabel && /* @__PURE__ */ jsxRuntime.jsx("span", {
25670
- ..._stylex.props(fontStyles.supporting, styles$v.sublabel),
25831
+ ..._stylex.props(fontStyles.supporting, styles$t.sublabel),
25671
25832
  children: sublabel
25672
25833
  })]
25673
25834
  })]
25674
25835
  });
25675
25836
  }
25676
- const styles$v = {
25837
+ const styles$t = {
25677
25838
  content: {
25678
25839
  display: "mly78zum5",
25679
25840
  flexDirection: "mlydt5ytf",
@@ -25760,7 +25921,7 @@ function QueryActionBar({
25760
25921
  children: [/* @__PURE__ */ jsxRuntime.jsx(Icon, {
25761
25922
  name: "filterSliders"
25762
25923
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
25763
- ..._stylex.props(fontStyles.largeBody, styles$u.title),
25924
+ ..._stylex.props(fontStyles.largeBody, styles$s.title),
25764
25925
  children: "Query"
25765
25926
  })]
25766
25927
  }), /* @__PURE__ */ jsxRuntime.jsxs("div", {
@@ -25805,13 +25966,13 @@ function QueryActionBar({
25805
25966
  })]
25806
25967
  });
25807
25968
  }
25808
- const styles$u = {
25969
+ const styles$s = {
25809
25970
  title: {
25810
25971
  fontWeight: "mly1xlr1w8",
25811
25972
  $$css: true
25812
25973
  }
25813
25974
  };
25814
- const styles$t = {
25975
+ const styles$r = {
25815
25976
  labelWithIcon: {
25816
25977
  display: "mly78zum5",
25817
25978
  alignItems: "mly6s0dn4",
@@ -29900,6 +30061,12 @@ function FieldToken({
29900
30061
  hoverActionsVisible,
29901
30062
  ...props2
29902
30063
  }) {
30064
+ let label = field.name;
30065
+ if (field.kind === "dimension" && (field.type.kind === "timestamp_type" || field.type.kind === "date_type")) {
30066
+ if (field.type.timeframe) {
30067
+ label += `.${field.type.timeframe}`;
30068
+ }
30069
+ }
29903
30070
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
29904
30071
  ...{
29905
30072
  0: {
@@ -29910,7 +30077,7 @@ function FieldToken({
29910
30077
  }
29911
30078
  }[!!hoverActionsVisible << 0],
29912
30079
  children: [/* @__PURE__ */ jsxRuntime.jsx(Token, {
29913
- label: field.name,
30080
+ label,
29914
30081
  color: fieldKindToColor(field.kind),
29915
30082
  icon: fieldToIcon(field),
29916
30083
  ...props2
@@ -29930,32 +30097,32 @@ function BadgeForField({
29930
30097
  label: "view",
29931
30098
  icon: "view_filled",
29932
30099
  color: "purple",
29933
- customStyle: styles$s.noBackground
30100
+ customStyle: styles$q.noBackground
29934
30101
  });
29935
30102
  } else if (field.kind === "dimension") {
29936
30103
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, {
29937
30104
  label: "dimension",
29938
30105
  icon: fieldToIcon(field),
29939
30106
  color: "cyan",
29940
- customStyle: styles$s.noBackground
30107
+ customStyle: styles$q.noBackground
29941
30108
  });
29942
30109
  } else if (field.kind === "measure") {
29943
30110
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, {
29944
30111
  label: "measure",
29945
30112
  icon: fieldToIcon(field),
29946
30113
  color: "green",
29947
- customStyle: styles$s.noBackground
30114
+ customStyle: styles$q.noBackground
29948
30115
  });
29949
30116
  } else if (field.kind === "join") {
29950
30117
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, {
29951
30118
  label: "join",
29952
30119
  icon: fieldToIcon(field),
29953
30120
  color: "gray",
29954
- customStyle: styles$s.noBackground
30121
+ customStyle: styles$q.noBackground
29955
30122
  });
29956
30123
  }
29957
30124
  }
29958
- const styles$s = {
30125
+ const styles$q = {
29959
30126
  noBackground: {
29960
30127
  backgroundColor: "mlyjbqb8w",
29961
30128
  $$css: true
@@ -29984,7 +30151,7 @@ function Visualization$1({
29984
30151
  onClick: () => setRenderer(viz)
29985
30152
  }));
29986
30153
  const tokens2 = [/* @__PURE__ */ jsxRuntime.jsx(SelectorToken, {
29987
- customStyle: styles$r.first,
30154
+ customStyle: styles$p.first,
29988
30155
  icon: `viz_${currentRenderer}`,
29989
30156
  value: currentRenderer,
29990
30157
  items: vizes,
@@ -29994,7 +30161,7 @@ function Visualization$1({
29994
30161
  children: tokens2
29995
30162
  });
29996
30163
  }
29997
- const styles$r = {
30164
+ const styles$p = {
29998
30165
  first: {
29999
30166
  flexGrow: "mly1iyjqo2",
30000
30167
  justifyContent: "mlylqzeqv",
@@ -30023,33 +30190,31 @@ function ViewAttributeTable({
30023
30190
  }) {
30024
30191
  const dimensions = viewInfo.schema.fields.filter((f2) => f2.kind === "dimension");
30025
30192
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
30026
- ..._stylex.props(styles$q.attributeTableContainer, style),
30027
- children: /* @__PURE__ */ jsxRuntime.jsx(ScrollableArea, {
30028
- children: /* @__PURE__ */ jsxRuntime.jsx("table", {
30029
- ...{
30030
- className: "mly1mwwwfo mly9f619 mlyh8yej3 mly5yr21d"
30031
- },
30032
- children: /* @__PURE__ */ jsxRuntime.jsxs("tbody", {
30033
- children: [/* @__PURE__ */ jsxRuntime.jsx(ViewAttributeTableRow, {
30034
- attribute: "chart type",
30035
- children: /* @__PURE__ */ jsxRuntime.jsx("div", {
30036
- ...{
30037
- className: "mly1rg5ohu"
30038
- },
30039
- children: /* @__PURE__ */ jsxRuntime.jsx(Visualization, {
30040
- annotations: viewInfo.annotations || []
30041
- })
30193
+ ..._stylex.props(styles$o.attributeTableContainer, style),
30194
+ children: /* @__PURE__ */ jsxRuntime.jsx("table", {
30195
+ ...{
30196
+ className: "mly1mwwwfo mly9f619 mlyh8yej3 mly5yr21d"
30197
+ },
30198
+ children: /* @__PURE__ */ jsxRuntime.jsxs("tbody", {
30199
+ children: [/* @__PURE__ */ jsxRuntime.jsx(ViewAttributeTableRow, {
30200
+ attribute: "chart type",
30201
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", {
30202
+ ...{
30203
+ className: "mly1rg5ohu"
30204
+ },
30205
+ children: /* @__PURE__ */ jsxRuntime.jsx(Visualization, {
30206
+ annotations: viewInfo.annotations || []
30042
30207
  })
30043
- }), /* @__PURE__ */ jsxRuntime.jsx(ViewAttributeTableRow, {
30044
- attribute: "output",
30045
- children: dimensions.map((f2) => /* @__PURE__ */ jsxRuntime.jsx("span", {
30046
- children: /* @__PURE__ */ jsxRuntime.jsx(FieldToken, {
30047
- field: f2,
30048
- size: isCompact ? "compact" : "default"
30049
- })
30050
- }, `${f2.kind}::${f2.name}`))
30051
- })]
30052
- })
30208
+ })
30209
+ }), /* @__PURE__ */ jsxRuntime.jsx(ViewAttributeTableRow, {
30210
+ attribute: "output",
30211
+ children: dimensions.map((f2) => /* @__PURE__ */ jsxRuntime.jsx("span", {
30212
+ children: /* @__PURE__ */ jsxRuntime.jsx(FieldToken, {
30213
+ field: f2,
30214
+ size: isCompact ? "compact" : "default"
30215
+ })
30216
+ }, `${f2.kind}::${f2.name}`))
30217
+ })]
30053
30218
  })
30054
30219
  })
30055
30220
  });
@@ -30063,9 +30228,9 @@ function ViewAttributeTableRow({
30063
30228
  className: "mlydpxx8g"
30064
30229
  },
30065
30230
  children: [/* @__PURE__ */ jsxRuntime.jsx("td", {
30066
- ..._stylex.props(styles$q.attributeTableKeyCell, fontStyles.supporting),
30231
+ ..._stylex.props(styles$o.attributeTableKeyCell, fontStyles.supporting),
30067
30232
  children: /* @__PURE__ */ jsxRuntime.jsx("div", {
30068
- ..._stylex.props(styles$q.attributeTableKeyCellContent, fontStyles.supporting),
30233
+ ..._stylex.props(styles$o.attributeTableKeyCellContent, fontStyles.supporting),
30069
30234
  children: attribute
30070
30235
  })
30071
30236
  }), /* @__PURE__ */ jsxRuntime.jsx("td", {
@@ -30076,7 +30241,7 @@ function ViewAttributeTableRow({
30076
30241
  })]
30077
30242
  });
30078
30243
  }
30079
- const styles$q = {
30244
+ const styles$o = {
30080
30245
  attributeTableContainer: {
30081
30246
  padding: "mlye8ttls",
30082
30247
  paddingInline: null,
@@ -30103,6 +30268,9 @@ const styles$q = {
30103
30268
  boxSizing: "mly9f619",
30104
30269
  width: "mlyh8yej3",
30105
30270
  height: "mly1m3v4wt",
30271
+ overflow: "mlyysyzu8",
30272
+ overflowX: null,
30273
+ overflowY: null,
30106
30274
  $$css: true
30107
30275
  },
30108
30276
  attributeTableKeyCell: {
@@ -30224,7 +30392,7 @@ function HoverText({
30224
30392
  asChild: true,
30225
30393
  children: /* @__PURE__ */ jsxRuntime.jsx("div", {
30226
30394
  ref: textRef,
30227
- ..._stylex.props(styles$p.text, fontStyles.supporting),
30395
+ ..._stylex.props(styles$n.text, fontStyles.supporting),
30228
30396
  children: text2
30229
30397
  })
30230
30398
  }), /* @__PURE__ */ jsxRuntime.jsx(Portal$4, {
@@ -30232,7 +30400,7 @@ function HoverText({
30232
30400
  side,
30233
30401
  align,
30234
30402
  children: /* @__PURE__ */ jsxRuntime.jsx("pre", {
30235
- ..._stylex.props(styles$p.hoverText, fontStyles.tooltipText),
30403
+ ..._stylex.props(styles$n.hoverText, fontStyles.tooltipText),
30236
30404
  children: text2
30237
30405
  })
30238
30406
  })
@@ -30241,7 +30409,7 @@ function HoverText({
30241
30409
  })
30242
30410
  });
30243
30411
  }
30244
- const styles$p = {
30412
+ const styles$n = {
30245
30413
  text: {
30246
30414
  overflow: "mlyb3r6kr",
30247
30415
  overflowX: null,
@@ -30294,11 +30462,11 @@ function HoverCard({
30294
30462
  customStyle
30295
30463
  }) {
30296
30464
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
30297
- ..._stylex.props(styles$o.container, fontStyles.body, customStyle),
30465
+ ..._stylex.props(styles$m.container, fontStyles.body, customStyle),
30298
30466
  children
30299
30467
  });
30300
30468
  }
30301
- const styles$o = {
30469
+ const styles$m = {
30302
30470
  container: {
30303
30471
  boxShadow: "mly5n1uv4",
30304
30472
  backgroundColor: "mly12peec7",
@@ -30343,7 +30511,7 @@ function FieldHoverCard({
30343
30511
  details = /* @__PURE__ */ jsxRuntime.jsx(ViewAttributeTable, {
30344
30512
  viewInfo: field,
30345
30513
  isCompact: true,
30346
- style: styles$n.viewAttributeTable
30514
+ style: styles$l.viewAttributeTable
30347
30515
  });
30348
30516
  } else if (field.kind === "dimension") {
30349
30517
  details = /* @__PURE__ */ jsxRuntime.jsx(TopValuesTable, {
@@ -30352,7 +30520,7 @@ function FieldHoverCard({
30352
30520
  });
30353
30521
  }
30354
30522
  return /* @__PURE__ */ jsxRuntime.jsxs(HoverCard, {
30355
- customStyle: styles$n.container,
30523
+ customStyle: styles$l.container,
30356
30524
  children: [/* @__PURE__ */ jsxRuntime.jsxs("div", {
30357
30525
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
30358
30526
  ...{
@@ -30362,10 +30530,10 @@ function FieldHoverCard({
30362
30530
  field
30363
30531
  })
30364
30532
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
30365
- ..._stylex.props(fontStyles.supporting, styles$n.path),
30533
+ ..._stylex.props(fontStyles.supporting, styles$l.path),
30366
30534
  children: pathString
30367
30535
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
30368
- ..._stylex.props(fontStyles.emphasized, styles$n.title),
30536
+ ..._stylex.props(fontStyles.emphasized, styles$l.title),
30369
30537
  children: field.name
30370
30538
  }), description && /* @__PURE__ */ jsxRuntime.jsx(HoverText, {
30371
30539
  text: description
@@ -30375,7 +30543,7 @@ function FieldHoverCard({
30375
30543
  })]
30376
30544
  });
30377
30545
  }
30378
- const styles$n = {
30546
+ const styles$l = {
30379
30547
  container: {
30380
30548
  width: "mlybl57os",
30381
30549
  maxHeight: "mlyq3t0pi",
@@ -30667,10 +30835,10 @@ const PillInput = ({
30667
30835
  commitValue();
30668
30836
  });
30669
30837
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
30670
- ..._stylex.props(fontStyles.body, styles$m.main),
30838
+ ..._stylex.props(fontStyles.body, styles$k.main),
30671
30839
  children: /* @__PURE__ */ jsxRuntime.jsx(ScrollableArea, {
30672
30840
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
30673
- ..._stylex.props(styles$m.content, customStyle),
30841
+ ..._stylex.props(styles$k.content, customStyle),
30674
30842
  onKeyUp,
30675
30843
  onClick: () => {
30676
30844
  var _a2;
@@ -30737,7 +30905,7 @@ const Pill = ({
30737
30905
  onClick,
30738
30906
  tabIndex: 0,
30739
30907
  ref: forwardRef,
30740
- ..._stylex.props(styles$m.pill, colorVariants[color]),
30908
+ ..._stylex.props(styles$k.pill, colorVariants[color]),
30741
30909
  children: [children, /* @__PURE__ */ jsxRuntime.jsx("div", {
30742
30910
  title: "Remove",
30743
30911
  ...{
@@ -30752,7 +30920,7 @@ const Pill = ({
30752
30920
  })]
30753
30921
  });
30754
30922
  };
30755
- const styles$m = {
30923
+ const styles$k = {
30756
30924
  main: {
30757
30925
  borderRadius: "mly12oqio5",
30758
30926
  borderStartStartRadius: null,
@@ -30936,7 +31104,7 @@ function ValueList({
30936
31104
  children: (stringSearchResults == null ? void 0 : stringSearchResults.length) ? stringSearchResults.map((value) => /* @__PURE__ */ jsxRuntime.jsxs("div", {
30937
31105
  role: "menuitem",
30938
31106
  tabIndex: -1,
30939
- ..._stylex.props(addMenuStyles.item, styles$l.valueItem),
31107
+ ..._stylex.props(addMenuStyles.item, styles$j.valueItem),
30940
31108
  onClick: () => onClick(value),
30941
31109
  children: [/* @__PURE__ */ jsxRuntime.jsx(Value, {
30942
31110
  value
@@ -30960,10 +31128,10 @@ function Value({
30960
31128
  label: value.fieldValue ?? "∅",
30961
31129
  icon: "filter",
30962
31130
  color: "purple",
30963
- customStyle: styles$l.token
31131
+ customStyle: styles$j.token
30964
31132
  });
30965
31133
  }
30966
- const styles$l = {
31134
+ const styles$j = {
30967
31135
  valueItem: {
30968
31136
  height: "mly1qx5ct2",
30969
31137
  paddingTop: "mly1y1aw1k",
@@ -31139,7 +31307,7 @@ const StringFilterCore = ({
31139
31307
  setSearchValue("");
31140
31308
  }
31141
31309
  },
31142
- customStyle: styles$k.valueList
31310
+ customStyle: styles$i.valueList
31143
31311
  })
31144
31312
  })]
31145
31313
  }) : currentFilter.operator === "~" ? /* @__PURE__ */ jsxRuntime.jsx(StringEditor, {
@@ -31207,7 +31375,7 @@ function stringFilterChangeType(filter, type) {
31207
31375
  };
31208
31376
  }
31209
31377
  }
31210
- const styles$k = {
31378
+ const styles$i = {
31211
31379
  valueList: {
31212
31380
  maxHeight: "mly3d5gib",
31213
31381
  width: "mly1hfn5x7",
@@ -31462,85 +31630,6 @@ function makeFilterWithNewType(filter, type) {
31462
31630
  };
31463
31631
  }
31464
31632
  }
31465
- const formats = {
31466
- second: "YYYY-MM-DD HH:mm:ss",
31467
- minute: "YYYY-MM-DD HH:mm",
31468
- hour: "YYYY-MM-DD HH:00",
31469
- day: "YYYY-MM-DD",
31470
- week: "[WK]YYYY-WW",
31471
- month: "YYYY-MM",
31472
- quarter: "YYYY-[Q]Q",
31473
- year: "YYYY"
31474
- };
31475
- const regexps = {
31476
- second: /\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d/,
31477
- minute: /\d\d\d\d-\d\d-\d\d \d\d:\d\d/,
31478
- hour: /\d\d\d\d-\d\d-\d\d \d\d:00/,
31479
- day: /\d\d\d\d-\d\d-\d\d/,
31480
- week: /WK\d\d\d\d-\d\d-\d\d/,
31481
- month: /\d\d\d\d-\d\d/,
31482
- quarter: /\d\d\d\d-Q\d/,
31483
- year: /\d\d\d\d/
31484
- };
31485
- const DateInput = ({
31486
- value,
31487
- setValue,
31488
- placeholder,
31489
- autoFocus,
31490
- units,
31491
- onFocus,
31492
- onBlur,
31493
- isActive,
31494
- customStyle,
31495
- forwardRef
31496
- }) => {
31497
- const format2 = formats[units];
31498
- const [tempValue, setTempValue] = React.useState(hooks.utc(value).format(format2));
31499
- React.useEffect(() => {
31500
- setTempValue(hooks.utc(value).format(format2));
31501
- }, [value, format2]);
31502
- return /* @__PURE__ */ jsxRuntime.jsx("input", {
31503
- ..._stylex.props(customStyle, isActive ? styles$j.active : null),
31504
- type: "text",
31505
- placeholder: placeholder || format2,
31506
- value: tempValue,
31507
- onFocus,
31508
- onBlur,
31509
- onChange: (event) => {
31510
- const raw2 = event.target.value;
31511
- setTempValue(raw2);
31512
- const regex = regexps[units];
31513
- if (raw2.match(regex)) {
31514
- const m = hooks.utc(raw2, format2);
31515
- if (m.isValid()) {
31516
- setValue(m.toDate());
31517
- }
31518
- }
31519
- },
31520
- autoFocus,
31521
- ref: forwardRef
31522
- });
31523
- };
31524
- function guessUnits(moment2, isDateTime) {
31525
- if (moment2.moment === "literal") {
31526
- const {
31527
- literal
31528
- } = moment2;
31529
- for (const unit in regexps) {
31530
- const temporalUnit = unit;
31531
- if (literal.match(regexps[temporalUnit])) {
31532
- return temporalUnit;
31533
- }
31534
- }
31535
- }
31536
- return isDateTime ? "second" : "day";
31537
- }
31538
- const styles$j = {
31539
- active: {
31540
- backgroundColor: "mly1vzefiq",
31541
- $$css: true
31542
- }
31543
- };
31544
31633
  function typeFromFilter(filter) {
31545
31634
  if (filter.operator === "null" && filter.not) {
31546
31635
  return "-null";
@@ -31737,15 +31826,48 @@ function NUnitFilter({
31737
31826
  });
31738
31827
  }
31739
31828
  function UnitFilter({
31829
+ currentFilter,
31830
+ updateFilter,
31740
31831
  units,
31741
31832
  setUnits,
31742
31833
  maxLevel
31743
31834
  }) {
31744
31835
  const options = maxLevel === "day" ? DateUnits : [...DateUnits, ...TimeUnits];
31836
+ const updateUnits = (units2) => {
31837
+ setUnits(units2);
31838
+ switch (currentFilter.operator) {
31839
+ case "after":
31840
+ updateFilter({
31841
+ ...currentFilter,
31842
+ after: updateMoment(currentFilter.after, units2)
31843
+ });
31844
+ return;
31845
+ case "before":
31846
+ updateFilter({
31847
+ ...currentFilter,
31848
+ before: updateMoment(currentFilter.before, units2)
31849
+ });
31850
+ return;
31851
+ case "to":
31852
+ updateFilter({
31853
+ ...currentFilter,
31854
+ fromMoment: updateMoment(currentFilter.fromMoment, units2),
31855
+ toMoment: updateMoment(currentFilter.toMoment, units2)
31856
+ });
31857
+ return;
31858
+ case "in": {
31859
+ updateFilter({
31860
+ ...currentFilter,
31861
+ in: updateMoment(currentFilter.in, units2)
31862
+ });
31863
+ return;
31864
+ }
31865
+ }
31866
+ };
31745
31867
  return /* @__PURE__ */ jsxRuntime.jsx(SelectDropdown, {
31746
31868
  options,
31747
31869
  value: units,
31748
- onChange: setUnits,
31870
+ onChange: updateUnits,
31749
31871
  customStyle: filterStyles.editorCell
31750
31872
  });
31751
31873
  }
@@ -31870,15 +31992,19 @@ function DoubleDateFilter({
31870
31992
  function createTemporalLiteral(date, units) {
31871
31993
  return {
31872
31994
  moment: "literal",
31873
- literal: hooks.utc(date).format(formats[units])
31995
+ literal: hooks.utc(date).format(formats[units]),
31996
+ units
31874
31997
  };
31875
31998
  }
31876
31999
  function extractDateFromMoment(momentObj) {
31877
32000
  if (momentObj && momentObj.moment === "literal") {
31878
- return hooks.utc(momentObj.literal).toDate();
32001
+ return hooks.utc(momentObj.literal, formats[momentObj.units ?? "second"]).toDate();
31879
32002
  }
31880
32003
  return /* @__PURE__ */ new Date();
31881
32004
  }
32005
+ function updateMoment(moment2, units) {
32006
+ return createTemporalLiteral(extractDateFromMoment(moment2), units);
32007
+ }
31882
32008
  function dateTimeFilterChangeType(filter, type, units) {
31883
32009
  let n = "7";
31884
32010
  let fromMoment = createTemporalLiteral(/* @__PURE__ */ new Date(), units);
@@ -31922,6 +32048,11 @@ function dateTimeFilterChangeType(filter, type, units) {
31922
32048
  operator: type,
31923
32049
  before: fromMoment
31924
32050
  };
32051
+ case "in":
32052
+ return {
32053
+ operator: type,
32054
+ in: fromMoment
32055
+ };
31925
32056
  case "to":
31926
32057
  return {
31927
32058
  operator: type,
@@ -31987,6 +32118,13 @@ function FilterDialog({
31987
32118
  };
31988
32119
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
31989
32120
  ..._stylex.props(fontStyles.body, filterStyles.filterDialog),
32121
+ onKeyDown: (event) => {
32122
+ if (event.key === "Enter") {
32123
+ onApply();
32124
+ } else if (event.key === "Esc") {
32125
+ onCancel();
32126
+ }
32127
+ },
31990
32128
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
31991
32129
  ..._stylex.props(filterStyles.filterDialogHeader),
31992
32130
  children: fieldInfo.name
@@ -32180,7 +32318,7 @@ function FieldList({
32180
32318
  ..._stylex.props(customStyle),
32181
32319
  children: groups.length ? groups.map((group) => /* @__PURE__ */ jsxRuntime.jsxs("div", {
32182
32320
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
32183
- ..._stylex.props(addMenuStyles.item, styles$i.fieldItem),
32321
+ ..._stylex.props(addMenuStyles.item, styles$h.fieldItem),
32184
32322
  "data-disabled": "true",
32185
32323
  children: group.name
32186
32324
  }), group.fields.map((field) => isFilterOperation && (field.kind === "dimension" || field.kind === "measure") ? /* @__PURE__ */ jsxRuntime.jsx(FilterPopover, {
@@ -32190,7 +32328,7 @@ function FieldList({
32190
32328
  anchor: /* @__PURE__ */ jsxRuntime.jsx("div", {
32191
32329
  role: "menuitem",
32192
32330
  tabIndex: -1,
32193
- ..._stylex.props(addMenuStyles.item, styles$i.fieldItem),
32331
+ ..._stylex.props(addMenuStyles.item, styles$h.fieldItem),
32194
32332
  children: /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, {
32195
32333
  asChild: true,
32196
32334
  children: /* @__PURE__ */ jsxRuntime.jsx(FieldToken, {
@@ -32217,7 +32355,7 @@ function FieldList({
32217
32355
  }, group.name + ":" + field.name) : /* @__PURE__ */ jsxRuntime.jsx("div", {
32218
32356
  role: "menuitem",
32219
32357
  tabIndex: -1,
32220
- ..._stylex.props(addMenuStyles.item, styles$i.fieldItem),
32358
+ ..._stylex.props(addMenuStyles.item, styles$h.fieldItem),
32221
32359
  children: /* @__PURE__ */ jsxRuntime.jsx(FieldToken, {
32222
32360
  field,
32223
32361
  onClick: () => onAddOperation(field, group.path),
@@ -32240,7 +32378,7 @@ function FieldList({
32240
32378
  })
32241
32379
  });
32242
32380
  }
32243
- const styles$i = {
32381
+ const styles$h = {
32244
32382
  fieldItem: {
32245
32383
  height: "mly1qx5ct2",
32246
32384
  paddingTop: "mly1y1aw1k",
@@ -32258,7 +32396,7 @@ function FieldMenu({
32258
32396
  }) {
32259
32397
  const [search, setSearch] = React.useState("");
32260
32398
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
32261
- ..._stylex.props(addMenuStyles.content, styles$h.content),
32399
+ ..._stylex.props(addMenuStyles.content, styles$g.content),
32262
32400
  role: "menu",
32263
32401
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
32264
32402
  ..._stylex.props(addMenuStyles.item),
@@ -32284,7 +32422,7 @@ function FieldMenu({
32284
32422
  })]
32285
32423
  });
32286
32424
  }
32287
- const styles$h = {
32425
+ const styles$g = {
32288
32426
  content: {
32289
32427
  maxHeight: "mly3d5gib",
32290
32428
  $$css: true
@@ -32311,6 +32449,7 @@ function segmentNestNo(segment, name) {
32311
32449
  }, 1);
32312
32450
  }
32313
32451
  function addGroupBy(view, field, path) {
32452
+ const type = field.kind === "dimension" ? field.type.kind : "string";
32314
32453
  const segment = view.getOrAddDefaultSegment();
32315
32454
  const {
32316
32455
  fields
@@ -32319,7 +32458,13 @@ function addGroupBy(view, field, path) {
32319
32458
  if (fields.find((f2) => f2.name === field.name)) {
32320
32459
  rename = findUniqueFieldName(fields, field.name, path);
32321
32460
  }
32322
- segment.addGroupBy(field.name, path, rename);
32461
+ if (type === "date_type") {
32462
+ segment.addDateGroupBy(field.name, path, "day");
32463
+ } else if (type === "timestamp_type") {
32464
+ segment.addTimestampGroupBy(field.name, path, "second");
32465
+ } else {
32466
+ segment.addGroupBy(field.name, path, rename);
32467
+ }
32323
32468
  }
32324
32469
  function addAggregate(view, field, path) {
32325
32470
  const segment = view.getOrAddDefaultSegment();
@@ -32343,6 +32488,18 @@ function addNest(view, field) {
32343
32488
  }
32344
32489
  segment.addNest(field.name, rename);
32345
32490
  }
32491
+ function addOrderBy(view, field, direction = "desc") {
32492
+ const segment = view.getOrAddDefaultSegment();
32493
+ segment.addOrderBy(field.name, direction);
32494
+ }
32495
+ function addFilter(view, field, path, filter) {
32496
+ const segment = view.getOrAddDefaultSegment();
32497
+ if (field.kind === "dimension") {
32498
+ segment.addWhere(field.name, path, filter);
32499
+ } else {
32500
+ segment.addHaving(field.name, path, filter);
32501
+ }
32502
+ }
32346
32503
  function getSegmentIfPresent(parent) {
32347
32504
  const definition = getViewDefinition(parent);
32348
32505
  if (definition instanceof QB.ASTSegmentViewDefinition) {
@@ -32368,7 +32525,7 @@ function OperationActionTitle({
32368
32525
  return !(segment == null ? void 0 : segment.hasField(field.name, path)) && isNotAnnotatedFilteredField(field);
32369
32526
  };
32370
32527
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
32371
- ..._stylex.props(styles$t.title, hoverStyles.main),
32528
+ ..._stylex.props(styles$r.title, hoverStyles.main),
32372
32529
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
32373
32530
  children: title
32374
32531
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
@@ -32765,7 +32922,14 @@ function RenameDialog({
32765
32922
  ..._stylex.props({
32766
32923
  ...dialogStyles.editorCell,
32767
32924
  ...dialogStyles.input
32768
- })
32925
+ }),
32926
+ onKeyDown: (event) => {
32927
+ if (event.key === "Enter") {
32928
+ onRename();
32929
+ } else if (event.key === "Esc") {
32930
+ setOpen(false);
32931
+ }
32932
+ }
32769
32933
  }), badName && /* @__PURE__ */ jsxRuntime.jsx(ErrorIcon, {
32770
32934
  errorMessage: "Name already in use"
32771
32935
  })]
@@ -32938,7 +33102,7 @@ function SortableOperations({
32938
33102
  fields,
32939
33103
  ...props2
32940
33104
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
32941
- ..._stylex.props(styles$t.tokenContainer),
33105
+ ..._stylex.props(styles$r.tokenContainer),
32942
33106
  children: /* @__PURE__ */ jsxRuntime.jsx(DndContext, {
32943
33107
  sensors,
32944
33108
  collisionDetection: closestCenter,
@@ -32946,6 +33110,7 @@ function SortableOperations({
32946
33110
  children: /* @__PURE__ */ jsxRuntime.jsx(SortableContext, {
32947
33111
  items,
32948
33112
  children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(SortableOperation, {
33113
+ rootQuery,
32949
33114
  id: item.id,
32950
33115
  color: kind === "group_by" ? "cyan" : "green",
32951
33116
  view,
@@ -32956,18 +33121,19 @@ function SortableOperations({
32956
33121
  })]
32957
33122
  });
32958
33123
  }
33124
+ const NULL_PATH = [];
32959
33125
  function SortableOperation({
33126
+ rootQuery,
32960
33127
  id,
32961
33128
  view,
32962
33129
  operation,
32963
33130
  color
32964
33131
  }) {
32965
33132
  const {
32966
- rootQuery,
32967
33133
  setQuery
32968
33134
  } = React.useContext(QueryEditorContext);
32969
33135
  const fieldInfo = operation.getFieldInfo();
32970
- const path = operation.field.getReference().path ?? [];
33136
+ const path = operation.field.getReference().path ?? NULL_PATH;
32971
33137
  const {
32972
33138
  attributes,
32973
33139
  listeners,
@@ -32987,37 +33153,64 @@ function SortableOperation({
32987
33153
  transform: CSS$1.Transform.toString(transform2),
32988
33154
  transition
32989
33155
  };
33156
+ const hoverActions = React.useMemo(() => {
33157
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
33158
+ children: [/* @__PURE__ */ jsxRuntime.jsx(DropdownMenu, {
33159
+ trigger: /* @__PURE__ */ jsxRuntime.jsx(Button, {
33160
+ variant: "flat",
33161
+ icon: "meatballs",
33162
+ size: "compact",
33163
+ tooltip: "More Actions"
33164
+ }),
33165
+ onOpenChange: setHoverActionsVisible,
33166
+ children: [/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, {
33167
+ label: "Rename",
33168
+ onClick: () => {
33169
+ setRenameTarget(operation);
33170
+ setRenameOpen(true);
33171
+ }
33172
+ }, "rename")]
33173
+ }, [...path, fieldInfo.name].join(".")), /* @__PURE__ */ jsxRuntime.jsx(ClearButton, {
33174
+ onClick: () => {
33175
+ operation.delete();
33176
+ setQuery == null ? void 0 : setQuery(rootQuery == null ? void 0 : rootQuery.build());
33177
+ }
33178
+ })]
33179
+ });
33180
+ }, [fieldInfo, operation, path, rootQuery, setQuery]);
33181
+ const granular = granularityMenuItems(fieldInfo, operation.field);
33182
+ let icon = "orderBy";
33183
+ if (fieldInfo.kind === "dimension" || fieldInfo.kind === "measure") {
33184
+ icon = atomicTypeToIcon(fieldInfo.type.kind);
33185
+ }
32990
33186
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
32991
33187
  id,
32992
33188
  ref: setNodeRef,
32993
33189
  style,
32994
- children: [/* @__PURE__ */ jsxRuntime.jsx(FieldToken, {
33190
+ children: [granular ? /* @__PURE__ */ jsxRuntime.jsxs(TokenGroup, {
33191
+ customStyle: customStyles.tokenGroup,
33192
+ children: [/* @__PURE__ */ jsxRuntime.jsx(Token, {
33193
+ color,
33194
+ icon,
33195
+ label: fieldInfo.name,
33196
+ dragProps: {
33197
+ attributes,
33198
+ listeners
33199
+ }
33200
+ }), /* @__PURE__ */ jsxRuntime.jsx(SelectorToken, {
33201
+ color,
33202
+ value: granular.value,
33203
+ onChange: (granulation) => {
33204
+ if (operation.field.expression instanceof QB.ASTTimeTruncationExpression) operation.field.expression.truncation = granulation;
33205
+ setQuery == null ? void 0 : setQuery(rootQuery.build());
33206
+ },
33207
+ items: granular.options
33208
+ })]
33209
+ }) : /* @__PURE__ */ jsxRuntime.jsx(FieldToken, {
32995
33210
  field: fieldInfo,
32996
33211
  color,
32997
33212
  hoverActionsVisible,
32998
- hoverActions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
32999
- children: [/* @__PURE__ */ jsxRuntime.jsx(DropdownMenu, {
33000
- trigger: /* @__PURE__ */ jsxRuntime.jsx(Button, {
33001
- variant: "flat",
33002
- icon: "meatballs",
33003
- size: "compact",
33004
- tooltip: "More Actions"
33005
- }),
33006
- onOpenChange: setHoverActionsVisible,
33007
- children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, {
33008
- label: "Rename",
33009
- onClick: () => {
33010
- setRenameTarget(operation);
33011
- setRenameOpen(true);
33012
- }
33013
- })
33014
- }, [...path, fieldInfo.name].join(".")), /* @__PURE__ */ jsxRuntime.jsx(ClearButton, {
33015
- onClick: () => {
33016
- operation.delete();
33017
- setQuery == null ? void 0 : setQuery(rootQuery == null ? void 0 : rootQuery.build());
33018
- }
33019
- })]
33020
- }),
33213
+ hoverActions,
33021
33214
  tooltip: /* @__PURE__ */ jsxRuntime.jsx(FieldHoverCard, {
33022
33215
  field: fieldInfo,
33023
33216
  path
@@ -33040,6 +33233,38 @@ function SortableOperation({
33040
33233
  })]
33041
33234
  });
33042
33235
  }
33236
+ const DateGranulation = ["day", "week", "month", "quarter", "year"];
33237
+ const TimestampGranulation = ["second", "minute", "hour", "day", "week", "month", "quarter", "year"];
33238
+ function granularityMenuItems(fieldInfo, field) {
33239
+ if (fieldInfo.kind !== "dimension" || !(field.expression instanceof QB.ASTTimeTruncationExpression)) {
33240
+ return null;
33241
+ }
33242
+ if (fieldInfo.type.kind === "timestamp_type") {
33243
+ return {
33244
+ value: fieldInfo.type.timeframe ?? "second",
33245
+ options: TimestampGranulation.map((value) => ({
33246
+ label: value,
33247
+ value
33248
+ }))
33249
+ };
33250
+ }
33251
+ if (fieldInfo.type.kind === "date_type") {
33252
+ return {
33253
+ value: fieldInfo.type.timeframe ?? "day",
33254
+ options: DateGranulation.map((value) => ({
33255
+ label: value,
33256
+ value
33257
+ }))
33258
+ };
33259
+ }
33260
+ return null;
33261
+ }
33262
+ const customStyles = {
33263
+ tokenGroup: {
33264
+ display: "mly78zum5",
33265
+ $$css: true
33266
+ }
33267
+ };
33043
33268
  function GroupByOperations({
33044
33269
  rootQuery,
33045
33270
  segment,
@@ -33088,10 +33313,10 @@ function FilterOperations({
33088
33313
  }
33089
33314
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
33090
33315
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
33091
- ..._stylex.props(styles$t.title),
33316
+ ..._stylex.props(styles$r.title),
33092
33317
  children: "filter by"
33093
33318
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
33094
- ..._stylex.props(styles$t.tokenContainer),
33319
+ ..._stylex.props(styles$r.tokenContainer),
33095
33320
  children: filters.map((filterOperation, key2) => {
33096
33321
  return /* @__PURE__ */ jsxRuntime.jsx(ErrorElement, {
33097
33322
  fallback: /* @__PURE__ */ jsxRuntime.jsxs("div", {
@@ -33355,7 +33580,7 @@ function LimitOperation({
33355
33580
  }
33356
33581
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
33357
33582
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
33358
- ..._stylex.props(styles$t.title),
33583
+ ..._stylex.props(styles$r.title),
33359
33584
  children: "limit"
33360
33585
  }), /* @__PURE__ */ jsxRuntime.jsxs("div", {
33361
33586
  ..._stylex.props(hoverStyles.main),
@@ -33405,10 +33630,10 @@ function OrderByOperations({
33405
33630
  }
33406
33631
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
33407
33632
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
33408
- ..._stylex.props(styles$t.title),
33633
+ ..._stylex.props(styles$r.title),
33409
33634
  children: "order by"
33410
33635
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
33411
- ..._stylex.props(styles$t.tokenContainer),
33636
+ ..._stylex.props(styles$r.tokenContainer),
33412
33637
  children: orderBys.map((orderBy) => {
33413
33638
  const {
33414
33639
  fieldReference
@@ -33476,77 +33701,6 @@ function View({
33476
33701
  })]
33477
33702
  });
33478
33703
  }
33479
- function CollapsiblePanel({
33480
- title,
33481
- children,
33482
- icon,
33483
- defaultOpen = true,
33484
- controls,
33485
- collapsedControls,
33486
- isFocused = false
33487
- }) {
33488
- const [isExpanded, setIsExpanded] = React.useState(defaultOpen);
33489
- return /* @__PURE__ */ jsxRuntime.jsxs("div", {
33490
- ...{
33491
- 0: {
33492
- className: "mlygbc89k mly1sxf85j mly1717udv"
33493
- },
33494
- 1: {
33495
- className: "mly1sxf85j mly1717udv mlybwr872"
33496
- }
33497
- }[!!isFocused << 0],
33498
- children: [/* @__PURE__ */ jsxRuntime.jsxs("div", {
33499
- ...{
33500
- className: "mlyrvj5dj mly1mt1orb mly52fmzj mlylqzeqv mlyfawy5m mly167g77z mly6s0dn4"
33501
- },
33502
- children: [/* @__PURE__ */ jsxRuntime.jsxs("div", {
33503
- ...{
33504
- className: "mlyrvj5dj mly1mt1orb mlylqzeqv mly6s0dn4 mly167g77z"
33505
- },
33506
- children: [icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, {
33507
- name: icon,
33508
- customStyle: styles$g.icon
33509
- }), /* @__PURE__ */ jsxRuntime.jsx("div", {
33510
- ...{
33511
- className: "mlyuxw1ft mlyb3r6kr mlylyipyv mlyehqz9p mly1ghz6dp"
33512
- },
33513
- children: title
33514
- })]
33515
- }), /* @__PURE__ */ jsxRuntime.jsxs("div", {
33516
- ...{
33517
- className: "mly78zum5"
33518
- },
33519
- children: [isExpanded ? /* @__PURE__ */ jsxRuntime.jsx("div", {
33520
- ...{
33521
- className: "mly78zum5 mly6s0dn4 mly1jnr06f"
33522
- },
33523
- children: controls
33524
- }) : /* @__PURE__ */ jsxRuntime.jsx("div", {
33525
- ...{
33526
- className: "mly78zum5 mly6s0dn4 mly1jnr06f"
33527
- },
33528
- children: collapsedControls
33529
- }), /* @__PURE__ */ jsxRuntime.jsx(Button, {
33530
- variant: "flat",
33531
- size: "compact",
33532
- onClick: () => setIsExpanded(!isExpanded),
33533
- icon: isExpanded ? "chevronDown" : "chevronRight",
33534
- tooltip: isExpanded ? "Collapse" : "Expand"
33535
- })]
33536
- })]
33537
- }), isExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", {
33538
- ...{
33539
- className: "mly1l4tkcb"
33540
- },
33541
- children
33542
- })]
33543
- });
33544
- }
33545
- const styles$g = {
33546
- icon: {
33547
- $$css: true
33548
- }
33549
- };
33550
33704
  function AddItem({
33551
33705
  icon,
33552
33706
  label,
@@ -33669,7 +33823,8 @@ function AddFieldItem({
33669
33823
  }
33670
33824
  const styles$e = {
33671
33825
  list: {
33672
- width: "mlyqyf9gi",
33826
+ minWidth: "mly2ixbly",
33827
+ maxWidth: "mly1j9u4d2",
33673
33828
  $$css: true
33674
33829
  }
33675
33830
  };
@@ -33691,8 +33846,7 @@ function AddOrderBy({
33691
33846
  fields,
33692
33847
  types: ["dimension"],
33693
33848
  onAddOperation: (field) => {
33694
- const segment2 = view.getOrAddDefaultSegment();
33695
- segment2.addOrderBy(field.name, "asc");
33849
+ addOrderBy(view, field);
33696
33850
  setQuery == null ? void 0 : setQuery(rootQuery.build());
33697
33851
  },
33698
33852
  disabledMessage: "There must be at least one field in the output to order by.",
@@ -33769,28 +33923,21 @@ function AddWhere({
33769
33923
  const {
33770
33924
  fields
33771
33925
  } = getInputSchemaFromViewParent(view);
33772
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
33773
- children: /* @__PURE__ */ jsxRuntime.jsx(AddFieldItem, {
33774
- label: "Add filter",
33775
- icon: "filter",
33776
- view,
33777
- fields,
33778
- types: ["measure", "dimension"],
33779
- filter: (_segment, field) => (field.kind === "dimension" || field.kind === "measure") && FILTERABLE_TYPES$1.has(field.type.kind) && isNotAnnotatedFilteredField(field),
33780
- onAddOperation: (field, path, filter) => {
33781
- if (filter && (field.kind === "dimension" || field.kind === "measure")) {
33782
- const segment = view.getOrAddDefaultSegment();
33783
- if (field.kind === "dimension") {
33784
- segment.addWhere(field.name, path, filter);
33785
- } else {
33786
- segment.addHaving(field.name, path, filter);
33787
- }
33788
- setQuery == null ? void 0 : setQuery(rootQuery == null ? void 0 : rootQuery.build());
33789
- }
33790
- },
33791
- isFilterOperation: true,
33792
- search
33793
- })
33926
+ return /* @__PURE__ */ jsxRuntime.jsx(AddFieldItem, {
33927
+ label: "Add filter",
33928
+ icon: "filter",
33929
+ view,
33930
+ fields,
33931
+ types: ["measure", "dimension"],
33932
+ filter: (_segment, field) => (field.kind === "dimension" || field.kind === "measure") && FILTERABLE_TYPES$1.has(field.type.kind) && isNotAnnotatedFilteredField(field),
33933
+ onAddOperation: (field, path, filter) => {
33934
+ if (filter && (field.kind === "dimension" || field.kind === "measure")) {
33935
+ addFilter(view, field, path, filter);
33936
+ setQuery == null ? void 0 : setQuery(rootQuery == null ? void 0 : rootQuery.build());
33937
+ }
33938
+ },
33939
+ isFilterOperation: true,
33940
+ search
33794
33941
  });
33795
33942
  }
33796
33943
  const FILTERABLE_TYPES$1 = /* @__PURE__ */ new Set(["string_type", "boolean_type", "number_type", "date_type", "timestamp_type"]);
@@ -34007,7 +34154,7 @@ function NestOperations({
34007
34154
  return null;
34008
34155
  }
34009
34156
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
34010
- ..._stylex.props(styles$t.tokenContainer),
34157
+ ..._stylex.props(styles$r.tokenContainer),
34011
34158
  children: nests.map((nest) => /* @__PURE__ */ jsxRuntime.jsx(NestOperation, {
34012
34159
  rootQuery,
34013
34160
  view,
@@ -34046,7 +34193,6 @@ function NestOperation({
34046
34193
  onCurrentNestViewChange == null ? void 0 : onCurrentNestViewChange(null);
34047
34194
  }
34048
34195
  };
34049
- const defaultOpen = nest.view.definition.node.kind === "segment" && nest.view.definition.node.operations.length === 0;
34050
34196
  const getControls = (nest2) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
34051
34197
  children: [/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, {
34052
34198
  trigger: /* @__PURE__ */ jsxRuntime.jsx(Button, {
@@ -34085,7 +34231,7 @@ function NestOperation({
34085
34231
  children: [/* @__PURE__ */ jsxRuntime.jsx(CollapsiblePanel, {
34086
34232
  title: nest.name,
34087
34233
  icon: viewToVisualizationIcon(nest.view),
34088
- defaultOpen,
34234
+ defaultOpen: true,
34089
34235
  controls: getControls(nest),
34090
34236
  collapsedControls: getControls(nest),
34091
34237
  isFocused: isCurrentNestQueryPanelFocused,
@@ -34210,7 +34356,7 @@ function ViewDefinition({
34210
34356
  function CollapsingView({
34211
34357
  viewDef
34212
34358
  }) {
34213
- const [collapsed, setCollapsed] = React.useState(true);
34359
+ const [collapsed, setCollapsed] = React.useState(false);
34214
34360
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
34215
34361
  ...{
34216
34362
  0: {
@@ -34284,6 +34430,7 @@ function Query({
34284
34430
  onCurrentNestQueryPanelChange == null ? void 0 : onCurrentNestQueryPanelChange(null);
34285
34431
  onCurrentNestViewChange == null ? void 0 : onCurrentNestViewChange(null);
34286
34432
  };
34433
+ const canEditViz = query.definition instanceof QB.ASTSegmentViewDefinition;
34287
34434
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
34288
34435
  onPointerDownCapture: focusMainQueryPanel,
34289
34436
  children: /* @__PURE__ */ jsxRuntime.jsxs(CollapsiblePanel, {
@@ -34332,7 +34479,7 @@ function Query({
34332
34479
  flexDirection: "column",
34333
34480
  gap: 8
34334
34481
  },
34335
- children: [!query.isEmpty() && /* @__PURE__ */ jsxRuntime.jsx(Visualization$1, {
34482
+ children: [!query.isEmpty() && canEditViz && /* @__PURE__ */ jsxRuntime.jsx(Visualization$1, {
34336
34483
  rootQuery,
34337
34484
  view: query
34338
34485
  }), /* @__PURE__ */ jsxRuntime.jsx(ViewDefinition, {
@@ -34346,12 +34493,13 @@ function Query({
34346
34493
  },
34347
34494
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
34348
34495
  ...{
34349
- className: "mly78zum5 mly6s0dn4"
34496
+ className: "mly78zum5 mly6s0dn4 mlywzxoxx"
34350
34497
  },
34351
34498
  children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
34352
34499
  children: "Click"
34353
34500
  }), /* @__PURE__ */ jsxRuntime.jsx(Icon, {
34354
- name: "insert"
34501
+ name: "insert",
34502
+ color: "disabled"
34355
34503
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
34356
34504
  children: "to get started"
34357
34505
  })]
@@ -34365,14 +34513,14 @@ function Source({
34365
34513
  }) {
34366
34514
  if (rootQuery.definition instanceof QB.ASTArrowQueryDefinition) {
34367
34515
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
34368
- ..._stylex.props(styles$t.queryCard, styles$b.content),
34516
+ ..._stylex.props(styles$r.queryCard, styles$b.content),
34369
34517
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
34370
- ..._stylex.props(styles$t.labelWithIcon),
34518
+ ..._stylex.props(styles$r.labelWithIcon),
34371
34519
  children: [/* @__PURE__ */ jsxRuntime.jsx(Icon, {
34372
34520
  name: "database"
34373
34521
  }), /* @__PURE__ */ jsxRuntime.jsx("div", {
34374
34522
  ...{
34375
- className: "mlyb3r6kr mlylyipyv"
34523
+ className: "mlyb3r6kr mlylyipyv mly117nqv4"
34376
34524
  },
34377
34525
  children: rootQuery.definition.as.ArrowQueryDefinition().source.as.ReferenceQueryArrowSource().name
34378
34526
  })]
@@ -35173,34 +35321,22 @@ function Banners({
35173
35321
  function RenderedResult({
35174
35322
  result
35175
35323
  }) {
35176
- const [html2, setHTML] = React__namespace.useState();
35177
- const [rendering, setRendering] = React__namespace.useState(true);
35178
- React__namespace.useEffect(() => {
35179
- let canceled = false;
35180
- setRendering(true);
35181
- const updateResults = async () => {
35182
- const renderer = new render__namespace.HTMLView(document);
35183
- const html22 = await renderer.render(result, {
35184
- dataStyles: {},
35185
- isDrillingEnabled: true
35186
- });
35187
- if (canceled) {
35188
- return;
35189
- }
35190
- setRendering(false);
35191
- setHTML(html22);
35192
- };
35193
- updateResults();
35194
- return () => {
35195
- canceled = true;
35196
- };
35324
+ const [renderer, setRenderer] = React.useState();
35325
+ React.useEffect(() => {
35326
+ const renderer2 = document.createElement("malloy-render");
35327
+ renderer2.malloyResult = result;
35328
+ setRenderer(renderer2);
35197
35329
  }, [result]);
35198
- if (!rendering) return html2 && /* @__PURE__ */ jsxRuntime.jsx(DOMElement, {
35199
- className: "malloy-render_result-wrapper",
35200
- element: html2
35201
- });
35202
- return /* @__PURE__ */ jsxRuntime.jsx(ScrollableArea, {
35203
- children: /* @__PURE__ */ jsxRuntime.jsx("div", {
35330
+ if (renderer) {
35331
+ return /* @__PURE__ */ jsxRuntime.jsx(DOMElement, {
35332
+ element: renderer,
35333
+ style: {
35334
+ overflow: "hidden",
35335
+ height: "100%"
35336
+ }
35337
+ });
35338
+ } else {
35339
+ return /* @__PURE__ */ jsxRuntime.jsx("div", {
35204
35340
  ...{
35205
35341
  className: "mly78zum5 mlyl56j7k mly6s0dn4"
35206
35342
  },
@@ -35215,8 +35351,8 @@ function RenderedResult({
35215
35351
  children: "Rendering..."
35216
35352
  })]
35217
35353
  })
35218
- })
35219
- });
35354
+ });
35355
+ }
35220
35356
  }
35221
35357
  function LoadingDisplay({
35222
35358
  onCancel,
@@ -35413,7 +35549,7 @@ function ResultPanel({
35413
35549
  children: [/* @__PURE__ */ jsxRuntime.jsx(Content, {
35414
35550
  value: "Results",
35415
35551
  ...{
35416
- className: "mlyc7ga6q mlyh8yej3 mly5yr21d mly9f619 mlyysyzu8"
35552
+ className: "mlyc7ga6q mlyh8yej3 mly5yr21d mly9f619"
35417
35553
  },
35418
35554
  children: submittedQuery && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
35419
35555
  children: [draftQuery && submittedQuery && !queriesAreEqual(draftQuery, submittedQuery.query) && /* @__PURE__ */ jsxRuntime.jsxs("div", {
@@ -35772,6 +35908,7 @@ function FieldTokenWithActions({
35772
35908
  isOrderByAllowed
35773
35909
  } = useOperations(view, field, path);
35774
35910
  const [isFilterPopoverOpen, setIsFilterPopoverOpen] = React.useState();
35911
+ const [isTooltipOpen, setIsTooltipOpen] = React.useState(false);
35775
35912
  const handleAddOperationAction = (operation, filter) => {
35776
35913
  if (field.kind === "dimension" || field.kind === "measure") {
35777
35914
  if (operation === "groupBy" && isGroupByAllowed) {
@@ -35779,15 +35916,9 @@ function FieldTokenWithActions({
35779
35916
  } else if (operation === "aggregate" && isAggregateAllowed) {
35780
35917
  addAggregate(view, field, path);
35781
35918
  } else if (operation === "orderBy" && isOrderByAllowed) {
35782
- const segment = view.getOrAddDefaultSegment();
35783
- segment.addOrderBy(field.name, "asc");
35919
+ addOrderBy(view, field);
35784
35920
  } else if (operation === "filter" && isFilterAllowed && filter) {
35785
- const segment = view.getOrAddDefaultSegment();
35786
- if (field.kind === "dimension") {
35787
- segment.addWhere(field.name, path, filter);
35788
- } else {
35789
- segment.addHaving(field.name, path, filter);
35790
- }
35921
+ addFilter(view, field, path, filter);
35791
35922
  }
35792
35923
  setQuery == null ? void 0 : setQuery(rootQuery == null ? void 0 : rootQuery.build());
35793
35924
  }
@@ -35811,18 +35942,21 @@ function FieldTokenWithActions({
35811
35942
  icon: "insert",
35812
35943
  disabled: !(rootQuery == null ? void 0 : rootQuery.isEmpty()),
35813
35944
  onClick: handleSetView,
35814
- tooltip: "Add view"
35945
+ tooltip: "Add view",
35946
+ onTooltipOpenChange: setIsTooltipOpen
35815
35947
  }), /* @__PURE__ */ jsxRuntime.jsx(ActionButton, {
35816
35948
  icon: "nest",
35817
35949
  onClick: handleAddView,
35818
- tooltip: "Add as new nested query"
35950
+ tooltip: "Add as new nested query",
35951
+ onTooltipOpenChange: setIsTooltipOpen
35819
35952
  })]
35820
35953
  }) : field.kind === "measure" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
35821
35954
  children: [/* @__PURE__ */ jsxRuntime.jsx(ActionButton, {
35822
35955
  icon: "aggregate",
35823
35956
  tooltip: "Add as aggregate",
35824
35957
  disabled: !isAggregateAllowed,
35825
- onClick: () => handleAddOperationAction("aggregate")
35958
+ onClick: () => handleAddOperationAction("aggregate"),
35959
+ onTooltipOpenChange: setIsTooltipOpen
35826
35960
  }), /* @__PURE__ */ jsxRuntime.jsx(FilterPopover, {
35827
35961
  fieldInfo: field,
35828
35962
  path,
@@ -35830,21 +35964,24 @@ function FieldTokenWithActions({
35830
35964
  trigger: /* @__PURE__ */ jsxRuntime.jsx(ActionButton, {
35831
35965
  icon: "filter",
35832
35966
  tooltip: "Add as filter",
35833
- disabled: !isFilterAllowed
35967
+ disabled: !isFilterAllowed,
35968
+ onTooltipOpenChange: setIsTooltipOpen
35834
35969
  }),
35835
35970
  onOpenChange: setIsFilterPopoverOpen
35836
35971
  }), /* @__PURE__ */ jsxRuntime.jsx(ActionButton, {
35837
35972
  icon: "orderBy",
35838
35973
  tooltip: "Add as order by",
35839
35974
  disabled: !isOrderByAllowed,
35840
- onClick: () => handleAddOperationAction("orderBy")
35975
+ onClick: () => handleAddOperationAction("orderBy"),
35976
+ onTooltipOpenChange: setIsTooltipOpen
35841
35977
  })]
35842
35978
  }) : field.kind === "dimension" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
35843
35979
  children: [/* @__PURE__ */ jsxRuntime.jsx(ActionButton, {
35844
35980
  icon: "groupBy",
35845
35981
  tooltip: "Add as group by",
35846
35982
  disabled: !isGroupByAllowed,
35847
- onClick: () => handleAddOperationAction("groupBy")
35983
+ onClick: () => handleAddOperationAction("groupBy"),
35984
+ onTooltipOpenChange: setIsTooltipOpen
35848
35985
  }), /* @__PURE__ */ jsxRuntime.jsx(FilterPopover, {
35849
35986
  fieldInfo: field,
35850
35987
  path,
@@ -35852,17 +35989,20 @@ function FieldTokenWithActions({
35852
35989
  trigger: /* @__PURE__ */ jsxRuntime.jsx(ActionButton, {
35853
35990
  icon: "filter",
35854
35991
  tooltip: "Add as filter",
35855
- disabled: !isFilterAllowed
35992
+ disabled: !isFilterAllowed,
35993
+ onTooltipOpenChange: setIsTooltipOpen
35856
35994
  }),
35857
35995
  onOpenChange: setIsFilterPopoverOpen
35858
35996
  }), /* @__PURE__ */ jsxRuntime.jsx(ActionButton, {
35859
35997
  icon: "orderBy",
35860
35998
  tooltip: "Add as order by",
35861
35999
  disabled: !isOrderByAllowed,
35862
- onClick: () => handleAddOperationAction("orderBy")
36000
+ onClick: () => handleAddOperationAction("orderBy"),
36001
+ onTooltipOpenChange: setIsTooltipOpen
35863
36002
  })]
35864
36003
  }) : null,
35865
- hoverActionsVisible: isFilterPopoverOpen,
36004
+ onClick: field.kind === "dimension" && isGroupByAllowed ? () => handleAddOperationAction("groupBy") : field.kind === "measure" && isAggregateAllowed ? () => handleAddOperationAction("aggregate") : field.kind === "view" ? () => handleAddView() : void 0,
36005
+ hoverActionsVisible: isFilterPopoverOpen || isTooltipOpen,
35866
36006
  tooltip: /* @__PURE__ */ jsxRuntime.jsx(FieldHoverCard, {
35867
36007
  field,
35868
36008
  path
@@ -35874,11 +36014,28 @@ function FieldTokenWithActions({
35874
36014
  }
35875
36015
  });
35876
36016
  }
35877
- function ActionButton(props2) {
35878
- return /* @__PURE__ */ jsxRuntime.jsx(Button, {
35879
- variant: "flat",
35880
- size: "compact",
35881
- ...props2
36017
+ function ActionButton({
36018
+ tooltip,
36019
+ onTooltipOpenChange,
36020
+ ...props2
36021
+ }) {
36022
+ return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, {
36023
+ delayDuration: 300,
36024
+ onOpenChange: onTooltipOpenChange,
36025
+ children: [/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, {
36026
+ asChild: true,
36027
+ children: /* @__PURE__ */ jsxRuntime.jsx(Button, {
36028
+ variant: "flat",
36029
+ size: "compact",
36030
+ ...props2
36031
+ })
36032
+ }), /* @__PURE__ */ jsxRuntime.jsx(TooltipPortal, {
36033
+ children: /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, {
36034
+ sideOffset: 8,
36035
+ ..._stylex.props(fontStyles.body, tooltipStyles.default),
36036
+ children: tooltip
36037
+ })
36038
+ })]
35882
36039
  });
35883
36040
  }
35884
36041
  const FIELD_KIND_ORDER = ["dimension", "measure", "view"];