@12-apps/ui 6.93.1 → 6.93.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/components/data-display/AsyncStateContainer/AsyncStateContainer.js +3 -3
- package/dist/_internal/components/data-display/ErrorState/ErrorState.js +2 -2
- package/dist/_internal/components/data-display/ErrorState/ErrorState.metrics.js +3 -1
- package/dist/_internal/components/data-display/index.js +3 -3
- package/dist/_internal/components/index.js +3 -3
- package/dist/{chunk-HBH7V3IP.js → chunk-I6IFUFLW.js} +5 -3
- package/dist/chunk-I6IFUFLW.js.map +1 -0
- package/dist/{chunk-TLGGVE56.js → chunk-OTVOQHZB.js} +3 -1
- package/dist/{chunk-TLGGVE56.js.map → chunk-OTVOQHZB.js.map} +1 -1
- package/dist/{chunk-7F6D73NL.js → chunk-RLTGD5WJ.js} +2 -2
- package/dist/data-display/AsyncStateContainer.js +3 -3
- package/dist/data-display/ErrorState.js +2 -2
- package/dist/native/data-display/ErrorState.js.map +1 -1
- package/dist/types/components/data-display/ErrorState/ErrorState.d.ts.map +1 -1
- package/dist/types/components/data-display/ErrorState/ErrorState.metrics.d.ts +5 -0
- package/dist/types/components/data-display/ErrorState/ErrorState.metrics.d.ts.map +1 -1
- package/dist/types-native/components/data-display/ErrorState/ErrorState.metrics.d.ts +5 -0
- package/dist/types-native/components/data-display/ErrorState/ErrorState.metrics.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/data-display/ErrorState/ErrorState.metrics.ts +5 -0
- package/src/components/data-display/ErrorState/ErrorState.tsx +2 -0
- package/dist/chunk-HBH7V3IP.js.map +0 -1
- /package/dist/{chunk-7F6D73NL.js.map → chunk-RLTGD5WJ.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AsyncStateContainer,
|
|
3
3
|
AsyncStateContainer_default
|
|
4
|
-
} from "../../../../chunk-
|
|
5
|
-
import "../../../../chunk-
|
|
6
|
-
import "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-RLTGD5WJ.js";
|
|
5
|
+
import "../../../../chunk-I6IFUFLW.js";
|
|
6
|
+
import "../../../../chunk-OTVOQHZB.js";
|
|
7
7
|
import "../../../../chunk-3Z6JX7UN.js";
|
|
8
8
|
import "../../../../chunk-7DFEKTT7.js";
|
|
9
9
|
import "../../../../chunk-YSTHOE66.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ErrorState,
|
|
3
3
|
ErrorState_default
|
|
4
|
-
} from "../../../../chunk-
|
|
5
|
-
import "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-I6IFUFLW.js";
|
|
5
|
+
import "../../../../chunk-OTVOQHZB.js";
|
|
6
6
|
import "../../../../chunk-XOXXG7Q5.js";
|
|
7
7
|
import "../../../../chunk-TYJR4GOF.js";
|
|
8
8
|
import "../../../../chunk-YKCAJ2TN.js";
|
|
@@ -10,9 +10,10 @@ import {
|
|
|
10
10
|
ERROR_TEXT_GAP_UNITS,
|
|
11
11
|
RETRY_BUTTON,
|
|
12
12
|
RETRY_MARGIN_TOP_UNITS,
|
|
13
|
+
RETRY_MIN_HEIGHT,
|
|
13
14
|
RETRY_MIN_WIDTH,
|
|
14
15
|
errorStatePalette
|
|
15
|
-
} from "../../../../chunk-
|
|
16
|
+
} from "../../../../chunk-OTVOQHZB.js";
|
|
16
17
|
import "../../../../chunk-PZ5AY32C.js";
|
|
17
18
|
export {
|
|
18
19
|
ERROR_ICON_BOX,
|
|
@@ -26,6 +27,7 @@ export {
|
|
|
26
27
|
ERROR_TEXT_GAP_UNITS,
|
|
27
28
|
RETRY_BUTTON,
|
|
28
29
|
RETRY_MARGIN_TOP_UNITS,
|
|
30
|
+
RETRY_MIN_HEIGHT,
|
|
29
31
|
RETRY_MIN_WIDTH,
|
|
30
32
|
errorStatePalette
|
|
31
33
|
};
|
|
@@ -16,12 +16,12 @@ import {
|
|
|
16
16
|
import "../../../chunk-SX3E6UC2.js";
|
|
17
17
|
import {
|
|
18
18
|
AsyncStateContainer
|
|
19
|
-
} from "../../../chunk-
|
|
19
|
+
} from "../../../chunk-RLTGD5WJ.js";
|
|
20
20
|
import "../../../chunk-UCYU56FO.js";
|
|
21
21
|
import {
|
|
22
22
|
ErrorState
|
|
23
|
-
} from "../../../chunk-
|
|
24
|
-
import "../../../chunk-
|
|
23
|
+
} from "../../../chunk-I6IFUFLW.js";
|
|
24
|
+
import "../../../chunk-OTVOQHZB.js";
|
|
25
25
|
import "../../../chunk-SJXSWVJG.js";
|
|
26
26
|
import {
|
|
27
27
|
LoadingState
|
|
@@ -447,12 +447,12 @@ import {
|
|
|
447
447
|
import "../../chunk-SX3E6UC2.js";
|
|
448
448
|
import {
|
|
449
449
|
AsyncStateContainer
|
|
450
|
-
} from "../../chunk-
|
|
450
|
+
} from "../../chunk-RLTGD5WJ.js";
|
|
451
451
|
import "../../chunk-UCYU56FO.js";
|
|
452
452
|
import {
|
|
453
453
|
ErrorState
|
|
454
|
-
} from "../../chunk-
|
|
455
|
-
import "../../chunk-
|
|
454
|
+
} from "../../chunk-I6IFUFLW.js";
|
|
455
|
+
import "../../chunk-OTVOQHZB.js";
|
|
456
456
|
import "../../chunk-SJXSWVJG.js";
|
|
457
457
|
import {
|
|
458
458
|
LoadingState
|
|
@@ -9,8 +9,9 @@ import {
|
|
|
9
9
|
ERROR_STATE_PADDING_UNITS,
|
|
10
10
|
ERROR_TEXT_GAP_UNITS,
|
|
11
11
|
RETRY_MARGIN_TOP_UNITS,
|
|
12
|
+
RETRY_MIN_HEIGHT,
|
|
12
13
|
RETRY_MIN_WIDTH
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-OTVOQHZB.js";
|
|
14
15
|
import {
|
|
15
16
|
EN_US_UI_LABELS
|
|
16
17
|
} from "./chunk-XOXXG7Q5.js";
|
|
@@ -135,7 +136,8 @@ var ErrorState = React.memo((props) => {
|
|
|
135
136
|
"data-testid": testId("retry-button"),
|
|
136
137
|
sx: {
|
|
137
138
|
mt: theme.spacing(RETRY_MARGIN_TOP_UNITS),
|
|
138
|
-
minWidth: rem(theme, RETRY_MIN_WIDTH)
|
|
139
|
+
minWidth: rem(theme, RETRY_MIN_WIDTH),
|
|
140
|
+
minHeight: rem(theme, RETRY_MIN_HEIGHT)
|
|
139
141
|
},
|
|
140
142
|
children: retryLabel
|
|
141
143
|
}
|
|
@@ -151,4 +153,4 @@ export {
|
|
|
151
153
|
ErrorState,
|
|
152
154
|
ErrorState_default
|
|
153
155
|
};
|
|
154
|
-
//# sourceMappingURL=chunk-
|
|
156
|
+
//# sourceMappingURL=chunk-I6IFUFLW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/data-display/ErrorState/ErrorState.tsx"],"sourcesContent":["import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';\nimport RefreshIcon from '@mui/icons-material/Refresh';\nimport WarningAmberIcon from '@mui/icons-material/WarningAmber';\nimport Box from '@mui/material/Box/index.js';\nimport Button from '@mui/material/Button/index.js';\nimport Stack from '@mui/material/Stack/index.js';\nimport Typography from '@mui/material/Typography/index.js';\nimport { useTheme } from '@mui/material/styles/index.js';\nimport type { Theme } from '@mui/material/styles/index.js';\nimport React from 'react';\n\nimport {\n ERROR_ICON_BOX,\n ERROR_ICON_BOX_OPACITY,\n ERROR_ICON_SIZE,\n ERROR_MESSAGE_LINE_HEIGHT,\n ERROR_MESSAGE_MAX_WIDTH,\n ERROR_STATE_GAP_UNITS,\n ERROR_STATE_MIN_HEIGHT,\n ERROR_STATE_PADDING_UNITS,\n ERROR_TEXT_GAP_UNITS,\n RETRY_MARGIN_TOP_UNITS,\n RETRY_MIN_HEIGHT,\n RETRY_MIN_WIDTH,\n} from './ErrorState.metrics';\nimport type { ErrorStateProps, ErrorStateSeverity } from './ErrorState.types';\nimport { resolveTestId } from '../../../platform/test-id';\nimport { rem, sxRem } from '../../../tokens/relative';\nimport { EN_US_UI_LABELS } from '../../../en-US.labels';\n\nconst makeTestId =\n (dataTestId?: string) =>\n (suffix: string): string =>\n dataTestId ? `${dataTestId}-${suffix}` : `error-state-${suffix}`;\n\nconst paletteFor = (theme: Theme, severity: ErrorStateSeverity) =>\n severity === 'error' ? theme.palette.error : theme.palette.warning;\n\nconst ErrorIcon: React.FC<{\n severity: ErrorStateSeverity;\n icon?: React.ReactNode;\n testId: string;\n}> = ({ severity, icon, testId }) => {\n const theme = useTheme();\n const color = paletteFor(theme, severity);\n const Fallback = severity === 'error' ? ErrorOutlineIcon : WarningAmberIcon;\n\n return (\n <Box\n data-testid={testId}\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: rem(theme, ERROR_ICON_BOX),\n height: rem(theme, ERROR_ICON_BOX),\n borderRadius: '50%',\n backgroundColor: color.light,\n opacity: ERROR_ICON_BOX_OPACITY,\n }}\n >\n {icon || <Fallback sx={{ fontSize: sxRem(ERROR_ICON_SIZE), color: color.main }} />}\n </Box>\n );\n};\n\nconst ErrorText: React.FC<{\n title?: string;\n message: string;\n titleId: string;\n testId: (suffix: string) => string;\n}> = ({ title, message, titleId, testId }) => {\n const theme = useTheme();\n\n return (\n <Stack spacing={ERROR_TEXT_GAP_UNITS} alignItems=\"center\">\n {title && (\n <Typography\n id={titleId}\n variant=\"h6\"\n component=\"h3\"\n data-testid={testId('title')}\n sx={{\n fontWeight: theme.typography.fontWeightMedium,\n color: theme.palette.text.primary,\n }}\n >\n {title}\n </Typography>\n )}\n\n <Typography\n id={`${titleId}-message`}\n variant=\"body2\"\n color=\"text.secondary\"\n data-testid={testId('message')}\n sx={{\n maxWidth: rem(theme, ERROR_MESSAGE_MAX_WIDTH),\n lineHeight: ERROR_MESSAGE_LINE_HEIGHT,\n }}\n >\n {message}\n </Typography>\n </Stack>\n );\n};\n\nexport const ErrorState: React.FC<ErrorStateProps> = React.memo((props) => {\n const {\n message,\n title,\n onRetry,\n retryLabel = EN_US_UI_LABELS.errorState.retry,\n severity = 'error',\n icon,\n className,\n } = props;\n const theme = useTheme();\n const titleId = React.useId();\n // `dataTestId` is the documented spelling; `testID`, the shared contract's\n // other one, resolves to the same id.\n const dataTestId = resolveTestId(props);\n const testId = makeTestId(dataTestId);\n\n return (\n <Box\n role=\"alert\"\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={`${titleId}-message`}\n className={className}\n data-testid={dataTestId || 'error-state'}\n sx={{\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n textAlign: 'center',\n padding: theme.spacing(ERROR_STATE_PADDING_UNITS),\n minHeight: rem(theme, ERROR_STATE_MIN_HEIGHT),\n gap: theme.spacing(ERROR_STATE_GAP_UNITS),\n }}\n >\n <ErrorIcon severity={severity} icon={icon} testId={testId('icon')} />\n\n <ErrorText title={title} message={message} titleId={titleId} testId={testId} />\n\n {onRetry && (\n <Button\n variant=\"outlined\"\n color={severity}\n onClick={onRetry}\n startIcon={<RefreshIcon />}\n data-testid={testId('retry-button')}\n sx={{\n mt: theme.spacing(RETRY_MARGIN_TOP_UNITS),\n minWidth: rem(theme, RETRY_MIN_WIDTH),\n minHeight: rem(theme, RETRY_MIN_HEIGHT),\n }}\n >\n {retryLabel}\n </Button>\n )}\n </Box>\n );\n});\n\nErrorState.displayName = 'ErrorState';\n\nexport default ErrorState;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,sBAAsB;AAC7B,OAAO,iBAAiB;AACxB,OAAO,sBAAsB;AAC7B,OAAO,SAAS;AAChB,OAAO,YAAY;AACnB,OAAO,WAAW;AAClB,OAAO,gBAAgB;AACvB,SAAS,gBAAgB;AAEzB,OAAO,WAAW;AAoDH,cAcX,YAdW;AA/Bf,IAAM,aACJ,CAAC,eACD,CAAC,WACC,aAAa,GAAG,UAAU,IAAI,MAAM,KAAK,eAAe,MAAM;AAElE,IAAM,aAAa,CAAC,OAAc,aAChC,aAAa,UAAU,MAAM,QAAQ,QAAQ,MAAM,QAAQ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MESSAGE_LINE_HEIGHT = 1.6;
|
|
11
11
|
var RETRY_MARGIN_TOP_UNITS = 1;
|
|
12
12
|
var RETRY_MIN_WIDTH = 120;
|
|
13
|
+
var RETRY_MIN_HEIGHT = 40;
|
|
13
14
|
var RETRY_BUTTON = {
|
|
14
15
|
paddingVertical: 5,
|
|
15
16
|
paddingHorizontal: 15,
|
|
@@ -31,7 +32,8 @@ export {
|
|
|
31
32
|
ERROR_MESSAGE_LINE_HEIGHT,
|
|
32
33
|
RETRY_MARGIN_TOP_UNITS,
|
|
33
34
|
RETRY_MIN_WIDTH,
|
|
35
|
+
RETRY_MIN_HEIGHT,
|
|
34
36
|
RETRY_BUTTON,
|
|
35
37
|
errorStatePalette
|
|
36
38
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
39
|
+
//# sourceMappingURL=chunk-OTVOQHZB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/data-display/ErrorState/ErrorState.metrics.ts"],"sourcesContent":["import type { ErrorStateSeverity } from './ErrorState.base';\nimport type { UiPaletteColor, UiTheme } from '../../../tokens/theme';\n\n/**\n * THE NUMBERS BOTH `ErrorState` RENDERERS DRAW WITH.\n *\n * `ErrorState.tsx` (MUI) and `ErrorState.native.tsx` (React Native) read this\n * one table. Spacing is in SPACING UNITS where the web writes\n * `theme.spacing(n)`; everything else is px or a ratio.\n */\n\n/** The region: a centred column, `theme.spacing(6)` of padding, at least 200px tall, its parts 16px apart. */\nexport const ERROR_STATE_PADDING_UNITS = 6;\nexport const ERROR_STATE_MIN_HEIGHT = 200;\nexport const ERROR_STATE_GAP_UNITS = 2;\n\n/** The glyph sits in an 80px disc of the severity's `light` shade at 0.9 opacity. */\nexport const ERROR_ICON_BOX = 80;\nexport const ERROR_ICON_BOX_OPACITY = 0.9;\nexport const ERROR_ICON_SIZE = 48;\n\n/** Title and message are 8px apart; the message wraps at 400px on a 1.6 line height. */\nexport const ERROR_TEXT_GAP_UNITS = 1;\nexport const ERROR_MESSAGE_MAX_WIDTH = 400;\nexport const ERROR_MESSAGE_LINE_HEIGHT = 1.6;\n\n/** The retry button: 8px below the text, no narrower than 120px. */\nexport const RETRY_MARGIN_TOP_UNITS = 1;\nexport const RETRY_MIN_WIDTH = 120;\n/**\n * The web retry IS MUI's medium outlined `Button`: 5px 15px inside its 1px\n * border, 14px type, the theme's radius, a 20px start icon. The native side\n * sizes the house `Button` to these.\n */\nexport const RETRY_BUTTON = {\n paddingVertical: 5,\n paddingHorizontal: 15,\n iconSize: 20,\n} as const;\n\n/** `error` is MUI's name for the `danger` slot; `warning` is its own. */\nexport function errorStatePalette(theme: UiTheme, severity: ErrorStateSeverity): UiPaletteColor {\n return severity === 'error' ? theme.palette.danger : theme.palette.warning;\n}\n"],"mappings":";AAYO,IAAM,4BAA4B;AAClC,IAAM,yBAAyB;AAC/B,IAAM,wBAAwB;AAG9B,IAAM,iBAAiB;AACvB,IAAM,yBAAyB;AAC/B,IAAM,kBAAkB;AAGxB,IAAM,uBAAuB;AAC7B,IAAM,0BAA0B;AAChC,IAAM,4BAA4B;AAGlC,IAAM,yBAAyB;AAC/B,IAAM,kBAAkB;
|
|
1
|
+
{"version":3,"sources":["../src/components/data-display/ErrorState/ErrorState.metrics.ts"],"sourcesContent":["import type { ErrorStateSeverity } from './ErrorState.base';\nimport type { UiPaletteColor, UiTheme } from '../../../tokens/theme';\n\n/**\n * THE NUMBERS BOTH `ErrorState` RENDERERS DRAW WITH.\n *\n * `ErrorState.tsx` (MUI) and `ErrorState.native.tsx` (React Native) read this\n * one table. Spacing is in SPACING UNITS where the web writes\n * `theme.spacing(n)`; everything else is px or a ratio.\n */\n\n/** The region: a centred column, `theme.spacing(6)` of padding, at least 200px tall, its parts 16px apart. */\nexport const ERROR_STATE_PADDING_UNITS = 6;\nexport const ERROR_STATE_MIN_HEIGHT = 200;\nexport const ERROR_STATE_GAP_UNITS = 2;\n\n/** The glyph sits in an 80px disc of the severity's `light` shade at 0.9 opacity. */\nexport const ERROR_ICON_BOX = 80;\nexport const ERROR_ICON_BOX_OPACITY = 0.9;\nexport const ERROR_ICON_SIZE = 48;\n\n/** Title and message are 8px apart; the message wraps at 400px on a 1.6 line height. */\nexport const ERROR_TEXT_GAP_UNITS = 1;\nexport const ERROR_MESSAGE_MAX_WIDTH = 400;\nexport const ERROR_MESSAGE_LINE_HEIGHT = 1.6;\n\n/** The retry button: 8px below the text, no narrower than 120px. */\nexport const RETRY_MARGIN_TOP_UNITS = 1;\nexport const RETRY_MIN_WIDTH = 120;\n/**\n * The web retry is never shorter than the 40px tap floor. MUI's medium outlined\n * button is 37px tall on its own (FUT-1310), so the floor is stated, not inherited.\n */\nexport const RETRY_MIN_HEIGHT = 40;\n/**\n * The web retry IS MUI's medium outlined `Button`: 5px 15px inside its 1px\n * border, 14px type, the theme's radius, a 20px start icon. The native side\n * sizes the house `Button` to these.\n */\nexport const RETRY_BUTTON = {\n paddingVertical: 5,\n paddingHorizontal: 15,\n iconSize: 20,\n} as const;\n\n/** `error` is MUI's name for the `danger` slot; `warning` is its own. */\nexport function errorStatePalette(theme: UiTheme, severity: ErrorStateSeverity): UiPaletteColor {\n return severity === 'error' ? theme.palette.danger : theme.palette.warning;\n}\n"],"mappings":";AAYO,IAAM,4BAA4B;AAClC,IAAM,yBAAyB;AAC/B,IAAM,wBAAwB;AAG9B,IAAM,iBAAiB;AACvB,IAAM,yBAAyB;AAC/B,IAAM,kBAAkB;AAGxB,IAAM,uBAAuB;AAC7B,IAAM,0BAA0B;AAChC,IAAM,4BAA4B;AAGlC,IAAM,yBAAyB;AAC/B,IAAM,kBAAkB;AAKxB,IAAM,mBAAmB;AAMzB,IAAM,eAAe;AAAA,EAC1B,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,UAAU;AACZ;AAGO,SAAS,kBAAkB,OAAgB,UAA8C;AAC9F,SAAO,aAAa,UAAU,MAAM,QAAQ,SAAS,MAAM,QAAQ;AACrE;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ErrorState
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-I6IFUFLW.js";
|
|
4
4
|
import {
|
|
5
5
|
LoadingState
|
|
6
6
|
} from "./chunk-3Z6JX7UN.js";
|
|
@@ -65,4 +65,4 @@ export {
|
|
|
65
65
|
AsyncStateContainer,
|
|
66
66
|
AsyncStateContainer_default
|
|
67
67
|
};
|
|
68
|
-
//# sourceMappingURL=chunk-
|
|
68
|
+
//# sourceMappingURL=chunk-RLTGD5WJ.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../chunk-SX3E6UC2.js";
|
|
2
2
|
import {
|
|
3
3
|
AsyncStateContainer
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-RLTGD5WJ.js";
|
|
5
|
+
import "../chunk-I6IFUFLW.js";
|
|
6
|
+
import "../chunk-OTVOQHZB.js";
|
|
7
7
|
import "../chunk-3Z6JX7UN.js";
|
|
8
8
|
import "../chunk-7DFEKTT7.js";
|
|
9
9
|
import "../chunk-YSTHOE66.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "../chunk-UCYU56FO.js";
|
|
2
2
|
import {
|
|
3
3
|
ErrorState
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-I6IFUFLW.js";
|
|
5
|
+
import "../chunk-OTVOQHZB.js";
|
|
6
6
|
import "../chunk-XOXXG7Q5.js";
|
|
7
7
|
import "../chunk-TYJR4GOF.js";
|
|
8
8
|
import "../chunk-YKCAJ2TN.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/data-display/ErrorState/ErrorState.native.tsx","../../../src/components/data-display/ErrorState/ErrorState.metrics.ts"],"sourcesContent":["import * as React from 'react';\nimport { StyleSheet, Text as RNText, View, type TextStyle, type ViewStyle } from 'react-native';\n\nimport {\n ERROR_ICON_BOX,\n ERROR_ICON_BOX_OPACITY,\n ERROR_ICON_SIZE,\n ERROR_MESSAGE_LINE_HEIGHT,\n ERROR_MESSAGE_MAX_WIDTH,\n ERROR_STATE_GAP_UNITS,\n ERROR_STATE_MIN_HEIGHT,\n ERROR_STATE_PADDING_UNITS,\n ERROR_TEXT_GAP_UNITS,\n RETRY_BUTTON,\n RETRY_MARGIN_TOP_UNITS,\n RETRY_MIN_WIDTH,\n errorStatePalette,\n} from './ErrorState.metrics';\nimport type { ErrorStateProps, ErrorStateSeverity } from './ErrorState.types.native';\nimport { Icon } from '../../../icons/Icon.native';\nimport { webAria } from '../../../platform/aria';\nimport { resolveTestId, withoutTestIdProps } from '../../../platform/test-id';\nimport { useUiTheme } from '../../../provider/use-ui-theme.native';\nimport { MUI_FONT_WEIGHT_MEDIUM, MUI_TYPE, muiTypeStyle } from '../../../tokens/mui-type';\nimport type { UiTheme } from '../../../tokens/theme';\nimport { Button } from '../../form/Button/Button.native';\nimport { EN_US_UI_LABELS } from '../../../en-US.labels';\n\nconst makeTestId =\n (dataTestId?: string) =>\n (suffix: string): string =>\n dataTestId ? `${dataTestId}-${suffix}` : `error-state-${suffix}`;\n\n/** MUI's `h6` as an `h3`, medium weight, in the body ink — what the web `Typography` renders. */\nexport function titleStyle(theme: UiTheme): TextStyle {\n return {\n ...muiTypeStyle(theme, 'h6'),\n fontWeight: `${MUI_FONT_WEIGHT_MEDIUM}`,\n color: theme.palette.text.primary,\n textAlign: 'center',\n };\n}\n\n/** MUI's `body2` on a 1.6 line height, muted, wrapping at 400px. */\nexport function messageStyle(theme: UiTheme): TextStyle {\n return {\n ...muiTypeStyle(theme, 'body2'),\n lineHeight: MUI_TYPE.body2.fontSize * ERROR_MESSAGE_LINE_HEIGHT,\n color: theme.palette.text.secondary,\n maxWidth: ERROR_MESSAGE_MAX_WIDTH,\n textAlign: 'center',\n };\n}\n\n/** The 80px disc behind the glyph, in the severity's `light` shade. */\nexport function iconBoxStyle(theme: UiTheme, severity: ErrorStateSeverity): ViewStyle {\n return {\n width: ERROR_ICON_BOX,\n height: ERROR_ICON_BOX,\n borderRadius: ERROR_ICON_BOX / 2,\n backgroundColor: errorStatePalette(theme, severity).light,\n opacity: ERROR_ICON_BOX_OPACITY,\n alignItems: 'center',\n justifyContent: 'center',\n };\n}\n\n/** The web retry is MUI's medium outlined button; the house `Button` is sized to it here. */\nexport function retryStyle(theme: UiTheme): ViewStyle {\n return {\n marginTop: theme.spacing(RETRY_MARGIN_TOP_UNITS),\n minWidth: RETRY_MIN_WIDTH,\n paddingVertical: RETRY_BUTTON.paddingVertical,\n paddingHorizontal: RETRY_BUTTON.paddingHorizontal,\n borderRadius: theme.radius.md,\n };\n}\n\nfunction ErrorIcon({\n severity,\n icon,\n testId,\n}: {\n severity: ErrorStateSeverity;\n icon?: React.ReactNode;\n testId: string;\n}): React.JSX.Element {\n const theme = useUiTheme();\n const glyph = severity === 'error' ? 'ErrorOutline' : 'WarningAmber';\n return (\n <View testID={testId} style={iconBoxStyle(theme, severity)}>\n {icon || <Icon name={glyph} size={ERROR_ICON_SIZE} color={errorStatePalette(theme, severity).main} />}\n </View>\n );\n}\n\nfunction ErrorText({\n title,\n message,\n titleId,\n testId,\n}: {\n title?: string;\n message: string;\n titleId: string;\n testId: (suffix: string) => string;\n}): React.JSX.Element {\n const theme = useUiTheme();\n return (\n <View style={[styles.text, { gap: theme.spacing(ERROR_TEXT_GAP_UNITS) }]}>\n {title ? (\n <RNText\n id={titleId}\n role=\"heading\"\n {...webAria({ 'aria-level': 3 })}\n testID={testId('title')}\n style={titleStyle(theme)}\n >\n {title}\n </RNText>\n ) : null}\n <RNText id={`${titleId}-message`} testID={testId('message')} style={messageStyle(theme)}>\n {message}\n </RNText>\n </View>\n );\n}\n\nexport const ErrorState: React.FC<ErrorStateProps> = React.memo(function ErrorState(props) {\n const {\n message,\n title,\n onRetry,\n retryLabel = EN_US_UI_LABELS.errorState.retry,\n severity = 'error',\n icon,\n style,\n ...others\n } = props;\n const theme = useUiTheme();\n const titleId = React.useId();\n const dataTestId = resolveTestId(others);\n const testId = makeTestId(dataTestId);\n const rest = withoutTestIdProps(others);\n\n return (\n <View\n role=\"alert\"\n aria-labelledby={title ? titleId : undefined}\n {...webAria({ 'aria-describedby': `${titleId}-message` })}\n testID={dataTestId || 'error-state'}\n style={[\n styles.root,\n {\n padding: theme.spacing(ERROR_STATE_PADDING_UNITS),\n minHeight: ERROR_STATE_MIN_HEIGHT,\n gap: theme.spacing(ERROR_STATE_GAP_UNITS),\n },\n style,\n ]}\n {...rest}\n >\n <ErrorIcon severity={severity} icon={icon} testId={testId('icon')} />\n\n <ErrorText title={title} message={message} titleId={titleId} testId={testId} />\n\n {onRetry ? (\n <Button\n variant=\"outline\"\n color={severity === 'error' ? 'danger' : 'warning'}\n size=\"sm\"\n icon={<Icon name=\"Refresh\" size={RETRY_BUTTON.iconSize} color={severity === 'error' ? 'danger' : 'warning'} />}\n onClick={onRetry}\n testID={testId('retry-button')}\n style={retryStyle(theme)}\n >\n {retryLabel}\n </Button>\n ) : null}\n </View>\n );\n});\n\nErrorState.displayName = 'ErrorState';\n\nconst styles = StyleSheet.create({\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n },\n text: {\n alignItems: 'center',\n },\n});\n","import type { ErrorStateSeverity } from './ErrorState.base';\nimport type { UiPaletteColor, UiTheme } from '../../../tokens/theme';\n\n/**\n * THE NUMBERS BOTH `ErrorState` RENDERERS DRAW WITH.\n *\n * `ErrorState.tsx` (MUI) and `ErrorState.native.tsx` (React Native) read this\n * one table. Spacing is in SPACING UNITS where the web writes\n * `theme.spacing(n)`; everything else is px or a ratio.\n */\n\n/** The region: a centred column, `theme.spacing(6)` of padding, at least 200px tall, its parts 16px apart. */\nexport const ERROR_STATE_PADDING_UNITS = 6;\nexport const ERROR_STATE_MIN_HEIGHT = 200;\nexport const ERROR_STATE_GAP_UNITS = 2;\n\n/** The glyph sits in an 80px disc of the severity's `light` shade at 0.9 opacity. */\nexport const ERROR_ICON_BOX = 80;\nexport const ERROR_ICON_BOX_OPACITY = 0.9;\nexport const ERROR_ICON_SIZE = 48;\n\n/** Title and message are 8px apart; the message wraps at 400px on a 1.6 line height. */\nexport const ERROR_TEXT_GAP_UNITS = 1;\nexport const ERROR_MESSAGE_MAX_WIDTH = 400;\nexport const ERROR_MESSAGE_LINE_HEIGHT = 1.6;\n\n/** The retry button: 8px below the text, no narrower than 120px. */\nexport const RETRY_MARGIN_TOP_UNITS = 1;\nexport const RETRY_MIN_WIDTH = 120;\n/**\n * The web retry IS MUI's medium outlined `Button`: 5px 15px inside its 1px\n * border, 14px type, the theme's radius, a 20px start icon. The native side\n * sizes the house `Button` to these.\n */\nexport const RETRY_BUTTON = {\n paddingVertical: 5,\n paddingHorizontal: 15,\n iconSize: 20,\n} as const;\n\n/** `error` is MUI's name for the `danger` slot; `warning` is its own. */\nexport function errorStatePalette(theme: UiTheme, severity: ErrorStateSeverity): UiPaletteColor {\n return severity === 'error' ? theme.palette.danger : theme.palette.warning;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAY,WAAW;AACvB,SAAS,YAAY,QAAQ,QAAQ,YAA4C;;;ACW1E,IAAM,4BAA4B;AAClC,IAAM,yBAAyB;AAC/B,IAAM,wBAAwB;AAG9B,IAAM,iBAAiB;AACvB,IAAM,yBAAyB;AAC/B,IAAM,kBAAkB;AAGxB,IAAM,uBAAuB;AAC7B,IAAM,0BAA0B;AAChC,IAAM,4BAA4B;AAGlC,IAAM,yBAAyB;AAC/B,IAAM,kBAAkB;AAMxB,IAAM,eAAe;AAAA,EAC1B,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,UAAU;AACZ;AAGO,SAAS,kBAAkB,OAAgB,UAA8C;AAC9F,SAAO,aAAa,UAAU,MAAM,QAAQ,SAAS,MAAM,QAAQ;AACrE;;;ADgDe,cAkBX,YAlBW;AA/Df,IAAM,aACJ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AM,GAAG;AAAA,QAEnE,oBAAC,aAAU,OAAc,SAAkB,SAAkB,QAAgB;AAAA,QAE5E,UACC;AAAA,UAAC;AAAA;AAAA,YACC,SAAQ;AAAA,YACR,OAAO,aAAa,UAAU,WAAW;AAAA,YACzC,MAAK;AAAA,YACL,MAAM,oBAAC,QAAK,MAAK,WAAU,MAAM,aAAa,UAAU,OAAO,aAAa,UAAU,WAAW,WAAW;AAAA,YAC5G,SAAS;AAAA,YACT,QAAQ,OAAO,cAAc;AAAA,YAC7B,OAAO,WAAW,KAAK;AAAA,YAEtB;AAAA;AAAA,QACH,IACE;AAAA;AAAA;AAAA,EACN;AAEJ,CAAC;AAED,WAAW,cAAc;AAEzB,IAAM,SAAS,WAAW,OAAO;AAAA,EAC/B,MAAM;AAAA,IACJ,YAAY;AAAA,IACZ,gBAAgB;AAAA,EAClB;AAAA,EACA,MAAM;AAAA,IACJ,YAAY;AAAA,EACd;AACF,CAAC;","names":["ErrorState"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/data-display/ErrorState/ErrorState.native.tsx","../../../src/components/data-display/ErrorState/ErrorState.metrics.ts"],"sourcesContent":["import * as React from 'react';\nimport { StyleSheet, Text as RNText, View, type TextStyle, type ViewStyle } from 'react-native';\n\nimport {\n ERROR_ICON_BOX,\n ERROR_ICON_BOX_OPACITY,\n ERROR_ICON_SIZE,\n ERROR_MESSAGE_LINE_HEIGHT,\n ERROR_MESSAGE_MAX_WIDTH,\n ERROR_STATE_GAP_UNITS,\n ERROR_STATE_MIN_HEIGHT,\n ERROR_STATE_PADDING_UNITS,\n ERROR_TEXT_GAP_UNITS,\n RETRY_BUTTON,\n RETRY_MARGIN_TOP_UNITS,\n RETRY_MIN_WIDTH,\n errorStatePalette,\n} from './ErrorState.metrics';\nimport type { ErrorStateProps, ErrorStateSeverity } from './ErrorState.types.native';\nimport { Icon } from '../../../icons/Icon.native';\nimport { webAria } from '../../../platform/aria';\nimport { resolveTestId, withoutTestIdProps } from '../../../platform/test-id';\nimport { useUiTheme } from '../../../provider/use-ui-theme.native';\nimport { MUI_FONT_WEIGHT_MEDIUM, MUI_TYPE, muiTypeStyle } from '../../../tokens/mui-type';\nimport type { UiTheme } from '../../../tokens/theme';\nimport { Button } from '../../form/Button/Button.native';\nimport { EN_US_UI_LABELS } from '../../../en-US.labels';\n\nconst makeTestId =\n (dataTestId?: string) =>\n (suffix: string): string =>\n dataTestId ? `${dataTestId}-${suffix}` : `error-state-${suffix}`;\n\n/** MUI's `h6` as an `h3`, medium weight, in the body ink — what the web `Typography` renders. */\nexport function titleStyle(theme: UiTheme): TextStyle {\n return {\n ...muiTypeStyle(theme, 'h6'),\n fontWeight: `${MUI_FONT_WEIGHT_MEDIUM}`,\n color: theme.palette.text.primary,\n textAlign: 'center',\n };\n}\n\n/** MUI's `body2` on a 1.6 line height, muted, wrapping at 400px. */\nexport function messageStyle(theme: UiTheme): TextStyle {\n return {\n ...muiTypeStyle(theme, 'body2'),\n lineHeight: MUI_TYPE.body2.fontSize * ERROR_MESSAGE_LINE_HEIGHT,\n color: theme.palette.text.secondary,\n maxWidth: ERROR_MESSAGE_MAX_WIDTH,\n textAlign: 'center',\n };\n}\n\n/** The 80px disc behind the glyph, in the severity's `light` shade. */\nexport function iconBoxStyle(theme: UiTheme, severity: ErrorStateSeverity): ViewStyle {\n return {\n width: ERROR_ICON_BOX,\n height: ERROR_ICON_BOX,\n borderRadius: ERROR_ICON_BOX / 2,\n backgroundColor: errorStatePalette(theme, severity).light,\n opacity: ERROR_ICON_BOX_OPACITY,\n alignItems: 'center',\n justifyContent: 'center',\n };\n}\n\n/** The web retry is MUI's medium outlined button; the house `Button` is sized to it here. */\nexport function retryStyle(theme: UiTheme): ViewStyle {\n return {\n marginTop: theme.spacing(RETRY_MARGIN_TOP_UNITS),\n minWidth: RETRY_MIN_WIDTH,\n paddingVertical: RETRY_BUTTON.paddingVertical,\n paddingHorizontal: RETRY_BUTTON.paddingHorizontal,\n borderRadius: theme.radius.md,\n };\n}\n\nfunction ErrorIcon({\n severity,\n icon,\n testId,\n}: {\n severity: ErrorStateSeverity;\n icon?: React.ReactNode;\n testId: string;\n}): React.JSX.Element {\n const theme = useUiTheme();\n const glyph = severity === 'error' ? 'ErrorOutline' : 'WarningAmber';\n return (\n <View testID={testId} style={iconBoxStyle(theme, severity)}>\n {icon || <Icon name={glyph} size={ERROR_ICON_SIZE} color={errorStatePalette(theme, severity).main} />}\n </View>\n );\n}\n\nfunction ErrorText({\n title,\n message,\n titleId,\n testId,\n}: {\n title?: string;\n message: string;\n titleId: string;\n testId: (suffix: string) => string;\n}): React.JSX.Element {\n const theme = useUiTheme();\n return (\n <View style={[styles.text, { gap: theme.spacing(ERROR_TEXT_GAP_UNITS) }]}>\n {title ? (\n <RNText\n id={titleId}\n role=\"heading\"\n {...webAria({ 'aria-level': 3 })}\n testID={testId('title')}\n style={titleStyle(theme)}\n >\n {title}\n </RNText>\n ) : null}\n <RNText id={`${titleId}-message`} testID={testId('message')} style={messageStyle(theme)}>\n {message}\n </RNText>\n </View>\n );\n}\n\nexport const ErrorState: React.FC<ErrorStateProps> = React.memo(function ErrorState(props) {\n const {\n message,\n title,\n onRetry,\n retryLabel = EN_US_UI_LABELS.errorState.retry,\n severity = 'error',\n icon,\n style,\n ...others\n } = props;\n const theme = useUiTheme();\n const titleId = React.useId();\n const dataTestId = resolveTestId(others);\n const testId = makeTestId(dataTestId);\n const rest = withoutTestIdProps(others);\n\n return (\n <View\n role=\"alert\"\n aria-labelledby={title ? titleId : undefined}\n {...webAria({ 'aria-describedby': `${titleId}-message` })}\n testID={dataTestId || 'error-state'}\n style={[\n styles.root,\n {\n padding: theme.spacing(ERROR_STATE_PADDING_UNITS),\n minHeight: ERROR_STATE_MIN_HEIGHT,\n gap: theme.spacing(ERROR_STATE_GAP_UNITS),\n },\n style,\n ]}\n {...rest}\n >\n <ErrorIcon severity={severity} icon={icon} testId={testId('icon')} />\n\n <ErrorText title={title} message={message} titleId={titleId} testId={testId} />\n\n {onRetry ? (\n <Button\n variant=\"outline\"\n color={severity === 'error' ? 'danger' : 'warning'}\n size=\"sm\"\n icon={<Icon name=\"Refresh\" size={RETRY_BUTTON.iconSize} color={severity === 'error' ? 'danger' : 'warning'} />}\n onClick={onRetry}\n testID={testId('retry-button')}\n style={retryStyle(theme)}\n >\n {retryLabel}\n </Button>\n ) : null}\n </View>\n );\n});\n\nErrorState.displayName = 'ErrorState';\n\nconst styles = StyleSheet.create({\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n },\n text: {\n alignItems: 'center',\n },\n});\n","import type { ErrorStateSeverity } from './ErrorState.base';\nimport type { UiPaletteColor, UiTheme } from '../../../tokens/theme';\n\n/**\n * THE NUMBERS BOTH `ErrorState` RENDERERS DRAW WITH.\n *\n * `ErrorState.tsx` (MUI) and `ErrorState.native.tsx` (React Native) read this\n * one table. Spacing is in SPACING UNITS where the web writes\n * `theme.spacing(n)`; everything else is px or a ratio.\n */\n\n/** The region: a centred column, `theme.spacing(6)` of padding, at least 200px tall, its parts 16px apart. */\nexport const ERROR_STATE_PADDING_UNITS = 6;\nexport const ERROR_STATE_MIN_HEIGHT = 200;\nexport const ERROR_STATE_GAP_UNITS = 2;\n\n/** The glyph sits in an 80px disc of the severity's `light` shade at 0.9 opacity. */\nexport const ERROR_ICON_BOX = 80;\nexport const ERROR_ICON_BOX_OPACITY = 0.9;\nexport const ERROR_ICON_SIZE = 48;\n\n/** Title and message are 8px apart; the message wraps at 400px on a 1.6 line height. */\nexport const ERROR_TEXT_GAP_UNITS = 1;\nexport const ERROR_MESSAGE_MAX_WIDTH = 400;\nexport const ERROR_MESSAGE_LINE_HEIGHT = 1.6;\n\n/** The retry button: 8px below the text, no narrower than 120px. */\nexport const RETRY_MARGIN_TOP_UNITS = 1;\nexport const RETRY_MIN_WIDTH = 120;\n/**\n * The web retry is never shorter than the 40px tap floor. MUI's medium outlined\n * button is 37px tall on its own (FUT-1310), so the floor is stated, not inherited.\n */\nexport const RETRY_MIN_HEIGHT = 40;\n/**\n * The web retry IS MUI's medium outlined `Button`: 5px 15px inside its 1px\n * border, 14px type, the theme's radius, a 20px start icon. The native side\n * sizes the house `Button` to these.\n */\nexport const RETRY_BUTTON = {\n paddingVertical: 5,\n paddingHorizontal: 15,\n iconSize: 20,\n} as const;\n\n/** `error` is MUI's name for the `danger` slot; `warning` is its own. */\nexport function errorStatePalette(theme: UiTheme, severity: ErrorStateSeverity): UiPaletteColor {\n return severity === 'error' ? theme.palette.danger : theme.palette.warning;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAY,WAAW;AACvB,SAAS,YAAY,QAAQ,QAAQ,YAA4C;;;ACW1E,IAAM,4BAA4B;AAClC,IAAM,yBAAyB;AAC/B,IAAM,wBAAwB;AAG9B,IAAM,iBAAiB;AACvB,IAAM,yBAAyB;AAC/B,IAAM,kBAAkB;AAGxB,IAAM,uBAAuB;AAC7B,IAAM,0BAA0B;AAChC,IAAM,4BAA4B;AAGlC,IAAM,yBAAyB;AAC/B,IAAM,kBAAkB;AAWxB,IAAM,eAAe;AAAA,EAC1B,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,UAAU;AACZ;AAGO,SAAS,kBAAkB,OAAgB,UAA8C;AAC9F,SAAO,aAAa,UAAU,MAAM,QAAQ,SAAS,MAAM,QAAQ;AACrE;;;AD2Ce,cAkBX,YAlBW;AA/Df,IAAM,aACJ,CAAC,eACD,CAAC,WACC,aAAa,GAAG,UAAU,IAAI,MAAM,KAAK,eAAe,MAAM;AAG3D,SAAS,WAAW,OAA2B;AACpD,SAAO;AAAA,IACL,GAAG,aAAa,OAAO,IAAI;AAAA,IAC3B,YAAY,GAAG,sBAAsB;AAAA,IACrC,OAAO,MAAM,QAAQ,KAAK;AAAA,IAC1B,WAAW;AAAA,EACb;AACF;AAGO,SAAS,aAAa,OAA2B;AACtD,SAAO;AAAA,IACL,GAAG,aAAa,OAAO,OAAO;AAAA,IAC9B,YAAY,SAAS,MAA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tB;AAAA;AAAA,QACH,IACE;AAAA;AAAA;AAAA,EACN;AAEJ,CAAC;AAED,WAAW,cAAc;AAEzB,IAAM,SAAS,WAAW,OAAO;AAAA,EAC/B,MAAM;AAAA,IACJ,YAAY;AAAA,IACZ,gBAAgB;AAAA,EAClB;AAAA,EACA,MAAM;AAAA,IACJ,YAAY;AAAA,EACd;AACF,CAAC;","names":["ErrorState"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorState.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/ErrorState/ErrorState.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ErrorState.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/ErrorState/ErrorState.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgB1B,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,oBAAoB,CAAC;AAkF9E,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAyD/C,CAAC;AAIH,eAAe,UAAU,CAAC"}
|
|
@@ -22,6 +22,11 @@ export declare const ERROR_MESSAGE_LINE_HEIGHT = 1.6;
|
|
|
22
22
|
/** The retry button: 8px below the text, no narrower than 120px. */
|
|
23
23
|
export declare const RETRY_MARGIN_TOP_UNITS = 1;
|
|
24
24
|
export declare const RETRY_MIN_WIDTH = 120;
|
|
25
|
+
/**
|
|
26
|
+
* The web retry is never shorter than the 40px tap floor. MUI's medium outlined
|
|
27
|
+
* button is 37px tall on its own (FUT-1310), so the floor is stated, not inherited.
|
|
28
|
+
*/
|
|
29
|
+
export declare const RETRY_MIN_HEIGHT = 40;
|
|
25
30
|
/**
|
|
26
31
|
* The web retry IS MUI's medium outlined `Button`: 5px 15px inside its 1px
|
|
27
32
|
* border, 14px type, the theme's radius, a 20px start icon. The native side
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorState.metrics.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/ErrorState/ErrorState.metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErE;;;;;;GAMG;AAEH,8GAA8G;AAC9G,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,qFAAqF;AACrF,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,wFAAwF;AACxF,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAEX,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,kBAAkB,GAAG,cAAc,CAE9F"}
|
|
1
|
+
{"version":3,"file":"ErrorState.metrics.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/ErrorState/ErrorState.metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErE;;;;;;GAMG;AAEH,8GAA8G;AAC9G,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,qFAAqF;AACrF,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,wFAAwF;AACxF,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAEX,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,kBAAkB,GAAG,cAAc,CAE9F"}
|
|
@@ -22,6 +22,11 @@ export declare const ERROR_MESSAGE_LINE_HEIGHT = 1.6;
|
|
|
22
22
|
/** The retry button: 8px below the text, no narrower than 120px. */
|
|
23
23
|
export declare const RETRY_MARGIN_TOP_UNITS = 1;
|
|
24
24
|
export declare const RETRY_MIN_WIDTH = 120;
|
|
25
|
+
/**
|
|
26
|
+
* The web retry is never shorter than the 40px tap floor. MUI's medium outlined
|
|
27
|
+
* button is 37px tall on its own (FUT-1310), so the floor is stated, not inherited.
|
|
28
|
+
*/
|
|
29
|
+
export declare const RETRY_MIN_HEIGHT = 40;
|
|
25
30
|
/**
|
|
26
31
|
* The web retry IS MUI's medium outlined `Button`: 5px 15px inside its 1px
|
|
27
32
|
* border, 14px type, the theme's radius, a 20px start icon. The native side
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorState.metrics.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/ErrorState/ErrorState.metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErE;;;;;;GAMG;AAEH,8GAA8G;AAC9G,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,qFAAqF;AACrF,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,wFAAwF;AACxF,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAEX,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,kBAAkB,GAAG,cAAc,CAE9F"}
|
|
1
|
+
{"version":3,"file":"ErrorState.metrics.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/ErrorState/ErrorState.metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErE;;;;;;GAMG;AAEH,8GAA8G;AAC9G,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,qFAAqF;AACrF,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,wFAAwF;AACxF,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAEX,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,kBAAkB,GAAG,cAAc,CAE9F"}
|
package/package.json
CHANGED
|
@@ -27,6 +27,11 @@ export const ERROR_MESSAGE_LINE_HEIGHT = 1.6;
|
|
|
27
27
|
/** The retry button: 8px below the text, no narrower than 120px. */
|
|
28
28
|
export const RETRY_MARGIN_TOP_UNITS = 1;
|
|
29
29
|
export const RETRY_MIN_WIDTH = 120;
|
|
30
|
+
/**
|
|
31
|
+
* The web retry is never shorter than the 40px tap floor. MUI's medium outlined
|
|
32
|
+
* button is 37px tall on its own (FUT-1310), so the floor is stated, not inherited.
|
|
33
|
+
*/
|
|
34
|
+
export const RETRY_MIN_HEIGHT = 40;
|
|
30
35
|
/**
|
|
31
36
|
* The web retry IS MUI's medium outlined `Button`: 5px 15px inside its 1px
|
|
32
37
|
* border, 14px type, the theme's radius, a 20px start icon. The native side
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
ERROR_STATE_PADDING_UNITS,
|
|
21
21
|
ERROR_TEXT_GAP_UNITS,
|
|
22
22
|
RETRY_MARGIN_TOP_UNITS,
|
|
23
|
+
RETRY_MIN_HEIGHT,
|
|
23
24
|
RETRY_MIN_WIDTH,
|
|
24
25
|
} from './ErrorState.metrics';
|
|
25
26
|
import type { ErrorStateProps, ErrorStateSeverity } from './ErrorState.types';
|
|
@@ -153,6 +154,7 @@ export const ErrorState: React.FC<ErrorStateProps> = React.memo((props) => {
|
|
|
153
154
|
sx={{
|
|
154
155
|
mt: theme.spacing(RETRY_MARGIN_TOP_UNITS),
|
|
155
156
|
minWidth: rem(theme, RETRY_MIN_WIDTH),
|
|
157
|
+
minHeight: rem(theme, RETRY_MIN_HEIGHT),
|
|
156
158
|
}}
|
|
157
159
|
>
|
|
158
160
|
{retryLabel}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/data-display/ErrorState/ErrorState.tsx"],"sourcesContent":["import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';\nimport RefreshIcon from '@mui/icons-material/Refresh';\nimport WarningAmberIcon from '@mui/icons-material/WarningAmber';\nimport Box from '@mui/material/Box/index.js';\nimport Button from '@mui/material/Button/index.js';\nimport Stack from '@mui/material/Stack/index.js';\nimport Typography from '@mui/material/Typography/index.js';\nimport { useTheme } from '@mui/material/styles/index.js';\nimport type { Theme } from '@mui/material/styles/index.js';\nimport React from 'react';\n\nimport {\n ERROR_ICON_BOX,\n ERROR_ICON_BOX_OPACITY,\n ERROR_ICON_SIZE,\n ERROR_MESSAGE_LINE_HEIGHT,\n ERROR_MESSAGE_MAX_WIDTH,\n ERROR_STATE_GAP_UNITS,\n ERROR_STATE_MIN_HEIGHT,\n ERROR_STATE_PADDING_UNITS,\n ERROR_TEXT_GAP_UNITS,\n RETRY_MARGIN_TOP_UNITS,\n RETRY_MIN_WIDTH,\n} from './ErrorState.metrics';\nimport type { ErrorStateProps, ErrorStateSeverity } from './ErrorState.types';\nimport { resolveTestId } from '../../../platform/test-id';\nimport { rem, sxRem } from '../../../tokens/relative';\nimport { EN_US_UI_LABELS } from '../../../en-US.labels';\n\nconst makeTestId =\n (dataTestId?: string) =>\n (suffix: string): string =>\n dataTestId ? `${dataTestId}-${suffix}` : `error-state-${suffix}`;\n\nconst paletteFor = (theme: Theme, severity: ErrorStateSeverity) =>\n severity === 'error' ? theme.palette.error : theme.palette.warning;\n\nconst ErrorIcon: React.FC<{\n severity: ErrorStateSeverity;\n icon?: React.ReactNode;\n testId: string;\n}> = ({ severity, icon, testId }) => {\n const theme = useTheme();\n const color = paletteFor(theme, severity);\n const Fallback = severity === 'error' ? ErrorOutlineIcon : WarningAmberIcon;\n\n return (\n <Box\n data-testid={testId}\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: rem(theme, ERROR_ICON_BOX),\n height: rem(theme, ERROR_ICON_BOX),\n borderRadius: '50%',\n backgroundColor: color.light,\n opacity: ERROR_ICON_BOX_OPACITY,\n }}\n >\n {icon || <Fallback sx={{ fontSize: sxRem(ERROR_ICON_SIZE), color: color.main }} />}\n </Box>\n );\n};\n\nconst ErrorText: React.FC<{\n title?: string;\n message: string;\n titleId: string;\n testId: (suffix: string) => string;\n}> = ({ title, message, titleId, testId }) => {\n const theme = useTheme();\n\n return (\n <Stack spacing={ERROR_TEXT_GAP_UNITS} alignItems=\"center\">\n {title && (\n <Typography\n id={titleId}\n variant=\"h6\"\n component=\"h3\"\n data-testid={testId('title')}\n sx={{\n fontWeight: theme.typography.fontWeightMedium,\n color: theme.palette.text.primary,\n }}\n >\n {title}\n </Typography>\n )}\n\n <Typography\n id={`${titleId}-message`}\n variant=\"body2\"\n color=\"text.secondary\"\n data-testid={testId('message')}\n sx={{\n maxWidth: rem(theme, ERROR_MESSAGE_MAX_WIDTH),\n lineHeight: ERROR_MESSAGE_LINE_HEIGHT,\n }}\n >\n {message}\n </Typography>\n </Stack>\n );\n};\n\nexport const ErrorState: React.FC<ErrorStateProps> = React.memo((props) => {\n const {\n message,\n title,\n onRetry,\n retryLabel = EN_US_UI_LABELS.errorState.retry,\n severity = 'error',\n icon,\n className,\n } = props;\n const theme = useTheme();\n const titleId = React.useId();\n // `dataTestId` is the documented spelling; `testID`, the shared contract's\n // other one, resolves to the same id.\n const dataTestId = resolveTestId(props);\n const testId = makeTestId(dataTestId);\n\n return (\n <Box\n role=\"alert\"\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={`${titleId}-message`}\n className={className}\n data-testid={dataTestId || 'error-state'}\n sx={{\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n textAlign: 'center',\n padding: theme.spacing(ERROR_STATE_PADDING_UNITS),\n minHeight: rem(theme, ERROR_STATE_MIN_HEIGHT),\n gap: theme.spacing(ERROR_STATE_GAP_UNITS),\n }}\n >\n <ErrorIcon severity={severity} icon={icon} testId={testId('icon')} />\n\n <ErrorText title={title} message={message} titleId={titleId} testId={testId} />\n\n {onRetry && (\n <Button\n variant=\"outlined\"\n color={severity}\n onClick={onRetry}\n startIcon={<RefreshIcon />}\n data-testid={testId('retry-button')}\n sx={{\n mt: theme.spacing(RETRY_MARGIN_TOP_UNITS),\n minWidth: rem(theme, RETRY_MIN_WIDTH),\n }}\n >\n {retryLabel}\n </Button>\n )}\n </Box>\n );\n});\n\nErrorState.displayName = 'ErrorState';\n\nexport default ErrorState;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,sBAAsB;AAC7B,OAAO,iBAAiB;AACxB,OAAO,sBAAsB;AAC7B,OAAO,SAAS;AAChB,OAAO,YAAY;AACnB,OAAO,WAAW;AAClB,OAAO,gBAAgB;AACvB,SAAS,gBAAgB;AAEzB,OAAO,WAAW;AAmDH,cAcX,YAdW;AA/Bf,IAAM,aACJ,CAAC,eACD,CAAC,WACC,aAAa,GAAG,UAAU,IAAI,MAAM,KAAK,eAAe,MAAM;AAElE,IAAM,aAAa,CAAC,OAAc,aAChC,aAAa,UAAU,MAAM,QAAQ,QAAQ,MAAM,QAAQ;AAE7D,IAAM,YAID,CAAC,EAAE,UAAU,MAAM,OAAO,MAAM;AACnC,QAAM,QAAQ,SAAS;AACvB,QAAM,QAAQ,WAAW,OAAO,QAAQ;AACxC,QAAM,WAAW,aAAa,UAAU,mBA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