shadcn-ui-react 0.7.13 → 0.7.15

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/dist/index.cjs CHANGED
@@ -3495,10 +3495,10 @@ function CaptionLabel(props) {
3495
3495
  // node_modules/react-day-picker/dist/esm/components/Chevron.js
3496
3496
  var import_react2 = __toESM(require("react"), 1);
3497
3497
  function Chevron(props) {
3498
- const { size = 24, orientation = "left", className } = props;
3498
+ const { size = 24, orientation = "left", className, style } = props;
3499
3499
  return import_react2.default.createElement(
3500
3500
  "svg",
3501
- { className, width: size, height: size, viewBox: "0 0 24 24" },
3501
+ { className, style, width: size, height: size, viewBox: "0 0 24 24" },
3502
3502
  orientation === "up" && import_react2.default.createElement("polygon", { points: "6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28" }),
3503
3503
  orientation === "down" && import_react2.default.createElement("polygon", { points: "6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72" }),
3504
3504
  orientation === "left" && import_react2.default.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" }),
@@ -3598,18 +3598,18 @@ function useDayPicker() {
3598
3598
  // node_modules/react-day-picker/dist/esm/components/Dropdown.js
3599
3599
  function Dropdown(props) {
3600
3600
  const _a = props, { options, className } = _a, selectProps = __objRest(_a, ["options", "className"]);
3601
- const { classNames, components } = useDayPicker();
3601
+ const { classNames, components, styles } = useDayPicker();
3602
3602
  const cssClassSelect = [classNames[UI.Dropdown], className].join(" ");
3603
3603
  const selectedOption = options == null ? void 0 : options.find(({ value }) => value === selectProps.value);
3604
3604
  return import_react6.default.createElement(
3605
3605
  "span",
3606
- { "data-disabled": selectProps.disabled, className: classNames[UI.DropdownRoot] },
3606
+ { "data-disabled": selectProps.disabled, className: classNames[UI.DropdownRoot], style: styles == null ? void 0 : styles[UI.DropdownRoot] },
3607
3607
  import_react6.default.createElement(components.Select, __spreadValues({ className: cssClassSelect }, selectProps), options == null ? void 0 : options.map(({ value, label, disabled }) => import_react6.default.createElement(components.Option, { key: value, value, disabled }, label))),
3608
3608
  import_react6.default.createElement(
3609
3609
  "span",
3610
- { className: classNames[UI.CaptionLabel], "aria-hidden": true },
3610
+ { className: classNames[UI.CaptionLabel], style: styles == null ? void 0 : styles[UI.CaptionLabel], "aria-hidden": true },
3611
3611
  selectedOption == null ? void 0 : selectedOption.label,
3612
- import_react6.default.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI.Chevron] })
3612
+ import_react6.default.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI.Chevron], style: styles == null ? void 0 : styles[UI.Chevron] })
3613
3613
  )
3614
3614
  );
3615
3615
  }
@@ -3663,7 +3663,7 @@ function MonthsDropdown(props) {
3663
3663
  var import_react14 = __toESM(require("react"), 1);
3664
3664
  function Nav(props) {
3665
3665
  const _a = props, { onPreviousClick, onNextClick, previousMonth, nextMonth } = _a, navProps = __objRest(_a, ["onPreviousClick", "onNextClick", "previousMonth", "nextMonth"]);
3666
- const { components, classNames, labels: { labelPrevious: labelPrevious2, labelNext: labelNext2 } } = useDayPicker();
3666
+ const { components, classNames, styles, labels: { labelPrevious: labelPrevious2, labelNext: labelNext2 } } = useDayPicker();
3667
3667
  const handleNextClick = (0, import_react14.useCallback)((e) => {
3668
3668
  if (nextMonth) {
3669
3669
  onNextClick == null ? void 0 : onNextClick(e);
@@ -3679,13 +3679,13 @@ function Nav(props) {
3679
3679
  __spreadValues({}, navProps),
3680
3680
  import_react14.default.createElement(
3681
3681
  components.PreviousMonthButton,
3682
- { type: "button", className: classNames[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick },
3683
- import_react14.default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], orientation: "left" })
3682
+ { type: "button", className: classNames[UI.PreviousMonthButton], style: styles == null ? void 0 : styles[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick },
3683
+ import_react14.default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles == null ? void 0 : styles[UI.Chevron], orientation: "left" })
3684
3684
  ),
3685
3685
  import_react14.default.createElement(
3686
3686
  components.NextMonthButton,
3687
- { type: "button", className: classNames[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick },
3688
- import_react14.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, orientation: "right", className: classNames[UI.Chevron] })
3687
+ { type: "button", className: classNames[UI.NextMonthButton], style: styles == null ? void 0 : styles[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick },
3688
+ import_react14.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, orientation: "right", className: classNames[UI.Chevron], style: styles == null ? void 0 : styles[UI.Chevron] })
3689
3689
  )
3690
3690
  );
3691
3691
  }
@@ -5372,6 +5372,14 @@ function DayPicker(initialProps) {
5372
5372
  style: __spreadValues(__spreadValues({}, styles == null ? void 0 : styles[UI.Root]), props.style)
5373
5373
  }), [classNames, props.className, props.style, styles]);
5374
5374
  const dataAttributes = getDataAttributes(props);
5375
+ const getDropdownStyle = (dropdown) => {
5376
+ const dropdownStyle = styles == null ? void 0 : styles[UI.Dropdown];
5377
+ const specificDropdownStyle = styles == null ? void 0 : styles[dropdown];
5378
+ if (!dropdownStyle && !specificDropdownStyle) {
5379
+ return void 0;
5380
+ }
5381
+ return __spreadValues(__spreadValues({}, dropdownStyle), specificDropdownStyle);
5382
+ };
5375
5383
  const rootElRef = (0, import_react31.useRef)(null);
