@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,213 @@
|
|
|
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 styles_exports = {};
|
|
26
|
+
__export(styles_exports, {
|
|
27
|
+
DefaultButton: () => DefaultButton,
|
|
28
|
+
FilledButton: () => FilledButton,
|
|
29
|
+
OutlineButton: () => OutlineButton,
|
|
30
|
+
RawButton: () => RawButton,
|
|
31
|
+
TextButton: () => TextButton
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(styles_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
36
|
+
var import_constants = require("./constants");
|
|
37
|
+
var import_DSButtonV2Definitions = require("./DSButtonV2Definitions");
|
|
38
|
+
const pseudoBorder = import_ds_system.css`
|
|
39
|
+
position: absolute;
|
|
40
|
+
content: '';
|
|
41
|
+
border-style: solid;
|
|
42
|
+
border-width: ${({ size, buttonType }) => size === import_constants.BUTTON_SIZES.S && buttonType === import_constants.BUTTON_TYPES.FILLED ? "1px" : "2px"};
|
|
43
|
+
${({ buttonType, shape, theme }) => {
|
|
44
|
+
if (buttonType === import_constants.BUTTON_TYPES.FILLED || buttonType === import_constants.BUTTON_TYPES.ICON_FILLED) {
|
|
45
|
+
return `
|
|
46
|
+
top: 0;
|
|
47
|
+
left: 0;
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 100%;
|
|
50
|
+
border-color: ${theme.colors.neutral["000"]};
|
|
51
|
+
border-radius: ${shape !== import_constants.BUTTON_SHAPES.DEFAULT ? "50%" : "0px"};
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
return `
|
|
55
|
+
top: -1px;
|
|
56
|
+
left: -1px;
|
|
57
|
+
width: calc(100% + 2px);
|
|
58
|
+
height: calc(100% + 2px);
|
|
59
|
+
border-radius: ${shape !== import_constants.BUTTON_SHAPES.DEFAULT ? "50%" : "2px"};
|
|
60
|
+
`;
|
|
61
|
+
}}
|
|
62
|
+
`;
|
|
63
|
+
const fontSizeSettings = import_ds_system.css`
|
|
64
|
+
${({ theme, size, buttonType }) => {
|
|
65
|
+
switch (size) {
|
|
66
|
+
case import_constants.BUTTON_SIZES.S:
|
|
67
|
+
if (buttonType === import_constants.BUTTON_TYPES.TEXT)
|
|
68
|
+
return `font-size: ${theme.fontSizes.label[200]};`;
|
|
69
|
+
return `font-size: ${theme.fontSizes.label[300]};`;
|
|
70
|
+
case import_constants.BUTTON_SIZES.L:
|
|
71
|
+
return `
|
|
72
|
+
font-size: ${theme.fontSizes.value[600]};
|
|
73
|
+
`;
|
|
74
|
+
default:
|
|
75
|
+
return `
|
|
76
|
+
font-size: ${theme.fontSizes.value[500]};
|
|
77
|
+
`;
|
|
78
|
+
}
|
|
79
|
+
}}
|
|
80
|
+
`;
|
|
81
|
+
const RawButton = (0, import_ds_system.styled)("button", {
|
|
82
|
+
name: import_DSButtonV2Definitions.DSButtonV2Name,
|
|
83
|
+
slot: import_DSButtonV2Definitions.DSButtonV2Slots.ROOT
|
|
84
|
+
})`
|
|
85
|
+
outline: none;
|
|
86
|
+
border: none;
|
|
87
|
+
background: transparent;
|
|
88
|
+
&:hover {
|
|
89
|
+
background: transparent;
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
const DefaultButton = (0, import_ds_system.styled)(RawButton)`
|
|
93
|
+
display: inline-grid;
|
|
94
|
+
grid-gap: 8px;
|
|
95
|
+
position: relative;
|
|
96
|
+
grid-auto-flow: column;
|
|
97
|
+
place-items: center;
|
|
98
|
+
align-items: center;
|
|
99
|
+
justify-items: center;
|
|
100
|
+
width: fit-content;
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
font-weight: 600;
|
|
103
|
+
padding: ${({ theme, buttonType }) => buttonType !== import_constants.BUTTON_TYPES.ICON && buttonType !== import_constants.BUTTON_TYPES.ICON_OUTLINE && buttonType !== import_constants.BUTTON_TYPES.ICON_FILLED ? `0 ${theme.space.xs}` : "0"};
|
|
104
|
+
border-style: solid;
|
|
105
|
+
height: ${({ size }) => import_constants.sizes[size]};
|
|
106
|
+
min-width: ${({ size }) => import_constants.sizes[size]};
|
|
107
|
+
border-radius: ${({ shape }) => shape === import_constants.BUTTON_SHAPES.DEFAULT ? "2px" : "50%"};
|
|
108
|
+
${fontSizeSettings}
|
|
109
|
+
${({ buttonType }) => buttonType === import_constants.BUTTON_TYPES.TEXT ? "text-transform: uppercase;" : ""}
|
|
110
|
+
&[aria-disabled='true'] {
|
|
111
|
+
cursor: not-allowed;
|
|
112
|
+
}
|
|
113
|
+
${import_ds_system.xStyledCommonProps}
|
|
114
|
+
`;
|
|
115
|
+
const FilledButton = (0, import_ds_system.styled)(DefaultButton)`
|
|
116
|
+
background-color: ${import_ds_system.th.color("brand-600")};
|
|
117
|
+
border-color: ${import_ds_system.th.color("brand-600")};
|
|
118
|
+
color: ${import_ds_system.th.color("neutral-000")};
|
|
119
|
+
border-width: ${({ size }) => size === "s" ? "1px;" : "2px"};
|
|
120
|
+
&:focus,
|
|
121
|
+
&[data-testemulatestate='focus'] {
|
|
122
|
+
&:after {
|
|
123
|
+
${pseudoBorder}
|
|
124
|
+
}
|
|
125
|
+
border-color: brand-700;
|
|
126
|
+
}
|
|
127
|
+
& .em-ds-icon svg {
|
|
128
|
+
fill: neutral-000;
|
|
129
|
+
}
|
|
130
|
+
&:hover,
|
|
131
|
+
&:active,
|
|
132
|
+
&[data-testemulatestate='hover'],
|
|
133
|
+
&[data-testemulatestate='active'] {
|
|
134
|
+
background-color: brand-700;
|
|
135
|
+
border-color: brand-700;
|
|
136
|
+
}
|
|
137
|
+
&[aria-disabled='true'] {
|
|
138
|
+
background-color: neutral-100;
|
|
139
|
+
border-color: neutral-100;
|
|
140
|
+
color: #5c6574;
|
|
141
|
+
& .em-ds-icon svg {
|
|
142
|
+
fill: #5c6574;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
`;
|
|
146
|
+
const OutlineButton = (0, import_ds_system.styled)(DefaultButton)`
|
|
147
|
+
background: ${import_ds_system.th.color("neutral-000")};
|
|
148
|
+
border-color: ${import_ds_system.th.color("neutral-400")};
|
|
149
|
+
color: ${import_ds_system.th.color("brand-600")};
|
|
150
|
+
border-width: 1px;
|
|
151
|
+
&:focus,
|
|
152
|
+
&[data-testemulatestate='focus'] {
|
|
153
|
+
&:after {
|
|
154
|
+
${pseudoBorder}
|
|
155
|
+
border-color: brand-600;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
& .em-ds-icon svg {
|
|
159
|
+
fill: brand-600;
|
|
160
|
+
}
|
|
161
|
+
&:hover,
|
|
162
|
+
&:active,
|
|
163
|
+
&[data-testemulatestate='hover'],
|
|
164
|
+
&[data-testemulatestate='active'] {
|
|
165
|
+
border-color: brand-700;
|
|
166
|
+
color: brand-700;
|
|
167
|
+
& .em-ds-icon svg {
|
|
168
|
+
fill: brand-700;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
&:disabled {
|
|
172
|
+
border-color: neutral-400;
|
|
173
|
+
color: neutral-500;
|
|
174
|
+
& .em-ds-icon svg {
|
|
175
|
+
fill: neutral-500;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
`;
|
|
179
|
+
const TextButton = (0, import_ds_system.styled)(DefaultButton)`
|
|
180
|
+
border-color: transparent;
|
|
181
|
+
background-color: transparent;
|
|
182
|
+
border-width: 1px;
|
|
183
|
+
&:focus,
|
|
184
|
+
&[data-testemulatestate='focus'] {
|
|
185
|
+
&:after {
|
|
186
|
+
${pseudoBorder}
|
|
187
|
+
border-color: brand-700;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
color: brand-700;
|
|
191
|
+
& .em-ds-icon svg {
|
|
192
|
+
fill: brand-700;
|
|
193
|
+
}
|
|
194
|
+
&:hover:not([aria-disabled='true']),
|
|
195
|
+
&[data-testemulatestate='hover'] {
|
|
196
|
+
background-color: brand-200;
|
|
197
|
+
color: brand-700;
|
|
198
|
+
& .em-ds-icon svg {
|
|
199
|
+
fill: brand-700;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
&:active,
|
|
203
|
+
&[data-testemulatestate='active'] {
|
|
204
|
+
color: brand-700;
|
|
205
|
+
}
|
|
206
|
+
&[aria-disabled='true'] {
|
|
207
|
+
color: neutral-500;
|
|
208
|
+
& .em-ds-icon svg {
|
|
209
|
+
fill: neutral-500;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
`;
|
|
213
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/styles.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport React, { type ComponentType } from 'react';\nimport { css, styled, th, xStyledCommonProps } from '@elliemae/ds-system';\nimport { BUTTON_TYPES, BUTTON_SIZES, BUTTON_SHAPES, sizes } from './constants';\nimport type { ButtonShapesT, ButtonSizesT, ButtonTypesT } from './sharedTypes';\nimport type { DSButtonT } from './react-desc-prop-types';\nimport { DSButtonV2Slots, DSButtonV2Name } from './DSButtonV2Definitions';\n\nexport interface StyledButtonPropsT {\n size: ButtonSizesT;\n buttonType: ButtonTypesT;\n shape: ButtonShapesT;\n}\n\nconst pseudoBorder = css<StyledButtonPropsT>`\n position: absolute;\n content: '';\n border-style: solid;\n border-width: ${({ size, buttonType }) =>\n size === BUTTON_SIZES.S && buttonType === BUTTON_TYPES.FILLED ? '1px' : '2px'};\n ${({ buttonType, shape, theme }) => {\n if (buttonType === BUTTON_TYPES.FILLED || buttonType === BUTTON_TYPES.ICON_FILLED) {\n return `\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border-color: ${theme.colors.neutral['000']};\n border-radius: ${shape !== BUTTON_SHAPES.DEFAULT ? '50%' : '0px'};\n `;\n }\n return `\n top: -1px;\n left: -1px;\n width: calc(100% + 2px);\n height: calc(100% + 2px);\n border-radius: ${shape !== BUTTON_SHAPES.DEFAULT ? '50%' : '2px'};\n`;\n }}\n`;\n\nconst fontSizeSettings = css<StyledButtonPropsT>`\n ${({ theme, size, buttonType }) => {\n switch (size) {\n case BUTTON_SIZES.S:\n if (buttonType === BUTTON_TYPES.TEXT) return `font-size: ${theme.fontSizes.label[200]};`;\n return `font-size: ${theme.fontSizes.label[300]};`;\n case BUTTON_SIZES.L:\n return `\n font-size: ${theme.fontSizes.value[600]};\n `;\n default:\n return `\n font-size: ${theme.fontSizes.value[500]};\n `;\n }\n }}\n`;\nexport const RawButton = styled('button', {\n name: DSButtonV2Name,\n slot: DSButtonV2Slots.ROOT,\n})<DSButtonT.Props>`\n outline: none;\n border: none;\n background: transparent;\n &:hover {\n background: transparent;\n }\n`;\n\nexport const DefaultButton = styled(RawButton)<StyledButtonPropsT>`\n display: inline-grid;\n grid-gap: 8px;\n position: relative;\n grid-auto-flow: column;\n place-items: center;\n align-items: center;\n justify-items: center;\n width: fit-content;\n cursor: pointer;\n font-weight: 600;\n padding: ${({ theme, buttonType }) =>\n buttonType !== BUTTON_TYPES.ICON &&\n buttonType !== BUTTON_TYPES.ICON_OUTLINE &&\n buttonType !== BUTTON_TYPES.ICON_FILLED\n ? `0 ${theme.space.xs}`\n : '0'};\n border-style: solid;\n height: ${({ size }) => sizes[size]};\n min-width: ${({ size }) => sizes[size]};\n border-radius: ${({ shape }) => (shape === BUTTON_SHAPES.DEFAULT ? '2px' : '50%')};\n ${fontSizeSettings}\n ${({ buttonType }) => (buttonType === BUTTON_TYPES.TEXT ? 'text-transform: uppercase;' : '')}\n &[aria-disabled='true'] {\n cursor: not-allowed;\n }\n ${xStyledCommonProps}\n`;\n\nexport const FilledButton = styled(DefaultButton)<StyledButtonPropsT>`\n background-color: ${th.color('brand-600')};\n border-color: ${th.color('brand-600')};\n color: ${th.color('neutral-000')};\n border-width: ${({ size }) => (size === 's' ? '1px;' : '2px')};\n &:focus,\n &[data-testemulatestate='focus'] {\n &:after {\n ${pseudoBorder}\n }\n border-color: brand-700;\n }\n & .em-ds-icon svg {\n fill: neutral-000;\n }\n &:hover,\n &:active,\n &[data-testemulatestate='hover'],\n &[data-testemulatestate='active'] {\n background-color: brand-700;\n border-color: brand-700;\n }\n &[aria-disabled='true'] {\n background-color: neutral-100;\n border-color: neutral-100;\n color: #5c6574;\n & .em-ds-icon svg {\n fill: #5c6574;\n }\n }\n`;\n\nexport const OutlineButton = styled(DefaultButton)`\n background: ${th.color('neutral-000')};\n border-color: ${th.color('neutral-400')};\n color: ${th.color('brand-600')};\n border-width: 1px;\n &:focus,\n &[data-testemulatestate='focus'] {\n &:after {\n ${pseudoBorder}\n border-color: brand-600;\n }\n }\n & .em-ds-icon svg {\n fill: brand-600;\n }\n &:hover,\n &:active,\n &[data-testemulatestate='hover'],\n &[data-testemulatestate='active'] {\n border-color: brand-700;\n color: brand-700;\n & .em-ds-icon svg {\n fill: brand-700;\n }\n }\n &:disabled {\n border-color: neutral-400;\n color: neutral-500;\n & .em-ds-icon svg {\n fill: neutral-500;\n }\n }\n`;\n\nexport const TextButton = styled(DefaultButton)`\n border-color: transparent;\n background-color: transparent;\n border-width: 1px;\n &:focus,\n &[data-testemulatestate='focus'] {\n &:after {\n ${pseudoBorder}\n border-color: brand-700;\n }\n }\n color: brand-700;\n & .em-ds-icon svg {\n fill: brand-700;\n }\n &:hover:not([aria-disabled='true']),\n &[data-testemulatestate='hover'] {\n background-color: brand-200;\n color: brand-700;\n & .em-ds-icon svg {\n fill: brand-700;\n }\n }\n &:active,\n &[data-testemulatestate='active'] {\n color: brand-700;\n }\n &[aria-disabled='true'] {\n color: neutral-500;\n & .em-ds-icon svg {\n fill: neutral-500;\n }\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { describe } from "@elliemae/ds-utilities";
|
|
4
|
+
import { useButtonV2 } from "./config/useButtonV2";
|
|
5
|
+
import { DSButtonPropTypes } from "./react-desc-prop-types";
|
|
6
|
+
import { DSButtonV2Name } from "./DSButtonV2Definitions";
|
|
7
|
+
const DSButtonV2 = (props) => {
|
|
8
|
+
const {
|
|
9
|
+
propsWithDefault,
|
|
10
|
+
tabIndex,
|
|
11
|
+
handleOnMouseDown,
|
|
12
|
+
globalProps,
|
|
13
|
+
xstyledProps,
|
|
14
|
+
handleOnKeyDown,
|
|
15
|
+
handleOnClick,
|
|
16
|
+
ButtonRenderer
|
|
17
|
+
} = useButtonV2(props);
|
|
18
|
+
const { size, buttonType, innerRef, children, type, shape } = propsWithDefault;
|
|
19
|
+
const { disabled, ...restGlobalProps } = globalProps;
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
ButtonRenderer,
|
|
22
|
+
{
|
|
23
|
+
"aria-disabled": disabled ? "true" : false,
|
|
24
|
+
...restGlobalProps,
|
|
25
|
+
...xstyledProps,
|
|
26
|
+
shape,
|
|
27
|
+
type,
|
|
28
|
+
buttonType,
|
|
29
|
+
tabIndex,
|
|
30
|
+
size,
|
|
31
|
+
ref: innerRef,
|
|
32
|
+
onKeyDown: handleOnKeyDown,
|
|
33
|
+
onClick: handleOnClick,
|
|
34
|
+
onMouseDown: handleOnMouseDown,
|
|
35
|
+
children
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
DSButtonV2.propTypes = DSButtonPropTypes;
|
|
40
|
+
DSButtonV2.displayName = DSButtonV2Name;
|
|
41
|
+
const DSButtonV2WithSchema = describe(DSButtonV2);
|
|
42
|
+
DSButtonV2WithSchema.propTypes = DSButtonPropTypes;
|
|
43
|
+
export {
|
|
44
|
+
DSButtonV2,
|
|
45
|
+
DSButtonV2WithSchema
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=DSButtonV2.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSButtonV2.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACqBnB;AApBJ,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAE5B,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;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,IAAI,YAAY,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,uBAAuB,SAAS,UAAU;AAChD,qBAAqB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const DSButtonV2Name = "DSButtonV2";
|
|
3
|
+
const DSButtonV2DataTestId = {
|
|
4
|
+
ROOT: "ds-button"
|
|
5
|
+
};
|
|
6
|
+
const DSButtonV2Slots = {
|
|
7
|
+
ROOT: "root"
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
DSButtonV2DataTestId,
|
|
11
|
+
DSButtonV2Name,
|
|
12
|
+
DSButtonV2Slots
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=DSButtonV2Definitions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSButtonV2Definitions.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSButtonV2Name = 'DSButtonV2';\n\nexport const DSButtonV2DataTestId = {\n ROOT: 'ds-button',\n};\nexport const DSButtonV2Slots = {\n ROOT: 'root',\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,iBAAiB;AAEvB,MAAM,uBAAuB;AAAA,EAClC,MAAM;AACR;AACO,MAAM,kBAAkB;AAAA,EAC7B,MAAM;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { DefaultButton, RawButton, FilledButton, OutlineButton, TextButton } from "../styles";
|
|
4
|
+
const buttonMap = {
|
|
5
|
+
filled: FilledButton,
|
|
6
|
+
iconFilled: FilledButton,
|
|
7
|
+
outline: OutlineButton,
|
|
8
|
+
iconOutline: OutlineButton,
|
|
9
|
+
text: TextButton,
|
|
10
|
+
icon: TextButton,
|
|
11
|
+
raw: RawButton
|
|
12
|
+
};
|
|
13
|
+
const useButtonRenderer = (propsWithDefault) => {
|
|
14
|
+
const { buttonType } = propsWithDefault;
|
|
15
|
+
return React2.useMemo(() => buttonMap[buttonType] || DefaultButton, [buttonType]);
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
useButtonRenderer
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=useButtonRenderer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useButtonRenderer.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAElB,SAAS,eAAe,WAAW,cAAc,eAAe,kBAAkB;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,SAAOA,OAAM,QAAQ,MAAM,UAAU,eAAe,eAAe,CAAC,UAAU,CAAC;AACjF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from "@elliemae/ds-utilities";
|
|
4
|
+
import { defaultProps, DSButtonPropTypes } from "../react-desc-prop-types";
|
|
5
|
+
import { useValidateProps } from "./useValidateProps";
|
|
6
|
+
import { useButtonRenderer } from "./useButtonRenderer";
|
|
7
|
+
const useButtonV2 = (props) => {
|
|
8
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
9
|
+
useValidateProps(props, DSButtonPropTypes);
|
|
10
|
+
const globalProps = useGetGlobalAttributes(propsWithDefault);
|
|
11
|
+
const xstyledProps = useGetXstyledProps(propsWithDefault);
|
|
12
|
+
const { disabled } = globalProps;
|
|
13
|
+
const ButtonRenderer = useButtonRenderer(propsWithDefault);
|
|
14
|
+
const { onKeyDown, onClick, onMouseDown } = propsWithDefault;
|
|
15
|
+
const handleOnKeyDown = React2.useCallback(
|
|
16
|
+
(e) => {
|
|
17
|
+
if (disabled || !onKeyDown) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
onKeyDown?.(e);
|
|
21
|
+
const { key } = e;
|
|
22
|
+
if (["Space", " ", "Enter"].includes(key)) {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
onClick(e);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
[disabled, onClick, onKeyDown]
|
|
28
|
+
);
|
|
29
|
+
const handleOnClick = React2.useCallback(
|
|
30
|
+
(e) => {
|
|
31
|
+
if (!disabled && onClick) {
|
|
32
|
+
onClick(e);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
[disabled, onClick]
|
|
36
|
+
);
|
|
37
|
+
const handleOnMouseDown = React2.useCallback(
|
|
38
|
+
(e) => {
|
|
39
|
+
if (disabled) {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
onMouseDown?.(e);
|
|
44
|
+
},
|
|
45
|
+
[disabled, onMouseDown]
|
|
46
|
+
);
|
|
47
|
+
const tabIndex = globalProps.disabled ? -1 : globalProps.tabIndex;
|
|
48
|
+
return React2.useMemo(
|
|
49
|
+
() => ({
|
|
50
|
+
propsWithDefault,
|
|
51
|
+
globalProps,
|
|
52
|
+
xstyledProps,
|
|
53
|
+
ButtonRenderer,
|
|
54
|
+
handleOnKeyDown,
|
|
55
|
+
handleOnClick,
|
|
56
|
+
tabIndex,
|
|
57
|
+
handleOnMouseDown
|
|
58
|
+
}),
|
|
59
|
+
[
|
|
60
|
+
propsWithDefault,
|
|
61
|
+
globalProps,
|
|
62
|
+
xstyledProps,
|
|
63
|
+
ButtonRenderer,
|
|
64
|
+
handleOnKeyDown,
|
|
65
|
+
handleOnClick,
|
|
66
|
+
tabIndex,
|
|
67
|
+
handleOnMouseDown
|
|
68
|
+
]
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
export {
|
|
72
|
+
useButtonV2
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=useButtonV2.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useButtonV2.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB,SAAS,wBAAwB,oBAAoB,oCAAoC;AAEzF,SAAS,cAAc,yBAAyB;AAChD,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAa3B,MAAM,cAAc,CAAC,UAAkD;AAI5E,QAAM,mBAAmB,6BAAsD,OAAO,YAAY;AAClG,mBAAiB,OAAO,iBAAiB;AAIzC,QAAM,cAAc,uBAAmE,gBAAgB;AACvG,QAAM,eAAe,mBAAmB,gBAAgB;AACxD,QAAM,EAAE,SAAS,IAAI;AAIrB,QAAM,iBAAiB,kBAAkB,gBAAgB;AACzD,QAAM,EAAE,WAAW,SAAS,YAAY,IAAI;AAE5C,QAAM,kBAAiEA,OAAM;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,gBAA4DA,OAAM;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,oBAAgEA,OAAM;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,SAAOA,OAAM;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,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useValidateTypescriptPropTypes } from "@elliemae/ds-utilities";
|
|
3
|
+
import { DSButtonV2Name } from "../DSButtonV2Definitions";
|
|
4
|
+
const useValidateProps = (props, propTypes) => {
|
|
5
|
+
useValidateTypescriptPropTypes(props, propTypes, DSButtonV2Name);
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
useValidateProps
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=useValidateProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useValidateProps.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,sCAAsC;AAE/C,SAAS,sBAAsB;AAGxB,MAAM,mBAAmB,CAAC,OAAwB,cAAgD;AAEvG,iCAA+B,OAAO,WAAW,cAAc;AACjE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const BUTTON_TYPES = {
|
|
3
|
+
FILLED: "filled",
|
|
4
|
+
OUTLINE: "outline",
|
|
5
|
+
TEXT: "text",
|
|
6
|
+
ICON: "icon",
|
|
7
|
+
ICON_FILLED: "iconFilled",
|
|
8
|
+
ICON_OUTLINE: "iconOutline",
|
|
9
|
+
RAW: "raw"
|
|
10
|
+
};
|
|
11
|
+
const BUTTON_SHAPES = {
|
|
12
|
+
DEFAULT: "default",
|
|
13
|
+
ROUND: "round"
|
|
14
|
+
};
|
|
15
|
+
const BUTTON_SIZES = {
|
|
16
|
+
S: "s",
|
|
17
|
+
M: "m",
|
|
18
|
+
L: "l"
|
|
19
|
+
};
|
|
20
|
+
const sizes = {
|
|
21
|
+
s: "20px",
|
|
22
|
+
m: "28px",
|
|
23
|
+
l: "40px"
|
|
24
|
+
};
|
|
25
|
+
const ButtonTypesValuesArray = Object.values(BUTTON_TYPES);
|
|
26
|
+
const ButtonSizesValuesArray = Object.values(BUTTON_SIZES);
|
|
27
|
+
const ButtonShapesValuesArray = Object.values(BUTTON_SHAPES);
|
|
28
|
+
const ButtonInteractionStates = ["hover", "focus", "active"];
|
|
29
|
+
const ButtonTypesValuesString = JSON.stringify(ButtonTypesValuesArray);
|
|
30
|
+
const ButtonSizesValuesString = JSON.stringify(ButtonSizesValuesArray);
|
|
31
|
+
const ButtonShapesValuesString = JSON.stringify(ButtonShapesValuesArray);
|
|
32
|
+
const ButtonInteractionStatesValuesString = JSON.stringify(ButtonInteractionStates);
|
|
33
|
+
export {
|
|
34
|
+
BUTTON_SHAPES,
|
|
35
|
+
BUTTON_SIZES,
|
|
36
|
+
BUTTON_TYPES,
|
|
37
|
+
ButtonInteractionStates,
|
|
38
|
+
ButtonInteractionStatesValuesString,
|
|
39
|
+
ButtonShapesValuesArray,
|
|
40
|
+
ButtonShapesValuesString,
|
|
41
|
+
ButtonSizesValuesArray,
|
|
42
|
+
ButtonSizesValuesString,
|
|
43
|
+
ButtonTypesValuesArray,
|
|
44
|
+
ButtonTypesValuesString,
|
|
45
|
+
sizes
|
|
46
|
+
};
|
|
47
|
+
//# 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_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"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAhB,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,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DSButtonV2, DSButtonV2WithSchema } from "./DSButtonV2";
|
|
3
|
+
import { BUTTON_SIZES, BUTTON_TYPES, BUTTON_SHAPES } from "./constants";
|
|
4
|
+
export {
|
|
5
|
+
BUTTON_SHAPES,
|
|
6
|
+
BUTTON_SIZES,
|
|
7
|
+
BUTTON_TYPES,
|
|
8
|
+
DSButtonV2,
|
|
9
|
+
DSButtonV2WithSchema
|
|
10
|
+
};
|
|
11
|
+
//# 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 { DSButtonV2, DSButtonV2WithSchema } from './DSButtonV2';\nexport { BUTTON_SIZES, BUTTON_TYPES, BUTTON_SHAPES } from './constants';\nexport type { DSButtonT } from './react-desc-prop-types';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,YAAY,4BAA4B;AACjD,SAAS,cAAc,cAAc,qBAAqB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from "@elliemae/ds-utilities";
|
|
3
|
+
import {
|
|
4
|
+
BUTTON_SIZES,
|
|
5
|
+
BUTTON_TYPES,
|
|
6
|
+
BUTTON_SHAPES,
|
|
7
|
+
ButtonSizesValuesArray,
|
|
8
|
+
ButtonInteractionStates,
|
|
9
|
+
ButtonSizesValuesString,
|
|
10
|
+
ButtonInteractionStatesValuesString,
|
|
11
|
+
ButtonTypesValuesArray,
|
|
12
|
+
ButtonTypesValuesString,
|
|
13
|
+
ButtonShapesValuesArray,
|
|
14
|
+
ButtonShapesValuesString
|
|
15
|
+
} from "./constants";
|
|
16
|
+
import { DSButtonV2DataTestId } from "./DSButtonV2Definitions";
|
|
17
|
+
const defaultProps = {
|
|
18
|
+
size: BUTTON_SIZES.M,
|
|
19
|
+
buttonType: BUTTON_TYPES.FILLED,
|
|
20
|
+
shape: BUTTON_SHAPES.DEFAULT,
|
|
21
|
+
"data-testid": DSButtonV2DataTestId.ROOT,
|
|
22
|
+
type: "button",
|
|
23
|
+
onClick: () => {
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const DSButtonPropTypes = {
|
|
27
|
+
...globalAttributesPropTypes,
|
|
28
|
+
...xstyledPropTypes,
|
|
29
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]).description(
|
|
30
|
+
"String, Number and/or Dimsum Icon"
|
|
31
|
+
).isRequired,
|
|
32
|
+
buttonType: PropTypes.oneOf(ButtonTypesValuesArray).description(ButtonTypesValuesString).defaultValue(BUTTON_TYPES.FILLED),
|
|
33
|
+
shape: PropTypes.oneOf(ButtonShapesValuesArray).description(ButtonShapesValuesString).defaultValue(BUTTON_SHAPES.DEFAULT),
|
|
34
|
+
type: PropTypes.string.description('html "type" props').defaultValue("button"),
|
|
35
|
+
size: PropTypes.oneOf(ButtonSizesValuesArray).description(ButtonSizesValuesString).defaultValue(BUTTON_SIZES.M),
|
|
36
|
+
onClick: PropTypes.func.description('function executed when the button is activated (via keyboard "space" or enter OR via mouse)').signature("(( e: React.SyntheticEvent ) => void )").defaultValue(() => {
|
|
37
|
+
}),
|
|
38
|
+
innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description("Inner ref to button component."),
|
|
39
|
+
"data-testid": PropTypes.string.description("root element data-testid").defaultValue(DSButtonV2DataTestId.ROOT),
|
|
40
|
+
"data-testemulatestate": PropTypes.oneOf(ButtonInteractionStates).description(
|
|
41
|
+
`Emulates button states. Useful for e2e tests. ${ButtonInteractionStatesValuesString}`
|
|
42
|
+
)
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
DSButtonPropTypes,
|
|
46
|
+
defaultProps
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* 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"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACIvB,SAAS,WAAW,2BAA2B,wBAAwB;AACvE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,4BAA4B;AAG9B,MAAM,eAAuC;AAAA,EAClD,MAAM,aAAa;AAAA,EACnB,YAAY,aAAa;AAAA,EACzB,OAAO,cAAc;AAAA,EACrB,eAAe,qBAAqB;AAAA,EACpC,MAAM;AAAA,EACN,SAAS,MAAM;AAAA,EAAC;AAClB;AAmCO,MAAM,oBAAoB;AAAA,EAC/B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,UAAU,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,QAAQ,UAAU,IAAI,CAAC,CAAC,EAAE;AAAA,IACjF;AAAA,EACF,EAAE;AAAA,EACF,YAAY,UAAU,MAAM,sBAAsB,EAC/C,YAAY,uBAAuB,EACnC,aAAa,aAAa,MAAM;AAAA,EACnC,OAAO,UAAU,MAAM,uBAAuB,EAC3C,YAAY,wBAAwB,EACpC,aAAa,cAAc,OAAO;AAAA,EACrC,MAAM,UAAU,OAAO,YAAY,mBAAmB,EAAE,aAAa,QAAQ;AAAA,EAC7E,MAAM,UAAU,MAAM,sBAAsB,EAAE,YAAY,uBAAuB,EAAE,aAAa,aAAa,CAAC;AAAA,EAC9G,SAAS,UAAU,KAChB,YAAY,6FAA6F,EACzG,UAAU,wCAAwC,EAClD,aAAa,MAAM;AAAA,EAAC,CAAC;AAAA,EACxB,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,IAAI,CAAC,EAAE,YAAY,gCAAgC;AAAA,EAE9G,eAAe,UAAU,OAAO,YAAY,0BAA0B,EAAE,aAAa,qBAAqB,IAAI;AAAA,EAC9G,yBAAyB,UAAU,MAAM,uBAAuB,EAAE;AAAA,IAChE,iDAAiD;AAAA,EACnD;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|