@jamsrui/switch 0.0.13 → 0.0.14
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/index.mjs +1 -1
- package/dist/styles.mjs +1 -1
- package/dist/switch-config.mjs +1 -1
- package/dist/switch-content.mjs +1 -1
- package/dist/switch-context.mjs +1 -1
- package/dist/switch-input.mjs +1 -1
- package/dist/switch-root.mjs +1 -1
- package/dist/switch-thumb.mjs +1 -1
- package/dist/switch-track.mjs +1 -1
- package/dist/switch.mjs +1 -1
- package/dist/use-switch.mjs +1 -1
- package/package.json +6 -6
- package/dist/chunk-2SD3LCHA.mjs +0 -1
- package/dist/chunk-3DYOKGGX.mjs +0 -1
- package/dist/chunk-3YY6BKHQ.mjs +0 -1
- package/dist/chunk-BSFNJ44W.mjs +0 -1
- package/dist/chunk-PH3TTZ56.mjs +0 -1
- package/dist/chunk-RBAAFDUL.mjs +0 -1
- package/dist/chunk-SO3SNGFL.mjs +0 -1
- package/dist/chunk-STY4A2DS.mjs +0 -1
- package/dist/chunk-TZ3CFLGK.mjs +0 -1
- package/dist/chunk-ZMFP3ZII.mjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{SwitchConfig as n,useSwitchConfig as f}from"./switch-config.mjs";import{Switch as t}from"./switch.mjs";import{SwitchContent as o}from"./switch-content.mjs";import{SwitchThumb as i}from"./switch-thumb.mjs";import{SwitchTrack as r}from"./switch-track.mjs";const w=Object.assign(t,{Root:t,Content:o,Track:r,Thumb:i});export{w as Switch,n as SwitchConfig,f as useSwitchConfig};
|
package/dist/styles.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{groupDataFocusVisibleClasses as e,tv as t}from"@jamsrui/utils";const s=t({slots:{root:"group flex gap-2",track:[...e,"flex relative cursor-default shrink-0 items-center rounded-full bg-surface-secondary p-1","uig-disabled:cursor-not-allowed uig-disabled:opacity-60","ui-interactive:hover:opacity-95","justify-start uig-checked:justify-end"],thumb:"size-8 rounded-full bg-white shadow-md flex justify-center items-center",content:"grid grow gap-1",input:"opacity-[0.0001] absolute inset-0 cursor-default 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-3.5"},sm:{track:"h-5 w-9",thumb:"size-3.5 uig-pressed:w-4"},md:{track:"h-6 w-10",thumb:"size-4 uig-pressed:w-5"},lg:{track:"h-7 w-12",thumb:"size-5 uig-pressed:w-6"}}},defaultVariants:{size:"md",color:"success"}});export{s as switchVariants};
|
package/dist/switch-config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{createConfigContext as o}from"@jamsrui/utils";const[t,e]=o({displayName:"SwitchConfig"});export{t as SwitchConfig,e as useSwitchConfig};
|
package/dist/switch-content.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{useRenderElement as r}from"@jamsrui/hooks";import{useSwitchContext as n}from"./switch-context.mjs";const i=e=>{const{getContentProps:t}=n();return r("div",{props:[t(e)]})};export{i as SwitchContent};
|
package/dist/switch-context.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{createContext as e,use as o}from"react";const n=e(null),c=()=>{const t=o(n);if(!t)throw new Error("useSwitchContext must be used within SwitchContext");return t};export{n as SwitchContext,c as useSwitchContext};
|
package/dist/switch-input.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{useFieldA11yContext as n}from"@jamsrui/context";import{useRenderElement as o}from"@jamsrui/hooks";import{useSwitchContext as p}from"./switch-context.mjs";const c=t=>{const{getInputProps:e}=p(),r=n();return o("input",{props:[e(t),r?.getInputProps()??{}]})};export{c as SwitchInput};
|
package/dist/switch-root.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{useRenderElement as t}from"@jamsrui/hooks";import{useSwitchContext as o}from"./switch-context.mjs";const i=r=>{const{getRootProps:e}=o();return t("div",{props:[e()]})};export{i as SwitchRoot};
|
package/dist/switch-thumb.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{jsx as p}from"react/jsx-runtime";import{motion as i}from"motion/react";import{useSwitchContext as n}from"./switch-context.mjs";const c=o=>{const{getThumbProps:t}=n(),{children:r,...e}=o;return p(i.div,{...t(e),children:r})};export{c as SwitchThumb};
|
package/dist/switch-track.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{Fragment as m,jsx as r,jsxs as h}from"react/jsx-runtime";import{useRenderElement as c}from"@jamsrui/hooks";import{useSwitchContext as i}from"./switch-context.mjs";import{SwitchInput as n}from"./switch-input.mjs";import{SwitchThumb as s}from"./switch-thumb.mjs";const w=e=>{const{children:t=r(s,{}),...o}=e,{getTrackProps:p}=i();return c("div",{props:[p(o),{children:h(m,{children:[t,r(n,{})]})}]})};export{w as SwitchTrack};
|
package/dist/switch.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import{FieldA11yContext as n,useFieldA11y as s}from"@jamsrui/context";import{mergeConfigProps as m}from"@jamsrui/utils";import{useSwitchConfig as p}from"./switch-config.mjs";import{SwitchContext as f}from"./switch-context.mjs";import{SwitchRoot as h}from"./switch-root.mjs";import{useSwitch as w}from"./use-switch.mjs";const g=o=>{const e=p(),i=m(e,e,o),r=w(i),c=s();return t(n,{value:c,children:t(f,{value:r,children:t(h,{children:o.children})})})};export{g as Switch};
|
package/dist/use-switch.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{useCallback as o,useId as G,useMemo as M}from"react";import{useControlledState as A,useFocusVisible as D,useMergeRefs as E,usePress as F}from"@jamsrui/hooks";import{cn as U,dataAttr as r,dataAttrDev as i,mapPropsVariants as j,mergeProps as H}from"@jamsrui/utils";import{switchVariants as k}from"./styles.mjs";const z=N=>{const[S,g]=j(N,k.variantKeys),e=k(g),{isChecked:y,defaultChecked:I,onCheckedChange:R,disabled:v=!1,inputProps:a,...n}=S,[c,p]=A({defaultProp:I,onChange:R,prop:y}),s=v,{isFocusVisible:l,ref:T}=D({isDisabled:s}),{isPressed:m,ref:V}=F({isDisabled:s}),x=a?.ref,h=E([x,T,V]),d=G(),u=o(t=>{s||p(t.target.checked)},[s,p]),P=o(()=>({...n,className:e.root({className:n.className}),"data-slot":i("root"),"data-component":i("switch"),"data-checked":r(c),"data-focus-visible":r(l),"data-pressed":r(m),"data-disabled":r(s)}),[n,c,s,l,m,e]),f=o(t=>({...H(t,a,{onChange:u}),ref:h,type:"checkbox","data-slot":i("input"),className:e.input({className:U(a?.className,t.className)}),disabled:s}),[u,a,h,s,e]),w=o(t=>({...t,"data-slot":"track",className:e.track({className:t.className})}),[e]),b=o(t=>({...t,layoutId:d,"data-slot":"thumb",className:e.thumb({className:t.className})}),[d,e]),C=o(t=>({...t,"data-slot":"content",className:e.content({className:t.className})}),[e]);return M(()=>({isChecked:c,getRootProps:P,getThumbProps:b,getContentProps:C,getTrackProps:w,getInputProps:f}),[c,P,b,C,w,f])};export{z as useSwitch};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jamsrui/switch",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"react": ">=19"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@jamsrui/context": "^0.0.
|
|
20
|
-
"@jamsrui/
|
|
21
|
-
"@jamsrui/
|
|
22
|
-
"@jamsrui/slot": "^0.0.
|
|
23
|
-
"@jamsrui/utils": "^0.0.
|
|
19
|
+
"@jamsrui/context": "^0.0.3",
|
|
20
|
+
"@jamsrui/core": "^0.0.12",
|
|
21
|
+
"@jamsrui/hooks": "^0.0.14",
|
|
22
|
+
"@jamsrui/slot": "^0.0.13",
|
|
23
|
+
"@jamsrui/utils": "^0.0.14"
|
|
24
24
|
},
|
|
25
25
|
"description": "A modern and beautiful Next.js UI components library.",
|
|
26
26
|
"keywords": [
|
package/dist/chunk-2SD3LCHA.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as t}from"./chunk-3DYOKGGX.mjs";import{a as e}from"./chunk-TZ3CFLGK.mjs";import{b as r}from"./chunk-ZMFP3ZII.mjs";import{useRenderElement as s}from"@jamsrui/hooks";import{Fragment as m,jsx as o,jsxs as h}from"react/jsx-runtime";var w=p=>{let{children:c=o(e,{}),...i}=p,{getTrackProps:n}=r();return s("div",{props:[n(i),{children:h(m,{children:[c,o(t,{})]})}]})};export{w as a};
|
package/dist/chunk-3DYOKGGX.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as t}from"./chunk-ZMFP3ZII.mjs";import{useFieldA11yContext as o}from"@jamsrui/context";import{useRenderElement as p}from"@jamsrui/hooks";var c=e=>{let{getInputProps:r}=t(),n=o();return p("input",{props:[r(e),n?.getInputProps()??{}]})};export{c as a};
|
package/dist/chunk-3YY6BKHQ.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createConfigContext as o}from"@jamsrui/utils";var[t,e]=o({displayName:"SwitchConfig"});export{t as a,e as b};
|
package/dist/chunk-BSFNJ44W.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as n}from"./chunk-PH3TTZ56.mjs";import{b as i}from"./chunk-3YY6BKHQ.mjs";import{a as c}from"./chunk-SO3SNGFL.mjs";import{a as r}from"./chunk-ZMFP3ZII.mjs";import{FieldA11yContext as f,useFieldA11y as h}from"@jamsrui/context";import{mergeConfigProps as w}from"@jamsrui/utils";import{jsx as t}from"react/jsx-runtime";var g=o=>{let e=i(),s=w(e,e,o),m=n(s),p=h();return t(f,{value:p,children:t(r,{value:m,children:t(c,{children:o.children})})})};export{g as a};
|
package/dist/chunk-PH3TTZ56.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as i}from"./chunk-RBAAFDUL.mjs";import{useCallback as o,useId as G,useMemo as M}from"react";import{useControlledState as A,useFocusVisible as D,useMergeRefs as E,usePress as F}from"@jamsrui/hooks";import{cn as U,dataAttr as r,dataAttrDev as p,mapPropsVariants as j,mergeProps as H}from"@jamsrui/utils";var z=N=>{let[S,g]=j(N,i.variantKeys),e=i(g),{isChecked:y,defaultChecked:I,onCheckedChange:R,disabled:v=!1,inputProps:a,...n}=S,[c,l]=A({defaultProp:I,onChange:R,prop:y}),s=v,{isFocusVisible:m,ref:T}=D({isDisabled:s}),{isPressed:h,ref:V}=F({isDisabled:s}),x=a?.ref,d=E([x,T,V]),u=G(),P=o(t=>{s||l(t.target.checked)},[s,l]),f=o(()=>({...n,className:e.root({className:n.className}),"data-slot":p("root"),"data-component":p("switch"),"data-checked":r(c),"data-focus-visible":r(m),"data-pressed":r(h),"data-disabled":r(s)}),[n,c,s,m,h,e]),w=o(t=>({...H(t,a,{onChange:P}),ref:d,type:"checkbox","data-slot":p("input"),className:e.input({className:U(a?.className,t.className)}),disabled:s}),[P,a,d,s,e]),b=o(t=>({...t,"data-slot":"track",className:e.track({className:t.className})}),[e]),C=o(t=>({...t,layoutId:u,"data-slot":"thumb",className:e.thumb({className:t.className})}),[u,e]),k=o(t=>({...t,"data-slot":"content",className:e.content({className:t.className})}),[e]);return M(()=>({isChecked:c,getRootProps:f,getThumbProps:C,getContentProps:k,getTrackProps:b,getInputProps:w}),[c,f,C,k,b,w])};export{z as a};
|
package/dist/chunk-RBAAFDUL.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{groupDataFocusVisibleClasses as e,tv as t}from"@jamsrui/utils";var s=t({slots:{root:"group flex gap-2",track:[...e,"flex relative cursor-default shrink-0 items-center rounded-full bg-surface-secondary p-1","uig-disabled:cursor-not-allowed uig-disabled:opacity-60","ui-interactive:hover:opacity-95","justify-start uig-checked:justify-end"],thumb:"size-8 rounded-full bg-white shadow-md flex justify-center items-center",content:"grid grow gap-1",input:"opacity-[0.0001] absolute inset-0 cursor-default 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-3.5"},sm:{track:"h-5 w-9",thumb:"size-3.5 uig-pressed:w-4"},md:{track:"h-6 w-10",thumb:"size-4 uig-pressed:w-5"},lg:{track:"h-7 w-12",thumb:"size-5 uig-pressed:w-6"}}},defaultVariants:{size:"md",color:"success"}});export{s as a};
|
package/dist/chunk-SO3SNGFL.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e}from"./chunk-ZMFP3ZII.mjs";import{useRenderElement as o}from"@jamsrui/hooks";var i=r=>{let{getRootProps:t}=e();return o("div",{props:[t()]})};export{i as a};
|
package/dist/chunk-STY4A2DS.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e}from"./chunk-ZMFP3ZII.mjs";import{useRenderElement as n}from"@jamsrui/hooks";var i=t=>{let{getContentProps:r}=e();return n("div",{props:[r(t)]})};export{i as a};
|
package/dist/chunk-TZ3CFLGK.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as o}from"./chunk-ZMFP3ZII.mjs";import{motion as n}from"motion/react";import{jsx as p}from"react/jsx-runtime";var c=t=>{let{getThumbProps:r}=o(),{children:e,...i}=t;return p(n.div,{...r(i),children:e})};export{c as a};
|
package/dist/chunk-ZMFP3ZII.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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};
|