@siyahi/ui 0.0.0-stage → 0.1.0-next.3

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 (192) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +174 -2
  3. package/THIRD_PARTY_NOTICES.md +51 -0
  4. package/dist/components/registry/dashboard-01/section-cards.d.ts +17 -0
  5. package/dist/components/registry/dashboard-01/section-cards.js +39 -0
  6. package/dist/components/registry/dashboardcn/bar-list.d.ts +24 -0
  7. package/dist/components/registry/dashboardcn/bar-list.js +71 -0
  8. package/dist/components/registry/heatmap/calendar-heatmap.d.ts +134 -0
  9. package/dist/components/registry/heatmap/calendar-heatmap.js +497 -0
  10. package/dist/components/registry/heatmap/status-heatmap.d.ts +120 -0
  11. package/dist/components/registry/heatmap/status-heatmap.js +330 -0
  12. package/dist/components/registry/heatmap/weekday-heatmap.d.ts +145 -0
  13. package/dist/components/registry/heatmap/weekday-heatmap.js +489 -0
  14. package/dist/components/registry/niko-table/components/data-table-column-actions.d.ts +26 -0
  15. package/dist/components/registry/niko-table/components/data-table-column-actions.js +32 -0
  16. package/dist/components/registry/niko-table/components/data-table-column-filter.d.ts +13 -0
  17. package/dist/components/registry/niko-table/components/data-table-column-filter.js +17 -0
  18. package/dist/components/registry/niko-table/components/data-table-column-header.d.ts +30 -0
  19. package/dist/components/registry/niko-table/components/data-table-column-header.js +35 -0
  20. package/dist/components/registry/niko-table/components/data-table-column-sort.d.ts +21 -0
  21. package/dist/components/registry/niko-table/components/data-table-column-sort.js +36 -0
  22. package/dist/components/registry/niko-table/components/data-table-column-title.d.ts +12 -0
  23. package/dist/components/registry/niko-table/components/data-table-column-title.js +18 -0
  24. package/dist/components/registry/niko-table/components/data-table-empty-state.d.ts +108 -0
  25. package/dist/components/registry/niko-table/components/data-table-empty-state.js +148 -0
  26. package/dist/components/registry/niko-table/components/data-table-faceted-filter.d.ts +46 -0
  27. package/dist/components/registry/niko-table/components/data-table-faceted-filter.js +133 -0
  28. package/dist/components/registry/niko-table/components/data-table-grouped-rows.d.ts +111 -0
  29. package/dist/components/registry/niko-table/components/data-table-grouped-rows.js +77 -0
  30. package/dist/components/registry/niko-table/components/data-table-row-context-menu-slot.d.ts +65 -0
  31. package/dist/components/registry/niko-table/components/data-table-row-context-menu-slot.js +65 -0
  32. package/dist/components/registry/niko-table/components/data-table-row-context-menu.d.ts +50 -0
  33. package/dist/components/registry/niko-table/components/data-table-row-context-menu.js +42 -0
  34. package/dist/components/registry/niko-table/components/data-table-row-menu.d.ts +51 -0
  35. package/dist/components/registry/niko-table/components/data-table-row-menu.js +65 -0
  36. package/dist/components/registry/niko-table/components/data-table-toolbar-section.d.ts +7 -0
  37. package/dist/components/registry/niko-table/components/data-table-toolbar-section.js +63 -0
  38. package/dist/components/registry/niko-table/config/data-table.d.ts +156 -0
  39. package/dist/components/registry/niko-table/config/data-table.js +279 -0
  40. package/dist/components/registry/niko-table/config/feature-detection.d.ts +39 -0
  41. package/dist/components/registry/niko-table/config/feature-detection.js +174 -0
  42. package/dist/components/registry/niko-table/core/data-table-context.d.ts +157 -0
  43. package/dist/components/registry/niko-table/core/data-table-context.js +326 -0
  44. package/dist/components/registry/niko-table/core/data-table-error-boundary.d.ts +85 -0
  45. package/dist/components/registry/niko-table/core/data-table-error-boundary.js +116 -0
  46. package/dist/components/registry/niko-table/core/data-table-grouped-row.d.ts +49 -0
  47. package/dist/components/registry/niko-table/core/data-table-grouped-row.js +112 -0
  48. package/dist/components/registry/niko-table/core/data-table-root.d.ts +62 -0
  49. package/dist/components/registry/niko-table/core/data-table-root.js +406 -0
  50. package/dist/components/registry/niko-table/core/data-table-structure.d.ts +153 -0
  51. package/dist/components/registry/niko-table/core/data-table-structure.js +370 -0
  52. package/dist/components/registry/niko-table/core/data-table.d.ts +30 -0
  53. package/dist/components/registry/niko-table/core/data-table.js +126 -0
  54. package/dist/components/registry/niko-table/filters/table-column-actions.d.ts +49 -0
  55. package/dist/components/registry/niko-table/filters/table-column-actions.js +48 -0
  56. package/dist/components/registry/niko-table/filters/table-column-sort.d.ts +51 -0
  57. package/dist/components/registry/niko-table/filters/table-column-sort.js +184 -0
  58. package/dist/components/registry/niko-table/filters/table-column-title.d.ts +17 -0
  59. package/dist/components/registry/niko-table/filters/table-column-title.js +20 -0
  60. package/dist/components/registry/niko-table/filters/table-faceted-filter.d.ts +40 -0
  61. package/dist/components/registry/niko-table/filters/table-faceted-filter.js +210 -0
  62. package/dist/components/registry/niko-table/hooks/use-derived-column-title.d.ts +29 -0
  63. package/dist/components/registry/niko-table/hooks/use-derived-column-title.js +40 -0
  64. package/dist/components/registry/niko-table/hooks/use-generated-options.d.ts +49 -0
  65. package/dist/components/registry/niko-table/hooks/use-generated-options.js +144 -0
  66. package/dist/components/registry/niko-table/lib/build-faceted-options.d.ts +59 -0
  67. package/dist/components/registry/niko-table/lib/build-faceted-options.js +82 -0
  68. package/dist/components/registry/niko-table/lib/column-resize-handle.d.ts +33 -0
  69. package/dist/components/registry/niko-table/lib/column-resize-handle.js +175 -0
  70. package/dist/components/registry/niko-table/lib/constants.d.ts +128 -0
  71. package/dist/components/registry/niko-table/lib/constants.js +123 -0
  72. package/dist/components/registry/niko-table/lib/create-scroll-handler.d.ts +35 -0
  73. package/dist/components/registry/niko-table/lib/create-scroll-handler.js +63 -0
  74. package/dist/components/registry/niko-table/lib/data-table-features.d.ts +218 -0
  75. package/dist/components/registry/niko-table/lib/data-table-features.js +127 -0
  76. package/dist/components/registry/niko-table/lib/filter-functions.d.ts +47 -0
  77. package/dist/components/registry/niko-table/lib/filter-functions.js +309 -0
  78. package/dist/components/registry/niko-table/lib/filter-rows.d.ts +14 -0
  79. package/dist/components/registry/niko-table/lib/filter-rows.js +28 -0
  80. package/dist/components/registry/niko-table/lib/flex-columns.d.ts +48 -0
  81. package/dist/components/registry/niko-table/lib/flex-columns.js +65 -0
  82. package/dist/components/registry/niko-table/lib/format.d.ts +33 -0
  83. package/dist/components/registry/niko-table/lib/format.js +99 -0
  84. package/dist/components/registry/niko-table/lib/render-cell-content.d.ts +17 -0
  85. package/dist/components/registry/niko-table/lib/render-cell-content.js +65 -0
  86. package/dist/components/registry/niko-table/lib/row-click.d.ts +67 -0
  87. package/dist/components/registry/niko-table/lib/row-click.js +28 -0
  88. package/dist/components/registry/niko-table/lib/styles.d.ts +6 -0
  89. package/dist/components/registry/niko-table/lib/styles.js +24 -0
  90. package/dist/components/registry/niko-table/lib/use-header-min-widths.d.ts +17 -0
  91. package/dist/components/registry/niko-table/lib/use-header-min-widths.js +82 -0
  92. package/dist/components/registry/niko-table/types/index.d.ts +141 -0
  93. package/dist/components/registry/niko-table/types/index.js +2 -0
  94. package/dist/components/registry/niko-table/ui/table.d.ts +13 -0
  95. package/dist/components/registry/niko-table/ui/table.js +74 -0
  96. package/dist/components/registry/sidebar-07/app-sidebar.d.ts +18 -0
  97. package/dist/components/registry/sidebar-07/app-sidebar.js +26 -0
  98. package/dist/components/registry/sidebar-07/nav-main.d.ts +15 -0
  99. package/dist/components/registry/sidebar-07/nav-main.js +25 -0
  100. package/dist/components/registry/sidebar-07/nav-projects.d.ts +9 -0
  101. package/dist/components/registry/sidebar-07/nav-projects.js +43 -0
  102. package/dist/components/registry/sidebar-07/nav-user.d.ts +9 -0
  103. package/dist/components/registry/sidebar-07/nav-user.js +70 -0
  104. package/dist/components/registry/sidebar-07/team-switcher.d.ts +10 -0
  105. package/dist/components/registry/sidebar-07/team-switcher.js +70 -0
  106. package/dist/components/siyahi/delta.d.ts +10 -0
  107. package/dist/components/siyahi/delta.js +27 -0
  108. package/dist/components/siyahi/local-time.d.ts +7 -0
  109. package/dist/components/siyahi/local-time.js +22 -0
  110. package/dist/components/siyahi/price-chart.d.ts +12 -0
  111. package/dist/components/siyahi/price-chart.js +80 -0
  112. package/dist/components/siyahi/siyahi-provider.d.ts +12 -0
  113. package/dist/components/siyahi/siyahi-provider.js +31 -0
  114. package/dist/components/siyahi/treemap.d.ts +14 -0
  115. package/dist/components/siyahi/treemap.js +58 -0
  116. package/dist/components/ui/alert.d.ts +12 -0
  117. package/dist/components/ui/alert.js +43 -0
  118. package/dist/components/ui/avatar.d.ts +13 -0
  119. package/dist/components/ui/avatar.js +50 -0
  120. package/dist/components/ui/badge.d.ts +9 -0
  121. package/dist/components/ui/badge.js +29 -0
  122. package/dist/components/ui/breadcrumb.d.ts +12 -0
  123. package/dist/components/ui/breadcrumb.js +72 -0
  124. package/dist/components/ui/button.d.ts +10 -0
  125. package/dist/components/ui/button.js +44 -0
  126. package/dist/components/ui/calendar.d.ts +12 -0
  127. package/dist/components/ui/calendar.js +107 -0
  128. package/dist/components/ui/card.d.ts +13 -0
  129. package/dist/components/ui/card.js +56 -0
  130. package/dist/components/ui/chart.d.ts +46 -0
  131. package/dist/components/ui/chart.js +149 -0
  132. package/dist/components/ui/collapsible.d.ts +7 -0
  133. package/dist/components/ui/collapsible.js +24 -0
  134. package/dist/components/ui/command.d.ts +21 -0
  135. package/dist/components/ui/command.js +88 -0
  136. package/dist/components/ui/context-menu.d.ts +31 -0
  137. package/dist/components/ui/context-menu.js +132 -0
  138. package/dist/components/ui/dialog.d.ts +19 -0
  139. package/dist/components/ui/dialog.js +91 -0
  140. package/dist/components/ui/dropdown-menu.d.ts +31 -0
  141. package/dist/components/ui/dropdown-menu.js +136 -0
  142. package/dist/components/ui/input-group.d.ts +20 -0
  143. package/dist/components/ui/input-group.js +79 -0
  144. package/dist/components/ui/input.d.ts +5 -0
  145. package/dist/components/ui/input.js +15 -0
  146. package/dist/components/ui/popover.d.ts +11 -0
  147. package/dist/components/ui/popover.js +55 -0
  148. package/dist/components/ui/progress.d.ts +9 -0
  149. package/dist/components/ui/progress.js +43 -0
  150. package/dist/components/ui/scroll-area.d.ts +7 -0
  151. package/dist/components/ui/scroll-area.js +36 -0
  152. package/dist/components/ui/select.d.ts +17 -0
  153. package/dist/components/ui/select.js +97 -0
  154. package/dist/components/ui/separator.d.ts +5 -0
  155. package/dist/components/ui/separator.js +15 -0
  156. package/dist/components/ui/sheet.d.ts +16 -0
  157. package/dist/components/ui/sheet.js +89 -0
  158. package/dist/components/ui/sidebar.d.ts +65 -0
  159. package/dist/components/ui/sidebar.js +385 -0
  160. package/dist/components/ui/skeleton.d.ts +4 -0
  161. package/dist/components/ui/skeleton.js +12 -0
  162. package/dist/components/ui/slider.d.ts +5 -0
  163. package/dist/components/ui/slider.js +33 -0
  164. package/dist/components/ui/table.d.ts +12 -0
  165. package/dist/components/ui/table.js +66 -0
  166. package/dist/components/ui/tabs.d.ts +12 -0
  167. package/dist/components/ui/tabs.js +45 -0
  168. package/dist/components/ui/textarea.d.ts +5 -0
  169. package/dist/components/ui/textarea.js +13 -0
  170. package/dist/components/ui/toggle-group.d.ts +13 -0
  171. package/dist/components/ui/toggle-group.js +52 -0
  172. package/dist/components/ui/toggle.d.ts +10 -0
  173. package/dist/components/ui/toggle.js +36 -0
  174. package/dist/components/ui/tooltip.d.ts +8 -0
  175. package/dist/components/ui/tooltip.js +41 -0
  176. package/dist/hooks/use-mobile.d.ts +3 -0
  177. package/dist/hooks/use-mobile.js +18 -0
  178. package/dist/index.d.ts +73 -0
  179. package/dist/index.js +71 -0
  180. package/dist/lib/format.d.ts +24 -0
  181. package/dist/lib/format.js +58 -0
  182. package/dist/lib/locale.d.ts +12 -0
  183. package/dist/lib/locale.js +8 -0
  184. package/dist/lib/recharts.d.ts +2 -0
  185. package/dist/lib/recharts.js +1 -0
  186. package/dist/lib/utils.d.ts +2 -0
  187. package/dist/lib/utils.js +1 -0
  188. package/package.json +78 -3
  189. package/registry.lock.json +413 -0
  190. package/report.css +129 -0
  191. package/styles/shadcn.css +643 -0
  192. package/styles/siyahi.css +189 -0
