@syscore/ui-library 2.0.0-beta-publish-workflow-beta.19 → 2.0.0-beta-publish-workflow-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/components/ui/button.tsx +4 -0
- package/client/components/ui/select.tsx +87 -45
- package/client/components/ui/stepper.tsx +4 -1
- package/client/global.css +43 -1
- package/dist/client/components/ui/button.js +2 -0
- package/dist/client/components/ui/select.js +82 -36
- package/dist/client/components/ui/stepper.js +3 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +0 -6
- package/dist/ui/index.js +1 -3
- package/package.json +1 -1
|
@@ -70,6 +70,8 @@ export interface ButtonProps
|
|
|
70
70
|
iconGap?: "tight" | "normal";
|
|
71
71
|
/** Default `"asymmetric"` reduces padding only on the icon's side. `"symmetric"` keeps both sides equal to the size variant's own padding. */
|
|
72
72
|
iconPadding?: "asymmetric" | "symmetric";
|
|
73
|
+
/** Stretches the button to its container's width — e.g. a Continue/Back pair that should read as the same size as a full-width CTA on another step. */
|
|
74
|
+
fullWidth?: boolean;
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
const sizeTextClasses: Record<string, string> = {
|
|
@@ -91,6 +93,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
91
93
|
iconPosition = "leading",
|
|
92
94
|
iconGap = "tight",
|
|
93
95
|
iconPadding = "asymmetric",
|
|
96
|
+
fullWidth = false,
|
|
94
97
|
children,
|
|
95
98
|
style,
|
|
96
99
|
...props
|
|
@@ -109,6 +112,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
109
112
|
Icon && iconPadding === "asymmetric" && iconPosition === "leading" && "button--has-icon-leading",
|
|
110
113
|
Icon && iconPadding === "asymmetric" && iconPosition === "trailing" && "button--has-icon-trailing",
|
|
111
114
|
Icon && iconGap === "normal" && "button--icon-gap-normal",
|
|
115
|
+
fullWidth && "button--full-width",
|
|
112
116
|
ftMadeFont && "font-ftMade",
|
|
113
117
|
mazzardSoftFont && "font-mazzardSoft",
|
|
114
118
|
className,
|
|
@@ -31,54 +31,98 @@ const SelectTrigger = React.forwardRef<
|
|
|
31
31
|
));
|
|
32
32
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
36
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
37
|
-
>(({ className, ...props }, ref) => (
|
|
38
|
-
<SelectPrimitive.ScrollUpButton
|
|
39
|
-
ref={ref}
|
|
40
|
-
className={cn("select-scroll-button select-scroll-up", className)}
|
|
41
|
-
{...props}
|
|
42
|
-
>
|
|
43
|
-
<UtilityChevronDown />
|
|
44
|
-
</SelectPrimitive.ScrollUpButton>
|
|
45
|
-
));
|
|
46
|
-
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
34
|
+
type ScrollDirection = "up" | "down";
|
|
47
35
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
|
|
36
|
+
function SelectScrollButton({
|
|
37
|
+
direction,
|
|
38
|
+
viewportRef,
|
|
39
|
+
visible,
|
|
40
|
+
onScrolled,
|
|
41
|
+
}: {
|
|
42
|
+
direction: ScrollDirection;
|
|
43
|
+
viewportRef: React.RefObject<HTMLDivElement>;
|
|
44
|
+
visible: boolean;
|
|
45
|
+
onScrolled: () => void;
|
|
46
|
+
}) {
|
|
47
|
+
if (!visible) return null;
|
|
48
|
+
|
|
49
|
+
const scrollOneItem = () => {
|
|
50
|
+
const viewport = viewportRef.current;
|
|
51
|
+
if (!viewport) return;
|
|
52
|
+
const item = viewport.querySelector<HTMLElement>('[role="option"]');
|
|
53
|
+
const step = item?.offsetHeight ?? 32;
|
|
54
|
+
viewport.scrollBy({ top: direction === "up" ? -step : step });
|
|
55
|
+
onScrolled();
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<button
|
|
60
|
+
type="button"
|
|
61
|
+
tabIndex={-1}
|
|
62
|
+
aria-label={direction === "up" ? "Scroll up one option" : "Scroll down one option"}
|
|
63
|
+
className={cn("select-scroll-button", `select-scroll-button--${direction}`)}
|
|
64
|
+
onClick={scrollOneItem}
|
|
65
|
+
>
|
|
66
|
+
<UtilityChevronDown />
|
|
67
|
+
</button>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
62
70
|
|
|
63
71
|
const SelectContent = React.forwardRef<
|
|
64
72
|
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
65
73
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
66
|
-
>(({ className, children, position = "popper", ...props }, ref) =>
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
>(({ className, children, position = "popper", ...props }, ref) => {
|
|
75
|
+
const viewportRef = React.useRef<HTMLDivElement>(null);
|
|
76
|
+
const [canScrollUp, setCanScrollUp] = React.useState(false);
|
|
77
|
+
const [canScrollDown, setCanScrollDown] = React.useState(false);
|
|
78
|
+
|
|
79
|
+
const updateScrollState = React.useCallback(() => {
|
|
80
|
+
const viewport = viewportRef.current;
|
|
81
|
+
if (!viewport) return;
|
|
82
|
+
setCanScrollUp(viewport.scrollTop > 0);
|
|
83
|
+
setCanScrollDown(
|
|
84
|
+
viewport.scrollTop + viewport.clientHeight < viewport.scrollHeight - 1,
|
|
85
|
+
);
|
|
86
|
+
}, []);
|
|
87
|
+
|
|
88
|
+
// The viewport's size isn't settled until Radix finishes positioning the
|
|
89
|
+
// open popup, so the first check runs a tick after mount.
|
|
90
|
+
React.useEffect(() => {
|
|
91
|
+
const raf = requestAnimationFrame(updateScrollState);
|
|
92
|
+
return () => cancelAnimationFrame(raf);
|
|
93
|
+
}, [updateScrollState, children]);
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<SelectPrimitive.Portal>
|
|
97
|
+
<SelectPrimitive.Content
|
|
98
|
+
ref={ref}
|
|
99
|
+
className={cn("select-content", className)}
|
|
100
|
+
position={position}
|
|
101
|
+
{...props}
|
|
102
|
+
>
|
|
103
|
+
<SelectScrollButton
|
|
104
|
+
direction="up"
|
|
105
|
+
viewportRef={viewportRef}
|
|
106
|
+
visible={canScrollUp}
|
|
107
|
+
onScrolled={updateScrollState}
|
|
108
|
+
/>
|
|
109
|
+
<SelectPrimitive.Viewport
|
|
110
|
+
ref={viewportRef}
|
|
111
|
+
className="select-viewport"
|
|
112
|
+
onScroll={updateScrollState}
|
|
113
|
+
>
|
|
114
|
+
{children}
|
|
115
|
+
</SelectPrimitive.Viewport>
|
|
116
|
+
<SelectScrollButton
|
|
117
|
+
direction="down"
|
|
118
|
+
viewportRef={viewportRef}
|
|
119
|
+
visible={canScrollDown}
|
|
120
|
+
onScrolled={updateScrollState}
|
|
121
|
+
/>
|
|
122
|
+
</SelectPrimitive.Content>
|
|
123
|
+
</SelectPrimitive.Portal>
|
|
124
|
+
);
|
|
125
|
+
});
|
|
82
126
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
83
127
|
|
|
84
128
|
const SelectLabel = React.forwardRef<
|
|
@@ -128,6 +172,4 @@ export {
|
|
|
128
172
|
SelectLabel,
|
|
129
173
|
SelectItem,
|
|
130
174
|
SelectSeparator,
|
|
131
|
-
SelectScrollUpButton,
|
|
132
|
-
SelectScrollDownButton,
|
|
133
175
|
};
|
|
@@ -87,7 +87,8 @@ const Stepper = React.forwardRef<HTMLDivElement, StepperProps>(
|
|
|
87
87
|
>
|
|
88
88
|
{steps.map((step, index) => {
|
|
89
89
|
const status = getStatus(index, currentStep);
|
|
90
|
-
|
|
90
|
+
|
|
91
|
+
const isClickable = !!onStepClick && status !== "upcoming";
|
|
91
92
|
const isLast = index === steps.length - 1;
|
|
92
93
|
|
|
93
94
|
return (
|
|
@@ -95,9 +96,11 @@ const Stepper = React.forwardRef<HTMLDivElement, StepperProps>(
|
|
|
95
96
|
key={index}
|
|
96
97
|
role="listitem"
|
|
97
98
|
aria-current={status === "current" ? "step" : undefined}
|
|
99
|
+
onClick={() => isClickable && onStepClick(index)}
|
|
98
100
|
className={cn(
|
|
99
101
|
"stepper-item",
|
|
100
102
|
`stepper-item--${status}`,
|
|
103
|
+
isClickable && "stepper-item--clickable",
|
|
101
104
|
orientation === "horizontal" && !isLast && "stepper-item--with-connector",
|
|
102
105
|
)}
|
|
103
106
|
>
|
package/client/global.css
CHANGED
|
@@ -919,6 +919,11 @@ body {
|
|
|
919
919
|
outline: none;
|
|
920
920
|
}
|
|
921
921
|
|
|
922
|
+
.button--full-width {
|
|
923
|
+
display: flex;
|
|
924
|
+
width: 100%;
|
|
925
|
+
}
|
|
926
|
+
|
|
922
927
|
.button:focus-visible {
|
|
923
928
|
outline: none;
|
|
924
929
|
box-shadow:
|
|
@@ -6091,11 +6096,22 @@ body {
|
|
|
6091
6096
|
|
|
6092
6097
|
.select-scroll-button {
|
|
6093
6098
|
display: flex;
|
|
6094
|
-
cursor:
|
|
6099
|
+
cursor: pointer;
|
|
6095
6100
|
align-items: center;
|
|
6096
6101
|
justify-content: center;
|
|
6102
|
+
width: 100%;
|
|
6097
6103
|
padding-top: 0.25rem;
|
|
6098
6104
|
padding-bottom: 0.25rem;
|
|
6105
|
+
background: none;
|
|
6106
|
+
border: none;
|
|
6107
|
+
}
|
|
6108
|
+
|
|
6109
|
+
.select-scroll-button:hover {
|
|
6110
|
+
opacity: 0.7;
|
|
6111
|
+
}
|
|
6112
|
+
|
|
6113
|
+
.select-scroll-button--up svg {
|
|
6114
|
+
transform: rotate(180deg);
|
|
6099
6115
|
}
|
|
6100
6116
|
|
|
6101
6117
|
.select-scroll-up svg {
|
|
@@ -12420,6 +12436,19 @@ body {
|
|
|
12420
12436
|
opacity: 0.8;
|
|
12421
12437
|
}
|
|
12422
12438
|
|
|
12439
|
+
/* Hovering anywhere on a clickable step — not just the circle or the
|
|
12440
|
+
title text — gives the same feedback, so the "+"/check icon and the
|
|
12441
|
+
empty space around it read as interactive too. */
|
|
12442
|
+
.stepper-item--clickable {
|
|
12443
|
+
cursor: pointer;
|
|
12444
|
+
}
|
|
12445
|
+
.stepper-item--clickable:hover .stepper-indicator {
|
|
12446
|
+
opacity: 0.8;
|
|
12447
|
+
}
|
|
12448
|
+
.stepper-item--clickable:hover .stepper-title {
|
|
12449
|
+
text-decoration: underline;
|
|
12450
|
+
}
|
|
12451
|
+
|
|
12423
12452
|
.stepper-indicator-number {
|
|
12424
12453
|
line-height: 1;
|
|
12425
12454
|
}
|
|
@@ -14241,6 +14270,19 @@ body {
|
|
|
14241
14270
|
opacity: 0.8;
|
|
14242
14271
|
}
|
|
14243
14272
|
|
|
14273
|
+
/* Hovering anywhere on a clickable step — not just the circle or the
|
|
14274
|
+
title text — gives the same feedback, so the "+"/check icon and the
|
|
14275
|
+
empty space around it read as interactive too. */
|
|
14276
|
+
.stepper-item--clickable {
|
|
14277
|
+
cursor: pointer;
|
|
14278
|
+
}
|
|
14279
|
+
.stepper-item--clickable:hover .stepper-indicator {
|
|
14280
|
+
opacity: 0.8;
|
|
14281
|
+
}
|
|
14282
|
+
.stepper-item--clickable:hover .stepper-title {
|
|
14283
|
+
text-decoration: underline;
|
|
14284
|
+
}
|
|
14285
|
+
|
|
14244
14286
|
.stepper-indicator-number {
|
|
14245
14287
|
line-height: 1;
|
|
14246
14288
|
}
|
|
@@ -62,6 +62,7 @@ const Button = React.forwardRef(
|
|
|
62
62
|
iconPosition = "leading",
|
|
63
63
|
iconGap = "tight",
|
|
64
64
|
iconPadding = "asymmetric",
|
|
65
|
+
fullWidth = false,
|
|
65
66
|
children,
|
|
66
67
|
style,
|
|
67
68
|
...props
|
|
@@ -76,6 +77,7 @@ const Button = React.forwardRef(
|
|
|
76
77
|
Icon && iconPadding === "asymmetric" && iconPosition === "leading" && "button--has-icon-leading",
|
|
77
78
|
Icon && iconPadding === "asymmetric" && iconPosition === "trailing" && "button--has-icon-trailing",
|
|
78
79
|
Icon && iconGap === "normal" && "button--icon-gap-normal",
|
|
80
|
+
fullWidth && "button--full-width",
|
|
79
81
|
ftMadeFont && "font-ftMade",
|
|
80
82
|
mazzardSoftFont && "font-mazzardSoft",
|
|
81
83
|
className
|
|
@@ -19,40 +19,88 @@ const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref)
|
|
|
19
19
|
}
|
|
20
20
|
));
|
|
21
21
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
)
|
|
22
|
+
function SelectScrollButton({
|
|
23
|
+
direction,
|
|
24
|
+
viewportRef,
|
|
25
|
+
visible,
|
|
26
|
+
onScrolled
|
|
27
|
+
}) {
|
|
28
|
+
if (!visible) return null;
|
|
29
|
+
const scrollOneItem = () => {
|
|
30
|
+
const viewport = viewportRef.current;
|
|
31
|
+
if (!viewport) return;
|
|
32
|
+
const item = viewport.querySelector('[role="option"]');
|
|
33
|
+
const step = (item == null ? void 0 : item.offsetHeight) ?? 32;
|
|
34
|
+
viewport.scrollBy({ top: direction === "up" ? -step : step });
|
|
35
|
+
onScrolled();
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
"button",
|
|
39
|
+
{
|
|
40
|
+
type: "button",
|
|
41
|
+
tabIndex: -1,
|
|
42
|
+
"aria-label": direction === "up" ? "Scroll up one option" : "Scroll down one option",
|
|
43
|
+
className: cn("select-scroll-button", `select-scroll-button--${direction}`),
|
|
44
|
+
onClick: scrollOneItem,
|
|
45
|
+
children: /* @__PURE__ */ jsx(UtilityChevronDown, {})
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
const SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => {
|
|
50
|
+
const viewportRef = React.useRef(null);
|
|
51
|
+
const [canScrollUp, setCanScrollUp] = React.useState(false);
|
|
52
|
+
const [canScrollDown, setCanScrollDown] = React.useState(false);
|
|
53
|
+
const updateScrollState = React.useCallback(() => {
|
|
54
|
+
const viewport = viewportRef.current;
|
|
55
|
+
if (!viewport) return;
|
|
56
|
+
setCanScrollUp(viewport.scrollTop > 0);
|
|
57
|
+
setCanScrollDown(
|
|
58
|
+
viewport.scrollTop + viewport.clientHeight < viewport.scrollHeight - 1
|
|
59
|
+
);
|
|
60
|
+
}, []);
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
const raf = requestAnimationFrame(updateScrollState);
|
|
63
|
+
return () => cancelAnimationFrame(raf);
|
|
64
|
+
}, [updateScrollState, children]);
|
|
65
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
66
|
+
SelectPrimitive.Content,
|
|
67
|
+
{
|
|
68
|
+
ref,
|
|
69
|
+
className: cn("select-content", className),
|
|
70
|
+
position,
|
|
71
|
+
...props,
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ jsx(
|
|
74
|
+
SelectScrollButton,
|
|
75
|
+
{
|
|
76
|
+
direction: "up",
|
|
77
|
+
viewportRef,
|
|
78
|
+
visible: canScrollUp,
|
|
79
|
+
onScrolled: updateScrollState
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
SelectPrimitive.Viewport,
|
|
84
|
+
{
|
|
85
|
+
ref: viewportRef,
|
|
86
|
+
className: "select-viewport",
|
|
87
|
+
onScroll: updateScrollState,
|
|
88
|
+
children
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
SelectScrollButton,
|
|
93
|
+
{
|
|
94
|
+
direction: "down",
|
|
95
|
+
viewportRef,
|
|
96
|
+
visible: canScrollDown,
|
|
97
|
+
onScrolled: updateScrollState
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
) });
|
|
103
|
+
});
|
|
56
104
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
57
105
|
const SelectLabel = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
58
106
|
SelectPrimitive.Label,
|
|
@@ -88,8 +136,6 @@ export {
|
|
|
88
136
|
SelectGroup,
|
|
89
137
|
SelectItem,
|
|
90
138
|
SelectLabel,
|
|
91
|
-
SelectScrollDownButton,
|
|
92
|
-
SelectScrollUpButton,
|
|
93
139
|
SelectSeparator,
|
|
94
140
|
SelectTrigger,
|
|
95
141
|
SelectValue
|
|
@@ -50,16 +50,18 @@ const Stepper = React.forwardRef(
|
|
|
50
50
|
),
|
|
51
51
|
children: steps.map((step, index) => {
|
|
52
52
|
const status = getStatus(index, currentStep);
|
|
53
|
-
const isClickable = !!onStepClick && status
|
|
53
|
+
const isClickable = !!onStepClick && status !== "upcoming";
|
|
54
54
|
const isLast = index === steps.length - 1;
|
|
55
55
|
return /* @__PURE__ */ jsxs(
|
|
56
56
|
"div",
|
|
57
57
|
{
|
|
58
58
|
role: "listitem",
|
|
59
59
|
"aria-current": status === "current" ? "step" : void 0,
|
|
60
|
+
onClick: () => isClickable && onStepClick(index),
|
|
60
61
|
className: cn(
|
|
61
62
|
"stepper-item",
|
|
62
63
|
`stepper-item--${status}`,
|
|
64
|
+
isClickable && "stepper-item--clickable",
|
|
63
65
|
orientation === "horizontal" && !isLast && "stepper-item--with-connector"
|
|
64
66
|
),
|
|
65
67
|
children: [
|