@trsys-tech/matrix-library 0.6.3-canary-0 → 0.6.3-canary-2

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.
@@ -1,5 +1,5 @@
1
1
  import { VariantProps, TVReturnType } from 'tailwind-variants';
2
- import { TVConfig } from 'tailwind-variants/dist/config';
2
+ import { TVConfig } from 'tailwind-variants/dist/config.js';
3
3
  import * as React from "react";
4
4
  declare const badgeVariants: TVReturnType<{
5
5
  variant: {
@@ -1,5 +1,5 @@
1
1
  import { VariantProps, TVReturnType } from 'tailwind-variants';
2
- import { TVConfig } from 'tailwind-variants/dist/config';
2
+ import { TVConfig } from 'tailwind-variants/dist/config.js';
3
3
  import * as React from "react";
4
4
  declare const buttonVariants: TVReturnType<{
5
5
  variant: {
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { VariantProps, TVReturnType } from 'tailwind-variants';
3
- import { TVConfig } from 'tailwind-variants/dist/config';
3
+ import { TVConfig } from 'tailwind-variants/dist/config.js';
4
4
  declare const chipVariants: TVReturnType<{
5
5
  variant: {
6
6
  primary: string;
@@ -4,7 +4,14 @@ import { GridApi, Theme, ThemeDefaultParams } from 'ag-grid-community';
4
4
  import { ButtonProps } from '../button/Button';
5
5
  import { IconButtonProps } from '../icon-botton/IconButton';
6
6
  import { PopoverContentProps, PopoverProps, PopoverTriggerProps } from '../popover/Popover';
7
+ type ResolveRowId = (data: unknown) => string | undefined;
8
+ /**
9
+ * Default ag-Grid theme used by DataGrid.
10
+ */
7
11
  declare const dataGridDefaultTheme: Theme< ThemeDefaultParams>;
12
+ /**
13
+ * Shared DataGrid state exposed through context.
14
+ */
8
15
  type DataGridContext = {
9
16
  api: GridApi | null;
10
17
  setApi: (value: GridApi) => void;
@@ -19,47 +26,169 @@ type DataGridContext = {
19
26
  setActionbarHeight: (value: number) => void;
20
27
  pinnedRowIds: Set<string>;
21
28
  setPinnedRowIds: (value: Set<string>) => void;
29
+ resolveRowIdRef: React.MutableRefObject<ResolveRowId>;
22
30
  };
23
31
  declare const DataGridContext: React.Context<DataGridContext | null>;
24
32
  declare const useDataGrid: () => DataGridContext;
33
+ /**
34
+ * Props for the root DataGrid provider.
35
+ */
25
36
  type DataGridProps = {
37
+ /** Content rendered inside the provider. */
26
38
  children: React.ReactNode;
27
39
  };
40
+ /**
41
+ * DataGrid provider.
42
+ * Provides shared state for the grid shell, content, and toolbar actions.
43
+ * @param {DataGridProps} props - DataGrid props.
44
+ * @param {React.ReactNode} children - Content rendered inside the provider.
45
+ * @returns {React.ReactElement}
46
+ */
28
47
  declare const DataGrid: React.FC<DataGridProps>;
48
+ /**
49
+ * Props for the Ag Grid content wrapper.
50
+ */
29
51
  type DataGridContentProps = Omit<AgGridReactProps, "theme"> & {
52
+ /** Optional theme override forwarded to ag-Grid. */
30
53
  theme?: Theme;
31
54
  };
55
+ /**
56
+ * DataGridContent component.
57
+ * Connects ag-Grid to the shared DataGrid context and keeps pinned rows separate from the main row set.
58
+ * @param {DataGridContentProps} props - Ag Grid props.
59
+ * @param {Theme} [theme] - Optional ag-Grid theme override.
60
+ * @param {GridReadyEvent} [onGridReady] - Called when the grid becomes ready.
61
+ * @param {any[] | null | undefined} [rowData] - Row data rendered by the grid.
62
+ * @param {string} [quickFilterText] - Quick filter text synced from the search action.
63
+ * @param {React.CSSProperties} [containerStyle] - Inline styles applied to the grid container.
64
+ * @param {Function} [getRowId] - Resolves the row id used to keep pinned rows stable.
65
+ * @param {React.ForwardedRef<AgGridReact>} ref - Grid ref.
66
+ * @returns {React.ReactElement}
67
+ */
32
68
  declare const DataGridContent: React.ForwardRefExoticComponent<Omit<AgGridReactProps<any>, "theme"> & {
69
+ /** Optional theme override forwarded to ag-Grid. */
33
70
  theme?: Theme;
34
71
  } & React.RefAttributes<AgGridReact<any>>>;
72
+ /**
73
+ * Props for the DataGrid action bar container.
74
+ */
35
75
  type DatagridActionBarProps = HTMLAttributes<HTMLDivElement> & {};
76
+ /**
77
+ * DataGrid action bar.
78
+ * Marks the grid as having a toolbar so the grid can adjust border radius and height.
79
+ * @param {DatagridActionBarProps} props - Action bar props.
80
+ * @param {React.ReactNode} children - Action bar content.
81
+ * @param {string} className - Additional classes applied to the action bar.
82
+ * @returns {React.ReactElement}
83
+ */
36
84
  declare const DataGridActionBar: React.FC<DatagridActionBarProps>;
85
+ /**
86
+ * Props for SearchAction.
87
+ */
37
88
  type SearchActionProps = HTMLAttributes<HTMLDivElement> & {
89
+ /** Opens the search input immediately on mount. */
38
90
  defaultOpen?: boolean;
91
+ /** Focuses the input the first time it opens. */
92
+ defaultOpenAutoFocus?: boolean;
39
93
  };
94
+ /**
95
+ * Search action.
96
+ * Toggles the quick filter input and manages its open/close focus behavior.
97
+ * @param {SearchActionProps} props - Search action props.
98
+ * @param {boolean} [defaultOpen] - Opens the search input immediately on mount.
99
+ * @param {boolean} [defaultOpenAutoFocus] - Focuses the input the first time it opens.
100
+ * @param {React.ReactNode} children - Optional wrapper content.
101
+ * @param {string} className - Additional wrapper classes.
102
+ * @returns {React.ReactElement}
103
+ */
40
104
  declare const SearchAction: React.FC<SearchActionProps>;
105
+ /**
106
+ * Props for FreezeAction.
107
+ */
41
108
  type FreezeActionProps = ButtonProps & {
109
+ /** Label shown when rows can be frozen. */
42
110
  freezeText?: string;
111
+ /** Label shown when rows are already frozen. */
43
112
  unFreezeText?: string;
44
113
  };
114
+ /**
115
+ * Freeze action.
116
+ * Pins the current selection when rows are selected, or clears pinned rows when the grid is already frozen.
117
+ * @param {FreezeActionProps} props - Freeze action props.
118
+ * @param {boolean} [disabled] - Disables the action button.
119
+ * @param {React.MouseEventHandler<HTMLButtonElement>} [onClick] - Called after the freeze toggle runs.
120
+ * @returns {React.ReactElement}
121
+ */
45
122
  declare const FreezeAction: React.FC<FreezeActionProps>;
123
+ /**
124
+ * Props for PrintAction.
125
+ */
46
126
  type PrintActionProps = IconButtonProps & {};
127
+ /**
128
+ * Print action.
129
+ * Switches the grid to print layout, captures the rendered markup, and opens the browser print flow.
130
+ * @param {PrintActionProps} props - Print action props.
131
+ * @param {React.ReactNode} [children] - Custom icon content rendered in the button.
132
+ * @param {string} [className] - Additional button classes.
133
+ * @param {React.MouseEventHandler<HTMLButtonElement>} [onClick] - Called after printing is triggered.
134
+ * @returns {React.ReactElement}
135
+ */
47
136
  declare const PrintAction: React.FC<PrintActionProps>;
137
+ /**
138
+ * Props for RefreshAction.
139
+ */
48
140
  type RefreshActionProps = Omit<IconButtonProps, "onClick"> & {
141
+ /** Callback invoked when the refresh action is clicked. */
49
142
  onRefresh: () => void;
50
143
  };
144
+ /**
145
+ * Refresh action.
146
+ * Calls the provided refresh callback and reflects the loading state in the toolbar button.
147
+ * @param {RefreshActionProps} props - Refresh action props.
148
+ * @param {() => void} onRefresh - Called when the button is clicked.
149
+ * @param {boolean} [loading] - Shows the loading spinner and disables the button.
150
+ * @param {React.ReactNode} [children] - Custom icon content rendered in the button.
151
+ * @param {string} [className] - Additional button classes.
152
+ * @returns {React.ReactElement}
153
+ */
51
154
  declare const RefreshAction: React.FC<RefreshActionProps>;
155
+ /**
156
+ * Props for DeleteAction.
157
+ */
52
158
  type DeleteActionProps = Omit<ButtonProps, "onClick"> & {
159
+ /** Callback invoked when the delete action is clicked. */
53
160
  onDelete: () => void;
54
161
  };
162
+ /**
163
+ * Delete action.
164
+ * Renders a danger button with the delete icon and delegates the click to the provided handler.
165
+ * @param {DeleteActionProps} props - Delete action props.
166
+ * @param {() => void} onDelete - Called when the button is clicked.
167
+ * @param {React.ReactNode} [children] - Button label or custom content.
168
+ * @returns {React.ReactElement}
169
+ */
55
170
  declare const DeleteAction: React.FC<DeleteActionProps>;
171
+ /**
172
+ * Props for ExtraActions.
173
+ */
56
174
  type ExtraActionsProps = PopoverContentProps & {
175
+ /** Menu items rendered inside the popover. */
57
176
  children: React.ReactNode;
177
+ /** Props forwarded to the popover trigger and popover root. */
58
178
  slotProps?: {
59
179
  triggerProps?: PopoverTriggerProps;
60
180
  popoverProps?: PopoverProps;
61
181
  };
62
182
  };
183
+ /**
184
+ * Extra actions menu.
185
+ * Wraps overflow actions in a popover anchored to the vertical ellipsis trigger.
186
+ * @param {ExtraActionsProps} props - Extra actions props.
187
+ * @param {React.ReactNode} children - Menu items rendered inside the popover.
188
+ * @param {{ triggerProps?: PopoverTriggerProps; popoverProps?: PopoverProps; }} [slotProps] - Props forwarded to the trigger and popover root.
189
+ * @param {string} [className] - Additional popover content classes.
190
+ * @returns {React.ReactElement}
191
+ */
63
192
  declare const ExtraActions: React.FC<ExtraActionsProps>;
64
193
  export { DataGrid, DataGridContent, DataGridActionBar, SearchAction, FreezeAction, PrintAction, RefreshAction, ExtraActions, DeleteAction, type DataGridProps, type DataGridContentProps, type DatagridActionBarProps, type SearchActionProps, type FreezeActionProps, type RefreshActionProps, type ExtraActionsProps, type DeleteActionProps, useDataGrid, dataGridDefaultTheme, };
65
194
  //# sourceMappingURL=DataGrid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataGrid.d.ts","sourceRoot":"","sources":["../../../src/components/data-grid/DataGrid.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAc,cAAc,EAAW,MAAM,OAAO,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAmE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAMpH,OAAO,EAAU,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAc,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAA2B,mBAAmB,EAAE,YAAY,EAAkB,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAMrI,QAAA,MAAM,oBAAoB,uDAUxB,CAAC;AAEH,KAAK,eAAe,GAAG;IACrB,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC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B,CAAC;CACH,CAAC;AAEF;;;;;;;;GAQG;AACH,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAW7C,CAAC;AAEF,OAAO,EACL,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,WAAW,EACX,oBAAoB,GACrB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DesktopDatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/DesktopDatePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAmB,MAAM,kBAAkB,CAAC;AAO3E,KAAK,sBAAsB,GAAG,SAAS,GACrC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEJ,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAmDvD,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,CAAC"}
1
+ {"version":3,"file":"DesktopDatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/DesktopDatePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAmB,MAAM,kBAAkB,CAAC;AAO3E,KAAK,sBAAsB,GAAG,SAAS,GACrC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEJ,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAoDvD,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { VariantProps, TVReturnType } from 'tailwind-variants';
2
- import { TVConfig } from 'tailwind-variants/dist/config';
2
+ import { TVConfig } from 'tailwind-variants/dist/config.js';
3
3
  import * as React from "react";
4
4
  declare const textFieldVariants: TVReturnType<{
5
5
  size: {
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { VariantProps, TVReturnType } from 'tailwind-variants';
3
- import { TVConfig } from 'tailwind-variants/dist/config';
3
+ import { TVConfig } from 'tailwind-variants/dist/config.js';
4
4
  declare const iconButtonVariants: TVReturnType<{
5
5
  variant: {
6
6
  table: string;
@@ -1,5 +1,5 @@
1
1
  import { VariantProps, TVReturnType } from 'tailwind-variants';
2
- import { TVConfig } from 'tailwind-variants/dist/config';
2
+ import { TVConfig } from 'tailwind-variants/dist/config.js';
3
3
  import * as React from "react";
4
4
  declare const Label: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & VariantProps< TVReturnType<{} | {} | {}, undefined, "text-xs font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70", TVConfig<unknown, {} | {}>, {} | {}, undefined, TVReturnType<unknown, undefined, "text-xs font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70", TVConfig<unknown, {} | {}>, unknown, unknown, undefined>>> & React.RefAttributes<HTMLLabelElement>>;
5
5
  type LabelProps = React.ComponentProps<typeof Label>;
@@ -1 +1 @@
1
- {"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/components/label/Label.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAM1D,QAAA,MAAM,KAAK,ypBAEV,CAAC;AAEF,KAAK,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC;AAErD,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/components/label/Label.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAM1D,QAAA,MAAM,KAAK,+pBAEV,CAAC;AAEF,KAAK,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC;AAErD,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { VariantProps, TVReturnType } from 'tailwind-variants';
2
- import { TVConfig } from 'tailwind-variants/dist/config';
2
+ import { TVConfig } from 'tailwind-variants/dist/config.js';
3
3
  import * as React from "react";
4
4
  /**
5
5
  * Variants for the multi-select component to handle different styles.
@@ -1,5 +1,5 @@
1
1
  import { VariantProps, TVReturnType } from 'tailwind-variants';
2
- import { TVConfig } from 'tailwind-variants/dist/config';
2
+ import { TVConfig } from 'tailwind-variants/dist/config.js';
3
3
  import * as React from "react";
4
4
  import * as ProgressPrimitive from "@radix-ui/react-progress";
5
5
  declare const progressVariants: TVReturnType<{
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { VariantProps, TVReturnType } from 'tailwind-variants';
3
- import { TVConfig } from 'tailwind-variants/dist/config';
3
+ import { TVConfig } from 'tailwind-variants/dist/config.js';
4
4
  declare const ratingVariants: TVReturnType<{
5
5
  variant: {
6
6
  default: string;
@@ -1,6 +1,6 @@
1
1
  import { DialogProps as SheetProps, DialogTriggerProps as SheetTriggerProps, DialogCloseProps as SheetCloseProps, DialogPortalProps as SheetPortalProps, DialogOverlayProps as SheetOverlayProps, DialogDescriptionProps as SheetDescriptionProps, DialogTitleProps as SheetTitleProps } from '@radix-ui/react-dialog';
2
2
  import { VariantProps, TVReturnType } from 'tailwind-variants';
3
- import { TVConfig } from 'tailwind-variants/dist/config';
3
+ import { TVConfig } from 'tailwind-variants/dist/config.js';
4
4
  import * as React from "react";
5
5
  import * as SheetPrimitive from "@radix-ui/react-dialog";
6
6
  declare const Sheet: React.FC<SheetPrimitive.DialogProps>;
@@ -1,7 +1,7 @@
1
1
  import { VariantProps, TVReturnType } from 'tailwind-variants';
2
2
  import { TooltipContent } from '../tooltip/Tooltip';
3
3
  import { SeparatorProps } from '@radix-ui/react-separator';
4
- import { TVConfig } from 'tailwind-variants/dist/config';
4
+ import { TVConfig } from 'tailwind-variants/dist/config.js';
5
5
  import * as React from "react";
6
6
  type SidebarContext = {
7
7
  state: "expanded" | "collapsed";
@@ -1,5 +1,5 @@
1
1
  import { VariantProps, TVReturnType } from 'tailwind-variants';
2
- import { TVConfig } from 'tailwind-variants/dist/config';
2
+ import { TVConfig } from 'tailwind-variants/dist/config.js';
3
3
  import * as React from "react";
4
4
  import * as SwitchPrimitives from "@radix-ui/react-switch";
5
5
  declare const switchVariants: TVReturnType<{
@@ -1,5 +1,5 @@
1
1
  import { VariantProps, TVReturnType } from 'tailwind-variants';
2
- import { TVConfig } from 'tailwind-variants/dist/config';
2
+ import { TVConfig } from 'tailwind-variants/dist/config.js';
3
3
  import * as React from "react";
4
4
  declare const textFieldVariants: TVReturnType<{
5
5
  size: {
@@ -1,5 +1,5 @@
1
1
  import { VariantProps, TVReturnType } from 'tailwind-variants';
2
- import { TVConfig } from 'tailwind-variants/dist/config';
2
+ import { TVConfig } from 'tailwind-variants/dist/config.js';
3
3
  import * as React from "react";
4
4
  import * as ToastPrimitives from "@radix-ui/react-toast";
5
5
  declare const ToastProvider: React.FC<ToastPrimitives.ToastProviderProps>;
@@ -1,16 +1,16 @@
1
- import { jsx as o, jsxs as z } from "react/jsx-runtime";
2
- import e, { forwardRef as H, useMemo as G } from "react";
3
- import { AgGridReact as L } from "ag-grid-react";
4
- import { themeQuartz as M, ModuleRegistry as B, AllCommunityModule as Q } from "ag-grid-community";
5
- import { Trashcan as O, ElipsisVertical as q, Snowflake as $, Print as j, Refresh as _, CircleXmark as U, Magnifier as N } from "@trsys-tech/matrix-icons";
6
- import { cn as g } from "./utils.es.js";
7
- import { printHtml as V } from "./printhtml.es.js";
8
- import { TextField as W } from "./textfield.es.js";
9
- import { Button as k } from "./button.es.js";
10
- import { IconButton as v } from "./iconbutton.es.js";
11
- import { Popover as X, PopoverTrigger as J, PopoverContent as K } from "./popover.es.js";
12
- B.registerModules([Q]);
13
- const Y = M.withParams({
1
+ import { jsx as i, jsxs as M } from "react/jsx-runtime";
2
+ import e, { forwardRef as L, useMemo as N } from "react";
3
+ import { AgGridReact as B } from "ag-grid-react";
4
+ import { themeQuartz as Q, ModuleRegistry as O, AllCommunityModule as q } from "ag-grid-community";
5
+ import { Trashcan as $, ElipsisVertical as j, Snowflake as _, Print as U, Refresh as V, CircleXmark as W, Magnifier as k } from "@trsys-tech/matrix-icons";
6
+ import { cn as C } from "./utils.es.js";
7
+ import { printHtml as X } from "./printhtml.es.js";
8
+ import { TextField as J } from "./textfield.es.js";
9
+ import { Button as P } from "./button.es.js";
10
+ import { IconButton as E } from "./iconbutton.es.js";
11
+ import { Popover as K, PopoverTrigger as Y, PopoverContent as Z } from "./popover.es.js";
12
+ O.registerModules([q]);
13
+ const ee = Q.withParams({
14
14
  fontFamily: "DMSans",
15
15
  fontSize: "12px",
16
16
  headerFontSize: "12px",
@@ -20,212 +20,235 @@ const Y = M.withParams({
20
20
  accentColor: "hsl(var(--primary-300))",
21
21
  foregroundColor: "hsl(var(--text-500))",
22
22
  cellTextColor: "hsl(var(--text-500))"
23
- }), w = e.createContext(null), ue = () => {
24
- const r = e.useContext(w);
25
- if (!r)
23
+ }), T = (n) => {
24
+ const t = n?.id;
25
+ return t != null ? String(t) : void 0;
26
+ }, te = (n) => n ? (t) => {
27
+ const r = n({ data: t, level: 0 });
28
+ return r != null ? String(r) : T(t);
29
+ } : T, R = e.createContext(null), pe = () => {
30
+ const n = e.useContext(R);
31
+ if (!n)
26
32
  throw new Error("useDataGrid should be used within <DataGrid>");
27
- return r;
28
- }, he = ({ children: r }) => {
29
- const s = e.useId(), [i, n] = e.useState(null), [a, c] = e.useState([]), [d, u] = e.useState(0), [h, l] = e.useState(/* @__PURE__ */ new Set()), [t, p] = e.useState(""), [f, m] = e.useState(!1);
30
- return /* @__PURE__ */ o(
31
- w.Provider,
33
+ return n;
34
+ }, we = ({ children: n }) => {
35
+ const t = e.useId(), [r, a] = e.useState(null), [s, c] = e.useState([]), [l, u] = e.useState(0), [f, d] = e.useState(/* @__PURE__ */ new Set()), o = e.useRef(T), [h, p] = e.useState(""), [w, x] = e.useState(!1);
36
+ return /* @__PURE__ */ i(
37
+ R.Provider,
32
38
  {
33
39
  value: {
34
- api: i,
35
- setApi: n,
36
- rowData: a,
40
+ api: r,
41
+ setApi: a,
42
+ rowData: s,
37
43
  setRowData: c,
38
- gridId: s,
39
- quickFilterText: t,
44
+ gridId: t,
45
+ quickFilterText: h,
40
46
  setQuickFilterText: p,
41
- actionbarExists: f,
42
- setActionbarExists: m,
43
- actionbarHeight: d,
47
+ actionbarExists: w,
48
+ setActionbarExists: x,
49
+ actionbarHeight: l,
44
50
  setActionbarHeight: u,
45
- pinnedRowIds: h,
46
- setPinnedRowIds: l
51
+ pinnedRowIds: f,
52
+ setPinnedRowIds: d,
53
+ resolveRowIdRef: o
47
54
  },
48
- children: r
55
+ children: n
49
56
  }
50
57
  );
51
- }, Z = H(
52
- ({ theme: r, onGridReady: s, quickFilterText: i, rowData: n, containerStyle: a, getRowId: c, ...d }, u) => {
53
- const h = e.useContext(w);
54
- if (!h)
58
+ }, ne = L(
59
+ ({ theme: n, onGridReady: t, quickFilterText: r, rowData: a, containerStyle: s, getRowId: c, ...l }, u) => {
60
+ const f = e.useContext(R);
61
+ if (!f)
55
62
  throw new Error("DataGridContent should be used within <DataGrid>");
56
- const { rowData: l, setRowData: t, actionbarExists: p, setApi: f, setQuickFilterText: m, quickFilterText: b, gridId: E, actionbarHeight: C, pinnedRowIds: x } = h, D = G(() => Y.withParams({
63
+ const {
64
+ rowData: d,
65
+ setRowData: o,
66
+ actionbarExists: h,
67
+ setApi: p,
68
+ setQuickFilterText: w,
69
+ quickFilterText: x,
70
+ gridId: b,
71
+ actionbarHeight: D,
72
+ pinnedRowIds: m,
73
+ resolveRowIdRef: g
74
+ } = f, v = e.useMemo(() => te(c), [c]), y = N(() => ee.withParams({
57
75
  headerHeight: 40,
58
- wrapperBorderRadius: p ? "0px 0px 8px 8px" : "8px"
59
- }), [p]), P = (R) => {
60
- f(R.api), s?.(R);
76
+ wrapperBorderRadius: h ? "0px 0px 8px 8px" : "8px"
77
+ }), [h]);
78
+ e.useEffect(() => (g.current = v, () => {
79
+ g.current = T;
80
+ }), [v, g]);
81
+ const F = (S) => {
82
+ p(S.api), t?.(S);
61
83
  };
62
84
  e.useEffect(() => {
63
- t(n);
64
- }, [n, t]), e.useEffect(() => {
65
- i !== void 0 && m(i ?? "");
66
- }, [i, m]);
67
- const { finalRowData: F, finalPinnedTopRowData: I } = G(() => {
68
- if (!l || x.size === 0)
69
- return { finalRowData: l, finalPinnedTopRowData: [] };
70
- const R = [], A = [];
71
- return l.forEach((S) => {
72
- const y = c ? c({ data: S, level: 0 }) : S.id, T = y != null ? String(y) : void 0;
73
- T !== void 0 && x.has(T) ? R.push(S) : A.push(S);
74
- }), { finalRowData: A, finalPinnedTopRowData: R };
75
- }, [l, x, c]);
76
- return /* @__PURE__ */ o(
77
- L,
85
+ o(a);
86
+ }, [a, o]), e.useEffect(() => {
87
+ r !== void 0 && w(r ?? "");
88
+ }, [r, w]);
89
+ const { finalRowData: z, finalPinnedTopRowData: H } = N(() => {
90
+ if (!d || m.size === 0)
91
+ return { finalRowData: d, finalPinnedTopRowData: [] };
92
+ const S = [], G = [];
93
+ return d.forEach((A) => {
94
+ const I = v(A);
95
+ I !== void 0 && m.has(I) ? S.push(A) : G.push(A);
96
+ }), { finalRowData: G, finalPinnedTopRowData: S };
97
+ }, [d, m, v]);
98
+ return /* @__PURE__ */ i(
99
+ B,
78
100
  {
79
- gridId: E,
80
- theme: r ?? D,
81
- rowData: F,
82
- pinnedTopRowData: I,
83
- quickFilterText: b,
84
- onGridReady: P,
85
- containerStyle: { height: `calc(100% - ${C}px)`, ...a },
101
+ gridId: b,
102
+ theme: n ?? y,
103
+ rowData: z,
104
+ pinnedTopRowData: H,
105
+ quickFilterText: x,
106
+ onGridReady: F,
107
+ containerStyle: { height: `calc(100% - ${D}px)`, ...s },
86
108
  getRowId: c,
87
- ...d,
109
+ ...l,
88
110
  ref: u
89
111
  }
90
112
  );
91
113
  }
92
114
  );
93
- Z.displayName = "DataGridContent";
94
- const pe = ({ className: r, ...s }) => {
95
- const i = e.useContext(w);
96
- if (!i)
115
+ ne.displayName = "DataGridContent";
116
+ const me = ({ className: n, ...t }) => {
117
+ const r = e.useContext(R);
118
+ if (!r)
97
119
  throw new Error("DataGridActionBar should be used within <DataGrid>");
98
- const n = e.useRef(null), { setActionbarExists: a, setActionbarHeight: c } = i, { children: d } = s;
99
- return e.useEffect(() => (a(!0), () => a(!1)), [a]), e.useEffect(() => {
100
- n.current && c(n.current.clientHeight);
101
- }, [c]), /* @__PURE__ */ o(
120
+ const a = e.useRef(null), { setActionbarExists: s, setActionbarHeight: c } = r, { children: l } = t;
121
+ return e.useEffect(() => (s(!0), () => s(!1)), [s]), e.useEffect(() => {
122
+ a.current && c(a.current.clientHeight);
123
+ }, [c]), /* @__PURE__ */ i(
102
124
  "div",
103
125
  {
104
- className: g(
126
+ className: C(
105
127
  "relative flex items-center p-2 h-12 w-full bg-gray-0 border border-gray-200 border-b-0 -mb-[1px] z-10 rounded-t-[8px]",
106
- r
128
+ n
107
129
  ),
108
- ref: n,
109
- children: d
130
+ ref: a,
131
+ children: l
110
132
  }
111
133
  );
112
- }, fe = ({ defaultOpen: r = !1, className: s, ...i }) => {
113
- const n = e.useContext(w);
114
- if (!n)
134
+ }, Re = ({ defaultOpen: n = !1, defaultOpenAutoFocus: t = !0, className: r, ...a }) => {
135
+ const s = e.useContext(R);
136
+ if (!s)
115
137
  throw new Error("SearchAction should be used within <DataGrid>");
116
- const { quickFilterText: a, setQuickFilterText: c } = n, [d, u] = e.useState(r), [h, l] = e.useState(!1), t = e.useRef(null), p = () => {
117
- n.setQuickFilterText(""), t.current && t.current.focus();
118
- }, f = () => {
119
- u(!0);
138
+ const { quickFilterText: c, setQuickFilterText: l } = s, [u, f] = e.useState(n), [d, o] = e.useState(!1), h = e.useRef(null), p = e.useRef(!0), w = () => {
139
+ s.setQuickFilterText(""), h.current && h.current.focus();
140
+ }, x = () => {
141
+ f(!0);
120
142
  };
121
143
  e.useEffect(() => {
122
- d && t?.current && t.current.focus();
123
- }, [d]);
124
- const m = () => {
125
- l(!0), n.setQuickFilterText(""), setTimeout(() => {
126
- u(!1), l(!1);
144
+ u && h?.current && (t || !p.current) && h.current.focus(), p.current = !1;
145
+ }, [u, t]);
146
+ const b = () => {
147
+ o(!0), s.setQuickFilterText(""), setTimeout(() => {
148
+ f(!1), o(!1);
127
149
  }, 200);
128
150
  };
129
- return /* @__PURE__ */ o("div", { className: g("max-w-60", s), ...i, children: d || h ? /* @__PURE__ */ o(
130
- W,
151
+ return /* @__PURE__ */ i("div", { className: C("max-w-60", r), ...a, children: u || d ? /* @__PURE__ */ i(
152
+ J,
131
153
  {
132
- ref: t,
133
- className: g("relative h-7.5", d && !h ? "animate-input-open" : "", h && "animate-input-close"),
134
- onChange: (b) => c(b.target.value),
135
- value: a,
136
- startAdornment: /* @__PURE__ */ o(v, { type: "button", variant: "toolbar", className: "p-0.5 h-6 w-6 border-none mx-1", onClick: m, children: /* @__PURE__ */ o(N, { className: "w-5 h-5" }) }),
137
- endAdornment: a && /* @__PURE__ */ o(v, { type: "button", variant: "toolbar", className: "p-0.5 w-6 h-6 border-none mx-1", onClick: p, children: /* @__PURE__ */ o(U, { className: "w-5 h-5" }) })
154
+ ref: h,
155
+ className: C("relative h-7.5", u && !d ? "animate-input-open" : "", d && "animate-input-close"),
156
+ onChange: (D) => l(D.target.value),
157
+ value: c,
158
+ startAdornment: /* @__PURE__ */ i(E, { type: "button", variant: "toolbar", className: "p-0.5 h-6 w-6 border-none mx-1", onClick: b, children: /* @__PURE__ */ i(k, { className: "w-5 h-5" }) }),
159
+ endAdornment: c && /* @__PURE__ */ i(E, { type: "button", variant: "toolbar", className: "p-0.5 w-6 h-6 border-none mx-1", onClick: w, children: /* @__PURE__ */ i(W, { className: "w-5 h-5" }) })
138
160
  }
139
- ) : /* @__PURE__ */ o(v, { type: "button", variant: "toolbar", className: "p-0.5 w-6 h-6 m-1", onClick: f, children: /* @__PURE__ */ o(N, { className: "w-5 h-5" }) }) });
140
- }, me = ({ freezeText: r, unFreezeText: s, onClick: i, disabled: n, ...a }) => {
141
- const c = e.useContext(w);
161
+ ) : /* @__PURE__ */ i(E, { type: "button", variant: "toolbar", className: "p-0.5 w-6 h-6 m-1", onClick: x, children: /* @__PURE__ */ i(k, { className: "w-5 h-5" }) }) });
162
+ }, xe = ({ freezeText: n, unFreezeText: t, onClick: r, disabled: a, ...s }) => {
163
+ const c = e.useContext(R);
142
164
  if (!c)
143
165
  throw new Error("FreezeAction should be used within <DataGrid>");
144
- const [d, u] = e.useState(0), [h, l] = e.useState(0), { api: t, pinnedRowIds: p, setPinnedRowIds: f } = c, m = () => {
145
- if (!t) return;
146
- const C = t.getSelectedNodes();
147
- if (C.length > 0) {
148
- const x = new Set(p);
149
- C.forEach((D) => {
150
- D.id !== void 0 && x.add(D.id);
151
- }), f(x), t.deselectAll();
166
+ const [l, u] = e.useState(0), [f, d] = e.useState(0), { api: o, pinnedRowIds: h, setPinnedRowIds: p, resolveRowIdRef: w } = c, x = () => {
167
+ if (!o) return;
168
+ const m = o.getSelectedRows();
169
+ if (m.length > 0) {
170
+ const g = new Set(h);
171
+ m.forEach((v) => {
172
+ const y = w.current(v);
173
+ y !== void 0 && g.add(y);
174
+ }), p(g), o.deselectAll();
152
175
  }
153
176
  }, b = () => {
154
- f(/* @__PURE__ */ new Set());
155
- }, E = (C) => {
156
- t && (t.getPinnedTopRowCount() > 0 ? b() : m()), i?.(C);
177
+ p(/* @__PURE__ */ new Set());
178
+ }, D = (m) => {
179
+ o && (o.getPinnedTopRowCount() > 0 ? b() : x()), r?.(m);
157
180
  };
158
- return e.useEffect(() => (t?.addEventListener("pinnedRowDataChanged", () => {
159
- u(t.getPinnedTopRowCount());
160
- }), t?.addEventListener("selectionChanged", () => {
161
- l(t.getSelectedNodes().length);
181
+ return e.useEffect(() => (o?.addEventListener("pinnedRowDataChanged", () => {
182
+ u(o.getPinnedTopRowCount());
183
+ }), o?.addEventListener("selectionChanged", () => {
184
+ d(o.getSelectedNodes().length);
162
185
  }), () => {
163
- t?.isDestroyed() || (t?.removeEventListener("pinnedRowDataChanged", () => {
164
- u(t.getPinnedTopRowCount());
165
- }), t?.removeEventListener("selectionChanged", () => {
166
- l(t.getSelectedNodes().length);
186
+ o?.isDestroyed() || (o?.removeEventListener("pinnedRowDataChanged", () => {
187
+ u(o.getPinnedTopRowCount());
188
+ }), o?.removeEventListener("selectionChanged", () => {
189
+ d(o.getSelectedNodes().length);
167
190
  }));
168
- }), [t]), /* @__PURE__ */ o(
169
- k,
191
+ }), [o]), /* @__PURE__ */ i(
192
+ P,
170
193
  {
171
194
  variant: "text",
172
195
  type: "button",
173
- onClick: E,
174
- startIcon: /* @__PURE__ */ o($, { className: "w-4.5 h-4.5" }),
175
- disabled: !d && !h || n,
176
- ...a,
177
- children: d ? s ?? "Unfreeze" : r ?? "Freeze"
196
+ onClick: D,
197
+ startIcon: /* @__PURE__ */ i(_, { className: "w-4.5 h-4.5" }),
198
+ disabled: !l && !f || a,
199
+ ...s,
200
+ children: l ? t ?? "Unfreeze" : n ?? "Freeze"
178
201
  }
179
202
  );
180
- }, we = ({ children: r, className: s, onClick: i, ...n }) => {
181
- const a = e.useContext(w);
182
- if (!a)
203
+ }, ge = ({ children: n, className: t, onClick: r, ...a }) => {
204
+ const s = e.useContext(R);
205
+ if (!s)
183
206
  throw new Error("PrintAction should be used within <DataGrid>");
184
- const c = (d) => {
185
- a.api && (a.api.setGridOption("domLayout", "print"), setTimeout(() => {
186
- const u = document.querySelector("[grid-id='" + a.gridId + "']"), l = `<html>
207
+ const c = (l) => {
208
+ s.api && (s.api.setGridOption("domLayout", "print"), setTimeout(() => {
209
+ const u = document.querySelector("[grid-id='" + s.gridId + "']"), d = `<html>
187
210
  ${document.head.innerHTML}
188
211
  ${u.outerHTML}
189
212
  </html>`;
190
- V(l), a?.api?.setGridOption("domLayout", void 0);
191
- })), i?.(d);
213
+ X(d), s?.api?.setGridOption("domLayout", void 0);
214
+ })), r?.(l);
192
215
  };
193
- return /* @__PURE__ */ o(v, { type: "button", variant: "toolbar", className: g("p-0.5 w-6 h-6", s), onClick: c, ...n, children: r ?? /* @__PURE__ */ o(j, { className: "w-5 h-5" }) });
194
- }, xe = ({ className: r, onRefresh: s, children: i, loading: n, ...a }) => {
195
- if (!e.useContext(w))
216
+ return /* @__PURE__ */ i(E, { type: "button", variant: "toolbar", className: C("p-0.5 w-6 h-6", t), onClick: c, ...a, children: n ?? /* @__PURE__ */ i(U, { className: "w-5 h-5" }) });
217
+ }, Ce = ({ className: n, onRefresh: t, children: r, loading: a, ...s }) => {
218
+ if (!e.useContext(R))
196
219
  throw new Error("RefreshAction should be used within <DataGrid>");
197
- const d = () => {
198
- s();
220
+ const l = () => {
221
+ t();
199
222
  };
200
- return /* @__PURE__ */ o(
201
- v,
223
+ return /* @__PURE__ */ i(
224
+ E,
202
225
  {
203
226
  type: "button",
204
- className: g("p-0.5 w-6 h-6", n && "disabled:bg-transparent", r),
227
+ className: C("p-0.5 w-6 h-6", a && "disabled:bg-transparent", n),
205
228
  variant: "toolbar",
206
- onClick: d,
207
- disabled: n,
208
- ...a,
209
- children: i ?? /* @__PURE__ */ o(_, { className: g("w-4.5 h-4.5", n && "animate-spin") })
229
+ onClick: l,
230
+ disabled: a,
231
+ ...s,
232
+ children: r ?? /* @__PURE__ */ i(V, { className: C("w-4.5 h-4.5", a && "animate-spin") })
210
233
  }
211
234
  );
212
- }, ge = ({ onDelete: r, children: s, ...i }) => /* @__PURE__ */ o(k, { variant: "danger", type: "button", onClick: () => {
213
- r();
214
- }, startIcon: /* @__PURE__ */ o(O, { className: "w-4.5 h-4.5" }), ...i, children: s }), Ce = ({ children: r, slotProps: s, className: i, ...n }) => /* @__PURE__ */ z(X, { ...s?.popoverProps ?? {}, children: [
215
- /* @__PURE__ */ o(J, { ...s?.triggerProps ?? {}, children: /* @__PURE__ */ o(q, { className: "w-4.5 h-4.5 text-primary" }) }),
216
- /* @__PURE__ */ o(K, { align: "end", className: g("w-40", i), ...n, children: r })
235
+ }, ve = ({ onDelete: n, children: t, ...r }) => /* @__PURE__ */ i(P, { variant: "danger", type: "button", onClick: () => {
236
+ n();
237
+ }, startIcon: /* @__PURE__ */ i($, { className: "w-4.5 h-4.5" }), ...r, children: t }), be = ({ children: n, slotProps: t, className: r, ...a }) => /* @__PURE__ */ M(K, { ...t?.popoverProps ?? {}, children: [
238
+ /* @__PURE__ */ i(Y, { ...t?.triggerProps ?? {}, children: /* @__PURE__ */ i(j, { className: "w-4.5 h-4.5 text-primary" }) }),
239
+ /* @__PURE__ */ i(Z, { align: "end", className: C("w-40", r), ...a, children: n })
217
240
  ] });
218
241
  export {
219
- he as DataGrid,
220
- pe as DataGridActionBar,
221
- Z as DataGridContent,
222
- ge as DeleteAction,
223
- Ce as ExtraActions,
224
- me as FreezeAction,
225
- we as PrintAction,
226
- xe as RefreshAction,
227
- fe as SearchAction,
228
- Y as dataGridDefaultTheme,
229
- ue as useDataGrid
242
+ we as DataGrid,
243
+ me as DataGridActionBar,
244
+ ne as DataGridContent,
245
+ ve as DeleteAction,
246
+ be as ExtraActions,
247
+ xe as FreezeAction,
248
+ ge as PrintAction,
249
+ Ce as RefreshAction,
250
+ Re as SearchAction,
251
+ ee as dataGridDefaultTheme,
252
+ pe as useDataGrid
230
253
  };
231
254
  //# sourceMappingURL=datagrid.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"datagrid.es.js","sources":["../src/components/data-grid/DataGrid.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport React, { forwardRef, HTMLAttributes, useMemo } from \"react\";\r\nimport { AgGridReact, AgGridReactProps } from \"ag-grid-react\";\r\nimport { GridApi, GridReadyEvent, themeQuartz, AllCommunityModule, ModuleRegistry, Theme } from \"ag-grid-community\";\r\nimport { CircleXmark, ElipsisVertical, Magnifier, Print, Refresh, Snowflake, Trashcan } from \"@trsys-tech/matrix-icons\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\nimport { printHtml } from \"../../lib/printHtml\";\r\nimport { TextField } from \"../text-field/TextField\";\r\nimport { Button, ButtonProps } from \"../button/Button\";\r\nimport { IconButton, IconButtonProps } from \"../icon-botton/IconButton\";\r\nimport { Popover, PopoverContent, PopoverContentProps, PopoverProps, PopoverTrigger, PopoverTriggerProps } from \"../popover/Popover\";\r\n\r\n// Register all Community features\r\n// Todo: Register only the required features\r\nModuleRegistry.registerModules([AllCommunityModule]);\r\n\r\nconst dataGridDefaultTheme = themeQuartz.withParams({\r\n fontFamily: \"DMSans\",\r\n fontSize: \"12px\",\r\n headerFontSize: \"12px\",\r\n headerFontWeight: 700,\r\n headerBackgroundColor: \"hsl(var(--primary-50))\",\r\n backgroundColor: \"hsl(var(--gray-0))\",\r\n accentColor: \"hsl(var(--primary-300))\",\r\n foregroundColor: \"hsl(var(--text-500))\",\r\n cellTextColor: \"hsl(var(--text-500))\",\r\n});\r\n\r\ntype DataGridContext = {\r\n api: GridApi | null;\r\n setApi: (value: GridApi) => void;\r\n rowData: any[] | null | undefined;\r\n setRowData: (value: any[] | null | undefined) => void;\r\n gridId: string;\r\n quickFilterText: string;\r\n setQuickFilterText: (value: string) => void;\r\n actionbarExists: boolean;\r\n setActionbarExists: (value: boolean) => void;\r\n actionbarHeight: number;\r\n setActionbarHeight: (value: number) => void;\r\n pinnedRowIds: Set<string>;\r\n setPinnedRowIds: (value: Set<string>) => void;\r\n};\r\n\r\nconst DataGridContext = React.createContext<DataGridContext | null>(null);\r\n\r\nconst useDataGrid = () => {\r\n const context = React.useContext(DataGridContext);\r\n\r\n if (!context) {\r\n throw new Error(\"useDataGrid should be used within <DataGrid>\");\r\n }\r\n\r\n return context;\r\n};\r\n\r\ntype DataGridProps = {\r\n children: React.ReactNode;\r\n};\r\n\r\nconst DataGrid: React.FC<DataGridProps> = ({ children }) => {\r\n const gridId = React.useId();\r\n const [api, setApi] = React.useState<GridApi | null>(null);\r\n const [rowData, setRowData] = React.useState<any[] | null | undefined>([]);\r\n const [actionbarHeight, setActionbarHeight] = React.useState(0);\r\n const [pinnedRowIds, setPinnedRowIds] = React.useState<Set<string>>(new Set());\r\n\r\n const [quickFilterText, setQuickFilterText] = React.useState(\"\");\r\n const [actionbarExists, setActionbarExists] = React.useState(false);\r\n return (\r\n <DataGridContext.Provider\r\n value={{\r\n api,\r\n setApi,\r\n rowData,\r\n setRowData,\r\n gridId,\r\n quickFilterText,\r\n setQuickFilterText,\r\n actionbarExists,\r\n setActionbarExists,\r\n actionbarHeight,\r\n setActionbarHeight,\r\n pinnedRowIds,\r\n setPinnedRowIds,\r\n }}\r\n >\r\n {children}\r\n </DataGridContext.Provider>\r\n );\r\n};\r\n\r\ntype DataGridContentProps = Omit<AgGridReactProps, \"theme\"> & {\r\n theme?: Theme;\r\n};\r\n\r\nconst DataGridContent = forwardRef<AgGridReact, DataGridContentProps>(\r\n ({ theme: propTheme, onGridReady, quickFilterText: quickFilterTextProps, rowData: rowDataProps, containerStyle, getRowId, ...props }, ref) => {\r\n const context = React.useContext(DataGridContext);\r\n\r\n if (!context) {\r\n throw new Error(\"DataGridContent should be used within <DataGrid>\");\r\n }\r\n const { rowData, setRowData, actionbarExists, setApi, setQuickFilterText, quickFilterText, gridId, actionbarHeight, pinnedRowIds } = context;\r\n\r\n const theme = useMemo(() => {\r\n return dataGridDefaultTheme.withParams({\r\n headerHeight: 40,\r\n wrapperBorderRadius: actionbarExists ? \"0px 0px 8px 8px\" : \"8px\",\r\n });\r\n }, [actionbarExists]);\r\n\r\n const handleGridReady = (e: GridReadyEvent) => {\r\n setApi(e.api);\r\n onGridReady?.(e);\r\n };\r\n\r\n React.useEffect(() => {\r\n setRowData(rowDataProps);\r\n }, [rowDataProps, setRowData]);\r\n\r\n React.useEffect(() => {\r\n if (quickFilterTextProps !== undefined) {\r\n setQuickFilterText(quickFilterTextProps ?? \"\");\r\n }\r\n }, [quickFilterTextProps, setQuickFilterText]);\r\n\r\n const { finalRowData, finalPinnedTopRowData } = useMemo(() => {\r\n if (!rowData || pinnedRowIds.size === 0) {\r\n return { finalRowData: rowData, finalPinnedTopRowData: [] };\r\n }\r\n\r\n const pinned: any[] = [];\r\n const unpinned: any[] = [];\r\n\r\n rowData.forEach(data => {\r\n const id = getRowId ? getRowId({ data, level: 0 } as any) : (data as any).id;\r\n const stringId = id !== undefined && id !== null ? String(id) : undefined;\r\n\r\n if (stringId !== undefined && pinnedRowIds.has(stringId)) {\r\n pinned.push(data);\r\n } else {\r\n unpinned.push(data);\r\n }\r\n });\r\n\r\n return { finalRowData: unpinned, finalPinnedTopRowData: pinned };\r\n }, [rowData, pinnedRowIds, getRowId]);\r\n\r\n return (\r\n <AgGridReact\r\n gridId={gridId}\r\n theme={propTheme ?? theme}\r\n rowData={finalRowData}\r\n pinnedTopRowData={finalPinnedTopRowData}\r\n quickFilterText={quickFilterText}\r\n onGridReady={handleGridReady}\r\n containerStyle={{ height: `calc(100% - ${actionbarHeight}px)`, ...containerStyle }}\r\n getRowId={getRowId}\r\n {...props}\r\n ref={ref}\r\n />\r\n );\r\n },\r\n);\r\n\r\nDataGridContent.displayName = \"DataGridContent\";\r\n\r\ntype DatagridActionBarProps = HTMLAttributes<HTMLDivElement> & {};\r\n\r\nconst DataGridActionBar: React.FC<DatagridActionBarProps> = ({ className, ...props }) => {\r\n const context = React.useContext(DataGridContext);\r\n\r\n if (!context) {\r\n throw new Error(\"DataGridActionBar should be used within <DataGrid>\");\r\n }\r\n const ref = React.useRef<HTMLDivElement | null>(null);\r\n const { setActionbarExists, setActionbarHeight } = context;\r\n const { children } = props;\r\n\r\n React.useEffect(() => {\r\n setActionbarExists(true);\r\n return () => setActionbarExists(false);\r\n }, [setActionbarExists]);\r\n\r\n React.useEffect(() => {\r\n if (ref.current) {\r\n setActionbarHeight(ref.current.clientHeight);\r\n }\r\n }, [setActionbarHeight]);\r\n\r\n return (\r\n <div\r\n className={cn(\r\n \"relative flex items-center p-2 h-12 w-full bg-gray-0 border border-gray-200 border-b-0 -mb-[1px] z-10 rounded-t-[8px]\",\r\n className,\r\n )}\r\n ref={ref}\r\n >\r\n {children}\r\n </div>\r\n );\r\n};\r\n\r\ntype SearchActionProps = HTMLAttributes<HTMLDivElement> & {\r\n defaultOpen?: boolean;\r\n};\r\n\r\nconst SearchAction: React.FC<SearchActionProps> = ({ defaultOpen = false, className, ...props }) => {\r\n const context = React.useContext(DataGridContext);\r\n\r\n if (!context) {\r\n throw new Error(\"SearchAction should be used within <DataGrid>\");\r\n }\r\n\r\n const { quickFilterText, setQuickFilterText } = context;\r\n\r\n const [isSearchInputOpen, setIsSearchInputOpen] = React.useState(defaultOpen);\r\n const [isClosing, setIsClosing] = React.useState(false);\r\n const inputRef = React.useRef<HTMLInputElement | null>(null);\r\n\r\n const handleClear = () => {\r\n context.setQuickFilterText(\"\");\r\n if (inputRef.current) {\r\n inputRef.current.focus();\r\n }\r\n };\r\n\r\n const handleOpen = () => {\r\n setIsSearchInputOpen(true);\r\n };\r\n\r\n React.useEffect(() => {\r\n if (isSearchInputOpen && inputRef?.current) {\r\n inputRef.current.focus();\r\n }\r\n }, [isSearchInputOpen]);\r\n\r\n const handleClose = () => {\r\n setIsClosing(true);\r\n context.setQuickFilterText(\"\");\r\n setTimeout(() => {\r\n setIsSearchInputOpen(false);\r\n setIsClosing(false);\r\n }, 200);\r\n };\r\n\r\n return (\r\n <div className={cn(\"max-w-60\", className)} {...props}>\r\n {isSearchInputOpen || isClosing ? (\r\n <TextField\r\n ref={inputRef}\r\n className={cn(\"relative h-7.5\", isSearchInputOpen && !isClosing ? \"animate-input-open\" : \"\", isClosing && \"animate-input-close\")}\r\n onChange={e => setQuickFilterText(e.target.value)}\r\n value={quickFilterText}\r\n startAdornment={\r\n <IconButton type=\"button\" variant=\"toolbar\" className=\"p-0.5 h-6 w-6 border-none mx-1\" onClick={handleClose}>\r\n <Magnifier className=\"w-5 h-5\" />\r\n </IconButton>\r\n }\r\n endAdornment={\r\n quickFilterText && (\r\n <IconButton type=\"button\" variant=\"toolbar\" className=\"p-0.5 w-6 h-6 border-none mx-1\" onClick={handleClear}>\r\n <CircleXmark className=\"w-5 h-5\" />\r\n </IconButton>\r\n )\r\n }\r\n />\r\n ) : (\r\n <IconButton type=\"button\" variant=\"toolbar\" className=\"p-0.5 w-6 h-6 m-1\" onClick={handleOpen}>\r\n <Magnifier className=\"w-5 h-5\" />\r\n </IconButton>\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\ntype FreezeActionProps = ButtonProps & {\r\n freezeText?: string;\r\n unFreezeText?: string;\r\n};\r\n\r\nconst FreezeAction: React.FC<FreezeActionProps> = ({ freezeText, unFreezeText, onClick, disabled, ...props }) => {\r\n const context = React.useContext(DataGridContext);\r\n\r\n if (!context) {\r\n throw new Error(\"FreezeAction should be used within <DataGrid>\");\r\n }\r\n\r\n const [pinnedRowCount, setPinnedRowCount] = React.useState(0);\r\n const [selectedRowsCount, setSelectedRowsCount] = React.useState(0);\r\n\r\n const { api, pinnedRowIds, setPinnedRowIds } = context;\r\n\r\n const freezeRows = () => {\r\n if (!api) return;\r\n\r\n // Get currently selected rows\r\n const selectedRows = api.getSelectedNodes();\r\n\r\n if (selectedRows.length > 0) {\r\n const newPinnedIds = new Set(pinnedRowIds);\r\n selectedRows.forEach(row => {\r\n if (row.id !== undefined) {\r\n newPinnedIds.add(row.id);\r\n }\r\n });\r\n setPinnedRowIds(newPinnedIds);\r\n api.deselectAll();\r\n }\r\n };\r\n\r\n const unfreezeRows = () => {\r\n setPinnedRowIds(new Set());\r\n };\r\n\r\n const handleFreezing = (e: React.MouseEvent<HTMLButtonElement>) => {\r\n if (api) {\r\n const pinnedRowsCount = api.getPinnedTopRowCount();\r\n if (pinnedRowsCount > 0) {\r\n unfreezeRows();\r\n } else {\r\n freezeRows();\r\n }\r\n }\r\n onClick?.(e);\r\n };\r\n\r\n React.useEffect(() => {\r\n api?.addEventListener(\"pinnedRowDataChanged\", () => {\r\n setPinnedRowCount(api.getPinnedTopRowCount());\r\n });\r\n\r\n api?.addEventListener(\"selectionChanged\", () => {\r\n setSelectedRowsCount(api.getSelectedNodes().length);\r\n });\r\n\r\n return () => {\r\n if (api?.isDestroyed()) return;\r\n api?.removeEventListener(\"pinnedRowDataChanged\", () => {\r\n setPinnedRowCount(api.getPinnedTopRowCount());\r\n });\r\n\r\n api?.removeEventListener(\"selectionChanged\", () => {\r\n setSelectedRowsCount(api.getSelectedNodes().length);\r\n });\r\n };\r\n }, [api]);\r\n\r\n return (\r\n <Button\r\n variant=\"text\"\r\n type=\"button\"\r\n onClick={handleFreezing}\r\n startIcon={<Snowflake className=\"w-4.5 h-4.5\" />}\r\n disabled={(!pinnedRowCount && !selectedRowsCount) || disabled}\r\n {...props}\r\n >\r\n {pinnedRowCount ? (unFreezeText ?? \"Unfreeze\") : (freezeText ?? \"Freeze\")}\r\n </Button>\r\n );\r\n};\r\n\r\ntype PrintActionProps = IconButtonProps & {};\r\n\r\nconst PrintAction: React.FC<PrintActionProps> = ({ children, className, onClick, ...props }) => {\r\n const context = React.useContext(DataGridContext);\r\n\r\n if (!context) {\r\n throw new Error(\"PrintAction should be used within <DataGrid>\");\r\n }\r\n\r\n const handlePrint = (e: React.MouseEvent<HTMLButtonElement>) => {\r\n if (context.api) {\r\n context.api.setGridOption(\"domLayout\", \"print\");\r\n\r\n setTimeout(() => {\r\n const element = document.querySelector(\"[grid-id='\" + context.gridId + \"']\") as HTMLElement;\r\n const header = document.head;\r\n const html = `<html>\r\n ${header.innerHTML}\r\n ${element.outerHTML}\r\n </html>`;\r\n printHtml(html);\r\n context?.api?.setGridOption(\"domLayout\", undefined);\r\n });\r\n }\r\n onClick?.(e);\r\n };\r\n\r\n return (\r\n <IconButton type=\"button\" variant=\"toolbar\" className={cn(\"p-0.5 w-6 h-6\", className)} onClick={handlePrint} {...props}>\r\n {children ?? <Print className=\"w-5 h-5\" />}\r\n </IconButton>\r\n );\r\n};\r\n\r\ntype RefreshActionProps = Omit<IconButtonProps, \"onClick\"> & {\r\n onRefresh: () => void;\r\n};\r\n\r\nconst RefreshAction: React.FC<RefreshActionProps> = ({ className, onRefresh, children, loading, ...props }) => {\r\n const context = React.useContext(DataGridContext);\r\n\r\n if (!context) {\r\n throw new Error(\"RefreshAction should be used within <DataGrid>\");\r\n }\r\n\r\n const handleRefresh = () => {\r\n onRefresh();\r\n };\r\n\r\n return (\r\n <IconButton\r\n type=\"button\"\r\n className={cn(\"p-0.5 w-6 h-6\", loading && \"disabled:bg-transparent\", className)}\r\n variant=\"toolbar\"\r\n onClick={handleRefresh}\r\n disabled={loading}\r\n {...props}\r\n >\r\n {children ?? <Refresh className={cn(\"w-4.5 h-4.5\", loading && \"animate-spin\")} />}\r\n </IconButton>\r\n );\r\n};\r\n\r\ntype DeleteActionProps = Omit<ButtonProps, \"onClick\"> & {\r\n onDelete: () => void;\r\n};\r\n\r\nconst DeleteAction: React.FC<DeleteActionProps> = ({ onDelete, children, ...props }) => {\r\n const handleDelete = () => {\r\n onDelete();\r\n };\r\n\r\n return (\r\n <Button variant=\"danger\" type=\"button\" onClick={handleDelete} startIcon={<Trashcan className=\"w-4.5 h-4.5\" />} {...props}>\r\n {children}\r\n </Button>\r\n );\r\n};\r\n\r\ntype ExtraActionsProps = PopoverContentProps & {\r\n children: React.ReactNode;\r\n slotProps?: {\r\n triggerProps?: PopoverTriggerProps;\r\n popoverProps?: PopoverProps;\r\n };\r\n};\r\n\r\nconst ExtraActions: React.FC<ExtraActionsProps> = ({ children, slotProps, className, ...props }) => {\r\n return (\r\n <Popover {...(slotProps?.popoverProps ?? {})}>\r\n <PopoverTrigger {...(slotProps?.triggerProps ?? {})}>\r\n <ElipsisVertical className=\"w-4.5 h-4.5 text-primary\" />\r\n </PopoverTrigger>\r\n <PopoverContent align=\"end\" className={cn(\"w-40\", className)} {...props}>\r\n {children}\r\n </PopoverContent>\r\n </Popover>\r\n );\r\n};\r\n\r\nexport {\r\n DataGrid,\r\n DataGridContent,\r\n DataGridActionBar,\r\n SearchAction,\r\n FreezeAction,\r\n PrintAction,\r\n RefreshAction,\r\n ExtraActions,\r\n DeleteAction,\r\n type DataGridProps,\r\n type DataGridContentProps,\r\n type DatagridActionBarProps,\r\n type SearchActionProps,\r\n type FreezeActionProps,\r\n type RefreshActionProps,\r\n type ExtraActionsProps,\r\n type DeleteActionProps,\r\n useDataGrid,\r\n dataGridDefaultTheme,\r\n};\r\n"],"names":["ModuleRegistry","AllCommunityModule","dataGridDefaultTheme","themeQuartz","DataGridContext","React","useDataGrid","context","DataGrid","children","gridId","api","setApi","rowData","setRowData","actionbarHeight","setActionbarHeight","pinnedRowIds","setPinnedRowIds","quickFilterText","setQuickFilterText","actionbarExists","setActionbarExists","jsx","DataGridContent","forwardRef","propTheme","onGridReady","quickFilterTextProps","rowDataProps","containerStyle","getRowId","props","ref","theme","useMemo","handleGridReady","e","finalRowData","finalPinnedTopRowData","pinned","unpinned","data","id","stringId","AgGridReact","DataGridActionBar","className","cn","SearchAction","defaultOpen","isSearchInputOpen","setIsSearchInputOpen","isClosing","setIsClosing","inputRef","handleClear","handleOpen","handleClose","TextField","IconButton","Magnifier","CircleXmark","FreezeAction","freezeText","unFreezeText","onClick","disabled","pinnedRowCount","setPinnedRowCount","selectedRowsCount","setSelectedRowsCount","freezeRows","selectedRows","newPinnedIds","row","unfreezeRows","handleFreezing","Button","Snowflake","PrintAction","handlePrint","element","html","printHtml","Print","RefreshAction","onRefresh","loading","handleRefresh","Refresh","DeleteAction","onDelete","Trashcan","ExtraActions","slotProps","Popover","PopoverTrigger","ElipsisVertical","PopoverContent"],"mappings":";;;;;;;;;;;AAgBAA,EAAe,gBAAgB,CAACC,CAAkB,CAAC;AAEnD,MAAMC,IAAuBC,EAAY,WAAW;AAAA,EAClD,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,uBAAuB;AAAA,EACvB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,eAAe;AACjB,CAAC,GAkBKC,IAAkBC,EAAM,cAAsC,IAAI,GAElEC,KAAc,MAAM;AACxB,QAAMC,IAAUF,EAAM,WAAWD,CAAe;AAEhD,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,8CAA8C;AAGhE,SAAOA;AACT,GAMMC,KAAoC,CAAC,EAAE,UAAAC,QAAe;AAC1D,QAAMC,IA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React, { forwardRef, HTMLAttributes, useMemo } from \"react\";\r\nimport { AgGridReact, AgGridReactProps } from \"ag-grid-react\";\r\nimport { GridApi, GridReadyEvent, themeQuartz, AllCommunityModule, ModuleRegistry, Theme } from \"ag-grid-community\";\r\nimport { CircleXmark, ElipsisVertical, Magnifier, Print, Refresh, Snowflake, Trashcan } from \"@trsys-tech/matrix-icons\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\nimport { printHtml } from \"../../lib/printHtml\";\r\nimport { TextField } from \"../text-field/TextField\";\r\nimport { Button, ButtonProps } from \"../button/Button\";\r\nimport { IconButton, IconButtonProps } from \"../icon-botton/IconButton\";\r\nimport { Popover, PopoverContent, PopoverContentProps, PopoverProps, PopoverTrigger, PopoverTriggerProps } from \"../popover/Popover\";\r\n\r\n// Register all Community features\r\n// Todo: Register only the required features\r\nModuleRegistry.registerModules([AllCommunityModule]);\r\n\r\ntype DataGridRowWithId = {\r\n id?: string | number | null;\r\n};\r\n\r\ntype ResolveRowId = (data: unknown) => string | undefined;\r\n\r\n/**\r\n * Default ag-Grid theme used by DataGrid.\r\n */\r\nconst dataGridDefaultTheme = themeQuartz.withParams({\r\n fontFamily: \"DMSans\",\r\n fontSize: \"12px\",\r\n headerFontSize: \"12px\",\r\n headerFontWeight: 700,\r\n headerBackgroundColor: \"hsl(var(--primary-50))\",\r\n backgroundColor: \"hsl(var(--gray-0))\",\r\n accentColor: \"hsl(var(--primary-300))\",\r\n foregroundColor: \"hsl(var(--text-500))\",\r\n cellTextColor: \"hsl(var(--text-500))\",\r\n});\r\n\r\nconst fallbackResolveRowId: ResolveRowId = data => {\r\n const id = (data as DataGridRowWithId | null | undefined)?.id;\r\n\r\n return id !== undefined && id !== null ? String(id) : undefined;\r\n};\r\n\r\nconst createResolveRowId = (getRowId?: AgGridReactProps[\"getRowId\"]): ResolveRowId => {\r\n if (!getRowId) {\r\n return fallbackResolveRowId;\r\n }\r\n\r\n return data => {\r\n const id = getRowId({ data, level: 0 } as any);\r\n\r\n return id !== undefined && id !== null ? String(id) : fallbackResolveRowId(data);\r\n };\r\n};\r\n\r\n/**\r\n * Shared DataGrid state exposed through context.\r\n */\r\ntype DataGridContext = {\r\n api: GridApi | null;\r\n setApi: (value: GridApi) => void;\r\n rowData: any[] | null | undefined;\r\n setRowData: (value: any[] | null | undefined) => void;\r\n gridId: string;\r\n quickFilterText: string;\r\n setQuickFilterText: (value: string) => void;\r\n actionbarExists: boolean;\r\n setActionbarExists: (value: boolean) => void;\r\n actionbarHeight: number;\r\n setActionbarHeight: (value: number) => void;\r\n pinnedRowIds: Set<string>;\r\n setPinnedRowIds: (value: Set<string>) => void;\r\n resolveRowIdRef: React.MutableRefObject<ResolveRowId>;\r\n};\r\n\r\nconst DataGridContext = React.createContext<DataGridContext | null>(null);\r\n\r\nconst useDataGrid = () => {\r\n const context = React.useContext(DataGridContext);\r\n\r\n if (!context) {\r\n throw new Error(\"useDataGrid should be used within <DataGrid>\");\r\n }\r\n\r\n return context;\r\n};\r\n\r\n/**\r\n * Props for the root DataGrid provider.\r\n */\r\ntype DataGridProps = {\r\n /** Content rendered inside the provider. */\r\n children: React.ReactNode;\r\n};\r\n\r\n/**\r\n * DataGrid provider.\r\n * Provides shared state for the grid shell, content, and toolbar actions.\r\n * @param {DataGridProps} props - DataGrid props.\r\n * @param {React.ReactNode} children - Content rendered inside the provider.\r\n * @returns {React.ReactElement}\r\n */\r\n\r\nconst DataGrid: React.FC<DataGridProps> = ({ children }) => {\r\n const gridId = React.useId();\r\n const [api, setApi] = React.useState<GridApi | null>(null);\r\n const [rowData, setRowData] = React.useState<any[] | null | undefined>([]);\r\n const [actionbarHeight, setActionbarHeight] = React.useState(0);\r\n const [pinnedRowIds, setPinnedRowIds] = React.useState<Set<string>>(new Set());\r\n const resolveRowIdRef = React.useRef<ResolveRowId>(fallbackResolveRowId);\r\n\r\n const [quickFilterText, setQuickFilterText] = React.useState(\"\");\r\n const [actionbarExists, setActionbarExists] = React.useState(false);\r\n return (\r\n <DataGridContext.Provider\r\n value={{\r\n api,\r\n setApi,\r\n rowData,\r\n setRowData,\r\n gridId,\r\n quickFilterText,\r\n setQuickFilterText,\r\n actionbarExists,\r\n setActionbarExists,\r\n actionbarHeight,\r\n setActionbarHeight,\r\n pinnedRowIds,\r\n setPinnedRowIds,\r\n resolveRowIdRef,\r\n }}\r\n >\r\n {children}\r\n </DataGridContext.Provider>\r\n );\r\n};\r\n\r\n/**\r\n * Props for the Ag Grid content wrapper.\r\n */\r\ntype DataGridContentProps = Omit<AgGridReactProps, \"theme\"> & {\r\n /** Optional theme override forwarded to ag-Grid. */\r\n theme?: Theme;\r\n};\r\n\r\n/**\r\n * DataGridContent component.\r\n * Connects ag-Grid to the shared DataGrid context and keeps pinned rows separate from the main row set.\r\n * @param {DataGridContentProps} props - Ag Grid props.\r\n * @param {Theme} [theme] - Optional ag-Grid theme override.\r\n * @param {GridReadyEvent} [onGridReady] - Called when the grid becomes ready.\r\n * @param {any[] | null | undefined} [rowData] - Row data rendered by the grid.\r\n * @param {string} [quickFilterText] - Quick filter text synced from the search action.\r\n * @param {React.CSSProperties} [containerStyle] - Inline styles applied to the grid container.\r\n * @param {Function} [getRowId] - Resolves the row id used to keep pinned rows stable.\r\n * @param {React.ForwardedRef<AgGridReact>} ref - Grid ref.\r\n * @returns {React.ReactElement}\r\n */\r\nconst DataGridContent = forwardRef<AgGridReact, DataGridContentProps>(\r\n ({ theme: propTheme, onGridReady, quickFilterText: quickFilterTextProps, rowData: rowDataProps, containerStyle, getRowId, ...props }, ref) => {\r\n const context = React.useContext(DataGridContext);\r\n\r\n if (!context) {\r\n throw new Error(\"DataGridContent should be used within <DataGrid>\");\r\n }\r\n const {\r\n rowData,\r\n setRowData,\r\n actionbarExists,\r\n setApi,\r\n setQuickFilterText,\r\n quickFilterText,\r\n gridId,\r\n actionbarHeight,\r\n pinnedRowIds,\r\n resolveRowIdRef,\r\n } = context;\r\n\r\n const resolveRowId = React.useMemo(() => createResolveRowId(getRowId), [getRowId]);\r\n\r\n const theme = useMemo(() => {\r\n return dataGridDefaultTheme.withParams({\r\n headerHeight: 40,\r\n wrapperBorderRadius: actionbarExists ? \"0px 0px 8px 8px\" : \"8px\",\r\n });\r\n }, [actionbarExists]);\r\n\r\n React.useEffect(() => {\r\n resolveRowIdRef.current = resolveRowId;\r\n\r\n return () => {\r\n resolveRowIdRef.current = fallbackResolveRowId;\r\n };\r\n }, [resolveRowId, resolveRowIdRef]);\r\n\r\n const handleGridReady = (e: GridReadyEvent) => {\r\n setApi(e.api);\r\n onGridReady?.(e);\r\n };\r\n\r\n React.useEffect(() => {\r\n setRowData(rowDataProps);\r\n }, [rowDataProps, setRowData]);\r\n\r\n React.useEffect(() => {\r\n if (quickFilterTextProps !== undefined) {\r\n setQuickFilterText(quickFilterTextProps ?? \"\");\r\n }\r\n }, [quickFilterTextProps, setQuickFilterText]);\r\n\r\n const { finalRowData, finalPinnedTopRowData } = useMemo(() => {\r\n if (!rowData || pinnedRowIds.size === 0) {\r\n return { finalRowData: rowData, finalPinnedTopRowData: [] };\r\n }\r\n\r\n const pinned: any[] = [];\r\n const unpinned: any[] = [];\r\n\r\n rowData.forEach(data => {\r\n const id = resolveRowId(data);\r\n\r\n if (id !== undefined && pinnedRowIds.has(id)) {\r\n pinned.push(data);\r\n } else {\r\n unpinned.push(data);\r\n }\r\n });\r\n\r\n return { finalRowData: unpinned, finalPinnedTopRowData: pinned };\r\n }, [rowData, pinnedRowIds, resolveRowId]);\r\n\r\n return (\r\n <AgGridReact\r\n gridId={gridId}\r\n theme={propTheme ?? theme}\r\n rowData={finalRowData}\r\n pinnedTopRowData={finalPinnedTopRowData}\r\n quickFilterText={quickFilterText}\r\n onGridReady={handleGridReady}\r\n containerStyle={{ height: `calc(100% - ${actionbarHeight}px)`, ...containerStyle }}\r\n getRowId={getRowId}\r\n {...props}\r\n ref={ref}\r\n />\r\n );\r\n },\r\n);\r\n\r\nDataGridContent.displayName = \"DataGridContent\";\r\n\r\n/**\r\n * Props for the DataGrid action bar container.\r\n */\r\ntype DatagridActionBarProps = HTMLAttributes<HTMLDivElement> & {};\r\n\r\n/**\r\n * DataGrid action bar.\r\n * Marks the grid as having a toolbar so the grid can adjust border radius and height.\r\n * @param {DatagridActionBarProps} props - Action bar props.\r\n * @param {React.ReactNode} children - Action bar content.\r\n * @param {string} className - Additional classes applied to the action bar.\r\n * @returns {React.ReactElement}\r\n */\r\nconst DataGridActionBar: React.FC<DatagridActionBarProps> = ({ className, ...props }) => {\r\n const context = React.useContext(DataGridContext);\r\n\r\n if (!context) {\r\n throw new Error(\"DataGridActionBar should be used within <DataGrid>\");\r\n }\r\n const ref = React.useRef<HTMLDivElement | null>(null);\r\n const { setActionbarExists, setActionbarHeight } = context;\r\n const { children } = props;\r\n\r\n React.useEffect(() => {\r\n setActionbarExists(true);\r\n return () => setActionbarExists(false);\r\n }, [setActionbarExists]);\r\n\r\n React.useEffect(() => {\r\n if (ref.current) {\r\n setActionbarHeight(ref.current.clientHeight);\r\n }\r\n }, [setActionbarHeight]);\r\n\r\n return (\r\n <div\r\n className={cn(\r\n \"relative flex items-center p-2 h-12 w-full bg-gray-0 border border-gray-200 border-b-0 -mb-[1px] z-10 rounded-t-[8px]\",\r\n className,\r\n )}\r\n ref={ref}\r\n >\r\n {children}\r\n </div>\r\n );\r\n};\r\n\r\n/**\r\n * Props for SearchAction.\r\n */\r\ntype SearchActionProps = HTMLAttributes<HTMLDivElement> & {\r\n /** Opens the search input immediately on mount. */\r\n defaultOpen?: boolean;\r\n /** Focuses the input the first time it opens. */\r\n defaultOpenAutoFocus?: boolean;\r\n};\r\n\r\n/**\r\n * Search action.\r\n * Toggles the quick filter input and manages its open/close focus behavior.\r\n * @param {SearchActionProps} props - Search action props.\r\n * @param {boolean} [defaultOpen] - Opens the search input immediately on mount.\r\n * @param {boolean} [defaultOpenAutoFocus] - Focuses the input the first time it opens.\r\n * @param {React.ReactNode} children - Optional wrapper content.\r\n * @param {string} className - Additional wrapper classes.\r\n * @returns {React.ReactElement}\r\n */\r\nconst SearchAction: React.FC<SearchActionProps> = ({ defaultOpen = false, defaultOpenAutoFocus = true, className, ...props }) => {\r\n const context = React.useContext(DataGridContext);\r\n\r\n if (!context) {\r\n throw new Error(\"SearchAction should be used within <DataGrid>\");\r\n }\r\n\r\n const { quickFilterText, setQuickFilterText } = context;\r\n\r\n const [isSearchInputOpen, setIsSearchInputOpen] = React.useState(defaultOpen);\r\n const [isClosing, setIsClosing] = React.useState(false);\r\n const inputRef = React.useRef<HTMLInputElement | null>(null);\r\n const firstRenderRef = React.useRef(true);\r\n\r\n const handleClear = () => {\r\n context.setQuickFilterText(\"\");\r\n if (inputRef.current) {\r\n inputRef.current.focus();\r\n }\r\n };\r\n\r\n const handleOpen = () => {\r\n setIsSearchInputOpen(true);\r\n };\r\n\r\n React.useEffect(() => {\r\n if (isSearchInputOpen && inputRef?.current && (defaultOpenAutoFocus || !firstRenderRef.current)) {\r\n inputRef.current.focus();\r\n }\r\n firstRenderRef.current = false;\r\n }, [isSearchInputOpen, defaultOpenAutoFocus]);\r\n\r\n const handleClose = () => {\r\n setIsClosing(true);\r\n context.setQuickFilterText(\"\");\r\n setTimeout(() => {\r\n setIsSearchInputOpen(false);\r\n setIsClosing(false);\r\n }, 200);\r\n };\r\n\r\n return (\r\n <div className={cn(\"max-w-60\", className)} {...props}>\r\n {isSearchInputOpen || isClosing ? (\r\n <TextField\r\n ref={inputRef}\r\n className={cn(\"relative h-7.5\", isSearchInputOpen && !isClosing ? \"animate-input-open\" : \"\", isClosing && \"animate-input-close\")}\r\n onChange={e => setQuickFilterText(e.target.value)}\r\n value={quickFilterText}\r\n startAdornment={\r\n <IconButton type=\"button\" variant=\"toolbar\" className=\"p-0.5 h-6 w-6 border-none mx-1\" onClick={handleClose}>\r\n <Magnifier className=\"w-5 h-5\" />\r\n </IconButton>\r\n }\r\n endAdornment={\r\n quickFilterText && (\r\n <IconButton type=\"button\" variant=\"toolbar\" className=\"p-0.5 w-6 h-6 border-none mx-1\" onClick={handleClear}>\r\n <CircleXmark className=\"w-5 h-5\" />\r\n </IconButton>\r\n )\r\n }\r\n />\r\n ) : (\r\n <IconButton type=\"button\" variant=\"toolbar\" className=\"p-0.5 w-6 h-6 m-1\" onClick={handleOpen}>\r\n <Magnifier className=\"w-5 h-5\" />\r\n </IconButton>\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\n/**\r\n * Props for FreezeAction.\r\n */\r\ntype FreezeActionProps = ButtonProps & {\r\n /** Label shown when rows can be frozen. */\r\n freezeText?: string;\r\n /** Label shown when rows are already frozen. */\r\n unFreezeText?: string;\r\n};\r\n\r\n/**\r\n * Freeze action.\r\n * Pins the current selection when rows are selected, or clears pinned rows when the grid is already frozen.\r\n * @param {FreezeActionProps} props - Freeze action props.\r\n * @param {boolean} [disabled] - Disables the action button.\r\n * @param {React.MouseEventHandler<HTMLButtonElement>} [onClick] - Called after the freeze toggle runs.\r\n * @returns {React.ReactElement}\r\n */\r\nconst FreezeAction: React.FC<FreezeActionProps> = ({ freezeText, unFreezeText, onClick, disabled, ...props }) => {\r\n const context = React.useContext(DataGridContext);\r\n\r\n if (!context) {\r\n throw new Error(\"FreezeAction should be used within <DataGrid>\");\r\n }\r\n\r\n const [pinnedRowCount, setPinnedRowCount] = React.useState(0);\r\n const [selectedRowsCount, setSelectedRowsCount] = React.useState(0);\r\n\r\n const { api, pinnedRowIds, setPinnedRowIds, resolveRowIdRef } = context;\r\n\r\n const freezeRows = () => {\r\n if (!api) return;\r\n\r\n // Get currently selected rows\r\n const selectedRows = api.getSelectedRows();\r\n\r\n if (selectedRows.length > 0) {\r\n const newPinnedIds = new Set(pinnedRowIds);\r\n selectedRows.forEach(row => {\r\n const rowId = resolveRowIdRef.current(row);\r\n\r\n if (rowId !== undefined) {\r\n newPinnedIds.add(rowId);\r\n }\r\n });\r\n setPinnedRowIds(newPinnedIds);\r\n api.deselectAll();\r\n }\r\n };\r\n\r\n const unfreezeRows = () => {\r\n setPinnedRowIds(new Set());\r\n };\r\n\r\n const handleFreezing = (e: React.MouseEvent<HTMLButtonElement>) => {\r\n if (api) {\r\n const pinnedRowsCount = api.getPinnedTopRowCount();\r\n if (pinnedRowsCount > 0) {\r\n unfreezeRows();\r\n } else {\r\n freezeRows();\r\n }\r\n }\r\n onClick?.(e);\r\n };\r\n\r\n React.useEffect(() => {\r\n api?.addEventListener(\"pinnedRowDataChanged\", () => {\r\n setPinnedRowCount(api.getPinnedTopRowCount());\r\n });\r\n\r\n api?.addEventListener(\"selectionChanged\", () => {\r\n setSelectedRowsCount(api.getSelectedNodes().length);\r\n });\r\n\r\n return () => {\r\n if (api?.isDestroyed()) return;\r\n api?.removeEventListener(\"pinnedRowDataChanged\", () => {\r\n setPinnedRowCount(api.getPinnedTopRowCount());\r\n });\r\n\r\n api?.removeEventListener(\"selectionChanged\", () => {\r\n setSelectedRowsCount(api.getSelectedNodes().length);\r\n });\r\n };\r\n }, [api]);\r\n\r\n return (\r\n <Button\r\n variant=\"text\"\r\n type=\"button\"\r\n onClick={handleFreezing}\r\n startIcon={<Snowflake className=\"w-4.5 h-4.5\" />}\r\n disabled={(!pinnedRowCount && !selectedRowsCount) || disabled}\r\n {...props}\r\n >\r\n {pinnedRowCount ? (unFreezeText ?? \"Unfreeze\") : (freezeText ?? \"Freeze\")}\r\n </Button>\r\n );\r\n};\r\n\r\n/**\r\n * Props for PrintAction.\r\n */\r\ntype PrintActionProps = IconButtonProps & {};\r\n\r\n/**\r\n * Print action.\r\n * Switches the grid to print layout, captures the rendered markup, and opens the browser print flow.\r\n * @param {PrintActionProps} props - Print action props.\r\n * @param {React.ReactNode} [children] - Custom icon content rendered in the button.\r\n * @param {string} [className] - Additional button classes.\r\n * @param {React.MouseEventHandler<HTMLButtonElement>} [onClick] - Called after printing is triggered.\r\n * @returns {React.ReactElement}\r\n */\r\nconst PrintAction: React.FC<PrintActionProps> = ({ children, className, onClick, ...props }) => {\r\n const context = React.useContext(DataGridContext);\r\n\r\n if (!context) {\r\n throw new Error(\"PrintAction should be used within <DataGrid>\");\r\n }\r\n\r\n const handlePrint = (e: React.MouseEvent<HTMLButtonElement>) => {\r\n if (context.api) {\r\n context.api.setGridOption(\"domLayout\", \"print\");\r\n\r\n setTimeout(() => {\r\n const element = document.querySelector(\"[grid-id='\" + context.gridId + \"']\") as HTMLElement;\r\n const header = document.head;\r\n const html = `<html>\r\n ${header.innerHTML}\r\n ${element.outerHTML}\r\n </html>`;\r\n printHtml(html);\r\n context?.api?.setGridOption(\"domLayout\", undefined);\r\n });\r\n }\r\n onClick?.(e);\r\n };\r\n\r\n return (\r\n <IconButton type=\"button\" variant=\"toolbar\" className={cn(\"p-0.5 w-6 h-6\", className)} onClick={handlePrint} {...props}>\r\n {children ?? <Print className=\"w-5 h-5\" />}\r\n </IconButton>\r\n );\r\n};\r\n\r\n/**\r\n * Props for RefreshAction.\r\n */\r\ntype RefreshActionProps = Omit<IconButtonProps, \"onClick\"> & {\r\n /** Callback invoked when the refresh action is clicked. */\r\n onRefresh: () => void;\r\n};\r\n\r\n/**\r\n * Refresh action.\r\n * Calls the provided refresh callback and reflects the loading state in the toolbar button.\r\n * @param {RefreshActionProps} props - Refresh action props.\r\n * @param {() => void} onRefresh - Called when the button is clicked.\r\n * @param {boolean} [loading] - Shows the loading spinner and disables the button.\r\n * @param {React.ReactNode} [children] - Custom icon content rendered in the button.\r\n * @param {string} [className] - Additional button classes.\r\n * @returns {React.ReactElement}\r\n */\r\nconst RefreshAction: React.FC<RefreshActionProps> = ({ className, onRefresh, children, loading, ...props }) => {\r\n const context = React.useContext(DataGridContext);\r\n\r\n if (!context) {\r\n throw new Error(\"RefreshAction should be used within <DataGrid>\");\r\n }\r\n\r\n const handleRefresh = () => {\r\n onRefresh();\r\n };\r\n\r\n return (\r\n <IconButton\r\n type=\"button\"\r\n className={cn(\"p-0.5 w-6 h-6\", loading && \"disabled:bg-transparent\", className)}\r\n variant=\"toolbar\"\r\n onClick={handleRefresh}\r\n disabled={loading}\r\n {...props}\r\n >\r\n {children ?? <Refresh className={cn(\"w-4.5 h-4.5\", loading && \"animate-spin\")} />}\r\n </IconButton>\r\n );\r\n};\r\n\r\n/**\r\n * Props for DeleteAction.\r\n */\r\ntype DeleteActionProps = Omit<ButtonProps, \"onClick\"> & {\r\n /** Callback invoked when the delete action is clicked. */\r\n onDelete: () => void;\r\n};\r\n\r\n/**\r\n * Delete action.\r\n * Renders a danger button with the delete icon and delegates the click to the provided handler.\r\n * @param {DeleteActionProps} props - Delete action props.\r\n * @param {() => void} onDelete - Called when the button is clicked.\r\n * @param {React.ReactNode} [children] - Button label or custom content.\r\n * @returns {React.ReactElement}\r\n */\r\nconst DeleteAction: React.FC<DeleteActionProps> = ({ onDelete, children, ...props }) => {\r\n const handleDelete = () => {\r\n onDelete();\r\n };\r\n\r\n return (\r\n <Button variant=\"danger\" type=\"button\" onClick={handleDelete} startIcon={<Trashcan className=\"w-4.5 h-4.5\" />} {...props}>\r\n {children}\r\n </Button>\r\n );\r\n};\r\n\r\n/**\r\n * Props for ExtraActions.\r\n */\r\ntype ExtraActionsProps = PopoverContentProps & {\r\n /** Menu items rendered inside the popover. */\r\n children: React.ReactNode;\r\n /** Props forwarded to the popover trigger and popover root. */\r\n slotProps?: {\r\n triggerProps?: PopoverTriggerProps;\r\n popoverProps?: PopoverProps;\r\n };\r\n};\r\n\r\n/**\r\n * Extra actions menu.\r\n * Wraps overflow actions in a popover anchored to the vertical ellipsis trigger.\r\n * @param {ExtraActionsProps} props - Extra actions props.\r\n * @param {React.ReactNode} children - Menu items rendered inside the popover.\r\n * @param {{ triggerProps?: PopoverTriggerProps; popoverProps?: PopoverProps; }} [slotProps] - Props forwarded to the trigger and popover root.\r\n * @param {string} [className] - Additional popover content classes.\r\n * @returns {React.ReactElement}\r\n */\r\nconst ExtraActions: React.FC<ExtraActionsProps> = ({ children, slotProps, className, ...props }) => {\r\n return (\r\n <Popover {...(slotProps?.popoverProps ?? {})}>\r\n <PopoverTrigger {...(slotProps?.triggerProps ?? {})}>\r\n <ElipsisVertical className=\"w-4.5 h-4.5 text-primary\" />\r\n </PopoverTrigger>\r\n <PopoverContent align=\"end\" className={cn(\"w-40\", className)} {...props}>\r\n {children}\r\n </PopoverContent>\r\n </Popover>\r\n );\r\n};\r\n\r\nexport {\r\n DataGrid,\r\n DataGridContent,\r\n DataGridActionBar,\r\n SearchAction,\r\n FreezeAction,\r\n PrintAction,\r\n RefreshAction,\r\n ExtraActions,\r\n DeleteAction,\r\n type DataGridProps,\r\n type DataGridContentProps,\r\n type DatagridActionBarProps,\r\n type SearchActionProps,\r\n type FreezeActionProps,\r\n type RefreshActionProps,\r\n type ExtraActionsProps,\r\n type DeleteActionProps,\r\n useDataGrid,\r\n dataGridDefaultTheme,\r\n};\r\n"],"names":["ModuleRegistry","AllCommunityModule","dataGridDefaultTheme","themeQuartz","fallbackResolveRowId","data","id","createResolveRowId","getRowId","DataGridContext","React","useDataGrid","context","DataGrid","children","gridId","api","setApi","rowData","setRowData","actionbarHeight","setActionbarHeight","pinnedRowIds","setPinnedRowIds","resolveRowIdRef","quickFilterText","setQuickFilterText","actionbarExists","setActionbarExists","jsx","DataGridContent","forwardRef","propTheme","onGridReady","quickFilterTextProps","rowDataProps","containerStyle","props","ref","resolveRowId","theme","useMemo","handleGridReady","e","finalRowData","finalPinnedTopRowData","pinned","unpinned","AgGridReact","DataGridActionBar","className","cn","SearchAction","defaultOpen","defaultOpenAutoFocus","isSearchInputOpen","setIsSearchInputOpen","isClosing","setIsClosing","inputRef","firstRenderRef","handleClear","handleOpen","handleClose","TextField","IconButton","Magnifier","CircleXmark","FreezeAction","freezeText","unFreezeText","onClick","disabled","pinnedRowCount","setPinnedRowCount","selectedRowsCount","setSelectedRowsCount","freezeRows","selectedRows","newPinnedIds","row","rowId","unfreezeRows","handleFreezing","Button","Snowflake","PrintAction","handlePrint","element","html","printHtml","Print","RefreshAction","onRefresh","loading","handleRefresh","Refresh","DeleteAction","onDelete","Trashcan","ExtraActions","slotProps","Popover","PopoverTrig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assName: i,
13
+ className: i,
14
+ calendarClassName: s,
15
15
  closeOnSelect: p = !0,
16
16
  onDayClick: l,
17
17
  disabled: m,
@@ -28,10 +28,11 @@ const I = ({
28
28
  variant: "text",
29
29
  className: w(
30
30
  "flex h-8 w-full items-center justify-between whitespace-nowrap rounded-sm border border-input bg-transparent ps-3 pe-1 py-1.5 text-xs ring-offset-background data-[placeholder]:text-muted-foreground hover:border hover:border-primary hover:bg-transparent focus:border focus:border-primary focus:outline-none focus:ring focus:ring-primary-100 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-text-300 disabled:border-gray-100 [&>span]:line-clamp-1 [&_svg]:disabled:text-text-300",
31
- s
31
+ i
32
32
  ),
33
33
  "data-placeholder": e ? void 0 : "",
34
34
  "aria-label": e ? `Selected date: ${n(e, a ?? "yyyy/MM/dd")}` : "Pick a date",
35
+ "aria-haspopup": "dialog",
35
36
  disabled: m,
36
37
  children: [
37
38
  e ? n(e, a ?? "yyyy/MM/dd") : /* @__PURE__ */ r("span", { children: d ?? "Pick a date" }),
@@ -49,7 +50,7 @@ const I = ({
49
50
  mode: "single",
50
51
  selected: e,
51
52
  captionLayout: "dropdown-years",
52
- className: i,
53
+ className: s,
53
54
  onDayClick: f
54
55
  }
55
56
  ) })
@@ -1 +1 @@
1
- {"version":3,"file":"desktopdatepicker.es.js","sources":["../src/components/date-picker/DesktopDatePicker.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { format } from \"date-fns\";\r\nimport { Calendar as CalendarIcon } from \"@trsys-tech/matrix-icons\";\r\nimport { PropsBase, PropsSingle, DayEventHandler } from \"react-day-picker\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\nimport { Calendar } from \"./calendar\";\r\nimport { Button } from \"../button/Button\";\r\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover/Popover\";\r\n\r\ntype DesktopDatePickerProps = PropsBase &\r\n Omit<PropsSingle, \"mode\"> & {\r\n formatStr?: string;\r\n placeholder?: string;\r\n calendarClassName?: string;\r\n selected?: Date;\r\n required?: boolean;\r\n closeOnSelect?: boolean;\r\n disabled?: boolean;\r\n };\r\n\r\nconst DesktopDatePicker: React.FC<DesktopDatePickerProps> = ({\r\n formatStr,\r\n selected,\r\n placeholder,\r\n className,\r\n calendarClassName,\r\n closeOnSelect = true,\r\n onDayClick,\r\n disabled,\r\n ...props\r\n}) => {\r\n const [isOpen, setIsOpen] = React.useState(false);\r\n\r\n const handleDayClick: DayEventHandler<React.MouseEvent<Element, MouseEvent>> = (date, modifiers, e) => {\r\n onDayClick?.(date, modifiers, e);\r\n if (closeOnSelect) setIsOpen(false);\r\n };\r\n\r\n return (\r\n <Popover open={isOpen} onOpenChange={setIsOpen}>\r\n <PopoverTrigger asChild>\r\n <Button\r\n type=\"button\"\r\n variant=\"text\"\r\n className={cn(\r\n \"flex h-8 w-full items-center justify-between whitespace-nowrap rounded-sm border border-input bg-transparent ps-3 pe-1 py-1.5 text-xs ring-offset-background data-[placeholder]:text-muted-foreground hover:border hover:border-primary hover:bg-transparent focus:border focus:border-primary focus:outline-none focus:ring focus:ring-primary-100 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-text-300 disabled:border-gray-100 [&>span]:line-clamp-1 [&_svg]:disabled:text-text-300\",\r\n className,\r\n )}\r\n data-placeholder={!selected ? \"\" : undefined}\r\n aria-label={selected ? `Selected date: ${format(selected, formatStr ?? \"yyyy/MM/dd\")}` : \"Pick a date\"}\r\n disabled={disabled}\r\n >\r\n {selected ? format(selected, formatStr ?? \"yyyy/MM/dd\") : <span>{placeholder ?? \"Pick a date\"}</span>}\r\n <CalendarIcon className=\"mr-2 ms-auto\" />\r\n </Button>\r\n </PopoverTrigger>\r\n <PopoverContent className=\"w-auto p-0\">\r\n <Calendar\r\n defaultMonth={selected}\r\n startMonth={new Date(2000, 0, 1)}\r\n endMonth={new Date(new Date().getFullYear() + 2, 11, 31)}\r\n {...props}\r\n mode=\"single\"\r\n selected={selected}\r\n captionLayout=\"dropdown-years\"\r\n className={calendarClassName}\r\n onDayClick={handleDayClick}\r\n />\r\n </PopoverContent>\r\n </Popover>\r\n );\r\n};\r\n\r\nexport { DesktopDatePicker, type DesktopDatePickerProps };\r\n"],"names":["DesktopDatePicker","formatStr","selected","placeholder","className","calendarClassName","closeOnSelect","onDayClick","disabled","props","isOpen","setIsOpen","React","handleDayClick","date","modifiers","e","jsxs","Popover","jsx","PopoverTrigger","Button","cn","format","CalendarIcon","PopoverContent","Calendar"],"mappings":";;;;;;;;AAuBA,MAAMA,IAAsD,CAAC;AAAA,EAC3D,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAM,SAAS,EAAK,GAE1CC,IAAyE,CAACC,GAAMC,GAAWC,MAAM;AACrG,IAAAT,IAAaO,GAAMC,GAAWC,CAAC,GAC3BV,OAAyB,EAAK;AAAA,EACpC;AAEA,SACE,gBAAAW,EAACC,GAAA,EAAQ,MAAMR,GAAQ,cAAcC,GACnC,UAAA;AAAA,IAAA,gBAAAQ,EAACC,GAAA,EAAe,SAAO,IACrB,UAAA,gBAAAH;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,WAAWC;AAAA,UACT;AAAA,UACAlB;AAAA,QAAA;AAAA,QAEF,oBAAmBF,IAAgB,SAAL;AAAA,QAC9B,cAAYA,IAAW,kBAAkBqB,EAAOrB,GAAUD,KAAa,YAAY,CAAC,KAAK;AAAA,QACzF,UAAAO;AAAA,QAEC,UAAA;AAAA,UAAAN,IAAWqB,EAAOrB,GAAUD,KAAa,YAAY,IAAI,gBAAAkB,EAAC,QAAA,EAAM,eAAe,cAAA,CAAc;AAAA,UAC9F,gBAAAA,EAACK,GAAA,EAAa,WAAU,eAAA,CAAe;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAE3C;AAAA,IACA,gBAAAL,EAACM,GAAA,EAAe,WAAU,cACxB,UAAA,gBAAAN;AAAA,MAACO;AAAAA,MAAA;AAAA,QACC,cAAcxB;AAAA,QACd,YAAY,IAAI,KAAK,KAAM,GAAG,CAAC;AAAA,QAC/B,UAAU,IAAI,MAAK,oBAAI,KAAA,GAAO,gBAAgB,GAAG,IAAI,EAAE;AAAA,QACtD,GAAGO;AAAA,QACJ,MAAK;AAAA,QACL,UAAAP;AAAA,QACA,eAAc;AAAA,QACd,WAAWG;AAAA,QACX,YAAYQ;AAAA,MAAA;AAAA,IAAA,EACd,CACF;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"desktopdatepicker.es.js","sources":["../src/components/date-picker/DesktopDatePicker.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { format } from \"date-fns\";\r\nimport { Calendar as CalendarIcon } from \"@trsys-tech/matrix-icons\";\r\nimport { PropsBase, PropsSingle, DayEventHandler } from \"react-day-picker\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\nimport { Calendar } from \"./calendar\";\r\nimport { Button } from \"../button/Button\";\r\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover/Popover\";\r\n\r\ntype DesktopDatePickerProps = PropsBase &\r\n Omit<PropsSingle, \"mode\"> & {\r\n formatStr?: string;\r\n placeholder?: string;\r\n calendarClassName?: string;\r\n selected?: Date;\r\n required?: boolean;\r\n closeOnSelect?: boolean;\r\n disabled?: boolean;\r\n };\r\n\r\nconst DesktopDatePicker: React.FC<DesktopDatePickerProps> = ({\r\n formatStr,\r\n selected,\r\n placeholder,\r\n className,\r\n calendarClassName,\r\n closeOnSelect = true,\r\n onDayClick,\r\n disabled,\r\n ...props\r\n}) => {\r\n const [isOpen, setIsOpen] = React.useState(false);\r\n\r\n const handleDayClick: DayEventHandler<React.MouseEvent<Element, MouseEvent>> = (date, modifiers, e) => {\r\n onDayClick?.(date, modifiers, e);\r\n if (closeOnSelect) setIsOpen(false);\r\n };\r\n\r\n return (\r\n <Popover open={isOpen} onOpenChange={setIsOpen}>\r\n <PopoverTrigger asChild>\r\n <Button\r\n type=\"button\"\r\n variant=\"text\"\r\n className={cn(\r\n \"flex h-8 w-full items-center justify-between whitespace-nowrap rounded-sm border border-input bg-transparent ps-3 pe-1 py-1.5 text-xs ring-offset-background data-[placeholder]:text-muted-foreground hover:border hover:border-primary hover:bg-transparent focus:border focus:border-primary focus:outline-none focus:ring focus:ring-primary-100 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-text-300 disabled:border-gray-100 [&>span]:line-clamp-1 [&_svg]:disabled:text-text-300\",\r\n className,\r\n )}\r\n data-placeholder={!selected ? \"\" : undefined}\r\n aria-label={selected ? `Selected date: ${format(selected, formatStr ?? \"yyyy/MM/dd\")}` : \"Pick a date\"}\r\n aria-haspopup=\"dialog\"\r\n disabled={disabled}\r\n >\r\n {selected ? format(selected, formatStr ?? \"yyyy/MM/dd\") : <span>{placeholder ?? \"Pick a date\"}</span>}\r\n <CalendarIcon className=\"mr-2 ms-auto\" />\r\n </Button>\r\n </PopoverTrigger>\r\n <PopoverContent className=\"w-auto p-0\">\r\n <Calendar\r\n defaultMonth={selected}\r\n startMonth={new Date(2000, 0, 1)}\r\n endMonth={new Date(new Date().getFullYear() + 2, 11, 31)}\r\n {...props}\r\n mode=\"single\"\r\n selected={selected}\r\n captionLayout=\"dropdown-years\"\r\n className={calendarClassName}\r\n onDayClick={handleDayClick}\r\n />\r\n </PopoverContent>\r\n </Popover>\r\n );\r\n};\r\n\r\nexport { DesktopDatePicker, type DesktopDatePickerProps };\r\n"],"names":["DesktopDatePicker","formatStr","selected","placeholder","className","calendarClassName","closeOnSelect","onDayClick","disabled","props","isOpen","setIsOpen","React","handleDayClick","date","modifiers","e","jsxs","Popover","jsx","PopoverTrigger","Button","cn","format","CalendarIcon","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KAAA,GAAO,gBAAgB,GAAG,IAAI,EAAE;AAAA,QACtD,GAAGO;AAAA,QACJ,MAAK;AAAA,QACL,UAAAP;AAAA,QACA,eAAc;AAAA,QACd,WAAWG;AAAA,QACX,YAAYQ;AAAA,MAAA;AAAA,IAAA,EACd,CACF;AAAA,EAAA,GACF;AAEJ;"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@trsys-tech/matrix-library",
3
3
  "description": "MatrixUI Library",
4
4
  "private": false,
5
- "version": "0.6.3-canary-0",
5
+ "version": "0.6.3-canary-2",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",