@flexkit/desk 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Flexkit.io
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.css ADDED
@@ -0,0 +1,641 @@
1
+ /*
2
+ ! tailwindcss v3.4.10 | MIT License | https://tailwindcss.com
3
+ */
4
+
5
+ /*
6
+ 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
7
+ 2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
8
+ */
9
+
10
+ *,
11
+ ::before,
12
+ ::after {
13
+ box-sizing: border-box;
14
+ /* 1 */
15
+ border-width: 0;
16
+ /* 2 */
17
+ border-style: solid;
18
+ /* 2 */
19
+ border-color: #e5e7eb;
20
+ /* 2 */
21
+ }
22
+
23
+ ::before,
24
+ ::after {
25
+ --tw-content: '';
26
+ }
27
+
28
+ /*
29
+ 1. Use a consistent sensible line-height in all browsers.
30
+ 2. Prevent adjustments of font size after orientation changes in iOS.
31
+ 3. Use a more readable tab size.
32
+ 4. Use the user's configured `sans` font-family by default.
33
+ 5. Use the user's configured `sans` font-feature-settings by default.
34
+ 6. Use the user's configured `sans` font-variation-settings by default.
35
+ 7. Disable tap highlights on iOS
36
+ */
37
+
38
+ html,
39
+ :host {
40
+ line-height: 1.5;
41
+ /* 1 */
42
+ -webkit-text-size-adjust: 100%;
43
+ /* 2 */
44
+ -moz-tab-size: 4;
45
+ /* 3 */
46
+ -o-tab-size: 4;
47
+ tab-size: 4;
48
+ /* 3 */
49
+ font-family: var(--font-geist-sans), ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
50
+ /* 4 */
51
+ font-feature-settings: normal;
52
+ /* 5 */
53
+ font-variation-settings: normal;
54
+ /* 6 */
55
+ -webkit-tap-highlight-color: transparent;
56
+ /* 7 */
57
+ }
58
+
59
+ /*
60
+ 1. Remove the margin in all browsers.
61
+ 2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
62
+ */
63
+
64
+ body {
65
+ margin: 0;
66
+ /* 1 */
67
+ line-height: inherit;
68
+ /* 2 */
69
+ }
70
+
71
+ /*
72
+ 1. Add the correct height in Firefox.
73
+ 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
74
+ 3. Ensure horizontal rules are visible by default.
75
+ */
76
+
77
+ hr {
78
+ height: 0;
79
+ /* 1 */
80
+ color: inherit;
81
+ /* 2 */
82
+ border-top-width: 1px;
83
+ /* 3 */
84
+ }
85
+
86
+ /*
87
+ Add the correct text decoration in Chrome, Edge, and Safari.
88
+ */
89
+
90
+ abbr:where([title]) {
91
+ -webkit-text-decoration: underline dotted;
92
+ text-decoration: underline dotted;
93
+ }
94
+
95
+ /*
96
+ Remove the default font size and weight for headings.
97
+ */
98
+
99
+ h1,
100
+ h2,
101
+ h3,
102
+ h4,
103
+ h5,
104
+ h6 {
105
+ font-size: inherit;
106
+ font-weight: inherit;
107
+ }
108
+
109
+ /*
110
+ Reset links to optimize for opt-in styling instead of opt-out.
111
+ */
112
+
113
+ a {
114
+ color: inherit;
115
+ text-decoration: inherit;
116
+ }
117
+
118
+ /*
119
+ Add the correct font weight in Edge and Safari.
120
+ */
121
+
122
+ b,
123
+ strong {
124
+ font-weight: bolder;
125
+ }
126
+
127
+ /*
128
+ 1. Use the user's configured `mono` font-family by default.
129
+ 2. Use the user's configured `mono` font-feature-settings by default.
130
+ 3. Use the user's configured `mono` font-variation-settings by default.
131
+ 4. Correct the odd `em` font sizing in all browsers.
132
+ */
133
+
134
+ code,
135
+ kbd,
136
+ samp,
137
+ pre {
138
+ font-family: var(--font-geist-mono), ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
139
+ /* 1 */
140
+ font-feature-settings: normal;
141
+ /* 2 */
142
+ font-variation-settings: normal;
143
+ /* 3 */
144
+ font-size: 1em;
145
+ /* 4 */
146
+ }
147
+
148
+ /*
149
+ Add the correct font size in all browsers.
150
+ */
151
+
152
+ small {
153
+ font-size: 80%;
154
+ }
155
+
156
+ /*
157
+ Prevent `sub` and `sup` elements from affecting the line height in all browsers.
158
+ */
159
+
160
+ sub,
161
+ sup {
162
+ font-size: 75%;
163
+ line-height: 0;
164
+ position: relative;
165
+ vertical-align: baseline;
166
+ }
167
+
168
+ sub {
169
+ bottom: -0.25em;
170
+ }
171
+
172
+ sup {
173
+ top: -0.5em;
174
+ }
175
+
176
+ /*
177
+ 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
178
+ 2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
179
+ 3. Remove gaps between table borders by default.
180
+ */
181
+
182
+ table {
183
+ text-indent: 0;
184
+ /* 1 */
185
+ border-color: inherit;
186
+ /* 2 */
187
+ border-collapse: collapse;
188
+ /* 3 */
189
+ }
190
+
191
+ /*
192
+ 1. Change the font styles in all browsers.
193
+ 2. Remove the margin in Firefox and Safari.
194
+ 3. Remove default padding in all browsers.
195
+ */
196
+
197
+ button,
198
+ input,
199
+ optgroup,
200
+ select,
201
+ textarea {
202
+ font-family: inherit;
203
+ /* 1 */
204
+ font-feature-settings: inherit;
205
+ /* 1 */
206
+ font-variation-settings: inherit;
207
+ /* 1 */
208
+ font-size: 100%;
209
+ /* 1 */
210
+ font-weight: inherit;
211
+ /* 1 */
212
+ line-height: inherit;
213
+ /* 1 */
214
+ letter-spacing: inherit;
215
+ /* 1 */
216
+ color: inherit;
217
+ /* 1 */
218
+ margin: 0;
219
+ /* 2 */
220
+ padding: 0;
221
+ /* 3 */
222
+ }
223
+
224
+ /*
225
+ Remove the inheritance of text transform in Edge and Firefox.
226
+ */
227
+
228
+ button,
229
+ select {
230
+ text-transform: none;
231
+ }
232
+
233
+ /*
234
+ 1. Correct the inability to style clickable types in iOS and Safari.
235
+ 2. Remove default button styles.
236
+ */
237
+
238
+ button,
239
+ input:where([type='button']),
240
+ input:where([type='reset']),
241
+ input:where([type='submit']) {
242
+ -webkit-appearance: button;
243
+ /* 1 */
244
+ background-color: transparent;
245
+ /* 2 */
246
+ background-image: none;
247
+ /* 2 */
248
+ }
249
+
250
+ /*
251
+ Use the modern Firefox focus style for all focusable elements.
252
+ */
253
+
254
+ :-moz-focusring {
255
+ outline: auto;
256
+ }
257
+
258
+ /*
259
+ Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
260
+ */
261
+
262
+ :-moz-ui-invalid {
263
+ box-shadow: none;
264
+ }
265
+
266
+ /*
267
+ Add the correct vertical alignment in Chrome and Firefox.
268
+ */
269
+
270
+ progress {
271
+ vertical-align: baseline;
272
+ }
273
+
274
+ /*
275
+ Correct the cursor style of increment and decrement buttons in Safari.
276
+ */
277
+
278
+ ::-webkit-inner-spin-button,
279
+ ::-webkit-outer-spin-button {
280
+ height: auto;
281
+ }
282
+
283
+ /*
284
+ 1. Correct the odd appearance in Chrome and Safari.
285
+ 2. Correct the outline style in Safari.
286
+ */
287
+
288
+ [type='search'] {
289
+ -webkit-appearance: textfield;
290
+ /* 1 */
291
+ outline-offset: -2px;
292
+ /* 2 */
293
+ }
294
+
295
+ /*
296
+ Remove the inner padding in Chrome and Safari on macOS.
297
+ */
298
+
299
+ ::-webkit-search-decoration {
300
+ -webkit-appearance: none;
301
+ }
302
+
303
+ /*
304
+ 1. Correct the inability to style clickable types in iOS and Safari.
305
+ 2. Change font properties to `inherit` in Safari.
306
+ */
307
+
308
+ ::-webkit-file-upload-button {
309
+ -webkit-appearance: button;
310
+ /* 1 */
311
+ font: inherit;
312
+ /* 2 */
313
+ }
314
+
315
+ /*
316
+ Add the correct display in Chrome and Safari.
317
+ */
318
+
319
+ summary {
320
+ display: list-item;
321
+ }
322
+
323
+ /*
324
+ Removes the default spacing and border for appropriate elements.
325
+ */
326
+
327
+ blockquote,
328
+ dl,
329
+ dd,
330
+ h1,
331
+ h2,
332
+ h3,
333
+ h4,
334
+ h5,
335
+ h6,
336
+ hr,
337
+ figure,
338
+ p,
339
+ pre {
340
+ margin: 0;
341
+ }
342
+
343
+ fieldset {
344
+ margin: 0;
345
+ padding: 0;
346
+ }
347
+
348
+ legend {
349
+ padding: 0;
350
+ }
351
+
352
+ ol,
353
+ ul,
354
+ menu {
355
+ list-style: none;
356
+ margin: 0;
357
+ padding: 0;
358
+ }
359
+
360
+ /*
361
+ Reset default styling for dialogs.
362
+ */
363
+
364
+ dialog {
365
+ padding: 0;
366
+ }
367
+
368
+ /*
369
+ Prevent resizing textareas horizontally by default.
370
+ */
371
+
372
+ textarea {
373
+ resize: vertical;
374
+ }
375
+
376
+ /*
377
+ 1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
378
+ 2. Set the default placeholder color to the user's configured gray 400 color.
379
+ */
380
+
381
+ input::-moz-placeholder, textarea::-moz-placeholder {
382
+ opacity: 1;
383
+ /* 1 */
384
+ color: #9ca3af;
385
+ /* 2 */
386
+ }
387
+
388
+ input::placeholder,
389
+ textarea::placeholder {
390
+ opacity: 1;
391
+ /* 1 */
392
+ color: #9ca3af;
393
+ /* 2 */
394
+ }
395
+
396
+ /*
397
+ Set the default cursor for buttons.
398
+ */
399
+
400
+ button,
401
+ [role="button"] {
402
+ cursor: pointer;
403
+ }
404
+
405
+ /*
406
+ Make sure disabled buttons don't get the pointer cursor.
407
+ */
408
+
409
+ :disabled {
410
+ cursor: default;
411
+ }
412
+
413
+ /*
414
+ 1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
415
+ 2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
416
+ This can trigger a poorly considered lint error in some tools but is included by design.
417
+ */
418
+
419
+ img,
420
+ svg,
421
+ video,
422
+ canvas,
423
+ audio,
424
+ iframe,
425
+ embed,
426
+ object {
427
+ display: block;
428
+ /* 1 */
429
+ vertical-align: middle;
430
+ /* 2 */
431
+ }
432
+
433
+ /*
434
+ Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
435
+ */
436
+
437
+ img,
438
+ video {
439
+ max-width: 100%;
440
+ height: auto;
441
+ }
442
+
443
+ /* Make elements with the HTML hidden attribute stay hidden by default */
444
+
445
+ [hidden] {
446
+ display: none;
447
+ }
448
+
449
+ *, ::before, ::after {
450
+ --tw-border-spacing-x: 0;
451
+ --tw-border-spacing-y: 0;
452
+ --tw-translate-x: 0;
453
+ --tw-translate-y: 0;
454
+ --tw-rotate: 0;
455
+ --tw-skew-x: 0;
456
+ --tw-skew-y: 0;
457
+ --tw-scale-x: 1;
458
+ --tw-scale-y: 1;
459
+ --tw-pan-x: ;
460
+ --tw-pan-y: ;
461
+ --tw-pinch-zoom: ;
462
+ --tw-scroll-snap-strictness: proximity;
463
+ --tw-gradient-from-position: ;
464
+ --tw-gradient-via-position: ;
465
+ --tw-gradient-to-position: ;
466
+ --tw-ordinal: ;
467
+ --tw-slashed-zero: ;
468
+ --tw-numeric-figure: ;
469
+ --tw-numeric-spacing: ;
470
+ --tw-numeric-fraction: ;
471
+ --tw-ring-inset: ;
472
+ --tw-ring-offset-width: 0px;
473
+ --tw-ring-offset-color: #fff;
474
+ --tw-ring-color: rgb(59 130 246 / 0.5);
475
+ --tw-ring-offset-shadow: 0 0 #0000;
476
+ --tw-ring-shadow: 0 0 #0000;
477
+ --tw-shadow: 0 0 #0000;
478
+ --tw-shadow-colored: 0 0 #0000;
479
+ --tw-blur: ;
480
+ --tw-brightness: ;
481
+ --tw-contrast: ;
482
+ --tw-grayscale: ;
483
+ --tw-hue-rotate: ;
484
+ --tw-invert: ;
485
+ --tw-saturate: ;
486
+ --tw-sepia: ;
487
+ --tw-drop-shadow: ;
488
+ --tw-backdrop-blur: ;
489
+ --tw-backdrop-brightness: ;
490
+ --tw-backdrop-contrast: ;
491
+ --tw-backdrop-grayscale: ;
492
+ --tw-backdrop-hue-rotate: ;
493
+ --tw-backdrop-invert: ;
494
+ --tw-backdrop-opacity: ;
495
+ --tw-backdrop-saturate: ;
496
+ --tw-backdrop-sepia: ;
497
+ --tw-contain-size: ;
498
+ --tw-contain-layout: ;
499
+ --tw-contain-paint: ;
500
+ --tw-contain-style: ;
501
+ }
502
+
503
+ ::backdrop {
504
+ --tw-border-spacing-x: 0;
505
+ --tw-border-spacing-y: 0;
506
+ --tw-translate-x: 0;
507
+ --tw-translate-y: 0;
508
+ --tw-rotate: 0;
509
+ --tw-skew-x: 0;
510
+ --tw-skew-y: 0;
511
+ --tw-scale-x: 1;
512
+ --tw-scale-y: 1;
513
+ --tw-pan-x: ;
514
+ --tw-pan-y: ;
515
+ --tw-pinch-zoom: ;
516
+ --tw-scroll-snap-strictness: proximity;
517
+ --tw-gradient-from-position: ;
518
+ --tw-gradient-via-position: ;
519
+ --tw-gradient-to-position: ;
520
+ --tw-ordinal: ;
521
+ --tw-slashed-zero: ;
522
+ --tw-numeric-figure: ;
523
+ --tw-numeric-spacing: ;
524
+ --tw-numeric-fraction: ;
525
+ --tw-ring-inset: ;
526
+ --tw-ring-offset-width: 0px;
527
+ --tw-ring-offset-color: #fff;
528
+ --tw-ring-color: rgb(59 130 246 / 0.5);
529
+ --tw-ring-offset-shadow: 0 0 #0000;
530
+ --tw-ring-shadow: 0 0 #0000;
531
+ --tw-shadow: 0 0 #0000;
532
+ --tw-shadow-colored: 0 0 #0000;
533
+ --tw-blur: ;
534
+ --tw-brightness: ;
535
+ --tw-contrast: ;
536
+ --tw-grayscale: ;
537
+ --tw-hue-rotate: ;
538
+ --tw-invert: ;
539
+ --tw-saturate: ;
540
+ --tw-sepia: ;
541
+ --tw-drop-shadow: ;
542
+ --tw-backdrop-blur: ;
543
+ --tw-backdrop-brightness: ;
544
+ --tw-backdrop-contrast: ;
545
+ --tw-backdrop-grayscale: ;
546
+ --tw-backdrop-hue-rotate: ;
547
+ --tw-backdrop-invert: ;
548
+ --tw-backdrop-opacity: ;
549
+ --tw-backdrop-saturate: ;
550
+ --tw-backdrop-sepia: ;
551
+ --tw-contain-size: ;
552
+ --tw-contain-layout: ;
553
+ --tw-contain-paint: ;
554
+ --tw-contain-style: ;
555
+ }
556
+
557
+ .-fk-ml-1 {
558
+ margin-left: -0.25rem;
559
+ }
560
+
561
+ .fk-mb-4 {
562
+ margin-bottom: 1rem;
563
+ }
564
+
565
+ .fk-flex {
566
+ display: flex;
567
+ }
568
+
569
+ .fk-h-4 {
570
+ height: 1rem;
571
+ }
572
+
573
+ .fk-h-full {
574
+ height: 100%;
575
+ }
576
+
577
+ .fk-w-4 {
578
+ width: 1rem;
579
+ }
580
+
581
+ .fk-w-full {
582
+ width: 100%;
583
+ }
584
+
585
+ .fk-flex-col {
586
+ flex-direction: column;
587
+ }
588
+
589
+ .fk-items-center {
590
+ align-items: center;
591
+ }
592
+
593
+ .fk-gap-2 {
594
+ gap: 0.5rem;
595
+ }
596
+
597
+ .fk-px-4 {
598
+ padding-left: 1rem;
599
+ padding-right: 1rem;
600
+ }
601
+
602
+ .fk-py-3 {
603
+ padding-top: 0.75rem;
604
+ padding-bottom: 0.75rem;
605
+ }
606
+
607
+ .fk-text-lg {
608
+ font-size: 1.125rem;
609
+ line-height: 1.75rem;
610
+ }
611
+
612
+ .fk-font-semibold {
613
+ font-weight: 600;
614
+ }
615
+
616
+ .fk-leading-none {
617
+ line-height: 1;
618
+ }
619
+
620
+ .fk-tracking-tight {
621
+ letter-spacing: -0.025em;
622
+ }
623
+
624
+ @keyframes enter {
625
+ from {
626
+ opacity: var(--tw-enter-opacity, 1);
627
+ transform: translate3d(var(--tw-enter-translate-x, 0), var(--tw-enter-translate-y, 0), 0) scale3d(var(--tw-enter-scale, 1), var(--tw-enter-scale, 1), var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0));
628
+ }
629
+ }
630
+
631
+ @keyframes exit {
632
+ to {
633
+ opacity: var(--tw-exit-opacity, 1);
634
+ transform: translate3d(var(--tw-exit-translate-x, 0), var(--tw-exit-translate-y, 0), 0) scale3d(var(--tw-exit-scale, 1), var(--tw-exit-scale, 1), var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0));
635
+ }
636
+ }
637
+
638
+ html,
639
+ body {
640
+ height: 100%;
641
+ }
@@ -0,0 +1,5 @@
1
+ import { PluginOptions } from '@flexkit/studio';
2
+
3
+ declare function Desk(): PluginOptions;
4
+
5
+ export { Desk };
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import {Layout}from'lucide-react';import {find,propEq}from'ramda';import {useParams,useLocation,useAppContext,useConfig,getEntitySchema,useEntityQuery,ProjectDisabled,SchemaError,Outlet,useAuth}from'@flexkit/studio';import {Tooltip,TooltipTrigger,SidebarTrigger,TooltipContent,Separator,SidebarProvider,Sidebar,SidebarInset,Skeleton}from'@flexkit/studio/ui';import {jsx,jsxs}from'react/jsx-runtime';import {useCallback}from'react';import {useGridColumnsDefinition,DataTable,DataTableToolbar,DataTableRowActions}from'@flexkit/studio/data-grid';var H="flexkit:sidebar:state";function x(){let[,t]=useAuth(),{projects:o,currentProjectId:r}=useConfig(),{schema:a,menuGroups:f}=find(propEq(r??"","projectId"))(o),u=document.cookie.split("; ").find(p=>p.startsWith(`${H}=`))?.split("=")[1]!=="false";return jsxs(SidebarProvider,{defaultOpen:u,children:[jsx(Sidebar,{schema:a,menuGroups:f}),jsx(SidebarInset,{children:jsx(Outlet,{})})]})}var c=25;function N(){let{entity:t}=useParams(),{search:o}=useLocation(),a=new URLSearchParams(o).get("id"),{scope:f}=useAppContext(),{projects:u,currentProjectId:p}=useConfig(),{schema:h}=find(propEq(p??"","projectId"))(u),n=getEntitySchema(h,t??""),y=useGridColumnsDefinition({attributesSchema:n?.attributes??[],actionsComponent:i=>ft({entityName:n?.name??"",entityNamePlural:t??"",row:i}),checkboxSelect:"multiple"}),C=a?{where:{_id:a}}:{options:{offset:0,limit:c}},{isLoading:l,fetchMore:b,count:d,data:s,isProjectDisabled:D}=useEntityQuery({entityNamePlural:t??"",schema:h,scope:f,variables:C}),E=useCallback(i=>{let S=s?.length??0;if(i&&d>0&&S>0){let{scrollHeight:w,scrollTop:A,clientHeight:I}=i;w-A-I<500&&!l&&S<d&&b({variables:{options:{offset:s?.length??0,limit:c}}});}},[d,s?.length,b,l]),T=Array(c).fill({}),v=ut(y);return D?jsx("div",{className:"fk-flex fk-flex-col fk-h-full fk-px-4 fk-py-3",children:jsx(ProjectDisabled,{})}):jsxs("div",{className:"fk-flex fk-flex-col fk-h-full fk-px-4 fk-py-3",children:[jsx(SchemaError,{}),jsxs("div",{className:"fk-flex fk-items-center fk-mb-4 fk-gap-2",children:[jsxs(Tooltip,{children:[jsx(TooltipTrigger,{asChild:true,children:jsx(SidebarTrigger,{className:"-fk-ml-1 fk-w-4 fk-h-4"})}),jsx(TooltipContent,{children:"Toggle Sidebar"})]}),jsx(Separator,{orientation:"vertical",className:"fk-h-4"}),jsx("h2",{className:"fk-text-lg fk-font-semibold fk-leading-none fk-tracking-tight",children:mt(n?.menu?.label??n?.plural??"")})]}),jsx(DataTable,{columns:l?v:y,data:l?T:s??[],entityName:n?.name??"",pageSize:c,onScroll:i=>{E(i.target);},toolbarComponent:i=>jsx(DataTableToolbar,{entityName:n?.name??"",table:i})}),jsx(Outlet,{})]})}function mt(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ft({entityName:t,entityNamePlural:o,row:r}){return jsx(DataTableRowActions,{entityName:t,entityNamePlural:o,row:r})}function ut(t){return t.map(o=>({...o,cell:()=>jsx(Skeleton,{className:"fk-h-4 fk-w-full",style:{marginTop:"7px",marginBottom:"6px"}})}))}function P(){let{entity:t,id:o}=useParams();return jsxs("div",{className:"flex flex-col",children:["Edit ",t," with id: ",o]})}function Ot(){return {name:"flexkit.desk",contributes:{apps:[{name:"desk",icon:jsx(Layout,{strokeWidth:1.5}),title:"Desk",component:jsx(x,{}),routes:[{path:"list/:entity",component:jsx(N,{}),children:[{path:"edit/:id",component:jsx(P,{})}]}]}]}}}export{Ot as Desk};//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/root.tsx","../src/list.tsx","../src/edit-entity.tsx","../src/index.tsx"],"names":["SIDEBAR_COOKIE_NAME","Root","auth","useAuth","projects","currentProjectId","useConfig","schema","menuGroups","find","propEq","defaultOpen","row","jsxs","SidebarProvider","jsx","Sidebar","SidebarInset","Outlet","pageSize","List","entityName","useParams","search","useLocation","entityId","scope","useAppContext","entitySchema","getEntitySchema","columnsDefinition","useGridColumnsDefinition","dataRowActions","variables","isLoading","fetchMore","count","data","isProjectDisabled","useEntityQuery","fetchMoreOnBottomReached","useCallback","containerRefElement","rowsCount","scrollHeight","scrollTop","clientHeight","loadingData","loadingColumns","getLoadingColumns","ProjectDisabled","SchemaError","Tooltip","TooltipTrigger","SidebarTrigger","TooltipContent","Separator","capitalize","DataTable","e","table","DataTableToolbar","str","entityNamePlural","DataTableRowActions","columns","column","Skeleton","EditEntity","entity","id","Desk","LayoutIcon"],"mappings":"+hBAKA,IAAMA,CAAAA,CAAsB,uBAAA,CAErB,SAASC,GAAoB,CAClC,GAAM,EAAGC,CAAI,CAAA,CAAIC,OAAAA,EAAQ,CACnB,CAAE,SAAAC,CAAAA,CAAU,gBAAA,CAAAC,CAAiB,CAAA,CAAIC,WAAU,CAC3C,CAAE,MAAA,CAAAC,CAAAA,CAAQ,WAAAC,CAAW,CAAA,CAAIC,IAAAA,CAAKC,MAAAA,CAAOL,GAAoB,EAAA,CAAI,WAAW,CAAC,CAAA,CAAED,CAAQ,CAAA,CACnFO,CAAAA,CACJ,QAAA,CAAS,MAAA,CACN,MAAM,IAAI,CAAA,CACV,KAAMC,CAAAA,EAAQA,CAAAA,CAAI,WAAW,CAAA,EAAGZ,CAAmB,CAAA,CAAA,CAAG,CAAC,GACtD,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,IAAM,OAAA,CAExB,OACEa,IAAAA,CAACC,eAAAA,CAAA,CAAgB,WAAA,CAAaH,CAAAA,CAC5B,QAAA,CAAA,CAAAI,GAAAA,CAACC,QAAA,CAAQ,MAAA,CAAQT,CAAAA,CAAQ,UAAA,CAAYC,EAAY,CAAA,CACjDO,GAAAA,CAACE,YAAAA,CAAA,CACC,SAAAF,GAAAA,CAACG,MAAAA,CAAA,EAAO,CAAA,CACV,GACF,CAEJ,CCRA,IAAMC,CAAAA,CAAW,EAAA,CAEV,SAASC,CAAAA,EAAoB,CAClC,GAAM,CAAE,MAAA,CAAQC,CAAW,EAAIC,SA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AAkBgB,CAAAA,CAAgD,CACzE,OAAOA,CAAAA,CAAQ,GAAA,CAAKC,CAAAA,GAAY,CAC9B,GAAGA,CAAAA,CACH,IAAA,CAAM,IAAMnD,IAACoD,QAAAA,CAAA,CAAS,SAAA,CAAU,kBAAA,CAAmB,MAAO,CAAE,SAAA,CAAW,KAAA,CAAO,YAAA,CAAc,KAAM,CAAA,CAAG,CACvG,CAAA,CAAE,CACJ,CCnIO,SAASC,CAAAA,EAA0B,CACxC,GAAM,CAAE,MAAA,CAAAC,CAAAA,CAAQ,EAAA,CAAAC,CAAG,CAAA,CAAIhD,SAAAA,EAAU,CAGjC,OACET,KAAC,KAAA,CAAA,CAAI,SAAA,CAAU,eAAA,CAAgB,QAAA,CAAA,CAAA,OAAA,CACvBwD,EAAO,YAAA,CAAWC,CAAAA,CAAAA,CAC1B,CAEJ,CCLO,SAASC,EAAAA,EAAsB,CACpC,OAAO,CACL,IAAA,CAAM,cAAA,CACN,YAAa,CACX,IAAA,CAAM,CACJ,CACE,IAAA,CAAM,OACN,IAAA,CAAMxD,GAAAA,CAACyD,MAAAA,CAAA,CAAW,YAAa,GAAA,CAAK,CAAA,CACpC,KAAA,CAAO,MAAA,CACP,UAAWzD,GAAAA,CAACd,CAAAA,CAAA,EAAK,CAAA,CACjB,OAAQ,CACN,CACE,IAAA,CAAM,cAAA,CACN,UAAWc,GAAAA,CAACK,CAAAA,CAAA,EAAK,CAAA,CACjB,SAAU,CACR,CACE,IAAA,CAAM,UAAA,CACN,UAAWL,GAAAA,CAACqD,CAAAA,CAAA,EAAW,CACzB,CACF,CACF,CACF,CACF,CACF,CACF,CACF,CACF","file":"index.js","sourcesContent":["import { find, propEq } from 'ramda';\nimport { Outlet, useAuth, useConfig } from '@flexkit/studio';\nimport { Sidebar, SidebarInset, SidebarProvider } from '@flexkit/studio/ui';\nimport type { SingleProject } from '@flexkit/studio';\n\nconst SIDEBAR_COOKIE_NAME = 'flexkit:sidebar:state';\n\nexport function Root(): JSX.Element {\n const [, auth] = useAuth();\n const { projects, currentProjectId } = useConfig();\n const { schema, menuGroups } = find(propEq(currentProjectId ?? '', 'projectId'))(projects) as SingleProject;\n const defaultOpen =\n document.cookie\n .split('; ')\n .find((row) => row.startsWith(`${SIDEBAR_COOKIE_NAME}=`))\n ?.split('=')[1] !== 'false';\n\n return (\n <SidebarProvider defaultOpen={defaultOpen}>\n <Sidebar schema={schema} menuGroups={menuGroups} />\n <SidebarInset>\n <Outlet />\n </SidebarInset>\n </SidebarProvider>\n );\n}\n","import { useCallback } from 'react';\nimport { find, propEq } from 'ramda';\nimport {\n getEntitySchema,\n useAppContext,\n useConfig,\n useLocation,\n useParams,\n Outlet,\n useEntityQuery,\n ProjectDisabled,\n SchemaError,\n} from '@flexkit/studio';\nimport { Skeleton, SidebarTrigger, Separator, Tooltip, TooltipContent, TooltipTrigger } from '@flexkit/studio/ui';\nimport type { ColumnDef, SingleProject, Row } from '@flexkit/studio';\nimport { DataTable, DataTableRowActions, DataTableToolbar, useGridColumnsDefinition } from '@flexkit/studio/data-grid';\n\nconst pageSize = 25;\n\nexport function List(): JSX.Element {\n const { entity: entityName } = useParams();\n const { search } = useLocation();\n const query = new URLSearchParams(search);\n const entityId = query.get('id');\n const { scope } = useAppContext();\n const { projects, currentProjectId } = useConfig();\n const { schema } = find(propEq(currentProjectId ?? '', 'projectId'))(projects) as SingleProject;\n const entitySchema = getEntitySchema(schema, entityName ?? '');\n const columnsDefinition = useGridColumnsDefinition({\n attributesSchema: entitySchema?.attributes ?? [],\n actionsComponent: (row) =>\n dataRowActions({ entityName: entitySchema?.name ?? '', entityNamePlural: entityName ?? '', row }),\n checkboxSelect: 'multiple',\n });\n\n const variables = entityId ? { where: { _id: entityId } } : { options: { offset: 0, limit: pageSize } };\n\n const { isLoading, fetchMore, count, data, isProjectDisabled } = useEntityQuery({\n entityNamePlural: entityName ?? '',\n schema,\n scope,\n variables,\n });\n\n // called on scroll and possibly on mount to fetch more data as the user scrolls and reaches bottom of table\n const fetchMoreOnBottomReached = useCallback(\n (containerRefElement?: HTMLDivElement | null) => {\n const rowsCount = data?.length ?? 0;\n\n if (containerRefElement && count > 0 && rowsCount > 0) {\n const { scrollHeight, scrollTop, clientHeight } = containerRefElement;\n //once the user has scrolled within 500px of the bottom of the table, fetch more data if we can\n if (scrollHeight - scrollTop - clientHeight < 500 && !isLoading && rowsCount < count) {\n fetchMore({\n variables: {\n options: {\n offset: data?.length ?? 0,\n limit: pageSize,\n },\n },\n });\n }\n }\n },\n [count, data?.length, fetchMore, isLoading]\n );\n\n const loadingData = Array(pageSize).fill({});\n const loadingColumns = getLoadingColumns(columnsDefinition);\n\n if (isProjectDisabled) {\n return (\n <div className=\"fk-flex fk-flex-col fk-h-full fk-px-4 fk-py-3\">\n <ProjectDisabled />\n </div>\n );\n }\n\n return (\n <div className=\"fk-flex fk-flex-col fk-h-full fk-px-4 fk-py-3\">\n <SchemaError />\n <div className=\"fk-flex fk-items-center fk-mb-4 fk-gap-2\">\n <Tooltip>\n <TooltipTrigger asChild>\n <SidebarTrigger className=\"-fk-ml-1 fk-w-4 fk-h-4\" />\n </TooltipTrigger>\n <TooltipContent>Toggle Sidebar</TooltipContent>\n </Tooltip>\n <Separator orientation=\"vertical\" className=\"fk-h-4\" />\n <h2 className=\"fk-text-lg fk-font-semibold fk-leading-none fk-tracking-tight\">\n {capitalize(entitySchema?.menu?.label ?? entitySchema?.plural ?? '')}\n </h2>\n </div>\n <DataTable\n columns={isLoading ? loadingColumns : columnsDefinition}\n data={isLoading ? loadingData : (data ?? [])}\n entityName={entitySchema?.name ?? ''}\n pageSize={pageSize}\n onScroll={(e) => {\n fetchMoreOnBottomReached(e.target as HTMLDivElement);\n }}\n toolbarComponent={(table) => <DataTableToolbar entityName={entitySchema?.name ?? ''} table={table} />}\n />\n <Outlet />\n </div>\n );\n}\n\nfunction capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\ntype AttributeValue = {\n _id: string;\n [key: string]: string | AttributeValue | null;\n __typename: string;\n};\n\ntype DataRowActions = {\n entityName: string;\n entityNamePlural: string;\n row: Row<AttributeValue>;\n};\n\nfunction dataRowActions({ entityName, entityNamePlural, row }: DataRowActions): JSX.Element {\n return <DataTableRowActions entityName={entityName} entityNamePlural={entityNamePlural} row={row} />;\n}\n\nfunction getLoadingColumns(columns: object[]): ColumnDef<AttributeValue>[] {\n return columns.map((column) => ({\n ...column,\n cell: () => <Skeleton className=\"fk-h-4 fk-w-full\" style={{ marginTop: '7px', marginBottom: '6px' }} />,\n })) as unknown as ColumnDef<AttributeValue>[];\n}\n","import { useParams } from '@flexkit/studio';\n\nexport function EditEntity(): JSX.Element {\n const { entity, id } = useParams();\n\n // Not used, left here as an example of how to nest routes in plugins (see ./index.tsx file)\n return (\n <div className=\"flex flex-col\">\n Edit {entity} with id: {id}\n </div>\n );\n}\n","import { Layout as LayoutIcon } from 'lucide-react';\nimport type { PluginOptions } from '@flexkit/studio';\nimport { Root } from './root';\nimport { List } from './list';\nimport { EditEntity } from './edit-entity';\n\nexport function Desk(): PluginOptions {\n return {\n name: 'flexkit.desk',\n contributes: {\n apps: [\n {\n name: 'desk',\n icon: <LayoutIcon strokeWidth={1.5} />,\n title: 'Desk',\n component: <Root />,\n routes: [\n {\n path: 'list/:entity',\n component: <List />,\n children: [\n {\n path: 'edit/:id',\n component: <EditEntity />, // Not used, left here as an example of how to nest routes in plugins\n },\n ],\n },\n ],\n },\n ],\n },\n };\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@flexkit/desk",
3
+ "version": "0.0.6",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "style": "dist/index.css",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.ts",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/flexkit-io/flexkit",
13
+ "directory": "packages/flexkit-desk"
14
+ },
15
+ "exports": {
16
+ ".": "./dist/index.js",
17
+ "./server": "./dist/server/index.js",
18
+ "./tailwind.config": "./tailwind.config.ts",
19
+ "./styles.css": "./dist/index.css"
20
+ },
21
+ "typesVersions": {
22
+ "*": {
23
+ "server": [
24
+ "./dist/server/index.d.ts"
25
+ ]
26
+ }
27
+ },
28
+ "sideEffects": false,
29
+ "files": [
30
+ "dist/**"
31
+ ],
32
+ "devDependencies": {
33
+ "@types/debug": "^4.1.12",
34
+ "@types/node": "^20.5.2",
35
+ "@types/ramda": "^0.29.7",
36
+ "@types/react": "^18.2.0",
37
+ "@types/react-dom": "^18.2.0",
38
+ "autoprefixer": "^10.4.16",
39
+ "postcss": "^8.4.31",
40
+ "react": "^18.2.0",
41
+ "react-dom": "^18.2.0",
42
+ "tailwindcss": "3.4.10",
43
+ "tsup": "8.5.0",
44
+ "typescript": "^5.3.3",
45
+ "eslint-config-custom": "0.0.0",
46
+ "tailwind-config": "0.0.1",
47
+ "@flexkit/studio": "0.0.6",
48
+ "tsconfig": "0.0.0"
49
+ },
50
+ "dependencies": {
51
+ "debug": "^4.3.4",
52
+ "lucide-react": "0.544.0",
53
+ "ramda": "^0.29.1",
54
+ "swr": "^2.2.4"
55
+ },
56
+ "peerDependencies": {
57
+ "react": "^18.0.0 || ^19.0.0",
58
+ "react-dom": "^18.0.0 || ^19.0.0",
59
+ "@flexkit/studio": "0.0.6"
60
+ },
61
+ "publishConfig": {
62
+ "access": "public"
63
+ },
64
+ "scripts": {
65
+ "build": "tsup src/index.tsx --format esm --dts --external react && tailwindcss -i ./src/styles.css -o dist/index.css",
66
+ "dev": "tsup src/index.tsx --format esm --watch --dts --external react && tailwindcss -i ./src/styles.css -o ./dist/index.css --watch",
67
+ "lint": "eslint \"src/**/*.ts*\"",
68
+ "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
69
+ }
70
+ }