@tedi-design-system/react 19.0.1-rc.2 → 19.1.0-rc.1
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/vertical-stepper/step-item/step-item.d.ts +6 -0
- package/src/community/components/vertical-stepper/sub-item/sub-item.d.ts +6 -0
- package/src/community/components/vertical-stepper/vertical-stepper.d.ts +6 -0
- package/src/tedi/components/navigation/card-stepper/card-stepper-step.cjs.js +1 -0
- package/src/tedi/components/navigation/card-stepper/card-stepper-step.d.ts +86 -0
- package/src/tedi/components/navigation/card-stepper/card-stepper-step.es.js +5 -0
- package/src/tedi/components/navigation/card-stepper/card-stepper.cjs.js +1 -0
- package/src/tedi/components/navigation/card-stepper/card-stepper.d.ts +130 -0
- package/src/tedi/components/navigation/card-stepper/card-stepper.es.js +200 -0
- package/src/tedi/components/navigation/card-stepper/card-stepper.module.scss.cjs.js +1 -0
- package/src/tedi/components/navigation/card-stepper/card-stepper.module.scss.es.js +26 -0
- package/src/tedi/components/navigation/card-stepper/index.d.ts +2 -0
- 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.es.js +36 -58
- package/src/tedi/components/navigation/vertical-stepper/index.d.ts +3 -0
- package/src/tedi/components/navigation/vertical-stepper/vertical-stepper-context.cjs.js +1 -0
- package/src/tedi/components/navigation/vertical-stepper/vertical-stepper-context.d.ts +10 -0
- package/src/tedi/components/navigation/vertical-stepper/vertical-stepper-context.es.js +8 -0
- package/src/tedi/components/navigation/vertical-stepper/vertical-stepper-item.cjs.js +1 -0
- package/src/tedi/components/navigation/vertical-stepper/vertical-stepper-item.d.ts +74 -0
- package/src/tedi/components/navigation/vertical-stepper/vertical-stepper-item.es.js +109 -0
- package/src/tedi/components/navigation/vertical-stepper/vertical-stepper-sub-item.cjs.js +1 -0
- package/src/tedi/components/navigation/vertical-stepper/vertical-stepper-sub-item.d.ts +47 -0
- package/src/tedi/components/navigation/vertical-stepper/vertical-stepper-sub-item.es.js +65 -0
- package/src/tedi/components/navigation/vertical-stepper/vertical-stepper.cjs.js +1 -0
- package/src/tedi/components/navigation/vertical-stepper/vertical-stepper.d.ts +28 -0
- package/src/tedi/components/navigation/vertical-stepper/vertical-stepper.es.js +32 -0
- package/src/tedi/components/navigation/vertical-stepper/vertical-stepper.module.scss.cjs.js +1 -0
- package/src/tedi/components/navigation/vertical-stepper/vertical-stepper.module.scss.es.js +34 -0
- package/src/tedi/components/overlays/sheet/sheet.cjs.js +1 -0
- package/src/tedi/components/overlays/sheet/sheet.d.ts +65 -0
- package/src/tedi/components/overlays/sheet/sheet.es.js +41 -0
- package/src/tedi/components/overlays/sheet/sheet.module.scss.cjs.js +1 -0
- package/src/tedi/components/overlays/sheet/sheet.module.scss.es.js +8 -0
- package/src/tedi/index.d.ts +2 -0
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +42 -0
- package/src/tedi/providers/label-provider/labels-map.es.js +113 -71
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +282 -272
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tedi-design-system/react",
|
|
3
|
-
"version": "19.0
|
|
3
|
+
"version": "19.1.0-rc.1",
|
|
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,4 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use `VerticalStepper.Item` from `@tedi-design-system/react/tedi` instead.
|
|
4
|
+
*/
|
|
2
5
|
export interface StepItemProps {
|
|
3
6
|
/**
|
|
4
7
|
* SubItems
|
|
@@ -26,4 +29,7 @@ export interface StepItemProps {
|
|
|
26
29
|
/** Called when collapse is toggled */
|
|
27
30
|
onToggle?: (isOpen: boolean) => void;
|
|
28
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use `VerticalStepper.Item` from `@tedi-design-system/react/tedi` instead.
|
|
34
|
+
*/
|
|
29
35
|
export declare const StepItem: ({ children, className, isSelected, hasIcon, title, href, onClick, state, info, isOpen, onToggle, }: StepItemProps) => JSX.Element;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use `VerticalStepper.SubItem` from `@tedi-design-system/react/tedi` instead.
|
|
3
|
+
*/
|
|
1
4
|
export interface SubItemProps {
|
|
2
5
|
/**
|
|
3
6
|
* Additional info components like StatusBadge, Button, Link or Text.
|
|
@@ -15,4 +18,7 @@ export interface SubItemProps {
|
|
|
15
18
|
onClick?: () => void;
|
|
16
19
|
as?: 'a' | 'button';
|
|
17
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Use `VerticalStepper.SubItem` from `@tedi-design-system/react/tedi` instead.
|
|
23
|
+
*/
|
|
18
24
|
export declare const SubItem: ({ children, className, state, isSelected, hasIcon, title, href, as, onClick, }: SubItemProps) => JSX.Element;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use `VerticalStepper` from `@tedi-design-system/react/tedi` instead.
|
|
3
|
+
*/
|
|
1
4
|
export interface VerticalStepperProps {
|
|
2
5
|
/**
|
|
3
6
|
* SubItem or Separator
|
|
@@ -10,5 +13,8 @@ export interface VerticalStepperProps {
|
|
|
10
13
|
/** Compact version of the stepper */
|
|
11
14
|
isCompact?: boolean;
|
|
12
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use `VerticalStepper` from `@tedi-design-system/react/tedi` instead.
|
|
18
|
+
*/
|
|
13
19
|
export declare const VerticalStepper: (props: VerticalStepperProps) => JSX.Element;
|
|
14
20
|
export default VerticalStepper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=p=>null;e.displayName="CardStepperStep";exports.CardStepperStep=e;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { VerticalStepperItemState } from '../vertical-stepper/vertical-stepper-item';
|
|
3
|
+
import { VerticalStepperSubItemState } from '../vertical-stepper/vertical-stepper-sub-item';
|
|
4
|
+
export interface CardStepperSubStepProps {
|
|
5
|
+
/**
|
|
6
|
+
* Sub-step label.
|
|
7
|
+
*/
|
|
8
|
+
title: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Visual / semantic state shown in the step-list modal.
|
|
11
|
+
* @default default
|
|
12
|
+
*/
|
|
13
|
+
state?: VerticalStepperSubItemState;
|
|
14
|
+
/**
|
|
15
|
+
* Marks the sub-step as the active one.
|
|
16
|
+
*/
|
|
17
|
+
current?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Stable key for the sub-step. Falls back to the array index.
|
|
20
|
+
*/
|
|
21
|
+
id?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Renders the sub-step as disabled (non-interactive) in the modal.
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Click handler — makes the sub-step navigable in the modal and closes the list when picked.
|
|
28
|
+
*/
|
|
29
|
+
onClick?: (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Navigates when set; renders the sub-step as a link in the modal.
|
|
32
|
+
*/
|
|
33
|
+
href?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface CardStepperStepProps {
|
|
36
|
+
/**
|
|
37
|
+
* Step title.
|
|
38
|
+
*/
|
|
39
|
+
title: React.ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Optional secondary line shown under the title (on the card for the active
|
|
42
|
+
* step, and always in the step-list modal).
|
|
43
|
+
*/
|
|
44
|
+
description?: React.ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* Visual / semantic state used in the progress bar and the step-list modal.
|
|
47
|
+
* @default default
|
|
48
|
+
*/
|
|
49
|
+
state?: VerticalStepperItemState;
|
|
50
|
+
/**
|
|
51
|
+
* Stable key for the step. Falls back to the array index.
|
|
52
|
+
*/
|
|
53
|
+
id?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Excludes the step from navigation — not reachable via the arrows or the step
|
|
56
|
+
* list, and rendered as disabled in the modal.
|
|
57
|
+
*/
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Custom content rendered at the bottom of the card when this step is active —
|
|
61
|
+
* e.g. an inline `Alert`, a "read more" link or an action button. Only shown for
|
|
62
|
+
* the active step. Matches the Figma "with bottom slot" variant.
|
|
63
|
+
*/
|
|
64
|
+
bottomSlot?: React.ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* Sub-steps shown under this step in the step-list modal. When present the step
|
|
67
|
+
* becomes a collapsible parent — the title navigates and a chevron expands the
|
|
68
|
+
* sub-step list.
|
|
69
|
+
*/
|
|
70
|
+
subSteps?: CardStepperSubStepProps[];
|
|
71
|
+
/**
|
|
72
|
+
* Whether the sub-step list starts expanded in the modal. Defaults to expanded
|
|
73
|
+
* for the active step. Only relevant with `subSteps`.
|
|
74
|
+
*/
|
|
75
|
+
defaultExpanded?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Declarative step config for `CardStepper`. It renders nothing on its own — the
|
|
79
|
+
* parent reads its props to build the active card, the progress bar and the
|
|
80
|
+
* step-list modal. Use it as `CardStepper.Step`.
|
|
81
|
+
*/
|
|
82
|
+
export declare const CardStepperStep: {
|
|
83
|
+
(_props: CardStepperStepProps): null;
|
|
84
|
+
displayName: string;
|
|
85
|
+
};
|
|
86
|
+
export default CardStepperStep;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),h=require("../../../../../external/classnames/index.cjs.js"),m=require("react"),ce=require("../../base/icon/icon.cjs.js"),R=require("../../base/typography/text/text.cjs.js"),w=require("../../buttons/button/button.cjs.js"),le=require("../../overlays/sheet/sheet.cjs.js"),C=require("../vertical-stepper/vertical-stepper.cjs.js"),r=require("./card-stepper.module.scss.cjs.js"),V=require("./card-stepper-step.cjs.js"),pe=require("../../../providers/label-provider/use-labels.cjs.js"),D=m.forwardRef((F,z)=>{const{children:J,steps:G,activeStep:y,defaultActiveStep:K=0,onStepChange:j,showStepNumber:Q=!0,showStatusIcon:U=!1,descriptionPosition:g="bottom",counterPosition:S="inline",showProgress:q=!0,showNavigation:_=!1,showStepList:I=!0,allowJump:N=!0,headingElement:W="h4",labels:a,"aria-label":X,className:Y}=F,{getLabel:p}=pe.useLabels(),u={previous:(a==null?void 0:a.previous)??p("stepper.previous"),next:(a==null?void 0:a.next)??p("stepper.next"),openSteps:(a==null?void 0:a.openSteps)??p("stepper.open-steps"),modalHeading:(a==null?void 0:a.modalHeading)??p("stepper.steps"),status:(a==null?void 0:a.status)??((e,s)=>p("stepper.status",e,s))},k=m.Children.toArray(J).filter(e=>m.isValidElement(e)&&e.type===V.CardStepperStep).map(e=>e.props),n=k.length>0?k:G??[],T=y!==void 0,[Z,$]=m.useState(K),f=n.length,o=Math.min(Math.max(T?y:Z,0),Math.max(f-1,0)),[L,v]=m.useState(!1),ee=m.useId(),d=n[o],M=Q&&!_,te=_||M,b=e=>{var s;e<0||e>=f||e===o||(s=n[e])!=null&&s.disabled||(T||$(e),j==null||j(e))},re=e=>{const s=n[e];return!s||s.disabled?!1:N===!0?!0:N===!1?!1:N==="completed"?s.state==="completed":s.state==="completed"||e===o+1},O=(e,s)=>{for(let c=e;c>=0&&c<f;c+=s)if(!n[c].disabled)return c;return-1},P=O(o-1,-1),A=O(o+1,1);if(!d)return t.jsx(t.Fragment,{});const se=q&&!d.bottomSlot,B=t.jsxs("span",{className:r.default["tedi-card-stepper__counter"],children:[t.jsxs("span",{"aria-hidden":"true",children:[o+1," / ",f]}),t.jsx("span",{className:"visually-hidden",children:u.status(o+1,f)})]}),x=d.description?t.jsx(R.Text,{modifiers:"small",color:"tertiary",className:r.default["tedi-card-stepper__description"],children:d.description}):null,E=g==="top"&&x,ae=S==="top"||E,de=g==="bottom"&&n.some(e=>e.description);return t.jsxs("div",{ref:z,role:"group","aria-label":X,className:h.default(r.default["tedi-card-stepper"],{[r.default["tedi-card-stepper--progress-flush"]]:se,[r.default["tedi-card-stepper--reserve-description"]]:de},Y),children:[t.jsxs("div",{className:h.default(r.default["tedi-card-stepper__main"],{[r.default["tedi-card-stepper__main--no-lead"]]:!te}),children:[_&&t.jsx(w.Button,{visualType:"neutral",icon:"arrow_back",className:h.default(r.default["tedi-card-stepper__lead"],r.default["tedi-card-stepper__nav-prev"]),disabled:P===-1,onClick:()=>b(P),children:u.previous}),M&&t.jsx("span",{className:h.default(r.default["tedi-card-stepper__indicator"],r.default["tedi-card-stepper__lead"]),"aria-hidden":"true",children:o+1}),t.jsxs("div",{className:r.default["tedi-card-stepper__body"],children:[ae&&t.jsxs("div",{className:r.default["tedi-card-stepper__top"],children:[S==="top"&&B,E&&x]}),t.jsxs(R.Text,{element:W,id:ee,modifiers:"h4",className:r.default["tedi-card-stepper__title"],children:[d.title,U&&(d.state==="completed"||d.state==="error")&&t.jsx(ce.Icon,{name:d.state==="completed"?"check":"error",color:d.state==="completed"?"success":"danger",size:18,display:"block",label:p(d.state==="completed"?"stepper.completed":"stepper.error"),className:r.default["tedi-card-stepper__status-icon"]})]}),g==="bottom"&&x&&t.jsx("div",{className:r.default["tedi-card-stepper__description-bottom"],children:x})]}),t.jsxs("div",{className:r.default["tedi-card-stepper__trail"],children:[S==="inline"&&B,I&&t.jsx(w.Button,{visualType:"neutral",icon:"list","aria-haspopup":"dialog","aria-expanded":L,onClick:()=>v(!0),children:u.openSteps}),_&&t.jsx(w.Button,{visualType:"neutral",icon:"arrow_forward",className:r.default["tedi-card-stepper__nav-next"],disabled:A===-1,onClick:()=>b(A),children:u.next})]})]}),q&&t.jsx("ol",{className:r.default["tedi-card-stepper__progress"],"aria-hidden":"true",children:n.map((e,s)=>t.jsx("li",{className:h.default(r.default["tedi-card-stepper__segment"],{[r.default["tedi-card-stepper__segment--done"]]:s<=o})},e.id??s))}),d.bottomSlot&&t.jsx("div",{className:r.default["tedi-card-stepper__bottom-slot"],children:d.bottomSlot}),I&&t.jsx(le.Sheet,{open:L,onToggle:v,title:u.modalHeading,children:t.jsx(C.VerticalStepper,{"aria-label":u.modalHeading,children:n.map((e,s)=>{const c=re(s),l=e.subSteps,ie=!!(l!=null&&l.some(i=>i.current));return t.jsx(C.VerticalStepper.Item,{title:e.title,description:e.description,state:e.disabled?"disabled":e.state,current:s===o&&!ie,onClick:c?()=>{b(s),v(!1)}:void 0,defaultOpen:l?e.defaultExpanded??s===o:void 0,children:l==null?void 0:l.map((i,oe)=>t.jsx(C.VerticalStepper.SubItem,{title:i.title,state:i.disabled?"disabled":i.state,current:i.current,href:i.href,onClick:i.onClick?ne=>{var H;(H=i.onClick)==null||H.call(i,ne),v(!1)}:void 0},i.id??oe))},e.id??s)})})})]})});D.displayName="CardStepper";const ue=Object.assign(D,{Step:V.CardStepperStep});exports.CardStepper=ue;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CardStepperStepProps } from './card-stepper-step';
|
|
3
|
+
/**
|
|
4
|
+
* Per-instance label overrides. When omitted, each label comes from the
|
|
5
|
+
* `LabelProvider` (`stepper.previous`, `stepper.next`, `stepper.open-steps`,
|
|
6
|
+
* `stepper.steps`, `stepper.status`).
|
|
7
|
+
*/
|
|
8
|
+
export interface CardStepperLabels {
|
|
9
|
+
/** Accessible label for the previous-step button. Defaults to the `stepper.previous` label. */
|
|
10
|
+
previous?: string;
|
|
11
|
+
/** Accessible label for the next-step button. Defaults to the `stepper.next` label. */
|
|
12
|
+
next?: string;
|
|
13
|
+
/** Accessible label for the button that opens the step list. Defaults to the `stepper.open-steps` label. */
|
|
14
|
+
openSteps?: string;
|
|
15
|
+
/** Heading of the step-list modal. Defaults to the `stepper.steps` label. */
|
|
16
|
+
modalHeading?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Screen-reader phrasing for the `N / M` counter (the visible "N / M" is hidden
|
|
19
|
+
* from assistive tech, since "N slash M" reads poorly). Defaults to the
|
|
20
|
+
* `stepper.status` label.
|
|
21
|
+
*/
|
|
22
|
+
status?: (current: number, total: number) => string;
|
|
23
|
+
}
|
|
24
|
+
export interface CardStepperProps {
|
|
25
|
+
/**
|
|
26
|
+
* `CardStepper.Step` elements (compound API) — the active step shows on the
|
|
27
|
+
* card, all steps in the modal. Alternative to the `steps` data prop.
|
|
28
|
+
*/
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Steps as data (alternative to `CardStepper.Step` children). Ignored when
|
|
32
|
+
* `children` contains `CardStepper.Step` elements.
|
|
33
|
+
*/
|
|
34
|
+
steps?: CardStepperStepProps[];
|
|
35
|
+
/**
|
|
36
|
+
* Active step index (0-based), controlled. Pair with `onStepChange`.
|
|
37
|
+
*/
|
|
38
|
+
activeStep?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Initial active step index for uncontrolled usage.
|
|
41
|
+
* @default 0
|
|
42
|
+
*/
|
|
43
|
+
defaultActiveStep?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Fired with the new index when the user navigates (arrows) or picks a step
|
|
46
|
+
* in the modal.
|
|
47
|
+
*/
|
|
48
|
+
onStepChange?: (index: number) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Show the active step's number in a ring indicator on the left. Ignored when
|
|
51
|
+
* `showNavigation` is set — the back arrow occupies the left slot instead.
|
|
52
|
+
* @default true
|
|
53
|
+
*/
|
|
54
|
+
showStepNumber?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Show a status icon next to the active step's title — a success check when the
|
|
57
|
+
* step's `state` is `'completed'`, a danger icon when it's `'error'`. Nothing is
|
|
58
|
+
* shown for other states.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
showStatusIcon?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Where the active step's `description` sits relative to its title:
|
|
64
|
+
* - `'bottom'` (default) — below the title.
|
|
65
|
+
* - `'top'` — above the title, as a small secondary line.
|
|
66
|
+
* @default bottom
|
|
67
|
+
*/
|
|
68
|
+
descriptionPosition?: 'top' | 'bottom';
|
|
69
|
+
/**
|
|
70
|
+
* Where the `N / M` step counter sits:
|
|
71
|
+
* - `'inline'` (default) — in the trailing controls, next to the list / next button.
|
|
72
|
+
* - `'top'` — above the title (and removed from the trailing controls).
|
|
73
|
+
* @default inline
|
|
74
|
+
*/
|
|
75
|
+
counterPosition?: 'inline' | 'top';
|
|
76
|
+
/**
|
|
77
|
+
* Show the segmented progress bar below the row.
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
80
|
+
showProgress?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Show previous / next arrow buttons on the edges. They move sequentially and
|
|
83
|
+
* skip `disabled` steps.
|
|
84
|
+
* @default false
|
|
85
|
+
*/
|
|
86
|
+
showNavigation?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Show the list button and the step-list modal. Turn off for a read-only
|
|
89
|
+
* progress tracker or an arrows-only flow.
|
|
90
|
+
* @default true
|
|
91
|
+
*/
|
|
92
|
+
showStepList?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Which steps can be jumped to from the step-list modal:
|
|
95
|
+
* - `true` — any step
|
|
96
|
+
* - `false` — none (the list is read-only)
|
|
97
|
+
* - `'completed'` — only completed steps
|
|
98
|
+
* - `'completed-or-next'` — completed steps and the one immediately after the active step
|
|
99
|
+
*
|
|
100
|
+
* A per-step `disabled` always wins. The prev/next arrows are sequential and are
|
|
101
|
+
* **not** gated by this.
|
|
102
|
+
* @default true
|
|
103
|
+
*/
|
|
104
|
+
allowJump?: boolean | 'completed' | 'completed-or-next';
|
|
105
|
+
/**
|
|
106
|
+
* Heading element for the active step's title — set it to fit the surrounding
|
|
107
|
+
* page's heading hierarchy. The visual size is unchanged.
|
|
108
|
+
* @default h4
|
|
109
|
+
*/
|
|
110
|
+
headingElement?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
111
|
+
/**
|
|
112
|
+
* Accessible label overrides. Otherwise sourced from the `LabelProvider`.
|
|
113
|
+
*/
|
|
114
|
+
labels?: CardStepperLabels;
|
|
115
|
+
/**
|
|
116
|
+
* Accessible name for the card region.
|
|
117
|
+
*/
|
|
118
|
+
'aria-label'?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Additional class name applied to the card root.
|
|
121
|
+
*/
|
|
122
|
+
className?: string;
|
|
123
|
+
}
|
|
124
|
+
export declare const CardStepper: React.ForwardRefExoticComponent<CardStepperProps & React.RefAttributes<HTMLDivElement>> & {
|
|
125
|
+
Step: {
|
|
126
|
+
(_props: CardStepperStepProps): null;
|
|
127
|
+
displayName: string;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
export default CardStepper;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { jsx as s, Fragment as le, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import _ from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import D, { forwardRef as me, useState as F, useId as ue } from "react";
|
|
4
|
+
import { Icon as he } from "../../base/icon/icon.es.js";
|
|
5
|
+
import { Text as V } from "../../base/typography/text/text.es.js";
|
|
6
|
+
import { Button as y } from "../../buttons/button/button.es.js";
|
|
7
|
+
import { Sheet as _e } from "../../overlays/sheet/sheet.es.js";
|
|
8
|
+
import { VerticalStepper as I } from "../vertical-stepper/vertical-stepper.es.js";
|
|
9
|
+
import t from "./card-stepper.module.scss.es.js";
|
|
10
|
+
import { CardStepperStep as z } from "./card-stepper-step.es.js";
|
|
11
|
+
import { useLabels as fe } from "../../../providers/label-provider/use-labels.es.js";
|
|
12
|
+
const J = me((q, G) => {
|
|
13
|
+
const {
|
|
14
|
+
children: K,
|
|
15
|
+
steps: Q,
|
|
16
|
+
activeStep: k,
|
|
17
|
+
defaultActiveStep: U = 0,
|
|
18
|
+
onStepChange: N,
|
|
19
|
+
showStepNumber: W = !0,
|
|
20
|
+
showStatusIcon: X = !1,
|
|
21
|
+
descriptionPosition: w = "bottom",
|
|
22
|
+
counterPosition: b = "inline",
|
|
23
|
+
showProgress: T = !0,
|
|
24
|
+
showNavigation: f = !1,
|
|
25
|
+
showStepList: L = !0,
|
|
26
|
+
allowJump: C = !0,
|
|
27
|
+
headingElement: Y = "h4",
|
|
28
|
+
labels: a,
|
|
29
|
+
"aria-label": Z,
|
|
30
|
+
className: $
|
|
31
|
+
} = q, { getLabel: m } = fe(), u = {
|
|
32
|
+
previous: (a == null ? void 0 : a.previous) ?? m("stepper.previous"),
|
|
33
|
+
next: (a == null ? void 0 : a.next) ?? m("stepper.next"),
|
|
34
|
+
openSteps: (a == null ? void 0 : a.openSteps) ?? m("stepper.open-steps"),
|
|
35
|
+
modalHeading: (a == null ? void 0 : a.modalHeading) ?? m("stepper.steps"),
|
|
36
|
+
status: (a == null ? void 0 : a.status) ?? ((e, r) => m("stepper.status", e, r))
|
|
37
|
+
}, x = D.Children.toArray(K).filter(
|
|
38
|
+
(e) => D.isValidElement(e) && e.type === z
|
|
39
|
+
).map((e) => e.props), n = x.length > 0 ? x : Q ?? [], j = k !== void 0, [ee, te] = F(U), h = n.length, d = Math.min(Math.max(j ? k : ee, 0), Math.max(h - 1, 0)), [A, v] = F(!1), re = ue(), o = n[d], E = W && !f, se = f || E, S = (e) => {
|
|
40
|
+
var r;
|
|
41
|
+
e < 0 || e >= h || e === d || (r = n[e]) != null && r.disabled || (j || te(e), N == null || N(e));
|
|
42
|
+
}, ae = (e) => {
|
|
43
|
+
const r = n[e];
|
|
44
|
+
return !r || r.disabled ? !1 : C === !0 ? !0 : C === !1 ? !1 : C === "completed" ? r.state === "completed" : r.state === "completed" || e === d + 1;
|
|
45
|
+
}, H = (e, r) => {
|
|
46
|
+
for (let p = e; p >= 0 && p < h; p += r)
|
|
47
|
+
if (!n[p].disabled) return p;
|
|
48
|
+
return -1;
|
|
49
|
+
}, M = H(d - 1, -1), O = H(d + 1, 1);
|
|
50
|
+
if (!o) return /* @__PURE__ */ s(le, {});
|
|
51
|
+
const oe = T && !o.bottomSlot, P = /* @__PURE__ */ c("span", { className: t["tedi-card-stepper__counter"], children: [
|
|
52
|
+
/* @__PURE__ */ c("span", { "aria-hidden": "true", children: [
|
|
53
|
+
d + 1,
|
|
54
|
+
" / ",
|
|
55
|
+
h
|
|
56
|
+
] }),
|
|
57
|
+
/* @__PURE__ */ s("span", { className: "visually-hidden", children: u.status(d + 1, h) })
|
|
58
|
+
] }), g = o.description ? /* @__PURE__ */ s(V, { modifiers: "small", color: "tertiary", className: t["tedi-card-stepper__description"], children: o.description }) : null, R = w === "top" && g, ie = b === "top" || R, de = w === "bottom" && n.some((e) => e.description);
|
|
59
|
+
return /* @__PURE__ */ c(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
ref: G,
|
|
63
|
+
role: "group",
|
|
64
|
+
"aria-label": Z,
|
|
65
|
+
className: _(
|
|
66
|
+
t["tedi-card-stepper"],
|
|
67
|
+
{
|
|
68
|
+
[t["tedi-card-stepper--progress-flush"]]: oe,
|
|
69
|
+
[t["tedi-card-stepper--reserve-description"]]: de
|
|
70
|
+
},
|
|
71
|
+
$
|
|
72
|
+
),
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ c(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
className: _(t["tedi-card-stepper__main"], {
|
|
78
|
+
[t["tedi-card-stepper__main--no-lead"]]: !se
|
|
79
|
+
}),
|
|
80
|
+
children: [
|
|
81
|
+
f && /* @__PURE__ */ s(
|
|
82
|
+
y,
|
|
83
|
+
{
|
|
84
|
+
visualType: "neutral",
|
|
85
|
+
icon: "arrow_back",
|
|
86
|
+
className: _(t["tedi-card-stepper__lead"], t["tedi-card-stepper__nav-prev"]),
|
|
87
|
+
disabled: M === -1,
|
|
88
|
+
onClick: () => S(M),
|
|
89
|
+
children: u.previous
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
E && /* @__PURE__ */ s(
|
|
93
|
+
"span",
|
|
94
|
+
{
|
|
95
|
+
className: _(t["tedi-card-stepper__indicator"], t["tedi-card-stepper__lead"]),
|
|
96
|
+
"aria-hidden": "true",
|
|
97
|
+
children: d + 1
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
/* @__PURE__ */ c("div", { className: t["tedi-card-stepper__body"], children: [
|
|
101
|
+
ie && /* @__PURE__ */ c("div", { className: t["tedi-card-stepper__top"], children: [
|
|
102
|
+
b === "top" && P,
|
|
103
|
+
R && g
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ c(V, { element: Y, id: re, modifiers: "h4", className: t["tedi-card-stepper__title"], children: [
|
|
106
|
+
o.title,
|
|
107
|
+
X && (o.state === "completed" || o.state === "error") && /* @__PURE__ */ s(
|
|
108
|
+
he,
|
|
109
|
+
{
|
|
110
|
+
name: o.state === "completed" ? "check" : "error",
|
|
111
|
+
color: o.state === "completed" ? "success" : "danger",
|
|
112
|
+
size: 18,
|
|
113
|
+
display: "block",
|
|
114
|
+
label: m(o.state === "completed" ? "stepper.completed" : "stepper.error"),
|
|
115
|
+
className: t["tedi-card-stepper__status-icon"]
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] }),
|
|
119
|
+
w === "bottom" && g && /* @__PURE__ */ s("div", { className: t["tedi-card-stepper__description-bottom"], children: g })
|
|
120
|
+
] }),
|
|
121
|
+
/* @__PURE__ */ c("div", { className: t["tedi-card-stepper__trail"], children: [
|
|
122
|
+
b === "inline" && P,
|
|
123
|
+
L && /* @__PURE__ */ s(
|
|
124
|
+
y,
|
|
125
|
+
{
|
|
126
|
+
visualType: "neutral",
|
|
127
|
+
icon: "list",
|
|
128
|
+
"aria-haspopup": "dialog",
|
|
129
|
+
"aria-expanded": A,
|
|
130
|
+
onClick: () => v(!0),
|
|
131
|
+
children: u.openSteps
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
f && /* @__PURE__ */ s(
|
|
135
|
+
y,
|
|
136
|
+
{
|
|
137
|
+
visualType: "neutral",
|
|
138
|
+
icon: "arrow_forward",
|
|
139
|
+
className: t["tedi-card-stepper__nav-next"],
|
|
140
|
+
disabled: O === -1,
|
|
141
|
+
onClick: () => S(O),
|
|
142
|
+
children: u.next
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
] })
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
T && /* @__PURE__ */ s("ol", { className: t["tedi-card-stepper__progress"], "aria-hidden": "true", children: n.map((e, r) => /* @__PURE__ */ s(
|
|
150
|
+
"li",
|
|
151
|
+
{
|
|
152
|
+
className: _(t["tedi-card-stepper__segment"], {
|
|
153
|
+
[t["tedi-card-stepper__segment--done"]]: r <= d
|
|
154
|
+
})
|
|
155
|
+
},
|
|
156
|
+
e.id ?? r
|
|
157
|
+
)) }),
|
|
158
|
+
o.bottomSlot && /* @__PURE__ */ s("div", { className: t["tedi-card-stepper__bottom-slot"], children: o.bottomSlot }),
|
|
159
|
+
L && /* @__PURE__ */ s(_e, { open: A, onToggle: v, title: u.modalHeading, children: /* @__PURE__ */ s(I, { "aria-label": u.modalHeading, children: n.map((e, r) => {
|
|
160
|
+
const p = ae(r), l = e.subSteps, ne = !!(l != null && l.some((i) => i.current));
|
|
161
|
+
return /* @__PURE__ */ s(
|
|
162
|
+
I.Item,
|
|
163
|
+
{
|
|
164
|
+
title: e.title,
|
|
165
|
+
description: e.description,
|
|
166
|
+
state: e.disabled ? "disabled" : e.state,
|
|
167
|
+
current: r === d && !ne,
|
|
168
|
+
onClick: p ? () => {
|
|
169
|
+
S(r), v(!1);
|
|
170
|
+
} : void 0,
|
|
171
|
+
defaultOpen: l ? e.defaultExpanded ?? r === d : void 0,
|
|
172
|
+
children: l == null ? void 0 : l.map((i, ce) => /* @__PURE__ */ s(
|
|
173
|
+
I.SubItem,
|
|
174
|
+
{
|
|
175
|
+
title: i.title,
|
|
176
|
+
state: i.disabled ? "disabled" : i.state,
|
|
177
|
+
current: i.current,
|
|
178
|
+
href: i.href,
|
|
179
|
+
onClick: i.onClick ? (pe) => {
|
|
180
|
+
var B;
|
|
181
|
+
(B = i.onClick) == null || B.call(i, pe), v(!1);
|
|
182
|
+
} : void 0
|
|
183
|
+
},
|
|
184
|
+
i.id ?? ce
|
|
185
|
+
))
|
|
186
|
+
},
|
|
187
|
+
e.id ?? r
|
|
188
|
+
);
|
|
189
|
+
}) }) })
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
});
|
|
194
|
+
J.displayName = "CardStepper";
|
|
195
|
+
const xe = Object.assign(J, {
|
|
196
|
+
Step: z
|
|
197
|
+
});
|
|
198
|
+
export {
|
|
199
|
+
xe as CardStepper
|
|
200
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-card-stepper":"tedi-card-stepper-990b287a","tedi-card-stepper--progress-flush":"tedi-card-stepper--progress-flush-23f58416","tedi-card-stepper__main":"tedi-card-stepper__main-ab70da77","tedi-card-stepper__main--no-lead":"tedi-card-stepper__main--no-lead-f358c4e9","tedi-card-stepper__body":"tedi-card-stepper__body-0df6ee92","tedi-card-stepper__trail":"tedi-card-stepper__trail-010e8317","tedi-card-stepper__lead":"tedi-card-stepper__lead-da7d326b","tedi-card-stepper__nav-prev":"tedi-card-stepper__nav-prev-274e6ce5","tedi-card-stepper__nav-next":"tedi-card-stepper__nav-next-697bbe17","tedi-card-stepper__indicator":"tedi-card-stepper__indicator-11d120ee","tedi-card-stepper__title":"tedi-card-stepper__title-93be7e94","tedi-card-stepper__status-icon":"tedi-card-stepper__status-icon-97374a76","tedi-card-stepper__top":"tedi-card-stepper__top-e92ed5ba","tedi-card-stepper__description":"tedi-card-stepper__description-f836d668","tedi-card-stepper__description-bottom":"tedi-card-stepper__description-bottom-c12f5c13","tedi-card-stepper--reserve-description":"tedi-card-stepper--reserve-description-ba59f2f8","tedi-card-stepper__bottom-slot":"tedi-card-stepper__bottom-slot-289c98d6","tedi-card-stepper__counter":"tedi-card-stepper__counter-6790f2c1","tedi-card-stepper__progress":"tedi-card-stepper__progress-05cbf5f8","tedi-card-stepper__segment":"tedi-card-stepper__segment-8303dffb","tedi-card-stepper__segment--done":"tedi-card-stepper__segment--done-332dd1fd"};exports.default=e;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
"tedi-card-stepper": "tedi-card-stepper-990b287a",
|
|
3
|
+
"tedi-card-stepper--progress-flush": "tedi-card-stepper--progress-flush-23f58416",
|
|
4
|
+
"tedi-card-stepper__main": "tedi-card-stepper__main-ab70da77",
|
|
5
|
+
"tedi-card-stepper__main--no-lead": "tedi-card-stepper__main--no-lead-f358c4e9",
|
|
6
|
+
"tedi-card-stepper__body": "tedi-card-stepper__body-0df6ee92",
|
|
7
|
+
"tedi-card-stepper__trail": "tedi-card-stepper__trail-010e8317",
|
|
8
|
+
"tedi-card-stepper__lead": "tedi-card-stepper__lead-da7d326b",
|
|
9
|
+
"tedi-card-stepper__nav-prev": "tedi-card-stepper__nav-prev-274e6ce5",
|
|
10
|
+
"tedi-card-stepper__nav-next": "tedi-card-stepper__nav-next-697bbe17",
|
|
11
|
+
"tedi-card-stepper__indicator": "tedi-card-stepper__indicator-11d120ee",
|
|
12
|
+
"tedi-card-stepper__title": "tedi-card-stepper__title-93be7e94",
|
|
13
|
+
"tedi-card-stepper__status-icon": "tedi-card-stepper__status-icon-97374a76",
|
|
14
|
+
"tedi-card-stepper__top": "tedi-card-stepper__top-e92ed5ba",
|
|
15
|
+
"tedi-card-stepper__description": "tedi-card-stepper__description-f836d668",
|
|
16
|
+
"tedi-card-stepper__description-bottom": "tedi-card-stepper__description-bottom-c12f5c13",
|
|
17
|
+
"tedi-card-stepper--reserve-description": "tedi-card-stepper--reserve-description-ba59f2f8",
|
|
18
|
+
"tedi-card-stepper__bottom-slot": "tedi-card-stepper__bottom-slot-289c98d6",
|
|
19
|
+
"tedi-card-stepper__counter": "tedi-card-stepper__counter-6790f2c1",
|
|
20
|
+
"tedi-card-stepper__progress": "tedi-card-stepper__progress-05cbf5f8",
|
|
21
|
+
"tedi-card-stepper__segment": "tedi-card-stepper__segment-8303dffb",
|
|
22
|
+
"tedi-card-stepper__segment--done": "tedi-card-stepper__segment--done-332dd1fd"
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
e as default
|
|
26
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("../../../../../../../external/classnames/index.cjs.js"),s=require("react"),x=require("../../../../base/typography/text/text.cjs.js"),C=require("../../../../buttons/collapse-button/collapse-button.cjs.js"),E=require("../../../../overlays/sheet/sheet.cjs.js"),c=require("../../table-of-contents.cjs.js"),t=require("../../table-of-contents.module.scss.cjs.js"),S=require("../table-of-contents-list/table-of-contents-list.cjs.js"),y=require("../../../../../providers/label-provider/use-labels.cjs.js"),p=g=>{const{children:d,heading:u,ariaLabel:_,activeId:l,numbered:b=!1,sticky:j=!0,className:L}=g,{getLabel:f}=y.useLabels(),[n,a]=s.useState(!1),[o,O]=s.useState(null);s.useEffect(()=>{if(!n||!o)return;const v=q=>{q.target.closest("a, button")&&a(!1)};return o.addEventListener("click",v),()=>o.removeEventListener("click",v)},[n,o]);const i=(u===void 0?f("table-of-contents.title"):u)??f("table-of-contents.title"),h=_||i,r=s.useMemo(()=>c.childrenToNodes(d),[d]),m=s.useMemo(()=>c.buildActiveTrail(r,l),[r,l]),T=s.useMemo(()=>({activeId:l,numbered:b,ariaLabel:h,activeTrail:m}),[l,b,h,m]);return e.jsxs(c.TableOfContentsContext.Provider,{value:T,children:[e.jsxs("div",{className:N.default(t.default["tedi-table-of-contents__bar"],{[t.default["tedi-table-of-contents__bar--static"]]:!j},L),children:[e.jsx(x.Text,{modifiers:"bold",className:t.default["tedi-table-of-contents__bar-title"],children:i}),e.jsx(C.CollapseButton,{open:n,onOpenChange:a,underline:!1,"aria-haspopup":"dialog"})]}),e.jsx(E.Sheet,{open:n,onToggle:a,ariaLabel:i,className:t.default["tedi-table-of-contents__sheet"],header:e.jsxs("div",{className:t.default["tedi-table-of-contents__sheet-header"],children:[e.jsx(x.Text,{modifiers:"bold",className:t.default["tedi-table-of-contents__bar-title"],children:i}),e.jsx(C.CollapseButton,{open:n,onOpenChange:a,underline:!1})]}),children:e.jsx("div",{ref:O,className:t.default["tedi-table-of-contents"],children:e.jsx(S.TableOfContentsList,{nodes:r,heading:null})})})]})};p.displayName="TableOfContentsCollapsible";exports.TableOfContentsCollapsible=p;
|