sy-ui-lib 1.0.36 → 1.0.38

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.
@@ -11,22 +11,23 @@ import { ButtonProps } from './Button.types';
11
11
  * - Customizable icon and text color
12
12
  *
13
13
  * Props:
14
- * @param {ButtonSize} [size="medium"] – Controls the padding and size of the button.
15
- * @param {ButtonVariant} [variant="primary"] – Visual style of the button (e.g., primary, ghost, danger).
16
- * @param {string} [text] – Optional text content displayed in the button.
17
- * @param {boolean} [disabled=false] – Whether the button is disabled.
18
- * @param {IconName} [iconName] – Optional icon to display.
19
- * @param {AvatarProps} [avatarProps] – Optional avatar to show beside the text/icon.
20
- * @param {function} [onClick] – Callback function triggered on button click.
21
- * @param {string} [iconPosition] - icon position when both icon and text are present.
22
- * @param {boolean} [isLoading] - shown loader and disable button if true.
23
- * @param {Color} [textColor] - Optional custom text color for the button text (applies to both icon and text). Overrides the default color based on variant.
24
- * @param {boolean} [fullWidth=false] - If true, the button will stretch to fill the width of its container.
14
+ * @param {ButtonSize} size Controls the padding and size of the button.
15
+ * @param {ButtonVariant} variant Visual style of the button (e.g., primary, ghost, danger).
16
+ * @param {string} text Optional text content displayed in the button.
17
+ * @param {boolean} disabled Whether the button is disabled.
18
+ * @param {IconName} iconName Optional icon to display.
19
+ * @param {AvatarProps} avatarProps Optional avatar to show beside the text/icon.
20
+ * @param {function} onClick Callback function triggered on button click.
21
+ * @param {string} iconPosition icon position when both icon and text are present.
22
+ * @param {boolean} isLoading shown loader and disable button if true.
23
+ * @param {Color} textColor Optional custom text color for the button text (applies to both icon and text). Overrides the default color based on variant.
24
+ * @param {boolean} fullWidth If true, the button will stretch to fill the width of its container.
25
+ * @param {string} disabledMessage Optional Tooltip message displayed when the button is disabled.
25
26
  *
26
- * Example usage:
27
+ * @example
27
28
  * <Button text="Submit" variant="success" iconName="check" iconPosition="left" isLoading={true} />
28
29
  * <Button avatarProps={{ src: "/user.png" }} text="Profile" />
29
- * <Button iconName="edit" size="small" textColor="primary"/>
30
+ * <Button iconName="edit" size="small" textColor="primary" disabled disabledMessage="Tooltip message" />
30
31
  * <Button text="Save" size="large" fullWidth />
31
32
  */
32
33
  declare const Button: React.FC<ButtonProps>;
@@ -16,3 +16,4 @@ export declare const LoadingButton: Story;
16
16
  export declare const TextWithAvatar: Story;
17
17
  export declare const DisabledButton: Story;
18
18
  export declare const FullWidthButton: Story;
19
+ export declare const DisabledButtonWithTooltip: Story;
@@ -1,6 +1,4 @@
1
- import { AvatarProps } from '../Avatar/Avatar.types';
2
- import { IconName } from '../Icon/Icon.types';
3
- import { TypoColor } from '../Typography/Typography.types';
1
+ import { AvatarProps, IconName, TypoColor } from '..';
4
2
  export type ButtonVariant = "primary" | "secondary" | "ghost" | "danger" | "success" | "outline";
5
3
  export type ButtonSize = "extraSmall" | "small" | "medium" | "large";
6
4
  export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
@@ -28,4 +26,6 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
28
26
  textColor?: TypoColor;
29
27
  /** Make the button take full container width when true.*/
30
28
  fullWidth?: boolean;
29
+ /** Tooltip displayed while the button is disabled. */
30
+ disabledMessage?: string;
31
31
  }
