@vodafone_de/brix-components 3.0.0 → 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/renderInlineRichTextFromOpenText-CA52y1-B.js +2383 -0
- 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 +1 -2
- package/dist/index-BoPDwZgt.js +0 -18
- package/dist/index-DRj4iUs9.js +0 -117
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
|
+
import { IconLoader, iconSize2xs } from "@vfde-react/inline-icon-library";
|
|
5
|
+
import styled from "styled-components";
|
|
6
|
+
import forcedColors from "../../foundations/media-query/forcedColors/index.js";
|
|
7
|
+
import { e as ease_in_sine } from "../../easing-Dm-pO8SY.js";
|
|
8
|
+
import { getBorderColor } from "../../foundations/token/getBorderColor/index.js";
|
|
9
|
+
import { getBorderRadius } from "../../foundations/token/getBorderRadius/index.js";
|
|
10
|
+
import { getBorderWidth } from "../../foundations/token/getBorderWidth/index.js";
|
|
11
|
+
import { getBottomSpacing } from "../../foundations/token/getBottomSpacing/index.js";
|
|
12
|
+
import { getObjectColor } from "../../foundations/token/getObjectColor/index.js";
|
|
13
|
+
import { getOpacity } from "../../foundations/token/getOpacity/index.js";
|
|
14
|
+
import { getSpacing } from "../../foundations/token/getSpacing/index.js";
|
|
15
|
+
import { c as colorBorderFocus } from "../../BorderColor-BummoQ1-.js";
|
|
16
|
+
import { c as borderRadiusFull } from "../../BorderRadius-ClUShVLu.js";
|
|
17
|
+
import { a as borderWidthFocus, c as borderWidthSm } from "../../BorderWidth-DfOlyKK7.js";
|
|
18
|
+
import { a as colorObjectInverse, b as colorObjectSelected, d as colorObjectUnselected } from "../../ObjectColor-BZDBuV8H.js";
|
|
19
|
+
import { a as opacityDisabled } from "../../Opacity-smkGiwsf.js";
|
|
20
|
+
import { a as spacingXs, s as spacingMd } from "../../Spacing-D0HQH9YJ.js";
|
|
21
|
+
import { f as filterProps } from "../../filterProps-Cewck8OH.js";
|
|
22
|
+
import Label from "../Label/index.js";
|
|
23
|
+
const getHandleIcon = (checked) => {
|
|
24
|
+
const iconName = checked ? "Tick" : "Close";
|
|
25
|
+
return /* @__PURE__ */ jsx(IconLoader, { size: iconSize2xs, name: iconName });
|
|
26
|
+
};
|
|
27
|
+
const SwitchButtonBorderRadius = "32px";
|
|
28
|
+
const SwitchLabelWrapperStyled = styled(Label).withConfig({
|
|
29
|
+
shouldForwardProp: filterProps(),
|
|
30
|
+
displayName: "SwitchLabelWrapperStyled",
|
|
31
|
+
componentId: "sc-1n5qceo-0"
|
|
32
|
+
})({
|
|
33
|
+
display: "flex",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
gap: getSpacing(spacingXs),
|
|
36
|
+
cursor: "pointer"
|
|
37
|
+
}, ({
|
|
38
|
+
disabled
|
|
39
|
+
}) => ({
|
|
40
|
+
...disabled && {
|
|
41
|
+
opacity: getOpacity(opacityDisabled)
|
|
42
|
+
}
|
|
43
|
+
}), ({
|
|
44
|
+
bottomSpacing = spacingMd
|
|
45
|
+
}) => getBottomSpacing({
|
|
46
|
+
bottomSpacing
|
|
47
|
+
}));
|
|
48
|
+
const SwitchButtonStyled = styled.span.withConfig({
|
|
49
|
+
shouldForwardProp: filterProps(),
|
|
50
|
+
displayName: "SwitchButtonStyled",
|
|
51
|
+
componentId: "sc-1n5qceo-1"
|
|
52
|
+
})({
|
|
53
|
+
position: "relative",
|
|
54
|
+
display: "flex",
|
|
55
|
+
"&:has(:focus-visible)": {
|
|
56
|
+
outline: `${getBorderWidth(borderWidthFocus)} solid ${getBorderColor(colorBorderFocus)}`,
|
|
57
|
+
borderRadius: SwitchButtonBorderRadius,
|
|
58
|
+
...forcedColors({
|
|
59
|
+
outline: `${getBorderWidth(borderWidthFocus)} solid CanvasText`
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const SwitchHandleWrapperStyled = styled.span.withConfig({
|
|
64
|
+
shouldForwardProp: filterProps(),
|
|
65
|
+
displayName: "SwitchHandleWrapperStyled",
|
|
66
|
+
componentId: "sc-1n5qceo-2"
|
|
67
|
+
})({
|
|
68
|
+
position: "absolute",
|
|
69
|
+
top: 0,
|
|
70
|
+
left: 0,
|
|
71
|
+
padding: "1px",
|
|
72
|
+
transition: `all .2s ${ease_in_sine}`
|
|
73
|
+
}, ({
|
|
74
|
+
checked
|
|
75
|
+
}) => ({
|
|
76
|
+
transform: checked ? "translateX(20px)" : "translateX(0)"
|
|
77
|
+
}));
|
|
78
|
+
const SwitchInputElementStyled = styled.input.withConfig({
|
|
79
|
+
shouldForwardProp: filterProps(),
|
|
80
|
+
displayName: "SwitchInputElementStyled",
|
|
81
|
+
componentId: "sc-1n5qceo-3"
|
|
82
|
+
})({
|
|
83
|
+
position: "absolute",
|
|
84
|
+
width: "100%",
|
|
85
|
+
height: "100%",
|
|
86
|
+
top: 0,
|
|
87
|
+
left: 0,
|
|
88
|
+
zIndex: 1,
|
|
89
|
+
margin: 0,
|
|
90
|
+
padding: 0,
|
|
91
|
+
cursor: "inherit",
|
|
92
|
+
appearance: "none",
|
|
93
|
+
"&:focus, &:focus-visible": {
|
|
94
|
+
outline: "none"
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
const SwitchHandleStyled = styled.span.withConfig({
|
|
98
|
+
shouldForwardProp: filterProps(),
|
|
99
|
+
displayName: "SwitchHandleStyled",
|
|
100
|
+
componentId: "sc-1n5qceo-4"
|
|
101
|
+
})({
|
|
102
|
+
display: "inline-flex",
|
|
103
|
+
alignItems: "center",
|
|
104
|
+
justifyContent: "center",
|
|
105
|
+
width: "30px",
|
|
106
|
+
height: "30px",
|
|
107
|
+
background: getObjectColor(colorObjectInverse),
|
|
108
|
+
borderRadius: getBorderRadius(borderRadiusFull)
|
|
109
|
+
}, ({
|
|
110
|
+
checked
|
|
111
|
+
}) => ({
|
|
112
|
+
...forcedColors({
|
|
113
|
+
color: checked ? "FieldText" : "Field",
|
|
114
|
+
background: checked ? "Field" : "FieldText"
|
|
115
|
+
}),
|
|
116
|
+
color: checked ? getObjectColor(colorObjectSelected) : getObjectColor(colorObjectUnselected)
|
|
117
|
+
}));
|
|
118
|
+
const SwitchTrackStyled = styled.span.withConfig({
|
|
119
|
+
shouldForwardProp: filterProps(),
|
|
120
|
+
displayName: "SwitchTrackStyled",
|
|
121
|
+
componentId: "sc-1n5qceo-5"
|
|
122
|
+
})(({
|
|
123
|
+
checked
|
|
124
|
+
}) => ({
|
|
125
|
+
...forcedColors({
|
|
126
|
+
background: checked ? "FieldText" : "Field",
|
|
127
|
+
border: `${getBorderWidth(borderWidthSm)} solid FieldText`
|
|
128
|
+
}),
|
|
129
|
+
width: "52px",
|
|
130
|
+
height: "32px",
|
|
131
|
+
background: checked ? getObjectColor(colorObjectSelected) : getObjectColor(colorObjectUnselected),
|
|
132
|
+
borderRadius: SwitchButtonBorderRadius
|
|
133
|
+
}));
|
|
134
|
+
const SwitchLabelStyled = styled.span.withConfig({
|
|
135
|
+
shouldForwardProp: filterProps(),
|
|
136
|
+
displayName: "SwitchLabelStyled",
|
|
137
|
+
componentId: "sc-1n5qceo-6"
|
|
138
|
+
})({});
|
|
139
|
+
const Switch = ({
|
|
140
|
+
uid,
|
|
141
|
+
label,
|
|
142
|
+
onUpdate,
|
|
143
|
+
disabled,
|
|
144
|
+
bottomSpacing,
|
|
145
|
+
...props
|
|
146
|
+
}) => {
|
|
147
|
+
const [checked, setChecked] = useState(Boolean(props.checked));
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
setChecked(props.checked ?? false);
|
|
150
|
+
}, [props.checked]);
|
|
151
|
+
const handleChange = () => {
|
|
152
|
+
const newChecked = !checked;
|
|
153
|
+
setChecked(!checked);
|
|
154
|
+
onUpdate == null ? void 0 : onUpdate(newChecked);
|
|
155
|
+
};
|
|
156
|
+
return /* @__PURE__ */ jsxs(SwitchLabelWrapperStyled, { bottomSpacing, disabled, htmlFor: uid, children: [
|
|
157
|
+
/* @__PURE__ */ jsxs(SwitchButtonStyled, { children: [
|
|
158
|
+
/* @__PURE__ */ jsxs(SwitchHandleWrapperStyled, { checked, children: [
|
|
159
|
+
/* @__PURE__ */ jsx(SwitchInputElementStyled, { ...props, id: uid, type: "checkbox", onChange: handleChange, checked, disabled, "aria-label": label, "aria-checked": checked, role: "switch" }),
|
|
160
|
+
/* @__PURE__ */ jsx(SwitchHandleStyled, { checked, children: getHandleIcon(checked) })
|
|
161
|
+
] }),
|
|
162
|
+
/* @__PURE__ */ jsx(SwitchTrackStyled, { checked })
|
|
163
|
+
] }),
|
|
164
|
+
/* @__PURE__ */ jsx(SwitchLabelStyled, { children: label })
|
|
165
|
+
] });
|
|
166
|
+
};
|
|
167
|
+
export {
|
|
168
|
+
Switch as default
|
|
169
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "react/jsx-runtime";
|
|
3
|
+
import { T, a } from "../../index-D6hvbziL.js";
|
|
4
|
+
import "../../tags-DI6H1biK.js";
|
|
5
|
+
import "../../Spacing-D0HQH9YJ.js";
|
|
6
|
+
import "../../renderInlineRichTextFromOpenText-CA52y1-B.js";
|
|
7
|
+
export {
|
|
8
|
+
T as TextListItem,
|
|
9
|
+
a as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useRef, useImperativeHandle, useState, useEffect } from "react";
|
|
4
|
+
import FormElement from "../FormElement/index.js";
|
|
5
|
+
import FormHelperLabel from "../FormHelperLabel/index.js";
|
|
6
|
+
import FormHelperMessage from "../FormHelperMessage/index.js";
|
|
7
|
+
import { i as inputStateError } from "../../props-Czq9XX2J.js";
|
|
8
|
+
import { c as spacingSm, d as spacingXl, s as spacingMd, a as spacingXs } from "../../Spacing-D0HQH9YJ.js";
|
|
9
|
+
import { r as renderInlineRichTextFromOpenText } from "../../renderInlineRichTextFromOpenText-CA52y1-B.js";
|
|
10
|
+
import styled from "styled-components";
|
|
11
|
+
import FormHelperStatusIcon from "../FormHelperStatusIcon/index.js";
|
|
12
|
+
import forcedColors from "../../foundations/media-query/forcedColors/index.js";
|
|
13
|
+
import { getBorderColor } from "../../foundations/token/getBorderColor/index.js";
|
|
14
|
+
import { getBorderRadius } from "../../foundations/token/getBorderRadius/index.js";
|
|
15
|
+
import { getBottomSpacing } from "../../foundations/token/getBottomSpacing/index.js";
|
|
16
|
+
import { getHeadingSize } from "../../foundations/token/getHeadingSize/index.js";
|
|
17
|
+
import { getSpacing } from "../../foundations/token/getSpacing/index.js";
|
|
18
|
+
import { getTextColor } from "../../foundations/token/getTextColor/index.js";
|
|
19
|
+
import { a as colorBorderNeutral, c as colorBorderFocus, b as colorBorderUnselected, d as colorBorderSuccess, e as colorBorderCritical } from "../../BorderColor-BummoQ1-.js";
|
|
20
|
+
import { b as borderRadiusMd } from "../../BorderRadius-ClUShVLu.js";
|
|
21
|
+
import { t as textHeadingXs } from "../../HeadingSize-CfCRn3Lh.js";
|
|
22
|
+
import { e as colorTextPlaceholder, a as colorTextNeutral } from "../../TextColor-BXiR5Uq9.js";
|
|
23
|
+
import { f as filterProps } from "../../filterProps-Cewck8OH.js";
|
|
24
|
+
const TextareaWrapperStyled = styled.div.withConfig({
|
|
25
|
+
shouldForwardProp: filterProps(),
|
|
26
|
+
displayName: "TextareaWrapperStyled",
|
|
27
|
+
componentId: "sc-b8i4y6-0"
|
|
28
|
+
})({
|
|
29
|
+
position: "relative",
|
|
30
|
+
width: "100%"
|
|
31
|
+
}, getBottomSpacing);
|
|
32
|
+
const TextareaStyled = styled.textarea.withConfig({
|
|
33
|
+
shouldForwardProp: filterProps(),
|
|
34
|
+
displayName: "TextareaStyled",
|
|
35
|
+
componentId: "sc-b8i4y6-1"
|
|
36
|
+
})({
|
|
37
|
+
...forcedColors({
|
|
38
|
+
backgroundColor: "Field",
|
|
39
|
+
border: "1px solid FieldText"
|
|
40
|
+
}),
|
|
41
|
+
display: "block",
|
|
42
|
+
width: "100%",
|
|
43
|
+
resize: "vertical",
|
|
44
|
+
borderRadius: getBorderRadius(borderRadiusMd),
|
|
45
|
+
border: "none",
|
|
46
|
+
fontFamily: "VodafoneVari, Arial, sans-serif",
|
|
47
|
+
color: getTextColor(colorTextNeutral),
|
|
48
|
+
backgroundColor: "transparent",
|
|
49
|
+
minHeight: `calc((${getHeadingSize(textHeadingXs).fontSize} * ${getHeadingSize(textHeadingXs).lineHeight}) + (2 * ${getSpacing(spacingSm)}))`,
|
|
50
|
+
"&:placeholder-shown": {
|
|
51
|
+
color: getTextColor(colorTextPlaceholder)
|
|
52
|
+
}
|
|
53
|
+
}, ({
|
|
54
|
+
status
|
|
55
|
+
}) => {
|
|
56
|
+
if (!status) {
|
|
57
|
+
return {
|
|
58
|
+
border: `1px solid ${getBorderColor(colorBorderUnselected)}`,
|
|
59
|
+
padding: getSpacing(spacingSm),
|
|
60
|
+
"&:focus-visible": {
|
|
61
|
+
...forcedColors({
|
|
62
|
+
outline: "4px solid CanvasText"
|
|
63
|
+
}),
|
|
64
|
+
outline: `4px solid ${getBorderColor(colorBorderFocus)}`,
|
|
65
|
+
border: `1px solid ${getBorderColor(colorBorderNeutral)}`
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if ("success" === status) {
|
|
70
|
+
return {
|
|
71
|
+
border: `2px solid ${getBorderColor(colorBorderSuccess)}`,
|
|
72
|
+
padding: `calc(${getSpacing(spacingSm)} - 1px)`,
|
|
73
|
+
"&:focus-visible": {
|
|
74
|
+
...forcedColors({
|
|
75
|
+
outline: "4px solid CanvasText"
|
|
76
|
+
}),
|
|
77
|
+
outline: `4px solid ${getBorderColor(colorBorderFocus)}`,
|
|
78
|
+
border: `2px solid ${getBorderColor(colorBorderSuccess)}`
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if ("error" === status) {
|
|
83
|
+
return {
|
|
84
|
+
border: `2px solid ${getBorderColor(colorBorderCritical)}`,
|
|
85
|
+
padding: `calc(${getSpacing(spacingSm)} - 1px)`,
|
|
86
|
+
"&:focus-visible": {
|
|
87
|
+
...forcedColors({
|
|
88
|
+
outline: "4px solid CanvasText"
|
|
89
|
+
}),
|
|
90
|
+
outline: `4px solid ${getBorderColor(colorBorderFocus)}`,
|
|
91
|
+
border: `2px solid ${getBorderColor(colorBorderCritical)}`
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}, ({
|
|
96
|
+
isResizable
|
|
97
|
+
}) => {
|
|
98
|
+
return {
|
|
99
|
+
resize: isResizable ? "vertical" : "none"
|
|
100
|
+
};
|
|
101
|
+
}, getHeadingSize(textHeadingXs));
|
|
102
|
+
const TextareaStatusIcon = styled(FormHelperStatusIcon).withConfig({
|
|
103
|
+
displayName: "TextareaStatusIcon",
|
|
104
|
+
componentId: "sc-b8i4y6-2"
|
|
105
|
+
})({
|
|
106
|
+
position: "absolute",
|
|
107
|
+
top: getSpacing(spacingSm)
|
|
108
|
+
}, ({
|
|
109
|
+
hasScrollbar
|
|
110
|
+
}) => {
|
|
111
|
+
return {
|
|
112
|
+
right: hasScrollbar ? getSpacing(spacingXl) : getSpacing(spacingSm)
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
const Textarea = forwardRef(({
|
|
116
|
+
uid,
|
|
117
|
+
helperText,
|
|
118
|
+
errorMessage,
|
|
119
|
+
status,
|
|
120
|
+
label,
|
|
121
|
+
rows = 4,
|
|
122
|
+
placeholder,
|
|
123
|
+
isResizable = false,
|
|
124
|
+
bottomSpacing = spacingMd,
|
|
125
|
+
disabled,
|
|
126
|
+
...props
|
|
127
|
+
}, outerRef) => {
|
|
128
|
+
const innerRef = useRef(null);
|
|
129
|
+
useImperativeHandle(outerRef, () => innerRef.current, []);
|
|
130
|
+
const [hasScrollbar, setHasScrollbar] = useState(false);
|
|
131
|
+
const messageId = `text-${uid}`;
|
|
132
|
+
const textAreaProps = {
|
|
133
|
+
...props,
|
|
134
|
+
id: uid,
|
|
135
|
+
"aria-describedby": inputStateError !== status && helperText || inputStateError === status && errorMessage ? messageId : props["aria-describedby"],
|
|
136
|
+
"aria-invalid": inputStateError === status ? true : void 0
|
|
137
|
+
};
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (!innerRef.current) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const element = innerRef.current;
|
|
143
|
+
new ResizeObserver(() => setHasScrollbar(element.clientHeight < element.scrollHeight)).observe(element);
|
|
144
|
+
}, [innerRef]);
|
|
145
|
+
return /* @__PURE__ */ jsxs(FormElement, { bottomSpacing, disabled, children: [
|
|
146
|
+
/* @__PURE__ */ jsx(FormHelperLabel, { label, uid }),
|
|
147
|
+
/* @__PURE__ */ jsxs(TextareaWrapperStyled, { bottomSpacing: inputStateError !== status && helperText || inputStateError === status && errorMessage ? spacingXs : void 0, children: [
|
|
148
|
+
/* @__PURE__ */ jsx(TextareaStyled, { ...textAreaProps, rows, status, placeholder: renderInlineRichTextFromOpenText(placeholder), isResizable, ref: innerRef }),
|
|
149
|
+
/* @__PURE__ */ jsx(TextareaStatusIcon, { status, hasScrollbar })
|
|
150
|
+
] }),
|
|
151
|
+
/* @__PURE__ */ jsx(FormHelperMessage, { id: messageId, status, message: inputStateError === status ? errorMessage : helperText })
|
|
152
|
+
] });
|
|
153
|
+
});
|
|
154
|
+
export {
|
|
155
|
+
Textarea as default
|
|
156
|
+
};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useRef, useEffect } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import ButtonGroup from "../ButtonGroup/index.js";
|
|
6
|
+
import Heading from "../Heading/index.js";
|
|
7
|
+
import { f as fontWeightBold } from "../../FontWeight-CR22KTex.js";
|
|
8
|
+
import { a as textHeadingMd } from "../../HeadingSize-CfCRn3Lh.js";
|
|
9
|
+
import { s as spacingMd, b as spacingNone } from "../../Spacing-D0HQH9YJ.js";
|
|
10
|
+
import styled from "styled-components";
|
|
11
|
+
import Card from "../Card/index.js";
|
|
12
|
+
import Flex from "../Flex/index.js";
|
|
13
|
+
import IconButton from "../IconButton/index.js";
|
|
14
|
+
import { v as viewport } from "../../index-Ck2bCrhT.js";
|
|
15
|
+
import { s as shadow28 } from "../../shadow-u158mzuN.js";
|
|
16
|
+
import { getBackgroundColor } from "../../foundations/token/getBackgroundColor/index.js";
|
|
17
|
+
import { getBorderWidth } from "../../foundations/token/getBorderWidth/index.js";
|
|
18
|
+
import { getSpacing } from "../../foundations/token/getSpacing/index.js";
|
|
19
|
+
import { b as colorBackgroundOverlayStatic } from "../../BackgroundColor-JObp_2xA.js";
|
|
20
|
+
import { a as borderWidthFocus } from "../../BorderWidth-DfOlyKK7.js";
|
|
21
|
+
import { g as getCssVar } from "../../getCssVar-BP6T9pFM.js";
|
|
22
|
+
import { b as flexOrientationVertical } from "../../styled-CpoX5USb.js";
|
|
23
|
+
const TrayOverlayStyled = styled("div").withConfig({
|
|
24
|
+
displayName: "TrayOverlayStyled",
|
|
25
|
+
componentId: "sc-os3mq3-0"
|
|
26
|
+
})({
|
|
27
|
+
position: "fixed",
|
|
28
|
+
top: 0,
|
|
29
|
+
left: 0,
|
|
30
|
+
flexDirection: "column",
|
|
31
|
+
justifyContent: "center",
|
|
32
|
+
height: "100%",
|
|
33
|
+
width: "100%",
|
|
34
|
+
transition: "background-color 0.5s, visibility 0.5s",
|
|
35
|
+
alignItems: "flex-end",
|
|
36
|
+
overflowX: "hidden",
|
|
37
|
+
display: "flex",
|
|
38
|
+
zIndex: "22",
|
|
39
|
+
"&.trayOpen": {
|
|
40
|
+
backgroundColor: getBackgroundColor(colorBackgroundOverlayStatic)
|
|
41
|
+
},
|
|
42
|
+
"&.trayClosed": {
|
|
43
|
+
backgroundColor: "rgba(0, 0, 0, 0)"
|
|
44
|
+
}
|
|
45
|
+
}, ({
|
|
46
|
+
open
|
|
47
|
+
}) => ({
|
|
48
|
+
visibility: open ? "visible" : "hidden"
|
|
49
|
+
}));
|
|
50
|
+
const TrayStyled = styled(Card).withConfig({
|
|
51
|
+
displayName: "TrayStyled",
|
|
52
|
+
componentId: "sc-os3mq3-1"
|
|
53
|
+
})({
|
|
54
|
+
height: "100%",
|
|
55
|
+
width: "320px",
|
|
56
|
+
...viewport.md({
|
|
57
|
+
width: "420px"
|
|
58
|
+
}),
|
|
59
|
+
...viewport.lg({
|
|
60
|
+
width: "475px"
|
|
61
|
+
}),
|
|
62
|
+
borderTopRightRadius: "0",
|
|
63
|
+
borderBottomRightRadius: "0",
|
|
64
|
+
transition: "transform 0.5s",
|
|
65
|
+
padding: `${getSpacing(spacingMd)} 0 0`,
|
|
66
|
+
display: "flex",
|
|
67
|
+
"&.trayOpen": {
|
|
68
|
+
transform: "translateX(0)"
|
|
69
|
+
},
|
|
70
|
+
"&.trayClosed": {
|
|
71
|
+
transform: "translateX(100%)"
|
|
72
|
+
}
|
|
73
|
+
}, ({
|
|
74
|
+
buttons
|
|
75
|
+
}) => ({
|
|
76
|
+
paddingBottom: buttons ? "0" : getSpacing(spacingMd)
|
|
77
|
+
}));
|
|
78
|
+
const TrayHeadingContainerStyled = styled(Flex).withConfig({
|
|
79
|
+
displayName: "TrayHeadingContainerStyled",
|
|
80
|
+
componentId: "sc-os3mq3-2"
|
|
81
|
+
})({
|
|
82
|
+
padding: `0 ${getSpacing(spacingMd)}`,
|
|
83
|
+
marginBottom: `calc(${getSpacing(spacingMd)} - ${getBorderWidth(borderWidthFocus)})`
|
|
84
|
+
});
|
|
85
|
+
const TrayCloseButtonStyled = styled(IconButton).withConfig({
|
|
86
|
+
displayName: "TrayCloseButtonStyled",
|
|
87
|
+
componentId: "sc-os3mq3-3"
|
|
88
|
+
})({
|
|
89
|
+
flex: "0 0 auto"
|
|
90
|
+
});
|
|
91
|
+
const TrayChildrenContainerStyled = styled("div").withConfig({
|
|
92
|
+
displayName: "TrayChildrenContainerStyled",
|
|
93
|
+
componentId: "sc-os3mq3-4"
|
|
94
|
+
})({
|
|
95
|
+
overflowY: "auto",
|
|
96
|
+
padding: `${getBorderWidth(borderWidthFocus)} ${getSpacing(spacingMd)} 0`
|
|
97
|
+
});
|
|
98
|
+
const TrayButtonContainerStyled = styled("div").withConfig({
|
|
99
|
+
displayName: "TrayButtonContainerStyled",
|
|
100
|
+
componentId: "sc-os3mq3-5"
|
|
101
|
+
})({
|
|
102
|
+
position: "relative",
|
|
103
|
+
transform: "none",
|
|
104
|
+
transition: "none",
|
|
105
|
+
padding: getSpacing(spacingMd),
|
|
106
|
+
boxShadow: getCssVar(shadow28),
|
|
107
|
+
marginTop: "auto"
|
|
108
|
+
});
|
|
109
|
+
const Tray = ({
|
|
110
|
+
heading,
|
|
111
|
+
// This default is set as the 'wrapper' element is currently containing the majority of the content of pages from our CMS.
|
|
112
|
+
contentElements = ".wrapper",
|
|
113
|
+
uid,
|
|
114
|
+
focusElementOnOpen,
|
|
115
|
+
focusElementOnClose,
|
|
116
|
+
children,
|
|
117
|
+
buttons,
|
|
118
|
+
...props
|
|
119
|
+
}) => {
|
|
120
|
+
const [open, setOpen] = useState(props.open === true);
|
|
121
|
+
const invokingElement = useRef(null);
|
|
122
|
+
const headingId = `${uid}-tray-heading`;
|
|
123
|
+
const overlay = useRef(null);
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
setOpen(true === props.open);
|
|
126
|
+
}, [props.open]);
|
|
127
|
+
const headingProps = {
|
|
128
|
+
...heading,
|
|
129
|
+
size: textHeadingMd,
|
|
130
|
+
weight: fontWeightBold,
|
|
131
|
+
id: headingId,
|
|
132
|
+
bottomSpacing: spacingNone
|
|
133
|
+
};
|
|
134
|
+
const onCloseIconButtonClick = (event) => {
|
|
135
|
+
event.preventDefault();
|
|
136
|
+
closeTray();
|
|
137
|
+
};
|
|
138
|
+
const closeWithEscape = (event) => {
|
|
139
|
+
if (event.key !== "Escape") return;
|
|
140
|
+
closeTray();
|
|
141
|
+
};
|
|
142
|
+
const closeOnOverlayClick = (event) => {
|
|
143
|
+
if (uid && event.target === document.getElementById(`${uid}-overlay`)) {
|
|
144
|
+
closeTray();
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const updateAttributes = (element, open2) => {
|
|
148
|
+
if (open2) {
|
|
149
|
+
element.setAttribute("aria-hidden", "true");
|
|
150
|
+
} else {
|
|
151
|
+
element.removeAttribute("aria-hidden");
|
|
152
|
+
}
|
|
153
|
+
element.toggleAttribute("inert", open2);
|
|
154
|
+
};
|
|
155
|
+
const updateElements = (open2) => {
|
|
156
|
+
const content = document.querySelectorAll(contentElements);
|
|
157
|
+
for (const element of content) {
|
|
158
|
+
updateAttributes(element, open2);
|
|
159
|
+
}
|
|
160
|
+
document.body.classList.toggle("HideOverflowY", open2);
|
|
161
|
+
};
|
|
162
|
+
const openTray = (event) => {
|
|
163
|
+
var _a;
|
|
164
|
+
if (invokingElement) invokingElement.current = event.target;
|
|
165
|
+
(_a = props.onToggle) == null ? void 0 : _a.call(props, true);
|
|
166
|
+
setOpen(true);
|
|
167
|
+
};
|
|
168
|
+
const closeTray = () => {
|
|
169
|
+
var _a;
|
|
170
|
+
(_a = props.onToggle) == null ? void 0 : _a.call(props, false);
|
|
171
|
+
setOpen(false);
|
|
172
|
+
};
|
|
173
|
+
const manageFocusOnOpen = () => {
|
|
174
|
+
var _a, _b, _c;
|
|
175
|
+
focusElementOnOpen ? (_a = document.getElementById(focusElementOnOpen)) == null ? void 0 : _a.focus() : (_b = document.getElementById(headingId)) == null ? void 0 : _b.focus();
|
|
176
|
+
(_c = overlay.current) == null ? void 0 : _c.removeEventListener("transitionend", manageFocusOnOpen);
|
|
177
|
+
};
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
const openingElements = document.querySelectorAll(`[data-action='tray-${uid}']`);
|
|
180
|
+
for (const openingElement of openingElements) {
|
|
181
|
+
openingElement.addEventListener("click", openTray);
|
|
182
|
+
}
|
|
183
|
+
return () => {
|
|
184
|
+
for (const openingElement of openingElements) {
|
|
185
|
+
openingElement.removeEventListener("click", openTray);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
}, []);
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
var _a;
|
|
191
|
+
if (open) {
|
|
192
|
+
updateElements(true);
|
|
193
|
+
(_a = overlay.current) == null ? void 0 : _a.addEventListener("transitionend", manageFocusOnOpen);
|
|
194
|
+
document.addEventListener("keydown", closeWithEscape);
|
|
195
|
+
}
|
|
196
|
+
return () => {
|
|
197
|
+
var _a2, _b;
|
|
198
|
+
updateElements(false);
|
|
199
|
+
focusElementOnClose ? (_a2 = document.getElementById(focusElementOnClose)) == null ? void 0 : _a2.focus() : (_b = invokingElement.current) == null ? void 0 : _b.focus();
|
|
200
|
+
document.removeEventListener("keydown", closeWithEscape);
|
|
201
|
+
};
|
|
202
|
+
}, [open]);
|
|
203
|
+
useEffect(() => {
|
|
204
|
+
overlay.current = document.getElementById(`${uid}-overlay`);
|
|
205
|
+
}, []);
|
|
206
|
+
const tray = /* @__PURE__ */ jsx(TrayOverlayStyled, { className: open ? "trayOpen" : "trayClosed", open, id: `${uid}-overlay`, onClick: closeOnOverlayClick, children: /* @__PURE__ */ jsxs(TrayStyled, { className: open ? "trayOpen" : "trayClosed", role: "dialog", "aria-modal": "true", "aria-labelledby": headingId, buttons, children: [
|
|
207
|
+
/* @__PURE__ */ jsxs(TrayHeadingContainerStyled, { justify: "between", bottomSpacing: spacingNone, children: [
|
|
208
|
+
/* @__PURE__ */ jsx(Heading, { ...headingProps, tabIndex: -1 }),
|
|
209
|
+
/* @__PURE__ */ jsx(TrayCloseButtonStyled, { label: "Schließen", iconName: "Close", appearance: "tertiary", bottomSpacing: spacingNone, onClick: onCloseIconButtonClick, type: "button" })
|
|
210
|
+
] }),
|
|
211
|
+
/* @__PURE__ */ jsx(TrayChildrenContainerStyled, { children }),
|
|
212
|
+
buttons && /* @__PURE__ */ jsx(TrayButtonContainerStyled, { children: /* @__PURE__ */ jsx(ButtonGroup, { ...buttons, orientation: flexOrientationVertical, bottomSpacing: spacingNone }) })
|
|
213
|
+
] }) });
|
|
214
|
+
return createPortal(tray, document.body);
|
|
215
|
+
};
|
|
216
|
+
export {
|
|
217
|
+
Tray as default
|
|
218
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const propsNotPassToDomDefault = ["accordionType", "activeId", "activeIndex", "setActiveId", "align", "animated", "appearance", "aspectRatio", "autoLayout", "apiKey", "badge", "borderBottom", "bottomSpacing", "buttonLink", "buttons", "coloringMode", "colorSwatch", "component", "corners", "description", "expanded", "filterItems", "gapSpacing", "grow", "handleOnClick", "handleOnToogle", "hasOverlay", "heading", "heightSm", "heightMd", "heightLg", "horizontalAlignment", "icon", "iconAlign", "iconName", "iconPosition", "images", "isActive", "isChecked", "isDisabled", "isFullscreen", "isOpen", "isOrdered", "isSelected", "isTransparentBackground", "items", "jumpToClickedItem", "justify", "justifyHorizontal", "lg", "loadingSpinnerChild", "mapId", "md", "message", "more", "nextAriaLabel", "notificationType", "objectFit", "objectPosition", "offset", "onUpdate", "openMultiple", "orientation", "padding", "prefix", "prefixWeight", "prevAriaLabel", "price", "productId", "promoPrice", "screenReaderInstruction", "showList", "size", "sm", "spacing", "spinnerType", "status", "stretch", "strikePrice", "suffix", "tag", "textContent", "uid", "variant", "verticalPadding", "viewportHeight", "weight", "width"];
|
|
2
|
+
const filterProps = (propsNotPassToDom = []) => {
|
|
3
|
+
const shouldForwardProp = (prop) => {
|
|
4
|
+
if ("string" !== typeof prop) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
return ![...propsNotPassToDom, ...propsNotPassToDomDefault].includes(prop);
|
|
8
|
+
};
|
|
9
|
+
return shouldForwardProp;
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
filterProps as f
|
|
13
|
+
};
|