dce-reactkit 3.9.0-beta.1 → 3.9.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.
Files changed (39) hide show
  1. package/dist/cjs/index.js +562 -257
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/Dropdown.d.ts +32 -0
  4. package/dist/cjs/types/components/Modal/ModalProps.d.ts +0 -2
  5. package/dist/cjs/types/helpers/validators/ChicagoTitleCase.d.ts +9 -0
  6. package/dist/cjs/types/helpers/validators/validURL.d.ts +8 -0
  7. package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/index.d.ts +22 -0
  8. package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +33 -0
  9. package/dist/cjs/types/index.d.ts +4 -1
  10. package/dist/cjs/types/types/DropdownItemType.d.ts +6 -0
  11. package/dist/cjs/types/types/ReactKitErrorCode.d.ts +4 -1
  12. package/dist/esm/index.js +560 -259
  13. package/dist/esm/index.js.map +1 -1
  14. package/dist/esm/types/components/Dropdown.d.ts +32 -0
  15. package/dist/esm/types/components/Modal/ModalProps.d.ts +0 -2
  16. package/dist/esm/types/helpers/validators/ChicagoTitleCase.d.ts +9 -0
  17. package/dist/esm/types/helpers/validators/validURL.d.ts +8 -0
  18. package/dist/esm/types/helpers/visitEndpointOnAnotherServer/index.d.ts +22 -0
  19. package/dist/esm/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +33 -0
  20. package/dist/esm/types/index.d.ts +4 -1
  21. package/dist/esm/types/types/DropdownItemType.d.ts +6 -0
  22. package/dist/esm/types/types/ReactKitErrorCode.d.ts +4 -1
  23. package/dist/index.d.ts +105 -46
  24. package/package.json +2 -1
  25. package/src/components/Dropdown.tsx +317 -0
  26. package/src/components/Modal/ModalProps.ts +0 -4
  27. package/src/components/Modal/index.tsx +3 -39
  28. package/src/components/MultiSwitch.tsx +1 -1
  29. package/src/helpers/validators/ChicagoTitleCase.test.ts +85 -0
  30. package/src/helpers/validators/ChicagoTitleCase.ts +32 -0
  31. package/src/helpers/validators/findURL.test.ts +83 -0
  32. package/src/helpers/validators/findURL.ts +43 -0
  33. package/src/helpers/validators/validURL.test.ts +90 -0
  34. package/src/helpers/validators/validURL.ts +18 -0
  35. package/src/helpers/visitEndpointOnAnotherServer/index.ts +90 -0
  36. package/src/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.ts +164 -0
  37. package/src/index.ts +6 -0
  38. package/src/types/DropdownItemType.ts +11 -0
  39. package/src/types/ReactKitErrorCode.tsx +6 -1
@@ -0,0 +1,32 @@
1
+ /**
2
+ * A simple dropdown menu
3
+ * @author Alessandra De Lucas
4
+ * @author Yuen Ler Chow
5
+ * @author Gabe Abrams
6
+ */
7
+ import React from 'react';
8
+ import Variant from '../types/Variant';
9
+ import DropdownItemType from '../types/DropdownItemType';
10
+ type Props = {
11
+ items: DropdownItem[];
12
+ dropdownButton: {
13
+ ariaLabel: string;
14
+ id: string;
15
+ content?: React.ReactNode;
16
+ variant?: Variant;
17
+ };
18
+ };
19
+ type DropdownItem = ({
20
+ type: DropdownItemType.Header;
21
+ content: React.ReactNode;
22
+ } | {
23
+ type: DropdownItemType.Divider;
24
+ } | {
25
+ type: DropdownItemType.Item;
26
+ content: React.ReactNode;
27
+ ariaLabel: string;
28
+ id: string;
29
+ onClick: () => void;
30
+ });
31
+ declare const Dropdown: React.FC<Props>;
32
+ export default Dropdown;
@@ -38,7 +38,5 @@ type ModalProps = {
38
38
  confirmLabel?: string;
39
39
  confirmVariant?: Variant;
40
40
  onTopOfOtherModals?: boolean;
41
- isLoading?: boolean;
42
- isLoadingCancelable?: boolean;
43
41
  };
44
42
  export default ModalProps;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This function converts a string to title case based on Chicago Title Case
