@nild/components 0.0.30 → 0.0.31
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/checkbox/Checkbox.js +1 -1
- package/dist/radio/Radio.js +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{useControllableState as E,useEffectCallback as g}from"@nild/hooks";import{isString as w,cnMerge as M}from"@nild/shared";import{forwardRef as S,Children as V,isValidElement as j,cloneElement as G}from"react";import{useGroupContext as P,CheckboxProvider as R}from"./contexts/index.js";import s from"./Indicator.js";import r from"./Label.js";import{checkboxClassNames as I}from"./style/index.js";const m=S((u,p)=>{const i=[],l=new Map,a=P(),{className:f,children:h,variant:v=a?.variant??"solid",size:d=a?.size??"medium",disabled:n=a?.disabled??!1,checked:C,defaultChecked:b,value:o,onChange:c,...k}=u,[y,x]=E(a?a.value.includes(o):C,b??!1),N=g(()=>{n||x(e=>(a?a.setValue(e?a.value.filter(z=>z!==o):a.value.concat(o)):c?.(!e),!e))});return V.forEach(h,e=>{j(e)?e.type===s?(l.delete(s),l.set(s,e)):e.type===r&&(l.delete(r),l.set(r,e)):w(e)&&(l.has(r)||l.set(r,t(r,{children:e})))}),i.push(...l.values()),l.has(s)||i.unshift(t(s,{})),t(R,{value:{variant:v,size:d,checked:y,setChecked:N},children:t("label",{...k,className:M(I({size:d,disabled:n}),f),ref:p,children:i.map(e=>G(e,{key:e.type.displayName,...e.props}))})})});m.displayName="Checkbox";export{m as default};
|
package/dist/radio/Radio.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{useControllableState as E,useEffectCallback as R}from"@nild/hooks";import{isString as g,cnMerge as w}from"@nild/shared";import{forwardRef as x,Children as M,isValidElement as S,cloneElement as V}from"react";import{useGroupContext as j,RadioProvider as G}from"./contexts/index.js";import i from"./Indicator.js";import l from"./Label.js";import{radioClassNames as P}from"./style/index.js";const c=x((p,u)=>{const t=[],s=new Map,a=j(),{className:f,children:h,variant:v=a?.variant??"solid",size:o=a?.size??"medium",disabled:d=a?.disabled??!1,checked:C,defaultChecked:b,value:m,onChange:n,...k}=p,[y,N]=E(a?a.value===m:C,b??!1),z=R(()=>{d||N(e=>e||(a?a.setValue(m):n?.(!e),!e))});return M.forEach(h,e=>{S(e)?e.type===i?(s.delete(i),s.set(i,e)):e.type===l&&(s.delete(l),s.set(l,e)):g(e)&&(s.has(l)||s.set(l,r(l,{children:e})))}),t.push(...s.values()),s.has(i)||t.unshift(r(i,{})),r(G,{value:{variant:v,size:o,checked:y,setChecked:z},children:r("label",{...k,className:w(P({size:o,disabled:d}),f),ref:u,children:t.map(e=>V(e,{key:e.type.displayName,...e.props}))})})});c.displayName="Radio";export{c as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nild/components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.31",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": "^18.2.0",
|
|
33
33
|
"react-dom": "^18.2.0",
|
|
34
|
-
"@nild/
|
|
35
|
-
"@nild/icons": "0.0.
|
|
36
|
-
"@nild/
|
|
34
|
+
"@nild/shared": "0.0.14",
|
|
35
|
+
"@nild/icons": "0.0.15",
|
|
36
|
+
"@nild/hooks": "0.0.16"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "vite build --mode PROD",
|