@brightlocal/ui-components 2.13.0 → 2.15.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/README.md +3 -2
- package/component-meta.json +151 -8
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +5 -1
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +48 -31
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +462 -447
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +21 -15
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts +259 -46
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +460 -185
- package/dist/stepper.cjs +1 -0
- package/dist/stepper.d.ts +176 -0
- package/dist/stepper.d.ts.map +1 -0
- package/dist/stepper.js +351 -0
- package/package.json +5 -4
- package/src/components/card.tsx +23 -0
- package/src/components/list.tsx +8 -2
- package/src/components/map.tsx +681 -134
- package/src/components/stepper.tsx +708 -0
- package/src/index.ts +1 -0
- package/src/types/assets.d.ts +9 -0
package/dist/stepper.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),F=require("react"),V=require("@radix-ui/react-slot"),_=require("class-variance-authority"),w=require("@brightlocal/icons"),d=require("@brightlocal/ui-components/lib/utils");function X(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const s=X(F),I=s.createContext(null);function k(){const e=s.useContext(I);if(!e)throw new Error("Stepper components must be used within <Stepper>");return e}const C=s.createContext(null);function z(){const e=s.useContext(C);if(!e)throw new Error("StepperItem sub-components must be used within <StepperItem>");return e}const R=s.forwardRef(({className:e,dataHook:a,steps:t,value:o,defaultValue:l,onValueChange:u,orientation:i="horizontal",labelPlacement:m="below",ariaLabel:g,trackingEl:p,trackingLabel:c,...n},f)=>{const y=i==="vertical"?"vertical":m==="inline"?"horizontal-inline":"horizontal-below",x=o!==void 0,[b,v]=s.useState(l??t[0]?.id??""),S=x?o:b,N=t.findIndex(h=>h.id===S),j=s.useCallback(h=>{x||v(h),u?.(h)},[x,u]),A=s.useMemo(()=>({activeId:S,activeIndex:N,setActiveStep:j,steps:t,orientation:i}),[S,N,j,t,i]);return r.jsx(I.Provider,{value:A,children:r.jsx("div",{ref:f,"aria-label":g??"Progress",className:d.cn("group/stepper flex data-[orientation=vertical]:flex-col",e),"data-hook":a,"data-layout":y,"data-orientation":i,"data-slot":"stepper","data-tracking-el":p,"data-tracking-label":c,role:"group",...n})})});R.displayName="Stepper";const T=s.forwardRef(({className:e,dataHook:a,...t},o)=>r.jsx("ol",{ref:o,className:d.cn("flex w-full","group-data-[orientation=horizontal]/stepper:flex-row group-data-[orientation=horizontal]/stepper:items-start","group-data-[orientation=vertical]/stepper:flex-col",e),"data-hook":a,"data-slot":"stepper-nav",...t}));T.displayName="StepperNav";const D=s.forwardRef(({className:e,stepId:a,completed:t=!1,error:o=!1,disabled:l=!1,loading:u=!1,dataHook:i,...m},g)=>{const{activeIndex:p,steps:c}=k(),n=c.findIndex(v=>v.id===a);if(n===-1)throw new Error(`StepperItem stepId "${a}" was not found in the Stepper "steps" prop. Each StepperItem's stepId must match a step id.`);const f=n===c.length-1,y=u&&!o&&n===p,x=o?"error":t||n<p?"completed":n===p?"active":"inactive",b=s.useMemo(()=>({stepId:a,index:n,state:x,isLast:f,isDisabled:l,isLoading:y}),[a,n,x,f,l,y]);return r.jsx(C.Provider,{value:b,children:r.jsx("li",{ref:g,className:d.cn("group/step","group-data-[layout=horizontal-below]/stepper:relative group-data-[layout=horizontal-below]/stepper:flex group-data-[layout=horizontal-below]/stepper:flex-1 group-data-[layout=horizontal-below]/stepper:flex-col group-data-[layout=horizontal-below]/stepper:items-center","group-data-[layout=horizontal-inline]/stepper:flex group-data-[layout=horizontal-inline]/stepper:flex-row group-data-[layout=horizontal-inline]/stepper:items-center",!f&&"group-data-[layout=horizontal-inline]/stepper:flex-1","group-data-[layout=vertical]/stepper:flex group-data-[layout=vertical]/stepper:flex-col group-data-[layout=vertical]/stepper:items-start",e),"data-disabled":l?"true":void 0,"data-hook":i,"data-loading":y?"true":void 0,"data-slot":"stepper-item","data-state":x,...m})})});D.displayName="StepperItem";const L=s.forwardRef(({asChild:e=!1,className:a,dataHook:t,...o},l)=>{const{setActiveStep:u}=k(),{stepId:i,state:m,isDisabled:g}=z(),p=e?V.Slot:"button";return r.jsx(p,{ref:l,"aria-current":m==="active"?"step":void 0,className:d.cn("group/trigger inline-flex outline-none","group-data-[layout=horizontal-below]/stepper:flex-col group-data-[layout=horizontal-below]/stepper:items-center group-data-[layout=horizontal-below]/stepper:gap-2","group-data-[layout=horizontal-inline]/stepper:flex-row group-data-[layout=horizontal-inline]/stepper:items-center group-data-[layout=horizontal-inline]/stepper:gap-3","group-data-[layout=vertical]/stepper:flex-row group-data-[layout=vertical]/stepper:items-center group-data-[layout=vertical]/stepper:gap-3","disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",!e&&!g&&"cursor-pointer",a),"data-hook":t,"data-slot":"stepper-trigger",...o,...e?{}:{type:"button",disabled:g||o.disabled,onClick:c=>{o.onClick?.(c),c.defaultPrevented||u(i)}}})});L.displayName="StepperTrigger";const $=_.cva(["relative flex size-8 shrink-0 items-center justify-center rounded-full text-xs font-medium","transition-colors duration-200 ease-out","after:pointer-events-none after:absolute after:inset-0 after:rounded-full after:bg-white/10 after:opacity-0 after:transition-opacity after:duration-200 after:ease-out","group-hover/trigger:after:opacity-100","group-focus-visible/trigger:shadow-default","group-data-[disabled=true]/step:opacity-50"],{variants:{state:{active:"bg-primary text-primary-foreground",completed:"bg-primary text-primary-foreground",inactive:"bg-secondary text-secondary-foreground",error:"bg-destructive text-destructive-foreground"}},defaultVariants:{state:"inactive"}}),P=s.forwardRef(({asChild:e=!1,className:a,children:t,completedLabel:o="Completed",errorLabel:l="Error",loadingLabel:u="Loading",dataHook:i,...m},g)=>{const{state:p,index:c,isLoading:n}=z(),f=r.jsxs(r.Fragment,{children:[p==="completed"&&r.jsx("span",{className:"sr-only",children:o}),p==="error"&&r.jsx("span",{className:"sr-only",children:l}),n&&r.jsx("span",{className:"sr-only",children:u})]});return r.jsx("span",{ref:g,className:d.cn($({state:p}),a),"data-hook":i,"data-slot":"stepper-indicator","data-state":p,...m,children:e?r.jsxs(r.Fragment,{children:[t,f]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:d.cn("transition-opacity duration-200 ease-out",(p==="completed"||p==="error"||n)&&"opacity-0"),children:t??c+1}),p==="completed"&&!n&&r.jsx(w.Check,{className:"absolute",size:16}),p==="error"&&!n&&r.jsx(w.X,{className:"absolute",size:16}),n&&r.jsx(w.LoaderCircle,{className:"absolute animate-spin",size:16}),f]})})});P.displayName="StepperIndicator";const q=s.forwardRef(({className:e,dataHook:a,...t},o)=>{const{isLast:l}=z();return l?null:r.jsx("div",{ref:o,"aria-hidden":"true",className:d.cn("bg-border shrink-0 rounded-full transition-colors duration-200","group-data-[state=completed]/step:bg-primary","group-data-[disabled=true]/step:opacity-50","group-data-[layout=horizontal-below]/stepper:absolute group-data-[layout=horizontal-below]/stepper:top-[15px] group-data-[layout=horizontal-below]/stepper:right-[calc(-50%+1.5rem)] group-data-[layout=horizontal-below]/stepper:left-[calc(50%+1.5rem)] group-data-[layout=horizontal-below]/stepper:h-0.5","group-data-[layout=horizontal-inline]/stepper:mx-2 group-data-[layout=horizontal-inline]/stepper:h-0.5 group-data-[layout=horizontal-inline]/stepper:flex-1","group-data-[layout=vertical]/stepper:my-1 group-data-[layout=vertical]/stepper:ms-[15px] group-data-[layout=vertical]/stepper:h-8 group-data-[layout=vertical]/stepper:w-0.5",e),"data-hook":a,"data-slot":"stepper-separator",role:"presentation",...t})});q.displayName="StepperSeparator";const O=s.forwardRef(({className:e,...a},t)=>r.jsx("span",{ref:t,className:d.cn("flex flex-col gap-0.5","group-data-[layout=horizontal-below]/stepper:items-center group-data-[layout=horizontal-below]/stepper:text-center","group-data-[layout=horizontal-inline]/stepper:items-start group-data-[layout=horizontal-inline]/stepper:text-left","group-data-[layout=vertical]/stepper:items-start group-data-[layout=vertical]/stepper:text-left",e),"data-slot":"stepper-content",...a}));O.displayName="StepperContent";const E=s.forwardRef(({className:e,...a},t)=>r.jsx("span",{ref:t,className:d.cn("text-foreground text-sm font-semibold","group-data-[state=inactive]/step:text-muted-foreground","group-data-[disabled=true]/step:text-muted-foreground",e),"data-slot":"stepper-title",...a}));E.displayName="StepperTitle";const M=s.forwardRef(({className:e,...a},t)=>r.jsx("span",{ref:t,className:d.cn("text-muted-foreground text-xs font-normal",e),"data-slot":"stepper-description",...a}));M.displayName="StepperDescription";exports.Stepper=R;exports.StepperContent=O;exports.StepperDescription=M;exports.StepperIndicator=P;exports.StepperItem=D;exports.StepperNav=T;exports.StepperSeparator=q;exports.StepperTitle=E;exports.StepperTrigger=L;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Orientation of the stepper layout.
|
|
4
|
+
*/
|
|
5
|
+
type StepperOrientation = "horizontal" | "vertical";
|
|
6
|
+
/**
|
|
7
|
+
* Placement of step labels relative to the indicator in horizontal orientation.
|
|
8
|
+
* `"below"` centers the label under the indicator; `"inline"` places it to the
|
|
9
|
+
* right (best with title-only steps). Ignored when orientation is vertical.
|
|
10
|
+
*/
|
|
11
|
+
type StepperLabelPlacement = "below" | "inline";
|
|
12
|
+
/**
|
|
13
|
+
* Visual/interaction state of a single step, derived from the active step
|
|
14
|
+
* (and any explicit `completed` / `error` overrides on the item).
|
|
15
|
+
*/
|
|
16
|
+
type StepperItemState = "active" | "completed" | "inactive" | "error";
|
|
17
|
+
/**
|
|
18
|
+
* A single step descriptor. Consumers may attach any extra fields they need
|
|
19
|
+
* (e.g. `title`, `href`); only `id` is required for ordering and state.
|
|
20
|
+
*/
|
|
21
|
+
interface StepperStep {
|
|
22
|
+
/** Stable, unique identifier for the step. */
|
|
23
|
+
id: string;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Props for the Stepper root component.
|
|
28
|
+
*/
|
|
29
|
+
interface StepperProps extends Omit<React.ComponentPropsWithoutRef<"div">, "onChange"> {
|
|
30
|
+
/** Data hook for automated testing (required). */
|
|
31
|
+
dataHook: string;
|
|
32
|
+
/** Ordered list of steps. Defines step order, total count and id → index resolution. */
|
|
33
|
+
steps: StepperStep[];
|
|
34
|
+
/** Controlled active step id. */
|
|
35
|
+
value?: string;
|
|
36
|
+
/** Active step id for uncontrolled usage. Defaults to the first step. */
|
|
37
|
+
defaultValue?: string;
|
|
38
|
+
/** Called with the new active step id when the active step changes. */
|
|
39
|
+
onValueChange?: (id: string) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Layout orientation.
|
|
42
|
+
* @default "horizontal"
|
|
43
|
+
*/
|
|
44
|
+
orientation?: StepperOrientation;
|
|
45
|
+
/**
|
|
46
|
+
* Where labels sit relative to the indicator in horizontal orientation.
|
|
47
|
+
* @default "below"
|
|
48
|
+
*/
|
|
49
|
+
labelPlacement?: StepperLabelPlacement;
|
|
50
|
+
/**
|
|
51
|
+
* Accessible label for the stepper region.
|
|
52
|
+
* @default "Progress"
|
|
53
|
+
*/
|
|
54
|
+
ariaLabel?: string;
|
|
55
|
+
/** Tracking element identifier for analytics. */
|
|
56
|
+
trackingEl?: string;
|
|
57
|
+
/** Tracking label for analytics context. */
|
|
58
|
+
trackingLabel?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Guides users through a multi-step process, showing progress and the current step.
|
|
62
|
+
* Tracks the active step (controlled or uncontrolled) and shares it with its
|
|
63
|
+
* sub-components via context.
|
|
64
|
+
*/
|
|
65
|
+
declare const Stepper: React.ForwardRefExoticComponent<StepperProps & React.RefAttributes<HTMLDivElement>>;
|
|
66
|
+
/**
|
|
67
|
+
* Props for the StepperNav component.
|
|
68
|
+
*/
|
|
69
|
+
interface StepperNavProps extends React.ComponentPropsWithoutRef<"ol"> {
|
|
70
|
+
/** Data hook for automated testing. */
|
|
71
|
+
dataHook?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Ordered list container that lays out the step indicators and separators.
|
|
75
|
+
*/
|
|
76
|
+
declare const StepperNav: React.ForwardRefExoticComponent<StepperNavProps & React.RefAttributes<HTMLOListElement>>;
|
|
77
|
+
/**
|
|
78
|
+
* Props for the StepperItem component.
|
|
79
|
+
*/
|
|
80
|
+
interface StepperItemProps extends React.ComponentPropsWithoutRef<"li"> {
|
|
81
|
+
/** Id of the step this item represents (must match an `id` in `steps`). */
|
|
82
|
+
stepId: string;
|
|
83
|
+
/** Force the completed state regardless of the active step. */
|
|
84
|
+
completed?: boolean;
|
|
85
|
+
/** Mark the step as errored (shows the error indicator). */
|
|
86
|
+
error?: boolean;
|
|
87
|
+
/** Disable interaction with the step. */
|
|
88
|
+
disabled?: boolean;
|
|
89
|
+
/** Show a loading spinner in the indicator while this step is active. */
|
|
90
|
+
loading?: boolean;
|
|
91
|
+
/** Data hook for automated testing. */
|
|
92
|
+
dataHook?: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A single step. Derives its state from the active step and exposes it to its
|
|
96
|
+
* sub-components (indicator, trigger, separator) via context and `data-state`.
|
|
97
|
+
*/
|
|
98
|
+
declare const StepperItem: React.ForwardRefExoticComponent<StepperItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
99
|
+
/**
|
|
100
|
+
* Props for the StepperTrigger component.
|
|
101
|
+
*/
|
|
102
|
+
interface StepperTriggerProps extends React.ComponentPropsWithoutRef<"button"> {
|
|
103
|
+
/**
|
|
104
|
+
* Render as the child element instead of a button (Radix Slot pattern).
|
|
105
|
+
* Note: the disabled state is not applied automatically when `asChild` is
|
|
106
|
+
* true — the consumer must handle disabled styling/behavior on the child.
|
|
107
|
+
*/
|
|
108
|
+
asChild?: boolean;
|
|
109
|
+
/** Data hook for automated testing. */
|
|
110
|
+
dataHook?: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Clickable wrapper around a step's indicator and labels. Activates its step
|
|
114
|
+
* on click and exposes hover/focus affordances. Render as a non-interactive
|
|
115
|
+
* element with `asChild` when steps should not be navigable.
|
|
116
|
+
*/
|
|
117
|
+
declare const StepperTrigger: React.ForwardRefExoticComponent<StepperTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
118
|
+
/**
|
|
119
|
+
* Props for the StepperIndicator component.
|
|
120
|
+
*/
|
|
121
|
+
interface StepperIndicatorProps extends React.ComponentPropsWithoutRef<"span"> {
|
|
122
|
+
/** Render arbitrary content instead of the built-in number/icon swap. */
|
|
123
|
+
asChild?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Screen-reader label appended when the step is completed.
|
|
126
|
+
* @default "Completed"
|
|
127
|
+
*/
|
|
128
|
+
completedLabel?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Screen-reader label appended when the step has an error.
|
|
131
|
+
* @default "Error"
|
|
132
|
+
*/
|
|
133
|
+
errorLabel?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Screen-reader label appended while the step is loading.
|
|
136
|
+
* @default "Loading"
|
|
137
|
+
*/
|
|
138
|
+
loadingLabel?: string;
|
|
139
|
+
/** Data hook for automated testing. */
|
|
140
|
+
dataHook?: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The circular step indicator. Shows the step number by default, swapping to a
|
|
144
|
+
* check icon when completed, a cross when errored, and a spinner while loading.
|
|
145
|
+
* Pass `children` to override the number (e.g. a custom index or icon).
|
|
146
|
+
*/
|
|
147
|
+
declare const StepperIndicator: React.ForwardRefExoticComponent<StepperIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
148
|
+
/**
|
|
149
|
+
* Props for the StepperSeparator component.
|
|
150
|
+
*/
|
|
151
|
+
interface StepperSeparatorProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
152
|
+
/** Data hook for automated testing. */
|
|
153
|
+
dataHook?: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Connector line between two steps. Renders nothing after the final step and
|
|
157
|
+
* fills with the primary color once its step is completed.
|
|
158
|
+
*/
|
|
159
|
+
declare const StepperSeparator: React.ForwardRefExoticComponent<StepperSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
160
|
+
/**
|
|
161
|
+
* Wraps a step's title and description with the correct alignment for the
|
|
162
|
+
* current orientation (centered below the indicator when horizontal, start-
|
|
163
|
+
* aligned beside it when vertical). Use inside a `StepperTrigger`.
|
|
164
|
+
*/
|
|
165
|
+
declare const StepperContent: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
166
|
+
/**
|
|
167
|
+
* Title label for a step. Adapts color to the step state.
|
|
168
|
+
*/
|
|
169
|
+
declare const StepperTitle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
170
|
+
/**
|
|
171
|
+
* Secondary description text for a step.
|
|
172
|
+
*/
|
|
173
|
+
declare const StepperDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
174
|
+
export { Stepper, StepperNav, StepperItem, StepperTrigger, StepperIndicator, StepperSeparator, StepperContent, StepperTitle, StepperDescription, };
|
|
175
|
+
export type { StepperProps, StepperNavProps, StepperItemProps, StepperTriggerProps, StepperIndicatorProps, StepperSeparatorProps, StepperStep, StepperItemState, StepperOrientation, StepperLabelPlacement, };
|
|
176
|
+
//# sourceMappingURL=stepper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepper.d.ts","sourceRoot":"","sources":["../../src/components/stepper.tsx"],"names":[],"mappings":"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"}
|
package/dist/stepper.js
ADDED
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { jsx as r, jsxs as z, Fragment as S } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "react";
|
|
3
|
+
import { Slot as D } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva as P } from "class-variance-authority";
|
|
5
|
+
import { Check as T, X as j, LoaderCircle as A } from "@brightlocal/icons";
|
|
6
|
+
import { cn as d } from "@brightlocal/ui-components/lib/utils";
|
|
7
|
+
const C = o.createContext(null);
|
|
8
|
+
function R() {
|
|
9
|
+
const t = o.useContext(C);
|
|
10
|
+
if (!t)
|
|
11
|
+
throw new Error("Stepper components must be used within <Stepper>");
|
|
12
|
+
return t;
|
|
13
|
+
}
|
|
14
|
+
const L = o.createContext(
|
|
15
|
+
null
|
|
16
|
+
);
|
|
17
|
+
function N() {
|
|
18
|
+
const t = o.useContext(L);
|
|
19
|
+
if (!t)
|
|
20
|
+
throw new Error(
|
|
21
|
+
"StepperItem sub-components must be used within <StepperItem>"
|
|
22
|
+
);
|
|
23
|
+
return t;
|
|
24
|
+
}
|
|
25
|
+
const M = o.forwardRef(
|
|
26
|
+
({
|
|
27
|
+
className: t,
|
|
28
|
+
dataHook: a,
|
|
29
|
+
steps: e,
|
|
30
|
+
value: p,
|
|
31
|
+
defaultValue: i,
|
|
32
|
+
onValueChange: c,
|
|
33
|
+
orientation: n = "horizontal",
|
|
34
|
+
labelPlacement: g = "below",
|
|
35
|
+
ariaLabel: f,
|
|
36
|
+
trackingEl: l,
|
|
37
|
+
trackingLabel: u,
|
|
38
|
+
...s
|
|
39
|
+
}, m) => {
|
|
40
|
+
const h = n === "vertical" ? "vertical" : g === "inline" ? "horizontal-inline" : "horizontal-below", y = p !== void 0, [b, v] = o.useState(
|
|
41
|
+
i ?? e[0]?.id ?? ""
|
|
42
|
+
), w = y ? p : b, I = e.findIndex((x) => x.id === w), k = o.useCallback(
|
|
43
|
+
(x) => {
|
|
44
|
+
y || v(x), c?.(x);
|
|
45
|
+
},
|
|
46
|
+
[y, c]
|
|
47
|
+
), E = o.useMemo(
|
|
48
|
+
() => ({
|
|
49
|
+
activeId: w,
|
|
50
|
+
activeIndex: I,
|
|
51
|
+
setActiveStep: k,
|
|
52
|
+
steps: e,
|
|
53
|
+
orientation: n
|
|
54
|
+
}),
|
|
55
|
+
[w, I, k, e, n]
|
|
56
|
+
);
|
|
57
|
+
return /* @__PURE__ */ r(C.Provider, { value: E, children: /* @__PURE__ */ r(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
ref: m,
|
|
61
|
+
"aria-label": f ?? "Progress",
|
|
62
|
+
className: d(
|
|
63
|
+
"group/stepper flex data-[orientation=vertical]:flex-col",
|
|
64
|
+
t
|
|
65
|
+
),
|
|
66
|
+
"data-hook": a,
|
|
67
|
+
"data-layout": h,
|
|
68
|
+
"data-orientation": n,
|
|
69
|
+
"data-slot": "stepper",
|
|
70
|
+
"data-tracking-el": l,
|
|
71
|
+
"data-tracking-label": u,
|
|
72
|
+
role: "group",
|
|
73
|
+
...s
|
|
74
|
+
}
|
|
75
|
+
) });
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
M.displayName = "Stepper";
|
|
79
|
+
const V = o.forwardRef(
|
|
80
|
+
({ className: t, dataHook: a, ...e }, p) => /* @__PURE__ */ r(
|
|
81
|
+
"ol",
|
|
82
|
+
{
|
|
83
|
+
ref: p,
|
|
84
|
+
className: d(
|
|
85
|
+
"flex w-full",
|
|
86
|
+
// Top-align items so indicators (and the separators between them) stay
|
|
87
|
+
// on one line even when a step's description wraps to multiple lines.
|
|
88
|
+
"group-data-[orientation=horizontal]/stepper:flex-row group-data-[orientation=horizontal]/stepper:items-start",
|
|
89
|
+
"group-data-[orientation=vertical]/stepper:flex-col",
|
|
90
|
+
t
|
|
91
|
+
),
|
|
92
|
+
"data-hook": a,
|
|
93
|
+
"data-slot": "stepper-nav",
|
|
94
|
+
...e
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
);
|
|
98
|
+
V.displayName = "StepperNav";
|
|
99
|
+
const F = o.forwardRef(
|
|
100
|
+
({
|
|
101
|
+
className: t,
|
|
102
|
+
stepId: a,
|
|
103
|
+
completed: e = !1,
|
|
104
|
+
error: p = !1,
|
|
105
|
+
disabled: i = !1,
|
|
106
|
+
loading: c = !1,
|
|
107
|
+
dataHook: n,
|
|
108
|
+
...g
|
|
109
|
+
}, f) => {
|
|
110
|
+
const { activeIndex: l, steps: u } = R(), s = u.findIndex((v) => v.id === a);
|
|
111
|
+
if (s === -1)
|
|
112
|
+
throw new Error(
|
|
113
|
+
`StepperItem stepId "${a}" was not found in the Stepper "steps" prop. Each StepperItem's stepId must match a step id.`
|
|
114
|
+
);
|
|
115
|
+
const m = s === u.length - 1, h = c && !p && s === l, y = p ? "error" : e || s < l ? "completed" : s === l ? "active" : "inactive", b = o.useMemo(
|
|
116
|
+
() => ({
|
|
117
|
+
stepId: a,
|
|
118
|
+
index: s,
|
|
119
|
+
state: y,
|
|
120
|
+
isLast: m,
|
|
121
|
+
isDisabled: i,
|
|
122
|
+
isLoading: h
|
|
123
|
+
}),
|
|
124
|
+
[a, s, y, m, i, h]
|
|
125
|
+
);
|
|
126
|
+
return /* @__PURE__ */ r(L.Provider, { value: b, children: /* @__PURE__ */ r(
|
|
127
|
+
"li",
|
|
128
|
+
{
|
|
129
|
+
ref: f,
|
|
130
|
+
className: d(
|
|
131
|
+
"group/step",
|
|
132
|
+
// Horizontal + labels below: equal-width centered columns. The
|
|
133
|
+
// separator is absolutely positioned between indicator centers (see
|
|
134
|
+
// StepperSeparator), so labels sit below the indicator without
|
|
135
|
+
// squeezing the connector or pushing indicators out of line.
|
|
136
|
+
"group-data-[layout=horizontal-below]/stepper:relative group-data-[layout=horizontal-below]/stepper:flex group-data-[layout=horizontal-below]/stepper:flex-1 group-data-[layout=horizontal-below]/stepper:flex-col group-data-[layout=horizontal-below]/stepper:items-center",
|
|
137
|
+
// Horizontal + inline labels: a row of indicator + label with an
|
|
138
|
+
// in-flow connector filling the gap to the next step.
|
|
139
|
+
"group-data-[layout=horizontal-inline]/stepper:flex group-data-[layout=horizontal-inline]/stepper:flex-row group-data-[layout=horizontal-inline]/stepper:items-center",
|
|
140
|
+
!m && "group-data-[layout=horizontal-inline]/stepper:flex-1",
|
|
141
|
+
// Vertical: indicator + labels in a row, separator below.
|
|
142
|
+
"group-data-[layout=vertical]/stepper:flex group-data-[layout=vertical]/stepper:flex-col group-data-[layout=vertical]/stepper:items-start",
|
|
143
|
+
t
|
|
144
|
+
),
|
|
145
|
+
"data-disabled": i ? "true" : void 0,
|
|
146
|
+
"data-hook": n,
|
|
147
|
+
"data-loading": h ? "true" : void 0,
|
|
148
|
+
"data-slot": "stepper-item",
|
|
149
|
+
"data-state": y,
|
|
150
|
+
...g
|
|
151
|
+
}
|
|
152
|
+
) });
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
F.displayName = "StepperItem";
|
|
156
|
+
const X = o.forwardRef(
|
|
157
|
+
({ asChild: t = !1, className: a, dataHook: e, ...p }, i) => {
|
|
158
|
+
const { setActiveStep: c } = R(), { stepId: n, state: g, isDisabled: f } = N();
|
|
159
|
+
return /* @__PURE__ */ r(
|
|
160
|
+
t ? D : "button",
|
|
161
|
+
{
|
|
162
|
+
ref: i,
|
|
163
|
+
"aria-current": g === "active" ? "step" : void 0,
|
|
164
|
+
className: d(
|
|
165
|
+
// Focus is shown as a ring on the indicator (see StepperIndicator),
|
|
166
|
+
// not on the whole trigger, so it stays a circle around the badge.
|
|
167
|
+
"group/trigger inline-flex outline-none",
|
|
168
|
+
// Layout adapts automatically — no consumer classes needed. Labels
|
|
169
|
+
// stack below the indicator (horizontal/below) or sit beside it
|
|
170
|
+
// (horizontal/inline and vertical).
|
|
171
|
+
"group-data-[layout=horizontal-below]/stepper:flex-col group-data-[layout=horizontal-below]/stepper:items-center group-data-[layout=horizontal-below]/stepper:gap-2",
|
|
172
|
+
"group-data-[layout=horizontal-inline]/stepper:flex-row group-data-[layout=horizontal-inline]/stepper:items-center group-data-[layout=horizontal-inline]/stepper:gap-3",
|
|
173
|
+
"group-data-[layout=vertical]/stepper:flex-row group-data-[layout=vertical]/stepper:items-center group-data-[layout=vertical]/stepper:gap-3",
|
|
174
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
175
|
+
!t && !f && "cursor-pointer",
|
|
176
|
+
a
|
|
177
|
+
),
|
|
178
|
+
"data-hook": e,
|
|
179
|
+
"data-slot": "stepper-trigger",
|
|
180
|
+
...p,
|
|
181
|
+
...t ? {} : {
|
|
182
|
+
type: "button",
|
|
183
|
+
disabled: f || p.disabled,
|
|
184
|
+
onClick: (u) => {
|
|
185
|
+
p.onClick?.(u), u.defaultPrevented || c(n);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
X.displayName = "StepperTrigger";
|
|
193
|
+
const $ = P(
|
|
194
|
+
[
|
|
195
|
+
"relative flex size-8 shrink-0 items-center justify-center rounded-full text-xs font-medium",
|
|
196
|
+
"transition-colors duration-200 ease-out",
|
|
197
|
+
// Hover overlay (only visible when wrapped by an interactive trigger).
|
|
198
|
+
"after:pointer-events-none after:absolute after:inset-0 after:rounded-full after:bg-white/10 after:opacity-0 after:transition-opacity after:duration-200 after:ease-out",
|
|
199
|
+
"group-hover/trigger:after:opacity-100",
|
|
200
|
+
// Focus ring is rendered here (around the circle) when the trigger is
|
|
201
|
+
// keyboard-focused, rather than around the whole trigger.
|
|
202
|
+
"group-focus-visible/trigger:shadow-default",
|
|
203
|
+
// Dim when the step is disabled.
|
|
204
|
+
"group-data-[disabled=true]/step:opacity-50"
|
|
205
|
+
],
|
|
206
|
+
{
|
|
207
|
+
variants: {
|
|
208
|
+
state: {
|
|
209
|
+
active: "bg-primary text-primary-foreground",
|
|
210
|
+
completed: "bg-primary text-primary-foreground",
|
|
211
|
+
// secondary-foreground (not muted-foreground) for AA contrast on the
|
|
212
|
+
// secondary background.
|
|
213
|
+
inactive: "bg-secondary text-secondary-foreground",
|
|
214
|
+
error: "bg-destructive text-destructive-foreground"
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
defaultVariants: {
|
|
218
|
+
state: "inactive"
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
), q = o.forwardRef(
|
|
222
|
+
({
|
|
223
|
+
asChild: t = !1,
|
|
224
|
+
className: a,
|
|
225
|
+
children: e,
|
|
226
|
+
completedLabel: p = "Completed",
|
|
227
|
+
errorLabel: i = "Error",
|
|
228
|
+
loadingLabel: c = "Loading",
|
|
229
|
+
dataHook: n,
|
|
230
|
+
...g
|
|
231
|
+
}, f) => {
|
|
232
|
+
const { state: l, index: u, isLoading: s } = N(), m = /* @__PURE__ */ z(S, { children: [
|
|
233
|
+
l === "completed" && /* @__PURE__ */ r("span", { className: "sr-only", children: p }),
|
|
234
|
+
l === "error" && /* @__PURE__ */ r("span", { className: "sr-only", children: i }),
|
|
235
|
+
s && /* @__PURE__ */ r("span", { className: "sr-only", children: c })
|
|
236
|
+
] });
|
|
237
|
+
return /* @__PURE__ */ r(
|
|
238
|
+
"span",
|
|
239
|
+
{
|
|
240
|
+
ref: f,
|
|
241
|
+
className: d($({ state: l }), a),
|
|
242
|
+
"data-hook": n,
|
|
243
|
+
"data-slot": "stepper-indicator",
|
|
244
|
+
"data-state": l,
|
|
245
|
+
...g,
|
|
246
|
+
children: t ? /* @__PURE__ */ z(S, { children: [
|
|
247
|
+
e,
|
|
248
|
+
m
|
|
249
|
+
] }) : /* @__PURE__ */ z(S, { children: [
|
|
250
|
+
/* @__PURE__ */ r(
|
|
251
|
+
"span",
|
|
252
|
+
{
|
|
253
|
+
className: d(
|
|
254
|
+
"transition-opacity duration-200 ease-out",
|
|
255
|
+
(l === "completed" || l === "error" || s) && "opacity-0"
|
|
256
|
+
),
|
|
257
|
+
children: e ?? u + 1
|
|
258
|
+
}
|
|
259
|
+
),
|
|
260
|
+
l === "completed" && !s && /* @__PURE__ */ r(T, { className: "absolute", size: 16 }),
|
|
261
|
+
l === "error" && !s && /* @__PURE__ */ r(j, { className: "absolute", size: 16 }),
|
|
262
|
+
s && /* @__PURE__ */ r(A, { className: "absolute animate-spin", size: 16 }),
|
|
263
|
+
m
|
|
264
|
+
] })
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
q.displayName = "StepperIndicator";
|
|
270
|
+
const B = o.forwardRef(({ className: t, dataHook: a, ...e }, p) => {
|
|
271
|
+
const { isLast: i } = N();
|
|
272
|
+
return i ? null : /* @__PURE__ */ r(
|
|
273
|
+
"div",
|
|
274
|
+
{
|
|
275
|
+
ref: p,
|
|
276
|
+
"aria-hidden": "true",
|
|
277
|
+
className: d(
|
|
278
|
+
"bg-border shrink-0 rounded-full transition-colors duration-200",
|
|
279
|
+
"group-data-[state=completed]/step:bg-primary",
|
|
280
|
+
"group-data-[disabled=true]/step:opacity-50",
|
|
281
|
+
// Horizontal + labels below: absolute connector spanning this indicator
|
|
282
|
+
// center to the next, at the indicator's vertical center (top 15px =
|
|
283
|
+
// half the 32px indicator minus half the 2px line). 1.5rem gaps the ends.
|
|
284
|
+
"group-data-[layout=horizontal-below]/stepper:absolute group-data-[layout=horizontal-below]/stepper:top-[15px] group-data-[layout=horizontal-below]/stepper:right-[calc(-50%+1.5rem)] group-data-[layout=horizontal-below]/stepper:left-[calc(50%+1.5rem)] group-data-[layout=horizontal-below]/stepper:h-0.5",
|
|
285
|
+
// Horizontal + inline labels: in-flow connector filling the gap to the
|
|
286
|
+
// next step (vertically centered with the indicator by the item row).
|
|
287
|
+
"group-data-[layout=horizontal-inline]/stepper:mx-2 group-data-[layout=horizontal-inline]/stepper:h-0.5 group-data-[layout=horizontal-inline]/stepper:flex-1",
|
|
288
|
+
// Vertical: in-flow line below the indicator (ms aligns under center).
|
|
289
|
+
"group-data-[layout=vertical]/stepper:my-1 group-data-[layout=vertical]/stepper:ms-[15px] group-data-[layout=vertical]/stepper:h-8 group-data-[layout=vertical]/stepper:w-0.5",
|
|
290
|
+
t
|
|
291
|
+
),
|
|
292
|
+
"data-hook": a,
|
|
293
|
+
"data-slot": "stepper-separator",
|
|
294
|
+
role: "presentation",
|
|
295
|
+
...e
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
});
|
|
299
|
+
B.displayName = "StepperSeparator";
|
|
300
|
+
const G = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
|
|
301
|
+
"span",
|
|
302
|
+
{
|
|
303
|
+
ref: e,
|
|
304
|
+
className: d(
|
|
305
|
+
"flex flex-col gap-0.5",
|
|
306
|
+
"group-data-[layout=horizontal-below]/stepper:items-center group-data-[layout=horizontal-below]/stepper:text-center",
|
|
307
|
+
"group-data-[layout=horizontal-inline]/stepper:items-start group-data-[layout=horizontal-inline]/stepper:text-left",
|
|
308
|
+
"group-data-[layout=vertical]/stepper:items-start group-data-[layout=vertical]/stepper:text-left",
|
|
309
|
+
t
|
|
310
|
+
),
|
|
311
|
+
"data-slot": "stepper-content",
|
|
312
|
+
...a
|
|
313
|
+
}
|
|
314
|
+
));
|
|
315
|
+
G.displayName = "StepperContent";
|
|
316
|
+
const H = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
|
|
317
|
+
"span",
|
|
318
|
+
{
|
|
319
|
+
ref: e,
|
|
320
|
+
className: d(
|
|
321
|
+
"text-foreground text-sm font-semibold",
|
|
322
|
+
"group-data-[state=inactive]/step:text-muted-foreground",
|
|
323
|
+
"group-data-[disabled=true]/step:text-muted-foreground",
|
|
324
|
+
t
|
|
325
|
+
),
|
|
326
|
+
"data-slot": "stepper-title",
|
|
327
|
+
...a
|
|
328
|
+
}
|
|
329
|
+
));
|
|
330
|
+
H.displayName = "StepperTitle";
|
|
331
|
+
const J = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
|
|
332
|
+
"span",
|
|
333
|
+
{
|
|
334
|
+
ref: e,
|
|
335
|
+
className: d("text-muted-foreground text-xs font-normal", t),
|
|
336
|
+
"data-slot": "stepper-description",
|
|
337
|
+
...a
|
|
338
|
+
}
|
|
339
|
+
));
|
|
340
|
+
J.displayName = "StepperDescription";
|
|
341
|
+
export {
|
|
342
|
+
M as Stepper,
|
|
343
|
+
G as StepperContent,
|
|
344
|
+
J as StepperDescription,
|
|
345
|
+
q as StepperIndicator,
|
|
346
|
+
F as StepperItem,
|
|
347
|
+
V as StepperNav,
|
|
348
|
+
B as StepperSeparator,
|
|
349
|
+
H as StepperTitle,
|
|
350
|
+
X as StepperTrigger
|
|
351
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightlocal/ui-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"description": "BrightLocal Design System UI Components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -130,8 +130,8 @@
|
|
|
130
130
|
"vite-bundle-visualizer": "^1.2.1",
|
|
131
131
|
"vite-plugin-dts": "^4.5.4",
|
|
132
132
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
133
|
-
"@workspace/
|
|
134
|
-
"@workspace/
|
|
133
|
+
"@workspace/typescript-config": "0.0.0",
|
|
134
|
+
"@workspace/eslint-config": "0.0.0"
|
|
135
135
|
},
|
|
136
136
|
"publishConfig": {
|
|
137
137
|
"access": "public",
|
|
@@ -185,7 +185,8 @@
|
|
|
185
185
|
"sonner": "^2.0.7",
|
|
186
186
|
"tailwind-merge": "^3.4.0",
|
|
187
187
|
"vaul": "^1.1.2",
|
|
188
|
-
"@brightlocal/icons": "2.
|
|
188
|
+
"@brightlocal/icons": "2.3.0",
|
|
189
|
+
"@brightlocal/illustrations": "0.5.0"
|
|
189
190
|
},
|
|
190
191
|
"size-limit": [
|
|
191
192
|
{
|
package/src/components/card.tsx
CHANGED
|
@@ -228,6 +228,28 @@ const CardAction = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
|
|
|
228
228
|
);
|
|
229
229
|
CardAction.displayName = "CardAction";
|
|
230
230
|
|
|
231
|
+
/**
|
|
232
|
+
* Media container for images, videos, or other visual content within the Card.
|
|
233
|
+
*/
|
|
234
|
+
const CardMedia = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
|
|
235
|
+
({ className, children, ...props }, ref) => {
|
|
236
|
+
const { flush, density } = React.useContext(CardContext);
|
|
237
|
+
return (
|
|
238
|
+
<div
|
|
239
|
+
ref={ref}
|
|
240
|
+
className={cn(subPadding(flush, density), className)}
|
|
241
|
+
data-slot="card-media"
|
|
242
|
+
{...props}
|
|
243
|
+
>
|
|
244
|
+
<div className="overflow-hidden rounded-md" data-slot="card-media-clip">
|
|
245
|
+
{children}
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
CardMedia.displayName = "CardMedia";
|
|
252
|
+
|
|
231
253
|
/**
|
|
232
254
|
* Main content area of the Card.
|
|
233
255
|
*/
|
|
@@ -275,6 +297,7 @@ export {
|
|
|
275
297
|
CardTitle,
|
|
276
298
|
CardAction,
|
|
277
299
|
CardDescription,
|
|
300
|
+
CardMedia,
|
|
278
301
|
CardContent,
|
|
279
302
|
};
|
|
280
303
|
|
package/src/components/list.tsx
CHANGED
|
@@ -232,7 +232,10 @@ const ItemTitle = React.forwardRef<HTMLDivElement, ItemTitleProps>(
|
|
|
232
232
|
({ className, ...props }, ref) => (
|
|
233
233
|
<div
|
|
234
234
|
ref={ref}
|
|
235
|
-
className={cn(
|
|
235
|
+
className={cn(
|
|
236
|
+
"text-foreground text-base leading-normal font-medium",
|
|
237
|
+
className
|
|
238
|
+
)}
|
|
236
239
|
data-slot="item-title"
|
|
237
240
|
{...props}
|
|
238
241
|
/>
|
|
@@ -254,7 +257,10 @@ const ItemDescription = React.forwardRef<HTMLDivElement, ItemDescriptionProps>(
|
|
|
254
257
|
({ className, ...props }, ref) => (
|
|
255
258
|
<div
|
|
256
259
|
ref={ref}
|
|
257
|
-
className={cn(
|
|
260
|
+
className={cn(
|
|
261
|
+
"text-muted-foreground text-sm leading-normal font-normal",
|
|
262
|
+
className
|
|
263
|
+
)}
|
|
258
264
|
data-slot="item-description"
|
|
259
265
|
{...props}
|
|
260
266
|
/>
|