@citygross/components 0.8.117 → 0.8.118

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.
Files changed (34) hide show
  1. package/build/@types/components/QuantitySelector/QuantitySelector.d.ts +3 -11
  2. package/build/@types/components/QuantitySelector/QuantitySelector.styles.d.ts +10 -8
  3. package/build/@types/components/QuantitySelector/QuantitySelector.types.d.ts +20 -0
  4. package/build/@types/helpers/quantity-selector.d.ts +2 -0
  5. package/build/@types/index.d.ts +1 -0
  6. package/build/cjs/components/src/components/AddressBlock/AddressBlock.js +1 -0
  7. package/build/cjs/components/src/components/AddressBlock/AddressBlock.js.map +1 -1
  8. package/build/cjs/components/src/components/QuantitySelector/QuantitySelector.js +32 -35
  9. package/build/cjs/components/src/components/QuantitySelector/QuantitySelector.js.map +1 -1
  10. package/build/cjs/components/src/components/QuantitySelector/QuantitySelector.styles.js +32 -15
  11. package/build/cjs/components/src/components/QuantitySelector/QuantitySelector.styles.js.map +1 -1
  12. package/build/cjs/components/src/components/QuantitySelector/QuantitySelector.types.js +11 -0
  13. package/build/cjs/components/src/components/QuantitySelector/QuantitySelector.types.js.map +1 -0
  14. package/build/cjs/components/src/components/WarningLabel/WarningLabel.js +1 -0
  15. package/build/cjs/components/src/components/WarningLabel/WarningLabel.js.map +1 -1
  16. package/build/cjs/components/src/helpers/quantity-selector.js +27 -0
  17. package/build/cjs/components/src/helpers/quantity-selector.js.map +1 -0
  18. package/build/cjs/components/src/index.js +5 -0
  19. package/build/cjs/components/src/index.js.map +1 -1
  20. package/build/es/components/src/components/AddressBlock/AddressBlock.js +1 -0
  21. package/build/es/components/src/components/AddressBlock/AddressBlock.js.map +1 -1
  22. package/build/es/components/src/components/QuantitySelector/QuantitySelector.js +33 -36
  23. package/build/es/components/src/components/QuantitySelector/QuantitySelector.js.map +1 -1
  24. package/build/es/components/src/components/QuantitySelector/QuantitySelector.styles.js +29 -12
  25. package/build/es/components/src/components/QuantitySelector/QuantitySelector.styles.js.map +1 -1
  26. package/build/es/components/src/components/QuantitySelector/QuantitySelector.types.js +9 -0
  27. package/build/es/components/src/components/QuantitySelector/QuantitySelector.types.js.map +1 -0
  28. package/build/es/components/src/components/WarningLabel/WarningLabel.js +1 -0
  29. package/build/es/components/src/components/WarningLabel/WarningLabel.js.map +1 -1
  30. package/build/es/components/src/helpers/quantity-selector.js +23 -0
  31. package/build/es/components/src/helpers/quantity-selector.js.map +1 -0
  32. package/build/es/components/src/index.js +1 -0
  33. package/build/es/components/src/index.js.map +1 -1
  34. package/package.json +2 -2