@@ -12,9 +12,10 @@ import { ChipProps } from './Chip.types';
12
12
  * @param {boolean} [isEditable=false] - If true, shows an edit icon and enforces "outlined" styling.
13
13
  * @param {iconName} [iconName] – Optional icon to display.
14
14
  * @param {() => void} [onClick] - Optional handler for when the chip is clicked.
15
+ * @param {string} tooltipText Tooltip displayed on hover.
15
16
  *
16
17
  * Example usage:
17
- * <Chip text="Active" state="active" iconName="timer" />
18
+ * <Chip text="Active" state="active" iconName="timer" tooltipText="Your account is locked due to multiple failed login attempts." />
18
19
  * <Chip text="Locked" state="locked" isEditable onClick={() => console.log("clicked")} />
19
20
  */
20
21
  declare const Chip: React.FC<ChipProps>;
@@ -33,6 +33,9 @@ declare const meta: {
33
33
  };
34
34
  options: string[];
35
35
  };
36
+ tooltipText: {
37
+ control: "text";
38
+ };
36
39
  };
37
40
  };
38
41
  export default meta;
@@ -55,3 +58,7 @@ export declare const PendingWithField: Story;
55
58
  export declare const PendingWithOutlined: Story;
56
59
  /** Pending with outlined example of Chip */
57
60
  export declare const InfoChip: Story;
61
+ /** Chip with a tooltip explaining its current state. */
62
+ export declare const WithTooltip: Story;
63
+ /** Editable chip with a tooltip. */
64
+ export declare const EditableWithTooltip: Story;
@@ -1,4 +1,4 @@
1
- import { IconName } from '../Icon/Icon.types';
1
+ import { IconName } from '..';
2
2
  /** Defines the available chip statuses */
3
3
  export type ChipType = "active" | "suspended" | "locked" | "pending" | "info";
4
4
  /** Defines the chip variant styles */
@@ -22,4 +22,6 @@ export interface ChipProps {
22
22
  iconName?: IconName;
23
23
  /** Size of the chip, affecting padding and minimum dimensions */
24
24
  size?: ChipSize;
25
+ /** Tooltip content displayed on hover. */
26
+ tooltipText?: string;
25
27
  }
@@ -10,7 +10,7 @@ import { EventDisplayCardProps } from './EventDisplayCard.types';
10
10
  * @param {string} title - The main heading or event label.
11
11
  * @param {ButtonProps[]} [actions] - An optional array of button props to render CTAs.
12
12
  *
13
- * Example usage:
13
+ * @example
14
14
  * <EventDisplayCard
15
15
  * iconName="cricketBat"
16
16
  * title="Bangladesh Emerg v/s South Africa Emerg"
@@ -12,9 +12,11 @@ import { IconProps } from './Icon.types';
12
12
  * @param {string} color Color of the icon (fill/stroke). Defaults to design system color
13
13
  * @param {function} onClick If provided, icon becomes clickable and renders as a <button>
14
14
  * @param {boolean} cursorPointer Enables pointer cursor styling when true. Defaults to true.
15
+ * @param {boolean} disabled Disabled pointer cursor styling when true. Defaults to false.
16
+ * @param {string} tooltipText Tooltip displayed on hover.
15
17
  *
16
- * Example usage:
17
- * <Icon icon='view' size={24} size={20} color="smokyblack" onClick={()=> console.log("clicked")} />
18
+ * @example
19
+ * <Icon icon='view' size={24} size={20} color="smokyblack" onClick={()=> console.log("clicked")} tooltipText="View account details." />
18
20
  */
19
21
  declare const Icon: React.FC<IconProps>;
20
22
  export default Icon;
@@ -4,28 +4,8 @@ import { icons } from './SvgIcons';
4
4
  * This ensures type-safe usage of icon names throughout the app.
5
5
  */
6
6
  export type IconName = keyof typeof icons;
