@krrli/cm-designsystem 1.32.0 → 1.32.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/assets/fallback.png.js +4 -0
- package/dist/cm-designsystem.css +1944 -1
- package/dist/components/accessible-button/AccessibleButton.js +29 -11
- package/dist/components/avatar/Avatar.js +91 -65
- package/dist/components/branding/BrandingGallery.js +212 -145
- package/dist/components/branding/app-icon-gradient.svg.js +4 -0
- package/dist/components/branding/app-icon-white.svg.js +4 -0
- package/dist/components/branding/hover-logo-default.svg.js +4 -0
- package/dist/components/branding/hover-logo-hovered.svg.js +4 -0
- package/dist/components/branding/logo-inline-gradient.svg.js +4 -0
- package/dist/components/branding/logo-inline-violet.svg.js +4 -0
- package/dist/components/branding/logo-inline-white.svg.js +4 -0
- package/dist/components/branding/logo-stacked-gradient.svg.js +4 -0
- package/dist/components/branding/logo-stacked-violet.svg.js +4 -0
- package/dist/components/branding/logo-stacked-white.svg.js +4 -0
- package/dist/components/branding/superzeichen.svg.js +4 -0
- package/dist/components/button/Button.js +61 -55
- package/dist/components/color/ColorDoc.js +26 -7
- package/dist/components/file-upload/FileUpload.js +129 -66
- package/dist/components/form/Form.js +33 -26
- package/dist/components/icon-button/IconButton.js +33 -29
- package/dist/components/icons/IconBase.js +21 -6
- package/dist/components/icons/generated/ArrowDown.js +15 -4
- package/dist/components/icons/generated/ArrowLeft.js +15 -4
- package/dist/components/icons/generated/ArrowRight.js +15 -4
- package/dist/components/icons/generated/ArrowUp.js +15 -4
- package/dist/components/icons/generated/Calendar.js +15 -4
- package/dist/components/icons/generated/Cancel.js +12 -4
- package/dist/components/icons/generated/Checkmark.js +12 -4
- package/dist/components/icons/generated/Edit.js +9 -4
- package/dist/components/icons/generated/Eye.js +15 -4
- package/dist/components/icons/generated/Fullscreen.js +9 -4
- package/dist/components/icons/generated/HeartFilled.js +15 -4
- package/dist/components/icons/generated/HeartOutline.js +15 -4
- package/dist/components/icons/generated/Location.js +15 -4
- package/dist/components/icons/generated/LogOut.js +12 -4
- package/dist/components/icons/generated/Mumble.js +13 -4
- package/dist/components/icons/generated/Profile.js +12 -4
- package/dist/components/icons/generated/ReplyFilled.js +15 -4
- package/dist/components/icons/generated/ReplyOutline.js +15 -4
- package/dist/components/icons/generated/Repost.js +15 -4
- package/dist/components/icons/generated/Send.js +15 -4
- package/dist/components/icons/generated/Settings.js +15 -4
- package/dist/components/icons/generated/Share.js +12 -4
- package/dist/components/icons/generated/Time.js +12 -4
- package/dist/components/icons/generated/Upload.js +21 -4
- package/dist/components/input/Input.js +67 -41
- package/dist/components/like-toggle/LikeToggle.js +203 -176
- package/dist/components/logo-link/LogoLink.js +56 -34
- package/dist/components/modal/Modal.js +66 -50
- package/dist/components/navi-button/NaviButton.js +42 -30
- package/dist/components/navi-user-button/NaviUserButton.js +39 -29
- package/dist/components/round-button/RoundButton.js +39 -29
- package/dist/components/tabs/TabItem.js +11 -8
- package/dist/components/tabs/Tabs.js +74 -59
- package/dist/components/text-link/TextLink.js +14 -11
- package/dist/components/textarea/Textarea.js +57 -41
- package/dist/components/timed-button/TimedButton.js +116 -102
- package/dist/components/toggle/Toggle.js +91 -62
- package/dist/components/typography/AccessibleTypography.js +12 -9
- package/dist/components/typography/Heading.js +13 -9
- package/dist/components/typography/Label.js +13 -9
- package/dist/components/typography/Paragraph.js +13 -9
- package/dist/components/typography/Placeholder.js +13 -9
- package/dist/components/typography/ValidationMessage.js +14 -9
- package/dist/components/typography/styles.js +53 -46
- package/dist/compositions/image-banner/ImageBanner.js +53 -45
- package/dist/compositions/image-upload-modal/ImageUploadModal.js +44 -20
- package/dist/compositions/post/Post.js +81 -26
- package/dist/compositions/post-base/PostBase.js +23 -24
- package/dist/compositions/post-creator/PostCreator.js +72 -24
- package/dist/compositions/profile-banner/ProfileBanner.js +71 -21
- package/dist/compositions/profile-banner-image/ProfileBannerImage.js +60 -52
- package/dist/compositions/profile-banner-info/ProfileBannerInfo.js +72 -40
- package/dist/compositions/response/Response.js +63 -19
- package/dist/compositions/response-creator/ResponseCreator.js +67 -23
- package/dist/compositions/user-info/UserInfo.js +71 -52
- package/dist/compositions/user-recommendation/UserRecommendation.js +58 -30
- package/dist/index.js +129 -4
- package/package.json +14 -11
- package/dist/components/accessible-button/AccessibleButton.d.ts +0 -32
- package/dist/components/accessible-button/AccessibleButton.test.d.ts +0 -1
- package/dist/components/accessible-button/AccessibleButton.test.js +0 -28
- package/dist/components/avatar/Avatar.d.ts +0 -118
- package/dist/components/branding/BrandingGallery.d.ts +0 -1
- package/dist/components/button/Button.d.ts +0 -66
- package/dist/components/button/Button.test.d.ts +0 -1
- package/dist/components/button/Button.test.js +0 -30
- package/dist/components/color/ColorDoc.d.ts +0 -4
- package/dist/components/file-upload/FileUpload.d.ts +0 -83
- package/dist/components/form/Form.d.ts +0 -54
- package/dist/components/icon-button/IconButton.d.ts +0 -69
- package/dist/components/icon-button/IconButton.test.d.ts +0 -1
- package/dist/components/icon-button/IconButton.test.js +0 -22
- package/dist/components/icons/IconBase.d.ts +0 -5
- package/dist/components/icons/generated/ArrowDown.d.ts +0 -3
- package/dist/components/icons/generated/ArrowLeft.d.ts +0 -3
- package/dist/components/icons/generated/ArrowRight.d.ts +0 -3
- package/dist/components/icons/generated/ArrowUp.d.ts +0 -3
- package/dist/components/icons/generated/Calendar.d.ts +0 -3
- package/dist/components/icons/generated/Cancel.d.ts +0 -3
- package/dist/components/icons/generated/Checkmark.d.ts +0 -3
- package/dist/components/icons/generated/Edit.d.ts +0 -3
- package/dist/components/icons/generated/Eye.d.ts +0 -3
- package/dist/components/icons/generated/Fullscreen.d.ts +0 -3
- package/dist/components/icons/generated/HeartFilled.d.ts +0 -3
- package/dist/components/icons/generated/HeartOutline.d.ts +0 -3
- package/dist/components/icons/generated/Location.d.ts +0 -3
- package/dist/components/icons/generated/LogOut.d.ts +0 -3
- package/dist/components/icons/generated/Mumble.d.ts +0 -3
- package/dist/components/icons/generated/Profile.d.ts +0 -3
- package/dist/components/icons/generated/ReplyFilled.d.ts +0 -3
- package/dist/components/icons/generated/ReplyOutline.d.ts +0 -3
- package/dist/components/icons/generated/Repost.d.ts +0 -3
- package/dist/components/icons/generated/Send.d.ts +0 -3
- package/dist/components/icons/generated/Settings.d.ts +0 -3
- package/dist/components/icons/generated/Share.d.ts +0 -3
- package/dist/components/icons/generated/Time.d.ts +0 -3
- package/dist/components/icons/generated/Upload.d.ts +0 -3
- package/dist/components/icons/generated/index.d.ts +0 -24
- package/dist/components/icons/generated/index.js +0 -24
- package/dist/components/index.d.ts +0 -27
- package/dist/components/index.js +0 -27
- package/dist/components/input/Input.d.ts +0 -61
- package/dist/components/like-toggle/LikeToggle.d.ts +0 -97
- package/dist/components/like-toggle/LikeToggle.test.d.ts +0 -1
- package/dist/components/like-toggle/LikeToggle.test.js +0 -35
- package/dist/components/logo-link/LogoLink.d.ts +0 -11
- package/dist/components/modal/Modal.d.ts +0 -75
- package/dist/components/modal/Modal.test.d.ts +0 -1
- package/dist/components/modal/Modal.test.js +0 -24
- package/dist/components/navi-button/NaviButton.d.ts +0 -49
- package/dist/components/navi-button/NaviButton.test.d.ts +0 -1
- package/dist/components/navi-button/NaviButton.test.js +0 -22
- package/dist/components/navi-user-button/NaviUserButton.d.ts +0 -44
- package/dist/components/round-button/RoundButton.d.ts +0 -44
- package/dist/components/round-button/RoundButton.test.d.ts +0 -1
- package/dist/components/round-button/RoundButton.test.js +0 -22
- package/dist/components/tabs/TabItem.d.ts +0 -11
- package/dist/components/tabs/Tabs.d.ts +0 -67
- package/dist/components/tabs/Tabs.test.d.ts +0 -1
- package/dist/components/tabs/Tabs.test.js +0 -61
- package/dist/components/text-link/TextLink.d.ts +0 -9
- package/dist/components/text-link/TextLink.test.d.ts +0 -1
- package/dist/components/text-link/TextLink.test.js +0 -14
- package/dist/components/textarea/Textarea.d.ts +0 -48
- package/dist/components/timed-button/TimedButton.d.ts +0 -79
- package/dist/components/timed-button/TimedButton.test.d.ts +0 -1
- package/dist/components/timed-button/TimedButton.test.js +0 -36
- package/dist/components/toggle/Toggle.d.ts +0 -62
- package/dist/components/toggle/Toggle.test.d.ts +0 -1
- package/dist/components/toggle/Toggle.test.js +0 -93
- package/dist/components/typography/AccessibleTypography.d.ts +0 -33
- package/dist/components/typography/Heading.d.ts +0 -24
- package/dist/components/typography/Label.d.ts +0 -22
- package/dist/components/typography/Paragraph.d.ts +0 -22
- package/dist/components/typography/Placeholder.d.ts +0 -17
- package/dist/components/typography/ValidationMessage.d.ts +0 -22
- package/dist/components/typography/styles.d.ts +0 -74
- package/dist/compositions/image-banner/ImageBanner.d.ts +0 -54
- package/dist/compositions/image-upload-modal/ImageUploadModal.d.ts +0 -15
- package/dist/compositions/index.d.ts +0 -11
- package/dist/compositions/index.js +0 -11
- package/dist/compositions/post/Post.d.ts +0 -75
- package/dist/compositions/post-base/PostBase.d.ts +0 -41
- package/dist/compositions/post-creator/PostCreator.d.ts +0 -69
- package/dist/compositions/profile-banner/ProfileBanner.d.ts +0 -82
- package/dist/compositions/profile-banner-image/ProfileBannerImage.d.ts +0 -54
- package/dist/compositions/profile-banner-info/ProfileBannerInfo.d.ts +0 -92
- package/dist/compositions/response/Response.d.ts +0 -75
- package/dist/compositions/response-creator/ResponseCreator.d.ts +0 -63
- package/dist/compositions/user-info/UserInfo.d.ts +0 -75
- package/dist/compositions/user-recommendation/UserRecommendation.d.ts +0 -63
- package/dist/favicon.svg +0 -18
- package/dist/index.d.ts +0 -3
- package/dist/index.es.js +0 -8343
- package/dist/logo-inline-gradient.svg +0 -43
- package/dist/setupTests.d.ts +0 -1
- package/dist/setupTests.js +0 -7
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { IconBase } from "../IconBase.js";
|
|
3
|
+
const Upload = (props) => /* @__PURE__ */ jsxs(IconBase, { label: "Upload", ...props, children: [
|
|
4
|
+
/* @__PURE__ */ jsx(
|
|
5
|
+
"path",
|
|
6
|
+
{
|
|
7
|
+
fill: "currentColor",
|
|
8
|
+
d: "M14 10a1 1 0 0 0-1 1v2H3v-2a1 1 0 0 0-2 0v2a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-2a1 1 0 0 0-1-1"
|
|
9
|
+
}
|
|
10
|
+
),
|
|
11
|
+
/* @__PURE__ */ jsx(
|
|
12
|
+
"path",
|
|
13
|
+
{
|
|
14
|
+
fill: "currentColor",
|
|
15
|
+
d: "M4.707 6.707 7 4.414V10a1 1 0 1 0 2 0V4.414l2.293 2.293a1 1 0 0 0 1.414-1.414l-4-4a1 1 0 0 0-1.414 0l-4 4a1 1 0 0 0 1.414 1.414"
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
] });
|
|
19
|
+
export {
|
|
20
|
+
Upload
|
|
21
|
+
};
|
|
@@ -1,48 +1,74 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as RadixForm from "@radix-ui/react-form";
|
|
4
4
|
import React, { useState } from "react";
|
|
5
5
|
import { tv } from "tailwind-variants";
|
|
6
|
-
import { Label } from "../typography/Label";
|
|
7
|
-
import { labelStyles, placeholderStyles } from "../typography/styles";
|
|
8
|
-
import { ValidationMessage } from "../typography/ValidationMessage";
|
|
6
|
+
import { Label } from "../typography/Label.js";
|
|
7
|
+
import { labelStyles, placeholderStyles } from "../typography/styles.js";
|
|
8
|
+
import { ValidationMessage } from "../typography/ValidationMessage.js";
|
|
9
9
|
const inputStyles = tv({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
10
|
+
slots: {
|
|
11
|
+
base: ["flex", "flex-col", "gap-1"],
|
|
12
|
+
controlContainer: ["relative", "inline-block"],
|
|
13
|
+
control: [
|
|
14
|
+
"w-full",
|
|
15
|
+
"ring",
|
|
16
|
+
"focus:ring-2",
|
|
17
|
+
"ring-slate-200",
|
|
18
|
+
"hover:ring-violet-600",
|
|
19
|
+
"focus-visible:ring-violet-600",
|
|
20
|
+
"focus-within:ring-violet-600",
|
|
21
|
+
"focus-visible:outline-none",
|
|
22
|
+
"bg-slate-50",
|
|
23
|
+
"rounded-lg",
|
|
24
|
+
"p-4",
|
|
25
|
+
"text-slate-700",
|
|
26
|
+
"transition",
|
|
27
|
+
"duration-300",
|
|
28
|
+
"ease-in-out"
|
|
29
|
+
],
|
|
30
|
+
icon: ["absolute", "w-4", "h-4", "right-4", "top-4.5"],
|
|
31
|
+
message: ["text-error"]
|
|
32
|
+
},
|
|
33
|
+
variants: {
|
|
34
|
+
hasIcon: {
|
|
35
|
+
true: { control: ["pr-10"] },
|
|
36
|
+
false: { control: ["pr-4"] }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
39
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
const Input = ({
|
|
41
|
+
type = "text",
|
|
42
|
+
isRequired = false,
|
|
43
|
+
...props
|
|
44
|
+
}) => {
|
|
45
|
+
const { base, controlContainer, control, message, icon } = inputStyles({
|
|
46
|
+
hasIcon: !!props.children,
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
const [value, setValue] = useState("");
|
|
50
|
+
return /* @__PURE__ */ jsxs(RadixForm.Field, { name: props.name, className: base(props), children: [
|
|
51
|
+
/* @__PURE__ */ jsx(RadixForm.Label, { children: /* @__PURE__ */ jsx(Label, { size: "md", children: props.label }) }),
|
|
52
|
+
/* @__PURE__ */ jsxs("div", { className: controlContainer(props), children: [
|
|
53
|
+
/* @__PURE__ */ jsx(RadixForm.Control, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
54
|
+
"input",
|
|
55
|
+
{
|
|
56
|
+
className: `${control(props)} ${labelStyles({ size: "md" })} ${placeholderStyles()}`,
|
|
57
|
+
type,
|
|
58
|
+
required: isRequired,
|
|
59
|
+
placeholder: props.placeholder,
|
|
60
|
+
onChange: (e) => setValue(e.target.value),
|
|
61
|
+
onBlur: () => props.onChange(value)
|
|
62
|
+
}
|
|
63
|
+
) }),
|
|
64
|
+
props.children && React.cloneElement(props.children, { className: icon(props) })
|
|
65
|
+
] }),
|
|
66
|
+
/* @__PURE__ */ jsxs("div", { className: message(props), children: [
|
|
67
|
+
isRequired && /* @__PURE__ */ jsx(RadixForm.Message, { match: "valueMissing", children: /* @__PURE__ */ jsx(ValidationMessage, { children: `${props.name} is required` }) }),
|
|
68
|
+
/* @__PURE__ */ jsx(RadixForm.Message, { match: "typeMismatch", children: /* @__PURE__ */ jsx(ValidationMessage, { children: `${props.name} is invalid` }) })
|
|
69
|
+
] })
|
|
70
|
+
] });
|
|
71
|
+
};
|
|
72
|
+
export {
|
|
73
|
+
Input
|
|
48
74
|
};
|
|
@@ -1,187 +1,214 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as RadixToggle from "@radix-ui/react-toggle";
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { tv } from "tailwind-variants";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { Label } from "../typography/Label.js";
|
|
7
|
+
import { HeartFilled } from "../icons/generated/HeartFilled.js";
|
|
8
|
+
import { HeartOutline } from "../icons/generated/HeartOutline.js";
|
|
8
9
|
const toggleStyles = tv({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
slots: {
|
|
11
|
+
base: [
|
|
12
|
+
"inline-flex",
|
|
13
|
+
"items-center",
|
|
14
|
+
"justify-center",
|
|
15
|
+
"gap-2",
|
|
16
|
+
"h-8",
|
|
17
|
+
"px-3",
|
|
18
|
+
"py-2",
|
|
19
|
+
"rounded-full",
|
|
20
|
+
"transition-all",
|
|
21
|
+
"duration-150",
|
|
22
|
+
"ease-in-out",
|
|
23
|
+
"focus-visible:outline-none",
|
|
24
|
+
"focus-visible:ring-2",
|
|
25
|
+
"focus-visible:ring-offset-2",
|
|
26
|
+
"disabled:opacity-50",
|
|
27
|
+
"disabled:pointer-events-none",
|
|
28
|
+
"cursor-pointer"
|
|
29
|
+
],
|
|
30
|
+
icon: ["inline-flex"],
|
|
31
|
+
label: []
|
|
32
|
+
},
|
|
33
|
+
variants: {
|
|
34
|
+
pressed: {
|
|
35
|
+
false: {
|
|
36
|
+
base: ["bg-transparent", "hover:bg-pink-50", "hover:text-pink-600"],
|
|
37
|
+
icon: [
|
|
38
|
+
"text-inherit",
|
|
39
|
+
"hover:transition-all",
|
|
40
|
+
"hover:duration-350",
|
|
41
|
+
"hover:ease-in-out"
|
|
28
42
|
],
|
|
29
|
-
|
|
30
|
-
|
|
43
|
+
label: [
|
|
44
|
+
"text-inherit",
|
|
45
|
+
"hover:transition-all",
|
|
46
|
+
"hover:duration-350",
|
|
47
|
+
"hover:ease-in-out"
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
true: {
|
|
51
|
+
base: [],
|
|
52
|
+
icon: ["text-pink-500", "transition-all", "duration-300", "ease-out"],
|
|
53
|
+
label: [
|
|
54
|
+
"text-pink-900",
|
|
55
|
+
"transition-transform",
|
|
56
|
+
"duration-300",
|
|
57
|
+
"ease-out"
|
|
58
|
+
]
|
|
59
|
+
}
|
|
31
60
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"hover:duration-350",
|
|
40
|
-
"hover:ease-in-out",
|
|
41
|
-
],
|
|
42
|
-
label: [
|
|
43
|
-
"text-inherit",
|
|
44
|
-
"hover:transition-all",
|
|
45
|
-
"hover:duration-350",
|
|
46
|
-
"hover:ease-in-out",
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
true: {
|
|
50
|
-
base: [],
|
|
51
|
-
icon: ["text-pink-500", "transition-all", "duration-300", "ease-out"],
|
|
52
|
-
label: [
|
|
53
|
-
"text-pink-900",
|
|
54
|
-
"transition-transform",
|
|
55
|
-
"duration-300",
|
|
56
|
-
"ease-out",
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
hasLikes: {
|
|
61
|
-
true: {
|
|
62
|
-
base: ["hover:bg-pink-50", "hover:text-pink-600"],
|
|
63
|
-
icon: ["text-pink-500"],
|
|
64
|
-
label: ["text-pink-900"],
|
|
65
|
-
},
|
|
66
|
-
false: "",
|
|
67
|
-
},
|
|
68
|
-
animating: {
|
|
69
|
-
true: {},
|
|
70
|
-
false: {},
|
|
71
|
-
},
|
|
61
|
+
hasLikes: {
|
|
62
|
+
true: {
|
|
63
|
+
base: ["hover:bg-pink-50", "hover:text-pink-600"],
|
|
64
|
+
icon: ["text-pink-500"],
|
|
65
|
+
label: ["text-pink-900"]
|
|
66
|
+
},
|
|
67
|
+
false: ""
|
|
72
68
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
class: {
|
|
118
|
-
label: [
|
|
119
|
-
"opacity-0",
|
|
120
|
-
"-translate-y-1",
|
|
121
|
-
"transition-all",
|
|
122
|
-
"duration-300",
|
|
123
|
-
"ease-out",
|
|
124
|
-
],
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
// not pressed + nicht animating
|
|
128
|
-
{
|
|
129
|
-
pressed: false,
|
|
130
|
-
animating: false,
|
|
131
|
-
class: {
|
|
132
|
-
label: [
|
|
133
|
-
"opacity-100",
|
|
134
|
-
"translate-y-0",
|
|
135
|
-
"transition-all",
|
|
136
|
-
"duration-300",
|
|
137
|
-
"ease-out",
|
|
138
|
-
],
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
defaultVariants: {
|
|
143
|
-
pressed: false,
|
|
144
|
-
animating: false,
|
|
69
|
+
animating: {
|
|
70
|
+
true: {},
|
|
71
|
+
false: {}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
compoundVariants: [
|
|
75
|
+
// pressed + animating --> Label ausblenden / nach oben verschieben
|
|
76
|
+
{
|
|
77
|
+
pressed: true,
|
|
78
|
+
animating: true,
|
|
79
|
+
class: {
|
|
80
|
+
label: [
|
|
81
|
+
"opacity-0",
|
|
82
|
+
"-translate-y-1",
|
|
83
|
+
"transition-all",
|
|
84
|
+
"duration-300",
|
|
85
|
+
"ease-out"
|
|
86
|
+
],
|
|
87
|
+
icon: ["text-pink-500"]
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
// pressed + nicht animating --> Label sichtbar
|
|
91
|
+
{
|
|
92
|
+
pressed: true,
|
|
93
|
+
animating: false,
|
|
94
|
+
class: {
|
|
95
|
+
label: [
|
|
96
|
+
"opacity-100",
|
|
97
|
+
"translate-y-0",
|
|
98
|
+
"text-pink-900",
|
|
99
|
+
"transition-all",
|
|
100
|
+
"duration-300",
|
|
101
|
+
"ease-out"
|
|
102
|
+
],
|
|
103
|
+
icon: ["text-pink-500"]
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
// pressed + hasLikes --> überschreibt Hover-Farbe
|
|
107
|
+
{
|
|
108
|
+
pressed: true,
|
|
109
|
+
hasLikes: true,
|
|
110
|
+
class: {
|
|
111
|
+
label: ["text-pink-900"]
|
|
112
|
+
}
|
|
145
113
|
},
|
|
114
|
+
// not pressed + animating
|
|
115
|
+
{
|
|
116
|
+
pressed: false,
|
|
117
|
+
animating: true,
|
|
118
|
+
class: {
|
|
119
|
+
label: [
|
|
120
|
+
"opacity-0",
|
|
121
|
+
"-translate-y-1",
|
|
122
|
+
"transition-all",
|
|
123
|
+
"duration-300",
|
|
124
|
+
"ease-out"
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
// not pressed + nicht animating
|
|
129
|
+
{
|
|
130
|
+
pressed: false,
|
|
131
|
+
animating: false,
|
|
132
|
+
class: {
|
|
133
|
+
label: [
|
|
134
|
+
"opacity-100",
|
|
135
|
+
"translate-y-0",
|
|
136
|
+
"transition-all",
|
|
137
|
+
"duration-300",
|
|
138
|
+
"ease-out"
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
defaultVariants: {
|
|
144
|
+
pressed: false,
|
|
145
|
+
animating: false
|
|
146
|
+
}
|
|
146
147
|
});
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
148
|
+
const LikeToggle = ({
|
|
149
|
+
pressed = false,
|
|
150
|
+
likes = 0,
|
|
151
|
+
onLikeChange
|
|
152
|
+
}) => {
|
|
153
|
+
const [animating, setAnimating] = useState(false);
|
|
154
|
+
const [selected, setSelected] = useState(pressed);
|
|
155
|
+
const [currentLikes, setCurrentLikes] = useState(likes);
|
|
156
|
+
const [label, setLabel] = useState(
|
|
157
|
+
likes ? likes === 1 ? `${likes} Like` : `${likes} Likes` : "Like"
|
|
158
|
+
);
|
|
159
|
+
const {
|
|
160
|
+
base,
|
|
161
|
+
icon,
|
|
162
|
+
label: labelSlot
|
|
163
|
+
} = toggleStyles({
|
|
164
|
+
pressed: selected,
|
|
165
|
+
hasLikes: currentLikes > 0,
|
|
166
|
+
animating
|
|
167
|
+
});
|
|
168
|
+
const handlePressedChange = (nextSelected) => {
|
|
169
|
+
if (nextSelected === selected) return;
|
|
170
|
+
setSelected(nextSelected);
|
|
171
|
+
if (nextSelected) {
|
|
172
|
+
setLabel("Liked");
|
|
173
|
+
} else {
|
|
174
|
+
setLabel(
|
|
175
|
+
currentLikes === 0 ? "Like" : currentLikes === 1 ? "1 Like" : `${currentLikes} Likes`
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
onLikeChange(nextSelected);
|
|
179
|
+
setTimeout(() => {
|
|
180
|
+
setCurrentLikes((prev) => {
|
|
181
|
+
const updated = Math.max(0, prev + (nextSelected ? 1 : -1));
|
|
182
|
+
setLabel(
|
|
183
|
+
updated === 0 ? "Like" : updated === 1 ? "1 Like" : `${updated} Likes`
|
|
184
|
+
);
|
|
185
|
+
setAnimating(true);
|
|
186
|
+
setTimeout(() => setAnimating(false), 300);
|
|
187
|
+
return updated;
|
|
188
|
+
});
|
|
189
|
+
}, 2e3);
|
|
190
|
+
};
|
|
191
|
+
return /* @__PURE__ */ jsxs(
|
|
192
|
+
RadixToggle.Root,
|
|
193
|
+
{
|
|
194
|
+
className: base(),
|
|
195
|
+
pressed: selected,
|
|
196
|
+
onPressedChange: handlePressedChange,
|
|
197
|
+
children: [
|
|
198
|
+
/* @__PURE__ */ jsx(
|
|
199
|
+
"span",
|
|
200
|
+
{
|
|
201
|
+
className: icon(),
|
|
202
|
+
"aria-hidden": "true",
|
|
203
|
+
"aria-label": selected ? "HeartFilled" : "HeartOutline",
|
|
204
|
+
children: selected ? /* @__PURE__ */ jsx(HeartFilled, {}) : /* @__PURE__ */ jsx(HeartOutline, {})
|
|
205
|
+
}
|
|
206
|
+
),
|
|
207
|
+
/* @__PURE__ */ jsx("span", { className: labelSlot(), children: /* @__PURE__ */ jsx(Label, { as: "span", size: "md", children: label }) })
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
};
|
|
212
|
+
export {
|
|
213
|
+
LikeToggle
|
|
187
214
|
};
|
|
@@ -1,38 +1,60 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { tv } from "tailwind-variants";
|
|
3
|
-
import hoverLogoDefault from "../branding/hover-logo-default.svg";
|
|
4
|
-
import hoverLogoHovered from "../branding/hover-logo-hovered.svg";
|
|
3
|
+
import hoverLogoDefault from "../branding/hover-logo-default.svg.js";
|
|
4
|
+
import hoverLogoHovered from "../branding/hover-logo-hovered.svg.js";
|
|
5
5
|
const logoStyles = tv({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
6
|
+
slots: {
|
|
7
|
+
link: [
|
|
8
|
+
"focus-ring-neutral",
|
|
9
|
+
"inline-flex",
|
|
10
|
+
"items-center",
|
|
11
|
+
"gap-2",
|
|
12
|
+
"align-middle"
|
|
13
|
+
],
|
|
14
|
+
container: ["group", "relative", "w-auto"],
|
|
15
|
+
default: [
|
|
16
|
+
"transition-all",
|
|
17
|
+
"duration-200",
|
|
18
|
+
"select-none",
|
|
19
|
+
"block",
|
|
20
|
+
"h-10",
|
|
21
|
+
"w-auto",
|
|
22
|
+
"group-hover:hidden"
|
|
23
|
+
],
|
|
24
|
+
hover: [
|
|
25
|
+
"transition-all",
|
|
26
|
+
"duration-200",
|
|
27
|
+
"select-none",
|
|
28
|
+
"hidden",
|
|
29
|
+
"h-11",
|
|
30
|
+
"w-auto",
|
|
31
|
+
"group-hover:block"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
34
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const LogoLink = ({ href = "/", ...props }) => {
|
|
36
|
+
const styles = logoStyles();
|
|
37
|
+
return /* @__PURE__ */ jsx("a", { href, className: styles.link(), ...props, children: /* @__PURE__ */ jsxs("div", { className: styles.container(), children: [
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
"img",
|
|
40
|
+
{
|
|
41
|
+
src: hoverLogoDefault,
|
|
42
|
+
alt: "Logo Default",
|
|
43
|
+
className: styles.default(),
|
|
44
|
+
draggable: false
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ jsx(
|
|
48
|
+
"img",
|
|
49
|
+
{
|
|
50
|
+
src: hoverLogoHovered,
|
|
51
|
+
alt: "Logo Hovered",
|
|
52
|
+
className: styles.hover(),
|
|
53
|
+
draggable: false
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
] }) });
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
LogoLink
|
|
38
60
|
};
|