@sudobility/components 4.0.91 → 4.0.92

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.
@@ -0,0 +1,101 @@
1
+ import { default as React } from 'react';
2
+ import { InfoType } from '@sudobility/types';
3
+ /** @deprecated Use InfoType from @sudobility/types instead */
4
+ export type BannerVariant = `${InfoType}`;
5
+ export interface BannerProps {
6
+ /** Whether the banner is visible */
7
+ isVisible: boolean;
8
+ /** Callback when banner is dismissed */
9
+ onDismiss: () => void;
10
+ /** Banner title */
11
+ title: string;
12
+ /** Banner description (optional) */
13
+ description?: string;
14
+ /** Visual variant */
15
+ variant?: InfoType;
16
+ /** Auto-dismiss duration in milliseconds (0 to disable, default: 5000) */
17
+ duration?: number;
18
+ /** Custom icon (overrides variant icon) */
19
+ icon?: React.ReactNode;
20
+ /** Additional CSS classes */
21
+ className?: string;
22
+ /** Accessible label for close button */
23
+ closeAriaLabel?: string;
24
+ }
25
+ /**
26
+ * Banner Component
27
+ *
28
+ * A temporary notification banner that slides down from the top of the screen.
29
+ * Similar to SwiftMessage for iOS - less intrusive than a modal.
30
+ *
31
+ * Features:
32
+ * - Slides down from top with animation
33
+ * - Auto-dismisses after configurable duration (default 5 seconds)
34
+ * - Manual dismiss via close button
35
+ * - Multiple variants: info, success, warning, error
36
+ * - Dark/light theme support
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * const [showBanner, setShowBanner] = useState(false);
41
+ *
42
+ * <Banner
43
+ * isVisible={showBanner}
44
+ * onDismiss={() => setShowBanner(false)}
45
+ * variant="success"
46
+ * title="Changes saved"
47
+ * description="Your settings have been updated successfully."
48
+ * />
49
+ * ```
50
+ */
51
+ export declare const Banner: React.FC<BannerProps>;
52
+ export interface UseBannerOptions {
53
+ /** Default duration for auto-dismiss (default: 5000) */
54
+ defaultDuration?: number;
55
+ }
56
+ export interface UseBannerReturn {
57
+ /** Whether the banner is currently visible */
58
+ isVisible: boolean;
59
+ /** Current banner props */
60
+ bannerProps: {
61
+ title: string;
62
+ description?: string;
63
+ variant: InfoType;
64
+ duration: number;
65
+ } | null;
66
+ /** Show a banner */
67
+ showBanner: (options: {
68
+ title: string;
69
+ description?: string;
70
+ variant?: InfoType;
71
+ duration?: number;
72
+ }) => void;
73
+ /** Hide the current banner */
74
+ hideBanner: () => void;
75
+ }
76
+ /**
77
+ * Hook for managing banner state
78
+ *
79
+ * @example
80
+ * ```tsx
81
+ * const { isVisible, bannerProps, showBanner, hideBanner } = useBanner();
82
+ *
83
+ * // Show a banner
84
+ * showBanner({
85
+ * title: 'Success!',
86
+ * description: 'Your changes have been saved.',
87
+ * variant: 'success',
88
+ * });
89
+ *
90
+ * // Render the banner
91
+ * {bannerProps && (
92
+ * <Banner
93
+ * isVisible={isVisible}
94
+ * onDismiss={hideBanner}
95
+ * {...bannerProps}
96
+ * />
97
+ * )}
98
+ * ```
99
+ */
100
+ export declare const useBanner: (options?: UseBannerOptions) => UseBannerReturn;
101
+ //# sourceMappingURL=banner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../src/ui/banner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAUxE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,8DAA8D;AAC9D,MAAM,MAAM,aAAa,GAAG,GAAG,QAAQ,EAAE,CAAC;AAE1C,MAAM,WAAW,WAAW;IAC1B,oCAAoC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,wCAAwC;IACxC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,mBAAmB;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AA6CD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA6IxC,CAAC;AAGF,MAAM,WAAW,gBAAgB;IAC/B,wDAAwD;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,SAAS,EAAE,OAAO,CAAC;IACnB,2BAA2B;IAC3B,WAAW,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE,QAAQ,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,IAAI,CAAC;IACT,oBAAoB;IACpB,UAAU,EAAE,CAAC,OAAO,EAAE;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE,QAAQ,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,KAAK,IAAI,CAAC;IACX,8BAA8B;IAC9B,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,SAAS,GAAI,UAAS,gBAAqB,KAAG,eAkC1D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/components",
3
- "version": "4.0.91",
3
+ "version": "4.0.92",
4
4
  "description": "Reusable UI components and design system - Reorganized for better maintainability",
5
5
  "type": "module",
6
6
  "main": "dist/index.umd.js",
@@ -47,7 +47,7 @@
47
47
  "@radix-ui/react-switch": ">=1.0.0",
48
48
  "@radix-ui/react-tabs": ">=1.0.0",
49
49
  "@sudobility/design": "^1.1.15",
50
- "@sudobility/types": "^1.9.31",
50
+ "@sudobility/types": "^1.9.32",
51
51
  "class-variance-authority": ">=0.7.0",
52
52
  "clsx": ">=2.0.0",
53
53
  "i18next": ">=23.0.0",
@@ -70,7 +70,7 @@
70
70
  "@radix-ui/react-switch": "^1.2.6",
71
71
  "@radix-ui/react-tabs": "^1.1.13",
72
72
  "@sudobility/design": "^1.1.15",
73
- "@sudobility/types": "^1.9.31",
73
+ "@sudobility/types": "^1.9.32",
74
74
  "@testing-library/dom": "^10.4.1",
75
75
  "@testing-library/jest-dom": "^6.9.1",
76
76
  "@testing-library/react": "^16.3.0",