carbon-react 159.2.0 → 159.2.2
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/action-popover/action-popover-item/action-popover-item.component.js +1 -1
- package/esm/components/action-popover/action-popover.component.js +1 -1
- package/esm/components/dialog/__internal__/__next__/__internal__/tokens/index.d.ts +3 -0
- package/esm/components/dialog/__internal__/__next__/__internal__/tokens/index.js +1 -0
- package/esm/components/dialog/__internal__/__next__/dialog.config.d.ts +3 -3
- package/esm/components/dialog/__internal__/__next__/dialog.config.js +1 -1
- package/esm/components/dialog/__internal__/__next__/dialog.style.d.ts +3 -3
- package/lib/components/action-popover/action-popover-item/action-popover-item.component.js +1 -1
- package/lib/components/action-popover/action-popover.component.js +1 -1
- package/lib/components/dialog/__internal__/__next__/__internal__/tokens/index.d.ts +3 -0
- package/lib/components/dialog/__internal__/__next__/__internal__/tokens/index.js +1 -0
- package/lib/components/dialog/__internal__/__next__/__internal__/tokens/package.json +6 -0
- package/lib/components/dialog/__internal__/__next__/dialog.config.d.ts +3 -3
- package/lib/components/dialog/__internal__/__next__/dialog.config.js +1 -1
- package/lib/components/dialog/__internal__/__next__/dialog.style.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import r,{useState as n,useRef as o,useCallback as i,useEffect as u}from"react";import c from"invariant";import{StyledMenuItemWrapper as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import r,{useState as n,useRef as o,useCallback as i,useEffect as u}from"react";import c from"invariant";import{StyledMenuItemWrapper as a,StyledMenuItem as l,SubMenuItemIcon as s,MenuItemIcon as p,StyledMenuItemInnerText as f}from"../action-popover.style.js";import m from"../../../__internal__/utils/helpers/events/events.js";import d from"../../../__internal__/utils/helpers/guid/index.js";import{useActionPopoverContext as v}from"../__internal__/action-popover.context.js";import b from"../action-popover-menu/action-popover-menu.component.js";function y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(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){y(e,t,r[t])}))}return e}function P(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function g(e){return Boolean(e&&e.current)}const O=y=>{var{children:O,icon:j,disabled:w=!1,onClick:_,submenu:S,focusItem:D,download:E,href:x,currentSubmenuPosition:I,setCurrentSubmenuPosition:K}=y,k=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(y,["children","icon","disabled","onClick","submenu","focusItem","download","href","currentSubmenuPosition","setCurrentSubmenuPosition"]);c(!r.isValidElement(S)||S.type===b,"ActionPopoverItem only accepts submenu of type `ActionPopoverMenu`");const{setOpenPopover:C,focusButton:T,submenuPosition:A,selectedSubmenuRef:L,setSelectedSubmenuRef:M}=v(),[R,B]=n(void 0),[W]=n(d()),[$,V]=n(!1),[z,F]=n(0),N=o(null),q=o(null),G=o(null),H=o(null),J=i((()=>{const e=function(e,t,r,n){if(!e.current||!t.current)return n||r;const{left:o,right:i}=e.current.getBoundingClientRect(),{offsetWidth:u}=t.current,c=document.body.clientWidth;return"left"===r?o>=u?"left":"right":c>=i+u?"right":"left"}(q,N,A,I);return null==K||K(e),g(q)&&g(N)&&S}),[S,K,A,I]);u((()=>{!w&&N.current&&V(L===N.current)}),[w,L]),u((()=>{B((()=>{if(!q.current||!N.current)return;const{offsetWidth:e}=N.current,t="left"===I;return{left:t?-e:"auto",right:t?"auto":-e}}))}),[S,I]),u((()=>{S&&J()}),[J,S]),u((()=>{D&&setTimeout((()=>{var e;null===(e=q.current)||void 0===e||e.focus()}),0)}),[D]),u((()=>function(){G.current&&clearTimeout(G.current),H.current&&clearTimeout(H.current)}),[]),u((()=>{const e="resize";return window.addEventListener(e,J),function(){window.removeEventListener(e,J)}}),[J]);const Q=i((e=>{var t;e.stopPropagation(),w?(null===(t=q.current)||void 0===t||t.focus(),e.preventDefault()):(C(!1),T(),_&&_(e))}),[w,T,_,C]),U=i((e=>{if(m.isSpaceKey(e))e.preventDefault(),e.stopPropagation();else if(w)m.isEnterKey(e)&&e.stopPropagation();else if(S){var t;if("left"===I){if(m.isLeftKey(e)||m.isEnterKey(e))M(N.current),V(!0),F(0),e.stopPropagation();else if(m.isRightKey(e)){var r;V(!1),null===(r=q.current)||void 0===r||r.focus(),e.stopPropagation()}}else(m.isRightKey(e)||m.isEnterKey(e))&&(V(!0),F(0),e.stopPropagation()),m.isLeftKey(e)&&(V(!1),null===(t=q.current)||void 0===t||t.focus(),e.stopPropagation());e.preventDefault()}else m.isEnterKey(e)&&(x||(e.preventDefault(),Q(e)))}),[w,S,I,M,Q,x]),X=P(h({},!w&&{onClick:e=>{var t;M(N.current),V(!0),null===(t=q.current)||void 0===t||t.focus(),e.preventDefault(),e.stopPropagation()}}),{"aria-haspopup":"true","aria-controls":`ActionPopoverMenu_${W}`,"aria-expanded":$}),Y=h({},!w&&{onMouseEnter:e=>{G.current&&clearTimeout(G.current),F(-1),G.current=setTimeout((()=>{V(!0),M(N.current)}),150),e.stopPropagation()},onMouseLeave:e=>{H.current&&clearTimeout(H.current),H.current=setTimeout((()=>{V(!1)}),150),e.stopPropagation()}});return e(a,P(h({onKeyDown:U},S&&Y),{children:[e(l,P(h(P(h({},k),{ref:q,onClick:Q,type:"button",tabIndex:0,isDisabled:w}),w&&{"aria-disabled":!0},!!x&&{as:"a",download:E,href:x},S&&X),{children:[S&&g(q)&&t(s,{"aria-hidden":!0,"data-element":"action-popover-menu-item-chevron","data-role":"chevron-icon",type:"left"===I?"chevron_left_thick":"chevron_right_thick"}),j&&t(p,{"aria-hidden":!0,type:j,"data-element":"action-popover-menu-item-icon","data-role":"item-icon"}),t(f,{"data-element":"action-popover-menu-item-inner-text",children:O})]})),r.isValidElement(S)?r.cloneElement(S,{parentID:`ActionPopoverItem_${W}`,menuID:`ActionPopoverMenu_${W}`,"data-element":"action-popover-submenu",isOpen:$,ref:N,style:R,setOpen:V,setFocusIndex:F,focusIndex:z}):null]}))};O.displayName="ActionPopoverItem";export{O as ActionPopoverItem,O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import o,{forwardRef as r,useState as n,useRef as a,useContext as i,useMemo as l,useCallback as p,useImperativeHandle as c,useEffect as s}from"react";import u from"invariant";import d from"../../__internal__/utils/helpers/tags/tags.js";import{MenuItemDivider as b,MenuButton as m,StyledButtonIcon as f,ButtonIcon as v}from"./action-popover.style.js";import y from"../../__internal__/utils/helpers/events/events.js";import _ from"../../__internal__/popover/popover.component.js";import O from"../../__internal__/utils/helpers/guid/index.js";import j from"../../hooks/__internal__/useLocale/useLocale.js";import g from"./action-popover-menu/action-popover-menu.component.js";import{ActionPopoverItem as h}from"./action-popover-item/action-popover-item.component.js";import"./action-popover-divider/action-popover-divider.component.js";import{ActionPopoverProvider as P}from"./__internal__/action-popover.context.js";import x from"../../hooks/__internal__/useModalManager/useModalManager.js";import w from"../../hooks/__internal__/useAdaptiveSidebarModalFocus/useAdaptiveSidebarModalFocus.js";import{getItems as A,findFirstFocusableItem as S,findLastFocusableItem as D,checkChildrenForString as I}from"./__internal__/action-popover.utils.js";import M from"../flat-table/__internal__/flat-table.context.js";function k(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const E=()=>{},
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import o,{forwardRef as r,useState as n,useRef as a,useContext as i,useMemo as l,useCallback as p,useImperativeHandle as c,useEffect as s}from"react";import u from"invariant";import d from"../../__internal__/utils/helpers/tags/tags.js";import{MenuItemDivider as b,MenuButton as m,StyledButtonIcon as f,ButtonIcon as v}from"./action-popover.style.js";import y from"../../__internal__/utils/helpers/events/events.js";import _ from"../../__internal__/popover/popover.component.js";import O from"../../__internal__/utils/helpers/guid/index.js";import j from"../../hooks/__internal__/useLocale/useLocale.js";import g from"./action-popover-menu/action-popover-menu.component.js";import{ActionPopoverItem as h}from"./action-popover-item/action-popover-item.component.js";import"./action-popover-divider/action-popover-divider.component.js";import{ActionPopoverProvider as P}from"./__internal__/action-popover.context.js";import x from"../../hooks/__internal__/useModalManager/useModalManager.js";import w from"../../hooks/__internal__/useAdaptiveSidebarModalFocus/useAdaptiveSidebarModalFocus.js";import{getItems as A,findFirstFocusableItem as S,findLastFocusableItem as D,checkChildrenForString as I}from"./__internal__/action-popover.utils.js";import M from"../flat-table/__internal__/flat-table.context.js";function k(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const E=()=>{},B=()=>{},L=r(((r,L)=>{var{children:K,id:$,onOpen:C=E,onClose:F=B,rightAlignMenu:z,renderButton:R,placement:N="bottom",horizontalAlignment:U="left",submenuPosition:q="left","aria-label":T,"aria-labelledby":V,"aria-describedby":G}=r,H=function(e,t){if(null==e)return{};var o,r,n=function(e,t){if(null==e)return{};var o,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)o=a[r],t.indexOf(o)>=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)o=a[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}(r,["children","id","onOpen","onClose","rightAlignMenu","renderButton","placement","horizontalAlignment","submenuPosition","aria-label","aria-labelledby","aria-describedby"]);const J=j(),[Q,W]=n(!1),[X,Y]=n(0),[Z]=n(O()),ee=a(null),te=a(null),{isInFlatTable:oe}=i(M),[re,ne]=n(null),ae=l((()=>!o.Children.toArray(K).find((e=>!o.isValidElement(e)||e.type!==h&&e.type!==b))),[K]),ie=l((()=>A(K)),[K]),le=S(ie),pe=D(ie);u(ae,`ActionPopover only accepts children of type \`${h.displayName}\` and \`${b.displayName}\`.`);const ce=l((()=>"top"!==N||z?"top"===N&&z?"top-start":"bottom"===N&&z?"bottom-start":"bottom-end":"top-end"),[N,z]),se=p((e=>{e&&!Q&&C(),!e&&Q&&F(),W(e)}),[Q,C,F]),ue=p((()=>{var e;const t=null===(e=ee.current)||void 0===e?void 0:e.querySelector("[data-element='action-popover-button']");null==t||t.focus()}),[]);c(L,(()=>({focusButton(){ue()}})),[ue]);const de=p((e=>{e.stopPropagation();const t=!Q;Y(le),se(t),t||ue()}),[Q,le,se,ue]),be=p((e=>{const t=e.target;Boolean(null==t?void 0:t.closest("[data-element='action-popover-button']"))&&(y.isSpaceKey(e)||y.isDownKey(e)||y.isEnterKey(e)?(e.preventDefault(),e.stopPropagation(),Y(le),se(!0)):y.isUpKey(e)&&(e.preventDefault(),e.stopPropagation(),Y(pe),se(!0)))}),[le,pe,se]),me=p((e=>{y.isEscKey(e)&&(se(!1),ue())}),[se,ue]);x({open:Q,closeModal:me,modalRef:ee}),s((()=>{const e=({target:e})=>{var t,o;const r=null==te||null===(t=te.current)||void 0===t?void 0:t.contains(e),n=null==ee||null===(o=ee.current)||void 0===o?void 0:o.contains(e);r||n||se(!1)},t="click";return document.addEventListener(t,e,{capture:!0}),function(){document.removeEventListener(t,e,{capture:!0})}}),[se]),w((()=>W(!1)));const fe=$||`ActionPopoverButton_${Z}`,ve=`ActionPopoverMenu_${Z}`;return e(m,(ye=function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})))),r.forEach((function(t){k(e,t,o[t])}))}return e}({id:fe,onKeyDown:be,onClick:de,isOpen:Q,ref:ee},H,d("action-popover-wrapper",H)),_e=null!=(_e={children:[(e=>{if(R){const t=R({tabIndex:Q?-1:0,"data-element":"action-popover-button",ariaAttributes:{"aria-haspopup":"true","aria-label":T||J.actionPopover.ariaLabel(),"aria-labelledby":V,"aria-describedby":G,"aria-controls":e,"aria-expanded":`${Q}`}}),o=I(t);return R({tabIndex:Q?-1:0,"data-element":"action-popover-button",ariaAttributes:{"aria-haspopup":"true","aria-label":o?void 0:T||J.actionPopover.ariaLabel(),"aria-labelledby":V,"aria-describedby":G,"aria-controls":e,"aria-expanded":`${Q}`}})}return t(f,{role:"button","aria-haspopup":"true","aria-label":T||J.actionPopover.ariaLabel(),"aria-labelledby":V,"aria-describedby":G,"aria-controls":e,"aria-expanded":Q,tabIndex:Q?-1:0,"data-element":"action-popover-button",children:t(v,{type:"ellipsis_vertical"})})})(ve),t(P,{value:{setOpenPopover:se,focusButton:ue,submenuPosition:q,horizontalAlignment:U,selectedSubmenuRef:re,setSelectedSubmenuRef:ne},children:Q&&t(_,{placement:ce,reference:ee,disableBackgroundUI:oe,children:t(g,{"data-component":"action-popover",ref:te,parentID:fe,menuID:ve,focusIndex:X,setFocusIndex:Y,isOpen:Q,setOpen:se,placement:N,children:K})})})]})?_e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(ye,Object.getOwnPropertyDescriptors(_e)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t.push.apply(t,o)}return t}(Object(_e)).forEach((function(e){Object.defineProperty(ye,e,Object.getOwnPropertyDescriptor(_e,e))})),ye));var ye,_e}));export{L as ActionPopover,L as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const p="540px",x="850px",o="1080px";export{o as containerSizeDialogMaxwidthL,x as containerSizeDialogMaxwidthM,p as containerSizeDialogMaxwidthS};
|
|
@@ -16,15 +16,15 @@ export declare const DIALOG_MIN_WIDTH = "288px";
|
|
|
16
16
|
*/
|
|
17
17
|
export declare const DIALOG_SIZE_CONFIG: {
|
|
18
18
|
readonly small: {
|
|
19
|
-
readonly maxWidth:
|
|
19
|
+
readonly maxWidth: "540px";
|
|
20
20
|
readonly minWidth: "288px";
|
|
21
21
|
};
|
|
22
22
|
readonly medium: {
|
|
23
|
-
readonly maxWidth:
|
|
23
|
+
readonly maxWidth: "850px";
|
|
24
24
|
readonly minWidth: "288px";
|
|
25
25
|
};
|
|
26
26
|
readonly large: {
|
|
27
|
-
readonly maxWidth:
|
|
27
|
+
readonly maxWidth: "1080px";
|
|
28
28
|
readonly minWidth: "288px";
|
|
29
29
|
};
|
|
30
30
|
readonly fullscreen: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{containerSizeDialogMaxwidthS as i,containerSizeDialogMaxwidthM as m,containerSizeDialogMaxwidthL as t}from"
|
|
1
|
+
import{containerSizeDialogMaxwidthS as i,containerSizeDialogMaxwidthM as m,containerSizeDialogMaxwidthL as t}from"./__internal__/tokens/index.js";const d="288px",n={small:{maxWidth:i,minWidth:d},medium:{maxWidth:m,minWidth:d},large:{maxWidth:t,minWidth:d},fullscreen:{maxWidth:"100%",minWidth:"100%"}},e="medium";export{e as DEFAULT_SIZE,d as DIALOG_MIN_WIDTH,n as DIALOG_SIZE_CONFIG};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DialogProps } from "./dialog.component";
|
|
2
2
|
import { Size, ContentPaddingInterface } from "./dialog.config";
|
|
3
3
|
declare const dialogSizes: {
|
|
4
|
-
readonly small:
|
|
5
|
-
readonly medium:
|
|
6
|
-
readonly large:
|
|
4
|
+
readonly small: "540px";
|
|
5
|
+
readonly medium: "850px";
|
|
6
|
+
readonly large: "1080px";
|
|
7
7
|
};
|
|
8
8
|
declare const smallScreenBreakpoint = "600px";
|
|
9
9
|
/** Transient size prop shared across all styled dialog sub-components */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("invariant"),r=require("../action-popover.style.js"),o=require("../../../__internal__/utils/helpers/events/events.js"),u=require("../../../__internal__/utils/helpers/guid/index.js"),i=require("../__internal__/action-popover.context.js"),c=require("../action-popover-menu/action-popover-menu.component.js");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("invariant"),r=require("../action-popover.style.js"),o=require("../../../__internal__/utils/helpers/events/events.js"),u=require("../../../__internal__/utils/helpers/guid/index.js"),i=require("../__internal__/action-popover.context.js"),c=require("../action-popover-menu/action-popover-menu.component.js");function a(e){return e&&e.__esModule?e:{default:e}}var l=a(t),s=a(n);function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){f(e,t,n[t])}))}return e}function d(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function m(e){return Boolean(e&&e.current)}const v=n=>{var{children:a,icon:f,disabled:v=!1,onClick:b,submenu:y,focusItem:P,download:h,href:g,currentSubmenuPosition:O,setCurrentSubmenuPosition:j}=n,_=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n=u[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(r=0;r<u.length;r++)n=u[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(n,["children","icon","disabled","onClick","submenu","focusItem","download","href","currentSubmenuPosition","setCurrentSubmenuPosition"]);s.default(!l.default.isValidElement(y)||y.type===c.default,"ActionPopoverItem only accepts submenu of type `ActionPopoverMenu`");const{setOpenPopover:S,focusButton:x,submenuPosition:I,selectedSubmenuRef:w,setSelectedSubmenuRef:E}=i.useActionPopoverContext(),[D,k]=t.useState(void 0),[M]=t.useState(u.default()),[C,K]=t.useState(!1),[R,q]=t.useState(0),A=t.useRef(null),T=t.useRef(null),L=t.useRef(null),W=t.useRef(null),B=t.useCallback((()=>{const e=function(e,t,n,r){if(!e.current||!t.current)return r||n;const{left:o,right:u}=e.current.getBoundingClientRect(),{offsetWidth:i}=t.current,c=document.body.clientWidth;return"left"===n?o>=i?"left":"right":c>=u+i?"right":"left"}(T,A,I,O);return null==j||j(e),m(T)&&m(A)&&y}),[y,j,I,O]);t.useEffect((()=>{!v&&A.current&&K(w===A.current)}),[v,w]),t.useEffect((()=>{k((()=>{if(!T.current||!A.current)return;const{offsetWidth:e}=A.current,t="left"===O;return{left:t?-e:"auto",right:t?"auto":-e}}))}),[y,O]),t.useEffect((()=>{y&&B()}),[B,y]),t.useEffect((()=>{P&&setTimeout((()=>{var e;null===(e=T.current)||void 0===e||e.focus()}),0)}),[P]),t.useEffect((()=>function(){L.current&&clearTimeout(L.current),W.current&&clearTimeout(W.current)}),[]),t.useEffect((()=>{const e="resize";return window.addEventListener(e,B),function(){window.removeEventListener(e,B)}}),[B]);const $=t.useCallback((e=>{var t;e.stopPropagation(),v?(null===(t=T.current)||void 0===t||t.focus(),e.preventDefault()):(S(!1),x(),b&&b(e))}),[v,x,b,S]),V=t.useCallback((e=>{if(o.default.isSpaceKey(e))e.preventDefault(),e.stopPropagation();else if(v)o.default.isEnterKey(e)&&e.stopPropagation();else if(y){var t;if("left"===O){if(o.default.isLeftKey(e)||o.default.isEnterKey(e))E(A.current),K(!0),q(0),e.stopPropagation();else if(o.default.isRightKey(e)){var n;K(!1),null===(n=T.current)||void 0===n||n.focus(),e.stopPropagation()}}else(o.default.isRightKey(e)||o.default.isEnterKey(e))&&(K(!0),q(0),e.stopPropagation()),o.default.isLeftKey(e)&&(K(!1),null===(t=T.current)||void 0===t||t.focus(),e.stopPropagation());e.preventDefault()}else o.default.isEnterKey(e)&&(g||(e.preventDefault(),$(e)))}),[v,y,O,E,$,g]),z=d(p({},!v&&{onClick:e=>{var t;E(A.current),K(!0),null===(t=T.current)||void 0===t||t.focus(),e.preventDefault(),e.stopPropagation()}}),{"aria-haspopup":"true","aria-controls":`ActionPopoverMenu_${M}`,"aria-expanded":C}),F=p({},!v&&{onMouseEnter:e=>{L.current&&clearTimeout(L.current),q(-1),L.current=setTimeout((()=>{K(!0),E(A.current)}),150),e.stopPropagation()},onMouseLeave:e=>{W.current&&clearTimeout(W.current),W.current=setTimeout((()=>{K(!1)}),150),e.stopPropagation()}});return e.jsxs(r.StyledMenuItemWrapper,d(p({onKeyDown:V},y&&F),{children:[e.jsxs(r.StyledMenuItem,d(p(d(p({},_),{ref:T,onClick:$,type:"button",tabIndex:0,isDisabled:v}),v&&{"aria-disabled":!0},!!g&&{as:"a",download:h,href:g},y&&z),{children:[y&&m(T)&&e.jsx(r.SubMenuItemIcon,{"aria-hidden":!0,"data-element":"action-popover-menu-item-chevron","data-role":"chevron-icon",type:"left"===O?"chevron_left_thick":"chevron_right_thick"}),f&&e.jsx(r.MenuItemIcon,{"aria-hidden":!0,type:f,"data-element":"action-popover-menu-item-icon","data-role":"item-icon"}),e.jsx(r.StyledMenuItemInnerText,{"data-element":"action-popover-menu-item-inner-text",children:a})]})),l.default.isValidElement(y)?l.default.cloneElement(y,{parentID:`ActionPopoverItem_${M}`,menuID:`ActionPopoverMenu_${M}`,"data-element":"action-popover-submenu",isOpen:C,ref:A,style:D,setOpen:K,setFocusIndex:q,focusIndex:R}):null]}))};v.displayName="ActionPopoverItem",exports.ActionPopoverItem=v,exports.default=v;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("invariant"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("invariant"),o=require("../../__internal__/utils/helpers/tags/tags.js"),n=require("./action-popover.style.js"),a=require("../../__internal__/utils/helpers/events/events.js"),i=require("../../__internal__/popover/popover.component.js"),l=require("../../__internal__/utils/helpers/guid/index.js"),u=require("../../hooks/__internal__/useLocale/useLocale.js"),s=require("./action-popover-menu/action-popover-menu.component.js"),c=require("./action-popover-item/action-popover-item.component.js");require("./action-popover-divider/action-popover-divider.component.js");var p=require("./__internal__/action-popover.context.js"),d=require("../../hooks/__internal__/useModalManager/useModalManager.js"),b=require("../../hooks/__internal__/useAdaptiveSidebarModalFocus/useAdaptiveSidebarModalFocus.js"),f=require("./__internal__/action-popover.utils.js"),v=require("../flat-table/__internal__/flat-table.context.js");function m(e){return e&&e.__esModule?e:{default:e}}var y=m(t),_=m(r);function j(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const O=()=>{},g=()=>{},P=t.forwardRef(((r,m)=>{var{children:P,id:h,onOpen:x=O,onClose:I=g,rightAlignMenu:S,renderButton:q,placement:M="bottom",horizontalAlignment:A="left",submenuPosition:k="left","aria-label":w,"aria-labelledby":D,"aria-describedby":C}=r,B=function(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}(r,["children","id","onOpen","onClose","rightAlignMenu","renderButton","placement","horizontalAlignment","submenuPosition","aria-label","aria-labelledby","aria-describedby"]);const E=u.default(),[F,L]=t.useState(!1),[K,R]=t.useState(0),[$]=t.useState(l.default()),z=t.useRef(null),N=t.useRef(null),{isInFlatTable:U}=t.useContext(v.default),[H,T]=t.useState(null),V=t.useMemo((()=>!y.default.Children.toArray(P).find((e=>!y.default.isValidElement(e)||e.type!==c.ActionPopoverItem&&e.type!==n.MenuItemDivider))),[P]),G=t.useMemo((()=>f.getItems(P)),[P]),J=f.findFirstFocusableItem(G),Q=f.findLastFocusableItem(G);_.default(V,`ActionPopover only accepts children of type \`${c.ActionPopoverItem.displayName}\` and \`${n.MenuItemDivider.displayName}\`.`);const W=t.useMemo((()=>"top"!==M||S?"top"===M&&S?"top-start":"bottom"===M&&S?"bottom-start":"bottom-end":"top-end"),[M,S]),X=t.useCallback((e=>{e&&!F&&x(),!e&&F&&I(),L(e)}),[F,x,I]),Y=t.useCallback((()=>{var e;const t=null===(e=z.current)||void 0===e?void 0:e.querySelector("[data-element='action-popover-button']");null==t||t.focus()}),[]);t.useImperativeHandle(m,(()=>({focusButton(){Y()}})),[Y]);const Z=t.useCallback((e=>{e.stopPropagation();const t=!F;R(J),X(t),t||Y()}),[F,J,X,Y]),ee=t.useCallback((e=>{const t=e.target;Boolean(null==t?void 0:t.closest("[data-element='action-popover-button']"))&&(a.default.isSpaceKey(e)||a.default.isDownKey(e)||a.default.isEnterKey(e)?(e.preventDefault(),e.stopPropagation(),R(J),X(!0)):a.default.isUpKey(e)&&(e.preventDefault(),e.stopPropagation(),R(Q),X(!0)))}),[J,Q,X]),te=t.useCallback((e=>{a.default.isEscKey(e)&&(X(!1),Y())}),[X,Y]);d.default({open:F,closeModal:te,modalRef:z}),t.useEffect((()=>{const e=({target:e})=>{var t,r;const o=null==N||null===(t=N.current)||void 0===t?void 0:t.contains(e),n=null==z||null===(r=z.current)||void 0===r?void 0:r.contains(e);o||n||X(!1)},t="click";return document.addEventListener(t,e,{capture:!0}),function(){document.removeEventListener(t,e,{capture:!0})}}),[X]),b.default((()=>L(!1)));const re=h||`ActionPopoverButton_${$}`,oe=`ActionPopoverMenu_${$}`;return e.jsxs(n.MenuButton,(ne=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),o.forEach((function(t){j(e,t,r[t])}))}return e}({id:re,onKeyDown:ee,onClick:Z,isOpen:F,ref:z},B,o.default("action-popover-wrapper",B)),ae=null!=(ae={children:[(t=>{if(q){const e=q({tabIndex:F?-1:0,"data-element":"action-popover-button",ariaAttributes:{"aria-haspopup":"true","aria-label":w||E.actionPopover.ariaLabel(),"aria-labelledby":D,"aria-describedby":C,"aria-controls":t,"aria-expanded":`${F}`}}),r=f.checkChildrenForString(e);return q({tabIndex:F?-1:0,"data-element":"action-popover-button",ariaAttributes:{"aria-haspopup":"true","aria-label":r?void 0:w||E.actionPopover.ariaLabel(),"aria-labelledby":D,"aria-describedby":C,"aria-controls":t,"aria-expanded":`${F}`}})}return e.jsx(n.StyledButtonIcon,{role:"button","aria-haspopup":"true","aria-label":w||E.actionPopover.ariaLabel(),"aria-labelledby":D,"aria-describedby":C,"aria-controls":t,"aria-expanded":F,tabIndex:F?-1:0,"data-element":"action-popover-button",children:e.jsx(n.ButtonIcon,{type:"ellipsis_vertical"})})})(oe),e.jsx(p.ActionPopoverProvider,{value:{setOpenPopover:X,focusButton:Y,submenuPosition:k,horizontalAlignment:A,selectedSubmenuRef:H,setSelectedSubmenuRef:T},children:F&&e.jsx(i.default,{placement:W,reference:z,disableBackgroundUI:U,children:e.jsx(s.default,{"data-component":"action-popover",ref:N,parentID:re,menuID:oe,focusIndex:K,setFocusIndex:R,isOpen:F,setOpen:X,placement:M,children:P})})})]})?ae:{},Object.getOwnPropertyDescriptors?Object.defineProperties(ne,Object.getOwnPropertyDescriptors(ae)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(ae)).forEach((function(e){Object.defineProperty(ne,e,Object.getOwnPropertyDescriptor(ae,e))})),ne));var ne,ae}));exports.ActionPopover=P,exports.default=P;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.containerSizeDialogMaxwidthL="1080px",exports.containerSizeDialogMaxwidthM="850px",exports.containerSizeDialogMaxwidthS="540px";
|
|
@@ -16,15 +16,15 @@ export declare const DIALOG_MIN_WIDTH = "288px";
|
|
|
16
16
|
*/
|
|
17
17
|
export declare const DIALOG_SIZE_CONFIG: {
|
|
18
18
|
readonly small: {
|
|
19
|
-
readonly maxWidth:
|
|
19
|
+
readonly maxWidth: "540px";
|
|
20
20
|
readonly minWidth: "288px";
|
|
21
21
|
};
|
|
22
22
|
readonly medium: {
|
|
23
|
-
readonly maxWidth:
|
|
23
|
+
readonly maxWidth: "850px";
|
|
24
24
|
readonly minWidth: "288px";
|
|
25
25
|
};
|
|
26
26
|
readonly large: {
|
|
27
|
-
readonly maxWidth:
|
|
27
|
+
readonly maxWidth: "1080px";
|
|
28
28
|
readonly minWidth: "288px";
|
|
29
29
|
};
|
|
30
30
|
readonly fullscreen: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var i=require("
|
|
1
|
+
"use strict";var i=require("./__internal__/tokens/index.js");const t="288px",e={small:{maxWidth:i.containerSizeDialogMaxwidthS,minWidth:t},medium:{maxWidth:i.containerSizeDialogMaxwidthM,minWidth:t},large:{maxWidth:i.containerSizeDialogMaxwidthL,minWidth:t},fullscreen:{maxWidth:"100%",minWidth:"100%"}};exports.DEFAULT_SIZE="medium",exports.DIALOG_MIN_WIDTH=t,exports.DIALOG_SIZE_CONFIG=e;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DialogProps } from "./dialog.component";
|
|
2
2
|
import { Size, ContentPaddingInterface } from "./dialog.config";
|
|
3
3
|
declare const dialogSizes: {
|
|
4
|
-
readonly small:
|
|
5
|
-
readonly medium:
|
|
6
|
-
readonly large:
|
|
4
|
+
readonly small: "540px";
|
|
5
|
+
readonly medium: "850px";
|
|
6
|
+
readonly large: "1080px";
|
|
7
7
|
};
|
|
8
8
|
declare const smallScreenBreakpoint = "600px";
|
|
9
9
|
/** Transient size prop shared across all styled dialog sub-components */
|