@elliemae/ds-button-v2 3.12.0-rc.5
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/DSButtonV2.js +73 -0
- package/dist/cjs/DSButtonV2.js.map +7 -0
- package/dist/cjs/DSButtonV2Definitions.js +40 -0
- package/dist/cjs/DSButtonV2Definitions.js.map +7 -0
- package/dist/cjs/config/useButtonRenderer.js +46 -0
- package/dist/cjs/config/useButtonRenderer.js.map +7 -0
- package/dist/cjs/config/useButtonV2.js +100 -0
- package/dist/cjs/config/useButtonV2.js.map +7 -0
- package/dist/cjs/config/useValidateProps.js +36 -0
- package/dist/cjs/config/useValidateProps.js.map +7 -0
- package/dist/cjs/constants.js +73 -0
- package/dist/cjs/constants.js.map +7 -0
- package/dist/cjs/index.js +37 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +62 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/sharedTypes.js +24 -0
- package/dist/cjs/sharedTypes.js.map +7 -0
- package/dist/cjs/styles.js +213 -0
- package/dist/cjs/styles.js.map +7 -0
- package/dist/esm/DSButtonV2.js +47 -0
- package/dist/esm/DSButtonV2.js.map +7 -0
- package/dist/esm/DSButtonV2Definitions.js +14 -0
- package/dist/esm/DSButtonV2Definitions.js.map +7 -0
- package/dist/esm/config/useButtonRenderer.js +20 -0
- package/dist/esm/config/useButtonRenderer.js.map +7 -0
- package/dist/esm/config/useButtonV2.js +74 -0
- package/dist/esm/config/useButtonV2.js.map +7 -0
- package/dist/esm/config/useValidateProps.js +10 -0
- package/dist/esm/config/useValidateProps.js.map +7 -0
- package/dist/esm/constants.js +47 -0
- package/dist/esm/constants.js.map +7 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +48 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/sharedTypes.js +2 -0
- package/dist/esm/sharedTypes.js.map +7 -0
- package/dist/esm/styles.js +187 -0
- package/dist/esm/styles.js.map +7 -0
- package/package.json +94 -0
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var DSButtonV2_exports = {};
|
|
26
|
+
__export(DSButtonV2_exports, {
|
|
27
|
+
DSButtonV2: () => DSButtonV2,
|
|
28
|
+
DSButtonV2WithSchema: () => DSButtonV2WithSchema
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(DSButtonV2_exports);
|
|
31
|
+
var React = __toESM(require("react"));
|
|
32
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
34
|
+
var import_useButtonV2 = require("./config/useButtonV2");
|
|
35
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types");
|
|
36
|
+
var import_DSButtonV2Definitions = require("./DSButtonV2Definitions");
|
|
37
|
+
const DSButtonV2 = (props) => {
|
|
38
|
+
const {
|
|
39
|
+
propsWithDefault,
|
|
40
|
+
tabIndex,
|
|
41
|
+
handleOnMouseDown,
|
|
42
|
+
globalProps,
|
|
43
|
+
xstyledProps,
|
|
44
|
+
handleOnKeyDown,
|
|
45
|
+
handleOnClick,
|
|
46
|
+
ButtonRenderer
|
|
47
|
+
} = (0, import_useButtonV2.useButtonV2)(props);
|
|
48
|
+
const { size, buttonType, innerRef, children, type, shape } = propsWithDefault;
|
|
49
|
+
const { disabled, ...restGlobalProps } = globalProps;
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
|
+
ButtonRenderer,
|
|
52
|
+
{
|
|
53
|
+
"aria-disabled": disabled ? "true" : false,
|
|
54
|
+
...restGlobalProps,
|
|
55
|
+
...xstyledProps,
|
|
56
|
+
shape,
|
|
57
|
+
type,
|
|
58
|
+
buttonType,
|
|
59
|
+
tabIndex,
|
|
60
|
+
size,
|
|
61
|
+
ref: innerRef,
|
|
62
|
+
onKeyDown: handleOnKeyDown,
|
|
63
|
+
onClick: handleOnClick,
|
|
64
|
+
onMouseDown: handleOnMouseDown,
|
|
65
|
+
children
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
DSButtonV2.propTypes = import_react_desc_prop_types.DSButtonPropTypes;
|
|
70
|
+
DSButtonV2.displayName = import_DSButtonV2Definitions.DSButtonV2Name;
|
|
71
|
+
const DSButtonV2WithSchema = (0, import_ds_utilities.describe)(DSButtonV2);
|
|
72
|
+
DSButtonV2WithSchema.propTypes = import_react_desc_prop_types.DSButtonPropTypes;
|
|
73
|
+
//# sourceMappingURL=DSButtonV2.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSButtonV2.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { useButtonV2 } from './config/useButtonV2';\nimport type { DSButtonT } from './react-desc-prop-types';\nimport { DSButtonPropTypes } from './react-desc-prop-types';\nimport { DSButtonV2Name } from './DSButtonV2Definitions';\n\nconst DSButtonV2: React.ComponentType<DSButtonT.Props> = (props) => {\n const {\n propsWithDefault,\n tabIndex,\n handleOnMouseDown,\n globalProps,\n xstyledProps,\n handleOnKeyDown,\n handleOnClick,\n ButtonRenderer,\n } = useButtonV2(props);\n const { size, buttonType, innerRef, children, type, shape } = propsWithDefault;\n const { disabled, ...restGlobalProps } = globalProps;\n return (\n <ButtonRenderer\n aria-disabled={disabled ? 'true' : false}\n {...restGlobalProps}\n {...xstyledProps}\n shape={shape}\n type={type}\n buttonType={buttonType}\n tabIndex={tabIndex}\n size={size}\n ref={innerRef}\n onKeyDown={handleOnKeyDown}\n onClick={handleOnClick}\n onMouseDown={handleOnMouseDown}\n >\n {children}\n </ButtonRenderer>\n );\n};\n\nDSButtonV2.propTypes = DSButtonPropTypes;\nDSButtonV2.displayName = DSButtonV2Name;\nconst DSButtonV2WithSchema = describe(DSButtonV2);\nDSButtonV2WithSchema.propTypes = DSButtonPropTypes;\n\nexport { DSButtonV2, DSButtonV2WithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADqBnB;AApBJ,0BAAyB;AACzB,yBAA4B;AAE5B,mCAAkC;AAClC,mCAA+B;AAE/B,MAAM,aAAmD,CAAC,UAAU;AAClE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,gCAAY,KAAK;AACrB,QAAM,EAAE,MAAM,YAAY,UAAU,UAAU,MAAM,MAAM,IAAI;AAC9D,QAAM,EAAE,aAAa,gBAAgB,IAAI;AACzC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,iBAAe,WAAW,SAAS;AAAA,MAClC,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,KAAK;AAAA,MACL,WAAW;AAAA,MACX,SAAS;AAAA,MACT,aAAa;AAAA,MAEZ;AAAA;AAAA,EACH;AAEJ;AAEA,WAAW,YAAY;AACvB,WAAW,cAAc;AACzB,MAAM,2BAAuB,8BAAS,UAAU;AAChD,qBAAqB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var DSButtonV2Definitions_exports = {};
|
|
26
|
+
__export(DSButtonV2Definitions_exports, {
|
|
27
|
+
DSButtonV2DataTestId: () => DSButtonV2DataTestId,
|
|
28
|
+
DSButtonV2Name: () => DSButtonV2Name,
|
|
29
|
+
DSButtonV2Slots: () => DSButtonV2Slots
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(DSButtonV2Definitions_exports);
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
const DSButtonV2Name = "DSButtonV2";
|
|
34
|
+
const DSButtonV2DataTestId = {
|
|
35
|
+
ROOT: "ds-button"
|
|
36
|
+
};
|
|
37
|
+
const DSButtonV2Slots = {
|
|
38
|
+
ROOT: "root"
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=DSButtonV2Definitions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSButtonV2Definitions.ts", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const DSButtonV2Name = 'DSButtonV2';\n\nexport const DSButtonV2DataTestId = {\n ROOT: 'ds-button',\n};\nexport const DSButtonV2Slots = {\n ROOT: 'root',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,iBAAiB;AAEvB,MAAM,uBAAuB;AAAA,EAClC,MAAM;AACR;AACO,MAAM,kBAAkB;AAAA,EAC7B,MAAM;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var useButtonRenderer_exports = {};
|
|
26
|
+
__export(useButtonRenderer_exports, {
|
|
27
|
+
useButtonRenderer: () => useButtonRenderer
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(useButtonRenderer_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_react = __toESM(require("react"));
|
|
32
|
+
var import_styles = require("../styles");
|
|
33
|
+
const buttonMap = {
|
|
34
|
+
filled: import_styles.FilledButton,
|
|
35
|
+
iconFilled: import_styles.FilledButton,
|
|
36
|
+
outline: import_styles.OutlineButton,
|
|
37
|
+
iconOutline: import_styles.OutlineButton,
|
|
38
|
+
text: import_styles.TextButton,
|
|
39
|
+
icon: import_styles.TextButton,
|
|
40
|
+
raw: import_styles.RawButton
|
|
41
|
+
};
|
|
42
|
+
const useButtonRenderer = (propsWithDefault) => {
|
|
43
|
+
const { buttonType } = propsWithDefault;
|
|
44
|
+
return import_react.default.useMemo(() => buttonMap[buttonType] || import_styles.DefaultButton, [buttonType]);
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=useButtonRenderer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/useButtonRenderer.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport type { DSButtonT } from '../react-desc-prop-types';\nimport { DefaultButton, RawButton, FilledButton, OutlineButton, TextButton } from '../styles';\n\nconst buttonMap = {\n filled: FilledButton,\n iconFilled: FilledButton,\n outline: OutlineButton,\n iconOutline: OutlineButton,\n text: TextButton,\n icon: TextButton,\n raw: RawButton,\n} as const;\n\nexport const useButtonRenderer = (propsWithDefault: DSButtonT.InternalProps) => {\n const { buttonType } = propsWithDefault;\n return React.useMemo(() => buttonMap[buttonType] || DefaultButton, [buttonType]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAElB,oBAAkF;AAElF,MAAM,YAAY;AAAA,EAChB,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,KAAK;AACP;AAEO,MAAM,oBAAoB,CAAC,qBAA8C;AAC9E,QAAM,EAAE,WAAW,IAAI;AACvB,SAAO,aAAAA,QAAM,QAAQ,MAAM,UAAU,eAAe,6BAAe,CAAC,UAAU,CAAC;AACjF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var useButtonV2_exports = {};
|
|
26
|
+
__export(useButtonV2_exports, {
|
|
27
|
+
useButtonV2: () => useButtonV2
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(useButtonV2_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_react = __toESM(require("react"));
|
|
32
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
33
|
+
var import_react_desc_prop_types = require("../react-desc-prop-types");
|
|
34
|
+
var import_useValidateProps = require("./useValidateProps");
|
|
35
|
+
var import_useButtonRenderer = require("./useButtonRenderer");
|
|
36
|
+
const useButtonV2 = (props) => {
|
|
37
|
+
const propsWithDefault = (0, import_ds_utilities.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultProps);
|
|
38
|
+
(0, import_useValidateProps.useValidateProps)(props, import_react_desc_prop_types.DSButtonPropTypes);
|
|
39
|
+
const globalProps = (0, import_ds_utilities.useGetGlobalAttributes)(propsWithDefault);
|
|
40
|
+
const xstyledProps = (0, import_ds_utilities.useGetXstyledProps)(propsWithDefault);
|
|
41
|
+
const { disabled } = globalProps;
|
|
42
|
+
const ButtonRenderer = (0, import_useButtonRenderer.useButtonRenderer)(propsWithDefault);
|
|
43
|
+
const { onKeyDown, onClick, onMouseDown } = propsWithDefault;
|
|
44
|
+
const handleOnKeyDown = import_react.default.useCallback(
|
|
45
|
+
(e) => {
|
|
46
|
+
if (disabled || !onKeyDown) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
onKeyDown?.(e);
|
|
50
|
+
const { key } = e;
|
|
51
|
+
if (["Space", " ", "Enter"].includes(key)) {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
onClick(e);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
[disabled, onClick, onKeyDown]
|
|
57
|
+
);
|
|
58
|
+
const handleOnClick = import_react.default.useCallback(
|
|
59
|
+
(e) => {
|
|
60
|
+
if (!disabled && onClick) {
|
|
61
|
+
onClick(e);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
[disabled, onClick]
|
|
65
|
+
);
|
|
66
|
+
const handleOnMouseDown = import_react.default.useCallback(
|
|
67
|
+
(e) => {
|
|
68
|
+
if (disabled) {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
onMouseDown?.(e);
|
|
73
|
+
},
|
|
74
|
+
[disabled, onMouseDown]
|
|
75
|
+
);
|
|
76
|
+
const tabIndex = globalProps.disabled ? -1 : globalProps.tabIndex;
|
|
77
|
+
return import_react.default.useMemo(
|
|
78
|
+
() => ({
|
|
79
|
+
propsWithDefault,
|
|
80
|
+
globalProps,
|
|
81
|
+
xstyledProps,
|
|
82
|
+
ButtonRenderer,
|
|
83
|
+
handleOnKeyDown,
|
|
84
|
+
handleOnClick,
|
|
85
|
+
tabIndex,
|
|
86
|
+
handleOnMouseDown
|
|
87
|
+
}),
|
|
88
|
+
[
|
|
89
|
+
propsWithDefault,
|
|
90
|
+
globalProps,
|
|
91
|
+
xstyledProps,
|
|
92
|
+
ButtonRenderer,
|
|
93
|
+
handleOnKeyDown,
|
|
94
|
+
handleOnClick,
|
|
95
|
+
tabIndex,
|
|
96
|
+
handleOnMouseDown
|
|
97
|
+
]
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=useButtonV2.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/useButtonV2.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-utilities';\nimport type { DSButtonT } from '../react-desc-prop-types';\nimport { defaultProps, DSButtonPropTypes } from '../react-desc-prop-types';\nimport { useValidateProps } from './useValidateProps';\nimport { useButtonRenderer } from './useButtonRenderer';\n\nexport interface ButtonV2Configuration {\n propsWithDefault: DSButtonT.InternalProps;\n globalProps: ReturnType<typeof useGetGlobalAttributes>;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n ButtonRenderer: ReturnType<typeof useButtonRenderer>;\n handleOnKeyDown: React.KeyboardEventHandler<HTMLButtonElement>;\n tabIndex: boolean;\n handleOnClick: React.MouseEventHandler<HTMLButtonElement>;\n handleOnMouseDown: React.MouseEventHandler<HTMLButtonElement>;\n}\n\nexport const useButtonV2 = (props: DSButtonT.Props): ButtonV2Configuration => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSButtonT.InternalProps>(props, defaultProps);\n useValidateProps(props, DSButtonPropTypes);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const globalProps = useGetGlobalAttributes<DSButtonT.InternalProps, HTMLButtonElement>(propsWithDefault);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n const { disabled } = globalProps;\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n const ButtonRenderer = useButtonRenderer(propsWithDefault);\n const { onKeyDown, onClick, onMouseDown } = propsWithDefault;\n\n const handleOnKeyDown: React.KeyboardEventHandler<HTMLButtonElement> = React.useCallback(\n (e) => {\n if (disabled || !onKeyDown) {\n return;\n }\n\n onKeyDown?.(e);\n const { key } = e;\n if (['Space', ' ', 'Enter'].includes(key)) {\n e.preventDefault();\n onClick(e);\n }\n },\n [disabled, onClick, onKeyDown],\n );\n\n const handleOnClick: React.MouseEventHandler<HTMLButtonElement> = React.useCallback(\n (e) => {\n if (!disabled && onClick) {\n onClick(e);\n }\n },\n [disabled, onClick],\n );\n\n const handleOnMouseDown: React.MouseEventHandler<HTMLButtonElement> = React.useCallback(\n (e) => {\n if (disabled) {\n e.preventDefault();\n return;\n }\n onMouseDown?.(e);\n },\n [disabled, onMouseDown],\n );\n\n const tabIndex = globalProps.disabled ? -1 : globalProps.tabIndex;\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalProps,\n xstyledProps,\n ButtonRenderer,\n handleOnKeyDown,\n handleOnClick,\n tabIndex,\n handleOnMouseDown,\n }),\n [\n propsWithDefault,\n globalProps,\n xstyledProps,\n ButtonRenderer,\n handleOnKeyDown,\n handleOnClick,\n tabIndex,\n handleOnMouseDown,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,0BAAyF;AAEzF,mCAAgD;AAChD,8BAAiC;AACjC,+BAAkC;AAa3B,MAAM,cAAc,CAAC,UAAkD;AAI5E,QAAM,uBAAmB,kDAAsD,OAAO,yCAAY;AAClG,gDAAiB,OAAO,8CAAiB;AAIzC,QAAM,kBAAc,4CAAmE,gBAAgB;AACvG,QAAM,mBAAe,wCAAmB,gBAAgB;AACxD,QAAM,EAAE,SAAS,IAAI;AAIrB,QAAM,qBAAiB,4CAAkB,gBAAgB;AACzD,QAAM,EAAE,WAAW,SAAS,YAAY,IAAI;AAE5C,QAAM,kBAAiE,aAAAA,QAAM;AAAA,IAC3E,CAAC,MAAM;AACL,UAAI,YAAY,CAAC,WAAW;AAC1B;AAAA,MACF;AAEA,kBAAY,CAAC;AACb,YAAM,EAAE,IAAI,IAAI;AAChB,UAAI,CAAC,SAAS,KAAK,OAAO,EAAE,SAAS,GAAG,GAAG;AACzC,UAAE,eAAe;AACjB,gBAAQ,CAAC;AAAA,MACX;AAAA,IACF;AAAA,IACA,CAAC,UAAU,SAAS,SAAS;AAAA,EAC/B;AAEA,QAAM,gBAA4D,aAAAA,QAAM;AAAA,IACtE,CAAC,MAAM;AACL,UAAI,CAAC,YAAY,SAAS;AACxB,gBAAQ,CAAC;AAAA,MACX;AAAA,IACF;AAAA,IACA,CAAC,UAAU,OAAO;AAAA,EACpB;AAEA,QAAM,oBAAgE,aAAAA,QAAM;AAAA,IAC1E,CAAC,MAAM;AACL,UAAI,UAAU;AACZ,UAAE,eAAe;AACjB;AAAA,MACF;AACA,oBAAc,CAAC;AAAA,IACjB;AAAA,IACA,CAAC,UAAU,WAAW;AAAA,EACxB;AAEA,QAAM,WAAW,YAAY,WAAW,KAAK,YAAY;AAEzD,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var useValidateProps_exports = {};
|
|
26
|
+
__export(useValidateProps_exports, {
|
|
27
|
+
useValidateProps: () => useValidateProps
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(useValidateProps_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
32
|
+
var import_DSButtonV2Definitions = require("../DSButtonV2Definitions");
|
|
33
|
+
const useValidateProps = (props, propTypes) => {
|
|
34
|
+
(0, import_ds_utilities.useValidateTypescriptPropTypes)(props, propTypes, import_DSButtonV2Definitions.DSButtonV2Name);
|
|
35
|
+
};
|
|
36
|
+
//# 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 { useValidateTypescriptPropTypes } from '@elliemae/ds-utilities';\nimport type { WeakValidationMap } from 'react';\nimport { DSButtonV2Name } from '../DSButtonV2Definitions';\nimport type { DSButtonT } from '../react-desc-prop-types';\n\nexport const useValidateProps = (props: DSButtonT.Props, propTypes: WeakValidationMap<unknown>): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSButtonV2Name);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA+C;AAE/C,mCAA+B;AAGxB,MAAM,mBAAmB,CAAC,OAAwB,cAAgD;AAEvG,0DAA+B,OAAO,WAAW,2CAAc;AACjE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var constants_exports = {};
|
|
26
|
+
__export(constants_exports, {
|
|
27
|
+
BUTTON_SHAPES: () => BUTTON_SHAPES,
|
|
28
|
+
BUTTON_SIZES: () => BUTTON_SIZES,
|
|
29
|
+
BUTTON_TYPES: () => BUTTON_TYPES,
|
|
30
|
+
ButtonInteractionStates: () => ButtonInteractionStates,
|
|
31
|
+
ButtonInteractionStatesValuesString: () => ButtonInteractionStatesValuesString,
|
|
32
|
+
ButtonShapesValuesArray: () => ButtonShapesValuesArray,
|
|
33
|
+
ButtonShapesValuesString: () => ButtonShapesValuesString,
|
|
34
|
+
ButtonSizesValuesArray: () => ButtonSizesValuesArray,
|
|
35
|
+
ButtonSizesValuesString: () => ButtonSizesValuesString,
|
|
36
|
+
ButtonTypesValuesArray: () => ButtonTypesValuesArray,
|
|
37
|
+
ButtonTypesValuesString: () => ButtonTypesValuesString,
|
|
38
|
+
sizes: () => sizes
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(constants_exports);
|
|
41
|
+
var React = __toESM(require("react"));
|
|
42
|
+
const BUTTON_TYPES = {
|
|
43
|
+
FILLED: "filled",
|
|
44
|
+
OUTLINE: "outline",
|
|
45
|
+
TEXT: "text",
|
|
46
|
+
ICON: "icon",
|
|
47
|
+
ICON_FILLED: "iconFilled",
|
|
48
|
+
ICON_OUTLINE: "iconOutline",
|
|
49
|
+
RAW: "raw"
|
|
50
|
+
};
|
|
51
|
+
const BUTTON_SHAPES = {
|
|
52
|
+
DEFAULT: "default",
|
|
53
|
+
ROUND: "round"
|
|
54
|
+
};
|
|
55
|
+
const BUTTON_SIZES = {
|
|
56
|
+
S: "s",
|
|
57
|
+
M: "m",
|
|
58
|
+
L: "l"
|
|
59
|
+
};
|
|
60
|
+
const sizes = {
|
|
61
|
+
s: "20px",
|
|
62
|
+
m: "28px",
|
|
63
|
+
l: "40px"
|
|
64
|
+
};
|
|
65
|
+
const ButtonTypesValuesArray = Object.values(BUTTON_TYPES);
|
|
66
|
+
const ButtonSizesValuesArray = Object.values(BUTTON_SIZES);
|
|
67
|
+
const ButtonShapesValuesArray = Object.values(BUTTON_SHAPES);
|
|
68
|
+
const ButtonInteractionStates = ["hover", "focus", "active"];
|
|
69
|
+
const ButtonTypesValuesString = JSON.stringify(ButtonTypesValuesArray);
|
|
70
|
+
const ButtonSizesValuesString = JSON.stringify(ButtonSizesValuesArray);
|
|
71
|
+
const ButtonShapesValuesString = JSON.stringify(ButtonShapesValuesArray);
|
|
72
|
+
const ButtonInteractionStatesValuesString = JSON.stringify(ButtonInteractionStates);
|
|
73
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/constants.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const BUTTON_TYPES = {\n FILLED: 'filled',\n OUTLINE: 'outline',\n TEXT: 'text',\n ICON: 'icon',\n ICON_FILLED: 'iconFilled',\n ICON_OUTLINE: 'iconOutline',\n RAW: 'raw',\n} as const;\n\nexport const BUTTON_SHAPES = {\n DEFAULT: 'default',\n ROUND: 'round',\n} as const;\n\nexport const BUTTON_SIZES = {\n S: 's',\n M: 'm',\n L: 'l',\n} as const;\n\nexport const sizes = {\n s: '20px',\n m: '28px',\n l: '40px',\n} as const;\n\nexport const ButtonTypesValuesArray = Object.values(BUTTON_TYPES);\nexport const ButtonSizesValuesArray = Object.values(BUTTON_SIZES);\nexport const ButtonShapesValuesArray = Object.values(BUTTON_SHAPES);\nexport const ButtonInteractionStates = ['hover', 'focus', 'active'];\n\nexport const ButtonTypesValuesString = JSON.stringify(ButtonTypesValuesArray);\nexport const ButtonSizesValuesString = JSON.stringify(ButtonSizesValuesArray);\nexport const ButtonShapesValuesString = JSON.stringify(ButtonShapesValuesArray);\nexport const ButtonInteractionStatesValuesString = JSON.stringify(ButtonInteractionStates);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,eAAe;AAAA,EAC1B,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,aAAa;AAAA,EACb,cAAc;AAAA,EACd,KAAK;AACP;AAEO,MAAM,gBAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,OAAO;AACT;AAEO,MAAM,eAAe;AAAA,EAC1B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,QAAQ;AAAA,EACnB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,yBAAyB,OAAO,OAAO,YAAY;AACzD,MAAM,yBAAyB,OAAO,OAAO,YAAY;AACzD,MAAM,0BAA0B,OAAO,OAAO,aAAa;AAC3D,MAAM,0BAA0B,CAAC,SAAS,SAAS,QAAQ;AAE3D,MAAM,0BAA0B,KAAK,UAAU,sBAAsB;AACrE,MAAM,0BAA0B,KAAK,UAAU,sBAAsB;AACrE,MAAM,2BAA2B,KAAK,UAAU,uBAAuB;AACvE,MAAM,sCAAsC,KAAK,UAAU,uBAAuB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var src_exports = {};
|
|
26
|
+
__export(src_exports, {
|
|
27
|
+
BUTTON_SHAPES: () => import_constants.BUTTON_SHAPES,
|
|
28
|
+
BUTTON_SIZES: () => import_constants.BUTTON_SIZES,
|
|
29
|
+
BUTTON_TYPES: () => import_constants.BUTTON_TYPES,
|
|
30
|
+
DSButtonV2: () => import_DSButtonV2.DSButtonV2,
|
|
31
|
+
DSButtonV2WithSchema: () => import_DSButtonV2.DSButtonV2WithSchema
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(src_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_DSButtonV2 = require("./DSButtonV2");
|
|
36
|
+
var import_constants = require("./constants");
|
|
37
|
+
//# 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 { DSButtonV2, DSButtonV2WithSchema } from './DSButtonV2';\nexport { BUTTON_SIZES, BUTTON_TYPES, BUTTON_SHAPES } from './constants';\nexport type { DSButtonT } from './react-desc-prop-types';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAiD;AACjD,uBAA0D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var react_desc_prop_types_exports = {};
|
|
26
|
+
__export(react_desc_prop_types_exports, {
|
|
27
|
+
DSButtonPropTypes: () => DSButtonPropTypes,
|
|
28
|
+
defaultProps: () => defaultProps
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
31
|
+
var React = __toESM(require("react"));
|
|
32
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
33
|
+
var import_constants = require("./constants");
|
|
34
|
+
var import_DSButtonV2Definitions = require("./DSButtonV2Definitions");
|
|
35
|
+
const defaultProps = {
|
|
36
|
+
size: import_constants.BUTTON_SIZES.M,
|
|
37
|
+
buttonType: import_constants.BUTTON_TYPES.FILLED,
|
|
38
|
+
shape: import_constants.BUTTON_SHAPES.DEFAULT,
|
|
39
|
+
"data-testid": import_DSButtonV2Definitions.DSButtonV2DataTestId.ROOT,
|
|
40
|
+
type: "button",
|
|
41
|
+
onClick: () => {
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const DSButtonPropTypes = {
|
|
45
|
+
...import_ds_utilities.globalAttributesPropTypes,
|
|
46
|
+
...import_ds_utilities.xstyledPropTypes,
|
|
47
|
+
children: import_ds_utilities.PropTypes.oneOfType([import_ds_utilities.PropTypes.node, import_ds_utilities.PropTypes.arrayOf(import_ds_utilities.PropTypes.node)]).description(
|
|
48
|
+
"String, Number and/or Dimsum Icon"
|
|
49
|
+
).isRequired,
|
|
50
|
+
buttonType: import_ds_utilities.PropTypes.oneOf(import_constants.ButtonTypesValuesArray).description(import_constants.ButtonTypesValuesString).defaultValue(import_constants.BUTTON_TYPES.FILLED),
|
|
51
|
+
shape: import_ds_utilities.PropTypes.oneOf(import_constants.ButtonShapesValuesArray).description(import_constants.ButtonShapesValuesString).defaultValue(import_constants.BUTTON_SHAPES.DEFAULT),
|
|
52
|
+
type: import_ds_utilities.PropTypes.string.description('html "type" props').defaultValue("button"),
|
|
53
|
+
size: import_ds_utilities.PropTypes.oneOf(import_constants.ButtonSizesValuesArray).description(import_constants.ButtonSizesValuesString).defaultValue(import_constants.BUTTON_SIZES.M),
|
|
54
|
+
onClick: import_ds_utilities.PropTypes.func.description('function executed when the button is activated (via keyboard "space" or enter OR via mouse)').signature("(( e: React.SyntheticEvent ) => void )").defaultValue(() => {
|
|
55
|
+
}),
|
|
56
|
+
innerRef: import_ds_utilities.PropTypes.oneOfType([import_ds_utilities.PropTypes.object, import_ds_utilities.PropTypes.func]).description("Inner ref to button component."),
|
|
57
|
+
"data-testid": import_ds_utilities.PropTypes.string.description("root element data-testid").defaultValue(import_DSButtonV2Definitions.DSButtonV2DataTestId.ROOT),
|
|
58
|
+
"data-testemulatestate": import_ds_utilities.PropTypes.oneOf(import_constants.ButtonInteractionStates).description(
|
|
59
|
+
`Emulates button states. Useful for e2e tests. ${import_constants.ButtonInteractionStatesValuesString}`
|
|
60
|
+
)
|
|
61
|
+
};
|
|
62
|
+
//# 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": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { RefCallback, WeakValidationMap } from 'react';\nimport type React from 'react';\nimport type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-utilities';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-utilities';\nimport {\n BUTTON_SIZES,\n BUTTON_TYPES,\n BUTTON_SHAPES,\n ButtonSizesValuesArray,\n ButtonInteractionStates,\n ButtonSizesValuesString,\n ButtonInteractionStatesValuesString,\n ButtonTypesValuesArray,\n ButtonTypesValuesString,\n ButtonShapesValuesArray,\n ButtonShapesValuesString,\n} from './constants';\nimport { DSButtonV2DataTestId } from './DSButtonV2Definitions';\nimport type { ButtonSizesT, ButtonTypesT, ButtonShapesT } from './sharedTypes';\n\nexport const defaultProps: DSButtonT.DefaultProps = {\n size: BUTTON_SIZES.M,\n buttonType: BUTTON_TYPES.FILLED,\n shape: BUTTON_SHAPES.DEFAULT,\n 'data-testid': DSButtonV2DataTestId.ROOT,\n type: 'button',\n onClick: () => {},\n};\n\nexport declare namespace DSButtonT {\n type HTMLButtonTypeProp = GlobalAttributesT<HTMLButtonElement>['type'];\n\n export interface DefaultProps {\n 'data-testid': string;\n size: ButtonSizesT;\n type: HTMLButtonTypeProp;\n buttonType: ButtonTypesT;\n onClick: (e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => void;\n shape: ButtonShapesT;\n }\n export interface OptionalProps {\n innerRef?: React.RefObject<HTMLButtonElement> | RefCallback<HTMLButtonElement>;\n }\n export interface RequiredProps {\n children: React.ReactNode;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const DSButtonPropTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]).description(\n 'String, Number and/or Dimsum Icon',\n ).isRequired,\n buttonType: PropTypes.oneOf(ButtonTypesValuesArray)\n .description(ButtonTypesValuesString)\n .defaultValue(BUTTON_TYPES.FILLED),\n shape: PropTypes.oneOf(ButtonShapesValuesArray)\n .description(ButtonShapesValuesString)\n .defaultValue(BUTTON_SHAPES.DEFAULT),\n type: PropTypes.string.description('html \"type\" props').defaultValue('button'),\n size: PropTypes.oneOf(ButtonSizesValuesArray).description(ButtonSizesValuesString).defaultValue(BUTTON_SIZES.M),\n onClick: PropTypes.func\n .description('function executed when the button is activated (via keyboard \"space\" or enter OR via mouse)')\n .signature('(( e: React.SyntheticEvent ) => void )')\n .defaultValue(() => {}),\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Inner ref to button component.'),\n\n 'data-testid': PropTypes.string.description('root element data-testid').defaultValue(DSButtonV2DataTestId.ROOT),\n 'data-testemulatestate': PropTypes.oneOf(ButtonInteractionStates).description(\n `Emulates button states. Useful for e2e tests. ${ButtonInteractionStatesValuesString}`,\n ),\n} as WeakValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,0BAAuE;AACvE,uBAYO;AACP,mCAAqC;AAG9B,MAAM,eAAuC;AAAA,EAClD,MAAM,8BAAa;AAAA,EACnB,YAAY,8BAAa;AAAA,EACzB,OAAO,+BAAc;AAAA,EACrB,eAAe,kDAAqB;AAAA,EACpC,MAAM;AAAA,EACN,SAAS,MAAM;AAAA,EAAC;AAClB;AAmCO,MAAM,oBAAoB;AAAA,EAC/B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,UAAU,8BAAU,UAAU,CAAC,8BAAU,MAAM,8BAAU,QAAQ,8BAAU,IAAI,CAAC,CAAC,EAAE;AAAA,IACjF;AAAA,EACF,EAAE;AAAA,EACF,YAAY,8BAAU,MAAM,uCAAsB,EAC/C,YAAY,wCAAuB,EACnC,aAAa,8BAAa,MAAM;AAAA,EACnC,OAAO,8BAAU,MAAM,wCAAuB,EAC3C,YAAY,yCAAwB,EACpC,aAAa,+BAAc,OAAO;AAAA,EACrC,MAAM,8BAAU,OAAO,YAAY,mBAAmB,EAAE,aAAa,QAAQ;AAAA,EAC7E,MAAM,8BAAU,MAAM,uCAAsB,EAAE,YAAY,wCAAuB,EAAE,aAAa,8BAAa,CAAC;AAAA,EAC9G,SAAS,8BAAU,KAChB,YAAY,6FAA6F,EACzG,UAAU,wCAAwC,EAClD,aAAa,MAAM;AAAA,EAAC,CAAC;AAAA,EACxB,UAAU,8BAAU,UAAU,CAAC,8BAAU,QAAQ,8BAAU,IAAI,CAAC,EAAE,YAAY,gCAAgC;AAAA,EAE9G,eAAe,8BAAU,OAAO,YAAY,0BAA0B,EAAE,aAAa,kDAAqB,IAAI;AAAA,EAC9G,yBAAyB,8BAAU,MAAM,wCAAuB,EAAE;AAAA,IAChE,iDAAiD;AAAA,EACnD;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
18
|
+
mod
|
|
19
|
+
));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var sharedTypes_exports = {};
|
|
22
|
+
module.exports = __toCommonJS(sharedTypes_exports);
|
|
23
|
+
var React = __toESM(require("react"));
|
|
24
|
+
//# sourceMappingURL=sharedTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/sharedTypes.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import type { BUTTON_SIZES, BUTTON_TYPES, BUTTON_SHAPES, ButtonInteractionStates } from './constants';\n\nexport type ButtonSizesT = typeof BUTTON_SIZES[keyof typeof BUTTON_SIZES];\n\nexport type ButtonTypesT = typeof BUTTON_TYPES[keyof typeof BUTTON_TYPES];\n\nexport type ButtonShapesT = typeof BUTTON_SHAPES[keyof typeof BUTTON_SHAPES];\n\nexport type ButtonInteractionStatesT = typeof ButtonInteractionStates[number];\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|