carbon-react 158.24.1 → 158.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/components/loader/__next__/loader.style.js +1 -1
- package/esm/components/search/search.component.d.ts +2 -0
- package/esm/components/search/search.component.js +1 -1
- package/lib/components/loader/__next__/loader.style.js +1 -1
- package/lib/components/search/search.component.d.ts +2 -0
- package/lib/components/search/search.component.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{css as t}from"styled-components";import{margin as
|
|
1
|
+
import e,{keyframes as a,css as t}from"styled-components";import{margin as r}from"styled-system";import i from"../../../style/themes/apply-base-theme.js";import{Typography as o}from"../../typography/typography.component.js";import"react/jsx-runtime";import"react";import n from"../../button/button.style.js";import{StyledButton as s}from"../../button/__next__/button.style.js";const l={"extra-small":20,small:32,medium:64,large:80},d={"extra-small":2.7,small:2.7,medium:2.7,large:2.7},m={small:"4px",medium:"8px",large:"16px"},p={"extra-small":"8px",small:"8px",medium:"12px",large:"16px"},c=a(["0%{left:0%;animation-timing-function:linear;}30%{left:10px;animation-timing-function:cubic-bezier(0.5,0.6,0.4,1);}100%{left:calc(100% - 15px);}"]),g=a(["0%{width:15px;animation-timing-function:cubic-bezier(0.7,0,0.8,1);}50%{width:35%;}100%{width:15px;}"]),f=a(["from{stroke-dasharray:100;stroke-dashoffset:100;}to{stroke-dasharray:100;stroke-dashoffset:20;}"]),x=a(["0%{transform:rotate(-90deg);stroke-dashoffset:95;}50%{transform:rotate(90deg);stroke-dashoffset:80;}100%{transform:rotate(270deg);stroke-dashoffset:95;}"]),h=(e,a)=>{const t=a?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.08)";return"ai"===e?{outerBarBackground:t,innerBarBackground:a?"linear-gradient(90deg, var(--mode-color-ai-alt-stop-1, #00D639) 0%, var(--mode-color-ai-alt-stop-2, #00D6DE) 40%, var(--mode-color-ai-alt-stop-3, #9D60FF) 90%)":"linear-gradient(90deg, var(--mode-color-ai-stop-1, #13A038) 0%, var(--mode-color-ai-stop-2, #149197) 40%, var(--mode-color-ai-stop-3, #A87CFB) 90%)"}:{outerBarBackground:t,innerBarBackground:a?"#FFFFFF":"#000000"}},u=t(["display:flex;justify-content:center;text-align:center;"]),y=e.div.withConfig({displayName:"loader.style__StyledLoaderPlaceholder",componentId:"sc-478aa3aa-0"})(["display:inline-block;min-width:var(--sizing800);"]),v=e.div.attrs(i).withConfig({displayName:"loader.style__StyledLoader",componentId:"sc-478aa3aa-1"})([""," text-align:center;white-space:nowrap;"],r),w=e.div.withConfig({displayName:"loader.style__OuterBar",componentId:"sc-478aa3aa-2"})(["",""],(({size:e,variant:a,inverse:r})=>t(["border-radius:var(--borderRadius400);height:",";width:100%;background:",";overflow:hidden;position:relative;"],m[e],h(a,r).outerBarBackground))),b=e.div.withConfig({displayName:"loader.style__InnerBar",componentId:"sc-478aa3aa-3"})(["",""],(({size:e,variant:a,inverse:r,animationTime:i,hasMotion:o})=>t(["position:absolute;background:",";width:15px;height:",";border-radius:var(--borderRadius400);animation-name:",",",";"," animation-iteration-count:",";"],h(a,r).innerBarBackground,m[e],c,g,o&&`animation-duration: ${i}s, ${i}s;`,o?"infinite, infinite":"none, none"))),k=e.svg.withConfig({displayName:"loader.style__StyledRingCircleSvg",componentId:"sc-478aa3aa-4"})([""," ",' & circle[data-role="inner-arc"],',' & circle[data-role="inner-arc"]{stroke:currentColor;}'],(({inverse:e,size:a,hasMotion:r,isTracked:i,isError:o,isSuccess:n,animationTime:s})=>{const m=`${l[a]}px`,p=d[a];return t(["height:",";min-height:",';circle[data-role="outer-arc"]{fill:transparent;stroke-width:',"px;stroke:",';cx:12px;cy:12px;r:10px;}circle[data-role="inner-arc"]{fill:transparent;stroke-width:',"px;stroke:",";stroke-linecap:round;stroke-dasharray:100px;stroke-dashoffset:95px;transform-origin:12px 12px 0px;cx:12px;cy:12px;r:10px;transform:rotate(-90deg);animation-name:",";"," animation-timing-function:cubic-bezier(0,0,1,1);animation-iteration-count:",";}"],m,m,p,e?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",p,(({inverse:e,isSuccess:a,isError:t})=>t?"#DB004E;":a?"#00811F;":e?"#FFF;":"#000000")({inverse:e,isSuccess:n,isError:o}),i?f:x,r&&`animation-duration: ${s}s;`,r?"infinite":"none")}),s,n),_="40px",B=e.div.withConfig({displayName:"loader.style__StyledStars",componentId:"sc-478aa3aa-5"})(["position:relative;width:",";height:",";"],_,_),C={standalone:{small:"4px",medium:"8px",large:"12px"},ring:{"extra-small":"4px",small:"8px",medium:"8px",large:"12px"}},S=e.div.withConfig({displayName:"loader.style__StyledStarLoaderWrapper",componentId:"sc-478aa3aa-6"})(["position:relative;display:flex;align-items:center;justify-content:center;"]),F=e(o).withConfig({displayName:"loader.style__StyledLoaderLabel",componentId:"sc-478aa3aa-7"})([""," line-height:150%;color:",";"," &,"," &{color:currentColor;}",""],u,(({inverse:e})=>e?"rgba(255, 255, 255, 0.55)":"rgba(0, 0, 0, 0.65)"),s,n,(({size:e="medium",loaderType:a,loaderVariant:r})=>"star"===a?t(["font-size:16px;font-weight:400;margin-left:12px;width:min-content;"]):"standalone"===a?t(["font-size:",";font-weight:500;width:100%;margin-top:",";"],"large"===e?"16px":"14px",C[a][e]):t(["font-size:",";font-weight:500;width:",";",";"],"large"===e?"16px":"extra-small"===e?"13px":"14px","inline"===r?"auto":"100%","inline"===r?`margin-left: ${p[e]}`:`margin-top: ${C[a][e]}`))),z=e.div.withConfig({displayName:"loader.style__StyledRingLoaderWrapper",componentId:"sc-478aa3aa-8"})(["",""],(({loaderVariant:e})=>t(["display:flex;flex-direction:",";align-items:center;justify-content:center;width:",";"],"inline"===e?"row":"column","inline"===e?"auto":"100%"))),I=e.span.withConfig({displayName:"loader.style__StyledLabel",componentId:"sc-478aa3aa-9"})(["",";"],(({inverse:e})=>t(["color:",";"," &,"," &{color:currentColor;}"],e?"rgba(255, 255, 255, 0.90)":"rgba(0, 0, 0, 0.90)",s,n)));export{b as InnerBar,w as OuterBar,I as StyledLabel,v as StyledLoader,F as StyledLoaderLabel,y as StyledLoaderPlaceholder,k as StyledRingCircleSvg,z as StyledRingLoaderWrapper,S as StyledStarLoaderWrapper,B as StyledStars};
|
|
@@ -42,6 +42,8 @@ export interface SearchProps extends ValidationProps, MarginProps, TagProps, Pic
|
|
|
42
42
|
* Pass a string to override the text in the search Button
|
|
43
43
|
* */
|
|
44
44
|
searchButton?: boolean | string;
|
|
45
|
+
/** Data tag prop bag for searchButton */
|
|
46
|
+
searchButtonDataProps?: TagProps;
|
|
45
47
|
/**
|
|
46
48
|
* Prop for specifying an input width length.
|
|
47
49
|
* Leaving the `searchWidth` prop with no value will default the width to '100%'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import r,{useRef as n,useImperativeHandle as o,useState as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import r,{useRef as n,useImperativeHandle as o,useState as a}from"react";import i from"invariant";import l from"../../__internal__/utils/helpers/tags/tags.js";import"../../style/utils/filter-styled-system-padding-props.js";import s from"../../style/utils/filter-styled-system-margin-props.js";import c from"./search.style.js";import u from"./search-button.style.js";import p from"../icon/icon.component.js";import{Textbox as m}from"../textbox/textbox.component.js";import f from"../button/button.component.js";import b from"../../hooks/__internal__/useLocale/useLocale.js";import h from"../../__internal__/utils/helpers/events/events.js";function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(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){d(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=r.forwardRef(((r,d)=>{var{onChange:O,onClick:v,onFocus:j,onBlur:P,onKeyDown:w,value:x,id:B,name:_,label:D,inputHint:C,searchWidth:k,maxWidth:S,searchButton:I,searchButtonDataProps:T,searchButtonAriaLabel:W,placeholder:E,variant:F="default","aria-label":H,tabIndex:K,error:L,warning:A,info:$,tooltipPosition:z,triggerOnClear:M}=r,N=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,["onChange","onClick","onFocus","onBlur","onKeyDown","value","id","name","label","inputHint","searchWidth","maxWidth","searchButton","searchButtonDataProps","searchButtonAriaLabel","placeholder","variant","aria-label","tabIndex","error","warning","info","tooltipPosition","triggerOnClear"]);const R=b(),V=n(null),q=n(null);o(d,(()=>({focus(){var e;null===(e=q.current)||void 0===e||e.focus()}})),[]),i("string"==typeof x,"This component has no initial value");const[G,J]=a(!1),Q=0===x.length;let U={};I&&v&&(U={onClick:()=>{v({target:{name:_,id:B,value:x}})}});const X="string"==typeof I?I:R.search.searchButtonText(),Y=!!(null==x?void 0:x.length);return e(c,g(y(g(y({ref:V,isFocused:G,searchWidth:k,maxWidth:S,searchHasValue:Y,showSearchButton:!!I,variant:F},s(N)),{id:B,name:_}),N,l("search",N)),{children:[t(m,{placeholder:E,value:x,inputIcon:Q?void 0:"cross",iconTabIndex:Q?-1:0,iconOnClick:()=>{var e;null==O||O({target:g(y({},_&&{name:_},B&&{id:B}),{value:""})}),M&&(null==v||v({target:g(y({},_&&{name:_},B&&{id:B}),{value:""})})),null===(e=q.current)||void 0===e||e.focus()},iconOnMouseDown:e=>{e.preventDefault()},"aria-label":H||(D?void 0:R.search.searchButtonText()),label:D,inputHint:C,onFocus:e=>{J(!0),j&&j(e)},onBlur:e=>{J(!1),P&&P(e)},onChange:e=>{O(e)},onKeyDown:e=>{1===e.key.length&&e.stopPropagation(),h.isEscKey(e)&&!Q&&(e.stopPropagation(),null==O||O({target:g(y({},_&&{name:_},B&&{id:B}),{value:""})})),w&&w(e)},ref:q,tabIndex:K,error:L,warning:A,info:$,leftChildren:I?void 0:t(p,{type:"search",ml:1}),tooltipPosition:z,my:0}),I&&t(u,{children:t(f,g(y({"aria-label":W||X,size:"medium",px:2,buttonType:"primary",iconPosition:"before",iconType:"search",className:"search-button"},l(`${X}-button`,y({"data-element":`${X}-button`},T)),U),{children:X}))})]}))}));export{O as Search,O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("styled-components"),
|
|
1
|
+
"use strict";var e=require("styled-components"),a=require("styled-system"),t=require("../../../style/themes/apply-base-theme.js"),r=require("../../typography/typography.component.js");require("react/jsx-runtime"),require("react");var i=require("../../button/button.style.js"),o=require("../../button/__next__/button.style.js");function n(e){return e&&e.__esModule?e:{default:e}}var s=n(e);const l={"extra-small":20,small:32,medium:64,large:80},d={"extra-small":2.7,small:2.7,medium:2.7,large:2.7},c={small:"4px",medium:"8px",large:"16px"},p={"extra-small":"8px",small:"8px",medium:"12px",large:"16px"},m=e.keyframes(["0%{left:0%;animation-timing-function:linear;}30%{left:10px;animation-timing-function:cubic-bezier(0.5,0.6,0.4,1);}100%{left:calc(100% - 15px);}"]),u=e.keyframes(["0%{width:15px;animation-timing-function:cubic-bezier(0.7,0,0.8,1);}50%{width:35%;}100%{width:15px;}"]),g=e.keyframes(["from{stroke-dasharray:100;stroke-dashoffset:100;}to{stroke-dasharray:100;stroke-dashoffset:20;}"]),f=e.keyframes(["0%{transform:rotate(-90deg);stroke-dashoffset:95;}50%{transform:rotate(90deg);stroke-dashoffset:80;}100%{transform:rotate(270deg);stroke-dashoffset:95;}"]),y=(e,a)=>{const t=a?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.08)";return"ai"===e?{outerBarBackground:t,innerBarBackground:a?"linear-gradient(90deg, var(--mode-color-ai-alt-stop-1, #00D639) 0%, var(--mode-color-ai-alt-stop-2, #00D6DE) 40%, var(--mode-color-ai-alt-stop-3, #9D60FF) 90%)":"linear-gradient(90deg, var(--mode-color-ai-stop-1, #13A038) 0%, var(--mode-color-ai-stop-2, #149197) 40%, var(--mode-color-ai-stop-3, #A87CFB) 90%)"}:{outerBarBackground:t,innerBarBackground:a?"#FFFFFF":"#000000"}},x=e.css(["display:flex;justify-content:center;text-align:center;"]),h=s.default.div.withConfig({displayName:"loader.style__StyledLoaderPlaceholder",componentId:"sc-478aa3aa-0"})(["display:inline-block;min-width:var(--sizing800);"]),v=s.default.div.attrs(t.default).withConfig({displayName:"loader.style__StyledLoader",componentId:"sc-478aa3aa-1"})([""," text-align:center;white-space:nowrap;"],a.margin),b=s.default.div.withConfig({displayName:"loader.style__OuterBar",componentId:"sc-478aa3aa-2"})(["",""],(({size:a,variant:t,inverse:r})=>e.css(["border-radius:var(--borderRadius400);height:",";width:100%;background:",";overflow:hidden;position:relative;"],c[a],y(t,r).outerBarBackground))),w=s.default.div.withConfig({displayName:"loader.style__InnerBar",componentId:"sc-478aa3aa-3"})(["",""],(({size:a,variant:t,inverse:r,animationTime:i,hasMotion:o})=>e.css(["position:absolute;background:",";width:15px;height:",";border-radius:var(--borderRadius400);animation-name:",",",";"," animation-iteration-count:",";"],y(t,r).innerBarBackground,c[a],m,u,o&&`animation-duration: ${i}s, ${i}s;`,o?"infinite, infinite":"none, none"))),k=s.default.svg.withConfig({displayName:"loader.style__StyledRingCircleSvg",componentId:"sc-478aa3aa-4"})([""," ",' & circle[data-role="inner-arc"],',' & circle[data-role="inner-arc"]{stroke:currentColor;}'],(({inverse:a,size:t,hasMotion:r,isTracked:i,isError:o,isSuccess:n,animationTime:s})=>{const c=`${l[t]}px`,p=d[t];return e.css(["height:",";min-height:",';circle[data-role="outer-arc"]{fill:transparent;stroke-width:',"px;stroke:",';cx:12px;cy:12px;r:10px;}circle[data-role="inner-arc"]{fill:transparent;stroke-width:',"px;stroke:",";stroke-linecap:round;stroke-dasharray:100px;stroke-dashoffset:95px;transform-origin:12px 12px 0px;cx:12px;cy:12px;r:10px;transform:rotate(-90deg);animation-name:",";"," animation-timing-function:cubic-bezier(0,0,1,1);animation-iteration-count:",";}"],c,c,p,a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",p,(({inverse:e,isSuccess:a,isError:t})=>t?"#DB004E;":a?"#00811F;":e?"#FFF;":"#000000")({inverse:a,isSuccess:n,isError:o}),i?g:f,r&&`animation-duration: ${s}s;`,r?"infinite":"none")}),o.StyledButton,i.default),S="40px",_=s.default.div.withConfig({displayName:"loader.style__StyledStars",componentId:"sc-478aa3aa-5"})(["position:relative;width:",";height:",";"],S,S),B={standalone:{small:"4px",medium:"8px",large:"12px"},ring:{"extra-small":"4px",small:"8px",medium:"8px",large:"12px"}},C=s.default.div.withConfig({displayName:"loader.style__StyledStarLoaderWrapper",componentId:"sc-478aa3aa-6"})(["position:relative;display:flex;align-items:center;justify-content:center;"]),L=s.default(r.Typography).withConfig({displayName:"loader.style__StyledLoaderLabel",componentId:"sc-478aa3aa-7"})([""," line-height:150%;color:",";"," &,"," &{color:currentColor;}",""],x,(({inverse:e})=>e?"rgba(255, 255, 255, 0.55)":"rgba(0, 0, 0, 0.65)"),o.StyledButton,i.default,(({size:a="medium",loaderType:t,loaderVariant:r})=>"star"===t?e.css(["font-size:16px;font-weight:400;margin-left:12px;width:min-content;"]):"standalone"===t?e.css(["font-size:",";font-weight:500;width:100%;margin-top:",";"],"large"===a?"16px":"14px",B[t][a]):e.css(["font-size:",";font-weight:500;width:",";",";"],"large"===a?"16px":"extra-small"===a?"13px":"14px","inline"===r?"auto":"100%","inline"===r?`margin-left: ${p[a]}`:`margin-top: ${B[t][a]}`))),F=s.default.div.withConfig({displayName:"loader.style__StyledRingLoaderWrapper",componentId:"sc-478aa3aa-8"})(["",""],(({loaderVariant:a})=>e.css(["display:flex;flex-direction:",";align-items:center;justify-content:center;width:",";"],"inline"===a?"row":"column","inline"===a?"auto":"100%"))),I=s.default.span.withConfig({displayName:"loader.style__StyledLabel",componentId:"sc-478aa3aa-9"})(["",";"],(({inverse:a})=>e.css(["color:",";"," &,"," &{color:currentColor;}"],a?"rgba(255, 255, 255, 0.90)":"rgba(0, 0, 0, 0.90)",o.StyledButton,i.default)));exports.InnerBar=w,exports.OuterBar=b,exports.StyledLabel=I,exports.StyledLoader=v,exports.StyledLoaderLabel=L,exports.StyledLoaderPlaceholder=h,exports.StyledRingCircleSvg=k,exports.StyledRingLoaderWrapper=F,exports.StyledStarLoaderWrapper=C,exports.StyledStars=_;
|
|
@@ -42,6 +42,8 @@ export interface SearchProps extends ValidationProps, MarginProps, TagProps, Pic
|
|
|
42
42
|
* Pass a string to override the text in the search Button
|
|
43
43
|
* */
|
|
44
44
|
searchButton?: boolean | string;
|
|
45
|
+
/** Data tag prop bag for searchButton */
|
|
46
|
+
searchButtonDataProps?: TagProps;
|
|
45
47
|
/**
|
|
46
48
|
* Prop for specifying an input width length.
|
|
47
49
|
* Leaving the `searchWidth` prop with no value will default the width to '100%'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("invariant"),n=require("../../__internal__/utils/helpers/tags/tags.js");require("../../style/utils/filter-styled-system-padding-props.js");var o=require("../../style/utils/filter-styled-system-margin-props.js"),a=require("./search.style.js"),i=require("./search-button.style.js"),l=require("../icon/icon.component.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("invariant"),n=require("../../__internal__/utils/helpers/tags/tags.js");require("../../style/utils/filter-styled-system-padding-props.js");var o=require("../../style/utils/filter-styled-system-margin-props.js"),a=require("./search.style.js"),i=require("./search-button.style.js"),l=require("../icon/icon.component.js"),u=require("../textbox/textbox.component.js"),s=require("../button/button.component.js"),c=require("../../hooks/__internal__/useLocale/useLocale.js"),p=require("../../__internal__/utils/helpers/events/events.js");function f(e){return e&&e.__esModule?e:{default:e}}var d=f(t),b=f(r);function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(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){h(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 v=d.default.forwardRef(((r,f)=>{var{onChange:d,onClick:h,onFocus:v,onBlur:j,onKeyDown:m,value:O,id:x,name:P,label:w,inputHint:_,searchWidth:q,maxWidth:B,searchButton:D,searchButtonDataProps:C,searchButtonAriaLabel:k,placeholder:S,variant:I="default","aria-label":T,tabIndex:W,error:H,warning:E,info:F,tooltipPosition:K,triggerOnClear:L}=r,M=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,["onChange","onClick","onFocus","onBlur","onKeyDown","value","id","name","label","inputHint","searchWidth","maxWidth","searchButton","searchButtonDataProps","searchButtonAriaLabel","placeholder","variant","aria-label","tabIndex","error","warning","info","tooltipPosition","triggerOnClear"]);const R=c.default(),A=t.useRef(null),$=t.useRef(null);t.useImperativeHandle(f,(()=>({focus(){var e;null===(e=$.current)||void 0===e||e.focus()}})),[]),b.default("string"==typeof O,"This component has no initial value");const[z,N]=t.useState(!1),V=0===O.length;let G={};D&&h&&(G={onClick:()=>{h({target:{name:P,id:x,value:O}})}});const J="string"==typeof D?D:R.search.searchButtonText(),Q=!!(null==O?void 0:O.length);return e.jsxs(a.default,g(y(g(y({ref:A,isFocused:z,searchWidth:q,maxWidth:B,searchHasValue:Q,showSearchButton:!!D,variant:I},o.default(M)),{id:x,name:P}),M,n.default("search",M)),{children:[e.jsx(u.Textbox,{placeholder:S,value:O,inputIcon:V?void 0:"cross",iconTabIndex:V?-1:0,iconOnClick:()=>{var e;null==d||d({target:g(y({},P&&{name:P},x&&{id:x}),{value:""})}),L&&(null==h||h({target:g(y({},P&&{name:P},x&&{id:x}),{value:""})})),null===(e=$.current)||void 0===e||e.focus()},iconOnMouseDown:e=>{e.preventDefault()},"aria-label":T||(w?void 0:R.search.searchButtonText()),label:w,inputHint:_,onFocus:e=>{N(!0),v&&v(e)},onBlur:e=>{N(!1),j&&j(e)},onChange:e=>{d(e)},onKeyDown:e=>{1===e.key.length&&e.stopPropagation(),p.default.isEscKey(e)&&!V&&(e.stopPropagation(),null==d||d({target:g(y({},P&&{name:P},x&&{id:x}),{value:""})})),m&&m(e)},ref:$,tabIndex:W,error:H,warning:E,info:F,leftChildren:D?void 0:e.jsx(l.default,{type:"search",ml:1}),tooltipPosition:K,my:0}),D&&e.jsx(i.default,{children:e.jsx(s.default,g(y({"aria-label":k||J,size:"medium",px:2,buttonType:"primary",iconPosition:"before",iconType:"search",className:"search-button"},n.default(`${J}-button`,y({"data-element":`${J}-button`},C)),G),{children:J}))})]}))}));exports.Search=v,exports.default=v;
|