7
- /**
8
- * IconSize defines the supported icon sizes in pixels.
9
- */
7
+ /** Supported icon sizes (in pixels). */
10
8
  export type IconSize = 12 | 16 | 20 | 24;
11
- /** A constant mapping of semantic color names to their corresponding CSS variable tokens */
12
- export declare const iconColor: {
13
- readonly primary: "--color-primary";
14
- readonly secondary: "--color-secondary";
15
- readonly success: "--color-success";
16
- readonly error: "--color-error";
17
- readonly black: "--color-black";
18
- readonly smokyblack: "--color-smokyblack";
19
- readonly slategray: "--color-slategray";
20
- readonly brightgray: "--color-brightgray";
21
- readonly offwhite: "--color-offwhite";
22
- readonly white: "--color-white";
23
- readonly goldenYellow: "--color-goldenYellow";
24
- readonly neutralGray: "--color-neutralGray";
25
- readonly techBlue: "--color-techBlue";
26
- };
27
- /** A union type representing all valid theme color names used in the iconColor map */
28
- export type IconColor = keyof typeof iconColor;
29
9
  /** Props associated with Icon Component */
30
10
  export type IconProps = {
31
11
  /** The name of the Icon to be rendered */
@@ -33,11 +13,15 @@ export type IconProps = {
33
13
  /** Optional size of the icon (in px). Defaults to 20 */
34
14
  size?: IconSize;
35
15
  /** Optional fill or stroke color. Defaults to icon's native color */
36
- color?: IconColor;
16
+ color?: string;
37
17
  /** Optional click handler for the icon */
38
18
  onClick?: (e: React.MouseEvent<HTMLElement>) => void;
39
19
  /** Optional. Enables pointer cursor styling (default: true). */
40
20
  cursorPointer?: boolean;
41
21
  /** Optional Tailwind or custom class */
42
22
  className?: string;
23
+ /** Disables interaction and applies disabled styling. */
24
+ disabled?: boolean;
25
+ /** Tooltip content displayed on hover. */
26
+ tooltipText?: string;
43
27
  };
@@ -1,4 +1,4 @@
1
- import { IconName } from '../Icon/Icon.types';
1
+ import { ButtonProps } from '..';
2
2
  export interface NullStateProps {
3
3
  /** Optional image URL to show. If not provided, a default image will be shown.*/
4
4
  image?: {
@@ -11,12 +11,5 @@ export interface NullStateProps {
11
11
  /** Optional descriptive text providing more context about the null state.*/
12
12
  description?: string;
13
13
  /** Here it is a CTA that can lead to change the state from null to something different.*/
14
- buttonProps?: {
15
- /** Text to display on the CTA button. */
16
- text: string;
17
- /** Optional icon to accompany the CTA button text. */
18
- iconName?: IconName;
19
- /** Optional click handler for the CTA button*/
20
- onClick?: () => void;
21
- };
14
+ buttonProps?: ButtonProps;
22
15
  }
@@ -1,18 +1,19 @@
1
1
  import { SearchBarProps } from './SearchBar.types';
2
2
  /**
3
- * SearchBar Component
3
+ * SearchBar
4
4
  *
5
- * This component use for getting searching input text
5
+ * A reusable search input with configurable sizes, optional full-width
6
+ * layout, and built-in debounced search support.
6
7
  *
7
8
  * Props:
8
- * @param {string} placeholder Placeholder text shown when the input is empty.
9
- * @param {"sm" | "lg" | "full"} size Defines the size of the input ("small", "large" or "fullWidth"). Default: "small".
10
- * @param {void} onSearch Callback triggered on input value change.
11
- * @param {number} debounceTime Set debounce time default value is "500" milliseconds.
12
- * @param {string} className Additional Tailwind CSS classes for custom styling. Default: "".
9
+ * @param {string} placeholder Placeholder text displayed when the input is empty.
10
+ * @param {"xs" | "sm" | "md" | "lg"} size Controls the size of the search bar.
11
+ * @param {boolean} fullWidth Expands the search bar to fill its container.
12
+ * @param {(value: string) => void} onSearch Callback invoked after the debounce delay.
13
+ * @param {number} debounceTime Debounce delay in milliseconds.
13
14
  *
14
- * Example usage:
15
- * <SearchBar placeholder='Search here' size = 'sm' />
15
+ * @example
16
+ * <SearchBar placeholder="Search here" size="sm" fullWidth />
16
17
  */
17
18
  declare const SearchBar: React.FC<SearchBarProps>;
18
19
  export default SearchBar;
@@ -3,6 +3,9 @@ import { SearchBarProps } from './SearchBar.types';
3
3
  declare const meta: Meta<SearchBarProps>;
4
4
  export default meta;
5
5
  type Story = StoryObj<SearchBarProps>;
6
+ export declare const ExtraSmallSize: Story;
6
7
  export declare const SmallSize: Story;
8
+ export declare const MediumSize: Story;
7
9
  export declare const LargeSize: Story;
10
+ export declare const FullWidthTrue: Story;
8
11
  export declare const SearchWithDebounce: Story;
@@ -3,7 +3,9 @@ export interface SearchBarProps {
3
3
  /** Placeholder text shown when the input is empty. */
4
4
  placeholder?: string;
5
5
  /** Defines the size of the input ("sm" or "lg"). */
6
- size?: "sm" | "lg" | "full";
6
+ size?: "xs" | "sm" | "md" | "lg";
7
+ /** Make the search bar take full container width when true.*/
8
+ fullWidth?: boolean;
7
9
  /** Callback triggered on input value change. */
8
10
  onSearch?: (value: string) => void;
9
11
  /** Set debounce time and default time is "500" milliseconds. */
@@ -11,6 +11,7 @@ import { ToggleProps } from './Toggle.types';
11
11
  * @param {boolean} [disabled=false] Optional If true, the toggle is non-interactive and visually muted.
12
12
  * @param {string} [ariaLabel="Toggle"] Optional Accessibility label for the toggle button.
13
13
  * @param {"sm" | "md"} [size="md"] Controls toggle dimensions
14
+ * @param {string} disabledMessage Optional Tooltip message displayed when the toggle is disabled.
14
15
  *
15
16
  * @param {Object} [content] Optional state-based UI configuration
16
17
  * @param {{ icon?: IconName; text?: string; color?: string }} [content.on] UI for "on" state
@@ -35,6 +36,8 @@ import { ToggleProps } from './Toggle.types';
35
36
  * <Toggle
36
37
  * checked={isOn}
37
38
  * onChange={toggleHandler}
39
+ * disabled
40
+ * disabledMessage="Tooltip message"
38
41
  * content={{
39
42
  * on: { icon: "sun" },
40
43
  * off: { icon: "moon" }
@@ -5,5 +5,6 @@ export default meta;
5
5
  type Story = StoryObj<ToggleProps>;
6
6
  export declare const ControlledToggle: Story;
7
7
  export declare const DisabledToggle: Story;
8
+ export declare const DisabledToggleWithTooltip: Story;
8
9
  export declare const CustomColorsToggle: Story;
9
10
  export declare const CompoundToggle: Story;
@@ -1,4 +1,4 @@
1
- import { IconName } from '../Icon';
1
+ import { IconName } from '..';
2
2
  /** Available visual variants of the toggle component:-
3
3
  * "compound" shows icon + text inside track, "default" is simple switch */
4
4
  export type ToggleVarinat = "default" | "compound";
@@ -25,4 +25,6 @@ export interface ToggleProps {
25
25
  /** UI (icon/text) to render when toggle is OFF */
26
26
  off?: ToggleStateContent;
27
27
  };
28
+ /** Tooltip displayed while the toggle is disabled. */
29
+ disabledMessage?: string;
28
30
  }