@trafilea/afrodita-components 6.10.0 → 6.11.1

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/index.js CHANGED
@@ -3377,7 +3377,9 @@ var buildImageUrl = function (_a) {
3377
3377
  var source = "/external/".concat(baseUrl.host.replaceAll('.', ''));
3378
3378
  var width = getValidSize(widthString);
3379
3379
  var height = getValidSize(heightString);
3380
- return "".concat(cdn).concat(source, "/images").concat(baseUrl.pathname, "?width=").concat(width, "&height=").concat(height, "&quality=").concat(quality, "&url=").concat(url);
3380
+ var format = src.includes('.svg') ? '&format=svg' : '';
3381
+ var params = "width=".concat(width, "&height=").concat(height, "&quality=").concat(quality, "&url=").concat(url).concat(format);
3382
+ return "".concat(cdn).concat(source, "/images").concat(baseUrl.pathname, "?").concat(params);
3381
3383
  }
3382
3384
  catch (e) {
3383
3385
  console.warn("[Afrodita][buildImageUrl] [src:".concat(src, "] ERROR:").concat(e));
@@ -4528,38 +4530,6 @@ var decimalFormat = function (number) {
4528
4530
  return number.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
4529
4531
  };
4530
4532
 
4531
- var isEmpty = function (value) {
4532
- return value.length === 0;
4533
- };
4534
- var isEmail = function (value) {
4535
- return /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(value);
4536
- };
4537
- var isNumber$1 = function (value) {
4538
- return /^[0-9]*$/.test(value);
4539
- };
4540
- var isPhoneNumber = function (value) {
4541
- return /^\d{10}$/.test(value);
4542
- };
4543
- var isValidDate = function (value) {
4544
- return /^\d{4}-\d{2}-\d{2}$/.test(value);
4545
- };
4546
-
4547
- var mouseClickEvents = ['mousedown', 'click', 'mouseup'];
4548
- var simulateMouseClick = function (element) {
4549
- mouseClickEvents.forEach(function (mouseEventType) {
4550
- return element.dispatchEvent(new MouseEvent(mouseEventType, {
4551
- view: window,
4552
- bubbles: true,
4553
- cancelable: true,
4554
- buttons: 1,
4555
- }));
4556
- });
4557
- };
4558
-
4559
- var sliceString = function (str, maxLength) {
4560
- return str.length > maxLength ? "".concat(str.slice(0, maxLength), "...") : str;
4561
- };
4562
-
4563
4533
  var getSrcSet = function (imgLink) {
4564
4534
  var breakpoints = [];
4565
4535
  for (var _i = 1; _i < arguments.length; _i++) {
@@ -4655,6 +4625,38 @@ var mediaQueries = index$2(["@media(max-width: 900px)", "@media(min-width: 900px
4655
4625
  literal: true,
4656
4626
  });
4657
4627
 
4628
+ var mouseClickEvents = ['mousedown', 'click', 'mouseup'];
4629
+ var simulateMouseClick = function (element) {
4630
+ mouseClickEvents.forEach(function (mouseEventType) {
4631
+ return element.dispatchEvent(new MouseEvent(mouseEventType, {
4632
+ view: window,
4633
+ bubbles: true,
4634
+ cancelable: true,
4635
+ buttons: 1,
4636
+ }));
4637
+ });
4638
+ };
4639
+
4640
+ var sliceString = function (str, maxLength) {
4641
+ return str.length > maxLength ? "".concat(str.slice(0, maxLength), "...") : str;
4642
+ };
4643
+
4644
+ var isEmpty = function (value) {
4645
+ return value.length === 0;
4646
+ };
4647
+ var isEmail = function (value) {
4648
+ return /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(value);
4649
+ };
4650
+ var isNumber$1 = function (value) {
4651
+ return /^[0-9]*$/.test(value);
4652
+ };
4653
+ var isPhoneNumber = function (value) {
4654
+ return /^\d{10}$/.test(value);
4655
+ };
4656
+ var isValidDate = function (value) {
4657
+ return /^\d{4}-\d{2}-\d{2}$/.test(value);
4658
+ };
4659
+
4658
4660
  var ErrorText = newStyled.h3(templateObject_1$1O || (templateObject_1$1O = __makeTemplateObject(["\n color: ", " !important;\n font-size: 0.75rem;\n font-weight: 600;\n margin: 0;\n font-height: 1rem;\n margin-left: 0.313rem;\n"], ["\n color: ", " !important;\n font-size: 0.75rem;\n font-weight: 600;\n margin: 0;\n font-height: 1rem;\n margin-left: 0.313rem;\n"])), function (props) { return props.color; });
4659
4661
  var ErrorContainer = newStyled.div(templateObject_2$1c || (templateObject_2$1c = __makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-top: 12px;\n"], ["\n display: flex;\n align-items: center;\n margin-top: 12px;\n"])));
4660
4662
  var Error$1 = function (_a) {
@@ -4744,7 +4746,7 @@ var BaseDropdownButton = function (_a) {
4744
4746
  alignItems: 'flex-start',
4745
4747
  whiteSpace: 'nowrap',
4746
4748
  overflowX: 'hidden',
4747
- } }, { children: [jsx("div", __assign$1({ css: { fontSize: '0.75rem', fontWeight: 400, margin: '0.125rem 0' } }, { children: label }), void 0), children] }), void 0)) : (children), jsxs(StyledIcon$1, __assign$1({ open: open }, { children: [jsx(CloseIcon, { testId: "CloseIcon", height: 0.875, width: 0.875, fill: "inherit" }, void 0), jsx(OpenIcon, { testId: "OpenIcon", height: 0.875, width: 0.875, fill: "inherit" }, void 0)] }), void 0)] }), void 0));
4749
+ } }, { children: [jsx("div", __assign$1({ css: { fontSize: '0.75rem', fontWeight: 400, margin: '0.125rem 0' } }, { children: label }), void 0), children] }), void 0)) : (jsx(Fragment, { children: children }, void 0)), jsxs(StyledIcon$1, __assign$1({ open: open }, { children: [jsx(CloseIcon, { testId: "CloseIcon", height: 0.875, width: 0.875, fill: "inherit" }, void 0), jsx(OpenIcon, { testId: "OpenIcon", height: 0.875, width: 0.875, fill: "inherit" }, void 0)] }), void 0)] }), void 0));
4748
4750
  } }), void 0));
