@still-void/ui 3.5.1 → 3.6.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/CHANGELOG.md +65 -0
- package/README.md +36 -0
- package/dist/css/app-shell.css +129 -0
- package/dist/css/base.css +27 -0
- package/dist/css/content.css +726 -0
- package/dist/css/controls.css +383 -0
- package/dist/css/data.css +190 -0
- package/dist/css/forms.css +318 -0
- package/dist/css/motion.css +49 -0
- package/dist/css/overlays.css +488 -0
- package/dist/css/toast.css +170 -0
- package/dist/react/_modules/behaviors/themeManager.js +10 -0
- package/dist/react/_modules/behaviors/themeManager.js.map +1 -0
- package/dist/react/_modules/components/ui/alert.js +14 -0
- package/dist/react/_modules/components/ui/alert.js.map +1 -0
- package/dist/react/_modules/components/ui/badge.js +9 -0
- package/dist/react/_modules/components/ui/badge.js.map +1 -0
- package/dist/react/_modules/components/ui/button.js +9 -0
- package/dist/react/_modules/components/ui/button.js.map +1 -0
- package/dist/react/_modules/components/ui/card.js +19 -0
- package/dist/react/_modules/components/ui/card.js.map +1 -0
- package/dist/react/_modules/components/ui/chart.js +18 -0
- package/dist/react/_modules/components/ui/chart.js.map +1 -0
- package/dist/react/_modules/components/ui/checkbox.js +8 -0
- package/dist/react/_modules/components/ui/checkbox.js.map +1 -0
- package/dist/react/_modules/components/ui/field.js +9 -0
- package/dist/react/_modules/components/ui/field.js.map +1 -0
- package/dist/react/_modules/components/ui/file-input.js +10 -0
- package/dist/react/_modules/components/ui/file-input.js.map +1 -0
- package/dist/react/_modules/components/ui/icon-set.js +11 -0
- package/dist/react/_modules/components/ui/icon-set.js.map +1 -0
- package/dist/react/_modules/components/ui/icon.js +9 -0
- package/dist/react/_modules/components/ui/icon.js.map +1 -0
- package/dist/react/_modules/components/ui/input.js +10 -0
- package/dist/react/_modules/components/ui/input.js.map +1 -0
- package/dist/react/_modules/components/ui/native-select.js +10 -0
- package/dist/react/_modules/components/ui/native-select.js.map +1 -0
- package/dist/react/_modules/components/ui/pagination.js +23 -0
- package/dist/react/_modules/components/ui/pagination.js.map +1 -0
- package/dist/react/_modules/components/ui/progress.js +8 -0
- package/dist/react/_modules/components/ui/progress.js.map +1 -0
- package/dist/react/_modules/components/ui/radio-group.js +12 -0
- package/dist/react/_modules/components/ui/radio-group.js.map +1 -0
- package/dist/react/_modules/components/ui/separator.js +8 -0
- package/dist/react/_modules/components/ui/separator.js.map +1 -0
- package/dist/react/_modules/components/ui/slot.js +7 -0
- package/dist/react/_modules/components/ui/slot.js.map +1 -0
- package/dist/react/_modules/components/ui/table.js +23 -0
- package/dist/react/_modules/components/ui/table.js.map +1 -0
- package/dist/react/_modules/components/ui/text-link.js +10 -0
- package/dist/react/_modules/components/ui/text-link.js.map +1 -0
- package/dist/react/_modules/components/ui/textarea.js +10 -0
- package/dist/react/_modules/components/ui/textarea.js.map +1 -0
- package/dist/react/_modules/lib/safe-href.js +9 -0
- package/dist/react/_modules/lib/safe-href.js.map +1 -0
- package/dist/react/_modules/lib/utils.js +7 -0
- package/dist/react/_modules/lib/utils.js.map +1 -0
- package/dist/react/_modules/react/components/Article.js +17 -0
- package/dist/react/_modules/react/components/Article.js.map +1 -0
- package/dist/react/_modules/react/components/Content.js +30 -0
- package/dist/react/_modules/react/components/Content.js.map +1 -0
- package/dist/react/_modules/react/components/PageHeader.js +8 -0
- package/dist/react/_modules/react/components/PageHeader.js.map +1 -0
- package/dist/react/_modules/react/components/Shell.js +17 -0
- package/dist/react/_modules/react/components/Shell.js.map +1 -0
- package/dist/react/_modules/react/components/ThemeScript.js +9 -0
- package/dist/react/_modules/react/components/ThemeScript.js.map +1 -0
- package/dist/react/_modules/recipes/article.js +34 -0
- package/dist/react/_modules/recipes/article.js.map +1 -0
- package/dist/react/_modules/recipes/content.js +34 -0
- package/dist/react/_modules/recipes/content.js.map +1 -0
- package/dist/react/_modules/recipes/cx.js +7 -0
- package/dist/react/_modules/recipes/cx.js.map +1 -0
- package/dist/react/_modules/recipes/field.js +12 -0
- package/dist/react/_modules/recipes/field.js.map +1 -0
- package/dist/react/_modules/recipes/shell.js +18 -0
- package/dist/react/_modules/recipes/shell.js.map +1 -0
- package/dist/react/_modules/recipes/table.js +9 -0
- package/dist/react/_modules/recipes/table.js.map +1 -0
- package/dist/react/_modules/tokens/categories.js +12 -0
- package/dist/react/_modules/tokens/categories.js.map +1 -0
- package/dist/react/_modules/tokens/colors.js +23 -0
- package/dist/react/_modules/tokens/colors.js.map +1 -0
- package/dist/react/_modules/tokens/motion.js +9 -0
- package/dist/react/_modules/tokens/motion.js.map +1 -0
- package/dist/react/_modules/tokens/spacing.js +9 -0
- package/dist/react/_modules/tokens/spacing.js.map +1 -0
- package/dist/react/_modules/tokens/typography.js +15 -0
- package/dist/react/_modules/tokens/typography.js.map +1 -0
- package/dist/react/_modules/tokens/zIndex.js +7 -0
- package/dist/react/_modules/tokens/zIndex.js.map +1 -0
- package/dist/react/chunk-2QRW4J2C.js +29 -0
- package/dist/react/chunk-2QRW4J2C.js.map +1 -0
- package/dist/react/chunk-3BWBG3BR.js +82 -0
- package/dist/react/chunk-3BWBG3BR.js.map +1 -0
- package/dist/react/chunk-563PKHIJ.js +48 -0
- package/dist/react/chunk-563PKHIJ.js.map +1 -0
- package/dist/react/chunk-5RPXXOD7.js +50 -0
- package/dist/react/chunk-5RPXXOD7.js.map +1 -0
- package/dist/react/chunk-6PF2SFKH.js +54 -0
- package/dist/react/chunk-6PF2SFKH.js.map +1 -0
- package/dist/react/chunk-7JIE3YAY.js +109 -0
- package/dist/react/chunk-7JIE3YAY.js.map +1 -0
- package/dist/react/chunk-7ZVSFBDK.js +26 -0
- package/dist/react/chunk-7ZVSFBDK.js.map +1 -0
- package/dist/react/chunk-AVAJOAL5.js +10 -0
- package/dist/react/chunk-AVAJOAL5.js.map +1 -0
- package/dist/react/chunk-BXKXO6FU.js +34 -0
- package/dist/react/chunk-BXKXO6FU.js.map +1 -0
- package/dist/react/chunk-CN3PNEZL.js +80 -0
- package/dist/react/chunk-CN3PNEZL.js.map +1 -0
- package/dist/react/chunk-EHJDOUXR.js +144 -0
- package/dist/react/chunk-EHJDOUXR.js.map +1 -0
- package/dist/react/chunk-FX2E23UV.js +28 -0
- package/dist/react/chunk-FX2E23UV.js.map +1 -0
- package/dist/react/chunk-GYGMM6RW.js +20 -0
- package/dist/react/chunk-GYGMM6RW.js.map +1 -0
- package/dist/react/chunk-H7DEOO3V.js +29 -0
- package/dist/react/chunk-H7DEOO3V.js.map +1 -0
- package/dist/react/chunk-HD7O5FNH.js +39 -0
- package/dist/react/chunk-HD7O5FNH.js.map +1 -0
- package/dist/react/chunk-HYLCMS2U.js +28 -0
- package/dist/react/chunk-HYLCMS2U.js.map +1 -0
- package/dist/react/chunk-HYXG2WF4.js +73 -0
- package/dist/react/chunk-HYXG2WF4.js.map +1 -0
- package/dist/react/chunk-KQK7SZ3K.js +52 -0
- package/dist/react/chunk-KQK7SZ3K.js.map +1 -0
- package/dist/react/chunk-KQZBK3XX.js +24 -0
- package/dist/react/chunk-KQZBK3XX.js.map +1 -0
- package/dist/react/chunk-L6WPFLSD.js +39 -0
- package/dist/react/chunk-L6WPFLSD.js.map +1 -0
- package/dist/react/chunk-LOVNG6RF.js +9 -0
- package/dist/react/chunk-LOVNG6RF.js.map +1 -0
- package/dist/react/chunk-M5FFVQKK.js +41 -0
- package/dist/react/chunk-M5FFVQKK.js.map +1 -0
- package/dist/react/chunk-MZEFPODP.js +77 -0
- package/dist/react/chunk-MZEFPODP.js.map +1 -0
- package/dist/react/chunk-NJQN37EG.js +37 -0
- package/dist/react/chunk-NJQN37EG.js.map +1 -0
- package/dist/react/chunk-OEFJMV7G.js +144 -0
- package/dist/react/chunk-OEFJMV7G.js.map +1 -0
- package/dist/react/chunk-P4M4LEI2.js +62 -0
- package/dist/react/chunk-P4M4LEI2.js.map +1 -0
- package/dist/react/chunk-PGDHKADW.js +60 -0
- package/dist/react/chunk-PGDHKADW.js.map +1 -0
- package/dist/react/chunk-QTVPXQ43.js +29 -0
- package/dist/react/chunk-QTVPXQ43.js.map +1 -0
- package/dist/react/chunk-QVOZHMVF.js +14 -0
- package/dist/react/chunk-QVOZHMVF.js.map +1 -0
- package/dist/react/chunk-SJ2YK4NJ.js +27 -0
- package/dist/react/chunk-SJ2YK4NJ.js.map +1 -0
- package/dist/react/chunk-SSMGCYPH.js +79 -0
- package/dist/react/chunk-SSMGCYPH.js.map +1 -0
- package/dist/react/chunk-SUT4G3TE.js +29 -0
- package/dist/react/chunk-SUT4G3TE.js.map +1 -0
- package/dist/react/chunk-SVLIJGBZ.js +14 -0
- package/dist/react/chunk-SVLIJGBZ.js.map +1 -0
- package/dist/react/chunk-SY7EEIC3.js +100 -0
- package/dist/react/chunk-SY7EEIC3.js.map +1 -0
- package/dist/react/chunk-TI3OPDCN.js +25 -0
- package/dist/react/chunk-TI3OPDCN.js.map +1 -0
- package/dist/react/chunk-U6L6J73Y.js +27 -0
- package/dist/react/chunk-U6L6J73Y.js.map +1 -0
- package/dist/react/chunk-VD5O66DN.js +54 -0
- package/dist/react/chunk-VD5O66DN.js.map +1 -0
- package/dist/react/chunk-YDGOXO6Q.js +74 -0
- package/dist/react/chunk-YDGOXO6Q.js.map +1 -0
- package/dist/react/chunk-YTTFCX3E.js +16 -0
- package/dist/react/chunk-YTTFCX3E.js.map +1 -0
- package/dist/react/chunk-YXV3UEL5.js +27 -0
- package/dist/react/chunk-YXV3UEL5.js.map +1 -0
- package/dist/react/client/_modules/behaviors/clipboard.js +8 -0
- package/dist/react/client/_modules/behaviors/clipboard.js.map +1 -0
- package/dist/react/client/_modules/behaviors/mediaQuery.js +8 -0
- package/dist/react/client/_modules/behaviors/mediaQuery.js.map +1 -0
- package/dist/react/client/_modules/behaviors/readingProgress.js +10 -0
- package/dist/react/client/_modules/behaviors/readingProgress.js.map +1 -0
- package/dist/react/client/_modules/behaviors/scrollSpy.js +8 -0
- package/dist/react/client/_modules/behaviors/scrollSpy.js.map +1 -0
- package/dist/react/client/_modules/behaviors/themeManager.js +11 -0
- package/dist/react/client/_modules/behaviors/themeManager.js.map +1 -0
- package/dist/react/client/_modules/components/ui/alert-dialog.js +30 -0
- package/dist/react/client/_modules/components/ui/alert-dialog.js.map +1 -0
- package/dist/react/client/_modules/components/ui/bottom-sheet.js +28 -0
- package/dist/react/client/_modules/components/ui/bottom-sheet.js.map +1 -0
- package/dist/react/client/_modules/components/ui/combobox.js +13 -0
- package/dist/react/client/_modules/components/ui/combobox.js.map +1 -0
- package/dist/react/client/_modules/components/ui/dialog.js +30 -0
- package/dist/react/client/_modules/components/ui/dialog.js.map +1 -0
- package/dist/react/client/_modules/components/ui/dropdown-menu.js +39 -0
- package/dist/react/client/_modules/components/ui/dropdown-menu.js.map +1 -0
- package/dist/react/client/_modules/components/ui/icon-set.js +12 -0
- package/dist/react/client/_modules/components/ui/icon-set.js.map +1 -0
- package/dist/react/client/_modules/components/ui/icon.js +10 -0
- package/dist/react/client/_modules/components/ui/icon.js.map +1 -0
- package/dist/react/client/_modules/components/ui/restore-focus.js +8 -0
- package/dist/react/client/_modules/components/ui/restore-focus.js.map +1 -0
- package/dist/react/client/_modules/components/ui/select.js +29 -0
- package/dist/react/client/_modules/components/ui/select.js.map +1 -0
- package/dist/react/client/_modules/components/ui/tabs.js +15 -0
- package/dist/react/client/_modules/components/ui/tabs.js.map +1 -0
- package/dist/react/client/_modules/components/ui/tooltip.js +15 -0
- package/dist/react/client/_modules/components/ui/tooltip.js.map +1 -0
- package/dist/react/client/_modules/lib/utils.js +8 -0
- package/dist/react/client/_modules/lib/utils.js.map +1 -0
- package/dist/react/client/_modules/react/client/CopyButton.js +11 -0
- package/dist/react/client/_modules/react/client/CopyButton.js.map +1 -0
- package/dist/react/client/_modules/react/client/ReadingProgress.js +14 -0
- package/dist/react/client/_modules/react/client/ReadingProgress.js.map +1 -0
- package/dist/react/client/_modules/react/client/SidebarProvider.js +26 -0
- package/dist/react/client/_modules/react/client/SidebarProvider.js.map +1 -0
- package/dist/react/client/_modules/react/client/TableOfContents.js +14 -0
- package/dist/react/client/_modules/react/client/TableOfContents.js.map +1 -0
- package/dist/react/client/_modules/react/client/ThemeProvider.js +12 -0
- package/dist/react/client/_modules/react/client/ThemeProvider.js.map +1 -0
- package/dist/react/client/_modules/react/client/ThemeToggle.js +14 -0
- package/dist/react/client/_modules/react/client/ThemeToggle.js.map +1 -0
- package/dist/react/client/_modules/react/client/ToastProvider.js +14 -0
- package/dist/react/client/_modules/react/client/ToastProvider.js.map +1 -0
- package/dist/react/client/_modules/react/client/hooks.js +17 -0
- package/dist/react/client/_modules/react/client/hooks.js.map +1 -0
- package/dist/react/client/_modules/react/client/shadcn.js +160 -0
- package/dist/react/client/_modules/react/client/shadcn.js.map +1 -0
- package/dist/react/client/_modules/recipes/article.js +35 -0
- package/dist/react/client/_modules/recipes/article.js.map +1 -0
- package/dist/react/client/_modules/recipes/cx.js +8 -0
- package/dist/react/client/_modules/recipes/cx.js.map +1 -0
- package/dist/react/client/_modules/recipes/field.js +13 -0
- package/dist/react/client/_modules/recipes/field.js.map +1 -0
- package/dist/react/client/_modules/tokens/colors.js +24 -0
- package/dist/react/client/_modules/tokens/colors.js.map +1 -0
- package/dist/react/client/chunk-3MVZ2ES4.js +83 -0
- package/dist/react/client/chunk-3MVZ2ES4.js.map +1 -0
- package/dist/react/client/chunk-7AU2DPOL.js +35 -0
- package/dist/react/client/chunk-7AU2DPOL.js.map +1 -0
- package/dist/react/client/chunk-ABWCVXOO.js +11 -0
- package/dist/react/client/chunk-ABWCVXOO.js.map +1 -0
- package/dist/react/client/chunk-AEXJWMUV.js +52 -0
- package/dist/react/client/chunk-AEXJWMUV.js.map +1 -0
- package/dist/react/client/chunk-CJQZ4BGO.js +125 -0
- package/dist/react/client/chunk-CJQZ4BGO.js.map +1 -0
- package/dist/react/client/chunk-CMMPIPNC.js +30 -0
- package/dist/react/client/chunk-CMMPIPNC.js.map +1 -0
- package/dist/react/client/chunk-CWA3N5RK.js +123 -0
- package/dist/react/client/chunk-CWA3N5RK.js.map +1 -0
- package/dist/react/client/chunk-ECOPTUZT.js +102 -0
- package/dist/react/client/chunk-ECOPTUZT.js.map +1 -0
- package/dist/react/client/chunk-GD7XJWKF.js +102 -0
- package/dist/react/client/chunk-GD7XJWKF.js.map +1 -0
- package/dist/react/client/chunk-JVVNV4DF.js +95 -0
- package/dist/react/client/chunk-JVVNV4DF.js.map +1 -0
- package/dist/react/client/chunk-LDOUB5IA.js +40 -0
- package/dist/react/client/chunk-LDOUB5IA.js.map +1 -0
- package/dist/react/client/chunk-M5QFSQYC.js +40 -0
- package/dist/react/client/chunk-M5QFSQYC.js.map +1 -0
- package/dist/react/client/chunk-MGR4F2BJ.js +67 -0
- package/dist/react/client/chunk-MGR4F2BJ.js.map +1 -0
- package/dist/react/client/chunk-MYTOL2RH.js +61 -0
- package/dist/react/client/chunk-MYTOL2RH.js.map +1 -0
- package/dist/react/client/chunk-N64GC5ZU.js +12 -0
- package/dist/react/client/chunk-N64GC5ZU.js.map +1 -0
- package/dist/react/client/chunk-NEAL74VV.js +130 -0
- package/dist/react/client/chunk-NEAL74VV.js.map +1 -0
- package/dist/react/client/chunk-OF6BMW2X.js +30 -0
- package/dist/react/client/chunk-OF6BMW2X.js.map +1 -0
- package/dist/react/client/chunk-OILITPDP.js +72 -0
- package/dist/react/client/chunk-OILITPDP.js.map +1 -0
- package/dist/react/client/chunk-OU4ACOFA.js +75 -0
- package/dist/react/client/chunk-OU4ACOFA.js.map +1 -0
- package/dist/react/client/chunk-OVMH25G3.js +23 -0
- package/dist/react/client/chunk-OVMH25G3.js.map +1 -0
- package/dist/react/client/chunk-P2UPL6Y3.js +205 -0
- package/dist/react/client/chunk-P2UPL6Y3.js.map +1 -0
- package/dist/react/client/chunk-PAOYY55O.js +41 -0
- package/dist/react/client/chunk-PAOYY55O.js.map +1 -0
- package/dist/react/client/chunk-PYG5NCEU.js +54 -0
- package/dist/react/client/chunk-PYG5NCEU.js.map +1 -0
- package/dist/react/client/chunk-RCZS37V5.js +239 -0
- package/dist/react/client/chunk-RCZS37V5.js.map +1 -0
- package/dist/react/client/chunk-RJFN4KXE.js +36 -0
- package/dist/react/client/chunk-RJFN4KXE.js.map +1 -0
- package/dist/react/client/chunk-RNMQZ6T2.js +62 -0
- package/dist/react/client/chunk-RNMQZ6T2.js.map +1 -0
- package/dist/react/client/chunk-TXL2US4Z.js +53 -0
- package/dist/react/client/chunk-TXL2US4Z.js.map +1 -0
- package/dist/react/client/chunk-U6FMZ32G.js +192 -0
- package/dist/react/client/chunk-U6FMZ32G.js.map +1 -0
- package/dist/react/client/chunk-WR7KQGBM.js +2 -0
- package/dist/react/client/chunk-WR7KQGBM.js.map +1 -0
- package/dist/react/client/chunk-XHL4YEVA.js +17 -0
- package/dist/react/client/chunk-XHL4YEVA.js.map +1 -0
- package/dist/react/client/index.cjs +400 -81
- package/dist/react/client/index.cjs.map +1 -1
- package/dist/react/client/index.d.cts +86 -5
- package/dist/react/client/index.d.ts +86 -5
- package/dist/react/client/index.js +141 -1426
- package/dist/react/client/index.js.map +1 -1
- package/dist/react/index.cjs +368 -183
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +202 -23
- package/dist/react/index.d.ts +202 -23
- package/dist/react/index.js +206 -1231
- package/dist/react/index.js.map +1 -1
- package/dist/shadcn-overrides.css +27 -13
- package/dist/style.css +301 -19
- package/dist/theme.css +73 -24
- package/package.json +36 -6
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-AVAJOAL5.js";
|
|
4
|
+
|
|
5
|
+
// src/components/ui/progress.tsx
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
function clamp(value, max) {
|
|
9
|
+
return Math.min(Math.max(value, 0), max);
|
|
10
|
+
}
|
|
11
|
+
function normalizeMax(max) {
|
|
12
|
+
return Number.isFinite(max) && max > 0 ? max : 0;
|
|
13
|
+
}
|
|
14
|
+
var Progress = React.forwardRef(
|
|
15
|
+
({ className, value = 0, max = 100, ...props }, ref) => {
|
|
16
|
+
const safeMax = normalizeMax(max);
|
|
17
|
+
const clamped = clamp(value, safeMax);
|
|
18
|
+
const percent = safeMax === 0 ? 0 : clamped / safeMax * 100;
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
...props,
|
|
23
|
+
ref,
|
|
24
|
+
role: "progressbar",
|
|
25
|
+
"aria-valuenow": clamped,
|
|
26
|
+
"aria-valuemin": 0,
|
|
27
|
+
"aria-valuemax": safeMax,
|
|
28
|
+
className: cn("sv-progress", className),
|
|
29
|
+
children: /* @__PURE__ */ jsx("div", { className: "sv-progress__indicator", style: { width: `${percent}%` } })
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
Progress.displayName = "Progress";
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
Progress
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=chunk-L6WPFLSD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/ui/progress.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { cn } from \"../../lib/utils\"\n\nexport interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Current amount. Clamped to `[0, max]` — never renders past the track. */\n value?: number\n /** Ceiling `value` is measured against. Library default is `100` — not a claim of native `<progress>` parity (that element defaults `max` to `1` and treats an omitted `value` as indeterminate; this component always renders a determinate `value`). */\n max?: number\n}\n\n/** `value`/`max` clamped into `[0, max]`, so an out-of-range input never overflows the track. */\nfunction clamp(value: number, max: number): number {\n return Math.min(Math.max(value, 0), max)\n}\n\n/**\n * A negative, `NaN` or `Infinity` `max` would otherwise produce an invalid\n * ARIA range (`aria-valuemin` > `aria-valuemax`) or a nonsensical 100%\n * indicator (`clamp(0, -10)` returns `-10`, not `0`) — normalize to a finite,\n * non-negative ceiling before it reaches `clamp`/`aria-valuemax`.\n */\nfunction normalizeMax(max: number): number {\n return Number.isFinite(max) && max > 0 ? max : 0\n}\n\nconst Progress = React.forwardRef<HTMLDivElement, ProgressProps>(\n ({ className, value = 0, max = 100, ...props }, ref) => {\n const safeMax = normalizeMax(max)\n const clamped = clamp(value, safeMax)\n const percent = safeMax === 0 ? 0 : (clamped / safeMax) * 100\n\n return (\n <div\n {...props}\n ref={ref}\n // Spread before, not after: the ARIA range this component computes\n // from value/max must not be overridable by a stray\n // role/aria-valuenow/aria-valuemin/aria-valuemax the caller passes\n // through `...props` — same reasoning as DialogContent's aria-modal.\n role=\"progressbar\"\n aria-valuenow={clamped}\n aria-valuemin={0}\n aria-valuemax={safeMax}\n className={cn(\"sv-progress\", className)}\n >\n <div className=\"sv-progress__indicator\" style={{ width: `${percent}%` }} />\n </div>\n )\n },\n)\nProgress.displayName = \"Progress\"\n\nexport { Progress }\n"],"mappings":";;;;;AAAA,YAAY,WAAW;AA6Cf;AAlCR,SAAS,MAAM,OAAe,KAAqB;AACjD,SAAO,KAAK,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,GAAG;AACzC;AAQA,SAAS,aAAa,KAAqB;AACzC,SAAO,OAAO,SAAS,GAAG,KAAK,MAAM,IAAI,MAAM;AACjD;AAEA,IAAM,WAAiB;AAAA,EACrB,CAAC,EAAE,WAAW,QAAQ,GAAG,MAAM,KAAK,GAAG,MAAM,GAAG,QAAQ;AACtD,UAAM,UAAU,aAAa,GAAG;AAChC,UAAM,UAAU,MAAM,OAAO,OAAO;AACpC,UAAM,UAAU,YAAY,IAAI,IAAK,UAAU,UAAW;AAE1D,WACE;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ;AAAA,QAKA,MAAK;AAAA,QACL,iBAAe;AAAA,QACf,iBAAe;AAAA,QACf,iBAAe;AAAA,QACf,WAAW,GAAG,eAAe,SAAS;AAAA,QAEtC,8BAAC,SAAI,WAAU,0BAAyB,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,GAAG;AAAA;AAAA,IAC3E;AAAA,EAEJ;AACF;AACA,SAAS,cAAc;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/recipes/cx.ts"],"sourcesContent":["/** Minimal class-name joiner. Falsy values are dropped. */\nexport function cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter(Boolean).join(' ');\n}\n"],"mappings":";AACO,SAAS,MAAM,OAAyD;AAC7E,SAAO,MAAM,OAAO,OAAO,EAAE,KAAK,GAAG;AACvC;","names":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cx
|
|
3
|
+
} from "./chunk-LOVNG6RF.js";
|
|
4
|
+
|
|
5
|
+
// src/recipes/shell.ts
|
|
6
|
+
function header(options = {}) {
|
|
7
|
+
return cx("sv-header", options.glass !== false && "sv-glass");
|
|
8
|
+
}
|
|
9
|
+
var headerClasses = {
|
|
10
|
+
nav: "sv-header__nav",
|
|
11
|
+
/** Wraps <nav> in a native <details> — collapsible below 640px, a no-op
|
|
12
|
+
* wrapper above it, with zero JavaScript (see DESIGN.md §5 Navigation). */
|
|
13
|
+
navToggle: "sv-header__nav-toggle",
|
|
14
|
+
navSummary: "sv-header__nav-summary",
|
|
15
|
+
link: "sv-header__link",
|
|
16
|
+
linkActive: cx("sv-header__link", "sv-header__link--active"),
|
|
17
|
+
actions: "sv-header__actions"
|
|
18
|
+
};
|
|
19
|
+
function logo() {
|
|
20
|
+
return "sv-logo";
|
|
21
|
+
}
|
|
22
|
+
var logoClasses = {
|
|
23
|
+
dot: "sv-logo__dot"
|
|
24
|
+
};
|
|
25
|
+
function footer() {
|
|
26
|
+
return "sv-footer";
|
|
27
|
+
}
|
|
28
|
+
var footerClasses = {
|
|
29
|
+
links: "sv-footer__links",
|
|
30
|
+
link: "sv-footer__link"
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
header,
|
|
35
|
+
headerClasses,
|
|
36
|
+
logo,
|
|
37
|
+
logoClasses,
|
|
38
|
+
footer,
|
|
39
|
+
footerClasses
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=chunk-M5FFVQKK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/recipes/shell.ts"],"sourcesContent":["import { cx } from './cx';\n\n/**\n * Shell recipes: Header, Logo, Footer.\n * Recipes are pure functions returning class strings — no DOM, no framework.\n * Safe in Next.js Server Components; usable via [class] in Angular, :class in Vue.\n */\n\nexport interface HeaderOptions {\n /** Frosted glass background (sticky headers). */\n glass?: boolean;\n}\n\nexport function header(options: HeaderOptions = {}): string {\n return cx('sv-header', options.glass !== false && 'sv-glass');\n}\n\nexport const headerClasses = {\n nav: 'sv-header__nav',\n /** Wraps <nav> in a native <details> — collapsible below 640px, a no-op\n * wrapper above it, with zero JavaScript (see DESIGN.md §5 Navigation). */\n navToggle: 'sv-header__nav-toggle',\n navSummary: 'sv-header__nav-summary',\n link: 'sv-header__link',\n linkActive: cx('sv-header__link', 'sv-header__link--active'),\n actions: 'sv-header__actions',\n} as const;\n\nexport function logo(): string {\n return 'sv-logo';\n}\n\nexport const logoClasses = {\n dot: 'sv-logo__dot',\n} as const;\n\nexport function footer(): string {\n return 'sv-footer';\n}\n\nexport const footerClasses = {\n links: 'sv-footer__links',\n link: 'sv-footer__link',\n} as const;\n"],"mappings":";;;;;AAaO,SAAS,OAAO,UAAyB,CAAC,GAAW;AAC1D,SAAO,GAAG,aAAa,QAAQ,UAAU,SAAS,UAAU;AAC9D;AAEO,IAAM,gBAAgB;AAAA,EAC3B,KAAK;AAAA;AAAA;AAAA,EAGL,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,YAAY,GAAG,mBAAmB,yBAAyB;AAAA,EAC3D,SAAS;AACX;AAEO,SAAS,OAAe;AAC7B,SAAO;AACT;AAEO,IAAM,cAAc;AAAA,EACzB,KAAK;AACP;AAEO,SAAS,SAAiB;AAC/B,SAAO;AACT;AAEO,IAAM,gBAAgB;AAAA,EAC3B,OAAO;AAAA,EACP,MAAM;AACR;","names":[]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
articleHeader,
|
|
3
|
+
articleHeaderClasses,
|
|
4
|
+
callout,
|
|
5
|
+
calloutClasses,
|
|
6
|
+
calloutLabels,
|
|
7
|
+
codeBlock,
|
|
8
|
+
codeBlockClasses,
|
|
9
|
+
prose,
|
|
10
|
+
proseClasses
|
|
11
|
+
} from "./chunk-YDGOXO6Q.js";
|
|
12
|
+
import {
|
|
13
|
+
cx
|
|
14
|
+
} from "./chunk-LOVNG6RF.js";
|
|
15
|
+
|
|
16
|
+
// src/react/components/Article.tsx
|
|
17
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
function CodeBlock({
|
|
19
|
+
code,
|
|
20
|
+
language,
|
|
21
|
+
filename,
|
|
22
|
+
rendered,
|
|
23
|
+
actions,
|
|
24
|
+
className,
|
|
25
|
+
...rest
|
|
26
|
+
}) {
|
|
27
|
+
return /* @__PURE__ */ jsxs("figure", { className: cx(codeBlock(), className), ...rest, children: [
|
|
28
|
+
/* @__PURE__ */ jsxs("figcaption", { className: codeBlockClasses.header, children: [
|
|
29
|
+
/* @__PURE__ */ jsx("span", { children: filename ?? language ?? "code" }),
|
|
30
|
+
actions
|
|
31
|
+
] }),
|
|
32
|
+
/* @__PURE__ */ jsx("pre", { className: codeBlockClasses.pre, children: rendered ?? /* @__PURE__ */ jsx("code", { children: code }) })
|
|
33
|
+
] });
|
|
34
|
+
}
|
|
35
|
+
function Callout({ kind, label, className, children, ...rest }) {
|
|
36
|
+
return /* @__PURE__ */ jsxs("aside", { className: cx(callout(kind), className), ...rest, children: [
|
|
37
|
+
/* @__PURE__ */ jsx("span", { className: calloutClasses.label, children: label ?? calloutLabels[kind] }),
|
|
38
|
+
/* @__PURE__ */ jsx("div", { children })
|
|
39
|
+
] });
|
|
40
|
+
}
|
|
41
|
+
function ArticleHeader({
|
|
42
|
+
title,
|
|
43
|
+
author,
|
|
44
|
+
date,
|
|
45
|
+
readMinutes,
|
|
46
|
+
eyebrow,
|
|
47
|
+
className,
|
|
48
|
+
...rest
|
|
49
|
+
}) {
|
|
50
|
+
return /* @__PURE__ */ jsxs("header", { className: cx(articleHeader(), className), ...rest, children: [
|
|
51
|
+
eyebrow,
|
|
52
|
+
/* @__PURE__ */ jsx("h1", { className: articleHeaderClasses.title, children: title }),
|
|
53
|
+
(author || date || readMinutes !== void 0) && /* @__PURE__ */ jsxs("div", { className: articleHeaderClasses.meta, children: [
|
|
54
|
+
author && /* @__PURE__ */ jsx("span", { className: articleHeaderClasses.author, children: author }),
|
|
55
|
+
date && /* @__PURE__ */ jsx("span", { children: date }),
|
|
56
|
+
readMinutes !== void 0 && /* @__PURE__ */ jsxs("span", { children: [
|
|
57
|
+
readMinutes,
|
|
58
|
+
" min"
|
|
59
|
+
] })
|
|
60
|
+
] })
|
|
61
|
+
] });
|
|
62
|
+
}
|
|
63
|
+
function Prose({ className, ...rest }) {
|
|
64
|
+
return /* @__PURE__ */ jsx("div", { className: cx(prose(), className), ...rest });
|
|
65
|
+
}
|
|
66
|
+
function Lead({ className, ...rest }) {
|
|
67
|
+
return /* @__PURE__ */ jsx("p", { className: cx(proseClasses.lead, className), ...rest });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
CodeBlock,
|
|
72
|
+
Callout,
|
|
73
|
+
ArticleHeader,
|
|
74
|
+
Prose,
|
|
75
|
+
Lead
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=chunk-MZEFPODP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/react/components/Article.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ReactNode } from 'react';\nimport { cx } from '../../recipes/cx';\nimport {\n articleHeader,\n articleHeaderClasses,\n callout,\n calloutClasses,\n calloutLabels,\n codeBlock,\n codeBlockClasses,\n prose,\n proseClasses,\n type CalloutKind,\n} from '../../recipes/article';\n\n/*\n * Article components are Server Component safe.\n * Interactive pieces (copy button, scroll spy) live in the client entry\n * and are composed in via slots.\n */\n\nexport interface CodeBlockProps extends ComponentPropsWithoutRef<'figure'> {\n /** Raw source shown when `rendered` is absent. */\n code: string;\n language?: string;\n filename?: string;\n /**\n * Pre-highlighted markup (e.g. Shiki output rendered on the server).\n * The prototype's regex tokenizer was demo-only and is intentionally\n * not part of the library.\n */\n rendered?: ReactNode;\n /** Header slot — pass <CopyButton code={code} /> from the client entry. */\n actions?: ReactNode;\n}\n\nexport function CodeBlock({\n code,\n language,\n filename,\n rendered,\n actions,\n className,\n ...rest\n}: CodeBlockProps) {\n return (\n <figure className={cx(codeBlock(), className)} {...rest}>\n <figcaption className={codeBlockClasses.header}>\n <span>{filename ?? language ?? 'code'}</span>\n {actions}\n </figcaption>\n <pre className={codeBlockClasses.pre}>\n {rendered ?? <code>{code}</code>}\n </pre>\n </figure>\n );\n}\n\nexport interface CalloutProps extends ComponentPropsWithoutRef<'aside'> {\n kind: CalloutKind;\n /** Override the default kind label. */\n label?: string;\n}\n\nexport function Callout({ kind, label, className, children, ...rest }: CalloutProps) {\n return (\n <aside className={cx(callout(kind), className)} {...rest}>\n <span className={calloutClasses.label}>{label ?? calloutLabels[kind]}</span>\n <div>{children}</div>\n </aside>\n );\n}\n\nexport interface ArticleHeaderProps extends ComponentPropsWithoutRef<'header'> {\n title: string;\n author?: string;\n date?: string;\n readMinutes?: number;\n /** Slot above the title — usually a <CategoryPill />. */\n eyebrow?: ReactNode;\n}\n\nexport function ArticleHeader({\n title,\n author,\n date,\n readMinutes,\n eyebrow,\n className,\n ...rest\n}: ArticleHeaderProps) {\n return (\n <header className={cx(articleHeader(), className)} {...rest}>\n {eyebrow}\n <h1 className={articleHeaderClasses.title}>{title}</h1>\n {(author || date || readMinutes !== undefined) && (\n <div className={articleHeaderClasses.meta}>\n {author && <span className={articleHeaderClasses.author}>{author}</span>}\n {date && <span>{date}</span>}\n {readMinutes !== undefined && <span>{readMinutes} min</span>}\n </div>\n )}\n </header>\n );\n}\n\nexport interface ProseProps extends ComponentPropsWithoutRef<'div'> {}\n\n/** Typography wrapper for article/MDX content. */\nexport function Prose({ className, ...rest }: ProseProps) {\n return <div className={cx(prose(), className)} {...rest} />;\n}\n\nexport interface LeadProps extends ComponentPropsWithoutRef<'p'> {}\n\n/** Lead paragraph inside <Prose>. */\nexport function Lead({ className, ...rest }: LeadProps) {\n return <p className={cx(proseClasses.lead, className)} {...rest} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA+CM,SACE,KADF;AAXC,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAmB;AACjB,SACE,qBAAC,YAAO,WAAW,GAAG,UAAU,GAAG,SAAS,GAAI,GAAG,MACjD;AAAA,yBAAC,gBAAW,WAAW,iBAAiB,QACtC;AAAA,0BAAC,UAAM,sBAAY,YAAY,QAAO;AAAA,MACrC;AAAA,OACH;AAAA,IACA,oBAAC,SAAI,WAAW,iBAAiB,KAC9B,sBAAY,oBAAC,UAAM,gBAAK,GAC3B;AAAA,KACF;AAEJ;AAQO,SAAS,QAAQ,EAAE,MAAM,OAAO,WAAW,UAAU,GAAG,KAAK,GAAiB;AACnF,SACE,qBAAC,WAAM,WAAW,GAAG,QAAQ,IAAI,GAAG,SAAS,GAAI,GAAG,MAClD;AAAA,wBAAC,UAAK,WAAW,eAAe,OAAQ,mBAAS,cAAc,IAAI,GAAE;AAAA,IACrE,oBAAC,SAAK,UAAS;AAAA,KACjB;AAEJ;AAWO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAuB;AACrB,SACE,qBAAC,YAAO,WAAW,GAAG,cAAc,GAAG,SAAS,GAAI,GAAG,MACpD;AAAA;AAAA,IACD,oBAAC,QAAG,WAAW,qBAAqB,OAAQ,iBAAM;AAAA,KAChD,UAAU,QAAQ,gBAAgB,WAClC,qBAAC,SAAI,WAAW,qBAAqB,MAClC;AAAA,gBAAU,oBAAC,UAAK,WAAW,qBAAqB,QAAS,kBAAO;AAAA,MAChE,QAAQ,oBAAC,UAAM,gBAAK;AAAA,MACpB,gBAAgB,UAAa,qBAAC,UAAM;AAAA;AAAA,QAAY;AAAA,SAAI;AAAA,OACvD;AAAA,KAEJ;AAEJ;AAKO,SAAS,MAAM,EAAE,WAAW,GAAG,KAAK,GAAe;AACxD,SAAO,oBAAC,SAAI,WAAW,GAAG,MAAM,GAAG,SAAS,GAAI,GAAG,MAAM;AAC3D;AAKO,SAAS,KAAK,EAAE,WAAW,GAAG,KAAK,GAAc;AACtD,SAAO,oBAAC,OAAE,WAAW,GAAG,aAAa,MAAM,SAAS,GAAI,GAAG,MAAM;AACnE;","names":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Slot
|
|
3
|
+
} from "./chunk-VD5O66DN.js";
|
|
4
|
+
import {
|
|
5
|
+
cn
|
|
6
|
+
} from "./chunk-AVAJOAL5.js";
|
|
7
|
+
|
|
8
|
+
// src/components/ui/button.tsx
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
var Button = React.forwardRef(
|
|
12
|
+
({ className, variant = "default", size = "default", asChild = false, ...props }, ref) => {
|
|
13
|
+
const classes = cn(
|
|
14
|
+
"sv-btn",
|
|
15
|
+
variant === "destructive" && "sv-btn--destructive",
|
|
16
|
+
variant === "outline" && "sv-btn--outline",
|
|
17
|
+
variant === "secondary" && "sv-btn--secondary",
|
|
18
|
+
variant === "ghost" && "sv-btn--ghost",
|
|
19
|
+
variant === "link" && "sv-btn--link",
|
|
20
|
+
(variant === "accent" || variant === "primary") && "sv-btn--accent",
|
|
21
|
+
size === "sm" && "sv-btn--sm",
|
|
22
|
+
size === "lg" && "sv-btn--lg",
|
|
23
|
+
size === "icon" && "sv-btn--icon",
|
|
24
|
+
className
|
|
25
|
+
);
|
|
26
|
+
if (asChild) {
|
|
27
|
+
return /* @__PURE__ */ jsx(Slot, { ref, className: classes, ...props });
|
|
28
|
+
}
|
|
29
|
+
return /* @__PURE__ */ jsx("button", { className: classes, ref, ...props });
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
Button.displayName = "Button";
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
Button
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=chunk-NJQN37EG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/ui/button.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { cn } from \"../../lib/utils\"\nimport { Slot } from \"./slot\"\n\nexport type ButtonVariant =\n | \"default\"\n | \"primary\"\n | \"destructive\"\n | \"outline\"\n | \"secondary\"\n | \"ghost\"\n | \"link\"\n | \"accent\"\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * `default` is the neutral surface button (secondary actions, toolbars) —\n * it is *not* the page's primary call to action. The filled accent button\n * is the primary CTA: `variant=\"primary\"` (alias, since 3.6) or `\"accent\"`\n * render the same `sv-btn--accent`. Use at most one per view (One-Accent\n * Rule, DESIGN.md).\n */\n variant?: ButtonVariant\n size?: \"default\" | \"sm\" | \"lg\" | \"icon\"\n /**\n * Merge the button's classes, ref and props onto a single child instead of\n * rendering a `<button>` — e.g. `<Button asChild><Link href=\"/x\">…</Link></Button>`\n * for a navigation that must look like a button (next/link, react-router).\n * Server-safe: uses the vendored `Slot` (AD-015), not Radix's.\n */\n asChild?: boolean\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant = \"default\", size = \"default\", asChild = false, ...props }, ref) => {\n const classes = cn(\n \"sv-btn\",\n variant === \"destructive\" && \"sv-btn--destructive\",\n variant === \"outline\" && \"sv-btn--outline\",\n variant === \"secondary\" && \"sv-btn--secondary\",\n variant === \"ghost\" && \"sv-btn--ghost\",\n variant === \"link\" && \"sv-btn--link\",\n (variant === \"accent\" || variant === \"primary\") && \"sv-btn--accent\",\n size === \"sm\" && \"sv-btn--sm\",\n size === \"lg\" && \"sv-btn--lg\",\n size === \"icon\" && \"sv-btn--icon\",\n className\n )\n if (asChild) {\n return <Slot ref={ref as React.Ref<HTMLElement>} className={classes} {...props} />\n }\n return <button className={classes} ref={ref} {...props} />\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button }\n"],"mappings":";;;;;;;;AAAA,YAAY,WAAW;AAkDV;AAhBb,IAAM,SAAe;AAAA,EACnB,CAAC,EAAE,WAAW,UAAU,WAAW,OAAO,WAAW,UAAU,OAAO,GAAG,MAAM,GAAG,QAAQ;AACxF,UAAM,UAAU;AAAA,MACd;AAAA,MACA,YAAY,iBAAiB;AAAA,MAC7B,YAAY,aAAa;AAAA,MACzB,YAAY,eAAe;AAAA,MAC3B,YAAY,WAAW;AAAA,MACvB,YAAY,UAAU;AAAA,OACrB,YAAY,YAAY,YAAY,cAAc;AAAA,MACnD,SAAS,QAAQ;AAAA,MACjB,SAAS,QAAQ;AAAA,MACjB,SAAS,UAAU;AAAA,MACnB;AAAA,IACF;AACA,QAAI,SAAS;AACX,aAAO,oBAAC,QAAK,KAAoC,WAAW,SAAU,GAAG,OAAO;AAAA,IAClF;AACA,WAAO,oBAAC,YAAO,WAAW,SAAS,KAAW,GAAG,OAAO;AAAA,EAC1D;AACF;AACA,OAAO,cAAc;","names":[]}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cardSkeleton,
|
|
3
|
+
categoryPill,
|
|
4
|
+
categoryPillClasses,
|
|
5
|
+
featuredPostCard,
|
|
6
|
+
featuredPostCardClasses,
|
|
7
|
+
hero,
|
|
8
|
+
heroClasses,
|
|
9
|
+
layout,
|
|
10
|
+
postCard,
|
|
11
|
+
postCardClasses,
|
|
12
|
+
postGrid,
|
|
13
|
+
sidebar,
|
|
14
|
+
sidebarClasses,
|
|
15
|
+
skeletonLine
|
|
16
|
+
} from "./chunk-SSMGCYPH.js";
|
|
17
|
+
import {
|
|
18
|
+
resolveCategoryColor
|
|
19
|
+
} from "./chunk-H7DEOO3V.js";
|
|
20
|
+
import {
|
|
21
|
+
cx
|
|
22
|
+
} from "./chunk-LOVNG6RF.js";
|
|
23
|
+
import {
|
|
24
|
+
safeHref
|
|
25
|
+
} from "./chunk-QVOZHMVF.js";
|
|
26
|
+
|
|
27
|
+
// src/react/components/Content.tsx
|
|
28
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
29
|
+
function CategoryPill({ label, color, active, interactive, className, style, ...rest }) {
|
|
30
|
+
const pillStyle = color ? { ...style, "--sv-pill-color": resolveCategoryColor(color) } : style;
|
|
31
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
32
|
+
/* @__PURE__ */ jsx("span", { className: categoryPillClasses.dot, "aria-hidden": "true" }),
|
|
33
|
+
label
|
|
34
|
+
] });
|
|
35
|
+
if (interactive) {
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
"button",
|
|
38
|
+
{
|
|
39
|
+
type: "button",
|
|
40
|
+
"aria-pressed": active ?? false,
|
|
41
|
+
className: cx(categoryPill({ active, interactive }), className),
|
|
42
|
+
style: pillStyle,
|
|
43
|
+
...rest,
|
|
44
|
+
children: content
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
className: cx(categoryPill({ active, interactive }), className),
|
|
52
|
+
style: pillStyle,
|
|
53
|
+
...rest,
|
|
54
|
+
children: content
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function PostMeta({ post }) {
|
|
59
|
+
if (!post.category && !post.date && post.readMinutes === void 0) return null;
|
|
60
|
+
return /* @__PURE__ */ jsxs("div", { className: postCardClasses.meta, children: [
|
|
61
|
+
post.category && /* @__PURE__ */ jsx(CategoryPill, { label: post.category.label, color: post.category.color }),
|
|
62
|
+
post.date && /* @__PURE__ */ jsx("span", { children: post.date }),
|
|
63
|
+
post.readMinutes !== void 0 && /* @__PURE__ */ jsxs("span", { children: [
|
|
64
|
+
post.readMinutes,
|
|
65
|
+
" min"
|
|
66
|
+
] })
|
|
67
|
+
] });
|
|
68
|
+
}
|
|
69
|
+
function PostCard({ post, dense, linkAs: LinkAs = "a", meta, className, children, ...rest }) {
|
|
70
|
+
return /* @__PURE__ */ jsxs("article", { className: cx(postCard({ dense }), className), ...rest, children: [
|
|
71
|
+
meta ?? /* @__PURE__ */ jsx(PostMeta, { post }),
|
|
72
|
+
/* @__PURE__ */ jsx("h3", { className: postCardClasses.title, children: /* @__PURE__ */ jsx(LinkAs, { href: safeHref(post.href), children: post.title }) }),
|
|
73
|
+
!dense && post.excerpt && /* @__PURE__ */ jsx("p", { className: postCardClasses.excerpt, children: post.excerpt }),
|
|
74
|
+
children
|
|
75
|
+
] });
|
|
76
|
+
}
|
|
77
|
+
function FeaturedPostCard({
|
|
78
|
+
post,
|
|
79
|
+
visual,
|
|
80
|
+
linkAs: LinkAs = "a",
|
|
81
|
+
meta,
|
|
82
|
+
eyebrow,
|
|
83
|
+
className,
|
|
84
|
+
children,
|
|
85
|
+
...rest
|
|
86
|
+
}) {
|
|
87
|
+
return /* @__PURE__ */ jsxs("article", { className: cx(featuredPostCard(), className), ...rest, children: [
|
|
88
|
+
/* @__PURE__ */ jsxs("div", { className: featuredPostCardClasses.body, children: [
|
|
89
|
+
eyebrow,
|
|
90
|
+
meta ?? /* @__PURE__ */ jsx(PostMeta, { post }),
|
|
91
|
+
/* @__PURE__ */ jsx("h2", { className: featuredPostCardClasses.title, children: /* @__PURE__ */ jsx(LinkAs, { href: safeHref(post.href), children: post.title }) }),
|
|
92
|
+
post.excerpt && /* @__PURE__ */ jsx("p", { className: postCardClasses.excerpt, children: post.excerpt }),
|
|
93
|
+
children
|
|
94
|
+
] }),
|
|
95
|
+
visual && /* @__PURE__ */ jsx("div", { className: featuredPostCardClasses.visual, children: visual })
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
function PostGrid({ className, ...rest }) {
|
|
99
|
+
return /* @__PURE__ */ jsx("div", { className: cx(postGrid(), className), ...rest });
|
|
100
|
+
}
|
|
101
|
+
function Layout({ withSidebar, className, ...rest }) {
|
|
102
|
+
return /* @__PURE__ */ jsx("div", { className: cx(layout({ withSidebar }), className), ...rest });
|
|
103
|
+
}
|
|
104
|
+
function Sidebar({ className, ...rest }) {
|
|
105
|
+
return /* @__PURE__ */ jsx("aside", { className: cx(sidebar(), className), ...rest });
|
|
106
|
+
}
|
|
107
|
+
function SidebarSection({ title, children, ...rest }) {
|
|
108
|
+
return /* @__PURE__ */ jsxs("section", { ...rest, children: [
|
|
109
|
+
/* @__PURE__ */ jsx("h4", { className: sidebarClasses.sectionTitle, children: title }),
|
|
110
|
+
children
|
|
111
|
+
] });
|
|
112
|
+
}
|
|
113
|
+
function Hero({ eyebrow, title, description, className, children, ...rest }) {
|
|
114
|
+
return /* @__PURE__ */ jsxs("section", { className: cx(hero(), className), ...rest, children: [
|
|
115
|
+
eyebrow && /* @__PURE__ */ jsx("span", { className: heroClasses.eyebrow, children: eyebrow }),
|
|
116
|
+
/* @__PURE__ */ jsx("h1", { className: heroClasses.title, children: title }),
|
|
117
|
+
description && /* @__PURE__ */ jsx("p", { className: heroClasses.description, children: description }),
|
|
118
|
+
children
|
|
119
|
+
] });
|
|
120
|
+
}
|
|
121
|
+
function Skeleton({ small, className, ...rest }) {
|
|
122
|
+
return /* @__PURE__ */ jsx("div", { className: cx(skeletonLine({ small }), className), "aria-hidden": "true", ...rest });
|
|
123
|
+
}
|
|
124
|
+
function CardSkeleton({ className, ...rest }) {
|
|
125
|
+
return /* @__PURE__ */ jsxs("div", { className: cx(cardSkeleton(), className), "aria-hidden": "true", ...rest, children: [
|
|
126
|
+
/* @__PURE__ */ jsx(Skeleton, { small: true }),
|
|
127
|
+
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
128
|
+
/* @__PURE__ */ jsx(Skeleton, {})
|
|
129
|
+
] });
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export {
|
|
133
|
+
CategoryPill,
|
|
134
|
+
PostCard,
|
|
135
|
+
FeaturedPostCard,
|
|
136
|
+
PostGrid,
|
|
137
|
+
Layout,
|
|
138
|
+
Sidebar,
|
|
139
|
+
SidebarSection,
|
|
140
|
+
Hero,
|
|
141
|
+
Skeleton,
|
|
142
|
+
CardSkeleton
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=chunk-OEFJMV7G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/react/components/Content.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, CSSProperties, ReactNode } from 'react';\nimport { cx } from '../../recipes/cx';\nimport {\n cardSkeleton,\n categoryPill,\n categoryPillClasses,\n featuredPostCard,\n featuredPostCardClasses,\n hero,\n heroClasses,\n layout,\n postCard,\n postCardClasses,\n postGrid,\n sidebar,\n sidebarClasses,\n skeletonLine,\n} from '../../recipes/content';\nimport { resolveCategoryColor } from '../../tokens/categories';\nimport type { LinkComponent, PostSummary } from '../../types';\nimport { safeHref } from '../../lib/safe-href';\n\n/* All components in this file are Server Component safe. */\n\ninterface CategoryPillBaseProps {\n label: string;\n /** Accent name ('cyan'), category name ('ia'), or any CSS color. */\n color?: string;\n active?: boolean;\n}\n\nexport type CategoryPillProps =\n | (CategoryPillBaseProps & { interactive: true } & Omit<\n ComponentPropsWithoutRef<'button'>,\n 'color'\n >)\n | (CategoryPillBaseProps & { interactive?: false } & Omit<\n ComponentPropsWithoutRef<'span'>,\n 'color'\n >);\n\n/**\n * Categories render as a colored dot + label. When `interactive`, this is a\n * real <button> (toggle semantics via `aria-pressed`) — a `<span>` with a\n * pointer cursor is not operable by keyboard or assistive tech.\n */\nexport function CategoryPill({ label, color, active, interactive, className, style, ...rest }: CategoryPillProps) {\n const pillStyle: CSSProperties | undefined = color\n ? ({ ...style, '--sv-pill-color': resolveCategoryColor(color) } as CSSProperties)\n : style;\n const content = (\n <>\n <span className={categoryPillClasses.dot} aria-hidden=\"true\" />\n {label}\n </>\n );\n\n if (interactive) {\n return (\n <button\n type=\"button\"\n aria-pressed={active ?? false}\n className={cx(categoryPill({ active, interactive }), className)}\n style={pillStyle}\n {...(rest as ComponentPropsWithoutRef<'button'>)}\n >\n {content}\n </button>\n );\n }\n\n return (\n <span\n className={cx(categoryPill({ active, interactive }), className)}\n style={pillStyle}\n {...(rest as ComponentPropsWithoutRef<'span'>)}\n >\n {content}\n </span>\n );\n}\n\nfunction PostMeta({ post }: { post: PostSummary }) {\n if (!post.category && !post.date && post.readMinutes === undefined) return null;\n return (\n <div className={postCardClasses.meta}>\n {post.category && <CategoryPill label={post.category.label} color={post.category.color} />}\n {post.date && <span>{post.date}</span>}\n {post.readMinutes !== undefined && <span>{post.readMinutes} min</span>}\n </div>\n );\n}\n\nexport interface PostCardProps extends ComponentPropsWithoutRef<'article'> {\n post: PostSummary;\n dense?: boolean;\n /** Render the title link as your router's link component (e.g. `next/link`). Defaults to `<a>`. */\n linkAs?: LinkComponent;\n /** Replaces the default meta row (category pill, date, reading time). */\n meta?: ReactNode;\n}\n\nexport function PostCard({ post, dense, linkAs: LinkAs = 'a', meta, className, children, ...rest }: PostCardProps) {\n return (\n <article className={cx(postCard({ dense }), className)} {...rest}>\n {meta ?? <PostMeta post={post} />}\n <h3 className={postCardClasses.title}>\n <LinkAs href={safeHref(post.href)}>{post.title}</LinkAs>\n </h3>\n {!dense && post.excerpt && <p className={postCardClasses.excerpt}>{post.excerpt}</p>}\n {children}\n </article>\n );\n}\n\nexport interface FeaturedPostCardProps extends ComponentPropsWithoutRef<'article'> {\n post: PostSummary;\n /** Custom visual slot (illustration, image). */\n visual?: ReactNode;\n /** Render the title link as your router's link component (e.g. `next/link`). Defaults to `<a>`. */\n linkAs?: LinkComponent;\n /** Replaces the default meta row (category pill, date, reading time). */\n meta?: ReactNode;\n /** Slot rendered above the meta row — e.g. a \"Featured\" badge. */\n eyebrow?: ReactNode;\n}\n\nexport function FeaturedPostCard({\n post,\n visual,\n linkAs: LinkAs = 'a',\n meta,\n eyebrow,\n className,\n children,\n ...rest\n}: FeaturedPostCardProps) {\n return (\n <article className={cx(featuredPostCard(), className)} {...rest}>\n <div className={featuredPostCardClasses.body}>\n {eyebrow}\n {meta ?? <PostMeta post={post} />}\n <h2 className={featuredPostCardClasses.title}>\n <LinkAs href={safeHref(post.href)}>{post.title}</LinkAs>\n </h2>\n {post.excerpt && <p className={postCardClasses.excerpt}>{post.excerpt}</p>}\n {children}\n </div>\n {visual && <div className={featuredPostCardClasses.visual}>{visual}</div>}\n </article>\n );\n}\n\nexport interface PostGridProps extends ComponentPropsWithoutRef<'div'> {}\n\nexport function PostGrid({ className, ...rest }: PostGridProps) {\n return <div className={cx(postGrid(), className)} {...rest} />;\n}\n\nexport interface LayoutProps extends ComponentPropsWithoutRef<'div'> {\n withSidebar?: boolean;\n}\n\nexport function Layout({ withSidebar, className, ...rest }: LayoutProps) {\n return <div className={cx(layout({ withSidebar }), className)} {...rest} />;\n}\n\nexport interface SidebarProps extends ComponentPropsWithoutRef<'aside'> {}\n\nexport function Sidebar({ className, ...rest }: SidebarProps) {\n return <aside className={cx(sidebar(), className)} {...rest} />;\n}\n\nexport interface SidebarSectionProps extends ComponentPropsWithoutRef<'section'> {\n title: string;\n}\n\nexport function SidebarSection({ title, children, ...rest }: SidebarSectionProps) {\n return (\n <section {...rest}>\n <h4 className={sidebarClasses.sectionTitle}>{title}</h4>\n {children}\n </section>\n );\n}\n\nexport interface HeroProps extends Omit<ComponentPropsWithoutRef<'section'>, 'title'> {\n /** Plain text or inline markup (e.g. a status dot before the text). */\n eyebrow?: ReactNode;\n /** Plain text or inline markup (e.g. one word in a muted tone). */\n title: ReactNode;\n description?: ReactNode;\n}\n\nexport function Hero({ eyebrow, title, description, className, children, ...rest }: HeroProps) {\n return (\n <section className={cx(hero(), className)} {...rest}>\n {eyebrow && <span className={heroClasses.eyebrow}>{eyebrow}</span>}\n <h1 className={heroClasses.title}>{title}</h1>\n {description && <p className={heroClasses.description}>{description}</p>}\n {children}\n </section>\n );\n}\n\nexport interface SkeletonProps extends ComponentPropsWithoutRef<'div'> {\n small?: boolean;\n}\n\nexport function Skeleton({ small, className, ...rest }: SkeletonProps) {\n return <div className={cx(skeletonLine({ small }), className)} aria-hidden=\"true\" {...rest} />;\n}\n\nexport function CardSkeleton({ className, ...rest }: ComponentPropsWithoutRef<'div'>) {\n return (\n <div className={cx(cardSkeleton(), className)} aria-hidden=\"true\" {...rest}>\n <Skeleton small />\n <Skeleton />\n <Skeleton />\n </div>\n );\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fieldClasses
|
|
3
|
+
} from "./chunk-QTVPXQ43.js";
|
|
4
|
+
import {
|
|
5
|
+
cn
|
|
6
|
+
} from "./chunk-AVAJOAL5.js";
|
|
7
|
+
|
|
8
|
+
// src/components/ui/radio-group.tsx
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var RadioGroupItem = React.forwardRef(
|
|
12
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs("label", { className: fieldClasses.choice, children: [
|
|
13
|
+
/* @__PURE__ */ jsx(
|
|
14
|
+
"input",
|
|
15
|
+
{
|
|
16
|
+
className: cn("sv-radio", className),
|
|
17
|
+
ref,
|
|
18
|
+
...props,
|
|
19
|
+
type: "radio"
|
|
20
|
+
}
|
|
21
|
+
),
|
|
22
|
+
children
|
|
23
|
+
] })
|
|
24
|
+
);
|
|
25
|
+
RadioGroupItem.displayName = "RadioGroupItem";
|
|
26
|
+
var RadioGroup = React.forwardRef(
|
|
27
|
+
({ className, legend, legendHidden, orientation = "vertical", name, children, ...props }, ref) => {
|
|
28
|
+
const items = React.Children.map(children, (child) => {
|
|
29
|
+
if (!React.isValidElement(child) || child.type !== RadioGroupItem) {
|
|
30
|
+
return child;
|
|
31
|
+
}
|
|
32
|
+
const itemProps = child.props;
|
|
33
|
+
if (itemProps.name !== void 0) {
|
|
34
|
+
return child;
|
|
35
|
+
}
|
|
36
|
+
return React.cloneElement(child, { name });
|
|
37
|
+
});
|
|
38
|
+
return /* @__PURE__ */ jsxs(
|
|
39
|
+
"fieldset",
|
|
40
|
+
{
|
|
41
|
+
className: cn(
|
|
42
|
+
"sv-radio-group",
|
|
43
|
+
orientation === "horizontal" && "sv-radio-group--horizontal",
|
|
44
|
+
className
|
|
45
|
+
),
|
|
46
|
+
ref,
|
|
47
|
+
...props,
|
|
48
|
+
children: [
|
|
49
|
+
legend !== void 0 && /* @__PURE__ */ jsx("legend", { className: cn("sv-radio-group__legend", legendHidden && fieldClasses.srOnly), children: legend }),
|
|
50
|
+
items
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
RadioGroup.displayName = "RadioGroup";
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
RadioGroupItem,
|
|
60
|
+
RadioGroup
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=chunk-P4M4LEI2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/ui/radio-group.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { cn } from \"../../lib/utils\"\nimport { fieldClasses } from \"../../recipes/field\"\n\nexport interface RadioGroupItemProps\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"type\"> {\n children?: React.ReactNode\n}\n\nconst RadioGroupItem = React.forwardRef<HTMLInputElement, RadioGroupItemProps>(\n ({ className, children, ...props }, ref) => (\n <label className={fieldClasses.choice}>\n <input\n className={cn(\"sv-radio\", className)}\n ref={ref}\n {...props}\n type=\"radio\"\n />\n {children}\n </label>\n )\n)\nRadioGroupItem.displayName = \"RadioGroupItem\"\n\nexport interface RadioGroupProps\n extends Omit<React.FieldsetHTMLAttributes<HTMLFieldSetElement>, \"name\"> {\n legend?: React.ReactNode\n legendHidden?: boolean\n orientation?: \"vertical\" | \"horizontal\"\n name?: string\n}\n\n// No React context API here — that constructor does not exist in Server\n// Components (AD-002). Instead, `name` is injected directly into\n// direct-child RadioGroupItems via React.Children.map — a child's own\n// `name` always wins, and anything that isn't a direct-child RadioGroupItem\n// (text, other elements, a wrapper, or a falsy child) passes through\n// untouched.\nconst RadioGroup = React.forwardRef<HTMLFieldSetElement, RadioGroupProps>(\n (\n { className, legend, legendHidden, orientation = \"vertical\", name, children, ...props },\n ref\n ) => {\n const items = React.Children.map(children, (child) => {\n if (!React.isValidElement(child) || child.type !== RadioGroupItem) {\n return child\n }\n const itemProps = child.props as RadioGroupItemProps\n if (itemProps.name !== undefined) {\n return child\n }\n return React.cloneElement(child as React.ReactElement<RadioGroupItemProps>, { name })\n })\n\n return (\n <fieldset\n className={cn(\n \"sv-radio-group\",\n orientation === \"horizontal\" && \"sv-radio-group--horizontal\",\n className\n )}\n ref={ref}\n {...props}\n >\n {legend !== undefined && (\n <legend className={cn(\"sv-radio-group__legend\", legendHidden && fieldClasses.srOnly)}>\n {legend}\n </legend>\n )}\n {items}\n </fieldset>\n )\n }\n)\nRadioGroup.displayName = \"RadioGroup\"\n\nexport { RadioGroup, RadioGroupItem }\n"],"mappings":";;;;;;;;AAAA,YAAY,WAAW;AAWnB,SACE,KADF;AAFJ,IAAM,iBAAuB;AAAA,EAC3B,CAAC,EAAE,WAAW,UAAU,GAAG,MAAM,GAAG,QAClC,qBAAC,WAAM,WAAW,aAAa,QAC7B;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,GAAG,YAAY,SAAS;AAAA,QACnC;AAAA,QACC,GAAG;AAAA,QACJ,MAAK;AAAA;AAAA,IACP;AAAA,IACC;AAAA,KACH;AAEJ;AACA,eAAe,cAAc;AAgB7B,IAAM,aAAmB;AAAA,EACvB,CACE,EAAE,WAAW,QAAQ,cAAc,cAAc,YAAY,MAAM,UAAU,GAAG,MAAM,GACtF,QACG;AACH,UAAM,QAAc,eAAS,IAAI,UAAU,CAAC,UAAU;AACpD,UAAI,CAAO,qBAAe,KAAK,KAAK,MAAM,SAAS,gBAAgB;AACjE,eAAO;AAAA,MACT;AACA,YAAM,YAAY,MAAM;AACxB,UAAI,UAAU,SAAS,QAAW;AAChC,eAAO;AAAA,MACT;AACA,aAAa,mBAAa,OAAkD,EAAE,KAAK,CAAC;AAAA,IACtF,CAAC;AAED,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA,gBAAgB,gBAAgB;AAAA,UAChC;AAAA,QACF;AAAA,QACA;AAAA,QACC,GAAG;AAAA,QAEH;AAAA,qBAAW,UACV,oBAAC,YAAO,WAAW,GAAG,0BAA0B,gBAAgB,aAAa,MAAM,GAChF,kBACH;AAAA,UAED;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,WAAW,cAAc;","names":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Icon
|
|
3
|
+
} from "./chunk-HD7O5FNH.js";
|
|
4
|
+
import {
|
|
5
|
+
cn
|
|
6
|
+
} from "./chunk-AVAJOAL5.js";
|
|
7
|
+
|
|
8
|
+
// src/components/ui/alert.tsx
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var variantConfig = {
|
|
12
|
+
info: { role: "status", icon: "info" },
|
|
13
|
+
success: { role: "status", icon: "check-circle" },
|
|
14
|
+
warning: { role: "alert", icon: "alert-triangle" },
|
|
15
|
+
danger: { role: "alert", icon: "alert-circle" }
|
|
16
|
+
};
|
|
17
|
+
var Alert = React.forwardRef(
|
|
18
|
+
({ className, variant, icon, action, role: propRole, ...props }, ref) => {
|
|
19
|
+
const config = variant && Object.prototype.hasOwnProperty.call(variantConfig, variant) ? variantConfig[variant] : null;
|
|
20
|
+
const derivedRole = config?.role ?? "alert";
|
|
21
|
+
const effectiveRole = config ? derivedRole : "alert";
|
|
22
|
+
let iconElement = null;
|
|
23
|
+
if (icon !== null) {
|
|
24
|
+
if (icon !== void 0) {
|
|
25
|
+
iconElement = icon;
|
|
26
|
+
} else if (config) {
|
|
27
|
+
iconElement = /* @__PURE__ */ jsx(Icon, { name: config.icon, "aria-hidden": "true" });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return /* @__PURE__ */ jsxs(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
ref,
|
|
34
|
+
className: cn("sv-alert", config && `sv-alert--${variant}`, className),
|
|
35
|
+
role: effectiveRole,
|
|
36
|
+
...props,
|
|
37
|
+
children: [
|
|
38
|
+
iconElement,
|
|
39
|
+
props.children,
|
|
40
|
+
action && /* @__PURE__ */ jsx("div", { className: "sv-alert__action", children: action })
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
Alert.displayName = "Alert";
|
|
47
|
+
var AlertTitle = React.forwardRef(({ className, ...props }, ref) => (
|
|
48
|
+
// eslint-disable-next-line jsx-a11y/heading-has-content -- content arrives as children via props
|
|
49
|
+
/* @__PURE__ */ jsx("h5", { ref, className: cn("sv-alert__title", className), ...props })
|
|
50
|
+
));
|
|
51
|
+
AlertTitle.displayName = "AlertTitle";
|
|
52
|
+
var AlertDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("sv-alert__description", className), ...props }));
|
|
53
|
+
AlertDescription.displayName = "AlertDescription";
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
Alert,
|
|
57
|
+
AlertTitle,
|
|
58
|
+
AlertDescription
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=chunk-PGDHKADW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/ui/alert.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { cn } from \"../../lib/utils\"\nimport { Icon, type IconName } from \"./icon\"\n\nexport type AlertVariant = 'info' | 'success' | 'warning' | 'danger'\n\ninterface AlertProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: AlertVariant\n icon?: React.ReactNode | null\n action?: React.ReactNode\n}\n\n// Map variant to derived role and default icon\nconst variantConfig: Record<AlertVariant, { role: 'alert' | 'status'; icon: IconName }> = {\n info: { role: 'status', icon: 'info' },\n success: { role: 'status', icon: 'check-circle' },\n warning: { role: 'alert', icon: 'alert-triangle' },\n danger: { role: 'alert', icon: 'alert-circle' },\n}\n\nconst Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n ({ className, variant, icon, action, role: propRole, ...props }, ref) => {\n // Validate variant: only use if it's a known own key (guards against\n // inherited names like \"constructor\"/\"toString\" matching via `in`)\n const config =\n variant && Object.prototype.hasOwnProperty.call(variantConfig, variant)\n ? variantConfig[variant]\n : null\n const derivedRole = config?.role ?? 'alert'\n // Derived role wins over prop role; without variant, force 'alert' unconditionally\n const effectiveRole = config ? derivedRole : 'alert'\n\n // Determine if icon should be rendered\n let iconElement: React.ReactNode = null\n if (icon !== null) {\n if (icon !== undefined) {\n // Render every non-null explicit node (element, string, number, array)\n iconElement = icon\n } else if (config) {\n // Render default icon for this variant\n iconElement = <Icon name={config.icon} aria-hidden=\"true\" />\n }\n }\n\n return (\n <div\n ref={ref}\n className={cn(\"sv-alert\", config && `sv-alert--${variant}`, className)}\n role={effectiveRole}\n {...props}\n >\n {iconElement}\n {props.children}\n {action && <div className=\"sv-alert__action\">{action}</div>}\n </div>\n )\n },\n)\nAlert.displayName = \"Alert\"\n\nconst AlertTitle = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n // eslint-disable-next-line jsx-a11y/heading-has-content -- content arrives as children via props\n <h5 ref={ref} className={cn(\"sv-alert__title\", className)} {...props} />\n))\nAlertTitle.displayName = \"AlertTitle\"\n\nconst AlertDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"sv-alert__description\", className)} {...props} />\n))\nAlertDescription.displayName = \"AlertDescription\"\n\nexport { Alert, AlertTitle, AlertDescription }\n"],"mappings":";;;;;;;;AAAA,YAAY,WAAW;AAwCD,cAKhB,YALgB;AA3BtB,IAAM,gBAAoF;AAAA,EACxF,MAAM,EAAE,MAAM,UAAU,MAAM,OAAO;AAAA,EACrC,SAAS,EAAE,MAAM,UAAU,MAAM,eAAe;AAAA,EAChD,SAAS,EAAE,MAAM,SAAS,MAAM,iBAAiB;AAAA,EACjD,QAAQ,EAAE,MAAM,SAAS,MAAM,eAAe;AAChD;AAEA,IAAM,QAAc;AAAA,EAClB,CAAC,EAAE,WAAW,SAAS,MAAM,QAAQ,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ;AAGvE,UAAM,SACJ,WAAW,OAAO,UAAU,eAAe,KAAK,eAAe,OAAO,IAClE,cAAc,OAAO,IACrB;AACN,UAAM,cAAc,QAAQ,QAAQ;AAEpC,UAAM,gBAAgB,SAAS,cAAc;AAG7C,QAAI,cAA+B;AACnC,QAAI,SAAS,MAAM;AACjB,UAAI,SAAS,QAAW;AAEtB,sBAAc;AAAA,MAChB,WAAW,QAAQ;AAEjB,sBAAc,oBAAC,QAAK,MAAM,OAAO,MAAM,eAAY,QAAO;AAAA,MAC5D;AAAA,IACF;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,YAAY,UAAU,aAAa,OAAO,IAAI,SAAS;AAAA,QACrE,MAAM;AAAA,QACL,GAAG;AAAA,QAEH;AAAA;AAAA,UACA,MAAM;AAAA,UACN,UAAU,oBAAC,SAAI,WAAU,oBAAoB,kBAAO;AAAA;AAAA;AAAA,IACvD;AAAA,EAEJ;AACF;AACA,MAAM,cAAc;AAEpB,IAAM,aAAmB,iBAGvB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG;AAAA;AAAA,EAE1B,oBAAC,QAAG,KAAU,WAAW,GAAG,mBAAmB,SAAS,GAAI,GAAG,OAAO;AAAA,CACvE;AACD,WAAW,cAAc;AAEzB,IAAM,mBAAyB,iBAG7B,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B,oBAAC,SAAI,KAAU,WAAW,GAAG,yBAAyB,SAAS,GAAI,GAAG,OAAO,CAC9E;AACD,iBAAiB,cAAc;","names":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cx
|
|
3
|
+
} from "./chunk-LOVNG6RF.js";
|
|
4
|
+
|
|
5
|
+
// src/recipes/field.ts
|
|
6
|
+
function field(options = {}) {
|
|
7
|
+
return cx(
|
|
8
|
+
"sv-field",
|
|
9
|
+
options.variant && options.variant !== "input" && `sv-field--${options.variant}`
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
var fieldClasses = {
|
|
13
|
+
choice: "sv-choice",
|
|
14
|
+
srOnly: "sv-sr-only",
|
|
15
|
+
/** Wrapper of a label + control + messages group (the `Field` component). */
|
|
16
|
+
group: "sv-form-field",
|
|
17
|
+
label: "sv-label",
|
|
18
|
+
labelRequired: "sv-label__required"
|
|
19
|
+
};
|
|
20
|
+
function fieldMessage(options = {}) {
|
|
21
|
+
return cx("sv-field-message", options.variant === "error" && "sv-field-message--error");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
field,
|
|
26
|
+
fieldClasses,
|
|
27
|
+
fieldMessage
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=chunk-QTVPXQ43.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/recipes/field.ts"],"sourcesContent":["import { cx } from './cx';\n\n/**\n * Field recipe: the single source of truth for the form-field frame shared by\n * Input, Textarea, NativeSelect and FileInput. Pure function — Server\n * Component safe, and exported so consumers composing their own markup style\n * a field the same way the components do instead of mirroring the CSS by hand.\n */\n\nexport type FieldVariant = 'input' | 'textarea' | 'select' | 'file';\n\nexport interface FieldOptions {\n variant?: FieldVariant;\n}\n\nexport function field(options: FieldOptions = {}): string {\n // 'input' is the base shape, so it adds no modifier — the plain frame is\n // already what a single-line input needs.\n return cx(\n 'sv-field',\n options.variant && options.variant !== 'input' && `sv-field--${options.variant}`,\n );\n}\n\nexport const fieldClasses = {\n choice: 'sv-choice',\n srOnly: 'sv-sr-only',\n /** Wrapper of a label + control + messages group (the `Field` component). */\n group: 'sv-form-field',\n label: 'sv-label',\n labelRequired: 'sv-label__required',\n} as const;\n\n/**\n * Invalid state is read from the native `aria-invalid` attribute rather than\n * a boolean prop: Input/Textarea/NativeSelect/FileInput already spread\n * `...props`, so `<Input aria-invalid=\"true\" />` alone paints the danger\n * border with zero component changes — composition over configuration.\n */\nexport type FieldMessageVariant = 'hint' | 'error';\n\nexport interface FieldMessageOptions {\n variant?: FieldMessageVariant;\n}\n\n/**\n * Helper/error text meant to sit under a field, associated to it via\n * `aria-describedby` on the field itself.\n */\nexport function fieldMessage(options: FieldMessageOptions = {}): string {\n return cx('sv-field-message', options.variant === 'error' && 'sv-field-message--error');\n}\n"],"mappings":";;;;;AAeO,SAAS,MAAM,UAAwB,CAAC,GAAW;AAGxD,SAAO;AAAA,IACL;AAAA,IACA,QAAQ,WAAW,QAAQ,YAAY,WAAW,aAAa,QAAQ,OAAO;AAAA,EAChF;AACF;AAEO,IAAM,eAAe;AAAA,EAC1B,QAAQ;AAAA,EACR,QAAQ;AAAA;AAAA,EAER,OAAO;AAAA,EACP,OAAO;AAAA,EACP,eAAe;AACjB;AAkBO,SAAS,aAAa,UAA+B,CAAC,GAAW;AACtE,SAAO,GAAG,oBAAoB,QAAQ,YAAY,WAAW,yBAAyB;AACxF;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/lib/safe-href.ts
|
|
2
|
+
var UNSAFE_SCHEME = /^(?:javascript|vbscript|data):/i;
|
|
3
|
+
var BLOCKED_HREF = "#";
|
|
4
|
+
function safeHref(href) {
|
|
5
|
+
if (href === void 0) return href;
|
|
6
|
+
const normalised = href.replace(/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g, "").replace(/[\t\n\r]/g, "");
|
|
7
|
+
return UNSAFE_SCHEME.test(normalised) ? BLOCKED_HREF : href;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
BLOCKED_HREF,
|
|
12
|
+
safeHref
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=chunk-QVOZHMVF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/safe-href.ts"],"sourcesContent":["/**\n * Schemes that run code or smuggle a document instead of navigating. Matched\n * after the browser's own URL normalisation: leading/trailing C0 controls and\n * spaces are stripped and tab/newline anywhere are removed before the scheme\n * is read (WHATWG URL), so `\" java\\tscript:\"` is still `javascript:`.\n */\nconst UNSAFE_SCHEME = /^(?:javascript|vbscript|data):/i\n\n/** What an unsafe href is replaced with: inert, still a valid `href` for `next/link`. */\nexport const BLOCKED_HREF = \"#\"\n\n/**\n * Returns `href` unchanged unless it uses a script-capable scheme\n * (`javascript:`, `vbscript:`, `data:`), in which case it returns `\"#\"`.\n * Relative paths, fragments, `http(s):`, `mailto:`, `tel:` and any other\n * scheme pass through. `undefined` stays `undefined`. Server-safe.\n *\n * React 19 already neutralises `javascript:` on a plain `<a>`, but not\n * `data:`/`vbscript:`, and not hrefs handed to a custom `linkAs` component.\n */\nexport function safeHref<T extends string | undefined>(href: T): T | typeof BLOCKED_HREF {\n if (href === undefined) return href\n // eslint-disable-next-line no-control-regex\n const normalised = href.replace(/^[\\u0000-\\u0020]+|[\\u0000-\\u0020]+$/g, \"\").replace(/[\\t\\n\\r]/g, \"\")\n return UNSAFE_SCHEME.test(normalised) ? BLOCKED_HREF : href\n}\n"],"mappings":";AAMA,IAAM,gBAAgB;AAGf,IAAM,eAAe;AAWrB,SAAS,SAAuC,MAAkC;AACvF,MAAI,SAAS,OAAW,QAAO;AAE/B,QAAM,aAAa,KAAK,QAAQ,wCAAwC,EAAE,EAAE,QAAQ,aAAa,EAAE;AACnG,SAAO,cAAc,KAAK,UAAU,IAAI,eAAe;AACzD;","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
field
|
|
3
|
+
} from "./chunk-QTVPXQ43.js";
|
|
4
|
+
import {
|
|
5
|
+
cn
|
|
6
|
+
} from "./chunk-AVAJOAL5.js";
|
|
7
|
+
|
|
8
|
+
// src/components/ui/input.tsx
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
var Input = React.forwardRef(
|
|
12
|
+
({ className, type, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
13
|
+
"input",
|
|
14
|
+
{
|
|
15
|
+
type,
|
|
16
|
+
className: cn(field(), className),
|
|
17
|
+
ref,
|
|
18
|
+
...props
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
Input.displayName = "Input";
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
Input
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=chunk-SJ2YK4NJ.js.map
|