@tedi-design-system/react 17.0.0-rc.4 → 17.0.0-rc.6
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/_virtual/index.es13.js +2 -2
- package/_virtual/index.es14.js +2 -2
- package/bundle-stats.html +1 -1
- package/external/react-is/index.cjs.js +1 -1
- package/external/react-is/index.es.js +1 -1
- package/external/toposort/index.cjs.js +1 -1
- package/external/toposort/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/community/components/tabs/tabs/tabs.d.ts +6 -0
- package/src/community/components/tabs/tabs-item/tabs-item.d.ts +6 -0
- package/src/community/components/tabs/tabs-nav/tabs-nav-item.d.ts +6 -0
- package/src/community/components/tabs/tabs-nav/tabs-nav.d.ts +6 -0
- package/src/tedi/components/form/textarea/textarea.cjs.js +1 -1
- package/src/tedi/components/form/textarea/textarea.d.ts +29 -0
- package/src/tedi/components/form/textarea/textarea.es.js +82 -36
- package/src/tedi/components/form/textarea/textarea.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/textarea/textarea.module.scss.es.js +1 -0
- package/src/tedi/components/misc/scroll-fade/scroll-fade.cjs.js +1 -1
- package/src/tedi/components/misc/scroll-fade/scroll-fade.es.js +32 -42
- package/src/tedi/components/navigation/tabs/index.d.ts +5 -0
- package/src/tedi/components/navigation/tabs/tabs-content/tabs-content.cjs.js +1 -0
- package/src/tedi/components/navigation/tabs/tabs-content/tabs-content.d.ts +22 -0
- package/src/tedi/components/navigation/tabs/tabs-content/tabs-content.es.js +22 -0
- package/src/tedi/components/navigation/tabs/tabs-context.cjs.js +1 -0
- package/src/tedi/components/navigation/tabs/tabs-context.d.ts +7 -0
- package/src/tedi/components/navigation/tabs/tabs-context.es.js +11 -0
- package/src/tedi/components/navigation/tabs/tabs-helpers.cjs.js +1 -0
- package/src/tedi/components/navigation/tabs/tabs-helpers.d.ts +5 -0
- package/src/tedi/components/navigation/tabs/tabs-helpers.es.js +29 -0
- package/src/tedi/components/navigation/tabs/tabs-list/tabs-list.cjs.js +1 -0
- package/src/tedi/components/navigation/tabs/tabs-list/tabs-list.d.ts +37 -0
- package/src/tedi/components/navigation/tabs/tabs-list/tabs-list.es.js +102 -0
- package/src/tedi/components/navigation/tabs/tabs-trigger/tabs-trigger.cjs.js +1 -0
- package/src/tedi/components/navigation/tabs/tabs-trigger/tabs-trigger.d.ts +31 -0
- package/src/tedi/components/navigation/tabs/tabs-trigger/tabs-trigger.es.js +43 -0
- package/src/tedi/components/navigation/tabs/tabs.cjs.js +1 -0
- package/src/tedi/components/navigation/tabs/tabs.d.ts +40 -0
- package/src/tedi/components/navigation/tabs/tabs.es.js +24 -0
- package/src/tedi/components/navigation/tabs/tabs.module.scss.cjs.js +1 -0
- package/src/tedi/components/navigation/tabs/tabs.module.scss.es.js +17 -0
- package/src/tedi/components/overlays/dropdown/dropdown-trigger/dropdown-trigger.cjs.js +1 -1
- package/src/tedi/components/overlays/dropdown/dropdown-trigger/dropdown-trigger.es.js +9 -7
- package/src/tedi/components/tags/status-badge/status-badge.cjs.js +1 -1
- package/src/tedi/components/tags/status-badge/status-badge.es.js +25 -25
- package/src/tedi/components/tags/status-badge/status-badge.module.scss.cjs.js +1 -1
- package/src/tedi/components/tags/status-badge/status-badge.module.scss.es.js +0 -6
- package/src/tedi/components/tags/status-indicator/index.d.ts +1 -0
- package/src/tedi/components/tags/status-indicator/status-indicator.cjs.js +1 -0
- package/src/tedi/components/tags/status-indicator/status-indicator.d.ts +36 -0
- package/src/tedi/components/tags/status-indicator/status-indicator.es.js +26 -0
- package/src/tedi/components/tags/status-indicator/status-indicator.module.scss.cjs.js +1 -0
- package/src/tedi/components/tags/status-indicator/status-indicator.module.scss.es.js +14 -0
- package/src/tedi/helpers/hooks/use-scroll-fade.cjs.js +1 -0
- package/src/tedi/helpers/hooks/use-scroll-fade.d.ts +35 -0
- package/src/tedi/helpers/hooks/use-scroll-fade.es.js +34 -0
- package/src/tedi/helpers/index.d.ts +1 -0
- package/src/tedi/index.d.ts +2 -0
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +7 -0
- package/src/tedi/providers/label-provider/labels-map.es.js +8 -1
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +186 -171
package/package.json
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { PrintProps } from '../../../../tedi/components/misc/print/print';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use Tabs from `@tedi-design-system/react/tedi` instead.
|
|
5
|
+
*/
|
|
3
6
|
export interface TabsProps {
|
|
4
7
|
/**
|
|
5
8
|
* Tabs content. Children should be TabsItems
|
|
@@ -32,5 +35,8 @@ export interface TabsProps {
|
|
|
32
35
|
*/
|
|
33
36
|
hideNavOnPrint?: PrintProps['visibility'];
|
|
34
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use Tabs from `@tedi-design-system/react/tedi` instead.
|
|
40
|
+
*/
|
|
35
41
|
export declare const Tabs: (props: TabsProps) => JSX.Element;
|
|
36
42
|
export default Tabs;
|
|
@@ -2,6 +2,9 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { BreakpointSupport } from '../../../helpers';
|
|
3
3
|
import { CardContentProps } from '../../card';
|
|
4
4
|
type TabsItemBreakpointProps = Pick<CardContentProps, 'padding' | 'background'>;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use Tabs from `@tedi-design-system/react/tedi` instead.
|
|
7
|
+
*/
|
|
5
8
|
export interface TabsItemProps extends BreakpointSupport<TabsItemBreakpointProps> {
|
|
6
9
|
/**
|
|
7
10
|
* ID property.
|
|
@@ -20,5 +23,8 @@ export interface TabsItemProps extends BreakpointSupport<TabsItemBreakpointProps
|
|
|
20
23
|
*/
|
|
21
24
|
className?: string;
|
|
22
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Use Tabs from `@tedi-design-system/react/tedi` instead.
|
|
28
|
+
*/
|
|
23
29
|
export declare const TabsItem: (props: TabsItemProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
24
30
|
export default TabsItem;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { AnchorProps } from '../../anchor/anchor';
|
|
3
3
|
import { TabsItemProps } from '../tabs-item/tabs-item';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use Tabs from `@tedi-design-system/react/tedi` instead.
|
|
6
|
+
*/
|
|
4
7
|
export type TabsNavItemProps<C extends React.ElementType = 'a'> = AnchorProps<C> & Pick<TabsItemProps, 'id'>;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Use Tabs from `@tedi-design-system/react/tedi` instead.
|
|
10
|
+
*/
|
|
5
11
|
export declare const TabsNavItem: <C extends React.ElementType = "a">(props: TabsNavItemProps<C>) => JSX.Element;
|
|
6
12
|
export default TabsNavItem;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { TabsNavItemProps } from './tabs-nav-item';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use Tabs from `@tedi-design-system/react/tedi` instead.
|
|
4
|
+
*/
|
|
2
5
|
export interface TabsNavProps {
|
|
3
6
|
/**
|
|
4
7
|
* Additional classes.
|
|
@@ -13,5 +16,8 @@ export interface TabsNavProps {
|
|
|
13
16
|
*/
|
|
14
17
|
'aria-labelledby': string;
|
|
15
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use Tabs from `@tedi-design-system/react/tedi` instead.
|
|
21
|
+
*/
|
|
16
22
|
export declare const TabsNav: (props: TabsNavProps) => JSX.Element;
|
|
17
23
|
export default TabsNav;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react/jsx-runtime"),w=require("../../../../../external/classnames/index.cjs.js"),a=require("react"),O=require("../textfield/textfield.cjs.js"),d=require("./textarea.module.scss.cjs.js"),M=a.forwardRef((N,o)=>{const{className:_,helper:p=[],characterLimit:s,onChange:n,onChangeEvent:g,value:l,defaultValue:b,autoGrow:t=!1,minRows:u=3,maxRows:y=12,height:H="7.5rem",maxHeight:i,...q}=N,[T,F]=a.useState(b??""),c=a.useRef(null),[v,E]=a.useState("auto"),j=a.useCallback(e=>{!l&&!(n||g)&&F(e),n==null||n(e)},[l,n,g]),m=a.useMemo(()=>l??T,[l,T]),r=a.useCallback(()=>{if(!t||!c.current)return;const e=c.current,$=e.style.overflow;e.style.overflow="hidden";const f=window.getComputedStyle(e);let h=parseFloat(f.lineHeight);isNaN(h)&&(h=(parseFloat(f.fontSize)||16)*1.5);const S=parseFloat(f.paddingTop),A=parseFloat(f.paddingBottom),B=e.scrollHeight-S-A;let x=Math.ceil(B/h);x=Math.min(Math.max(x,u),y);const R=`${x*h+S+A}px`;e.style.height=R,E(R),e.style.overflow=$,e.style.overflowY=e.scrollHeight>e.clientHeight?"auto":"hidden"},[t,u,y]);a.useEffect(()=>{t&&requestAnimationFrame(()=>{r()})},[m,t,r]),a.useEffect(()=>{t&&c.current&&r()},[t,r]);const k=a.useCallback(e=>{o&&(typeof o=="function"?o(e):o.current=e),e!=null&&e.input&&e.input instanceof HTMLTextAreaElement&&(c.current=e.input,t&&setTimeout(r,0))},[o,t,r]),z=a.useMemo(()=>t?{rows:u,style:{...i?{maxHeight:i}:{},overflow:"hidden",height:v}}:{style:{height:H,...i?{maxHeight:i}:{},overflow:"auto"}},[t,u,i,H,v]),C=m.length,I=s?`${C}/${s}`:"",V=[...Array.isArray(p)?p:[p],...s?[{type:C>s?"error":"hint",text:I,position:"right",className:w.default(d.default["tedi-textarea__character-count"])}]:[]];return L.jsx(O.TextField,{...q,ref:k,"data-name":"textarea",inputClassName:w.default(d.default["tedi-textarea__input"],{[d.default["tedi-textarea__input--auto-grow"]]:t}),isTextArea:!0,className:w.default(d.default["tedi-textarea"],_),value:m,onChange:j,onChangeEvent:g,helper:V,input:z})});M.displayName="TextArea";exports.TextArea=M;
|
|
@@ -5,6 +5,35 @@ export interface TextAreaProps extends TextFieldProps {
|
|
|
5
5
|
* Maximum number of characters allowed in the textarea.
|
|
6
6
|
*/
|
|
7
7
|
characterLimit?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Enable automatic height adjustment based on content.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
autoGrow?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Minimum number of rows (only used when autoGrow = true).
|
|
15
|
+
* @default 3
|
|
16
|
+
*/
|
|
17
|
+
minRows?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Maximum number of rows before scrolling (only used when autoGrow = true).
|
|
20
|
+
* @default 12
|
|
21
|
+
*/
|
|
22
|
+
maxRows?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Fixed height for the textarea (e.g. '200px', '12rem', 240).
|
|
25
|
+
* Ignored when autoGrow = true.
|
|
26
|
+
*
|
|
27
|
+
* @default 7.5rem
|
|
28
|
+
*/
|
|
29
|
+
height?: string | number;
|
|
30
|
+
/**
|
|
31
|
+
* Maximum height of the textarea.
|
|
32
|
+
*
|
|
33
|
+
* - When `autoGrow` is enabled, this limits how tall the textarea can grow.
|
|
34
|
+
* - When `autoGrow` is disabled, this limits the fixed height.
|
|
35
|
+
*/
|
|
36
|
+
maxHeight?: string | number;
|
|
8
37
|
}
|
|
9
38
|
export declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<TextFieldForwardRef>>;
|
|
10
39
|
export default TextArea;
|
|
@@ -1,51 +1,97 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { TextField as
|
|
5
|
-
import
|
|
6
|
-
const
|
|
1
|
+
import { jsx as q } from "react/jsx-runtime";
|
|
2
|
+
import w from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import a, { forwardRef as G, useRef as O, useEffect as R } from "react";
|
|
4
|
+
import { TextField as P } from "../textfield/textfield.es.js";
|
|
5
|
+
import p from "./textarea.module.scss.es.js";
|
|
6
|
+
const Y = G((S, r) => {
|
|
7
7
|
const {
|
|
8
|
-
className:
|
|
9
|
-
helper:
|
|
10
|
-
characterLimit:
|
|
11
|
-
onChange:
|
|
12
|
-
onChangeEvent:
|
|
13
|
-
value:
|
|
14
|
-
defaultValue:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
className: F,
|
|
9
|
+
helper: f = [],
|
|
10
|
+
characterLimit: i,
|
|
11
|
+
onChange: s,
|
|
12
|
+
onChangeEvent: g,
|
|
13
|
+
value: l,
|
|
14
|
+
defaultValue: M,
|
|
15
|
+
autoGrow: e = !1,
|
|
16
|
+
minRows: c = 3,
|
|
17
|
+
maxRows: H = 12,
|
|
18
|
+
height: y = "7.5rem",
|
|
19
|
+
maxHeight: n,
|
|
20
|
+
...b
|
|
21
|
+
} = S, [v, k] = a.useState(M ?? ""), u = O(null), [C, z] = a.useState("auto"), E = a.useCallback(
|
|
22
|
+
(t) => {
|
|
23
|
+
!l && !(s || g) && k(t), s == null || s(t);
|
|
19
24
|
},
|
|
20
|
-
[
|
|
21
|
-
),
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
[l, s, g]
|
|
26
|
+
), x = a.useMemo(() => l ?? v, [l, v]), o = a.useCallback(() => {
|
|
27
|
+
if (!e || !u.current) return;
|
|
28
|
+
const t = u.current, L = t.style.overflow;
|
|
29
|
+
t.style.overflow = "hidden";
|
|
30
|
+
const h = window.getComputedStyle(t);
|
|
31
|
+
let m = parseFloat(h.lineHeight);
|
|
32
|
+
isNaN(m) && (m = (parseFloat(h.fontSize) || 16) * 1.5);
|
|
33
|
+
const N = parseFloat(h.paddingTop), _ = parseFloat(h.paddingBottom), j = t.scrollHeight - N - _;
|
|
34
|
+
let d = Math.ceil(j / m);
|
|
35
|
+
d = Math.min(Math.max(d, c), H);
|
|
36
|
+
const A = `${d * m + N + _}px`;
|
|
37
|
+
t.style.height = A, z(A), t.style.overflow = L, t.style.overflowY = t.scrollHeight > t.clientHeight ? "auto" : "hidden";
|
|
38
|
+
}, [e, c, H]);
|
|
39
|
+
R(() => {
|
|
40
|
+
e && requestAnimationFrame(() => {
|
|
41
|
+
o();
|
|
42
|
+
});
|
|
43
|
+
}, [x, e, o]), R(() => {
|
|
44
|
+
e && u.current && o();
|
|
45
|
+
}, [e, o]);
|
|
46
|
+
const I = a.useCallback(
|
|
47
|
+
(t) => {
|
|
48
|
+
r && (typeof r == "function" ? r(t) : r.current = t), t != null && t.input && t.input instanceof HTMLTextAreaElement && (u.current = t.input, e && setTimeout(o, 0));
|
|
49
|
+
},
|
|
50
|
+
[r, e, o]
|
|
51
|
+
), V = a.useMemo(() => e ? {
|
|
52
|
+
rows: c,
|
|
53
|
+
style: {
|
|
54
|
+
...n ? { maxHeight: n } : {},
|
|
55
|
+
overflow: "hidden",
|
|
56
|
+
height: C
|
|
57
|
+
}
|
|
58
|
+
} : {
|
|
59
|
+
style: {
|
|
60
|
+
height: y,
|
|
61
|
+
...n ? { maxHeight: n } : {},
|
|
62
|
+
overflow: "auto"
|
|
63
|
+
}
|
|
64
|
+
}, [e, c, n, y, C]), T = x.length, $ = i ? `${T}/${i}` : "", B = [
|
|
65
|
+
...Array.isArray(f) ? f : [f],
|
|
66
|
+
...i ? [
|
|
24
67
|
{
|
|
25
|
-
type:
|
|
26
|
-
text:
|
|
68
|
+
type: T > i ? "error" : "hint",
|
|
69
|
+
text: $,
|
|
27
70
|
position: "right",
|
|
28
|
-
className:
|
|
71
|
+
className: w(p["tedi-textarea__character-count"])
|
|
29
72
|
}
|
|
30
73
|
] : []
|
|
31
74
|
];
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
|
|
75
|
+
return /* @__PURE__ */ q(
|
|
76
|
+
P,
|
|
34
77
|
{
|
|
35
|
-
...
|
|
36
|
-
ref:
|
|
78
|
+
...b,
|
|
79
|
+
ref: I,
|
|
37
80
|
"data-name": "textarea",
|
|
38
|
-
inputClassName:
|
|
81
|
+
inputClassName: w(p["tedi-textarea__input"], {
|
|
82
|
+
[p["tedi-textarea__input--auto-grow"]]: e
|
|
83
|
+
}),
|
|
39
84
|
isTextArea: !0,
|
|
40
|
-
className:
|
|
41
|
-
value:
|
|
42
|
-
onChange:
|
|
43
|
-
onChangeEvent:
|
|
44
|
-
helper:
|
|
85
|
+
className: w(p["tedi-textarea"], F),
|
|
86
|
+
value: x,
|
|
87
|
+
onChange: E,
|
|
88
|
+
onChangeEvent: g,
|
|
89
|
+
helper: B,
|
|
90
|
+
input: V
|
|
45
91
|
}
|
|
46
92
|
);
|
|
47
93
|
});
|
|
48
|
-
|
|
94
|
+
Y.displayName = "TextArea";
|
|
49
95
|
export {
|
|
50
|
-
|
|
96
|
+
Y as TextArea
|
|
51
97
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={"tedi-textarea__input":"tedi-textarea__input-8c740e37","tedi-textarea__input--auto-grow":"tedi-textarea__input--auto-grow-dddcdb8a","tedi-textarea__character-count":"tedi-textarea__character-count-c5b62b38"};exports.default=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react/jsx-runtime"),s=require("../../../../../external/classnames/index.cjs.js"),n=require("react"),l=require("./scroll-fade.module.scss.cjs.js"),E=require("../../../helpers/hooks/use-scroll-fade.cjs.js"),c=n.forwardRef((i,e)=>{const{children:u,className:f,scrollBar:S="custom",onScrollToBottom:m,onScrollToTop:F,fadeSize:r=20,fadePosition:o="both"}=i,{scrollRef:a,canScrollStart:b,canScrollEnd:h,handleScroll:_}=E.useScrollFade({direction:"vertical",onScrollToStart:F,onScrollToEnd:m}),p=n.useCallback(t=>{a(t),typeof e=="function"?e(t):e&&(e.current=t)},[a,e]),T=b&&(o==="both"||o==="top"),q=h&&(o==="both"||o==="bottom"),v=s.default(l.default["tedi-scroll-fade"],{[l.default[`tedi-scroll-fade--top-${r}`]]:T},{[l.default[`tedi-scroll-fade--bottom-${r}`]]:q},f),x=s.default(l.default["tedi-scroll-fade__inner"],{[l.default["tedi-scroll-fade__inner--custom-scroll"]]:S==="custom"});return d.jsx("div",{"data-name":"scroll-fade",className:v,children:d.jsx("div",{ref:p,onScroll:_,className:x,tabIndex:0,children:u})})});c.displayName="ScrollFade";exports.ScrollFade=c;exports.default=c;
|
|
@@ -1,48 +1,38 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import s from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { forwardRef as B, useCallback as _ } from "react";
|
|
4
|
+
import l from "./scroll-fade.module.scss.es.js";
|
|
5
|
+
import { useScrollFade as v } from "../../../helpers/hooks/use-scroll-fade.es.js";
|
|
6
|
+
const w = B((d, o) => {
|
|
6
7
|
const {
|
|
7
|
-
children:
|
|
8
|
-
className:
|
|
9
|
-
scrollBar:
|
|
10
|
-
onScrollToBottom:
|
|
11
|
-
onScrollToTop:
|
|
12
|
-
fadeSize:
|
|
13
|
-
fadePosition:
|
|
14
|
-
} =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
children: n,
|
|
9
|
+
className: i,
|
|
10
|
+
scrollBar: m = "custom",
|
|
11
|
+
onScrollToBottom: f,
|
|
12
|
+
onScrollToTop: S,
|
|
13
|
+
fadeSize: c = 20,
|
|
14
|
+
fadePosition: t = "both"
|
|
15
|
+
} = d, { scrollRef: e, canScrollStart: p, canScrollEnd: u, handleScroll: h } = v({
|
|
16
|
+
direction: "vertical",
|
|
17
|
+
onScrollToStart: S,
|
|
18
|
+
onScrollToEnd: f
|
|
19
|
+
}), b = _(
|
|
20
|
+
(r) => {
|
|
21
|
+
e(r), typeof o == "function" ? o(r) : o && (o.current = r);
|
|
19
22
|
},
|
|
20
|
-
[
|
|
21
|
-
),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
(t) => {
|
|
29
|
-
typeof e == "function" ? e(t) : e && (e.current = t), t && c(t.scrollTop, t.scrollHeight, t.clientHeight);
|
|
30
|
-
},
|
|
31
|
-
[c, e]
|
|
32
|
-
), x = u(
|
|
33
|
-
o["tedi-scroll-fade"],
|
|
34
|
-
{ [o[`tedi-scroll-fade--top-${m}`]]: n.top && (s === "both" || s === "top") },
|
|
35
|
-
{
|
|
36
|
-
[o[`tedi-scroll-fade--bottom-${m}`]]: n.bottom && (s === "both" || s === "bottom")
|
|
37
|
-
},
|
|
38
|
-
N
|
|
39
|
-
), y = u(o["tedi-scroll-fade__inner"], {
|
|
40
|
-
[o["tedi-scroll-fade__inner--custom-scroll"]]: S === "custom"
|
|
23
|
+
[e, o]
|
|
24
|
+
), F = p && (t === "both" || t === "top"), E = u && (t === "both" || t === "bottom"), N = s(
|
|
25
|
+
l["tedi-scroll-fade"],
|
|
26
|
+
{ [l[`tedi-scroll-fade--top-${c}`]]: F },
|
|
27
|
+
{ [l[`tedi-scroll-fade--bottom-${c}`]]: E },
|
|
28
|
+
i
|
|
29
|
+
), T = s(l["tedi-scroll-fade__inner"], {
|
|
30
|
+
[l["tedi-scroll-fade__inner--custom-scroll"]]: m === "custom"
|
|
41
31
|
});
|
|
42
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ a("div", { "data-name": "scroll-fade", className: N, children: /* @__PURE__ */ a("div", { ref: b, onScroll: h, className: T, tabIndex: 0, children: n }) });
|
|
43
33
|
});
|
|
44
|
-
|
|
34
|
+
w.displayName = "ScrollFade";
|
|
45
35
|
export {
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
w as ScrollFade,
|
|
37
|
+
w as default
|
|
48
38
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),i=require("../../../../../../external/classnames/index.cjs.js"),l=require("../tabs.module.scss.cjs.js"),d=require("../tabs-context.cjs.js"),t=n=>{const{id:e,children:a,className:s}=n,{currentTab:o}=d.useTabsContext();return e&&o!==e?null:r.jsx("div",{"data-name":"tabs-content",id:e?`${e}-panel`:void 0,role:"tabpanel","aria-labelledby":e??void 0,className:i.default(l.default["tedi-tabs__content"],s),children:a})};t.displayName="TabsContent";exports.TabsContent=t;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface TabsContentProps {
|
|
3
|
+
/**
|
|
4
|
+
* Unique identifier matching the corresponding TabsTrigger id.
|
|
5
|
+
* When provided, content is only shown when this tab is active.
|
|
6
|
+
* When omitted, content is always rendered (useful for router outlets).
|
|
7
|
+
*/
|
|
8
|
+
id?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Tab panel content
|
|
11
|
+
*/
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Additional class name(s)
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const TabsContent: {
|
|
19
|
+
(props: TabsContentProps): import("react/jsx-runtime").JSX.Element | null;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
22
|
+
export default TabsContent;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import r from "../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import i from "../tabs.module.scss.es.js";
|
|
4
|
+
import { useTabsContext as l } from "../tabs-context.es.js";
|
|
5
|
+
const m = (a) => {
|
|
6
|
+
const { id: t, children: e, className: n } = a, { currentTab: o } = l();
|
|
7
|
+
return t && o !== t ? null : /* @__PURE__ */ s(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
"data-name": "tabs-content",
|
|
11
|
+
id: t ? `${t}-panel` : void 0,
|
|
12
|
+
role: "tabpanel",
|
|
13
|
+
"aria-labelledby": t ?? void 0,
|
|
14
|
+
className: r(i["tedi-tabs__content"], n),
|
|
15
|
+
children: e
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
m.displayName = "TabsContent";
|
|
20
|
+
export {
|
|
21
|
+
m as TabsContent
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),n=e.createContext(null),o=()=>{const t=e.useContext(n);if(!t)throw new Error("Tabs components must be used within <Tabs />");return t};exports.TabsContext=n;exports.useTabsContext=o;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type TabsContextValue = {
|
|
3
|
+
currentTab: string;
|
|
4
|
+
setCurrentTab: (id: string) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const TabsContext: React.Context<TabsContextValue | null>;
|
|
7
|
+
export declare const useTabsContext: () => TabsContextValue;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import e, { useContext as o } from "react";
|
|
2
|
+
const n = e.createContext(null), r = () => {
|
|
3
|
+
const t = o(n);
|
|
4
|
+
if (!t)
|
|
5
|
+
throw new Error("Tabs components must be used within <Tabs />");
|
|
6
|
+
return t;
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
n as TabsContext,
|
|
10
|
+
r as useTabsContext
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=e=>{if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight"&&e.key!=="Home"&&e.key!=="End")return null;const l=e.currentTarget.closest('[role="tablist"]');if(!l)return null;const t=Array.from(l.querySelectorAll('[role="tab"]:not([disabled])')).filter(a=>getComputedStyle(a).display!=="none"),n=t.indexOf(e.currentTarget);if(t.length===0||n===-1)return null;let r=-1;switch(e.key){case"ArrowLeft":r=n===0?t.length-1:n-1;break;case"ArrowRight":r=n===t.length-1?0:n+1;break;case"Home":r=0;break;case"End":r=t.length-1;break}return r!==-1?(e.preventDefault(),t[r].focus(),t[r].scrollIntoView({block:"nearest",inline:"nearest"}),t[r]):null};exports.navigateTablist=o;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigates to a sibling tab in the tablist using ArrowLeft/ArrowRight/Home/End keys.
|
|
3
|
+
* Returns the target tab element if navigation occurred, or null otherwise.
|
|
4
|
+
*/
|
|
5
|
+
export declare const navigateTablist: (e: React.KeyboardEvent<HTMLButtonElement>) => HTMLButtonElement | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const o = (e) => {
|
|
2
|
+
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight" && e.key !== "Home" && e.key !== "End")
|
|
3
|
+
return null;
|
|
4
|
+
const l = e.currentTarget.closest('[role="tablist"]');
|
|
5
|
+
if (!l) return null;
|
|
6
|
+
const t = Array.from(l.querySelectorAll('[role="tab"]:not([disabled])')).filter(
|
|
7
|
+
(a) => getComputedStyle(a).display !== "none"
|
|
8
|
+
), n = t.indexOf(e.currentTarget);
|
|
9
|
+
if (t.length === 0 || n === -1) return null;
|
|
10
|
+
let r = -1;
|
|
11
|
+
switch (e.key) {
|
|
12
|
+
case "ArrowLeft":
|
|
13
|
+
r = n === 0 ? t.length - 1 : n - 1;
|
|
14
|
+
break;
|
|
15
|
+
case "ArrowRight":
|
|
16
|
+
r = n === t.length - 1 ? 0 : n + 1;
|
|
17
|
+
break;
|
|
18
|
+
case "Home":
|
|
19
|
+
r = 0;
|
|
20
|
+
break;
|
|
21
|
+
case "End":
|
|
22
|
+
r = t.length - 1;
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
return r !== -1 ? (e.preventDefault(), t[r].focus(), t[r].scrollIntoView({ block: "nearest", inline: "nearest" }), t[r]) : null;
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
o as navigateTablist
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),g=require("../../../../../../external/classnames/index.cjs.js"),t=require("react"),D=require("../../../base/icon/icon.cjs.js"),k=require("../../../misc/print/print.cjs.js"),o=require("../../../overlays/dropdown/dropdown.cjs.js"),i=require("../tabs.module.scss.cjs.js"),z=require("../tabs-context.cjs.js"),P=require("../../../../providers/label-provider/use-labels.cjs.js"),A=require("../../../../helpers/hooks/use-scroll-fade.cjs.js"),v=R=>{const{children:a,className:S,"aria-label":j,"aria-labelledby":y,printVisibility:L="show",overflowMode:r="dropdown"}=R,{getLabel:q}=P.useLabels(),{currentTab:W,setCurrentTab:T}=z.useTabsContext(),h=t.useRef(null),c=t.useRef(null),[d,u]=t.useState(!1),f=t.useRef(!1),b=t.useRef(0);f.current=d;const{scrollRef:w,canScrollStart:C,canScrollEnd:M,handleScroll:N}=A.useScrollFade({direction:"horizontal"}),O=t.useCallback(e=>{c.current=e,r==="scroll"&&w(e)},[r,w]),p=t.useMemo(()=>t.Children.toArray(a).filter(t.isValidElement),[a]),m=t.useMemo(()=>{const e=[];return p.forEach(l=>{const n=l.props;e.push({id:n.id,label:n.children,disabled:n.disabled})}),e},[p]),_=r==="dropdown"&&d&&m.length>1,E=m.filter(e=>e.id!==W),I=e=>{e&&T(e)};return t.useLayoutEffect(()=>{if(r!=="dropdown")return;const e=c.current;!e||f.current||(b.current=e.scrollWidth,e.scrollWidth>e.clientWidth&&e.clientWidth>0&&u(!0))},[r,d,p]),t.useEffect(()=>{if(r!=="dropdown")return;const e=h.current,l=c.current;if(!e||!l)return;const n=()=>{f.current?b.current<=e.clientWidth&&u(!1):l.scrollWidth>l.clientWidth&&l.clientWidth>0&&(b.current=l.scrollWidth,u(!0))},x=new ResizeObserver(n);return x.observe(e),()=>x.disconnect()},[r]),s.jsx(k.Print,{visibility:L,children:s.jsxs("div",{ref:h,className:g.default(i.default["tedi-tabs__list-wrapper"],{[i.default["tedi-tabs__list-wrapper--scroll-fade-left"]]:r==="scroll"&&C,[i.default["tedi-tabs__list-wrapper--scroll-fade-right"]]:r==="scroll"&&M}),children:[s.jsx("div",{ref:O,"data-name":"tabs-list",role:"tablist","aria-label":j,"aria-labelledby":y,className:g.default(i.default["tedi-tabs__list"],{[i.default["tedi-tabs__list--overflow"]]:_},{[i.default["tedi-tabs__list--scroll"]]:r==="scroll"},S),onScroll:r==="scroll"?N:void 0,children:a}),_&&s.jsx("div",{className:i.default["tedi-tabs__more-wrapper"],children:s.jsxs(o.Dropdown,{placement:"bottom-end",children:[s.jsx(o.Dropdown.Trigger,{children:s.jsxs("button",{"data-name":"tabs-more-btn",type:"button",className:i.default["tedi-tabs__more-btn"],children:[q("tabs.more"),s.jsx(D.Icon,{name:"expand_more",size:18})]})}),s.jsx(o.Dropdown.Content,{children:E.map((e,l)=>s.jsx(o.Dropdown.Item,{index:l,disabled:e.disabled,onClick:()=>I(e.id),children:e.label},e.id))})]})})]})})};v.displayName="TabsList";exports.TabsList=v;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PrintProps } from '../../../misc/print/print';
|
|
3
|
+
export interface TabsListProps {
|
|
4
|
+
/**
|
|
5
|
+
* Tab trigger elements
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Additional class name(s)
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Accessible label for the tablist
|
|
14
|
+
*/
|
|
15
|
+
'aria-label'?: string;
|
|
16
|
+
/**
|
|
17
|
+
* ID of element labelling the tablist
|
|
18
|
+
*/
|
|
19
|
+
'aria-labelledby'?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Controls visibility when printing
|
|
22
|
+
* @default 'show'
|
|
23
|
+
*/
|
|
24
|
+
printVisibility?: PrintProps['visibility'];
|
|
25
|
+
/**
|
|
26
|
+
* How to handle tab overflow when tabs don't fit in available space.
|
|
27
|
+
* - 'dropdown': Shows a dropdown button containing overflowing tabs (default)
|
|
28
|
+
* - 'scroll': Enables horizontal scrolling with a fade indicator
|
|
29
|
+
* @default 'dropdown'
|
|
30
|
+
*/
|
|
31
|
+
overflowMode?: 'dropdown' | 'scroll';
|
|
32
|
+
}
|
|
33
|
+
export declare const TabsList: {
|
|
34
|
+
(props: TabsListProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
displayName: string;
|
|
36
|
+
};
|
|
37
|
+
export default TabsList;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as s, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import R from "../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import i, { useRef as n, useState as A, useCallback as P, useLayoutEffect as V, useEffect as B } from "react";
|
|
4
|
+
import { Icon as D } from "../../../base/icon/icon.es.js";
|
|
5
|
+
import { Print as F } from "../../../misc/print/print.es.js";
|
|
6
|
+
import { Dropdown as a } from "../../../overlays/dropdown/dropdown.es.js";
|
|
7
|
+
import l from "../tabs.module.scss.es.js";
|
|
8
|
+
import { useTabsContext as q } from "../tabs-context.es.js";
|
|
9
|
+
import { useLabels as G } from "../../../../providers/label-provider/use-labels.es.js";
|
|
10
|
+
import { useScrollFade as H } from "../../../../helpers/hooks/use-scroll-fade.es.js";
|
|
11
|
+
const J = (S) => {
|
|
12
|
+
const {
|
|
13
|
+
children: c,
|
|
14
|
+
className: W,
|
|
15
|
+
"aria-label": L,
|
|
16
|
+
"aria-labelledby": N,
|
|
17
|
+
printVisibility: C = "show",
|
|
18
|
+
overflowMode: r = "dropdown"
|
|
19
|
+
} = S, { getLabel: T } = G(), { currentTab: x, setCurrentTab: E } = q(), w = n(null), d = n(null), [f, b] = A(!1), m = n(!1), u = n(0);
|
|
20
|
+
m.current = f;
|
|
21
|
+
const {
|
|
22
|
+
scrollRef: _,
|
|
23
|
+
canScrollStart: I,
|
|
24
|
+
canScrollEnd: M,
|
|
25
|
+
handleScroll: O
|
|
26
|
+
} = H({ direction: "horizontal" }), k = P(
|
|
27
|
+
(e) => {
|
|
28
|
+
d.current = e, r === "scroll" && _(e);
|
|
29
|
+
},
|
|
30
|
+
[r, _]
|
|
31
|
+
), p = i.useMemo(() => i.Children.toArray(c).filter(i.isValidElement), [c]), v = i.useMemo(() => {
|
|
32
|
+
const e = [];
|
|
33
|
+
return p.forEach((t) => {
|
|
34
|
+
const o = t.props;
|
|
35
|
+
e.push({ id: o.id, label: o.children, disabled: o.disabled });
|
|
36
|
+
}), e;
|
|
37
|
+
}, [p]), g = r === "dropdown" && f && v.length > 1, z = v.filter((e) => e.id !== x), j = (e) => {
|
|
38
|
+
e && E(e);
|
|
39
|
+
};
|
|
40
|
+
return V(() => {
|
|
41
|
+
if (r !== "dropdown") return;
|
|
42
|
+
const e = d.current;
|
|
43
|
+
!e || m.current || (u.current = e.scrollWidth, e.scrollWidth > e.clientWidth && e.clientWidth > 0 && b(!0));
|
|
44
|
+
}, [r, f, p]), B(() => {
|
|
45
|
+
if (r !== "dropdown") return;
|
|
46
|
+
const e = w.current, t = d.current;
|
|
47
|
+
if (!e || !t) return;
|
|
48
|
+
const o = () => {
|
|
49
|
+
m.current ? u.current <= e.clientWidth && b(!1) : t.scrollWidth > t.clientWidth && t.clientWidth > 0 && (u.current = t.scrollWidth, b(!0));
|
|
50
|
+
}, y = new ResizeObserver(o);
|
|
51
|
+
return y.observe(e), () => y.disconnect();
|
|
52
|
+
}, [r]), /* @__PURE__ */ s(F, { visibility: C, children: /* @__PURE__ */ h(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
ref: w,
|
|
56
|
+
className: R(l["tedi-tabs__list-wrapper"], {
|
|
57
|
+
[l["tedi-tabs__list-wrapper--scroll-fade-left"]]: r === "scroll" && I,
|
|
58
|
+
[l["tedi-tabs__list-wrapper--scroll-fade-right"]]: r === "scroll" && M
|
|
59
|
+
}),
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ s(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
ref: k,
|
|
65
|
+
"data-name": "tabs-list",
|
|
66
|
+
role: "tablist",
|
|
67
|
+
"aria-label": L,
|
|
68
|
+
"aria-labelledby": N,
|
|
69
|
+
className: R(
|
|
70
|
+
l["tedi-tabs__list"],
|
|
71
|
+
{ [l["tedi-tabs__list--overflow"]]: g },
|
|
72
|
+
{ [l["tedi-tabs__list--scroll"]]: r === "scroll" },
|
|
73
|
+
W
|
|
74
|
+
),
|
|
75
|
+
onScroll: r === "scroll" ? O : void 0,
|
|
76
|
+
children: c
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
g && /* @__PURE__ */ s("div", { className: l["tedi-tabs__more-wrapper"], children: /* @__PURE__ */ h(a, { placement: "bottom-end", children: [
|
|
80
|
+
/* @__PURE__ */ s(a.Trigger, { children: /* @__PURE__ */ h("button", { "data-name": "tabs-more-btn", type: "button", className: l["tedi-tabs__more-btn"], children: [
|
|
81
|
+
T("tabs.more"),
|
|
82
|
+
/* @__PURE__ */ s(D, { name: "expand_more", size: 18 })
|
|
83
|
+
] }) }),
|
|
84
|
+
/* @__PURE__ */ s(a.Content, { children: z.map((e, t) => /* @__PURE__ */ s(
|
|
85
|
+
a.Item,
|
|
86
|
+
{
|
|
87
|
+
index: t,
|
|
88
|
+
disabled: e.disabled,
|
|
89
|
+
onClick: () => j(e.id),
|
|
90
|
+
children: e.label
|
|
91
|
+
},
|
|
92
|
+
e.id
|
|
93
|
+
)) })
|
|
94
|
+
] }) })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
) });
|
|
98
|
+
};
|
|
99
|
+
J.displayName = "TabsList";
|
|
100
|
+
export {
|
|
101
|
+
J as TabsList
|
|
102
|
+
};
|