5376
5384
  useAnimation(rootElRef, Boolean(props.animate), {
5377
5385
  classNames,
@@ -5420,15 +5428,15 @@ function DayPicker(initialProps) {
5420
5428
  },
5421
5429
  navLayout === "around" && !props.hideNavigation && displayIndex === 0 && import_react31.default.createElement(
5422
5430
  components.PreviousMonthButton,
5423
- { type: "button", className: classNames[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : void 0 },
5424
- import_react31.default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" })
5431
+ { type: "button", className: classNames[UI.PreviousMonthButton], style: styles == null ? void 0 : styles[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : void 0 },
5432
+ import_react31.default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles == null ? void 0 : styles[UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" })
5425
5433
  ),
5426
5434
  import_react31.default.createElement(components.MonthCaption, { "data-animated-caption": props.animate ? "true" : void 0, className: classNames[UI.MonthCaption], style: styles == null ? void 0 : styles[UI.MonthCaption], calendarMonth, displayIndex }, (captionLayout == null ? void 0 : captionLayout.startsWith("dropdown")) ? import_react31.default.createElement(
5427
5435
  components.DropdownNav,
5428
5436
  { className: classNames[UI.Dropdowns], style: styles == null ? void 0 : styles[UI.Dropdowns] },
5429
5437
  (() => {
5430
- const monthControl = captionLayout === "dropdown" || captionLayout === "dropdown-months" ? import_react31.default.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI.MonthsDropdown], "aria-label": labelMonthDropdown2(), disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date, monthOffset), options: getMonthOptions(calendarMonth.date, navStart, navEnd, formatters2, dateLib), style: styles == null ? void 0 : styles[UI.Dropdown], value: dateLib.getMonth(calendarMonth.date) }) : import_react31.default.createElement("span", { key: "month" }, formatMonthDropdown2(calendarMonth.date, dateLib));
5431
- const yearControl = captionLayout === "dropdown" || captionLayout === "dropdown-years" ? import_react31.default.createElement(components.YearsDropdown, { key: "year", className: classNames[UI.YearsDropdown], "aria-label": labelYearDropdown2(dateLib.options), disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date, monthOffset), options: getYearOptions(navStart, navEnd, formatters2, dateLib, Boolean(props.reverseYears)), style: styles == null ? void 0 : styles[UI.Dropdown], value: dateLib.getYear(calendarMonth.date) }) : import_react31.default.createElement("span", { key: "year" }, formatYearDropdown2(calendarMonth.date, dateLib));
5438
+ const monthControl = captionLayout === "dropdown" || captionLayout === "dropdown-months" ? import_react31.default.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI.MonthsDropdown], "aria-label": labelMonthDropdown2(), disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date, monthOffset), options: getMonthOptions(calendarMonth.date, navStart, navEnd, formatters2, dateLib), style: getDropdownStyle(UI.MonthsDropdown), value: dateLib.getMonth(calendarMonth.date) }) : import_react31.default.createElement("span", { key: "month" }, formatMonthDropdown2(calendarMonth.date, dateLib));
5439
+ const yearControl = captionLayout === "dropdown" || captionLayout === "dropdown-years" ? import_react31.default.createElement(components.YearsDropdown, { key: "year", className: classNames[UI.YearsDropdown], "aria-label": labelYearDropdown2(dateLib.options), disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date, monthOffset), options: getYearOptions(navStart, navEnd, formatters2, dateLib, Boolean(props.reverseYears)), style: getDropdownStyle(UI.YearsDropdown), value: dateLib.getYear(calendarMonth.date) }) : import_react31.default.createElement("span", { key: "year" }, formatYearDropdown2(calendarMonth.date, dateLib));
5432
5440
  const controls = dateLib.getMonthYearOrder() === "year-first" ? [yearControl, monthControl] : [monthControl, yearControl];
5433
5441
  return controls;
5434
5442
  })(),
@@ -5444,11 +5452,11 @@ function DayPicker(initialProps) {
5444
5452
  whiteSpace: "nowrap",
5445
5453
  wordWrap: "normal"
5446
5454
  } }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))
