carbon-react 159.13.2 → 159.13.3

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.
@@ -1 +1 @@
1
- import{jsxs as e,jsx as r}from"react/jsx-runtime";import o,{useRef as t,useCallback as a}from"react";import n from"../../__internal__/modal/modal.component.js";import{StyledSidebar as i,StyledSidebarContent as s}from"./sidebar.style.js";import l from"../icon-button/icon-button.component.js";import c from"../icon/icon.component.js";import d from"../../__internal__/focus-trap/focus-trap.component.js";import u,{SidebarSubHeader as p}from"./__internal__/sidebar-header/sidebar-header.component.js";import b from"../../__internal__/utils/helpers/guid/index.js";import m from"../../hooks/__internal__/useLocale/useLocale.js";import f from"../../style/utils/filter-styled-system-padding-props.js";import y from"../../__internal__/utils/helpers/tags/tags.js";import h from"../../hooks/__internal__/useModalAria/useModalAria.js";import O from"./__internal__/sidebar.context.js";import j from"../../hooks/useMediaQuery/useMediaQuery.js";function _(e,r,o){return r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}function g(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{},t=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(o).filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})))),t.forEach((function(r){_(e,r,o[r])}))}return e}function P(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r.push.apply(r,o)}return r}(Object(r)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})),e}const w=o.forwardRef(((o,_)=>{var{"aria-describedby":w,"aria-label":v,"aria-labelledby":k,"data-element":F="sidebar","data-role":S,open:C,bespokeFocusTrap:E,closeButtonDataProps:A,disableAutoFocus:M=!1,disableEscKey:x=!1,enableBackgroundUI:D=!1,header:I,headerVariant:B="light",subHeader:H,position:N="right",size:z="medium",children:K,onCancel:L,role:R="dialog",focusFirstElement:T,focusableContainers:U,focusableSelectors:V,width:Q,widthAnimation:W=!1,headerPadding:q={},subHeaderPadding:G={},topModalOverride:J,restoreFocusOnClose:X=!0,className:Y,hidden:Z}=o,$=function(e,r){if(null==e)return{};var o,t,a=function(e,r){if(null==e)return{};var o,t,a={},n=Object.keys(e);for(t=0;t<n.length;t++)o=n[t],r.indexOf(o)>=0||(a[o]=e[o]);return a}(e,r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(t=0;t<n.length;t++)o=n[t],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(a[o]=e[o])}return a}(o,["aria-describedby","aria-label","aria-labelledby","data-element","data-role","open","bespokeFocusTrap","closeButtonDataProps","disableAutoFocus","disableEscKey","enableBackgroundUI","header","headerVariant","subHeader","position","size","children","onCancel","role","focusFirstElement","focusableContainers","focusableSelectors","width","widthAnimation","headerPadding","subHeaderPadding","topModalOverride","restoreFocusOnClose","className","hidden"]);const ee=m(),re=j("screen and (prefers-reduced-motion: no-preference)"),{current:oe}=t(b()),{current:te}=t(b()),ae=t(null),ne=a((e=>{ae.current=e,_&&("object"==typeof _&&(_.current=e),"function"==typeof _&&_(e))}),[_]),ie=h(ae,Z),se=()=>L?r(l,P(g({"aria-label":ee.sidebar.ariaLabels.close(),onClick:L},y("close",g({"data-element":"close"},A))),{children:r(c,{type:"close"})})):null,le=e(i,{"aria-modal":!D&&ie,"aria-describedby":w||te,"aria-label":v,"aria-labelledby":k||v?k:oe,"data-component":"sidebar","data-element":F,"data-role":S,ref:ne,position:N,size:z,onCancel:L,role:R,width:Q,widthAnimation:W&&re,className:Y,children:[I&&r(u,P(g({headerVariant:B,closeIcon:se()},q),{id:oe,children:I})),H&&r(p,P(g({},G),{id:te,children:H})),!I&&se(),r(s,P(g({"data-element":"sidebar-content","data-role":"sidebar-content"},f($)),{children:r(O.Provider,{value:{isInSidebar:!0},children:K})}))]});return r(n,{open:C,onCancel:L,disableEscKey:x,enableBackgroundUI:D,topModalOverride:J,restoreFocusOnClose:X,children:D?le:r(d,{wrapperRef:ae,isOpen:C,additionalWrapperRefs:U,focusableSelectors:V,focusFirstElement:T,autoFocus:!M,bespokeTrap:E,children:le})})}));w.displayName="Sidebar";export{w as Sidebar,w as default};
1
+ import{jsxs as e,jsx as r}from"react/jsx-runtime";import o,{useRef as t,useCallback as a}from"react";import n from"../../__internal__/modal/modal.component.js";import{StyledSidebar as i,StyledSidebarContent as s}from"./sidebar.style.js";import l from"../icon-button/icon-button.component.js";import c from"../icon/icon.component.js";import d from"../../__internal__/focus-trap/focus-trap.component.js";import u,{SidebarSubHeader as p}from"./__internal__/sidebar-header/sidebar-header.component.js";import b from"../../__internal__/utils/helpers/guid/index.js";import m from"../../hooks/__internal__/useLocale/useLocale.js";import f from"../../style/utils/filter-styled-system-padding-props.js";import y from"../../__internal__/utils/helpers/tags/tags.js";import h from"../../hooks/__internal__/useModalAria/useModalAria.js";import O from"./__internal__/sidebar.context.js";import j from"../../hooks/useMediaQuery/useMediaQuery.js";function _(e,r,o){return r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}function g(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{},t=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(o).filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})))),t.forEach((function(r){_(e,r,o[r])}))}return e}function P(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r.push.apply(r,o)}return r}(Object(r)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})),e}const w=o.forwardRef(((o,_)=>{var{"aria-describedby":w,"aria-label":v,"aria-labelledby":k,"data-element":F="sidebar","data-role":S,open:C,bespokeFocusTrap:E,closeButtonDataProps:x,disableAutoFocus:A=!1,disableEscKey:I=!1,enableBackgroundUI:M=!1,header:D,headerVariant:B="light",subHeader:H,position:N="right",size:z="medium",children:K,onCancel:L,role:R="dialog",focusFirstElement:T,focusableContainers:U,focusableSelectors:V,width:Q,widthAnimation:W=!1,headerPadding:q={},subHeaderPadding:G={},topModalOverride:J,restoreFocusOnClose:X=!0,className:Y,hidden:Z}=o,$=function(e,r){if(null==e)return{};var o,t,a=function(e,r){if(null==e)return{};var o,t,a={},n=Object.keys(e);for(t=0;t<n.length;t++)o=n[t],r.indexOf(o)>=0||(a[o]=e[o]);return a}(e,r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(t=0;t<n.length;t++)o=n[t],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(a[o]=e[o])}return a}(o,["aria-describedby","aria-label","aria-labelledby","data-element","data-role","open","bespokeFocusTrap","closeButtonDataProps","disableAutoFocus","disableEscKey","enableBackgroundUI","header","headerVariant","subHeader","position","size","children","onCancel","role","focusFirstElement","focusableContainers","focusableSelectors","width","widthAnimation","headerPadding","subHeaderPadding","topModalOverride","restoreFocusOnClose","className","hidden"]);const ee=m(),re=j("screen and (prefers-reduced-motion: no-preference)"),{current:oe}=t(b()),{current:te}=t(b()),ae=t(null),ne=a((e=>{ae.current=e,_&&("object"==typeof _&&(_.current=e),"function"==typeof _&&_(e))}),[_]),ie=h(ae,Z),se=()=>L?r(l,P(g({"aria-label":ee.sidebar.ariaLabels.close(),onClick:L},y("close",g({"data-element":"close"},x))),{children:r(c,{type:"close"})})):null,le=e(i,{"aria-modal":!M&&ie,"aria-describedby":w||te,"aria-label":v,"aria-labelledby":k||v?k:oe,"data-component":"sidebar","data-element":F,"data-role":S,ref:ne,position:N,size:z,onCancel:L,role:R,width:Q,widthAnimation:W&&re,className:Y,children:[D&&r(u,P(g({headerVariant:B,closeIcon:se()},q),{id:oe,children:D})),H&&r(p,P(g({},G),{id:te,children:H})),!D&&se(),r(s,P(g({"data-element":"sidebar-content","data-role":"sidebar-content",tabIndex:-1},f($)),{children:r(O.Provider,{value:{isInSidebar:!0},children:K})}))]});return r(n,{open:C,onCancel:L,disableEscKey:I,enableBackgroundUI:M,topModalOverride:J,restoreFocusOnClose:X,children:M?le:r(d,{wrapperRef:ae,isOpen:C,additionalWrapperRefs:U,focusableSelectors:V,focusFirstElement:T,autoFocus:!A,bespokeTrap:E,children:le})})}));w.displayName="Sidebar";export{w as Sidebar,w as default};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../__internal__/modal/modal.component.js"),a=require("./sidebar.style.js"),n=require("../icon-button/icon-button.component.js"),o=require("../icon/icon.component.js"),i=require("../../__internal__/focus-trap/focus-trap.component.js"),s=require("./__internal__/sidebar-header/sidebar-header.component.js"),l=require("../../__internal__/utils/helpers/guid/index.js"),d=require("../../hooks/__internal__/useLocale/useLocale.js"),u=require("../../style/utils/filter-styled-system-padding-props.js"),c=require("../../__internal__/utils/helpers/tags/tags.js"),b=require("../../hooks/__internal__/useModalAria/useModalAria.js"),p=require("./__internal__/sidebar.context.js"),f=require("../../hooks/useMediaQuery/useMediaQuery.js");function y(e){return e&&e.__esModule?e:{default:e}}function j(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function h(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},a=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),a.forEach((function(r){j(e,r,t[r])}))}return e}function m(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})),e}const O=y(r).default.forwardRef(((y,j)=>{var{"aria-describedby":O,"aria-label":_,"aria-labelledby":g,"data-element":P="sidebar","data-role":w,open:S,bespokeFocusTrap:x,closeButtonDataProps:v,disableAutoFocus:q=!1,disableEscKey:k=!1,enableBackgroundUI:C=!1,header:F,headerVariant:E="light",subHeader:M,position:A="right",size:D="medium",children:I,onCancel:R,role:B="dialog",focusFirstElement:H,focusableContainers:N,focusableSelectors:z,width:K,widthAnimation:L=!1,headerPadding:T={},subHeaderPadding:U={},topModalOverride:V,restoreFocusOnClose:Q=!0,className:W,hidden:G}=y,J=function(e,r){if(null==e)return{};var t,a,n=function(e,r){if(null==e)return{};var t,a,n={},o=Object.keys(e);for(a=0;a<o.length;a++)t=o[a],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)t=o[a],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}(y,["aria-describedby","aria-label","aria-labelledby","data-element","data-role","open","bespokeFocusTrap","closeButtonDataProps","disableAutoFocus","disableEscKey","enableBackgroundUI","header","headerVariant","subHeader","position","size","children","onCancel","role","focusFirstElement","focusableContainers","focusableSelectors","width","widthAnimation","headerPadding","subHeaderPadding","topModalOverride","restoreFocusOnClose","className","hidden"]);const X=d.default(),Y=f.default("screen and (prefers-reduced-motion: no-preference)"),{current:Z}=r.useRef(l.default()),{current:$}=r.useRef(l.default()),ee=r.useRef(null),re=r.useCallback((e=>{ee.current=e,j&&("object"==typeof j&&(j.current=e),"function"==typeof j&&j(e))}),[j]),te=b.default(ee,G),ae=()=>R?e.jsx(n.default,m(h({"aria-label":X.sidebar.ariaLabels.close(),onClick:R},c.default("close",h({"data-element":"close"},v))),{children:e.jsx(o.default,{type:"close"})})):null,ne=e.jsxs(a.StyledSidebar,{"aria-modal":!C&&te,"aria-describedby":O||$,"aria-label":_,"aria-labelledby":g||_?g:Z,"data-component":"sidebar","data-element":P,"data-role":w,ref:re,position:A,size:D,onCancel:R,role:B,width:K,widthAnimation:L&&Y,className:W,children:[F&&e.jsx(s.default,m(h({headerVariant:E,closeIcon:ae()},T),{id:Z,children:F})),M&&e.jsx(s.SidebarSubHeader,m(h({},U),{id:$,children:M})),!F&&ae(),e.jsx(a.StyledSidebarContent,m(h({"data-element":"sidebar-content","data-role":"sidebar-content"},u.default(J)),{children:e.jsx(p.default.Provider,{value:{isInSidebar:!0},children:I})}))]});return e.jsx(t.default,{open:S,onCancel:R,disableEscKey:k,enableBackgroundUI:C,topModalOverride:V,restoreFocusOnClose:Q,children:C?ne:e.jsx(i.default,{wrapperRef:ee,isOpen:S,additionalWrapperRefs:N,focusableSelectors:z,focusFirstElement:H,autoFocus:!q,bespokeTrap:x,children:ne})})}));O.displayName="Sidebar",exports.Sidebar=O,exports.default=O;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../__internal__/modal/modal.component.js"),a=require("./sidebar.style.js"),n=require("../icon-button/icon-button.component.js"),o=require("../icon/icon.component.js"),i=require("../../__internal__/focus-trap/focus-trap.component.js"),s=require("./__internal__/sidebar-header/sidebar-header.component.js"),l=require("../../__internal__/utils/helpers/guid/index.js"),d=require("../../hooks/__internal__/useLocale/useLocale.js"),u=require("../../style/utils/filter-styled-system-padding-props.js"),c=require("../../__internal__/utils/helpers/tags/tags.js"),b=require("../../hooks/__internal__/useModalAria/useModalAria.js"),p=require("./__internal__/sidebar.context.js"),f=require("../../hooks/useMediaQuery/useMediaQuery.js");function y(e){return e&&e.__esModule?e:{default:e}}function j(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function h(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},a=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),a.forEach((function(r){j(e,r,t[r])}))}return e}function m(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})),e}const O=y(r).default.forwardRef(((y,j)=>{var{"aria-describedby":O,"aria-label":_,"aria-labelledby":g,"data-element":P="sidebar","data-role":w,open:x,bespokeFocusTrap:S,closeButtonDataProps:v,disableAutoFocus:q=!1,disableEscKey:k=!1,enableBackgroundUI:C=!1,header:F,headerVariant:E="light",subHeader:M,position:A="right",size:I="medium",children:D,onCancel:R,role:B="dialog",focusFirstElement:H,focusableContainers:N,focusableSelectors:z,width:K,widthAnimation:L=!1,headerPadding:T={},subHeaderPadding:U={},topModalOverride:V,restoreFocusOnClose:Q=!0,className:W,hidden:G}=y,J=function(e,r){if(null==e)return{};var t,a,n=function(e,r){if(null==e)return{};var t,a,n={},o=Object.keys(e);for(a=0;a<o.length;a++)t=o[a],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)t=o[a],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}(y,["aria-describedby","aria-label","aria-labelledby","data-element","data-role","open","bespokeFocusTrap","closeButtonDataProps","disableAutoFocus","disableEscKey","enableBackgroundUI","header","headerVariant","subHeader","position","size","children","onCancel","role","focusFirstElement","focusableContainers","focusableSelectors","width","widthAnimation","headerPadding","subHeaderPadding","topModalOverride","restoreFocusOnClose","className","hidden"]);const X=d.default(),Y=f.default("screen and (prefers-reduced-motion: no-preference)"),{current:Z}=r.useRef(l.default()),{current:$}=r.useRef(l.default()),ee=r.useRef(null),re=r.useCallback((e=>{ee.current=e,j&&("object"==typeof j&&(j.current=e),"function"==typeof j&&j(e))}),[j]),te=b.default(ee,G),ae=()=>R?e.jsx(n.default,m(h({"aria-label":X.sidebar.ariaLabels.close(),onClick:R},c.default("close",h({"data-element":"close"},v))),{children:e.jsx(o.default,{type:"close"})})):null,ne=e.jsxs(a.StyledSidebar,{"aria-modal":!C&&te,"aria-describedby":O||$,"aria-label":_,"aria-labelledby":g||_?g:Z,"data-component":"sidebar","data-element":P,"data-role":w,ref:re,position:A,size:I,onCancel:R,role:B,width:K,widthAnimation:L&&Y,className:W,children:[F&&e.jsx(s.default,m(h({headerVariant:E,closeIcon:ae()},T),{id:Z,children:F})),M&&e.jsx(s.SidebarSubHeader,m(h({},U),{id:$,children:M})),!F&&ae(),e.jsx(a.StyledSidebarContent,m(h({"data-element":"sidebar-content","data-role":"sidebar-content",tabIndex:-1},u.default(J)),{children:e.jsx(p.default.Provider,{value:{isInSidebar:!0},children:D})}))]});return e.jsx(t.default,{open:x,onCancel:R,disableEscKey:k,enableBackgroundUI:C,topModalOverride:V,restoreFocusOnClose:Q,children:C?ne:e.jsx(i.default,{wrapperRef:ee,isOpen:x,additionalWrapperRefs:N,focusableSelectors:z,focusFirstElement:H,autoFocus:!q,bespokeTrap:S,children:ne})})}));O.displayName="Sidebar",exports.Sidebar=O,exports.default=O;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "159.13.2",
3
+ "version": "159.13.3",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",