pne-ui 5.0.0-rc.13 → 5.0.0-rc.16
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/README.md +21 -0
- package/cjs/component/PneModal.js +4 -29
- package/cjs/component/iconActionLook.js +42 -0
- package/cjs/component/overlay/OverlayHost.js +17 -55
- package/cjs/component/overlay/OverlayToast.js +124 -0
- package/cjs/component/overlay/overlayStore.js +8 -6
- package/cjs/component/table/AbstractHeaderTableCell.js +8 -10
- package/cjs/component/table/PneHeaderTableCell.js +0 -3
- package/cjs/component/table/PneTableCell.js +10 -3
- package/cjs/component/table/PneTableRow.js +46 -32
- package/cjs/component/table/PneTableSortLabel.js +51 -12
- package/cjs/createTheme.js +4 -0
- package/cjs/tablePalette.js +27 -0
- package/cjs/toastPalette.js +30 -0
- package/esm/component/PneModal.js +4 -29
- package/esm/component/iconActionLook.d.ts +8 -0
- package/esm/component/iconActionLook.js +38 -0
- package/esm/component/overlay/OverlayHost.js +18 -56
- package/esm/component/overlay/OverlayToast.d.ts +31 -0
- package/esm/component/overlay/OverlayToast.js +121 -0
- package/esm/component/overlay/overlayStore.js +8 -6
- package/esm/component/overlay/types.d.ts +3 -0
- package/esm/component/table/AbstractHeaderTableCell.js +8 -10
- package/esm/component/table/PneHeaderTableCell.js +0 -3
- package/esm/component/table/PneTableCell.js +10 -3
- package/esm/component/table/PneTableRow.d.ts +6 -1
- package/esm/component/table/PneTableRow.js +45 -31
- package/esm/component/table/PneTableSortLabel.js +51 -12
- package/esm/createTheme.d.ts +6 -0
- package/esm/createTheme.js +4 -0
- package/esm/exports/theme.d.ts +2 -0
- package/esm/tablePalette.d.ts +29 -0
- package/esm/tablePalette.js +23 -0
- package/esm/toastPalette.d.ts +22 -0
- package/esm/toastPalette.js +26 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -687,6 +687,16 @@ export const OrdersTable = () => (
|
|
|
687
687
|
|
|
688
688
|
### PneTable
|
|
689
689
|
|
|
690
|
+
Вид каркаса (UI Kit Cell и Table row). Строка тела — 40 px при одной строке текста: ячейка `PneTableCell` 14/20
|
|
691
|
+
Neutral/900 с 12 px по бокам, под каждой строкой, кроме последней, линия 1 px Neutral/200. Строка под указателем
|
|
692
|
+
заливается Neutral/100 (`PneTableRow hover={false}` отключает), выбранная (`selected` у строки и у ячеек) — Brand/100
|
|
693
|
+
и остаётся такой под указателем. Заголовок `PneHeaderTableCell` — 14/20 SemiBold над такой же линией. Знак
|
|
694
|
+
сортировки `PneTableSortLabel` — две стрелки UI Kit рядом с подписью, видны всегда: у неотсортированной колонки обе
|
|
695
|
+
серые (под указателем — цвета ссылки), у отсортированной направление в силе — цвета ссылки, второе приглушено;
|
|
696
|
+
подпись сохраняет цвет заголовка. Цвета берутся из `theme.palette.pne.table`. Виды ячеек UI Kit (числа
|
|
697
|
+
моноширинным шрифтом, ссылки, статусы, действия строки и другие) в библиотеке пока не выделены: содержимое ячейки
|
|
698
|
+
рисует экран.
|
|
699
|
+
|
|
690
700
|
Передавайте `autoTestId` для каждой логической таблицы; если на странице их несколько, значения обязаны быть
|
|
691
701
|
уникальными. Существующий внешний root получает `data-autotest="table"` и переданный ID в
|
|
692
702
|
`data-autotest-value`. `tableAriaLabel` или `tableAriaLabelledBy` независимо задают пользовательское имя
|
|
@@ -2578,6 +2588,17 @@ const OwnChip = ({children}: {children: React.ReactNode}) => {
|
|
|
2578
2588
|
|
|
2579
2589
|
## OverlayHost и уведомления
|
|
2580
2590
|
|
|
2591
|
+
Вид уведомлений (UI Kit Toast и Banner). Каждое уведомление шириной 448 px (на телефоне — по ширине экрана),
|
|
2592
|
+
между уведомлениями 8 px; нижние рисуются поверх теней верхних. Тост залит цветом своего тона (успех — зелёный,
|
|
2593
|
+
информация — синий, предупреждение — янтарный, ошибка — красный), скругление 8, отступы 8/16, тень тоста; значка
|
|
2594
|
+
тона нет. `message` — заголовок 18/26 SemiBold, необязательное `description` — вторая строка 12/16 цветом текста
|
|
2595
|
+
тона. Справа, в 64 px от текста, стоят действие потребителя (`action`) и крестик — значок 16 px в кнопке 32 px
|
|
2596
|
+
без заливки, цветом текста тона; крестик есть и рядом с действием. Полоса таймера 3 px идёт по нижнему краю и
|
|
2597
|
+
убывает влево. Кнопка «Undo» из `showUndoSnackbar` — мягкая `small` с подписью цвета основного текста, без значка.
|
|
2598
|
+
Ошибка Paynet с идентификатором и деталями (`showError({error})`) — баннер: бледная заливка тона в кольце его
|
|
2599
|
+
цвета, отступы 12/16, знак тона 20 px слева, крестик 24 px. Цвета — `theme.palette.pne.toast`, одинаковые для
|
|
2600
|
+
всех скинов.
|
|
2601
|
+
|
|
2581
2602
|
`OverlayHost` рендерит snackbars из `overlayActions` и принимает декларативные постоянные оверлеи через `PermanentOverlay`
|
|
2582
2603
|
(по одному на слот: `top-left/top-right/bottom-left/bottom-right`).
|
|
2583
2604
|
```tsx
|
|
@@ -9,6 +9,7 @@ const styles_1 = require("@mui/material/styles");
|
|
|
9
9
|
const React = tslib_1.__importStar(require("react"));
|
|
10
10
|
const createTheme_1 = require("../createTheme");
|
|
11
11
|
const dropdownLook_1 = require("./dropdown/dropdownLook");
|
|
12
|
+
const iconActionLook_1 = require("./iconActionLook");
|
|
12
13
|
const PneSurface_1 = require("./internal/PneSurface");
|
|
13
14
|
const PneModal = React.forwardRef(function PneModal(props, ref) {
|
|
14
15
|
const { actions, ariaDescribedBy, ariaLabel, blockingOverlay, children, className, closeButtonProps, closeLabel = 'Close', containerProps, containerSx, hideCloseButton = false, modalProps, onClose, open, overlay, slotProps, subtitle, title, ...directContainerDataAttributes } = props;
|
|
@@ -103,7 +104,7 @@ const PneModal = React.forwardRef(function PneModal(props, ref) {
|
|
|
103
104
|
modalSubtitleSx,
|
|
104
105
|
...(Array.isArray(subtitleSx) ? subtitleSx : [subtitleSx]),
|
|
105
106
|
] }, subtitle)),
|
|
106
|
-
!hideCloseButton && React.createElement(IconButton_1.default, { ...forwardedCloseButtonProps, "aria-label": resolvedCloseLabel, inert: isBlocked ? true : undefined, sx: modalCloseButtonSx, onClick: handleCloseButtonClick, type: 'button' },
|
|
107
|
+
!hideCloseButton && React.createElement(IconButton_1.default, { ...forwardedCloseButtonProps, "aria-label": resolvedCloseLabel, inert: isBlocked ? true : undefined, disableRipple: true, sx: modalCloseButtonSx, onClick: handleCloseButtonClick, type: 'button' },
|
|
107
108
|
React.createElement(dropdownLook_1.PneCloseIcon, null))),
|
|
108
109
|
children != null && React.createElement(Body, { ...forwardedBodyProps, "data-pne-modal-body": 'true', "data-pne-modal-last": actions == null ? 'true' : undefined, inert: isBlocked ? true : forwardedBodyProps.inert }, children),
|
|
109
110
|
actions != null && React.createElement(Footer, { ...forwardedFooterProps, "data-pne-modal-footer": 'true', inert: isBlocked ? true : forwardedFooterProps.inert }, actions),
|
|
@@ -372,34 +373,8 @@ const modalSubtitleSx = theme => ({
|
|
|
372
373
|
lineHeight: '16px',
|
|
373
374
|
color: (0, createTheme_1.resolvePneSemanticPalette)(theme).modal.subtitle,
|
|
374
375
|
});
|
|
375
|
-
// UI Kit Icon action: a 32px
|
|
376
|
-
const modalCloseButtonSx =
|
|
377
|
-
const pne = (0, createTheme_1.resolvePneSemanticPalette)(theme);
|
|
378
|
-
const colors = pne.button.text;
|
|
379
|
-
return {
|
|
380
|
-
flex: '0 0 auto',
|
|
381
|
-
width: '32px',
|
|
382
|
-
height: '32px',
|
|
383
|
-
padding: 0,
|
|
384
|
-
borderRadius: '4px',
|
|
385
|
-
backgroundColor: 'transparent',
|
|
386
|
-
color: colors.default.text,
|
|
387
|
-
'& .MuiSvgIcon-root': {
|
|
388
|
-
fontSize: '16px',
|
|
389
|
-
},
|
|
390
|
-
'&:hover': {
|
|
391
|
-
backgroundColor: colors.hover.fill,
|
|
392
|
-
color: colors.hover.text,
|
|
393
|
-
},
|
|
394
|
-
'&:active': {
|
|
395
|
-
backgroundColor: colors.pressed.fill,
|
|
396
|
-
color: colors.pressed.text,
|
|
397
|
-
},
|
|
398
|
-
'&.Mui-focusVisible': {
|
|
399
|
-
boxShadow: `0 0 0 2px ${pne.modal.fill}, 0 0 0 4px ${pne.focusRing}`,
|
|
400
|
-
},
|
|
401
|
-
};
|
|
402
|
-
};
|
|
376
|
+
// UI Kit Icon action md: a 32px box with the 16px thin cross; hover and press colour only the icon.
|
|
377
|
+
const modalCloseButtonSx = (0, iconActionLook_1.pneIconActionSx)('medium');
|
|
403
378
|
const BlockingOverlaySlot = (0, styles_1.styled)(Box_1.default) `
|
|
404
379
|
position: absolute;
|
|
405
380
|
inset: 0;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pneIconActionSx = void 0;
|
|
4
|
+
const createTheme_1 = require("../createTheme");
|
|
5
|
+
const themeColors_1 = require("../themeColors");
|
|
6
|
+
/**
|
|
7
|
+
* UI Kit Icon action on a MUI IconButton: an icon button with no background, where hover and press
|
|
8
|
+
* colour only the icon. `medium` is a 32px box with a 16px glyph (the close cross of a modal and of
|
|
9
|
+
* a toast), `small` a 24px box with a 14px glyph. The icon rests in the tertiary text colour, or in
|
|
10
|
+
* `restColor` (the tone of a toast), and takes the brand text colour under the pointer.
|
|
11
|
+
*/
|
|
12
|
+
const pneIconActionSx = (size, restColor) => theme => {
|
|
13
|
+
const pne = (0, createTheme_1.resolvePneSemanticPalette)(theme);
|
|
14
|
+
const dark = theme.palette.mode === 'dark';
|
|
15
|
+
const box = size === 'small' ? '24px' : '32px';
|
|
16
|
+
return {
|
|
17
|
+
flex: '0 0 auto',
|
|
18
|
+
width: box,
|
|
19
|
+
height: box,
|
|
20
|
+
padding: 0,
|
|
21
|
+
borderRadius: '4px',
|
|
22
|
+
backgroundColor: 'transparent',
|
|
23
|
+
color: restColor ?? (dark ? themeColors_1.PNE_DARK_COLORS.textMuted : themeColors_1.PNE_NEUTRAL_RAMP[600]),
|
|
24
|
+
'& .MuiSvgIcon-root': {
|
|
25
|
+
fontSize: size === 'small' ? '14px' : '16px',
|
|
26
|
+
},
|
|
27
|
+
'&:hover': {
|
|
28
|
+
backgroundColor: 'transparent',
|
|
29
|
+
color: pne.button.text.hover.text,
|
|
30
|
+
},
|
|
31
|
+
'&:active': {
|
|
32
|
+
color: pne.button.text.pressed.text,
|
|
33
|
+
},
|
|
34
|
+
'&.Mui-focusVisible': {
|
|
35
|
+
boxShadow: `0 0 0 2px ${theme.palette.background.paper}, 0 0 0 4px ${pne.focusRing}`,
|
|
36
|
+
},
|
|
37
|
+
'&.Mui-disabled': {
|
|
38
|
+
color: dark ? themeColors_1.PNE_DARK_COLORS.textDisabled : themeColors_1.PNE_NEUTRAL_RAMP[400],
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
exports.pneIconActionSx = pneIconActionSx;
|
|
@@ -11,6 +11,8 @@ const PermanentOverlayContext_1 = require("./PermanentOverlayContext");
|
|
|
11
11
|
const OverlayPortalContainerContext_1 = require("./OverlayPortalContainerContext");
|
|
12
12
|
const PaynetErrorPresentationContext_1 = require("./PaynetErrorPresentationContext");
|
|
13
13
|
const overlayRuntime_1 = require("./overlayRuntime");
|
|
14
|
+
const OverlayToast_1 = tslib_1.__importDefault(require("./OverlayToast"));
|
|
15
|
+
const PaynetErrorContent_1 = tslib_1.__importDefault(require("./PaynetErrorContent"));
|
|
14
16
|
/**
|
|
15
17
|
* Final left coordinates matching the adaptive Paynet menu shell:
|
|
16
18
|
* no reserved menu below 1080px, a collapsed rail below 1600px,
|
|
@@ -25,6 +27,8 @@ exports.PAYNET_LEFT_MENU_OVERLAY_OFFSET = {
|
|
|
25
27
|
],
|
|
26
28
|
};
|
|
27
29
|
const STACK_GAP = 12;
|
|
30
|
+
// UI Kit OverlayHost: 8px between notifications.
|
|
31
|
+
const NOTIFICATION_GAP = 8;
|
|
28
32
|
const STACK_OFFSET = 24;
|
|
29
33
|
const OPERATION_CENTER_OFFSET = 16;
|
|
30
34
|
const STACK_REFLOW_DURATION_MS = 200;
|
|
@@ -65,6 +69,9 @@ const clearTimer = (timer) => {
|
|
|
65
69
|
clearTimeout(timer);
|
|
66
70
|
}
|
|
67
71
|
};
|
|
72
|
+
const NOTIFICATION_WIDTH = 448;
|
|
73
|
+
// An error with an identifier and details is a banner, not a toast (UI Kit OverlayHost).
|
|
74
|
+
const isPaynetErrorMessage = (message) => react_1.default.isValidElement(message) && message.type === PaynetErrorContent_1.default;
|
|
68
75
|
const ManagedSnackbar = ({ anchor, onExited, open, onRemove, prefersReducedMotion, snack, }) => {
|
|
69
76
|
const autoHideMs = typeof snack.autoHideMs === 'number' && snack.autoHideMs > 0 ? snack.autoHideMs : null;
|
|
70
77
|
const [remainingMs, setRemainingMs] = (0, react_1.useState)(autoHideMs);
|
|
@@ -168,59 +175,11 @@ const ManagedSnackbar = ({ anchor, onExited, open, onRemove, prefersReducedMotio
|
|
|
168
175
|
position: 'static',
|
|
169
176
|
transform: 'none',
|
|
170
177
|
pointerEvents: open ? 'auto' : 'none',
|
|
171
|
-
|
|
178
|
+
// UI Kit OverlayHost: every notification is 448px wide, or as wide as a phone lets it be.
|
|
172
179
|
maxWidth: 'calc(100vw - 32px)',
|
|
173
|
-
width:
|
|
180
|
+
width: `${NOTIFICATION_WIDTH}px`,
|
|
174
181
|
} },
|
|
175
|
-
react_1.default.createElement(
|
|
176
|
-
boxSizing: 'border-box',
|
|
177
|
-
position: 'relative',
|
|
178
|
-
overflow: 'hidden',
|
|
179
|
-
alignItems: 'flex-start',
|
|
180
|
-
maxWidth: '100%',
|
|
181
|
-
width: '100%',
|
|
182
|
-
'& .MuiAlert-message': {
|
|
183
|
-
minWidth: 0,
|
|
184
|
-
},
|
|
185
|
-
...(snack.action != null ? {
|
|
186
|
-
'& .MuiAlert-action': {
|
|
187
|
-
alignItems: 'flex-start',
|
|
188
|
-
},
|
|
189
|
-
} : {
|
|
190
|
-
'& .MuiAlert-action': {
|
|
191
|
-
alignItems: 'stretch',
|
|
192
|
-
alignSelf: 'stretch',
|
|
193
|
-
mb: '-6px',
|
|
194
|
-
mr: '-16px',
|
|
195
|
-
mt: '-6px',
|
|
196
|
-
pb: 0,
|
|
197
|
-
pl: '8px',
|
|
198
|
-
pt: 0,
|
|
199
|
-
},
|
|
200
|
-
'& .MuiAlert-action .MuiIconButton-root': {
|
|
201
|
-
alignItems: 'flex-start',
|
|
202
|
-
alignSelf: 'stretch',
|
|
203
|
-
borderRadius: 0,
|
|
204
|
-
pb: 0,
|
|
205
|
-
pl: '13px',
|
|
206
|
-
pr: '13px',
|
|
207
|
-
pt: '15px',
|
|
208
|
-
},
|
|
209
|
-
}),
|
|
210
|
-
} },
|
|
211
|
-
progressScale != null && !prefersReducedMotion ? (react_1.default.createElement(material_1.Box, { "data-testid": 'overlay-snackbar-progress', sx: {
|
|
212
|
-
position: 'absolute',
|
|
213
|
-
top: 0,
|
|
214
|
-
left: 0,
|
|
215
|
-
right: 0,
|
|
216
|
-
height: '3px',
|
|
217
|
-
backgroundColor: 'currentColor',
|
|
218
|
-
opacity: 0.24,
|
|
219
|
-
transformOrigin: 'left',
|
|
220
|
-
transform: `scaleX(${progressScale})`,
|
|
221
|
-
pointerEvents: 'none',
|
|
222
|
-
} })) : null,
|
|
223
|
-
snack.message)));
|
|
182
|
+
react_1.default.createElement(OverlayToast_1.default, { action: snack.action, description: snack.description, onClose: remove, presentation: isPaynetErrorMessage(snack.message) ? 'banner' : 'toast', progress: prefersReducedMotion ? null : progressScale, tone: snack.variant ?? 'info' }, snack.message)));
|
|
224
183
|
};
|
|
225
184
|
const MeasuredSnackbarStack = ({ anchor, breakpoint, completeExitPart, items, leftOffset, operationCenterElement, operationCenterHeight, prefersReducedMotion, removeSnackbar, }) => {
|
|
226
185
|
const [stackElement, setStackElement] = (0, react_1.useState)(null);
|
|
@@ -243,13 +202,13 @@ const MeasuredSnackbarStack = ({ anchor, breakpoint, completeExitPart, items, le
|
|
|
243
202
|
: {
|
|
244
203
|
bottom: sharesOperationBottom
|
|
245
204
|
? operationCenterHeight + OPERATION_CENTER_OFFSET
|
|
246
|
-
: STACK_OFFSET -
|
|
205
|
+
: STACK_OFFSET - NOTIFICATION_GAP,
|
|
247
206
|
top: 'auto',
|
|
248
207
|
flexDirection: 'column-reverse',
|
|
249
208
|
'@supports (bottom: env(safe-area-inset-bottom))': {
|
|
250
209
|
bottom: sharesOperationBottom
|
|
251
210
|
? `calc(${operationCenterHeight + OPERATION_CENTER_OFFSET}px + env(safe-area-inset-bottom, 0px))`
|
|
252
|
-
: `calc(${STACK_OFFSET -
|
|
211
|
+
: `calc(${STACK_OFFSET - NOTIFICATION_GAP}px + env(safe-area-inset-bottom, 0px))`,
|
|
253
212
|
},
|
|
254
213
|
};
|
|
255
214
|
return (react_1.default.createElement(material_1.Box, { "data-pne-overlay-stack": `${anchor.vertical}-${anchor.horizontal}`, ref: setStackElement, sx: {
|
|
@@ -260,8 +219,11 @@ const MeasuredSnackbarStack = ({ anchor, breakpoint, completeExitPart, items, le
|
|
|
260
219
|
pointerEvents: 'none',
|
|
261
220
|
...horizontalStyles,
|
|
262
221
|
...verticalStyles,
|
|
263
|
-
} }, items.map(({ open, presentationKey, snack }) => (react_1.default.createElement(material_1.Collapse, { key: presentationKey, appear: false, enter: false, in: open, onExited: () => completeExitPart(presentationKey, 'collapse'),
|
|
264
|
-
|
|
222
|
+
} }, items.map(({ open, presentationKey, snack }, index) => (react_1.default.createElement(material_1.Collapse, { key: presentationKey, appear: false, enter: false, in: open, onExited: () => completeExitPart(presentationKey, 'collapse'),
|
|
223
|
+
// The first item stands lowest. A toast casts a long shadow downwards, so each item is
|
|
224
|
+
// drawn over the ones above it and no shadow falls on a neighbour's face.
|
|
225
|
+
sx: { position: 'relative', zIndex: items.length - index }, timeout: prefersReducedMotion ? 0 : STACK_REFLOW_DURATION_MS },
|
|
226
|
+
react_1.default.createElement(material_1.Box, { "data-pne-overlay-stack-item": true, sx: { pb: `${NOTIFICATION_GAP}px` } },
|
|
265
227
|
react_1.default.createElement(ManagedSnackbar, { anchor: anchor, onExited: () => completeExitPart(presentationKey, 'grow'), open: open, onRemove: removeSnackbar, prefersReducedMotion: prefersReducedMotion, snack: snack })))))));
|
|
266
228
|
};
|
|
267
229
|
const MeasuredPermanentOverlay = ({ breakpoint, content, entry, operationCenterElement, operationCenterHeight, }) => {
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const createTheme_1 = require("../../createTheme");
|
|
7
|
+
const dropdownLook_1 = require("../dropdown/dropdownLook");
|
|
8
|
+
const iconActionLook_1 = require("../iconActionLook");
|
|
9
|
+
/**
|
|
10
|
+
* One notification of OverlayHost by the UI Kit.
|
|
11
|
+
* Toast: a card filled with the colour of its tone, radius 8, 8/16 inside, the toast shadow; the
|
|
12
|
+
* message as the title (18/26 SemiBold) over an optional description (12/16 in the text colour of
|
|
13
|
+
* the tone); the consumer's action and a 32px close cross on the right, 64px from the text; a 3px
|
|
14
|
+
* timer bar along the bottom that shrinks to the left. No sign of the tone.
|
|
15
|
+
* Banner (an error with details): the pale fill of the tone inside a ring of its colour, 12/16
|
|
16
|
+
* inside, the 20px sign of the tone on the left, a 24px close cross.
|
|
17
|
+
*/
|
|
18
|
+
// The snackbar's transition holds the card by its ref and style, so both go to the root.
|
|
19
|
+
const OverlayToast = React.forwardRef(function OverlayToast({ action, children, closeLabel = 'Close', description, onClose, presentation = 'toast', progress, style, tone = 'info', }, ref) {
|
|
20
|
+
const isBanner = presentation === 'banner';
|
|
21
|
+
return React.createElement(material_1.Alert, { ref: ref, style: style, action: React.createElement(React.Fragment, null,
|
|
22
|
+
action,
|
|
23
|
+
onClose ? React.createElement(material_1.IconButton, { "aria-label": closeLabel, "data-pne-toast-close": 'true', disableRipple: true, onClick: onClose, sx: (0, iconActionLook_1.pneIconActionSx)(isBanner ? 'small' : 'medium', 'var(--pne-toast-text)'), title: closeLabel, type: 'button' },
|
|
24
|
+
React.createElement(dropdownLook_1.PneCloseIcon, null)) : null), "data-pne-toast": presentation, "data-pne-tone": tone, elevation: 0, icon: isBanner ? undefined : false, severity: tone, sx: overlayToastSx },
|
|
25
|
+
progress != null ? React.createElement("span", { "aria-hidden": 'true', "data-pne-toast-timer": 'true', "data-testid": 'overlay-snackbar-progress', style: { transform: `scaleX(${progress})` } }) : null,
|
|
26
|
+
isBanner ? children : React.createElement(React.Fragment, null,
|
|
27
|
+
React.createElement("span", { "data-pne-toast-title": 'true' }, children),
|
|
28
|
+
description != null && description !== ''
|
|
29
|
+
? React.createElement("span", { "data-pne-toast-description": 'true' }, description)
|
|
30
|
+
: null));
|
|
31
|
+
});
|
|
32
|
+
exports.default = OverlayToast;
|
|
33
|
+
const TONES = ['info', 'success', 'warning', 'error'];
|
|
34
|
+
const overlayToastSx = theme => {
|
|
35
|
+
const toast = (0, createTheme_1.resolvePneSemanticPalette)(theme).toast;
|
|
36
|
+
const rules = {
|
|
37
|
+
'&': {
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
borderRadius: '8px',
|
|
40
|
+
boxShadow: toast.shadow,
|
|
41
|
+
boxSizing: 'border-box',
|
|
42
|
+
color: toast.title,
|
|
43
|
+
maxWidth: '100%',
|
|
44
|
+
overflow: 'hidden',
|
|
45
|
+
padding: '8px 16px',
|
|
46
|
+
position: 'relative',
|
|
47
|
+
width: '100%',
|
|
48
|
+
},
|
|
49
|
+
'& .MuiAlert-message': {
|
|
50
|
+
display: 'flex',
|
|
51
|
+
flex: '1 1 auto',
|
|
52
|
+
flexDirection: 'column',
|
|
53
|
+
minWidth: 0,
|
|
54
|
+
overflow: 'visible',
|
|
55
|
+
padding: 0,
|
|
56
|
+
},
|
|
57
|
+
// The actions keep 64px from the text; on a phone the text needs that room itself.
|
|
58
|
+
'& .MuiAlert-action': {
|
|
59
|
+
alignItems: 'center',
|
|
60
|
+
display: 'flex',
|
|
61
|
+
flex: '0 0 auto',
|
|
62
|
+
gap: '8px',
|
|
63
|
+
margin: 0,
|
|
64
|
+
padding: '0 0 0 64px',
|
|
65
|
+
'@media (max-width: 480px)': {
|
|
66
|
+
paddingLeft: '16px',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
'& [data-pne-toast-title]': {
|
|
70
|
+
fontSize: '18px',
|
|
71
|
+
fontWeight: 600,
|
|
72
|
+
lineHeight: '26px',
|
|
73
|
+
overflowWrap: 'anywhere',
|
|
74
|
+
},
|
|
75
|
+
'& [data-pne-toast-description]': {
|
|
76
|
+
color: 'var(--pne-toast-text)',
|
|
77
|
+
fontSize: '12px',
|
|
78
|
+
lineHeight: '16px',
|
|
79
|
+
overflowWrap: 'anywhere',
|
|
80
|
+
},
|
|
81
|
+
'& [data-pne-toast-timer]': {
|
|
82
|
+
backgroundColor: 'var(--pne-toast-text)',
|
|
83
|
+
bottom: 0,
|
|
84
|
+
height: '3px',
|
|
85
|
+
left: 0,
|
|
86
|
+
pointerEvents: 'none',
|
|
87
|
+
position: 'absolute',
|
|
88
|
+
right: 0,
|
|
89
|
+
transformOrigin: 'left',
|
|
90
|
+
},
|
|
91
|
+
// Banner: an error with an identifier and details.
|
|
92
|
+
'&[data-pne-toast="banner"]': {
|
|
93
|
+
alignItems: 'flex-start',
|
|
94
|
+
padding: '12px 16px',
|
|
95
|
+
},
|
|
96
|
+
'&[data-pne-toast="banner"] .MuiAlert-icon': {
|
|
97
|
+
color: 'var(--pne-toast-text)',
|
|
98
|
+
fontSize: '20px',
|
|
99
|
+
marginRight: '12px',
|
|
100
|
+
opacity: 1,
|
|
101
|
+
padding: 0,
|
|
102
|
+
},
|
|
103
|
+
'&[data-pne-toast="banner"] .MuiAlert-message': {
|
|
104
|
+
fontSize: '14px',
|
|
105
|
+
lineHeight: '20px',
|
|
106
|
+
},
|
|
107
|
+
'&[data-pne-toast="banner"] .MuiAlert-action': {
|
|
108
|
+
alignItems: 'flex-start',
|
|
109
|
+
paddingLeft: '12px',
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
for (const tone of TONES) {
|
|
113
|
+
const colors = toast[tone];
|
|
114
|
+
rules[`&[data-pne-tone="${tone}"]`] = {
|
|
115
|
+
'--pne-toast-text': colors.text,
|
|
116
|
+
backgroundColor: colors.fill,
|
|
117
|
+
};
|
|
118
|
+
rules[`&[data-pne-toast="banner"][data-pne-tone="${tone}"]`] = {
|
|
119
|
+
backgroundColor: colors.bannerFill,
|
|
120
|
+
boxShadow: `inset 0 0 0 1px ${colors.fill}, ${toast.shadow}`,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return rules;
|
|
124
|
+
};
|
|
@@ -3,13 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.overlayActions = exports.useOverlayStore = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const createTheme_1 = require("../../createTheme");
|
|
7
7
|
const PneButton_1 = tslib_1.__importDefault(require("../PneButton"));
|
|
8
8
|
const zustand_1 = require("zustand");
|
|
9
9
|
const overlayRuntime_1 = require("./overlayRuntime");
|
|
10
10
|
const paynetError_1 = require("./paynetError");
|
|
11
11
|
const PaynetErrorContent_1 = require("./PaynetErrorContent");
|
|
12
12
|
const defaultAutoHideMs = 5000;
|
|
13
|
+
// The label of a toast's action reads as the primary text on the soft fill, whatever the skin.
|
|
14
|
+
const toastActionSx = theme => ({
|
|
15
|
+
color: (0, createTheme_1.resolvePneSemanticPalette)(theme).toast.title,
|
|
16
|
+
});
|
|
13
17
|
const makeId = () => {
|
|
14
18
|
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
|
|
15
19
|
return crypto.randomUUID();
|
|
@@ -96,16 +100,14 @@ exports.overlayActions = {
|
|
|
96
100
|
...snackbar,
|
|
97
101
|
id,
|
|
98
102
|
action: react_1.default.createElement(PneButton_1.default, {
|
|
99
|
-
|
|
103
|
+
// UI Kit Toast: a soft small button whose label reads as the primary text.
|
|
104
|
+
pneStyle: 'neutral',
|
|
100
105
|
size: 'small',
|
|
101
|
-
startIcon: react_1.default.createElement(Undo_1.default, { fontSize: 'inherit' }),
|
|
102
106
|
onClick: () => {
|
|
103
107
|
exports.useOverlayStore.getState().removeSnackbar(id);
|
|
104
108
|
onUndo();
|
|
105
109
|
},
|
|
106
|
-
sx:
|
|
107
|
-
fontWeight: 600,
|
|
108
|
-
},
|
|
110
|
+
sx: toastActionSx,
|
|
109
111
|
}, undoLabel),
|
|
110
112
|
});
|
|
111
113
|
return id;
|
|
@@ -3,21 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
|
+
const createTheme_1 = require("../../createTheme");
|
|
6
7
|
const AbstractHeaderTableCell = (props) => {
|
|
7
8
|
const { sx, children, ...rest } = props;
|
|
9
|
+
// UI Kit Cell/Header: 14/20 SemiBold over a hairline; with the line the header row is 40px high.
|
|
8
10
|
const _sx = [
|
|
9
11
|
{
|
|
10
|
-
fontSize: '
|
|
12
|
+
fontSize: '14px',
|
|
11
13
|
fontStyle: 'normal',
|
|
12
|
-
fontWeight:
|
|
13
|
-
lineHeight: '
|
|
14
|
-
color: (theme) => theme.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
padding: '8px',
|
|
18
|
-
borderBottom: (theme) => `1px solid ${theme.palette.mode === 'dark'
|
|
19
|
-
? theme.palette.divider
|
|
20
|
-
: '#b7cdda'}`
|
|
14
|
+
fontWeight: 600,
|
|
15
|
+
lineHeight: '20px',
|
|
16
|
+
color: (theme) => (0, createTheme_1.resolvePneSemanticPalette)(theme).table.header.text,
|
|
17
|
+
padding: '10px 12px 9px',
|
|
18
|
+
borderBottom: (theme) => `1px solid ${(0, createTheme_1.resolvePneSemanticPalette)(theme).table.line}`,
|
|
21
19
|
},
|
|
22
20
|
...(Array.isArray(sx) ? sx : [sx])
|
|
23
21
|
];
|
|
@@ -3,13 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const AbstractHeaderTableCell_1 = tslib_1.__importDefault(require("./AbstractHeaderTableCell"));
|
|
6
|
-
const usePneTheme_1 = require("../../usePneTheme");
|
|
7
6
|
const PneHeaderTableCell = (props) => {
|
|
8
7
|
const { sx, sortDirection, sortIndex, sortOptions, children, ...rest } = props;
|
|
9
|
-
const theme = (0, usePneTheme_1.usePneTheme)();
|
|
10
8
|
const _sx = [
|
|
11
9
|
{
|
|
12
|
-
borderBottom: `1px solid ${theme.palette.primary.light}`,
|
|
13
10
|
background: 'transparent',
|
|
14
11
|
},
|
|
15
12
|
...(Array.isArray(sx) ? sx : [sx])
|
|
@@ -4,15 +4,22 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const AbstractTableCell_1 = tslib_1.__importDefault(require("./AbstractTableCell"));
|
|
6
6
|
const usePneTheme_1 = require("../../usePneTheme");
|
|
7
|
+
const createTheme_1 = require("../../createTheme");
|
|
8
|
+
// 10 + 20 + 9 and the 1px line of the row make the 40px of the UI Kit row.
|
|
9
|
+
const CELL_PADDING = '10px 12px 9px';
|
|
7
10
|
const PneTableCell = (0, react_1.forwardRef)((props, ref) => {
|
|
8
11
|
const theme = (0, usePneTheme_1.usePneTheme)();
|
|
9
12
|
const { sx, onClick, children, selected, ...rest } = props;
|
|
13
|
+
const table = (0, createTheme_1.resolvePneSemanticPalette)(theme).table;
|
|
14
|
+
// UI Kit Cell: 12px at the sides, the 14/20 text of a value; with its line a one-line row is 40px high.
|
|
10
15
|
const _sx = [
|
|
11
16
|
{
|
|
12
|
-
padding:
|
|
13
|
-
background: selected ?
|
|
17
|
+
padding: CELL_PADDING,
|
|
18
|
+
background: selected ? table.row.selected : 'inherit',
|
|
14
19
|
border: 'none',
|
|
15
|
-
color:
|
|
20
|
+
color: table.text,
|
|
21
|
+
fontSize: '14px',
|
|
22
|
+
lineHeight: '20px',
|
|
16
23
|
position: 'relative',
|
|
17
24
|
},
|
|
18
25
|
...(Array.isArray(sx) ? sx : [sx])
|
|
@@ -1,37 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const system_1 = require("@mui/system");
|
|
4
3
|
const material_1 = require("@mui/material");
|
|
5
|
-
|
|
4
|
+
// The styled of MUI Material, not of MUI System: without a ThemeProvider it falls back to the Material
|
|
5
|
+
// theme, whose palette the colours of the row are built from.
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const createTheme_1 = require("../../createTheme");
|
|
8
|
+
/**
|
|
9
|
+
* UI Kit Table row: a hairline under each row but the last one, and the hover fill under the pointer
|
|
10
|
+
* (`hover={false}` switches it off). The cells carry the line, so a row keeps its height whatever
|
|
11
|
+
* stands in it.
|
|
12
|
+
*/
|
|
13
|
+
const PneTableRow = (0, styles_1.styled)(material_1.TableRow, {
|
|
6
14
|
shouldForwardProp: prop => prop !== 'hover'
|
|
7
|
-
})(({ theme, hover = true }) =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
15
|
+
})(({ theme, hover = true }) => {
|
|
16
|
+
const table = (0, createTheme_1.resolvePneSemanticPalette)(theme).table;
|
|
17
|
+
const paper = theme.palette.mode === 'dark' ? theme.palette.background.paper : '#fff';
|
|
18
|
+
return {
|
|
19
|
+
borderColor: 'transparent',
|
|
20
|
+
borderBottomColor: table.line,
|
|
21
|
+
fontSize: '14px',
|
|
22
|
+
lineHeight: '20px',
|
|
23
|
+
// The table drops the line of its last row.
|
|
24
|
+
'tbody > &:last-of-type': {
|
|
25
|
+
borderBottomColor: 'transparent',
|
|
26
|
+
},
|
|
27
|
+
...(hover ? {
|
|
28
|
+
'tbody > &:hover': {
|
|
29
|
+
backgroundColor: table.row.hover,
|
|
30
|
+
},
|
|
31
|
+
} : {}),
|
|
32
|
+
// A picked row keeps its fill under the pointer too (UI Kit: Brand/100).
|
|
33
|
+
'&&.Mui-selected, tbody > &&.Mui-selected:hover': {
|
|
34
|
+
backgroundColor: table.row.selected,
|
|
35
|
+
},
|
|
36
|
+
'& td': {
|
|
37
|
+
borderTop: `1px solid ${paper}`,
|
|
38
|
+
borderBottom: `1px solid ${paper}`,
|
|
39
|
+
borderColor: 'inherit',
|
|
40
|
+
},
|
|
41
|
+
'& td:first-of-type': {
|
|
42
|
+
borderLeft: `1px solid ${paper}`,
|
|
43
|
+
borderColor: 'inherit',
|
|
44
|
+
},
|
|
45
|
+
'& td:last-of-type': {
|
|
46
|
+
borderRight: `1px solid ${paper}`,
|
|
47
|
+
borderColor: 'inherit',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
});
|
|
37
51
|
exports.default = PneTableRow;
|