@citygross/components 0.8.114 → 0.8.116
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/@types/components/CartCard/CartCard.d.ts +9 -9
- package/build/@types/components/CgButton/CgButton.d.ts +10 -28
- package/build/@types/components/CgButton/CgButton.styles.d.ts +1 -15
- package/build/@types/components/CgButton/CgButton.types.d.ts +39 -0
- package/build/@types/components/CouponCode/CouponCode.d.ts +10 -10
- package/build/@types/components/Header/Header.d.ts +4 -4
- package/build/@types/components/StepperMobile/StepperMobile.d.ts +3 -3
- package/build/@types/helpers/button.d.ts +5 -0
- package/build/cjs/components/src/components/AddressBlock/AddressBlock.js +1 -0
- package/build/cjs/components/src/components/AddressBlock/AddressBlock.js.map +1 -1
- package/build/cjs/components/src/components/CartCard/CartCard.js +6 -3
- package/build/cjs/components/src/components/CartCard/CartCard.js.map +1 -1
- package/build/cjs/components/src/components/CgButton/CgButton.js +11 -26
- package/build/cjs/components/src/components/CgButton/CgButton.js.map +1 -1
- package/build/cjs/components/src/components/CgButton/CgButton.styles.js +53 -67
- package/build/cjs/components/src/components/CgButton/CgButton.styles.js.map +1 -1
- package/build/cjs/components/src/components/CgButton/CgButton.types.js +19 -0
- package/build/cjs/components/src/components/CgButton/CgButton.types.js.map +1 -0
- package/build/cjs/components/src/components/CouponCode/CouponCode.js +8 -7
- package/build/cjs/components/src/components/CouponCode/CouponCode.js.map +1 -1
- package/build/cjs/components/src/components/Header/Header.js +3 -2
- package/build/cjs/components/src/components/Header/Header.js.map +1 -1
- package/build/cjs/components/src/components/StepperMobile/StepperMobile.js +7 -5
- package/build/cjs/components/src/components/StepperMobile/StepperMobile.js.map +1 -1
- package/build/cjs/components/src/components/WarningLabel/WarningLabel.js +1 -0
- package/build/cjs/components/src/components/WarningLabel/WarningLabel.js.map +1 -1
- package/build/cjs/components/src/helpers/button.js +93 -0
- package/build/cjs/components/src/helpers/button.js.map +1 -0
- package/build/cjs/components/src/index.js +0 -8
- package/build/cjs/components/src/index.js.map +1 -1
- package/build/cjs/design-tokens/build/index.js +11 -6
- package/build/cjs/design-tokens/build/index.js.map +1 -1
- package/build/es/components/src/components/AddressBlock/AddressBlock.js +1 -0
- package/build/es/components/src/components/AddressBlock/AddressBlock.js.map +1 -1
- package/build/es/components/src/components/CartCard/CartCard.js +7 -4
- package/build/es/components/src/components/CartCard/CartCard.js.map +1 -1
- package/build/es/components/src/components/CgButton/CgButton.js +14 -29
- package/build/es/components/src/components/CgButton/CgButton.js.map +1 -1
- package/build/es/components/src/components/CgButton/CgButton.styles.js +54 -66
- package/build/es/components/src/components/CgButton/CgButton.styles.js.map +1 -1
- package/build/es/components/src/components/CgButton/CgButton.types.js +17 -0
- package/build/es/components/src/components/CgButton/CgButton.types.js.map +1 -0
- package/build/es/components/src/components/CouponCode/CouponCode.js +10 -9
- package/build/es/components/src/components/CouponCode/CouponCode.js.map +1 -1
- package/build/es/components/src/components/Header/Header.js +4 -3
- package/build/es/components/src/components/Header/Header.js.map +1 -1
- package/build/es/components/src/components/StepperMobile/StepperMobile.js +7 -5
- package/build/es/components/src/components/StepperMobile/StepperMobile.js.map +1 -1
- package/build/es/components/src/components/WarningLabel/WarningLabel.js +1 -0
- package/build/es/components/src/components/WarningLabel/WarningLabel.js.map +1 -1
- package/build/es/components/src/helpers/button.js +89 -0
- package/build/es/components/src/helpers/button.js.map +1 -0
- package/build/es/components/src/index.js +1 -1
- package/build/es/design-tokens/build/index.js +11 -6
- package/build/es/design-tokens/build/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare type TCartCard = {
|
|
3
|
-
markings?: React.ReactNode;
|
|
4
|
-
title: string;
|
|
5
3
|
description?: React.ReactNode;
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
image: string;
|
|
5
|
+
markings?: React.ReactNode;
|
|
8
6
|
maxReachedWarning?: string;
|
|
9
7
|
maxValue?: number;
|
|
10
|
-
setValue?: (value: number) => void;
|
|
11
|
-
value?: number;
|
|
12
|
-
price: React.ReactNode;
|
|
13
|
-
image: string;
|
|
14
8
|
onDelete?: () => void;
|
|
9
|
+
price: React.ReactNode;
|
|
15
10
|
quanitytSelector?: React.ReactNode;
|
|
11
|
+
secondaryDescription?: React.ReactNode;
|
|
12
|
+
setValue?: (value: number) => void;
|
|
13
|
+
showDelete?: boolean;
|
|
14
|
+
title: string;
|
|
16
15
|
titleLineClamp?: number;
|
|
17
16
|
titleLink?: React.ReactNode;
|
|
17
|
+
value?: number;
|
|
18
18
|
};
|
|
19
|
-
export declare const CartCard: ({
|
|
19
|
+
export declare const CartCard: ({ description, image, markings, maxReachedWarning, maxValue, onDelete, price, quanitytSelector, secondaryDescription, showDelete, title, titleLineClamp, titleLink, value }: TCartCard) => JSX.Element;
|
|
@@ -1,30 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
'large' = 2
|
|
6
|
-
}
|
|
7
|
-
export declare enum EButtonVariant {
|
|
8
|
-
'primary' = 0,
|
|
9
|
-
'secondary' = 1,
|
|
10
|
-
'tertiary' = 2,
|
|
11
|
-
'prio' = 3,
|
|
12
|
-
'ghost' = 4
|
|
13
|
-
}
|
|
14
|
-
export declare type TCgButton = {
|
|
15
|
-
ariaLabel?: string;
|
|
16
|
-
buttonRef?: React.Ref<HTMLButtonElement>;
|
|
2
|
+
import { EButtonVariant, EButtonSize } from './CgButton.types';
|
|
3
|
+
export declare const CgButton: React.ForwardRefExoticComponent<{
|
|
4
|
+
boxShadow?: boolean | undefined;
|
|
17
5
|
children?: React.ReactNode;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
round?: boolean;
|
|
26
|
-
shouldPreventDefault?: boolean;
|
|
27
|
-
size?: ECgButtonSize;
|
|
28
|
-
variant?: EButtonVariant;
|
|
29
|
-
};
|
|
30
|
-
export declare const CgButton: ({ ariaLabel, buttonRef, children, disabled, flexReverse, fullWidth, icon, id, loading, onClick, round, shouldPreventDefault, size, variant }: TCgButton) => JSX.Element;
|
|
6
|
+
circle?: boolean | undefined;
|
|
7
|
+
fullWidth?: boolean | undefined;
|
|
8
|
+
loading?: boolean | undefined;
|
|
9
|
+
rounded?: boolean | undefined;
|
|
10
|
+
size?: EButtonSize | undefined;
|
|
11
|
+
variant?: EButtonVariant | undefined;
|
|
12
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { ECgButtonSize, EButtonVariant } from './CgButton';
|
|
3
|
-
export declare type TCgButtonStyleProps = {
|
|
4
|
-
size?: ECgButtonSize;
|
|
5
|
-
variant?: EButtonVariant;
|
|
6
|
-
icon?: React.ReactNode;
|
|
7
|
-
flexReverse?: boolean;
|
|
8
|
-
loading?: boolean;
|
|
9
|
-
isIconOnly?: boolean;
|
|
10
|
-
fullWidth?: boolean;
|
|
11
|
-
round?: boolean;
|
|
12
|
-
};
|
|
13
|
-
export declare const CgButtonContainer: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, TCgButtonStyleProps, never>;
|
|
14
|
-
export declare const CgButtonContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Pick<TCgButtonStyleProps, "flexReverse" | "size" | "loading">, never>;
|
|
15
|
-
export declare const CgButtonLoader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
1
|
+
export declare const Container: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, Omit<import("./CgButton.types").TCgButton, "children" | "loading" | "variant"> & import("./CgButton.types").TButtonSizeAttributes & import("./CgButton.types").TButtonVariantAttributes, never>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare enum EButtonSize {
|
|
3
|
+
small = "small",
|
|
4
|
+
medium = "medium",
|
|
5
|
+
large = "large"
|
|
6
|
+
}
|
|
7
|
+
export declare enum EButtonVariant {
|
|
8
|
+
primary = "primary",
|
|
9
|
+
secondary = "secondary",
|
|
10
|
+
tertiary = "tertiary",
|
|
11
|
+
prio = "prio",
|
|
12
|
+
ghost = "ghost"
|
|
13
|
+
}
|
|
14
|
+
export declare type TCgButton = {
|
|
15
|
+
boxShadow?: boolean;
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
circle?: boolean;
|
|
18
|
+
fullWidth?: boolean;
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
rounded?: boolean;
|
|
21
|
+
size?: EButtonSize;
|
|
22
|
+
variant?: EButtonVariant;
|
|
23
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
24
|
+
export declare type TCgButtonStyle = Omit<TCgButton, 'children' | 'loading' | 'variant'> & TButtonSizeAttributes & TButtonVariantAttributes;
|
|
25
|
+
export declare type TButtonSizeAttributes = {
|
|
26
|
+
fontSize?: number;
|
|
27
|
+
height?: number;
|
|
28
|
+
loadingSpinner?: number;
|
|
29
|
+
paddingX?: number;
|
|
30
|
+
paddingY?: number;
|
|
31
|
+
};
|
|
32
|
+
export declare type TButtonVariantAttributes = {
|
|
33
|
+
backgroundActive?: string;
|
|
34
|
+
backgroundColor?: string;
|
|
35
|
+
backgroundDisabled?: string;
|
|
36
|
+
backgroundHover?: string;
|
|
37
|
+
border?: boolean;
|
|
38
|
+
fontColor?: string;
|
|
39
|
+
};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare enum ECouponCodeStatus {
|
|
3
|
-
|
|
4
|
-
Invalid = "Invalid",
|
|
3
|
+
Empty = "Empty",
|
|
5
4
|
Error = "Error",
|
|
6
|
-
|
|
5
|
+
Invalid = "Invalid",
|
|
6
|
+
Success = "Success"
|
|
7
7
|
}
|
|
8
8
|
declare type TSubmitResult = {
|
|
9
|
-
status: ECouponCodeStatus;
|
|
10
9
|
message: string;
|
|
10
|
+
status: ECouponCodeStatus;
|
|
11
11
|
};
|
|
12
12
|
export declare type TCouponCode = {
|
|
13
13
|
label: string;
|
|
14
|
-
resetLabel: string;
|
|
15
|
-
placeholder: string;
|
|
16
|
-
onSubmit: () => void;
|
|
17
|
-
status?: TSubmitResult;
|
|
18
14
|
loading?: boolean;
|
|
15
|
+
onReset: () => void;
|
|
16
|
+
onSubmit: () => void;
|
|
17
|
+
placeholder: string;
|
|
18
|
+
resetLabel: string;
|
|
19
19
|
setValue: (value: string) => void;
|
|
20
|
+
status?: TSubmitResult;
|
|
20
21
|
value: string;
|
|
21
|
-
onReset: () => void;
|
|
22
22
|
};
|
|
23
|
-
export declare function CouponCode({ label,
|
|
23
|
+
export declare function CouponCode({ label, loading, onReset, onSubmit, placeholder, resetLabel, setValue, status, value }: TCouponCode): JSX.Element;
|
|
24
24
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export declare type THeader = {
|
|
3
|
+
children?: ReactNode;
|
|
3
4
|
logoImage?: JSX.Element;
|
|
4
5
|
logOut?: () => void;
|
|
5
6
|
logOutLabel?: string;
|
|
6
|
-
children?: ReactNode;
|
|
7
|
-
topLinkLabel: string;
|
|
8
|
-
topLinkHref?: string;
|
|
9
7
|
lowerContainerMaxWidth?: number;
|
|
8
|
+
topLinkHref?: string;
|
|
9
|
+
topLinkLabel: string;
|
|
10
10
|
};
|
|
11
|
-
export declare function Header({
|
|
11
|
+
export declare function Header({ children, logoImage, logOut, logOutLabel, lowerContainerMaxWidth, topLinkHref, topLinkLabel }: THeader): JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { IStepperItem } from '../Stepper/StepperList';
|
|
3
3
|
export declare type TStepperMobile = {
|
|
4
|
-
|
|
4
|
+
buttonText: string;
|
|
5
5
|
current: number;
|
|
6
6
|
setCurrent: () => void;
|
|
7
7
|
setPrevious: () => void;
|
|
8
|
-
|
|
8
|
+
steps: IStepperItem[];
|
|
9
9
|
};
|
|
10
|
-
export declare
|
|
10
|
+
export declare const StepperMobile: ({ buttonText, current, setCurrent, setPrevious, steps }: TStepperMobile) => JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { EButtonSize, EButtonVariant, TButtonSizeAttributes, TButtonVariantAttributes } from '../components/CgButton/CgButton.types';
|
|
2
|
+
export declare const getButtonAttributes: (buttonSize?: EButtonSize, buttonVariant?: EButtonVariant) => {
|
|
3
|
+
sizeAttributes: TButtonSizeAttributes;
|
|
4
|
+
variantAttributes: TButtonVariantAttributes;
|
|
5
|
+
};
|
|
@@ -19,6 +19,7 @@ require('@citygross/design-tokens');
|
|
|
19
19
|
require('../Button/Button.styles.js');
|
|
20
20
|
require('../CartCard/CartCard.styles.js');
|
|
21
21
|
require('../CgButton/CgButton.js');
|
|
22
|
+
require('../CgButton/CgButton.types.js');
|
|
22
23
|
require('../CartCardLabel/CartCardLabel.styles.js');
|
|
23
24
|
require('@citygross/utils');
|
|
24
25
|
require('react-loading-skeleton');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddressBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -7,23 +7,26 @@ var fallback_grocery = require('./assets/fallback_grocery.svg.js');
|
|
|
7
7
|
var CartCard_styles = require('./CartCard.styles.js');
|
|
8
8
|
var icons = require('@citygross/icons');
|
|
9
9
|
var CgButton = require('../CgButton/CgButton.js');
|
|
10
|
+
var CgButton_types = require('../CgButton/CgButton.types.js');
|
|
10
11
|
|
|
11
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
13
|
|
|
13
14
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
15
|
|
|
15
16
|
var CartCard = function (_a) {
|
|
16
|
-
var
|
|
17
|
+
var description = _a.description, image = _a.image, markings = _a.markings, maxReachedWarning = _a.maxReachedWarning, _b = _a.maxValue, maxValue = _b === void 0 ? 999 : _b, onDelete = _a.onDelete, price = _a.price, quanitytSelector = _a.quanitytSelector, secondaryDescription = _a.secondaryDescription, showDelete = _a.showDelete, title = _a.title, _c = _a.titleLineClamp, titleLineClamp = _c === void 0 ? 1 : _c, titleLink = _a.titleLink, value = _a.value;
|
|
17
18
|
return (React__default["default"].createElement(CartCard_styles.CartCardContainer, null,
|
|
18
19
|
React__default["default"].createElement(CartCard_styles.CartCardImage, { src: image || fallback_grocery }),
|
|
19
20
|
React__default["default"].createElement(CartCard_styles.CartCardInner, null,
|
|
20
21
|
React__default["default"].createElement(CartCard_styles.CartCardInnerTop, null,
|
|
21
22
|
React__default["default"].createElement(CartCard_styles.CartCardInfo, null,
|
|
22
23
|
markings && (React__default["default"].createElement(CartCard_styles.MarkingsContainer, null, markings)),
|
|
23
|
-
titleLink ||
|
|
24
|
+
titleLink ||
|
|
25
|
+
(title && (React__default["default"].createElement(CartCard_styles.CartCardTitle, { titleLineClamp: titleLineClamp }, title))),
|
|
24
26
|
description && description),
|
|
25
27
|
showDelete && (React__default["default"].createElement(CartCard_styles.CartCardDelete, null,
|
|
26
|
-
React__default["default"].createElement(CgButton.CgButton, { onClick: onDelete, variant:
|
|
28
|
+
React__default["default"].createElement(CgButton.CgButton, { onClick: onDelete, variant: CgButton_types.EButtonVariant.secondary },
|
|
29
|
+
React__default["default"].createElement(icons.Icons.Trash, { width: 16, height: 16 }))))),
|
|
27
30
|
secondaryDescription && secondaryDescription,
|
|
28
31
|
React__default["default"].createElement(CartCard_styles.CartCardPriceContainer, null,
|
|
29
32
|
React__default["default"].createElement(CartCard_styles.PriceContainer, null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartCard.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CartCard.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,40 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _tslib = require('../../../../_virtual/_tslib.js');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var CgButton_styles = require('./CgButton.styles.js');
|
|
7
8
|
var Spinner = require('../Spinner/Spinner.js');
|
|
9
|
+
var CgButton_types = require('./CgButton.types.js');
|
|
10
|
+
var button = require('../../helpers/button.js');
|
|
8
11
|
|
|
9
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
13
|
|
|
11
14
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
EButtonVariant[EButtonVariant["primary"] = 0] = "primary";
|
|
22
|
-
EButtonVariant[EButtonVariant["secondary"] = 1] = "secondary";
|
|
23
|
-
EButtonVariant[EButtonVariant["tertiary"] = 2] = "tertiary";
|
|
24
|
-
EButtonVariant[EButtonVariant["prio"] = 3] = "prio";
|
|
25
|
-
EButtonVariant[EButtonVariant["ghost"] = 4] = "ghost";
|
|
26
|
-
})(exports.EButtonVariant || (exports.EButtonVariant = {}));
|
|
27
|
-
var CgButton = function (_a) {
|
|
28
|
-
var ariaLabel = _a.ariaLabel, buttonRef = _a.buttonRef, children = _a.children, disabled = _a.disabled, flexReverse = _a.flexReverse, fullWidth = _a.fullWidth, icon = _a.icon, _b = _a.id, id = _b === void 0 ? 'cg-button' : _b, loading = _a.loading, onClick = _a.onClick, round = _a.round, _c = _a.shouldPreventDefault, shouldPreventDefault = _c === void 0 ? true : _c, size = _a.size, variant = _a.variant;
|
|
29
|
-
return (React__default["default"].createElement(CgButton_styles.CgButtonContainer, { "aria-label": ariaLabel, disabled: disabled || loading, flexReverse: flexReverse, fullWidth: fullWidth, isIconOnly: !children, id: id, loading: loading, onClick: function (e) {
|
|
30
|
-
shouldPreventDefault && e.preventDefault();
|
|
31
|
-
onClick && onClick();
|
|
32
|
-
}, ref: buttonRef, round: round, size: size, variant: variant },
|
|
33
|
-
React__default["default"].createElement(CgButton_styles.CgButtonContent, { flexReverse: flexReverse, loading: loading, size: size },
|
|
34
|
-
icon,
|
|
35
|
-
children),
|
|
36
|
-
loading && (React__default["default"].createElement(CgButton_styles.CgButtonLoader, null,
|
|
37
|
-
React__default["default"].createElement(Spinner.Spinner, { animationSpeedMs: 1000, size: 16 })))));
|
|
38
|
-
};
|
|
16
|
+
var CgButton = React.forwardRef(function (_a, ref) {
|
|
17
|
+
var boxShadow = _a.boxShadow, children = _a.children, circle = _a.circle, fullWidth = _a.fullWidth, loading = _a.loading, rounded = _a.rounded, _b = _a.size, size = _b === void 0 ? CgButton_types.EButtonSize.medium : _b, _c = _a.variant, variant = _c === void 0 ? CgButton_types.EButtonVariant.primary : _c, props = _tslib.__rest(_a, ["boxShadow", "children", "circle", "fullWidth", "loading", "rounded", "size", "variant"]);
|
|
18
|
+
var _d = button.getButtonAttributes(size, variant), sizeAttributes = _d.sizeAttributes, variantAttributes = _d.variantAttributes;
|
|
19
|
+
return (React__default["default"].createElement(CgButton_styles.Container, _tslib.__assign({ backgroundColor: variantAttributes.backgroundColor, backgroundHover: variantAttributes.backgroundHover, backgroundDisabled: variantAttributes.backgroundDisabled, backgroundActive: variantAttributes.backgroundActive, border: variantAttributes.border, boxShadow: boxShadow, circle: circle, fontColor: variantAttributes.fontColor, fontSize: sizeAttributes.fontSize, height: sizeAttributes.height, fullWidth: fullWidth, paddingX: sizeAttributes.paddingX, paddingY: sizeAttributes.paddingY, ref: ref, rounded: rounded, size: size }, props),
|
|
20
|
+
loading && (React__default["default"].createElement(Spinner.Spinner, { animationSpeedMs: 1000, size: sizeAttributes.loadingSpinner })),
|
|
21
|
+
children));
|
|
22
|
+
});
|
|
23
|
+
CgButton.displayName = 'CgButton';
|
|
39
24
|
|
|
40
25
|
exports.CgButton = CgButton;
|
|
41
26
|
//# sourceMappingURL=CgButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CgButton.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CgButton.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -5,77 +5,63 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _tslib = require('../../../../_virtual/_tslib.js');
|
|
6
6
|
var styled = require('styled-components');
|
|
7
7
|
var global_styles = require('../../shared/global.styles.js');
|
|
8
|
-
var
|
|
8
|
+
var CgButton_types = require('./CgButton.types.js');
|
|
9
|
+
var designTokens = require('@citygross/design-tokens');
|
|
9
10
|
|
|
10
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
12
|
|
|
12
13
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
13
14
|
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
var _a,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
case CgButton.EButtonVariant.ghost:
|
|
65
|
-
return CgGhost;
|
|
66
|
-
default:
|
|
67
|
-
return CgPrimary;
|
|
68
|
-
}
|
|
69
|
-
}, function (props) {
|
|
70
|
-
var _a;
|
|
71
|
-
return props.loading &&
|
|
72
|
-
"\n background-color: ".concat((_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.lightest, "\n ");
|
|
73
|
-
});
|
|
74
|
-
var CgButtonContent = styled__default["default"].div(templateObject_8 || (templateObject_8 = _tslib.__makeTemplateObject(["\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: ", "px;\nflex-direction: ", ";\nfont-size ", ";\n", ";\nwhite-space: nowrap;\nmin-width: max-content;\n"], ["\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: ", "px;\nflex-direction: ", ";\nfont-size ", ";\n", ";\nwhite-space: nowrap;\nmin-width: max-content;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; }, function (props) { return (props.flexReverse ? 'row-reverse' : 'row'); }, function (props) { return buttonFontSize(props.size, props.theme.typography); }, function (props) { return (props === null || props === void 0 ? void 0 : props.loading) && "opacity: 0"; });
|
|
75
|
-
var CgButtonLoader = styled__default["default"].div(templateObject_9 || (templateObject_9 = _tslib.__makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: grid;\n place-content: center;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: grid;\n place-content: center;\n"])));
|
|
76
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
|
|
15
|
+
var _a, _b, _c, _d, _e;
|
|
16
|
+
var Container = styled__default["default"].button(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n border: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n background-color: ", ";\n color: ", ";\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: ", "px;\n font-family: ", ";\n font-size: ", "px;\n font-weight: ", ";\n height: ", ";\n width: ", ";\n padding: ", ";\n transition: background-color 0.3s ease;\n white-space: nowrap;\n\n &:active {\n background-color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n color: ", ";\n cursor: default;\n }\n\n ", "\n"], ["\n border: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n background-color: ", ";\n color: ", ";\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: ", "px;\n font-family: ", ";\n font-size: ", "px;\n font-weight: ", ";\n height: ", ";\n width: ", ";\n padding: ", ";\n transition: background-color 0.3s ease;\n white-space: nowrap;\n\n &:active {\n background-color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n color: ", ";\n cursor: default;\n }\n\n ", "\n"])), function (_a) {
|
|
17
|
+
var _b;
|
|
18
|
+
var border = _a.border;
|
|
19
|
+
return border ? "1px solid ".concat((_b = designTokens.theme.palette) === null || _b === void 0 ? void 0 : _b.placeholder) : 'none';
|
|
20
|
+
}, function (_a) {
|
|
21
|
+
var _b, _c, _d;
|
|
22
|
+
var circle = _a.circle, rounded = _a.rounded;
|
|
23
|
+
return circle
|
|
24
|
+
? (_b = designTokens.theme.attributes) === null || _b === void 0 ? void 0 : _b.borderRadius.circle
|
|
25
|
+
: rounded
|
|
26
|
+
? "".concat((_c = designTokens.theme.attributes) === null || _c === void 0 ? void 0 : _c.borderRadius.rounded, "px")
|
|
27
|
+
: "".concat((_d = designTokens.theme.spacings) === null || _d === void 0 ? void 0 : _d.xxs, "px");
|
|
28
|
+
}, function (_a) {
|
|
29
|
+
var _b, _c;
|
|
30
|
+
var boxShadow = _a.boxShadow, size = _a.size;
|
|
31
|
+
return boxShadow
|
|
32
|
+
? size === CgButton_types.EButtonSize.small
|
|
33
|
+
? (_b = designTokens.theme.attributes) === null || _b === void 0 ? void 0 : _b.boxShadow.layoutShadowInset
|
|
34
|
+
: (_c = designTokens.theme.attributes) === null || _c === void 0 ? void 0 : _c.boxShadow.layoutShadowInsetMedium
|
|
35
|
+
: 'none';
|
|
36
|
+
}, function (_a) {
|
|
37
|
+
var backgroundColor = _a.backgroundColor;
|
|
38
|
+
return backgroundColor;
|
|
39
|
+
}, function (_a) {
|
|
40
|
+
var fontColor = _a.fontColor;
|
|
41
|
+
return fontColor;
|
|
42
|
+
}, (_a = designTokens.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs, (_b = designTokens.theme.typography) === null || _b === void 0 ? void 0 : _b.type.primary, function (_a) {
|
|
43
|
+
var fontSize = _a.fontSize;
|
|
44
|
+
return fontSize;
|
|
45
|
+
}, (_d = (_c = designTokens.theme.typography) === null || _c === void 0 ? void 0 : _c.weight) === null || _d === void 0 ? void 0 : _d.medium, function (_a) {
|
|
46
|
+
var circle = _a.circle, height = _a.height;
|
|
47
|
+
return (!circle ? "".concat(height, "px") : 'max-content');
|
|
48
|
+
}, function (_a) {
|
|
49
|
+
var fullWidth = _a.fullWidth;
|
|
50
|
+
return (fullWidth ? '100%' : 'max-content');
|
|
51
|
+
}, function (_a) {
|
|
52
|
+
var circle = _a.circle, paddingX = _a.paddingX, paddingY = _a.paddingY;
|
|
53
|
+
return circle ? "".concat(paddingY, "px") : "".concat(paddingY, "px ").concat(paddingX, "px");
|
|
54
|
+
}, function (_a) {
|
|
55
|
+
var backgroundActive = _a.backgroundActive;
|
|
56
|
+
return backgroundActive;
|
|
57
|
+
}, function (_a) {
|
|
58
|
+
var backgroundHover = _a.backgroundHover;
|
|
59
|
+
return backgroundHover;
|
|
60
|
+
}, function (_a) {
|
|
61
|
+
var backgroundDisabled = _a.backgroundDisabled;
|
|
62
|
+
return backgroundDisabled;
|
|
63
|
+
}, (_e = designTokens.theme.palette) === null || _e === void 0 ? void 0 : _e.placeholder, global_styles.focusVisible);
|
|
64
|
+
var templateObject_1;
|
|
77
65
|
|
|
78
|
-
exports.
|
|
79
|
-
exports.CgButtonContent = CgButtonContent;
|
|
80
|
-
exports.CgButtonLoader = CgButtonLoader;
|
|
66
|
+
exports.Container = Container;
|
|
81
67
|
//# sourceMappingURL=CgButton.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CgButton.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CgButton.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
exports.EButtonSize = void 0;
|
|
6
|
+
(function (EButtonSize) {
|
|
7
|
+
EButtonSize["small"] = "small";
|
|
8
|
+
EButtonSize["medium"] = "medium";
|
|
9
|
+
EButtonSize["large"] = "large";
|
|
10
|
+
})(exports.EButtonSize || (exports.EButtonSize = {}));
|
|
11
|
+
exports.EButtonVariant = void 0;
|
|
12
|
+
(function (EButtonVariant) {
|
|
13
|
+
EButtonVariant["primary"] = "primary";
|
|
14
|
+
EButtonVariant["secondary"] = "secondary";
|
|
15
|
+
EButtonVariant["tertiary"] = "tertiary";
|
|
16
|
+
EButtonVariant["prio"] = "prio";
|
|
17
|
+
EButtonVariant["ghost"] = "ghost";
|
|
18
|
+
})(exports.EButtonVariant || (exports.EButtonVariant = {}));
|
|
19
|
+
//# sourceMappingURL=CgButton.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CgButton.types.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var CouponCode_styles = require('./CouponCode.styles.js');
|
|
7
7
|
var CgButton = require('../CgButton/CgButton.js');
|
|
8
|
+
var CgButton_types = require('../CgButton/CgButton.types.js');
|
|
8
9
|
var icons = require('@citygross/icons');
|
|
9
10
|
var designTokens = require('@citygross/design-tokens');
|
|
10
11
|
var Link = require('../Links/Link.js');
|
|
@@ -16,10 +17,10 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
16
17
|
|
|
17
18
|
exports.ECouponCodeStatus = void 0;
|
|
18
19
|
(function (ECouponCodeStatus) {
|
|
19
|
-
ECouponCodeStatus["Success"] = "Success";
|
|
20
|
-
ECouponCodeStatus["Invalid"] = "Invalid";
|
|
21
|
-
ECouponCodeStatus["Error"] = "Error";
|
|
22
20
|
ECouponCodeStatus["Empty"] = "Empty";
|
|
21
|
+
ECouponCodeStatus["Error"] = "Error";
|
|
22
|
+
ECouponCodeStatus["Invalid"] = "Invalid";
|
|
23
|
+
ECouponCodeStatus["Success"] = "Success";
|
|
23
24
|
})(exports.ECouponCodeStatus || (exports.ECouponCodeStatus = {}));
|
|
24
25
|
var CouponResultIcon = function (_a) {
|
|
25
26
|
var _b, _c, _d;
|
|
@@ -34,9 +35,9 @@ var CouponResultIcon = function (_a) {
|
|
|
34
35
|
}
|
|
35
36
|
};
|
|
36
37
|
function CouponCode(_a) {
|
|
37
|
-
var label = _a.label,
|
|
38
|
+
var label = _a.label, loading = _a.loading, onReset = _a.onReset, onSubmit = _a.onSubmit, placeholder = _a.placeholder, resetLabel = _a.resetLabel, setValue = _a.setValue, status = _a.status, value = _a.value;
|
|
38
39
|
var _b = React.useState(false), customFocus = _b[0], setCustomFocus = _b[1];
|
|
39
|
-
return (React__default["default"].createElement(
|
|
40
|
+
return (React__default["default"].createElement(React.Fragment, null, (status === null || status === void 0 ? void 0 : status.status) === exports.ECouponCodeStatus.Empty ? (React__default["default"].createElement(CouponCode_styles.CouponContainer, null,
|
|
40
41
|
React__default["default"].createElement(CouponCode_styles.CouponInputContainer, null,
|
|
41
42
|
React__default["default"].createElement(CouponCode_styles.CouponInput, { type: "text", placeholder: placeholder, value: value, onChange: function (e) { return setValue(e.currentTarget.value); }, onMouseDown: function () {
|
|
42
43
|
setCustomFocus(true);
|
|
@@ -47,9 +48,9 @@ function CouponCode(_a) {
|
|
|
47
48
|
}
|
|
48
49
|
}, onBlur: function () { return setCustomFocus(false); }, customFocus: customFocus })),
|
|
49
50
|
React__default["default"].createElement("div", null,
|
|
50
|
-
React__default["default"].createElement(CgButton.CgButton, { variant:
|
|
51
|
+
React__default["default"].createElement(CgButton.CgButton, { variant: CgButton_types.EButtonVariant.secondary, disabled: loading, onClick: function () { return onSubmit(); }, size: CgButton_types.EButtonSize.medium, fullWidth: true, loading: loading }, label)))) : (React__default["default"].createElement(CouponCode_styles.CouponResultContainer, { status: status === null || status === void 0 ? void 0 : status.status }, (status === null || status === void 0 ? void 0 : status.status) === exports.ECouponCodeStatus.Success ? (React__default["default"].createElement(CouponCode_styles.CouponResultMessage, null,
|
|
51
52
|
React__default["default"].createElement(CouponResultIcon, { status: status === null || status === void 0 ? void 0 : status.status }),
|
|
52
|
-
React__default["default"].createElement("p", null, status === null || status === void 0 ? void 0 : status.message))) : (React__default["default"].createElement(
|
|
53
|
+
React__default["default"].createElement("p", null, status === null || status === void 0 ? void 0 : status.message))) : (React__default["default"].createElement(React.Fragment, null,
|
|
53
54
|
React__default["default"].createElement(CouponCode_styles.CouponResultMessage, null,
|
|
54
55
|
React__default["default"].createElement(CouponResultIcon, { status: status === null || status === void 0 ? void 0 : status.status }),
|
|
55
56
|
React__default["default"].createElement("p", null, status === null || status === void 0 ? void 0 : status.message)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CouponCode.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CouponCode.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -10,6 +10,7 @@ var Logo = require('../Logo/Logo.js');
|
|
|
10
10
|
var Header_styles = require('./Header.styles.js');
|
|
11
11
|
var HeaderLink = require('../HeaderLink/HeaderLink.js');
|
|
12
12
|
var CgButton = require('../CgButton/CgButton.js');
|
|
13
|
+
var CgButton_types = require('../CgButton/CgButton.types.js');
|
|
13
14
|
|
|
14
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
16
|
|
|
@@ -17,14 +18,14 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
17
18
|
|
|
18
19
|
function Header(_a) {
|
|
19
20
|
var _b, _c;
|
|
20
|
-
var
|
|
21
|
+
var children = _a.children, logoImage = _a.logoImage, logOut = _a.logOut, logOutLabel = _a.logOutLabel, _d = _a.lowerContainerMaxWidth, lowerContainerMaxWidth = _d === void 0 ? (_b = designTokens.theme.constants) === null || _b === void 0 ? void 0 : _b.pageContentMaxWidth : _d, _e = _a.topLinkHref, topLinkHref = _e === void 0 ? '/' : _e, topLinkLabel = _a.topLinkLabel;
|
|
21
22
|
var device = utils.useDetectDevice();
|
|
22
23
|
return (React__default["default"].createElement(Header_styles.Wrapper, null,
|
|
23
24
|
topLinkLabel && topLinkHref && (React__default["default"].createElement(HeaderLink.HeaderLink, { icon: React__default["default"].createElement(icons.Icons.ChevronLeft, { width: 20, height: 20, color: (_c = designTokens.theme.palette) === null || _c === void 0 ? void 0 : _c.white }), linkHref: topLinkHref, linkLabel: topLinkLabel })),
|
|
24
25
|
(logoImage || logOutLabel) && (React__default["default"].createElement(Header_styles.HeaderWrapper, null,
|
|
25
26
|
React__default["default"].createElement(Header_styles.HeaderContainer, { maxWidth: lowerContainerMaxWidth },
|
|
26
27
|
logoImage && React__default["default"].createElement(Logo.Logo, { logoImage: logoImage }),
|
|
27
|
-
logOut && (React__default["default"].createElement(CgButton.CgButton, { onClick: function () { return logOut && logOut(); }, variant:
|
|
28
|
+
logOut && (React__default["default"].createElement(CgButton.CgButton, { onClick: function () { return logOut && logOut(); }, variant: CgButton_types.EButtonVariant.secondary, size: device.isMobile ? CgButton_types.EButtonSize.medium : CgButton_types.EButtonSize.large }, logOutLabel))))),
|
|
28
29
|
children && React__default["default"].createElement(Header_styles.MenuContainer, null, children)));
|
|
29
30
|
}
|
|
30
31
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Header.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|