@orangecheck/design 0.25.0 → 0.26.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 CHANGED
@@ -1,4 +1,4 @@
1
- export { AppearanceControls, DEFAULT_OC_THEME, OC_DEFAULT_ACCENT, OC_SKIN_COOKIE, OC_THEMES, OcAppearanceMenu, OcAppearanceMenuProps, OcAurora, OcAuroraProps, OcTheme, OcThemeBridge, OcThemeId, OcThemePicker, OcThemePickerProps, OcThemeProvider, OcThemeProviderProps, accentFor, cn, getOcThemeInitScript, isKnownTheme, resolveTheme, useOcSkin } from './tokens.mjs';
1
+ export { AppearanceControls, DEFAULT_OC_THEME, OC_DEFAULT_ACCENT, OC_MOTION_COOKIE, OC_SKIN_COOKIE, OC_THEMES, OcAppearanceMenu, OcAppearanceMenuProps, OcAurora, OcAuroraProps, OcMotion, OcTheme, OcThemeBridge, OcThemeId, OcThemePicker, OcThemePickerProps, OcThemeProvider, OcThemeProviderProps, accentFor, cn, getOcThemeInitScript, isKnownTheme, resolveTheme, useOcMotion, 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, Checkbox, ConfirmHost, ConfirmOptions, CopyButton, CopyButtonProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, ErrorBoundary, IconBadge, IconBadgeProps, Input, Label, Modal, ModalProps, Pagination, PaginationProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PromptHost, PromptOptions, QrCode, QrCodeProps, RadioGroup, RadioGroupItem, SatsAmount, SatsAmountProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, SkeletonProps, Sparkline, SparklineProps, StatBlock, StatBlockProps, StatusPill, StatusPillProps, StatusPillSpec, StatusPillVariant, StatusTone, Surface, SurfaceProps, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeToggle, ThemeToggleLink, Toaster, Tooltip, TooltipProps, Working, WorkingPanel, WorkingProps, badgeVariants, buttonVariants, confirm, iconBadgeVariants, makeStatusPill, prompt, surfaceVariants } from './primitives.mjs';
3
3
  export { AccentList, AccentListItem, AccentListProps, AccentNote, AccentNoteProps, BrandBand, Callout, CalloutProps, CalloutTone, CheckList, CheckListProps, ComparisonRow, ComparisonTable, ComparisonTableProps, DataRow, DataRowProps, DefinitionItem, DefinitionList, DefinitionListProps, EmailCapture, EmailCaptureProps, EmptyState, EmptyStateCta, EmptyStateProps, Faq, FaqItem, FaqProps, FeatureCard, FeatureCardProps, HelpHint, HelpHintProps, MarketingHeading, MarketingHeadingProps, NumberedStep, NumberedStepProps, Panel, PanelProps, Section, SectionHeader, SectionHeaderProps, SectionProps, StatCard, StatCardProps, StatGrid, StatGridProps, StatItem, StatTile, Step, StepList, StepListProps, TwoToneHeading, TwoToneHeadingProps, VerifiedChip, VerifiedChipProps } from './composites.mjs';
4
4
  export { AppShell, AppShellProps, EcosystemSlug, EcosystemSwitcher, EcosystemSwitcherProps, FAMILY_PROPERTIES, FamilyCategory, FamilyProperty, FooterColumn, FooterLink, LayoutSubHeader, LayoutSubHeaderProps, LayoutSubHeaderTag, OcAccountMenu, OcAccountMenuBuildInfo, OcAccountMenuItem, OcAccountMenuProps, OcAccountMenuSession, OcAccountMenuView, OcAccountMenuViewProps, OcAppBar, OcAppBarProps, OcDashboardHub, OcDashboardHubProps, OcDashboardShell, OcDashboardShellProps, OcDashboardTool, OcFamilyFooter, OcFamilyFooterBrand, OcFamilyFooterProps, OcLogoDropdown, OcLogoDropdownProps, OcPrimaryNav, OcPrimaryNavLink, OcPrimaryNavProps, SITE_STATE_LABEL, SiteState, findFamilyProperty } from './chrome.mjs';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { AppearanceControls, DEFAULT_OC_THEME, OC_DEFAULT_ACCENT, OC_SKIN_COOKIE, OC_THEMES, OcAppearanceMenu, OcAppearanceMenuProps, OcAurora, OcAuroraProps, OcTheme, OcThemeBridge, OcThemeId, OcThemePicker, OcThemePickerProps, OcThemeProvider, OcThemeProviderProps, accentFor, cn, getOcThemeInitScript, isKnownTheme, resolveTheme, useOcSkin } from './tokens.js';
