@astryxdesign/core 0.1.4-canary.fd7ab46 → 0.1.4-canary.ff77e1c

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.
@@ -100,7 +100,7 @@ export interface MobileNavProps extends Omit<BaseProps, 'title'> {
100
100
  * </MobileNav>
101
101
  * ```
102
102
  */
103
- export declare function MobileNav({ isOpen: isOpenProp, onOpenChange: onOpenChangeProp, children, header, width, side, label, 'data-testid': testId, xstyle, className: _className, style: _style, ref, }: MobileNavProps): import("react").JSX.Element;
103
+ export declare function MobileNav({ isOpen: isOpenProp, onOpenChange: onOpenChangeProp, children, header, width, side, label, 'data-testid': testId, xstyle, className, style, onClick: onClickProp, ref, ...rest }: MobileNavProps): import("react").JSX.Element;
104
104
  export declare namespace MobileNav {
105
105
  var displayName: string;
106
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MobileNav.d.ts","sourceRoot":"","sources":["../../src/MobileNav/MobileNav.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAcf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA0I5C,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAEzC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;;;OAQG;IACH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,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,SAAS,CAAC,EACxB,MAAM,EAAE,UAAU,EAClB,YAAY,EAAE,gBAAgB,EAC9B,QAAQ,EACR,MAAM,EACN,KAAW,EACX,IAAa,EACb,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,MAAM,EACN,SAAS,EACT,KAAK,EACL,OAAO,EAAE,WAAW,EACpB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,cAAc,+BA2KhB;yBA1Le,SAAS"}
@@ -33,7 +33,7 @@ import { Button } from "../Button/index.js";
33
33
  import { Icon } from "../Icon/index.js";
34
34
  import { Heading } from "../Heading/Heading.js";
35
35
  import { useAppShellMobile } from "../AppShell/AppShellMobileContext.js";
36
- import { mergeProps, mergeRefs } from "../utils/index.js";
36
+ import { mergeProps, mergeRefs, composeEventHandlers } from "../utils/index.js";
37
37
  import { themeProps } from "../utils/themeProps.js";
38
38
 
39
39
  // =============================================================================
@@ -172,9 +172,11 @@ export function MobileNav({
172
172
  label,
173
173
  'data-testid': testId,
174
174
  xstyle,
175
- className: _className,
176
- style: _style,
177
- ref
175
+ className,
176
+ style,
177
+ onClick: onClickProp,
178
+ ref,
179
+ ...rest
178
180
  }) {
179
181
  // Read from AppShell context as fallback
180
182
  const appShellMobile = useAppShellMobile();
@@ -268,13 +270,14 @@ export function MobileNav({
268
270
  const isStart = resolvedSide === 'start';
269
271
  return /*#__PURE__*/_jsxDEV("dialog", {
270
272
  ref: mergeRefs(ref, dialogRef),
273
+ ...mergeProps(themeProps('mobile-nav', {
274
+ side: resolvedSide
275
+ }), stylex.props(styles.dialog, isOpen && styles.open, styles.backdrop, isOpen && styles.backdropOpen, xstyle), className, style),
276
+ ...rest,
271
277
  "data-testid": testId,
272
278
  "aria-label": label ?? (typeof header === 'string' ? header : 'Navigation'),
273
- onClick: handleDialogClick,
279
+ onClick: composeEventHandlers(onClickProp, handleDialogClick),
274
280
  onCancel: handleCancel,
275
- ...mergeProps(themeProps('mobile-nav', {
276
- side: resolvedSide
277
- }), stylex.props(styles.dialog, isOpen && styles.open, styles.backdrop, isOpen && styles.backdropOpen, xstyle)),
278
281
  children: /*#__PURE__*/_jsxDEV("div", {
279
282
  tabIndex: -1,
280
283
  ...stylex.props(styles.drawer, dynamicStyles.width(width), isStart && styles.drawerStart, isStart && isOpen && styles.drawerStartOpen, !isStart && styles.drawerEnd, !isStart && isOpen && styles.drawerEndOpen),
@@ -1 +1 @@
1
- {"version":3,"file":"useToast.d.ts","sourceRoot":"","sources":["../../src/Toast/useToast.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAGV,WAAW,EAEZ,MAAM,SAAS,CAAC;AA8FjB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,IAAI,WAAW,CAetC"}
1
+ {"version":3,"file":"useToast.d.ts","sourceRoot":"","sources":["../../src/Toast/useToast.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAGV,WAAW,EAEZ,MAAM,SAAS,CAAC;AAsIjB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,IAAI,WAAW,CAetC"}
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { useCallback, use, useEffect, useRef } from 'react';
6
6
  import { createRoot } from 'react-dom/client';
7
+ import { dataAttr } from "../naming.js";
7
8
  import { ToastContext } from "./ToastContext.js";
8
9
  import { ToastViewport } from "./ToastViewport.js";
9
10
  import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
@@ -11,6 +12,44 @@ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
11
12
  let fallbackContext = null;
12
13
  let fallbackRoot = null;
13
14
  let fallbackWarned = false;
15
+ const ROOT_THEME_ATTRS = ['data-theme', dataAttr('theme')];
16
+
17
+ // The fallback container is a detached tree with no ThemeContext, so this
18
+ // mirrors <html>'s theme attributes onto it directly (live via
19
+ // MutationObserver) for the theme's @scope'd CSS to reach it. It's a
20
+ // lifetime-of-app singleton that's never torn down, so there's nothing to
21
+ // disconnect — this returns void.
22
+ function syncRootThemeAttrs(container) {
23
+ const sync = () => {
24
+ let mirroredMode = null;
25
+ for (const attr of ROOT_THEME_ATTRS) {
26
+ const value = document.documentElement.getAttribute(attr);
27
+ if (value == null) {
28
+ container.removeAttribute(attr);
29
+ } else {
30
+ container.setAttribute(attr, value);
31
+ if (attr === 'data-theme') {
32
+ mirroredMode = value;
33
+ }
34
+ }
35
+ }
36
+ // Pages whose built theme CSS pins color-scheme unconditionally (#3658)
37
+ // would otherwise resolve light-dark() tokens by OS preference while the
38
+ // mirrored mode above follows the app theme; the inline style wins over
39
+ // that CSS.
40
+ if (mirroredMode === 'light' || mirroredMode === 'dark') {
41
+ container.style.colorScheme = mirroredMode;
42
+ } else {
43
+ container.style.removeProperty('color-scheme');
44
+ }
45
+ };
46
+ sync();
47
+ const observer = new MutationObserver(sync);
48
+ observer.observe(document.documentElement, {
49
+ attributes: true,
50
+ attributeFilter: [...ROOT_THEME_ATTRS]
51
+ });
52
+ }
14
53
  function getFallbackContext() {
15
54
  if (fallbackContext) {
16
55
  return fallbackContext;
@@ -25,6 +64,7 @@ function getFallbackContext() {
25
64
  const container = document.createElement('div');
26
65
  container.setAttribute('data-astryx-toast-fallback', '');
27
66
  document.body.appendChild(container);
67
+ syncRootThemeAttrs(container);
28
68
  let resolveCtx;
29
69
  const ctxReady = new Promise(r => {
30
70
  resolveCtx = r;