@grasp-labs/ds-react-components 0.26.0 → 0.28.0

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.
@@ -0,0 +1,23 @@
1
+ import { ReactNode } from 'react';
2
+ import { ToggleButtonColor } from './ToggleButtonTrack';
3
+ export type ToggleButtonProps = React.InputHTMLAttributes<HTMLInputElement> & {
4
+ /** Label shown when toggle is ON */
5
+ enabledLabel?: string;
6
+ /** Label shown when toggle is OFF */
7
+ disabledLabel?: string;
8
+ /** External label text */
9
+ label?: string;
10
+ /** Color scheme of the toggle */
11
+ color?: ToggleButtonColor;
12
+ /** Optional extra content (e.g. tooltip, icon) */
13
+ children?: ReactNode;
14
+ /** Ref for the input element */
15
+ ref?: React.Ref<HTMLInputElement>;
16
+ };
17
+ /**
18
+ * A toggle button component with optional inner text and external label.
19
+ * Supports multiple color schemes with smooth animations.
20
+ *
21
+ * @param props - The props for the ToggleButton component.
22
+ */
23
+ export declare const ToggleButton: ({ value, enabledLabel, disabledLabel, label, checked, disabled, color, onChange, className, children, ref, id, name, ...rest }: ToggleButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ export type ToggleButtonColor = "primary" | "error" | "warning" | "success";
2
+ export type ToggleButtonTrackProps = {
3
+ /** Whether the toggle is checked/on */
4
+ checked?: boolean;
5
+ /** Whether the toggle is disabled */
6
+ disabled?: boolean;
7
+ /** Color scheme of the toggle */
8
+ color?: ToggleButtonColor;
9
+ /** Label shown when toggle is ON (slides in from right when enabled) */
10
+ enabledLabel?: string;
11
+ /** Label shown when toggle is OFF (slides in from left when disabled) */
12
+ disabledLabel?: string;
13
+ /** Additional CSS classes */
14
+ className?: string;
15
+ };
16
+ /**
17
+ * A visual track component for toggle button states.
18
+ * Renders the track, thumb, and optional inner text.
19
+ *
20
+ * @param props - The props for the ToggleButtonTrack component.
21
+ * @returns The rendered toggle track element.
22
+ */
23
+ export declare const ToggleButtonTrack: ({ checked, disabled, color, enabledLabel, disabledLabel, className, }: ToggleButtonTrackProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export { ToggleButton } from './ToggleButton';
2
+ export type { ToggleButtonProps } from './ToggleButton';
3
+ export { ToggleButtonTrack } from './ToggleButtonTrack';
4
+ export type { ToggleButtonTrackProps, ToggleButtonColor, } from './ToggleButtonTrack';