@orangecheck/design 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +111 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +112 -2
- package/dist/index.mjs.map +1 -1
- package/dist/tokens.d.mts +8 -1
- package/dist/tokens.d.ts +8 -1
- package/dist/tokens.js +110 -0
- package/dist/tokens.js.map +1 -1
- package/dist/tokens.mjs +111 -2
- package/dist/tokens.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DEFAULT_OC_THEME, OC_SKIN_COOKIE, OC_THEMES, OcTheme, OcThemeBridge, OcThemeId, OcThemePicker, OcThemePickerProps, OcThemeProvider, OcThemeProviderProps, cn, getOcThemeInitScript, isKnownTheme, resolveTheme, useOcSkin } from './tokens.mjs';
|
|
1
|
+
export { DEFAULT_OC_THEME, OC_SKIN_COOKIE, OC_THEMES, OcAppearanceMenu, OcAppearanceMenuProps, OcTheme, OcThemeBridge, OcThemeId, OcThemePicker, OcThemePickerProps, OcThemeProvider, OcThemeProviderProps, cn, getOcThemeInitScript, isKnownTheme, resolveTheme, useOcSkin } from './tokens.mjs';
|
|
2
2
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, AlertWithAction, AlertWithActionProps, AlertWithCountdown, AlertWithCountdownProps, Badge, Bar, BarProps, BitcoinAddress, BitcoinAddressProps, Button, Card, CardProps, ConfirmHost, ConfirmOptions, CopyButton, CopyButtonProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, ErrorBoundary, Input, Label, Modal, ModalProps, Pagination, PaginationProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PromptHost, PromptOptions, QrCode, QrCodeProps, SatsAmount, SatsAmountProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetContent, SheetDescription, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, SkeletonProps, Sparkline, SparklineProps, StatBlock, StatBlockProps, StatusPill, StatusPillProps, StatusTone, Textarea, ThemeToggle, ThemeToggleLink, Toaster, Working, WorkingPanel, WorkingProps, badgeVariants, buttonVariants, confirm, prompt } from './primitives.mjs';
|
|
3
3
|
export * from '@orangecheck/ui';
|
|
4
4
|
export { ExplorerNetwork, ExplorerTarget, REFERENCE_BTC_USD, explorerUrl, formatSats, formatSatsCompact, priceBoth, relativeTime, satsToUsd, shortenAddress, usdToSats } from './format.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DEFAULT_OC_THEME, OC_SKIN_COOKIE, OC_THEMES, OcTheme, OcThemeBridge, OcThemeId, OcThemePicker, OcThemePickerProps, OcThemeProvider, OcThemeProviderProps, cn, getOcThemeInitScript, isKnownTheme, resolveTheme, useOcSkin } from './tokens.js';
|
|
1
|
+
export { DEFAULT_OC_THEME, OC_SKIN_COOKIE, OC_THEMES, OcAppearanceMenu, OcAppearanceMenuProps, OcTheme, OcThemeBridge, OcThemeId, OcThemePicker, OcThemePickerProps, OcThemeProvider, OcThemeProviderProps, cn, getOcThemeInitScript, isKnownTheme, resolveTheme, useOcSkin } from './tokens.js';
|
|
2
2
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, AlertWithAction, AlertWithActionProps, AlertWithCountdown, AlertWithCountdownProps, Badge, Bar, BarProps, BitcoinAddress, BitcoinAddressProps, Button, Card, CardProps, ConfirmHost, ConfirmOptions, CopyButton, CopyButtonProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, ErrorBoundary, Input, Label, Modal, ModalProps, Pagination, PaginationProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PromptHost, PromptOptions, QrCode, QrCodeProps, SatsAmount, SatsAmountProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetContent, SheetDescription, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, SkeletonProps, Sparkline, SparklineProps, StatBlock, StatBlockProps, StatusPill, StatusPillProps, StatusTone, Textarea, ThemeToggle, ThemeToggleLink, Toaster, Working, WorkingPanel, WorkingProps, badgeVariants, buttonVariants, confirm, prompt } from './primitives.js';
|
|
3
3
|
export * from '@orangecheck/ui';
|
|
4
4
|
export { ExplorerNetwork, ExplorerTarget, REFERENCE_BTC_USD, explorerUrl, formatSats, formatSatsCompact, priceBoth, relativeTime, satsToUsd, shortenAddress, usdToSats } from './format.js';
|
package/dist/index.js
CHANGED
|
@@ -102,6 +102,7 @@ __export(src_exports, {
|
|
|
102
102
|
Modal: () => Modal,
|
|
103
103
|
OC_SKIN_COOKIE: () => OC_SKIN_COOKIE,
|
|
104
104
|
OC_THEMES: () => OC_THEMES,
|
|
105
|
+
OcAppearanceMenu: () => OcAppearanceMenu,
|
|
105
106
|
OcThemeBridge: () => OcThemeBridge,
|
|
106
107
|
OcThemePicker: () => OcThemePicker,
|
|
107
108
|
OcThemeProvider: () => OcThemeProvider,
|
|
@@ -403,6 +404,115 @@ function OcThemePicker({ className, triggerClassName, popoverClassName }) {
|
|
|
403
404
|
)
|
|
404
405
|
] });
|
|
405
406
|
}
|
|
407
|
+
var MODES = [
|
|
408
|
+
{ id: "light", label: "light", Icon: lucideReact.Sun },
|
|
409
|
+
{ id: "dark", label: "dark", Icon: lucideReact.Moon },
|
|
410
|
+
{ id: "system", label: "system", Icon: lucideReact.Monitor }
|
|
411
|
+
];
|
|
412
|
+
function OcAppearanceMenu({
|
|
413
|
+
className,
|
|
414
|
+
triggerClassName,
|
|
415
|
+
popoverClassName
|
|
416
|
+
}) {
|
|
417
|
+
const { skin, setSkin, themes } = useOcSkin();
|
|
418
|
+
const { theme, setTheme } = nextThemes.useTheme();
|
|
419
|
+
const [open, setOpen] = React2.useState(false);
|
|
420
|
+
const [mounted, setMounted] = React2.useState(false);
|
|
421
|
+
const rootRef = React2.useRef(null);
|
|
422
|
+
React2.useEffect(() => setMounted(true), []);
|
|
423
|
+
React2.useEffect(() => {
|
|
424
|
+
if (!open) return;
|
|
425
|
+
function onDown(e) {
|
|
426
|
+
if (rootRef.current && !rootRef.current.contains(e.target)) setOpen(false);
|
|
427
|
+
}
|
|
428
|
+
function onKey(e) {
|
|
429
|
+
if (e.key === "Escape") setOpen(false);
|
|
430
|
+
}
|
|
431
|
+
document.addEventListener("mousedown", onDown);
|
|
432
|
+
document.addEventListener("keydown", onKey);
|
|
433
|
+
return () => {
|
|
434
|
+
document.removeEventListener("mousedown", onDown);
|
|
435
|
+
document.removeEventListener("keydown", onKey);
|
|
436
|
+
};
|
|
437
|
+
}, [open]);
|
|
438
|
+
const activeMode = mounted ? theme ?? "system" : null;
|
|
439
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: rootRef, className: cn("relative", className), children: [
|
|
440
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
441
|
+
"button",
|
|
442
|
+
{
|
|
443
|
+
type: "button",
|
|
444
|
+
"aria-label": "appearance settings",
|
|
445
|
+
"aria-haspopup": "menu",
|
|
446
|
+
"aria-expanded": open,
|
|
447
|
+
title: "appearance \xB7 mode + theme",
|
|
448
|
+
onClick: () => setOpen((v) => !v),
|
|
449
|
+
className: cn(
|
|
450
|
+
"text-muted-foreground hover:text-foreground inline-flex size-9 items-center justify-center rounded-md transition-colors outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
451
|
+
triggerClassName
|
|
452
|
+
),
|
|
453
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Palette, { className: "size-4", "aria-hidden": true })
|
|
454
|
+
}
|
|
455
|
+
),
|
|
456
|
+
open && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
457
|
+
"div",
|
|
458
|
+
{
|
|
459
|
+
role: "menu",
|
|
460
|
+
className: cn(
|
|
461
|
+
"bg-popover text-popover-foreground absolute right-0 z-50 mt-2 w-64 overflow-hidden rounded-md border shadow-md",
|
|
462
|
+
popoverClassName
|
|
463
|
+
),
|
|
464
|
+
children: [
|
|
465
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "label-mono text-muted-foreground px-3 pt-3 pb-2", children: "mode" }),
|
|
466
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-3 gap-1 px-2 pb-2", children: MODES.map(({ id, label, Icon: Icon2 }) => {
|
|
467
|
+
const active = activeMode === id;
|
|
468
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
469
|
+
"button",
|
|
470
|
+
{
|
|
471
|
+
type: "button",
|
|
472
|
+
role: "menuitemradio",
|
|
473
|
+
"aria-checked": active,
|
|
474
|
+
onClick: () => setTheme(id),
|
|
475
|
+
className: cn(
|
|
476
|
+
"flex flex-col items-center gap-1 rounded-md border py-2 text-[11px] transition-colors",
|
|
477
|
+
active ? "border-primary text-foreground bg-accent" : "border-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground"
|
|
478
|
+
),
|
|
479
|
+
children: [
|
|
480
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "size-4", "aria-hidden": true }),
|
|
481
|
+
label
|
|
482
|
+
]
|
|
483
|
+
},
|
|
484
|
+
id
|
|
485
|
+
);
|
|
486
|
+
}) }),
|
|
487
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "label-mono text-muted-foreground border-t px-3 pt-3 pb-1", children: "theme" }),
|
|
488
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "pb-1", children: themes.map((t) => {
|
|
489
|
+
const active = t.id === skin;
|
|
490
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
491
|
+
"button",
|
|
492
|
+
{
|
|
493
|
+
type: "button",
|
|
494
|
+
role: "menuitemradio",
|
|
495
|
+
"aria-checked": active,
|
|
496
|
+
onClick: () => setSkin(t.id),
|
|
497
|
+
className: cn(
|
|
498
|
+
"hover:bg-accent hover:text-accent-foreground flex w-full items-start gap-2 px-3 py-2 text-left transition-colors",
|
|
499
|
+
active && "text-foreground"
|
|
500
|
+
),
|
|
501
|
+
children: [
|
|
502
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 size-4 shrink-0", children: active && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "text-primary size-4", "aria-hidden": true }) }),
|
|
503
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0", children: [
|
|
504
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-sm font-medium", children: t.label }),
|
|
505
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground block text-xs leading-snug", children: t.description })
|
|
506
|
+
] })
|
|
507
|
+
]
|
|
508
|
+
}
|
|
509
|
+
) }, t.id);
|
|
510
|
+
}) })
|
|
511
|
+
]
|
|
512
|
+
}
|
|
513
|
+
)
|
|
514
|
+
] });
|
|
515
|
+
}
|
|
406
516
|
var buttonVariants = classVarianceAuthority.cva(
|
|
407
517
|
"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
408
518
|
{
|
|
@@ -1905,6 +2015,7 @@ exports.Label = Label;
|
|
|
1905
2015
|
exports.Modal = Modal;
|
|
1906
2016
|
exports.OC_SKIN_COOKIE = OC_SKIN_COOKIE;
|
|
1907
2017
|
exports.OC_THEMES = OC_THEMES;
|
|
2018
|
+
exports.OcAppearanceMenu = OcAppearanceMenu;
|
|
1908
2019
|
exports.OcThemeBridge = OcThemeBridge;
|
|
1909
2020
|
exports.OcThemePicker = OcThemePicker;
|
|
1910
2021
|
exports.OcThemeProvider = OcThemeProvider;
|