@tedi-design-system/react 18.0.0-rc.1 → 18.0.0-rc.10
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/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/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,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ModalBodyProps {
|
|
3
|
+
/**
|
|
4
|
+
* Body content.
|
|
5
|
+
*/
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Disable the body's internal scroll. Use when the modal is wrapped in
|
|
9
|
+
* `<Modal.Content scrollBehavior="page">` and overflow is handled by the page.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
noScroll?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Additional class name.
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const ModalBody: {
|
|
19
|
+
({ children, noScroll, className }: ModalBodyProps): JSX.Element;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
22
|
+
export default ModalBody;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import m from "../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import o from "../modal.module.scss.es.js";
|
|
4
|
+
const e = ({ children: a, noScroll: d = !1, className: s }) => /* @__PURE__ */ l(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
className: m(
|
|
8
|
+
o["tedi-modal__body"],
|
|
9
|
+
{
|
|
10
|
+
[o["tedi-modal__body--scroll-page"]]: d
|
|
11
|
+
},
|
|
12
|
+
s
|
|
13
|
+
),
|
|
14
|
+
children: a
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
e.displayName = "Modal.Body";
|
|
18
|
+
export {
|
|
19
|
+
e as ModalBody,
|
|
20
|
+
e as default
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react"),r=require("../modal-context.cjs.js"),e=({children:o})=>{const{onOpenChange:n}=r.useModalContext();return a.cloneElement(o,{onClick:s=>{var l,t;(t=(l=o.props).onClick)==null||t.call(l,s),n(!1)}})};e.displayName="Modal.Closer";exports.ModalCloser=e;exports.default=e;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MouseEvent, ReactElement } from 'react';
|
|
2
|
+
export interface ModalCloserProps {
|
|
3
|
+
/**
|
|
4
|
+
* Element that closes the modal when clicked. The element is cloned and receives
|
|
5
|
+
* a wrapped `onClick` that calls the original handler first, then closes the modal.
|
|
6
|
+
*/
|
|
7
|
+
children: ReactElement<{
|
|
8
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
export declare const ModalCloser: {
|
|
12
|
+
({ children }: ModalCloserProps): JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
export default ModalCloser;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { cloneElement as a } from "react";
|
|
2
|
+
import { useModalContext as r } from "../modal-context.es.js";
|
|
3
|
+
const s = ({ children: o }) => {
|
|
4
|
+
const { onOpenChange: n } = r();
|
|
5
|
+
return a(o, {
|
|
6
|
+
onClick: (t) => {
|
|
7
|
+
var e, l;
|
|
8
|
+
(l = (e = o.props).onClick) == null || l.call(e, t), n(!1);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
s.displayName = "Modal.Closer";
|
|
13
|
+
export {
|
|
14
|
+
s as ModalCloser,
|
|
15
|
+
s as default
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),d=require("../../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),f=require("../../../../../../external/classnames/index.cjs.js"),e=require("../modal.module.scss.cjs.js"),N=require("../modal-context.cjs.js"),O=require("../../../../helpers/hooks/use-breakpoint-props.cjs.js"),W=require("../../../../providers/label-provider/use-labels.cjs.js"),H=["xs","sm","md","lg","xl"],T=l=>H.includes(l),r=l=>{const{getCurrentBreakpointProps:m}=O.useBreakpointProps(l.defaultServerBreakpoint),{width:t="md",maxWidth:s,position:_="center",fullscreen:o=!1}=m(l),{children:v,size:y="default",scrollBehavior:b="content",trapFocus:n=!0,returnFocus:g=!0,showOverlay:x=!0,lockScroll:h=!0,visuallyHiddenDismiss:C=!1,initialFocus:P,className:F}=l,{getLabel:p}=W.useLabels(),{open:q,floating:B,getFloatingProps:M,context:S,labelId:j,descriptionId:k}=N.useModalContext();if(!q)return null;const c=l["aria-labelledby"]??(j||void 0),L=l["aria-describedby"]??(k||void 0),w=c?void 0:l["aria-label"],u=T(t),i={};u||(i.width=t),s&&(i.maxWidth=s);const D=o===!0?e.default["tedi-modal__container--fullscreen"]:o==="edge"?e.default["tedi-modal__container--fullscreen-edge"]:void 0,I=o==="edge"?e.default["tedi-modal__overlay--fullscreen-edge"]:void 0;return a.jsx(d.FloatingPortal,{children:a.jsx(d.FloatingOverlay,{lockScroll:h,className:f.default(e.default["tedi-modal__overlay"],e.default[`tedi-modal__overlay--position-${_}`],I,{[e.default["tedi-modal__overlay--no-overlay"]]:!x,[e.default["tedi-modal__overlay--scroll-page"]]:b==="page"}),children:a.jsx(d.FloatingFocusManager,{context:S,modal:n,returnFocus:g,initialFocus:P,visuallyHiddenDismiss:C?p("modal.close"):void 0,children:a.jsx("div",{...M({ref:B,"aria-labelledby":c,"aria-describedby":L,"aria-label":w,"aria-modal":n,style:i,className:f.default(e.default["tedi-modal__container"],u&&e.default[`tedi-modal__container--${t}`],e.default[`tedi-modal--${y}`],D,F)}),children:v})})})})};r.displayName="Modal.Content";exports.ModalContent=r;exports.default=r;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { FloatingFocusManager } from '@floating-ui/react';
|
|
2
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
import { BreakpointSupport } from '../../../../helpers';
|
|
4
|
+
export type ModalWidthPreset = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
+
export type ModalWidth = ModalWidthPreset | (string & Record<never, never>);
|
|
6
|
+
export type ModalSize = 'default' | 'small';
|
|
7
|
+
export type ModalPosition = 'center' | 'top' | 'right' | 'left' | 'bottom';
|
|
8
|
+
export type ModalScrollBehavior = 'content' | 'page';
|
|
9
|
+
export type ModalFullscreen = boolean | 'edge';
|
|
10
|
+
type ModalContentBreakpointProps = {
|
|
11
|
+
/**
|
|
12
|
+
* Modal width — a Figma-aligned preset (`xs`–`xl`) or any CSS length.
|
|
13
|
+
* Use `maxWidth` when you only need to cap the width instead of set it.
|
|
14
|
+
* @default md
|
|
15
|
+
*/
|
|
16
|
+
width?: ModalWidth;
|
|
17
|
+
/**
|
|
18
|
+
* Hard cap on width. Lightweight alternative to a custom `width`.
|
|
19
|
+
* @default calc(100vw - 16px * 2)
|
|
20
|
+
*/
|
|
21
|
+
maxWidth?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Placement on the viewport.
|
|
24
|
+
* @default center
|
|
25
|
+
*/
|
|
26
|
+
position?: ModalPosition;
|
|
27
|
+
/**
|
|
28
|
+
* Fullscreen behaviour:
|
|
29
|
+
* - `false` — content-sized modal inside the 16px backdrop padding.
|
|
30
|
+
* - `true` — modal fills the overlay; 16px backdrop stays visible.
|
|
31
|
+
* - `'edge'` — edge-to-edge; overlay padding removed, no border/radius.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
fullscreen?: ModalFullscreen;
|
|
35
|
+
};
|
|
36
|
+
export interface ModalContentProps extends BreakpointSupport<ModalContentBreakpointProps> {
|
|
37
|
+
/**
|
|
38
|
+
* `<Modal.Header>`, `<Modal.Body>`, `<Modal.Footer>` and any other content.
|
|
39
|
+
*/
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Size density — controls header/body/footer padding.
|
|
43
|
+
* @default default
|
|
44
|
+
*/
|
|
45
|
+
size?: ModalSize;
|
|
46
|
+
/**
|
|
47
|
+
* Where overflow scrolls. `'content'` keeps the modal frame fixed and scrolls the body;
|
|
48
|
+
* `'page'` lets the modal grow with content and scrolls the overlay around it.
|
|
49
|
+
* @default content
|
|
50
|
+
*/
|
|
51
|
+
scrollBehavior?: ModalScrollBehavior;
|
|
52
|
+
/**
|
|
53
|
+
* Trap focus inside the modal while open.
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
trapFocus?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Restore focus to the trigger after closing.
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
returnFocus?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Render the dimmed backdrop. `false` keeps portal + focus management but no overlay.
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
showOverlay?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Lock background scroll while open.
|
|
69
|
+
* @default true
|
|
70
|
+
*/
|
|
71
|
+
lockScroll?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Render visually-hidden dismiss buttons at the start and end of the dialog
|
|
74
|
+
* so touch screen-readers can escape without an Escape key.
|
|
75
|
+
* @default false
|
|
76
|
+
*/
|
|
77
|
+
visuallyHiddenDismiss?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Override the dialog's labelling element. Only needed when the label lives
|
|
80
|
+
* outside `<Modal.Header>` — the header wires this automatically.
|
|
81
|
+
*/
|
|
82
|
+
'aria-labelledby'?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Override the dialog's describing element. Only needed when the description
|
|
85
|
+
* lives outside `<Modal.Header>` — the header wires this automatically.
|
|
86
|
+
*/
|
|
87
|
+
'aria-describedby'?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Plain-text accessible name. Use when there's no visible title (icon-only
|
|
90
|
+
* confirmation, etc.). Ignored when `aria-labelledby` is set.
|
|
91
|
+
*/
|
|
92
|
+
'aria-label'?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Element to focus on open. Tabbable index (`0` = first tabbable, `-1` = dialog
|
|
95
|
+
* container) or a ref. Override the default to focus a "Cancel" button on
|
|
96
|
+
* destructive prompts, or the first input on form-heavy modals.
|
|
97
|
+
*/
|
|
98
|
+
initialFocus?: ComponentProps<typeof FloatingFocusManager>['initialFocus'];
|
|
99
|
+
/**
|
|
100
|
+
* Additional class name on the modal container.
|
|
101
|
+
*/
|
|
102
|
+
className?: string;
|
|
103
|
+
}
|
|
104
|
+
export declare const ModalContent: {
|
|
105
|
+
(props: ModalContentProps): JSX.Element | null;
|
|
106
|
+
displayName: string;
|
|
107
|
+
};
|
|
108
|
+
export default ModalContent;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { FloatingPortal as M, FloatingOverlay as W, FloatingFocusManager as H } from "../../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
|
|
3
|
+
import c from "../../../../../../external/classnames/index.es.js";
|
|
4
|
+
import e from "../modal.module.scss.es.js";
|
|
5
|
+
import { useModalContext as O } from "../modal-context.es.js";
|
|
6
|
+
import { useBreakpointProps as $ } from "../../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
7
|
+
import { useLabels as E } from "../../../../providers/label-provider/use-labels.es.js";
|
|
8
|
+
const T = ["xs", "sm", "md", "lg", "xl"], j = (l) => T.includes(l), z = (l) => {
|
|
9
|
+
const { getCurrentBreakpointProps: m } = $(l.defaultServerBreakpoint), {
|
|
10
|
+
width: o = "md",
|
|
11
|
+
maxWidth: r,
|
|
12
|
+
position: u = "center",
|
|
13
|
+
fullscreen: t = !1
|
|
14
|
+
} = m(l), {
|
|
15
|
+
children: f,
|
|
16
|
+
size: y = "default",
|
|
17
|
+
scrollBehavior: v = "content",
|
|
18
|
+
trapFocus: s = !0,
|
|
19
|
+
returnFocus: _ = !0,
|
|
20
|
+
showOverlay: b = !0,
|
|
21
|
+
lockScroll: g = !0,
|
|
22
|
+
visuallyHiddenDismiss: h = !1,
|
|
23
|
+
initialFocus: p,
|
|
24
|
+
className: x
|
|
25
|
+
} = l, { getLabel: F } = E(), { open: C, floating: P, getFloatingProps: B, context: N, labelId: S, descriptionId: k } = O();
|
|
26
|
+
if (!C) return null;
|
|
27
|
+
const d = l["aria-labelledby"] ?? (S || void 0), w = l["aria-describedby"] ?? (k || void 0), D = d ? void 0 : l["aria-label"], n = j(o), i = {};
|
|
28
|
+
n || (i.width = o), r && (i.maxWidth = r);
|
|
29
|
+
const I = t === !0 ? e["tedi-modal__container--fullscreen"] : t === "edge" ? e["tedi-modal__container--fullscreen-edge"] : void 0, L = t === "edge" ? e["tedi-modal__overlay--fullscreen-edge"] : void 0;
|
|
30
|
+
return /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(
|
|
31
|
+
W,
|
|
32
|
+
{
|
|
33
|
+
lockScroll: g,
|
|
34
|
+
className: c(
|
|
35
|
+
e["tedi-modal__overlay"],
|
|
36
|
+
e[`tedi-modal__overlay--position-${u}`],
|
|
37
|
+
L,
|
|
38
|
+
{
|
|
39
|
+
[e["tedi-modal__overlay--no-overlay"]]: !b,
|
|
40
|
+
[e["tedi-modal__overlay--scroll-page"]]: v === "page"
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
children: /* @__PURE__ */ a(
|
|
44
|
+
H,
|
|
45
|
+
{
|
|
46
|
+
context: N,
|
|
47
|
+
modal: s,
|
|
48
|
+
returnFocus: _,
|
|
49
|
+
initialFocus: p,
|
|
50
|
+
visuallyHiddenDismiss: h ? F("modal.close") : void 0,
|
|
51
|
+
children: /* @__PURE__ */ a(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
...B({
|
|
55
|
+
ref: P,
|
|
56
|
+
"aria-labelledby": d,
|
|
57
|
+
"aria-describedby": w,
|
|
58
|
+
"aria-label": D,
|
|
59
|
+
"aria-modal": s,
|
|
60
|
+
style: i,
|
|
61
|
+
className: c(
|
|
62
|
+
e["tedi-modal__container"],
|
|
63
|
+
n && e[`tedi-modal__container--${o}`],
|
|
64
|
+
e[`tedi-modal--${y}`],
|
|
65
|
+
I,
|
|
66
|
+
x
|
|
67
|
+
)
|
|
68
|
+
}),
|
|
69
|
+
children: f
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
) });
|
|
76
|
+
};
|
|
77
|
+
z.displayName = "Modal.Content";
|
|
78
|
+
export {
|
|
79
|
+
z as ModalContent,
|
|
80
|
+
z as default
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),o=t.createContext(null),n=()=>{const e=t.useContext(o);if(!e)throw new Error("Modal subcomponents must be rendered inside <Modal>.");return e},l=()=>{const{open:e,onOpenChange:r,labelId:s,descriptionId:d}=n();return{open:e,onOpenChange:r,labelId:s,descriptionId:d}};exports.ModalContext=o;exports.useModal=l;exports.useModalContext=n;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { FloatingContext, ReferenceType } from '@floating-ui/react';
|
|
2
|
+
export interface ModalContextValue {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange: (open: boolean) => void;
|
|
5
|
+
reference: (node: ReferenceType | null) => void;
|
|
6
|
+
floating: (node: HTMLElement | null) => void;
|
|
7
|
+
getReferenceProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
8
|
+
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
9
|
+
context: FloatingContext<ReferenceType>;
|
|
10
|
+
labelId: string;
|
|
11
|
+
descriptionId: string;
|
|
12
|
+
setHasTitle: (hasTitle: boolean) => void;
|
|
13
|
+
setHasDescription: (hasDescription: boolean) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const ModalContext: import('react').Context<ModalContextValue | null>;
|
|
16
|
+
export declare const useModalContext: () => ModalContextValue;
|
|
17
|
+
/**
|
|
18
|
+
* Public Modal context — the safe subset consumers can read from inside a `<Modal>`.
|
|
19
|
+
* Use this when you bypass `<Modal.Header>` and render your own title / description
|
|
20
|
+
* markup, or when you need to close the modal programmatically from deeply nested code.
|
|
21
|
+
*
|
|
22
|
+
* The floating-ui plumbing (`reference`, `floating`, `getReferenceProps`, …) is
|
|
23
|
+
* intentionally hidden — touching it from outside the Modal package leads to subtle
|
|
24
|
+
* focus/dismissal bugs.
|
|
25
|
+
*
|
|
26
|
+
* @example Custom header with manual `aria-labelledby` wiring
|
|
27
|
+
* ```tsx
|
|
28
|
+
* function CustomHeader({ title }: { title: string }) {
|
|
29
|
+
* const { labelId, onOpenChange } = useModal();
|
|
30
|
+
* return (
|
|
31
|
+
* <Modal.Header>
|
|
32
|
+
* <h2 id={labelId}>{title}</h2>
|
|
33
|
+
* <ClosingButton onClick={() => onOpenChange(false)} />
|
|
34
|
+
* </Modal.Header>
|
|
35
|
+
* );
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example Close the modal from a footer action
|
|
40
|
+
* ```tsx
|
|
41
|
+
* function ConfirmButton() {
|
|
42
|
+
* const { onOpenChange } = useModal();
|
|
43
|
+
* return <Button onClick={() => onOpenChange(false)}>Confirm</Button>;
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @throws if called outside a `<Modal>` subtree.
|
|
48
|
+
*/
|
|
49
|
+
export interface UseModalReturn {
|
|
50
|
+
/** Whether the modal is currently open. */
|
|
51
|
+
open: boolean;
|
|
52
|
+
/** Programmatically open or close the modal. Equivalent to clicking the trigger / closer. */
|
|
53
|
+
onOpenChange: (open: boolean) => void;
|
|
54
|
+
/** ID assigned to the title element, intended for `aria-labelledby`. Empty when no title is registered. */
|
|
55
|
+
labelId: string;
|
|
56
|
+
/** ID assigned to the description element, intended for `aria-describedby`. Empty when no description is registered. */
|
|
57
|
+
descriptionId: string;
|
|
58
|
+
}
|
|
59
|
+
export declare const useModal: () => UseModalReturn;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext as r, useContext as s } from "react";
|
|
2
|
+
const d = r(null), c = () => {
|
|
3
|
+
const e = s(d);
|
|
4
|
+
if (!e)
|
|
5
|
+
throw new Error("Modal subcomponents must be rendered inside <Modal>.");
|
|
6
|
+
return e;
|
|
7
|
+
}, a = () => {
|
|
8
|
+
const { open: e, onOpenChange: o, labelId: t, descriptionId: n } = c();
|
|
9
|
+
return { open: e, onOpenChange: o, labelId: t, descriptionId: n };
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
d as ModalContext,
|
|
13
|
+
a as useModal,
|
|
14
|
+
c as useModalContext
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),a=require("../../../../../../external/classnames/index.cjs.js"),e=require("../modal.module.scss.cjs.js"),d=({children:i,left:t,className:s})=>{const l=!!t;return o.jsxs("div",{className:a.default(e.default["tedi-modal__footer"],e.default[l?"tedi-modal__footer--split":"tedi-modal__footer--end"],s),children:[l&&o.jsx("div",{className:e.default["tedi-modal__footer-side"],children:t}),o.jsx("div",{className:a.default(e.default["tedi-modal__footer-side"],e.default["tedi-modal__footer-side--right"]),children:i})]})};d.displayName="Modal.Footer";exports.ModalFooter=d;exports.default=d;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ModalFooterProps {
|
|
3
|
+
/**
|
|
4
|
+
* Content placed on the right side of the footer (the primary actions).
|
|
5
|
+
* If `left` is omitted, the footer simply right-aligns these children.
|
|
6
|
+
*/
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Content placed on the left side of the footer. When set, the footer splits into
|
|
10
|
+
* `left` + `right` halves — matches Figma's "Buttons left and right" variant.
|
|
11
|
+
*/
|
|
12
|
+
left?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Additional class name.
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const ModalFooter: {
|
|
19
|
+
({ children, left, className }: ModalFooterProps): JSX.Element;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
22
|
+
export default ModalFooter;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import s from "../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import o from "../modal.module.scss.es.js";
|
|
4
|
+
const l = ({ children: i, left: e, className: a }) => {
|
|
5
|
+
const d = !!e;
|
|
6
|
+
return /* @__PURE__ */ r(
|
|
7
|
+
"div",
|
|
8
|
+
{
|
|
9
|
+
className: s(
|
|
10
|
+
o["tedi-modal__footer"],
|
|
11
|
+
o[d ? "tedi-modal__footer--split" : "tedi-modal__footer--end"],
|
|
12
|
+
a
|
|
13
|
+
),
|
|
14
|
+
children: [
|
|
15
|
+
d && /* @__PURE__ */ t("div", { className: o["tedi-modal__footer-side"], children: e }),
|
|
16
|
+
/* @__PURE__ */ t("div", { className: s(o["tedi-modal__footer-side"], o["tedi-modal__footer-side--right"]), children: i })
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
l.displayName = "Modal.Footer";
|
|
22
|
+
export {
|
|
23
|
+
l as ModalFooter,
|
|
24
|
+
l as default
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),g=require("../../../../../../external/classnames/index.cjs.js"),r=require("react"),j=require("../../../base/typography/heading/heading.cjs.js"),p=require("../../../base/typography/text/text.cjs.js"),q=require("../../../buttons/closing-button/closing-button.cjs.js"),a=require("../modal.module.scss.cjs.js"),B=require("../modal-context.cjs.js"),n=i=>{const{title:s,description:o,closeButton:c=!0,closeButtonProps:u,children:t,className:m}=i,{onOpenChange:f,labelId:h,descriptionId:x,setHasTitle:l,setHasDescription:d}=B.useModalContext();r.useEffect(()=>(l(!!s||!!t),()=>l(!1)),[s,t,l]),r.useEffect(()=>(d(!!o||!!t),()=>d(!1)),[o,t,d]);const _=()=>f(!1);return e.jsx("div",{className:g.default(a.default["tedi-modal__header"],m),children:t??e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:a.default["tedi-modal__header-row"],children:[s&&e.jsx(j.Heading,{element:"h3",modifiers:"h3",id:h,className:a.default["tedi-modal__header-title"],children:s}),c&&e.jsx(q.ClosingButton,{size:"default",...u,onClick:_})]}),o&&e.jsx(p.Text,{id:x,className:a.default["tedi-modal__header-description"],children:o})]})})};n.displayName="Modal.Header";exports.ModalHeader=n;exports.default=n;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ClosingButtonProps } from '../../../buttons/closing-button/closing-button';
|
|
3
|
+
export interface ModalHeaderProps {
|
|
4
|
+
/**
|
|
5
|
+
* Title text. Rendered as an `<h3>` and automatically registered as the modal's
|
|
6
|
+
* `aria-labelledby`. Pass `children` instead for full control of the title markup.
|
|
7
|
+
*/
|
|
8
|
+
title?: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Description text below the title. Automatically registered as the modal's
|
|
11
|
+
* `aria-describedby`.
|
|
12
|
+
*/
|
|
13
|
+
description?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Show the closing button.
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
closeButton?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Forwarded to the closing button — use to override size, title, etc.
|
|
21
|
+
*/
|
|
22
|
+
closeButtonProps?: Omit<ClosingButtonProps, 'onClick'>;
|
|
23
|
+
/**
|
|
24
|
+
* Replaces the default title/description layout entirely. When set, `title` and
|
|
25
|
+
* `description` are ignored.
|
|
26
|
+
*
|
|
27
|
+
* Accessibility note: the automatic `aria-labelledby` / `aria-describedby` wiring
|
|
28
|
+
* only fires for the `title` / `description` props. With `children` you need to
|
|
29
|
+
* connect them yourself — call `useModal()` to read `labelId` / `descriptionId`
|
|
30
|
+
* and put them on the right elements:
|
|
31
|
+
*
|
|
32
|
+
* ```tsx
|
|
33
|
+
* function CustomHeader() {
|
|
34
|
+
* const { labelId, descriptionId, onOpenChange } = useModal();
|
|
35
|
+
* return (
|
|
36
|
+
* <Modal.Header>
|
|
37
|
+
* <h2 id={labelId}>Custom title</h2>
|
|
38
|
+
* <p id={descriptionId}>Supporting text</p>
|
|
39
|
+
* <ClosingButton onClick={() => onOpenChange(false)} />
|
|
40
|
+
* </Modal.Header>
|
|
41
|
+
* );
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* Alternatively, set `aria-labelledby` / `aria-describedby` explicitly on
|
|
46
|
+
* `<Modal.Content>` pointing at IDs you control.
|
|
47
|
+
*/
|
|
48
|
+
children?: ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Additional class name.
|
|
51
|
+
*/
|
|
52
|
+
className?: string;
|
|
53
|
+
}
|
|
54
|
+
export declare const ModalHeader: {
|
|
55
|
+
(props: ModalHeaderProps): JSX.Element;
|
|
56
|
+
displayName: string;
|
|
57
|
+
};
|
|
58
|
+
export default ModalHeader;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as a, jsxs as i, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import N from "../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useEffect as d } from "react";
|
|
4
|
+
import { Heading as x } from "../../../base/typography/heading/heading.es.js";
|
|
5
|
+
import { Text as C } from "../../../base/typography/text/text.es.js";
|
|
6
|
+
import { ClosingButton as H } from "../../../buttons/closing-button/closing-button.es.js";
|
|
7
|
+
import r from "../modal.module.scss.es.js";
|
|
8
|
+
import { useModalContext as g } from "../modal-context.es.js";
|
|
9
|
+
const M = (n) => {
|
|
10
|
+
const { title: o, description: t, closeButton: m = !0, closeButtonProps: c, children: e, className: f } = n, { onOpenChange: p, labelId: h, descriptionId: u, setHasTitle: s, setHasDescription: l } = g();
|
|
11
|
+
d(() => (s(!!o || !!e), () => s(!1)), [o, e, s]), d(() => (l(!!t || !!e), () => l(!1)), [t, e, l]);
|
|
12
|
+
const _ = () => p(!1);
|
|
13
|
+
return /* @__PURE__ */ a("div", { className: N(r["tedi-modal__header"], f), children: e ?? /* @__PURE__ */ i(B, { children: [
|
|
14
|
+
/* @__PURE__ */ i("div", { className: r["tedi-modal__header-row"], children: [
|
|
15
|
+
o && /* @__PURE__ */ a(x, { element: "h3", modifiers: "h3", id: h, className: r["tedi-modal__header-title"], children: o }),
|
|
16
|
+
m && /* @__PURE__ */ a(H, { size: "default", ...c, onClick: _ })
|
|
17
|
+
] }),
|
|
18
|
+
t && /* @__PURE__ */ a(C, { id: u, className: r["tedi-modal__header-description"], children: t })
|
|
19
|
+
] }) });
|
|
20
|
+
};
|
|
21
|
+
M.displayName = "Modal.Header";
|
|
22
|
+
export {
|
|
23
|
+
M as ModalHeader,
|
|
24
|
+
M as default
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("react"),c=require("../modal-context.cjs.js"),u=(...e)=>t=>{for(const r of e)r&&(typeof r=="function"?r(t):r.current=t)},o=({children:e})=>{const{getReferenceProps:t,reference:r}=c.useModalContext(),s=e.ref??e.props.ref,n=u(r,s);return f.cloneElement(e,t({ref:n,...e.props}))};o.displayName="Modal.Trigger";exports.ModalTrigger=o;exports.default=o;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
export interface ModalTriggerProps {
|
|
3
|
+
/**
|
|
4
|
+
* Element that opens the modal when clicked. The element is cloned and receives
|
|
5
|
+
* the `onClick` / `aria-*` props produced by floating-ui.
|
|
6
|
+
*/
|
|
7
|
+
children: JSX.Element;
|
|
8
|
+
}
|
|
9
|
+
export declare const ModalTrigger: {
|
|
10
|
+
({ children }: ModalTriggerProps): JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export default ModalTrigger;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cloneElement as s } from "react";
|
|
2
|
+
import { useModalContext as n } from "../modal-context.es.js";
|
|
3
|
+
const p = (...e) => (r) => {
|
|
4
|
+
for (const o of e)
|
|
5
|
+
o && (typeof o == "function" ? o(r) : o.current = r);
|
|
6
|
+
}, c = ({ children: e }) => {
|
|
7
|
+
const { getReferenceProps: r, reference: o } = n(), t = e.ref ?? e.props.ref, f = p(o, t);
|
|
8
|
+
return s(e, r({ ref: f, ...e.props }));
|
|
9
|
+
};
|
|
10
|
+
c.displayName = "Modal.Trigger";
|
|
11
|
+
export {
|
|
12
|
+
c as ModalTrigger,
|
|
13
|
+
c as default
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("react/jsx-runtime"),n=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),o=require("react"),k=require("./modal-body/modal-body.cjs.js"),v=require("./modal-closer/modal-closer.cjs.js"),x=require("./modal-content/modal-content.cjs.js"),B=require("./modal-context.cjs.js"),j=require("./modal-footer/modal-footer.cjs.js"),D=require("./modal-header/modal-header.cjs.js"),_=require("./modal-trigger/modal-trigger.cjs.js"),e=b=>{const{children:I,defaultOpen:h=!1,open:c,onToggle:s,closeOnBackdropClick:d=!0,closeOnEscape:u=!0,role:y="dialog"}=b,[F,R]=o.useState(h),a=typeof c<"u",l=a?c:F,i=o.useCallback(q=>{a||R(q),s==null||s(q)},[a,s]),{refs:r,context:t}=n.useFloating({open:l,onOpenChange:i}),{getReferenceProps:p,getFloatingProps:g}=n.useInteractions([n.useClick(t),n.useRole(t,{role:y}),n.useDismiss(t,{enabled:d||u,escapeKey:u,outsidePress:d})]),f=o.useId(),C=`${f}-label`,M=`${f}-description`,[m,H]=o.useState(!1),[O,P]=o.useState(!1),S=o.useMemo(()=>({open:l,onOpenChange:i,reference:r.setReference,floating:r.setFloating,getReferenceProps:p,getFloatingProps:g,context:t,labelId:m?C:"",descriptionId:O?M:"",setHasTitle:H,setHasDescription:P}),[l,i,r.setReference,r.setFloating,p,g,t,m,O,C,M]);return T.jsx(B.ModalContext.Provider,{value:S,children:I})};e.Trigger=_.ModalTrigger;e.Content=x.ModalContent;e.Header=D.ModalHeader;e.Body=k.ModalBody;e.Footer=j.ModalFooter;e.Closer=v.ModalCloser;e.displayName="Modal";exports.Modal=e;exports.default=e;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ModalRole = 'dialog' | 'alertdialog';
|
|
3
|
+
export interface ModalProps {
|
|
4
|
+
/**
|
|
5
|
+
* `<Modal.Trigger>` and `<Modal.Content>` children.
|
|
6
|
+
*/
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Open state for uncontrolled mode. Use `open` + `onToggle` for controlled mode.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
defaultOpen?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Open state for controlled mode. Pair with `onToggle`.
|
|
15
|
+
*/
|
|
16
|
+
open?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Called whenever the modal opens or closes. Pair with `open` for controlled mode.
|
|
19
|
+
*/
|
|
20
|
+
onToggle?: (open: boolean) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Close the modal when the backdrop is clicked.
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
closeOnBackdropClick?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Close the modal when the Escape key is pressed.
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
closeOnEscape?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* ARIA role for the dialog. Use `'alertdialog'` for destructive confirmations
|
|
33
|
+
* (delete, cancel subscription) — screen readers announce alertdialogs with higher
|
|
34
|
+
* urgency and require an explicit user action to dismiss. Affects both the trigger's
|
|
35
|
+
* `aria-haspopup` and the floating element's `role`.
|
|
36
|
+
* @default dialog
|
|
37
|
+
*/
|
|
38
|
+
role?: ModalRole;
|
|
39
|
+
}
|
|
40
|
+
export declare const Modal: {
|
|
41
|
+
(props: ModalProps): JSX.Element;
|
|
42
|
+
Trigger: {
|
|
43
|
+
({ children }: import('./modal-trigger/modal-trigger').ModalTriggerProps): import("react").JSX.Element;
|
|
44
|
+
displayName: string;
|
|
45
|
+
};
|
|
46
|
+
Content: {
|
|
47
|
+
(props: import('./modal-content/modal-content').ModalContentProps): JSX.Element | null;
|
|
48
|
+
displayName: string;
|
|
49
|
+
};
|
|
50
|
+
Header: {
|
|
51
|
+
(props: import('./modal-header/modal-header').ModalHeaderProps): JSX.Element;
|
|
52
|
+
displayName: string;
|
|
53
|
+
};
|
|
54
|
+
Body: {
|
|
55
|
+
({ children, noScroll, className }: import('./modal-body/modal-body').ModalBodyProps): JSX.Element;
|
|
56
|
+
displayName: string;
|
|
57
|
+
};
|
|
58
|
+
Footer: {
|
|
59
|
+
({ children, left, className }: import('./modal-footer/modal-footer').ModalFooterProps): JSX.Element;
|
|
60
|
+
displayName: string;
|
|
61
|
+
};
|
|
62
|
+
Closer: {
|
|
63
|
+
({ children }: import('./modal-closer/modal-closer').ModalCloserProps): JSX.Element;
|
|
64
|
+
displayName: string;
|
|
65
|
+
};
|
|
66
|
+
displayName: string;
|
|
67
|
+
};
|
|
68
|
+
export default Modal;
|