carbon-react 158.34.1 → 158.35.1

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.
Files changed (38) hide show
  1. package/esm/__internal__/label/label.component.js +1 -1
  2. package/esm/components/button/__next__/button.component.js +1 -1
  3. package/esm/components/date/date.component.js +1 -1
  4. package/esm/components/draggable/__internal__/drag-drop-provider.js +1 -1
  5. package/esm/components/heading/heading.component.js +1 -1
  6. package/esm/components/menu/__internal__/submenu/submenu.component.js +1 -1
  7. package/esm/components/message/message.component.js +1 -1
  8. package/esm/components/message/message.style.js +1 -1
  9. package/esm/components/popover-container/popover-container.component.js +1 -1
  10. package/esm/components/radio-button/radio-button.component.js +1 -1
  11. package/esm/components/select/filterable-select/filterable-select.component.js +1 -1
  12. package/esm/components/select/multi-select/multi-select.component.js +1 -1
  13. package/esm/components/split-button/split-button.component.js +1 -1
  14. package/esm/components/tabs/__next__/tabs.component.js +1 -1
  15. package/esm/components/text-editor/__internal__/__nodes__/mention.node.js +1 -1
  16. package/esm/components/text-editor/__internal__/__ui__/Toolbar/toolbar.component.js +1 -1
  17. package/esm/components/textarea/index.js +1 -1
  18. package/esm/components/tokens-wrapper/__internal__/static-tokens/index.d.ts +1 -1
  19. package/esm/components/tokens-wrapper/__internal__/static-tokens/index.js +1 -1
  20. package/esm/components/tooltip/tooltip.component.js +1 -1
  21. package/esm/components/vertical-menu/responsive-vertical-menu/responsive-vertical-menu-item/responsive-vertical-menu-item.component.js +1 -1
  22. package/esm/components/vertical-menu/responsive-vertical-menu/responsive-vertical-menu.context.js +1 -1
  23. package/esm/hooks/__internal__/useStableCallback/index.js +1 -1
  24. package/esm/hooks/use-multi-input/index.js +1 -1
  25. package/esm/index.js +1 -1
  26. package/lib/components/button/__next__/button.component.js +1 -1
  27. package/lib/components/menu/__internal__/submenu/submenu.component.js +1 -1
  28. package/lib/components/message/message.component.js +1 -1
  29. package/lib/components/message/message.style.js +1 -1
  30. package/lib/components/select/filterable-select/filterable-select.component.js +1 -1
  31. package/lib/components/select/multi-select/multi-select.component.js +1 -1
  32. package/lib/components/textarea/index.js +1 -1
  33. package/lib/components/tokens-wrapper/__internal__/static-tokens/index.d.ts +1 -1
  34. package/lib/components/tokens-wrapper/__internal__/static-tokens/index.js +1 -1
  35. package/lib/hooks/__internal__/useStableCallback/index.js +1 -1
  36. package/lib/hooks/use-multi-input/index.js +1 -1
  37. package/lib/index.js +1 -1
  38. package/package.json +3 -4
