carbon-react 158.27.1 → 158.27.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/__internal__/label/label.component.d.ts +4 -2
- package/esm/__internal__/label/label.component.js +1 -1
- package/esm/components/text-editor/text-editor.component.js +1 -1
- package/esm/components/time/time.style.d.ts +1 -1
- package/lib/__internal__/label/label.component.d.ts +4 -2
- package/lib/__internal__/label/label.component.js +1 -1
- package/lib/components/text-editor/text-editor.component.js +1 -1
- package/lib/components/time/time.style.d.ts +1 -1
- package/package.json +2 -2
|
@@ -29,7 +29,9 @@ export interface LabelProps extends ValidationProps, StyledLabelProps, StyledLab
|
|
|
29
29
|
"aria-label"?: string;
|
|
30
30
|
/** Whether this component is shown against a dark background */
|
|
31
31
|
isDarkBackground?: boolean;
|
|
32
|
+
/** @internal @private */
|
|
33
|
+
onClick?: () => void;
|
|
32
34
|
}
|
|
33
|
-
export declare const Label: ({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, isLarge, }: LabelProps) => React.JSX.Element;
|
|
34
|
-
declare const _default: React.MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, isLarge, }: LabelProps) => React.JSX.Element>;
|
|
35
|
+
export declare const Label: ({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, onClick, "aria-label": ariaLabel, isLarge, }: LabelProps) => React.JSX.Element;
|
|
36
|
+
declare const _default: React.MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, onClick, "aria-label": ariaLabel, isLarge, }: LabelProps) => React.JSX.Element>;
|
|
35
37
|
export default _default;
|
|
@@ -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:
|
|
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 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{LexicalComposer as n}from"@lexical/react/LexicalComposer";import{ClickableLinkPlugin as o}from"@lexical/react/LexicalClickableLinkPlugin";import{LexicalErrorBoundary as i}from"@lexical/react/LexicalErrorBoundary";import{HistoryPlugin as a}from"@lexical/react/LexicalHistoryPlugin";import{MarkdownShortcutPlugin as l}from"@lexical/react/LexicalMarkdownShortcutPlugin";import{RichTextPlugin as s}from"@lexical/react/LexicalRichTextPlugin";import{LinkPlugin as c}from"@lexical/react/LexicalLinkPlugin";import{ListPlugin as
|
|
1
|
+
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{LexicalComposer as n}from"@lexical/react/LexicalComposer";import{ClickableLinkPlugin as o}from"@lexical/react/LexicalClickableLinkPlugin";import{LexicalErrorBoundary as i}from"@lexical/react/LexicalErrorBoundary";import{HistoryPlugin as a}from"@lexical/react/LexicalHistoryPlugin";import{MarkdownShortcutPlugin as l}from"@lexical/react/LexicalMarkdownShortcutPlugin";import{RichTextPlugin as s}from"@lexical/react/LexicalRichTextPlugin";import{LinkPlugin as c}from"@lexical/react/LexicalLinkPlugin";import{ListPlugin as d}from"@lexical/react/LexicalListPlugin";import{OnChangePlugin as p}from"@lexical/react/LexicalOnChangePlugin";import{$getRoot as u}from"lexical";import _,{forwardRef as m,useRef as f,useState as g,useImperativeHandle as h,useEffect as v,useMemo as b,useCallback as x}from"react";import y from"../../__internal__/label/label.component.js";import j from"../../hooks/__internal__/useLocale/useLocale.js";import w from"../../__internal__/utils/logger/index.js";import{COMPONENT_PREFIX as O,MARKDOWN_NODES as P}from"./__internal__/__utils__/constants.js";import L from"./__internal__/__plugins__/AutoLinker/auto-link.component.js";import C from"./__internal__/__plugins__/LinkMonitor/link-monitor.plugin.js";import E from"./__internal__/__plugins__/StyledSpanEnter/styled-span-enter.plugin.js";import"./__internal__/__plugins__/useCursorAtEnd/index.js";import T from"./text-editor.context.js";import{StyledTextEditorWrapper as k,StyledWrapper as S,StyledEditorToolbarWrapper as M,StyledHeaderWrapper as $,StyledTextEditor as B,StyledFooterWrapper as F}from"./text-editor.style.js";import{createEmpty as H,SerializeLexical as z,validateUrl as A}from"./__internal__/__utils__/helpers.js";import{HintText as q}from"../../__internal__/hint-text/hint-text.component.js";import D from"../../__internal__/validation-message/validation-message.component.js";import I from"../textbox/textbox.style.js";import"../../style/utils/filter-styled-system-padding-props.js";import R from"../../style/utils/filter-styled-system-margin-props.js";import V from"../../__internal__/utils/helpers/tags/tags.js";import U from"./__internal__/__ui__/ReadOnlyEditor/read-only-rte.component.js";import{getTheme as G}from"./__internal__/__utils__/theme.js";import J from"./__internal__/__ui__/CharacterCounter/character-counter.component.js";import K from"./__internal__/__ui__/ContentEditor/content-editor.component.js";import"./__internal__/__ui__/LinkPreviewer/link-previewer.style.js";import"@lexical/react/LexicalComposerContext";import"@lexical/react/LexicalTypeaheadMenuPlugin";import"react-dom";import"./__internal__/__ui__/Mentions/constants.js";import"./__internal__/__ui__/Mentions/mentions.style.js";import"../tooltip/tooltip.component.js";import"../portrait/portrait.style.js";import N from"./__internal__/__ui__/Placeholder/placeholder.component.js";import Q from"./__internal__/__ui__/Toolbar/toolbar.component.js";function W(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function X(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){W(e,r,t[r])}))}return e}let Y=!1,Z=!1,ee=!1;const re=m(((m,W)=>{var re,te,ne,{characterLimit:oe=3e3,error:ie,footer:ae,header:le,inputHint:se,labelText:ce,namespace:de=O,id:pe,onBlur:ue,onCancel:_e,onChange:me,onFocus:fe,onLinkAdded:ge,onSave:he,placeholder:ve,previews:be=[],readOnly:xe=!1,required:ye=!1,rows:je,size:we="medium",warning:Oe,customPlugins:Pe,validationMessagePositionTop:Le=!1,toolbarControls:Ce}=m,Ee=function(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(m,["characterLimit","error","footer","header","inputHint","labelText","namespace","id","onBlur","onCancel","onChange","onFocus","onLinkAdded","onSave","placeholder","previews","readOnly","required","rows","size","warning","customPlugins","validationMessagePositionTop","toolbarControls"]);!Y&&Ee.value&&(Y=!0,w.deprecate("`value` is deprecated in TextEditor and support will soon be removed. Please use `initialValue` instead.")),!Z&&_e&&(Z=!0,w.deprecate("`onCancel` is deprecated in TextEditor and support will soon be removed. Please ensure that `TextEditor` is used as a part of a `Form` component, which will handle the cancel functionality.")),!ee&&he&&(ee=!0,w.deprecate("`onSave` is deprecated in TextEditor and support will soon be removed. Please ensure that `TextEditor` is used as a part of a `Form` component, which will handle the save functionality."));const Te=f(null!==(ne=null!==(te=Ee.initialValue)&&void 0!==te?te:Ee.value)&&void 0!==ne?ne:H()),ke=j(),[Se,Me]=g(void 0),$e=f(null),[Be,Fe]=g(!1);h(W,(()=>({focus(){var e;null===(e=$e.current)||void 0===e||e.focus()}})),[]),v((()=>{const e=null==$e?void 0:$e.current,r=()=>{Fe(!0)},t=()=>{Fe(!1)};return null==e||e.addEventListener("focus",r),null==e||e.addEventListener("blur",t),()=>{null==e||e.removeEventListener("focus",r),null==e||e.removeEventListener("blur",t)}}),[$e]);const He=b((()=>({namespace:de,nodes:P,onError:e=>w.error(e.message),theme:G(),editorState:Te.current,editable:!xe})),[de,xe]),ze=x(((e,r)=>{const t=e.read((()=>u().getChildren().map((e=>e.getTextContent())).join("\n\n")));if(me){const e=z(r);null==me||me(t,e)}if(oe>0){const e=oe-t.length;Me(e<0?ke.textEditor.characterLimit(Math.abs(e)):void 0)}}),[oe,ke.textEditor,me]),Ae=x((e=>{if(!e.isEditable())return;if(!_e)return;const r=e.parseEditorState(Te.current);e.setEditorState(r),_e()}),[_e]),qe=b((()=>({namespace:de,onCancel:_e?Ae:void 0,onSave:he,toolbarControls:Ce})),[Ae,de,_e,he,Ce]),De=Oe||Se,Ie=()=>{switch(we){case"large":return"var(--spacing150)";case"small":return"var(--spacing050)";default:return"var(--spacing100)"}};return e(k,(Re=X({"data-role":`${de}-editor-wrapper`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||null==ue||ue(e)},onFocus:e=>{e.currentTarget.contains(e.relatedTarget)||null==fe||fe(e)}},R(Ee),V("text-editor",Ee)),Ve={children:r(T.Provider,{value:{onLinkAdded:ge},children:[e(y,{onClick:()=>{var e;return null===(e=$e.current)||void 0===e?void 0:e.focus()},isRequired:ye,labelId:`${de}-label`,children:ce}),se&&!xe&&e(q,{id:`${de}-input-hint`,marginBottom:Ie(),children:se}),e(n,{initialConfig:He,children:r(S,{"data-role":`${de}-wrapper`,children:[Le&&r(t,{children:[e(D,{error:ie,warning:De,validationId:`${de}-validation-message`,"data-role":`${de}-validation-message`,validationMessagePositionTop:Le}),(ie||De)&&e(I,{warning:!(ie||!De)})]}),r(M,{"data-role":`${de}-editor-toolbar-wrapper`,error:!!ie,id:`${de}-editor-toolbar-wrapper`,children:[le&&e($,{"data-role":`${de}-header-wrapper`,children:le}),xe?e(U,{"aria-label":ce,initialValue:(null===(re=$e.current)||void 0===re?void 0:re.innerHTML)||Te.current,size:we}):r(t,{children:[e(Q,X({contentEditorRef:$e,hasHeader:Boolean(le),size:we},qe)),r(B,{"data-role":`${de}-editor`,error:!!ie,children:[e(s,{contentEditable:e(K,{id:pe,ref:$e,inputHint:se,isFocused:Be,namespace:de,previews:be,rows:je,readOnly:xe,required:ye,error:!!ie,warning:!!Oe||!!Se,validationMessagePositionTop:Le,size:we}),placeholder:e(N,{namespace:de,text:ve}),ErrorBoundary:i}),e(d,{}),e(a,{}),e(l,{}),e(p,{onChange:ze,ignoreHistoryMergeTagChange:!0,ignoreSelectionChange:!0}),e(c,{validateUrl:A}),e(o,{newTab:!0}),e(L,{}),e(E,{}),_.Children.toArray(Pe)]})]}),ae&&e(F,{"data-role":`${de}-footer-wrapper`,size:we,children:ae}),e(C,{})]}),!Le&&r(t,{children:[e(D,{error:ie,warning:De,validationId:`${de}-validation-message`,"data-role":`${de}-validation-message`,validationMessagePositionTop:Le}),(ie||De)&&e(I,{warning:!(ie||!De)})]}),oe>0&&!xe&&e(J,{isFocused:Be,maxChars:oe,namespace:de,marginTop:Ie()})]})})]})},Ve=null!=Ve?Ve:{},Object.getOwnPropertyDescriptors?Object.defineProperties(Re,Object.getOwnPropertyDescriptors(Ve)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(Ve)).forEach((function(e){Object.defineProperty(Re,e,Object.getOwnPropertyDescriptor(Ve,e))})),Re));var Re,Ve}));export{re as TextEditor,re as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const StyledLabel: import("styled-components").StyledComponent<import("react").MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, isLarge, }: import("../../__internal__/label").LabelProps) => import("react").JSX.Element>, any, {}, never>;
|
|
1
|
+
declare const StyledLabel: import("styled-components").StyledComponent<import("react").MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, onClick, "aria-label": ariaLabel, isLarge, }: import("../../__internal__/label").LabelProps) => import("react").JSX.Element>, any, {}, never>;
|
|
2
2
|
export default StyledLabel;
|
|
@@ -29,7 +29,9 @@ export interface LabelProps extends ValidationProps, StyledLabelProps, StyledLab
|
|
|
29
29
|
"aria-label"?: string;
|
|
30
30
|
/** Whether this component is shown against a dark background */
|
|
31
31
|
isDarkBackground?: boolean;
|
|
32
|
+
/** @internal @private */
|
|
33
|
+
onClick?: () => void;
|
|
32
34
|
}
|
|
33
|
-
export declare const Label: ({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, isLarge, }: LabelProps) => React.JSX.Element;
|
|
34
|
-
declare const _default: React.MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, isLarge, }: LabelProps) => React.JSX.Element>;
|
|
35
|
+
export declare const Label: ({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, onClick, "aria-label": ariaLabel, isLarge, }: LabelProps) => React.JSX.Element;
|
|
36
|
+
declare const _default: React.MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, onClick, "aria-label": ariaLabel, isLarge, }: LabelProps) => React.JSX.Element>;
|
|
35
37
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../components/help/help.component.js"),n=require("./label.style.js"),o=require("../validations/validation-icon.component.js"),i=require("./icon-wrapper.style.js"),l=require("../input-behaviour/input-behaviour.component.js"),a=require("../input-behaviour/input-group-behaviour.component.js"),u=require("../utils/helpers/guid/index.js");function s(e){return e&&e.__esModule?e:{default:e}}function c(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){c(e,r,t[r])}))}return e}function d(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 b=({align:s,as:c="label",children:b,disabled:f,error:j,help:g,helpIcon:h,htmlFor:y,info:O,inline:m,isDarkBackground:v=!1,isRequired:w,labelId:x,pr:P,pl:q,tooltipId:I,useValidationIcon:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../components/help/help.component.js"),n=require("./label.style.js"),o=require("../validations/validation-icon.component.js"),i=require("./icon-wrapper.style.js"),l=require("../input-behaviour/input-behaviour.component.js"),a=require("../input-behaviour/input-group-behaviour.component.js"),u=require("../utils/helpers/guid/index.js");function s(e){return e&&e.__esModule?e:{default:e}}function c(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){c(e,r,t[r])}))}return e}function d(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 b=({align:s,as:c="label",children:b,disabled:f,error:j,help:g,helpIcon:h,htmlFor:y,info:O,inline:m,isDarkBackground:v=!1,isRequired:w,labelId:x,pr:P,pl:q,tooltipId:I,useValidationIcon:k=!0,validationIconId:M,warning:C,width:L=30,className:D,onClick:S,"aria-label":E,isLarge:F})=>{const[_,B]=r.useState(!1),{onMouseEnter:R,onMouseLeave:N}=r.useContext(l.InputContext),{onMouseEnter:V,onMouseLeave:G}=r.useContext(a.InputGroupContext),H=r.useRef(u.default());let $;return $=m&&!s?"right":s||"left",e.jsxs(n.StyledLabelContainer,{"data-role":"label-container",id:`label-container-${null!=x?x:H.current}`,align:$,inline:m,width:L,pr:P,pl:q,className:D,onClick:S,children:[e.jsx(n.default,d(p({"data-element":"label",disabled:f,id:x},"label"===c?{htmlFor:y}:{}),{onMouseEnter:()=>{R&&R(),V&&V()},onMouseLeave:()=>{N&&N(),G&&G()},isRequired:w,as:c,"aria-label":E,isDarkBackground:v,isLarge:F,children:b})),(()=>{const r={onFocus:()=>B(!0),onBlur:()=>B(!1)};if(k&&(({error:e,warning:r,info:t,disabled:n})=>!n&&"string"==typeof(e||r||t))({error:j,warning:C,info:O,disabled:f})){const r=(({error:e,warning:r,info:t,inline:n})=>(e||r||t)&&n?"top":"right")({error:j,warning:C,info:O,inline:m});return e.jsx(i.default,{children:e.jsx(o.ValidationIcon,{tooltipId:M,error:j,warning:C,info:O,tooltipPosition:r,tooltipFlipOverrides:["top","bottom"]})})}return g&&e.jsx(i.default,d(p({},r),{children:e.jsx(t.Help,{tooltipId:I,type:h,isFocused:_,children:g})}))})()]})};var f=s(r).default.memo(b);exports.Label=b,exports.default=f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@lexical/react/LexicalComposer"),t=require("@lexical/react/LexicalClickableLinkPlugin"),n=require("@lexical/react/LexicalErrorBoundary"),i=require("@lexical/react/LexicalHistoryPlugin"),a=require("@lexical/react/LexicalMarkdownShortcutPlugin"),l=require("@lexical/react/LexicalRichTextPlugin"),o=require("@lexical/react/LexicalLinkPlugin"),s=require("@lexical/react/LexicalListPlugin"),u=require("@lexical/react/LexicalOnChangePlugin"),d=require("lexical"),c=require("react"),_=require("../../__internal__/label/label.component.js"),p=require("../../hooks/__internal__/useLocale/useLocale.js"),x=require("../../__internal__/utils/logger/index.js"),g=require("./__internal__/__utils__/constants.js"),j=require("./__internal__/__plugins__/AutoLinker/auto-link.component.js"),f=require("./__internal__/__plugins__/LinkMonitor/link-monitor.plugin.js"),m=require("./__internal__/__plugins__/StyledSpanEnter/styled-span-enter.plugin.js");require("./__internal__/__plugins__/useCursorAtEnd/index.js");var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@lexical/react/LexicalComposer"),t=require("@lexical/react/LexicalClickableLinkPlugin"),n=require("@lexical/react/LexicalErrorBoundary"),i=require("@lexical/react/LexicalHistoryPlugin"),a=require("@lexical/react/LexicalMarkdownShortcutPlugin"),l=require("@lexical/react/LexicalRichTextPlugin"),o=require("@lexical/react/LexicalLinkPlugin"),s=require("@lexical/react/LexicalListPlugin"),u=require("@lexical/react/LexicalOnChangePlugin"),d=require("lexical"),c=require("react"),_=require("../../__internal__/label/label.component.js"),p=require("../../hooks/__internal__/useLocale/useLocale.js"),x=require("../../__internal__/utils/logger/index.js"),g=require("./__internal__/__utils__/constants.js"),j=require("./__internal__/__plugins__/AutoLinker/auto-link.component.js"),f=require("./__internal__/__plugins__/LinkMonitor/link-monitor.plugin.js"),m=require("./__internal__/__plugins__/StyledSpanEnter/styled-span-enter.plugin.js");require("./__internal__/__plugins__/useCursorAtEnd/index.js");var v=require("./text-editor.context.js"),h=require("./text-editor.style.js"),b=require("./__internal__/__utils__/helpers.js"),y=require("../../__internal__/hint-text/hint-text.component.js"),q=require("../../__internal__/validation-message/validation-message.component.js"),w=require("../textbox/textbox.style.js");require("../../style/utils/filter-styled-system-padding-props.js");var P=require("../../style/utils/filter-styled-system-margin-props.js"),O=require("../../__internal__/utils/helpers/tags/tags.js"),E=require("./__internal__/__ui__/ReadOnlyEditor/read-only-rte.component.js"),L=require("./__internal__/__utils__/theme.js"),C=require("./__internal__/__ui__/CharacterCounter/character-counter.component.js"),T=require("./__internal__/__ui__/ContentEditor/content-editor.component.js");require("./__internal__/__ui__/LinkPreviewer/link-previewer.style.js"),require("@lexical/react/LexicalComposerContext"),require("@lexical/react/LexicalTypeaheadMenuPlugin"),require("react-dom"),require("./__internal__/__ui__/Mentions/constants.js"),require("./__internal__/__ui__/Mentions/mentions.style.js"),require("../tooltip/tooltip.component.js"),require("../portrait/portrait.style.js");var S=require("./__internal__/__ui__/Placeholder/placeholder.component.js"),k=require("./__internal__/__ui__/Toolbar/toolbar.component.js");function M(e){return e&&e.__esModule?e:{default:e}}var $=M(c);function F(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function H(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},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){F(e,r,t[r])}))}return e}let R=!1,B=!1,z=!1;const A=c.forwardRef(((M,F)=>{var A,D,I,{characterLimit:W=3e3,error:N,footer:V,header:U,inputHint:K,labelText:X,namespace:G=g.COMPONENT_PREFIX,id:J,onBlur:Q,onCancel:Y,onChange:Z,onFocus:ee,onLinkAdded:re,onSave:te,placeholder:ne,previews:ie=[],readOnly:ae=!1,required:le=!1,rows:oe,size:se="medium",warning:ue,customPlugins:de,validationMessagePositionTop:ce=!1,toolbarControls:_e}=M,pe=function(e,r){if(null==e)return{};var t,n,i=function(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(i[t]=e[t]);return i}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}(M,["characterLimit","error","footer","header","inputHint","labelText","namespace","id","onBlur","onCancel","onChange","onFocus","onLinkAdded","onSave","placeholder","previews","readOnly","required","rows","size","warning","customPlugins","validationMessagePositionTop","toolbarControls"]);!R&&pe.value&&(R=!0,x.default.deprecate("`value` is deprecated in TextEditor and support will soon be removed. Please use `initialValue` instead.")),!B&&Y&&(B=!0,x.default.deprecate("`onCancel` is deprecated in TextEditor and support will soon be removed. Please ensure that `TextEditor` is used as a part of a `Form` component, which will handle the cancel functionality.")),!z&&te&&(z=!0,x.default.deprecate("`onSave` is deprecated in TextEditor and support will soon be removed. Please ensure that `TextEditor` is used as a part of a `Form` component, which will handle the save functionality."));const xe=c.useRef(null!==(I=null!==(D=pe.initialValue)&&void 0!==D?D:pe.value)&&void 0!==I?I:b.createEmpty()),ge=p.default(),[je,fe]=c.useState(void 0),me=c.useRef(null),[ve,he]=c.useState(!1);c.useImperativeHandle(F,(()=>({focus(){var e;null===(e=me.current)||void 0===e||e.focus()}})),[]),c.useEffect((()=>{const e=null==me?void 0:me.current,r=()=>{he(!0)},t=()=>{he(!1)};return null==e||e.addEventListener("focus",r),null==e||e.addEventListener("blur",t),()=>{null==e||e.removeEventListener("focus",r),null==e||e.removeEventListener("blur",t)}}),[me]);const be=c.useMemo((()=>({namespace:G,nodes:g.MARKDOWN_NODES,onError:e=>x.default.error(e.message),theme:L.getTheme(),editorState:xe.current,editable:!ae})),[G,ae]),ye=c.useCallback(((e,r)=>{const t=e.read((()=>d.$getRoot().getChildren().map((e=>e.getTextContent())).join("\n\n")));if(Z){const e=b.SerializeLexical(r);null==Z||Z(t,e)}if(W>0){const e=W-t.length;fe(e<0?ge.textEditor.characterLimit(Math.abs(e)):void 0)}}),[W,ge.textEditor,Z]),qe=c.useCallback((e=>{if(!e.isEditable())return;if(!Y)return;const r=e.parseEditorState(xe.current);e.setEditorState(r),Y()}),[Y]),we=c.useMemo((()=>({namespace:G,onCancel:Y?qe:void 0,onSave:te,toolbarControls:_e})),[qe,G,Y,te,_e]),Pe=ue||je,Oe=()=>{switch(se){case"large":return"var(--spacing150)";case"small":return"var(--spacing050)";default:return"var(--spacing100)"}};return e.jsx(h.StyledTextEditorWrapper,(Ee=H({"data-role":`${G}-editor-wrapper`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||null==Q||Q(e)},onFocus:e=>{e.currentTarget.contains(e.relatedTarget)||null==ee||ee(e)}},P.default(pe),O.default("text-editor",pe)),Le={children:e.jsxs(v.default.Provider,{value:{onLinkAdded:re},children:[e.jsx(_.default,{onClick:()=>{var e;return null===(e=me.current)||void 0===e?void 0:e.focus()},isRequired:le,labelId:`${G}-label`,children:X}),K&&!ae&&e.jsx(y.HintText,{id:`${G}-input-hint`,marginBottom:Oe(),children:K}),e.jsx(r.LexicalComposer,{initialConfig:be,children:e.jsxs(h.StyledWrapper,{"data-role":`${G}-wrapper`,children:[ce&&e.jsxs(e.Fragment,{children:[e.jsx(q.default,{error:N,warning:Pe,validationId:`${G}-validation-message`,"data-role":`${G}-validation-message`,validationMessagePositionTop:ce}),(N||Pe)&&e.jsx(w.default,{warning:!(N||!Pe)})]}),e.jsxs(h.StyledEditorToolbarWrapper,{"data-role":`${G}-editor-toolbar-wrapper`,error:!!N,id:`${G}-editor-toolbar-wrapper`,children:[U&&e.jsx(h.StyledHeaderWrapper,{"data-role":`${G}-header-wrapper`,children:U}),ae?e.jsx(E.default,{"aria-label":X,initialValue:(null===(A=me.current)||void 0===A?void 0:A.innerHTML)||xe.current,size:se}):e.jsxs(e.Fragment,{children:[e.jsx(k.default,H({contentEditorRef:me,hasHeader:Boolean(U),size:se},we)),e.jsxs(h.StyledTextEditor,{"data-role":`${G}-editor`,error:!!N,children:[e.jsx(l.RichTextPlugin,{contentEditable:e.jsx(T.default,{id:J,ref:me,inputHint:K,isFocused:ve,namespace:G,previews:ie,rows:oe,readOnly:ae,required:le,error:!!N,warning:!!ue||!!je,validationMessagePositionTop:ce,size:se}),placeholder:e.jsx(S.default,{namespace:G,text:ne}),ErrorBoundary:n.LexicalErrorBoundary}),e.jsx(s.ListPlugin,{}),e.jsx(i.HistoryPlugin,{}),e.jsx(a.MarkdownShortcutPlugin,{}),e.jsx(u.OnChangePlugin,{onChange:ye,ignoreHistoryMergeTagChange:!0,ignoreSelectionChange:!0}),e.jsx(o.LinkPlugin,{validateUrl:b.validateUrl}),e.jsx(t.ClickableLinkPlugin,{newTab:!0}),e.jsx(j.default,{}),e.jsx(m.default,{}),$.default.Children.toArray(de)]})]}),V&&e.jsx(h.StyledFooterWrapper,{"data-role":`${G}-footer-wrapper`,size:se,children:V}),e.jsx(f.default,{})]}),!ce&&e.jsxs(e.Fragment,{children:[e.jsx(q.default,{error:N,warning:Pe,validationId:`${G}-validation-message`,"data-role":`${G}-validation-message`,validationMessagePositionTop:ce}),(N||Pe)&&e.jsx(w.default,{warning:!(N||!Pe)})]}),W>0&&!ae&&e.jsx(C.default,{isFocused:ve,maxChars:W,namespace:G,marginTop:Oe()})]})})]})},Le=null!=Le?Le:{},Object.getOwnPropertyDescriptors?Object.defineProperties(Ee,Object.getOwnPropertyDescriptors(Le)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(Le)).forEach((function(e){Object.defineProperty(Ee,e,Object.getOwnPropertyDescriptor(Le,e))})),Ee));var Ee,Le}));exports.TextEditor=A,exports.default=A;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const StyledLabel: import("styled-components").StyledComponent<import("react").MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, isLarge, }: import("../../__internal__/label").LabelProps) => import("react").JSX.Element>, any, {}, never>;
|
|
1
|
+
declare const StyledLabel: import("styled-components").StyledComponent<import("react").MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, onClick, "aria-label": ariaLabel, isLarge, }: import("../../__internal__/label").LabelProps) => import("react").JSX.Element>, any, {}, never>;
|
|
2
2
|
export default StyledLabel;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "158.27.
|
|
3
|
+
"version": "158.27.3",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
7
7
|
"esm"
|
|
8
8
|
],
|
|
9
9
|
"engines": {
|
|
10
|
-
"npm": ">=11.
|
|
10
|
+
"npm": ">=11.9.0"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
13
|
"setup": "npm ci && npm run prepare",
|