5447
- ) : import_react31.default.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))),
5455
+ ) : import_react31.default.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], style: styles == null ? void 0 : styles[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))),
5448
5456
  navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 && import_react31.default.createElement(
5449
5457
  components.NextMonthButton,
5450
- { type: "button", className: classNames[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : void 0 },
5451
- import_react31.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" })
5458
+ { type: "button", className: classNames[UI.NextMonthButton], style: styles == null ? void 0 : styles[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : void 0 },
5459
+ import_react31.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles == null ? void 0 : styles[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" })
5452
5460
  ),
5453
5461
  displayIndex === numberOfMonths - 1 && navLayout === "after" && !props.hideNavigation && import_react31.default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles == null ? void 0 : styles[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }),
5454
5462
  import_react31.default.createElement(
@@ -7704,11 +7712,15 @@ var SelectContent = React46.forwardRef(
7704
7712
  setContentStyle(void 0);
7705
7713
  }
7706
7714
  }, [context.open]);
7715
+ function clampNumber(value, min2, max2) {
7716
+ return Math.min(Math.max(value, min2), max2);
7717
+ }
7707
7718
  const updatePosition = React46.useCallback(() => {
7708
7719
  const trigger = context.triggerRef.current;
7709
7720
  if (!trigger) return;
7710
7721
  const rect = trigger.getBoundingClientRect();
7711
7722
  const viewportPadding = 8;
7723
+ const viewportWidth = window.innerWidth;
7712
7724
  const preferredMaxHeight = 288;
7713
7725
  const minUsefulHeight = 140;
7714
7726
  const availableBelow = window.innerHeight - rect.bottom - viewportPadding - sideOffset;
@@ -7726,25 +7738,47 @@ var SelectContent = React46.forwardRef(
7726
7738
  const baseStyle = {
7727
7739
  position: "fixed",
7728
7740
  zIndex: 9999,
7729
- width: rect.width,
7741
+ width: "max-content",
7730
7742
  minWidth: rect.width,
7731
- maxWidth: "calc(100vw - 16px)",
7732
7743
  maxHeight: contentMaxHeight
7733
7744
  };
7734
7745
  if (align === "start") {
7735
- baseStyle.left = rect.left;
7746
+ const left = clampNumber(
7747
+ rect.left,
7748
+ viewportPadding,
7749
+ Math.max(
7750
+ viewportPadding,
7751
+ viewportWidth - viewportPadding - rect.width
7752
+ )
7753
+ );
7754
+ baseStyle.left = left;
7736
7755
  baseStyle.right = void 0;
7737
7756
  baseStyle.transform = void 0;
7757
+ baseStyle.maxWidth = Math.max(
7758
+ rect.width,
7759
+ viewportWidth - left - viewportPadding
7760
+ );
7738
7761
  }
7739
7762
  if (align === "center") {
7740
- baseStyle.left = rect.left + rect.width / 2;
7763
+ const center = clampNumber(
7764
+ rect.left + rect.width / 2,
7765
+ viewportPadding + rect.width / 2,
7766
+ viewportWidth - viewportPadding - rect.width / 2
7767
+ );
7768
+ baseStyle.left = center;
7741
7769
  baseStyle.right = void 0;
7742
7770
  baseStyle.transform = "translateX(-50%)";
7771
+ baseStyle.maxWidth = viewportWidth - viewportPadding * 2;
7743
7772
  }
7744
7773
  if (align === "end") {
7745
- baseStyle.left = rect.right;
7746
- baseStyle.right = void 0;
7747
- baseStyle.transform = "translateX(-100%)";
7774
+ const right = Math.max(viewportPadding, viewportWidth - rect.right);
7775
+ baseStyle.left = void 0;
7776
+ baseStyle.right = right;
7777
+ baseStyle.transform = void 0;
7778
+ baseStyle.maxWidth = Math.max(
7779
+ rect.width,
7780
+ viewportWidth - right - viewportPadding
7781
+ );
7748
7782
  }
7749
7783
  if (nextSide === "bottom") {
7750
7784
  baseStyle.top = rect.bottom + sideOffset;
@@ -7813,38 +7847,38 @@ var SelectContent = React46.forwardRef(
7813
7847
  cancelAnimationFrame(frame);
7814
7848
  };
7815
7849
  }, [context.activeValue, context.items, context.open]);
7816
- if (!context.open) {
7817
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { hidden: true, "aria-hidden": "true", style: { display: "none" }, children });
7818
- }
7819
- if (!mounted || !contentStyle) return null;
7850
+ if (!mounted) return null;
7851
+ const isVisible = context.open && Boolean(contentStyle);
7820
7852
  return (0, import_react_dom.createPortal)(
7821
7853
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
7822
7854
  "div",
7823
7855
  __spreadProps(__spreadValues({}, props), {
7824
7856
  ref: composeRefs(ref, context.contentRef),
7825
7857
  role: "listbox",
7858
+ "aria-hidden": !isVisible,
7826
7859
  "data-side": side,
7827
7860
  "data-select-content": true,
7828
7861
  className: cn(
7829
- "pointer-events-auto min-w-32 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md",
7862
+ "pointer-events-auto overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-xl",
7830
7863
  className
7831
7864
  ),
7832
- style: __spreadValues(__spreadValues({}, contentStyle), style),
7865
+ style: __spreadProps(__spreadValues(__spreadValues({}, contentStyle != null ? contentStyle : {
7866
+ position: "fixed",
7867
+ zIndex: 9999
7868
+ }), style), {
7869
+ display: isVisible ? void 0 : "none"
7870
+ }),
7833
7871
  children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
7834
7872
  "div",
7835
7873
  {
7836
7874
  ref: scrollRef,
7837
7875
  "data-select-scroll-content": true,
7838
- className: cn(
7839
- "max-h-full overflow-x-hidden overflow-y-auto overscroll-contain px-1 py-1",
7840
- "scrollbar-gutter-stable"
7841
- ),
7876
+ className: "max-h-full overflow-x-hidden overflow-y-auto overscroll-contain px-1 py-1",
7842
7877
  style: {
7843
- maxHeight: contentStyle.maxHeight,
7878
+ maxHeight: contentStyle == null ? void 0 : contentStyle.maxHeight,
7844
7879
  overflowX: "hidden",
7845
7880
  overflowY: "auto",
7846
7881
  overscrollBehavior: "contain",
7847
- scrollbarGutter: "stable",
7848
7882
  WebkitOverflowScrolling: "touch"
7849
7883
  },
7850
7884
  onWheel: (event) => {
@@ -7971,7 +8005,7 @@ var SelectItem = React46.forwardRef(
7971
8005
  "data-highlighted": isActive ? "" : void 0,
7972
8006
  "data-disabled": disabled ? "" : void 0,
7973
8007
  className: cn(
7974
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 outline-none transition-colors",
8008
+ "relative flex w-full min-w-0 cursor-default select-none items-center rounded-lg py-1.5 pl-2 pr-8 text-left outline-none transition-colors",
7975
8009
  sizeClasses.selectItem,
7976
8010
  !disabled && "data-highlighted:bg-accent data-highlighted:text-accent-foreground",
7977
8011
  disabled && "pointer-events-none opacity-50",
@@ -7996,7 +8030,7 @@ var SelectItem = React46.forwardRef(
7996
8030
  }, props), {
7997
8031
  children: [
7998
8032
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: isSelected ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_icons9.CheckIcon, { className: "h-4 w-4" }) : null }),
7999
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate", children })
8033
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "min-w-0 flex-1 truncate whitespace-nowrap", children })
8000
8034
  ]
8001
8035
  })
8002
8036
  );
@@ -8138,13 +8172,23 @@ function SearchableSelectBase({
8138
8172
  96,
8139
8173
  Math.min(preferredMaxHeight, availableHeight)
8140
8174
  );
8175
+ const left = Math.min(
8176
+ Math.max(viewportPadding, rect.left),
8177
+ Math.max(
8178
+ viewportPadding,
8179
+ window.innerWidth - viewportPadding - rect.width
8180
+ )
8181
+ );
8141
8182
  const nextStyle = {
8142
8183
  position: "fixed",
8143
8184
  zIndex: 9999,
8144
- left: Math.max(viewportPadding, rect.left),
8145
- width: rect.width,
8185
+ left,
8186
+ width: "max-content",
8146
8187
  minWidth: rect.width,
8147
- maxWidth: `calc(100vw - ${viewportPadding * 2}px)`,
8188
+ maxWidth: Math.max(
8189
+ rect.width,
8190
+ window.innerWidth - left - viewportPadding
8191
+ ),
8148
8192
  maxHeight: contentMaxHeight
8149
8193
  };
8150
8194
  if (shouldOpenBelow) {
@@ -8269,13 +8313,12 @@ function SearchableSelectBase({
8269
8313
  {
8270
8314
  id: listboxId,
8271
8315
  role: "listbox",
8272
- className: "max-h-full overflow-x-hidden overflow-y-auto overscroll-contain p-1 scrollbar-gutter-stable",
8316
+ className: "max-h-full overflow-x-hidden overflow-y-auto overscroll-contain p-1",
8273
8317
  style: {
8274
8318
  maxHeight: contentStyle.maxHeight,
8275
8319
  overflowX: "hidden",
8276
8320
  overflowY: "auto",
8277
8321
  overscrollBehavior: "contain",
8278
- scrollbarGutter: "stable",
8279
8322
  WebkitOverflowScrolling: "touch"
8280
8323
  },
8281
8324
  onWheel: (event) => {
@@ -8518,7 +8561,6 @@ var FormSelect = ({
8518
8561
  const form = (0, import_react_hook_form5.useFormContext)();
8519
8562
  const controllerControl = control != null ? control : form == null ? void 0 : form.control;
8520
8563
  const sizeClasses = getFormSizeClasses(size, customSize);
8521
- const triggerSizeClass = getFormControlSizeClass(variant, sizeClasses);
8522
8564
  const normalizedOptions = React48.useMemo(() => {
8523
8565
  if (options) return options;
8524
8566
  return (items != null ? items : []).map((item) => {
@@ -8608,7 +8650,7 @@ var FormSelect = ({
8608
8650
  field.onBlur();
8609
8651
  }
8610
8652
  }
8611
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
8653
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
8612
8654
  Select2,
8613
8655
  {
8614
8656
  value: (_b = field.value) != null ? _b : "",
@@ -8617,19 +8659,36 @@ var FormSelect = ({
8617
8659
  if (!nextOpen) field.onBlur();
8618
8660
  },
8619
8661
  disabled,
8620
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
8621
- SelectTrigger,
8622
- {
8623
- className: classNameDefault ? cn(
8624
- formControlBase,
8625
- formInputVariants[variant],
8626
- triggerSizeClass,
8627
- hasError && formControlErrorClass,
8628
- className
8629
- ) : className,
8630
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectValue, { placeholder })
8631
- }
8632
- ) })
8662
+ size,
8663
+ customSize,
8664
+ variant,
8665
+ invalid: hasError,
8666
+ children: [
8667
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectTrigger, { className, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectValue, { placeholder }) }) }),
8668
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
8669
+ SelectContent,
8670
+ {
8671
+ position: "popper",
8672
+ sideOffset: 6,
8673
+ className: cn(
8674
+ "z-50 overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-xl outline-none",
8675
+ contentClassName
8676
+ ),
8677
+ onWheelCapture: (event) => event.stopPropagation(),
8678
+ onTouchMoveCapture: (event) => event.stopPropagation(),
8679
+ children: normalizedOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
8680
+ SelectItem,
8681
+ {
8682
+ value: option.value,
8683
+ disabled: option.disabled,
8684
+ className: cn(sizeClasses.selectItem, itemClassName),
8685
+ children: option.label
8686
+ },
8687
+ option.value
8688
+ ))
8689
+ }
8690
+ )
8691
+ ]
8633
8692
  }
8634
8693
  ),
8635
8694
  fieldError ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
@@ -10381,25 +10440,27 @@ function UiSelect({
10381
10440
  variant = "outline",
10382
10441
  errorMessage,
10383
10442
  htmlFormItemId,
10384
- position
10443
+ position = "popper",
10444
+ contentAlign = "center",
10445
+ contentSideOffset = 6
10385
10446
  }) {
10386
10447
  const generatedId = React72.useId();
10387
10448
  const triggerId = htmlFormItemId != null ? htmlFormItemId : generatedId;
10388
10449
  const messageId = `${triggerId}-message`;
10389
10450
  const hasError = Boolean(errorMessage);
10390
10451
  const sizeClasses = getFormSizeClasses(size, customSize);
10391
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: cn("w-full space-y-0.5", selectClassName), children: [
10452
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: cn("w-full min-w-0 space-y-0.5", selectClassName), children: [
10392
10453
  label ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
10393
10454
  Label3,
10394
10455
  {
10395
10456
  htmlFor: triggerId,
10396
10457
  className: cn(
10397
- "flex items-center gap-0.5 text-sm font-medium -mt-0.75 -pt-1.5",
10458
+ "flex items-center gap-0.5 text-sm font-medium",
10398
10459
  hasError && "text-destructive",
10399
10460
  labelClassName
10400
10461
  ),
10401
10462
  children: [
10402
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: label }),
10463
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "min-w-0 truncate", children: label }),
10403
10464
  requiredLabel ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10404
10465
  import_lucide_react9.Asterisk,
10405
10466
  {
@@ -10431,7 +10492,7 @@ function UiSelect({
10431
10492
  id: triggerId,
10432
10493
  "aria-invalid": hasError || void 0,
10433
10494
  "aria-describedby": errorMessage ? messageId : void 0,
10434
- className,
10495
+ className: cn("min-w-0", className),
10435
10496
  children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SelectValue, { placeholder })
10436
10497
  }
10437
10498
  ),
@@ -10439,7 +10500,8 @@ function UiSelect({
10439
10500
  SelectContent,
10440
10501
  {
10441
10502
  position,
10442
- sideOffset: 6,
10503
+ align: contentAlign,
10504
+ sideOffset: contentSideOffset,
10443
10505
  className: cn(
10444
10506
  "z-50 overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-xl outline-none",
10445
10507
  contentClassName
package/dist/index.d.cts CHANGED
@@ -1024,8 +1024,10 @@ interface UiSelectProps<TData = unknown> {
1024
1024
  errorMessage?: string;
1025
1025
  htmlFormItemId?: string;
1026
1026
  position?: "popper";
1027
+ contentAlign?: "start" | "center" | "end";
1028
+ contentSideOffset?: number;
1027
1029
  }
1028
- declare function UiSelect<TData = unknown>({ label, placeholder, value, defaultValue, onChange, items, children, disabled, requiredLabel, className, selectClassName, labelClassName, contentClassName, itemClassName, messageClassName, requiredLabelClassName, size, customSize, variant, errorMessage, htmlFormItemId, position, }: UiSelectProps<TData>): react_jsx_runtime.JSX.Element;
1030
+ declare function UiSelect<TData = unknown>({ label, placeholder, value, defaultValue, onChange, items, children, disabled, requiredLabel, className, selectClassName, labelClassName, contentClassName, itemClassName, messageClassName, requiredLabelClassName, size, customSize, variant, errorMessage, htmlFormItemId, position, contentAlign, contentSideOffset, }: UiSelectProps<TData>): react_jsx_runtime.JSX.Element;
1029
1031
 
1030
1032
  interface UiCheckboxProps extends CheckboxProps {
1031
1033
  label?: React$1.ReactNode;
package/dist/index.d.ts CHANGED
@@ -1024,8 +1024,10 @@ interface UiSelectProps<TData = unknown> {
1024
1024
  errorMessage?: string;
1025
1025
  htmlFormItemId?: string;
1026
1026
  position?: "popper";
1027
+ contentAlign?: "start" | "center" | "end";
1028
+ contentSideOffset?: number;
1027
1029
  }
1028
- declare function UiSelect<TData = unknown>({ label, placeholder, value, defaultValue, onChange, items, children, disabled, requiredLabel, className, selectClassName, labelClassName, contentClassName, itemClassName, messageClassName, requiredLabelClassName, size, customSize, variant, errorMessage, htmlFormItemId, position, }: UiSelectProps<TData>): react_jsx_runtime.JSX.Element;
1030
+ declare function UiSelect<TData = unknown>({ label, placeholder, value, defaultValue, onChange, items, children, disabled, requiredLabel, className, selectClassName, labelClassName, contentClassName, itemClassName, messageClassName, requiredLabelClassName, size, customSize, variant, errorMessage, htmlFormItemId, position, contentAlign, contentSideOffset, }: UiSelectProps<TData>): react_jsx_runtime.JSX.Element;
1029
1031
 
1030
1032
  interface UiCheckboxProps extends CheckboxProps {
1031
1033
  label?: React$1.ReactNode;
package/dist/index.js CHANGED
@@ -3198,10 +3198,10 @@ function CaptionLabel(props) {
3198
3198
  // node_modules/react-day-picker/dist/esm/components/Chevron.js
3199
3199
  import React9 from "react";
3200
3200
  function Chevron(props) {
3201
- const { size = 24, orientation = "left", className } = props;
3201
+ const { size = 24, orientation = "left", className, style } = props;
3202
3202
  return React9.createElement(
3203
3203
  "svg",
3204
- { className, width: size, height: size, viewBox: "0 0 24 24" },
3204
+ { className, style, width: size, height: size, viewBox: "0 0 24 24" },
3205
3205
  orientation === "up" && React9.createElement("polygon", { points: "6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28" }),
3206
3206
  orientation === "down" && React9.createElement("polygon", { points: "6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72" }),
3207
3207
  orientation === "left" && React9.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" }),
@@ -3301,18 +3301,18 @@ function useDayPicker() {
3301
3301
  // node_modules/react-day-picker/dist/esm/components/Dropdown.js
3302
3302
  function Dropdown(props) {
3303
3303
  const _a = props, { options, className } = _a, selectProps = __objRest(_a, ["options", "className"]);
3304
- const { classNames, components } = useDayPicker();
3304
+ const { classNames, components, styles } = useDayPicker();
3305
3305
  const cssClassSelect = [classNames[UI.Dropdown], className].join(" ");
3306
3306
  const selectedOption = options == null ? void 0 : options.find(({ value }) => value === selectProps.value);
3307
3307
  return React12.createElement(
3308
3308
  "span",
3309
- { "data-disabled": selectProps.disabled, className: classNames[UI.DropdownRoot] },
3309
+ { "data-disabled": selectProps.disabled, className: classNames[UI.DropdownRoot], style: styles == null ? void 0 : styles[UI.DropdownRoot] },
3310
3310
  React12.createElement(components.Select, __spreadValues({ className: cssClassSelect }, selectProps), options == null ? void 0 : options.map(({ value, label, disabled }) => React12.createElement(components.Option, { key: value, value, disabled }, label))),
3311
3311
  React12.createElement(
3312
3312
  "span",
3313
- { className: classNames[UI.CaptionLabel], "aria-hidden": true },
3313
+ { className: classNames[UI.CaptionLabel], style: styles == null ? void 0 : styles[UI.CaptionLabel], "aria-hidden": true },
3314
3314
  selectedOption == null ? void 0 : selectedOption.label,
3315
- React12.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI.Chevron] })
3315
+ React12.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI.Chevron], style: styles == null ? void 0 : styles[UI.Chevron] })
3316
3316
  )
3317
3317
  );
3318
3318
  }
@@ -3366,7 +3366,7 @@ function MonthsDropdown(props) {
3366
3366
  import React20, { useCallback } from "react";
3367
3367
  function Nav(props) {
3368
3368
  const _a = props, { onPreviousClick, onNextClick, previousMonth, nextMonth } = _a, navProps = __objRest(_a, ["onPreviousClick", "onNextClick", "previousMonth", "nextMonth"]);
3369
- const { components, classNames, labels: { labelPrevious: labelPrevious2, labelNext: labelNext2 } } = useDayPicker();
3369
+ const { components, classNames, styles, labels: { labelPrevious: labelPrevious2, labelNext: labelNext2 } } = useDayPicker();
3370
3370
  const handleNextClick = useCallback((e) => {
3371
3371
  if (nextMonth) {
3372
3372
  onNextClick == null ? void 0 : onNextClick(e);
@@ -3382,13 +3382,13 @@ function Nav(props) {
3382
3382
  __spreadValues({}, navProps),
3383
3383
  React20.createElement(
3384
3384
  components.PreviousMonthButton,
3385
- { type: "button", className: classNames[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick },
3386
- React20.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], orientation: "left" })
3385
+ { type: "button", className: classNames[UI.PreviousMonthButton], style: styles == null ? void 0 : styles[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick },
3386
+ React20.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles == null ? void 0 : styles[UI.Chevron], orientation: "left" })
3387
3387
  ),
3388
3388
  React20.createElement(
3389
3389
  components.NextMonthButton,
3390
- { type: "button", className: classNames[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick },
3391
- React20.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, orientation: "right", className: classNames[UI.Chevron] })
3390
+ { type: "button", className: classNames[UI.NextMonthButton], style: styles == null ? void 0 : styles[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick },
3391
+ React20.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, orientation: "right", className: classNames[UI.Chevron], style: styles == null ? void 0 : styles[UI.Chevron] })
3392
3392
  )
3393
3393
  );
3394
3394
  }
@@ -5075,6 +5075,14 @@ function DayPicker(initialProps) {
5075
5075
  style: __spreadValues(__spreadValues({}, styles == null ? void 0 : styles[UI.Root]), props.style)
5076
5076
  }), [classNames, props.className, props.style, styles]);
5077
5077
  const dataAttributes = getDataAttributes(props);
5078
+ const getDropdownStyle = (dropdown) => {
5079
+ const dropdownStyle = styles == null ? void 0 : styles[UI.Dropdown];
5080
+ const specificDropdownStyle = styles == null ? void 0 : styles[dropdown];
5081
+ if (!dropdownStyle && !specificDropdownStyle) {
5082
+ return void 0;
5083
+ }
5084
+ return __spreadValues(__spreadValues({}, dropdownStyle), specificDropdownStyle);
5085
+ };
5078
5086
  const rootElRef = useRef2(null);
5079
5087
  useAnimation(rootElRef, Boolean(props.animate), {
5080
5088
  classNames,
@@ -5123,15 +5131,15 @@ function DayPicker(initialProps) {
5123
5131
  },
5124
5132
  navLayout === "around" && !props.hideNavigation && displayIndex === 0 && React33.createElement(
5125
5133
  components.PreviousMonthButton,
5126
- { type: "button", className: classNames[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : void 0 },
5127
- React33.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" })
5134
+ { type: "button", className: classNames[UI.PreviousMonthButton], style: styles == null ? void 0 : styles[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : void 0 },
5135
+ React33.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles == null ? void 0 : styles[UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" })
5128
5136
  ),
5129
5137
  React33.createElement(components.MonthCaption, { "data-animated-caption": props.animate ? "true" : void 0, className: classNames[UI.MonthCaption], style: styles == null ? void 0 : styles[UI.MonthCaption], calendarMonth, displayIndex }, (captionLayout == null ? void 0 : captionLayout.startsWith("dropdown")) ? React33.createElement(
5130
5138
  components.DropdownNav,
5131
5139
  { className: classNames[UI.Dropdowns], style: styles == null ? void 0 : styles[UI.Dropdowns] },
5132
5140
  (() => {
5133
- const monthControl = captionLayout === "dropdown" || captionLayout === "dropdown-months" ? React33.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI.MonthsDropdown], "aria-label": labelMonthDropdown2(), disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date, monthOffset), options: getMonthOptions(calendarMonth.date, navStart, navEnd, formatters2, dateLib), style: styles == null ? void 0 : styles[UI.Dropdown], value: dateLib.getMonth(calendarMonth.date) }) : React33.createElement("span", { key: "month" }, formatMonthDropdown2(calendarMonth.date, dateLib));
5134
- const yearControl = captionLayout === "dropdown" || captionLayout === "dropdown-years" ? React33.createElement(components.YearsDropdown, { key: "year", className: classNames[UI.YearsDropdown], "aria-label": labelYearDropdown2(dateLib.options), disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date, monthOffset), options: getYearOptions(navStart, navEnd, formatters2, dateLib, Boolean(props.reverseYears)), style: styles == null ? void 0 : styles[UI.Dropdown], value: dateLib.getYear(calendarMonth.date) }) : React33.createElement("span", { key: "year" }, formatYearDropdown2(calendarMonth.date, dateLib));
5141
+ const monthControl = captionLayout === "dropdown" || captionLayout === "dropdown-months" ? React33.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI.MonthsDropdown], "aria-label": labelMonthDropdown2(), disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date, monthOffset), options: getMonthOptions(calendarMonth.date, navStart, navEnd, formatters2, dateLib), style: getDropdownStyle(UI.MonthsDropdown), value: dateLib.getMonth(calendarMonth.date) }) : React33.createElement("span", { key: "month" }, formatMonthDropdown2(calendarMonth.date, dateLib));
5142
+ const yearControl = captionLayout === "dropdown" || captionLayout === "dropdown-years" ? React33.createElement(components.YearsDropdown, { key: "year", className: classNames[UI.YearsDropdown], "aria-label": labelYearDropdown2(dateLib.options), disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date, monthOffset), options: getYearOptions(navStart, navEnd, formatters2, dateLib, Boolean(props.reverseYears)), style: getDropdownStyle(UI.YearsDropdown), value: dateLib.getYear(calendarMonth.date) }) : React33.createElement("span", { key: "year" }, formatYearDropdown2(calendarMonth.date, dateLib));
5135
5143
  const controls = dateLib.getMonthYearOrder() === "year-first" ? [yearControl, monthControl] : [monthControl, yearControl];
5136
5144
  return controls;
5137
5145
  })(),
@@ -5147,11 +5155,11 @@ function DayPicker(initialProps) {
5147
5155
  whiteSpace: "nowrap",
5148
5156
  wordWrap: "normal"
5149
5157
  } }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))
