@elliemae/ds-button-v1 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.
@@ -0,0 +1,147 @@
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 DSButton_exports = {};
26
+ __export(DSButton_exports, {
27
+ DSButton: () => DSButton,
28
+ DSButtonWithSchema: () => DSButtonWithSchema,
29
+ default: () => DSButton_default
30
+ });
31
+ module.exports = __toCommonJS(DSButton_exports);
32
+ var React = __toESM(require("react"));
33
+ var import_jsx_runtime = require("react/jsx-runtime");
34
+ var import_react = require("react");
35
+ var import_ds_classnames = require("@elliemae/ds-classnames");
36
+ var import_ds_utilities = require("@elliemae/ds-utilities");
37
+ var import_constants = require("./constants");
38
+ var import_propTypes = require("./propTypes");
39
+ var import_defaultProps = require("./defaultProps");
40
+ const blockName = "button";
41
+ const getContainer = (Element) => (0, import_ds_classnames.aggregatedClasses)(Element)(
42
+ blockName,
43
+ null,
44
+ ({ iconOnly, variant }) => ({
45
+ "icon-only": iconOnly,
46
+ [variant]: variant
47
+ }),
48
+ {
49
+ propsToRemoveFromFinalElement: ["cx"]
50
+ }
51
+ );
52
+ const DSButton = ({
53
+ innerRef,
54
+ disabled,
55
+ buttonType,
56
+ fluidWidth,
57
+ size,
58
+ labelText,
59
+ icon,
60
+ onBlur,
61
+ onClick,
62
+ onKeyPress,
63
+ leftIcon,
64
+ tabIndex,
65
+ variant,
66
+ intent,
67
+ containerProps,
68
+ className,
69
+ as: Component,
70
+ type,
71
+ ...rest
72
+ }) => {
73
+ const [pressed, setPressed] = (0, import_react.useState)(false);
74
+ const Button = (0, import_react.useMemo)(() => getContainer(Component), [Component]);
75
+ const intentBlockName = `${blockName}${intent ? `-${intent}` : ""}`;
76
+ const { cssClassName: intentClassName } = (0, import_ds_classnames.convertPropToCssClassName)(intentBlockName);
77
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
78
+ Button,
79
+ {
80
+ "data-testid": containerProps && containerProps["data-testid"] || "button-wrapper",
81
+ ...rest,
82
+ ...containerProps,
83
+ "aria-disabled": rest["aria-disabled"] !== void 0 ? rest["aria-disabled"] : disabled,
84
+ "aria-label": rest["aria-label"] || labelText || "button",
85
+ "aria-pressed": pressed,
86
+ className: (0, import_ds_utilities.cx)(intentClassName, className),
87
+ classProps: {
88
+ disabled,
89
+ buttonType: buttonType || import_constants.BUTTON_TYPE.PRIMARY,
90
+ size: size || import_constants.BUTTON_SIZE.M,
91
+ fluidWidth,
92
+ iconOnly: !labelText && (icon || leftIcon),
93
+ variant: disabled ? import_constants.BUTTON_VARIANT.DISABLED : variant
94
+ },
95
+ disabled,
96
+ innerRef,
97
+ onBlur: (e) => {
98
+ if (disabled)
99
+ return;
100
+ setPressed(false);
101
+ if (onBlur)
102
+ onBlur(e);
103
+ },
104
+ onClick: (e) => {
105
+ if (disabled)
106
+ return;
107
+ setPressed(true);
108
+ if (onClick)
109
+ onClick(e);
110
+ },
111
+ onKeyPress: (e) => {
112
+ if (disabled)
113
+ return;
114
+ e.preventDefault();
115
+ if (e.key === "Enter") {
116
+ setPressed(true);
117
+ if (onClick)
118
+ onClick(e);
119
+ }
120
+ if (onKeyPress)
121
+ onKeyPress(e);
122
+ },
123
+ tabIndex,
124
+ type,
125
+ children: [
126
+ leftIcon,
127
+ labelText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
128
+ "span",
129
+ {
130
+ className: `label-wrapper ${icon || leftIcon ? "with-icon" : "no-icon"}`,
131
+ "data-testid": "button-label",
132
+ role: "presentation",
133
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: labelText })
134
+ }
135
+ ),
136
+ icon
137
+ ]
138
+ }
139
+ );
140
+ };
141
+ DSButton.defaultProps = import_defaultProps.defaultProps;
142
+ DSButton.propTypes = import_propTypes.btnPropTypes;
143
+ DSButton.displayName = "DSButton";
144
+ const DSButtonWithSchema = (0, import_ds_utilities.describe)(DSButton);
145
+ DSButtonWithSchema.propTypes = import_propTypes.btnPropTypes;
146
+ var DSButton_default = DSButton;
147
+ //# sourceMappingURL=DSButton.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/DSButton.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable jest/valid-title */\nimport React, { useState, useMemo } from 'react';\nimport { aggregatedClasses, convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { cx, describe } from '@elliemae/ds-utilities';\nimport { BUTTON_TYPE, BUTTON_SIZE, BUTTON_VARIANT } from './constants';\nimport { btnPropTypes } from './propTypes';\nimport { defaultProps } from './defaultProps';\n\nconst blockName = 'button';\n\nconst getContainer = (Element) =>\n aggregatedClasses(Element)(\n blockName,\n null,\n ({ iconOnly, variant }) => ({\n 'icon-only': iconOnly,\n [variant]: variant,\n }),\n {\n propsToRemoveFromFinalElement: ['cx'],\n },\n );\n\ninterface ButtonPropsT {\n [x: string]: unknown;\n disabled?: boolean;\n fluidWidth?: boolean;\n innerRef?: unknown;\n buttonType?: typeof BUTTON_TYPE[keyof typeof BUTTON_TYPE];\n size?: typeof BUTTON_SIZE[keyof typeof BUTTON_SIZE];\n variant?: typeof BUTTON_VARIANT[keyof typeof BUTTON_VARIANT];\n labelText?: string;\n icon?: JSX.Element;\n leftIcon?: JSX.Element;\n tabIndex?: number;\n intent?: 'success' | 'danger' | 'warning' | 'info';\n containerProps?: { [x: string]: unknown };\n className?: string;\n as?: string | JSX.Element;\n type?: 'button' | 'text';\n onBlur?: React.FocusEventHandler<HTMLElement>;\n onClick?: (event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;\n onKeyPress?: React.KeyboardEventHandler<HTMLElement>;\n}\n\n// eslint-disable-next-line complexity\nconst DSButton = ({\n innerRef,\n disabled,\n buttonType,\n fluidWidth,\n size,\n labelText,\n icon,\n onBlur,\n onClick,\n onKeyPress,\n leftIcon,\n tabIndex,\n variant,\n intent,\n containerProps,\n className,\n as: Component,\n type,\n ...rest\n}: ButtonPropsT) => {\n const [pressed, setPressed] = useState(false);\n const Button = useMemo(() => getContainer(Component), [Component]);\n const intentBlockName = `${blockName}${intent ? `-${intent}` : ''}`;\n const { cssClassName: intentClassName } = convertPropToCssClassName(intentBlockName);\n return (\n <Button\n data-testid={(containerProps && containerProps['data-testid']) || 'button-wrapper'}\n {...rest}\n {...containerProps}\n aria-disabled={rest['aria-disabled'] !== undefined ? rest['aria-disabled'] : disabled}\n aria-label={rest['aria-label'] || labelText || 'button'}\n aria-pressed={pressed}\n className={cx(intentClassName, className)}\n classProps={{\n disabled,\n // DON'T CHANGE FOR defaultProps\n // using OR to keep ButtonGroup behavior at packages/ds-basic/src/ButtonGroup/DSButtonGroup\n buttonType: buttonType || BUTTON_TYPE.PRIMARY,\n // using or to keep ButtonGroup behavior at packages/ds-basic/src/ButtonGroup/DSButtonGroup\n size: size || BUTTON_SIZE.M,\n fluidWidth,\n iconOnly: !labelText && (icon || leftIcon),\n variant: disabled ? BUTTON_VARIANT.DISABLED : variant,\n }}\n disabled={disabled} // https://jira.elliemae.io/browse/PUI-1215\n innerRef={innerRef}\n onBlur={(e: React.FocusEvent<HTMLElement>) => {\n if (disabled) return;\n setPressed(false);\n if (onBlur) onBlur(e);\n }}\n onClick={(e: React.MouseEvent<HTMLElement>) => {\n if (disabled) return;\n setPressed(true);\n if (onClick) onClick(e);\n }}\n onKeyPress={(e: React.KeyboardEvent<HTMLElement>) => {\n if (disabled) return;\n e.preventDefault();\n if (e.key === 'Enter') {\n setPressed(true);\n if (onClick) onClick(e);\n }\n if (onKeyPress) onKeyPress(e);\n }}\n tabIndex={tabIndex}\n type={type}\n >\n {leftIcon}\n {labelText && (\n <span\n className={`label-wrapper ${icon || leftIcon ? 'with-icon' : 'no-icon'}`}\n data-testid=\"button-label\"\n role=\"presentation\"\n >\n <span>{labelText}</span>\n </span>\n )}\n {icon}\n </Button>\n );\n};\n\nDSButton.defaultProps = defaultProps;\nDSButton.propTypes = btnPropTypes;\nDSButton.displayName = 'DSButton';\n\nconst DSButtonWithSchema = describe(DSButton);\nDSButtonWithSchema.propTypes = btnPropTypes;\n\nexport { DSButton, DSButtonWithSchema };\nexport default DSButton;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADyEnB;AAvEJ,mBAAyC;AACzC,2BAA6D;AAC7D,0BAA6B;AAC7B,uBAAyD;AACzD,uBAA6B;AAC7B,0BAA6B;AAE7B,MAAM,YAAY;AAElB,MAAM,eAAe,CAAC,gBACpB,wCAAkB,OAAO;AAAA,EACvB;AAAA,EACA;AAAA,EACA,CAAC,EAAE,UAAU,QAAQ,OAAO;AAAA,IAC1B,aAAa;AAAA,IACb,CAAC,UAAU;AAAA,EACb;AAAA,EACA;AAAA,IACE,+BAA+B,CAAC,IAAI;AAAA,EACtC;AACF;AAyBF,MAAM,WAAW,CAAC;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,IAAI;AAAA,EACJ;AAAA,KACG;AACL,MAAoB;AAClB,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,KAAK;AAC5C,QAAM,aAAS,sBAAQ,MAAM,aAAa,SAAS,GAAG,CAAC,SAAS,CAAC;AACjE,QAAM,kBAAkB,GAAG,YAAY,SAAS,IAAI,WAAW;AAC/D,QAAM,EAAE,cAAc,gBAAgB,QAAI,gDAA0B,eAAe;AACnF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAc,kBAAkB,eAAe,kBAAmB;AAAA,MACjE,GAAG;AAAA,MACH,GAAG;AAAA,MACJ,iBAAe,KAAK,qBAAqB,SAAY,KAAK,mBAAmB;AAAA,MAC7E,cAAY,KAAK,iBAAiB,aAAa;AAAA,MAC/C,gBAAc;AAAA,MACd,eAAW,wBAAG,iBAAiB,SAAS;AAAA,MACxC,YAAY;AAAA,QACV;AAAA,QAGA,YAAY,cAAc,6BAAY;AAAA,QAEtC,MAAM,QAAQ,6BAAY;AAAA,QAC1B;AAAA,QACA,UAAU,CAAC,cAAc,QAAQ;AAAA,QACjC,SAAS,WAAW,gCAAe,WAAW;AAAA,MAChD;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ,CAAC,MAAqC;AAC5C,YAAI;AAAU;AACd,mBAAW,KAAK;AAChB,YAAI;AAAQ,iBAAO,CAAC;AAAA,MACtB;AAAA,MACA,SAAS,CAAC,MAAqC;AAC7C,YAAI;AAAU;AACd,mBAAW,IAAI;AACf,YAAI;AAAS,kBAAQ,CAAC;AAAA,MACxB;AAAA,MACA,YAAY,CAAC,MAAwC;AACnD,YAAI;AAAU;AACd,UAAE,eAAe;AACjB,YAAI,EAAE,QAAQ,SAAS;AACrB,qBAAW,IAAI;AACf,cAAI;AAAS,oBAAQ,CAAC;AAAA,QACxB;AACA,YAAI;AAAY,qBAAW,CAAC;AAAA,MAC9B;AAAA,MACA;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,QACA,aACC;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,iBAAiB,QAAQ,WAAW,cAAc;AAAA,YAC7D,eAAY;AAAA,YACZ,MAAK;AAAA,YAEL,sDAAC,UAAM,qBAAU;AAAA;AAAA,QACnB;AAAA,QAED;AAAA;AAAA;AAAA,EACH;AAEJ;AAEA,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,cAAc;AAEvB,MAAM,yBAAqB,8BAAS,QAAQ;AAC5C,mBAAmB,YAAY;AAG/B,IAAO,mBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,68 @@
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_INTENT: () => BUTTON_INTENT,
28
+ BUTTON_SIZE: () => BUTTON_SIZE,
29
+ BUTTON_TYPE: () => BUTTON_TYPE,
30
+ BUTTON_VARIANT: () => BUTTON_VARIANT,
31
+ buttonTypes: () => buttonTypes,
32
+ buttonVariants: () => buttonVariants
33
+ });
34
+ module.exports = __toCommonJS(constants_exports);
35
+ var React = __toESM(require("react"));
36
+ const BUTTON_TYPE = {
37
+ PRIMARY: "primary",
38
+ SECONDARY: "secondary",
39
+ TEXT: "text",
40
+ LINK: "link"
41
+ };
42
+ const buttonTypes = ["primary", "secondary", "text", "link"];
43
+ const BUTTON_SIZE = {
44
+ S: "s",
45
+ M: "m",
46
+ L: "l"
47
+ };
48
+ const BUTTON_INTENT = {
49
+ DANGER: "danger",
50
+ SUCCESS: "success",
51
+ WARNING: "warning",
52
+ INFO: "info"
53
+ };
54
+ const BUTTON_VARIANT = {
55
+ DEFAULT: "variant-default",
56
+ FOCUS: "variant-focus",
57
+ ACTIVE: "variant-active",
58
+ DISABLED: "variant-disabled",
59
+ HOVER: "variant-hover"
60
+ };
61
+ const buttonVariants = [
62
+ "variant-default",
63
+ "variant-focus",
64
+ "variant-active",
65
+ "variant-disabled",
66
+ "variant-hover"
67
+ ];
68
+ //# 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_TYPE = {\n PRIMARY: 'primary' as const,\n SECONDARY: 'secondary' as const,\n TEXT: 'text' as const,\n LINK: 'link' as const,\n};\n\nexport const buttonTypes = ['primary' as const, 'secondary' as const, 'text' as const, 'link' as const] as const;\n\nexport const BUTTON_SIZE = {\n S: 's' as const,\n M: 'm' as const,\n L: 'l' as const,\n};\n\nexport const BUTTON_INTENT = {\n DANGER: 'danger' as const,\n SUCCESS: 'success' as const,\n WARNING: 'warning' as const,\n INFO: 'info' as const,\n};\n\nexport const BUTTON_VARIANT = {\n DEFAULT: 'variant-default' as const,\n FOCUS: 'variant-focus' as const,\n ACTIVE: 'variant-active' as const,\n DISABLED: 'variant-disabled' as const,\n HOVER: 'variant-hover' as const,\n};\n\nexport const buttonVariants = [\n 'variant-default' as const,\n 'variant-focus' as const,\n 'variant-active' as const,\n 'variant-disabled' as const,\n 'variant-hover' as const,\n] as const;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,cAAc;AAAA,EACzB,SAAS;AAAA,EACT,WAAW;AAAA,EACX,MAAM;AAAA,EACN,MAAM;AACR;AAEO,MAAM,cAAc,CAAC,WAAoB,aAAsB,QAAiB,MAAe;AAE/F,MAAM,cAAc;AAAA,EACzB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,gBAAgB;AAAA,EAC3B,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,MAAM;AACR;AAEO,MAAM,iBAAiB;AAAA,EAC5B,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,OAAO;AACT;AAEO,MAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,47 @@
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 defaultProps_exports = {};
26
+ __export(defaultProps_exports, {
27
+ defaultProps: () => defaultProps
28
+ });
29
+ module.exports = __toCommonJS(defaultProps_exports);
30
+ var React = __toESM(require("react"));
31
+ var import_constants = require("./constants");
32
+ const defaultProps = {
33
+ disabled: false,
34
+ fluidWidth: false,
35
+ labelText: "",
36
+ icon: null,
37
+ onBlur: () => null,
38
+ onClick: () => null,
39
+ onKeyPress: () => null,
40
+ leftIcon: null,
41
+ tabIndex: 0,
42
+ variant: import_constants.BUTTON_VARIANT.DEFAULT,
43
+ containerProps: {},
44
+ as: "button",
45
+ type: "button"
46
+ };
47
+ //# sourceMappingURL=defaultProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/defaultProps.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { BUTTON_VARIANT } from './constants';\n\nexport const defaultProps = {\n disabled: false,\n fluidWidth: false,\n labelText: '',\n icon: null,\n onBlur: () => null,\n onClick: () => null,\n onKeyPress: () => null,\n leftIcon: null,\n tabIndex: 0,\n variant: BUTTON_VARIANT.DEFAULT,\n containerProps: {},\n as: 'button',\n type: 'button',\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA+B;AAExB,MAAM,eAAe;AAAA,EAC1B,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,MAAM;AAAA,EACN,QAAQ,MAAM;AAAA,EACd,SAAS,MAAM;AAAA,EACf,YAAY,MAAM;AAAA,EAClB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS,gCAAe;AAAA,EACxB,gBAAgB,CAAC;AAAA,EACjB,IAAI;AAAA,EACJ,MAAM;AACR;",
6
+ "names": []
7
+ }
@@ -0,0 +1,35 @@
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
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
+ __export(src_exports, {
28
+ default: () => import_DSButton.default
29
+ });
30
+ module.exports = __toCommonJS(src_exports);
31
+ var React = __toESM(require("react"));
32
+ __reExport(src_exports, require("./DSButton"), module.exports);
33
+ __reExport(src_exports, require("./constants"), module.exports);
34
+ var import_DSButton = __toESM(require("./DSButton"));
35
+ //# 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 './DSButton';\nexport * from './constants';\nexport { default } from './DSButton';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc,uBAAd;AACA,wBAAc,wBADd;AAEA,sBAAwB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,61 @@
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 propTypes_exports = {};
26
+ __export(propTypes_exports, {
27
+ btnPropTypes: () => btnPropTypes
28
+ });
29
+ module.exports = __toCommonJS(propTypes_exports);
30
+ var React = __toESM(require("react"));
31
+ var import_ds_utilities = require("@elliemae/ds-utilities");
32
+ var import_ds_shared = require("@elliemae/ds-shared");
33
+ var import_constants = require("./constants");
34
+ const btnPropTypes = {
35
+ tabIndex: import_ds_utilities.PropTypes.number.description("Tab index"),
36
+ className: import_ds_utilities.PropTypes.string.description("Additional className"),
37
+ "aria-disabled": import_ds_utilities.PropTypes.string.description("aria disabled"),
38
+ as: import_ds_utilities.PropTypes.string.description("Html tag").defaultValue("button"),
39
+ disabled: import_ds_utilities.PropTypes.bool.description("Whether the button is disabled or not"),
40
+ fluidWidth: import_ds_utilities.PropTypes.bool.description("Make the content of the button fit the button container or not"),
41
+ labelText: import_ds_utilities.PropTypes.oneOfType([import_ds_utilities.PropTypes.string, import_ds_utilities.PropTypes.element]).description(
42
+ "Displayable label inside the button"
43
+ ),
44
+ icon: import_ds_utilities.PropTypes.element.description("Put an icon inside the button"),
45
+ leftIcon: import_ds_utilities.PropTypes.element.description("Put an icon on the left side of the button"),
46
+ buttonType: import_ds_utilities.PropTypes.oneOf(import_constants.buttonTypes).description("type of the button"),
47
+ size: import_ds_utilities.PropTypes.oneOf(import_ds_shared.dsBasicSizes).description("size of the button"),
48
+ type: import_ds_utilities.PropTypes.oneOf(["button", "submit"]).description("type of the button"),
49
+ variant: import_ds_utilities.PropTypes.oneOf(import_constants.buttonVariants).description("variant of the button"),
50
+ innerRef: import_ds_utilities.PropTypes.oneOfType([import_ds_utilities.PropTypes.func, import_ds_utilities.PropTypes.shape({ current: import_ds_utilities.PropTypes.any })]).description(
51
+ "reference to the component"
52
+ ),
53
+ onBlur: import_ds_utilities.PropTypes.func.description("Allows a function that is triggered once the button is blur"),
54
+ intent: import_ds_utilities.PropTypes.oneOf(["success", "warning", "danger", "info"]).description(
55
+ 'Apply intent color. Only valid with buttonType="text"'
56
+ ),
57
+ containerProps: import_ds_utilities.PropTypes.object.description("additional props for the container"),
58
+ onClick: import_ds_utilities.PropTypes.func.description("Allows a function that is triggered once the button is clicked"),
59
+ onKeyPress: import_ds_utilities.PropTypes.func.description("Allows a function that is triggered once the button is key pressed")
60
+ };
61
+ //# sourceMappingURL=propTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/propTypes.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable no-unused-vars */\nimport { PropTypes } from '@elliemae/ds-utilities';\nimport { dsBasicSizes } from '@elliemae/ds-shared';\nimport { buttonTypes, buttonVariants } from './constants';\n\nexport const btnPropTypes = {\n /**\n * Tab index\n */\n tabIndex: PropTypes.number.description('Tab index'),\n /**\n * Additional className\n */\n className: PropTypes.string.description('Additional className'),\n /**\n * aria disabled\n */\n 'aria-disabled': PropTypes.string.description('aria disabled'),\n /**\n * Html tag. default 'button'\n */\n as: PropTypes.string.description('Html tag').defaultValue('button'),\n /**\n * Whether the button is disabled or not\n */\n disabled: PropTypes.bool.description('Whether the button is disabled or not'),\n /**\n * Make the content of the button fit the button container or not\n */\n fluidWidth: PropTypes.bool.description('Make the content of the button fit the button container or not'),\n /**\n * Displayable label inside the button\n */\n labelText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).description(\n 'Displayable label inside the button',\n ),\n /**\n * Put an icon inside the button\n */\n icon: PropTypes.element.description('Put an icon inside the button'),\n /**\n * Put an icon on the left side of the button\n */\n leftIcon: PropTypes.element.description('Put an icon on the left side of the button'),\n /**\n * ['primary', 'secondary', 'text', 'link']\n */\n buttonType: PropTypes.oneOf(buttonTypes).description('type of the button'),\n /**\n * ['s', 'm', 'l']\n */\n size: PropTypes.oneOf(dsBasicSizes).description('size of the button'),\n /**\n * submit or button\n */\n type: PropTypes.oneOf(['button', 'submit']).description('type of the button'),\n /**\n * [\n * 'variant-default',\n * 'variant-focus',\n * 'variant-active',\n * 'variant-disabled',\n * ]\n */\n variant: PropTypes.oneOf(buttonVariants).description('variant of the button'),\n /**\n * Refence\n */\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'reference to the component',\n ),\n /**\n * Onblur callback\n */\n onBlur: PropTypes.func.description('Allows a function that is triggered once the button is blur'),\n /**\n * Apply intent color: ['success', 'warning', 'danger', 'info']\n * Only valid with buttonType=\"text\"\n */\n intent: PropTypes.oneOf(['success', 'warning', 'danger', 'info']).description(\n 'Apply intent color. Only valid with buttonType=\"text\"',\n ),\n /**\n * additional props for the container\n */\n containerProps: PropTypes.object.description('additional props for the container'),\n /**\n * Allows a function that is triggered once the button is clicked\n */\n onClick: PropTypes.func.description('Allows a function that is triggered once the button is clicked'),\n /**\n * Allows a function that is triggered once the button is key pressed\n */\n onKeyPress: PropTypes.func.description('Allows a function that is triggered once the button is key pressed'),\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,0BAA0B;AAC1B,uBAA6B;AAC7B,uBAA4C;AAErC,MAAM,eAAe;AAAA,EAI1B,UAAU,8BAAU,OAAO,YAAY,WAAW;AAAA,EAIlD,WAAW,8BAAU,OAAO,YAAY,sBAAsB;AAAA,EAI9D,iBAAiB,8BAAU,OAAO,YAAY,eAAe;AAAA,EAI7D,IAAI,8BAAU,OAAO,YAAY,UAAU,EAAE,aAAa,QAAQ;AAAA,EAIlE,UAAU,8BAAU,KAAK,YAAY,uCAAuC;AAAA,EAI5E,YAAY,8BAAU,KAAK,YAAY,gEAAgE;AAAA,EAIvG,WAAW,8BAAU,UAAU,CAAC,8BAAU,QAAQ,8BAAU,OAAO,CAAC,EAAE;AAAA,IACpE;AAAA,EACF;AAAA,EAIA,MAAM,8BAAU,QAAQ,YAAY,+BAA+B;AAAA,EAInE,UAAU,8BAAU,QAAQ,YAAY,4CAA4C;AAAA,EAIpF,YAAY,8BAAU,MAAM,4BAAW,EAAE,YAAY,oBAAoB;AAAA,EAIzE,MAAM,8BAAU,MAAM,6BAAY,EAAE,YAAY,oBAAoB;AAAA,EAIpE,MAAM,8BAAU,MAAM,CAAC,UAAU,QAAQ,CAAC,EAAE,YAAY,oBAAoB;AAAA,EAS5E,SAAS,8BAAU,MAAM,+BAAc,EAAE,YAAY,uBAAuB;AAAA,EAI5E,UAAU,8BAAU,UAAU,CAAC,8BAAU,MAAM,8BAAU,MAAM,EAAE,SAAS,8BAAU,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC3F;AAAA,EACF;AAAA,EAIA,QAAQ,8BAAU,KAAK,YAAY,6DAA6D;AAAA,EAKhG,QAAQ,8BAAU,MAAM,CAAC,WAAW,WAAW,UAAU,MAAM,CAAC,EAAE;AAAA,IAChE;AAAA,EACF;AAAA,EAIA,gBAAgB,8BAAU,OAAO,YAAY,oCAAoC;AAAA,EAIjF,SAAS,8BAAU,KAAK,YAAY,gEAAgE;AAAA,EAIpG,YAAY,8BAAU,KAAK,YAAY,oEAAoE;AAC7G;",
6
+ "names": []
7
+ }
@@ -0,0 +1,121 @@
1
+ import * as React from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState, useMemo } from "react";
4
+ import { aggregatedClasses, convertPropToCssClassName } from "@elliemae/ds-classnames";
5
+ import { cx, describe } from "@elliemae/ds-utilities";
6
+ import { BUTTON_TYPE, BUTTON_SIZE, BUTTON_VARIANT } from "./constants";
7
+ import { btnPropTypes } from "./propTypes";
8
+ import { defaultProps } from "./defaultProps";
9
+ const blockName = "button";
10
+ const getContainer = (Element) => aggregatedClasses(Element)(
11
+ blockName,
12
+ null,
13
+ ({ iconOnly, variant }) => ({
14
+ "icon-only": iconOnly,
15
+ [variant]: variant
16
+ }),
17
+ {
18
+ propsToRemoveFromFinalElement: ["cx"]
19
+ }
20
+ );
21
+ const DSButton = ({
22
+ innerRef,
23
+ disabled,
24
+ buttonType,
25
+ fluidWidth,
26
+ size,
27
+ labelText,
28
+ icon,
29
+ onBlur,
30
+ onClick,
31
+ onKeyPress,
32
+ leftIcon,
33
+ tabIndex,
34
+ variant,
35
+ intent,
36
+ containerProps,
37
+ className,
38
+ as: Component,
39
+ type,
40
+ ...rest
41
+ }) => {
42
+ const [pressed, setPressed] = useState(false);
43
+ const Button = useMemo(() => getContainer(Component), [Component]);
44
+ const intentBlockName = `${blockName}${intent ? `-${intent}` : ""}`;
45
+ const { cssClassName: intentClassName } = convertPropToCssClassName(intentBlockName);
46
+ return /* @__PURE__ */ jsxs(
47
+ Button,
48
+ {
49
+ "data-testid": containerProps && containerProps["data-testid"] || "button-wrapper",
50
+ ...rest,
51
+ ...containerProps,
52
+ "aria-disabled": rest["aria-disabled"] !== void 0 ? rest["aria-disabled"] : disabled,
53
+ "aria-label": rest["aria-label"] || labelText || "button",
54
+ "aria-pressed": pressed,
55
+ className: cx(intentClassName, className),
56
+ classProps: {
57
+ disabled,
58
+ buttonType: buttonType || BUTTON_TYPE.PRIMARY,
59
+ size: size || BUTTON_SIZE.M,
60
+ fluidWidth,
61
+ iconOnly: !labelText && (icon || leftIcon),
62
+ variant: disabled ? BUTTON_VARIANT.DISABLED : variant
63
+ },
64
+ disabled,
65
+ innerRef,
66
+ onBlur: (e) => {
67
+ if (disabled)
68
+ return;
69
+ setPressed(false);
70
+ if (onBlur)
71
+ onBlur(e);
72
+ },
73
+ onClick: (e) => {
74
+ if (disabled)
75
+ return;
76
+ setPressed(true);
77
+ if (onClick)
78
+ onClick(e);
79
+ },
80
+ onKeyPress: (e) => {
81
+ if (disabled)
82
+ return;
83
+ e.preventDefault();
84
+ if (e.key === "Enter") {
85
+ setPressed(true);
86
+ if (onClick)
87
+ onClick(e);
88
+ }
89
+ if (onKeyPress)
90
+ onKeyPress(e);
91
+ },
92
+ tabIndex,
93
+ type,
94
+ children: [
95
+ leftIcon,
96
+ labelText && /* @__PURE__ */ jsx(
97
+ "span",
98
+ {
99
+ className: `label-wrapper ${icon || leftIcon ? "with-icon" : "no-icon"}`,
100
+ "data-testid": "button-label",
101
+ role: "presentation",
102
+ children: /* @__PURE__ */ jsx("span", { children: labelText })
103
+ }
104
+ ),
105
+ icon
106
+ ]
107
+ }
108
+ );
109
+ };
110
+ DSButton.defaultProps = defaultProps;
111
+ DSButton.propTypes = btnPropTypes;
112
+ DSButton.displayName = "DSButton";
113
+ const DSButtonWithSchema = describe(DSButton);
114
+ DSButtonWithSchema.propTypes = btnPropTypes;
115
+ var DSButton_default = DSButton;
116
+ export {
117
+ DSButton,
118
+ DSButtonWithSchema,
119
+ DSButton_default as default
120
+ };
121
+ //# sourceMappingURL=DSButton.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSButton.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable jest/valid-title */\nimport React, { useState, useMemo } from 'react';\nimport { aggregatedClasses, convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { cx, describe } from '@elliemae/ds-utilities';\nimport { BUTTON_TYPE, BUTTON_SIZE, BUTTON_VARIANT } from './constants';\nimport { btnPropTypes } from './propTypes';\nimport { defaultProps } from './defaultProps';\n\nconst blockName = 'button';\n\nconst getContainer = (Element) =>\n aggregatedClasses(Element)(\n blockName,\n null,\n ({ iconOnly, variant }) => ({\n 'icon-only': iconOnly,\n [variant]: variant,\n }),\n {\n propsToRemoveFromFinalElement: ['cx'],\n },\n );\n\ninterface ButtonPropsT {\n [x: string]: unknown;\n disabled?: boolean;\n fluidWidth?: boolean;\n innerRef?: unknown;\n buttonType?: typeof BUTTON_TYPE[keyof typeof BUTTON_TYPE];\n size?: typeof BUTTON_SIZE[keyof typeof BUTTON_SIZE];\n variant?: typeof BUTTON_VARIANT[keyof typeof BUTTON_VARIANT];\n labelText?: string;\n icon?: JSX.Element;\n leftIcon?: JSX.Element;\n tabIndex?: number;\n intent?: 'success' | 'danger' | 'warning' | 'info';\n containerProps?: { [x: string]: unknown };\n className?: string;\n as?: string | JSX.Element;\n type?: 'button' | 'text';\n onBlur?: React.FocusEventHandler<HTMLElement>;\n onClick?: (event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;\n onKeyPress?: React.KeyboardEventHandler<HTMLElement>;\n}\n\n// eslint-disable-next-line complexity\nconst DSButton = ({\n innerRef,\n disabled,\n buttonType,\n fluidWidth,\n size,\n labelText,\n icon,\n onBlur,\n onClick,\n onKeyPress,\n leftIcon,\n tabIndex,\n variant,\n intent,\n containerProps,\n className,\n as: Component,\n type,\n ...rest\n}: ButtonPropsT) => {\n const [pressed, setPressed] = useState(false);\n const Button = useMemo(() => getContainer(Component), [Component]);\n const intentBlockName = `${blockName}${intent ? `-${intent}` : ''}`;\n const { cssClassName: intentClassName } = convertPropToCssClassName(intentBlockName);\n return (\n <Button\n data-testid={(containerProps && containerProps['data-testid']) || 'button-wrapper'}\n {...rest}\n {...containerProps}\n aria-disabled={rest['aria-disabled'] !== undefined ? rest['aria-disabled'] : disabled}\n aria-label={rest['aria-label'] || labelText || 'button'}\n aria-pressed={pressed}\n className={cx(intentClassName, className)}\n classProps={{\n disabled,\n // DON'T CHANGE FOR defaultProps\n // using OR to keep ButtonGroup behavior at packages/ds-basic/src/ButtonGroup/DSButtonGroup\n buttonType: buttonType || BUTTON_TYPE.PRIMARY,\n // using or to keep ButtonGroup behavior at packages/ds-basic/src/ButtonGroup/DSButtonGroup\n size: size || BUTTON_SIZE.M,\n fluidWidth,\n iconOnly: !labelText && (icon || leftIcon),\n variant: disabled ? BUTTON_VARIANT.DISABLED : variant,\n }}\n disabled={disabled} // https://jira.elliemae.io/browse/PUI-1215\n innerRef={innerRef}\n onBlur={(e: React.FocusEvent<HTMLElement>) => {\n if (disabled) return;\n setPressed(false);\n if (onBlur) onBlur(e);\n }}\n onClick={(e: React.MouseEvent<HTMLElement>) => {\n if (disabled) return;\n setPressed(true);\n if (onClick) onClick(e);\n }}\n onKeyPress={(e: React.KeyboardEvent<HTMLElement>) => {\n if (disabled) return;\n e.preventDefault();\n if (e.key === 'Enter') {\n setPressed(true);\n if (onClick) onClick(e);\n }\n if (onKeyPress) onKeyPress(e);\n }}\n tabIndex={tabIndex}\n type={type}\n >\n {leftIcon}\n {labelText && (\n <span\n className={`label-wrapper ${icon || leftIcon ? 'with-icon' : 'no-icon'}`}\n data-testid=\"button-label\"\n role=\"presentation\"\n >\n <span>{labelText}</span>\n </span>\n )}\n {icon}\n </Button>\n );\n};\n\nDSButton.defaultProps = defaultProps;\nDSButton.propTypes = btnPropTypes;\nDSButton.displayName = 'DSButton';\n\nconst DSButtonWithSchema = describe(DSButton);\nDSButtonWithSchema.propTypes = btnPropTypes;\n\nexport { DSButton, DSButtonWithSchema };\nexport default DSButton;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACyEnB,SAkDM,KAlDN;AAvEJ,SAAgB,UAAU,eAAe;AACzC,SAAS,mBAAmB,iCAAiC;AAC7D,SAAS,IAAI,gBAAgB;AAC7B,SAAS,aAAa,aAAa,sBAAsB;AACzD,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAE7B,MAAM,YAAY;AAElB,MAAM,eAAe,CAAC,YACpB,kBAAkB,OAAO;AAAA,EACvB;AAAA,EACA;AAAA,EACA,CAAC,EAAE,UAAU,QAAQ,OAAO;AAAA,IAC1B,aAAa;AAAA,IACb,CAAC,UAAU;AAAA,EACb;AAAA,EACA;AAAA,IACE,+BAA+B,CAAC,IAAI;AAAA,EACtC;AACF;AAyBF,MAAM,WAAW,CAAC;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,IAAI;AAAA,EACJ;AAAA,KACG;AACL,MAAoB;AAClB,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,SAAS,QAAQ,MAAM,aAAa,SAAS,GAAG,CAAC,SAAS,CAAC;AACjE,QAAM,kBAAkB,GAAG,YAAY,SAAS,IAAI,WAAW;AAC/D,QAAM,EAAE,cAAc,gBAAgB,IAAI,0BAA0B,eAAe;AACnF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAc,kBAAkB,eAAe,kBAAmB;AAAA,MACjE,GAAG;AAAA,MACH,GAAG;AAAA,MACJ,iBAAe,KAAK,qBAAqB,SAAY,KAAK,mBAAmB;AAAA,MAC7E,cAAY,KAAK,iBAAiB,aAAa;AAAA,MAC/C,gBAAc;AAAA,MACd,WAAW,GAAG,iBAAiB,SAAS;AAAA,MACxC,YAAY;AAAA,QACV;AAAA,QAGA,YAAY,cAAc,YAAY;AAAA,QAEtC,MAAM,QAAQ,YAAY;AAAA,QAC1B;AAAA,QACA,UAAU,CAAC,cAAc,QAAQ;AAAA,QACjC,SAAS,WAAW,eAAe,WAAW;AAAA,MAChD;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ,CAAC,MAAqC;AAC5C,YAAI;AAAU;AACd,mBAAW,KAAK;AAChB,YAAI;AAAQ,iBAAO,CAAC;AAAA,MACtB;AAAA,MACA,SAAS,CAAC,MAAqC;AAC7C,YAAI;AAAU;AACd,mBAAW,IAAI;AACf,YAAI;AAAS,kBAAQ,CAAC;AAAA,MACxB;AAAA,MACA,YAAY,CAAC,MAAwC;AACnD,YAAI;AAAU;AACd,UAAE,eAAe;AACjB,YAAI,EAAE,QAAQ,SAAS;AACrB,qBAAW,IAAI;AACf,cAAI;AAAS,oBAAQ,CAAC;AAAA,QACxB;AACA,YAAI;AAAY,qBAAW,CAAC;AAAA,MAC9B;AAAA,MACA;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,QACA,aACC;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,iBAAiB,QAAQ,WAAW,cAAc;AAAA,YAC7D,eAAY;AAAA,YACZ,MAAK;AAAA,YAEL,8BAAC,UAAM,qBAAU;AAAA;AAAA,QACnB;AAAA,QAED;AAAA;AAAA;AAAA,EACH;AAEJ;AAEA,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,cAAc;AAEvB,MAAM,qBAAqB,SAAS,QAAQ;AAC5C,mBAAmB,YAAY;AAG/B,IAAO,mBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,42 @@
1
+ import * as React from "react";
2
+ const BUTTON_TYPE = {
3
+ PRIMARY: "primary",
4
+ SECONDARY: "secondary",
5
+ TEXT: "text",
6
+ LINK: "link"
7
+ };
8
+ const buttonTypes = ["primary", "secondary", "text", "link"];
9
+ const BUTTON_SIZE = {
10
+ S: "s",
11
+ M: "m",
12
+ L: "l"
13
+ };
14
+ const BUTTON_INTENT = {
15
+ DANGER: "danger",
16
+ SUCCESS: "success",
17
+ WARNING: "warning",
18
+ INFO: "info"
19
+ };
20
+ const BUTTON_VARIANT = {
21
+ DEFAULT: "variant-default",
22
+ FOCUS: "variant-focus",
23
+ ACTIVE: "variant-active",
24
+ DISABLED: "variant-disabled",
25
+ HOVER: "variant-hover"
26
+ };
27
+ const buttonVariants = [
28
+ "variant-default",
29
+ "variant-focus",
30
+ "variant-active",
31
+ "variant-disabled",
32
+ "variant-hover"
33
+ ];
34
+ export {
35
+ BUTTON_INTENT,
36
+ BUTTON_SIZE,
37
+ BUTTON_TYPE,
38
+ BUTTON_VARIANT,
39
+ buttonTypes,
40
+ buttonVariants
41
+ };
42
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/constants.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const BUTTON_TYPE = {\n PRIMARY: 'primary' as const,\n SECONDARY: 'secondary' as const,\n TEXT: 'text' as const,\n LINK: 'link' as const,\n};\n\nexport const buttonTypes = ['primary' as const, 'secondary' as const, 'text' as const, 'link' as const] as const;\n\nexport const BUTTON_SIZE = {\n S: 's' as const,\n M: 'm' as const,\n L: 'l' as const,\n};\n\nexport const BUTTON_INTENT = {\n DANGER: 'danger' as const,\n SUCCESS: 'success' as const,\n WARNING: 'warning' as const,\n INFO: 'info' as const,\n};\n\nexport const BUTTON_VARIANT = {\n DEFAULT: 'variant-default' as const,\n FOCUS: 'variant-focus' as const,\n ACTIVE: 'variant-active' as const,\n DISABLED: 'variant-disabled' as const,\n HOVER: 'variant-hover' as const,\n};\n\nexport const buttonVariants = [\n 'variant-default' as const,\n 'variant-focus' as const,\n 'variant-active' as const,\n 'variant-disabled' as const,\n 'variant-hover' as const,\n] as const;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,cAAc;AAAA,EACzB,SAAS;AAAA,EACT,WAAW;AAAA,EACX,MAAM;AAAA,EACN,MAAM;AACR;AAEO,MAAM,cAAc,CAAC,WAAoB,aAAsB,QAAiB,MAAe;AAE/F,MAAM,cAAc;AAAA,EACzB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,gBAAgB;AAAA,EAC3B,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,MAAM;AACR;AAEO,MAAM,iBAAiB;AAAA,EAC5B,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,OAAO;AACT;AAEO,MAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,21 @@
1
+ import * as React from "react";
2
+ import { BUTTON_VARIANT } from "./constants";
3
+ const defaultProps = {
4
+ disabled: false,
5
+ fluidWidth: false,
6
+ labelText: "",
7
+ icon: null,
8
+ onBlur: () => null,
9
+ onClick: () => null,
10
+ onKeyPress: () => null,
11
+ leftIcon: null,
12
+ tabIndex: 0,
13
+ variant: BUTTON_VARIANT.DEFAULT,
14
+ containerProps: {},
15
+ as: "button",
16
+ type: "button"
17
+ };
18
+ export {
19
+ defaultProps
20
+ };
21
+ //# sourceMappingURL=defaultProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/defaultProps.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { BUTTON_VARIANT } from './constants';\n\nexport const defaultProps = {\n disabled: false,\n fluidWidth: false,\n labelText: '',\n icon: null,\n onBlur: () => null,\n onClick: () => null,\n onKeyPress: () => null,\n leftIcon: null,\n tabIndex: 0,\n variant: BUTTON_VARIANT.DEFAULT,\n containerProps: {},\n as: 'button',\n type: 'button',\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,sBAAsB;AAExB,MAAM,eAAe;AAAA,EAC1B,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,MAAM;AAAA,EACN,QAAQ,MAAM;AAAA,EACd,SAAS,MAAM;AAAA,EACf,YAAY,MAAM;AAAA,EAClB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS,eAAe;AAAA,EACxB,gBAAgB,CAAC;AAAA,EACjB,IAAI;AAAA,EACJ,MAAM;AACR;",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ export * from "./DSButton";
3
+ export * from "./constants";
4
+ import { default as default2 } from "./DSButton";
5
+ export {
6
+ default2 as default
7
+ };
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSButton';\nexport * from './constants';\nexport { default } from './DSButton';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;AACd,cAAc;AACd,SAAS,WAAAA,gBAAe;",
6
+ "names": ["default"]
7
+ }
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { PropTypes } from "@elliemae/ds-utilities";
3
+ import { dsBasicSizes } from "@elliemae/ds-shared";
4
+ import { buttonTypes, buttonVariants } from "./constants";
5
+ const btnPropTypes = {
6
+ tabIndex: PropTypes.number.description("Tab index"),
7
+ className: PropTypes.string.description("Additional className"),
8
+ "aria-disabled": PropTypes.string.description("aria disabled"),
9
+ as: PropTypes.string.description("Html tag").defaultValue("button"),
10
+ disabled: PropTypes.bool.description("Whether the button is disabled or not"),
11
+ fluidWidth: PropTypes.bool.description("Make the content of the button fit the button container or not"),
12
+ labelText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).description(
13
+ "Displayable label inside the button"
14
+ ),
15
+ icon: PropTypes.element.description("Put an icon inside the button"),
16
+ leftIcon: PropTypes.element.description("Put an icon on the left side of the button"),
17
+ buttonType: PropTypes.oneOf(buttonTypes).description("type of the button"),
18
+ size: PropTypes.oneOf(dsBasicSizes).description("size of the button"),
19
+ type: PropTypes.oneOf(["button", "submit"]).description("type of the button"),
20
+ variant: PropTypes.oneOf(buttonVariants).description("variant of the button"),
21
+ innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(
22
+ "reference to the component"
23
+ ),
24
+ onBlur: PropTypes.func.description("Allows a function that is triggered once the button is blur"),
25
+ intent: PropTypes.oneOf(["success", "warning", "danger", "info"]).description(
26
+ 'Apply intent color. Only valid with buttonType="text"'
27
+ ),
28
+ containerProps: PropTypes.object.description("additional props for the container"),
29
+ onClick: PropTypes.func.description("Allows a function that is triggered once the button is clicked"),
30
+ onKeyPress: PropTypes.func.description("Allows a function that is triggered once the button is key pressed")
31
+ };
32
+ export {
33
+ btnPropTypes
34
+ };
35
+ //# sourceMappingURL=propTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/propTypes.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-unused-vars */\nimport { PropTypes } from '@elliemae/ds-utilities';\nimport { dsBasicSizes } from '@elliemae/ds-shared';\nimport { buttonTypes, buttonVariants } from './constants';\n\nexport const btnPropTypes = {\n /**\n * Tab index\n */\n tabIndex: PropTypes.number.description('Tab index'),\n /**\n * Additional className\n */\n className: PropTypes.string.description('Additional className'),\n /**\n * aria disabled\n */\n 'aria-disabled': PropTypes.string.description('aria disabled'),\n /**\n * Html tag. default 'button'\n */\n as: PropTypes.string.description('Html tag').defaultValue('button'),\n /**\n * Whether the button is disabled or not\n */\n disabled: PropTypes.bool.description('Whether the button is disabled or not'),\n /**\n * Make the content of the button fit the button container or not\n */\n fluidWidth: PropTypes.bool.description('Make the content of the button fit the button container or not'),\n /**\n * Displayable label inside the button\n */\n labelText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).description(\n 'Displayable label inside the button',\n ),\n /**\n * Put an icon inside the button\n */\n icon: PropTypes.element.description('Put an icon inside the button'),\n /**\n * Put an icon on the left side of the button\n */\n leftIcon: PropTypes.element.description('Put an icon on the left side of the button'),\n /**\n * ['primary', 'secondary', 'text', 'link']\n */\n buttonType: PropTypes.oneOf(buttonTypes).description('type of the button'),\n /**\n * ['s', 'm', 'l']\n */\n size: PropTypes.oneOf(dsBasicSizes).description('size of the button'),\n /**\n * submit or button\n */\n type: PropTypes.oneOf(['button', 'submit']).description('type of the button'),\n /**\n * [\n * 'variant-default',\n * 'variant-focus',\n * 'variant-active',\n * 'variant-disabled',\n * ]\n */\n variant: PropTypes.oneOf(buttonVariants).description('variant of the button'),\n /**\n * Refence\n */\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'reference to the component',\n ),\n /**\n * Onblur callback\n */\n onBlur: PropTypes.func.description('Allows a function that is triggered once the button is blur'),\n /**\n * Apply intent color: ['success', 'warning', 'danger', 'info']\n * Only valid with buttonType=\"text\"\n */\n intent: PropTypes.oneOf(['success', 'warning', 'danger', 'info']).description(\n 'Apply intent color. Only valid with buttonType=\"text\"',\n ),\n /**\n * additional props for the container\n */\n containerProps: PropTypes.object.description('additional props for the container'),\n /**\n * Allows a function that is triggered once the button is clicked\n */\n onClick: PropTypes.func.description('Allows a function that is triggered once the button is clicked'),\n /**\n * Allows a function that is triggered once the button is key pressed\n */\n onKeyPress: PropTypes.func.description('Allows a function that is triggered once the button is key pressed'),\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,aAAa,sBAAsB;AAErC,MAAM,eAAe;AAAA,EAI1B,UAAU,UAAU,OAAO,YAAY,WAAW;AAAA,EAIlD,WAAW,UAAU,OAAO,YAAY,sBAAsB;AAAA,EAI9D,iBAAiB,UAAU,OAAO,YAAY,eAAe;AAAA,EAI7D,IAAI,UAAU,OAAO,YAAY,UAAU,EAAE,aAAa,QAAQ;AAAA,EAIlE,UAAU,UAAU,KAAK,YAAY,uCAAuC;AAAA,EAI5E,YAAY,UAAU,KAAK,YAAY,gEAAgE;AAAA,EAIvG,WAAW,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,OAAO,CAAC,EAAE;AAAA,IACpE;AAAA,EACF;AAAA,EAIA,MAAM,UAAU,QAAQ,YAAY,+BAA+B;AAAA,EAInE,UAAU,UAAU,QAAQ,YAAY,4CAA4C;AAAA,EAIpF,YAAY,UAAU,MAAM,WAAW,EAAE,YAAY,oBAAoB;AAAA,EAIzE,MAAM,UAAU,MAAM,YAAY,EAAE,YAAY,oBAAoB;AAAA,EAIpE,MAAM,UAAU,MAAM,CAAC,UAAU,QAAQ,CAAC,EAAE,YAAY,oBAAoB;AAAA,EAS5E,SAAS,UAAU,MAAM,cAAc,EAAE,YAAY,uBAAuB;AAAA,EAI5E,UAAU,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,EAAE,SAAS,UAAU,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC3F;AAAA,EACF;AAAA,EAIA,QAAQ,UAAU,KAAK,YAAY,6DAA6D;AAAA,EAKhG,QAAQ,UAAU,MAAM,CAAC,WAAW,WAAW,UAAU,MAAM,CAAC,EAAE;AAAA,IAChE;AAAA,EACF;AAAA,EAIA,gBAAgB,UAAU,OAAO,YAAY,oCAAoC;AAAA,EAIjF,SAAS,UAAU,KAAK,YAAY,gEAAgE;AAAA,EAIpG,YAAY,UAAU,KAAK,YAAY,oEAAoE;AAC7G;",
6
+ "names": []
7
+ }
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "@elliemae/ds-button-v1",
3
+ "version": "3.12.0-rc.5",
4
+ "license": "MIT",
5
+ "description": "ICE MT - Dimsum - Button V 1",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "module": "./dist/esm/index.js",
10
+ "main": "./dist/cjs/index.js",
11
+ "types": "./dist/types/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/esm/index.js",
15
+ "require": "./dist/cjs/index.js"
16
+ },
17
+ "./propTypes": {
18
+ "import": "./dist/esm/propTypes.js",
19
+ "require": "./dist/cjs/propTypes.js"
20
+ },
21
+ "./DSButton": {
22
+ "import": "./dist/esm/DSButton.js",
23
+ "require": "./dist/cjs/DSButton.js"
24
+ },
25
+ "./defaultProps": {
26
+ "import": "./dist/esm/defaultProps.js",
27
+ "require": "./dist/cjs/defaultProps.js"
28
+ },
29
+ "./constants": {
30
+ "import": "./dist/esm/constants.js",
31
+ "require": "./dist/cjs/constants.js"
32
+ }
33
+ },
34
+ "sideEffects": [
35
+ "*.css",
36
+ "*.scss"
37
+ ],
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "https://git.elliemae.io/platform-ui/dimsum.git"
41
+ },
42
+ "engines": {
43
+ "pnpm": ">=6",
44
+ "node": ">=16"
45
+ },
46
+ "author": "ICE MT",
47
+ "jestSonar": {
48
+ "sonar56x": true,
49
+ "reportPath": "reports",
50
+ "reportFile": "tests.xml",
51
+ "indent": 4
52
+ },
53
+ "dependencies": {
54
+ "@elliemae/ds-classnames": "3.12.0-rc.5",
55
+ "@elliemae/ds-shared": "3.12.0-rc.5",
56
+ "@elliemae/ds-utilities": "3.12.0-rc.5"
57
+ },
58
+ "devDependencies": {
59
+ "@testing-library/jest-dom": "~5.16.4",
60
+ "@testing-library/react": "~12.1.3",
61
+ "styled-components": "~5.3.6"
62
+ },
63
+ "peerDependencies": {
64
+ "react": "^17.0.2",
65
+ "react-dom": "^17.0.2",
66
+ "styled-components": "~5.3.6"
67
+ },
68
+ "publishConfig": {
69
+ "access": "public",
70
+ "typeSafety": false
71
+ },
72
+ "scripts": {
73
+ "dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
74
+ "test": "node ../../scripts/testing/test.mjs",
75
+ "lint": "node ../../scripts/lint.mjs --fix",
76
+ "eslint:fix": "eslint --ext='.js,.jsx,.test.js,.ts,.tsx' --fix --config='../../.eslintrc.js' src/",
77
+ "dts": "node ../../scripts/dts.mjs",
78
+ "dts:withdeps": "pnpm --filter {.}... dts",
79
+ "build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs",
80
+ "dev:build": "pnpm --filter {.}... build && pnpm --filter {.}... dts",
81
+ "dev:install": "pnpm --filter {.}... i --no-lockfile && pnpm run dev:build",
82
+ "checkDeps": "npx -yes ../ds-codemods check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
83
+ }
84
+ }