carbon-react 155.13.0 → 156.0.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/__internal__/checkable-input/checkable-input.component.d.ts +0 -5
- package/esm/__internal__/checkable-input/checkable-input.component.js +1 -1
- package/esm/__internal__/fieldset/fieldset.component.d.ts +1 -6
- package/esm/__internal__/fieldset/fieldset.component.js +1 -1
- package/esm/__internal__/fieldset/fieldset.style.d.ts +0 -6
- package/esm/__internal__/fieldset/fieldset.style.js +1 -1
- package/esm/__internal__/form-field/form-field.component.d.ts +1 -6
- package/esm/__internal__/form-field/form-field.component.js +1 -1
- package/esm/__internal__/input/input.component.d.ts +0 -5
- package/esm/__internal__/input/input.component.js +1 -1
- package/esm/__internal__/label/label.component.d.ts +2 -2
- package/esm/__internal__/label/label.component.js +1 -1
- package/esm/__internal__/label/label.style.d.ts +0 -4
- package/esm/__internal__/label/label.style.js +1 -1
- package/esm/components/badge/badge.component.d.ts +15 -8
- package/esm/components/badge/badge.component.js +1 -1
- package/esm/components/badge/badge.style.d.ts +6 -5
- package/esm/components/badge/badge.style.js +1 -1
- package/esm/components/checkbox/checkbox-group/checkbox-group.component.d.ts +1 -6
- package/esm/components/checkbox/checkbox-group/checkbox-group.component.js +1 -1
- package/esm/components/checkbox/checkbox.component.js +1 -1
- package/esm/components/date-range/date-range.component.d.ts +1 -6
- package/esm/components/date-range/date-range.component.js +1 -1
- package/esm/components/dialog/dialog.component.js +1 -1
- package/esm/components/dialog-full-screen/dialog-full-screen.component.js +1 -1
- package/esm/components/fieldset/fieldset.component.d.ts +1 -6
- package/esm/components/fieldset/fieldset.component.js +1 -1
- package/esm/components/fieldset/fieldset.style.d.ts +0 -7
- package/esm/components/fieldset/fieldset.style.js +1 -1
- package/esm/components/file-input/file-input.component.d.ts +0 -5
- package/esm/components/file-input/file-input.component.js +1 -1
- package/esm/components/inline-inputs/inline-inputs.component.d.ts +1 -6
- package/esm/components/inline-inputs/inline-inputs.component.js +1 -1
- package/esm/components/loader/loader.component.d.ts +1 -6
- package/esm/components/loader/loader.component.js +1 -1
- package/esm/components/modal/modal.component.d.ts +1 -3
- package/esm/components/modal/modal.component.js +1 -1
- package/esm/components/numeral-date/numeral-date.component.d.ts +0 -5
- package/esm/components/numeral-date/numeral-date.component.js +1 -1
- package/esm/components/numeral-date/numeral-date.style.d.ts +1 -1
- package/esm/components/radio-button/radio-button-group/radio-button-group.component.d.ts +1 -6
- package/esm/components/radio-button/radio-button-group/radio-button-group.component.js +1 -1
- package/esm/components/radio-button/radio-button.component.d.ts +1 -1
- package/esm/components/select/__internal__/select-textbox/select-textbox.component.d.ts +0 -5
- package/esm/components/select/__internal__/select-textbox/select-textbox.component.js +1 -1
- package/esm/components/select/filterable-select/filterable-select.component.d.ts +0 -5
- package/esm/components/select/filterable-select/filterable-select.component.js +1 -1
- package/esm/components/select/multi-select/multi-select.component.d.ts +0 -5
- package/esm/components/select/multi-select/multi-select.component.js +1 -1
- package/esm/components/select/simple-select/simple-select.component.d.ts +0 -5
- package/esm/components/select/simple-select/simple-select.component.js +1 -1
- package/esm/components/switch/switch.component.js +1 -1
- package/esm/components/tabs/__internal__/tab-title/tab-title.component.js +1 -1
- package/esm/components/text-editor/text-editor.component.d.ts +0 -5
- package/esm/components/text-editor/text-editor.component.js +1 -1
- package/esm/components/textarea/textarea.component.d.ts +0 -5
- package/esm/components/textarea/textarea.component.js +1 -1
- package/esm/components/textbox/textbox.component.d.ts +0 -5
- package/esm/components/textbox/textbox.component.js +1 -1
- package/esm/components/tile-select/tile-select.style.d.ts +1 -1
- package/esm/components/time/time.component.d.ts +0 -5
- package/esm/components/time/time.component.js +1 -1
- package/esm/components/time/time.style.d.ts +1 -1
- package/esm/locales/de-de.js +1 -1
- package/esm/locales/en-gb.js +1 -1
- package/esm/locales/es-es.js +1 -1
- package/esm/locales/fr-ca.js +1 -1
- package/esm/locales/fr-fr.js +1 -1
- package/esm/locales/locale.d.ts +0 -3
- package/lib/__internal__/checkable-input/checkable-input.component.d.ts +0 -5
- package/lib/__internal__/checkable-input/checkable-input.component.js +1 -1
- package/lib/__internal__/fieldset/fieldset.component.d.ts +1 -6
- package/lib/__internal__/fieldset/fieldset.component.js +1 -1
- package/lib/__internal__/fieldset/fieldset.style.d.ts +0 -6
- package/lib/__internal__/fieldset/fieldset.style.js +1 -1
- package/lib/__internal__/form-field/form-field.component.d.ts +1 -6
- package/lib/__internal__/form-field/form-field.component.js +1 -1
- package/lib/__internal__/input/input.component.d.ts +0 -5
- package/lib/__internal__/input/input.component.js +1 -1
- package/lib/__internal__/label/label.component.d.ts +2 -2
- package/lib/__internal__/label/label.component.js +1 -1
- package/lib/__internal__/label/label.style.d.ts +0 -4
- package/lib/__internal__/label/label.style.js +1 -1
- package/lib/components/badge/badge.component.d.ts +15 -8
- package/lib/components/badge/badge.component.js +1 -1
- package/lib/components/badge/badge.style.d.ts +6 -5
- package/lib/components/badge/badge.style.js +1 -1
- package/lib/components/checkbox/checkbox-group/checkbox-group.component.d.ts +1 -6
- package/lib/components/checkbox/checkbox-group/checkbox-group.component.js +1 -1
- package/lib/components/checkbox/checkbox.component.js +1 -1
- package/lib/components/date-range/date-range.component.d.ts +1 -6
- package/lib/components/date-range/date-range.component.js +1 -1
- package/lib/components/dialog/dialog.component.js +1 -1
- package/lib/components/dialog-full-screen/dialog-full-screen.component.js +1 -1
- package/lib/components/fieldset/fieldset.component.d.ts +1 -6
- package/lib/components/fieldset/fieldset.component.js +1 -1
- package/lib/components/fieldset/fieldset.style.d.ts +0 -7
- package/lib/components/fieldset/fieldset.style.js +1 -1
- package/lib/components/file-input/file-input.component.d.ts +0 -5
- package/lib/components/file-input/file-input.component.js +1 -1
- package/lib/components/inline-inputs/inline-inputs.component.d.ts +1 -6
- package/lib/components/inline-inputs/inline-inputs.component.js +1 -1
- package/lib/components/loader/loader.component.d.ts +1 -6
- package/lib/components/loader/loader.component.js +1 -1
- package/lib/components/modal/modal.component.d.ts +1 -3
- package/lib/components/modal/modal.component.js +1 -1
- package/lib/components/numeral-date/numeral-date.component.d.ts +0 -5
- package/lib/components/numeral-date/numeral-date.component.js +1 -1
- package/lib/components/numeral-date/numeral-date.style.d.ts +1 -1
- package/lib/components/radio-button/radio-button-group/radio-button-group.component.d.ts +1 -6
- package/lib/components/radio-button/radio-button-group/radio-button-group.component.js +1 -1
- package/lib/components/radio-button/radio-button.component.d.ts +1 -1
- package/lib/components/select/__internal__/select-textbox/select-textbox.component.d.ts +0 -5
- package/lib/components/select/__internal__/select-textbox/select-textbox.component.js +1 -1
- package/lib/components/select/filterable-select/filterable-select.component.d.ts +0 -5
- package/lib/components/select/filterable-select/filterable-select.component.js +1 -1
- package/lib/components/select/multi-select/multi-select.component.d.ts +0 -5
- package/lib/components/select/multi-select/multi-select.component.js +1 -1
- package/lib/components/select/simple-select/simple-select.component.d.ts +0 -5
- package/lib/components/select/simple-select/simple-select.component.js +1 -1
- package/lib/components/switch/switch.component.js +1 -1
- package/lib/components/tabs/__internal__/tab-title/tab-title.component.js +1 -1
- package/lib/components/text-editor/text-editor.component.d.ts +0 -5
- package/lib/components/text-editor/text-editor.component.js +1 -1
- package/lib/components/textarea/textarea.component.d.ts +0 -5
- package/lib/components/textarea/textarea.component.js +1 -1
- package/lib/components/textbox/textbox.component.d.ts +0 -5
- package/lib/components/textbox/textbox.component.js +1 -1
- package/lib/components/tile-select/tile-select.style.d.ts +1 -1
- package/lib/components/time/time.component.d.ts +0 -5
- package/lib/components/time/time.component.js +1 -1
- package/lib/components/time/time.style.d.ts +1 -1
- package/lib/locales/de-de.js +1 -1
- package/lib/locales/en-gb.js +1 -1
- package/lib/locales/es-es.js +1 -1
- package/lib/locales/fr-ca.js +1 -1
- package/lib/locales/fr-fr.js +1 -1
- package/lib/locales/locale.d.ts +0 -3
- package/package.json +1 -1
|
@@ -8,14 +8,9 @@ export interface FieldsetProps extends MarginProps, TagProps {
|
|
|
8
8
|
legend?: string;
|
|
9
9
|
/** Flag to configure fields as mandatory. */
|
|
10
10
|
required?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* [Legacy] Flag to configure component as optional.
|
|
13
|
-
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
14
|
-
*/
|
|
15
|
-
isOptional?: boolean;
|
|
16
11
|
}
|
|
17
12
|
export declare const Fieldset: {
|
|
18
|
-
({ children, legend, required,
|
|
13
|
+
({ children, legend, required, ...rest }: FieldsetProps): React.JSX.Element;
|
|
19
14
|
displayName: string;
|
|
20
15
|
};
|
|
21
16
|
export default Fieldset;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as
|
|
1
|
+
import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useState as t,useContext as n,useEffect as o}from"react";import i from"../../__internal__/utils/helpers/tags/tags.js";import{FieldsetStyle as l,StyledLegend as s}from"./fieldset.style.js";import c from"../carbon-provider/__internal__/new-validation.context.js";import"../../style/utils/filter-styled-system-padding-props.js";import a from"../../style/utils/filter-styled-system-margin-props.js";function p(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}const u=u=>{var{children:f,legend:y,required:b}=u,d=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}(u,["children","legend","required"]);const[O,m]=t(null),j=a(d),{validationRedesignOptIn:g}=n(c);return o((()=>{O&&b&&Array.from(O.querySelectorAll("input")||[]).forEach((e=>{e.setAttribute("required","")}))}),[O,b]),e(l,(v=function(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){p(e,r,t[r])}))}return e}({ref:m,newValidation:g},d,j,i("fieldset",d)),w=null!=(w={children:[y&&r(s,{"data-element":"legend",isRequired:b,children:y}),f]})?w:{},Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(w)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(w)).forEach((function(e){Object.defineProperty(v,e,Object.getOwnPropertyDescriptor(w,e))})),v));var v,w};u.displayName="Fieldset";export{u as Fieldset,u as default};
|
|
@@ -7,13 +7,6 @@ declare const FieldsetStyle: import("styled-components").StyledComponent<"fields
|
|
|
7
7
|
export interface StyledLegendProps {
|
|
8
8
|
/** Flag to configure fields as mandatory. */
|
|
9
9
|
isRequired?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* [Legacy] Flag to configure fields as optional.
|
|
12
|
-
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
13
|
-
*/
|
|
14
|
-
isOptional?: boolean;
|
|
15
|
-
/** Text used for the optional label */
|
|
16
|
-
optionalLabel?: string;
|
|
17
10
|
}
|
|
18
11
|
declare const StyledLegend: import("styled-components").StyledComponent<"legend", any, StyledLegendProps, never>;
|
|
19
12
|
export { FieldsetStyle, StyledLegend };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e,{css as t}from"styled-components";import{margin as i}from"styled-system";import o from"../../__internal__/form-field/form-field.style.js";import n from"../../style/themes/apply-base-theme.js";import a from"../checkbox/checkbox.style.js";const r=e.fieldset.attrs(n).withConfig({displayName:"fieldset.style__FieldsetStyle",componentId:"sc-570c0e4a-0"})(["margin:0;margin-bottom:var(--fieldSpacing);"," border:none;padding:0;",""],i,(({newValidation:e})=>!e&&t(["& *{--fieldSpacing:0;}&&&& ","{margin-top:0;margin-bottom:-1px;}& ","{padding-top:8px;padding-bottom:8px;}"],o,a))),s=e.legend.withConfig({displayName:"fieldset.style__StyledLegend",componentId:"sc-570c0e4a-1"})(["display:flex;align-items:center;margin-bottom:var(--spacing250);font-size:var(--fontSizes400);font-weight:var(--fontWeights500);color:var(--colorsUtilityYin090);line-height:24px;",""],(({isRequired:e})=>e&&t(['::after{content:"*";line-height:24px;color:var(--colorsSemanticNegative500);font-weight:var(--fontWeights500);margin-left:var(--spacing100);position:relative;top:1px;left:-4px;}'])));export{r as FieldsetStyle,s as StyledLegend};
|
|
@@ -33,11 +33,6 @@ export interface FileInputProps extends Pick<ValidationProps, "error">, Pick<Inp
|
|
|
33
33
|
uploadStatus?: FileUploadStatusProps | FileUploadStatusProps[];
|
|
34
34
|
/** Flag to configure component as mandatory. */
|
|
35
35
|
required?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* [Legacy] Flag to configure component as optional.
|
|
38
|
-
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
39
|
-
*/
|
|
40
|
-
isOptional?: boolean;
|
|
41
36
|
/** Render the ValidationMessage above the FileInput */
|
|
42
37
|
validationMessagePositionTop?: boolean;
|
|
43
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as t,jsx as r}from"react/jsx-runtime";import n,{useState as i,useRef as o,useEffect as a,createElement as l}from"react";import"../../style/utils/filter-styled-system-padding-props.js";import s from"../../style/utils/filter-styled-system-margin-props.js";import{InputBehaviour as
|
|
1
|
+
import{jsxs as e,Fragment as t,jsx as r}from"react/jsx-runtime";import n,{useState as i,useRef as o,useEffect as a,createElement as l}from"react";import"../../style/utils/filter-styled-system-padding-props.js";import s from"../../style/utils/filter-styled-system-margin-props.js";import{InputBehaviour as d}from"../../__internal__/input-behaviour/input-behaviour.component.js";import p from"../../__internal__/form-field/form-field.component.js";import m from"../../hooks/__internal__/useUniqueId/index.js";import u from"../../hooks/__internal__/useInputAccessibility/useInputAccessibility.js";import c from"../../__internal__/validation-message/validation-message.component.js";import{StyledHiddenFileInput as f,StyledFileInputPresentation as g}from"./file-input.style.js";import v from"../textbox/textbox.style.js";import{ButtonMinor as b}from"../button-minor/button-minor.component.js";import{Typography as y}from"../typography/typography.component.js";import{FileUploadStatus as h}from"./__internal__/file-upload-status/file-upload-status.component.js";import{Box as j}from"../box/box.component.js";import O from"../../hooks/__internal__/useLocale/useLocale.js";import{HintText as _}from"../../__internal__/hint-text/hint-text.component.js";function x(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function P(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){x(e,t,r[t])}))}return e}function D(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var 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=n.forwardRef(((n,x)=>{var{accept:w,buttonText:I,"data-element":T,"data-role":k,dragAndDropText:E,error:L,label:S,id:H,inputHint:A,isVertical:W,maxHeight:q,maxWidth:F,minHeight:C,minWidth:M="280px",name:R,onChange:V,required:U,uploadStatus:N=[],validationMessagePositionTop:z=!0}=n,B=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(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)&&(i[r]=e[r])}return i}(n,["accept","buttonText","data-element","data-role","dragAndDropText","error","label","id","inputHint","isVertical","maxHeight","maxWidth","minHeight","minWidth","name","onChange","required","uploadStatus","validationMessagePositionTop"]);const G=O(),J=I||G.fileInput.selectFile(),K=E||G.fileInput.dragAndDrop(),Q={maxHeight:q||void 0,maxWidth:F||M,minHeight:C,minWidth:M},[X,Y]=m(H,R),[Z,$]=i(!1),[ee,te]=i(!1),re=o(null),ne=e=>{var t;e.preventDefault(),(null===(t=e.dataTransfer)||void 0===t?void 0:t.types.includes("Files"))&&te(!0)},ie=e=>{e.preventDefault(),te(!1)};a((()=>(document.addEventListener("dragover",ne),document.addEventListener("drop",ie),document.addEventListener("dragleave",ie),()=>{document.removeEventListener("dragover",ne),document.removeEventListener("drop",ie),document.removeEventListener("dragleave",ie)})),[]);const oe=e=>{null==V||V(e)},{labelId:ae,validationId:le}=u({id:X,validationRedesignOptIn:!0,error:L,label:S}),se=Array.isArray(N)?N:[N],de=e(t,{children:[A&&r(_,{children:A}),e(j,{position:"relative",children:[z&&e(t,{children:[r(c,{error:L,validationId:le,validationMessagePositionTop:z,"data-role":"validation-message-top"}),L&&r(v,{warning:!1})]}),r(f,P(D(P({},U&&{required:U}),{accept:w,"aria-invalid":!!L,id:X,ref:e=>{re.current=e,"function"==typeof x?x(e):x&&(x.current=e)},name:Y,onChange:e=>{oe(e.target.files)},type:"file"}),B)),e(g,D(P({"data-role":"file-input-presentation",isDraggedOver:Z,isDraggingFile:ee,error:L,onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),$(!1)},onDragOver:e=>{var t;e.preventDefault(),(null===(t=e.dataTransfer)||void 0===t?void 0:t.types.includes("Files"))&&$(!0)},onDrop:e=>{e.preventDefault(),$(!1),oe(e.dataTransfer.files)},isVertical:W},Q),{children:[r(b,{buttonType:"primary",onClick:()=>{var e;null===(e=re.current)||void 0===e||e.click()},children:J}),r(y,{m:0,children:K})]})),!z&&e(t,{children:[r(c,{error:L,validationId:le,validationMessagePositionTop:z,"data-role":"validation-message-bottom"}),L&&r(v,{warning:!1})]})]})]});return r(d,{children:r(p,D(P({error:L,label:S,labelId:ae,id:X,isRequired:U,"data-component":"file-input","data-role":k,"data-element":T,validationRedesignOptIn:!0},s(B)),{children:0===se.length?de:se.map((e=>l(g,D(P({hasUploadStatus:!0},Q),{key:e.filename}),r(h,P({},e)))))}))})}));w.displayName="FileInput";export{w as FileInput,w as default};
|
|
@@ -26,14 +26,9 @@ export interface InlineInputsProps extends MarginProps, StyledContentContainerPr
|
|
|
26
26
|
labelId?: string;
|
|
27
27
|
/** Flag to configure component as mandatory. */
|
|
28
28
|
required?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* [Legacy] Flag to configure component as optional.
|
|
31
|
-
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
32
|
-
*/
|
|
33
|
-
isOptional?: boolean;
|
|
34
29
|
}
|
|
35
30
|
declare const InlineInputs: {
|
|
36
|
-
({ adaptiveLabelBreakpoint, label, labelAlign, labelId, htmlFor, children, gutter, inputWidth, labelInline, labelWidth, required,
|
|
31
|
+
({ adaptiveLabelBreakpoint, label, labelAlign, labelId, htmlFor, children, gutter, inputWidth, labelInline, labelWidth, required, ...rest }: InlineInputsProps): React.JSX.Element;
|
|
37
32
|
displayName: string;
|
|
38
33
|
};
|
|
39
34
|
export default InlineInputs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import r,{useRef as n,useEffect as l}from"react";import i from"../../__internal__/label/label.component.js";import o,{StyledContentContainer as a,StyledInlineInput as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import r,{useRef as n,useEffect as l}from"react";import i from"../../__internal__/label/label.component.js";import o,{StyledContentContainer as a,StyledInlineInput as u}from"./inline-inputs.style.js";import p from"../../hooks/__internal__/useIsAboveBreakpoint/useIsAboveBreakpoint.js";import s from"../../__internal__/utils/helpers/tags/tags.js";import"../../style/utils/filter-styled-system-padding-props.js";import c from"../../style/utils/filter-styled-system-margin-props.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}const f=(e,n)=>r.Children.map(e,(e=>t(u,{gutter:n,"data-element":"inline-input",children:e}))),d=r=>{var{adaptiveLabelBreakpoint:u,label:d,labelAlign:m,labelId:y,htmlFor:O,children:g=null,gutter:h="none",inputWidth:j,labelInline:v=!0,labelWidth:P,required:_}=r,w=function(e,t){if(null==e)return{};var r,n,l=function(e,t){if(null==e)return{};var r,n,l={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(l[r]=e[r]);return l}(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)&&(l[r]=e[r])}return l}(r,["adaptiveLabelBreakpoint","label","labelAlign","labelId","htmlFor","children","gutter","inputWidth","labelInline","labelWidth","required"]);const I=p(u),k=n(null);let A=v;u&&(A=I);const S=c(w);return l((()=>{var e;_&&Array.from((null===(e=k.current)||void 0===e?void 0:e.querySelectorAll("input"))||[]).forEach((e=>e.setAttribute("required","")))}),[_]),e(o,(W=function(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}({gutter:h,labelWidth:P,labelInline:A,ref:k},S,s("inline-inputs",w)),q=null!=(q={children:[d?t(i,{align:m,labelId:y,inline:A,htmlFor:O,isRequired:_,children:d}):null,t(a,{gutter:h,"data-element":"inline-inputs-container","data-role":"inline-inputs-container",inputWidth:j,children:f(g,h)})]})?q:{},Object.getOwnPropertyDescriptors?Object.defineProperties(W,Object.getOwnPropertyDescriptors(q)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(q)).forEach((function(e){Object.defineProperty(W,e,Object.getOwnPropertyDescriptor(q,e))})),W));var W,q};d.displayName="InlineInputs";export{d as default};
|
|
@@ -5,16 +5,11 @@ import { StyledLoaderSquareProps } from "./loader-square.style";
|
|
|
5
5
|
export interface LoaderProps extends Omit<StyledLoaderSquareProps, "backgroundColor">, MarginProps, TagProps {
|
|
6
6
|
/** Toggle between the default variant and gradient variant */
|
|
7
7
|
variant?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Specify a custom accessible name for the Loader component
|
|
10
|
-
* @deprecated - use `loaderLabel` prop instead
|
|
11
|
-
*/
|
|
12
|
-
"aria-label"?: string;
|
|
13
8
|
/**
|
|
14
9
|
* Specify a custom accessible label for the Loader.
|
|
15
10
|
* This label is visible to users who have enabled the reduce motion setting in their operating system. It is also available to assistive technologies.
|
|
16
11
|
*/
|
|
17
12
|
loaderLabel?: string;
|
|
18
13
|
}
|
|
19
|
-
export declare const Loader: ({ variant,
|
|
14
|
+
export declare const Loader: ({ variant, size, isInsideButton, isActive, loaderLabel, ...rest }: LoaderProps) => React.JSX.Element;
|
|
20
15
|
export default Loader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import"react";import"../../style/utils/filter-styled-system-padding-props.js";import o from"../../style/utils/filter-styled-system-margin-props.js";import n from"../../hooks/useMediaQuery/useMediaQuery.js";import
|
|
1
|
+
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import"react";import"../../style/utils/filter-styled-system-padding-props.js";import o from"../../style/utils/filter-styled-system-margin-props.js";import n from"../../hooks/useMediaQuery/useMediaQuery.js";import i from"../../hooks/__internal__/useLocale/useLocale.js";import s from"../../__internal__/utils/helpers/tags/tags.js";import a from"./loader.style.js";import l,{StyledLoaderPlaceholder as c}from"./loader-square.style.js";import{Typography as p}from"../typography/typography.component.js";function u(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function d(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),o.forEach((function(r){u(e,r,t[r])}))}return e}const f=u=>{var{variant:f="default",size:y="medium",isInsideButton:m=!1,isActive:b=!0,loaderLabel:O}=u,j=function(e,r){if(null==e)return{};var t,o,n=function(e,r){if(null==e)return{};var t,o,n={},i=Object.keys(e);for(o=0;o<i.length;o++)t=i[o],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)t=i[o],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}(u,["variant","size","isInsideButton","isActive","loaderLabel"]);const g=i(),v=n("screen and (prefers-reduced-motion: no-preference)");if(void 0===v)return e(c,{});const h={isInsideButton:m,isActive:b,size:y,variant:f};return e(a,(P=d({},s("loader",j),o(j)),w=null!=(w={children:v?r(t,{children:[["#13A038","#0092DB","#8F49FE"].map((r=>e(l,d({"data-role":"loader-square",backgroundColor:"gradient"===f?r:"var(--colorsActionMajor500)"},h),r))),e(p,{"data-role":"hidden-label",variant:"span",screenReaderOnly:!0,children:O||g.loader.loading()})]}):O||g.loader.loading()})?w:{},Object.getOwnPropertyDescriptors?Object.defineProperties(P,Object.getOwnPropertyDescriptors(w)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(w)).forEach((function(e){Object.defineProperty(P,e,Object.getOwnPropertyDescriptor(w,e))})),P));var P,w};export{f as Loader,f as default};
|
|
@@ -21,8 +21,6 @@ export interface ModalProps extends TagProps {
|
|
|
21
21
|
onCancel?: (ev: React.KeyboardEvent<HTMLElement> | KeyboardEvent) => void;
|
|
22
22
|
/** Sets the open state of the modal */
|
|
23
23
|
open: boolean;
|
|
24
|
-
/** @deprecated Transition time */
|
|
25
|
-
timeout?: number;
|
|
26
24
|
/** Manually override the internal modal stacking order to set this as top */
|
|
27
25
|
topModalOverride?: boolean;
|
|
28
26
|
/** Enables the automatic restoration of focus to the element that invoked
|
|
@@ -30,5 +28,5 @@ export interface ModalProps extends TagProps {
|
|
|
30
28
|
*/
|
|
31
29
|
restoreFocusOnClose?: boolean;
|
|
32
30
|
}
|
|
33
|
-
declare const Modal: ({ children, "data-element": dataElement, "data-role": dataRole, open, onCancel, disableEscKey, disableClose, enableBackgroundUI,
|
|
31
|
+
declare const Modal: ({ children, "data-element": dataElement, "data-role": dataRole, open, onCancel, disableEscKey, disableClose, enableBackgroundUI, topModalOverride, restoreFocusOnClose, ...rest }: ModalProps) => React.JSX.Element;
|
|
34
32
|
export default Modal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useRef as o,useState as t,useEffect as n,useCallback as l}from"react";import{TransitionGroup as a,CSSTransition as i}from"react-transition-group";import c from"../../hooks/__internal__/useScrollBlock/useScrollBlock.js";import{Portal as s}from"../portal/portal.js";import{getDocument as d}from"../../__internal__/dom/globals.js";import m from"../../__internal__/utils/helpers/events/events.js";import p from"../../hooks/__internal__/useModalManager/useModalManager.js";import{StyledModal as u,StyledModalBackground as f}from"./modal.style.js";import b from"./__internal__/modal.context.js";function O(e,r,o){return r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}function g(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{},t=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(o).filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})))),t.forEach((function(r){O(e,r,o[r])}))}return e}const y=O=>{var{children:
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useRef as o,useState as t,useEffect as n,useCallback as l}from"react";import{TransitionGroup as a,CSSTransition as i}from"react-transition-group";import c from"../../hooks/__internal__/useScrollBlock/useScrollBlock.js";import{Portal as s}from"../portal/portal.js";import{getDocument as d}from"../../__internal__/dom/globals.js";import m from"../../__internal__/utils/helpers/events/events.js";import p from"../../hooks/__internal__/useModalManager/useModalManager.js";import{StyledModal as u,StyledModalBackground as f}from"./modal.style.js";import b from"./__internal__/modal.context.js";function O(e,r,o){return r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}function g(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{},t=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(o).filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})))),t.forEach((function(r){O(e,r,o[r])}))}return e}const y=300,j=O=>{var{children:j,"data-element":v,"data-role":_="modal",open:h,onCancel:P,disableEscKey:k=!1,disableClose:w,enableBackgroundUI:E=!1,topModalOverride:M,restoreFocusOnClose:S=!0}=O,C=function(e,r){if(null==e)return{};var o,t,n=function(e,r){if(null==e)return{};var o,t,n={},l=Object.keys(e);for(t=0;t<l.length;t++)o=l[t],r.indexOf(o)>=0||(n[o]=e[o]);return n}(e,r);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t<l.length;t++)o=l[t],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}(O,["children","data-element","data-role","open","onCancel","disableEscKey","disableClose","enableBackgroundUI","topModalOverride","restoreFocusOnClose"]);const x=o(null),I=o(null),R=o(null),[B,D]=t(!1),[F,N]=t(!1),{blockScroll:T,allowScroll:K}=c();n((()=>{E||(h?T():K())}),[K,T,E,h]),n((()=>()=>{E||K()}),[K,E]);const A=l((e=>{P&&!w&&!k&&m.isEscKey(e)&&(e.stopImmediatePropagation(),P(e))}),[w,k,P]),U=d();let q,z;return p({open:h,closeModal:A,modalRef:x,setTriggerRefocusFlag:N,topModalOverride:M,focusCallToActionElement:S&&U?U.activeElement:void 0}),h&&(q=E?null:e(f,{ref:I,"data-element":"modal-background","data-role":"modal-background",transitionName:"modal-background",transitionTime:y}),z=j),e(s,{children:r(u,(G=g({"data-component":"modal","data-element":v,"data-role":_,"data-state":h?"open":"closed",transitionName:"modal",transitionTime:y,topModalOverride:M,ref:x},C),H={children:[e(a,{children:q&&e(i,{nodeRef:I,appear:!0,classNames:"modal-background",timeout:y,onEntered:()=>D(!0),onExiting:()=>D(!1),children:q},"modal")}),e(a,{children:z&&e(i,{nodeRef:R,appear:!0,classNames:"modal",timeout:y,children:e(b.Provider,{value:{isAnimationComplete:B,triggerRefocusFlag:F,isInModal:!0},children:e("div",{ref:R,children:z})})})})]},H=null!=H?H:{},Object.getOwnPropertyDescriptors?Object.defineProperties(G,Object.getOwnPropertyDescriptors(H)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r.push.apply(r,o)}return r}(Object(H)).forEach((function(e){Object.defineProperty(G,e,Object.getOwnPropertyDescriptor(H,e))})),G))});var G,H};export{j as default};
|
|
@@ -80,11 +80,6 @@ export interface NumeralDateProps extends ValidationProps, MarginProps, TagProps
|
|
|
80
80
|
* A React ref to pass to the input corresponding to the year
|
|
81
81
|
*/
|
|
82
82
|
yearRef?: React.ForwardedRef<HTMLInputElement>;
|
|
83
|
-
/**
|
|
84
|
-
* [Legacy] Flag to configure component as optional.
|
|
85
|
-
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
86
|
-
*/
|
|
87
|
-
isOptional?: boolean;
|
|
88
83
|
/** Render the ValidationMessage above the NumeralDate inputs when validationRedesignOptIn flag is set */
|
|
89
84
|
validationMessagePositionTop?: boolean;
|
|
90
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as n,Fragment as t}from"react/jsx-runtime";import{forwardRef as r,useContext as i,useRef as l,useImperativeHandle as o,useState as a,useMemo as d,useEffect as s}from"react";import m from"invariant";import c from"../../__internal__/utils/helpers/tags/tags.js";import"../../style/utils/filter-styled-system-padding-props.js";import y from"../../style/utils/filter-styled-system-margin-props.js";import u from"../../__internal__/utils/helpers/events/events.js";import{StyledFieldset as p,StyledNumeralDate as f,StyledDateField as b}from"./numeral-date.style.js";import{Textbox as g}from"../textbox/textbox.component.js";import{Box as h}from"../box/box.component.js";import v from"../textbox/textbox.style.js";import _ from"../../__internal__/validation-message/validation-message.component.js";import O from"../../__internal__/utils/helpers/guid/index.js";import j from"../../hooks/__internal__/useLocale/useLocale.js";import{TooltipProvider as w}from"../../__internal__/tooltip-provider/index.js";import D from"../carbon-provider/__internal__/new-validation.context.js";import I from"./__internal__/numeral-date.context.js";import x from"../../__internal__/utils/logger/index.js";import{FieldHelp as P}from"../../__internal__/field-help/field-help.component.js";import k from"../../hooks/__internal__/useIsAboveBreakpoint/useIsAboveBreakpoint.js";import A from"../../hooks/__internal__/useInputAccessibility/useInputAccessibility.js";import{HintText as S}from"../../__internal__/hint-text/hint-text.component.js";function B(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function L(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){B(e,n,t[n])}))}return e}function E(e,n){return n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):function(e){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n.push.apply(n,t)}return n}(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})),e}let R=!1;const F=[["dd","mm","yyyy"],["mm","dd","yyyy"],["yyyy","mm","dd"],["dd","mm"],["mm","dd"],["mm","yyyy"]],T=e=>{const n=(new Date).getFullYear(),{format:t}=new Intl.DateTimeFormat(e,{month:"long"});return[...Array(12).keys()].map((e=>t(new Date(Date.UTC(n,e)))))},H=(e,n,t)=>({dd:e.numeralDate.validation.day(n?T(e.locale())[+n-1]:void 0,t),mm:e.numeralDate.validation.month(),yyyy:e.numeralDate.validation.year()}),M=(e,n)=>{switch(e){case"mm":return n.numeralDate.labels.month();case"yyyy":return n.numeralDate.labels.year();default:return n.numeralDate.labels.day()}},z=r(((r,B)=>{var{dateFormat:T=["dd","mm","yyyy"],defaultValue:z,disabled:N,error:W="",warning:q="",info:C,id:K,name:V,onBlur:Y,onChange:J,value:U,validationOnLabel:$=!1,label:G,labelInline:Q,labelWidth:X,labelAlign:Z,fieldLabelsAlign:ee,labelHelp:ne,labelSpacing:te,fieldHelp:re,adaptiveLabelBreakpoint:ie,required:le,readOnly:oe,size:ae="medium",enableInternalError:de,enableInternalWarning:se,tooltipPosition:me,helpAriaLabel:ce,dayRef:ye,monthRef:ue,yearRef:pe,validationMessagePositionTop:fe=!0}=r,be=function(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},l=Object.keys(e);for(r=0;r<l.length;r++)t=l[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)t=l[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}(r,["dateFormat","defaultValue","disabled","error","warning","info","id","name","onBlur","onChange","value","validationOnLabel","label","labelInline","labelWidth","labelAlign","fieldLabelsAlign","labelHelp","labelSpacing","fieldHelp","adaptiveLabelBreakpoint","required","readOnly","size","enableInternalError","enableInternalWarning","tooltipPosition","helpAriaLabel","dayRef","monthRef","yearRef","validationMessagePositionTop"]);const ge=j(),{validationRedesignOptIn:he}=i(D),{current:ve}=l(K||O()),_e=l({dd:O(),mm:O(),yyyy:O()}),Oe=l(O()),je=l(void 0!==U),we=je.current?U:z,De=l(T.map((()=>null)));o(B,(()=>({focus:()=>{var e;null===(e=De.current[0])||void 0===e||e.focus()}})));const[Ie,xe]=a(L({},Object.fromEntries(T.map((e=>[e,""]))))),Pe=d((()=>!T||F.find((e=>JSON.stringify(e)===JSON.stringify(T)))),[T]);m(Pe,"Forbidden prop dateFormat supplied to NumeralDate. Only one of these date formats is allowed: ['dd', 'mm', 'yyyy'], ['mm', 'dd', 'yyyy'], ['yyyy', 'mm', 'dd'], ['dd', 'mm'], ['mm', 'dd'], ['mm', 'yyyy']"),s((()=>{m(je.current===(void 0!==U),"Input elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component")}),[U]);const[ke,Ae]=a(L({},we||Object.fromEntries(T.map((e=>[e,""]))))),Se=e=>({target:{name:V,id:ve,value:e}}),Be=e=>{u.isNumberKey(e)||u.isTabKey(e)||u.isEnterKey(e)||"Delete"===e.key||"Backspace"===e.key||e.preventDefault()},Le=()=>{(de||se)&&xe((e=>L({},e,((e,{dd:n,mm:t,yyyy:r})=>{const i={dd:"",mm:"",yyyy:""},l=((e,n)=>{if(!e||+e>12||+e<1)return 31;const t=new Date,r=+(n||t.getFullYear());return new Date(r,+e,0).getDate()})(t,r);return n&&(+n>l||+n<1)&&(i.dd=H(e,t,String(l)).dd),t&&(+t>12||+t<1)&&(i.mm=H(e).mm),r&&(+r<1800||+r>2200)&&(i.yyyy=H(e).yyyy),i})(ge,ke)))),setTimeout((()=>{const e=!De.current.find((e=>e===document.activeElement));Y&&e&&Y(Se(ke))}),5)},Ee=Object.keys(Ie).reduce(((e,n)=>Ie[n]?`${e+Ie[n]}\n`:e),""),Re=de?Ee+W:W,Fe=se?Ee+q:q;R||je.current||(R=!0,x.deprecate("Uncontrolled behaviour in `Numeral Date` is deprecated and support will soon be removed. Please make sure all your inputs are controlled."));const Te=k(ie);let He=Q;ie&&(He=Te);const{validationId:Me,fieldHelpId:ze,ariaDescribedBy:Ne}=A({id:ve,validationRedesignOptIn:!0,error:Re,warning:Fe,info:C,fieldHelp:re}),We=(he&&fe?[Ne,Oe.current]:[Oe.current,Ne]).filter(Boolean).join(" "),qe=()=>e(f,{onKeyDown:Be,children:T.map(((n,t)=>{const r=t===T.length-1;let i;const l=Re||Fe||C,o=!he&&"string"==typeof l&&""!==l;switch(n.slice(0,2)){case"dd":i=ye;break;case"mm":i=ue;break;case"yy":i=pe}return e(I.Provider,{value:{disableErrorBorder:!0},children:e(b,{size:ae,isYearInput:4===n.length,hasValidationIconInField:!$&&r&&o,children:e(g,E(L({id:_e.current[n],label:M(n,ge),labelAlign:ee,disabled:N,readOnly:oe,error:!!Re,warning:!!Fe,info:!!C,size:ae,value:ke[n],onChange:e=>((e,n)=>{const{value:t}=e.target;if(t.length<=n.length){const e=E(L({},ke),{[n]:t});Ae(e),J&&J(Se(e))}})(e,n),onBlur:Le,ref:e=>((e,n,t)=>{De.current[n]=e,t&&("function"==typeof t?t(e):t.current=e)})(e,t,i)},r&&!$&&!he&&{error:Re,warning:Fe,info:C}),{tooltipPosition:me,tooltipId:Me,my:0}))},n)},n)}))});return he?n(p,E(L({id:ve,legend:G,legendMargin:{mb:0},legendAlign:Z,isRequired:le,isDisabled:N,name:V,"aria-describedby":We},y(be),c("numeral-date",be)),{children:[ne&&e(S,{align:Z,id:Oe.current,children:ne}),n(h,{position:"relative",mt:ne?0:1,children:[fe&&(Re||Fe)&&n(t,{children:[e(_,{error:Re,warning:Fe,validationId:Me,validationMessagePositionTop:fe}),e(v,{warning:!(Re||!Fe)})]}),qe(),!fe&&(Re||Fe)&&n(t,{children:[e(_,{error:Re,warning:Fe,validationId:Me,validationMessagePositionTop:fe}),e(v,{warning:!(Re||!Fe)})]})]})]})):e(w,{helpAriaLabel:ce,children:e(p,E(L({id:ve,legend:G,legendMargin:{mb:0},isRequired:le,isDisabled:N,name:V,error:$&&Re,warning:$&&Fe,info:$&&C,inline:He,size:ae,labelHelp:ne,legendAlign:Z,legendWidth:X,legendSpacing:te,validationId:Me,"aria-describedby":$?Ne:ze},y(be),c("numeral-date",be)),{children:n(h,{display:"flex",flexDirection:"column",mt:He?0:1,children:[qe(),re&&e(P,{id:ze,children:re})]})}))})}));export{F as ALLOWED_DATE_FORMATS,z as NumeralDate,z as default};
|
|
@@ -12,5 +12,5 @@ interface StyledFieldsetProps extends FieldsetProps {
|
|
|
12
12
|
inline?: boolean;
|
|
13
13
|
size?: "small" | "medium" | "large";
|
|
14
14
|
}
|
|
15
|
-
export declare const StyledFieldset: import("styled-components").StyledComponent<({ legend, children, inline, legendWidth, legendAlign, legendSpacing, error, warning, info, isRequired, blockGroupBehaviour, legendMargin, isDisabled,
|
|
15
|
+
export declare const StyledFieldset: import("styled-components").StyledComponent<({ legend, children, inline, legendWidth, legendAlign, legendSpacing, error, warning, info, isRequired, blockGroupBehaviour, legendMargin, isDisabled, labelHelp, validationId, ...rest }: FieldsetProps) => import("react").JSX.Element, any, StyledFieldsetProps, never>;
|
|
16
16
|
export {};
|
|
@@ -41,11 +41,6 @@ export interface RadioButtonGroupProps extends ValidationProps, MarginProps, Tag
|
|
|
41
41
|
onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
|
|
42
42
|
/** Flag to configure component as mandatory */
|
|
43
43
|
required?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* [Legacy] Flag to configure component as optional.
|
|
46
|
-
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
47
|
-
*/
|
|
48
|
-
isOptional?: boolean;
|
|
49
44
|
/** value of the selected RadioButton */
|
|
50
45
|
value?: string;
|
|
51
46
|
/** [Legacy] Overrides the default tooltip position */
|
|
@@ -54,7 +49,7 @@ export interface RadioButtonGroupProps extends ValidationProps, MarginProps, Tag
|
|
|
54
49
|
validationMessagePositionTop?: boolean;
|
|
55
50
|
}
|
|
56
51
|
export declare const RadioButtonGroup: {
|
|
57
|
-
({ children, id, name, legend, legendHelp, error, warning, info, onBlur, onChange, value, inline, legendInline, legendWidth, legendAlign, legendSpacing, labelSpacing, adaptiveLegendBreakpoint, adaptiveSpacingBreakpoint, required,
|
|
52
|
+
({ children, id, name, legend, legendHelp, error, warning, info, onBlur, onChange, value, inline, legendInline, legendWidth, legendAlign, legendSpacing, labelSpacing, adaptiveLegendBreakpoint, adaptiveSpacingBreakpoint, required, tooltipPosition, validationMessagePositionTop, ...rest }: RadioButtonGroupProps): React.JSX.Element;
|
|
58
53
|
displayName: string;
|
|
59
54
|
};
|
|
60
55
|
export default RadioButtonGroup;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as n,jsxs as r}from"react/jsx-runtime";import i,{useContext as o,useRef as t}from"react";import l from"../../../__internal__/utils/helpers/tags/tags.js";import a from"../../../__internal__/fieldset/fieldset.component.js";import d from"./radio-button-group.style.js";import p from"../../../__internal__/radio-button-mapper/radio-button-mapper.component.js";import s from"../../../hooks/__internal__/useIsAboveBreakpoint/useIsAboveBreakpoint.js";import"../../../style/utils/filter-styled-system-padding-props.js";import c from"../../../style/utils/filter-styled-system-margin-props.js";import{TooltipProvider as g}from"../../../__internal__/tooltip-provider/index.js";import u from"../../../__internal__/utils/logger/index.js";import m from"../../carbon-provider/__internal__/new-validation.context.js";import
|
|
1
|
+
import{jsx as e,Fragment as n,jsxs as r}from"react/jsx-runtime";import i,{useContext as o,useRef as t}from"react";import l from"../../../__internal__/utils/helpers/tags/tags.js";import a from"../../../__internal__/fieldset/fieldset.component.js";import d from"./radio-button-group.style.js";import p from"../../../__internal__/radio-button-mapper/radio-button-mapper.component.js";import s from"../../../hooks/__internal__/useIsAboveBreakpoint/useIsAboveBreakpoint.js";import"../../../style/utils/filter-styled-system-padding-props.js";import c from"../../../style/utils/filter-styled-system-margin-props.js";import{TooltipProvider as g}from"../../../__internal__/tooltip-provider/index.js";import u from"../../../__internal__/utils/logger/index.js";import m from"../../carbon-provider/__internal__/new-validation.context.js";import b from"../../../__internal__/validation-message/validation-message.component.js";import{Box as f}from"../../box/box.component.js";import _ from"../../../__internal__/utils/helpers/guid/index.js";import v from"../../../hooks/__internal__/useInputAccessibility/useInputAccessibility.js";import h from"../../textbox/textbox.style.js";import{HintText as y}from"../../../__internal__/hint-text/hint-text.component.js";function j(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function O(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{},i=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),i.forEach((function(n){j(e,n,r[n])}))}return e}function w(e,n){return n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):function(e){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})),e}let P=!1;const x=j=>{var{children:x,id:B,name:I,legend:S,legendHelp:k,error:A,warning:E,info:C,onBlur:R,onChange:D,value:T,inline:q=!1,legendInline:M=!1,legendWidth:G,legendAlign:W="left",legendSpacing:H,labelSpacing:L=1,adaptiveLegendBreakpoint:V,adaptiveSpacingBreakpoint:N,required:U,tooltipPosition:$,validationMessagePositionTop:z=!0}=j,F=function(e,n){if(null==e)return{};var r,i,o=function(e,n){if(null==e)return{};var r,i,o={},t=Object.keys(e);for(i=0;i<t.length;i++)r=t[i],n.indexOf(r)>=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(i=0;i<t.length;i++)r=t[i],n.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(j,["children","id","name","legend","legendHelp","error","warning","info","onBlur","onChange","value","inline","legendInline","legendWidth","legendAlign","legendSpacing","labelSpacing","adaptiveLegendBreakpoint","adaptiveSpacingBreakpoint","required","tooltipPosition","validationMessagePositionTop"]);const{validationRedesignOptIn:J}=o(m),K=t(_()),Q=B||K.current,X=k?`${Q}-hint`:void 0;P||D||(P=!0,u.deprecate("Uncontrolled behaviour in `Radio Button` is deprecated and support will soon be removed. Please make sure all your inputs are controlled."));const Y=c(F),Z=s(V),ee=s(N);let ne=M;V&&(ne=!!Z);let re=Y.ml;N&&!ee&&(re=void 0);const{validationId:ie,ariaDescribedBy:oe}=v({id:Q,validationRedesignOptIn:!0,error:A,warning:E,info:C}),te=(J&&z?[oe,X]:[X,oe]).filter(Boolean).join(" ");return e(n,{children:J?r(a,w(O(w(O({legend:S,error:A,warning:E,legendAlign:W,isRequired:U,width:"fit-content"},l("radiogroup",F),Y),{ml:re,blockGroupBehaviour:!(A||E)}),te&&{"aria-describedby":te}),{children:[k&&e(y,{align:W,id:X,marginTop:"-4px",children:k}),r(f,{position:"relative",children:[z&&r(n,{children:[e(b,{error:A,warning:E,validationId:ie,validationMessagePositionTop:z}),(A||E)&&e(h,{"data-role":"radio-error-border",warning:!(A||!E)})]}),e(d,{"data-component":"radio-button-group",role:"radiogroup",inline:q,legendInline:ne,children:e(p,{name:I,onBlur:R,onChange:D,value:T,children:i.Children.map(x,(e=>i.isValidElement(e)?i.cloneElement(e,O({inline:q,labelSpacing:L,error:!!A,warning:!!E},e.props)):e))})}),!z&&r(n,{children:[e(b,{error:A,warning:E,validationId:ie,validationMessagePositionTop:z}),(A||E)&&e(h,{"data-role":"radio-error-border",warning:!(A||!E)})]})]})]})):e(g,{tooltipPosition:$,children:e(a,w(O({legend:S,error:A,warning:E,info:C,inline:ne,legendWidth:G,legendAlign:W,legendSpacing:H,isRequired:U},l("radiogroup",F),Y),{ml:re,blockGroupBehaviour:!(A||E||C),"aria-describedby":oe,validationId:ie,children:e(d,{"data-component":"radio-button-group",role:"radiogroup",inline:q,legendInline:ne,children:e(p,{name:I,onBlur:R,onChange:D,value:T,children:i.Children.map(x,(e=>i.isValidElement(e)?i.cloneElement(e,O({inline:q,labelSpacing:L,error:!!A,warning:!!E,info:!!C},e.props)):e))})})}))})})};x.displayName="RadioButtonGroup";export{x as RadioButtonGroup,x as default};
|
|
@@ -5,7 +5,7 @@ import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
|
5
5
|
interface InternalRadioButtonProps {
|
|
6
6
|
inline?: boolean;
|
|
7
7
|
}
|
|
8
|
-
export interface RadioButtonProps extends Omit<CommonCheckableInputProps, "required"
|
|
8
|
+
export interface RadioButtonProps extends Omit<CommonCheckableInputProps, "required">, MarginProps, TagProps {
|
|
9
9
|
/** Accepts a callback function which is triggered on click event */
|
|
10
10
|
onClick?: (ev: React.MouseEvent<HTMLInputElement>) => void;
|
|
11
11
|
/** the value of the Radio Button, passed on form submit */
|
|
@@ -56,11 +56,6 @@ export interface FormInputPropTypes extends ValidationProps, Omit<CommonTextboxP
|
|
|
56
56
|
*
|
|
57
57
|
*/
|
|
58
58
|
labelId?: string;
|
|
59
|
-
/**
|
|
60
|
-
* [Legacy] Flag to configure component as optional.
|
|
61
|
-
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
62
|
-
*/
|
|
63
|
-
isOptional?: boolean;
|
|
64
59
|
}
|
|
65
60
|
export interface SelectTextboxProps extends FormInputPropTypes {
|
|
66
61
|
/** Id attribute of the select list */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import t from"react";import{SelectTextboxContext as r}from"./select-textbox.context.js";import{StyledSelectText as o,StyledSelectTextChildrenWrapper as n}from"./select-textbox.style.js";import{Textbox as a}from"../../../textbox/textbox.component.js";import l from"../../../../hooks/__internal__/useLocale/useLocale.js";function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(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){i(e,t,r[t])}))}return e}function s(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 d(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}const b=t.forwardRef(((t,i)=>{var{ariaLabel:b,ariaLabelledby:u,accessibilityLabelId:p,labelId:y,"aria-controls":f,disabled:O=!1,isOpen:m,id:x,readOnly:j=!1,placeholder:h,size:v="medium",onClick:g,onFocus:w,onBlur:P,formattedValue:I="",selectedValue:D,required:k,
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import t from"react";import{SelectTextboxContext as r}from"./select-textbox.context.js";import{StyledSelectText as o,StyledSelectTextChildrenWrapper as n}from"./select-textbox.style.js";import{Textbox as a}from"../../../textbox/textbox.component.js";import l from"../../../../hooks/__internal__/useLocale/useLocale.js";function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(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){i(e,t,r[t])}))}return e}function s(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 d(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}const b=t.forwardRef(((t,i)=>{var{ariaLabel:b,ariaLabelledby:u,accessibilityLabelId:p,labelId:y,"aria-controls":f,disabled:O=!1,isOpen:m,id:x,readOnly:j=!1,placeholder:h,size:v="medium",onClick:g,onFocus:w,onBlur:P,formattedValue:I="",selectedValue:D,required:k,hasTextCursor:C,transparent:L=!1,activeDescendantId:S,onKeyDown:V}=t,z=d(t,["ariaLabel","ariaLabelledby","accessibilityLabelId","labelId","aria-controls","disabled","isOpen","id","readOnly","placeholder","size","onClick","onFocus","onBlur","formattedValue","selectedValue","required","hasTextCursor","transparent","activeDescendantId","onKeyDown"]);const _=l(),q=h||_.select.placeholder(),B=!O&&!j&&!I;function E(e){null==g||g(e)}const F=c({disabled:O,id:x,readOnly:j,required:k,onClick:E,onFocus:function(e){O||j||null==w||w(e)},onBlur:P,labelId:y,type:"text",ref:i,onKeyDown:V},z),{"aria-describedby":K}=z,T=d(z,["aria-describedby"]),A={"aria-expanded":j?void 0:m,"aria-labelledby":p?`${u||y} ${p}`:u,"aria-activedescendant":S,"aria-controls":f,"aria-autocomplete":C?"both":void 0,role:j?void 0:"combobox"},$="string"==typeof D||Array.isArray(D)&&"string"==typeof D[0];return e(r.Provider,{value:{isInputInSelect:!0},children:e(a,s(c({"aria-describedby":K,"aria-label":b,"data-element":"select-input","data-role":"select-textbox",inputIcon:"dropdown",autoComplete:"off",size:v,onChange:()=>{},formattedValue:I,value:$?D:void 0,placeholder:C?q:void 0},A,F),{my:0,children:!C&&e(o,s(c({"aria-hidden":!0,"data-element":"select-text","data-role":"select-text",disabled:O,hasPlaceholder:B,onClick:O||j?void 0:E,readOnly:j,transparent:L,size:v},T),{children:e(n,{children:B?q:I})}))}))})}));b.displayName="SelectTextbox";export{b as default};
|
|
@@ -56,11 +56,6 @@ export interface FilterableSelectProps extends Omit<FormInputPropTypes, "default
|
|
|
56
56
|
/** Boolean to disable automatic filtering and highlighting of options.
|
|
57
57
|
* This allows custom filtering and option styling to be performed outside of the component when the filter text changes. */
|
|
58
58
|
disableDefaultFiltering?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* [Legacy] Flag to configure component as optional.
|
|
61
|
-
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
62
|
-
*/
|
|
63
|
-
isOptional?: boolean;
|
|
64
59
|
/** Flag to configure component as mandatory */
|
|
65
60
|
required?: boolean;
|
|
66
61
|
/** Specify a callback triggered on change */
|
|
@@ -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
|
|
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 g from"../__internal__/utils/is-navigation-key.js";import y from"../../../__internal__/utils/logger/index.js";import{useStableCallback as h}from"../../../hooks/__internal__/useStableCallback/useStableCallback.js";import O from"../../../hooks/__internal__/useInputAccessibility/useInputAccessibility.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 w(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 j(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}let C=!1;const x=p(f),L=n.forwardRef(((p,_)=>{var{"aria-label":L,"aria-labelledby":S,value:P,defaultValue:k,id:D,name:A,label:E,children:B,onOpen:F,onChange:M,onFilterChange:V,onClick:I,onKeyDown:T,onFocus:q,onBlur:H,openOnFocus:W,noResultsMessage:K,listActionButton:R,listMaxHeight:U,onListAction:z,isLoading:G,disabled:J,readOnly:N,onListScrollBottom:Q,tableHeader:X,multiColumn:Y,"data-element":Z,"data-role":$,tooltipPosition:ee,listPlacement:te="bottom",flipEnabled:ne=!0,enableVirtualScroll:re,virtualScrollOverscan:oe,disableDefaultFiltering:le=!1,required:ie,listWidth:ae}=p,se=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","defaultValue","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[ce,ue]=r(""),de=o(d()),pe=o(null),me=o(null),fe=o(void 0!==P),be=o(!1),ve=o(!1),ge=o(!1),[ye,he]=r(),[Oe,_e]=r(!1),[we,je]=r(""),[Ce,xe]=r(P||k||""),Le=o(P),[Se,Pe]=r(""),[ke,De]=r(""),Ae=o(D||d()),{labelId:Ee}=O({id:Ae.current,label:E}),Be=o(null),Fe=o(!1);!C&&(!fe||!M&&k)&&(C=!0,y.deprecate("Uncontrolled behaviour in `Filterable Select` is deprecated and support will soon be removed. Please make sure all your inputs are controlled."));const Me=l(((e,t)=>({target:j(w({},A&&{name:A},D&&{id:D}),{value:e}),selectionConfirmed:t})),[A,D]),Ve=l(((e,t)=>{M&&M(Me(e,t))}),[M,Me]),Ie=l(((e,t)=>{xe((r=>{var o;const l=e.trimStart(),i=(a=l,s=B,n.Children.toArray(s).find((e=>{const{text:t}=e.props;return-1!==(null==t?void 0:t.toLowerCase().indexOf(null==a?void 0:a.toLowerCase()))})));var a,s;const c=t&&!e.length;return!i||c||i.props.disabled?(je(e),Ve("",!1),""):(l.length&&Ve(i.props.value,!1),t?(je(e),i.props.value):(l.length&&(null===(o=i.props.text)||void 0===o?void 0:o.toLowerCase().startsWith(l.toLowerCase()))?je(i.props.text):je(e),fe.current?r:(Pe(i.props.value),i.props.value)))}))}),[B,Ve]),Te=l(((e,t=!1)=>{var r;const o=n.Children.toArray(B).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==ke?void 0:ke.toLowerCase().trim())))&&je(o.props.text):je(ke||"")}),[B,ke]),qe=l((e=>{const t=e.target.value,{inputType:n}=e.nativeEvent;Ie(t,"deleteContentBackward"===n||"deleteContentForward"===n||"delete"===n),De(t),_e(!0)}),[Ie]),He=l((e=>{De((t=>(null==t?void 0:t.length)===(null==we?void 0:we.length)-1&&e===we.slice(-1)?we:t))}),[we]),We=l((e=>{const{key:t}=e;T&&T(e),N||(!e.defaultPrevented&&g(t)&&(e.preventDefault(),_e(!0)),He(t))}),[He,T,N]),Ke=fe.current?P:Ce,Re=l((e=>{const t=pe.current&&!pe.current.contains(e.target),n=me.current&&!me.current.contains(e.target);be.current=!1,t&&n&&(Te(Ke,!0),_e(!1))}),[Te,Ke]);i((()=>{a(fe.current===(void 0!==P),"Input elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component"),a(!fe.current||fe.current&&M,"onChange prop required when using a controlled input element"),fe.current?(xe((e=>(P&&e!==P&&Te(P),P))),Pe(P)):(we!==Ce&&Te(Ce),Se!==Ce&&Pe(Ce))}),[P,M,B]);const Ue=h(F);i((()=>{Oe?Ue&&Ue():De("")}),[Ue,Oe]),i((()=>{const e=void 0!==R;a(!e||e&&z,"onListAction prop required when using listActionButton prop")}),[R,z]);const ze=o(!0);i((()=>{ze.current&&Te(Ce),fe.current&&("object"==typeof P&&"object"==typeof Le.current?v(P,Le.current)||(Te(P),Le.current=P):Te(P))}),[P,B]);const Ge=h(V);i((()=>{Ge&&!ze.current&&Ge(ke)}),[Ge,ke]),i((()=>{ze.current=!1}),[]),i((()=>{const e="click";return window.addEventListener(e,Re),function(){window.removeEventListener(e,Re)}}),[Re]),i((()=>{const e=null==ke?void 0:ke.trimStart(),t=null==we?void 0:we.toLowerCase().startsWith(e.toLowerCase());!J&&!N&&ye&&e.length&&(null==we?void 0:we.length)>e.length&&t&&(ye.selectionStart=e.length)}),[we,ke,ye,J,N]);const Je=l((e=>{const{id:t,text:n,value:r,selectionType:o,selectionConfirmed:l}=e;fe.current||(xe(r),Pe(r)),je(n),Ve(r,!!l),ue(t),"navigationKey"!==o&&(Fe.current=!!W,_e(!1),null==ye||ye.focus(),null==ye||ye.select(),Fe.current=!1)}),[ye,Ve,W]),Ne=l((()=>{_e(!1),Te(Ce,!0)}),[Ce,Te]);function Qe(e){be.current=!0,"input"===e.target.dataset.element&&(ge.current=!0)}i((()=>()=>{Be.current&&clearTimeout(Be.current)}),[]);const Xe=l((e=>{e&&(he(e),_&&("function"==typeof _?_(e):_.current=e))}),[_]);let Ye;switch(te){case"top":Ye="top-end";break;case"bottom":Ye="bottom-end";break;default:Ye=te}const Ze={ref:me,id:de.current,labelId:Ee,anchorElement:(null==ye?void 0:ye.parentElement)||void 0,onSelect:Je,onSelectListClose:Ne,onMouseDown:function(){be.current=!0},filterText:ke.trim(),highlightedValue:Se,noResultsMessage:K,listActionButton:R,listMaxHeight:U,onListAction:function(){_e(!1),null==z||z()},isLoading:G,onListScrollBottom:Q,tableHeader:X,multiColumn:Y,listPlacement:void 0!==ae?Ye:te,flipEnabled:ne,isOpen:Oe,enableVirtualScroll:re,virtualScrollOverscan:oe,listWidth:ae},$e=e(le?f:x,j(w({},Ze),{children:B})),et=s(se);return t(m,j(w({hasTextCursor:!0,readOnly:N,disabled:J,"data-component":"filterable-select","data-role":$,"data-element":Z,isOpen:Oe},et),{children:[e("div",{ref:pe,children:e(u,w({ref:Xe,activeDescendantId:ce,ariaLabel:L,ariaLabelledby:S,labelId:E?Ee:void 0,"aria-controls":de.current,isOpen:Oe,hasTextCursor:!0},j(w({id:Ae.current,name:A,label:E,disabled:J,readOnly:N,selectedValue:Ce,formattedValue:we,onClick:function(e){be.current=!1,I&&I(e),_e(!0)},iconOnClick:function(e){be.current=!1,I&&I(e),_e((e=>!e))},iconOnMouseDown:Qe,onFocus:function(e){const t=()=>null==q?void 0:q(e);if(W){if(Be.current&&clearTimeout(Be.current),Fe.current)return;Be.current=setTimeout((()=>{_e((e=>!(!e&&(q&&!ve.current&&(t(),ve.current=!0),be.current&&!ge.current))))}))}else q&&!ve.current&&(t(),ve.current=!0)},onBlur:function(e){ge.current=!1,be.current||(ve.current=!1,H&&H(e))},onKeyDown:We,onChange:qe,onMouseDown:Qe,tooltipPosition:ee,required:ie},c(se)),{"data-component":void 0})))}),$e]}))}));export{L as FilterableSelect,L as default};
|
|
@@ -52,11 +52,6 @@ export interface MultiSelectProps extends Omit<FormInputPropTypes, "defaultValue
|
|
|
52
52
|
* Higher values make for smoother scrolling but may impact performance.
|
|
53
53
|
* Only used if the `enableVirtualScroll` prop is set. */
|
|
54
54
|
virtualScrollOverscan?: number;
|
|
55
|
-
/**
|
|
56
|
-
* [Legacy] Flag to configure component as optional.
|
|
57
|
-
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
58
|
-
*/
|
|
59
|
-
isOptional?: boolean;
|
|
60
55
|
/** Specify a callback triggered on change */
|
|
61
56
|
onChange?: (ev: CustomSelectChangeEvent | React.ChangeEvent<HTMLInputElement>) => void;
|
|
62
57
|
/** Override the default width of the list element. Number passed is converted into pixel value */
|