1
+ export { AppearanceControls, DEFAULT_OC_THEME, OC_DEFAULT_ACCENT, OC_MOTION_COOKIE, OC_SKIN_COOKIE, OC_THEMES, OcAppearanceMenu, OcAppearanceMenuProps, OcAurora, OcAuroraProps, OcMotion, OcTheme, OcThemeBridge, OcThemeId, OcThemePicker, OcThemePickerProps, OcThemeProvider, OcThemeProviderProps, accentFor, cn, getOcThemeInitScript, isKnownTheme, resolveTheme, useOcMotion, 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, Checkbox, ConfirmHost, ConfirmOptions, CopyButton, CopyButtonProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, ErrorBoundary, IconBadge, IconBadgeProps, Input, Label, Modal, ModalProps, Pagination, PaginationProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PromptHost, PromptOptions, QrCode, QrCodeProps, RadioGroup, RadioGroupItem, SatsAmount, SatsAmountProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, SkeletonProps, Sparkline, SparklineProps, StatBlock, StatBlockProps, StatusPill, StatusPillProps, StatusPillSpec, StatusPillVariant, StatusTone, Surface, SurfaceProps, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeToggle, ThemeToggleLink, Toaster, Tooltip, TooltipProps, Working, WorkingPanel, WorkingProps, badgeVariants, buttonVariants, confirm, iconBadgeVariants, makeStatusPill, prompt, surfaceVariants } from './primitives.js';
3
3
  export { AccentList, AccentListItem, AccentListProps, AccentNote, AccentNoteProps, BrandBand, Callout, CalloutProps, CalloutTone, CheckList, CheckListProps, ComparisonRow, ComparisonTable, ComparisonTableProps, DataRow, DataRowProps, DefinitionItem, DefinitionList, DefinitionListProps, EmailCapture, EmailCaptureProps, EmptyState, EmptyStateCta, EmptyStateProps, Faq, FaqItem, FaqProps, FeatureCard, FeatureCardProps, HelpHint, HelpHintProps, MarketingHeading, MarketingHeadingProps, NumberedStep, NumberedStepProps, Panel, PanelProps, Section, SectionHeader, SectionHeaderProps, SectionProps, StatCard, StatCardProps, StatGrid, StatGridProps, StatItem, StatTile, Step, StepList, StepListProps, TwoToneHeading, TwoToneHeadingProps, VerifiedChip, VerifiedChipProps } from './composites.js';
4
4
  export { AppShell, AppShellProps, EcosystemSlug, EcosystemSwitcher, EcosystemSwitcherProps, FAMILY_PROPERTIES, FamilyCategory, FamilyProperty, FooterColumn, FooterLink, LayoutSubHeader, LayoutSubHeaderProps, LayoutSubHeaderTag, OcAccountMenu, OcAccountMenuBuildInfo, OcAccountMenuItem, OcAccountMenuProps, OcAccountMenuSession, OcAccountMenuView, OcAccountMenuViewProps, OcAppBar, OcAppBarProps, OcDashboardHub, OcDashboardHubProps, OcDashboardShell, OcDashboardShellProps, OcDashboardTool, OcFamilyFooter, OcFamilyFooterBrand, OcFamilyFooterProps, OcLogoDropdown, OcLogoDropdownProps, OcPrimaryNav, OcPrimaryNavLink, OcPrimaryNavProps, SITE_STATE_LABEL, SiteState, findFamilyProperty } from './chrome.js';
package/dist/index.js CHANGED
@@ -108,13 +108,18 @@ function resolveTheme(id) {
108
108
  return isKnownTheme(id) ? id : DEFAULT_OC_THEME;
109
109
  }
110
110
  var OC_SKIN_COOKIE = "oc_skin";
111
+ var OC_MOTION_COOKIE = "oc_motion";
111
112
  var BLOBS = [1, 2, 3, 4, 5];
