@vodafone_de/brix-components 3.0.1 → 3.0.2
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/BackgroundColor-JObp_2xA.js +14 -0
- package/dist/BorderColor-BummoQ1-.js +24 -0
- package/dist/BorderRadius-ClUShVLu.js +10 -0
- package/dist/BorderWidth-DfOlyKK7.js +16 -0
- package/dist/CornerStyle-JEbGNArR.js +6 -0
- package/dist/FontWeight-CR22KTex.js +8 -0
- package/dist/HeadingSize-CfCRn3Lh.js +12 -0
- package/dist/IconColor-CtC9WUgr.js +10 -0
- package/dist/ObjectColor-BZDBuV8H.js +22 -0
- package/dist/Opacity-smkGiwsf.js +6 -0
- package/dist/SizeTypes-Ck_RdzIf.js +8 -0
- package/dist/Spacing-D0HQH9YJ.js +16 -0
- package/dist/TextBodySize-BcZR9mh2.js +6 -0
- package/dist/TextColor-BXiR5Uq9.js +16 -0
- package/dist/colorUtils-uLZF5UIN.js +94 -0
- package/dist/components/Accordion/index.js +195 -0
- package/dist/components/AccordionGroup/index.js +59 -0
- package/dist/components/Badge/index.js +11 -0
- package/dist/components/Body/index.js +72 -6
- package/dist/components/BottomBar/index.js +79 -0
- package/dist/components/Button/index.js +24 -0
- package/dist/components/ButtonAsLink/index.js +7 -0
- package/dist/components/ButtonGroup/index.js +34 -0
- package/dist/components/Card/index.js +18 -0
- package/dist/components/Carousel/index.js +497 -0
- package/dist/components/Checkbox/index.js +218 -0
- package/dist/components/CheckboxGroup/index.js +58 -0
- package/dist/components/Collapsible/index.js +85 -0
- package/dist/components/ColorSwatch/index.js +87 -0
- package/dist/components/ColorSwatchGroup/index.js +43 -0
- package/dist/components/Container/index.js +76 -0
- package/dist/components/DateInput/index.js +86 -0
- package/dist/components/DemoBox/index.js +21 -0
- package/dist/components/Dialog/index.js +172 -0
- package/dist/components/DiscoveryCard/index.js +130 -0
- package/dist/components/DiscoveryCardGroup/index.js +53 -0
- package/dist/components/Divider/index.js +30 -0
- package/dist/components/Fieldset/index.js +41 -0
- package/dist/components/FilterGroup/index.js +148 -0
- package/dist/components/Flex/index.js +17 -0
- package/dist/components/FlexItem/index.js +41 -0
- package/dist/components/FootnoteContent/index.js +39 -0
- package/dist/components/FootnoteLink/index.js +46 -0
- package/dist/components/Form/index.js +20 -0
- package/dist/components/FormElement/index.js +31 -0
- package/dist/components/FormHelperLabel/index.js +21 -0
- package/dist/components/FormHelperMessage/index.js +47 -0
- package/dist/components/FormHelperStatusIcon/index.js +50 -0
- package/dist/components/GoogleMap/index.js +196 -0
- package/dist/components/Grid/index.js +39 -0
- package/dist/components/GridItem/index.js +12 -0
- package/dist/components/Heading/index.js +94 -0
- package/dist/components/HifiIcon/index.js +31 -0
- package/dist/components/Icon/index.js +38 -0
- package/dist/components/IconButton/index.js +85 -0
- package/dist/components/IconSnippet/index.js +112 -0
- package/dist/components/IconSnippet/styled.d.ts +1 -1
- package/dist/components/IconSnippetList/index.js +25 -0
- package/dist/components/Image/index.js +84 -0
- package/dist/components/ImageHeader/index.js +262 -0
- package/dist/components/ImageHeader/styled.d.ts +4 -4
- package/dist/components/InlineLink/index.js +43 -0
- package/dist/components/Input/index.js +55 -0
- package/dist/components/Label/index.js +22 -0
- package/dist/components/Legend/index.js +60 -0
- package/dist/components/Link/index.js +19 -0
- package/dist/components/LinkAsButton/index.js +7 -0
- package/dist/components/LinkList/index.js +64 -0
- package/dist/components/LinkListItem/index.js +316 -0
- package/dist/components/LoadingSpinner/index.js +70 -0
- package/dist/components/Notification/index.js +181 -0
- package/dist/components/Overlay/index.js +33 -0
- package/dist/components/PickerGroup/index.js +282 -0
- package/dist/components/Price/index.js +18 -0
- package/dist/components/ProductCard/index.js +81 -0
- package/dist/components/RadioGroup/index.js +197 -0
- package/dist/components/ResponsiveImage/index.js +89 -0
- package/dist/components/RichText/index.js +7 -0
- package/dist/components/ScreenreaderOnly/index.js +6 -0
- package/dist/components/SearchInput/index.js +140 -0
- package/dist/components/SelectInput/index.js +160 -0
- package/dist/components/Stepper/index.js +205 -0
- package/dist/components/SuggestInput/index.js +387 -0
- package/dist/components/Switch/index.js +169 -0
- package/dist/components/TabularPrice/index.js +8 -0
- package/dist/components/TextList/index.js +10 -0
- package/dist/components/Textarea/index.js +156 -0
- package/dist/components/Tray/index.js +218 -0
- package/dist/easing-Dm-pO8SY.js +6 -0
- package/dist/filterProps-Cewck8OH.js +13 -0
- package/dist/foundations/GlobalStyle/index.js +3 -292
- package/dist/foundations/PatternProps/index.js +1 -0
- package/dist/foundations/media-query/forcedColors/index.js +12 -0
- package/dist/foundations/media-query/reducedMotion/index.js +21 -0
- package/dist/foundations/media-query/viewport/index.js +6 -0
- package/dist/foundations/token/getBackgroundColor/index.js +5 -0
- package/dist/foundations/token/getBodySize/index.js +13 -2
- package/dist/foundations/token/getBorderColor/index.js +5 -0
- package/dist/foundations/token/getBorderRadius/index.js +15 -0
- package/dist/foundations/token/getBorderWidth/index.js +19 -0
- package/dist/foundations/token/getBottomSpacing/index.js +14 -0
- package/dist/foundations/token/getFontWeight/index.js +13 -0
- package/dist/foundations/token/getHeadingSize/index.js +27 -0
- package/dist/foundations/token/getHoverColor/index.js +7 -0
- package/dist/foundations/token/getIconColor/index.js +5 -0
- package/dist/foundations/token/getObjectColor/index.js +5 -0
- package/dist/foundations/token/getOpacity/index.js +11 -0
- package/dist/foundations/token/getPressColor/index.js +7 -0
- package/dist/foundations/token/getSpacing/index.js +5 -0
- package/dist/foundations/token/getTextColor/index.js +5 -0
- package/dist/foundations/token/getTextDecoration/index.js +13 -0
- package/dist/getCssVar-BP6T9pFM.js +6 -0
- package/dist/hooks/useFocusWithin/index.js +36 -0
- package/dist/hooks/useForcedColors/index.js +9 -0
- package/dist/hooks/useMediaQuery/index.js +19 -0
- package/dist/hooks/useReducedMotion/index.js +9 -0
- package/dist/hooks/useThirdPartyConsent/index.js +54 -0
- package/dist/hooks/useViewport/index.js +24 -0
- package/dist/index-BXLT6ke-.js +79 -0
- package/dist/index-C4XnzWFL.js +61 -0
- package/dist/index-CeJsIf3Z.js +208 -0
- package/dist/index-Ck2bCrhT.js +32 -0
- package/dist/index-CzTqNQTT.js +79 -0
- package/dist/index-D6hvbziL.js +167 -0
- package/dist/index-DQhtQZ85.js +24 -0
- package/dist/props-Czq9XX2J.js +6 -0
- package/dist/{index-BaPlSfS3.js → renderInlineRichTextFromOpenText-CA52y1-B.js} +3 -105
- package/dist/shadow-u158mzuN.js +4 -0
- package/dist/styled-BpvuD699.js +45 -0
- package/dist/styled-CDWclYAa.js +124 -0
- package/dist/styled-CXSdomF5.js +34 -0
- package/dist/styled-CpoX5USb.js +71 -0
- package/dist/styled-DZo6MwrF.js +245 -0
- package/dist/styled-FNJyDkPV.js +165 -0
- package/dist/styled-Wlt68LfQ.js +133 -0
- package/dist/styled-ZpQohvyx.js +29 -0
- package/dist/tags-DI6H1biK.js +29 -0
- package/package.json +2 -1
- package/dist/index-BoPDwZgt.js +0 -18
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useRef, useEffect, createElement } from "react";
|
|
4
|
+
import Fieldset from "../Fieldset/index.js";
|
|
5
|
+
import Flex from "../Flex/index.js";
|
|
6
|
+
import { i as inputStateError } from "../../props-Czq9XX2J.js";
|
|
7
|
+
import { a as spacingXs, b as spacingNone, c as spacingSm } from "../../Spacing-D0HQH9YJ.js";
|
|
8
|
+
import styled from "styled-components";
|
|
9
|
+
import Label from "../Label/index.js";
|
|
10
|
+
import forcedColors from "../../foundations/media-query/forcedColors/index.js";
|
|
11
|
+
import { getBodySize } from "../../foundations/token/getBodySize/index.js";
|
|
12
|
+
import { getBorderColor } from "../../foundations/token/getBorderColor/index.js";
|
|
13
|
+
import { getBorderRadius } from "../../foundations/token/getBorderRadius/index.js";
|
|
14
|
+
import { getBorderWidth } from "../../foundations/token/getBorderWidth/index.js";
|
|
15
|
+
import { getObjectColor } from "../../foundations/token/getObjectColor/index.js";
|
|
16
|
+
import { getOpacity } from "../../foundations/token/getOpacity/index.js";
|
|
17
|
+
import { c as colorBorderFocus, e as colorBorderCritical, i as colorBorderSelected, b as colorBorderUnselected } from "../../BorderColor-BummoQ1-.js";
|
|
18
|
+
import { c as borderRadiusFull } from "../../BorderRadius-ClUShVLu.js";
|
|
19
|
+
import { a as borderWidthFocus } from "../../BorderWidth-DfOlyKK7.js";
|
|
20
|
+
import { b as colorObjectSelected, a as colorObjectInverse } from "../../ObjectColor-BZDBuV8H.js";
|
|
21
|
+
import { a as opacityDisabled } from "../../Opacity-smkGiwsf.js";
|
|
22
|
+
import { f as filterProps } from "../../filterProps-Cewck8OH.js";
|
|
23
|
+
const RadioContainer = styled(Flex).withConfig({
|
|
24
|
+
shouldForwardProp: filterProps(["disabled"]),
|
|
25
|
+
displayName: "RadioContainer",
|
|
26
|
+
componentId: "sc-qti4z3-0"
|
|
27
|
+
})({
|
|
28
|
+
alignItems: "flex-start",
|
|
29
|
+
width: "max-content",
|
|
30
|
+
flexWrap: "nowrap"
|
|
31
|
+
}, ({
|
|
32
|
+
disabled
|
|
33
|
+
}) => {
|
|
34
|
+
if (disabled) {
|
|
35
|
+
return {
|
|
36
|
+
pointerEvents: "none",
|
|
37
|
+
opacity: getOpacity(opacityDisabled)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const RadioStyled = styled.div.withConfig({
|
|
42
|
+
shouldForwardProp: filterProps(),
|
|
43
|
+
displayName: "RadioStyled",
|
|
44
|
+
componentId: "sc-qti4z3-1"
|
|
45
|
+
})({
|
|
46
|
+
position: "relative",
|
|
47
|
+
width: `calc(${getBodySize("md").fontSize} * ${getBodySize("md").lineHeight})`,
|
|
48
|
+
height: `calc(${getBodySize("md").fontSize} * ${getBodySize("md").lineHeight})`,
|
|
49
|
+
cursor: "pointer",
|
|
50
|
+
"&:has(:focus-visible)": {
|
|
51
|
+
svg: {
|
|
52
|
+
outline: `${getBorderWidth(borderWidthFocus)} solid ${getBorderColor(colorBorderFocus)}`,
|
|
53
|
+
borderRadius: getBorderRadius(borderRadiusFull),
|
|
54
|
+
...forcedColors({
|
|
55
|
+
outline: `${getBorderWidth(borderWidthFocus)} solid CanvasText`
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const RadioInputStyled = styled.input.withConfig({
|
|
61
|
+
shouldForwardProp: filterProps(),
|
|
62
|
+
displayName: "RadioInputStyled",
|
|
63
|
+
componentId: "sc-qti4z3-2"
|
|
64
|
+
})({
|
|
65
|
+
position: "absolute",
|
|
66
|
+
width: "100%",
|
|
67
|
+
height: "100%",
|
|
68
|
+
top: 0,
|
|
69
|
+
left: 0,
|
|
70
|
+
zIndex: 1,
|
|
71
|
+
margin: 0,
|
|
72
|
+
padding: 0,
|
|
73
|
+
cursor: "inherit",
|
|
74
|
+
appearance: "none",
|
|
75
|
+
"&:focus, &:focus-visible": {
|
|
76
|
+
outline: "none"
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const RadioLabelStyled = styled(Label).withConfig({
|
|
80
|
+
shouldForwardProp: filterProps(),
|
|
81
|
+
displayName: "RadioLabelStyled",
|
|
82
|
+
componentId: "sc-qti4z3-3"
|
|
83
|
+
})({
|
|
84
|
+
cursor: "pointer"
|
|
85
|
+
});
|
|
86
|
+
const RadioSVGStyled = styled.svg.withConfig({
|
|
87
|
+
shouldForwardProp: filterProps(),
|
|
88
|
+
displayName: "RadioSVGStyled",
|
|
89
|
+
componentId: "sc-qti4z3-4"
|
|
90
|
+
})({
|
|
91
|
+
fill: "none",
|
|
92
|
+
width: "inherit",
|
|
93
|
+
height: "inherit"
|
|
94
|
+
});
|
|
95
|
+
const RadioFillingCircleStyled = styled.circle.withConfig({
|
|
96
|
+
shouldForwardProp: filterProps(),
|
|
97
|
+
displayName: "RadioFillingCircleStyled",
|
|
98
|
+
componentId: "sc-qti4z3-5"
|
|
99
|
+
})({
|
|
100
|
+
fill: getObjectColor(colorObjectSelected)
|
|
101
|
+
}, forcedColors({
|
|
102
|
+
fill: "FieldText"
|
|
103
|
+
}));
|
|
104
|
+
const RadioBorderPathStyled = styled.circle.withConfig({
|
|
105
|
+
shouldForwardProp: filterProps(),
|
|
106
|
+
displayName: "RadioBorderPathStyled",
|
|
107
|
+
componentId: "sc-qti4z3-6"
|
|
108
|
+
})({
|
|
109
|
+
fill: getObjectColor(colorObjectInverse)
|
|
110
|
+
}, forcedColors({
|
|
111
|
+
fill: "Field"
|
|
112
|
+
}), ({
|
|
113
|
+
checked,
|
|
114
|
+
status
|
|
115
|
+
}) => {
|
|
116
|
+
return {
|
|
117
|
+
stroke: status === inputStateError ? getBorderColor(colorBorderCritical) : checked ? getBorderColor(colorBorderSelected) : getBorderColor(colorBorderUnselected),
|
|
118
|
+
...forcedColors({
|
|
119
|
+
stroke: "FieldText"
|
|
120
|
+
})
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
const RadioSVG = ({
|
|
124
|
+
checked,
|
|
125
|
+
status
|
|
126
|
+
}) => /* @__PURE__ */ jsxs(RadioSVGStyled, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 26 26", fill: "none", children: [
|
|
127
|
+
/* @__PURE__ */ jsx(RadioBorderPathStyled, { cx: "13", cy: "13", r: "12.5", checked, status }),
|
|
128
|
+
checked && /* @__PURE__ */ jsx(RadioFillingCircleStyled, { cx: "13", cy: "13", r: "8" })
|
|
129
|
+
] });
|
|
130
|
+
const Radio = ({
|
|
131
|
+
uid,
|
|
132
|
+
status,
|
|
133
|
+
label,
|
|
134
|
+
checked,
|
|
135
|
+
disabled,
|
|
136
|
+
...props
|
|
137
|
+
}) => {
|
|
138
|
+
const inputProps = {
|
|
139
|
+
...props,
|
|
140
|
+
id: uid
|
|
141
|
+
};
|
|
142
|
+
return /* @__PURE__ */ jsxs(RadioContainer, { disabled, gapSpacing: spacingXs, children: [
|
|
143
|
+
/* @__PURE__ */ jsxs(RadioStyled, { children: [
|
|
144
|
+
/* @__PURE__ */ jsx(RadioInputStyled, { ...inputProps, checked, status, type: "radio", disabled }),
|
|
145
|
+
/* @__PURE__ */ jsx(RadioSVG, { status, checked })
|
|
146
|
+
] }),
|
|
147
|
+
/* @__PURE__ */ jsx(RadioLabelStyled, { bottomSpacing: spacingNone, htmlFor: uid, uid, children: label })
|
|
148
|
+
] });
|
|
149
|
+
};
|
|
150
|
+
const RadioGroup = ({
|
|
151
|
+
component: _component,
|
|
152
|
+
radios,
|
|
153
|
+
checkedValue,
|
|
154
|
+
onUpdate,
|
|
155
|
+
orientation = "horizontal",
|
|
156
|
+
status,
|
|
157
|
+
disabled,
|
|
158
|
+
...props
|
|
159
|
+
}) => {
|
|
160
|
+
const [checked, setChecked] = useState(checkedValue);
|
|
161
|
+
const [currentStatus, setCurrentStatus] = useState(status);
|
|
162
|
+
const ref = useRef(null);
|
|
163
|
+
const prevChecked = useRef(checked);
|
|
164
|
+
const handleChange = (event) => {
|
|
165
|
+
const value = event.target.value;
|
|
166
|
+
setChecked(value);
|
|
167
|
+
setCurrentStatus(void 0);
|
|
168
|
+
if (onUpdate) {
|
|
169
|
+
onUpdate(value);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
useEffect(() => {
|
|
173
|
+
if (checked === checkedValue) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
setChecked(checkedValue);
|
|
177
|
+
}, [checkedValue]);
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
setCurrentStatus(status);
|
|
180
|
+
}, [status]);
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
if (prevChecked.current !== checked) {
|
|
183
|
+
const checkedInput = ref.current.querySelector(`[value='${checked}']`);
|
|
184
|
+
checkedInput && checkedInput.focus();
|
|
185
|
+
}
|
|
186
|
+
prevChecked.current = checked;
|
|
187
|
+
}, [checked]);
|
|
188
|
+
return /* @__PURE__ */ jsx(Fieldset, { ...props, status: currentStatus, ...{
|
|
189
|
+
"aria-disabled": disabled,
|
|
190
|
+
"aria-invalid": inputStateError === currentStatus ? true : void 0
|
|
191
|
+
}, ref, children: /* @__PURE__ */ jsx(Flex, { orientation, gapSpacing: orientation === "horizontal" ? spacingSm : spacingXs, bottomSpacing: spacingXs, children: radios.map((radio) => {
|
|
192
|
+
return /* @__PURE__ */ createElement(Radio, { ...radio, onChange: handleChange, checked: checked === radio.value, key: radio.uid, status: currentStatus, disabled });
|
|
193
|
+
}) }) });
|
|
194
|
+
};
|
|
195
|
+
export {
|
|
196
|
+
RadioGroup as default
|
|
197
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { v as viewport, a as breakpoint_large, c as breakpoint_medium } from "../../index-Ck2bCrhT.js";
|
|
4
|
+
import { s as spacingMd } from "../../Spacing-D0HQH9YJ.js";
|
|
5
|
+
import styled from "styled-components";
|
|
6
|
+
import { getBorderRadius } from "../../foundations/token/getBorderRadius/index.js";
|
|
7
|
+
import { getBottomSpacing } from "../../foundations/token/getBottomSpacing/index.js";
|
|
8
|
+
import { b as borderRadiusMd, a as borderRadiusNone } from "../../BorderRadius-ClUShVLu.js";
|
|
9
|
+
import { f as filterProps } from "../../filterProps-Cewck8OH.js";
|
|
10
|
+
const ResponsiveImagePictureStyled = styled.picture.withConfig({
|
|
11
|
+
shouldForwardProp: filterProps(),
|
|
12
|
+
displayName: "ResponsiveImagePictureStyled",
|
|
13
|
+
componentId: "sc-1itvcas-0"
|
|
14
|
+
})({});
|
|
15
|
+
const ResponsiveImageStyled = styled.img.withConfig({
|
|
16
|
+
shouldForwardProp: filterProps(),
|
|
17
|
+
displayName: "ResponsiveImageStyled",
|
|
18
|
+
componentId: "sc-1itvcas-1"
|
|
19
|
+
})({
|
|
20
|
+
display: "block",
|
|
21
|
+
width: "100%"
|
|
22
|
+
}, ({
|
|
23
|
+
images
|
|
24
|
+
}) => {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
return {
|
|
27
|
+
...images.sm.objectFit && {
|
|
28
|
+
objectFit: images.sm.objectFit
|
|
29
|
+
},
|
|
30
|
+
...((_a = images.md) == null ? void 0 : _a.objectFit) && viewport.md({
|
|
31
|
+
objectFit: images.md.objectFit
|
|
32
|
+
}),
|
|
33
|
+
...((_b = images.lg) == null ? void 0 : _b.objectFit) && viewport.lg({
|
|
34
|
+
objectFit: images.lg.objectFit
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
}, ({
|
|
38
|
+
images
|
|
39
|
+
}) => {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
return {
|
|
42
|
+
...images.sm.objectPosition && {
|
|
43
|
+
objectPosition: images.sm.objectPosition
|
|
44
|
+
},
|
|
45
|
+
...((_a = images.md) == null ? void 0 : _a.objectPosition) && viewport.md({
|
|
46
|
+
objectPosition: images.md.objectPosition
|
|
47
|
+
}),
|
|
48
|
+
...((_b = images.lg) == null ? void 0 : _b.objectPosition) && viewport.lg({
|
|
49
|
+
objectPosition: images.lg.objectPosition
|
|
50
|
+
})
|
|
51
|
+
};
|
|
52
|
+
}, ({
|
|
53
|
+
images = {}
|
|
54
|
+
}) => {
|
|
55
|
+
var _a, _b, _c;
|
|
56
|
+
return {
|
|
57
|
+
...((_a = images.sm) == null ? void 0 : _a.aspectRatio) && {
|
|
58
|
+
aspectRatio: images.sm.aspectRatio
|
|
59
|
+
},
|
|
60
|
+
...((_b = images.md) == null ? void 0 : _b.aspectRatio) && viewport.md({
|
|
61
|
+
aspectRatio: images.md.aspectRatio
|
|
62
|
+
}),
|
|
63
|
+
...((_c = images.lg) == null ? void 0 : _c.aspectRatio) && viewport.lg({
|
|
64
|
+
aspectRatio: images.lg.aspectRatio
|
|
65
|
+
})
|
|
66
|
+
};
|
|
67
|
+
}, ({
|
|
68
|
+
images: {
|
|
69
|
+
sm: {
|
|
70
|
+
corners
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}) => ({
|
|
74
|
+
borderRadius: corners === "rounded" ? getBorderRadius(borderRadiusMd) : getBorderRadius(borderRadiusNone)
|
|
75
|
+
}), getBottomSpacing);
|
|
76
|
+
const ResponsiveImage = ({
|
|
77
|
+
images,
|
|
78
|
+
bottomSpacing = spacingMd,
|
|
79
|
+
...props
|
|
80
|
+
}) => /* @__PURE__ */ jsxs(ResponsiveImagePictureStyled, { ...props, children: [
|
|
81
|
+
images.lg && /* @__PURE__ */ jsx("source", { media: `(min-width: ${breakpoint_large})`, srcSet: images.lg.src }),
|
|
82
|
+
images.md && /* @__PURE__ */ jsx("source", { media: `(min-width: ${breakpoint_medium})`, srcSet: images.md.src }),
|
|
83
|
+
/* @__PURE__ */ jsx(ResponsiveImageStyled, { ..."" === images.sm.alt ? {
|
|
84
|
+
"aria-hidden": true
|
|
85
|
+
} : {}, images, ...images.sm, bottomSpacing })
|
|
86
|
+
] });
|
|
87
|
+
export {
|
|
88
|
+
ResponsiveImage as default
|
|
89
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { CloseIcon, iconSizeSm } from "@vfde-react/inline-icon-library";
|
|
4
|
+
import { forwardRef, useState, useRef, useImperativeHandle } from "react";
|
|
5
|
+
import FormHelperLabel from "../FormHelperLabel/index.js";
|
|
6
|
+
import IconButton, { iconButtonShapeSquare } from "../IconButton/index.js";
|
|
7
|
+
import { b as spacingNone, s as spacingMd } from "../../Spacing-D0HQH9YJ.js";
|
|
8
|
+
import { p as primaryAppearance } from "../../styled-FNJyDkPV.js";
|
|
9
|
+
import { r as renderInlineRichTextFromOpenText } from "../../renderInlineRichTextFromOpenText-CA52y1-B.js";
|
|
10
|
+
import Form from "../Form/index.js";
|
|
11
|
+
import styled from "styled-components";
|
|
12
|
+
import { I as InputWrapperStyled, a as InputStyled } from "../../styled-CDWclYAa.js";
|
|
13
|
+
import { getSpacing } from "../../foundations/token/getSpacing/index.js";
|
|
14
|
+
import { f as filterProps } from "../../filterProps-Cewck8OH.js";
|
|
15
|
+
const SearchInputButtonWrapperStyled = styled.div.withConfig({
|
|
16
|
+
shouldForwardProp: filterProps(),
|
|
17
|
+
displayName: "SearchInputButtonWrapperStyled",
|
|
18
|
+
componentId: "sc-dt60o-0"
|
|
19
|
+
})({
|
|
20
|
+
display: "flex",
|
|
21
|
+
":where(:focus,:focus-visible,:focus-within)": {
|
|
22
|
+
zIndex: 1
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const SearchInputWrapperStyled = styled(InputWrapperStyled).withConfig({
|
|
26
|
+
shouldForwardProp: filterProps(),
|
|
27
|
+
displayName: "SearchInputWrapperStyled",
|
|
28
|
+
componentId: "sc-dt60o-1"
|
|
29
|
+
})({
|
|
30
|
+
flex: 1,
|
|
31
|
+
borderTopRightRadius: getSpacing(spacingNone),
|
|
32
|
+
borderBottomRightRadius: getSpacing(spacingNone)
|
|
33
|
+
}, ({
|
|
34
|
+
value
|
|
35
|
+
}) => {
|
|
36
|
+
if (value !== "") {
|
|
37
|
+
const iconSelectorOnFocusAndHover = `&:focus-within ${CloseIconStyled.toString()}, &:hover ${CloseIconStyled.toString()}`;
|
|
38
|
+
return {
|
|
39
|
+
[iconSelectorOnFocusAndHover]: {
|
|
40
|
+
opacity: 1
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const SearchInputIconButtonStyled = styled(IconButton).withConfig({
|
|
46
|
+
displayName: "SearchInputIconButtonStyled",
|
|
47
|
+
componentId: "sc-dt60o-2"
|
|
48
|
+
})({
|
|
49
|
+
borderTopLeftRadius: 0,
|
|
50
|
+
borderBottomLeftRadius: 0
|
|
51
|
+
});
|
|
52
|
+
const CloseIconStyled = styled(CloseIcon).withConfig({
|
|
53
|
+
displayName: "CloseIconStyled",
|
|
54
|
+
componentId: "sc-dt60o-3"
|
|
55
|
+
})({
|
|
56
|
+
opacity: 0
|
|
57
|
+
});
|
|
58
|
+
const SearchInputCloseButtonStyled = styled.button.withConfig({
|
|
59
|
+
displayName: "SearchInputCloseButtonStyled",
|
|
60
|
+
componentId: "sc-dt60o-4"
|
|
61
|
+
})({
|
|
62
|
+
background: "none"
|
|
63
|
+
}, ({
|
|
64
|
+
disabled
|
|
65
|
+
}) => {
|
|
66
|
+
if (!disabled) {
|
|
67
|
+
return {
|
|
68
|
+
"&:hover": {
|
|
69
|
+
cursor: "pointer"
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
const SearchInputStyled = styled(InputStyled).withConfig({
|
|
75
|
+
displayName: "SearchInputStyled",
|
|
76
|
+
componentId: "sc-dt60o-5"
|
|
77
|
+
})({
|
|
78
|
+
"&::-webkit-search-cancel-button": {
|
|
79
|
+
WebkitAppearance: "none"
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const SearchInput = forwardRef(({
|
|
83
|
+
uid,
|
|
84
|
+
label,
|
|
85
|
+
bottomSpacing = spacingMd,
|
|
86
|
+
hideLabel,
|
|
87
|
+
buttonAppearance = primaryAppearance,
|
|
88
|
+
searchButtonLabel,
|
|
89
|
+
placeholder,
|
|
90
|
+
onSearch,
|
|
91
|
+
onReset,
|
|
92
|
+
disabled,
|
|
93
|
+
...props
|
|
94
|
+
}, ref) => {
|
|
95
|
+
const initialValueState = !props.value ? "" : props.value;
|
|
96
|
+
const [value, setValue] = useState(initialValueState);
|
|
97
|
+
const inputRef = useRef(null);
|
|
98
|
+
useImperativeHandle(ref, () => inputRef.current, []);
|
|
99
|
+
const inputProps = {
|
|
100
|
+
...props,
|
|
101
|
+
id: uid
|
|
102
|
+
};
|
|
103
|
+
const onChange = (event) => {
|
|
104
|
+
setValue(event.target.value);
|
|
105
|
+
if (props.onChange) {
|
|
106
|
+
props.onChange(event);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const onSubmit = (e) => {
|
|
110
|
+
e.preventDefault();
|
|
111
|
+
const formElement = e.target;
|
|
112
|
+
if (onSearch) {
|
|
113
|
+
onSearch(formElement.getElementsByTagName("input")[0].value);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const resetButtonHandler = () => {
|
|
117
|
+
var _a;
|
|
118
|
+
if (disabled) return;
|
|
119
|
+
setValue("");
|
|
120
|
+
inputRef && ((_a = inputRef.current) == null ? void 0 : _a.focus());
|
|
121
|
+
onReset && onReset();
|
|
122
|
+
};
|
|
123
|
+
const resetHandler = (e) => {
|
|
124
|
+
if (e.key === "Escape" && onReset && value !== "") onReset();
|
|
125
|
+
props.onKeyDown && props.onKeyDown(e);
|
|
126
|
+
};
|
|
127
|
+
return /* @__PURE__ */ jsxs(Form, { className: props.className, role: "search", bottomSpacing, onSubmit, children: [
|
|
128
|
+
!hideLabel && /* @__PURE__ */ jsx(FormHelperLabel, { label, uid }),
|
|
129
|
+
/* @__PURE__ */ jsxs(SearchInputButtonWrapperStyled, { children: [
|
|
130
|
+
/* @__PURE__ */ jsxs(SearchInputWrapperStyled, { value, children: [
|
|
131
|
+
/* @__PURE__ */ jsx(SearchInputStyled, { ...inputProps, ref: inputRef, onChange, onKeyDown: resetHandler, type: "search", value, "aria-label": hideLabel && typeof label === "string" ? label : void 0, placeholder: renderInlineRichTextFromOpenText(placeholder) }),
|
|
132
|
+
value && /* @__PURE__ */ jsx(SearchInputCloseButtonStyled, { type: "button", "aria-hidden": true, onClick: resetButtonHandler, tabIndex: -1, disabled, children: /* @__PURE__ */ jsx(CloseIconStyled, { size: iconSizeSm, value }) })
|
|
133
|
+
] }),
|
|
134
|
+
/* @__PURE__ */ jsx(SearchInputIconButtonStyled, { iconName: "Search", label: searchButtonLabel, bottomSpacing: spacingNone, shape: iconButtonShapeSquare, appearance: buttonAppearance, type: "submit" })
|
|
135
|
+
] })
|
|
136
|
+
] });
|
|
137
|
+
});
|
|
138
|
+
export {
|
|
139
|
+
SearchInput as default
|
|
140
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { iconSizeSm, ChevronDownIcon } from "@vfde-react/inline-icon-library";
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
import FormElement from "../FormElement/index.js";
|
|
6
|
+
import FormHelperLabel from "../FormHelperLabel/index.js";
|
|
7
|
+
import FormHelperMessage from "../FormHelperMessage/index.js";
|
|
8
|
+
import FormHelperStatusIcon from "../FormHelperStatusIcon/index.js";
|
|
9
|
+
import { i as inputStateError } from "../../props-Czq9XX2J.js";
|
|
10
|
+
import { a as spacingXs, c as spacingSm, s as spacingMd } from "../../Spacing-D0HQH9YJ.js";
|
|
11
|
+
import { r as renderInlineRichTextFromOpenText } from "../../renderInlineRichTextFromOpenText-CA52y1-B.js";
|
|
12
|
+
import styled from "styled-components";
|
|
13
|
+
import forcedColors from "../../foundations/media-query/forcedColors/index.js";
|
|
14
|
+
import { getBackgroundColor } from "../../foundations/token/getBackgroundColor/index.js";
|
|
15
|
+
import { getBorderColor } from "../../foundations/token/getBorderColor/index.js";
|
|
16
|
+
import { getBorderRadius } from "../../foundations/token/getBorderRadius/index.js";
|
|
17
|
+
import { getHeadingSize } from "../../foundations/token/getHeadingSize/index.js";
|
|
18
|
+
import { getSpacing } from "../../foundations/token/getSpacing/index.js";
|
|
19
|
+
import { getTextColor } from "../../foundations/token/getTextColor/index.js";
|
|
20
|
+
import { c as colorBackgroundNeutral } from "../../BackgroundColor-JObp_2xA.js";
|
|
21
|
+
import { c as colorBorderFocus, a as colorBorderNeutral, b as colorBorderUnselected, d as colorBorderSuccess, e as colorBorderCritical } from "../../BorderColor-BummoQ1-.js";
|
|
22
|
+
import { b as borderRadiusMd } from "../../BorderRadius-ClUShVLu.js";
|
|
23
|
+
import { a as colorTextNeutral } from "../../TextColor-BXiR5Uq9.js";
|
|
24
|
+
import { f as filterProps } from "../../filterProps-Cewck8OH.js";
|
|
25
|
+
import { g as getCssVar } from "../../getCssVar-BP6T9pFM.js";
|
|
26
|
+
const SelectInputWrapperStyled = styled.div.withConfig({
|
|
27
|
+
displayName: "SelectInputWrapperStyled",
|
|
28
|
+
componentId: "sc-4qxq2i-0"
|
|
29
|
+
})({
|
|
30
|
+
position: "relative",
|
|
31
|
+
":focus, :focus-visible": {
|
|
32
|
+
outline: "none"
|
|
33
|
+
},
|
|
34
|
+
marginBottom: getSpacing(spacingXs)
|
|
35
|
+
});
|
|
36
|
+
const SelectInputStyled = styled.select.withConfig({
|
|
37
|
+
shouldForwardProp: filterProps(),
|
|
38
|
+
displayName: "SelectInputStyled",
|
|
39
|
+
componentId: "sc-4qxq2i-1"
|
|
40
|
+
})({
|
|
41
|
+
...forcedColors({
|
|
42
|
+
border: "1px solid FieldText",
|
|
43
|
+
background: "Field"
|
|
44
|
+
}),
|
|
45
|
+
display: "flex",
|
|
46
|
+
justifyItems: "center",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
gap: `${getSpacing(spacingXs)}`,
|
|
49
|
+
// Right padding needs to be larger as thats where the absolutely positioned icon is
|
|
50
|
+
padding: `${getSpacing(spacingXs)} calc(${getSpacing(spacingSm)} + ${getCssVar(iconSizeSm)}) ${getSpacing(spacingXs)} ${getSpacing(spacingSm)}`,
|
|
51
|
+
borderRadius: getBorderRadius(borderRadiusMd),
|
|
52
|
+
backgroundColor: getBackgroundColor(colorBackgroundNeutral),
|
|
53
|
+
color: getTextColor(colorTextNeutral),
|
|
54
|
+
width: "100%",
|
|
55
|
+
fontFamily: "VodafoneVari, Arial, sans-serif",
|
|
56
|
+
border: "none",
|
|
57
|
+
height: "44px",
|
|
58
|
+
zIndex: 0
|
|
59
|
+
}, ({
|
|
60
|
+
status
|
|
61
|
+
}) => {
|
|
62
|
+
if (!status) {
|
|
63
|
+
return {
|
|
64
|
+
boxShadow: `inset ${getBorderColor(colorBorderUnselected)} 0px 0px 0px 1px`,
|
|
65
|
+
"&:focus-within, &:focus-visible": {
|
|
66
|
+
...forcedColors({
|
|
67
|
+
outline: "4px solid CanvasText"
|
|
68
|
+
}),
|
|
69
|
+
boxShadow: `${getBorderColor(colorBorderFocus)} 0px 0px 0px 4px, inset ${getBorderColor(colorBorderNeutral)} 0px 0px 0px 1px`,
|
|
70
|
+
outline: "none"
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if ("success" === status) {
|
|
75
|
+
return {
|
|
76
|
+
boxShadow: `inset ${getBorderColor(colorBorderSuccess)} 0px 0px 0px 2px`,
|
|
77
|
+
// Right padding needs to be even larger here as we get a second icon for the status
|
|
78
|
+
paddingRight: `calc(${getSpacing(spacingSm)} + 2*${getCssVar(iconSizeSm)} + ${getSpacing(spacingXs)})`,
|
|
79
|
+
"&:focus-within, &:focus-visible": {
|
|
80
|
+
...forcedColors({
|
|
81
|
+
outline: "4px solid CanvasText"
|
|
82
|
+
}),
|
|
83
|
+
boxShadow: `${getBorderColor(colorBorderFocus)} 0px 0px 0px 4px, inset ${getBorderColor(colorBorderSuccess)} 0px 0px 0px 2px`,
|
|
84
|
+
outline: "none"
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if ("error" === status) {
|
|
89
|
+
return {
|
|
90
|
+
boxShadow: `inset ${getBorderColor(colorBorderCritical)} 0px 0px 0px 2px`,
|
|
91
|
+
// Right padding needs to be even larger here as we get a second icon for the status
|
|
92
|
+
paddingRight: `calc(${getSpacing(spacingSm)} + 2*${getCssVar(iconSizeSm)} + ${getSpacing(spacingXs)})`,
|
|
93
|
+
"&:focus-within, &:focus-visible": {
|
|
94
|
+
...forcedColors({
|
|
95
|
+
outline: "4px solid CanvasText"
|
|
96
|
+
}),
|
|
97
|
+
boxShadow: `${getBorderColor(colorBorderFocus)} 0px 0px 0px 4px, inset ${getBorderColor(colorBorderCritical)} 0px 0px 0px 2px`,
|
|
98
|
+
outline: "none"
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}, getHeadingSize("xs"));
|
|
103
|
+
const SelectInputIconsBarStyled = styled.div.withConfig({
|
|
104
|
+
displayName: "SelectInputIconsBarStyled",
|
|
105
|
+
componentId: "sc-4qxq2i-2"
|
|
106
|
+
})({
|
|
107
|
+
...forcedColors({
|
|
108
|
+
color: "FieldText"
|
|
109
|
+
}),
|
|
110
|
+
position: "absolute",
|
|
111
|
+
top: `calc(50% - (${getCssVar(iconSizeSm)}/2))`,
|
|
112
|
+
right: `${getSpacing(spacingSm)}`,
|
|
113
|
+
display: "flex",
|
|
114
|
+
gap: `${getSpacing(spacingXs)}`,
|
|
115
|
+
pointerEvents: "none"
|
|
116
|
+
});
|
|
117
|
+
const SelectInput = forwardRef(({
|
|
118
|
+
uid,
|
|
119
|
+
label,
|
|
120
|
+
status,
|
|
121
|
+
errorMessage,
|
|
122
|
+
helperText,
|
|
123
|
+
options,
|
|
124
|
+
onUpdate,
|
|
125
|
+
disabled = false,
|
|
126
|
+
bottomSpacing = spacingMd,
|
|
127
|
+
...props
|
|
128
|
+
}, ref) => {
|
|
129
|
+
const messageId = `text-${uid}`;
|
|
130
|
+
const selectInputProps = {
|
|
131
|
+
...props,
|
|
132
|
+
disabled,
|
|
133
|
+
status,
|
|
134
|
+
id: uid,
|
|
135
|
+
"aria-describedby": inputStateError === status ? errorMessage : helperText
|
|
136
|
+
};
|
|
137
|
+
const onChange = (event) => {
|
|
138
|
+
if (!onUpdate) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
onUpdate(event.target.value);
|
|
142
|
+
};
|
|
143
|
+
const optionsHtml = options.map((option) => {
|
|
144
|
+
return /* @__PURE__ */ jsx("option", { value: option, children: renderInlineRichTextFromOpenText(option) }, option);
|
|
145
|
+
});
|
|
146
|
+
return /* @__PURE__ */ jsxs(FormElement, { className: props.className, bottomSpacing, disabled, children: [
|
|
147
|
+
/* @__PURE__ */ jsx(FormHelperLabel, { label, uid }),
|
|
148
|
+
/* @__PURE__ */ jsxs(SelectInputWrapperStyled, { bottomSpacing: inputStateError !== status && helperText || inputStateError === status && errorMessage ? spacingXs : void 0, children: [
|
|
149
|
+
/* @__PURE__ */ jsx(SelectInputStyled, { ...selectInputProps, ref, onChange, "aria-describedby": inputStateError !== status && helperText || inputStateError === status && errorMessage ? `text-${uid}` : props["aria-describedby"], "aria-invalid": status === inputStateError, children: optionsHtml }),
|
|
150
|
+
/* @__PURE__ */ jsxs(SelectInputIconsBarStyled, { children: [
|
|
151
|
+
/* @__PURE__ */ jsx(FormHelperStatusIcon, { status }),
|
|
152
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, { size: iconSizeSm })
|
|
153
|
+
] })
|
|
154
|
+
] }),
|
|
155
|
+
/* @__PURE__ */ jsx(FormHelperMessage, { id: messageId, status, message: inputStateError === status ? errorMessage : helperText })
|
|
156
|
+
] });
|
|
157
|
+
});
|
|
158
|
+
export {
|
|
159
|
+
SelectInput as default
|
|
160
|
+
};
|