@algorithm-shift/design-system 1.2.35 → 1.2.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -100,6 +100,9 @@ interface TableProps extends ElementProps {
100
100
  itemsPerPage?: number;
101
101
  onPageChange?: (page: number) => void;
102
102
  loading?: boolean;
103
+ cellClickEnabled?: (cellData: Record<string, any>, columnId: string) => boolean;
104
+ onCellClick?: (cellData: Record<string, any>, columnId: string) => void;
105
+ getRowSelection?: (rowSelection: Record<string, boolean>) => void;
103
106
  }
104
107
 
105
108
  interface TabsProps extends ElementProps {
@@ -189,11 +192,11 @@ interface NavbarProps extends ElementProps {
189
192
 
190
193
  declare const Modal: ({ children, onClose, label, className, style }: ModalProps) => react_jsx_runtime.JSX.Element;
191
194
 
192
- declare const Flex: ({ children, className, style }: ElementProps) => react_jsx_runtime.JSX.Element;
195
+ declare const Flex: ({ children, className, style, ...props }: ElementProps) => react_jsx_runtime.JSX.Element;
193
196
 
194
- declare const Grid: ({ children, className, style }: ElementProps) => react_jsx_runtime.JSX.Element;
197
+ declare const Grid: ({ children, className, style, ...props }: ElementProps) => react_jsx_runtime.JSX.Element;
195
198
 
196
- declare const Container: ({ children, className, style }: ElementProps) => react_jsx_runtime.JSX.Element;
199
+ declare const Container: ({ children, className, style, ...props }: ElementProps) => react_jsx_runtime.JSX.Element;
197
200
 
198
201
  declare const ButtonWrapper: ({ className, style, textContent, ...props }: ButtonProps) => react_jsx_runtime.JSX.Element;
199
202
 
@@ -242,7 +245,7 @@ declare const DateRange: ({ className, style, ...props }: DateRangeInputProps) =
242
245
 
243
246
  declare const TextInputGroup: ({ className, style, prepend, append, ...props }: TextInputGroupProps) => react_jsx_runtime.JSX.Element;
244
247
 
245
- declare const Table: ({ columns, data, rowActions, className, style, pagination, itemsPerPage, onPageChange, loading }: TableProps) => react_jsx_runtime.JSX.Element;
248
+ declare const Table: ({ columns, data, rowActions, className, style, pagination, itemsPerPage, onPageChange, loading, ...props }: TableProps) => react_jsx_runtime.JSX.Element;
246
249
 
247
250
  interface CustomPaginationProps {
248
251
  totalPages: number;
@@ -272,6 +275,30 @@ declare const DonutChart: ({ className, style, ...props }: PieChartProps) => rea
272
275
 
273
276
  declare function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc, setShowBcc, cc, setCc, bcc, setBcc, subject, setSubject, body, setBody }: EmailComposerProps): react_jsx_runtime.JSX.Element;
274
277
 
278
+ type ToastVariant = 'default' | 'success' | 'error' | 'info' | 'warning';
279
+ type SonnerToastProps = {
280
+ title: string;
281
+ description?: string;
282
+ variant?: ToastVariant;
283
+ duration?: number;
284
+ actionLabel?: string;
285
+ onAction?: () => void;
286
+ };
287
+ declare function showSonnerToast({ title, description, variant, duration, actionLabel, onAction, }: SonnerToastProps): void;
288
+
289
+ declare function StateProvider({ children }: {
290
+ children: React$1.ReactNode;
291
+ }): react_jsx_runtime.JSX.Element;
292
+ declare function useAppState(): any;
293
+
294
+ type CanvasState = Record<string, any>;
295
+ type CanvasAction = {
296
+ type: 'SET_STATE';
297
+ key: string;
298
+ value: any;
299
+ };
300
+ declare function stateReducer(state: CanvasState, action: CanvasAction): CanvasState;
301
+
275
302
  declare function cn(...inputs: ClassValue[]): string;
276
303
 
277
- export { ChartComponent as BarChart, ButtonWrapper as Button, CheckboxInput as Checkbox, Container, DatePicker, DateRange, Dropdown, EmailInput as Email, EmailComposer, FileInput, Flex as FlexLayout, Grid as GridLayout, ImageControl as Image, Logo, Modal, MultiCheckbox, Navbar, Notification, NumberInput, CustomPagination as Pagination, PasswordInput as Password, PhoneInput as Phone, DonutChart as PieChart, Profile, RadioInput as RadioGroup, RichText, SearchInput as Search, Shape, Spacer, StagesComponent as Stages, SwitchToggle, Table, Tabs, TextInput as Text, TextInputGroup, Textarea, Typography, UrlInput as URL, cn };
304
+ export { ChartComponent as BarChart, ButtonWrapper as Button, CheckboxInput as Checkbox, Container, DatePicker, DateRange, Dropdown, EmailInput as Email, EmailComposer, FileInput, Flex as FlexLayout, Grid as GridLayout, ImageControl as Image, Logo, Modal, MultiCheckbox, Navbar, Notification, NumberInput, CustomPagination as Pagination, PasswordInput as Password, PhoneInput as Phone, DonutChart as PieChart, Profile, RadioInput as RadioGroup, RichText, SearchInput as Search, Shape, Spacer, StagesComponent as Stages, StateProvider, SwitchToggle, Table, Tabs, TextInput as Text, TextInputGroup, Textarea, Typography, UrlInput as URL, cn, showSonnerToast, stateReducer, useAppState };
package/dist/index.d.ts CHANGED
@@ -100,6 +100,9 @@ interface TableProps extends ElementProps {
100
100
  itemsPerPage?: number;
101
101
  onPageChange?: (page: number) => void;
102
102
  loading?: boolean;
103
+ cellClickEnabled?: (cellData: Record<string, any>, columnId: string) => boolean;
104
+ onCellClick?: (cellData: Record<string, any>, columnId: string) => void;
105
+ getRowSelection?: (rowSelection: Record<string, boolean>) => void;
103
106
  }
104
107
 
105
108
  interface TabsProps extends ElementProps {
@@ -189,11 +192,11 @@ interface NavbarProps extends ElementProps {
189
192
 
190
193
  declare const Modal: ({ children, onClose, label, className, style }: ModalProps) => react_jsx_runtime.JSX.Element;
191
194
 
192
- declare const Flex: ({ children, className, style }: ElementProps) => react_jsx_runtime.JSX.Element;
195
+ declare const Flex: ({ children, className, style, ...props }: ElementProps) => react_jsx_runtime.JSX.Element;
193
196
 
194
- declare const Grid: ({ children, className, style }: ElementProps) => react_jsx_runtime.JSX.Element;
197
+ declare const Grid: ({ children, className, style, ...props }: ElementProps) => react_jsx_runtime.JSX.Element;
195
198
 
196
- declare const Container: ({ children, className, style }: ElementProps) => react_jsx_runtime.JSX.Element;
199
+ declare const Container: ({ children, className, style, ...props }: ElementProps) => react_jsx_runtime.JSX.Element;
197
200
 
198
201
  declare const ButtonWrapper: ({ className, style, textContent, ...props }: ButtonProps) => react_jsx_runtime.JSX.Element;
199
202
 
@@ -242,7 +245,7 @@ declare const DateRange: ({ className, style, ...props }: DateRangeInputProps) =
242
245
 
243
246
  declare const TextInputGroup: ({ className, style, prepend, append, ...props }: TextInputGroupProps) => react_jsx_runtime.JSX.Element;
244
247
 
245
- declare const Table: ({ columns, data, rowActions, className, style, pagination, itemsPerPage, onPageChange, loading }: TableProps) => react_jsx_runtime.JSX.Element;
248
+ declare const Table: ({ columns, data, rowActions, className, style, pagination, itemsPerPage, onPageChange, loading, ...props }: TableProps) => react_jsx_runtime.JSX.Element;
246
249
 
247
250
  interface CustomPaginationProps {
248
251
  totalPages: number;
@@ -272,6 +275,30 @@ declare const DonutChart: ({ className, style, ...props }: PieChartProps) => rea
272
275
 
273
276
  declare function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc, setShowBcc, cc, setCc, bcc, setBcc, subject, setSubject, body, setBody }: EmailComposerProps): react_jsx_runtime.JSX.Element;
274
277
 
278
+ type ToastVariant = 'default' | 'success' | 'error' | 'info' | 'warning';
279
+ type SonnerToastProps = {
280
+ title: string;
281
+ description?: string;
282
+ variant?: ToastVariant;
283
+ duration?: number;
284
+ actionLabel?: string;
285
+ onAction?: () => void;
286
+ };
287
+ declare function showSonnerToast({ title, description, variant, duration, actionLabel, onAction, }: SonnerToastProps): void;
288
+
289
+ declare function StateProvider({ children }: {
290
+ children: React$1.ReactNode;
291
+ }): react_jsx_runtime.JSX.Element;
292
+ declare function useAppState(): any;
293
+
294
+ type CanvasState = Record<string, any>;
295
+ type CanvasAction = {
296
+ type: 'SET_STATE';
297
+ key: string;
298
+ value: any;
299
+ };
300
+ declare function stateReducer(state: CanvasState, action: CanvasAction): CanvasState;
301
+
275
302
  declare function cn(...inputs: ClassValue[]): string;
276
303
 
277
- export { ChartComponent as BarChart, ButtonWrapper as Button, CheckboxInput as Checkbox, Container, DatePicker, DateRange, Dropdown, EmailInput as Email, EmailComposer, FileInput, Flex as FlexLayout, Grid as GridLayout, ImageControl as Image, Logo, Modal, MultiCheckbox, Navbar, Notification, NumberInput, CustomPagination as Pagination, PasswordInput as Password, PhoneInput as Phone, DonutChart as PieChart, Profile, RadioInput as RadioGroup, RichText, SearchInput as Search, Shape, Spacer, StagesComponent as Stages, SwitchToggle, Table, Tabs, TextInput as Text, TextInputGroup, Textarea, Typography, UrlInput as URL, cn };
304
+ export { ChartComponent as BarChart, ButtonWrapper as Button, CheckboxInput as Checkbox, Container, DatePicker, DateRange, Dropdown, EmailInput as Email, EmailComposer, FileInput, Flex as FlexLayout, Grid as GridLayout, ImageControl as Image, Logo, Modal, MultiCheckbox, Navbar, Notification, NumberInput, CustomPagination as Pagination, PasswordInput as Password, PhoneInput as Phone, DonutChart as PieChart, Profile, RadioInput as RadioGroup, RichText, SearchInput as Search, Shape, Spacer, StagesComponent as Stages, StateProvider, SwitchToggle, Table, Tabs, TextInput as Text, TextInputGroup, Textarea, Typography, UrlInput as URL, cn, showSonnerToast, stateReducer, useAppState };
package/dist/index.js CHANGED
@@ -60,6 +60,7 @@ __export(index_exports, {
60
60
  Shape: () => Shape_default,
61
61
  Spacer: () => Spacer_default,
62
62
  Stages: () => Stages_default,
63
+ StateProvider: () => StateProvider,
63
64
  SwitchToggle: () => SwitchToggle_default,
64
65
  Table: () => Table_default,
65
66
  Tabs: () => Tabs_default,
@@ -68,7 +69,10 @@ __export(index_exports, {
68
69
  Textarea: () => Textarea_default,
69
70
  Typography: () => Typography_default,
70
71
  URL: () => UrlInput_default,
71
- cn: () => cn
72
+ cn: () => cn,
73
+ showSonnerToast: () => showSonnerToast,
74
+ stateReducer: () => stateReducer,
75
+ useAppState: () => useAppState
72
76
  });
73
77
  module.exports = __toCommonJS(index_exports);
74
78
 
@@ -104,9 +108,10 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
104
108
  var Flex = ({
105
109
  children,
106
110
  className,
107
- style
111
+ style,
112
+ ...props
108
113
  }) => {
109
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className, style, children });
114
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ...props, className, style, children });
110
115
  };
