@trafilea/afrodita-components 7.5.1 → 7.6.0
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.
- package/build/es/components/dropdown/base/BaseDropdownOptions.js +1 -1
- package/build/es/components/dropdown/variants/simple/SimpleDropdown.js +1 -1
- package/build/es/components/pricing/discount/DiscountTag.js +1 -1
- package/build/index.d.ts +5 -2
- package/build/lib/components/dropdown/base/BaseDropdownOptions.js +1 -1
- package/build/lib/components/dropdown/variants/simple/SimpleDropdown.js +1 -1
- package/build/lib/components/pricing/discount/DiscountTag.js +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as o}from"tslib";import{jsx as r}from"react/jsx-runtime";import e from"@emotion/styled";import{useTheme as t}from"../../../core/theme/Theme.js";import n from"../../shared/select/BaseSelect.js";var
|
|
1
|
+
import{__assign as o}from"tslib";import{jsx as r}from"react/jsx-runtime";import e from"@emotion/styled";import{useTheme as t}from"../../../core/theme/Theme.js";import n from"../../shared/select/BaseSelect.js";var d=e(n.Options)((function(r){var e=r.theme,t=r.isOpenUpwards,n=r.maxHeight;return o(o({display:"flex",flexDirection:"column",alignItems:"flex-start",border:"".concat(e.component.dropdown.borderWidth||"0.063rem"," solid ").concat(e.component.dropdown.options.borderColor),boxSizing:"border-box",borderRadius:e.component.dropdown.options.borderRadius,background:e.colors.shades.white.color,fontFamily:e.fonts.config[0].family,padding:0},t?{marginBottom:"0.125rem",bottom:"100%"}:{marginTop:"0.125rem"}),{position:"absolute",width:"100%",color:e.colors.shades[700].color,zIndex:10,overflow:n?"auto":e.component.dropdown.optionsWrapper.overflow,maxHeight:null!=n?n:"unset","&::-webkit-scrollbar":{width:"8px"},"&::-webkit-scrollbar-track":{background:e.colors.shades[50].color,borderRadius:e.component.dropdown.options.borderRadius},"&::-webkit-scrollbar-thumb":{background:e.colors.shades[150].color,borderRadius:e.component.dropdown.options.borderRadius,"&:hover":{background:e.colors.shades[400].color}}})})),i=function(e){var n=e.children,i=e.isOpenUpwards,s=e.maxHeight,a=t();return r(d,o({theme:a,isOpenUpwards:i,maxHeight:s},{children:n}),void 0)};export{i as default};
|
|
2
2
|
//# sourceMappingURL=BaseDropdownOptions.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as e,__assign as n}from"tslib";import{jsx as
|
|
1
|
+
import{__makeTemplateObject as e,__assign as n}from"tslib";import{jsx as i,jsxs as o,Fragment as r}from"react/jsx-runtime";import t from"@emotion/styled";import{useState as d,useMemo as l,useEffect as a,Fragment as s}from"react";import{Icon as c}from"../../../icons/index.js";import{Error as m}from"../../../input/base/Error.js";import v from"../../base/BaseDropdown.js";var u,p,g,h=t.div(u||(u=e([""],[""]))),f=t.p(p||(p=e(["\n margin: unset;\n &:after {\n content: '*';\n color: var(--colors-semantic-urgent-color);\n }\n"],["\n margin: unset;\n &:after {\n content: '*';\n color: var(--colors-semantic-urgent-color);\n }\n"]))),b=t.span(g||(g=e(["\n font-weight: ",";\n"],["\n font-weight: ",";\n"])),(function(e){return e.fontWeight||""}));function w(e){var t=e.options,u=e.disabled,p=void 0!==u&&u,g=e.initialValue,w=e.placeHolder,R=e.label,U=e.wide,O=void 0!==U&&U,x=e.sort,I=void 0!==x&&x,L=e.onChange,C=e.value,j=e.testId,y=void 0===j?"simple-dropdown":j,H=e.required,W=e.showRequiredPlaceholder,q=e.selectedOptionWeight,A=e.isOpenUpwards,B=void 0!==A&&A,D=e.maxHeight,F=d(C||g),k=F[0],E=F[1],P=l((function(){var e;return k?null!==(e=k.selectedLabel)&&void 0!==e?e:k.label:W?i(f,{children:w},void 0):w}),[k,W,w]);return a((function(){null!=C?t.findIndex((function(e){return e.value===C.value}))<0?E(void 0):E(C):g||E(void 0)}),[C,t,g]),o(W?h:s,{children:[o(v,n({value:k,onChange:function(e){L&&L(e),E(e)},disabled:p,wide:O},{children:[o(v.Button,n({label:R,OpenIcon:c.Arrows.ChevronDown,CloseIcon:c.Arrows.ChevronUp,wide:O,isSortOrFilter:I,testId:y},{children:[!!(null==k?void 0:k.imageURL)&&i("img",{src:k.imageURL,alt:k.label,style:{paddingRight:8}},void 0),q&&p?i(b,n({fontWeight:q},{children:P}),void 0):i(r,{children:P},void 0)]}),void 0),i(v.Options,n({isOpenUpwards:B,maxHeight:D},{children:t.map((function(e){return o(v.Option,n({value:e,disabled:e.disabled,hasImage:!!e.imageURL},{children:[!!e.imageURL&&i("img",{src:e.imageURL,alt:e.label,style:{paddingRight:8}},void 0),e.label]}),e.key)}))}),void 0)]}),void 0),!!H&&i(m,{error:H},void 0)]},void 0)}export{w as default};
|
|
2
2
|
//# sourceMappingURL=SimpleDropdown.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as o}from"tslib";import{jsxs as r,jsx as
|
|
1
|
+
import{__assign as o}from"tslib";import{jsxs as r,jsx as i,Fragment as s}from"react/jsx-runtime";import{useTheme as e}from"../../../core/theme/Theme.js";import{ComponentSize as n}from"../../../types/enums.js";import{Container as t,IconContainer as d,H3 as c}from"./styled.js";var a=function(o){var r=o.discount,e=o.offText,n=o.savings,t=o.showSavings,d=void 0!==t&&t,c=o.showOnlySavings;if(void 0!==c&&c&&n)return i(s,{children:n},void 0);var a="".concat(r,"% ").concat(e),v=d&&n?" - ".concat(n):"";return i(s,{children:"".concat(a).concat(v).trim()},void 0)},v=function(s){var v=s.discount,l=s.offText,f=s.savings,h=s.showSavings,m=void 0!==h&&h,u=s.showOnlySavings,g=void 0!==u&&u,p=s.disabled,b=s.backgroundColor,w=void 0===b?"#fff":b,y=s.borderColor,x=void 0===y?"transparent":y,S=s.textColor,C=void 0===S?"#fff":S,j=s.size,T=void 0===j?n.Medium:j,z=s.style,O=s.bordersRounded,k=void 0!==O&&O,R=s.icon,M=e();return r(t,o({backgroundColor:p?M.colors.shades[50].color:w,borderColor:p?M.colors.shades[50].color:x,size:T,"data-testid":"discount-container",style:z,bordersRounded:k},{children:[R&&i(d,{children:R},void 0),i(c,o({textColor:p?M.colors.shades[250].color:C,size:T,style:o(o({},z),{whiteSpace:"nowrap"}),theme:M},{children:i(a,{discount:v,offText:l,savings:f,showSavings:m,showOnlySavings:g},void 0)}),void 0)]}),void 0)};export{v as DiscountTag,a as SavingsText};
|
|
2
2
|
//# sourceMappingURL=DiscountTag.js.map
|
package/build/index.d.ts
CHANGED
|
@@ -90,6 +90,7 @@ interface DiscountTagProps$1 {
|
|
|
90
90
|
offText: string;
|
|
91
91
|
savings?: string;
|
|
92
92
|
showSavings?: boolean;
|
|
93
|
+
showOnlySavings?: boolean;
|
|
93
94
|
disabled?: boolean;
|
|
94
95
|
backgroundColor?: string;
|
|
95
96
|
borderColor?: string;
|
|
@@ -99,7 +100,7 @@ interface DiscountTagProps$1 {
|
|
|
99
100
|
bordersRounded?: boolean;
|
|
100
101
|
icon?: ReactNode;
|
|
101
102
|
}
|
|
102
|
-
declare const DiscountTag: ({ discount, offText, savings, showSavings, disabled, backgroundColor, borderColor, textColor, size, style, bordersRounded, icon, }: DiscountTagProps$1) => JSX.Element;
|
|
103
|
+
declare const DiscountTag: ({ discount, offText, savings, showSavings, showOnlySavings, disabled, backgroundColor, borderColor, textColor, size, style, bordersRounded, icon, }: DiscountTagProps$1) => JSX.Element;
|
|
103
104
|
|
|
104
105
|
interface PriceLabelProps {
|
|
105
106
|
finalPrice: string | number;
|
|
@@ -3242,6 +3243,8 @@ declare type CommonProps$1<T> = {
|
|
|
3242
3243
|
required?: string;
|
|
3243
3244
|
showRequiredPlaceholder?: boolean;
|
|
3244
3245
|
imageURL?: string;
|
|
3246
|
+
isOpenUpwards?: boolean;
|
|
3247
|
+
maxHeight?: string | number;
|
|
3245
3248
|
};
|
|
3246
3249
|
declare type ControlledProps<T> = {
|
|
3247
3250
|
value: Value<T>;
|
|
@@ -3254,7 +3257,7 @@ declare type UncontrolledProps<T> = {
|
|
|
3254
3257
|
selectedOptionWeight?: number | string;
|
|
3255
3258
|
} & CommonProps$1<T>;
|
|
3256
3259
|
declare type SimpleDropdownProps<T> = UncontrolledProps<T> | ControlledProps<T>;
|
|
3257
|
-
declare function SimpleDropdown<T>({ options, disabled, initialValue, placeHolder, label, wide, sort, onChange, value, testId, required, showRequiredPlaceholder, selectedOptionWeight, }: SimpleDropdownProps<T>): JSX.Element;
|
|
3260
|
+
declare function SimpleDropdown<T>({ options, disabled, initialValue, placeHolder, label, wide, sort, onChange, value, testId, required, showRequiredPlaceholder, selectedOptionWeight, isOpenUpwards, maxHeight, }: SimpleDropdownProps<T>): JSX.Element;
|
|
3258
3261
|
|
|
3259
3262
|
interface FiltersProps {
|
|
3260
3263
|
values: Filter[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var o=require("tslib"),e=require("react/jsx-runtime"),r=require("@emotion/styled"),
|
|
1
|
+
"use strict";var o=require("tslib"),e=require("react/jsx-runtime"),r=require("@emotion/styled"),t=require("../../../core/theme/Theme.js"),n=require("../../shared/select/BaseSelect.js");function s(o){return o&&"object"==typeof o&&"default"in o?o:{default:o}}var i=s(r).default(n.Options)((function(e){var r=e.theme,t=e.isOpenUpwards,n=e.maxHeight;return o.__assign(o.__assign({display:"flex",flexDirection:"column",alignItems:"flex-start",border:"".concat(r.component.dropdown.borderWidth||"0.063rem"," solid ").concat(r.component.dropdown.options.borderColor),boxSizing:"border-box",borderRadius:r.component.dropdown.options.borderRadius,background:r.colors.shades.white.color,fontFamily:r.fonts.config[0].family,padding:0},t?{marginBottom:"0.125rem",bottom:"100%"}:{marginTop:"0.125rem"}),{position:"absolute",width:"100%",color:r.colors.shades[700].color,zIndex:10,overflow:n?"auto":r.component.dropdown.optionsWrapper.overflow,maxHeight:null!=n?n:"unset","&::-webkit-scrollbar":{width:"8px"},"&::-webkit-scrollbar-track":{background:r.colors.shades[50].color,borderRadius:r.component.dropdown.options.borderRadius},"&::-webkit-scrollbar-thumb":{background:r.colors.shades[150].color,borderRadius:r.component.dropdown.options.borderRadius,"&:hover":{background:r.colors.shades[400].color}}})}));module.exports=function(r){var n=r.children,s=r.isOpenUpwards,d=r.maxHeight,a=t.useTheme();return e.jsx(i,o.__assign({theme:a,isOpenUpwards:s,maxHeight:d},{children:n}),void 0)};
|
|
2
2
|
//# sourceMappingURL=BaseDropdownOptions.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("tslib"),n=require("react/jsx-runtime"),i=require("@emotion/styled"),r=require("react"),t=require("../../../icons/index.js"),o=require("../../../input/base/Error.js"),a=require("../../base/BaseDropdown.js");function
|
|
1
|
+
"use strict";var e=require("tslib"),n=require("react/jsx-runtime"),i=require("@emotion/styled"),r=require("react"),t=require("../../../icons/index.js"),o=require("../../../input/base/Error.js"),a=require("../../base/BaseDropdown.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l,d,u,c=s(i),v=c.default.div(l||(l=e.__makeTemplateObject([""],[""]))),g=c.default.p(d||(d=e.__makeTemplateObject(["\n margin: unset;\n &:after {\n content: '*';\n color: var(--colors-semantic-urgent-color);\n }\n"],["\n margin: unset;\n &:after {\n content: '*';\n color: var(--colors-semantic-urgent-color);\n }\n"]))),m=c.default.span(u||(u=e.__makeTemplateObject(["\n font-weight: ",";\n"],["\n font-weight: ",";\n"])),(function(e){return e.fontWeight||""}));module.exports=function(i){var s=i.options,l=i.disabled,d=void 0!==l&&l,u=i.initialValue,c=i.placeHolder,p=i.label,h=i.wide,f=void 0!==h&&h,j=i.sort,b=void 0!==j&&j,x=i.onChange,_=i.value,w=i.testId,O=void 0===w?"simple-dropdown":w,q=i.required,I=i.showRequiredPlaceholder,R=i.selectedOptionWeight,U=i.isOpenUpwards,L=void 0!==U&&U,y=i.maxHeight,C=r.useState(_||u),k=C[0],E=C[1],F=r.useMemo((function(){var e;return k?null!==(e=k.selectedLabel)&&void 0!==e?e:k.label:I?n.jsx(g,{children:c},void 0):c}),[k,I,c]);r.useEffect((function(){null!=_?s.findIndex((function(e){return e.value===_.value}))<0?E(void 0):E(_):u||E(void 0)}),[_,s,u]);var H=I?v:r.Fragment;return n.jsxs(H,{children:[n.jsxs(a,e.__assign({value:k,onChange:function(e){x&&x(e),E(e)},disabled:d,wide:f},{children:[n.jsxs(a.Button,e.__assign({label:p,OpenIcon:t.Icon.Arrows.ChevronDown,CloseIcon:t.Icon.Arrows.ChevronUp,wide:f,isSortOrFilter:b,testId:O},{children:[!!(null==k?void 0:k.imageURL)&&n.jsx("img",{src:k.imageURL,alt:k.label,style:{paddingRight:8}},void 0),R&&d?n.jsx(m,e.__assign({fontWeight:R},{children:F}),void 0):n.jsx(n.Fragment,{children:F},void 0)]}),void 0),n.jsx(a.Options,e.__assign({isOpenUpwards:L,maxHeight:y},{children:s.map((function(i){return n.jsxs(a.Option,e.__assign({value:i,disabled:i.disabled,hasImage:!!i.imageURL},{children:[!!i.imageURL&&n.jsx("img",{src:i.imageURL,alt:i.label,style:{paddingRight:8}},void 0),i.label]}),i.key)}))}),void 0)]}),void 0),!!q&&n.jsx(o.Error,{error:q},void 0)]},void 0)};
|
|
2
2
|
//# sourceMappingURL=SimpleDropdown.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("tslib"),e=require("react/jsx-runtime"),s=require("../../../core/theme/Theme.js"),r=require("../../../types/enums.js"),i=require("./styled.js"),n=function(o){var s=o.discount,r=o.offText,i=o.savings,n=o.showSavings,t=void 0!==n&&n,d=o.showOnlySavings;if(void 0!==d&&d&&i)return e.jsx(e.Fragment,{children:i},void 0);var a="".concat(s,"% ").concat(r),c=t&&i?" - ".concat(i):"";return e.jsx(e.Fragment,{children:"".concat(a).concat(c).trim()},void 0)};exports.DiscountTag=function(t){var d=t.discount,a=t.offText,c=t.savings,v=t.showSavings,l=void 0!==v&&v,u=t.showOnlySavings,g=void 0!==u&&u,h=t.disabled,f=t.backgroundColor,x=void 0===f?"#fff":f,j=t.borderColor,m=void 0===j?"transparent":j,_=t.textColor,b=void 0===_?"#fff":_,p=t.size,y=void 0===p?r.ComponentSize.Medium:p,C=t.style,S=t.bordersRounded,w=void 0!==S&&S,T=t.icon,q=s.useTheme();return e.jsxs(i.Container,o.__assign({backgroundColor:h?q.colors.shades[50].color:x,borderColor:h?q.colors.shades[50].color:m,size:y,"data-testid":"discount-container",style:C,bordersRounded:w},{children:[T&&e.jsx(i.IconContainer,{children:T},void 0),e.jsx(i.H3,o.__assign({textColor:h?q.colors.shades[250].color:b,size:y,style:o.__assign(o.__assign({},C),{whiteSpace:"nowrap"}),theme:q},{children:e.jsx(n,{discount:d,offText:a,savings:c,showSavings:l,showOnlySavings:g},void 0)}),void 0)]}),void 0)},exports.SavingsText=n;
|
|
2
2
|
//# sourceMappingURL=DiscountTag.js.map
|
package/package.json
CHANGED