@still-void/ui 0.0.0-canary-20261202214749
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 +350 -0
- package/LICENSE +21 -0
- package/README.md +330 -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 +1924 -0
- package/dist/react/client/index.cjs.map +1 -0
- package/dist/react/client/index.d.cts +588 -0
- package/dist/react/client/index.d.ts +588 -0
- package/dist/react/client/index.js +233 -0
- package/dist/react/client/index.js.map +1 -0
- package/dist/react/index.cjs +1682 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +994 -0
- package/dist/react/index.d.ts +994 -0
- package/dist/react/index.js +333 -0
- package/dist/react/index.js.map +1 -0
- package/dist/shadcn-overrides.css +112 -0
- package/dist/style.css +2480 -0
- package/dist/tailwind.css +73 -0
- package/dist/theme.css +346 -0
- package/package.json +171 -0
|
@@ -0,0 +1,1924 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/react/client/index.ts
|
|
32
|
+
var client_exports = {};
|
|
33
|
+
__export(client_exports, {
|
|
34
|
+
AlertDialog: () => AlertDialog,
|
|
35
|
+
AlertDialogAction: () => AlertDialogAction,
|
|
36
|
+
AlertDialogCancel: () => AlertDialogCancel,
|
|
37
|
+
AlertDialogContent: () => AlertDialogContent,
|
|
38
|
+
AlertDialogDescription: () => AlertDialogDescription,
|
|
39
|
+
AlertDialogFooter: () => AlertDialogFooter,
|
|
40
|
+
AlertDialogHeader: () => AlertDialogHeader,
|
|
41
|
+
AlertDialogOverlay: () => AlertDialogOverlay,
|
|
42
|
+
AlertDialogPortal: () => AlertDialogPortal,
|
|
43
|
+
AlertDialogTitle: () => AlertDialogTitle,
|
|
44
|
+
AlertDialogTrigger: () => AlertDialogTrigger,
|
|
45
|
+
BottomSheet: () => BottomSheet,
|
|
46
|
+
BottomSheetBody: () => BottomSheetBody,
|
|
47
|
+
BottomSheetClose: () => BottomSheetClose,
|
|
48
|
+
BottomSheetContent: () => BottomSheetContent,
|
|
49
|
+
BottomSheetDescription: () => BottomSheetDescription,
|
|
50
|
+
BottomSheetFooter: () => BottomSheetFooter,
|
|
51
|
+
BottomSheetHeader: () => BottomSheetHeader,
|
|
52
|
+
BottomSheetOverlay: () => BottomSheetOverlay,
|
|
53
|
+
BottomSheetTitle: () => BottomSheetTitle,
|
|
54
|
+
BottomSheetTrigger: () => BottomSheetTrigger,
|
|
55
|
+
Combobox: () => Combobox,
|
|
56
|
+
CopyButton: () => CopyButton,
|
|
57
|
+
DEFAULT_STORAGE_KEY: () => DEFAULT_STORAGE_KEY,
|
|
58
|
+
Dialog: () => Dialog2,
|
|
59
|
+
DialogClose: () => DialogClose,
|
|
60
|
+
DialogContent: () => DialogContent,
|
|
61
|
+
DialogDescription: () => DialogDescription,
|
|
62
|
+
DialogFooter: () => DialogFooter,
|
|
63
|
+
DialogHeader: () => DialogHeader,
|
|
64
|
+
DialogOverlay: () => DialogOverlay,
|
|
65
|
+
DialogPortal: () => DialogPortal,
|
|
66
|
+
DialogTitle: () => DialogTitle,
|
|
67
|
+
DialogTrigger: () => DialogTrigger,
|
|
68
|
+
DropdownMenu: () => DropdownMenu,
|
|
69
|
+
DropdownMenuCheckboxItem: () => DropdownMenuCheckboxItem,
|
|
70
|
+
DropdownMenuContent: () => DropdownMenuContent,
|
|
71
|
+
DropdownMenuGroup: () => DropdownMenuGroup,
|
|
72
|
+
DropdownMenuItem: () => DropdownMenuItem,
|
|
73
|
+
DropdownMenuLabel: () => DropdownMenuLabel,
|
|
74
|
+
DropdownMenuPortal: () => DropdownMenuPortal,
|
|
75
|
+
DropdownMenuRadioGroup: () => DropdownMenuRadioGroup,
|
|
76
|
+
DropdownMenuRadioItem: () => DropdownMenuRadioItem,
|
|
77
|
+
DropdownMenuSeparator: () => DropdownMenuSeparator,
|
|
78
|
+
DropdownMenuShortcut: () => DropdownMenuShortcut,
|
|
79
|
+
DropdownMenuSub: () => DropdownMenuSub,
|
|
80
|
+
DropdownMenuSubContent: () => DropdownMenuSubContent,
|
|
81
|
+
DropdownMenuSubTrigger: () => DropdownMenuSubTrigger,
|
|
82
|
+
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
83
|
+
ReadingProgress: () => ReadingProgress,
|
|
84
|
+
Select: () => Select,
|
|
85
|
+
SelectContent: () => SelectContent,
|
|
86
|
+
SelectGroup: () => SelectGroup,
|
|
87
|
+
SelectItem: () => SelectItem,
|
|
88
|
+
SelectLabel: () => SelectLabel,
|
|
89
|
+
SelectScrollDownButton: () => SelectScrollDownButton,
|
|
90
|
+
SelectScrollUpButton: () => SelectScrollUpButton,
|
|
91
|
+
SelectSeparator: () => SelectSeparator,
|
|
92
|
+
SelectTrigger: () => SelectTrigger,
|
|
93
|
+
SelectValue: () => SelectValue,
|
|
94
|
+
SidebarInset: () => SidebarInset,
|
|
95
|
+
SidebarPanel: () => SidebarPanel,
|
|
96
|
+
SidebarProvider: () => SidebarProvider,
|
|
97
|
+
SidebarTrigger: () => SidebarTrigger,
|
|
98
|
+
TableOfContents: () => TableOfContents,
|
|
99
|
+
Tabs: () => Tabs,
|
|
100
|
+
TabsContent: () => TabsContent,
|
|
101
|
+
TabsList: () => TabsList,
|
|
102
|
+
TabsTrigger: () => TabsTrigger,
|
|
103
|
+
ThemeProvider: () => ThemeProvider,
|
|
104
|
+
ThemeToggle: () => ThemeToggle,
|
|
105
|
+
ToastProvider: () => ToastProvider,
|
|
106
|
+
Tooltip: () => Tooltip,
|
|
107
|
+
TooltipContent: () => TooltipContent,
|
|
108
|
+
TooltipProvider: () => TooltipProvider,
|
|
109
|
+
TooltipTrigger: () => TooltipTrigger,
|
|
110
|
+
copyToClipboard: () => copyToClipboard,
|
|
111
|
+
createMediaQuery: () => createMediaQuery,
|
|
112
|
+
createReadingProgress: () => createReadingProgress,
|
|
113
|
+
createScrollSpy: () => createScrollSpy,
|
|
114
|
+
createThemeManager: () => createThemeManager,
|
|
115
|
+
defaultComboboxLabels: () => defaultComboboxLabels,
|
|
116
|
+
defaultThemeToggleLabels: () => defaultThemeToggleLabels,
|
|
117
|
+
useMediaQuery: () => useMediaQuery,
|
|
118
|
+
useReadingProgress: () => useReadingProgress,
|
|
119
|
+
useScrollSpy: () => useScrollSpy,
|
|
120
|
+
useSidebar: () => useSidebar,
|
|
121
|
+
useTheme: () => useTheme,
|
|
122
|
+
useToast: () => useToast
|
|
123
|
+
});
|
|
124
|
+
module.exports = __toCommonJS(client_exports);
|
|
125
|
+
|
|
126
|
+
// src/react/client/ThemeProvider.tsx
|
|
127
|
+
var import_react = require("react");
|
|
128
|
+
|
|
129
|
+
// src/tokens/colors.ts
|
|
130
|
+
var colors = {
|
|
131
|
+
dark: {
|
|
132
|
+
bg: "#0A0A0C",
|
|
133
|
+
bgElev: "#111114",
|
|
134
|
+
surface: "#16161B",
|
|
135
|
+
surface2: "#1C1C22",
|
|
136
|
+
border: "rgba(255,255,255,0.08)",
|
|
137
|
+
borderStrong: "rgba(255,255,255,0.14)",
|
|
138
|
+
// WCAG 1.4.11: edge of an input/select/checkbox must read ≥3:1 on every surface; the
|
|
139
|
+
// decorative borders above sit near 1.5:1 and stay decorative.
|
|
140
|
+
controlBorder: "#6B6B76",
|
|
141
|
+
text: "#EDEDF0",
|
|
142
|
+
text2: "#8B8B96",
|
|
143
|
+
// Corrected from #5A5A66 (~2.6:1 on surface) to meet WCAG AA 4.5:1 — text3 is used for
|
|
144
|
+
// real copy (metadata, TOC links), not decoration, so it must be readable, not just muted.
|
|
145
|
+
text3: "#83838F"
|
|
146
|
+
},
|
|
147
|
+
light: {
|
|
148
|
+
bg: "#F7F7F5",
|
|
149
|
+
bgElev: "#FFFFFF",
|
|
150
|
+
surface: "#FFFFFF",
|
|
151
|
+
surface2: "#F2F2EF",
|
|
152
|
+
border: "rgba(0,0,0,0.08)",
|
|
153
|
+
borderStrong: "rgba(0,0,0,0.14)",
|
|
154
|
+
controlBorder: "#85858E",
|
|
155
|
+
text: "#16161B",
|
|
156
|
+
text2: "#5A5A66",
|
|
157
|
+
// Corrected from #8B8B96 (~3.1:1 on white) to meet WCAG AA 4.5:1, same reasoning as dark.
|
|
158
|
+
// A further step from #6F6F78 to #6D6D76: the first fix cleared white/paper (≥4.7:1) but
|
|
159
|
+
// was only ~4.44:1 against surface2 (#F2F2EF), the darkest of the light surfaces — still a
|
|
160
|
+
// failure. Verified against bg/bgElev/surface/surface2 together, not just one background.
|
|
161
|
+
text3: "#6D6D76"
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
var accents = {
|
|
165
|
+
cyan: "oklch(0.78 0.12 210)",
|
|
166
|
+
violet: "oklch(0.72 0.14 295)",
|
|
167
|
+
mint: "oklch(0.78 0.10 160)",
|
|
168
|
+
amber: "oklch(0.78 0.12 75)"
|
|
169
|
+
};
|
|
170
|
+
var themeModes = Object.keys(colors);
|
|
171
|
+
var accentNames = Object.keys(accents);
|
|
172
|
+
var DEFAULT_MODE = "dark";
|
|
173
|
+
var DEFAULT_ACCENT = "cyan";
|
|
174
|
+
|
|
175
|
+
// src/behaviors/themeManager.ts
|
|
176
|
+
var DEFAULT_STORAGE_KEY = "still-void-theme";
|
|
177
|
+
function isMode(value) {
|
|
178
|
+
return themeModes.includes(value);
|
|
179
|
+
}
|
|
180
|
+
function isAccent(value) {
|
|
181
|
+
return accentNames.includes(value);
|
|
182
|
+
}
|
|
183
|
+
function readStorage(key) {
|
|
184
|
+
try {
|
|
185
|
+
const raw = window.localStorage.getItem(key);
|
|
186
|
+
if (!raw) return {};
|
|
187
|
+
const parsed = JSON.parse(raw);
|
|
188
|
+
if (typeof parsed !== "object" || parsed === null) return {};
|
|
189
|
+
const { mode, accent } = parsed;
|
|
190
|
+
return {
|
|
191
|
+
...isMode(mode) ? { mode } : {},
|
|
192
|
+
...isAccent(accent) ? { accent } : {}
|
|
193
|
+
};
|
|
194
|
+
} catch {
|
|
195
|
+
return {};
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function createThemeManager(options = {}) {
|
|
199
|
+
const root = options.root ?? document.documentElement;
|
|
200
|
+
const storageKey = options.storageKey === null ? null : options.storageKey ?? DEFAULT_STORAGE_KEY;
|
|
201
|
+
const ssrMode = root.getAttribute("data-theme");
|
|
202
|
+
const ssrAccent = root.getAttribute("data-accent");
|
|
203
|
+
const stored = storageKey ? readStorage(storageKey) : {};
|
|
204
|
+
let state = {
|
|
205
|
+
mode: stored.mode ?? (isMode(ssrMode) ? ssrMode : options.defaultMode ?? DEFAULT_MODE),
|
|
206
|
+
accent: stored.accent ?? (isAccent(ssrAccent) ? ssrAccent : options.defaultAccent ?? DEFAULT_ACCENT)
|
|
207
|
+
};
|
|
208
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
209
|
+
function apply() {
|
|
210
|
+
root.setAttribute("data-theme", state.mode);
|
|
211
|
+
root.setAttribute("data-accent", state.accent);
|
|
212
|
+
if (storageKey) {
|
|
213
|
+
try {
|
|
214
|
+
window.localStorage.setItem(storageKey, JSON.stringify(state));
|
|
215
|
+
} catch {
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
for (const listener of listeners) listener(state);
|
|
219
|
+
}
|
|
220
|
+
apply();
|
|
221
|
+
return {
|
|
222
|
+
getState: () => state,
|
|
223
|
+
setMode(mode) {
|
|
224
|
+
state = { ...state, mode };
|
|
225
|
+
apply();
|
|
226
|
+
},
|
|
227
|
+
setAccent(accent) {
|
|
228
|
+
state = { ...state, accent };
|
|
229
|
+
apply();
|
|
230
|
+
},
|
|
231
|
+
toggleMode() {
|
|
232
|
+
state = { ...state, mode: state.mode === "dark" ? "light" : "dark" };
|
|
233
|
+
apply();
|
|
234
|
+
},
|
|
235
|
+
subscribe(listener) {
|
|
236
|
+
listeners.add(listener);
|
|
237
|
+
return () => listeners.delete(listener);
|
|
238
|
+
},
|
|
239
|
+
destroy() {
|
|
240
|
+
listeners.clear();
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// src/react/client/ThemeProvider.tsx
|
|
246
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
247
|
+
var ThemeContext = (0, import_react.createContext)(null);
|
|
248
|
+
function ThemeProvider({
|
|
249
|
+
children,
|
|
250
|
+
defaultMode = DEFAULT_MODE,
|
|
251
|
+
defaultAccent = DEFAULT_ACCENT,
|
|
252
|
+
storageKey
|
|
253
|
+
}) {
|
|
254
|
+
const managerRef = (0, import_react.useRef)(null);
|
|
255
|
+
const [state, setState] = (0, import_react.useState)({ mode: defaultMode, accent: defaultAccent });
|
|
256
|
+
(0, import_react.useEffect)(() => {
|
|
257
|
+
const manager = createThemeManager({ defaultMode, defaultAccent, storageKey });
|
|
258
|
+
managerRef.current = manager;
|
|
259
|
+
setState(manager.getState());
|
|
260
|
+
const unsubscribe = manager.subscribe(setState);
|
|
261
|
+
return () => {
|
|
262
|
+
unsubscribe();
|
|
263
|
+
manager.destroy();
|
|
264
|
+
managerRef.current = null;
|
|
265
|
+
};
|
|
266
|
+
}, []);
|
|
267
|
+
const value = (0, import_react.useMemo)(
|
|
268
|
+
() => ({
|
|
269
|
+
mode: state.mode,
|
|
270
|
+
accent: state.accent,
|
|
271
|
+
setMode: (mode) => managerRef.current?.setMode(mode),
|
|
272
|
+
setAccent: (accent) => managerRef.current?.setAccent(accent),
|
|
273
|
+
toggleMode: () => managerRef.current?.toggleMode()
|
|
274
|
+
}),
|
|
275
|
+
[state]
|
|
276
|
+
);
|
|
277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext.Provider, { value, children });
|
|
278
|
+
}
|
|
279
|
+
function useTheme() {
|
|
280
|
+
const ctx = (0, import_react.useContext)(ThemeContext);
|
|
281
|
+
if (!ctx) throw new Error("useTheme must be used within ThemeProvider");
|
|
282
|
+
return ctx;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// src/recipes/cx.ts
|
|
286
|
+
function cx(...parts) {
|
|
287
|
+
return parts.filter(Boolean).join(" ");
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// src/react/client/ThemeToggle.tsx
|
|
291
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
292
|
+
var defaultThemeToggleLabels = {
|
|
293
|
+
light: "Light",
|
|
294
|
+
dark: "Dark",
|
|
295
|
+
switchToLight: "Switch to light theme",
|
|
296
|
+
switchToDark: "Switch to dark theme"
|
|
297
|
+
};
|
|
298
|
+
function ThemeToggle({ className, labels, onClick, children, ...rest }) {
|
|
299
|
+
const { mode, toggleMode } = useTheme();
|
|
300
|
+
const text = { ...defaultThemeToggleLabels, ...labels };
|
|
301
|
+
const isDark = mode === "dark";
|
|
302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
303
|
+
"button",
|
|
304
|
+
{
|
|
305
|
+
type: "button",
|
|
306
|
+
className: cx("sv-header__link", className),
|
|
307
|
+
"aria-label": isDark ? text.switchToLight : text.switchToDark,
|
|
308
|
+
...rest,
|
|
309
|
+
onClick: (event) => {
|
|
310
|
+
onClick?.(event);
|
|
311
|
+
if (!event.defaultPrevented) toggleMode();
|
|
312
|
+
},
|
|
313
|
+
children: children ?? (isDark ? text.light : text.dark)
|
|
314
|
+
}
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// src/react/client/CopyButton.tsx
|
|
319
|
+
var import_react2 = require("react");
|
|
320
|
+
|
|
321
|
+
// src/behaviors/clipboard.ts
|
|
322
|
+
async function copyToClipboard(text) {
|
|
323
|
+
if (typeof navigator === "undefined" || !navigator.clipboard?.writeText) return false;
|
|
324
|
+
try {
|
|
325
|
+
await navigator.clipboard.writeText(text);
|
|
326
|
+
return true;
|
|
327
|
+
} catch {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// src/recipes/article.ts
|
|
333
|
+
var codeBlockClasses = {
|
|
334
|
+
header: "sv-code-block__header",
|
|
335
|
+
pre: "sv-code-block__pre",
|
|
336
|
+
copy: "sv-code-block__copy",
|
|
337
|
+
copyCopied: cx("sv-code-block__copy", "sv-code-block__copy--copied")
|
|
338
|
+
};
|
|
339
|
+
function tableOfContents() {
|
|
340
|
+
return "sv-toc";
|
|
341
|
+
}
|
|
342
|
+
function tocLink(options = {}) {
|
|
343
|
+
return cx(
|
|
344
|
+
"sv-toc__link",
|
|
345
|
+
options.active && "sv-toc__link--active",
|
|
346
|
+
options.depth === 3 && "sv-toc__link--depth-3"
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
function readingProgress() {
|
|
350
|
+
return "sv-reading-progress";
|
|
351
|
+
}
|
|
352
|
+
var readingProgressClasses = {
|
|
353
|
+
bar: "sv-reading-progress__bar"
|
|
354
|
+
};
|
|
355
|
+
var READING_PROGRESS_VAR = "--sv-reading-progress";
|
|
356
|
+
|
|
357
|
+
// src/react/client/CopyButton.tsx
|
|
358
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
359
|
+
var COPIED_FEEDBACK_MS = 2e3;
|
|
360
|
+
function CopyButton({
|
|
361
|
+
code,
|
|
362
|
+
label = "Copy",
|
|
363
|
+
copiedLabel = "Copied",
|
|
364
|
+
className,
|
|
365
|
+
...rest
|
|
366
|
+
}) {
|
|
367
|
+
const [copied, setCopied] = (0, import_react2.useState)(false);
|
|
368
|
+
const timerRef = (0, import_react2.useRef)(null);
|
|
369
|
+
(0, import_react2.useEffect)(
|
|
370
|
+
() => () => {
|
|
371
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
372
|
+
},
|
|
373
|
+
[]
|
|
374
|
+
);
|
|
375
|
+
async function handleCopy() {
|
|
376
|
+
const ok = await copyToClipboard(code);
|
|
377
|
+
if (!ok) return;
|
|
378
|
+
setCopied(true);
|
|
379
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
380
|
+
timerRef.current = setTimeout(() => setCopied(false), COPIED_FEEDBACK_MS);
|
|
381
|
+
}
|
|
382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
383
|
+
"button",
|
|
384
|
+
{
|
|
385
|
+
type: "button",
|
|
386
|
+
onClick: handleCopy,
|
|
387
|
+
className: cx(copied ? codeBlockClasses.copyCopied : codeBlockClasses.copy, className),
|
|
388
|
+
"aria-live": "polite",
|
|
389
|
+
...rest,
|
|
390
|
+
children: copied ? copiedLabel : label
|
|
391
|
+
}
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// src/react/client/TableOfContents.tsx
|
|
396
|
+
var import_react4 = require("react");
|
|
397
|
+
|
|
398
|
+
// src/react/client/hooks.ts
|
|
399
|
+
var import_react3 = require("react");
|
|
400
|
+
|
|
401
|
+
// src/behaviors/mediaQuery.ts
|
|
402
|
+
function createMediaQuery(query) {
|
|
403
|
+
if (typeof window === "undefined" || !window.matchMedia) {
|
|
404
|
+
return {
|
|
405
|
+
getSnapshot: () => false,
|
|
406
|
+
subscribe: () => () => {
|
|
407
|
+
},
|
|
408
|
+
// no-op unsubscribe
|
|
409
|
+
destroy: () => {
|
|
410
|
+
}
|
|
411
|
+
// no-op
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
const mql = window.matchMedia(query);
|
|
415
|
+
const listeners = [];
|
|
416
|
+
let currentMatches = mql.matches;
|
|
417
|
+
let attached = false;
|
|
418
|
+
const handleChange = () => {
|
|
419
|
+
const newMatches = mql.matches;
|
|
420
|
+
if (newMatches !== currentMatches) {
|
|
421
|
+
currentMatches = newMatches;
|
|
422
|
+
for (const listener of [...listeners]) {
|
|
423
|
+
listener();
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
const attachListener = () => {
|
|
428
|
+
if (attached) return;
|
|
429
|
+
attached = true;
|
|
430
|
+
if (mql.addEventListener) {
|
|
431
|
+
mql.addEventListener("change", handleChange);
|
|
432
|
+
} else if (mql.addListener) {
|
|
433
|
+
mql.addListener(handleChange);
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
const detachListener = () => {
|
|
437
|
+
if (!attached) return;
|
|
438
|
+
attached = false;
|
|
439
|
+
if (mql.removeEventListener) {
|
|
440
|
+
mql.removeEventListener("change", handleChange);
|
|
441
|
+
} else if (mql.removeListener) {
|
|
442
|
+
mql.removeListener(handleChange);
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
return {
|
|
446
|
+
getSnapshot: () => mql.matches,
|
|
447
|
+
subscribe: (listener) => {
|
|
448
|
+
listeners.push(listener);
|
|
449
|
+
attachListener();
|
|
450
|
+
return () => {
|
|
451
|
+
const index = listeners.indexOf(listener);
|
|
452
|
+
if (index >= 0) {
|
|
453
|
+
listeners.splice(index, 1);
|
|
454
|
+
}
|
|
455
|
+
if (listeners.length === 0) {
|
|
456
|
+
detachListener();
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
},
|
|
460
|
+
destroy: () => {
|
|
461
|
+
listeners.length = 0;
|
|
462
|
+
detachListener();
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// src/behaviors/readingProgress.ts
|
|
468
|
+
var raf = typeof window !== "undefined" && typeof window.requestAnimationFrame === "function" ? (cb) => window.requestAnimationFrame(cb) : (
|
|
469
|
+
/* v8 ignore next */
|
|
470
|
+
(cb) => setTimeout(cb, 16)
|
|
471
|
+
);
|
|
472
|
+
var cancelRaf = typeof window !== "undefined" && typeof window.cancelAnimationFrame === "function" ? (id) => window.cancelAnimationFrame(id) : (
|
|
473
|
+
/* v8 ignore next */
|
|
474
|
+
(id) => clearTimeout(id)
|
|
475
|
+
);
|
|
476
|
+
function createReadingProgress(options = {}) {
|
|
477
|
+
const varTarget = options.varTarget === null ? null : options.varTarget ?? document.documentElement;
|
|
478
|
+
let percent = 0;
|
|
479
|
+
function measure() {
|
|
480
|
+
if (options.target) {
|
|
481
|
+
const rect = options.target.getBoundingClientRect();
|
|
482
|
+
const viewport = window.innerHeight;
|
|
483
|
+
const total2 = rect.height - viewport;
|
|
484
|
+
if (total2 <= 0) return 1;
|
|
485
|
+
return Math.min(1, Math.max(0, -rect.top / total2));
|
|
486
|
+
}
|
|
487
|
+
const doc = document.documentElement;
|
|
488
|
+
const total = doc.scrollHeight - window.innerHeight;
|
|
489
|
+
if (total <= 0) return 1;
|
|
490
|
+
return Math.min(1, Math.max(0, window.scrollY / total));
|
|
491
|
+
}
|
|
492
|
+
function update() {
|
|
493
|
+
percent = measure();
|
|
494
|
+
varTarget?.style.setProperty(READING_PROGRESS_VAR, String(percent));
|
|
495
|
+
options.onChange?.(percent);
|
|
496
|
+
}
|
|
497
|
+
let frame = null;
|
|
498
|
+
function onFrame() {
|
|
499
|
+
frame = null;
|
|
500
|
+
update();
|
|
501
|
+
}
|
|
502
|
+
function schedule() {
|
|
503
|
+
if (frame !== null) return;
|
|
504
|
+
frame = raf(onFrame);
|
|
505
|
+
}
|
|
506
|
+
update();
|
|
507
|
+
window.addEventListener("scroll", schedule, { passive: true });
|
|
508
|
+
window.addEventListener("resize", schedule, { passive: true });
|
|
509
|
+
return {
|
|
510
|
+
getPercent: () => percent,
|
|
511
|
+
destroy() {
|
|
512
|
+
window.removeEventListener("scroll", schedule);
|
|
513
|
+
window.removeEventListener("resize", schedule);
|
|
514
|
+
if (frame !== null) cancelRaf(frame);
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// src/behaviors/scrollSpy.ts
|
|
520
|
+
function createScrollSpy(ids, options) {
|
|
521
|
+
const visible = /* @__PURE__ */ new Map();
|
|
522
|
+
const observer = new IntersectionObserver(
|
|
523
|
+
(entries) => {
|
|
524
|
+
for (const entry of entries) {
|
|
525
|
+
if (entry.isIntersecting) {
|
|
526
|
+
visible.set(entry.target.id, entry.intersectionRatio);
|
|
527
|
+
} else {
|
|
528
|
+
visible.delete(entry.target.id);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
const active = ids.find((id) => visible.has(id)) ?? null;
|
|
532
|
+
options.onChange(active);
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
rootMargin: options.rootMargin ?? "0px 0px -70% 0px",
|
|
536
|
+
threshold: options.threshold ?? 0
|
|
537
|
+
}
|
|
538
|
+
);
|
|
539
|
+
for (const id of ids) {
|
|
540
|
+
const el = document.getElementById(id);
|
|
541
|
+
if (el) observer.observe(el);
|
|
542
|
+
}
|
|
543
|
+
return {
|
|
544
|
+
destroy: () => observer.disconnect()
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// src/react/client/hooks.ts
|
|
549
|
+
function useScrollSpy(ids, rootMargin) {
|
|
550
|
+
const [activeId, setActiveId] = (0, import_react3.useState)(null);
|
|
551
|
+
const key = ids.join("|");
|
|
552
|
+
(0, import_react3.useEffect)(() => {
|
|
553
|
+
const spy = createScrollSpy(ids, { onChange: setActiveId, rootMargin });
|
|
554
|
+
return () => spy.destroy();
|
|
555
|
+
}, [key, rootMargin]);
|
|
556
|
+
return activeId;
|
|
557
|
+
}
|
|
558
|
+
function useReadingProgress(target, step = 1) {
|
|
559
|
+
const [percent, setPercent] = (0, import_react3.useState)(0);
|
|
560
|
+
(0, import_react3.useEffect)(() => {
|
|
561
|
+
const progress = createReadingProgress({
|
|
562
|
+
target: target ?? void 0,
|
|
563
|
+
onChange: (value) => {
|
|
564
|
+
const bucket = step > 0 ? Math.round(value / step) * step : value;
|
|
565
|
+
setPercent((prev) => prev === bucket ? prev : bucket);
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
return () => progress.destroy();
|
|
569
|
+
}, [target, step]);
|
|
570
|
+
return percent;
|
|
571
|
+
}
|
|
572
|
+
function useMediaQuery(query) {
|
|
573
|
+
const mq = (0, import_react3.useSyncExternalStore)(
|
|
574
|
+
// subscribe: attach listener and return unsubscribe
|
|
575
|
+
(onStoreChange) => {
|
|
576
|
+
const mediaQuery = createMediaQuery(query);
|
|
577
|
+
const unsubscribe = mediaQuery.subscribe(onStoreChange);
|
|
578
|
+
return () => {
|
|
579
|
+
unsubscribe();
|
|
580
|
+
mediaQuery.destroy();
|
|
581
|
+
};
|
|
582
|
+
},
|
|
583
|
+
// getSnapshot: return current state (after hydration)
|
|
584
|
+
() => {
|
|
585
|
+
const mediaQuery = createMediaQuery(query);
|
|
586
|
+
const matches = mediaQuery.getSnapshot();
|
|
587
|
+
mediaQuery.destroy();
|
|
588
|
+
return matches;
|
|
589
|
+
},
|
|
590
|
+
// getServerSnapshot: return initial state during SSR (desktop/false)
|
|
591
|
+
// R5-01 AC-4: SSR returns false without error
|
|
592
|
+
() => false
|
|
593
|
+
);
|
|
594
|
+
return mq;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// src/react/client/TableOfContents.tsx
|
|
598
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
599
|
+
function TableOfContents({
|
|
600
|
+
items,
|
|
601
|
+
rootMargin,
|
|
602
|
+
label = "Table of contents",
|
|
603
|
+
className,
|
|
604
|
+
...rest
|
|
605
|
+
}) {
|
|
606
|
+
const ids = (0, import_react4.useMemo)(() => items.map((item) => item.id), [items]);
|
|
607
|
+
const activeId = useScrollSpy(ids, rootMargin);
|
|
608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("nav", { className: cx(tableOfContents(), className), "aria-label": label, ...rest, children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
609
|
+
"a",
|
|
610
|
+
{
|
|
611
|
+
href: `#${item.id}`,
|
|
612
|
+
className: tocLink({ active: item.id === activeId, depth: item.depth }),
|
|
613
|
+
"aria-current": item.id === activeId ? "true" : void 0,
|
|
614
|
+
children: item.label
|
|
615
|
+
},
|
|
616
|
+
item.id
|
|
617
|
+
)) });
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
// src/react/client/ReadingProgress.tsx
|
|
621
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
622
|
+
function ReadingProgress({
|
|
623
|
+
target,
|
|
624
|
+
announce,
|
|
625
|
+
label = "Reading progress",
|
|
626
|
+
className,
|
|
627
|
+
...rest
|
|
628
|
+
}) {
|
|
629
|
+
const percent = useReadingProgress(target, announce ? 0.1 : 1);
|
|
630
|
+
const a11yProps = announce ? {
|
|
631
|
+
role: "progressbar",
|
|
632
|
+
"aria-valuemin": 0,
|
|
633
|
+
"aria-valuemax": 100,
|
|
634
|
+
"aria-valuenow": Math.round(percent * 100),
|
|
635
|
+
"aria-label": label
|
|
636
|
+
} : { "aria-hidden": true };
|
|
637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: cx(readingProgress(), className), ...a11yProps, ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: readingProgressClasses.bar }) });
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
// src/react/client/ToastProvider.tsx
|
|
641
|
+
var React2 = __toESM(require("react"), 1);
|
|
642
|
+
var Toast = __toESM(require("@radix-ui/react-toast"), 1);
|
|
643
|
+
|
|
644
|
+
// src/components/ui/icon.tsx
|
|
645
|
+
var React = __toESM(require("react"), 1);
|
|
646
|
+
|
|
647
|
+
// src/lib/utils.ts
|
|
648
|
+
var import_clsx = require("clsx");
|
|
649
|
+
function cn(...inputs) {
|
|
650
|
+
return (0, import_clsx.clsx)(inputs);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
// src/components/ui/icon-set.ts
|
|
654
|
+
var import_outline = require("@heroicons/react/24/outline");
|
|
655
|
+
var ICON_GLYPHS = {
|
|
656
|
+
x: import_outline.XMarkIcon,
|
|
657
|
+
check: import_outline.CheckIcon,
|
|
658
|
+
"chevron-down": import_outline.ChevronDownIcon,
|
|
659
|
+
"chevron-up": import_outline.ChevronUpIcon,
|
|
660
|
+
"chevron-right": import_outline.ChevronRightIcon,
|
|
661
|
+
"chevron-left": import_outline.ChevronLeftIcon,
|
|
662
|
+
info: import_outline.InformationCircleIcon,
|
|
663
|
+
"alert-triangle": import_outline.ExclamationTriangleIcon,
|
|
664
|
+
"alert-circle": import_outline.ExclamationCircleIcon,
|
|
665
|
+
"check-circle": import_outline.CheckCircleIcon,
|
|
666
|
+
copy: import_outline.DocumentDuplicateIcon,
|
|
667
|
+
sun: import_outline.SunIcon,
|
|
668
|
+
moon: import_outline.MoonIcon,
|
|
669
|
+
search: import_outline.MagnifyingGlassIcon,
|
|
670
|
+
menu: import_outline.Bars3Icon,
|
|
671
|
+
camera: import_outline.CameraIcon,
|
|
672
|
+
blocked: import_outline.NoSymbolIcon,
|
|
673
|
+
pending: import_outline.ClockIcon
|
|
674
|
+
};
|
|
675
|
+
var ICON_NAMES = Object.keys(ICON_GLYPHS);
|
|
676
|
+
var ICON_FALLBACK_NAME = "alert-circle";
|
|
677
|
+
|
|
678
|
+
// src/components/ui/icon.tsx
|
|
679
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
680
|
+
var Icon = React.forwardRef(
|
|
681
|
+
({ name, size = "md", label, className, ...props }, ref) => {
|
|
682
|
+
const Glyph = ICON_GLYPHS[name] ?? ICON_GLYPHS[ICON_FALLBACK_NAME];
|
|
683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
684
|
+
Glyph,
|
|
685
|
+
{
|
|
686
|
+
...props,
|
|
687
|
+
ref,
|
|
688
|
+
"data-icon-name": name,
|
|
689
|
+
className: cn(
|
|
690
|
+
"sv-icon",
|
|
691
|
+
size === "sm" && "sv-icon--sm",
|
|
692
|
+
size === "lg" && "sv-icon--lg",
|
|
693
|
+
className
|
|
694
|
+
),
|
|
695
|
+
"aria-hidden": label === void 0 ? "true" : void 0,
|
|
696
|
+
role: label === void 0 ? void 0 : "img",
|
|
697
|
+
"aria-label": label
|
|
698
|
+
}
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
);
|
|
702
|
+
Icon.displayName = "Icon";
|
|
703
|
+
|
|
704
|
+
// src/react/client/ToastProvider.tsx
|
|
705
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
706
|
+
var ToastContext = React2.createContext(null);
|
|
707
|
+
function useToast() {
|
|
708
|
+
const context = React2.useContext(ToastContext);
|
|
709
|
+
if (!context) {
|
|
710
|
+
throw new Error("useToast must be used within ToastProvider");
|
|
711
|
+
}
|
|
712
|
+
return context;
|
|
713
|
+
}
|
|
714
|
+
var variantConfig = {
|
|
715
|
+
info: { icon: "info", type: "background" },
|
|
716
|
+
success: { icon: "check-circle", type: "background" },
|
|
717
|
+
warning: { icon: "alert-triangle", type: "foreground" },
|
|
718
|
+
danger: { icon: "alert-circle", type: "foreground" }
|
|
719
|
+
};
|
|
720
|
+
function toastReducer(state, action) {
|
|
721
|
+
switch (action.type) {
|
|
722
|
+
case "ADD": {
|
|
723
|
+
return [...state, action.entry];
|
|
724
|
+
}
|
|
725
|
+
case "REMOVE": {
|
|
726
|
+
return state.filter((t) => t.id !== action.id);
|
|
727
|
+
}
|
|
728
|
+
case "UPDATE": {
|
|
729
|
+
return state.map(
|
|
730
|
+
(t) => t.id === action.id ? { ...t, ...action.patch, version: t.version + 1 } : t
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
case "REMOVE_ALL": {
|
|
734
|
+
return [];
|
|
735
|
+
}
|
|
736
|
+
/* v8 ignore next 2 */
|
|
737
|
+
default: {
|
|
738
|
+
return state;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
function ToastProvider({
|
|
743
|
+
children,
|
|
744
|
+
duration = 5e3,
|
|
745
|
+
max = 3,
|
|
746
|
+
label = "Notifications",
|
|
747
|
+
closeLabel = "Close",
|
|
748
|
+
swipeDirection = "right"
|
|
749
|
+
}) {
|
|
750
|
+
const [allToasts, dispatch] = React2.useReducer(toastReducer, []);
|
|
751
|
+
const isMountedRef = React2.useRef(true);
|
|
752
|
+
React2.useEffect(() => {
|
|
753
|
+
isMountedRef.current = true;
|
|
754
|
+
return () => {
|
|
755
|
+
isMountedRef.current = false;
|
|
756
|
+
};
|
|
757
|
+
}, []);
|
|
758
|
+
const validatedMax = typeof max === "number" && Number.isFinite(max) && max > 0 ? Math.floor(max) : 3;
|
|
759
|
+
const displayedToasts = allToasts.slice(-validatedMax);
|
|
760
|
+
const toast = React2.useCallback(
|
|
761
|
+
(options) => {
|
|
762
|
+
if (!isMountedRef.current) return { id: "", dismiss: () => {
|
|
763
|
+
}, update: () => {
|
|
764
|
+
} };
|
|
765
|
+
const id = Math.random().toString(36).substr(2, 9);
|
|
766
|
+
const variant = options.variant ?? "info";
|
|
767
|
+
const duration_val = typeof options.duration === "number" && options.duration > 0 ? options.duration : duration;
|
|
768
|
+
const entry = {
|
|
769
|
+
...options,
|
|
770
|
+
variant,
|
|
771
|
+
duration: duration_val,
|
|
772
|
+
id,
|
|
773
|
+
version: 0
|
|
774
|
+
};
|
|
775
|
+
dispatch({ type: "ADD", entry });
|
|
776
|
+
return {
|
|
777
|
+
id,
|
|
778
|
+
dismiss: () => dispatch({ type: "REMOVE", id }),
|
|
779
|
+
update: (patch) => {
|
|
780
|
+
dispatch({ type: "UPDATE", id, patch });
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
},
|
|
784
|
+
[duration]
|
|
785
|
+
);
|
|
786
|
+
const dismiss = React2.useCallback((id) => {
|
|
787
|
+
dispatch({ type: "REMOVE", id });
|
|
788
|
+
}, []);
|
|
789
|
+
const dismissAll = React2.useCallback(() => {
|
|
790
|
+
dispatch({ type: "REMOVE_ALL" });
|
|
791
|
+
}, []);
|
|
792
|
+
React2.useEffect(() => {
|
|
793
|
+
if (allToasts.length > validatedMax) {
|
|
794
|
+
const toRemove = allToasts[0];
|
|
795
|
+
if (toRemove) {
|
|
796
|
+
dismiss(toRemove.id);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
}, [allToasts, validatedMax, dismiss]);
|
|
800
|
+
const value = {
|
|
801
|
+
toast,
|
|
802
|
+
dismiss,
|
|
803
|
+
dismissAll,
|
|
804
|
+
toasts: displayedToasts
|
|
805
|
+
};
|
|
806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ToastContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Toast.Provider, { duration, label, swipeDirection, children: [
|
|
807
|
+
children,
|
|
808
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Toast.Viewport, { className: "sv-toast__viewport" }),
|
|
809
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
810
|
+
ToastViewportRenderer,
|
|
811
|
+
{
|
|
812
|
+
toasts: displayedToasts,
|
|
813
|
+
closeLabel,
|
|
814
|
+
duration,
|
|
815
|
+
dismiss
|
|
816
|
+
}
|
|
817
|
+
)
|
|
818
|
+
] }) });
|
|
819
|
+
}
|
|
820
|
+
function ToastViewportRenderer({
|
|
821
|
+
toasts,
|
|
822
|
+
closeLabel,
|
|
823
|
+
duration,
|
|
824
|
+
dismiss
|
|
825
|
+
}) {
|
|
826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: toasts.map((entry) => {
|
|
827
|
+
const { id, title, description, variant = "info", action } = entry;
|
|
828
|
+
const config = variantConfig[variant];
|
|
829
|
+
const toastDuration = entry.duration ?? duration;
|
|
830
|
+
const handleActionClick = () => {
|
|
831
|
+
if (action?.onClick) {
|
|
832
|
+
action.onClick();
|
|
833
|
+
}
|
|
834
|
+
dismiss(id);
|
|
835
|
+
};
|
|
836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
837
|
+
Toast.Root,
|
|
838
|
+
{
|
|
839
|
+
open: true,
|
|
840
|
+
onOpenChange: (open) => {
|
|
841
|
+
if (!open) {
|
|
842
|
+
dismiss(id);
|
|
843
|
+
}
|
|
844
|
+
},
|
|
845
|
+
duration: toastDuration,
|
|
846
|
+
type: config.type,
|
|
847
|
+
"data-variant": variant,
|
|
848
|
+
className: cn("sv-toast", `sv-toast--${variant}`),
|
|
849
|
+
children: [
|
|
850
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: config.icon, className: "sv-toast__icon", "aria-hidden": "true", "data-name": config.icon }),
|
|
851
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "sv-toast__content", children: [
|
|
852
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Toast.Title, { className: "sv-toast__title", children: title }),
|
|
853
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Toast.Description, { className: "sv-toast__description", children: description })
|
|
854
|
+
] }),
|
|
855
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "sv-toast__actions", children: [
|
|
856
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
857
|
+
Toast.Action,
|
|
858
|
+
{
|
|
859
|
+
altText: action.altText,
|
|
860
|
+
asChild: true,
|
|
861
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
862
|
+
"button",
|
|
863
|
+
{
|
|
864
|
+
type: "button",
|
|
865
|
+
className: "sv-toast__action",
|
|
866
|
+
onClick: handleActionClick,
|
|
867
|
+
children: action.label
|
|
868
|
+
}
|
|
869
|
+
)
|
|
870
|
+
}
|
|
871
|
+
),
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Toast.Close, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "sv-toast__close", "aria-label": closeLabel, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "x" }) }) })
|
|
873
|
+
] })
|
|
874
|
+
]
|
|
875
|
+
},
|
|
876
|
+
`${id}-${entry.version}`
|
|
877
|
+
);
|
|
878
|
+
}) });
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
// src/react/client/SidebarProvider.tsx
|
|
882
|
+
var import_react5 = require("react");
|
|
883
|
+
var Dialog = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
884
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
885
|
+
function composeRefs(...refs) {
|
|
886
|
+
return (node) => {
|
|
887
|
+
for (const ref of refs) {
|
|
888
|
+
if (typeof ref === "function") {
|
|
889
|
+
ref(node);
|
|
890
|
+
} else if (ref !== null && ref !== void 0) {
|
|
891
|
+
;
|
|
892
|
+
ref.current = node;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
var DEFAULT_BREAKPOINT = 1024;
|
|
898
|
+
var noopSubscribe = () => () => {
|
|
899
|
+
};
|
|
900
|
+
function useHydrated() {
|
|
901
|
+
return (0, import_react5.useSyncExternalStore)(
|
|
902
|
+
noopSubscribe,
|
|
903
|
+
() => true,
|
|
904
|
+
() => false
|
|
905
|
+
);
|
|
906
|
+
}
|
|
907
|
+
var SidebarContext = (0, import_react5.createContext)(null);
|
|
908
|
+
function SidebarProvider({
|
|
909
|
+
children,
|
|
910
|
+
defaultOpen = true,
|
|
911
|
+
open: controlledOpen,
|
|
912
|
+
onOpenChange,
|
|
913
|
+
collapsible: collapsibleProp = "offcanvas",
|
|
914
|
+
breakpoint: breakpointProp
|
|
915
|
+
}) {
|
|
916
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react5.useState)(defaultOpen);
|
|
917
|
+
const panelId = (0, import_react5.useId)();
|
|
918
|
+
const triggerRef = (0, import_react5.useRef)(null);
|
|
919
|
+
const breakpoint = (() => {
|
|
920
|
+
if (breakpointProp === void 0 || breakpointProp === 0 || breakpointProp < 0 || Number.isNaN(breakpointProp) || !Number.isFinite(breakpointProp)) {
|
|
921
|
+
return DEFAULT_BREAKPOINT;
|
|
922
|
+
}
|
|
923
|
+
return breakpointProp;
|
|
924
|
+
})();
|
|
925
|
+
const hydrated = useHydrated();
|
|
926
|
+
const matchesDesktop = useMediaQuery(`(min-width: ${breakpoint}px)`);
|
|
927
|
+
const isMobile = hydrated ? !matchesDesktop : false;
|
|
928
|
+
const isControlled = controlledOpen !== void 0;
|
|
929
|
+
const open = isControlled ? controlledOpen : uncontrolledOpen;
|
|
930
|
+
const setOpen = (0, import_react5.useCallback)(
|
|
931
|
+
(newOpen) => {
|
|
932
|
+
if (collapsibleProp === "none") return;
|
|
933
|
+
if (isControlled) {
|
|
934
|
+
onOpenChange?.(newOpen);
|
|
935
|
+
} else {
|
|
936
|
+
setUncontrolledOpen(newOpen);
|
|
937
|
+
}
|
|
938
|
+
},
|
|
939
|
+
[collapsibleProp, isControlled, onOpenChange]
|
|
940
|
+
);
|
|
941
|
+
const toggle = (0, import_react5.useCallback)(() => {
|
|
942
|
+
if (collapsibleProp === "none") return;
|
|
943
|
+
if (isControlled) {
|
|
944
|
+
onOpenChange?.(!controlledOpen);
|
|
945
|
+
} else {
|
|
946
|
+
setUncontrolledOpen((prev) => !prev);
|
|
947
|
+
}
|
|
948
|
+
}, [collapsibleProp, isControlled, controlledOpen, onOpenChange]);
|
|
949
|
+
const contextValue = {
|
|
950
|
+
open,
|
|
951
|
+
setOpen,
|
|
952
|
+
toggle,
|
|
953
|
+
isMobile,
|
|
954
|
+
collapsible: collapsibleProp,
|
|
955
|
+
panelId,
|
|
956
|
+
triggerRef
|
|
957
|
+
};
|
|
958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
959
|
+
"div",
|
|
960
|
+
{
|
|
961
|
+
className: "sv-app-shell",
|
|
962
|
+
"data-state": open ? "open" : "closed",
|
|
963
|
+
"data-collapsible": collapsibleProp,
|
|
964
|
+
"data-mobile": hydrated ? isMobile : void 0,
|
|
965
|
+
"data-breakpoint": breakpoint === DEFAULT_BREAKPOINT ? void 0 : breakpoint,
|
|
966
|
+
children: [
|
|
967
|
+
!hydrated && breakpoint !== DEFAULT_BREAKPOINT ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SidebarBreakpointStyle, { breakpoint }) : null,
|
|
968
|
+
children
|
|
969
|
+
]
|
|
970
|
+
}
|
|
971
|
+
) });
|
|
972
|
+
}
|
|
973
|
+
function SidebarBreakpointStyle({ breakpoint }) {
|
|
974
|
+
const scope = `.sv-app-shell[data-breakpoint="${breakpoint}"]:not([data-mobile]):not([data-collapsible='none'])`;
|
|
975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("style", { children: `@media (width < ${breakpoint}px){${scope} .sv-app-sidebar{display:none}}` });
|
|
976
|
+
}
|
|
977
|
+
function useSidebar() {
|
|
978
|
+
const context = (0, import_react5.useContext)(SidebarContext);
|
|
979
|
+
if (!context) {
|
|
980
|
+
throw new Error("useSidebar must be used within SidebarProvider");
|
|
981
|
+
}
|
|
982
|
+
return context;
|
|
983
|
+
}
|
|
984
|
+
var SidebarPanel = (0, import_react5.forwardRef)(
|
|
985
|
+
function SidebarPanel2({ className, title = "Navigation", closeLabel = "Close sidebar", children, ...props }, ref) {
|
|
986
|
+
const { open, setOpen, isMobile, collapsible, panelId, triggerRef } = useSidebar();
|
|
987
|
+
if (isMobile && collapsible !== "none") {
|
|
988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Dialog.Root, { open, onOpenChange: setOpen, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Dialog.Portal, { children: [
|
|
989
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Dialog.Overlay, { className: "sv-overlay" }),
|
|
990
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
991
|
+
Dialog.Content,
|
|
992
|
+
{
|
|
993
|
+
ref,
|
|
994
|
+
className: cn("sv-app-sidebar sv-app-sidebar__drawer", className),
|
|
995
|
+
role: "dialog",
|
|
996
|
+
"aria-modal": "true",
|
|
997
|
+
id: panelId,
|
|
998
|
+
onCloseAutoFocus: (event) => {
|
|
999
|
+
event.preventDefault();
|
|
1000
|
+
triggerRef.current?.focus();
|
|
1001
|
+
},
|
|
1002
|
+
...props,
|
|
1003
|
+
children: [
|
|
1004
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Dialog.Title, { className: "sv-sr-only", children: title }),
|
|
1005
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "sv-app-sidebar__body", children }),
|
|
1006
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Dialog.Close, { className: "sv-dialog__close", asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-label": closeLabel, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "x" }) }) })
|
|
1007
|
+
]
|
|
1008
|
+
}
|
|
1009
|
+
)
|
|
1010
|
+
] }) });
|
|
1011
|
+
}
|
|
1012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1013
|
+
"aside",
|
|
1014
|
+
{
|
|
1015
|
+
ref,
|
|
1016
|
+
className: cn("sv-app-sidebar", className),
|
|
1017
|
+
id: panelId,
|
|
1018
|
+
...props,
|
|
1019
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "sv-app-sidebar__body", children })
|
|
1020
|
+
}
|
|
1021
|
+
);
|
|
1022
|
+
}
|
|
1023
|
+
);
|
|
1024
|
+
SidebarPanel.displayName = "SidebarPanel";
|
|
1025
|
+
var SidebarTrigger = (0, import_react5.forwardRef)(
|
|
1026
|
+
function SidebarTrigger2({ className, label, children, onClick, ...props }, ref) {
|
|
1027
|
+
const { open, toggle, collapsible, panelId, triggerRef } = useSidebar();
|
|
1028
|
+
if (collapsible === "none") {
|
|
1029
|
+
return null;
|
|
1030
|
+
}
|
|
1031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1032
|
+
"button",
|
|
1033
|
+
{
|
|
1034
|
+
ref: composeRefs(ref, triggerRef),
|
|
1035
|
+
type: "button",
|
|
1036
|
+
...props,
|
|
1037
|
+
className: cn("sv-app-sidebar-trigger", className),
|
|
1038
|
+
"aria-expanded": open,
|
|
1039
|
+
"aria-controls": panelId,
|
|
1040
|
+
"aria-label": label || "Toggle sidebar",
|
|
1041
|
+
onClick: (event) => {
|
|
1042
|
+
onClick?.(event);
|
|
1043
|
+
toggle();
|
|
1044
|
+
},
|
|
1045
|
+
children: children || /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "menu" })
|
|
1046
|
+
}
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
1049
|
+
);
|
|
1050
|
+
SidebarTrigger.displayName = "SidebarTrigger";
|
|
1051
|
+
var SidebarInset = (0, import_react5.forwardRef)(
|
|
1052
|
+
function SidebarInset2({ className, ...props }, ref) {
|
|
1053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("main", { ref, className: cn("sv-app-sidebar-inset", className), ...props });
|
|
1054
|
+
}
|
|
1055
|
+
);
|
|
1056
|
+
SidebarInset.displayName = "SidebarInset";
|
|
1057
|
+
|
|
1058
|
+
// src/components/ui/dialog.tsx
|
|
1059
|
+
var React4 = __toESM(require("react"), 1);
|
|
1060
|
+
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1061
|
+
|
|
1062
|
+
// src/components/ui/restore-focus.ts
|
|
1063
|
+
var React3 = __toESM(require("react"), 1);
|
|
1064
|
+
function useRestoreFocus(onCloseAutoFocus) {
|
|
1065
|
+
const [opener] = React3.useState(() => {
|
|
1066
|
+
if (typeof document === "undefined") return null;
|
|
1067
|
+
const active = document.activeElement;
|
|
1068
|
+
return active instanceof HTMLElement && active !== document.body ? active : null;
|
|
1069
|
+
});
|
|
1070
|
+
return (event) => {
|
|
1071
|
+
onCloseAutoFocus?.(event);
|
|
1072
|
+
if (event.defaultPrevented) return;
|
|
1073
|
+
if (opener === null || !opener.isConnected) return;
|
|
1074
|
+
event.preventDefault();
|
|
1075
|
+
opener.focus({ preventScroll: true });
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
// src/components/ui/dialog.tsx
|
|
1080
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1081
|
+
var Dialog2 = DialogPrimitive.Root;
|
|
1082
|
+
var DialogTrigger = DialogPrimitive.Trigger;
|
|
1083
|
+
var DialogPortal = DialogPrimitive.Portal;
|
|
1084
|
+
var DialogClose = DialogPrimitive.Close;
|
|
1085
|
+
var DialogOverlay = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1086
|
+
DialogPrimitive.Overlay,
|
|
1087
|
+
{
|
|
1088
|
+
ref,
|
|
1089
|
+
className: cn("sv-overlay", className),
|
|
1090
|
+
...props
|
|
1091
|
+
}
|
|
1092
|
+
));
|
|
1093
|
+
DialogOverlay.displayName = "DialogOverlay";
|
|
1094
|
+
var DialogContent = React4.forwardRef(({ className, children, showCloseButton = true, closeLabel: closeLabelProp, onCloseAutoFocus, ...props }, ref) => {
|
|
1095
|
+
const restoreFocus = useRestoreFocus(onCloseAutoFocus);
|
|
1096
|
+
const closeLabel = closeLabelProp && closeLabelProp.trim().length > 0 ? closeLabelProp : "Close dialog";
|
|
1097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogPortal, { children: [
|
|
1098
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogOverlay, {}),
|
|
1099
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1100
|
+
DialogPrimitive.Content,
|
|
1101
|
+
{
|
|
1102
|
+
ref,
|
|
1103
|
+
className: cn("sv-dialog", className),
|
|
1104
|
+
...props,
|
|
1105
|
+
onCloseAutoFocus: restoreFocus,
|
|
1106
|
+
"aria-modal": "true",
|
|
1107
|
+
children: [
|
|
1108
|
+
children,
|
|
1109
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogPrimitive.Close, { className: "sv-dialog__close", children: [
|
|
1110
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: "x" }),
|
|
1111
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "sv-sr-only", children: closeLabel })
|
|
1112
|
+
] }) : null
|
|
1113
|
+
]
|
|
1114
|
+
}
|
|
1115
|
+
)
|
|
1116
|
+
] });
|
|
1117
|
+
});
|
|
1118
|
+
DialogContent.displayName = "DialogContent";
|
|
1119
|
+
var DialogHeader = ({
|
|
1120
|
+
className,
|
|
1121
|
+
...props
|
|
1122
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("sv-dialog__header", className), ...props });
|
|
1123
|
+
DialogHeader.displayName = "DialogHeader";
|
|
1124
|
+
var DialogFooter = ({
|
|
1125
|
+
className,
|
|
1126
|
+
...props
|
|
1127
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("sv-dialog__footer", className), ...props });
|
|
1128
|
+
DialogFooter.displayName = "DialogFooter";
|
|
1129
|
+
var DialogTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1130
|
+
DialogPrimitive.Title,
|
|
1131
|
+
{
|
|
1132
|
+
ref,
|
|
1133
|
+
className: cn("sv-dialog__title", className),
|
|
1134
|
+
...props
|
|
1135
|
+
}
|
|
1136
|
+
));
|
|
1137
|
+
DialogTitle.displayName = "DialogTitle";
|
|
1138
|
+
var DialogDescription = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1139
|
+
DialogPrimitive.Description,
|
|
1140
|
+
{
|
|
1141
|
+
ref,
|
|
1142
|
+
className: cn("sv-dialog__description", className),
|
|
1143
|
+
...props
|
|
1144
|
+
}
|
|
1145
|
+
));
|
|
1146
|
+
DialogDescription.displayName = "DialogDescription";
|
|
1147
|
+
|
|
1148
|
+
// src/components/ui/bottom-sheet.tsx
|
|
1149
|
+
var React5 = __toESM(require("react"), 1);
|
|
1150
|
+
var DialogPrimitive2 = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1151
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1152
|
+
var DISMISS_DISTANCE = 96;
|
|
1153
|
+
var BottomSheetContext = React5.createContext(null);
|
|
1154
|
+
var BottomSheet = ({ open: openProp, defaultOpen = false, onOpenChange, ...props }) => {
|
|
1155
|
+
const [openState, setOpenState] = React5.useState(defaultOpen);
|
|
1156
|
+
const controlled = openProp !== void 0;
|
|
1157
|
+
const open = controlled ? openProp : openState;
|
|
1158
|
+
const setOpen = React5.useCallback(
|
|
1159
|
+
(next) => {
|
|
1160
|
+
if (!controlled) setOpenState(next);
|
|
1161
|
+
onOpenChange?.(next);
|
|
1162
|
+
},
|
|
1163
|
+
[controlled, onOpenChange]
|
|
1164
|
+
);
|
|
1165
|
+
const value = React5.useMemo(() => ({ close: () => setOpen(false) }), [setOpen]);
|
|
1166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BottomSheetContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogPrimitive2.Root, { open, onOpenChange: setOpen, ...props }) });
|
|
1167
|
+
};
|
|
1168
|
+
var BottomSheetTrigger = DialogPrimitive2.Trigger;
|
|
1169
|
+
var BottomSheetClose = DialogPrimitive2.Close;
|
|
1170
|
+
var BottomSheetOverlay = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogPrimitive2.Overlay, { ref, className: cn("sv-overlay", className), ...props }));
|
|
1171
|
+
BottomSheetOverlay.displayName = "BottomSheetOverlay";
|
|
1172
|
+
var BottomSheetContent = React5.forwardRef(
|
|
1173
|
+
({
|
|
1174
|
+
className,
|
|
1175
|
+
children,
|
|
1176
|
+
style,
|
|
1177
|
+
showCloseButton = true,
|
|
1178
|
+
closeLabel: closeLabelProp,
|
|
1179
|
+
draggable = true,
|
|
1180
|
+
onCloseAutoFocus,
|
|
1181
|
+
...props
|
|
1182
|
+
}, ref) => {
|
|
1183
|
+
const restoreFocus = useRestoreFocus(onCloseAutoFocus);
|
|
1184
|
+
const { close } = React5.useContext(BottomSheetContext);
|
|
1185
|
+
const closeLabel = closeLabelProp && closeLabelProp.trim().length > 0 ? closeLabelProp : "Cancel";
|
|
1186
|
+
const [offset, setOffset] = React5.useState(0);
|
|
1187
|
+
const [dragging, setDragging] = React5.useState(false);
|
|
1188
|
+
const startY = React5.useRef(0);
|
|
1189
|
+
const onPointerDown = (event) => {
|
|
1190
|
+
if (!draggable) return;
|
|
1191
|
+
startY.current = event.clientY;
|
|
1192
|
+
setDragging(true);
|
|
1193
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
1194
|
+
};
|
|
1195
|
+
const onPointerMove = (event) => {
|
|
1196
|
+
if (!dragging) return;
|
|
1197
|
+
setOffset(Math.max(0, event.clientY - startY.current));
|
|
1198
|
+
};
|
|
1199
|
+
const endDrag = () => {
|
|
1200
|
+
if (!dragging) return;
|
|
1201
|
+
setDragging(false);
|
|
1202
|
+
if (offset >= DISMISS_DISTANCE) close();
|
|
1203
|
+
else setOffset(0);
|
|
1204
|
+
};
|
|
1205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogPrimitive2.Portal, { children: [
|
|
1206
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BottomSheetOverlay, {}),
|
|
1207
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1208
|
+
DialogPrimitive2.Content,
|
|
1209
|
+
{
|
|
1210
|
+
ref,
|
|
1211
|
+
className: cn("sv-sheet", className),
|
|
1212
|
+
"data-dragging": dragging ? "true" : void 0,
|
|
1213
|
+
style: { ...style, ["--sv-sheet-drag"]: `${offset}px` },
|
|
1214
|
+
...props,
|
|
1215
|
+
onCloseAutoFocus: restoreFocus,
|
|
1216
|
+
"aria-modal": "true",
|
|
1217
|
+
children: [
|
|
1218
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1219
|
+
"div",
|
|
1220
|
+
{
|
|
1221
|
+
className: "sv-sheet__handle",
|
|
1222
|
+
"data-draggable": draggable ? "true" : void 0,
|
|
1223
|
+
"aria-hidden": "true",
|
|
1224
|
+
onPointerDown,
|
|
1225
|
+
onPointerMove,
|
|
1226
|
+
onPointerUp: endDrag,
|
|
1227
|
+
onPointerCancel: endDrag
|
|
1228
|
+
}
|
|
1229
|
+
),
|
|
1230
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogPrimitive2.Close, { className: "sv-btn sv-btn--ghost sv-btn--sm sv-sheet__close", children: closeLabel }) : null,
|
|
1231
|
+
children
|
|
1232
|
+
]
|
|
1233
|
+
}
|
|
1234
|
+
)
|
|
1235
|
+
] });
|
|
1236
|
+
}
|
|
1237
|
+
);
|
|
1238
|
+
BottomSheetContent.displayName = "BottomSheetContent";
|
|
1239
|
+
var BottomSheetHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: cn("sv-sheet__header", className), ...props });
|
|
1240
|
+
BottomSheetHeader.displayName = "BottomSheetHeader";
|
|
1241
|
+
var BottomSheetBody = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: cn("sv-sheet__body", className), ...props });
|
|
1242
|
+
BottomSheetBody.displayName = "BottomSheetBody";
|
|
1243
|
+
var BottomSheetFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: cn("sv-sheet__footer", className), ...props });
|
|
1244
|
+
BottomSheetFooter.displayName = "BottomSheetFooter";
|
|
1245
|
+
var BottomSheetTitle = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogPrimitive2.Title, { ref, className: cn("sv-sheet__title", className), ...props }));
|
|
1246
|
+
BottomSheetTitle.displayName = "BottomSheetTitle";
|
|
1247
|
+
var BottomSheetDescription = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogPrimitive2.Description, { ref, className: cn("sv-sheet__description", className), ...props }));
|
|
1248
|
+
BottomSheetDescription.displayName = "BottomSheetDescription";
|
|
1249
|
+
|
|
1250
|
+
// src/components/ui/alert-dialog.tsx
|
|
1251
|
+
var React6 = __toESM(require("react"), 1);
|
|
1252
|
+
var AlertDialogPrimitive = __toESM(require("@radix-ui/react-alert-dialog"), 1);
|
|
1253
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1254
|
+
var AlertDialog = AlertDialogPrimitive.Root;
|
|
1255
|
+
var AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
1256
|
+
var AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
1257
|
+
var AlertDialogOverlay = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1258
|
+
AlertDialogPrimitive.Overlay,
|
|
1259
|
+
{
|
|
1260
|
+
ref,
|
|
1261
|
+
className: cn("sv-overlay", className),
|
|
1262
|
+
...props
|
|
1263
|
+
}
|
|
1264
|
+
));
|
|
1265
|
+
AlertDialogOverlay.displayName = "AlertDialogOverlay";
|
|
1266
|
+
var AlertDialogContent = React6.forwardRef(({ className, onCloseAutoFocus, ...props }, ref) => {
|
|
1267
|
+
const restoreFocus = useRestoreFocus(onCloseAutoFocus);
|
|
1268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(AlertDialogPortal, { children: [
|
|
1269
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AlertDialogOverlay, {}),
|
|
1270
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1271
|
+
AlertDialogPrimitive.Content,
|
|
1272
|
+
{
|
|
1273
|
+
ref,
|
|
1274
|
+
"aria-modal": "true",
|
|
1275
|
+
className: cn("sv-dialog", className),
|
|
1276
|
+
...props,
|
|
1277
|
+
onCloseAutoFocus: restoreFocus
|
|
1278
|
+
}
|
|
1279
|
+
)
|
|
1280
|
+
] });
|
|
1281
|
+
});
|
|
1282
|
+
AlertDialogContent.displayName = "AlertDialogContent";
|
|
1283
|
+
var AlertDialogHeader = ({
|
|
1284
|
+
className,
|
|
1285
|
+
...props
|
|
1286
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: cn("sv-dialog__header", className), ...props });
|
|
1287
|
+
AlertDialogHeader.displayName = "AlertDialogHeader";
|
|
1288
|
+
var AlertDialogFooter = ({
|
|
1289
|
+
className,
|
|
1290
|
+
...props
|
|
1291
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: cn("sv-dialog__footer", className), ...props });
|
|
1292
|
+
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
1293
|
+
var AlertDialogTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1294
|
+
AlertDialogPrimitive.Title,
|
|
1295
|
+
{
|
|
1296
|
+
ref,
|
|
1297
|
+
className: cn("sv-dialog__title", className),
|
|
1298
|
+
...props
|
|
1299
|
+
}
|
|
1300
|
+
));
|
|
1301
|
+
AlertDialogTitle.displayName = "AlertDialogTitle";
|
|
1302
|
+
var AlertDialogDescription = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1303
|
+
AlertDialogPrimitive.Description,
|
|
1304
|
+
{
|
|
1305
|
+
ref,
|
|
1306
|
+
className: cn("sv-dialog__description", className),
|
|
1307
|
+
...props
|
|
1308
|
+
}
|
|
1309
|
+
));
|
|
1310
|
+
AlertDialogDescription.displayName = "AlertDialogDescription";
|
|
1311
|
+
var AlertDialogAction = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1312
|
+
AlertDialogPrimitive.Action,
|
|
1313
|
+
{
|
|
1314
|
+
ref,
|
|
1315
|
+
className: cn(className),
|
|
1316
|
+
...props
|
|
1317
|
+
}
|
|
1318
|
+
));
|
|
1319
|
+
AlertDialogAction.displayName = "AlertDialogAction";
|
|
1320
|
+
var AlertDialogCancel = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1321
|
+
AlertDialogPrimitive.Cancel,
|
|
1322
|
+
{
|
|
1323
|
+
ref,
|
|
1324
|
+
className: cn(className),
|
|
1325
|
+
...props
|
|
1326
|
+
}
|
|
1327
|
+
));
|
|
1328
|
+
AlertDialogCancel.displayName = "AlertDialogCancel";
|
|
1329
|
+
|
|
1330
|
+
// src/components/ui/select.tsx
|
|
1331
|
+
var React7 = __toESM(require("react"), 1);
|
|
1332
|
+
var SelectPrimitive = __toESM(require("@radix-ui/react-select"), 1);
|
|
1333
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1334
|
+
var Select = SelectPrimitive.Root;
|
|
1335
|
+
var SelectGroup = SelectPrimitive.Group;
|
|
1336
|
+
var SelectValue = SelectPrimitive.Value;
|
|
1337
|
+
var SelectTrigger = React7.forwardRef(
|
|
1338
|
+
({ className, children, icon = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { name: "chevron-down" }), ...props }, ref) => (
|
|
1339
|
+
// The trigger IS a form field, so it shares .sv-field with Input, Textarea
|
|
1340
|
+
// and NativeSelect rather than restating the frame. The utility string this
|
|
1341
|
+
// replaces named `ring-offset-background` and `focus:ring-accent`, neither
|
|
1342
|
+
// of which this package ever declared: the field had no visible focus.
|
|
1343
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1344
|
+
SelectPrimitive.Trigger,
|
|
1345
|
+
{
|
|
1346
|
+
ref,
|
|
1347
|
+
className: cn("sv-field", "sv-field--trigger", className),
|
|
1348
|
+
...props,
|
|
1349
|
+
children: [
|
|
1350
|
+
children,
|
|
1351
|
+
icon === null ? null : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SelectPrimitive.Icon, { children: icon })
|
|
1352
|
+
]
|
|
1353
|
+
}
|
|
1354
|
+
)
|
|
1355
|
+
)
|
|
1356
|
+
);
|
|
1357
|
+
SelectTrigger.displayName = "SelectTrigger";
|
|
1358
|
+
var SelectScrollUpButton = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1359
|
+
SelectPrimitive.ScrollUpButton,
|
|
1360
|
+
{
|
|
1361
|
+
ref,
|
|
1362
|
+
className: cn("sv-pop__scroll", className),
|
|
1363
|
+
...props,
|
|
1364
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { name: "chevron-up" })
|
|
1365
|
+
}
|
|
1366
|
+
));
|
|
1367
|
+
SelectScrollUpButton.displayName = "SelectScrollUpButton";
|
|
1368
|
+
var SelectScrollDownButton = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1369
|
+
SelectPrimitive.ScrollDownButton,
|
|
1370
|
+
{
|
|
1371
|
+
ref,
|
|
1372
|
+
className: cn("sv-pop__scroll", className),
|
|
1373
|
+
...props,
|
|
1374
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { name: "chevron-down" })
|
|
1375
|
+
}
|
|
1376
|
+
));
|
|
1377
|
+
SelectScrollDownButton.displayName = "SelectScrollDownButton";
|
|
1378
|
+
var SelectContent = React7.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SelectPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1379
|
+
SelectPrimitive.Content,
|
|
1380
|
+
{
|
|
1381
|
+
ref,
|
|
1382
|
+
className: cn("sv-pop", position === "popper" && "sv-pop--popper", className),
|
|
1383
|
+
position,
|
|
1384
|
+
...props,
|
|
1385
|
+
children: [
|
|
1386
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SelectScrollUpButton, {}),
|
|
1387
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1388
|
+
SelectPrimitive.Viewport,
|
|
1389
|
+
{
|
|
1390
|
+
className: cn(
|
|
1391
|
+
"sv-pop__viewport",
|
|
1392
|
+
position === "popper" && "sv-pop__viewport--popper"
|
|
1393
|
+
),
|
|
1394
|
+
children
|
|
1395
|
+
}
|
|
1396
|
+
),
|
|
1397
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SelectScrollDownButton, {})
|
|
1398
|
+
]
|
|
1399
|
+
}
|
|
1400
|
+
) }));
|
|
1401
|
+
SelectContent.displayName = "SelectContent";
|
|
1402
|
+
var SelectItem = React7.forwardRef(({ className, children, icon = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { name: "check" }), ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1403
|
+
SelectPrimitive.Item,
|
|
1404
|
+
{
|
|
1405
|
+
ref,
|
|
1406
|
+
className: cn("sv-menu-item", className),
|
|
1407
|
+
...props,
|
|
1408
|
+
children: [
|
|
1409
|
+
icon === null ? null : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SelectPrimitive.ItemIndicator, { className: "sv-menu-item__indicator", children: icon }),
|
|
1410
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SelectPrimitive.ItemText, { children })
|
|
1411
|
+
]
|
|
1412
|
+
}
|
|
1413
|
+
));
|
|
1414
|
+
SelectItem.displayName = "SelectItem";
|
|
1415
|
+
var SelectLabel = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1416
|
+
SelectPrimitive.Label,
|
|
1417
|
+
{
|
|
1418
|
+
ref,
|
|
1419
|
+
className: cn("sv-menu-label", className),
|
|
1420
|
+
...props
|
|
1421
|
+
}
|
|
1422
|
+
));
|
|
1423
|
+
SelectLabel.displayName = "SelectLabel";
|
|
1424
|
+
var SelectSeparator = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1425
|
+
SelectPrimitive.Separator,
|
|
1426
|
+
{
|
|
1427
|
+
ref,
|
|
1428
|
+
className: cn("sv-menu-separator", className),
|
|
1429
|
+
...props
|
|
1430
|
+
}
|
|
1431
|
+
));
|
|
1432
|
+
SelectSeparator.displayName = "SelectSeparator";
|
|
1433
|
+
|
|
1434
|
+
// src/components/ui/dropdown-menu.tsx
|
|
1435
|
+
var React8 = __toESM(require("react"), 1);
|
|
1436
|
+
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
|
|
1437
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1438
|
+
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
1439
|
+
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
1440
|
+
var DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
1441
|
+
var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
1442
|
+
var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
1443
|
+
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
1444
|
+
var DropdownMenuSubTrigger = React8.forwardRef(
|
|
1445
|
+
({ className, inset, children, icon = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { name: "chevron-right" }), ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1446
|
+
DropdownMenuPrimitive.SubTrigger,
|
|
1447
|
+
{
|
|
1448
|
+
ref,
|
|
1449
|
+
className: cn("sv-menu-item", inset && "sv-menu-item--inset", className),
|
|
1450
|
+
...props,
|
|
1451
|
+
children: [
|
|
1452
|
+
children,
|
|
1453
|
+
icon
|
|
1454
|
+
]
|
|
1455
|
+
}
|
|
1456
|
+
)
|
|
1457
|
+
);
|
|
1458
|
+
DropdownMenuSubTrigger.displayName = "DropdownMenuSubTrigger";
|
|
1459
|
+
var DropdownMenuSubContent = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1460
|
+
DropdownMenuPrimitive.SubContent,
|
|
1461
|
+
{
|
|
1462
|
+
ref,
|
|
1463
|
+
className: cn("sv-pop", className),
|
|
1464
|
+
...props
|
|
1465
|
+
}
|
|
1466
|
+
));
|
|
1467
|
+
DropdownMenuSubContent.displayName = "DropdownMenuSubContent";
|
|
1468
|
+
var DropdownMenuContent = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1469
|
+
DropdownMenuPrimitive.Content,
|
|
1470
|
+
{
|
|
1471
|
+
ref,
|
|
1472
|
+
className: cn("sv-pop", className),
|
|
1473
|
+
...props
|
|
1474
|
+
}
|
|
1475
|
+
) }));
|
|
1476
|
+
DropdownMenuContent.displayName = "DropdownMenuContent";
|
|
1477
|
+
var DropdownMenuItem = React8.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1478
|
+
DropdownMenuPrimitive.Item,
|
|
1479
|
+
{
|
|
1480
|
+
ref,
|
|
1481
|
+
className: cn("sv-menu-item", inset && "sv-menu-item--inset", className),
|
|
1482
|
+
...props
|
|
1483
|
+
}
|
|
1484
|
+
));
|
|
1485
|
+
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
1486
|
+
var DropdownMenuCheckboxItem = React8.forwardRef(({ className, children, icon = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { name: "check" }), ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1487
|
+
DropdownMenuPrimitive.CheckboxItem,
|
|
1488
|
+
{
|
|
1489
|
+
ref,
|
|
1490
|
+
className: cn("sv-menu-item", className),
|
|
1491
|
+
...props,
|
|
1492
|
+
children: [
|
|
1493
|
+
icon === null ? null : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownMenuPrimitive.ItemIndicator, { className: "sv-menu-item__indicator", children: icon }),
|
|
1494
|
+
children
|
|
1495
|
+
]
|
|
1496
|
+
}
|
|
1497
|
+
));
|
|
1498
|
+
DropdownMenuCheckboxItem.displayName = "DropdownMenuCheckboxItem";
|
|
1499
|
+
var DropdownMenuRadioItem = React8.forwardRef(
|
|
1500
|
+
({ className, children, icon = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "sv-menu-item__dot" }), ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1501
|
+
DropdownMenuPrimitive.RadioItem,
|
|
1502
|
+
{
|
|
1503
|
+
ref,
|
|
1504
|
+
className: cn("sv-menu-item", className),
|
|
1505
|
+
...props,
|
|
1506
|
+
children: [
|
|
1507
|
+
icon === null ? null : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownMenuPrimitive.ItemIndicator, { className: "sv-menu-item__indicator", children: icon }),
|
|
1508
|
+
children
|
|
1509
|
+
]
|
|
1510
|
+
}
|
|
1511
|
+
)
|
|
1512
|
+
);
|
|
1513
|
+
DropdownMenuRadioItem.displayName = "DropdownMenuRadioItem";
|
|
1514
|
+
var DropdownMenuLabel = React8.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1515
|
+
DropdownMenuPrimitive.Label,
|
|
1516
|
+
{
|
|
1517
|
+
ref,
|
|
1518
|
+
className: cn("sv-menu-label", inset && "sv-menu-item--inset", className),
|
|
1519
|
+
...props
|
|
1520
|
+
}
|
|
1521
|
+
));
|
|
1522
|
+
DropdownMenuLabel.displayName = "DropdownMenuLabel";
|
|
1523
|
+
var DropdownMenuSeparator = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1524
|
+
DropdownMenuPrimitive.Separator,
|
|
1525
|
+
{
|
|
1526
|
+
ref,
|
|
1527
|
+
className: cn("sv-menu-separator", className),
|
|
1528
|
+
...props
|
|
1529
|
+
}
|
|
1530
|
+
));
|
|
1531
|
+
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
|
|
1532
|
+
var DropdownMenuShortcut = ({
|
|
1533
|
+
className,
|
|
1534
|
+
...props
|
|
1535
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: cn("sv-menu-shortcut", className), ...props });
|
|
1536
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
1537
|
+
|
|
1538
|
+
// src/components/ui/tabs.tsx
|
|
1539
|
+
var React9 = __toESM(require("react"), 1);
|
|
1540
|
+
var TabsPrimitive = __toESM(require("@radix-ui/react-tabs"), 1);
|
|
1541
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1542
|
+
var Tabs = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1543
|
+
TabsPrimitive.Root,
|
|
1544
|
+
{
|
|
1545
|
+
ref,
|
|
1546
|
+
className: cn("sv-tabs", className),
|
|
1547
|
+
...props
|
|
1548
|
+
}
|
|
1549
|
+
));
|
|
1550
|
+
Tabs.displayName = "Tabs";
|
|
1551
|
+
var TabsList = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1552
|
+
TabsPrimitive.List,
|
|
1553
|
+
{
|
|
1554
|
+
ref,
|
|
1555
|
+
className: cn("sv-tabs__list", className),
|
|
1556
|
+
...props
|
|
1557
|
+
}
|
|
1558
|
+
));
|
|
1559
|
+
TabsList.displayName = "TabsList";
|
|
1560
|
+
var TabsTrigger = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1561
|
+
TabsPrimitive.Trigger,
|
|
1562
|
+
{
|
|
1563
|
+
ref,
|
|
1564
|
+
className: cn("sv-tabs__trigger", className),
|
|
1565
|
+
...props
|
|
1566
|
+
}
|
|
1567
|
+
));
|
|
1568
|
+
TabsTrigger.displayName = "TabsTrigger";
|
|
1569
|
+
var TabsContent = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1570
|
+
TabsPrimitive.Content,
|
|
1571
|
+
{
|
|
1572
|
+
ref,
|
|
1573
|
+
className: cn("sv-tabs__content", className),
|
|
1574
|
+
...props
|
|
1575
|
+
}
|
|
1576
|
+
));
|
|
1577
|
+
TabsContent.displayName = "TabsContent";
|
|
1578
|
+
|
|
1579
|
+
// src/components/ui/tooltip.tsx
|
|
1580
|
+
var React10 = __toESM(require("react"), 1);
|
|
1581
|
+
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
1582
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1583
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
1584
|
+
var Tooltip = TooltipPrimitive.Root;
|
|
1585
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
1586
|
+
var TooltipContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1587
|
+
TooltipPrimitive.Content,
|
|
1588
|
+
{
|
|
1589
|
+
ref,
|
|
1590
|
+
sideOffset,
|
|
1591
|
+
className: cn("sv-pop", "sv-tooltip", className),
|
|
1592
|
+
...props
|
|
1593
|
+
}
|
|
1594
|
+
));
|
|
1595
|
+
TooltipContent.displayName = "TooltipContent";
|
|
1596
|
+
|
|
1597
|
+
// src/components/ui/combobox.tsx
|
|
1598
|
+
var React11 = __toESM(require("react"), 1);
|
|
1599
|
+
|
|
1600
|
+
// src/recipes/field.ts
|
|
1601
|
+
function field(options = {}) {
|
|
1602
|
+
return cx(
|
|
1603
|
+
"sv-field",
|
|
1604
|
+
options.variant && options.variant !== "input" && `sv-field--${options.variant}`
|
|
1605
|
+
);
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
// src/components/ui/combobox.tsx
|
|
1609
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1610
|
+
var defaultComboboxLabels = {
|
|
1611
|
+
loading: "Searching\u2026",
|
|
1612
|
+
empty: "No results",
|
|
1613
|
+
minLength: (min) => `Type at least ${min} character${min === 1 ? "" : "s"}`,
|
|
1614
|
+
error: "Search failed",
|
|
1615
|
+
results: (count) => `${count} result${count === 1 ? "" : "s"}`
|
|
1616
|
+
};
|
|
1617
|
+
var Combobox = React11.forwardRef(
|
|
1618
|
+
({
|
|
1619
|
+
onSearch,
|
|
1620
|
+
onSelect,
|
|
1621
|
+
value,
|
|
1622
|
+
defaultValue = null,
|
|
1623
|
+
minLength = 1,
|
|
1624
|
+
debounceMs = 250,
|
|
1625
|
+
labels: labelsProp,
|
|
1626
|
+
wrapperClassName,
|
|
1627
|
+
className,
|
|
1628
|
+
id: idProp,
|
|
1629
|
+
name,
|
|
1630
|
+
onKeyDown,
|
|
1631
|
+
onBlur,
|
|
1632
|
+
onFocus,
|
|
1633
|
+
disabled,
|
|
1634
|
+
...props
|
|
1635
|
+
}, ref) => {
|
|
1636
|
+
const labels = { ...defaultComboboxLabels, ...labelsProp };
|
|
1637
|
+
const autoId = React11.useId();
|
|
1638
|
+
const id = idProp ?? `sv-combobox-${autoId}`;
|
|
1639
|
+
const listId = `${id}-listbox`;
|
|
1640
|
+
const isControlled = value !== void 0;
|
|
1641
|
+
const [innerSelected, setInnerSelected] = React11.useState(defaultValue);
|
|
1642
|
+
const selected = isControlled ? value : innerSelected;
|
|
1643
|
+
const [term, setTerm] = React11.useState(selected?.label ?? "");
|
|
1644
|
+
const [open, setOpen] = React11.useState(false);
|
|
1645
|
+
const [status, setStatus] = React11.useState("idle");
|
|
1646
|
+
const [options, setOptions] = React11.useState([]);
|
|
1647
|
+
const [active, setActive] = React11.useState(-1);
|
|
1648
|
+
const timer = React11.useRef(void 0);
|
|
1649
|
+
const controller = React11.useRef(null);
|
|
1650
|
+
const [lastSelected, setLastSelected] = React11.useState(selected);
|
|
1651
|
+
if (selected !== lastSelected) {
|
|
1652
|
+
setLastSelected(selected);
|
|
1653
|
+
setTerm(selected?.label ?? "");
|
|
1654
|
+
}
|
|
1655
|
+
const cancel = React11.useCallback(() => {
|
|
1656
|
+
clearTimeout(timer.current);
|
|
1657
|
+
controller.current?.abort();
|
|
1658
|
+
controller.current = null;
|
|
1659
|
+
}, []);
|
|
1660
|
+
React11.useEffect(() => cancel, [cancel]);
|
|
1661
|
+
const search = (next) => {
|
|
1662
|
+
cancel();
|
|
1663
|
+
setActive(-1);
|
|
1664
|
+
if (next.trim().length < minLength) {
|
|
1665
|
+
setOptions([]);
|
|
1666
|
+
setStatus("hint");
|
|
1667
|
+
return;
|
|
1668
|
+
}
|
|
1669
|
+
setStatus("loading");
|
|
1670
|
+
timer.current = setTimeout(async () => {
|
|
1671
|
+
const current = new AbortController();
|
|
1672
|
+
controller.current = current;
|
|
1673
|
+
try {
|
|
1674
|
+
const result = await onSearch(next.trim(), { signal: current.signal });
|
|
1675
|
+
if (current.signal.aborted) return;
|
|
1676
|
+
setOptions(result);
|
|
1677
|
+
setStatus(result.length > 0 ? "ready" : "empty");
|
|
1678
|
+
} catch {
|
|
1679
|
+
if (current.signal.aborted) return;
|
|
1680
|
+
setOptions([]);
|
|
1681
|
+
setStatus("error");
|
|
1682
|
+
}
|
|
1683
|
+
}, debounceMs);
|
|
1684
|
+
};
|
|
1685
|
+
const select = (option) => {
|
|
1686
|
+
if (!isControlled) setInnerSelected(option);
|
|
1687
|
+
setLastSelected(option);
|
|
1688
|
+
onSelect?.(option);
|
|
1689
|
+
};
|
|
1690
|
+
const pick = (option) => {
|
|
1691
|
+
if (option.disabled) return;
|
|
1692
|
+
cancel();
|
|
1693
|
+
select(option);
|
|
1694
|
+
setTerm(option.label);
|
|
1695
|
+
setOpen(false);
|
|
1696
|
+
setActive(-1);
|
|
1697
|
+
};
|
|
1698
|
+
const move = (step) => {
|
|
1699
|
+
const enabled = options.map((o, i) => o.disabled ? -1 : i).filter((i) => i >= 0);
|
|
1700
|
+
if (enabled.length === 0) return;
|
|
1701
|
+
const at = enabled.indexOf(active);
|
|
1702
|
+
const next = at === -1 ? step === 1 ? 0 : enabled.length - 1 : (at + step + enabled.length) % enabled.length;
|
|
1703
|
+
setActive(enabled[next]);
|
|
1704
|
+
};
|
|
1705
|
+
const handleKeyDown = (event) => {
|
|
1706
|
+
onKeyDown?.(event);
|
|
1707
|
+
if (event.defaultPrevented) return;
|
|
1708
|
+
switch (event.key) {
|
|
1709
|
+
case "ArrowDown":
|
|
1710
|
+
case "ArrowUp":
|
|
1711
|
+
event.preventDefault();
|
|
1712
|
+
if (!open) {
|
|
1713
|
+
setOpen(true);
|
|
1714
|
+
if (status === "idle") search(term);
|
|
1715
|
+
return;
|
|
1716
|
+
}
|
|
1717
|
+
move(event.key === "ArrowDown" ? 1 : -1);
|
|
1718
|
+
return;
|
|
1719
|
+
case "Enter": {
|
|
1720
|
+
const option = open ? options[active] : void 0;
|
|
1721
|
+
if (option) {
|
|
1722
|
+
event.preventDefault();
|
|
1723
|
+
pick(option);
|
|
1724
|
+
}
|
|
1725
|
+
return;
|
|
1726
|
+
}
|
|
1727
|
+
case "Escape":
|
|
1728
|
+
if (open) {
|
|
1729
|
+
event.preventDefault();
|
|
1730
|
+
cancel();
|
|
1731
|
+
setOpen(false);
|
|
1732
|
+
setActive(-1);
|
|
1733
|
+
} else if (term !== "") {
|
|
1734
|
+
event.preventDefault();
|
|
1735
|
+
setTerm("");
|
|
1736
|
+
if (selected) select(null);
|
|
1737
|
+
setStatus("idle");
|
|
1738
|
+
setOptions([]);
|
|
1739
|
+
}
|
|
1740
|
+
return;
|
|
1741
|
+
}
|
|
1742
|
+
};
|
|
1743
|
+
const showList = open && !disabled;
|
|
1744
|
+
const activeId = showList && active >= 0 ? `${id}-option-${active}` : void 0;
|
|
1745
|
+
const statusText = status === "hint" ? labels.minLength(minLength) : status === "loading" ? labels.loading : status === "empty" ? labels.empty : status === "error" ? labels.error : status === "ready" ? labels.results(options.length) : "";
|
|
1746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: cn("sv-combobox", wrapperClassName), children: [
|
|
1747
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1748
|
+
"input",
|
|
1749
|
+
{
|
|
1750
|
+
ref,
|
|
1751
|
+
id,
|
|
1752
|
+
type: "text",
|
|
1753
|
+
role: "combobox",
|
|
1754
|
+
"aria-autocomplete": "list",
|
|
1755
|
+
"aria-expanded": showList,
|
|
1756
|
+
"aria-controls": listId,
|
|
1757
|
+
"aria-activedescendant": activeId,
|
|
1758
|
+
autoComplete: "off",
|
|
1759
|
+
disabled,
|
|
1760
|
+
className: cn(field(), className),
|
|
1761
|
+
value: term,
|
|
1762
|
+
onChange: (event) => {
|
|
1763
|
+
const next = event.target.value;
|
|
1764
|
+
setTerm(next);
|
|
1765
|
+
setOpen(true);
|
|
1766
|
+
if (selected) select(null);
|
|
1767
|
+
search(next);
|
|
1768
|
+
},
|
|
1769
|
+
onKeyDown: handleKeyDown,
|
|
1770
|
+
onFocus,
|
|
1771
|
+
onBlur: (event) => {
|
|
1772
|
+
onBlur?.(event);
|
|
1773
|
+
cancel();
|
|
1774
|
+
setOpen(false);
|
|
1775
|
+
setActive(-1);
|
|
1776
|
+
},
|
|
1777
|
+
...props
|
|
1778
|
+
}
|
|
1779
|
+
),
|
|
1780
|
+
name !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "hidden", name, value: selected?.value ?? "" }) : null,
|
|
1781
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1782
|
+
"ul",
|
|
1783
|
+
{
|
|
1784
|
+
id: listId,
|
|
1785
|
+
role: "listbox",
|
|
1786
|
+
"aria-labelledby": props["aria-labelledby"],
|
|
1787
|
+
"aria-label": props["aria-labelledby"] ? void 0 : props["aria-label"],
|
|
1788
|
+
className: "sv-combobox__list sv-pop",
|
|
1789
|
+
hidden: !showList || options.length === 0,
|
|
1790
|
+
children: options.map((option, index) => (
|
|
1791
|
+
// Keyboard interaction lives on the input (aria-activedescendant),
|
|
1792
|
+
// per the APG combobox pattern; options never take focus.
|
|
1793
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
1794
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1795
|
+
"li",
|
|
1796
|
+
{
|
|
1797
|
+
id: `${id}-option-${index}`,
|
|
1798
|
+
role: "option",
|
|
1799
|
+
"aria-selected": index === active,
|
|
1800
|
+
"aria-disabled": option.disabled || void 0,
|
|
1801
|
+
"data-highlighted": index === active ? "" : void 0,
|
|
1802
|
+
"data-disabled": option.disabled ? "" : void 0,
|
|
1803
|
+
className: "sv-menu-item sv-combobox__option",
|
|
1804
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1805
|
+
onClick: () => pick(option),
|
|
1806
|
+
children: [
|
|
1807
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "sv-combobox__label", children: option.label }),
|
|
1808
|
+
option.description ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "sv-combobox__description", children: option.description }) : null
|
|
1809
|
+
]
|
|
1810
|
+
},
|
|
1811
|
+
option.value
|
|
1812
|
+
)
|
|
1813
|
+
))
|
|
1814
|
+
}
|
|
1815
|
+
),
|
|
1816
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1817
|
+
"div",
|
|
1818
|
+
{
|
|
1819
|
+
role: "status",
|
|
1820
|
+
"aria-live": "polite",
|
|
1821
|
+
className: cn(
|
|
1822
|
+
"sv-combobox__status",
|
|
1823
|
+
(!showList || status === "ready" || statusText === "") && "sv-sr-only"
|
|
1824
|
+
),
|
|
1825
|
+
children: showList ? statusText : ""
|
|
1826
|
+
}
|
|
1827
|
+
)
|
|
1828
|
+
] });
|
|
1829
|
+
}
|
|
1830
|
+
);
|
|
1831
|
+
Combobox.displayName = "Combobox";
|
|
1832
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1833
|
+
0 && (module.exports = {
|
|
1834
|
+
AlertDialog,
|
|
1835
|
+
AlertDialogAction,
|
|
1836
|
+
AlertDialogCancel,
|
|
1837
|
+
AlertDialogContent,
|
|
1838
|
+
AlertDialogDescription,
|
|
1839
|
+
AlertDialogFooter,
|
|
1840
|
+
AlertDialogHeader,
|
|
1841
|
+
AlertDialogOverlay,
|
|
1842
|
+
AlertDialogPortal,
|
|
1843
|
+
AlertDialogTitle,
|
|
1844
|
+
AlertDialogTrigger,
|
|
1845
|
+
BottomSheet,
|
|
1846
|
+
BottomSheetBody,
|
|
1847
|
+
BottomSheetClose,
|
|
1848
|
+
BottomSheetContent,
|
|
1849
|
+
BottomSheetDescription,
|
|
1850
|
+
BottomSheetFooter,
|
|
1851
|
+
BottomSheetHeader,
|
|
1852
|
+
BottomSheetOverlay,
|
|
1853
|
+
BottomSheetTitle,
|
|
1854
|
+
BottomSheetTrigger,
|
|
1855
|
+
Combobox,
|
|
1856
|
+
CopyButton,
|
|
1857
|
+
DEFAULT_STORAGE_KEY,
|
|
1858
|
+
Dialog,
|
|
1859
|
+
DialogClose,
|
|
1860
|
+
DialogContent,
|
|
1861
|
+
DialogDescription,
|
|
1862
|
+
DialogFooter,
|
|
1863
|
+
DialogHeader,
|
|
1864
|
+
DialogOverlay,
|
|
1865
|
+
DialogPortal,
|
|
1866
|
+
DialogTitle,
|
|
1867
|
+
DialogTrigger,
|
|
1868
|
+
DropdownMenu,
|
|
1869
|
+
DropdownMenuCheckboxItem,
|
|
1870
|
+
DropdownMenuContent,
|
|
1871
|
+
DropdownMenuGroup,
|
|
1872
|
+
DropdownMenuItem,
|
|
1873
|
+
DropdownMenuLabel,
|
|
1874
|
+
DropdownMenuPortal,
|
|
1875
|
+
DropdownMenuRadioGroup,
|
|
1876
|
+
DropdownMenuRadioItem,
|
|
1877
|
+
DropdownMenuSeparator,
|
|
1878
|
+
DropdownMenuShortcut,
|
|
1879
|
+
DropdownMenuSub,
|
|
1880
|
+
DropdownMenuSubContent,
|
|
1881
|
+
DropdownMenuSubTrigger,
|
|
1882
|
+
DropdownMenuTrigger,
|
|
1883
|
+
ReadingProgress,
|
|
1884
|
+
Select,
|
|
1885
|
+
SelectContent,
|
|
1886
|
+
SelectGroup,
|
|
1887
|
+
SelectItem,
|
|
1888
|
+
SelectLabel,
|
|
1889
|
+
SelectScrollDownButton,
|
|
1890
|
+
SelectScrollUpButton,
|
|
1891
|
+
SelectSeparator,
|
|
1892
|
+
SelectTrigger,
|
|
1893
|
+
SelectValue,
|
|
1894
|
+
SidebarInset,
|
|
1895
|
+
SidebarPanel,
|
|
1896
|
+
SidebarProvider,
|
|
1897
|
+
SidebarTrigger,
|
|
1898
|
+
TableOfContents,
|
|
1899
|
+
Tabs,
|
|
1900
|
+
TabsContent,
|
|
1901
|
+
TabsList,
|
|
1902
|
+
TabsTrigger,
|
|
1903
|
+
ThemeProvider,
|
|
1904
|
+
ThemeToggle,
|
|
1905
|
+
ToastProvider,
|
|
1906
|
+
Tooltip,
|
|
1907
|
+
TooltipContent,
|
|
1908
|
+
TooltipProvider,
|
|
1909
|
+
TooltipTrigger,
|
|
1910
|
+
copyToClipboard,
|
|
1911
|
+
createMediaQuery,
|
|
1912
|
+
createReadingProgress,
|
|
1913
|
+
createScrollSpy,
|
|
1914
|
+
createThemeManager,
|
|
1915
|
+
defaultComboboxLabels,
|
|
1916
|
+
defaultThemeToggleLabels,
|
|
1917
|
+
useMediaQuery,
|
|
1918
|
+
useReadingProgress,
|
|
1919
|
+
useScrollSpy,
|
|
1920
|
+
useSidebar,
|
|
1921
|
+
useTheme,
|
|
1922
|
+
useToast
|
|
1923
|
+
});
|
|
1924
|
+
//# sourceMappingURL=index.cjs.map
|