@tedi-design-system/react 18.0.0-rc.14 → 18.0.0-rc.16
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.es13.js +2 -2
- package/_virtual/index.es14.js +2 -2
- package/bundle-stats.html +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 +1 -1
- package/src/community/components/stepper/step.d.ts +6 -0
- package/src/community/components/stepper/stepper-nav.d.ts +6 -0
- package/src/community/components/stepper/stepper.d.ts +6 -0
- package/src/tedi/components/form/time-field/time-field-helpers.cjs.js +1 -1
- package/src/tedi/components/form/time-field/time-field-helpers.d.ts +1 -1
- package/src/tedi/components/form/time-field/time-field-helpers.es.js +1 -1
- package/src/tedi/components/form/time-field/time-field.cjs.js +1 -1
- package/src/tedi/components/form/time-field/time-field.d.ts +23 -1
- package/src/tedi/components/form/time-field/time-field.es.js +126 -94
- package/src/tedi/components/form/time-field/time-picker-modal/time-picker-modal.cjs.js +1 -0
- package/src/tedi/components/form/time-field/time-picker-modal/time-picker-modal.d.ts +30 -0
- package/src/tedi/components/form/time-field/time-picker-modal/time-picker-modal.es.js +59 -0
- package/src/tedi/components/form/time-field/time-picker-modal/time-picker-modal.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/time-field/time-picker-modal/time-picker-modal.module.scss.es.js +10 -0
- package/src/tedi/components/form/time-picker/components/time-grid/time-grid.cjs.js +1 -1
- package/src/tedi/components/form/time-picker/components/time-grid/time-grid.d.ts +5 -1
- package/src/tedi/components/form/time-picker/components/time-grid/time-grid.es.js +47 -64
- package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.cjs.js +1 -1
- package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.es.js +1 -1
- package/src/tedi/components/form/time-picker/time-picker.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/time-picker/time-picker.module.scss.es.js +1 -2
- package/src/tedi/components/navigation/horizontal-stepper/horizontal-stepper-context.cjs.js +1 -0
- package/src/tedi/components/navigation/horizontal-stepper/horizontal-stepper-context.d.ts +2 -0
- package/src/tedi/components/navigation/horizontal-stepper/horizontal-stepper-context.es.js +5 -0
- package/src/tedi/components/navigation/horizontal-stepper/horizontal-stepper-item.cjs.js +1 -0
- package/src/tedi/components/navigation/horizontal-stepper/horizontal-stepper-item.d.ts +45 -0
- package/src/tedi/components/navigation/horizontal-stepper/horizontal-stepper-item.es.js +50 -0
- package/src/tedi/components/navigation/horizontal-stepper/horizontal-stepper.cjs.js +1 -0
- package/src/tedi/components/navigation/horizontal-stepper/horizontal-stepper.d.ts +36 -0
- package/src/tedi/components/navigation/horizontal-stepper/horizontal-stepper.es.js +38 -0
- package/src/tedi/components/navigation/horizontal-stepper/horizontal-stepper.module.scss.cjs.js +1 -0
- package/src/tedi/components/navigation/horizontal-stepper/horizontal-stepper.module.scss.es.js +24 -0
- package/src/tedi/components/navigation/horizontal-stepper/index.d.ts +2 -0
- package/src/tedi/index.d.ts +1 -0
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +28 -0
- package/src/tedi/providers/label-provider/labels-map.es.js +28 -0
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +162 -158
|
@@ -1,101 +1,84 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { ChoiceGroup as R } from "../../../choice-group/choice-group.es.js";
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import A from "../../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useId as I, useRef as _, useEffect as N } from "react";
|
|
4
|
+
import { ChoiceGroup as $ } from "../../../choice-group/choice-group.es.js";
|
|
6
5
|
import d from "../../time-picker.module.scss.es.js";
|
|
7
|
-
import { useLabels as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
variant: p = "button",
|
|
17
|
-
bordered: g = !0
|
|
6
|
+
import { useLabels as v } from "../../../../../providers/label-provider/use-labels.es.js";
|
|
7
|
+
const C = ({
|
|
8
|
+
times: p,
|
|
9
|
+
value: n,
|
|
10
|
+
onSelect: f,
|
|
11
|
+
className: b,
|
|
12
|
+
colWidth: s = { xs: 6, md: 4 },
|
|
13
|
+
variant: m = "button",
|
|
14
|
+
bordered: y = !0
|
|
18
15
|
}) => {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
if (!
|
|
22
|
-
const e =
|
|
16
|
+
const c = I(), { getLabel: h } = v(), a = _(null);
|
|
17
|
+
N(() => {
|
|
18
|
+
if (!n) return;
|
|
19
|
+
const e = a.current;
|
|
23
20
|
if (!e) return;
|
|
24
|
-
const r = e.querySelector(
|
|
25
|
-
`input[type="radio"][value="${o}"], button[data-time="${o}"]`
|
|
26
|
-
);
|
|
21
|
+
const r = e.querySelector(`input[type="radio"][value="${n}"]`);
|
|
27
22
|
r == null || r.focus({ preventScroll: !0 });
|
|
28
23
|
}, []);
|
|
29
|
-
const
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
const r = s.current;
|
|
24
|
+
const k = (e) => {
|
|
25
|
+
var u;
|
|
26
|
+
const r = a.current;
|
|
33
27
|
if (!r) return;
|
|
34
28
|
const t = Array.from(r.querySelectorAll('input[type="radio"]:not([disabled])'));
|
|
35
29
|
if (t.length === 0) return;
|
|
36
|
-
const
|
|
37
|
-
let
|
|
30
|
+
const o = t.findIndex((x) => x === document.activeElement);
|
|
31
|
+
let i;
|
|
38
32
|
switch (e.key) {
|
|
39
33
|
case "ArrowDown":
|
|
40
34
|
case "ArrowRight":
|
|
41
|
-
|
|
35
|
+
i = o < 0 || o === t.length - 1 ? 0 : o + 1;
|
|
42
36
|
break;
|
|
43
37
|
case "ArrowUp":
|
|
44
38
|
case "ArrowLeft":
|
|
45
|
-
|
|
39
|
+
i = o <= 0 ? t.length - 1 : o - 1;
|
|
46
40
|
break;
|
|
47
41
|
case "Home":
|
|
48
|
-
|
|
42
|
+
i = 0;
|
|
49
43
|
break;
|
|
50
44
|
case "End":
|
|
51
|
-
|
|
45
|
+
i = t.length - 1;
|
|
52
46
|
break;
|
|
53
47
|
default:
|
|
54
48
|
return;
|
|
55
49
|
}
|
|
56
|
-
e.preventDefault(), (
|
|
57
|
-
},
|
|
50
|
+
e.preventDefault(), (u = t[i]) == null || u.focus();
|
|
51
|
+
}, w = A(
|
|
58
52
|
d["tedi-time-picker__grid"],
|
|
59
53
|
{
|
|
60
|
-
[d["tedi-time-picker__grid--borderless"]]: !
|
|
54
|
+
[d["tedi-time-picker__grid--borderless"]]: !y
|
|
61
55
|
},
|
|
62
|
-
|
|
63
|
-
),
|
|
64
|
-
return
|
|
65
|
-
|
|
56
|
+
b
|
|
57
|
+
), g = typeof s == "object" ? s : { width: s };
|
|
58
|
+
return /* @__PURE__ */ l("div", { ref: a, className: w, onKeyDown: k, children: /* @__PURE__ */ l(
|
|
59
|
+
$,
|
|
66
60
|
{
|
|
67
|
-
id: `time-picker-group-${
|
|
68
|
-
label:
|
|
61
|
+
id: `time-picker-group-${c}`,
|
|
62
|
+
label: h("timePicker.pickTime"),
|
|
69
63
|
inputType: "radio",
|
|
70
|
-
name: `time-grid-${
|
|
71
|
-
value:
|
|
72
|
-
onChange: (e) =>
|
|
73
|
-
items:
|
|
74
|
-
id: `time-${
|
|
75
|
-
label: e,
|
|
64
|
+
name: `time-grid-${c}`,
|
|
65
|
+
value: n,
|
|
66
|
+
onChange: (e) => f(e),
|
|
67
|
+
items: p.map((e) => ({
|
|
68
|
+
id: `time-${c}-${e}`,
|
|
69
|
+
label: m === "button" ? /* @__PURE__ */ l("span", { className: d["tedi-time-picker__slot-label"], children: e }) : e,
|
|
76
70
|
value: e,
|
|
77
|
-
colProps:
|
|
71
|
+
colProps: g
|
|
78
72
|
})),
|
|
79
73
|
direction: "row",
|
|
80
74
|
variant: "card",
|
|
81
|
-
showIndicator:
|
|
75
|
+
showIndicator: m === "radio",
|
|
82
76
|
color: "secondary",
|
|
83
77
|
hideLabel: !0
|
|
84
78
|
}
|
|
85
|
-
) })
|
|
86
|
-
$,
|
|
87
|
-
{
|
|
88
|
-
noStyle: !0,
|
|
89
|
-
"data-time": e,
|
|
90
|
-
className: h(d["tedi-time-picker__grid-item"], {
|
|
91
|
-
[d["tedi-time-picker__grid-item--selected"]]: e === o
|
|
92
|
-
}),
|
|
93
|
-
onClick: () => u(e),
|
|
94
|
-
children: e
|
|
95
|
-
}
|
|
96
|
-
))) }) });
|
|
79
|
+
) });
|
|
97
80
|
};
|
|
98
|
-
|
|
81
|
+
C.displayName = "TimeGrid";
|
|
99
82
|
export {
|
|
100
|
-
|
|
83
|
+
C as TimeGrid
|
|
101
84
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),j=require("../../../../../../../external/classnames/index.cjs.js"),n=require("react"),t=require("../../../time-field/time-field-helpers.cjs.js"),p=require("../../time-picker.module.scss.cjs.js"),F=({hours:c,minutes:l,selectedHour:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),j=require("../../../../../../../external/classnames/index.cjs.js"),n=require("react"),t=require("../../../time-field/time-field-helpers.cjs.js"),p=require("../../time-picker.module.scss.cjs.js"),F=({hours:c,minutes:l,selectedHour:s,selectedMinute:a,onChange:x,className:P,bordered:L=!0})=>{const I=n.useId(),i=n.useRef(null),d=n.useRef(null),f=n.useRef(!1),m=n.useRef(!1),g=n.useRef(),k=n.useRef(),v=n.useRef(-1),b=n.useRef(-1),[M,R]=n.useState(null),[C,$]=n.useState(null),N=(r,e)=>Math.max(0,Math.min(e-1,r)),A=(r,e,o)=>{const T=r.current;if(!T||e<0)return;const w=t.getScrollTopForIndex(e);o?f.current=!0:m.current=!0,T.scrollTo({top:w,behavior:"instant"}),requestAnimationFrame(()=>{o?f.current=!1:m.current=!1})};n.useLayoutEffect(()=>{const r=c.indexOf(s),e=l.indexOf(a);r!==v.current&&(v.current=r,A(i,r,!0)),e!==b.current&&(b.current=e,A(d,e,!1)),R(r),$(e)},[c,l,s,a]);const q=n.useRef(()=>{});q.current=()=>{const r=i.current;if(!r||f.current)return;t.clearScrollTimeout(g.current);const e=N(t.snapToNearestItem(r.scrollTop,c.length),c.length);R(e);const o=t.getScrollTopForIndex(e);t.needsScrollCorrection(r.scrollTop,o,8)&&(f.current=!0,t.scrollToIndex(r,e,"instant"),requestAnimationFrame(()=>{f.current=!1})),e!==v.current&&(v.current=e,x(c[e],a))};const y=n.useRef(()=>{});y.current=()=>{const r=d.current;if(!r||m.current)return;t.clearScrollTimeout(k.current);const e=N(t.snapToNearestItem(r.scrollTop,l.length),l.length);$(e);const o=t.getScrollTopForIndex(e);t.needsScrollCorrection(r.scrollTop,o,8)&&(m.current=!0,t.scrollToIndex(r,e,"instant"),requestAnimationFrame(()=>{m.current=!1})),e!==b.current&&(b.current=e,x(s,l[e]))},n.useEffect(()=>{const r=i.current,e=d.current;if(!r||!e)return;const o=()=>q.current(),T=()=>y.current();return r.addEventListener("scrollend",o),e.addEventListener("scrollend",T),()=>{r.removeEventListener("scrollend",o),e.removeEventListener("scrollend",T)}},[]);const H=()=>{if(!i.current||f.current)return;const r=N(t.snapToNearestItem(i.current.scrollTop,c.length),c.length);R(r),t.clearScrollTimeout(g.current),g.current=setTimeout(()=>q.current(),150)},K=()=>{if(!d.current||m.current)return;const r=N(t.snapToNearestItem(d.current.scrollTop,l.length),l.length);$(r),t.clearScrollTimeout(k.current),k.current=setTimeout(()=>y.current(),150)},W=r=>{const e=c[r];!e||!i.current||(t.clearScrollTimeout(g.current),v.current=r,R(r),x(e,a),f.current=!0,t.scrollToIndex(i.current,r,"smooth"),setTimeout(()=>{f.current=!1},300))},U=r=>{const e=l[r];!e||!d.current||(t.clearScrollTimeout(k.current),b.current=r,$(r),x(s,e),m.current=!0,t.scrollToIndex(d.current,r,"smooth"),setTimeout(()=>{m.current=!1},300))},D=(r,e,o,T)=>w=>{const u=e.indexOf(o);if(u===-1)return;let h=-1,_=!1;switch(w.key){case"ArrowDown":h=(u+1)%e.length,_=u===e.length-1;break;case"ArrowUp":h=(u-1+e.length)%e.length,_=u===0;break;case"Home":h=0;break;case"End":h=e.length-1;break;case"PageDown":h=(u+5)%e.length,_=u+5>=e.length;break;case"PageUp":h=(u-5+e.length)%e.length,_=u-5<0;break;case"Enter":case" ":w.preventDefault(),T(e[u]);return;default:return}w.preventDefault();const O=r==="hour"?i.current:d.current,S=O==null?void 0:O.querySelector(`#${CSS.escape(`${I}-${r}-${h}`)}`);S==null||S.focus(),S==null||S.scrollIntoView({block:"center",behavior:_?"instant":"smooth"})};return n.useEffect(()=>()=>{t.clearScrollTimeout(g.current),t.clearScrollTimeout(k.current)},[]),E.jsxs("div",{className:j.default(p.default["tedi-time-picker__wheel"],{[p.default["tedi-time-picker__wheel--borderless"]]:!L},P),children:[E.jsx("div",{ref:i,role:"listbox","aria-label":"Hours",tabIndex:0,"aria-activedescendant":`${I}-hour-${c.indexOf(s)}`,className:p.default["tedi-time-picker__wheel-column"],onScroll:H,onKeyDown:D("hour",c,s,r=>x(r,a)),children:c.map((r,e)=>E.jsx("div",{className:j.default(p.default["tedi-time-picker__wheel-item"],{[p.default["tedi-time-picker__wheel-item--selected"]]:e===(M??c.indexOf(s))}),onClick:()=>W(e),id:`${I}-hour-${e}`,role:"option","aria-selected":r===s,children:r},r))}),E.jsx("div",{ref:d,role:"listbox",className:p.default["tedi-time-picker__wheel-column"],onScroll:K,"aria-label":"Minutes",tabIndex:0,"aria-activedescendant":`${I}-minute-${l.indexOf(a)}`,onKeyDown:D("minute",l,a,r=>x(s,r)),children:l.map((r,e)=>E.jsx("div",{className:j.default(p.default["tedi-time-picker__wheel-item"],{[p.default["tedi-time-picker__wheel-item--selected"]]:e===(C??l.indexOf(a))}),onClick:()=>U(e),id:`${I}-minute-${e}`,role:"option","aria-selected":r===a,children:r},r))})]})};F.displayName="TimeWheel";exports.TimeWheel=F;
|
|
@@ -107,7 +107,7 @@ const Y = ({
|
|
|
107
107
|
}
|
|
108
108
|
I.preventDefault();
|
|
109
109
|
const q = r === "hour" ? a.current : s.current, T = q == null ? void 0 : q.querySelector(`#${CSS.escape(`${g}-${r}-${x}`)}`);
|
|
110
|
-
T == null || T.focus(), T == null || T.scrollIntoView({ block: "center", behavior: b ? "
|
|
110
|
+
T == null || T.focus(), T == null || T.scrollIntoView({ block: "center", behavior: b ? "instant" : "smooth" });
|
|
111
111
|
};
|
|
112
112
|
return j(() => () => {
|
|
113
113
|
d(v.current), d(S.current);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-time-picker__wheel":"tedi-time-picker__wheel-3c73e157","tedi-time-picker__wheel--borderless":"tedi-time-picker__wheel--borderless-42e8669c","tedi-time-picker__wheel-column":"tedi-time-picker__wheel-column-02048315","tedi-time-picker__wheel-item":"tedi-time-picker__wheel-item-78600fe1","tedi-time-picker__wheel-item--selected":"tedi-time-picker__wheel-item--selected-cc3c7194","tedi-time-picker__grid":"tedi-time-picker__grid-5cf42402","tedi-time-picker__grid--borderless":"tedi-time-picker__grid--borderless-805d6413","tedi-time-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-time-picker__wheel":"tedi-time-picker__wheel-3c73e157","tedi-time-picker__wheel--borderless":"tedi-time-picker__wheel--borderless-42e8669c","tedi-time-picker__wheel-column":"tedi-time-picker__wheel-column-02048315","tedi-time-picker__wheel-item":"tedi-time-picker__wheel-item-78600fe1","tedi-time-picker__wheel-item--selected":"tedi-time-picker__wheel-item--selected-cc3c7194","tedi-time-picker__grid":"tedi-time-picker__grid-5cf42402","tedi-time-picker__grid--borderless":"tedi-time-picker__grid--borderless-805d6413","tedi-time-picker__slot-label":"tedi-time-picker__slot-label-87a1b0e8"};exports.default=e;
|
|
@@ -6,8 +6,7 @@ const e = {
|
|
|
6
6
|
"tedi-time-picker__wheel-item--selected": "tedi-time-picker__wheel-item--selected-cc3c7194",
|
|
7
7
|
"tedi-time-picker__grid": "tedi-time-picker__grid-5cf42402",
|
|
8
8
|
"tedi-time-picker__grid--borderless": "tedi-time-picker__grid--borderless-805d6413",
|
|
9
|
-
"tedi-time-
|
|
10
|
-
"tedi-time-picker__grid-item--selected": "tedi-time-picker__grid-item--selected-32fb5e5d"
|
|
9
|
+
"tedi-time-picker__slot-label": "tedi-time-picker__slot-label-87a1b0e8"
|
|
11
10
|
};
|
|
12
11
|
export {
|
|
13
12
|
e as default
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=e.createContext(0);exports.HorizontalStepperStepNumberContext=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),_=require("../../../../../external/classnames/index.cjs.js"),f=require("react"),d=require("../../base/icon/icon.cjs.js"),e=require("./horizontal-stepper.module.scss.cjs.js"),x=require("./horizontal-stepper-context.cjs.js"),j=require("../../../providers/label-provider/use-labels.cjs.js"),l=c=>{const{label:u,description:a,completed:m,error:r,selected:i,disabled:s,onSelect:o,className:h}=c,{getLabel:n}=j.useLabels(),z=f.useContext(x.HorizontalStepperStepNumberContext),p=!!m&&!r,b=()=>{i||s||o==null||o()};return t.jsx("li",{"data-name":"horizontal-stepper-item",className:_.default(e.default["tedi-horizontal-stepper-item"],{[e.default["tedi-horizontal-stepper-item--selected"]]:i,[e.default["tedi-horizontal-stepper-item--completed"]]:p,[e.default["tedi-horizontal-stepper-item--error"]]:r,[e.default["tedi-horizontal-stepper-item--disabled"]]:s},h),children:t.jsxs("button",{type:"button",className:e.default["tedi-horizontal-stepper-item__step"],disabled:s,"aria-current":i?"step":void 0,onClick:b,children:[t.jsx("span",{className:e.default["tedi-horizontal-stepper-item__indicator"],children:p?t.jsx(d.Icon,{name:"check",color:"white",size:18,label:n("stepper.completed")}):r?t.jsx(d.Icon,{name:"priority_high",color:"white",size:18,label:n("stepper.error")}):t.jsx("span",{className:e.default["tedi-horizontal-stepper-item__number"],children:z})}),t.jsxs("span",{className:e.default["tedi-horizontal-stepper-item__content"],children:[t.jsx("span",{className:e.default["tedi-horizontal-stepper-item__label"],children:u}),a&&t.jsx("span",{className:e.default["tedi-horizontal-stepper-item__description"],children:a})]})]})})};l.displayName="HorizontalStepperItem";exports.HorizontalStepperItem=l;exports.default=l;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface HorizontalStepperItemProps {
|
|
2
|
+
/**
|
|
3
|
+
* Step label shown next to the indicator.
|
|
4
|
+
*/
|
|
5
|
+
label: string;
|
|
6
|
+
/**
|
|
7
|
+
* Secondary text rendered below the label.
|
|
8
|
+
*/
|
|
9
|
+
description?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Marks the step as completed — the indicator shows a check glyph. Ignored
|
|
12
|
+
* while `error` is set.
|
|
13
|
+
*/
|
|
14
|
+
completed?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Marks the step as invalid — the indicator shows a warning glyph and the
|
|
17
|
+
* step uses the danger colours. Takes precedence over `completed`.
|
|
18
|
+
*/
|
|
19
|
+
error?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Marks the step as the current one. Sets `aria-current="step"` and renders
|
|
22
|
+
* the selected (filled) treatment; the step is not clickable while selected.
|
|
23
|
+
*/
|
|
24
|
+
selected?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Prevents the step from being clicked or focused. Use for future steps the
|
|
27
|
+
* user shouldn't reach yet (e.g. when validation runs step-by-step). Leave
|
|
28
|
+
* completed steps enabled so users can navigate back to them.
|
|
29
|
+
*/
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Fired when the user activates the step. Does not fire when the step is
|
|
33
|
+
* `selected` (already current) or `disabled`.
|
|
34
|
+
*/
|
|
35
|
+
onSelect?: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Additional class name on the item's root element.
|
|
38
|
+
*/
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare const HorizontalStepperItem: {
|
|
42
|
+
(props: HorizontalStepperItemProps): JSX.Element;
|
|
43
|
+
displayName: string;
|
|
44
|
+
};
|
|
45
|
+
export default HorizontalStepperItem;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import N from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useContext as u } from "react";
|
|
4
|
+
import { Icon as m } from "../../base/icon/icon.es.js";
|
|
5
|
+
import e from "./horizontal-stepper.module.scss.es.js";
|
|
6
|
+
import { HorizontalStepperStepNumberContext as f } from "./horizontal-stepper-context.es.js";
|
|
7
|
+
import { useLabels as x } from "../../../providers/label-provider/use-labels.es.js";
|
|
8
|
+
const C = (c) => {
|
|
9
|
+
const { label: d, description: p, completed: h, error: r, selected: i, disabled: o, onSelect: s, className: z } = c, { getLabel: a } = x(), b = u(f), l = !!h && !r, _ = () => {
|
|
10
|
+
i || o || s == null || s();
|
|
11
|
+
};
|
|
12
|
+
return /* @__PURE__ */ t(
|
|
13
|
+
"li",
|
|
14
|
+
{
|
|
15
|
+
"data-name": "horizontal-stepper-item",
|
|
16
|
+
className: N(
|
|
17
|
+
e["tedi-horizontal-stepper-item"],
|
|
18
|
+
{
|
|
19
|
+
[e["tedi-horizontal-stepper-item--selected"]]: i,
|
|
20
|
+
[e["tedi-horizontal-stepper-item--completed"]]: l,
|
|
21
|
+
[e["tedi-horizontal-stepper-item--error"]]: r,
|
|
22
|
+
[e["tedi-horizontal-stepper-item--disabled"]]: o
|
|
23
|
+
},
|
|
24
|
+
z
|
|
25
|
+
),
|
|
26
|
+
children: /* @__PURE__ */ n(
|
|
27
|
+
"button",
|
|
28
|
+
{
|
|
29
|
+
type: "button",
|
|
30
|
+
className: e["tedi-horizontal-stepper-item__step"],
|
|
31
|
+
disabled: o,
|
|
32
|
+
"aria-current": i ? "step" : void 0,
|
|
33
|
+
onClick: _,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ t("span", { className: e["tedi-horizontal-stepper-item__indicator"], children: l ? /* @__PURE__ */ t(m, { name: "check", color: "white", size: 18, label: a("stepper.completed") }) : r ? /* @__PURE__ */ t(m, { name: "priority_high", color: "white", size: 18, label: a("stepper.error") }) : /* @__PURE__ */ t("span", { className: e["tedi-horizontal-stepper-item__number"], children: b }) }),
|
|
36
|
+
/* @__PURE__ */ n("span", { className: e["tedi-horizontal-stepper-item__content"], children: [
|
|
37
|
+
/* @__PURE__ */ t("span", { className: e["tedi-horizontal-stepper-item__label"], children: d }),
|
|
38
|
+
p && /* @__PURE__ */ t("span", { className: e["tedi-horizontal-stepper-item__description"], children: p })
|
|
39
|
+
] })
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
C.displayName = "HorizontalStepperItem";
|
|
47
|
+
export {
|
|
48
|
+
C as HorizontalStepperItem,
|
|
49
|
+
C as default
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),f=require("../../../../../external/classnames/index.cjs.js"),a=require("react"),e=require("./horizontal-stepper.module.scss.cjs.js"),S=require("./horizontal-stepper-context.cjs.js"),i=require("./horizontal-stepper-item.cjs.js"),l=a.forwardRef(({children:s,"aria-label":u,background:d="default",compact:r="sm",className:m},z)=>{let n=0;const c=a.Children.map(s,t=>a.isValidElement(t)&&t.type===i.HorizontalStepperItem?(n+=1,o.jsx(S.HorizontalStepperStepNumberContext.Provider,{value:n,children:t})):t);return o.jsx("nav",{ref:z,"aria-label":u,"data-name":"horizontal-stepper",className:f.default(e.default["tedi-horizontal-stepper"],{[e.default["tedi-horizontal-stepper--transparent"]]:d==="transparent",[e.default["tedi-horizontal-stepper--compact"]]:r===!0},typeof r=="string"&&e.default[`tedi-horizontal-stepper--compact-${r}`],m),children:o.jsx("ol",{className:e.default["tedi-horizontal-stepper__list"],children:c})})});l.displayName="HorizontalStepper";const p=Object.assign(l,{Item:i.HorizontalStepperItem});exports.HorizontalStepper=p;exports.default=p;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type HorizontalStepperBackground = 'default' | 'transparent';
|
|
3
|
+
export type HorizontalStepperCompact = boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
4
|
+
export interface HorizontalStepperProps {
|
|
5
|
+
/**
|
|
6
|
+
* `HorizontalStepper.Item` elements, one per step.
|
|
7
|
+
*/
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Accessible name for the navigation landmark.
|
|
11
|
+
*/
|
|
12
|
+
'aria-label'?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Background style of the stepper track.
|
|
15
|
+
* @default default
|
|
16
|
+
*/
|
|
17
|
+
background?: HorizontalStepperBackground;
|
|
18
|
+
/**
|
|
19
|
+
* Collapse labels so only the indicators plus the selected step's label are
|
|
20
|
+
* visible. `true` collapses at every width; a breakpoint (`'sm'`, `'md'`,
|
|
21
|
+
* `'lg'`, `'xl'`, `'xxl'`) collapses only below that breakpoint.
|
|
22
|
+
* @default sm
|
|
23
|
+
*/
|
|
24
|
+
compact?: HorizontalStepperCompact;
|
|
25
|
+
/**
|
|
26
|
+
* Additional class name on the root element.
|
|
27
|
+
*/
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare const HorizontalStepper: import('react').ForwardRefExoticComponent<HorizontalStepperProps & import('react').RefAttributes<HTMLElement>> & {
|
|
31
|
+
Item: {
|
|
32
|
+
(props: import('./horizontal-stepper-item').HorizontalStepperItemProps): JSX.Element;
|
|
33
|
+
displayName: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export default HorizontalStepper;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import z from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { forwardRef as u, Children as c, isValidElement as h } from "react";
|
|
4
|
+
import e from "./horizontal-stepper.module.scss.es.js";
|
|
5
|
+
import { HorizontalStepperStepNumberContext as N } from "./horizontal-stepper-context.es.js";
|
|
6
|
+
import { HorizontalStepperItem as p } from "./horizontal-stepper-item.es.js";
|
|
7
|
+
const i = u(
|
|
8
|
+
({ children: n, "aria-label": s, background: l = "default", compact: r = "sm", className: m }, d) => {
|
|
9
|
+
let a = 0;
|
|
10
|
+
const f = c.map(n, (t) => h(t) && t.type === p ? (a += 1, /* @__PURE__ */ o(N.Provider, { value: a, children: t })) : t);
|
|
11
|
+
return /* @__PURE__ */ o(
|
|
12
|
+
"nav",
|
|
13
|
+
{
|
|
14
|
+
ref: d,
|
|
15
|
+
"aria-label": s,
|
|
16
|
+
"data-name": "horizontal-stepper",
|
|
17
|
+
className: z(
|
|
18
|
+
e["tedi-horizontal-stepper"],
|
|
19
|
+
{
|
|
20
|
+
[e["tedi-horizontal-stepper--transparent"]]: l === "transparent",
|
|
21
|
+
[e["tedi-horizontal-stepper--compact"]]: r === !0
|
|
22
|
+
},
|
|
23
|
+
typeof r == "string" && e[`tedi-horizontal-stepper--compact-${r}`],
|
|
24
|
+
m
|
|
25
|
+
),
|
|
26
|
+
children: /* @__PURE__ */ o("ol", { className: e["tedi-horizontal-stepper__list"], children: f })
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
i.displayName = "HorizontalStepper";
|
|
32
|
+
const C = Object.assign(i, {
|
|
33
|
+
Item: p
|
|
34
|
+
});
|
|
35
|
+
export {
|
|
36
|
+
C as HorizontalStepper,
|
|
37
|
+
C as default
|
|
38
|
+
};
|
package/src/tedi/components/navigation/horizontal-stepper/horizontal-stepper.module.scss.cjs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-horizontal-stepper":"tedi-horizontal-stepper-36325c11","tedi-horizontal-stepper--transparent":"tedi-horizontal-stepper--transparent-71968b15","tedi-horizontal-stepper--compact":"tedi-horizontal-stepper--compact-82fea631","tedi-horizontal-stepper-item":"tedi-horizontal-stepper-item-3e2a41ca","tedi-horizontal-stepper-item--selected":"tedi-horizontal-stepper-item--selected-490ca638","tedi-horizontal-stepper-item__step":"tedi-horizontal-stepper-item__step-615ed27d","tedi-horizontal-stepper-item__content":"tedi-horizontal-stepper-item__content-8f33417f","tedi-horizontal-stepper--compact-sm":"tedi-horizontal-stepper--compact-sm-326a14fe","tedi-horizontal-stepper--compact-md":"tedi-horizontal-stepper--compact-md-aa582376","tedi-horizontal-stepper--compact-lg":"tedi-horizontal-stepper--compact-lg-1520fc41","tedi-horizontal-stepper--compact-xl":"tedi-horizontal-stepper--compact-xl-242fb9b8","tedi-horizontal-stepper--compact-xxl":"tedi-horizontal-stepper--compact-xxl-c032d0fd","tedi-horizontal-stepper__list":"tedi-horizontal-stepper__list-6cdbd337","tedi-horizontal-stepper-item__indicator":"tedi-horizontal-stepper-item__indicator-ae18c372","tedi-horizontal-stepper-item__number":"tedi-horizontal-stepper-item__number-d8803c85","tedi-horizontal-stepper-item__label":"tedi-horizontal-stepper-item__label-002ac63e","tedi-horizontal-stepper-item__description":"tedi-horizontal-stepper-item__description-3c4a57e8","tedi-horizontal-stepper-item--completed":"tedi-horizontal-stepper-item--completed-e9724250","tedi-horizontal-stepper-item--error":"tedi-horizontal-stepper-item--error-8a7b6bbb"};exports.default=e;
|
package/src/tedi/components/navigation/horizontal-stepper/horizontal-stepper.module.scss.es.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const t = {
|
|
2
|
+
"tedi-horizontal-stepper": "tedi-horizontal-stepper-36325c11",
|
|
3
|
+
"tedi-horizontal-stepper--transparent": "tedi-horizontal-stepper--transparent-71968b15",
|
|
4
|
+
"tedi-horizontal-stepper--compact": "tedi-horizontal-stepper--compact-82fea631",
|
|
5
|
+
"tedi-horizontal-stepper-item": "tedi-horizontal-stepper-item-3e2a41ca",
|
|
6
|
+
"tedi-horizontal-stepper-item--selected": "tedi-horizontal-stepper-item--selected-490ca638",
|
|
7
|
+
"tedi-horizontal-stepper-item__step": "tedi-horizontal-stepper-item__step-615ed27d",
|
|
8
|
+
"tedi-horizontal-stepper-item__content": "tedi-horizontal-stepper-item__content-8f33417f",
|
|
9
|
+
"tedi-horizontal-stepper--compact-sm": "tedi-horizontal-stepper--compact-sm-326a14fe",
|
|
10
|
+
"tedi-horizontal-stepper--compact-md": "tedi-horizontal-stepper--compact-md-aa582376",
|
|
11
|
+
"tedi-horizontal-stepper--compact-lg": "tedi-horizontal-stepper--compact-lg-1520fc41",
|
|
12
|
+
"tedi-horizontal-stepper--compact-xl": "tedi-horizontal-stepper--compact-xl-242fb9b8",
|
|
13
|
+
"tedi-horizontal-stepper--compact-xxl": "tedi-horizontal-stepper--compact-xxl-c032d0fd",
|
|
14
|
+
"tedi-horizontal-stepper__list": "tedi-horizontal-stepper__list-6cdbd337",
|
|
15
|
+
"tedi-horizontal-stepper-item__indicator": "tedi-horizontal-stepper-item__indicator-ae18c372",
|
|
16
|
+
"tedi-horizontal-stepper-item__number": "tedi-horizontal-stepper-item__number-d8803c85",
|
|
17
|
+
"tedi-horizontal-stepper-item__label": "tedi-horizontal-stepper-item__label-002ac63e",
|
|
18
|
+
"tedi-horizontal-stepper-item__description": "tedi-horizontal-stepper-item__description-3c4a57e8",
|
|
19
|
+
"tedi-horizontal-stepper-item--completed": "tedi-horizontal-stepper-item--completed-e9724250",
|
|
20
|
+
"tedi-horizontal-stepper-item--error": "tedi-horizontal-stepper-item--error-8a7b6bbb"
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
t as default
|
|
24
|
+
};
|
package/src/tedi/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export * from './components/notifications/toast/toast';
|
|
|
31
31
|
export * from './components/cards/card';
|
|
32
32
|
export * from './components/navigation/breadcrumbs';
|
|
33
33
|
export * from './components/navigation/hash-trigger/hash-trigger';
|
|
34
|
+
export * from './components/navigation/horizontal-stepper';
|
|
34
35
|
export * from './components/navigation/link/link';
|
|
35
36
|
export * from './components/navigation/pagination';
|
|
36
37
|
export * from './components/navigation/tabs';
|