@jamsrui/switch 0.0.17 → 0.0.19
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.d.mts +9 -6
- package/dist/index.mjs +1 -1
- package/dist/switch-config.d.mts +2 -1
- package/dist/switch-config.mjs +1 -1
- package/dist/switch.mjs +1 -1
- package/dist/use-switch.mjs +1 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
export { SwitchConfig, useSwitchConfig } from './switch-config.mjs';
|
|
4
3
|
import { Switch as Switch$1 } from './switch.mjs';
|
|
4
|
+
import { SwitchConfig } from './switch-config.mjs';
|
|
5
|
+
export { useSwitchConfig } from './switch-config.mjs';
|
|
5
6
|
import { SwitchContent } from './switch-content.mjs';
|
|
7
|
+
export { SwitchContext, useSwitchContext } from './switch-context.mjs';
|
|
6
8
|
import { SwitchThumb } from './switch-thumb.mjs';
|
|
7
9
|
import { SwitchTrack } from './switch-track.mjs';
|
|
10
|
+
export { SwitchSlots, SwitchVariants, switchVariants } from './styles.mjs';
|
|
11
|
+
export { useSwitch } from './use-switch.mjs';
|
|
8
12
|
import '@jamsrui/core';
|
|
9
|
-
import './use-switch.mjs';
|
|
10
13
|
import '@jamsrui/utils';
|
|
11
|
-
import '
|
|
14
|
+
import 'motion/react';
|
|
12
15
|
import './switch-input.mjs';
|
|
13
16
|
import './switch-root.mjs';
|
|
14
|
-
import 'motion/react';
|
|
15
17
|
|
|
16
18
|
declare const Switch: ((props: Switch$1.Props) => react_jsx_runtime.JSX.Element) & {
|
|
17
|
-
Root: (props: Switch$1.Props) => react_jsx_runtime.JSX.Element;
|
|
18
19
|
Content: (props: SwitchContent.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
19
20
|
Track: (props: SwitchTrack.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
20
21
|
Thumb: (props: SwitchThumb.Props) => react_jsx_runtime.JSX.Element;
|
|
@@ -22,6 +23,8 @@ declare const Switch: ((props: Switch$1.Props) => react_jsx_runtime.JSX.Element)
|
|
|
22
23
|
declare namespace Switch {
|
|
23
24
|
interface Props extends Switch$1.Props {
|
|
24
25
|
}
|
|
26
|
+
interface Config extends SwitchConfig.Props {
|
|
27
|
+
}
|
|
25
28
|
interface Content extends SwitchContent.Props {
|
|
26
29
|
}
|
|
27
30
|
interface Track extends SwitchTrack.Props {
|
|
@@ -30,4 +33,4 @@ declare namespace Switch {
|
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
export { Switch };
|
|
36
|
+
export { Switch, SwitchConfig, SwitchContent, SwitchThumb, SwitchTrack };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SwitchConfig as
|
|
1
|
+
import{Switch as e}from"./switch.mjs";import{SwitchConfig as r,useSwitchConfig as c}from"./switch-config.mjs";import{SwitchContent as t}from"./switch-content.mjs";import{SwitchContext as n,useSwitchContext as h}from"./switch-context.mjs";import{SwitchThumb as o}from"./switch-thumb.mjs";import{SwitchTrack as i}from"./switch-track.mjs";import{switchVariants as p}from"./styles.mjs";import{useSwitch as s}from"./use-switch.mjs";const b=Object.assign(e,{Content:t,Track:i,Thumb:o});export{b as Switch,r as SwitchConfig,t as SwitchContent,n as SwitchContext,o as SwitchThumb,i as SwitchTrack,p as switchVariants,s as useSwitch,c as useSwitchConfig,h as useSwitchContext};
|
package/dist/switch-config.d.mts
CHANGED
|
@@ -18,7 +18,8 @@ declare const SwitchConfig: (props: Omit<Partial<SwitchConfig.Props>, "children"
|
|
|
18
18
|
children: React.ReactNode;
|
|
19
19
|
}) => react_jsx_runtime.JSX.Element;
|
|
20
20
|
declare namespace SwitchConfig {
|
|
21
|
-
|
|
21
|
+
interface Props extends WithGlobalConfig<Switch.Props> {
|
|
22
|
+
}
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export { SwitchConfig, useSwitchConfig };
|
package/dist/switch-config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{createConfigContext as
|
|
1
|
+
"use client";import{createConfigContext as i}from"@jamsrui/utils";const[t,e]=i({displayName:"SwitchConfig"});export{t as SwitchConfig,e as useSwitchConfig};
|
package/dist/switch.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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{
|
|
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{switchVariants as p}from"./styles.mjs";import{useSwitchConfig as f}from"./switch-config.mjs";import{SwitchContext as h}from"./switch-context.mjs";import{SwitchRoot as w}from"./switch-root.mjs";import{useSwitch as S}from"./use-switch.mjs";const P=o=>{const e=f(),i=m(p.defaultVariants,e,o),r=S(i),c=s();return t(n,{value:c,children:t(h,{value:r,children:t(w,{children:o.children})})})};export{P as Switch};
|
package/dist/use-switch.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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 C}from"./styles.mjs";const z=N=>{const[S,g]=j(N,C.variantKeys),e=C(g),{checked:y,defaultChecked:I,onCheckedChange:R,disabled:v=!1,inputProps:a,...n}=S,[c,p]=A({defaultProp:I,onChange:R,prop:y}),s=v,{isFocusVisible:m,ref:T}=D({isDisabled:s}),{isPressed:l,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]),f=o(()=>({...n,className:e.root({className:n.className}),"data-slot":i("root"),"data-component":i("switch"),"data-checked":r(c),"data-focus-visible":r(m),"data-pressed":r(l),"data-disabled":r(s)}),[n,c,s,m,l,e]),P=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]),k=o(t=>({...t,"data-slot":"content",className:e.content({className:t.className})}),[e]);return M(()=>({isChecked:c,getRootProps:f,getThumbProps:b,getContentProps:k,getTrackProps:w,getInputProps:P}),[c,f,b,k,w,P])};export{z as useSwitch};
|
|
1
|
+
"use client";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 C}from"./styles.mjs";const z=N=>{const[S,g]=j(N,C.variantKeys),e=C(g),{checked:y,defaultChecked:I,onCheckedChange:R,disabled:v=!1,inputProps:a,...n}=S,[c,p]=A({defaultProp:I,onChange:R,prop:y}),s=v,{isFocusVisible:m,ref:T}=D({isDisabled:s}),{isPressed:l,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]),f=o(()=>({...n,className:e.root({className:n.className}),"data-slot":i("root"),"data-component":i("switch"),"data-checked":r(c),"data-focus-visible":r(m),"data-pressed":r(l),"data-disabled":r(s)}),[n,c,s,m,l,e]),P=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]),k=o(t=>({...t,"data-slot":"content",className:e.content({className:t.className})}),[e]);return M(()=>({isChecked:c,getRootProps:f,getThumbProps:b,getContentProps:k,getTrackProps:w,getInputProps:P}),[c,f,b,k,w,P])};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.19",
|
|
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/
|
|
20
|
-
"@jamsrui/hooks": "^0.0.
|
|
21
|
-
"@jamsrui/
|
|
22
|
-
"@jamsrui/
|
|
23
|
-
"@jamsrui/
|
|
19
|
+
"@jamsrui/context": "^0.0.7",
|
|
20
|
+
"@jamsrui/hooks": "^0.0.18",
|
|
21
|
+
"@jamsrui/core": "^0.0.14",
|
|
22
|
+
"@jamsrui/slot": "^0.0.15",
|
|
23
|
+
"@jamsrui/utils": "^0.0.18"
|
|
24
24
|
},
|
|
25
25
|
"description": "A modern and beautiful Next.js UI components library.",
|
|
26
26
|
"keywords": [
|