@qwickapps/react-framework 1.3.2 → 1.3.3

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.
Files changed (33) hide show
  1. package/README.md +106 -0
  2. package/dist/components/AccessibilityProvider.d.ts +64 -0
  3. package/dist/components/AccessibilityProvider.d.ts.map +1 -0
  4. package/dist/components/Breadcrumbs.d.ts +39 -0
  5. package/dist/components/Breadcrumbs.d.ts.map +1 -0
  6. package/dist/components/ErrorBoundary.d.ts +39 -0
  7. package/dist/components/ErrorBoundary.d.ts.map +1 -0
  8. package/dist/components/QwickApp.d.ts.map +1 -1
  9. package/dist/components/index.d.ts +3 -0
  10. package/dist/components/index.d.ts.map +1 -1
  11. package/dist/index.bundled.css +12 -0
  12. package/dist/index.esm.js +795 -12
  13. package/dist/index.js +800 -10
  14. package/package.json +1 -1
  15. package/src/components/AccessibilityProvider.tsx +466 -0
  16. package/src/components/Breadcrumbs.tsx +223 -0
  17. package/src/components/ErrorBoundary.tsx +216 -0
  18. package/src/components/QwickApp.tsx +17 -11
  19. package/src/components/__tests__/AccessibilityProvider.test.tsx +330 -0
  20. package/src/components/__tests__/Breadcrumbs.test.tsx +268 -0
  21. package/src/components/__tests__/ErrorBoundary.test.tsx +163 -0
  22. package/src/components/index.ts +3 -0
  23. package/src/stories/AccessibilityProvider.stories.tsx +284 -0
  24. package/src/stories/Breadcrumbs.stories.tsx +304 -0
  25. package/src/stories/ErrorBoundary.stories.tsx +159 -0
  26. package/dist/schemas/Builders.d.ts +0 -7
  27. package/dist/schemas/Builders.d.ts.map +0 -1
  28. package/dist/schemas/types.d.ts +0 -7
  29. package/dist/schemas/types.d.ts.map +0 -1
  30. package/dist/types/DataBinding.d.ts +0 -7
  31. package/dist/types/DataBinding.d.ts.map +0 -1
  32. package/dist/types/DataProvider.d.ts +0 -7
  33. package/dist/types/DataProvider.d.ts.map +0 -1
