@admin-layout/tailwind-ui 12.2.4-alpha.98 → 12.2.5-alpha.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.
Files changed (62) hide show
  1. package/lib/components/ErrorHandlers/ApplicationErrorHandler.d.ts.map +1 -1
  2. package/lib/components/ErrorHandlers/ApplicationErrorHandler.js +5 -1
  3. package/lib/components/ErrorHandlers/ApplicationErrorHandler.js.map +1 -1
  4. package/lib/components/ErrorHandlers/RemixErrorBoundary.d.ts +11 -0
  5. package/lib/components/ErrorHandlers/RemixErrorBoundary.d.ts.map +1 -1
  6. package/lib/components/ErrorHandlers/RemixErrorBoundary.js +134 -3
  7. package/lib/components/ErrorHandlers/RemixErrorBoundary.js.map +1 -1
  8. package/lib/components/ErrorHandlers/SPAErrorBoundary.d.ts.map +1 -1
  9. package/lib/components/ErrorHandlers/SPAErrorBoundary.js +5 -1
  10. package/lib/components/ErrorHandlers/SPAErrorBoundary.js.map +1 -1
  11. package/lib/components/ErrorHandlers/__tests__/RemixErrorBoundary.test.d.ts +2 -0
  12. package/lib/components/ErrorHandlers/__tests__/RemixErrorBoundary.test.d.ts.map +1 -0
  13. package/lib/components/InputToolBar/InputToolBar.d.ts.map +1 -1
  14. package/lib/components/InputToolBar/InputToolBar.js +34 -25
  15. package/lib/components/InputToolBar/InputToolBar.js.map +1 -1
  16. package/lib/components/InputToolBar/types.d.ts +2 -0
  17. package/lib/components/InputToolBar/types.d.ts.map +1 -1
  18. package/lib/components/RJSFPreview/PreviewAsyncDropdown.js +111 -0
  19. package/lib/components/RJSFPreview/PreviewAsyncDropdown.js.map +1 -0
  20. package/lib/components/RJSFPreview/PreviewCheckboxWidget.js +95 -0
  21. package/lib/components/RJSFPreview/PreviewCheckboxWidget.js.map +1 -0
  22. package/lib/components/RJSFPreview/PreviewCustomFieldTemplate.js +235 -0
  23. package/lib/components/RJSFPreview/PreviewCustomFieldTemplate.js.map +1 -0
  24. package/lib/components/RJSFPreview/PreviewDateWidget.js +178 -0
  25. package/lib/components/RJSFPreview/PreviewDateWidget.js.map +1 -0
  26. package/lib/components/RJSFPreview/PreviewDialog.js +21 -0
  27. package/lib/components/RJSFPreview/PreviewDialog.js.map +1 -0
  28. package/lib/components/RJSFPreview/PreviewDropdownWidget.js +66 -0
  29. package/lib/components/RJSFPreview/PreviewDropdownWidget.js.map +1 -0
  30. package/lib/components/RJSFPreview/PreviewFieldTemplate.js +69 -0
  31. package/lib/components/RJSFPreview/PreviewFieldTemplate.js.map +1 -0
  32. package/lib/components/RJSFPreview/PreviewFileUploadWidget.js +113 -0
  33. package/lib/components/RJSFPreview/PreviewFileUploadWidget.js.map +1 -0
  34. package/lib/components/RJSFPreview/PreviewFormRenderer.js +195 -0
  35. package/lib/components/RJSFPreview/PreviewFormRenderer.js.map +1 -0
  36. package/lib/components/RJSFPreview/PreviewImageUploadWidget.js +104 -0
  37. package/lib/components/RJSFPreview/PreviewImageUploadWidget.js.map +1 -0
  38. package/lib/components/RJSFPreview/PreviewInputWidget.js +70 -0
  39. package/lib/components/RJSFPreview/PreviewInputWidget.js.map +1 -0
  40. package/lib/components/RJSFPreview/PreviewObjectFieldTemplate.js +33 -0
  41. package/lib/components/RJSFPreview/PreviewObjectFieldTemplate.js.map +1 -0
  42. package/lib/components/RJSFPreview/PreviewRadioWidget.js +55 -0
  43. package/lib/components/RJSFPreview/PreviewRadioWidget.js.map +1 -0
  44. package/lib/components/RJSFPreview/PreviewStepper.js +40 -0
  45. package/lib/components/RJSFPreview/PreviewStepper.js.map +1 -0
  46. package/lib/components/RJSFPreview/PreviewSwitchWidget.js +75 -0
  47. package/lib/components/RJSFPreview/PreviewSwitchWidget.js.map +1 -0
  48. package/lib/components/RJSFPreview/PreviewTab.js +358 -0
  49. package/lib/components/RJSFPreview/PreviewTab.js.map +1 -0
  50. package/lib/components/RJSFPreview/PreviewTextareaWidget.js +45 -0
  51. package/lib/components/RJSFPreview/PreviewTextareaWidget.js.map +1 -0
  52. package/lib/components/RJSFPreview/generateSchemaWithInputs.js +134 -0
  53. package/lib/components/RJSFPreview/generateSchemaWithInputs.js.map +1 -0
  54. package/lib/components/RJSFPreview/index.d.ts +34 -0
  55. package/lib/components/RJSFPreview/index.d.ts.map +1 -1
  56. package/lib/components/RJSFPreview/index.js +1 -0
  57. package/lib/components/RJSFPreview/index.js.map +1 -0
  58. package/lib/components/index.d.ts.map +1 -1
  59. package/lib/index.js +1 -1
  60. package/lib/shardui/chart.d.ts +1 -1
  61. package/lib/shardui/resizable.d.ts +1 -1
  62. package/package.json +20 -5
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationErrorHandler.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorHandlers/ApplicationErrorHandler.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,uBAAuB,GAAI,UAAK,4CAG5C,CAAC"}
1
+ {"version":3,"file":"ApplicationErrorHandler.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorHandlers/ApplicationErrorHandler.tsx"],"names":[],"mappings":"AAqBA,eAAO,MAAM,uBAAuB,GAAI,UAAK,4CAG5C,CAAC"}
@@ -8,7 +8,11 @@ import {jsx}from'react/jsx-runtime';import {ApplicationErrorHandlerCommon}from'@
8
8
  duration: 9000
