@nongt/visql 0.0.0-stage → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +916 -2
  3. package/dist/PipelineEditor-DNZkDSaY.js +10042 -0
  4. package/dist/calendarDate-CYlr9TvX.js +43 -0
  5. package/dist/core-api-BDCnbFHY.js +1056 -0
  6. package/dist/core.js +80 -0
  7. package/dist/fixtures.js +7 -0
  8. package/dist/index.js +145 -0
  9. package/dist/issueLocation-Cw5sttQL.js +3183 -0
  10. package/dist/mui-date-pickers.js +117 -0
  11. package/dist/mui.js +510 -0
  12. package/dist/schema-z95dxLxu.js +839 -0
  13. package/dist/sql-import.js +1366 -0
  14. package/dist/style.css +1 -0
  15. package/dist/tokens-BTaVMSOx.js +95 -0
  16. package/dist/types/adapters/mui/MuiDatePicker.d.ts +12 -0
  17. package/dist/types/adapters/mui/MuiDateTimePicker.d.ts +10 -0
  18. package/dist/types/adapters/mui/MuiListInput.d.ts +9 -0
  19. package/dist/types/adapters/mui/MuiTimePicker.d.ts +10 -0
  20. package/dist/types/adapters/mui/QueryBuilder.d.ts +12 -0
  21. package/dist/types/adapters/mui/components.d.ts +16 -0
  22. package/dist/types/adapters/mui/index.d.ts +6 -0
  23. package/dist/types/adapters/mui/muiPickers.d.ts +6 -0
  24. package/dist/types/adapters/mui/pickerStyles.d.ts +28 -0
  25. package/dist/types/adapters/mui/theme.d.ts +11 -0
  26. package/dist/types/core/BetweenOnTextContext.d.ts +11 -0
  27. package/dist/types/core/DialectContext.d.ts +10 -0
  28. package/dist/types/core/DrillDownContext.d.ts +22 -0
  29. package/dist/types/core/ExistsContext.d.ts +29 -0
  30. package/dist/types/core/FlowDirectionContext.d.ts +8 -0
  31. package/dist/types/core/FlowOrientationContext.d.ts +6 -0
  32. package/dist/types/core/FunctionsContext.d.ts +25 -0
  33. package/dist/types/core/GroupKeysContext.d.ts +18 -0
  34. package/dist/types/core/MeasureLockContext.d.ts +12 -0
  35. package/dist/types/core/ReadOnlyContext.d.ts +6 -0
  36. package/dist/types/core/SchemaContext.d.ts +8 -0
  37. package/dist/types/core/SubqueryContext.d.ts +16 -0
  38. package/dist/types/core/UnionBranchContext.d.ts +6 -0
  39. package/dist/types/core/ValueInputContext.d.ts +24 -0
  40. package/dist/types/core/absolutePath.d.ts +57 -0
  41. package/dist/types/core/ast.d.ts +154 -0
  42. package/dist/types/core/astChildren.d.ts +4 -0
  43. package/dist/types/core/astEqual.d.ts +4 -0
  44. package/dist/types/core/astMap.d.ts +21 -0
  45. package/dist/types/core/calendarDate.d.ts +21 -0
  46. package/dist/types/core/columnFormats.d.ts +23 -0
  47. package/dist/types/core/components/BoolPicker.d.ts +8 -0
  48. package/dist/types/core/components/NumberInput.d.ts +8 -0
  49. package/dist/types/core/components/ReadOnlyPart.d.ts +10 -0
  50. package/dist/types/core/components/TextInput.d.ts +8 -0
  51. package/dist/types/core/components/expression/BinaryView.d.ts +10 -0
  52. package/dist/types/core/components/expression/ExprSummary.d.ts +12 -0
  53. package/dist/types/core/components/expression/ExpressionTypeSelector.d.ts +35 -0
  54. package/dist/types/core/components/expression/ExpressionView.d.ts +30 -0
  55. package/dist/types/core/components/expression/FieldView.d.ts +15 -0
  56. package/dist/types/core/components/expression/FormulaPeek.d.ts +14 -0
  57. package/dist/types/core/components/expression/FunctionArgInput.d.ts +22 -0
  58. package/dist/types/core/components/expression/FunctionView.d.ts +7 -0
  59. package/dist/types/core/components/expression/ListView.d.ts +20 -0
  60. package/dist/types/core/components/expression/LiteralView.d.ts +23 -0
  61. package/dist/types/core/components/expression/LogicalView.d.ts +9 -0
  62. package/dist/types/core/components/expression/MeasureMenu.d.ts +21 -0
  63. package/dist/types/core/components/expression/ParamView.d.ts +13 -0
  64. package/dist/types/core/components/expression/RelativeDateView.d.ts +15 -0
  65. package/dist/types/core/components/expression/SubqueryView.d.ts +8 -0
  66. package/dist/types/core/components/expression/formulaClasses.d.ts +8 -0
  67. package/dist/types/core/components/flow/CaseBranchFlowNode.d.ts +5 -0
  68. package/dist/types/core/components/flow/CaseElseFlowNode.d.ts +5 -0
  69. package/dist/types/core/components/flow/CaseFlowNode.d.ts +5 -0
  70. package/dist/types/core/components/flow/ConditionFlowNode.d.ts +5 -0
  71. package/dist/types/core/components/flow/CreateConditionFlowNode.d.ts +14 -0
  72. package/dist/types/core/components/flow/CreateHavingFlowNode.d.ts +11 -0
  73. package/dist/types/core/components/flow/DistinctToggle.d.ts +10 -0
  74. package/dist/types/core/components/flow/ExistsFlowNode.d.ts +9 -0
  75. package/dist/types/core/components/flow/FromFlowNode.d.ts +110 -0
  76. package/dist/types/core/components/flow/FunctionArgFlowNode.d.ts +5 -0
  77. package/dist/types/core/components/flow/FunctionCallFlowNode.d.ts +5 -0
  78. package/dist/types/core/components/flow/FunctionSortKeys.d.ts +10 -0
  79. package/dist/types/core/components/flow/GroupBgNode.d.ts +14 -0
  80. package/dist/types/core/components/flow/GroupByFlowNode.d.ts +29 -0
  81. package/dist/types/core/components/flow/IfElseFlowNode.d.ts +5 -0
  82. package/dist/types/core/components/flow/IfFlowNode.d.ts +5 -0
  83. package/dist/types/core/components/flow/IfThenFlowNode.d.ts +5 -0
  84. package/dist/types/core/components/flow/LeafConditionFrame.d.ts +19 -0
  85. package/dist/types/core/components/flow/LogicalFlowNode.d.ts +5 -0
  86. package/dist/types/core/components/flow/MoveTooltip.d.ts +19 -0
  87. package/dist/types/core/components/flow/NotFlowNode.d.ts +5 -0
  88. package/dist/types/core/components/flow/OrderByFlowNode.d.ts +32 -0
  89. package/dist/types/core/components/flow/SectionLabelFlowNode.d.ts +7 -0
  90. package/dist/types/core/components/flow/SelectFlowNode.d.ts +49 -0
  91. package/dist/types/core/components/flow/SharedQueriesFlowNode.d.ts +39 -0
  92. package/dist/types/core/components/flow/SummaryPill.d.ts +12 -0
  93. package/dist/types/core/components/flow/WarningNote.d.ts +9 -0
  94. package/dist/types/core/components/flow/chainSides.d.ts +18 -0
  95. package/dist/types/core/components/flow/dragContext.d.ts +12 -0
  96. package/dist/types/core/components/flow/moveTooltipHysteresis.d.ts +18 -0
  97. package/dist/types/core/components/flow/useRowDrag.d.ts +34 -0
  98. package/dist/types/core/components/flow/useRowReorderFlip.d.ts +30 -0
  99. package/dist/types/core/derivedTables.d.ts +98 -0
  100. package/dist/types/core/distinctSort.d.ts +7 -0
  101. package/dist/types/core/drillPath.d.ts +11 -0
  102. package/dist/types/core/exists.d.ts +7 -0
  103. package/dist/types/core/existsMenu.d.ts +61 -0
  104. package/dist/types/core/expressionFlow.d.ts +428 -0
  105. package/dist/types/core/fanOut.d.ts +58 -0
  106. package/dist/types/core/findParts.d.ts +19 -0
  107. package/dist/types/core/flowTrees.d.ts +20 -0
  108. package/dist/types/core/focusKey.d.ts +10 -0
  109. package/dist/types/core/formula.d.ts +24 -0
  110. package/dist/types/core/formulaPeek.d.ts +16 -0
  111. package/dist/types/core/functionRegistry.d.ts +117 -0
  112. package/dist/types/core/grouping.d.ts +58 -0
  113. package/dist/types/core/history.d.ts +25 -0
  114. package/dist/types/core/i18n/defaultMessages.d.ts +367 -0
  115. package/dist/types/core/i18n/messages.d.ts +273 -0
  116. package/dist/types/core/i18n/relativeDateWords.d.ts +3 -0
  117. package/dist/types/core/id.d.ts +5 -0
  118. package/dist/types/core/issueAnchor.d.ts +29 -0
  119. package/dist/types/core/issueLocation.d.ts +105 -0
  120. package/dist/types/core/limits.d.ts +17 -0
  121. package/dist/types/core/measures.d.ts +51 -0
  122. package/dist/types/core/params.d.ts +30 -0
  123. package/dist/types/core/pipelineAnchor.d.ts +118 -0
  124. package/dist/types/core/pipelineFlow.d.ts +271 -0
  125. package/dist/types/core/queryAst.d.ts +201 -0
  126. package/dist/types/core/queryHelpers.d.ts +113 -0
  127. package/dist/types/core/queryValidation.d.ts +206 -0
  128. package/dist/types/core/relativeDates.d.ts +11 -0
  129. package/dist/types/core/resolveNames.d.ts +17 -0
  130. package/dist/types/core/rowRange.d.ts +3 -0
  131. package/dist/types/core/schema.d.ts +119 -0
  132. package/dist/types/core/scopeQuery.d.ts +45 -0
  133. package/dist/types/core/selectColumns.d.ts +23 -0
  134. package/dist/types/core/settleQuery.d.ts +11 -0
  135. package/dist/types/core/sharedQueries.d.ts +66 -0
  136. package/dist/types/core/sqlGen.d.ts +102 -0
  137. package/dist/types/core/sqlOffsets.d.ts +5 -0
  138. package/dist/types/core/sqlSpans.d.ts +33 -0
  139. package/dist/types/core/storedQuery.d.ts +43 -0
  140. package/dist/types/core/summarize.d.ts +3 -0
  141. package/dist/types/core/theme/tokens.d.ts +74 -0
  142. package/dist/types/core/ui/UIContext.d.ts +6 -0
  143. package/dist/types/core/ui/index.d.ts +12 -0
  144. package/dist/types/core/ui/types.d.ts +264 -0
  145. package/dist/types/core/unionTables.d.ts +121 -0
  146. package/dist/types/core/useValueTypes.d.ts +12 -0
  147. package/dist/types/core/valueTypes.d.ts +54 -0
  148. package/dist/types/core-api.d.ts +20 -0
  149. package/dist/types/features/queryEditor/ExpressionFlowCanvas.d.ts +10 -0
  150. package/dist/types/features/queryEditor/FindBox.d.ts +12 -0
  151. package/dist/types/features/queryEditor/FlowCanvas.d.ts +96 -0
  152. package/dist/types/features/queryEditor/FocusPulse.d.ts +10 -0
  153. package/dist/types/features/queryEditor/IssuesButton.d.ts +16 -0
  154. package/dist/types/features/queryEditor/PipelineEditor.d.ts +210 -0
  155. package/dist/types/features/queryEditor/QueryOutline.d.ts +16 -0
  156. package/dist/types/features/queryEditor/ResultsPanel.d.ts +11 -0
  157. package/dist/types/features/queryEditor/RunButton.d.ts +11 -0
  158. package/dist/types/features/queryEditor/SubFlowPanel.d.ts +24 -0
  159. package/dist/types/features/queryEditor/UndoRedoToast.d.ts +6 -0
  160. package/dist/types/features/queryEditor/canvasPositioning.d.ts +81 -0
  161. package/dist/types/features/queryEditor/findKeys.d.ts +3 -0
  162. package/dist/types/features/queryEditor/flowDragUtils.d.ts +16 -0
  163. package/dist/types/features/queryEditor/focusContext.d.ts +24 -0
  164. package/dist/types/features/queryEditor/hoveredPart.d.ts +32 -0
  165. package/dist/types/features/queryEditor/issueFocusParts.d.ts +9 -0
  166. package/dist/types/features/queryEditor/issueLocationText.d.ts +7 -0
  167. package/dist/types/features/queryEditor/issueText.d.ts +11 -0
  168. package/dist/types/features/queryEditor/outlineSections.d.ts +23 -0
  169. package/dist/types/features/queryEditor/run.d.ts +36 -0
  170. package/dist/types/features/queryEditor/sectionLabels.d.ts +15 -0
  171. package/dist/types/features/queryEditor/treeScopeContext.d.ts +14 -0
  172. package/dist/types/features/queryEditor/useRemeasureOnDirectionChange.d.ts +7 -0
  173. package/dist/types/features/queryEditor/useRevealNewNodes.d.ts +35 -0
  174. package/dist/types/features/queryEditor/withTreeScope.d.ts +10 -0
  175. package/dist/types/fixtures.d.ts +44 -0
  176. package/dist/types/index.d.ts +13 -0
  177. package/dist/types/mui-date-pickers.d.ts +3 -0
  178. package/dist/types/mui.d.ts +2 -0
  179. package/dist/types/sql-import.d.ts +3 -0
  180. package/dist/types/sqlImport/context.d.ts +71 -0
  181. package/dist/types/sqlImport/expressions.d.ts +11 -0
  182. package/dist/types/sqlImport/importSql.d.ts +28 -0
  183. package/dist/types/sqlImport/parse.d.ts +6 -0
  184. package/dist/types/sqlImport/syntax.d.ts +245 -0
  185. package/dist/types/sqlImport/tokenize.d.ts +26 -0
  186. package/package.json +164 -3
