laif-ds 0.1.6 → 0.1.8

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 (97) hide show
  1. package/dist/_virtual/_cloneBuffer.js +5 -0
  2. package/dist/_virtual/dayjs.min.js +8 -0
  3. package/dist/_virtual/dayjs.min2.js +5 -0
  4. package/dist/_virtual/debounce.js +8 -0
  5. package/dist/_virtual/index5.js +5 -2
  6. package/dist/_virtual/index6.js +5 -0
  7. package/dist/_virtual/index7.js +5 -0
  8. package/dist/_virtual/localizedFormat.js +8 -0
  9. package/dist/_virtual/localizedFormat2.js +5 -0
  10. package/dist/_virtual/omit.js +8 -0
  11. package/dist/components/ui/gantt/assets/icons/MinusSquareOutlined.js +36 -0
  12. package/dist/components/ui/gantt/assets/icons/PlusSquareOutlined.js +45 -0
  13. package/dist/components/ui/gantt/components/Chart/Bars/Bars.js +115 -0
  14. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarItem/BarItem.js +158 -0
  15. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsItems/BarItems.js +36 -0
  16. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsRow.js +26 -0
  17. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsRowContext.js +14 -0
  18. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/RepeteadBars/RepeteadBars.js +75 -0
  19. package/dist/components/ui/gantt/components/Chart/Chart.js +66 -0
  20. package/dist/components/ui/gantt/components/Chart/Scale/Scale.js +88 -0
  21. package/dist/components/ui/gantt/components/Chart/Tree/Tree.js +72 -0
  22. package/dist/components/ui/gantt/components/Controls/Controls.js +82 -0
  23. package/dist/components/ui/gantt/components/Gantt/Gantt.js +58 -0
  24. package/dist/components/ui/gantt/components/Gantt/GanttContext.js +35 -0
  25. package/dist/components/ui/gantt/constants/DimensionsSettings.js +89 -0
  26. package/dist/components/ui/gantt/constants/DragStepOptions.js +43 -0
  27. package/dist/components/ui/gantt/constants/GanttConsts.js +17 -0
  28. package/dist/components/ui/gantt/constants/colors.json.js +106 -0
  29. package/dist/components/ui/gantt/enums/DataRepeatTimes.js +5 -0
  30. package/dist/components/ui/gantt/enums/DragStepSizes.js +5 -0
  31. package/dist/components/ui/gantt/enums/DragTypes.js +5 -0
  32. package/dist/components/ui/gantt/enums/GanttDimensions.js +5 -0
  33. package/dist/components/ui/gantt/enums/GanttUnitOfTimes.js +5 -0
  34. package/dist/components/ui/gantt/hooks/useForwardRef.js +11 -0
  35. package/dist/components/ui/gantt/hooks/useGanttCalculate.js +30 -0
  36. package/dist/components/ui/gantt/utils/getInitialScrollOffset.js +11 -0
  37. package/dist/components/ui/gantt/utils/getScaleDates.js +14 -0
  38. package/dist/components/ui/gantt/utils/getScaleItems.js +33 -0
  39. package/dist/components/ui/gantt/utils/getWholeWidth.js +7 -0
  40. package/dist/components/ui/gantt/utils/transformData.js +36 -0
  41. package/dist/index.d.ts +168 -0
  42. package/dist/index.js +300 -294
  43. package/dist/laif-ds.css +1 -0
  44. package/dist/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +8 -0
  45. package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +13 -0
  46. package/dist/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +8 -0
  47. package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +9 -0
  48. package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +57 -0
  49. package/dist/node_modules/@dnd-kit/core/dist/core.esm.js +2150 -0
  50. package/dist/node_modules/@dnd-kit/modifiers/dist/modifiers.esm.js +27 -0
  51. package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +184 -0
  52. package/dist/node_modules/classnames/index.js +43 -0
  53. package/dist/node_modules/dayjs/dayjs.min.js +283 -0
  54. package/dist/node_modules/dayjs/plugin/localizedFormat.js +30 -0
  55. package/dist/node_modules/lodash/_arrayEach.js +15 -0
  56. package/dist/node_modules/lodash/_assignValue.js +17 -0
  57. package/dist/node_modules/lodash/_baseAssign.js +16 -0
  58. package/dist/node_modules/lodash/_baseAssignIn.js +16 -0
  59. package/dist/node_modules/lodash/_baseAssignValue.js +20 -0
  60. package/dist/node_modules/lodash/_baseClone.js +71 -0
  61. package/dist/node_modules/lodash/_baseCreate.js +24 -0
  62. package/dist/node_modules/lodash/_baseIsMap.js +16 -0
  63. package/dist/node_modules/lodash/_baseIsSet.js +16 -0
  64. package/dist/node_modules/lodash/_baseKeysIn.js +22 -0
  65. package/dist/node_modules/lodash/_baseUnset.js +18 -0
  66. package/dist/node_modules/lodash/_cloneArrayBuffer.js +16 -0
  67. package/dist/node_modules/lodash/_cloneBuffer.js +20 -0
  68. package/dist/node_modules/lodash/_cloneDataView.js +16 -0
  69. package/dist/node_modules/lodash/_cloneRegExp.js +15 -0
  70. package/dist/node_modules/lodash/_cloneSymbol.js +15 -0
  71. package/dist/node_modules/lodash/_cloneTypedArray.js +16 -0
  72. package/dist/node_modules/lodash/_copyArray.js +16 -0
  73. package/dist/node_modules/lodash/_copyObject.js +22 -0
  74. package/dist/node_modules/lodash/_copySymbols.js +16 -0
  75. package/dist/node_modules/lodash/_copySymbolsIn.js +16 -0
  76. package/dist/node_modules/lodash/_customOmitClone.js +15 -0
  77. package/dist/node_modules/lodash/_flatRest.js +17 -0
  78. package/dist/node_modules/lodash/_getAllKeysIn.js +17 -0
  79. package/dist/node_modules/lodash/_getPrototype.js +12 -0
  80. package/dist/node_modules/lodash/_getSymbolsIn.js +19 -0
  81. package/dist/node_modules/lodash/_initCloneArray.js +15 -0
  82. package/dist/node_modules/lodash/_initCloneByTag.js +49 -0
  83. package/dist/node_modules/lodash/_initCloneObject.js +17 -0
  84. package/dist/node_modules/lodash/_nativeKeysIn.js +17 -0
  85. package/dist/node_modules/lodash/_parent.js +16 -0
  86. package/dist/node_modules/lodash/flatten.js +16 -0
  87. package/dist/node_modules/lodash/isMap.js +14 -0
  88. package/dist/node_modules/lodash/isPlainObject.js +23 -0
  89. package/dist/node_modules/lodash/isSet.js +14 -0
  90. package/dist/node_modules/lodash/keysIn.js +17 -0
  91. package/dist/node_modules/lodash/last.js +14 -0
  92. package/dist/node_modules/lodash/omit.js +30 -0
  93. package/dist/node_modules/memoize-one/dist/memoize-one.esm.js +28 -0
  94. package/dist/node_modules/react-window/dist/index.esm.js +375 -0
  95. package/dist/node_modules/style-to-object/cjs/index.js +1 -1
  96. package/dist/styles.css +1 -1
  97. package/package.json +8 -1
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import t from "../../../../_virtual/dayjs.min.js";
3
+ import { GanttDimensionsSettings as f } from "../constants/DimensionsSettings.js";
4
+ import { GanttConsts as m } from "../constants/GanttConsts.js";
5
+ const l = (n, o, e) => {
6
+ const { secondsInPixel: s, unitOfTime: i } = f[n], r = (e || t().unix()) - t.unix(o[0]).startOf(i).unix();
7
+ return Math.round(r / s) - m.TREE_WIDTH;
8
+ };
9
+ export {
10
+ l as getInitialScrollOffset
11
+ };
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import s from "../../../../_virtual/dayjs.min.js";
3
+ import { GanttUnitOfTimes as i } from "../enums/GanttUnitOfTimes.js";
4
+ const u = (e = s().unix(), r = 99, a = i.DAY) => {
5
+ const o = [];
6
+ for (let t = 0; t < r; t++)
7
+ o.push(
8
+ s.unix(e).startOf(a).subtract(Math.floor(r / 2) - t, a).unix()
9
+ );
10
+ return o;
11
+ };
12
+ export {
13
+ u as getScaleDates
14
+ };
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import g from "../../../../_virtual/dayjs.min.js";
3
+ import { GanttDimensionsSettings as o } from "../constants/DimensionsSettings.js";
4
+ import { GanttUnitOfTimes as s } from "../enums/GanttUnitOfTimes.js";
5
+ import { GanttConsts as i } from "../constants/GanttConsts.js";
6
+ const I = (n, a) => {
7
+ switch (o[n].unitOfTime) {
8
+ case s.DAY: {
9
+ const t = i.HOURS_IN_DAY / o[n].hours;
10
+ let e = 0;
11
+ return new Array(t).fill(0).map((r, u) => {
12
+ if (t < i.HOURS_IN_DAY) {
13
+ const c = e, m = i.HOURS_IN_DAY / t + e;
14
+ return e = m, `${c.toLocaleString("en-US", {
15
+ minimumIntegerDigits: 2
16
+ })} - ${m.toLocaleString("en-US", {
17
+ minimumIntegerDigits: 2
18
+ })}`;
19
+ }
20
+ return u.toLocaleString("en-US", { minimumIntegerDigits: 2 });
21
+ });
22
+ }
23
+ case s.MONTH: {
24
+ const t = g.unix(a).daysInMonth();
25
+ return new Array(t).fill(0).map((e, r) => (r + 1).toLocaleString("en-US", { minimumIntegerDigits: 2 }));
26
+ }
27
+ default:
28
+ return [];
29
+ }
30
+ };
31
+ export {
32
+ I as getScaleItems
33
+ };
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import m from "../../../../_virtual/dayjs.min.js";
3
+ import { GanttDimensions as u } from "../enums/GanttDimensions.js";
4
+ const h = (n, t, o, r) => t === u.DAY ? r * n.reduce((e, i) => e + m.unix(i).daysInMonth(), 0) : n.length * o * r;
5
+ export {
6
+ h as getWholeWidth
7
+ };
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import s from "../../../../_virtual/omit.js";
3
+ import n from "../constants/colors.json.js";
4
+ const g = (e, u = !0, o = 0, d = 0, t = []) => e.reduce((l, r) => {
5
+ var h;
6
+ const c = d + l.length;
7
+ if ((h = r == null ? void 0 : r.children) != null && h.length) {
8
+ const f = g(r.children, u, o + 1, c + 1, [
9
+ ...t,
10
+ r.key
11
+ ]);
12
+ return [
13
+ ...l,
14
+ {
15
+ color: n[c % n.length],
16
+ ...s(r, "children"),
17
+ expanded: u,
18
+ level: o,
19
+ parentsKeys: t
20
+ },
21
+ ...f
22
+ ];
23
+ }
24
+ return [
25
+ ...l,
26
+ {
27
+ color: n[c % n.length],
28
+ ...s(r, "children"),
29
+ level: o,
30
+ parentsKeys: t
31
+ }
32
+ ];
33
+ }, []);
34
+ export {
35
+ g as transformData
36
+ };
package/dist/index.d.ts CHANGED
@@ -203,6 +203,8 @@ export declare const badgeVariants: (props?: ({
203
203
  variant?: "default" | "secondary" | "destructive" | "outline" | null | undefined;
204
204
  } & ClassProp) | undefined) => string;
