@bigbinary/neeto-molecules 0.0.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.
Files changed (183) hide show
  1. package/README.md +60 -0
  2. package/dist/BrowserSupport.cjs.js +1727 -0
  3. package/dist/BrowserSupport.cjs.js.map +1 -0
  4. package/dist/BrowserSupport.js +1721 -0
  5. package/dist/BrowserSupport.js.map +1 -0
  6. package/dist/Columns.cjs.js +191 -0
  7. package/dist/Columns.cjs.js.map +1 -0
  8. package/dist/Columns.js +184 -0
  9. package/dist/Columns.js.map +1 -0
  10. package/dist/Container.cjs.js +1277 -0
  11. package/dist/Container.cjs.js.map +1 -0
  12. package/dist/Container.js +1271 -0
  13. package/dist/Container.js.map +1 -0
  14. package/dist/CopyToClipboardButton.cjs.js +78 -0
  15. package/dist/CopyToClipboardButton.cjs.js.map +1 -0
  16. package/dist/CopyToClipboardButton.js +72 -0
  17. package/dist/CopyToClipboardButton.js.map +1 -0
  18. package/dist/CustomDomain.cjs.js +680 -0
  19. package/dist/CustomDomain.cjs.js.map +1 -0
  20. package/dist/CustomDomain.js +654 -0
  21. package/dist/CustomDomain.js.map +1 -0
  22. package/dist/CustomDomainDashboard.cjs.js +2306 -0
  23. package/dist/CustomDomainDashboard.cjs.js.map +1 -0
  24. package/dist/CustomDomainDashboard.js +2279 -0
  25. package/dist/CustomDomainDashboard.js.map +1 -0
  26. package/dist/DateFormat.cjs.js +51 -0
  27. package/dist/DateFormat.cjs.js.map +1 -0
  28. package/dist/DateFormat.js +45 -0
  29. package/dist/DateFormat.js.map +1 -0
  30. package/dist/DateRangeFilter.cjs.js +236 -0
  31. package/dist/DateRangeFilter.cjs.js.map +1 -0
  32. package/dist/DateRangeFilter.js +229 -0
  33. package/dist/DateRangeFilter.js.map +1 -0
  34. package/dist/DynamicVariables.cjs.js +112 -0
  35. package/dist/DynamicVariables.cjs.js.map +1 -0
  36. package/dist/DynamicVariables.js +106 -0
  37. package/dist/DynamicVariables.js.map +1 -0
  38. package/dist/EmailPreview.cjs.js +102 -0
  39. package/dist/EmailPreview.cjs.js.map +1 -0
  40. package/dist/EmailPreview.js +96 -0
  41. package/dist/EmailPreview.js.map +1 -0
  42. package/dist/ErrorPage.cjs.js +208 -0
  43. package/dist/ErrorPage.cjs.js.map +1 -0
  44. package/dist/ErrorPage.js +184 -0
  45. package/dist/ErrorPage.js.map +1 -0
  46. package/dist/Header.cjs.js +219 -0
  47. package/dist/Header.cjs.js.map +1 -0
  48. package/dist/Header.js +213 -0
  49. package/dist/Header.js.map +1 -0
  50. package/dist/IconPicker.cjs.js +1307 -0
  51. package/dist/IconPicker.cjs.js.map +1 -0
  52. package/dist/IconPicker.js +1301 -0
  53. package/dist/IconPicker.js.map +1 -0
  54. package/dist/IntegrationCard.cjs.js +75 -0
  55. package/dist/IntegrationCard.cjs.js.map +1 -0
  56. package/dist/IntegrationCard.js +69 -0
  57. package/dist/IntegrationCard.js.map +1 -0
  58. package/dist/IntegrationDisconnectAlert.cjs.js +81 -0
  59. package/dist/IntegrationDisconnectAlert.cjs.js.map +1 -0
  60. package/dist/IntegrationDisconnectAlert.js +75 -0
  61. package/dist/IntegrationDisconnectAlert.js.map +1 -0
  62. package/dist/IntegrationWalkthroughModal.cjs.js +42 -0
  63. package/dist/IntegrationWalkthroughModal.cjs.js.map +1 -0
  64. package/dist/IntegrationWalkthroughModal.js +36 -0
  65. package/dist/IntegrationWalkthroughModal.js.map +1 -0
  66. package/dist/IpRestriction.cjs.js +3764 -0
  67. package/dist/IpRestriction.cjs.js.map +1 -0
  68. package/dist/IpRestriction.js +3738 -0
  69. package/dist/IpRestriction.js.map +1 -0
  70. package/dist/KeyboardShortcuts.cjs.js +2242 -0
  71. package/dist/KeyboardShortcuts.cjs.js.map +1 -0
  72. package/dist/KeyboardShortcuts.js +2235 -0
  73. package/dist/KeyboardShortcuts.js.map +1 -0
  74. package/dist/LoginPage.cjs.js +618 -0
  75. package/dist/LoginPage.cjs.js.map +1 -0
  76. package/dist/LoginPage.js +593 -0
  77. package/dist/LoginPage.js.map +1 -0
  78. package/dist/MenuBar.cjs.js +31044 -0
  79. package/dist/MenuBar.cjs.js.map +1 -0
  80. package/dist/MenuBar.js +31038 -0
  81. package/dist/MenuBar.js.map +1 -0
  82. package/dist/NeetoWidget.cjs.js +3369 -0
  83. package/dist/NeetoWidget.cjs.js.map +1 -0
  84. package/dist/NeetoWidget.js +3343 -0
  85. package/dist/NeetoWidget.js.map +1 -0
  86. package/dist/PageLoader.cjs.js +158 -0
  87. package/dist/PageLoader.cjs.js.map +1 -0
  88. package/dist/PageLoader.js +134 -0
  89. package/dist/PageLoader.js.map +1 -0
  90. package/dist/PhoneNumber.cjs.js +7021 -0
  91. package/dist/PhoneNumber.cjs.js.map +1 -0
  92. package/dist/PhoneNumber.js +6989 -0
  93. package/dist/PhoneNumber.js.map +1 -0
  94. package/dist/PublishBlock.cjs.js +189 -0
  95. package/dist/PublishBlock.cjs.js.map +1 -0
  96. package/dist/PublishBlock.js +183 -0
  97. package/dist/PublishBlock.js.map +1 -0
  98. package/dist/Rename.cjs.js +306 -0
  99. package/dist/Rename.cjs.js.map +1 -0
  100. package/dist/Rename.js +300 -0
  101. package/dist/Rename.js.map +1 -0
  102. package/dist/ResponsiveDevicePicker.cjs.js +260 -0
  103. package/dist/ResponsiveDevicePicker.cjs.js.map +1 -0
  104. package/dist/ResponsiveDevicePicker.js +254 -0
  105. package/dist/ResponsiveDevicePicker.js.map +1 -0
  106. package/dist/Schedule.cjs.js +952 -0
  107. package/dist/Schedule.cjs.js.map +1 -0
  108. package/dist/Schedule.js +921 -0
  109. package/dist/Schedule.js.map +1 -0
  110. package/dist/Scrollable.cjs.js +184 -0
  111. package/dist/Scrollable.cjs.js.map +1 -0
  112. package/dist/Scrollable.js +178 -0
  113. package/dist/Scrollable.js.map +1 -0
  114. package/dist/ShareViaEmail.cjs.js +2992 -0
  115. package/dist/ShareViaEmail.cjs.js.map +1 -0
  116. package/dist/ShareViaEmail.js +2966 -0
  117. package/dist/ShareViaEmail.js.map +1 -0
  118. package/dist/ShareViaLink.cjs.js +1385 -0
  119. package/dist/ShareViaLink.cjs.js.map +1 -0
  120. package/dist/ShareViaLink.js +1360 -0
  121. package/dist/ShareViaLink.js.map +1 -0
  122. package/dist/Sidebar.cjs.js +32222 -0
  123. package/dist/Sidebar.cjs.js.map +1 -0
  124. package/dist/Sidebar.js +32196 -0
  125. package/dist/Sidebar.js.map +1 -0
  126. package/dist/SubHeader.cjs.js +272 -0
  127. package/dist/SubHeader.cjs.js.map +1 -0
  128. package/dist/SubHeader.js +265 -0
  129. package/dist/SubHeader.js.map +1 -0
  130. package/dist/TableWrapper.cjs.js +87 -0
  131. package/dist/TableWrapper.cjs.js.map +1 -0
  132. package/dist/TableWrapper.js +81 -0
  133. package/dist/TableWrapper.js.map +1 -0
  134. package/dist/ThemeSidebar.cjs.js +13618 -0
  135. package/dist/ThemeSidebar.cjs.js.map +1 -0
  136. package/dist/ThemeSidebar.js +13593 -0
  137. package/dist/ThemeSidebar.js.map +1 -0
  138. package/dist/TimeFormat.cjs.js +53 -0
  139. package/dist/TimeFormat.cjs.js.map +1 -0
  140. package/dist/TimeFormat.js +47 -0
  141. package/dist/TimeFormat.js.map +1 -0
  142. package/dist/TimezoneMismatchModal.cjs.js +176 -0
  143. package/dist/TimezoneMismatchModal.cjs.js.map +1 -0
  144. package/dist/TimezoneMismatchModal.js +168 -0
  145. package/dist/TimezoneMismatchModal.js.map +1 -0
  146. package/package.json +185 -0
  147. package/src/translations/en.json +449 -0
  148. package/types/BrowserSupport.d.ts +86 -0
  149. package/types/Columns.d.ts +53 -0
  150. package/types/Container.d.ts +35 -0
  151. package/types/CopyToClipboardButton.d.ts +21 -0
  152. package/types/CustomDomain.d.ts +19 -0
  153. package/types/CustomDomainDashboard.d.ts +33 -0
  154. package/types/DateFormat.d.ts +18 -0
  155. package/types/DateRangeFilter.d.ts +52 -0
  156. package/types/DynamicVariables.d.ts +45 -0
  157. package/types/EmailPreview.d.ts +41 -0
  158. package/types/ErrorPage.d.ts +15 -0
  159. package/types/Header.d.ts +30 -0
  160. package/types/IconPicker.d.ts +43 -0
  161. package/types/IntegrationCard.d.ts +45 -0
  162. package/types/IntegrationDisconnectAlert.d.ts +37 -0
  163. package/types/IntegrationWalkthroughModal.d.ts +31 -0
  164. package/types/IpRestriction.d.ts +23 -0
  165. package/types/KeyboardShortcuts.d.ts +147 -0
  166. package/types/LoginPage.d.ts +43 -0
  167. package/types/MenuBar.d.ts +125 -0
  168. package/types/NeetoWidget.d.ts +41 -0
  169. package/types/PageLoader.d.ts +38 -0
  170. package/types/PhoneNumber.d.ts +106 -0
  171. package/types/PublishBlock.d.ts +84 -0
  172. package/types/Rename.d.ts +60 -0
  173. package/types/ResponsiveDevicePicker.d.ts +30 -0
  174. package/types/Schedule.d.ts +132 -0
  175. package/types/Scrollable.d.ts +28 -0
  176. package/types/ShareViaEmail.d.ts +99 -0
  177. package/types/ShareViaLink.d.ts +117 -0
  178. package/types/Sidebar.d.ts +63 -0
  179. package/types/SubHeader.d.ts +97 -0
  180. package/types/TableWrapper.d.ts +38 -0
  181. package/types/TimeFormat.d.ts +17 -0
  182. package/types/TimezoneMismatchModal.d.ts +39 -0
  183. package/types/themeSidebar.d.ts +80 -0
