sy-ui-lib 1.0.18 → 1.0.20
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/components/Icon/SvgIcons.d.ts +3 -0
- package/dist/components/PhoneNumberInput/PhoneNumberInput.types.d.ts +1 -1
- package/dist/components/Toggle/Toggle.component.d.ts +26 -1
- package/dist/components/Toggle/Toggle.stories.d.ts +1 -0
- package/dist/components/Toggle/Toggle.types.d.ts +17 -0
- package/dist/index.cjs +14 -14
- package/dist/index.css +1 -1
- package/dist/index.js +944 -809
- package/package.json +1 -1
|
@@ -77,4 +77,7 @@ export declare const icons: {
|
|
|
77
77
|
casino: (size: IconSize) => import("react/jsx-runtime").JSX.Element;
|
|
78
78
|
kabaddi: (size: IconSize) => import("react/jsx-runtime").JSX.Element;
|
|
79
79
|
virtualEvents: (size: IconSize) => import("react/jsx-runtime").JSX.Element;
|
|
80
|
+
currentOff: (size: IconSize) => import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
current: (size: IconSize) => import("react/jsx-runtime").JSX.Element;
|
|
82
|
+
save: (size: IconSize) => import("react/jsx-runtime").JSX.Element;
|
|
80
83
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InputFieldProps } from '../InputField';
|
|
2
2
|
/** Props associated with PhoneNumberInput component */
|
|
3
|
-
export interface PhoneNumberInputProps extends Omit<InputFieldProps, "type" | "iconName" | "onClick" | "onChange"
|
|
3
|
+
export interface PhoneNumberInputProps extends Omit<InputFieldProps, "type" | "iconName" | "onClick" | "onChange"> {
|
|
4
4
|
/** Handler function called when the phone input value changes. Receives the new value as a string. */
|
|
5
5
|
onChange?: (value: string) => void;
|
|
6
6
|
}
|
|
@@ -12,11 +12,36 @@ import { ToggleProps } from './Toggle.types';
|
|
|
12
12
|
* @param {string} [ariaLabel="Toggle"] Optional Accessibility label for the toggle button.
|
|
13
13
|
* @param {string} [onColor] Optional Tailwind color class for the "on" state of the toggle knob.
|
|
14
14
|
* @param {string} [offColor] Optional Tailwind color class for the "off" state of the toggle knob.
|
|
15
|
+
* @param {"sm" | "md"} [size="md"] Controls toggle dimensions
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
+
* @param {Object} [content] Optional state-based UI configuration
|
|
18
|
+
* @param {{ icon?: IconName; text?: string }} [content.on] UI for "on" state
|
|
19
|
+
* @param {{ icon?: IconName; text?: string }} [content.off] UI for "off" state
|
|
20
|
+
*
|
|
21
|
+
* @example usage:
|
|
17
22
|
* <Toggle checked={true} onChange={toggleHandler} />
|
|
18
23
|
* <Toggle checked={false} disabled />
|
|
19
24
|
* <Toggle checked={isOn} onChange={toggleHandler} onColor="bg-success" offColor="bg-error" />
|
|
25
|
+
*
|
|
26
|
+
* With content (icon + text):
|
|
27
|
+
* <Toggle
|
|
28
|
+
* checked={isOn}
|
|
29
|
+
* onChange={toggleHandler}
|
|
30
|
+
* content={{
|
|
31
|
+
* on: { icon: "check", text: "On" },
|
|
32
|
+
* off: { icon: "close", text: "Off" }
|
|
33
|
+
* }}
|
|
34
|
+
* />
|
|
35
|
+
*
|
|
36
|
+
* Icon only:
|
|
37
|
+
* <Toggle
|
|
38
|
+
* checked={isOn}
|
|
39
|
+
* onChange={toggleHandler}
|
|
40
|
+
* content={{
|
|
41
|
+
* on: { icon: "sun" },
|
|
42
|
+
* off: { icon: "moon" }
|
|
43
|
+
* }}
|
|
44
|
+
* />
|
|
20
45
|
*/
|
|
21
46
|
declare const Toggle: React.FC<ToggleProps>;
|
|
22
47
|
export default Toggle;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import { IconName } from '../Icon';
|
|
2
|
+
/** Available visual variants of the toggle component */
|
|
3
|
+
export type ToggleVarinat = "default" | "compound";
|
|
4
|
+
export type ToggleStateContent = {
|
|
5
|
+
/** Icon to display for a specific state */
|
|
6
|
+
icon?: IconName;
|
|
7
|
+
/** Text label to display for a specific state */
|
|
8
|
+
text?: string;
|
|
9
|
+
};
|
|
1
10
|
export interface ToggleProps {
|
|
2
11
|
checked?: boolean;
|
|
3
12
|
onChange: (checked: boolean) => void;
|
|
@@ -6,4 +15,12 @@ export interface ToggleProps {
|
|
|
6
15
|
onColor?: string;
|
|
7
16
|
offColor?: string;
|
|
8
17
|
size?: "sm" | "md";
|
|
18
|
+
/** Defines the visual style/structure of the toggle */
|
|
19
|
+
variant?: ToggleVarinat;
|
|
20
|
+
content?: {
|
|
21
|
+
/** UI (icon/text) to render when toggle is ON */
|
|
22
|
+
on?: ToggleStateContent;
|
|
23
|
+
/** UI (icon/text) to render when toggle is OFF */
|
|
24
|
+
off?: ToggleStateContent;
|
|
25
|
+
};
|
|
9
26
|
}
|