@elliemae/ds-card-v2 3.28.1-rc.2 → 3.29.0-next.2
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/index.js +0 -2
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/types/index.d.ts +0 -1
- package/package.json +11 -11
- package/dist/cjs/CardV3.js +0 -296
- package/dist/cjs/CardV3.js.map +0 -7
- package/dist/esm/CardV3.js +0 -270
- package/dist/esm/CardV3.js.map +0 -7
- package/dist/types/CardV3.d.ts +0 -80
package/dist/cjs/index.js
CHANGED
|
@@ -17,7 +17,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
21
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
22
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -40,5 +39,4 @@ var React = __toESM(require("react"));
|
|
|
40
39
|
var import_DSCardV2 = require("./DSCardV2.js");
|
|
41
40
|
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
42
41
|
var import_constants = require("./constants/index.js");
|
|
43
|
-
__reExport(src_exports, require("./CardV3.js"), module.exports);
|
|
44
42
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport {\n DSCardV2,\n DSCardV2 as CustomCard,\n DSCardV2WithSchema,\n DSCardV2WithSchema as DSCardCustomWithSchema,\n} from './DSCardV2.js';\nexport { type DSCardV2T } from './react-desc-prop-types.js';\nexport { CARD_V2_DATA_TESTID } from './constants/index.js';\
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport {\n DSCardV2,\n DSCardV2 as CustomCard,\n DSCardV2WithSchema,\n DSCardV2WithSchema as DSCardCustomWithSchema,\n} from './DSCardV2.js';\nexport { type DSCardV2T } from './react-desc-prop-types.js';\nexport { CARD_V2_DATA_TESTID } from './constants/index.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,sBAKO;AACP,mCAA+B;AAC/B,uBAAoC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport {\n DSCardV2,\n DSCardV2 as CustomCard,\n DSCardV2WithSchema,\n DSCardV2WithSchema as DSCardCustomWithSchema,\n} from './DSCardV2.js';\nexport { type DSCardV2T } from './react-desc-prop-types.js';\nexport { CARD_V2_DATA_TESTID } from './constants/index.js';\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACGvB;AAAA,EACE;AAAA,EACY,YAAZA;AAAA,EACA;AAAA,EACsB,sBAAtBC;AAAA,OACK;AACP,eAA+B;AAC/B,SAAS,2BAA2B;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport {\n DSCardV2,\n DSCardV2 as CustomCard,\n DSCardV2WithSchema,\n DSCardV2WithSchema as DSCardCustomWithSchema,\n} from './DSCardV2.js';\nexport { type DSCardV2T } from './react-desc-prop-types.js';\nexport { CARD_V2_DATA_TESTID } from './constants/index.js';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACGvB;AAAA,EACE;AAAA,EACY,YAAZA;AAAA,EACA;AAAA,EACsB,sBAAtBC;AAAA,OACK;AACP,eAA+B;AAC/B,SAAS,2BAA2B;",
|
|
6
6
|
"names": ["DSCardV2", "DSCardV2WithSchema"]
|
|
7
7
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { DSCardV2, DSCardV2 as CustomCard, DSCardV2WithSchema, DSCardV2WithSchema as DSCardCustomWithSchema, } from './DSCardV2.js';
|
|
2
2
|
export { type DSCardV2T } from './react-desc-prop-types.js';
|
|
3
3
|
export { CARD_V2_DATA_TESTID } from './constants/index.js';
|
|
4
|
-
export * from './CardV3.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-card-v2",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.29.0-next.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Card V2",
|
|
6
6
|
"files": [
|
|
@@ -49,21 +49,21 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"lodash": "~4.17.21",
|
|
51
51
|
"uid": "~2.0.1",
|
|
52
|
-
"@elliemae/ds-button": "3.
|
|
53
|
-
"@elliemae/ds-grid": "3.
|
|
54
|
-
"@elliemae/ds-header": "3.
|
|
55
|
-
"@elliemae/ds-controlled-form": "3.
|
|
56
|
-
"@elliemae/ds-icons": "3.
|
|
57
|
-
"@elliemae/ds-separator": "3.
|
|
58
|
-
"@elliemae/ds-
|
|
59
|
-
"@elliemae/ds-
|
|
60
|
-
"@elliemae/ds-utilities": "3.
|
|
52
|
+
"@elliemae/ds-button": "3.29.0-next.2",
|
|
53
|
+
"@elliemae/ds-grid": "3.29.0-next.2",
|
|
54
|
+
"@elliemae/ds-header": "3.29.0-next.2",
|
|
55
|
+
"@elliemae/ds-controlled-form": "3.29.0-next.2",
|
|
56
|
+
"@elliemae/ds-icons": "3.29.0-next.2",
|
|
57
|
+
"@elliemae/ds-separator": "3.29.0-next.2",
|
|
58
|
+
"@elliemae/ds-truncated-tooltip-text": "3.29.0-next.2",
|
|
59
|
+
"@elliemae/ds-system": "3.29.0-next.2",
|
|
60
|
+
"@elliemae/ds-utilities": "3.29.0-next.2"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@elliemae/pui-cli": "~9.0.0-next.31",
|
|
64
64
|
"@xstyled/system": "3.7.0",
|
|
65
65
|
"styled-components": "~5.3.9",
|
|
66
|
-
"@elliemae/ds-monorepo-devops": "3.
|
|
66
|
+
"@elliemae/ds-monorepo-devops": "3.29.0-next.2"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"lodash": "^4.17.21",
|
package/dist/cjs/CardV3.js
DELETED
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var CardV3_exports = {};
|
|
30
|
-
__export(CardV3_exports, {
|
|
31
|
-
Card: () => Card,
|
|
32
|
-
CardActionArea: () => CardActionArea,
|
|
33
|
-
CardContent: () => CardContent,
|
|
34
|
-
CardFooter: () => CardFooter,
|
|
35
|
-
CardHeader: () => CardHeader,
|
|
36
|
-
CardSelectIndicator: () => CardSelectIndicator,
|
|
37
|
-
DSCardV3DataTestIds: () => DSCardV3DataTestIds,
|
|
38
|
-
DSCardV3Name: () => DSCardV3Name,
|
|
39
|
-
DSCardV3Slots: () => DSCardV3Slots,
|
|
40
|
-
StyledButtonCard: () => StyledButtonCard,
|
|
41
|
-
StyledCard: () => StyledCard,
|
|
42
|
-
StyledCardDisabled: () => StyledCardDisabled,
|
|
43
|
-
StyledCardError: () => StyledCardError,
|
|
44
|
-
StyledCardSingleIndicator: () => StyledCardSingleIndicator,
|
|
45
|
-
defaultProps: () => defaultProps
|
|
46
|
-
});
|
|
47
|
-
module.exports = __toCommonJS(CardV3_exports);
|
|
48
|
-
var React = __toESM(require("react"));
|
|
49
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
50
|
-
var import_react = __toESM(require("react"));
|
|
51
|
-
var import_lodash = require("lodash");
|
|
52
|
-
var import_ds_grid = require("@elliemae/ds-grid");
|
|
53
|
-
var import_ds_system = require("@elliemae/ds-system");
|
|
54
|
-
var import_ds_controlled_form = require("@elliemae/ds-controlled-form");
|
|
55
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
56
|
-
const DSCardV3Name = "DSCardV3";
|
|
57
|
-
const DSCardV3Slots = {
|
|
58
|
-
ACTION_AREA: "action-area"
|
|
59
|
-
};
|
|
60
|
-
const DSCardV3DataTestIds = (0, import_ds_system.slotObjectToDataTestIds)(DSCardV3Name, DSCardV3Slots);
|
|
61
|
-
const defaultContext = {
|
|
62
|
-
isSelected: false,
|
|
63
|
-
isMultiSelect: false,
|
|
64
|
-
disabled: false
|
|
65
|
-
};
|
|
66
|
-
const CardContext = import_react.default.createContext(defaultContext);
|
|
67
|
-
const defaultProps = {
|
|
68
|
-
hasError: false
|
|
69
|
-
};
|
|
70
|
-
const CardActionArea = (0, import_ds_system.styled)("button", {
|
|
71
|
-
name: DSCardV3Name,
|
|
72
|
-
slot: DSCardV3Slots.ACTION_AREA
|
|
73
|
-
})`
|
|
74
|
-
border: none;
|
|
75
|
-
background-color: transparent;
|
|
76
|
-
width: 0px;
|
|
77
|
-
height: 0px;
|
|
78
|
-
padding: 0;
|
|
79
|
-
&:focus {
|
|
80
|
-
outline: none;
|
|
81
|
-
}
|
|
82
|
-
text-align: unset;
|
|
83
|
-
`;
|
|
84
|
-
const StyledCard = (0, import_ds_system.styled)(import_ds_grid.Grid)`
|
|
85
|
-
min-width: 240px;
|
|
86
|
-
min-height: 56px;
|
|
87
|
-
background-color: ${({ theme, isOverlay }) => isOverlay ? theme.colors.neutral["080"] : "white"};
|
|
88
|
-
outline-offset: -2px;
|
|
89
|
-
* {
|
|
90
|
-
color: ${({ theme, isOverlay }) => isOverlay ? theme.colors.neutral["500"] : "inherit"};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
${import_ds_system.xStyledCommonProps}
|
|
94
|
-
`;
|
|
95
|
-
const StyledButtonCard = (0, import_ds_system.styled)(StyledCard)`
|
|
96
|
-
cursor: pointer;
|
|
97
|
-
`;
|
|
98
|
-
const StyledCardError = (0, import_ds_system.styled)(StyledCard)`
|
|
99
|
-
outline: ${({ theme }) => `2px solid ${theme.colors.danger[900]}`};
|
|
100
|
-
`;
|
|
101
|
-
const StyledCardSingleIndicator = (0, import_ds_system.styled)(import_ds_grid.Grid)`
|
|
102
|
-
width: ${({ isSelected }) => isSelected ? "6px" : "4px"};
|
|
103
|
-
align-self: normal;
|
|
104
|
-
background-color: ${({ theme, isSelected }) => {
|
|
105
|
-
if (isSelected)
|
|
106
|
-
return theme.colors.brand["700"];
|
|
107
|
-
return theme.colors.brand["300"];
|
|
108
|
-
}};
|
|
109
|
-
transition: all 0.1s ease-in-out;
|
|
110
|
-
|
|
111
|
-
${StyledCard}:not([data-disabled='true']):not([data-selected='true']):hover & {
|
|
112
|
-
background-color: ${({ theme }) => theme.colors.brand["500"]};
|
|
113
|
-
}
|
|
114
|
-
`;
|
|
115
|
-
const StyledCardDisabled = (0, import_ds_system.styled)(StyledCard)`
|
|
116
|
-
cursor: not-allowed;
|
|
117
|
-
user-select: none;
|
|
118
|
-
opacity: 0.5;
|
|
119
|
-
${StyledCardSingleIndicator} {
|
|
120
|
-
background-color: ${({ theme, isSelected }) => isSelected ? theme.colors.neutral["800"] : theme.colors.neutral["080"]};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
${CardActionArea} {
|
|
124
|
-
pointer-events: none;
|
|
125
|
-
}
|
|
126
|
-
`;
|
|
127
|
-
const CardSelectIndicator = (props) => {
|
|
128
|
-
const { isSelected, isMultiSelect } = props;
|
|
129
|
-
if (!isMultiSelect) {
|
|
130
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_grid.Grid, { alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_controlled_form.PresentationalRadio, { checked: isSelected, "aria-label": "@todo", device: "desktop" }) });
|
|
131
|
-
}
|
|
132
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledCardSingleIndicator, { isSelected });
|
|
133
|
-
};
|
|
134
|
-
const CardHeader = (props) => {
|
|
135
|
-
const { isSelected, isMultiSelect, onClick } = import_react.default.useContext(CardContext);
|
|
136
|
-
const { children, ...rest } = props;
|
|
137
|
-
if (isSelected !== void 0 && isMultiSelect && onClick) {
|
|
138
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
139
|
-
import_ds_grid.Grid,
|
|
140
|
-
{
|
|
141
|
-
cols: ["12px", "auto"],
|
|
142
|
-
"data-type": "card-header",
|
|
143
|
-
padding: "xxxs",
|
|
144
|
-
alignItems: "center",
|
|
145
|
-
minHeight: "56px",
|
|
146
|
-
...rest,
|
|
147
|
-
children: [
|
|
148
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardSelectIndicator, { isSelected, isMultiSelect }),
|
|
149
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_grid.Grid, { py: "xxxs", paddingRight: "xxs2", children })
|
|
150
|
-
]
|
|
151
|
-
}
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
if (isSelected !== void 0 && !isMultiSelect && onClick) {
|
|
155
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
156
|
-
import_ds_grid.Grid,
|
|
157
|
-
{
|
|
158
|
-
cols: ["16px", "auto"],
|
|
159
|
-
"data-type": "card-header",
|
|
160
|
-
gutter: "xxs",
|
|
161
|
-
px: "xs",
|
|
162
|
-
py: "xxs",
|
|
163
|
-
alignItems: "center",
|
|
164
|
-
minHeight: "56px",
|
|
165
|
-
...rest,
|
|
166
|
-
children: [
|
|
167
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardSelectIndicator, { isSelected, isMultiSelect }),
|
|
168
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_grid.Grid, { py: "xxxs", paddingRight: "xxs2", children })
|
|
169
|
-
]
|
|
170
|
-
}
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_grid.Grid, { "data-type": "card-header", px: "xs", py: "xxs", gutter: "xxs", alignItems: "center", minHeight: "56px", ...rest, children });
|
|
174
|
-
};
|
|
175
|
-
const CardFooter = (props) => {
|
|
176
|
-
const { children, ...rest } = props;
|
|
177
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
178
|
-
import_ds_grid.Grid,
|
|
179
|
-
{
|
|
180
|
-
"data-type": "card-footer",
|
|
181
|
-
px: "xs",
|
|
182
|
-
py: "xxs",
|
|
183
|
-
gutter: "xxs",
|
|
184
|
-
borderTop: "1px solid #CBCFD7",
|
|
185
|
-
minHeight: "40px",
|
|
186
|
-
alignItems: "center",
|
|
187
|
-
...rest,
|
|
188
|
-
children
|
|
189
|
-
}
|
|
190
|
-
);
|
|
191
|
-
};
|
|
192
|
-
const CardContent = (props) => {
|
|
193
|
-
const { children, ...rest } = props;
|
|
194
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
195
|
-
import_ds_grid.Grid,
|
|
196
|
-
{
|
|
197
|
-
"data-type": "card-content",
|
|
198
|
-
gutter: "xxs",
|
|
199
|
-
px: "xs",
|
|
200
|
-
py: "xxs",
|
|
201
|
-
paddingTop: "0px",
|
|
202
|
-
minHeight: "64px",
|
|
203
|
-
alignItems: "center",
|
|
204
|
-
...rest,
|
|
205
|
-
children
|
|
206
|
-
}
|
|
207
|
-
);
|
|
208
|
-
};
|
|
209
|
-
const StyledFocusRing = (0, import_ds_system.styled)(import_ds_grid.Grid)`
|
|
210
|
-
width: 100%;
|
|
211
|
-
height: 100%;
|
|
212
|
-
outline-offset: -1px;
|
|
213
|
-
outline: ${({ showFocusRing, hasError, theme }) => {
|
|
214
|
-
if (showFocusRing) {
|
|
215
|
-
return `2px solid ${theme.colors.brand[700]}`;
|
|
216
|
-
}
|
|
217
|
-
if (hasError) {
|
|
218
|
-
return `2px solid ${theme.colors.danger[900]}`;
|
|
219
|
-
}
|
|
220
|
-
return "none";
|
|
221
|
-
}};
|
|
222
|
-
`;
|
|
223
|
-
const FocusRing = (props) => {
|
|
224
|
-
const { target, children, hasError } = props;
|
|
225
|
-
const [showFocusRing, setShowFocusingRing] = import_react.default.useState(false);
|
|
226
|
-
const handleOnFocus = import_react.default.useCallback(
|
|
227
|
-
(e) => {
|
|
228
|
-
if (e.target.matches(target)) {
|
|
229
|
-
setShowFocusingRing(true);
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
[target]
|
|
233
|
-
);
|
|
234
|
-
const handleOnBlur = import_react.default.useCallback(
|
|
235
|
-
(e) => {
|
|
236
|
-
if (e.target.matches(target)) {
|
|
237
|
-
setShowFocusingRing(false);
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
[target]
|
|
241
|
-
);
|
|
242
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
243
|
-
StyledFocusRing,
|
|
244
|
-
{
|
|
245
|
-
hasError,
|
|
246
|
-
onFocusCapture: handleOnFocus,
|
|
247
|
-
onBlurCapture: handleOnBlur,
|
|
248
|
-
showFocusRing,
|
|
249
|
-
children
|
|
250
|
-
}
|
|
251
|
-
);
|
|
252
|
-
};
|
|
253
|
-
const Card = (props) => {
|
|
254
|
-
const propsWithDefault = (0, import_ds_utilities.useMemoMergePropsWithDefault)(props, defaultProps);
|
|
255
|
-
const { children, hasError, disabled, isOverlay, onClick, isSelected, isMultiSelect } = propsWithDefault;
|
|
256
|
-
const StyledCardContainer = (0, import_react.useMemo)(() => {
|
|
257
|
-
if (onClick && !disabled) {
|
|
258
|
-
return StyledButtonCard;
|
|
259
|
-
}
|
|
260
|
-
if (disabled) {
|
|
261
|
-
return StyledCardDisabled;
|
|
262
|
-
}
|
|
263
|
-
return StyledCard;
|
|
264
|
-
}, [disabled, onClick]);
|
|
265
|
-
const globalsAttrs = (0, import_lodash.omit)((0, import_ds_utilities.useGetGlobalAttributes)(propsWithDefault), ["cols", "rows", "wrap"]);
|
|
266
|
-
const xstyledProps = (0, import_ds_utilities.useGetXstyledProps)(propsWithDefault);
|
|
267
|
-
const getOwnerProps = (0, import_react.useCallback)(() => propsWithDefault, [propsWithDefault]);
|
|
268
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardContext.Provider, { value: { isMultiSelect, disabled, isSelected, onClick }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
269
|
-
StyledCardContainer,
|
|
270
|
-
{
|
|
271
|
-
border: "solid 1px neutral-100",
|
|
272
|
-
boxShadow: "xs",
|
|
273
|
-
isOverlay,
|
|
274
|
-
...globalsAttrs,
|
|
275
|
-
...xstyledProps,
|
|
276
|
-
"data-disabled": disabled,
|
|
277
|
-
"data-selected": isSelected,
|
|
278
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FocusRing, { target: `[data-testid=${DSCardV3DataTestIds.ACTION_AREA}]`, hasError, children: [
|
|
279
|
-
onClick ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
280
|
-
CardActionArea,
|
|
281
|
-
{
|
|
282
|
-
disabled,
|
|
283
|
-
"data-testid": DSCardV3DataTestIds.ACTION_AREA,
|
|
284
|
-
"aria-selected": isSelected,
|
|
285
|
-
"aria-multiselectable": isMultiSelect,
|
|
286
|
-
"aria-disabled": disabled,
|
|
287
|
-
"aria-invalid": hasError,
|
|
288
|
-
getOwnerProps
|
|
289
|
-
}
|
|
290
|
-
) : null,
|
|
291
|
-
children
|
|
292
|
-
] })
|
|
293
|
-
}
|
|
294
|
-
) });
|
|
295
|
-
};
|
|
296
|
-
//# sourceMappingURL=CardV3.js.map
|
package/dist/cjs/CardV3.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/CardV3.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n/* eslint-disable react/display-name */\nimport React, { useMemo, useCallback } from 'react';\nimport { omit } from 'lodash';\nimport { Grid, type DSGridT } from '@elliemae/ds-grid';\nimport { styled, slotObjectToDataTestIds, xStyledCommonProps } from '@elliemae/ds-system';\nimport { PresentationalRadio } from '@elliemae/ds-controlled-form';\nimport {\n useMemoMergePropsWithDefault,\n useGetXstyledProps,\n useGetGlobalAttributes,\n type GlobalAttributesT,\n} from '@elliemae/ds-utilities';\n\nexport const DSCardV3Name = 'DSCardV3';\nexport const DSCardV3Slots = {\n ACTION_AREA: 'action-area',\n};\n\nexport const DSCardV3DataTestIds = slotObjectToDataTestIds(DSCardV3Name, DSCardV3Slots);\n\ndeclare namespace CardT {\n export interface RequiredProps {\n children: React.ReactNode;\n }\n\n export interface OptinalProps {\n isSelected?: boolean;\n isMultiSelect?: boolean;\n isOverlay?: boolean;\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n }\n\n export interface DefaultProps {\n hasError: boolean;\n }\n\n export interface Props\n extends RequiredProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof RequiredProps>,\n OptinalProps,\n DefaultProps {}\n export interface InternalProps\n extends RequiredProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof RequiredProps>,\n OptinalProps,\n Partial<DefaultProps> {}\n\n export interface CardSelectIndicatorProps {\n isSelected?: boolean;\n isMultiSelect?: boolean;\n }\n}\n\ninterface CardContextProps {\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n isSelected?: boolean;\n isMultiSelect?: boolean;\n disabled?: boolean;\n}\n\nconst defaultContext: CardContextProps = {\n isSelected: false,\n isMultiSelect: false,\n disabled: false,\n};\n\nconst CardContext = React.createContext<CardContextProps>(defaultContext);\n\nexport const defaultProps: CardT.DefaultProps = {\n hasError: false,\n};\n\nexport const CardActionArea = styled('button', {\n name: DSCardV3Name,\n slot: DSCardV3Slots.ACTION_AREA,\n})`\n border: none;\n background-color: transparent;\n width: 0px;\n height: 0px;\n padding: 0;\n &:focus {\n outline: none;\n }\n text-align: unset;\n`;\n\n// START style cards variants\nexport const StyledCard = styled(Grid)<{\n isOverlay?: boolean;\n onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n}>`\n min-width: 240px;\n min-height: 56px;\n background-color: ${({ theme, isOverlay }) => (isOverlay ? theme.colors.neutral['080'] : 'white')};\n outline-offset: -2px;\n * {\n color: ${({ theme, isOverlay }) => (isOverlay ? theme.colors.neutral['500'] : 'inherit')};\n }\n\n ${xStyledCommonProps}\n`;\n\nexport const StyledButtonCard = styled(StyledCard)<{ isOverlay?: boolean }>`\n cursor: pointer;\n`;\n\nexport const StyledCardError = styled(StyledCard)`\n outline: ${({ theme }) => `2px solid ${theme.colors.danger[900]}`};\n`;\n\nexport const StyledCardSingleIndicator = styled(Grid)<{ isSelected?: boolean }>`\n width: ${({ isSelected }) => (isSelected ? '6px' : '4px')};\n align-self: normal;\n background-color: ${({ theme, isSelected }) => {\n if (isSelected) return theme.colors.brand['700'];\n return theme.colors.brand['300'];\n }};\n transition: all 0.1s ease-in-out;\n\n ${StyledCard}:not([data-disabled='true']):not([data-selected='true']):hover & {\n background-color: ${({ theme }) => theme.colors.brand['500']};\n }\n`;\n\nexport const StyledCardDisabled = styled(StyledCard)`\n cursor: not-allowed;\n user-select: none;\n opacity: 0.5;\n ${StyledCardSingleIndicator} {\n background-color: ${({ theme, isSelected }) =>\n isSelected ? theme.colors.neutral['800'] : theme.colors.neutral['080']};\n }\n\n ${CardActionArea} {\n pointer-events: none;\n }\n`;\n\nexport const CardSelectIndicator = (props: CardT.CardSelectIndicatorProps) => {\n const { isSelected, isMultiSelect } = props;\n if (!isMultiSelect) {\n return (\n <Grid alignItems=\"center\">\n <PresentationalRadio checked={isSelected} aria-label=\"@todo\" device=\"desktop\" />\n </Grid>\n );\n }\n return <StyledCardSingleIndicator isSelected={isSelected} />;\n};\n\ninterface CardElementsProps extends DSGridT.InternalProps {\n children: React.ReactNode;\n}\nexport const CardHeader = (props: CardElementsProps) => {\n const { isSelected, isMultiSelect, onClick } = React.useContext(CardContext);\n const { children, ...rest } = props;\n if (isSelected !== undefined && isMultiSelect && onClick) {\n return (\n <Grid\n cols={['12px', 'auto']}\n data-type=\"card-header\"\n padding=\"xxxs\"\n alignItems=\"center\"\n minHeight=\"56px\"\n {...rest}\n >\n <CardSelectIndicator isSelected={isSelected} isMultiSelect={isMultiSelect} />\n <Grid py=\"xxxs\" paddingRight=\"xxs2\">\n {children}\n </Grid>\n </Grid>\n );\n }\n if (isSelected !== undefined && !isMultiSelect && onClick) {\n return (\n <Grid\n cols={['16px', 'auto']}\n data-type=\"card-header\"\n gutter=\"xxs\"\n px=\"xs\"\n py=\"xxs\"\n alignItems=\"center\"\n minHeight=\"56px\"\n {...rest}\n >\n <CardSelectIndicator isSelected={isSelected} isMultiSelect={isMultiSelect} />\n <Grid py=\"xxxs\" paddingRight=\"xxs2\">\n {children}\n </Grid>\n </Grid>\n );\n }\n return (\n <Grid data-type=\"card-header\" px=\"xs\" py=\"xxs\" gutter=\"xxs\" alignItems=\"center\" minHeight=\"56px\" {...rest}>\n {children}\n </Grid>\n );\n};\n\nexport const CardFooter = (props: CardElementsProps) => {\n const { children, ...rest } = props;\n return (\n <Grid\n data-type=\"card-footer\"\n px=\"xs\"\n py=\"xxs\"\n gutter=\"xxs\"\n borderTop=\"1px solid #CBCFD7\"\n minHeight=\"40px\"\n alignItems=\"center\"\n {...rest}\n >\n {children}\n </Grid>\n );\n};\n\nexport const CardContent = (props: CardElementsProps) => {\n const { children, ...rest } = props;\n return (\n <Grid\n data-type=\"card-content\"\n gutter=\"xxs\"\n px=\"xs\"\n py=\"xxs\"\n paddingTop=\"0px\"\n minHeight=\"64px\"\n alignItems=\"center\"\n {...rest}\n >\n {children}\n </Grid>\n );\n};\n\nconst StyledFocusRing = styled(Grid)<{ showFocusRing: boolean; hasError?: boolean }>`\n width: 100%;\n height: 100%;\n outline-offset: -1px;\n outline: ${({ showFocusRing, hasError, theme }) => {\n if (showFocusRing) {\n return `2px solid ${theme.colors.brand[700]}`;\n }\n if (hasError) {\n return `2px solid ${theme.colors.danger[900]}`;\n }\n return 'none';\n }};\n`;\n\ninterface FocusRingProps {\n target: string;\n children: React.ReactNode;\n hasError?: boolean;\n}\nconst FocusRing = (props: FocusRingProps) => {\n const { target, children, hasError } = props;\n const [showFocusRing, setShowFocusingRing] = React.useState(false);\n const handleOnFocus: React.FocusEventHandler<HTMLDivElement> = React.useCallback(\n (e) => {\n if (e.target.matches(target)) {\n setShowFocusingRing(true);\n }\n },\n [target],\n );\n\n const handleOnBlur: React.FocusEventHandler<HTMLDivElement> = React.useCallback(\n (e) => {\n if (e.target.matches(target)) {\n setShowFocusingRing(false);\n }\n },\n [target],\n );\n return (\n <StyledFocusRing\n hasError={hasError}\n onFocusCapture={handleOnFocus}\n onBlurCapture={handleOnBlur}\n showFocusRing={showFocusRing}\n >\n {children}\n </StyledFocusRing>\n );\n};\n\n// create acontext\n\nexport const Card: React.ComponentType<CardT.InternalProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<CardT.Props>(props, defaultProps);\n const { children, hasError, disabled, isOverlay, onClick, isSelected, isMultiSelect } = propsWithDefault;\n\n const StyledCardContainer = useMemo(() => {\n if (onClick && !disabled) {\n return StyledButtonCard;\n }\n if (disabled) {\n return StyledCardDisabled;\n }\n return StyledCard;\n }, [disabled, onClick]);\n\n const globalsAttrs = omit(useGetGlobalAttributes(propsWithDefault), ['cols', 'rows', 'wrap']);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n const getOwnerProps = useCallback(() => propsWithDefault, [propsWithDefault]);\n\n return (\n <CardContext.Provider value={{ isMultiSelect, disabled, isSelected, onClick }}>\n <StyledCardContainer\n border=\"solid 1px neutral-100\"\n boxShadow=\"xs\"\n isOverlay={isOverlay}\n {...globalsAttrs}\n {...xstyledProps}\n data-disabled={disabled}\n data-selected={isSelected}\n >\n <FocusRing target={`[data-testid=${DSCardV3DataTestIds.ACTION_AREA}]`} hasError={hasError}>\n {onClick ? (\n <CardActionArea\n disabled={disabled}\n data-testid={DSCardV3DataTestIds.ACTION_AREA}\n aria-selected={isSelected}\n aria-multiselectable={isMultiSelect}\n aria-disabled={disabled}\n aria-invalid={hasError}\n getOwnerProps={getOwnerProps}\n />\n ) : null}\n {children}\n </FocusRing>\n </StyledCardContainer>\n </CardContext.Provider>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkJf;AA/IR,mBAA4C;AAC5C,oBAAqB;AACrB,qBAAmC;AACnC,uBAAoE;AACpE,gCAAoC;AACpC,0BAKO;AAEA,MAAM,eAAe;AACrB,MAAM,gBAAgB;AAAA,EAC3B,aAAa;AACf;AAEO,MAAM,0BAAsB,0CAAwB,cAAc,aAAa;AA0CtF,MAAM,iBAAmC;AAAA,EACvC,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,UAAU;AACZ;AAEA,MAAM,cAAc,aAAAA,QAAM,cAAgC,cAAc;AAEjE,MAAM,eAAmC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";
|
|
3
|
-
import React2, { useMemo, useCallback } from "react";
|
|
4
|
-
import { omit } from "lodash";
|
|
5
|
-
import { Grid } from "@elliemae/ds-grid";
|
|
6
|
-
import { styled, slotObjectToDataTestIds, xStyledCommonProps } from "@elliemae/ds-system";
|
|
7
|
-
import { PresentationalRadio } from "@elliemae/ds-controlled-form";
|
|
8
|
-
import {
|
|
9
|
-
useMemoMergePropsWithDefault,
|
|
10
|
-
useGetXstyledProps,
|
|
11
|
-
useGetGlobalAttributes
|
|
12
|
-
} from "@elliemae/ds-utilities";
|
|
13
|
-
const DSCardV3Name = "DSCardV3";
|
|
14
|
-
const DSCardV3Slots = {
|
|
15
|
-
ACTION_AREA: "action-area"
|
|
16
|
-
};
|
|
17
|
-
const DSCardV3DataTestIds = slotObjectToDataTestIds(DSCardV3Name, DSCardV3Slots);
|
|
18
|
-
const defaultContext = {
|
|
19
|
-
isSelected: false,
|
|
20
|
-
isMultiSelect: false,
|
|
21
|
-
disabled: false
|
|
22
|
-
};
|
|
23
|
-
const CardContext = React2.createContext(defaultContext);
|
|
24
|
-
const defaultProps = {
|
|
25
|
-
hasError: false
|
|
26
|
-
};
|
|
27
|
-
const CardActionArea = styled("button", {
|
|
28
|
-
name: DSCardV3Name,
|
|
29
|
-
slot: DSCardV3Slots.ACTION_AREA
|
|
30
|
-
})`
|
|
31
|
-
border: none;
|
|
32
|
-
background-color: transparent;
|
|
33
|
-
width: 0px;
|
|
34
|
-
height: 0px;
|
|
35
|
-
padding: 0;
|
|
36
|
-
&:focus {
|
|
37
|
-
outline: none;
|
|
38
|
-
}
|
|
39
|
-
text-align: unset;
|
|
40
|
-
`;
|
|
41
|
-
const StyledCard = styled(Grid)`
|
|
42
|
-
min-width: 240px;
|
|
43
|
-
min-height: 56px;
|
|
44
|
-
background-color: ${({ theme, isOverlay }) => isOverlay ? theme.colors.neutral["080"] : "white"};
|
|
45
|
-
outline-offset: -2px;
|
|
46
|
-
* {
|
|
47
|
-
color: ${({ theme, isOverlay }) => isOverlay ? theme.colors.neutral["500"] : "inherit"};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
${xStyledCommonProps}
|
|
51
|
-
`;
|
|
52
|
-
const StyledButtonCard = styled(StyledCard)`
|
|
53
|
-
cursor: pointer;
|
|
54
|
-
`;
|
|
55
|
-
const StyledCardError = styled(StyledCard)`
|
|
56
|
-
outline: ${({ theme }) => `2px solid ${theme.colors.danger[900]}`};
|
|
57
|
-
`;
|
|
58
|
-
const StyledCardSingleIndicator = styled(Grid)`
|
|
59
|
-
width: ${({ isSelected }) => isSelected ? "6px" : "4px"};
|
|
60
|
-
align-self: normal;
|
|
61
|
-
background-color: ${({ theme, isSelected }) => {
|
|
62
|
-
if (isSelected)
|
|
63
|
-
return theme.colors.brand["700"];
|
|
64
|
-
return theme.colors.brand["300"];
|
|
65
|
-
}};
|
|
66
|
-
transition: all 0.1s ease-in-out;
|
|
67
|
-
|
|
68
|
-
${StyledCard}:not([data-disabled='true']):not([data-selected='true']):hover & {
|
|
69
|
-
background-color: ${({ theme }) => theme.colors.brand["500"]};
|
|
70
|
-
}
|
|
71
|
-
`;
|
|
72
|
-
const StyledCardDisabled = styled(StyledCard)`
|
|
73
|
-
cursor: not-allowed;
|
|
74
|
-
user-select: none;
|
|
75
|
-
opacity: 0.5;
|
|
76
|
-
${StyledCardSingleIndicator} {
|
|
77
|
-
background-color: ${({ theme, isSelected }) => isSelected ? theme.colors.neutral["800"] : theme.colors.neutral["080"]};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
${CardActionArea} {
|
|
81
|
-
pointer-events: none;
|
|
82
|
-
}
|
|
83
|
-
`;
|
|
84
|
-
const CardSelectIndicator = (props) => {
|
|
85
|
-
const { isSelected, isMultiSelect } = props;
|
|
86
|
-
if (!isMultiSelect) {
|
|
87
|
-
return /* @__PURE__ */ jsx(Grid, { alignItems: "center", children: /* @__PURE__ */ jsx(PresentationalRadio, { checked: isSelected, "aria-label": "@todo", device: "desktop" }) });
|
|
88
|
-
}
|
|
89
|
-
return /* @__PURE__ */ jsx(StyledCardSingleIndicator, { isSelected });
|
|
90
|
-
};
|
|
91
|
-
const CardHeader = (props) => {
|
|
92
|
-
const { isSelected, isMultiSelect, onClick } = React2.useContext(CardContext);
|
|
93
|
-
const { children, ...rest } = props;
|
|
94
|
-
if (isSelected !== void 0 && isMultiSelect && onClick) {
|
|
95
|
-
return /* @__PURE__ */ jsxs(
|
|
96
|
-
Grid,
|
|
97
|
-
{
|
|
98
|
-
cols: ["12px", "auto"],
|
|
99
|
-
"data-type": "card-header",
|
|
100
|
-
padding: "xxxs",
|
|
101
|
-
alignItems: "center",
|
|
102
|
-
minHeight: "56px",
|
|
103
|
-
...rest,
|
|
104
|
-
children: [
|
|
105
|
-
/* @__PURE__ */ jsx(CardSelectIndicator, { isSelected, isMultiSelect }),
|
|
106
|
-
/* @__PURE__ */ jsx(Grid, { py: "xxxs", paddingRight: "xxs2", children })
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
if (isSelected !== void 0 && !isMultiSelect && onClick) {
|
|
112
|
-
return /* @__PURE__ */ jsxs(
|
|
113
|
-
Grid,
|
|
114
|
-
{
|
|
115
|
-
cols: ["16px", "auto"],
|
|
116
|
-
"data-type": "card-header",
|
|
117
|
-
gutter: "xxs",
|
|
118
|
-
px: "xs",
|
|
119
|
-
py: "xxs",
|
|
120
|
-
alignItems: "center",
|
|
121
|
-
minHeight: "56px",
|
|
122
|
-
...rest,
|
|
123
|
-
children: [
|
|
124
|
-
/* @__PURE__ */ jsx(CardSelectIndicator, { isSelected, isMultiSelect }),
|
|
125
|
-
/* @__PURE__ */ jsx(Grid, { py: "xxxs", paddingRight: "xxs2", children })
|
|
126
|
-
]
|
|
127
|
-
}
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
return /* @__PURE__ */ jsx(Grid, { "data-type": "card-header", px: "xs", py: "xxs", gutter: "xxs", alignItems: "center", minHeight: "56px", ...rest, children });
|
|
131
|
-
};
|
|
132
|
-
const CardFooter = (props) => {
|
|
133
|
-
const { children, ...rest } = props;
|
|
134
|
-
return /* @__PURE__ */ jsx(
|
|
135
|
-
Grid,
|
|
136
|
-
{
|
|
137
|
-
"data-type": "card-footer",
|
|
138
|
-
px: "xs",
|
|
139
|
-
py: "xxs",
|
|
140
|
-
gutter: "xxs",
|
|
141
|
-
borderTop: "1px solid #CBCFD7",
|
|
142
|
-
minHeight: "40px",
|
|
143
|
-
alignItems: "center",
|
|
144
|
-
...rest,
|
|
145
|
-
children
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
|
-
};
|
|
149
|
-
const CardContent = (props) => {
|
|
150
|
-
const { children, ...rest } = props;
|
|
151
|
-
return /* @__PURE__ */ jsx(
|
|
152
|
-
Grid,
|
|
153
|
-
{
|
|
154
|
-
"data-type": "card-content",
|
|
155
|
-
gutter: "xxs",
|
|
156
|
-
px: "xs",
|
|
157
|
-
py: "xxs",
|
|
158
|
-
paddingTop: "0px",
|
|
159
|
-
minHeight: "64px",
|
|
160
|
-
alignItems: "center",
|
|
161
|
-
...rest,
|
|
162
|
-
children
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
};
|
|
166
|
-
const StyledFocusRing = styled(Grid)`
|
|
167
|
-
width: 100%;
|
|
168
|
-
height: 100%;
|
|
169
|
-
outline-offset: -1px;
|
|
170
|
-
outline: ${({ showFocusRing, hasError, theme }) => {
|
|
171
|
-
if (showFocusRing) {
|
|
172
|
-
return `2px solid ${theme.colors.brand[700]}`;
|
|
173
|
-
}
|
|
174
|
-
if (hasError) {
|
|
175
|
-
return `2px solid ${theme.colors.danger[900]}`;
|
|
176
|
-
}
|
|
177
|
-
return "none";
|
|
178
|
-
}};
|
|
179
|
-
`;
|
|
180
|
-
const FocusRing = (props) => {
|
|
181
|
-
const { target, children, hasError } = props;
|
|
182
|
-
const [showFocusRing, setShowFocusingRing] = React2.useState(false);
|
|
183
|
-
const handleOnFocus = React2.useCallback(
|
|
184
|
-
(e) => {
|
|
185
|
-
if (e.target.matches(target)) {
|
|
186
|
-
setShowFocusingRing(true);
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
[target]
|
|
190
|
-
);
|
|
191
|
-
const handleOnBlur = React2.useCallback(
|
|
192
|
-
(e) => {
|
|
193
|
-
if (e.target.matches(target)) {
|
|
194
|
-
setShowFocusingRing(false);
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
[target]
|
|
198
|
-
);
|
|
199
|
-
return /* @__PURE__ */ jsx(
|
|
200
|
-
StyledFocusRing,
|
|
201
|
-
{
|
|
202
|
-
hasError,
|
|
203
|
-
onFocusCapture: handleOnFocus,
|
|
204
|
-
onBlurCapture: handleOnBlur,
|
|
205
|
-
showFocusRing,
|
|
206
|
-
children
|
|
207
|
-
}
|
|
208
|
-
);
|
|
209
|
-
};
|
|
210
|
-
const Card = (props) => {
|
|
211
|
-
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
212
|
-
const { children, hasError, disabled, isOverlay, onClick, isSelected, isMultiSelect } = propsWithDefault;
|
|
213
|
-
const StyledCardContainer = useMemo(() => {
|
|
214
|
-
if (onClick && !disabled) {
|
|
215
|
-
return StyledButtonCard;
|
|
216
|
-
}
|
|
217
|
-
if (disabled) {
|
|
218
|
-
return StyledCardDisabled;
|
|
219
|
-
}
|
|
220
|
-
return StyledCard;
|
|
221
|
-
}, [disabled, onClick]);
|
|
222
|
-
const globalsAttrs = omit(useGetGlobalAttributes(propsWithDefault), ["cols", "rows", "wrap"]);
|
|
223
|
-
const xstyledProps = useGetXstyledProps(propsWithDefault);
|
|
224
|
-
const getOwnerProps = useCallback(() => propsWithDefault, [propsWithDefault]);
|
|
225
|
-
return /* @__PURE__ */ jsx(CardContext.Provider, { value: { isMultiSelect, disabled, isSelected, onClick }, children: /* @__PURE__ */ jsx(
|
|
226
|
-
StyledCardContainer,
|
|
227
|
-
{
|
|
228
|
-
border: "solid 1px neutral-100",
|
|
229
|
-
boxShadow: "xs",
|
|
230
|
-
isOverlay,
|
|
231
|
-
...globalsAttrs,
|
|
232
|
-
...xstyledProps,
|
|
233
|
-
"data-disabled": disabled,
|
|
234
|
-
"data-selected": isSelected,
|
|
235
|
-
children: /* @__PURE__ */ jsxs(FocusRing, { target: `[data-testid=${DSCardV3DataTestIds.ACTION_AREA}]`, hasError, children: [
|
|
236
|
-
onClick ? /* @__PURE__ */ jsx(
|
|
237
|
-
CardActionArea,
|
|
238
|
-
{
|
|
239
|
-
disabled,
|
|
240
|
-
"data-testid": DSCardV3DataTestIds.ACTION_AREA,
|
|
241
|
-
"aria-selected": isSelected,
|
|
242
|
-
"aria-multiselectable": isMultiSelect,
|
|
243
|
-
"aria-disabled": disabled,
|
|
244
|
-
"aria-invalid": hasError,
|
|
245
|
-
getOwnerProps
|
|
246
|
-
}
|
|
247
|
-
) : null,
|
|
248
|
-
children
|
|
249
|
-
] })
|
|
250
|
-
}
|
|
251
|
-
) });
|
|
252
|
-
};
|
|
253
|
-
export {
|
|
254
|
-
Card,
|
|
255
|
-
CardActionArea,
|
|
256
|
-
CardContent,
|
|
257
|
-
CardFooter,
|
|
258
|
-
CardHeader,
|
|
259
|
-
CardSelectIndicator,
|
|
260
|
-
DSCardV3DataTestIds,
|
|
261
|
-
DSCardV3Name,
|
|
262
|
-
DSCardV3Slots,
|
|
263
|
-
StyledButtonCard,
|
|
264
|
-
StyledCard,
|
|
265
|
-
StyledCardDisabled,
|
|
266
|
-
StyledCardError,
|
|
267
|
-
StyledCardSingleIndicator,
|
|
268
|
-
defaultProps
|
|
269
|
-
};
|
|
270
|
-
//# sourceMappingURL=CardV3.js.map
|
package/dist/esm/CardV3.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/CardV3.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n/* eslint-disable react/display-name */\nimport React, { useMemo, useCallback } from 'react';\nimport { omit } from 'lodash';\nimport { Grid, type DSGridT } from '@elliemae/ds-grid';\nimport { styled, slotObjectToDataTestIds, xStyledCommonProps } from '@elliemae/ds-system';\nimport { PresentationalRadio } from '@elliemae/ds-controlled-form';\nimport {\n useMemoMergePropsWithDefault,\n useGetXstyledProps,\n useGetGlobalAttributes,\n type GlobalAttributesT,\n} from '@elliemae/ds-utilities';\n\nexport const DSCardV3Name = 'DSCardV3';\nexport const DSCardV3Slots = {\n ACTION_AREA: 'action-area',\n};\n\nexport const DSCardV3DataTestIds = slotObjectToDataTestIds(DSCardV3Name, DSCardV3Slots);\n\ndeclare namespace CardT {\n export interface RequiredProps {\n children: React.ReactNode;\n }\n\n export interface OptinalProps {\n isSelected?: boolean;\n isMultiSelect?: boolean;\n isOverlay?: boolean;\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n }\n\n export interface DefaultProps {\n hasError: boolean;\n }\n\n export interface Props\n extends RequiredProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof RequiredProps>,\n OptinalProps,\n DefaultProps {}\n export interface InternalProps\n extends RequiredProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof RequiredProps>,\n OptinalProps,\n Partial<DefaultProps> {}\n\n export interface CardSelectIndicatorProps {\n isSelected?: boolean;\n isMultiSelect?: boolean;\n }\n}\n\ninterface CardContextProps {\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n isSelected?: boolean;\n isMultiSelect?: boolean;\n disabled?: boolean;\n}\n\nconst defaultContext: CardContextProps = {\n isSelected: false,\n isMultiSelect: false,\n disabled: false,\n};\n\nconst CardContext = React.createContext<CardContextProps>(defaultContext);\n\nexport const defaultProps: CardT.DefaultProps = {\n hasError: false,\n};\n\nexport const CardActionArea = styled('button', {\n name: DSCardV3Name,\n slot: DSCardV3Slots.ACTION_AREA,\n})`\n border: none;\n background-color: transparent;\n width: 0px;\n height: 0px;\n padding: 0;\n &:focus {\n outline: none;\n }\n text-align: unset;\n`;\n\n// START style cards variants\nexport const StyledCard = styled(Grid)<{\n isOverlay?: boolean;\n onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n}>`\n min-width: 240px;\n min-height: 56px;\n background-color: ${({ theme, isOverlay }) => (isOverlay ? theme.colors.neutral['080'] : 'white')};\n outline-offset: -2px;\n * {\n color: ${({ theme, isOverlay }) => (isOverlay ? theme.colors.neutral['500'] : 'inherit')};\n }\n\n ${xStyledCommonProps}\n`;\n\nexport const StyledButtonCard = styled(StyledCard)<{ isOverlay?: boolean }>`\n cursor: pointer;\n`;\n\nexport const StyledCardError = styled(StyledCard)`\n outline: ${({ theme }) => `2px solid ${theme.colors.danger[900]}`};\n`;\n\nexport const StyledCardSingleIndicator = styled(Grid)<{ isSelected?: boolean }>`\n width: ${({ isSelected }) => (isSelected ? '6px' : '4px')};\n align-self: normal;\n background-color: ${({ theme, isSelected }) => {\n if (isSelected) return theme.colors.brand['700'];\n return theme.colors.brand['300'];\n }};\n transition: all 0.1s ease-in-out;\n\n ${StyledCard}:not([data-disabled='true']):not([data-selected='true']):hover & {\n background-color: ${({ theme }) => theme.colors.brand['500']};\n }\n`;\n\nexport const StyledCardDisabled = styled(StyledCard)`\n cursor: not-allowed;\n user-select: none;\n opacity: 0.5;\n ${StyledCardSingleIndicator} {\n background-color: ${({ theme, isSelected }) =>\n isSelected ? theme.colors.neutral['800'] : theme.colors.neutral['080']};\n }\n\n ${CardActionArea} {\n pointer-events: none;\n }\n`;\n\nexport const CardSelectIndicator = (props: CardT.CardSelectIndicatorProps) => {\n const { isSelected, isMultiSelect } = props;\n if (!isMultiSelect) {\n return (\n <Grid alignItems=\"center\">\n <PresentationalRadio checked={isSelected} aria-label=\"@todo\" device=\"desktop\" />\n </Grid>\n );\n }\n return <StyledCardSingleIndicator isSelected={isSelected} />;\n};\n\ninterface CardElementsProps extends DSGridT.InternalProps {\n children: React.ReactNode;\n}\nexport const CardHeader = (props: CardElementsProps) => {\n const { isSelected, isMultiSelect, onClick } = React.useContext(CardContext);\n const { children, ...rest } = props;\n if (isSelected !== undefined && isMultiSelect && onClick) {\n return (\n <Grid\n cols={['12px', 'auto']}\n data-type=\"card-header\"\n padding=\"xxxs\"\n alignItems=\"center\"\n minHeight=\"56px\"\n {...rest}\n >\n <CardSelectIndicator isSelected={isSelected} isMultiSelect={isMultiSelect} />\n <Grid py=\"xxxs\" paddingRight=\"xxs2\">\n {children}\n </Grid>\n </Grid>\n );\n }\n if (isSelected !== undefined && !isMultiSelect && onClick) {\n return (\n <Grid\n cols={['16px', 'auto']}\n data-type=\"card-header\"\n gutter=\"xxs\"\n px=\"xs\"\n py=\"xxs\"\n alignItems=\"center\"\n minHeight=\"56px\"\n {...rest}\n >\n <CardSelectIndicator isSelected={isSelected} isMultiSelect={isMultiSelect} />\n <Grid py=\"xxxs\" paddingRight=\"xxs2\">\n {children}\n </Grid>\n </Grid>\n );\n }\n return (\n <Grid data-type=\"card-header\" px=\"xs\" py=\"xxs\" gutter=\"xxs\" alignItems=\"center\" minHeight=\"56px\" {...rest}>\n {children}\n </Grid>\n );\n};\n\nexport const CardFooter = (props: CardElementsProps) => {\n const { children, ...rest } = props;\n return (\n <Grid\n data-type=\"card-footer\"\n px=\"xs\"\n py=\"xxs\"\n gutter=\"xxs\"\n borderTop=\"1px solid #CBCFD7\"\n minHeight=\"40px\"\n alignItems=\"center\"\n {...rest}\n >\n {children}\n </Grid>\n );\n};\n\nexport const CardContent = (props: CardElementsProps) => {\n const { children, ...rest } = props;\n return (\n <Grid\n data-type=\"card-content\"\n gutter=\"xxs\"\n px=\"xs\"\n py=\"xxs\"\n paddingTop=\"0px\"\n minHeight=\"64px\"\n alignItems=\"center\"\n {...rest}\n >\n {children}\n </Grid>\n );\n};\n\nconst StyledFocusRing = styled(Grid)<{ showFocusRing: boolean; hasError?: boolean }>`\n width: 100%;\n height: 100%;\n outline-offset: -1px;\n outline: ${({ showFocusRing, hasError, theme }) => {\n if (showFocusRing) {\n return `2px solid ${theme.colors.brand[700]}`;\n }\n if (hasError) {\n return `2px solid ${theme.colors.danger[900]}`;\n }\n return 'none';\n }};\n`;\n\ninterface FocusRingProps {\n target: string;\n children: React.ReactNode;\n hasError?: boolean;\n}\nconst FocusRing = (props: FocusRingProps) => {\n const { target, children, hasError } = props;\n const [showFocusRing, setShowFocusingRing] = React.useState(false);\n const handleOnFocus: React.FocusEventHandler<HTMLDivElement> = React.useCallback(\n (e) => {\n if (e.target.matches(target)) {\n setShowFocusingRing(true);\n }\n },\n [target],\n );\n\n const handleOnBlur: React.FocusEventHandler<HTMLDivElement> = React.useCallback(\n (e) => {\n if (e.target.matches(target)) {\n setShowFocusingRing(false);\n }\n },\n [target],\n );\n return (\n <StyledFocusRing\n hasError={hasError}\n onFocusCapture={handleOnFocus}\n onBlurCapture={handleOnBlur}\n showFocusRing={showFocusRing}\n >\n {children}\n </StyledFocusRing>\n );\n};\n\n// create acontext\n\nexport const Card: React.ComponentType<CardT.InternalProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<CardT.Props>(props, defaultProps);\n const { children, hasError, disabled, isOverlay, onClick, isSelected, isMultiSelect } = propsWithDefault;\n\n const StyledCardContainer = useMemo(() => {\n if (onClick && !disabled) {\n return StyledButtonCard;\n }\n if (disabled) {\n return StyledCardDisabled;\n }\n return StyledCard;\n }, [disabled, onClick]);\n\n const globalsAttrs = omit(useGetGlobalAttributes(propsWithDefault), ['cols', 'rows', 'wrap']);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n const getOwnerProps = useCallback(() => propsWithDefault, [propsWithDefault]);\n\n return (\n <CardContext.Provider value={{ isMultiSelect, disabled, isSelected, onClick }}>\n <StyledCardContainer\n border=\"solid 1px neutral-100\"\n boxShadow=\"xs\"\n isOverlay={isOverlay}\n {...globalsAttrs}\n {...xstyledProps}\n data-disabled={disabled}\n data-selected={isSelected}\n >\n <FocusRing target={`[data-testid=${DSCardV3DataTestIds.ACTION_AREA}]`} hasError={hasError}>\n {onClick ? (\n <CardActionArea\n disabled={disabled}\n data-testid={DSCardV3DataTestIds.ACTION_AREA}\n aria-selected={isSelected}\n aria-multiselectable={isMultiSelect}\n aria-disabled={disabled}\n aria-invalid={hasError}\n getOwnerProps={getOwnerProps}\n />\n ) : null}\n {children}\n </FocusRing>\n </StyledCardContainer>\n </CardContext.Provider>\n );\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACkJf,cAeF,YAfE;AA/IR,OAAOA,UAAS,SAAS,mBAAmB;AAC5C,SAAS,YAAY;AACrB,SAAS,YAA0B;AACnC,SAAS,QAAQ,yBAAyB,0BAA0B;AACpE,SAAS,2BAA2B;AACpC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEA,MAAM,eAAe;AACrB,MAAM,gBAAgB;AAAA,EAC3B,aAAa;AACf;AAEO,MAAM,sBAAsB,wBAAwB,cAAc,aAAa;AA0CtF,MAAM,iBAAmC;AAAA,EACvC,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,UAAU;AACZ;AAEA,MAAM,cAAcA,OAAM,cAAgC,cAAc;AAEjE,MAAM,eAAmC;AAAA,EAC9C,UAAU;AACZ;AAEO,MAAM,iBAAiB,OAAO,UAAU;AAAA,EAC7C,MAAM;AAAA,EACN,MAAM,cAAc;AACtB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaM,MAAM,aAAa,OAAO,IAAI;AAAA;AAAA;AAAA,sBAMf,CAAC,EAAE,OAAO,UAAU,MAAO,YAAY,MAAM,OAAO,QAAQ,KAAK,IAAI;AAAA;AAAA;AAAA,aAG9E,CAAC,EAAE,OAAO,UAAU,MAAO,YAAY,MAAM,OAAO,QAAQ,KAAK,IAAI;AAAA;AAAA;A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QAAQ,QAAQ,MAAM,CAAC;AAC5F,QAAM,eAAe,mBAAmB,gBAAgB;AACxD,QAAM,gBAAgB,YAAY,MAAM,kBAAkB,CAAC,gBAAgB,CAAC;AAE5E,SACE,oBAAC,YAAY,UAAZ,EAAqB,OAAO,EAAE,eAAe,UAAU,YAAY,QAAQ,GAC1E;AAAA,IAAC;AAAA;AAAA,MACC,QAAO;AAAA,MACP,WAAU;AAAA,MACV;AAAA,MACC,GAAG;AAAA,MACH,GAAG;AAAA,MACJ,iBAAe;AAAA,MACf,iBAAe;AAAA,MAEf,+BAAC,aAAU,QAAQ,gBAAgB,oBAAoB,gBAAgB,UACpE;AAAA,kBACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,eAAa,oBAAoB;AAAA,YACjC,iBAAe;AAAA,YACf,wBAAsB;AAAA,YACtB,iBAAe;AAAA,YACf,gBAAc;AAAA,YACd;AAAA;AAAA,QACF,IACE;AAAA,QACH;AAAA,SACH;AAAA;AAAA,EACF,GACF;AAEJ;",
|
|
6
|
-
"names": ["React"]
|
|
7
|
-
}
|
package/dist/types/CardV3.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type DSGridT } from '@elliemae/ds-grid';
|
|
3
|
-
import { type GlobalAttributesT } from '@elliemae/ds-utilities';
|
|
4
|
-
export declare const DSCardV3Name = "DSCardV3";
|
|
5
|
-
export declare const DSCardV3Slots: {
|
|
6
|
-
ACTION_AREA: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const DSCardV3DataTestIds: Record<string, string>;
|
|
9
|
-
declare namespace CardT {
|
|
10
|
-
interface RequiredProps {
|
|
11
|
-
children: React.ReactNode;
|
|
12
|
-
}
|
|
13
|
-
interface OptinalProps {
|
|
14
|
-
isSelected?: boolean;
|
|
15
|
-
isMultiSelect?: boolean;
|
|
16
|
-
isOverlay?: boolean;
|
|
17
|
-
onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
18
|
-
}
|
|
19
|
-
interface DefaultProps {
|
|
20
|
-
hasError: boolean;
|
|
21
|
-
}
|
|
22
|
-
interface Props extends RequiredProps, Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof RequiredProps>, OptinalProps, DefaultProps {
|
|
23
|
-
}
|
|
24
|
-
interface InternalProps extends RequiredProps, Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof RequiredProps>, OptinalProps, Partial<DefaultProps> {
|
|
25
|
-
}
|
|
26
|
-
interface CardSelectIndicatorProps {
|
|
27
|
-
isSelected?: boolean;
|
|
28
|
-
isMultiSelect?: boolean;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export declare const defaultProps: CardT.DefaultProps;
|
|
32
|
-
export declare const CardActionArea: import("styled-components").StyledComponent<"button", import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"button">, never>;
|
|
33
|
-
export declare const StyledCard: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, {
|
|
34
|
-
isOverlay?: boolean | undefined;
|
|
35
|
-
onClick?: ((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
|
|
36
|
-
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>>, never>;
|
|
37
|
-
export declare const StyledButtonCard: import("styled-components").StyledComponent<import("styled-components").StyledComponent<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, {
|
|
38
|
-
isOverlay?: boolean | undefined;
|
|
39
|
-
onClick?: ((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
|
|
40
|
-
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>>, never>, import("@elliemae/ds-system").Theme, {
|
|
41
|
-
isOverlay?: boolean | undefined;
|
|
42
|
-
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("styled-components").StyledComponent<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, {
|
|
43
|
-
isOverlay?: boolean | undefined;
|
|
44
|
-
onClick?: ((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
|
|
45
|
-
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>>, never>>, never>;
|
|
46
|
-
export declare const StyledCardError: import("styled-components").StyledComponent<import("styled-components").StyledComponent<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, {
|
|
47
|
-
isOverlay?: boolean | undefined;
|
|
48
|
-
onClick?: ((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
|
|
49
|
-
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>>, never>, import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("styled-components").StyledComponent<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, {
|
|
50
|
-
isOverlay?: boolean | undefined;
|
|
51
|
-
onClick?: ((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
|
|
52
|
-
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>>, never>>, never>;
|
|
53
|
-
export declare const StyledCardSingleIndicator: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, {
|
|
54
|
-
isSelected?: boolean | undefined;
|
|
55
|
-
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>>, never>;
|
|
56
|
-
export declare const StyledCardDisabled: import("styled-components").StyledComponent<import("styled-components").StyledComponent<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, {
|
|
57
|
-
isOverlay?: boolean | undefined;
|
|
58
|
-
onClick?: ((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
|
|
59
|
-
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>>, never>, import("@elliemae/ds-system").Theme, {
|
|
60
|
-
[x: string]: any;
|
|
61
|
-
[x: number]: any;
|
|
62
|
-
[x: symbol]: any;
|
|
63
|
-
} & {
|
|
64
|
-
theme?: import("@elliemae/ds-system").Theme | undefined;
|
|
65
|
-
} & {
|
|
66
|
-
as?: string | React.ComponentType<any> | undefined;
|
|
67
|
-
forwardedAs?: string | React.ComponentType<any> | undefined;
|
|
68
|
-
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("styled-components").StyledComponent<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, {
|
|
69
|
-
isOverlay?: boolean | undefined;
|
|
70
|
-
onClick?: ((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
|
|
71
|
-
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<React.ForwardRefExoticComponent<DSGridT.Props & React.RefAttributes<HTMLDivElement>>>, never>>, never>;
|
|
72
|
-
export declare const CardSelectIndicator: (props: CardT.CardSelectIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
73
|
-
interface CardElementsProps extends DSGridT.InternalProps {
|
|
74
|
-
children: React.ReactNode;
|
|
75
|
-
}
|
|
76
|
-
export declare const CardHeader: (props: CardElementsProps) => import("react/jsx-runtime").JSX.Element;
|
|
77
|
-
export declare const CardFooter: (props: CardElementsProps) => import("react/jsx-runtime").JSX.Element;
|
|
78
|
-
export declare const CardContent: (props: CardElementsProps) => import("react/jsx-runtime").JSX.Element;
|
|
79
|
-
export declare const Card: React.ComponentType<CardT.InternalProps>;
|
|
80
|
-
export {};
|