@pablo-v/stepper 0.0.0-stage → 0.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pablo Viniegra
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,13 @@
1
- # Temporary Holding Version
1
+ # @pablo-v/stepper
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Multi-step progress indicator
4
+
5
+ ```bash
6
+ pnpm add @pablo-v/stepper @pablo-v/tokens
7
+ ```
8
+
9
+ ```tsx
10
+ import '@pablo-v/tokens/styles.css';
11
+ import '@pablo-v/stepper/style.css';
12
+ import { Stepper } from '@pablo-v/stepper';
13
+ ```
@@ -0,0 +1,24 @@
1
+ import { type Orientation } from '@pablo-v/core';
2
+ import type { ComponentPropsWithRef, ReactNode } from 'react';
3
+ export type StepStatus = 'complete' | 'current' | 'upcoming' | 'error';
4
+ export interface StepperStep {
5
+ label: ReactNode;
6
+ description?: ReactNode;
7
+ /** Overrides the status derived from `current`, e.g. `'error'`. */
8
+ status?: StepStatus;
9
+ disabled?: boolean;
10
+ }
11
+ export interface StepperProps extends Omit<ComponentPropsWithRef<'ol'>, 'onChange'> {
12
+ steps: StepperStep[];
13
+ /** Index of the active step. Steps before it are complete. */
14
+ current: number;
15
+ /** Makes complete steps buttons that jump back to them. */
16
+ onStepClick?: (index: number) => void;
17
+ /** @default 'horizontal' */
18
+ orientation?: Orientation;
19
+ /** Screen-reader text appended to each step by status. */
20
+ statusLabels?: Partial<Record<StepStatus, string>>;
21
+ }
22
+ /** Progress through a sequence of steps, with pixel-cell connectors between them. */
23
+ export declare function Stepper({ steps, current, onStepClick, orientation, statusLabels, className, ...rest }: StepperProps): import("react").JSX.Element;
24
+ //# sourceMappingURL=Stepper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stepper.d.ts","sourceRoot":"","sources":["../src/Stepper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9D,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;AAEvE,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,mEAAmE;IACnE,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IACjF,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,4BAA4B;IAC5B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,0DAA0D;IAC1D,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD;AASD,qFAAqF;AACrF,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,OAAO,EACP,WAAW,EACX,WAA0B,EAC1B,YAAY,EACZ,SAAS,EACT,GAAG,IAAI,EACR,EAAE,YAAY,+BAiEd"}
@@ -0,0 +1,21 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cx } from '@pablo-v/core';
3
+ import { CheckIcon, ErrorIcon } from '@pablo-v/pixel-icons';
4
+ const STATUS_LABELS = {
5
+ complete: 'completed',
6
+ current: 'current',
7
+ upcoming: 'not started',
8
+ error: 'has errors',
9
+ };
10
+ /** Progress through a sequence of steps, with pixel-cell connectors between them. */
11
+ export function Stepper({ steps, current, onStepClick, orientation = 'horizontal', statusLabels, className, ...rest }) {
12
+ const labels = { ...STATUS_LABELS, ...statusLabels };
13
+ return (_jsx("ol", { "data-orientation": orientation, className: cx('pxl-stepper', className), ...rest, children: steps.map((step, index) => {
14
+ const status = step.status ??
15
+ (index < current ? 'complete' : index === current ? 'current' : 'upcoming');
16
+ const interactive = onStepClick && status !== 'current' && index < current && !step.disabled;
17
+ const body = (_jsxs(_Fragment, { children: [_jsx("span", { className: "pxl-stepper__marker", "aria-hidden": "true", children: status === 'complete' ? (_jsx(CheckIcon, {})) : status === 'error' ? (_jsx(ErrorIcon, {})) : (index + 1) }), _jsxs("span", { className: "pxl-stepper__text", children: [_jsxs("span", { className: "pxl-stepper__label", children: [step.label, _jsxs("span", { className: "pxl-stepper__status", children: [", ", labels[status]] })] }), step.description != null && (_jsx("span", { className: "pxl-stepper__description", children: step.description }))] })] }));
18
+ return (_jsxs("li", { "data-status": status, "aria-current": status === 'current' ? 'step' : undefined, className: "pxl-stepper__step", children: [interactive ? (_jsx("button", { type: "button", className: "pxl-stepper__body", onClick: () => onStepClick(index), children: body })) : (_jsx("span", { className: "pxl-stepper__body", "data-disabled": step.disabled || undefined, children: body })), index < steps.length - 1 && (_jsx("span", { className: "pxl-stepper__connector", "data-lit": index < current || undefined, "aria-hidden": "true" }))] }, index));
19
+ }) }));
20
+ }
21
+ //# sourceMappingURL=Stepper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stepper.js","sourceRoot":"","sources":["../src/Stepper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAoB,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAyB5D,MAAM,aAAa,GAA+B;IAChD,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,aAAa;IACvB,KAAK,EAAE,YAAY;CACpB,CAAC;AAEF,qFAAqF;AACrF,MAAM,UAAU,OAAO,CAAC,EACtB,KAAK,EACL,OAAO,EACP,WAAW,EACX,WAAW,GAAG,YAAY,EAC1B,YAAY,EACZ,SAAS,EACT,GAAG,IAAI,EACM;IACb,MAAM,MAAM,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,YAAY,EAAE,CAAC;IACrD,OAAO,CACL,iCAAsB,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,KAAM,IAAI,YACjF,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACzB,MAAM,MAAM,GACV,IAAI,CAAC,MAAM;gBACX,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,CAA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AC,wBAAwB,cACxB,KAAK,GAAG,OAAO,IAAI,SAAS,iBAC1B,MAAM,GAClB,CACH,KAxBI,KAAK,CAyBP,CACN,CAAC;QACJ,CAAC,CAAC,GACC,CACN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Stepper, type StepperProps, type StepperStep, type StepStatus } from './Stepper.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { Stepper } from './Stepper.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAwD,MAAM,cAAc,CAAC"}
@@ -0,0 +1,217 @@
1
+ .pxl-stepper {
2
+ --_marker: var(--pxl-size-xs);
3
+
4
+ display: flex;
5
+ gap: var(--pxl-space-2);
6
+ margin: 0;
7
+ padding: 0;
8
+ color: var(--pxl-fg);
9
+ font-family: var(--pxl-font-sans);
10
+ font-size: var(--pxl-text-sm);
11
+ list-style: none;
12
+ }
13
+
14
+ .pxl-stepper[data-orientation="vertical"] {
15
+ flex-direction: column;
16
+ gap: 0;
17
+ }
18
+
19
+ .pxl-stepper__step {
20
+ position: relative;
21
+ display: flex;
22
+ flex: 1;
23
+ align-items: flex-start;
24
+ gap: var(--pxl-space-2);
25
+ min-width: 0;
26
+ }
27
+
28
+ .pxl-stepper__step:last-child {
29
+ flex: 0 0 auto;
30
+ }
31
+
32
+ .pxl-stepper[data-orientation="vertical"] .pxl-stepper__step {
33
+ flex-direction: column;
34
+ gap: 0;
35
+ }
36
+
37
+ .pxl-stepper__body {
38
+ display: flex;
39
+ align-items: flex-start;
40
+ gap: var(--pxl-space-2);
41
+ min-width: 0;
42
+ margin: 0;
43
+ padding: 0;
44
+ border: 0;
45
+ border-radius: var(--pxl-radius-md);
46
+ background: none;
47
+ color: inherit;
48
+ font: inherit;
49
+ text-align: left;
50
+ }
51
+
52
+ button.pxl-stepper__body {
53
+ cursor: pointer;
54
+ }
55
+
56
+ button.pxl-stepper__body:focus-visible {
57
+ outline: 2px solid var(--pxl-accent);
58
+ outline-offset: 2px;
59
+ }
60
+
61
+ .pxl-stepper__body[data-disabled] {
62
+ opacity: var(--pxl-opacity-disabled);
63
+ }
64
+
65
+ .pxl-stepper__marker {
66
+ display: grid;
67
+ flex: none;
68
+ place-items: center;
69
+ box-sizing: border-box;
70
+ width: var(--_marker);
71
+ height: var(--_marker);
72
+ border: 1px solid var(--pxl-gray-600);
73
+ border-radius: var(--pxl-radius-sm);
74
+ background: var(--pxl-bg);
75
+ color: var(--pxl-fg-muted);
76
+ font-family: var(--pxl-font-mono);
77
+ font-size: var(--pxl-text-xs);
78
+ font-variant-numeric: tabular-nums;
79
+ transition:
80
+ background-color var(--pxl-dur-fast) linear,
81
+ border-color var(--pxl-dur-fast) linear,
82
+ color var(--pxl-dur-fast) linear;
83
+ }
84
+
85
+ .pxl-stepper__step[data-status="current"] .pxl-stepper__marker {
86
+ border-color: var(--pxl-accent);
87
+ background: var(--pxl-accent-subtle);
88
+ color: var(--pxl-accent-text);
89
+ }
90
+
91
+ .pxl-stepper__step[data-status="complete"] .pxl-stepper__marker {
92
+ border-color: var(--pxl-fg);
93
+ background: var(--pxl-fg);
94
+ color: var(--pxl-bg);
95
+ }
96
+
97
+ .pxl-stepper__marker > .pxl-icon {
98
+ animation: pxl-pop-in var(--pxl-dur-base) var(--pxl-ease-out);
99
+ }
100
+
101
+ .pxl-stepper__step[data-status="error"] .pxl-stepper__marker {
102
+ border-color: var(--pxl-danger);
103
+ background: var(--pxl-danger-subtle);
104
+ color: var(--pxl-danger);
105
+ }
106
+
107
+ .pxl-stepper__text {
108
+ display: flex;
109
+ flex-direction: column;
110
+ gap: 2px;
111
+ min-width: 0;
112
+ padding-top: calc((var(--_marker) - 1.4em) / 2);
113
+ line-height: 1.4;
114
+ }
115
+
116
+ .pxl-stepper__label {
117
+ font-weight: 500;
118
+ }
119
+
120
+ .pxl-stepper__step[data-status="upcoming"] .pxl-stepper__label {
121
+ color: var(--pxl-fg-muted);
122
+ font-weight: 400;
123
+ }
124
+
125
+ button.pxl-stepper__body:hover .pxl-stepper__label {
126
+ text-decoration: underline;
127
+ text-underline-offset: 3px;
128
+ }
129
+
130
+ .pxl-stepper__description {
131
+ color: var(--pxl-fg-muted);
132
+ font-size: var(--pxl-text-xs);
133
+ }
134
+
135
+ .pxl-stepper__status {
136
+ position: absolute;
137
+ width: 1px;
138
+ height: 1px;
139
+ overflow: hidden;
140
+ clip-path: inset(50%);
141
+ white-space: nowrap;
142
+ }
143
+
144
+ /* The connector is a row of 4px cells; a lit copy wipes over it once the step before it is done. */
145
+ .pxl-stepper__connector {
146
+ --_cells: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 6px);
147
+ position: relative;
148
+ flex: 1;
149
+ min-width: var(--pxl-space-4);
150
+ height: 4px;
151
+ margin-top: calc((var(--_marker) - 4px) / 2);
152
+ color: var(--pxl-gray-300);
153
+ background: var(--_cells);
154
+ }
155
+
156
+ .pxl-stepper__connector::after {
157
+ position: absolute;
158
+ inset: 0;
159
+ color: var(--pxl-fg);
160
+ background: var(--_cells);
161
+ content: "";
162
+ transform: scaleX(0);
163
+ transform-origin: left;
164
+ transition: transform var(--pxl-dur-slow) var(--pxl-ease-out);
165
+ }
166
+
167
+ .pxl-stepper__connector[data-lit]::after {
168
+ transform: none;
169
+ }
170
+
171
+ .pxl-stepper[data-orientation="vertical"] .pxl-stepper__connector {
172
+ --_cells: repeating-linear-gradient(180deg, currentColor 0 4px, transparent 4px 6px);
173
+ flex: none;
174
+ width: 4px;
175
+ min-width: 0;
176
+ height: auto;
177
+ min-height: var(--pxl-space-6);
178
+ margin: var(--pxl-space-1) 0 var(--pxl-space-1) calc((var(--_marker) - 4px) / 2);
179
+ }
180
+
181
+ .pxl-stepper[data-orientation="vertical"] .pxl-stepper__connector::after {
182
+ transform: scaleY(0);
183
+ transform-origin: top;
184
+ }
185
+
186
+ .pxl-stepper[data-orientation="vertical"] .pxl-stepper__connector[data-lit]::after {
187
+ transform: none;
188
+ }
189
+
190
+ /* Narrow rows keep every marker and only the current step's text, which stays readable to screen readers. */
191
+ @media (width < 30rem) {
192
+ .pxl-stepper:not([data-orientation="vertical"])
193
+ .pxl-stepper__step:not([data-status="current"])
194
+ .pxl-stepper__text {
195
+ position: absolute;
196
+ width: 1px;
197
+ height: 1px;
198
+ overflow: hidden;
199
+ clip-path: inset(50%);
200
+ white-space: nowrap;
201
+ }
202
+
203
+ .pxl-stepper:not([data-orientation="vertical"]) .pxl-stepper__step:not(:last-child) {
204
+ flex: 1 0 auto;
205
+ }
206
+ }
207
+
208
+ @media (forced-colors: active) {
209
+ .pxl-stepper__connector,
210
+ .pxl-stepper__connector::after {
211
+ background: none;
212
+ }
213
+
214
+ .pxl-stepper__connector {
215
+ border-top: 2px dotted CanvasText;
216
+ }
217
+ }
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
2
  "name": "@pablo-v/stepper",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "Multi-step progress indicator",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/PabloViniegra/pixel-ui.git",
9
+ "directory": "packages/stepper"
10
+ },
11
+ "type": "module",
12
+ "sideEffects": [
13
+ "*.css"
14
+ ],
15
+ "exports": {
16
+ ".": {
17
+ "source": "./src/index.ts",
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ },
21
+ "./style.css": {
22
+ "source": "./src/stepper.css",
23
+ "default": "./dist/stepper.css"
24
+ },
25
+ "./package.json": "./package.json"
26
+ },
27
+ "files": [
28
+ "dist"
29
+ ],
30
+ "dependencies": {
31
+ "@pablo-v/core": "^0.2.1",
32
+ "@pablo-v/pixel-icons": "^1.3.0"
33
+ },
34
+ "peerDependencies": {
35
+ "react": "^19.0.0",
36
+ "@pablo-v/tokens": "^0.2.4"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "scripts": {
42
+ "build": "tsc -b && node ../../scripts/copy-assets.mjs",
43
+ "clean": "rm -rf dist *.tsbuildinfo"
44
+ }
6
45
  }