9
9
  });
10
10
  }
11
- logger.error('Application Backend Error', error?.payload.message);
11
+ // pino-style signature: the merging object must come first - a second
12
+ // positional arg without a printf placeholder is silently dropped.
13
+ logger.error({
14
+ payload: error?.payload
15
+ }, 'Application Backend Error');
12
16
  }, []);
13
17
  return null;
14
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationErrorHandler.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ApplicationErrorHandler.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,19 @@
1
+ export declare function isManifestVersionMismatchError(error: unknown): error is Error;
2
+ /**
3
+ * The reload Remix started commits as soon as the new document's headers arrive.
4
+ * If it has not by then (assignment dropped, blocked, or never started), force one -
5
+ * once - so nobody is left sitting on the reloading screen.
6
+ */
7
+ export declare const MANIFEST_RELOAD_FALLBACK_MS = 5000;
1
8
  /**
2
9
  * Remix Route ErrorBoundary Component
3
10
  * This is specifically for Remix route errors (404s, loader errors, etc.)
4
11
  * Different from React's ErrorBoundary which handles component errors
5
12
  *
13
+ * A manifest version mismatch (the browser is on an older build than the server)
14
+ * is not presented as an error: Remix has already started a document reload, so the
15
+ * boundary shows a reloading screen and forces the reload if it does not commit.
16
+ *
6
17
  * Uses inline styles as fallback to ensure the error page renders correctly
7
18
  * even when Tailwind CSS fails to load or during hydration error recovery.
8
19
  *
@@ -1 +1 @@
1
- {"version":3,"file":"RemixErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorHandlers/RemixErrorBoundary.tsx"],"names":[],"mappings":"AA6CA;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,4CA2KjC"}
1
+ {"version":3,"file":"RemixErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorHandlers/RemixErrorBoundary.tsx"],"names":[],"mappings":"AAwEA,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAE7E;AAED;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,OAAO,CAAC;AA+DhD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,4CA6LjC"}
@@ -35,11 +35,122 @@ const buttonStyle = {
35
35
  border: 'none',
36
36
  cursor: 'pointer'
37
37
  };
38
+ const spinnerStyle = {
39
+ width: '2.5rem',
40
+ height: '2.5rem',
41
+ color: '#2563eb',
42
+ animation: 'remix-error-boundary-spin 1s linear infinite'
43
+ };
44
+ const linkButtonStyle = {
45
+ background: 'none',
46
+ border: 'none',
47
+ padding: 0,
48
+ cursor: 'pointer',
49
+ fontSize: '0.875rem',
50
+ fontWeight: 500,
51
+ color: '#2563eb'
52
+ };
53
+ /**
54
+ * Thrown by Remix's lazy route discovery (`@remix-run/react` fog-of-war) when the
55
+ * browser hydrated on a previous build and the server now runs a newer one: the
56
+ * `/__manifest` call answers 204 + `X-Remix-Reload-Document`, Remix assigns
57
+ * `window.location.href` to the destination and then throws so the client-side
58
+ * navigation aborts. The reload is already in flight when this boundary renders,
59
+ * so it is a "please wait" state, not an application error.
60
+ */
61
+ const MANIFEST_VERSION_MISMATCH = /manifest version mismatch/i;
62
+ function isManifestVersionMismatchError(error) {
63
+ return error instanceof Error && MANIFEST_VERSION_MISMATCH.test(error.message);
64
+ }
65
+ /**
66
+ * The reload Remix started commits as soon as the new document's headers arrive.
67
+ * If it has not by then (assignment dropped, blocked, or never started), force one -
68
+ * once - so nobody is left sitting on the reloading screen.
69
+ */
70
+ const MANIFEST_RELOAD_FALLBACK_MS = 5000;
71
+ function NewBuildReloadScreen() {
72
+ return jsxs("div", {
73
+ className: "flex min-h-screen items-center justify-center bg-gray-50 px-4 py-12 sm:px-6 lg:px-8",
74
+ style: containerStyle,
75
+ role: "status",
76
+ "aria-live": "polite",
77
+ children: [jsx("style", {
78
+ children: '@keyframes remix-error-boundary-spin{to{transform:rotate(360deg)}}'
79
+ }), jsxs("div", {
80
+ className: "w-full max-w-md text-center",
81
+ style: {
82
+ maxWidth: '28rem',
83
+ width: '100%',
84
+ textAlign: 'center'
85
+ },
86
+ children: [jsx("div", {
87
+ className: "mb-4 flex justify-center",
88
+ style: {
89
+ display: 'flex',
90
+ justifyContent: 'center',
91
+ marginBottom: '1rem'
92
+ },
93
+ children: jsxs("svg", {
94
+ className: "h-10 w-10 text-blue-600",
95
+ style: spinnerStyle,
96
+ viewBox: "0 0 24 24",
97
+ fill: "none",
98
+ "aria-hidden": "true",
99
+ children: [jsx("circle", {
100
+ cx: "12",
101
+ cy: "12",
102
+ r: "10",
103
+ stroke: "currentColor",
104
+ strokeOpacity: "0.2",
105
+ strokeWidth: "3"
106
+ }), jsx("path", {
107
+ d: "M22 12a10 10 0 0 0-10-10",
108
+ stroke: "currentColor",
109
+ strokeWidth: "3",
110
+ strokeLinecap: "round"
111
+ })]
112
+ })
113
+ }), jsx("h1", {
114
+ className: "text-2xl font-bold tracking-tight text-gray-900",
115
+ style: {
116
+ fontSize: '1.5rem',
117
+ fontWeight: 700,
118
+ color: '#111827'
119
+ },
120
+ children: "Updating to the latest version"
121
+ }), jsx("p", {
122
+ className: "mt-2 text-base text-gray-600",
123
+ style: {
124
+ marginTop: '0.5rem',
125
+ fontSize: '1rem',
126
+ color: '#4b5563'
127
+ },
128
+ children: "A new version was just released. This page will reload automatically."
129
+ }), jsx("div", {
130
+ className: "mt-6",
131
+ style: {
132
+ marginTop: '1.5rem'
133
+ },
134
+ children: jsx("button", {
135
+ type: "button",
136
+ onClick: () => window.location.reload(),
137
+ className: "text-sm font-medium text-blue-600 hover:text-blue-700",
138
+ style: linkButtonStyle,
139
+ children: "Reload now"
140
+ })
141
+ })]
142
+ })]
143
+ });
144
+ }
38
145
  /**
39
146
  * Remix Route ErrorBoundary Component
40
147
  * This is specifically for Remix route errors (404s, loader errors, etc.)
41
148
  * Different from React's ErrorBoundary which handles component errors
42
149
  *
150
+ * A manifest version mismatch (the browser is on an older build than the server)
151
+ * is not presented as an error: Remix has already started a document reload, so the
152
+ * boundary shows a reloading screen and forces the reload if it does not commit.
153
+ *
43
154
  * Uses inline styles as fallback to ensure the error page renders correctly
44
155
  * even when Tailwind CSS fails to load or during hydration error recovery.
45
156
  *
@@ -48,14 +159,34 @@ const buttonStyle = {
48
159
  */
