@1771technologies/lytenyte-pro 0.0.39

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 (168) hide show
  1. package/LICENSE +15 -0
  2. package/dist/DialogPortalContext-C2WZTqJ3.js +47 -0
  3. package/dist/InternalBackdrop-Dm9czgoC.js +6746 -0
  4. package/dist/MenuRoot-9n64jNWP.js +724 -0
  5. package/dist/anchor-context-B9sGQdR5.js +35 -0
  6. package/dist/arrow-down-icon-B-3ldODD.js +27 -0
  7. package/dist/arrow-svg-evmXDI_J.js +29 -0
  8. package/dist/column-manager.js +1241 -0
  9. package/dist/cross-icon-CEMLAlFX.js +20 -0
  10. package/dist/dialog.js +506 -0
  11. package/dist/filter-manager.js +1056 -0
  12. package/dist/getPseudoElementBounds-BSHt6WYm.js +26 -0
  13. package/dist/grid-container.js +18 -0
  14. package/dist/icons.js +512 -0
  15. package/dist/index.js +3730 -0
  16. package/dist/lytenyte-pro.css +1948 -0
  17. package/dist/manage-columns-icon-D4CElo5H.js +146 -0
  18. package/dist/menu.js +1639 -0
  19. package/dist/pill-C4Jhdf8E.js +985 -0
  20. package/dist/pill-manager.js +674 -0
  21. package/dist/plus-icon-ToqW5CC-.js +15 -0
  22. package/dist/popover.js +770 -0
  23. package/dist/row-group-icon-BOOju5Vu.js +205 -0
  24. package/dist/search-icon-CcG1lqsn.js +86 -0
  25. package/dist/select-C6xOZZLq.js +2231 -0
  26. package/dist/sort-manager.js +298 -0
  27. package/dist/tickmark-icon-CoogRMoO.js +51 -0
  28. package/dist/types/cell-selection/cell-selection-containers.d.ts +3 -0
  29. package/dist/types/cell-selection/cell-selection-driver.d.ts +1 -0
  30. package/dist/types/cell-selection/cell-style-row.d.ts +8 -0
  31. package/dist/types/column-manager/column-manager-drag-box-controls.d.ts +1 -0
  32. package/dist/types/column-manager/column-manager-drag-box-expander.d.ts +1 -0
  33. package/dist/types/column-manager/column-manager-drag-box-label.d.ts +5 -0
  34. package/dist/types/column-manager/column-manager-drag-box.d.ts +13 -0
  35. package/dist/types/column-manager/column-manager-drag-placeholder.d.ts +5 -0
  36. package/dist/types/column-manager/column-manager-drop-zone.d.ts +10 -0
  37. package/dist/types/column-manager/column-manager-impl.d.ts +36 -0
  38. package/dist/types/column-manager/column-manager-pill.d.ts +4 -0
  39. package/dist/types/column-manager/column-manager-pivot-mode-toggle.d.ts +1 -0
  40. package/dist/types/column-manager/column-manager-search.d.ts +1 -0
  41. package/dist/types/column-manager/column-manager-state.d.ts +8 -0
  42. package/dist/types/column-manager/column-manager-tree-item.d.ts +6 -0
  43. package/dist/types/column-manager/column-manager-tree.d.ts +11 -0
  44. package/dist/types/column-manager/column-manager-types.d.ts +1 -0
  45. package/dist/types/column-manager/column-manager.d.ts +1 -0
  46. package/dist/types/column-manager/column-mananger-context.d.ts +12 -0
  47. package/dist/types/column-manager/utils/all-leafs.d.ts +3 -0
  48. package/dist/types/column-manager/utils/can-hide-item.d.ts +3 -0
  49. package/dist/types/column-manager/utils/handle-item-hide.d.ts +3 -0
  50. package/dist/types/components-internal/button/button.d.ts +9 -0
  51. package/dist/types/components-internal/grid-frame/grid-frame.d.ts +11 -0
  52. package/dist/types/components-internal/radio/radio.d.ts +5 -0
  53. package/dist/types/components-internal/separator/separator.d.ts +8 -0
  54. package/dist/types/components-internal/toggle/toggle.d.ts +7 -0
  55. package/dist/types/dialog/dialog-driver.d.ts +1 -0
  56. package/dist/types/dialog/dialog-impl.d.ts +6 -0
  57. package/dist/types/dialog/dialog.d.ts +8 -0
  58. package/dist/types/dialog/use-dialog-class.d.ts +1 -0
  59. package/dist/types/external.d.ts +2 -0
  60. package/dist/types/filter-manager/combined-to-flat.d.ts +3 -0
  61. package/dist/types/filter-manager/components/apply-filter-button.d.ts +1 -0
  62. package/dist/types/filter-manager/components/clear-filter-button.d.ts +1 -0
  63. package/dist/types/filter-manager/components/flatten-tree-items.d.ts +4 -0
  64. package/dist/types/filter-manager/components/get-child-values.d.ts +2 -0
  65. package/dist/types/filter-manager/components/in-filter-container.d.ts +1 -0
  66. package/dist/types/filter-manager/components/in-filter-error.d.ts +5 -0
  67. package/dist/types/filter-manager/components/in-filter-loading.d.ts +1 -0
  68. package/dist/types/filter-manager/components/in-filter-root.d.ts +11 -0
  69. package/dist/types/filter-manager/components/in-filter-tree.d.ts +15 -0
  70. package/dist/types/filter-manager/components/simple-filter-additional-switch.d.ts +1 -0
  71. package/dist/types/filter-manager/components/simple-filter-operator/date-operator.d.ts +1 -0
  72. package/dist/types/filter-manager/components/simple-filter-operator/number-operator.d.ts +1 -0
  73. package/dist/types/filter-manager/components/simple-filter-operator/simple-filter-operator.d.ts +1 -0
  74. package/dist/types/filter-manager/components/simple-filter-operator/text-operator.d.ts +1 -0
  75. package/dist/types/filter-manager/components/simple-filter-root.d.ts +9 -0
  76. package/dist/types/filter-manager/components/simple-filter-value/date-value.d.ts +1 -0
  77. package/dist/types/filter-manager/components/simple-filter-value/number-value.d.ts +1 -0
  78. package/dist/types/filter-manager/components/simple-filter-value/simple-filter-value.d.ts +1 -0
  79. package/dist/types/filter-manager/components/simple-filter-value/text-value.d.ts +1 -0
  80. package/dist/types/filter-manager/components/use-date-filter-callbacks.d.ts +9 -0
  81. package/dist/types/filter-manager/components/use-in-filter-item-loader.d.ts +7 -0
  82. package/dist/types/filter-manager/components/use-number-filter-callbacks.d.ts +8 -0
  83. package/dist/types/filter-manager/components/use-text-filter-callbacks.d.ts +8 -0
  84. package/dist/types/filter-manager/filter-manager-impl.d.ts +27 -0
  85. package/dist/types/filter-manager/filter-manager.d.ts +1 -0
  86. package/dist/types/filter-manager/filter-state-context.d.ts +16 -0
  87. package/dist/types/filter-manager/flat-to-combined.d.ts +3 -0
  88. package/dist/types/filter-manager/flatten-combined-filter.d.ts +3 -0
  89. package/dist/types/filter-manager/is-filter-complete.d.ts +2 -0
  90. package/dist/types/filter-manager/types.d.ts +15 -0
  91. package/dist/types/filter-manager/use-in-filter.d.ts +5 -0
  92. package/dist/types/filter-manager/use-simple-filters.d.ts +8 -0
  93. package/dist/types/grid-container/grid-container-impl.d.ts +6 -0
  94. package/dist/types/grid-container/grid-container.d.ts +2 -0
  95. package/dist/types/icons.d.ts +1 -0
  96. package/dist/types/index.d.ts +7 -0
  97. package/dist/types/license.d.ts +12 -0
  98. package/dist/types/list-view/list-view-context.d.ts +21 -0
  99. package/dist/types/list-view/list-view.d.ts +26 -0
  100. package/dist/types/lytenyte-pro.d.ts +7 -0
  101. package/dist/types/menu/arrow-svg.d.ts +1 -0
  102. package/dist/types/menu/column-menu/column-menu-driver.d.ts +4 -0
  103. package/dist/types/menu/context-menu/context-menu-driver.d.ts +1 -0
  104. package/dist/types/menu/context-menu/use-context-menu-listener.d.ts +6 -0
  105. package/dist/types/menu/menu-impl.d.ts +17 -0
  106. package/dist/types/menu/menu.d.ts +18 -0
  107. package/dist/types/menu/use-menu-class-name.d.ts +1 -0
  108. package/dist/types/overlay/load-error-overlay.d.ts +1 -0
  109. package/dist/types/overlay/loading-overlay.d.ts +1 -0
  110. package/dist/types/overlay/no-data-overlay.d.ts +1 -0
  111. package/dist/types/overlay/overlay-driver.d.ts +1 -0
  112. package/dist/types/pill/pill.d.ts +5 -0
  113. package/dist/types/pill-manager/pill-manager-agg-menu.d.ts +7 -0
  114. package/dist/types/pill-manager/pill-manager-controls.d.ts +9 -0
  115. package/dist/types/pill-manager/pill-manager-drag-placeholder.d.ts +5 -0
  116. package/dist/types/pill-manager/pill-manager-expander.d.ts +1 -0
  117. package/dist/types/pill-manager/pill-manager-impl.d.ts +49 -0
  118. package/dist/types/pill-manager/pill-manager-pill.d.ts +4 -0
  119. package/dist/types/pill-manager/pill-manager-pills/pill-manager-pills.d.ts +2 -0
  120. package/dist/types/pill-manager/pill-manager-pills/use-aggregation-source.d.ts +2 -0
  121. package/dist/types/pill-manager/pill-manager-pills/use-column-pivot-source.d.ts +2 -0
  122. package/dist/types/pill-manager/pill-manager-pills/use-column-source.d.ts +2 -0
  123. package/dist/types/pill-manager/pill-manager-pills/use-measures-source.d.ts +2 -0
  124. package/dist/types/pill-manager/pill-manager-pills/use-row-groups-source.d.ts +2 -0
  125. package/dist/types/pill-manager/pill-manager-pills/utils.d.ts +3 -0
  126. package/dist/types/pill-manager/pill-manager-row-label.d.ts +22 -0
  127. package/dist/types/pill-manager/pill-manager-row.d.ts +12 -0
  128. package/dist/types/pill-manager/pill-manager-rows.d.ts +1 -0
  129. package/dist/types/pill-manager/pill-manager-separator.d.ts +1 -0
  130. package/dist/types/pill-manager/pill-manager-types.d.ts +36 -0
  131. package/dist/types/pill-manager/pill-manager.d.ts +1 -0
  132. package/dist/types/popover/anchor-context.d.ts +6 -0
  133. package/dist/types/popover/popover-driver.d.ts +1 -0
  134. package/dist/types/popover/popover-impl.d.ts +8 -0
  135. package/dist/types/popover/popover.d.ts +10 -0
  136. package/dist/types/popover/use-popover-class.d.ts +1 -0
  137. package/dist/types/select/select.d.ts +17 -0
  138. package/dist/types/sort-manager/sort-adder.d.ts +4 -0
  139. package/dist/types/sort-manager/sort-apply.d.ts +1 -0
  140. package/dist/types/sort-manager/sort-cancel.d.ts +1 -0
  141. package/dist/types/sort-manager/sort-clear.d.ts +1 -0
  142. package/dist/types/sort-manager/sort-column-select.d.ts +5 -0
  143. package/dist/types/sort-manager/sort-direction-select.d.ts +5 -0
  144. package/dist/types/sort-manager/sort-items-to-sort-model.d.ts +3 -0
  145. package/dist/types/sort-manager/sort-manager-container.d.ts +53 -0
  146. package/dist/types/sort-manager/sort-manager-context.d.ts +4 -0
  147. package/dist/types/sort-manager/sort-manager-impl.d.ts +30 -0
  148. package/dist/types/sort-manager/sort-manager.d.ts +1 -0
  149. package/dist/types/sort-manager/sort-model-to-sort-items.d.ts +4 -0
  150. package/dist/types/sort-manager/sort-remove.d.ts +4 -0
  151. package/dist/types/sort-manager/sort-sort-select.d.ts +5 -0
  152. package/dist/types/sort-manager/use-sort-state.d.ts +8 -0
  153. package/dist/types/sort-manager/use-sortable-column-items.d.ts +9 -0
  154. package/dist/types/types.d.ts +1 -0
  155. package/dist/types/use-client-data-source.d.ts +6 -0
  156. package/dist/types/use-edge-scroll.d.ts +7 -0
  157. package/dist/types/use-grid.d.ts +6 -0
  158. package/dist/types/use-lytenyte.d.ts +10 -0
  159. package/dist/types/use-tree-data-source.d.ts +3 -0
  160. package/dist/types/watermark.d.ts +3 -0
  161. package/dist/types.js +1 -0
  162. package/dist/use-grid-DKvzGZWc.js +916 -0
  163. package/dist/useAnchorPositioning-Cm44rb7y.js +252 -0
  164. package/dist/useBaseUiId-J66PFGv_.js +48 -0
  165. package/dist/useButton-Cy7tjZ__.js +183 -0
  166. package/dist/useCompositeListItem-I14CpQPi.js +51 -0
  167. package/dist/useScrollLock-D6h5lZYs.js +515 -0
  168. package/package.json +96 -0