3
+ * Style rules.
4
+ * @author Leisha Bhandari
5
+ * @param input: The input string that needs to be converted to Chicago title
6
+ * case.
7
+ * @returns Input string converted to title case
8
+ */
9
+ declare const chicagoTitleCase: (input: string) => string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This function checks if a given input string is a valid URL.
3
+ * @author Leisha Bhandari
4
+ * @param URL: The input string that needs checked as a URL or not.
5
+ * @returns A true boolean value if the input string is a valid URL, and a false
6
+ * boolean value if the input string is a invalid URL
7
+ */
8
+ declare function isValid(url: string): boolean;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Send a server-to-server request from this sever to another server that uses
3
+ * dce-reactkit [for server only]
4
+ * @author Gabe Abrams
5
+ * @param opts object containing all arguments
6
+ * @param opts.path - the path of the other server's endpoint
7
+ * @param [opts.method=GET] - the method of the endpoint
8
+ * @param [opts.params] - query/body parameters to include
9
+ * @param [opts.headers] - headers to include
10
+ * @returns response from server
11
+ */
12
+ declare const visitEndpointOnAnotherServer: (opts: {
13
+ path: string;
14
+ method?: "GET" | "POST" | "DELETE" | "PUT" | undefined;
15
+ params?: {
16
+ [x: string]: any;
17
+ } | undefined;
18
+ headers?: {
19
+ [x: string]: any;
20
+ } | undefined;
21
+ }) => Promise<any>;
22
+ export default visitEndpointOnAnotherServer;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Sends and retries an http request
3
+ * @author Gabriel Abrams
4
+ * @param opts object containing all arguments
5
+ * @param opts.path path to send request to
6
+ * @param [opts.host] host to send request to
7
+ * @param [opts.method=GET] http method to use
8
+ * @param [opts.params] body/data to include in the request
9
+ * @param [opts.headers] headers to include in the request
10
+ * @param [opts.sendCrossDomainCredentials=true if in development mode] if true,
11
+ * send cross-domain credentials even if not in dev mode
12
+ * @param [opts.responseType=JSON] expected response type
13
+ * @returns { body, status, headers } on success
14
+ */
15
+ declare const sendServerToServerRequest: (opts: {
16
+ path: string;
17
+ host?: string | undefined;
18
+ method?: "GET" | "POST" | "DELETE" | "PUT" | undefined;
19
+ params?: {
20
+ [x: string]: any;
21
+ } | undefined;
22
+ headers?: {
23
+ [x: string]: any;
24
+ } | undefined;
25
+ responseType?: "Text" | "JSON" | undefined;
26
+ }) => Promise<{
27
+ body: any;
28
+ status: number;
29
+ headers: {
30
+ [x: string]: any;
31
+ };
32
+ }>;
33
+ export default sendServerToServerRequest;
@@ -21,6 +21,7 @@ import Tooltip from './components/Tooltip';
21
21
  import ToggleSwitch from './components/ToggleSwitch';
22
22
  import AutoscrollToBottomContainer from './components/AutoscrollToBottomContainer';
23
23
  import MultiSwitch from './components/MultiSwitch';
24
+ import Dropdown from './components/Dropdown';
24
25
  import ErrorWithCode from './errors/ErrorWithCode';
25
26
  import MINUTE_IN_MS from './constants/MINUTE_IN_MS';
26
27
  import HOUR_IN_MS from './constants/HOUR_IN_MS';
@@ -77,6 +78,7 @@ import mapAsync from './helpers/asyncArrayFunctions/mapAsync';
77
78
  import someAsync from './helpers/asyncArrayFunctions/someAsync';
78
79
  import capitalize from './helpers/capitalize';
79
80
  import shuffleArray from './helpers/shuffleArray';
81
+ import visitEndpointOnAnotherServer from './helpers/visitEndpointOnAnotherServer';
80
82
  import ModalButtonType from './types/ModalButtonType';
81
83
  import ModalSize from './types/ModalSize';
82
84
  import ModalType from './types/ModalType';
@@ -92,8 +94,9 @@ import LogBuiltInMetadata from './types/LogBuiltInMetadata';
92
94
  import LogMetadataType from './types/LogMetadataType';
93
95
  import LogFunction from './types/LogFunction';
94
96
  import IntelliTableColumn from './types/IntelliTableColumn';
97
+ import DropdownItemType from './types/DropdownItemType';
95
98
  import PickableItem from './components/ItemPicker/types/PickableItem';
96
99
  import DBEntry from './components/DBEntryManagerPanel/types/DBEntry';
97
100
  import DBEntryField from './components/DBEntryManagerPanel/types/DBEntryField';
98
101
  import DBEntryFieldType from './components/DBEntryManagerPanel/types/DBEntryFieldType';
99
- export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, alert, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, addDBEditorEndpoints, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, IntelliTableColumn, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ParamType, };
102
+ export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, Dropdown, alert, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, addDBEditorEndpoints, visitEndpointOnAnotherServer, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, IntelliTableColumn, DropdownItemType, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ParamType, };
@@ -0,0 +1,6 @@
1
+ declare enum DropdownItemType {
2
+ Header = "Header",
3
+ Divider = "Divider",
4
+ Item = "Item"
5
+ }
6
+ export default DropdownItemType;
@@ -15,6 +15,9 @@ declare enum ReactKitErrorCode {
15
15
  NotAdmin = "DRK10",
16
16
  NotAllowedToReviewLogs = "DRK11",
17
17
  ThemeCheckedBeforeReactKitReady = "DRK12",
18
- SessionExpiredMessageGottenBeforeReactKitReady = "DRK13"
18
+ SessionExpiredMessageGottenBeforeReactKitReady = "DRK13",
19
+ NotConnected = "DRK14",
20
+ SelfSigned = "DRK15",
21
+ ResponseParseError = "DRK16"
19
22
  }
20
23
  export default ReactKitErrorCode;