@fluentui/react-drawer 9.5.6 → 9.5.7
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/CHANGELOG.md +12 -2
- package/dist/index.d.ts +22 -8
- package/lib/components/Drawer/Drawer.types.js.map +1 -1
- package/lib/components/Drawer/useDrawer.js +8 -6
- package/lib/components/Drawer/useDrawer.js.map +1 -1
- package/lib/components/InlineDrawer/InlineDrawer.types.js.map +1 -1
- package/lib/components/InlineDrawer/renderInlineDrawer.js +3 -4
- package/lib/components/InlineDrawer/renderInlineDrawer.js.map +1 -1
- package/lib/components/InlineDrawer/useInlineDrawer.js +31 -9
- package/lib/components/InlineDrawer/useInlineDrawer.js.map +1 -1
- package/lib/components/InlineDrawer/useInlineDrawerStyles.styles.js +4 -24
- package/lib/components/InlineDrawer/useInlineDrawerStyles.styles.js.map +1 -1
- package/lib/components/OverlayDrawer/OverlayDrawer.types.js.map +1 -1
- package/lib/components/OverlayDrawer/OverlayDrawerSurface/OverlayDrawerSurface.types.js.map +1 -1
- package/lib/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.js +0 -4
- package/lib/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.js.map +1 -1
- package/lib/components/OverlayDrawer/renderOverlayDrawer.js +0 -3
- package/lib/components/OverlayDrawer/renderOverlayDrawer.js.map +1 -1
- package/lib/components/OverlayDrawer/useOverlayDrawer.js +24 -10
- package/lib/components/OverlayDrawer/useOverlayDrawer.js.map +1 -1
- package/lib/components/OverlayDrawer/useOverlayDrawerStyles.styles.js +6 -47
- package/lib/components/OverlayDrawer/useOverlayDrawerStyles.styles.js.map +1 -1
- package/lib/e2e/DrawerShared.js.map +1 -1
- package/lib/shared/DrawerBase.types.js.map +1 -1
- package/lib/shared/drawerMotionUtils.js +24 -0
- package/lib/shared/drawerMotionUtils.js.map +1 -0
- package/lib/shared/drawerMotions.js +112 -0
- package/lib/shared/drawerMotions.js.map +1 -0
- package/lib/shared/useDrawerBaseStyles.styles.js +4 -34
- package/lib/shared/useDrawerBaseStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Drawer/Drawer.types.js.map +1 -1
- package/lib-commonjs/components/Drawer/useDrawer.js +8 -6
- package/lib-commonjs/components/Drawer/useDrawer.js.map +1 -1
- package/lib-commonjs/components/InlineDrawer/InlineDrawer.types.js.map +1 -1
- package/lib-commonjs/components/InlineDrawer/renderInlineDrawer.js +3 -4
- package/lib-commonjs/components/InlineDrawer/renderInlineDrawer.js.map +1 -1
- package/lib-commonjs/components/InlineDrawer/useInlineDrawer.js +31 -9
- package/lib-commonjs/components/InlineDrawer/useInlineDrawer.js.map +1 -1
- package/lib-commonjs/components/InlineDrawer/useInlineDrawerStyles.styles.js +3 -32
- package/lib-commonjs/components/InlineDrawer/useInlineDrawerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/OverlayDrawer/OverlayDrawer.types.js.map +1 -1
- package/lib-commonjs/components/OverlayDrawer/OverlayDrawerSurface/OverlayDrawerSurface.types.js.map +1 -1
- package/lib-commonjs/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.js +3 -15
- package/lib-commonjs/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.js.map +1 -1
- package/lib-commonjs/components/OverlayDrawer/renderOverlayDrawer.js +0 -3
- package/lib-commonjs/components/OverlayDrawer/renderOverlayDrawer.js.map +1 -1
- package/lib-commonjs/components/OverlayDrawer/useOverlayDrawer.js +24 -10
- package/lib-commonjs/components/OverlayDrawer/useOverlayDrawer.js.map +1 -1
- package/lib-commonjs/components/OverlayDrawer/useOverlayDrawerStyles.styles.js +4 -60
- package/lib-commonjs/components/OverlayDrawer/useOverlayDrawerStyles.styles.js.map +1 -1
- package/lib-commonjs/e2e/DrawerShared.js.map +1 -1
- package/lib-commonjs/shared/DrawerBase.types.js.map +1 -1
- package/lib-commonjs/shared/drawerMotionUtils.js +32 -0
- package/lib-commonjs/shared/drawerMotionUtils.js.map +1 -0
- package/lib-commonjs/shared/drawerMotions.js +127 -0
- package/lib-commonjs/shared/drawerMotions.js.map +1 -0
- package/lib-commonjs/shared/useDrawerBaseStyles.styles.js +2 -46
- package/lib-commonjs/shared/useDrawerBaseStyles.styles.js.map +1 -1
- package/package.json +3 -3
- package/lib/components/OverlayDrawer/OverlayDrawerDialog.js +0 -22
- package/lib/components/OverlayDrawer/OverlayDrawerDialog.js.map +0 -1
- package/lib-commonjs/components/OverlayDrawer/OverlayDrawerDialog.js +0 -28
- package/lib-commonjs/components/OverlayDrawer/OverlayDrawerDialog.js.map +0 -1
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { __resetStyles, __styles, mergeClasses } from '@griffel/react';
|
|
3
|
-
import { tokens } from '@fluentui/react-theme';
|
|
4
3
|
import { createFocusOutlineStyle } from '@fluentui/react-tabster';
|
|
5
|
-
import { drawerCSSVars, drawerDefaultStyles, useDrawerBaseClassNames
|
|
6
|
-
import { useMotionClassNames } from '@fluentui/react-motion-preview';
|
|
4
|
+
import { drawerCSSVars, drawerDefaultStyles, useDrawerBaseClassNames } from '../../shared/useDrawerBaseStyles.styles';
|
|
7
5
|
export const overlayDrawerClassNames = {
|
|
8
6
|
root: 'fui-OverlayDrawer',
|
|
9
7
|
backdrop: 'fui-OverlayDrawer__backdrop'
|
|
@@ -16,51 +14,15 @@ const useDrawerResetStyles = /*#__PURE__*/__resetStyles("r7dfyj8", "rmx02j7", {
|
|
|
16
14
|
s: ["@media (forced-colors: active){.r7dfyj8[data-fui-focus-visible]::after{border-top-color:Highlight;border-right-color:Highlight;border-bottom-color:Highlight;border-left-color:Highlight;}}", "@media (forced-colors: active){.rmx02j7[data-fui-focus-visible]::after{border-top-color:Highlight;border-left-color:Highlight;border-bottom-color:Highlight;border-right-color:Highlight;}}"]
|
|
17
15
|
});
|
|
18
16
|
const useDrawerRootStyles = /*#__PURE__*/__styles({
|
|
19
|
-
start: {
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
end: {
|
|
23
|
-
Bz10aip: "f1g0pcr8"
|
|
24
|
-
},
|
|
17
|
+
start: {},
|
|
18
|
+
end: {},
|
|
25
19
|
bottom: {
|
|
26
|
-
Bz10aip: "fip488n",
|
|
27
20
|
Bhzewxz: "f198g47y",
|
|
28
21
|
Bqenvij: "fub80nq",
|
|
29
22
|
a9b677: "fr97h3j"
|
|
30
23
|
}
|
|
31
24
|
}, {
|
|
32
|
-
d: [".
|
|
33
|
-
});
|
|
34
|
-
const useDrawerMotionStyles = /*#__PURE__*/__styles({
|
|
35
|
-
"default": {
|
|
36
|
-
abs64n: "fk73vx1",
|
|
37
|
-
E5pizo: "ff88big",
|
|
38
|
-
Bmy1vo4: "f1neo61",
|
|
39
|
-
Es3by: "f1ytgekk"
|
|
40
|
-
},
|
|
41
|
-
enter: {
|
|
42
|
-
abs64n: "f5p0z4x",
|
|
43
|
-
Bz10aip: "f87uvqx",
|
|
44
|
-
E5pizo: "f10nrhrw"
|
|
45
|
-
}
|
|
46
|
-
}, {
|
|
47
|
-
d: [".fk73vx1{opacity:0;}", ".ff88big{box-shadow:0px var(--colorTransparentBackground);}", ".f1neo61{transition-property:transform,box-shadow,opacity;}", ".f1ytgekk{will-change:transform,box-shadow,opacity;}", ".f5p0z4x{opacity:1;}", ".f87uvqx{transform:translate3D(0, 0, 0);}", ".f10nrhrw{box-shadow:var(--shadow64);}"]
|
|
48
|
-
});
|
|
49
|
-
/**
|
|
50
|
-
* Styles for the backdrop slot
|
|
51
|
-
*/
|
|
52
|
-
const useBackdropMotionStyles = /*#__PURE__*/__styles({
|
|
53
|
-
"default": {
|
|
54
|
-
abs64n: "fk73vx1",
|
|
55
|
-
Bmy1vo4: "f13u1uyl",
|
|
56
|
-
Bkqvd7p: "f17wnm97",
|
|
57
|
-
Es3by: "f1gqqdtu"
|
|
58
|
-
},
|
|
59
|
-
enter: {
|
|
60
|
-
abs64n: "f5p0z4x"
|
|
61
|
-
}
|
|
62
|
-
}, {
|
|
63
|
-
d: [".fk73vx1{opacity:0;}", ".f13u1uyl{transition-property:opacity;}", ".f17wnm97{transition-timing-function:var(--curveEasyEase);}", ".f1gqqdtu{will-change:opacity;}", ".f5p0z4x{opacity:1;}"]
|
|
25
|
+
d: [".f198g47y{top:auto;}", ".fub80nq{height:var(--fui-Drawer--size);}", ".fr97h3j{width:100vw;}"]
|
|
64
26
|
});
|
|
65
27
|
/**
|
|
66
28
|
* Apply styling to the OverlayDrawer slots based on the state
|
|
@@ -71,13 +33,10 @@ export const useOverlayDrawerStyles_unstable = state => {
|
|
|
71
33
|
const baseClassNames = useDrawerBaseClassNames(state);
|
|
72
34
|
const resetStyles = useDrawerResetStyles();
|
|
73
35
|
const rootStyles = useDrawerRootStyles();
|
|
74
|
-
const durationStyles = useDrawerDurationStyles();
|
|
75
|
-
const drawerMotionClassNames = useMotionClassNames(state.motion, useDrawerMotionStyles());
|
|
76
|
-
const backdropMotionClassNames = useMotionClassNames(state.motion, useBackdropMotionStyles());
|
|
77
36
|
const backdrop = state.root.backdrop;
|
|
78
|
-
state.root.className = mergeClasses(overlayDrawerClassNames.root, baseClassNames, resetStyles, rootStyles[state.position],
|
|
37
|
+
state.root.className = mergeClasses(overlayDrawerClassNames.root, baseClassNames, resetStyles, rootStyles[state.position], state.root.className);
|
|
79
38
|
if (backdrop) {
|
|
80
|
-
backdrop.className = mergeClasses(overlayDrawerClassNames.backdrop,
|
|
39
|
+
backdrop.className = mergeClasses(overlayDrawerClassNames.backdrop, backdrop.className);
|
|
81
40
|
}
|
|
82
41
|
return state;
|
|
83
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","__resetStyles","__styles","mergeClasses","
|
|
1
|
+
{"version":3,"names":["React","__resetStyles","__styles","mergeClasses","createFocusOutlineStyle","drawerCSSVars","drawerDefaultStyles","useDrawerBaseClassNames","overlayDrawerClassNames","root","backdrop","useDrawerResetStyles","r","s","useDrawerRootStyles","start","end","bottom","Bhzewxz","Bqenvij","a9b677","d","useOverlayDrawerStyles_unstable","state","baseClassNames","resetStyles","rootStyles","className","position"],"sources":["useOverlayDrawerStyles.styles.js"],"sourcesContent":["import * as React from 'react';\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { drawerCSSVars, drawerDefaultStyles, useDrawerBaseClassNames } from '../../shared/useDrawerBaseStyles.styles';\nexport const overlayDrawerClassNames = {\n root: 'fui-OverlayDrawer',\n backdrop: 'fui-OverlayDrawer__backdrop'\n};\n/**\n * Styles for the root slot\n */ const useDrawerResetStyles = makeResetStyles({\n ...createFocusOutlineStyle(),\n ...drawerDefaultStyles,\n position: 'fixed',\n top: 0,\n bottom: 0\n});\nconst useDrawerRootStyles = makeStyles({\n /* Positioning */ start: {},\n end: {},\n bottom: {\n top: 'auto',\n height: `var(${drawerCSSVars.drawerSizeVar})`,\n width: '100vw'\n }\n});\n/**\n * Apply styling to the OverlayDrawer slots based on the state\n */ export const useOverlayDrawerStyles_unstable = (state)=>{\n 'use no memo';\n const baseClassNames = useDrawerBaseClassNames(state);\n const resetStyles = useDrawerResetStyles();\n const rootStyles = useDrawerRootStyles();\n const backdrop = state.root.backdrop;\n state.root.className = mergeClasses(overlayDrawerClassNames.root, baseClassNames, resetStyles, rootStyles[state.position], state.root.className);\n if (backdrop) {\n backdrop.className = mergeClasses(overlayDrawerClassNames.backdrop, backdrop.className);\n }\n return state;\n};\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAAAC,aAAA,EAAAC,QAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,SAASC,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,aAAa,EAAEC,mBAAmB,EAAEC,uBAAuB,QAAQ,yCAAyC;AACrH,OAAO,MAAMC,uBAAuB,GAAG;EACnCC,IAAI,EAAE,mBAAmB;EACzBC,QAAQ,EAAE;AACd,CAAC;AACD;AACA;AACA;AAAI,MAAMC,oBAAoB,gBAAGV,aAAA;EAAAW,CAAA;EAAAC,CAAA;AAAA,CAMhC,CAAC;AACF,MAAMC,mBAAmB,gBAAGZ,QAAA;EAAAa,KAAA;EAAAC,GAAA;EAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAQ3B,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,+BAA+B,GAAIC,KAAK,IAAG;EACxD,aAAa;;EACb,MAAMC,cAAc,GAAGjB,uBAAuB,CAACgB,KAAK,CAAC;EACrD,MAAME,WAAW,GAAGd,oBAAoB,CAAC,CAAC;EAC1C,MAAMe,UAAU,GAAGZ,mBAAmB,CAAC,CAAC;EACxC,MAAMJ,QAAQ,GAAGa,KAAK,CAACd,IAAI,CAACC,QAAQ;EACpCa,KAAK,CAACd,IAAI,CAACkB,SAAS,GAAGxB,YAAY,CAACK,uBAAuB,CAACC,IAAI,EAAEe,cAAc,EAAEC,WAAW,EAAEC,UAAU,CAACH,KAAK,CAACK,QAAQ,CAAC,EAAEL,KAAK,CAACd,IAAI,CAACkB,SAAS,CAAC;EAChJ,IAAIjB,QAAQ,EAAE;IACVA,QAAQ,CAACiB,SAAS,GAAGxB,YAAY,CAACK,uBAAuB,CAACE,QAAQ,EAAEA,QAAQ,CAACiB,SAAS,CAAC;EAC3F;EACA,OAAOJ,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DrawerShared.tsx"],"sourcesContent":["import * as React from 'react';\nimport { mount } from '@cypress/react';\nimport { FluentProvider } from '@fluentui/react-provider';\nimport { webLightTheme } from '@fluentui/react-theme';\n\nimport
|
|
1
|
+
{"version":3,"sources":["DrawerShared.tsx"],"sourcesContent":["import * as React from 'react';\nimport { mount } from '@cypress/react';\nimport { FluentProvider } from '@fluentui/react-provider';\nimport { webLightTheme } from '@fluentui/react-theme';\n\nimport { InlineDrawer } from '../components/InlineDrawer';\nimport { OverlayDrawer } from '../components/OverlayDrawer';\nimport { Drawer, DrawerProps } from '../Drawer';\n\nconst mountFluent = (element: JSX.Element) => {\n mount(<FluentProvider theme={webLightTheme}>{element}</FluentProvider>);\n};\n\nexport function testDrawerBaseScenarios(Component: typeof Drawer | typeof OverlayDrawer | typeof InlineDrawer) {\n describe('basic functionality', () => {\n it('should not render any element when closed', () => {\n mountFluent(<Component id=\"drawer\" />);\n\n cy.get('#drawer').should('not.exist');\n });\n\n it('should render an element when opened', () => {\n mountFluent(<Component id=\"drawer\" open />);\n\n cy.get('#drawer').should('exist');\n });\n\n it('should render children content', () => {\n const content = 'Test the renderization';\n mountFluent(\n <Component id=\"drawer\" open>\n {content}\n </Component>,\n );\n\n cy.get('#drawer').contains(content);\n });\n\n it('should toggle visibility on open prop change', () => {\n const ExampleDrawer = () => {\n const [open, setOpen] = React.useState(false);\n\n return (\n <>\n <Component id=\"drawer\" open={open} />\n <button id=\"button\" onClick={() => setOpen(true)}>\n Open\n </button>\n </>\n );\n };\n\n mountFluent(<ExampleDrawer />);\n\n cy.get('#drawer').should('not.exist');\n cy.get('#button').click();\n cy.get('#drawer').should('exist');\n });\n });\n\n describe('size prop', () => {\n const sizes = {\n small: 320,\n medium: 592,\n large: 940,\n full: 1000,\n };\n\n Object.entries(sizes).forEach(([size, width]) => {\n const sizeProp = size as DrawerProps['size'];\n\n it(`should have correct size when size is ${size}`, () => {\n mountFluent(<Component size={sizeProp} id=\"drawer\" open />);\n\n cy.viewport(1000, 1000);\n cy.get('#drawer').should('have.css', 'width', width + 'px');\n cy.get('#drawer').invoke('outerWidth').should('equal', width);\n });\n });\n\n it('width should not be bigger than viewport', () => {\n mountFluent(<Component id=\"drawer\" open />);\n\n cy.viewport(319, 319);\n cy.get('#drawer').should('have.css', 'width', '319px');\n cy.get('#drawer').invoke('outerWidth').should('equal', 319);\n });\n\n it('should have custom size', () => {\n mountFluent(<Component id=\"drawer\" open style={{ width: '200px' }} />);\n\n cy.get('#drawer').should('have.css', 'width', '200px');\n cy.get('#drawer').invoke('outerWidth').should('equal', 200);\n });\n });\n\n describe('position prop', () => {\n const positions = {\n start: 'left',\n end: 'right',\n bottom: 'bottom',\n };\n\n Object.entries(positions).forEach(([position, side]) => {\n const positionProp = position as DrawerProps['position'];\n\n it(`should have correct position when position is ${position}`, () => {\n mountFluent(<Component position={positionProp} id=\"drawer\" open />);\n\n cy.get('#drawer').should('have.css', side, '0px');\n });\n });\n });\n}\n"],"names":["React","mount","FluentProvider","webLightTheme","mountFluent","element","theme","testDrawerBaseScenarios","Component","describe","it","id","cy","get","should","open","content","contains","ExampleDrawer","setOpen","useState","button","onClick","click","sizes","small","medium","large","full","Object","entries","forEach","size","width","sizeProp","viewport","invoke","style","positions","start","end","bottom","position","side","positionProp"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,cAAc,QAAQ,2BAA2B;AAC1D,SAASC,aAAa,QAAQ,wBAAwB;AAMtD,MAAMC,cAAc,CAACC;IACnBJ,oBAAM,oBAACC;QAAeI,OAAOH;OAAgBE;AAC/C;AAEA,OAAO,SAASE,wBAAwBC,SAAqE;IAC3GC,SAAS,uBAAuB;QAC9BC,GAAG,6CAA6C;YAC9CN,0BAAY,oBAACI;gBAAUG,IAAG;;YAE1BC,GAAGC,GAAG,CAAC,WAAWC,MAAM,CAAC;QAC3B;QAEAJ,GAAG,wCAAwC;YACzCN,0BAAY,oBAACI;gBAAUG,IAAG;gBAASI,MAAAA;;YAEnCH,GAAGC,GAAG,CAAC,WAAWC,MAAM,CAAC;QAC3B;QAEAJ,GAAG,kCAAkC;YACnC,MAAMM,UAAU;YAChBZ,0BACE,oBAACI;gBAAUG,IAAG;gBAASI,MAAAA;eACpBC;YAILJ,GAAGC,GAAG,CAAC,WAAWI,QAAQ,CAACD;QAC7B;QAEAN,GAAG,gDAAgD;YACjD,MAAMQ,gBAAgB;gBACpB,MAAM,CAACH,MAAMI,QAAQ,GAAGnB,MAAMoB,QAAQ,CAAC;gBAEvC,qBACE,wDACE,oBAACZ;oBAAUG,IAAG;oBAASI,MAAMA;kCAC7B,oBAACM;oBAAOV,IAAG;oBAASW,SAAS,IAAMH,QAAQ;mBAAO;YAKxD;YAEAf,0BAAY,oBAACc;YAEbN,GAAGC,GAAG,CAAC,WAAWC,MAAM,CAAC;YACzBF,GAAGC,GAAG,CAAC,WAAWU,KAAK;YACvBX,GAAGC,GAAG,CAAC,WAAWC,MAAM,CAAC;QAC3B;IACF;IAEAL,SAAS,aAAa;QACpB,MAAMe,QAAQ;YACZC,OAAO;YACPC,QAAQ;YACRC,OAAO;YACPC,MAAM;QACR;QAEAC,OAAOC,OAAO,CAACN,OAAOO,OAAO,CAAC,CAAC,CAACC,MAAMC,MAAM;YAC1C,MAAMC,WAAWF;YAEjBtB,GAAG,CAAC,sCAAsC,EAAEsB,KAAK,CAAC,EAAE;gBAClD5B,0BAAY,oBAACI;oBAAUwB,MAAME;oBAAUvB,IAAG;oBAASI,MAAAA;;gBAEnDH,GAAGuB,QAAQ,CAAC,MAAM;gBAClBvB,GAAGC,GAAG,CAAC,WAAWC,MAAM,CAAC,YAAY,SAASmB,QAAQ;gBACtDrB,GAAGC,GAAG,CAAC,WAAWuB,MAAM,CAAC,cAActB,MAAM,CAAC,SAASmB;YACzD;QACF;QAEAvB,GAAG,4CAA4C;YAC7CN,0BAAY,oBAACI;gBAAUG,IAAG;gBAASI,MAAAA;;YAEnCH,GAAGuB,QAAQ,CAAC,KAAK;YACjBvB,GAAGC,GAAG,CAAC,WAAWC,MAAM,CAAC,YAAY,SAAS;YAC9CF,GAAGC,GAAG,CAAC,WAAWuB,MAAM,CAAC,cAActB,MAAM,CAAC,SAAS;QACzD;QAEAJ,GAAG,2BAA2B;YAC5BN,0BAAY,oBAACI;gBAAUG,IAAG;gBAASI,MAAAA;gBAAKsB,OAAO;oBAAEJ,OAAO;gBAAQ;;YAEhErB,GAAGC,GAAG,CAAC,WAAWC,MAAM,CAAC,YAAY,SAAS;YAC9CF,GAAGC,GAAG,CAAC,WAAWuB,MAAM,CAAC,cAActB,MAAM,CAAC,SAAS;QACzD;IACF;IAEAL,SAAS,iBAAiB;QACxB,MAAM6B,YAAY;YAChBC,OAAO;YACPC,KAAK;YACLC,QAAQ;QACV;QAEAZ,OAAOC,OAAO,CAACQ,WAAWP,OAAO,CAAC,CAAC,CAACW,UAAUC,KAAK;YACjD,MAAMC,eAAeF;YAErBhC,GAAG,CAAC,8CAA8C,EAAEgC,SAAS,CAAC,EAAE;gBAC9DtC,0BAAY,oBAACI;oBAAUkC,UAAUE;oBAAcjC,IAAG;oBAASI,MAAAA;;gBAE3DH,GAAGC,GAAG,CAAC,WAAWC,MAAM,CAAC,YAAY6B,MAAM;YAC7C;QACF;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DrawerBase.types.ts"],"sourcesContent":["import * as React from 'react';\n\ntype MotionType = 'entering' | 'entered' | 'idle' | 'exiting' | 'exited' | 'unmounted';\n\ntype MotionState<Element extends HTMLElement = HTMLElement> = {\n /**\n * Ref to the element.\n */\n ref: React.Ref<Element>;\n\n /**\n * Current state of the element.\n *\n * - `unmounted` - The element is not yet rendered or can be safely removed from the DOM.\n * - `entering` - The element is performing enter animation.\n * - `entered` - The element has finished enter animation.\n * - `idle` - The element is currently not animating, but rendered on screen.\n * - `exiting` - The element is performing exit animation.\n * - `exited` - The element has finished exit animation.\n */\n type: MotionType;\n\n /**\n * Indicates whether the component can be rendered.\n * Useful to render the element before animating it or to remove it from the DOM after exit animation.\n */\n canRender: boolean;\n\n /**\n * Indicates whether the component is ready to receive a CSS transition className.\n * Useful to apply CSS transitions when the element is mounted and ready to be animated.\n */\n active: boolean;\n};\n\nexport type DrawerBaseProps = {\n /**\n * Position of the drawer.\n *\n * Note: 'bottom' does not supports size, but it supports customized height.\n *\n * @default 'start'\n */\n position?: 'start' | 'end' | 'bottom';\n\n /**\n * Size of the drawer.\n *\n * - 'small' - Drawer is 320px wide.\n * - 'medium' - Drawer is 592px wide.\n * - 'large' - Drawer is 940px wide.\n * - 'full' - Drawer is 100vw wide.\n *\n * @default 'small'\n */\n size?: 'small' | 'medium' | 'large' | 'full';\n\n /**\n * Controls the open state of the Drawer\n *\n * @default false\n */\n open?: boolean;\n};\n\nexport type DrawerBaseState = Required<Pick<DrawerBaseProps, 'position' | 'size'>> & {\n motion: MotionState<HTMLElement>;\n};\n\nexport type DrawerScrollState = 'none' | 'top' | 'middle' | 'bottom';\n"],"names":["React"],"rangeMappings":"","mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
1
|
+
{"version":3,"sources":["DrawerBase.types.ts"],"sourcesContent":["import * as React from 'react';\n\ntype MotionType = 'entering' | 'entered' | 'idle' | 'exiting' | 'exited' | 'unmounted';\n\ntype MotionState<Element extends HTMLElement = HTMLElement> = {\n /**\n * Ref to the element.\n */\n ref: React.Ref<Element>;\n\n /**\n * Current state of the element.\n *\n * - `unmounted` - The element is not yet rendered or can be safely removed from the DOM.\n * - `entering` - The element is performing enter animation.\n * - `entered` - The element has finished enter animation.\n * - `idle` - The element is currently not animating, but rendered on screen.\n * - `exiting` - The element is performing exit animation.\n * - `exited` - The element has finished exit animation.\n */\n type: MotionType;\n\n /**\n * Indicates whether the component can be rendered.\n * Useful to render the element before animating it or to remove it from the DOM after exit animation.\n */\n canRender: boolean;\n\n /**\n * Indicates whether the component is ready to receive a CSS transition className.\n * Useful to apply CSS transitions when the element is mounted and ready to be animated.\n */\n active: boolean;\n};\n\nexport type DrawerBaseProps = {\n /**\n * Position of the drawer.\n *\n * Note: 'bottom' does not supports size, but it supports customized height.\n *\n * @default 'start'\n */\n position?: 'start' | 'end' | 'bottom';\n\n /**\n * Size of the drawer.\n *\n * - 'small' - Drawer is 320px wide.\n * - 'medium' - Drawer is 592px wide.\n * - 'large' - Drawer is 940px wide.\n * - 'full' - Drawer is 100vw wide.\n *\n * @default 'small'\n */\n size?: 'small' | 'medium' | 'large' | 'full';\n\n /**\n * Controls the open state of the Drawer\n *\n * @default false\n */\n open?: boolean;\n};\n\nexport type DrawerBaseState = Required<Pick<DrawerBaseProps, 'position' | 'size'>> & {\n /**\n * @deprecated Passed values will be static.\n */\n motion: MotionState<HTMLElement>;\n\n open?: boolean;\n};\n\nexport type DrawerScrollState = 'none' | 'top' | 'middle' | 'bottom';\n"],"names":["React"],"rangeMappings":"","mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* @todo Drawer is a first component to use this pattern, we should move this to a shared package if it will be used in more components
|
|
5
|
+
*/ export function mergePresenceSlots(inputSlot, Component, params) {
|
|
6
|
+
if (inputSlot === null) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
...inputSlot,
|
|
11
|
+
children: (_, props)=>{
|
|
12
|
+
if (inputSlot === null || inputSlot === void 0 ? void 0 : inputSlot.children) {
|
|
13
|
+
return inputSlot.children(Component, {
|
|
14
|
+
...props,
|
|
15
|
+
...params
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return /*#__PURE__*/ React.createElement(Component, {
|
|
19
|
+
...props,
|
|
20
|
+
...params
|
|
21
|
+
}, props.children);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["drawerMotionUtils.tsx"],"sourcesContent":["import type { PresenceComponent, PresenceMotionSlotProps } from '@fluentui/react-motion';\nimport * as React from 'react';\n\ntype SerializableObject = Record<string, string | boolean | number>;\n\n/**\n * @internal\n * @todo Drawer is a first component to use this pattern, we should move this to a shared package if it will be used in more components\n */\nexport function mergePresenceSlots<\n BaseMotionParams extends SerializableObject = {},\n EnhancedMotionParams extends SerializableObject = {},\n>(\n inputSlot: PresenceMotionSlotProps<EnhancedMotionParams> | null | undefined,\n Component: PresenceComponent<EnhancedMotionParams>,\n params: EnhancedMotionParams,\n): PresenceMotionSlotProps<BaseMotionParams> | null {\n if (inputSlot === null) {\n return null;\n }\n\n return {\n ...inputSlot,\n children: (_, props) => {\n if (inputSlot?.children) {\n return inputSlot.children(Component, { ...props, ...params });\n }\n\n return (\n <Component {...props} {...params}>\n {props.children}\n </Component>\n );\n },\n };\n}\n"],"names":["React","mergePresenceSlots","inputSlot","Component","params","children","_","props"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":"AACA,YAAYA,WAAW,QAAQ;AAI/B;;;CAGC,GACD,OAAO,SAASC,mBAIdC,SAA2E,EAC3EC,SAAkD,EAClDC,MAA4B;IAE5B,IAAIF,cAAc,MAAM;QACtB,OAAO;IACT;IAEA,OAAO;QACL,GAAGA,SAAS;QACZG,UAAU,CAACC,GAAGC;YACZ,IAAIL,sBAAAA,gCAAAA,UAAWG,QAAQ,EAAE;gBACvB,OAAOH,UAAUG,QAAQ,CAACF,WAAW;oBAAE,GAAGI,KAAK;oBAAE,GAAGH,MAAM;gBAAC;YAC7D;YAEA,qBACE,oBAACD;gBAAW,GAAGI,KAAK;gBAAG,GAAGH,MAAM;eAC7BG,MAAMF,QAAQ;QAGrB;IACF;AACF"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createPresenceComponent, motionTokens } from '@fluentui/react-motion';
|
|
2
|
+
import { tokens } from '@fluentui/react-theme';
|
|
3
|
+
import { drawerCSSVars } from './useDrawerBaseStyles.styles';
|
|
4
|
+
const durations = {
|
|
5
|
+
small: motionTokens.durationGentle,
|
|
6
|
+
medium: motionTokens.durationSlow,
|
|
7
|
+
large: motionTokens.durationSlower,
|
|
8
|
+
full: motionTokens.durationUltraSlow
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/ export const InlineDrawerMotion = createPresenceComponent(({ position, size })=>{
|
|
13
|
+
const keyframes = [
|
|
14
|
+
{
|
|
15
|
+
...position === 'start' && {
|
|
16
|
+
transform: `translate3d(calc(var(${drawerCSSVars.drawerSizeVar}) * -1), 0, 0)`
|
|
17
|
+
},
|
|
18
|
+
...position === 'end' && {
|
|
19
|
+
transform: `translate3d(var(${drawerCSSVars.drawerSizeVar}), 0, 0)`
|
|
20
|
+
},
|
|
21
|
+
...position === 'bottom' && {
|
|
22
|
+
transform: `translate3d(0, var(${drawerCSSVars.drawerSizeVar}), 0)`
|
|
23
|
+
},
|
|
24
|
+
opacity: 0
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
transform: 'translate3d(0, 0, 0)',
|
|
28
|
+
opacity: 1
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
const duration = durations[size];
|
|
32
|
+
return {
|
|
33
|
+
enter: {
|
|
34
|
+
keyframes,
|
|
35
|
+
duration,
|
|
36
|
+
easing: motionTokens.curveDecelerateMid
|
|
37
|
+
},
|
|
38
|
+
exit: {
|
|
39
|
+
keyframes: [
|
|
40
|
+
...keyframes
|
|
41
|
+
].reverse(),
|
|
42
|
+
duration,
|
|
43
|
+
easing: motionTokens.curveAccelerateMin
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
*/ export const OverlayDrawerMotion = createPresenceComponent(({ position, size })=>{
|
|
50
|
+
const keyframes = [
|
|
51
|
+
{
|
|
52
|
+
...position === 'start' && {
|
|
53
|
+
transform: `translate3D(calc(var(${drawerCSSVars.drawerSizeVar}) * -1), 0, 0)`
|
|
54
|
+
},
|
|
55
|
+
...position === 'end' && {
|
|
56
|
+
transform: `translate3d(calc(var(${drawerCSSVars.drawerSizeVar}) * 1), 0, 0)`
|
|
57
|
+
},
|
|
58
|
+
...position === 'bottom' && {
|
|
59
|
+
transform: `translate3d(0, calc(var(${drawerCSSVars.drawerSizeVar}) * 1), 0)`
|
|
60
|
+
},
|
|
61
|
+
boxShadow: `0px ${tokens.colorTransparentBackground}`,
|
|
62
|
+
opacity: 0
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
transform: 'translate3d(0, 0, 0)',
|
|
66
|
+
boxShadow: tokens.shadow64,
|
|
67
|
+
opacity: 1
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
const duration = durations[size];
|
|
71
|
+
return {
|
|
72
|
+
enter: {
|
|
73
|
+
keyframes,
|
|
74
|
+
duration,
|
|
75
|
+
easing: motionTokens.curveDecelerateMid
|
|
76
|
+
},
|
|
77
|
+
exit: {
|
|
78
|
+
keyframes: [
|
|
79
|
+
...keyframes
|
|
80
|
+
].reverse(),
|
|
81
|
+
duration,
|
|
82
|
+
easing: motionTokens.curveAccelerateMin
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* @internal
|
|
88
|
+
*/ export const OverlaySurfaceBackdropMotion = createPresenceComponent(({ size })=>{
|
|
89
|
+
const keyframes = [
|
|
90
|
+
{
|
|
91
|
+
opacity: 0
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
opacity: 1
|
|
95
|
+
}
|
|
96
|
+
];
|
|
97
|
+
const duration = durations[size];
|
|
98
|
+
return {
|
|
99
|
+
enter: {
|
|
100
|
+
keyframes,
|
|
101
|
+
easing: motionTokens.curveLinear,
|
|
102
|
+
duration
|
|
103
|
+
},
|
|
104
|
+
exit: {
|
|
105
|
+
keyframes: [
|
|
106
|
+
...keyframes
|
|
107
|
+
].reverse(),
|
|
108
|
+
easing: motionTokens.curveLinear,
|
|
109
|
+
duration
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["drawerMotions.ts"],"sourcesContent":["import { createPresenceComponent, motionTokens } from '@fluentui/react-motion';\nimport { tokens } from '@fluentui/react-theme';\n\nimport type { DrawerBaseProps } from './DrawerBase.types';\nimport { drawerCSSVars } from './useDrawerBaseStyles.styles';\n\nexport type DrawerMotionParams = Required<Pick<DrawerBaseProps, 'size' | 'position'>>;\nexport type OverlayDrawerSurfaceMotionParams = Required<Pick<DrawerBaseProps, 'size'>>;\n\nconst durations: Record<NonNullable<DrawerBaseProps['size']>, number> = {\n small: motionTokens.durationGentle,\n medium: motionTokens.durationSlow,\n large: motionTokens.durationSlower,\n full: motionTokens.durationUltraSlow,\n};\n\n/**\n * @internal\n */\nexport const InlineDrawerMotion = createPresenceComponent<DrawerMotionParams>(({ position, size }) => {\n const keyframes: Keyframe[] = [\n {\n ...(position === 'start' && {\n transform: `translate3d(calc(var(${drawerCSSVars.drawerSizeVar}) * -1), 0, 0)`,\n }),\n ...(position === 'end' && {\n transform: `translate3d(var(${drawerCSSVars.drawerSizeVar}), 0, 0)`,\n }),\n ...(position === 'bottom' && {\n transform: `translate3d(0, var(${drawerCSSVars.drawerSizeVar}), 0)`,\n }),\n\n opacity: 0,\n },\n { transform: 'translate3d(0, 0, 0)', opacity: 1 },\n ];\n const duration = durations[size];\n\n return {\n enter: {\n keyframes,\n duration,\n easing: motionTokens.curveDecelerateMid,\n },\n exit: {\n keyframes: [...keyframes].reverse(),\n duration,\n easing: motionTokens.curveAccelerateMin,\n },\n };\n});\n\n/**\n * @internal\n */\nexport const OverlayDrawerMotion = createPresenceComponent<DrawerMotionParams>(({ position, size }) => {\n const keyframes: Keyframe[] = [\n {\n ...(position === 'start' && {\n transform: `translate3D(calc(var(${drawerCSSVars.drawerSizeVar}) * -1), 0, 0)`,\n }),\n ...(position === 'end' && {\n transform: `translate3d(calc(var(${drawerCSSVars.drawerSizeVar}) * 1), 0, 0)`,\n }),\n ...(position === 'bottom' && {\n transform: `translate3d(0, calc(var(${drawerCSSVars.drawerSizeVar}) * 1), 0)`,\n }),\n\n boxShadow: `0px ${tokens.colorTransparentBackground}`,\n opacity: 0,\n },\n {\n transform: 'translate3d(0, 0, 0)',\n boxShadow: tokens.shadow64,\n opacity: 1,\n },\n ];\n const duration = durations[size];\n\n return {\n enter: {\n keyframes,\n duration,\n easing: motionTokens.curveDecelerateMid,\n },\n exit: {\n keyframes: [...keyframes].reverse(),\n duration,\n easing: motionTokens.curveAccelerateMin,\n },\n };\n});\n\n/**\n * @internal\n */\nexport const OverlaySurfaceBackdropMotion = createPresenceComponent(({ size }: OverlayDrawerSurfaceMotionParams) => {\n const keyframes = [{ opacity: 0 }, { opacity: 1 }];\n const duration = durations[size];\n\n return {\n enter: {\n keyframes,\n easing: motionTokens.curveLinear,\n duration,\n },\n exit: {\n keyframes: [...keyframes].reverse(),\n easing: motionTokens.curveLinear,\n duration,\n },\n };\n});\n"],"names":["createPresenceComponent","motionTokens","tokens","drawerCSSVars","durations","small","durationGentle","medium","durationSlow","large","durationSlower","full","durationUltraSlow","InlineDrawerMotion","position","size","keyframes","transform","drawerSizeVar","opacity","duration","enter","easing","curveDecelerateMid","exit","reverse","curveAccelerateMin","OverlayDrawerMotion","boxShadow","colorTransparentBackground","shadow64","OverlaySurfaceBackdropMotion","curveLinear"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,uBAAuB,EAAEC,YAAY,QAAQ,yBAAyB;AAC/E,SAASC,MAAM,QAAQ,wBAAwB;AAG/C,SAASC,aAAa,QAAQ,+BAA+B;AAK7D,MAAMC,YAAkE;IACtEC,OAAOJ,aAAaK,cAAc;IAClCC,QAAQN,aAAaO,YAAY;IACjCC,OAAOR,aAAaS,cAAc;IAClCC,MAAMV,aAAaW,iBAAiB;AACtC;AAEA;;CAEC,GACD,OAAO,MAAMC,qBAAqBb,wBAA4C,CAAC,EAAEc,QAAQ,EAAEC,IAAI,EAAE;IAC/F,MAAMC,YAAwB;QAC5B;YACE,GAAIF,aAAa,WAAW;gBAC1BG,WAAW,CAAC,qBAAqB,EAAEd,cAAce,aAAa,CAAC,cAAc,CAAC;YAChF,CAAC;YACD,GAAIJ,aAAa,SAAS;gBACxBG,WAAW,CAAC,gBAAgB,EAAEd,cAAce,aAAa,CAAC,QAAQ,CAAC;YACrE,CAAC;YACD,GAAIJ,aAAa,YAAY;gBAC3BG,WAAW,CAAC,mBAAmB,EAAEd,cAAce,aAAa,CAAC,KAAK,CAAC;YACrE,CAAC;YAEDC,SAAS;QACX;QACA;YAAEF,WAAW;YAAwBE,SAAS;QAAE;KACjD;IACD,MAAMC,WAAWhB,SAAS,CAACW,KAAK;IAEhC,OAAO;QACLM,OAAO;YACLL;YACAI;YACAE,QAAQrB,aAAasB,kBAAkB;QACzC;QACAC,MAAM;YACJR,WAAW;mBAAIA;aAAU,CAACS,OAAO;YACjCL;YACAE,QAAQrB,aAAayB,kBAAkB;QACzC;IACF;AACF,GAAG;AAEH;;CAEC,GACD,OAAO,MAAMC,sBAAsB3B,wBAA4C,CAAC,EAAEc,QAAQ,EAAEC,IAAI,EAAE;IAChG,MAAMC,YAAwB;QAC5B;YACE,GAAIF,aAAa,WAAW;gBAC1BG,WAAW,CAAC,qBAAqB,EAAEd,cAAce,aAAa,CAAC,cAAc,CAAC;YAChF,CAAC;YACD,GAAIJ,aAAa,SAAS;gBACxBG,WAAW,CAAC,qBAAqB,EAAEd,cAAce,aAAa,CAAC,aAAa,CAAC;YAC/E,CAAC;YACD,GAAIJ,aAAa,YAAY;gBAC3BG,WAAW,CAAC,wBAAwB,EAAEd,cAAce,aAAa,CAAC,UAAU,CAAC;YAC/E,CAAC;YAEDU,WAAW,CAAC,IAAI,EAAE1B,OAAO2B,0BAA0B,CAAC,CAAC;YACrDV,SAAS;QACX;QACA;YACEF,WAAW;YACXW,WAAW1B,OAAO4B,QAAQ;YAC1BX,SAAS;QACX;KACD;IACD,MAAMC,WAAWhB,SAAS,CAACW,KAAK;IAEhC,OAAO;QACLM,OAAO;YACLL;YACAI;YACAE,QAAQrB,aAAasB,kBAAkB;QACzC;QACAC,MAAM;YACJR,WAAW;mBAAIA;aAAU,CAACS,OAAO;YACjCL;YACAE,QAAQrB,aAAayB,kBAAkB;QACzC;IACF;AACF,GAAG;AAEH;;CAEC,GACD,OAAO,MAAMK,+BAA+B/B,wBAAwB,CAAC,EAAEe,IAAI,EAAoC;IAC7G,MAAMC,YAAY;QAAC;YAAEG,SAAS;QAAE;QAAG;YAAEA,SAAS;QAAE;KAAE;IAClD,MAAMC,WAAWhB,SAAS,CAACW,KAAK;IAEhC,OAAO;QACLM,OAAO;YACLL;YACAM,QAAQrB,aAAa+B,WAAW;YAChCZ;QACF;QACAI,MAAM;YACJR,WAAW;mBAAIA;aAAU,CAACS,OAAO;YACjCH,QAAQrB,aAAa+B,WAAW;YAChCZ;QACF;IACF;AACF,GAAG"}
|
|
@@ -27,15 +27,6 @@ export const drawerDefaultStyles = {
|
|
|
27
27
|
* Shared dynamic styles for the Drawer component
|
|
28
28
|
*/
|
|
29
29
|
const useDrawerStyles = /*#__PURE__*/__styles({
|
|
30
|
-
entering: {
|
|
31
|
-
Bkqvd7p: "f18ad807"
|
|
32
|
-
},
|
|
33
|
-
exiting: {
|
|
34
|
-
Bkqvd7p: "f1mfizis"
|
|
35
|
-
},
|
|
36
|
-
reducedMotion: {
|
|
37
|
-
Hwfdqs: "f5e8c63"
|
|
38
|
-
},
|
|
39
30
|
start: {
|
|
40
31
|
h3c5rm: 0,
|
|
41
32
|
vrafjx: 0,
|
|
@@ -69,7 +60,7 @@ const useDrawerStyles = /*#__PURE__*/__styles({
|
|
|
69
60
|
Bjr0ffy: "fsdmzs6"
|
|
70
61
|
}
|
|
71
62
|
}, {
|
|
72
|
-
d: [
|
|
63
|
+
d: [[".f1xteiwb{border-right:var(--strokeWidthThin) solid var(--colorTransparentStroke);}", {
|
|
73
64
|
p: -1
|
|
74
65
|
}], [".fsqykmd{border-left:var(--strokeWidthThin) solid var(--colorTransparentStroke);}", {
|
|
75
66
|
p: -1
|
|
@@ -77,10 +68,7 @@ const useDrawerStyles = /*#__PURE__*/__styles({
|
|
|
77
68
|
p: -1
|
|
78
69
|
}], [".f1xteiwb{border-right:var(--strokeWidthThin) solid var(--colorTransparentStroke);}", {
|
|
79
70
|
p: -1
|
|
80
|
-
}], ".f1yab3r1{bottom:0;}", ".f198g47y{top:auto;}", ".f1exhnwo{--fui-Drawer--size:320px;}", ".fqofjzu{--fui-Drawer--size:592px;}", ".fce6y3m{--fui-Drawer--size:940px;}", ".fsdmzs6{--fui-Drawer--size:100vw;}"]
|
|
81
|
-
m: [["@media screen and (prefers-reduced-motion: reduce){.f5e8c63{transition-duration:0.001ms;}}", {
|
|
82
|
-
m: "screen and (prefers-reduced-motion: reduce)"
|
|
83
|
-
}]]
|
|
71
|
+
}], ".f1yab3r1{bottom:0;}", ".f198g47y{top:auto;}", ".f1exhnwo{--fui-Drawer--size:320px;}", ".fqofjzu{--fui-Drawer--size:592px;}", ".fce6y3m{--fui-Drawer--size:940px;}", ".fsdmzs6{--fui-Drawer--size:100vw;}"]
|
|
84
72
|
});
|
|
85
73
|
export const useDrawerBottomBaseStyles = /*#__PURE__*/__styles({
|
|
86
74
|
small: {
|
|
@@ -98,30 +86,12 @@ export const useDrawerBottomBaseStyles = /*#__PURE__*/__styles({
|
|
|
98
86
|
}, {
|
|
99
87
|
d: [".f1exhnwo{--fui-Drawer--size:320px;}", ".fqofjzu{--fui-Drawer--size:592px;}", ".fce6y3m{--fui-Drawer--size:940px;}", ".fno8cgj{--fui-Drawer--size:100vh;}"]
|
|
100
88
|
});
|
|
101
|
-
export const useDrawerDurationStyles = /*#__PURE__*/__styles({
|
|
102
|
-
small: {
|
|
103
|
-
B3o57yi: "fc397y7"
|
|
104
|
-
},
|
|
105
|
-
medium: {
|
|
106
|
-
B3o57yi: "f78771"
|
|
107
|
-
},
|
|
108
|
-
large: {
|
|
109
|
-
B3o57yi: "f9ymmep"
|
|
110
|
-
},
|
|
111
|
-
full: {
|
|
112
|
-
B3o57yi: "f1loko9l"
|
|
113
|
-
}
|
|
114
|
-
}, {
|
|
115
|
-
d: [".fc397y7{transition-duration:var(--durationGentle);}", ".f78771{transition-duration:var(--durationSlow);}", ".f9ymmep{transition-duration:var(--durationSlower);}", ".f1loko9l{transition-duration:var(--durationUltraSlow);}"]
|
|
116
|
-
});
|
|
117
89
|
export const useDrawerBaseClassNames = ({
|
|
118
90
|
position,
|
|
119
|
-
size
|
|
120
|
-
motion
|
|
91
|
+
size
|
|
121
92
|
}) => {
|
|
122
93
|
const baseStyles = useDrawerStyles();
|
|
123
94
|
const bottomBaseStyles = useDrawerBottomBaseStyles();
|
|
124
|
-
|
|
125
|
-
return mergeClasses(baseStyles[position], position === 'bottom' && bottomBaseStyles[size], durationStyles[size], position !== 'bottom' && baseStyles[size], baseStyles.reducedMotion, motion.type === 'entering' && baseStyles.entering, motion.type === 'exiting' && baseStyles.exiting);
|
|
95
|
+
return mergeClasses(baseStyles[position], position === 'bottom' && bottomBaseStyles[size], position !== 'bottom' && baseStyles[size]);
|
|
126
96
|
};
|
|
127
97
|
//# sourceMappingURL=useDrawerBaseStyles.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__styles","mergeClasses","tokens","drawerCSSVars","drawerSizeVar","drawerDefaultStyles","overflow","width","maxWidth","height","maxHeight","boxSizing","display","flexDirection","alignItems","justifyContent","backgroundColor","colorNeutralBackground1","color","colorNeutralForeground1","useDrawerStyles","
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","tokens","drawerCSSVars","drawerSizeVar","drawerDefaultStyles","overflow","width","maxWidth","height","maxHeight","boxSizing","display","flexDirection","alignItems","justifyContent","backgroundColor","colorNeutralBackground1","color","colorNeutralForeground1","useDrawerStyles","start","h3c5rm","vrafjx","Bekrc4i","u1mtju","oyh7mz","j35jbq","end","zhjwy3","wvpqe5","ibv6hh","B4g9neb","bottom","B5kzvoi","Bhzewxz","small","Bjr0ffy","medium","large","full","d","p","useDrawerBottomBaseStyles","useDrawerBaseClassNames","position","size","baseStyles","bottomBaseStyles"],"sources":["useDrawerBaseStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\n/**\n * CSS variable names used internally for uniform styling in Drawer.\n */ export const drawerCSSVars = {\n drawerSizeVar: '--fui-Drawer--size'\n};\n/**\n * Default shared styles for the Drawer component\n */ export const drawerDefaultStyles = {\n overflow: 'hidden',\n width: `var(${drawerCSSVars.drawerSizeVar})`,\n maxWidth: '100vw',\n height: 'auto',\n maxHeight: '100vh',\n boxSizing: 'border-box',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n justifyContent: 'flex-start',\n backgroundColor: tokens.colorNeutralBackground1,\n color: tokens.colorNeutralForeground1\n};\n/**\n * Shared dynamic styles for the Drawer component\n */ const useDrawerStyles = makeStyles({\n /* Positioning */ start: {\n borderRight: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,\n left: 0,\n right: 'auto'\n },\n end: {\n borderLeft: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,\n right: 0,\n left: 'auto'\n },\n bottom: {\n bottom: 0,\n top: 'auto'\n },\n /* Sizes */ small: {\n [drawerCSSVars.drawerSizeVar]: '320px'\n },\n medium: {\n [drawerCSSVars.drawerSizeVar]: '592px'\n },\n large: {\n [drawerCSSVars.drawerSizeVar]: '940px'\n },\n full: {\n [drawerCSSVars.drawerSizeVar]: '100vw'\n }\n});\nexport const useDrawerBottomBaseStyles = makeStyles({\n /* Sizes for position bottom */ small: {\n [drawerCSSVars.drawerSizeVar]: '320px'\n },\n medium: {\n [drawerCSSVars.drawerSizeVar]: '592px'\n },\n large: {\n [drawerCSSVars.drawerSizeVar]: '940px'\n },\n full: {\n [drawerCSSVars.drawerSizeVar]: '100vh'\n }\n});\nexport const useDrawerBaseClassNames = ({ position, size })=>{\n const baseStyles = useDrawerStyles();\n const bottomBaseStyles = useDrawerBottomBaseStyles();\n return mergeClasses(baseStyles[position], position === 'bottom' && bottomBaseStyles[size], position !== 'bottom' && baseStyles[size]);\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,SAASC,MAAM,QAAQ,uBAAuB;AAC9C;AACA;AACA;AAAI,OAAO,MAAMC,aAAa,GAAG;EAC7BC,aAAa,EAAE;AACnB,CAAC;AACD;AACA;AACA;AAAI,OAAO,MAAMC,mBAAmB,GAAG;EACnCC,QAAQ,EAAE,QAAQ;EAClBC,KAAK,EAAE,OAAOJ,aAAa,CAACC,aAAa,GAAG;EAC5CI,QAAQ,EAAE,OAAO;EACjBC,MAAM,EAAE,MAAM;EACdC,SAAS,EAAE,OAAO;EAClBC,SAAS,EAAE,YAAY;EACvBC,OAAO,EAAE,MAAM;EACfC,aAAa,EAAE,QAAQ;EACvBC,UAAU,EAAE,YAAY;EACxBC,cAAc,EAAE,YAAY;EAC5BC,eAAe,EAAEd,MAAM,CAACe,uBAAuB;EAC/CC,KAAK,EAAEhB,MAAM,CAACiB;AAClB,CAAC;AACD;AACA;AACA;AAAI,MAAMC,eAAe,gBAAGpB,QAAA;EAAAqB,KAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;EAAA;EAAAC,GAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAL,MAAA;IAAAD,MAAA;EAAA;EAAAO,MAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;EAAAC,KAAA;IAAAC,OAAA;EAAA;EAAAC,MAAA;IAAAD,OAAA;EAAA;EAAAE,KAAA;IAAAF,OAAA;EAAA;EAAAG,IAAA;IAAAH,OAAA;EAAA;AAAA;EAAAI,CAAA;IAAAC,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;AAAA,CA2B3B,CAAC;AACF,OAAO,MAAMC,yBAAyB,gBAAG3C,QAAA;EAAAoC,KAAA;IAAAC,OAAA;EAAA;EAAAC,MAAA;IAAAD,OAAA;EAAA;EAAAE,KAAA;IAAAF,OAAA;EAAA;EAAAG,IAAA;IAAAH,OAAA;EAAA;AAAA;EAAAI,CAAA;AAAA,CAaxC,CAAC;AACF,OAAO,MAAMG,uBAAuB,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAK,CAAC,KAAG;EACzD,MAAMC,UAAU,GAAG3B,eAAe,CAAC,CAAC;EACpC,MAAM4B,gBAAgB,GAAGL,yBAAyB,CAAC,CAAC;EACpD,OAAO1C,YAAY,CAAC8C,UAAU,CAACF,QAAQ,CAAC,EAAEA,QAAQ,KAAK,QAAQ,IAAIG,gBAAgB,CAACF,IAAI,CAAC,EAAED,QAAQ,KAAK,QAAQ,IAAIE,UAAU,CAACD,IAAI,CAAC,CAAC;AACzI,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Drawer.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\n\nimport type { OverlayDrawerProps, OverlayDrawerSlots } from '../OverlayDrawer';\nimport type { InlineDrawerProps, InlineDrawerSlots } from '../InlineDrawer';\n\nexport type DrawerSlots = OverlayDrawerSlots | InlineDrawerSlots
|
|
1
|
+
{"version":3,"sources":["Drawer.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\n\nimport type { OverlayDrawerProps, OverlayDrawerSlots } from '../OverlayDrawer';\nimport type { InlineDrawerProps, InlineDrawerSlots } from '../InlineDrawer';\n\nexport type DrawerSlots = Pick<OverlayDrawerSlots, 'root'> | Pick<InlineDrawerSlots, 'root'>;\n\n/**\n * Drawer Props\n */\nexport type DrawerProps = ComponentProps<DrawerSlots> & {\n /**\n * Type of the drawer.\n *\n * - 'overlay' - Drawer is hidden by default and can be opened by clicking on the trigger.\n * - 'inline' - Drawer is stacked with the content\n *\n * @default overlay\n */\n type?: 'inline' | 'overlay';\n} & (OverlayDrawerProps | InlineDrawerProps);\n\n/**\n * State used in rendering Drawer\n */\nexport type DrawerState = ComponentState<DrawerSlots>;\n"],"names":[],"rangeMappings":";;","mappings":"AAsBA;;CAEC"}
|
|
@@ -14,16 +14,18 @@ const _reactutilities = require("@fluentui/react-utilities");
|
|
|
14
14
|
const _OverlayDrawer = require("../OverlayDrawer");
|
|
15
15
|
const _InlineDrawer = require("../InlineDrawer");
|
|
16
16
|
const useDrawer_unstable = (props, ref)=>{
|
|
17
|
+
// casting here to convert a union of functions to a single function with the union of parameters
|
|
17
18
|
const elementType = props.type === 'inline' ? _InlineDrawer.InlineDrawer : _OverlayDrawer.OverlayDrawer;
|
|
19
|
+
const root = _reactutilities.slot.always({
|
|
20
|
+
ref,
|
|
21
|
+
...props
|
|
22
|
+
}, {
|
|
23
|
+
elementType
|
|
24
|
+
});
|
|
18
25
|
return {
|
|
19
26
|
components: {
|
|
20
27
|
root: elementType
|
|
21
28
|
},
|
|
22
|
-
root
|
|
23
|
-
ref,
|
|
24
|
-
...props
|
|
25
|
-
}, {
|
|
26
|
-
elementType
|
|
27
|
-
})
|
|
29
|
+
root
|
|
28
30
|
};
|
|
29
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDrawer.ts"],"sourcesContent":["import * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\n\nimport type { DrawerProps, DrawerState } from './Drawer.types';\nimport { OverlayDrawer } from '../OverlayDrawer';\nimport { InlineDrawer } from '../InlineDrawer';\n\n/**\n * Create the state required to render Drawer.\n *\n * The returned state can be modified with hooks such as useDrawerStyles_unstable,\n * before being passed to renderDrawer_unstable.\n *\n * @param props - props from this instance of Drawer\n * @param ref - reference to root HTMLElement of Drawer\n */\nexport const useDrawer_unstable = (props: DrawerProps, ref: React.Ref<HTMLElement>): DrawerState => {\n const elementType = props.type === 'inline' ? InlineDrawer : OverlayDrawer
|
|
1
|
+
{"version":3,"sources":["useDrawer.ts"],"sourcesContent":["import * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\n\nimport type { DrawerProps, DrawerState } from './Drawer.types';\nimport { OverlayDrawer, type OverlayDrawerProps } from '../OverlayDrawer';\nimport { InlineDrawer, type InlineDrawerProps } from '../InlineDrawer';\n\n/**\n * Create the state required to render Drawer.\n *\n * The returned state can be modified with hooks such as useDrawerStyles_unstable,\n * before being passed to renderDrawer_unstable.\n *\n * @param props - props from this instance of Drawer\n * @param ref - reference to root HTMLElement of Drawer\n */\nexport const useDrawer_unstable = (props: DrawerProps, ref: React.Ref<HTMLElement>): DrawerState => {\n // casting here to convert a union of functions to a single function with the union of parameters\n const elementType = (props.type === 'inline' ? InlineDrawer : OverlayDrawer) as React.FC<\n InlineDrawerProps | OverlayDrawerProps\n >;\n const root: InlineDrawerProps | OverlayDrawerProps = slot.always({ ref, ...props }, { elementType });\n\n return {\n components: { root: elementType },\n root,\n };\n};\n"],"names":["useDrawer_unstable","props","ref","elementType","type","InlineDrawer","OverlayDrawer","root","slot","always","components"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAgBaA;;;eAAAA;;;;iEAhBU;gCACF;+BAGkC;8BACF;AAW9C,MAAMA,qBAAqB,CAACC,OAAoBC;IACrD,iGAAiG;IACjG,MAAMC,cAAeF,MAAMG,IAAI,KAAK,WAAWC,0BAAAA,GAAeC,4BAAAA;IAG9D,MAAMC,OAA+CC,oBAAAA,CAAKC,MAAM,CAAC;QAAEP;QAAK,GAAGD,KAAK;IAAC,GAAG;QAAEE;IAAY;IAElG,OAAO;QACLO,YAAY;YAAEH,MAAMJ;QAAY;QAChCI;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["InlineDrawer.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nimport { DrawerBaseProps, DrawerBaseState } from '../../shared/DrawerBase.types';\n\nexport type InlineDrawerSlots = {\n root: Slot<'div', 'aside'>;\n};\n\n/**\n * InlineDrawer Props\n */\nexport type InlineDrawerProps = ComponentProps<InlineDrawerSlots> &\n DrawerBaseProps & {\n /**\n * Whether the drawer has a separator line.\n *\n * @default false\n */\n separator?: boolean;\n };\n\n/**\n * State used in rendering InlineDrawer\n */\nexport type InlineDrawerState = Required<\n ComponentState<InlineDrawerSlots
|
|
1
|
+
{"version":3,"sources":["InlineDrawer.types.ts"],"sourcesContent":["import type { PresenceMotionSlotProps } from '@fluentui/react-motion';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nimport type { DrawerMotionParams } from '../../shared/drawerMotions';\nimport type { DrawerBaseProps, DrawerBaseState } from '../../shared/DrawerBase.types';\n\nexport type SurfaceMotionSlotProps = PresenceMotionSlotProps<DrawerMotionParams>;\n\nexport type InlineDrawerSlots = {\n root: Slot<'div', 'aside'>;\n surfaceMotion?: Slot<SurfaceMotionSlotProps>;\n};\n\n/**\n * InlineDrawer Props\n */\nexport type InlineDrawerProps = ComponentProps<InlineDrawerSlots> &\n DrawerBaseProps & {\n /**\n * Whether the drawer has a separator line.\n *\n * @default false\n */\n separator?: boolean;\n };\n\n/**\n * State used in rendering InlineDrawer\n */\nexport type InlineDrawerState = Required<\n ComponentState<NonNullable<InlineDrawerSlots>> & DrawerBaseState & Pick<InlineDrawerProps, 'separator'>\n>;\n"],"names":[],"rangeMappings":";;","mappings":"AA0BA;;CAEC"}
|
|
@@ -12,12 +12,11 @@ const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
|
|
12
12
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
13
13
|
const _drawerContext = require("../../contexts/drawerContext");
|
|
14
14
|
const renderInlineDrawer_unstable = (state, contextValue)=>{
|
|
15
|
-
if (!state.motion.canRender) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
15
|
(0, _reactutilities.assertSlots)(state);
|
|
19
16
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_drawerContext.DrawerProvider, {
|
|
20
17
|
value: contextValue,
|
|
21
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.
|
|
18
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.surfaceMotion, {
|
|
19
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {})
|
|
20
|
+
})
|
|
22
21
|
});
|
|
23
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderInlineDrawer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { DrawerContextValue, DrawerProvider } from '../../contexts/drawerContext';\n\nimport type { InlineDrawerState, InlineDrawerSlots } from './InlineDrawer.types';\n\n/**\n * Render the final JSX of InlineDrawer\n */\nexport const renderInlineDrawer_unstable = (state: InlineDrawerState, contextValue: DrawerContextValue) => {\n
|
|
1
|
+
{"version":3,"sources":["renderInlineDrawer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { DrawerContextValue, DrawerProvider } from '../../contexts/drawerContext';\n\nimport type { InlineDrawerState, InlineDrawerSlots } from './InlineDrawer.types';\n\n/**\n * Render the final JSX of InlineDrawer\n */\nexport const renderInlineDrawer_unstable = (state: InlineDrawerState, contextValue: DrawerContextValue) => {\n assertSlots<InlineDrawerSlots>(state);\n\n return (\n <DrawerProvider value={contextValue}>\n <state.surfaceMotion>\n <state.root />\n </state.surfaceMotion>\n </DrawerProvider>\n );\n};\n"],"names":["renderInlineDrawer_unstable","state","contextValue","assertSlots","_jsx","DrawerProvider","value","surfaceMotion","root"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;4BATb;gCAC4B;+BACuB;AAO5C,MAAMA,8BAA8B,CAACC,OAA0BC;IACpEC,IAAAA,2BAAAA,EAA+BF;IAE/B,OAAA,WAAA,GACEG,IAAAA,eAAA,EAACC,6BAAAA,EAAAA;QAAeC,OAAOJ;kBACrB,WAAA,GAAAE,IAAAA,eAAA,EAACH,MAAMM,aAAa,EAAA;sBAClB,WAAA,GAAAH,IAAAA,eAAA,EAACH,MAAMO,IAAI,EAAA,CAAA;;;AAInB"}
|
|
@@ -9,27 +9,49 @@ Object.defineProperty(exports, "useInlineDrawer_unstable", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
-
const
|
|
12
|
+
const _reactmotion = require("@fluentui/react-motion");
|
|
13
13
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
14
|
-
const
|
|
14
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
15
|
+
const _drawerMotions = require("../../shared/drawerMotions");
|
|
15
16
|
const _useDrawerDefaultProps = require("../../shared/useDrawerDefaultProps");
|
|
17
|
+
const STATIC_MOTION = {
|
|
18
|
+
active: true,
|
|
19
|
+
canRender: true,
|
|
20
|
+
ref: /*#__PURE__*/ _react.createRef(),
|
|
21
|
+
type: 'idle'
|
|
22
|
+
};
|
|
16
23
|
const useInlineDrawer_unstable = (props, ref)=>{
|
|
17
24
|
const { size, position, open } = (0, _useDrawerDefaultProps.useDrawerDefaultProps)(props);
|
|
18
|
-
const { separator = false } = props;
|
|
19
|
-
const
|
|
20
|
-
return {
|
|
25
|
+
const { separator = false, surfaceMotion } = props;
|
|
26
|
+
const state = {
|
|
21
27
|
components: {
|
|
22
|
-
root: 'div'
|
|
28
|
+
root: 'div',
|
|
29
|
+
// casting from internal type that has required properties
|
|
30
|
+
// to external type that only has optional properties
|
|
31
|
+
// converting to unknown first as both Function component signatures are not compatible
|
|
32
|
+
surfaceMotion: _drawerMotions.InlineDrawerMotion
|
|
23
33
|
},
|
|
24
34
|
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
|
|
25
35
|
...props,
|
|
26
|
-
ref
|
|
36
|
+
ref
|
|
27
37
|
}), {
|
|
28
38
|
elementType: 'div'
|
|
29
39
|
}),
|
|
30
|
-
|
|
40
|
+
open,
|
|
31
41
|
position,
|
|
42
|
+
size,
|
|
32
43
|
separator,
|
|
33
|
-
|
|
44
|
+
surfaceMotion: (0, _reactmotion.presenceMotionSlot)(surfaceMotion, {
|
|
45
|
+
elementType: _drawerMotions.InlineDrawerMotion,
|
|
46
|
+
defaultProps: {
|
|
47
|
+
position,
|
|
48
|
+
size,
|
|
49
|
+
visible: open,
|
|
50
|
+
unmountOnExit: true
|
|
51
|
+
}
|
|
52
|
+
}),
|
|
53
|
+
// Deprecated props
|
|
54
|
+
motion: STATIC_MOTION
|
|
34
55
|
};
|
|
56
|
+
return state;
|
|
35
57
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useInlineDrawer.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["useInlineDrawer.ts"],"sourcesContent":["import { presenceMotionSlot } from '@fluentui/react-motion';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nimport { type DrawerMotionParams, InlineDrawerMotion } from '../../shared/drawerMotions';\nimport { useDrawerDefaultProps } from '../../shared/useDrawerDefaultProps';\nimport type { InlineDrawerProps, InlineDrawerState, SurfaceMotionSlotProps } from './InlineDrawer.types';\n\nconst STATIC_MOTION = {\n active: true,\n canRender: true,\n ref: React.createRef<HTMLDivElement>(),\n type: 'idle' as const,\n};\n\n/**\n * Create the state required to render InlineDrawer.\n *\n * The returned state can be modified with hooks such as useInlineDrawerStyles_unstable,\n * before being passed to renderInlineDrawer_unstable.\n *\n * @param props - props from this instance of InlineDrawer\n * @param ref - reference to root HTMLElement of InlineDrawer\n */\nexport const useInlineDrawer_unstable = (props: InlineDrawerProps, ref: React.Ref<HTMLElement>): InlineDrawerState => {\n const { size, position, open } = useDrawerDefaultProps(props);\n const { separator = false, surfaceMotion } = props;\n\n const state: InlineDrawerState = {\n components: {\n root: 'div',\n // casting from internal type that has required properties\n // to external type that only has optional properties\n // converting to unknown first as both Function component signatures are not compatible\n surfaceMotion: InlineDrawerMotion as unknown as React.FC<SurfaceMotionSlotProps>,\n },\n\n root: slot.always(\n getIntrinsicElementProps('div', {\n ...props,\n ref,\n }),\n { elementType: 'div' },\n ),\n\n open,\n position,\n size,\n separator,\n surfaceMotion: presenceMotionSlot<DrawerMotionParams>(surfaceMotion, {\n elementType: InlineDrawerMotion,\n defaultProps: {\n position,\n size,\n visible: open,\n unmountOnExit: true,\n },\n }),\n\n // Deprecated props\n motion: STATIC_MOTION,\n };\n\n return state;\n};\n"],"names":["useInlineDrawer_unstable","STATIC_MOTION","active","canRender","ref","React","createRef","type","props","size","position","open","useDrawerDefaultProps","separator","surfaceMotion","state","components","root","InlineDrawerMotion","slot","always","getIntrinsicElementProps","elementType","presenceMotionSlot","defaultProps","visible","unmountOnExit","motion"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAwBaA;;;eAAAA;;;;6BAxBsB;gCACY;iEACxB;+BAEqC;uCACtB;AAGtC,MAAMC,gBAAgB;IACpBC,QAAQ;IACRC,WAAW;IACXC,mBAAKC,OAAMC,SAAS;IACpBC,MAAM;AACR;AAWO,MAAMP,2BAA2B,CAACQ,OAA0BJ;IACjE,MAAM,EAAEK,IAAI,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGC,IAAAA,4CAAAA,EAAsBJ;IACvD,MAAM,EAAEK,YAAY,KAAK,EAAEC,aAAa,EAAE,GAAGN;IAE7C,MAAMO,QAA2B;QAC/BC,YAAY;YACVC,MAAM;YACN,0DAA0D;YAC1D,qDAAqD;YACrD,uFAAuF;YACvFH,eAAeI,iCAAAA;QACjB;QAEAD,MAAME,oBAAAA,CAAKC,MAAM,CACfC,IAAAA,wCAAAA,EAAyB,OAAO;YAC9B,GAAGb,KAAK;YACRJ;QACF,IACA;YAAEkB,aAAa;QAAM;QAGvBX;QACAD;QACAD;QACAI;QACAC,eAAeS,IAAAA,+BAAAA,EAAuCT,eAAe;YACnEQ,aAAaJ,iCAAAA;YACbM,cAAc;gBACZd;gBACAD;gBACAgB,SAASd;gBACTe,eAAe;YACjB;QACF;QAEA,mBAAmB;QACnBC,QAAQ1B;IACV;IAEA,OAAOc;AACT"}
|