@@ -0,0 +1,117 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { useContext as x, useCallback as a, useMemo as s } from "react";
3
+ import { DatePicker as h } from "@mui/x-date-pickers/DatePicker";
4
+ import { c as g } from "./calendarDate-CYlr9TvX.js";
5
+ import { AdapterDateFns as F } from "@mui/x-date-pickers/AdapterDateFns";
6
+ import { MuiPickersAdapterContext as U, LocalizationProvider as w } from "@mui/x-date-pickers/LocalizationProvider";
7
+ import { t as p } from "./tokens-BTaVMSOx.js";
8
+ import { DateTimePicker as S } from "@mui/x-date-pickers/DateTimePicker";
9
+ import { TimePicker as b } from "@mui/x-date-pickers/TimePicker";
10
+ function f({ children: o }) {
11
+ return x(U) ? o : /* @__PURE__ */ n(w, { dateAdapter: F, children: o });
12
+ }
13
+ const D = ".MuiPickersOutlinedInput-notchedOutline";
14
+ function P(o, i = !1) {
15
+ return {
16
+ width: "fit-content",
17
+ ...i ? { "& .MuiPickersSectionList-root": { width: "auto" } } : {},
18
+ "& .MuiPickersOutlinedInput-root": {
19
+ ...o ? { height: 38, borderTopLeftRadius: 0, borderBottomLeftRadius: 0 } : {},
20
+ [`& ${D}`]: { borderColor: p("fieldBorder") },
21
+ [`&:hover:not(.Mui-focused):not(.Mui-disabled) ${D}`]: {
22
+ borderColor: p("fieldBorderHover")
23
+ }
24
+ },
25
+ // The calendar/clock button: the size of the other fields' arrows.
26
+ "& .MuiInputAdornment-root .MuiIconButton-root": { padding: "4px" },
27
+ "& .MuiInputAdornment-root .MuiSvgIcon-root": { fontSize: 20 }
28
+ };
29
+ }
30
+ const O = ({
31
+ className: o,
32
+ grouped: i,
33
+ value: t,
34
+ onChange: r,
35
+ disabled: l
36
+ }) => {
37
+ const c = a((d) => {
38
+ r == null || r(d ? g(d.getFullYear(), d.getMonth() + 1, d.getDate()) : void 0);
39
+ }, [r]), m = s(() => t ? new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()) : null, [t]), u = s(() => ({
40
+ className: o,
41
+ sx: P(i, !0),
42
+ size: "small"
43
+ }), [o, i]), e = s(() => ({
44
+ textField: u
45
+ }), [u]);
46
+ return /* @__PURE__ */ n(f, { children: /* @__PURE__ */ n(
47
+ h,
48
+ {
49
+ disabled: l,
50
+ value: m,
51
+ slotProps: e,
52
+ onChange: c
53
+ }
54
+ ) });
55
+ }, Y = ({
56
+ className: o,
57
+ grouped: i,
58
+ value: t,
59
+ onChange: r,
60
+ disabled: l
61
+ }) => {
62
+ const c = a((e) => {
63
+ r == null || r(e ? new Date(Date.UTC(
64
+ e.getFullYear(),
65
+ e.getMonth(),
66
+ e.getDate(),
67
+ e.getHours(),
68
+ e.getMinutes()
69
+ )) : void 0);
70
+ }, [r]), m = s(() => t ? new Date(
71
+ t.getUTCFullYear(),
72
+ t.getUTCMonth(),
73
+ t.getUTCDate(),
74
+ t.getUTCHours(),
75
+ t.getUTCMinutes()
76
+ ) : null, [t]), u = s(() => ({
77
+ textField: { className: o, sx: P(i), size: "small" }
78
+ }), [o, i]);
79
+ return /* @__PURE__ */ n(f, { children: /* @__PURE__ */ n(
80
+ S,
81
+ {
82
+ disabled: l,
83
+ value: m,
84
+ slotProps: u,
85
+ onChange: c
86
+ }
87
+ ) });
88
+ }, M = (o) => String(o).padStart(2, "0"), R = ({
89
+ className: o,
90
+ grouped: i,
91
+ value: t,
92
+ onChange: r,
93
+ disabled: l
94
+ }) => {
95
+ const c = a((e) => {
96
+ r == null || r(e ? `${M(e.getHours())}:${M(e.getMinutes())}:${M(e.getSeconds())}` : void 0);
97
+ }, [r]), m = s(() => {
98
+ const [e, d, T] = (t ?? "").split(":").map(Number);
99
+ return t ? new Date(2e3, 0, 1, e, d, T || 0) : null;
100
+ }, [t]), u = s(() => ({
101
+ textField: { className: o, sx: P(i, !0), size: "small" }
102
+ }), [o, i]);
103
+ return /* @__PURE__ */ n(f, { children: /* @__PURE__ */ n(
104
+ b,
105
+ {
106
+ disabled: l,
107
+ value: m,
108
+ slotProps: u,
109
+ onChange: c
110
+ }
111
+ ) });
112
+ };
113
+ export {
114
+ O as MuiDatePicker,
115
+ Y as MuiDateTimePicker,
116
+ R as MuiTimePicker
117
+ };
package/dist/mui.js ADDED
@@ -0,0 +1,510 @@
1
+ import { jsx as n, jsxs as P } from "react/jsx-runtime";
2
+ import { useMemo as H, useState as w, useRef as A, useLayoutEffect as G } from "react";
3
+ import { P as K } from "./PipelineEditor-DNZkDSaY.js";
4
+ import Q from "@emotion/cache";
5
+ import { CacheProvider as U } from "@emotion/react";
6
+ import { TextField as R, Menu as J, ListSubheader as _, MenuItem as $, Box as y, createFilterOptions as X, Autocomplete as D, Select as Y, InputBase as Z, Button as ee, IconButton as te, Tooltip as oe, Chip as re } from "@mui/material";
7
+ import { createTheme as ne, alpha as E, ThemeProvider as ie } from "@mui/material/styles";
8
+ import le from "clsx";
9
+ import { Plus as ue } from "iconoir-react";
10
+ import { t as L } from "./tokens-BTaVMSOx.js";
11
+ import { i as se, f as ce } from "./calendarDate-CYlr9TvX.js";
12
+ function ae(e, t) {
13
+ return ne({
14
+ palette: {
15
+ primary: { main: e.accent },
16
+ secondary: { main: e.secondary },
17
+ error: { main: e.danger },
18
+ warning: { main: e.warning }
19
+ },
20
+ typography: {
21
+ // The editor's `fontFamily` when set — this also reaches popovers and
22
+ // menus, which render outside the editor root — else the host page's.
23
+ fontFamily: t ?? "inherit",
24
+ allVariants: {
25
+ fontSize: 14
26
+ }
27
+ },
28
+ components: {
29
+ MuiTooltip: {
30
+ defaultProps: {
31
+ arrow: !0
32
+ }
33
+ },
34
+ MuiAutocomplete: {
35
+ defaultProps: {
36
+ size: "small"
37
+ }
38
+ },
39
+ MuiTextField: {
40
+ defaultProps: {
41
+ size: "small"
42
+ }
43
+ },
44
+ // Input outlines in the editor's field colors, the same as the type
45
+ // badges and chips beside them (MUI's own is a darker translucent
46
+ // black). Focus keeps MUI's accent outline.
47
+ MuiOutlinedInput: {
48
+ styleOverrides: {
49
+ root: {
50
+ "& .MuiOutlinedInput-notchedOutline": { borderColor: e.fieldBorder },
51
+ "&:hover:not(.Mui-focused):not(.Mui-disabled) .MuiOutlinedInput-notchedOutline": {
52
+ borderColor: e.fieldBorderHover
53
+ }
54
+ }
55
+ }
56
+ },
57
+ MuiIconButton: {
58
+ styleOverrides: {
59
+ root: {
60
+ // Preserve the button's own color at 25% when disabled,
61
+ // instead of MUI's default flat gray.
62
+ "&.MuiIconButton-colorSecondary.Mui-disabled": {
63
+ color: E(e.secondary, 0.25)
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
69
+ });
70
+ }
71
+ const j = {
72
+ "& .MuiOutlinedInput-root": {
73
+ borderTopLeftRadius: 0,
74
+ borderBottomLeftRadius: 0,
75
+ height: 38
76
+ }
77
+ };
78
+ let W;
79
+ function de() {
80
+ if (!W) {
81
+ const e = Q({ key: "qb" }), t = e.insert.bind(e);
82
+ e.insert = (r, u, s, c) => t(
83
+ r,
84
+ u.styles.startsWith("@layer") ? u : { ...u, styles: `@layer qb-mui {${u.styles}}` },
85
+ s,
86
+ c
87
+ ), W = e;
88
+ }
89
+ return W;
90
+ }
91
+ const pe = ({ tokens: e, fontFamily: t, children: r }) => {
92
+ const u = H(() => ae(e, t), [e, t]);
93
+ return /* @__PURE__ */ n(U, { value: de(), children: /* @__PURE__ */ n(ie, { theme: u, children: r }) });
94
+ }, me = ({ children: e, ...t }) => /* @__PURE__ */ n(oe, { disableInteractive: !0, ...t, children: e }), fe = ({ children: e, ...t }) => /* @__PURE__ */ n(te, { ...t, children: e }), he = ({ children: e, ...t }) => /* @__PURE__ */ n(ee, { ...t, children: e }), xe = ({
95
+ value: e,
96
+ onChange: t,
97
+ onBlur: r,
98
+ type: u,
99
+ placeholder: s,
100
+ className: c,
101
+ inputClassName: l,
102
+ grouped: m,
103
+ disabled: d,
104
+ readOnly: b,
105
+ inline: I,
106
+ maxLength: f
107
+ }) => I ? (
108
+ // No box: the editor's classes are all there is to it.
109
+ /* @__PURE__ */ n(
110
+ Z,
111
+ {
112
+ disabled: d,
113
+ className: c,
114
+ value: e,
115
+ onChange: t && ((h) => t(h.currentTarget.value)),
116
+ onBlur: r,
117
+ placeholder: s,
118
+ sx: { font: "inherit", color: "inherit" },
119
+ slotProps: { input: { className: l, readOnly: b, maxLength: f } }
120
+ }
121
+ )
122
+ ) : /* @__PURE__ */ n(
123
+ R,
124
+ {
125
+ disabled: d,
126
+ className: c,
127
+ sx: m ? j : void 0,
128
+ value: e,
129
+ onChange: t && ((h) => t(h.currentTarget.value)),
130
+ onBlur: r,
131
+ type: u,
132
+ placeholder: s,
133
+ slotProps: {
134
+ htmlInput: {
135
+ className: l,
136
+ readOnly: b,
137
+ maxLength: f,
138
+ ...u === "number" ? { inputMode: "numeric" } : {}
139
+ }
140
+ }
141
+ }
142
+ ), be = ({
143
+ value: e,
144
+ options: t,
145
+ onChange: r,
146
+ density: u = "normal",
147
+ className: s,
148
+ grouped: c,
149
+ disabled: l
150
+ }) => {
151
+ const m = u === "compact";
152
+ return /* @__PURE__ */ n(
153
+ Y,
154
+ {
155
+ className: s,
156
+ disabled: l,
157
+ value: e,
158
+ size: m ? "small" : void 0,
159
+ onChange: (d) => r(d.target.value),
160
+ sx: {
161
+ ...c ? { borderTopLeftRadius: 0, borderBottomLeftRadius: 0, height: 38 } : {},
162
+ ...m ? { fontSize: "0.75rem", height: 26, ".MuiSelect-select": { py: 0.25 } } : {}
163
+ },
164
+ children: t.map((d) => /* @__PURE__ */ n(
165
+ $,
166
+ {
167
+ value: d.value,
168
+ dense: m,
169
+ sx: m ? { fontSize: "0.75rem" } : void 0,
170
+ children: d.label
171
+ },
172
+ d.value
173
+ ))
174
+ }
175
+ );
176
+ }, Ie = ({
177
+ value: e,
178
+ onChange: t,
179
+ className: r,
180
+ grouped: u,
181
+ disabled: s
182
+ }) => /* @__PURE__ */ n(
183
+ R,
184
+ {
185
+ type: "date",
186
+ disabled: s,
187
+ className: r,
188
+ sx: u ? j : void 0,
189
+ value: e ? se(e) : "",
190
+ onChange: (c) => t == null ? void 0 : t(ce(c.currentTarget.value))
191
+ }
192
+ ), Me = { input: "input", clear: "clear" }, ge = {
193
+ paper: { className: "w-fit" },
194
+ popper: { sx: { minWidth: "max-content" } }
195
+ }, q = {
196
+ fontWeight: 700,
197
+ lineHeight: "32px",
198
+ borderTop: 1,
199
+ borderBottom: 1,
200
+ borderColor: ({ palette: e }) => E(e.text.primary, 0.07),
201
+ boxShadow: "0 3px 4px -3px rgba(0, 0, 0, 0.18)",
202
+ bgcolor: "background.paper",
203
+ backgroundImage: ({ palette: e }) => {
204
+ const t = E(e.text.primary, 0.04);
205
+ return `linear-gradient(${t}, ${t})`;
206
+ }
207
+ }, ye = { ...q, top: -8, whiteSpace: "nowrap" }, Se = {
208
+ borderTop: 1,
209
+ borderColor: "divider",
210
+ color: "primary.main",
211
+ fontWeight: 600,
212
+ gap: 1,
213
+ whiteSpace: "nowrap"
214
+ };
215
+ function ve({
216
+ options: e,
217
+ value: t,
218
+ onChange: r,
219
+ inputValue: u,
220
+ onInputChange: s,
221
+ getOptionLabel: c,
222
+ getOptionKey: l,
223
+ searchText: m,
224
+ groupBy: d,
225
+ groupTone: b,
226
+ freeSolo: I,
227
+ isAction: f,
228
+ label: h,
229
+ placeholder: S,
230
+ noOptionsText: v,
231
+ maxLength: g,
232
+ className: k,
233
+ inputClassName: O,
234
+ grouped: B,
235
+ appearance: C = "light",
236
+ disabled: i,
237
+ autoFocus: a
238
+ }) {
239
+ const p = (o) => typeof o == "string" || !c ? String(o) : c(o), F = (o) => typeof o == "string" || !l ? p(o) : l(o), N = C === "dark", V = X(m ? { stringify: m } : {});
240
+ return /* @__PURE__ */ n(
241
+ D,
242
+ {
243
+ filterOptions: (o, x) => {
244
+ const M = o.some((T) => p(T).toLowerCase() === x.inputValue.toLowerCase()) ? o : V(o, x);
245
+ return f ? o.filter((T) => f(T) || M.includes(T)) : M;
246
+ },
247
+ className: k,
248
+ disabled: i,
249
+ openOnFocus: a,
250
+ freeSolo: I,
251
+ ...v === void 0 ? {} : { noOptionsText: v },
252
+ forcePopupIcon: I && e.length > 0 ? !0 : "auto",
253
+ options: e,
254
+ value: t,
255
+ onChange: r && ((o, x) => r(x)),
256
+ inputValue: u,
257
+ onInputChange: s && ((o, x, M) => s(x, Me[M] ?? "reset")),
258
+ getOptionLabel: p,
259
+ getOptionKey: F,
260
+ groupBy: d,
261
+ renderGroup: (o) => /* @__PURE__ */ P("li", { children: [
262
+ o.group !== "" && /* @__PURE__ */ n(
263
+ _,
264
+ {
265
+ component: "div",
266
+ sx: {
267
+ ...ye,
268
+ ...(b == null ? void 0 : b(o.group)) === "accent" ? { color: "primary.main" } : {}
269
+ },
270
+ children: o.group
271
+ }
272
+ ),
273
+ /* @__PURE__ */ n(y, { component: "ul", sx: { p: 0 }, children: o.children })
274
+ ] }, o.key),
275
+ renderOption: ({ key: o, ...x }, M) => f != null && f(M) ? /* @__PURE__ */ P(y, { component: "li", ...x, sx: Se, children: [
276
+ /* @__PURE__ */ n(ue, { width: 14, height: 14, strokeWidth: 2.2 }),
277
+ p(M)
278
+ ] }, o) : /* @__PURE__ */ n("li", { ...x, className: le(x.className, "text-nowrap"), children: p(M) }, o),
279
+ slotProps: ge,
280
+ sx: {
281
+ ...B ? {
282
+ "& .MuiOutlinedInput-root": { borderTopLeftRadius: 0, borderBottomLeftRadius: 0 }
283
+ } : {},
284
+ ...N ? {
285
+ "& .MuiAutocomplete-popupIndicator": { color: L("nodeInputIcon") },
286
+ "& .MuiAutocomplete-clearIndicator": { color: L("nodeInputIcon") }
287
+ } : {}
288
+ },
289
+ renderInput: (o) => /* @__PURE__ */ n(
290
+ R,
291
+ {
292
+ ...o,
293
+ label: h,
294
+ placeholder: S,
295
+ autoFocus: a,
296
+ slotProps: {
297
+ input: o.InputProps,
298
+ // A given inputClassName replaces MUI's own input class (callers
299
+ // that size the input themselves also set its padding); without
300
+ // one, MUI's styling stays as is.
301
+ htmlInput: {
302
+ ...o.inputProps,
303
+ ...O ? { className: O } : {},
304
+ maxLength: g
305
+ }
306
+ },
307
+ sx: {
308
+ // A floating label only explains an empty field — once focused,
309
+ // tuck it up into the outline instead of hovering over the text.
310
+ ...h ? {
311
+ "& .MuiInputLabel-root.Mui-focused": {
312
+ transform: "translate(15px, -6px) scale(0.75)"
313
+ }
314
+ } : {},
315
+ ...N ? {
316
+ "& .MuiInputBase-root": {
317
+ bgcolor: "transparent",
318
+ color: L("nodeInputText")
319
+ },
320
+ "& .MuiOutlinedInput-notchedOutline": { borderColor: L("nodeInputBorder") }
321
+ } : {}
322
+ }
323
+ }
324
+ )
325
+ }
326
+ );
327
+ }
328
+ const Oe = { danger: "error.main", warning: "warning.main" }, Pe = { ...q, top: 0 }, Be = ({
329
+ anchorEl: e,
330
+ open: t,
331
+ onClose: r,
332
+ sections: u
333
+ }) => /* @__PURE__ */ n(J, { anchorEl: e, open: t, onClose: r, children: u.flatMap((s, c) => [
334
+ ...s.title ? [/* @__PURE__ */ n(_, { sx: Pe, children: s.title }, `section-${c}`)] : [],
335
+ ...s.items.map((l) => /* @__PURE__ */ P(
336
+ $,
337
+ {
338
+ dense: !0,
339
+ selected: l.selected,
340
+ disabled: l.disabled,
341
+ onClick: l.onClick,
342
+ sx: { pl: 2, gap: 1, alignItems: "flex-start" },
343
+ children: [
344
+ l.icon && /* @__PURE__ */ n(
345
+ y,
346
+ {
347
+ component: "span",
348
+ sx: {
349
+ display: "flex",
350
+ pt: "2px",
351
+ color: l.tone && Oe[l.tone]
352
+ },
353
+ children: l.icon
354
+ }
355
+ ),
356
+ /* @__PURE__ */ P(y, { component: "span", sx: { display: "flex", flexDirection: "column" }, children: [
357
+ l.label,
358
+ l.detail && /* @__PURE__ */ n(y, { component: "span", sx: { fontSize: "0.7rem", color: "text.secondary" }, children: l.detail })
359
+ ] })
360
+ ]
361
+ },
362
+ l.key
363
+ ))
364
+ ]) }), z = 38;
365
+ function Te({
366
+ items: e,
367
+ options: t,
368
+ onChange: r,
369
+ canAdd: u,
370
+ placeholder: s,
371
+ maxLength: c,
372
+ className: l,
373
+ grouped: m,
374
+ disabled: d
375
+ }) {
376
+ const [b, I] = w(""), [f, h] = w(!1), [S, v] = w(!1), [g, k] = w(0), O = A(null);
377
+ G(() => {
378
+ var p;
379
+ const i = [...O.current.querySelectorAll(".MuiAutocomplete-tag")], a = ((p = i[0]) == null ? void 0 : p.offsetTop) ?? 0;
380
+ k(S ? 0 : i.filter((F) => F.offsetTop > a + 4).length);
381
+ }, [e, S, g]);
382
+ const B = (i) => u && !u(i) ? !1 : (I(""), r == null || r([...e, i]), !0);
383
+ return /* @__PURE__ */ P(
384
+ y,
385
+ {
386
+ ref: O,
387
+ className: l,
388
+ sx: { position: "relative", display: "inline-flex" },
389
+ onFocus: () => v(!0),
390
+ onBlur: (i) => {
391
+ if (i.currentTarget.contains(i.relatedTarget)) return;
392
+ v(!1);
393
+ const a = b.trim();
394
+ a !== "" && !B(a) && I(""), h(!1);
395
+ },
396
+ children: [
397
+ /* @__PURE__ */ n(
398
+ D,
399
+ {
400
+ multiple: !0,
401
+ freeSolo: !t,
402
+ disableClearable: !0,
403
+ disabled: d,
404
+ size: "small",
405
+ options: t ?? [],
406
+ value: e,
407
+ inputValue: b,
408
+ onInputChange: (i, a, p) => {
409
+ p === "input" && (h(!1), I(a));
410
+ },
411
+ onChange: (i, a, p) => {
412
+ if (p === "createOption") {
413
+ h(!B(String(a[a.length - 1]).trim()));
414
+ return;
415
+ }
416
+ I(""), r == null || r(a);
417
+ },
418
+ getOptionLabel: (i) => i.label,
419
+ getOptionKey: (i) => i.key,
420
+ isOptionEqualToValue: (i, a) => i.key === a.key,
421
+ filterSelectedOptions: !0,
422
+ slotProps: {
423
+ paper: { className: "w-fit" },
424
+ popper: { sx: { minWidth: "max-content" } },
425
+ chip: { size: "small" }
426
+ },
427
+ sx: {
428
+ minWidth: 160,
429
+ maxWidth: 360,
430
+ // (As specific as MUI's own small-field padding, to replace it.)
431
+ "& .MuiOutlinedInput-root.MuiInputBase-sizeSmall": {
432
+ minHeight: z,
433
+ // A row of chips (24px, 2px margins) fills the 38px exactly.
434
+ py: "5px",
435
+ ...m ? { borderTopLeftRadius: 0, borderBottomLeftRadius: 0 } : {},
436
+ // Collapsed: one row, room on the right for the `+N`. Clipped,
437
+ // not hidden: an overflow-hidden box can still be scrolled, and
438
+ // focusing the input (rows down) scrolls it — left that way once
439
+ // collapsed again.
440
+ ...S ? {} : {
441
+ maxHeight: z,
442
+ overflow: "clip",
443
+ ...g > 0 ? {
444
+ pr: "44px",
445
+ // The chips past the first row (its first children): the
446
+ // top of the next row would show in the padding below.
447
+ [`& > .MuiAutocomplete-tag:nth-child(n+${e.length - g + 1})`]: {
448
+ visibility: "hidden"
449
+ }
450
+ } : {}
451
+ }
452
+ }
453
+ },
454
+ renderInput: (i) => /* @__PURE__ */ n(
455
+ R,
456
+ {
457
+ ...i,
458
+ error: f,
459
+ placeholder: e.length ? void 0 : s,
460
+ slotProps: {
461
+ input: i.InputProps,
462
+ htmlInput: { ...i.inputProps, maxLength: c }
463
+ }
464
+ }
465
+ )
466
+ }
467
+ ),
468
+ g > 0 && /* @__PURE__ */ n(
469
+ re,
470
+ {
471
+ "data-testid": "list-more",
472
+ size: "small",
473
+ label: `+${g}`,
474
+ sx: {
475
+ position: "absolute",
476
+ right: 8,
477
+ top: (z - 24) / 2,
478
+ pointerEvents: "none"
479
+ }
480
+ }
481
+ )
482
+ ]
483
+ }
484
+ );
485
+ }
486
+ const we = {
487
+ Provider: pe,
488
+ Tooltip: me,
489
+ IconButton: fe,
490
+ Button: he,
491
+ TextField: xe,
492
+ Select: be,
493
+ Combobox: ve,
494
+ Menu: Be,
495
+ // A light native-date field; the MUI X picker is an opt-in (MuiDatePicker,
496
+ // `@nongt/visql/mui-date-pickers`) so this kit doesn't need MUI X/date-fns.
497
+ DatePicker: Ie,
498
+ // IN's values: an Autocomplete of chips (plain @mui/material).
499
+ ListInput: Te
500
+ }, $e = ({ components: e, ...t }) => {
501
+ const r = H(
502
+ () => ({ ...we, ...e }),
503
+ [e]
504
+ );
505
+ return /* @__PURE__ */ n(K, { ...t, components: r });
506
+ };
507
+ export {
508
+ $e as QueryBuilder,
509
+ we as muiComponents
510
+ };