@telia/teddy 0.0.68 → 0.0.70
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/dist/components/card/card-carousel.cjs +36 -0
- package/dist/components/card/card-carousel.d.ts +15 -0
- package/dist/components/card/card-carousel.js +36 -0
- package/dist/components/card/card-slot.cjs +4 -3
- package/dist/components/card/card-slot.js +4 -3
- package/dist/components/card/card.cjs +49 -47
- package/dist/components/card/card.js +49 -47
- package/dist/components/card/index.cjs +4 -1
- package/dist/components/card/index.d.ts +3 -0
- package/dist/components/card/index.js +4 -1
- package/dist/components/carousel/carousel-root.cjs +99 -0
- package/dist/components/carousel/carousel-root.d.ts +15 -0
- package/dist/components/carousel/carousel-root.js +99 -0
- package/dist/components/carousel/index.cjs +4 -0
- package/dist/components/carousel/index.d.ts +2 -0
- package/dist/components/carousel/index.js +4 -0
- package/dist/components/color-dot/color-dot-root.cjs +10 -8
- package/dist/components/color-dot/color-dot-root.d.ts +2 -0
- package/dist/components/color-dot/color-dot-root.js +10 -8
- package/dist/components/color-dot/index.d.ts +1 -0
- package/dist/components/index.cjs +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/modal/modal.cjs +1 -0
- package/dist/components/modal/modal.js +1 -0
- package/dist/components/navigation-menu/navigation-menu.cjs +1 -0
- package/dist/components/navigation-menu/navigation-menu.js +1 -0
- package/dist/components/radio-card-group/radio-card-group-content.cjs +1 -0
- package/dist/components/radio-card-group/radio-card-group-content.js +1 -0
- package/dist/components/radio-card-group/radio-card-group-item-body.cjs +1 -0
- package/dist/components/radio-card-group/radio-card-group-item-body.js +1 -0
- package/dist/components/radio-card-group/radio-card-group-item-title.cjs +1 -0
- package/dist/components/radio-card-group/radio-card-group-item-title.js +1 -0
- package/dist/components/radio-card-group/radio-card-group-item.cjs +1 -0
- package/dist/components/radio-card-group/radio-card-group-item.js +1 -0
- package/dist/main.cjs +2 -0
- package/dist/main.js +2 -0
- package/dist/style.css +776 -104
- package/dist/utils/useIsClientSide.cjs +16 -0
- package/dist/utils/useIsClientSide.d.ts +1 -0
- package/dist/utils/useIsClientSide.js +16 -0
- package/package.json +5 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const clsx = require("clsx");
|
|
6
|
+
const components_card_card = require("./card.cjs");
|
|
7
|
+
const components_carousel_carouselRoot = require("../carousel/carousel-root.cjs");
|
|
8
|
+
const components_colorDot_index = require("../color-dot/index.cjs");
|
|
9
|
+
const ImageSlider = React.forwardRef(
|
|
10
|
+
({ variants, className, children, onClickNext, onClickPrev, onChangeVariant = () => void 0 }, forwardRef) => {
|
|
11
|
+
const [selectedSlide, setSelectedSlide] = React.useState(0);
|
|
12
|
+
const rootCarouselClass = `${components_card_card.rootClassName}__carousel`;
|
|
13
|
+
const classes = clsx([components_card_card.styles[rootCarouselClass]], className);
|
|
14
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: forwardRef, className: classes, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
15
|
+
components_carousel_carouselRoot.Carousel,
|
|
16
|
+
{
|
|
17
|
+
size: "sm",
|
|
18
|
+
onClickNext,
|
|
19
|
+
onClickPrev,
|
|
20
|
+
settings: {
|
|
21
|
+
beforeChange: (_currentSlide, nextSlide) => {
|
|
22
|
+
setSelectedSlide(nextSlide);
|
|
23
|
+
onChangeVariant(variants[nextSlide]);
|
|
24
|
+
},
|
|
25
|
+
customPaging: (index) => {
|
|
26
|
+
const variant = variants[index];
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsx(components_colorDot_index.ColorDot, { color: variant.color, size: "xs", bordered: true, wide: index === selectedSlide });
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
children
|
|
31
|
+
}
|
|
32
|
+
) });
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
ImageSlider.displayName = "ImageSlider";
|
|
36
|
+
exports.ImageSlider = ImageSlider;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export type ImageSliderVariant = {
|
|
4
|
+
color: string;
|
|
5
|
+
url: string;
|
|
6
|
+
};
|
|
7
|
+
export interface ImageSliderProps {
|
|
8
|
+
variants: ImageSliderVariant[];
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
onClickNext?: () => void;
|
|
12
|
+
onClickPrev?: () => void;
|
|
13
|
+
onChangeVariant?: (variant: ImageSliderVariant) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const ImageSlider: React.ForwardRefExoticComponent<ImageSliderProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React__default, { useState } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { s as styles, rootClassName } from "./card.js";
|
|
5
|
+
import { Carousel } from "../carousel/carousel-root.js";
|
|
6
|
+
import { ColorDot } from "../color-dot/index.js";
|
|
7
|
+
const ImageSlider = React__default.forwardRef(
|
|
8
|
+
({ variants, className, children, onClickNext, onClickPrev, onChangeVariant = () => void 0 }, forwardRef) => {
|
|
9
|
+
const [selectedSlide, setSelectedSlide] = useState(0);
|
|
10
|
+
const rootCarouselClass = `${rootClassName}__carousel`;
|
|
11
|
+
const classes = clsx([styles[rootCarouselClass]], className);
|
|
12
|
+
return /* @__PURE__ */ jsx("div", { ref: forwardRef, className: classes, children: /* @__PURE__ */ jsx(
|
|
13
|
+
Carousel,
|
|
14
|
+
{
|
|
15
|
+
size: "sm",
|
|
16
|
+
onClickNext,
|
|
17
|
+
onClickPrev,
|
|
18
|
+
settings: {
|
|
19
|
+
beforeChange: (_currentSlide, nextSlide) => {
|
|
20
|
+
setSelectedSlide(nextSlide);
|
|
21
|
+
onChangeVariant(variants[nextSlide]);
|
|
22
|
+
},
|
|
23
|
+
customPaging: (index) => {
|
|
24
|
+
const variant = variants[index];
|
|
25
|
+
return /* @__PURE__ */ jsx(ColorDot, { color: variant.color, size: "xs", bordered: true, wide: index === selectedSlide });
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
children
|
|
29
|
+
}
|
|
30
|
+
) });
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
ImageSlider.displayName = "ImageSlider";
|
|
34
|
+
export {
|
|
35
|
+
ImageSlider
|
|
36
|
+
};
|
|
@@ -9,8 +9,8 @@ const getOffsets = (layout, align) => {
|
|
|
9
9
|
switch (layout) {
|
|
10
10
|
case "product":
|
|
11
11
|
return {
|
|
12
|
-
top: "
|
|
13
|
-
right: "
|
|
12
|
+
top: "100",
|
|
13
|
+
right: "100"
|
|
14
14
|
};
|
|
15
15
|
default:
|
|
16
16
|
return {
|
|
@@ -30,7 +30,8 @@ const Slot = React.forwardRef(
|
|
|
30
30
|
components_card_card.styles[`${components_card_card.rootClassName}__slot`],
|
|
31
31
|
{
|
|
32
32
|
[components_card_card.styles[`${components_card_card.rootClassName}__slot--center`]]: align === "top" || align === "bottom",
|
|
33
|
-
[components_card_card.styles[`${components_card_card.rootClassName}__slot--bottom`]]: align == null ? void 0 : align.includes("bottom")
|
|
33
|
+
[components_card_card.styles[`${components_card_card.rootClassName}__slot--bottom`]]: align == null ? void 0 : align.includes("bottom"),
|
|
34
|
+
[components_card_card.styles[`${components_card_card.rootClassName}__slot--no-translate`]]: layout === "product"
|
|
34
35
|
}
|
|
35
36
|
],
|
|
36
37
|
className
|
|
@@ -7,8 +7,8 @@ const getOffsets = (layout, align) => {
|
|
|
7
7
|
switch (layout) {
|
|
8
8
|
case "product":
|
|
9
9
|
return {
|
|
10
|
-
top: "
|
|
11
|
-
right: "
|
|
10
|
+
top: "100",
|
|
11
|
+
right: "100"
|
|
12
12
|
};
|
|
13
13
|
default:
|
|
14
14
|
return {
|
|
@@ -28,7 +28,8 @@ const Slot = React__default.forwardRef(
|
|
|
28
28
|
styles[`${rootClassName}__slot`],
|
|
29
29
|
{
|
|
30
30
|
[styles[`${rootClassName}__slot--center`]]: align === "top" || align === "bottom",
|
|
31
|
-
[styles[`${rootClassName}__slot--bottom`]]: align == null ? void 0 : align.includes("bottom")
|
|
31
|
+
[styles[`${rootClassName}__slot--bottom`]]: align == null ? void 0 : align.includes("bottom"),
|
|
32
|
+
[styles[`${rootClassName}__slot--no-translate`]]: layout === "product"
|
|
32
33
|
}
|
|
33
34
|
],
|
|
34
35
|
className
|
|
@@ -7,53 +7,55 @@ const utils_composeEventHandlers = require("../../utils/composeEventHandlers.cjs
|
|
|
7
7
|
const components_grid_grid = require("../grid/grid.cjs");
|
|
8
8
|
const tokens_color_variables = require("../../tokens/color/variables.cjs");
|
|
9
9
|
const styles = {
|
|
10
|
-
"teddy-card": "_teddy-
|
|
11
|
-
"teddy-card__slot": "_teddy-
|
|
12
|
-
"teddy-card__slot--bottom": "_teddy-card__slot--
|
|
13
|
-
"teddy-card__slot--center": "_teddy-card__slot--
|
|
14
|
-
"teddy-
|
|
15
|
-
"teddy-
|
|
16
|
-
"teddy-card__action
|
|
17
|
-
"teddy-
|
|
18
|
-
"teddy-card--
|
|
19
|
-
"teddy-
|
|
20
|
-
"teddy-
|
|
21
|
-
"teddy-
|
|
22
|
-
"teddy-
|
|
23
|
-
"teddy-
|
|
24
|
-
"teddy-
|
|
25
|
-
"teddy-
|
|
26
|
-
"teddy-
|
|
27
|
-
"teddy-
|
|
28
|
-
"teddy-
|
|
29
|
-
"teddy-
|
|
30
|
-
"teddy-
|
|
31
|
-
"teddy-card--
|
|
32
|
-
"teddy-card--navigation-
|
|
33
|
-
"teddy-card--
|
|
34
|
-
"teddy-
|
|
35
|
-
"teddy-card--
|
|
36
|
-
"teddy-
|
|
37
|
-
"teddy-card--
|
|
38
|
-
"teddy-card--
|
|
39
|
-
"teddy-card--
|
|
40
|
-
"teddy-card--
|
|
41
|
-
"teddy-
|
|
42
|
-
"teddy-
|
|
43
|
-
"teddy-
|
|
44
|
-
"teddy-
|
|
45
|
-
"teddy-
|
|
46
|
-
"teddy-
|
|
47
|
-
"teddy-card__inset
|
|
48
|
-
"teddy-card__inset--
|
|
49
|
-
"teddy-card__inset--
|
|
50
|
-
"teddy-
|
|
51
|
-
"teddy-
|
|
52
|
-
"teddy-card__availability--
|
|
53
|
-
"teddy-card__availability--
|
|
54
|
-
"teddy-card__availability--
|
|
55
|
-
"teddy-card__availability--
|
|
56
|
-
"teddy-card__availability--
|
|
10
|
+
"teddy-card": "_teddy-card_1vcct_3",
|
|
11
|
+
"teddy-card__slot": "_teddy-card__slot_1vcct_13",
|
|
12
|
+
"teddy-card__slot--bottom": "_teddy-card__slot--bottom_1vcct_16",
|
|
13
|
+
"teddy-card__slot--center": "_teddy-card__slot--center_1vcct_19",
|
|
14
|
+
"teddy-card__slot--no-translate": "_teddy-card__slot--no-translate_1vcct_25",
|
|
15
|
+
"teddy-card--shadow": "_teddy-card--shadow_1vcct_44",
|
|
16
|
+
"teddy-card__action": "_teddy-card__action_1vcct_48",
|
|
17
|
+
"teddy-card__action--disabled": "_teddy-card__action--disabled_1vcct_48",
|
|
18
|
+
"teddy-card--border": "_teddy-card--border_1vcct_55",
|
|
19
|
+
"teddy-card--layout": "_teddy-card--layout_1vcct_58",
|
|
20
|
+
"teddy-card__illustration": "_teddy-card__illustration_1vcct_58",
|
|
21
|
+
"teddy-card__carousel": "_teddy-card__carousel_1vcct_61",
|
|
22
|
+
"teddy-card__content": "_teddy-card__content_1vcct_64",
|
|
23
|
+
"teddy-card__heading": "_teddy-card__heading_1vcct_67",
|
|
24
|
+
"teddy-card__action-wrapper": "_teddy-card__action-wrapper_1vcct_70",
|
|
25
|
+
"teddy-card__footer": "_teddy-card__footer_1vcct_73",
|
|
26
|
+
"teddy-card__overline": "_teddy-card__overline_1vcct_76",
|
|
27
|
+
"teddy-card__description": "_teddy-card__description_1vcct_79",
|
|
28
|
+
"teddy-card__color-dots": "_teddy-card__color-dots_1vcct_82",
|
|
29
|
+
"teddy-card__availability": "_teddy-card__availability_1vcct_85",
|
|
30
|
+
"teddy-card__price": "_teddy-card__price_1vcct_88",
|
|
31
|
+
"teddy-card--default": "_teddy-card--default_1vcct_91",
|
|
32
|
+
"teddy-card--navigation-vertical": "_teddy-card--navigation-vertical_1vcct_96",
|
|
33
|
+
"teddy-card--navigation-horizontal-small": "_teddy-card--navigation-horizontal-small_1vcct_115",
|
|
34
|
+
"teddy-card--navigation-horizontal-large": "_teddy-card--navigation-horizontal-large_1vcct_127",
|
|
35
|
+
"teddy-card--rich-card": "_teddy-card--rich-card_1vcct_139",
|
|
36
|
+
"teddy-card__line": "_teddy-card__line_1vcct_157",
|
|
37
|
+
"teddy-card--purple-light": "_teddy-card--purple-light_1vcct_161",
|
|
38
|
+
"teddy-card--purple-dark": "_teddy-card--purple-dark_1vcct_175",
|
|
39
|
+
"teddy-card--white": "_teddy-card--white_1vcct_194",
|
|
40
|
+
"teddy-card--gray": "_teddy-card--gray_1vcct_208",
|
|
41
|
+
"teddy-card--beige": "_teddy-card--beige_1vcct_222",
|
|
42
|
+
"teddy-card--product": "_teddy-card--product_1vcct_236",
|
|
43
|
+
"teddy-card__price--big": "_teddy-card__price--big_1vcct_296",
|
|
44
|
+
"teddy-card__image--as-background": "_teddy-card__image--as-background_1vcct_299",
|
|
45
|
+
"teddy-card--background-image": "_teddy-card--background-image_1vcct_305",
|
|
46
|
+
"teddy-card__illustration--rounded": "_teddy-card__illustration--rounded_1vcct_310",
|
|
47
|
+
"teddy-card__inset": "_teddy-card__inset_1vcct_314",
|
|
48
|
+
"teddy-card__inset--top": "_teddy-card__inset--top_1vcct_317",
|
|
49
|
+
"teddy-card__inset--left": "_teddy-card__inset--left_1vcct_320",
|
|
50
|
+
"teddy-card__inset--right": "_teddy-card__inset--right_1vcct_323",
|
|
51
|
+
"teddy-card__inset--bottom": "_teddy-card__inset--bottom_1vcct_326",
|
|
52
|
+
"teddy-card__availability--badge": "_teddy-card__availability--badge_1vcct_341",
|
|
53
|
+
"teddy-card__availability--success": "_teddy-card__availability--success_1vcct_344",
|
|
54
|
+
"teddy-card__availability--warning": "_teddy-card__availability--warning_1vcct_347",
|
|
55
|
+
"teddy-card__availability--error": "_teddy-card__availability--error_1vcct_350",
|
|
56
|
+
"teddy-card__availability--special": "_teddy-card__availability--special_1vcct_353",
|
|
57
|
+
"teddy-card__availability--neutral": "_teddy-card__availability--neutral_1vcct_356",
|
|
58
|
+
"teddy-card__availability--information": "_teddy-card__availability--information_1vcct_359"
|
|
57
59
|
};
|
|
58
60
|
const rootClassName = "teddy-card";
|
|
59
61
|
const actionElementIdentifier = `${rootClassName}__action`;
|
|
@@ -5,53 +5,55 @@ import { composeEventHandlers } from "../../utils/composeEventHandlers.js";
|
|
|
5
5
|
import { Grid } from "../grid/grid.js";
|
|
6
6
|
import { teddyColorTransparentWhite850, teddyColorTransparentWhite800, teddyColorTransparentWhite100, teddyColorTransparentBlack600, teddyColorTransparentBlack200 } from "../../tokens/color/variables.js";
|
|
7
7
|
const styles = {
|
|
8
|
-
"teddy-card": "_teddy-
|
|
9
|
-
"teddy-card__slot": "_teddy-
|
|
10
|
-
"teddy-card__slot--bottom": "_teddy-card__slot--
|
|
11
|
-
"teddy-card__slot--center": "_teddy-card__slot--
|
|
12
|
-
"teddy-
|
|
13
|
-
"teddy-
|
|
14
|
-
"teddy-card__action
|
|
15
|
-
"teddy-
|
|
16
|
-
"teddy-card--
|
|
17
|
-
"teddy-
|
|
18
|
-
"teddy-
|
|
19
|
-
"teddy-
|
|
20
|
-
"teddy-
|
|
21
|
-
"teddy-
|
|
22
|
-
"teddy-
|
|
23
|
-
"teddy-
|
|
24
|
-
"teddy-
|
|
25
|
-
"teddy-
|
|
26
|
-
"teddy-
|
|
27
|
-
"teddy-
|
|
28
|
-
"teddy-
|
|
29
|
-
"teddy-card--
|
|
30
|
-
"teddy-card--navigation-
|
|
31
|
-
"teddy-card--
|
|
32
|
-
"teddy-
|
|
33
|
-
"teddy-card--
|
|
34
|
-
"teddy-
|
|
35
|
-
"teddy-card--
|
|
36
|
-
"teddy-card--
|
|
37
|
-
"teddy-card--
|
|
38
|
-
"teddy-card--
|
|
39
|
-
"teddy-
|
|
40
|
-
"teddy-
|
|
41
|
-
"teddy-
|
|
42
|
-
"teddy-
|
|
43
|
-
"teddy-
|
|
44
|
-
"teddy-
|
|
45
|
-
"teddy-card__inset
|
|
46
|
-
"teddy-card__inset--
|
|
47
|
-
"teddy-card__inset--
|
|
48
|
-
"teddy-
|
|
49
|
-
"teddy-
|
|
50
|
-
"teddy-card__availability--
|
|
51
|
-
"teddy-card__availability--
|
|
52
|
-
"teddy-card__availability--
|
|
53
|
-
"teddy-card__availability--
|
|
54
|
-
"teddy-card__availability--
|
|
8
|
+
"teddy-card": "_teddy-card_1vcct_3",
|
|
9
|
+
"teddy-card__slot": "_teddy-card__slot_1vcct_13",
|
|
10
|
+
"teddy-card__slot--bottom": "_teddy-card__slot--bottom_1vcct_16",
|
|
11
|
+
"teddy-card__slot--center": "_teddy-card__slot--center_1vcct_19",
|
|
12
|
+
"teddy-card__slot--no-translate": "_teddy-card__slot--no-translate_1vcct_25",
|
|
13
|
+
"teddy-card--shadow": "_teddy-card--shadow_1vcct_44",
|
|
14
|
+
"teddy-card__action": "_teddy-card__action_1vcct_48",
|
|
15
|
+
"teddy-card__action--disabled": "_teddy-card__action--disabled_1vcct_48",
|
|
16
|
+
"teddy-card--border": "_teddy-card--border_1vcct_55",
|
|
17
|
+
"teddy-card--layout": "_teddy-card--layout_1vcct_58",
|
|
18
|
+
"teddy-card__illustration": "_teddy-card__illustration_1vcct_58",
|
|
19
|
+
"teddy-card__carousel": "_teddy-card__carousel_1vcct_61",
|
|
20
|
+
"teddy-card__content": "_teddy-card__content_1vcct_64",
|
|
21
|
+
"teddy-card__heading": "_teddy-card__heading_1vcct_67",
|
|
22
|
+
"teddy-card__action-wrapper": "_teddy-card__action-wrapper_1vcct_70",
|
|
23
|
+
"teddy-card__footer": "_teddy-card__footer_1vcct_73",
|
|
24
|
+
"teddy-card__overline": "_teddy-card__overline_1vcct_76",
|
|
25
|
+
"teddy-card__description": "_teddy-card__description_1vcct_79",
|
|
26
|
+
"teddy-card__color-dots": "_teddy-card__color-dots_1vcct_82",
|
|
27
|
+
"teddy-card__availability": "_teddy-card__availability_1vcct_85",
|
|
28
|
+
"teddy-card__price": "_teddy-card__price_1vcct_88",
|
|
29
|
+
"teddy-card--default": "_teddy-card--default_1vcct_91",
|
|
30
|
+
"teddy-card--navigation-vertical": "_teddy-card--navigation-vertical_1vcct_96",
|
|
31
|
+
"teddy-card--navigation-horizontal-small": "_teddy-card--navigation-horizontal-small_1vcct_115",
|
|
32
|
+
"teddy-card--navigation-horizontal-large": "_teddy-card--navigation-horizontal-large_1vcct_127",
|
|
33
|
+
"teddy-card--rich-card": "_teddy-card--rich-card_1vcct_139",
|
|
34
|
+
"teddy-card__line": "_teddy-card__line_1vcct_157",
|
|
35
|
+
"teddy-card--purple-light": "_teddy-card--purple-light_1vcct_161",
|
|
36
|
+
"teddy-card--purple-dark": "_teddy-card--purple-dark_1vcct_175",
|
|
37
|
+
"teddy-card--white": "_teddy-card--white_1vcct_194",
|
|
38
|
+
"teddy-card--gray": "_teddy-card--gray_1vcct_208",
|
|
39
|
+
"teddy-card--beige": "_teddy-card--beige_1vcct_222",
|
|
40
|
+
"teddy-card--product": "_teddy-card--product_1vcct_236",
|
|
41
|
+
"teddy-card__price--big": "_teddy-card__price--big_1vcct_296",
|
|
42
|
+
"teddy-card__image--as-background": "_teddy-card__image--as-background_1vcct_299",
|
|
43
|
+
"teddy-card--background-image": "_teddy-card--background-image_1vcct_305",
|
|
44
|
+
"teddy-card__illustration--rounded": "_teddy-card__illustration--rounded_1vcct_310",
|
|
45
|
+
"teddy-card__inset": "_teddy-card__inset_1vcct_314",
|
|
46
|
+
"teddy-card__inset--top": "_teddy-card__inset--top_1vcct_317",
|
|
47
|
+
"teddy-card__inset--left": "_teddy-card__inset--left_1vcct_320",
|
|
48
|
+
"teddy-card__inset--right": "_teddy-card__inset--right_1vcct_323",
|
|
49
|
+
"teddy-card__inset--bottom": "_teddy-card__inset--bottom_1vcct_326",
|
|
50
|
+
"teddy-card__availability--badge": "_teddy-card__availability--badge_1vcct_341",
|
|
51
|
+
"teddy-card__availability--success": "_teddy-card__availability--success_1vcct_344",
|
|
52
|
+
"teddy-card__availability--warning": "_teddy-card__availability--warning_1vcct_347",
|
|
53
|
+
"teddy-card__availability--error": "_teddy-card__availability--error_1vcct_350",
|
|
54
|
+
"teddy-card__availability--special": "_teddy-card__availability--special_1vcct_353",
|
|
55
|
+
"teddy-card__availability--neutral": "_teddy-card__availability--neutral_1vcct_356",
|
|
56
|
+
"teddy-card__availability--information": "_teddy-card__availability--information_1vcct_359"
|
|
55
57
|
};
|
|
56
58
|
const rootClassName = "teddy-card";
|
|
57
59
|
const actionElementIdentifier = `${rootClassName}__action`;
|
|
@@ -14,6 +14,7 @@ const components_card_cardDescription = require("./card-description.cjs");
|
|
|
14
14
|
const components_card_cardAvailability = require("./card-availability.cjs");
|
|
15
15
|
const components_card_cardColorDots = require("./card-color-dots.cjs");
|
|
16
16
|
const components_card_cardPrice = require("./card-price.cjs");
|
|
17
|
+
const components_card_cardCarousel = require("./card-carousel.cjs");
|
|
17
18
|
components_card_card.Root.displayName = "Card";
|
|
18
19
|
components_card_cardButton.Button.displayName = "Card.Button";
|
|
19
20
|
components_card_cardContent.Content.displayName = "Card.Content";
|
|
@@ -28,6 +29,7 @@ components_card_cardDescription.Description.displayName = "Card.Description";
|
|
|
28
29
|
components_card_cardAvailability.Availability.displayName = "Card.Availability";
|
|
29
30
|
components_card_cardColorDots.ColorDots.displayName = "Card.ColorDots";
|
|
30
31
|
components_card_cardPrice.Price.displayName = "Card.Price";
|
|
32
|
+
components_card_cardCarousel.ImageSlider.displayName = "Card.ImageSlider";
|
|
31
33
|
const Card = Object.assign(components_card_card.Root, {
|
|
32
34
|
Heading: components_card_cardHeading.Heading,
|
|
33
35
|
Button: components_card_cardButton.Button,
|
|
@@ -41,6 +43,7 @@ const Card = Object.assign(components_card_card.Root, {
|
|
|
41
43
|
Description: components_card_cardDescription.Description,
|
|
42
44
|
Availability: components_card_cardAvailability.Availability,
|
|
43
45
|
ColorDots: components_card_cardColorDots.ColorDots,
|
|
44
|
-
Price: components_card_cardPrice.Price
|
|
46
|
+
Price: components_card_cardPrice.Price,
|
|
47
|
+
ImageSlider: components_card_cardCarousel.ImageSlider
|
|
45
48
|
});
|
|
46
49
|
exports.Card = Card;
|
|
@@ -12,6 +12,7 @@ import { DescriptionProps } from './card-description';
|
|
|
12
12
|
import { AvailabilityProps } from './card-availability';
|
|
13
13
|
import { ColorDotsProps } from './card-color-dots';
|
|
14
14
|
import { PriceProps } from './card-price';
|
|
15
|
+
import { ImageSliderProps } from './card-carousel';
|
|
15
16
|
|
|
16
17
|
export declare const Card: import('react').ForwardRefExoticComponent<RootProps & import('react').RefAttributes<HTMLDivElement>> & {
|
|
17
18
|
Heading: import('react').ForwardRefExoticComponent<HeadingProps & import('react').RefAttributes<HTMLHeadingElement>>;
|
|
@@ -38,6 +39,7 @@ export declare const Card: import('react').ForwardRefExoticComponent<RootProps &
|
|
|
38
39
|
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
39
40
|
ColorDots: import('react').ForwardRefExoticComponent<ColorDotsProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
40
41
|
Price: import('react').ForwardRefExoticComponent<PriceProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
42
|
+
ImageSlider: import('react').ForwardRefExoticComponent<ImageSliderProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
41
43
|
};
|
|
42
44
|
export type CardProps = {
|
|
43
45
|
Root: RootProps;
|
|
@@ -54,4 +56,5 @@ export type CardProps = {
|
|
|
54
56
|
Availability: AvailabilityProps;
|
|
55
57
|
ColorDots: ColorDotsProps;
|
|
56
58
|
Price: PriceProps;
|
|
59
|
+
ImageSlider: ImageSliderProps;
|
|
57
60
|
};
|
|
@@ -12,6 +12,7 @@ import { Description } from "./card-description.js";
|
|
|
12
12
|
import { Availability } from "./card-availability.js";
|
|
13
13
|
import { ColorDots } from "./card-color-dots.js";
|
|
14
14
|
import { Price } from "./card-price.js";
|
|
15
|
+
import { ImageSlider } from "./card-carousel.js";
|
|
15
16
|
Root.displayName = "Card";
|
|
16
17
|
Button.displayName = "Card.Button";
|
|
17
18
|
Content.displayName = "Card.Content";
|
|
@@ -26,6 +27,7 @@ Description.displayName = "Card.Description";
|
|
|
26
27
|
Availability.displayName = "Card.Availability";
|
|
27
28
|
ColorDots.displayName = "Card.ColorDots";
|
|
28
29
|
Price.displayName = "Card.Price";
|
|
30
|
+
ImageSlider.displayName = "Card.ImageSlider";
|
|
29
31
|
const Card = Object.assign(Root, {
|
|
30
32
|
Heading,
|
|
31
33
|
Button,
|
|
@@ -39,7 +41,8 @@ const Card = Object.assign(Root, {
|
|
|
39
41
|
Description,
|
|
40
42
|
Availability,
|
|
41
43
|
ColorDots,
|
|
42
|
-
Price
|
|
44
|
+
Price,
|
|
45
|
+
ImageSlider
|
|
43
46
|
});
|
|
44
47
|
export {
|
|
45
48
|
Card
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const clsx = require("clsx");
|
|
6
|
+
const Slider = require("react-slick");
|
|
7
|
+
require("../../assets/sprite.269ba410-teddy.svg");
|
|
8
|
+
const components_icon_icon = require("../icon/icon.cjs");
|
|
9
|
+
const tokens_color_variables = require("../../tokens/color/variables.cjs");
|
|
10
|
+
const styles = {
|
|
11
|
+
"teddy-carousel": "_teddy-carousel_1p2ww_2",
|
|
12
|
+
"teddy-carousel__arrow": "_teddy-carousel__arrow_1p2ww_9",
|
|
13
|
+
"teddy-carousel__item": "_teddy-carousel__item_1p2ww_18",
|
|
14
|
+
"teddy-carousel--sm": "_teddy-carousel--sm_1p2ww_82"
|
|
15
|
+
};
|
|
16
|
+
const rootClassName = "teddy-carousel";
|
|
17
|
+
const CustomArrow = ({
|
|
18
|
+
className,
|
|
19
|
+
icon,
|
|
20
|
+
onClick = () => void 0,
|
|
21
|
+
handleClick = () => void 0,
|
|
22
|
+
ariaLabel
|
|
23
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
24
|
+
"button",
|
|
25
|
+
{
|
|
26
|
+
type: "button",
|
|
27
|
+
"aria-label": ariaLabel,
|
|
28
|
+
className: clsx([styles[`${rootClassName}__arrow`], className]),
|
|
29
|
+
onClick: (event) => {
|
|
30
|
+
event.stopPropagation();
|
|
31
|
+
onClick();
|
|
32
|
+
handleClick();
|
|
33
|
+
},
|
|
34
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: icon, color: tokens_color_variables.teddyColorTextInteractivePrimary, size: "md" })
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
const Carousel = ({
|
|
38
|
+
children,
|
|
39
|
+
className = "",
|
|
40
|
+
onClickNext,
|
|
41
|
+
onClickPrev,
|
|
42
|
+
navigationIcon,
|
|
43
|
+
settings,
|
|
44
|
+
size = "lg"
|
|
45
|
+
}) => {
|
|
46
|
+
const computedSettings = {
|
|
47
|
+
responsive: [],
|
|
48
|
+
centerMode: false,
|
|
49
|
+
slidesPerRow: 1,
|
|
50
|
+
nextArrow: /* @__PURE__ */ jsxRuntime.jsx(CustomArrow, { icon: navigationIcon ?? "arrow-right", handleClick: onClickNext, ariaLabel: "Neste" }),
|
|
51
|
+
prevArrow: /* @__PURE__ */ jsxRuntime.jsx(CustomArrow, { icon: navigationIcon ?? "arrow-left", handleClick: onClickPrev, ariaLabel: "Forrige" }),
|
|
52
|
+
slidesToScroll: 1,
|
|
53
|
+
speed: 500,
|
|
54
|
+
dots: true,
|
|
55
|
+
lazyLoad: "ondemand",
|
|
56
|
+
...settings
|
|
57
|
+
};
|
|
58
|
+
const [swiped, setSwiped] = React.useState(false);
|
|
59
|
+
const handleSwiped = React.useCallback(() => {
|
|
60
|
+
setSwiped(true);
|
|
61
|
+
}, [setSwiped]);
|
|
62
|
+
const handleOnItemClick = React.useCallback(
|
|
63
|
+
(e) => {
|
|
64
|
+
if (swiped) {
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
setSwiped(false);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
[swiped]
|
|
71
|
+
);
|
|
72
|
+
const filteredChildren = React.Children.toArray(children).filter((child) => !!child);
|
|
73
|
+
const SliderComponent = Slider.default ? Slider.default : Slider;
|
|
74
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
75
|
+
"section",
|
|
76
|
+
{
|
|
77
|
+
className: clsx(styles[`${rootClassName}`], {
|
|
78
|
+
[styles[`${rootClassName}--${size}`]]: size,
|
|
79
|
+
[className]: className
|
|
80
|
+
}),
|
|
81
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SliderComponent, { ...computedSettings, onSwipe: handleSwiped, children: React.Children.map(filteredChildren, (child) => {
|
|
82
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
83
|
+
"div",
|
|
84
|
+
{
|
|
85
|
+
onClick: (e) => {
|
|
86
|
+
e.stopPropagation();
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
},
|
|
89
|
+
onClickCapture: handleOnItemClick,
|
|
90
|
+
className: clsx(styles[`${rootClassName}__item`]),
|
|
91
|
+
children: child
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}) })
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
Carousel.displayName = "Carousel";
|
|
99
|
+
exports.Carousel = Carousel;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Settings } from 'react-slick';
|
|
3
|
+
import { IconName } from '../icon';
|
|
4
|
+
|
|
5
|
+
export type CarouselProps = {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
navigationIcon?: IconName;
|
|
9
|
+
settings?: Settings;
|
|
10
|
+
size?: 'sm' | 'lg';
|
|
11
|
+
onClickNext?: () => void;
|
|
12
|
+
onClickPrev?: () => void;
|
|
13
|
+
};
|
|
14
|
+
/** Carousel to show images in. Can be fully customized by utlizing underlying 'settings' props mapped with react-slick */
|
|
15
|
+
export declare const Carousel: React.FC<CarouselProps>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React__default, { useState, useCallback } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import Slider from "react-slick";
|
|
5
|
+
import "../../assets/sprite.269ba410-teddy.svg";
|
|
6
|
+
import { Icon } from "../icon/icon.js";
|
|
7
|
+
import { teddyColorTextInteractivePrimary } from "../../tokens/color/variables.js";
|
|
8
|
+
const styles = {
|
|
9
|
+
"teddy-carousel": "_teddy-carousel_1p2ww_2",
|
|
10
|
+
"teddy-carousel__arrow": "_teddy-carousel__arrow_1p2ww_9",
|
|
11
|
+
"teddy-carousel__item": "_teddy-carousel__item_1p2ww_18",
|
|
12
|
+
"teddy-carousel--sm": "_teddy-carousel--sm_1p2ww_82"
|
|
13
|
+
};
|
|
14
|
+
const rootClassName = "teddy-carousel";
|
|
15
|
+
const CustomArrow = ({
|
|
16
|
+
className,
|
|
17
|
+
icon,
|
|
18
|
+
onClick = () => void 0,
|
|
19
|
+
handleClick = () => void 0,
|
|
20
|
+
ariaLabel
|
|
21
|
+
}) => /* @__PURE__ */ jsx(
|
|
22
|
+
"button",
|
|
23
|
+
{
|
|
24
|
+
type: "button",
|
|
25
|
+
"aria-label": ariaLabel,
|
|
26
|
+
className: clsx([styles[`${rootClassName}__arrow`], className]),
|
|
27
|
+
onClick: (event) => {
|
|
28
|
+
event.stopPropagation();
|
|
29
|
+
onClick();
|
|
30
|
+
handleClick();
|
|
31
|
+
},
|
|
32
|
+
children: /* @__PURE__ */ jsx(Icon, { name: icon, color: teddyColorTextInteractivePrimary, size: "md" })
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
const Carousel = ({
|
|
36
|
+
children,
|
|
37
|
+
className = "",
|
|
38
|
+
onClickNext,
|
|
39
|
+
onClickPrev,
|
|
40
|
+
navigationIcon,
|
|
41
|
+
settings,
|
|
42
|
+
size = "lg"
|
|
43
|
+
}) => {
|
|
44
|
+
const computedSettings = {
|
|
45
|
+
responsive: [],
|
|
46
|
+
centerMode: false,
|
|
47
|
+
slidesPerRow: 1,
|
|
48
|
+
nextArrow: /* @__PURE__ */ jsx(CustomArrow, { icon: navigationIcon ?? "arrow-right", handleClick: onClickNext, ariaLabel: "Neste" }),
|
|
49
|
+
prevArrow: /* @__PURE__ */ jsx(CustomArrow, { icon: navigationIcon ?? "arrow-left", handleClick: onClickPrev, ariaLabel: "Forrige" }),
|
|
50
|
+
slidesToScroll: 1,
|
|
51
|
+
speed: 500,
|
|
52
|
+
dots: true,
|
|
53
|
+
lazyLoad: "ondemand",
|
|
54
|
+
...settings
|
|
55
|
+
};
|
|
56
|
+
const [swiped, setSwiped] = useState(false);
|
|
57
|
+
const handleSwiped = useCallback(() => {
|
|
58
|
+
setSwiped(true);
|
|
59
|
+
}, [setSwiped]);
|
|
60
|
+
const handleOnItemClick = useCallback(
|
|
61
|
+
(e) => {
|
|
62
|
+
if (swiped) {
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
setSwiped(false);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
[swiped]
|
|
69
|
+
);
|
|
70
|
+
const filteredChildren = React__default.Children.toArray(children).filter((child) => !!child);
|
|
71
|
+
const SliderComponent = Slider.default ? Slider.default : Slider;
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
73
|
+
"section",
|
|
74
|
+
{
|
|
75
|
+
className: clsx(styles[`${rootClassName}`], {
|
|
76
|
+
[styles[`${rootClassName}--${size}`]]: size,
|
|
77
|
+
[className]: className
|
|
78
|
+
}),
|
|
79
|
+
children: /* @__PURE__ */ jsx(SliderComponent, { ...computedSettings, onSwipe: handleSwiped, children: React__default.Children.map(filteredChildren, (child) => {
|
|
80
|
+
return /* @__PURE__ */ jsx(
|
|
81
|
+
"div",
|
|
82
|
+
{
|
|
83
|
+
onClick: (e) => {
|
|
84
|
+
e.stopPropagation();
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
},
|
|
87
|
+
onClickCapture: handleOnItemClick,
|
|
88
|
+
className: clsx(styles[`${rootClassName}__item`]),
|
|
89
|
+
children: child
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}) })
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
Carousel.displayName = "Carousel";
|
|
97
|
+
export {
|
|
98
|
+
Carousel
|
|
99
|
+
};
|