carbon-react 158.29.0 → 158.31.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__/form-field/form-field.component.js +1 -1
- package/esm/components/box/box.component.d.ts +2 -0
- package/esm/components/box/box.component.js +1 -1
- package/esm/components/flat-table/flat-table-header/flat-table-header.component.js +1 -1
- package/esm/components/flat-table/sort/sort.component.d.ts +7 -2
- package/esm/components/flat-table/sort/sort.component.js +1 -1
- package/esm/components/heading/heading.style.d.ts +1 -1
- package/esm/components/loader/__next__/loader.style.d.ts +1 -1
- package/esm/components/loader-spinner/loader-spinner.style.d.ts +1 -1
- package/esm/components/loader-star/loader-star.style.d.ts +1 -1
- package/esm/components/tabs/__next__/tabs.component.d.ts +1 -1
- package/esm/components/tabs/__next__/tabs.component.js +1 -1
- package/esm/components/tabs/__next__/tabs.context.js +1 -1
- package/esm/components/tabs/__next__/tabs.style.d.ts +11 -8
- package/esm/components/tabs/__next__/tabs.style.js +1 -1
- package/esm/components/tabs/__next__/tabs.types.d.ts +12 -0
- package/esm/components/tabs/index.d.ts +2 -1
- package/esm/components/tabs/tab/tab.component.d.ts +62 -17
- package/esm/components/tabs/tab/tab.component.js +1 -1
- package/esm/components/tabs/tabs.component.d.ts +16 -11
- package/esm/components/tabs/tabs.component.js +1 -1
- package/esm/components/typography/typography.component.d.ts +5 -1
- package/esm/components/typography/typography.component.js +1 -1
- package/esm/index.js +1 -1
- package/esm/locales/en-gb.js +1 -1
- package/esm/locales/locale.d.ts +8 -1
- package/lib/__internal__/form-field/form-field.component.js +1 -1
- package/lib/components/box/box.component.d.ts +2 -0
- package/lib/components/box/box.component.js +1 -1
- package/lib/components/flat-table/flat-table-header/flat-table-header.component.js +1 -1
- package/lib/components/flat-table/sort/sort.component.d.ts +7 -2
- package/lib/components/flat-table/sort/sort.component.js +1 -1
- package/lib/components/heading/heading.style.d.ts +1 -1
- package/lib/components/loader/__next__/loader.style.d.ts +1 -1
- package/lib/components/loader-spinner/loader-spinner.style.d.ts +1 -1
- package/lib/components/loader-star/loader-star.style.d.ts +1 -1
- package/lib/components/tabs/__next__/tabs.component.d.ts +1 -1
- package/lib/components/tabs/__next__/tabs.component.js +1 -1
- package/lib/components/tabs/__next__/tabs.context.js +1 -1
- package/lib/components/tabs/__next__/tabs.style.d.ts +11 -8
- package/lib/components/tabs/__next__/tabs.style.js +1 -1
- package/lib/components/tabs/__next__/tabs.types.d.ts +12 -0
- package/lib/components/tabs/index.d.ts +2 -1
- package/lib/components/tabs/tab/tab.component.d.ts +62 -17
- package/lib/components/tabs/tab/tab.component.js +1 -1
- package/lib/components/tabs/tabs.component.d.ts +16 -11
- package/lib/components/tabs/tabs.component.js +1 -1
- package/lib/components/typography/typography.component.d.ts +5 -1
- package/lib/components/typography/typography.component.js +1 -1
- package/lib/index.js +1 -1
- package/lib/locales/en-gb.js +1 -1
- package/lib/locales/locale.d.ts +8 -1
- package/package.json +1 -1
- package/esm/components/tabs/__internal__/tab-title/index.d.ts +0 -2
- package/esm/components/tabs/__internal__/tab-title/index.js +0 -1
- package/esm/components/tabs/__internal__/tab-title/tab-title.component.d.ts +0 -34
- package/esm/components/tabs/__internal__/tab-title/tab-title.component.js +0 -1
- package/esm/components/tabs/__internal__/tab-title/tab-title.context.d.ts +0 -6
- package/esm/components/tabs/__internal__/tab-title/tab-title.context.js +0 -1
- package/esm/components/tabs/__internal__/tab-title/tab-title.style.d.ts +0 -27
- package/esm/components/tabs/__internal__/tab-title/tab-title.style.js +0 -1
- package/esm/components/tabs/__internal__/tabs-header/index.d.ts +0 -2
- package/esm/components/tabs/__internal__/tabs-header/index.js +0 -1
- package/esm/components/tabs/__internal__/tabs-header/tabs-header.component.d.ts +0 -13
- package/esm/components/tabs/__internal__/tabs-header/tabs-header.component.js +0 -1
- package/esm/components/tabs/__internal__/tabs-header/tabs-header.style.d.ts +0 -30
- package/esm/components/tabs/__internal__/tabs-header/tabs-header.style.js +0 -1
- package/esm/components/tabs/tab/__internal__/tab.context.d.ts +0 -8
- package/esm/components/tabs/tab/__internal__/tab.context.js +0 -1
- package/esm/components/tabs/tab/tab.style.d.ts +0 -11
- package/esm/components/tabs/tab/tab.style.js +0 -1
- package/esm/components/tabs/tabs.style.d.ts +0 -8
- package/esm/components/tabs/tabs.style.js +0 -1
- package/lib/components/tabs/__internal__/tab-title/index.d.ts +0 -2
- package/lib/components/tabs/__internal__/tab-title/index.js +0 -1
- package/lib/components/tabs/__internal__/tab-title/package.json +0 -6
- package/lib/components/tabs/__internal__/tab-title/tab-title.component.d.ts +0 -34
- package/lib/components/tabs/__internal__/tab-title/tab-title.component.js +0 -1
- package/lib/components/tabs/__internal__/tab-title/tab-title.context.d.ts +0 -6
- package/lib/components/tabs/__internal__/tab-title/tab-title.context.js +0 -1
- package/lib/components/tabs/__internal__/tab-title/tab-title.style.d.ts +0 -27
- package/lib/components/tabs/__internal__/tab-title/tab-title.style.js +0 -1
- package/lib/components/tabs/__internal__/tabs-header/index.d.ts +0 -2
- package/lib/components/tabs/__internal__/tabs-header/index.js +0 -1
- package/lib/components/tabs/__internal__/tabs-header/package.json +0 -6
- package/lib/components/tabs/__internal__/tabs-header/tabs-header.component.d.ts +0 -13
- package/lib/components/tabs/__internal__/tabs-header/tabs-header.component.js +0 -1
- package/lib/components/tabs/__internal__/tabs-header/tabs-header.style.d.ts +0 -30
- package/lib/components/tabs/__internal__/tabs-header/tabs-header.style.js +0 -1
- package/lib/components/tabs/tab/__internal__/tab.context.d.ts +0 -8
- package/lib/components/tabs/tab/__internal__/tab.context.js +0 -1
- package/lib/components/tabs/tab/tab.style.d.ts +0 -11
- package/lib/components/tabs/tab/tab.style.js +0 -1
- package/lib/components/tabs/tabs.style.d.ts +0 -8
- package/lib/components/tabs/tabs.style.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useMemo as n,useContext as r,useRef as i,useLayoutEffect as l,useEffect as o}from"react";import a from"invariant";import s,{FieldLineStyle as d}from"./form-field.style.js";import p from"../label/label.component.js";import{FieldHelp as c}from"../field-help/field-help.component.js";import b from"../utils/helpers/tags/tags.js";import f from"../../hooks/__internal__/useIsAboveBreakpoint/useIsAboveBreakpoint.js";import"../../style/utils/filter-styled-system-padding-props.js";import
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useMemo as n,useContext as r,useRef as i,useLayoutEffect as l,useEffect as o}from"react";import a from"invariant";import s,{FieldLineStyle as d}from"./form-field.style.js";import p from"../label/label.component.js";import{FieldHelp as c}from"../field-help/field-help.component.js";import b from"../utils/helpers/tags/tags.js";import f from"../../hooks/__internal__/useIsAboveBreakpoint/useIsAboveBreakpoint.js";import"../../style/utils/filter-styled-system-padding-props.js";import u from"../../style/utils/filter-styled-system-margin-props.js";import{TabsContext as m}from"../../components/tabs/__next__/tabs.context.js";import{TabContext as y}from"../../components/tabs/__next__/tab.context.js";function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const g=g=>{var{maxWidth:I,children:j,"data-component":h,disabled:v,loading:w,fieldHelp:P,fieldHelpInline:_,error:x,warning:H,info:k,tooltipId:S,fieldHelpId:W,label:A,labelId:R,labelAlign:q,labelHelp:B,labelHelpIcon:D,labelInline:E,labelSpacing:F=2,labelWidth:V,labelAs:L,id:N,reverse:U,useValidationIcon:$,adaptiveLabelBreakpoint:z,isRequired:C,validationIconId:G,validationRedesignOptIn:J}=g,K=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(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)&&(i[n]=e[n])}return i}(g,["maxWidth","children","data-component","disabled","loading","fieldHelp","fieldHelpInline","error","warning","info","tooltipId","fieldHelpId","label","labelId","labelAlign","labelHelp","labelHelpIcon","labelInline","labelSpacing","labelWidth","labelAs","id","reverse","useValidationIcon","adaptiveLabelBreakpoint","isRequired","validationIconId","validationRedesignOptIn"]);const M=n((()=>{const e={error:!!x,warning:!!H,info:!!k};if(v&&!w)return Object.keys(e).find((t=>e[t]))}),[x,H,k,v,w]);a(void 0===M,`Prop \`${M}\` cannot be used in conjunction with \`disabled\`. Use \`readOnly\` if you require users to see validations with a non-interactive field`);const Q=f(z);let T=E;z&&(T=Q);const{setErrors:X,setWarnings:Y,setInfos:Z}=r(m),{tabId:ee}=r(y),te=u(K),ne=i(!1);l((()=>(ne.current=!0,()=>{ne.current=!1})),[]),o((()=>(X&&X(N,ee||"",x||!1),Y&&Y(N,ee||"",H||!1),Z&&Z(N,ee||"",k||!1),()=>{ne.current||(X&&X(N,ee||"",!1),Y&&Y(N,ee||"",!1),Z&&Z(N,ee||"",!1))})),[N,X,Y,x,H,k,ee,Z]);const re=P?t(c,{labelInline:T,labelWidth:V,id:W,children:P}):null;return e(s,(ie=function(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){O(e,t,n[t])}))}return e}({},b(h,K),te),le=null!=(le={children:[e(d,{"data-role":"field-line",inline:T,maxWidth:I,children:[U&&j,A&&t(p,{labelId:R,align:q,disabled:v,error:!J&&x,warning:!J&&H,info:!J&&k,help:B,tooltipId:S,htmlFor:N,helpIcon:D,inline:T,width:V,useValidationIcon:$,pr:U?void 0:F,pl:U?F:void 0,isRequired:C,validationIconId:G,as:L,children:A}),_&&re,!U&&j]}),!_&&re]})?le:{},Object.getOwnPropertyDescriptors?Object.defineProperties(ie,Object.getOwnPropertyDescriptors(le)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(le)).forEach((function(e){Object.defineProperty(ie,e,Object.getOwnPropertyDescriptor(le,e))})),ie));var ie,le};g.displayName="FormField";export{g as default};
|
|
@@ -52,6 +52,8 @@ export interface BoxProps extends FlexboxProps, Omit<GridProps, "gridGap" | "gri
|
|
|
52
52
|
opacity?: string | number;
|
|
53
53
|
/** Set the container to be hidden from screen readers */
|
|
54
54
|
"aria-hidden"?: "true" | "false";
|
|
55
|
+
/** Make the container an aria-live region */
|
|
56
|
+
"aria-live"?: "off" | "assertive" | "polite";
|
|
55
57
|
/** @private @internal @ignore */
|
|
56
58
|
"data-component"?: string;
|
|
57
59
|
/** @private @internal @ignore */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import e from"react";import t from"../../style/utils/filter-styled-system-padding-props.js";import o from"../../style/utils/filter-styled-system-margin-props.js";import
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import e from"react";import t from"../../style/utils/filter-styled-system-padding-props.js";import o from"../../style/utils/filter-styled-system-margin-props.js";import i from"../../style/utils/filter-styled-system-layout-props.js";import n from"../../style/utils/filter-styled-system-flexbox-props.js";import a from"../../style/utils/filter-styled-system-grid-props.js";import l from"./box.style.js";import s from"../../__internal__/utils/helpers/tags/tags.js";function p(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}const c=e.forwardRef(((e,c)=>{var{"data-component":d,tabIndex:f,as:b,id:y,role:u,overflowWrap:m,scrollVariant:g,boxSizing:O,gap:h,columnGap:j,rowGap:w,className:x,children:v,bg:P,backgroundColor:S,boxShadow:k,borderRadius:G,color:$,opacity:D,height:I,width:N,hidden:R,"aria-hidden":_,"aria-live":z}=e,C=function(r,e){if(null==r)return{};var t,o,i=function(r,e){if(null==r)return{};var t,o,i={},n=Object.keys(r);for(o=0;o<n.length;o++)t=n[o],e.indexOf(t)>=0||(i[t]=r[t]);return i}(r,e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);for(o=0;o<n.length;o++)t=n[o],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}(e,["data-component","tabIndex","as","id","role","overflowWrap","scrollVariant","boxSizing","gap","columnGap","rowGap","className","children","bg","backgroundColor","boxShadow","borderRadius","color","opacity","height","width","hidden","aria-hidden","aria-live"]);let E="";"number"==typeof N?E=N<=1?`${(100*N).toFixed(0)}%`:`${N}px`:"string"==typeof N&&(E=N);let V="";"number"==typeof I?V=I<=1?`${(100*I).toFixed(0)}%`:`${I}px`:"string"==typeof I&&(V=I);const W={color:$,opacity:D,width:E,height:V};return r(l,(F=function(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})))),o.forEach((function(e){p(r,e,t[e])}))}return r}({as:b,id:y,role:u,overflowWrap:m,scrollVariant:g,boxSizing:O,gap:h,columnGap:j,rowGap:w,className:x,ref:c,bg:P,backgroundColor:S,boxShadow:k,$borderRadius:G,"aria-hidden":_,hidden:R,"aria-live":z},s(d,C),o(C),t(C),n(C),a(C),i(C)),B=null!=(B={cssProps:W,tabIndex:f,children:v})?B:{},Object.getOwnPropertyDescriptors?Object.defineProperties(F,Object.getOwnPropertyDescriptors(B)):function(r){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e.push.apply(e,t)}return e}(Object(B)).forEach((function(r){Object.defineProperty(F,r,Object.getOwnPropertyDescriptor(B,r))})),F));var F,B}));c.displayName="Box";export{c as Box,c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useRef as t}from"react";import r from"./flat-table-header.style.js";import{useStrictFlatTableContext as n}from"../__internal__/strict-flat-table.context.js";import o from"../../../__internal__/utils/helpers/guid/index.js";import l from"../__internal__/use-table-cell.js";function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(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){a(e,t,r[t])}))}return e}function c(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 p=a=>{var{align:p="left",children:
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useRef as t}from"react";import r from"./flat-table-header.style.js";import{useStrictFlatTableContext as n}from"../__internal__/strict-flat-table.context.js";import o from"../../../__internal__/utils/helpers/guid/index.js";import l from"../__internal__/use-table-cell.js";function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(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){a(e,t,r[t])}))}return e}function c(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 p=a=>{var{align:p="left",children:s,colspan:u,rowspan:f,width:d,py:b,px:m,id:y,"data-element":O,"data-role":j}=a,h=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},l=Object.keys(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(a,["align","children","colspan","rowspan","width","py","px","id","data-element","data-role"]);const g=t(null),P=t(y||o()),{colorTheme:v}=n(),{leftPosition:w,rightPosition:S,makeCellSticky:_}=l(P.current);return e(r,c(i(c(i({ref:g,leftPosition:w,rightPosition:S,makeCellSticky:_,className:_?"isSticky":void 0,align:p,colorTheme:v},void 0!==u&&{colSpan:Number(u)},void 0!==f&&{rowSpan:Number(f)}),{colWidth:d,py:b,px:m}),h),{"data-component":"flat-table-header","data-element":O||"flat-table-header","data-role":j,id:P.current,"aria-sort":(()=>{var e;const t=null===(e=g.current)||void 0===e?void 0:e.querySelector("[data-component='sort']");if(t)return t.getAttribute("data-sort-type")})(),children:e("div",{"data-role":"flat-table-header-content",children:s})}))};p.displayName="FlatTableHeader";export{p as FlatTableHeader,p as default};
|
|
@@ -7,8 +7,13 @@ export interface SortProps extends TagProps {
|
|
|
7
7
|
onClick?: () => void;
|
|
8
8
|
/** Sets the text content of the component */
|
|
9
9
|
children?: string;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Sets the accessible name of the component
|
|
12
|
+
* @deprecated this prop has been deprecated in favour of using `aria-live` regions
|
|
13
|
+
* */
|
|
11
14
|
accessibleName?: string;
|
|
15
|
+
/** Sets the aria-roledescription of the component */
|
|
16
|
+
"aria-roledescription"?: string;
|
|
12
17
|
}
|
|
13
|
-
export declare const Sort: ({ children, onClick, sortType, accessibleName, "data-element": dataElement, "data-role": dataRole, }: SortProps) => React.JSX.Element;
|
|
18
|
+
export declare const Sort: ({ children, onClick, sortType, accessibleName, "data-element": dataElement, "data-role": dataRole, "aria-roledescription": ariaRoleDescription, }: SortProps) => React.JSX.Element;
|
|
14
19
|
export default Sort;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,
|
|
1
|
+
import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useRef as r}from"react";import{useStrictFlatTableContext as t}from"../__internal__/strict-flat-table.context.js";import n from"../../../__internal__/utils/helpers/events/events.js";import a from"../../../__internal__/utils/helpers/guid/index.js";import i from"../../../hooks/__internal__/useLocale/useLocale.js";import s from"../../icon/icon.component.js";import l from"./sort.style.js";import c from"../../../__internal__/utils/logger/index.js";let d=!1;const p=({children:p,onClick:m,sortType:_,accessibleName:u,"data-element":f,"data-role":h,"aria-roledescription":v})=>{var g,j;u&&!d&&(c.deprecate("The `accessibleName` prop has been deprecated in favour of using `aria-live` regions. Please use an `aria-live` region to announce changes in sort order to assistive technologies."),d=!0);const y=r(a()),b=i(),{colorTheme:x}=t();return e(l,{"aria-describedby":y.current,colorTheme:x,"data-component":"sort","data-element":f,"data-role":h,onClick:m,onKeyDown:e=>n.isEnterOrSpaceKey(e)?(e.preventDefault(),null==m?void 0:m()):null,"data-sort-type":_||"none","aria-roledescription":v||(null===(j=b.sort)||void 0===j||null===(g=j.ariaRoleDescription)||void 0===g?void 0:g.call(j)),children:[o("span",{children:p}),_?o(s,{"aria-hidden":!0,"data-element":"sort-icon",type:"ascending"===_?"sort_up":"sort_down"}):o("span",{"data-role":"sort-placeholder"})]})};export{p as Sort,p as default};
|
|
@@ -13,7 +13,7 @@ type StyledHeadingTitleProps = {
|
|
|
13
13
|
withMargin?: boolean;
|
|
14
14
|
};
|
|
15
15
|
declare const StyledHeadingTitle: import("styled-components").StyledComponent<{
|
|
16
|
-
({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordBreak, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, screenReaderOnly, isDisabled, "aria-hidden": ariaHidden, className, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
|
|
16
|
+
({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordBreak, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, screenReaderOnly, isDisabled, "aria-live": ariaLive, role, "aria-hidden": ariaHidden, className, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
|
|
17
17
|
displayName: string;
|
|
18
18
|
}, any, StyledHeadingTitleProps, never>;
|
|
19
19
|
declare const StyledHeadingPills: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -35,7 +35,7 @@ type LabelProps = {
|
|
|
35
35
|
};
|
|
36
36
|
export declare const StyledStarLoaderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
37
37
|
export declare const StyledLoaderLabel: import("styled-components").StyledComponent<{
|
|
38
|
-
({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordBreak, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, screenReaderOnly, isDisabled, "aria-hidden": ariaHidden, className, ...rest }: import("../../typography").TypographyProps): import("react").JSX.Element;
|
|
38
|
+
({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordBreak, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, screenReaderOnly, isDisabled, "aria-live": ariaLive, role, "aria-hidden": ariaHidden, className, ...rest }: import("../../typography").TypographyProps): import("react").JSX.Element;
|
|
39
39
|
displayName: string;
|
|
40
40
|
}, any, LabelProps, never>;
|
|
41
41
|
type RingLoaderWrapperProps = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LoaderSpinnerProps } from "./loader-spinner.component";
|
|
2
2
|
export declare const StyledSpinnerWrapper: import("styled-components").StyledComponent<"div", any, Pick<LoaderSpinnerProps, "size">, never>;
|
|
3
3
|
export declare const StyledLabel: import("styled-components").StyledComponent<{
|
|
4
|
-
({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordBreak, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, screenReaderOnly, isDisabled, "aria-hidden": ariaHidden, className, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
|
|
4
|
+
({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordBreak, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, screenReaderOnly, isDisabled, "aria-live": ariaLive, role, "aria-hidden": ariaHidden, className, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
}, any, Required<Pick<LoaderSpinnerProps, "size">>, never>;
|
|
7
7
|
interface StyledSpinnerCircleSvgProps extends Omit<LoaderSpinnerProps, "showSpinnerLabel"> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LoaderStarProps } from "./loader-star.component";
|
|
2
2
|
export declare const StyledLoaderStarWrapper: import("styled-components").StyledComponent<"div", any, LoaderStarProps, never>;
|
|
3
3
|
export declare const StyledLabel: import("styled-components").StyledComponent<{
|
|
4
|
-
({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordBreak, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, screenReaderOnly, isDisabled, "aria-hidden": ariaHidden, className, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
|
|
4
|
+
({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordBreak, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, screenReaderOnly, isDisabled, "aria-live": ariaLive, role, "aria-hidden": ariaHidden, className, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
}, any, {}, never>;
|
|
7
7
|
export declare const StyledStars: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TabsHandle, TabListProps, TabPanelProps, TabProps, TabsProps } from "./tabs.types";
|
|
3
3
|
export declare const TabPanel: ({ children, id, tabId, ...rest }: TabPanelProps) => React.JSX.Element;
|
|
4
|
-
export declare const Tab: ({ controls, error, id, label, leftSlot, rightSlot, warning, info, ...rest }: TabProps) => React.JSX.Element;
|
|
4
|
+
export declare const Tab: ({ controls, error, id, label, leftSlot, rightSlot, warning, info, hasCustomLayout, headerWidth, href, ...rest }: TabProps) => React.JSX.Element;
|
|
5
5
|
export declare const TabList: React.ForwardRefExoticComponent<TabListProps & React.RefAttributes<TabsHandle>>;
|
|
6
6
|
export declare const Tabs: ({ children, labelledBy, orientation, selectedTabId, size, ...rest }: TabsProps) => React.JSX.Element;
|
|
7
7
|
export default Tabs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,
|
|
1
|
+
import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{forwardRef as n,useRef as o,useImperativeHandle as i,useCallback as a,useEffect as l,useState as c}from"react";import{TabsProvider as s,useTabs as b}from"./tabs.context.js";import{StyledTabs as d,StyledTabListWrapper as u,StyledTabList as f,StyledTabPanel as h,StyledScrollButton as p,StyledScrollButtonPlaceholder as g,StyledTab as y,Spacer as v}from"./tabs.style.js";import m from"../../../__internal__/utils/logger/index.js";import O from"../../../hooks/__internal__/useResizeObserver/useResizeObserver.js";import j from"../../../hooks/__internal__/useLocale/useLocale.js";import _ from"../../icon/icon.component.js";import{TabProvider as w}from"./tab.context.js";import x from"../../../hooks/__internal__/usePrevious/index.js";import k from"../../../__internal__/utils/helpers/guid/index.js";import I from"../../../__internal__/utils/helpers/tags/tags.js";import S from"../../../__internal__/utils/helpers/extract-text/index.js";function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function L(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){T(e,t,r[t])}))}return e}function $(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function P(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}const z=t=>{var{children:r,id:n,tabId:o}=t,i=P(t,["children","id","tabId"]);const{activeTab:a}=b();return e(w,{tabId:o,visible:o===a,children:e(h,$(L({id:n,role:"tabpanel","aria-labelledby":o},I("tab-panel",i)),{children:r}))})};let A=!1;const C=t=>{var{controls:n,error:o=!1,id:i,label:a,leftSlot:s,rightSlot:d,warning:u=!1,info:f=!1,hasCustomLayout:h,headerWidth:p,href:g}=t,v=P(t,["controls","error","id","label","leftSlot","rightSlot","warning","info","hasCustomLayout","headerWidth","href"]);const O=j(),[x,k]=c(o),[T,z]=c(u),[C,W]=c(f),{activeTab:D,focusIndex:E,orientation:N,setActiveTab:R,setCurrentTabId:B,setFocusIndex:q,size:F,errors:U,warnings:G,infos:H}=b(),K=D===i;l((()=>{K&&B(i)}),[i,K,B]),!s&&!d||"string"==typeof a||A||(m.warn("[WARNING] Using `leftSlot` and/or `rightSlot` is not supported when `label` is not a string. Please use `leftSlot` and/or `rightSlot` alongside a string `label`, or use the `label` prop exclusively."),A=!0),l((()=>{if(E===i){const e=document.getElementById(i);null==e||e.focus()}}),[E,i,B]),l((()=>{let e=U[i],t=G[i],r=H[i];if(o&&!e&&(e={static:o}),u&&!t&&(t={static:u}),f&&!r&&(r={static:f}),!e)return void k(!1);const n=Object.keys(e).map((t=>e[t])).filter((e=>!1!==e)),a=o||!!n.length;if(k(a),!t)return void z(!1);const l=Object.keys(t).map((e=>t[e])).filter((e=>!1!==e)),c=u||!!l.length;if(z(c),!r)return void W(!1);const s=Object.keys(r).map((e=>r[e])).filter((e=>!1!==e)),b=f||!!s.length;W(b)}),[o,i,U,G,u,H,f]);const J=()=>{const t=S(a);if(x||T||C){if(x)return e(_,{"data-role":"icon-error",type:"error",ariaLabel:O.tabs.error(t),color:"#db004e"});if(T)return e(_,{"data-role":"icon-warning",type:"warning",ariaLabel:O.tabs.warning(t),color:"#d64309"});if(C)return e(_,{"data-role":"icon-info",type:"info",ariaLabel:O.tabs.info(t),color:"#0060a7ff"})}return null};return e(w,{tabId:i,visible:!0,children:e(y,$(L($(L({activeTab:D===i,className:D===i?"active-tab":"","aria-controls":n,"aria-selected":K?"true":"false",error:x,warning:T,info:C,id:i,onClick:()=>{R(i),q(i)},$orientation:N,role:"tab",$size:F,type:g?void 0:"button",tabIndex:D===i?0:-1,$hasCustomLayout:h,$headerWidth:p},I("tab",v)),{"data-tabid":i,as:g?"a":void 0}),g&&{href:g,target:"_blank",style:{textDecoration:"none",display:"block",boxSizing:"border-box"}}),{children:r("span","string"==typeof a?{className:"tab-title-content-wrapper",children:[s,a,d,J()]}:{className:"tab-title-content-wrapper",children:[a,J()]})}))})},W=n(((n,s)=>{var{ariaLabel:d,children:h,onTabChange:y,headerWidth:m}=n,w=P(n,["ariaLabel","children","onTabChange","headerWidth"]);const S=o(null),{activeTab:T,focusIndex:z,orientation:A,selectedTabId:C,setFocusIndex:W,setActiveTab:D,size:E}=b(),N=o(k()),R=o(k()),B=o(k()),q=j();i(s,(()=>({focusTab:e=>{var t;const r=null===(t=S.current)||void 0===t?void 0:t.querySelector(`#${e}`);null==r||r.focus(),W(e),D(e)}})));const F=a((()=>{var e;const t=(null===(e=S.current)||void 0===e?void 0:e.querySelectorAll("[role='tab']"))||[];return Array.from(t).map((e=>e.id)).filter((e=>e))}),[]);l((()=>{if(C)D(C);else if(!T){const e=F()[0];D(e)}}),[T,F,C,D]);const U=x(T);l((()=>{U&&U!==T&&(null==y||y(T))}),[T,y,U]);const G=a((e=>{const t=F(),r=t.indexOf(z||T),n=t.length-1;if(-1===r)return;let o=r;switch(e.key){case"Home":o=0;break;case"End":o=n;break;case"ArrowRight":o=(r+1)%t.length;break;case"ArrowLeft":o=(r-1+t.length)%t.length;break;case"ArrowUp":"vertical"===A&&(o=(r-1+t.length)%t.length);break;case"ArrowDown":"vertical"===A&&(o=(r+1)%t.length);break;case"Enter":case" ":return void D(T);case"Tab":return void W(T);default:return}W(t[o])}),[T,z,F,A,D,W]),[H,K]=c(!1),[J,M]=c(!1),[Q,V]=c(!1),X=a((()=>{if(S.current){const e=S.current.scrollWidth-S.current.clientWidth-20;K(e>0),M(S.current.scrollLeft>=20),V(S.current.scrollLeft<=e)}}),[]);O(S,(()=>{X()})),l((()=>{S.current&&X()}),[X]);const Y=e=>{S.current&&("left"===e?S.current.scrollLeft-=200:S.current.scrollLeft+=200,X())};return e(t,{children:r(u,{$headerWidth:m,"data-role":"tab-list-wrapper",children:["vertical"!==A&&H?J?e(p,{"data-role":"tab-navigation-button-left",id:`tab-navigation-button-left-${N.current}`,onClick:()=>Y("left"),$size:E,tabIndex:-1,title:null===(Z=(ee=q.tabs).scrollLeftText)||void 0===Z?void 0:Z.call(ee),type:"button",children:e(_,{type:"chevron_left"})}):e(g,{$size:E}):null,r(f,$(L({"aria-label":d,id:`tablist-${B.current}`,onKeyDown:G,$orientation:A,ref:S,role:"tablist",tabIndex:-1},I("tab-list",w)),{children:[h,e(v,{})]})),(()=>{var t,r;return"vertical"!==A&&H?Q?e(p,{"data-role":"tab-navigation-button-right",id:`tab-navigation-button-right-${R.current}`,onClick:()=>Y("right"),$size:E,tabIndex:-1,title:null===(t=(r=q.tabs).scrollRightText)||void 0===t?void 0:t.call(r),type:"button",children:e(_,{type:"chevron_right"})}):e(g,{$size:E}):null})()]})});var Z,ee})),D=t=>{var{children:r,labelledBy:n="",orientation:i="horizontal",selectedTabId:a,size:l="medium"}=t,c=P(t,["children","labelledBy","orientation","selectedTabId","size"]);const b=o(k());return e(s,{labelledBy:n,orientation:i,selectedTabId:a,size:l,children:e(d,$(L({id:`tabs-container-${b.current}`,$orientation:i},I("tabs",c)),{children:r}))})};export{C as Tab,W as TabList,z as TabPanel,D as Tabs,D as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useContext as r,createContext as t,useState as n,useCallback as o}from"react";function
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useContext as r,createContext as t,useState as n,useCallback as o,useEffect as s}from"react";import i from"../../../hooks/__internal__/usePrevious/index.js";function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function c(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){a(e,r,t[r])}))}return e}const b=t({activeTab:"",currentTabId:"",focusIndex:"",isInTab:!1,labelledBy:"",orientation:"horizontal",selectedTabId:"",setActiveTab:()=>{},setFocusIndex:()=>{},setCurrentTabId:()=>{},setErrors:()=>{},setWarnings:()=>{},size:"medium",errors:{},warnings:{},infos:{},setInfos:()=>{}}),l=()=>r(b),u=({children:r,isInTab:t=!0,labelledBy:a,orientation:l,selectedTabId:u="",size:d})=>{const[f,I]=n(u),[m,T]=n(u),[y,p]=n(""),[v,g]=n({}),[O,j]=n({}),[x,h]=n({}),w=o(((e,r,t)=>{const n={[r]:{[e]:t}};g((o=>(o[r]||(o[r]={}),o[r][e]!==t?c({},o,n):o)))}),[]),P=o(((e,r,t)=>{const n={[r]:{[e]:t}};j((o=>(o[r]||(o[r]={}),o[r][e]!==t?c({},o,n):o)))}),[]),z=o(((e,r,t)=>{const n={[r]:{[e]:t}};h((o=>(o[r]||(o[r]={}),o[r][e]!==t?c({},o,n):o)))}),[]),_=i(u);return s((()=>{u&&u!==_&&(I(u),T(u))}),[u,_]),e(b.Provider,{value:{activeTab:f,currentTabId:m,focusIndex:y,isInTab:t,labelledBy:a,orientation:l,setActiveTab:I,setCurrentTabId:T,setFocusIndex:p,setErrors:w,setWarnings:P,size:d,errors:v,warnings:O,infos:x,setInfos:z},children:r})};export{b as TabsContext,u as TabsProvider,l as useTabs};
|
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
import { TabProps } from "./tabs.types";
|
|
2
2
|
interface StyledTabListProps {
|
|
3
|
-
orientation: "horizontal" | "vertical";
|
|
4
|
-
size: "medium" | "large";
|
|
3
|
+
$orientation: "horizontal" | "vertical";
|
|
5
4
|
}
|
|
6
5
|
export declare const StyledTabPanel: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
6
|
export declare const StyledTabList: import("styled-components").StyledComponent<"div", any, StyledTabListProps, never>;
|
|
8
|
-
export declare const StyledTabListWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
+
export declare const StyledTabListWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
8
|
+
$headerWidth?: string;
|
|
9
|
+
}, never>;
|
|
9
10
|
export declare const Spacer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
11
|
export declare const StyledScrollButton: import("styled-components").StyledComponent<"button", any, {
|
|
11
|
-
size: "medium" | "large";
|
|
12
|
+
$size: "medium" | "large";
|
|
12
13
|
}, never>;
|
|
13
14
|
export declare const StyledScrollButtonPlaceholder: import("styled-components").StyledComponent<"div", any, {
|
|
14
|
-
size: "medium" | "large";
|
|
15
|
+
$size: "medium" | "large";
|
|
15
16
|
}, never>;
|
|
16
17
|
interface StyledTabProps extends Omit<TabProps, "controls" | "index" | "label"> {
|
|
17
18
|
activeTab: boolean;
|
|
18
19
|
error?: string | boolean;
|
|
19
20
|
warning?: string | boolean;
|
|
20
|
-
orientation: "horizontal" | "vertical";
|
|
21
|
-
size: "medium" | "large";
|
|
21
|
+
$orientation: "horizontal" | "vertical";
|
|
22
|
+
$size: "medium" | "large";
|
|
23
|
+
$hasCustomLayout?: boolean;
|
|
24
|
+
$headerWidth?: string;
|
|
22
25
|
}
|
|
23
26
|
export declare const StyledTab: import("styled-components").StyledComponent<"button", any, StyledTabProps, never>;
|
|
24
27
|
export declare const StyledTabs: import("styled-components").StyledComponent<"div", any, {
|
|
25
|
-
orientation?: "horizontal" | "vertical";
|
|
28
|
+
$orientation?: "horizontal" | "vertical";
|
|
26
29
|
}, never>;
|
|
27
30
|
export declare const StyledTabProvider: import("styled-components").StyledComponent<"div", any, {
|
|
28
31
|
visible: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import o,{css as
|
|
1
|
+
import o,{css as t}from"styled-components";import i from"../../../style/utils/add-focus-styling.js";const e={medium:{fontSize:14,iconMinWidth:84,height:40,paddingX:16,paddingY:8,width:56},large:{fontSize:16,iconMinWidth:104,height:48,paddingX:24,paddingY:0,width:76}},d=o.div.withConfig({displayName:"tabs.style__StyledTabPanel",componentId:"sc-75b008c3-0"})(["padding:0 6px;"]),r=o.div.withConfig({displayName:"tabs.style__StyledTabList",componentId:"sc-75b008c3-1"})(["display:flex;"," width:100%;padding:6px;overflow-x:hidden;"],(({$orientation:o})=>t([""," ",""],"horizontal"===o&&t(["margin-bottom:8px;"]),"vertical"===o&&t(["flex-direction:column;flex-wrap:wrap;margin-right:8px;"])))),a=o.div.withConfig({displayName:"tabs.style__StyledTabListWrapper",componentId:"sc-75b008c3-2"})(["display:flex;z-index:6;",";"],(({$headerWidth:o})=>o&&t(["width:",";"],o))),n=o.div.withConfig({displayName:"tabs.style__Spacer",componentId:"sc-75b008c3-3"})(["align-self:flex-end;background:#8b8b8bff;flex-grow:1;height:2px;"]),p=o.button.withConfig({displayName:"tabs.style__StyledScrollButton",componentId:"sc-75b008c3-4"})(["height:",";width:",";border-radius:0px;border-top-right-radius:8px;border-top-left-radius:8px;border-color:#8b8b8bff;background:white;border:none;border-bottom:2px solid #8b8b8bff;top:6px;position:relative;"],(({$size:o})=>"medium"===o?"40px":"48px"),(({$size:o})=>"medium"===o?"40px":"48px")),b=o.div.withConfig({displayName:"tabs.style__StyledScrollButtonPlaceholder",componentId:"sc-75b008c3-5"})(["height:",";width:",";border-radius:0;border-color:#8b8b8bff;border:none;border-bottom:2px solid #8b8b8bff;top:4px;position:relative;"],(({$size:o})=>"medium"===o?"40px":"48px"),(({$size:o})=>"medium"===o?"40px":"48px")),l=o.button.withConfig({displayName:"tabs.style__StyledTab",componentId:"sc-75b008c3-6"})(["background-color:transparent;border:none;border-bottom:2px solid #8b8b8bff;border-bottom-left-radius:0px;border-bottom-right-radius:0px;border-top-left-radius:8px;border-top-right-radius:8px;white-space:nowrap;height:fit-content;color:var(--colorsYin090);font-weight:var(--fontWeights500);line-height:var(--lineHeights500);position:relative;.tab-title-content-wrapper{"," ","}:hover{background-color:#00000010;cursor:pointer;}",";",";"," :focus{"," z-index:1;","}"],(({$hasCustomLayout:o})=>!o&&t(["align-items:center;display:flex;gap:8px;"])),(({activeTab:o,$orientation:i,$size:e,error:d,warning:r,info:a,$hasCustomLayout:n})=>o&&t([""," "," ",""],"horizontal"===i&&(d||r||a)&&t(["position:relative;top:1px;"]),"large"===e&&t(["margin-top:-4px;"]),n&&"horizontal"===i&&t(["position:relative;top:-2px;left:1px;"]))),(({$size:o,$hasCustomLayout:i})=>t(["font-size:","px;height:","px;",""],e[o].fontSize,e[o].height,i?t(["padding:0;"]):t(["padding:","px ","px;"],e[o].paddingY,e[o].paddingX))),(({activeTab:o,error:i,info:d,$orientation:r,$size:a,warning:n,$hasCustomLayout:p})=>o&&"horizontal"===r&&t(["background-color:white;border:2px solid #8b8b8bff;border-bottom:none;",' :hover{background-color:white;}::after{content:"";position:absolute;bottom:0;left:20%;width:60%;height:4px;background-color:',";border-radius:2px;min-width:24px;}"],!p&&t(["padding-top:","px;padding-right:","px;padding-bottom:","px;padding-left:","px;"],e[a].paddingY-4,e[a].paddingX-2,e[a].paddingY,e[a].paddingX-2),(()=>i?"#db004e":n?"#d64309":d?"#0060a7ff":"black"))),(({activeTab:o,error:i,info:d,$orientation:r,$size:a,warning:n,$hasCustomLayout:p,$headerWidth:b})=>"vertical"===r&&t(["border:none;border-right:2px solid #8b8b8bff;border-bottom-left-radius:8px;border-bottom-right-radius:0px;border-top-left-radius:8px;border-top-right-radius:0px;max-width:",";width:",";"," ",""],null!=b?b:"200px",null!=b?b:"200px",b&&t(["white-space:normal;height:auto;"]),o&&t(["background-color:white;border:2px solid #8b8b8bff;border-right:none;"," :hover{background-color:white;}.tab-title-content-wrapper{"," ",' ::after{content:"";position:absolute;right:0;width:4px;'," height:60%;background-color:",";border-radius:2px;min-height:24px;}}"],!p&&t(["padding-top:","px;padding-right:var(--global-space-none);padding-bottom:","px;padding-left:","px;"],"medium"===a?e.medium.paddingY-2:4,"medium"===a?e.medium.paddingY-2:e.large.paddingY,e[a].paddingX-2),b&&!p&&t(["padding-right:18px;"]),p&&t(["width:100%;> *{position:relative;left:-2px;top:-2px;}"]),p&&t(["top:20%;right:0px;"]),(()=>i?"#db004e":n?"#d64309":d?"#0060a7ff":"black")))),i(),(({$orientation:o})=>t(["border-top-left-radius:8px;border-top-right-radius:",";border-bottom-left-radius:",";border-bottom-right-radius:0px;"],"horizontal"===o?"8px":"0","horizontal"===o?"0px":"8px"))),s=o.div.withConfig({displayName:"tabs.style__StyledTabs",componentId:"sc-75b008c3-7"})(["display:flex;",""],(({$orientation:o})=>t(["flex-direction:",";"],"horizontal"===o?"column":"row"))),h=o.div.withConfig({displayName:"tabs.style__StyledTabProvider",componentId:"sc-75b008c3-8"})(["",""],(({visible:o})=>t(["display:",";"],o?"block":"none")));export{n as Spacer,p as StyledScrollButton,b as StyledScrollButtonPlaceholder,l as StyledTab,r as StyledTabList,a as StyledTabListWrapper,d as StyledTabPanel,h as StyledTabProvider,s as StyledTabs};
|
|
@@ -46,6 +46,10 @@ export interface TabListProps extends TagProps {
|
|
|
46
46
|
children?: React.ReactNode;
|
|
47
47
|
/** A callback for when the active tab is changed */
|
|
48
48
|
onTabChange?: (tabId: string) => void;
|
|
49
|
+
/**
|
|
50
|
+
* @private @ignore @internal
|
|
51
|
+
*/
|
|
52
|
+
headerWidth?: string;
|
|
49
53
|
}
|
|
50
54
|
export interface TabProps extends TagProps {
|
|
51
55
|
/** The tab panel that this tab controls */
|
|
@@ -67,6 +71,14 @@ export interface TabProps extends TagProps {
|
|
|
67
71
|
* @deprecated to be removed when legacy `Tabs` and `Tab` are removed
|
|
68
72
|
* */
|
|
69
73
|
info?: boolean | string;
|
|
74
|
+
/**
|
|
75
|
+
* @internal @private @ignore
|
|
76
|
+
*/
|
|
77
|
+
hasCustomLayout?: boolean;
|
|
78
|
+
/** @private @ignore @internal */
|
|
79
|
+
headerWidth?: string;
|
|
80
|
+
/** @private @ignore @internal */
|
|
81
|
+
href?: string;
|
|
70
82
|
}
|
|
71
83
|
export interface TabsProps extends TagProps {
|
|
72
84
|
/** The tab list to be rendered within this set of tabs */
|
|
@@ -1,32 +1,72 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PaddingProps } from "styled-system";
|
|
3
3
|
import { TagProps } from "../../../__internal__/utils/helpers/tags/tags";
|
|
4
|
-
|
|
4
|
+
import type { TabProps as NextTabProps } from "../__next__";
|
|
5
|
+
export type TabsHandle = {
|
|
6
|
+
/** Programmatically focus on a specific tab.
|
|
7
|
+
* @param tabId - The ID of the tab to focus. Must match the `tabId` prop of the target `Tab` component.
|
|
8
|
+
*/
|
|
9
|
+
focusTab: (tabId: string) => void;
|
|
10
|
+
} | null;
|
|
11
|
+
export interface TabProps extends PaddingProps, TagProps, Partial<NextTabProps> {
|
|
12
|
+
/**
|
|
13
|
+
* The title of the Tab.
|
|
14
|
+
* @deprecated Support will be removed in a future release, it is recommended to use `label` prop instead.
|
|
15
|
+
*/
|
|
5
16
|
title?: string;
|
|
6
|
-
/**
|
|
7
|
-
|
|
17
|
+
/**
|
|
18
|
+
* A unique ID to identify this specific tab.
|
|
19
|
+
* @deprecated Support will be removed in a future release, it is recommended to use `id` instead.
|
|
20
|
+
* */
|
|
21
|
+
tabId?: string;
|
|
8
22
|
/** The child elements of Tab component. */
|
|
9
23
|
children?: React.ReactNode;
|
|
10
24
|
/** @ignore @private Boolean indicating selected state of Tab. */
|
|
11
25
|
isTabSelected?: boolean;
|
|
12
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* The position of the Tab.
|
|
28
|
+
* @deprecated Support will be removed in a future release.
|
|
29
|
+
* */
|
|
13
30
|
position?: "top" | "left";
|
|
14
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated
|
|
33
|
+
* Message displayed when Tab has error
|
|
34
|
+
* The legacy validation pattern is being removed in a future release.
|
|
35
|
+
* */
|
|
15
36
|
errorMessage?: string;
|
|
16
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated
|
|
39
|
+
* Message displayed when Tab has warning
|
|
40
|
+
* The legacy validation pattern is being removed in a future release.
|
|
41
|
+
* */
|
|
17
42
|
warningMessage?: string;
|
|
18
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated
|
|
45
|
+
* Message displayed when Tab has info
|
|
46
|
+
* The legacy validation pattern is being removed in a future release.
|
|
47
|
+
* */
|
|
19
48
|
infoMessage?: string;
|
|
20
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Additional content to display with title
|
|
51
|
+
* @deprecated Support for siblings will be removed in a future release.
|
|
52
|
+
* It is recommended to use `label` prop to compose what you want.
|
|
53
|
+
* */
|
|
21
54
|
siblings?: React.ReactNode;
|
|
22
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Position title before or after siblings
|
|
57
|
+
* @deprecated Support for titlePosition will be removed in a future release.
|
|
58
|
+
* It is recommended to use `label` prop to compose what you want.
|
|
59
|
+
* */
|
|
23
60
|
titlePosition?: "before" | "after";
|
|
24
61
|
/**
|
|
25
62
|
* Allows Tab to be a link
|
|
26
63
|
* @deprecated Using tabs as links is inaccessible; this prop will be deprecated in a future release.
|
|
27
64
|
* */
|
|
28
65
|
href?: string;
|
|
29
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Overrides default layout with a one defined in this prop
|
|
68
|
+
* @deprecated Support for customLayout will be removed in a future release, it is recommended to use the `label` prop instead.
|
|
69
|
+
* */
|
|
30
70
|
customLayout?: React.ReactNode;
|
|
31
71
|
/** Additional props to be passed to the Tab's corresponding title. */
|
|
32
72
|
titleProps?: {
|
|
@@ -37,12 +77,17 @@ export interface TabProps extends PaddingProps, TagProps {
|
|
|
37
77
|
role?: string;
|
|
38
78
|
/** @private @ignore */
|
|
39
79
|
ariaLabelledby?: string;
|
|
40
|
-
/** @private @ignore */
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
80
|
+
/** @private @ignore @internal */
|
|
81
|
+
validationStatusOverride?: {
|
|
82
|
+
error?: boolean;
|
|
83
|
+
warning?: boolean;
|
|
84
|
+
info?: boolean;
|
|
85
|
+
};
|
|
86
|
+
/** @private @ignore @internal */
|
|
87
|
+
headerWidth?: string;
|
|
46
88
|
}
|
|
47
|
-
export declare const Tab:
|
|
89
|
+
export declare const Tab: {
|
|
90
|
+
({ tabId, title, customLayout, siblings, titlePosition, validationStatusOverride, errorMessage, warningMessage, infoMessage, titleProps, controls, id, label, error, warning, info, ...rest }: TabProps): React.JSX.Element | null;
|
|
91
|
+
displayName: string;
|
|
92
|
+
};
|
|
48
93
|
export default Tab;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e
|
|
1
|
+
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import"react";import{Tab as n}from"../__next__/tabs.component.js";import o from"../../../__internal__/utils/logger/index.js";function i(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}let a=!1;const l=l=>{var{tabId:s,title:u,customLayout:c,siblings:f,titlePosition:b,validationStatusOverride:g,errorMessage:d,warningMessage:p,infoMessage:m,titleProps:y,controls:O,id:v,label:w,error:h,warning:j,info:P}=l,_=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}(l,["tabId","title","customLayout","siblings","titlePosition","validationStatusOverride","errorMessage","warningMessage","infoMessage","titleProps","controls","id","label","error","warning","info"]);a||(o.warn("Warning: This version of the `Tab` component is intended to help migration to the `next` version and will be removed in a future release."),a=!0);let x="";if(w)x=w;else if(c)x=c;else if(x=u,f){const n=e("span",{children:w||u});x=r(t,"after"===b?{children:[f,n]}:{children:[n,f]})}const{error:M,warning:S,info:T}=g||{},I=v||s;return I?e(n,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){i(e,r,t[r])}))}return e}({id:I,controls:O||`${I}-panel`,label:x,error:h||M,warning:j||S,info:P||T,hasCustomLayout:!!c,"data-role":null==y?void 0:y["data-role"]},_)):null};l.displayName="Tab";export{l as Tab,l as default};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
|
-
import Tab from "./tab";
|
|
4
3
|
import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
|
|
5
4
|
export type TabsHandle = {
|
|
6
|
-
/**
|
|
7
|
-
* Programmatically focus on a specific tab.
|
|
5
|
+
/** Programmatically focus on a specific tab.
|
|
8
6
|
* @param tabId - The ID of the tab to focus. Must match the `tabId` prop of the target `Tab` component.
|
|
9
7
|
*/
|
|
10
8
|
focusTab: (tabId: string) => void;
|
|
11
9
|
} | null;
|
|
12
10
|
export interface TabsProps extends MarginProps, TagProps {
|
|
13
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Prevent rendering of hidden tabs, by default this is set to true and therefore all tabs will be rendered
|
|
13
|
+
* @deprecated Support for this prop will be removed in a future release. All tabs will be rendered by default.
|
|
14
|
+
* */
|
|
14
15
|
renderHiddenTabs?: boolean;
|
|
15
16
|
/** Allows manual control over the currently selected tab. */
|
|
16
17
|
selectedTabId?: string;
|
|
@@ -18,7 +19,7 @@ export interface TabsProps extends MarginProps, TagProps {
|
|
|
18
19
|
children: React.ReactNode;
|
|
19
20
|
/**
|
|
20
21
|
* Sets the alignment of the tab titles. Possible values include.
|
|
21
|
-
* @deprecated
|
|
22
|
+
* @deprecated Support for right-aligned tab content has been removed.
|
|
22
23
|
*/
|
|
23
24
|
align?: "left" | "right";
|
|
24
25
|
/** A callback for when a tab is changed. You can use this to manually control
|
|
@@ -33,18 +34,22 @@ export interface TabsProps extends MarginProps, TagProps {
|
|
|
33
34
|
size?: "default" | "large";
|
|
34
35
|
/**
|
|
35
36
|
* Sets the divider of the tab titles header to extend the full width of the parent.
|
|
36
|
-
* @deprecated
|
|
37
|
+
* @deprecated Support for extended lines in tab headers has been removed.
|
|
37
38
|
* */
|
|
38
39
|
extendedLine?: boolean;
|
|
39
40
|
/**
|
|
40
41
|
* Adds a combination of borders to the tab titles.
|
|
41
|
-
* @deprecated
|
|
42
|
+
* @deprecated Support for configurable borders on tab titles has been removed.
|
|
42
43
|
* */
|
|
43
44
|
borders?: "off" | "on" | "no left side" | "no right side" | "no sides";
|
|
44
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Adds an alternate styling variant to the tab titles.
|
|
47
|
+
* @deprecated Support for alternate styling variants on tab titles has been removed.
|
|
48
|
+
*/
|
|
45
49
|
variant?: "default" | "alternate";
|
|
46
50
|
/** sets width to the tab headers. Can be any valid CSS string.
|
|
47
51
|
* The headerWidth prop works only for `position="left"`
|
|
52
|
+
* @deprecated Support will be removed in a future release.
|
|
48
53
|
*/
|
|
49
54
|
headerWidth?: string;
|
|
50
55
|
/** An object to support overriding validation statuses, when the Tabs have custom targets for example.
|
|
@@ -60,9 +65,9 @@ export interface TabsProps extends MarginProps, TagProps {
|
|
|
60
65
|
/**
|
|
61
66
|
* When this prop is set any string validation failures in the children of each Tab
|
|
62
67
|
* will be summarised in the Tooltip next to the Tab title
|
|
63
|
-
* @deprecated
|
|
68
|
+
* @deprecated Support for validation summaries has been removed.
|
|
64
69
|
*/
|
|
65
70
|
showValidationsSummary?: boolean;
|
|
66
71
|
}
|
|
67
|
-
declare const Tabs: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<TabsHandle>>;
|
|
68
|
-
export
|
|
72
|
+
export declare const Tabs: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<TabsHandle>>;
|
|
73
|
+
export default Tabs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as
|
|
1
|
+
import{jsxs as e,jsx as r}from"react/jsx-runtime";import t,{forwardRef as n,useMemo as o,useState as i,useEffect as a,createElement as l}from"react";import{Tabs as s,TabList as d,TabPanel as p}from"./__next__/tabs.component.js";import{Tab as c}from"./tab/tab.component.js";import b from"../../__internal__/utils/logger/index.js";import u from"../drawer/__internal__/drawer-sidebar.context.js";import f from"../../hooks/__internal__/usePrevious/index.js";function m(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){m(e,r,t[r])}))}return e}function O(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}let y=!1;const g=n(((n,m)=>{var g,v,{children:j,selectedTabId:w,onTabChange:T,position:P="top",size:_="default",validationStatusOverride:I,align:x,headerWidth:S,renderHiddenTabs:W=!0}=n,E=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}(n,["children","selectedTabId","onTabChange","position","size","validationStatusOverride","align","headerWidth","renderHiddenTabs"]);y||(b.warn("Warning: This version of the `Tabs` component is intended to help migration to the `next` version and will be removed in a future release."),y=!0);const k=o((()=>{const e=[];return t.Children.forEach(j,(r=>{t.isValidElement(r)&&e.push({props:r.props})})),e}),[j]),[C,z]=i(w||(null===(g=k[0])||void 0===g?void 0:g.props.id)||(null===(v=k[0])||void 0===v?void 0:v.props.tabId)),D="default"===_?"medium":"large",{isInSidebar:H}=t.useContext(u),$=H||"left"===P?"vertical":"horizontal",q=W?k:k.filter((({props:e})=>e.isTabSelected||e.tabId===C)),L=f(w);return a((()=>{w!==L&&w!==C&&z(w)}),[w,L,C]),e(s,O(h({orientation:$,selectedTabId:C,size:D},E),{children:[r(d,{ref:m,ariaLabel:"Tabs",onTabChange:e=>{z(e),null==T||T(e)},headerWidth:H?"100%":void 0,children:k.map((({props:e})=>{const r=e.id||e.tabId;return r?l(c,O(h({headerWidth:H?"100%":S},e),{key:r})):(b.warn("Warning: Tab component is missing a unique identifier. Please provide an `id` prop to ensure proper functionality."),null)}))}),!H&&q.map((({props:e})=>{const t=e.id||e.tabId;return t?r(p,{id:`${t}-panel`,tabId:t,children:e.children},`${t}-panel`):(b.warn("Warning: Each `Tab` component must have an `id` or `tabId` prop to associate it with a TabPanel."),null)}))]}))}));g.displayName="Tabs";export{g as Tabs,g as default};
|