205
205
 
206
+ declare type BarItemDataType = RepeatDataType | NoRepeatDataType;
207
+
206
208
  export declare function Button({ className, variant, size, asChild, iconLeft, iconRight, ...props }: ButtonProps): JSX.Element;
207
209
 
208
210
  export declare interface ButtonProps extends React_2.ComponentProps<"button">, VariantProps<typeof buttonVariants> {
@@ -259,6 +261,8 @@ declare type CarouselProps = {
259
261
  setApi?: (api: CarouselApi) => void;
260
262
  };
261
263
 
264
+ declare const Chart: default_3.FC<ChartProps>;
265
+
262
266
  export declare type ChartConfig = {
263
267
  [k in string]: {
264
268
  label?: React_2.ReactNode;
@@ -284,6 +288,13 @@ export declare function ChartLegendContent({ className, hideIcon, payload, verti
284
288
  nameKey?: string;
285
289
  }): JSX.Element | null;
286
290
 
291
+ declare interface ChartProps {
292
+ data: GanttDataType[];
293
+ className?: string;
294
+ onBarDoubleClick?: OnBarDoubleClickType;
295
+ onBarChange?: OnBarChangeType;
296
+ }
297
+
287
298
  export declare const ChartStyle: ({ id, config }: {
288
299
  id: string;
289
300
  config: ChartConfig;
@@ -438,6 +449,12 @@ export declare function ContextMenuSubTrigger({ className, inset, children, ...p
438
449
 
439
450
  export declare function ContextMenuTrigger({ ...props }: React_2.ComponentProps<typeof ContextMenuPrimitive.Trigger>): JSX.Element;
440
451
 
452
+ declare const Controls: default_3.FC<ControlsProps>;
453
+
454
+ declare interface ControlsProps {
455
+ className?: string;
456
+ }
457
+
441
458
  export declare function CopyButton({ content, copyMessage }: CopyButtonProps): JSX.Element;
442
459
 
443
460
  declare type CopyButtonProps = {
@@ -445,6 +462,12 @@ declare type CopyButtonProps = {
445
462
  copyMessage?: string;
446
463
  };
447
464
 
465
+ declare enum DataRepeatTypes {
466
+ DAY = "DAY",
467
+ WEEK = "WEEK",
468
+ MONTH = "MONTH"
469
+ }
470
+
448
471
  export declare function DataTable<TData, TValue>({ columns, data, loading, loadingComponent, emptyComponent, className, rowSelection, onRowSelectionChange, checkable, onCheckedRowsChange, notFoundMessage, loadingMessage }: DataTableProps<TData, TValue>): JSX.Element;
449
472
 
450
473
  declare interface DataTableProps<TData, TValue> {
@@ -524,6 +547,64 @@ export declare function FormLabel({ className, ...props }: React_2.ComponentProp
524
547
 
525
548
  export declare function FormMessage({ className, ...props }: React_2.ComponentProps<"p">): JSX.Element | null;
526
549
 
550
+ export declare const Gantt: default_3.FC<GanttProps> & {
551
+ Chart: typeof Chart;
552
+ Controls: typeof Controls;
553
+ };
554
+
555
+ export declare const GanttConsts: {
556
+ ROW_HEIGHT: number;
557
+ HEADER_HEIGHT: number;
558
+ TREE_WIDTH: number;
559
+ LEAF_TITLE_PADDING_LEFT: number;
560
+ LEAF_CHILDREN_PADDING_LEFT: number;
561
+ SCALE_STEP_DEFAULT_WIDTH: number;
562
+ SECONDS_IN_HOUR: number;
563
+ SECONDS_IN_DAY: number;
564
+ HOURS_IN_DAY: number;
565
+ MIN_SCROLL_OFFSET: number;
566
+ SCALE_STEP_RATIO: number;
567
+ };
568
+
569
+ declare type GanttDataType<T = Record<string, unknown>> = RawGanttDataType<T> & {
570
+ [P in keyof T]: T[P];
571
+ };
572
+
573
+ export declare enum GanttDimensions {
574
+ HOUR = "hour",
575
+ TWO_HOURS = "twoHours",
576
+ THREE_HOURS = "threeHours",
577
+ FOUR_HOURS = "fourHours",
578
+ SIX_HOURS = "sixHours",
579
+ EIGHT_HOURS = "eightHours",
580
+ TWELVE_HOURS = "twelveHours",
581
+ DAY = "day"
582
+ }
583
+
584
+ declare type GanttItemDataType<T = Record<string, unknown>> = TransformedDataType<GanttDataType<T>> & {
585
+ /**
586
+ * Tree level of gantt item
587
+ */
588
+ level: number;
589
+ /**
590
+ * Parents keys of gantt item
591
+ */
592
+ parentsKeys: string[];
593
+ /**
594
+ * Color of gantt item
595
+ */
596
+ color: string;
597
+ /**
598
+ * Is gantt item expanded?
599
+ */
600
+ expanded?: boolean;
601
+ } & T;
602
+
603
+ declare type GanttProps = {
604
+ children: ReactNode | ReactNode[];
605
+ draggable?: boolean;
606
+ };
607
+
527
608
  export declare function HoverCard({ ...props }: React_2.ComponentProps<typeof HoverCardPrimitive.Root>): JSX.Element;
528
609
 
529
610
  export declare function HoverCardContent({ className, align, sideOffset, ...props }: React_2.ComponentProps<typeof HoverCardPrimitive.Content>): JSX.Element;
@@ -777,6 +858,28 @@ export declare function NavigationMenuTrigger({ className, children, ...props }:
777
858
 
778
859
  export declare function NavigationMenuViewport({ className, ...props }: React_2.ComponentProps<typeof NavigationMenuPrimitive.Viewport>): JSX.Element;
779
860
 
861
+ declare type NoRepeatDataType = {
862
+ /**
863
+ * Start date and time of unrepeatable bar item
864
+ */
865
+ startDate: string;
866
+ /**
867
+ * End date and time of unrepeatable bar item
868
+ */
869
+ endDate: string;
870
+ fromTime?: never;
871
+ toTime?: never;
872
+ fromDate?: never;
873
+ toDate?: never;
874
+ repeatType?: never;
875
+ weekdays?: never;
876
+ monthdays?: never;
877
+ };
878
+
879
+ declare type OnBarChangeType<T extends Record<string, unknown> = any> = (barData: GanttItemDataType<T>, data: (GanttItemDataType<T> & T)[]) => any;
880
+
881
+ declare type OnBarDoubleClickType<T extends Record<string, unknown> = any> = (barData: GanttItemDataType<T>) => any;
882
+
780
883
  declare interface Option_2 {
781
884
  value: string;
782
885
  label: string;
@@ -833,11 +936,72 @@ export declare function RadioGroup({ className, ...props }: React_2.ComponentPro
833
936
 
834
937
  export declare function RadioGroupItem({ className, ...props }: React_2.ComponentProps<typeof RadioGroupPrimitive.Item>): JSX.Element;
835
938
 
939
+ export declare type RawGanttDataType<T = Record<string, unknown>> = {
940
+ /**
941
+ * Title of gantt item
942
+ */
943
+ title: string;
944
+ /**
945
+ * Unique gantt item key
946
+ */
947
+ key: string;
948
+ /**
949
+ * Color of gantt item
950
+ */
951
+ color?: string;
952
+ /**
953
+ * Data to render gantt item on the chart
954
+ */
955
+ data?: BarItemDataType;
956
+ /**
957
+ * Nested gantt items
958
+ */
959
+ children?: GanttDataType<T>[];
960
+ /**
961
+ * Custom component to render on the left side of the title
962
+ * Può essere un ReactNode o una funzione che riceve i dati della barra e restituisce un ReactNode
963
+ */
964
+ leftRender?: React.ReactNode | ((barData: RawGanttDataType) => React.ReactNode);
965
+ };
966
+
836
967
  declare interface ReasoningPart {
837
968
  type: "reasoning";
838
969
  reasoning: string;
839
970
  }
840
971
 
972
+ declare type RepeatDataType = {
973
+ /**
974
+ * Type of repeatable gantt item
975
+ */
976
+ repeatType: DataRepeatTypes;
977
+ /**
978
+ * Repeatable gantt item start time in seconds (0-86400)
979
+ */
980
+ fromTime: number;
981
+ /**
982
+ * Repeatable gantt item end time in seconds (0-86400)
983
+ */
984
+ toTime: number;
985
+ /**
986
+ * Start date of repeatable gantt items
987
+ */
988
+ fromDate?: string;
989
+ /**
990
+ * End date of Repeatable gantt items
991
+ */
992
+ toDate?: string;
993
+ /**
994
+ * Numbers of weekdays for repeating (0-6)
995
+ */
996
+ weekdays?: number[];
997
+ /**
998
+ * Numbers of monthdays for repeating (0-31)
999
+ */
1000
+ monthdays?: number[];
1001
+ startDate?: never;
1002
+ endDate?: never;
1003
+ };
1004
+
841
1005
  export declare function ResizableHandle({ withHandle, className, ...props }: React_2.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
842
1006
  withHandle?: boolean;
843
1007
  }): JSX.Element;
@@ -1078,6 +1242,10 @@ export declare function TooltipProvider({ delayDuration, ...props }: React_2.Com
1078
1242
 
1079
1243
  export declare function TooltipTrigger({ ...props }: React_2.ComponentProps<typeof TooltipPrimitive.Trigger>): JSX.Element;
1080
1244
 
1245
+ declare type TransformedDataType<T> = {
1246
+ [P in keyof T as Exclude<P, 'children'>]: T[P];
1247
+ };
1248
+
1081
1249
  export declare function TypingIndicator(): JSX.Element;
1082
1250
 
1083
1251
  export declare const Typo: React_2.FC<TypoProps>;