@@ -1,11 +1,3 @@
1
- import React from 'react';
2
- export declare type TQuantitySelector = {
3
- onAdd: () => void;
4
- onSubtract: () => void;
5
- onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
6
- maxValue: number;
7
- value: number;
8
- inCart?: boolean;
9
- onBlur: () => void;
10
- };
11
- export declare function QuantitySelector({ onAdd, onSubtract, onChange, maxValue, value, onBlur }: TQuantitySelector): JSX.Element;
1
+ /// <reference types="react" />
2
+ import { TQuantitySelector } from './QuantitySelector.types';
3
+ export declare function QuantitySelector({ maxQuantity, onAdd, onBlur, onChange, onSubtract, productName, quantity, size }: TQuantitySelector): JSX.Element;
@@ -1,11 +1,13 @@
1
- declare type TQuantityButton = {
2
- direction: 'left' | 'right';
1
+ import { TQuantitySelector } from './QuantitySelector.types';
2
+ declare type TContainer = Pick<TQuantitySelector, 'size'>;
3
+ export declare const Container: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TContainer, never>;
4
+ declare type TStepButton = {
5
+ direction: 'add' | 'subtract';
3
6
  };
4
- declare type TQuanityInput = {
5
- customFocus: boolean;
7
+ export declare const StepButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, TStepButton, never>;
8
+ export declare const Label: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, {}, never>;
9
+ declare type TInput = {
10
+ isMaxQuantity?: boolean;
6
11
  };
7
- export declare const QuantitySelectorContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
8
- export declare const QuantityButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, TQuantityButton, never>;
9
- export declare const QuantityInput: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, TQuanityInput, never>;
10
- export declare const IconContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
12
+ export declare const Input: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, TInput, never>;
11
13
  export {};
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ export declare enum EQuantitySelectorSize {
3
+ dynamic = "dynamic",
4
+ small = "small",
5
+ large = "large"
6
+ }
7
+ export declare type TQuantitySelector = {
8
+ maxQuantity: number;
9
+ onAdd: () => void;
10
+ onBlur: () => void;
11
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
12
+ onSubtract: () => void;
13
+ productName?: string;
14
+ quantity: number;
15
+ size?: EQuantitySelectorSize;
16
+ };
17
+ export declare type TQuantitySelectorSizeAttributes = {
18
+ fontSize?: number;
19
+ height?: number;
20
+ };
@@ -0,0 +1,2 @@
1
+ import { EQuantitySelectorSize, TQuantitySelectorSizeAttributes } from '../components/QuantitySelector/QuantitySelector.types';
2
+ export declare const getQuantitySelectorSizeAttributes: (size?: EQuantitySelectorSize) => TQuantitySelectorSizeAttributes;
@@ -59,6 +59,7 @@ export * from './components/PriceTag/PriceTag.types';
59
59
  export * from './components/ProductHeader/ProductHeader';
60
60
  export * from './components/ProgressBar/ProgressBar';
61
61
  export * from './components/QuantitySelector/QuantitySelector';
62
+ export * from './components/QuantitySelector/QuantitySelector.types';
62
63
  export * from './components/RadioBox';
63
64
  export * from './components/RadioGroup';
64
65
  export * from './components/RadioListItem/RadioListItem';
@@ -76,6 +76,7 @@ require('../PriceTag/PriceTag.styles.js');
76
76
  require('../ProductHeader/ProductHeader.js');
77
77
  require('../ProgressBar/ProgressBar.styled.js');
78
78
  require('../QuantitySelector/QuantitySelector.styles.js');
79
+ require('../QuantitySelector/QuantitySelector.types.js');
79
80
  require('../RadioBox/RadioBoxItem.styles.js');
80
81
  require('../RadioBox/RadioBoxList.styles.js');
81
82
  require('../RadioGroup/RadioGroup.styles.js');
@@ -1 +1 @@
1
- {"version":3,"file":"AddressBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"AddressBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -3,48 +3,45 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
- var QuantitySelector_styles = require('./QuantitySelector.styles.js');
7
6
  var icons = require('@citygross/icons');
7
+ var QuantitySelector_styles = require('./QuantitySelector.styles.js');
8
+ var designTokens = require('@citygross/design-tokens');
9
+ var QuantitySelector_types = require('./QuantitySelector.types.js');
8
10
 
9
11
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
12
 
11
13
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
14
 
13
15
  function QuantitySelector(_a) {
14
- var onAdd = _a.onAdd, onSubtract = _a.onSubtract, onChange = _a.onChange, maxValue = _a.maxValue, value = _a.value, onBlur = _a.onBlur;
15
- var _b = React.useState(false), customFocus = _b[0], setCustomFocus = _b[1];
16
- var inputRef = React.useRef(null);
17
- return (React__default["default"].createElement(QuantitySelector_styles.QuantitySelectorContainer, null,
18
- React__default["default"].createElement(QuantitySelector_styles.QuantityButton, { direction: "left", disabled: value <= 0, onClick: onSubtract, tabIndex: -1 },
19
- React__default["default"].createElement(QuantitySelector_styles.IconContainer, null,
20
- React__default["default"].createElement(icons.Icons.Minus, { width: 16, height: 16 }))),
21
- React__default["default"].createElement(QuantitySelector_styles.QuantityInput, { customFocus: customFocus, max: maxValue, value: value, ref: inputRef, type: "number", pattern: "[0-9]*", onMouseDown: function () {
22
- setCustomFocus(true);
23
- }, onClick: function () {
24
- if (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) {
25
- inputRef.current.select();
26
- }
27
- }, onFocus: function () {
28
- if (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) {
29
- inputRef.current.select();
30
- }
31
- }, onKeyDown: function (event) {
32
- if (event.key === ',' || event.key === '.') {
33
- event.preventDefault();
34
- }
35
- if (event.key === 'Enter' || event.key === 'Escape') {
36
- event.currentTarget.blur();
37
- }
38
- }, onBlur: function () {
39
- onBlur && onBlur();
40
- setCustomFocus(false);
41
- }, onChange: function (e) {
42
- console.log(e.target.value);
43
- onChange(e);
44
- } }),
45
- React__default["default"].createElement(QuantitySelector_styles.QuantityButton, { direction: "right", disabled: value >= maxValue, onClick: onAdd, tabIndex: -1 },
46
- React__default["default"].createElement(QuantitySelector_styles.IconContainer, null,
47
- React__default["default"].createElement(icons.Icons.Plus, { width: 16, height: 16 })))));
16
+ var _b, _c, _d, _e;
17
+ 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 _g = React.useState(false), isFocused = _g[0], setIsFocused = _g[1];
19
+ var disabledAdd = quantity >= maxQuantity;
20
+ var disabledSubtract = quantity <= 0;
21
+ var handleBlur = function () {
22
+ setIsFocused(false);
23
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur();
24
+ };
25
+ var handleKeyDown = function (e) {
26
+ if (e.key === ',' ||
27
+ e.key === '.' ||
28
+ (e.currentTarget.value.length >= 2 && /^[0-9]$/.test(e.key))) {
29
+ e.preventDefault();
30
+ }
31
+ if (e.key === 'Enter' || e.key === 'Escape') {
32
+ e.currentTarget.blur();
33
+ }
34
+ };
35
+ return (React__default["default"].createElement(QuantitySelector_styles.Container, { size: size },
36
+ React__default["default"].createElement(QuantitySelector_styles.StepButton, { "aria-label": "Minska antal ".concat(productName || ''), direction: "subtract", disabled: disabledSubtract, onClick: onSubtract },
37
+ React__default["default"].createElement(icons.Icons.Minus, { color: disabledSubtract
38
+ ? (_b = designTokens.theme.palette) === null || _b === void 0 ? void 0 : _b.placeholder
39
+ : (_c = designTokens.theme.palette) === null || _c === void 0 ? void 0 : _c.darkest, height: 16, width: 16 })),
40
+ React__default["default"].createElement(QuantitySelector_styles.Label, null,
41
+ quantity === maxQuantity && !isFocused && (React__default["default"].createElement("span", { "aria-label": "Max antal ".concat(maxQuantity), "aria-live": "polite", role: "status" }, "Max")),
42
+ React__default["default"].createElement(QuantitySelector_styles.Input, { "aria-label": "Ange antal", 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 })),
43
+ React__default["default"].createElement(QuantitySelector_styles.StepButton, { "aria-label": "\u00D6ka antal ".concat(productName || ''), direction: "add", disabled: disabledAdd, onClick: onAdd },
44
+ 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 }))));
48
45
  }
49
46
 
50
47
  exports.QuantitySelector = QuantitySelector;
@@ -1 +1 @@
1
- {"version":3,"file":"QuantitySelector.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"QuantitySelector.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -4,26 +4,43 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _tslib = require('../../../../_virtual/_tslib.js');
6
6
  var styled = require('styled-components');
7
- var global_styles = require('../../shared/global.styles.js');
7
+ var designTokens = require('@citygross/design-tokens');
8
+ var QuantitySelector_types = require('./QuantitySelector.types.js');
9
+ var quantitySelector = require('../../helpers/quantity-selector.js');
8
10
 
9
11
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
12
 
11
13
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
12
14
 
13
- var quantityButton = styled.css(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n cursor: pointer;\n &:disabled {\n background-color: ", ";\n opacity: 0.5;\n cursor: default;\n }\n\n &:hover {\n background-color: ", ";\n }\n\n &:active {\n background-color: ", ";\n }\n"], ["\n cursor: pointer;\n &:disabled {\n background-color: ", ";\n opacity: 0.5;\n cursor: default;\n }\n\n &:hover {\n background-color: ", ";\n }\n\n &:active {\n background-color: ", ";\n }\n"])), function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.lighter; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.lightest; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.lighter; });
14
- var border = styled.css(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n border: 1px solid ", ";\n"], ["\n border: 1px solid ", ";\n"])), function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.disabledGray; });
15
- var borderRadiusLeft = styled.css(templateObject_3 || (templateObject_3 = _tslib.__makeTemplateObject(["\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n border-right: none;\n"], ["\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n border-right: none;\n"])), function (props) { var _a; return (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.borderRadius.small; }, function (props) { var _a; return (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.borderRadius.small; });
16
- var borderRadiusRight = styled.css(templateObject_4 || (templateObject_4 = _tslib.__makeTemplateObject(["\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n border-left: none;\n"], ["\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n border-left: none;\n"])), function (props) { var _a; return (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.borderRadius.small; }, function (props) { var _a; return (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.borderRadius.small; });
17
- var QuantitySelectorContainer = styled__default["default"].div(templateObject_5 || (templateObject_5 = _tslib.__makeTemplateObject(["\n display: grid;\n grid-template-columns: 40px 48px 40px;\n height: 40px;\n background: ", ";\n width: 128px;\n\n @media (min-width: ", "px) {\n grid-template-columns: 32px 40px 32px;\n width: 104px;\n height: 32px;\n }\n"], ["\n display: grid;\n grid-template-columns: 40px 48px 40px;\n height: 40px;\n background: ", ";\n width: 128px;\n\n @media (min-width: ", "px) {\n grid-template-columns: 32px 40px 32px;\n width: 104px;\n height: 32px;\n }\n"])), function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.transparent; }, function (props) { var _a; return (_a = props.theme.breakpoints) === null || _a === void 0 ? void 0 : _a.sm; });
18
- var QuantityButton = styled__default["default"].button(templateObject_6 || (templateObject_6 = _tslib.__makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ", ";\n ", "\n ", "\n ", "\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ", ";\n ", "\n ", "\n ", "\n"])), function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.white; }, quantityButton, border, function (props) {
19
- return props.direction === 'left' ? borderRadiusLeft : borderRadiusRight;
15
+ var _a, _b, _c, _d, _e, _f, _g, _h;
16
+ var border = styled.css(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n border: 1px solid ", ";\n"], ["\n border: 1px solid ", ";\n"])), (_a = designTokens.theme.palette) === null || _a === void 0 ? void 0 : _a.placeholder);
17
+ var borderRadiusLeft = styled.css(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n border-right: none;\n"], ["\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n border-right: none;\n"])), (_b = designTokens.theme.attributes) === null || _b === void 0 ? void 0 : _b.borderRadius.small, (_c = designTokens.theme.attributes) === null || _c === void 0 ? void 0 : _c.borderRadius.small);
18
+ var borderRadiusRight = styled.css(templateObject_3 || (templateObject_3 = _tslib.__makeTemplateObject(["\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n border-left: none;\n"], ["\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n border-left: none;\n"])), (_d = designTokens.theme.attributes) === null || _d === void 0 ? void 0 : _d.borderRadius.small, (_e = designTokens.theme.attributes) === null || _e === void 0 ? void 0 : _e.borderRadius.small);
19
+ var Container = styled__default["default"].div(templateObject_6 || (templateObject_6 = _tslib.__makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
20
+ var _b;
21
+ var size = _a.size;
22
+ var resolvedSize = size === QuantitySelector_types.EQuantitySelectorSize.dynamic
23
+ ? QuantitySelector_types.EQuantitySelectorSize.small
24
+ : size;
25
+ var _c = quantitySelector.getQuantitySelectorSizeAttributes(resolvedSize), fontSize = _c.fontSize, height = _c.height;
26
+ var largeSize = quantitySelector.getQuantitySelectorSizeAttributes(QuantitySelector_types.EQuantitySelectorSize.large);
27
+ return styled.css(templateObject_5 || (templateObject_5 = _tslib.__makeTemplateObject(["\n display: grid;\n font-size: ", "px;\n grid-template-columns: ", "px 1fr ", "px;\n height: ", "px;\n\n ", "\n "], ["\n display: grid;\n font-size: ", "px;\n grid-template-columns: ", "px 1fr ", "px;\n height: ", "px;\n\n ", "\n "])), fontSize, height, height, height, size === QuantitySelector_types.EQuantitySelectorSize.dynamic && styled.css(templateObject_4 || (templateObject_4 = _tslib.__makeTemplateObject(["\n @media (max-width: ", "px) {\n font-size: ", "px;\n grid-template-columns: ", "px 1fr ", "px;\n height: ", "px;\n }\n "], ["\n @media (max-width: ", "px) {\n font-size: ", "px;\n grid-template-columns: ", "px 1fr ", "px;\n height: ", "px;\n }\n "])), (_b = designTokens.theme.breakpoints) === null || _b === void 0 ? void 0 : _b.sm, largeSize.fontSize, largeSize.height, largeSize.height, largeSize.height));
20
28
  });
21
- var QuantityInput = styled__default["default"].input(templateObject_7 || (templateObject_7 = _tslib.__makeTemplateObject(["\n ", "\n z-index: 1;\n text-align: center;\n border-radius: 0;\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n &:focus-visible {\n border: 1px solid ", ";\n }\n outline: none;\n ", "\n"], ["\n ", "\n z-index: 1;\n text-align: center;\n border-radius: 0;\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n &:focus-visible {\n border: 1px solid ", ";\n }\n outline: none;\n ", "\n"])), border, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.alertBlue; }, function (props) { return !props.customFocus && global_styles.focusVisible; });
22
- var IconContainer = styled__default["default"].div(templateObject_8 || (templateObject_8 = _tslib.__makeTemplateObject(["\n display: grid;\n place-content: center;\n"], ["\n display: grid;\n place-content: center;\n"])));
23
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
29
+ var StepButton = styled__default["default"].button(templateObject_7 || (templateObject_7 = _tslib.__makeTemplateObject(["\n background-color: ", ";\n ", "\n ", "\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n\n &:hover {\n background-color: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n cursor: default;\n }\n"], ["\n background-color: ", ";\n ", "\n ", "\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n\n &:hover {\n background-color: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n cursor: default;\n }\n"])), (_f = designTokens.theme.palette) === null || _f === void 0 ? void 0 : _f.white, border, function (_a) {
30
+ var direction = _a.direction;
31
+ return direction === 'subtract'
32
+ ? borderRadiusLeft
33
+ : borderRadiusRight;
34
+ }, (_g = designTokens.theme.palette) === null || _g === void 0 ? void 0 : _g.lightest, (_h = designTokens.theme.palette) === null || _h === void 0 ? void 0 : _h.light);
35
+ var Label = styled__default["default"].label(templateObject_8 || (templateObject_8 = _tslib.__makeTemplateObject(["\n ", "\n border-radius: 0;\n cursor: pointer;\n text-align: center;\n"], ["\n ", "\n border-radius: 0;\n cursor: pointer;\n text-align: center;\n"])), border);
36
+ var Input = styled__default["default"].input(templateObject_9 || (templateObject_9 = _tslib.__makeTemplateObject(["\n border: none;\n height: 100%;\n text-align: center;\n width: ", ";\n\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n -moz-appearance: textfield;\n appearance: textfield;\n"], ["\n border: none;\n height: 100%;\n text-align: center;\n width: ", ";\n\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n -moz-appearance: textfield;\n appearance: textfield;\n"])), function (_a) {
37
+ var isMaxQuantity = _a.isMaxQuantity;
38
+ return (isMaxQuantity ? 'max-content' : '100%');
39
+ });
40
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
24
41
 
25
- exports.IconContainer = IconContainer;
26
- exports.QuantityButton = QuantityButton;
27
- exports.QuantityInput = QuantityInput;
28
- exports.QuantitySelectorContainer = QuantitySelectorContainer;
42
+ exports.Container = Container;
43
+ exports.Input = Input;
44
+ exports.Label = Label;
45
+ exports.StepButton = StepButton;
29
46
  //# sourceMappingURL=QuantitySelector.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuantitySelector.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"QuantitySelector.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ exports.EQuantitySelectorSize = void 0;
6
+ (function (EQuantitySelectorSize) {
7
+ EQuantitySelectorSize["dynamic"] = "dynamic";
8
+ EQuantitySelectorSize["small"] = "small";
9
+ EQuantitySelectorSize["large"] = "large";
10
+ })(exports.EQuantitySelectorSize || (exports.EQuantitySelectorSize = {}));
11
+ //# sourceMappingURL=QuantitySelector.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuantitySelector.types.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -76,6 +76,7 @@ require('../PriceTag/PriceTag.styles.js');
76
76
  require('../ProductHeader/ProductHeader.js');
77
77
  require('../ProgressBar/ProgressBar.styled.js');
78
78
  require('../QuantitySelector/QuantitySelector.styles.js');
79
+ require('../QuantitySelector/QuantitySelector.types.js');
79
80
  require('../RadioBox/RadioBoxItem.styles.js');
80
81
  require('../RadioBox/RadioBoxList.styles.js');
81
82
  require('../RadioGroup/RadioGroup.styles.js');
@@ -1 +1 @@
1
- {"version":3,"file":"WarningLabel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"WarningLabel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var designTokens = require('@citygross/design-tokens');
6
+ var QuantitySelector_types = require('../components/QuantitySelector/QuantitySelector.types.js');
7
+
8
+ var getQuantitySelectorSizeAttributes = function (size) {
9
+ var _a, _b, _c, _d, _e, _f;
10
+ switch (size) {
11
+ case QuantitySelector_types.EQuantitySelectorSize.small:
12
+ return {
13
+ fontSize: (_b = (_a = designTokens.theme.typography) === null || _a === void 0 ? void 0 : _a.size) === null || _b === void 0 ? void 0 : _b.s2,
14
+ height: (_c = designTokens.theme.spacings) === null || _c === void 0 ? void 0 : _c.lg
15
+ };
16
+ case QuantitySelector_types.EQuantitySelectorSize.large:
17
+ return {
18
+ fontSize: (_e = (_d = designTokens.theme.typography) === null || _d === void 0 ? void 0 : _d.size) === null || _e === void 0 ? void 0 : _e.s2,
19
+ height: (_f = designTokens.theme.spacings) === null || _f === void 0 ? void 0 : _f.xl
20
+ };
21
+ default:
22
+ return {};
23
+ }
24
+ };
25
+
26
+ exports.getQuantitySelectorSizeAttributes = getQuantitySelectorSizeAttributes;
27
+ //# sourceMappingURL=quantity-selector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quantity-selector.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -66,6 +66,7 @@ var PriceTag_types = require('./components/PriceTag/PriceTag.types.js');
66
66
  var ProductHeader = require('./components/ProductHeader/ProductHeader.js');
67
67
  var ProgressBar = require('./components/ProgressBar/ProgressBar.js');
68
68
  var QuantitySelector = require('./components/QuantitySelector/QuantitySelector.js');
69
+ var QuantitySelector_types = require('./components/QuantitySelector/QuantitySelector.types.js');
69
70
  var RadioBoxItem = require('./components/RadioBox/RadioBoxItem.js');
70
71
  var RadioBoxList = require('./components/RadioBox/RadioBoxList.js');
71
72
  var RadioGroup = require('./components/RadioGroup/RadioGroup.js');
@@ -218,6 +219,10 @@ Object.defineProperty(exports, 'EProductHeader', {
218
219
  exports.ProductHeader = ProductHeader.ProductHeader;
219
220
  exports.ProgressBar = ProgressBar.ProgressBar;
220
221
  exports.QuantitySelector = QuantitySelector.QuantitySelector;
222
+ Object.defineProperty(exports, 'EQuantitySelectorSize', {
223
+ enumerable: true,
224
+ get: function () { return QuantitySelector_types.EQuantitySelectorSize; }
225
+ });
221
226
  exports.RadioBoxItem = RadioBoxItem.RadioBoxItem;
222
227
  exports.RadioBoxList = RadioBoxList.RadioBoxList;
223
228
  exports.RadioGroup = RadioGroup.RadioGroup;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -72,6 +72,7 @@ import '../PriceTag/PriceTag.styles.js';
72
72
  import '../ProductHeader/ProductHeader.js';
73
73
  import '../ProgressBar/ProgressBar.styled.js';
74
74
  import '../QuantitySelector/QuantitySelector.styles.js';
75
+ import '../QuantitySelector/QuantitySelector.types.js';
75
76
  import '../RadioBox/RadioBoxItem.styles.js';
76
77
  import '../RadioBox/RadioBoxList.styles.js';
77
78
  import '../RadioGroup/RadioGroup.styles.js';
@@ -1 +1 @@
1
- {"version":3,"file":"AddressBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"AddressBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,42 +1,39 @@
1
- import React, { useState, useRef } from 'react';
2
- import { QuantitySelectorContainer, QuantityButton, IconContainer, QuantityInput } from './QuantitySelector.styles.js';
1
+ import React, { useState } from 'react';
3
2
  import { Icons } from '@citygross/icons';
3
+ import { Container, StepButton, Label, Input } from './QuantitySelector.styles.js';
4
+ import { theme } from '@citygross/design-tokens';
5
+ import { EQuantitySelectorSize } from './QuantitySelector.types.js';
4
6
 
5
7
  function QuantitySelector(_a) {
6
- var onAdd = _a.onAdd, onSubtract = _a.onSubtract, onChange = _a.onChange, maxValue = _a.maxValue, value = _a.value, onBlur = _a.onBlur;
7
- var _b = useState(false), customFocus = _b[0], setCustomFocus = _b[1];
8
- var inputRef = useRef(null);
9
- return (React.createElement(QuantitySelectorContainer, null,
10
- React.createElement(QuantityButton, { direction: "left", disabled: value <= 0, onClick: onSubtract, tabIndex: -1 },
11
- React.createElement(IconContainer, null,
12
- React.createElement(Icons.Minus, { width: 16, height: 16 }))),
13
- React.createElement(QuantityInput, { customFocus: customFocus, max: maxValue, value: value, ref: inputRef, type: "number", pattern: "[0-9]*", onMouseDown: function () {
14
- setCustomFocus(true);
15
- }, onClick: function () {
16
- if (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) {
17
- inputRef.current.select();
18
- }
19
- }, onFocus: function () {
20
- if (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) {
21
- inputRef.current.select();
22
- }
23
- }, onKeyDown: function (event) {
24
- if (event.key === ',' || event.key === '.') {
25
- event.preventDefault();
26
- }
27
- if (event.key === 'Enter' || event.key === 'Escape') {
28
- event.currentTarget.blur();
29
- }
30
- }, onBlur: function () {
31
- onBlur && onBlur();
32
- setCustomFocus(false);
33
- }, onChange: function (e) {
34
- console.log(e.target.value);
35
- onChange(e);
36
- } }),
37
- React.createElement(QuantityButton, { direction: "right", disabled: value >= maxValue, onClick: onAdd, tabIndex: -1 },
38
- React.createElement(IconContainer, null,
39
- React.createElement(Icons.Plus, { width: 16, height: 16 })))));
8
+ var _b, _c, _d, _e;
9
+ 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 _g = useState(false), isFocused = _g[0], setIsFocused = _g[1];
11
+ var disabledAdd = quantity >= maxQuantity;
12
+ var disabledSubtract = quantity <= 0;
13
+ var handleBlur = function () {
14
+ setIsFocused(false);
15
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur();
16
+ };
17
+ var handleKeyDown = function (e) {
18
+ if (e.key === ',' ||
19
+ e.key === '.' ||
20
+ (e.currentTarget.value.length >= 2 && /^[0-9]$/.test(e.key))) {
21
+ e.preventDefault();
22
+ }
23
+ if (e.key === 'Enter' || e.key === 'Escape') {
24
+ e.currentTarget.blur();
25
+ }
26
+ };
27
+ return (React.createElement(Container, { size: size },
28
+ React.createElement(StepButton, { "aria-label": "Minska antal ".concat(productName || ''), direction: "subtract", disabled: disabledSubtract, onClick: onSubtract },
29
+ React.createElement(Icons.Minus, { color: disabledSubtract
30
+ ? (_b = theme.palette) === null || _b === void 0 ? void 0 : _b.placeholder
31
+ : (_c = theme.palette) === null || _c === void 0 ? void 0 : _c.darkest, height: 16, width: 16 })),
32
+ React.createElement(Label, null,
33
+ quantity === maxQuantity && !isFocused && (React.createElement("span", { "aria-label": "Max antal ".concat(maxQuantity), "aria-live": "polite", role: "status" }, "Max")),
34
+ React.createElement(Input, { "aria-label": "Ange antal", 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 })),
35
+ React.createElement(StepButton, { "aria-label": "\u00D6ka antal ".concat(productName || ''), direction: "add", disabled: disabledAdd, onClick: onAdd },
36
+ 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 }))));
40
37
  }
41
38
 
42
39
  export { QuantitySelector };
@@ -1 +1 @@
1
- {"version":3,"file":"QuantitySelector.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"QuantitySelector.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,18 +1,35 @@
1
1
  import { __makeTemplateObject } from '../../../../_virtual/_tslib.js';
2
2
  import styled, { css } from 'styled-components';
3
- import { focusVisible } from '../../shared/global.styles.js';
3
+ import { theme } from '@citygross/design-tokens';
4
+ import { EQuantitySelectorSize } from './QuantitySelector.types.js';
5
+ import { getQuantitySelectorSizeAttributes } from '../../helpers/quantity-selector.js';
4
6
 
5
- var quantityButton = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n cursor: pointer;\n &:disabled {\n background-color: ", ";\n opacity: 0.5;\n cursor: default;\n }\n\n &:hover {\n background-color: ", ";\n }\n\n &:active {\n background-color: ", ";\n }\n"], ["\n cursor: pointer;\n &:disabled {\n background-color: ", ";\n opacity: 0.5;\n cursor: default;\n }\n\n &:hover {\n background-color: ", ";\n }\n\n &:active {\n background-color: ", ";\n }\n"])), function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.lighter; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.lightest; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.lighter; });
6
- var border = css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border: 1px solid ", ";\n"], ["\n border: 1px solid ", ";\n"])), function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.disabledGray; });
7
- var borderRadiusLeft = css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n border-right: none;\n"], ["\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n border-right: none;\n"])), function (props) { var _a; return (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.borderRadius.small; }, function (props) { var _a; return (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.borderRadius.small; });
8
- var borderRadiusRight = css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n border-left: none;\n"], ["\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n border-left: none;\n"])), function (props) { var _a; return (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.borderRadius.small; }, function (props) { var _a; return (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.borderRadius.small; });
9
- var QuantitySelectorContainer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: grid;\n grid-template-columns: 40px 48px 40px;\n height: 40px;\n background: ", ";\n width: 128px;\n\n @media (min-width: ", "px) {\n grid-template-columns: 32px 40px 32px;\n width: 104px;\n height: 32px;\n }\n"], ["\n display: grid;\n grid-template-columns: 40px 48px 40px;\n height: 40px;\n background: ", ";\n width: 128px;\n\n @media (min-width: ", "px) {\n grid-template-columns: 32px 40px 32px;\n width: 104px;\n height: 32px;\n }\n"])), function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.transparent; }, function (props) { var _a; return (_a = props.theme.breakpoints) === null || _a === void 0 ? void 0 : _a.sm; });
10
- var QuantityButton = styled.button(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ", ";\n ", "\n ", "\n ", "\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ", ";\n ", "\n ", "\n ", "\n"])), function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.white; }, quantityButton, border, function (props) {
11
- return props.direction === 'left' ? borderRadiusLeft : borderRadiusRight;
7
+ var _a, _b, _c, _d, _e, _f, _g, _h;
8
+ var border = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border: 1px solid ", ";\n"], ["\n border: 1px solid ", ";\n"])), (_a = theme.palette) === null || _a === void 0 ? void 0 : _a.placeholder);
9
+ var borderRadiusLeft = css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n border-right: none;\n"], ["\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n border-right: none;\n"])), (_b = theme.attributes) === null || _b === void 0 ? void 0 : _b.borderRadius.small, (_c = theme.attributes) === null || _c === void 0 ? void 0 : _c.borderRadius.small);
10
+ var borderRadiusRight = css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n border-left: none;\n"], ["\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n border-left: none;\n"])), (_d = theme.attributes) === null || _d === void 0 ? void 0 : _d.borderRadius.small, (_e = theme.attributes) === null || _e === void 0 ? void 0 : _e.borderRadius.small);
11
+ var Container = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
12
+ var _b;
13
+ var size = _a.size;
14
+ var resolvedSize = size === EQuantitySelectorSize.dynamic
15
+ ? EQuantitySelectorSize.small
16
+ : size;
17
+ var _c = getQuantitySelectorSizeAttributes(resolvedSize), fontSize = _c.fontSize, height = _c.height;
18
+ var largeSize = getQuantitySelectorSizeAttributes(EQuantitySelectorSize.large);
19
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: grid;\n font-size: ", "px;\n grid-template-columns: ", "px 1fr ", "px;\n height: ", "px;\n\n ", "\n "], ["\n display: grid;\n font-size: ", "px;\n grid-template-columns: ", "px 1fr ", "px;\n height: ", "px;\n\n ", "\n "])), fontSize, height, height, height, size === EQuantitySelectorSize.dynamic && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n @media (max-width: ", "px) {\n font-size: ", "px;\n grid-template-columns: ", "px 1fr ", "px;\n height: ", "px;\n }\n "], ["\n @media (max-width: ", "px) {\n font-size: ", "px;\n grid-template-columns: ", "px 1fr ", "px;\n height: ", "px;\n }\n "])), (_b = theme.breakpoints) === null || _b === void 0 ? void 0 : _b.sm, largeSize.fontSize, largeSize.height, largeSize.height, largeSize.height));
12
20
  });
13
- var QuantityInput = styled.input(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n ", "\n z-index: 1;\n text-align: center;\n border-radius: 0;\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n &:focus-visible {\n border: 1px solid ", ";\n }\n outline: none;\n ", "\n"], ["\n ", "\n z-index: 1;\n text-align: center;\n border-radius: 0;\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n &:focus-visible {\n border: 1px solid ", ";\n }\n outline: none;\n ", "\n"])), border, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.alertBlue; }, function (props) { return !props.customFocus && focusVisible; });
14
- var IconContainer = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: grid;\n place-content: center;\n"], ["\n display: grid;\n place-content: center;\n"])));
15
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
21
+ var StepButton = styled.button(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n background-color: ", ";\n ", "\n ", "\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n\n &:hover {\n background-color: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n cursor: default;\n }\n"], ["\n background-color: ", ";\n ", "\n ", "\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n\n &:hover {\n background-color: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n cursor: default;\n }\n"])), (_f = theme.palette) === null || _f === void 0 ? void 0 : _f.white, border, function (_a) {
22
+ var direction = _a.direction;
23
+ return direction === 'subtract'
24
+ ? borderRadiusLeft
25
+ : borderRadiusRight;
26
+ }, (_g = theme.palette) === null || _g === void 0 ? void 0 : _g.lightest, (_h = theme.palette) === null || _h === void 0 ? void 0 : _h.light);
27
+ var Label = styled.label(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n ", "\n border-radius: 0;\n cursor: pointer;\n text-align: center;\n"], ["\n ", "\n border-radius: 0;\n cursor: pointer;\n text-align: center;\n"])), border);
28
+ var Input = styled.input(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n border: none;\n height: 100%;\n text-align: center;\n width: ", ";\n\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n -moz-appearance: textfield;\n appearance: textfield;\n"], ["\n border: none;\n height: 100%;\n text-align: center;\n width: ", ";\n\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n -moz-appearance: textfield;\n appearance: textfield;\n"])), function (_a) {
29
+ var isMaxQuantity = _a.isMaxQuantity;
30
+ return (isMaxQuantity ? 'max-content' : '100%');
31
+ });
32
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
16
33
 
17
- export { IconContainer, QuantityButton, QuantityInput, QuantitySelectorContainer };
34
+ export { Container, Input, Label, StepButton };
18
35
  //# sourceMappingURL=QuantitySelector.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuantitySelector.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"QuantitySelector.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,9 @@
1
+ var EQuantitySelectorSize;
2
+ (function (EQuantitySelectorSize) {
3
+ EQuantitySelectorSize["dynamic"] = "dynamic";
4
+ EQuantitySelectorSize["small"] = "small";
5
+ EQuantitySelectorSize["large"] = "large";
6
+ })(EQuantitySelectorSize || (EQuantitySelectorSize = {}));
7
+
8
+ export { EQuantitySelectorSize };
9
+ //# sourceMappingURL=QuantitySelector.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuantitySelector.types.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -72,6 +72,7 @@ import '../PriceTag/PriceTag.styles.js';
72
72
  import '../ProductHeader/ProductHeader.js';
73
73
  import '../ProgressBar/ProgressBar.styled.js';
74
74
  import '../QuantitySelector/QuantitySelector.styles.js';
75
+ import '../QuantitySelector/QuantitySelector.types.js';
75
76
  import '../RadioBox/RadioBoxItem.styles.js';
76
77
  import '../RadioBox/RadioBoxList.styles.js';
77
78
  import '../RadioGroup/RadioGroup.styles.js';
@@ -1 +1 @@
1
- {"version":3,"file":"WarningLabel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"WarningLabel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,23 @@
1
+ import { theme } from '@citygross/design-tokens';
2
+ import { EQuantitySelectorSize } from '../components/QuantitySelector/QuantitySelector.types.js';
3
+
4
+ var getQuantitySelectorSizeAttributes = function (size) {
5
+ var _a, _b, _c, _d, _e, _f;
6
+ switch (size) {
7
+ case EQuantitySelectorSize.small:
8
+ return {
9
+ fontSize: (_b = (_a = theme.typography) === null || _a === void 0 ? void 0 : _a.size) === null || _b === void 0 ? void 0 : _b.s2,
10
+ height: (_c = theme.spacings) === null || _c === void 0 ? void 0 : _c.lg
11
+ };
12
+ case EQuantitySelectorSize.large:
13
+ return {
14
+ fontSize: (_e = (_d = theme.typography) === null || _d === void 0 ? void 0 : _d.size) === null || _e === void 0 ? void 0 : _e.s2,
15
+ height: (_f = theme.spacings) === null || _f === void 0 ? void 0 : _f.xl
16
+ };
17
+ default:
18
+ return {};
19
+ }
20
+ };
21
+
22
+ export { getQuantitySelectorSizeAttributes };
23
+ //# sourceMappingURL=quantity-selector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quantity-selector.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
@@ -62,6 +62,7 @@ export { EPriceSize, EPriceVariant } from './components/PriceTag/PriceTag.types.
62
62
  export { EProductHeader, ProductHeader } from './components/ProductHeader/ProductHeader.js';
63
63
  export { ProgressBar } from './components/ProgressBar/ProgressBar.js';
64
64
  export { QuantitySelector } from './components/QuantitySelector/QuantitySelector.js';
65
+ export { EQuantitySelectorSize } from './components/QuantitySelector/QuantitySelector.types.js';
65
66
  export { RadioBoxItem } from './components/RadioBox/RadioBoxItem.js';
66
67
  export { RadioBoxList } from './components/RadioBox/RadioBoxList.js';
67
68
  export { RadioGroup } from './components/RadioGroup/RadioGroup.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citygross/components",
3
- "version": "0.8.117",
3
+ "version": "0.8.118",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "./build/cjs/components/src/index.js",
@@ -76,5 +76,5 @@
76
76
  "react-slick": "^0.30.1",
77
77
  "slick-carousel": "^1.8.1"
78
78
  },
79
- "gitHead": "241f3a0c92971e0ee22fdff8984246c3f9750b8e"
79
+ "gitHead": "59b9fc83018e2d1316c418719d5eabfdca70be76"
80
80
  }