shadcn-ui-react 0.7.10 → 0.7.11

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.js CHANGED
@@ -6594,7 +6594,7 @@ import {
6594
6594
  // src/components/input.tsx
6595
6595
  import * as React45 from "react";
6596
6596
 
6597
- // src/components/Form/utils/form-utils.ts
6597
+ // src/utils/form-utils.ts
6598
6598
  var formInputVariants = {
6599
6599
  outline: "rounded-md border border-input bg-input backdrop-blur-sm shadow-sm hover:border-primary/60 focus:border-primary focus:ring-2 focus:ring-primary/20",
6600
6600
  soft: "rounded-md border border-transparent bg-muted/60 shadow-sm hover:bg-muted focus:bg-input/80 focus:ring-2 focus:ring-primary/20",
@@ -6604,6 +6604,15 @@ var formInputVariants = {
6604
6604
  unstyled: "border-0 shadow-none focus:ring-0",
6605
6605
  link: "h-auto border-0 bg-transparent p-0 text-primary shadow-none underline-offset-4 focus:underline focus:ring-0"
6606
6606
  };
6607
+ var formCompositeVariants = {
6608
+ outline: "rounded-md border border-input bg-input backdrop-blur-sm shadow-sm hover:border-primary/60 focus-within:border-primary focus-within:ring-2 focus-within:ring-primary/20",
6609
+ soft: "rounded-md border border-transparent bg-muted/60 shadow-sm hover:bg-muted focus-within:bg-input/80 focus-within:ring-2 focus-within:ring-primary/20",
6610
+ ghost: "rounded-md border border-transparent bg-transparent hover:bg-muted/50 focus-within:ring-2 focus-within:ring-ring",
6611
+ filled: "rounded-md border border-input bg-muted/70 shadow-inner hover:bg-muted focus-within:bg-input/70 focus-within:ring-2 focus-within:ring-primary/20",
6612
+ flushed: "rounded-none border-0 border-b border-input px-0 shadow-none focus-within:border-b-2 focus-within:border-primary focus-within:ring-0",
6613
+ unstyled: "border-0 shadow-none focus-within:ring-0",
6614
+ link: "h-auto border-0 bg-transparent p-0 text-primary shadow-none underline-offset-4 focus-within:underline focus-within:ring-0"
6615
+ };
6607
6616
  var variants = formInputVariants;
6608
6617
  var formSizeVariants = {
6609
6618
  "2xs": {
@@ -6684,9 +6693,18 @@ var formSizeVariants = {
6684
6693
  message: "text-base"
6685
6694
  }
6686
6695
  };
6696
+ var formControlBase = "relative inline-flex w-full items-center justify-between gap-2 text-foreground outline-none transition data-[placeholder]:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50";
6697
+ var formCompositeControlBase = "relative flex w-full items-center gap-2 text-foreground outline-none transition";
6698
+ var formControlErrorClass = "border-destructive focus:border-destructive focus:ring-destructive/20";
6699
+ var formCompositeControlErrorClass = "border-destructive focus-within:border-destructive focus-within:ring-destructive/20";
6687
6700
  function getFormSizeClasses(size = "md", customSize) {
6688
6701
  return __spreadValues(__spreadValues({}, formSizeVariants[size]), customSize);
6689
6702
  }
6703
+ function getFormControlSizeClass(variant, sizeClasses) {
6704
+ if (variant === "flushed") return sizeClasses.flushedControl;
6705
+ if (variant === "link") return sizeClasses.linkControl;
6706
+ return sizeClasses.control;
6707
+ }
6690
6708
 
6691
6709
  // src/components/input.tsx
6692
6710
  import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
@@ -6898,201 +6916,751 @@ import {
6898
6916
  } from "react-hook-form";
6899
6917
 
6900
6918
  // src/components/select.tsx
6901
- import {
6902
- CaretSortIcon,
6903
- CheckIcon as CheckIcon4,
6904
- ChevronDownIcon as ChevronDownIcon2,
6905
- ChevronUpIcon
6906
- } from "@radix-ui/react-icons";
6907
- import * as SelectPrimitive from "@radix-ui/react-select";
6919
+ import { CaretSortIcon, CheckIcon as CheckIcon4 } from "@radix-ui/react-icons";
6908
6920
  import * as React46 from "react";
6909
- import { Fragment, jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
6910
- var Select2 = SelectPrimitive.Root;
6911
- var SelectGroup = SelectPrimitive.Group;
6912
- var SelectValue = SelectPrimitive.Value;
6913
- var BODY_UNLOCK_ATTR = "data-select-scroll-unlocked";
6914
- var BODY_UNLOCK_STYLE_ID = "radix-select-scroll-unlock-style";
6915
- var useSafeLayoutEffect = typeof window !== "undefined" ? React46.useLayoutEffect : React46.useEffect;
6916
- function SelectBodyScrollUnlock() {
6917
- useSafeLayoutEffect(() => {
6918
- var _a;
6919
- if (typeof document === "undefined") return;
6920
- if (!document.getElementById(BODY_UNLOCK_STYLE_ID)) {
6921
- const style = document.createElement("style");
6922
- style.id = BODY_UNLOCK_STYLE_ID;
6923
- style.textContent = `
6924
- body[${BODY_UNLOCK_ATTR}][data-scroll-locked] {
6925
- overflow: auto !important;
6926
- margin-right: 0 !important;
6927
- padding-right: 0 !important;
6928
- }
6929
- `;
6930
- document.head.appendChild(style);
6931
- }
6932
- const body = document.body;
6933
- const currentCount = Number((_a = body.getAttribute(BODY_UNLOCK_ATTR)) != null ? _a : "0");
6934
- body.setAttribute(BODY_UNLOCK_ATTR, String(currentCount + 1));
6935
- return () => {
6936
- var _a2;
6937
- const nextCount = Number((_a2 = body.getAttribute(BODY_UNLOCK_ATTR)) != null ? _a2 : "1") - 1;
6938
- if (nextCount <= 0) {
6939
- body.removeAttribute(BODY_UNLOCK_ATTR);
6940
- } else {
6941
- body.setAttribute(BODY_UNLOCK_ATTR, String(nextCount));
6921
+ import { createPortal } from "react-dom";
6922
+ import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
6923
+ var SelectContext = React46.createContext(null);
6924
+ function useSelectContext(componentName) {
6925
+ const context = React46.useContext(SelectContext);
6926
+ if (!context) {
6927
+ throw new Error(`${componentName} must be used within <Select />`);
6928
+ }
6929
+ return context;
6930
+ }
6931
+ function useControllableState({
6932
+ value,
6933
+ defaultValue,
6934
+ onChange
6935
+ }) {
6936
+ const [internalValue, setInternalValue] = React46.useState(defaultValue);
6937
+ const isControlled = value !== void 0;
6938
+ const currentValue = isControlled ? value : internalValue;
6939
+ const setValue = React46.useCallback(
6940
+ (nextValue) => {
6941
+ if (!isControlled) {
6942
+ setInternalValue(nextValue);
6942
6943
  }
6943
- };
6944
- }, []);
6945
- return null;
6944
+ onChange == null ? void 0 : onChange(nextValue);
6945
+ },
6946
+ [isControlled, onChange]
6947
+ );
6948
+ return [currentValue, setValue];
6946
6949
  }
6947
- var SelectTrigger = React46.forwardRef((_a, ref) => {
6948
- var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
6949
- return /* @__PURE__ */ jsxs14(
6950
- SelectPrimitive.Trigger,
6951
- __spreadProps(__spreadValues({
6952
- ref,
6953
- className: cn(
6954
- "flex h-9 w-full items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background transition-colors placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
6955
- className
6956
- )
6957
- }, props), {
6958
- children: [
6959
- children,
6960
- /* @__PURE__ */ jsx24(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx24(CaretSortIcon, { className: "h-4 w-4 shrink-0 opacity-50" }) })
6961
- ]
6962
- })
6950
+ function composeRefs(...refs) {
6951
+ return (node) => {
6952
+ refs.forEach((ref) => {
6953
+ if (!ref) return;
6954
+ if (typeof ref === "function") {
6955
+ ref(node);
6956
+ return;
6957
+ }
6958
+ ref.current = node;
6959
+ });
6960
+ };
6961
+ }
6962
+ function getNodeText(node) {
6963
+ if (node === null || node === void 0 || typeof node === "boolean") {
6964
+ return "";
6965
+ }
6966
+ if (typeof node === "string" || typeof node === "number") {
6967
+ return String(node);
6968
+ }
6969
+ if (Array.isArray(node)) {
6970
+ return node.map(getNodeText).join("");
6971
+ }
6972
+ if (React46.isValidElement(node)) {
6973
+ return getNodeText(node.props.children);
6974
+ }
6975
+ return "";
6976
+ }
6977
+ function getEnabledItems(items) {
6978
+ return items.filter((item) => !item.disabled);
6979
+ }
6980
+ function getNextItemValue(items, currentValue, direction) {
6981
+ var _a, _b, _c;
6982
+ const enabledItems = getEnabledItems(items);
6983
+ if (!enabledItems.length) return void 0;
6984
+ const currentIndex = enabledItems.findIndex(
6985
+ (item) => item.value === currentValue
6963
6986
  );
6964
- });
6965
- SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
6966
- var SelectScrollUpButton = React46.forwardRef((_a, ref) => {
6967
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
6968
- return /* @__PURE__ */ jsx24(
6969
- SelectPrimitive.ScrollUpButton,
6970
- __spreadProps(__spreadValues({
6971
- ref,
6972
- className: cn(
6973
- "flex cursor-default items-center justify-center py-1",
6974
- className
6975
- )
6976
- }, props), {
6977
- children: /* @__PURE__ */ jsx24(ChevronUpIcon, { className: "h-4 w-4" })
6978
- })
6987
+ if (currentIndex === -1) {
6988
+ return direction === "next" ? (_a = enabledItems[0]) == null ? void 0 : _a.value : (_b = enabledItems[enabledItems.length - 1]) == null ? void 0 : _b.value;
6989
+ }
6990
+ const nextIndex = direction === "next" ? (currentIndex + 1) % enabledItems.length : (currentIndex - 1 + enabledItems.length) % enabledItems.length;
6991
+ return (_c = enabledItems[nextIndex]) == null ? void 0 : _c.value;
6992
+ }
6993
+ function Select2({
6994
+ value,
6995
+ defaultValue = "",
6996
+ onValueChange,
6997
+ open,
6998
+ defaultOpen = false,
6999
+ onOpenChange,
7000
+ disabled = false,
7001
+ name,
7002
+ required,
7003
+ variant = "outline",
7004
+ size = "sm",
7005
+ customSize,
7006
+ invalid = false,
7007
+ children
7008
+ }) {
7009
+ const triggerRef = React46.useRef(null);
7010
+ const contentRef = React46.useRef(null);
7011
+ const [currentValue, setCurrentValue] = useControllableState({
7012
+ value,
7013
+ defaultValue,
7014
+ onChange: onValueChange
7015
+ });
7016
+ const [isOpen, setIsOpen] = useControllableState({
7017
+ value: open,
7018
+ defaultValue: defaultOpen,
7019
+ onChange: onOpenChange
7020
+ });
7021
+ const itemsRef = React46.useRef(/* @__PURE__ */ new Map());
7022
+ const [itemsVersion, forceItemsUpdate] = React46.useReducer(
7023
+ (version) => version + 1,
7024
+ 0
7025
+ );
7026
+ const [activeValue, setActiveValue] = React46.useState();
7027
+ const items = React46.useMemo(
7028
+ () => Array.from(itemsRef.current.values()),
7029
+ [itemsVersion]
7030
+ );
7031
+ const selectedItem = items.find((item) => item.value === currentValue);
7032
+ const registerItem = React46.useCallback((item) => {
7033
+ itemsRef.current.set(item.value, item);
7034
+ forceItemsUpdate();
7035
+ }, []);
7036
+ const unregisterItem = React46.useCallback((value2, id) => {
7037
+ const currentItem = itemsRef.current.get(value2);
7038
+ if (!currentItem || currentItem.id !== id) return;
7039
+ itemsRef.current.set(value2, __spreadProps(__spreadValues({}, currentItem), {
7040
+ ref: null
7041
+ }));
7042
+ forceItemsUpdate();
7043
+ }, []);
7044
+ const updateItemRef = React46.useCallback(
7045
+ (value2, id, node) => {
7046
+ const currentItem = itemsRef.current.get(value2);
7047
+ if (!currentItem || currentItem.id !== id) return;
7048
+ if (currentItem.ref === node) return;
7049
+ itemsRef.current.set(value2, __spreadProps(__spreadValues({}, currentItem), {
7050
+ ref: node
7051
+ }));
7052
+ forceItemsUpdate();
7053
+ },
7054
+ []
6979
7055
  );
6980
- });
6981
- SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
6982
- var SelectScrollDownButton = React46.forwardRef((_a, ref) => {
6983
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
6984
- return /* @__PURE__ */ jsx24(
6985
- SelectPrimitive.ScrollDownButton,
6986
- __spreadProps(__spreadValues({
6987
- ref,
6988
- className: cn(
6989
- "flex cursor-default items-center justify-center py-1",
6990
- className
6991
- )
6992
- }, props), {
6993
- children: /* @__PURE__ */ jsx24(ChevronDownIcon2, { className: "h-4 w-4" })
6994
- })
7056
+ const handleOpenChange = React46.useCallback(
7057
+ (nextOpen) => {
7058
+ if (disabled) return;
7059
+ setIsOpen(nextOpen);
7060
+ },
7061
+ [disabled, setIsOpen]
6995
7062
  );
6996
- });
6997
- SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
7063
+ const handleValueChange = React46.useCallback(
7064
+ (nextValue) => {
7065
+ if (disabled) return;
7066
+ setCurrentValue(nextValue);
7067
+ setIsOpen(false);
7068
+ requestAnimationFrame(() => {
7069
+ var _a;
7070
+ (_a = triggerRef.current) == null ? void 0 : _a.focus();
7071
+ });
7072
+ },
7073
+ [disabled, setCurrentValue, setIsOpen]
7074
+ );
7075
+ React46.useEffect(() => {
7076
+ var _a;
7077
+ if (!isOpen) return;
7078
+ const selectedEnabledItem = items.find(
7079
+ (item) => item.value === currentValue && !item.disabled
7080
+ );
7081
+ const firstEnabledItem = getEnabledItems(items)[0];
7082
+ setActiveValue((_a = selectedEnabledItem == null ? void 0 : selectedEnabledItem.value) != null ? _a : firstEnabledItem == null ? void 0 : firstEnabledItem.value);
7083
+ }, [currentValue, isOpen, items]);
7084
+ React46.useEffect(() => {
7085
+ if (!isOpen) return;
7086
+ const handlePointerDown = (event) => {
7087
+ var _a, _b;
7088
+ const target = event.target;
7089
+ if (((_a = triggerRef.current) == null ? void 0 : _a.contains(target)) || ((_b = contentRef.current) == null ? void 0 : _b.contains(target))) {
7090
+ return;
7091
+ }
7092
+ setIsOpen(false);
7093
+ };
7094
+ document.addEventListener("pointerdown", handlePointerDown);
7095
+ return () => {
7096
+ document.removeEventListener("pointerdown", handlePointerDown);
7097
+ };
7098
+ }, [isOpen, setIsOpen]);
7099
+ const contextValue = React46.useMemo(
7100
+ () => ({
7101
+ value: currentValue,
7102
+ open: isOpen,
7103
+ disabled,
7104
+ invalid,
7105
+ variant,
7106
+ size,
7107
+ customSize,
7108
+ selectedItem,
7109
+ activeValue,
7110
+ items,
7111
+ triggerRef,
7112
+ contentRef,
7113
+ setOpen: handleOpenChange,
7114
+ setValue: handleValueChange,
7115
+ setActiveValue,
7116
+ registerItem,
7117
+ unregisterItem,
7118
+ updateItemRef
7119
+ }),
7120
+ [
7121
+ currentValue,
7122
+ isOpen,
7123
+ disabled,
7124
+ invalid,
7125
+ variant,
7126
+ size,
7127
+ customSize,
7128
+ selectedItem,
7129
+ activeValue,
7130
+ items,
7131
+ handleOpenChange,
7132
+ handleValueChange,
7133
+ registerItem,
7134
+ unregisterItem,
7135
+ updateItemRef
7136
+ ]
7137
+ );
7138
+ return /* @__PURE__ */ jsxs14(SelectContext.Provider, { value: contextValue, children: [
7139
+ children,
7140
+ name ? /* @__PURE__ */ jsx24(
7141
+ "input",
7142
+ {
7143
+ type: "hidden",
7144
+ name,
7145
+ value: currentValue,
7146
+ required
7147
+ }
7148
+ ) : null
7149
+ ] });
7150
+ }
7151
+ var SelectTrigger = React46.forwardRef(
7152
+ (_a, ref) => {
7153
+ var _b = _a, {
7154
+ className,
7155
+ children,
7156
+ variant,
7157
+ size,
7158
+ customSize,
7159
+ invalid,
7160
+ disabled,
7161
+ onClick,
7162
+ onKeyDown
7163
+ } = _b, props = __objRest(_b, [
7164
+ "className",
7165
+ "children",
7166
+ "variant",
7167
+ "size",
7168
+ "customSize",
7169
+ "invalid",
7170
+ "disabled",
7171
+ "onClick",
7172
+ "onKeyDown"
7173
+ ]);
7174
+ const context = useSelectContext("SelectTrigger");
7175
+ const resolvedVariant = variant != null ? variant : context.variant;
7176
+ const resolvedSize = size != null ? size : context.size;
7177
+ const resolvedCustomSize = customSize != null ? customSize : context.customSize;
7178
+ const resolvedInvalid = invalid != null ? invalid : context.invalid;
7179
+ const resolvedDisabled = disabled != null ? disabled : context.disabled;
7180
+ const sizeClasses = getFormSizeClasses(resolvedSize, resolvedCustomSize);
7181
+ const controlSizeClass = getFormControlSizeClass(
7182
+ resolvedVariant,
7183
+ sizeClasses
7184
+ );
7185
+ const typeaheadRef = React46.useRef("");
7186
+ const typeaheadTimeoutRef = React46.useRef(null);
7187
+ const moveActiveItem = React46.useCallback(
7188
+ (direction) => {
7189
+ var _a2;
7190
+ const nextValue = getNextItemValue(
7191
+ context.items,
7192
+ (_a2 = context.activeValue) != null ? _a2 : context.value,
7193
+ direction
7194
+ );
7195
+ if (nextValue) {
7196
+ context.setActiveValue(nextValue);
7197
+ }
7198
+ },
7199
+ [context]
7200
+ );
7201
+ const handleTypeahead = React46.useCallback(
7202
+ (key) => {
7203
+ typeaheadRef.current += key.toLowerCase();
7204
+ if (typeaheadTimeoutRef.current) {
7205
+ window.clearTimeout(typeaheadTimeoutRef.current);
7206
+ }
7207
+ typeaheadTimeoutRef.current = window.setTimeout(() => {
7208
+ typeaheadRef.current = "";
7209
+ }, 500);
7210
+ const enabledItems = getEnabledItems(context.items);
7211
+ const match2 = enabledItems.find(
7212
+ (item) => item.textValue.toLowerCase().startsWith(typeaheadRef.current)
7213
+ );
7214
+ if (!match2) return;
7215
+ if (!context.open) {
7216
+ context.setOpen(true);
7217
+ }
7218
+ context.setActiveValue(match2.value);
7219
+ },
7220
+ [context]
7221
+ );
7222
+ React46.useEffect(() => {
7223
+ return () => {
7224
+ if (typeaheadTimeoutRef.current) {
7225
+ window.clearTimeout(typeaheadTimeoutRef.current);
7226
+ }
7227
+ };
7228
+ }, []);
7229
+ const handleKeyDown = (event) => {
7230
+ onKeyDown == null ? void 0 : onKeyDown(event);
7231
+ if (event.defaultPrevented || resolvedDisabled) return;
7232
+ if (event.key === "ArrowDown") {
7233
+ event.preventDefault();
7234
+ if (!context.open) {
7235
+ context.setOpen(true);
7236
+ return;
7237
+ }
7238
+ moveActiveItem("next");
7239
+ return;
7240
+ }
7241
+ if (event.key === "ArrowUp") {
7242
+ event.preventDefault();
7243
+ if (!context.open) {
7244
+ context.setOpen(true);
7245
+ return;
7246
+ }
7247
+ moveActiveItem("previous");
7248
+ return;
7249
+ }
7250
+ if (event.key === "Enter" || event.key === " ") {
7251
+ event.preventDefault();
7252
+ if (!context.open) {
7253
+ context.setOpen(true);
7254
+ return;
7255
+ }
7256
+ if (context.activeValue) {
7257
+ context.setValue(context.activeValue);
7258
+ }
7259
+ return;
7260
+ }
7261
+ if (event.key === "Escape") {
7262
+ event.preventDefault();
7263
+ context.setOpen(false);
7264
+ return;
7265
+ }
7266
+ if (event.key === "Home") {
7267
+ event.preventDefault();
7268
+ const firstEnabledItem = getEnabledItems(context.items)[0];
7269
+ if (firstEnabledItem) {
7270
+ context.setActiveValue(firstEnabledItem.value);
7271
+ }
7272
+ return;
7273
+ }
7274
+ if (event.key === "End") {
7275
+ event.preventDefault();
7276
+ const enabledItems = getEnabledItems(context.items);
7277
+ const lastEnabledItem = enabledItems[enabledItems.length - 1];
7278
+ if (lastEnabledItem) {
7279
+ context.setActiveValue(lastEnabledItem.value);
7280
+ }
7281
+ return;
7282
+ }
7283
+ if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
7284
+ handleTypeahead(event.key);
7285
+ }
7286
+ };
7287
+ return /* @__PURE__ */ jsxs14(
7288
+ "button",
7289
+ __spreadProps(__spreadValues({
7290
+ ref: composeRefs(ref, context.triggerRef),
7291
+ type: "button",
7292
+ "aria-haspopup": "listbox",
7293
+ "aria-expanded": context.open,
7294
+ "data-placeholder": !context.value ? "" : void 0,
7295
+ disabled: resolvedDisabled,
7296
+ className: cn(
7297
+ formControlBase,
7298
+ "whitespace-nowrap ring-offset-background [&>span]:line-clamp-1",
7299
+ formInputVariants[resolvedVariant],
7300
+ controlSizeClass,
7301
+ resolvedInvalid && formControlErrorClass,
7302
+ className
7303
+ ),
7304
+ onClick: (event) => {
7305
+ onClick == null ? void 0 : onClick(event);
7306
+ if (!event.defaultPrevented && !resolvedDisabled) {
7307
+ context.setOpen(!context.open);
7308
+ }
7309
+ },
7310
+ onKeyDown: handleKeyDown
7311
+ }, props), {
7312
+ children: [
7313
+ children,
7314
+ /* @__PURE__ */ jsx24(CaretSortIcon, { className: "h-4 w-4 shrink-0 opacity-50" })
7315
+ ]
7316
+ })
7317
+ );
7318
+ }
7319
+ );
7320
+ SelectTrigger.displayName = "SelectTrigger";
7321
+ var SelectValue = React46.forwardRef(
7322
+ (_a, ref) => {
7323
+ var _b = _a, { className, placeholder, children } = _b, props = __objRest(_b, ["className", "placeholder", "children"]);
7324
+ var _a2, _b2;
7325
+ const context = useSelectContext("SelectValue");
7326
+ return /* @__PURE__ */ jsx24("span", __spreadProps(__spreadValues({ ref, className: cn("truncate", className) }, props), { children: (_b2 = children != null ? children : (_a2 = context.selectedItem) == null ? void 0 : _a2.label) != null ? _b2 : placeholder }));
7327
+ }
7328
+ );
7329
+ SelectValue.displayName = "SelectValue";
6998
7330
  var SelectContent = React46.forwardRef(
6999
7331
  (_a, ref) => {
7000
7332
  var _b = _a, {
7001
7333
  className,
7002
7334
  children,
7003
- position = "popper",
7004
7335
  sideOffset = 4,
7005
- align = "start"
7336
+ align = "start",
7337
+ position: _position,
7338
+ style
7006
7339
  } = _b, props = __objRest(_b, [
7007
7340
  "className",
7008
7341
  "children",
7009
- "position",
7010
7342
  "sideOffset",
7011
- "align"
7343
+ "align",
7344
+ "position",
7345
+ "style"
7012
7346
  ]);
7013
- return /* @__PURE__ */ jsxs14(Fragment, { children: [
7014
- /* @__PURE__ */ jsx24(SelectBodyScrollUnlock, {}),
7015
- /* @__PURE__ */ jsx24(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs14(
7016
- SelectPrimitive.Content,
7017
- __spreadProps(__spreadValues({
7018
- ref,
7019
- position,
7020
- sideOffset,
7021
- align,
7347
+ const context = useSelectContext("SelectContent");
7348
+ const scrollRef = React46.useRef(null);
7349
+ const rafRef = React46.useRef(null);
7350
+ const [mounted, setMounted] = React46.useState(false);
7351
+ const [side, setSide] = React46.useState("bottom");
7352
+ const [contentStyle, setContentStyle] = React46.useState();
7353
+ React46.useEffect(() => {
7354
+ setMounted(true);
7355
+ }, []);
7356
+ const updatePosition = React46.useCallback(() => {
7357
+ const trigger = context.triggerRef.current;
7358
+ if (!trigger) return;
7359
+ const rect = trigger.getBoundingClientRect();
7360
+ const viewportPadding = 8;
7361
+ const preferredMaxHeight = 260;
7362
+ const minUsefulHeight = 140;
7363
+ const availableBelow = window.innerHeight - rect.bottom - viewportPadding - sideOffset;
7364
+ const availableAbove = rect.top - viewportPadding - sideOffset;
7365
+ const nextSide = availableBelow >= Math.min(preferredMaxHeight, minUsefulHeight) || availableBelow >= availableAbove ? "bottom" : "top";
7366
+ const availableHeight = nextSide === "bottom" ? availableBelow : availableAbove;
7367
+ const contentMaxHeight = Math.max(
7368
+ 80,
7369
+ Math.min(preferredMaxHeight, availableHeight)
7370
+ );
7371
+ const baseStyle = {
7372
+ position: "fixed",
7373
+ zIndex: 9999,
7374
+ width: rect.width,
7375
+ minWidth: rect.width,
7376
+ maxWidth: "calc(100vw - 16px)",
7377
+ maxHeight: contentMaxHeight
7378
+ };
7379
+ if (align === "start") {
7380
+ baseStyle.left = rect.left;
7381
+ baseStyle.transform = void 0;
7382
+ }
7383
+ if (align === "center") {
7384
+ baseStyle.left = rect.left + rect.width / 2;
7385
+ baseStyle.transform = "translateX(-50%)";
7386
+ }
7387
+ if (align === "end") {
7388
+ baseStyle.left = rect.right;
7389
+ baseStyle.transform = "translateX(-100%)";
7390
+ }
7391
+ if (nextSide === "bottom") {
7392
+ baseStyle.top = rect.bottom + sideOffset;
7393
+ baseStyle.bottom = void 0;
7394
+ } else {
7395
+ baseStyle.bottom = window.innerHeight - rect.top + sideOffset;
7396
+ baseStyle.top = void 0;
7397
+ }
7398
+ setSide(nextSide);
7399
+ setContentStyle(baseStyle);
7400
+ }, [align, context.triggerRef, sideOffset]);
7401
+ const scheduleUpdatePosition = React46.useCallback(() => {
7402
+ if (rafRef.current) {
7403
+ cancelAnimationFrame(rafRef.current);
7404
+ }
7405
+ rafRef.current = requestAnimationFrame(() => {
7406
+ updatePosition();
7407
+ });
7408
+ }, [updatePosition]);
7409
+ React46.useLayoutEffect(() => {
7410
+ var _a2, _b2;
7411
+ if (!context.open) return;
7412
+ updatePosition();
7413
+ scheduleUpdatePosition();
7414
+ const handleResize = () => {
7415
+ scheduleUpdatePosition();
7416
+ };
7417
+ const handlePageScroll = (event) => {
7418
+ var _a3;
7419
+ const target = event.target;
7420
+ if (target && ((_a3 = scrollRef.current) == null ? void 0 : _a3.contains(target))) {
7421
+ return;
7422
+ }
7423
+ scheduleUpdatePosition();
7424
+ };
7425
+ window.addEventListener("resize", handleResize);
7426
+ window.addEventListener("scroll", handlePageScroll, true);
7427
+ (_a2 = window.visualViewport) == null ? void 0 : _a2.addEventListener("resize", handleResize);
7428
+ (_b2 = window.visualViewport) == null ? void 0 : _b2.addEventListener("scroll", handleResize);
7429
+ return () => {
7430
+ var _a3, _b3;
7431
+ window.removeEventListener("resize", handleResize);
7432
+ window.removeEventListener("scroll", handlePageScroll, true);
7433
+ (_a3 = window.visualViewport) == null ? void 0 : _a3.removeEventListener("resize", handleResize);
7434
+ (_b3 = window.visualViewport) == null ? void 0 : _b3.removeEventListener("scroll", handleResize);
7435
+ if (rafRef.current) {
7436
+ cancelAnimationFrame(rafRef.current);
7437
+ rafRef.current = null;
7438
+ }
7439
+ };
7440
+ }, [context.open, scheduleUpdatePosition, updatePosition]);
7441
+ React46.useLayoutEffect(() => {
7442
+ if (!context.open) return;
7443
+ const frame = requestAnimationFrame(() => {
7444
+ var _a2;
7445
+ const activeItem = context.items.find(
7446
+ (item) => item.value === context.activeValue
7447
+ );
7448
+ (_a2 = activeItem == null ? void 0 : activeItem.ref) == null ? void 0 : _a2.scrollIntoView({
7449
+ block: "nearest"
7450
+ });
7451
+ });
7452
+ return () => {
7453
+ cancelAnimationFrame(frame);
7454
+ };
7455
+ }, [context.activeValue, context.items, context.open]);
7456
+ if (!context.open) {
7457
+ return /* @__PURE__ */ jsx24("div", { hidden: true, "aria-hidden": "true", style: { display: "none" }, children });
7458
+ }
7459
+ if (!mounted || !contentStyle) return null;
7460
+ return createPortal(
7461
+ /* @__PURE__ */ jsx24(
7462
+ "div",
7463
+ __spreadProps(__spreadValues({}, props), {
7464
+ ref: composeRefs(ref, context.contentRef),
7465
+ role: "listbox",
7466
+ "data-side": side,
7022
7467
  className: cn(
7023
- "relative z-50 min-w-32 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md",
7024
- "data-[state=open]:animate-in data-[state=closed]:animate-out",
7025
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
7026
- "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
7027
- "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
7028
- "data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
7029
- position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
7468
+ "min-w-32 rounded-md border border-border bg-popover text-popover-foreground shadow-md",
7469
+ "overflow-hidden",
7030
7470
  className
7471
+ ),
7472
+ style: __spreadValues(__spreadValues({}, contentStyle), style),
7473
+ children: /* @__PURE__ */ jsx24(
7474
+ "div",
7475
+ {
7476
+ ref: scrollRef,
7477
+ "data-select-scroll-content": true,
7478
+ className: cn(
7479
+ "max-h-full px-1 py-1",
7480
+ "!overflow-x-hidden !overflow-y-scroll overscroll-contain",
7481
+ "[scrollbar-gutter:stable]",
7482
+ "[scrollbar-width:thin]",
7483
+ "[&::-webkit-scrollbar]:!block",
7484
+ "[&::-webkit-scrollbar]:!w-2",
7485
+ "[&::-webkit-scrollbar-track]:!bg-transparent",
7486
+ "[&::-webkit-scrollbar-thumb]:!rounded-full",
7487
+ "[&::-webkit-scrollbar-thumb]:!bg-border"
7488
+ ),
7489
+ style: {
7490
+ maxHeight: contentStyle.maxHeight,
7491
+ overflowX: "hidden",
7492
+ overflowY: "scroll",
7493
+ overscrollBehavior: "contain",
7494
+ scrollbarGutter: "stable",
7495
+ WebkitOverflowScrolling: "touch"
7496
+ },
7497
+ onWheel: (event) => {
7498
+ event.stopPropagation();
7499
+ },
7500
+ children
7501
+ }
7031
7502
  )
7032
- }, props), {
7033
- children: [
7034
- /* @__PURE__ */ jsx24(SelectScrollUpButton, {}),
7035
- /* @__PURE__ */ jsx24(
7036
- SelectPrimitive.Viewport,
7037
- {
7038
- className: cn(
7039
- "max-h-[min(20rem,var(--radix-select-content-available-height))] overflow-y-auto p-1",
7040
- position === "popper" && "w-full min-w-(--radix-select-trigger-width)"
7041
- ),
7042
- children
7043
- }
7044
- ),
7045
- /* @__PURE__ */ jsx24(SelectScrollDownButton, {})
7046
- ]
7047
7503
  })
7048
- ) })
7049
- ] });
7504
+ ),
7505
+ document.body
7506
+ );
7050
7507
  }
7051
7508
  );
7052
- SelectContent.displayName = SelectPrimitive.Content.displayName;
7053
- var SelectLabel = React46.forwardRef((_a, ref) => {
7054
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
7055
- return /* @__PURE__ */ jsx24(
7056
- SelectPrimitive.Label,
7057
- __spreadValues({
7058
- ref,
7059
- className: cn("px-2 py-1.5 text-sm font-semibold", className)
7060
- }, props)
7061
- );
7062
- });
7063
- SelectLabel.displayName = SelectPrimitive.Label.displayName;
7064
- var SelectItem = React46.forwardRef((_a, ref) => {
7065
- var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
7066
- return /* @__PURE__ */ jsxs14(
7067
- SelectPrimitive.Item,
7068
- __spreadProps(__spreadValues({
7069
- ref,
7070
- className: cn(
7071
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none transition-colors",
7072
- "focus:bg-accent focus:text-accent-foreground",
7073
- "data-disabled:pointer-events-none data-disabled:opacity-50",
7074
- className
7075
- )
7076
- }, props), {
7077
- children: [
7078
- /* @__PURE__ */ jsx24("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx24(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx24(CheckIcon4, { className: "h-4 w-4" }) }) }),
7079
- /* @__PURE__ */ jsx24(SelectPrimitive.ItemText, { children })
7080
- ]
7081
- })
7082
- );
7083
- });
7084
- SelectItem.displayName = SelectPrimitive.Item.displayName;
7085
- var SelectSeparator = React46.forwardRef((_a, ref) => {
7086
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
7087
- return /* @__PURE__ */ jsx24(
7088
- SelectPrimitive.Separator,
7089
- __spreadValues({
7090
- ref,
7091
- className: cn("-mx-1 my-1 h-px bg-muted", className)
7092
- }, props)
7093
- );
7094
- });
7095
- SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
7509
+ SelectContent.displayName = "SelectContent";
7510
+ var SelectGroup = React46.forwardRef(
7511
+ (_a, ref) => {
7512
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
7513
+ return /* @__PURE__ */ jsx24("div", __spreadValues({ ref, role: "group", className }, props));
7514
+ }
7515
+ );
7516
+ SelectGroup.displayName = "SelectGroup";
7517
+ var SelectLabel = React46.forwardRef(
7518
+ (_a, ref) => {
7519
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
7520
+ return /* @__PURE__ */ jsx24(
7521
+ "div",
7522
+ __spreadValues({
7523
+ ref,
7524
+ className: cn("px-2 py-1.5 text-sm font-semibold", className)
7525
+ }, props)
7526
+ );
7527
+ }
7528
+ );
7529
+ SelectLabel.displayName = "SelectLabel";
7530
+ var SelectItem = React46.forwardRef(
7531
+ (_a, ref) => {
7532
+ var _b = _a, {
7533
+ className,
7534
+ children,
7535
+ value,
7536
+ disabled = false,
7537
+ textValue,
7538
+ size,
7539
+ customSize,
7540
+ onClick,
7541
+ onMouseMove,
7542
+ onMouseDown
7543
+ } = _b, props = __objRest(_b, [
7544
+ "className",
7545
+ "children",
7546
+ "value",
7547
+ "disabled",
7548
+ "textValue",
7549
+ "size",
7550
+ "customSize",
7551
+ "onClick",
7552
+ "onMouseMove",
7553
+ "onMouseDown"
7554
+ ]);
7555
+ const context = useSelectContext("SelectItem");
7556
+ const {
7557
+ registerItem,
7558
+ unregisterItem,
7559
+ updateItemRef,
7560
+ setActiveValue,
7561
+ setValue,
7562
+ value: selectedValue,
7563
+ activeValue,
7564
+ size: contextSize,
7565
+ customSize: contextCustomSize
7566
+ } = context;
7567
+ const itemId = React46.useId();
7568
+ const localRef = React46.useRef(null);
7569
+ const resolvedSize = size != null ? size : contextSize;
7570
+ const resolvedCustomSize = customSize != null ? customSize : contextCustomSize;
7571
+ const sizeClasses = getFormSizeClasses(resolvedSize, resolvedCustomSize);
7572
+ const labelText = textValue != null ? textValue : getNodeText(children);
7573
+ const isSelected = selectedValue === value;
7574
+ const isActive = activeValue === value;
7575
+ React46.useEffect(() => {
7576
+ registerItem({
7577
+ id: itemId,
7578
+ value,
7579
+ label: children,
7580
+ textValue: labelText,
7581
+ disabled,
7582
+ ref: localRef.current
7583
+ });
7584
+ return () => {
7585
+ unregisterItem(value, itemId);
7586
+ };
7587
+ }, [
7588
+ registerItem,
7589
+ unregisterItem,
7590
+ itemId,
7591
+ value,
7592
+ children,
7593
+ labelText,
7594
+ disabled
7595
+ ]);
7596
+ const handleItemRef = React46.useCallback(
7597
+ (node) => {
7598
+ localRef.current = node;
7599
+ updateItemRef(value, itemId, node);
7600
+ },
7601
+ [updateItemRef, value, itemId]
7602
+ );
7603
+ const setRefs = React46.useMemo(
7604
+ () => composeRefs(ref, handleItemRef),
7605
+ [ref, handleItemRef]
7606
+ );
7607
+ return /* @__PURE__ */ jsxs14(
7608
+ "div",
7609
+ __spreadProps(__spreadValues({
7610
+ ref: setRefs,
7611
+ id: itemId,
7612
+ role: "option",
7613
+ "aria-selected": isSelected,
7614
+ "aria-disabled": disabled,
7615
+ "data-highlighted": isActive ? "" : void 0,
7616
+ "data-disabled": disabled ? "" : void 0,
7617
+ className: cn(
7618
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 outline-none transition-colors",
7619
+ sizeClasses.selectItem,
7620
+ !disabled && "data-highlighted:bg-accent data-highlighted:text-accent-foreground",
7621
+ disabled && "pointer-events-none opacity-50",
7622
+ className
7623
+ ),
7624
+ onMouseDown: (event) => {
7625
+ event.preventDefault();
7626
+ onMouseDown == null ? void 0 : onMouseDown(event);
7627
+ },
7628
+ onMouseMove: (event) => {
7629
+ onMouseMove == null ? void 0 : onMouseMove(event);
7630
+ if (!disabled) {
7631
+ setActiveValue(value);
7632
+ }
7633
+ },
7634
+ onClick: (event) => {
7635
+ onClick == null ? void 0 : onClick(event);
7636
+ if (!event.defaultPrevented && !disabled) {
7637
+ setValue(value);
7638
+ }
7639
+ }
7640
+ }, props), {
7641
+ children: [
7642
+ /* @__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 }),
7643
+ /* @__PURE__ */ jsx24("span", { className: "truncate", children })
7644
+ ]
7645
+ })
7646
+ );
7647
+ }
7648
+ );
7649
+ SelectItem.displayName = "SelectItem";
7650
+ var SelectSeparator = React46.forwardRef(
7651
+ (_a, ref) => {
7652
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
7653
+ return /* @__PURE__ */ jsx24(
7654
+ "div",
7655
+ __spreadValues({
7656
+ ref,
7657
+ role: "separator",
7658
+ className: cn("-mx-1 my-1 h-px bg-muted", className)
7659
+ }, props)
7660
+ );
7661
+ }
7662
+ );
7663
+ SelectSeparator.displayName = "SelectSeparator";
7096
7664
 
7097
7665
  // src/components/searchable-select.tsx
7098
7666
  import * as React47 from "react";
@@ -7134,6 +7702,11 @@ function SearchableSelectBase({
7134
7702
  disabled,
7135
7703
  name,
7136
7704
  required,
7705
+ invalid = false,
7706
+ size = "md",
7707
+ customSize,
7708
+ variant = "outline",
7709
+ classNameDefault = true,
7137
7710
  triggerClassName,
7138
7711
  contentClassName,
7139
7712
  itemClassName,
@@ -7142,6 +7715,8 @@ function SearchableSelectBase({
7142
7715
  const rootRef = React47.useRef(null);
7143
7716
  const inputRef = React47.useRef(null);
7144
7717
  const listboxId = React47.useId();
7718
+ const sizeClasses = getFormSizeClasses(size, customSize);
7719
+ const triggerSizeClass = getFormControlSizeClass(variant, sizeClasses);
7145
7720
  const isControlled = value !== void 0;
7146
7721
  const [internalValue, setInternalValue] = React47.useState(defaultValue != null ? defaultValue : "");
7147
7722
  const currentValue = isControlled ? value != null ? value : "" : internalValue;
@@ -7220,12 +7795,14 @@ function SearchableSelectBase({
7220
7795
  /* @__PURE__ */ jsxs15(
7221
7796
  "div",
7222
7797
  {
7223
- className: cn(
7224
- "relative flex h-9 w-full items-center gap-2 rounded-md border border-input bg-background px-3 text-sm shadow-sm transition",
7225
- "focus-within:border-primary/60 focus-within:ring-2 focus-within:ring-primary/20",
7798
+ className: classNameDefault ? cn(
7799
+ formCompositeControlBase,
7800
+ formCompositeVariants[variant],
7801
+ triggerSizeClass,
7802
+ invalid && formCompositeControlErrorClass,
7226
7803
  disabled && "cursor-not-allowed opacity-50",
7227
7804
  triggerClassName
7228
- ),
7805
+ ) : triggerClassName,
7229
7806
  onPointerDown: () => {
7230
7807
  if (disabled) return;
7231
7808
  setOpen(true);
@@ -7244,6 +7821,7 @@ function SearchableSelectBase({
7244
7821
  "aria-autocomplete": "list",
7245
7822
  "aria-expanded": open,
7246
7823
  "aria-controls": listboxId,
7824
+ "aria-invalid": invalid || void 0,
7247
7825
  "aria-activedescendant": activeIndex >= 0 ? `${listboxId}-option-${activeIndex}` : void 0,
7248
7826
  placeholder: open ? searchPlaceholder : placeholder,
7249
7827
  autoComplete: "off",
@@ -7295,7 +7873,7 @@ function SearchableSelectBase({
7295
7873
  }
7296
7874
  },
7297
7875
  className: cn(
7298
- "h-full min-w-0 flex-1 border-0 bg-transparent p-0 text-sm outline-none",
7876
+ "h-full min-w-0 flex-1 border-0 bg-transparent p-0 outline-none",
7299
7877
  "placeholder:text-muted-foreground disabled:cursor-not-allowed",
7300
7878
  searchInputClassName
7301
7879
  )
@@ -7358,7 +7936,16 @@ function SearchableSelectBase({
7358
7936
  onTouchMoveCapture: (event) => {
7359
7937
  event.stopPropagation();
7360
7938
  },
7361
- children: filteredItems.length === 0 ? /* @__PURE__ */ jsx25("div", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: emptyText }) : filteredItems.map((item, index) => {
7939
+ children: filteredItems.length === 0 ? /* @__PURE__ */ jsx25(
7940
+ "div",
7941
+ {
7942
+ className: cn(
7943
+ "px-3 py-6 text-center text-muted-foreground",
7944
+ sizeClasses.message
7945
+ ),
7946
+ children: emptyText
7947
+ }
7948
+ ) : filteredItems.map((item, index) => {
7362
7949
  const isSelected = item.value === currentValue;
7363
7950
  const isActive = index === activeIndex;
7364
7951
  return /* @__PURE__ */ jsxs15(
@@ -7382,7 +7969,8 @@ function SearchableSelectBase({
7382
7969
  }
7383
7970
  },
7384
7971
  className: cn(
7385
- "relative flex w-full select-none items-center gap-2 rounded-lg px-3 py-2 text-left text-sm outline-none transition",
7972
+ "relative flex w-full select-none items-center gap-2 rounded-lg px-3 text-left outline-none transition",
7973
+ sizeClasses.selectItem,
7386
7974
  item.disabled ? "pointer-events-none opacity-50" : "cursor-pointer",
7387
7975
  isActive && !item.disabled && "bg-accent text-accent-foreground",
7388
7976
  !isActive && !item.disabled && "hover:bg-accent/70 hover:text-accent-foreground",
@@ -7448,13 +8036,13 @@ var FormSelect = ({
7448
8036
  searchable = false,
7449
8037
  searchPlaceholder = "Buscar\u2026",
7450
8038
  emptyText = "No hay resultados",
7451
- position = "popper"
8039
+ classNameDefault = true,
8040
+ position
7452
8041
  }) => {
7453
8042
  const form = useFormContext4();
7454
8043
  const controllerControl = control != null ? control : form == null ? void 0 : form.control;
7455
8044
  const sizeClasses = getFormSizeClasses(size, customSize);
7456
- const triggerBase = "relative inline-flex w-full items-center justify-between gap-2 text-foreground outline-none ring-offset-background transition placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50";
7457
- const triggerSizeClass = variant === "flushed" ? sizeClasses.flushedControl : variant === "link" ? sizeClasses.linkControl : sizeClasses.control;
8045
+ const triggerSizeClass = getFormControlSizeClass(variant, sizeClasses);
7458
8046
  const contentBase = "z-50 rounded-xl border border-border bg-popover text-popover-foreground shadow-xl outline-none";
7459
8047
  const contentViewport = "[&_[data-radix-select-viewport]]:max-h-72 [&_[data-radix-select-viewport]]:overflow-y-auto [&_[data-radix-select-viewport]]:overscroll-contain [&_[data-radix-select-viewport]]:[scrollbar-gutter:stable]";
7460
8048
  const normalizedOptions = React48.useMemo(() => {
@@ -7531,21 +8119,15 @@ var FormSelect = ({
7531
8119
  searchPlaceholder,
7532
8120
  emptyText,
7533
8121
  disabled,
7534
- triggerClassName: cn(
7535
- "min-h-10 w-full rounded-xl border border-input bg-input px-3 text-sm shadow-sm",
7536
- "focus-within:border-primary focus-within:ring-2 focus-within:ring-primary/20",
7537
- hasError && "border-destructive ring-destructive/20",
7538
- className
7539
- ),
7540
- contentClassName: cn(
7541
- "z-50 mt-1 max-h-72 w-full overflow-hidden rounded-xl border border-border bg-popover shadow-xl",
7542
- contentClassName
7543
- ),
7544
- itemClassName: cn(sizeClasses.selectItem, itemClassName),
7545
- searchInputClassName: cn(
7546
- "h-full w-full min-w-0 bg-transparent outline-none placeholder:text-muted-foreground",
7547
- searchInputClassName
7548
- ),
8122
+ invalid: hasError,
8123
+ size,
8124
+ customSize,
8125
+ variant,
8126
+ classNameDefault,
8127
+ triggerClassName: className,
8128
+ contentClassName,
8129
+ itemClassName,
8130
+ searchInputClassName,
7549
8131
  onValueChange: (value, option) => {
7550
8132
  var _a2;
7551
8133
  field.onChange(value);
@@ -7569,13 +8151,13 @@ var FormSelect = ({
7569
8151
  /* @__PURE__ */ jsx26(FormControl, { children: /* @__PURE__ */ jsx26(
7570
8152
  SelectTrigger,
7571
8153
  {
7572
- className: cn(
7573
- triggerBase,
7574
- variants[variant],
8154
+ className: classNameDefault ? cn(
8155
+ formControlBase,
8156
+ formInputVariants[variant],
7575
8157
  triggerSizeClass,
7576
- hasError && "border-destructive ring-destructive focus:ring-destructive/40",
8158
+ hasError && formControlErrorClass,
7577
8159
  className
7578
- ),
8160
+ ) : className,
7579
8161
  children: /* @__PURE__ */ jsx26(SelectValue, { placeholder })
7580
8162
  }
7581
8163
  ) }),
@@ -7990,7 +8572,7 @@ var Modal = ({
7990
8572
  };
7991
8573
 
7992
8574
  // src/components/navigation-menu.tsx
7993
- import { ChevronDownIcon as ChevronDownIcon3 } from "@radix-ui/react-icons";
8575
+ import { ChevronDownIcon as ChevronDownIcon2 } from "@radix-ui/react-icons";
7994
8576
  import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
7995
8577
  import { cva as cva6 } from "class-variance-authority";
7996
8578
  import * as React52 from "react";
@@ -8044,7 +8626,7 @@ var NavigationMenuTrigger = React52.forwardRef((_a, ref) => {
8044
8626
  children,
8045
8627
  " ",
8046
8628
  /* @__PURE__ */ jsx31(
8047
- ChevronDownIcon3,
8629
+ ChevronDownIcon2,
8048
8630
  {
8049
8631
  className: "relative top-[1px] ml-1 h-3 w-3 transition duration-300 group-data-[state=open]:rotate-180",
8050
8632
  "aria-hidden": "true"
@@ -8563,7 +9145,7 @@ SearchInput.displayName = "SearchInput";
8563
9145
  import * as SeparatorPrimitive from "@radix-ui/react-separator";
8564
9146
  import * as React59 from "react";
8565
9147
  import { jsx as jsx39 } from "react/jsx-runtime";
8566
- var Separator6 = React59.forwardRef(
9148
+ var Separator5 = React59.forwardRef(
8567
9149
  (_a, ref) => {
8568
9150
  var _b = _a, { className, orientation = "horizontal", decorative = true } = _b, props = __objRest(_b, ["className", "orientation", "decorative"]);
8569
9151
  return /* @__PURE__ */ jsx39(
@@ -8581,7 +9163,7 @@ var Separator6 = React59.forwardRef(
8581
9163
  );
8582
9164
  }
8583
9165
  );
8584
- Separator6.displayName = SeparatorPrimitive.Root.displayName;
9166
+ Separator5.displayName = SeparatorPrimitive.Root.displayName;
8585
9167
 
8586
9168
  // src/components/sheet.tsx
8587
9169
  import * as SheetPrimitive from "@radix-ui/react-dialog";
@@ -9382,20 +9964,6 @@ UiInput.displayName = "UiInput";
9382
9964
  // src/components/ui/select.tsx
9383
9965
  import * as React72 from "react";
9384
9966
  import { Asterisk as Asterisk5 } from "lucide-react";
9385
-
9386
- // src/types/select.ts
9387
- var selectVariants = {
9388
- outline: "rounded-md border border-input bg-input backdrop-blur-sm shadow-sm hover:border-primary/60 focus:border-primary focus:ring-2 focus:ring-primary/20",
9389
- soft: "rounded-md border border-transparent bg-muted/60 shadow-sm hover:bg-muted focus:bg-input/80 focus:ring-2 focus:ring-primary/20",
9390
- ghost: "rounded-md border border-transparent bg-transparent hover:bg-muted/50 focus:ring-2 focus:ring-ring",
9391
- filled: "rounded-md border border-input bg-muted/70 shadow-inner hover:bg-muted focus:bg-input/70 focus:ring-2 focus:ring-primary/20",
9392
- flushed: "rounded-none border-0 border-b border-input px-0 shadow-none focus:border-b-2 focus:border-primary focus:ring-0",
9393
- unstyled: "border-0 shadow-none focus:ring-0",
9394
- link: "h-auto border-0 bg-transparent p-0 text-primary shadow-none underline-offset-4 focus:underline focus:ring-0"
9395
- };
9396
- var variants2 = selectVariants;
9397
-
9398
- // src/components/ui/select.tsx
9399
9967
  import { jsx as jsx54, jsxs as jsxs27 } from "react/jsx-runtime";
9400
9968
  function UiSelect({
9401
9969
  label,
@@ -9415,33 +9983,28 @@ function UiSelect({
9415
9983
  messageClassName,
9416
9984
  requiredLabelClassName,
9417
9985
  size = "md",
9986
+ customSize,
9418
9987
  variant = "outline",
9988
+ classNameDefault = true,
9419
9989
  errorMessage,
9420
- htmlFormItemId
9990
+ htmlFormItemId,
9991
+ position
9421
9992
  }) {
9422
9993
  const generatedId = React72.useId();
9423
9994
  const triggerId = htmlFormItemId != null ? htmlFormItemId : generatedId;
9424
9995
  const messageId = `${triggerId}-message`;
9425
9996
  const hasError = Boolean(errorMessage);
9426
- const triggerBase = "relative inline-flex w-full items-center justify-between text-foreground outline-none ring-offset-background transition placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50";
9427
- const sizeTrigger = {
9428
- sm: "h-9 px-3 text-sm",
9429
- md: "h-10 px-3.5 text-sm",
9430
- lg: "h-11 px-4 text-base"
9431
- };
9432
- const itemSize = {
9433
- sm: "h-8 text-sm",
9434
- md: "h-9 text-sm",
9435
- lg: "h-10 text-base"
9436
- };
9437
- const specialFlushed = variant === "flushed" ? size === "sm" ? "h-9 text-sm" : size === "lg" ? "h-11 text-base" : "h-10 text-sm" : "";
9438
- const specialLink = variant === "link" ? "text-sm" : "";
9439
- return /* @__PURE__ */ jsxs27("div", { className: cn("w-full space-y-1.5", selectClassName), children: [
9997
+ const sizeClasses = getFormSizeClasses(size, customSize);
9998
+ const triggerSizeClass = getFormControlSizeClass(variant, sizeClasses);
9999
+ const contentBase = "z-50 rounded-xl border border-border bg-popover text-popover-foreground shadow-xl outline-none";
10000
+ const contentViewport = "[&_[data-radix-select-viewport]]:max-h-72 [&_[data-radix-select-viewport]]:overflow-y-auto [&_[data-radix-select-viewport]]:overscroll-contain [&_[data-radix-select-viewport]]:[scrollbar-gutter:stable]";
10001
+ return /* @__PURE__ */ jsxs27("div", { className: cn("w-full space-y-2", selectClassName), children: [
9440
10002
  label ? /* @__PURE__ */ jsxs27(
9441
10003
  Label3,
9442
10004
  {
9443
10005
  className: cn(
9444
- "inline-flex items-start gap-0.5 text-sm font-medium",
10006
+ "inline-flex items-start gap-0.5 font-medium",
10007
+ sizeClasses.label,
9445
10008
  hasError && "text-destructive",
9446
10009
  labelClassName
9447
10010
  ),
@@ -9453,7 +10016,7 @@ function UiSelect({
9453
10016
  {
9454
10017
  "aria-hidden": "true",
9455
10018
  className: cn(
9456
- "mt-0.5 h-3 w-3 shrink-0 text-red-500",
10019
+ "h-3 w-3 shrink-0 text-red-500",
9457
10020
  requiredLabelClassName
9458
10021
  )
9459
10022
  }
@@ -9475,26 +10038,45 @@ function UiSelect({
9475
10038
  id: triggerId,
9476
10039
  "aria-invalid": hasError || void 0,
9477
10040
  "aria-describedby": errorMessage ? messageId : void 0,
9478
- className: cn(
9479
- triggerBase,
9480
- variants2[variant],
9481
- variant === "flushed" ? specialFlushed : variant === "link" ? specialLink : sizeTrigger[size],
9482
- hasError && "border-destructive ring-destructive focus:ring-destructive/40",
10041
+ className: classNameDefault ? cn(
10042
+ formControlBase,
10043
+ formInputVariants[variant],
10044
+ triggerSizeClass,
10045
+ hasError && formControlErrorClass,
9483
10046
  className
9484
- ),
10047
+ ) : className,
9485
10048
  children: /* @__PURE__ */ jsx54(SelectValue, { placeholder })
9486
10049
  }
9487
10050
  ),
9488
- /* @__PURE__ */ jsx54(SelectContent, { className: contentClassName, children: children != null ? children : items == null ? void 0 : items.map((item) => /* @__PURE__ */ jsx54(
9489
- SelectItem,
10051
+ /* @__PURE__ */ jsx54(
10052
+ SelectContent,
9490
10053
  {
9491
- value: item.value,
9492
- disabled: item.disabled,
9493
- className: cn(itemSize[size], itemClassName),
9494
- children: item.label
9495
- },
9496
- item.value
9497
- )) })
10054
+ position,
10055
+ sideOffset: 6,
10056
+ className: cn(
10057
+ contentBase,
10058
+ contentViewport,
10059
+ "w-(--radix-select-trigger-width) min-w-(--radix-select-trigger-width) overflow-hidden!",
10060
+ contentClassName
10061
+ ),
10062
+ onWheelCapture: (event) => {
10063
+ event.stopPropagation();
10064
+ },
10065
+ onTouchMoveCapture: (event) => {
10066
+ event.stopPropagation();
10067
+ },
10068
+ children: children != null ? children : items == null ? void 0 : items.map((item) => /* @__PURE__ */ jsx54(
10069
+ SelectItem,
10070
+ {
10071
+ value: item.value,
10072
+ disabled: item.disabled,
10073
+ className: cn(sizeClasses.selectItem, itemClassName),
10074
+ children: item.label
10075
+ },
10076
+ item.value
10077
+ ))
10078
+ }
10079
+ )
9498
10080
  ]
9499
10081
  }
9500
10082
  ),
@@ -9502,7 +10084,11 @@ function UiSelect({
9502
10084
  "p",
9503
10085
  {
9504
10086
  id: messageId,
9505
- className: cn("text-sm font-medium text-destructive", messageClassName),
10087
+ className: cn(
10088
+ "font-medium text-destructive",
10089
+ sizeClasses.message,
10090
+ messageClassName
10091
+ ),
9506
10092
  children: errorMessage
9507
10093
  }
9508
10094
  ) : null
@@ -9618,18 +10204,18 @@ var UiCheckbox = React73.forwardRef(
9618
10204
  UiCheckbox.displayName = "UiCheckbox";
9619
10205
 
9620
10206
  // src/hooks/use-sidebar.tsx
9621
- import { createContext as createContext5, useContext as useContext6, useState as useState7 } from "react";
10207
+ import { createContext as createContext6, useContext as useContext7, useState as useState8 } from "react";
9622
10208
  import { jsx as jsx56 } from "react/jsx-runtime";
9623
- var SidebarContext = createContext5({
10209
+ var SidebarContext = createContext6({
9624
10210
  isMinimized: false,
9625
10211
  toggle: () => {
9626
10212
  }
9627
10213
  });
9628
- var useSidebar = () => useContext6(SidebarContext);
10214
+ var useSidebar = () => useContext7(SidebarContext);
9629
10215
  var SidebarProvider = ({
9630
10216
  children
9631
10217
  }) => {
9632
- const [isMinimized, setIsMinimized] = useState7(false);
10218
+ const [isMinimized, setIsMinimized] = useState8(false);
9633
10219
  const toggle = () => {
9634
10220
  setIsMinimized(!isMinimized);
9635
10221
  };
@@ -9677,7 +10263,7 @@ var AlertModal = ({
9677
10263
 
9678
10264
  // src/shared/breadcrumbs.tsx
9679
10265
  import { Slash } from "lucide-react";
9680
- import { Fragment as Fragment2 } from "react";
10266
+ import { Fragment } from "react";
9681
10267
  import { jsx as jsx58, jsxs as jsxs30 } from "react/jsx-runtime";
9682
10268
  function Breadcrumbs({
9683
10269
  items,
@@ -9688,7 +10274,7 @@ function Breadcrumbs({
9688
10274
  return /* @__PURE__ */ jsx58(Breadcrumb, { className, children: /* @__PURE__ */ jsx58(BreadcrumbList, { className: classNameList, children: items.map((item, index) => {
9689
10275
  var _a;
9690
10276
  const isLast = index === items.length - 1;
9691
- return /* @__PURE__ */ jsxs30(Fragment2, { children: [
10277
+ return /* @__PURE__ */ jsxs30(Fragment, { children: [
9692
10278
  !isLast ? /* @__PURE__ */ jsx58(BreadcrumbItem, { className: item.className, children: /* @__PURE__ */ jsx58(BreadcrumbLink, { href: (_a = item.link) != null ? _a : "#", children: item.title }) }) : /* @__PURE__ */ jsx58(BreadcrumbItem, { className: item.className, children: /* @__PURE__ */ jsx58(BreadcrumbPage, { children: item.title }) }),
9693
10279
  !isLast ? /* @__PURE__ */ jsx58(BreadcrumbSeparator, { children: separator }) : null
9694
10280
  ] }, `${item.title}-${index}`);
@@ -9696,7 +10282,7 @@ function Breadcrumbs({
9696
10282
  }
9697
10283
 
9698
10284
  // src/shared/data-table.tsx
9699
- import { useMemo as useMemo5 } from "react";
10285
+ import { useMemo as useMemo6 } from "react";
9700
10286
  import { AnimatePresence, motion } from "framer-motion";
9701
10287
  import {
9702
10288
  DoubleArrowLeftIcon,
@@ -9946,7 +10532,7 @@ function DataTable({
9946
10532
  const safePageCount = Math.max(pageCount != null ? pageCount : 1, 1);
9947
10533
  const pageIndex = Math.min(Math.max(page - 1, 0), safePageCount - 1);
9948
10534
  const pageSize = Math.max(perPage, 1);
9949
- const paginationState = useMemo5(
10535
+ const paginationState = useMemo6(
9950
10536
  () => ({ pageIndex, pageSize }),
9951
10537
  [pageIndex, pageSize]
9952
10538
  );
@@ -9963,7 +10549,7 @@ function DataTable({
9963
10549
  autoResetPageIndex: false
9964
10550
  });
9965
10551
  const clickable = !!onClick;
9966
- const pageKey = useMemo5(
10552
+ const pageKey = useMemo6(
9967
10553
  () => `${pageIndex}-${pageSize}-${data.length}`,
9968
10554
  [pageIndex, pageSize, data.length]
9969
10555
  );
@@ -9978,7 +10564,7 @@ function DataTable({
9978
10564
  onPageSizeChange == null ? void 0 : onPageSizeChange(size);
9979
10565
  onPageChange == null ? void 0 : onPageChange(1);
9980
10566
  };
9981
- const ui = useMemo5(() => {
10567
+ const ui = useMemo6(() => {
9982
10568
  var _a;
9983
10569
  const builtIn = (_a = DATA_TABLE_TEMPLATES[template]) != null ? _a : DATA_TABLE_TEMPLATES.neo;
9984
10570
  return mergeSlots(DATA_TABLE_TEMPLATES.neo, builtIn, classNames);
@@ -10111,7 +10697,7 @@ function DataTable({
10111
10697
  children: /* @__PURE__ */ jsx59(SelectValue, { placeholder: `${pageSize}` })
10112
10698
  }
10113
10699
  ),
10114
- /* @__PURE__ */ jsx59(SelectContent, { side: "top", children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx59(SelectItem, { value: `${size}`, children: size }, size)) })
10700
+ /* @__PURE__ */ jsx59(SelectContent, { children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx59(SelectItem, { value: `${size}`, children: size }, size)) })
10115
10701
  ]
10116
10702
  }
10117
10703
  )
@@ -10282,7 +10868,7 @@ function Dropzone({
10282
10868
  // src/shared/fileupload.tsx
10283
10869
  import { AvatarIcon } from "@radix-ui/react-icons";
10284
10870
  import { CameraIcon } from "lucide-react";
10285
- import { useEffect as useEffect7, useState as useState8 } from "react";
10871
+ import { useEffect as useEffect7, useState as useState9 } from "react";
10286
10872
  import { useDropzone as useDropzone2 } from "react-dropzone";
10287
10873
  import { jsx as jsx62, jsxs as jsxs34 } from "react/jsx-runtime";
10288
10874
  function FileUpload({
@@ -10319,7 +10905,7 @@ function FileUpload({
10319
10905
  ) });
10320
10906
  }
10321
10907
  function ImagePreview({ file }) {
10322
- const [objectUrl, setObjectUrl] = useState8(null);
10908
+ const [objectUrl, setObjectUrl] = useState9(null);
10323
10909
  useEffect7(() => {
10324
10910
  const url = URL.createObjectURL(file);
10325
10911
  setObjectUrl(url);
@@ -10635,12 +11221,10 @@ export {
10635
11221
  SelectGroup,
10636
11222
  SelectItem,
10637
11223
  SelectLabel,
10638
- SelectScrollDownButton,
10639
- SelectScrollUpButton,
10640
11224
  SelectSeparator,
10641
11225
  SelectTrigger,
10642
11226
  SelectValue,
10643
- Separator6 as Separator,
11227
+ Separator5 as Separator,
10644
11228
  Sheet,
10645
11229
  SheetClose,
10646
11230
  SheetContent,
@@ -10691,9 +11275,18 @@ export {
10691
11275
  badgeVariants,
10692
11276
  buttonVariants,
10693
11277
  cn,
11278
+ formCompositeControlBase,
11279
+ formCompositeControlErrorClass,
11280
+ formCompositeVariants,
11281
+ formControlBase,
11282
+ formControlErrorClass,
11283
+ formInputVariants,
11284
+ formSizeVariants,
10694
11285
  getDefaultOptionLabel,
10695
11286
  getDefaultOptionValue,
10696
11287
  getErrorMessage,
11288
+ getFormControlSizeClass,
11289
+ getFormSizeClasses,
10697
11290
  getNextEnabledIndex,
10698
11291
  iconButtonVariants,
10699
11292
  navigationMenuTriggerStyle,
@@ -10703,5 +11296,6 @@ export {
10703
11296
  toggleVariants,
10704
11297
  useFormField,
10705
11298
  useSidebar,
10706
- useToast
11299
+ useToast,
11300
+ variants
10707
11301
  };