@citygross/components 0.7.190 → 0.7.192

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.
@@ -5,5 +5,4 @@ export declare type TMaxHeightText = {
5
5
  readLessText?: string;
6
6
  maxHeight: number;
7
7
  };
8
- declare const MaxHeightText: ({ readMoreText, readLessText, maxHeight, children }: TMaxHeightText) => JSX.Element;
9
- export default MaxHeightText;
8
+ export declare function MaxHeightText({ readMoreText, readLessText, maxHeight, children }: TMaxHeightText): JSX.Element;
@@ -1,8 +1,7 @@
1
- /// <reference types="react" />
2
1
  import { TMaxHeightText } from './MaxHeightText';
3
2
  import { Story } from '@storybook/react';
4
3
  declare const _default: {
5
- component: ({ readMoreText, readLessText, maxHeight, children }: TMaxHeightText) => JSX.Element;
4
+ component: any;
6
5
  title: string;
7
6
  };
8
7
  export default _default;
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var styles = require('./styles.js');
7
+ var Link = require('../Links/Link.js');
8
+ var typography = require('@citygross/typography');
9
+
10
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
+
12
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
13
+
14
+ function MaxHeightText(_a) {
15
+ var readMoreText = _a.readMoreText, readLessText = _a.readLessText, maxHeight = _a.maxHeight, children = _a.children;
16
+ var _b = React.useState(false), open = _b[0], setOpen = _b[1];
17
+ return (React__default["default"].createElement(styles.MaxHeightTextWrapper, null,
18
+ React__default["default"].createElement(styles.MaxHeightTextContainer, { maxHeight: open ? undefined : maxHeight },
19
+ children,
20
+ !open && React__default["default"].createElement(styles.MaxHeightTextFader, null)),
21
+ React__default["default"].createElement(Link.Link, { size: typography.TextTypes.TextSize.REGULAR, onClick: function () { return setOpen(!open); } }, open ? readLessText : readMoreText)));
22
+ }
23
+
24
+ exports.MaxHeightText = MaxHeightText;
25
+ //# sourceMappingURL=MaxHeightText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MaxHeightText.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var _tslib = require('../../../../_virtual/_tslib.js');
4
6
  var styled = require('styled-components');
5
7
 
@@ -7,8 +9,12 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
7
9
 
8
10
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
9
11
 