112
113
  function OcAurora({ intensity, className }) {
113
114
  const style = intensity == null ? void 0 : { "--oc-aurora-intensity": String(intensity) };
114
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("oc-aurora", className), style, "aria-hidden": "true", children: BLOBS.map((n) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: `oc-aurora__blob oc-aurora__blob-${n}` }, n)) });
115
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("oc-aurora", className), style, "aria-hidden": "true", children: [
116
+ BLOBS.map((n) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: `oc-aurora__blob oc-aurora__blob-${n}` }, n)),
117
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oc-aurora__grain" })
118
+ ] });
115
119
  }
116
120
  var ONE_YEAR = 60 * 60 * 24 * 365;
117
121
  var ATTR = "data-oc-theme";
122
+ var MOTION_ATTR = "data-oc-motion";
118
123
  function readSkinCookie() {
119
124
  if (typeof document === "undefined") return null;
120
125
  const prefix = `${OC_SKIN_COOKIE}=`;
@@ -146,6 +151,38 @@ function applyAttr(skin) {
146
151
  if (typeof document === "undefined") return;
147
152
  document.documentElement.setAttribute(ATTR, skin);
148
153
  }
154
+ function readMotionCookie() {
155
+ if (typeof document === "undefined") return null;
156
+ const prefix = `${OC_MOTION_COOKIE}=`;
157
+ for (const part of document.cookie.split(";")) {
158
+ const trimmed = part.trim();
159
+ if (trimmed.startsWith(prefix)) {
160
+ const v = decodeURIComponent(trimmed.slice(prefix.length));
161
+ return v === "off" ? "off" : v === "on" ? "on" : null;
162
+ }
163
+ }
164
+ return null;
165
+ }
166
+ function writeMotionCookie(value) {
167
+ if (typeof document === "undefined") return;
168
+ const isLocal = location.hostname === "localhost" || location.hostname === "127.0.0.1";
169
+ const parts = [
170
+ `${OC_MOTION_COOKIE}=${encodeURIComponent(value)}`,
171
+ "Path=/",
172
+ `Max-Age=${ONE_YEAR}`,
173
+ "SameSite=Lax"
174
+ ];
175
+ if (!isLocal) {
176
+ parts.push("Domain=.ochk.io");
177
+ parts.push("Secure");
178
+ }
179
+ document.cookie = parts.join("; ");
180
+ }
181
+ function applyMotionAttr(motion) {
182
+ if (typeof document === "undefined") return;
183
+ if (motion === "off") document.documentElement.setAttribute(MOTION_ATTR, "off");
184
+ else document.documentElement.removeAttribute(MOTION_ATTR);
185
+ }
149
186
  function applySkinChrome(skin) {
150
187
  if (typeof window === "undefined") return;
151
188
  if (typeof window.__ocApplySkinChrome === "function") {
@@ -162,6 +199,7 @@ function OcThemeProvider({
162
199
  aurora = true
163
200
  }) {
164
201
  const [skin, setSkinState] = React2.useState(() => resolveTheme(defaultSkin));
202
+ const [motion, setMotionState] = React2.useState("on");
165
203
  const hydratedRef = React2.useRef(false);
166
204
  React2.useEffect(() => {
167
205
  if (hydratedRef.current) return;
@@ -170,6 +208,9 @@ function OcThemeProvider({
170
208
  applyAttr(fromCookie);
171
209
  applySkinChrome(fromCookie);
172
210
  setSkinState(fromCookie);
211
+ const motionCookie = readMotionCookie() ?? "on";
212
+ applyMotionAttr(motionCookie);
213
+ setMotionState(motionCookie);
173
214
  }, [defaultSkin]);
174
215
  React2.useEffect(() => {
175
216
  function sync() {
@@ -179,6 +220,11 @@ function OcThemeProvider({
179
220
  applySkinChrome(fromCookie);
180
221
  setSkinState(fromCookie);
181
222
  }
223
+ const motionCookie = readMotionCookie() ?? "on";
224
+ if (motionCookie !== motion) {
225
+ applyMotionAttr(motionCookie);
226
+ setMotionState(motionCookie);
227
+ }
182
228
  }
183
229
  window.addEventListener("focus", sync);
184
230
  document.addEventListener("visibilitychange", sync);
@@ -186,7 +232,7 @@ function OcThemeProvider({
186
232
  window.removeEventListener("focus", sync);
187
233
  document.removeEventListener("visibilitychange", sync);
188
234
  };
189
- }, [skin]);
235
+ }, [skin, motion]);
190
236
  const setSkin = React2.useCallback((id) => {
191
237
  const next = resolveTheme(id);
192
238
  applyAttr(next);
@@ -194,9 +240,15 @@ function OcThemeProvider({
194
240
  writeSkinCookie(next);
195
241
  setSkinState(next);
196
242
  }, []);
243
+ const setMotion = React2.useCallback((value2) => {
244
+ const next = value2 === "off" ? "off" : "on";
245
+ applyMotionAttr(next);
246
+ writeMotionCookie(next);
247
+ setMotionState(next);
248
+ }, []);
197
249
  const value = React2.useMemo(
198
- () => ({ skin, setSkin, themes: OC_THEMES }),
199
- [skin, setSkin]
250
+ () => ({ skin, setSkin, themes: OC_THEMES, motion, setMotion }),
251
+ [skin, setSkin, motion, setMotion]
200
252
  );
201
253
  return /* @__PURE__ */ jsxRuntime.jsxs(OcSkinContext.Provider, { value, children: [
202
254
  aurora !== false && /* @__PURE__ */ jsxRuntime.jsx(OcAurora, { intensity: typeof aurora === "object" ? aurora.intensity : void 0 }),
@@ -210,9 +262,13 @@ function useOcSkin() {
210
262
  }
211
263
  return ctx;
212
264
  }
265
+ function useOcMotion() {
266
+ const { motion, setMotion } = useOcSkin();
267
+ return { motion, setMotion };
268
+ }
213
269
  function getOcThemeInitScript(defaultSkin = DEFAULT_OC_THEME) {
214
270
  const accents = Object.fromEntries(OC_THEMES.map((t) => [t.id, t.accent]));
215
- return `(function(){var ACC=${JSON.stringify(accents)},DEF=${JSON.stringify(defaultSkin)},ORIG=${JSON.stringify(OC_DEFAULT_ACCENT)},fav=null;function acc(s){return ACC[s]||ACC[DEF]||ORIG;}window.__ocApplySkinChrome=function(s){try{var a=acc(s);var meta=document.querySelector('meta[name="theme-color"]');if(meta){meta.setAttribute('content',a);}var link=document.querySelector('link[rel~="icon"][type="image/svg+xml"]');if(!link){return;}var paint=function(svg){link.setAttribute('href','data:image/svg+xml,'+encodeURIComponent(svg.split(ORIG).join(a)));};if(fav!=null){paint(fav);return;}var h=link.getAttribute('href');if(!h||h.indexOf('data:')===0){return;}fetch(h).then(function(r){return r.text();}).then(function(svg){fav=svg;paint(svg);}).catch(function(){});}catch(e){}};try{var m=document.cookie.match(/(?:^|; )${OC_SKIN_COOKIE}=([^;]*)/);var s=m?decodeURIComponent(m[1]):DEF;if(!s){s=DEF;}document.documentElement.setAttribute('${ATTR}',s);window.__ocApplySkinChrome(s);}catch(e){document.documentElement.setAttribute('${ATTR}',DEF);}})();`;
271
+ return `(function(){var ACC=${JSON.stringify(accents)},DEF=${JSON.stringify(defaultSkin)},ORIG=${JSON.stringify(OC_DEFAULT_ACCENT)},fav=null;function acc(s){return ACC[s]||ACC[DEF]||ORIG;}window.__ocApplySkinChrome=function(s){try{var a=acc(s);var meta=document.querySelector('meta[name="theme-color"]');if(meta){meta.setAttribute('content',a);}var link=document.querySelector('link[rel~="icon"][type="image/svg+xml"]');if(!link){return;}var paint=function(svg){link.setAttribute('href','data:image/svg+xml,'+encodeURIComponent(svg.split(ORIG).join(a)));};if(fav!=null){paint(fav);return;}var h=link.getAttribute('href');if(!h||h.indexOf('data:')===0){return;}fetch(h).then(function(r){return r.text();}).then(function(svg){fav=svg;paint(svg);}).catch(function(){});}catch(e){}};try{var m=document.cookie.match(/(?:^|; )${OC_SKIN_COOKIE}=([^;]*)/);var s=m?decodeURIComponent(m[1]):DEF;if(!s){s=DEF;}document.documentElement.setAttribute('${ATTR}',s);window.__ocApplySkinChrome(s);}catch(e){document.documentElement.setAttribute('${ATTR}',DEF);}try{var mm=document.cookie.match(/(?:^|; )${OC_MOTION_COOKIE}=([^;]*)/);if(mm&&decodeURIComponent(mm[1])==='off'){document.documentElement.setAttribute('${MOTION_ATTR}','off');}}catch(e){}})();`;
216
272
  }
217
273
  var COOKIE = "oc_theme";
218
274
  var ALLOWED = /* @__PURE__ */ new Set(["light", "dark", "system"]);
@@ -347,10 +403,12 @@ var MODES = [
347
403
  ];
348
404
  function AppearanceControls({ className }) {
349
405
  const { skin, setSkin, themes } = useOcSkin();
406
+ const { motion, setMotion } = useOcMotion();
350
407
  const { theme, setTheme } = nextThemes.useTheme();
351
408
  const [mounted, setMounted] = React2.useState(false);
352
409
  React2.useEffect(() => setMounted(true), []);
353
410
  const activeMode = mounted ? theme ?? "system" : null;
411
+ const activeMotion = mounted ? motion : null;
354
412
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
355
413
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "label-mono text-muted-foreground px-3 pt-3 pb-2", children: "mode" }),
356
414
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-3 gap-1 px-2 pb-2", children: MODES.map(({ id, label, Icon: Icon2 }) => {
@@ -397,6 +455,32 @@ function AppearanceControls({ className }) {
397
455
  ]
398
456
  }
399
457
  ) }, t.id);
458
+ }) }),
459
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "label-mono text-muted-foreground border-t px-3 pt-3 pb-2", children: "ambient motion" }),
460
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 gap-1 px-2 pb-3", children: [
461
+ { id: "on", label: "on", Icon: lucideReact.Waves },
462
+ { id: "off", label: "off", Icon: lucideReact.Pause }
463
+ ].map(({ id, label, Icon: Icon2 }) => {
464
+ const active = activeMotion === id;
465
+ return /* @__PURE__ */ jsxRuntime.jsxs(
466
+ "button",
467
+ {
468
+ type: "button",
469
+ role: "menuitemradio",
470
+ "aria-checked": active,
471
+ "aria-label": id === "off" ? "pause ambient motion" : "ambient motion on",
472
+ onClick: () => setMotion(id),
473
+ className: cn(
474
+ "flex flex-col items-center gap-1 rounded-md border py-2 text-[11px] transition-colors",
475
+ active ? "border-primary text-foreground bg-accent" : "border-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground"
476
+ ),
477
+ children: [
478
+ /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "size-4", "aria-hidden": true }),
479
+ label
480
+ ]
481
+ },
482
+ id
483
+ );
400
484
  }) })
401
485
  ] });
402
486
  }
@@ -5042,6 +5126,7 @@ exports.MarketingHeading = MarketingHeading;
5042
5126
  exports.Modal = Modal;
5043
5127
  exports.NumberedStep = NumberedStep;
5044
5128
  exports.OC_DEFAULT_ACCENT = OC_DEFAULT_ACCENT;
5129
+ exports.OC_MOTION_COOKIE = OC_MOTION_COOKIE;
5045
5130
  exports.OC_SKIN_COOKIE = OC_SKIN_COOKIE;
5046
5131
  exports.OC_THEMES = OC_THEMES;
5047
5132
  exports.OcAccountMenu = OcAccountMenu;
@@ -5138,6 +5223,7 @@ exports.satsToUsd = satsToUsd;
5138
5223
  exports.shortenAddress = shortenAddress;
5139
5224
  exports.surfaceVariants = surfaceVariants;
5140
5225
  exports.usdToSats = usdToSats;
5226
+ exports.useOcMotion = useOcMotion;
5141
5227
  exports.useOcSkin = useOcSkin;
5142
5228
  exports.useSpotPrice = useSpotPrice;
5143
5229
  //# sourceMappingURL=index.js.map