@vritti/quantum-ui 0.3.7 → 0.3.8

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.
Files changed (83) hide show
  1. package/dist/Avatar.js +4 -4
  2. package/dist/Checkbox2.js +2 -2
  3. package/dist/ConfirmHost.js +109 -0
  4. package/dist/ConfirmHost.js.map +1 -0
  5. package/dist/Dialog.js +74 -42
  6. package/dist/Dialog.js.map +1 -1
  7. package/dist/DropdownMenu.js +1 -2
  8. package/dist/DropdownMenu.js.map +1 -1
  9. package/dist/Form.js +50 -26
  10. package/dist/Form.js.map +1 -1
  11. package/dist/Progress.js +2 -2
  12. package/dist/RadioGroup.js +2 -2
  13. package/dist/Sidebar.js +1 -1
  14. package/dist/Switch.js +2 -2
  15. package/dist/TabsSkeleton.js +1 -1
  16. package/dist/Toggle.js +1 -1
  17. package/dist/assets/quantum-ui.css +43 -5
  18. package/dist/cells.js +46 -43
  19. package/dist/cells.js.map +1 -1
  20. package/dist/components/ConfirmHost.js +2 -0
  21. package/dist/components/ConfirmHost.js.map +1 -0
  22. package/dist/components/RichTextEditor.js +1 -1
  23. package/dist/context/index.js +0 -1
  24. package/dist/context/index.js.map +1 -1
  25. package/dist/dropdown-menu.js +2 -2
  26. package/dist/image-component.js +1 -1
  27. package/dist/index.js +2 -2
  28. package/dist/index13.js +1 -1
  29. package/dist/index14.js +3 -3
  30. package/dist/index15.js +1 -1
  31. package/dist/index16.js +1 -1
  32. package/dist/index20.js +1 -1
  33. package/dist/index25.js +1 -1
  34. package/dist/index26.js +2 -2
  35. package/dist/index29.js +1123 -35
  36. package/dist/index29.js.map +1 -1
  37. package/dist/index30.js +36 -310
  38. package/dist/index30.js.map +1 -1
  39. package/dist/index31.js +309 -7
  40. package/dist/index31.js.map +1 -1
  41. package/dist/index32.js +8 -30
  42. package/dist/index32.js.map +1 -1
  43. package/dist/index33.js +29 -59
  44. package/dist/index33.js.map +1 -1
  45. package/dist/index34.js +59 -10
  46. package/dist/index34.js.map +1 -1
  47. package/dist/index35.js +10 -35
  48. package/dist/index35.js.map +1 -1
  49. package/dist/index36.js +27 -36809
  50. package/dist/index36.js.map +1 -1
  51. package/dist/index37.js +36809 -70
  52. package/dist/index37.js.map +1 -1
  53. package/dist/index38.js +72 -187
  54. package/dist/index38.js.map +1 -1
  55. package/dist/index39.js +199 -0
  56. package/dist/index39.js.map +1 -0
  57. package/dist/lib/components/ConfirmHost/ConfirmHost.d.ts +39 -0
  58. package/dist/lib/components/ConfirmHost/ConfirmHost.d.ts.map +1 -0
  59. package/dist/lib/components/ConfirmHost/index.d.ts +2 -0
  60. package/dist/lib/components/ConfirmHost/index.d.ts.map +1 -0
  61. package/dist/lib/components/Dialog/Dialog.d.ts +2 -3
  62. package/dist/lib/components/Dialog/Dialog.d.ts.map +1 -1
  63. package/dist/lib/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  64. package/dist/lib/components/DropdownMenu/types.d.ts +0 -1
  65. package/dist/lib/components/DropdownMenu/types.d.ts.map +1 -1
  66. package/dist/lib/components/Form/Form.d.ts.map +1 -1
  67. package/dist/lib/components/index.d.ts +1 -0
  68. package/dist/lib/components/index.d.ts.map +1 -1
  69. package/dist/lib/context/index.d.ts +0 -1
  70. package/dist/lib/context/index.d.ts.map +1 -1
  71. package/dist/lib/hooks/useConfirm.d.ts +3 -3
  72. package/dist/lib/hooks/useConfirm.d.ts.map +1 -1
  73. package/dist/useConfirm.js +3 -7
  74. package/dist/useConfirm.js.map +1 -1
  75. package/dist/utils/motion.js +2 -2
  76. package/dist/value.js +1 -1
  77. package/package.json +5 -1
  78. package/dist/Combination.js +0 -1129
  79. package/dist/Combination.js.map +0 -1
  80. package/dist/ConfirmContext.js +0 -96
  81. package/dist/ConfirmContext.js.map +0 -1
  82. package/dist/lib/context/ConfirmContext.d.ts +0 -26
  83. package/dist/lib/context/ConfirmContext.d.ts.map +0 -1
