@jamsrui/switch 0.0.9 → 0.0.10
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/chunk-4HIF66TZ.mjs +1 -0
- package/dist/chunk-CV6X5VZS.mjs +1 -0
- package/dist/chunk-IBRNHXAJ.mjs +1 -0
- package/dist/chunk-IGNAWQUV.mjs +1 -0
- package/dist/chunk-IIZ5FKIW.mjs +1 -0
- package/dist/chunk-NR7TBHSW.mjs +1 -0
- package/dist/chunk-PXWG26DS.mjs +0 -0
- package/dist/chunk-UV6DZE4H.mjs +1 -0
- package/dist/chunk-VP7BK66R.mjs +1 -0
- package/dist/chunk-VSR2PVUI.mjs +1 -0
- package/dist/chunk-X76H4PSZ.mjs +1 -0
- package/dist/chunk-YFRKKQNC.mjs +1 -0
- package/dist/chunk-YQAB3LUG.mjs +1 -0
- package/dist/chunk-YYWXM3MT.mjs +1 -0
- package/dist/chunk-YZHN6POK.mjs +1 -0
- package/dist/chunk-ZID55QUD.mjs +1 -0
- package/dist/index.mjs +1 -1
- package/dist/primitive/index.mjs +1 -1
- package/dist/primitive/styles.mjs +1 -1
- package/dist/primitive/switch-config.mjs +1 -1
- package/dist/primitive/switch-content.mjs +1 -1
- package/dist/primitive/switch-context.mjs +1 -1
- package/dist/primitive/switch-description.mjs +1 -1
- package/dist/primitive/switch-input.mjs +1 -1
- package/dist/primitive/switch-label.mjs +1 -1
- package/dist/primitive/switch-root.mjs +1 -1
- package/dist/primitive/switch-thumb.mjs +1 -1
- package/dist/primitive/switch-track.mjs +1 -1
- package/dist/primitive/switch-wrapper.mjs +1 -1
- package/dist/primitive/switch.mjs +1 -1
- package/dist/primitive/use-switch.mjs +1 -1
- package/dist/switch-config.mjs +1 -1
- package/dist/switch.mjs +1 -1
- package/package.json +10 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as n}from"./chunk-YYWXM3MT.mjs";import{useCallback as a,useId as L,useMemo as M}from"react";import{useControlledState as W,useFocusVisible as A,useMergeRefs as E,usePress as F}from"@jamsrui/hooks";import{cn as r,dataAttr as p,dataAttrDev as l,mapPropsVariants as j,mergeProps as H}from"@jamsrui/utils";var z=R=>{let[I,G]=j(R,n.variantKeys),e=n(G),{isChecked:T,defaultChecked:v,onCheckedChange:V,isDisabled:o,isReadonly:c,classNames:s}=I,[i,m]=W({defaultProp:v,onChange:V,prop:T}),{isFocusVisible:h,ref:D}=A({isDisabled:o}),{isPressed:d,ref:x}=F({isDisabled:o}),u=E([D,x]),w=L(),P=a(t=>{!o&&!c&&m(t.target.checked)},[o,c,m]),b=a(t=>({...t,className:e.root({className:r(s?.root,t.className)}),"data-slot":l("root"),"data-component":l("switch"),"data-checked":p(i),"data-focus-visible":p(h),"data-pressed":p(d),"data-disabled":p(o)}),[s?.root,i,o,h,d,e]),N=a(t=>({...H(t,{onChange:P}),ref:u,type:"checkbox","data-slot":l("input"),className:e.input({className:r(s?.input,t.className)}),disabled:o,readOnly:c}),[s?.input,P,u,o,c,e]),S=a(t=>({...t,"data-slot":"track",className:e.track({className:r(s?.track,t.className)})}),[s?.track,e]),f=a(t=>({...t,layoutId:w,"data-slot":"thumb",className:e.thumb({className:r(s?.thumb,t.className)})}),[s?.thumb,w,e]),C=a(t=>({...t,"data-slot":"label",className:e.label({className:r(s?.label,t.className)})}),[s?.label,e]),k=a(t=>({...t,"data-slot":"description",className:e.description({className:r(s?.description,t.className)})}),[s?.description,e]),y=a(t=>({...t,"data-slot":"content",className:e.content({className:r(s?.content,t.className)})}),[s?.content,e]),g=a(t=>({...t,"data-slot":"wrapper",className:e.wrapper({className:r(s?.wrapper,t.className)})}),[s?.wrapper,e]);return M(()=>({isChecked:i,getRootProps:b,getThumbProps:f,getLabelProps:C,getDescriptionProps:k,getContentProps:y,getWrapperProps:g,getTrackProps:S,getInputProps:N}),[i,b,f,C,k,y,g,S,N])};export{z as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as t}from"./chunk-NR7TBHSW.mjs";import{useRenderElement as o}from"@jamsrui/hooks";var i=e=>{let{getContentProps:r}=t();return o("div",{props:[r(e)]})};export{i as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as c}from"./chunk-4HIF66TZ.mjs";import{b as e}from"./chunk-IIZ5FKIW.mjs";import{a as r}from"./chunk-NR7TBHSW.mjs";import{mergeConfigProps as s}from"@jamsrui/utils";import{jsx as p}from"react/jsx-runtime";var S=t=>{let o=e(),i=s(o,o,t),n=c(i);return p(r,{value:n,children:t.children})};export{S as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createConfigContext as o}from"@jamsrui/utils";var[t,r]=o({displayName:"SwitchConfig"});export{t as a,r as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createConfigContext as o}from"@jamsrui/utils";var[t,r]=o({displayName:"SwitchConfig"});export{t as a,r as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as e,use as o}from"react";var n=e(null),c=()=>{let t=o(n);if(!t)throw new Error("useSwitchContext must be used within SwitchContext");return t};export{n as a,c as b};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as t}from"./chunk-NR7TBHSW.mjs";import{useRenderElement as r}from"@jamsrui/hooks";var i=e=>{let{getRootProps:o}=t();return r("div",{props:[o(e)]})};export{i as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as t}from"./chunk-NR7TBHSW.mjs";import{motion as r}from"motion/react";import{jsx as e}from"react/jsx-runtime";var p=o=>{let{getThumbProps:i}=t();return e(r.div,{...i(o),children:o.children})};export{p as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as e}from"./chunk-NR7TBHSW.mjs";import{useRenderElement as p}from"@jamsrui/hooks";var m=r=>{let{getWrapperProps:t}=e();return p("label",{props:[t(r)]})};export{m as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as e}from"./chunk-NR7TBHSW.mjs";import{useRenderElement as o}from"@jamsrui/hooks";var m=r=>{let{getLabelProps:t}=e();return o("span",{props:[t(r)]})};export{m as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as r}from"./chunk-NR7TBHSW.mjs";import{useRenderElement as o}from"@jamsrui/hooks";var c=e=>{let{getTrackProps:t}=r();return o("div",{props:[t(e)]})};export{c as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as r}from"./chunk-IGNAWQUV.mjs";import{a as S}from"./chunk-YZHN6POK.mjs";import{a as n}from"./chunk-ZID55QUD.mjs";import{a as p}from"./chunk-X76H4PSZ.mjs";import{a as h}from"./chunk-UV6DZE4H.mjs";import{a as w}from"./chunk-VP7BK66R.mjs";import{a as m}from"./chunk-YFRKKQNC.mjs";import{a}from"./chunk-VSR2PVUI.mjs";import{a as s}from"./chunk-4HIF66TZ.mjs";import{a as l}from"./chunk-CV6X5VZS.mjs";import{a as c}from"./chunk-NR7TBHSW.mjs";import{Slot as i}from"@jamsrui/slot";import{mergeConfigProps as C}from"@jamsrui/utils";import{AnimatePresence as T}from"motion/react";import{jsx as t,jsxs as f}from"react/jsx-runtime";var D=u=>{let e=r(),P=C(e,e,u),{label:b,children:d,slots:o,...g}=P,x=s(g);return t(c,{value:x,children:t(i,{slot:o?.root,children:t(h,{children:t(i,{slot:o?.wrapper,children:f(a,{children:[t(i,{slot:o?.input,children:t(n,{})}),t(i,{slot:o?.content,children:f(l,{children:[t(i,{slot:o?.label,children:t(p,{children:b})}),t(i,{slot:o?.description,children:t(S,{children:d})})]})}),t(T,{initial:!1,children:t(i,{slot:o?.track,children:t(m,{children:t(i,{slot:o?.thumb,children:t(w,{})})})})})]})})})})})};export{D as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{groupDataFocusVisibleClasses as e,tv as r}from"@jamsrui/utils";var s=r({slots:{root:"group flex flex-col gap-2",track:[...e,"flex cursor-pointer shrink-0 items-center rounded-full bg-surface-secondary p-1","uig-disabled:cursor-not-allowed uig-disabled:opacity-60","cursor-default ui-interactive:cursor-pointer ui-interactive:hover:opacity-95","justify-start uig-checked:justify-end"],thumb:"size-8 rounded-full bg-white shadow-md",label:"text-sm uig-interactive:cursor-pointer",description:"text-xs text-foreground-secondary",content:"grid grow gap-1",wrapper:"flex items-center justify-between gap-2 relative",input:"opacity-[0.0001] absolute inset-0 cursor-pointer disabled:cursor-not-allowed z-1"},variants:{color:{default:{track:"uig-checked:bg-default"},primary:{track:"uig-checked:bg-primary"},secondary:{track:"uig-checked:bg-secondary"},success:{track:"uig-checked:bg-success"},warning:{track:"uig-checked:bg-warning"},danger:{track:"uig-checked:bg-danger"}},size:{xs:{track:"h-4 w-7 px-0.5",thumb:"size-3 uig-pressed:w-4"},sm:{track:"h-6 w-10",thumb:"size-4 uig-pressed:w-5"},md:{track:"h-7 w-12",thumb:"size-5 uig-pressed:w-6"},lg:{track:"h-8 w-14",thumb:"size-6 uig-pressed:w-7"}},labelPlacement:{start:{wrapper:"flex-row"},end:{wrapper:"flex-row-reverse"},top:{wrapper:"flex-col"},bottom:{wrapper:"flex-col-reverse"}}},defaultVariants:{size:"md",color:"success",labelPlacement:"start"}});export{s as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as e}from"./chunk-NR7TBHSW.mjs";import{useRenderElement as o}from"@jamsrui/hooks";var n=r=>{let{getDescriptionProps:t}=e();return o("div",{props:[t(r)]})};export{n as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as t}from"./chunk-NR7TBHSW.mjs";import{useRenderElement as p}from"@jamsrui/hooks";var i=e=>{let{getInputProps:r}=t();return p("input",{props:[r(e)]})};export{i as a};
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{a as t}from"./chunk-YQAB3LUG.mjs";import{a as i,b as o}from"./chunk-IGNAWQUV.mjs";import"./chunk-PXWG26DS.mjs";import"./chunk-YZHN6POK.mjs";import"./chunk-ZID55QUD.mjs";import"./chunk-X76H4PSZ.mjs";import"./chunk-UV6DZE4H.mjs";import"./chunk-VP7BK66R.mjs";import"./chunk-YFRKKQNC.mjs";import"./chunk-VSR2PVUI.mjs";import"./chunk-IBRNHXAJ.mjs";import"./chunk-4HIF66TZ.mjs";import"./chunk-YYWXM3MT.mjs";import"./chunk-IIZ5FKIW.mjs";import"./chunk-CV6X5VZS.mjs";import"./chunk-NR7TBHSW.mjs";export{t as Switch,i as SwitchConfig,o as useSwitchConfig};
|
package/dist/primitive/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import"../chunk-PXWG26DS.mjs";import{a as h}from"../chunk-YZHN6POK.mjs";import{a as i}from"../chunk-ZID55QUD.mjs";import{a as j}from"../chunk-X76H4PSZ.mjs";import{a as k}from"../chunk-UV6DZE4H.mjs";import{a as l}from"../chunk-VP7BK66R.mjs";import{a as m}from"../chunk-YFRKKQNC.mjs";import{a as n}from"../chunk-VSR2PVUI.mjs";import{a as f}from"../chunk-IBRNHXAJ.mjs";import{a as e}from"../chunk-4HIF66TZ.mjs";import"../chunk-YYWXM3MT.mjs";import{a,b}from"../chunk-IIZ5FKIW.mjs";import{a as g}from"../chunk-CV6X5VZS.mjs";import{a as c,b as d}from"../chunk-NR7TBHSW.mjs";export{f as Switch,a as SwitchConfig,g as SwitchContent,c as SwitchContext,h as SwitchDescription,i as SwitchInput,j as SwitchLabel,k as SwitchRoot,l as SwitchThumb,m as SwitchTrack,n as SwitchWrapper,e as useSwitch,b as useSwitchConfig,d as useSwitchContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"../chunk-YYWXM3MT.mjs";export{a as switchVariants};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a,b}from"../chunk-IIZ5FKIW.mjs";export{a as SwitchConfig,b as useSwitchConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"../chunk-CV6X5VZS.mjs";import"../chunk-NR7TBHSW.mjs";export{a as SwitchContent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a,b}from"../chunk-NR7TBHSW.mjs";export{a as SwitchContext,b as useSwitchContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"../chunk-YZHN6POK.mjs";import"../chunk-NR7TBHSW.mjs";export{a as SwitchDescription};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"../chunk-ZID55QUD.mjs";import"../chunk-NR7TBHSW.mjs";export{a as SwitchInput};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"../chunk-X76H4PSZ.mjs";import"../chunk-NR7TBHSW.mjs";export{a as SwitchLabel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"../chunk-UV6DZE4H.mjs";import"../chunk-NR7TBHSW.mjs";export{a as SwitchRoot};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"../chunk-VP7BK66R.mjs";import"../chunk-NR7TBHSW.mjs";export{a as SwitchThumb};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"../chunk-YFRKKQNC.mjs";import"../chunk-NR7TBHSW.mjs";export{a as SwitchTrack};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"../chunk-VSR2PVUI.mjs";import"../chunk-NR7TBHSW.mjs";export{a as SwitchWrapper};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"../chunk-IBRNHXAJ.mjs";import"../chunk-4HIF66TZ.mjs";import"../chunk-YYWXM3MT.mjs";import"../chunk-IIZ5FKIW.mjs";import"../chunk-NR7TBHSW.mjs";export{a as Switch};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"../chunk-4HIF66TZ.mjs";import"../chunk-YYWXM3MT.mjs";export{a as useSwitch};
|
package/dist/switch-config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a,b}from"./chunk-IGNAWQUV.mjs";export{a as SwitchConfig,b as useSwitchConfig};
|
package/dist/switch.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"./chunk-YQAB3LUG.mjs";import"./chunk-IGNAWQUV.mjs";import"./chunk-PXWG26DS.mjs";import"./chunk-YZHN6POK.mjs";import"./chunk-ZID55QUD.mjs";import"./chunk-X76H4PSZ.mjs";import"./chunk-UV6DZE4H.mjs";import"./chunk-VP7BK66R.mjs";import"./chunk-YFRKKQNC.mjs";import"./chunk-VSR2PVUI.mjs";import"./chunk-IBRNHXAJ.mjs";import"./chunk-4HIF66TZ.mjs";import"./chunk-YYWXM3MT.mjs";import"./chunk-IIZ5FKIW.mjs";import"./chunk-CV6X5VZS.mjs";import"./chunk-NR7TBHSW.mjs";export{a as Switch};
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jamsrui/switch",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
|
-
"import": "./dist/index.mjs"
|
|
8
|
-
|
|
7
|
+
"import": "./dist/index.mjs"
|
|
8
|
+
},
|
|
9
|
+
"./primitive": {
|
|
10
|
+
"types": "./dist/primitive/index.d.ts",
|
|
11
|
+
"import": "./dist/primitive/index.mjs"
|
|
9
12
|
}
|
|
10
13
|
},
|
|
11
14
|
"peerDependencies": {
|
|
@@ -13,10 +16,10 @@
|
|
|
13
16
|
"react": ">=19"
|
|
14
17
|
},
|
|
15
18
|
"dependencies": {
|
|
16
|
-
"@jamsrui/
|
|
17
|
-
"@jamsrui/
|
|
18
|
-
"@jamsrui/
|
|
19
|
-
"@jamsrui/slot": "^0.0.
|
|
19
|
+
"@jamsrui/core": "^0.0.9",
|
|
20
|
+
"@jamsrui/utils": "^0.0.10",
|
|
21
|
+
"@jamsrui/hooks": "^0.0.10",
|
|
22
|
+
"@jamsrui/slot": "^0.0.10"
|
|
20
23
|
},
|
|
21
24
|
"description": "A modern and beautiful Next.js UI components library.",
|
|
22
25
|
"keywords": [
|