@capillarytech/blaze-ui 5.11.1 → 5.11.6
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/.npmrc +2 -0
- package/CapErrorBoundary/CapErrorBoundary-use-cases.md +89 -0
- package/CapErrorBoundary/README.md +150 -0
- package/CapErrorBoundary/index.d.ts +10 -0
- package/CapErrorBoundary/index.d.ts.map +1 -0
- package/CapErrorBoundary/index.js +62 -127
- package/CapErrorBoundary/index.js.map +1 -1
- package/CapErrorBoundary/types.d.ts +46 -0
- package/CapErrorBoundary/types.d.ts.map +1 -0
- package/CapErrorStateIllustration/README.md +222 -0
- package/CapErrorStateIllustration/USE_CASES.md +33 -0
- package/CapErrorStateIllustration/index.d.ts +11 -0
- package/CapErrorStateIllustration/index.d.ts.map +1 -0
- package/CapErrorStateIllustration/index.js +22 -52
- package/CapErrorStateIllustration/index.js.map +1 -1
- package/CapErrorStateIllustration/types.d.ts +20 -0
- package/CapErrorStateIllustration/types.d.ts.map +1 -0
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -1
- package/index.js +372 -2
- package/index.js.map +1 -1
- package/package.json +2 -1
package/.npmrc
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Test Cases: CapErrorBoundary (Antd v3→v6)
|
|
2
|
+
|
|
3
|
+
## Role
|
|
4
|
+
Senior frontend engineer documenting ESSENTIAL test cases for Storybook stories and migration validation.
|
|
5
|
+
|
|
6
|
+
## Input
|
|
7
|
+
- **Component**: CapErrorBoundary
|
|
8
|
+
- **Complexity**: medium (≤20 test cases)
|
|
9
|
+
- **Source**: blaze-ui/components/CapErrorBoundary/
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Google Sheets Output
|
|
14
|
+
|
|
15
|
+
**Spreadsheet ID**: `1Xt8l8Q6Hw0cUYV65SlGvGcPnOtzprr0fukDR9UWJ3kg`
|
|
16
|
+
**Tab**: CapErrorBoundary
|
|
17
|
+
|
|
18
|
+
### Steps
|
|
19
|
+
1. Check connection: `COMPOSIO_CHECK_ACTIVE_CONNECTION` toolkit="googlesheets"
|
|
20
|
+
2. Create tab: `GOOGLESHEETS_ADD_SHEET`
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"spreadsheetId": "1Xt8l8Q6Hw0cUYV65SlGvGcPnOtzprr0fukDR9UWJ3kg",
|
|
24
|
+
"properties": {
|
|
25
|
+
"title": "CapErrorBoundary",
|
|
26
|
+
"gridProperties": {"rowCount": 100, "columnCount": 6}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
3. Write data: `GOOGLESHEETS_VALUES_UPDATE`
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"spreadsheet_id": "1Xt8l8Q6Hw0cUYV65SlGvGcPnOtzprr0fukDR9UWJ3kg",
|
|
34
|
+
"range": "CapErrorBoundary!A1",
|
|
35
|
+
"value_input_option": "USER_ENTERED",
|
|
36
|
+
"values": [
|
|
37
|
+
["ID", "Use Case", "Props/Config", "Expected Visual/Behavior", "Priority", "Storybook Story", "Notes"],
|
|
38
|
+
["UC-001", "React ErrorBoundary mode: child throws", "children (component that throws), useSlideBox: false/true", "Error boundary catches; fallbackRender runs; errorHandler(error) called; error illustration shows inline or inside CapSlideBox per useSlideBox", "P0", "ReactErrorBoundaryMode", "Core ErrorBoundary behavior"],
|
|
39
|
+
["UC-002", "API error boundary mode", "isApiErrorBoundary: true, isApiError: true | false", "When isApiError true: error illustration only. When false: children render. No ErrorBoundary when isApiErrorBoundary", "P0", "ApiErrorBoundaryMode", "Grouped isApiErrorBoundary + isApiError"],
|
|
40
|
+
["UC-003", "SlideBox vs inline fallback", "useSlideBox: true | false, slideBoxProps (e.g. className)", "useSlideBox true: fallback in CapSlideBox with show, content, handleClose, slideBoxProps spread. false: inline illustration only", "P0", "SlideBoxVsInline", "Grouped useSlideBox and slideBoxProps"],
|
|
41
|
+
["UC-004", "Boolean and config variants", "showIllustrationImage, showAnimation, isExpired, refreshThreshold (e.g. 3, 1, 0)", "Image show/hide; animation class when showAnimation; isExpired or refreshCount >= refreshThreshold sets isRefreshExpired on illustration", "P1", "ConfigVariants", "Grouped boolean/config visual state"],
|
|
42
|
+
["UC-005", "Content props (copy and slots)", "refreshText, expiryTitle, refreshTitle, expiryDescription (string or node); prefix, suffix", "All text passed to illustration; prefix/suffix render before/after in same row", "P1", "ContentProps", "Grouped content and prefix/suffix"],
|
|
43
|
+
["UC-006", "Refresh interaction and expiry", "onRefreshClick, refreshThreshold, isApiErrorBoundary: false", "Click refresh → onRefreshClick called, refreshCount increments; refreshCount === refreshThreshold → isRefreshExpired; key updates so ErrorBoundary remounts", "P1", "RefreshInteraction", "Grouped click and threshold/remount"],
|
|
44
|
+
["UC-007", "SlideBox close interaction", "useSlideBox: true, onCloseSlideBox", "Closing slide box calls onCloseSlideBox; handleClose wired correctly", "P1", "SlideBoxClose", "Single interaction test"],
|
|
45
|
+
["UC-008", "Event handlers invoked", "errorHandler, onRefreshClick, onCloseSlideBox", "errorHandler called with error in fallbackRender; onRefreshClick on refresh; onCloseSlideBox when slide box closed", "P1", "EventHandlers", "Grouped all handler invocations"],
|
|
46
|
+
["UC-009", "Styling (className and slideBoxProps)", "className, slideBoxProps: { className }", "className on illustration container; slideBoxProps spread to CapSlideBox including className", "P2", "Styling", "Grouped className + slideBoxProps"],
|
|
47
|
+
["UC-010", "Default props and minimal usage", "No optional props (or only children)", "Defaults apply; component renders without error", "P1", "DefaultProps", "Sanity with defaults"],
|
|
48
|
+
["UC-011", "Edge: refreshThreshold 0 or 1", "refreshThreshold: 0 | 1, trigger refresh", "Expired state after 0 or 1 refresh click; no crash", "P2", "EdgeRefreshThreshold", "Production edge for quick expiry"],
|
|
49
|
+
["UC-012", "Edge: children null or valid content", "children: null | valid React node", "null children don't throw; valid children render until throw. API mode: children when isApiError false", "P2", "EdgeChildren", "Grouped empty/valid children"]
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Use Cases Table
|
|
58
|
+
|
|
59
|
+
| ID | Use Case | Props/Config | Expected Visual/Behavior | Priority | Storybook Story | Notes |
|
|
60
|
+
|----|----------|---------------|--------------------------|----------|-----------------|--------|
|
|
61
|
+
| UC-001 | React ErrorBoundary mode: child throws | children (component that throws), useSlideBox: false/true | Error boundary catches; fallbackRender runs; errorHandler(error) called; error illustration shows inline or inside CapSlideBox per useSlideBox | P0 | ReactErrorBoundaryMode | Core ErrorBoundary behavior |
|
|
62
|
+
| UC-002 | API error boundary mode | isApiErrorBoundary: true, isApiError: true \| false | When isApiError true: error illustration only (no ErrorBoundary wrapper). When false: children render. No ErrorBoundary when isApiErrorBoundary | P0 | ApiErrorBoundaryMode | Grouped isApiErrorBoundary + isApiError |
|
|
63
|
+
| UC-003 | SlideBox vs inline fallback | useSlideBox: true \| false, slideBoxProps (e.g. className) | useSlideBox true: fallback in CapSlideBox with show, content, handleClose, slideBoxProps spread. false: fallback is inline illustration only | P0 | SlideBoxVsInline | Grouped useSlideBox and slideBoxProps usage |
|
|
64
|
+
| UC-004 | Boolean and config variants | showIllustrationImage, showAnimation, isExpired, refreshThreshold (e.g. 3, 1, 0) | Illustration shows/hides image; animation class applied when showAnimation; isExpired or refreshCount >= refreshThreshold sets isRefreshExpired on CapErrorStateIllustration | P1 | ConfigVariants | Grouped all boolean/config that affect visual state |
|
|
65
|
+
| UC-005 | Content props (copy and slots) | refreshText, expiryTitle, refreshTitle, expiryDescription (string or node); prefix, suffix | All text/copy passed to CapErrorStateIllustration; prefix/suffix render before/after illustration in same row | P1 | ContentProps | Grouped all content and prefix/suffix |
|
|
66
|
+
| UC-006 | Refresh interaction and expiry | onRefreshClick, refreshThreshold, isApiErrorBoundary: false | Click refresh → onRefreshClick called, refreshCount increments; when refreshCount === refreshThreshold, isRefreshExpired true (expired state). When !isApiErrorBoundary, key updates so ErrorBoundary remounts | P1 | RefreshInteraction | Grouped click behavior and threshold/remount |
|
|
67
|
+
| UC-007 | SlideBox close interaction | useSlideBox: true, onCloseSlideBox | Closing slide box calls onCloseSlideBox; handleClose wired to onCloseSlideBox | P1 | SlideBoxClose | Single interaction test |
|
|
68
|
+
| UC-008 | Event handlers invoked | errorHandler, onRefreshClick, onCloseSlideBox | errorHandler called with error object in fallbackRender; onRefreshClick on refresh; onCloseSlideBox when slide box closed | P1 | EventHandlers | Grouped all handler invocations |
|
|
69
|
+
| UC-009 | Styling (className and slideBoxProps) | className, slideBoxProps: { className } | className on illustration container (CapRow); slideBoxProps spread to CapSlideBox including className for slide box | P2 | Styling | Grouped className + slideBoxProps styling |
|
|
70
|
+
| UC-010 | Default props and minimal usage | No optional props (or only children) | Defaults: empty strings for text, refreshThreshold 3, showIllustrationImage true, showAnimation true, useSlideBox false, isApiErrorBoundary false; component renders without error | P1 | DefaultProps | Sanity with defaults |
|
|
71
|
+
| UC-011 | Edge: refreshThreshold 0 or 1 | refreshThreshold: 0 \| 1, trigger refresh | Expired state (isRefreshExpired) after 0 or 1 refresh click; no crash | P2 | EdgeRefreshThreshold | Production edge for quick expiry |
|
|
72
|
+
| UC-012 | Edge: children null or valid content | children: null \| valid React node | With React ErrorBoundary: null children don’t throw; valid children render until throw. With API mode: children render when isApiError false | P2 | EdgeChildren | Grouped empty/valid children |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Summary
|
|
77
|
+
|
|
78
|
+
- **Total use cases**: 12 (within medium limit of 20).
|
|
79
|
+
- **Grouping**: Config/boolean variants, content props, event handlers, styling, and edge cases each combined into single tests.
|
|
80
|
+
- **P0**: React vs API mode, SlideBox vs inline (3). **P1**: Config, content, refresh/slide interactions, handlers, defaults (6). **P2**: Styling, refreshThreshold edge, children edge (3).
|
|
81
|
+
- **Storybook stories**: ReactErrorBoundaryMode, ApiErrorBoundaryMode, SlideBoxVsInline, ConfigVariants, ContentProps, RefreshInteraction, SlideBoxClose, EventHandlers, Styling, DefaultProps, EdgeRefreshThreshold, EdgeChildren.
|
|
82
|
+
|
|
83
|
+
## Test Implementation Notes
|
|
84
|
+
|
|
85
|
+
- Use **React Testing Library** with **Jest**.
|
|
86
|
+
- Prefer `data-testid` for querying (add to component if needed).
|
|
87
|
+
- Clear mocks between tests where applicable.
|
|
88
|
+
- Do **not** mock Cap UI components (e.g. CapErrorStateIllustration, CapSlideBox, CapRow) unless instructed.
|
|
89
|
+
- Avoid relying on getByRole where avoidable; keep tests focused and not overly complex.
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# CapErrorBoundary
|
|
2
|
+
|
|
3
|
+
A wrapper component that provides error boundary functionality for React applications, catching JavaScript errors anywhere in the child component tree and displaying a fallback UI.
|
|
4
|
+
|
|
5
|
+
## Migration from Ant Design v3 to v6
|
|
6
|
+
|
|
7
|
+
This component has been migrated from Ant Design v3 to v6 with the following changes:
|
|
8
|
+
|
|
9
|
+
### Breaking Changes
|
|
10
|
+
|
|
11
|
+
**None** - The component maintains full backward compatibility. No API changes were made.
|
|
12
|
+
|
|
13
|
+
### Style Changes
|
|
14
|
+
|
|
15
|
+
**Approach**: The component now uses CSS Modules with the `styles[classname]` pattern instead of global class names. All styling remains functionally identical.
|
|
16
|
+
|
|
17
|
+
### Code Improvements
|
|
18
|
+
|
|
19
|
+
1. **Removed PropTypes**: Replaced with TypeScript types from `types.ts`
|
|
20
|
+
2. **Removed defaultProps**: Converted to default parameters in function arguments
|
|
21
|
+
3. **TypeScript support**: Full TypeScript type definitions with proper types
|
|
22
|
+
4. **CSS Modules**: Using `styles[classname]` pattern for scoped styling
|
|
23
|
+
|
|
24
|
+
### What Stayed the Same
|
|
25
|
+
|
|
26
|
+
- All component props and behavior
|
|
27
|
+
- Error boundary functionality (React ErrorBoundary mode)
|
|
28
|
+
- API error boundary mode (`isApiErrorBoundary` prop)
|
|
29
|
+
- Slide box vs inline fallback rendering
|
|
30
|
+
- Refresh threshold and expiry logic
|
|
31
|
+
- Animation support
|
|
32
|
+
- Prefix/suffix content slots
|
|
33
|
+
- All event handlers
|
|
34
|
+
|
|
35
|
+
### What Changed
|
|
36
|
+
|
|
37
|
+
- **Removed**: `PropTypes` (replaced with TypeScript types)
|
|
38
|
+
- **Removed**: `defaultProps` (replaced with default parameters)
|
|
39
|
+
- **Updated**: CSS class names now use CSS Modules pattern
|
|
40
|
+
- **Added**: TypeScript type definitions in `types.ts`
|
|
41
|
+
- **Added**: CSS Modules for scoped styling
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
### Basic Usage (React ErrorBoundary Mode)
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import CapErrorBoundary from '@capillarytech/blaze-ui/components/CapErrorBoundary';
|
|
49
|
+
|
|
50
|
+
function App() {
|
|
51
|
+
return (
|
|
52
|
+
<CapErrorBoundary>
|
|
53
|
+
<YourComponent />
|
|
54
|
+
</CapErrorBoundary>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### With Custom Error Handler
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<CapErrorBoundary
|
|
63
|
+
errorHandler={(error) => {
|
|
64
|
+
console.error('Error caught:', error);
|
|
65
|
+
// Send to error tracking service
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
<YourComponent />
|
|
69
|
+
</CapErrorBoundary>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### API Error Boundary Mode
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
<CapErrorBoundary
|
|
76
|
+
isApiErrorBoundary
|
|
77
|
+
isApiError={hasApiError}
|
|
78
|
+
>
|
|
79
|
+
<YourComponent />
|
|
80
|
+
</CapErrorBoundary>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### With Slide Box
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
<CapErrorBoundary
|
|
87
|
+
useSlideBox
|
|
88
|
+
onCloseSlideBox={() => {
|
|
89
|
+
console.log('Slide box closed');
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
<YourComponent />
|
|
93
|
+
</CapErrorBoundary>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### With Custom Content
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
<CapErrorBoundary
|
|
100
|
+
refreshText="Try Again"
|
|
101
|
+
refreshTitle="Something went wrong"
|
|
102
|
+
expiryTitle="Refresh limit reached"
|
|
103
|
+
expiryDescription="Please contact support"
|
|
104
|
+
prefix={<CustomHeader />}
|
|
105
|
+
suffix={<CustomFooter />}
|
|
106
|
+
>
|
|
107
|
+
<YourComponent />
|
|
108
|
+
</CapErrorBoundary>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Props
|
|
112
|
+
|
|
113
|
+
| Prop | Type | Default | Description |
|
|
114
|
+
|------|------|---------|-------------|
|
|
115
|
+
| `children` | `React.ReactNode` | - | Child components to wrap with error boundary |
|
|
116
|
+
| `className` | `string` | `''` | Additional CSS class name |
|
|
117
|
+
| `isExpired` | `boolean` | `false` | Whether the refresh action has expired |
|
|
118
|
+
| `isApiError` | `boolean` | `false` | Whether to show API error state (only used when `isApiErrorBoundary` is true) |
|
|
119
|
+
| `refreshText` | `string \| React.ReactNode` | `''` | Text to display for refresh action |
|
|
120
|
+
| `expiryTitle` | `string \| React.ReactNode` | `''` | Title to display when refresh has expired |
|
|
121
|
+
| `refreshTitle` | `string \| React.ReactNode` | `''` | Title to display for refresh action |
|
|
122
|
+
| `useSlideBox` | `boolean` | `false` | Whether to display error in a slide box instead of inline |
|
|
123
|
+
| `errorHandler` | `(error: Error) => void` | `() => {}` | Handler called when an error is caught |
|
|
124
|
+
| `slideBoxProps` | `Record<string, unknown>` | `{}` | Props to pass to CapSlideBox when `useSlideBox` is true |
|
|
125
|
+
| `onRefreshClick` | `() => void` | `() => {}` | Handler called when refresh button is clicked |
|
|
126
|
+
| `onCloseSlideBox` | `() => void` | `() => {}` | Handler called when slide box is closed |
|
|
127
|
+
| `refreshThreshold` | `number` | `3` | Number of refresh clicks before showing expired state |
|
|
128
|
+
| `expiryDescription` | `string \| React.ReactNode` | `''` | Description to display when refresh has expired |
|
|
129
|
+
| `isApiErrorBoundary` | `boolean` | `false` | Whether to use API error boundary mode (shows error based on `isApiError` prop instead of catching React errors) |
|
|
130
|
+
| `showIllustrationImage` | `boolean` | `true` | Whether to show illustration image |
|
|
131
|
+
| `prefix` | `string \| React.ReactNode` | `''` | Content to render before the error illustration |
|
|
132
|
+
| `suffix` | `string \| React.ReactNode` | `''` | Content to render after the error illustration |
|
|
133
|
+
| `showAnimation` | `boolean` | `true` | Whether to show animation when error illustration appears |
|
|
134
|
+
|
|
135
|
+
## Modes
|
|
136
|
+
|
|
137
|
+
### React ErrorBoundary Mode (Default)
|
|
138
|
+
|
|
139
|
+
When `isApiErrorBoundary` is `false` (default), the component wraps children with React's `ErrorBoundary` from `react-error-boundary`. This catches JavaScript errors during rendering, in lifecycle methods, and in constructors of the whole tree below.
|
|
140
|
+
|
|
141
|
+
### API Error Boundary Mode
|
|
142
|
+
|
|
143
|
+
When `isApiErrorBoundary` is `true`, the component does not use React's ErrorBoundary. Instead, it conditionally renders the error illustration based on the `isApiError` prop. This is useful for handling API errors that don't cause React component errors.
|
|
144
|
+
|
|
145
|
+
## Notes
|
|
146
|
+
|
|
147
|
+
- The component uses `react-error-boundary` library for React error boundary functionality
|
|
148
|
+
- When refresh is clicked in React ErrorBoundary mode, the component remounts the ErrorBoundary by updating its key
|
|
149
|
+
- The refresh count is tracked internally and compared against `refreshThreshold` to determine expired state
|
|
150
|
+
- All additional props passed to `CapErrorBoundary` are spread to `CapErrorStateIllustration`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapErrorBoundary/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAQxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhD,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA2FrD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -4767,9 +4767,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
4767
4767
|
exports.__esModule = true;
|
|
4768
4768
|
exports["default"] = void 0;
|
|
4769
4769
|
var _classnames = _interopRequireDefault(__webpack_require__(46942));
|
|
4770
|
-
var _propTypes = _interopRequireDefault(__webpack_require__(43363));
|
|
4771
4770
|
var _react = _interopRequireDefault(__webpack_require__(9206));
|
|
4772
|
-
var _styledComponents = _interopRequireDefault(__webpack_require__(76480));
|
|
4773
4771
|
var _expiryErrorStateIllustration = _interopRequireDefault(__webpack_require__(67277));
|
|
4774
4772
|
var _refreshErrorStateIllustration = _interopRequireDefault(__webpack_require__(57291));
|
|
4775
4773
|
var _CapButton = _interopRequireDefault(__webpack_require__(80739));
|
|
@@ -4777,11 +4775,9 @@ var _CapHeading = _interopRequireDefault(__webpack_require__(7319));
|
|
|
4777
4775
|
var _CapIcon = _interopRequireDefault(__webpack_require__(65124));
|
|
4778
4776
|
var _CapImage = _interopRequireDefault(__webpack_require__(84446));
|
|
4779
4777
|
var _CapRow = _interopRequireDefault(__webpack_require__(69813));
|
|
4780
|
-
var
|
|
4781
|
-
__webpack_require__(72890);
|
|
4778
|
+
var _styles = _interopRequireDefault(__webpack_require__(72890));
|
|
4782
4779
|
var _jsxRuntime = __webpack_require__(74848);
|
|
4783
4780
|
const _excluded = ["showImage", "className", "refreshText", "expiryTitle", "refreshTitle", "onRefreshClick", "isRefreshExpired", "expiryDescription"];
|
|
4784
|
-
var _templateObject, _templateObject2;
|
|
4785
4781
|
/**
|
|
4786
4782
|
*
|
|
4787
4783
|
* CapErrorStateIllustration
|
|
@@ -4790,28 +4786,26 @@ var _templateObject, _templateObject2;
|
|
|
4790
4786
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
4791
4787
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4792
4788
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4793
|
-
function _taggedTemplateLiteralLoose(e, t) { return t || (t = e.slice(0)), e.raw = t, e; }
|
|
4794
|
-
const ErrorStateIllustrationContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: 100%;\n display: flex;\n text-align: center;\n align-items: center;\n justify-content: center;\n"])));
|
|
4795
|
-
const RefreshButtonTextContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: ", ";\n padding: ", ";\n color: ", ";\n"])), _variables.CAP_SPACE_04, _variables.CAP_SPACE_04, _variables.CAP_SECONDARY.base);
|
|
4796
4789
|
const CapErrorStateIllustration = _ref => {
|
|
4797
4790
|
let {
|
|
4798
|
-
showImage,
|
|
4799
|
-
className,
|
|
4800
|
-
refreshText,
|
|
4801
|
-
expiryTitle,
|
|
4802
|
-
refreshTitle,
|
|
4803
|
-
onRefreshClick,
|
|
4804
|
-
isRefreshExpired,
|
|
4805
|
-
expiryDescription
|
|
4791
|
+
showImage = true,
|
|
4792
|
+
className = '',
|
|
4793
|
+
refreshText = '',
|
|
4794
|
+
expiryTitle = '',
|
|
4795
|
+
refreshTitle = '',
|
|
4796
|
+
onRefreshClick = () => {},
|
|
4797
|
+
isRefreshExpired = false,
|
|
4798
|
+
expiryDescription = ''
|
|
4806
4799
|
} = _ref,
|
|
4807
4800
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
4808
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
4809
|
-
className: (0, _classnames.default)('cap-error-state-illustration', className)
|
|
4801
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _extends({
|
|
4802
|
+
className: (0, _classnames.default)(_styles.default['cap-error-state-illustration'], className)
|
|
4810
4803
|
}, rest, {
|
|
4811
4804
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
|
|
4805
|
+
className: _styles.default['error-state-illustration-content'],
|
|
4812
4806
|
children: [showImage && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapImage.default, {
|
|
4813
4807
|
src: isRefreshExpired ? _expiryErrorStateIllustration.default : _refreshErrorStateIllustration.default,
|
|
4814
|
-
className:
|
|
4808
|
+
className: _styles.default['error-state-image']
|
|
4815
4809
|
}), !isRefreshExpired ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
4816
4810
|
children: [refreshTitle && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapHeading.default, {
|
|
4817
4811
|
type: "h4",
|
|
@@ -4819,11 +4813,12 @@ const CapErrorStateIllustration = _ref => {
|
|
|
4819
4813
|
}), refreshText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapButton.default, {
|
|
4820
4814
|
type: "link",
|
|
4821
4815
|
onClick: onRefreshClick,
|
|
4822
|
-
className:
|
|
4823
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
4816
|
+
className: _styles.default['error-state-refresh-button'],
|
|
4817
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
4818
|
+
className: _styles.default['refresh-button-text-container'],
|
|
4824
4819
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapIcon.default, {
|
|
4825
4820
|
type: "refresh",
|
|
4826
|
-
className:
|
|
4821
|
+
className: _styles.default['error-state-refresh-icon']
|
|
4827
4822
|
}), refreshText]
|
|
4828
4823
|
})
|
|
4829
4824
|
})]
|
|
@@ -4839,26 +4834,7 @@ const CapErrorStateIllustration = _ref => {
|
|
|
4839
4834
|
})
|
|
4840
4835
|
}));
|
|
4841
4836
|
};
|
|
4842
|
-
CapErrorStateIllustration.
|
|
4843
|
-
className: '',
|
|
4844
|
-
refreshText: '',
|
|
4845
|
-
expiryTitle: '',
|
|
4846
|
-
showImage: true,
|
|
4847
|
-
refreshTitle: '',
|
|
4848
|
-
expiryDescription: '',
|
|
4849
|
-
isRefreshExpired: false,
|
|
4850
|
-
onRefreshClick: () => {}
|
|
4851
|
-
};
|
|
4852
|
-
CapErrorStateIllustration.propTypes = {
|
|
4853
|
-
showImage: _propTypes.default.bool,
|
|
4854
|
-
className: _propTypes.default.string,
|
|
4855
|
-
onRefreshClick: _propTypes.default.func,
|
|
4856
|
-
isRefreshExpired: _propTypes.default.bool,
|
|
4857
|
-
refreshText: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
4858
|
-
expiryTitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
4859
|
-
refreshTitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
4860
|
-
expiryDescription: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node])
|
|
4861
|
-
};
|
|
4837
|
+
CapErrorStateIllustration.displayName = 'CapErrorStateIllustration';
|
|
4862
4838
|
var _default = exports["default"] = CapErrorStateIllustration;
|
|
4863
4839
|
|
|
4864
4840
|
/***/ }),
|
|
@@ -8364,15 +8340,13 @@ var ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ = __webpack_require__(31601);
|
|
|
8364
8340
|
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(76314);
|
|
8365
8341
|
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
|
|
8366
8342
|
// Module
|
|
8367
|
-
___CSS_LOADER_EXPORT___.push([module.id, `@keyframes errorBoundarySlide{from{transform:translateY(30%)}to{transform:translateY(0%)}}.
|
|
8343
|
+
___CSS_LOADER_EXPORT___.push([module.id, `@keyframes errorBoundarySlide{from{transform:translateY(30%)}to{transform:translateY(0%)}}.illustrationAnimation{position:relative;animation:errorBoundarySlide .3s ease}.slideBox .cap-slide-box-v2-container .slidebox-content-container{overflow:hidden}.illustrationContainer{height:100%;width:100%}`, ""]);
|
|
8368
8344
|
// Exports
|
|
8369
8345
|
___CSS_LOADER_EXPORT___.locals = {
|
|
8370
|
-
"
|
|
8346
|
+
"illustrationAnimation": `illustrationAnimation`,
|
|
8371
8347
|
"errorBoundarySlide": `errorBoundarySlide`,
|
|
8372
|
-
"
|
|
8373
|
-
"
|
|
8374
|
-
"slidebox-content-container": `slidebox-content-container`,
|
|
8375
|
-
"cap-error-boundary-illustration-container": `cap-error-boundary-illustration-container`
|
|
8348
|
+
"slideBox": `slideBox`,
|
|
8349
|
+
"illustrationContainer": `illustrationContainer`
|
|
8376
8350
|
};
|
|
8377
8351
|
module.exports = ___CSS_LOADER_EXPORT___;
|
|
8378
8352
|
|
|
@@ -11100,13 +11074,15 @@ var ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ = __webpack_require__(31601);
|
|
|
11100
11074
|
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(76314);
|
|
11101
11075
|
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
|
|
11102
11076
|
// Module
|
|
11103
|
-
___CSS_LOADER_EXPORT___.push([module.id, `.cap-error-state-illustration .error-state-image{padding-bottom:1.428rem}.cap-error-state-illustration .error-state-refresh-button{margin:.285rem}.cap-error-state-illustration .error-state-refresh-icon{font-size:1.143rem}`, ""]);
|
|
11077
|
+
___CSS_LOADER_EXPORT___.push([module.id, `.cap-error-state-illustration{width:100%;height:100%;display:flex;text-align:center;align-items:center;justify-content:center}.cap-error-state-illustration .error-state-image{padding-bottom:1.428rem}.cap-error-state-illustration .error-state-refresh-button{margin:.285rem}.cap-error-state-illustration .error-state-refresh-icon{font-size:1.143rem}.cap-error-state-illustration .error-state-illustration-content{display:flex;flex-direction:column;align-items:center;justify-content:center}.cap-error-state-illustration .refresh-button-text-container{display:flex;align-items:center;gap:.285rem;padding:.285rem;color:#2466ea}`, ""]);
|
|
11104
11078
|
// Exports
|
|
11105
11079
|
___CSS_LOADER_EXPORT___.locals = {
|
|
11106
11080
|
"cap-error-state-illustration": `cap-error-state-illustration`,
|
|
11107
11081
|
"error-state-image": `error-state-image`,
|
|
11108
11082
|
"error-state-refresh-button": `error-state-refresh-button`,
|
|
11109
|
-
"error-state-refresh-icon": `error-state-refresh-icon
|
|
11083
|
+
"error-state-refresh-icon": `error-state-refresh-icon`,
|
|
11084
|
+
"error-state-illustration-content": `error-state-illustration-content`,
|
|
11085
|
+
"refresh-button-text-container": `refresh-button-text-container`
|
|
11110
11086
|
};
|
|
11111
11087
|
module.exports = ___CSS_LOADER_EXPORT___;
|
|
11112
11088
|
|
|
@@ -13746,14 +13722,6 @@ var update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js
|
|
|
13746
13722
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_node_modules_sass_loader_dist_cjs_js_ruleSet_1_rules_1_use_2_styles_scss__WEBPACK_IMPORTED_MODULE_5___default()) && (_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_node_modules_sass_loader_dist_cjs_js_ruleSet_1_rules_1_use_2_styles_scss__WEBPACK_IMPORTED_MODULE_5___default().locals) ? (_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_node_modules_sass_loader_dist_cjs_js_ruleSet_1_rules_1_use_2_styles_scss__WEBPACK_IMPORTED_MODULE_5___default().locals) : undefined);
|
|
13747
13723
|
|
|
13748
13724
|
|
|
13749
|
-
/***/ }),
|
|
13750
|
-
|
|
13751
|
-
/***/ 76480:
|
|
13752
|
-
/***/ ((module) => {
|
|
13753
|
-
|
|
13754
|
-
"use strict";
|
|
13755
|
-
module.exports = require("styled-components");
|
|
13756
|
-
|
|
13757
13725
|
/***/ }),
|
|
13758
13726
|
|
|
13759
13727
|
/***/ 76903:
|
|
@@ -16879,15 +16847,15 @@ var exports = __webpack_exports__;
|
|
|
16879
16847
|
exports.__esModule = true;
|
|
16880
16848
|
exports["default"] = void 0;
|
|
16881
16849
|
var _classnames = _interopRequireDefault(__webpack_require__(46942));
|
|
16882
|
-
var _propTypes = _interopRequireDefault(__webpack_require__(43363));
|
|
16883
16850
|
var _react = _interopRequireWildcard(__webpack_require__(9206));
|
|
16884
16851
|
var _reactErrorBoundary = __webpack_require__(59263);
|
|
16885
16852
|
var _CapErrorStateIllustration = _interopRequireDefault(__webpack_require__(30988));
|
|
16886
16853
|
var _CapRow = _interopRequireDefault(__webpack_require__(69813));
|
|
16887
16854
|
var _CapSlideBox = _interopRequireDefault(__webpack_require__(70225));
|
|
16888
|
-
__webpack_require__(26909);
|
|
16855
|
+
var _styles = _interopRequireDefault(__webpack_require__(26909));
|
|
16889
16856
|
var _jsxRuntime = __webpack_require__(74848);
|
|
16890
|
-
const _excluded = ["children", "className", "isExpired", "isApiError", "refreshText", "expiryTitle", "useSlideBox", "
|
|
16857
|
+
const _excluded = ["children", "className", "isExpired", "isApiError", "refreshText", "expiryTitle", "refreshTitle", "useSlideBox", "header", "errorHandler", "slideBoxProps", "onRefreshClick", "onCloseSlideBox", "refreshThreshold", "expiryDescription", "isApiErrorBoundary", "showIllustrationImage", "prefix", "suffix", "showAnimation"],
|
|
16858
|
+
_excluded2 = ["className", "header"];
|
|
16891
16859
|
/**
|
|
16892
16860
|
*
|
|
16893
16861
|
* CapErrorBoundary
|
|
@@ -16900,24 +16868,25 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
16900
16868
|
const CapErrorBoundary = _ref => {
|
|
16901
16869
|
let {
|
|
16902
16870
|
children,
|
|
16903
|
-
className,
|
|
16904
|
-
isExpired,
|
|
16905
|
-
isApiError,
|
|
16906
|
-
refreshText,
|
|
16907
|
-
expiryTitle,
|
|
16908
|
-
|
|
16909
|
-
|
|
16910
|
-
|
|
16911
|
-
|
|
16912
|
-
|
|
16913
|
-
|
|
16914
|
-
|
|
16915
|
-
|
|
16916
|
-
|
|
16917
|
-
|
|
16918
|
-
|
|
16919
|
-
|
|
16920
|
-
|
|
16871
|
+
className = '',
|
|
16872
|
+
isExpired = false,
|
|
16873
|
+
isApiError = false,
|
|
16874
|
+
refreshText = '',
|
|
16875
|
+
expiryTitle = '',
|
|
16876
|
+
refreshTitle = '',
|
|
16877
|
+
useSlideBox = false,
|
|
16878
|
+
header,
|
|
16879
|
+
errorHandler = () => {},
|
|
16880
|
+
slideBoxProps = {},
|
|
16881
|
+
onRefreshClick = () => {},
|
|
16882
|
+
onCloseSlideBox = () => {},
|
|
16883
|
+
refreshThreshold = 3,
|
|
16884
|
+
expiryDescription = '',
|
|
16885
|
+
isApiErrorBoundary = false,
|
|
16886
|
+
showIllustrationImage = true,
|
|
16887
|
+
prefix = '',
|
|
16888
|
+
suffix = '',
|
|
16889
|
+
showAnimation = true
|
|
16921
16890
|
} = _ref,
|
|
16922
16891
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
16923
16892
|
const [refreshCount, setRefreshCount] = (0, _react.useState)(0);
|
|
@@ -16930,10 +16899,10 @@ const CapErrorBoundary = _ref => {
|
|
|
16930
16899
|
}
|
|
16931
16900
|
};
|
|
16932
16901
|
const errorStateIllustration = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
|
|
16933
|
-
className: (0, _classnames.default)(
|
|
16902
|
+
className: (0, _classnames.default)(_styles.default.illustrationContainer, className),
|
|
16934
16903
|
children: [prefix, /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapErrorStateIllustration.default, _extends({
|
|
16935
16904
|
className: (0, _classnames.default)({
|
|
16936
|
-
|
|
16905
|
+
[_styles.default.illustrationAnimation]: showAnimation
|
|
16937
16906
|
}),
|
|
16938
16907
|
refreshText: refreshText,
|
|
16939
16908
|
expiryTitle: expiryTitle,
|
|
@@ -16950,15 +16919,22 @@ const CapErrorBoundary = _ref => {
|
|
|
16950
16919
|
} = _ref2;
|
|
16951
16920
|
errorHandler(error);
|
|
16952
16921
|
if (useSlideBox) {
|
|
16953
|
-
const
|
|
16954
|
-
|
|
16955
|
-
|
|
16922
|
+
const _ref3 = slideBoxProps,
|
|
16923
|
+
{
|
|
16924
|
+
className: slideBoxClassName,
|
|
16925
|
+
header: slideBoxHeaderProp = ''
|
|
16926
|
+
} = _ref3,
|
|
16927
|
+
restSlideBoxProps = _objectWithoutPropertiesLoose(_ref3, _excluded2);
|
|
16928
|
+
// Priority: 1) header prop, 2) slideBoxProps.header, 3) undefined if both not found
|
|
16929
|
+
const slideBoxHeader = header !== undefined ? header : slideBoxHeaderProp;
|
|
16956
16930
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapSlideBox.default, _extends({
|
|
16957
16931
|
show: true,
|
|
16932
|
+
header: slideBoxHeader //added header here because header is required prop in CapSlideBox
|
|
16933
|
+
,
|
|
16958
16934
|
content: errorStateIllustration,
|
|
16959
16935
|
handleClose: onCloseSlideBox,
|
|
16960
|
-
className: (0, _classnames.default)(
|
|
16961
|
-
},
|
|
16936
|
+
className: (0, _classnames.default)(_styles.default.slideBox, slideBoxClassName)
|
|
16937
|
+
}, restSlideBoxProps));
|
|
16962
16938
|
}
|
|
16963
16939
|
return errorStateIllustration;
|
|
16964
16940
|
};
|
|
@@ -16969,47 +16945,6 @@ const CapErrorBoundary = _ref => {
|
|
|
16969
16945
|
}), isApiErrorBoundary && (isApiError ? errorStateIllustration : children)]
|
|
16970
16946
|
}, updatedKey);
|
|
16971
16947
|
};
|
|
16972
|
-
CapErrorBoundary.defaultProps = {
|
|
16973
|
-
className: '',
|
|
16974
|
-
refreshText: '',
|
|
16975
|
-
expiryTitle: '',
|
|
16976
|
-
refreshTitle: '',
|
|
16977
|
-
isExpired: false,
|
|
16978
|
-
isApiError: false,
|
|
16979
|
-
slideBoxProps: {},
|
|
16980
|
-
useSlideBox: false,
|
|
16981
|
-
refreshThreshold: 3,
|
|
16982
|
-
expiryDescription: '',
|
|
16983
|
-
errorHandler: () => {},
|
|
16984
|
-
onRefreshClick: () => {},
|
|
16985
|
-
onCloseSlideBox: () => {},
|
|
16986
|
-
isApiErrorBoundary: false,
|
|
16987
|
-
showIllustrationImage: true,
|
|
16988
|
-
prefix: '',
|
|
16989
|
-
suffix: '',
|
|
16990
|
-
showAnimation: true
|
|
16991
|
-
};
|
|
16992
|
-
CapErrorBoundary.propTypes = {
|
|
16993
|
-
children: _propTypes.default.node,
|
|
16994
|
-
isExpired: _propTypes.default.bool,
|
|
16995
|
-
isApiError: _propTypes.default.bool,
|
|
16996
|
-
className: _propTypes.default.string,
|
|
16997
|
-
useSlideBox: _propTypes.default.bool,
|
|
16998
|
-
errorHandler: _propTypes.default.func,
|
|
16999
|
-
onRefreshClick: _propTypes.default.func,
|
|
17000
|
-
onCloseSlideBox: _propTypes.default.func,
|
|
17001
|
-
slideBoxProps: _propTypes.default.object,
|
|
17002
|
-
refreshThreshold: _propTypes.default.number,
|
|
17003
|
-
isApiErrorBoundary: _propTypes.default.bool,
|
|
17004
|
-
showIllustrationImage: _propTypes.default.bool,
|
|
17005
|
-
showAnimation: _propTypes.default.bool,
|
|
17006
|
-
refreshText: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
17007
|
-
expiryTitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
17008
|
-
refreshTitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
17009
|
-
expiryDescription: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
17010
|
-
prefix: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
17011
|
-
suffix: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node])
|
|
17012
|
-
};
|
|
17013
16948
|
var _default = exports["default"] = CapErrorBoundary;
|
|
17014
16949
|
})();
|
|
17015
16950
|
|