@elliemae/ds-global-header 2.1.0 → 2.2.0-alpha.3
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.
- package/cjs/GlobalHeader.js +55 -35
- package/cjs/GlobalHeader.js.map +7 -0
- package/cjs/GlobalHeaderContainer.js +40 -23
- package/cjs/GlobalHeaderContainer.js.map +7 -0
- package/cjs/GlobalHeaderContext.js +39 -13
- package/cjs/GlobalHeaderContext.js.map +7 -0
- package/cjs/GlobalHeaderTypes.js +27 -2
- package/cjs/GlobalHeaderTypes.js.map +7 -0
- package/cjs/components/Breadcrumb/GlobalHeaderBreadcrumb.js +59 -59
- package/cjs/components/Breadcrumb/GlobalHeaderBreadcrumb.js.map +7 -0
- package/cjs/components/Breadcrumb/PureBreadcrumb.js +50 -59
- package/cjs/components/Breadcrumb/PureBreadcrumb.js.map +7 -0
- package/cjs/components/Breadcrumb/styles.js +82 -58
- package/cjs/components/Breadcrumb/styles.js.map +7 -0
- package/cjs/components/Title/GlobalHeaderTitle.js +43 -24
- package/cjs/components/Title/GlobalHeaderTitle.js.map +7 -0
- package/cjs/components/Toolbar/GlobalHeaderToolbar.js +41 -22
- package/cjs/components/Toolbar/GlobalHeaderToolbar.js.map +7 -0
- package/cjs/components/Toolbar/ToolbarItems.js +83 -94
- package/cjs/components/Toolbar/ToolbarItems.js.map +7 -0
- package/cjs/components/Toolbar/styles.js +60 -24
- package/cjs/components/Toolbar/styles.js.map +7 -0
- package/cjs/config/useGetPropsWithDefaults.js +42 -30
- package/cjs/config/useGetPropsWithDefaults.js.map +7 -0
- package/cjs/config/useGlobalHeader.js +44 -30
- package/cjs/config/useGlobalHeader.js.map +7 -0
- package/cjs/config/useValidateProps.js +81 -64
- package/cjs/config/useValidateProps.js.map +7 -0
- package/cjs/config/validateHelpers.js +95 -41
- package/cjs/config/validateHelpers.js.map +7 -0
- package/cjs/defaultProps.js +34 -7
- package/cjs/defaultProps.js.map +7 -0
- package/cjs/index.js +36 -11
- package/cjs/index.js.map +7 -0
- package/cjs/outOfTheBox/AppPicker/AppPicker.js +83 -90
- package/cjs/outOfTheBox/AppPicker/AppPicker.js.map +7 -0
- package/cjs/outOfTheBox/PopupMenu/PopupMenu.js +70 -75
- package/cjs/outOfTheBox/PopupMenu/PopupMenu.js.map +7 -0
- package/cjs/outOfTheBox/PopupMenu/PopupMenuContent.js +76 -83
- package/cjs/outOfTheBox/PopupMenu/PopupMenuContent.js.map +7 -0
- package/cjs/outOfTheBox/PopupMenu/styles.js +66 -31
- package/cjs/outOfTheBox/PopupMenu/styles.js.map +7 -0
- package/cjs/outOfTheBox/SearchToggle/SearchToggle.js +80 -85
- package/cjs/outOfTheBox/SearchToggle/SearchToggle.js.map +7 -0
- package/cjs/outOfTheBox/SearchToggle/styles.js +76 -9
- package/cjs/outOfTheBox/SearchToggle/styles.js.map +7 -0
- package/cjs/outOfTheBox/index.js +30 -13
- package/cjs/outOfTheBox/index.js.map +7 -0
- package/cjs/propTypes.js +52 -25
- package/cjs/propTypes.js.map +7 -0
- package/cjs/styles.js +42 -20
- package/cjs/styles.js.map +7 -0
- package/esm/GlobalHeader.js +21 -21
- package/esm/GlobalHeader.js.map +7 -0
- package/esm/GlobalHeaderContainer.js +11 -15
- package/esm/GlobalHeaderContainer.js.map +7 -0
- package/esm/GlobalHeaderContext.js +9 -8
- package/esm/GlobalHeaderContext.js.map +7 -0
- package/esm/GlobalHeaderTypes.js +2 -1
- package/esm/GlobalHeaderTypes.js.map +7 -0
- package/esm/components/Breadcrumb/GlobalHeaderBreadcrumb.js +26 -45
- package/esm/components/Breadcrumb/GlobalHeaderBreadcrumb.js.map +7 -0
- package/esm/components/Breadcrumb/PureBreadcrumb.js +22 -49
- package/esm/components/Breadcrumb/PureBreadcrumb.js.map +7 -0
- package/esm/components/Breadcrumb/styles.js +54 -48
- package/esm/components/Breadcrumb/styles.js.map +7 -0
- package/esm/components/Title/GlobalHeaderTitle.js +13 -15
- package/esm/components/Title/GlobalHeaderTitle.js.map +7 -0
- package/esm/components/Toolbar/GlobalHeaderToolbar.js +12 -14
- package/esm/components/Toolbar/GlobalHeaderToolbar.js.map +7 -0
- package/esm/components/Toolbar/ToolbarItems.js +53 -83
- package/esm/components/Toolbar/ToolbarItems.js.map +7 -0
- package/esm/components/Toolbar/styles.js +32 -17
- package/esm/components/Toolbar/styles.js.map +7 -0
- package/esm/config/useGetPropsWithDefaults.js +13 -22
- package/esm/config/useGetPropsWithDefaults.js.map +7 -0
- package/esm/config/useGlobalHeader.js +12 -19
- package/esm/config/useGlobalHeader.js.map +7 -0
- package/esm/config/useValidateProps.js +58 -58
- package/esm/config/useValidateProps.js.map +7 -0
- package/esm/config/validateHelpers.js +66 -28
- package/esm/config/validateHelpers.js.map +7 -0
- package/esm/defaultProps.js +5 -3
- package/esm/defaultProps.js.map +7 -0
- package/esm/index.js +7 -1
- package/esm/index.js.map +7 -0
- package/esm/outOfTheBox/AppPicker/AppPicker.js +50 -76
- package/esm/outOfTheBox/AppPicker/AppPicker.js.map +7 -0
- package/esm/outOfTheBox/PopupMenu/PopupMenu.js +37 -61
- package/esm/outOfTheBox/PopupMenu/PopupMenu.js.map +7 -0
- package/esm/outOfTheBox/PopupMenu/PopupMenuContent.js +45 -71
- package/esm/outOfTheBox/PopupMenu/PopupMenuContent.js.map +7 -0
- package/esm/outOfTheBox/PopupMenu/styles.js +38 -21
- package/esm/outOfTheBox/PopupMenu/styles.js.map +7 -0
- package/esm/outOfTheBox/SearchToggle/SearchToggle.js +46 -70
- package/esm/outOfTheBox/SearchToggle/SearchToggle.js.map +7 -0
- package/esm/outOfTheBox/SearchToggle/styles.js +51 -5
- package/esm/outOfTheBox/SearchToggle/styles.js.map +7 -0
- package/esm/outOfTheBox/index.js +5 -3
- package/esm/outOfTheBox/index.js.map +7 -0
- package/esm/propTypes.js +21 -17
- package/esm/propTypes.js.map +7 -0
- package/esm/styles.js +14 -13
- package/esm/styles.js.map +7 -0
- package/package.json +7 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/Toolbar/styles.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import styled from 'styled-components';\n\nexport const Button = styled.button`\n height: 40px;\n width: 40px;\n border: none;\n background-color: transparent;\n cursor: pointer;\n position: relative;\n outline: none;\n &:hover:not(:focus) {\n background-color: ${({ theme }) => theme.colors.brand[700]};\n outline: none;\n }\n &:focus {\n :before {\n content: '';\n position: absolute;\n z-index: 2;\n top: 2px;\n left: 2px;\n width: calc(100% - 4px);\n height: calc(100% - 4px);\n border: 2px solid ${({ theme }) => theme.colors.neutral['000']};\n border-radius: 4px;\n }\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,+BAAmB;AAEZ,MAAM,SAAS,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBASL,CAAC,EAAE,YAAY,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAYhC,CAAC,EAAE,YAAY,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,31 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var React = require('react');
|
|
12
|
-
var defaultProps = require('../defaultProps.js');
|
|
13
|
-
|
|
14
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
-
|
|
16
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
17
|
-
|
|
18
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
-
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
-
const useGetPropsWithDefaults = props => {
|
|
22
|
-
const {
|
|
23
|
-
toolbar,
|
|
24
|
-
breadcrumb,
|
|
25
|
-
Logo,
|
|
26
|
-
LogoWithBrand
|
|
27
|
-
} = props;
|
|
28
|
-
return React.useMemo(() => _objectSpread(_objectSpread({}, defaultProps.defaultProps), props), [toolbar, breadcrumb, Logo, LogoWithBrand]);
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
29
11
|
};
|
|
30
|
-
|
|
31
|
-
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var useGetPropsWithDefaults_exports = {};
|
|
29
|
+
__export(useGetPropsWithDefaults_exports, {
|
|
30
|
+
useGetPropsWithDefaults: () => useGetPropsWithDefaults
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_defaultProps = __toESM(require("../defaultProps"));
|
|
35
|
+
const useGetPropsWithDefaults = (props) => {
|
|
36
|
+
const { toolbar, breadcrumb, Logo, LogoWithBrand } = props;
|
|
37
|
+
return (0, import_react.useMemo)(() => ({
|
|
38
|
+
...import_defaultProps.defaultProps,
|
|
39
|
+
...props
|
|
40
|
+
}), [toolbar, breadcrumb, Logo, LogoWithBrand]);
|
|
41
|
+
};
|
|
42
|
+
module.exports = __toCommonJS(useGetPropsWithDefaults_exports);
|
|
43
|
+
//# sourceMappingURL=useGetPropsWithDefaults.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/useGetPropsWithDefaults.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react-hooks/exhaustive-deps */\nimport { useMemo } from 'react';\nimport type { GlobalHeaderPropsT } from '../GlobalHeaderTypes';\nimport { defaultProps } from '../defaultProps';\n\nexport const useGetPropsWithDefaults = (props: GlobalHeaderPropsT): GlobalHeaderPropsT => {\n const { toolbar, breadcrumb, Logo, LogoWithBrand } = props;\n\n return useMemo(\n () => ({\n ...defaultProps,\n ...props,\n }),\n [toolbar, breadcrumb, Logo, LogoWithBrand],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAwB;AAExB,0BAA6B;AAEtB,MAAM,0BAA0B,CAAC,UAAkD;AACxF,QAAM,EAAE,SAAS,YAAY,MAAM,kBAAkB;AAErD,SAAO,0BACL,MAAO;AAAA,OACF;AAAA,OACA;AAAA,MAEL,CAAC,SAAS,YAAY,MAAM;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,31 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var useGlobalHeader_exports = {};
|
|
29
|
+
__export(useGlobalHeader_exports, {
|
|
30
|
+
useGlobalHeader: () => useGlobalHeader
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_uid = __toESM(require("uid"));
|
|
35
|
+
var import_useGetPropsWithDefaults = __toESM(require("./useGetPropsWithDefaults"));
|
|
36
|
+
const useGlobalHeader = (props) => {
|
|
37
|
+
const [showIconOnly, setShowIconOnly] = (0, import_react.useState)(false);
|
|
38
|
+
const instanceUID = (0, import_react.useMemo)(() => (0, import_uid.uid)(5), []);
|
|
39
|
+
const globalHeaderToolbarGrid = (0, import_react.useMemo)(() => new Array(props?.toolbar?.length ?? 0).fill("auto"), [props.toolbar]);
|
|
40
|
+
const globalHeaderBreadcrumbGrid = (0, import_react.useMemo)(() => ["auto", ...new Array(props?.breadcrumb?.length ?? 0).fill("auto"), "1fr"], [props.breadcrumb]);
|
|
41
|
+
const propsWithDefaults = (0, import_useGetPropsWithDefaults.useGetPropsWithDefaults)(props);
|
|
42
|
+
const ctx = import_react.default.useMemo(() => ({
|
|
29
43
|
props: propsWithDefaults,
|
|
30
44
|
showIconOnly,
|
|
31
45
|
setShowIconOnly,
|
|
@@ -35,5 +49,5 @@ const useGlobalHeader = props => {
|
|
|
35
49
|
}), [propsWithDefaults, showIconOnly, instanceUID, globalHeaderToolbarGrid, globalHeaderBreadcrumbGrid]);
|
|
36
50
|
return ctx;
|
|
37
51
|
};
|
|
38
|
-
|
|
39
|
-
|
|
52
|
+
module.exports = __toCommonJS(useGlobalHeader_exports);
|
|
53
|
+
//# sourceMappingURL=useGlobalHeader.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/useGlobalHeader.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useState, useMemo } from 'react';\nimport { uid } from 'uid';\nimport type { ContextT, GlobalHeaderPropsT } from '../GlobalHeaderTypes';\nimport { useGetPropsWithDefaults } from './useGetPropsWithDefaults';\n\nexport const useGlobalHeader = (props: GlobalHeaderPropsT): ContextT => {\n const [showIconOnly, setShowIconOnly] = useState<boolean>(false);\n\n const instanceUID = useMemo(() => uid(5), []);\n\n const globalHeaderToolbarGrid = useMemo(() => new Array(props?.toolbar?.length ?? 0).fill('auto'), [props.toolbar]);\n const globalHeaderBreadcrumbGrid = useMemo(\n () => ['auto', ...new Array(props?.breadcrumb?.length ?? 0).fill('auto'), '1fr'],\n [props.breadcrumb],\n );\n\n const propsWithDefaults = useGetPropsWithDefaults(props);\n\n const ctx = React.useMemo(\n () => ({\n props: propsWithDefaults,\n showIconOnly,\n setShowIconOnly,\n instanceUID,\n globalHeaderToolbarGrid,\n globalHeaderBreadcrumbGrid,\n }),\n [propsWithDefaults, showIconOnly, instanceUID, globalHeaderToolbarGrid, globalHeaderBreadcrumbGrid],\n );\n\n return ctx;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAyC;AACzC,iBAAoB;AAEpB,qCAAwC;AAEjC,MAAM,kBAAkB,CAAC,UAAwC;AACtE,QAAM,CAAC,cAAc,mBAAmB,2BAAkB;AAE1D,QAAM,cAAc,0BAAQ,MAAM,oBAAI,IAAI;AAE1C,QAAM,0BAA0B,0BAAQ,MAAM,IAAI,MAAM,OAAO,SAAS,UAAU,GAAG,KAAK,SAAS,CAAC,MAAM;AAC1G,QAAM,6BAA6B,0BACjC,MAAM,CAAC,QAAQ,GAAG,IAAI,MAAM,OAAO,YAAY,UAAU,GAAG,KAAK,SAAS,QAC1E,CAAC,MAAM;AAGT,QAAM,oBAAoB,4DAAwB;AAElD,QAAM,MAAM,qBAAM,QAChB,MAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MAEF,CAAC,mBAAmB,cAAc,aAAa,yBAAyB;AAG1E,SAAO;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,92 +1,109 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var useValidateProps_exports = {};
|
|
29
|
+
__export(useValidateProps_exports, {
|
|
30
|
+
useValidateProps: () => useValidateProps
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_validateHelpers = __toESM(require("./validateHelpers"));
|
|
34
|
+
const validatePopupItem = (componentProps) => {
|
|
11
35
|
if (componentProps.options && !Array.isArray(componentProps.options)) {
|
|
12
|
-
|
|
36
|
+
(0, import_validateHelpers.throwToolbarPopupItemError)("options", componentProps.options);
|
|
13
37
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
validateHelpers.throwToolbarPopupItemError('closeOnClick', componentProps.closeOnClick);
|
|
38
|
+
if (componentProps.closeOnClick && typeof componentProps.closeOnClick !== "boolean") {
|
|
39
|
+
(0, import_validateHelpers.throwToolbarPopupItemError)("closeOnClick", componentProps.closeOnClick);
|
|
17
40
|
}
|
|
18
41
|
};
|
|
19
|
-
|
|
20
|
-
const validateAppPickerItem = componentProps => {
|
|
42
|
+
const validateAppPickerItem = (componentProps) => {
|
|
21
43
|
if (componentProps.apps && !Array.isArray(componentProps.apps)) {
|
|
22
|
-
|
|
44
|
+
(0, import_validateHelpers.throwToolbarAppPickerItemError)("apps", componentProps.apps);
|
|
23
45
|
}
|
|
24
|
-
|
|
25
46
|
if (componentProps.customApps && !Array.isArray(componentProps.customApps)) {
|
|
26
|
-
|
|
47
|
+
(0, import_validateHelpers.throwToolbarAppPickerItemError)("customApps", componentProps.customApps);
|
|
48
|
+
}
|
|
49
|
+
if (componentProps.sectionTitle && typeof componentProps.sectionTitle !== "string") {
|
|
50
|
+
(0, import_validateHelpers.throwToolbarAppPickerItemError)("sectionTitle", componentProps.sectionTitle);
|
|
51
|
+
}
|
|
52
|
+
if (componentProps.customSectionTitle && typeof componentProps.customSectionTitle !== "string") {
|
|
53
|
+
(0, import_validateHelpers.throwToolbarAppPickerItemError)("customSectionTitle", componentProps.customSectionTitle);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const validateGenericToolbarItem = (item) => {
|
|
57
|
+
if (item.label && typeof item.label !== "string") {
|
|
58
|
+
(0, import_validateHelpers.throwToolbarItemGenericError)("label", item.label);
|
|
27
59
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
validateHelpers.throwToolbarAppPickerItemError('sectionTitle', componentProps.sectionTitle);
|
|
60
|
+
if (item.onClick && typeof item.onClick !== "function") {
|
|
61
|
+
(0, import_validateHelpers.throwToolbarItemGenericError)("onClick", item.onClick);
|
|
31
62
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
63
|
+
if (item.Icon && typeof item.Icon !== "function") {
|
|
64
|
+
if (item.type === "ds-app-picker")
|
|
65
|
+
return;
|
|
66
|
+
(0, import_validateHelpers.throwToolbarItemGenericError)("Icon", item.Icon);
|
|
35
67
|
}
|
|
36
68
|
};
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
toolbar,
|
|
42
|
-
Logo,
|
|
43
|
-
LogoWithBrand
|
|
44
|
-
} = props;
|
|
45
|
-
|
|
46
|
-
if (Logo && typeof Logo !== 'function') {
|
|
47
|
-
validateHelpers.throwLogoError('Logo', Logo);
|
|
69
|
+
const useValidateProps = (props) => {
|
|
70
|
+
const { breadcrumb, toolbar, Logo, LogoWithBrand } = props;
|
|
71
|
+
if (Logo && typeof Logo !== "function") {
|
|
72
|
+
(0, import_validateHelpers.throwLogoError)("Logo", Logo);
|
|
48
73
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
validateHelpers.throwLogoError('LogoWithBrand', LogoWithBrand);
|
|
74
|
+
if (LogoWithBrand && typeof LogoWithBrand !== "function") {
|
|
75
|
+
(0, import_validateHelpers.throwLogoError)("LogoWithBrand", LogoWithBrand);
|
|
52
76
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
validateHelpers.throwBreadcrumbItemError('label', breadcrumbItem.label);
|
|
77
|
+
breadcrumb?.forEach((breadcrumbItem) => {
|
|
78
|
+
if (breadcrumbItem.label && typeof breadcrumbItem.label !== "string") {
|
|
79
|
+
(0, import_validateHelpers.throwBreadcrumbItemError)("label", breadcrumbItem.label);
|
|
57
80
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
validateHelpers.throwBreadcrumbItemError('onClick', breadcrumbItem.onClick);
|
|
81
|
+
if (breadcrumbItem.onClick && typeof breadcrumbItem.onClick !== "function") {
|
|
82
|
+
(0, import_validateHelpers.throwBreadcrumbItemError)("onClick", breadcrumbItem.onClick);
|
|
61
83
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
validateHelpers.throwBreadcrumbItemError('hasNext', breadcrumbItem.hasNext);
|
|
84
|
+
if (breadcrumbItem.hasNext && typeof breadcrumbItem.hasNext !== "boolean") {
|
|
85
|
+
(0, import_validateHelpers.throwBreadcrumbItemError)("hasNext", breadcrumbItem.hasNext);
|
|
65
86
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
validateHelpers.throwBreadcrumbItemError('isSelected', breadcrumbItem.isSelected);
|
|
87
|
+
if (breadcrumbItem.isSelected && typeof breadcrumbItem.isSelected !== "boolean") {
|
|
88
|
+
(0, import_validateHelpers.throwBreadcrumbItemError)("isSelected", breadcrumbItem.isSelected);
|
|
69
89
|
}
|
|
70
90
|
});
|
|
71
|
-
toolbar
|
|
91
|
+
toolbar?.forEach((toolbarItem) => {
|
|
72
92
|
if (toolbarItem.type) {
|
|
73
|
-
if (!
|
|
74
|
-
|
|
93
|
+
if (!(0, import_validateHelpers.isValidToolbarType)(toolbarItem.type)) {
|
|
94
|
+
(0, import_validateHelpers.throwToolbarItemGenericError)("type", toolbarItem.type);
|
|
75
95
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
validateHelpers.throwToolbarItemGenericError('componentProps', toolbarItem.componentProps);
|
|
96
|
+
if (toolbarItem.componentProps && !(0, import_validateHelpers.isObject)(toolbarItem.componentProps)) {
|
|
97
|
+
(0, import_validateHelpers.throwToolbarItemGenericError)("componentProps", toolbarItem.componentProps);
|
|
79
98
|
}
|
|
80
|
-
|
|
81
|
-
if (toolbarItem.type === 'ds-popup-menu') {
|
|
99
|
+
if (toolbarItem.type === "ds-popup-menu") {
|
|
82
100
|
validatePopupItem(toolbarItem.componentProps);
|
|
83
101
|
}
|
|
84
|
-
|
|
85
|
-
if (toolbarItem.type === 'ds-app-picker') {
|
|
102
|
+
if (toolbarItem.type === "ds-app-picker") {
|
|
86
103
|
validateAppPickerItem(toolbarItem.componentProps);
|
|
87
104
|
}
|
|
88
105
|
}
|
|
89
106
|
});
|
|
90
107
|
};
|
|
91
|
-
|
|
92
|
-
|
|
108
|
+
module.exports = __toCommonJS(useValidateProps_exports);
|
|
109
|
+
//# sourceMappingURL=useValidateProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/useValidateProps.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { AppPickerProps, GlobalHeaderPropsT, PopupPropsT, ToolbarItemT } from '../GlobalHeaderTypes';\nimport {\n throwToolbarPopupItemError,\n throwToolbarAppPickerItemError,\n throwToolbarItemGenericError,\n throwLogoError,\n throwBreadcrumbItemError,\n isValidToolbarType,\n isObject,\n} from './validateHelpers';\n\nconst validatePopupItem = (componentProps: PopupPropsT): void => {\n if (componentProps.options && !Array.isArray(componentProps.options)) {\n throwToolbarPopupItemError('options', componentProps.options);\n }\n if (componentProps.closeOnClick && typeof componentProps.closeOnClick !== 'boolean') {\n throwToolbarPopupItemError('closeOnClick', componentProps.closeOnClick);\n }\n};\n\nconst validateAppPickerItem = (componentProps: AppPickerProps): void => {\n if (componentProps.apps && !Array.isArray(componentProps.apps)) {\n throwToolbarAppPickerItemError('apps', componentProps.apps);\n }\n if (componentProps.customApps && !Array.isArray(componentProps.customApps)) {\n throwToolbarAppPickerItemError('customApps', componentProps.customApps);\n }\n if (componentProps.sectionTitle && typeof componentProps.sectionTitle !== 'string') {\n throwToolbarAppPickerItemError('sectionTitle', componentProps.sectionTitle);\n }\n if (componentProps.customSectionTitle && typeof componentProps.customSectionTitle !== 'string') {\n throwToolbarAppPickerItemError('customSectionTitle', componentProps.customSectionTitle);\n }\n};\n\nconst validateGenericToolbarItem = (item: ToolbarItemT): void => {\n if (item.label && typeof item.label !== 'string') {\n throwToolbarItemGenericError('label', item.label);\n }\n if (item.onClick && typeof item.onClick !== 'function') {\n throwToolbarItemGenericError('onClick', item.onClick);\n }\n if (item.Icon && typeof item.Icon !== 'function') {\n if (item.type === 'ds-app-picker') return;\n throwToolbarItemGenericError('Icon', item.Icon);\n }\n};\n\nexport const useValidateProps = (props: GlobalHeaderPropsT): void => {\n const { breadcrumb, toolbar, Logo, LogoWithBrand } = props;\n\n if (Logo && typeof Logo !== 'function') {\n throwLogoError('Logo', Logo);\n }\n\n if (LogoWithBrand && typeof LogoWithBrand !== 'function') {\n throwLogoError('LogoWithBrand', LogoWithBrand);\n }\n\n breadcrumb?.forEach((breadcrumbItem) => {\n if (breadcrumbItem.label && typeof breadcrumbItem.label !== 'string') {\n throwBreadcrumbItemError('label', breadcrumbItem.label);\n }\n if (breadcrumbItem.onClick && typeof breadcrumbItem.onClick !== 'function') {\n throwBreadcrumbItemError('onClick', breadcrumbItem.onClick);\n }\n if (breadcrumbItem.hasNext && typeof breadcrumbItem.hasNext !== 'boolean') {\n throwBreadcrumbItemError('hasNext', breadcrumbItem.hasNext);\n }\n if (breadcrumbItem.isSelected && typeof breadcrumbItem.isSelected !== 'boolean') {\n throwBreadcrumbItemError('isSelected', breadcrumbItem.isSelected);\n }\n });\n\n toolbar?.forEach((toolbarItem) => {\n if (toolbarItem.type) {\n if (!isValidToolbarType(toolbarItem.type)) {\n throwToolbarItemGenericError('type', toolbarItem.type);\n }\n if (toolbarItem.componentProps && !isObject(toolbarItem.componentProps)) {\n throwToolbarItemGenericError('componentProps', toolbarItem.componentProps);\n }\n if (toolbarItem.type === 'ds-popup-menu') {\n validatePopupItem(toolbarItem.componentProps as PopupPropsT);\n }\n if (toolbarItem.type === 'ds-app-picker') {\n validateAppPickerItem(toolbarItem.componentProps as AppPickerProps);\n }\n }\n });\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,6BAQO;AAEP,MAAM,oBAAoB,CAAC,mBAAsC;AAC/D,MAAI,eAAe,WAAW,CAAC,MAAM,QAAQ,eAAe,UAAU;AACpE,2DAA2B,WAAW,eAAe;AAAA;AAEvD,MAAI,eAAe,gBAAgB,OAAO,eAAe,iBAAiB,WAAW;AACnF,2DAA2B,gBAAgB,eAAe;AAAA;AAAA;AAI9D,MAAM,wBAAwB,CAAC,mBAAyC;AACtE,MAAI,eAAe,QAAQ,CAAC,MAAM,QAAQ,eAAe,OAAO;AAC9D,+DAA+B,QAAQ,eAAe;AAAA;AAExD,MAAI,eAAe,cAAc,CAAC,MAAM,QAAQ,eAAe,aAAa;AAC1E,+DAA+B,cAAc,eAAe;AAAA;AAE9D,MAAI,eAAe,gBAAgB,OAAO,eAAe,iBAAiB,UAAU;AAClF,+DAA+B,gBAAgB,eAAe;AAAA;AAEhE,MAAI,eAAe,sBAAsB,OAAO,eAAe,uBAAuB,UAAU;AAC9F,+DAA+B,sBAAsB,eAAe;AAAA;AAAA;AAIxE,MAAM,6BAA6B,CAAC,SAA6B;AAC/D,MAAI,KAAK,SAAS,OAAO,KAAK,UAAU,UAAU;AAChD,6DAA6B,SAAS,KAAK;AAAA;AAE7C,MAAI,KAAK,WAAW,OAAO,KAAK,YAAY,YAAY;AACtD,6DAA6B,WAAW,KAAK;AAAA;AAE/C,MAAI,KAAK,QAAQ,OAAO,KAAK,SAAS,YAAY;AAChD,QAAI,KAAK,SAAS;AAAiB;AACnC,6DAA6B,QAAQ,KAAK;AAAA;AAAA;AAIvC,MAAM,mBAAmB,CAAC,UAAoC;AACnE,QAAM,EAAE,YAAY,SAAS,MAAM,kBAAkB;AAErD,MAAI,QAAQ,OAAO,SAAS,YAAY;AACtC,+CAAe,QAAQ;AAAA;AAGzB,MAAI,iBAAiB,OAAO,kBAAkB,YAAY;AACxD,+CAAe,iBAAiB;AAAA;AAGlC,cAAY,QAAQ,CAAC,mBAAmB;AACtC,QAAI,eAAe,SAAS,OAAO,eAAe,UAAU,UAAU;AACpE,2DAAyB,SAAS,eAAe;AAAA;AAEnD,QAAI,eAAe,WAAW,OAAO,eAAe,YAAY,YAAY;AAC1E,2DAAyB,WAAW,eAAe;AAAA;AAErD,QAAI,eAAe,WAAW,OAAO,eAAe,YAAY,WAAW;AACzE,2DAAyB,WAAW,eAAe;AAAA;AAErD,QAAI,eAAe,cAAc,OAAO,eAAe,eAAe,WAAW;AAC/E,2DAAyB,cAAc,eAAe;AAAA;AAAA;AAI1D,WAAS,QAAQ,CAAC,gBAAgB;AAChC,QAAI,YAAY,MAAM;AACpB,UAAI,CAAC,+CAAmB,YAAY,OAAO;AACzC,iEAA6B,QAAQ,YAAY;AAAA;AAEnD,UAAI,YAAY,kBAAkB,CAAC,qCAAS,YAAY,iBAAiB;AACvE,iEAA6B,kBAAkB,YAAY;AAAA;AAE7D,UAAI,YAAY,SAAS,iBAAiB;AACxC,0BAAkB,YAAY;AAAA;AAEhC,UAAI,YAAY,SAAS,iBAAiB;AACxC,8BAAsB,YAAY;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,57 +1,111 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var validateHelpers_exports = {};
|
|
29
|
+
__export(validateHelpers_exports, {
|
|
30
|
+
breadcrumbProps: () => breadcrumbProps,
|
|
31
|
+
getVariableType: () => getVariableType,
|
|
32
|
+
isObject: () => isObject,
|
|
33
|
+
isValidToolbarType: () => isValidToolbarType,
|
|
34
|
+
throwBreadcrumbItemError: () => throwBreadcrumbItemError,
|
|
35
|
+
throwLogoError: () => throwLogoError,
|
|
36
|
+
throwToolbarAppPickerItemError: () => throwToolbarAppPickerItemError,
|
|
37
|
+
throwToolbarItemGenericError: () => throwToolbarItemGenericError,
|
|
38
|
+
throwToolbarPopupItemError: () => throwToolbarPopupItemError,
|
|
39
|
+
toolbarProps: () => toolbarProps
|
|
40
|
+
});
|
|
41
|
+
var React = __toESM(require("react"));
|
|
5
42
|
const breadcrumbProps = {
|
|
6
|
-
label:
|
|
7
|
-
onClick:
|
|
8
|
-
hasNext:
|
|
9
|
-
isSelected:
|
|
43
|
+
label: "string",
|
|
44
|
+
onClick: "function",
|
|
45
|
+
hasNext: "boolean",
|
|
46
|
+
isSelected: "boolean"
|
|
10
47
|
};
|
|
11
48
|
const toolbarProps = {
|
|
12
|
-
label:
|
|
49
|
+
label: "string",
|
|
13
50
|
type: '"ds-app-picker" or "ds-popup-menu" or "ds-search-toggle"',
|
|
14
|
-
componentProps:
|
|
15
|
-
Icon:
|
|
16
|
-
onClick:
|
|
17
|
-
options:
|
|
18
|
-
closeOnClick:
|
|
19
|
-
apps:
|
|
20
|
-
customApps:
|
|
21
|
-
sectionTitle:
|
|
22
|
-
customSectionTitle:
|
|
23
|
-
};
|
|
24
|
-
const isObject = obj => typeof obj ===
|
|
25
|
-
const getVariableType = arg => {
|
|
26
|
-
if (Array.isArray(arg))
|
|
27
|
-
|
|
28
|
-
if (arg ===
|
|
51
|
+
componentProps: "object",
|
|
52
|
+
Icon: "react component",
|
|
53
|
+
onClick: "function",
|
|
54
|
+
options: "array",
|
|
55
|
+
closeOnClick: "boolean",
|
|
56
|
+
apps: "array",
|
|
57
|
+
customApps: "array",
|
|
58
|
+
sectionTitle: "string",
|
|
59
|
+
customSectionTitle: "string"
|
|
60
|
+
};
|
|
61
|
+
const isObject = (obj) => typeof obj === "object" && !!obj && !Array.isArray(obj);
|
|
62
|
+
const getVariableType = (arg) => {
|
|
63
|
+
if (Array.isArray(arg))
|
|
64
|
+
return "array";
|
|
65
|
+
if (arg === null)
|
|
66
|
+
return "null";
|
|
67
|
+
if (arg === void 0)
|
|
68
|
+
return "undefined";
|
|
29
69
|
return typeof arg;
|
|
30
70
|
};
|
|
31
|
-
const isValidToolbarType = string => string ===
|
|
71
|
+
const isValidToolbarType = (string) => string === "ds-app-picker" || string === "ds-popup-menu" || string === "ds-search-toggle" || string === "custom";
|
|
32
72
|
const throwBreadcrumbItemError = (validPropKey, invalidProp) => {
|
|
33
|
-
throw new Error(
|
|
73
|
+
throw new Error(`You are trying to pass a not valid "${validPropKey}" property for a breadcrumb item, please provide a valid type.
|
|
74
|
+
|
|
75
|
+
Received: ${invalidProp} (${typeof invalidProp})
|
|
76
|
+
Expected: (${breadcrumbProps[validPropKey]})
|
|
77
|
+
`);
|
|
34
78
|
};
|
|
35
79
|
const throwToolbarPopupItemError = (validPropKey, invalidProp) => {
|
|
36
|
-
throw new Error(
|
|
80
|
+
throw new Error(`You are trying to pass a not valid "${validPropKey}" property inside componentProps for a ds-popup-menu
|
|
81
|
+
toolbar item, please provide a valid type.
|
|
82
|
+
|
|
83
|
+
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
84
|
+
Expected: (${toolbarProps[validPropKey]})
|
|
85
|
+
`);
|
|
37
86
|
};
|
|
38
87
|
const throwToolbarAppPickerItemError = (validPropKey, invalidProp) => {
|
|
39
|
-
throw new Error(
|
|
88
|
+
throw new Error(`You are trying to pass a not valid "${validPropKey}" property inside componentProps for a ds-app-picker
|
|
89
|
+
toolbar item, please provide a valid type.
|
|
90
|
+
|
|
91
|
+
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
92
|
+
Expected: (${toolbarProps[validPropKey]})
|
|
93
|
+
`);
|
|
40
94
|
};
|
|
41
95
|
const throwToolbarItemGenericError = (validPropKey, invalidProp) => {
|
|
42
|
-
throw new Error(
|
|
96
|
+
throw new Error(`You are trying to pass a not valid "${validPropKey}" property for a toolbar item, please provide a valid type.
|
|
97
|
+
|
|
98
|
+
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
99
|
+
Expected: (${toolbarProps[validPropKey]})
|
|
100
|
+
`);
|
|
43
101
|
};
|
|
44
102
|
const throwLogoError = (validPropKey, invalidProp) => {
|
|
45
|
-
throw new Error(
|
|
46
|
-
|
|
103
|
+
throw new Error(`You are trying to pass a not valid "${validPropKey}" property for a global header,
|
|
104
|
+
remember to provide both Logo and LogoWithBrand properties with a valid type.
|
|
47
105
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
exports
|
|
53
|
-
|
|
54
|
-
exports.throwToolbarAppPickerItemError = throwToolbarAppPickerItemError;
|
|
55
|
-
exports.throwToolbarItemGenericError = throwToolbarItemGenericError;
|
|
56
|
-
exports.throwToolbarPopupItemError = throwToolbarPopupItemError;
|
|
57
|
-
exports.toolbarProps = toolbarProps;
|
|
106
|
+
Received: ${invalidProp} (${getVariableType(invalidProp)}).
|
|
107
|
+
Expected: (react component).
|
|
108
|
+
`);
|
|
109
|
+
};
|
|
110
|
+
module.exports = __toCommonJS(validateHelpers_exports);
|
|
111
|
+
//# sourceMappingURL=validateHelpers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/validateHelpers.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const breadcrumbProps = {\n label: 'string',\n onClick: 'function',\n hasNext: 'boolean',\n isSelected: 'boolean',\n};\n\nexport const toolbarProps = {\n label: 'string',\n type: '\"ds-app-picker\" or \"ds-popup-menu\" or \"ds-search-toggle\"',\n componentProps: 'object',\n Icon: 'react component',\n onClick: 'function',\n options: 'array',\n closeOnClick: 'boolean',\n apps: 'array',\n customApps: 'array',\n sectionTitle: 'string',\n customSectionTitle: 'string',\n};\n\nexport const isObject = (obj: unknown): boolean => typeof obj === 'object' && !!obj && !Array.isArray(obj);\n\nexport const getVariableType = (arg: unknown): string => {\n if (Array.isArray(arg)) return 'array';\n if (arg === null) return 'null';\n if (arg === undefined) return 'undefined';\n return typeof arg;\n};\n\nexport const isValidToolbarType = (string: unknown): boolean =>\n string === 'ds-app-picker' || string === 'ds-popup-menu' || string === 'ds-search-toggle' || string === 'custom';\n\nexport const throwBreadcrumbItemError = (validPropKey: keyof typeof breadcrumbProps, invalidProp: unknown): void => {\n throw new Error(\n `You are trying to pass a not valid \"${validPropKey}\" property for a breadcrumb item, please provide a valid type.\n\n Received: ${invalidProp} (${typeof invalidProp})\n Expected: (${breadcrumbProps[validPropKey]})\n `,\n );\n};\n\nexport const throwToolbarPopupItemError = (validPropKey: keyof typeof toolbarProps, invalidProp: unknown): void => {\n throw new Error(\n `You are trying to pass a not valid \"${validPropKey}\" property inside componentProps for a ds-popup-menu \n toolbar item, please provide a valid type.\n\n Received: ${invalidProp} (${getVariableType(invalidProp)})\n Expected: (${toolbarProps[validPropKey]})\n `,\n );\n};\n\nexport const throwToolbarAppPickerItemError = (validPropKey: keyof typeof toolbarProps, invalidProp: unknown): void => {\n throw new Error(\n `You are trying to pass a not valid \"${validPropKey}\" property inside componentProps for a ds-app-picker \n toolbar item, please provide a valid type.\n\n Received: ${invalidProp} (${getVariableType(invalidProp)})\n Expected: (${toolbarProps[validPropKey]})\n `,\n );\n};\n\nexport const throwToolbarItemGenericError = (validPropKey: keyof typeof toolbarProps, invalidProp: unknown): void => {\n throw new Error(\n `You are trying to pass a not valid \"${validPropKey}\" property for a toolbar item, please provide a valid type.\n\n Received: ${invalidProp} (${getVariableType(invalidProp)})\n Expected: (${toolbarProps[validPropKey]})\n `,\n );\n};\n\nexport const throwLogoError = (validPropKey: string, invalidProp: unknown): void => {\n throw new Error(\n `You are trying to pass a not valid \"${validPropKey}\" property for a global header, \n remember to provide both Logo and LogoWithBrand properties with a valid type.\n\n Received: ${invalidProp} (${getVariableType(invalidProp)}).\n Expected: (react component).\n `,\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,kBAAkB;AAAA,EAC7B,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,EACT,YAAY;AAAA;AAGP,MAAM,eAAe;AAAA,EAC1B,OAAO;AAAA,EACP,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,cAAc;AAAA,EACd,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,oBAAoB;AAAA;AAGf,MAAM,WAAW,CAAC,QAA0B,OAAO,QAAQ,YAAY,CAAC,CAAC,OAAO,CAAC,MAAM,QAAQ;AAE/F,MAAM,kBAAkB,CAAC,QAAyB;AACvD,MAAI,MAAM,QAAQ;AAAM,WAAO;AAC/B,MAAI,QAAQ;AAAM,WAAO;AACzB,MAAI,QAAQ;AAAW,WAAO;AAC9B,SAAO,OAAO;AAAA;AAGT,MAAM,qBAAqB,CAAC,WACjC,WAAW,mBAAmB,WAAW,mBAAmB,WAAW,sBAAsB,WAAW;AAEnG,MAAM,2BAA2B,CAAC,cAA4C,gBAA+B;AAClH,QAAM,IAAI,MACR,uCAAuC;AAAA;AAAA,cAE7B,gBAAgB,OAAO;AAAA,eACtB,gBAAgB;AAAA;AAAA;AAKxB,MAAM,6BAA6B,CAAC,cAAyC,gBAA+B;AACjH,QAAM,IAAI,MACR,uCAAuC;AAAA;AAAA;AAAA,cAG7B,gBAAgB,gBAAgB;AAAA,eAC/B,aAAa;AAAA;AAAA;AAKrB,MAAM,iCAAiC,CAAC,cAAyC,gBAA+B;AACrH,QAAM,IAAI,MACR,uCAAuC;AAAA;AAAA;AAAA,cAG7B,gBAAgB,gBAAgB;AAAA,eAC/B,aAAa;AAAA;AAAA;AAKrB,MAAM,+BAA+B,CAAC,cAAyC,gBAA+B;AACnH,QAAM,IAAI,MACR,uCAAuC;AAAA;AAAA,cAE7B,gBAAgB,gBAAgB;AAAA,eAC/B,aAAa;AAAA;AAAA;AAKrB,MAAM,iBAAiB,CAAC,cAAsB,gBAA+B;AAClF,QAAM,IAAI,MACR,uCAAuC;AAAA;AAAA;AAAA,cAG7B,gBAAgB,gBAAgB;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/cjs/defaultProps.js
CHANGED
|
@@ -1,14 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var defaultProps_exports = {};
|
|
29
|
+
__export(defaultProps_exports, {
|
|
30
|
+
defaultProps: () => defaultProps
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
5
33
|
const emptyComp = () => null;
|
|
6
|
-
|
|
7
34
|
const defaultProps = {
|
|
8
35
|
breadcrumb: [],
|
|
9
36
|
toolbar: [],
|
|
10
37
|
LogoWithBrand: emptyComp,
|
|
11
38
|
Logo: emptyComp
|
|
12
39
|
};
|
|
13
|
-
|
|
14
|
-
|
|
40
|
+
module.exports = __toCommonJS(defaultProps_exports);
|
|
41
|
+
//# sourceMappingURL=defaultProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/defaultProps.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import type { GlobalHeaderPropsT } from './GlobalHeaderTypes';\n\nconst emptyComp = () => null;\n\nexport const defaultProps: GlobalHeaderPropsT = {\n breadcrumb: [],\n toolbar: [],\n LogoWithBrand: emptyComp,\n Logo: emptyComp,\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,MAAM,YAAY,MAAM;AAEjB,MAAM,eAAmC;AAAA,EAC9C,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,eAAe;AAAA,EACf,MAAM;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|