@vodafone_de/brix-components 7.0.6 → 7.0.8
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/README.md +1 -0
- package/dist/{FontWeight-DEBGHbtO.js → FontWeight-CR22KTex.js} +2 -2
- package/dist/components/Accordion/index.js +1 -1
- package/dist/components/Badge/index.js +1 -1
- package/dist/components/Body/index.js +1 -1
- package/dist/components/Button/index.js +2 -2
- package/dist/components/ButtonAsLink/index.js +1 -1
- package/dist/components/ButtonGroup/index.js +1 -1
- package/dist/components/Carousel/components/CarouselContext.d.ts +3 -2
- package/dist/components/Carousel/index.js +41 -52
- package/dist/components/Carousel/utils/useScrollSpy.d.ts +2 -0
- package/dist/components/ConsentMessage/index.js +1 -1
- package/dist/components/ConsentMessage/styled.d.ts +1 -1
- package/dist/components/DemoBox/index.js +1 -1
- package/dist/components/Dialog/index.js +1 -1
- package/dist/components/Dialog/styled.d.ts +1 -1
- package/dist/components/DiscoveryCard/index.js +5 -5
- package/dist/components/DiscoveryCard/styled.d.ts +1 -1
- package/dist/components/DiscoveryCardGroup/index.js +1 -1
- package/dist/components/GoogleMap/styled.d.ts +1 -1
- package/dist/components/Heading/index.js +1 -1
- package/dist/components/IconButton/index.js +1 -1
- package/dist/components/IconSnippet/index.js +3 -4
- package/dist/components/IconSnippet/props.d.ts +2 -2
- package/dist/components/IconSnippet/styled.d.ts +1 -1
- package/dist/components/ImageHeader/index.js +4 -4
- package/dist/components/ImageHeader/styled.d.ts +4 -4
- package/dist/components/InlineLink/index.js +1 -1
- package/dist/components/Legend/index.js +1 -1
- package/dist/components/Link/index.js +1 -1
- package/dist/components/LinkAsButton/index.js +1 -1
- package/dist/components/LinkListItem/index.js +1 -1
- package/dist/components/Notification/index.js +1 -1
- package/dist/components/PickerGroup/index.js +2 -2
- package/dist/components/Price/index.js +1 -1
- package/dist/components/ProductCard/index.js +3 -3
- package/dist/components/RichText/index.js +1 -1
- package/dist/components/SearchInput/index.js +1 -1
- package/dist/components/SearchInput/styled.d.ts +1 -1
- package/dist/components/Stepper/index.js +2 -2
- package/dist/components/TabularPrice/index.js +1 -1
- package/dist/components/TextList/index.js +1 -1
- package/dist/components/Tray/index.js +1 -1
- package/dist/components/YoutubeVideo/index.js +2 -1
- package/dist/hooks/useViewport/index.js +22 -5
- package/dist/{index-BRs8j3Vq.js → index-BeSd-V81.js} +1 -1
- package/dist/{index-DrySIh-D.js → index-C5GzK6_0.js} +1 -1
- package/dist/{index-57IF0yrd.js → index-C7meHOM4.js} +2 -2
- package/dist/{index-CKvLGUdD.js → index-ZHkR70j3.js} +1 -1
- package/dist/{index-WLBo71sp.js → index-aUJfXBUI.js} +1 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.js +119 -129
- package/dist/{styled-DLS1p_AJ.js → styled-BSqC5P9h.js} +1 -1
- package/package.json +1 -1
- package/dist/components/MediaText/index.d.ts +0 -5
- package/dist/components/MediaText/index.js +0 -121
- package/dist/components/MediaText/props.d.ts +0 -42
- package/dist/components/MediaText/styled.d.ts +0 -4
- package/dist/components/Rating/assets/StarSVG.d.ts +0 -3
- package/dist/components/Rating/index.d.ts +0 -6
- package/dist/components/Rating/index.js +0 -153
- package/dist/components/Rating/props.d.ts +0 -22
- package/dist/components/Rating/styled.d.ts +0 -6
- package/dist/index-Cs0Hw0dj.js +0 -25
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import Flex from "../Flex/index.js";
|
|
5
|
-
import FlexItem from "../FlexItem/index.js";
|
|
6
|
-
import Heading, { headingAlignLeft } from "../Heading/index.js";
|
|
7
|
-
import Image, { aspectRatio16_9 } from "../Image/index.js";
|
|
8
|
-
import Link from "../Link/index.js";
|
|
9
|
-
import { g as getUid, R as RichText } from "../../index-BRs8j3Vq.js";
|
|
10
|
-
import YoutubeVideo from "../YoutubeVideo/index.js";
|
|
11
|
-
import { u as ulTagName, d as divTagName, l as liTagName } from "../../tags-DI6H1biK.js";
|
|
12
|
-
import { a as fontWeightRegular } from "../../FontWeight-DEBGHbtO.js";
|
|
13
|
-
import { b as textHeadingSm, t as textHeadingXs } from "../../HeadingSize-CfCRn3Lh.js";
|
|
14
|
-
import { s as spacingMd, e as spacing2Xs, c as spacingSm, b as spacingNone } from "../../Spacing-D0HQH9YJ.js";
|
|
15
|
-
import { u as useViewport } from "../../index-Cs0Hw0dj.js";
|
|
16
|
-
import styled from "styled-components";
|
|
17
|
-
import { v as viewport } from "../../index-Ck2bCrhT.js";
|
|
18
|
-
import { getBottomSpacing } from "../../foundations/token/getBottomSpacing/index.js";
|
|
19
|
-
import { getSpacing } from "../../foundations/token/getSpacing/index.js";
|
|
20
|
-
import { f as filterProps } from "../../filterProps-Cewck8OH.js";
|
|
21
|
-
import { a as flexOrientationVertical, f as flexOrientationHorizontal, b as flexJustifyStart } from "../../styled-B0YKfXTz.js";
|
|
22
|
-
const mediaTextOrientationTop = "top";
|
|
23
|
-
const mediaTextOrientationLeft = "left";
|
|
24
|
-
const mediaTextOrientationRight = "right";
|
|
25
|
-
const MediaTextStyled = styled.div.withConfig({
|
|
26
|
-
shouldForwardProp: filterProps(),
|
|
27
|
-
displayName: "MediaTextStyled",
|
|
28
|
-
componentId: "sc-zs2pry-0"
|
|
29
|
-
})(({
|
|
30
|
-
orientation,
|
|
31
|
-
bottomSpacing = spacingMd
|
|
32
|
-
}) => ({
|
|
33
|
-
display: "flex",
|
|
34
|
-
flexDirection: "column",
|
|
35
|
-
...viewport.md({
|
|
36
|
-
flexDirection: orientation === "top" ? "column" : orientation === "left" ? "row" : "row-reverse"
|
|
37
|
-
}),
|
|
38
|
-
...getBottomSpacing({
|
|
39
|
-
bottomSpacing
|
|
40
|
-
})
|
|
41
|
-
}));
|
|
42
|
-
const MediaTextMediaStyled = styled.div.withConfig({
|
|
43
|
-
shouldForwardProp: filterProps(),
|
|
44
|
-
displayName: "MediaTextMediaStyled",
|
|
45
|
-
componentId: "sc-zs2pry-1"
|
|
46
|
-
})(({
|
|
47
|
-
orientation,
|
|
48
|
-
bottomSpacing = spacingMd
|
|
49
|
-
}) => ({
|
|
50
|
-
flex: 1,
|
|
51
|
-
...getBottomSpacing({
|
|
52
|
-
bottomSpacing
|
|
53
|
-
}),
|
|
54
|
-
...viewport.md({
|
|
55
|
-
...orientation != mediaTextOrientationTop ? {
|
|
56
|
-
marginBottom: 0
|
|
57
|
-
} : {}
|
|
58
|
-
})
|
|
59
|
-
}));
|
|
60
|
-
const MediaTextContentStyled = styled.div.withConfig({
|
|
61
|
-
shouldForwardProp: filterProps(),
|
|
62
|
-
displayName: "MediaTextContentStyled",
|
|
63
|
-
componentId: "sc-zs2pry-2"
|
|
64
|
-
})(({
|
|
65
|
-
orientation
|
|
66
|
-
}) => ({
|
|
67
|
-
flex: 1,
|
|
68
|
-
...viewport.md({
|
|
69
|
-
...orientation === "left" && {
|
|
70
|
-
paddingLeft: getSpacing(spacingMd)
|
|
71
|
-
},
|
|
72
|
-
...orientation === "right" && {
|
|
73
|
-
paddingRight: getSpacing(spacingMd)
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
}));
|
|
77
|
-
const MediaText = ({
|
|
78
|
-
media,
|
|
79
|
-
orientation = mediaTextOrientationLeft,
|
|
80
|
-
heading,
|
|
81
|
-
subline,
|
|
82
|
-
richText,
|
|
83
|
-
action,
|
|
84
|
-
...props
|
|
85
|
-
}) => {
|
|
86
|
-
const headingId = `heading-${getUid()}`;
|
|
87
|
-
const sublineId = `subline-${getUid()}`;
|
|
88
|
-
const viewport2 = useViewport();
|
|
89
|
-
const headingSpacing = subline ? spacing2Xs : spacingMd;
|
|
90
|
-
const hasMultipleActions = Array.isArray(action) && action.length > 1;
|
|
91
|
-
const actionFlexAs = hasMultipleActions ? ulTagName : divTagName;
|
|
92
|
-
const linkFlexItemAs = hasMultipleActions ? liTagName : divTagName;
|
|
93
|
-
const renderMedia = (media2) => {
|
|
94
|
-
if (!media2) return null;
|
|
95
|
-
switch (media2.component) {
|
|
96
|
-
case "Image":
|
|
97
|
-
return /* @__PURE__ */ jsx(Image, { ...media2, aspectRatio: aspectRatio16_9, bottomSpacing: spacingNone });
|
|
98
|
-
case "YoutubeVideo":
|
|
99
|
-
return /* @__PURE__ */ jsx(YoutubeVideo, { ...media2, bottomSpacing: spacingNone });
|
|
100
|
-
default:
|
|
101
|
-
console.warn(`Unsupported media component: ${media2.component}`);
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
const mediaContent = useMemo(() => renderMedia(media), [media]);
|
|
106
|
-
return /* @__PURE__ */ jsxs(MediaTextStyled, { orientation, ...props, children: [
|
|
107
|
-
/* @__PURE__ */ jsx(MediaTextMediaStyled, { orientation, children: mediaContent }),
|
|
108
|
-
/* @__PURE__ */ jsxs(MediaTextContentStyled, { orientation, children: [
|
|
109
|
-
/* @__PURE__ */ jsx(Heading, { ...heading, id: headingId, align: headingAlignLeft, size: textHeadingSm, bottomSpacing: headingSpacing }),
|
|
110
|
-
subline && /* @__PURE__ */ jsx(Heading, { ...subline, id: sublineId, align: headingAlignLeft, size: textHeadingXs, weight: fontWeightRegular, bottomSpacing: spacingMd }),
|
|
111
|
-
/* @__PURE__ */ jsx(RichText, { ...richText, bottomSpacing: spacingMd }),
|
|
112
|
-
/* @__PURE__ */ jsx(Flex, { bottomSpacing: spacingMd, gapSpacing: spacingSm, justify: flexJustifyStart, orientation: "sm" === viewport2 ? flexOrientationVertical : flexOrientationHorizontal, as: actionFlexAs, children: action && action.map((action2) => /* @__PURE__ */ jsx(FlexItem, { as: linkFlexItemAs, bottomSpacing: spacingNone, children: /* @__PURE__ */ jsx(Link, { ...action2 }) }, action2.uid)) })
|
|
113
|
-
] })
|
|
114
|
-
] });
|
|
115
|
-
};
|
|
116
|
-
export {
|
|
117
|
-
MediaText as default,
|
|
118
|
-
mediaTextOrientationLeft,
|
|
119
|
-
mediaTextOrientationRight,
|
|
120
|
-
mediaTextOrientationTop
|
|
121
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'react';
|
|
2
|
-
import { HeadingProps } from '../Heading/props';
|
|
3
|
-
import { ImageProps } from '../Image';
|
|
4
|
-
import { LinkProps } from '../Link';
|
|
5
|
-
import { RichTextProps } from '../RichText';
|
|
6
|
-
import { YoutubeVideoProps } from '../YoutubeVideo';
|
|
7
|
-
import { PatternProps } from '../../foundations/PatternProps';
|
|
8
|
-
export declare const mediaTextOrientationTop = "top";
|
|
9
|
-
export declare const mediaTextOrientationLeft = "left";
|
|
10
|
-
export declare const mediaTextOrientationRight = "right";
|
|
11
|
-
export type MediaTextOrientation = typeof mediaTextOrientationTop | typeof mediaTextOrientationLeft | typeof mediaTextOrientationRight;
|
|
12
|
-
export interface MediaTextProps extends PatternProps, HTMLAttributes<HTMLDivElement> {
|
|
13
|
-
/**
|
|
14
|
-
* Pin component's name from string to the concrete name
|
|
15
|
-
*/
|
|
16
|
-
component?: 'MediaText';
|
|
17
|
-
/**
|
|
18
|
-
* media prop can be either an Image or a YoutubeVideo
|
|
19
|
-
* The aspect ratio is always 16 to 1. This must be taken into account when selecting the asset.
|
|
20
|
-
*/
|
|
21
|
-
media: Omit<ImageProps, 'bottomSpacing'> | Omit<YoutubeVideoProps, 'bottomSpacing'>;
|
|
22
|
-
/**
|
|
23
|
-
* MediaText media can be orientated top, left or right.
|
|
24
|
-
*/
|
|
25
|
-
orientation?: MediaTextOrientation;
|
|
26
|
-
/**
|
|
27
|
-
* Heading
|
|
28
|
-
*/
|
|
29
|
-
heading: Omit<HeadingProps, 'size' | 'weight' | 'bottomSpacing'>;
|
|
30
|
-
/**
|
|
31
|
-
* Subline
|
|
32
|
-
*/
|
|
33
|
-
subline?: Omit<HeadingProps, 'size' | 'weight' | 'bottomSpacing'>;
|
|
34
|
-
/**
|
|
35
|
-
* Body
|
|
36
|
-
*/
|
|
37
|
-
richText: Omit<RichTextProps, 'bottomSpacing'>;
|
|
38
|
-
/**
|
|
39
|
-
* Action, list of links
|
|
40
|
-
*/
|
|
41
|
-
action?: LinkProps[];
|
|
42
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { MediaTextProps } from './props';
|
|
2
|
-
export declare const MediaTextStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Pick<MediaTextProps, "orientation" | "bottomSpacing">>> & string;
|
|
3
|
-
export declare const MediaTextMediaStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Pick<MediaTextProps, "orientation" | "bottomSpacing">>> & string;
|
|
4
|
-
export declare const MediaTextContentStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Pick<MediaTextProps, "orientation">>> & string;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
declare const StarSVG: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.SVGProps<SVGSVGElement>, never>> & string & Omit<(props: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element, keyof React.Component<any, {}, any>>;
|
|
3
|
-
export default StarSVG;
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useEffect, useRef } from "react";
|
|
4
|
-
import Fieldset from "../Fieldset/index.js";
|
|
5
|
-
import styled from "styled-components";
|
|
6
|
-
import { u as useViewport, v as viewportSm } from "../../index-Cs0Hw0dj.js";
|
|
7
|
-
import { getBorderColor } from "../../foundations/token/getBorderColor/index.js";
|
|
8
|
-
import { getBorderWidth } from "../../foundations/token/getBorderWidth/index.js";
|
|
9
|
-
import { getHoverColor } from "../../foundations/token/getHoverColor/index.js";
|
|
10
|
-
import { getObjectColor } from "../../foundations/token/getObjectColor/index.js";
|
|
11
|
-
import { getSpacing } from "../../foundations/token/getSpacing/index.js";
|
|
12
|
-
import { c as colorBackgroundNeutral } from "../../BackgroundColor-e0N9tdDR.js";
|
|
13
|
-
import { c as colorBorderFocus, i as colorBorderSelected, a as colorBorderNeutral, b as colorBorderUnselected } from "../../BorderColor-BummoQ1-.js";
|
|
14
|
-
import { a as borderWidthFocus } from "../../BorderWidth-DfOlyKK7.js";
|
|
15
|
-
import { b as colorObjectSelected } from "../../ObjectColor-BZDBuV8H.js";
|
|
16
|
-
import { a as spacingXs } from "../../Spacing-D0HQH9YJ.js";
|
|
17
|
-
const StarSVGBase = (props) => {
|
|
18
|
-
const viewport = useViewport();
|
|
19
|
-
let width = 32;
|
|
20
|
-
let height = 30.624;
|
|
21
|
-
if (viewport === viewportSm) {
|
|
22
|
-
width = 24;
|
|
23
|
-
height = 22.968;
|
|
24
|
-
}
|
|
25
|
-
return /* @__PURE__ */ jsx("svg", { style: {
|
|
26
|
-
display: "inline-block"
|
|
27
|
-
}, width, height, viewBox: "0 0 26 25", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M1 9.95223L9.26911 8.58599L12.8296 1L16.6847 8.44108L25 9.48408L19.1147 15.449L20.6911 23.6799L13.199 19.9252L5.85987 23.9682L7.11465 15.6831L1 9.95223Z", fill: "white", stroke: "#7E7E7E", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
28
|
-
};
|
|
29
|
-
const StarSVG = styled(StarSVGBase).withConfig({
|
|
30
|
-
displayName: "StarSVG",
|
|
31
|
-
componentId: "sc-iheyat-0"
|
|
32
|
-
})([""]);
|
|
33
|
-
const getSvgPathStyles = (props) => ({
|
|
34
|
-
fill: props.selected ? getObjectColor(colorObjectSelected) : props.isInHoverRange ? getHoverColor(colorBackgroundNeutral) : "transparent",
|
|
35
|
-
strokeWidth: "1px",
|
|
36
|
-
stroke: props.selected ? getBorderColor(colorBorderSelected) : props.isInHoverRange ? getBorderColor(colorBorderNeutral) : getBorderColor(colorBorderUnselected)
|
|
37
|
-
});
|
|
38
|
-
const getHoverSvgPathStyles = (props) => ({
|
|
39
|
-
fill: props.selected ? getHoverColor(colorObjectSelected) : getHoverColor(colorBackgroundNeutral),
|
|
40
|
-
strokeWidth: "1px",
|
|
41
|
-
stroke: props.selected ? getBorderColor(colorBorderSelected) : getBorderColor(colorBorderNeutral)
|
|
42
|
-
});
|
|
43
|
-
const StarsWrapperStyled = styled.div.withConfig({
|
|
44
|
-
displayName: "StarsWrapperStyled",
|
|
45
|
-
componentId: "sc-1nbg0l6-0"
|
|
46
|
-
})({
|
|
47
|
-
display: "flex",
|
|
48
|
-
gap: getSpacing(spacingXs)
|
|
49
|
-
});
|
|
50
|
-
const StarLabelStyled = styled.label.withConfig({
|
|
51
|
-
displayName: "StarLabelStyled",
|
|
52
|
-
componentId: "sc-1nbg0l6-1"
|
|
53
|
-
})(({
|
|
54
|
-
selected,
|
|
55
|
-
isInHoverRange
|
|
56
|
-
}) => {
|
|
57
|
-
const normalStyles = getSvgPathStyles({
|
|
58
|
-
selected,
|
|
59
|
-
isInHoverRange
|
|
60
|
-
});
|
|
61
|
-
const hoverStyles = getHoverSvgPathStyles({
|
|
62
|
-
selected
|
|
63
|
-
});
|
|
64
|
-
return {
|
|
65
|
-
cursor: "pointer",
|
|
66
|
-
display: "inline-flex",
|
|
67
|
-
alignItems: "center",
|
|
68
|
-
justifyContent: "center",
|
|
69
|
-
svg: {
|
|
70
|
-
path: {
|
|
71
|
-
...normalStyles,
|
|
72
|
-
transition: "fill 200ms, stroke 200ms"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
"&:hover svg path": {
|
|
76
|
-
...hoverStyles,
|
|
77
|
-
transition: "fill 200ms, stroke 200ms"
|
|
78
|
-
},
|
|
79
|
-
// Apply focus-visible styles on label when input is focused
|
|
80
|
-
"&:has(:focus-visible)": {
|
|
81
|
-
outline: `${getBorderWidth(borderWidthFocus)} solid ${getBorderColor(colorBorderFocus)}`,
|
|
82
|
-
outlineOffset: "2px"
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
|
-
const HiddenRadioStyled = styled.input.withConfig({
|
|
87
|
-
displayName: "HiddenRadioStyled",
|
|
88
|
-
componentId: "sc-1nbg0l6-2"
|
|
89
|
-
})({
|
|
90
|
-
border: 0,
|
|
91
|
-
clip: "rect(0 0 0 0)",
|
|
92
|
-
clipPath: "inset(50%)",
|
|
93
|
-
height: "1px",
|
|
94
|
-
margin: "-1px",
|
|
95
|
-
overflow: "hidden",
|
|
96
|
-
padding: 0,
|
|
97
|
-
position: "absolute",
|
|
98
|
-
whiteSpace: "nowrap",
|
|
99
|
-
width: "1px"
|
|
100
|
-
});
|
|
101
|
-
const Rating = ({
|
|
102
|
-
value,
|
|
103
|
-
onUpdate,
|
|
104
|
-
className,
|
|
105
|
-
groupName,
|
|
106
|
-
uid,
|
|
107
|
-
component: _component,
|
|
108
|
-
...props
|
|
109
|
-
}) => {
|
|
110
|
-
const [internalValue, setInternalValue] = useState(value ?? 0);
|
|
111
|
-
const [hoverValue, setHoverValue] = useState(null);
|
|
112
|
-
useEffect(() => {
|
|
113
|
-
if (value !== void 0) {
|
|
114
|
-
setInternalValue(value);
|
|
115
|
-
}
|
|
116
|
-
}, [value]);
|
|
117
|
-
const handleChange = (event) => {
|
|
118
|
-
const newValue = Number(event.target.value);
|
|
119
|
-
setInternalValue(newValue);
|
|
120
|
-
if (onUpdate) {
|
|
121
|
-
onUpdate(newValue);
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
const handleMouseEnter = (index) => {
|
|
125
|
-
setHoverValue(index + 1);
|
|
126
|
-
};
|
|
127
|
-
const handleMouseLeave = () => {
|
|
128
|
-
setHoverValue(null);
|
|
129
|
-
};
|
|
130
|
-
const handleClick = (starValue) => {
|
|
131
|
-
if (starValue === internalValue) {
|
|
132
|
-
setInternalValue(0);
|
|
133
|
-
if (onUpdate) {
|
|
134
|
-
onUpdate(0);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
const ref = useRef(null);
|
|
139
|
-
return /* @__PURE__ */ jsx(Fieldset, { ...props, uid, ref, children: /* @__PURE__ */ jsx(StarsWrapperStyled, { className, role: "radiogroup", children: [...Array(5)].map((_, index) => {
|
|
140
|
-
const starValue = index + 1;
|
|
141
|
-
const isInHoverRange = hoverValue !== null && starValue <= hoverValue;
|
|
142
|
-
return /* @__PURE__ */ jsxs(StarLabelStyled, { selected: starValue <= internalValue, isInHoverRange, htmlFor: `${uid}-star-${starValue}`, onMouseEnter: () => handleMouseEnter(index), onMouseLeave: handleMouseLeave, "aria-label": `${starValue} von 5 Sternen`, children: [
|
|
143
|
-
/* @__PURE__ */ jsx(HiddenRadioStyled, { type: "radio", id: `${uid}-star-${starValue}`, name: groupName || uid, value: starValue, checked: starValue === internalValue, onChange: handleChange, onClick: () => handleClick(starValue) }),
|
|
144
|
-
/* @__PURE__ */ jsx(StarSVG, {})
|
|
145
|
-
] }, `star-${starValue}-${uid}`);
|
|
146
|
-
}) }) });
|
|
147
|
-
};
|
|
148
|
-
export {
|
|
149
|
-
HiddenRadioStyled,
|
|
150
|
-
StarLabelStyled,
|
|
151
|
-
StarsWrapperStyled,
|
|
152
|
-
Rating as default
|
|
153
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { FieldsetSharedProps } from '../Fieldset';
|
|
2
|
-
/**
|
|
3
|
-
* Props for the Rating component
|
|
4
|
-
*/
|
|
5
|
-
export interface RatingProps extends Omit<FieldsetSharedProps, 'status' | 'errorMessage' | 'disabled' | 'helperText'> {
|
|
6
|
-
/**
|
|
7
|
-
* The current rating value (number of stars selected)
|
|
8
|
-
*/
|
|
9
|
-
value?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Callback fired when the rating value changes
|
|
12
|
-
*/
|
|
13
|
-
onUpdate?: (value: number) => void;
|
|
14
|
-
/**
|
|
15
|
-
* Optional group name to identify the rating group for accessibility
|
|
16
|
-
*/
|
|
17
|
-
groupName?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Pin component's name from string to the concrete name
|
|
20
|
-
*/
|
|
21
|
-
component?: 'Rating';
|
|
22
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const StarsWrapperStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
|
-
export declare const StarLabelStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, {
|
|
3
|
-
selected: boolean;
|
|
4
|
-
isInHoverRange?: boolean;
|
|
5
|
-
}>> & string;
|
|
6
|
-
export declare const HiddenRadioStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>> & string;
|
package/dist/index-Cs0Hw0dj.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from "react";
|
|
2
|
-
import { l as largeMediaQuery, m as mediumMediaQuery } from "./index-Ck2bCrhT.js";
|
|
3
|
-
import { useMediaQuery } from "./hooks/useMediaQuery/index.js";
|
|
4
|
-
const viewportSm = "sm";
|
|
5
|
-
const viewportMd = "md";
|
|
6
|
-
const viewportLg = "lg";
|
|
7
|
-
const useViewport = () => {
|
|
8
|
-
const tablet = useMediaQuery(mediumMediaQuery);
|
|
9
|
-
const desktop = useMediaQuery(largeMediaQuery);
|
|
10
|
-
const [viewportState, setViewportState] = useState(viewportSm);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
if (desktop) {
|
|
13
|
-
setViewportState(viewportLg);
|
|
14
|
-
} else if (tablet) {
|
|
15
|
-
setViewportState(viewportMd);
|
|
16
|
-
} else {
|
|
17
|
-
setViewportState(viewportSm);
|
|
18
|
-
}
|
|
19
|
-
}, [tablet, desktop]);
|
|
20
|
-
return viewportState;
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
useViewport as u,
|
|
24
|
-
viewportSm as v
|
|
25
|
-
};
|