@bothub-chat/ui 2.60.0-feat-switcher-a744b586-a49c-47ce-8f4d-b95013faac4b → 2.60.0-feat-switcher-52ce3f48-af9f-4d6d-bf8c-6649d2e0f077
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 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as
|
|
1
|
+
import{jsxs as e,jsx as n}from"react/jsx-runtime";import{useState as t,useRef as r,useEffect as i}from"react";import{SwitcherContainer as o,SwitcherSlider as c,SwitcherOption as l}from"./styled.js";const s=({options:s,defaultOption:u=0,onChange:d,className:f})=>{const[m,a]=t(u),[p,h]=t(0),[w,g]=t(0),C=r(null),v=r(null),j=r(null);i(()=>{k()},[m]),i(()=>{const e=()=>{k()};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[m]);const k=()=>{const e=[v,j][m];if(e.current&&C.current){const n=C.current.getBoundingClientRect(),t=e.current.getBoundingClientRect(),r=t.left-n.left,{width:i}=t;h(r),g(i)}},x=()=>{a(e=>0===e?1:0),null==d||d(0===m?1:0)};return e(o,{ref:C,className:f,children:[n(c,{position:p,width:w}),n(l,{ref:v,onClick:x,children:s[0]}),n(l,{ref:j,onClick:x,children:s[1]})]})};export{s as SwitcherSelect};
|
|
@@ -282,7 +282,7 @@ export declare const SwitcherContainer: import("styled-components").IStyledCompo
|
|
|
282
282
|
onTransitionStart?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
283
283
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
284
284
|
}>;
|
|
285
|
-
export declare const SwitcherOption: import("styled-components").IStyledComponent<"web",
|
|
285
|
+
export declare const SwitcherOption: import("styled-components").IStyledComponent<"web", {
|
|
286
286
|
variant?: import("../typography").TypographyVariant | undefined;
|
|
287
287
|
component?: import("../typography").TypographyComponent | undefined;
|
|
288
288
|
align?: import("../typography").TypographyAlign | undefined;
|
|
@@ -571,9 +571,7 @@ export declare const SwitcherOption: import("styled-components").IStyledComponen
|
|
|
571
571
|
onTransitionStart?: import("react").TransitionEventHandler<HTMLSpanElement> | undefined;
|
|
572
572
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLSpanElement> | undefined;
|
|
573
573
|
ref?: import("react").Ref<HTMLSpanElement> | undefined;
|
|
574
|
-
}
|
|
575
|
-
isActive: boolean;
|
|
576
|
-
}>>;
|
|
574
|
+
}>;
|
|
577
575
|
export declare const SwitcherSlider: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
578
576
|
position: number;
|
|
579
577
|
width: number;
|
package/package.json
CHANGED