@syscore/ui-library 2.0.0-beta-publish-workflow-beta.18 → 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.
@@ -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,
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { ChevronLeft, ChevronRight } from "lucide-react";
2
+ import { ChevronDown, ChevronLeft, ChevronRight } from "lucide-react";
3
3
  import { DayPicker } from "react-day-picker";
4
4
 
5
5
  import { cn } from "@/lib/utils";
@@ -20,31 +20,38 @@ function Calendar({
20
20
  classNames={{
21
21
  months: "calendar-months",
22
22
  month: "calendar-month",
23
- caption: "calendar-caption",
23
+ month_caption: "calendar-caption",
24
24
  caption_label: "calendar-caption-label",
25
25
  nav: "calendar-nav",
26
- nav_button: cn(
26
+ button_previous: cn(
27
27
  buttonVariants({ variant: "general-secondary" }),
28
28
  "calendar-nav-button",
29
+ "calendar-nav-button-previous",
29
30
  ),
30
- nav_button_previous: "calendar-nav-button-previous",
31
- nav_button_next: "calendar-nav-button-next",
32
- table: "calendar-table",
33
- head_row: "calendar-head-row",
34
- head_cell: "calendar-head-cell",
35
- row: "calendar-row",
36
- cell: "calendar-cell",
37
- day: cn(
31
+ button_next: cn(
32
+ buttonVariants({ variant: "general-secondary" }),
33
+ "calendar-nav-button",
34
+ "calendar-nav-button-next",
35
+ ),
36
+ month_grid: "calendar-table",
37
+ weekdays: "calendar-head-row",
38
+ weekday: "calendar-head-cell",
39
+ week: "calendar-row",
40
+ day: "calendar-cell",
41
+ day_button: cn(
38
42
  buttonVariants({ variant: "general-tertiary" }),
39
43
  "calendar-day",
40
44
  ),
41
- day_range_end: "calendar-day-range-end",
42
- day_selected: "calendar-day-selected",
43
- day_today: "calendar-day-today",
44
- day_outside: "calendar-day-outside",
45
- day_disabled: "calendar-day-disabled",
46
- day_range_middle: "calendar-day-range-middle",
47
- day_hidden: "calendar-day-hidden",
45
+ range_end: "calendar-day-range-end",
46
+ selected: "calendar-day-selected",
47
+ today: "calendar-day-today",
48
+ outside: "calendar-day-outside",
49
+ disabled: "calendar-day-disabled",
50
+ range_middle: "calendar-day-range-middle",
51
+ hidden: "calendar-day-hidden",
52
+ dropdowns: "calendar-dropdowns",
53
+ dropdown_root: "calendar-dropdown-root",
54
+ dropdown: "calendar-dropdown",
48
55
  ...classNames,
49
56
  }}
50
57
  components={{
@@ -52,7 +59,10 @@ function Calendar({
52
59
  if (props.orientation === "left") {
53
60
  return <ChevronLeft className="icon-4" />;
54
61
  }
55
- return <ChevronRight className="icon-4" />;
62
+ if (props.orientation === "right") {
63
+ return <ChevronRight className="icon-4" />;
64
+ }
65
+ return <ChevronDown className="icon-3" />;
56
66
  },
57
67
  }}
58
68
  {...props}
@@ -31,54 +31,98 @@ const SelectTrigger = React.forwardRef<
31
31
  ));
32
32
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
33
33
 
34
- const SelectScrollUpButton = React.forwardRef<
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", className)}
41
- {...props}
42
- >
43
- <UtilityChevronDown />
44
- </SelectPrimitive.ScrollUpButton>
45
- ));
46
- SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
34
+ type ScrollDirection = "up" | "down";
47
35
 
48
- const SelectScrollDownButton = React.forwardRef<
49
- React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
50
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
51
- >(({ className, ...props }, ref) => (
52
- <SelectPrimitive.ScrollDownButton
53
- ref={ref}
54
- className={cn("select-scroll-button", className)}
55
- {...props}
56
- >
57
- <UtilityChevronDown />
58
- </SelectPrimitive.ScrollDownButton>
59
- ));
60
- SelectScrollDownButton.displayName =
61
- SelectPrimitive.ScrollDownButton.displayName;
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
- <SelectPrimitive.Portal>
68
- <SelectPrimitive.Content
69
- ref={ref}
70
- className={cn("select-content", className)}
71
- position={position}
72
- {...props}
73
- >
74
- <SelectScrollUpButton />
75
- <SelectPrimitive.Viewport className="select-viewport">
76
- {children}
77
- </SelectPrimitive.Viewport>
78
- <SelectScrollDownButton />
79
- </SelectPrimitive.Content>
80
- </SelectPrimitive.Portal>
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
- const isClickable = !!onStepClick && status === "complete";
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,26 @@ body {
6091
6096
 
6092
6097
  .select-scroll-button {
6093
6098
  display: flex;
6094
- cursor: default;
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);
6115
+ }
6116
+
6117
+ .select-scroll-up svg {
6118
+ transform: rotate(180deg);
6099
6119
  }
6100
6120
 
6101
6121
  .select-content {
@@ -9232,6 +9252,7 @@ body {
9232
9252
 
9233
9253
  /* Calendar Styles */
9234
9254
  .calendar {
9255
+ position: relative;
9235
9256
  padding: 0.75rem;
9236
9257
  }
9237
9258
 
@@ -9268,10 +9289,63 @@ body {
9268
9289
  font-weight: 500;
9269
9290
  }
9270
9291
 
9292
+ /* Month/year pickers (captionLayout="dropdown"): v9 lays a real <select> over a visible label. */
9293
+ .calendar-dropdowns {
9294
+ display: flex;
9295
+ align-items: center;
9296
+ gap: 0.5rem;
9297
+ }
9298
+
9299
+ .calendar-dropdowns .calendar-dropdown-root {
9300
+ position: relative;
9301
+ display: inline-flex;
9302
+ align-items: center;
9303
+ gap: 0.125rem;
9304
+ padding: 0.125rem 0.25rem;
9305
+ border-radius: calc(var(--radius-md, 8px));
9306
+ }
9307
+
9308
+ .calendar-dropdowns .calendar-dropdown-root:hover {
9309
+ background-color: var(--color-gray-50, #f9f9fa);
9310
+ }
9311
+
9312
+ .calendar-dropdowns .calendar-dropdown {
9313
+ position: absolute;
9314
+ inset: 0;
9315
+ width: 100%;
9316
+ height: 100%;
9317
+ margin: 0;
9318
+ padding: 0;
9319
+ border: 0;
9320
+ opacity: 0;
9321
+ cursor: pointer;
9322
+ appearance: none;
9323
+ }
9324
+
9325
+ .calendar-dropdowns .calendar-dropdown:focus-visible + .calendar-caption-label {
9326
+ outline: 2px solid var(--color-blue-600, #2e74ad);
9327
+ outline-offset: 2px;
9328
+ border-radius: calc(var(--radius-sm, 4px));
9329
+ }
9330
+
9331
+ .calendar-dropdowns .calendar-caption-label {
9332
+ display: inline-flex;
9333
+ align-items: center;
9334
+ gap: 0.125rem;
9335
+ white-space: nowrap;
9336
+ pointer-events: none;
9337
+ }
9338
+
9339
+ /* react-day-picker v9: the nav is a sibling of the months, so anchor it to the calendar root. */
9271
9340
  .calendar-nav {
9341
+ position: absolute;
9342
+ top: 0.25rem;
9343
+ left: 0.25rem;
9344
+ right: 0.25rem;
9272
9345
  display: flex;
9273
9346
  gap: 0.25rem;
9274
9347
  align-items: center;
9348
+ justify-content: space-between;
9275
9349
  }
9276
9350
 
9277
9351
  .calendar-nav-button {
@@ -9287,14 +9361,9 @@ body {
9287
9361
  opacity: 1;
9288
9362
  }
9289
9363
 
9290
- .calendar-nav-button-previous {
9291
- position: absolute;
9292
- left: 0.25rem;
9293
- }
9294
-
9364
+ .calendar-nav-button-previous,
9295
9365
  .calendar-nav-button-next {
9296
- position: absolute;
9297
- right: 0.25rem;
9366
+ position: static;
9298
9367
  }
9299
9368
 
9300
9369
  .calendar-table {
@@ -12367,6 +12436,19 @@ body {
12367
12436
  opacity: 0.8;
12368
12437
  }
12369
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
+
12370
12452
  .stepper-indicator-number {
12371
12453
  line-height: 1;
12372
12454
  }
@@ -14188,6 +14270,19 @@ body {
14188
14270
  opacity: 0.8;
14189
14271
  }
14190
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
+
14191
14286
  .stepper-indicator-number {
14192
14287
  line-height: 1;
14193
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
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { ChevronLeft, ChevronRight } from "lucide-react";
2
+ import { ChevronLeft, ChevronRight, ChevronDown } from "lucide-react";
3
3
  import { DayPicker } from "react-day-picker";
4
4
  import { cn } from "../../lib/utils.js";
5
5
  import { buttonVariants } from "./button.js";
@@ -17,31 +17,38 @@ function Calendar({
17
17
  classNames: {
18
18
  months: "calendar-months",
19
19
  month: "calendar-month",
20
- caption: "calendar-caption",
20
+ month_caption: "calendar-caption",
21
21
  caption_label: "calendar-caption-label",
22
22
  nav: "calendar-nav",
23
- nav_button: cn(
23
+ button_previous: cn(
24
24
  buttonVariants({ variant: "general-secondary" }),
25
- "calendar-nav-button"
25
+ "calendar-nav-button",
26
+ "calendar-nav-button-previous"
26
27
  ),
27
- nav_button_previous: "calendar-nav-button-previous",
28
- nav_button_next: "calendar-nav-button-next",
29
- table: "calendar-table",
30
- head_row: "calendar-head-row",
31
- head_cell: "calendar-head-cell",
32
- row: "calendar-row",
33
- cell: "calendar-cell",
34
- day: cn(
28
+ button_next: cn(
29
+ buttonVariants({ variant: "general-secondary" }),
30
+ "calendar-nav-button",
31
+ "calendar-nav-button-next"
32
+ ),
33
+ month_grid: "calendar-table",
34
+ weekdays: "calendar-head-row",
35
+ weekday: "calendar-head-cell",
36
+ week: "calendar-row",
37
+ day: "calendar-cell",
38
+ day_button: cn(
35
39
  buttonVariants({ variant: "general-tertiary" }),
36
40
  "calendar-day"
37
41
  ),
38
- day_range_end: "calendar-day-range-end",
39
- day_selected: "calendar-day-selected",
40
- day_today: "calendar-day-today",
41
- day_outside: "calendar-day-outside",
42
- day_disabled: "calendar-day-disabled",
43
- day_range_middle: "calendar-day-range-middle",
44
- day_hidden: "calendar-day-hidden",
42
+ range_end: "calendar-day-range-end",
43
+ selected: "calendar-day-selected",
44
+ today: "calendar-day-today",
45
+ outside: "calendar-day-outside",
46
+ disabled: "calendar-day-disabled",
47
+ range_middle: "calendar-day-range-middle",
48
+ hidden: "calendar-day-hidden",
49
+ dropdowns: "calendar-dropdowns",
50
+ dropdown_root: "calendar-dropdown-root",
51
+ dropdown: "calendar-dropdown",
45
52
  ...classNames
46
53
  },
47
54
  components: {
@@ -49,7 +56,10 @@ function Calendar({
49
56
  if (props2.orientation === "left") {
50
57
  return /* @__PURE__ */ jsx(ChevronLeft, { className: "icon-4" });
51
58
  }
52
- return /* @__PURE__ */ jsx(ChevronRight, { className: "icon-4" });
59
+ if (props2.orientation === "right") {
60
+ return /* @__PURE__ */ jsx(ChevronRight, { className: "icon-4" });
61
+ }
62
+ return /* @__PURE__ */ jsx(ChevronDown, { className: "icon-3" });
53
63
  }
54
64
  },
55
65
  ...props
@@ -19,40 +19,88 @@ const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref)
19
19
  }
20
20
  ));
21
21
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
22
- const SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
23
- SelectPrimitive.ScrollUpButton,
24
- {
25
- ref,
26
- className: cn("select-scroll-button", className),
27
- ...props,
28
- children: /* @__PURE__ */ jsx(UtilityChevronDown, {})
29
- }
30
- ));
31
- SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
32
- const SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
33
- SelectPrimitive.ScrollDownButton,
34
- {
35
- ref,
36
- className: cn("select-scroll-button", className),
37
- ...props,
38
- children: /* @__PURE__ */ jsx(UtilityChevronDown, {})
39
- }
40
- ));
41
- SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
42
- const SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
43
- SelectPrimitive.Content,
44
- {
45
- ref,
46
- className: cn("select-content", className),
47
- position,
48
- ...props,
49
- children: [
50
- /* @__PURE__ */ jsx(SelectScrollUpButton, {}),
51
- /* @__PURE__ */ jsx(SelectPrimitive.Viewport, { className: "select-viewport", children }),
52
- /* @__PURE__ */ jsx(SelectScrollDownButton, {})
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