@@ -0,0 +1,674 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { u as useGrid, a as useDragStore, b as useDrag, D as DragProvider, G as GridProvider } from "./use-grid-DKvzGZWc.js";
3
+ import { useMemo, createContext, useState, useContext, forwardRef, useEffect, useCallback } from "react";
4
+ import { clsx } from "@1771technologies/js-utils";
5
+ import { c as canAgg, a as canMeasure, u as useAggregationSource, b as useMeasuresSource, d as useRowGroupsSource, e as useColumnPivotSource, f as useDroppable, g as useEdgeScroll, P as Pill, M as MenuTrigger, h as useDraggable, i as PillManagerAggMenu, j as PillManagerMeasureMenu } from "./pill-C4Jhdf8E.js";
6
+ import "@1771technologies/react-sizer";
7
+ import { useCombinedRefs } from "@1771technologies/react-utils";
8
+ import "@1771technologies/grid-provider";
9
+ import "@1771technologies/react-dragon";
10
+ import "@1771technologies/grid-core";
11
+ import { D as DragIcon, M as MeasuresIcon, C as ColumnPivotIcon, R as RowGroupIcon, a as MoreDotsIcon } from "./row-group-icon-BOOju5Vu.js";
12
+ import { M as MenuRoot, a as MenuPortal, b as MenuPositioner } from "./MenuRoot-9n64jNWP.js";
13
+ import { M as ManageColumnsIcon, C as CollapseIcon, E as ExpandIcon } from "./manage-columns-icon-D4CElo5H.js";
14
+ import { createPortal } from "react-dom";
15
+ function useColumnSource(source) {
16
+ const { api, state: sx } = useGrid();
17
+ const columns = sx.columns.use();
18
+ const pivotModel = sx.columnPivotModel.use();
19
+ const aggModel = sx.aggModel.use();
20
+ const groupModel = sx.rowGroupModel.use();
21
+ const measureModel = sx.measureModel.use();
22
+ const base = sx.columnBase.use();
23
+ return useMemo(() => {
24
+ if (source !== "columns") return [];
25
+ const active = [];
26
+ const inactive = [];
27
+ for (const c of columns) {
28
+ if (api.columnIsGridGenerated(c)) continue;
29
+ if (api.columnIsVisible(c, true)) {
30
+ const onToggle = () => api.columnUpdate(c, { hide: true });
31
+ const dragTags = ["columns"];
32
+ if (api.columnIsPivotable(c) && !pivotModel.includes(c.id)) dragTags.push("column-pivot");
33
+ if (api.columnIsRowGroupable(c) && !groupModel.includes(c.id)) dragTags.push("row-group");
34
+ if (!aggModel[c.id] && canAgg(c, base)) dragTags.push("aggregations");
35
+ if (!measureModel[c.id] && canMeasure(c, base)) dragTags.push("measures");
36
+ const dragEnd = (d) => {
37
+ const over = d.over.at(-1);
38
+ if (!over || !over.canDrop) return;
39
+ if (over.data.target === "columns") {
40
+ const id = over.data.id;
41
+ if (id === c.id) return;
42
+ const isBefore = (sx.rtl.peek() ? "right" : "left") === over.xHalf;
43
+ if (isBefore) api.columnMoveBefore([c.id], id);
44
+ else api.columnMoveAfter([c.id], id);
45
+ return;
46
+ }
47
+ if (over.id === "row-groups-pills") {
48
+ sx.rowGroupModel.set((prev) => [...prev, c.id]);
49
+ api.columnUpdate(c, { hide: true });
50
+ return;
51
+ }
52
+ if (over.data.target === "row-group") {
53
+ const id = over.data.id;
54
+ api.columnUpdate(c, { hide: true });
55
+ const model = sx.rowGroupModel.peek();
56
+ const isBefore = (sx.rtl.peek() ? "right" : "left") === over.xHalf;
57
+ const index = model.indexOf(id);
58
+ const nextModel = [...model];
59
+ nextModel.splice(isBefore ? index : index + 1, 0, c.id);
60
+ sx.rowGroupModel.set(nextModel);
61
+ return;
62
+ }
63
+ if (over.id === "column-pivots-pills") {
64
+ sx.columnPivotModel.set((prev) => [...prev, c.id]);
65
+ api.columnUpdate(c, { hide: true });
66
+ return;
67
+ }
68
+ if (over.data.target === "column-pivot") {
69
+ const id = over.data.id;
70
+ api.columnUpdate(c, { hide: true });
71
+ const model = sx.columnPivotModel.peek();
72
+ const isBefore = (sx.rtl.peek() ? "right" : "left") === over.xHalf;
73
+ const index = model.indexOf(id);
74
+ const nextModel = [...model];
75
+ nextModel.splice(isBefore ? index : index + 1, 0, c.id);
76
+ sx.columnPivotModel.set(nextModel);
77
+ return;
78
+ }
79
+ if (over.id === "aggregations-pills") {
80
+ const aggFn = c.aggFnDefault ?? c.aggFnsAllowed?.at(0) ?? base.aggFnsAllowed?.at(0);
81
+ if (!aggFn) return;
82
+ sx.aggModel.set((prev) => ({ ...prev, [c.id]: { fn: aggFn } }));
83
+ return;
84
+ }
85
+ if (over.id === "measures-pills") {
86
+ const measureFn = c.measureFnDefault ?? c.measureFnsAllowed?.at(0) ?? base.measureFnsAllowed?.at(0);
87
+ if (!measureFn) return;
88
+ sx.measureModel.set((prev) => ({ ...prev, [c.id]: { fn: measureFn } }));
89
+ return;
90
+ }
91
+ };
92
+ active.push({
93
+ kind: "column",
94
+ active: true,
95
+ label: c.headerName ?? c.id,
96
+ onClick: onToggle,
97
+ isColumn: true,
98
+ draggable: api.columnIsMovable(c),
99
+ dragTags,
100
+ dragEnd,
101
+ dropId: `column-${c.id}`,
102
+ dropTags: ["columns"],
103
+ dropData: {
104
+ target: "columns",
105
+ id: c.id
106
+ }
107
+ });
108
+ } else {
109
+ const onToggle = () => api.columnUpdate(c, { hide: false });
110
+ inactive.push({
111
+ kind: "column",
112
+ active: false,
113
+ label: c.headerName ?? c.id,
114
+ onClick: onToggle,
115
+ dropId: `column-${c.id}`,
116
+ draggable: false,
117
+ dragTags: [],
118
+ dropTags: [],
119
+ dropData: {}
120
+ });
121
+ }
122
+ }
123
+ return [...active, ...inactive];
124
+ }, [
125
+ aggModel,
126
+ api,
127
+ base,
128
+ columns,
129
+ groupModel,
130
+ measureModel,
131
+ pivotModel,
132
+ source,
133
+ sx.aggModel,
134
+ sx.columnPivotModel,
135
+ sx.measureModel,
136
+ sx.rowGroupModel,
137
+ sx.rtl
138
+ ]);
139
+ }
140
+ const context$1 = createContext({});
141
+ function PillManagerControlsProvider(props) {
142
+ const [activeRow, setActiveRow] = useState(null);
143
+ const [activePill, setActivePill] = useState(null);
144
+ const m = useMemo(() => {
145
+ return {
146
+ activeRow,
147
+ setActiveRow,
148
+ activePill,
149
+ setActivePill
150
+ };
151
+ }, [activePill, activeRow]);
152
+ return /* @__PURE__ */ jsx(context$1.Provider, { value: m, children: props.children });
153
+ }
154
+ const usePillControls = () => useContext(context$1);
155
+ const PillRowContext = createContext(null);
156
+ const usePillRow = () => useContext(PillRowContext);
157
+ const PillManagerRow = forwardRef(
158
+ function PillManagerRow2({ pillSource, ...props }, ref) {
159
+ const [expanded, setExpanded] = useState(false);
160
+ const { activeRow } = usePillControls();
161
+ const value = useMemo(() => {
162
+ return {
163
+ expanded,
164
+ setExpanded,
165
+ expandable: true,
166
+ pillSource
167
+ };
168
+ }, [expanded, pillSource]);
169
+ return /* @__PURE__ */ jsx(PillRowContext.Provider, { value, children: /* @__PURE__ */ jsx(
170
+ "div",
171
+ {
172
+ ...props,
173
+ className: clsx("lng1771-pill-manager__row"),
174
+ ref,
175
+ "data-expanded": expanded,
176
+ "data-pill-row-key": pillSource,
177
+ "data-pill-active": activeRow === pillSource
178
+ }
179
+ ) });
180
+ }
181
+ );
182
+ const PillManagerPills = forwardRef(function PillManagerRow3({ children, ...props }, ref) {
183
+ const { pillSource } = usePillRow();
184
+ const aggs = useAggregationSource(pillSource);
185
+ const measures = useMeasuresSource(pillSource);
186
+ const columns = useColumnSource(pillSource);
187
+ const rowGroups = useRowGroupsSource(pillSource);
188
+ const pivots = useColumnPivotSource(pillSource);
189
+ const sourceItems = useMemo(() => {
190
+ if (pillSource === "columns") return columns;
191
+ if (pillSource === "column-pivots") return pivots;
192
+ if (pillSource === "row-groups") return rowGroups;
193
+ if (pillSource === "aggregations") return aggs;
194
+ if (pillSource === "measures") return measures;
195
+ return [];
196
+ }, [aggs, columns, measures, pillSource, pivots, rowGroups]);
197
+ const dropTags = useMemo(() => {
198
+ if (pillSource === "columns") return ["columns"];
199
+ if (pillSource === "aggregations") return ["aggregations"];
200
+ if (pillSource === "column-pivots") return ["column-pivot"];
201
+ if (pillSource === "measures") return ["measures"];
202
+ if (pillSource === "row-groups") return ["row-group"];
203
+ return [];
204
+ }, [pillSource]);
205
+ const dropData = useMemo(() => {
206
+ return { target: pillSource, sourceItems };
207
+ }, [pillSource, sourceItems]);
208
+ const {
209
+ canDrop,
210
+ isTarget,
211
+ isNearestOver,
212
+ ref: dropRef
213
+ } = useDroppable({
214
+ id: `${pillSource}-pills`,
215
+ accepted: dropTags,
216
+ data: dropData
217
+ });
218
+ const combined = useCombinedRefs(dropRef, ref);
219
+ const store = useDragStore();
220
+ const isActive = useDrag(store, (s) => !!s.active);
221
+ const re = useEdgeScroll({ isActive, direction: "horizontal" });
222
+ const allRefs = useCombinedRefs(re, combined);
223
+ return /* @__PURE__ */ jsx(
224
+ "div",
225
+ {
226
+ ...props,
227
+ className: clsx("lng1771-pill-manager__pills", props.className),
228
+ "data-is-drop-target": isTarget,
229
+ ref: allRefs,
230
+ "data-pill-source": pillSource,
231
+ "data-drop-visible": canDrop && sourceItems.filter((c) => c.active).length === 0,
232
+ tabIndex: -1,
233
+ children: /* @__PURE__ */ jsxs("div", { className: "lng1771-pill-manager__pills-inner", children: [
234
+ children({ pills: sourceItems }),
235
+ canDrop && isNearestOver && sourceItems.filter((c) => c.active).length > 0 && /* @__PURE__ */ jsx("div", { className: "lng1771-pill-manager__drop-indicator-end" })
236
+ ] })
237
+ }
238
+ );
239
+ });
240
+ const PillManagerPill = forwardRef(function PillManagerPill2({ item, ...props }, ref) {
241
+ const {
242
+ ref: dropRef,
243
+ isTarget,
244
+ canDrop,
245
+ xHalf
246
+ } = useDroppable({
247
+ id: item.dropId,
248
+ accepted: item.dropTags,
249
+ data: item.dropData,
250
+ active: item.active
251
+ });
252
+ const grid = useGrid();
253
+ const rtl = grid.state.rtl.use();
254
+ const combinedRefs = useCombinedRefs(ref, dropRef);
255
+ const { activePill, setActivePill, setActiveRow } = usePillControls();
256
+ const { pillSource } = usePillRow();
257
+ const {
258
+ aggMenuRenderer: AggMenu,
259
+ measureMenuRenderer: MeasureMenu,
260
+ menuTriggerIcon: TriggerIcon
261
+ } = useComponents();
262
+ const [isDragging, setIsDragging] = useState(false);
263
+ return /* @__PURE__ */ jsxs(
264
+ "div",
265
+ {
266
+ ...props,
267
+ role: "button",
268
+ ref: combinedRefs,
269
+ "data-pill-key": item.dropId,
270
+ "data-pill-active": item.active,
271
+ "data-is-droppable": isTarget && canDrop,
272
+ className: "lng1771-pill-manager__pill-outer",
273
+ onClick: item.onClick,
274
+ children: [
275
+ /* @__PURE__ */ jsxs(
276
+ Pill,
277
+ {
278
+ kind: item.kind,
279
+ "data-pill-focused": item.dropId === activePill,
280
+ className: "lng1771-pill-manager__pill-inner",
281
+ interactive: true,
282
+ "data-draggable": item.draggable,
283
+ "data-drag-active": isDragging,
284
+ children: [
285
+ item.draggable && /* @__PURE__ */ jsx(DragHandle, { item, setIsDragging }),
286
+ /* @__PURE__ */ jsx("span", { children: item.label }),
287
+ item.secondaryLabel && /* @__PURE__ */ jsx("span", { className: "lng1771-pill-manager__pill-inner--secondary-label", children: item.secondaryLabel }),
288
+ (item.isAggregation || item.isMeasure) && /* @__PURE__ */ jsxs(MenuRoot, { children: [
289
+ /* @__PURE__ */ jsx(
290
+ MenuTrigger,
291
+ {
292
+ className: "lng1771-pill-manager__menu-trigger",
293
+ "data-pill-menu-trigger": "true",
294
+ tabIndex: -1,
295
+ onClick: (e) => e.stopPropagation(),
296
+ onFocus: (ev) => {
297
+ let current = ev.currentTarget;
298
+ while (current && current.getAttribute("data-rows-root") == null) {
299
+ current = current.parentElement;
300
+ }
301
+ if (current) current.focus();
302
+ setTimeout(() => {
303
+ setActivePill(item.dropId);
304
+ setActiveRow(pillSource);
305
+ });
306
+ },
307
+ children: /* @__PURE__ */ jsx(TriggerIcon, { width: 16, height: 16 })
308
+ }
309
+ ),
310
+ /* @__PURE__ */ jsx(MenuPortal, { children: /* @__PURE__ */ jsxs(MenuPositioner, { onClick: (ev) => ev.stopPropagation(), children: [
311
+ item.isAggregation && /* @__PURE__ */ jsx(AggMenu, { grid, column: item.column }),
312
+ item.isMeasure && /* @__PURE__ */ jsx(MeasureMenu, { grid, column: item.column })
313
+ ] }) })
314
+ ] })
315
+ ]
316
+ }
317
+ ),
318
+ canDrop && (rtl ? "left" : "right") === xHalf && /* @__PURE__ */ jsx("div", { className: "lng1771-pill-manager__drop-indicator-end" }),
319
+ canDrop && (rtl ? "right" : "left") === xHalf && /* @__PURE__ */ jsx("div", { className: "lng1771-pill-manager__drop-indicator-start" })
320
+ ]
321
+ }
322
+ );
323
+ });
324
+ function DragHandle({
325
+ item,
326
+ setIsDragging
327
+ }) {
328
+ const { onPointerDown, isActive } = useDraggable({
329
+ id: item.label,
330
+ getTags: () => item.dragTags,
331
+ getData: () => item?.dragData,
332
+ onDragStart: () => {
333
+ document.body.classList.add("lng1771-drag-on");
334
+ },
335
+ onDragCancel: () => {
336
+ document.body.classList.remove("lng1771-drag-on");
337
+ },
338
+ onDragEnd: (p) => {
339
+ item.dragEnd?.(p);
340
+ document.body.classList.remove("lng1771-drag-on");
341
+ }
342
+ });
343
+ useEffect(() => {
344
+ setIsDragging(isActive);
345
+ }, [isActive, setIsDragging]);
346
+ return /* @__PURE__ */ jsx(
347
+ "button",
348
+ {
349
+ tabIndex: -1,
350
+ className: "lng1771-pill-manager__pill-dragger",
351
+ onPointerDown,
352
+ children: /* @__PURE__ */ jsx(DragIcon, { width: 16, height: 16 })
353
+ }
354
+ );
355
+ }
356
+ const PillManagerRowLabel = forwardRef(
357
+ function PillManagerRowLabel2(props, ref) {
358
+ return /* @__PURE__ */ jsx(
359
+ "div",
360
+ {
361
+ ...props,
362
+ className: clsx("lng1771-pill-manager__row-label", props.className),
363
+ ref
364
+ }
365
+ );
366
+ }
367
+ );
368
+ const PillManagerColumnsLabel = forwardRef(function PillManagerColumnsLabel2({ labelText = "Columns", icon = /* @__PURE__ */ jsx(ManageColumnsIcon, {}), ...props }, ref) {
369
+ return /* @__PURE__ */ jsxs(
370
+ PillManagerRowLabel,
371
+ {
372
+ ...props,
373
+ className: "lng1771-pill-manager__row-label-built-in",
374
+ ref,
375
+ children: [
376
+ icon,
377
+ /* @__PURE__ */ jsx("span", { children: labelText })
378
+ ]
379
+ }
380
+ );
381
+ });
382
+ const PillManagerAggLabel = forwardRef(function PillManagerColumnsLabel3({ labelText = "Aggregations", icon = /* @__PURE__ */ jsx(MeasuresIcon, {}), ...props }, ref) {
383
+ return /* @__PURE__ */ jsxs(
384
+ PillManagerRowLabel,
385
+ {
386
+ ...props,
387
+ className: "lng1771-pill-manager__row-label-built-in",
388
+ ref,
389
+ children: [
390
+ icon,
391
+ /* @__PURE__ */ jsx("span", { children: labelText })
392
+ ]
393
+ }
394
+ );
395
+ });
396
+ const PillManagerMeasureLabel = forwardRef(function PillManagerColumnsLabel4({ labelText = "Measure", icon = /* @__PURE__ */ jsx(MeasuresIcon, {}), ...props }, ref) {
397
+ return /* @__PURE__ */ jsxs(
398
+ PillManagerRowLabel,
399
+ {
400
+ ...props,
401
+ className: "lng1771-pill-manager__row-label-built-in",
402
+ ref,
403
+ children: [
404
+ icon,
405
+ /* @__PURE__ */ jsx("span", { children: labelText })
406
+ ]
407
+ }
408
+ );
409
+ });
410
+ const PillManagerColumnPivotsLabel = forwardRef(function PillManagerColumnsLabel5({ labelText = "Column Pivots", icon = /* @__PURE__ */ jsx(ColumnPivotIcon, {}), ...props }, ref) {
411
+ return /* @__PURE__ */ jsxs(
412
+ PillManagerRowLabel,
413
+ {
414
+ ...props,
415
+ className: "lng1771-pill-manager__row-label-built-in",
416
+ ref,
417
+ children: [
418
+ icon,
419
+ /* @__PURE__ */ jsx("span", { children: labelText })
420
+ ]
421
+ }
422
+ );
423
+ });
424
+ const PillManagerRowGroupsLabel = forwardRef(function PillManagerColumnsLabel6({ labelText = "Row Groups", icon = /* @__PURE__ */ jsx(RowGroupIcon, {}), ...props }, ref) {
425
+ return /* @__PURE__ */ jsxs(
426
+ PillManagerRowLabel,
427
+ {
428
+ ...props,
429
+ className: "lng1771-pill-manager__row-label-built-in",
430
+ ref,
431
+ children: [
432
+ icon,
433
+ /* @__PURE__ */ jsx("span", { children: labelText })
434
+ ]
435
+ }
436
+ );
437
+ });
438
+ const PillManagerRows = forwardRef(
439
+ function PillManagerRows2({ onKeyDown: kd, ...props }, ref) {
440
+ const { activePill, activeRow, setActivePill, setActiveRow } = usePillControls();
441
+ const sx = useGrid();
442
+ const onKeydown = useCallback(
443
+ (ev) => {
444
+ kd?.(ev);
445
+ const targets = Array.from(ev.currentTarget.children).filter((c) => c.getAttribute("data-pill-row-key")).map((c) => [c.getAttribute("data-pill-row-key"), c]);
446
+ if (targets.length === 0) return;
447
+ const startKey = sx.state.rtl.peek() ? "ArrowRight" : "ArrowLeft";
448
+ const endKey = sx.state.rtl.peek() ? "ArrowLeft" : "ArrowRight";
449
+ const focusPrevActive = (el) => {
450
+ const pills = Array.from(el.querySelectorAll(`[data-pill-key]`)).map(
451
+ (c) => [c.getAttribute("data-pill-key"), c]
452
+ );
453
+ if (!pills.length) {
454
+ setActivePill(null);
455
+ return;
456
+ }
457
+ if (!activePill) {
458
+ setActivePill(pills.at(-1)[0]);
459
+ pills.at(-1)[1].scrollIntoView();
460
+ return;
461
+ }
462
+ const activeIndex = pills.findIndex((c) => c[0] === activePill);
463
+ if (activeIndex === -1 || activeIndex === 0) {
464
+ setActivePill(pills.at(-1)[0]);
465
+ pills.at(-1)[1].scrollIntoView();
466
+ return;
467
+ }
468
+ setActivePill(pills[activeIndex - 1][0]);
469
+ pills[activeIndex - 1][1].scrollIntoView();
470
+ };
471
+ const focusNextActive = (el) => {
472
+ const pills = Array.from(el.querySelectorAll(`[data-pill-key]`)).map(
473
+ (c) => [c.getAttribute("data-pill-key"), c]
474
+ );
475
+ if (!pills.length) {
476
+ setActivePill(null);
477
+ return;
478
+ }
479
+ if (!activePill) {
480
+ setActivePill(pills[0][0]);
481
+ pills[0][1].scrollIntoView();
482
+ return;
483
+ }
484
+ const activeIndex = pills.findIndex((c) => c[0] === activePill);
485
+ if (activeIndex === -1 || activeIndex === pills.length - 1) {
486
+ setActivePill(pills[0][0]);
487
+ pills[0][1].scrollIntoView();
488
+ return;
489
+ }
490
+ setActivePill(pills[activeIndex + 1][0]);
491
+ pills[activeIndex + 1][1].scrollIntoView();
492
+ };
493
+ if (ev.key === "ArrowUp") {
494
+ const currentActive = targets.findIndex((c) => c[0] === activeRow);
495
+ if (currentActive === -1 || currentActive === 0) {
496
+ setActiveRow(targets.at(-1)[0]);
497
+ focusNextActive(targets.at(-1)[1]);
498
+ } else {
499
+ setActiveRow(targets[currentActive - 1][0]);
500
+ focusNextActive(targets[currentActive - 1][1]);
501
+ }
502
+ } else if (ev.key === "ArrowDown") {
503
+ const currentActive = targets.findIndex((c) => c[0] === activeRow);
504
+ if (currentActive === -1 || currentActive === targets.length - 1) {
505
+ setActiveRow(targets[0][0]);
506
+ focusNextActive(targets[0][1]);
507
+ } else {
508
+ setActiveRow(targets[currentActive + 1][0]);
509
+ focusNextActive(targets[currentActive + 1][1]);
510
+ }
511
+ } else if (ev.key === endKey) {
512
+ const currentActive = targets.find((c) => c[0] === activeRow)?.[1];
513
+ if (!currentActive) return;
514
+ focusNextActive(currentActive);
515
+ ev.preventDefault();
516
+ return;
517
+ } else if (ev.key === startKey) {
518
+ const currentActive = targets.find((c) => c[0] === activeRow)?.[1];
519
+ if (!currentActive) return;
520
+ focusPrevActive(currentActive);
521
+ ev.preventDefault();
522
+ return;
523
+ } else if (ev.key === " ") {
524
+ if (!activePill) return;
525
+ const currentActive = targets.find((c) => c[0] === activeRow)?.[1];
526
+ if (!currentActive) return;
527
+ const pill = currentActive.querySelector(
528
+ `[data-pill-key="${activePill}"]`
529
+ );
530
+ if (!pill) return;
531
+ pill.click();
532
+ ev.preventDefault();
533
+ } else if (ev.key === "x") {
534
+ const currentActive = targets.find((c) => c[0] === activeRow)?.[1];
535
+ if (!currentActive) return;
536
+ const expander = currentActive.querySelector(
537
+ `[data-pill-expander-source]`
538
+ );
539
+ if (expander) expander.click();
540
+ } else if (ev.key === "m") {
541
+ if (!activePill) return;
542
+ const currentActive = targets.find((c) => c[0] === activeRow)?.[1];
543
+ if (!currentActive) return;
544
+ const pill = currentActive.querySelector(
545
+ `[data-pill-key="${activePill}"]`
546
+ );
547
+ if (!pill) return;
548
+ const menu = pill.querySelector('[data-pill-menu-trigger="true"]');
549
+ if (!menu) return;
550
+ menu.click();
551
+ }
552
+ },
553
+ [activePill, activeRow, kd, setActivePill, setActiveRow, sx.state.rtl]
554
+ );
555
+ return /* @__PURE__ */ jsx(
556
+ "div",
557
+ {
558
+ ...props,
559
+ onKeyDown: onKeydown,
560
+ tabIndex: 0,
561
+ onBlur: () => {
562
+ setActiveRow(null);
563
+ setActivePill(null);
564
+ },
565
+ className: clsx("lng1771-pill-manager__rows", props.className),
566
+ "data-rows-root": "true",
567
+ "data-active-row": activePill,
568
+ "data-active-pill": activeRow,
569
+ ref
570
+ }
571
+ );
572
+ }
573
+ );
574
+ const PillManagerExpander = forwardRef(
575
+ function PillManagerExpander2({ children, ...props }, ref) {
576
+ const { expanded, setExpanded, pillSource } = usePillRow();
577
+ return /* @__PURE__ */ jsxs(
578
+ "button",
579
+ {
580
+ ...props,
581
+ className: clsx("lng1771-pill-manager__expander"),
582
+ ref,
583
+ tabIndex: -1,
584
+ "data-pill-expander-source": pillSource,
585
+ onClick: () => {
586
+ setExpanded((prev) => !prev);
587
+ },
588
+ children: [
589
+ !children && (expanded ? /* @__PURE__ */ jsx(CollapseIcon, {}) : /* @__PURE__ */ jsx(ExpandIcon, {})),
590
+ children
591
+ ]
592
+ }
593
+ );
594
+ }
595
+ );
596
+ const PillManagerSeparator = forwardRef(
597
+ function PillManagerSeparator2(props, ref) {
598
+ return /* @__PURE__ */ jsx(
599
+ "div",
600
+ {
601
+ ...props,
602
+ className: clsx("lng1771-pill-manager__separator", props.className),
603
+ ref
604
+ }
605
+ );
606
+ }
607
+ );
608
+ function PillManagerDragPlaceholder(props) {
609
+ const store = useDragStore();
610
+ const s = useDrag(store, (s2) => s2.active);
611
+ if (!s) return null;
612
+ const c = props.children ?? DefaultPlaceholder;
613
+ return createPortal(
614
+ /* @__PURE__ */ jsx(
615
+ "div",
616
+ {
617
+ className: "lng1771-pill-manager__drag-placeholder",
618
+ style: { transform: `translate3d(${s.x}px, ${s.y}px, 0px)` },
619
+ children: c(s)
620
+ }
621
+ ),
622
+ document.body
623
+ );
624
+ }
625
+ function DefaultPlaceholder(p) {
626
+ return /* @__PURE__ */ jsxs("div", { className: "lng1771-pill-manager__drag-placeholder--default", children: [
627
+ /* @__PURE__ */ jsx(
628
+ "svg",
629
+ {
630
+ xmlns: "http://www.w3.org/2000/svg",
631
+ width: "20px",
632
+ height: "20px",
633
+ fill: "currentcolor",
634
+ viewBox: "0 0 256 256",
635
+ children: /* @__PURE__ */ jsx("path", { d: "M90.34,61.66a8,8,0,0,1,0-11.32l32-32a8,8,0,0,1,11.32,0l32,32a8,8,0,0,1-11.32,11.32L136,43.31V96a8,8,0,0,1-16,0V43.31L101.66,61.66A8,8,0,0,1,90.34,61.66Zm64,132.68L136,212.69V160a8,8,0,0,0-16,0v52.69l-18.34-18.35a8,8,0,0,0-11.32,11.32l32,32a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0-11.32-11.32Zm83.32-72-32-32a8,8,0,0,0-11.32,11.32L212.69,120H160a8,8,0,0,0,0,16h52.69l-18.35,18.34a8,8,0,0,0,11.32,11.32l32-32A8,8,0,0,0,237.66,122.34ZM43.31,136H96a8,8,0,0,0,0-16H43.31l18.35-18.34A8,8,0,0,0,50.34,90.34l-32,32a8,8,0,0,0,0,11.32l32,32a8,8,0,0,0,11.32-11.32Z" })
636
+ }
637
+ ),
638
+ /* @__PURE__ */ jsx("span", { children: p.id })
639
+ ] });
640
+ }
641
+ const context = createContext({});
642
+ const useComponents = () => useContext(context);
643
+ const Root = forwardRef(function Root2({ grid, children, aggMenuRenderer, measureMenuRenderer, menuTriggerIcon, ...props }, ref) {
644
+ const components = useMemo(() => {
645
+ return {
646
+ aggMenuRenderer: aggMenuRenderer ?? PillManagerAggMenu,
647
+ measureMenuRenderer: measureMenuRenderer ?? PillManagerMeasureMenu,
648
+ menuTriggerIcon: menuTriggerIcon ?? MoreDotsIcon
649
+ };
650
+ }, [aggMenuRenderer, measureMenuRenderer, menuTriggerIcon]);
651
+ return /* @__PURE__ */ jsx(context.Provider, { value: components, children: /* @__PURE__ */ jsx(DragProvider, { children: /* @__PURE__ */ jsx(GridProvider, { value: grid, children: /* @__PURE__ */ jsx(PillManagerControlsProvider, { children: /* @__PURE__ */ jsx(RootImpl, { ...props, ref, children }) }) }) }) });
652
+ });
653
+ const RootImpl = forwardRef(function RootImpl2({ children, ...props }, ref) {
654
+ return /* @__PURE__ */ jsx("div", { ...props, className: clsx("lng1771-pill-manager", props.className), ref, children });
655
+ });
656
+ const PillManager = {
657
+ Root,
658
+ Rows: PillManagerRows,
659
+ Row: PillManagerRow,
660
+ RowLabel: PillManagerRowLabel,
661
+ RowLabelColumns: PillManagerColumnsLabel,
662
+ RowLabelMeasures: PillManagerMeasureLabel,
663
+ RowLabelAggregations: PillManagerAggLabel,
664
+ RowLabelColumnPivots: PillManagerColumnPivotsLabel,
665
+ RowLabelRowGroups: PillManagerRowGroupsLabel,
666
+ Separator: PillManagerSeparator,
667
+ Expander: PillManagerExpander,
668
+ Pills: PillManagerPills,
669
+ Pill: PillManagerPill,
670
+ DragPlaceholder: PillManagerDragPlaceholder
671
+ };
672
+ export {
673
+ PillManager
674
+ };
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ function PlusIcon(props) {
3
+ return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx(
4
+ "path",
5
+ {
6
+ d: "M8 2.75C8 2.47386 7.77614 2.25 7.5 2.25C7.22386 2.25 7 2.47386 7 2.75V7H2.75C2.47386 7 2.25 7.22386 2.25 7.5C2.25 7.77614 2.47386 8 2.75 8H7V12.25C7 12.5261 7.22386 12.75 7.5 12.75C7.77614 12.75 8 12.5261 8 12.25V8H12.25C12.5261 8 12.75 7.77614 12.75 7.5C12.75 7.22386 12.5261 7 12.25 7H8V2.75Z",
7
+ fill: "currentColor",
8
+ fillRule: "evenodd",
9
+ clipRule: "evenodd"
10
+ }
11
+ ) });
12
+ }
13
+ export {
14
+ PlusIcon as P
15
+ };