5150
- ) : React33.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))),
5158
+ ) : React33.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], style: styles == null ? void 0 : styles[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))),
5151
5159
  navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 && React33.createElement(
5152
5160
  components.NextMonthButton,
5153
- { type: "button", className: classNames[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : void 0 },
5154
- React33.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" })
5161
+ { type: "button", className: classNames[UI.NextMonthButton], style: styles == null ? void 0 : styles[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : void 0 },
5162
+ React33.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles == null ? void 0 : styles[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" })
5155
5163
  ),
5156
5164
  displayIndex === numberOfMonths - 1 && navLayout === "after" && !props.hideNavigation && React33.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles == null ? void 0 : styles[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }),
5157
5165
  React33.createElement(
@@ -7428,11 +7436,15 @@ var SelectContent = React46.forwardRef(
7428
7436
  setContentStyle(void 0);
7429
7437
  }
7430
7438
  }, [context.open]);
7439
+ function clampNumber(value, min2, max2) {
7440
+ return Math.min(Math.max(value, min2), max2);
7441
+ }
7431
7442
  const updatePosition = React46.useCallback(() => {
7432
7443
  const trigger = context.triggerRef.current;
7433
7444
  if (!trigger) return;
7434
7445
  const rect = trigger.getBoundingClientRect();
7435
7446
  const viewportPadding = 8;
7447
+ const viewportWidth = window.innerWidth;
7436
7448
  const preferredMaxHeight = 288;
7437
7449
  const minUsefulHeight = 140;
7438
7450
  const availableBelow = window.innerHeight - rect.bottom - viewportPadding - sideOffset;
@@ -7450,25 +7462,47 @@ var SelectContent = React46.forwardRef(
7450
7462
  const baseStyle = {
7451
7463
  position: "fixed",
7452
7464
  zIndex: 9999,
7453
- width: rect.width,
7465
+ width: "max-content",
7454
7466
  minWidth: rect.width,
7455
- maxWidth: "calc(100vw - 16px)",
7456
7467
  maxHeight: contentMaxHeight
7457
7468
  };
7458
7469
  if (align === "start") {
7459
- baseStyle.left = rect.left;
7470
+ const left = clampNumber(
7471
+ rect.left,
7472
+ viewportPadding,
7473
+ Math.max(
7474
+ viewportPadding,
7475
+ viewportWidth - viewportPadding - rect.width
7476
+ )
7477
+ );
7478
+ baseStyle.left = left;
7460
7479
  baseStyle.right = void 0;
7461
7480
  baseStyle.transform = void 0;
7481
+ baseStyle.maxWidth = Math.max(
7482
+ rect.width,
7483
+ viewportWidth - left - viewportPadding
7484
+ );
7462
7485
  }
7463
7486
  if (align === "center") {
7464
- baseStyle.left = rect.left + rect.width / 2;
7487
+ const center = clampNumber(
7488
+ rect.left + rect.width / 2,
7489
+ viewportPadding + rect.width / 2,
7490
+ viewportWidth - viewportPadding - rect.width / 2
7491
+ );
7492
+ baseStyle.left = center;
7465
7493
  baseStyle.right = void 0;
7466
7494
  baseStyle.transform = "translateX(-50%)";
7495
+ baseStyle.maxWidth = viewportWidth - viewportPadding * 2;
7467
7496
  }
7468
7497
  if (align === "end") {
7469
- baseStyle.left = rect.right;
7470
- baseStyle.right = void 0;
7471
- baseStyle.transform = "translateX(-100%)";
7498
+ const right = Math.max(viewportPadding, viewportWidth - rect.right);
7499
+ baseStyle.left = void 0;
7500
+ baseStyle.right = right;
7501
+ baseStyle.transform = void 0;
7502
+ baseStyle.maxWidth = Math.max(
7503
+ rect.width,
7504
+ viewportWidth - right - viewportPadding
7505
+ );
7472
7506
  }
7473
7507
  if (nextSide === "bottom") {
7474
7508
  baseStyle.top = rect.bottom + sideOffset;
@@ -7537,38 +7571,38 @@ var SelectContent = React46.forwardRef(
7537
7571
  cancelAnimationFrame(frame);
7538
7572
  };
7539
7573
  }, [context.activeValue, context.items, context.open]);
7540
- if (!context.open) {
7541
- return /* @__PURE__ */ jsx24("div", { hidden: true, "aria-hidden": "true", style: { display: "none" }, children });
7542
- }
7543
- if (!mounted || !contentStyle) return null;
7574
+ if (!mounted) return null;
7575
+ const isVisible = context.open && Boolean(contentStyle);
7544
7576
  return createPortal(
7545
7577
  /* @__PURE__ */ jsx24(
7546
7578
  "div",
7547
7579
  __spreadProps(__spreadValues({}, props), {
7548
7580
  ref: composeRefs(ref, context.contentRef),
7549
7581
  role: "listbox",
7582
+ "aria-hidden": !isVisible,
7550
7583
  "data-side": side,
7551
7584
  "data-select-content": true,
7552
7585
  className: cn(
7553
- "pointer-events-auto min-w-32 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md",
7586
+ "pointer-events-auto overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-xl",
7554
7587
  className
7555
7588
  ),
7556
- style: __spreadValues(__spreadValues({}, contentStyle), style),
7589
+ style: __spreadProps(__spreadValues(__spreadValues({}, contentStyle != null ? contentStyle : {
7590
+ position: "fixed",
7591
+ zIndex: 9999
7592
+ }), style), {
7593
+ display: isVisible ? void 0 : "none"
7594
+ }),
7557
7595
  children: /* @__PURE__ */ jsx24(
7558
7596
  "div",
7559
7597
  {
7560
7598
  ref: scrollRef,
7561
7599
  "data-select-scroll-content": true,
7562
- className: cn(
7563
- "max-h-full overflow-x-hidden overflow-y-auto overscroll-contain px-1 py-1",
7564
- "scrollbar-gutter-stable"
7565
- ),
7600
+ className: "max-h-full overflow-x-hidden overflow-y-auto overscroll-contain px-1 py-1",
7566
7601
  style: {
7567
- maxHeight: contentStyle.maxHeight,
7602
+ maxHeight: contentStyle == null ? void 0 : contentStyle.maxHeight,
7568
7603
  overflowX: "hidden",
7569
7604
  overflowY: "auto",
7570
7605
  overscrollBehavior: "contain",
7571
- scrollbarGutter: "stable",
7572
7606
  WebkitOverflowScrolling: "touch"
7573
7607
  },
7574
7608
  onWheel: (event) => {
@@ -7695,7 +7729,7 @@ var SelectItem = React46.forwardRef(
7695
7729
  "data-highlighted": isActive ? "" : void 0,
7696
7730
  "data-disabled": disabled ? "" : void 0,
7697
7731
  className: cn(
7698
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 outline-none transition-colors",
7732
+ "relative flex w-full min-w-0 cursor-default select-none items-center rounded-lg py-1.5 pl-2 pr-8 text-left outline-none transition-colors",
7699
7733
  sizeClasses.selectItem,
7700
7734
  !disabled && "data-highlighted:bg-accent data-highlighted:text-accent-foreground",
7701
7735
  disabled && "pointer-events-none opacity-50",
@@ -7720,7 +7754,7 @@ var SelectItem = React46.forwardRef(
7720
7754
  }, props), {
7721
7755
  children: [
7722
7756
  /* @__PURE__ */ jsx24("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: isSelected ? /* @__PURE__ */ jsx24(CheckIcon4, { className: "h-4 w-4" }) : null }),
7723
- /* @__PURE__ */ jsx24("span", { className: "truncate", children })
7757
+ /* @__PURE__ */ jsx24("span", { className: "min-w-0 flex-1 truncate whitespace-nowrap", children })
7724
7758
  ]
7725
7759
  })
7726
7760
  );
@@ -7862,13 +7896,23 @@ function SearchableSelectBase({
7862
7896
  96,
7863
7897
  Math.min(preferredMaxHeight, availableHeight)
7864
7898
  );
7899
+ const left = Math.min(
7900
+ Math.max(viewportPadding, rect.left),
7901
+ Math.max(
7902
+ viewportPadding,
7903
+ window.innerWidth - viewportPadding - rect.width
7904
+ )
7905
+ );
7865
7906
  const nextStyle = {
7866
7907
  position: "fixed",
7867
7908
  zIndex: 9999,
7868
- left: Math.max(viewportPadding, rect.left),
7869
- width: rect.width,
7909
+ left,
7910
+ width: "max-content",
7870
7911
  minWidth: rect.width,
7871
- maxWidth: `calc(100vw - ${viewportPadding * 2}px)`,
7912
+ maxWidth: Math.max(
7913
+ rect.width,
7914
+ window.innerWidth - left - viewportPadding
7915
+ ),
7872
7916
  maxHeight: contentMaxHeight
7873
7917
  };
7874
7918
  if (shouldOpenBelow) {
@@ -7993,13 +8037,12 @@ function SearchableSelectBase({
7993
8037
  {
7994
8038
  id: listboxId,
7995
8039
  role: "listbox",
7996
- className: "max-h-full overflow-x-hidden overflow-y-auto overscroll-contain p-1 scrollbar-gutter-stable",
8040
+ className: "max-h-full overflow-x-hidden overflow-y-auto overscroll-contain p-1",
7997
8041
  style: {
7998
8042
  maxHeight: contentStyle.maxHeight,
7999
8043
  overflowX: "hidden",
8000
8044
  overflowY: "auto",
8001
8045
  overscrollBehavior: "contain",
8002
- scrollbarGutter: "stable",
8003
8046
  WebkitOverflowScrolling: "touch"
8004
8047
  },
8005
8048
  onWheel: (event) => {
@@ -8242,7 +8285,6 @@ var FormSelect = ({
8242
8285
  const form = useFormContext4();
8243
8286
  const controllerControl = control != null ? control : form == null ? void 0 : form.control;
8244
8287
  const sizeClasses = getFormSizeClasses(size, customSize);
8245
- const triggerSizeClass = getFormControlSizeClass(variant, sizeClasses);
8246
8288
  const normalizedOptions = React48.useMemo(() => {
8247
8289
  if (options) return options;
8248
8290
  return (items != null ? items : []).map((item) => {
@@ -8332,7 +8374,7 @@ var FormSelect = ({
8332
8374
  field.onBlur();
8333
8375
  }
8334
8376
  }
8335
- ) }) : /* @__PURE__ */ jsx26(
8377
+ ) }) : /* @__PURE__ */ jsxs16(
8336
8378
  Select2,
8337
8379
  {
8338
8380
  value: (_b = field.value) != null ? _b : "",
@@ -8341,19 +8383,36 @@ var FormSelect = ({
8341
8383
  if (!nextOpen) field.onBlur();
8342
8384
  },
8343
8385
  disabled,
8344
- children: /* @__PURE__ */ jsx26(FormControl, { children: /* @__PURE__ */ jsx26(
8345
- SelectTrigger,
8346
- {
8347
- className: classNameDefault ? cn(
8348
- formControlBase,
8349
- formInputVariants[variant],
8350
- triggerSizeClass,
8351
- hasError && formControlErrorClass,
8352
- className
8353
- ) : className,
8354
- children: /* @__PURE__ */ jsx26(SelectValue, { placeholder })
8355
- }
8356
- ) })
8386
+ size,
8387
+ customSize,
8388
+ variant,
8389
+ invalid: hasError,
8390
+ children: [
8391
+ /* @__PURE__ */ jsx26(FormControl, { children: /* @__PURE__ */ jsx26(SelectTrigger, { className, children: /* @__PURE__ */ jsx26(SelectValue, { placeholder }) }) }),
8392
+ /* @__PURE__ */ jsx26(
8393
+ SelectContent,
8394
+ {
8395
+ position: "popper",
8396
+ sideOffset: 6,
8397
+ className: cn(
8398
+ "z-50 overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-xl outline-none",
8399
+ contentClassName
8400
+ ),
8401
+ onWheelCapture: (event) => event.stopPropagation(),
8402
+ onTouchMoveCapture: (event) => event.stopPropagation(),
8403
+ children: normalizedOptions.map((option) => /* @__PURE__ */ jsx26(
8404
+ SelectItem,
8405
+ {
8406
+ value: option.value,
8407
+ disabled: option.disabled,
8408
+ className: cn(sizeClasses.selectItem, itemClassName),
8409
+ children: option.label
8410
+ },
8411
+ option.value
8412
+ ))
8413
+ }
8414
+ )
8415
+ ]
8357
8416
  }
8358
8417
  ),
8359
8418
  fieldError ? /* @__PURE__ */ jsx26(
@@ -10141,25 +10200,27 @@ function UiSelect({
10141
10200
  variant = "outline",
10142
10201
  errorMessage,
10143
10202
  htmlFormItemId,
10144
- position
10203
+ position = "popper",
10204
+ contentAlign = "center",
10205
+ contentSideOffset = 6
10145
10206
  }) {
10146
10207
  const generatedId = React72.useId();
10147
10208
  const triggerId = htmlFormItemId != null ? htmlFormItemId : generatedId;
10148
10209
  const messageId = `${triggerId}-message`;
10149
10210
  const hasError = Boolean(errorMessage);
10150
10211
  const sizeClasses = getFormSizeClasses(size, customSize);
10151
- return /* @__PURE__ */ jsxs27("div", { className: cn("w-full space-y-0.5", selectClassName), children: [
10212
+ return /* @__PURE__ */ jsxs27("div", { className: cn("w-full min-w-0 space-y-0.5", selectClassName), children: [
10152
10213
  label ? /* @__PURE__ */ jsxs27(
10153
10214
  Label3,
10154
10215
  {
10155
10216
  htmlFor: triggerId,
10156
10217
  className: cn(
10157
- "flex items-center gap-0.5 text-sm font-medium -mt-0.75 -pt-1.5",
10218
+ "flex items-center gap-0.5 text-sm font-medium",
10158
10219
  hasError && "text-destructive",
10159
10220
  labelClassName
10160
10221
  ),
10161
10222
  children: [
10162
- /* @__PURE__ */ jsx54("span", { children: label }),
10223
+ /* @__PURE__ */ jsx54("span", { className: "min-w-0 truncate", children: label }),
10163
10224
  requiredLabel ? /* @__PURE__ */ jsx54(
10164
10225
  Asterisk5,
10165
10226
  {
@@ -10191,7 +10252,7 @@ function UiSelect({
10191
10252
  id: triggerId,
10192
10253
  "aria-invalid": hasError || void 0,
10193
10254
  "aria-describedby": errorMessage ? messageId : void 0,
10194
- className,
10255
+ className: cn("min-w-0", className),
10195
10256
  children: /* @__PURE__ */ jsx54(SelectValue, { placeholder })
10196
10257
  }
10197
10258
  ),
@@ -10199,7 +10260,8 @@ function UiSelect({
10199
10260
  SelectContent,
10200
10261
  {
10201
10262
  position,
10202
- sideOffset: 6,
10263
+ align: contentAlign,
10264
+ sideOffset: contentSideOffset,
10203
10265
  className: cn(
10204
10266
  "z-50 overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-xl outline-none",
10205
10267
  contentClassName
package/dist/style.css CHANGED
@@ -468,9 +468,6 @@
468
468
  .my-1 {
469
469
  margin-block: calc(var(--spacing) * 1);
470
470
  }
471
- .-mt-0\.75 {
472
- margin-top: calc(var(--spacing) * -0.75);
473
- }
474
471
  .-mt-4 {
475
472
  margin-top: calc(var(--spacing) * -4);
476
473
  }
@@ -727,6 +724,9 @@
727
724
  .w-\[calc\(100vw-1rem\)\] {
728
725
  width: calc(100vw - 1rem);
729
726
  }
727
+ .w-auto {
728
+ width: auto;
729
+ }
730
730
  .w-full {
731
731
  width: 100%;
732
732
  }
@@ -753,8 +753,11 @@
753
753
  .min-w-0 {
754
754
  min-width: calc(var(--spacing) * 0);
755
755
  }
756
- .min-w-32 {
757
- min-width: calc(var(--spacing) * 32);
756
+ .min-w-5 {
757
+ min-width: calc(var(--spacing) * 5);
758
+ }
759
+ .min-w-14 {
760
+ min-width: calc(var(--spacing) * 14);
758
761
  }
759
762
  .min-w-\[8rem\] {
760
763
  min-width: 8rem;
@@ -854,9 +857,6 @@
854
857
  .resize {
855
858
  resize: both;
856
859
  }
857
- .scrollbar-gutter-stable {
858
- scrollbar-gutter: stable;
859
- }
860
860
  .list-none {
861
861
  list-style-type: none;
862
862
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shadcn-ui-react",
3
- "version": "0.7.13",
3
+ "version": "0.7.15",
4
4
  "private": false,
5
5
  "author": "Bleker <bleker@gliyen.com>",
6
6
  "description": "A collection of components for building beautiful and accessible user interfaces with React and Tailwind CSS.",
@@ -54,13 +54,13 @@
54
54
  "prepack": "npm run build"
55
55
  },
56
56
  "devDependencies": {
57
- "@babel/core": "^7.29.0",
58
- "@babel/preset-env": "^7.29.5",
59
- "@babel/preset-react": "^7.28.5",
60
- "@babel/preset-typescript": "^7.28.5",
57
+ "@babel/core": "^7.29.7",
58
+ "@babel/preset-env": "^7.29.7",
59
+ "@babel/preset-react": "^7.29.7",
60
+ "@babel/preset-typescript": "^7.29.7",
61
61
  "@eslint/config-array": "^0.23.5",
62
62
  "@eslint/object-schema": "^3.0.5",
63
- "@hookform/resolvers": "^5.2.2",
63
+ "@hookform/resolvers": "^5.4.0",
64
64
  "@tailwindcss/postcss": "^4.3.0",
65
65
  "@tailwindcss/vite": "^4.3.0",
66
66
  "@testing-library/dom": "^10.4.1",
@@ -68,22 +68,22 @@
68
68
  "@testing-library/react": "^16.3.2",
69
69
  "@testing-library/user-event": "^14.6.1",
70
70
  "@types/jest": "^30.0.0",
71
- "@types/node": "^25.6.2",
72
- "@types/react": "^19.2.14",
71
+ "@types/node": "^25.9.1",
72
+ "@types/react": "^19.2.15",
73
73
  "@types/react-dom": "^19.2.3",
74
- "@typescript-eslint/eslint-plugin": "^8.59.2",
75
- "@typescript-eslint/parser": "^8.59.2",
74
+ "@typescript-eslint/eslint-plugin": "^8.60.0",
75
+ "@typescript-eslint/parser": "^8.60.0",
76
76
  "autoprefixer": "^10.5.0",
77
77
  "babel-jest": "^30.4.1",
78
78
  "cross-env": "^10.1.0",
79
- "eslint": "^10.3.0",
79
+ "eslint": "^10.4.1",
80
80
  "eslint-plugin-react-hooks": "^7.1.1",
81
81
  "eslint-plugin-react-refresh": "^0.5.2",
82
82
  "identity-obj-proxy": "^3.0.0",
83
83
  "jest": "^30.4.2",
84
84
  "jest-environment-jsdom": "^30.4.1",
85
85
  "react": "^19.2.6",
86
- "react-day-picker": "^10.0.0",
86
+ "react-day-picker": "^10.0.1",
87
87
  "react-dom": "^19.2.6",
88
88
  "react-test-renderer": "^19.2.6",
89
89
  "rimraf": "^6.1.3",
@@ -92,12 +92,12 @@
92
92
  "tsup": "^8.5.1",
93
93
  "typescript": "^6.0.3",
94
94
  "vaul": "^1.1.2",
95
- "vite": "^8.0.11",
96
- "vite-plugin-dts": "^5.0.0",
95
+ "vite": "^8.0.14",
96
+ "vite-plugin-dts": "^5.0.1",
97
97
  "vite-plugin-ts-alias": "^0.1.1",
98
98
  "zod": "^4.4.3",
99
- "@vitejs/plugin-react": "^6.0.1",
100
- "@vitejs/plugin-react-swc": "^4.3.0"
99
+ "@vitejs/plugin-react": "^6.0.2",
100
+ "@vitejs/plugin-react-swc": "^4.3.1"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "react": ">=17.0.0 <21.0.0",
@@ -140,16 +140,16 @@
140
140
  "clsx": "^2.1.1",
141
141
  "cmdk": "^1.1.1",
142
142
  "embla-carousel-react": "^8.6.0",
143
- "framer-motion": "^12.38.0",
143
+ "framer-motion": "^12.40.0",
144
144
  "input-otp": "^1.4.2",
145
- "lucide-react": "^1.14.0",
145
+ "lucide-react": "^1.17.0",
146
146
  "next-themes": "^0.4.6",
147
147
  "react-dropzone": "^15.0.0",
148
148
  "react-helmet-next": "^0.0.2",
149
- "react-hook-form": "^7.75.0",
150
- "react-resizable-panels": "^4.11.0",
149
+ "react-hook-form": "^7.76.1",
150
+ "react-resizable-panels": "^4.11.2",
151
151
  "sonner": "^2.0.7",
152
- "tailwind-merge": "^3.5.0",
152
+ "tailwind-merge": "^3.6.0",
153
153
  "tailwind-variants": "^3.2.2",
154
154
  "use-debounce": "^10.1.1",
155
155
  "vaul": "^1.1.2"