gridsmith-ui 0.3.0 → 0.3.1
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/dist/chunk-GYVBRUO2.js +30 -0
- package/dist/chunk-GYVBRUO2.js.map +1 -0
- package/dist/chunk-WVB3SRXW.js +82 -0
- package/dist/chunk-WVB3SRXW.js.map +1 -0
- package/dist/feather-N37QZ7LA.js +72 -0
- package/dist/feather-N37QZ7LA.js.map +1 -0
- package/dist/heroicons-HJTKMLIJ.js +72 -0
- package/dist/heroicons-HJTKMLIJ.js.map +1 -0
- package/dist/icons.js +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +74 -55
- package/dist/index.js.map +1 -1
- package/dist/lucide-6TGT4G26.js +67 -0
- package/dist/lucide-6TGT4G26.js.map +1 -0
- package/dist/phosphor-BWDP4PU7.js +72 -0
- package/dist/phosphor-BWDP4PU7.js.map +1 -0
- package/dist/roots.css +6 -0
- package/dist/tabler-6TPNTLFV.js +72 -0
- package/dist/tabler-6TPNTLFV.js.map +1 -0
- package/package.json +1 -4
- package/dist/chunk-H2XI6OUB.js +0 -396
- package/dist/chunk-H2XI6OUB.js.map +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// ../../showcase/src/lib/icon-packs/utils.ts
|
|
2
|
+
function pascalToKebab(s) {
|
|
3
|
+
return s.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").replace(/([a-zA-Z])(\d)/g, "$1-$2").replace(/(\d)([a-zA-Z])/g, "$1-$2").toLowerCase();
|
|
4
|
+
}
|
|
5
|
+
function isRenderableComponent(value) {
|
|
6
|
+
if (typeof value === "function") return true;
|
|
7
|
+
return typeof value === "object" && value !== null && "$$typeof" in value;
|
|
8
|
+
}
|
|
9
|
+
function buildExtendedMap(mod, aliases, opts) {
|
|
10
|
+
const map = {};
|
|
11
|
+
for (const [exportName, value] of Object.entries(mod)) {
|
|
12
|
+
if (!isRenderableComponent(value)) continue;
|
|
13
|
+
if (!exportName[0] || exportName[0] !== exportName[0].toUpperCase()) continue;
|
|
14
|
+
let name = exportName;
|
|
15
|
+
if (opts?.stripPrefix && name.startsWith(opts.stripPrefix)) {
|
|
16
|
+
name = name.slice(opts.stripPrefix.length);
|
|
17
|
+
}
|
|
18
|
+
if (opts?.stripSuffix && name.endsWith(opts.stripSuffix)) {
|
|
19
|
+
name = name.slice(0, -opts.stripSuffix.length);
|
|
20
|
+
}
|
|
21
|
+
if (!name) continue;
|
|
22
|
+
map[pascalToKebab(name)] = value;
|
|
23
|
+
}
|
|
24
|
+
Object.assign(map, aliases);
|
|
25
|
+
return map;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { buildExtendedMap };
|
|
29
|
+
//# sourceMappingURL=chunk-GYVBRUO2.js.map
|
|
30
|
+
//# sourceMappingURL=chunk-GYVBRUO2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../showcase/src/lib/icon-packs/utils.ts"],"names":[],"mappings":";AAEA,SAAS,cAAc,CAAA,EAAmB;AACxC,EAAA,OAAO,EACJ,OAAA,CAAQ,oBAAA,EAAsB,OAAO,CAAA,CACrC,QAAQ,sBAAA,EAAwB,OAAO,CAAA,CACvC,OAAA,CAAQ,mBAAmB,OAAO,CAAA,CAClC,QAAQ,iBAAA,EAAmB,OAAO,EAClC,WAAA,EAAY;AACjB;AAEA,SAAS,sBAAsB,KAAA,EAAyB;AACtD,EAAA,IAAI,OAAO,KAAA,KAAU,UAAA,EAAY,OAAO,IAAA;AACxC,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,UAAA,IAAc,KAAA;AACtE;AAEO,SAAS,gBAAA,CACd,GAAA,EACA,OAAA,EACA,IAAA,EACS;AACT,EAAA,MAAM,MAAe,EAAC;AAEtB,EAAA,KAAA,MAAW,CAAC,UAAA,EAAY,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,GAAG,CAAA,EAAG;AACrD,IAAA,IAAI,CAAC,qBAAA,CAAsB,KAAK,CAAA,EAAG;AACnC,IAAA,IAAI,CAAC,UAAA,CAAW,CAAC,CAAA,IAAK,UAAA,CAAW,CAAC,CAAA,KAAM,UAAA,CAAW,CAAC,CAAA,CAAE,WAAA,EAAY,EAAG;AAErE,IAAA,IAAI,IAAA,GAAO,UAAA;AACX,IAAA,IAAI,MAAM,WAAA,IAAe,IAAA,CAAK,UAAA,CAAW,IAAA,CAAK,WAAW,CAAA,EAAG;AAC1D,MAAA,IAAA,GAAO,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,WAAA,CAAY,MAAM,CAAA;AAAA,IAC3C;AACA,IAAA,IAAI,MAAM,WAAA,IAAe,IAAA,CAAK,QAAA,CAAS,IAAA,CAAK,WAAW,CAAA,EAAG;AACxD,MAAA,IAAA,GAAO,KAAK,KAAA,CAAM,CAAA,EAAG,CAAC,IAAA,CAAK,YAAY,MAAM,CAAA;AAAA,IAC/C;AACA,IAAA,IAAI,CAAC,IAAA,EAAM;AAEX,IAAA,GAAA,CAAI,aAAA,CAAc,IAAI,CAAC,CAAA,GAAI,KAAA;AAAA,EAC7B;AAEA,EAAA,MAAA,CAAO,MAAA,CAAO,KAAK,OAAO,CAAA;AAC1B,EAAA,OAAO,GAAA;AACT","file":"chunk-GYVBRUO2.js","sourcesContent":["import type { IconMap, IconComponent } from './types'\n\nfunction pascalToKebab(s: string): string {\n return s\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .replace(/([A-Z])([A-Z][a-z])/g, \"$1-$2\")\n .replace(/([a-zA-Z])(\\d)/g, \"$1-$2\")\n .replace(/(\\d)([a-zA-Z])/g, \"$1-$2\")\n .toLowerCase()\n}\n\nfunction isRenderableComponent(value: unknown): boolean {\n if (typeof value === \"function\") return true\n return typeof value === \"object\" && value !== null && \"$$typeof\" in value\n}\n\nexport function buildExtendedMap(\n mod: Record<string, unknown>,\n aliases: IconMap,\n opts?: { stripPrefix?: string; stripSuffix?: string },\n): IconMap {\n const map: IconMap = {}\n\n for (const [exportName, value] of Object.entries(mod)) {\n if (!isRenderableComponent(value)) continue\n if (!exportName[0] || exportName[0] !== exportName[0].toUpperCase()) continue\n\n let name = exportName\n if (opts?.stripPrefix && name.startsWith(opts.stripPrefix)) {\n name = name.slice(opts.stripPrefix.length)\n }\n if (opts?.stripSuffix && name.endsWith(opts.stripSuffix)) {\n name = name.slice(0, -opts.stripSuffix.length)\n }\n if (!name) continue\n\n map[pascalToKebab(name)] = value as IconComponent\n }\n\n Object.assign(map, aliases)\n return map\n}\n"]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createContext, useContext, useState, useEffect } from 'react';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// ../../showcase/src/lib/icons.tsx
|
|
5
|
+
var packCache = /* @__PURE__ */ new Map();
|
|
6
|
+
var fullyLoaded = /* @__PURE__ */ new Set();
|
|
7
|
+
async function loadPack(pack) {
|
|
8
|
+
switch (pack) {
|
|
9
|
+
case "lucide":
|
|
10
|
+
return (await import('./lucide-6TGT4G26.js')).load();
|
|
11
|
+
case "phosphor":
|
|
12
|
+
return (await import('./phosphor-BWDP4PU7.js')).load();
|
|
13
|
+
case "heroicons":
|
|
14
|
+
return (await import('./heroicons-HJTKMLIJ.js')).load();
|
|
15
|
+
case "tabler":
|
|
16
|
+
return (await import('./tabler-6TPNTLFV.js')).load();
|
|
17
|
+
case "feather":
|
|
18
|
+
return (await import('./feather-N37QZ7LA.js')).load();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
var IconCtx = createContext({ pack: "lucide", weight: 1.5 });
|
|
22
|
+
function IconProvider({ pack, weight, children }) {
|
|
23
|
+
return /* @__PURE__ */ jsx(IconCtx.Provider, { value: { pack, weight }, children });
|
|
24
|
+
}
|
|
25
|
+
function useIconMap(pack) {
|
|
26
|
+
const [map, setMap] = useState(packCache.get(pack) ?? null);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (fullyLoaded.has(pack)) {
|
|
29
|
+
const cached = packCache.get(pack);
|
|
30
|
+
if (cached) setMap(cached);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
let cancelled = false;
|
|
34
|
+
loadPack(pack).then((loaded) => {
|
|
35
|
+
packCache.set(pack, loaded);
|
|
36
|
+
fullyLoaded.add(pack);
|
|
37
|
+
if (!cancelled) setMap(loaded);
|
|
38
|
+
});
|
|
39
|
+
return () => {
|
|
40
|
+
cancelled = true;
|
|
41
|
+
};
|
|
42
|
+
}, [pack]);
|
|
43
|
+
return map;
|
|
44
|
+
}
|
|
45
|
+
function getPhosphorWeight(numericWeight) {
|
|
46
|
+
if (numericWeight <= 0.75) return "thin";
|
|
47
|
+
if (numericWeight <= 1.25) return "light";
|
|
48
|
+
if (numericWeight <= 1.75) return "regular";
|
|
49
|
+
if (numericWeight <= 2.25) return "bold";
|
|
50
|
+
return "fill";
|
|
51
|
+
}
|
|
52
|
+
function Icon({ name, size = 16, className }) {
|
|
53
|
+
const { pack, weight } = useContext(IconCtx);
|
|
54
|
+
const map = useIconMap(pack);
|
|
55
|
+
const needsFallback = pack !== "lucide" && map !== null && !map[name];
|
|
56
|
+
const lucideMap = useIconMap(needsFallback ? "lucide" : pack);
|
|
57
|
+
if (!map) return null;
|
|
58
|
+
let Comp = map[name];
|
|
59
|
+
let renderPack = pack;
|
|
60
|
+
if (!Comp) {
|
|
61
|
+
if (!needsFallback || !lucideMap?.[name]) return null;
|
|
62
|
+
Comp = lucideMap[name];
|
|
63
|
+
renderPack = "lucide";
|
|
64
|
+
}
|
|
65
|
+
if (renderPack === "phosphor") {
|
|
66
|
+
return /* @__PURE__ */ jsx(Comp, { size, weight: getPhosphorWeight(weight), className });
|
|
67
|
+
}
|
|
68
|
+
if (renderPack === "heroicons") {
|
|
69
|
+
return /* @__PURE__ */ jsx(Comp, { className, style: { width: size, height: size, strokeWidth: weight } });
|
|
70
|
+
}
|
|
71
|
+
if (renderPack === "tabler") {
|
|
72
|
+
return /* @__PURE__ */ jsx(Comp, { size, stroke: weight, className });
|
|
73
|
+
}
|
|
74
|
+
if (renderPack === "feather") {
|
|
75
|
+
return /* @__PURE__ */ jsx(Comp, { size, className, strokeWidth: weight });
|
|
76
|
+
}
|
|
77
|
+
return /* @__PURE__ */ jsx(Comp, { size, strokeWidth: weight, className });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export { Icon, IconProvider };
|
|
81
|
+
//# sourceMappingURL=chunk-WVB3SRXW.js.map
|
|
82
|
+
//# sourceMappingURL=chunk-WVB3SRXW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../showcase/src/lib/icons.tsx"],"names":[],"mappings":";;;;AAgDA,IAAM,SAAA,uBAAgB,GAAA,EAAuB;AAC7C,IAAM,WAAA,uBAAkB,GAAA,EAAc;AAEtC,eAAe,SAAS,IAAA,EAAkC;AACxD,EAAA,QAAQ,IAAA;AAAM,IACZ,KAAK,QAAA;AAAU,MAAA,OAAA,CAAQ,MAAM,OAAO,sBAAqB,CAAA,EAAG,IAAA,EAAK;AAAA,IACjE,KAAK,UAAA;AAAY,MAAA,OAAA,CAAQ,MAAM,OAAO,wBAAuB,CAAA,EAAG,IAAA,EAAK;AAAA,IACrE,KAAK,WAAA;AAAa,MAAA,OAAA,CAAQ,MAAM,OAAO,yBAAwB,CAAA,EAAG,IAAA,EAAK;AAAA,IACvE,KAAK,QAAA;AAAU,MAAA,OAAA,CAAQ,MAAM,OAAO,sBAAqB,CAAA,EAAG,IAAA,EAAK;AAAA,IACjE,KAAK,SAAA;AAAW,MAAA,OAAA,CAAQ,MAAM,OAAO,uBAAsB,CAAA,EAAG,IAAA,EAAK;AAAA;AAEvE;AAkBA,IAAM,UAAU,aAAA,CAAgC,EAAE,MAAM,QAAA,EAAU,MAAA,EAAQ,KAAK,CAAA;AAExE,SAAS,YAAA,CAAa,E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AI,eAAe,SAAA,EAAW;AAC5B,IAAA,uBAAO,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAY,SAAA,EAAsB,aAAa,MAAA,EAAQ,CAAA;AAAA,EACtE;AAEA,EAAA,uBAAO,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAY,WAAA,EAAa,QAAQ,SAAA,EAAsB,CAAA;AACtE","file":"chunk-WVB3SRXW.js","sourcesContent":["import { createContext, useContext, useState, useEffect, type ReactNode, type ComponentType } from \"react\";\n\n/* ── Types ────────────────────────────────────────────────────── */\n\n/**\n * Runtime list of curated icon names. The CuratedIconName type derives from\n * this array, so adding a name here extends autocomplete automatically.\n * Every name must have an alias (or auto-kebab match) in ALL five packs —\n * icon-completeness.test.tsx enforces this.\n */\nexport const CURATED_ICON_NAMES = [\n \"home\", \"folder\", \"chart\", \"settings\",\n \"chevron-right\", \"close\", \"plus\", \"search\",\n \"bell\", \"user\", \"check\", \"warning\", \"info\", \"error\",\n \"clock\", \"calendar\",\n \"bold\", \"italic\", \"underline\", \"strikethrough\",\n \"align-left\", \"align-center\", \"align-right\",\n \"list\", \"list-ordered\", \"list-checks\",\n \"link\", \"image\", \"table\", \"code\", \"quote\", \"minus\",\n \"superscript\", \"subscript\", \"highlight\", \"type\",\n \"chevron-up\", \"chevron-down\", \"trash\",\n \"undo\", \"redo\",\n \"arrow-left\", \"grip-vertical\",\n \"mic\", \"paperclip\", \"send\",\n \"log-out\", \"edit\", \"menu\",\n \"star\", \"bookmark\", \"download\", \"upload\",\n] as const;\n\ntype CuratedIconName = (typeof CURATED_ICON_NAMES)[number];\n\n/**\n * Curated names provide autocomplete and work identically across all 5 packs.\n * Any kebab-case string is also accepted — it resolves directly against the\n * active pack's native exports (e.g. \"clipboard-copy\" → Lucide's ClipboardCopy).\n */\nexport type IconName = CuratedIconName | (string & {});\n\nexport type IconPack = \"lucide\" | \"phosphor\" | \"heroicons\" | \"tabler\" | \"feather\";\n\ntype IconComponent = ComponentType<Record<string, unknown>>;\ntype IconMap = Record<string, IconComponent>;\n\n/* ── Pack loading ─────────────────────────────────────────────── \n Each pack is isolated in its own file under ./icon-packs/.\n Only the active pack's module is dynamically imported at runtime,\n so bundlers (including Turbopack) won't resolve unused pack\n dependencies at build time. */\n\nconst packCache = new Map<IconPack, IconMap>();\nconst fullyLoaded = new Set<IconPack>();\n\nasync function loadPack(pack: IconPack): Promise<IconMap> {\n switch (pack) {\n case \"lucide\": return (await import(\"./icon-packs/lucide\")).load();\n case \"phosphor\": return (await import(\"./icon-packs/phosphor\")).load();\n case \"heroicons\": return (await import(\"./icon-packs/heroicons\")).load();\n case \"tabler\": return (await import(\"./icon-packs/tabler\")).load();\n case \"feather\": return (await import(\"./icon-packs/feather\")).load();\n }\n}\n\n/** Exported for the icon-completeness test — not part of the public API. */\nexport const packLoaders: Record<IconPack, () => Promise<IconMap>> = {\n lucide: () => loadPack(\"lucide\"),\n phosphor: () => loadPack(\"phosphor\"),\n heroicons: () => loadPack(\"heroicons\"),\n tabler: () => loadPack(\"tabler\"),\n feather: () => loadPack(\"feather\"),\n};\n\n/* ── Context ──────────────────────────────────────────────────── */\n\ninterface IconContextValue {\n pack: IconPack;\n weight: number;\n}\n\nconst IconCtx = createContext<IconContextValue>({ pack: \"lucide\", weight: 1.5 });\n\nexport function IconProvider({ pack, weight, children }: { pack: IconPack; weight: number; children: ReactNode }) {\n return <IconCtx.Provider value={{ pack, weight }}>{children}</IconCtx.Provider>;\n}\n\n/* ── Hook ─────────────────────────────────────────────────────── */\n\nfunction useIconMap(pack: IconPack): IconMap | null {\n const [map, setMap] = useState<IconMap | null>(packCache.get(pack) ?? null);\n\n useEffect(() => {\n if (fullyLoaded.has(pack)) {\n const cached = packCache.get(pack);\n if (cached) setMap(cached);\n return;\n }\n\n let cancelled = false;\n loadPack(pack).then((loaded) => {\n packCache.set(pack, loaded);\n fullyLoaded.add(pack);\n if (!cancelled) setMap(loaded);\n });\n return () => { cancelled = true; };\n }, [pack]);\n\n return map;\n}\n\n/* ── Phosphor weight mapping ──────────────────────────────────── */\n\nfunction getPhosphorWeight(numericWeight: number): \"thin\" | \"light\" | \"regular\" | \"bold\" | \"fill\" | \"duotone\" {\n if (numericWeight <= 0.75) return \"thin\";\n if (numericWeight <= 1.25) return \"light\";\n if (numericWeight <= 1.75) return \"regular\";\n if (numericWeight <= 2.25) return \"bold\";\n return \"fill\";\n}\n\n/* ── Icon component ───────────────────────────────────────────── */\n\nexport function Icon({ name, size = 16, className }: { name: IconName; size?: number; className?: string }) {\n const { pack, weight } = useContext(IconCtx);\n const map = useIconMap(pack);\n\n // Lucide doubles as the universal fallback: when the active pack has loaded\n // but lacks the requested name, resolve against lucide instead of rendering\n // nothing. The hook call is unconditional (no conditional-hook violation) —\n // it only re-targets lucide once a miss is confirmed, which triggers the\n // lazy load and a re-render when the map arrives.\n const needsFallback = pack !== \"lucide\" && map !== null && !map[name];\n const lucideMap = useIconMap(needsFallback ? \"lucide\" : pack);\n\n if (!map) return null;\n\n let Comp = map[name];\n let renderPack: IconPack = pack;\n if (!Comp) {\n if (!needsFallback || !lucideMap?.[name]) return null;\n Comp = lucideMap[name];\n renderPack = \"lucide\";\n }\n\n if (renderPack === \"phosphor\") {\n return <Comp size={size} weight={getPhosphorWeight(weight)} className={className} />;\n }\n\n if (renderPack === \"heroicons\") {\n return <Comp className={className} style={{ width: size, height: size, strokeWidth: weight }} />;\n }\n\n if (renderPack === \"tabler\") {\n return <Comp size={size} stroke={weight} className={className} />;\n }\n\n if (renderPack === \"feather\") {\n return <Comp size={size} className={className} strokeWidth={weight} />;\n }\n\n return <Comp size={size} strokeWidth={weight} className={className} />;\n}\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { buildExtendedMap } from './chunk-GYVBRUO2.js';
|
|
2
|
+
import './chunk-5WRI5ZAA.js';
|
|
3
|
+
|
|
4
|
+
// ../../showcase/src/lib/icon-packs/feather.ts
|
|
5
|
+
async function load() {
|
|
6
|
+
let F;
|
|
7
|
+
try {
|
|
8
|
+
F = await import('react-icons/fi');
|
|
9
|
+
} catch {
|
|
10
|
+
throw new Error("gridsmith-ui: react-icons is not installed. Run: npm install react-icons");
|
|
11
|
+
}
|
|
12
|
+
const aliases = {
|
|
13
|
+
"home": F.FiHome,
|
|
14
|
+
"folder": F.FiFolder,
|
|
15
|
+
"chart": F.FiBarChart2,
|
|
16
|
+
"settings": F.FiSettings,
|
|
17
|
+
"chevron-right": F.FiChevronRight,
|
|
18
|
+
"close": F.FiX,
|
|
19
|
+
"plus": F.FiPlus,
|
|
20
|
+
"search": F.FiSearch,
|
|
21
|
+
"bell": F.FiBell,
|
|
22
|
+
"user": F.FiUser,
|
|
23
|
+
"check": F.FiCheck,
|
|
24
|
+
"warning": F.FiAlertTriangle,
|
|
25
|
+
"info": F.FiInfo,
|
|
26
|
+
"error": F.FiAlertCircle,
|
|
27
|
+
"clock": F.FiClock,
|
|
28
|
+
"calendar": F.FiCalendar,
|
|
29
|
+
"bold": F.FiBold,
|
|
30
|
+
"italic": F.FiItalic,
|
|
31
|
+
"underline": F.FiUnderline,
|
|
32
|
+
"strikethrough": F.FiSlash,
|
|
33
|
+
"align-left": F.FiAlignLeft,
|
|
34
|
+
"align-center": F.FiAlignCenter,
|
|
35
|
+
"align-right": F.FiAlignRight,
|
|
36
|
+
"list": F.FiList,
|
|
37
|
+
"list-ordered": F.FiList,
|
|
38
|
+
"list-checks": F.FiCheckSquare,
|
|
39
|
+
"link": F.FiLink,
|
|
40
|
+
"image": F.FiImage,
|
|
41
|
+
"table": F.FiGrid,
|
|
42
|
+
"code": F.FiCode,
|
|
43
|
+
"quote": F.FiMessageSquare,
|
|
44
|
+
"minus": F.FiMinus,
|
|
45
|
+
"superscript": F.FiChevronUp,
|
|
46
|
+
"subscript": F.FiChevronDown,
|
|
47
|
+
"highlight": F.FiEdit2,
|
|
48
|
+
"type": F.FiType,
|
|
49
|
+
"chevron-up": F.FiChevronUp,
|
|
50
|
+
"chevron-down": F.FiChevronDown,
|
|
51
|
+
"trash": F.FiTrash2,
|
|
52
|
+
"undo": F.FiRotateCcw,
|
|
53
|
+
"redo": F.FiRotateCw,
|
|
54
|
+
"arrow-left": F.FiArrowLeft,
|
|
55
|
+
"grip-vertical": F.FiMoreVertical,
|
|
56
|
+
"mic": F.FiMic,
|
|
57
|
+
"paperclip": F.FiPaperclip,
|
|
58
|
+
"send": F.FiSend,
|
|
59
|
+
"log-out": F.FiLogOut,
|
|
60
|
+
"edit": F.FiEdit2,
|
|
61
|
+
"menu": F.FiMenu,
|
|
62
|
+
"star": F.FiStar,
|
|
63
|
+
"bookmark": F.FiBookmark,
|
|
64
|
+
"download": F.FiDownload,
|
|
65
|
+
"upload": F.FiUpload
|
|
66
|
+
};
|
|
67
|
+
return buildExtendedMap(F, aliases, { stripPrefix: "Fi" });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { load };
|
|
71
|
+
//# sourceMappingURL=feather-N37QZ7LA.js.map
|
|
72
|
+
//# sourceMappingURL=feather-N37QZ7LA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../showcase/src/lib/icon-packs/feather.ts"],"names":[],"mappings":";;;;AAGA,eAAsB,IAAA,GAAyB;AAC7C,EAAA,IAAI,CAAA;AACJ,EAAA,IAAI;AAAE,IAAA,CAAA,GAAI,MAAM,OAAO,gBAAgB,CAAA;AAAA,EAAE,CAAA,CAAA,MACnC;AAAE,IAAA,MAAM,IAAI,MAAM,0EAA0E,CAAA;AAAA,EAAE;AACpG,EAAA,MAAM,OAAA,GAAmB;AAAA,IACvB,QAAQ,CAAA,CAAE,MAAA;AAAA,IAAQ,UAAU,CAAA,CAAE,QAAA;AAAA,IAAU,SAAS,CAAA,CAAE,WAAA;AAAA,IAAa,YAAY,CAAA,CAAE,UAAA;AAAA,IAC9E,iBAAiB,CAAA,CAAE,cAAA;AAAA,IAAgB,SAAS,CAAA,CAAE,GAAA;AAAA,IAAK,QAAQ,CAAA,CAAE,M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AAAA,IAAa,QAAQ,CAAA,CAAE,UAAA;AAAA,IACjC,cAAc,CAAA,CAAE,WAAA;AAAA,IAAa,iBAAiB,CAAA,CAAE,cAAA;AAAA,IAChD,OAAO,CAAA,CAAE,KAAA;AAAA,IAAO,aAAa,CAAA,CAAE,WAAA;AAAA,IAAa,QAAQ,CAAA,CAAE,MAAA;AAAA,IACtD,WAAW,CAAA,CAAE,QAAA;AAAA,IAAU,QAAQ,CAAA,CAAE,OAAA;AAAA,IAAS,QAAQ,CAAA,CAAE,MAAA;AAAA,IACpD,QAAQ,CAAA,CAAE,MAAA;AAAA,IAAQ,YAAY,CAAA,CAAE,UAAA;AAAA,IAChC,YAAY,CAAA,CAAE,UAAA;AAAA,IAAY,UAAU,CAAA,CAAE;AAAA,GACxC;AACA,EAAA,OAAO,iBAAiB,CAAA,EAAyC,OAAA,EAAS,EAAE,WAAA,EAAa,MAAM,CAAA;AACjG","file":"feather-N37QZ7LA.js","sourcesContent":["import type { IconMap } from './types'\nimport { buildExtendedMap } from './utils'\n\nexport async function load(): Promise<IconMap> {\n let F: typeof import(\"react-icons/fi\")\n try { F = await import(\"react-icons/fi\") }\n catch { throw new Error('gridsmith-ui: react-icons is not installed. Run: npm install react-icons') }\n const aliases: IconMap = {\n \"home\": F.FiHome, \"folder\": F.FiFolder, \"chart\": F.FiBarChart2, \"settings\": F.FiSettings,\n \"chevron-right\": F.FiChevronRight, \"close\": F.FiX, \"plus\": F.FiPlus, \"search\": F.FiSearch,\n \"bell\": F.FiBell, \"user\": F.FiUser, \"check\": F.FiCheck, \"warning\": F.FiAlertTriangle,\n \"info\": F.FiInfo, \"error\": F.FiAlertCircle, \"clock\": F.FiClock, \"calendar\": F.FiCalendar,\n \"bold\": F.FiBold, \"italic\": F.FiItalic, \"underline\": F.FiUnderline, \"strikethrough\": F.FiSlash,\n \"align-left\": F.FiAlignLeft, \"align-center\": F.FiAlignCenter, \"align-right\": F.FiAlignRight,\n \"list\": F.FiList, \"list-ordered\": F.FiList, \"list-checks\": F.FiCheckSquare,\n \"link\": F.FiLink, \"image\": F.FiImage, \"table\": F.FiGrid, \"code\": F.FiCode,\n \"quote\": F.FiMessageSquare, \"minus\": F.FiMinus, \"superscript\": F.FiChevronUp,\n \"subscript\": F.FiChevronDown, \"highlight\": F.FiEdit2, \"type\": F.FiType,\n \"chevron-up\": F.FiChevronUp, \"chevron-down\": F.FiChevronDown, \"trash\": F.FiTrash2,\n \"undo\": F.FiRotateCcw, \"redo\": F.FiRotateCw,\n \"arrow-left\": F.FiArrowLeft, \"grip-vertical\": F.FiMoreVertical,\n \"mic\": F.FiMic, \"paperclip\": F.FiPaperclip, \"send\": F.FiSend,\n \"log-out\": F.FiLogOut, \"edit\": F.FiEdit2, \"menu\": F.FiMenu,\n \"star\": F.FiStar, \"bookmark\": F.FiBookmark,\n \"download\": F.FiDownload, \"upload\": F.FiUpload,\n }\n return buildExtendedMap(F as unknown as Record<string, unknown>, aliases, { stripPrefix: \"Fi\" })\n}\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { buildExtendedMap } from './chunk-GYVBRUO2.js';
|
|
2
|
+
import './chunk-5WRI5ZAA.js';
|
|
3
|
+
|
|
4
|
+
// ../../showcase/src/lib/icon-packs/heroicons.ts
|
|
5
|
+
async function load() {
|
|
6
|
+
let H;
|
|
7
|
+
try {
|
|
8
|
+
H = await import('@heroicons/react/24/outline');
|
|
9
|
+
} catch {
|
|
10
|
+
throw new Error("gridsmith-ui: @heroicons/react is not installed. Run: npm install @heroicons/react");
|
|
11
|
+
}
|
|
12
|
+
const aliases = {
|
|
13
|
+
"home": H.HomeIcon,
|
|
14
|
+
"folder": H.FolderIcon,
|
|
15
|
+
"chart": H.ChartBarIcon,
|
|
16
|
+
"settings": H.Cog6ToothIcon,
|
|
17
|
+
"chevron-right": H.ChevronRightIcon,
|
|
18
|
+
"close": H.XMarkIcon,
|
|
19
|
+
"plus": H.PlusIcon,
|
|
20
|
+
"search": H.MagnifyingGlassIcon,
|
|
21
|
+
"bell": H.BellIcon,
|
|
22
|
+
"user": H.UserIcon,
|
|
23
|
+
"check": H.CheckIcon,
|
|
24
|
+
"warning": H.ExclamationTriangleIcon,
|
|
25
|
+
"info": H.InformationCircleIcon,
|
|
26
|
+
"error": H.ExclamationCircleIcon,
|
|
27
|
+
"clock": H.ClockIcon,
|
|
28
|
+
"calendar": H.CalendarDaysIcon,
|
|
29
|
+
"bold": H.BoldIcon,
|
|
30
|
+
"italic": H.ItalicIcon,
|
|
31
|
+
"underline": H.UnderlineIcon,
|
|
32
|
+
"strikethrough": H.StrikethroughIcon,
|
|
33
|
+
"align-left": H.Bars3BottomLeftIcon,
|
|
34
|
+
"align-center": H.Bars3Icon,
|
|
35
|
+
"align-right": H.Bars3BottomRightIcon,
|
|
36
|
+
"list": H.ListBulletIcon,
|
|
37
|
+
"list-ordered": H.NumberedListIcon,
|
|
38
|
+
"list-checks": H.ClipboardDocumentCheckIcon,
|
|
39
|
+
"link": H.LinkIcon,
|
|
40
|
+
"image": H.PhotoIcon,
|
|
41
|
+
"table": H.TableCellsIcon,
|
|
42
|
+
"code": H.CodeBracketIcon,
|
|
43
|
+
"quote": H.ChatBubbleBottomCenterTextIcon,
|
|
44
|
+
"minus": H.MinusIcon,
|
|
45
|
+
"superscript": H.H1Icon,
|
|
46
|
+
"subscript": H.H2Icon,
|
|
47
|
+
"highlight": H.PaintBrushIcon,
|
|
48
|
+
"type": H.LanguageIcon,
|
|
49
|
+
"chevron-up": H.ChevronUpIcon,
|
|
50
|
+
"chevron-down": H.ChevronDownIcon,
|
|
51
|
+
"trash": H.TrashIcon,
|
|
52
|
+
"undo": H.ArrowUturnLeftIcon,
|
|
53
|
+
"redo": H.ArrowUturnRightIcon,
|
|
54
|
+
"arrow-left": H.ArrowLeftIcon,
|
|
55
|
+
"grip-vertical": H.Bars2Icon,
|
|
56
|
+
"mic": H.MicrophoneIcon,
|
|
57
|
+
"paperclip": H.PaperClipIcon,
|
|
58
|
+
"send": H.PaperAirplaneIcon,
|
|
59
|
+
"log-out": H.ArrowRightStartOnRectangleIcon,
|
|
60
|
+
"edit": H.PencilIcon,
|
|
61
|
+
"menu": H.Bars3Icon,
|
|
62
|
+
"star": H.StarIcon,
|
|
63
|
+
"bookmark": H.BookmarkIcon,
|
|
64
|
+
"download": H.ArrowDownTrayIcon,
|
|
65
|
+
"upload": H.ArrowUpTrayIcon
|
|
66
|
+
};
|
|
67
|
+
return buildExtendedMap(H, aliases, { stripSuffix: "Icon" });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { load };
|
|
71
|
+
//# sourceMappingURL=heroicons-HJTKMLIJ.js.map
|
|
72
|
+
//# sourceMappingURL=heroicons-HJTKMLIJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../showcase/src/lib/icon-packs/heroicons.ts"],"names":[],"mappings":";;;;AAGA,eAAsB,IAAA,GAAyB;AAC7C,EAAA,IAAI,CAAA;AACJ,EAAA,IAAI;AAAE,IAAA,CAAA,GAAI,MAAM,OAAO,6BAA6B,CAAA;AAAA,EAAE,CAAA,CAAA,MAChD;AAAE,IAAA,MAAM,IAAI,MAAM,oFAAoF,CAAA;AAAA,EAAE;AAC9G,EAAA,MAAM,OAAA,GAAmB;AAAA,IACvB,QAAQ,CAAA,CAAE,QAAA;AAAA,IAAU,UAAU,CAAA,CAAE,UAAA;AAAA,IAAY,SAAS,CAAA,CAAE,YAAA;AAAA,IACvD,YAAY,CAAA,CAAE,aAAA;AAAA,IAAe,iBAAiB,CAAA,CAAE,gBAAA;AAAA,IAChD,SAAS,CAAA,CAAE,SAAA;AAAA,IAAW,QAAQ,CAAA,CAAE,QAAA;AAAA,IAAU,UAAU,CAAA,CAAE,mBAAA;AAAA,IACtD,QAAQ,CAAA,CAAE,QAAA;AAAA,IAAU,QAAQ,CAAA,CAAE,QAAA;AAAA,IAAU,SAAS,CAAA,CAAE,SAAA;AAAA,IACnD,WAAW,CAAA,CAAE,uBAA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AAA,CAAE,aAAA;AAAA,IAAe,QAAQ,CAAA,CAAE,iBAAA;AAAA,IACjE,WAAW,CAAA,CAAE,8BAAA;AAAA,IAAgC,QAAQ,CAAA,CAAE,UAAA;AAAA,IAAY,QAAQ,CAAA,CAAE,SAAA;AAAA,IAC7E,QAAQ,CAAA,CAAE,QAAA;AAAA,IAAU,YAAY,CAAA,CAAE,YAAA;AAAA,IAClC,YAAY,CAAA,CAAE,iBAAA;AAAA,IAAmB,UAAU,CAAA,CAAE;AAAA,GAC/C;AACA,EAAA,OAAO,iBAAiB,CAAA,EAAyC,OAAA,EAAS,EAAE,WAAA,EAAa,QAAQ,CAAA;AACnG","file":"heroicons-HJTKMLIJ.js","sourcesContent":["import type { IconMap } from './types'\nimport { buildExtendedMap } from './utils'\n\nexport async function load(): Promise<IconMap> {\n let H: typeof import(\"@heroicons/react/24/outline\")\n try { H = await import(\"@heroicons/react/24/outline\") }\n catch { throw new Error('gridsmith-ui: @heroicons/react is not installed. Run: npm install @heroicons/react') }\n const aliases: IconMap = {\n \"home\": H.HomeIcon, \"folder\": H.FolderIcon, \"chart\": H.ChartBarIcon,\n \"settings\": H.Cog6ToothIcon, \"chevron-right\": H.ChevronRightIcon,\n \"close\": H.XMarkIcon, \"plus\": H.PlusIcon, \"search\": H.MagnifyingGlassIcon,\n \"bell\": H.BellIcon, \"user\": H.UserIcon, \"check\": H.CheckIcon,\n \"warning\": H.ExclamationTriangleIcon, \"info\": H.InformationCircleIcon,\n \"error\": H.ExclamationCircleIcon, \"clock\": H.ClockIcon, \"calendar\": H.CalendarDaysIcon,\n \"bold\": H.BoldIcon, \"italic\": H.ItalicIcon, \"underline\": H.UnderlineIcon,\n \"strikethrough\": H.StrikethroughIcon, \"align-left\": H.Bars3BottomLeftIcon,\n \"align-center\": H.Bars3Icon, \"align-right\": H.Bars3BottomRightIcon,\n \"list\": H.ListBulletIcon, \"list-ordered\": H.NumberedListIcon,\n \"list-checks\": H.ClipboardDocumentCheckIcon, \"link\": H.LinkIcon,\n \"image\": H.PhotoIcon, \"table\": H.TableCellsIcon, \"code\": H.CodeBracketIcon,\n \"quote\": H.ChatBubbleBottomCenterTextIcon, \"minus\": H.MinusIcon,\n \"superscript\": H.H1Icon, \"subscript\": H.H2Icon,\n \"highlight\": H.PaintBrushIcon, \"type\": H.LanguageIcon,\n \"chevron-up\": H.ChevronUpIcon, \"chevron-down\": H.ChevronDownIcon, \"trash\": H.TrashIcon,\n \"undo\": H.ArrowUturnLeftIcon, \"redo\": H.ArrowUturnRightIcon,\n \"arrow-left\": H.ArrowLeftIcon, \"grip-vertical\": H.Bars2Icon,\n \"mic\": H.MicrophoneIcon, \"paperclip\": H.PaperClipIcon, \"send\": H.PaperAirplaneIcon,\n \"log-out\": H.ArrowRightStartOnRectangleIcon, \"edit\": H.PencilIcon, \"menu\": H.Bars3Icon,\n \"star\": H.StarIcon, \"bookmark\": H.BookmarkIcon,\n \"download\": H.ArrowDownTrayIcon, \"upload\": H.ArrowUpTrayIcon,\n }\n return buildExtendedMap(H as unknown as Record<string, unknown>, aliases, { stripSuffix: \"Icon\" })\n}\n"]}
|
package/dist/icons.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -68,12 +68,14 @@ interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
|
68
68
|
}
|
|
69
69
|
declare function Textarea({ className, autoResize, maxRows, ref, ...props }: TextareaProps): react_jsx_runtime.JSX.Element;
|
|
70
70
|
declare function Label({ className, children, ...props }: LabelHTMLAttributes<HTMLLabelElement>): react_jsx_runtime.JSX.Element;
|
|
71
|
-
|
|
71
|
+
type ToggleLayout = "full" | "compact";
|
|
72
|
+
declare function Toggle({ checked, onChange, label, disabled, error, layout, "aria-labelledby": ariaLabelledBy, ...rest }: {
|
|
72
73
|
checked: boolean;
|
|
73
74
|
onChange: (v: boolean) => void;
|
|
74
75
|
label?: string;
|
|
75
76
|
disabled?: boolean;
|
|
76
77
|
error?: boolean;
|
|
78
|
+
layout?: ToggleLayout;
|
|
77
79
|
"aria-labelledby"?: string;
|
|
78
80
|
} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onChange">): react_jsx_runtime.JSX.Element;
|
|
79
81
|
|
|
@@ -1207,9 +1209,10 @@ interface ToastProps {
|
|
|
1207
1209
|
pauseOnHover?: boolean;
|
|
1208
1210
|
action?: ToastAction;
|
|
1209
1211
|
position?: ToastPosition;
|
|
1212
|
+
mode?: "light" | "dark";
|
|
1210
1213
|
container?: Element | DocumentFragment;
|
|
1211
1214
|
}
|
|
1212
|
-
declare function Toast({ variant, message, visible, onDismiss, duration, pauseOnHover, action, position, container }: ToastProps): react.ReactPortal | null;
|
|
1215
|
+
declare function Toast({ variant, message, visible, onDismiss, duration, pauseOnHover, action, position, mode, container }: ToastProps): react.ReactPortal | null;
|
|
1213
1216
|
|
|
1214
1217
|
type ProgressVariant = "default" | "success" | "warning" | "error";
|
|
1215
1218
|
interface ProgressProps {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cn, GLASS_BACKDROP, GLASS_DROPDOWN, lockBodyScroll, unlockBodyScroll, GLASS_OVERLAY, GLASS_SURFACE } from './chunk-5XIPPVH7.js';
|
|
2
|
-
import { Icon } from './chunk-
|
|
2
|
+
import { Icon } from './chunk-WVB3SRXW.js';
|
|
3
3
|
import { __commonJS, __toESM } from './chunk-5WRI5ZAA.js';
|
|
4
4
|
import * as React6 from 'react';
|
|
5
5
|
import React6__default, { createContext, forwardRef, useState, useCallback, useRef, useContext, useId, useMemo, useEffect, useLayoutEffect, isValidElement, cloneElement, createElement, Fragment as Fragment$1, useDebugValue, memo, useReducer, useSyncExternalStore as useSyncExternalStore$1, useImperativeHandle } from 'react';
|
|
@@ -1731,7 +1731,7 @@ function Spinner({ size = "md", color = "default", label = "Loading", className
|
|
|
1731
1731
|
);
|
|
1732
1732
|
}
|
|
1733
1733
|
var variantStyles = {
|
|
1734
|
-
default: "bg-[var(--ds-accent-primary)] [background-image:var(--ds-gradient)] text-[var(--ds-text-on-primary)] border-transparent hover:bg-[var(--ds-accent-primary-hover)] hover:brightness-110",
|
|
1734
|
+
default: "bg-[var(--ds-accent-primary)] [background-image:var(--ds-gradient)] [background-origin:border-box] text-[var(--ds-text-on-primary)] border-transparent hover:bg-[var(--ds-accent-primary-hover)] hover:brightness-110",
|
|
1735
1735
|
secondary: "bg-[var(--ds-bg-surface)] text-[var(--ds-text-primary)] border-[var(--ds-border-default)] hover:bg-[var(--ds-bg-muted)]",
|
|
1736
1736
|
tertiary: "bg-[var(--ds-bg-muted)] text-[var(--ds-text-primary)] border-transparent hover:brightness-95",
|
|
1737
1737
|
outline: "bg-[var(--ds-input-bg)] text-[var(--ds-text-primary)] border-[var(--ds-border-default)] hover:bg-[var(--ds-bg-muted)]",
|
|
@@ -2093,51 +2093,64 @@ function Label({ className, children, ...props }) {
|
|
|
2093
2093
|
}
|
|
2094
2094
|
);
|
|
2095
2095
|
}
|
|
2096
|
-
function Toggle({ checked, onChange, label, disabled, error = false, "aria-labelledby": ariaLabelledBy, ...rest }) {
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
"
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
height: 16,
|
|
2134
|
-
transform: checked ? "translateX(calc(25px - var(--ds-border-width)))" : "translateX(calc(1px + var(--ds-border-width)))"
|
|
2135
|
-
}
|
|
2096
|
+
function Toggle({ checked, onChange, label, disabled, error = false, layout = "full", "aria-labelledby": ariaLabelledBy, ...rest }) {
|
|
2097
|
+
const switchButton = /* @__PURE__ */ jsx(
|
|
2098
|
+
"button",
|
|
2099
|
+
{
|
|
2100
|
+
role: "switch",
|
|
2101
|
+
"aria-checked": checked,
|
|
2102
|
+
"aria-label": !label && !ariaLabelledBy ? "Toggle" : void 0,
|
|
2103
|
+
"aria-labelledby": ariaLabelledBy,
|
|
2104
|
+
"aria-invalid": error || void 0,
|
|
2105
|
+
disabled,
|
|
2106
|
+
onClick: () => !disabled && onChange(!checked),
|
|
2107
|
+
...rest,
|
|
2108
|
+
className: cn(
|
|
2109
|
+
"relative inline-flex shrink-0 items-center overflow-hidden",
|
|
2110
|
+
"border-[length:var(--ds-border-width)]",
|
|
2111
|
+
"rounded-[var(--ds-radius-full)]",
|
|
2112
|
+
"transition-colors duration-[var(--ds-transition-speed)]",
|
|
2113
|
+
"focus-visible:outline-none focus-visible:shadow-[var(--ds-shadow-focus)]",
|
|
2114
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
2115
|
+
checked ? "bg-[var(--ds-accent-primary)]" : "bg-[var(--ds-bg-muted)]",
|
|
2116
|
+
error ? "border-[var(--ds-status-error)]" : checked ? "border-transparent" : "border-[var(--ds-border-default)]"
|
|
2117
|
+
),
|
|
2118
|
+
style: { width: 44, height: 24 },
|
|
2119
|
+
children: /* @__PURE__ */ jsx(
|
|
2120
|
+
"span",
|
|
2121
|
+
{
|
|
2122
|
+
className: cn(
|
|
2123
|
+
"pointer-events-none inline-block shrink-0",
|
|
2124
|
+
"bg-[var(--ds-bg-surface)]",
|
|
2125
|
+
"border-[length:var(--ds-border-width)] border-transparent",
|
|
2126
|
+
"rounded-[var(--ds-radius-full)]",
|
|
2127
|
+
"transition-transform"
|
|
2128
|
+
),
|
|
2129
|
+
style: {
|
|
2130
|
+
width: 16,
|
|
2131
|
+
height: 16,
|
|
2132
|
+
transform: checked ? "translateX(calc(25px - var(--ds-border-width)))" : "translateX(calc(1px + var(--ds-border-width)))"
|
|
2136
2133
|
}
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2134
|
+
}
|
|
2135
|
+
)
|
|
2136
|
+
}
|
|
2137
|
+
);
|
|
2138
|
+
if (!label) {
|
|
2139
|
+
return /* @__PURE__ */ jsx("div", { className: cn(disabled && "opacity-disabled"), children: switchButton });
|
|
2140
|
+
}
|
|
2141
|
+
return /* @__PURE__ */ jsxs(
|
|
2142
|
+
"label",
|
|
2143
|
+
{
|
|
2144
|
+
className: cn(
|
|
2145
|
+
layout === "full" ? "flex items-center justify-between gap-ds-4" : "inline-flex items-center gap-ds-3",
|
|
2146
|
+
disabled ? "cursor-not-allowed opacity-disabled" : "cursor-pointer"
|
|
2147
|
+
),
|
|
2148
|
+
children: [
|
|
2149
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-[var(--ds-text-primary)]", children: label }),
|
|
2150
|
+
switchButton
|
|
2151
|
+
]
|
|
2152
|
+
}
|
|
2153
|
+
);
|
|
2141
2154
|
}
|
|
2142
2155
|
function Dropdown({
|
|
2143
2156
|
options,
|
|
@@ -2156,6 +2169,7 @@ function Dropdown({
|
|
|
2156
2169
|
}) {
|
|
2157
2170
|
const [open, setOpen] = useState(false);
|
|
2158
2171
|
const [search, setSearch] = useState("");
|
|
2172
|
+
const [positioned, setPositioned] = useState(false);
|
|
2159
2173
|
const triggerRef = useRef(null);
|
|
2160
2174
|
const menuRef = useRef(null);
|
|
2161
2175
|
const searchRef = useRef(null);
|
|
@@ -2181,12 +2195,16 @@ function Dropdown({
|
|
|
2181
2195
|
setPos({ top, left, width });
|
|
2182
2196
|
}, []);
|
|
2183
2197
|
useEffect(() => {
|
|
2184
|
-
if (!open)
|
|
2198
|
+
if (!open) {
|
|
2199
|
+
setPositioned(false);
|
|
2200
|
+
return;
|
|
2201
|
+
}
|
|
2185
2202
|
updatePos();
|
|
2186
2203
|
setSearch("");
|
|
2187
2204
|
requestAnimationFrame(() => {
|
|
2188
2205
|
searchRef.current?.focus();
|
|
2189
2206
|
updatePos();
|
|
2207
|
+
setPositioned(true);
|
|
2190
2208
|
});
|
|
2191
2209
|
const onScroll = () => updatePos();
|
|
2192
2210
|
window.addEventListener("scroll", onScroll, true);
|
|
@@ -2267,7 +2285,7 @@ function Dropdown({
|
|
|
2267
2285
|
"rounded-[var(--ds-radius-md)] overflow-hidden",
|
|
2268
2286
|
"shadow-[var(--ds-shadow-dropdown),var(--ds-glass-inset)]"
|
|
2269
2287
|
),
|
|
2270
|
-
style: { top: pos.top, left: pos.left, minWidth: pos.width, width: "max-content", maxWidth: "calc(100vw - 16px)" },
|
|
2288
|
+
style: { top: pos.top, left: pos.left, minWidth: pos.width, width: "max-content", maxWidth: "calc(100vw - 16px)", visibility: positioned ? "visible" : "hidden" },
|
|
2271
2289
|
children: [
|
|
2272
2290
|
searchable && /* @__PURE__ */ jsx("div", { className: "border-b-[length:var(--ds-border-width)] border-[var(--ds-border-subtle)]", style: { padding: "var(--ds-space-2)" }, children: /* @__PURE__ */ jsx(
|
|
2273
2291
|
"input",
|
|
@@ -2581,7 +2599,7 @@ function Checkbox({ checked, onChange, label, disabled = false, indeterminate =
|
|
|
2581
2599
|
"border-[2px]",
|
|
2582
2600
|
"transition-all",
|
|
2583
2601
|
"peer-focus-visible:shadow-[var(--ds-shadow-focus)]",
|
|
2584
|
-
filled ? "bg-[var(--ds-check-bg)] border-[var(--ds-check-border)]" : "bg-[var(--ds-input-bg)] border-[var(--ds-input-border)]",
|
|
2602
|
+
filled ? "bg-[var(--ds-check-bg)] [background-image:var(--ds-gradient)] border-[var(--ds-check-border)]" : "bg-[var(--ds-input-bg)] border-[var(--ds-input-border)]",
|
|
2585
2603
|
disabled && "pointer-events-none"
|
|
2586
2604
|
),
|
|
2587
2605
|
children: /* @__PURE__ */ jsx(
|
|
@@ -2695,7 +2713,7 @@ function RadioGroup({ value, onChange, options, orientation = "vertical", classN
|
|
|
2695
2713
|
selected && "border-[var(--ds-check-border)]",
|
|
2696
2714
|
"focus-visible:shadow-[var(--ds-shadow-focus)]"
|
|
2697
2715
|
),
|
|
2698
|
-
children: selected && /* @__PURE__ */ jsx("span", { className: "h-2.5 w-2.5 rounded-full bg-[var(--ds-accent-primary)]" })
|
|
2716
|
+
children: selected && /* @__PURE__ */ jsx("span", { className: "h-2.5 w-2.5 rounded-full bg-[var(--ds-accent-primary)] [background-image:var(--ds-gradient)]" })
|
|
2699
2717
|
}
|
|
2700
2718
|
),
|
|
2701
2719
|
/* @__PURE__ */ jsx("span", { className: "text-sm text-[var(--ds-text-primary)]", children: option.label })
|
|
@@ -3131,7 +3149,7 @@ function SliderRange({
|
|
|
3131
3149
|
/* @__PURE__ */ jsx(
|
|
3132
3150
|
"div",
|
|
3133
3151
|
{
|
|
3134
|
-
className: "absolute h-1.5 rounded-[var(--ds-radius-full)] bg-[var(--ds-accent-primary)]",
|
|
3152
|
+
className: "absolute h-1.5 rounded-[var(--ds-radius-full)] bg-[var(--ds-accent-primary)] [background-image:var(--ds-gradient)]",
|
|
3135
3153
|
style: {
|
|
3136
3154
|
left: `${isRange ? pct(low) : 0}%`,
|
|
3137
3155
|
width: `${isRange ? pct(high) - pct(low) : pct(low)}%`
|
|
@@ -83140,7 +83158,7 @@ function MonthView({
|
|
|
83140
83158
|
{
|
|
83141
83159
|
className: cn(
|
|
83142
83160
|
"text-xs w-6 h-6 flex items-center justify-center rounded-full",
|
|
83143
|
-
today ? "bg-[var(--ds-accent-primary)] text-[var(--ds-text-on-primary)] font-bold" : "text-[var(--ds-text-secondary)]"
|
|
83161
|
+
today ? "bg-[var(--ds-accent-primary)] [background-image:var(--ds-gradient)] text-[var(--ds-text-on-primary)] font-bold" : "text-[var(--ds-text-secondary)]"
|
|
83144
83162
|
),
|
|
83145
83163
|
children: day.getDate()
|
|
83146
83164
|
}
|
|
@@ -93809,7 +93827,7 @@ function Pagination({ currentPage, totalPages, onPageChange, pageSize, pageSizeO
|
|
|
93809
93827
|
"rounded-[var(--ds-radius-md)]",
|
|
93810
93828
|
"border-[length:var(--ds-border-width)]",
|
|
93811
93829
|
"transition-colors duration-[var(--ds-transition-speed)]",
|
|
93812
|
-
p === currentPage ? "bg-[var(--ds-accent-primary)] text-[var(--ds-text-on-primary)] border-[var(--ds-accent-primary)]" : "bg-[var(--ds-bg-surface)] text-[var(--ds-text-secondary)] border-[var(--ds-border-default)] hover:bg-[var(--ds-bg-muted)] hover:text-[var(--ds-text-primary)]"
|
|
93830
|
+
p === currentPage ? "bg-[var(--ds-accent-primary)] [background-image:var(--ds-gradient)] text-[var(--ds-text-on-primary)] border-[var(--ds-accent-primary)]" : "bg-[var(--ds-bg-surface)] text-[var(--ds-text-secondary)] border-[var(--ds-border-default)] hover:bg-[var(--ds-bg-muted)] hover:text-[var(--ds-text-primary)]"
|
|
93813
93831
|
),
|
|
93814
93832
|
children: p
|
|
93815
93833
|
},
|
|
@@ -93943,7 +93961,7 @@ function StepCircle({ status, index, onClick, clickable }) {
|
|
|
93943
93961
|
"focus-visible:outline-none focus-visible:shadow-[var(--ds-shadow-focus)]",
|
|
93944
93962
|
clickable && "cursor-pointer",
|
|
93945
93963
|
!clickable && "cursor-default",
|
|
93946
|
-
status === "complete" && "bg-[var(--ds-accent-primary)] text-[var(--ds-text-on-primary)]",
|
|
93964
|
+
status === "complete" && "bg-[var(--ds-accent-primary)] [background-image:var(--ds-gradient)] text-[var(--ds-text-on-primary)]",
|
|
93947
93965
|
status === "current" && "border-2 border-[var(--ds-accent-primary)] text-[var(--ds-accent-primary)] bg-[var(--ds-bg-surface)]",
|
|
93948
93966
|
status === "error" && "bg-[var(--ds-status-error)] text-[var(--ds-text-on-primary)]",
|
|
93949
93967
|
status === "loading" && "border-2 border-[var(--ds-accent-primary)] text-[var(--ds-accent-primary)] bg-[var(--ds-bg-surface)] animate-pulse",
|
|
@@ -96902,7 +96920,7 @@ var positionClasses = {
|
|
|
96902
96920
|
"top-center": "top-ds-4 left-1/2 -translate-x-1/2",
|
|
96903
96921
|
"bottom-center": "bottom-ds-4 left-1/2 -translate-x-1/2"
|
|
96904
96922
|
};
|
|
96905
|
-
function Toast({ variant = "default", message, visible, onDismiss, duration = 3e3, pauseOnHover = false, action, position = "bottom-right", container }) {
|
|
96923
|
+
function Toast({ variant = "default", message, visible, onDismiss, duration = 3e3, pauseOnHover = false, action, position = "bottom-right", mode, container }) {
|
|
96906
96924
|
const isMobile = useBreakpoint("sm");
|
|
96907
96925
|
const isCentered = position === "top-center" || position === "bottom-center";
|
|
96908
96926
|
const timerRef = useRef(void 0);
|
|
@@ -96944,6 +96962,7 @@ function Toast({ variant = "default", message, visible, onDismiss, duration = 3e
|
|
|
96944
96962
|
{
|
|
96945
96963
|
role: "status",
|
|
96946
96964
|
"aria-live": "polite",
|
|
96965
|
+
"data-mode": mode,
|
|
96947
96966
|
onMouseEnter: handleMouseEnter,
|
|
96948
96967
|
onMouseLeave: handleMouseLeave2,
|
|
96949
96968
|
className: cn(
|