@@ -0,0 +1,147 @@
1
+ import React from "react";
2
+ import { TFunction } from "i18next";
3
+ interface Shortcut {
4
+ sequence: string;
5
+ description: TFunction;
6
+ }
7
+ interface Category {
8
+ [index: string]: Shortcut | string;
9
+ fullShortcutsLink?: string;
10
+ }
11
+ interface ShortcutsObject {
12
+ [index: string | TFunction]: Category;
13
+ }
14
+ /**
15
+ *
16
+ * A common component that accept's a list of all the keyboard shortcuts in a
17
+ *
18
+ * product and renders a side panel on the right side of the screen upon pressing a
19
+ *
20
+ * defined hotkey (shift+/).
21
+ *
22
+ * ![image](https://user-images.githubusercontent.com/29166133/223832668-2b92ff28-6565-434c-8a76-cf587c9dbc99.png|height=200|width=300)
23
+ *
24
+ * All the global shortcuts like open pane, close modal etc will be rendered by
25
+ *
26
+ * default by the component. It provides a single prop called productShortcuts
27
+ *
28
+ * which is used to pass in the product specific keyboard shortcuts. The prop's
29
+ *
30
+ * structure is given below:
31
+ *
32
+ * @example
33
+ *
34
+ * {
35
+ * [i18n.t("shortcuts.category1.categoryName")]: {
36
+ * shortcutName: {
37
+ * sequence: "command+shift+r",
38
+ * description: "",
39
+ * },
40
+ * },
41
+ * [i18n.t("shortcuts.category2.categoryName")]: {
42
+ * shortcutName2: {
43
+ * sequence: "r s",
44
+ * description: "",
45
+ * fullShortcutsLink: "www.example.com/all-shortcuts"
46
+ * },
47
+ * },
48
+ * }
49
+ * @endexample
50
+ * fullShortcutsLink is an optional property in the data structure which can be
51
+ *
52
+ * used to render links which points to external pages that lists all the
53
+ *
54
+ * shortcuts. This will be useful when the number of shortcuts under a category is
55
+ *
56
+ * very large.
57
+ *
58
+ * The sequence should be passed in MacOS format and the component will take care
59
+ *
60
+ * of detecting & converting it to the users platform. The component supports three
61
+ *
62
+ * kinds of sequence.
63
+ *
64
+ * @example
65
+ *
66
+ * import KeyboardShortcuts from "@bigbinary/neeto-molecules/KeyboardShortcuts";
67
+ *
68
+ * const App = () => (
69
+ * <Main />
70
+ * <KeyboardShortcuts.Pane productShortcuts={{
71
+ * [i18n.t("shortcuts.tickets.categoryName")]: {
72
+ * openNotes: {
73
+ * sequence: "command+shift+r",
74
+ * description: i18n.t("shortcuts.tickets.openNotes"),
75
+ * },
76
+ * },
77
+ * }}/>
78
+ * )
79
+ * @endexample
80
+ * This hook can be used to manage the behavior of KeyboardShortcuts pane.
81
+ *
82
+ * This hook will return an array with exactly 2 values just like useState hook.
83
+ *
84
+ * @example
85
+ *
86
+ * import KeyboardShortcuts from "@bigbinary/neeto-molecules/KeyboardShortcuts";
87
+ *
88
+ * const [isOpen, setIsOpen] = KeyboardShortcuts.usePaneState();
89
+ *
90
+ * return (
91
+ * <>
92
+ * <button onClick={() => setIsOpen(true)}> Open shortcuts pane</button>
93
+ * <button onClick={() => setIsOpen(prevIsOpen => !prevIsOpen)}>
94
+ * Toggle shortcuts pane
95
+ * </button>
96
+ * </>
97
+ * );
98
+ * @endexample
99
+ * This constant exposes the list of global shortcuts displayed by the pane to the
100
+ *
101
+ * product.
102
+ *
103
+ * It will give the following shortcuts:
104
+ *
105
+ * @example
106
+ *
107
+ * {
108
+ * GLOBAL: {
109
+ * openKeyboardShortcutsPane: {
110
+ * sequence: "shift+/",
111
+ * description: "See keyboard shortcuts",
112
+ * },
113
+ * close: {
114
+ * sequence: "esc",
115
+ * description: "Close modals, panes",
116
+ * },
117
+ * submitForm: {
118
+ * sequence: "command+return",
119
+ * description: "Submit form or text input",
120
+ * },
121
+ * },
122
+ * }
123
+ * @endexample
124
+ * It can be used by the product to implement the shortcuts without needing to
125
+ *
126
+ * define the shortcut constant again.
127
+ *
128
+ * @example
129
+ *
130
+ * import KeyboardShortcuts from "@bigbinary/neeto-molecules/KeyboardShortcuts";
131
+ * import { useHotKeys } from "neetocommons/react-utils";
132
+ *
133
+ * useHotKeys(
134
+ * KeyboardShortcuts.GLOBAL_SHORTCUTS.GLOBAL.submitForm.sequence,
135
+ * keyboardShortCutHandlers.SUBMIT_FORM,
136
+ * { mode: "global" }
137
+ * );
138
+ * @endexample
139
+ */
140
+ const KeyboardShortcuts: {
141
+ Pane: React.FC<{
142
+ productShortcuts?: ShortcutsObject;
143
+ }>;
144
+ usePaneState(): [boolean, React.Dispatch<React.SetStateAction<boolean>>];
145
+ GLOBAL_SHORTCUTS: ShortcutsObject;
146
+ };
147
+ export default KeyboardShortcuts;
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ /**
3
+ *
4
+ * A common login page for all neeto-applications with dedicated button for oliver
5
+ *
6
+ * to login.
7
+ *
8
+ * undefined
9
+ *
10
+ * @example
11
+ *
12
+ * import LoginPage from "@bigbinary/neeto-molecules/LoginPage";
13
+ *
14
+ * // Main.jsx
15
+ * export default function Main() {
16
+ * if (!isLoggedIn) {
17
+ * return <LoginPage handleSubmit={payload => sessionsApi.create(payload)} />;
18
+ * }
19
+ *
20
+ * // return main routes
21
+ * }
22
+ * @endexample
23
+ * The payload will be of the following format:
24
+ *
25
+ * @example
26
+ *
27
+ * {
28
+ * "user": {
29
+ * "email": "oliver@example.com",
30
+ * "password": "welcome"
31
+ * }
32
+ * }
33
+ * @endexample
34
+ */
35
+ const LoginPage: React.FC<{
36
+ handleSubmit: (data: {
37
+ user: {
38
+ email: string;
39
+ password: string;
40
+ };
41
+ }) => any;
42
+ }>;
43
+ export default LoginPage;
@@ -0,0 +1,125 @@
1
+ import React from "react";
2
+ import { ButtonProps, InputProps } from "@bigbinary/neetoui";
3
+ import { LinkProps } from "react-router-dom";
4
+ type BlockProps = {
5
+ label: string;
6
+ url?: string;
7
+ icon?: React.ReactNode;
8
+ count?: number;
9
+ active?: boolean;
10
+ onEdit?: (...args: any[]) => any;
11
+ onClick?: (...args: any[]) => any;
12
+ className?: string;
13
+ } & LinkProps & React.RefAttributes<HTMLAnchorElement> & React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
14
+ type ItemProps = {
15
+ label?: string;
16
+ description?: string;
17
+ active?: boolean;
18
+ className?: string;
19
+ } & React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
20
+ type SubTitleProps = {
21
+ iconProps?: ButtonProps[];
22
+ } & React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
23
+ type SearchProps = {
24
+ isCollapsed?: boolean;
25
+ onCollapse?: React.MouseEventHandler<HTMLButtonElement>;
26
+ } & InputProps;
27
+ type AddNewProps = {
28
+ label?: string;
29
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
30
+ } & React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
31
+ /**
32
+ *
33
+ * Used in neeto products to show a collapsible menu which can be used for adding
34
+ *
35
+ * navigation options to view different sections.
36
+ *
37
+ * ![image](https://user-images.githubusercontent.com/12969853/225556542-ed4fd436-45d8-4eb5-8ffe-4a9e191d8fc1.png|height=200|width=300)
38
+ *
39
+ * @example
40
+ *
41
+ * import MenuBar from "@bigbinary/neeto-molecules/MenuBar";
42
+ *
43
+ * const MenuBarContainer = ({ children }) => {
44
+ * return (
45
+ * <div>
46
+ * <MenuBar showMenu />
47
+ * </div>
48
+ * );
49
+ * };
50
+ * @endexample
51
+ * MenuBar with custom title
52
+ *
53
+ * @example
54
+ *
55
+ * import MenuBar from "@bigbinary/neeto-molecules/MenuBar";
56
+ *
57
+ * const MenuBarContainer = ({ children }) => {
58
+ * return (
59
+ * <div>
60
+ * <MenuBar showMenu title="Custom Title" />
61
+ * </div>
62
+ * );
63
+ * };
64
+ * @endexample
65
+ * Props for MenuBar.Block:
66
+ *
67
+ * Props for MenuBar.AddNew:
68
+ *
69
+ * Props for MenuBar.SubTitle:
70
+ *
71
+ * Props for MenuBar.Search:
72
+ *
73
+ * Props for MenuBar.Item:
74
+ *
75
+ * @example
76
+ *
77
+ * import MenuBar from "@bigbinary/neeto-molecules/MenuBar";
78
+ *
79
+ * const MenuBarContainer = ({ children }) => {
80
+ * return (
81
+ * <div>
82
+ * <MenuBar showMenu title="Custom Title">
83
+ * <MenuBar.Block active count={13} label="All" />
84
+ * <MenuBar.SubTitle
85
+ * iconProps={[
86
+ * {
87
+ * icon: Search,
88
+ * onClick: () => {},
89
+ * },
90
+ * ]}
91
+ * >
92
+ * <Typography
93
+ * component="h4"
94
+ * style="h5"
95
+ * textTransform="uppercase"
96
+ * weight="bold"
97
+ * >
98
+ * Subtitle
99
+ * </Typography>
100
+ * </MenuBar.SubTitle>
101
+ * <MenuBar.Search isCollapsed={isSearchCollapsed} onCollapse={() => {}} />
102
+ * <MenuBar.AddNew label="Add new button" />
103
+ * <MenuBar.Item
104
+ * description="An Item which can have a subheading and heading"
105
+ * label="Heading"
106
+ * />
107
+ * </MenuBar>
108
+ * </div>
109
+ * );
110
+ * };
111
+ * @endexample
112
+ */
113
+ const MenuBar: React.FC<{
114
+ title?: string;
115
+ showMenu?: boolean;
116
+ className?: string;
117
+ children?: React.ReactNode | React.ReactNode[];
118
+ }> & {
119
+ Block: React.FC<BlockProps>;
120
+ Item: React.FC<ItemProps>;
121
+ SubTitle: React.FC<SubTitleProps>;
122
+ Search: React.FC<SearchProps>;
123
+ AddNew: React.FC<AddNewProps>;
124
+ };
125
+ export default MenuBar;
@@ -0,0 +1,41 @@
1
+ import React from "react";
2
+ type EmbedCode = React.FC<{
3
+ maxWidth?: string;
4
+ primaryApp?: string;
5
+ showSessionContext?: boolean;
6
+ showUserIdentity?: boolean;
7
+ }>;
8
+ /**
9
+ *
10
+ * This component can be accessed only in SSO mode. To access the component, run
11
+ *
12
+ * neetoAuth in the background and restart the application in SSO mode.
13
+ *
14
+ * This object contains the widget names.
15
+ *
16
+ * This component can be used to render the neetoWidget embed code within any
17
+ *
18
+ * host application. It uses APIs from neeto_sso to query the apiKey from
19
+ *
20
+ * neeto-auth-web, enable/disable widgets, and to allow the user to send the
21
+ *
22
+ * embed code via email.
23
+ *
24
+ * Developers can use the props to customize the component for the host
25
+ *
26
+ * application.
27
+ *
28
+ * @example
29
+ *
30
+ * <NeetoWidget.EmbedCode primaryApp={NeetoWidget.WIDGET_TYPES.chat} />
31
+ * @endexample
32
+ */
33
+ const NeetoWidget: {
34
+ EmbedCode: EmbedCode;
35
+ WIDGET_TYPES: {
36
+ changelog: "changelog";
37
+ chat: "chat";
38
+ replay: "replay";
39
+ };
40
+ };
41
+ export default NeetoWidget;
@@ -0,0 +1,38 @@
1
+ import React from "react";
2
+ /**
3
+ *
4
+ * Used in neeto products as the page loader to indicate that the page is being
5
+ *
6
+ * loaded.
7
+ *
8
+ * ![image](https://user-images.githubusercontent.com/12969853/225239088-f78bd7b4-ba46-404c-896c-e9e5104f824c.png|height=200|width=300)
9
+ *
10
+ * @example
11
+ *
12
+ * import PageLoader from "@bigbinary/neeto-molecules/PageLoader";
13
+ * const PageLoaderContainer = ({ children }) => {
14
+ * return (
15
+ * <div>
16
+ * <PageLoader />
17
+ * </div>
18
+ * );
19
+ * };
20
+ * @endexample
21
+ * PageLoader with custom text
22
+ *
23
+ * @example
24
+ *
25
+ * import PageLoader from "@bigbinary/neeto-molecules/PageLoader";
26
+ * const PageLoaderContainer = ({ children }) => {
27
+ * return (
28
+ * <div>
29
+ * <PageLoader text="Loading..." />
30
+ * </div>
31
+ * );
32
+ * };
33
+ * @endexample
34
+ */
35
+ const PageLoader: React.FC<{
36
+ text?: string;
37
+ }>;
38
+ export default PageLoader;
@@ -0,0 +1,106 @@
1
+ import React from "react";
2
+ import { InputProps, SelectProps, TypographyProps } from "@bigbinary/neetoui";
3
+ import { CountryCode } from "libphonenumber-js";
4
+ import { StringSchema } from "yup";
5
+ export interface PhoneNumberInputProps extends InputProps {
6
+ value?: string;
7
+ onChange?: (value: string) => any;
8
+ className?: string;
9
+ selectProps?: SelectProps;
10
+ error?: string;
11
+ defaultCountry?: string;
12
+ }
13
+ export interface FormikPhoneNumberInputProps extends PhoneNumberInputProps {
14
+ name: string;
15
+ }
16
+ export interface PhoneNumberProps extends TypographyProps {
17
+ className?: string;
18
+ defaultCountry?: string;
19
+ children?: React.ReactNode;
20
+ showEmoji?: boolean;
21
+ value?: string;
22
+ }
23
+ export const PhoneNumberInput: React.ForwardRefExoticComponent<PhoneNumberInputProps>;
24
+ export const FormikPhoneNumberInput: React.ForwardRefExoticComponent<FormikPhoneNumberInputProps>;
25
+ export
26
+ /**
27
+ *
28
+ * An input component to input and validate phone numbers with a country code
29
+ *
30
+ * picker.
31
+ *
32
+ * ![PhoneNumberInput](https://user-images.githubusercontent.com/35297280/231367938-93aa94b0-2a8c-44b3-b1c7-8c60843e40c4.png|height=200|width=300)
33
+ *
34
+ * @example
35
+ *
36
+ * import React, { useState } from "react";
37
+ *
38
+ * import { PhoneNumberInput } from "@bigbinary/neeto-molecules/PhoneNumber";
39
+ *
40
+ * const App = () => {
41
+ * const [phoneNumber, setPhoneNumber] = useState("");
42
+ *
43
+ * return <PhoneNumberInput value={phoneNumber} onChange={setPhoneNumber} />;
44
+ * };
45
+ * @endexample
46
+ * A typography component to display phone numbers along with the flag of the
47
+ *
48
+ * country associated with it.
49
+ *
50
+ * ![PhoneNumber](https://user-images.githubusercontent.com/35297280/231367945-ee5f0921-92e3-4086-a8e2-f9ab63cf9a37.png|height=200|width=300)
51
+ *
52
+ * @example
53
+ *
54
+ * import { PhoneNumber } from "@bigbinary/neeto-molecules/PhoneNumber";
55
+ *
56
+ * const App = () => <PhoneNumber showEmoji value="+919988776655" />;
57
+ * @endexample
58
+ * The PhoneNumberInput component wrapped in Formik.
59
+ *
60
+ * @example
61
+ *
62
+ * import { FormikPhoneNumberInput, validation } from "@bigbinary/neeto-molecules/PhoneNumber";
63
+ * import { Form } from "@bigbinary/neetoui/formik";
64
+ *
65
+ * const App = () => (
66
+ * return (
67
+ * <Form
68
+ * formikProps={{
69
+ * initialValues: { phoneNumber: "+919988776655" },
70
+ * validationSchema: yup.object({ phoneNumber: validation().required() }),
71
+ * onSubmit: ({ phoneNumber }) => alert(phoneNumber),
72
+ * }}
73
+ * >
74
+ * <FormikPhoneNumberInput name="phoneNumber" />
75
+ * </Form>
76
+ * );
77
+ * );
78
+ * @endexample
79
+ * A utility function that exports a Yup validation schema to be used in Formik. It
80
+ *
81
+ * accepts a string as an optional argument to override the default validation
82
+ *
83
+ * message.
84
+ *
85
+ * @example
86
+ *
87
+ * import { validation } from "@bigbinary/neeto-molecules/PhoneNumber";
88
+ * import * as yup from "yup";
89
+ *
90
+ * const VALIDATION_SCHEMA = yup.object({
91
+ * phoneNumber: validation("Phone number is invalid"),
92
+ * });
93
+ * @endexample
94
+ * A utility function to check whether a phone number is valid. It accepts a phone
95
+ *
96
+ * number and a default country as argument and returns a boolean value specifying
97
+ *
98
+ * whether the phone number is valid or not.
99
+ *
100
+ */
101
+ const PhoneNumber: React.FC<PhoneNumberProps>;
102
+ export const isPhoneNumberValid: (phoneNumber: string, defaultCountry?: CountryCode | {
103
+ defaultCountry?: CountryCode;
104
+ defaultCallingCode?: string;
105
+ }) => boolean;
106
+ export const validation: (message?: string) => StringSchema<any, any, any>;
@@ -0,0 +1,84 @@
1
+ import React from "react";
2
+ import { AlertProps } from "@bigbinary/neetoui";
3
+ interface PublishBlockProps {
4
+ renderDraftButtons: (props: {
5
+ ViewDraftButton: JSX.Element;
6
+ ResetDraftButton: JSX.Element;
7
+ }) => React.ReactNode;
8
+ renderPublishButtons: (props: {
9
+ PublishButton: JSX.Element;
10
+ PublishPreviewButton: JSX.Element;
11
+ }) => React.ReactNode;
12
+ }
13
+ /**
14
+ *
15
+ * A common component to manage draft and publish versions.
16
+ *
17
+ * ![image](https://user-images.githubusercontent.com/35297280/219363621-9fb295c4-72e4-4cde-b8d1-614f49e5dfa5.png|height=200|width=300)
18
+ *
19
+ * @example
20
+ *
21
+ * import PublishBlock from "@bigbinary/neeto-molecules/PublishBlock";
22
+ *
23
+ * const PublishActionBlock = (
24
+ * {
25
+ * //all variables used in the below example can be passed as props or can be defined in the component itself
26
+ * }
27
+ * ) => {
28
+ * const renderDraftButtons = ({ ViewDraftButton, ResetDraftButton }) =>
29
+ * !isDraftBlockHidden && (
30
+ * <>
31
+ * <ViewDraftButton to={previewDraftUrl} />
32
+ * {hasDraftVersion && <ResetDraftButton onClick={handleResetDraft} />}
33
+ * </>
34
+ * );
35
+ *
36
+ * const renderPublishButtons = ({ PublishButton, PublishPreviewButton }) => (
37
+ * <>
38
+ * <PublishButton disabled={isPublishDisabled} onClick={handlePublish} />
39
+ * <PublishPreviewButton
40
+ * disabled={isPublishPreviewDisabled}
41
+ * to={previewPublishedUrl}
42
+ * />
43
+ * </>
44
+ * );
45
+ * return (
46
+ * <PublishBlock
47
+ * renderDraftButtons={renderDraftButtons}
48
+ * renderPublishButtons={renderPublishButtons}
49
+ * />
50
+ * );
51
+ * };
52
+ * @endexample
53
+ * This optional component can be used to render the reset alert modal for
54
+ *
55
+ * discarding draft.
56
+ *
57
+ * It also accepts all other alert props.
58
+ *
59
+ * @example
60
+ *
61
+ * import PublishBlock from "@bigbinary/neeto-molecules/PublishBlock";
62
+ *
63
+ * const PublishActionBlock = (
64
+ * {
65
+ * //all variables used in the below example can be passed as props or can be defined in the component itself
66
+ * }
67
+ * ) => {
68
+ * return (
69
+ * <PublishBlock.Alert
70
+ * isOpen={isResetDraftAlertOpen}
71
+ * message="Leaving this page will delete all unpublished changes."
72
+ * title="Are you sure you want to discard changes?"
73
+ * onClose={() => setIsResetDraftAlertOpen(false)}
74
+ * onSubmit={action("handleReset")}
75
+ * //other alert props can also be passed
76
+ * />
77
+ * );
78
+ * };
79
+ * @endexample
80
+ */
81
+ const PublishBlock: React.FC<PublishBlockProps> & {
82
+ Alert: React.FC<AlertProps>;
83
+ };
84
+ export default PublishBlock;
@@ -0,0 +1,60 @@
1
+ import { ButtonProps, InputProps, TypographyProps } from "@bigbinary/neetoui";
2
+ import React from "react";
3
+ /**
4
+ *
5
+ * The Rename component is used to rename a resource on the page, It can be used as
6
+ *
7
+ * the title in the Header component and provides props for additional actions with
8
+ *
9
+ * the dropdown.
10
+ *
11
+ * @example
12
+ *
13
+ * import Rename from "@bigbinary/neeto-molecules/Rename";
14
+ *
15
+ * const App = () => {
16
+ * const [value, setValue] = useState("Name");
17
+ * return (
18
+ * <Rename
19
+ * value={value}
20
+ * placeholder="Enter a name"
21
+ * dropdownItems={[
22
+ * {
23
+ * label: "Clone",
24
+ * onClick: () => alert("Clicked on clone"),
25
+ * },
26
+ * ]}
27
+ * onRename={value => setValue(name)}
28
+ * breadcrumbs={[
29
+ * {
30
+ * label: "Home",
31
+ * link: "home",
32
+ * },
33
+ * {
34
+ * label: "Contacts",
35
+ * link: "contacts",
36
+ * },
37
+ * ]}
38
+ * />
39
+ * );
40
+ * };
41
+ * @endexample
42
+ */
43
+ const Rename: React.FC<{
44
+ className?: string;
45
+ isOpen?: boolean;
46
+ value: string;
47
+ onRename?: (newName: string) => void;
48
+ isUpdating?: boolean;
49
+ placeholder?: string;
50
+ hideMenu?: boolean;
51
+ disabled?: boolean;
52
+ dropdownItems?: ButtonProps[];
53
+ textProps?: TypographyProps;
54
+ inputProps?: InputProps;
55
+ breadcrumbs?: {
56
+ text: string;
57
+ link: string;
58
+ }[];
59
+ }>;
60
+ export default Rename;
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ type SelectedDeviceState = "desktop" | "tablet" | "mobile";
3
+ /**
4
+ *
5
+ * A common component to switch between different device resolutions.
6
+ *
7
+ * ![image](https://user-images.githubusercontent.com/24496302/230879938-43f4a9bc-cb36-496a-be18-79d85fbffb3a.png|height=200|width=300)
8
+ *
9
+ * @example
10
+ *
11
+ * import ResponsiveDevicePicker from "@bigbinary/neeto-molecules/ResponsiveDevicePicker";
12
+ *
13
+ * const ResponsiveDevicePickerContainer = ({}) => {
14
+ * const [selectedDevice, setSelectedDevice] = useState("desktop");
15
+ *
16
+ * return (
17
+ * <ResponsiveDevicePicker
18
+ * selectedDevice={selectedDevice}
19
+ * onDeviceChange={setSelectedDevice}
20
+ * />
21
+ * );
22
+ * };
23
+ * @endexample
24
+ */
25
+ const ResponsiveDevicePicker: React.FC<{
26
+ className?: string;
27
+ selectedDevice?: SelectedDeviceState;
28
+ onDeviceChange?: (device: SelectedDeviceState) => void;
29
+ }>;
30
+ export default ResponsiveDevicePicker;