package/dist/Form.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Form.js","sources":["../lib/utils/formHelpers.ts","../lib/components/Form/Form.tsx"],"sourcesContent":["import type { FieldPath, FieldValues, UseFormReturn } from 'react-hook-form';\n\n/**\n * Field mapping configuration for API error to form field mapping\n */\nexport interface FieldMapping {\n [apiField: string]: string; // Maps API field names to form field names\n}\n\n/**\n * Axios error structure (or similar HTTP client error structure)\n */\ninterface AxiosLikeError {\n response?: {\n data?: unknown;\n };\n}\n\n/**\n * RFC 9457 field error structure\n */\nexport interface FieldError {\n field: string;\n message: string;\n}\n\n/**\n * API error structure with field-specific errors\n * Supports RFC 9457 Problem Details format\n */\nexport interface ApiErrorResponse {\n type?: string; // RFC 9457: URI reference identifying the problem type\n title?: string; // RFC 9457: Short human-readable summary\n status?: number; // RFC 9457: HTTP status code\n label?: string; // Root error heading displayed to the user\n detail?: string; // RFC 9457: Human-readable explanation\n instance?: string; // RFC 9457: URI reference for the specific occurrence\n errors?: FieldError[];\n}\n\n/**\n * Options for mapping API errors to form\n */\nexport interface MapApiErrorsOptions {\n /**\n * Field name mapping from API to form fields\n */\n fieldMapping?: FieldMapping;\n\n /**\n * Whether to set root error for general messages\n */\n setRootError?: boolean;\n}\n\n/**\n * Maps an RFC 9457 Problem Details API error response to react-hook-form errors.\n *\n * Root errors (`label`/`title` + `detail`) and field errors (`errors[]`) are\n * handled independently -- a single response can populate both the root error\n * alert and inline field errors at the same time.\n *\n * @param error - The error object from API response\n * @param form - The react-hook-form instance\n * @param options - Mapping options\n *\n * @example\n * ```tsx\n * try {\n * await api.post('/login', data);\n * } catch (error) {\n * mapApiErrorsToForm(error.response?.data, form, {\n * fieldMapping: {\n * 'email_address': 'email',\n * 'password_hash': 'password'\n * }\n * });\n * }\n * ```\n */\nexport function mapApiErrorsToForm<TFieldValues extends FieldValues = FieldValues>(\n error: unknown,\n form: UseFormReturn<TFieldValues>,\n options: MapApiErrorsOptions = {},\n): void {\n const { fieldMapping = {}, setRootError = true } = options;\n\n if (!error || typeof error !== 'object') {\n if (setRootError) {\n form.setError('root', {\n type: 'Error',\n message: 'An error occurred',\n });\n }\n return;\n }\n\n // Extract error data from axios response structure\n const axiosError = error as AxiosLikeError;\n const errorData = axiosError.response?.data || error;\n const apiError = errorData as ApiErrorResponse;\n\n // Extract title/label for error heading (RFC 9457)\n const errorTitle = apiError.label || apiError.title || 'Error';\n const generalMessage = apiError.detail;\n\n // Map field-specific errors (field is always present in RFC 9457)\n let mappedFieldErrorsCount = 0;\n if (apiError.errors && Array.isArray(apiError.errors)) {\n for (const errorItem of apiError.errors) {\n const formField = fieldMapping[errorItem.field] || errorItem.field;\n\n form.setError(formField as FieldPath<TFieldValues>, {\n type: 'manual',\n message: errorItem.message,\n });\n mappedFieldErrorsCount += 1;\n }\n }\n\n // Root error is shown only when no field errors are present\n if (generalMessage && setRootError && mappedFieldErrorsCount === 0) {\n form.setError('root', {\n type: errorTitle,\n message: generalMessage,\n });\n }\n}\n","import type { UseMutationResult } from '@tanstack/react-query';\nimport type React from 'react';\nimport { Children, cloneElement, Fragment, isValidElement, useCallback } from 'react';\nimport {\n Controller,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n FormProvider,\n type UseFormReturn,\n} from 'react-hook-form';\nimport type { Country } from 'react-phone-number-input';\nimport { cn } from '../../../shadcn/utils';\nimport { axios } from '../../utils/axios';\nimport { type FieldMapping, mapApiErrorsToForm } from '../../utils/formHelpers';\nimport { Alert } from '../Alert';\nimport { Button } from '../Button';\nimport { Checkbox } from '../Checkbox';\nimport { CheckboxGroup } from '../CheckboxGroup';\nimport { DatePicker } from '../DatePicker';\nimport { DateTimePicker } from '../DateTimePicker';\nimport { PhoneField } from '../PhoneField';\nimport { RadioGroup } from '../RadioGroup';\nimport { Switch } from '../Switch';\nimport { UploadFile } from '../UploadFile';\n\n// Re-export Controller for explicit usage\nexport { Controller } from 'react-hook-form';\n\n/**\n * Recursively process children to wrap form fields with Controller\n * and inject loading state into submit buttons\n */\nfunction processChildren<\n TFieldValues extends FieldValues = FieldValues,\n _TContext = any,\n TTransformedValues extends FieldValues | undefined = TFieldValues,\n>(\n children: React.ReactNode,\n control: ControllerProps<TFieldValues, FieldPath<TFieldValues>, TTransformedValues>['control'],\n isSubmitting: boolean,\n setValue: UseFormReturn<TFieldValues, _TContext, TTransformedValues>['setValue'],\n onCancel?: () => void,\n reset?: UseFormReturn<TFieldValues, _TContext, TTransformedValues>['reset'],\n): React.ReactNode {\n return Children.map(children, (child) => {\n // Handle non-element children (strings, numbers, null, etc.)\n if (!isValidElement(child)) {\n return child;\n }\n\n const childProps = child.props as any;\n const isFragment = child.type === Fragment;\n\n // Handle form fields with name prop (but not Fragments)\n if (!isFragment && childProps.name && typeof childProps.name === 'string') {\n const name = childProps.name as FieldPath<TFieldValues>;\n\n return (\n <Controller\n key={name}\n control={control}\n name={name}\n render={({ field, fieldState }) => {\n // Check if this is a Checkbox, Switch, RadioGroup, or CheckboxGroup component\n const isCheckbox = child.type === Checkbox;\n const isSwitch = child.type === Switch;\n const isRadioGroup = child.type === RadioGroup;\n const isCheckboxGroup = child.type === CheckboxGroup;\n const isPhone = child.type === PhoneField;\n const isDatePicker = child.type === DatePicker;\n const isDateTimePicker = child.type === DateTimePicker;\n\n const fieldProps =\n isCheckbox || isSwitch\n ? {\n checked: field.value,\n onCheckedChange: field.onChange,\n onBlur: field.onBlur,\n ref: field.ref,\n }\n : isRadioGroup || isCheckboxGroup\n ? {\n value: field.value,\n onValueChange: field.onChange,\n onBlur: field.onBlur,\n }\n : isDatePicker\n ? {\n value: field.value,\n onValueChange: field.onChange,\n onBlur: field.onBlur,\n ref: field.ref,\n }\n : isDateTimePicker\n ? {\n value: field.value,\n onValueChange: field.onChange,\n onBlur: field.onBlur,\n ref: field.ref,\n }\n : isPhone\n ? {\n ...field,\n onCountryChange: (country: Country | undefined) => {\n setValue(`${name}Country` as FieldPath<TFieldValues>, country as any);\n },\n }\n : field;\n\n const isUploadFile = child.type === UploadFile;\n\n return cloneElement(child, {\n ...childProps,\n ...fieldProps,\n error: fieldState.error?.message || (fieldState.error ? 'Invalid' : undefined),\n name: undefined, // Remove name to avoid passing it to the underlying input\n ...(isUploadFile ? { isLoading: isSubmitting } : {}),\n });\n }}\n />\n );\n }\n\n // Handle cancel buttons - wire up form.reset() + onCancel callback\n if (childProps['data-cancel'] && onCancel && reset) {\n return cloneElement(child, {\n ...childProps,\n onClick: () => {\n reset();\n onCancel();\n },\n });\n }\n\n // Handle submit buttons - inject loading state via isLoading prop\n if (childProps.type === 'submit') {\n const isButtonElement =\n child.type === Button || (typeof child.type === 'function' && (child.type as any).displayName === 'Button');\n\n if (isButtonElement) {\n return cloneElement(child, {\n ...childProps,\n isLoading: isSubmitting,\n });\n }\n }\n\n // Handle React Fragments - process their children directly\n if (isFragment) {\n return processChildren(childProps.children, control, isSubmitting, setValue, onCancel, reset);\n }\n\n // Recurse into children for container elements (divs, FieldGroups, etc.)\n if (childProps.children != null) {\n return cloneElement(child, {\n ...childProps,\n children: processChildren(childProps.children, control, isSubmitting, setValue, onCancel, reset),\n });\n }\n\n // Return unchanged if no name prop and no children\n return child;\n });\n}\n\nexport interface FormProps<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TTransformedValues extends FieldValues | undefined = TFieldValues,\n TMutationData = unknown,\n TMutationError = Error,\n TMutationVariables = any,\n> extends Omit<React.FormHTMLAttributes<HTMLFormElement>, 'onSubmit'> {\n /**\n * The react-hook-form form instance\n */\n form: UseFormReturn<TFieldValues, TContext, TTransformedValues>;\n\n /**\n * Form submit handler - receives the transformed values if transformation is applied.\n * Optional when using `mutation` prop.\n */\n onSubmit?: Parameters<UseFormReturn<TFieldValues, TContext, TTransformedValues>['handleSubmit']>[0];\n\n /**\n * Children elements - automatically wrapped with Controller if they have a name prop\n */\n children: React.ReactNode;\n\n /**\n * Position of the root error display\n * @default 'bottom'\n */\n rootErrorPosition?: 'top' | 'bottom';\n\n /**\n * Additional classes for the root error display\n */\n rootErrorClassName?: string;\n\n /**\n * Action element rendered in the root error Alert (e.g. button or link)\n * Positioned in the top-right corner using AlertAction\n */\n rootErrorAction?: React.ReactNode;\n\n /**\n * Field mapping for automatic API error mapping\n * Maps API field names to form field names\n */\n fieldMapping?: FieldMapping;\n\n /**\n * TanStack Query mutation for automatic handling.\n * When provided, the form will use `mutateAsync` to submit data and handle errors automatically.\n * The mutation's own callbacks (onSuccess, onError, etc.) will fire automatically.\n * Form only adds `mapApiErrorsToForm` as an extra error handling layer.\n * Optional - you can use `onSubmit` instead for forms that don't use mutations.\n */\n mutation?: UseMutationResult<TMutationData, TMutationError, TMutationVariables, unknown>;\n\n /**\n * Transform form data to mutation variables before submission.\n * Only used when `mutation` prop is provided.\n */\n transformSubmit?: (\n data: TTransformedValues extends undefined ? TFieldValues : TTransformedValues,\n ) => TMutationVariables;\n\n /**\n * Automatically calls form.reset() after a successful mutation.\n * Set to false for \"edit\" forms where resetting clears pre-populated values.\n * @default true\n */\n resetOnSuccess?: boolean;\n\n /**\n * Called when a cancel button (marked with data-cancel) is clicked.\n * Form.reset() is called automatically before invoking this callback.\n */\n onCancel?: () => void;\n}\n\n/**\n * Smart Form component that automatically wraps children with Controller\n *\n * Usage with onSubmit:\n * ```tsx\n * <Form form={form} onSubmit={handleSubmit}>\n * <TextField name=\"email\" label=\"Email\" description=\"Your email address\" />\n * <PasswordField name=\"password\" label=\"Password\" />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * ```\n *\n * Usage with TanStack Query mutation:\n * ```tsx\n * const mutation = useMutation({\n * mutationFn: (data) => api.post('/login', data),\n * onSuccess: (data) => console.log('Success!', data),\n * onError: (error) => console.error('Error!', error),\n * });\n *\n * <Form\n * form={form}\n * mutation={mutation}\n * transformSubmit={(data) => ({ ...data, timestamp: Date.now() })}\n * >\n * <TextField name=\"email\" label=\"Email\" />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * ```\n */\nexport function Form<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TTransformedValues extends FieldValues | undefined = TFieldValues,\n TMutationData = unknown,\n TMutationError = Error,\n TMutationVariables = any,\n>({\n form,\n onSubmit,\n children,\n rootErrorPosition = 'bottom',\n rootErrorClassName,\n rootErrorAction,\n fieldMapping,\n mutation,\n transformSubmit,\n resetOnSuccess,\n onCancel,\n className,\n ...props\n}: FormProps<TFieldValues, TContext, TTransformedValues, TMutationData, TMutationError, TMutationVariables>) {\n // Compute isSubmitting from both form state and mutation state\n const isSubmitting = form.formState.isSubmitting || (mutation?.isPending ?? false);\n\n // Wrap the submit handler with automatic error mapping (always enabled)\n // Form only adds mapApiErrorsToForm - the mutation's own callbacks fire automatically\n const wrappedOnSubmit = useCallback(\n async (data: TTransformedValues extends undefined ? TFieldValues : TTransformedValues) => {\n // Suppress error toasts during form submission — Form handles errors inline\n const interceptorId = axios.interceptors.request.use((config) => ({\n ...config,\n showErrorToast: false,\n }));\n\n try {\n if (mutation) {\n const variables = transformSubmit ? transformSubmit(data) : data;\n // mutateAsync will trigger the mutation's onSuccess/onError callbacks\n await mutation.mutateAsync(variables as TMutationVariables);\n } else if (onSubmit) {\n await onSubmit(data as any);\n }\n\n // Reset form after successful submission (default: true)\n if (resetOnSuccess !== false) form.reset();\n } catch (error) {\n // Form's only job: map API errors to form fields\n // mapApiErrorsToForm handles axios error structure extraction internally\n mapApiErrorsToForm(error, form as any, {\n fieldMapping,\n });\n // Log error for debugging\n console.error('[Form Submission Error]', error);\n // Error is swallowed, not re-thrown (mutation's onError already fired)\n } finally {\n axios.interceptors.request.eject(interceptorId);\n }\n },\n [onSubmit, mutation, transformSubmit, fieldMapping, form, resetOnSuccess],\n );\n\n const handleSubmit = form.handleSubmit(wrappedOnSubmit as any);\n\n // Process children recursively to automatically wrap with Controller\n const processedChildren = processChildren(children, form.control, isSubmitting, form.setValue, onCancel, form.reset);\n\n return (\n <FormProvider {...form}>\n <form onSubmit={handleSubmit} className={cn('space-y-4', className)} {...props}>\n {/* Top position error */}\n {rootErrorPosition === 'top' && form.formState.errors.root && (\n <Alert\n variant=\"destructive\"\n title={form.formState.errors.root.type || 'Error'}\n description={form.formState.errors.root.message}\n action={rootErrorAction}\n className={cn('mb-4', rootErrorClassName)}\n />\n )}\n\n {processedChildren}\n\n {/* Bottom position error */}\n {rootErrorPosition === 'bottom' && form.formState.errors.root && (\n <Alert\n variant=\"destructive\"\n title={form.formState.errors.root.type || 'Error'}\n description={form.formState.errors.root.message}\n action={rootErrorAction}\n className={cn('mt-4', rootErrorClassName)}\n />\n )}\n </form>\n </FormProvider>\n );\n}\n\nForm.displayName = 'Form';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgFO,SAAS,kBAAA,CACd,KAAA,EACA,IAAA,EACA,OAAA,GAA+B,EAAC,EAC1B;AACN,EAAA,MAAM,EAAE,YAAA,GAAe,EAAC,EAAG,YAAA,GAAe,MAAK,GAAI,OAAA;AAEnD,EAAA,IAAI,CAAC,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,EAAU;AACvC,IAAA,IAAI,YAAA,EAAc;AAChB,MAAA,IAAA,CAAK,SAAS,MAAA,EAAQ;AAAA,QACpB,IAAA,EAAM,OAAA;AAAA,QACN,OAAA,EAAS;AAAA,OACV,CAAA;AAAA,IACH;AACA,IAAA;AAAA,EACF;AAGA,EAAA,MAAM,UAAA,GAAa,KAAA;AACnB,EAAA,MAAM,SAAA,GAAY,UAAA,CAAW,QAAA,EAAU,IAAA,IAAQ,KAAA;AAC/C,EAAA,MAAM,QAAA,GAAW,SAAA;AAGjB,EAAA,MAAM,UAAA,GAAa,QAAA,CAAS,KAAA,IAAS,QAAA,CAAS,KAAA,IAAS,OAAA;AACvD,EAAA,MAAM,iBAAiB,QAAA,CAAS,MAAA;AAGhC,EAAA,IAAI,sBAAA,GAAyB,CAAA;AAC7B,EAAA,IAAI,SAAS,MAAA,IAAU,KAAA,CAAM,OAAA,CAAQ,QAAA,CAAS,MAAM,CAAA,EAAG;AACrD,IAAA,KAAA,MAAW,SAAA,IAAa,SAAS,MAAA,EAAQ;AACvC,MAAA,MAAM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AA,EAAa,IAAA,CAAK,SAAA,CAAU,MAAA,CAAO,IAAA,CAAK,OAAA;AAAA,QACxC,MAAA,EAAQ,eAAA;AAAA,QACR,SAAA,EAAW,EAAA,CAAG,MAAA,EAAQ,kBAAkB;AAAA;AAAA;AAC1C,GAAA,EAEJ,CAAA,EACF,CAAA;AAEJ;AAEA,IAAA,CAAK,WAAA,GAAc,MAAA;;;;"}
1
+ {"version":3,"file":"Form.js","sources":["../lib/utils/formHelpers.ts","../lib/components/Form/Form.tsx"],"sourcesContent":["import type { FieldPath, FieldValues, UseFormReturn } from 'react-hook-form';\n\n/**\n * Field mapping configuration for API error to form field mapping\n */\nexport interface FieldMapping {\n [apiField: string]: string; // Maps API field names to form field names\n}\n\n/**\n * Axios error structure (or similar HTTP client error structure)\n */\ninterface AxiosLikeError {\n response?: {\n data?: unknown;\n };\n}\n\n/**\n * RFC 9457 field error structure\n */\nexport interface FieldError {\n field: string;\n message: string;\n}\n\n/**\n * API error structure with field-specific errors\n * Supports RFC 9457 Problem Details format\n */\nexport interface ApiErrorResponse {\n type?: string; // RFC 9457: URI reference identifying the problem type\n title?: string; // RFC 9457: Short human-readable summary\n status?: number; // RFC 9457: HTTP status code\n label?: string; // Root error heading displayed to the user\n detail?: string; // RFC 9457: Human-readable explanation\n instance?: string; // RFC 9457: URI reference for the specific occurrence\n errors?: FieldError[];\n}\n\n/**\n * Options for mapping API errors to form\n */\nexport interface MapApiErrorsOptions {\n /**\n * Field name mapping from API to form fields\n */\n fieldMapping?: FieldMapping;\n\n /**\n * Whether to set root error for general messages\n */\n setRootError?: boolean;\n}\n\n/**\n * Maps an RFC 9457 Problem Details API error response to react-hook-form errors.\n *\n * Root errors (`label`/`title` + `detail`) and field errors (`errors[]`) are\n * handled independently -- a single response can populate both the root error\n * alert and inline field errors at the same time.\n *\n * @param error - The error object from API response\n * @param form - The react-hook-form instance\n * @param options - Mapping options\n *\n * @example\n * ```tsx\n * try {\n * await api.post('/login', data);\n * } catch (error) {\n * mapApiErrorsToForm(error.response?.data, form, {\n * fieldMapping: {\n * 'email_address': 'email',\n * 'password_hash': 'password'\n * }\n * });\n * }\n * ```\n */\nexport function mapApiErrorsToForm<TFieldValues extends FieldValues = FieldValues>(\n error: unknown,\n form: UseFormReturn<TFieldValues>,\n options: MapApiErrorsOptions = {},\n): void {\n const { fieldMapping = {}, setRootError = true } = options;\n\n if (!error || typeof error !== 'object') {\n if (setRootError) {\n form.setError('root', {\n type: 'Error',\n message: 'An error occurred',\n });\n }\n return;\n }\n\n // Extract error data from axios response structure\n const axiosError = error as AxiosLikeError;\n const errorData = axiosError.response?.data || error;\n const apiError = errorData as ApiErrorResponse;\n\n // Extract title/label for error heading (RFC 9457)\n const errorTitle = apiError.label || apiError.title || 'Error';\n const generalMessage = apiError.detail;\n\n // Map field-specific errors (field is always present in RFC 9457)\n let mappedFieldErrorsCount = 0;\n if (apiError.errors && Array.isArray(apiError.errors)) {\n for (const errorItem of apiError.errors) {\n const formField = fieldMapping[errorItem.field] || errorItem.field;\n\n form.setError(formField as FieldPath<TFieldValues>, {\n type: 'manual',\n message: errorItem.message,\n });\n mappedFieldErrorsCount += 1;\n }\n }\n\n // Root error is shown only when no field errors are present\n if (generalMessage && setRootError && mappedFieldErrorsCount === 0) {\n form.setError('root', {\n type: errorTitle,\n message: generalMessage,\n });\n }\n}\n","import type { UseMutationResult } from '@tanstack/react-query';\nimport type React from 'react';\nimport { Children, cloneElement, Fragment, isValidElement, useCallback } from 'react';\nimport {\n Controller,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n FormProvider,\n type UseFormReturn,\n} from 'react-hook-form';\nimport type { Country } from 'react-phone-number-input';\nimport { cn } from '../../../shadcn/utils';\nimport { axios } from '../../utils/axios';\nimport { type FieldMapping, mapApiErrorsToForm } from '../../utils/formHelpers';\nimport { Alert } from '../Alert';\nimport { Button } from '../Button';\nimport { Checkbox } from '../Checkbox';\nimport { CheckboxGroup } from '../CheckboxGroup';\nimport { DatePicker } from '../DatePicker';\nimport { DateTimePicker } from '../DateTimePicker';\nimport { PhoneField } from '../PhoneField';\nimport { RadioGroup } from '../RadioGroup';\nimport { Switch } from '../Switch';\nimport { UploadFile } from '../UploadFile';\n\n// Re-export Controller for explicit usage\nexport { Controller } from 'react-hook-form';\n\n/**\n * Recursively process children to wrap form fields with Controller\n * and inject loading state into submit buttons\n */\nfunction processChildren<\n TFieldValues extends FieldValues = FieldValues,\n _TContext = any,\n TTransformedValues extends FieldValues | undefined = TFieldValues,\n>(\n children: React.ReactNode,\n control: ControllerProps<TFieldValues, FieldPath<TFieldValues>, TTransformedValues>['control'],\n isSubmitting: boolean,\n setValue: UseFormReturn<TFieldValues, _TContext, TTransformedValues>['setValue'],\n onCancel?: () => void,\n reset?: UseFormReturn<TFieldValues, _TContext, TTransformedValues>['reset'],\n): React.ReactNode {\n return Children.map(children, (child) => {\n // Handle non-element children (strings, numbers, null, etc.)\n if (!isValidElement(child)) {\n return child;\n }\n\n const childProps = child.props as any;\n const isFragment = child.type === Fragment;\n\n // Handle form fields with name prop (but not Fragments)\n if (!isFragment && childProps.name && typeof childProps.name === 'string') {\n const name = childProps.name as FieldPath<TFieldValues>;\n\n return (\n <Controller\n key={name}\n control={control}\n name={name}\n render={({ field, fieldState }) => {\n // Check if this is a Checkbox, Switch, RadioGroup, or CheckboxGroup component\n const isCheckbox = child.type === Checkbox;\n const isSwitch = child.type === Switch;\n const isRadioGroup = child.type === RadioGroup;\n const isCheckboxGroup = child.type === CheckboxGroup;\n const isPhone = child.type === PhoneField;\n const isDatePicker = child.type === DatePicker;\n const isDateTimePicker = child.type === DateTimePicker;\n\n const fieldProps =\n isCheckbox || isSwitch\n ? {\n checked: field.value,\n onCheckedChange: field.onChange,\n onBlur: field.onBlur,\n ref: field.ref,\n }\n : isRadioGroup || isCheckboxGroup\n ? {\n value: field.value,\n onValueChange: field.onChange,\n onBlur: field.onBlur,\n }\n : isDatePicker\n ? {\n value: field.value,\n onValueChange: field.onChange,\n onBlur: field.onBlur,\n ref: field.ref,\n }\n : isDateTimePicker\n ? {\n value: field.value,\n onValueChange: field.onChange,\n onBlur: field.onBlur,\n ref: field.ref,\n }\n : isPhone\n ? {\n ...field,\n onCountryChange: (country: Country | undefined) => {\n setValue(`${name}Country` as FieldPath<TFieldValues>, country as any);\n },\n }\n : field;\n\n const isUploadFile = child.type === UploadFile;\n\n return cloneElement(child, {\n ...childProps,\n ...fieldProps,\n error: fieldState.error?.message || (fieldState.error ? 'Invalid' : undefined),\n name: undefined, // Remove name to avoid passing it to the underlying input\n ...(isUploadFile ? { isLoading: isSubmitting } : {}),\n });\n }}\n />\n );\n }\n\n // Handle cancel buttons - wire up form.reset() + onCancel callback\n if (childProps['data-cancel'] && onCancel && reset) {\n return cloneElement(child, {\n ...childProps,\n onClick: () => {\n reset();\n onCancel();\n },\n });\n }\n\n // Handle submit buttons - inject loading state via isLoading prop\n if (childProps.type === 'submit') {\n const isButtonElement =\n child.type === Button || (typeof child.type === 'function' && (child.type as any).displayName === 'Button');\n\n if (isButtonElement) {\n return cloneElement(child, {\n ...childProps,\n isLoading: isSubmitting,\n });\n }\n }\n\n // Handle React Fragments - process their children directly\n if (isFragment) {\n return processChildren(childProps.children, control, isSubmitting, setValue, onCancel, reset);\n }\n\n // Recurse into children for container elements (divs, FieldGroups, etc.)\n if (childProps.children != null) {\n return cloneElement(child, {\n ...childProps,\n children: processChildren(childProps.children, control, isSubmitting, setValue, onCancel, reset),\n });\n }\n\n // Return unchanged if no name prop and no children\n return child;\n });\n}\n\nexport interface FormProps<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TTransformedValues extends FieldValues | undefined = TFieldValues,\n TMutationData = unknown,\n TMutationError = Error,\n TMutationVariables = any,\n> extends Omit<React.FormHTMLAttributes<HTMLFormElement>, 'onSubmit'> {\n /**\n * The react-hook-form form instance\n */\n form: UseFormReturn<TFieldValues, TContext, TTransformedValues>;\n\n /**\n * Form submit handler - receives the transformed values if transformation is applied.\n * Optional when using `mutation` prop.\n */\n onSubmit?: Parameters<UseFormReturn<TFieldValues, TContext, TTransformedValues>['handleSubmit']>[0];\n\n /**\n * Children elements - automatically wrapped with Controller if they have a name prop\n */\n children: React.ReactNode;\n\n /**\n * Position of the root error display\n * @default 'bottom'\n */\n rootErrorPosition?: 'top' | 'bottom';\n\n /**\n * Additional classes for the root error display\n */\n rootErrorClassName?: string;\n\n /**\n * Action element rendered in the root error Alert (e.g. button or link)\n * Positioned in the top-right corner using AlertAction\n */\n rootErrorAction?: React.ReactNode;\n\n /**\n * Field mapping for automatic API error mapping\n * Maps API field names to form field names\n */\n fieldMapping?: FieldMapping;\n\n /**\n * TanStack Query mutation for automatic handling.\n * When provided, the form will use `mutateAsync` to submit data and handle errors automatically.\n * The mutation's own callbacks (onSuccess, onError, etc.) will fire automatically.\n * Form only adds `mapApiErrorsToForm` as an extra error handling layer.\n * Optional - you can use `onSubmit` instead for forms that don't use mutations.\n */\n mutation?: UseMutationResult<TMutationData, TMutationError, TMutationVariables, unknown>;\n\n /**\n * Transform form data to mutation variables before submission.\n * Only used when `mutation` prop is provided.\n */\n transformSubmit?: (\n data: TTransformedValues extends undefined ? TFieldValues : TTransformedValues,\n ) => TMutationVariables;\n\n /**\n * Automatically calls form.reset() after a successful mutation.\n * Set to false for \"edit\" forms where resetting clears pre-populated values.\n * @default true\n */\n resetOnSuccess?: boolean;\n\n /**\n * Called when a cancel button (marked with data-cancel) is clicked.\n * Form.reset() is called automatically before invoking this callback.\n */\n onCancel?: () => void;\n}\n\n/**\n * Smart Form component that automatically wraps children with Controller\n *\n * Usage with onSubmit:\n * ```tsx\n * <Form form={form} onSubmit={handleSubmit}>\n * <TextField name=\"email\" label=\"Email\" description=\"Your email address\" />\n * <PasswordField name=\"password\" label=\"Password\" />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * ```\n *\n * Usage with TanStack Query mutation:\n * ```tsx\n * const mutation = useMutation({\n * mutationFn: (data) => api.post('/login', data),\n * onSuccess: (data) => console.log('Success!', data),\n * onError: (error) => console.error('Error!', error),\n * });\n *\n * <Form\n * form={form}\n * mutation={mutation}\n * transformSubmit={(data) => ({ ...data, timestamp: Date.now() })}\n * >\n * <TextField name=\"email\" label=\"Email\" />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * ```\n */\nexport function Form<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TTransformedValues extends FieldValues | undefined = TFieldValues,\n TMutationData = unknown,\n TMutationError = Error,\n TMutationVariables = any,\n>({\n form,\n onSubmit,\n children,\n rootErrorPosition = 'bottom',\n rootErrorClassName,\n rootErrorAction,\n fieldMapping,\n mutation,\n transformSubmit,\n resetOnSuccess,\n onCancel,\n className,\n ...props\n}: FormProps<TFieldValues, TContext, TTransformedValues, TMutationData, TMutationError, TMutationVariables>) {\n // Compute isSubmitting from both form state and mutation state\n const isSubmitting = form.formState.isSubmitting || (mutation?.isPending ?? false);\n\n // Wrap the submit handler with automatic error mapping (always enabled)\n // Form only adds mapApiErrorsToForm - the mutation's own callbacks fire automatically\n const wrappedOnSubmit = useCallback(\n async (data: TTransformedValues extends undefined ? TFieldValues : TTransformedValues) => {\n // Suppress error toasts during form submission — Form handles errors inline\n const interceptorId = axios.interceptors.request.use((config) => ({\n ...config,\n showErrorToast: false,\n }));\n\n try {\n if (mutation) {\n const variables = transformSubmit ? transformSubmit(data) : data;\n // mutateAsync will trigger the mutation's onSuccess/onError callbacks\n await mutation.mutateAsync(variables as TMutationVariables);\n } else if (onSubmit) {\n await onSubmit(data as any);\n }\n\n // Reset form after successful submission (default: true)\n if (resetOnSuccess !== false) form.reset();\n } catch (error) {\n // Form's only job: map API errors to form fields\n // mapApiErrorsToForm handles axios error structure extraction internally\n mapApiErrorsToForm(error, form as any, {\n fieldMapping,\n });\n // Log error for debugging\n console.error('[Form Submission Error]', error);\n // Error is swallowed, not re-thrown (mutation's onError already fired)\n } finally {\n axios.interceptors.request.eject(interceptorId);\n }\n },\n [onSubmit, mutation, transformSubmit, fieldMapping, form, resetOnSuccess],\n );\n\n const handleSubmit = form.handleSubmit(wrappedOnSubmit as any);\n\n // Process children recursively to automatically wrap with Controller\n const processedChildren = processChildren(children, form.control, isSubmitting, form.setValue, onCancel, form.reset);\n\n const childArray = Children.toArray(processedChildren);\n const actionsIndex = childArray.findIndex(\n (child) => isValidElement(child) && (child.type as { displayName?: string })?.displayName === 'DialogActions',\n );\n const hasActions = actionsIndex !== -1;\n const bodyChildren = hasActions ? childArray.filter((_, index) => index !== actionsIndex) : processedChildren;\n const actions = hasActions ? childArray[actionsIndex] : null;\n\n const topError =\n rootErrorPosition === 'top' && form.formState.errors.root ? (\n <Alert\n variant=\"destructive\"\n title={form.formState.errors.root.type || 'Error'}\n description={form.formState.errors.root.message}\n action={rootErrorAction}\n className={cn('mb-4', rootErrorClassName)}\n />\n ) : null;\n const bottomError =\n rootErrorPosition === 'bottom' && form.formState.errors.root ? (\n <Alert\n variant=\"destructive\"\n title={form.formState.errors.root.type || 'Error'}\n description={form.formState.errors.root.message}\n action={rootErrorAction}\n className={cn('mt-4', rootErrorClassName)}\n />\n ) : null;\n\n return (\n <FormProvider {...form}>\n <form\n onSubmit={handleSubmit}\n className={cn(hasActions ? 'flex min-h-0 flex-1 flex-col' : 'space-y-4', className)}\n {...props}\n >\n {hasActions ? (\n <>\n <div className=\"min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-6 py-4 [scrollbar-gutter:stable]\">\n {topError}\n {bodyChildren}\n {bottomError}\n </div>\n {actions}\n </>\n ) : (\n <>\n {topError}\n {processedChildren}\n {bottomError}\n </>\n )}\n </form>\n </FormProvider>\n );\n}\n\nForm.displayName = 'Form';\n"],"names":["Fragment"],"mappings":";;;;;;;;;;;;;;;;AAgFO,SAAS,kBAAA,CACd,KAAA,EACA,IAAA,EACA,OAAA,GAA+B,EAAC,EAC1B;AACN,EAAA,MAAM,EAAE,YAAA,GAAe,EAAC,EAAG,YAAA,GAAe,MAAK,GAAI,OAAA;AAEnD,EAAA,IAAI,CAAC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AAA,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAU,YAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,UAAA,GAAa,8BAAA,GAAiC,aAAa,SAAS,CAAA;AAAA,MACjF,GAAG,KAAA;AAAA,MAEH,uCACC,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,wBAAA,IAAA,CAAC,KAAA,EAAA,EAAI,WAAU,iGAAA,EACZ,QAAA,EAAA;AAAA,UAAA,QAAA;AAAA,UACA,YAAA;AAAA,UACA;AAAA,SAAA,EACH,CAAA;AAAA,QACC;AAAA,OAAA,EACH,oBAEA,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,QAAA,QAAA;AAAA,QACA,iBAAA;AAAA,QACA;AAAA,OAAA,EACH;AAAA;AAAA,GAEJ,EACF,CAAA;AAEJ;AAEA,IAAA,CAAK,WAAA,GAAc,MAAA;;;;"}
package/dist/Progress.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { forwardRef } from 'react';
4
- import { c as createContextScope } from './index33.js';
5
- import { P as Primitive } from './index29.js';
4
+ import { c as createContextScope } from './index34.js';
5
+ import { P as Primitive } from './index30.js';
6
6
  import { c as cn } from './utils.js';
7
7
 
8
8
  var PROGRESS_NAME = "Progress";
@@ -8,8 +8,8 @@ import { u as useComposedRefs } from './index11.js';
8
8
  import { c as createContextScope } from './index19.js';
9
9
  import { R as Root, c as createRovingFocusGroupScope, I as Item } from './index20.js';
10
10
  import { u as useDirection } from './index22.js';
11
- import { u as useSize } from './index35.js';
12
- import { u as usePrevious } from './index34.js';
11
+ import { u as useSize } from './index36.js';
12
+ import { u as usePrevious } from './index35.js';
13
13
  import { P as Presence } from './index21.js';
14
14
 
15
15
  var RADIO_NAME = "Radio";
package/dist/Sidebar.js CHANGED
@@ -6,7 +6,7 @@ import { forwardRef, useState, useCallback, useEffect, useMemo, useRef, createCo
6
6
  import { u as useIsMobile } from './useIsMobile.js';
7
7
  import { c as cn } from './utils.js';
8
8
  import { T as TooltipProvider, a as Tooltip, b as TooltipTrigger, c as TooltipContent } from './tooltip.js';
9
- import { R as Root, P as Portal, C as Content, a as Close, b as Title, D as Description, O as Overlay } from './index30.js';
9
+ import { R as Root, P as Portal, C as Content, a as Close, b as Title, D as Description, O as Overlay } from './index31.js';
10
10
  import { X } from './x.js';
11
11
  import { D as DropdownMenu, a as DropdownMenuTrigger, b as DropdownMenuContent, e as DropdownMenuLabel, c as DropdownMenuItem } from './dropdown-menu.js';
12
12
  import { c as createLucideIcon } from './createLucideIcon.js';
package/dist/Switch.js CHANGED
@@ -5,8 +5,8 @@ import { F as Field, e as FieldLabel, c as FieldError } from './field.js';
5
5
  import { u as useControllableState, P as Primitive, c as composeEventHandlers } from './index18.js';
6
6
  import { u as useComposedRefs } from './index11.js';
7
7
  import { c as createContextScope } from './index19.js';
8
- import { u as usePrevious } from './index34.js';
9
- import { u as useSize } from './index35.js';
8
+ import { u as usePrevious } from './index35.js';
9
+ import { u as useSize } from './index36.js';
10
10
  import { c as cn } from './utils.js';
11
11
 
12
12
  var SWITCH_NAME = "Switch";
@@ -2,7 +2,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { C as Content, L as List, T as Trigger, R as Root2 } from './index17.js';
3
3
  import { useId, useState } from 'react';
4
4
  import { c as cn } from './utils.js';
5
- import { L as LayoutGroup } from './index37.js';
5
+ import { L as LayoutGroup } from './index38.js';
6
6
  import { m as motion, A as AnimatePresence } from './proxy.js';
7
7
  import { S as Skeleton } from './Skeleton.js';
8
8
 
package/dist/Toggle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { R as Root } from './index32.js';
2
+ import { R as Root } from './index33.js';
3
3
  import { c as cva } from './index8.js';
4
4
  import { c as cn } from './utils.js';
5
5
 
@@ -1552,6 +1552,10 @@ select:-webkit-autofill:active {
1552
1552
  margin-inline: calc(var(--spacing) * -1);
1553
1553
  }
1554
1554
 
1555
+ .-mx-6 {
1556
+ margin-inline: calc(var(--spacing) * -6);
1557
+ }
1558
+
1555
1559
  .mx-0 {
1556
1560
  margin-inline: calc(var(--spacing) * 0);
1557
1561
  }
@@ -1972,14 +1976,14 @@ select:-webkit-autofill:active {
1972
1976
  max-height: calc(var(--spacing) * 60);
1973
1977
  }
1974
1978
 
1975
- .max-h-64 {
1976
- max-height: calc(var(--spacing) * 64);
1977
- }
1978
-
1979
1979
  .max-h-80 {
1980
1980
  max-height: calc(var(--spacing) * 80);
1981
1981
  }
1982
1982
 
1983
+ .max-h-\[95vh\] {
1984
+ max-height: 95vh;
1985
+ }
1986
+
1983
1987
  .max-h-\[300px\] {
1984
1988
  max-height: 300px;
1985
1989
  }
@@ -2004,6 +2008,10 @@ select:-webkit-autofill:active {
2004
2008
  min-height: calc(var(--spacing) * 16);
2005
2009
  }
2006
2010
 
2011
+ .min-h-32 {
2012
+ min-height: calc(var(--spacing) * 32);
2013
+ }
2014
+
2007
2015
  .min-h-72 {
2008
2016
  min-height: calc(var(--spacing) * 72);
2009
2017
  }
@@ -2666,6 +2674,10 @@ select:-webkit-autofill:active {
2666
2674
  justify-content: flex-start;
2667
2675
  }
2668
2676
 
2677
+ .gap-0 {
2678
+ gap: calc(var(--spacing) * 0);
2679
+ }
2680
+
2669
2681
  .gap-0\.5 {
2670
2682
  gap: calc(var(--spacing) * .5);
2671
2683
  }
@@ -2855,6 +2867,10 @@ select:-webkit-autofill:active {
2855
2867
  overscroll-behavior: auto;
2856
2868
  }
2857
2869
 
2870
+ .overscroll-contain {
2871
+ overscroll-behavior: contain;
2872
+ }
2873
+
2858
2874
  .rounded {
2859
2875
  border-radius: .25rem;
2860
2876
  }
@@ -3446,7 +3462,17 @@ select:-webkit-autofill:active {
3446
3462
  background-color: #0000;
3447
3463
  }
3448
3464
 
3449
- .bg-warning, .bg-warning\/15 {
3465
+ .bg-warning, .bg-warning\/10 {
3466
+ background-color: var(--warning);
3467
+ }
3468
+
3469
+ @supports (color: color-mix(in lab, red, red)) {
3470
+ .bg-warning\/10 {
3471
+ background-color: color-mix(in oklab, var(--warning) 10%, transparent);
3472
+ }
3473
+ }
3474
+
3475
+ .bg-warning\/15 {
3450
3476
  background-color: var(--warning);
3451
3477
  }
3452
3478
 
@@ -3662,6 +3688,10 @@ select:-webkit-autofill:active {
3662
3688
  padding-top: calc(var(--spacing) * 4);
3663
3689
  }
3664
3690
 
3691
+ .pt-6 {
3692
+ padding-top: calc(var(--spacing) * 6);
3693
+ }
3694
+
3665
3695
  .pt-16 {
3666
3696
  padding-top: calc(var(--spacing) * 16);
3667
3697
  }
@@ -3706,6 +3736,10 @@ select:-webkit-autofill:active {
3706
3736
  padding-bottom: calc(var(--spacing) * 4);
3707
3737
  }
3708
3738
 
3739
+ .pb-6 {
3740
+ padding-bottom: calc(var(--spacing) * 6);
3741
+ }
3742
+
3709
3743
  .pl-2 {
3710
3744
  padding-left: calc(var(--spacing) * 2);
3711
3745
  }
@@ -4366,6 +4400,10 @@ select:-webkit-autofill:active {
4366
4400
  -moz-appearance: textfield;
4367
4401
  }
4368
4402
 
4403
+ .\[scrollbar-gutter\:stable\] {
4404
+ scrollbar-gutter: stable;
4405
+ }
4406
+
4369
4407
  .\[text-decoration\:underline_line-through\] {
4370
4408
  text-decoration: underline line-through;
4371
4409
  }
package/dist/cells.js CHANGED
@@ -21822,53 +21822,55 @@ function ManageViewsDialog({ tableSlug, open, onClose }) {
21822
21822
  if (!v) onClose();
21823
21823
  }
21824
21824
  };
21825
- return /* @__PURE__ */ jsx(
21825
+ return /* @__PURE__ */ jsxs(
21826
21826
  Dialog,
21827
21827
  {
21828
21828
  handle,
21829
21829
  icon: Settings2,
21830
21830
  title: "Manage Views",
21831
21831
  description: "Share or delete saved views for this table.",
21832
- footer: /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: onClose, children: "Close" }),
21833
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 py-2 max-h-64 overflow-y-auto", children: [
21834
- views.length === 0 && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground text-center py-4", children: "No saved views yet." }),
21835
- views.map((view) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded-md px-3 py-2 hover:bg-accent/50", children: [
21836
- /* @__PURE__ */ jsx("span", { className: "text-sm truncate", children: view.name }),
21837
- view.isOwn && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 shrink-0", children: [
21838
- /* @__PURE__ */ jsx(
21839
- Button,
21840
- {
21841
- variant: "ghost",
21842
- size: "icon",
21843
- className: "size-7 text-muted-foreground hover:text-foreground",
21844
- title: view.isShared ? "Make private" : "Share with everyone",
21845
- onClick: () => shareMut.mutate({ id: view.id, isShared: !view.isShared }),
21846
- disabled: shareMut.isPending,
21847
- children: view.isShared ? /* @__PURE__ */ jsx(EyeOff, { className: "size-4" }) : /* @__PURE__ */ jsx(Share2, { className: "size-4" })
21848
- }
21849
- ),
21850
- /* @__PURE__ */ jsx(
21851
- Button,
21852
- {
21853
- variant: "ghost",
21854
- size: "icon",
21855
- className: "size-7 text-destructive hover:text-destructive",
21856
- onClick: async () => {
21857
- const confirmed = await confirm({
21858
- title: `Delete "${view.name}"?`,
21859
- description: "This view will be permanently removed.",
21860
- confirmLabel: "Delete",
21861
- variant: "destructive"
21862
- });
21863
- if (confirmed) deleteMut.mutate(view.id);
21864
- },
21865
- disabled: deleteMut.isPending,
21866
- children: /* @__PURE__ */ jsx(Trash2, { className: "size-4" })
21867
- }
21868
- )
21869
- ] })
21870
- ] }, view.id))
21871
- ] })
21832
+ children: [
21833
+ /* @__PURE__ */ jsxs("div", { className: "flex max-h-80 min-h-32 flex-col gap-1 overflow-y-auto py-1", children: [
21834
+ views.length === 0 && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground text-center py-4", children: "No saved views yet." }),
21835
+ views.map((view) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded-md px-3 py-2 hover:bg-accent/50", children: [
21836
+ /* @__PURE__ */ jsx("span", { className: "text-sm truncate", children: view.name }),
21837
+ view.isOwn && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 shrink-0", children: [
21838
+ /* @__PURE__ */ jsx(
21839
+ Button,
21840
+ {
21841
+ variant: "ghost",
21842
+ size: "icon",
21843
+ className: "size-7 text-muted-foreground hover:text-foreground",
21844
+ title: view.isShared ? "Make private" : "Share with everyone",
21845
+ onClick: () => shareMut.mutate({ id: view.id, isShared: !view.isShared }),
21846
+ disabled: shareMut.isPending,
21847
+ children: view.isShared ? /* @__PURE__ */ jsx(EyeOff, { className: "size-4" }) : /* @__PURE__ */ jsx(Share2, { className: "size-4" })
21848
+ }
21849
+ ),
21850
+ /* @__PURE__ */ jsx(
21851
+ Button,
21852
+ {
21853
+ variant: "ghost",
21854
+ size: "icon",
21855
+ className: "size-7 text-destructive hover:text-destructive",
21856
+ onClick: async () => {
21857
+ const confirmed = await confirm({
21858
+ title: `Delete "${view.name}"?`,
21859
+ description: "This view will be permanently removed.",
21860
+ confirmLabel: "Delete",
21861
+ variant: "destructive"
21862
+ });
21863
+ if (confirmed) deleteMut.mutate(view.id);
21864
+ },
21865
+ disabled: deleteMut.isPending,
21866
+ children: /* @__PURE__ */ jsx(Trash2, { className: "size-4" })
21867
+ }
21868
+ )
21869
+ ] })
21870
+ ] }, view.id))
21871
+ ] }),
21872
+ /* @__PURE__ */ jsx("div", { className: "-mx-6 mt-4 flex flex-col-reverse gap-2 border-t px-6 pt-4 sm:flex-row sm:justify-end", children: /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: onClose, children: "Close" }) })
21873
+ ]
21872
21874
  }
21873
21875
  );
21874
21876
  }
@@ -22056,9 +22058,10 @@ function DataTableViewTabs({ slug }) {
22056
22058
  {
22057
22059
  handle: dirtyGuard,
22058
22060
  icon: TriangleAlert,
22061
+ iconVariant: "warning",
22059
22062
  title: "Unsaved Changes",
22060
22063
  description: "This view has unsaved changes. What would you like to do?",
22061
- footer: /* @__PURE__ */ jsxs("div", { className: "flex gap-2 justify-end w-full", children: [
22064
+ children: /* @__PURE__ */ jsxs("div", { className: "flex gap-2 justify-end w-full", children: [
22062
22065
  /* @__PURE__ */ jsx(
22063
22066
  Button,
22064
22067
  {
@@ -22109,7 +22112,7 @@ const densityClasses = {
22109
22112
  };
22110
22113
  const MODE_HEIGHTS = {
22111
22114
  page: "calc(100vh - 280px)",
22112
- tab: "calc(100vh - 328px)",
22115
+ tab: "calc(100vh - 320px)",
22113
22116
  compact: "calc(100vh - 570px)"
22114
22117
  };
22115
22118
  function buildNoResultsDescription(flags) {