49
160
  function RemixErrorBoundary() {
50
161
  const error = useRouteError();
162
+ const isNewBuild = isManifestVersionMismatchError(error);
51
163
  React.useEffect(() => {
52
- logger.error('Route Error:', error);
164
+ if (isNewBuild) {
165
+ logger.info({
166
+ err: error
167
+ }, 'Newer build detected during navigation; reloading');
168
+ return;
169
+ }
170
+ // pino-style signature: the merging object must come first - a second
171
+ // positional arg without a printf placeholder is silently dropped, which
172
+ // left every route crash logged as a bare 'Route Error:' with no payload.
173
+ logger.error({
174
+ err: error
175
+ }, 'Route Error');
53
176
  console.error('Route Error:', error);
54
- }, [error]);
177
+ }, [error, isNewBuild]);
178
+ React.useEffect(() => {
179
+ if (!isNewBuild) return undefined;
180
+ const timer = window.setTimeout(() => window.location.reload(), MANIFEST_RELOAD_FALLBACK_MS);
181
+ return () => window.clearTimeout(timer);
182
+ }, [isNewBuild]);
55
183
  const handleGoHome = () => {
56
184
  // Use direct location change instead of useNavigate to avoid router context issues
57
185
  window.location.href = '/';
58
186
  };
187
+ if (isNewBuild) {
188
+ return jsx(NewBuildReloadScreen, {});
189
+ }
59
190
  if (isRouteErrorResponse(error)) {
60
191
  return jsx("div", {
61
192
  className: "flex min-h-screen items-center justify-center bg-gray-50 px-4 py-12 sm:px-6 lg:px-8",
@@ -238,4 +369,4 @@ function RemixErrorBoundary() {
238
369
  })]
239
370
  })
