@astryxdesign/lab 0.1.8-canary.0db5dfd → 0.1.8-canary.17d83c9
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/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +3 -9
- package/package.json +2 -2
- package/src/Drawer/Drawer.test.tsx +10 -10
- package/src/Drawer/Drawer.tsx +9 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../src/Drawer/Drawer.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AA6SlD,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC/D,iDAAiD;IACjD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAEnC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IAEpB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;IAE1C;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEvB;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAEjD;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AAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAEjD;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,OAAO,EACP,IAAY,EACZ,IAAU,EACV,KAAK,EACL,QAAe,EACf,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,+BAmQb;yBAnRe,MAAM"}
|
package/dist/Drawer/Drawer.js
CHANGED
|
@@ -40,7 +40,7 @@ import '@astryxdesign/core/theme/tokens.stylex';
|
|
|
40
40
|
import { borderVars, colorVars, durationVars, easeVars, shadowVars, spacingVars, typeScaleVars } from '@astryxdesign/core/theme/tokens.stylex';
|
|
41
41
|
import { Icon } from '@astryxdesign/core/Icon';
|
|
42
42
|
import { IconButton } from '@astryxdesign/core/IconButton';
|
|
43
|
-
import { useScrollLock } from '@astryxdesign/core/hooks';
|
|
43
|
+
import { useScrollLock, useDevWarning } from '@astryxdesign/core/hooks';
|
|
44
44
|
import { mergeProps, mergeRefs, themeProps } from '@astryxdesign/core/utils';
|
|
45
45
|
|
|
46
46
|
// =============================================================================
|
|
@@ -291,14 +291,8 @@ export function Drawer({
|
|
|
291
291
|
const collapsed = canCollapse && isCollapsed === true;
|
|
292
292
|
const showCloseButton = hasCloseButton ?? hasScrim;
|
|
293
293
|
|
|
294
|
-
// Dev warning for unsupported collapse combinations
|
|
295
|
-
|
|
296
|
-
const hasInvalidCollapse = isCollapsed != null && !canCollapse;
|
|
297
|
-
useEffect(() => {
|
|
298
|
-
if (hasInvalidCollapse) {
|
|
299
|
-
console.error('[Drawer] `isCollapsed` is only supported for non-modal drawers ' + '(hasScrim={false}) with side="start" or side="end". The prop is ' + 'ignored.');
|
|
300
|
-
}
|
|
301
|
-
}, [hasInvalidCollapse]);
|
|
294
|
+
// Dev warning for unsupported collapse combinations.
|
|
295
|
+
useDevWarning('Drawer', '`isCollapsed` is only supported for non-modal drawers ' + '(hasScrim={false}) with side="start" or side="end". The prop is ' + 'ignored.', isCollapsed != null && !canCollapse);
|
|
302
296
|
|
|
303
297
|
// Open/close the native dialog. close() is delayed so the slide-out
|
|
304
298
|
// transition can play; focus restore happens after close() because a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/lab",
|
|
3
|
-
"version": "0.1.8-canary.
|
|
3
|
+
"version": "0.1.8-canary.17d83c9",
|
|
4
4
|
"description": "Experimental Astryx components — published to npm only under the @canary dist-tag for early testing; never released as a stable (latest) version.",
|
|
5
5
|
"author": "Meta Open Source",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@stylexjs/stylex": ">=0.10.0",
|
|
48
|
-
"@astryxdesign/core": "0.1.8-canary.
|
|
48
|
+
"@astryxdesign/core": "0.1.8-canary.17d83c9",
|
|
49
49
|
"react": ">=19.0.0",
|
|
50
50
|
"react-dom": ">=19.0.0",
|
|
51
51
|
"lexical": "^0.46.0",
|
|
@@ -483,8 +483,8 @@ describe('Drawer', () => {
|
|
|
483
483
|
});
|
|
484
484
|
|
|
485
485
|
it('dev-warns and ignores isCollapsed on a modal drawer', () => {
|
|
486
|
-
const
|
|
487
|
-
.spyOn(console, '
|
|
486
|
+
const consoleWarn = vi
|
|
487
|
+
.spyOn(console, 'warn')
|
|
488
488
|
.mockImplementation(() => {});
|
|
489
489
|
try {
|
|
490
490
|
render(
|
|
@@ -497,20 +497,20 @@ describe('Drawer', () => {
|
|
|
497
497
|
Content
|
|
498
498
|
</Drawer>,
|
|
499
499
|
);
|
|
500
|
-
expect(
|
|
501
|
-
expect.stringContaining('
|
|
500
|
+
expect(consoleWarn).toHaveBeenCalledWith(
|
|
501
|
+
expect.stringContaining('Drawer:'),
|
|
502
502
|
);
|
|
503
503
|
expect(
|
|
504
504
|
screen.queryByRole('button', {name: 'Expand Inspector'}),
|
|
505
505
|
).not.toBeInTheDocument();
|
|
506
506
|
} finally {
|
|
507
|
-
|
|
507
|
+
consoleWarn.mockRestore();
|
|
508
508
|
}
|
|
509
509
|
});
|
|
510
510
|
|
|
511
511
|
it('dev-warns and ignores isCollapsed on a sheet', () => {
|
|
512
|
-
const
|
|
513
|
-
.spyOn(console, '
|
|
512
|
+
const consoleWarn = vi
|
|
513
|
+
.spyOn(console, 'warn')
|
|
514
514
|
.mockImplementation(() => {});
|
|
515
515
|
try {
|
|
516
516
|
render(
|
|
@@ -525,14 +525,14 @@ describe('Drawer', () => {
|
|
|
525
525
|
Content
|
|
526
526
|
</Drawer>,
|
|
527
527
|
);
|
|
528
|
-
expect(
|
|
529
|
-
expect.stringContaining('
|
|
528
|
+
expect(consoleWarn).toHaveBeenCalledWith(
|
|
529
|
+
expect.stringContaining('Drawer:'),
|
|
530
530
|
);
|
|
531
531
|
expect(
|
|
532
532
|
screen.queryByRole('button', {name: 'Expand Inspector'}),
|
|
533
533
|
).not.toBeInTheDocument();
|
|
534
534
|
} finally {
|
|
535
|
-
|
|
535
|
+
consoleWarn.mockRestore();
|
|
536
536
|
}
|
|
537
537
|
});
|
|
538
538
|
});
|
package/src/Drawer/Drawer.tsx
CHANGED
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
} from '@astryxdesign/core/theme/tokens.stylex';
|
|
57
57
|
import {Icon} from '@astryxdesign/core/Icon';
|
|
58
58
|
import {IconButton} from '@astryxdesign/core/IconButton';
|
|
59
|
-
import {useScrollLock} from '@astryxdesign/core/hooks';
|
|
59
|
+
import {useScrollLock, useDevWarning} from '@astryxdesign/core/hooks';
|
|
60
60
|
import {mergeProps, mergeRefs, themeProps} from '@astryxdesign/core/utils';
|
|
61
61
|
|
|
62
62
|
// =============================================================================
|
|
@@ -494,18 +494,14 @@ export function Drawer({
|
|
|
494
494
|
const collapsed = canCollapse && isCollapsed === true;
|
|
495
495
|
const showCloseButton = hasCloseButton ?? hasScrim;
|
|
496
496
|
|
|
497
|
-
// Dev warning for unsupported collapse combinations
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
'ignored.',
|
|
506
|
-
);
|
|
507
|
-
}
|
|
508
|
-
}, [hasInvalidCollapse]);
|
|
497
|
+
// Dev warning for unsupported collapse combinations.
|
|
498
|
+
useDevWarning(
|
|
499
|
+
'Drawer',
|
|
500
|
+
'`isCollapsed` is only supported for non-modal drawers ' +
|
|
501
|
+
'(hasScrim={false}) with side="start" or side="end". The prop is ' +
|
|
502
|
+
'ignored.',
|
|
503
|
+
isCollapsed != null && !canCollapse,
|
|
504
|
+
);
|
|
509
505
|
|
|
510
506
|
// Open/close the native dialog. close() is delayed so the slide-out
|
|
511
507
|
// transition can play; focus restore happens after close() because a
|