@krrli/cm-designsystem 1.29.0 → 1.31.0

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.
@@ -4,6 +4,8 @@ declare const profileBannerInfoStyles: import("tailwind-variants").TVReturnType<
4
4
  [key: string]: import("tailwind-merge").ClassNameValue | {
5
5
  displayName?: import("tailwind-merge").ClassNameValue;
6
6
  base?: import("tailwind-merge").ClassNameValue;
7
+ title?: import("tailwind-merge").ClassNameValue;
8
+ icon?: import("tailwind-merge").ClassNameValue;
7
9
  detailInfo?: import("tailwind-merge").ClassNameValue;
8
10
  secondaryInfo?: import("tailwind-merge").ClassNameValue;
9
11
  };
@@ -13,12 +15,16 @@ declare const profileBannerInfoStyles: import("tailwind-variants").TVReturnType<
13
15
  [x: string]: import("tailwind-merge").ClassNameValue | {
14
16
  displayName?: import("tailwind-merge").ClassNameValue;
15
17
  base?: import("tailwind-merge").ClassNameValue;
18
+ title?: import("tailwind-merge").ClassNameValue;
19
+ icon?: import("tailwind-merge").ClassNameValue;
16
20
  detailInfo?: import("tailwind-merge").ClassNameValue;
17
21
  secondaryInfo?: import("tailwind-merge").ClassNameValue;
18
22
  };
19
23
  };
20
24
  } | {}, {
21
25
  base: string[];
26
+ title: string[];
27
+ icon: string[];
22
28
  displayName: string[];
23
29
  detailInfo: string[];
24
30
  secondaryInfo: string[];
@@ -27,23 +33,31 @@ declare const profileBannerInfoStyles: import("tailwind-variants").TVReturnType<
27
33
  [key: string]: import("tailwind-merge").ClassNameValue | {
28
34
  displayName?: import("tailwind-merge").ClassNameValue;
29
35
  base?: import("tailwind-merge").ClassNameValue;
36
+ title?: import("tailwind-merge").ClassNameValue;
37
+ icon?: import("tailwind-merge").ClassNameValue;
30
38
  detailInfo?: import("tailwind-merge").ClassNameValue;
31
39
  secondaryInfo?: import("tailwind-merge").ClassNameValue;
32
40
  };
33
41
  };
34
42
  } | {}, {
35
43
  base: string[];
44
+ title: string[];
45
+ icon: string[];
36
46
  displayName: string[];
37
47
  detailInfo: string[];
38
48
  secondaryInfo: string[];
39
49
  }, import("tailwind-variants").TVReturnType<unknown, {
40
50
  base: string[];
51
+ title: string[];
52
+ icon: string[];
41
53
  displayName: string[];
42
54
  detailInfo: string[];
43
55
  secondaryInfo: string[];
44
56
  }, undefined, unknown, unknown, undefined>>;
45
57
  type ProfileBannerInfoVariants = VariantProps<typeof profileBannerInfoStyles>;
46
58
  interface ProfileBannerInfoProps extends ProfileBannerInfoVariants {
59
+ /** Whether the profile being viewed belongs to the logged-in user. */
60
+ isCurrentUser: boolean;
47
61
  /**
48
62
  * The user's full display name (e.g., "John Doe").
49
63
  */
@@ -65,7 +79,9 @@ interface ProfileBannerInfoProps extends ProfileBannerInfoVariants {
65
79
  * Callback fired whenever any profile-related element is clicked.
66
80
  * Typically used to open the profile or navigate to a user page.
67
81
  */
68
- onClick: () => void;
82
+ onProfileClick: () => void;
83
+ /** A function called when the settings button is clicked. */
84
+ onSettingsClick?: () => void;
69
85
  }
70
86
  /**
71
87
  * ProfileBannerInfo Component
@@ -1,12 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { tv } from "tailwind-variants";
3
3
  import { IconButton } from "../../components/icon-button/IconButton";
4
- import { Profile, Location, Calendar } from "../../components/icons/generated";
4
+ import { Profile, Location, Calendar, Settings, } from "../../components/icons/generated";
5
5
  import { Label } from "../../components/typography/Label";
6
6
  const profileBannerInfoStyles = tv({
7
7
  slots: {
8
8
  base: ["flex", "flex-col", "gap-2", "items-start"],
9
- displayName: ["text-slate-900", "**:cursor-pointer"],
9
+ title: ["flex", "gap-1", "items-center", "**:cursor-pointer"],
10
+ icon: ["text-violet-600", "-mt-0.5"],
11
+ displayName: ["text-slate-900"],
10
12
  detailInfo: ["flex", "gap-4"],
11
13
  secondaryInfo: ["text-slate-500"],
12
14
  },
@@ -40,6 +42,6 @@ const memberSincePrefix = "Member since ";
40
42
  * Renders profile information used in a user profile banner
41
43
  */
42
44
  export const ProfileBannerInfo = (props) => {
43
- const { base, displayName, detailInfo, secondaryInfo } = profileBannerInfoStyles(props);
44
- return (_jsxs("div", { className: base(), children: [_jsx("button", { onClick: props.onClick, className: displayName(), children: _jsx(Label, { size: "xl", children: props.displayName }) }), _jsxs("div", { className: detailInfo(), children: [_jsx(IconButton, { intent: "secondary", icon: Profile, onClick: props.onClick, children: props.userName }), _jsx(IconButton, { intent: "primary", icon: Location, onClick: props.onClick, className: secondaryInfo(), children: props.location }), _jsx(IconButton, { intent: "primary", icon: Calendar, onClick: props.onClick, className: secondaryInfo(), children: memberSincePrefix + timeSince(props.joinedTimestamp) })] })] }));
45
+ const { base, title, icon, displayName, detailInfo, secondaryInfo } = profileBannerInfoStyles(props);
46
+ return (_jsxs("div", { className: base(), children: [_jsxs("div", { className: title(), children: [_jsx("button", { onClick: props.onProfileClick, className: displayName(), children: _jsx(Label, { size: "xl", children: props.displayName }) }), props.isCurrentUser && (_jsx("button", { onClick: props.onSettingsClick, children: _jsx(Settings, { className: icon() }) }))] }), _jsxs("div", { className: detailInfo(), children: [_jsx(IconButton, { intent: "secondary", icon: Profile, onClick: props.onProfileClick, children: props.userName }), _jsx(IconButton, { intent: "primary", icon: Location, onClick: props.onProfileClick, className: secondaryInfo(), children: props.location }), _jsx(IconButton, { intent: "primary", icon: Calendar, onClick: props.onProfileClick, className: secondaryInfo(), children: memberSincePrefix + timeSince(props.joinedTimestamp) })] })] }));
45
47
  };
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Form } from "@radix-ui/react-form";
3
- import { useState } from "react";
3
+ import { useRef, useState } from "react";
4
4
  import { tv } from "tailwind-variants";
