@bigbinary/neeto-molecules 3.4.2 → 3.6.0-beta-1

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.
@@ -0,0 +1,166 @@
1
+ import React from "react";
2
+ import { HelpPopoverProps } from "./HelpPopover";
3
+ interface Details {
4
+ name?: string;
5
+ value: string;
6
+ label?: string;
7
+ key?: string;
8
+ icon?: React.ReactNode;
9
+ error?: string;
10
+ kind?: string;
11
+ isEditable?: boolean;
12
+ extraClasses?: string;
13
+ extraWrapperClasses?: string;
14
+ id?: string;
15
+ fieldValueId?: string;
16
+ custom?: boolean;
17
+ showCopyButton?: boolean;
18
+ }
19
+ ;
20
+ /**
21
+ *
22
+ * SessionEnvironment is a component that displays the session details like name,
23
+ *
24
+ * email, phone number, etc. It also provides an option to view more details, where
25
+ *
26
+ * you can see additional information about the session, which is hidden by
27
+ *
28
+ * default.
29
+ *
30
+ * ![Screenshot](https://github.com/user-attachments/assets/37f608e0-8a3d-4f47-87e2-fcd49ba067a4|height=200|width=300)
31
+ *
32
+ * @example
33
+ *
34
+ * import SessionEnvironment from "@bigbinary/neeto-molecules/SessionEnvironment";
35
+ *
36
+ * const App = () => {
37
+ * const details = [
38
+ * { name: "name", value: "John Doe" },
39
+ * { name: "email", value: "john.doe@example.com" },
40
+ * { name: "phone_number", value: "+1 123 456 7890" },
41
+ * ];
42
+ *
43
+ * const moreDetails = [
44
+ * {
45
+ * name: "created_at",
46
+ * value: "2021-09-01 12:00:00",
47
+ * kind: "datetime",
48
+ * label: "Created at",
49
+ * },
50
+ * {
51
+ * name: "updated_at",
52
+ * value: "2021-09-01 12:00:00",
53
+ * kind: "datetime",
54
+ * label: "Updated at",
55
+ * },
56
+ * ];
57
+ *
58
+ * return (
59
+ * <div>
60
+ * <SessionEnvironment
61
+ * details={details}
62
+ * helpPopoverProps={{
63
+ * description:
64
+ * "The details pane shows extra information about your recording. Additional details on each metadata field can be found in the help article.",
65
+ * helpLinkProps: {
66
+ * href: "https://neetoreplayhelp.neetokb.com/articles/recording-details",
67
+ * label: t("common.viewHelpArticle"),
68
+ * },
69
+ * }}
70
+ * moreDetails={moreDetails}
71
+ * title="Recording details"
72
+ * />
73
+ * </div>
74
+ * );
75
+ * };
76
+ * @endexample
77
+ * @example
78
+ *
79
+ * import { useState } from "react";
80
+ *
81
+ * import SessionEnvironment from "@bigbinary/neeto-molecules/SessionEnvironment";
82
+ *
83
+ * const App = () => {
84
+ * const basicDetails = [
85
+ * {
86
+ * name: "name",
87
+ * value: "John Doe",
88
+ * isEditable: true,
89
+ * },
90
+ * {
91
+ * name: "email",
92
+ * value: "john.doe@example.com",
93
+ * isEditable: true,
94
+ * },
95
+ * {
96
+ * name: "phone_number",
97
+ * value: "+1 123 456 7890",
98
+ * },
99
+ * ];
100
+ *
101
+ * const moreDetails = [
102
+ * {
103
+ * name: "created_at",
104
+ * value: "2021-09-01 12:00:00",
105
+ * kind: "datetime",
106
+ * label: "Created at",
107
+ * },
108
+ * {
109
+ * name: "updated_at",
110
+ * value: "2021-09-01 12:00:00",
111
+ * kind: "datetime",
112
+ * label: "Updated at",
113
+ * },
114
+ * ];
115
+ *
116
+ * const [editableDetails, setEditableDetails] = useState([
117
+ * ...basicDetails,
118
+ * ...moreDetails,
119
+ * ]);
120
+ *
121
+ * const handleSubmit = ({ name, value }) => {
122
+ * setEditableDetails(oldDetails =>
123
+ * oldDetails.map(detail => {
124
+ * if (detail.name === name) {
125
+ * return { ...detail, value, isEditing: false };
126
+ * }
127
+ *
128
+ * return detail;
129
+ * })
130
+ * );
131
+ * };
132
+ *
133
+ * const handleCancel = name => {
134
+ * setEditableDetails(oldDetails =>
135
+ * oldDetails.map(detail => {
136
+ * if (detail.name === name) return findBy({ name }, args.details);
137
+ *
138
+ * return detail;
139
+ * })
140
+ * );
141
+ * };
142
+ *
143
+ * return (
144
+ * <div>
145
+ * <SessionEnvironment
146
+ * details={basicDetails}
147
+ * handleCancel={handleCancel}
148
+ * handleSubmit={handleSubmit}
149
+ * moreDetails={moreDetails}
150
+ * />
151
+ * </div>
152
+ * );
153
+ * };
154
+ * @endexample
155
+ */
156
+ const SessionEnvironment: React.FC<{
157
+ details: Details[];
158
+ handleCancel?: (string) => void;
159
+ handleSubmit?: (object) => void;
160
+ helpPopoverProps?: HelpPopoverProps;
161
+ iconSize?: number;
162
+ isLoading?: boolean;
163
+ moreDetails?: Details[];
164
+ title?: string;
165
+ }>;
166
+ export default SessionEnvironment;
@@ -9,7 +9,7 @@ import React from "react";
9
9
  *
10
10
  * @example
11
11
  *
12
- * import StatusDropdown from "@bigbinary/neeto-molecules/Sidebar";
12
+ * import StatusDropdown from "@bigbinary/neeto-molecules/StatusDropdown";
13
13
  *
14
14
  * const App = () => {
15
15
  * const [selectedStatus, setSelectedStatus] = React.useState("All");
@@ -34,7 +34,7 @@ import React from "react";
34
34
  * @endexample
35
35
  * @example
36
36
  *
37
- * import StatusDropdown from "@bigbinary/neeto-molecules/Sidebar";
37
+ * import StatusDropdown from "@bigbinary/neeto-molecules/StatusDropdown";
38
38
  *
39
39
  * const App = () => {
40
40
  * const [selectedStatus, setSelectedStatus] = React.useState("All");