@elliemae/ds-toolbar-v2 3.45.1 → 3.46.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/react-desc-prop-types.js.map +1 -1
- package/dist/cjs/typescript-testing/typescript-toolbar-v2-valid.js +80 -0
- package/dist/cjs/typescript-testing/typescript-toolbar-v2-valid.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js.map +1 -1
- package/dist/esm/typescript-testing/typescript-toolbar-v2-valid.js +57 -0
- package/dist/esm/typescript-testing/typescript-toolbar-v2-valid.js.map +7 -0
- package/dist/types/react-desc-prop-types.d.ts +1 -1
- package/dist/types/typescript-testing/typescript-toolbar-v2-valid.d.ts +1 -0
- package/package.json +8 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 type ValidationMap,\n} from '@elliemae/ds-props-helpers';\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 type AnyRef<T> = React.MutableRefObject<T | null> | ((_ref: T | null) => void);\n\n export type RenderHTMLElementT =\n | HTMLElement\n | HTMLButtonElement\n | HTMLInputElement\n | HTMLTextAreaElement\n | HTMLSelectElement\n | HTMLOptionElement\n | null;\n\n export type RendererProps<T extends HTMLElement> = { innerRef: AnyRef<T>; tabIndex: 0 | -1 };\n\n export interface Props<T extends HTMLElement = HTMLElement | HTMLButtonElement> {\n render: React.ComponentType<RendererProps<T>>;\n isFirstItem?: boolean;\n }\n}\n\nexport const defaultItemProps: DSToolbarItemT.Props<HTMLElement> = {\n render: () => <div></div>,\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 ValidationMap<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 ValidationMap<DSToolbarItemT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
4
|
+
"sourcesContent": ["import {\n globalAttributesPropTypes,\n xstyledPropTypes,\n PropTypes,\n type GlobalAttributesT,\n type XstyledProps,\n type DSPropTypesSchema,\n type ValidationMap,\n} from '@elliemae/ds-props-helpers';\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 | null>;\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 type AnyRef<T> = React.MutableRefObject<T | null> | ((_ref: T | null) => void);\n\n export type RenderHTMLElementT =\n | HTMLElement\n | HTMLButtonElement\n | HTMLInputElement\n | HTMLTextAreaElement\n | HTMLSelectElement\n | HTMLOptionElement\n | null;\n\n export type RendererProps<T extends HTMLElement> = { innerRef: AnyRef<T>; tabIndex: 0 | -1 };\n\n export interface Props<T extends HTMLElement = HTMLElement | HTMLButtonElement> {\n render: React.ComponentType<RendererProps<T>>;\n isFirstItem?: boolean;\n }\n}\n\nexport const defaultItemProps: DSToolbarItemT.Props<HTMLElement> = {\n render: () => <div></div>,\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 ValidationMap<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 ValidationMap<DSToolbarItemT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADuDP;AAvDhB,8BAQO;AA8CA,MAAM,mBAAsD;AAAA,EACjE,QAAQ,MAAM,4CAAC,SAAI;AAAA,EACnB,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var React = __toESM(require("react"));
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import__ = require("../index.js");
|
|
27
|
+
const testOptionalProps = {
|
|
28
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {})
|
|
29
|
+
};
|
|
30
|
+
const testPartialDefaults = {
|
|
31
|
+
alignment: "left",
|
|
32
|
+
withDepth: false,
|
|
33
|
+
compact: false
|
|
34
|
+
};
|
|
35
|
+
const testProps = {
|
|
36
|
+
...testOptionalProps,
|
|
37
|
+
...testPartialDefaults
|
|
38
|
+
};
|
|
39
|
+
const testPropsAsSyntax = {
|
|
40
|
+
...testOptionalProps,
|
|
41
|
+
...testPartialDefaults
|
|
42
|
+
};
|
|
43
|
+
const testCompleteDefaults = {
|
|
44
|
+
alignment: "left",
|
|
45
|
+
withDepth: false,
|
|
46
|
+
compact: false
|
|
47
|
+
};
|
|
48
|
+
const testInternalProps = {
|
|
49
|
+
...testOptionalProps,
|
|
50
|
+
...testCompleteDefaults
|
|
51
|
+
};
|
|
52
|
+
const testInternalPropsAsSyntax = {
|
|
53
|
+
...testOptionalProps,
|
|
54
|
+
...testCompleteDefaults
|
|
55
|
+
};
|
|
56
|
+
const testExplicitDefinition = {
|
|
57
|
+
alignment: "left",
|
|
58
|
+
withDepth: false,
|
|
59
|
+
compact: false,
|
|
60
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {})
|
|
61
|
+
};
|
|
62
|
+
const testInferedTypeCompatibility = {
|
|
63
|
+
alignment: "left",
|
|
64
|
+
withDepth: false,
|
|
65
|
+
compact: false,
|
|
66
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {})
|
|
67
|
+
};
|
|
68
|
+
const testDefinitionAsConst = {
|
|
69
|
+
alignment: "left",
|
|
70
|
+
withDepth: false,
|
|
71
|
+
compact: false,
|
|
72
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {})
|
|
73
|
+
};
|
|
74
|
+
const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSToolbarV2, { ...testExplicitDefinition }),
|
|
76
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSToolbarV2, { ...testInferedTypeCompatibility }),
|
|
77
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSToolbarV2, { ...testDefinitionAsConst }),
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSToolbarV2, { alignment: "left", withDepth: false, compact: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {}) })
|
|
79
|
+
] });
|
|
80
|
+
//# sourceMappingURL=typescript-toolbar-v2-valid.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-toolbar-v2-valid.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSToolbarV2 } from '../index.js';\nimport type { DSToolbarT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSToolbarT.Props;\ntype ComponentPropsInternals = DSToolbarT.InternalProps;\ntype ComponentPropsDefaultProps = DSToolbarT.DefaultProps;\ntype ComponentPropsOptionalProps = DSToolbarT.OptionalProps;\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n children: <div />,\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n alignment: 'left',\n withDepth: false,\n compact: false,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n alignment: 'left',\n withDepth: false,\n compact: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n alignment: 'left',\n withDepth: false,\n compact: false,\n children: <div />,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n alignment: 'left',\n withDepth: false,\n compact: false,\n children: <div />,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n alignment: 'left',\n withDepth: false,\n compact: false,\n children: <div />,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSToolbarV2 {...testExplicitDefinition} />\n <DSToolbarV2 {...testInferedTypeCompatibility} />\n <DSToolbarV2 {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSToolbarV2 alignment=\"left\" withDepth={false} compact={false}>\n <div />\n </DSToolbarV2>\n </>\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACYX;AAVZ,eAA4B;AAS5B,MAAM,oBAAiD;AAAA,EACrD,UAAU,4CAAC,SAAI;AACjB;AAIA,MAAM,sBAA2D;AAAA,EAC/D,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AACX;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AACX;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AAAA,EACT,UAAU,4CAAC,SAAI;AACjB;AAGA,MAAM,+BAA+B;AAAA,EACnC,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AAAA,EACT,UAAU,4CAAC,SAAI;AACjB;AAEA,MAAM,wBAAwB;AAAA,EAC5B,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AAAA,EACT,UAAU,4CAAC,SAAI;AACjB;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,wBAAa,GAAG,wBAAwB;AAAA,EACzC,4CAAC,wBAAa,GAAG,8BAA8B;AAAA,EAC/C,4CAAC,wBAAa,GAAG,uBAAuB;AAAA,EAExC,4CAAC,wBAAY,WAAU,QAAO,WAAW,OAAO,SAAS,OACvD,sDAAC,SAAI,GACP;AAAA,GACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import {\n globalAttributesPropTypes,\n xstyledPropTypes,\n PropTypes,\n type GlobalAttributesT,\n type XstyledProps,\n type DSPropTypesSchema,\n type ValidationMap,\n} from '@elliemae/ds-props-helpers';\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 type AnyRef<T> = React.MutableRefObject<T | null> | ((_ref: T | null) => void);\n\n export type RenderHTMLElementT =\n | HTMLElement\n | HTMLButtonElement\n | HTMLInputElement\n | HTMLTextAreaElement\n | HTMLSelectElement\n | HTMLOptionElement\n | null;\n\n export type RendererProps<T extends HTMLElement> = { innerRef: AnyRef<T>; tabIndex: 0 | -1 };\n\n export interface Props<T extends HTMLElement = HTMLElement | HTMLButtonElement> {\n render: React.ComponentType<RendererProps<T>>;\n isFirstItem?: boolean;\n }\n}\n\nexport const defaultItemProps: DSToolbarItemT.Props<HTMLElement> = {\n render: () => <div></div>,\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 ValidationMap<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 ValidationMap<DSToolbarItemT.Props>;\n"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import {\n globalAttributesPropTypes,\n xstyledPropTypes,\n PropTypes,\n type GlobalAttributesT,\n type XstyledProps,\n type DSPropTypesSchema,\n type ValidationMap,\n} from '@elliemae/ds-props-helpers';\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 | null>;\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 type AnyRef<T> = React.MutableRefObject<T | null> | ((_ref: T | null) => void);\n\n export type RenderHTMLElementT =\n | HTMLElement\n | HTMLButtonElement\n | HTMLInputElement\n | HTMLTextAreaElement\n | HTMLSelectElement\n | HTMLOptionElement\n | null;\n\n export type RendererProps<T extends HTMLElement> = { innerRef: AnyRef<T>; tabIndex: 0 | -1 };\n\n export interface Props<T extends HTMLElement = HTMLElement | HTMLButtonElement> {\n render: React.ComponentType<RendererProps<T>>;\n isFirstItem?: boolean;\n }\n}\n\nexport const defaultItemProps: DSToolbarItemT.Props<HTMLElement> = {\n render: () => <div></div>,\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 ValidationMap<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 ValidationMap<DSToolbarItemT.Props>;\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACuDP;AAvDhB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AA8CA,MAAM,mBAAsD;AAAA,EACjE,QAAQ,MAAM,oBAAC,SAAI;AAAA,EACnB,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,UAAU,MAAM,CAAC,SAAS,MAAM,CAAC,EACzC,YAAY,4CAA4C,EACxD,aAAa,OAAO;AAAA,EACvB,WAAW,UAAU,KAAK,YAAY,8CAA8C,EAAE,aAAa,IAAI;AAAA,EACvG,SAAS,UAAU,KAAK,YAAY,qDAAqD,EAAE,aAAa,KAAK;AAAA,EAC7G,UAAU,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,CAAC,EAAE,YAAY,oCAAoC;AACpH;AAEO,MAAM,oBAAoB;AAE1B,MAAM,2BAA2B;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,QAAQ,UAAU,KAAK,WAAW,YAAY,iBAAiB,EAAE,aAAa,MAAM;AAAA,EAAC,CAAC;AAAA,EACtF,aAAa,UAAU,KACpB;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AACvB;AAEO,MAAM,wBAAwB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { DSToolbarV2 } from "../index.js";
|
|
4
|
+
const testOptionalProps = {
|
|
5
|
+
children: /* @__PURE__ */ jsx("div", {})
|
|
6
|
+
};
|
|
7
|
+
const testPartialDefaults = {
|
|
8
|
+
alignment: "left",
|
|
9
|
+
withDepth: false,
|
|
10
|
+
compact: false
|
|
11
|
+
};
|
|
12
|
+
const testProps = {
|
|
13
|
+
...testOptionalProps,
|
|
14
|
+
...testPartialDefaults
|
|
15
|
+
};
|
|
16
|
+
const testPropsAsSyntax = {
|
|
17
|
+
...testOptionalProps,
|
|
18
|
+
...testPartialDefaults
|
|
19
|
+
};
|
|
20
|
+
const testCompleteDefaults = {
|
|
21
|
+
alignment: "left",
|
|
22
|
+
withDepth: false,
|
|
23
|
+
compact: false
|
|
24
|
+
};
|
|
25
|
+
const testInternalProps = {
|
|
26
|
+
...testOptionalProps,
|
|
27
|
+
...testCompleteDefaults
|
|
28
|
+
};
|
|
29
|
+
const testInternalPropsAsSyntax = {
|
|
30
|
+
...testOptionalProps,
|
|
31
|
+
...testCompleteDefaults
|
|
32
|
+
};
|
|
33
|
+
const testExplicitDefinition = {
|
|
34
|
+
alignment: "left",
|
|
35
|
+
withDepth: false,
|
|
36
|
+
compact: false,
|
|
37
|
+
children: /* @__PURE__ */ jsx("div", {})
|
|
38
|
+
};
|
|
39
|
+
const testInferedTypeCompatibility = {
|
|
40
|
+
alignment: "left",
|
|
41
|
+
withDepth: false,
|
|
42
|
+
compact: false,
|
|
43
|
+
children: /* @__PURE__ */ jsx("div", {})
|
|
44
|
+
};
|
|
45
|
+
const testDefinitionAsConst = {
|
|
46
|
+
alignment: "left",
|
|
47
|
+
withDepth: false,
|
|
48
|
+
compact: false,
|
|
49
|
+
children: /* @__PURE__ */ jsx("div", {})
|
|
50
|
+
};
|
|
51
|
+
const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
52
|
+
/* @__PURE__ */ jsx(DSToolbarV2, { ...testExplicitDefinition }),
|
|
53
|
+
/* @__PURE__ */ jsx(DSToolbarV2, { ...testInferedTypeCompatibility }),
|
|
54
|
+
/* @__PURE__ */ jsx(DSToolbarV2, { ...testDefinitionAsConst }),
|
|
55
|
+
/* @__PURE__ */ jsx(DSToolbarV2, { alignment: "left", withDepth: false, compact: false, children: /* @__PURE__ */ jsx("div", {}) })
|
|
56
|
+
] });
|
|
57
|
+
//# sourceMappingURL=typescript-toolbar-v2-valid.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-toolbar-v2-valid.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSToolbarV2 } from '../index.js';\nimport type { DSToolbarT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSToolbarT.Props;\ntype ComponentPropsInternals = DSToolbarT.InternalProps;\ntype ComponentPropsDefaultProps = DSToolbarT.DefaultProps;\ntype ComponentPropsOptionalProps = DSToolbarT.OptionalProps;\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n children: <div />,\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n alignment: 'left',\n withDepth: false,\n compact: false,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n alignment: 'left',\n withDepth: false,\n compact: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n alignment: 'left',\n withDepth: false,\n compact: false,\n children: <div />,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n alignment: 'left',\n withDepth: false,\n compact: false,\n children: <div />,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n alignment: 'left',\n withDepth: false,\n compact: false,\n children: <div />,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSToolbarV2 {...testExplicitDefinition} />\n <DSToolbarV2 {...testInferedTypeCompatibility} />\n <DSToolbarV2 {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSToolbarV2 alignment=\"left\" withDepth={false} compact={false}>\n <div />\n </DSToolbarV2>\n </>\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACYX,SA8DV,UA9DU,KA8DV,YA9DU;AAVZ,SAAS,mBAAmB;AAS5B,MAAM,oBAAiD;AAAA,EACrD,UAAU,oBAAC,SAAI;AACjB;AAIA,MAAM,sBAA2D;AAAA,EAC/D,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AACX;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AACX;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AAAA,EACT,UAAU,oBAAC,SAAI;AACjB;AAGA,MAAM,+BAA+B;AAAA,EACnC,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AAAA,EACT,UAAU,oBAAC,SAAI;AACjB;AAEA,MAAM,wBAAwB;AAAA,EAC5B,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AAAA,EACT,UAAU,oBAAC,SAAI;AACjB;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,eAAa,GAAG,wBAAwB;AAAA,EACzC,oBAAC,eAAa,GAAG,8BAA8B;AAAA,EAC/C,oBAAC,eAAa,GAAG,uBAAuB;AAAA,EAExC,oBAAC,eAAY,WAAU,QAAO,WAAW,OAAO,SAAS,OACvD,8BAAC,SAAI,GACP;AAAA,GACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -7,7 +7,7 @@ export declare namespace DSToolbarT {
|
|
|
7
7
|
compact: boolean;
|
|
8
8
|
}
|
|
9
9
|
interface OptionalProps {
|
|
10
|
-
innerRef?: React.MutableRefObject<HTMLDivElement>;
|
|
10
|
+
innerRef?: React.MutableRefObject<HTMLDivElement | null>;
|
|
11
11
|
children?: React.ReactNode;
|
|
12
12
|
}
|
|
13
13
|
interface Props extends Partial<DefaultProps>, OptionalProps, Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps>, XstyledProps {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-toolbar-v2",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.46.0-rc.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Toolbar V2",
|
|
6
6
|
"files": [
|
|
@@ -90,16 +90,16 @@
|
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"prop-types": "~15.8.1",
|
|
92
92
|
"uid": "2.0.1",
|
|
93
|
-
"@elliemae/ds-button-v2": "3.
|
|
94
|
-
"@elliemae/ds-grid": "3.
|
|
95
|
-
"@elliemae/ds-icons": "3.
|
|
96
|
-
"@elliemae/ds-props-helpers": "3.
|
|
97
|
-
"@elliemae/ds-system": "3.
|
|
93
|
+
"@elliemae/ds-button-v2": "3.46.0-rc.0",
|
|
94
|
+
"@elliemae/ds-grid": "3.46.0-rc.0",
|
|
95
|
+
"@elliemae/ds-icons": "3.46.0-rc.0",
|
|
96
|
+
"@elliemae/ds-props-helpers": "3.46.0-rc.0",
|
|
97
|
+
"@elliemae/ds-system": "3.46.0-rc.0"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
100
|
"@elliemae/pui-cli": "9.0.0-next.50",
|
|
101
101
|
"styled-components": "~5.3.9",
|
|
102
|
-
"@elliemae/ds-monorepo-devops": "3.
|
|
102
|
+
"@elliemae/ds-monorepo-devops": "3.46.0-rc.0"
|
|
103
103
|
},
|
|
104
104
|
"peerDependencies": {
|
|
105
105
|
"lodash": "^4.17.21",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
},
|
|
110
110
|
"publishConfig": {
|
|
111
111
|
"access": "public",
|
|
112
|
-
"typeSafety":
|
|
112
|
+
"typeSafety": true
|
|
113
113
|
},
|
|
114
114
|
"scripts": {
|
|
115
115
|
"dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
|