@tedi-design-system/react 19.1.0-rc.2 → 19.1.0-rc.20
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/DESIGN.md +308 -0
- package/README.md +28 -0
- package/_virtual/index.es13.js +2 -2
- package/_virtual/index.es14.js +2 -2
- package/bundle-stats.html +1 -1
- package/community.cjs.js +1 -1
- package/community.es.js +215 -223
- package/component.manifest.json +1234 -0
- package/external/@floating-ui/core/dist/floating-ui.core.es.js +1 -1
- package/external/@floating-ui/dom/dist/floating-ui.dom.es.js +2 -2
- package/external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js +5 -5
- package/external/@mui/x-date-pickers/DatePicker/shared.es.js +1 -1
- package/external/@mui/x-date-pickers/DateTimePicker/shared.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/prop-types/external/react-is/index.cjs.js +1 -1
- package/external/prop-types/external/react-is/index.es.js +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 +3 -3
- package/src/community/components/accordion/accordion.cjs.js +1 -1
- package/src/community/components/accordion/accordion.es.js +14 -9
- package/src/community/components/card/card-notification/card-notification.cjs.js +1 -1
- package/src/community/components/card/card-notification/card-notification.es.js +10 -8
- package/src/community/components/dock-panel/dock-panel.cjs.js +2 -0
- package/src/community/components/dock-panel/dock-panel.d.ts +110 -0
- package/src/community/components/dock-panel/dock-panel.es.js +138 -0
- package/src/community/components/dock-panel/dock-panel.module.scss.cjs.js +1 -0
- package/src/community/components/dock-panel/dock-panel.module.scss.es.js +18 -0
- package/src/community/components/dropdown/dropdown.cjs.js +1 -1
- package/src/community/components/dropdown/dropdown.es.js +34 -32
- package/src/community/components/form/category-search/category-search.cjs.js +1 -0
- package/src/community/components/form/category-search/category-search.d.ts +9 -0
- package/src/community/components/form/category-search/category-search.es.js +297 -0
- package/src/community/components/form/category-search/category-search.module.scss.cjs.js +1 -0
- package/src/community/components/form/category-search/category-search.module.scss.es.js +21 -0
- package/src/community/components/form/category-search/category-search.types.d.ts +162 -0
- package/src/community/components/form/category-search/define-category-search-category.cjs.js +1 -0
- package/src/community/components/form/category-search/define-category-search-category.d.ts +7 -0
- package/src/community/components/form/category-search/define-category-search-category.es.js +25 -0
- package/src/community/components/form/category-search/index.d.ts +3 -0
- package/src/community/components/form/category-search/use-category-search.cjs.js +1 -0
- package/src/community/components/form/category-search/use-category-search.d.ts +17 -0
- package/src/community/components/form/category-search/use-category-search.es.js +64 -0
- package/src/community/components/form/file-upload/file-upload.cjs.js +1 -1
- package/src/community/components/form/file-upload/file-upload.es.js +43 -41
- package/src/community/components/form/pickers/calendar/calendar.cjs.js +1 -1
- package/src/community/components/form/pickers/calendar/calendar.es.js +41 -39
- package/src/community/components/form/pickers/timepicker/timepicker.cjs.js +1 -1
- package/src/community/components/form/pickers/timepicker/timepicker.es.js +33 -31
- package/src/community/components/form/toggle/toggle.cjs.js +1 -1
- package/src/community/components/form/toggle/toggle.es.js +30 -28
- package/src/community/components/map-components/base-map-selection/base-map-option.cjs.js +1 -1
- package/src/community/components/map-components/base-map-selection/base-map-option.d.ts +8 -5
- package/src/community/components/map-components/base-map-selection/base-map-option.es.js +63 -65
- package/src/community/components/map-components/base-map-selection/base-map-selection.cjs.js +1 -1
- package/src/community/components/map-components/base-map-selection/base-map-selection.d.ts +1 -4
- package/src/community/components/map-components/base-map-selection/base-map-selection.es.js +55 -55
- package/src/community/components/map-components/carousel/carousel.cjs.js +1 -1
- package/src/community/components/map-components/carousel/carousel.es.js +19 -17
- package/src/community/components/map-components/map-button/map-button.cjs.js +1 -1
- package/src/community/components/map-components/map-button/map-button.d.ts +12 -4
- package/src/community/components/map-components/map-button/map-button.es.js +43 -40
- package/src/community/components/map-components/map-dropdown/map-dropdown.cjs.js +1 -1
- package/src/community/components/map-components/map-dropdown/map-dropdown.es.js +51 -49
- package/src/community/components/status/status.cjs.js +1 -1
- package/src/community/components/status/status.es.js +14 -12
- package/src/community/components/stepper/stepper.cjs.js +1 -1
- package/src/community/components/stepper/stepper.es.js +33 -31
- package/src/community/components/table/table.cjs.js +1 -1
- package/src/community/components/table/table.es.js +9 -9
- package/src/community/components/table-of-contents/table-of-contents.cjs.js +1 -1
- package/src/community/components/table-of-contents/table-of-contents.es.js +21 -19
- package/src/community/components/tabs/tabs/tabs.cjs.js +1 -1
- package/src/community/components/tabs/tabs/tabs.es.js +29 -27
- package/src/community/components/vertical-stepper/vertical-stepper.cjs.js +1 -1
- package/src/community/components/vertical-stepper/vertical-stepper.es.js +8 -6
- package/src/community/deprecated-exports.cjs.js +1 -0
- package/src/community/deprecated-exports.d.ts +19 -0
- package/src/community/deprecated-exports.es.js +112 -0
- package/src/community/index.d.ts +3 -0
- package/src/tedi/components/content/card/card.d.ts +4 -0
- package/src/tedi/components/content/card/card.module.scss.cjs.js +1 -1
- package/src/tedi/components/content/card/card.module.scss.es.js +3 -2
- package/src/tedi/components/content/carousel/carousel.cjs.js +1 -1
- package/src/tedi/components/content/carousel/carousel.d.ts +5 -0
- package/src/tedi/components/content/carousel/carousel.es.js +20 -20
- package/src/tedi/components/content/carousel/use-carousel.cjs.js +1 -1
- package/src/tedi/components/content/carousel/use-carousel.d.ts +1 -1
- package/src/tedi/components/content/carousel/use-carousel.es.js +127 -127
- package/src/tedi/components/content/table-card/index.d.ts +1 -0
- package/src/tedi/components/content/table-card/table-card.cjs.js +1 -0
- package/src/tedi/components/content/table-card/table-card.d.ts +131 -0
- package/src/tedi/components/content/table-card/table-card.es.js +206 -0
- package/src/tedi/components/content/table-card/table-card.module.scss.cjs.js +1 -0
- package/src/tedi/components/content/table-card/table-card.module.scss.es.js +18 -0
- package/src/tedi/components/content/text-group/text-group-list/text-group-list.cjs.js +1 -1
- package/src/tedi/components/content/text-group/text-group-list/text-group-list.d.ts +42 -0
- package/src/tedi/components/content/text-group/text-group-list/text-group-list.es.js +41 -23
- package/src/tedi/components/content/text-group/text-group.cjs.js +1 -1
- package/src/tedi/components/content/text-group/text-group.d.ts +10 -0
- package/src/tedi/components/content/text-group/text-group.es.js +14 -13
- package/src/tedi/components/content/text-group/text-group.module.scss.cjs.js +1 -1
- package/src/tedi/components/content/text-group/text-group.module.scss.es.js +5 -1
- package/src/tedi/components/filter/filter/filter.cjs.js +1 -1
- package/src/tedi/components/filter/filter/filter.d.ts +5 -0
- package/src/tedi/components/filter/filter/filter.es.js +154 -144
- package/src/tedi/components/filter/filter/filter.module.scss.cjs.js +1 -1
- package/src/tedi/components/filter/filter/filter.module.scss.es.js +2 -1
- package/src/tedi/components/form/date-field/date-field-helpers.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field-helpers.d.ts +12 -19
- package/src/tedi/components/form/date-field/date-field-helpers.es.js +27 -21
- package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field.d.ts +1 -1
- package/src/tedi/components/form/date-field/date-field.es.js +169 -164
- package/src/tedi/components/form/date-time-field/date-time-field.cjs.js +1 -1
- package/src/tedi/components/form/date-time-field/date-time-field.es.js +181 -176
- package/src/tedi/components/form/search/index.d.ts +1 -0
- package/src/tedi/components/form/search/search.cjs.js +1 -1
- package/src/tedi/components/form/search/search.d.ts +92 -1
- package/src/tedi/components/form/search/search.es.js +265 -69
- package/src/tedi/components/form/search/search.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/search/search.module.scss.es.js +9 -1
- package/src/tedi/components/form/slider/slider.cjs.js +1 -1
- package/src/tedi/components/form/slider/slider.es.js +38 -38
- package/src/tedi/components/form/slider/slider.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/slider/slider.module.scss.es.js +0 -1
- package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
- package/src/tedi/components/form/textfield/textfield.es.js +21 -21
- package/src/tedi/components/form/time-field/time-field.cjs.js +1 -1
- package/src/tedi/components/form/time-field/time-field.es.js +126 -124
- package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.cjs.js +1 -1
- package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.d.ts +1 -1
- package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.es.js +28 -27
- package/src/tedi/components/layout/mobile-nav/mobile-nav.cjs.js +1 -1
- package/src/tedi/components/layout/mobile-nav/mobile-nav.d.ts +1 -1
- package/src/tedi/components/layout/mobile-nav/mobile-nav.es.js +124 -92
- package/src/tedi/components/layout/sidenav/sidenav.module.scss.cjs.js +1 -1
- package/src/tedi/components/layout/sidenav/sidenav.module.scss.es.js +1 -0
- package/src/tedi/components/misc/affix/affix.cjs.js +1 -1
- package/src/tedi/components/misc/affix/affix.es.js +20 -8
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-collapsible/table-of-contents-collapsible.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-collapsible/table-of-contents-collapsible.d.ts +9 -1
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-collapsible/table-of-contents-collapsible.es.js +78 -39
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-item/table-of-contents-item.d.ts +6 -0
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.es.js +23 -28
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.d.ts +32 -21
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.es.js +58 -55
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.module.scss.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.module.scss.es.js +4 -1
- package/src/tedi/components/navigation/tabs/tabs-helpers.cjs.js +1 -1
- package/src/tedi/components/navigation/tabs/tabs-helpers.d.ts +5 -0
- package/src/tedi/components/navigation/tabs/tabs-helpers.es.js +7 -4
- package/src/tedi/components/navigation/tabs/tabs-trigger/tabs-trigger.cjs.js +1 -1
- package/src/tedi/components/navigation/tabs/tabs-trigger/tabs-trigger.es.js +17 -17
- package/src/tedi/components/overlays/dropdown/dropdown.cjs.js +1 -1
- package/src/tedi/components/overlays/dropdown/dropdown.d.ts +8 -0
- package/src/tedi/components/overlays/dropdown/dropdown.es.js +82 -72
- package/src/tedi/components/overlays/dropdown/dropdown.module.scss.cjs.js +1 -1
- package/src/tedi/components/overlays/dropdown/dropdown.module.scss.es.js +1 -0
- package/src/tedi/components/overlays/overlay/overlay-trigger.cjs.js +1 -1
- package/src/tedi/components/overlays/overlay/overlay-trigger.es.js +22 -21
- package/src/tedi/helpers/warn-deprecated/warn-deprecated.cjs.js +1 -0
- package/src/tedi/helpers/warn-deprecated/warn-deprecated.d.ts +12 -0
- package/src/tedi/helpers/warn-deprecated/warn-deprecated.es.js +11 -0
- package/src/tedi/index.d.ts +2 -1
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +44 -2
- package/src/tedi/providers/label-provider/labels-map.es.js +43 -1
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +326 -324
|
@@ -1,45 +1,40 @@
|
|
|
1
1
|
import { jsxs as p, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { useContext as
|
|
4
|
-
import { Separator as
|
|
5
|
-
import { TableOfContentsContext as
|
|
2
|
+
import _ from "../../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useContext as j } from "react";
|
|
4
|
+
import { Separator as y } from "../../../../misc/separator/separator.es.js";
|
|
5
|
+
import { TableOfContentsContext as R } from "../../table-of-contents.es.js";
|
|
6
6
|
import t from "../../table-of-contents.module.scss.es.js";
|
|
7
|
-
const
|
|
8
|
-
const { activeId:
|
|
7
|
+
const b = ({ node: u, depth: r, index: i, numberPrefix: s }) => {
|
|
8
|
+
const { activeId: h, numbered: a, activeTrail: v, defaultOpen: N } = j(R), { id: o, content: C, children: n, separator: O, slot: c } = u, $ = !!(n != null && n.length), d = !!o && o === h, w = $ && (N || !!o && v.has(o)), T = Math.min(r, 2), l = s ? `${s}.${i + 1}` : `${i + 1}`, x = s ? l : `${l}.`, g = a ? "ol" : "ul";
|
|
9
9
|
return /* @__PURE__ */ p(
|
|
10
10
|
"li",
|
|
11
11
|
{
|
|
12
|
-
"aria-current":
|
|
13
|
-
className:
|
|
14
|
-
[t["tedi-table-of-contents__item--selected"]]:
|
|
12
|
+
"aria-current": d ? "true" : void 0,
|
|
13
|
+
className: _(t["tedi-table-of-contents__item"], {
|
|
14
|
+
[t["tedi-table-of-contents__item--selected"]]: d
|
|
15
15
|
}),
|
|
16
16
|
children: [
|
|
17
|
-
/* @__PURE__ */ p(
|
|
18
|
-
"span",
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
),
|
|
27
|
-
$ && /* @__PURE__ */ e(T, { className: t["tedi-table-of-contents__group"], children: n.map((m, d) => /* @__PURE__ */ e(
|
|
28
|
-
_,
|
|
17
|
+
/* @__PURE__ */ p("div", { className: _(t["tedi-table-of-contents__row"], t[`tedi-table-of-contents__row--level-${T}`]), children: [
|
|
18
|
+
a && /* @__PURE__ */ e("span", { className: t["tedi-table-of-contents__number"], "aria-hidden": "true", children: x }),
|
|
19
|
+
/* @__PURE__ */ e("span", { className: t["tedi-table-of-contents__content"], children: C }),
|
|
20
|
+
c !== void 0 && /* @__PURE__ */ e("div", { className: t["tedi-table-of-contents__slot"], children: c })
|
|
21
|
+
] }),
|
|
22
|
+
w && /* @__PURE__ */ e(g, { className: t["tedi-table-of-contents__group"], children: n.map((m, f) => /* @__PURE__ */ e(
|
|
23
|
+
b,
|
|
29
24
|
{
|
|
30
25
|
node: m,
|
|
31
|
-
depth:
|
|
32
|
-
index:
|
|
33
|
-
numberPrefix: a ?
|
|
26
|
+
depth: r + 1,
|
|
27
|
+
index: f,
|
|
28
|
+
numberPrefix: a ? l : void 0
|
|
34
29
|
},
|
|
35
|
-
m.id ??
|
|
30
|
+
m.id ?? f
|
|
36
31
|
)) }),
|
|
37
|
-
|
|
32
|
+
O && /* @__PURE__ */ e(y, { className: t["tedi-table-of-contents__separator"] })
|
|
38
33
|
]
|
|
39
34
|
}
|
|
40
35
|
);
|
|
41
36
|
};
|
|
42
|
-
|
|
37
|
+
b.displayName = "TableOfContentsRow";
|
|
43
38
|
export {
|
|
44
|
-
|
|
39
|
+
b as TableOfContentsRow
|
|
45
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),g=require("../../../../../external/classnames/index.cjs.js"),i=require("react"),P=require("../../misc/affix/affix.cjs.js"),S=require("./components/table-of-contents-collapsible/table-of-contents-collapsible.cjs.js"),j=require("./components/table-of-contents-item/table-of-contents-item.cjs.js"),B=require("./components/table-of-contents-list/table-of-contents-list.cjs.js"),f=require("./table-of-contents.module.scss.cjs.js"),M=require("../../../providers/label-provider/use-labels.cjs.js"),w=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),E=require("../../content/card/card.cjs.js"),R=require("../../content/card/card-content/card-content.cjs.js"),y=i.createContext({activeTrail:new Set}),m=t=>i.isValidElement(t)&&t.type===j.TableOfContentsItem,h=t=>i.Children.toArray(t).filter(m).map(l=>{const{id:o,separator:a,slot:c,children:s}=l.props,e=i.Children.toArray(s),n=e.filter(m),d=e.filter(u=>!m(u));return{id:o,separator:a,slot:c,content:r.jsx(r.Fragment,{children:d}),children:n.length?h(s):void 0}}),k=(t,l)=>{const o=new Set;if(!l)return o;const a=(c,s)=>{for(const e of c){const n=e.id?[...s,e.id]:s;if(e.id===l||e.children&&a(e.children,n))return n.forEach(d=>o.add(d)),!0}return!1};return a(t,[]),o};function b(t){const{getLabel:l}=M.useLabels(),{getCurrentBreakpointProps:o}=w.useBreakpointProps(t.defaultServerBreakpoint),{children:a,heading:c,headingLevel:s="h3",ariaLabel:e,activeId:n,defaultOpen:d=!0,numbered:u=!1,sticky:p=!0,variant:x="default",bordered:N=!1,className:L}=o(t),A=c===void 0?l("table-of-contents.title"):c,C=i.useMemo(()=>h(a),[a]),T=i.useMemo(()=>k(C,n),[C,n]),I=i.useMemo(()=>({activeId:n,numbered:u,headingLevel:s,ariaLabel:e,activeTrail:T,defaultOpen:d}),[n,u,s,e,T,d]),v=r.jsx("div",{className:g.default(f.default["tedi-table-of-contents"],{[f.default["tedi-table-of-contents--transparent"]]:x==="transparent",[f.default["tedi-table-of-contents--bordered"]]:N}),children:r.jsx(B.TableOfContentsList,{nodes:C,heading:A})}),O=g.default({[f.default["tedi-table-of-contents--sticky"]]:p},L),q=x==="transparent"?r.jsx("div",{className:O,children:v}):r.jsx(E.Card,{className:O,children:r.jsx(R.CardContent,{padding:0,children:v})});return r.jsx(y.Provider,{value:I,children:p?r.jsx(P.Affix,{position:"sticky",top:1.5,bottom:1.5,children:q}):q})}b.displayName="TableOfContents";b.Item=j.TableOfContentsItem;b.Collapsible=S.TableOfContentsCollapsible;exports.TableOfContents=b;exports.TableOfContentsContext=y;exports.buildActiveTrail=k;exports.childrenToNodes=h;
|
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { BreakpointSupport } from '../../../helpers';
|
|
2
3
|
import { TableOfContentsItemProps } from './components/table-of-contents-item/table-of-contents-item';
|
|
3
|
-
/** Semantic level of the `TableOfContents` heading element. */
|
|
4
4
|
export type TableOfContentsHeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
5
|
-
|
|
5
|
+
type TableOfContentsBreakpointProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Visual variant:
|
|
8
|
+
* - `default` — rendered inside a bordered `Card`.
|
|
9
|
+
* - `transparent` — no card chrome (border / background); the list sits
|
|
10
|
+
* directly on the page, with a continuous grey left rail (the active item's
|
|
11
|
+
* segment turns blue).
|
|
12
|
+
* @default default
|
|
13
|
+
*/
|
|
14
|
+
variant?: 'default' | 'transparent';
|
|
15
|
+
/**
|
|
16
|
+
* Stick the card to the viewport while scrolling.
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
sticky?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export interface TableOfContentsProps extends BreakpointSupport<TableOfContentsBreakpointProps> {
|
|
6
22
|
/**
|
|
7
23
|
* `TableOfContents.Item` elements. An item's non-`Item` children are its
|
|
8
24
|
* link / label; nested `TableOfContents.Item` children become its sub-items.
|
|
@@ -28,36 +44,29 @@ export interface TableOfContentsProps {
|
|
|
28
44
|
*/
|
|
29
45
|
ariaLabel?: string;
|
|
30
46
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* directly on the page, with a continuous grey left rail (the active item's
|
|
35
|
-
* segment turns blue).
|
|
36
|
-
* @default default
|
|
47
|
+
* Id of the currently active item. The active item gets the left accent bar
|
|
48
|
+
* and active link colour. When `defaultOpen` is `false`, the branch leading
|
|
49
|
+
* to it is the only one kept expanded.
|
|
37
50
|
*/
|
|
38
|
-
|
|
51
|
+
activeId?: string;
|
|
39
52
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
53
|
+
* Draws a divider between items so the list reads as a set of separated rows. The last item has no
|
|
54
|
+
* divider — the card border closes the list.
|
|
55
|
+
* @default false
|
|
42
56
|
*/
|
|
43
|
-
|
|
57
|
+
bordered?: boolean;
|
|
44
58
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
59
|
+
* Whether every item's sub-items are expanded by default. Set `false` to make the list behave like
|
|
60
|
+
* an accordion: only the branch leading to `activeId` keeps its nested children visible.
|
|
61
|
+
* @default true
|
|
48
62
|
*/
|
|
49
|
-
|
|
63
|
+
defaultOpen?: boolean;
|
|
50
64
|
/**
|
|
51
65
|
* Render the list as an ordered list with auto-generated hierarchical numbers
|
|
52
66
|
* (`1.`, `2.`, `2.1`, …) shown before each item.
|
|
53
67
|
* @default false
|
|
54
68
|
*/
|
|
55
69
|
numbered?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Stick the card to the viewport while scrolling.
|
|
58
|
-
* @default true
|
|
59
|
-
*/
|
|
60
|
-
sticky?: boolean;
|
|
61
70
|
/**
|
|
62
71
|
* Additional class name on the root element.
|
|
63
72
|
*/
|
|
@@ -69,6 +78,7 @@ export interface TableOfContentsNode {
|
|
|
69
78
|
content: ReactNode;
|
|
70
79
|
children?: TableOfContentsNode[];
|
|
71
80
|
separator?: boolean;
|
|
81
|
+
slot?: ReactNode;
|
|
72
82
|
}
|
|
73
83
|
interface TableOfContentsContextValue {
|
|
74
84
|
activeId?: string;
|
|
@@ -76,6 +86,7 @@ interface TableOfContentsContextValue {
|
|
|
76
86
|
headingLevel?: TableOfContentsHeadingLevel;
|
|
77
87
|
ariaLabel?: string;
|
|
78
88
|
activeTrail: Set<string>;
|
|
89
|
+
defaultOpen?: boolean;
|
|
79
90
|
}
|
|
80
91
|
export declare const TableOfContentsContext: import('react').Context<TableOfContentsContextValue>;
|
|
81
92
|
export declare const childrenToNodes: (children: ReactNode) => TableOfContentsNode[];
|
|
@@ -1,70 +1,73 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { Affix as
|
|
5
|
-
import { TableOfContentsCollapsible as
|
|
6
|
-
import { TableOfContentsItem as
|
|
7
|
-
import { TableOfContentsList as
|
|
8
|
-
import
|
|
9
|
-
import { useLabels as
|
|
1
|
+
import { jsx as o, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import N from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useMemo as p, createContext as E, Children as k, isValidElement as P } from "react";
|
|
4
|
+
import { Affix as S } from "../../misc/affix/affix.es.js";
|
|
5
|
+
import { TableOfContentsCollapsible as V } from "./components/table-of-contents-collapsible/table-of-contents-collapsible.es.js";
|
|
6
|
+
import { TableOfContentsItem as O } from "./components/table-of-contents-item/table-of-contents-item.es.js";
|
|
7
|
+
import { TableOfContentsList as j } from "./components/table-of-contents-list/table-of-contents-list.es.js";
|
|
8
|
+
import m from "./table-of-contents.module.scss.es.js";
|
|
9
|
+
import { useLabels as F } from "../../../providers/label-provider/use-labels.es.js";
|
|
10
|
+
import { useBreakpointProps as H } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
10
11
|
import { Card as M } from "../../content/card/card.es.js";
|
|
11
|
-
import { CardContent as
|
|
12
|
-
const
|
|
12
|
+
import { CardContent as q } from "../../content/card/card-content/card-content.es.js";
|
|
13
|
+
const z = E({
|
|
13
14
|
activeTrail: /* @__PURE__ */ new Set()
|
|
14
|
-
}),
|
|
15
|
-
const { id:
|
|
15
|
+
}), u = (e) => P(e) && e.type === O, x = (e) => k.toArray(e).filter(u).map((a) => {
|
|
16
|
+
const { id: i, separator: s, slot: l, children: r } = a.props, t = k.toArray(r), n = t.filter(u), c = t.filter((d) => !u(d));
|
|
16
17
|
return {
|
|
17
|
-
id:
|
|
18
|
-
separator:
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
id: i,
|
|
19
|
+
separator: s,
|
|
20
|
+
slot: l,
|
|
21
|
+
content: /* @__PURE__ */ o(B, { children: c }),
|
|
22
|
+
children: n.length ? x(r) : void 0
|
|
21
23
|
};
|
|
22
|
-
}),
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
25
|
-
const
|
|
26
|
-
for (const t of
|
|
27
|
-
const
|
|
28
|
-
if (t.id ===
|
|
29
|
-
return
|
|
24
|
+
}), D = (e, a) => {
|
|
25
|
+
const i = /* @__PURE__ */ new Set();
|
|
26
|
+
if (!a) return i;
|
|
27
|
+
const s = (l, r) => {
|
|
28
|
+
for (const t of l) {
|
|
29
|
+
const n = t.id ? [...r, t.id] : r;
|
|
30
|
+
if (t.id === a || t.children && s(t.children, n))
|
|
31
|
+
return n.forEach((c) => i.add(c)), !0;
|
|
30
32
|
}
|
|
31
33
|
return !1;
|
|
32
34
|
};
|
|
33
|
-
return
|
|
35
|
+
return s(e, []), i;
|
|
34
36
|
};
|
|
35
|
-
function
|
|
36
|
-
const { getLabel:
|
|
37
|
-
children:
|
|
38
|
-
heading:
|
|
39
|
-
headingLevel:
|
|
40
|
-
ariaLabel:
|
|
41
|
-
activeId:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
function b(e) {
|
|
38
|
+
const { getLabel: a } = F(), { getCurrentBreakpointProps: i } = H(e.defaultServerBreakpoint), {
|
|
39
|
+
children: s,
|
|
40
|
+
heading: l,
|
|
41
|
+
headingLevel: r = "h3",
|
|
42
|
+
ariaLabel: t,
|
|
43
|
+
activeId: n,
|
|
44
|
+
defaultOpen: c = !0,
|
|
45
|
+
numbered: d = !1,
|
|
46
|
+
sticky: h = !0,
|
|
47
|
+
variant: C = "default",
|
|
48
|
+
bordered: A = !1,
|
|
49
|
+
className: L
|
|
50
|
+
} = i(e), I = l === void 0 ? a("table-of-contents.title") : l, f = p(() => x(s), [s]), v = p(() => D(f, n), [f, n]), w = p(
|
|
51
|
+
() => ({ activeId: n, numbered: d, headingLevel: r, ariaLabel: t, activeTrail: v, defaultOpen: c }),
|
|
52
|
+
[n, d, r, t, v, c]
|
|
53
|
+
), T = /* @__PURE__ */ o(
|
|
51
54
|
"div",
|
|
52
55
|
{
|
|
53
|
-
className:
|
|
54
|
-
[
|
|
56
|
+
className: N(m["tedi-table-of-contents"], {
|
|
57
|
+
[m["tedi-table-of-contents--transparent"]]: C === "transparent",
|
|
58
|
+
[m["tedi-table-of-contents--bordered"]]: A
|
|
55
59
|
}),
|
|
56
|
-
|
|
57
|
-
children: /* @__PURE__ */ r(F, { nodes: d, heading: L })
|
|
60
|
+
children: /* @__PURE__ */ o(j, { nodes: f, heading: I })
|
|
58
61
|
}
|
|
59
|
-
),
|
|
60
|
-
return /* @__PURE__ */
|
|
62
|
+
), g = N({ [m["tedi-table-of-contents--sticky"]]: h }, L), y = C === "transparent" ? /* @__PURE__ */ o("div", { className: g, children: T }) : /* @__PURE__ */ o(M, { className: g, children: /* @__PURE__ */ o(q, { padding: 0, children: T }) });
|
|
63
|
+
return /* @__PURE__ */ o(z.Provider, { value: w, children: h ? /* @__PURE__ */ o(S, { position: "sticky", top: 1.5, bottom: 1.5, children: y }) : y });
|
|
61
64
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
b.displayName = "TableOfContents";
|
|
66
|
+
b.Item = O;
|
|
67
|
+
b.Collapsible = V;
|
|
65
68
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
b as TableOfContents,
|
|
70
|
+
z as TableOfContentsContext,
|
|
71
|
+
D as buildActiveTrail,
|
|
72
|
+
x as childrenToNodes
|
|
70
73
|
};
|
package/src/tedi/components/navigation/table-of-contents/table-of-contents.module.scss.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={"tedi-table-of-contents":"tedi-table-of-contents-ce55e86d","tedi-table-of-contents--transparent":"tedi-table-of-contents--transparent-067ea2c2","tedi-table-of-contents__list":"tedi-table-of-contents__list-94025876","tedi-table-of-contents--sticky":"tedi-table-of-contents--sticky-1ee87047","tedi-table-of-contents__heading":"tedi-table-of-contents__heading-c6b7a6df","tedi-table-of-contents__group":"tedi-table-of-contents__group-590e4963","tedi-table-of-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={"tedi-table-of-contents":"tedi-table-of-contents-ce55e86d","tedi-table-of-contents--bordered":"tedi-table-of-contents--bordered-90b16d0b","tedi-table-of-contents--transparent":"tedi-table-of-contents--transparent-067ea2c2","tedi-table-of-contents__list":"tedi-table-of-contents__list-94025876","tedi-table-of-contents--sticky":"tedi-table-of-contents--sticky-1ee87047","tedi-table-of-contents__heading":"tedi-table-of-contents__heading-c6b7a6df","tedi-table-of-contents__group":"tedi-table-of-contents__group-590e4963","tedi-table-of-contents__item":"tedi-table-of-contents__item-29f072b5","tedi-table-of-contents__row":"tedi-table-of-contents__row-fb686650","tedi-table-of-contents__row--level-2":"tedi-table-of-contents__row--level-2-4fec675b","tedi-table-of-contents__number":"tedi-table-of-contents__number-693b03b7","tedi-table-of-contents__content":"tedi-table-of-contents__content-8a05ad59","tedi-table-of-contents__slot":"tedi-table-of-contents__slot-53aefc57","tedi-table-of-contents__item--selected":"tedi-table-of-contents__item--selected-632958d1","tedi-table-of-contents__separator":"tedi-table-of-contents__separator-b824eeee","tedi-table-of-contents__bar":"tedi-table-of-contents__bar-f4daef0b","tedi-table-of-contents__bar--static":"tedi-table-of-contents__bar--static-f919cf73","tedi-table-of-contents__bar--hidden":"tedi-table-of-contents__bar--hidden-53dd04a2","tedi-table-of-contents__bar-title":"tedi-table-of-contents__bar-title-b82ab4ed","tedi-table-of-contents__sheet":"tedi-table-of-contents__sheet-16e41b54","tedi-table-of-contents__sheet-header":"tedi-table-of-contents__sheet-header-ec904c54"};exports.default=t;
|
package/src/tedi/components/navigation/table-of-contents/table-of-contents.module.scss.es.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
const t = {
|
|
2
2
|
"tedi-table-of-contents": "tedi-table-of-contents-ce55e86d",
|
|
3
|
+
"tedi-table-of-contents--bordered": "tedi-table-of-contents--bordered-90b16d0b",
|
|
3
4
|
"tedi-table-of-contents--transparent": "tedi-table-of-contents--transparent-067ea2c2",
|
|
4
5
|
"tedi-table-of-contents__list": "tedi-table-of-contents__list-94025876",
|
|
5
6
|
"tedi-table-of-contents--sticky": "tedi-table-of-contents--sticky-1ee87047",
|
|
6
7
|
"tedi-table-of-contents__heading": "tedi-table-of-contents__heading-c6b7a6df",
|
|
7
8
|
"tedi-table-of-contents__group": "tedi-table-of-contents__group-590e4963",
|
|
8
|
-
"tedi-table-of-contents__list--headless": "tedi-table-of-contents__list--headless-99c1bab5",
|
|
9
9
|
"tedi-table-of-contents__item": "tedi-table-of-contents__item-29f072b5",
|
|
10
10
|
"tedi-table-of-contents__row": "tedi-table-of-contents__row-fb686650",
|
|
11
11
|
"tedi-table-of-contents__row--level-2": "tedi-table-of-contents__row--level-2-4fec675b",
|
|
12
12
|
"tedi-table-of-contents__number": "tedi-table-of-contents__number-693b03b7",
|
|
13
13
|
"tedi-table-of-contents__content": "tedi-table-of-contents__content-8a05ad59",
|
|
14
|
+
"tedi-table-of-contents__slot": "tedi-table-of-contents__slot-53aefc57",
|
|
14
15
|
"tedi-table-of-contents__item--selected": "tedi-table-of-contents__item--selected-632958d1",
|
|
16
|
+
"tedi-table-of-contents__separator": "tedi-table-of-contents__separator-b824eeee",
|
|
15
17
|
"tedi-table-of-contents__bar": "tedi-table-of-contents__bar-f4daef0b",
|
|
16
18
|
"tedi-table-of-contents__bar--static": "tedi-table-of-contents__bar--static-f919cf73",
|
|
19
|
+
"tedi-table-of-contents__bar--hidden": "tedi-table-of-contents__bar--hidden-53dd04a2",
|
|
17
20
|
"tedi-table-of-contents__bar-title": "tedi-table-of-contents__bar-title-b82ab4ed",
|
|
18
21
|
"tedi-table-of-contents__sheet": "tedi-table-of-contents__sheet-16e41b54",
|
|
19
22
|
"tedi-table-of-contents__sheet-header": "tedi-table-of-contents__sheet-header-ec904c54"
|
|
@@ -1 +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]
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=e=>{e.scrollIntoView({block:"nearest",inline:"nearest"})},s=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(),o(t[r]),t[r]):null};exports.navigateTablist=s;exports.scrollTabIntoView=o;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scrolls a tab fully into view inside a horizontally scrollable tablist.
|
|
3
|
+
* A no-op when the tab is already fully visible.
|
|
4
|
+
*/
|
|
5
|
+
export declare const scrollTabIntoView: (tab: HTMLElement) => void;
|
|
1
6
|
/**
|
|
2
7
|
* Navigates to a sibling tab in the tablist using ArrowLeft/ArrowRight/Home/End keys.
|
|
3
8
|
* Returns the target tab element if navigation occurred, or null otherwise.
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a = (e) => {
|
|
2
|
+
e.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
3
|
+
}, s = (e) => {
|
|
2
4
|
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight" && e.key !== "Home" && e.key !== "End")
|
|
3
5
|
return null;
|
|
4
6
|
const l = e.currentTarget.closest('[role="tablist"]');
|
|
5
7
|
if (!l) return null;
|
|
6
8
|
const t = Array.from(l.querySelectorAll('[role="tab"]:not([disabled])')).filter(
|
|
7
|
-
(
|
|
9
|
+
(o) => getComputedStyle(o).display !== "none"
|
|
8
10
|
), n = t.indexOf(e.currentTarget);
|
|
9
11
|
if (t.length === 0 || n === -1) return null;
|
|
10
12
|
let r = -1;
|
|
@@ -22,8 +24,9 @@ const o = (e) => {
|
|
|
22
24
|
r = t.length - 1;
|
|
23
25
|
break;
|
|
24
26
|
}
|
|
25
|
-
return r !== -1 ? (e.preventDefault(), t[r].focus(), t[r]
|
|
27
|
+
return r !== -1 ? (e.preventDefault(), t[r].focus(), a(t[r]), t[r]) : null;
|
|
26
28
|
};
|
|
27
29
|
export {
|
|
28
|
-
|
|
30
|
+
s as navigateTablist,
|
|
31
|
+
a as scrollTabIntoView
|
|
29
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),x=require("../../../../../../external/classnames/index.cjs.js"),_=require("../../../base/icon/icon.cjs.js"),a=require("../tabs.module.scss.cjs.js"),q=require("../tabs-context.cjs.js"),l=require("../tabs-helpers.cjs.js"),d=b=>{const{id:e,children:u,icon:n,disabled:t=!1,className:g}=b,{currentTab:T,setCurrentTab:i}=q.useTabsContext(),r=T===e,f=s=>{t||(i(e),l.scrollTabIntoView(s.currentTarget))},m=s=>{const o=l.navigateTablist(s);o&&i(o.id)};return c.jsxs("button",{"data-name":"tabs-trigger",id:e,role:"tab",type:"button","aria-selected":r,"aria-controls":`${e}-panel`,tabIndex:r?0:-1,disabled:t,className:x.default(a.default["tedi-tabs__trigger"],{[a.default["tedi-tabs__trigger--selected"]]:r},{[a.default["tedi-tabs__trigger--disabled"]]:t},g),onClick:f,onKeyDown:m,children:[n&&c.jsx(_.Icon,{name:n,size:18,color:"inherit"}),u]})};d.displayName="TabsTrigger";exports.TabsTrigger=d;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs as p, jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as p, jsx as T } from "react/jsx-runtime";
|
|
2
|
+
import f from "../../../../../../external/classnames/index.es.js";
|
|
3
3
|
import { Icon as u } from "../../../base/icon/icon.es.js";
|
|
4
4
|
import s from "../tabs.module.scss.es.js";
|
|
5
5
|
import { useTabsContext as _ } from "../tabs-context.es.js";
|
|
6
|
-
import { navigateTablist as h } from "../tabs-helpers.es.js";
|
|
7
|
-
const
|
|
8
|
-
const { id: e, children:
|
|
9
|
-
t ||
|
|
10
|
-
},
|
|
11
|
-
const
|
|
12
|
-
|
|
6
|
+
import { navigateTablist as h, scrollTabIntoView as x } from "../tabs-helpers.es.js";
|
|
7
|
+
const y = (c) => {
|
|
8
|
+
const { id: e, children: l, icon: i, disabled: t = !1, className: d } = c, { currentTab: m, setCurrentTab: o } = _(), r = m === e, b = (a) => {
|
|
9
|
+
t || (o(e), x(a.currentTarget));
|
|
10
|
+
}, g = (a) => {
|
|
11
|
+
const n = h(a);
|
|
12
|
+
n && o(n.id);
|
|
13
13
|
};
|
|
14
14
|
return /* @__PURE__ */ p(
|
|
15
15
|
"button",
|
|
@@ -22,22 +22,22 @@ const x = (n) => {
|
|
|
22
22
|
"aria-controls": `${e}-panel`,
|
|
23
23
|
tabIndex: r ? 0 : -1,
|
|
24
24
|
disabled: t,
|
|
25
|
-
className:
|
|
25
|
+
className: f(
|
|
26
26
|
s["tedi-tabs__trigger"],
|
|
27
27
|
{ [s["tedi-tabs__trigger--selected"]]: r },
|
|
28
28
|
{ [s["tedi-tabs__trigger--disabled"]]: t },
|
|
29
|
-
|
|
29
|
+
d
|
|
30
30
|
),
|
|
31
|
-
onClick:
|
|
32
|
-
onKeyDown:
|
|
31
|
+
onClick: b,
|
|
32
|
+
onKeyDown: g,
|
|
33
33
|
children: [
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
i && /* @__PURE__ */ T(u, { name: i, size: 18, color: "inherit" }),
|
|
35
|
+
l
|
|
36
36
|
]
|
|
37
37
|
}
|
|
38
38
|
);
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
y.displayName = "TabsTrigger";
|
|
41
41
|
export {
|
|
42
|
-
|
|
42
|
+
y as TabsTrigger
|
|
43
43
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),e=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),A=require("../../../../../external/classnames/index.cjs.js"),t=require("react"),v=require("./dropdown.module.scss.cjs.js"),z=require("./dropdown-content/dropdown-content.cjs.js"),G=require("./dropdown-context.cjs.js"),J=require("./dropdown-helpers.cjs.js"),K=require("./dropdown-item/dropdown-item.cjs.js"),Q=require("./dropdown-separator/dropdown-separator.cjs.js"),V=require("./dropdown-trigger/dropdown-trigger.cjs.js"),X=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),Y=require("../../../providers/label-provider/use-labels.cjs.js"),Z=require("../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),x=require("../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),ee=4,a=h=>{var O;const{getCurrentBreakpointProps:b}=X.useBreakpointProps(h.defaultServerBreakpoint),{children:F,modal:q=!1,divided:P=!1,width:R="auto",variant:p="default",open:f,defaultOpen:y=!1,onOpenChange:l,defaultActiveIndex:n,placement:g="bottom-start",maxHeight:c,className:j}=b(h),{getLabel:N}=Y.useLabels(),_=e.useFloatingNodeId(),D=t.useRef([]),[u,m]=t.useState(n??null),[w,k]=t.useState(null),[B,T]=t.useState(y),o=f??B;t.useEffect(()=>{o||m(n??null)},[o,n]);const I=t.useCallback(i=>{f===void 0&&T(i),l==null||l(i)},[f,l]),U=e.useFloating({nodeId:_,open:o,placement:g,onOpenChange:I,middleware:[x.offset(ee),x.flip(),x.shift()],whileElementsMounted:Z.autoUpdate}),{context:r,refs:s,x:H,y:L,strategy:M}=U,C=e.useInteractions([e.useClick(r),e.useRole(r,{role:"menu"}),e.useDismiss(r),e.useListNavigation(r,{listRef:D,activeIndex:u,onNavigate:m,loop:!0,selectedIndex:n??null,focusItemOnOpen:n!==null?!0:"auto"})]),W={open:o,setOpen:I,refs:s,listItemsRef:D,activeIndex:u,setActiveIndex:m,placement:g,content:w,setContent:k,divided:P,variant:p,...C},E=(O=s.reference.current)==null?void 0:O.getBoundingClientRect().width,$=t.useMemo(()=>{const i=s.reference.current;if(!i)return;const S=i.offsetParent;if(S)return S.getBoundingClientRect().width},[s.reference.current]);return d.jsxs(G.DropdownContext.Provider,{value:W,children:[F,d.jsx(e.FloatingPortal,{children:o&&d.jsx(e.FloatingFocusManager,{context:r,modal:q,visuallyHiddenDismiss:q?N("close"):!1,children:d.jsx("div",{...C.getFloatingProps({ref:s.setFloating,className:A.default(v.default["tedi-dropdown"],{[v.default[`tedi-dropdown--${p}`]]:p==="tree"},j),style:{position:M,left:H??0,top:L??0,width:J.resolveDropdownWidth(R,E,$)},role:"menu","aria-orientation":"vertical","aria-activedescendant":u!==null?`dropdown-item-${u}`:void 0}),"data-placement":g,"data-state":o?"open":"closed",children:c!==void 0?d.jsx("div",{className:v.default["tedi-dropdown__scroll"],role:"group",tabIndex:0,style:{maxHeight:typeof c=="number"?`${c}px`:c},children:w}):w})})})]})};a.Trigger=V.DropdownTrigger;a.Content=z.DropdownContent;a.Item=K.DropdownItem;a.Separator=Q.DropdownSeparator;exports.Dropdown=a;
|
|
@@ -34,6 +34,14 @@ type DropdownBreakpointProps = {
|
|
|
34
34
|
* @default 'default'
|
|
35
35
|
*/
|
|
36
36
|
variant?: 'default' | 'tree';
|
|
37
|
+
/**
|
|
38
|
+
* Restricts the height of the dropdown's scrollable body. When the content is taller,
|
|
39
|
+
* the body scrolls vertically while any sticky regions (e.g. a Filter search / clear) stay pinned.
|
|
40
|
+
* - `number` – fixed max height in pixels
|
|
41
|
+
* - `string` – any valid CSS length (e.g. `'20rem'`, `'50vh'`)
|
|
42
|
+
* @default undefined (no restriction)
|
|
43
|
+
*/
|
|
44
|
+
maxHeight?: number | string;
|
|
37
45
|
};
|
|
38
46
|
export interface DropdownProps extends BreakpointSupport<DropdownBreakpointProps> {
|
|
39
47
|
/**
|