@12-apps/ui 6.67.0 → 6.68.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/dist/_internal/components/data-display/Chip/Chip.js +3 -3
- package/dist/_internal/components/data-display/Chip/Chip.metrics.js +5 -1
- package/dist/_internal/components/data-display/Chip/Chip.styles.js +2 -2
- package/dist/_internal/components/data-display/DataViews/DataViewsGrid.js +6 -6
- package/dist/_internal/components/data-display/DataViews/DataViewsTableBase.js +7 -7
- package/dist/_internal/components/data-display/DataViews/data-views-filter-panel.js +4 -4
- package/dist/_internal/components/data-display/DataViews/data-views-grid-parts.js +5 -5
- package/dist/_internal/components/data-display/index.js +3 -3
- package/dist/_internal/components/feedback/StackedModal/StackedModal.js +3 -3
- package/dist/_internal/components/feedback/StackedModal/StackedModal.parts.js +2 -2
- package/dist/_internal/components/feedback/StackedModal/StackedModal.styles.js +1 -1
- package/dist/_internal/components/feedback/index.js +3 -3
- package/dist/_internal/components/index.js +14 -14
- package/dist/_internal/components/layout/SettingCard/SettingCard.js +6 -6
- package/dist/_internal/components/layout/SettingCard/SettingCard.parts.js +4 -4
- package/dist/_internal/components/layout/SettingCard/SettingCard.summary.js +5 -5
- package/dist/_internal/components/layout/SettingCard/SettingGrid.js +5 -5
- package/dist/_internal/components/layout/SettingCard/SettingGroup.js +7 -7
- package/dist/_internal/components/layout/SettingCard/SettingSwitch.js +6 -6
- package/dist/_internal/components/layout/SettingCard/SettingToggle.js +7 -7
- package/dist/_internal/components/layout/index.js +10 -10
- package/dist/_internal/components/navigation/Tabs/Tabs.js +1 -1
- package/dist/_internal/components/navigation/index.js +1 -1
- package/dist/{chunk-AAXLQFC7.js → chunk-3FIIMP7I.js} +2 -2
- package/dist/{chunk-6A6GZRXD.js → chunk-3VXS7O3X.js} +2 -2
- package/dist/{chunk-QAZLQYSD.js → chunk-6CZC5S6O.js} +2 -2
- package/dist/{chunk-HYQJJLBC.js → chunk-DHAXUVMR.js} +27 -3
- package/dist/chunk-DHAXUVMR.js.map +1 -0
- package/dist/{chunk-AHNEEFK6.js → chunk-E5GYHN4X.js} +3 -3
- package/dist/{chunk-KU6VHNRV.js → chunk-E5I776YW.js} +6 -2
- package/dist/{chunk-KU6VHNRV.js.map → chunk-E5I776YW.js.map} +1 -1
- package/dist/{chunk-5RC7WAHH.js → chunk-EZAQIEYB.js} +2 -2
- package/dist/{chunk-SAJDNO43.js → chunk-IGMD6S76.js} +3 -3
- package/dist/{chunk-EZFQO77P.js → chunk-IPYV7BLH.js} +2 -2
- package/dist/{chunk-TNVO3EVF.js → chunk-KT3TF2LT.js} +5 -3
- package/dist/chunk-KT3TF2LT.js.map +1 -0
- package/dist/{chunk-P3USTYIO.js → chunk-L7HKMTKR.js} +2 -2
- package/dist/{chunk-7JS2SPRW.js → chunk-LKRXLWCC.js} +3 -3
- package/dist/{chunk-EWTSQTVR.js → chunk-NI67M453.js} +6 -5
- package/dist/chunk-NI67M453.js.map +1 -0
- package/dist/{chunk-CMLIWUBW.js → chunk-QPCHABOZ.js} +24 -1
- package/dist/chunk-QPCHABOZ.js.map +1 -0
- package/dist/{chunk-KUFDUXYB.js → chunk-U6ODZJCH.js} +2 -2
- package/dist/{chunk-3PGY4UL4.js → chunk-YKQA4NPM.js} +37 -7
- package/dist/chunk-YKQA4NPM.js.map +1 -0
- package/dist/{chunk-XMVPNCYM.js → chunk-YQGVO3ZU.js} +3 -3
- package/dist/{chunk-OJFE5PK6.js → chunk-ZZO5MRMV.js} +2 -2
- package/dist/data-display/Chip.js +3 -3
- package/dist/data-display/DataViews.js +7 -7
- package/dist/feedback/StackedModal.js +3 -3
- package/dist/layout/SettingCard.js +10 -10
- package/dist/native/data-display/Chip.js +20 -1
- package/dist/native/data-display/Chip.js.map +1 -1
- package/dist/navigation/Tabs.js +1 -1
- package/dist/types/components/data-display/Chip/Chip.base.d.ts +5 -1
- package/dist/types/components/data-display/Chip/Chip.base.d.ts.map +1 -1
- package/dist/types/components/data-display/Chip/Chip.d.ts.map +1 -1
- package/dist/types/components/data-display/Chip/Chip.metrics.d.ts +4 -0
- package/dist/types/components/data-display/Chip/Chip.metrics.d.ts.map +1 -1
- package/dist/types/components/data-display/Chip/Chip.styles.d.ts +2 -7
- package/dist/types/components/data-display/Chip/Chip.styles.d.ts.map +1 -1
- package/dist/types/components/feedback/StackedModal/StackedModal.d.ts.map +1 -1
- package/dist/types/components/feedback/StackedModal/StackedModal.styles.d.ts +2 -1
- package/dist/types/components/feedback/StackedModal/StackedModal.styles.d.ts.map +1 -1
- package/dist/types/components/feedback/StackedModal/StackedModal.types.d.ts +17 -0
- package/dist/types/components/feedback/StackedModal/StackedModal.types.d.ts.map +1 -1
- package/dist/types/components/feedback/StackedModal/index.d.ts +1 -1
- package/dist/types/components/feedback/StackedModal/index.d.ts.map +1 -1
- package/dist/types/components/navigation/Tabs/Tabs.d.ts.map +1 -1
- package/dist/types/components/navigation/Tabs/Tabs.types.d.ts +12 -0
- package/dist/types/components/navigation/Tabs/Tabs.types.d.ts.map +1 -1
- package/dist/types/components/navigation/Tabs/index.d.ts +1 -1
- package/dist/types/components/navigation/Tabs/index.d.ts.map +1 -1
- package/dist/types-native/components/data-display/Chip/Chip.base.d.ts +5 -1
- package/dist/types-native/components/data-display/Chip/Chip.base.d.ts.map +1 -1
- package/dist/types-native/components/data-display/Chip/Chip.look.native.d.ts.map +1 -1
- package/dist/types-native/components/data-display/Chip/Chip.metrics.d.ts +4 -0
- package/dist/types-native/components/data-display/Chip/Chip.metrics.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/data-display/Chip/Chip.base.ts +5 -1
- package/src/components/data-display/Chip/Chip.look.native.ts +22 -1
- package/src/components/data-display/Chip/Chip.metrics.ts +5 -0
- package/src/components/data-display/Chip/Chip.styles.tsx +38 -1
- package/src/components/data-display/Chip/Chip.tsx +6 -2
- package/src/components/data-display/Chip/chip.md +2 -2
- package/src/components/feedback/StackedModal/StackedModal.md +1 -0
- package/src/components/feedback/StackedModal/StackedModal.styles.ts +53 -6
- package/src/components/feedback/StackedModal/StackedModal.tsx +2 -1
- package/src/components/feedback/StackedModal/StackedModal.types.ts +17 -0
- package/src/components/feedback/StackedModal/index.ts +1 -1
- package/src/components/navigation/Tabs/Tabs.md +1 -0
- package/src/components/navigation/Tabs/Tabs.tsx +30 -1
- package/src/components/navigation/Tabs/Tabs.types.ts +14 -0
- package/src/components/navigation/Tabs/index.ts +1 -1
- package/dist/chunk-3PGY4UL4.js.map +0 -1
- package/dist/chunk-CMLIWUBW.js.map +0 -1
- package/dist/chunk-EWTSQTVR.js.map +0 -1
- package/dist/chunk-HYQJJLBC.js.map +0 -1
- package/dist/chunk-TNVO3EVF.js.map +0 -1
- /package/dist/{chunk-AAXLQFC7.js.map → chunk-3FIIMP7I.js.map} +0 -0
- /package/dist/{chunk-6A6GZRXD.js.map → chunk-3VXS7O3X.js.map} +0 -0
- /package/dist/{chunk-QAZLQYSD.js.map → chunk-6CZC5S6O.js.map} +0 -0
- /package/dist/{chunk-AHNEEFK6.js.map → chunk-E5GYHN4X.js.map} +0 -0
- /package/dist/{chunk-5RC7WAHH.js.map → chunk-EZAQIEYB.js.map} +0 -0
- /package/dist/{chunk-SAJDNO43.js.map → chunk-IGMD6S76.js.map} +0 -0
- /package/dist/{chunk-EZFQO77P.js.map → chunk-IPYV7BLH.js.map} +0 -0
- /package/dist/{chunk-P3USTYIO.js.map → chunk-L7HKMTKR.js.map} +0 -0
- /package/dist/{chunk-7JS2SPRW.js.map → chunk-LKRXLWCC.js.map} +0 -0
- /package/dist/{chunk-KUFDUXYB.js.map → chunk-U6ODZJCH.js.map} +0 -0
- /package/dist/{chunk-XMVPNCYM.js.map → chunk-YQGVO3ZU.js.map} +0 -0
- /package/dist/{chunk-OJFE5PK6.js.map → chunk-ZZO5MRMV.js.map} +0 -0
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
DELETE_ICON_ON_COLOR_ALPHA,
|
|
11
11
|
OUTLINED_BORDER_ALPHA,
|
|
12
12
|
OUTLINED_HOVER_ALPHA,
|
|
13
|
+
SOFT_GROUND_ALPHA,
|
|
14
|
+
SOFT_HOVER_ALPHA,
|
|
13
15
|
type ChipMuiSize,
|
|
14
16
|
type ChipSizeMetrics,
|
|
15
17
|
} from './Chip.metrics';
|
|
@@ -52,6 +54,24 @@ function filledPaint(theme: UiTheme, color: ChipColor): ChipPaint {
|
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
56
|
|
|
57
|
+
function softPaint(theme: UiTheme, color: ChipColor): ChipPaint {
|
|
58
|
+
if (!isAccented(color)) {
|
|
59
|
+
return {
|
|
60
|
+
container: { backgroundColor: theme.palette.action.selected },
|
|
61
|
+
pressed: { backgroundColor: theme.palette.action.hover },
|
|
62
|
+
label: { color: theme.palette.text.secondary, fontWeight: '600' },
|
|
63
|
+
deleteColor: alpha(theme.palette.text.secondary, DELETE_ICON_ALPHA),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const accent = theme.palette[color];
|
|
67
|
+
return {
|
|
68
|
+
container: { backgroundColor: alpha(accent.main, SOFT_GROUND_ALPHA) },
|
|
69
|
+
pressed: { backgroundColor: alpha(accent.main, SOFT_HOVER_ALPHA) },
|
|
70
|
+
label: { color: accent.dark, fontWeight: '600' },
|
|
71
|
+
deleteColor: alpha(accent.dark, DELETE_ICON_ALPHA),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
55
75
|
function outlinedPaint(theme: UiTheme, color: ChipColor): ChipPaint {
|
|
56
76
|
const border: ViewStyle = { backgroundColor: 'transparent', borderWidth: 1, borderStyle: 'solid' };
|
|
57
77
|
if (!isAccented(color)) {
|
|
@@ -82,7 +102,8 @@ export function chipPaint(
|
|
|
82
102
|
color: ChipColor,
|
|
83
103
|
selected: boolean,
|
|
84
104
|
): ChipPaint {
|
|
85
|
-
const paint =
|
|
105
|
+
const paint =
|
|
106
|
+
variant === 'outlined' ? outlinedPaint(theme, color) : variant === 'soft' ? softPaint(theme, color) : filledPaint(theme, color);
|
|
86
107
|
if (variant !== 'outlined' || !selected) return paint;
|
|
87
108
|
return {
|
|
88
109
|
...paint,
|
|
@@ -100,3 +100,8 @@ export const HOVER_LIFT_PX = 1;
|
|
|
100
100
|
export const HOVER_SHADOW = { offsetY: 4, blur: 12, alphaLight: 0.15, alphaDark: 0.3 } as const;
|
|
101
101
|
export const CHIP_TRANSITION_MS = 200;
|
|
102
102
|
export const CHIP_TRANSITION_EASING = 'cubic-bezier(0.4, 0, 0.2, 1)';
|
|
103
|
+
|
|
104
|
+
/** A soft chip's ground: the colour at this alpha over the page. */
|
|
105
|
+
export const SOFT_GROUND_ALPHA = 0.14;
|
|
106
|
+
/** A soft chip's hover ground. */
|
|
107
|
+
export const SOFT_HOVER_ALPHA = 0.22;
|
|
@@ -4,7 +4,17 @@ import type { KeyboardEvent, ReactElement } from 'react';
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
6
|
import { chipKeyAction, type ChipKeyArgs } from './Chip.helpers';
|
|
7
|
-
import {
|
|
7
|
+
import { alpha } from '@mui/material/styles/index.js';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
CHIP_SIZES,
|
|
11
|
+
CHIP_TRANSITION_EASING,
|
|
12
|
+
CHIP_TRANSITION_MS,
|
|
13
|
+
HOVER_LIFT_PX,
|
|
14
|
+
HOVER_SHADOW,
|
|
15
|
+
SOFT_GROUND_ALPHA,
|
|
16
|
+
SOFT_HOVER_ALPHA,
|
|
17
|
+
} from './Chip.metrics';
|
|
8
18
|
import type { ChipProps } from './Chip.types';
|
|
9
19
|
import { shadowInk } from '../../../tokens/ink';
|
|
10
20
|
import { rem, rems, sxRem } from '../../../tokens/relative';
|
|
@@ -43,6 +53,7 @@ export const avatarFor = (
|
|
|
43
53
|
|
|
44
54
|
interface ChipStyleArgs {
|
|
45
55
|
variant: ChipProps['variant'];
|
|
56
|
+
color?: ChipProps['color'];
|
|
46
57
|
selected?: boolean;
|
|
47
58
|
clickable?: boolean;
|
|
48
59
|
disabled?: boolean;
|
|
@@ -61,8 +72,33 @@ const hoverShadow = (theme: Theme): string =>
|
|
|
61
72
|
* state); an outlined selected chip gets a subtle theme-driven `action.selected`
|
|
62
73
|
* tint so it reads as active without muddying the fill.
|
|
63
74
|
*/
|
|
75
|
+
/** The palette entry a colour paints with; `neutral` has none and takes the ink. */
|
|
76
|
+
const paletteKey = (color: NonNullable<ChipProps['color']>): 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | null => {
|
|
77
|
+
if (color === 'neutral') return null;
|
|
78
|
+
return color === 'danger' ? 'error' : color;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/** `soft`: the colour's tint for a ground, its dark step for ink (and the icon). */
|
|
82
|
+
const softStyles = (color: NonNullable<ChipProps['color']>): SxProps<Theme> => {
|
|
83
|
+
const key = paletteKey(color);
|
|
84
|
+
const ground = (theme: Theme): string =>
|
|
85
|
+
key ? alpha(theme.palette[key].main, SOFT_GROUND_ALPHA) : theme.palette.action.selected;
|
|
86
|
+
const ink = (theme: Theme): string => (key ? theme.palette[key].dark : theme.palette.text.secondary);
|
|
87
|
+
return {
|
|
88
|
+
backgroundColor: ground,
|
|
89
|
+
color: ink,
|
|
90
|
+
// A state is read at a glance: the label is set semibold.
|
|
91
|
+
fontWeight: 600,
|
|
92
|
+
'& .MuiChip-icon': { color: ink },
|
|
93
|
+
'&.MuiChip-clickable:hover': {
|
|
94
|
+
backgroundColor: (theme: Theme) => (key ? alpha(theme.palette[key].main, SOFT_HOVER_ALPHA) : theme.palette.action.hover),
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
64
99
|
export const chipStyles = ({
|
|
65
100
|
variant,
|
|
101
|
+
color = 'primary',
|
|
66
102
|
selected,
|
|
67
103
|
clickable,
|
|
68
104
|
disabled,
|
|
@@ -70,6 +106,7 @@ export const chipStyles = ({
|
|
|
70
106
|
const lifts = clickable && !disabled;
|
|
71
107
|
|
|
72
108
|
return {
|
|
109
|
+
...(variant === 'soft' ? (softStyles(color) as object) : {}),
|
|
73
110
|
// Enhanced styling for outlined variant
|
|
74
111
|
...(variant === 'outlined' && {
|
|
75
112
|
borderWidth: '1px',
|
|
@@ -37,6 +37,10 @@ const muiColorFor = (color: NonNullable<ChipProps['color']>): MuiChipColor => {
|
|
|
37
37
|
return color === 'neutral' ? 'default' : color;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
/** `soft` is ours: MUI has two variants, so it paints as `filled` and `chipStyles` tints it. */
|
|
41
|
+
const muiVariantFor = (variant: NonNullable<ChipProps['variant']>): 'filled' | 'outlined' =>
|
|
42
|
+
variant === 'soft' ? 'filled' : variant;
|
|
43
|
+
|
|
40
44
|
export const Chip = forwardRef<HTMLDivElement, ChipProps>(({
|
|
41
45
|
label,
|
|
42
46
|
variant = 'filled',
|
|
@@ -66,7 +70,7 @@ export const Chip = forwardRef<HTMLDivElement, ChipProps>(({
|
|
|
66
70
|
<MuiChip
|
|
67
71
|
ref={ref}
|
|
68
72
|
label={<span data-testid={testId('label')}>{label}</span>}
|
|
69
|
-
variant={variant}
|
|
73
|
+
variant={muiVariantFor(variant)}
|
|
70
74
|
size={chipMuiSize(size)}
|
|
71
75
|
color={muiColorFor(color)}
|
|
72
76
|
avatar={avatarFor(avatar, avatarSrc)}
|
|
@@ -81,7 +85,7 @@ export const Chip = forwardRef<HTMLDivElement, ChipProps>(({
|
|
|
81
85
|
role={chipRole(selectable, onClick)}
|
|
82
86
|
aria-selected={selectable ? selected : undefined}
|
|
83
87
|
data-testid={chipId || 'chip'}
|
|
84
|
-
sx={chipStyles({ variant, selected, clickable, disabled })}
|
|
88
|
+
sx={chipStyles({ variant, color, selected, clickable, disabled })}
|
|
85
89
|
{...props}
|
|
86
90
|
/>
|
|
87
91
|
);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
```ts
|
|
6
6
|
interface ChipProps {
|
|
7
7
|
label: string;
|
|
8
|
-
variant?: 'filled' | 'outlined';
|
|
8
|
+
variant?: 'filled' | 'outlined' | 'soft';
|
|
9
9
|
size?: SizeValue; // all five stops; MUI's two heights, xs/sm small and md up medium
|
|
10
10
|
/**
|
|
11
11
|
* The house vocabulary, identical to Button's. `danger` and `neutral` are
|
|
@@ -28,7 +28,7 @@ interface ChipProps {
|
|
|
28
28
|
|
|
29
29
|
**Features**
|
|
30
30
|
|
|
31
|
-
- Filled/Outlined variants; optional avatar or icon.
|
|
31
|
+
- Filled/Outlined/Soft variants; optional avatar or icon. `soft` is a status chip: the colour's tint for a ground and its dark step for ink.
|
|
32
32
|
- Selectable (toggle) and/or deletable (× button).
|
|
33
33
|
- Keyboard: Space/Enter activates; Delete/Backspace triggers remove when focused.
|
|
34
34
|
|
|
@@ -138,6 +138,7 @@ new component that portals should too.
|
|
|
138
138
|
| `fullScreen` | `boolean` | `false` | Full screen mode |
|
|
139
139
|
| `maxWidth` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| false` | `'md'` | Maximum modal width |
|
|
140
140
|
| `size` | `'default' \| 'wide'` | `'default'` | Viewport share of the top panel: default is 80vw (`sm`–`lg`), 60vw (`lg`+), 40vw (≥2200px); `wide` is 90vw up to `xl`, 75vw above, 60vw ≥2200px — for a dense two-column editor |
|
|
141
|
+
| `panelWidth` | `{ share: string; maxPx: number; fullBelowPx?: number }` | - | An exact width for the top panel: `min(share, maxPx)` of the viewport, the whole screen under `fullBelowPx`. Replaces `size` and `maxWidth`. Viewport only — nothing inside the panel feeds back into it |
|
|
141
142
|
| `disableBackdrop` | `boolean` | `false` | Hide backdrop |
|
|
142
143
|
| `disableFocusTrap` | `boolean` | `false` | Disable focus trapping |
|
|
143
144
|
| `keepMounted` | `boolean` | `false` | Keep modal mounted when closed |
|
|
@@ -3,7 +3,7 @@ import type { CSSObject, Theme } from '@mui/material/styles/index.js';
|
|
|
3
3
|
import { scrim } from '../../../tokens/ink';
|
|
4
4
|
import { rem } from '../../../tokens/relative';
|
|
5
5
|
import { dynamicViewportHeight } from '../../../utils/viewport';
|
|
6
|
-
import type { ModalPanelRole, PanelMaxWidth, PanelSize } from './StackedModal.types';
|
|
6
|
+
import type { ModalPanelRole, PanelMaxWidth, PanelSize, PanelWidth } from './StackedModal.types';
|
|
7
7
|
|
|
8
8
|
/** Props that drive the panel's look but must not reach the DOM. */
|
|
9
9
|
export interface PanelStyleProps {
|
|
@@ -13,10 +13,11 @@ export interface PanelStyleProps {
|
|
|
13
13
|
rtl?: boolean;
|
|
14
14
|
customMaxWidth?: PanelMaxWidth;
|
|
15
15
|
panelSize?: PanelSize;
|
|
16
|
+
panelWidth?: PanelWidth;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
/** Style-only props, filtered out before they can land on a DOM node. */
|
|
19
|
-
export const STYLE_ONLY_PROPS = ['modalRole', 'isAnimating', 'glass', 'rtl', 'customMaxWidth', 'panelSize'];
|
|
20
|
+
export const STYLE_ONLY_PROPS = ['modalRole', 'isAnimating', 'glass', 'rtl', 'customMaxWidth', 'panelSize', 'panelWidth'];
|
|
20
21
|
|
|
21
22
|
/** MUI breakpoint names mapped to the pixel width they cap the panel at. */
|
|
22
23
|
const MAX_WIDTH_PX: Record<Exclude<PanelMaxWidth, false>, number> = {
|
|
@@ -38,6 +39,15 @@ const ANIMATION_BY_ROLE: Partial<Record<ModalPanelRole, string>> = {
|
|
|
38
39
|
primary: 'contractModal 300ms ease-in-out forwards',
|
|
39
40
|
};
|
|
40
41
|
|
|
42
|
+
/** The custom property an exact-width panel's width and keyframes share. */
|
|
43
|
+
const EXACT_WIDTH_VAR = '--stacked-modal-width';
|
|
44
|
+
|
|
45
|
+
/** An exact-width panel settles at its own width, so its keyframes read it too. */
|
|
46
|
+
const EXACT_ANIMATION_BY_ROLE: Partial<Record<ModalPanelRole, string>> = {
|
|
47
|
+
secondary: 'expandModalExact 300ms ease-in-out forwards',
|
|
48
|
+
primary: 'contractModalExact 300ms ease-in-out forwards',
|
|
49
|
+
};
|
|
50
|
+
|
|
41
51
|
/** A wide panel settles at 90vw, so its keyframes must end there too, or it snaps. */
|
|
42
52
|
const WIDE_ANIMATION_BY_ROLE: Partial<Record<ModalPanelRole, string>> = {
|
|
43
53
|
secondary: 'expandModalWide 300ms ease-in-out forwards',
|
|
@@ -63,6 +73,15 @@ const KEYFRAMES: CSSObject = {
|
|
|
63
73
|
from: { width: '100vw', transform: 'translateX(0)' },
|
|
64
74
|
to: { width: '90vw', transform: 'translateX(0)' },
|
|
65
75
|
},
|
|
76
|
+
// An exact-width panel settles at its own width, carried by the custom property.
|
|
77
|
+
'@keyframes expandModalExact': {
|
|
78
|
+
from: { width: `var(${EXACT_WIDTH_VAR})`, transform: 'translateX(0)' },
|
|
79
|
+
to: { width: '100vw', transform: 'translateX(0)' },
|
|
80
|
+
},
|
|
81
|
+
'@keyframes contractModalExact': {
|
|
82
|
+
from: { width: '100vw', transform: 'translateX(0)' },
|
|
83
|
+
to: { width: `var(${EXACT_WIDTH_VAR})`, transform: 'translateX(0)' },
|
|
84
|
+
},
|
|
66
85
|
};
|
|
67
86
|
|
|
68
87
|
const cap = (customMaxWidth?: PanelMaxWidth): number | null =>
|
|
@@ -106,6 +125,22 @@ const widePrimaryPanelStyles = (theme: Theme, capPx: number | null): CSSObject =
|
|
|
106
125
|
[theme.breakpoints.up(2200)]: panelWidth(theme, '60vw', capPx),
|
|
107
126
|
});
|
|
108
127
|
|
|
128
|
+
/**
|
|
129
|
+
* `panelWidth`: `min(share, maxPx)` from `sm` up, the whole screen under `sm`
|
|
130
|
+
* and under `fullBelowPx`. Viewport media queries only — never the panel's size.
|
|
131
|
+
*/
|
|
132
|
+
const exactPrimaryPanelStyles = (theme: Theme, exact: PanelWidth): CSSObject => {
|
|
133
|
+
const width = `min(${exact.share}, ${rem(theme, exact.maxPx)})`;
|
|
134
|
+
const full = { [EXACT_WIDTH_VAR]: '100%', width: '100%', maxWidth: '100%' };
|
|
135
|
+
return {
|
|
136
|
+
[EXACT_WIDTH_VAR]: width,
|
|
137
|
+
width: `var(${EXACT_WIDTH_VAR})`,
|
|
138
|
+
maxWidth: `var(${EXACT_WIDTH_VAR})`,
|
|
139
|
+
[theme.breakpoints.down('sm')]: full,
|
|
140
|
+
...(exact.fullBelowPx ? { [theme.breakpoints.down(exact.fullBelowPx)]: full } : {}),
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
|
|
109
144
|
/** Panels below the top one expand to full width, producing the GTM stacking effect. */
|
|
110
145
|
const secondaryPanelStyles = (): CSSObject => ({
|
|
111
146
|
width: '100vw !important',
|
|
@@ -123,8 +158,10 @@ const rolePanelStyles = (
|
|
|
123
158
|
role: ModalPanelRole | undefined,
|
|
124
159
|
capPx: number | null,
|
|
125
160
|
size?: PanelSize,
|
|
161
|
+
exact?: PanelWidth,
|
|
126
162
|
): CSSObject => {
|
|
127
163
|
if (role === 'primary') {
|
|
164
|
+
if (exact) return exactPrimaryPanelStyles(theme, exact);
|
|
128
165
|
return size === 'wide' ? widePrimaryPanelStyles(theme, capPx) : primaryPanelStyles(theme, capPx);
|
|
129
166
|
}
|
|
130
167
|
if (role === 'secondary') return secondaryPanelStyles();
|
|
@@ -143,8 +180,18 @@ const glassStyles = (theme: Theme, glass?: boolean, role?: ModalPanelRole): CSSO
|
|
|
143
180
|
}
|
|
144
181
|
: {};
|
|
145
182
|
|
|
146
|
-
const
|
|
147
|
-
|
|
183
|
+
const animationByRole = (size?: PanelSize, exact?: PanelWidth): Partial<Record<ModalPanelRole, string>> => {
|
|
184
|
+
if (exact) return EXACT_ANIMATION_BY_ROLE;
|
|
185
|
+
return size === 'wide' ? WIDE_ANIMATION_BY_ROLE : ANIMATION_BY_ROLE;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const animationStyles = (
|
|
189
|
+
isAnimating?: boolean,
|
|
190
|
+
role?: ModalPanelRole,
|
|
191
|
+
size?: PanelSize,
|
|
192
|
+
exact?: PanelWidth,
|
|
193
|
+
): CSSObject => {
|
|
194
|
+
const byRole = animationByRole(size, exact);
|
|
148
195
|
return isAnimating ? { animation: (role && byRole[role]) ?? 'none' } : {};
|
|
149
196
|
};
|
|
150
197
|
|
|
@@ -169,9 +216,9 @@ const panelStyles = (theme: Theme, props: PanelStyleProps): CSSObject => {
|
|
|
169
216
|
const capPx = cap(props.customMaxWidth);
|
|
170
217
|
return {
|
|
171
218
|
...panelBaseStyles(theme),
|
|
172
|
-
...rolePanelStyles(theme, props.modalRole, capPx, props.panelSize),
|
|
219
|
+
...rolePanelStyles(theme, props.modalRole, capPx, props.panelSize, props.panelWidth),
|
|
173
220
|
...glassStyles(theme, props.glass, props.modalRole),
|
|
174
|
-
...animationStyles(props.isAnimating, props.modalRole, props.panelSize),
|
|
221
|
+
...animationStyles(props.isAnimating, props.modalRole, props.panelSize, props.panelWidth),
|
|
175
222
|
};
|
|
176
223
|
};
|
|
177
224
|
|
|
@@ -79,7 +79,7 @@ const useUnnamedDialogWarning = (unnamed: boolean): void => {
|
|
|
79
79
|
const StackedModalPanel: FC<ResolvedProps> = (props) => {
|
|
80
80
|
const {
|
|
81
81
|
open, onClose, glass, navigationTitle, backLabel, hideClose, hideHeader, children, actions, modalId,
|
|
82
|
-
closeOnClickOutside, closeOnEsc, loading, loadingText, fullScreen, maxWidth, size, disableBackdrop,
|
|
82
|
+
closeOnClickOutside, closeOnEsc, loading, loadingText, fullScreen, maxWidth, size, panelWidth, disableBackdrop,
|
|
83
83
|
disableFocusTrap, keepMounted, rtl, dataTestId,
|
|
84
84
|
'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...otherProps
|
|
85
85
|
} = props;
|
|
@@ -114,6 +114,7 @@ const StackedModalPanel: FC<ResolvedProps> = (props) => {
|
|
|
114
114
|
rtl={rtl}
|
|
115
115
|
customMaxWidth={maxWidth}
|
|
116
116
|
panelSize={size}
|
|
117
|
+
panelWidth={panelWidth}
|
|
117
118
|
TransitionComponent={SlideTransition}
|
|
118
119
|
maxWidth={maxWidth}
|
|
119
120
|
disableEscapeKeyDown={!closeOnEsc}
|
|
@@ -12,6 +12,21 @@ export type PanelMaxWidth = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | false;
|
|
|
12
12
|
* 60vw starves on a laptop.
|
|
13
13
|
*/
|
|
14
14
|
export type PanelSize = 'default' | 'wide';
|
|
15
|
+
/**
|
|
16
|
+
* An exact width for the top panel, for a screen whose owner set one: the
|
|
17
|
+
* panel takes `min(share, maxPx)` of the viewport, and the whole screen when
|
|
18
|
+
* the viewport is narrower than `fullBelowPx`. It replaces `size` and
|
|
19
|
+
* `maxWidth`. Everything here reads the VIEWPORT, never the panel, so nothing
|
|
20
|
+
* inside the panel can feed back into the width that laid it out.
|
|
21
|
+
*/
|
|
22
|
+
export interface PanelWidth {
|
|
23
|
+
/** The viewport share, as a CSS length (`'72vw'`). */
|
|
24
|
+
share: string;
|
|
25
|
+
/** The cap, in px; converted to rem like every other size here. */
|
|
26
|
+
maxPx: number;
|
|
27
|
+
/** Under this viewport width (px) the panel takes the whole screen. */
|
|
28
|
+
fullBelowPx?: number;
|
|
29
|
+
}
|
|
15
30
|
|
|
16
31
|
export interface StackedModalProps {
|
|
17
32
|
/** The back arrow's accessible name — it carries a glyph only. REQUIRED. */
|
|
@@ -64,6 +79,8 @@ export interface StackedModalProps {
|
|
|
64
79
|
maxWidth?: PanelMaxWidth;
|
|
65
80
|
/** Viewport share of the top panel — `wide` gives a dense editor more room */
|
|
66
81
|
size?: PanelSize;
|
|
82
|
+
/** An exact width for the top panel; replaces `size` and `maxWidth` (see `PanelWidth`). */
|
|
83
|
+
panelWidth?: PanelWidth;
|
|
67
84
|
/** Disable the backdrop click behavior */
|
|
68
85
|
disableBackdrop?: boolean;
|
|
69
86
|
/** Disable focus trap functionality */
|
|
@@ -50,6 +50,7 @@ The Tabs component provides an intuitive way to organize related content into se
|
|
|
50
50
|
| `content` | `ReactNode` | Yes | Content to display in panel |
|
|
51
51
|
| `icon` | `ReactNode` | No | Icon to display before label |
|
|
52
52
|
| `badge` | `string \| number` | No | Badge content (notification count) |
|
|
53
|
+
| `count` | `{ value: string \| number; tone?: 'neutral' \| 'warning' \| 'danger' }` | No | A count said inside the tab, after its label, as a small pill (lines, events, charges); `tone` marks one asking for action |
|
|
53
54
|
| `disabled` | `boolean` | No | Whether tab is disabled |
|
|
54
55
|
| `closable` | `boolean` | No | Whether tab can be closed |
|
|
55
56
|
| `className`| `string` | No | Custom CSS class for the tab |
|
|
@@ -10,7 +10,7 @@ import React from 'react';
|
|
|
10
10
|
|
|
11
11
|
import { CustomTabPanel } from './TabsPanel';
|
|
12
12
|
import { tabsRootStyles } from './Tabs.styles';
|
|
13
|
-
import type { TabItem, TabsProps } from './Tabs.types';
|
|
13
|
+
import type { TabCount, TabItem, TabsProps } from './Tabs.types';
|
|
14
14
|
import { rem, sxRem } from '../../../tokens/relative';
|
|
15
15
|
|
|
16
16
|
const StyledTabs = styled(MuiTabs, {
|
|
@@ -43,6 +43,30 @@ const BadgeWrapper = styled(Badge)(({ theme }) => ({
|
|
|
43
43
|
height: rem(theme, 16),
|
|
44
44
|
padding: 0 } }));
|
|
45
45
|
|
|
46
|
+
/** A tab's inline count pill, toned by what it asks for. */
|
|
47
|
+
const CountPill = styled('span', {
|
|
48
|
+
shouldForwardProp: (prop) => prop !== 'tone',
|
|
49
|
+
})<{ tone: NonNullable<TabCount['tone']> }>(({ theme, tone }) => {
|
|
50
|
+
const look = {
|
|
51
|
+
neutral: { backgroundColor: theme.palette.action.selected, color: theme.palette.text.secondary },
|
|
52
|
+
warning: { backgroundColor: alpha(theme.palette.warning.main, 0.16), color: theme.palette.warning.dark },
|
|
53
|
+
danger: { backgroundColor: theme.palette.error.main, color: theme.palette.error.contrastText },
|
|
54
|
+
}[tone];
|
|
55
|
+
return {
|
|
56
|
+
display: 'inline-flex',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
height: rem(theme, 20),
|
|
60
|
+
minWidth: rem(theme, 20),
|
|
61
|
+
padding: theme.spacing(0, 0.875),
|
|
62
|
+
borderRadius: rem(theme, 999),
|
|
63
|
+
fontSize: rem(theme, 11.5),
|
|
64
|
+
fontWeight: 600,
|
|
65
|
+
lineHeight: 1,
|
|
66
|
+
...look,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
|
|
46
70
|
const TABS_DEFAULTS: Partial<TabsProps> = {
|
|
47
71
|
variant: 'default',
|
|
48
72
|
size: 'md',
|
|
@@ -154,6 +178,11 @@ const TabLabel: React.FC<{
|
|
|
154
178
|
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
|
155
179
|
{item.icon}
|
|
156
180
|
<span>{item.label}</span>
|
|
181
|
+
{item.count !== undefined && (
|
|
182
|
+
<CountPill tone={item.count.tone ?? 'neutral'} data-tone={item.count.tone ?? 'neutral'}>
|
|
183
|
+
{item.count.value}
|
|
184
|
+
</CountPill>
|
|
185
|
+
)}
|
|
157
186
|
{item.closable && (
|
|
158
187
|
<CloseButton
|
|
159
188
|
onClick={(e) => onClose(e, item.id)}
|
|
@@ -2,6 +2,13 @@ import type { ColorValue, SizeValue } from '../../../tokens/scales';
|
|
|
2
2
|
import type { TabsProps as MuiTabsProps } from '@mui/material/Tabs/index.js';
|
|
3
3
|
import type { ReactNode } from 'react';
|
|
4
4
|
|
|
5
|
+
/** A tab's inline count — see `TabItem.count`. */
|
|
6
|
+
export interface TabCount {
|
|
7
|
+
value: string | number;
|
|
8
|
+
/** `warning` asks for attention, `danger` for action; neutral otherwise. */
|
|
9
|
+
tone?: 'neutral' | 'warning' | 'danger';
|
|
10
|
+
}
|
|
11
|
+
|
|
5
12
|
export interface TabItem {
|
|
6
13
|
/**
|
|
7
14
|
* Unique identifier for the tab
|
|
@@ -32,6 +39,13 @@ export interface TabItem {
|
|
|
32
39
|
* Badge content to show on the tab
|
|
33
40
|
*/
|
|
34
41
|
badge?: string | number;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A count said INSIDE the tab, after its label, as a small pill: how many
|
|
45
|
+
* lines, events or charges the pane holds. `tone` marks one that asks for
|
|
46
|
+
* action. Unlike `badge` it never floats over the label.
|
|
47
|
+
*/
|
|
48
|
+
count?: TabCount;
|
|
35
49
|
|
|
36
50
|
/**
|
|
37
51
|
* Custom className for the tab
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Tabs } from './Tabs';
|
|
2
|
-
export type { TabItem, TabPanelProps,TabsProps } from './Tabs.types';
|
|
2
|
+
export type { TabCount, TabItem, TabPanelProps, TabsProps } from './Tabs.types';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/feedback/StackedModal/StackedModal.styles.ts"],"sourcesContent":["import { alpha } from '@mui/material/styles/index.js';\nimport type { CSSObject, Theme } from '@mui/material/styles/index.js';\nimport { scrim } from '../../../tokens/ink';\nimport { rem } from '../../../tokens/relative';\nimport { dynamicViewportHeight } from '../../../utils/viewport';\nimport type { ModalPanelRole, PanelMaxWidth, PanelSize } from './StackedModal.types';\n\n/** Props that drive the panel's look but must not reach the DOM. */\nexport interface PanelStyleProps {\n modalRole?: ModalPanelRole;\n isAnimating?: boolean;\n glass?: boolean;\n rtl?: boolean;\n customMaxWidth?: PanelMaxWidth;\n panelSize?: PanelSize;\n}\n\n/** Style-only props, filtered out before they can land on a DOM node. */\nexport const STYLE_ONLY_PROPS = ['modalRole', 'isAnimating', 'glass', 'rtl', 'customMaxWidth', 'panelSize'];\n\n/** MUI breakpoint names mapped to the pixel width they cap the panel at. */\nconst MAX_WIDTH_PX: Record<Exclude<PanelMaxWidth, false>, number> = {\n xs: 444,\n sm: 600,\n md: 960,\n lg: 1280,\n xl: 1920,\n};\n\n/** The scrim's opacity behind each receding panel role. */\nconst BACKDROP_ALPHA_BY_ROLE: Partial<Record<ModalPanelRole, number>> = {\n secondary: 0.3,\n background: 0.1,\n};\n\nconst ANIMATION_BY_ROLE: Partial<Record<ModalPanelRole, string>> = {\n secondary: 'expandModal 300ms ease-in-out forwards',\n primary: 'contractModal 300ms ease-in-out forwards',\n};\n\n/** A wide panel settles at 90vw, so its keyframes must end there too, or it snaps. */\nconst WIDE_ANIMATION_BY_ROLE: Partial<Record<ModalPanelRole, string>> = {\n secondary: 'expandModalWide 300ms ease-in-out forwards',\n primary: 'contractModalWide 300ms ease-in-out forwards',\n};\n\n// Animation endpoints use the common lg width (60vw); the role styles set the\n// exact per-breakpoint width once the animation settles.\nconst KEYFRAMES: CSSObject = {\n '@keyframes expandModal': {\n from: { width: '60vw', transform: 'translateX(0)' },\n to: { width: '100vw', transform: 'translateX(0)' },\n },\n '@keyframes contractModal': {\n from: { width: '100vw', transform: 'translateX(0)' },\n to: { width: '60vw', transform: 'translateX(0)' },\n },\n '@keyframes expandModalWide': {\n from: { width: '90vw', transform: 'translateX(0)' },\n to: { width: '100vw', transform: 'translateX(0)' },\n },\n '@keyframes contractModalWide': {\n from: { width: '100vw', transform: 'translateX(0)' },\n to: { width: '90vw', transform: 'translateX(0)' },\n },\n};\n\nconst cap = (customMaxWidth?: PanelMaxWidth): number | null =>\n customMaxWidth ? MAX_WIDTH_PX[customMaxWidth] : null;\n\n/** One breakpoint's width: the viewport share, held under the optional px cap. */\nconst panelWidth = (theme: Theme, share: string, capPx: number | null): CSSObject =>\n capPx\n ? { width: `min(${share}, ${rem(theme, capPx)})`, maxWidth: rem(theme, capPx) }\n : { width: share, maxWidth: share };\n\nconst backdropStyles = (theme: Theme, modalRole?: ModalPanelRole): CSSObject => ({\n backgroundColor: scrim(theme, (modalRole && BACKDROP_ALPHA_BY_ROLE[modalRole]) ?? 0.5),\n backdropFilter: modalRole === 'primary' ? `blur(${rem(theme, 4)})` : 'none',\n});\n\n/**\n * The top panel is viewport-aware and narrows as the screen grows: full width on\n * mobile, 80vw on tablet/small desktop, 60vw on regular desktops (lg up —\n * including ~1080p/1440p/1080-wide), and 40vw only on ultra-wide screens\n * (≥2200px) so the receding panel stays visible on huge monitors. A `maxWidth`\n * prop, when given, caps it further.\n */\nconst primaryPanelStyles = (theme: Theme, capPx: number | null): CSSObject => ({\n [theme.breakpoints.down('sm')]: panelWidth(theme, '100%', capPx),\n [theme.breakpoints.between('sm', 'lg')]: panelWidth(theme, '80vw', capPx),\n [theme.breakpoints.up('lg')]: panelWidth(theme, '60vw', capPx),\n // A viewport width, in the theme's breakpoint unit like the three above.\n [theme.breakpoints.up(2200)]: panelWidth(theme, '40vw', capPx),\n});\n\n/**\n * `size=\"wide\"`: 90vw up to `xl`, 75vw above it, 60vw on ultra-wide screens.\n * At 1280 that is ~1150px instead of 768px — room for a form column beside a\n * fixed ~350px sidebar — while a sliver of the page behind stays visible.\n */\nconst widePrimaryPanelStyles = (theme: Theme, capPx: number | null): CSSObject => ({\n [theme.breakpoints.down('sm')]: panelWidth(theme, '100%', capPx),\n [theme.breakpoints.between('sm', 'xl')]: panelWidth(theme, '90vw', capPx),\n [theme.breakpoints.up('xl')]: panelWidth(theme, '75vw', capPx),\n [theme.breakpoints.up(2200)]: panelWidth(theme, '60vw', capPx),\n});\n\n/** Panels below the top one expand to full width, producing the GTM stacking effect. */\nconst secondaryPanelStyles = (): CSSObject => ({\n width: '100vw !important',\n maxWidth: '100vw !important',\n right: '0 !important',\n top: '0 !important',\n ...dynamicViewportHeight('height', 'maxHeight'),\n borderRadius: '0 !important',\n opacity: 0.95,\n transform: 'scale(1)',\n});\n\nconst rolePanelStyles = (\n theme: Theme,\n role: ModalPanelRole | undefined,\n capPx: number | null,\n size?: PanelSize,\n): CSSObject => {\n if (role === 'primary') {\n return size === 'wide' ? widePrimaryPanelStyles(theme, capPx) : primaryPanelStyles(theme, capPx);\n }\n if (role === 'secondary') return secondaryPanelStyles();\n // Background modals stay mounted but hidden, for performance.\n if (role === 'background') return { display: 'none' };\n return {};\n};\n\nconst glassStyles = (theme: Theme, glass?: boolean, role?: ModalPanelRole): CSSObject =>\n glass && role === 'primary'\n ? {\n backgroundColor: alpha(theme.palette.background.paper, 0.85),\n backdropFilter: `blur(${rem(theme, 10)})`,\n WebkitBackdropFilter: `blur(${rem(theme, 10)})`,\n border: `1px solid ${alpha(theme.palette.divider, 0.18)}`,\n }\n : {};\n\nconst animationStyles = (isAnimating?: boolean, role?: ModalPanelRole, size?: PanelSize): CSSObject => {\n const byRole = size === 'wide' ? WIDE_ANIMATION_BY_ROLE : ANIMATION_BY_ROLE;\n return isAnimating ? { animation: (role && byRole[role]) ?? 'none' } : {};\n};\n\nconst panelBaseStyles = (theme: Theme): CSSObject => ({\n margin: 0,\n position: 'fixed',\n right: 0,\n top: 0,\n // Pinned to the DYNAMIC viewport: on iOS a `100vh` panel runs underneath the\n // browser toolbar, which parks the tail of the scroll area (the submit row)\n // out of reach. See `dynamicViewportHeight`.\n ...dynamicViewportHeight('height', 'maxHeight'),\n borderRadius: 0,\n willChange: 'transform, width, border-radius',\n transition: theme.transitions.create(\n ['width', 'max-width', 'border-radius', 'transform', 'opacity'],\n { duration: 300, easing: theme.transitions.easing.easeInOut },\n ),\n});\n\nconst panelStyles = (theme: Theme, props: PanelStyleProps): CSSObject => {\n const capPx = cap(props.customMaxWidth);\n return {\n ...panelBaseStyles(theme),\n ...rolePanelStyles(theme, props.modalRole, capPx, props.panelSize),\n ...glassStyles(theme, props.glass, props.modalRole),\n ...animationStyles(props.isAnimating, props.modalRole, props.panelSize),\n };\n};\n\n/** The full rule set for the sliding panel's Dialog root. */\nexport const dialogRootStyles = (theme: Theme, props: PanelStyleProps): CSSObject => ({\n direction: props.rtl ? 'rtl' : 'ltr',\n // The dialog's OWN backdrop only: a descendant selector also reached the\n // backdrop of any sheet or drawer rendered inside the panel, and blurred the\n // very panel that sheet sits on.\n '& > .MuiBackdrop-root': backdropStyles(theme, props.modalRole),\n '& .MuiDialog-container': { alignItems: 'flex-start', justifyContent: 'flex-end' },\n '& .MuiDialog-paper': panelStyles(theme, props),\n ...KEYFRAMES,\n});\n\nexport const titleStyles = (theme: Theme, rtl?: boolean): CSSObject => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n padding: theme.spacing(2, 2.5),\n borderBottom: `1px solid ${theme.palette.divider}`,\n direction: rtl ? 'rtl' : 'ltr',\n});\n\nexport const titleLeftStyles = (theme: Theme): CSSObject => ({\n display: 'flex',\n alignItems: 'center',\n gap: theme.spacing(1.5),\n flex: 1,\n});\n\nexport const titleRightStyles = (theme: Theme): CSSObject => ({\n display: 'flex',\n alignItems: 'center',\n gap: theme.spacing(1),\n});\n\nexport const loadingOverlayStyles = (theme: Theme): CSSObject => ({\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: alpha(theme.palette.background.paper, 0.8),\n zIndex: 9999,\n});\n\nexport const modalContentStyles = (theme: Theme): CSSObject => ({\n padding: theme.spacing(3),\n // MUI's DialogContent defaults to `overflow-y: auto`, but inside a panel it is\n // NOT the element that scrolls — ModalBody above it is, and this box always\n // ends up exactly as tall as its own content. A scroll container that never\n // scrolls is still the containing block for every `position: sticky`\n // descendant, so a sticky header anchored here gets zero travel and rides the\n // content out of view: sticky, and pinned to nothing. Handing the overflow\n // back to ModalBody makes the panel's own scroller the anchor.\n overflowY: 'visible',\n});\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,aAAa;AAkBf,IAAM,mBAAmB,CAAC,aAAa,eAAe,SAAS,OAAO,kBAAkB,WAAW;AAG1G,IAAM,eAA8D;AAAA,EAClE,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAGA,IAAM,yBAAkE;AAAA,EACtE,WAAW;AAAA,EACX,YAAY;AACd;AAEA,IAAM,oBAA6D;AAAA,EACjE,WAAW;AAAA,EACX,SAAS;AACX;AAGA,IAAM,yBAAkE;AAAA,EACtE,WAAW;AAAA,EACX,SAAS;AACX;AAIA,IAAM,YAAuB;AAAA,EAC3B,0BAA0B;AAAA,IACxB,MAAM,EAA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AAQ,OAAO;AAAA,EAChD,WAAW,MAAM,QAAQ;AAC3B;AAEO,IAAM,kBAAkB,CAAC,WAA6B;AAAA,EAC3D,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,KAAK,MAAM,QAAQ,GAAG;AAAA,EACtB,MAAM;AACR;AAEO,IAAM,mBAAmB,CAAC,WAA6B;AAAA,EAC5D,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,KAAK,MAAM,QAAQ,CAAC;AACtB;AAEO,IAAM,uBAAuB,CAAC,WAA6B;AAAA,EAChE,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,iBAAiB,MAAM,MAAM,QAAQ,WAAW,OAAO,GAAG;AAAA,EAC1D,QAAQ;AACV;AAEO,IAAM,qBAAqB,CAAC,WAA6B;AAAA,EAC9D,SAAS,MAAM,QAAQ,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQxB,WAAW;AACb;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/navigation/Tabs/Tabs.tsx"],"sourcesContent":["import Close from '@mui/icons-material/Close';\nimport Badge from '@mui/material/Badge/index.js';\nimport Box from '@mui/material/Box/index.js';\nimport Divider from '@mui/material/Divider/index.js';\nimport MuiTab from '@mui/material/Tab/index.js';\nimport MuiTabs from '@mui/material/Tabs/index.js';\nimport { alpha, styled } from '@mui/material/styles/index.js';\nimport type { Theme } from '@mui/material/styles/index.js';\nimport React from 'react';\n\nimport { CustomTabPanel } from './TabsPanel';\nimport { tabsRootStyles } from './Tabs.styles';\nimport type { TabItem, TabsProps } from './Tabs.types';\nimport { rem, sxRem } from '../../../tokens/relative';\n\nconst StyledTabs = styled(MuiTabs, {\n shouldForwardProp: (prop) => !['customVariant', 'size', 'showDividers'].includes(prop as string) })<{ customVariant?: string; size?: string; showDividers?: boolean }>(\n ({ theme, customVariant, size, showDividers }) => ({\n ...tabsRootStyles({ theme, customVariant, size, showDividers }) }),\n);\n\nconst CloseButton = styled(Box)(({ theme }) => ({\n marginLeft: theme.spacing(0.5),\n padding: theme.spacing(0.25),\n width: rem(theme, 20),\n height: rem(theme, 20),\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n cursor: 'pointer',\n borderRadius: '50%',\n color: theme.palette.action.active,\n '&:hover': {\n backgroundColor: alpha(theme.palette.error.main, 0.1),\n color: theme.palette.error.main } }));\n\nconst BadgeWrapper = styled(Badge)(({ theme }) => ({\n '& .MuiBadge-badge': {\n right: rem(theme, -6),\n top: rem(theme, 4),\n fontSize: rem(theme, 12),\n minWidth: rem(theme, 16),\n height: rem(theme, 16),\n padding: 0 } }));\n\nconst TABS_DEFAULTS: Partial<TabsProps> = {\n variant: 'default',\n size: 'md',\n color: 'primary',\n fullWidth: false,\n orientation: 'horizontal',\n showDividers: false,\n centered: false,\n scrollable: false,\n scrollButtons: 'auto',\n sticky: false,\n stickyOffset: 0,\n animateContent: false,\n animationDuration: 300,\n persistContent: false,\n disabled: false,\n loading: false };\n\n/**\n * The props this component OWNS and MUI's `Tabs` does not understand (12-86).\n *\n * `rest` below is spread onto the DOM node, so anything left in it that React\n * cannot place on an element is reported — five `does not recognize the … prop`\n * warnings and three `Received false for a non-boolean attribute`, on every\n * render, in the browser console and in every host's jsdom output.\n *\n * An explicit list rather than `Object.keys(TABS_DEFAULTS)`, because the two\n * sets differ in both directions: `items`, `closeTabLabel`, `tabPanelProps` and\n * `loadingComponent` have no default and still must not reach the DOM, while\n * `orientation`, `centered` and `indicatorColor` are real MUI props that must.\n * An omission rather than more destructuring, so a prop added to `TabsProps`\n * costs a line here instead of an unused `_name` binding.\n *\n * Deliberately NOT here: `onFocus` and `onBlur`. They are ordinary DOM handlers\n * that reach the element through `rest` and nowhere else, so listing them would\n * silently stop them working.\n */\nconst OWN_PROPS = new Set<string>([\n 'items',\n 'closeTabLabel',\n 'color',\n 'size',\n 'fullWidth',\n 'scrollable',\n 'scrollButtons',\n 'sticky',\n 'stickyOffset',\n 'animateContent',\n 'animationDuration',\n 'persistContent',\n 'tabPanelProps',\n 'loading',\n 'loadingComponent',\n]);\n\n/** `props` with every {@link OWN_PROPS} key dropped — what is left is passthrough. */\nconst domPassthrough = (props: Record<string, unknown>): Record<string, unknown> =>\n Object.fromEntries(Object.entries(props).filter(([key]) => !OWN_PROPS.has(key)));\n\n// Strips explicitly-undefined props before the merge, so `prop={undefined}`\n// still falls back to the default as a destructuring default would.\nconst definedProps = (props: TabsProps): Partial<TabsProps> =>\n Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Partial<TabsProps>;\n\n// Once the row is scrollable every accepted scrollButtons value ends up as\n// MUI's 'auto'. That is exactly what the previous nested ternary did — it mapped\n// 'on'/'off'/'desktop' to 'auto', and its remaining branch could only ever be\n// 'auto' anyway — so the behaviour is preserved here rather than quietly\n// changed. Worth knowing that scrollButtons=\"off\" therefore still shows buttons.\nconst resolveScrollButtons = (scrollable?: boolean): 'auto' | false =>\n scrollable ? 'auto' : false;\n\nconst buildTabsSx = ({\n fullWidth,\n sticky,\n stickyOffset,\n indicatorColor,\n disabled }: {\n fullWidth?: boolean;\n sticky?: boolean;\n /** The pinned list's `top`, already through the theme (the prop is design px). */\n stickyOffset: (theme: Theme) => string;\n indicatorColor?: string;\n disabled?: boolean;\n}) => ({\n ...(fullWidth && { width: '100%' }),\n // Pin the tab list while panels scroll beneath it. Opaque background + bottom\n // divider so scrolled content does not show through.\n ...(sticky && {\n position: 'sticky',\n top: stickyOffset,\n zIndex: 2,\n backgroundColor: 'background.default',\n borderBottom: 1,\n borderColor: 'divider' }),\n ...(indicatorColor && {\n '& .MuiTabs-indicator': { backgroundColor: indicatorColor } }),\n ...(disabled && { opacity: 0.6, pointerEvents: 'none' }) });\n\n// A tab's label: icon, text, optional close affordance, optionally badged.\nconst TabLabel: React.FC<{\n item: TabItem;\n closeTabLabel: string;\n onClose: (event: React.MouseEvent | React.KeyboardEvent, tabId: string) => void;\n}> = ({ item, closeTabLabel, onClose }) => {\n const content = (\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>\n {item.icon}\n <span>{item.label}</span>\n {item.closable && (\n <CloseButton\n onClick={(e) => onClose(e, item.id)}\n role=\"button\"\n tabIndex={0}\n aria-label={closeTabLabel}\n onKeyDown={(e) => {\n if (e.key !== 'Enter' && e.key !== ' ') return;\n onClose(e, item.id);\n }}\n >\n <Close fontSize=\"inherit\" />\n </CloseButton>\n )}\n </Box>\n );\n\n if (item.badge === undefined) return content;\n\n return (\n <BadgeWrapper badgeContent={item.badge} color=\"error\">\n {content}\n </BadgeWrapper>\n );\n};\n\ntype ResolvedTabs = TabsProps;\n\n// The tab strip. Kept in this file because StyledTabs cannot cross a module\n// boundary (TS2742).\nconst TabsBar: React.FC<\n ResolvedTabs & {\n rest: Record<string, unknown>;\n onChange: (event: React.SyntheticEvent, newValue: string) => void;\n onCloseTab: (event: React.MouseEvent | React.KeyboardEvent, tabId: string) => void;\n }\n> = ({ rest, items, value, onChange, onCloseTab, dataTestId, ...p }) => (\n <StyledTabs\n {...rest}\n value={value}\n onChange={onChange}\n customVariant={p.variant}\n size={p.size}\n showDividers={p.showDividers}\n orientation={p.orientation}\n centered={p.centered}\n // MUI only scrolls when its own `variant` is `scrollable`; map our\n // `scrollable` flag onto it so overflowing tab rows actually scroll.\n variant={p.scrollable ? 'scrollable' : 'standard'}\n data-testid={dataTestId ? `${dataTestId}-list` : 'tabs-list'}\n scrollButtons={resolveScrollButtons(p.scrollable)}\n allowScrollButtonsMobile={p.scrollable}\n textColor={p.color}\n indicatorColor={p.color}\n sx={buildTabsSx({\n fullWidth: p.fullWidth,\n sticky: p.sticky,\n stickyOffset: sxRem(p.stickyOffset ?? 0),\n indicatorColor: p.indicatorColor,\n disabled: p.disabled })}\n >\n {items.map((item, index) => (\n <MuiTab\n key={item.id}\n value={item.id}\n label={<TabLabel closeTabLabel={p.closeTabLabel} item={item} onClose={onCloseTab} />}\n disabled={item.disabled || p.disabled}\n className={item.className}\n id={`tab-${item.id}`}\n aria-controls={`tabpanel-${item.id}`}\n aria-disabled={item.disabled || p.disabled}\n data-testid={dataTestId ? `${dataTestId}-tab-${index}` : `tabs-tab-${index}`}\n />\n ))}\n </StyledTabs>\n);\n\nconst TabsPanels: React.FC<ResolvedTabs> = ({\n items,\n value,\n variant,\n animateContent,\n animationDuration,\n persistContent,\n loading,\n loadingComponent,\n tabPanelProps,\n dataTestId }) => (\n <Box sx={{ mt: variant === 'enclosed' ? 0 : 2 }}>\n {items.map((item, index) => (\n <CustomTabPanel\n key={item.id}\n id={item.id}\n value={value}\n animate={animateContent}\n animationDuration={animationDuration}\n persist={persistContent}\n loading={loading}\n loadingComponent={loadingComponent}\n className={tabPanelProps?.className}\n dataTestId={dataTestId}\n index={index}\n >\n {item.content}\n </CustomTabPanel>\n ))}\n </Box>\n);\n\nexport const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(\n (tabsProps, ref) => {\n const resolved = { ...TABS_DEFAULTS, ...definedProps(tabsProps) } as TabsProps;\n const {\n // Destructured only to keep it OUT of `rest`, which is spread onto the\n // DOM node — `{...resolved}` below is what actually carries it to\n // `TabsBar`. Same reason as `value` on the next line.\n closeTabLabel: _closeTabLabel,\n value: _value,\n onChange,\n onTabClose,\n className,\n disabled,\n showDividers,\n variant,\n dataTestId,\n ...rest\n } = resolved;\n\n const handleChange = (event: React.SyntheticEvent, newValue: string) => {\n if (!disabled) onChange(event, newValue);\n };\n\n const handleTabClose = (event: React.MouseEvent | React.KeyboardEvent, tabId: string) => {\n event.stopPropagation();\n onTabClose?.(tabId);\n };\n\n return (\n <Box className={className} ref={ref} data-testid={dataTestId || 'tabs'}>\n <TabsBar\n {...resolved}\n // The destructuring above drops the props this component USES;\n // `domPassthrough` drops the ones it merely OWNS. Both have to go:\n // `rest` is spread onto the DOM node, and the second group is where\n // 12-86's warnings came from.\n rest={domPassthrough(rest as unknown as Record<string, unknown>)}\n onChange={handleChange}\n onCloseTab={handleTabClose}\n />\n\n {showDividers && variant !== 'enclosed' && <Divider />}\n\n <TabsPanels {...resolved} />\n </Box>\n );\n },\n);\n\nTabs.displayName = 'Tabs';\n"],"mappings":";;;;;;;;;;;;AAAA,OAAO,WAAW;AAClB,OAAO,WAAW;AAClB,OAAO,SAAS;AAChB,OAAO,aAAa;AACpB,OAAO,YAAY;AACnB,OAAO,aAAa;AACpB,SAAS,OAAO,cAAc;AAE9B,OAAO,WAAW;AAiJd,SAEE,KAFF;AA1IJ,IAAM,aAAa,OAAO,SAAS;AAAA,EACjC,mBAAmB,CAAC,SAAS,CAAC,CAAC,iBAAiB,QAAQ,cAAc,EAAE,SAAS,IAAc;AAAE,CAAC;AAAA,EAClG,CAAC,EAAE,OAAO,eAAe,MAAM,aAAa,OAAO;AAAA,IACjD,GAAG,eAAe,EAAE,OAAO,eAAe,MAAM,aAAa,CAAC;AAAA,EAAE;AACpE;AAEA,IAAM,cAAc,OAAO,GAAG,EAAE,CAAC,EAAE,MAAM,OAAO;AAAA,EAC9C,YAAY,MAAM,QAAQ,GAAG;AAAA,EAC7B,SAAS,MAAM,QAAQ,IAAI;AAAA,EAC3B,OAAO,IAAI,OAAO,EAAE;AAAA,EACpB,QAAQ,IAAI,OAAO,EAAE;AAAA,EACrB,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,OAAO,MAAM,QAAQ,OAAO;AAAA,EAC5B,WAAW;AAAA,IACT,iBAAiB,MAAM,MAAM,QAAQ,MAAM,MAAM,GAAG;AAAA,IACpD,OAAO,MAAM,QAAQ,MAAM;AAAA,EAAK;AAAE,EAAE;AAExC,IAAM,eAAe,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,OAAO;AAAA,EACjD,qBAAqB;AAAA,IAC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,CAAC,WAAW,QAAQ;AAClB,UAAM,WAAW,EAAE,GAAG,eAAe,GAAG,aAAa,SAAS,EAAE;AAChE,UAAM;AAAA;AAAA;AAAA;AAAA,MAIJ,eAAe;AAAA,MACf,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL,IAAI;AAEJ,UAAM,eAAe,CAAC,OAA6B,aAAqB;AACtE,UAAI,CAAC,SAAU,UAAS,OAAO,QAAQ;AAAA,IACzC;AAEA,UAAM,iBAAiB,CAAC,OAA+C,UAAkB;AACvF,YAAM,gBAAgB;AACtB,mBAAa,KAAK;AAAA,IACpB;AAEA,WACE,qBAAC,OAAI,WAAsB,KAAU,eAAa,cAAc,QAC9D;AAAA;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UAKJ,MAAM,eAAe,IAA0C;AAAA,UAC/D,UAAU;AAAA,UACV,YAAY;AAAA;AAAA,MACd;AAAA,MAEC,gBAAgB,YAAY,cAAc,oBAAC,WAAQ;AAAA,MAEpD,oBAAC,cAAY,GAAG,UAAU;AAAA,OAC5B;AAAA,EAEJ;AACF;AAEA,KAAK,cAAc;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/data-display/Chip/Chip.tsx"],"sourcesContent":["import CancelIcon from '@mui/icons-material/Cancel';\nimport MuiChip from '@mui/material/Chip/index.js';\nimport { forwardRef } from 'react';\n\nimport { chipRole, isClickable, makeTestId } from './Chip.helpers';\nimport { chipMuiSize } from './Chip.metrics';\nimport {\n avatarFor,\n chipStyles,\n iconWithTestId,\n makeKeyDownHandler,\n} from './Chip.styles';\nimport type { ChipProps } from './Chip.types';\n\ntype MuiChipColor =\n | 'primary'\n | 'secondary'\n | 'error'\n | 'info'\n | 'success'\n | 'warning'\n | 'default';\n\n/**\n * `danger` and `neutral` are ours; the rest are MUI's own names already.\n *\n * The same boundary translation `Button` performs, and it must stay a\n * translation rather than a cast: a cast is what let `danger` through untouched\n * and had MUI silently fall back to grey.\n *\n * `neutral` maps to `default`, not to `inherit` as it does on a button. A chip's\n * unaccented state is a real palette entry with its own fill; `inherit` would\n * take the surrounding text colour and paint a chip that reads as disabled.\n */\nconst muiColorFor = (color: NonNullable<ChipProps['color']>): MuiChipColor => {\n if (color === 'danger') return 'error';\n return color === 'neutral' ? 'default' : color;\n};\n\nexport const Chip = forwardRef<HTMLDivElement, ChipProps>(({\n label,\n variant = 'filled',\n size = 'md',\n color = 'primary',\n avatarSrc,\n avatar,\n icon,\n selected,\n selectable,\n deletable,\n disabled,\n onClick,\n onDelete,\n className,\n dataTestId,\n // React Native's spelling of the same id; it names the component on both\n // sides and must not reach the DOM as an attribute.\n testID,\n ...props\n}, ref) => {\n const chipId = testID ?? dataTestId;\n const testId = makeTestId(chipId);\n const clickable = isClickable(disabled, onClick, selectable);\n\n return (\n <MuiChip\n ref={ref}\n label={<span data-testid={testId('label')}>{label}</span>}\n variant={variant}\n size={chipMuiSize(size)}\n color={muiColorFor(color)}\n avatar={avatarFor(avatar, avatarSrc)}\n icon={iconWithTestId(icon, testId('icon'))}\n onDelete={deletable ? onDelete : undefined}\n deleteIcon={deletable ? <CancelIcon data-testid={testId('delete')} /> : undefined}\n disabled={disabled}\n clickable={clickable}\n onClick={clickable ? onClick : undefined}\n onKeyDown={makeKeyDownHandler({ disabled, deletable, selectable, onClick, onDelete })}\n className={className}\n role={chipRole(selectable, onClick)}\n aria-selected={selectable ? selected : undefined}\n data-testid={chipId || 'chip'}\n sx={chipStyles({ variant, selected, clickable, disabled })}\n {...props}\n />\n );\n});\n\nChip.displayName = 'Chip';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAO,gBAAgB;AACvB,OAAO,aAAa;AACpB,SAAS,kBAAkB;AAiEd;AAjCb,IAAM,cAAc,CAAC,UAAyD;AAC5E,MAAI,UAAU,SAAU,QAAO;AAC/B,SAAO,UAAU,YAAY,YAAY;AAC3C;AAEO,IAAM,OAAO,WAAsC,CAAC;AAAA,EACzD;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA,GAAG;AACL,GAAG,QAAQ;AACT,QAAM,SAAS,UAAU;AACzB,QAAM,SAAS,WAAW,MAAM;AAChC,QAAM,YAAY,YAAY,UAAU,SAAS,UAAU;AAE3D,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,OAAO,oBAAC,UAAK,eAAa,OAAO,OAAO,GAAI,iBAAM;AAAA,MAClD;AAAA,MACA,MAAM,YAAY,IAAI;AAAA,MACtB,OAAO,YAAY,KAAK;AAAA,MACxB,QAAQ,UAAU,QAAQ,SAAS;AAAA,MACnC,MAAM,eAAe,MAAM,OAAO,MAAM,CAAC;AAAA,MACzC,UAAU,YAAY,WAAW;AAAA,MACjC,YAAY,YAAY,oBAAC,cAAW,eAAa,OAAO,QAAQ,GAAG,IAAK;AAAA,MACxE;AAAA,MACA;AAAA,MACA,SAAS,YAAY,UAAU;AAAA,MAC/B,WAAW,mBAAmB,EAAE,UAAU,WAAW,YAAY,SAAS,SAAS,CAAC;AAAA,MACpF;AAAA,MACA,MAAM,SAAS,YAAY,OAAO;AAAA,MAClC,iBAAe,aAAa,WAAW;AAAA,MACvC,eAAa,UAAU;AAAA,MACvB,IAAI,WAAW,EAAE,SAAS,UAAU,WAAW,SAAS,CAAC;AAAA,MACxD,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;AAED,KAAK,cAAc;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/data-display/Chip/Chip.styles.tsx"],"sourcesContent":["import Avatar from '@mui/material/Avatar/index.js';\nimport type { SxProps, Theme } from '@mui/material/styles/index.js';\nimport type { KeyboardEvent, ReactElement } from 'react';\nimport React from 'react';\n\nimport { chipKeyAction, type ChipKeyArgs } from './Chip.helpers';\nimport { CHIP_SIZES, CHIP_TRANSITION_EASING, CHIP_TRANSITION_MS, HOVER_LIFT_PX, HOVER_SHADOW } from './Chip.metrics';\nimport type { ChipProps } from './Chip.types';\nimport { shadowInk } from '../../../tokens/ink';\nimport { rem, rems, sxRem } from '../../../tokens/relative';\n\n/**\n * A chip is not a native control, so the two keyboard conventions it stands in\n * for are wired by hand: Delete/Backspace removes it, Enter/Space activates it.\n * The DECISION is `chipKeyAction`, which the native half reads too.\n */\nexport const makeKeyDownHandler =\n (args: ChipKeyArgs & { onClick?: () => void; onDelete?: () => void }) =>\n (event: KeyboardEvent): void => {\n const action = chipKeyAction(event.key, args);\n if (action === null) return;\n event.preventDefault();\n if (action === 'delete') {\n args.onDelete?.();\n return;\n }\n args.onClick?.();\n };\n\nexport const avatarFor = (\n avatar: ChipProps['avatar'],\n avatarSrc?: string,\n): ReactElement | undefined => {\n if (avatar && React.isValidElement(avatar)) {\n return avatar;\n }\n if (avatarSrc) {\n const { avatarSize } = CHIP_SIZES.medium;\n return <Avatar src={avatarSrc} sx={{ width: sxRem(avatarSize), height: sxRem(avatarSize) }} />;\n }\n return undefined;\n};\n\ninterface ChipStyleArgs {\n variant: ChipProps['variant'];\n selected?: boolean;\n clickable?: boolean;\n disabled?: boolean;\n}\n\n/** The lift's shadow, per mode — the same numbers the native chip reads. */\nconst hoverShadow = (theme: Theme): string =>\n `0 ${rems(theme, HOVER_SHADOW.offsetY, HOVER_SHADOW.blur)} ${shadowInk(\n theme,\n theme.palette.mode === 'dark' ? HOVER_SHADOW.alphaDark : HOVER_SHADOW.alphaLight,\n )}`;\n\n/**\n * Selection styling uses SEMANTIC palette tokens (not hardcoded rgba). A filled\n * selected chip keeps MUI's solid `color.main` + contrast text (clear active\n * state); an outlined selected chip gets a subtle theme-driven `action.selected`\n * tint so it reads as active without muddying the fill.\n */\nexport const chipStyles = ({\n variant,\n selected,\n clickable,\n disabled,\n}: ChipStyleArgs): SxProps<Theme> => {\n const lifts = clickable && !disabled;\n\n return {\n // Enhanced styling for outlined variant\n ...(variant === 'outlined' && {\n borderWidth: '1px',\n borderStyle: 'solid',\n backgroundColor: 'transparent',\n }),\n ...(selected &&\n variant === 'outlined' && {\n backgroundColor: (theme: Theme) => theme.palette.action.selected,\n }),\n '&:hover': {\n ...(lifts && {\n transform: (theme: Theme) => `translateY(${rem(theme, -HOVER_LIFT_PX)})`,\n boxShadow: (theme: Theme) => hoverShadow(theme),\n }),\n },\n '&:active': {\n ...(lifts && {\n transform: 'translateY(0px)',\n }),\n },\n transition: `all ${CHIP_TRANSITION_MS / 1000}s ${CHIP_TRANSITION_EASING}`,\n };\n};\n\nexport const iconWithTestId = (\n icon: ChipProps['icon'],\n testId: string,\n): ReactElement | undefined =>\n icon && React.isValidElement(icon)\n ? React.cloneElement(icon as ReactElement, {\n 'data-testid': testId,\n } as Record<string, unknown>)\n : undefined;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAO,YAAY;AAGnB,OAAO,WAAW;AAmCP;AAtBJ,IAAM,qBACX,CAAC,SACD,CAAC,UAA+B;AAC9B,QAAM,SAAS,cAAc,MAAM,KAAK,IAAI;AAC5C,MAAI,WAAW,KAAM;AACrB,QAAM,eAAe;AACrB,MAAI,WAAW,UAAU;AACvB,SAAK,WAAW;AAChB;AAAA,EACF;AACA,OAAK,UAAU;AACjB;AAEK,IAAM,YAAY,CACvB,QACA,cAC6B;AAC7B,MAAI,UAAU,MAAM,eAAe,MAAM,GAAG;AAC1C,WAAO;AAAA,EACT;AACA,MAAI,WAAW;AACb,UAAM,EAAE,WAAW,IAAI,WAAW;AAClC,WAAO,oBAAC,UAAO,KAAK,WAAW,IAAI,EAAE,OAAO,MAAM,UAAU,GAAG,QAAQ,MAAM,UAAU,EAAE,GAAG;AAAA,EAC9F;AACA,SAAO;AACT;AAUA,IAAM,cAAc,CAAC,UACnB,KAAK,KAAK,OAAO,aAAa,SAAS,aAAa,IAAI,CAAC,IAAI;AAAA,EAC3D;AAAA,EACA,MAAM,QAAQ,SAAS,SAAS,aAAa,YAAY,aAAa;AACxE,CAAC;AAQI,IAAM,aAAa,CAAC;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAqC;AACnC,QAAM,QAAQ,aAAa,CAAC;AAE5B,SAAO;AAAA;AAAA,IAEL,GAAI,YAAY,cAAc;AAAA,MAC5B,aAAa;AAAA,MACb,aAAa;AAAA,MACb,iBAAiB;AAAA,IACnB;AAAA,IACA,GAAI,YACF,YAAY,cAAc;AAAA,MACxB,iBAAiB,CAAC,UAAiB,MAAM,QAAQ,OAAO;AAAA,IAC1D;AAAA,IACF,WAAW;AAAA,MACT,GAAI,SAAS;AAAA,QACX,WAAW,CAAC,UAAiB,cAAc,IAAI,OAAO,CAAC,aAAa,CAAC;AAAA,QACrE,WAAW,CAAC,UAAiB,YAAY,KAAK;AAAA,MAChD;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV,GAAI,SAAS;AAAA,QACX,WAAW;AAAA,MACb;AAAA,IACF;AAAA,IACA,YAAY,OAAO,qBAAqB,GAAI,KAAK,sBAAsB;AAAA,EACzE;AACF;AAEO,IAAM,iBAAiB,CAC5B,MACA,WAEA,QAAQ,MAAM,eAAe,IAAI,IAC7B,MAAM,aAAa,MAAsB;AAAA,EACvC,eAAe;AACjB,CAA4B,IAC5B;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/feedback/StackedModal/StackedModal.tsx"],"sourcesContent":["import Dialog from '@mui/material/Dialog/index.js';\nimport Slide from '@mui/material/Slide/index.js';\nimport { styled } from '@mui/material/styles/index.js';\nimport type { TransitionProps } from '@mui/material/transitions/index.js';\nimport type { FC } from 'react';\nimport React, { forwardRef, useEffect, useId } from 'react';\nimport { usePanelChrome } from './StackedModal.hooks';\nimport { modalAriaIds, ModalPanelContents, resolveModalContent } from './StackedModal.parts';\nimport type { PanelStyleProps } from './StackedModal.styles';\nimport { dialogRootStyles, STYLE_ONLY_PROPS } from './StackedModal.styles';\nimport type { StackedModalProps } from './StackedModal.types';\n\nconst StyledDialog = styled(Dialog, {\n shouldForwardProp: (prop) => !STYLE_ONLY_PROPS.includes(prop as string),\n})<PanelStyleProps>(({ theme, ...props }) => dialogRootStyles(theme, props));\n\n/** Panels slide in from the right on every device. */\nconst SlideTransition = forwardRef<HTMLDivElement, TransitionProps>(\n function SlideTransition(props, ref) {\n return (\n <Slide direction=\"left\" ref={ref} {...props}>\n {props.children as React.ReactElement}\n </Slide>\n );\n },\n);\n\nconst DEFAULTS: Partial<StackedModalProps> = {\n open: false,\n glass: false,\n navigationTitle: '',\n closeOnClickOutside: true,\n closeOnEsc: true,\n loading: false,\n loadingText: 'Loading...',\n maxWidth: false,\n disableBackdrop: false,\n disableFocusTrap: false,\n keepMounted: false,\n rtl: false,\n};\n\n/**\n * Fills in the defaults for props the caller left `undefined`. A table plus one\n * loop, rather than a default per destructured prop — each of those is a branch,\n * and fifteen of them put the component over the complexity bar on their own.\n */\nconst withDefaults = (props: StackedModalProps): StackedModalProps => {\n const resolved = { ...props };\n for (const [key, value] of Object.entries(DEFAULTS)) {\n const prop = key as keyof StackedModalProps;\n if (resolved[prop] === undefined) {\n Object.assign(resolved, { [prop]: value });\n }\n }\n return resolved;\n};\n\n/** The modal's props once defaults are applied and its stack identity is settled. */\ntype ResolvedProps = StackedModalProps & { modalId: string };\n\n/**\n * `hideHeader` removes the bar that names the dialog; without an\n * `aria-labelledby` of the caller's own, the dialog has no accessible name.\n */\nconst useUnnamedDialogWarning = (unnamed: boolean): void => {\n useEffect(() => {\n const development = typeof process !== 'undefined' && process.env?.NODE_ENV !== 'production';\n if (unnamed && development) {\n // eslint-disable-next-line no-console -- a config warning has no other channel.\n console.warn(\n 'StackedModal: `hideHeader` without `aria-labelledby` leaves the dialog unnamed. ' +\n \"Point `aria-labelledby` at your content header's title.\",\n );\n }\n }, [unnamed]);\n};\n\nconst StackedModalPanel: FC<ResolvedProps> = (props) => {\n const {\n open, onClose, glass, navigationTitle, backLabel, hideClose, hideHeader, children, actions, modalId,\n closeOnClickOutside, closeOnEsc, loading, loadingText, fullScreen, maxWidth, size, disableBackdrop,\n disableFocusTrap, keepMounted, rtl, dataTestId,\n 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...otherProps\n } = props;\n\n const {\n dialogRef, modalRole, isAnimating, showSkeleton, zIndex, isMobile, canGoBack, isRoot,\n handleBack, handleClose,\n } = usePanelChrome({\n open, modalId, loading, closeOnEsc, closeOnClickOutside, disableFocusTrap, onClose,\n });\n\n // Don't render if in background (performance optimization)\n if (modalRole === 'background' && !keepMounted) return null;\n\n const { content, modalActions, headerActions, hasMobileActions } = resolveModalContent(\n children,\n actions,\n isMobile,\n );\n const { titleId, descId } = modalAriaIds(modalId, ariaLabelledBy, ariaDescribedBy);\n useUnnamedDialogWarning(Boolean(hideHeader) && !ariaLabelledBy);\n\n return (\n <StyledDialog\n ref={dialogRef}\n open={Boolean(open)}\n onClose={handleClose}\n fullScreen={fullScreen ?? isMobile}\n modalRole={modalRole}\n isAnimating={isAnimating}\n glass={glass}\n rtl={rtl}\n customMaxWidth={maxWidth}\n panelSize={size}\n TransitionComponent={SlideTransition}\n maxWidth={maxWidth}\n disableEscapeKeyDown={!closeOnEsc}\n hideBackdrop={disableBackdrop}\n keepMounted={keepMounted}\n aria-labelledby={titleId}\n aria-describedby={descId}\n data-testid={dataTestId}\n sx={{ zIndex }}\n {...otherProps}\n >\n <ModalPanelContents\n backLabel={backLabel}\n showSkeleton={showSkeleton}\n loadingText={loadingText}\n titleId={titleId}\n descId={descId}\n navigationTitle={navigationTitle}\n hideClose={hideClose}\n hideHeader={Boolean(hideHeader) && isRoot}\n canGoBack={canGoBack}\n onBack={handleBack}\n onClose={onClose}\n headerActions={headerActions}\n content={content}\n modalActions={modalActions}\n hasMobileActions={hasMobileActions}\n rtl={rtl}\n dataTestId={dataTestId}\n />\n </StyledDialog>\n );\n};\n\nexport const StackedModal: FC<StackedModalProps> = (props) => {\n // A modal with no caller-supplied id still needs a STABLE one — it keys this\n // panel's entry in the stack, so a value that changed per render (as a\n // `Math.random()` default does) would re-register it on every pass.\n const fallbackId = useId();\n const resolved = withDefaults(props);\n return <StackedModalPanel {...resolved} modalId={resolved.modalId ?? fallbackId} />;\n};\n\n// Re-exported so `./StackedModal` stays the single public entry point for the\n// component and its stack primitives, as the barrel and existing imports expect.\nexport {\n ModalStackProvider,\n ModalStackProvider as StackedModalProvider,\n useModalStack,\n useModalStack as useStackedModal,\n} from './modal-stack';\nexport { StackedModalActions, StackedModalContent } from './StackedModal.parts';\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAO,YAAY;AACnB,OAAO,WAAW;AAClB,SAAS,cAAc;AAGvB,SAAgB,YAAY,WAAW,aAAa;AAe9C;AARN,IAAM,eAAe,OAAO,QAAQ;AAAA,EAClC,mBAAmB,CAAC,SAAS,CAAC,iBAAiB,SAAS,IAAc;AACxE,CAAC,EAAmB,CAAC,EAAE,OAAO,GAAG,MAAM,MAAM,iBAAiB,OAAO,KAAK,CAAC;AAG3E,IAAM,kBAAkB;AAAA,EACtB,SAASA,iBAAgB,OAAO,KAAK;AACnC,WACE,oBAAC,SAAM,WAAU,QAAO,KAAW,GAAG,OACnC,gBAAM,UACT;AAAA,EAEJ;AACF;AAEA,IAAM,WAAuC;AAAA,EAC3C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,aAAa;AAAA,EACb,KAAK;AACP;AAOA,IAAM,eAAe,CAAC,UAAgD;AACpE,QAAM,WAAW,EAAE,GAAG,MAA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EACF;AACA,QAAM,EAAE,SAAS,OAAO,IAAI,aAAa,SAAS,gBAAgB,eAAe;AACjF,0BAAwB,QAAQ,UAAU,KAAK,CAAC,cAAc;AAE9D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,MAAM,QAAQ,IAAI;AAAA,MAClB,SAAS;AAAA,MACT,YAAY,cAAc;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAgB;AAAA,MAChB,WAAW;AAAA,MACX,qBAAqB;AAAA,MACrB;AAAA,MACA,sBAAsB,CAAC;AAAA,MACvB,cAAc;AAAA,MACd;AAAA,MACA,mBAAiB;AAAA,MACjB,oBAAkB;AAAA,MAClB,eAAa;AAAA,MACb,IAAI,EAAE,OAAO;AAAA,MACZ,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,YAAY,QAAQ,UAAU,KAAK;AAAA,UACnC;AAAA,UACA,QAAQ;AAAA,UACR;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;AAEO,IAAM,eAAsC,CAAC,UAAU;AAI5D,QAAM,aAAa,MAAM;AACzB,QAAM,WAAW,aAAa,KAAK;AACnC,SAAO,oBAAC,qBAAmB,GAAG,UAAU,SAAS,SAAS,WAAW,YAAY;AACnF;","names":["SlideTransition"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|