@scalably/ui 0.11.0 → 0.11.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.
- package/README.md +11 -8
- package/dist/index.d.cts +85 -25
- package/dist/index.d.ts +85 -25
- package/dist/index.esm.js +16 -16
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|

|
|
8
8
|

|
|
9
9
|

|
|
10
|
+

|
|
10
11
|

|
|
12
|
+

|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
@@ -917,7 +917,9 @@ interface FileUploadError {
|
|
|
917
917
|
}
|
|
918
918
|
interface FileUploadFile {
|
|
919
919
|
id: string;
|
|
920
|
-
file
|
|
920
|
+
file?: File;
|
|
921
|
+
name?: string;
|
|
922
|
+
type?: string;
|
|
921
923
|
preview?: string;
|
|
922
924
|
status: "pending" | "uploading" | "success" | "error";
|
|
923
925
|
error?: FileUploadError;
|
|
@@ -940,6 +942,11 @@ interface FileUploadProps {
|
|
|
940
942
|
onUploadSuccess?: (files: File[]) => void;
|
|
941
943
|
onUploadError?: (error: FileUploadError) => void;
|
|
942
944
|
onFileRemove?: (fileId: string) => void;
|
|
945
|
+
/**
|
|
946
|
+
* Optional default file source (URL).
|
|
947
|
+
* This is used to display an existing file when the component initializes.
|
|
948
|
+
*/
|
|
949
|
+
defaultFileSrc?: string;
|
|
943
950
|
/**
|
|
944
951
|
* Accepted file types. Can be:
|
|
945
952
|
* - MIME types (e.g., 'image/jpeg', 'image/png') - **Recommended**
|
|
@@ -2154,54 +2161,86 @@ declare const CelebrationModal: {
|
|
|
2154
2161
|
displayName: string;
|
|
2155
2162
|
};
|
|
2156
2163
|
|
|
2164
|
+
/**
|
|
2165
|
+
* Semantic variant for a toast: default icon, border, background, and progress color.
|
|
2166
|
+
*/
|
|
2157
2167
|
type ToastStatus = "success" | "info" | "warn" | "error";
|
|
2168
|
+
/**
|
|
2169
|
+
* Configuration for one optional action control rendered beside the toast body.
|
|
2170
|
+
*/
|
|
2158
2171
|
interface ToastAction {
|
|
2172
|
+
/** Visible label for the action control. */
|
|
2159
2173
|
label: string;
|
|
2174
|
+
/** Called when the user activates this action. */
|
|
2160
2175
|
onClick: () => void;
|
|
2176
|
+
/**
|
|
2177
|
+
* Visual style for the action {@link Button}.
|
|
2178
|
+
* @defaultValue `"link"`
|
|
2179
|
+
*/
|
|
2161
2180
|
variant?: React.ComponentProps<typeof Button>["variant"];
|
|
2162
2181
|
}
|
|
2182
|
+
/** Props for the `Toast` component. */
|
|
2163
2183
|
interface ToastProps {
|
|
2184
|
+
/** Semantic status; controls default icon and color treatment. */
|
|
2164
2185
|
status: ToastStatus;
|
|
2186
|
+
/** Primary heading line. */
|
|
2165
2187
|
title: string;
|
|
2188
|
+
/** Optional supporting text shown under the title. */
|
|
2166
2189
|
message?: string;
|
|
2190
|
+
/** Additional CSS classes merged onto the toast root element. */
|
|
2167
2191
|
className?: string;
|
|
2192
|
+
/** Optional actions rendered as buttons; order is preserved. */
|
|
2168
2193
|
actions?: ToastAction[];
|
|
2194
|
+
/**
|
|
2195
|
+
* Called after the toast has finished dismissing: following the exit animation when
|
|
2196
|
+
* motion is allowed, or immediately when the user prefers reduced motion.
|
|
2197
|
+
* Use this to unmount the toast or remove it from your queue.
|
|
2198
|
+
*/
|
|
2169
2199
|
onClose?: () => void;
|
|
2200
|
+
/**
|
|
2201
|
+
* Auto-dismiss duration in milliseconds. Set to `0` to disable auto-dismiss and the progress UI tied to it.
|
|
2202
|
+
* @defaultValue 5000
|
|
2203
|
+
*/
|
|
2170
2204
|
autoCloseMs?: number;
|
|
2205
|
+
/**
|
|
2206
|
+
* When `autoCloseMs` is greater than zero, shows the default or custom progress indicator.
|
|
2207
|
+
* @defaultValue true
|
|
2208
|
+
*/
|
|
2171
2209
|
showProgress?: boolean;
|
|
2172
|
-
/**
|
|
2210
|
+
/**
|
|
2211
|
+
* Replaces the default status icon when set; ignored if `renderIcon` is provided.
|
|
2212
|
+
*/
|
|
2173
2213
|
customIcon?: React.ReactNode;
|
|
2174
|
-
/**
|
|
2214
|
+
/**
|
|
2215
|
+
* Full control over icon rendering; takes precedence over `customIcon` and the default status icon.
|
|
2216
|
+
*/
|
|
2175
2217
|
renderIcon?: (status: ToastStatus) => React.ReactNode;
|
|
2176
|
-
/**
|
|
2218
|
+
/**
|
|
2219
|
+
* Renders the dismiss control; receives `onClick` which must be invoked to start closing.
|
|
2220
|
+
*/
|
|
2177
2221
|
renderCloseButton?: (props: {
|
|
2178
2222
|
onClick: () => void;
|
|
2179
2223
|
}) => React.ReactNode;
|
|
2180
|
-
/**
|
|
2224
|
+
/**
|
|
2225
|
+
* Renders the countdown/progress UI; receives remaining percentage (0–100) and status.
|
|
2226
|
+
*/
|
|
2181
2227
|
renderProgress?: (progress: number, status: ToastStatus) => React.ReactNode;
|
|
2182
|
-
/**
|
|
2228
|
+
/**
|
|
2229
|
+
* When `true`, the default dismiss button is not rendered (you may still use `renderCloseButton`).
|
|
2230
|
+
* @defaultValue false
|
|
2231
|
+
*/
|
|
2183
2232
|
hideCloseButton?: boolean;
|
|
2184
2233
|
}
|
|
2185
2234
|
/**
|
|
2186
|
-
*
|
|
2235
|
+
* Temporary status notification with optional actions, auto-dismiss, and an optional progress indicator.
|
|
2187
2236
|
*
|
|
2188
|
-
*
|
|
2189
|
-
* -
|
|
2190
|
-
* - Auto-dismiss
|
|
2191
|
-
* -
|
|
2192
|
-
* -
|
|
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
|
|
2237
|
+
* @remarks
|
|
2238
|
+
* - Uses `role="status"` (implicit polite live region) for assistive technologies.
|
|
2239
|
+
* - Auto-dismiss pauses while the pointer hovers over the toast or while focus is inside it.
|
|
2240
|
+
* - Enter and exit motion honors `prefers-reduced-motion`; when reduced, dismissal calls `onClose` without waiting for animation.
|
|
2241
|
+
* - For fixed positioning and stacking at a viewport edge, wrap instances in `ToastContainer`.
|
|
2198
2242
|
*
|
|
2199
|
-
*
|
|
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
|
|
2243
|
+
* @see ToastContainer
|
|
2205
2244
|
*
|
|
2206
2245
|
* @example
|
|
2207
2246
|
* ```tsx
|
|
@@ -2256,16 +2295,37 @@ interface ToastProps {
|
|
|
2256
2295
|
*/
|
|
2257
2296
|
declare const Toast: React.FC<ToastProps>;
|
|
2258
2297
|
|
|
2298
|
+
/**
|
|
2299
|
+
* Corner or edge alignment for the fixed toast stack relative to the viewport.
|
|
2300
|
+
*/
|
|
2259
2301
|
type ToastPosition = "top-left" | "top-right" | "top-center" | "bottom-left" | "bottom-right" | "bottom-center";
|
|
2302
|
+
/**
|
|
2303
|
+
* Props for `ToastContainer`.
|
|
2304
|
+
*/
|
|
2260
2305
|
interface ToastContainerProps {
|
|
2306
|
+
/**
|
|
2307
|
+
* Where the stack is anchored on the screen.
|
|
2308
|
+
* @defaultValue `"top-right"`
|
|
2309
|
+
*/
|
|
2261
2310
|
position?: ToastPosition;
|
|
2311
|
+
/** Additional CSS classes for the outer fixed wrapper. */
|
|
2262
2312
|
className?: string;
|
|
2313
|
+
/** Toasts or other content; each child is wrapped to restore pointer events. */
|
|
2263
2314
|
children?: React.ReactNode;
|
|
2315
|
+
/**
|
|
2316
|
+
* Width of the inner column that holds toasts (number is treated as pixels).
|
|
2317
|
+
* @defaultValue `"420px"`
|
|
2318
|
+
*/
|
|
2264
2319
|
width?: number | string;
|
|
2265
2320
|
}
|
|
2266
2321
|
/**
|
|
2267
|
-
*
|
|
2268
|
-
*
|
|
2322
|
+
* Fixed-position region for stacking one or more `Toast` instances at a viewport edge.
|
|
2323
|
+
*
|
|
2324
|
+
* @remarks
|
|
2325
|
+
* - 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.
|
|
2326
|
+
* - Sets `role="region"` and `aria-live="polite"` on the outer element for screen reader context when content updates.
|
|
2327
|
+
*
|
|
2328
|
+
* @see Toast
|
|
2269
2329
|
*/
|
|
2270
2330
|
declare const ToastContainer: React.FC<ToastContainerProps>;
|
|
2271
2331
|
|
package/dist/index.d.ts
CHANGED
|
@@ -917,7 +917,9 @@ interface FileUploadError {
|
|
|
917
917
|
}
|
|
918
918
|
interface FileUploadFile {
|
|
919
919
|
id: string;
|
|
920
|
-
file
|
|
920
|
+
file?: File;
|
|
921
|
+
name?: string;
|
|
922
|
+
type?: string;
|
|
921
923
|
preview?: string;
|
|
922
924
|
status: "pending" | "uploading" | "success" | "error";
|
|
923
925
|
error?: FileUploadError;
|
|
@@ -940,6 +942,11 @@ interface FileUploadProps {
|
|
|
940
942
|
onUploadSuccess?: (files: File[]) => void;
|
|
941
943
|
onUploadError?: (error: FileUploadError) => void;
|
|
942
944
|
onFileRemove?: (fileId: string) => void;
|
|
945
|
+
/**
|
|
946
|
+
* Optional default file source (URL).
|
|
947
|
+
* This is used to display an existing file when the component initializes.
|
|
948
|
+
*/
|
|
949
|
+
defaultFileSrc?: string;
|
|
943
950
|
/**
|
|
944
951
|
* Accepted file types. Can be:
|
|
945
952
|
* - MIME types (e.g., 'image/jpeg', 'image/png') - **Recommended**
|
|
@@ -2154,54 +2161,86 @@ declare const CelebrationModal: {
|
|
|
2154
2161
|
displayName: string;
|
|
2155
2162
|
};
|
|
2156
2163
|
|
|
2164
|
+
/**
|
|
2165
|
+
* Semantic variant for a toast: default icon, border, background, and progress color.
|
|
2166
|
+
*/
|
|
2157
2167
|
type ToastStatus = "success" | "info" | "warn" | "error";
|
|
2168
|
+
/**
|
|
2169
|
+
* Configuration for one optional action control rendered beside the toast body.
|
|
2170
|
+
*/
|
|
2158
2171
|
interface ToastAction {
|
|
2172
|
+
/** Visible label for the action control. */
|
|
2159
2173
|
label: string;
|
|
2174
|
+
/** Called when the user activates this action. */
|
|
2160
2175
|
onClick: () => void;
|
|
2176
|
+
/**
|
|
2177
|
+
* Visual style for the action {@link Button}.
|
|
2178
|
+
* @defaultValue `"link"`
|
|
2179
|
+
*/
|
|
2161
2180
|
variant?: React.ComponentProps<typeof Button>["variant"];
|
|
2162
2181
|
}
|
|
2182
|
+
/** Props for the `Toast` component. */
|
|
2163
2183
|
interface ToastProps {
|
|
2184
|
+
/** Semantic status; controls default icon and color treatment. */
|
|
2164
2185
|
status: ToastStatus;
|
|
2186
|
+
/** Primary heading line. */
|
|
2165
2187
|
title: string;
|
|
2188
|
+
/** Optional supporting text shown under the title. */
|
|
2166
2189
|
message?: string;
|
|
2190
|
+
/** Additional CSS classes merged onto the toast root element. */
|
|
2167
2191
|
className?: string;
|
|
2192
|
+
/** Optional actions rendered as buttons; order is preserved. */
|
|
2168
2193
|
actions?: ToastAction[];
|
|
2194
|
+
/**
|
|
2195
|
+
* Called after the toast has finished dismissing: following the exit animation when
|
|
2196
|
+
* motion is allowed, or immediately when the user prefers reduced motion.
|
|
2197
|
+
* Use this to unmount the toast or remove it from your queue.
|
|
2198
|
+
*/
|
|
2169
2199
|
onClose?: () => void;
|
|
2200
|
+
/**
|
|
2201
|
+
* Auto-dismiss duration in milliseconds. Set to `0` to disable auto-dismiss and the progress UI tied to it.
|
|
2202
|
+
* @defaultValue 5000
|
|
2203
|
+
*/
|
|
2170
2204
|
autoCloseMs?: number;
|
|
2205
|
+
/**
|
|
2206
|
+
* When `autoCloseMs` is greater than zero, shows the default or custom progress indicator.
|
|
2207
|
+
* @defaultValue true
|
|
2208
|
+
*/
|
|
2171
2209
|
showProgress?: boolean;
|
|
2172
|
-
/**
|
|
2210
|
+
/**
|
|
2211
|
+
* Replaces the default status icon when set; ignored if `renderIcon` is provided.
|
|
2212
|
+
*/
|
|
2173
2213
|
customIcon?: React.ReactNode;
|
|
2174
|
-
/**
|
|
2214
|
+
/**
|
|
2215
|
+
* Full control over icon rendering; takes precedence over `customIcon` and the default status icon.
|
|
2216
|
+
*/
|
|
2175
2217
|
renderIcon?: (status: ToastStatus) => React.ReactNode;
|
|
2176
|
-
/**
|
|
2218
|
+
/**
|
|
2219
|
+
* Renders the dismiss control; receives `onClick` which must be invoked to start closing.
|
|
2220
|
+
*/
|
|
2177
2221
|
renderCloseButton?: (props: {
|
|
2178
2222
|
onClick: () => void;
|
|
2179
2223
|
}) => React.ReactNode;
|
|
2180
|
-
/**
|
|
2224
|
+
/**
|
|
2225
|
+
* Renders the countdown/progress UI; receives remaining percentage (0–100) and status.
|
|
2226
|
+
*/
|
|
2181
2227
|
renderProgress?: (progress: number, status: ToastStatus) => React.ReactNode;
|
|
2182
|
-
/**
|
|
2228
|
+
/**
|
|
2229
|
+
* When `true`, the default dismiss button is not rendered (you may still use `renderCloseButton`).
|
|
2230
|
+
* @defaultValue false
|
|
2231
|
+
*/
|
|
2183
2232
|
hideCloseButton?: boolean;
|
|
2184
2233
|
}
|
|
2185
2234
|
/**
|
|
2186
|
-
*
|
|
2235
|
+
* Temporary status notification with optional actions, auto-dismiss, and an optional progress indicator.
|
|
2187
2236
|
*
|
|
2188
|
-
*
|
|
2189
|
-
* -
|
|
2190
|
-
* - Auto-dismiss
|
|
2191
|
-
* -
|
|
2192
|
-
* -
|
|
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
|
|
2237
|
+
* @remarks
|
|
2238
|
+
* - Uses `role="status"` (implicit polite live region) for assistive technologies.
|
|
2239
|
+
* - Auto-dismiss pauses while the pointer hovers over the toast or while focus is inside it.
|
|
2240
|
+
* - Enter and exit motion honors `prefers-reduced-motion`; when reduced, dismissal calls `onClose` without waiting for animation.
|
|
2241
|
+
* - For fixed positioning and stacking at a viewport edge, wrap instances in `ToastContainer`.
|
|
2198
2242
|
*
|
|
2199
|
-
*
|
|
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
|
|
2243
|
+
* @see ToastContainer
|
|
2205
2244
|
*
|
|
2206
2245
|
* @example
|
|
2207
2246
|
* ```tsx
|
|
@@ -2256,16 +2295,37 @@ interface ToastProps {
|
|
|
2256
2295
|
*/
|
|
2257
2296
|
declare const Toast: React.FC<ToastProps>;
|
|
2258
2297
|
|
|
2298
|
+
/**
|
|
2299
|
+
* Corner or edge alignment for the fixed toast stack relative to the viewport.
|
|
2300
|
+
*/
|
|
2259
2301
|
type ToastPosition = "top-left" | "top-right" | "top-center" | "bottom-left" | "bottom-right" | "bottom-center";
|
|
2302
|
+
/**
|
|
2303
|
+
* Props for `ToastContainer`.
|
|
2304
|
+
*/
|
|
2260
2305
|
interface ToastContainerProps {
|
|
2306
|
+
/**
|
|
2307
|
+
* Where the stack is anchored on the screen.
|
|
2308
|
+
* @defaultValue `"top-right"`
|
|
2309
|
+
*/
|
|
2261
2310
|
position?: ToastPosition;
|
|
2311
|
+
/** Additional CSS classes for the outer fixed wrapper. */
|
|
2262
2312
|
className?: string;
|
|
2313
|
+
/** Toasts or other content; each child is wrapped to restore pointer events. */
|
|
2263
2314
|
children?: React.ReactNode;
|
|
2315
|
+
/**
|
|
2316
|
+
* Width of the inner column that holds toasts (number is treated as pixels).
|
|
2317
|
+
* @defaultValue `"420px"`
|
|
2318
|
+
*/
|
|
2264
2319
|
width?: number | string;
|
|
2265
2320
|
}
|
|
2266
2321
|
/**
|
|
2267
|
-
*
|
|
2268
|
-
*
|
|
2322
|
+
* Fixed-position region for stacking one or more `Toast` instances at a viewport edge.
|
|
2323
|
+
*
|
|
2324
|
+
* @remarks
|
|
2325
|
+
* - 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.
|
|
2326
|
+
* - Sets `role="region"` and `aria-live="polite"` on the outer element for screen reader context when content updates.
|
|
2327
|
+
*
|
|
2328
|
+
* @see Toast
|
|
2269
2329
|
*/
|
|
2270
2330
|
declare const ToastContainer: React.FC<ToastContainerProps>;
|
|
2271
2331
|
|