@devalok/shilp-sutra 0.37.1 → 0.38.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/MIGRATION.md +67 -0
- package/dist/_chunks/tiptap.js +977 -968
- package/dist/_chunks/tiptap.js.map +1 -1
- package/dist/composed/index.d.ts +0 -2
- package/dist/composed/index.d.ts.map +1 -1
- package/dist/composed/index.js +5 -6
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +0 -1
- package/dist/ui/alert.d.ts +1 -2
- package/dist/ui/alert.d.ts.map +1 -1
- package/dist/ui/alert.js +1 -27
- package/dist/ui/alert.js.map +1 -1
- package/dist/ui/banner.d.ts +3 -5
- package/dist/ui/banner.d.ts.map +1 -1
- package/dist/ui/banner.js +13 -13
- package/dist/ui/banner.js.map +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +2 -2
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/input.d.ts +1 -9
- package/dist/ui/input.d.ts.map +1 -1
- package/dist/ui/input.js +26 -27
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/segmented-control.d.ts +1 -1
- package/dist/ui/segmented-control.d.ts.map +1 -1
- package/dist/ui/segmented-control.js +2 -4
- package/dist/ui/segmented-control.js.map +1 -1
- package/docs/components/_header.md +1 -1
- package/docs/components/ui/alert.md +4 -1
- package/docs/components/ui/banner.md +3 -1
- package/docs/components/ui/input.md +4 -2
- package/docs/components/ui/segmented-control.md +13 -6
- package/docs/recipes/customize-brand.md +216 -0
- package/docs/recipes/index.md +51 -0
- package/docs/recipes/install-astro.md +178 -0
- package/docs/recipes/install-next-app-router.md +230 -0
- package/docs/recipes/install-next-pages.md +123 -0
- package/docs/recipes/install-remix.md +171 -0
- package/docs/recipes/install-tanstack-start.md +143 -0
- package/docs/recipes/install-vite.md +170 -0
- package/docs/recipes/server-components.md +209 -0
- package/docs/recipes/troubleshoot.md +217 -0
- package/llms-full.txt +26 -53
- package/llms.txt +33 -16
- package/package.json +45 -35
- package/dist/composed/responsive-overlay.d.ts +0 -23
- package/dist/composed/responsive-overlay.d.ts.map +0 -1
- package/dist/composed/responsive-overlay.js +0 -40
- package/dist/composed/responsive-overlay.js.map +0 -1
- package/dist/hooks/use-toast.d.ts +0 -17
- package/dist/hooks/use-toast.d.ts.map +0 -1
- package/dist/hooks/use-toast.js +0 -3
- package/dist/tailwind/index.cjs +0 -41
- package/dist/tailwind/index.d.ts +0 -2
- package/dist/tailwind/index.d.ts.map +0 -1
- package/dist/tailwind/index.js +0 -2
- package/dist/tailwind/preset.d.ts +0 -25
- package/dist/tailwind/preset.d.ts.map +0 -1
- package/dist/tailwind/preset.js +0 -17
- package/dist/tailwind/preset.js.map +0 -1
- package/docs/components/composed/responsive-overlay.md +0 -41
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Dialog as e, DialogContent as t, DialogDescription as n, DialogHeader as r, DialogTitle as i } from "../ui/dialog.js";
|
|
3
|
-
import { Sheet as a, SheetContent as o, SheetDescription as s, SheetHeader as c, SheetTitle as l } from "../ui/sheet.js";
|
|
4
|
-
import * as u from "react";
|
|
5
|
-
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
6
|
-
//#region src/composed/responsive-overlay.tsx
|
|
7
|
-
var p = {
|
|
8
|
-
sm: "640px",
|
|
9
|
-
md: "768px"
|
|
10
|
-
};
|
|
11
|
-
function m(e) {
|
|
12
|
-
let [t, n] = u.useState(!1);
|
|
13
|
-
return u.useEffect(() => {
|
|
14
|
-
if (typeof window > "u") return;
|
|
15
|
-
let t = window.matchMedia(`(max-width: ${p[e]})`);
|
|
16
|
-
n(t.matches);
|
|
17
|
-
let r = (e) => n(e.matches);
|
|
18
|
-
return t.addEventListener("change", r), () => t.removeEventListener("change", r);
|
|
19
|
-
}, [e]), t;
|
|
20
|
-
}
|
|
21
|
-
function h({ open: u, onOpenChange: p, title: h, description: g, breakpoint: _ = "md", children: v, className: y }) {
|
|
22
|
-
return m(_) ? /* @__PURE__ */ d(a, {
|
|
23
|
-
open: u,
|
|
24
|
-
onOpenChange: p,
|
|
25
|
-
children: /* @__PURE__ */ f(o, {
|
|
26
|
-
side: "bottom",
|
|
27
|
-
className: y,
|
|
28
|
-
children: [(h || g) && /* @__PURE__ */ f(c, { children: [h && /* @__PURE__ */ d(l, { children: h }), g && /* @__PURE__ */ d(s, { children: g })] }), v]
|
|
29
|
-
})
|
|
30
|
-
}) : /* @__PURE__ */ d(e, {
|
|
31
|
-
open: u,
|
|
32
|
-
onOpenChange: p,
|
|
33
|
-
children: /* @__PURE__ */ f(t, {
|
|
34
|
-
className: y,
|
|
35
|
-
children: [(h || g) && /* @__PURE__ */ f(r, { children: [h && /* @__PURE__ */ d(i, { children: h }), g && /* @__PURE__ */ d(n, { children: g })] }), v]
|
|
36
|
-
})
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
//#endregion
|
|
40
|
-
export { h as ResponsiveOverlay };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"responsive-overlay.js","names":[],"sources":["../../src/composed/responsive-overlay.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\n\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from '../ui/dialog'\nimport {\n Sheet,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetTitle,\n} from '../ui/sheet'\n\n// ============================================================\n// Types\n// ============================================================\n\n/**\n * @deprecated Dialog and Sheet now auto-adapt to mobile viewports.\n * Use Dialog directly (fullScreens on mobile) or Sheet directly (becomes bottom sheet on mobile).\n * This component will be removed in a future major version.\n */\nexport interface ResponsiveOverlayProps {\n open: boolean\n onOpenChange: (open: boolean) => void\n title?: string\n description?: string\n /** Below this breakpoint renders as bottom Sheet @default 'md' */\n breakpoint?: 'sm' | 'md'\n children: React.ReactNode\n className?: string\n}\n\n// ============================================================\n// Hook\n// ============================================================\n\nconst breakpointValues: Record<string, string> = {\n sm: '640px',\n md: '768px',\n}\n\nfunction useIsMobileOverlay(breakpoint: string): boolean {\n const [isMobile, setIsMobile] = React.useState(false)\n\n React.useEffect(() => {\n if (typeof window === 'undefined') return\n const mql = window.matchMedia(`(max-width: ${breakpointValues[breakpoint]})`)\n setIsMobile(mql.matches)\n const handler = (e: MediaQueryListEvent) => setIsMobile(e.matches)\n mql.addEventListener('change', handler)\n return () => mql.removeEventListener('change', handler)\n }, [breakpoint])\n\n return isMobile\n}\n\n// ============================================================\n// ResponsiveOverlay\n// ============================================================\n\n/**\n * @deprecated Use Dialog or Sheet directly — they are now individually mobile-responsive.\n */\nfunction ResponsiveOverlay({\n open,\n onOpenChange,\n title,\n description,\n breakpoint = 'md',\n children,\n className,\n}: ResponsiveOverlayProps) {\n const isMobile = useIsMobileOverlay(breakpoint)\n\n if (isMobile) {\n return (\n <Sheet open={open} onOpenChange={onOpenChange}>\n <SheetContent side=\"bottom\" className={className}>\n {(title || description) && (\n <SheetHeader>\n {title && <SheetTitle>{title}</SheetTitle>}\n {description && <SheetDescription>{description}</SheetDescription>}\n </SheetHeader>\n )}\n {children}\n </SheetContent>\n </Sheet>\n )\n }\n\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent className={className}>\n {(title || description) && (\n <DialogHeader>\n {title && <DialogTitle>{title}</DialogTitle>}\n {description && <DialogDescription>{description}</DialogDescription>}\n </DialogHeader>\n )}\n {children}\n </DialogContent>\n </Dialog>\n )\n}\n\nexport { ResponsiveOverlay }\n"],"mappings":";;;;;;AA2CA,IAAM,IAA2C;CAC/C,IAAI;CACJ,IAAI;CACL;AAED,SAAS,EAAmB,GAA6B;CACvD,IAAM,CAAC,GAAU,KAAe,EAAM,SAAS,GAAM;AAWrD,QATA,EAAM,gBAAgB;AACpB,MAAI,OAAO,SAAW,IAAa;EACnC,IAAM,IAAM,OAAO,WAAW,eAAe,EAAiB,GAAY,GAAG;AAC7E,IAAY,EAAI,QAAQ;EACxB,IAAM,KAAW,MAA2B,EAAY,EAAE,QAAQ;AAElE,SADA,EAAI,iBAAiB,UAAU,EAAQ,QAC1B,EAAI,oBAAoB,UAAU,EAAQ;IACtD,CAAC,EAAW,CAAC,EAET;;AAUT,SAAS,EAAkB,EACzB,SACA,iBACA,UACA,gBACA,gBAAa,MACb,aACA,gBACyB;AAmBzB,QAlBiB,EAAmB,EAAW,GAI3C,kBAAC,GAAD;EAAa;EAAoB;YAC/B,kBAAC,GAAD;GAAc,MAAK;GAAoB;aAAvC,EACI,KAAS,MACT,kBAAC,GAAD,EAAA,UAAA,CACG,KAAS,kBAAC,GAAD,EAAA,UAAa,GAAmB,CAAA,EACzC,KAAe,kBAAC,GAAD,EAAA,UAAmB,GAA+B,CAAA,CACtD,EAAA,CAAA,EAEf,EACY;;EACT,CAAA,GAKV,kBAAC,GAAD;EAAc;EAAoB;YAChC,kBAAC,GAAD;GAA0B;aAA1B,EACI,KAAS,MACT,kBAAC,GAAD,EAAA,UAAA,CACG,KAAS,kBAAC,GAAD,EAAA,UAAc,GAAoB,CAAA,EAC3C,KAAe,kBAAC,GAAD,EAAA,UAAoB,GAAgC,CAAA,CACvD,EAAA,CAAA,EAEhB,EACa;;EACT,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated Use `toast` directly from `@devalok/shilp-sutra/ui/toast` or `@devalok/shilp-sutra`.
|
|
4
|
-
* This module is provided for back-compatibility during migration.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* // New API (recommended):
|
|
8
|
-
* import { toast } from '@devalok/shilp-sutra'
|
|
9
|
-
* toast.success('Saved!')
|
|
10
|
-
*
|
|
11
|
-
* // Old API (deprecated):
|
|
12
|
-
* import { toast } from '@devalok/shilp-sutra/hooks/use-toast'
|
|
13
|
-
* toast('Something happened')
|
|
14
|
-
*/
|
|
15
|
-
export { toast } from '../ui/toast';
|
|
16
|
-
export type { ToastActionOptions, ToastOptions, ToastType, ToastUndoOptions, ToastUploadOptions, UploadFile, } from '../ui/toast-types';
|
|
17
|
-
//# sourceMappingURL=use-toast.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-toast.d.ts","sourceRoot":"","sources":["../../src/hooks/use-toast.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,GACX,MAAM,mBAAmB,CAAA"}
|
package/dist/hooks/use-toast.js
DELETED
package/dist/tailwind/index.cjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var preset_exports = {};
|
|
20
|
-
__export(preset_exports, {
|
|
21
|
-
default: () => e
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(preset_exports);
|
|
24
|
-
var e = {}, t = false;
|
|
25
|
-
function n() {
|
|
26
|
-
if (t) return;
|
|
27
|
-
t = true;
|
|
28
|
-
let e2 = '\n\u26A0\uFE0F [@devalok/shilp-sutra] DEPRECATION: The JS preset at "./tailwind" is deprecated in 0.37.0 and will be removed in 0.38.0.\n\nEvery class utility you relied on from this preset (bg-surface-raised, p-ds-04, shadow-raised, text-ds-md, etc.) is now emitted zero CSS by Tailwind 4. Your app will ship unstyled unless you migrate.\n\nReplace:\n // tailwind.config.ts\n import shilpSutra from "@devalok/shilp-sutra/tailwind"\n export default { presets: [shilpSutra], content: [...] }\n\nwith:\n // app/globals.css\n @import "tailwindcss";\n @import "@devalok/shilp-sutra/css";\n\nFull guide: https://github.com/devalok-design/shilp-sutra/blob/main/MIGRATION.md\n';
|
|
29
|
-
try {
|
|
30
|
-
if (typeof process < "u" && typeof process.stderr?.write == "function") {
|
|
31
|
-
process.stderr.write(e2);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
} catch {
|
|
35
|
-
}
|
|
36
|
-
console.warn(e2);
|
|
37
|
-
}
|
|
38
|
-
n();
|
|
39
|
-
|
|
40
|
-
module.exports = module.exports.default;
|
|
41
|
-
module.exports.default = module.exports;
|
package/dist/tailwind/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tailwind/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/tailwind/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Config } from 'tailwindcss';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated Since 0.37.0. Tailwind 4 uses CSS-first configuration via
|
|
4
|
-
* `@theme`, `@utility`, and `@custom-variant`, not JavaScript presets.
|
|
5
|
-
*
|
|
6
|
-
* Migrate to:
|
|
7
|
-
*
|
|
8
|
-
* ```css
|
|
9
|
-
* // app/globals.css
|
|
10
|
-
* @import "tailwindcss";
|
|
11
|
-
* @import "@devalok/shilp-sutra/css";
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* And delete your `tailwind.config.ts` (or shrink it to whatever your own
|
|
15
|
-
* app needs — we no longer ask you to reference our preset).
|
|
16
|
-
*
|
|
17
|
-
* This export remains as a typed no-op so in-flight consumer code that
|
|
18
|
-
* still imports it doesn't crash at import time. Scheduled for removal
|
|
19
|
-
* in 0.38.0.
|
|
20
|
-
*
|
|
21
|
-
* See MIGRATION.md at the repo root for the full 0.36 → 0.37 walkthrough.
|
|
22
|
-
*/
|
|
23
|
-
declare const preset: Partial<Config>;
|
|
24
|
-
export default preset;
|
|
25
|
-
//# sourceMappingURL=preset.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../../src/tailwind/preset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,MAAM,EAAE,OAAO,CAAC,MAAM,CAAM,CAAA;AA8DlC,eAAe,MAAM,CAAA"}
|
package/dist/tailwind/preset.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
//#region src/tailwind/preset.ts
|
|
2
|
-
var e = {}, t = !1;
|
|
3
|
-
function n() {
|
|
4
|
-
if (t) return;
|
|
5
|
-
t = !0;
|
|
6
|
-
let e = "\n⚠️ [@devalok/shilp-sutra] DEPRECATION: The JS preset at \"./tailwind\" is deprecated in 0.37.0 and will be removed in 0.38.0.\n\nEvery class utility you relied on from this preset (bg-surface-raised, p-ds-04, shadow-raised, text-ds-md, etc.) is now emitted zero CSS by Tailwind 4. Your app will ship unstyled unless you migrate.\n\nReplace:\n // tailwind.config.ts\n import shilpSutra from \"@devalok/shilp-sutra/tailwind\"\n export default { presets: [shilpSutra], content: [...] }\n\nwith:\n // app/globals.css\n @import \"tailwindcss\";\n @import \"@devalok/shilp-sutra/css\";\n\nFull guide: https://github.com/devalok-design/shilp-sutra/blob/main/MIGRATION.md\n";
|
|
7
|
-
try {
|
|
8
|
-
if (typeof process < "u" && typeof process.stderr?.write == "function") {
|
|
9
|
-
process.stderr.write(e);
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
} catch {}
|
|
13
|
-
console.warn(e);
|
|
14
|
-
}
|
|
15
|
-
n();
|
|
16
|
-
//#endregion
|
|
17
|
-
export { e as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"preset.js","names":[],"sources":["../../src/tailwind/preset.ts"],"sourcesContent":["import type { Config } from 'tailwindcss'\n\n/**\n * @deprecated Since 0.37.0. Tailwind 4 uses CSS-first configuration via\n * `@theme`, `@utility`, and `@custom-variant`, not JavaScript presets.\n *\n * Migrate to:\n *\n * ```css\n * // app/globals.css\n * @import \"tailwindcss\";\n * @import \"@devalok/shilp-sutra/css\";\n * ```\n *\n * And delete your `tailwind.config.ts` (or shrink it to whatever your own\n * app needs — we no longer ask you to reference our preset).\n *\n * This export remains as a typed no-op so in-flight consumer code that\n * still imports it doesn't crash at import time. Scheduled for removal\n * in 0.38.0.\n *\n * See MIGRATION.md at the repo root for the full 0.36 → 0.37 walkthrough.\n */\nconst preset: Partial<Config> = {}\n\n// Emit a one-time deprecation warning so consumers on the old JS-preset\n// setup discover the migration via their build output — not via silent\n// visual breakage in production.\n//\n// Critical: the warning fires in ALL environments including `next build`\n// (NODE_ENV=production). Gating this on NODE_ENV would defeat the whole\n// point — the consumer most likely to ship broken CSS (CI-only pipeline,\n// no local dev loop) is exactly the one who would never see a dev-only\n// warn. Audited 0.37.0-pre-RC; see post-audit commit message.\n//\n// Written to stderr directly (not console.warn) so it survives Next's\n// output filters which can silence console calls during `next build`.\n// Inline process shim so we don't need @types/node in packages/core's\n// tsconfig (typecheck runs with types: []).\ndeclare const process:\n | {\n env?: { NODE_ENV?: string }\n stderr?: { write: (s: string) => void }\n }\n | undefined\nlet warned = false\nfunction emitDeprecationNotice(): void {\n if (warned) return\n warned = true\n const msg =\n '\\n' +\n '⚠️ [@devalok/shilp-sutra] DEPRECATION: The JS preset at \"./tailwind\" is ' +\n 'deprecated in 0.37.0 and will be removed in 0.38.0.\\n\\n' +\n 'Every class utility you relied on from this preset (bg-surface-raised, ' +\n 'p-ds-04, shadow-raised, text-ds-md, etc.) is now emitted zero CSS by ' +\n 'Tailwind 4. Your app will ship unstyled unless you migrate.\\n\\n' +\n 'Replace:\\n' +\n ' // tailwind.config.ts\\n' +\n ' import shilpSutra from \"@devalok/shilp-sutra/tailwind\"\\n' +\n ' export default { presets: [shilpSutra], content: [...] }\\n\\n' +\n 'with:\\n' +\n ' // app/globals.css\\n' +\n ' @import \"tailwindcss\";\\n' +\n ' @import \"@devalok/shilp-sutra/css\";\\n\\n' +\n 'Full guide: https://github.com/devalok-design/shilp-sutra/blob/main/MIGRATION.md\\n'\n\n // Prefer process.stderr for CI visibility; fall back to console.warn\n // in environments where process is not available (browsers, Edge runtime).\n try {\n if (\n typeof process !== 'undefined' &&\n typeof process.stderr?.write === 'function'\n ) {\n process.stderr.write(msg)\n return\n }\n } catch {\n // Fall through to console.warn.\n }\n \n console.warn(msg)\n}\n// Fire when the module is imported (ESM evaluates module body once).\nemitDeprecationNotice()\n\nexport default preset\n"],"mappings":";AAuBA,IAAM,IAA0B,EAAE,EAsB9B,IAAS;AACb,SAAS,IAA8B;AACrC,KAAI,EAAQ;AACZ,KAAS;CACT,IAAM,IACJ;AAkBF,KAAI;AACF,MACE,OAAO,UAAY,OACnB,OAAO,QAAQ,QAAQ,SAAU,YACjC;AACA,WAAQ,OAAO,MAAM,EAAI;AACzB;;SAEI;AAIR,SAAQ,KAAK,EAAI;;AAGnB,GAAuB"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# ResponsiveOverlay
|
|
2
|
-
|
|
3
|
-
- Import: @devalok/shilp-sutra/composed/responsive-overlay
|
|
4
|
-
- Server-safe: No
|
|
5
|
-
- Category: composed
|
|
6
|
-
|
|
7
|
-
## Props
|
|
8
|
-
open: boolean
|
|
9
|
-
onOpenChange: (open: boolean) => void
|
|
10
|
-
title: string
|
|
11
|
-
description: string
|
|
12
|
-
breakpoint: "sm" | "md" (below this renders as bottom Sheet; above as Dialog)
|
|
13
|
-
children: ReactNode
|
|
14
|
-
className: string
|
|
15
|
-
|
|
16
|
-
## Defaults
|
|
17
|
-
breakpoint="md"
|
|
18
|
-
|
|
19
|
-
## Example
|
|
20
|
-
```jsx
|
|
21
|
-
<ResponsiveOverlay
|
|
22
|
-
open={open}
|
|
23
|
-
onOpenChange={setOpen}
|
|
24
|
-
title="Edit task"
|
|
25
|
-
description="Update the task details"
|
|
26
|
-
>
|
|
27
|
-
<TaskForm />
|
|
28
|
-
</ResponsiveOverlay>
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Composability
|
|
32
|
-
- **One component, two containers.** Above `breakpoint`: centered Dialog. Below: bottom-anchored Sheet. Same content slot, different surface treatment per viewport.
|
|
33
|
-
- **Standard controlled model** — `open` + `onOpenChange` (same shape as Dialog/Sheet).
|
|
34
|
-
- **title + description pattern** — matches Dialog/Sheet's requirement for an accessible heading. Omit both only when the surrounding context makes the purpose obvious (rare).
|
|
35
|
-
- **SSR caveat:** `window.matchMedia` reads on mount — initial SSR render defaults to desktop (Dialog). Hydration flips to Sheet on mobile. Acceptable for most flows; visible layout shift on low-spec devices.
|
|
36
|
-
- **When to use:** Any modal that needs to behave differently on mobile (edit dialogs, filter panels, quick-action menus). For always-the-same behavior, use Dialog or Sheet directly.
|
|
37
|
-
|
|
38
|
-
## Gotchas
|
|
39
|
-
- Renders a centered Dialog on desktop and a bottom Sheet on mobile — same content, different container
|
|
40
|
-
- Uses `window.matchMedia` internally — SSR defaults to desktop (Dialog) until hydration
|
|
41
|
-
- Title and description are optional; if omitted, no header is rendered in either mode
|