@algorithm-shift/design-system 1.2.35 → 1.2.36

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 {
@@ -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 {
@@ -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
 
@@ -1801,7 +1805,7 @@ var DateRange_default = DateRange;
1801
1805
  // src/components/Inputs/TextInputGroup/TextInputGroup.tsx
1802
1806
  var React14 = __toESM(require("react"));
1803
1807
  var import_jsx_runtime36 = require("react/jsx-runtime");
1804
- var TextInputGroup = ({ className, style, prepend, append = ".com", ...props }) => {
1808
+ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
1805
1809
  const placeholder = props.placeholder ?? "Placeholder text";
1806
1810
  const isEditable = props.isEditable ?? true;
1807
1811
  const isDisabled = props.isDisabled ?? false;
@@ -2194,7 +2198,18 @@ var Pagination_default = CustomPagination;
2194
2198
  // src/components/DataDisplay/Table/Table.tsx
2195
2199
  var import_react13 = require("react");
2196
2200
  var import_jsx_runtime41 = require("react/jsx-runtime");
2197
- var Table2 = ({ columns, data, rowActions, className, style, pagination = false, itemsPerPage = 10, onPageChange, loading = false }) => {
2201
+ var Table2 = ({
2202
+ columns,
2203
+ data,
2204
+ rowActions,
2205
+ className,
2206
+ style,
2207
+ pagination = false,
2208
+ itemsPerPage = 10,
2209
+ onPageChange,
2210
+ loading = false,
2211
+ ...props
2212
+ }) => {
2198
2213
  const rawColumns = Array.isArray(columns) ? columns : [];
2199
2214
  const rawData = Array.isArray(data) ? data : [];
2200
2215
  const rawRowActions = Array.isArray(rowActions) ? rowActions : [];
@@ -2206,7 +2221,16 @@ var Table2 = ({ columns, data, rowActions, className, style, pagination = false,
2206
2221
  };
2207
2222
  const paginatedData = enablePagination ? rawData.slice((currentPage - 1) * itemsPerPage, currentPage * itemsPerPage) : rawData;
2208
2223
  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 }),
2224
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2225
+ DataTable,
2226
+ {
2227
+ ...props,
2228
+ columns: rawColumns,
2229
+ data: paginatedData,
2230
+ rowActions: rawRowActions,
2231
+ loading
2232
+ }
2233
+ ),
2210
2234
  enablePagination && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2211
2235
  Pagination_default,
2212
2236
  {
@@ -2787,6 +2811,67 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
2787
2811
  ] })
2788
2812
  ] }) });
2789
2813
  }
2814
+
2815
+ // src/components/ui/sonner-toast.tsx
2816
+ var import_sonner = require("sonner");
2817
+ function showSonnerToast({
2818
+ title,
2819
+ description,
2820
+ variant = "default",
2821
+ duration = 3e3,
2822
+ actionLabel,
2823
+ onAction
2824
+ }) {
2825
+ const options = {
2826
+ description,
2827
+ duration,
2828
+ action: actionLabel ? {
2829
+ label: actionLabel,
2830
+ onClick: onAction || (() => {
2831
+ })
2832
+ } : void 0
2833
+ };
2834
+ switch (variant) {
2835
+ case "success":
2836
+ import_sonner.toast.success(title, options);
2837
+ break;
2838
+ case "error":
2839
+ import_sonner.toast.error(title, options);
2840
+ break;
2841
+ case "info":
2842
+ import_sonner.toast.info(title, options);
2843
+ break;
2844
+ case "warning":
2845
+ import_sonner.toast.warning(title, options);
2846
+ break;
2847
+ default:
2848
+ (0, import_sonner.toast)(title, options);
2849
+ }
2850
+ }
2851
+
2852
+ // src/components/StateManagment/StateContext.tsx
2853
+ var import_react15 = require("react");
2854
+
2855
+ // src/components/StateManagment/stateReducer.ts
2856
+ function stateReducer(state, action) {
2857
+ switch (action.type) {
2858
+ case "SET_STATE":
2859
+ return { ...state, [action.key]: action.value };
2860
+ default:
2861
+ return state;
2862
+ }
2863
+ }
2864
+
2865
+ // src/components/StateManagment/StateContext.tsx
2866
+ var import_jsx_runtime54 = require("react/jsx-runtime");
2867
+ var StateContext = (0, import_react15.createContext)(null);
2868
+ function StateProvider({ children }) {
2869
+ const [state, dispatch] = (0, import_react15.useReducer)(stateReducer, {});
2870
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(StateContext.Provider, { value: { state, dispatch }, children });
2871
+ }
2872
+ function useAppState() {
2873
+ return (0, import_react15.useContext)(StateContext);
2874
+ }
2790
2875
  // Annotate the CommonJS export names for ESM import in node:
2791
2876
  0 && (module.exports = {
2792
2877
  BarChart,
@@ -2819,6 +2904,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
2819
2904
  Shape,
2820
2905
  Spacer,
2821
2906
  Stages,
2907
+ StateProvider,
2822
2908
  SwitchToggle,
2823
2909
  Table,
2824
2910
  Tabs,
@@ -2827,7 +2913,10 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
2827
2913
  Textarea,
2828
2914
  Typography,
2829
2915
  URL,
2830
- cn
2916
+ cn,
2917
+ showSonnerToast,
2918
+ stateReducer,
2919
+ useAppState
2831
2920
  });
2832
2921
  /*! Bundled license information:
2833
2922