@elliemae/ds-toolbar-v2 3.22.0-next.30
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/dist/cjs/DSToolbarDefinitions.js +38 -0
- package/dist/cjs/DSToolbarDefinitions.js.map +7 -0
- package/dist/cjs/DSToolbarItemV2.js +79 -0
- package/dist/cjs/DSToolbarItemV2.js.map +7 -0
- package/dist/cjs/DSToolbarSeparatorV2.js +38 -0
- package/dist/cjs/DSToolbarSeparatorV2.js.map +7 -0
- package/dist/cjs/DSToolbarV2.js +84 -0
- package/dist/cjs/DSToolbarV2.js.map +7 -0
- package/dist/cjs/DSToolbarV2Context.js +44 -0
- package/dist/cjs/DSToolbarV2Context.js.map +7 -0
- package/dist/cjs/index.js +32 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +7 -0
- package/dist/cjs/react-desc-prop-types.js +70 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/styled.js +55 -0
- package/dist/cjs/styled.js.map +7 -0
- package/dist/cjs/useToolbarItemHandlers.js +82 -0
- package/dist/cjs/useToolbarItemHandlers.js.map +7 -0
- package/dist/esm/DSToolbarDefinitions.js +8 -0
- package/dist/esm/DSToolbarDefinitions.js.map +7 -0
- package/dist/esm/DSToolbarItemV2.js +54 -0
- package/dist/esm/DSToolbarItemV2.js.map +7 -0
- package/dist/esm/DSToolbarSeparatorV2.js +8 -0
- package/dist/esm/DSToolbarSeparatorV2.js.map +7 -0
- package/dist/esm/DSToolbarV2.js +59 -0
- package/dist/esm/DSToolbarV2.js.map +7 -0
- package/dist/esm/DSToolbarV2Context.js +14 -0
- package/dist/esm/DSToolbarV2Context.js.map +7 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/package.json +7 -0
- package/dist/esm/react-desc-prop-types.js +44 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/styled.js +25 -0
- package/dist/esm/styled.js.map +7 -0
- package/dist/esm/useToolbarItemHandlers.js +52 -0
- package/dist/esm/useToolbarItemHandlers.js.map +7 -0
- package/dist/types/DSToolbarDefinitions.d.ts +2 -0
- package/dist/types/DSToolbarItemV2.d.ts +5 -0
- package/dist/types/DSToolbarSeparatorV2.d.ts +2 -0
- package/dist/types/DSToolbarV2.d.ts +5 -0
- package/dist/types/DSToolbarV2Context.d.ts +11 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/react-desc-prop-types.d.ts +485 -0
- package/dist/types/styled.d.ts +7 -0
- package/dist/types/tests/DSToolbar.test.d.ts +1 -0
- package/dist/types/useToolbarItemHandlers.d.ts +4 -0
- package/package.json +127 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var DSToolbarDefinitions_exports = {};
|
|
30
|
+
__export(DSToolbarDefinitions_exports, {
|
|
31
|
+
DSToolbarItemName: () => DSToolbarItemName,
|
|
32
|
+
DSToolbarName: () => DSToolbarName
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(DSToolbarDefinitions_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
const DSToolbarName = "DSToolbar";
|
|
37
|
+
const DSToolbarItemName = "DSToolbarItem";
|
|
38
|
+
//# sourceMappingURL=DSToolbarDefinitions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSToolbarDefinitions.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const DSToolbarName = 'DSToolbar';\n\nexport const DSToolbarItemName = 'DSToolbarItem';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,gBAAgB;AAEtB,MAAM,oBAAoB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var DSToolbarItemV2_exports = {};
|
|
30
|
+
__export(DSToolbarItemV2_exports, {
|
|
31
|
+
DSToolbarItemV2: () => DSToolbarItemV2,
|
|
32
|
+
DSToolbarItemV2WithSchema: () => DSToolbarItemV2WithSchema
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(DSToolbarItemV2_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_react = require("react");
|
|
38
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
39
|
+
var import_uid = require("uid");
|
|
40
|
+
var import_lodash = require("lodash");
|
|
41
|
+
var import_DSToolbarV2Context = require("./DSToolbarV2Context.js");
|
|
42
|
+
var import_styled = require("./styled.js");
|
|
43
|
+
var import_useToolbarItemHandlers = require("./useToolbarItemHandlers.js");
|
|
44
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
45
|
+
var import_DSToolbarDefinitions = require("./DSToolbarDefinitions.js");
|
|
46
|
+
const DSToolbarItemV2 = (props) => {
|
|
47
|
+
const propsWithDefaults = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultItemProps);
|
|
48
|
+
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefaults, import_react_desc_prop_types.DSToolbarItemV2Schema, import_DSToolbarDefinitions.DSToolbarItemName);
|
|
49
|
+
const { render: ComponentRenderer, isFirstItem } = propsWithDefaults;
|
|
50
|
+
const { id: providedId, ...restGlobals } = (0, import_lodash.omit)((0, import_ds_props_helpers.useGetGlobalAttributes)(propsWithDefaults), ["rows", "cols", "wrap"]);
|
|
51
|
+
const { registerReference, dndDraggingItem } = (0, import_react.useContext)(import_DSToolbarV2Context.DSToolbarV2Context);
|
|
52
|
+
const ref = (0, import_react.useRef)(null);
|
|
53
|
+
const toolbarItemId = (0, import_react.useMemo)(() => {
|
|
54
|
+
const id = providedId ?? `ds-toolbar-item-${(0, import_uid.uid)()}`;
|
|
55
|
+
registerReference(id, ref);
|
|
56
|
+
return id;
|
|
57
|
+
}, [registerReference, ref, providedId]);
|
|
58
|
+
const tabIndex = (0, import_react.useMemo)(
|
|
59
|
+
() => dndDraggingItem === toolbarItemId || !dndDraggingItem && isFirstItem ? 0 : -1,
|
|
60
|
+
[dndDraggingItem, isFirstItem, toolbarItemId]
|
|
61
|
+
);
|
|
62
|
+
const handlers = (0, import_useToolbarItemHandlers.useToolbarItemHandlers)(toolbarItemId);
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
+
import_styled.StyledToolbarItem,
|
|
65
|
+
{
|
|
66
|
+
id: toolbarItemId,
|
|
67
|
+
"data-testid": "ds-toolbar-item",
|
|
68
|
+
className: "ds-toolbar-item",
|
|
69
|
+
...handlers,
|
|
70
|
+
...restGlobals,
|
|
71
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComponentRenderer, { innerRef: ref, tabIndex })
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
DSToolbarItemV2.propTypes = import_react_desc_prop_types.DSToolbarItemV2Schema;
|
|
76
|
+
DSToolbarItemV2.displayName = import_DSToolbarDefinitions.DSToolbarItemName;
|
|
77
|
+
const DSToolbarItemV2WithSchema = (0, import_ds_props_helpers.describe)(DSToolbarItemV2).description("Toolbar Item");
|
|
78
|
+
DSToolbarItemV2WithSchema.propTypes = import_react_desc_prop_types.DSToolbarItemV2Schema;
|
|
79
|
+
//# sourceMappingURL=DSToolbarItemV2.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSToolbarItemV2.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/prop-types */\nimport React, { useContext, useMemo, useRef } from 'react';\nimport {\n describe,\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n useGetGlobalAttributes,\n} from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { omit } from 'lodash';\nimport { DSToolbarV2Context } from './DSToolbarV2Context.js';\nimport { StyledToolbarItem } from './styled.js';\nimport { useToolbarItemHandlers } from './useToolbarItemHandlers.js';\nimport { defaultItemProps, DSToolbarItemV2Schema } from './react-desc-prop-types.js';\nimport type { DSToolbarItemT } from './react-desc-prop-types.js';\nimport { DSToolbarItemName } from './DSToolbarDefinitions.js';\nconst DSToolbarItemV2: React.ComponentType<DSToolbarItemT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSToolbarItemT.Props>(props, defaultItemProps);\n\n useValidateTypescriptPropTypes(propsWithDefaults, DSToolbarItemV2Schema, DSToolbarItemName);\n const { render: ComponentRenderer, isFirstItem } = propsWithDefaults;\n const { id: providedId, ...restGlobals } = omit(useGetGlobalAttributes(propsWithDefaults), ['rows', 'cols', 'wrap']);\n const { registerReference, dndDraggingItem } = useContext(DSToolbarV2Context);\n const ref = useRef<DSToolbarItemT.RenderHTMLElementT>(null);\n\n const toolbarItemId = useMemo(() => {\n const id = providedId ?? `ds-toolbar-item-${uid()}`;\n registerReference(id, ref);\n return id;\n }, [registerReference, ref, providedId]);\n\n const tabIndex = useMemo(\n () => (dndDraggingItem === toolbarItemId || (!dndDraggingItem && isFirstItem) ? 0 : -1),\n [dndDraggingItem, isFirstItem, toolbarItemId],\n );\n\n const handlers = useToolbarItemHandlers(toolbarItemId);\n return (\n <StyledToolbarItem\n id={toolbarItemId}\n data-testid=\"ds-toolbar-item\"\n className=\"ds-toolbar-item\"\n {...handlers}\n {...restGlobals}\n >\n <ComponentRenderer innerRef={ref} tabIndex={tabIndex} />\n </StyledToolbarItem>\n );\n};\n\nDSToolbarItemV2.propTypes = DSToolbarItemV2Schema;\n\nDSToolbarItemV2.displayName = DSToolbarItemName;\nconst DSToolbarItemV2WithSchema = describe(DSToolbarItemV2).description('Toolbar Item');\nDSToolbarItemV2WithSchema.propTypes = DSToolbarItemV2Schema;\n\nexport { DSToolbarItemV2, DSToolbarItemV2WithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD6CjB;AA5CN,mBAAmD;AACnD,8BAKO;AACP,iBAAoB;AACpB,oBAAqB;AACrB,gCAAmC;AACnC,oBAAkC;AAClC,oCAAuC;AACvC,mCAAwD;AAExD,kCAAkC;AAClC,MAAM,kBAA6D,CAAC,UAAU;AAC5E,QAAM,wBAAoB,sDAAmD,OAAO,6CAAgB;AAEpG,8DAA+B,mBAAmB,oDAAuB,6CAAiB;AAC1F,QAAM,EAAE,QAAQ,mBAAmB,YAAY,IAAI;AACnD,QAAM,EAAE,IAAI,YAAY,GAAG,YAAY,QAAI,wBAAK,gDAAuB,iBAAiB,GAAG,CAAC,QAAQ,QAAQ,MAAM,CAAC;AACnH,QAAM,EAAE,mBAAmB,gBAAgB,QAAI,yBAAW,4CAAkB;AAC5E,QAAM,UAAM,qBAA0C,IAAI;AAE1D,QAAM,oBAAgB,sBAAQ,MAAM;AAClC,UAAM,KAAK,cAAc,uBAAmB,gBAAI;AAChD,sBAAkB,IAAI,GAAG;AACzB,WAAO;AAAA,EACT,GAAG,CAAC,mBAAmB,KAAK,UAAU,CAAC;AAEvC,QAAM,eAAW;AAAA,IACf,MAAO,oBAAoB,iBAAkB,CAAC,mBAAmB,cAAe,IAAI;AAAA,IACpF,CAAC,iBAAiB,aAAa,aAAa;AAAA,EAC9C;AAEA,QAAM,eAAW,sDAAuB,aAAa;AACrD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,IAAI;AAAA,MACJ,eAAY;AAAA,MACZ,WAAU;AAAA,MACT,GAAG;AAAA,MACH,GAAG;AAAA,MAEJ,sDAAC,qBAAkB,UAAU,KAAK,UAAoB;AAAA;AAAA,EACxD;AAEJ;AAEA,gBAAgB,YAAY;AAE5B,gBAAgB,cAAc;AAC9B,MAAM,gCAA4B,kCAAS,eAAe,EAAE,YAAY,cAAc;AACtF,0BAA0B,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var DSToolbarSeparatorV2_exports = {};
|
|
30
|
+
__export(DSToolbarSeparatorV2_exports, {
|
|
31
|
+
DSToolbarSeparatorV2: () => DSToolbarSeparatorV2
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(DSToolbarSeparatorV2_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_styled = require("./styled.js");
|
|
37
|
+
const DSToolbarSeparatorV2 = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledSeparator, { className: "ds-toolbar-separator" });
|
|
38
|
+
//# sourceMappingURL=DSToolbarSeparatorV2.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSToolbarSeparatorV2.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { StyledSeparator } from './styled.js';\n\nexport const DSToolbarSeparatorV2: React.ComponentType = () => <StyledSeparator className=\"ds-toolbar-separator\" />;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGwC;AAF/D,oBAAgC;AAEzB,MAAM,uBAA4C,MAAM,4CAAC,iCAAgB,WAAU,wBAAuB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var DSToolbarV2_exports = {};
|
|
30
|
+
__export(DSToolbarV2_exports, {
|
|
31
|
+
DSToolbarV2: () => DSToolbarV2,
|
|
32
|
+
DSToolbarV2WithSchema: () => DSToolbarV2WithSchema
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(DSToolbarV2_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_react = require("react");
|
|
38
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
39
|
+
var import_uid = require("uid");
|
|
40
|
+
var import_lodash = require("lodash");
|
|
41
|
+
var import_DSToolbarV2Context = require("./DSToolbarV2Context.js");
|
|
42
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
43
|
+
var import_styled = require("./styled.js");
|
|
44
|
+
var import_DSToolbarDefinitions = require("./DSToolbarDefinitions.js");
|
|
45
|
+
const DSToolbarV2 = (props) => {
|
|
46
|
+
const propsWithDefaults = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultProps);
|
|
47
|
+
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefaults, import_react_desc_prop_types.DSToolbarV2Schema, import_DSToolbarDefinitions.DSToolbarName);
|
|
48
|
+
const { alignment, withDepth, compact, innerRef, children } = propsWithDefaults;
|
|
49
|
+
const globalsProps = (0, import_lodash.omit)((0, import_ds_props_helpers.useGetGlobalAttributes)(propsWithDefaults), ["cols", "rows", "wrap"]);
|
|
50
|
+
const toolbarUid = (0, import_react.useMemo)(() => globalsProps.id ?? `ds-toolbar-${(0, import_uid.uid)()}`, [globalsProps.id]);
|
|
51
|
+
const [itemReferences, setItemReferences] = (0, import_react.useState)({});
|
|
52
|
+
const [dndDraggingItem, setDndDraggingItem] = (0, import_react.useState)("");
|
|
53
|
+
const registerReference = (0, import_react.useCallback)(
|
|
54
|
+
(itemId, ref) => {
|
|
55
|
+
setItemReferences((prevItemReferences) => ({ ...prevItemReferences, [itemId]: ref }));
|
|
56
|
+
},
|
|
57
|
+
[setItemReferences]
|
|
58
|
+
);
|
|
59
|
+
const ctx = (0, import_react.useMemo)(
|
|
60
|
+
() => ({ toolbarUid, registerReference, itemReferences, dndDraggingItem, setDndDraggingItem }),
|
|
61
|
+
[dndDraggingItem, itemReferences, registerReference, toolbarUid]
|
|
62
|
+
);
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSToolbarV2Context.DSToolbarV2Context.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
+
import_styled.StyledToolbarWrapper,
|
|
65
|
+
{
|
|
66
|
+
role: "toolbar",
|
|
67
|
+
"data-testid": "ds-toolbar-wrapper",
|
|
68
|
+
id: toolbarUid,
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
justifyContent: alignment === "left" ? "flex-start" : "flex-end",
|
|
71
|
+
withDepth,
|
|
72
|
+
gutter: "xxs2",
|
|
73
|
+
compact,
|
|
74
|
+
ref: innerRef,
|
|
75
|
+
...globalsProps,
|
|
76
|
+
children
|
|
77
|
+
}
|
|
78
|
+
) });
|
|
79
|
+
};
|
|
80
|
+
DSToolbarV2.propTypes = import_react_desc_prop_types.DSToolbarV2Schema;
|
|
81
|
+
DSToolbarV2.displayName = import_DSToolbarDefinitions.DSToolbarName;
|
|
82
|
+
const DSToolbarV2WithSchema = (0, import_ds_props_helpers.describe)(DSToolbarV2).description("Toolbar");
|
|
83
|
+
DSToolbarV2WithSchema.propTypes = import_react_desc_prop_types.DSToolbarV2Schema;
|
|
84
|
+
//# sourceMappingURL=DSToolbarV2.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSToolbarV2.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/prop-types */\nimport React, { useCallback, useMemo, useState } from 'react';\nimport {\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n useGetGlobalAttributes,\n describe,\n} from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { omit } from 'lodash';\nimport { DSToolbarV2Context } from './DSToolbarV2Context.js';\nimport { DSToolbarV2Schema, defaultProps } from './react-desc-prop-types.js';\nimport { StyledToolbarWrapper } from './styled.js';\nimport type { DSToolbarT, DSToolbarItemT } from './react-desc-prop-types.js';\nimport { DSToolbarName } from './DSToolbarDefinitions.js';\nconst DSToolbarV2: React.ComponentType<DSToolbarT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSToolbarT.InternalProps>(props, defaultProps);\n\n useValidateTypescriptPropTypes(propsWithDefaults, DSToolbarV2Schema, DSToolbarName);\n\n const { alignment, withDepth, compact, innerRef, children } = propsWithDefaults;\n\n const globalsProps = omit(useGetGlobalAttributes(propsWithDefaults), ['cols', 'rows', 'wrap']);\n\n const toolbarUid = useMemo(() => globalsProps.id ?? `ds-toolbar-${uid()}`, [globalsProps.id]);\n\n const [itemReferences, setItemReferences] = useState({});\n const [dndDraggingItem, setDndDraggingItem] = useState('');\n\n const registerReference = useCallback(\n (itemId: string, ref: React.MutableRefObject<DSToolbarItemT.RenderHTMLElementT>) => {\n setItemReferences((prevItemReferences) => ({ ...prevItemReferences, [itemId]: ref }));\n },\n [setItemReferences],\n );\n\n const ctx = useMemo(\n () => ({ toolbarUid, registerReference, itemReferences, dndDraggingItem, setDndDraggingItem }),\n [dndDraggingItem, itemReferences, registerReference, toolbarUid],\n );\n\n return (\n <DSToolbarV2Context.Provider value={ctx}>\n <StyledToolbarWrapper\n role=\"toolbar\"\n data-testid=\"ds-toolbar-wrapper\"\n id={toolbarUid}\n alignItems=\"center\"\n justifyContent={alignment === 'left' ? 'flex-start' : 'flex-end'}\n withDepth={withDepth}\n gutter=\"xxs2\"\n compact={compact}\n ref={innerRef}\n {...globalsProps}\n >\n {children}\n </StyledToolbarWrapper>\n </DSToolbarV2Context.Provider>\n );\n};\n\nDSToolbarV2.propTypes = DSToolbarV2Schema;\n\nDSToolbarV2.displayName = DSToolbarName;\nconst DSToolbarV2WithSchema = describe(DSToolbarV2).description('Toolbar');\nDSToolbarV2WithSchema.propTypes = DSToolbarV2Schema;\n\nexport { DSToolbarV2, DSToolbarV2WithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2CjB;AA1CN,mBAAsD;AACtD,8BAKO;AACP,iBAAoB;AACpB,oBAAqB;AACrB,gCAAmC;AACnC,mCAAgD;AAChD,oBAAqC;AAErC,kCAA8B;AAC9B,MAAM,cAAqD,CAAC,UAAU;AACpE,QAAM,wBAAoB,sDAAuD,OAAO,yCAAY;AAEpG,8DAA+B,mBAAmB,gDAAmB,yCAAa;AAElF,QAAM,EAAE,WAAW,WAAW,SAAS,UAAU,SAAS,IAAI;AAE9D,QAAM,mBAAe,wBAAK,gDAAuB,iBAAiB,GAAG,CAAC,QAAQ,QAAQ,MAAM,CAAC;AAE7F,QAAM,iBAAa,sBAAQ,MAAM,aAAa,MAAM,kBAAc,gBAAI,KAAK,CAAC,aAAa,EAAE,CAAC;AAE5F,QAAM,CAAC,gBAAgB,iBAAiB,QAAI,uBAAS,CAAC,CAAC;AACvD,QAAM,CAAC,iBAAiB,kBAAkB,QAAI,uBAAS,EAAE;AAEzD,QAAM,wBAAoB;AAAA,IACxB,CAAC,QAAgB,QAAmE;AAClF,wBAAkB,CAAC,wBAAwB,EAAE,GAAG,oBAAoB,CAAC,MAAM,GAAG,IAAI,EAAE;AAAA,IACtF;AAAA,IACA,CAAC,iBAAiB;AAAA,EACpB;AAEA,QAAM,UAAM;AAAA,IACV,OAAO,EAAE,YAAY,mBAAmB,gBAAgB,iBAAiB,mBAAmB;AAAA,IAC5F,CAAC,iBAAiB,gBAAgB,mBAAmB,UAAU;AAAA,EACjE;AAEA,SACE,4CAAC,6CAAmB,UAAnB,EAA4B,OAAO,KAClC;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,eAAY;AAAA,MACZ,IAAI;AAAA,MACJ,YAAW;AAAA,MACX,gBAAgB,cAAc,SAAS,eAAe;AAAA,MACtD;AAAA,MACA,QAAO;AAAA,MACP;AAAA,MACA,KAAK;AAAA,MACJ,GAAG;AAAA,MAEH;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,YAAY,YAAY;AAExB,YAAY,cAAc;AAC1B,MAAM,4BAAwB,kCAAS,WAAW,EAAE,YAAY,SAAS;AACzE,sBAAsB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var DSToolbarV2Context_exports = {};
|
|
30
|
+
__export(DSToolbarV2Context_exports, {
|
|
31
|
+
DSToolbarV2Context: () => DSToolbarV2Context
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(DSToolbarV2Context_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
const DSToolbarV2Context = (0, import_react.createContext)({
|
|
37
|
+
registerReference: () => null,
|
|
38
|
+
itemReferences: {},
|
|
39
|
+
toolbarUid: "",
|
|
40
|
+
dndDraggingItem: "",
|
|
41
|
+
setDndDraggingItem: () => {
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=DSToolbarV2Context.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSToolbarV2Context.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import type { MutableRefObject } from 'react';\nimport { createContext } from 'react';\nimport { type DSToolbarItemT } from './react-desc-prop-types.js';\ninterface IDSToolbarV2Context {\n registerReference: (uid: string, ref: React.MutableRefObject<DSToolbarItemT.RenderHTMLElementT>) => void;\n itemReferences: Record<string, MutableRefObject<HTMLElement | null>>;\n toolbarUid: string;\n dndDraggingItem: string;\n setDndDraggingItem: React.Dispatch<React.SetStateAction<string>>;\n}\nexport const DSToolbarV2Context = createContext<IDSToolbarV2Context>({\n registerReference: () => null,\n itemReferences: {},\n toolbarUid: '',\n dndDraggingItem: '',\n setDndDraggingItem: () => {},\n});\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA8B;AASvB,MAAM,yBAAqB,4BAAmC;AAAA,EACnE,mBAAmB,MAAM;AAAA,EACzB,gBAAgB,CAAC;AAAA,EACjB,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,oBAAoB,MAAM;AAAA,EAAC;AAC7B,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
+
mod
|
|
24
|
+
));
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var src_exports = {};
|
|
27
|
+
module.exports = __toCommonJS(src_exports);
|
|
28
|
+
var React = __toESM(require("react"));
|
|
29
|
+
__reExport(src_exports, require("./DSToolbarV2.js"), module.exports);
|
|
30
|
+
__reExport(src_exports, require("./DSToolbarItemV2.js"), module.exports);
|
|
31
|
+
__reExport(src_exports, require("./DSToolbarSeparatorV2.js"), module.exports);
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export * from './DSToolbarV2.js';\nexport * from './DSToolbarItemV2.js';\nexport * from './DSToolbarSeparatorV2.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc,6BAAd;AACA,wBAAc,iCADd;AAEA,wBAAc,sCAFd;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var react_desc_prop_types_exports = {};
|
|
30
|
+
__export(react_desc_prop_types_exports, {
|
|
31
|
+
DSToolbarItemV2PropTypes: () => DSToolbarItemV2PropTypes,
|
|
32
|
+
DSToolbarItemV2Schema: () => DSToolbarItemV2Schema,
|
|
33
|
+
DSToolbarPropTypes: () => DSToolbarPropTypes,
|
|
34
|
+
DSToolbarV2Schema: () => DSToolbarV2Schema,
|
|
35
|
+
defaultItemProps: () => defaultItemProps,
|
|
36
|
+
defaultProps: () => defaultProps
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
39
|
+
var React = __toESM(require("react"));
|
|
40
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
42
|
+
const defaultItemProps = {
|
|
43
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}),
|
|
44
|
+
isFirstItem: false
|
|
45
|
+
};
|
|
46
|
+
const defaultProps = {
|
|
47
|
+
alignment: "right",
|
|
48
|
+
withDepth: true,
|
|
49
|
+
compact: false
|
|
50
|
+
};
|
|
51
|
+
const DSToolbarPropTypes = {
|
|
52
|
+
...import_ds_props_helpers.xstyledPropTypes,
|
|
53
|
+
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
54
|
+
alignment: import_ds_props_helpers.PropTypes.oneOf(["right", "left"]).description("Whether to align the content left or right").defaultValue("right"),
|
|
55
|
+
withDepth: import_ds_props_helpers.PropTypes.bool.description("Whether to add a box-shadow to the container").defaultValue(true),
|
|
56
|
+
compact: import_ds_props_helpers.PropTypes.bool.description("Whether you want the compact version of the toolbar").defaultValue(false),
|
|
57
|
+
innerRef: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.func, import_ds_props_helpers.PropTypes.object]).description("Reference to attach to the wrapper")
|
|
58
|
+
};
|
|
59
|
+
const DSToolbarV2Schema = DSToolbarPropTypes;
|
|
60
|
+
const DSToolbarItemV2PropTypes = {
|
|
61
|
+
...import_ds_props_helpers.xstyledPropTypes,
|
|
62
|
+
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
63
|
+
render: import_ds_props_helpers.PropTypes.func.isRequired.description("render function").defaultValue(() => {
|
|
64
|
+
}),
|
|
65
|
+
isFirstItem: import_ds_props_helpers.PropTypes.bool.description(
|
|
66
|
+
"If true the item will have tab index 0 to be the first element focusable by keyboard on the page load"
|
|
67
|
+
).defaultValue(false)
|
|
68
|
+
};
|
|
69
|
+
const DSToolbarItemV2Schema = DSToolbarPropTypes;
|
|
70
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react-desc-prop-types.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import {\n globalAttributesPropTypes,\n xstyledPropTypes,\n PropTypes,\n type GlobalAttributesT,\n type XstyledProps,\n type DSPropTypesSchema,\n} from '@elliemae/ds-props-helpers';\nimport { type WeakValidationMap } from 'react';\n\nexport declare namespace DSToolbarT {\n export interface DefaultProps {\n alignment: 'left' | 'right';\n withDepth: boolean;\n compact: boolean;\n }\n\n export interface OptionalProps {\n innerRef?: React.MutableRefObject<HTMLDivElement>;\n children?: React.ReactNode;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps>,\n XstyledProps {}\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps>,\n XstyledProps {}\n}\n\nexport declare namespace DSToolbarItemT {\n export type RenderHTMLElementT =\n | HTMLElement\n | HTMLButtonElement\n | HTMLInputElement\n | HTMLTextAreaElement\n | HTMLSelectElement\n | HTMLOptionElement\n | null;\n\n export interface Props {\n render: <T>(props: { innerRef: React.MutableRefObject<T>; tabIndex: number }) => JSX.Element;\n isFirstItem?: boolean;\n }\n}\n\nexport const defaultItemProps: DSToolbarItemT.Props = {\n render: () => <></>,\n isFirstItem: false,\n};\n\nexport const defaultProps: DSToolbarT.DefaultProps = {\n alignment: 'right',\n withDepth: true,\n compact: false,\n};\n\nexport const DSToolbarPropTypes: DSPropTypesSchema<DSToolbarT.Props> = {\n ...xstyledPropTypes,\n ...globalAttributesPropTypes,\n alignment: PropTypes.oneOf(['right', 'left'])\n .description('Whether to align the content left or right')\n .defaultValue('right'),\n withDepth: PropTypes.bool.description('Whether to add a box-shadow to the container').defaultValue(true),\n compact: PropTypes.bool.description('Whether you want the compact version of the toolbar').defaultValue(false),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Reference to attach to the wrapper'),\n};\n\nexport const DSToolbarV2Schema = DSToolbarPropTypes as unknown as WeakValidationMap<DSToolbarT.Props>;\n\nexport const DSToolbarItemV2PropTypes = {\n ...xstyledPropTypes,\n ...globalAttributesPropTypes,\n render: PropTypes.func.isRequired.description('render function').defaultValue(() => {}),\n isFirstItem: PropTypes.bool\n .description(\n 'If true the item will have tab index 0 to be the first element focusable by keyboard on the page load',\n )\n .defaultValue(false),\n};\n\nexport const DSToolbarItemV2Schema = DSToolbarPropTypes as unknown as WeakValidationMap<DSToolbarItemT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmDP;AAnDhB,8BAOO;AA2CA,MAAM,mBAAyC;AAAA,EACpD,QAAQ,MAAM,2EAAE;AAAA,EAChB,aAAa;AACf;AAEO,MAAM,eAAwC;AAAA,EACnD,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AACX;AAEO,MAAM,qBAA0D;AAAA,EACrE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,WAAW,kCAAU,MAAM,CAAC,SAAS,MAAM,CAAC,EACzC,YAAY,4CAA4C,EACxD,aAAa,OAAO;AAAA,EACvB,WAAW,kCAAU,KAAK,YAAY,8CAA8C,EAAE,aAAa,IAAI;AAAA,EACvG,SAAS,kCAAU,KAAK,YAAY,qDAAqD,EAAE,aAAa,KAAK;AAAA,EAC7G,UAAU,kCAAU,UAAU,CAAC,kCAAU,MAAM,kCAAU,MAAM,CAAC,EAAE,YAAY,oCAAoC;AACpH;AAEO,MAAM,oBAAoB;AAE1B,MAAM,2BAA2B;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,QAAQ,kCAAU,KAAK,WAAW,YAAY,iBAAiB,EAAE,aAAa,MAAM;AAAA,EAAC,CAAC;AAAA,EACtF,aAAa,kCAAU,KACpB;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AACvB;AAEO,MAAM,wBAAwB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var styled_exports = {};
|
|
30
|
+
__export(styled_exports, {
|
|
31
|
+
StyledSeparator: () => StyledSeparator,
|
|
32
|
+
StyledToolbarItem: () => StyledToolbarItem,
|
|
33
|
+
StyledToolbarWrapper: () => StyledToolbarWrapper
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(styled_exports);
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
38
|
+
var import_ds_grid = __toESM(require("@elliemae/ds-grid"));
|
|
39
|
+
const StyledToolbarWrapper = (0, import_ds_system.styled)(import_ds_grid.default)`
|
|
40
|
+
background-color: ${(props) => props.theme.colors.neutral["000"]};
|
|
41
|
+
|
|
42
|
+
min-height: ${(props) => props.compact ? "28px" : "36px"};
|
|
43
|
+
max-height: ${(props) => props.theme.space.xxl};
|
|
44
|
+
|
|
45
|
+
padding: 0 ${(props) => props.theme.space.xxs};
|
|
46
|
+
grid-auto-flow: column;
|
|
47
|
+
box-shadow: ${(props) => !props.withDepth ? "none" : "0 1px 5px 0 rgb(0 0 0 / 13%), 0 2px 4px 0 rgb(0 0 0 / 20%)"};
|
|
48
|
+
`;
|
|
49
|
+
const StyledToolbarItem = (0, import_ds_system.styled)(import_ds_grid.default)``;
|
|
50
|
+
const StyledSeparator = (0, import_ds_system.styled)(import_ds_grid.default)`
|
|
51
|
+
height: 30px;
|
|
52
|
+
width: 1px;
|
|
53
|
+
background-color: ${(props) => props.theme.colors.neutral[200]};
|
|
54
|
+
`;
|
|
55
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/styled.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { styled } from '@elliemae/ds-system';\nimport Grid from '@elliemae/ds-grid';\n\nexport const StyledToolbarWrapper = styled(Grid)<{ compact: boolean; withDepth: boolean }>`\n background-color: ${(props) => props.theme.colors.neutral['000']};\n\n min-height: ${(props) => (props.compact ? '28px' : '36px')};\n max-height: ${(props) => props.theme.space.xxl};\n\n padding: 0 ${(props) => props.theme.space.xxs};\n grid-auto-flow: column;\n box-shadow: ${(props) => (!props.withDepth ? 'none' : '0 1px 5px 0 rgb(0 0 0 / 13%), 0 2px 4px 0 rgb(0 0 0 / 20%)')};\n`;\n\nexport const StyledToolbarItem = styled(Grid)``;\n\nexport const StyledSeparator = styled(Grid)`\n height: 30px;\n width: 1px;\n background-color: ${(props) => props.theme.colors.neutral[200]};\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AACvB,qBAAiB;AAEV,MAAM,2BAAuB,yBAAO,eAAAA,OAAI;AAAA,sBACzB,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,KAAK;AAAA;AAAA,gBAEjD,CAAC,UAAW,MAAM,UAAU,SAAS;AAAA,gBACrC,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA,eAE9B,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA,gBAE5B,CAAC,UAAW,CAAC,MAAM,YAAY,SAAS;AAAA;AAGjD,MAAM,wBAAoB,yBAAO,eAAAA,OAAI;AAErC,MAAM,sBAAkB,yBAAO,eAAAA,OAAI;AAAA;AAAA;AAAA,sBAGpB,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,GAAG;AAAA;",
|
|
6
|
+
"names": ["Grid"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useToolbarItemHandlers_exports = {};
|
|
30
|
+
__export(useToolbarItemHandlers_exports, {
|
|
31
|
+
useToolbarItemHandlers: () => useToolbarItemHandlers
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useToolbarItemHandlers_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_DSToolbarV2Context = require("./DSToolbarV2Context.js");
|
|
37
|
+
const findInCircularList = (list, from, criteria, step = 1) => {
|
|
38
|
+
for (let i = (from + step + list.length) % list.length; i !== from && from > -1; i = (i + step + list.length) % list.length) {
|
|
39
|
+
if (criteria(list[i]))
|
|
40
|
+
return i;
|
|
41
|
+
}
|
|
42
|
+
return from;
|
|
43
|
+
};
|
|
44
|
+
const useToolbarItemHandlers = (toolbarItemId) => {
|
|
45
|
+
const { toolbarUid, itemReferences, setDndDraggingItem } = (0, import_react.useContext)(import_DSToolbarV2Context.DSToolbarV2Context);
|
|
46
|
+
const onFocus = (0, import_react.useCallback)(() => {
|
|
47
|
+
setDndDraggingItem(toolbarItemId);
|
|
48
|
+
}, [setDndDraggingItem, toolbarItemId]);
|
|
49
|
+
const onKeyDown = (0, import_react.useCallback)(
|
|
50
|
+
(e) => {
|
|
51
|
+
const toolbarItems = [...document.querySelectorAll(`#${toolbarUid} .ds-toolbar-item`)];
|
|
52
|
+
let nextToolbarItemIndex = -1;
|
|
53
|
+
const toolbarItemIndex = toolbarItems.findIndex((domElem) => domElem.id === toolbarItemId);
|
|
54
|
+
const criteria = (item) => {
|
|
55
|
+
const ref = itemReferences[item.id];
|
|
56
|
+
return !ref.current?.getAttribute("disabled");
|
|
57
|
+
};
|
|
58
|
+
if (["ArrowLeft", "ArrowRight"].includes(e.code)) {
|
|
59
|
+
nextToolbarItemIndex = findInCircularList(
|
|
60
|
+
toolbarItems,
|
|
61
|
+
toolbarItemIndex,
|
|
62
|
+
criteria,
|
|
63
|
+
e.code === "ArrowLeft" ? -1 : 1
|
|
64
|
+
);
|
|
65
|
+
} else if (e.code === "Home") {
|
|
66
|
+
nextToolbarItemIndex = 0;
|
|
67
|
+
} else if (e.code === "End") {
|
|
68
|
+
nextToolbarItemIndex = toolbarItems.length - 1;
|
|
69
|
+
}
|
|
70
|
+
if (nextToolbarItemIndex >= 0 && nextToolbarItemIndex < toolbarItems.length) {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
e.stopPropagation();
|
|
73
|
+
const ref = itemReferences[toolbarItems[nextToolbarItemIndex].id];
|
|
74
|
+
if (ref.current)
|
|
75
|
+
ref.current.focus();
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
[toolbarUid, toolbarItemId, itemReferences]
|
|
79
|
+
);
|
|
80
|
+
return { onKeyDown, onFocus };
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=useToolbarItemHandlers.js.map
|