10
- styled__default["default"].div(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"], ["\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"])), function (props) { var _a, _b; return (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.spacings) === null || _b === void 0 ? void 0 : _b.xs; });
11
- styled__default["default"].div(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n max-height: ", ";\n overflow: hidden;\n position: relative;\n"], ["\n max-height: ", ";\n overflow: hidden;\n position: relative;\n"])), function (props) { return ((props === null || props === void 0 ? void 0 : props.maxHeight) ? "".concat(props === null || props === void 0 ? void 0 : props.maxHeight, "px") : 'auto'); });
12
- styled__default["default"].div(templateObject_3 || (templateObject_3 = _tslib.__makeTemplateObject(["\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n height: ", "px;\n background: linear-gradient(\n ", "\n );\n"], ["\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n height: ", "px;\n background: linear-gradient(\n ", "\n );\n"])), function (props) { var _a, _b; return (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.constants) === null || _b === void 0 ? void 0 : _b.maxHeightFaderHeight; }, function (props) { var _a, _b, _c, _d; return "".concat((_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.palette) === null || _b === void 0 ? void 0 : _b.transparent, ", ").concat((_d = (_c = props.theme) === null || _c === void 0 ? void 0 : _c.palette) === null || _d === void 0 ? void 0 : _d.lightest); });
12
+ var MaxHeightTextWrapper = styled__default["default"].div(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"], ["\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"])), function (props) { var _a, _b; return (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.spacings) === null || _b === void 0 ? void 0 : _b.xs; });
13
+ var MaxHeightTextContainer = styled__default["default"].div(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n max-height: ", ";\n overflow: hidden;\n position: relative;\n"], ["\n max-height: ", ";\n overflow: hidden;\n position: relative;\n"])), function (props) { return ((props === null || props === void 0 ? void 0 : props.maxHeight) ? "".concat(props === null || props === void 0 ? void 0 : props.maxHeight, "px") : 'auto'); });
14
+ var MaxHeightTextFader = styled__default["default"].div(templateObject_3 || (templateObject_3 = _tslib.__makeTemplateObject(["\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n height: ", "px;\n background: linear-gradient(\n ", "\n );\n"], ["\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n height: ", "px;\n background: linear-gradient(\n ", "\n );\n"])), function (props) { var _a, _b; return (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.constants) === null || _b === void 0 ? void 0 : _b.maxHeightFaderHeight; }, function (props) { var _a, _b, _c, _d; return "".concat((_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.palette) === null || _b === void 0 ? void 0 : _b.transparent, ", ").concat((_d = (_c = props.theme) === null || _c === void 0 ? void 0 : _c.palette) === null || _d === void 0 ? void 0 : _d.lightest); });
13
15
  var templateObject_1, templateObject_2, templateObject_3;
16
+
17
+ exports.MaxHeightTextContainer = MaxHeightTextContainer;
18
+ exports.MaxHeightTextFader = MaxHeightTextFader;
19
+ exports.MaxHeightTextWrapper = MaxHeightTextWrapper;
14
20
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
@@ -79,9 +79,7 @@ var MenuListItem = require('./components/MenuListItem/MenuListItem.js');
79
79
  var SlideInOutContainer = require('./components/SlideInOutContainer/SlideInOutContainer.js');
80
80
  var SearchSuggestionChip = require('./components/SearchSuggestionChip/SearchSuggestionChip.js');
81
81
  var ZipCodeInput = require('./components/ZipCodeInput/ZipCodeInput.js');
82
- require('react');
83
- require('./components/MaxHeightText/styles.js');
84
- require('@citygross/typography');
82
+ var MaxHeightText = require('./components/MaxHeightText/MaxHeightText.js');
85
83
 
86
84
 
87
85
 
@@ -193,4 +191,5 @@ exports.MenuListItem = MenuListItem.MenuListItem;
193
191
  exports.SlideInOutContainer = SlideInOutContainer.SlideInOutContainer;
194
192
  exports.SearchSuggestionChip = SearchSuggestionChip.SearchSuggestionChip;
195
193
  exports.ZipCodeInput = ZipCodeInput.ZipCodeInput;
194
+ exports.MaxHeightText = MaxHeightText.MaxHeightText;
196
195
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -343,6 +343,31 @@ function useWindowSize() {
343
343
  return { width: windowSize.width, height: windowSize.height };
344
344
  }
345
345
 
346
+ function comparisonTypes(type) {
347
+ switch (type) {
348
+ case 'KGM':
349
+ return 'kg';
350
+ case 'G':
351
+ return 'g';
352
+ case 'LTR':
353
+ return 'l';
354
+ case 'PCE':
355
+ return 'st';
356
+ case 'H87':
357
+ return 'st';
358
+ case 'm':
359
+ return 'm';
360
+ case 'MM':
361
+ return 'm';
362
+ case 'MTR':
363
+ return 'm';
364
+ case 'DSK':
365
+ return 'disk';
366
+ case 'TVA':
367
+ return 'tvätt';
368
+ }
369
+ }
370
+
346
371
  var phoneRegex = /^[0-9]{7,14}$/;
347
372
  var nameRegex = /^[a-ö, A-Ö]$/;
348
373
  var zipRegex = /(^\d{5}$)|(^\d{3} \d{2}$)/;
@@ -18618,6 +18643,7 @@ var Locale;
18618
18643
  moment.locale(Locale.swedish);
18619
18644
 
18620
18645
  index.__exports.capitalizeFirstLetter = capitalizeFirstLetter;
18646
+ index.__exports.comparisonTypes = comparisonTypes;
18621
18647
  index.__exports.emailRegex = emailRegex;
18622
18648
  index.__exports.formatPrice = formatPrice;
18623
18649
  index.__exports.formatPriceWithDecimalsReduced = formatPriceWithDecimalsReduced;