carbon-react 158.2.1 → 158.3.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/esm/components/drawer/drawer.component.d.ts +17 -5
- package/esm/components/drawer/drawer.component.js +1 -1
- package/esm/components/drawer/drawer.style.d.ts +11 -13
- package/esm/components/drawer/drawer.style.js +1 -1
- package/lib/components/drawer/drawer.component.d.ts +17 -5
- package/lib/components/drawer/drawer.component.js +1 -1
- package/lib/components/drawer/drawer.style.d.ts +11 -13
- package/lib/components/drawer/drawer.style.js +1 -1
- package/package.json +1 -1
- package/esm/__internal__/sticky-footer/index.d.ts +0 -2
- package/esm/__internal__/sticky-footer/index.js +0 -1
- package/esm/__internal__/sticky-footer/sticky-footer.component.d.ts +0 -11
- package/esm/__internal__/sticky-footer/sticky-footer.component.js +0 -1
- package/esm/__internal__/sticky-footer/sticky-footer.style.d.ts +0 -4
- package/esm/__internal__/sticky-footer/sticky-footer.style.js +0 -1
- package/lib/__internal__/sticky-footer/index.d.ts +0 -2
- package/lib/__internal__/sticky-footer/index.js +0 -1
- package/lib/__internal__/sticky-footer/package.json +0 -6
- package/lib/__internal__/sticky-footer/sticky-footer.component.d.ts +0 -11
- package/lib/__internal__/sticky-footer/sticky-footer.component.js +0 -1
- package/lib/__internal__/sticky-footer/sticky-footer.style.d.ts +0 -4
- package/lib/__internal__/sticky-footer/sticky-footer.style.js +0 -1
|
@@ -2,7 +2,10 @@ import React from "react";
|
|
|
2
2
|
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
3
3
|
import DrawerSidebarContext from "./__internal__/drawer-sidebar.context";
|
|
4
4
|
export interface DrawerProps extends TagProps {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Duration of a animation
|
|
7
|
+
* @deprecated This prop will soon be removed.
|
|
8
|
+
*/
|
|
6
9
|
animationDuration?: string;
|
|
7
10
|
/** Specify an aria-label for the Drawer component */
|
|
8
11
|
"aria-label"?: string;
|
|
@@ -10,18 +13,27 @@ export interface DrawerProps extends TagProps {
|
|
|
10
13
|
sidebarAriaLabel?: string;
|
|
11
14
|
/** Sets color of sidebar's background */
|
|
12
15
|
backgroundColor?: string;
|
|
16
|
+
/** Main content to display */
|
|
13
17
|
children: React.ReactNode;
|
|
14
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Set the default state of expansion of the Drawer if component is meant to be used as uncontrolled
|
|
20
|
+
* @deprecated This prop will soon be removed, please use the `expanded` prop instead.
|
|
21
|
+
*/
|
|
15
22
|
defaultExpanded?: boolean;
|
|
16
23
|
/** Sets the expansion state of the Drawer if component is meant to be used as controlled */
|
|
17
24
|
expanded?: boolean;
|
|
25
|
+
/** The width of the expanded sidebar */
|
|
18
26
|
expandedWidth?: string;
|
|
19
|
-
/** Sets
|
|
27
|
+
/** Sets the height of the component */
|
|
20
28
|
height?: string;
|
|
21
29
|
/** Callback fired when expansion state changes, onChange(event: object, isExpanded: boolean) */
|
|
22
30
|
onChange?: (e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>, isExpanded: boolean) => void;
|
|
31
|
+
/** Drawer sidebar content */
|
|
23
32
|
sidebar?: React.ReactNode;
|
|
24
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Enables expand/collapse button that controls drawer
|
|
35
|
+
* @deprecated This prop will soon be removed, this component is now intended to be non-dismissible.
|
|
36
|
+
*/
|
|
25
37
|
showControls?: boolean;
|
|
26
38
|
/** Sets the heading of the drawer */
|
|
27
39
|
title?: React.ReactNode;
|
|
@@ -32,6 +44,6 @@ export interface DrawerProps extends TagProps {
|
|
|
32
44
|
/** Makes the footer of the drawer sticky. Footer prop must also be set. */
|
|
33
45
|
stickyFooter?: boolean;
|
|
34
46
|
}
|
|
35
|
-
export declare const Drawer: ({ "aria-label": ariaLabel, sidebarAriaLabel,
|
|
47
|
+
export declare const Drawer: ({ "aria-label": ariaLabel, sidebarAriaLabel, defaultExpanded, expanded, onChange, children, expandedWidth, sidebar, animationDuration, backgroundColor, title, footer, showControls, height, stickyHeader, stickyFooter, ...rest }: DrawerProps) => React.JSX.Element;
|
|
36
48
|
export { DrawerSidebarContext };
|
|
37
49
|
export default Drawer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as r
|
|
1
|
+
import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useRef as t,useState as n,useEffect as o,useCallback as i}from"react";import a from"invariant";import l from"../../__internal__/utils/helpers/guid/index.js";import d from"../../hooks/__internal__/usePrevious/index.js";import c from"../icon/icon.component.js";import{StyledDrawerWrapper as s,StyledDrawerContent as p,StyledSidebarTitle as u,StyledDrawerSidebar as b,StyledSidebarFooter as f,StyledSidebarToggleButton as m}from"./drawer.style.js";import h from"../../__internal__/utils/helpers/tags/tags.js";import g from"./__internal__/drawer-sidebar.context.js";import w from"../../__internal__/utils/logger/index.js";function y(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}let O=!1,v=!1,j=!1;const _=_=>{var{"aria-label":x,sidebarAriaLabel:D,defaultExpanded:P,expanded:k,onChange:C,children:E,expandedWidth:S="30vw",sidebar:H,animationDuration:T="400ms",backgroundColor:A,title:F,footer:W,showControls:I,height:L="100%",stickyHeader:$,stickyFooter:q}=_,z=function(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(_,["aria-label","sidebarAriaLabel","defaultExpanded","expanded","onChange","children","expandedWidth","sidebar","animationDuration","backgroundColor","title","footer","showControls","height","stickyHeader","stickyFooter"]);"400ms"===T||O||(w.deprecate("The `animationDuration` prop in `Drawer` is deprecated and will soon be removed."),O=!0),void 0===I||j||(w.deprecate("The `showControls` prop in `Drawer` is deprecated and will soon be removed."),j=!0),void 0===P||v||(w.deprecate("The `defaultExpanded` prop in `Drawer` is deprecated and will soon be removed."),v=!0);const B=t(l()),G=`DrawerSidebar_${B.current}`,J=`DrawerTitle_${B.current}`,K=t(null),M=t(null),N=t(void 0!==k),[Q,R]=n(N.current?k:null==P||P),U=d(k);o((()=>{a(N.current===(void 0!==k),"Drawer should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled Drawer element for the lifetime of the component"),N.current&&U!==k&&R(k)}),[k,U,I]),o((()=>{const e=M.current;e&&(e.scrollHeight>e.clientHeight?e.setAttribute("tabindex","0"):e.removeAttribute("tabindex"))}),[H,Q]);const V=i((e=>{R(!Q),null==C||C(e,!Q),Q&&K.current&&(K.current.scrollTop=0)}),[Q,C]);return e(s,(X=function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),n.forEach((function(r){y(e,r,t[r])}))}return e}({"aria-label":x,height:L},h("drawer",z)),Y=null!=(Y={children:[e(p,{expandedWidth:S,animationDuration:T,isExpanded:Q,showControls:I,ref:K,backgroundColor:A,"data-element":"drawer-content","data-role":"drawer-content","aria-label":D,"aria-labelledby":F?J:void 0,children:[F&&r(u,{id:J,stickyHeader:$,children:F}),I&&r(m,{"aria-label":"toggle sidebar","aria-expanded":Q,"aria-controls":G,"data-element":"drawer-toggle",onClick:V,isExpanded:Q,children:r(c,{type:"chevron_right"})}),r(b,{"data-element":"drawer-sidebar",id:G,ref:M,children:r(g.Provider,{value:{isInSidebar:!0},children:H})}),W&&r(f,{stickyFooter:q,children:W})]}),E]})?Y:{},Object.getOwnPropertyDescriptors?Object.defineProperties(X,Object.getOwnPropertyDescriptors(Y)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(Y)).forEach((function(e){Object.defineProperty(X,e,Object.getOwnPropertyDescriptor(Y,e))})),X));var X,Y};export{_ as Drawer,g as DrawerSidebarContext,_ as default};
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
|
|
1
|
+
export declare const StyledSidebarTitle: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
stickyHeader?: boolean;
|
|
3
3
|
}, never>;
|
|
4
|
-
declare const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
hasControls: boolean;
|
|
9
|
-
}
|
|
10
|
-
declare const StyledDrawerSidebar: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../box").BoxProps & import("react").RefAttributes<HTMLDivElement>>, any, StyledDrawerSidebarProps, never>;
|
|
4
|
+
export declare const StyledSidebarFooter: import("styled-components").StyledComponent<"div", any, {
|
|
5
|
+
stickyFooter?: boolean;
|
|
6
|
+
}, never>;
|
|
7
|
+
declare const StyledDrawerSidebar: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
8
|
interface StyledDrawerContentProps {
|
|
12
9
|
animationDuration?: string;
|
|
13
10
|
backgroundColor?: string;
|
|
14
|
-
expandedWidth
|
|
11
|
+
expandedWidth?: string;
|
|
12
|
+
isExpanded?: boolean;
|
|
13
|
+
showControls?: boolean;
|
|
15
14
|
}
|
|
16
15
|
declare const StyledDrawerContent: import("styled-components").StyledComponent<"aside", any, StyledDrawerContentProps, never>;
|
|
17
16
|
interface StyledSidebarToggleButtonProps {
|
|
18
|
-
animationDuration?: string;
|
|
19
17
|
isExpanded?: boolean;
|
|
20
18
|
}
|
|
21
19
|
declare const StyledSidebarToggleButton: import("styled-components").StyledComponent<"button", any, {
|
|
@@ -24,6 +22,6 @@ declare const StyledSidebarToggleButton: import("styled-components").StyledCompo
|
|
|
24
22
|
type: "button";
|
|
25
23
|
} & StyledSidebarToggleButtonProps, "theme" | "type">;
|
|
26
24
|
declare const StyledDrawerWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
27
|
-
height
|
|
25
|
+
height?: string;
|
|
28
26
|
}, never>;
|
|
29
|
-
export {
|
|
27
|
+
export { StyledDrawerWrapper, StyledDrawerContent, StyledDrawerSidebar, StyledSidebarToggleButton, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t,{css as e}from"styled-components";import i from"../../style/utils/add-focus-styling.js";import o from"../../style/themes/apply-base-theme.js";const a=t.div.withConfig({displayName:"drawer.style__StyledSidebarTitle",componentId:"sc-4497ce5f-0"})(["padding:var(--spacing300);",""],(({stickyHeader:t})=>t&&e(["position:sticky;top:0;border-bottom:var(--sizing010) solid #a0a0a0;"]))),r=t.div.withConfig({displayName:"drawer.style__StyledSidebarFooter",componentId:"sc-4497ce5f-1"})(["padding:var(--spacing300);background-color:var(--colorsUtilityYang100);",""],(({stickyFooter:t})=>t&&e(["position:sticky;bottom:0;"]))),n=t.div.withConfig({displayName:"drawer.style__StyledDrawerSidebar",componentId:"sc-4497ce5f-2"})(["display:flex;flex-direction:column;flex:1 1 0%;overflow-y:auto;outline:none;"]),d=t.aside.withConfig({displayName:"drawer.style__StyledDrawerContent",componentId:"sc-4497ce5f-3"})(["",";"],(({animationDuration:t,backgroundColor:i,expandedWidth:o,isExpanded:d,showControls:s})=>e(['flex-direction:column;height:auto;position:relative;overflow:auto;display:flex;min-width:"288px";width:',';max-width:"760px";'," background-color:",";",""],o,!d&&e(["display:none;width:0;min-width:0;"]),i||"var(--colorsUtilityYang100)",s&&e(["display:flex;overflow:hidden;min-height:40px;transition:all "," ease-in-out;",",",",","{transition:all "," ease-in-out;white-space:nowrap;overflow:hidden;opacity:1;}",""],t,n,a,r,t,!d&&e(["min-width:var(--sizing500);width:var(--sizing500);",",",",","{opacity:0;}"],n,a,r))))),s=t.button.attrs(o).attrs({type:"button"}).withConfig({displayName:"drawer.style__StyledSidebarToggleButton",componentId:"sc-4497ce5f-4"})(["",""],(({isExpanded:t})=>e(["position:absolute;top:var(--spacing300);right:8px;padding:var(--spacing100);width:var(--spacing300);height:var(--spacing300);display:flex;justify-content:center;align-items:center;background-color:transparent;border:none;z-index:1;border-radius:var(--borderRadius050);transform:rotate(0deg);&:focus{","}&:hover{cursor:pointer;}",""],i(),t&&e(["transform:rotate(180deg);"])))),l=t.div.withConfig({displayName:"drawer.style__StyledDrawerWrapper",componentId:"sc-4497ce5f-5"})(["display:flex;",""],(({height:t})=>e(["height:",";"],t)));export{d as StyledDrawerContent,n as StyledDrawerSidebar,l as StyledDrawerWrapper,r as StyledSidebarFooter,a as StyledSidebarTitle,s as StyledSidebarToggleButton};
|
|
@@ -2,7 +2,10 @@ import React from "react";
|
|
|
2
2
|
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
3
3
|
import DrawerSidebarContext from "./__internal__/drawer-sidebar.context";
|
|
4
4
|
export interface DrawerProps extends TagProps {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Duration of a animation
|
|
7
|
+
* @deprecated This prop will soon be removed.
|
|
8
|
+
*/
|
|
6
9
|
animationDuration?: string;
|
|
7
10
|
/** Specify an aria-label for the Drawer component */
|
|
8
11
|
"aria-label"?: string;
|
|
@@ -10,18 +13,27 @@ export interface DrawerProps extends TagProps {
|
|
|
10
13
|
sidebarAriaLabel?: string;
|
|
11
14
|
/** Sets color of sidebar's background */
|
|
12
15
|
backgroundColor?: string;
|
|
16
|
+
/** Main content to display */
|
|
13
17
|
children: React.ReactNode;
|
|
14
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Set the default state of expansion of the Drawer if component is meant to be used as uncontrolled
|
|
20
|
+
* @deprecated This prop will soon be removed, please use the `expanded` prop instead.
|
|
21
|
+
*/
|
|
15
22
|
defaultExpanded?: boolean;
|
|
16
23
|
/** Sets the expansion state of the Drawer if component is meant to be used as controlled */
|
|
17
24
|
expanded?: boolean;
|
|
25
|
+
/** The width of the expanded sidebar */
|
|
18
26
|
expandedWidth?: string;
|
|
19
|
-
/** Sets
|
|
27
|
+
/** Sets the height of the component */
|
|
20
28
|
height?: string;
|
|
21
29
|
/** Callback fired when expansion state changes, onChange(event: object, isExpanded: boolean) */
|
|
22
30
|
onChange?: (e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>, isExpanded: boolean) => void;
|
|
31
|
+
/** Drawer sidebar content */
|
|
23
32
|
sidebar?: React.ReactNode;
|
|
24
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Enables expand/collapse button that controls drawer
|
|
35
|
+
* @deprecated This prop will soon be removed, this component is now intended to be non-dismissible.
|
|
36
|
+
*/
|
|
25
37
|
showControls?: boolean;
|
|
26
38
|
/** Sets the heading of the drawer */
|
|
27
39
|
title?: React.ReactNode;
|
|
@@ -32,6 +44,6 @@ export interface DrawerProps extends TagProps {
|
|
|
32
44
|
/** Makes the footer of the drawer sticky. Footer prop must also be set. */
|
|
33
45
|
stickyFooter?: boolean;
|
|
34
46
|
}
|
|
35
|
-
export declare const Drawer: ({ "aria-label": ariaLabel, sidebarAriaLabel,
|
|
47
|
+
export declare const Drawer: ({ "aria-label": ariaLabel, sidebarAriaLabel, defaultExpanded, expanded, onChange, children, expandedWidth, sidebar, animationDuration, backgroundColor, title, footer, showControls, height, stickyHeader, stickyFooter, ...rest }: DrawerProps) => React.JSX.Element;
|
|
36
48
|
export { DrawerSidebarContext };
|
|
37
49
|
export default Drawer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("invariant"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("invariant"),n=require("../../__internal__/utils/helpers/guid/index.js"),a=require("../../hooks/__internal__/usePrevious/index.js"),o=require("../icon/icon.component.js"),i=require("./drawer.style.js"),l=require("../../__internal__/utils/helpers/tags/tags.js"),d=require("./__internal__/drawer-sidebar.context.js"),s=require("../../__internal__/utils/logger/index.js");function c(e){return e&&e.__esModule?e:{default:e}}var u=c(t);function b(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}let p=!1,f=!1,h=!1;const y=t=>{var{"aria-label":c,sidebarAriaLabel:y,defaultExpanded:w,expanded:g,onChange:j,children:x,expandedWidth:O="30vw",sidebar:v,animationDuration:m="400ms",backgroundColor:_,title:D,footer:S,showControls:P,height:k="100%",stickyHeader:C,stickyFooter:q}=t,E=function(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}(t,["aria-label","sidebarAriaLabel","defaultExpanded","expanded","onChange","children","expandedWidth","sidebar","animationDuration","backgroundColor","title","footer","showControls","height","stickyHeader","stickyFooter"]);"400ms"===m||p||(s.default.deprecate("The `animationDuration` prop in `Drawer` is deprecated and will soon be removed."),p=!0),void 0===P||h||(s.default.deprecate("The `showControls` prop in `Drawer` is deprecated and will soon be removed."),h=!0),void 0===w||f||(s.default.deprecate("The `defaultExpanded` prop in `Drawer` is deprecated and will soon be removed."),f=!0);const T=r.useRef(n.default()),H=`DrawerSidebar_${T.current}`,A=`DrawerTitle_${T.current}`,F=r.useRef(null),R=r.useRef(null),W=r.useRef(void 0!==g),[I,L]=r.useState(W.current?g:null==w||w),M=a.default(g);r.useEffect((()=>{u.default(W.current===(void 0!==g),"Drawer should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled Drawer element for the lifetime of the component"),W.current&&M!==g&&L(g)}),[g,M,P]),r.useEffect((()=>{const e=R.current;e&&(e.scrollHeight>e.clientHeight?e.setAttribute("tabindex","0"):e.removeAttribute("tabindex"))}),[v,I]);const $=r.useCallback((e=>{L(!I),null==j||j(e,!I),I&&F.current&&(F.current.scrollTop=0)}),[I,j]);return e.jsxs(i.StyledDrawerWrapper,(B=function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),n.forEach((function(r){b(e,r,t[r])}))}return e}({"aria-label":c,height:k},l.default("drawer",E)),z=null!=(z={children:[e.jsxs(i.StyledDrawerContent,{expandedWidth:O,animationDuration:m,isExpanded:I,showControls:P,ref:F,backgroundColor:_,"data-element":"drawer-content","data-role":"drawer-content","aria-label":y,"aria-labelledby":D?A:void 0,children:[D&&e.jsx(i.StyledSidebarTitle,{id:A,stickyHeader:C,children:D}),P&&e.jsx(i.StyledSidebarToggleButton,{"aria-label":"toggle sidebar","aria-expanded":I,"aria-controls":H,"data-element":"drawer-toggle",onClick:$,isExpanded:I,children:e.jsx(o.default,{type:"chevron_right"})}),e.jsx(i.StyledDrawerSidebar,{"data-element":"drawer-sidebar",id:H,ref:R,children:e.jsx(d.default.Provider,{value:{isInSidebar:!0},children:v})}),S&&e.jsx(i.StyledSidebarFooter,{stickyFooter:q,children:S})]}),x]})?z:{},Object.getOwnPropertyDescriptors?Object.defineProperties(B,Object.getOwnPropertyDescriptors(z)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(z)).forEach((function(e){Object.defineProperty(B,e,Object.getOwnPropertyDescriptor(z,e))})),B));var B,z};exports.DrawerSidebarContext=d.default,exports.Drawer=y,exports.default=y;
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
|
|
1
|
+
export declare const StyledSidebarTitle: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
stickyHeader?: boolean;
|
|
3
3
|
}, never>;
|
|
4
|
-
declare const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
hasControls: boolean;
|
|
9
|
-
}
|
|
10
|
-
declare const StyledDrawerSidebar: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../box").BoxProps & import("react").RefAttributes<HTMLDivElement>>, any, StyledDrawerSidebarProps, never>;
|
|
4
|
+
export declare const StyledSidebarFooter: import("styled-components").StyledComponent<"div", any, {
|
|
5
|
+
stickyFooter?: boolean;
|
|
6
|
+
}, never>;
|
|
7
|
+
declare const StyledDrawerSidebar: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
8
|
interface StyledDrawerContentProps {
|
|
12
9
|
animationDuration?: string;
|
|
13
10
|
backgroundColor?: string;
|
|
14
|
-
expandedWidth
|
|
11
|
+
expandedWidth?: string;
|
|
12
|
+
isExpanded?: boolean;
|
|
13
|
+
showControls?: boolean;
|
|
15
14
|
}
|
|
16
15
|
declare const StyledDrawerContent: import("styled-components").StyledComponent<"aside", any, StyledDrawerContentProps, never>;
|
|
17
16
|
interface StyledSidebarToggleButtonProps {
|
|
18
|
-
animationDuration?: string;
|
|
19
17
|
isExpanded?: boolean;
|
|
20
18
|
}
|
|
21
19
|
declare const StyledSidebarToggleButton: import("styled-components").StyledComponent<"button", any, {
|
|
@@ -24,6 +22,6 @@ declare const StyledSidebarToggleButton: import("styled-components").StyledCompo
|
|
|
24
22
|
type: "button";
|
|
25
23
|
} & StyledSidebarToggleButtonProps, "theme" | "type">;
|
|
26
24
|
declare const StyledDrawerWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
27
|
-
height
|
|
25
|
+
height?: string;
|
|
28
26
|
}, never>;
|
|
29
|
-
export {
|
|
27
|
+
export { StyledDrawerWrapper, StyledDrawerContent, StyledDrawerSidebar, StyledSidebarToggleButton, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("styled-components"),t=require("
|
|
1
|
+
"use strict";var e=require("styled-components"),t=require("../../style/utils/add-focus-styling.js"),i=require("../../style/themes/apply-base-theme.js");function o(e){return e&&e.__esModule?e:{default:e}}var a=o(e);const r=a.default.div.withConfig({displayName:"drawer.style__StyledSidebarTitle",componentId:"sc-4497ce5f-0"})(["padding:var(--spacing300);",""],(({stickyHeader:t})=>t&&e.css(["position:sticky;top:0;border-bottom:var(--sizing010) solid #a0a0a0;"]))),s=a.default.div.withConfig({displayName:"drawer.style__StyledSidebarFooter",componentId:"sc-4497ce5f-1"})(["padding:var(--spacing300);background-color:var(--colorsUtilityYang100);",""],(({stickyFooter:t})=>t&&e.css(["position:sticky;bottom:0;"]))),d=a.default.div.withConfig({displayName:"drawer.style__StyledDrawerSidebar",componentId:"sc-4497ce5f-2"})(["display:flex;flex-direction:column;flex:1 1 0%;overflow-y:auto;outline:none;"]),n=a.default.aside.withConfig({displayName:"drawer.style__StyledDrawerContent",componentId:"sc-4497ce5f-3"})(["",";"],(({animationDuration:t,backgroundColor:i,expandedWidth:o,isExpanded:a,showControls:n})=>e.css(['flex-direction:column;height:auto;position:relative;overflow:auto;display:flex;min-width:"288px";width:',';max-width:"760px";'," background-color:",";",""],o,!a&&e.css(["display:none;width:0;min-width:0;"]),i||"var(--colorsUtilityYang100)",n&&e.css(["display:flex;overflow:hidden;min-height:40px;transition:all "," ease-in-out;",",",",","{transition:all "," ease-in-out;white-space:nowrap;overflow:hidden;opacity:1;}",""],t,d,r,s,t,!a&&e.css(["min-width:var(--sizing500);width:var(--sizing500);",",",",","{opacity:0;}"],d,r,s))))),l=a.default.button.attrs(i.default).attrs({type:"button"}).withConfig({displayName:"drawer.style__StyledSidebarToggleButton",componentId:"sc-4497ce5f-4"})(["",""],(({isExpanded:i})=>e.css(["position:absolute;top:var(--spacing300);right:8px;padding:var(--spacing100);width:var(--spacing300);height:var(--spacing300);display:flex;justify-content:center;align-items:center;background-color:transparent;border:none;z-index:1;border-radius:var(--borderRadius050);transform:rotate(0deg);&:focus{","}&:hover{cursor:pointer;}",""],t.default(),i&&e.css(["transform:rotate(180deg);"])))),c=a.default.div.withConfig({displayName:"drawer.style__StyledDrawerWrapper",componentId:"sc-4497ce5f-5"})(["display:flex;",""],(({height:t})=>e.css(["height:",";"],t)));exports.StyledDrawerContent=n,exports.StyledDrawerSidebar=d,exports.StyledDrawerWrapper=c,exports.StyledSidebarFooter=s,exports.StyledSidebarTitle=r,exports.StyledSidebarToggleButton=l;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{default}from"./sticky-footer.component.js";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export interface StickyFooterProps {
|
|
3
|
-
/** child elements */
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
/** Ref of the container the footer should be sticky on */
|
|
6
|
-
containerRef: React.RefObject<HTMLElement>;
|
|
7
|
-
/** Disable the sticky behaviour manually */
|
|
8
|
-
disableSticky?: boolean;
|
|
9
|
-
}
|
|
10
|
-
declare const StickyFooter: ({ children, containerRef, disableSticky, ...rest }: StickyFooterProps) => React.JSX.Element;
|
|
11
|
-
export default StickyFooter;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useState as t,useRef as r,useCallback as n,useEffect as o}from"react";import c from"lodash/throttle";import l from"./sticky-footer.style.js";function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const s=s=>{var{children:u,containerRef:f,disableSticky:a}=s,p=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},c=Object.keys(e);for(n=0;n<c.length;n++)r=c[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)r=c[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(s,["children","containerRef","disableSticky"]);const[b,y]=t(!0),O=r(null),j=n(c((()=>{const e=f.current,t=O.current?O.current.clientHeight/2:0;let r;e&&(r=e.scrollHeight-e.scrollTop-t<=e.clientHeight),y(!r)}),50),[f]);return o((()=>{const e=f.current;return null==e||e.addEventListener("scroll",j,!1),()=>{null==e||e.removeEventListener("scroll",j,!1)}}),[j,f]),e(l,(m=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){i(e,t,r[t])}))}return e}({"data-component":"sticky-footer",sticky:!a&&b,ref:O},p),g=null!=(g={children:u})?g:{},Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(g)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(g)).forEach((function(e){Object.defineProperty(m,e,Object.getOwnPropertyDescriptor(g,e))})),m));var m,g};export{s as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import o,{keyframes as t,css as a}from"styled-components";const i=t(["0%{transform:translateY(50px);}100%{transform:translateY(0px);}"]),n=o.div.withConfig({displayName:"sticky-footer.style__StyledStickyFooter",componentId:"sc-e0475900-0"})(["padding:var(--spacing200) var(--spacing400);box-sizing:border-box;width:100%;",""],(({sticky:o})=>o&&a(["animation:"," 0.25s ease;position:sticky;bottom:0;left:0;background-color:var(--colorsActionMinorYang100);box-shadow:var(--boxShadow150);z-index:1000;"],i)));export{n as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./sticky-footer.component.js");exports.default=e.default;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export interface StickyFooterProps {
|
|
3
|
-
/** child elements */
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
/** Ref of the container the footer should be sticky on */
|
|
6
|
-
containerRef: React.RefObject<HTMLElement>;
|
|
7
|
-
/** Disable the sticky behaviour manually */
|
|
8
|
-
disableSticky?: boolean;
|
|
9
|
-
}
|
|
10
|
-
declare const StickyFooter: ({ children, containerRef, disableSticky, ...rest }: StickyFooterProps) => React.JSX.Element;
|
|
11
|
-
export default StickyFooter;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("lodash/throttle"),n=require("./sticky-footer.style.js");function c(e){return e&&e.__esModule?e:{default:e}}var o=c(r);function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}exports.default=r=>{var{children:c,containerRef:u,disableSticky:i}=r,s=function(e,t){if(null==e)return{};var r,n,c=function(e,t){if(null==e)return{};var r,n,c={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(c[r]=e[r]);return c}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(c[r]=e[r])}return c}(r,["children","containerRef","disableSticky"]);const[a,f]=t.useState(!0),b=t.useRef(null),y=t.useCallback(o.default((()=>{const e=u.current,t=b.current?b.current.clientHeight/2:0;let r;e&&(r=e.scrollHeight-e.scrollTop-t<=e.clientHeight),f(!r)}),50),[u]);return t.useEffect((()=>{const e=u.current;return null==e||e.addEventListener("scroll",y,!1),()=>{null==e||e.removeEventListener("scroll",y,!1)}}),[y,u]),e.jsx(n.default,(O=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){l(e,t,r[t])}))}return e}({"data-component":"sticky-footer",sticky:!i&&a,ref:b},s),p=null!=(p={children:c})?p:{},Object.getOwnPropertyDescriptors?Object.defineProperties(O,Object.getOwnPropertyDescriptors(p)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(p)).forEach((function(e){Object.defineProperty(O,e,Object.getOwnPropertyDescriptor(p,e))})),O));var O,p};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("styled-components");function t(o){return o&&o.__esModule?o:{default:o}}var e=t(o);const r=o.keyframes(["0%{transform:translateY(50px);}100%{transform:translateY(0px);}"]),s=e.default.div.withConfig({displayName:"sticky-footer.style__StyledStickyFooter",componentId:"sc-e0475900-0"})(["padding:var(--spacing200) var(--spacing400);box-sizing:border-box;width:100%;",""],(({sticky:t})=>t&&o.css(["animation:"," 0.25s ease;position:sticky;bottom:0;left:0;background-color:var(--colorsActionMinorYang100);box-shadow:var(--boxShadow150);z-index:1000;"],r)));exports.default=s;
|