@@ -0,0 +1,279 @@
1
+ import { FILTER_OPERATORS, FILTER_VARIANTS, JOIN_OPERATORS } from "../lib/constants.js";
2
+ import { ArrowDown01, ArrowDown10, ArrowDownAZ, ArrowDownZA, ArrowUpDown, Calendar, Check, X } from "lucide-react";
3
+ //#region src/components/registry/niko-table/config/data-table.ts
4
+ const SORT_ICONS = {
5
+ [FILTER_VARIANTS.TEXT]: {
6
+ asc: ArrowDownAZ,
7
+ desc: ArrowDownZA,
8
+ unsorted: ArrowUpDown
9
+ },
10
+ [FILTER_VARIANTS.NUMBER]: {
11
+ asc: ArrowDown01,
12
+ desc: ArrowDown10,
13
+ unsorted: ArrowUpDown
14
+ },
15
+ [FILTER_VARIANTS.RANGE]: {
16
+ asc: ArrowDown01,
17
+ desc: ArrowDown10,
18
+ unsorted: ArrowUpDown
19
+ },
20
+ [FILTER_VARIANTS.DATE]: {
21
+ asc: ArrowUpDown,
22
+ desc: ArrowUpDown,
23
+ unsorted: Calendar
24
+ },
25
+ [FILTER_VARIANTS.DATE_RANGE]: {
26
+ asc: ArrowUpDown,
27
+ desc: ArrowUpDown,
28
+ unsorted: Calendar
29
+ },
30
+ [FILTER_VARIANTS.BOOLEAN]: {
31
+ asc: X,
32
+ desc: Check,
33
+ unsorted: ArrowUpDown
34
+ },
35
+ [FILTER_VARIANTS.SELECT]: {
36
+ asc: ArrowDownAZ,
37
+ desc: ArrowDownZA,
38
+ unsorted: ArrowUpDown
39
+ },
40
+ [FILTER_VARIANTS.MULTI_SELECT]: {
41
+ asc: ArrowDownAZ,
42
+ desc: ArrowDownZA,
43
+ unsorted: ArrowUpDown
44
+ }
45
+ };
46
+ const SORT_LABELS = {
47
+ [FILTER_VARIANTS.TEXT]: {
48
+ asc: "Asc",
49
+ desc: "Desc"
50
+ },
51
+ [FILTER_VARIANTS.NUMBER]: {
52
+ asc: "Low to High",
53
+ desc: "High to Low"
54
+ },
55
+ [FILTER_VARIANTS.RANGE]: {
56
+ asc: "Low to High",
57
+ desc: "High to Low"
58
+ },
59
+ [FILTER_VARIANTS.DATE]: {
60
+ asc: "Oldest First",
61
+ desc: "Newest First"
62
+ },
63
+ [FILTER_VARIANTS.DATE_RANGE]: {
64
+ asc: "Oldest First",
65
+ desc: "Newest First"
66
+ },
67
+ [FILTER_VARIANTS.BOOLEAN]: {
68
+ asc: "False First",
69
+ desc: "True First"
70
+ },
71
+ [FILTER_VARIANTS.SELECT]: {
72
+ asc: "Asc",
73
+ desc: "Desc"
74
+ },
75
+ [FILTER_VARIANTS.MULTI_SELECT]: {
76
+ asc: "Asc",
77
+ desc: "Desc"
78
+ }
79
+ };
80
+ /**
81
+ * @credit Adapted from React Table's default config
82
+ * @see https://react-table.tanstack.com/docs/overview
83
+ */
84
+ const dataTableConfig = {
85
+ debounceMs: 300,
86
+ throttleMs: 50,
87
+ textOperators: [
88
+ {
89
+ label: "Contains",
90
+ value: FILTER_OPERATORS.ILIKE
91
+ },
92
+ {
93
+ label: "Does not contain",
94
+ value: FILTER_OPERATORS.NOT_ILIKE
95
+ },
96
+ {
97
+ label: "Is",
98
+ value: FILTER_OPERATORS.EQ
99
+ },
100
+ {
101
+ label: "Is not",
102
+ value: FILTER_OPERATORS.NEQ
103
+ },
104
+ {
105
+ label: "Is empty",
106
+ value: FILTER_OPERATORS.EMPTY
107
+ },
108
+ {
109
+ label: "Is not empty",
110
+ value: FILTER_OPERATORS.NOT_EMPTY
111
+ }
112
+ ],
113
+ numericOperators: [
114
+ {
115
+ label: "Is",
116
+ value: FILTER_OPERATORS.EQ
117
+ },
118
+ {
119
+ label: "Is not",
120
+ value: FILTER_OPERATORS.NEQ
121
+ },
122
+ {
123
+ label: "Is less than",
124
+ value: FILTER_OPERATORS.LT
125
+ },
126
+ {
127
+ label: "Is less than or equal to",
128
+ value: FILTER_OPERATORS.LTE
129
+ },
130
+ {
131
+ label: "Is greater than",
132
+ value: FILTER_OPERATORS.GT
133
+ },
134
+ {
135
+ label: "Is greater than or equal to",
136
+ value: FILTER_OPERATORS.GTE
137
+ },
138
+ {
139
+ label: "Is between",
140
+ value: FILTER_OPERATORS.BETWEEN
141
+ },
142
+ {
143
+ label: "Is empty",
144
+ value: FILTER_OPERATORS.EMPTY
145
+ },
146
+ {
147
+ label: "Is not empty",
148
+ value: FILTER_OPERATORS.NOT_EMPTY
149
+ }
150
+ ],
151
+ dateOperators: [
152
+ {
153
+ label: "Is",
154
+ value: FILTER_OPERATORS.EQ
155
+ },
156
+ {
157
+ label: "Is not",
158
+ value: FILTER_OPERATORS.NEQ
159
+ },
160
+ {
161
+ label: "Is before",
162
+ value: FILTER_OPERATORS.LT
163
+ },
164
+ {
165
+ label: "Is after",
166
+ value: FILTER_OPERATORS.GT
167
+ },
168
+ {
169
+ label: "Is on or before",
170
+ value: FILTER_OPERATORS.LTE
171
+ },
172
+ {
173
+ label: "Is on or after",
174
+ value: FILTER_OPERATORS.GTE
175
+ },
176
+ {
177
+ label: "Is between",
178
+ value: FILTER_OPERATORS.BETWEEN
179
+ },
180
+ {
181
+ label: "Is empty",
182
+ value: FILTER_OPERATORS.EMPTY
183
+ },
184
+ {
185
+ label: "Is not empty",
186
+ value: FILTER_OPERATORS.NOT_EMPTY
187
+ }
188
+ ],
189
+ selectOperators: [
190
+ {
191
+ label: "Is",
192
+ value: FILTER_OPERATORS.EQ
193
+ },
194
+ {
195
+ label: "Is not",
196
+ value: FILTER_OPERATORS.NEQ
197
+ },
198
+ {
199
+ label: "Is empty",
200
+ value: FILTER_OPERATORS.EMPTY
201
+ },
202
+ {
203
+ label: "Is not empty",
204
+ value: FILTER_OPERATORS.NOT_EMPTY
205
+ }
206
+ ],
207
+ multiSelectOperators: [
208
+ {
209
+ label: "Has any of",
210
+ value: FILTER_OPERATORS.IN
211
+ },
212
+ {
213
+ label: "Has none of",
214
+ value: FILTER_OPERATORS.NOT_IN
215
+ },
216
+ {
217
+ label: "Is empty",
218
+ value: FILTER_OPERATORS.EMPTY
219
+ },
220
+ {
221
+ label: "Is not empty",
222
+ value: FILTER_OPERATORS.NOT_EMPTY
223
+ }
224
+ ],
225
+ booleanOperators: [{
226
+ label: "Is",
227
+ value: FILTER_OPERATORS.EQ
228
+ }, {
229
+ label: "Is not",
230
+ value: FILTER_OPERATORS.NEQ
231
+ }],
232
+ /**
233
+ * Choices for a boolean filter's value select. Also handed to the select as
234
+ * `items`, where Base UI reads the closed trigger's label from.
235
+ */
236
+ booleanValues: [{
237
+ label: "True",
238
+ value: "true"
239
+ }, {
240
+ label: "False",
241
+ value: "false"
242
+ }],
243
+ sortOrders: [{
244
+ label: "Asc",
245
+ value: "asc"
246
+ }, {
247
+ label: "Desc",
248
+ value: "desc"
249
+ }],
250
+ filterVariants: [
251
+ FILTER_VARIANTS.TEXT,
252
+ FILTER_VARIANTS.NUMBER,
253
+ FILTER_VARIANTS.RANGE,
254
+ FILTER_VARIANTS.DATE,
255
+ FILTER_VARIANTS.DATE_RANGE,
256
+ FILTER_VARIANTS.BOOLEAN,
257
+ FILTER_VARIANTS.SELECT,
258
+ FILTER_VARIANTS.MULTI_SELECT
259
+ ],
260
+ operators: [
261
+ FILTER_OPERATORS.ILIKE,
262
+ FILTER_OPERATORS.NOT_ILIKE,
263
+ FILTER_OPERATORS.EQ,
264
+ FILTER_OPERATORS.NEQ,
265
+ FILTER_OPERATORS.IN,
266
+ FILTER_OPERATORS.NOT_IN,
267
+ FILTER_OPERATORS.EMPTY,
268
+ FILTER_OPERATORS.NOT_EMPTY,
269
+ FILTER_OPERATORS.LT,
270
+ FILTER_OPERATORS.LTE,
271
+ FILTER_OPERATORS.GT,
272
+ FILTER_OPERATORS.GTE,
273
+ FILTER_OPERATORS.BETWEEN,
274
+ FILTER_OPERATORS.RELATIVE
275
+ ],
276
+ joinOperators: [JOIN_OPERATORS.AND, JOIN_OPERATORS.OR]
277
+ };
278
+ //#endregion
279
+ export { SORT_ICONS, SORT_LABELS, dataTableConfig };
@@ -0,0 +1,39 @@
1
+ import { ReactNode } from "react";
2
+ //#region src/components/registry/niko-table/config/feature-detection.d.ts
3
+ /**
4
+ * Feature requirements that components can declare
5
+ */
6
+ export interface FeatureRequirements {
7
+ enableFilters?: boolean;
8
+ enablePagination?: boolean;
9
+ enableRowSelection?: boolean;
10
+ enableSorting?: boolean;
11
+ enableMultiSort?: boolean;
12
+ enableGrouping?: boolean;
13
+ enableExpanding?: boolean;
14
+ enableColumnResizing?: boolean;
15
+ manualSorting?: boolean;
16
+ manualPagination?: boolean;
17
+ manualFiltering?: boolean;
18
+ pageCount?: number;
19
+ }
20
+ /**
21
+ * Walks the React tree to aggregate feature requirements declared by child
22
+ * components (via displayName) and column header functions.
23
+ */
24
+ export declare function detectFeaturesFromChildren(children: ReactNode, columns?: Array<{
25
+ header?: unknown;
26
+ enableColumnFilter?: boolean;
27
+ }>): FeatureRequirements;
28
+ /**
29
+ * Register a component's feature requirements
30
+ * This allows third-party components to declare their needs
31
+ */
32
+ export declare function registerComponentFeatures(displayName: string, features: FeatureRequirements): void;
33
+ /**
34
+ * Get all registered components and their features (for debugging)
35
+ */
36
+ export declare function getRegisteredComponents(): {
37
+ [x: string]: FeatureRequirements;
38
+ };
39
+ //#endregion
@@ -0,0 +1,174 @@
1
+ import { Children, isValidElement } from "react";
2
+ //#region src/components/registry/niko-table/config/feature-detection.ts
3
+ const detectionCache = typeof window !== "undefined" ? /* @__PURE__ */ new Map() : null;
4
+ const MAX_CACHE_SIZE = 50;
5
+ /**
6
+ * Component feature registry - maps component displayNames to their requirements
7
+ */
8
+ const COMPONENT_FEATURES = {
9
+ DataTablePagination: { enablePagination: true },
10
+ TablePagination: { enablePagination: true },
11
+ DataTableViewMenu: { enableFilters: true },
12
+ TableViewMenu: { enableFilters: true },
13
+ DataTableViewDndMenu: { enableFilters: true },
14
+ TableViewDndMenu: { enableFilters: true },
15
+ DataTableColumnResize: { enableColumnResizing: true },
16
+ DataTableSearchFilter: { enableFilters: true },
17
+ TableSearchFilter: { enableFilters: true },
18
+ DataTableFacetedFilter: { enableFilters: true },
19
+ TableFacetedFilter: { enableFilters: true },
20
+ DataTableSliderFilter: { enableFilters: true },
21
+ TableSliderFilter: { enableFilters: true },
22
+ DataTableSortMenu: { enableSorting: true },
23
+ TableSortMenu: { enableSorting: true },
24
+ DataTableFilterMenu: { enableFilters: true },
25
+ TableFilterMenu: { enableFilters: true },
26
+ DataTableDateFilter: { enableFilters: true },
27
+ DataTableInlineFilter: { enableFilters: true },
28
+ TableInlineFilter: { enableFilters: true },
29
+ DataTableClearFilter: { enableFilters: true },
30
+ TableClearFilter: { enableFilters: true },
31
+ DataTableColumnFacetedFilterMenu: { enableFilters: true },
32
+ TableColumnFacetedFilterMenu: { enableFilters: true },
33
+ DataTableColumnFacetedFilterOptions: { enableFilters: true },
34
+ TableColumnFacetedFilterOptions: { enableFilters: true },
35
+ DataTableColumnSliderFilterMenu: { enableFilters: true },
36
+ TableColumnSliderFilterMenu: { enableFilters: true },
37
+ DataTableColumnSliderFilterOptions: { enableFilters: true },
38
+ TableColumnSliderFilterOptions: { enableFilters: true },
39
+ DataTableColumnDateFilterMenu: { enableFilters: true },
40
+ TableColumnDateFilterMenu: { enableFilters: true },
41
+ DataTableColumnDateFilterOptions: { enableFilters: true },
42
+ TableColumnDateFilterOptions: { enableFilters: true },
43
+ DataTableSelectionBar: { enableRowSelection: true },
44
+ DataTableColumnHeader: { enableSorting: true },
45
+ TableColumnHeader: { enableSorting: true },
46
+ TableColumnSortMenu: {
47
+ enableSorting: true,
48
+ enableMultiSort: true
49
+ },
50
+ DataTableColumnSortMenu: {
51
+ enableSorting: true,
52
+ enableMultiSort: true
53
+ },
54
+ TableColumnSortOptions: {
55
+ enableSorting: true,
56
+ enableMultiSort: true
57
+ },
58
+ DataTableColumnSortOptions: {
59
+ enableSorting: true,
60
+ enableMultiSort: true
61
+ },
62
+ DataTableGroupedRows: {
63
+ enableGrouping: true,
64
+ enableExpanding: true
65
+ },
66
+ TableGroupedRows: {
67
+ enableGrouping: true,
68
+ enableExpanding: true
69
+ },
70
+ TableColumnGroupOptions: {
71
+ enableGrouping: true,
72
+ enableExpanding: true
73
+ },
74
+ DataTableColumnGroupOptions: {
75
+ enableGrouping: true,
76
+ enableExpanding: true
77
+ },
78
+ TableColumnGroupMenu: {
79
+ enableGrouping: true,
80
+ enableExpanding: true
81
+ },
82
+ DataTableColumnGroupMenu: {
83
+ enableGrouping: true,
84
+ enableExpanding: true
85
+ }
86
+ };
87
+ /**
88
+ * Walks the React tree to aggregate feature requirements declared by child
89
+ * components (via displayName) and column header functions.
90
+ */
91
+ function detectFeaturesFromChildren(children, columns) {
92
+ const shouldCache = detectionCache && !columns && children && typeof children === "object";
93
+ if (shouldCache) {
94
+ const cached = detectionCache.get(children);
95
+ if (cached) return cached;
96
+ }
97
+ const requirements = {};
98
+ const searchRecursively = (children) => {
99
+ const childrenArray = Children.toArray(children);
100
+ for (const child of childrenArray) if (isValidElement(child)) {
101
+ if (typeof child.type === "function") {
102
+ const displayName = child.type.displayName;
103
+ const componentFeatures = displayName ? COMPONENT_FEATURES[displayName] : void 0;
104
+ if (componentFeatures) Object.keys(componentFeatures).forEach((key) => {
105
+ const featureKey = key;
106
+ if (componentFeatures[featureKey]) requirements[featureKey] = true;
107
+ });
108
+ }
109
+ const propsWithChildren = child.props;
110
+ if (propsWithChildren?.children) searchRecursively(propsWithChildren.children);
111
+ }
112
+ };
113
+ if (columns && Array.isArray(columns)) for (const column of columns) {
114
+ if (column.enableColumnFilter) requirements.enableFilters = true;
115
+ if (column.header && typeof column.header === "function") try {
116
+ const headerFn = column.header;
117
+ const headerResult = headerFn({ column: {
118
+ getCanSort: () => true,
119
+ getIsSorted: () => false,
120
+ toggleSorting: () => {},
121
+ clearSorting: () => {},
122
+ getCanHide: () => true,
123
+ getIsVisible: () => true,
124
+ toggleVisibility: () => {},
125
+ getCanPin: () => true,
126
+ getIsPinned: () => false,
127
+ pin: () => {},
128
+ getCanGroup: () => true,
129
+ getIsGrouped: () => false,
130
+ toggleGrouping: () => {},
131
+ columnDef: { meta: {} },
132
+ id: "mock"
133
+ } });
134
+ const checkElementForFeatures = (element) => {
135
+ if (!isValidElement(element)) return;
136
+ if (typeof element.type === "function") {
137
+ const displayName = element.type.displayName;
138
+ const componentFeatures = displayName ? COMPONENT_FEATURES[displayName] : void 0;
139
+ if (componentFeatures) Object.keys(componentFeatures).forEach((key) => {
140
+ const featureKey = key;
141
+ if (componentFeatures[featureKey]) requirements[featureKey] = true;
142
+ });
143
+ }
144
+ const propsWithChildren = element.props;
145
+ if (propsWithChildren?.children) Children.toArray(propsWithChildren.children).forEach(checkElementForFeatures);
146
+ };
147
+ checkElementForFeatures(headerResult);
148
+ } catch {}
149
+ }
150
+ searchRecursively(children);
151
+ if (shouldCache && detectionCache) {
152
+ if (detectionCache.size >= MAX_CACHE_SIZE) {
153
+ const firstKey = detectionCache.keys().next().value;
154
+ if (firstKey !== void 0) detectionCache.delete(firstKey);
155
+ }
156
+ detectionCache.set(children, requirements);
157
+ }
158
+ return requirements;
159
+ }
160
+ /**
161
+ * Register a component's feature requirements
162
+ * This allows third-party components to declare their needs
163
+ */
164
+ function registerComponentFeatures(displayName, features) {
165
+ COMPONENT_FEATURES[displayName] = features;
166
+ }
167
+ /**
168
+ * Get all registered components and their features (for debugging)
169
+ */
170
+ function getRegisteredComponents() {
171
+ return { ...COMPONENT_FEATURES };
172
+ }
173
+ //#endregion
174
+ export { detectFeaturesFromChildren, getRegisteredComponents, registerComponentFeatures };
@@ -0,0 +1,157 @@
1
+ import { DataTableColumnDef, DataTableInstance, Option } from "../types/index.js";
2
+ import React from "react";
3
+ import { RowData } from "@tanstack/react-table";
4
+ //#region src/components/registry/niko-table/core/data-table-context.d.ts
5
+ export type DataTableContextState = {
6
+ isLoading: boolean;
7
+ };
8
+ /** Alignment for `scrollRowIntoView`, mirroring TanStack Virtual's `align`. */
9
+ export type ScrollAlign = "auto" | "start" | "center" | "end";
10
+ /** Scroll a row into view by its position in the current row model. */
11
+ export type ScrollRowIntoView = (index: number, opts?: {
12
+ align?: ScrollAlign;
13
+ }) => void;
14
+ /**
15
+ * The active-selection SPAN for a grid-style cross-highlight — EVERY column
16
+ * and row in the current selection lights up (header + gutter), not just the
17
+ * focused cell. Grid-agnostic: the editable grid sets it from its selection
18
+ * rectangle. `null` disables the highlight (the default for read-only tables).
19
+ *
20
+ * Columns are addressed by id (there are few and all render, so a Set is
21
+ * cheap); rows by an inclusive row-model index range (rows are virtualized, so
22
+ * a Set of ids would be unbounded for a large selection — the body tests each
23
+ * visible row's `index` against the range in O(1)).
24
+ */
25
+ export interface ActiveSelection {
26
+ /** Ids of columns whose header should highlight. */
27
+ columnIds: ReadonlySet<string>;
28
+ /** Inclusive row-model index range whose rows/gutter should highlight. */
29
+ rowRange: {
30
+ min: number;
31
+ max: number;
32
+ };
33
+ }
34
+ export type ActiveCell = ActiveSelection | null;
35
+ export interface FlashRowsOptions {
36
+ /** How long the highlight lasts, ms. Default 1400. */
37
+ durationMs?: number;
38
+ /** Scroll the first flashed row into view first. Default true. */
39
+ scrollIntoView?: boolean;
40
+ }
41
+ /**
42
+ * Briefly highlight rows (by id) so users see what just changed — e.g. after a
43
+ * mutation ("which row did adding a member update?"). Scrolls the row into view
44
+ * (reusing the virtualizer bridge) then plays a soft fade pulse. A row flash
45
+ * lights every cell in the row (works even under pinned columns).
46
+ */
47
+ export type FlashRows = (ids: string[], opts?: FlashRowsOptions) => void;
48
+ /** A single cell target for `flashCells`. */
49
+ export interface FlashCellRef {
50
+ rowId: string;
51
+ columnId: string;
52
+ }
53
+ /**
54
+ * Briefly highlight individual cells (cell-level, for value-level changes —
55
+ * e.g. an inline edit or paste). Same fade pulse as `flashRows`, scoped to cells.
56
+ */
57
+ export type FlashCells = (cells: FlashCellRef[], opts?: FlashRowsOptions) => void;
58
+ /** Internal key for a flashing cell (row id + column id). */
59
+ export declare function flashCellKey(rowId: string, columnId: string): string;
60
+ type DataTableContextProps<TData extends RowData> = DataTableContextState & {
61
+ table: DataTableInstance<TData>;
62
+ columns: DataTableColumnDef<TData>[];
63
+ generatedOptionsMap: Record<string, Option[]>;
64
+ setIsLoading: (isLoading: boolean) => void;
65
+ /** Ids of rows currently flashing (used by the body to animate them). */
66
+ flashingRowIds: ReadonlySet<string>;
67
+ /** Keys (`flashCellKey`) of cells currently flashing. */
68
+ flashingCellKeys: ReadonlySet<string>;
69
+ /** Flash rows by id — scroll into view + soft fade pulse. */
70
+ flashRows: FlashRows;
71
+ /** Flash individual cells (value-level changes). */
72
+ flashCells: FlashCells;
73
+ /**
74
+ * Scroll a row into view. Works on virtualized bodies (via the virtualizer,
75
+ * which registers itself) and plain bodies (DOM `scrollIntoView` fallback).
76
+ * A stable, virtualizer-agnostic handle so consumers never touch the
77
+ * virtualizer directly — the registry owner can change virtualization
78
+ * internals without breaking consumers.
79
+ */
80
+ scrollRowIntoView: ScrollRowIntoView;
81
+ /**
82
+ * Internal: the virtualized body registers its scroll function here on mount
83
+ * and clears it (null) on unmount. Non-virtualized bodies never register, so
84
+ * `scrollRowIntoView` falls back to a DOM query.
85
+ */
86
+ registerRowScroller: (fn: ScrollRowIntoView | null) => void;
87
+ /**
88
+ * The table's scroll container (`<DataTable>`'s `[data-slot="table-container"]`
89
+ * viewport). `<DataTable>` registers it on mount; opt-in features like
90
+ * `<DataTableColumnAutoFit />` read it to measure/observe available width.
91
+ * `null` until the container mounts (or when no `<DataTable>` is used).
92
+ */
93
+ scrollContainer: HTMLElement | null;
94
+ /** Internal: `<DataTable>` registers its scroll container element here. */
95
+ registerScrollContainer: (el: HTMLElement | null) => void;
96
+ /**
97
+ * Header-fit floors: `columnId -> minimum width` so an un-resized column is
98
+ * never rendered narrower than its own header label (measured, never written
99
+ * to `columnSizing`). Empty when resizing is off. Read by the header, body,
100
+ * and the min-width lock so they agree on widths.
101
+ */
102
+ headerMinWidths: ReadonlyMap<string, number>;
103
+ /**
104
+ * Drive the resize preview line for a flex-column drag (which resizes outside
105
+ * TanStack). Pass `{ resizingColumnId, deltaOffset }` while dragging and
106
+ * `null` on release. Normal (TanStack) resizes ignore this.
107
+ */
108
+ setColumnResizePreview: (info: ColumnResizeInfo | null) => void;
109
+ /**
110
+ * Toggle a row's selection with standard Shift-range support: a plain
111
+ * click toggles one row and sets the anchor; a Shift+click selects every row
112
+ * between the anchor and this one (in current display order). Wire a select
113
+ * checkbox to this instead of `row.toggleSelected()` to get range selection.
114
+ */
115
+ toggleRowSelection: (rowId: string, shiftKey: boolean) => void;
116
+ };
117
+ /**
118
+ * The active-selection span for the grid-style cross-highlight (`null` when
119
+ * inactive). In a header, `activeCell.columnIds.has(column.id)` lights the
120
+ * active columns; in a body/gutter, the row's **display** index (position in
121
+ * `getRowModel().rows` / the virtualizer index) within `activeCell.rowRange`
122
+ * lights the active rows — not TanStack's source-data `row.index`.
123
+ */
124
+ export declare function useDataTableActiveCell(): ActiveCell;
125
+ /**
126
+ * Set (or clear, with `null`) the active-cell cross-highlight. The setter is
127
+ * stable, so subscribing to it never causes re-renders. Used by the grid's
128
+ * `<DataGridCrossHighlight>` opt-in.
129
+ */
130
+ export declare function useDataTableActiveCellSetter(): (cell: ActiveCell) => void;
131
+ export interface ColumnResizeInfo {
132
+ /** Id of the column being dragged, or `null` when no resize is active. */
133
+ resizingColumnId: string | null;
134
+ /** Pixel delta from the drag start (add to the column's right edge). */
135
+ deltaOffset: number;
136
+ }
137
+ /**
138
+ * Live column-resize offset for the preview guide line. Returns the idle value
139
+ * (`{ resizingColumnId: null, deltaOffset: 0 }`) when no drag is in flight (or
140
+ * outside a provider), so it's safe to call unconditionally.
141
+ */
142
+ export declare function useColumnResizeInfo(): ColumnResizeInfo;
143
+ declare const DataTableContext: React.Context<DataTableContextProps<any> | undefined>;
144
+ export declare function useDataTable<TData extends RowData>(): DataTableContextProps<TData>;
145
+ export declare enum DataTableActions {
146
+ SET = 0,
147
+ SET_IS_LOADING = 1
148
+ }
149
+ interface DataTableProviderProps<TData extends RowData> {
150
+ children: React.ReactNode;
151
+ table: DataTableInstance<TData>;
152
+ columns?: DataTableColumnDef<TData>[];
153
+ isLoading?: boolean;
154
+ }
155
+ export declare function DataTableProvider<TData extends RowData>({ children, table, columns, isLoading: externalIsLoading }: DataTableProviderProps<TData>): React.JSX.Element;
156
+ //#endregion
157
+ export { DataTableContext };