@tedi-design-system/react 18.0.0-rc.1 → 18.0.0-rc.11
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.cjs10.js +1 -1
- package/_virtual/index.cjs11.js +1 -1
- package/_virtual/index.cjs12.js +1 -1
- package/_virtual/index.cjs13.js +1 -1
- package/_virtual/index.cjs5.js +1 -1
- package/_virtual/index.cjs6.js +1 -1
- package/_virtual/index.cjs7.js +1 -1
- package/_virtual/index.cjs8.js +1 -1
- package/_virtual/index.cjs9.js +1 -1
- package/_virtual/index.es10.js +1 -1
- package/_virtual/index.es11.js +1 -1
- package/_virtual/index.es12.js +1 -1
- package/_virtual/index.es13.js +2 -4
- package/_virtual/index.es14.js +2 -2
- package/_virtual/index.es5.js +4 -2
- package/_virtual/index.es6.js +1 -1
- package/_virtual/index.es7.js +1 -1
- package/_virtual/index.es8.js +1 -1
- package/_virtual/index.es9.js +1 -1
- package/bundle-stats.html +1 -1
- package/external/@floating-ui/core/dist/floating-ui.core.cjs.js +1 -1
- package/external/@floating-ui/core/dist/floating-ui.core.es.js +275 -271
- package/external/@floating-ui/dom/dist/floating-ui.dom.cjs.js +1 -1
- package/external/@floating-ui/dom/dist/floating-ui.dom.es.js +189 -188
- package/external/@floating-ui/react/dist/floating-ui.react.cjs.js +1 -1
- package/external/@floating-ui/react/dist/floating-ui.react.es.js +1419 -1538
- package/external/@floating-ui/react/dist/floating-ui.react.utils.cjs.js +1 -1
- package/external/@floating-ui/react/dist/floating-ui.react.utils.es.js +348 -81
- package/external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js +1 -1
- package/external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js +113 -93
- package/external/@floating-ui/utils/dist/floating-ui.utils.cjs.js +1 -1
- package/external/@floating-ui/utils/dist/floating-ui.utils.dom.cjs.js +1 -1
- package/external/@floating-ui/utils/dist/floating-ui.utils.dom.es.js +97 -97
- package/external/@floating-ui/utils/dist/floating-ui.utils.es.js +66 -68
- package/external/@mui/system/colorManipulator.cjs.js +1 -1
- package/external/@mui/system/colorManipulator.es.js +2 -2
- package/external/@mui/system/createStyled.cjs.js +1 -1
- package/external/@mui/system/createStyled.es.js +6 -6
- package/external/@mui/system/useThemeWithoutDefault.cjs.js +1 -1
- package/external/@mui/system/useThemeWithoutDefault.es.js +1 -1
- package/external/lodash-es/_baseUnset.cjs.js +1 -1
- package/external/lodash-es/_baseUnset.es.js +12 -19
- package/external/react-is/index.cjs.js +1 -1
- package/external/react-is/index.es.js +1 -1
- package/external/tabbable/dist/index.esm.cjs.js +1 -1
- package/external/tabbable/dist/index.esm.es.js +72 -63
- package/external/toposort/index.cjs.js +1 -1
- package/external/toposort/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +4 -4
- package/src/community/components/form/pickers/calendar/calendar.d.ts +6 -0
- package/src/community/components/form/pickers/datepicker/datepicker.d.ts +6 -0
- package/src/community/components/form/pickers/datetimepicker/datetimepicker.d.ts +6 -0
- package/src/community/components/form/pickers/timepicker/timepicker.d.ts +6 -0
- package/src/community/components/modal/modal-closer.d.ts +6 -0
- package/src/community/components/modal/modal-provider.d.ts +6 -0
- package/src/community/components/modal/modal-trigger.d.ts +6 -0
- package/src/community/components/modal/modal.d.ts +6 -0
- package/src/community/components/placeholder/placeholder.d.ts +5 -0
- package/src/tedi/components/buttons/button-group/button-group.cjs.js +1 -1
- package/src/tedi/components/buttons/button-group/button-group.es.js +4 -4
- package/src/tedi/components/buttons/collapse/collapse.cjs.js +1 -1
- package/src/tedi/components/buttons/collapse/collapse.d.ts +23 -0
- package/src/tedi/components/buttons/collapse/collapse.es.js +62 -59
- package/src/tedi/components/buttons/collapse/collapse.module.scss.cjs.js +1 -1
- package/src/tedi/components/buttons/collapse/collapse.module.scss.es.js +2 -1
- package/src/tedi/components/content/calendar/calendar-grid.cjs.js +1 -1
- package/src/tedi/components/content/calendar/calendar-grid.es.js +7 -6
- package/src/tedi/components/content/calendar/calendar.cjs.js +1 -1
- package/src/tedi/components/content/calendar/calendar.d.ts +9 -1
- package/src/tedi/components/content/calendar/calendar.es.js +72 -71
- package/src/tedi/components/content/calendar/calendar.module.scss.cjs.js +1 -1
- package/src/tedi/components/content/calendar/calendar.module.scss.es.js +3 -2
- package/src/tedi/components/content/calendar/components/calendar-header/calendar-header.cjs.js +1 -1
- package/src/tedi/components/content/calendar/components/calendar-header/calendar-header.es.js +99 -79
- package/src/tedi/components/content/table/index.d.ts +6 -0
- package/src/tedi/components/content/table/table-columns-menu/table-columns-menu.cjs.js +1 -0
- package/src/tedi/components/content/table/table-columns-menu/table-columns-menu.d.ts +15 -0
- package/src/tedi/components/content/table/table-columns-menu/table-columns-menu.es.js +37 -0
- package/src/tedi/components/content/table/table-context.cjs.js +1 -0
- package/src/tedi/components/content/table/table-context.d.ts +3 -0
- package/src/tedi/components/content/table/table-context.es.js +11 -0
- package/src/tedi/components/content/table/table-header-button/table-header-button.cjs.js +1 -0
- package/src/tedi/components/content/table/table-header-button/table-header-button.d.ts +51 -0
- package/src/tedi/components/content/table/table-header-button/table-header-button.es.js +42 -0
- package/src/tedi/components/content/table/table-header-button/table-header-button.module.scss.cjs.js +1 -0
- package/src/tedi/components/content/table/table-header-button/table-header-button.module.scss.es.js +7 -0
- package/src/tedi/components/content/table/table-toolbar/table-toolbar.cjs.js +1 -0
- package/src/tedi/components/content/table/table-toolbar/table-toolbar.d.ts +21 -0
- package/src/tedi/components/content/table/table-toolbar/table-toolbar.es.js +9 -0
- package/src/tedi/components/content/table/table.cjs.js +1 -0
- package/src/tedi/components/content/table/table.d.ts +519 -0
- package/src/tedi/components/content/table/table.es.js +856 -0
- package/src/tedi/components/content/table/table.module.scss.cjs.js +1 -0
- package/src/tedi/components/content/table/table.module.scss.es.js +54 -0
- package/src/tedi/components/content/table/use-table-persistence.cjs.js +1 -0
- package/src/tedi/components/content/table/use-table-persistence.d.ts +13 -0
- package/src/tedi/components/content/table/use-table-persistence.es.js +53 -0
- package/src/tedi/components/filter/filter/filter-group-context.cjs.js +1 -0
- package/src/tedi/components/filter/filter/filter-group-context.d.ts +8 -0
- package/src/tedi/components/filter/filter/filter-group-context.es.js +5 -0
- package/src/tedi/components/filter/filter/filter-group.cjs.js +1 -0
- package/src/tedi/components/filter/filter/filter-group.d.ts +94 -0
- package/src/tedi/components/filter/filter/filter-group.es.js +64 -0
- package/src/tedi/components/filter/filter/filter.cjs.js +1 -0
- package/src/tedi/components/filter/filter/filter.d.ts +98 -0
- package/src/tedi/components/filter/filter/filter.es.js +236 -0
- package/src/tedi/components/filter/filter/filter.module.scss.cjs.js +1 -0
- package/src/tedi/components/filter/filter/filter.module.scss.es.js +21 -0
- package/src/tedi/components/filter/filter/index.d.ts +3 -0
- package/src/tedi/components/form/date-field/date-field-helpers.cjs.js +1 -0
- package/src/tedi/components/form/date-field/date-field-helpers.d.ts +66 -0
- package/src/tedi/components/form/date-field/date-field-helpers.es.js +28 -0
- package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field.d.ts +22 -0
- package/src/tedi/components/form/date-field/date-field.es.js +248 -212
- package/src/tedi/components/form/date-time-field/date-time-field.cjs.js +1 -0
- package/src/tedi/components/form/date-time-field/date-time-field.d.ts +207 -0
- package/src/tedi/components/form/date-time-field/date-time-field.es.js +376 -0
- package/src/tedi/components/form/date-time-field/date-time-field.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/date-time-field/date-time-field.module.scss.es.js +30 -0
- package/src/tedi/components/form/input-group/components/input/input.cjs.js +1 -1
- package/src/tedi/components/form/input-group/components/input/input.es.js +14 -13
- package/src/tedi/components/form/input-group/components/prefix/prefix.cjs.js +1 -1
- package/src/tedi/components/form/input-group/components/prefix/prefix.es.js +16 -16
- package/src/tedi/components/form/input-group/components/suffix/suffix.cjs.js +1 -1
- package/src/tedi/components/form/input-group/components/suffix/suffix.es.js +12 -12
- package/src/tedi/components/form/input-group/input-group.cjs.js +1 -1
- package/src/tedi/components/form/input-group/input-group.d.ts +13 -0
- package/src/tedi/components/form/input-group/input-group.es.js +47 -45
- package/src/tedi/components/form/input-group/input-group.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/input-group/input-group.module.scss.es.js +2 -0
- package/src/tedi/components/form/search/search.cjs.js +1 -1
- package/src/tedi/components/form/search/search.es.js +22 -20
- package/src/tedi/components/form/time-field/time-field.cjs.js +1 -1
- package/src/tedi/components/form/time-field/time-field.d.ts +9 -0
- package/src/tedi/components/form/time-field/time-field.es.js +80 -78
- package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.cjs.js +1 -0
- package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.d.ts +52 -0
- package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.es.js +68 -0
- package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.module.scss.cjs.js +1 -0
- package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.module.scss.es.js +9 -0
- package/src/tedi/components/layout/mobile-nav/index.d.ts +2 -0
- package/src/tedi/components/layout/mobile-nav/mobile-nav.cjs.js +1 -0
- package/src/tedi/components/layout/mobile-nav/mobile-nav.d.ts +20 -0
- package/src/tedi/components/layout/{sidenav/components/sidenav-mobile/sidenav-mobile.es.js → mobile-nav/mobile-nav.es.js} +21 -20
- package/src/tedi/components/layout/sidenav/index.d.ts +2 -2
- package/src/tedi/components/layout/sidenav/sidenav.cjs.js +1 -1
- package/src/tedi/components/layout/sidenav/sidenav.d.ts +2 -11
- package/src/tedi/components/layout/sidenav/sidenav.es.js +27 -27
- package/src/tedi/components/layout/top-nav/components/top-nav-group/top-nav-group.cjs.js +1 -0
- package/src/tedi/components/layout/top-nav/components/top-nav-group/top-nav-group.d.ts +34 -0
- package/src/tedi/components/layout/top-nav/components/top-nav-group/top-nav-group.es.js +33 -0
- package/src/tedi/components/layout/top-nav/components/top-nav-item/top-nav-item.cjs.js +1 -0
- package/src/tedi/components/layout/top-nav/components/top-nav-item/top-nav-item.d.ts +66 -0
- package/src/tedi/components/layout/top-nav/components/top-nav-item/top-nav-item.es.js +101 -0
- package/src/tedi/components/layout/top-nav/components/top-nav-separator/top-nav-separator.cjs.js +1 -0
- package/src/tedi/components/layout/top-nav/components/top-nav-separator/top-nav-separator.d.ts +11 -0
- package/src/tedi/components/layout/top-nav/components/top-nav-separator/top-nav-separator.es.js +9 -0
- package/src/tedi/components/layout/top-nav/components/top-nav-subitem/top-nav-subitem.cjs.js +1 -0
- package/src/tedi/components/layout/top-nav/components/top-nav-subitem/top-nav-subitem.d.ts +28 -0
- package/src/tedi/components/layout/top-nav/components/top-nav-subitem/top-nav-subitem.es.js +30 -0
- package/src/tedi/components/layout/top-nav/index.d.ts +5 -0
- package/src/tedi/components/layout/top-nav/top-nav-context.cjs.js +1 -0
- package/src/tedi/components/layout/top-nav/top-nav-context.d.ts +11 -0
- package/src/tedi/components/layout/top-nav/top-nav-context.es.js +6 -0
- package/src/tedi/components/layout/top-nav/top-nav.cjs.js +1 -0
- package/src/tedi/components/layout/top-nav/top-nav.d.ts +91 -0
- package/src/tedi/components/layout/top-nav/top-nav.es.js +171 -0
- package/src/tedi/components/layout/top-nav/top-nav.module.scss.cjs.js +1 -0
- package/src/tedi/components/layout/top-nav/top-nav.module.scss.es.js +28 -0
- package/src/tedi/components/navigation/pagination/index.d.ts +1 -0
- package/src/tedi/components/navigation/pagination/pagination-mobile-modal/pagination-mobile-modal.cjs.js +1 -0
- package/src/tedi/components/navigation/pagination/pagination-mobile-modal/pagination-mobile-modal.d.ts +36 -0
- package/src/tedi/components/navigation/pagination/pagination-mobile-modal/pagination-mobile-modal.es.js +65 -0
- package/src/tedi/components/navigation/pagination/pagination-mobile-modal/pagination-mobile-modal.module.scss.cjs.js +1 -0
- package/src/tedi/components/navigation/pagination/pagination-mobile-modal/pagination-mobile-modal.module.scss.es.js +13 -0
- package/src/tedi/components/navigation/pagination/pagination.cjs.js +1 -1
- package/src/tedi/components/navigation/pagination/pagination.d.ts +115 -13
- package/src/tedi/components/navigation/pagination/pagination.es.js +244 -96
- package/src/tedi/components/navigation/pagination/pagination.module.scss.cjs.js +1 -1
- package/src/tedi/components/navigation/pagination/pagination.module.scss.es.js +18 -1
- package/src/tedi/components/notifications/alert/alert.cjs.js +1 -1
- package/src/tedi/components/notifications/alert/alert.d.ts +14 -1
- package/src/tedi/components/notifications/alert/alert.es.js +45 -42
- package/src/tedi/components/notifications/alert/alert.module.scss.cjs.js +1 -1
- package/src/tedi/components/notifications/alert/alert.module.scss.es.js +2 -1
- package/src/tedi/components/overlays/dropdown/dropdown.es.js +0 -3
- package/src/tedi/components/overlays/modal/index.d.ts +8 -0
- package/src/tedi/components/overlays/modal/modal-body/modal-body.cjs.js +1 -0
- package/src/tedi/components/overlays/modal/modal-body/modal-body.d.ts +22 -0
- package/src/tedi/components/overlays/modal/modal-body/modal-body.es.js +21 -0
- package/src/tedi/components/overlays/modal/modal-closer/modal-closer.cjs.js +1 -0
- package/src/tedi/components/overlays/modal/modal-closer/modal-closer.d.ts +15 -0
- package/src/tedi/components/overlays/modal/modal-closer/modal-closer.es.js +16 -0
- package/src/tedi/components/overlays/modal/modal-content/modal-content.cjs.js +1 -0
- package/src/tedi/components/overlays/modal/modal-content/modal-content.d.ts +108 -0
- package/src/tedi/components/overlays/modal/modal-content/modal-content.es.js +81 -0
- package/src/tedi/components/overlays/modal/modal-context.cjs.js +1 -0
- package/src/tedi/components/overlays/modal/modal-context.d.ts +59 -0
- package/src/tedi/components/overlays/modal/modal-context.es.js +15 -0
- package/src/tedi/components/overlays/modal/modal-footer/modal-footer.cjs.js +1 -0
- package/src/tedi/components/overlays/modal/modal-footer/modal-footer.d.ts +22 -0
- package/src/tedi/components/overlays/modal/modal-footer/modal-footer.es.js +25 -0
- package/src/tedi/components/overlays/modal/modal-header/modal-header.cjs.js +1 -0
- package/src/tedi/components/overlays/modal/modal-header/modal-header.d.ts +58 -0
- package/src/tedi/components/overlays/modal/modal-header/modal-header.es.js +25 -0
- package/src/tedi/components/overlays/modal/modal-trigger/modal-trigger.cjs.js +1 -0
- package/src/tedi/components/overlays/modal/modal-trigger/modal-trigger.d.ts +13 -0
- package/src/tedi/components/overlays/modal/modal-trigger/modal-trigger.es.js +14 -0
- package/src/tedi/components/overlays/modal/modal.cjs.js +1 -0
- package/src/tedi/components/overlays/modal/modal.d.ts +68 -0
- package/src/tedi/components/overlays/modal/modal.es.js +76 -0
- package/src/tedi/components/overlays/modal/modal.module.scss.cjs.js +1 -0
- package/src/tedi/components/overlays/modal/modal.module.scss.es.js +37 -0
- package/src/tedi/components/overlays/overlay/overlay-content.cjs.js +1 -1
- package/src/tedi/components/overlays/overlay/overlay-content.es.js +35 -32
- package/src/tedi/components/overlays/tooltip/tooltip.cjs.js +1 -1
- package/src/tedi/components/overlays/tooltip/tooltip.es.js +14 -6
- package/src/tedi/helpers/hooks/use-breakpoint.cjs.js +1 -1
- package/src/tedi/helpers/hooks/use-breakpoint.d.ts +7 -0
- package/src/tedi/helpers/hooks/use-breakpoint.es.js +22 -14
- package/src/tedi/helpers/hooks/use-sidenav-state.d.ts +1 -1
- package/src/tedi/index.d.ts +6 -0
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +174 -6
- package/src/tedi/providers/label-provider/labels-map.es.js +234 -57
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +257 -202
- package/src/tedi/components/layout/sidenav/components/sidenav-mobile/sidenav-mobile.cjs.js +0 -1
- package/src/tedi/components/layout/sidenav/components/sidenav-mobile/sidenav-mobile.d.ts +0 -14
- package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.cjs.js +0 -1
- package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.d.ts +0 -31
- package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.es.js +0 -48
- package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.module.scss.cjs.js +0 -1
- package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.module.scss.es.js +0 -8
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { jsx as u, jsxs as ae } from "react/jsx-runtime";
|
|
2
|
+
import ue from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import R, { useState as P, useEffect as g, useMemo as c, useCallback as ce, useRef as le, useId as me, Children as l, isValidElement as w, Fragment as D } from "react";
|
|
4
|
+
import { MobileNav as de } from "../mobile-nav/mobile-nav.es.js";
|
|
5
|
+
import { TopNavGroup as F } from "./components/top-nav-group/top-nav-group.es.js";
|
|
6
|
+
import { TopNavItem as M } from "./components/top-nav-item/top-nav-item.es.js";
|
|
7
|
+
import { TopNavSeparator as H } from "./components/top-nav-separator/top-nav-separator.es.js";
|
|
8
|
+
import { TopNavSubItem as K } from "./components/top-nav-subitem/top-nav-subitem.es.js";
|
|
9
|
+
import f from "./top-nav.module.scss.es.js";
|
|
10
|
+
import { TopNavContext as fe } from "./top-nav-context.es.js";
|
|
11
|
+
import { useBreakpoint as ve, isBreakpointBelow as be, BREAKPOINT_WIDTHS as V } from "../../../helpers/hooks/use-breakpoint.es.js";
|
|
12
|
+
const he = (n) => {
|
|
13
|
+
if (!(n === void 0 || n === "none" || n === 0))
|
|
14
|
+
return typeof n == "string" && n !== "xs" && n in V ? V[n] : n;
|
|
15
|
+
}, q = (n) => {
|
|
16
|
+
const r = [];
|
|
17
|
+
return l.forEach(n, (t) => {
|
|
18
|
+
if (w(t)) {
|
|
19
|
+
if (t.type === D) {
|
|
20
|
+
r.push(...q(t.props.children));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
(t.type === M || t.type === H) && r.push(t);
|
|
24
|
+
}
|
|
25
|
+
}), r;
|
|
26
|
+
}, j = (n) => n.type === M, Ie = (n) => ({
|
|
27
|
+
children: n.props.children,
|
|
28
|
+
href: n.props.href,
|
|
29
|
+
isActive: n.props.isActive,
|
|
30
|
+
onClick: n.props.onClick
|
|
31
|
+
}), $ = (n) => {
|
|
32
|
+
if (!n) return;
|
|
33
|
+
const r = [];
|
|
34
|
+
return l.forEach(n, (t) => {
|
|
35
|
+
if (!w(t)) return;
|
|
36
|
+
if (t.type === D) {
|
|
37
|
+
const s = $(t.props.children);
|
|
38
|
+
s && r.push(...s);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (t.type !== F) return;
|
|
42
|
+
const b = t.props, p = [];
|
|
43
|
+
l.forEach(b.children, (s) => {
|
|
44
|
+
w(s) && s.type === K && p.push(Ie(s));
|
|
45
|
+
}), p.length > 0 && r.push({ subHeading: b.title, subItems: p });
|
|
46
|
+
}), r.length > 0 ? r : void 0;
|
|
47
|
+
}, v = (n) => {
|
|
48
|
+
const {
|
|
49
|
+
children: r,
|
|
50
|
+
ariaLabel: t,
|
|
51
|
+
mobileBreakpoint: b = "md",
|
|
52
|
+
isMobileOpen: p,
|
|
53
|
+
onMenuToggle: s,
|
|
54
|
+
showMobileOverlay: z = !0,
|
|
55
|
+
className: T,
|
|
56
|
+
id: J,
|
|
57
|
+
submenuFit: Q = "full",
|
|
58
|
+
maxWidth: U = "xxl"
|
|
59
|
+
} = n, X = ve(), C = be(X, b), h = p !== void 0, [Y, B] = P(!1), Z = h ? p : Y;
|
|
60
|
+
g(() => {
|
|
61
|
+
!h && !C && B(!1);
|
|
62
|
+
}, [C, h]);
|
|
63
|
+
const ee = (e) => {
|
|
64
|
+
h || B(e), s == null || s(e);
|
|
65
|
+
}, E = c(() => q(r), [r]), a = c(() => E.filter(j), [E]), O = (e) => !e.props.href && l.count(e.props.submenu) > 0, _ = c(() => {
|
|
66
|
+
const e = a.findIndex((o) => O(o) && o.props.isActive);
|
|
67
|
+
return e === -1 ? null : e;
|
|
68
|
+
}, [a]), [I, m] = P(_);
|
|
69
|
+
g(() => {
|
|
70
|
+
m(_);
|
|
71
|
+
}, [_]);
|
|
72
|
+
const A = ce(() => m(null), []), ne = c(() => ({ closeSubmenu: A }), [A]), x = le(null), y = me();
|
|
73
|
+
g(() => {
|
|
74
|
+
if (I === null) return;
|
|
75
|
+
const e = (i) => {
|
|
76
|
+
x.current && !x.current.contains(i.target) && m(null);
|
|
77
|
+
}, o = (i) => {
|
|
78
|
+
var S;
|
|
79
|
+
if (i.key !== "Escape") return;
|
|
80
|
+
const d = (S = x.current) == null ? void 0 : S.querySelector(
|
|
81
|
+
`[aria-controls="${CSS.escape(y)}"][aria-expanded="true"]`
|
|
82
|
+
);
|
|
83
|
+
d == null || d.focus(), m(null);
|
|
84
|
+
};
|
|
85
|
+
return document.addEventListener("mousedown", e), document.addEventListener("keydown", o), () => {
|
|
86
|
+
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", o);
|
|
87
|
+
};
|
|
88
|
+
}, [I, y]);
|
|
89
|
+
const W = (e, o) => O(e) ? I === o : !!e.props.isActive, L = c(
|
|
90
|
+
() => a.find((e, o) => W(e, o) && l.count(e.props.submenu) > 0),
|
|
91
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
92
|
+
[a, I]
|
|
93
|
+
), te = c(
|
|
94
|
+
() => a.map((e) => ({
|
|
95
|
+
children: e.props.children,
|
|
96
|
+
disabled: e.props.disabled,
|
|
97
|
+
href: e.props.href,
|
|
98
|
+
icon: e.props.icon,
|
|
99
|
+
isActive: e.props.isActive,
|
|
100
|
+
onClick: e.props.onClick,
|
|
101
|
+
subItemGroups: $(e.props.submenu)
|
|
102
|
+
})),
|
|
103
|
+
[a]
|
|
104
|
+
);
|
|
105
|
+
if (C)
|
|
106
|
+
return /* @__PURE__ */ u(
|
|
107
|
+
de,
|
|
108
|
+
{
|
|
109
|
+
navItems: te,
|
|
110
|
+
ariaLabel: t,
|
|
111
|
+
isOpen: Z,
|
|
112
|
+
onClose: () => ee(!1),
|
|
113
|
+
showOverlay: z,
|
|
114
|
+
className: T
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
const G = Q === "content", N = he(U);
|
|
118
|
+
let oe = 0;
|
|
119
|
+
return /* @__PURE__ */ u(fe.Provider, { value: ne, children: /* @__PURE__ */ ae(
|
|
120
|
+
"nav",
|
|
121
|
+
{
|
|
122
|
+
ref: x,
|
|
123
|
+
id: J,
|
|
124
|
+
className: ue(f["tedi-top-nav"], T),
|
|
125
|
+
"aria-label": t,
|
|
126
|
+
"data-name": "top-nav",
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ u("div", { className: f["tedi-top-nav__bar"], children: /* @__PURE__ */ u(
|
|
129
|
+
"ul",
|
|
130
|
+
{
|
|
131
|
+
className: f["tedi-top-nav__list"],
|
|
132
|
+
style: N !== void 0 ? { maxWidth: N } : void 0,
|
|
133
|
+
children: E.map((e, o) => {
|
|
134
|
+
if (j(e)) {
|
|
135
|
+
const i = oe++, d = l.count(e.props.submenu) > 0, S = O(e), re = W(e, i), k = e.props.onClick, se = S ? (ie) => {
|
|
136
|
+
k == null || k(ie), m((pe) => pe === i ? null : i);
|
|
137
|
+
} : k;
|
|
138
|
+
return R.cloneElement(e, {
|
|
139
|
+
key: o,
|
|
140
|
+
hasSubmenu: d,
|
|
141
|
+
renderSubmenuInline: G,
|
|
142
|
+
isSubmenuOpen: re,
|
|
143
|
+
panelId: y,
|
|
144
|
+
onClick: se
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
return R.cloneElement(e, { key: o });
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
) }),
|
|
151
|
+
!G && L && /* @__PURE__ */ u("div", { id: y, className: f["tedi-top-nav__submenu"], "data-name": "top-nav-submenu", children: /* @__PURE__ */ u(
|
|
152
|
+
"div",
|
|
153
|
+
{
|
|
154
|
+
className: f["tedi-top-nav__submenu-inner"],
|
|
155
|
+
style: N !== void 0 ? { maxWidth: N } : void 0,
|
|
156
|
+
children: L.props.submenu
|
|
157
|
+
}
|
|
158
|
+
) })
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
) });
|
|
162
|
+
};
|
|
163
|
+
v.displayName = "TopNav";
|
|
164
|
+
v.Item = M;
|
|
165
|
+
v.Group = F;
|
|
166
|
+
v.SubItem = K;
|
|
167
|
+
v.Separator = H;
|
|
168
|
+
export {
|
|
169
|
+
v as TopNav,
|
|
170
|
+
v as default
|
|
171
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={"tedi-top-nav":"tedi-top-nav-7985280d","tedi-top-nav__bar":"tedi-top-nav__bar-d7be6587","tedi-top-nav__list":"tedi-top-nav__list-1cdecbe8","tedi-top-nav__item":"tedi-top-nav__item-aa7109b8","tedi-top-nav__item--has-inline-submenu":"tedi-top-nav__item--has-inline-submenu-4d48fa95","tedi-top-nav__link":"tedi-top-nav__link-724c1ebc","tedi-top-nav__link--active":"tedi-top-nav__link--active-34580ede","tedi-top-nav__icon":"tedi-top-nav__icon-1ab6c34d","tedi-top-nav__chevron":"tedi-top-nav__chevron-e05880f8","tedi-top-nav__chevron--open":"tedi-top-nav__chevron--open-ef97d87b","tedi-top-nav__separator":"tedi-top-nav__separator-d1e8646d","tedi-top-nav__separator-line":"tedi-top-nav__separator-line-4777819a","tedi-top-nav__submenu":"tedi-top-nav__submenu-9b591c05","tedi-top-nav__submenu-inner":"tedi-top-nav__submenu-inner-7a7895b2","tedi-top-nav__submenu--inline":"tedi-top-nav__submenu--inline-b4debcfa","tedi-top-nav__submenu-inner--inline":"tedi-top-nav__submenu-inner--inline-c5cd3a64","tedi-top-nav__group":"tedi-top-nav__group-691df203","tedi-top-nav__group-title":"tedi-top-nav__group-title-70faf48a","tedi-top-nav__group-icon":"tedi-top-nav__group-icon-792cee8c","tedi-top-nav__group-list":"tedi-top-nav__group-list-88ee40bb","tedi-top-nav__subitem":"tedi-top-nav__subitem-d8c89fc6","tedi-top-nav__subitem-link":"tedi-top-nav__subitem-link-382e3910","tedi-top-nav__subitem-link--active":"tedi-top-nav__subitem-link--active-d0f16d73"};exports.default=t;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const t = {
|
|
2
|
+
"tedi-top-nav": "tedi-top-nav-7985280d",
|
|
3
|
+
"tedi-top-nav__bar": "tedi-top-nav__bar-d7be6587",
|
|
4
|
+
"tedi-top-nav__list": "tedi-top-nav__list-1cdecbe8",
|
|
5
|
+
"tedi-top-nav__item": "tedi-top-nav__item-aa7109b8",
|
|
6
|
+
"tedi-top-nav__item--has-inline-submenu": "tedi-top-nav__item--has-inline-submenu-4d48fa95",
|
|
7
|
+
"tedi-top-nav__link": "tedi-top-nav__link-724c1ebc",
|
|
8
|
+
"tedi-top-nav__link--active": "tedi-top-nav__link--active-34580ede",
|
|
9
|
+
"tedi-top-nav__icon": "tedi-top-nav__icon-1ab6c34d",
|
|
10
|
+
"tedi-top-nav__chevron": "tedi-top-nav__chevron-e05880f8",
|
|
11
|
+
"tedi-top-nav__chevron--open": "tedi-top-nav__chevron--open-ef97d87b",
|
|
12
|
+
"tedi-top-nav__separator": "tedi-top-nav__separator-d1e8646d",
|
|
13
|
+
"tedi-top-nav__separator-line": "tedi-top-nav__separator-line-4777819a",
|
|
14
|
+
"tedi-top-nav__submenu": "tedi-top-nav__submenu-9b591c05",
|
|
15
|
+
"tedi-top-nav__submenu-inner": "tedi-top-nav__submenu-inner-7a7895b2",
|
|
16
|
+
"tedi-top-nav__submenu--inline": "tedi-top-nav__submenu--inline-b4debcfa",
|
|
17
|
+
"tedi-top-nav__submenu-inner--inline": "tedi-top-nav__submenu-inner--inline-c5cd3a64",
|
|
18
|
+
"tedi-top-nav__group": "tedi-top-nav__group-691df203",
|
|
19
|
+
"tedi-top-nav__group-title": "tedi-top-nav__group-title-70faf48a",
|
|
20
|
+
"tedi-top-nav__group-icon": "tedi-top-nav__group-icon-792cee8c",
|
|
21
|
+
"tedi-top-nav__group-list": "tedi-top-nav__group-list-88ee40bb",
|
|
22
|
+
"tedi-top-nav__subitem": "tedi-top-nav__subitem-d8c89fc6",
|
|
23
|
+
"tedi-top-nav__subitem-link": "tedi-top-nav__subitem-link-382e3910",
|
|
24
|
+
"tedi-top-nav__subitem-link--active": "tedi-top-nav__subitem-link--active-d0f16d73"
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
t as default
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),c=require("../../../../../../external/classnames/index.cjs.js"),u=require("react"),o=require("../../../overlays/modal/modal.cjs.js"),l=require("./pagination-mobile-modal.module.scss.cjs.js"),d=m=>{const{open:n,onOpenChange:s,options:b,selectedValue:f,onSelect:_,ariaLabel:g,title:r,ariaCurrent:p="true"}=m,t=u.useRef(null);u.useEffect(()=>{if(!n)return;const e=requestAnimationFrame(()=>{var i;typeof((i=t.current)==null?void 0:i.scrollIntoView)=="function"&&t.current.scrollIntoView({block:"start"})});return()=>cancelAnimationFrame(e)},[n]);const M=e=>{_(e),s(!1)};return a.jsx(o.Modal,{open:n,onToggle:s,children:a.jsxs(o.Modal.Content,{size:"small",position:"bottom",initialFocus:t,"aria-label":r?void 0:g,className:l.default["tedi-pagination-mobile-modal__content"],children:[a.jsx(o.Modal.Header,{title:r,closeButtonProps:{className:l.default["tedi-pagination-mobile-modal__close"]}}),a.jsx(o.Modal.Body,{children:a.jsx("ul",{className:l.default["tedi-pagination-mobile-modal__list"],children:b.map(e=>{const i=e.value===f;return a.jsx("li",{children:a.jsxs("button",{ref:i?t:void 0,type:"button",className:c.default(l.default["tedi-pagination-mobile-modal__item"],{[l.default["tedi-pagination-mobile-modal__item--selected"]]:i}),"aria-current":i?p:void 0,"aria-label":e.ariaLabel,onClick:()=>M(e.value),children:[a.jsx("span",{className:c.default(l.default["tedi-pagination-mobile-modal__radio"],{[l.default["tedi-pagination-mobile-modal__radio--selected"]]:i}),"aria-hidden":"true"}),a.jsx("span",{className:l.default["tedi-pagination-mobile-modal__label"],children:e.label})]})},e.value)})})})]})})};d.displayName="PaginationMobileModal";exports.PaginationMobileModal=d;exports.default=d;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface PaginationMobileModalOption {
|
|
2
|
+
/** Value emitted when this option is selected. */
|
|
3
|
+
value: number;
|
|
4
|
+
/** Visible label inside the row. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Full accessible name for the row's button. */
|
|
7
|
+
ariaLabel: string;
|
|
8
|
+
}
|
|
9
|
+
export interface PaginationMobileModalProps {
|
|
10
|
+
/** Whether the modal is open. */
|
|
11
|
+
open: boolean;
|
|
12
|
+
/** Callback when the modal opens or closes (e.g. dismiss via backdrop or Escape). */
|
|
13
|
+
onOpenChange: (open: boolean) => void;
|
|
14
|
+
/** Options listed in the picker. */
|
|
15
|
+
options: PaginationMobileModalOption[];
|
|
16
|
+
/** Currently selected value — drives the active row styling. */
|
|
17
|
+
selectedValue: number;
|
|
18
|
+
/** Fires with the chosen value. The modal closes automatically. */
|
|
19
|
+
onSelect: (value: number) => void;
|
|
20
|
+
/** Accessible name for the modal dialog (used when `title` is omitted). */
|
|
21
|
+
ariaLabel: string;
|
|
22
|
+
/** Optional heading rendered in the modal header. */
|
|
23
|
+
title?: string;
|
|
24
|
+
/** `aria-current` value set on the selected row. @default 'true' */
|
|
25
|
+
ariaCurrent?: 'page' | 'step' | 'true';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Mobile option-picker modal — one row per option with a radio-style indicator
|
|
29
|
+
* on the active one. Used by `Pagination` below `md` for both the page picker
|
|
30
|
+
* and the page-size picker.
|
|
31
|
+
*/
|
|
32
|
+
export declare const PaginationMobileModal: {
|
|
33
|
+
(props: PaginationMobileModalProps): JSX.Element;
|
|
34
|
+
displayName: string;
|
|
35
|
+
};
|
|
36
|
+
export default PaginationMobileModal;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as l, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import m from "../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useRef as h, useEffect as N } from "react";
|
|
4
|
+
import { Modal as o } from "../../../overlays/modal/modal.es.js";
|
|
5
|
+
import a from "./pagination-mobile-modal.module.scss.es.js";
|
|
6
|
+
const v = (c) => {
|
|
7
|
+
const { open: n, onOpenChange: r, options: u, selectedValue: p, onSelect: b, ariaLabel: f, title: s, ariaCurrent: _ = "true" } = c, t = h(null);
|
|
8
|
+
N(() => {
|
|
9
|
+
if (!n) return;
|
|
10
|
+
const e = requestAnimationFrame(() => {
|
|
11
|
+
var i;
|
|
12
|
+
typeof ((i = t.current) == null ? void 0 : i.scrollIntoView) == "function" && t.current.scrollIntoView({ block: "start" });
|
|
13
|
+
});
|
|
14
|
+
return () => cancelAnimationFrame(e);
|
|
15
|
+
}, [n]);
|
|
16
|
+
const g = (e) => {
|
|
17
|
+
b(e), r(!1);
|
|
18
|
+
};
|
|
19
|
+
return /* @__PURE__ */ l(o, { open: n, onToggle: r, children: /* @__PURE__ */ d(
|
|
20
|
+
o.Content,
|
|
21
|
+
{
|
|
22
|
+
size: "small",
|
|
23
|
+
position: "bottom",
|
|
24
|
+
initialFocus: t,
|
|
25
|
+
"aria-label": s ? void 0 : f,
|
|
26
|
+
className: a["tedi-pagination-mobile-modal__content"],
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ l(o.Header, { title: s, closeButtonProps: { className: a["tedi-pagination-mobile-modal__close"] } }),
|
|
29
|
+
/* @__PURE__ */ l(o.Body, { children: /* @__PURE__ */ l("ul", { className: a["tedi-pagination-mobile-modal__list"], children: u.map((e) => {
|
|
30
|
+
const i = e.value === p;
|
|
31
|
+
return /* @__PURE__ */ l("li", { children: /* @__PURE__ */ d(
|
|
32
|
+
"button",
|
|
33
|
+
{
|
|
34
|
+
ref: i ? t : void 0,
|
|
35
|
+
type: "button",
|
|
36
|
+
className: m(a["tedi-pagination-mobile-modal__item"], {
|
|
37
|
+
[a["tedi-pagination-mobile-modal__item--selected"]]: i
|
|
38
|
+
}),
|
|
39
|
+
"aria-current": i ? _ : void 0,
|
|
40
|
+
"aria-label": e.ariaLabel,
|
|
41
|
+
onClick: () => g(e.value),
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ l(
|
|
44
|
+
"span",
|
|
45
|
+
{
|
|
46
|
+
className: m(a["tedi-pagination-mobile-modal__radio"], {
|
|
47
|
+
[a["tedi-pagination-mobile-modal__radio--selected"]]: i
|
|
48
|
+
}),
|
|
49
|
+
"aria-hidden": "true"
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ l("span", { className: a["tedi-pagination-mobile-modal__label"], children: e.label })
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
) }, e.value);
|
|
56
|
+
}) }) })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
) });
|
|
60
|
+
};
|
|
61
|
+
v.displayName = "PaginationMobileModal";
|
|
62
|
+
export {
|
|
63
|
+
v as PaginationMobileModal,
|
|
64
|
+
v as default
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i={"tedi-pagination-mobile-modal__content":"tedi-pagination-mobile-modal__content-aeaa35e4","tedi-pagination-mobile-modal__close":"tedi-pagination-mobile-modal__close-f2be0c6d","tedi-pagination-mobile-modal__list":"tedi-pagination-mobile-modal__list-6731fe96","tedi-pagination-mobile-modal__item":"tedi-pagination-mobile-modal__item-e21bf884","tedi-pagination-mobile-modal__item--selected":"tedi-pagination-mobile-modal__item--selected-9c438a43","tedi-pagination-mobile-modal__radio":"tedi-pagination-mobile-modal__radio-09dfef50","tedi-pagination-mobile-modal__radio--selected":"tedi-pagination-mobile-modal__radio--selected-0dd20206","tedi-pagination-mobile-modal__label":"tedi-pagination-mobile-modal__label-d13b1631"};exports.default=i;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const i = {
|
|
2
|
+
"tedi-pagination-mobile-modal__content": "tedi-pagination-mobile-modal__content-aeaa35e4",
|
|
3
|
+
"tedi-pagination-mobile-modal__close": "tedi-pagination-mobile-modal__close-f2be0c6d",
|
|
4
|
+
"tedi-pagination-mobile-modal__list": "tedi-pagination-mobile-modal__list-6731fe96",
|
|
5
|
+
"tedi-pagination-mobile-modal__item": "tedi-pagination-mobile-modal__item-e21bf884",
|
|
6
|
+
"tedi-pagination-mobile-modal__item--selected": "tedi-pagination-mobile-modal__item--selected-9c438a43",
|
|
7
|
+
"tedi-pagination-mobile-modal__radio": "tedi-pagination-mobile-modal__radio-09dfef50",
|
|
8
|
+
"tedi-pagination-mobile-modal__radio--selected": "tedi-pagination-mobile-modal__radio--selected-0dd20206",
|
|
9
|
+
"tedi-pagination-mobile-modal__label": "tedi-pagination-mobile-modal__label-d13b1631"
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
i as default
|
|
13
|
+
};
|
|
@@ -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 a=require("react/jsx-runtime"),k=require("../../../../../external/classnames/index.cjs.js"),n=require("react"),B=require("../../base/icon/icon.cjs.js"),te=require("../../base/typography/text/text.cjs.js"),q=require("../../buttons/button/button.cjs.js"),Re=require("../../form/select/select.cjs.js"),t=require("./pagination.module.scss.cjs.js"),ie=require("./pagination-mobile-modal/pagination-mobile-modal.cjs.js"),we=require("./use-pagination.cjs.js"),ne=require("../../../helpers/hooks/use-breakpoint.cjs.js"),Ce=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),Ae=require("../../../providers/label-provider/use-labels.cjs.js"),se=["xs","sm","md","lg","xl","xxl"],T=(c,v)=>c===void 0||c===!1?!1:c===!0?!0:v?se.indexOf(v)<se.indexOf(c):!1,I=n.forwardRef((c,v)=>{var Y;const{pageCount:l,page:_,defaultPage:le=1,onPageChange:S,totalItems:$,pageSize:p,pageSizeOptions:m,onPageSizeChange:g,labels:E,hideResults:re=!1,hidePageSize:oe=!1,hidePager:ue=!1,className:de}=c,{getCurrentBreakpointProps:ce}=Ce.useBreakpointProps(c.defaultServerBreakpoint),{boundaryCount:pe=1,siblingCount:ge=1,background:V="white",borders:fe="top",showPrevNextButtons:H=!1,showEdgeNavLabels:O=!1,previousIcon:be="arrow_back",nextIcon:_e="arrow_forward",arrowVariant:me="default"}=ce(c),{getLabel:o}=Ae.useLabels(),j=ne.useBreakpoint(),h=ne.isBreakpointBelow(j,"md"),s=n.useMemo(()=>({ariaLabel:o("pagination.title"),previous:o("pagination.prev-page"),next:o("pagination.next-page"),pageAriaLabel:e=>o("pagination.page",e,!1),currentPageAriaLabel:e=>o("pagination.page",e,!0),results:e=>o("pagination.results",e),pageSize:o("pagination.page-size"),pageStatus:(e,i)=>o("pagination.page-status",e,i),...E}),[o,E]),[N,R]=n.useState(le),he=_??N,u=l>0?Math.max(1,Math.min(l,he)):1;n.useEffect(()=>{_===void 0&&(l>0&&N>l?R(l):N<1&&R(1))},[_,l,N]);const z=we.usePagination({page:u,pageCount:l,boundaryCount:pe,siblingCount:ge}),P=n.useCallback(e=>{e!==null&&(e===u||e<1||e>l||(_===void 0&&R(e),S==null||S(e)))},[u,S,_,l]),xe=n.useId(),x=n.useMemo(()=>Array.isArray(m)?m.map(e=>typeof e=="number"?{value:e,label:String(e)}:e):[],[m]),y=n.useMemo(()=>x.map(e=>({value:String(e.value),label:e.label})),[x]),w=n.useMemo(()=>p===void 0?y[0]??null:y.find(e=>e.value===String(p))??null,[p,y]),ve=n.useCallback(e=>{const i=Array.isArray(e)?e[0]:e;i&&"value"in i&&(g==null||g(Number(i.value)))},[g]),Se=w?Number(w.value):p??0,F=((Y=x.find(e=>e.value===p))==null?void 0:Y.label)??(p!==void 0?String(p):""),je=n.useMemo(()=>Array.from({length:l},(e,i)=>{const r=i+1;return{value:r,label:String(r),ariaLabel:r===u?s.currentPageAriaLabel(r):s.pageAriaLabel(r)}}),[l,u,s]),Ne=n.useMemo(()=>x.map(e=>({value:e.value,label:e.label,ariaLabel:`${s.pageSize} ${e.label}`})),[x,s]),ze=T(re,j),Pe=T(oe,j),ye=T(ue,j),K=!ze&&$!==void 0,C=!Pe&&Array.isArray(m)&&m.length>0,A=!ye&&l>1,Le=k.default(t.default["tedi-pagination"],t.default[`tedi-pagination--bg-${V}`],V!=="transparent"&&t.default[`tedi-pagination--borders-${fe}`],{[t.default["tedi-pagination--no-pager"]]:!A,[t.default["tedi-pagination--no-results"]]:!K,[t.default["tedi-pagination--no-page-size"]]:!C},de),[f,D]=n.useState(!1),U=n.useRef(null),G=n.useRef(f);n.useEffect(()=>{var e;G.current&&!f&&((e=U.current)==null||e.focus()),G.current=f},[f]);const[b,J]=n.useState(!1),Q=n.useRef(null),W=n.useRef(b);n.useEffect(()=>{var e;W.current&&!b&&((e=Q.current)==null||e.focus()),W.current=b},[b]);const Me=l>1?s.pageStatus(u,l):"",ke=`${`${u} / ${l}`}, ${s.ariaLabel}`,L=z[0],M=z[z.length-1],Oe=z.slice(1,-1),X=(e,i,r,d)=>{const Z=t.default[`tedi-pagination__button--nav-${e}`];if(me==="primary")return a.jsx(q.Button,{type:"button",visualType:"primary",size:"small",iconLeft:e==="previous"?r:void 0,iconRight:e==="next"?r:void 0,className:Z,disabled:i==null?void 0:i.disabled,onClick:()=>P((i==null?void 0:i.page)??null),children:d});const ee=a.jsx(B.Icon,{name:r,size:18,color:"inherit"}),ae=a.jsx("span",{className:t.default["tedi-pagination__nav-label"],children:d});return a.jsx(q.Button,{className:k.default(t.default["tedi-pagination__button"],t.default["tedi-pagination__button--nav"],Z,{[t.default["tedi-pagination__button--nav-link"]]:O}),"aria-label":d,disabled:i==null?void 0:i.disabled,onClick:()=>P((i==null?void 0:i.page)??null),visualType:"neutral",size:"small",icon:O?void 0:r,children:O&&(e==="previous"?a.jsxs(a.Fragment,{children:[ee,ae]}):a.jsxs(a.Fragment,{children:[ae,ee]}))})};return a.jsxs("div",{ref:v,className:Le,"data-name":"tedi-pagination",children:[a.jsx("span",{className:t.default["tedi-pagination__status"],role:"status","aria-live":"polite","aria-atomic":"true",children:Me}),a.jsx("div",{className:t.default["tedi-pagination__slot-start"],children:K&&a.jsx(te.Text,{className:t.default["tedi-pagination__results"],color:"secondary",modifiers:"small",children:s.results($)})}),a.jsx("div",{className:t.default["tedi-pagination__slot-center"],children:A&&a.jsxs("nav",{"aria-label":s.ariaLabel,className:t.default["tedi-pagination__nav"],children:[!H&&(L!=null&&L.disabled)?null:X("previous",L,be,s.previous),!h&&a.jsx("ul",{className:t.default["tedi-pagination__list"],children:Oe.map((e,i)=>{const r=`slot-${i}`;if(e.type==="ellipsis")return a.jsx("li",{className:k.default(t.default["tedi-pagination__item"],t.default["tedi-pagination__item--ellipsis"]),"aria-hidden":"true",children:"…"},r);const d=e.page;return a.jsx("li",{className:t.default["tedi-pagination__item"],children:a.jsx(q.Button,{type:"button",className:k.default(t.default["tedi-pagination__button"],{[t.default["tedi-pagination__button--selected"]]:e.selected}),"aria-label":e.selected?s.currentPageAriaLabel(d):s.pageAriaLabel(d),"aria-current":e.selected?"page":void 0,onClick:()=>P(d),noStyle:!0,children:a.jsx("span",{className:t.default["tedi-pagination__button-label"],children:d},d)})},r)})}),h&&a.jsxs("button",{ref:U,type:"button",className:t.default["tedi-pagination__mobile-trigger"],"aria-haspopup":"dialog","aria-expanded":f,"aria-label":ke,onClick:()=>D(!0),children:[a.jsxs("span",{className:t.default["tedi-pagination__mobile-trigger-label"],"aria-hidden":"true",children:[a.jsx("strong",{children:u}),a.jsx("span",{children:"/"}),a.jsx("span",{children:l})]}),a.jsx(B.Icon,{name:"arrow_drop_down",size:24,color:"inherit"})]}),!H&&(M!=null&&M.disabled)?null:X("next",M,_e,s.next)]})}),a.jsx("div",{className:t.default["tedi-pagination__slot-end"],children:C&&a.jsxs("div",{className:t.default["tedi-pagination__page-size"],children:[a.jsx(te.Text,{className:t.default["tedi-pagination__page-size-label"],color:"secondary",modifiers:"small",element:"span",children:s.pageSize}),h?a.jsxs("button",{ref:Q,type:"button",className:t.default["tedi-pagination__mobile-trigger"],"aria-haspopup":"dialog","aria-expanded":b,"aria-label":`${s.pageSize} ${F}`,onClick:()=>J(!0),children:[a.jsx("span",{className:t.default["tedi-pagination__mobile-trigger-label"],"aria-hidden":"true",children:F}),a.jsx(B.Icon,{name:"arrow_drop_down",size:24,color:"inherit"})]}):a.jsx(Re.Select,{id:`tedi-pagination-page-size-${xe}`,className:t.default["tedi-pagination__select"],label:s.pageSize,hideLabel:!0,size:"small",options:y,value:w,onChange:ve,isSearchable:!1,isClearable:!1})]})}),h&&A&&a.jsx(ie.PaginationMobileModal,{open:f,onOpenChange:D,options:je,selectedValue:u,onSelect:P,ariaLabel:s.ariaLabel,ariaCurrent:"page"}),h&&C&&a.jsx(ie.PaginationMobileModal,{open:b,onOpenChange:J,options:Ne,selectedValue:Se,onSelect:e=>g==null?void 0:g(e),ariaLabel:s.pageSize,title:s.pageSize})]})});I.displayName="Pagination";exports.Pagination=I;exports.default=I;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Breakpoint, BreakpointSupport } from '../../../helpers';
|
|
1
3
|
export type PaginationItemType = 'page' | 'previous' | 'next' | 'ellipsis';
|
|
2
4
|
export interface PaginationItem {
|
|
3
5
|
type: PaginationItemType;
|
|
@@ -5,6 +7,13 @@ export interface PaginationItem {
|
|
|
5
7
|
selected: boolean;
|
|
6
8
|
disabled: boolean;
|
|
7
9
|
}
|
|
10
|
+
export type PaginationBackground = 'white' | 'transparent';
|
|
11
|
+
export type PaginationBorders = 'top' | 'bottom' | 'both' | 'none';
|
|
12
|
+
export type PaginationVisibility = boolean | Exclude<Breakpoint, 'xs'>;
|
|
13
|
+
export interface PaginationPageSizeOption {
|
|
14
|
+
value: number;
|
|
15
|
+
label: string;
|
|
16
|
+
}
|
|
8
17
|
export interface PaginationLabels {
|
|
9
18
|
/**
|
|
10
19
|
* Accessible label for the nav wrapper.
|
|
@@ -33,16 +42,99 @@ export interface PaginationLabels {
|
|
|
33
42
|
currentPageAriaLabel: (page: number) => string;
|
|
34
43
|
/**
|
|
35
44
|
* Rendered to the left of the pagination nav when `totalItems` is set.
|
|
45
|
+
* Returns any React node, so consumers can mix copy with formatting markup
|
|
46
|
+
* (e.g. a bold count or a status badge) — not just a plain string.
|
|
36
47
|
* @default (count) => `${count} results`
|
|
37
48
|
*/
|
|
38
|
-
results: (count: number) =>
|
|
49
|
+
results: (count: number) => ReactNode;
|
|
39
50
|
/**
|
|
40
51
|
* Prefix label for the page-size select.
|
|
41
52
|
* @default 'Show per page'
|
|
42
53
|
*/
|
|
43
54
|
pageSize: string;
|
|
55
|
+
/**
|
|
56
|
+
* Announcement for the polite aria-live region when the page changes.
|
|
57
|
+
* Lets screen reader users know they moved without stealing focus.
|
|
58
|
+
* @default (page, total) => `Page ${page} of ${total}`
|
|
59
|
+
*/
|
|
60
|
+
pageStatus: (page: number, pageCount: number) => string;
|
|
44
61
|
}
|
|
45
|
-
|
|
62
|
+
type PaginationBreakpointProps = {
|
|
63
|
+
/**
|
|
64
|
+
* Number of pages always shown at the start and end of the range before
|
|
65
|
+
* ellipsis kicks in.
|
|
66
|
+
* @default 1
|
|
67
|
+
*/
|
|
68
|
+
boundaryCount?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Number of sibling pages shown on either side of the current page.
|
|
71
|
+
* @default 1
|
|
72
|
+
*/
|
|
73
|
+
siblingCount?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Background variant. `transparent` removes the surface fill — use it when
|
|
76
|
+
* pagination sits on a non-white container. Border behaviour is controlled
|
|
77
|
+
* separately via `borders`.
|
|
78
|
+
* @default white
|
|
79
|
+
*/
|
|
80
|
+
background?: PaginationBackground;
|
|
81
|
+
/**
|
|
82
|
+
* Where the separator border is drawn around the pagination strip:
|
|
83
|
+
* - `'top'` (default) — separator above only (typical "table then pager"
|
|
84
|
+
* layout).
|
|
85
|
+
* - `'both'` — separator above and below (split layout where the pager is
|
|
86
|
+
* sandwiched between content rows, e.g. a fixed header table + a footer
|
|
87
|
+
* beneath the pager).
|
|
88
|
+
* - `'none'` — borderless, for embedded contexts where the outer container
|
|
89
|
+
* already provides framing.
|
|
90
|
+
*
|
|
91
|
+
* Ignored when `background='transparent'` — that variant is always borderless.
|
|
92
|
+
* @default top
|
|
93
|
+
*/
|
|
94
|
+
borders?: PaginationBorders;
|
|
95
|
+
/**
|
|
96
|
+
* Keep the Previous / Next buttons visible even when they would be disabled
|
|
97
|
+
* (Previous on the first page, Next on the last). Default `false` drops the
|
|
98
|
+
* disabled edge button entirely — compact layout. Set `true` to keep both
|
|
99
|
+
* buttons rendered (disabled) at the edges so the pager width stays stable.
|
|
100
|
+
* @default false
|
|
101
|
+
*/
|
|
102
|
+
showPrevNextButtons?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Show the textual `previous` / `next` labels alongside the arrow icons on
|
|
105
|
+
* the edge nav buttons. The labels are sourced from `labels.previous` /
|
|
106
|
+
* `labels.next` (or the corresponding i18n keys). Default keeps the
|
|
107
|
+
* icon-only Figma variant.
|
|
108
|
+
*
|
|
109
|
+
* When set, the arrows render as small text links (label + icon, link
|
|
110
|
+
* colour, underline on hover) rather than circular icon buttons —
|
|
111
|
+
* `arrowVariant` is ignored in this mode.
|
|
112
|
+
* @default false
|
|
113
|
+
*/
|
|
114
|
+
showEdgeNavLabels?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Material icon name for the Previous arrow. Override to swap the default
|
|
117
|
+
* chevron (e.g. `'first_page'`, `'chevron_left'`).
|
|
118
|
+
* @default 'arrow_back'
|
|
119
|
+
*/
|
|
120
|
+
previousIcon?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Material icon name for the Next arrow.
|
|
123
|
+
* @default 'arrow_forward'
|
|
124
|
+
*/
|
|
125
|
+
nextIcon?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Visual treatment of the prev/next arrow buttons:
|
|
128
|
+
* - `'default'` — brand-coloured icon on a transparent circle (light tint on
|
|
129
|
+
* hover); pair with `showEdgeNavLabels` for the small-link style.
|
|
130
|
+
* - `'primary'` — a primary small `Button` with the label text and a leading
|
|
131
|
+
* (previous) / trailing (next) arrow icon, for prominent navigation. The
|
|
132
|
+
* text label is always shown, so `showEdgeNavLabels` has no effect here.
|
|
133
|
+
* @default default
|
|
134
|
+
*/
|
|
135
|
+
arrowVariant?: 'default' | 'primary';
|
|
136
|
+
};
|
|
137
|
+
export interface PaginationProps extends BreakpointSupport<PaginationBreakpointProps> {
|
|
46
138
|
/**
|
|
47
139
|
* Total number of pages.
|
|
48
140
|
*/
|
|
@@ -71,28 +163,38 @@ export interface PaginationProps {
|
|
|
71
163
|
*/
|
|
72
164
|
pageSize?: number;
|
|
73
165
|
/**
|
|
74
|
-
* Options for the page-size select. Omit to hide the select.
|
|
166
|
+
* Options for the page-size select. Omit to hide the select. Accepts plain numbers, or
|
|
167
|
+
* `{ value, label }` objects when the visible text should differ from the value — e.g. a
|
|
168
|
+
* "Show all" entry `{ value: totalItems, label: 'Show all' }`. Selecting an option emits its
|
|
169
|
+
* `value` via `onPageSizeChange`; the pager collapses once the consumer recomputes `pageCount` to 1.
|
|
75
170
|
*/
|
|
76
|
-
pageSizeOptions?: number[];
|
|
171
|
+
pageSizeOptions?: (number | PaginationPageSizeOption)[];
|
|
77
172
|
/**
|
|
78
173
|
* Fires when the user picks a different page size.
|
|
79
174
|
*/
|
|
80
175
|
onPageSizeChange?: (pageSize: number) => void;
|
|
81
176
|
/**
|
|
82
|
-
*
|
|
83
|
-
* ellipsis kicks in.
|
|
84
|
-
* @default 1
|
|
177
|
+
* Override any of the default text labels / aria labels.
|
|
85
178
|
*/
|
|
86
|
-
|
|
179
|
+
labels?: Partial<PaginationLabels>;
|
|
87
180
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
181
|
+
* Hide the "X results" label even when `totalItems` is set. Pass a
|
|
182
|
+
* breakpoint name (e.g. `"md"`) to hide only below that breakpoint.
|
|
183
|
+
* @default false
|
|
90
184
|
*/
|
|
91
|
-
|
|
185
|
+
hideResults?: PaginationVisibility;
|
|
92
186
|
/**
|
|
93
|
-
*
|
|
187
|
+
* Hide the page-size dropdown even when `pageSizeOptions` is non-empty.
|
|
188
|
+
* Pass a breakpoint name to hide only below that breakpoint.
|
|
189
|
+
* @default false
|
|
94
190
|
*/
|
|
95
|
-
|
|
191
|
+
hidePageSize?: PaginationVisibility;
|
|
192
|
+
/**
|
|
193
|
+
* Hide the pager (prev/next + page list). Pass a breakpoint name to hide
|
|
194
|
+
* only below that breakpoint.
|
|
195
|
+
* @default false
|
|
196
|
+
*/
|
|
197
|
+
hidePager?: PaginationVisibility;
|
|
96
198
|
/**
|
|
97
199
|
* Additional class name on the root element.
|
|
98
200
|
*/
|