@integrigo/integrigo-ui 1.6.17-f → 1.6.17-g
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.
@@ -7,6 +7,7 @@ interface SwitchOption {
|
|
7
7
|
export interface SwitchProps {
|
8
8
|
options: [SwitchOption, SwitchOption] | [SwitchOption, SwitchOption, SwitchOption];
|
9
9
|
active?: SwitchOption["id"];
|
10
|
+
onClick: (id: SwitchOption["id"]) => void;
|
10
11
|
}
|
11
12
|
export declare const Switch: React.FC<SwitchProps>;
|
12
13
|
export {};
|
package/package.json
CHANGED
@@ -11,6 +11,7 @@ const Template: ComponentStory<typeof Switch> = (args) => <Switch {...args} />;
|
|
11
11
|
|
12
12
|
export const TwoOptions = Template.bind({});
|
13
13
|
TwoOptions.args = {
|
14
|
+
onClick: (id) => console.log(id),
|
14
15
|
options: [
|
15
16
|
{ id: "1", name: "One" },
|
16
17
|
{ id: "2", name: "Two" },
|
@@ -19,6 +20,7 @@ TwoOptions.args = {
|
|
19
20
|
|
20
21
|
export const ThreeOptions = Template.bind({});
|
21
22
|
ThreeOptions.args = {
|
23
|
+
onClick: (id) => console.log(id),
|
22
24
|
options: [
|
23
25
|
{ id: "1", name: "One" },
|
24
26
|
{ id: "2", name: "Two" },
|
@@ -28,6 +30,7 @@ ThreeOptions.args = {
|
|
28
30
|
|
29
31
|
export const ThreeWithDisabled = Template.bind({});
|
30
32
|
ThreeWithDisabled.args = {
|
33
|
+
onClick: (id) => console.log(id),
|
31
34
|
options: [
|
32
35
|
{ id: "1", name: "One" },
|
33
36
|
{ id: "2", name: "Two", disabled: true },
|
@@ -12,11 +12,13 @@ export interface SwitchProps {
|
|
12
12
|
| [SwitchOption, SwitchOption]
|
13
13
|
| [SwitchOption, SwitchOption, SwitchOption];
|
14
14
|
active?: SwitchOption["id"];
|
15
|
+
onClick: (id: SwitchOption["id"]) => void;
|
15
16
|
}
|
16
17
|
|
17
18
|
export const Switch: React.FC<SwitchProps> = ({
|
18
19
|
options,
|
19
20
|
active: defaultActive,
|
21
|
+
onClick,
|
20
22
|
}) => {
|
21
23
|
const [active, setActive] = useState(defaultActive);
|
22
24
|
|
@@ -29,6 +31,7 @@ export const Switch: React.FC<SwitchProps> = ({
|
|
29
31
|
}
|
30
32
|
|
31
33
|
setActive(id);
|
34
|
+
onClick(id);
|
32
35
|
};
|
33
36
|
|
34
37
|
return (
|