@citygross/components 0.12.9 → 0.13.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.
@@ -4,5 +4,6 @@ export declare type TLayoutBox = {
4
4
  borderRadius?: number;
5
5
  shadowInset?: boolean;
6
6
  showOverflow?: boolean;
7
+ noShadow?: boolean;
7
8
  };
8
9
  export declare const LayoutBox: React.FunctionComponent<TLayoutBox>;
@@ -4,6 +4,7 @@ declare type TLayoutBoxContainer = {
4
4
  borderRadius?: number;
5
5
  shadowInset?: boolean;
6
6
  showOverflow?: boolean;
7
+ noShadow?: boolean;
7
8
  };
8
9
  export declare const LayoutBoxContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TLayoutBoxContainer, never>;
9
10
  export {};
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { TQuantitySelector } from './QuantitySelector.types';
3
- export declare function QuantitySelector({ maxQuantity, onAdd, onBlur, onChange, onSubtract, productName, quantity, size }: TQuantitySelector): JSX.Element;
3
+ export declare const QuantitySelector: ({ maxQuantity, onAdd, onBlur, onChange, onSubtract, productId, productName, quantity, size }: TQuantitySelector) => JSX.Element;
@@ -10,6 +10,7 @@ export declare type TQuantitySelector = {
10
10
  onBlur: () => void;
11
11
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
12
12
  onSubtract: () => void;
13
+ productId: string;
13
14
  productName?: string;
14
15
  quantity: number;
15
16
  size?: EQuantitySelectorSize;
@@ -10,8 +10,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
10
10
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
11
11
 
12
12
  var LayoutBox = function (_a) {
13
- var background = _a.background, borderRadius = _a.borderRadius, shadowInset = _a.shadowInset, showOverflow = _a.showOverflow, children = _a.children;
14
- return (React__default["default"].createElement(LayoutBox_styles.LayoutBoxContainer, { borderRadius: borderRadius, shadowInset: shadowInset, background: background || '#fff', showOverflow: showOverflow }, children));
13
+ var background = _a.background, borderRadius = _a.borderRadius, shadowInset = _a.shadowInset, showOverflow = _a.showOverflow, noShadow = _a.noShadow, children = _a.children;
14
+ return (React__default["default"].createElement(LayoutBox_styles.LayoutBoxContainer, { borderRadius: borderRadius, shadowInset: shadowInset, background: background || '#fff', showOverflow: showOverflow, noShadow: noShadow }, children));
15
15
  };
16
16
 
17
17
  exports.LayoutBox = LayoutBox;
@@ -11,9 +11,11 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
11
11
 
12
12
  var LayoutBoxContainer = styled__default["default"].div(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n background: ", ";\n box-shadow: ", ";\n overflow: ", ";\n @media (min-width: ", "px) {\n border-radius: ", "px;\n }\n"], ["\n background: ", ";\n box-shadow: ", ";\n overflow: ", ";\n @media (min-width: ", "px) {\n border-radius: ", "px;\n }\n"])), function (props) { return props.background; }, function (props) {
13
13
  var _a, _b, _c, _d;
14
- return props.shadowInset
15
- ? (_b = (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.boxShadow) === null || _b === void 0 ? void 0 : _b.layoutShadowInset
16
- : (_d = (_c = props.theme.attributes) === null || _c === void 0 ? void 0 : _c.boxShadow) === null || _d === void 0 ? void 0 : _d.layoutShadow;
14
+ return props.noShadow
15
+ ? 'none'
16
+ : props.shadowInset
17
+ ? (_b = (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.boxShadow) === null || _b === void 0 ? void 0 : _b.layoutShadowInset
18
+ : (_d = (_c = props.theme.attributes) === null || _c === void 0 ? void 0 : _c.boxShadow) === null || _d === void 0 ? void 0 : _d.layoutShadow;
17
19
  }, function (props) { return (props.showOverflow ? 'visible' : 'hidden'); }, function (props) { var _a; return (_a = props.theme.breakpoints) === null || _a === void 0 ? void 0 : _a.lg; }, function (props) { var _a; return props.borderRadius || ((_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.borderRadius.small); });
18
20
  var templateObject_1;
19
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutBox.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"LayoutBox.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
@@ -13,9 +13,9 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
13
13
 
14
14
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
15
15
 
16
- function QuantitySelector(_a) {
16
+ var QuantitySelector = function (_a) {
17
17
  var _b, _c, _d, _e;
18
- var maxQuantity = _a.maxQuantity, onAdd = _a.onAdd, onBlur = _a.onBlur, onChange = _a.onChange, onSubtract = _a.onSubtract, productName = _a.productName, quantity = _a.quantity, _f = _a.size, size = _f === void 0 ? QuantitySelector_types.EQuantitySelectorSize.large : _f;
18
+ var maxQuantity = _a.maxQuantity, onAdd = _a.onAdd, onBlur = _a.onBlur, onChange = _a.onChange, onSubtract = _a.onSubtract, productId = _a.productId, productName = _a.productName, quantity = _a.quantity, _f = _a.size, size = _f === void 0 ? QuantitySelector_types.EQuantitySelectorSize.large : _f;
19
19
  var _g = React.useState(false), isFocused = _g[0], setIsFocused = _g[1];
20
20
  var disabledAdd = quantity >= maxQuantity;
21
21
  var disabledSubtract = quantity <= 0;
@@ -37,10 +37,10 @@ function QuantitySelector(_a) {
37
37
  React__default["default"].createElement(QuantitySelector_styles.Label, null,
38
38
  React__default["default"].createElement(ScreenReader.ScreenReader, { string: "Ange antal" }),
39
39
  quantity === maxQuantity && !isFocused && (React__default["default"].createElement("span", { "aria-label": "Max antal ".concat(maxQuantity), "aria-live": "polite", role: "status" }, "Max")),
40
- React__default["default"].createElement(QuantitySelector_styles.Input, { id: "quantity-input", inputMode: "numeric", isMaxQuantity: quantity === maxQuantity && !isFocused, max: maxQuantity, min: 0, onBlur: handleBlur, onChange: function (e) { return onChange(e); }, onFocus: function () { return setIsFocused(true); }, onKeyDown: handleKeyDown, pattern: "[0-9]*", type: "number", value: quantity })),
40
+ React__default["default"].createElement(QuantitySelector_styles.Input, { id: "quantity-input-".concat(productId), inputMode: "numeric", isMaxQuantity: quantity === maxQuantity && !isFocused, max: maxQuantity, min: 0, onBlur: handleBlur, onChange: function (e) { return onChange(e); }, onFocus: function () { return setIsFocused(true); }, onKeyDown: handleKeyDown, pattern: "[0-9]*", type: "number", value: quantity })),
41
41
  React__default["default"].createElement(QuantitySelector_styles.StepButton, { "aria-label": "\u00D6ka antal ".concat(productName || ''), direction: "add", disabled: disabledAdd, onClick: onAdd },
42
42
  React__default["default"].createElement(icons.Icons.Plus, { color: disabledAdd ? (_d = designTokens.theme.palette) === null || _d === void 0 ? void 0 : _d.placeholder : (_e = designTokens.theme.palette) === null || _e === void 0 ? void 0 : _e.darkest, height: 16, width: 16 }))));
43
- }
43
+ };
44
44
 
45
45
  exports.QuantitySelector = QuantitySelector;
46
46
  //# sourceMappingURL=QuantitySelector.js.map
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import { LayoutBoxContainer } from './LayoutBox.styles.js';
3
3
 
4
4
  var LayoutBox = function (_a) {
5
- var background = _a.background, borderRadius = _a.borderRadius, shadowInset = _a.shadowInset, showOverflow = _a.showOverflow, children = _a.children;
6
- return (React.createElement(LayoutBoxContainer, { borderRadius: borderRadius, shadowInset: shadowInset, background: background || '#fff', showOverflow: showOverflow }, children));
5
+ var background = _a.background, borderRadius = _a.borderRadius, shadowInset = _a.shadowInset, showOverflow = _a.showOverflow, noShadow = _a.noShadow, children = _a.children;
6
+ return (React.createElement(LayoutBoxContainer, { borderRadius: borderRadius, shadowInset: shadowInset, background: background || '#fff', showOverflow: showOverflow, noShadow: noShadow }, children));
7
7
  };
8
8
 
9
9
  export { LayoutBox };
@@ -3,9 +3,11 @@ import styled from 'styled-components';
3
3
 
4
4
  var LayoutBoxContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: ", ";\n box-shadow: ", ";\n overflow: ", ";\n @media (min-width: ", "px) {\n border-radius: ", "px;\n }\n"], ["\n background: ", ";\n box-shadow: ", ";\n overflow: ", ";\n @media (min-width: ", "px) {\n border-radius: ", "px;\n }\n"])), function (props) { return props.background; }, function (props) {
5
5
  var _a, _b, _c, _d;
6
- return props.shadowInset
7
- ? (_b = (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.boxShadow) === null || _b === void 0 ? void 0 : _b.layoutShadowInset
8
- : (_d = (_c = props.theme.attributes) === null || _c === void 0 ? void 0 : _c.boxShadow) === null || _d === void 0 ? void 0 : _d.layoutShadow;
6
+ return props.noShadow
7
+ ? 'none'
8
+ : props.shadowInset
9
+ ? (_b = (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.boxShadow) === null || _b === void 0 ? void 0 : _b.layoutShadowInset
10
+ : (_d = (_c = props.theme.attributes) === null || _c === void 0 ? void 0 : _c.boxShadow) === null || _d === void 0 ? void 0 : _d.layoutShadow;
9
11
  }, function (props) { return (props.showOverflow ? 'visible' : 'hidden'); }, function (props) { var _a; return (_a = props.theme.breakpoints) === null || _a === void 0 ? void 0 : _a.lg; }, function (props) { var _a; return props.borderRadius || ((_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.borderRadius.small); });
10
12
  var templateObject_1;
11
13
 
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutBox.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
1
+ {"version":3,"file":"LayoutBox.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
@@ -5,9 +5,9 @@ import { theme } from '@citygross/design-tokens';
5
5
  import { EQuantitySelectorSize } from './QuantitySelector.types.js';
6
6
  import { ScreenReader } from '../ScreenReader/ScreenReader.js';
7
7
 
8
- function QuantitySelector(_a) {
8
+ var QuantitySelector = function (_a) {
9
9
  var _b, _c, _d, _e;
10
- var maxQuantity = _a.maxQuantity, onAdd = _a.onAdd, onBlur = _a.onBlur, onChange = _a.onChange, onSubtract = _a.onSubtract, productName = _a.productName, quantity = _a.quantity, _f = _a.size, size = _f === void 0 ? EQuantitySelectorSize.large : _f;
10
+ var maxQuantity = _a.maxQuantity, onAdd = _a.onAdd, onBlur = _a.onBlur, onChange = _a.onChange, onSubtract = _a.onSubtract, productId = _a.productId, productName = _a.productName, quantity = _a.quantity, _f = _a.size, size = _f === void 0 ? EQuantitySelectorSize.large : _f;
11
11
  var _g = useState(false), isFocused = _g[0], setIsFocused = _g[1];
12
12
  var disabledAdd = quantity >= maxQuantity;
13
13
  var disabledSubtract = quantity <= 0;
@@ -29,10 +29,10 @@ function QuantitySelector(_a) {
29
29
  React.createElement(Label, null,
30
30
  React.createElement(ScreenReader, { string: "Ange antal" }),
31
31
  quantity === maxQuantity && !isFocused && (React.createElement("span", { "aria-label": "Max antal ".concat(maxQuantity), "aria-live": "polite", role: "status" }, "Max")),
32
- React.createElement(Input, { id: "quantity-input", inputMode: "numeric", isMaxQuantity: quantity === maxQuantity && !isFocused, max: maxQuantity, min: 0, onBlur: handleBlur, onChange: function (e) { return onChange(e); }, onFocus: function () { return setIsFocused(true); }, onKeyDown: handleKeyDown, pattern: "[0-9]*", type: "number", value: quantity })),
32
+ React.createElement(Input, { id: "quantity-input-".concat(productId), inputMode: "numeric", isMaxQuantity: quantity === maxQuantity && !isFocused, max: maxQuantity, min: 0, onBlur: handleBlur, onChange: function (e) { return onChange(e); }, onFocus: function () { return setIsFocused(true); }, onKeyDown: handleKeyDown, pattern: "[0-9]*", type: "number", value: quantity })),
33
33
  React.createElement(StepButton, { "aria-label": "\u00D6ka antal ".concat(productName || ''), direction: "add", disabled: disabledAdd, onClick: onAdd },
34
34
  React.createElement(Icons.Plus, { color: disabledAdd ? (_d = theme.palette) === null || _d === void 0 ? void 0 : _d.placeholder : (_e = theme.palette) === null || _e === void 0 ? void 0 : _e.darkest, height: 16, width: 16 }))));
35
- }
35
+ };
36
36
 
37
37
  export { QuantitySelector };
38
38
  //# sourceMappingURL=QuantitySelector.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citygross/components",
3
- "version": "0.12.9",
3
+ "version": "0.13.1",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "./build/cjs/components/src/index.js",
@@ -75,5 +75,5 @@
75
75
  "react-slick": "^0.30.1",
76
76
  "slick-carousel": "^1.8.1"
77
77
  },
78
- "gitHead": "b5a2e8c97086fa86291429b9a6cd117d82c7a87d"
78
+ "gitHead": "81e9038ba3f6c7f485f556dd2db33a4dce1361d6"
79
79
  }