@bikdotai/bik-component-library 0.0.7-beta.0 → 0.0.7
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("./CheckBox.styled.js"),t=require("../../constants/Theme.js");const l=i=>e.jsxs("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("rect",{x:"0",y:"0",width:"18",height:"18",rx:"4",fill:i.isDisabled?t.COLORS.content.inactive:t.COLORS.background.positive.vibrant}),!i.isPartial&&e.jsx("svg",Object.assign({width:"10",height:"9",x:"4",y:"4",viewBox:"0 0 10 9",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.68189 1.06043C10.0724 1.45096 10.0724 2.08412 9.68189 2.47464L4.02501 8.13152C3.63449 8.52205 3.00132 8.52205 2.6108 8.13152L0.489684 6.01041C0.0991601 5.61988 0.0991598 4.98672 0.489684 4.59619C0.880209 4.20567 1.51337 4.20567 1.9039 4.59619L3.31791 6.0102L8.26768 1.06043C8.6582 0.669907 9.29137 0.669907 9.68189 1.06043Z",fill:"white"})})),i.isPartial&&e.jsx("rect",{x:"5",y:"8",width:"8",height:"2",rx:"1",fill:t.COLORS.surface.standard})]}));exports.CheckBox=t=>{var n;const[r,a]=i.useState(t.isChecked||!1),[c
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("./CheckBox.styled.js"),t=require("../../constants/Theme.js");const l=i=>e.jsxs("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("rect",{x:"0",y:"0",width:"18",height:"18",rx:"4",fill:i.isDisabled?t.COLORS.content.inactive:t.COLORS.background.positive.vibrant}),!i.isPartial&&e.jsx("svg",Object.assign({width:"10",height:"9",x:"4",y:"4",viewBox:"0 0 10 9",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.68189 1.06043C10.0724 1.45096 10.0724 2.08412 9.68189 2.47464L4.02501 8.13152C3.63449 8.52205 3.00132 8.52205 2.6108 8.13152L0.489684 6.01041C0.0991601 5.61988 0.0991598 4.98672 0.489684 4.59619C0.880209 4.20567 1.51337 4.20567 1.9039 4.59619L3.31791 6.0102L8.26768 1.06043C8.6582 0.669907 9.29137 0.669907 9.68189 1.06043Z",fill:"white"})})),i.isPartial&&e.jsx("rect",{x:"5",y:"8",width:"8",height:"2",rx:"1",fill:t.COLORS.surface.standard})]}));exports.CheckBox=t=>{var n;const[r,a]=i.useState(t.isChecked||!1),[o,c]=i.useState(!1),[d,h]=i.useState(!1);return e.jsx(s.CheckboxContainer,Object.assign({onClick:()=>{var e;if(!t.isDisabled){const i=!r;a(i),null===(e=t.onValueChange)||void 0===e||e.call(t,i,t.value)}},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onMouseDown:()=>h(!0),onMouseUp:()=>h(!1)},{children:e.jsx(s.CheckboxIcon,Object.assign({checked:r,hovered:o,clicked:d,isDisabled:t.isDisabled||!1},{children:r&&e.jsx(l,{isPartial:null!==(n=t.isPartiallyChecked)&&void 0!==n&&n,isDisabled:t.isDisabled||!1})}))}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as i}from"react/jsx-runtime";import{useState as s
|
|
1
|
+
import{jsx as e,jsxs as i}from"react/jsx-runtime";import{useState as s}from"react";import{CheckboxContainer as t,CheckboxIcon as l}from"./CheckBox.styled.js";import{COLORS as n}from"../../constants/Theme.js";const o=s=>i("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e("rect",{x:"0",y:"0",width:"18",height:"18",rx:"4",fill:s.isDisabled?n.content.inactive:n.background.positive.vibrant}),!s.isPartial&&e("svg",Object.assign({width:"10",height:"9",x:"4",y:"4",viewBox:"0 0 10 9",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.68189 1.06043C10.0724 1.45096 10.0724 2.08412 9.68189 2.47464L4.02501 8.13152C3.63449 8.52205 3.00132 8.52205 2.6108 8.13152L0.489684 6.01041C0.0991601 5.61988 0.0991598 4.98672 0.489684 4.59619C0.880209 4.20567 1.51337 4.20567 1.9039 4.59619L3.31791 6.0102L8.26768 1.06043C8.6582 0.669907 9.29137 0.669907 9.68189 1.06043Z",fill:"white"})})),s.isPartial&&e("rect",{x:"5",y:"8",width:"8",height:"2",rx:"1",fill:n.surface.standard})]})),r=i=>{var n;const[r,a]=s(i.isChecked||!1),[c,d]=s(!1),[h,v]=s(!1);return e(t,Object.assign({onClick:()=>{var e;if(!i.isDisabled){const s=!r;a(s),null===(e=i.onValueChange)||void 0===e||e.call(i,s,i.value)}},onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onMouseDown:()=>v(!0),onMouseUp:()=>v(!1)},{children:e(l,Object.assign({checked:r,hovered:c,clicked:h,isDisabled:i.isDisabled||!1},{children:r&&e(o,{isPartial:null!==(n=i.isPartiallyChecked)&&void 0!==n&&n,isDisabled:i.isDisabled||!1})}))}))};export{r as CheckBox};
|