@bigbinary/neeto-molecules 1.0.97 → 1.0.99

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,95 @@
1
+ import React, { ReactNode } from "react";
2
+ import { IntegrationCardProps } from "./IntegrationCard";
3
+ type SettingItem = {
4
+ label: string;
5
+ path: string;
6
+ } & Partial<IntegrationCardProps>;
7
+ type SettingCategory = {
8
+ id: string;
9
+ label: string;
10
+ isIntegration?: boolean;
11
+ items: SettingItem[];
12
+ };
13
+ /**
14
+ *
15
+ * Settings can be used to create a settings page card layout.
16
+ *
17
+ * ![image](https://github.com/bigbinary/neeto-molecules/assets/66865722/16af3d07-e96a-4b4e-8013-ed6fa577c7b8|height=200|width=300)
18
+ *
19
+ * @example
20
+ *
21
+ * categories={[
22
+ * {
23
+ * id: "general-settings",
24
+ * label: "General Settings",
25
+ * items: [
26
+ * {
27
+ * label: 'Ticket tags',
28
+ * description: 'Create and manage tags',
29
+ * icon: TicketIcon,
30
+ * path: '/settings/general/ticket_tags'
31
+ * dataCy: 'Ticket tags' //dataCy can be passed here.
32
+ * // other props will be passed on to the setting card.
33
+ * }
34
+ * ...
35
+ * ...
36
+ * //more items
37
+ * ]
38
+ * },
39
+ * {
40
+ * id: "integrations",
41
+ * isIntegration: true //Integrations section MUST have 'isIntegration: true',
42
+ * label: "Integrations",
43
+ * items: [
44
+ * {
45
+ * label: 'Github',
46
+ * description: 'Connect with github',
47
+ * icon: GithubIcon
48
+ * onConnect: () => setIsIntegrationModalOpen(true)
49
+ * onDisconnect: ()=> setIsIntegrationDisconnectModalOpen(true)
50
+ * ...
51
+ * ...
52
+ * //rest of the props for IntegrationCard should be passed here.
53
+ * // other props will be passed on to the integration card.
54
+ * }
55
+ * ],
56
+ * },
57
+ * ...
58
+ * ...
59
+ * //more categories
60
+ * ]}
61
+ * @endexample
62
+ * Note: This component also supports "scroll-into-view" functionality to scroll
63
+ *
64
+ * specific setting categories into view, based on the query params. For example,
65
+ *
66
+ * the page will scroll to the "Integrations" category, when the query params
67
+ *
68
+ * contain ?category=integrations. The query param should be the id of the
69
+ *
70
+ * category.
71
+ *
72
+ * @example
73
+ *
74
+ * import React, { useState } from "react";
75
+ * import Settings from "@bigbinary/neeto-molecules/Settings";
76
+ * import { Modal as IntegrationModal } from "neetointegrations"
77
+ * import { getCategories } from "./utils";
78
+ *
79
+ * const SettingsPage = () => {
80
+ * const [isOpen, setIsOpen] = useState(false);
81
+ *
82
+ * return (
83
+ * <div>
84
+ * <Settings categories={getCategories({setIsIntegrationModalOpen: setIsOpen})} />
85
+ * <IntegrationModal isOpen={isOpen}>
86
+ * </div>
87
+ * );
88
+ * };
89
+ * @endexample
90
+ */
91
+ const Settings: React.FC<{
92
+ categories: SettingCategory[];
93
+ className?: string;
94
+ }>;
95
+ export default Settings;
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { InputProps, SwitchProps } from "neetoui";
2
3
  /**
3
4
  *
4
5
  * ToggleFeatureCard can be used to enable or disable a setting, and supports
@@ -19,14 +20,7 @@ const ToggleFeatureCard: React.FC<{
19
20
  descriptionDataCy?: string;
20
21
  isDisabled?: boolean;
21
22
  children?: React.ReactNode | null;
22
- inputProps: {
23
- name: string;
24
- display?: React.ReactNode | null;
25
- label?: string;
26
- editButtonTooltip?: string;
27
- editButtonDataCy?: string;
28
- placeholder?: string;
29
- dataCy?: string;
30
- };
23
+ inputProps?: InputProps;
24
+ switchProps?: SwitchProps;
31
25
  }>;
32
26
  export default ToggleFeatureCard;