@bikdotai/bik-component-library 0.0.547-beta.pp-6 → 0.0.547-beta.pp-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("./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=n=>{const[o,r]=i.useState(n.isActive||!1),[c,d]=i.useState(!1),[O,
|
|
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=n=>{const[o,r]=i.useState(n.isActive||!1),[c,d]=i.useState(!1),[O,b]=i.useState(!1);i.useEffect((()=>{r(n.isActive)}),[n.isActive]);return e.jsxs(s.RadioButtonContainer,Object.assign({onClick:()=>{var e;if(!n.skipSelectingOff&&!n.isDisabled){const i=!o;r(i),null===(e=n.onValueChange)||void 0===e||e.call(n,i,n.value)}},onMouseEnter:()=>d(!n.skipHoverState),onMouseLeave:()=>d(!1),onMouseDown:()=>b(!n.skipHoverState),onMouseUp:()=>b(!1)},{children:[e.jsx(s.RadioButtonIcon,Object.assign({checked:o,hovered:c,clicked:O,isDisabled:n.isDisabled||!1,size:n.size},{children:e.jsx(a,{isSmall:"SMALL"===n.size,isActive:o,isDisabled:n.isDisabled||!1})})),n.label?n.boldOnChecked&&o?e.jsx(t.TitleSmall,Object.assign({color:n.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:n.label})):"SMALL"===n.size?e.jsx(t.BodyCaption,Object.assign({color:n.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary,style:{fontWeight:n.boldOnChecked&&o?"600":"normal"}},{children:n.label})):"MEDIUM"===n.labelSize?e.jsx(t.BodySecondary,Object.assign({color:n.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary,style:{fontWeight:n.boldOnChecked&&o?"600":"normal"}},{children:n.label})):e.jsx(t.BodyPrimary,Object.assign({color:n.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary,style:{fontWeight:n.boldOnChecked&&o?"600":"normal"}},{children:n.label})):e.jsx(e.Fragment,{})]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as i,Fragment as s}from"react/jsx-runtime";import{useState as l,useEffect as t}from"react";import{RadioButtonContainer as a,RadioButtonIcon as o}from"./RadioButton.styled.js";import{
|
|
1
|
+
import{jsxs as e,jsx as i,Fragment as s}from"react/jsx-runtime";import{useState as l,useEffect as t}from"react";import{RadioButtonContainer as a,RadioButtonIcon as o}from"./RadioButton.styled.js";import{TitleSmall as n,BodyCaption as r,BodySecondary as c,BodyPrimary as d}from"../TypographyStyle.js";import{COLORS as b}from"../../constants/Theme.js";const m=s=>{const l=s.isDisabled?b.content.inactive:s.isActive?b.background.positive.vibrant:b.content.primary;return e("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:[i("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&&i("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?3:5,fill:s.isDisabled?b.content.inactive:b.background.positive.vibrant})]}))},h=h=>{const[v,p]=l(h.isActive||!1),[g,S]=l(!1),[k,x]=l(!1);t((()=>{p(h.isActive)}),[h.isActive]);return e(a,Object.assign({onClick:()=>{var e;if(!h.skipSelectingOff&&!h.isDisabled){const i=!v;p(i),null===(e=h.onValueChange)||void 0===e||e.call(h,i,h.value)}},onMouseEnter:()=>S(!h.skipHoverState),onMouseLeave:()=>S(!1),onMouseDown:()=>x(!h.skipHoverState),onMouseUp:()=>x(!1)},{children:[i(o,Object.assign({checked:v,hovered:g,clicked:k,isDisabled:h.isDisabled||!1,size:h.size},{children:i(m,{isSmall:"SMALL"===h.size,isActive:v,isDisabled:h.isDisabled||!1})})),h.label?h.boldOnChecked&&v?i(n,Object.assign({color:h.isDisabled?b.text.disabled:b.text.primary},{children:h.label})):"SMALL"===h.size?i(r,Object.assign({color:h.isDisabled?b.text.disabled:b.text.primary,style:{fontWeight:h.boldOnChecked&&v?"600":"normal"}},{children:h.label})):"MEDIUM"===h.labelSize?i(c,Object.assign({color:h.isDisabled?b.text.disabled:b.text.primary,style:{fontWeight:h.boldOnChecked&&v?"600":"normal"}},{children:h.label})):i(d,Object.assign({color:h.isDisabled?b.text.disabled:b.text.primary,style:{fontWeight:h.boldOnChecked&&v?"600":"normal"}},{children:h.label})):i(s,{})]}))};export{h as RadioButton};
|