@scalably/ui 0.11.0 → 0.11.1

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 CHANGED
@@ -7,7 +7,9 @@
7
7
  ![TypeScript](https://img.shields.io/badge/TypeScript-5.9.3-blue)
8
8
  ![Node](https://img.shields.io/badge/Node-%3E%3D18-green)
9
9
  ![React](https://img.shields.io/badge/React-%3E%3D18-blue)
10
+ ![Tailwind](https://img.shields.io/badge/Tailwind-3.4-38bdf8?logo=tailwindcss&logoColor=white)
10
11
  ![Coverage](https://img.shields.io/badge/coverage-vitest-blue)
12
+ ![Maintained](https://img.shields.io/badge/maintained-yes-brightgreen)
11
13
 
12
14
  A modern, accessible, and fully isolated React component library built with TypeScript and Tailwind CSS. Designed to work seamlessly across multiple projects without style conflicts.
13
15
 
@@ -50,9 +52,10 @@ export default function App() {
50
52
  <Button className="sui-mt-4" type="submit">Submit</Button>
51
53
  </Form>
52
54
 
53
- {/* Toasts */}
54
- <ToastContainer />
55
- <Toast status="success" title="Welcome" description="You're all set." />
55
+ {/* Toasts: render each Toast inside ToastContainer for fixed stacking */}
56
+ <ToastContainer>
57
+ <Toast status="success" title="Welcome" message="You're all set." />
58
+ </ToastContainer>
56
59
  </main>
57
60
  </ScalablyUIProvider>
58
61
  );
@@ -91,7 +94,7 @@ Styles automatically work in portaled components (modals, tooltips, popovers, et
91
94
  </Tooltip>
92
95
  ```
93
96
 
94
- Note: Toasts in this library are intentionally declarative. Render a `Toast` inside a `ToastContainer` when you want it visible (e.g., based on component state). This avoids hidden globals and keeps UI state predictable. If you prefer an imperative API, you can wrap your own tiny helper around local state to toggle a `Toast` component.
97
+ Note: Toasts are declarative. Put each `Toast` **inside** `ToastContainer` so they stack in a fixed corner of the viewport (`Toast` is not positioned on its own). Toggle visibility with state; use `onClose` after auto-dismiss or when the user dismisses the toast to unmount or dequeue. `ToastContainer` accepts `position` (e.g. `top-right`, `bottom-center`), optional `width`, and `className`. `Toast` uses `message` for body text, `status` of `success` | `info` | `warn` | `error`, plus optional `actions`, `autoCloseMs`, and `showProgress`.
95
98
 
96
99
  ### 4. React import guidance
97
100
 
@@ -152,12 +155,12 @@ import {
152
155
  onChange={(date) => console.log(date)}
153
156
  />;
154
157
 
155
- // Toast notifications (declarative)
156
- <ToastContainer>
158
+ // Toast notifications (declarative; nest Toast inside ToastContainer)
159
+ <ToastContainer position="top-right">
157
160
  <Toast
158
161
  status="success"
159
162
  title="Success!"
160
- description="Your changes have been saved."
163
+ message="Your changes have been saved."
161
164
  />
162
165
  </ToastContainer>;
163
166
 
@@ -188,7 +191,7 @@ import {
188
191
  This library exposes a set of composable, production-ready primitives. The full list of exports is available in `src/index.ts`, but the main groups are:
189
192
 
190
193
  - **Form primitives**: `Form`, `FormField`, `FormErrorSummary`, `Input`, `SearchInput`, `QuantityInput`, `CheckBox`, `CheckBoxGroup`, `Radio`, `RadioGroup`, `Select`, `Switch`, `FileUpload`, `DateInput`, `DatePicker`, `TimePicker`
191
- - **Feedback & status**: `StatusBadge`, `Toast`, `ToastContainer`, `Skeleton`, `SkeletonText`, `Countdown`
194
+ - **Feedback & status**: `StatusBadge`, `Toast`, `ToastContainer` (with `ToastPosition`, stacking at viewport edge), `Skeleton`, `SkeletonText`, `Countdown`
192
195
  - **Layout & navigation**: `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`, `Pagination`, `BackToTop`, `ViewToggle`, `Divider`
193
196
  - **Content & rich text**: `RichTextEditor`, `RichTextViewer`, `Tooltip`, `AuthPrompt`, `LoadingScreen`, `WelcomeBackground`
194
197
  - **Media & brand**: `AvatarPlaceholder`, `Logo`, `logoAssets`, `defaultAssets`, `welcomeAssets` (all inline React SVGs—no static paths required)
package/dist/index.d.cts CHANGED
@@ -2154,54 +2154,86 @@ declare const CelebrationModal: {
2154
2154
  displayName: string;
2155
2155
  };
2156
2156
 
2157
+ /**
2158
+ * Semantic variant for a toast: default icon, border, background, and progress color.
2159
+ */
2157
2160
  type ToastStatus = "success" | "info" | "warn" | "error";
2161
+ /**
2162
+ * Configuration for one optional action control rendered beside the toast body.
2163
+ */
2158
2164
  interface ToastAction {
2165
+ /** Visible label for the action control. */
2159
2166
  label: string;
2167
+ /** Called when the user activates this action. */
2160
2168
  onClick: () => void;
2169
+ /**
2170
+ * Visual style for the action {@link Button}.
2171
+ * @defaultValue `"link"`
2172
+ */
2161
2173
  variant?: React.ComponentProps<typeof Button>["variant"];
2162
2174
  }
2175
+ /** Props for the `Toast` component. */
2163
2176
  interface ToastProps {
2177
+ /** Semantic status; controls default icon and color treatment. */
2164
2178
  status: ToastStatus;
2179
+ /** Primary heading line. */
2165
2180
  title: string;
2181
+ /** Optional supporting text shown under the title. */
2166
2182
  message?: string;
2183
+ /** Additional CSS classes merged onto the toast root element. */
2167
2184
  className?: string;
2185
+ /** Optional actions rendered as buttons; order is preserved. */
2168
2186
  actions?: ToastAction[];
2187
+ /**
2188
+ * Called after the toast has finished dismissing: following the exit animation when
2189
+ * motion is allowed, or immediately when the user prefers reduced motion.
2190
+ * Use this to unmount the toast or remove it from your queue.
2191
+ */
2169
2192
  onClose?: () => void;
2193
+ /**
2194
+ * Auto-dismiss duration in milliseconds. Set to `0` to disable auto-dismiss and the progress UI tied to it.
2195
+ * @defaultValue 5000
2196
+ */
2170
2197
  autoCloseMs?: number;
2198
+ /**
2199
+ * When `autoCloseMs` is greater than zero, shows the default or custom progress indicator.
2200
+ * @defaultValue true
2201
+ */
2171
2202
  showProgress?: boolean;
2172
- /** Custom icon for this toast (overrides status icon) */
2203
+ /**
2204
+ * Replaces the default status icon when set; ignored if `renderIcon` is provided.
2205
+ */
2173
2206
  customIcon?: React.ReactNode;
2174
- /** Custom render function for the icon */
2207
+ /**
2208
+ * Full control over icon rendering; takes precedence over `customIcon` and the default status icon.
2209
+ */
2175
2210
  renderIcon?: (status: ToastStatus) => React.ReactNode;
2176
- /** Custom render function for the close button */
2211
+ /**
2212
+ * Renders the dismiss control; receives `onClick` which must be invoked to start closing.
2213
+ */
2177
2214
  renderCloseButton?: (props: {
2178
2215
  onClick: () => void;
2179
2216
  }) => React.ReactNode;
2180
- /** Custom render function for the progress bar */
2217
+ /**
2218
+ * Renders the countdown/progress UI; receives remaining percentage (0–100) and status.
2219
+ */
2181
2220
  renderProgress?: (progress: number, status: ToastStatus) => React.ReactNode;
2182
- /** Hide the close button */
2221
+ /**
2222
+ * When `true`, the default dismiss button is not rendered (you may still use `renderCloseButton`).
2223
+ * @defaultValue false
2224
+ */
2183
2225
  hideCloseButton?: boolean;
2184
2226
  }
2185
2227
  /**
2186
- * Toast - A status notification component with auto-dismiss and action buttons.
2228
+ * Temporary status notification with optional actions, auto-dismiss, and an optional progress indicator.
2187
2229
  *
2188
- * Features:
2189
- * - Multiple status types: success, info, warn, error
2190
- * - Auto-dismiss with configurable timeout
2191
- * - Visual progress bar showing remaining time
2192
- * - Pauses on hover/focus for better UX
2193
- * - Optional action buttons
2194
- * - Manual close button
2195
- * - ARIA live region for screen reader announcements
2196
- * - Smooth animations
2197
- * - Fully customizable icons, close button, and progress bar
2230
+ * @remarks
2231
+ * - Uses `role="status"` (implicit polite live region) for assistive technologies.
2232
+ * - Auto-dismiss pauses while the pointer hovers over the toast or while focus is inside it.
2233
+ * - Enter and exit motion honors `prefers-reduced-motion`; when reduced, dismissal calls `onClose` without waiting for animation.
2234
+ * - For fixed positioning and stacking at a viewport edge, wrap instances in `ToastContainer`.
2198
2235
  *
2199
- * Customization:
2200
- * - `customIcon`: Replace the default status icon
2201
- * - `renderIcon`: Full control over icon rendering
2202
- * - `renderCloseButton`: Custom close button
2203
- * - `renderProgress`: Custom progress bar
2204
- * - `hideCloseButton`: Hide the close button
2236
+ * @see ToastContainer
2205
2237
  *
2206
2238
  * @example
2207
2239
  * ```tsx
@@ -2256,16 +2288,37 @@ interface ToastProps {
2256
2288
  */
2257
2289
  declare const Toast: React.FC<ToastProps>;
2258
2290
 
2291
+ /**
2292
+ * Corner or edge alignment for the fixed toast stack relative to the viewport.
2293
+ */
2259
2294
  type ToastPosition = "top-left" | "top-right" | "top-center" | "bottom-left" | "bottom-right" | "bottom-center";
2295
+ /**
2296
+ * Props for `ToastContainer`.
2297
+ */
2260
2298
  interface ToastContainerProps {
2299
+ /**
2300
+ * Where the stack is anchored on the screen.
2301
+ * @defaultValue `"top-right"`
2302
+ */
2261
2303
  position?: ToastPosition;
2304
+ /** Additional CSS classes for the outer fixed wrapper. */
2262
2305
  className?: string;
2306
+ /** Toasts or other content; each child is wrapped to restore pointer events. */
2263
2307
  children?: React.ReactNode;
2308
+ /**
2309
+ * Width of the inner column that holds toasts (number is treated as pixels).
2310
+ * @defaultValue `"420px"`
2311
+ */
2264
2312
  width?: number | string;
2265
2313
  }
2266
2314
  /**
2267
- * - Fixed-position portal region to stack toasts at screen edges.
2268
- * - Click-through outer wrapper with pointer-enabled children.
2315
+ * Fixed-position region for stacking one or more `Toast` instances at a viewport edge.
2316
+ *
2317
+ * @remarks
2318
+ * - The outer layer uses `pointer-events: none` so clicks pass through empty space; each child is wrapped with `pointer-events: auto` so toasts and controls remain interactive.
2319
+ * - Sets `role="region"` and `aria-live="polite"` on the outer element for screen reader context when content updates.
2320
+ *
2321
+ * @see Toast
2269
2322
  */
2270
2323
  declare const ToastContainer: React.FC<ToastContainerProps>;
2271
2324
 
package/dist/index.d.ts CHANGED
@@ -2154,54 +2154,86 @@ declare const CelebrationModal: {
2154
2154
  displayName: string;
2155
2155
  };
2156
2156
 
2157
+ /**
2158
+ * Semantic variant for a toast: default icon, border, background, and progress color.
2159
+ */
2157
2160
  type ToastStatus = "success" | "info" | "warn" | "error";
2161
+ /**
2162
+ * Configuration for one optional action control rendered beside the toast body.
2163
+ */
2158
2164
  interface ToastAction {
2165
+ /** Visible label for the action control. */
2159
2166
  label: string;
2167
+ /** Called when the user activates this action. */
2160
2168
  onClick: () => void;
2169
+ /**
2170
+ * Visual style for the action {@link Button}.
2171
+ * @defaultValue `"link"`
2172
+ */
2161
2173
  variant?: React.ComponentProps<typeof Button>["variant"];
2162
2174
  }
2175
+ /** Props for the `Toast` component. */
2163
2176
  interface ToastProps {
2177
+ /** Semantic status; controls default icon and color treatment. */
2164
2178
  status: ToastStatus;
2179
+ /** Primary heading line. */
2165
2180
  title: string;
2181
+ /** Optional supporting text shown under the title. */
2166
2182
  message?: string;
2183
+ /** Additional CSS classes merged onto the toast root element. */
2167
2184
  className?: string;
2185
+ /** Optional actions rendered as buttons; order is preserved. */
2168
2186
  actions?: ToastAction[];
2187
+ /**
2188
+ * Called after the toast has finished dismissing: following the exit animation when
2189
+ * motion is allowed, or immediately when the user prefers reduced motion.
2190
+ * Use this to unmount the toast or remove it from your queue.
2191
+ */
2169
2192
  onClose?: () => void;
2193
+ /**
2194
+ * Auto-dismiss duration in milliseconds. Set to `0` to disable auto-dismiss and the progress UI tied to it.
2195
+ * @defaultValue 5000
2196
+ */
2170
2197
  autoCloseMs?: number;
2198
+ /**
2199
+ * When `autoCloseMs` is greater than zero, shows the default or custom progress indicator.
2200
+ * @defaultValue true
2201
+ */
2171
2202
  showProgress?: boolean;
2172
- /** Custom icon for this toast (overrides status icon) */
2203
+ /**
2204
+ * Replaces the default status icon when set; ignored if `renderIcon` is provided.
2205
+ */
2173
2206
  customIcon?: React.ReactNode;
2174
- /** Custom render function for the icon */
2207
+ /**
2208
+ * Full control over icon rendering; takes precedence over `customIcon` and the default status icon.
2209
+ */
2175
2210
  renderIcon?: (status: ToastStatus) => React.ReactNode;
2176
- /** Custom render function for the close button */
2211
+ /**
2212
+ * Renders the dismiss control; receives `onClick` which must be invoked to start closing.
2213
+ */
2177
2214
  renderCloseButton?: (props: {
2178
2215
  onClick: () => void;
2179
2216
  }) => React.ReactNode;
2180
- /** Custom render function for the progress bar */
2217
+ /**
2218
+ * Renders the countdown/progress UI; receives remaining percentage (0–100) and status.
2219
+ */
2181
2220
  renderProgress?: (progress: number, status: ToastStatus) => React.ReactNode;
2182
- /** Hide the close button */
2221
+ /**
2222
+ * When `true`, the default dismiss button is not rendered (you may still use `renderCloseButton`).
2223
+ * @defaultValue false
2224
+ */
2183
2225
  hideCloseButton?: boolean;
2184
2226
  }
2185
2227
  /**
2186
- * Toast - A status notification component with auto-dismiss and action buttons.
2228
+ * Temporary status notification with optional actions, auto-dismiss, and an optional progress indicator.
2187
2229
  *
2188
- * Features:
2189
- * - Multiple status types: success, info, warn, error
2190
- * - Auto-dismiss with configurable timeout
2191
- * - Visual progress bar showing remaining time
2192
- * - Pauses on hover/focus for better UX
2193
- * - Optional action buttons
2194
- * - Manual close button
2195
- * - ARIA live region for screen reader announcements
2196
- * - Smooth animations
2197
- * - Fully customizable icons, close button, and progress bar
2230
+ * @remarks
2231
+ * - Uses `role="status"` (implicit polite live region) for assistive technologies.
2232
+ * - Auto-dismiss pauses while the pointer hovers over the toast or while focus is inside it.
2233
+ * - Enter and exit motion honors `prefers-reduced-motion`; when reduced, dismissal calls `onClose` without waiting for animation.
2234
+ * - For fixed positioning and stacking at a viewport edge, wrap instances in `ToastContainer`.
2198
2235
  *
2199
- * Customization:
2200
- * - `customIcon`: Replace the default status icon
2201
- * - `renderIcon`: Full control over icon rendering
2202
- * - `renderCloseButton`: Custom close button
2203
- * - `renderProgress`: Custom progress bar
2204
- * - `hideCloseButton`: Hide the close button
2236
+ * @see ToastContainer
2205
2237
  *
2206
2238
  * @example
2207
2239
  * ```tsx
@@ -2256,16 +2288,37 @@ interface ToastProps {
2256
2288
  */
2257
2289
  declare const Toast: React.FC<ToastProps>;
2258
2290
 
2291
+ /**
2292
+ * Corner or edge alignment for the fixed toast stack relative to the viewport.
2293
+ */
2259
2294
  type ToastPosition = "top-left" | "top-right" | "top-center" | "bottom-left" | "bottom-right" | "bottom-center";
2295
+ /**
2296
+ * Props for `ToastContainer`.
2297
+ */
2260
2298
  interface ToastContainerProps {
2299
+ /**
2300
+ * Where the stack is anchored on the screen.
2301
+ * @defaultValue `"top-right"`
2302
+ */
2261
2303
  position?: ToastPosition;
2304
+ /** Additional CSS classes for the outer fixed wrapper. */
2262
2305
  className?: string;
2306
+ /** Toasts or other content; each child is wrapped to restore pointer events. */
2263
2307
  children?: React.ReactNode;
2308
+ /**
2309
+ * Width of the inner column that holds toasts (number is treated as pixels).
2310
+ * @defaultValue `"420px"`
2311
+ */
2264
2312
  width?: number | string;
2265
2313
  }
2266
2314
  /**
2267
- * - Fixed-position portal region to stack toasts at screen edges.
2268
- * - Click-through outer wrapper with pointer-enabled children.
2315
+ * Fixed-position region for stacking one or more `Toast` instances at a viewport edge.
2316
+ *
2317
+ * @remarks
2318
+ * - The outer layer uses `pointer-events: none` so clicks pass through empty space; each child is wrapped with `pointer-events: auto` so toasts and controls remain interactive.
2319
+ * - Sets `role="region"` and `aria-live="polite"` on the outer element for screen reader context when content updates.
2320
+ *
2321
+ * @see Toast
2269
2322
  */
2270
2323
  declare const ToastContainer: React.FC<ToastContainerProps>;
2271
2324