@bikdotai/bik-component-library 0.0.603 → 0.0.604

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.
@@ -4,11 +4,13 @@ export type RadioButtonProps = {
4
4
  isDisabled?: boolean;
5
5
  value?: string;
6
6
  label?: string;
7
+ caption?: string;
7
8
  onValueChange: (checked: boolean, value?: string) => void;
8
9
  skipHoverState?: boolean;
9
10
  size?: 'DEFAULT' | 'SMALL';
10
11
  skipSelectingOff?: boolean;
11
12
  labelSize?: 'DEFAULT' | 'MEDIUM';
12
13
  boldOnChecked?: boolean;
14
+ alwaysBold?: boolean;
13
15
  };
14
16
  export declare const RadioButton: React.FC<RadioButtonProps>;
@@ -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,o]=i.useState(r.isActive||!1),[c,d]=i.useState(!1),[O,S]=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:()=>S(!r.skipHoverState),onMouseUp:()=>S(!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?r.boldOnChecked&&n?e.jsx(t.TitleSmall,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
+ "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[r,o]=i.useState(n.isActive||!1),[c,d]=i.useState(!1),[O,S]=i.useState(!1);i.useEffect((()=>{o(n.isActive)}),[n.isActive]);return e.jsxs(s.RadioButtonContainer,Object.assign({onClick:()=>{var e;if(!n.skipSelectingOff&&!n.isDisabled){const i=!r;o(i),null===(e=n.onValueChange)||void 0===e||e.call(n,i,n.value)}},onMouseEnter:()=>d(!n.skipHoverState),onMouseLeave:()=>d(!1),onMouseDown:()=>S(!n.skipHoverState),onMouseUp:()=>S(!1),style:n.caption?{alignItems:"flex-start"}:{}},{children:[e.jsx(s.RadioButtonIcon,Object.assign({checked:r,hovered:c,clicked:O,isDisabled:n.isDisabled||!1,size:n.size,style:n.caption?{margin:"2px 0"}:{}},{children:e.jsx(a,{isSmall:"SMALL"===n.size,isActive:r,isDisabled:n.isDisabled||!1})})),e.jsxs("div",{children:[n.label?n.boldOnChecked&&r||n.alwaysBold?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},{children:n.label})):"MEDIUM"===n.labelSize?e.jsx(t.BodySecondary,Object.assign({color:n.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:n.label})):e.jsx(t.BodyPrimary,Object.assign({color:n.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:n.label})):e.jsx(e.Fragment,{}),n.caption&&e.jsx(t.BodyCaption,Object.assign({color:n.isDisabled?l.COLORS.text.disabled:l.COLORS.text.secondary},{children:n.caption}))]})]}))};
@@ -4,11 +4,13 @@ export type RadioButtonProps = {
4
4
  isDisabled?: boolean;
5
5
  value?: string;
6
6
  label?: string;
7
+ caption?: string;
7
8
  onValueChange: (checked: boolean, value?: string) => void;
8
9
  skipHoverState?: boolean;
9
10
  size?: 'DEFAULT' | 'SMALL';
10
11
  skipSelectingOff?: boolean;
11
12
  labelSize?: 'DEFAULT' | 'MEDIUM';
12
13
  boldOnChecked?: boolean;
14
+ alwaysBold?: boolean;
13
15
  };
14
16
  export declare const RadioButton: React.FC<RadioButtonProps>;
@@ -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 r}from"./RadioButton.styled.js";import{TitleSmall as o,BodyCaption as c,BodySecondary as n,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 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?b.content.inactive:b.background.positive.vibrant})]}))},v=v=>{const[p,h]=l(v.isActive||!1),[S,g]=l(!1),[x,u]=l(!1);t((()=>{h(v.isActive)}),[v.isActive]);return i(a,Object.assign({onClick:()=>{var i;if(!v.skipSelectingOff&&!v.isDisabled){const e=!p;h(e),null===(i=v.onValueChange)||void 0===i||i.call(v,e,v.value)}},onMouseEnter:()=>g(!v.skipHoverState),onMouseLeave:()=>g(!1),onMouseDown:()=>u(!v.skipHoverState),onMouseUp:()=>u(!1)},{children:[e(r,Object.assign({checked:p,hovered:S,clicked:x,isDisabled:v.isDisabled||!1,size:v.size},{children:e(m,{isSmall:"SMALL"===v.size,isActive:p,isDisabled:v.isDisabled||!1})})),v.label?v.boldOnChecked&&p?e(o,Object.assign({color:v.isDisabled?b.text.disabled:b.text.primary},{children:v.label})):"SMALL"===v.size?e(c,Object.assign({color:v.isDisabled?b.text.disabled:b.text.primary},{children:v.label})):"MEDIUM"===v.labelSize?e(n,Object.assign({color:v.isDisabled?b.text.disabled:b.text.primary},{children:v.label})):e(d,Object.assign({color:v.isDisabled?b.text.disabled:b.text.primary},{children:v.label})):e(s,{})]}))};export{v as RadioButton};
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 c}from"./RadioButton.styled.js";import{BodyCaption as o,TitleSmall as r,BodySecondary as n,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 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?b.content.inactive:b.background.positive.vibrant})]}))},p=p=>{const[v,h]=l(p.isActive||!1),[g,x]=l(!1),[S,y]=l(!1);t((()=>{h(p.isActive)}),[p.isActive]);return i(a,Object.assign({onClick:()=>{var i;if(!p.skipSelectingOff&&!p.isDisabled){const e=!v;h(e),null===(i=p.onValueChange)||void 0===i||i.call(p,e,p.value)}},onMouseEnter:()=>x(!p.skipHoverState),onMouseLeave:()=>x(!1),onMouseDown:()=>y(!p.skipHoverState),onMouseUp:()=>y(!1),style:p.caption?{alignItems:"flex-start"}:{}},{children:[e(c,Object.assign({checked:v,hovered:g,clicked:S,isDisabled:p.isDisabled||!1,size:p.size,style:p.caption?{margin:"2px 0"}:{}},{children:e(m,{isSmall:"SMALL"===p.size,isActive:v,isDisabled:p.isDisabled||!1})})),i("div",{children:[p.label?p.boldOnChecked&&v||p.alwaysBold?e(r,Object.assign({color:p.isDisabled?b.text.disabled:b.text.primary},{children:p.label})):"SMALL"===p.size?e(o,Object.assign({color:p.isDisabled?b.text.disabled:b.text.primary},{children:p.label})):"MEDIUM"===p.labelSize?e(n,Object.assign({color:p.isDisabled?b.text.disabled:b.text.primary},{children:p.label})):e(d,Object.assign({color:p.isDisabled?b.text.disabled:b.text.primary},{children:p.label})):e(s,{}),p.caption&&e(o,Object.assign({color:p.isDisabled?b.text.disabled:b.text.secondary},{children:p.caption}))]})]}))};export{p as RadioButton};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.603",
3
+ "version": "0.0.604",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",