carbon-react 114.0.0 → 114.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/__internal__/utils/helpers/events/events.d.ts +5 -0
- package/esm/__internal__/utils/helpers/events/events.js +7 -0
- package/esm/__spec_helper__/mock-match-media.d.ts +4 -7
- package/esm/__spec_helper__/mock-match-media.js +4 -4
- package/esm/components/i18n-provider/i18n-provider.component.js +3 -0
- package/esm/components/inline-inputs/inline-inputs.component.d.ts +3 -1
- package/esm/components/inline-inputs/inline-inputs.component.js +6 -3
- package/esm/components/pod/index.d.ts +2 -2
- package/esm/components/pod/pod.component.d.ts +47 -0
- package/esm/components/pod/pod.component.js +289 -258
- package/esm/components/pod/pod.config.d.ts +6 -0
- package/esm/components/pod/pod.config.js +2 -2
- package/esm/components/pod/pod.style.d.ts +44 -0
- package/esm/components/pod/pod.style.js +151 -103
- package/esm/components/show-edit-pod/show-edit-pod.style.js +1 -1
- package/esm/components/tile/index.d.ts +2 -1
- package/esm/components/tile/tile-footer/index.d.ts +2 -1
- package/esm/components/tile/tile-footer/tile-footer.component.d.ts +9 -0
- package/esm/components/tile/tile-footer/tile-footer.component.js +160 -8
- package/esm/components/tile/tile-footer/tile-footer.style.d.ts +5 -0
- package/esm/components/tile/tile.component.d.ts +29 -0
- package/esm/components/tile/tile.component.js +330 -44
- package/esm/components/tile/tile.config.d.ts +2 -0
- package/esm/components/tile/tile.style.d.ts +12 -0
- package/esm/components/tile/tile.style.js +13 -21
- package/esm/hooks/useMediaQuery/useMediaQuery.js +2 -2
- package/esm/locales/en-gb.js +3 -0
- package/esm/locales/locale.d.ts +3 -0
- package/esm/locales/pl-pl.js +3 -0
- package/lib/__internal__/utils/helpers/events/events.d.ts +5 -0
- package/lib/__internal__/utils/helpers/events/events.js +7 -0
- package/lib/__spec_helper__/mock-match-media.d.ts +4 -7
- package/lib/__spec_helper__/mock-match-media.js +4 -4
- package/lib/components/i18n-provider/i18n-provider.component.js +3 -0
- package/lib/components/inline-inputs/inline-inputs.component.d.ts +3 -1
- package/lib/components/inline-inputs/inline-inputs.component.js +6 -3
- package/lib/components/pod/index.d.ts +2 -2
- package/lib/components/pod/pod.component.d.ts +47 -0
- package/lib/components/pod/pod.component.js +292 -259
- package/lib/components/pod/pod.config.d.ts +6 -0
- package/lib/components/pod/pod.config.js +4 -4
- package/lib/components/pod/pod.style.d.ts +44 -0
- package/lib/components/pod/pod.style.js +153 -106
- package/lib/components/show-edit-pod/show-edit-pod.style.js +4 -4
- package/lib/components/tile/index.d.ts +2 -1
- package/lib/components/tile/tile-footer/index.d.ts +2 -1
- package/lib/components/tile/tile-footer/tile-footer.component.d.ts +9 -0
- package/lib/components/tile/tile-footer/tile-footer.component.js +157 -11
- package/lib/components/tile/tile-footer/tile-footer.style.d.ts +5 -0
- package/lib/components/tile/tile.component.d.ts +29 -0
- package/lib/components/tile/tile.component.js +329 -46
- package/lib/components/tile/tile.config.d.ts +2 -0
- package/lib/components/tile/tile.style.d.ts +12 -0
- package/lib/components/tile/tile.style.js +13 -22
- package/lib/hooks/useMediaQuery/useMediaQuery.js +2 -2
- package/lib/locales/en-gb.js +3 -0
- package/lib/locales/locale.d.ts +3 -0
- package/lib/locales/pl-pl.js +3 -0
- package/package.json +6 -16
- package/esm/components/pod/pod.d.ts +0 -55
- package/esm/components/tile/tile-footer/tile-footer.d.ts +0 -13
- package/esm/components/tile/tile.d.ts +0 -46
- package/lib/components/pod/pod.d.ts +0 -55
- package/lib/components/tile/tile-footer/tile-footer.d.ts +0 -13
- package/lib/components/tile/tile.d.ts +0 -46
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
|
-
import React, { useState,
|
|
3
|
+
import React, { useState, useMemo } from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
9
|
-
import LocaleContext from "../../__internal__/i18n-context";
|
|
10
|
-
import { StyledBlock, StyledContent, StyledEditAction, StyledActionsContainer, StyledDeleteButton, StyledUndoButton, StyledFooter, StyledPod, StyledHeader, StyledSubtitle, StyledTitle } from "./pod.style.js";
|
|
5
|
+
import Logger from "../../__internal__/utils/logger";
|
|
6
|
+
import useLocale from "../../hooks/__internal__/useLocale";
|
|
7
|
+
import { StyledBlock, StyledContent, StyledEditAction, StyledActionsContainer, StyledDeleteButton, StyledUndoButton, StyledFooter, StyledPod, StyledHeader, StyledSubtitle, StyledTitle } from "./pod.style";
|
|
11
8
|
import Icon from "../icon";
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import Event from "../../__internal__/utils/helpers/events";
|
|
10
|
+
let deprecationOnEditStringWarnTriggered = false;
|
|
11
|
+
let deprecationOnEditObjectWarnTriggered = false;
|
|
12
|
+
const Pod = /*#__PURE__*/React.forwardRef(({
|
|
13
|
+
"data-element": dataElement,
|
|
14
|
+
"data-role": dataRole,
|
|
14
15
|
alignTitle = "left",
|
|
15
16
|
border = true,
|
|
16
17
|
children,
|
|
@@ -31,170 +32,55 @@ const Pod = /*#__PURE__*/forwardRef(({
|
|
|
31
32
|
variant = "primary",
|
|
32
33
|
...rest
|
|
33
34
|
}, ref) => {
|
|
35
|
+
if (!deprecationOnEditStringWarnTriggered && typeof onEdit === "string") {
|
|
36
|
+
deprecationOnEditStringWarnTriggered = true;
|
|
37
|
+
Logger.deprecate("Support for passing strings to the `onEdit` prop of the `Pod` component is now deprecated. Please only pass event handlers to `onEdit`.");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!deprecationOnEditObjectWarnTriggered && typeof onEdit === "object") {
|
|
41
|
+
deprecationOnEditObjectWarnTriggered = true;
|
|
42
|
+
Logger.deprecate("Support for passing objects to the `onEdit` prop of the `Pod` component is now deprecated. Please only pass event handlers to `onEdit`.");
|
|
43
|
+
}
|
|
44
|
+
|
|
34
45
|
const [isEditFocused, setEditFocused] = useState(false);
|
|
35
46
|
const [isEditHovered, setEditHovered] = useState(false);
|
|
36
47
|
const [isDeleteFocused, setDeleteFocused] = useState(false);
|
|
37
48
|
const [isDeleteHovered, setDeleteHovered] = useState(false);
|
|
38
49
|
const [isUndoFocused, setUndoFocused] = useState(false);
|
|
39
50
|
const [isUndoHovered, setUndoHovered] = useState(false);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
podHeight = `${height}px`;
|
|
44
|
-
} else if (height) {
|
|
45
|
-
podHeight = height;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const shouldContentHaveEditEvents = useCallback(() => {
|
|
49
|
-
return (triggerEditOnContent || displayEditButtonOnHover) && onEdit;
|
|
50
|
-
}, [displayEditButtonOnHover, onEdit, triggerEditOnContent]);
|
|
51
|
+
const l = useLocale();
|
|
52
|
+
const shouldContentHaveEditEvents = useMemo(() => !!(onEdit && (triggerEditOnContent || displayEditButtonOnHover)), [displayEditButtonOnHover, onEdit, triggerEditOnContent]);
|
|
53
|
+
const hasButtons = useMemo(() => !!(onEdit || onDelete || onUndo), [onEdit, onDelete, onUndo]);
|
|
51
54
|
|
|
52
55
|
const processPodAction = action => ev => {
|
|
53
|
-
if (Event.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
56
|
+
if (Event.isKeyboardEvent(ev) && Event.isEventType(ev, "keydown") && !Event.isEnterKey(ev)) return;
|
|
57
|
+
ev.preventDefault();
|
|
58
|
+
action(ev);
|
|
57
59
|
};
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return editProps;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function podHeader() {
|
|
76
|
-
if (!title) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return /*#__PURE__*/React.createElement(StyledHeader, {
|
|
81
|
-
alignTitle: alignTitle,
|
|
82
|
-
internalEditButton: internalEditButton,
|
|
83
|
-
size: size
|
|
84
|
-
}, /*#__PURE__*/React.createElement(StyledTitle, {
|
|
85
|
-
"data-element": "title"
|
|
86
|
-
}, title), subtitle && /*#__PURE__*/React.createElement(StyledSubtitle, {
|
|
87
|
-
"data-element": "subtitle"
|
|
88
|
-
}, subtitle));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function renderFooter() {
|
|
92
|
-
if (!footer) {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return /*#__PURE__*/React.createElement(StyledFooter, {
|
|
97
|
-
"data-element": "footer",
|
|
98
|
-
size: size,
|
|
99
|
-
variant: variant,
|
|
100
|
-
softDelete: softDelete
|
|
101
|
-
}, footer);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function actionButtons() {
|
|
105
|
-
if (softDelete && onUndo) {
|
|
106
|
-
return /*#__PURE__*/React.createElement(StyledActionsContainer, {
|
|
107
|
-
internalEditButton: internalEditButton
|
|
108
|
-
}, undo());
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (!softDelete && (onDelete || onEdit)) {
|
|
112
|
-
return /*#__PURE__*/React.createElement(StyledActionsContainer, {
|
|
113
|
-
internalEditButton: internalEditButton
|
|
114
|
-
}, onEdit && edit(), onDelete && renderDelete());
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function renderDelete() {
|
|
121
|
-
return /*#__PURE__*/React.createElement(StyledDeleteButton, {
|
|
122
|
-
onMouseEnter: () => setDeleteHovered(true),
|
|
123
|
-
onMouseLeave: () => setDeleteHovered(false),
|
|
124
|
-
onFocus: () => setDeleteFocused(true),
|
|
125
|
-
onBlur: () => setDeleteFocused(false),
|
|
126
|
-
"data-element": "delete",
|
|
127
|
-
internalEditButton: internalEditButton,
|
|
128
|
-
displayOnlyOnHover: displayEditButtonOnHover,
|
|
129
|
-
isFocused: isDeleteFocused,
|
|
130
|
-
isHovered: isDeleteHovered,
|
|
131
|
-
noBorder: !border,
|
|
132
|
-
size: size,
|
|
133
|
-
variant: variant,
|
|
134
|
-
onKeyDown: processPodAction(onDelete),
|
|
135
|
-
onAction: processPodAction(onDelete)
|
|
136
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
137
|
-
type: "delete"
|
|
138
|
-
}));
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function edit() {
|
|
142
|
-
return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, l => /*#__PURE__*/React.createElement("div", _extends({}, editEvents(), {
|
|
143
|
-
"data-element": "edit-container"
|
|
144
|
-
}), /*#__PURE__*/React.createElement(StyledEditAction, _extends({
|
|
145
|
-
contentTriggersEdit: triggerEditOnContent,
|
|
146
|
-
"data-element": "edit",
|
|
147
|
-
displayOnlyOnHover: displayEditButtonOnHover,
|
|
148
|
-
icon: "edit",
|
|
149
|
-
internalEditButton: internalEditButton,
|
|
150
|
-
isFocused: isEditFocused,
|
|
151
|
-
isHovered: isEditHovered,
|
|
152
|
-
noBorder: !border,
|
|
153
|
-
size: size,
|
|
154
|
-
variant: variant
|
|
155
|
-
}, linkProps()), l.actions.edit())));
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function undo() {
|
|
159
|
-
return /*#__PURE__*/React.createElement(StyledUndoButton, {
|
|
160
|
-
onMouseEnter: () => setUndoHovered(true),
|
|
161
|
-
onMouseLeave: () => setUndoHovered(false),
|
|
162
|
-
onFocus: () => setUndoFocused(true),
|
|
163
|
-
onBlur: () => setUndoFocused(false),
|
|
164
|
-
"data-element": "undo-container",
|
|
165
|
-
internalEditButton: internalEditButton,
|
|
166
|
-
isFocused: isUndoFocused,
|
|
167
|
-
isHovered: isUndoHovered,
|
|
168
|
-
noBorder: !border,
|
|
169
|
-
size: size,
|
|
170
|
-
variant: variant,
|
|
171
|
-
onKeyDown: processPodAction(onUndo),
|
|
172
|
-
onAction: processPodAction(onUndo)
|
|
173
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
174
|
-
type: "undo"
|
|
175
|
-
}));
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function linkProps() {
|
|
179
|
-
if (typeof onEdit === "string") {
|
|
180
|
-
return {
|
|
181
|
-
to: onEdit
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return onEdit;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return /*#__PURE__*/React.createElement(StyledPod, _extends({}, rest, {
|
|
61
|
+
const editEvents = {
|
|
62
|
+
onMouseEnter: () => setEditHovered(true),
|
|
63
|
+
onMouseLeave: () => setEditHovered(false),
|
|
64
|
+
onFocus: () => setEditFocused(true),
|
|
65
|
+
onBlur: () => setEditFocused(false),
|
|
66
|
+
...(typeof onEdit === "function" && {
|
|
67
|
+
onClick: processPodAction(onEdit),
|
|
68
|
+
onKeyDown: processPodAction(onEdit)
|
|
69
|
+
})
|
|
70
|
+
};
|
|
71
|
+
return /*#__PURE__*/React.createElement(StyledPod, _extends({
|
|
72
|
+
alignTitle: alignTitle,
|
|
189
73
|
className: className,
|
|
190
|
-
internalEditButton: internalEditButton
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
74
|
+
internalEditButton: internalEditButton,
|
|
75
|
+
height: typeof height === "number" ? `${height}px` : height,
|
|
76
|
+
ref: ref,
|
|
77
|
+
"data-component": "pod",
|
|
78
|
+
"data-element": dataElement,
|
|
79
|
+
"data-role": dataRole
|
|
80
|
+
}, rest), /*#__PURE__*/React.createElement(StyledBlock, _extends({
|
|
195
81
|
"data-element": "block",
|
|
196
|
-
contentTriggersEdit: shouldContentHaveEditEvents
|
|
197
|
-
hasButtons:
|
|
82
|
+
contentTriggersEdit: shouldContentHaveEditEvents,
|
|
83
|
+
hasButtons: hasButtons,
|
|
198
84
|
fullWidth: editContentFullWidth,
|
|
199
85
|
internalEditButton: internalEditButton,
|
|
200
86
|
isFocused: isEditFocused || isDeleteFocused,
|
|
@@ -202,105 +88,250 @@ const Pod = /*#__PURE__*/forwardRef(({
|
|
|
202
88
|
noBorder: !border,
|
|
203
89
|
variant: variant,
|
|
204
90
|
softDelete: softDelete
|
|
205
|
-
}, shouldContentHaveEditEvents
|
|
206
|
-
tabIndex:
|
|
207
|
-
}
|
|
91
|
+
}, shouldContentHaveEditEvents && { ...editEvents,
|
|
92
|
+
tabIndex: 0
|
|
93
|
+
}), /*#__PURE__*/React.createElement(StyledContent, {
|
|
208
94
|
"data-element": "content",
|
|
209
95
|
size: size
|
|
210
|
-
},
|
|
96
|
+
}, title && /*#__PURE__*/React.createElement(StyledHeader, {
|
|
97
|
+
alignTitle: alignTitle,
|
|
98
|
+
internalEditButton: internalEditButton,
|
|
99
|
+
size: size
|
|
100
|
+
}, /*#__PURE__*/React.createElement(StyledTitle, {
|
|
101
|
+
"data-element": "title"
|
|
102
|
+
}, title), subtitle && /*#__PURE__*/React.createElement(StyledSubtitle, {
|
|
103
|
+
"data-element": "subtitle"
|
|
104
|
+
}, subtitle)), children), footer && /*#__PURE__*/React.createElement(StyledFooter, {
|
|
105
|
+
"data-element": "footer",
|
|
106
|
+
size: size,
|
|
107
|
+
variant: variant,
|
|
108
|
+
softDelete: softDelete
|
|
109
|
+
}, footer)), hasButtons && /*#__PURE__*/React.createElement(StyledActionsContainer, {
|
|
110
|
+
"data-element": "action-button-container",
|
|
111
|
+
internalEditButton: internalEditButton
|
|
112
|
+
}, softDelete && onUndo && /*#__PURE__*/React.createElement(StyledUndoButton, {
|
|
113
|
+
"aria-label": l.pod.undo(),
|
|
114
|
+
onMouseEnter: () => setUndoHovered(true),
|
|
115
|
+
onMouseLeave: () => setUndoHovered(false),
|
|
116
|
+
onFocus: () => setUndoFocused(true),
|
|
117
|
+
onBlur: () => setUndoFocused(false),
|
|
118
|
+
"data-element": "undo",
|
|
119
|
+
internalEditButton: internalEditButton,
|
|
120
|
+
isFocused: isUndoFocused,
|
|
121
|
+
isHovered: isUndoHovered,
|
|
122
|
+
noBorder: !border,
|
|
123
|
+
size: size,
|
|
124
|
+
variant: variant,
|
|
125
|
+
onAction: processPodAction(onUndo)
|
|
126
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
127
|
+
type: "undo"
|
|
128
|
+
})), !softDelete && onEdit && /*#__PURE__*/React.createElement(StyledEditAction, _extends({}, editEvents, {
|
|
129
|
+
"aria-label": l.actions.edit(),
|
|
130
|
+
"data-element": "edit",
|
|
131
|
+
displayOnlyOnHover: displayEditButtonOnHover,
|
|
132
|
+
internalEditButton: internalEditButton,
|
|
133
|
+
isFocused: isEditFocused,
|
|
134
|
+
isHovered: isEditHovered,
|
|
135
|
+
noBorder: !border,
|
|
136
|
+
size: size,
|
|
137
|
+
variant: variant
|
|
138
|
+
}, typeof onEdit === "string" ? {
|
|
139
|
+
href: onEdit
|
|
140
|
+
} : onEdit), /*#__PURE__*/React.createElement(Icon, {
|
|
141
|
+
type: "edit"
|
|
142
|
+
})), !softDelete && onDelete && /*#__PURE__*/React.createElement(StyledDeleteButton, {
|
|
143
|
+
"aria-label": l.actions.delete(),
|
|
144
|
+
"data-element": "delete",
|
|
145
|
+
onMouseEnter: () => setDeleteHovered(true),
|
|
146
|
+
onMouseLeave: () => setDeleteHovered(false),
|
|
147
|
+
onFocus: () => setDeleteFocused(true),
|
|
148
|
+
onBlur: () => setDeleteFocused(false),
|
|
149
|
+
internalEditButton: internalEditButton,
|
|
150
|
+
isFocused: isDeleteFocused,
|
|
151
|
+
isHovered: isDeleteHovered,
|
|
152
|
+
noBorder: !border,
|
|
153
|
+
size: size,
|
|
154
|
+
variant: variant,
|
|
155
|
+
onAction: processPodAction(onDelete)
|
|
156
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
157
|
+
type: "delete"
|
|
158
|
+
}))));
|
|
211
159
|
});
|
|
212
|
-
Pod.propTypes = {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
160
|
+
Pod.propTypes = {
|
|
161
|
+
"alignTitle": PropTypes.oneOf(["center", "left", "right"]),
|
|
162
|
+
"border": PropTypes.bool,
|
|
163
|
+
"children": PropTypes.node,
|
|
164
|
+
"className": PropTypes.string,
|
|
165
|
+
"data-element": PropTypes.string,
|
|
166
|
+
"data-role": PropTypes.string,
|
|
167
|
+
"displayEditButtonOnHover": PropTypes.bool,
|
|
168
|
+
"editContentFullWidth": PropTypes.bool,
|
|
169
|
+
"footer": PropTypes.node,
|
|
170
|
+
"height": PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
171
|
+
"internalEditButton": PropTypes.bool,
|
|
172
|
+
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
173
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
174
|
+
"description": PropTypes.string,
|
|
175
|
+
"toString": PropTypes.func.isRequired,
|
|
176
|
+
"valueOf": PropTypes.func.isRequired
|
|
177
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
178
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
179
|
+
"description": PropTypes.string,
|
|
180
|
+
"toString": PropTypes.func.isRequired,
|
|
181
|
+
"valueOf": PropTypes.func.isRequired
|
|
182
|
+
}), PropTypes.string]),
|
|
183
|
+
"margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
184
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
185
|
+
"description": PropTypes.string,
|
|
186
|
+
"toString": PropTypes.func.isRequired,
|
|
187
|
+
"valueOf": PropTypes.func.isRequired
|
|
188
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
189
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
190
|
+
"description": PropTypes.string,
|
|
191
|
+
"toString": PropTypes.func.isRequired,
|
|
192
|
+
"valueOf": PropTypes.func.isRequired
|
|
193
|
+
}), PropTypes.string]),
|
|
194
|
+
"marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
195
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
196
|
+
"description": PropTypes.string,
|
|
197
|
+
"toString": PropTypes.func.isRequired,
|
|
198
|
+
"valueOf": PropTypes.func.isRequired
|
|
199
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
200
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
201
|
+
"description": PropTypes.string,
|
|
202
|
+
"toString": PropTypes.func.isRequired,
|
|
203
|
+
"valueOf": PropTypes.func.isRequired
|
|
204
|
+
}), PropTypes.string]),
|
|
205
|
+
"marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
206
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
207
|
+
"description": PropTypes.string,
|
|
208
|
+
"toString": PropTypes.func.isRequired,
|
|
209
|
+
"valueOf": PropTypes.func.isRequired
|
|
210
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
211
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
212
|
+
"description": PropTypes.string,
|
|
213
|
+
"toString": PropTypes.func.isRequired,
|
|
214
|
+
"valueOf": PropTypes.func.isRequired
|
|
215
|
+
}), PropTypes.string]),
|
|
216
|
+
"marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
217
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
218
|
+
"description": PropTypes.string,
|
|
219
|
+
"toString": PropTypes.func.isRequired,
|
|
220
|
+
"valueOf": PropTypes.func.isRequired
|
|
221
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
222
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
223
|
+
"description": PropTypes.string,
|
|
224
|
+
"toString": PropTypes.func.isRequired,
|
|
225
|
+
"valueOf": PropTypes.func.isRequired
|
|
226
|
+
}), PropTypes.string]),
|
|
227
|
+
"marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
228
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
229
|
+
"description": PropTypes.string,
|
|
230
|
+
"toString": PropTypes.func.isRequired,
|
|
231
|
+
"valueOf": PropTypes.func.isRequired
|
|
232
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
233
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
234
|
+
"description": PropTypes.string,
|
|
235
|
+
"toString": PropTypes.func.isRequired,
|
|
236
|
+
"valueOf": PropTypes.func.isRequired
|
|
237
|
+
}), PropTypes.string]),
|
|
238
|
+
"marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
239
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
240
|
+
"description": PropTypes.string,
|
|
241
|
+
"toString": PropTypes.func.isRequired,
|
|
242
|
+
"valueOf": PropTypes.func.isRequired
|
|
243
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
244
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
245
|
+
"description": PropTypes.string,
|
|
246
|
+
"toString": PropTypes.func.isRequired,
|
|
247
|
+
"valueOf": PropTypes.func.isRequired
|
|
248
|
+
}), PropTypes.string]),
|
|
249
|
+
"marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
250
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
251
|
+
"description": PropTypes.string,
|
|
252
|
+
"toString": PropTypes.func.isRequired,
|
|
253
|
+
"valueOf": PropTypes.func.isRequired
|
|
254
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
255
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
256
|
+
"description": PropTypes.string,
|
|
257
|
+
"toString": PropTypes.func.isRequired,
|
|
258
|
+
"valueOf": PropTypes.func.isRequired
|
|
259
|
+
}), PropTypes.string]),
|
|
260
|
+
"mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
261
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
262
|
+
"description": PropTypes.string,
|
|
263
|
+
"toString": PropTypes.func.isRequired,
|
|
264
|
+
"valueOf": PropTypes.func.isRequired
|
|
265
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
266
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
267
|
+
"description": PropTypes.string,
|
|
268
|
+
"toString": PropTypes.func.isRequired,
|
|
269
|
+
"valueOf": PropTypes.func.isRequired
|
|
270
|
+
}), PropTypes.string]),
|
|
271
|
+
"ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
272
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
273
|
+
"description": PropTypes.string,
|
|
274
|
+
"toString": PropTypes.func.isRequired,
|
|
275
|
+
"valueOf": PropTypes.func.isRequired
|
|
276
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
277
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
278
|
+
"description": PropTypes.string,
|
|
279
|
+
"toString": PropTypes.func.isRequired,
|
|
280
|
+
"valueOf": PropTypes.func.isRequired
|
|
281
|
+
}), PropTypes.string]),
|
|
282
|
+
"mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
283
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
284
|
+
"description": PropTypes.string,
|
|
285
|
+
"toString": PropTypes.func.isRequired,
|
|
286
|
+
"valueOf": PropTypes.func.isRequired
|
|
287
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
288
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
289
|
+
"description": PropTypes.string,
|
|
290
|
+
"toString": PropTypes.func.isRequired,
|
|
291
|
+
"valueOf": PropTypes.func.isRequired
|
|
292
|
+
}), PropTypes.string]),
|
|
293
|
+
"mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
294
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
295
|
+
"description": PropTypes.string,
|
|
296
|
+
"toString": PropTypes.func.isRequired,
|
|
297
|
+
"valueOf": PropTypes.func.isRequired
|
|
298
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
299
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
300
|
+
"description": PropTypes.string,
|
|
301
|
+
"toString": PropTypes.func.isRequired,
|
|
302
|
+
"valueOf": PropTypes.func.isRequired
|
|
303
|
+
}), PropTypes.string]),
|
|
304
|
+
"mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
305
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
306
|
+
"description": PropTypes.string,
|
|
307
|
+
"toString": PropTypes.func.isRequired,
|
|
308
|
+
"valueOf": PropTypes.func.isRequired
|
|
309
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
310
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
311
|
+
"description": PropTypes.string,
|
|
312
|
+
"toString": PropTypes.func.isRequired,
|
|
313
|
+
"valueOf": PropTypes.func.isRequired
|
|
314
|
+
}), PropTypes.string]),
|
|
315
|
+
"my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
316
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
317
|
+
"description": PropTypes.string,
|
|
318
|
+
"toString": PropTypes.func.isRequired,
|
|
319
|
+
"valueOf": PropTypes.func.isRequired
|
|
320
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
321
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
322
|
+
"description": PropTypes.string,
|
|
323
|
+
"toString": PropTypes.func.isRequired,
|
|
324
|
+
"valueOf": PropTypes.func.isRequired
|
|
325
|
+
}), PropTypes.string]),
|
|
326
|
+
"onDelete": PropTypes.func,
|
|
327
|
+
"onEdit": PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.string]),
|
|
328
|
+
"onUndo": PropTypes.func,
|
|
329
|
+
"size": PropTypes.oneOf(["extra-large", "extra-small", "large", "medium", "small"]),
|
|
330
|
+
"softDelete": PropTypes.bool,
|
|
331
|
+
"subtitle": PropTypes.string,
|
|
332
|
+
"title": PropTypes.node,
|
|
333
|
+
"triggerEditOnContent": PropTypes.bool,
|
|
334
|
+
"variant": PropTypes.oneOf(["primary", "secondary", "tertiary", "tile", "transparent"])
|
|
305
335
|
};
|
|
336
|
+
Pod.displayName = "Pod";
|
|
306
337
|
export default Pod;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const POD_SIZES: readonly ["extra-small", "small", "medium", "large", "extra-large"];
|
|
2
|
+
export declare const POD_ALIGNMENTS: readonly ["left", "center", "right"];
|
|
3
|
+
export declare const POD_VARIANTS: readonly ["primary", "secondary", "tertiary", "tile", "transparent"];
|
|
4
|
+
export declare type PodSize = typeof POD_SIZES[number];
|
|
5
|
+
export declare type PodAlignment = typeof POD_ALIGNMENTS[number];
|
|
6
|
+
export declare type PodVariant = typeof POD_VARIANTS[number];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export const POD_SIZES = ["extra-small", "small", "medium", "large", "extra-large"];
|
|
2
|
-
export const POD_ALIGNMENTS = ["
|
|
3
|
-
export const
|
|
2
|
+
export const POD_ALIGNMENTS = ["left", "center", "right"];
|
|
3
|
+
export const POD_VARIANTS = ["primary", "secondary", "tertiary", "tile", "transparent"];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
import { PodProps } from "./pod.component";
|
|
4
|
+
import { PodSize, PodVariant } from "./pod.config";
|
|
5
|
+
declare const StyledPod: import("styled-components").StyledComponent<"div", any, MarginProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & Pick<PodProps, "height" | "alignTitle" | "internalEditButton">, never>;
|
|
6
|
+
interface StyledBlockProps extends Pick<PodProps, "softDelete" | "internalEditButton"> {
|
|
7
|
+
variant: PodVariant;
|
|
8
|
+
noBorder: boolean;
|
|
9
|
+
hasButtons: boolean;
|
|
10
|
+
contentTriggersEdit?: boolean;
|
|
11
|
+
fullWidth?: boolean;
|
|
12
|
+
isHovered?: boolean;
|
|
13
|
+
isFocused?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const StyledBlock: import("styled-components").StyledComponent<"div", any, StyledBlockProps, never>;
|
|
16
|
+
declare const StyledContent: import("styled-components").StyledComponent<"div", any, {
|
|
17
|
+
size: PodSize;
|
|
18
|
+
}, never>;
|
|
19
|
+
interface StyledFooterProps extends Pick<PodProps, "softDelete"> {
|
|
20
|
+
variant: PodVariant;
|
|
21
|
+
size: PodSize;
|
|
22
|
+
}
|
|
23
|
+
declare const StyledFooter: import("styled-components").StyledComponent<"div", any, StyledFooterProps, never>;
|
|
24
|
+
declare const StyledActionsContainer: import("styled-components").StyledComponent<"div", any, Pick<PodProps, "internalEditButton">, never>;
|
|
25
|
+
interface CommonPodButtonProps extends Pick<PodProps, "internalEditButton"> {
|
|
26
|
+
isHovered?: boolean;
|
|
27
|
+
isFocused?: boolean;
|
|
28
|
+
size: PodSize;
|
|
29
|
+
noBorder: boolean;
|
|
30
|
+
variant: PodVariant;
|
|
31
|
+
}
|
|
32
|
+
interface StyledEditActionProps extends CommonPodButtonProps {
|
|
33
|
+
displayOnlyOnHover?: boolean;
|
|
34
|
+
}
|
|
35
|
+
declare const StyledEditAction: import("styled-components").StyledComponent<"a", any, StyledEditActionProps, never>;
|
|
36
|
+
declare const StyledDeleteButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon-button").IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, CommonPodButtonProps, never>;
|
|
37
|
+
declare const StyledUndoButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon-button").IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, CommonPodButtonProps, never>;
|
|
38
|
+
interface StyledHeaderProps extends Pick<PodProps, "alignTitle" | "internalEditButton"> {
|
|
39
|
+
size: PodSize;
|
|
40
|
+
}
|
|
41
|
+
declare const StyledHeader: import("styled-components").StyledComponent<"div", any, StyledHeaderProps, never>;
|
|
42
|
+
declare const StyledSubtitle: import("styled-components").StyledComponent<"h5", any, {}, never>;
|
|
43
|
+
declare const StyledTitle: import("styled-components").StyledComponent<"h4", any, {}, never>;
|
|
44
|
+
export { StyledBlock, StyledContent, StyledEditAction, StyledActionsContainer, StyledDeleteButton, StyledUndoButton, StyledFooter, StyledPod, StyledHeader, StyledSubtitle, StyledTitle, };
|