@bikdotai/bik-component-library 0.0.547-beta.pp-8 → 0.0.547-beta.pp-9
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("./RadioButton.styled.js"),t=require("../TypographyStyle.js"),l=require("../../constants/Theme.js");const a=i=>{const s=i.isDisabled?l.COLORS.content.inactive:i.isActive?l.COLORS.background.positive.vibrant:l.COLORS.content.primary;return e.jsxs("svg",Object.assign({width:i.isSmall?"16":"20",height:i.isSmall?"16":"20",viewBox:i.isSmall?"0 0 16 16":"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("circle",{cx:i.isSmall?"8":"10",cy:i.isSmall?"8":"10",r:i.isSmall?6:9,stroke:s,strokeWidth:i.isSmall?1.5:2}),i.isActive&&e.jsx("circle",{cx:i.isSmall?"8":"10",cy:i.isSmall?"8":"10",r:i.isSmall?3:5,fill:i.isDisabled?l.COLORS.content.inactive:l.COLORS.background.positive.vibrant})]}))};exports.RadioButton=r=>{const[n,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("./RadioButton.styled.js"),t=require("../TypographyStyle.js"),l=require("../../constants/Theme.js");const a=i=>{const s=i.isDisabled?l.COLORS.content.inactive:i.isActive?l.COLORS.background.positive.vibrant:l.COLORS.content.primary;return e.jsxs("svg",Object.assign({width:i.isSmall?"16":"20",height:i.isSmall?"16":"20",viewBox:i.isSmall?"0 0 16 16":"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("circle",{cx:i.isSmall?"8":"10",cy:i.isSmall?"8":"10",r:i.isSmall?6:9,stroke:s,strokeWidth:i.isSmall?1.5:2}),i.isActive&&e.jsx("circle",{cx:i.isSmall?"8":"10",cy:i.isSmall?"8":"10",r:i.isSmall?3:5,fill:i.isDisabled?l.COLORS.content.inactive:l.COLORS.background.positive.vibrant})]}))};exports.RadioButton=r=>{const[n,o]=i.useState(r.isActive||!1),[c,d]=i.useState(!1),[O,b]=i.useState(!1);i.useEffect((()=>{o(r.isActive)}),[r.isActive]);return e.jsxs(s.RadioButtonContainer,Object.assign({onClick:()=>{var e;if(!r.skipSelectingOff&&!r.isDisabled){const i=!n;o(i),null===(e=r.onValueChange)||void 0===e||e.call(r,i,r.value)}},onMouseEnter:()=>d(!r.skipHoverState),onMouseLeave:()=>d(!1),onMouseDown:()=>b(!r.skipHoverState),onMouseUp:()=>b(!1)},{children:[e.jsx(s.RadioButtonIcon,Object.assign({checked:n,hovered:c,clicked:O,isDisabled:r.isDisabled||!1,size:r.size},{children:e.jsx(a,{isSmall:"SMALL"===r.size,isActive:n,isDisabled:r.isDisabled||!1})})),r.label?"DEFAULT"===r.labelSize&&r.boldOnChecked&&n?e.jsx(t.TitleSmall,Object.assign({color:r.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:r.label})):r.boldOnChecked&&n?e.jsx(t.TitleRegular,Object.assign({color:r.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:r.label})):"SMALL"===r.size?e.jsx(t.BodyCaption,Object.assign({color:r.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:r.label})):"MEDIUM"===r.labelSize?e.jsx(t.BodySecondary,Object.assign({color:r.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:r.label})):e.jsx(t.BodyPrimary,Object.assign({color:r.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:r.label})):e.jsx(e.Fragment,{})]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as i,jsx as e,Fragment as s}from"react/jsx-runtime";import{useState as l,useEffect as t}from"react";import{RadioButtonContainer as a,RadioButtonIcon as
|
|
1
|
+
import{jsxs as i,jsx as e,Fragment as s}from"react/jsx-runtime";import{useState as l,useEffect as t}from"react";import{RadioButtonContainer as a,RadioButtonIcon as r}from"./RadioButton.styled.js";import{TitleSmall as c,TitleRegular as o,BodyCaption as n,BodySecondary as d,BodyPrimary as b}from"../TypographyStyle.js";import{COLORS as m}from"../../constants/Theme.js";const v=s=>{const l=s.isDisabled?m.content.inactive:s.isActive?m.background.positive.vibrant:m.content.primary;return i("svg",Object.assign({width:s.isSmall?"16":"20",height:s.isSmall?"16":"20",viewBox:s.isSmall?"0 0 16 16":"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?6:9,stroke:l,strokeWidth:s.isSmall?1.5:2}),s.isActive&&e("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?3:5,fill:s.isDisabled?m.content.inactive:m.background.positive.vibrant})]}))},p=p=>{const[h,S]=l(p.isActive||!1),[g,x]=l(!1),[D,u]=l(!1);t((()=>{S(p.isActive)}),[p.isActive]);return i(a,Object.assign({onClick:()=>{var i;if(!p.skipSelectingOff&&!p.isDisabled){const e=!h;S(e),null===(i=p.onValueChange)||void 0===i||i.call(p,e,p.value)}},onMouseEnter:()=>x(!p.skipHoverState),onMouseLeave:()=>x(!1),onMouseDown:()=>u(!p.skipHoverState),onMouseUp:()=>u(!1)},{children:[e(r,Object.assign({checked:h,hovered:g,clicked:D,isDisabled:p.isDisabled||!1,size:p.size},{children:e(v,{isSmall:"SMALL"===p.size,isActive:h,isDisabled:p.isDisabled||!1})})),p.label?"DEFAULT"===p.labelSize&&p.boldOnChecked&&h?e(c,Object.assign({color:p.isDisabled?m.text.disabled:m.text.primary},{children:p.label})):p.boldOnChecked&&h?e(o,Object.assign({color:p.isDisabled?m.text.disabled:m.text.primary},{children:p.label})):"SMALL"===p.size?e(n,Object.assign({color:p.isDisabled?m.text.disabled:m.text.primary},{children:p.label})):"MEDIUM"===p.labelSize?e(d,Object.assign({color:p.isDisabled?m.text.disabled:m.text.primary},{children:p.label})):e(b,Object.assign({color:p.isDisabled?m.text.disabled:m.text.primary},{children:p.label})):e(s,{})]}))};export{p as RadioButton};
|