@trafilea/afrodita-components 7.25.5 → 7.25.6

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,2 +1,2 @@
1
- import{__makeTemplateObject as e,__assign as o}from"tslib";import{jsxs as n,jsx as t}from"react/jsx-runtime";import i from"@emotion/styled";import{useTheme as r}from"../../core/theme/Theme.js";import{ComponentSize as a}from"../../types/enums.js";import{Icon as c}from"../icons/index.js";import d from"../shared/label/label.js";import{CustomCheckboxStyles as s}from"./styles.js";var l,h,u=i.div(l||(l=e(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n user-select: none;\n position: relative;\n"],["\n display: flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n user-select: none;\n position: relative;\n"]))),g=function(e,o){if(!e&&!o)return!1;var n=(null==e?void 0:e.toLowerCase().trim())||"",t=(null==o?void 0:o.toLowerCase().trim())||"";return n.includes("white")||"#fff"===n||"#ffffff"===n||"white"===n||"#daa070"===n||"#f1cb75"===n||n.includes("beige")||n.includes("latte")||n.includes("sand")||("white"===t||"beige"===t||"latte"===t||"sand"===t)},m=i.div(s.baseStyles,(function(e){var o,n=e.backgroundImage?"\n background-image: url(".concat(e.backgroundImage,");\n background-repeat: no-repeat;\n background-size: cover;\n background-position: center;\n "):"",t=e.backgroundColor?"background-color: ".concat(e.backgroundColor,";"):"",i=g(null===(o=e.backgroundColor)||void 0===o?void 0:o.toString(),e.text)?"\n svg {\n path {\n fill: var(--colors-shades-black-color);\n }\n }":"",r=e.hasHightligthBorder?"border: 0.27px var(--colors-shades-300-color) solid;":"";return[s[e.size](e.theme),s[e.variant](e.theme,e.isChecked,e.disabled),"\n ".concat(n,"\n ").concat(t,"\n ").concat(i,"\n ").concat(r)]})),b=i.input(h||(h=e(["\n position: absolute;\n height: 100%;\n width: 100%;\n margin: 0;\n opacity: 0;\n cursor: ",";\n"],["\n position: absolute;\n height: 100%;\n width: 100%;\n margin: 0;\n opacity: 0;\n cursor: ",";\n"])),(function(e){return e.disabled?"not-allowed":"pointer"})),f=function(e){var i=e.disabled,s=void 0!==i&&i,l=e.onChange,h=e.size,f=void 0===h?a.Medium:h,v=e.sizeLabel,k=void 0===v?a.Medium:v,p=e.colorLabel,x=e.text,y=e.checked,C=void 0!==y&&y,w=e.id,j=e.variant,z=e.blockUncheck,I=e.backgroundColor,L=e.backgroundImage,B=e.hasHightligthBorder,H=void 0!==B&&B,M=r();return n(u,{children:[t(b,{type:"checkbox",checked:C,disabled:s,onChange:function(e){s||!1===e.target.checked&&z?e.preventDefault():l(e.target.checked)},id:w},void 0),t(m,o({theme:M,size:f,disabled:s,isChecked:C,"data-testid":"checkbox",variant:j,backgroundColor:I,backgroundImage:L,text:x,hasHightligthBorder:H},{children:C&&t(c.Actions.Check,{fill:g(I,x)?M.colors.shades.black.color:M.colors.shades.white.color},void 0)}),void 0),t(d,o({"data-testid":"checkbox-text",size:k,style:{color:p||M.colors.shades[700].color},variant:C?"demi":"regular",htmlFor:w,disabled:s},{children:x}),void 0)]},void 0)};export{f as Checkbox};
1
+ import{__makeTemplateObject as e,__assign as o}from"tslib";import{jsxs as n,jsx as i}from"react/jsx-runtime";import t from"@emotion/styled";import{useTheme as r}from"../../core/theme/Theme.js";import{ComponentSize as a}from"../../types/enums.js";import{Icon as c}from"../icons/index.js";import s from"../shared/label/label.js";import{CustomCheckboxStyles as l}from"./styles.js";var d,u,h=t.div(d||(d=e(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n user-select: none;\n position: relative;\n"],["\n display: flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n user-select: none;\n position: relative;\n"]))),b=function(e,o){if(!e&&!o)return!1;var n=(null==e?void 0:e.toLowerCase().trim())||"",i=(null==o?void 0:o.toLowerCase().trim())||"";return n.includes("white")||"#fff"===n||"#ffffff"===n||"white"===n||"#daa070"===n||"#f1cb75"===n||n.includes("beige")||n.includes("latte")||n.includes("sand")||("white"===i||"beige"===i||"latte"===i||"sand"===i)},f=t.div(l.baseStyles,(function(e){var o,n=e.backgroundImage?"\n background-image: url(".concat(e.backgroundImage,");\n background-repeat: no-repeat;\n background-size: cover;\n background-position: center;\n "):"",i=e.backgroundColor?"background-color: ".concat(e.backgroundColor,";"):"",t=b(null===(o=e.backgroundColor)||void 0===o?void 0:o.toString(),e.text)?"\n svg {\n path {\n fill: var(--colors-shades-black-color);\n }\n }":"",r=e.hasHightligthBorder?"border: 0.27px var(--colors-shades-300-color) solid;":"";return[l[e.size](e.theme),l[e.variant](e.theme,e.isChecked,e.disabled),"\n ".concat(n,"\n ").concat(i,"\n ").concat(t,"\n ").concat(r)]})),g=t.input(u||(u=e(["\n position: absolute;\n height: 100%;\n width: 100%;\n margin: 0;\n opacity: 0;\n cursor: ",";\n\n &:focus-visible {\n outline: none;\n }\n\n &:focus-visible + div {\n outline: 2px solid var(--colors-shades-700-color);\n outline-offset: 2px;\n ","\n }\n"],["\n position: absolute;\n height: 100%;\n width: 100%;\n margin: 0;\n opacity: 0;\n cursor: ",";\n\n &:focus-visible {\n outline: none;\n }\n\n &:focus-visible + div {\n outline: 2px solid var(--colors-shades-700-color);\n outline-offset: 2px;\n ","\n }\n"])),(function(e){return e.disabled?"not-allowed":"pointer"}),(function(e){return e.$isColorVariant&&"border-radius: 50%;"})),m=function(e){var t=e.disabled,l=void 0!==t&&t,d=e.onChange,u=e.size,m=void 0===u?a.Medium:u,v=e.sizeLabel,p=void 0===v?a.Medium:v,k=e.colorLabel,x=e.text,C=e.checked,y=void 0!==C&&C,w=e.id,j=e.variant,z=e.blockUncheck,L=e.backgroundColor,I=e.backgroundImage,B=e.hasHightligthBorder,H=void 0!==B&&B,M=e.ariaLabel,S=r();return n(h,{children:[i(g,{type:"checkbox",checked:y,disabled:l,onChange:function(e){l||!1===e.target.checked&&z?e.preventDefault():d(e.target.checked)},id:w,"aria-label":M,$isColorVariant:"color"===j},void 0),i(f,o({theme:S,size:m,disabled:l,isChecked:y,"data-testid":"checkbox",variant:j,backgroundColor:L,backgroundImage:I,text:x,hasHightligthBorder:H},{children:y&&i(c.Actions.Check,{fill:b(L,x)?S.colors.shades.black.color:S.colors.shades.white.color},void 0)}),void 0),i(s,o({"data-testid":"checkbox-text",size:p,style:{color:k||S.colors.shades[700].color},variant:y?"demi":"regular",htmlFor:w,disabled:l},{children:x}),void 0)]},void 0)};export{m as Checkbox};
2
2
  //# sourceMappingURL=Checkbox.js.map
package/build/index.d.ts CHANGED
@@ -1364,11 +1364,12 @@ declare const AssetsProvider: FC<{
1364
1364
  }>;
1365
1365
  declare const useThemeAssets: () => ThemeAssets;
1366
1366
 
1367
+ declare type CheckboxSize = ComponentSize.Large | ComponentSize.Medium | ComponentSize.Small;
1367
1368
  interface CheckboxProps {
1368
1369
  disabled?: boolean;
1369
1370
  onChange: (checked: boolean) => void;
1370
- size?: ComponentSize.Large | ComponentSize.Medium | ComponentSize.Small;
1371
- sizeLabel?: ComponentSize.Large | ComponentSize.Medium | ComponentSize.Small;
1371
+ size?: CheckboxSize;
1372
+ sizeLabel?: CheckboxSize;
1372
1373
  colorLabel?: string;
1373
1374
  text: string;
1374
1375
  checked?: boolean;
@@ -1378,6 +1379,7 @@ interface CheckboxProps {
1378
1379
  backgroundImage?: string;
1379
1380
  variant: 'primary' | 'secondary' | 'color';
1380
1381
  hasHightligthBorder?: boolean;
1382
+ ariaLabel?: string;
1381
1383
  }
1382
1384
  declare const Checkbox: react__default.FC<CheckboxProps>;
1383
1385
 
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("@emotion/styled"),o=require("../../core/theme/Theme.js"),i=require("../../types/enums.js"),r=require("../icons/index.js"),a=require("../shared/label/label.js"),c=require("./styles.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d,l,u=s(t),h=u.default.div(d||(d=e.__makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n user-select: none;\n position: relative;\n"],["\n display: flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n user-select: none;\n position: relative;\n"]))),b=function(e,n){if(!e&&!n)return!1;var t=(null==e?void 0:e.toLowerCase().trim())||"",o=(null==n?void 0:n.toLowerCase().trim())||"";return t.includes("white")||"#fff"===t||"#ffffff"===t||"white"===t||"#daa070"===t||"#f1cb75"===t||t.includes("beige")||t.includes("latte")||t.includes("sand")||("white"===o||"beige"===o||"latte"===o||"sand"===o)},g=u.default.div(c.CustomCheckboxStyles.baseStyles,(function(e){var n,t=e.backgroundImage?"\n background-image: url(".concat(e.backgroundImage,");\n background-repeat: no-repeat;\n background-size: cover;\n background-position: center;\n "):"",o=e.backgroundColor?"background-color: ".concat(e.backgroundColor,";"):"",i=b(null===(n=e.backgroundColor)||void 0===n?void 0:n.toString(),e.text)?"\n svg {\n path {\n fill: var(--colors-shades-black-color);\n }\n }":"",r=e.hasHightligthBorder?"border: 0.27px var(--colors-shades-300-color) solid;":"";return[c.CustomCheckboxStyles[e.size](e.theme),c.CustomCheckboxStyles[e.variant](e.theme,e.isChecked,e.disabled),"\n ".concat(t,"\n ").concat(o,"\n ").concat(i,"\n ").concat(r)]})),k=u.default.input(l||(l=e.__makeTemplateObject(["\n position: absolute;\n height: 100%;\n width: 100%;\n margin: 0;\n opacity: 0;\n cursor: ",";\n"],["\n position: absolute;\n height: 100%;\n width: 100%;\n margin: 0;\n opacity: 0;\n cursor: ",";\n"])),(function(e){return e.disabled?"not-allowed":"pointer"}));exports.Checkbox=function(t){var c=t.disabled,s=void 0!==c&&c,d=t.onChange,l=t.size,u=void 0===l?i.ComponentSize.Medium:l,f=t.sizeLabel,m=void 0===f?i.ComponentSize.Medium:f,v=t.colorLabel,p=t.text,x=t.checked,C=void 0!==x&&x,j=t.id,y=t.variant,w=t.blockUncheck,_=t.backgroundColor,q=t.backgroundImage,z=t.hasHightligthBorder,S=void 0!==z&&z,I=o.useTheme();return n.jsxs(h,{children:[n.jsx(k,{type:"checkbox",checked:C,disabled:s,onChange:function(e){s||!1===e.target.checked&&w?e.preventDefault():d(e.target.checked)},id:j},void 0),n.jsx(g,e.__assign({theme:I,size:u,disabled:s,isChecked:C,"data-testid":"checkbox",variant:y,backgroundColor:_,backgroundImage:q,text:p,hasHightligthBorder:S},{children:C&&n.jsx(r.Icon.Actions.Check,{fill:b(_,p)?I.colors.shades.black.color:I.colors.shades.white.color},void 0)}),void 0),n.jsx(a,e.__assign({"data-testid":"checkbox-text",size:m,style:{color:v||I.colors.shades[700].color},variant:C?"demi":"regular",htmlFor:j,disabled:s},{children:p}),void 0)]},void 0)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),o=require("@emotion/styled"),t=require("../../core/theme/Theme.js"),i=require("../../types/enums.js"),r=require("../icons/index.js"),a=require("../shared/label/label.js"),s=require("./styles.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l,d,u=c(o),h=u.default.div(l||(l=e.__makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n user-select: none;\n position: relative;\n"],["\n display: flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n user-select: none;\n position: relative;\n"]))),b=function(e,n){if(!e&&!n)return!1;var o=(null==e?void 0:e.toLowerCase().trim())||"",t=(null==n?void 0:n.toLowerCase().trim())||"";return o.includes("white")||"#fff"===o||"#ffffff"===o||"white"===o||"#daa070"===o||"#f1cb75"===o||o.includes("beige")||o.includes("latte")||o.includes("sand")||("white"===t||"beige"===t||"latte"===t||"sand"===t)},f=u.default.div(s.CustomCheckboxStyles.baseStyles,(function(e){var n,o=e.backgroundImage?"\n background-image: url(".concat(e.backgroundImage,");\n background-repeat: no-repeat;\n background-size: cover;\n background-position: center;\n "):"",t=e.backgroundColor?"background-color: ".concat(e.backgroundColor,";"):"",i=b(null===(n=e.backgroundColor)||void 0===n?void 0:n.toString(),e.text)?"\n svg {\n path {\n fill: var(--colors-shades-black-color);\n }\n }":"",r=e.hasHightligthBorder?"border: 0.27px var(--colors-shades-300-color) solid;":"";return[s.CustomCheckboxStyles[e.size](e.theme),s.CustomCheckboxStyles[e.variant](e.theme,e.isChecked,e.disabled),"\n ".concat(o,"\n ").concat(t,"\n ").concat(i,"\n ").concat(r)]})),g=u.default.input(d||(d=e.__makeTemplateObject(["\n position: absolute;\n height: 100%;\n width: 100%;\n margin: 0;\n opacity: 0;\n cursor: ",";\n\n &:focus-visible {\n outline: none;\n }\n\n &:focus-visible + div {\n outline: 2px solid var(--colors-shades-700-color);\n outline-offset: 2px;\n ","\n }\n"],["\n position: absolute;\n height: 100%;\n width: 100%;\n margin: 0;\n opacity: 0;\n cursor: ",";\n\n &:focus-visible {\n outline: none;\n }\n\n &:focus-visible + div {\n outline: 2px solid var(--colors-shades-700-color);\n outline-offset: 2px;\n ","\n }\n"])),(function(e){return e.disabled?"not-allowed":"pointer"}),(function(e){return e.$isColorVariant&&"border-radius: 50%;"}));exports.Checkbox=function(o){var s=o.disabled,c=void 0!==s&&s,l=o.onChange,d=o.size,u=void 0===d?i.ComponentSize.Medium:d,v=o.sizeLabel,k=void 0===v?i.ComponentSize.Medium:v,m=o.colorLabel,p=o.text,x=o.checked,C=void 0!==x&&x,j=o.id,y=o.variant,w=o.blockUncheck,_=o.backgroundColor,q=o.backgroundImage,z=o.hasHightligthBorder,S=void 0!==z&&z,I=o.ariaLabel,L=t.useTheme(),T="color"===y;return n.jsxs(h,{children:[n.jsx(g,{type:"checkbox",checked:C,disabled:c,onChange:function(e){c||!1===e.target.checked&&w?e.preventDefault():l(e.target.checked)},id:j,"aria-label":I,$isColorVariant:T},void 0),n.jsx(f,e.__assign({theme:L,size:u,disabled:c,isChecked:C,"data-testid":"checkbox",variant:y,backgroundColor:_,backgroundImage:q,text:p,hasHightligthBorder:S},{children:C&&n.jsx(r.Icon.Actions.Check,{fill:b(_,p)?L.colors.shades.black.color:L.colors.shades.white.color},void 0)}),void 0),n.jsx(a,e.__assign({"data-testid":"checkbox-text",size:k,style:{color:m||L.colors.shades[700].color},variant:C?"demi":"regular",htmlFor:j,disabled:c},{children:p}),void 0)]},void 0)};
2
2
  //# sourceMappingURL=Checkbox.js.map
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Trafilea's Design System",
4
4
  "author": "Trafilea",
5
5
  "repository": "https://github.com/trafilea/afrodita-components",
6
- "version": "7.25.5",
6
+ "version": "7.25.6",
7
7
  "private": false,
8
8
  "main": "build/lib/index.js",
9
9
  "style": "build/es/index.css",