@@ -0,0 +1,159 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { ErrorBoundary, withErrorBoundary } from '../components/ErrorBoundary';
3
+ import React from 'react';
4
+
5
+ // Test component that throws an error
6
+ const ThrowError = ({ shouldThrow = false }: { shouldThrow?: boolean }) => {
7
+ if (shouldThrow) {
8
+ throw new Error('Intentional error for testing ErrorBoundary');
9
+ }
10
+ return <div>This component is working fine!</div>;
11
+ };
12
+
13
+ const meta: Meta<typeof ErrorBoundary> = {
14
+ title: 'Framework/ErrorBoundary',
15
+ component: ErrorBoundary,
16
+ parameters: {
17
+ layout: 'centered',
18
+ docs: {
19
+ description: {
20
+ component: 'A React Error Boundary component that catches JavaScript errors and displays a user-friendly fallback UI with recovery options.',
21
+ },
22
+ },
23
+ },
24
+ tags: ['autodocs'],
25
+ argTypes: {
26
+ fallback: {
27
+ description: 'Custom fallback UI to display when an error occurs',
28
+ },
29
+ onError: {
30
+ description: 'Callback function called when an error is caught',
31
+ action: 'onError',
32
+ },
33
+ showErrorDetails: {
34
+ description: 'Whether to show error details (overrides development mode detection)',
35
+ control: 'boolean',
36
+ },
37
+ children: {
38
+ description: 'Child components to wrap with error boundary',
39
+ },
40
+ },
41
+ };
42
+
43
+ export default meta;
44
+ type Story = StoryObj<typeof meta>;
45
+
46
+ // Default story with working component
47
+ export const Default: Story = {
48
+ args: {
49
+ children: <div>This is a working component wrapped in ErrorBoundary</div>,
50
+ },
51
+ };
52
+
53
+ // Story that demonstrates error handling
54
+ export const WithError: Story = {
55
+ args: {
56
+ children: <ThrowError shouldThrow={true} />,
57
+ },
58
+ parameters: {
59
+ docs: {
60
+ description: {
61
+ story: 'Demonstrates ErrorBoundary catching an error and displaying the fallback UI.',
62
+ },
63
+ },
64
+ },
65
+ };
66
+
67
+ // Story with custom fallback UI
68
+ export const CustomFallback: Story = {
69
+ args: {
70
+ children: <ThrowError shouldThrow={true} />,
71
+ fallback: (
72
+ <div style={{
73
+ padding: '2rem',
74
+ textAlign: 'center',
75
+ background: '#ffe6e6',
76
+ border: '2px solid #ff9999',
77
+ borderRadius: '8px',
78
+ color: '#cc0000'
79
+ }}>
80
+ <h3>🚨 Custom Error UI</h3>
81
+ <p>Something went wrong, but we have a custom fallback!</p>
82
+ </div>
83
+ ),
84
+ },
85
+ parameters: {
86
+ docs: {
87
+ description: {
88
+ story: 'Shows how to provide a custom fallback UI instead of the default error message.',
89
+ },
90
+ },
91
+ },
92
+ };
93
+
94
+ // Story showing error details in development mode
95
+ export const WithErrorDetails: Story = {
96
+ args: {
97
+ children: <ThrowError shouldThrow={true} />,
98
+ showErrorDetails: true,
99
+ },
100
+ parameters: {
101
+ docs: {
102
+ description: {
103
+ story: 'Shows error details including stack trace (normally only shown in development mode).',
104
+ },
105
+ },
106
+ },
107
+ };
108
+
109
+ // Story demonstrating the HOC
110
+ const TestComponent = () => <div>Component enhanced with ErrorBoundary HOC</div>;
111
+ const EnhancedComponent = withErrorBoundary(TestComponent);
112
+
113
+ export const HigherOrderComponent: Story = {
114
+ render: () => <EnhancedComponent />,
115
+ parameters: {
116
+ docs: {
117
+ description: {
118
+ story: 'Demonstrates using the withErrorBoundary Higher-Order Component to wrap any component with error handling.',
119
+ },
120
+ },
121
+ },
122
+ };
123
+
124
+ // Interactive story for testing retry functionality
125
+ export const Interactive: Story = {
126
+ render: () => {
127
+ const [shouldThrow, setShouldThrow] = React.useState(false);
128
+
129
+ return (
130
+ <div style={{ padding: '2rem' }}>
131
+ <button
132
+ onClick={() => setShouldThrow(!shouldThrow)}
133
+ style={{
134
+ marginBottom: '1rem',
135
+ padding: '0.5rem 1rem',
136
+ background: shouldThrow ? '#ff4444' : '#44aa44',
137
+ color: 'white',
138
+ border: 'none',
139
+ borderRadius: '4px',
140
+ cursor: 'pointer'
141
+ }}
142
+ >
143
+ {shouldThrow ? 'Fix Component' : 'Break Component'}
144
+ </button>
145
+
146
+ <ErrorBoundary>
147
+ <ThrowError shouldThrow={shouldThrow} />
148
+ </ErrorBoundary>
149
+ </div>
150
+ );
151
+ },
152
+ parameters: {
153
+ docs: {
154
+ description: {
155
+ story: 'Interactive demo where you can break and fix the component to see ErrorBoundary in action.',
156
+ },
157
+ },
158
+ },
159
+ };
@@ -1,7 +0,0 @@
1
- /**
2
- * Schema builders - Re-exported from @qwickapps/schema
3
- *
4
- * @deprecated Import directly from '@qwickapps/schema' instead
5
- */
6
- export { FieldBuilder, SchemaBuilder, ModelBuilder, createSchema, field, model, Fields } from '@qwickapps/schema';
7
- //# sourceMappingURL=Builders.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Builders.d.ts","sourceRoot":"","sources":["../../src/schemas/Builders.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,KAAK,EACL,MAAM,EACP,MAAM,mBAAmB,CAAC"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Schema types - Re-exported from @qwickapps/schema
3
- *
4
- * @deprecated Import directly from '@qwickapps/schema' instead
5
- */
6
- export { Schema, Model, FieldDefinition, DataType, FieldType, ValidationRules, EditorConfig } from '@qwickapps/schema';
7
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/schemas/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,MAAM,EACN,KAAK,EACL,eAAe,EACf,QAAQ,EACR,SAAS,EACT,eAAe,EACf,YAAY,EACb,MAAM,mBAAmB,CAAC"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Data binding types - Re-exported from @qwickapps/schema
3
- *
4
- * @deprecated Import directly from '@qwickapps/schema' instead
5
- */
6
- export { DataBindingProps, DataBindingMeta, DataBindingOptions, WithDataBinding, DataBindingResult } from '@qwickapps/schema';
7
- //# sourceMappingURL=DataBinding.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DataBinding.d.ts","sourceRoot":"","sources":["../../src/types/DataBinding.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EAClB,MAAM,mBAAmB,CAAC"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Data provider interface - Re-exported from @qwickapps/schema
3
- *
4
- * @deprecated Import directly from '@qwickapps/schema' instead
5
- */
6
- export { IDataProvider, DataResponse, ModelInstance, SelectOptions } from '@qwickapps/schema';
7
- //# sourceMappingURL=DataProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DataProvider.d.ts","sourceRoot":"","sources":["../../src/types/DataProvider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}