4749
4751
  };
4750
4752
  var BaseDropdownButton$1 = React__default["default"].memo(BaseDropdownButton);
@@ -4945,12 +4947,12 @@ var Checkbox = function (_a) {
4945
4947
  var templateObject_1$1L, templateObject_2$1b;
4946
4948
 
4947
4949
  var CustomOption = newStyled.li(function (_a) {
4948
- var theme = _a.theme, selected = _a.selected, active = _a.active;
4950
+ var theme = _a.theme, selected = _a.selected, active = _a.active, hasImage = _a.hasImage;
4949
4951
  return ({
4950
4952
  listStyleType: 'none',
4951
4953
  display: 'flex',
4952
4954
  flexDirection: 'row',
4953
- alignItems: 'flex-start',
4955
+ alignItems: hasImage ? 'center' : 'flex-start',
4954
4956
  margin: 0,
4955
4957
  cursor: 'pointer',
4956
4958
  padding: theme.component.dropdown.optionPadding,
@@ -4965,11 +4967,11 @@ var CustomOption = newStyled.li(function (_a) {
4965
4967
  });
4966
4968
  });
4967
4969
  function BaseDropdownOption(_a) {
4968
- var value = _a.value, disabled = _a.disabled, children = _a.children, _b = _a.hasCheckbox, hasCheckbox = _b === void 0 ? false : _b, isSelected = _a.isSelected;
4970
+ var value = _a.value, disabled = _a.disabled, children = _a.children, _b = _a.hasCheckbox, hasCheckbox = _b === void 0 ? false : _b, isSelected = _a.isSelected, _c = _a.hasImage, hasImage = _c === void 0 ? false : _c;
4969
4971
  var theme = useTheme();
4970
4972
  return (jsxRuntime.jsx(BaseSelect$1.Option, __assign$1({ value: value, disabled: disabled, as: React$2.Fragment }, { children: function (_a) {
4971
4973
  var selected = _a.selected, active = _a.active;
4972
- return (jsxRuntime.jsxs(CustomOption, __assign$1({ theme: theme, selected: isSelected || selected, active: active }, { children: [hasCheckbox && (jsxRuntime.jsx(Checkbox, { checked: isSelected || selected, text: "", id: value.key, onChange: console.log, size: exports.ComponentSize.Small, variant: "primary" }, void 0)), children] }), void 0));
4974
+ return (jsxRuntime.jsxs(CustomOption, __assign$1({ theme: theme, selected: isSelected || selected, active: active, hasImage: hasImage }, { children: [hasCheckbox && (jsxRuntime.jsx(Checkbox, { checked: isSelected || selected, text: "", id: value.key, onChange: console.log, size: exports.ComponentSize.Small, variant: "primary" }, void 0)), children] }), void 0));
4973
4975
  } }), void 0));
4974
4976
  }
4975
4977
 
@@ -5022,7 +5024,7 @@ function SimpleDropdown(_a) {
5022
5024
  setSelectedValue(value);
5023
5025
  }, [value, options, initialValue]);
5024
5026
  var DropdownContainer = showRequiredPlaceholder ? Container$16 : React$2.Fragment;
5025
- return (jsxRuntime.jsxs(DropdownContainer, { children: [jsxRuntime.jsxs(BaseDropdown$1, __assign$1({ value: selectedValue, onChange: onChangeHandler, disabled: disabled, wide: wide }, { children: [jsxRuntime.jsx(BaseDropdown$1.Button, __assign$1({ label: label, OpenIcon: Icon.Arrows.ChevronDown, CloseIcon: Icon.Arrows.ChevronUp, wide: wide, isSortOrFilter: sort, testId: testId }, { children: selectedOptionLabel }), void 0), jsxRuntime.jsx(BaseDropdown$1.Options, { children: options.map(function (item) { return (jsxRuntime.jsx(BaseDropdown$1.Option, __assign$1({ value: item, disabled: item.disabled }, { children: item.label }), item.key)); }) }, void 0)] }), void 0), !!required && jsxRuntime.jsx(Error$1, { error: required }, void 0)] }, void 0));
5027
+ return (jsxRuntime.jsxs(DropdownContainer, { children: [jsxRuntime.jsxs(BaseDropdown$1, __assign$1({ value: selectedValue, onChange: onChangeHandler, disabled: disabled, wide: wide }, { children: [jsxRuntime.jsxs(BaseDropdown$1.Button, __assign$1({ label: label, OpenIcon: Icon.Arrows.ChevronDown, CloseIcon: Icon.Arrows.ChevronUp, wide: wide, isSortOrFilter: sort, testId: testId }, { children: [!!(selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.imageURL) && (jsxRuntime.jsx("img", { src: selectedValue.imageURL, alt: selectedValue.label, style: { paddingRight: 8 } }, void 0)), selectedOptionLabel] }), void 0), jsxRuntime.jsx(BaseDropdown$1.Options, { children: options.map(function (item) { return (jsxRuntime.jsxs(BaseDropdown$1.Option, __assign$1({ value: item, disabled: item.disabled, hasImage: !!item.imageURL }, { children: [!!item.imageURL && (jsxRuntime.jsx("img", { src: item.imageURL, alt: item.label, style: { paddingRight: 8 } }, void 0)), item.label] }), item.key)); }) }, void 0)] }), void 0), !!required && jsxRuntime.jsx(Error$1, { error: required }, void 0)] }, void 0));
5026
5028
  }
5027
5029
  var templateObject_1$1K, templateObject_2$1a;
5028
5030
 
@@ -19951,6 +19953,8 @@ exports.Tooltip = Tooltip;
19951
19953
  exports.Totals = Totals;
19952
19954
  exports.TrackingProgress = TrackingProgress;
19953
19955
  exports.TrackingProgressV2 = TrackingProgressV2;
19956
+ exports.Video = Video$1;
19957
+ exports.buildImageUrl = buildImageUrl;
19954
19958
  exports.componentSizeMapper = componentSizeMapper;
19955
19959
  exports.css = css;
19956
19960
  exports.decimalFormat = decimalFormat;