240
371
  });
241
- }export{RemixErrorBoundary};//# sourceMappingURL=RemixErrorBoundary.js.map
372
+ }export{MANIFEST_RELOAD_FALLBACK_MS,RemixErrorBoundary,isManifestVersionMismatchError};//# sourceMappingURL=RemixErrorBoundary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RemixErrorBoundary.js","sources":["../../../src/components/ErrorHandlers/RemixErrorBoundary.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAuDG,EAAA,eAAA,EAAA,SAAA;AACH,EAAA,OAAA,EAAA,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"RemixErrorBoundary.js","sources":["../../../src/components/ErrorHandlers/RemixErrorBoundary.tsx"],"sourcesContent":[null],"names":[],"mappings":";AAgFG,MAAA,cAAA,GAAA;AACH,EAAA,OAAA,EAAA,MAAO;AA+DP,EAAA,SAAA,EAAA,OAAA;;;;;;;;;;;;;;AAcG,EAAA,eAAA,EAAA,SAAA;AACH,EAAA,UAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SPAErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorHandlers/SPAErrorBoundary.tsx"],"names":[],"mappings":"AA6CA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,4CA8M/B"}
1
+ {"version":3,"file":"SPAErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorHandlers/SPAErrorBoundary.tsx"],"names":[],"mappings":"AA6CA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,4CAgN/B"}
@@ -56,7 +56,11 @@ const buttonStyle = {
56
56
  function SPAErrorBoundary() {
57
57
  const error = useRouteError();
58
58
  React.useEffect(() => {
59
- logger.error('Root Route Error:', error);
59
+ // pino-style signature: the merging object must come first - a second
60
+ // positional arg without a printf placeholder is silently dropped.
61
+ logger.error({
62
+ err: error
63
+ }, 'Root Route Error');
60
64
  console.error('Root Route Error:', error);
61
65
  }, [error]);
62
66
  const handleGoHome = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"SPAErrorBoundary.js","sources":["../../../src/components/ErrorHandlers/SPAErrorBoundary.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;AA8DG,EAAA,MAAA,EAAA,MAAA;AACH,EAAA,UAAA,EAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"SPAErrorBoundary.js","sources":["../../../src/components/ErrorHandlers/SPAErrorBoundary.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;AA8DG,EAAA,MAAA,EAAA,MAAA;AACH,EAAA,UAAA,EAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RemixErrorBoundary.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RemixErrorBoundary.test.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorHandlers/__tests__/RemixErrorBoundary.test.tsx"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"InputToolBar.d.ts","sourceRoot":"","sources":["../../../src/components/InputToolBar/InputToolBar.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAER,iBAAiB,EAQpB,MAAM,SAAS,CAAC;AAihBjB;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EACzB,SAAS,EACT,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,cAAc,EAC1B,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,gBAAgB,GACnB,EAAE,iBAAiB,2CAwFnB;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"InputToolBar.d.ts","sourceRoot":"","sources":["../../../src/components/InputToolBar/InputToolBar.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAER,iBAAiB,EAQpB,MAAM,SAAS,CAAC;AAqhBjB;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EACzB,SAAS,EACT,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,cAAc,EAC1B,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,gBAAgB,GACnB,EAAE,iBAAiB,2CAwFnB;AAED,eAAe,YAAY,CAAC"}
@@ -1,4 +1,4 @@
1
- import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {Lightbulb,Zap,Search,Mic,Paperclip,Image,Camera,WandSparkles,Settings,X,Layout,Check,Plus,StopCircle,ArrowUpRight}from'lucide-react';import React__default,{useState,useMemo}from'react';import'../../utils/isBrowser/index.js';import {cn}from'../../utils/util.js';import'fast-deep-equal/react.js';const iconSize = 'h-3.5 w-3.5';
1
+ import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {Lightbulb,Zap,Search,Mic,Paperclip,Image,Camera,WandSparkles,Settings,X,Layout,Check,Plus,ArrowUpRight,StopCircle}from'lucide-react';import React__default,{useState,useMemo}from'react';import'../../utils/isBrowser/index.js';import {cn}from'../../utils/util.js';import'fast-deep-equal/react.js';const iconSize = 'h-3.5 w-3.5';
2
2
  const iconSizeRight = 'h-4 w-4';
3
3
  const defaultLeftIconMap = {
4
4
  search: jsx(Search, {
@@ -70,6 +70,9 @@ const defaultRightIconMap = {
70
70
  className: iconSizeRight
71
71
  })
72
72
  };
73
+ /** Stop while loading, otherwise Send (content) or Mic. With `steerable` the Send/Mic button stays
74
+ * mounted to the left of Stop so another turn can be queued mid-response — Stop owns the rightmost
75
+ * slot whenever it is shown, since stopping is the primary action mid-response. */
73
76
  function MicSendButton({
74
77
  hasContent,
75
78
  onSend,
@@ -77,27 +80,38 @@ function MicSendButton({
77
80
  disabled,
78
81
  isLoading,
79
82
  onStop,
83
+ steerable,
80
84
  className
81
85
  }) {
82
86
  const isStop = isLoading === true;
83
- const isSend = !isStop && hasContent;
84
- const base = 'inline-flex h-7 w-7 items-center justify-center rounded-2xl transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary border border-primary';
85
- const handleClick = isStop ? onStop : isSend ? onSend : onMic;
86
- const label = isStop ? 'Stop' : isSend ? 'Send' : 'Start voice input';
87
- return jsx("button", {
88
- type: "button",
89
- "aria-label": label,
90
- title: label,
91
- onClick: handleClick,
92
- disabled: disabled && !isStop,
93
- className: cn(base, className),
94
- children: isStop ? jsx(StopCircle, {
95
- className: iconSizeRight
96
- }) : isSend ? jsx(ArrowUpRight, {
97
- className: iconSizeRight
98
- }) : jsx(Mic, {
99
- className: iconSizeRight
100
- })
87
+ const shell = 'inline-flex h-7 w-7 items-center justify-center rounded-2xl transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none';
88
+ const filled = 'bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary border border-primary';
89
+ // Paired with Stop, Send/Mic steps back to a quiet variant so the two do not compete as primary.
90
+ const quiet = 'bg-secondary/70 text-foreground hover:bg-secondary active:bg-secondary border border-border';
91
+ const sendLabel = hasContent ? 'Send' : 'Start voice input';
92
+ return jsxs(Fragment, {
93
+ children: [(!isStop || steerable === true) && jsx("button", {
94
+ type: "button",
95
+ "aria-label": sendLabel,
96
+ title: sendLabel,
97
+ onClick: hasContent ? onSend : onMic,
98
+ disabled: disabled,
99
+ className: cn(shell, isStop ? quiet : filled, className),
100
+ children: hasContent ? jsx(ArrowUpRight, {
101
+ className: iconSizeRight
102
+ }) : jsx(Mic, {
103
+ className: iconSizeRight
104
+ })
105
+ }), isStop && jsx("button", {
106
+ type: "button",
107
+ "aria-label": "Stop",
108
+ title: "Stop",
109
+ onClick: onStop,
110
+ className: cn(shell, filled, className),
111
+ children: jsx(StopCircle, {
112
+ className: iconSizeRight
113
+ })
114
+ })]
101
115
  });
102
116
  }
103
117
  function ToolbarIconButton({
@@ -308,12 +322,7 @@ function RightSection({
308
322
  })
309
323
  })]
310
324
  }), micSendButton != null && jsx(MicSendButton, {
311
- hasContent: micSendButton.hasContent,
312
- onSend: micSendButton.onSend,
313
- onMic: micSendButton.onMic,
314
- disabled: micSendButton.disabled,
315
- isLoading: micSendButton.isLoading,
316
- onStop: micSendButton.onStop,
325
+ ...micSendButton,
317
326
  className: classNames?.micSendButton
318
327
  })]
319
328
  });
@@ -1 +1 @@
1
- {"version":3,"file":"InputToolBar.js","sources":["../../../src/components/InputToolBar/InputToolBar.tsx"],"sourcesContent":[null],"names":[],"mappings":"gWAijBG,MAAA,QAAA,GAAA,aAAA;AACH,MAAA,aAAA,GAAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -49,6 +49,8 @@ export interface MicSendButtonConfig {
49
49
  /** When true, show stop icon and call onStop on click. */
50
50
  isLoading?: boolean;
51
51
  onStop?: () => void;
52
+ /** Host supports steering (sending mid-response): keep Send/Mic beside Stop instead of replacing it. */
53
+ steerable?: boolean;
52
54
  }
53
55
  /** Configuration for the optional template pill: either "+ Template (N)" or selected template name with remove/change */
54
56
  export interface TemplateButtonConfig {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/InputToolBar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,qHAAqH;AACrH,MAAM,WAAW,WAAW;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAClE,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IACjE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,mBAAmB,GAAG,IA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;IAC9B,oFAAoF;IACpF,aAAa,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC3C,uIAAuI;IACvI,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,gGAAgG;IAChG,2BAA2B,CAAC,EAAE,MAAM,IAAI,CAAC;IACzC,wMAAwM;IACxM,0BAA0B,CAAC,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAC/D,gEAAgE;IAChE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,+CAA+C;IAC/C,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CACpD"}
@@ -0,0 +1,111 @@
1
+ import {jsxs,jsx}from'react/jsx-runtime';import {useState,useCallback,useEffect}from'react';const PreviewAsyncDropdown = props => {
2
+ const {
3
+ id,
4
+ placeholder,
5
+ disabled,
6
+ readonly,
7
+ autofocus,
8
+ options,
9
+ value,
10
+ onChange,
11
+ onBlur,
12
+ onFocus,
13
+ uiSchema,
14
+ multiple = false,
15
+ schema,
16
+ required,
17
+ rawErrors
18
+ } = props;
19
+ console.log('we are here', props);
20
+ const isMultiple = multiple || schema.type === 'array';
21
+ const [loading, setLoading] = useState(false);
22
+ const [dropdownOptions, setDropdownOptions] = useState([]);
23
+ const loadOptions = useCallback(async () => {
24
+ console.log('loadOptions', uiSchema, schema);
25
+ const asyncFuncStr = options?.loadOptionsFunc || schema?.loadOptionsFunc;
26
+ if (!asyncFuncStr) return;
27
+ console.log('asyncFuncStr', asyncFuncStr);
28
+ try {
29
+ setLoading(true);
30
+ const dummyResults = await new Promise(resolve => {
31
+ setTimeout(() => {
32
+ resolve([{
33
+ label: 'Async Option 1',
34
+ value: 'async_1'
35
+ }, {
36
+ label: 'Async Option 2',
37
+ value: 'async_2'
38
+ }, {
39
+ label: 'Async Option 3',
40
+ value: 'async_3'
41
+ }, {
42
+ label: 'Dynamic Choice A',
43
+ value: 'dynamic_a'
44
+ }, {
45
+ label: 'Dynamic Choice B',
46
+ value: 'dynamic_b'
47
+ }]);
48
+ }, 1000);
49
+ });
50
+ setDropdownOptions(dummyResults);
51
+ } catch (error) {
52
+ console.error('Error loading async dropdown options:', error);
53
+ } finally {
54
+ setLoading(false);
55
+ }
56
+ }, [uiSchema, schema]);
57
+ useEffect(() => {
58
+ loadOptions();
59
+ }, [loadOptions]);
60
+ useEffect(() => {
61
+ if (options?.enumOptions && !options?.loadOptionsFunc) {
62
+ const enumOptions = options.enumOptions.map(option => ({
63
+ label: option.label,
64
+ value: option.value
65
+ }));
66
+ setDropdownOptions(enumOptions);
67
+ }
68
+ }, [options, uiSchema]);
69
+ const handleChange = e => {
70
+ const selectedValue = e.target.value;
71
+ onChange(selectedValue);
72
+ };
73
+ return jsxs("div", {
74
+ className: "space-y-3",
75
+ children: [jsxs("div", {
76
+ className: "block text-base font-semibold text-gray-800 mb-1",
77
+ children: [schema?.title, required && jsx("span", {
78
+ className: "text-red-500 ml-1",
79
+ children: "*"
80
+ })]
81
+ }), jsxs("div", {
82
+ className: "relative",
83
+ children: [jsxs("select", {
84
+ id: id,
85
+ value: value || '',
86
+ disabled: disabled || readonly,
87
+ autoFocus: autofocus,
88
+ onChange: handleChange,
89
+ onBlur: onBlur && (() => onBlur(id, value)),
90
+ onFocus: onFocus && (() => onFocus(id, value)),
91
+ className: `w-full px-3 pb-2 rounded-md focus:outline-none focus:ring-2 disabled:opacity-50 disabled:cursor-not-allowed text-sm ${rawErrors && rawErrors.length > 0 ? 'border-2 border-red-500 focus:border-red-500 focus:ring-red-500' : 'border border-gray-300 focus:border-blue-500 focus:ring-blue-500'}`,
92
+ multiple: isMultiple,
93
+ children: [jsx("option", {
94
+ value: "",
95
+ children: placeholder || 'Select an option...'
96
+ }), dropdownOptions.map((option, index) => jsx("option", {
97
+ value: String(option.value),
98
+ children: String(option.label)
99
+ }, index))]
100
+ }), loading && jsx("div", {
101
+ className: "absolute right-3 top-1/2 transform -translate-y-1/2",
102
+ children: jsx("div", {
103
+ className: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"
104
+ })
105
+ })]
106
+ }), rawErrors && rawErrors.length > 0 && jsx("p", {
107
+ className: "mt-1 text-sm text-red-500",
108
+ children: rawErrors[0]
109
+ })]
110
+ });
111
+ };export{PreviewAsyncDropdown as default};//# sourceMappingURL=PreviewAsyncDropdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewAsyncDropdown.js","sources":["../../../src/components/RJSFPreview/PreviewAsyncDropdown.tsx"],"sourcesContent":[null],"names":[],"mappings":"4FAII,MAAA,oBAAmB,GAAA,KAAA,IAAA;AACnB,EAAA,MAAA;AACI,IAAA,EAAA;AACA,IAAA,WAAA;YACF;AACL,IAAA,QAAA;AAOD,IAAA;AA+GA,IAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,95 @@
1
+ import {jsxs,jsx}from'react/jsx-runtime';const PreviewCheckboxWidget = ({
2
+ id,
3
+ value,
4
+ required,
5
+ disabled,
6
+ readonly,
7
+ onChange,
8
+ label,
9
+ placeholder,
10
+ schema,
11
+ options,
12
+ rawErrors
13
+ }) => {
14
+ const isBooleanCheckbox = schema?.type === 'boolean';
15
+ const isArrayCheckbox = schema?.type === 'array';
16
+ if (isBooleanCheckbox) {
17
+ const handleBooleanChange = event => {
18
+ onChange(event.target.checked);
19
+ };
20
+ const displayLabel = placeholder || schema?.placeholder || label || schema?.title || 'Checkbox';
21
+ return jsxs("div", {
22
+ className: "space-y-2",
23
+ children: [jsxs("div", {
24
+ className: "flex items-start space-x-3",
25
+ children: [jsx("input", {
26
+ id: id,
27
+ type: "checkbox",
28
+ checked: value || false,
29
+ onChange: handleBooleanChange,
30
+ disabled: disabled || readonly,
31
+ className: `mt-1 h-4 w-4 text-blue-600 rounded focus:ring-blue-500 focus:ring-2 disabled:opacity-50 disabled:cursor-not-allowed ${rawErrors && rawErrors.length > 0 ? 'border-2 border-red-500' : 'border border-gray-300'}`
32
+ }), jsx("label", {
33
+ htmlFor: id,
34
+ className: `text-sm text-gray-700 ${disabled || readonly ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}`,
35
+ children: displayLabel
36
+ })]
37
+ }), rawErrors && rawErrors.length > 0 && jsx("p", {
38
+ className: "mt-1 text-sm text-red-500",
39
+ children: rawErrors[0]
40
+ })]
41
+ });
42
+ }
43
+ if (isArrayCheckbox) {
44
+ const handleArrayChange = (optionValue, checked) => {
45
+ const currentValues = Array.isArray(value) ? value : [];
46
+ let newValues;
47
+ if (checked) {
48
+ newValues = currentValues.includes(optionValue) ? currentValues : [...currentValues, optionValue];
49
+ } else {
50
+ newValues = currentValues.filter(v => v !== optionValue);
51
+ }
52
+ onChange(newValues);
53
+ };
54
+ const checkboxOptions = Array.isArray(options?.enumOptions) ? options.enumOptions : Array.isArray(schema?.items?.oneOf) ? (schema?.items?.oneOf || []).map(option => ({
55
+ value: option.const || option.value || option,
56
+ label: option.title || option.label || option.const || option
57
+ })) : Array.isArray(schema?.items?.enum) ? (schema?.items?.enum || []).map(option => ({
58
+ value: option,
59
+ label: option
60
+ })) : [];
61
+ const currentValues = Array.isArray(value) ? value : [];
62
+ schema?.title || label || 'Select Options';
63
+ return jsxs("div", {
64
+ className: "space-y-2",
65
+ children: [checkboxOptions.map((option, index) => {
66
+ const optionValue = option.value !== undefined ? option.value : option;
67
+ const optionLabel = option.label !== undefined ? option.label : option;
68
+ const checkboxId = `${id}-${index}`;
69
+ const isChecked = currentValues.includes(optionValue);
70
+ return jsxs("div", {
71
+ className: "flex items-center space-x-3",
72
+ children: [jsx("input", {
73
+ id: checkboxId,
74
+ type: "checkbox",
75
+ checked: isChecked,
76
+ onChange: e => handleArrayChange(optionValue, e.target.checked),
77
+ disabled: disabled || readonly,
78
+ className: `h-4 w-4 text-blue-600 rounded focus:ring-blue-500 focus:ring-2 disabled:opacity-50 disabled:cursor-not-allowed ${rawErrors && rawErrors.length > 0 ? 'border-2 border-red-500' : 'border border-gray-300'}`
79
+ }), jsx("label", {
80
+ htmlFor: checkboxId,
81
+ className: `text-sm text-gray-700 ${disabled || readonly ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}`,
82
+ children: String(optionLabel)
83
+ })]
84
+ }, index);
85
+ }), rawErrors && rawErrors.length > 0 && jsx("p", {
86
+ className: "mt-1 text-sm text-red-500",
87
+ children: rawErrors[0]
88
+ })]
89
+ });
90
+ }
91
+ return jsxs("div", {
92
+ className: "text-red-500 text-sm",
93
+ children: ["Unsupported checkbox schema type: ", schema?.type]
94
+ });
95
+ };export{PreviewCheckboxWidget};//# sourceMappingURL=PreviewCheckboxWidget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewCheckboxWidget.js","sources":["../../../src/components/RJSFPreview/PreviewCheckboxWidget.tsx"],"sourcesContent":[null],"names":[],"mappings":"yCACS,MAAA;AAET,EAAA,EAAA;OACI;AACH,EAAA,QAAA;AAED,EAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}