@tedi-design-system/react 19.1.0-rc.19 → 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/bundle-stats.html +1 -1
- package/community.cjs.js +1 -1
- package/community.es.js +215 -230
- 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/index.css +1 -1
- package/package.json +1 -1
- 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/dropdown/dropdown.cjs.js +1 -1
- package/src/community/components/dropdown/dropdown.es.js +34 -32
- 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/carousel/carousel.cjs.js +1 -1
- package/src/community/components/map-components/carousel/carousel.es.js +19 -17
- 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 +1 -0
- 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 +64 -63
- 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/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,
|
|
@@ -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
|
};
|
|
@@ -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
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),S=require("../../../../../external/classnames/index.cjs.js"),j=require("react"),z=require("../../../../tedi/components/form/feedback-text/feedback-text.cjs.js"),A=require("../../../../tedi/components/form/form-label/form-label.cjs.js"),I=require("../../../../tedi/components/tags/tag/tag.cjs.js"),O=require("../../../../tedi/helpers/warn-deprecated/warn-deprecated.cjs.js"),P=require("../../button/button.cjs.js"),c=require("./file-upload.module.scss.cjs.js"),W=require("../../../../tedi/providers/label-provider/use-labels.cjs.js"),Y=require("../../card/card.cjs.js"),G=require("../../card/card-content/card-content.cjs.js"),J=require("../../../../tedi/components/layout/grid/row.cjs.js"),E=require("../../../../tedi/components/layout/grid/col.cjs.js"),K=({accept:a,maxSize:i},n)=>{if(!a&&!i)return;const s=[a&&`${n("file-upload.accept")} ${a.replaceAll(",",", ")}`,i&&`${n("file-upload.max-size")} ${i}MB`].filter(Boolean).join(". ");return s.length?{text:s}:void 0},Q=(a,i)=>{const n=a.reduce((s,{type:r,file:p})=>(s[r].push(p.name),s),{extension:[],size:[]});return Object.entries(n).filter(([s,r])=>r.length).map(([s,r])=>{const p=r.map(F=>`'${F}'`).join(", ");return i(`file-upload.${s}-rejected`,p)}).join(". ")},V=a=>{O.warnDeprecated("Community FileUpload","Use `FileUpload` from `@tedi-design-system/react/tedi` instead.");const{getLabel:i}=W.useLabels(),{id:n,name:s,accept:r,multiple:p,onChange:o,className:F,defaultFiles:M,onDelete:v,files:f,readOnly:b,disabled:m=!1,maxSize:h,helper:d=K({accept:r,maxSize:h},i),...N}=a,q=d?(d==null?void 0:d.id)??`${n}-helper`:void 0,[$,L]=j.useState(!1),[_,w]=j.useState(M||[]),[C,T]=j.useState(),k=S.default(c.default["file-upload"],{[c.default["file-upload-disabled"]]:m}),B=e=>{var x;if(!r)return!0;const l=(r==null?void 0:r.replace(/,/g,"").split("."))||[],u=(x=e.name.split(".").pop())==null?void 0:x.toLowerCase();return!!u&&l.includes(u)},y=j.useMemo(()=>f&&o?f:_,[f,_,o]),H=e=>{if(e.target.files){const l=[],u=[...Array.from(e.target.files)].filter(g=>B(g)?!0:(l.push({type:"extension",file:g}),!1)).filter(g=>!h||g.size<=h*1048576?!0:(l.push({type:"size",file:g}),!1)),x=[...y,...u];typeof f>"u"&&w(x),o==null||o(x),e.target.value="",l.length?T({type:"error",text:Q(l,i)}):T(void 0)}},D=e=>{const l=[...y].filter(u=>u!==e);v&&v(e),typeof f>"u"&&w(l),o==null||o(l)},R=(e,l)=>t.jsx("li",{children:t.jsx(I.Tag,{color:"secondary",onClose:!e.isLoading&&!m&&!b?()=>D(e):void 0,isLoading:e.isLoading,children:e.name})},l),U=()=>t.jsx("ul",{className:c.default["file-upload__items"],children:y.map((e,l)=>R(e,l))});return t.jsxs("div",{children:[t.jsx("div",{onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1),className:c.default["file-upload__label-wrapper"],children:t.jsx(A.FormLabel,{id:n,...N,renderWithoutLabel:b,className:c.default["file-upload__label"]})}),b?U():t.jsx(Y.Card,{padding:.5,background:m?"bg-disabled":void 0,className:c.default["file-upload__card"],children:t.jsx(G.CardContent,{children:t.jsxs(J.Row,{gutterY:2,children:[t.jsx(E.Col,{children:U()}),t.jsx(E.Col,{xs:12,md:"auto",align:"center",children:t.jsxs("div",{className:k,children:[t.jsx("input",{id:n,type:"file",name:s,accept:r,onChange:H,multiple:p,disabled:m}),t.jsx(P.Button,{visualType:"link",iconLeft:"file_upload","aria-describedby":q,isActive:$,disabled:m,onClick:()=>{var e;return(e=document.getElementById(n))==null?void 0:e.click()},children:i("file-upload.add")})]})})]})})}),(C||d)&&t.jsx(z.FeedbackText,{...C||d,id:q})]})};exports.FileUpload=V;
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { jsxs as _, jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import R from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import y from "react";
|
|
4
4
|
import { FeedbackText as O } from "../../../../tedi/components/form/feedback-text/feedback-text.es.js";
|
|
5
5
|
import { FormLabel as S } from "../../../../tedi/components/form/form-label/form-label.es.js";
|
|
6
6
|
import { Tag as W } from "../../../../tedi/components/tags/tag/tag.es.js";
|
|
7
|
-
import {
|
|
7
|
+
import { warnDeprecated as Y } from "../../../../tedi/helpers/warn-deprecated/warn-deprecated.es.js";
|
|
8
|
+
import { Button as q } from "../../button/button.es.js";
|
|
8
9
|
import c from "./file-upload.module.scss.es.js";
|
|
9
|
-
import { useLabels as
|
|
10
|
-
import { Card as
|
|
11
|
-
import { CardContent as
|
|
12
|
-
import { Row as
|
|
13
|
-
import { Col as
|
|
14
|
-
const
|
|
10
|
+
import { useLabels as G } from "../../../../tedi/providers/label-provider/use-labels.es.js";
|
|
11
|
+
import { Card as J } from "../../card/card.es.js";
|
|
12
|
+
import { CardContent as K } from "../../card/card-content/card-content.es.js";
|
|
13
|
+
import { Row as P } from "../../../../tedi/components/layout/grid/row.es.js";
|
|
14
|
+
import { Col as $ } from "../../../../tedi/components/layout/grid/col.es.js";
|
|
15
|
+
const Q = ({ accept: a, maxSize: i }, s) => {
|
|
15
16
|
if (!a && !i) return;
|
|
16
17
|
const o = [
|
|
17
18
|
a && `${s("file-upload.accept")} ${a.replaceAll(",", ", ")}`,
|
|
18
19
|
i && `${s("file-upload.max-size")} ${i}MB`
|
|
19
20
|
].filter(Boolean).join(". ");
|
|
20
21
|
return o.length ? { text: o } : void 0;
|
|
21
|
-
},
|
|
22
|
+
}, V = (a, i) => {
|
|
22
23
|
const s = a.reduce(
|
|
23
24
|
(o, { type: r, file: u }) => (o[r].push(u.name), o),
|
|
24
25
|
{ extension: [], size: [] }
|
|
@@ -27,45 +28,46 @@ const P = ({ accept: a, maxSize: i }, s) => {
|
|
|
27
28
|
const u = r.map((x) => `'${x}'`).join(", ");
|
|
28
29
|
return i(`file-upload.${o}-rejected`, u);
|
|
29
30
|
}).join(". ");
|
|
30
|
-
},
|
|
31
|
-
|
|
31
|
+
}, ue = (a) => {
|
|
32
|
+
Y("Community FileUpload", "Use `FileUpload` from `@tedi-design-system/react/tedi` instead.");
|
|
33
|
+
const { getLabel: i } = G(), {
|
|
32
34
|
id: s,
|
|
33
35
|
name: o,
|
|
34
36
|
accept: r,
|
|
35
37
|
multiple: u,
|
|
36
38
|
onChange: n,
|
|
37
39
|
className: x,
|
|
38
|
-
defaultFiles:
|
|
40
|
+
defaultFiles: M,
|
|
39
41
|
onDelete: j,
|
|
40
|
-
files:
|
|
41
|
-
readOnly:
|
|
42
|
-
disabled:
|
|
43
|
-
maxSize:
|
|
44
|
-
helper: d =
|
|
45
|
-
...
|
|
46
|
-
} = a, L = d ? (d == null ? void 0 : d.id) ?? `${s}-helper` : void 0, [
|
|
47
|
-
var
|
|
42
|
+
files: m,
|
|
43
|
+
readOnly: F,
|
|
44
|
+
disabled: f = !1,
|
|
45
|
+
maxSize: b,
|
|
46
|
+
helper: d = Q({ accept: r, maxSize: b }, i),
|
|
47
|
+
...k
|
|
48
|
+
} = a, L = d ? (d == null ? void 0 : d.id) ?? `${s}-helper` : void 0, [B, N] = y.useState(!1), [w, C] = y.useState(M || []), [E, T] = y.useState(), H = R(c["file-upload"], { [c["file-upload-disabled"]]: f }), z = (e) => {
|
|
49
|
+
var g;
|
|
48
50
|
if (!r)
|
|
49
51
|
return !0;
|
|
50
|
-
const t = (r == null ? void 0 : r.replace(/,/g, "").split(".")) || [], p = (
|
|
52
|
+
const t = (r == null ? void 0 : r.replace(/,/g, "").split(".")) || [], p = (g = e.name.split(".").pop()) == null ? void 0 : g.toLowerCase();
|
|
51
53
|
return !!p && t.includes(p);
|
|
52
|
-
},
|
|
54
|
+
}, v = y.useMemo(() => m && n ? m : w, [m, w, n]), A = (e) => {
|
|
53
55
|
if (e.target.files) {
|
|
54
|
-
const t = [], p = [...Array.from(e.target.files)].filter((
|
|
55
|
-
typeof
|
|
56
|
+
const t = [], p = [...Array.from(e.target.files)].filter((h) => z(h) ? !0 : (t.push({ type: "extension", file: h }), !1)).filter((h) => !b || h.size <= b * 1048576 ? !0 : (t.push({ type: "size", file: h }), !1)), g = [...v, ...p];
|
|
57
|
+
typeof m > "u" && C(g), n == null || n(g), e.target.value = "", t.length ? T({ type: "error", text: V(t, i) }) : T(void 0);
|
|
56
58
|
}
|
|
57
|
-
},
|
|
58
|
-
const t = [...
|
|
59
|
-
j && j(e), typeof
|
|
60
|
-
},
|
|
59
|
+
}, D = (e) => {
|
|
60
|
+
const t = [...v].filter((p) => p !== e);
|
|
61
|
+
j && j(e), typeof m > "u" && C(t), n == null || n(t);
|
|
62
|
+
}, I = (e, t) => /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(
|
|
61
63
|
W,
|
|
62
64
|
{
|
|
63
65
|
color: "secondary",
|
|
64
|
-
onClose: !e.isLoading && !
|
|
66
|
+
onClose: !e.isLoading && !f && !F ? () => D(e) : void 0,
|
|
65
67
|
isLoading: e.isLoading,
|
|
66
68
|
children: e.name
|
|
67
69
|
}
|
|
68
|
-
) }, t),
|
|
70
|
+
) }, t), U = () => /* @__PURE__ */ l("ul", { className: c["file-upload__items"], children: v.map((e, t) => I(e, t)) });
|
|
69
71
|
return /* @__PURE__ */ _("div", { children: [
|
|
70
72
|
/* @__PURE__ */ l(
|
|
71
73
|
"div",
|
|
@@ -73,12 +75,12 @@ const P = ({ accept: a, maxSize: i }, s) => {
|
|
|
73
75
|
onMouseEnter: () => N(!0),
|
|
74
76
|
onMouseLeave: () => N(!1),
|
|
75
77
|
className: c["file-upload__label-wrapper"],
|
|
76
|
-
children: /* @__PURE__ */ l(S, { id: s, ...
|
|
78
|
+
children: /* @__PURE__ */ l(S, { id: s, ...k, renderWithoutLabel: F, className: c["file-upload__label"] })
|
|
77
79
|
}
|
|
78
80
|
),
|
|
79
|
-
|
|
80
|
-
/* @__PURE__ */ l(
|
|
81
|
-
/* @__PURE__ */ l(
|
|
81
|
+
F ? U() : /* @__PURE__ */ l(J, { padding: 0.5, background: f ? "bg-disabled" : void 0, className: c["file-upload__card"], children: /* @__PURE__ */ l(K, { children: /* @__PURE__ */ _(P, { gutterY: 2, children: [
|
|
82
|
+
/* @__PURE__ */ l($, { children: U() }),
|
|
83
|
+
/* @__PURE__ */ l($, { xs: 12, md: "auto", align: "center", children: /* @__PURE__ */ _("div", { className: H, children: [
|
|
82
84
|
/* @__PURE__ */ l(
|
|
83
85
|
"input",
|
|
84
86
|
{
|
|
@@ -88,17 +90,17 @@ const P = ({ accept: a, maxSize: i }, s) => {
|
|
|
88
90
|
accept: r,
|
|
89
91
|
onChange: A,
|
|
90
92
|
multiple: u,
|
|
91
|
-
disabled:
|
|
93
|
+
disabled: f
|
|
92
94
|
}
|
|
93
95
|
),
|
|
94
96
|
/* @__PURE__ */ l(
|
|
95
|
-
|
|
97
|
+
q,
|
|
96
98
|
{
|
|
97
99
|
visualType: "link",
|
|
98
100
|
iconLeft: "file_upload",
|
|
99
101
|
"aria-describedby": L,
|
|
100
|
-
isActive:
|
|
101
|
-
disabled:
|
|
102
|
+
isActive: B,
|
|
103
|
+
disabled: f,
|
|
102
104
|
onClick: () => {
|
|
103
105
|
var e;
|
|
104
106
|
return (e = document.getElementById(s)) == null ? void 0 : e.click();
|
|
@@ -108,9 +110,9 @@ const P = ({ accept: a, maxSize: i }, s) => {
|
|
|
108
110
|
)
|
|
109
111
|
] }) })
|
|
110
112
|
] }) }) }),
|
|
111
|
-
(
|
|
113
|
+
(E || d) && /* @__PURE__ */ l(O, { ...E || d, id: L })
|
|
112
114
|
] });
|
|
113
115
|
};
|
|
114
116
|
export {
|
|
115
|
-
|
|
117
|
+
ue as FileUpload
|
|
116
118
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),D=require("../../../../../../external/classnames/index.cjs.js"),d=require("react"),H=require("../../../../../tedi/helpers/warn-deprecated/warn-deprecated.cjs.js"),S=require("./calendar.module.scss.cjs.js"),T=require("../../../../../../external/@mui/x-date-pickers/CalendarPicker/CalendarPicker.cjs.js"),B=require("../../../../../../external/@mui/x-date-pickers/PickersDay/PickersDay.cjs.js"),E=o=>{H.warnDeprecated("Community Calendar","Use `Calendar` from `@tedi-design-system/react/tedi` instead.");const{value:e,defaultValue:l,onChange:a,disabled:c,disableFuture:y,disableHighlightToday:f,disablePast:m,loading:g,minDate:b,maxDate:h,readOnly:C,view:q="day",views:M=["day"],showDaysOutsideCurrentMonth:P=!1,shouldHighlightDate:r,shouldDisableDate:p,shouldDisableMonth:x,shouldDisableYear:j,shouldShowStatusOnDate:i}=o,[s,k]=d.useState(l||null),v=d.useMemo(()=>a&&typeof e<"u"?e:s,[s,a,e]),w=n=>{!(n!=null&&n.isValid())&&n!==null||(typeof e>"u"&&k(n),!(n!=null&&n.isSame(s))&&(a==null||a(n)))},_=(n,F,O)=>{const R=r==null?void 0:r(n),t=i==null?void 0:i(n),V=D.default({"Mui-highlighted":R},{[S.default[`calendar__day--status-${t}`]]:t});return u.jsx(B.PickersDay,{className:V,...O})};return u.jsx(T.CalendarPicker,{"data-name":"calendar",date:v,onChange:w,disabled:c,disableFuture:y,disableHighlightToday:f,disablePast:m,loading:g,minDate:b,maxDate:h,readOnly:C,renderDay:_,shouldDisableDate:p,shouldDisableMonth:x,shouldDisableYear:j,showDaysOutsideCurrentMonth:P,view:q,views:M})};exports.Calendar=E;
|
|
@@ -1,60 +1,62 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
2
|
import N from "../../../../../../external/classnames/index.es.js";
|
|
3
|
-
import
|
|
4
|
-
import O from "
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
3
|
+
import t from "react";
|
|
4
|
+
import { warnDeprecated as O } from "../../../../../tedi/helpers/warn-deprecated/warn-deprecated.es.js";
|
|
5
|
+
import j from "./calendar.module.scss.es.js";
|
|
6
|
+
import { CalendarPicker as B } from "../../../../../../external/@mui/x-date-pickers/CalendarPicker/CalendarPicker.es.js";
|
|
7
|
+
import { PickersDay as E } from "../../../../../../external/@mui/x-date-pickers/PickersDay/PickersDay.es.js";
|
|
8
|
+
const G = (m) => {
|
|
9
|
+
O("Community Calendar", "Use `Calendar` from `@tedi-design-system/react/tedi` instead.");
|
|
8
10
|
const {
|
|
9
|
-
value:
|
|
10
|
-
defaultValue:
|
|
11
|
-
onChange:
|
|
12
|
-
disabled:
|
|
11
|
+
value: n,
|
|
12
|
+
defaultValue: u,
|
|
13
|
+
onChange: r,
|
|
14
|
+
disabled: l,
|
|
13
15
|
disableFuture: f,
|
|
14
16
|
disableHighlightToday: y,
|
|
15
|
-
disablePast:
|
|
16
|
-
loading:
|
|
17
|
+
disablePast: p,
|
|
18
|
+
loading: h,
|
|
17
19
|
minDate: g,
|
|
18
|
-
maxDate:
|
|
19
|
-
readOnly:
|
|
20
|
-
view:
|
|
21
|
-
views:
|
|
22
|
-
showDaysOutsideCurrentMonth:
|
|
20
|
+
maxDate: C,
|
|
21
|
+
readOnly: b,
|
|
22
|
+
view: c = "day",
|
|
23
|
+
views: M = ["day"],
|
|
24
|
+
showDaysOutsideCurrentMonth: _ = !1,
|
|
23
25
|
shouldHighlightDate: i,
|
|
24
26
|
shouldDisableDate: v,
|
|
25
|
-
shouldDisableMonth:
|
|
26
|
-
shouldDisableYear:
|
|
27
|
+
shouldDisableMonth: w,
|
|
28
|
+
shouldDisableYear: x,
|
|
27
29
|
shouldShowStatusOnDate: o
|
|
28
|
-
} =
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
|
|
30
|
+
} = m, [e, H] = t.useState(u || null), P = t.useMemo(() => r && typeof n < "u" ? n : e, [e, r, n]);
|
|
31
|
+
return /* @__PURE__ */ d(
|
|
32
|
+
B,
|
|
31
33
|
{
|
|
32
34
|
"data-name": "calendar",
|
|
33
|
-
date:
|
|
35
|
+
date: P,
|
|
34
36
|
onChange: (a) => {
|
|
35
|
-
!(a != null && a.isValid()) && a !== null || (typeof
|
|
37
|
+
!(a != null && a.isValid()) && a !== null || (typeof n > "u" && H(a), !(a != null && a.isSame(e)) && (r == null || r(a)));
|
|
36
38
|
},
|
|
37
|
-
disabled:
|
|
39
|
+
disabled: l,
|
|
38
40
|
disableFuture: f,
|
|
39
41
|
disableHighlightToday: y,
|
|
40
|
-
disablePast:
|
|
41
|
-
loading:
|
|
42
|
+
disablePast: p,
|
|
43
|
+
loading: h,
|
|
42
44
|
minDate: g,
|
|
43
|
-
maxDate:
|
|
44
|
-
readOnly:
|
|
45
|
-
renderDay: (a,
|
|
46
|
-
const
|
|
47
|
-
{ "Mui-highlighted":
|
|
48
|
-
{ [
|
|
45
|
+
maxDate: C,
|
|
46
|
+
readOnly: b,
|
|
47
|
+
renderDay: (a, T, R) => {
|
|
48
|
+
const V = i == null ? void 0 : i(a), s = o == null ? void 0 : o(a), k = N(
|
|
49
|
+
{ "Mui-highlighted": V },
|
|
50
|
+
{ [j[`calendar__day--status-${s}`]]: s }
|
|
49
51
|
);
|
|
50
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ d(E, { className: k, ...R });
|
|
51
53
|
},
|
|
52
54
|
shouldDisableDate: v,
|
|
53
|
-
shouldDisableMonth:
|
|
54
|
-
shouldDisableYear:
|
|
55
|
-
showDaysOutsideCurrentMonth:
|
|
56
|
-
view:
|
|
57
|
-
views:
|
|
55
|
+
shouldDisableMonth: w,
|
|
56
|
+
shouldDisableYear: x,
|
|
57
|
+
showDaysOutsideCurrentMonth: _,
|
|
58
|
+
view: c,
|
|
59
|
+
views: M
|
|
58
60
|
}
|
|
59
61
|
);
|
|
60
62
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),o=require("react"),I=require("../../../../../tedi/helpers/warn-deprecated/warn-deprecated.cjs.js"),O=require("../mui-input-transition/mui-input-transition.cjs.js"),h=require("../../../../../../external/@mui/x-date-pickers/TimePicker/TimePicker.cjs.js"),w=c=>{I.warnDeprecated("Community TimePicker","Use `TimeField` from `@tedi-design-system/react/tedi` instead.");const{defaultValue:m,onChange:n,value:t,disabled:p,readOnly:u,inputFormat:a="HH:mm",toolbarTitle:f,maxTime:T,minTime:y,minutesStep:P=1,onError:k,shouldDisableTime:x,views:b=["hours","minutes"],ampm:g=!1,onClose:r,...q}=c,[l,v]=o.useState(m||null),[C,i]=o.useState(!1),S=o.useMemo(()=>n&&typeof t<"u"?t:l,[l,n,t]),s=e=>{!(e!=null&&e.isValid())&&e!==null||(typeof t>"u"&&v(e),n==null||n(e))},j=()=>{i(!1),r==null||r()};return d.jsx(h.TimePicker,{"data-name":"timepicker",value:S,onChange:s,open:C,onOpen:()=>i(!0),onClose:j,renderInput:e=>d.jsx(O.default,{muiTextfieldProps:e,inputFormat:a,onChangeHandler:s,textfieldProps:{...q,onClear:()=>s(null),onIconClick:u?void 0:()=>i(H=>!H)},type:"time"}),disabled:p,readOnly:u,inputFormat:a,toolbarTitle:f,maxTime:T,minTime:y,minutesStep:P,onError:k,shouldDisableTime:x,views:b,ampm:g})};exports.TimePicker=w;
|