UNPKG

@accelint/design-toolkit

Version:

An open-source component library to serve as part of the entire ecosystem of UX for Accelint.

4 lines (3 loc) 958 B
'use client'; import {jsx,jsxs,Fragment}from'react/jsx-runtime';import'client-only';import {createContext}from'react';import {useContextProps,Switch,composeRenderProps}from'react-aria-components';import {SwitchStyles}from'./styles.js';const {switch:d,control:u,label:N}=SwitchStyles(),c=createContext(null);function a({children:t,...e}){return jsx(c.Provider,{value:e,children:t})}a.displayName="Switch.Provider";function l({ref:t,...e}){[e,t]=useContextProps(e,t??null,c);const{children:n,classNames:s,labelPosition:p="end",...m}=e;return jsx(Switch,{...m,ref:t,className:composeRenderProps(s?.switch,o=>d({className:o,labelPosition:p})),children:composeRenderProps(n,o=>jsxs(Fragment,{children:[jsx("span",{className:u({className:s?.control})}),o&&jsx("span",{className:N({className:s?.label}),children:o})]}))})}l.displayName="Switch",l.Provider=a;export{l as Switch,c as SwitchContext};//# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map