@@ -1 +1 @@
1
- import{jsxs as e,jsx as r}from"react/jsx-runtime";import o,{useState as n,useContext as t,useRef as i}from"react";import{Help as l}from"../../components/help/help.component.js";import a,{StyledLabelContainer as c}from"./label.style.js";import{ValidationIcon as s}from"../validations/validation-icon.component.js";import p from"./icon-wrapper.style.js";import{InputContext as u}from"../input-behaviour/input-behaviour.component.js";import{InputGroupContext as d}from"../input-behaviour/input-group-behaviour.component.js";import b from"../utils/helpers/guid/index.js";function m(e,r,o){return r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}function f(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})))),n.forEach((function(r){m(e,r,o[r])}))}return e}function g(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 h=({align:o,as:m="label",children:h,disabled:O,error:j,help:y,helpIcon:w,htmlFor:v,info:P,inline:k,isDarkBackground:I=!1,isRequired:D,labelId:M,pr:E,pl:F,tooltipId:L,useValidationIcon:S=!0,validationIconId:x,warning:B,width:q=30,className:C,onClick:N,"aria-label":R,isLarge:V})=>{const[$,z]=n(!1),{onMouseEnter:A,onMouseLeave:G}=t(u),{onMouseEnter:H,onMouseLeave:J}=t(d),K=i(b());let Q;return Q=k&&!o?"right":o||"left",e(c,{"data-role":"label-container",id:`label-container-${null!=M?M:K.current}`,align:Q,inline:k,width:q,pr:E,pl:F,className:C,onClick:N,children:[r(a,g(f({"data-element":"label",disabled:O,id:M},"label"===m?{htmlFor:v}:{}),{onMouseEnter:()=>{A&&A(),H&&H()},onMouseLeave:()=>{G&&G(),J&&J()},isRequired:D,as:m,"aria-label":R,isDarkBackground:I,isLarge:V,children:h})),(()=>{const e={onFocus:()=>z(!0),onBlur:()=>z(!1)};if(S&&(({error:e,warning:r,info:o,disabled:n})=>!n&&"string"==typeof(e||r||o))({error:j,warning:B,info:P,disabled:O})){const e=(({error:e,warning:r,info:o,inline:n})=>(e||r||o)&&n?"top":"right")({error:j,warning:B,info:P,inline:k});return r(p,{children:r(s,{tooltipId:x,error:j,warning:B,info:P,tooltipPosition:e,tooltipFlipOverrides:["top","bottom"]})})}return y&&r(p,g(f({},e),{children:r(l,{tooltipId:L,type:w,isFocused:$,children:y})}))})()]})};var O=o.memo(h);export{h as Label,O as default};
1
+ import{jsxs as e,jsx as r}from"react/jsx-runtime";import o,{useState as n,useContext as t,useRef as i}from"react";import{Help as l}from"../../components/help/help.component.js";import a,{StyledLabelContainer as c}from"./label.style.js";import{ValidationIcon as s}from"../validations/validation-icon.component.js";import p from"./icon-wrapper.style.js";import{InputContext as u}from"../input-behaviour/input-behaviour.component.js";import{InputGroupContext as b}from"../input-behaviour/input-group-behaviour.component.js";import d from"../utils/helpers/guid/index.js";function m(e,r,o){return r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}function f(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})))),n.forEach((function(r){m(e,r,o[r])}))}return e}function g(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 h=({align:o,as:m="label",children:h,disabled:O,error:j,help:y,helpIcon:w,htmlFor:v,info:P,inline:k,isDarkBackground:I=!1,isRequired:D,labelId:L,pr:M,pl:E,tooltipId:F,useValidationIcon:S=!0,validationIconId:x,warning:B,width:q=30,className:C,onClick:N,"aria-label":R,isLarge:V})=>{const[$,z]=n(!1),{onMouseEnter:A,onMouseLeave:G}=t(u),{onMouseEnter:H,onMouseLeave:J}=t(b),K=i(d());let Q;return Q=k&&!o?"right":o||"left",e(c,{"data-role":"label-container",id:`label-container-${null!=L?L:K.current}`,align:Q,inline:k,width:q,pr:M,pl:E,className:C,onClick:N,children:[r(a,g(f({"data-element":"label",disabled:O,id:L},"label"===m?{htmlFor:v}:{}),{onMouseEnter:()=>{A&&A(),H&&H()},onMouseLeave:()=>{G&&G(),J&&J()},isRequired:D,as:m,"aria-label":R,isDarkBackground:I,isLarge:V,children:h})),(()=>{const e={onFocus:()=>z(!0),onBlur:()=>z(!1)};if(S&&(({error:e,warning:r,info:o,disabled:n})=>!n&&"string"==typeof(e||r||o))({error:j,warning:B,info:P,disabled:O})){const e=(({error:e,warning:r,info:o,inline:n})=>(e||r||o)&&n?"top":"right")({error:j,warning:B,info:P,inline:k});return r(p,{children:r(s,{tooltipId:x,error:j,warning:B,info:P,tooltipPosition:e,tooltipFlipOverrides:["top","bottom"]})})}return y&&r(p,g(f({},e),{children:r(l,{tooltipId:F,type:w,isFocused:$,children:y})}))})()]})};var O=o.memo(h);export{h as Label,O as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{forwardRef as n,useRef as a,useImperativeHandle as i}from"react";import{StyledButton as o,StyledContentContainer as c}from"./button.style.js";import l from"../../../__internal__/utils/helpers/tags/tags.js";import u from"../../../hooks/useMediaQuery/useMediaQuery.js";import s from"./__internal__/utils/is-icon-only.js";import d from"../../icon/icon.component.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}function p(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}function b(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 f=n(((n,y)=>{var{"aria-describedby":f,"aria-label":v,"aria-labelledby":m,children:O,disabled:h=!1,fullWidth:j=!1,id:g,inverse:T,name:P,noWrap:w=!0,onClick:k,size:W="medium",variant:$="default",variantType:_="primary",buttonType:S,destructive:x,iconType:D,iconPosition:z="before",isWhite:B,href:C}=n,E=function(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(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)&&(a[t]=e[t])}return a}(n,["aria-describedby","aria-label","aria-labelledby","children","disabled","fullWidth","id","inverse","name","noWrap","onClick","size","variant","variantType","buttonType","destructive","iconType","iconPosition","isWhite","href"]);const M=a(null),Q=void 0!==O&&!1!==O,I=!!D&&!Q||s(O);i(y,(()=>({focusButton:()=>{var e;null===(e=M.current)||void 0===e||e.focus()}})),[]);const q=u("screen and (prefers-reduced-motion: no-preference)"),{variant:A,variantType:F}=(({buttonType:e,destructive:r,variant:t,variantType:n})=>{if(!e&&!r)return{variant:t,variantType:n};if(r)return{variant:"destructive",variantType:"primary"===(null!=e?e:n)?"primary":"secondary"};switch(e){case"primary":return{variant:"default",variantType:"primary"};case"tertiary":return{variant:"default",variantType:"tertiary"};case"darkBackground":default:return{variant:"default",variantType:"secondary"};case"gradient-grey":case"gradient-white":return{variant:"gradient",variantType:"secondary"}}})({buttonType:S,destructive:x,variant:$,variantType:_});return e(o,b(p({$allowMotion:q,"aria-describedby":f,"aria-label":v,"aria-labelledby":m,disabled:h,$fullWidth:j,$inverse:T||"darkBackground"===S||B,id:g,name:P,$noWrap:w,onClick:C?void 0:e=>{var r;null===(r=M.current)||void 0===r||r.focus({preventScroll:!0}),null==k||k(e)},ref:M,$size:W,$variant:A,$variantType:F,as:!h&&C?"a":"button",href:C,$iconOnly:I},l("button",E),E),{children:e(c,{"data-role":"button-child-container",children:(()=>{if(!D)return O;const n={"aria-hidden":!0,bg:"transparent"};return Q?r(t,"before"===z?{children:[e(d,b(p({type:D},n),{"data-role":"button-icon-before"})),O]}:{children:[O,e(d,b(p({type:D},n),{"data-role":"button-icon-after"}))]}):e(d,b(p({type:D},n),{"data-role":"button-icon-only"}))})()})}))}));export{f as Button,f as default};
1
+ import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{forwardRef as n,useRef as a,useImperativeHandle as i}from"react";import{StyledButton as o,StyledContentContainer as c}from"./button.style.js";import l from"../../../__internal__/utils/helpers/tags/tags.js";import u from"../../../hooks/useMediaQuery/useMediaQuery.js";import s from"./__internal__/utils/is-icon-only.js";import d from"../../icon/icon.component.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}function p(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}function b(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 f=n(((n,y)=>{var{"aria-describedby":f,"aria-label":v,"aria-labelledby":m,children:O,disabled:h=!1,fullWidth:j=!1,id:g,inverse:T,name:P,noWrap:w=!0,onClick:k,size:W="medium",variant:$="default",variantType:_="primary",buttonType:S,destructive:x,iconType:D,iconPosition:z="before",isWhite:B,href:C}=n,E=function(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(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)&&(a[t]=e[t])}return a}(n,["aria-describedby","aria-label","aria-labelledby","children","disabled","fullWidth","id","inverse","name","noWrap","onClick","size","variant","variantType","buttonType","destructive","iconType","iconPosition","isWhite","href"]);const M=a(null),Q=void 0!==O&&!1!==O,I=!!D&&!Q||s(O);i(y,(()=>({focusButton:()=>{var e;null===(e=M.current)||void 0===e||e.focus()}})),[]);const q=u("screen and (prefers-reduced-motion: no-preference)"),{variant:A,variantType:F}=(({buttonType:e,destructive:r,variant:t,variantType:n})=>{if(!e&&!r)return{variant:t,variantType:n};if(r)return{variant:"destructive",variantType:"primary"===(null!=e?e:n)?"primary":"secondary"};switch(e){case"primary":return{variant:"default",variantType:"primary"};case"tertiary":return{variant:"default",variantType:"tertiary"};case"darkBackground":default:return{variant:"default",variantType:"secondary"};case"gradient-grey":case"gradient-white":return{variant:"gradient",variantType:"secondary"}}})({buttonType:S,destructive:x,variant:$,variantType:_});return e(o,b(p({$allowMotion:q,"aria-describedby":f,"aria-label":v,"aria-labelledby":m,type:"button",disabled:h,$fullWidth:j,$inverse:T||"darkBackground"===S||B,id:g,name:P,$noWrap:w,onClick:C?void 0:e=>{var r;null===(r=M.current)||void 0===r||r.focus({preventScroll:!0}),null==k||k(e)},ref:M,$size:W,$variant:A,$variantType:F,as:!h&&C?"a":"button",href:C,$iconOnly:I},l("button",E),E),{children:e(c,{"data-role":"button-child-container",children:(()=>{if(!D)return O;const n={"aria-hidden":!0,bg:"transparent"};return Q?r(t,"before"===z?{children:[e(d,b(p({type:D},n),{"data-role":"button-icon-before"})),O]}:{children:[O,e(d,b(p({type:D},n),{"data-role":"button-icon-after"}))]}):e(d,b(p({type:D},n),{"data-role":"button-icon-only"}))})()})}))}));export{f as Button,f as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import r,{useRef as n,useMemo as o,useContext as a,useState as l,useCallback as i,useEffect as u}from"react";import{isValidLocaleDate as s,parseISODate as c,parseDate as p,checkISOFormatAndLength as d,findMatchedFormatAndValue as m,isDateValid as f,additionalYears as b,formattedValue as y,getSeparator as v,formatToISO as g}from"./__internal__/utils.js";import O from"../../hooks/__internal__/useLocale/useLocale.js";import _ from"../../__internal__/utils/helpers/events/events.js";import"../../style/utils/filter-styled-system-padding-props.js";import P from"../../style/utils/filter-styled-system-margin-props.js";import j from"../../style/utils/filter-out-styled-system-spacing-props.js";import k from"./__internal__/date-formats/index.js";import h from"./date.style.js";import{Textbox as w}from"../textbox/textbox.component.js";import{DatePicker as D}from"./__internal__/date-picker/date-picker.component.js";import x from"../date-range/__internal__/date-range.context.js";import L from"../../hooks/__internal__/useClickAwayListener/useClickAwayListener.js";import C from"../../__internal__/utils/helpers/guid/index.js";import B from"../../__internal__/utils/helpers/tags/tags.js";function W(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F(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){W(e,t,r[t])}))}return e}function A(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}const M=r.forwardRef(((r,W)=>{var{adaptiveLabelBreakpoint:M,allowEmptyValue:S,autoFocus:I,"data-element":E,"data-role":T,disabled:V,disablePortal:K=!0,helpAriaLabel:z,labelInline:R,minDate:N,maxDate:q,onBlur:G,onChange:$,onClick:H,onFocus:J,onKeyDown:Q,pickerProps:U,readOnly:X,size:Y="medium",tooltipPosition:Z,value:ee,inputWidth:te,labelWidth:re,maxWidth:ne,inputName:oe,onPickerClose:ae,onPickerOpen:le,dateFormatOverride:ie,datePickerAriaLabel:ue,datePickerAriaLabelledBy:se,validationMessagePositionTop:ce=!0}=r,pe=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(r,["adaptiveLabelBreakpoint","allowEmptyValue","autoFocus","data-element","data-role","disabled","disablePortal","helpAriaLabel","labelInline","minDate","maxDate","onBlur","onChange","onClick","onFocus","onKeyDown","pickerProps","readOnly","size","tooltipPosition","value","inputWidth","labelWidth","maxWidth","inputName","onPickerClose","onPickerOpen","dateFormatOverride","datePickerAriaLabel","datePickerAriaLabelledBy","validationMessagePositionTop"]);const de=n(null),me=n(null),fe=n(null),be=n(!1),ye=n(!1),ve=n(!1),ge=O(),{dateFnsLocale:Oe,dateFormatOverride:_e}=ge.date,{format:Pe,formats:je}=o((()=>k(Oe(),ie||_e)),[Oe,_e,ie]),{inputRefMap:ke,setInputRefMap:he,validationMessagePositionTop:we}=a(x),[De,xe]=l(!1),[Le,Ce]=l((()=>{if(s(ee,Oe()))return d(ee)?c(ee):p(Pe,ee)})),Be=n(!0),We=n(C()),Fe=null!=we?we:ce,Ae=e=>S&&!e.length?e:null,Me=e=>{const{id:t,name:r}=e.target,[n,o]=m(e.target.value,je),a="blur"===e.type?y(Pe,Le):e.target.value,l=f(p(n,o))?g(...b(n,o)):Ae(e.target.value);return{target:A(F({},r&&{name:r},t&&{id:t}),{value:{formattedValue:a,rawValue:l}})}},Se=L((()=>{var e,t;De&&(be.current=!0,null===(e=fe.current)||void 0===e||e.focus(),ye.current=!1,null===(t=fe.current)||void 0===t||t.blur(),xe(!1),null==ae||ae(),be.current=!1)}),"mousedown"),Ie=e=>{H&&H(e)},Ee=i((e=>{var t;fe.current=e,me.current=null==e?void 0:e.parentElement,W&&("function"==typeof W?W(e):W.current=e),oe&&(null==ke||null===(t=ke[oe])||void 0===t?void 0:t.setOpen)!==xe&&(null==he||he({[oe]:{isBlurBlocked:ye,setOpen:xe}}))}),[oe,ke,he,W]);u((()=>{const[e,t]=m(ee,je);e&&t&&f(p(e,t))?Ce(p(...b(e,t))):d(ee)&&Be.current?Ce(c(ee)):Ce(void 0)}),[ee,je]);const Te=P(pe);return e(h,A(F(A(F({ref:de,role:"presentation",size:Y,labelInline:R},Te),{applyDateRangeStyling:!!ke,maxWidth:ne,inputWidth:te}),B("date",{"data-element":E,"data-role":T})),{children:[t(w,A(F({},j(pe)),{"data-component":"date-input",value:(()=>{if(d(ee)&&Be.current)return y(Pe,c(ee));const e=v(ee),t=v(Pe),r=()=>ee.split("").map((r=>r===e?t:r)).join("");if(Be.current&&e!==t&&f(p(Pe,r()))){Be.current=!1;const[e,t]=m(r(),je);return y(Pe,p(...b(e,t)))}return ee})(),onBlur:e=>{if(V||X)return;let t;if(f(Le)){t=Me(e);const r=d(ee)?y(Pe,c(ee)):ee,[,n]=m(r,je);y(Pe,Le)!==n&&$(t)}else{const{id:r,name:n}=e.target;t={target:A(F({},n&&{name:n},r&&{id:r}),{value:{formattedValue:e.target.value,rawValue:Ae(e.target.value)}})}}ye.current||G&&G(t)},onChange:e=>{Be.current=!1,$(Me(e))},onClick:Ie,onFocus:e=>{V||X||(ye.current=!1,J&&J(e))},onKeyDown:e=>{if(Q&&Q(e),De&&_.isTabKey(e)){if(_.isShiftKey(e))xe(!1),null==ae||ae();else if(!K){var t,r;e.preventDefault(),null===(r=document)||void 0===r||null===(t=r.querySelector(`[id="${We.current}"]`))||void 0===t||t.focus()}be.current=!1}},iconOnClick:Ie,onMouseDown:()=>{Se(),he&&(ye.current=!0),De||null==le||le()},iconOnMouseDown:()=>{ye.current=!0,be.current=!0,Se(),De?(xe(!1),null==ae||ae()):(xe(!0),null==le||le())},inputIcon:"calendar",labelInline:R,ref:Ee,adaptiveLabelBreakpoint:M,tooltipPosition:Z,helpAriaLabel:z,autoFocus:I,size:Y,disabled:V,readOnly:X,inputWidth:te,labelWidth:re,maxWidth:ne,m:0,validationMessagePositionTop:Fe})),t(D,{disablePortal:K,inputElement:me,pickerProps:U,selectedDays:Le,onDayClick:(e,t)=>{var r;Ce(e),$(Me(A(F({},t),{target:A(F({},t.target),{value:y(Pe,e)})}))),ve.current=!0,null===(r=fe.current)||void 0===r||r.focus(),xe(!1)},minDate:N,maxDate:q,pickerMouseDown:()=>{ye.current=!0,Se()},open:De,setOpen:xe,pickerTabGuardId:We.current,onPickerClose:ae,ariaLabel:ue,ariaLabelledBy:se})]}))}));export{M as DateInput,M as default};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import r,{useRef as n,useMemo as o,useContext as a,useState as l,useCallback as i,useEffect as u}from"react";import{isValidLocaleDate as s,checkISOFormatAndLength as c,parseISODate as p,parseDate as d,findMatchedFormatAndValue as m,isDateValid as f,additionalYears as b,formattedValue as y,getSeparator as v,formatToISO as g}from"./__internal__/utils.js";import O from"../../hooks/__internal__/useLocale/useLocale.js";import _ from"../../__internal__/utils/helpers/events/events.js";import"../../style/utils/filter-styled-system-padding-props.js";import P from"../../style/utils/filter-styled-system-margin-props.js";import j from"../../style/utils/filter-out-styled-system-spacing-props.js";import k from"./__internal__/date-formats/index.js";import h from"./date.style.js";import{Textbox as w}from"../textbox/textbox.component.js";import{DatePicker as D}from"./__internal__/date-picker/date-picker.component.js";import x from"../date-range/__internal__/date-range.context.js";import L from"../../hooks/__internal__/useClickAwayListener/useClickAwayListener.js";import C from"../../__internal__/utils/helpers/guid/index.js";import B from"../../__internal__/utils/helpers/tags/tags.js";function W(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F(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){W(e,t,r[t])}))}return e}function A(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}const M=r.forwardRef(((r,W)=>{var{adaptiveLabelBreakpoint:M,allowEmptyValue:S,autoFocus:I,"data-element":E,"data-role":T,disabled:V,disablePortal:K=!0,helpAriaLabel:z,labelInline:R,minDate:N,maxDate:q,onBlur:G,onChange:$,onClick:H,onFocus:J,onKeyDown:Q,pickerProps:U,readOnly:X,size:Y="medium",tooltipPosition:Z,value:ee,inputWidth:te,labelWidth:re,maxWidth:ne,inputName:oe,onPickerClose:ae,onPickerOpen:le,dateFormatOverride:ie,datePickerAriaLabel:ue,datePickerAriaLabelledBy:se,validationMessagePositionTop:ce=!0}=r,pe=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(r,["adaptiveLabelBreakpoint","allowEmptyValue","autoFocus","data-element","data-role","disabled","disablePortal","helpAriaLabel","labelInline","minDate","maxDate","onBlur","onChange","onClick","onFocus","onKeyDown","pickerProps","readOnly","size","tooltipPosition","value","inputWidth","labelWidth","maxWidth","inputName","onPickerClose","onPickerOpen","dateFormatOverride","datePickerAriaLabel","datePickerAriaLabelledBy","validationMessagePositionTop"]);const de=n(null),me=n(null),fe=n(null),be=n(!1),ye=n(!1),ve=n(!1),ge=O(),{dateFnsLocale:Oe,dateFormatOverride:_e}=ge.date,{format:Pe,formats:je}=o((()=>k(Oe(),ie||_e)),[Oe,_e,ie]),{inputRefMap:ke,setInputRefMap:he,validationMessagePositionTop:we}=a(x),[De,xe]=l(!1),[Le,Ce]=l((()=>{if(s(ee,Oe()))return c(ee)?p(ee):d(Pe,ee)})),Be=n(!0),We=n(C()),Fe=null!=we?we:ce,Ae=e=>S&&!e.length?e:null,Me=e=>{const{id:t,name:r}=e.target,[n,o]=m(e.target.value,je),a="blur"===e.type?y(Pe,Le):e.target.value,l=f(d(n,o))?g(...b(n,o)):Ae(e.target.value);return{target:A(F({},r&&{name:r},t&&{id:t}),{value:{formattedValue:a,rawValue:l}})}},Se=L((()=>{var e,t;De&&(be.current=!0,null===(e=fe.current)||void 0===e||e.focus(),ye.current=!1,null===(t=fe.current)||void 0===t||t.blur(),xe(!1),null==ae||ae(),be.current=!1)}),"mousedown"),Ie=e=>{H&&H(e)},Ee=i((e=>{var t;fe.current=e,me.current=null==e?void 0:e.parentElement,W&&("function"==typeof W?W(e):W.current=e),oe&&(null==ke||null===(t=ke[oe])||void 0===t?void 0:t.setOpen)!==xe&&(null==he||he({[oe]:{isBlurBlocked:ye,setOpen:xe}}))}),[oe,ke,he,W]);u((()=>{const[e,t]=m(ee,je);e&&t&&f(d(e,t))?Ce(d(...b(e,t))):c(ee)&&Be.current?Ce(p(ee)):Ce(void 0)}),[ee,je]);const Te=P(pe);return e(h,A(F(A(F({ref:de,role:"presentation",size:Y,labelInline:R},Te),{applyDateRangeStyling:!!ke,maxWidth:ne,inputWidth:te}),B("date",{"data-element":E,"data-role":T})),{children:[t(w,A(F({},j(pe)),{"data-component":"date-input",value:(()=>{if(c(ee)&&Be.current)return y(Pe,p(ee));const e=v(ee),t=v(Pe),r=()=>ee.split("").map((r=>r===e?t:r)).join("");if(Be.current&&e!==t&&f(d(Pe,r()))){Be.current=!1;const[e,t]=m(r(),je);return y(Pe,d(...b(e,t)))}return ee})(),onBlur:e=>{if(V||X)return;let t;if(f(Le)){t=Me(e);const r=c(ee)?y(Pe,p(ee)):ee,[,n]=m(r,je);y(Pe,Le)!==n&&$(t)}else{const{id:r,name:n}=e.target;t={target:A(F({},n&&{name:n},r&&{id:r}),{value:{formattedValue:e.target.value,rawValue:Ae(e.target.value)}})}}ye.current||G&&G(t)},onChange:e=>{Be.current=!1,$(Me(e))},onClick:Ie,onFocus:e=>{V||X||(ye.current=!1,J&&J(e))},onKeyDown:e=>{if(Q&&Q(e),De&&_.isTabKey(e)){if(_.isShiftKey(e))xe(!1),null==ae||ae();else if(!K){var t,r;e.preventDefault(),null===(r=document)||void 0===r||null===(t=r.querySelector(`[id="${We.current}"]`))||void 0===t||t.focus()}be.current=!1}},iconOnClick:Ie,onMouseDown:()=>{Se(),he&&(ye.current=!0),De||null==le||le()},iconOnMouseDown:()=>{ye.current=!0,be.current=!0,Se(),De?(xe(!1),null==ae||ae()):(xe(!0),null==le||le())},inputIcon:"calendar",labelInline:R,ref:Ee,adaptiveLabelBreakpoint:M,tooltipPosition:Z,helpAriaLabel:z,autoFocus:I,size:Y,disabled:V,readOnly:X,inputWidth:te,labelWidth:re,maxWidth:ne,m:0,validationMessagePositionTop:Fe})),t(D,{disablePortal:K,inputElement:me,pickerProps:U,selectedDays:Le,onDayClick:(e,t)=>{var r;Ce(e),$(Me(A(F({},t),{target:A(F({},t.target),{value:y(Pe,e)})}))),ve.current=!0,null===(r=fe.current)||void 0===r||r.focus(),xe(!1)},minDate:N,maxDate:q,pickerMouseDown:()=>{ye.current=!0,Se()},open:De,setOpen:xe,pickerTabGuardId:We.current,onPickerClose:ae,ariaLabel:ue,ariaLabelledBy:se})]}))}));export{M as DateInput,M as default};
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import r,{createContext as a,useEffect as e}from"react";import{isDraggable as o,isDropTarget as n}from"./data.js";import{monitorForElements as d}from"@atlaskit/pragmatic-drag-and-drop/element/adapter";const c=a(null);function l(){return r.useContext(c)}const u=({children:a,onDrop:l})=>{const[u]=r.useState((()=>Symbol("draggable-context")));return e((()=>d({canMonitor:({source:t})=>o(t.data)&&t.data.contextId===u,onDrop:({source:t,location:r})=>{if(!o(t.data))return;if(!r.current.dropTargets.length)return void(null==l||l({dragged:t.data,target:null}));const a=r.current.dropTargets[0];n(a.data)&&(null==l||l({dragged:t.data,target:a.data}))}})),[u,l]),t(c.Provider,{value:{contextId:u},children:a})};export{u as DragDropProvider,l as useDragDropContext};
1
+ import{jsx as t}from"react/jsx-runtime";import r,{useEffect as a,createContext as e}from"react";import{isDraggable as o,isDropTarget as n}from"./data.js";import{monitorForElements as d}from"@atlaskit/pragmatic-drag-and-drop/element/adapter";const c=e(null);function l(){return r.useContext(c)}const u=({children:e,onDrop:l})=>{const[u]=r.useState((()=>Symbol("draggable-context")));return a((()=>d({canMonitor:({source:t})=>o(t.data)&&t.data.contextId===u,onDrop:({source:t,location:r})=>{if(!o(t.data))return;if(!r.current.dropTargets.length)return void(null==l||l({dragged:t.data,target:null}));const a=r.current.dropTargets[0];n(a.data)&&(null==l||l({dragged:t.data,target:a.data}))}})),[u,l]),t(c.Provider,{value:{contextId:u},children:e})};export{u as DragDropProvider,l as useDragDropContext};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import"react";import"../../style/utils/filter-styled-system-padding-props.js";import r from"../../style/utils/filter-styled-system-margin-props.js";import n from"../../__internal__/utils/helpers/tags/tags.js";import{StyledHeading as i,StyledHeader as a,StyledHeaderContent as l,StyledHeadingTitle as o,StyledSeparator as c,StyledDivider as s,StyledHeadingBackButton as d,StyledHeadingIcon as p,StyledSubHeader as u,StyledHeaderHelp as b,StyledHeadingPills as h}from"./heading.style.js";import f from"../../hooks/__internal__/useLocale/useLocale.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 m(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 g(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}const O=y=>{var{children:O,backLink:j,divider:k=!0,help:v,helpAriaLabel:P,helpLink:w,pills:L,separator:_=!1,subheader:S,subtitleId:D,headingType:I="h1",title:x,titleId:A}=y,E=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(y,["children","backLink","divider","help","helpAriaLabel","helpLink","pills","separator","subheader","subtitleId","headingType","title","titleId"]);const T=f(),B=r(E);return x?e(i,g(m({},n("heading",E),B),{children:[e(a,{"data-element":"header-container",divider:k,subheader:!!S,hasBackLink:!!j,children:[j&&(()=>{const e="string"==typeof j?{href:j}:{onClick:j};return t(d,g(m({"aria-label":T.heading.backLinkAriaLabel(),"data-element":"back","data-role":"heading-back-button",onMouseDown:e=>e.currentTarget.focus({preventScroll:!0})},e),{children:t(p,{type:"chevron_left"})}))})(),e(l,{children:[t(o,{withMargin:!!L||!!v,variant:I,"data-element":"title",id:A,children:x}),(v||w)&&t(b,{"data-element":"help",tooltipPosition:"right",href:w,ariaLabel:P,children:v}),L&&t(h,{"data-element":"pills","data-role":"heading-pills-container",children:L})]}),_&&t(c,{"data-role":"heading-separator"}),S&&t(u,{"data-element":"subtitle","data-role":"subtitle",id:D,hasBackLink:!!j,hasSeparator:_,children:S})]}),k&&t(s,{"data-element":"divider","data-role":"heading-divider"}),O]})):null};export{O as Heading,O as default};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import"react";import"../../style/utils/filter-styled-system-padding-props.js";import r from"../../style/utils/filter-styled-system-margin-props.js";import n from"../../__internal__/utils/helpers/tags/tags.js";import{StyledHeading as i,StyledHeader as a,StyledHeaderContent as l,StyledHeadingTitle as o,StyledSeparator as c,StyledDivider as s,StyledHeadingBackButton as d,StyledHeadingIcon as p,StyledHeaderHelp as u,StyledHeadingPills as b,StyledSubHeader as h}from"./heading.style.js";import f from"../../hooks/__internal__/useLocale/useLocale.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 m(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 g(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}const O=y=>{var{children:O,backLink:j,divider:k=!0,help:v,helpAriaLabel:P,helpLink:w,pills:L,separator:_=!1,subheader:S,subtitleId:D,headingType:I="h1",title:x,titleId:A}=y,E=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(y,["children","backLink","divider","help","helpAriaLabel","helpLink","pills","separator","subheader","subtitleId","headingType","title","titleId"]);const T=f(),B=r(E);return x?e(i,g(m({},n("heading",E),B),{children:[e(a,{"data-element":"header-container",divider:k,subheader:!!S,hasBackLink:!!j,children:[j&&(()=>{const e="string"==typeof j?{href:j}:{onClick:j};return t(d,g(m({"aria-label":T.heading.backLinkAriaLabel(),"data-element":"back","data-role":"heading-back-button",onMouseDown:e=>e.currentTarget.focus({preventScroll:!0})},e),{children:t(p,{type:"chevron_left"})}))})(),e(l,{children:[t(o,{withMargin:!!L||!!v,variant:I,"data-element":"title",id:A,children:x}),(v||w)&&t(u,{"data-element":"help",tooltipPosition:"right",href:w,ariaLabel:P,children:v}),L&&t(b,{"data-element":"pills","data-role":"heading-pills-container",children:L})]}),_&&t(c,{"data-role":"heading-separator"}),S&&t(h,{"data-element":"subtitle","data-role":"subtitle",id:D,hasBackLink:!!j,hasSeparator:_,children:S})]}),k&&t(s,{"data-element":"divider","data-role":"heading-divider"}),O]})):null};export{O as Heading,O as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import n,{useState as r,useRef as o,useContext as i,useMemo as u,useCallback as l,useEffect as a}from"react";import s from"../../menu-item/menu-item.style.js";import{StyledSubmenuWrapper as c,StyledSubmenu as m}from"./submenu.style.js";import p from"../../../../__internal__/utils/helpers/events/events.js";import{useStrictMenuContext as d}from"../strict-menu.context.js";import{characterNavigation as b}from"../keyboard-navigation/index.js";import f from"./submenu.context.js";import y from"../../../../__internal__/utils/helpers/guid/index.js";import{BLOCK_INDEX_SELECTOR as h,SCROLLABLE_BLOCK as v,SCROLLABLE_BLOCK_PARENT as g,ALL_CHILDREN_SELECTOR as O}from"../locators.js";import{useStableCallback as w}from"../../../../hooks/__internal__/useStableCallback/useStableCallback.js";import S from"../../../navigation-bar/__internal__/fixed-navigation-bar.context.js";import{defaultFocusableSelectors as j}from"../../../../__internal__/focus-trap/focus-trap-utils.js";function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(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){x(e,t,n[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 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}const A=n.forwardRef(((n,x)=>{var{children:A,className:_,title:T,icon:k,submenuDirection:I="right",onKeyDown:K,variant:C="default",showDropdownArrow:E=!0,clickToOpen:F,href:M,maxWidth:q,asPassiveItem:W,onSubmenuOpen:R,onSubmenuClose:V,onClick:H,submenuMaxWidth:L,submenuMinWidth:N}=n,$=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(n,["children","className","title","icon","submenuDirection","onKeyDown","variant","showDropdownArrow","clickToOpen","href","maxWidth","asPassiveItem","onSubmenuOpen","onSubmenuClose","onClick","submenuMaxWidth","submenuMinWidth"]);const[B,U]=r(null),z=o(y()),{inFullscreenView:G,openSubmenuId:J,setOpenSubmenuId:Q,menuType:X}=d(),[Y,Z]=r(!1),[ee,te]=r(null),[ne,re]=r([]),[oe,ie]=r(""),[ue,le]=r(!1),[ae,se]=r(!1),ce=ne.length,{submenuMaxHeight:me}=i(S),pe=w(R),de=u((()=>{const e=null==B?void 0:B.querySelectorAll(h);if(e&&Y&&ce){const t=Array.from(e),n=null==B?void 0:B.querySelector(`[data-component='${v}']`),r=n?t.indexOf(n):-1;return(null==n?void 0:n.querySelector(`[data-component='${g}']`))?r+1:r}return-1}),[Y,ce,B]),be=o(null),fe=l((()=>{be.current=setTimeout((()=>{ie("")}),1500)}),[]),ye=l((()=>{be.current&&clearTimeout(be.current),fe()}),[fe]);a((()=>()=>{be.current&&clearTimeout(be.current)}),[]);const he=l((()=>{Z(!0),Q(z.current)}),[Q]),ve=o();a((()=>{Y&&B&&(()=>{var e;if(!B)return;const t=Array.from(B.querySelectorAll("[data-component='menu-item']")||[]),n=t.length>0?t[t.length-1]:null;ve.current=null!=n?n:void 0,B.querySelectorAll("[data-last-visible-menu-item]").forEach((e=>e.removeAttribute("data-last-visible-menu-item"))),n&&n.setAttribute("data-last-visible-menu-item","true");const r=Array.from(B.querySelectorAll("ul:not([data-component='submenu'])")||[]);if(0===r.length)return le(!1),void se(!1);const o=r[r.length-1],i=(null==o||null===(e=o.parentElement)||void 0===e?void 0:e.dataset.component)===v,u=Array.from(o.querySelectorAll("[data-component='menu-item']")||[]),l=u.length>0?u[u.length-1]:null;let a=!1;l&&o&&(a=l.getBoundingClientRect().bottom<o.getBoundingClientRect().bottom);const s=!!l&&!!n&&l===n;le(s),se(s&&!i||s&&i&&!a)})()}),[Y,B,ce]),a((()=>{Y&&pe&&pe()}),[Y,pe]);const ge=l((()=>{Z(!1),te(null),V&&V(),ie("")}),[V]);a((()=>{J&&J!==z.current&&ge()}),[J,ge]);const Oe=l((e=>ne.findIndex((t=>t===e))),[ne]),we=l((e=>{const t=p.isEnterKey(e)||p.isSpaceKey(e);if(!t&&!p.isDownKey(e)||Y||(e.preventDefault(),he()),Y){const n=Oe(ee);let r=n;if(ee||((t&&!M||p.isSpaceKey(e)&&M)&&(e.preventDefault(),ge()),p.isShiftKey(e)&&p.isTabKey(e)&&ge()),p.isDownKey(e)&&(e.preventDefault(),r<ce-1&&(r+=1)),p.isUpKey(e)&&(e.preventDefault(),le(!1),r>0&&(r-=1)),p.isEscKey(e))return null==K||K(e),void ge();p.isHomeKey(e)&&(e.preventDefault(),e.stopPropagation(),r=0),p.isEndKey(e)&&(e.preventDefault(),e.stopPropagation(),r=ce-1),1===e.key.length?(e.stopPropagation(),be.current?ye():fe(),ie(`${oe}${e.key.toLowerCase()}`)):ie(""),p.composedPath(e.nativeEvent).find((e=>e instanceof HTMLElement&&("input"===e.getAttribute("data-element")||"input-icon-toggle"===e.getAttribute("data-element"))))||p.isEnterKey(e)&&setTimeout((()=>ge()),0),r!==n&&te(ne[r])}}),[ne,Y,M,ce,ee,Oe,he,ge,K,oe,ye,fe]);return a((()=>{if(B&&A){const e=null==B?void 0:B.querySelectorAll(O);e&&re(Array.from(e).filter((e=>e.querySelector(j))).map((e=>e.getAttribute("id"))))}}),[A,Y,B]),a((()=>{const e=null==B?void 0:B.querySelectorAll(O);if(e&&""!==oe){const t=Array.from(e),n=b(oe,t);n&&te(n.id)}}),[B,oe,ne]),e(c,G?{"data-component":"submenu-wrapper",inFullscreenView:G,asPassiveItem:W,menuType:X,children:[t(s,P(D({},$),{onClick:W?void 0:H,className:_,menuType:X,ref:x,href:M,menuItemVariant:C,inFullscreenView:G,asDiv:W,children:T})),t(m,{"data-component":"submenu",variant:C,menuType:X,inFullscreenView:G,ref:U,applyFocusRadiusStyling:!1,applyFocusRadiusStylingToLastItem:ae,children:t(f.Provider,{value:{handleKeyDown:we,blockIndex:de,updateFocusId:te},children:A})})]}:{"data-component":"submenu-wrapper","data-role":"submenu-wrapper",onMouseOver:F?void 0:()=>he(),onMouseLeave:()=>ge(),isSubmenuOpen:Y,ref:U,children:[t(s,P(D({},$),{className:_,menuType:X,ref:x,icon:k,tabIndex:-1,menuItemVariant:C,isOpen:Y,hasSubmenu:!0,showDropdownArrow:E,onKeyDown:we,onClick:e=>{he(),H&&H(e)},clickToOpen:F,href:M,maxWidth:q,"aria-expanded":Y,"data-role":"submenu-parent-item",children:T})),Y&&t(m,{"data-component":"submenu",submenuDirection:I,variant:C,menuType:X,role:0===de?"presentation":"list",maxHeight:me,applyFocusRadiusStyling:ue,applyFocusRadiusStylingToLastItem:ae,submenuMaxWidth:L,submenuMinWidth:N,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||ge()},children:t(f.Provider,{value:{submenuFocusId:ee,handleKeyDown:we,blockIndex:de,updateFocusId:te,submenuHasMaxWidth:!!L,closeSubmenu:ge},children:A})})]})}));A.displayName="submenu";export{A as default};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import n,{useState as r,useRef as o,useContext as i,useMemo as u,useCallback as l,useEffect as a}from"react";import s from"../../menu-item/menu-item.style.js";import{StyledSubmenuWrapper as c,StyledSubmenu as m}from"./submenu.style.js";import p from"../../../../__internal__/utils/helpers/events/events.js";import{useStrictMenuContext as d}from"../strict-menu.context.js";import{characterNavigation as b}from"../keyboard-navigation/index.js";import f from"./submenu.context.js";import y from"../../../../__internal__/utils/helpers/guid/index.js";import{BLOCK_INDEX_SELECTOR as h,SCROLLABLE_BLOCK as v,SCROLLABLE_BLOCK_PARENT as g,ALL_CHILDREN_SELECTOR as O}from"../locators.js";import w from"../../../../hooks/__internal__/useStableCallback/useStableCallback.js";import S from"../../../navigation-bar/__internal__/fixed-navigation-bar.context.js";import{defaultFocusableSelectors as j}from"../../../../__internal__/focus-trap/focus-trap-utils.js";function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(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){x(e,t,n[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 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}const A=n.forwardRef(((n,x)=>{var{children:A,className:_,title:T,icon:k,submenuDirection:I="right",onKeyDown:K,variant:C="default",showDropdownArrow:E=!0,clickToOpen:F,href:M,maxWidth:q,asPassiveItem:W,onSubmenuOpen:R,onSubmenuClose:V,onClick:H,submenuMaxWidth:L,submenuMinWidth:N}=n,$=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(n,["children","className","title","icon","submenuDirection","onKeyDown","variant","showDropdownArrow","clickToOpen","href","maxWidth","asPassiveItem","onSubmenuOpen","onSubmenuClose","onClick","submenuMaxWidth","submenuMinWidth"]);const[B,U]=r(null),z=o(y()),{inFullscreenView:G,openSubmenuId:J,setOpenSubmenuId:Q,menuType:X}=d(),[Y,Z]=r(!1),[ee,te]=r(null),[ne,re]=r([]),[oe,ie]=r(""),[ue,le]=r(!1),[ae,se]=r(!1),ce=ne.length,{submenuMaxHeight:me}=i(S),pe=w(R),de=u((()=>{const e=null==B?void 0:B.querySelectorAll(h);if(e&&Y&&ce){const t=Array.from(e),n=null==B?void 0:B.querySelector(`[data-component='${v}']`),r=n?t.indexOf(n):-1;return(null==n?void 0:n.querySelector(`[data-component='${g}']`))?r+1:r}return-1}),[Y,ce,B]),be=o(null),fe=l((()=>{be.current=setTimeout((()=>{ie("")}),1500)}),[]),ye=l((()=>{be.current&&clearTimeout(be.current),fe()}),[fe]);a((()=>()=>{be.current&&clearTimeout(be.current)}),[]);const he=l((()=>{Z(!0),Q(z.current)}),[Q]),ve=o();a((()=>{Y&&B&&(()=>{var e;if(!B)return;const t=Array.from(B.querySelectorAll("[data-component='menu-item']")||[]),n=t.length>0?t[t.length-1]:null;ve.current=null!=n?n:void 0,B.querySelectorAll("[data-last-visible-menu-item]").forEach((e=>e.removeAttribute("data-last-visible-menu-item"))),n&&n.setAttribute("data-last-visible-menu-item","true");const r=Array.from(B.querySelectorAll("ul:not([data-component='submenu'])")||[]);if(0===r.length)return le(!1),void se(!1);const o=r[r.length-1],i=(null==o||null===(e=o.parentElement)||void 0===e?void 0:e.dataset.component)===v,u=Array.from(o.querySelectorAll("[data-component='menu-item']")||[]),l=u.length>0?u[u.length-1]:null;let a=!1;l&&o&&(a=l.getBoundingClientRect().bottom<o.getBoundingClientRect().bottom);const s=!!l&&!!n&&l===n;le(s),se(s&&!i||s&&i&&!a)})()}),[Y,B,ce]),a((()=>{Y&&pe&&pe()}),[Y,pe]);const ge=l((()=>{Z(!1),te(null),V&&V(),ie("")}),[V]);a((()=>{J&&J!==z.current&&ge()}),[J,ge]);const Oe=l((e=>ne.findIndex((t=>t===e))),[ne]),we=l((e=>{const t=p.isEnterKey(e)||p.isSpaceKey(e);if(!t&&!p.isDownKey(e)||Y||(e.preventDefault(),he()),Y){const n=Oe(ee);let r=n;if(ee||((t&&!M||p.isSpaceKey(e)&&M)&&(e.preventDefault(),ge()),p.isShiftKey(e)&&p.isTabKey(e)&&ge()),p.isDownKey(e)&&(e.preventDefault(),r<ce-1&&(r+=1)),p.isUpKey(e)&&(e.preventDefault(),le(!1),r>0&&(r-=1)),p.isEscKey(e))return null==K||K(e),void ge();p.isHomeKey(e)&&(e.preventDefault(),e.stopPropagation(),r=0),p.isEndKey(e)&&(e.preventDefault(),e.stopPropagation(),r=ce-1),1===e.key.length?(e.stopPropagation(),be.current?ye():fe(),ie(`${oe}${e.key.toLowerCase()}`)):ie(""),p.composedPath(e.nativeEvent).find((e=>e instanceof HTMLElement&&("input"===e.getAttribute("data-element")||"input-icon-toggle"===e.getAttribute("data-element"))))||p.isEnterKey(e)&&setTimeout((()=>ge()),0),r!==n&&te(ne[r])}}),[ne,Y,M,ce,ee,Oe,he,ge,K,oe,ye,fe]);return a((()=>{if(B&&A){const e=null==B?void 0:B.querySelectorAll(O);e&&re(Array.from(e).filter((e=>e.querySelector(j))).map((e=>e.getAttribute("id"))))}}),[A,Y,B]),a((()=>{const e=null==B?void 0:B.querySelectorAll(O);if(e&&""!==oe){const t=Array.from(e),n=b(oe,t);n&&te(n.id)}}),[B,oe,ne]),e(c,G?{"data-component":"submenu-wrapper",inFullscreenView:G,asPassiveItem:W,menuType:X,children:[t(s,P(D({},$),{onClick:W?void 0:H,className:_,menuType:X,ref:x,href:M,menuItemVariant:C,inFullscreenView:G,asDiv:W,children:T})),t(m,{"data-component":"submenu",variant:C,menuType:X,inFullscreenView:G,ref:U,applyFocusRadiusStyling:!1,applyFocusRadiusStylingToLastItem:ae,children:t(f.Provider,{value:{handleKeyDown:we,blockIndex:de,updateFocusId:te},children:A})})]}:{"data-component":"submenu-wrapper","data-role":"submenu-wrapper",onMouseOver:F?void 0:()=>he(),onMouseLeave:()=>ge(),isSubmenuOpen:Y,ref:U,children:[t(s,P(D({},$),{className:_,menuType:X,ref:x,icon:k,tabIndex:-1,menuItemVariant:C,isOpen:Y,hasSubmenu:!0,showDropdownArrow:E,onKeyDown:we,onClick:e=>{he(),H&&H(e)},clickToOpen:F,href:M,maxWidth:q,"aria-expanded":Y,"data-role":"submenu-parent-item",children:T})),Y&&t(m,{"data-component":"submenu",submenuDirection:I,variant:C,menuType:X,role:0===de?"presentation":"list",maxHeight:me,applyFocusRadiusStyling:ue,applyFocusRadiusStylingToLastItem:ae,submenuMaxWidth:L,submenuMinWidth:N,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||ge()},children:t(f.Provider,{value:{submenuFocusId:ee,handleKeyDown:we,blockIndex:de,updateFocusId:te,submenuHasMaxWidth:!!L,closeSubmenu:ge},children:A})})]})}));A.displayName="submenu";export{A as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import n,{useRef as o}from"react";import{Typography as i}from"../typography/typography.component.js";import{MessageStyle as s,MessageWrapper as a,MessageContent as l,MessageContentWrapper as c,TypeIconStyle as p}from"./message.style.js";import u from"../../__internal__/utils/helpers/tags/tags.js";import d from"../icon/icon.component.js";import m from"../icon-button/icon-button.component.js";import{AiIcon as f,AiIconInverse as b}from"../../__internal__/ai-icon/ai-icon.component.js";import"../../style/utils/filter-styled-system-padding-props.js";import y from"../../style/utils/filter-styled-system-margin-props.js";import g from"../../hooks/__internal__/useLocale/useLocale.js";import h from"../../__internal__/utils/logger/index.js";function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j(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){O(e,t,r[t])}))}return e}function w(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}let v=!1,_=!1,P=!1;const S=n.forwardRef(((n,O)=>{var{open:S=!0,transparent:x=!1,title:D,variant:k="info",children:z,onDismiss:I,id:L,closeButtonAriaLabel:M,showCloseIcon:C=!0,width:T,size:A="medium"}=n,B=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}(n,["open","transparent","title","variant","children","onDismiss","id","closeButtonAriaLabel","showCloseIcon","width","size"]);x&&!v&&(h.deprecate("The 'transparent' prop in `Message` is deprecated and will soon be removed."),v=!0),"neutral"!==k||_||(h.deprecate("The 'neutral' variant in `Message` is deprecated and will soon be removed."),_=!0),!1!==C||P||(h.deprecate("The 'showCloseIcon' prop in `Message` is deprecated and will soon be removed. To prevent the close button from being rendered, don't pass the `onDismiss` prop."),P=!0);const E=o(null),R=O||E,W=g(),N=y(B),q={neutral:"info",success:"tick_circle",error:"error",warning:"warning",info:"info",callout:"tag"},F=k.endsWith("-subtle"),G=k.replace("-subtle",""),H=()=>{var n,o;return e(r,{children:[t(p,{"aria-hidden":"true",variant:G,isSubtle:F,transparent:x,children:"ai"===k?t(f,{"data-role":"ai-icon"}):"ai-subtle"===k?t(b,{"data-role":"ai-icon-subtle"}):t(d,{type:q[G]})}),t(i,{screenReaderOnly:!0,children:null===(n=(o=W.message)[G])||void 0===n?void 0:n.call(o)})]})};return S?e(s,w(j(w(j({},u("Message",B)),{transparent:x,variant:G,isSubtle:F,id:L,width:T,ref:R}),N),{tabIndex:-1,children:[!F&&H(),e(a,{children:[e(l,{"data-role":"message-content",size:A,isSubtle:F,children:[F&&H(),e(c,{size:A,children:[D?"string"==typeof D?t(i,{m:0,fontWeight:"500",fontSize:"large"===A?"16px":"14px",children:D}):D:null,z]})]}),C&&I&&t(m,{my:"large"===A?2:1,mr:"large"===A?2:1,p:"4px","data-element":"close","aria-label":M||W.message.closeButtonAriaLabel(),onClick:I,children:t(d,{type:"cross"})})]})]})):null}));S.displayName="Message";export{S as Message,S as default};
1
+ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import n,{useRef as o}from"react";import{Typography as i}from"../typography/typography.component.js";import{MessageStyle as s,MessageWrapper as a,MessageContent as l,MessageContentWrapper as c,TypeIconStyle as p}from"./message.style.js";import u from"../../__internal__/utils/helpers/tags/tags.js";import d from"../icon/icon.component.js";import{Button as m}from"../button/__next__/button.component.js";import{AiIcon as f,AiIconInverse as b}from"../../__internal__/ai-icon/ai-icon.component.js";import"../../style/utils/filter-styled-system-padding-props.js";import y from"../../style/utils/filter-styled-system-margin-props.js";import g from"../../hooks/__internal__/useLocale/useLocale.js";import h from"../../__internal__/utils/logger/index.js";function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j(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){O(e,t,r[t])}))}return e}function w(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}let v=!1,_=!1,P=!1;const S=n.forwardRef(((n,O)=>{var{open:S=!0,transparent:x=!1,title:D,variant:k="info",children:z,onDismiss:I,id:L,closeButtonAriaLabel:M,showCloseIcon:T=!0,width:C,size:A="medium"}=n,B=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}(n,["open","transparent","title","variant","children","onDismiss","id","closeButtonAriaLabel","showCloseIcon","width","size"]);x&&!v&&(h.deprecate("The 'transparent' prop in `Message` is deprecated and will soon be removed."),v=!0),"neutral"!==k||_||(h.deprecate("The 'neutral' variant in `Message` is deprecated and will soon be removed."),_=!0),!1!==T||P||(h.deprecate("The 'showCloseIcon' prop in `Message` is deprecated and will soon be removed. To prevent the close button from being rendered, don't pass the `onDismiss` prop."),P=!0);const E=o(null),R=O||E,W=g(),N=y(B),q={neutral:"info",success:"tick_circle",error:"error",warning:"warning",info:"info",callout:"tag"},F=k.endsWith("-subtle"),G=k.replace("-subtle",""),H=()=>{var n,o;return e(r,{children:[t(p,{"aria-hidden":"true",variant:G,isSubtle:F,transparent:x,children:"ai"===k?t(f,{"data-role":"ai-icon"}):"ai-subtle"===k?t(b,{"data-role":"ai-icon-subtle"}):t(d,{type:q[G]})}),t(i,{screenReaderOnly:!0,children:null===(n=(o=W.message)[G])||void 0===n?void 0:n.call(o)})]})};return S?e(s,w(j(w(j({},u("Message",B)),{transparent:x,variant:G,isSubtle:F,id:L,width:C,ref:R}),N),{tabIndex:-1,children:[!F&&H(),e(a,{children:[e(l,{"data-role":"message-content",size:A,isSubtle:F,children:[F&&H(),e(c,{size:A,children:[D?"string"==typeof D?t(i,{m:0,fontWeight:"500",fontSize:"large"===A?"16px":"14px",children:D}):D:null,z]})]}),T&&I&&t(m,{my:"large"===A?2:1,mr:"large"===A?2:1,"data-element":"close","aria-label":M||W.message.closeButtonAriaLabel(),variantType:"subtle",onClick:e=>{I(e)},children:t(d,{type:"cross"})})]})]})):null}));S.displayName="Message";export{S as Message,S as default};
@@ -1 +1 @@
1
- import e,{css as t}from"styled-components";import{margin as o}from"styled-system";import a from"../../style/themes/apply-base-theme.js";const s={error:"#CD384B",info:"#0060A7",success:"#00811F ",warning:"#D64309",neutral:"var(--colorsSemanticNeutral500)",ai:"var(--colorsUtilityYin100)",callout:"var(--colorsUtilityYin100)"},i={error:"#FDECEB",info:"#EAEEF6",success:"#E9F2E8 ",warning:"#FFEDE5",ai:"#EFEFEF",callout:"#E6FAE2"},n=e.div.attrs(a).withConfig({displayName:"message.style__MessageStyle",componentId:"sc-2430d97-0"})(["position:relative;display:flex;border-radius:var(--borderRadius100);overflow:hidden;border:1px solid ",";background-color:var(--colorsUtilityYang100);max-width:720px;:focus{outline:none;}"," "," "," ",""],(({variant:e})=>s[e]),(({isSubtle:e,variant:o})=>e&&t(["border:none;background-color:",";"],i[o])),(({transparent:e})=>e&&t(["border:none;background:transparent;"])),(({width:e})=>e&&`width: ${e};`),o),r=e.div.withConfig({displayName:"message.style__MessageWrapper",componentId:"sc-2430d97-1"})(["display:flex;justify-content:space-between;align-items:flex-start;width:100%;"]),l=e.div.withConfig({displayName:"message.style__MessageContent",componentId:"sc-2430d97-2"})(["display:flex;box-sizing:border-box;width:100%;height:100%;padding:12px;",""],(({size:e,isSubtle:o})=>t([""," ",""],"large"===e&&t(["padding:20px;"]),o&&t(["gap:",";"],"large"===e?"16px":"8px")))),d=e.div.withConfig({displayName:"message.style__MessageContentWrapper",componentId:"sc-2430d97-3"})(["display:flex;flex-direction:column;justify-content:center;width:100%;gap:2px;font-size:14px;",""],(({size:e})=>"large"===e&&t(["gap:4px;font-size:16px;"]))),p=e.div.withConfig({displayName:"message.style__TypeIconStyle",componentId:"sc-2430d97-4"})(["",""],(({transparent:e,isSubtle:o,variant:a})=>t(["display:flex;background-color:",";"," span{width:20px;height:20px;&:before{color:var(--colorsUtilityYang100);}}"," ",""],s[a],!o&&t(["justify-content:center;align-items:center;width:32px;"]),o&&t(["padding-top:2px;background-color:transparent;span{&:before{color:",";}}"],s[a]),e&&t(["background-color:transparent;span{&:before{color:",";}}"],s[a]))));export{l as MessageContent,d as MessageContentWrapper,n as MessageStyle,r as MessageWrapper,p as TypeIconStyle};
1
+ import e,{css as t}from"styled-components";import{margin as o}from"styled-system";import a from"../../style/themes/apply-base-theme.js";const s={error:"#CD384B",info:"#0060A7",success:"#00811F ",warning:"#D64309",neutral:"var(--colorsSemanticNeutral500)",ai:"var(--colorsUtilityYin100)",callout:"var(--colorsUtilityYin100)"},i={error:"#FDECEB",info:"#EAEEF6",success:"#E9F2E8 ",warning:"#FFEDE5",ai:"#EFEFEF",callout:"#E6FAE2"},n=e.div.attrs(a).withConfig({displayName:"message.style__MessageStyle",componentId:"sc-d364e7a3-0"})(["position:relative;display:flex;border-radius:var(--borderRadius100);overflow:hidden;border:1px solid ",";background-color:var(--colorsUtilityYang100);max-width:720px;:focus{outline:none;}"," "," "," ",""],(({variant:e})=>s[e]),(({isSubtle:e,variant:o})=>e&&t(["border:none;background-color:",";"],i[o])),(({transparent:e})=>e&&t(["border:none;background:transparent;"])),(({width:e})=>e&&`width: ${e};`),o),r=e.div.withConfig({displayName:"message.style__MessageWrapper",componentId:"sc-d364e7a3-1"})(["display:flex;justify-content:space-between;align-items:flex-start;width:100%;"]),l=e.div.withConfig({displayName:"message.style__MessageContent",componentId:"sc-d364e7a3-2"})(["display:flex;box-sizing:border-box;width:100%;height:100%;padding:12px;",""],(({size:e,isSubtle:o})=>t([""," ",""],"large"===e&&t(["padding:20px;"]),o&&t(["gap:",";"],"large"===e?"16px":"8px")))),d=e.div.withConfig({displayName:"message.style__MessageContentWrapper",componentId:"sc-d364e7a3-3"})(["display:flex;flex-direction:column;justify-content:center;width:100%;gap:2px;font-size:14px;",""],(({size:e})=>"large"===e&&t(["gap:4px;font-size:16px;"]))),p=e.div.withConfig({displayName:"message.style__TypeIconStyle",componentId:"sc-d364e7a3-4"})(["",""],(({transparent:e,isSubtle:o,variant:a})=>t(["display:flex;background-color:",";"," span{width:20px;height:20px;&:before{color:var(--colorsUtilityYang100);}}"," ",""],s[a],!o&&t(["justify-content:center;align-items:center;width:32px;"]),o&&t(["padding-top:6px;background-color:transparent;span{&:before{color:",";}}"],s[a]),e&&t(["background-color:transparent;span{&:before{color:",";}}"],s[a]))));export{l as MessageContent,d as MessageContentWrapper,n as MessageStyle,r as MessageWrapper,p as TypeIconStyle};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import{forwardRef as n,useState as o,useRef as a,useContext as i,useCallback as l,useEffect as s,useImperativeHandle as c,useMemo as p}from"react";import{CSSTransition as d}from"react-transition-group";import{offset as u,flip as m,shift as f}from"@floating-ui/dom";import b from"../../hooks/useMediaQuery/useMediaQuery.js";import{PopoverContainerWrapperStyle as v,PopoverContainerOpenIcon as h,PopoverContainerCloseIcon as y,PopoverContainerContentStyle as _,PopoverContainerHeaderStyle as O,PopoverContainerTitleStyle as g}from"./popover-container.style.js";import j from"../icon/icon.component.js";import x from"../../__internal__/popover/popover.component.js";import P from"../../__internal__/utils/helpers/guid/index.js";import C from"../../style/utils/filter-styled-system-padding-props.js";import w from"../../hooks/__internal__/useClickAwayListener/useClickAwayListener.js";import k from"../../__internal__/utils/helpers/events/events.js";import A from"../../__internal__/focus-trap/focus-trap.component.js";import B from"../../__internal__/modal/modal.context.js";import I from"../../hooks/__internal__/useFocusPortalContent/useFocusPortalContent.js";import D from"../../__internal__/utils/helpers/tags/tags.js";import{defaultFocusableSelectors as L}from"../../__internal__/focus-trap/focus-trap-utils.js";import E from"../flat-table/__internal__/flat-table.context.js";import{useGlobalHeader as S}from"../global-header/__internal__/global-header.context.js";function F(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R(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){F(e,t,r[t])}))}return e}function M(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}const W=({tabIndex:t,onClick:r,"data-element":n,ref:o,"aria-label":a,id:i,"aria-expanded":l,"aria-haspopup":s})=>e(h,{tabIndex:t,onClick:r,"data-element":n,ref:o,"aria-label":a,"aria-haspopup":s,"aria-expanded":l,id:i,children:e(j,{type:"settings"})}),$=({"data-element":t,tabIndex:r,onClick:n,ref:o,"aria-label":a,closeButtonDataProps:i})=>e(y,M(R({tabIndex:r,onClick:n,ref:o,"aria-label":a},D("close",R({"data-element":t},i))),{children:e(j,{type:"close"})}));function H(e,t,r){return p((()=>[u(e?({rects:e})=>({mainAxis:-e.reference.height}):r),m({fallbackStrategy:"initialPlacement"}),...t?[f()]:[]]),[e,t,r])}const Q=n(((n,p)=>{var{children:u,title:m,borderRadius:f,position:h="right",offset:y=6,open:j,onOpen:F,onClose:Q,renderOpenComponent:T=W,renderCloseComponent:q=$,shouldCoverButton:z=!1,ariaDescribedBy:G,openButtonAriaLabel:K,closeButtonAriaLabel:N="close",containerAriaLabel:U,closeButtonDataProps:J,disableAnimation:V=!1,hasFullWidth:X=!1}=n,Y=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(n,["children","title","borderRadius","position","offset","open","onOpen","onClose","renderOpenComponent","renderCloseComponent","shouldCoverButton","ariaDescribedBy","openButtonAriaLabel","closeButtonAriaLabel","containerAriaLabel","closeButtonDataProps","disableAnimation","hasFullWidth"]);const Z=void 0!==j,[ee,te]=o(!1),re=a(null),ne=a(null),oe=a(null),ae=a(P()),ie=a(null),le=m?`PopoverContainer_${ae.current}`:void 0,se=Z?j:ee,ce=!b("screen and (prefers-reduced-motion: no-preference)"),pe=H(z,"center"===h,y),{isInFlatTable:de}=i(E),ue=l((e=>{var t;Z||te(!1),null==Q||Q(e),se&&(null===(t=ne.current)||void 0===t||t.focus())}),[Z,se,Q]),me=l((e=>{!k.composedPath(e).find((e=>e instanceof HTMLElement&&"input"===e.getAttribute("data-element")&&"true"===e.getAttribute("aria-expanded")))&&se&&k.isEscKey(e)&&ue(e)}),[ue,se]);s((()=>(document.addEventListener("keydown",me),()=>{document.removeEventListener("keydown",me)})),[me]),s((()=>{var e;!z&&se&&(null===(e=ie.current)||void 0===e||e.focus({preventScroll:!0}))}),[se,z,ie]),I(z?void 0:ie,z?void 0:ne,ue);const fe=l((e=>{const t=Array.from(document.querySelectorAll(L)||[]).filter((e=>e===ne.current||-1!==Number(e.tabIndex))),r=t.indexOf(ne.current);t[r+1].focus(),ue(e)}),[]),be=(e,t)=>{var r;"next"===e&&fe?fe(t):"prev"===e&&(null===(r=ne.current)||void 0===r||r.focus())},ve={tabIndex:0,"aria-expanded":se,"aria-haspopup":"dialog",isOpen:se,"data-element":"popover-container-open-component",onClick:e=>{Z||te(!se),se?null==Q||Q(e):null==F||F(e)},ref:ne,"aria-label":K||m,id:se?void 0:le,"data-popover-container-button":"true"},he={"data-element":"popover-container-close-component",tabIndex:0,onClick:e=>{ue(e)},ref:re,"aria-label":N,closeButtonDataProps:J},ye=w((e=>{Z||te(!1),se&&(null==Q||Q(e))}),"mousedown"),[_e,Oe]=o(!1),{isWithinGlobalHeader:ge}=S();c(p,(()=>({focusButton(){var e;null===(e=ne.current)||void 0===e||e.focus()}})),[]);const je=()=>t(_,M(R({"data-element":"popover-container-content",role:"dialog","aria-labelledby":le,"aria-label":U,"aria-describedby":G,p:"16px 24px",$borderRadius:f,$popoverOffset:y,ref:ie,tabIndex:-1,disableAnimation:V||ce,zIndex:ge?1e4:2e3},C(Y)),{children:[t(O,{children:[m&&e(g,{id:le,"data-element":"popover-container-title",children:m}),q(he)]}),u]}));return t(v,M(R({onMouseDown:ye,hasFullWidth:X},D("popover-container",Y)),{children:[e("div",{ref:oe,children:T(ve)}),e(d,{nodeRef:ie,timeout:{exit:V?0:300},in:se,unmountOnExit:!0,onEntered:z?()=>Oe(!0):void 0,onExiting:z?()=>Oe(!1):void 0,children:e(x,{reference:oe,placement:"center"===h?"bottom":"right"===h?"bottom-start":"bottom-end",popoverStrategy:V||ce?"fixed":"absolute",middleware:pe,childRefOverride:ie,disableBackgroundUI:de,children:z?e(B.Provider,{value:{isAnimationComplete:_e},children:e(A,{wrapperRef:ie,isOpen:se,children:je()})}):t(r,{children:[e("div",{"data-element":"tab-guard-top",tabIndex:0,onFocus:e=>be("prev",e)}),je(),e("div",{"data-element":"tab-guard-bottom",tabIndex:0,onFocus:e=>be("next",e)})]})})})]}))}));export{Q as PopoverContainer,Q as default,$ as renderClose,W as renderOpen};
1
+ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{forwardRef as n,useState as o,useRef as a,useContext as i,useCallback as l,useEffect as s,useImperativeHandle as c,useMemo as p}from"react";import{CSSTransition as d}from"react-transition-group";import{offset as u,flip as m,shift as f}from"@floating-ui/dom";import b from"../../hooks/useMediaQuery/useMediaQuery.js";import{PopoverContainerWrapperStyle as v,PopoverContainerCloseIcon as h,PopoverContainerOpenIcon as y,PopoverContainerContentStyle as _,PopoverContainerHeaderStyle as O,PopoverContainerTitleStyle as g}from"./popover-container.style.js";import j from"../icon/icon.component.js";import x from"../../__internal__/popover/popover.component.js";import P from"../../__internal__/utils/helpers/guid/index.js";import C from"../../style/utils/filter-styled-system-padding-props.js";import w from"../../hooks/__internal__/useClickAwayListener/useClickAwayListener.js";import k from"../../__internal__/utils/helpers/events/events.js";import A from"../../__internal__/focus-trap/focus-trap.component.js";import B from"../../__internal__/modal/modal.context.js";import I from"../../hooks/__internal__/useFocusPortalContent/useFocusPortalContent.js";import D from"../../__internal__/utils/helpers/tags/tags.js";import{defaultFocusableSelectors as L}from"../../__internal__/focus-trap/focus-trap-utils.js";import E from"../flat-table/__internal__/flat-table.context.js";import{useGlobalHeader as S}from"../global-header/__internal__/global-header.context.js";function F(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R(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){F(e,t,r[t])}))}return e}function M(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}const W=({tabIndex:e,onClick:r,"data-element":n,ref:o,"aria-label":a,id:i,"aria-expanded":l,"aria-haspopup":s})=>t(y,{tabIndex:e,onClick:r,"data-element":n,ref:o,"aria-label":a,"aria-haspopup":s,"aria-expanded":l,id:i,children:t(j,{type:"settings"})}),$=({"data-element":e,tabIndex:r,onClick:n,ref:o,"aria-label":a,closeButtonDataProps:i})=>t(h,M(R({tabIndex:r,onClick:n,ref:o,"aria-label":a},D("close",R({"data-element":e},i))),{children:t(j,{type:"close"})}));function H(e,t,r){return p((()=>[u(e?({rects:e})=>({mainAxis:-e.reference.height}):r),m({fallbackStrategy:"initialPlacement"}),...t?[f()]:[]]),[e,t,r])}const Q=n(((n,p)=>{var{children:u,title:m,borderRadius:f,position:h="right",offset:y=6,open:j,onOpen:F,onClose:Q,renderOpenComponent:T=W,renderCloseComponent:q=$,shouldCoverButton:z=!1,ariaDescribedBy:G,openButtonAriaLabel:K,closeButtonAriaLabel:N="close",containerAriaLabel:U,closeButtonDataProps:J,disableAnimation:V=!1,hasFullWidth:X=!1}=n,Y=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(n,["children","title","borderRadius","position","offset","open","onOpen","onClose","renderOpenComponent","renderCloseComponent","shouldCoverButton","ariaDescribedBy","openButtonAriaLabel","closeButtonAriaLabel","containerAriaLabel","closeButtonDataProps","disableAnimation","hasFullWidth"]);const Z=void 0!==j,[ee,te]=o(!1),re=a(null),ne=a(null),oe=a(null),ae=a(P()),ie=a(null),le=m?`PopoverContainer_${ae.current}`:void 0,se=Z?j:ee,ce=!b("screen and (prefers-reduced-motion: no-preference)"),pe=H(z,"center"===h,y),{isInFlatTable:de}=i(E),ue=l((e=>{var t;Z||te(!1),null==Q||Q(e),se&&(null===(t=ne.current)||void 0===t||t.focus())}),[Z,se,Q]),me=l((e=>{!k.composedPath(e).find((e=>e instanceof HTMLElement&&"input"===e.getAttribute("data-element")&&"true"===e.getAttribute("aria-expanded")))&&se&&k.isEscKey(e)&&ue(e)}),[ue,se]);s((()=>(document.addEventListener("keydown",me),()=>{document.removeEventListener("keydown",me)})),[me]),s((()=>{var e;!z&&se&&(null===(e=ie.current)||void 0===e||e.focus({preventScroll:!0}))}),[se,z,ie]),I(z?void 0:ie,z?void 0:ne,ue);const fe=l((e=>{const t=Array.from(document.querySelectorAll(L)||[]).filter((e=>e===ne.current||-1!==Number(e.tabIndex))),r=t.indexOf(ne.current);t[r+1].focus(),ue(e)}),[]),be=(e,t)=>{var r;"next"===e&&fe?fe(t):"prev"===e&&(null===(r=ne.current)||void 0===r||r.focus())},ve={tabIndex:0,"aria-expanded":se,"aria-haspopup":"dialog",isOpen:se,"data-element":"popover-container-open-component",onClick:e=>{Z||te(!se),se?null==Q||Q(e):null==F||F(e)},ref:ne,"aria-label":K||m,id:se?void 0:le,"data-popover-container-button":"true"},he={"data-element":"popover-container-close-component",tabIndex:0,onClick:e=>{ue(e)},ref:re,"aria-label":N,closeButtonDataProps:J},ye=w((e=>{Z||te(!1),se&&(null==Q||Q(e))}),"mousedown"),[_e,Oe]=o(!1),{isWithinGlobalHeader:ge}=S();c(p,(()=>({focusButton(){var e;null===(e=ne.current)||void 0===e||e.focus()}})),[]);const je=()=>e(_,M(R({"data-element":"popover-container-content",role:"dialog","aria-labelledby":le,"aria-label":U,"aria-describedby":G,p:"16px 24px",$borderRadius:f,$popoverOffset:y,ref:ie,tabIndex:-1,disableAnimation:V||ce,zIndex:ge?1e4:2e3},C(Y)),{children:[e(O,{children:[m&&t(g,{id:le,"data-element":"popover-container-title",children:m}),q(he)]}),u]}));return e(v,M(R({onMouseDown:ye,hasFullWidth:X},D("popover-container",Y)),{children:[t("div",{ref:oe,children:T(ve)}),t(d,{nodeRef:ie,timeout:{exit:V?0:300},in:se,unmountOnExit:!0,onEntered:z?()=>Oe(!0):void 0,onExiting:z?()=>Oe(!1):void 0,children:t(x,{reference:oe,placement:"center"===h?"bottom":"right"===h?"bottom-start":"bottom-end",popoverStrategy:V||ce?"fixed":"absolute",middleware:pe,childRefOverride:ie,disableBackgroundUI:de,children:z?t(B.Provider,{value:{isAnimationComplete:_e},children:t(A,{wrapperRef:ie,isOpen:se,children:je()})}):e(r,{children:[t("div",{"data-element":"tab-guard-top",tabIndex:0,onFocus:e=>be("prev",e)}),je(),t("div",{"data-element":"tab-guard-bottom",tabIndex:0,onFocus:e=>be("next",e)})]})})})]}))}));export{Q as PopoverContainer,Q as default,$ as renderClose,W as renderOpen};
@@ -1 +1 @@
1
- import{jsx as e,Fragment as t}from"react/jsx-runtime";import r,{useContext as n,useCallback as o}from"react";import i from"invariant";import l from"./radio-button.style.js";import a from"../../__internal__/checkable-input/checkable-input.component.js";import p from"./radio-button-svg.component.js";import"../../style/utils/filter-styled-system-padding-props.js";import s from"../../style/utils/filter-styled-system-margin-props.js";import{TooltipProvider as c}from"../../__internal__/tooltip-provider/index.js";import d from"../carbon-provider/__internal__/new-validation.context.js";import u from"../../__internal__/utils/helpers/tags/tags.js";function b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(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){b(e,t,r[t])}))}return e}function m(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}const y=r.forwardRef(((r,b)=>{var{autoFocus:y,checked:g,disabled:h,fieldHelp:O,fieldHelpInline:j,id:v,inline:w,inputWidth:P,label:_,labelHelp:H,labelSpacing:S=1,labelWidth:k,name:x,onChange:F,onBlur:I,onFocus:W,value:B,reverse:D=!1,size:z,error:A,warning:C,info:E,tooltipPosition:L,"data-element":R,"data-role":N,helpAriaLabel:T}=r,V=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}(r,["autoFocus","checked","disabled","fieldHelp","fieldHelpInline","id","inline","inputWidth","label","labelHelp","labelSpacing","labelWidth","name","onChange","onBlur","onFocus","value","reverse","size","error","warning","info","tooltipPosition","data-element","data-role","helpAriaLabel"]);const{validationRedesignOptIn:Y}=n(d),q=s(V),G=o((e=>{F&&F(e),e.target.focus()}),[F]),J=m(f({},{error:A,warning:C,info:E}),{disabled:h,inputWidth:P,fieldHelpInline:j,labelSpacing:S}),K=m(f(m(f({},J),{autoFocus:y,checked:g,fieldHelp:O,name:x,onChange:G,onBlur:I,onFocus:W,labelInline:!0,labelWidth:k,label:_,labelHelp:H,id:v,value:B,type:"radio",reverse:!D,ref:b}),V),{"data-component":void 0});i(!V.children,"This component is meant to be used as a self-closing tag. You should probably use the label prop instead.");const M=e(l,m(f({applyNewValidation:Y,inline:w,reverse:D,size:z},J,q,u("radio-button",{"data-element":R,"data-role":N})),{children:e(a,m(f({},K),{children:e(p,{})}))}));return e(t,{children:Y?M:e(c,{helpAriaLabel:T,tooltipPosition:L,children:M})})}));y.displayName="RadioButton";var g=r.memo(y);export{y as RadioButton,g as default};
1
+ import{jsx as e,Fragment as t}from"react/jsx-runtime";import r,{useContext as n,useCallback as o}from"react";import i from"invariant";import l from"./radio-button.style.js";import a from"../../__internal__/checkable-input/checkable-input.component.js";import p from"./radio-button-svg.component.js";import"../../style/utils/filter-styled-system-padding-props.js";import s from"../../style/utils/filter-styled-system-margin-props.js";import{TooltipProvider as c}from"../../__internal__/tooltip-provider/index.js";import d from"../carbon-provider/__internal__/new-validation.context.js";import u from"../../__internal__/utils/helpers/tags/tags.js";function b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(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){b(e,t,r[t])}))}return e}function m(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}const y=r.forwardRef(((r,b)=>{var{autoFocus:y,checked:g,disabled:h,fieldHelp:O,fieldHelpInline:j,id:v,inline:w,inputWidth:P,label:_,labelHelp:H,labelSpacing:S=1,labelWidth:k,name:x,onChange:F,onBlur:I,onFocus:W,value:B,reverse:D=!1,size:R,error:z,warning:A,info:C,tooltipPosition:E,"data-element":L,"data-role":N,helpAriaLabel:T}=r,V=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}(r,["autoFocus","checked","disabled","fieldHelp","fieldHelpInline","id","inline","inputWidth","label","labelHelp","labelSpacing","labelWidth","name","onChange","onBlur","onFocus","value","reverse","size","error","warning","info","tooltipPosition","data-element","data-role","helpAriaLabel"]);const{validationRedesignOptIn:Y}=n(d),q=s(V),G=o((e=>{F&&F(e),e.target.focus()}),[F]),J=m(f({},{error:z,warning:A,info:C}),{disabled:h,inputWidth:P,fieldHelpInline:j,labelSpacing:S}),K=m(f(m(f({},J),{autoFocus:y,checked:g,fieldHelp:O,name:x,onChange:G,onBlur:I,onFocus:W,labelInline:!0,labelWidth:k,label:_,labelHelp:H,id:v,value:B,type:"radio",reverse:!D,ref:b}),V),{"data-component":void 0});i(!V.children,"This component is meant to be used as a self-closing tag. You should probably use the label prop instead.");const M=e(l,m(f({applyNewValidation:Y,inline:w,reverse:D,size:R},J,q,u("radio-button",{"data-element":L,"data-role":N})),{children:e(a,m(f({},K),{children:e(p,{})}))}));return e(t,{children:Y?M:e(c,{helpAriaLabel:T,tooltipPosition:E,children:M})})}));y.displayName="RadioButton";var g=r.memo(y);export{y as RadioButton,g as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import n,{useState as r,useRef as o,useCallback as l,useEffect as i}from"react";import a from"invariant";import"../../../style/utils/filter-styled-system-padding-props.js";import s from"../../../style/utils/filter-styled-system-margin-props.js";import c from"../../../style/utils/filter-out-styled-system-spacing-props.js";import u from"../__internal__/select-textbox/select-textbox.component.js";import d from"../../../__internal__/utils/helpers/guid/index.js";import p from"../__internal__/utils/with-filter.hoc.js";import m from"../select.style.js";import f from"../__internal__/select-list/select-list.component.js";import b from"../__internal__/utils/is-expected-option.js";import v from"../__internal__/utils/are-objects-equal.js";import y from"../__internal__/utils/is-navigation-key.js";import{useStableCallback as g}from"../../../hooks/__internal__/useStableCallback/useStableCallback.js";import h from"../../../hooks/__internal__/useInputAccessibility/useInputAccessibility.js";import O from"../../../hooks/__internal__/useAdaptiveSidebarModalFocus/useAdaptiveSidebarModalFocus.js";function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(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){_(e,t,n[t])}))}return e}function w(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}const C=p(f),x=n.forwardRef(((p,_)=>{var{"aria-label":x,"aria-labelledby":S,value:L,id:P,name:k,label:A,children:D,onOpen:E,onChange:F,onFilterChange:B,onClick:M,onKeyDown:T,onFocus:I,onBlur:V,openOnFocus:H,noResultsMessage:W,listActionButton:q,listMaxHeight:K,onListAction:R,isLoading:z,disabled:G,readOnly:J,onListScrollBottom:N,tableHeader:Q,multiColumn:U,"data-element":X,"data-role":Y,tooltipPosition:Z,listPlacement:$="bottom",flipEnabled:ee=!0,enableVirtualScroll:te,virtualScrollOverscan:ne,disableDefaultFiltering:re=!1,required:oe,listWidth:le}=p,ie=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(p,["aria-label","aria-labelledby","value","id","name","label","children","onOpen","onChange","onFilterChange","onClick","onKeyDown","onFocus","onBlur","openOnFocus","noResultsMessage","listActionButton","listMaxHeight","onListAction","isLoading","disabled","readOnly","onListScrollBottom","tableHeader","multiColumn","data-element","data-role","tooltipPosition","listPlacement","flipEnabled","enableVirtualScroll","virtualScrollOverscan","disableDefaultFiltering","required","listWidth"]);const[ae,se]=r(""),ce=o(d()),ue=o(null),de=o(null),pe=o(!1),me=o(!1),fe=o(!1),[be,ve]=r(),[ye,ge]=r(!1),[he,Oe]=r(""),[_e,je]=r(L||""),we=o(L),[Ce,xe]=r(""),[Se,Le]=r(""),Pe=o(P||d()),{labelId:ke}=h({id:Pe.current,label:A}),Ae=o(null),De=o(!1),Ee=l(((e,t)=>({target:w(j({},k&&{name:k},P&&{id:P}),{value:e}),selectionConfirmed:t})),[k,P]),Fe=l(((e,t)=>{F&&F(Ee(e,t))}),[F,Ee]),Be=l(((e,t)=>{je((()=>{var r;const o=e.trimStart(),l=(i=o,a=D,n.Children.toArray(a).find((e=>{const{text:t}=e.props;return-1!==(null==t?void 0:t.toLowerCase().indexOf(null==i?void 0:i.toLowerCase()))})));var i,a;const s=t&&!e.length;return!l||s||l.props.disabled?(Oe(e),Fe("",!1),""):(o.length&&Fe(l.props.value,!1),t?(Oe(e),l.props.value):(o.length&&(null===(r=l.props.text)||void 0===r?void 0:r.toLowerCase().startsWith(o.toLowerCase()))?Oe(l.props.text):Oe(e),xe(l.props.value),l.props.value))}))}),[D,Fe]),Me=l(((e,t=!1)=>{var r;const o=n.Children.toArray(D).find((t=>n.isValidElement(t)&&b(t,e)));o&&void 0!==o.props.text?(t||(null===(r=o.props.text)||void 0===r?void 0:r.toLowerCase().startsWith(null==Se?void 0:Se.toLowerCase().trim())))&&Oe(o.props.text):Oe(Se||"")}),[D,Se]),Te=l((e=>{const t=e.target.value,{inputType:n}=e.nativeEvent;Be(t,"deleteContentBackward"===n||"deleteContentForward"===n||"delete"===n),Le(t),ge(!0)}),[Be]),Ie=l((e=>{Le((t=>(null==t?void 0:t.length)===(null==he?void 0:he.length)-1&&e===he.slice(-1)?he:t))}),[he]),Ve=l((e=>{const{key:t}=e;T&&T(e),J||(!e.defaultPrevented&&y(t)&&(e.preventDefault(),ge(!0)),Ie(t))}),[Ie,T,J]),He=l((e=>{const t=ue.current&&!ue.current.contains(e.target),n=de.current&&!de.current.contains(e.target);pe.current=!1,t&&n&&(Me(L,!0),ge(!1))}),[Me,L]);i((()=>{je((e=>(L&&e!==L&&Me(L),L))),xe(L)}),[L,F,D]);const We=g(E);i((()=>{ye?We&&We():Le("")}),[We,ye]),i((()=>{const e=void 0!==q;a(!e||e&&R,"onListAction prop required when using listActionButton prop")}),[q,R]);const qe=o(!0);i((()=>{qe.current&&Me(_e),"object"==typeof L&&"object"==typeof we.current?v(L,we.current)||(Me(L),we.current=L):Me(L)}),[L,D]);const Ke=g(B);i((()=>{Ke&&!qe.current&&Ke(Se)}),[Ke,Se]),i((()=>{qe.current=!1}),[]),i((()=>{const e="click";return window.addEventListener(e,He),function(){window.removeEventListener(e,He)}}),[He]),i((()=>{const e=null==Se?void 0:Se.trimStart(),t=null==he?void 0:he.toLowerCase().startsWith(e.toLowerCase());!G&&!J&&be&&e.length&&(null==he?void 0:he.length)>e.length&&t&&(be.selectionStart=e.length)}),[he,Se,be,G,J]);const Re=l((e=>{const{id:t,text:n,value:r,selectionType:o,selectionConfirmed:l}=e;Oe(n),Fe(r,!!l),se(t),"navigationKey"!==o&&(De.current=!!H,ge(!1),null==be||be.focus(),null==be||be.select(),De.current=!1)}),[be,Fe,H]),ze=l((()=>{ge(!1),Me(_e,!0)}),[_e,Me]);function Ge(e){pe.current=!0,"input"===e.target.dataset.element&&(fe.current=!0)}i((()=>()=>{Ae.current&&clearTimeout(Ae.current)}),[]),O((()=>ge(!1)));const Je=l((e=>{e&&(ve(e),_&&("function"==typeof _?_(e):_.current=e))}),[_]);let Ne;switch($){case"top":Ne="top-end";break;case"bottom":Ne="bottom-end";break;default:Ne=$}const Qe={ref:de,id:ce.current,labelId:ke,anchorElement:(null==be?void 0:be.parentElement)||void 0,onSelect:Re,onSelectListClose:ze,onMouseDown:function(){pe.current=!0},filterText:Se.trim(),highlightedValue:Ce,noResultsMessage:W,listActionButton:q,listMaxHeight:K,onListAction:function(){ge(!1),null==R||R()},isLoading:z,onListScrollBottom:N,tableHeader:Q,multiColumn:U,listPlacement:void 0!==le?Ne:$,flipEnabled:ee,isOpen:ye,enableVirtualScroll:te,virtualScrollOverscan:ne,listWidth:le},Ue=e(re?f:C,w(j({},Qe),{children:D})),Xe=s(ie);return t(m,w(j({hasTextCursor:!0,readOnly:J,disabled:G,"data-component":"filterable-select","data-role":Y,"data-element":X,isOpen:ye},Xe),{children:[e("div",{ref:ue,children:e(u,w(j({ref:Je,activeDescendantId:ae,ariaLabel:x,ariaLabelledby:S,labelId:A?ke:void 0,"aria-controls":ce.current,isOpen:ye,hasTextCursor:!0},w(j({id:Pe.current,name:k,label:A,disabled:G,readOnly:J,selectedValue:_e,formattedValue:he,onClick:function(e){pe.current=!1,M&&M(e),ge(!0)},iconOnClick:function(e){pe.current=!1,M&&M(e),ge((e=>!e))},iconOnMouseDown:Ge,onFocus:function(e){const t=()=>null==I?void 0:I(e);if(H){if(Ae.current&&clearTimeout(Ae.current),De.current)return;Ae.current=setTimeout((()=>{ge((e=>!(!e&&(I&&!me.current&&(t(),me.current=!0),pe.current&&!fe.current))))}))}else I&&!me.current&&(t(),me.current=!0)},onBlur:function(e){fe.current=!1,pe.current||(me.current=!1,V&&V(e))},onKeyDown:Ve,onChange:Te,onMouseDown:Ge,tooltipPosition:Z,required:oe},c(ie)),{"data-component":void 0})),{onChange:Te,value:he}))}),Ue]}))}));export{x as FilterableSelect,x as default};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import n,{useState as r,useRef as o,useCallback as l,useEffect as i}from"react";import a from"invariant";import"../../../style/utils/filter-styled-system-padding-props.js";import s from"../../../style/utils/filter-styled-system-margin-props.js";import c from"../../../style/utils/filter-out-styled-system-spacing-props.js";import u from"../__internal__/select-textbox/select-textbox.component.js";import d from"../../../__internal__/utils/helpers/guid/index.js";import p from"../__internal__/utils/with-filter.hoc.js";import m from"../select.style.js";import f from"../__internal__/select-list/select-list.component.js";import b from"../__internal__/utils/is-expected-option.js";import v from"../__internal__/utils/are-objects-equal.js";import y from"../__internal__/utils/is-navigation-key.js";import g from"../../../hooks/__internal__/useStableCallback/useStableCallback.js";import h from"../../../hooks/__internal__/useInputAccessibility/useInputAccessibility.js";import O from"../../../hooks/__internal__/useAdaptiveSidebarModalFocus/useAdaptiveSidebarModalFocus.js";function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(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){_(e,t,n[t])}))}return e}function w(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}const C=p(f),x=n.forwardRef(((p,_)=>{var{"aria-label":x,"aria-labelledby":S,value:L,id:P,name:k,label:A,children:D,onOpen:E,onChange:F,onFilterChange:B,onClick:M,onKeyDown:T,onFocus:I,onBlur:V,openOnFocus:H,noResultsMessage:W,listActionButton:q,listMaxHeight:K,onListAction:R,isLoading:z,disabled:G,readOnly:J,onListScrollBottom:N,tableHeader:Q,multiColumn:U,"data-element":X,"data-role":Y,tooltipPosition:Z,listPlacement:$="bottom",flipEnabled:ee=!0,enableVirtualScroll:te,virtualScrollOverscan:ne,disableDefaultFiltering:re=!1,required:oe,listWidth:le}=p,ie=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(p,["aria-label","aria-labelledby","value","id","name","label","children","onOpen","onChange","onFilterChange","onClick","onKeyDown","onFocus","onBlur","openOnFocus","noResultsMessage","listActionButton","listMaxHeight","onListAction","isLoading","disabled","readOnly","onListScrollBottom","tableHeader","multiColumn","data-element","data-role","tooltipPosition","listPlacement","flipEnabled","enableVirtualScroll","virtualScrollOverscan","disableDefaultFiltering","required","listWidth"]);const[ae,se]=r(""),ce=o(d()),ue=o(null),de=o(null),pe=o(!1),me=o(!1),fe=o(!1),[be,ve]=r(),[ye,ge]=r(!1),[he,Oe]=r(""),[_e,je]=r(L||""),we=o(L),[Ce,xe]=r(""),[Se,Le]=r(""),Pe=o(P||d()),{labelId:ke}=h({id:Pe.current,label:A}),Ae=o(null),De=o(!1),Ee=l(((e,t)=>({target:w(j({},k&&{name:k},P&&{id:P}),{value:e}),selectionConfirmed:t})),[k,P]),Fe=l(((e,t)=>{F&&F(Ee(e,t))}),[F,Ee]),Be=l(((e,t)=>{je((()=>{var r;const o=e.trimStart(),l=(i=o,a=D,n.Children.toArray(a).find((e=>{const{text:t}=e.props;return-1!==(null==t?void 0:t.toLowerCase().indexOf(null==i?void 0:i.toLowerCase()))})));var i,a;const s=t&&!e.length;return!l||s||l.props.disabled?(Oe(e),Fe("",!1),""):(o.length&&Fe(l.props.value,!1),t?(Oe(e),l.props.value):(o.length&&(null===(r=l.props.text)||void 0===r?void 0:r.toLowerCase().startsWith(o.toLowerCase()))?Oe(l.props.text):Oe(e),xe(l.props.value),l.props.value))}))}),[D,Fe]),Me=l(((e,t=!1)=>{var r;const o=n.Children.toArray(D).find((t=>n.isValidElement(t)&&b(t,e)));o&&void 0!==o.props.text?(t||(null===(r=o.props.text)||void 0===r?void 0:r.toLowerCase().startsWith(null==Se?void 0:Se.toLowerCase().trim())))&&Oe(o.props.text):Oe(Se||"")}),[D,Se]),Te=l((e=>{const t=e.target.value,{inputType:n}=e.nativeEvent;Be(t,"deleteContentBackward"===n||"deleteContentForward"===n||"delete"===n),Le(t),ge(!0)}),[Be]),Ie=l((e=>{Le((t=>(null==t?void 0:t.length)===(null==he?void 0:he.length)-1&&e===he.slice(-1)?he:t))}),[he]),Ve=l((e=>{const{key:t}=e;T&&T(e),J||(!e.defaultPrevented&&y(t)&&(e.preventDefault(),ge(!0)),Ie(t))}),[Ie,T,J]),He=l((e=>{const t=ue.current&&!ue.current.contains(e.target),n=de.current&&!de.current.contains(e.target);pe.current=!1,t&&n&&(Me(L,!0),ge(!1))}),[Me,L]);i((()=>{je((e=>(L&&e!==L&&Me(L),L))),xe(L)}),[L,F,D]);const We=g(E);i((()=>{ye?We&&We():Le("")}),[We,ye]),i((()=>{const e=void 0!==q;a(!e||e&&R,"onListAction prop required when using listActionButton prop")}),[q,R]);const qe=o(!0);i((()=>{qe.current&&Me(_e),"object"==typeof L&&"object"==typeof we.current?v(L,we.current)||(Me(L),we.current=L):Me(L)}),[L,D]);const Ke=g(B);i((()=>{Ke&&!qe.current&&Ke(Se)}),[Ke,Se]),i((()=>{qe.current=!1}),[]),i((()=>{const e="click";return window.addEventListener(e,He),function(){window.removeEventListener(e,He)}}),[He]),i((()=>{const e=null==Se?void 0:Se.trimStart(),t=null==he?void 0:he.toLowerCase().startsWith(e.toLowerCase());!G&&!J&&be&&e.length&&(null==he?void 0:he.length)>e.length&&t&&(be.selectionStart=e.length)}),[he,Se,be,G,J]);const Re=l((e=>{const{id:t,text:n,value:r,selectionType:o,selectionConfirmed:l}=e;Oe(n),Fe(r,!!l),se(t),"navigationKey"!==o&&(De.current=!!H,ge(!1),null==be||be.focus(),null==be||be.select(),De.current=!1)}),[be,Fe,H]),ze=l((()=>{ge(!1),Me(_e,!0)}),[_e,Me]);function Ge(e){pe.current=!0,"input"===e.target.dataset.element&&(fe.current=!0)}i((()=>()=>{Ae.current&&clearTimeout(Ae.current)}),[]),O((()=>ge(!1)));const Je=l((e=>{e&&(ve(e),_&&("function"==typeof _?_(e):_.current=e))}),[_]);let Ne;switch($){case"top":Ne="top-end";break;case"bottom":Ne="bottom-end";break;default:Ne=$}const Qe={ref:de,id:ce.current,labelId:ke,anchorElement:(null==be?void 0:be.parentElement)||void 0,onSelect:Re,onSelectListClose:ze,onMouseDown:function(){pe.current=!0},filterText:Se.trim(),highlightedValue:Ce,noResultsMessage:W,listActionButton:q,listMaxHeight:K,onListAction:function(){ge(!1),null==R||R()},isLoading:z,onListScrollBottom:N,tableHeader:Q,multiColumn:U,listPlacement:void 0!==le?Ne:$,flipEnabled:ee,isOpen:ye,enableVirtualScroll:te,virtualScrollOverscan:ne,listWidth:le},Ue=e(re?f:C,w(j({},Qe),{children:D})),Xe=s(ie);return t(m,w(j({hasTextCursor:!0,readOnly:J,disabled:G,"data-component":"filterable-select","data-role":Y,"data-element":X,isOpen:ye},Xe),{children:[e("div",{ref:ue,children:e(u,w(j({ref:Je,activeDescendantId:ae,ariaLabel:x,ariaLabelledby:S,labelId:A?ke:void 0,"aria-controls":ce.current,isOpen:ye,hasTextCursor:!0},w(j({id:Pe.current,name:k,label:A,disabled:G,readOnly:J,selectedValue:_e,formattedValue:he,onClick:function(e){pe.current=!1,M&&M(e),ge(!0)},iconOnClick:function(e){pe.current=!1,M&&M(e),ge((e=>!e))},iconOnMouseDown:Ge,onFocus:function(e){const t=()=>null==I?void 0:I(e);if(H){if(Ae.current&&clearTimeout(Ae.current),De.current)return;Ae.current=setTimeout((()=>{ge((e=>!(!e&&(I&&!me.current&&(t(),me.current=!0),pe.current&&!fe.current))))}))}else I&&!me.current&&(t(),me.current=!0)},onBlur:function(e){fe.current=!1,pe.current||(me.current=!1,V&&V(e))},onKeyDown:Ve,onChange:Te,onMouseDown:Ge,tooltipPosition:Z,required:oe},c(ie)),{"data-component":void 0})),{onChange:Te,value:he}))}),Ue]}))}));export{x as FilterableSelect,x as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import r,{useState as n,useRef as l,useCallback as o,useMemo as i,useEffect as a}from"react";import"../../../style/utils/filter-styled-system-padding-props.js";import s from"../../../style/utils/filter-styled-system-margin-props.js";import c from"../../../style/utils/filter-out-styled-system-spacing-props.js";import u from"../__internal__/select-textbox/select-textbox.component.js";import d from"../../../__internal__/utils/helpers/guid/index.js";import p from"../__internal__/utils/with-filter.hoc.js";import m from"../__internal__/select-list/select-list.component.js";import{StyledSelectPillContainer as f,StyledSelectMultiSelect as b,StyledAccessibilityLabelContainer as v}from"./multi-select.style.js";import{Pill as y}from"../../pill/pill.component.js";import h from"../__internal__/utils/is-expected-option.js";import g from"../__internal__/utils/is-expected-value.js";import O from"../__internal__/utils/is-navigation-key.js";import{useStableCallback as _}from"../../../hooks/__internal__/useStableCallback/useStableCallback.js";import j from"../../../hooks/__internal__/useInputAccessibility/useInputAccessibility.js";import w from"../../../hooks/__internal__/useAdaptiveSidebarModalFocus/useAdaptiveSidebarModalFocus.js";function C(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x(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){C(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}const S=p(m),k=r.forwardRef(((p,m)=>{var{"aria-label":C,"aria-labelledby":k,value:D,id:L,label:E,name:M,disabled:V,readOnly:F,children:I,onOpen:T,onFilterChange:B,onChange:A,onClick:H,onFocus:z,onBlur:K,onKeyDown:R,openOnFocus:q=!1,noResultsMessage:W,placeholder:$,isLoading:G,onListScrollBottom:J,tableHeader:N,multiColumn:Q,tooltipPosition:U,size:X="medium","data-element":Y,"data-role":Z,listPlacement:ee="bottom",listMaxHeight:te,flipEnabled:re=!0,wrapPillText:ne=!0,enableVirtualScroll:le,virtualScrollOverscan:oe,required:ie,listWidth:ae}=p,se=function(e,t){if(null==e)return{};var r,n,l=function(e,t){if(null==e)return{};var r,n,l={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(l[r]=e[r]);return l}(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)&&(l[r]=e[r])}return l}(p,["aria-label","aria-labelledby","value","id","label","name","disabled","readOnly","children","onOpen","onFilterChange","onChange","onClick","onFocus","onBlur","onKeyDown","openOnFocus","noResultsMessage","placeholder","isLoading","onListScrollBottom","tableHeader","multiColumn","tooltipPosition","size","data-element","data-role","listPlacement","listMaxHeight","flipEnabled","wrapPillText","enableVirtualScroll","virtualScrollOverscan","required","listWidth"]);const[ce,ue]=n(""),de=l(d()),pe=l(d()),me=l(null),fe=l(null),be=l(!1),ve=l(!1),ye=l(!1),he=l(!1),ge=l(!1),[Oe,_e]=n(),[je,we]=n(!1),[Ce,xe]=n(""),[Pe,Se]=n(""),[ke,De]=n(""),[Le,Ee]=n(),Me=l(L||d()),{labelId:Ve}=j({id:Me.current,label:E}),Fe=l(null),Ie=o((()=>{we((e=>(!e&&T&&T(),!0)))}),[T]),Te=o(((e,t)=>({target:P(x({},M&&{name:M},L&&{id:L}),{value:e}),selectionConfirmed:t})),[M,L]),Be=o(((e,t)=>{const r=e(D);r.length!==(null==D?void 0:D.length)&&A(Te(r,t))}),[Te,A,D]),Ae=o((e=>{const t=e.target.value,n=(l=t,o=I,r.Children.toArray(o).find((e=>{const{text:t}=e.props;return-1!==(null==t?void 0:t.toLowerCase().indexOf(null==l?void 0:l.toLowerCase()))})));var l,o;n&&Se(n.props.value),De(t),xe(t),Ie()}),[I,Ie]),He=o((e=>{ve.current=!0,Be((t=>{if(!t.length)return t;const r=t.slice();return r.splice(e,1),r}),!0)}),[Be]),ze=o((e=>{const{key:t}=e,r="Backspace"===t||"Delete"===t;R&&R(e),F||(!e.defaultPrevented&&O(t)&&(e.preventDefault(),Ie()),!r||""!==ke&&""!==Ce||He(-1))}),[R,F,ke,Ce,Ie,He]),Ke=i((()=>{var e;return D&&D.length?null===(e=r.Children.map(I,(e=>!(!r.isValidElement(e)||!D.includes(e.props.value))&&e.props.text)))||void 0===e?void 0:e.filter((e=>e)).reduce(((e,t)=>e?`${e}, ${t}`:t),""):null}),[I,D]),Re=o((e=>{if(ye.current=!1,!je)return;const t=me.current&&!me.current.contains(e.target),r=fe.current&&!fe.current.contains(e.target);t&&r&&!ve.current&&(xe(""),De(""),Se(""),we(!1)),ve.current=!1}),[je]),qe=i((()=>{const t=!V&&!F;let n;return(null==D?void 0:D.length)?D.map(((l,o)=>{const i=r.Children.toArray(I).find((e=>r.isValidElement(e)&&h(e,l)));let a={};if(!i)return null;var s,c;r.isValidElement(i)&&(n=void 0!==(null==i||null===(s=i.props.value)||void 0===s?void 0:s.value)?null==i||null===(c=i.props.value)||void 0===c?void 0:c.value:null==i?void 0:i.props.value,a={title:i.props.text,fill:i.props.fill,borderColor:i.props.borderColor});const u=a.title||"",d=u+n||o;return e(f,{children:e(y,P(x({onDelete:t?()=>He(o):void 0,wrapText:ne},a),{children:u}))},d)})):""}),[I,V,F,D]);a((()=>{const e=null==D?void 0:D.length;Ee(e?" ":$)}),[D,$]),a((()=>{const e="click";return window.addEventListener(e,Re),function(){window.removeEventListener(e,Re)}}),[Re]);const We=_(B),$e=l(!0);function Ge(e){if(ye.current=!1,H&&H(e),!q||q&&!ge.current){if(je)return De(""),void we(!1);null==T||T(),we(!0)}else ge.current=!1}function Je(e){ye.current=!1,H&&H(e),we((e=>e?(De(""),!1):(T&&T(),!0)))}function Ne(e){he.current=!1,ye.current||(be.current=!1,K&&K(e))}function Qe(e){ye.current=!0,"input"===e.target.dataset.element&&(he.current=!0)}function Ue(e){const t=()=>null==z?void 0:z(e);q?(Fe.current&&clearTimeout(Fe.current),Fe.current=setTimeout((()=>{we((e=>!!e||(T&&T(),z&&!be.current&&(t(),be.current=!0),ye.current&&!he.current?(ge.current=!1,!1):(he.current&&(ge.current=!0),!0))))}))):z&&!be.current&&(t(),be.current=!0)}a((()=>{We&&!$e.current&&We(ke)}),[We,ke]),a((()=>{$e.current=!1}),[]),w((()=>we(!1)));const Xe=o((e=>{const{value:t,selectionType:r,id:n,selectionConfirmed:l}=e;if("navigationKey"===r)return Se(t),void ue(n);"click"===r&&(ve.current=!0),xe("");const o=-1!==(null==D?void 0:D.findIndex((e=>g(e,t))));null==Oe||Oe.focus(),ye.current=!1,Be((e=>o?e:[...e,t]),l)}),[Oe,D,Be]),Ye=o((()=>{we(!1),De("")}),[]),Ze=o((e=>{e&&(_e(e),m&&("function"==typeof m?m(e):m.current=e))}),[m]);function et(){return P(x({id:Me.current,name:M,disabled:V,label:E,readOnly:F,placeholder:Le,leftChildren:qe,formattedValue:Ce,selectedValue:D,onClick:Ge,onMouseDown:Qe,onFocus:Ue,onBlur:Ne,iconOnClick:Je,iconOnMouseDown:Qe,onKeyDown:ze,onChange:Ae,tooltipPosition:U,size:X,required:ie},c(se)),{"data-component":void 0})}let tt;switch(ee){case"top":tt="top-end";break;case"bottom":tt="bottom-end";break;default:tt=ee}const rt=e(S,{ref:fe,id:de.current,labelId:Ve,anchorElement:(null==Oe?void 0:Oe.parentElement)||void 0,onSelect:Xe,onSelectListClose:Ye,onMouseDown:function(){ye.current=!0},filterText:ke.trim(),highlightedValue:Pe,noResultsMessage:W,isLoading:G,onListScrollBottom:J,tableHeader:N,multiColumn:Q,listPlacement:void 0!==ae?tt:ee,listMaxHeight:te,flipEnabled:re,multiselectValues:D,isOpen:je,enableVirtualScroll:le,virtualScrollOverscan:oe,listWidth:ae,children:I}),nt=s(se);return t(b,P(x({disabled:V,readOnly:F,hasTextCursor:!0,size:X,"data-component":"multiselect","data-role":Z,"data-element":Y,isOpen:je},nt),{children:[t("div",{ref:me,children:[e(v,{"data-element":"accessibility-label",id:pe.current,children:Ke}),e(u,x({ref:Ze,accessibilityLabelId:pe.current,activeDescendantId:ce,"aria-controls":de.current,ariaLabel:C,ariaLabelledby:k,hasTextCursor:!0,isOpen:je,labelId:Ve,value:et().formattedValue},et()))]}),rt]}))}));export{k as MultiSelect,k as default};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import r,{useState as n,useRef as l,useCallback as o,useMemo as i,useEffect as a}from"react";import"../../../style/utils/filter-styled-system-padding-props.js";import s from"../../../style/utils/filter-styled-system-margin-props.js";import c from"../../../style/utils/filter-out-styled-system-spacing-props.js";import u from"../__internal__/select-textbox/select-textbox.component.js";import d from"../../../__internal__/utils/helpers/guid/index.js";import p from"../__internal__/utils/with-filter.hoc.js";import m from"../__internal__/select-list/select-list.component.js";import{StyledSelectPillContainer as f,StyledSelectMultiSelect as b,StyledAccessibilityLabelContainer as v}from"./multi-select.style.js";import{Pill as y}from"../../pill/pill.component.js";import h from"../__internal__/utils/is-expected-option.js";import g from"../__internal__/utils/is-expected-value.js";import O from"../__internal__/utils/is-navigation-key.js";import _ from"../../../hooks/__internal__/useStableCallback/useStableCallback.js";import j from"../../../hooks/__internal__/useInputAccessibility/useInputAccessibility.js";import w from"../../../hooks/__internal__/useAdaptiveSidebarModalFocus/useAdaptiveSidebarModalFocus.js";function C(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x(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){C(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}const S=p(m),k=r.forwardRef(((p,m)=>{var{"aria-label":C,"aria-labelledby":k,value:D,id:L,label:E,name:M,disabled:V,readOnly:F,children:I,onOpen:T,onFilterChange:B,onChange:A,onClick:H,onFocus:z,onBlur:K,onKeyDown:R,openOnFocus:q=!1,noResultsMessage:W,placeholder:$,isLoading:G,onListScrollBottom:J,tableHeader:N,multiColumn:Q,tooltipPosition:U,size:X="medium","data-element":Y,"data-role":Z,listPlacement:ee="bottom",listMaxHeight:te,flipEnabled:re=!0,wrapPillText:ne=!0,enableVirtualScroll:le,virtualScrollOverscan:oe,required:ie,listWidth:ae}=p,se=function(e,t){if(null==e)return{};var r,n,l=function(e,t){if(null==e)return{};var r,n,l={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(l[r]=e[r]);return l}(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)&&(l[r]=e[r])}return l}(p,["aria-label","aria-labelledby","value","id","label","name","disabled","readOnly","children","onOpen","onFilterChange","onChange","onClick","onFocus","onBlur","onKeyDown","openOnFocus","noResultsMessage","placeholder","isLoading","onListScrollBottom","tableHeader","multiColumn","tooltipPosition","size","data-element","data-role","listPlacement","listMaxHeight","flipEnabled","wrapPillText","enableVirtualScroll","virtualScrollOverscan","required","listWidth"]);const[ce,ue]=n(""),de=l(d()),pe=l(d()),me=l(null),fe=l(null),be=l(!1),ve=l(!1),ye=l(!1),he=l(!1),ge=l(!1),[Oe,_e]=n(),[je,we]=n(!1),[Ce,xe]=n(""),[Pe,Se]=n(""),[ke,De]=n(""),[Le,Ee]=n(),Me=l(L||d()),{labelId:Ve}=j({id:Me.current,label:E}),Fe=l(null),Ie=o((()=>{we((e=>(!e&&T&&T(),!0)))}),[T]),Te=o(((e,t)=>({target:P(x({},M&&{name:M},L&&{id:L}),{value:e}),selectionConfirmed:t})),[M,L]),Be=o(((e,t)=>{const r=e(D);r.length!==(null==D?void 0:D.length)&&A(Te(r,t))}),[Te,A,D]),Ae=o((e=>{const t=e.target.value,n=(l=t,o=I,r.Children.toArray(o).find((e=>{const{text:t}=e.props;return-1!==(null==t?void 0:t.toLowerCase().indexOf(null==l?void 0:l.toLowerCase()))})));var l,o;n&&Se(n.props.value),De(t),xe(t),Ie()}),[I,Ie]),He=o((e=>{ve.current=!0,Be((t=>{if(!t.length)return t;const r=t.slice();return r.splice(e,1),r}),!0)}),[Be]),ze=o((e=>{const{key:t}=e,r="Backspace"===t||"Delete"===t;R&&R(e),F||(!e.defaultPrevented&&O(t)&&(e.preventDefault(),Ie()),!r||""!==ke&&""!==Ce||He(-1))}),[R,F,ke,Ce,Ie,He]),Ke=i((()=>{var e;return D&&D.length?null===(e=r.Children.map(I,(e=>!(!r.isValidElement(e)||!D.includes(e.props.value))&&e.props.text)))||void 0===e?void 0:e.filter((e=>e)).reduce(((e,t)=>e?`${e}, ${t}`:t),""):null}),[I,D]),Re=o((e=>{if(ye.current=!1,!je)return;const t=me.current&&!me.current.contains(e.target),r=fe.current&&!fe.current.contains(e.target);t&&r&&!ve.current&&(xe(""),De(""),Se(""),we(!1)),ve.current=!1}),[je]),qe=i((()=>{const t=!V&&!F;let n;return(null==D?void 0:D.length)?D.map(((l,o)=>{const i=r.Children.toArray(I).find((e=>r.isValidElement(e)&&h(e,l)));let a={};if(!i)return null;var s,c;r.isValidElement(i)&&(n=void 0!==(null==i||null===(s=i.props.value)||void 0===s?void 0:s.value)?null==i||null===(c=i.props.value)||void 0===c?void 0:c.value:null==i?void 0:i.props.value,a={title:i.props.text,fill:i.props.fill,borderColor:i.props.borderColor});const u=a.title||"",d=u+n||o;return e(f,{children:e(y,P(x({onDelete:t?()=>He(o):void 0,wrapText:ne},a),{children:u}))},d)})):""}),[I,V,F,D]);a((()=>{const e=null==D?void 0:D.length;Ee(e?" ":$)}),[D,$]),a((()=>{const e="click";return window.addEventListener(e,Re),function(){window.removeEventListener(e,Re)}}),[Re]);const We=_(B),$e=l(!0);function Ge(e){if(ye.current=!1,H&&H(e),!q||q&&!ge.current){if(je)return De(""),void we(!1);null==T||T(),we(!0)}else ge.current=!1}function Je(e){ye.current=!1,H&&H(e),we((e=>e?(De(""),!1):(T&&T(),!0)))}function Ne(e){he.current=!1,ye.current||(be.current=!1,K&&K(e))}function Qe(e){ye.current=!0,"input"===e.target.dataset.element&&(he.current=!0)}function Ue(e){const t=()=>null==z?void 0:z(e);q?(Fe.current&&clearTimeout(Fe.current),Fe.current=setTimeout((()=>{we((e=>!!e||(T&&T(),z&&!be.current&&(t(),be.current=!0),ye.current&&!he.current?(ge.current=!1,!1):(he.current&&(ge.current=!0),!0))))}))):z&&!be.current&&(t(),be.current=!0)}a((()=>{We&&!$e.current&&We(ke)}),[We,ke]),a((()=>{$e.current=!1}),[]),w((()=>we(!1)));const Xe=o((e=>{const{value:t,selectionType:r,id:n,selectionConfirmed:l}=e;if("navigationKey"===r)return Se(t),void ue(n);"click"===r&&(ve.current=!0),xe("");const o=-1!==(null==D?void 0:D.findIndex((e=>g(e,t))));null==Oe||Oe.focus(),ye.current=!1,Be((e=>o?e:[...e,t]),l)}),[Oe,D,Be]),Ye=o((()=>{we(!1),De("")}),[]),Ze=o((e=>{e&&(_e(e),m&&("function"==typeof m?m(e):m.current=e))}),[m]);function et(){return P(x({id:Me.current,name:M,disabled:V,label:E,readOnly:F,placeholder:Le,leftChildren:qe,formattedValue:Ce,selectedValue:D,onClick:Ge,onMouseDown:Qe,onFocus:Ue,onBlur:Ne,iconOnClick:Je,iconOnMouseDown:Qe,onKeyDown:ze,onChange:Ae,tooltipPosition:U,size:X,required:ie},c(se)),{"data-component":void 0})}let tt;switch(ee){case"top":tt="top-end";break;case"bottom":tt="bottom-end";break;default:tt=ee}const rt=e(S,{ref:fe,id:de.current,labelId:Ve,anchorElement:(null==Oe?void 0:Oe.parentElement)||void 0,onSelect:Xe,onSelectListClose:Ye,onMouseDown:function(){ye.current=!0},filterText:ke.trim(),highlightedValue:Pe,noResultsMessage:W,isLoading:G,onListScrollBottom:J,tableHeader:N,multiColumn:Q,listPlacement:void 0!==ae?tt:ee,listMaxHeight:te,flipEnabled:re,multiselectValues:D,isOpen:je,enableVirtualScroll:le,virtualScrollOverscan:oe,listWidth:ae,children:I}),nt=s(se);return t(b,P(x({disabled:V,readOnly:F,hasTextCursor:!0,size:X,"data-component":"multiselect","data-role":Z,"data-element":Y,isOpen:je},nt),{children:[t("div",{ref:me,children:[e(v,{"data-element":"accessibility-label",id:pe.current,children:Ke}),e(u,x({ref:Ze,accessibilityLabelId:pe.current,activeDescendantId:ce,"aria-controls":de.current,ariaLabel:C,ariaLabelledby:k,hasTextCursor:!0,isOpen:je,labelId:Ve,value:et().formattedValue},et()))]}),rt]}))}));export{k as MultiSelect,k as default};
@@ -1 +1 @@
1
- import{jsxs as t,jsx as e,Fragment as o}from"react/jsx-runtime";import r,{forwardRef as n,useContext as i,useRef as l,useImperativeHandle as s}from"react";import{ThemeContext as a}from"styled-components";import{offset as c,flip as p}from"@floating-ui/dom";import u from"../../hooks/__internal__/useClickAwayListener/useClickAwayListener.js";import d from"../icon/icon.component.js";import m from"../button/button.component.js";import b from"./split-button.style.js";import f from"./split-button-toggle.style.js";import y from"./split-button-children.style.js";import h from"../../__internal__/utils/helpers/guid/index.js";import g from"../../__internal__/popover/popover.component.js";import"../../style/utils/filter-styled-system-padding-props.js";import j from"../../style/utils/filter-styled-system-margin-props.js";import _ from"../../style/utils/filter-out-styled-system-spacing-props.js";import"../../style/themes/sage/index.js";import O from"../../style/themes/base/index.js";import"../../style/themes/none/index.js";import w from"../../hooks/__internal__/useChildButtons/useChildButtons.js";import v from"../../hooks/__internal__/useAdaptiveSidebarModalFocus/useAdaptiveSidebarModalFocus.js";import P from"./__internal__/split-button.context.js";import x from"../../hooks/__internal__/useLocale/useLocale.js";import k from"../flat-table/__internal__/flat-table.context.js";function B(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function C(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter((function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable})))),r.forEach((function(e){B(t,e,o[e])}))}return t}function S(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach((function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})),t}const T=n(((n,B)=>{var{align:T="left",position:D="right",buttonType:A="secondary",children:L,disabled:z=!1,iconPosition:W="before",iconType:E,onClick:F,size:I="medium",subtext:M,text:K,"data-element":N,"data-role":U,"aria-label":V,isWhite:q=!1}=n,G=function(t,e){if(null==t)return{};var o,r,n=function(t,e){if(null==t)return{};var o,r,n={},i=Object.keys(t);for(r=0;r<i.length;r++)o=i[r],e.indexOf(o)>=0||(n[o]=t[o]);return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)o=i[r],e.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}(n,["align","position","buttonType","children","disabled","iconPosition","iconType","onClick","size","subtext","text","data-element","data-role","aria-label","isWhite"]);const H=x(),J=i(a)||O,Q=l(h()),R=l(h()),X=l(null),Y=l(null),{isInFlatTable:Z}=i(k),$="secondary"===A&&q;s(B,(()=>({focusMainButton(){var t;null===(t=X.current)||void 0===t||t.focus()},focusToggleButton(){var t;null===(t=Y.current)||void 0===t||t.focus()}})),[]);const{showAdditionalButtons:tt,showButtons:et,hideButtons:ot,buttonNode:rt,handleToggleButtonKeyDown:nt,wrapperProps:it,contextValue:lt}=w(Y,.75);return v((()=>ot())),t(b,S(C({"data-component":"split-button","data-element":N,"data-role":U,onClick:u(ot),ref:rt},j(G)),{children:[t(o,{children:[e(m,S(C({"data-element":"main-button",id:Q.current,ref:X,isWhite:$,subtext:M,size:I,iconType:E,disabled:z,buttonType:A,iconPosition:W,onClick:t=>{null==F||F(t),tt&&ot()}},_(G)),{children:K}),"main-button"),e(f,{"aria-expanded":tt,"aria-controls":R.current,"aria-label":V||H.splitButton.ariaLabel(),"data-element":"toggle-button",type:"button",ref:Y,isWhite:$,disabled:z,displayed:tt,buttonType:A,size:I,onKeyDown:nt,onClick:()=>{tt?ot():et()},children:e(d,{type:"dropdown",color:{primary:J.colors.white,secondary:J.colors.primary}[A],bg:"transparent",disabled:z})},"toggle-button")]}),e(g,{disableBackgroundUI:Z,disablePortal:!0,placement:"left"===D?"bottom-start":"bottom-end",popoverStrategy:"fixed",reference:rt,middleware:[c(6),p({fallbackStrategy:"initialPlacement"})],children:e(y,S(C({id:R.current},it),{align:T,hidden:!tt,children:e(P.Provider,{value:lt,children:r.Children.map(L,(t=>e("li",{children:t})))})}))})]}))}));export{T as SplitButton,T as default};
1
+ import{jsxs as t,Fragment as e,jsx as o}from"react/jsx-runtime";import r,{forwardRef as n,useContext as i,useRef as l,useImperativeHandle as s}from"react";import{ThemeContext as a}from"styled-components";import{offset as c,flip as p}from"@floating-ui/dom";import u from"../../hooks/__internal__/useClickAwayListener/useClickAwayListener.js";import d from"../icon/icon.component.js";import m from"../button/button.component.js";import b from"./split-button.style.js";import f from"./split-button-toggle.style.js";import y from"./split-button-children.style.js";import h from"../../__internal__/utils/helpers/guid/index.js";import g from"../../__internal__/popover/popover.component.js";import"../../style/utils/filter-styled-system-padding-props.js";import j from"../../style/utils/filter-styled-system-margin-props.js";import _ from"../../style/utils/filter-out-styled-system-spacing-props.js";import"../../style/themes/sage/index.js";import O from"../../style/themes/base/index.js";import"../../style/themes/none/index.js";import w from"../../hooks/__internal__/useChildButtons/useChildButtons.js";import v from"../../hooks/__internal__/useAdaptiveSidebarModalFocus/useAdaptiveSidebarModalFocus.js";import P from"./__internal__/split-button.context.js";import x from"../../hooks/__internal__/useLocale/useLocale.js";import k from"../flat-table/__internal__/flat-table.context.js";function B(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function C(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter((function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable})))),r.forEach((function(e){B(t,e,o[e])}))}return t}function S(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach((function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})),t}const T=n(((n,B)=>{var{align:T="left",position:D="right",buttonType:A="secondary",children:L,disabled:z=!1,iconPosition:W="before",iconType:E,onClick:F,size:I="medium",subtext:M,text:K,"data-element":N,"data-role":U,"aria-label":V,isWhite:q=!1}=n,G=function(t,e){if(null==t)return{};var o,r,n=function(t,e){if(null==t)return{};var o,r,n={},i=Object.keys(t);for(r=0;r<i.length;r++)o=i[r],e.indexOf(o)>=0||(n[o]=t[o]);return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)o=i[r],e.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}(n,["align","position","buttonType","children","disabled","iconPosition","iconType","onClick","size","subtext","text","data-element","data-role","aria-label","isWhite"]);const H=x(),J=i(a)||O,Q=l(h()),R=l(h()),X=l(null),Y=l(null),{isInFlatTable:Z}=i(k),$="secondary"===A&&q;s(B,(()=>({focusMainButton(){var t;null===(t=X.current)||void 0===t||t.focus()},focusToggleButton(){var t;null===(t=Y.current)||void 0===t||t.focus()}})),[]);const{showAdditionalButtons:tt,showButtons:et,hideButtons:ot,buttonNode:rt,handleToggleButtonKeyDown:nt,wrapperProps:it,contextValue:lt}=w(Y,.75);return v((()=>ot())),t(b,S(C({"data-component":"split-button","data-element":N,"data-role":U,onClick:u(ot),ref:rt},j(G)),{children:[t(e,{children:[o(m,S(C({"data-element":"main-button",id:Q.current,ref:X,isWhite:$,subtext:M,size:I,iconType:E,disabled:z,buttonType:A,iconPosition:W,onClick:t=>{null==F||F(t),tt&&ot()}},_(G)),{children:K}),"main-button"),o(f,{"aria-expanded":tt,"aria-controls":R.current,"aria-label":V||H.splitButton.ariaLabel(),"data-element":"toggle-button",type:"button",ref:Y,isWhite:$,disabled:z,displayed:tt,buttonType:A,size:I,onKeyDown:nt,onClick:()=>{tt?ot():et()},children:o(d,{type:"dropdown",color:{primary:J.colors.white,secondary:J.colors.primary}[A],bg:"transparent",disabled:z})},"toggle-button")]}),o(g,{disableBackgroundUI:Z,disablePortal:!0,placement:"left"===D?"bottom-start":"bottom-end",popoverStrategy:"fixed",reference:rt,middleware:[c(6),p({fallbackStrategy:"initialPlacement"})],children:o(y,S(C({id:R.current},it),{align:T,hidden:!tt,children:o(P.Provider,{value:lt,children:r.Children.map(L,(t=>o("li",{children:t})))})}))})]}))}));export{T as SplitButton,T as default};
@@ -1 +1 @@
1
- import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{forwardRef as n,useRef as o,useImperativeHandle as i,useCallback as a,useEffect as l,useState as c}from"react";import{TabsProvider as s,useTabs as b}from"./tabs.context.js";import{StyledTabs as d,StyledTabListWrapper as u,StyledTabList as f,StyledTabPanel as h,StyledScrollButton as p,StyledScrollButtonPlaceholder as g,StyledTab as y,Spacer as v}from"./tabs.style.js";import m from"../../../__internal__/utils/logger/index.js";import O from"../../../hooks/__internal__/useResizeObserver/useResizeObserver.js";import j from"../../../hooks/__internal__/useLocale/useLocale.js";import _ from"../../icon/icon.component.js";import{TabProvider as w}from"./tab.context.js";import x from"../../../hooks/__internal__/usePrevious/index.js";import k from"../../../__internal__/utils/helpers/guid/index.js";import I from"../../../__internal__/utils/helpers/tags/tags.js";import S from"../../../__internal__/utils/helpers/extract-text/index.js";function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function L(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){T(e,t,r[t])}))}return e}function $(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 P(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}const z=t=>{var{children:r,id:n,tabId:o}=t,i=P(t,["children","id","tabId"]);const{activeTab:a}=b();return e(w,{tabId:o,visible:o===a,children:e(h,$(L({id:n,role:"tabpanel","aria-labelledby":o},I("tab-panel",i)),{children:r}))})};let A=!1;const C=t=>{var{controls:n,error:o=!1,id:i,label:a,leftSlot:s,rightSlot:d,warning:u=!1,info:f=!1,hasCustomLayout:h,headerWidth:p,href:g}=t,v=P(t,["controls","error","id","label","leftSlot","rightSlot","warning","info","hasCustomLayout","headerWidth","href"]);const O=j(),[x,k]=c(o),[T,z]=c(u),[C,W]=c(f),{activeTab:D,focusIndex:E,orientation:N,setActiveTab:R,setCurrentTabId:B,setFocusIndex:q,size:F,errors:U,warnings:G,infos:H}=b(),K=D===i;l((()=>{K&&B(i)}),[i,K,B]),!s&&!d||"string"==typeof a||A||(m.warn("[WARNING] Using `leftSlot` and/or `rightSlot` is not supported when `label` is not a string. Please use `leftSlot` and/or `rightSlot` alongside a string `label`, or use the `label` prop exclusively."),A=!0),l((()=>{if(E===i){const e=document.getElementById(i);null==e||e.focus()}}),[E,i,B]),l((()=>{let e=U[i],t=G[i],r=H[i];if(o&&!e&&(e={static:o}),u&&!t&&(t={static:u}),f&&!r&&(r={static:f}),!e)return void k(!1);const n=Object.keys(e).map((t=>e[t])).filter((e=>!1!==e)),a=o||!!n.length;if(k(a),!t)return void z(!1);const l=Object.keys(t).map((e=>t[e])).filter((e=>!1!==e)),c=u||!!l.length;if(z(c),!r)return void W(!1);const s=Object.keys(r).map((e=>r[e])).filter((e=>!1!==e)),b=f||!!s.length;W(b)}),[o,i,U,G,u,H,f]);const J=()=>{const t=S(a);if(x||T||C){if(x)return e(_,{"data-role":"icon-error",type:"error",ariaLabel:O.tabs.error(t),color:"#db004e"});if(T)return e(_,{"data-role":"icon-warning",type:"warning",ariaLabel:O.tabs.warning(t),color:"#d64309"});if(C)return e(_,{"data-role":"icon-info",type:"info",ariaLabel:O.tabs.info(t),color:"#0060a7ff"})}return null};return e(w,{tabId:i,visible:!0,children:e(y,$(L($(L({activeTab:D===i,className:D===i?"active-tab":"","aria-controls":n,"aria-selected":K?"true":"false",error:x,warning:T,info:C,id:i,onClick:()=>{R(i),q(i)},$orientation:N,role:"tab",$size:F,type:g?void 0:"button",tabIndex:D===i?0:-1,$hasCustomLayout:h,$headerWidth:p},I("tab",v)),{"data-tabid":i,as:g?"a":void 0}),g&&{href:g,target:"_blank",style:{textDecoration:"none",display:"block",boxSizing:"border-box"}}),{children:r("span","string"==typeof a?{className:"tab-title-content-wrapper",children:[s,a,d,J()]}:{className:"tab-title-content-wrapper",children:[a,J()]})}))})},W=n(((n,s)=>{var{ariaLabel:d,children:h,onTabChange:y,headerWidth:m}=n,w=P(n,["ariaLabel","children","onTabChange","headerWidth"]);const S=o(null),{activeTab:T,focusIndex:z,orientation:A,selectedTabId:C,setFocusIndex:W,setActiveTab:D,size:E}=b(),N=o(k()),R=o(k()),B=o(k()),q=j();i(s,(()=>({focusTab:e=>{var t;const r=null===(t=S.current)||void 0===t?void 0:t.querySelector(`#${e}`);null==r||r.focus(),W(e),D(e)}})));const F=a((()=>{var e;const t=(null===(e=S.current)||void 0===e?void 0:e.querySelectorAll("[role='tab']"))||[];return Array.from(t).map((e=>e.id)).filter((e=>e))}),[]);l((()=>{if(C)D(C);else if(!T){const e=F()[0];D(e)}}),[T,F,C,D]);const U=x(T);l((()=>{U&&U!==T&&(null==y||y(T))}),[T,y,U]);const G=a((e=>{const t=F(),r=t.indexOf(z||T),n=t.length-1;if(-1===r)return;let o=r;switch(e.key){case"Home":o=0;break;case"End":o=n;break;case"ArrowRight":o=(r+1)%t.length;break;case"ArrowLeft":o=(r-1+t.length)%t.length;break;case"ArrowUp":"vertical"===A&&(o=(r-1+t.length)%t.length);break;case"ArrowDown":"vertical"===A&&(o=(r+1)%t.length);break;case"Enter":case" ":return void D(T);case"Tab":return void W(T);default:return}W(t[o])}),[T,z,F,A,D,W]),[H,K]=c(!1),[J,M]=c(!1),[Q,V]=c(!1),X=a((()=>{if(S.current){const e=S.current.scrollWidth-S.current.clientWidth-20;K(e>0),M(S.current.scrollLeft>=20),V(S.current.scrollLeft<=e)}}),[]);O(S,(()=>{X()})),l((()=>{S.current&&X()}),[X]);const Y=e=>{S.current&&("left"===e?S.current.scrollLeft-=200:S.current.scrollLeft+=200,X())};return e(t,{children:r(u,{$headerWidth:m,"data-role":"tab-list-wrapper",children:["vertical"!==A&&H?J?e(p,{"data-role":"tab-navigation-button-left",id:`tab-navigation-button-left-${N.current}`,onClick:()=>Y("left"),$size:E,tabIndex:-1,title:null===(Z=(ee=q.tabs).scrollLeftText)||void 0===Z?void 0:Z.call(ee),type:"button",children:e(_,{type:"chevron_left"})}):e(g,{$size:E}):null,r(f,$(L({"aria-label":d,id:`tablist-${B.current}`,onKeyDown:G,$orientation:A,ref:S,role:"tablist",tabIndex:-1},I("tab-list",w)),{children:[h,e(v,{})]})),(()=>{var t,r;return"vertical"!==A&&H?Q?e(p,{"data-role":"tab-navigation-button-right",id:`tab-navigation-button-right-${R.current}`,onClick:()=>Y("right"),$size:E,tabIndex:-1,title:null===(t=(r=q.tabs).scrollRightText)||void 0===t?void 0:t.call(r),type:"button",children:e(_,{type:"chevron_right"})}):e(g,{$size:E}):null})()]})});var Z,ee})),D=t=>{var{children:r,labelledBy:n="",orientation:i="horizontal",selectedTabId:a,size:l="medium"}=t,c=P(t,["children","labelledBy","orientation","selectedTabId","size"]);const b=o(k());return e(s,{labelledBy:n,orientation:i,selectedTabId:a,size:l,children:e(d,$(L({id:`tabs-container-${b.current}`,$orientation:i},I("tabs",c)),{children:r}))})};export{C as Tab,W as TabList,z as TabPanel,D as Tabs,D as default};
1
+ import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{useRef as n,forwardRef as o,useImperativeHandle as i,useCallback as a,useEffect as l,useState as c}from"react";import{TabsProvider as s,useTabs as b}from"./tabs.context.js";import{StyledTabs as d,StyledTabListWrapper as u,StyledTabList as f,StyledTabPanel as h,StyledScrollButton as p,StyledScrollButtonPlaceholder as g,StyledTab as y,Spacer as v}from"./tabs.style.js";import m from"../../../__internal__/utils/logger/index.js";import O from"../../../hooks/__internal__/useResizeObserver/useResizeObserver.js";import j from"../../../hooks/__internal__/useLocale/useLocale.js";import _ from"../../icon/icon.component.js";import{TabProvider as w}from"./tab.context.js";import x from"../../../hooks/__internal__/usePrevious/index.js";import k from"../../../__internal__/utils/helpers/guid/index.js";import I from"../../../__internal__/utils/helpers/tags/tags.js";import S from"../../../__internal__/utils/helpers/extract-text/index.js";function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function L(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){T(e,t,r[t])}))}return e}function $(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 P(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}const z=t=>{var{children:r,id:n,tabId:o}=t,i=P(t,["children","id","tabId"]);const{activeTab:a}=b();return e(w,{tabId:o,visible:o===a,children:e(h,$(L({id:n,role:"tabpanel","aria-labelledby":o},I("tab-panel",i)),{children:r}))})};let A=!1;const C=t=>{var{controls:n,error:o=!1,id:i,label:a,leftSlot:s,rightSlot:d,warning:u=!1,info:f=!1,hasCustomLayout:h,headerWidth:p,href:g}=t,v=P(t,["controls","error","id","label","leftSlot","rightSlot","warning","info","hasCustomLayout","headerWidth","href"]);const O=j(),[x,k]=c(o),[T,z]=c(u),[C,W]=c(f),{activeTab:D,focusIndex:E,orientation:N,setActiveTab:R,setCurrentTabId:B,setFocusIndex:q,size:F,errors:U,warnings:G,infos:H}=b(),K=D===i;l((()=>{K&&B(i)}),[i,K,B]),!s&&!d||"string"==typeof a||A||(m.warn("[WARNING] Using `leftSlot` and/or `rightSlot` is not supported when `label` is not a string. Please use `leftSlot` and/or `rightSlot` alongside a string `label`, or use the `label` prop exclusively."),A=!0),l((()=>{if(E===i){const e=document.getElementById(i);null==e||e.focus()}}),[E,i,B]),l((()=>{let e=U[i],t=G[i],r=H[i];if(o&&!e&&(e={static:o}),u&&!t&&(t={static:u}),f&&!r&&(r={static:f}),!e)return void k(!1);const n=Object.keys(e).map((t=>e[t])).filter((e=>!1!==e)),a=o||!!n.length;if(k(a),!t)return void z(!1);const l=Object.keys(t).map((e=>t[e])).filter((e=>!1!==e)),c=u||!!l.length;if(z(c),!r)return void W(!1);const s=Object.keys(r).map((e=>r[e])).filter((e=>!1!==e)),b=f||!!s.length;W(b)}),[o,i,U,G,u,H,f]);const J=()=>{const t=S(a);if(x||T||C){if(x)return e(_,{"data-role":"icon-error",type:"error",ariaLabel:O.tabs.error(t),color:"#db004e"});if(T)return e(_,{"data-role":"icon-warning",type:"warning",ariaLabel:O.tabs.warning(t),color:"#d64309"});if(C)return e(_,{"data-role":"icon-info",type:"info",ariaLabel:O.tabs.info(t),color:"#0060a7ff"})}return null};return e(w,{tabId:i,visible:!0,children:e(y,$(L($(L({activeTab:D===i,className:D===i?"active-tab":"","aria-controls":n,"aria-selected":K?"true":"false",error:x,warning:T,info:C,id:i,onClick:()=>{R(i),q(i)},$orientation:N,role:"tab",$size:F,type:g?void 0:"button",tabIndex:D===i?0:-1,$hasCustomLayout:h,$headerWidth:p},I("tab",v)),{"data-tabid":i,as:g?"a":void 0}),g&&{href:g,target:"_blank",style:{textDecoration:"none",display:"block",boxSizing:"border-box"}}),{children:r("span","string"==typeof a?{className:"tab-title-content-wrapper",children:[s,a,d,J()]}:{className:"tab-title-content-wrapper",children:[a,J()]})}))})},W=o(((o,s)=>{var{ariaLabel:d,children:h,onTabChange:y,headerWidth:m}=o,w=P(o,["ariaLabel","children","onTabChange","headerWidth"]);const S=n(null),{activeTab:T,focusIndex:z,orientation:A,selectedTabId:C,setFocusIndex:W,setActiveTab:D,size:E}=b(),N=n(k()),R=n(k()),B=n(k()),q=j();i(s,(()=>({focusTab:e=>{var t;const r=null===(t=S.current)||void 0===t?void 0:t.querySelector(`#${e}`);null==r||r.focus(),W(e),D(e)}})));const F=a((()=>{var e;const t=(null===(e=S.current)||void 0===e?void 0:e.querySelectorAll("[role='tab']"))||[];return Array.from(t).map((e=>e.id)).filter((e=>e))}),[]);l((()=>{if(C)D(C);else if(!T){const e=F()[0];D(e)}}),[T,F,C,D]);const U=x(T);l((()=>{U&&U!==T&&(null==y||y(T))}),[T,y,U]);const G=a((e=>{const t=F(),r=t.indexOf(z||T),n=t.length-1;if(-1===r)return;let o=r;switch(e.key){case"Home":o=0;break;case"End":o=n;break;case"ArrowRight":o=(r+1)%t.length;break;case"ArrowLeft":o=(r-1+t.length)%t.length;break;case"ArrowUp":"vertical"===A&&(o=(r-1+t.length)%t.length);break;case"ArrowDown":"vertical"===A&&(o=(r+1)%t.length);break;case"Enter":case" ":return void D(T);case"Tab":return void W(T);default:return}W(t[o])}),[T,z,F,A,D,W]),[H,K]=c(!1),[J,M]=c(!1),[Q,V]=c(!1),X=a((()=>{if(S.current){const e=S.current.scrollWidth-S.current.clientWidth-20;K(e>0),M(S.current.scrollLeft>=20),V(S.current.scrollLeft<=e)}}),[]);O(S,(()=>{X()})),l((()=>{S.current&&X()}),[X]);const Y=e=>{S.current&&("left"===e?S.current.scrollLeft-=200:S.current.scrollLeft+=200,X())};return e(t,{children:r(u,{$headerWidth:m,"data-role":"tab-list-wrapper",children:["vertical"!==A&&H?J?e(p,{"data-role":"tab-navigation-button-left",id:`tab-navigation-button-left-${N.current}`,onClick:()=>Y("left"),$size:E,tabIndex:-1,title:null===(Z=(ee=q.tabs).scrollLeftText)||void 0===Z?void 0:Z.call(ee),type:"button",children:e(_,{type:"chevron_left"})}):e(g,{$size:E}):null,r(f,$(L({"aria-label":d,id:`tablist-${B.current}`,onKeyDown:G,$orientation:A,ref:S,role:"tablist",tabIndex:-1},I("tab-list",w)),{children:[h,e(v,{})]})),(()=>{var t,r;return"vertical"!==A&&H?Q?e(p,{"data-role":"tab-navigation-button-right",id:`tab-navigation-button-right-${R.current}`,onClick:()=>Y("right"),$size:E,tabIndex:-1,title:null===(t=(r=q.tabs).scrollRightText)||void 0===t?void 0:t.call(r),type:"button",children:e(_,{type:"chevron_right"})}):e(g,{$size:E}):null})()]})});var Z,ee})),D=t=>{var{children:r,labelledBy:o="",orientation:i="horizontal",selectedTabId:a,size:l="medium"}=t,c=P(t,["children","labelledBy","orientation","selectedTabId","size"]);const b=n(k());return e(s,{labelledBy:o,orientation:i,selectedTabId:a,size:l,children:e(d,$(L({id:`tabs-container-${b.current}`,$orientation:i},I("tabs",c)),{children:r}))})};export{C as Tab,W as TabList,z as TabPanel,D as Tabs,D as default};
@@ -1 +1 @@
1
- import{TextNode as e,$applyNodeReplacement as t}from"lexical";function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class r extends e{static getType(){return"mention"}static clone(e){return new r(e.__mention,e.__text,e.__key)}createDOM(e){const t=super.createDOM(e);return t.style.cssText="\n background-color: #EFEFEFFF;\n border: 1px solid #656565FF;\n border-radius: 6px;\n color: #000000DD;\n cursor: pointer;\n display: inline-block;\n font-weight: 400;\n line-height: 1.25rem;\n min-height: 21px;\n padding: 0px 8px;\n margin: 0px 4px;\n",t.className="mention",t.spellcheck=!1,t}exportJSON(){return e=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){n(e,t,r[t])}))}return e}({},super.exportJSON()),t=null!=(t={type:"mention",version:1,mention:this.__mention,format:0})?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;var e,t}static importJSON(e){return new r(e.mention,e.text)}setFormat(){return this}toggleFormat(){return this}hasFormat(){return!1}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}constructor(e,t,r){super(null!=t?t:e,r),n(this,"__mention",void 0),this.__mention=e}}function o(e,n){const o=new r(e,null!=n?n:e);return o.setMode("token").toggleDirectionless(),t(o)}function i(e){return e instanceof r}const c=e=>{const{textContent:t}=e,n=e.getAttribute("data-lexical-mention-name");return(null==t?void 0:t.length)?{node:o("string"==typeof n?n:t,t)}:null};export{c as $convertMentionElement,o as $createMentionNode,i as $isMentionNode,r as MentionNode};
1
+ import{$applyNodeReplacement as e,TextNode as t}from"lexical";function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class r extends t{static getType(){return"mention"}static clone(e){return new r(e.__mention,e.__text,e.__key)}createDOM(e){const t=super.createDOM(e);return t.style.cssText="\n background-color: #EFEFEFFF;\n border: 1px solid #656565FF;\n border-radius: 6px;\n color: #000000DD;\n cursor: pointer;\n display: inline-block;\n font-weight: 400;\n line-height: 1.25rem;\n min-height: 21px;\n padding: 0px 8px;\n margin: 0px 4px;\n",t.className="mention",t.spellcheck=!1,t}exportJSON(){return e=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){n(e,t,r[t])}))}return e}({},super.exportJSON()),t=null!=(t={type:"mention",version:1,mention:this.__mention,format:0})?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;var e,t}static importJSON(e){return new r(e.mention,e.text)}setFormat(){return this}toggleFormat(){return this}hasFormat(){return!1}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}constructor(e,t,r){super(null!=t?t:e,r),n(this,"__mention",void 0),this.__mention=e}}function o(t,n){const o=new r(t,null!=n?n:t);return o.setMode("token").toggleDirectionless(),e(o)}function i(e){return e instanceof r}const c=e=>{const{textContent:t}=e,n=e.getAttribute("data-lexical-mention-name");return(null==t?void 0:t.length)?{node:o("string"==typeof n?n:t,t)}:null};export{c as $convertMentionElement,o as $createMentionNode,i as $isMentionNode,r as MentionNode};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useLexicalComposerContext as n}from"@lexical/react/LexicalComposerContext";import{mergeRegister as i}from"@lexical/utils";import{$getSelection as r,$isRangeSelection as l,$getRoot as a,$createTextNode as s,$createParagraphNode as d,$isParagraphNode as c}from"lexical";import{useRef as u,useState as m,useCallback as p,useEffect as b}from"react";import{StyledToolbarWrapper as f,StyledToolbar as h,CommandButtons as g}from"./toolbar.style.js";import v from"../../../../button/button.component.js";import y from"../../../../../hooks/__internal__/useLocale/useLocale.js";import x from"./buttons/bold.component.js";import k from"./buttons/hyperlink.component.js";import j from"./buttons/italic.component.js";import E from"./buttons/list.component.js";import F from"./buttons/save.component.js";import w from"./buttons/typography.component.js";import z from"./buttons/underline.component.js";import B from"./button-group/button-group.component.js";import{TEXT_EDITOR_ACTION_TYPES as C}from"../../__utils__/constants.js";import{Textbox as D}from"../../../../textbox/textbox.component.js";import{$createLinkNode as L}from"@lexical/link";import{Dialog as $}from"../../../../dialog/dialog.component.js";import{Form as A}from"../../../../form/form.component.js";import"../../../../form/required-fields-indicator/required-fields-indicator.component.js";const I=({contentEditorRef:I,namespace:S,hasHeader:_,onCancel:q,onSave:O,size:T="medium",toolbarControls:H=["typography","bold","italic","underline","unordered-list","ordered-list","link"]})=>{const[R]=n(),U=R.isEditable(),N=u(null),[K,G]=m(!1),[J,M]=m(!1),[P,Q]=m(!1),[V,W]=m(!1),[X,Y]=m(!1),[Z,ee]=m(-1),[te,oe]=m(""),[ne,ie]=m(""),re=y(),le=H.includes("typography"),ae=H.includes("bold")||H.includes("italic")||H.includes("underline"),se=H.includes("unordered-list")||H.includes("ordered-list"),de=H.includes("link"),ce=p((()=>{const e=r();l(e)&&(G(e.hasFormat(C.Bold)),M(e.hasFormat(C.Italic)),Q(e.hasFormat(C.Underline)))}),[]);b((()=>i(R.registerUpdateListener((({editorState:e})=>{e.read((()=>{R.isEditable()&&ce()}))})))),[ce,R]);const ue=()=>{oe(""),ie(""),W(!1)};if(!U)return null;const me=te.length&&ne.length;return e(f,{"data-role":`${S}-toolbar-wrapper`,hasHeader:_,id:`${S}-toolbar-wrapper`,size:T,children:[e(h,{role:"toolbar","aria-label":re.textEditor.toolbarAriaLabel(),"data-role":`${S}-toolbar`,id:`${S}-toolbar`,ref:N,onKeyDown:e=>{var t,o;if(0===H.length||!N.current)return;const n=Array.from(null===(t=N.current)||void 0===t?void 0:t.querySelectorAll("button.toolbar-button"));if(!n.length)return;const i=n.findIndex((e=>{var t;return e.id===(null===(t=document.activeElement)||void 0===t?void 0:t.id)}));let r=-1;switch(e.key){case"ArrowRight":e.preventDefault(),X||(r=i<n.length-1?i+1:0);break;case"ArrowLeft":e.preventDefault(),X||(r=i>0?i-1:n.length-1);break;case"Home":e.preventDefault(),r=0;break;case"End":e.preventDefault(),r=n.length-1;break;default:return}n.forEach(((e,t)=>{e.tabIndex=t===r?0:-1})),r>-1&&(null===(o=n[r])||void 0===o||o.focus())},tabIndex:-1,children:[e(o,{children:[le&&t(B,{name:"typography-formatting-buttons",namespace:S,showDivider:ae||se||de,children:t(w,{contentEditorRef:I,namespace:S,isFirstButton:!0,isOpen:X,setIsOpen:Y,focusedIndex:Z,setFocusedIndex:ee,size:T})}),ae&&e(B,{name:"text-formatting-buttons",namespace:S,showDivider:se||de,children:[H.includes("bold")&&t(x,{isActive:K,namespace:S,isFirstButton:!le,size:T}),H.includes("italic")&&t(j,{isActive:J,namespace:S,isFirstButton:!le&&!H.includes("bold"),size:T}),H.includes("underline")&&t(z,{isActive:P,namespace:S,isFirstButton:!le&&!H.includes("bold")&&!H.includes("italic"),size:T})]}),se&&t(B,{name:"list-formatting-buttons",namespace:S,showDivider:de,children:t(E,{namespace:S,olIsFirstButton:!le&&!ae&&!H.includes("unordered-list"),showOL:H.includes("ordered-list"),showUL:H.includes("unordered-list"),ulIsFirstButton:!le&&!ae,size:T})}),de&&t(B,{name:"hyperlink-formatting-buttons",namespace:S,showDivider:!1,children:t(k,{namespace:S,isFirstButton:!le&&!ae&&!se,setDialogOpen:W,size:T})})]}),t($,{open:V,onCancel:()=>{ue()},title:re.textEditor.hyperlink.dialogTitle(),"data-role":`${S}-hyperlink-dialog`,"aria-label":re.textEditor.hyperlink.dialogTitle(),size:"small",children:e(A,{leftSideButtons:t(v,{"data-role":`${S}-hyperlink-cancel-button`,onClick:()=>{ue()},children:"Cancel"}),saveButton:t(v,{buttonType:"primary",type:"submit",disabled:!me,"data-role":`${S}-hyperlink-save-button`,children:"Save"}),onSubmit:e=>{e.preventDefault(),R.isEditable()&&(R.update((()=>{const e=a(),t=e.getChildrenSize(),o=r(),n=L(ne);if(n.append(s(te)),0===t){const t=d();t.append(n),e.append(t),t.selectEnd()}else if(l(o))o.insertNodes([n]);else{const t=e.getLastChild();c(t)&&t.append(n)}})),ue())},children:[t(D,{label:re.textEditor.hyperlink.textFieldLabel(),name:"text",required:!0,"data-role":`${S}-hyperlink-text-field`,value:te,onChange:e=>oe(e.target.value)}),t(D,{label:re.textEditor.hyperlink.linkFieldLabel(),name:"link",required:!0,"data-role":`${S}-hyperlink-link-field`,value:ne,onChange:e=>ie(e.target.value)})]})})]}),e(g,{"data-role":`${S}-command-buttons`,children:[q&&t(v,{buttonType:"tertiary","data-role":`${S}-cancel-button`,"aria-label":re.textEditor.cancelButtonAria(),onClick:()=>null==q?void 0:q(R),size:T,className:"command-button",children:re.textEditor.cancelButton()}),O&&t(F,{namespace:S,onSave:O,size:T})]})]})};export{I as default};
1
+ import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import{useLexicalComposerContext as n}from"@lexical/react/LexicalComposerContext";import{mergeRegister as i}from"@lexical/utils";import{$getSelection as r,$isRangeSelection as l,$getRoot as a,$createTextNode as s,$createParagraphNode as d,$isParagraphNode as c}from"lexical";import{useRef as u,useState as m,useCallback as p,useEffect as b}from"react";import{StyledToolbarWrapper as f,StyledToolbar as h,CommandButtons as g}from"./toolbar.style.js";import v from"../../../../button/button.component.js";import y from"../../../../../hooks/__internal__/useLocale/useLocale.js";import x from"./buttons/bold.component.js";import k from"./buttons/hyperlink.component.js";import j from"./buttons/italic.component.js";import E from"./buttons/list.component.js";import F from"./buttons/save.component.js";import w from"./buttons/typography.component.js";import z from"./buttons/underline.component.js";import B from"./button-group/button-group.component.js";import{TEXT_EDITOR_ACTION_TYPES as C}from"../../__utils__/constants.js";import{Textbox as D}from"../../../../textbox/textbox.component.js";import{$createLinkNode as L}from"@lexical/link";import{Dialog as $}from"../../../../dialog/dialog.component.js";import{Form as A}from"../../../../form/form.component.js";import"../../../../form/required-fields-indicator/required-fields-indicator.component.js";const I=({contentEditorRef:I,namespace:S,hasHeader:_,onCancel:q,onSave:O,size:T="medium",toolbarControls:H=["typography","bold","italic","underline","unordered-list","ordered-list","link"]})=>{const[R]=n(),U=R.isEditable(),N=u(null),[K,G]=m(!1),[J,M]=m(!1),[P,Q]=m(!1),[V,W]=m(!1),[X,Y]=m(!1),[Z,ee]=m(-1),[te,oe]=m(""),[ne,ie]=m(""),re=y(),le=H.includes("typography"),ae=H.includes("bold")||H.includes("italic")||H.includes("underline"),se=H.includes("unordered-list")||H.includes("ordered-list"),de=H.includes("link"),ce=p((()=>{const e=r();l(e)&&(G(e.hasFormat(C.Bold)),M(e.hasFormat(C.Italic)),Q(e.hasFormat(C.Underline)))}),[]);b((()=>i(R.registerUpdateListener((({editorState:e})=>{e.read((()=>{R.isEditable()&&ce()}))})))),[ce,R]);const ue=()=>{oe(""),ie(""),W(!1)};if(!U)return null;const me=te.length&&ne.length;return e(f,{"data-role":`${S}-toolbar-wrapper`,hasHeader:_,id:`${S}-toolbar-wrapper`,size:T,children:[e(h,{role:"toolbar","aria-label":re.textEditor.toolbarAriaLabel(),"data-role":`${S}-toolbar`,id:`${S}-toolbar`,ref:N,onKeyDown:e=>{var t,o;if(0===H.length||!N.current)return;const n=Array.from(null===(t=N.current)||void 0===t?void 0:t.querySelectorAll("button.toolbar-button"));if(!n.length)return;const i=n.findIndex((e=>{var t;return e.id===(null===(t=document.activeElement)||void 0===t?void 0:t.id)}));let r=-1;switch(e.key){case"ArrowRight":e.preventDefault(),X||(r=i<n.length-1?i+1:0);break;case"ArrowLeft":e.preventDefault(),X||(r=i>0?i-1:n.length-1);break;case"Home":e.preventDefault(),r=0;break;case"End":e.preventDefault(),r=n.length-1;break;default:return}n.forEach(((e,t)=>{e.tabIndex=t===r?0:-1})),r>-1&&(null===(o=n[r])||void 0===o||o.focus())},tabIndex:-1,children:[e(t,{children:[le&&o(B,{name:"typography-formatting-buttons",namespace:S,showDivider:ae||se||de,children:o(w,{contentEditorRef:I,namespace:S,isFirstButton:!0,isOpen:X,setIsOpen:Y,focusedIndex:Z,setFocusedIndex:ee,size:T})}),ae&&e(B,{name:"text-formatting-buttons",namespace:S,showDivider:se||de,children:[H.includes("bold")&&o(x,{isActive:K,namespace:S,isFirstButton:!le,size:T}),H.includes("italic")&&o(j,{isActive:J,namespace:S,isFirstButton:!le&&!H.includes("bold"),size:T}),H.includes("underline")&&o(z,{isActive:P,namespace:S,isFirstButton:!le&&!H.includes("bold")&&!H.includes("italic"),size:T})]}),se&&o(B,{name:"list-formatting-buttons",namespace:S,showDivider:de,children:o(E,{namespace:S,olIsFirstButton:!le&&!ae&&!H.includes("unordered-list"),showOL:H.includes("ordered-list"),showUL:H.includes("unordered-list"),ulIsFirstButton:!le&&!ae,size:T})}),de&&o(B,{name:"hyperlink-formatting-buttons",namespace:S,showDivider:!1,children:o(k,{namespace:S,isFirstButton:!le&&!ae&&!se,setDialogOpen:W,size:T})})]}),o($,{open:V,onCancel:()=>{ue()},title:re.textEditor.hyperlink.dialogTitle(),"data-role":`${S}-hyperlink-dialog`,"aria-label":re.textEditor.hyperlink.dialogTitle(),size:"small",children:e(A,{leftSideButtons:o(v,{"data-role":`${S}-hyperlink-cancel-button`,onClick:()=>{ue()},children:"Cancel"}),saveButton:o(v,{buttonType:"primary",type:"submit",disabled:!me,"data-role":`${S}-hyperlink-save-button`,children:"Save"}),onSubmit:e=>{e.preventDefault(),R.isEditable()&&(R.update((()=>{const e=a(),t=e.getChildrenSize(),o=r(),n=L(ne);if(n.append(s(te)),0===t){const t=d();t.append(n),e.append(t),t.selectEnd()}else if(l(o))o.insertNodes([n]);else{const t=e.getLastChild();c(t)&&t.append(n)}})),ue())},children:[o(D,{label:re.textEditor.hyperlink.textFieldLabel(),name:"text",required:!0,"data-role":`${S}-hyperlink-text-field`,value:te,onChange:e=>oe(e.target.value)}),o(D,{label:re.textEditor.hyperlink.linkFieldLabel(),name:"link",required:!0,"data-role":`${S}-hyperlink-link-field`,value:ne,onChange:e=>ie(e.target.value)})]})})]}),e(g,{"data-role":`${S}-command-buttons`,children:[q&&o(v,{buttonType:"tertiary","data-role":`${S}-cancel-button`,"aria-label":re.textEditor.cancelButtonAria(),onClick:()=>null==q?void 0:q(R),size:T,className:"command-button",children:re.textEditor.cancelButton()}),O&&o(F,{namespace:S,onSave:O,size:T})]})]})};export{I as default};
@@ -1 +1 @@
1
- export{Textarea as default}from"./textarea.component.js";
1
+ export{OriginalTextarea as default}from"./textarea.component.js";