111
116
  var Flex_default = Flex;
112
117
 
@@ -115,9 +120,10 @@ var import_jsx_runtime3 = require("react/jsx-runtime");
115
120
  var Grid = ({
116
121
  children,
117
122
  className,
118
- style
123
+ style,
124
+ ...props
119
125
  }) => {
120
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className, style, children });
126
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ...props, className, style, children });
121
127
  };
122
128
  var Grid_default = Grid;
123
129
 
@@ -126,9 +132,10 @@ var import_jsx_runtime4 = require("react/jsx-runtime");
126
132
  var Container = ({
127
133
  children,
128
134
  className,
129
- style
135
+ style,
136
+ ...props
130
137
  }) => {
131
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className, style, children });
138
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ...props, className, style, children });
132
139
  };
133
140
  var Container_default = Container;
134
141
 
@@ -1801,7 +1808,7 @@ var DateRange_default = DateRange;
1801
1808
  // src/components/Inputs/TextInputGroup/TextInputGroup.tsx
1802
1809
  var React14 = __toESM(require("react"));
1803
1810
  var import_jsx_runtime36 = require("react/jsx-runtime");
1804
- var TextInputGroup = ({ className, style, prepend, append = ".com", ...props }) => {
1811
+ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
1805
1812
  const placeholder = props.placeholder ?? "Placeholder text";
1806
1813
  const isEditable = props.isEditable ?? true;
1807
1814
  const isDisabled = props.isDisabled ?? false;
@@ -2194,7 +2201,18 @@ var Pagination_default = CustomPagination;
2194
2201
  // src/components/DataDisplay/Table/Table.tsx
2195
2202
  var import_react13 = require("react");
2196
2203
  var import_jsx_runtime41 = require("react/jsx-runtime");
2197
- var Table2 = ({ columns, data, rowActions, className, style, pagination = false, itemsPerPage = 10, onPageChange, loading = false }) => {
2204
+ var Table2 = ({
2205
+ columns,
2206
+ data,
2207
+ rowActions,
2208
+ className,
2209
+ style,
2210
+ pagination = false,
2211
+ itemsPerPage = 10,
2212
+ onPageChange,
2213
+ loading = false,
2214
+ ...props
2215
+ }) => {
2198
2216
  const rawColumns = Array.isArray(columns) ? columns : [];
2199
2217
  const rawData = Array.isArray(data) ? data : [];
2200
2218
  const rawRowActions = Array.isArray(rowActions) ? rowActions : [];
@@ -2206,7 +2224,16 @@ var Table2 = ({ columns, data, rowActions, className, style, pagination = false,
2206
2224
  };
2207
2225
  const paginatedData = enablePagination ? rawData.slice((currentPage - 1) * itemsPerPage, currentPage * itemsPerPage) : rawData;
2208
2226
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: `${className} space-y-3`, style, children: [
2209
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DataTable, { columns: rawColumns, data: paginatedData, rowActions: rawRowActions, loading }),
2227
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2228
+ DataTable,
2229
+ {
2230
+ ...props,
2231
+ columns: rawColumns,
2232
+ data: paginatedData,
2233
+ rowActions: rawRowActions,
2234
+ loading
2235
+ }
2236
+ ),
2210
2237
  enablePagination && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2211
2238
  Pagination_default,
2212
2239
  {
@@ -2787,6 +2814,67 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
2787
2814
  ] })
2788
2815
  ] }) });