5
- import { Button, FileUpload, Modal, Textarea } from "../../components";
6
- import { Cancel, Checkmark, Send, Upload, } from "../../components/icons/generated";
5
+ import { Button, Textarea } from "../../components";
6
+ import { Send, Upload } from "../../components/icons/generated";
7
+ import { ImageUploadModal, } from "../image-upload-modal/ImageUploadModal";
7
8
  import { PostBase } from "../post-base/PostBase";
8
9
  import { UserInfo } from "../user-info/UserInfo";
9
10
  const ResponseCreatorStyles = tv({
@@ -20,8 +21,8 @@ const ResponseCreatorStyles = tv({
20
21
  */
21
22
  export const ResponseCreator = (props) => {
22
23
  const { content, input, action } = ResponseCreatorStyles(props);
23
- const [open, setOpen] = useState(false);
24
24
  const [file, setFile] = useState(null);
25
25
  const [text, setText] = useState("");
26
- return (_jsxs(_Fragment, { children: [_jsx(PostBase, { children: _jsxs(Form, { className: content(), children: [_jsx(UserInfo, { displayName: props.displayName, onClick: props.onAvatarClick, size: "sm", src: props.src, userName: props.userName }), _jsx("div", { className: input(), children: _jsx(Textarea, { name: "post", placeholder: "Your opinion matters!", onChange: setText }) }), _jsxs("div", { className: action(), children: [_jsx(Button, { intent: "primary", size: "md", icon: Upload, onClick: () => setOpen(true), children: "Picture upload" }), _jsx(Button, { intent: "secondary", size: "md", icon: Send, onClick: () => props.onSendClick(text, file), children: "Send" })] })] }) }), _jsxs(Modal, { open: open, onOpenChange: setOpen, title: "Picture upload", children: [_jsx(Modal.Body, { children: _jsx(FileUpload, { onFileSelect: setFile }) }), _jsxs(Modal.Actions, { children: [_jsx(Button, { intent: "primary", size: "md", icon: Cancel, onClick: () => setOpen(false), children: "Cancel" }), _jsx(Button, { intent: "secondary", size: "md", icon: Checkmark, onClick: () => setOpen(false), children: "Save" })] })] })] }));
26
+ const imageUploadModalRef = useRef(null);
27
+ return (_jsxs(_Fragment, { children: [_jsx(PostBase, { children: _jsxs(Form, { className: content(), children: [_jsx(UserInfo, { displayName: props.displayName, onClick: props.onAvatarClick, size: "sm", src: props.src, userName: props.userName }), _jsx("div", { className: input(), children: _jsx(Textarea, { name: "post", placeholder: "Your opinion matters!", onChange: setText }) }), _jsxs("div", { className: action(), children: [_jsx(Button, { intent: "primary", size: "md", icon: Upload, onClick: () => imageUploadModalRef.current?.openModal(true), children: "Picture upload" }), _jsx(Button, { intent: "secondary", size: "md", icon: Send, onClick: () => props.onSendClick(text, file), children: "Send" })] })] }) }), _jsx(ImageUploadModal, { ref: imageUploadModalRef, onFileChange: setFile })] }));
27
28
  };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  import "./index.css";
2
2
  export * from "./components";
3
+ export * from "./compositions";