@dgithiomi/sbui-web 1.0.0 → 1.0.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.
- package/README.md +320 -0
- package/dist/{chunk-3QS3WKRC.mjs → chunk-LZOMFHX3.mjs} +9 -2
- package/dist/index.cjs +9225 -329
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +87 -2
- package/dist/index.d.ts +87 -2
- package/dist/index.mjs +9219 -327
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +64 -0
- package/dist/tailwind-preset.mjs +1 -1
- package/package.json +3 -3
- /package/dist/{chunk-3QS3WKRC.mjs.map → chunk-LZOMFHX3.mjs.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React, { ReactNode, RefObject, TextareaHTMLAttributes, FocusEvent } from 'react';
|
|
1
|
+
import React, { ReactNode, RefObject, TextareaHTMLAttributes, FocusEvent, PropsWithChildren } from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
type TooltipAnimation = "fade" | "scale" | "none";
|
|
4
5
|
type TooltipPointerDirection = "left" | "right" | "center";
|
|
@@ -222,4 +223,88 @@ type ProgressBarProps = {
|
|
|
222
223
|
|
|
223
224
|
declare const ProgressBar: React.FC<ProgressBarProps>;
|
|
224
225
|
|
|
225
|
-
|
|
226
|
+
/**
|
|
227
|
+
* The duration that a toast notification should be visible.
|
|
228
|
+
* - "short": Typically a brief delay (e.g., 2-3 seconds).
|
|
229
|
+
* - "long": A longer delay (e.g., 5-6 seconds).
|
|
230
|
+
*/
|
|
231
|
+
type ToastDuration = "short" | "long";
|
|
232
|
+
/**
|
|
233
|
+
* Visual style variants for the toast notification.
|
|
234
|
+
* - "success": Indicates a successful or positive action.
|
|
235
|
+
* - "error": Indicates an error or negative action.
|
|
236
|
+
* - "warning": Indicates a warning or potentially problematic action.
|
|
237
|
+
* - "info": Provides informational feedback to the user.
|
|
238
|
+
*/
|
|
239
|
+
type ToastVariant = "success" | "error" | "warning" | "info";
|
|
240
|
+
/**
|
|
241
|
+
* Interface describing the visual properties for a particular toast variant.
|
|
242
|
+
* Used to customize the appearance according to the variant type.
|
|
243
|
+
*/
|
|
244
|
+
interface ToastVariantProps {
|
|
245
|
+
/** The icon to display, based on the variant. */
|
|
246
|
+
icon: ReactNode;
|
|
247
|
+
/** The text color to use for toast content. */
|
|
248
|
+
textColor: string;
|
|
249
|
+
/** The background color for the icon container. */
|
|
250
|
+
iconBackground: string;
|
|
251
|
+
/** The background color of the toast itself. */
|
|
252
|
+
backgroundColor: string;
|
|
253
|
+
/** The color used for the content within the toast (may differ from general text color). */
|
|
254
|
+
toastContentColor: string;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Core properties for a toast notification.
|
|
258
|
+
* Used when displaying or creating a toast within the UI.
|
|
259
|
+
*/
|
|
260
|
+
interface ToastProps {
|
|
261
|
+
/** Optional title to display above the message. */
|
|
262
|
+
title?: string;
|
|
263
|
+
/** The main message to display in the toast (required). */
|
|
264
|
+
message: string;
|
|
265
|
+
/** The variant determines the toast's styling and icon. */
|
|
266
|
+
variant: ToastVariant;
|
|
267
|
+
/** How long the toast should remain visible. If not provided, defaults may be used. */
|
|
268
|
+
duration?: ToastDuration;
|
|
269
|
+
/** Function called when the toast is closed or dismissed. */
|
|
270
|
+
onClose?: () => void;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Internal representation of a toast, typically managed by the toast system.
|
|
274
|
+
* Extends ToastProps with a unique identifier for handling toast instances.
|
|
275
|
+
*/
|
|
276
|
+
interface ToastInternal extends ToastProps {
|
|
277
|
+
/** Unique identifier for the toast instance (used internally for management). */
|
|
278
|
+
toastUUID: string;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* The context shape for the Toast provider, enabling components to trigger toasts.
|
|
282
|
+
* Exposes the showToast method, which accepts toast properties except an "id".
|
|
283
|
+
*/
|
|
284
|
+
interface ToastContextType {
|
|
285
|
+
/**
|
|
286
|
+
* Show a new toast.
|
|
287
|
+
* @param toast - An object specifying the toast's properties.
|
|
288
|
+
*/
|
|
289
|
+
showToast: (toast: ToastProps) => void;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
declare const Toast: React.FC<ToastProps>;
|
|
293
|
+
|
|
294
|
+
declare const ToastContext: React.Context<ToastContextType | null>;
|
|
295
|
+
declare const ToastProvider: React.FC<{
|
|
296
|
+
children: ReactNode;
|
|
297
|
+
}>;
|
|
298
|
+
|
|
299
|
+
declare function useToast(): ToastContextType;
|
|
300
|
+
|
|
301
|
+
interface SbuiProviderProps extends PropsWithChildren {
|
|
302
|
+
/**
|
|
303
|
+
* Keep this provider extensible: feature providers can be toggled here
|
|
304
|
+
* as the library grows without forcing consumer-level wrapper churn.
|
|
305
|
+
*/
|
|
306
|
+
enableToastProvider?: boolean;
|
|
307
|
+
}
|
|
308
|
+
declare const SbuiProvider: ({ children, enableToastProvider, }: SbuiProviderProps) => react_jsx_runtime.JSX.Element;
|
|
309
|
+
|
|
310
|
+
export { ProgressBar, type ProgressBarProps, SbuiProvider, type SbuiProviderProps, TextArea, type TextAreaProps, type TextAreaResize, type TextAreaSize, type TextAreaStatus, Toast, ToastContext, type ToastContextType, type ToastDuration, type ToastInternal, type ToastProps, ToastProvider, type ToastVariant, type ToastVariantProps, Tooltip, type TooltipAnimation, type TooltipPlacement, type TooltipPointerDirection, type TooltipProps, type TooltipTrigger, type TooltipVariant, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React, { ReactNode, RefObject, TextareaHTMLAttributes, FocusEvent } from 'react';
|
|
1
|
+
import React, { ReactNode, RefObject, TextareaHTMLAttributes, FocusEvent, PropsWithChildren } from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
type TooltipAnimation = "fade" | "scale" | "none";
|
|
4
5
|
type TooltipPointerDirection = "left" | "right" | "center";
|
|
@@ -222,4 +223,88 @@ type ProgressBarProps = {
|
|
|
222
223
|
|
|
223
224
|
declare const ProgressBar: React.FC<ProgressBarProps>;
|
|
224
225
|
|
|
225
|
-
|
|
226
|
+
/**
|
|
227
|
+
* The duration that a toast notification should be visible.
|
|
228
|
+
* - "short": Typically a brief delay (e.g., 2-3 seconds).
|
|
229
|
+
* - "long": A longer delay (e.g., 5-6 seconds).
|
|
230
|
+
*/
|
|
231
|
+
type ToastDuration = "short" | "long";
|
|
232
|
+
/**
|
|
233
|
+
* Visual style variants for the toast notification.
|
|
234
|
+
* - "success": Indicates a successful or positive action.
|
|
235
|
+
* - "error": Indicates an error or negative action.
|
|
236
|
+
* - "warning": Indicates a warning or potentially problematic action.
|
|
237
|
+
* - "info": Provides informational feedback to the user.
|
|
238
|
+
*/
|
|
239
|
+
type ToastVariant = "success" | "error" | "warning" | "info";
|
|
240
|
+
/**
|
|
241
|
+
* Interface describing the visual properties for a particular toast variant.
|
|
242
|
+
* Used to customize the appearance according to the variant type.
|
|
243
|
+
*/
|
|
244
|
+
interface ToastVariantProps {
|
|
245
|
+
/** The icon to display, based on the variant. */
|
|
246
|
+
icon: ReactNode;
|
|
247
|
+
/** The text color to use for toast content. */
|
|
248
|
+
textColor: string;
|
|
249
|
+
/** The background color for the icon container. */
|
|
250
|
+
iconBackground: string;
|
|
251
|
+
/** The background color of the toast itself. */
|
|
252
|
+
backgroundColor: string;
|
|
253
|
+
/** The color used for the content within the toast (may differ from general text color). */
|
|
254
|
+
toastContentColor: string;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Core properties for a toast notification.
|
|
258
|
+
* Used when displaying or creating a toast within the UI.
|
|
259
|
+
*/
|
|
260
|
+
interface ToastProps {
|
|
261
|
+
/** Optional title to display above the message. */
|
|
262
|
+
title?: string;
|
|
263
|
+
/** The main message to display in the toast (required). */
|
|
264
|
+
message: string;
|
|
265
|
+
/** The variant determines the toast's styling and icon. */
|
|
266
|
+
variant: ToastVariant;
|
|
267
|
+
/** How long the toast should remain visible. If not provided, defaults may be used. */
|
|
268
|
+
duration?: ToastDuration;
|
|
269
|
+
/** Function called when the toast is closed or dismissed. */
|
|
270
|
+
onClose?: () => void;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Internal representation of a toast, typically managed by the toast system.
|
|
274
|
+
* Extends ToastProps with a unique identifier for handling toast instances.
|
|
275
|
+
*/
|
|
276
|
+
interface ToastInternal extends ToastProps {
|
|
277
|
+
/** Unique identifier for the toast instance (used internally for management). */
|
|
278
|
+
toastUUID: string;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* The context shape for the Toast provider, enabling components to trigger toasts.
|
|
282
|
+
* Exposes the showToast method, which accepts toast properties except an "id".
|
|
283
|
+
*/
|
|
284
|
+
interface ToastContextType {
|
|
285
|
+
/**
|
|
286
|
+
* Show a new toast.
|
|
287
|
+
* @param toast - An object specifying the toast's properties.
|
|
288
|
+
*/
|
|
289
|
+
showToast: (toast: ToastProps) => void;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
declare const Toast: React.FC<ToastProps>;
|
|
293
|
+
|
|
294
|
+
declare const ToastContext: React.Context<ToastContextType | null>;
|
|
295
|
+
declare const ToastProvider: React.FC<{
|
|
296
|
+
children: ReactNode;
|
|
297
|
+
}>;
|
|
298
|
+
|
|
299
|
+
declare function useToast(): ToastContextType;
|
|
300
|
+
|
|
301
|
+
interface SbuiProviderProps extends PropsWithChildren {
|
|
302
|
+
/**
|
|
303
|
+
* Keep this provider extensible: feature providers can be toggled here
|
|
304
|
+
* as the library grows without forcing consumer-level wrapper churn.
|
|
305
|
+
*/
|
|
306
|
+
enableToastProvider?: boolean;
|
|
307
|
+
}
|
|
308
|
+
declare const SbuiProvider: ({ children, enableToastProvider, }: SbuiProviderProps) => react_jsx_runtime.JSX.Element;
|
|
309
|
+
|
|
310
|
+
export { ProgressBar, type ProgressBarProps, SbuiProvider, type SbuiProviderProps, TextArea, type TextAreaProps, type TextAreaResize, type TextAreaSize, type TextAreaStatus, Toast, ToastContext, type ToastContextType, type ToastDuration, type ToastInternal, type ToastProps, ToastProvider, type ToastVariant, type ToastVariantProps, Tooltip, type TooltipAnimation, type TooltipPlacement, type TooltipPointerDirection, type TooltipProps, type TooltipTrigger, type TooltipVariant, useToast };
|