sy-ui-lib 1.0.11 → 1.0.13

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,28 +1,3 @@
1
1
  import { DatePickerProps } from './DatePicker.types';
2
- /**
3
- * A reusable and customizable date picker component that supports both
4
- * single date and date range selection using `react-day-picker`.
5
- *
6
- * @param {string} [title] - Optional button text placeholder. Default is "Select Date".
7
- * @param {(value: HandleSelectDatePicker) => void} selectedDate - Callback function
8
- * triggered when the user applies a selected date or range.
9
- * @param {HandleSelectDatePicker} [value] - Controlled selected value (single date or date range).
10
- * @param {boolean} [fullWidth] - If true, the date picker will stretch to full width of its container.
11
- * @param {number} [maxPastDays] - Maximum number of past days selectable.
12
- * @param {number} [maxRangeDays] - Maximum range in days (for range mode).
13
- * @param {boolean} [currentSelected] - If true, today is pre-selected on mount.
14
- *
15
- * @returns {JSX.Element} The rendered DatePicker component.
16
- *
17
- * @example
18
- * <DatePicker
19
- * title="Pick a date"
20
- * fullWidth
21
- * maxPastDays={30}
22
- * maxRangeDays={14}
23
- * currentSelected
24
- * selectedDate={(value) => console.log("Selected:", value)}
25
- * />
26
- */
27
2
  declare const DatePicker: React.FC<DatePickerProps>;
28
3
  export default DatePicker;
@@ -5,6 +5,5 @@ export default meta;
5
5
  type Story = StoryObj<DatePickerProps>;
6
6
  export declare const Default: Story;
7
7
  export declare const CustomTitle: Story;
8
- export declare const CurrentDateSelected: Story;
9
8
  export declare const MaxPastDays: Story;
10
- export declare const MaxRangeDays: Story;
9
+ export declare const Range: Story;
@@ -1,33 +1,30 @@
1
- import { DateRange } from 'react-day-picker';
2
- /**
3
- * The selection mode for the date picker.
4
- * - "single": For selecting a single date
5
- * - "range": For selecting a date range
6
- */
1
+ import { ButtonSize } from '../Button';
2
+ /** "single": For selecting a single date. "range": For selecting a date range*/
7
3
  export type DatePickerMode = "single" | "range";
8
- /**
9
- * Represents the value returned from the date picker based on the selected mode.
10
- * - `Date`: when mode is "single"
11
- * - `DateRange`: when mode is "range" (includes `from` and optional `to`)
12
- * - `undefined`: when no date is selected
13
- */
14
- export type HandleSelectDatePicker = Date | DateRange | undefined;
15
- /**
16
- * Props for the reusable DatePicker component.
17
- */
4
+ /** Props for the reusable DatePicker component. */
18
5
  export interface DatePickerProps {
19
6
  /** Optional title/label to show above the date picker, default value "Select Date" */
20
7
  title?: string;
21
- /** Callback function that receives the selected date or date range */
22
- selectedDate: (value: HandleSelectDatePicker) => void;
23
- /** External selected value to control DatePicker state (single or range) */
24
- value?: HandleSelectDatePicker;
25
- /** Defines the size of the date picker ("sm" or "lg"). */
26
- size?: "sm" | "lg" | "full";
27
- /** Maximum number of past days selectable. */
8
+ /** Defines picker behavior */
9
+ variant?: DatePickerMode;
10
+ /** Selected date (controlled) */
11
+ value?: Date;
12
+ /** Callback when single date changes */
13
+ onChange?: (date: Date | undefined) => void;
14
+ /** Selected "from" date */
15
+ fromDate?: Date;
16
+ /** Selected "to" date */
17
+ toDate?: Date;
18
+ /** Callback when "from" date changes */
19
+ onFromChange?: (date: Date | undefined) => void;
20
+ /** Callback when "to" date changes */
21
+ onToChange?: (date: Date | undefined) => void;
22
+ /** Size of the picker */
23
+ size?: ButtonSize;
24
+ /** Maximum selectable past days */
28
25
  maxPastDays?: number;
29
- /** Maximum range in days (for range mode).*/
26
+ /** Maximum selectable past days */
30
27
  maxRangeDays?: number;
31
- /** If true, today is pre-selected on mount.*/
28
+ /** If true, today is pre-selected on mount. */
32
29
  currentSelected?: boolean;
33
30
  }
@@ -1,3 +1,4 @@
1
+ import { ButtonSize } from '../Button';
1
2
  /**
2
3
  * Represents an individual option in the dropdown.
3
4
  */
@@ -12,7 +13,7 @@ export interface DropdownProps {
12
13
  /** The fallback label to display when no option is selected. */
13
14
  label: string;
14
15
  /** Defines the size of the dropdown button and options. default value is "sm" */
15
- size?: "sm" | "lg" | "full";
16
+ size?: ButtonSize;
16
17
  /** List of dropdown options available for selection. */
17
18
  options: DropdownOptionValues[];
18
19
  /** Currently selected option. Must be one of the items from `options`. */
@@ -1,3 +1,4 @@
1
+ import { ButtonSize } from '../Button';
1
2
  export interface MultiSelectOptionValues {
2
3
  /** The visible label shown in the dropdown list and selected state */
3
4
  label: string;
@@ -9,7 +10,7 @@ export interface MultiSelectDropdownProps {
9
10
  /** The fallback label to display when no option is selected. */
10
11
  label: string;
11
12
  /** Defines the size of the dropdown button and options. default value is "sm" */
12
- size?: "sm" | "lg" | "full";
13
+ size?: ButtonSize;
13
14
  /** List of dropdown options available for selection. */
14
15
  options: MultiSelectOptionValues[];
15
16
  /** Currently selected option. Must be one of the items from `options`. */
@@ -33,7 +33,7 @@ import { SnackBarProps } from './SnackBar.types';
33
33
  * });
34
34
  *
35
35
  * @component
36
- * @param {string} message - The message text to show in the snackbar.
36
+ * @param {React.ReactNode} message - The message text / custom UI to show in the snackbar.
37
37
  * @param {"info" | "success" | "error"} [type="info"] - The type of snackbar (affects color).
38
38
  * @param {"default" | "action" | "dismiss"} [variant="default"] - Type of interaction allowed.
39
39
  * @param {number} [duration=3000] - Duration in milliseconds before it auto-dismisses.
@@ -17,7 +17,7 @@ export interface DismissProps {
17
17
  /** Base props common to all snackbar variants */
18
18
  interface SnackBarBaseProps {
19
19
  /** Message text to display in the snackbar */
20
- message: string;
20
+ message: React.ReactNode;
21
21
  /** Time (in milliseconds) before the snackbar auto-dismisses */
22
22
  duration?: number;
23
23
  /** Type of message (info, success, error) to control the snackbar color */
@@ -29,10 +29,10 @@ type SnackbarOptions = {
29
29
  /** Trigger global snackbars.*/
30
30
  export declare const snackbar: {
31
31
  /** Show success snackbar */
32
- success: (message: string, options?: SnackbarOptions) => void;
32
+ success: (message: React.ReactNode, options?: SnackbarOptions) => void;
33
33
  /** Show error snackbar */
34
- error: (message: string, options?: SnackbarOptions) => void;
34
+ error: (message: React.ReactNode, options?: SnackbarOptions) => void;
35
35
  /** Show info snackbar */
36
- info: (message: string, options?: SnackbarOptions) => void;
36
+ info: (message: React.ReactNode, options?: SnackbarOptions) => void;
37
37
  };
38
38
  export {};