@tedi-design-system/react 19.1.0-rc.2 → 19.1.0-rc.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +308 -0
- package/README.md +28 -0
- package/_virtual/index.es13.js +2 -2
- package/_virtual/index.es14.js +2 -2
- package/bundle-stats.html +1 -1
- package/community.cjs.js +1 -1
- package/community.es.js +215 -223
- package/component.manifest.json +1234 -0
- package/external/@floating-ui/core/dist/floating-ui.core.es.js +1 -1
- package/external/@floating-ui/dom/dist/floating-ui.dom.es.js +2 -2
- package/external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js +5 -5
- package/external/@mui/x-date-pickers/DatePicker/shared.es.js +1 -1
- package/external/@mui/x-date-pickers/DateTimePicker/shared.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/prop-types/external/react-is/index.cjs.js +1 -1
- package/external/prop-types/external/react-is/index.es.js +1 -1
- package/external/react-is/index.cjs.js +1 -1
- package/external/react-is/index.es.js +1 -1
- package/external/toposort/index.cjs.js +1 -1
- package/external/toposort/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +3 -3
- package/src/community/components/accordion/accordion.cjs.js +1 -1
- package/src/community/components/accordion/accordion.es.js +14 -9
- package/src/community/components/card/card-notification/card-notification.cjs.js +1 -1
- package/src/community/components/card/card-notification/card-notification.es.js +10 -8
- package/src/community/components/dock-panel/dock-panel.cjs.js +2 -0
- package/src/community/components/dock-panel/dock-panel.d.ts +110 -0
- package/src/community/components/dock-panel/dock-panel.es.js +138 -0
- package/src/community/components/dock-panel/dock-panel.module.scss.cjs.js +1 -0
- package/src/community/components/dock-panel/dock-panel.module.scss.es.js +18 -0
- package/src/community/components/dropdown/dropdown.cjs.js +1 -1
- package/src/community/components/dropdown/dropdown.es.js +34 -32
- package/src/community/components/form/category-search/category-search.cjs.js +1 -0
- package/src/community/components/form/category-search/category-search.d.ts +9 -0
- package/src/community/components/form/category-search/category-search.es.js +297 -0
- package/src/community/components/form/category-search/category-search.module.scss.cjs.js +1 -0
- package/src/community/components/form/category-search/category-search.module.scss.es.js +21 -0
- package/src/community/components/form/category-search/category-search.types.d.ts +162 -0
- package/src/community/components/form/category-search/define-category-search-category.cjs.js +1 -0
- package/src/community/components/form/category-search/define-category-search-category.d.ts +7 -0
- package/src/community/components/form/category-search/define-category-search-category.es.js +25 -0
- package/src/community/components/form/category-search/index.d.ts +3 -0
- package/src/community/components/form/category-search/use-category-search.cjs.js +1 -0
- package/src/community/components/form/category-search/use-category-search.d.ts +17 -0
- package/src/community/components/form/category-search/use-category-search.es.js +64 -0
- package/src/community/components/form/file-upload/file-upload.cjs.js +1 -1
- package/src/community/components/form/file-upload/file-upload.es.js +43 -41
- package/src/community/components/form/pickers/calendar/calendar.cjs.js +1 -1
- package/src/community/components/form/pickers/calendar/calendar.es.js +41 -39
- package/src/community/components/form/pickers/timepicker/timepicker.cjs.js +1 -1
- package/src/community/components/form/pickers/timepicker/timepicker.es.js +33 -31
- package/src/community/components/form/toggle/toggle.cjs.js +1 -1
- package/src/community/components/form/toggle/toggle.es.js +30 -28
- package/src/community/components/map-components/base-map-selection/base-map-option.cjs.js +1 -1
- package/src/community/components/map-components/base-map-selection/base-map-option.d.ts +8 -5
- package/src/community/components/map-components/base-map-selection/base-map-option.es.js +63 -65
- package/src/community/components/map-components/base-map-selection/base-map-selection.cjs.js +1 -1
- package/src/community/components/map-components/base-map-selection/base-map-selection.d.ts +1 -4
- package/src/community/components/map-components/base-map-selection/base-map-selection.es.js +55 -55
- package/src/community/components/map-components/carousel/carousel.cjs.js +1 -1
- package/src/community/components/map-components/carousel/carousel.es.js +19 -17
- package/src/community/components/map-components/map-button/map-button.cjs.js +1 -1
- package/src/community/components/map-components/map-button/map-button.d.ts +12 -4
- package/src/community/components/map-components/map-button/map-button.es.js +43 -40
- package/src/community/components/map-components/map-dropdown/map-dropdown.cjs.js +1 -1
- package/src/community/components/map-components/map-dropdown/map-dropdown.es.js +51 -49
- package/src/community/components/status/status.cjs.js +1 -1
- package/src/community/components/status/status.es.js +14 -12
- package/src/community/components/stepper/stepper.cjs.js +1 -1
- package/src/community/components/stepper/stepper.es.js +33 -31
- package/src/community/components/table/table.cjs.js +1 -1
- package/src/community/components/table/table.es.js +9 -9
- package/src/community/components/table-of-contents/table-of-contents.cjs.js +1 -1
- package/src/community/components/table-of-contents/table-of-contents.es.js +21 -19
- package/src/community/components/tabs/tabs/tabs.cjs.js +1 -1
- package/src/community/components/tabs/tabs/tabs.es.js +29 -27
- package/src/community/components/vertical-stepper/vertical-stepper.cjs.js +1 -1
- package/src/community/components/vertical-stepper/vertical-stepper.es.js +8 -6
- package/src/community/deprecated-exports.cjs.js +1 -0
- package/src/community/deprecated-exports.d.ts +19 -0
- package/src/community/deprecated-exports.es.js +112 -0
- package/src/community/index.d.ts +3 -0
- package/src/tedi/components/content/card/card.d.ts +4 -0
- package/src/tedi/components/content/card/card.module.scss.cjs.js +1 -1
- package/src/tedi/components/content/card/card.module.scss.es.js +3 -2
- package/src/tedi/components/content/carousel/carousel.cjs.js +1 -1
- package/src/tedi/components/content/carousel/carousel.d.ts +5 -0
- package/src/tedi/components/content/carousel/carousel.es.js +20 -20
- package/src/tedi/components/content/carousel/use-carousel.cjs.js +1 -1
- package/src/tedi/components/content/carousel/use-carousel.d.ts +1 -1
- package/src/tedi/components/content/carousel/use-carousel.es.js +127 -127
- package/src/tedi/components/content/table-card/index.d.ts +1 -0
- package/src/tedi/components/content/table-card/table-card.cjs.js +1 -0
- package/src/tedi/components/content/table-card/table-card.d.ts +131 -0
- package/src/tedi/components/content/table-card/table-card.es.js +206 -0
- package/src/tedi/components/content/table-card/table-card.module.scss.cjs.js +1 -0
- package/src/tedi/components/content/table-card/table-card.module.scss.es.js +18 -0
- package/src/tedi/components/content/text-group/text-group-list/text-group-list.cjs.js +1 -1
- package/src/tedi/components/content/text-group/text-group-list/text-group-list.d.ts +42 -0
- package/src/tedi/components/content/text-group/text-group-list/text-group-list.es.js +41 -23
- package/src/tedi/components/content/text-group/text-group.cjs.js +1 -1
- package/src/tedi/components/content/text-group/text-group.d.ts +10 -0
- package/src/tedi/components/content/text-group/text-group.es.js +14 -13
- package/src/tedi/components/content/text-group/text-group.module.scss.cjs.js +1 -1
- package/src/tedi/components/content/text-group/text-group.module.scss.es.js +5 -1
- package/src/tedi/components/filter/filter/filter.cjs.js +1 -1
- package/src/tedi/components/filter/filter/filter.d.ts +5 -0
- package/src/tedi/components/filter/filter/filter.es.js +154 -144
- package/src/tedi/components/filter/filter/filter.module.scss.cjs.js +1 -1
- package/src/tedi/components/filter/filter/filter.module.scss.es.js +2 -1
- package/src/tedi/components/form/date-field/date-field-helpers.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field-helpers.d.ts +12 -19
- package/src/tedi/components/form/date-field/date-field-helpers.es.js +27 -21
- package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field.d.ts +1 -1
- package/src/tedi/components/form/date-field/date-field.es.js +169 -164
- package/src/tedi/components/form/date-time-field/date-time-field.cjs.js +1 -1
- package/src/tedi/components/form/date-time-field/date-time-field.es.js +181 -176
- package/src/tedi/components/form/search/index.d.ts +1 -0
- package/src/tedi/components/form/search/search.cjs.js +1 -1
- package/src/tedi/components/form/search/search.d.ts +92 -1
- package/src/tedi/components/form/search/search.es.js +265 -69
- package/src/tedi/components/form/search/search.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/search/search.module.scss.es.js +9 -1
- package/src/tedi/components/form/slider/slider.cjs.js +1 -1
- package/src/tedi/components/form/slider/slider.es.js +38 -38
- package/src/tedi/components/form/slider/slider.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/slider/slider.module.scss.es.js +0 -1
- package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
- package/src/tedi/components/form/textfield/textfield.es.js +21 -21
- package/src/tedi/components/form/time-field/time-field.cjs.js +1 -1
- package/src/tedi/components/form/time-field/time-field.es.js +126 -124
- package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.cjs.js +1 -1
- package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.d.ts +1 -1
- package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.es.js +28 -27
- package/src/tedi/components/layout/mobile-nav/mobile-nav.cjs.js +1 -1
- package/src/tedi/components/layout/mobile-nav/mobile-nav.d.ts +1 -1
- package/src/tedi/components/layout/mobile-nav/mobile-nav.es.js +124 -92
- package/src/tedi/components/layout/sidenav/sidenav.module.scss.cjs.js +1 -1
- package/src/tedi/components/layout/sidenav/sidenav.module.scss.es.js +1 -0
- package/src/tedi/components/misc/affix/affix.cjs.js +1 -1
- package/src/tedi/components/misc/affix/affix.es.js +20 -8
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-collapsible/table-of-contents-collapsible.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-collapsible/table-of-contents-collapsible.d.ts +9 -1
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-collapsible/table-of-contents-collapsible.es.js +78 -39
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-item/table-of-contents-item.d.ts +6 -0
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.es.js +23 -28
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.d.ts +32 -21
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.es.js +58 -55
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.module.scss.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.module.scss.es.js +4 -1
- package/src/tedi/components/navigation/tabs/tabs-helpers.cjs.js +1 -1
- package/src/tedi/components/navigation/tabs/tabs-helpers.d.ts +5 -0
- package/src/tedi/components/navigation/tabs/tabs-helpers.es.js +7 -4
- package/src/tedi/components/navigation/tabs/tabs-trigger/tabs-trigger.cjs.js +1 -1
- package/src/tedi/components/navigation/tabs/tabs-trigger/tabs-trigger.es.js +17 -17
- package/src/tedi/components/overlays/dropdown/dropdown.cjs.js +1 -1
- package/src/tedi/components/overlays/dropdown/dropdown.d.ts +8 -0
- package/src/tedi/components/overlays/dropdown/dropdown.es.js +82 -72
- package/src/tedi/components/overlays/dropdown/dropdown.module.scss.cjs.js +1 -1
- package/src/tedi/components/overlays/dropdown/dropdown.module.scss.es.js +1 -0
- package/src/tedi/components/overlays/overlay/overlay-trigger.cjs.js +1 -1
- package/src/tedi/components/overlays/overlay/overlay-trigger.es.js +22 -21
- package/src/tedi/helpers/warn-deprecated/warn-deprecated.cjs.js +1 -0
- package/src/tedi/helpers/warn-deprecated/warn-deprecated.d.ts +12 -0
- package/src/tedi/helpers/warn-deprecated/warn-deprecated.es.js +11 -0
- package/src/tedi/index.d.ts +2 -1
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +44 -2
- package/src/tedi/providers/label-provider/labels-map.es.js +43 -1
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +326 -324
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tedi-design-system/react",
|
|
3
|
-
"version": "19.1.0-rc.
|
|
3
|
+
"version": "19.1.0-rc.20",
|
|
4
4
|
"description": "TEDI Design System React component library — accessible, reusable UI components. Docs & live examples: https://storybook.tedi.ee/react/rc/",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@mui/material": "^5.15.13",
|
|
48
48
|
"@mui/x-date-pickers": "^5.0.20",
|
|
49
49
|
"@tanstack/react-table": "^8.13.2",
|
|
50
|
-
"@tedi-design-system/core": "^6.
|
|
50
|
+
"@tedi-design-system/core": "^6.9.0",
|
|
51
51
|
"classnames": "^2.5.1",
|
|
52
52
|
"draft-js": "^0.11.7",
|
|
53
53
|
"draftjs-md-converter": "^1.5.2",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
107
107
|
"@typescript-eslint/parser": "^6.21.0",
|
|
108
108
|
"@vitejs/plugin-react": "^4.3.4",
|
|
109
|
-
"chromatic": "^
|
|
109
|
+
"chromatic": "^18.7.4",
|
|
110
110
|
"concurrently": "^10.0.3",
|
|
111
111
|
"dompurify": "^3.4.12",
|
|
112
112
|
"eslint": "8.48.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),O=require("../../../../external/classnames/index.cjs.js"),i=require("react"),j=require("../../../tedi/helpers/warn-deprecated/warn-deprecated.cjs.js"),C=require("./accordion.module.scss.cjs.js"),S=require("../../../tedi/components/layout/vertical-spacing/vertical-spacing.cjs.js"),s=i.createContext({isOpen:()=>!0,onToggle:()=>null}),T=c=>{j.warnDeprecated("Community Accordion","Use the TEDI-Ready `Accordion` from `@tedi-design-system/react/tedi` instead.");const{children:d,className:u,openItem:t,gutter:a=.5,onToggleItem:n,defaultOpenItem:l=[],...m}=c,f=t||l,[g,p]=i.useState(f),x=(e=c.openItem)=>!!n&&typeof e<"u",I=e=>{if(n)return n(e);x(t)||p(o=>o.includes(e)?o.filter(A=>A!==e):[...o,e])},y=()=>n&&typeof t<"u"?t:g,q=e=>y().includes(e);return r.jsx(s.Provider,{value:{isOpen:q,onToggle:I},children:r.jsx("div",{"data-name":"accordion",...m,className:O.default(C.default.accordion,u),children:r.jsx(S.VerticalSpacing,{size:a,children:d})})})};exports.Accordion=T;exports.AccordionContext=s;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import x from "../../../../external/classnames/index.es.js";
|
|
3
|
+
import s from "react";
|
|
4
|
+
import { warnDeprecated as A } from "../../../tedi/helpers/warn-deprecated/warn-deprecated.es.js";
|
|
4
5
|
import C from "./accordion.module.scss.es.js";
|
|
5
|
-
import { VerticalSpacing as
|
|
6
|
-
const
|
|
6
|
+
import { VerticalSpacing as T } from "../../../tedi/components/layout/vertical-spacing/vertical-spacing.es.js";
|
|
7
|
+
const N = s.createContext({
|
|
7
8
|
isOpen: () => !0,
|
|
8
9
|
onToggle: () => null
|
|
9
|
-
}), v = (
|
|
10
|
-
|
|
10
|
+
}), v = (c) => {
|
|
11
|
+
A(
|
|
12
|
+
"Community Accordion",
|
|
13
|
+
"Use the TEDI-Ready `Accordion` from `@tedi-design-system/react/tedi` instead."
|
|
14
|
+
);
|
|
15
|
+
const { children: i, className: m, openItem: t, gutter: a = 0.5, onToggleItem: n, defaultOpenItem: d = [], ...l } = c, u = t || d, [f, p] = s.useState(u), g = (e = c.openItem) => !!n && typeof e < "u", I = (e) => {
|
|
11
16
|
if (n)
|
|
12
17
|
return n(e);
|
|
13
18
|
g(t) || p((o) => o.includes(e) ? o.filter((h) => h !== e) : [...o, e]);
|
|
14
|
-
},
|
|
15
|
-
return /* @__PURE__ */ r(
|
|
19
|
+
}, y = () => n && typeof t < "u" ? t : f, O = (e) => y().includes(e);
|
|
20
|
+
return /* @__PURE__ */ r(N.Provider, { value: { isOpen: O, onToggle: I }, children: /* @__PURE__ */ r("div", { "data-name": "accordion", ...l, className: x(C.accordion, m), children: /* @__PURE__ */ r(T, { size: a, children: i }) }) });
|
|
16
21
|
};
|
|
17
22
|
export {
|
|
18
23
|
v as Accordion,
|
|
19
|
-
|
|
24
|
+
N as AccordionContext
|
|
20
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("../../../../../external/classnames/index.cjs.js"),s=require("../../../../tedi/components/notifications/alert/alert.cjs.js"),l=require("../card-content/card-content.cjs.js"),e=require("./card-notification.module.scss.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("../../../../../external/classnames/index.cjs.js"),s=require("../../../../tedi/components/notifications/alert/alert.cjs.js"),u=require("../../../../tedi/helpers/warn-deprecated/warn-deprecated.cjs.js"),l=require("../card-content/card-content.cjs.js"),e=require("./card-notification.module.scss.cjs.js"),f=i=>{u.warnDeprecated("Community CardNotification","Use `CardNotification` from `@tedi-design-system/react/tedi` instead.");const{children:a,padding:n,className:r,...o}=i,c=d.default(e.default.card__notification,r);return t.jsx(l.CardContent,{"data-name":"card-notification",padding:n,className:e.default["card__notification-content"],children:t.jsx(s.Alert,{className:c,...o,children:a})})};exports.CardNotification=f;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { Alert as
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import m from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { Alert as s } from "../../../../tedi/components/notifications/alert/alert.es.js";
|
|
4
|
+
import { warnDeprecated as d } from "../../../../tedi/helpers/warn-deprecated/warn-deprecated.es.js";
|
|
5
|
+
import { CardContent as f } from "../card-content/card-content.es.js";
|
|
6
|
+
import i from "./card-notification.module.scss.es.js";
|
|
7
|
+
const g = (o) => {
|
|
8
|
+
d("Community CardNotification", "Use `CardNotification` from `@tedi-design-system/react/tedi` instead.");
|
|
9
|
+
const { children: r, padding: a, className: n, ...e } = o, c = m(i.card__notification, n);
|
|
10
|
+
return /* @__PURE__ */ t(f, { "data-name": "card-notification", padding: a, className: i["card__notification-content"], children: /* @__PURE__ */ t(s, { className: c, ...e, children: r }) });
|
|
9
11
|
};
|
|
10
12
|
export {
|
|
11
|
-
|
|
13
|
+
g as CardNotification
|
|
12
14
|
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),$=require("../../../../external/classnames/index.cjs.js"),s=require("react"),le=require("../../../tedi/components/base/typography/heading/heading.cjs.js"),B=require("../../../tedi/components/buttons/button/button.cjs.js"),n=require("./dock-panel.module.scss.cjs.js"),se=["xs","sm","md","lg","xl"],ae={xs:"25%",sm:"35%",md:"50%",lg:"65%",xl:"80%"},de=o=>typeof o=="string"&&se.includes(o),H=o=>de(o)?ae[o]:typeof o=="number"?`${o}px`:o,z=s.forwardRef((o,p)=>{const{title:h,children:g,labels:d,placement:O="right",size:v="default",collapsed:N,defaultCollapsed:M=!1,onCollapsedChange:_,onClose:b,headerActions:k,footer:y,width:E,height:j,maxHeight:i,headingElement:G,id:W,className:J,style:K,...D}=o,Q=s.useId(),x=W??`tedi-dock-panel-${Q}`,I=`${x}-title`,R=`${x}-body`,[U,V]=s.useState(M),X=N!==void 0,l=N??U,r=s.useRef(null),u=s.useRef(null),C=s.useRef(null),f=s.useRef(!1);s.useEffect(()=>{var T;const e=(T=r.current)==null?void 0:T.ownerDocument;if(!e)return;const c=()=>{var q,w,A;const a=e.activeElement,L=!!(a&&((q=u.current)!=null&&q.contains(a)||(w=C.current)!=null&&w.contains(a)));(L||a!==e.body||!((A=u.current)!=null&&A.hidden))&&(f.current=L)},S=()=>{var a;(a=u.current)!=null&&a.hidden||(f.current=!1)};return c(),e.addEventListener("focusin",c),e.addEventListener("focusout",S),()=>{e.removeEventListener("focusin",c),e.removeEventListener("focusout",S)}},[]),s.useEffect(()=>{var e;l&&f.current&&((e=r.current)==null||e.focus(),f.current=!1)},[l]);const Y=()=>{var c;const e=!l;(c=r.current)==null||c.focus(),X||V(e),_==null||_(e)},m={...K};E!==void 0&&(m["--dock-panel-width"]=H(E)),j!==void 0&&(m["--dock-panel-height"]=H(j)),i!==void 0&&(m["--dock-panel-max-height"]=typeof i=="number"?`${i}px`:i);const Z=G??(v==="small"?"h4":"h3"),ee=l?"small":void 0,P=l?d.expand:d.collapse,te=l?"zoom_out_map":"zoom_in_map",ne=k!=null,oe=y!=null;return t.jsxs("div",{...D,ref:p,id:x,role:"region","aria-labelledby":D["aria-labelledby"]??I,"data-dock-panel":"","data-placement":O,"data-size":v,"data-collapsed":l,className:$.default(n.default["tedi-dock-panel"],J),style:m,children:[t.jsxs("div",{className:n.default["tedi-dock-panel__header"],children:[t.jsx(le.Heading,{id:I,element:Z,modifiers:ee,className:n.default["tedi-dock-panel__title"],children:h}),ne&&t.jsx("div",{ref:C,className:n.default["tedi-dock-panel__header-actions"],hidden:l,children:k}),t.jsxs("div",{className:n.default["tedi-dock-panel__controls"],children:[t.jsx(B.Button,{ref:r,className:n.default["tedi-dock-panel__toggle"],type:"button",visualType:"neutral",icon:te,title:P,"aria-expanded":!l,"aria-controls":R,onClick:Y,children:P}),b&&t.jsx(B.Button,{className:n.default["tedi-dock-panel__close"],type:"button",visualType:"neutral",icon:"close",title:d.close,onClick:b,children:d.close})]})]}),t.jsxs("div",{ref:u,id:R,className:n.default["tedi-dock-panel__body"],hidden:l,children:[t.jsx("div",{className:n.default["tedi-dock-panel__content"],children:t.jsx("div",{className:n.default["tedi-dock-panel__content-inner"],children:g})}),oe&&t.jsx("div",{className:n.default["tedi-dock-panel__footer"],children:y})]})]})});z.displayName="DockPanel";const F=s.forwardRef(({children:o,panel:p,className:h,...g},d)=>t.jsxs("div",{...g,ref:d,className:$.default(n.default["tedi-dock-panel-layout"],h),children:[t.jsx("div",{className:n.default["tedi-dock-panel-layout__content"],"data-dock-panel-layout-content":"",children:o}),p]}));F.displayName="DockPanelLayout";exports.DockPanel=z;exports.DockPanelLayout=F;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { CSSProperties, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { HeadingProps } from '../../../tedi/components/base/typography/heading/heading';
|
|
3
|
+
export type DockPanelPlacement = 'left' | 'right' | 'top' | 'bottom';
|
|
4
|
+
export type DockPanelSize = 'default' | 'small';
|
|
5
|
+
export type DockPanelDimensionPreset = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
6
|
+
export type DockPanelWidth = DockPanelDimensionPreset | CSSProperties['width'];
|
|
7
|
+
export type DockPanelHeight = DockPanelDimensionPreset | CSSProperties['height'];
|
|
8
|
+
export interface DockPanelLabels {
|
|
9
|
+
/** Accessible name for the minimize button. Supply translated text. */
|
|
10
|
+
collapse: string;
|
|
11
|
+
/** Accessible name for the restore button. Supply translated text. */
|
|
12
|
+
expand: string;
|
|
13
|
+
/** Accessible name for the optional close button. Supply translated text. */
|
|
14
|
+
close: string;
|
|
15
|
+
}
|
|
16
|
+
export interface DockPanelProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'children'> {
|
|
17
|
+
/** Required. Visible heading and default accessible name of the panel. */
|
|
18
|
+
title: string;
|
|
19
|
+
/** Required. Application-provided React content. Kept mounted while minimized. */
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Required. Translated accessible button names: { collapse, expand, close }.
|
|
23
|
+
* All three strings are required by this interface, including close when onClose is omitted.
|
|
24
|
+
* Providing labels.close alone does not display a close button.
|
|
25
|
+
*/
|
|
26
|
+
labels: DockPanelLabels;
|
|
27
|
+
/**
|
|
28
|
+
* Optional. Edge of the containing workspace, not necessarily the browser viewport.
|
|
29
|
+
* Place the panel in DockPanelLayout to overlay when expanded and reserve space when minimized.
|
|
30
|
+
* @default right
|
|
31
|
+
*/
|
|
32
|
+
placement?: DockPanelPlacement;
|
|
33
|
+
/**
|
|
34
|
+
* Optional. Panel density, using TEDI Modal padding tokens for the header, content and footer.
|
|
35
|
+
* The title defaults to h3 for default and h4 for small, including its text size when expanded.
|
|
36
|
+
* Set headingElement to override both. Minimized titles always use compact text.
|
|
37
|
+
* This is independent of width/height: small does not mean a narrower panel.
|
|
38
|
+
* @default default
|
|
39
|
+
*/
|
|
40
|
+
size?: DockPanelSize;
|
|
41
|
+
/**
|
|
42
|
+
* Optional. Controlled minimized state. Supply onCollapsedChange and apply the requested value.
|
|
43
|
+
* When omitted, the component manages its own state, initialized from defaultCollapsed.
|
|
44
|
+
*/
|
|
45
|
+
collapsed?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Optional. Initial minimized state in uncontrolled mode; ignored when collapsed is supplied.
|
|
48
|
+
* Changes after mounting do not reset the state.
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
defaultCollapsed?: boolean;
|
|
52
|
+
/** Optional. Requests/notifies a minimize/restore change. Receives the next collapsed value. */
|
|
53
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Optional. Displays the close button and requests dismissal when clicked.
|
|
56
|
+
* The application owns removal, unsaved-change confirmation and focus restoration.
|
|
57
|
+
* Omit this callback to hide the close button. Closing is separate from minimizing.
|
|
58
|
+
*/
|
|
59
|
+
onClose?: () => void;
|
|
60
|
+
/** Optional. React content before the grouped panel controls. Hidden, not unmounted, when minimized. */
|
|
61
|
+
headerActions?: ReactNode;
|
|
62
|
+
/** Optional. React content below the scrolling body. Hidden, not unmounted, when minimized. */
|
|
63
|
+
footer?: ReactNode;
|
|
64
|
+
/**
|
|
65
|
+
* Optional. Expanded width for left/right placement; ignored for top/bottom.
|
|
66
|
+
* Presets share the height scale: xs=25%, sm=35%, md=50%, lg=65%, xl=80% of workspace width.
|
|
67
|
+
* Every named preset leaves some workspace visible beside the panel, including xl.
|
|
68
|
+
* Also accepts a CSS length or a number in pixels, limited to the workspace width.
|
|
69
|
+
* Use 100% explicitly to fill the workspace. An omitted width defaults to xs (25%) via CSS.
|
|
70
|
+
* @default xs
|
|
71
|
+
*/
|
|
72
|
+
width?: DockPanelWidth;
|
|
73
|
+
/**
|
|
74
|
+
* Optional. Expanded height for any placement. Numbers mean pixels; CSS lengths and auto work too.
|
|
75
|
+
* Presets share the width scale: xs=25%, sm=35%, md=50%, lg=65%, xl=80% of workspace height.
|
|
76
|
+
* Named presets leave workspace visible; use 100% explicitly for the full available height.
|
|
77
|
+
* Defaults to 100% for left/right and 50% for top/bottom.
|
|
78
|
+
* Use auto for content height, with maxHeight to leave background visible underneath.
|
|
79
|
+
* A minimized side rail keeps an explicit height, or fits its title and controls for auto.
|
|
80
|
+
*/
|
|
81
|
+
height?: DockPanelHeight;
|
|
82
|
+
/**
|
|
83
|
+
* Optional. Maximum height as a CSS length or number in pixels; not a preset.
|
|
84
|
+
* For example, calc(100% - 4rem) reserves space below a side panel.
|
|
85
|
+
* At the limit, the body scrolls while the header and footer remain visible.
|
|
86
|
+
* @default 100%
|
|
87
|
+
*/
|
|
88
|
+
maxHeight?: CSSProperties['maxHeight'];
|
|
89
|
+
/**
|
|
90
|
+
* Optional. Overrides the title's HTML heading tag and expanded text size.
|
|
91
|
+
* When omitted, uses h3 for default and h4 for small. Minimized titles always use compact text.
|
|
92
|
+
* @default h3 (h4 when size is small)
|
|
93
|
+
*/
|
|
94
|
+
headingElement?: HeadingProps['element'];
|
|
95
|
+
}
|
|
96
|
+
export declare const DockPanel: import('react').ForwardRefExoticComponent<DockPanelProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
97
|
+
/**
|
|
98
|
+
* Shared layout for one DockPanel and its underlying application content.
|
|
99
|
+
* Expanded panels are out of flow. A minimized panel occupies a separate grid track,
|
|
100
|
+
* so the workspace resizes without being obscured by the rail.
|
|
101
|
+
* Keep the layout mounted when opening/closing the panel to preserve application state.
|
|
102
|
+
*/
|
|
103
|
+
export interface DockPanelLayoutProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
104
|
+
/** Required. Underlying application content, such as a map, editor or table. */
|
|
105
|
+
children: ReactNode;
|
|
106
|
+
/** Optional. One DockPanel, or a layout-aware wrapper containing it. Null means closed. */
|
|
107
|
+
panel?: ReactNode;
|
|
108
|
+
}
|
|
109
|
+
export declare const DockPanelLayout: import('react').ForwardRefExoticComponent<DockPanelLayoutProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
110
|
+
export default DockPanel;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as i, jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import j from "../../../../external/classnames/index.es.js";
|
|
4
|
+
import { forwardRef as M, useId as ae, useState as se, useRef as f, useEffect as z } from "react";
|
|
5
|
+
import { Heading as ce } from "../../../tedi/components/base/typography/heading/heading.es.js";
|
|
6
|
+
import { Button as F } from "../../../tedi/components/buttons/button/button.es.js";
|
|
7
|
+
import t from "./dock-panel.module.scss.es.js";
|
|
8
|
+
const ie = ["xs", "sm", "md", "lg", "xl"], de = {
|
|
9
|
+
xs: "25%",
|
|
10
|
+
sm: "35%",
|
|
11
|
+
md: "50%",
|
|
12
|
+
lg: "65%",
|
|
13
|
+
xl: "80%"
|
|
14
|
+
}, re = (n) => typeof n == "string" && ie.includes(n), O = (n) => re(n) ? de[n] : typeof n == "number" ? `${n}px` : n, ue = M((n, h) => {
|
|
15
|
+
const {
|
|
16
|
+
title: g,
|
|
17
|
+
children: _,
|
|
18
|
+
labels: s,
|
|
19
|
+
placement: G = "right",
|
|
20
|
+
size: b = "default",
|
|
21
|
+
collapsed: x,
|
|
22
|
+
defaultCollapsed: W = !1,
|
|
23
|
+
onCollapsedChange: y,
|
|
24
|
+
onClose: E,
|
|
25
|
+
headerActions: k,
|
|
26
|
+
footer: v,
|
|
27
|
+
width: I,
|
|
28
|
+
height: D,
|
|
29
|
+
maxHeight: d,
|
|
30
|
+
headingElement: q,
|
|
31
|
+
id: J,
|
|
32
|
+
className: K,
|
|
33
|
+
style: Q,
|
|
34
|
+
...C
|
|
35
|
+
} = n, U = ae(), N = J ?? `tedi-dock-panel-${U}`, T = `${N}-title`, R = `${N}-body`, [V, X] = se(W), Y = x !== void 0, o = x ?? V, r = f(null), u = f(null), S = f(null), m = f(!1);
|
|
36
|
+
z(() => {
|
|
37
|
+
var A;
|
|
38
|
+
const e = (A = r.current) == null ? void 0 : A.ownerDocument;
|
|
39
|
+
if (!e) return;
|
|
40
|
+
const c = () => {
|
|
41
|
+
var w, B, $;
|
|
42
|
+
const a = e.activeElement, H = !!(a && ((w = u.current) != null && w.contains(a) || (B = S.current) != null && B.contains(a)));
|
|
43
|
+
(H || a !== e.body || !(($ = u.current) != null && $.hidden)) && (m.current = H);
|
|
44
|
+
}, P = () => {
|
|
45
|
+
var a;
|
|
46
|
+
(a = u.current) != null && a.hidden || (m.current = !1);
|
|
47
|
+
};
|
|
48
|
+
return c(), e.addEventListener("focusin", c), e.addEventListener("focusout", P), () => {
|
|
49
|
+
e.removeEventListener("focusin", c), e.removeEventListener("focusout", P);
|
|
50
|
+
};
|
|
51
|
+
}, []), z(() => {
|
|
52
|
+
var e;
|
|
53
|
+
o && m.current && ((e = r.current) == null || e.focus(), m.current = !1);
|
|
54
|
+
}, [o]);
|
|
55
|
+
const Z = () => {
|
|
56
|
+
var c;
|
|
57
|
+
const e = !o;
|
|
58
|
+
(c = r.current) == null || c.focus(), Y || X(e), y == null || y(e);
|
|
59
|
+
}, p = { ...Q };
|
|
60
|
+
I !== void 0 && (p["--dock-panel-width"] = O(I)), D !== void 0 && (p["--dock-panel-height"] = O(D)), d !== void 0 && (p["--dock-panel-max-height"] = typeof d == "number" ? `${d}px` : d);
|
|
61
|
+
const ee = q ?? (b === "small" ? "h4" : "h3"), te = o ? "small" : void 0, L = o ? s.expand : s.collapse, ne = o ? "zoom_out_map" : "zoom_in_map", oe = k != null, le = v != null;
|
|
62
|
+
return /* @__PURE__ */ i(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
...C,
|
|
66
|
+
ref: h,
|
|
67
|
+
id: N,
|
|
68
|
+
role: "region",
|
|
69
|
+
"aria-labelledby": C["aria-labelledby"] ?? T,
|
|
70
|
+
"data-dock-panel": "",
|
|
71
|
+
"data-placement": G,
|
|
72
|
+
"data-size": b,
|
|
73
|
+
"data-collapsed": o,
|
|
74
|
+
className: j(t["tedi-dock-panel"], K),
|
|
75
|
+
style: p,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ i("div", { className: t["tedi-dock-panel__header"], children: [
|
|
78
|
+
/* @__PURE__ */ l(
|
|
79
|
+
ce,
|
|
80
|
+
{
|
|
81
|
+
id: T,
|
|
82
|
+
element: ee,
|
|
83
|
+
modifiers: te,
|
|
84
|
+
className: t["tedi-dock-panel__title"],
|
|
85
|
+
children: g
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
oe && /* @__PURE__ */ l("div", { ref: S, className: t["tedi-dock-panel__header-actions"], hidden: o, children: k }),
|
|
89
|
+
/* @__PURE__ */ i("div", { className: t["tedi-dock-panel__controls"], children: [
|
|
90
|
+
/* @__PURE__ */ l(
|
|
91
|
+
F,
|
|
92
|
+
{
|
|
93
|
+
ref: r,
|
|
94
|
+
className: t["tedi-dock-panel__toggle"],
|
|
95
|
+
type: "button",
|
|
96
|
+
visualType: "neutral",
|
|
97
|
+
icon: ne,
|
|
98
|
+
title: L,
|
|
99
|
+
"aria-expanded": !o,
|
|
100
|
+
"aria-controls": R,
|
|
101
|
+
onClick: Z,
|
|
102
|
+
children: L
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
E && /* @__PURE__ */ l(
|
|
106
|
+
F,
|
|
107
|
+
{
|
|
108
|
+
className: t["tedi-dock-panel__close"],
|
|
109
|
+
type: "button",
|
|
110
|
+
visualType: "neutral",
|
|
111
|
+
icon: "close",
|
|
112
|
+
title: s.close,
|
|
113
|
+
onClick: E,
|
|
114
|
+
children: s.close
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
] })
|
|
118
|
+
] }),
|
|
119
|
+
/* @__PURE__ */ i("div", { ref: u, id: R, className: t["tedi-dock-panel__body"], hidden: o, children: [
|
|
120
|
+
/* @__PURE__ */ l("div", { className: t["tedi-dock-panel__content"], children: /* @__PURE__ */ l("div", { className: t["tedi-dock-panel__content-inner"], children: _ }) }),
|
|
121
|
+
le && /* @__PURE__ */ l("div", { className: t["tedi-dock-panel__footer"], children: v })
|
|
122
|
+
] })
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
});
|
|
127
|
+
ue.displayName = "DockPanel";
|
|
128
|
+
const me = M(
|
|
129
|
+
({ children: n, panel: h, className: g, ..._ }, s) => /* @__PURE__ */ i("div", { ..._, ref: s, className: j(t["tedi-dock-panel-layout"], g), children: [
|
|
130
|
+
/* @__PURE__ */ l("div", { className: t["tedi-dock-panel-layout__content"], "data-dock-panel-layout-content": "", children: n }),
|
|
131
|
+
h
|
|
132
|
+
] })
|
|
133
|
+
);
|
|
134
|
+
me.displayName = "DockPanelLayout";
|
|
135
|
+
export {
|
|
136
|
+
ue as DockPanel,
|
|
137
|
+
me as DockPanelLayout
|
|
138
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-dock-panel":"tedi-dock-panel-ef8c20a6","tedi-dock-panel-layout":"tedi-dock-panel-layout-cde58073","tedi-dock-panel__header":"tedi-dock-panel__header-b12fda64","tedi-dock-panel__title":"tedi-dock-panel__title-d31ae9ea","tedi-dock-panel__header-actions":"tedi-dock-panel__header-actions-6b6b0022","tedi-dock-panel__controls":"tedi-dock-panel__controls-ec981d75","tedi-dock-panel__toggle":"tedi-dock-panel__toggle-8b710f3d","tedi-dock-panel__close":"tedi-dock-panel__close-d516de11","tedi-dock-panel__body":"tedi-dock-panel__body-06c713da","tedi-dock-panel__content":"tedi-dock-panel__content-417ece1d","tedi-dock-panel__content-inner":"tedi-dock-panel__content-inner-3ea8c932","tedi-dock-panel__footer":"tedi-dock-panel__footer-364577b7","tedi-dock-panel-layout__content":"tedi-dock-panel-layout__content-cff421e0"};exports.default=e;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
"tedi-dock-panel": "tedi-dock-panel-ef8c20a6",
|
|
3
|
+
"tedi-dock-panel-layout": "tedi-dock-panel-layout-cde58073",
|
|
4
|
+
"tedi-dock-panel__header": "tedi-dock-panel__header-b12fda64",
|
|
5
|
+
"tedi-dock-panel__title": "tedi-dock-panel__title-d31ae9ea",
|
|
6
|
+
"tedi-dock-panel__header-actions": "tedi-dock-panel__header-actions-6b6b0022",
|
|
7
|
+
"tedi-dock-panel__controls": "tedi-dock-panel__controls-ec981d75",
|
|
8
|
+
"tedi-dock-panel__toggle": "tedi-dock-panel__toggle-8b710f3d",
|
|
9
|
+
"tedi-dock-panel__close": "tedi-dock-panel__close-d516de11",
|
|
10
|
+
"tedi-dock-panel__body": "tedi-dock-panel__body-06c713da",
|
|
11
|
+
"tedi-dock-panel__content": "tedi-dock-panel__content-417ece1d",
|
|
12
|
+
"tedi-dock-panel__content-inner": "tedi-dock-panel__content-inner-3ea8c932",
|
|
13
|
+
"tedi-dock-panel__footer": "tedi-dock-panel__footer-364577b7",
|
|
14
|
+
"tedi-dock-panel-layout__content": "tedi-dock-panel-layout__content-cff421e0"
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
e as default
|
|
18
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),o=require("../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),B=require("../../../../external/classnames/index.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),o=require("../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),B=require("../../../../external/classnames/index.cjs.js"),l=require("react"),K=require("../../../tedi/helpers/warn-deprecated/warn-deprecated.cjs.js"),T=require("../button/button.cjs.js"),a=require("./dropdown.module.scss.cjs.js"),H=require("../../../tedi/providers/label-provider/use-labels.cjs.js"),$=require("../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),I=require("../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),z=c=>{K.warnDeprecated("Community Dropdown","Use `Dropdown` from `@tedi-design-system/react/tedi` instead.");const{getLabel:q}=H.useLabels(),{button:F,items:u,onItemClick:i,closeMenuOnClick:_=!0,...h}=c,{initialFocus:v=-1,modal:f=!1,...p}=c.focusManager??{},{visuallyHiddenDismiss:j=f?q("close"):!1}=p??{},y=o.useFloatingNodeId(),g=l.useRef([]),[w,d]=l.useState(!1),[b,R]=l.useState(null),{x:M,y:C,strategy:N,refs:x,placement:O,context:r}=o.useFloating({placement:"bottom-start",nodeId:y,open:w,onOpenChange:d,middleware:[I.flip(),I.shift()],whileElementsMounted:$.autoUpdate}),P=u.findIndex(e=>e.isActive),{getReferenceProps:S,getFloatingProps:U,getItemProps:L}=o.useInteractions([o.useClick(r),o.useListNavigation(r,{listRef:g,activeIndex:b,selectedIndex:P,onNavigate:R,loop:!0}),o.useRole(r,{role:"listbox"}),o.useDismiss(r)]),A=()=>{const e=s.jsx(o.FloatingFocusManager,{context:r,initialFocus:v,visuallyHiddenDismiss:j,modal:f,...p,children:s.jsx("div",{...U({ref:x.setFloating,style:{position:N,left:M??0,top:C??0},className:a.default.dropdown,onKeyDown(t){t.key==="Tab"&&d(!1)}}),"data-placement":O,children:u.map((t,n)=>k(t,n))})});return w?e:null},E=e=>B.default(a.default.dropdown__item,{[a.default["dropdown__item--active"]]:e.isActive,[a.default["dropdown__item--disabled"]]:e.isDisabled}),m=(e,t,n)=>{var D;i==null||i(e,t,n),(D=e==null?void 0:e.onClick)==null||D.call(e,n),_&&d(!1)},k=(e,t)=>s.jsx("button",{...L({disabled:e.isDisabled,tabIndex:b===t?0:-1,role:"option",className:E(e),onClick:n=>m(e,t,n),onKeyDown(n){n.key==="Enter"&&m(e,t,n)},ref(n){g.current[t]=n}}),children:e.children},t);return s.jsxs(s.Fragment,{children:[s.jsx(T.Button,{"data-name":"dropdown",...h,...F,...S({ref:x.setReference,tabIndex:0})}),s.jsx(o.FloatingPortal,{children:A()})]})};exports.Dropdown=z;
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { jsxs as B, Fragment as K, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import { useFloatingNodeId as
|
|
2
|
+
import { useFloatingNodeId as U, useFloating as H, useInteractions as T, useClick as q, useListNavigation as z, useRole as G, useDismiss as J, FloatingPortal as Q, FloatingFocusManager as V } from "../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
|
|
3
3
|
import W from "../../../../external/classnames/index.es.js";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
4
|
+
import l from "react";
|
|
5
|
+
import { warnDeprecated as X } from "../../../tedi/helpers/warn-deprecated/warn-deprecated.es.js";
|
|
6
|
+
import { Button as Y } from "../button/button.es.js";
|
|
6
7
|
import r from "./dropdown.module.scss.es.js";
|
|
7
|
-
import { useLabels as
|
|
8
|
-
import { autoUpdate as
|
|
9
|
-
import { flip as
|
|
10
|
-
const
|
|
11
|
-
|
|
8
|
+
import { useLabels as Z } from "../../../tedi/providers/label-provider/use-labels.es.js";
|
|
9
|
+
import { autoUpdate as $ } from "../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
|
|
10
|
+
import { flip as ee, shift as oe } from "../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
|
|
11
|
+
const fe = (d) => {
|
|
12
|
+
X("Community Dropdown", "Use `Dropdown` from `@tedi-design-system/react/tedi` instead.");
|
|
13
|
+
const { getLabel: x } = Z(), { button: D, items: c, onItemClick: a, closeMenuOnClick: F = !0, ...h } = d, { initialFocus: v = -1, modal: p = !1, ...f } = d.focusManager ?? {}, { visuallyHiddenDismiss: _ = p ? x("close") : !1 } = f ?? {}, y = U(), m = l.useRef([]), [u, i] = l.useState(!1), [g, R] = l.useState(null), { x: C, y: M, strategy: N, refs: w, placement: O, context: n } = H({
|
|
12
14
|
placement: "bottom-start",
|
|
13
|
-
nodeId:
|
|
14
|
-
open:
|
|
15
|
-
onOpenChange:
|
|
16
|
-
middleware: [
|
|
17
|
-
whileElementsMounted:
|
|
18
|
-
}), P =
|
|
15
|
+
nodeId: y,
|
|
16
|
+
open: u,
|
|
17
|
+
onOpenChange: i,
|
|
18
|
+
middleware: [ee(), oe()],
|
|
19
|
+
whileElementsMounted: $
|
|
20
|
+
}), P = c.findIndex((e) => e.isActive), { getReferenceProps: A, getFloatingProps: E, getItemProps: L } = T([
|
|
19
21
|
q(n),
|
|
20
22
|
z(n, {
|
|
21
|
-
listRef:
|
|
23
|
+
listRef: m,
|
|
22
24
|
activeIndex: g,
|
|
23
25
|
selectedIndex: P,
|
|
24
|
-
onNavigate:
|
|
26
|
+
onNavigate: R,
|
|
25
27
|
loop: !0
|
|
26
28
|
}),
|
|
27
29
|
G(n, { role: "listbox" }),
|
|
@@ -39,30 +41,30 @@ const de = (c) => {
|
|
|
39
41
|
"div",
|
|
40
42
|
{
|
|
41
43
|
...E({
|
|
42
|
-
ref:
|
|
44
|
+
ref: w.setFloating,
|
|
43
45
|
style: {
|
|
44
|
-
position:
|
|
45
|
-
left:
|
|
46
|
-
top:
|
|
46
|
+
position: N,
|
|
47
|
+
left: C ?? 0,
|
|
48
|
+
top: M ?? 0
|
|
47
49
|
},
|
|
48
50
|
className: r.dropdown,
|
|
49
51
|
onKeyDown(o) {
|
|
50
|
-
o.key === "Tab" &&
|
|
52
|
+
o.key === "Tab" && i(!1);
|
|
51
53
|
}
|
|
52
54
|
}),
|
|
53
55
|
"data-placement": O,
|
|
54
|
-
children:
|
|
56
|
+
children: c.map((o, t) => k(o, t))
|
|
55
57
|
}
|
|
56
58
|
)
|
|
57
59
|
}
|
|
58
60
|
);
|
|
59
|
-
return
|
|
61
|
+
return u ? e : null;
|
|
60
62
|
}, j = (e) => W(r.dropdown__item, {
|
|
61
63
|
[r["dropdown__item--active"]]: e.isActive,
|
|
62
64
|
[r["dropdown__item--disabled"]]: e.isDisabled
|
|
63
|
-
}),
|
|
64
|
-
var
|
|
65
|
-
a == null || a(e, o, t), (
|
|
65
|
+
}), I = (e, o, t) => {
|
|
66
|
+
var b;
|
|
67
|
+
a == null || a(e, o, t), (b = e == null ? void 0 : e.onClick) == null || b.call(e, t), F && i(!1);
|
|
66
68
|
}, k = (e, o) => /* @__PURE__ */ s(
|
|
67
69
|
"button",
|
|
68
70
|
{
|
|
@@ -71,12 +73,12 @@ const de = (c) => {
|
|
|
71
73
|
tabIndex: g === o ? 0 : -1,
|
|
72
74
|
role: "option",
|
|
73
75
|
className: j(e),
|
|
74
|
-
onClick: (t) =>
|
|
76
|
+
onClick: (t) => I(e, o, t),
|
|
75
77
|
onKeyDown(t) {
|
|
76
|
-
t.key === "Enter" &&
|
|
78
|
+
t.key === "Enter" && I(e, o, t);
|
|
77
79
|
},
|
|
78
80
|
ref(t) {
|
|
79
|
-
|
|
81
|
+
m.current[o] = t;
|
|
80
82
|
}
|
|
81
83
|
}),
|
|
82
84
|
children: e.children
|
|
@@ -85,13 +87,13 @@ const de = (c) => {
|
|
|
85
87
|
);
|
|
86
88
|
return /* @__PURE__ */ B(K, { children: [
|
|
87
89
|
/* @__PURE__ */ s(
|
|
88
|
-
|
|
90
|
+
Y,
|
|
89
91
|
{
|
|
90
92
|
"data-name": "dropdown",
|
|
91
93
|
...h,
|
|
92
94
|
...D,
|
|
93
95
|
...A({
|
|
94
|
-
ref:
|
|
96
|
+
ref: w.setReference,
|
|
95
97
|
tabIndex: 0
|
|
96
98
|
})
|
|
97
99
|
}
|
|
@@ -100,5 +102,5 @@ const de = (c) => {
|
|
|
100
102
|
] });
|
|
101
103
|
};
|
|
102
104
|
export {
|
|
103
|
-
|
|
105
|
+
fe as Dropdown
|
|
104
106
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),_e=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),Y=require("../../../../../external/classnames/index.cjs.js"),d=require("react"),we=require("../../../../tedi/components/base/icon/icon.cjs.js"),m=require("../../../../tedi/components/buttons/button/button.cjs.js"),P=require("../../../../tedi/components/form/input-group/input-group.cjs.js"),Se=require("../../../../tedi/components/form/search/search.cjs.js"),b=require("../../../../tedi/components/overlays/dropdown/dropdown.cjs.js"),a=require("./category-search.module.scss.cjs.js"),Ie=require("./use-category-search.cjs.js"),Re=require("../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),Z=require("../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),$e={category:"Search category",searchInput:"Search",search:"Search",clear:"Clear",close:"Close",filter:"Filter",cancelFilter:"Clear filter",showFilters:"Show filters",showResults:"Show results",results:"Results",loading:"Searching…",noResults:"No results found.",searchError:"The search failed. Please try again.",filtersChanged:"Filters edited since searching.",resultCount:p=>`${p} results`},H=d.forwardRef(({categories:p,id:z,categoryId:G,defaultCategoryId:ee,onCategoryChange:C,open:M,defaultOpen:te=!1,onOpenChange:N,disabled:n=!1,size:i="default",labels:re,panelWidth:k="100%",maxPanelHeight:q="min(32rem, 70dvh)",className:se},le)=>{var J,W,X;const ne=d.useId(),y=z??`category-search-${ne}`,F=`${y}-panel`,s={...$e,...re},[ae,ie]=d.useState(ee??((J=p[0])==null?void 0:J.id)),[ce,oe]=d.useState(te),{states:ue,changeDraft:D,search:U,clear:de,cancel:V}=Ie.useCategorySearch(p),[fe,j]=d.useState(),I=d.useRef(null),A=d.useRef(null),K=d.useRef(null),v=d.useRef(!1),he=G??ae,e=p.find(t=>t.id===he)??p[0],l=e?ue.get(e.id):void 0,h=l==null?void 0:l.completedSearch,B=(l==null?void 0:l.status)==="loading",R=(l==null?void 0:l.status)==="error",w=!!(h||B||R),o=(e==null?void 0:e.mode)==="search",pe=M??ce;let f="closed";pe&&e&&l&&(o?l.draft&&w&&(f="results"):w&&fe!==e.id?f="results":f="filters");const x=f!=="closed",g=h?((W=e==null?void 0:e.getResultCount)==null?void 0:W.call(e,h.result))??(Array.isArray(h.result)?h.result.length:void 0):void 0,{refs:$,floatingStyles:me}=_e.useFloating({open:x,placement:"bottom-start",whileElementsMounted:Re.autoUpdate,middleware:[o&&Z.shift(),Z.size({apply({rects:t,availableWidth:u,elements:c}){o?(c.floating.style.width="",c.floating.style.maxWidth=`${Math.max(0,u)}px`):(c.floating.style.width=`${t.reference.width}px`,c.floating.style.maxWidth="")}})]});let E=s.filter,O=!1;f==="results"?E=s.showFilters:w&&(E=s.showResults,O=!0),d.useImperativeHandle(le,()=>I.current),d.useEffect(()=>{j(void 0)},[e==null?void 0:e.id]),d.useEffect(()=>{var u,c;if(f==="closed"||!v.current)return;v.current=!1;const t=document.activeElement;(t===document.body||t&&((u=I.current)!=null&&u.contains(t)))&&((c=$.floating.current)==null||c.focus())},[f,e==null?void 0:e.id,l,$.floating]);function _(t){M===void 0&&oe(t),N==null||N(t)}function xe(t){n||(G===void 0&&ie(t.id),C==null||C(t.id),_(!0))}function Q(){var t,u,c;o?(u=(t=K.current)==null?void 0:t.input)==null||u.focus():(c=A.current)==null||c.focus()}function S(){v.current=!1,_(!1),Q()}function T(){!e||n||(de(e),j(void 0),v.current=!1,_(!o),Q())}function ge(t){if(!(!e||n)){if(D(e.id,t),v.current=!1,_(t.length>0),!t){V(e.id);return}U(e,t)}}function ye(t){!e||!o||n||(V(e.id),D(e.id,t),S())}function L(){!e||!l||n||o&&!l.draft||(j(void 0),v.current=!0,_(!0),U(e,l.draft))}function je(){f==="closed"?(j(void 0),_(!0)):f==="results"?j(e==null?void 0:e.id):w?j(void 0):S()}function ve(t){var c;if(t.key!=="Escape"||t.defaultPrevented||!x)return;const u=t.target;(c=I.current)!=null&&c.contains(u)&&(u.closest('[role="combobox"][aria-expanded="true"]')||(t.stopPropagation(),t.preventDefault(),S()))}return r.jsx("div",{id:y,ref:I,className:Y.default(a.default["tedi-category-search"],a.default[`tedi-category-search--${i}`],se),style:{"--category-search-panel-width":typeof k=="number"?`${k}px`:k,"--category-search-panel-max-height":typeof q=="number"?`${q}px`:q},onKeyDown:ve,children:e&&l&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:a.default["tedi-category-search__bar"],children:r.jsxs(P.InputGroup,{id:`${y}-input`,label:o?s.searchInput:null,hideLabel:!0,disabled:n,children:[r.jsx("div",{ref:$.setReference,className:a.default["tedi-category-search__main"],children:o?r.jsx(P.InputGroup.Input,{children:r.jsx(Se.Search,{ref:K,id:`${y}-input`,name:`${y}-query`,value:l.draft,disabled:n,size:i,ariaLabel:e.label,placeholder:e.placeholder,onChange:ge,onClear:T,onSearch:L,button:{icon:"search",size:i,disabled:n,"aria-label":s.search},input:{"aria-controls":x?F:void 0}})}):r.jsxs("div",{className:a.default["tedi-category-search__actions"],children:[r.jsxs(m.Button,{id:`${y}-input`,ref:A,size:i,visualType:"link",iconLeft:"tune",disabled:n,"aria-expanded":x,"aria-controls":x?F:void 0,onClick:je,children:[E,O&&g!==void 0?` (${g})`:""]}),w&&r.jsx(m.Button,{size:i,visualType:"link",iconLeft:"close",disabled:n,onClick:T,children:s.cancelFilter})]})}),r.jsx(P.InputGroup.Suffix,{className:a.default["tedi-category-search__suffix"],children:r.jsxs(b.Dropdown,{defaultActiveIndex:p.indexOf(e),modal:!1,placement:"bottom-end",className:Y.default(a.default["tedi-category-search__menu"],a.default[`tedi-category-search__menu--${i}`]),children:[r.jsx(b.Dropdown.Trigger,{children:r.jsxs(m.Button,{noStyle:!0,size:i,disabled:n,"aria-label":`${s.category}: ${e.label}`,children:[r.jsx("span",{className:a.default["tedi-category-search__category-label"],children:e.label}),r.jsx(we.Icon,{name:"arrow_drop_down",color:"inherit"})]})}),r.jsx(b.Dropdown.Content,{children:p.map((t,u)=>r.jsx(b.Dropdown.Item,{index:u,className:a.default["tedi-category-search__menu-item"],role:"menuitemradio","aria-checked":e.id===t.id,active:e.id===t.id,disabled:n,onClick:()=>xe(t),children:t.label},t.id))})]})})]})}),x&&r.jsx("section",{id:F,ref:$.setFloating,style:me,tabIndex:-1,"aria-label":`${e.label}: ${f==="results"?s.results:s.filter}`,className:a.default["tedi-category-search__panel"],children:f==="filters"?r.jsxs("form",{onSubmit:t=>{t.preventDefault(),t.stopPropagation(),L()},children:[r.jsxs("fieldset",{disabled:n,className:a.default["tedi-category-search__fields"],children:[r.jsx("legend",{className:a.default["tedi-category-search__sr-only"],children:e.label}),(X=e.renderFilters)==null?void 0:X.call(e,{values:l.draft,onChange:t=>D(e.id,t),disabled:n,size:i})]}),r.jsxs("div",{className:a.default["tedi-category-search__footer"],children:[r.jsx(m.Button,{size:i,visualType:"link",onClick:S,children:s.close}),r.jsx(m.Button,{size:i,visualType:"secondary",disabled:n,onClick:T,children:s.clear}),r.jsx(m.Button,{size:i,type:"submit",formNoValidate:!1,disabled:n,children:s.search})]})]}):r.jsxs(r.Fragment,{children:[B&&r.jsx("p",{role:"status",children:s.loading}),R&&r.jsx("p",{role:"alert",children:s.searchError}),h&&r.jsxs("div",{"aria-label":s.results,children:[!o&&l.draft!==h.input&&r.jsx("p",{children:s.filtersChanged}),!o&&g!==void 0&&r.jsx("p",{children:s.resultCount(g)}),g===0?r.jsx("p",{children:s.noResults}):e.renderResults({value:h.input,result:h.result,selectResult:ye})]}),r.jsxs("div",{className:a.default["tedi-category-search__footer"],children:[r.jsx(m.Button,{size:i,visualType:"link",onClick:S,children:s.close}),o&&R&&r.jsx(m.Button,{size:i,disabled:n,onClick:L,children:s.search})]})]})}),r.jsx("span",{className:a.default["tedi-category-search__sr-only"],role:"status","aria-live":"polite","aria-atomic":"true",children:x&&!B&&!R&&h?`${e.label}: ${g!==void 0?s.resultCount(g):s.results}`:""})]})})});H.displayName="CategorySearch";exports.CategorySearch=H;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CategorySearchProps } from './category-search.types';
|
|
3
|
+
/**
|
|
4
|
+
* Search categories with independent drafts and results in an anchored, non-modal panel.
|
|
5
|
+
* The background remains interactive. Closing, switching categories, or editing a draft
|
|
6
|
+
* preserves completed results; clearing resets only the active category.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CategorySearch: React.ForwardRefExoticComponent<CategorySearchProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export default CategorySearch;
|