@1d1s/design-system 2.4.0 → 2.4.1
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.es.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -111,7 +111,7 @@ return e(ss,{__scopeCheckbox:a,checked:l,defaultChecked:s,disabled:d,required:c,
|
|
|
111
111
|
return e(K,{present:o||bs(i.checked)||!0===i.checked,children:/* @__PURE__ */e(U.span,{"data-state":vs(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:n,style:{pointerEvents:"none",...t.style}})})});ps.displayName=fs;var ms="CheckboxBubbleInput",hs=x.forwardRef(({__scopeCheckbox:t,...n},r)=>{const{control:o,hasConsumerStoppedPropagationRef:a,checked:i,defaultChecked:l,required:s,disabled:c,name:d,value:u,form:f,bubbleInput:p,setBubbleInput:m}=ls(ms,t),h=W(r,m),g=ns(i),b=rs(o);x.useEffect(()=>{const e=p;if(!e)return;const t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(g!==i&&n){const t=new Event("click",{bubbles:!a.current});e.indeterminate=bs(i),n.call(e,!bs(i)&&i),e.dispatchEvent(t)}},[p,g,i,a]);const v=x.useRef(!bs(i)&&i);/* @__PURE__ */
|
|
112
112
|
return e(U.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??v.current,required:s,disabled:c,name:d,value:u,form:f,...n,tabIndex:-1,ref:h,style:{...n.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function gs(e){return"function"==typeof e}function bs(e){return"indeterminate"===e}function vs(e){return bs(e)?"indeterminate":e?"checked":"unchecked"}hs.displayName=ms;const ys=x.forwardRef(({className:t,label:r,id:o,readOnly:a,...i},l)=>{const s=x.useId(),c=o||s;/* @__PURE__ */
|
|
113
113
|
return n("div",{className:pn("flex items-center gap-2",a&&"pointer-events-none"),children:[
|
|
114
|
-
/* @__PURE__ */e(us,{ref:l,id:c,className:pn("peer h-[18px] w-[18px] shrink-0 cursor-pointer rounded-1.5 border-[1.5px] border-gray-300 bg-white text-white","transition-[background-color,border-color] duration-150 ease-out","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/30 focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-[0.45]","data-[state=checked]:border-brand data-[state=checked]:bg-brand data-[state=checked]:text-white",t),...i,children:/* @__PURE__ */e(ps,{className:"flex items-center justify-center text-current animate-pop",children:/* @__PURE__ */e(jn,{className:"h-2.5 w-2.5",strokeWidth:8})})}),r?/* @__PURE__ */e("label",{htmlFor:c,className:pn("cursor-pointer select-none text-gray-800 transition-colors","peer-disabled:cursor-not-allowed peer-disabled:opacity-[0.45]","peer-data-[state=checked]:text-gray-500 peer-data-[state=checked]:line-through"),children:/* @__PURE__ */e(On,{size:"caption2",weight:"medium",children:r})}):null]})});ys.displayName=us.displayName;const ws={sm:{list:"gap-0",row:"gap-2.5",checkbox:"h-[18px] w-[18px]",label:"body2"},md:{list:"gap-0.5",row:"gap-3",checkbox:"h-5 w-5",label:"body1"},lg:{list:"gap-1",row:"gap-3",checkbox:"h-6 w-6",label:"body1"}},xs={sm:{list:"gap-
|
|
114
|
+
/* @__PURE__ */e(us,{ref:l,id:c,className:pn("peer h-[18px] w-[18px] shrink-0 cursor-pointer rounded-1.5 border-[1.5px] border-gray-300 bg-white text-white","transition-[background-color,border-color] duration-150 ease-out","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/30 focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-[0.45]","data-[state=checked]:border-brand data-[state=checked]:bg-brand data-[state=checked]:text-white",t),...i,children:/* @__PURE__ */e(ps,{className:"flex items-center justify-center text-current animate-pop",children:/* @__PURE__ */e(jn,{className:"h-2.5 w-2.5",strokeWidth:8})})}),r?/* @__PURE__ */e("label",{htmlFor:c,className:pn("cursor-pointer select-none text-gray-800 transition-colors","peer-disabled:cursor-not-allowed peer-disabled:opacity-[0.45]","peer-data-[state=checked]:text-gray-500 peer-data-[state=checked]:line-through"),children:/* @__PURE__ */e(On,{size:"caption2",weight:"medium",children:r})}):null]})});ys.displayName=us.displayName;const ws={sm:{list:"gap-0",row:"gap-2.5",checkbox:"h-[18px] w-[18px]",label:"body2"},md:{list:"gap-0.5",row:"gap-3",checkbox:"h-5 w-5",label:"body1"},lg:{list:"gap-1",row:"gap-3",checkbox:"h-6 w-6",label:"body1"}},xs={sm:{list:"gap-1.5",row:"px-3.5 py-3"},md:{list:"gap-2",row:"px-4 py-3.5"},lg:{list:"gap-2",row:"px-4 py-4"}};function Cs({options:t,value:r,onValueChange:o,size:a="md",variant:i="flat",className:l,readOnly:s=!1,disabled:c=!1,checkColor:d}){const u=C.useId(),f=ws[a],p=xs[a],m="card"===i;/* @__PURE__ */
|
|
115
115
|
return e("div",{className:pn("stagger-in flex flex-col",m?p.list:f.list,l),children:t.map(t=>{const a=r.includes(t.id),i=c||t.disabled,l=!i&&s,h=i||l,g=`${u}-${t.id}`;/* @__PURE__ */
|
|
116
116
|
return n("label",{htmlFor:g,"aria-disabled":h,onClick(e){h&&e.preventDefault()},className:pn("flex w-full items-center text-left","transition duration-200 ease-out",m?pn("rounded-3 border border-gray-200 bg-white",p.row):"-mx-2.5 rounded-2 px-2.5 py-1.5",f.row,!h&&"cursor-pointer active:scale-[0.97]",!h&&(m?"hover:bg-gray-50":"hover:bg-gray-100"),i&&"cursor-not-allowed",l&&"cursor-default hover:cursor-not-allowed"),children:[
|
|
117
117
|
/* @__PURE__ */e(ys,{id:g,checked:a,disabled:i,onCheckedChange(e){var n;h||"indeterminate"===e||(n=t.id,o(!0===e?r.includes(n)?r:[...r,n]:r.filter(e=>e!==n)))},style:d&&a?{backgroundColor:d,borderColor:d}:void 0,className:pn(f.checkbox,"rounded-full",!d&&"data-[state=checked]:border-green-600 data-[state=checked]:bg-green-600",l&&"cursor-default hover:cursor-not-allowed")}),"string"==typeof t.label||"number"==typeof t.label?/* @__PURE__ */e(On,{size:f.label,weight:a?"bold":"medium",className:pn("flex-1 transition-colors",a?"text-gray-900":"text-gray-500",i&&"text-gray-400"),children:t.label}):/* @__PURE__ */e("span",{className:pn("flex-1",!a&&"text-gray-600",i&&"opacity-60"),children:t.label})]},t.id)})})}const ks={peach:"var(--main-300)",cream:"var(--brand-soft)",mint:"var(--mint-200)",blue:"var(--blue-200)",sky:"var(--blue-300)",rose:"var(--red-300)",gray:"var(--gray-200)"};function Ns(e){return e?e in ks?ks[e]:e:ks.cream}function As(e){return`repeating-linear-gradient(135deg, ${e}, ${e} 8px, color-mix(in srgb, ${e} 98%, black) 8px, color-mix(in srgb, ${e} 98%, black) 16px)`}function Ss({tone:t,label:n,radius:r=0,height:o="100%",animated:a=!1,className:i,style:l,...s}){const c=Ns(t);/* @__PURE__ */
|