2789
2816
  }
2817
+
2818
+ // src/components/ui/sonner-toast.tsx
2819
+ var import_sonner = require("sonner");
2820
+ function showSonnerToast({
2821
+ title,
2822
+ description,
2823
+ variant = "default",
2824
+ duration = 3e3,
2825
+ actionLabel,
2826
+ onAction
2827
+ }) {
2828
+ const options = {
2829
+ description,
2830
+ duration,
2831
+ action: actionLabel ? {
2832
+ label: actionLabel,
2833
+ onClick: onAction || (() => {
2834
+ })
2835
+ } : void 0
2836
+ };
2837
+ switch (variant) {
2838
+ case "success":
2839
+ import_sonner.toast.success(title, options);
2840
+ break;
2841
+ case "error":
2842
+ import_sonner.toast.error(title, options);
2843
+ break;
2844
+ case "info":
2845
+ import_sonner.toast.info(title, options);
2846
+ break;
2847
+ case "warning":
2848
+ import_sonner.toast.warning(title, options);
2849
+ break;
2850
+ default:
2851
+ (0, import_sonner.toast)(title, options);
2852
+ }
2853
+ }
2854
+
2855
+ // src/components/StateManagment/StateContext.tsx
2856
+ var import_react15 = require("react");
2857
+
2858
+ // src/components/StateManagment/stateReducer.ts
2859
+ function stateReducer(state, action) {
2860
+ switch (action.type) {
2861
+ case "SET_STATE":
2862
+ return { ...state, [action.key]: action.value };
2863
+ default:
2864
+ return state;
2865
+ }
2866
+ }
2867
+
2868
+ // src/components/StateManagment/StateContext.tsx
2869
+ var import_jsx_runtime54 = require("react/jsx-runtime");
2870
+ var StateContext = (0, import_react15.createContext)(null);
2871
+ function StateProvider({ children }) {
2872
+ const [state, dispatch] = (0, import_react15.useReducer)(stateReducer, {});
2873
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(StateContext.Provider, { value: { state, dispatch }, children });
2874
+ }
2875
+ function useAppState() {
2876
+ return (0, import_react15.useContext)(StateContext);
2877
+ }
2790
2878
  // Annotate the CommonJS export names for ESM import in node:
2791
2879
  0 && (module.exports = {
2792
2880
  BarChart,
@@ -2819,6 +2907,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
2819
2907
  Shape,
2820
2908
  Spacer,
2821
2909
  Stages,
2910
+ StateProvider,
2822
2911
  SwitchToggle,
2823
2912
  Table,
2824
2913
  Tabs,
@@ -2827,7 +2916,10 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
2827
2916
  Textarea,
2828
2917
  Typography,
2829
2918
  URL,
2830
- cn
2919
+ cn,
2920
+ showSonnerToast,
2921
+ stateReducer,
2922
+ useAppState
2831
2923
  });
2832
2924
  /*! Bundled license information:
2833
2925