@rozie-ui/toast-solid 0.1.0

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/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ export { default as Toaster } from './Toaster';
2
+ export { default } from './Toaster';
3
+
4
+ /** The `$expose` imperative handle received via `ref` — { show, dismiss, clear, patch, promise }. */
5
+ export type { ToasterHandle } from './Toaster';
@@ -0,0 +1,57 @@
1
+ /*
2
+ * @rozie-ui/toast — base token reference.
3
+ *
4
+ * Every COSMETIC value the toast host renders is a `--rozie-toast-*` custom
5
+ * property. The component ships with inline `var(token, fallback)` defaults, so
6
+ * importing this file is OPTIONAL — it simply makes the full token surface
7
+ * explicit in one place so you can copy/override exactly what you need.
8
+ *
9
+ * The structural rules (the fixed-corner region, the flex stack, the per-toast
10
+ * box model, the close button) live in the component's scoped `<style>` (per-leaf,
11
+ * NOT consumer-overridable). Only the values below flow through tokens.
12
+ *
13
+ * Override any token at any ancestor scope (`:root`, `.dark`, a wrapper, or the
14
+ * `.rozie-toaster` element). See themes/shadcn.css, themes/material.css and
15
+ * themes/bootstrap.css for design-system bridges.
16
+ */
17
+ .rozie-toaster {
18
+ /* region layout */
19
+ --rozie-toast-z: 9999;
20
+ --rozie-toast-gap: 0.5rem;
21
+ --rozie-toast-region-padding: 1rem;
22
+ --rozie-toast-max-width: calc(100vw - 2rem);
23
+ --rozie-toast-font: inherit;
24
+
25
+ /* per-toast box model */
26
+ --rozie-toast-content-gap: 0.75rem;
27
+ --rozie-toast-min-width: 16rem;
28
+ --rozie-toast-toast-max-width: 24rem;
29
+ --rozie-toast-padding: 0.75rem 1rem;
30
+ --rozie-toast-color: #fff;
31
+ --rozie-toast-bg: #333;
32
+ --rozie-toast-radius: 0.5rem;
33
+ --rozie-toast-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
34
+
35
+ /* per-type accents */
36
+ --rozie-toast-success-bg: #16a34a;
37
+ --rozie-toast-error-bg: #dc2626;
38
+ --rozie-toast-warning-bg: #ca8a04;
39
+ --rozie-toast-info-bg: var(--rozie-toast-bg, #333);
40
+
41
+ /* message + close button */
42
+ --rozie-toast-font-size: 0.9rem;
43
+ --rozie-toast-close-size: 1.25rem;
44
+ --rozie-toast-close-opacity: 0.75;
45
+
46
+ /* enter/exit lifecycle */
47
+ --rozie-toast-enter-duration: 200ms;
48
+ --rozie-toast-exit-duration: 200ms;
49
+
50
+ /* stacked mode (opt-in `stacked` prop) — collapsed depth transform */
51
+ --rozie-toast-stack-offset: 8px;
52
+ --rozie-toast-stack-scale-step: 0.05;
53
+
54
+ /* the decorative 'loading' type spinner */
55
+ --rozie-toast-spinner-size: 1em;
56
+ --rozie-toast-spinner-color: currentColor;
57
+ }
@@ -0,0 +1,27 @@
1
+ /*
2
+ * @rozie-ui/toast — Bootstrap 5 bridge.
3
+ *
4
+ * Maps the toast tokens onto Bootstrap's `--bs-*` CSS variables (Bootstrap
5
+ * 5.2+). Reading them live means the toast host follows `data-bs-theme="dark"`
6
+ * and any custom `$primary` build automatically. Falls back to Bootstrap's
7
+ * default palette when the vars are absent. Mirrors Bootstrap's own toast /
8
+ * alert contextual colors.
9
+ *
10
+ * import '@rozie-ui/toast-react/themes/bootstrap.css';
11
+ */
12
+ .rozie-toaster {
13
+ --rozie-toast-color: #fff;
14
+ --rozie-toast-bg: var(--bs-dark, #212529);
15
+ --rozie-toast-radius: var(--bs-border-radius, 0.375rem);
16
+ --rozie-toast-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
17
+
18
+ --rozie-toast-success-bg: var(--bs-success, #198754);
19
+ --rozie-toast-error-bg: var(--bs-danger, #dc3545);
20
+ --rozie-toast-warning-bg: var(--bs-warning, #ffc107);
21
+ --rozie-toast-info-bg: var(--bs-info, #0dcaf0);
22
+
23
+ /* Bootstrap's own $transition-fade / $toast-*-time defaults are ~150ms. */
24
+ --rozie-toast-enter-duration: 150ms;
25
+ --rozie-toast-exit-duration: 150ms;
26
+ --rozie-toast-spinner-color: #fff;
27
+ }
@@ -0,0 +1,28 @@
1
+ /*
2
+ * @rozie-ui/toast — Material Design 3 bridge.
3
+ *
4
+ * Maps the toast tokens onto the MD3 system color roles
5
+ * (`--md-sys-color-*`) emitted by material-web / @material/material-color-utilities
6
+ * theme builders. Falls back to the baseline M3 light palette when those vars
7
+ * are absent, so it renders correctly even without a generated theme. The default
8
+ * (info) toast uses the M3 "inverse surface" snackbar convention.
9
+ *
10
+ * import '@rozie-ui/toast-react/themes/material.css';
11
+ */
12
+ .rozie-toaster {
13
+ --rozie-toast-color: var(--md-sys-color-inverse-on-surface, #f5eff7);
14
+ --rozie-toast-bg: var(--md-sys-color-inverse-surface, #322f35);
15
+ --rozie-toast-radius: 0.25rem;
16
+ --rozie-toast-shadow: 0 3px 5px rgba(0, 0, 0, 0.2), 0 6px 10px rgba(0, 0, 0, 0.14);
17
+
18
+ --rozie-toast-success-bg: #2e7d32;
19
+ --rozie-toast-error-bg: var(--md-sys-color-error, #b3261e);
20
+ --rozie-toast-warning-bg: #f9a825;
21
+ --rozie-toast-info-bg: var(--md-sys-color-inverse-surface, #322f35);
22
+
23
+ /* MD3's motion system favors slightly longer "emphasized" easing/duration
24
+ for surfaces entering/leaving the screen than the 200ms baseline. */
25
+ --rozie-toast-enter-duration: 250ms;
26
+ --rozie-toast-exit-duration: 250ms;
27
+ --rozie-toast-spinner-color: var(--md-sys-color-inverse-on-surface, #f5eff7);
28
+ }
@@ -0,0 +1,29 @@
1
+ /*
2
+ * @rozie-ui/toast — shadcn/ui (Radix) bridge.
3
+ *
4
+ * Maps the toast tokens onto the shadcn/ui CSS variables defined on `:root`
5
+ * / `.dark` (the classic HSL-channel convention: `--background: 0 0% 100%`
6
+ * consumed as `hsl(var(--background))`). Because it reads those vars live, the
7
+ * toast host automatically follows light/dark theme switches and accent changes.
8
+ *
9
+ * import '@rozie-ui/toast-react/themes/shadcn.css';
10
+ *
11
+ * If your shadcn setup predates the `hsl()`-wrapping convention (Tailwind v4 /
12
+ * oklch tokens emit pre-formed colors), drop the `hsl(...)` wrappers below.
13
+ */
14
+ .rozie-toaster {
15
+ --rozie-toast-color: hsl(var(--foreground, 222.2 84% 4.9%));
16
+ --rozie-toast-bg: hsl(var(--background, 0 0% 100%));
17
+ --rozie-toast-radius: var(--radius, 0.5rem);
18
+ --rozie-toast-shadow: 0 10px 38px -10px hsl(var(--foreground, 222.2 84% 4.9%) / 0.35), 0 10px 20px -15px hsl(var(--foreground, 222.2 84% 4.9%) / 0.2);
19
+
20
+ --rozie-toast-success-bg: hsl(142.1 76.2% 36.3%);
21
+ --rozie-toast-error-bg: hsl(var(--destructive, 0 84.2% 60.2%));
22
+ --rozie-toast-warning-bg: hsl(38 92% 50%);
23
+ --rozie-toast-info-bg: hsl(var(--muted, 210 40% 96.1%));
24
+
25
+ /* Radix's own Toast primitive animates fast (~150ms) — match that snap. */
26
+ --rozie-toast-enter-duration: 150ms;
27
+ --rozie-toast-exit-duration: 150ms;
28
+ --rozie-toast-spinner-color: hsl(var(--foreground, 222.2 84% 4.9%));
29
+ }