@skybin-tech/nebula-ui 0.0.20 → 0.0.21
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/cjs/components/Alert/Alert.cjs +1 -0
- package/dist/cjs/components/Alert/Alert.cjs.map +1 -1
- package/dist/cjs/components/Avatar/Avatar.cjs +1 -0
- package/dist/cjs/components/Avatar/Avatar.cjs.map +1 -1
- package/dist/cjs/components/Badge/Badge.cjs +1 -0
- package/dist/cjs/components/Badge/Badge.cjs.map +1 -1
- package/dist/cjs/components/Button/Button.cjs +1 -0
- package/dist/cjs/components/Button/Button.cjs.map +1 -1
- package/dist/cjs/components/Card/Card.cjs +1 -0
- package/dist/cjs/components/Card/Card.cjs.map +1 -1
- package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs +1 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs.map +1 -1
- package/dist/cjs/components/Form/Checkbox.cjs +1 -0
- package/dist/cjs/components/Form/Checkbox.cjs.map +1 -1
- package/dist/cjs/components/Form/Form.cjs +1 -0
- package/dist/cjs/components/Form/Form.cjs.map +1 -1
- package/dist/cjs/components/Form/Radio.cjs +1 -0
- package/dist/cjs/components/Form/Radio.cjs.map +1 -1
- package/dist/cjs/components/Form/Select.cjs +1 -0
- package/dist/cjs/components/Form/Select.cjs.map +1 -1
- package/dist/cjs/components/Form/Switch.cjs +1 -0
- package/dist/cjs/components/Form/Switch.cjs.map +1 -1
- package/dist/cjs/components/Form/TextArea.cjs +1 -0
- package/dist/cjs/components/Form/TextArea.cjs.map +1 -1
- package/dist/cjs/components/Form/TextBox.cjs +1 -0
- package/dist/cjs/components/Form/TextBox.cjs.map +1 -1
- package/dist/cjs/components/Form/context.cjs +1 -0
- package/dist/cjs/components/Form/context.cjs.map +1 -1
- package/dist/cjs/components/Form/hooks.cjs +1 -0
- package/dist/cjs/components/Form/hooks.cjs.map +1 -1
- package/dist/cjs/components/Form/variants.cjs +1 -0
- package/dist/cjs/components/Form/variants.cjs.map +1 -1
- package/dist/cjs/components/Input/Input.cjs +1 -0
- package/dist/cjs/components/Input/Input.cjs.map +1 -1
- package/dist/cjs/components/Label/Label.cjs +1 -0
- package/dist/cjs/components/Label/Label.cjs.map +1 -1
- package/dist/cjs/components/Separator/Separator.cjs +1 -0
- package/dist/cjs/components/Separator/Separator.cjs.map +1 -1
- package/dist/cjs/components/Tabs/Tabs.cjs +1 -0
- package/dist/cjs/components/Tabs/Tabs.cjs.map +1 -1
- package/dist/cjs/components/Textarea/Textarea.cjs +1 -0
- package/dist/cjs/components/Textarea/Textarea.cjs.map +1 -1
- package/dist/cjs/hooks/useDebounce.cjs +1 -0
- package/dist/cjs/hooks/useDebounce.cjs.map +1 -1
- package/dist/cjs/hooks/useToast.cjs +1 -0
- package/dist/cjs/hooks/useToast.cjs.map +1 -1
- package/dist/cjs/hooks/useToggle.cjs +1 -0
- package/dist/cjs/hooks/useToggle.cjs.map +1 -1
- package/dist/components/Alert/Alert.js +1 -0
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/Avatar/Avatar.js +1 -0
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Badge/Badge.js +1 -0
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Button/Button.js +1 -0
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Card/Card.js +1 -0
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/components/Form/Checkbox.js +1 -0
- package/dist/components/Form/Checkbox.js.map +1 -1
- package/dist/components/Form/Form.js +1 -0
- package/dist/components/Form/Form.js.map +1 -1
- package/dist/components/Form/Radio.js +1 -0
- package/dist/components/Form/Radio.js.map +1 -1
- package/dist/components/Form/Select.js +1 -0
- package/dist/components/Form/Select.js.map +1 -1
- package/dist/components/Form/Switch.js +1 -0
- package/dist/components/Form/Switch.js.map +1 -1
- package/dist/components/Form/TextArea.js +1 -0
- package/dist/components/Form/TextArea.js.map +1 -1
- package/dist/components/Form/TextBox.js +1 -0
- package/dist/components/Form/TextBox.js.map +1 -1
- package/dist/components/Form/context.js +1 -0
- package/dist/components/Form/context.js.map +1 -1
- package/dist/components/Form/hooks.js +1 -0
- package/dist/components/Form/hooks.js.map +1 -1
- package/dist/components/Form/variants.js +1 -0
- package/dist/components/Form/variants.js.map +1 -1
- package/dist/components/Input/Input.js +1 -0
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Label/Label.js +1 -0
- package/dist/components/Label/Label.js.map +1 -1
- package/dist/components/Separator/Separator.js +1 -0
- package/dist/components/Separator/Separator.js.map +1 -1
- package/dist/components/Tabs/Tabs.js +1 -0
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Textarea/Textarea.js +1 -0
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/hooks/useDebounce.js +1 -0
- package/dist/hooks/useDebounce.js.map +1 -1
- package/dist/hooks/useToast.js +1 -0
- package/dist/hooks/useToast.js.map +1 -1
- package/dist/hooks/useToggle.js +1 -0
- package/dist/hooks/useToggle.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextBox.cjs","sources":["../../../../src/components/Form/TextBox.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, useId, useContext, useEffect } from \"react\";\nimport type { InputHTMLAttributes, ReactNode } from \"react\";\nimport { useController, useFormContext as useRHFFormContext, type FieldValues, type FieldPath, type Control } from \"react-hook-form\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../utils/cn\";\nimport { FormConfigContext, type FormConfig, type FieldValidationRules } from \"../Form/context\";\nimport { labelVariants } from \"./variants\";\nimport { TextBoxPrimitive } from \"../../primitives/textbox\";\nimport { Label } from \"../../primitives/label\";\nimport { X } from \"lucide-react\";\n\nconst textBoxVariants = cva(\n \"\",\n {\n variants: {\n size: {\n sm: \"h-8 text-xs px-2\",\n md: \"h-10 text-sm px-3\",\n lg: \"h-12 text-base px-4\",\n },\n variant: {\n default: \"border-input focus-visible:ring-ring\",\n error: \"border-destructive focus-visible:ring-destructive\",\n success: \"border-green-500 focus-visible:ring-green-500\",\n },\n },\n defaultVariants: {\n size: \"md\",\n variant: \"default\",\n },\n }\n);\n\n/**\n * Validation rule with optional custom message\n */\ntype ValidationRule<T> = T | { value: T; message: string };\n\nexport interface TextBoxProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"name\" | \"prefix\" | \"pattern\" | \"required\" | \"minLength\" | \"maxLength\">,\n VariantProps<typeof textBoxVariants> {\n /** Field name - required for form integration */\n name: TName;\n /** Label text for the input */\n label?: string;\n /** Helper text displayed below the input */\n helperText?: string;\n /** Whether to show the error message */\n showError?: boolean;\n /** Custom error message (overrides form error) */\n error?: string;\n /** Whether the input should take full width */\n fullWidth?: boolean;\n /** Prefix element */\n prefix?: ReactNode;\n /** Suffix element */\n suffix?: ReactNode;\n /** Allow clear button */\n allowClear?: boolean;\n /** Callback when clear is clicked */\n onClear?: () => void;\n /** External control (for use outside Form) */\n control?: Control<TFieldValues>;\n \n // Validation props\n /** Field is required */\n required?: boolean | string;\n /** Minimum length for strings */\n minLength?: ValidationRule<number>;\n /** Maximum length for strings */\n maxLength?: ValidationRule<number>;\n /** Minimum value for numbers */\n minValue?: ValidationRule<number>;\n /** Maximum value for numbers */\n maxValue?: ValidationRule<number>;\n /** Regex pattern for validation */\n pattern?: ValidationRule<RegExp>;\n /** Email validation */\n email?: boolean | string;\n /** URL validation */\n url?: boolean | string;\n /** Custom validation function */\n validate?: (value: unknown) => boolean | string | Promise<boolean | string>;\n}\n\n/**\n * TextBox component with form integration and automatic validation registration\n * \n * This is a wrapper around the shadcn/ui Input primitive that adds:\n * - Form integration with react-hook-form\n * - Automatic validation registration\n * - Label, helper text, and error message support\n * - Prefix/suffix elements\n * - Clear button functionality\n * \n * @example\n * ```tsx\n * // Inside a Form component - validation is automatically registered\n * <Form onSubmit={handleSubmit} defaultValues={{ username: \"\", email: \"\" }}>\n * <TextBox name=\"username\" label=\"Username\" required minLength={3} maxLength={50} />\n * <TextBox name=\"email\" label=\"Email\" type=\"email\" required email />\n * <TextBox name=\"website\" label=\"Website\" url />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * ```\n */\nfunction TextBoxInner<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>(\n {\n name,\n label,\n helperText,\n showError = true,\n error: customError,\n size,\n variant,\n fullWidth = true,\n className,\n disabled,\n prefix,\n suffix,\n allowClear,\n onClear,\n id: providedId,\n control: externalControl,\n // Validation props\n required,\n minLength,\n maxLength,\n minValue,\n maxValue,\n pattern,\n email,\n url,\n validate,\n ...props\n }: TextBoxProps<TFieldValues, TName>,\n ref: React.ForwardedRef<HTMLInputElement>\n) {\n const generatedId = useId();\n const inputId = providedId ?? generatedId;\n \n // Try to get form context\n const formConfigContext = useContext(FormConfigContext);\n const formConfig: FormConfig = formConfigContext ?? {};\n\n // Get form context from react-hook-form\n const rhfContext = useRHFFormContext<TFieldValues>();\n const control = externalControl ?? rhfContext?.control;\n\n // Destructure stable function references so the effect doesn't depend on the\n // context object identity (which changes every render due to inline construction).\n const registerFieldValidation = formConfigContext?.registerFieldValidation;\n const unregisterFieldValidation = formConfigContext?.unregisterFieldValidation;\n\n // Register validation rules with the form\n useEffect(() => {\n if (registerFieldValidation) {\n const rules: FieldValidationRules = {};\n\n if (required !== undefined) rules.required = required;\n if (minLength !== undefined) rules.minLength = minLength;\n if (maxLength !== undefined) rules.maxLength = maxLength;\n if (minValue !== undefined) rules.min = minValue;\n if (maxValue !== undefined) rules.max = maxValue;\n if (pattern !== undefined) rules.pattern = pattern;\n if (email !== undefined) rules.email = email;\n if (url !== undefined) rules.url = url;\n if (validate !== undefined) rules.validate = validate;\n\n // Determine field type and auto-infer rules from input type\n const inputType = props.type ?? \"text\";\n let fieldType: \"string\" | \"number\" | \"date\" = \"string\";\n\n if (inputType === \"number\") {\n fieldType = \"number\";\n } else if (inputType === \"date\") {\n fieldType = \"date\";\n } else if (inputType === \"email\" && rules.email === undefined) {\n rules.email = true;\n } else if (inputType === \"url\" && rules.url === undefined) {\n rules.url = true;\n } else if (inputType === \"tel\" && rules.pattern === undefined) {\n rules.pattern = { value: /^\\+?[\\d\\s\\-().]{7,}$/, message: \"Invalid phone number\" };\n }\n\n registerFieldValidation({\n name: name as string,\n type: fieldType,\n rules,\n });\n\n return () => {\n unregisterFieldValidation?.(name as string);\n };\n }\n }, [\n registerFieldValidation,\n unregisterFieldValidation,\n name,\n required,\n minLength,\n maxLength,\n minValue,\n maxValue,\n pattern,\n email,\n url,\n validate,\n props.type,\n ]);\n\n // Use controller for form integration\n const { field, fieldState } = useController<TFieldValues, TName>({\n name,\n control,\n });\n\n const fieldError = fieldState.error?.message;\n const errorMessage = customError ?? fieldError;\n const hasError = !!errorMessage;\n \n // Merge sizes - prop takes precedence over form config\n const effectiveSize = size ?? formConfig.size ?? \"md\";\n const effectiveDisabled = disabled ?? formConfig.disabled;\n \n // Determine variant based on error state\n const effectiveVariant = hasError ? \"error\" : variant;\n\n const handleClear = () => {\n field.onChange(\"\");\n onClear?.();\n };\n\n return (\n <div className={cn(\"space-y-1.5\", fullWidth && \"w-full\")}>\n {label && (\n <Label\n htmlFor={inputId}\n className={labelVariants({ required: !!required })}\n >\n {label}\n {formConfig.colon && \":\"}\n </Label>\n )}\n \n <div className=\"relative\">\n {prefix && (\n <div className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\">\n {prefix}\n </div>\n )}\n \n <TextBoxPrimitive\n {...props}\n {...field}\n ref={(node) => {\n // Handle both refs\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n field.ref(node);\n }}\n id={inputId}\n disabled={effectiveDisabled}\n aria-invalid={hasError}\n aria-describedby={\n hasError\n ? `${inputId}-error`\n : helperText\n ? `${inputId}-helper`\n : undefined\n }\n className={cn(\n textBoxVariants({ size: effectiveSize, variant: effectiveVariant }),\n prefix && \"pl-10\",\n (suffix || allowClear) && \"pr-10\",\n className\n )}\n />\n\n {(suffix || (allowClear && field.value)) && (\n <div className=\"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-1\">\n {allowClear && field.value && (\n <button\n type=\"button\"\n onClick={handleClear}\n className=\"text-muted-foreground hover:text-foreground transition-colors\"\n tabIndex={-1}\n >\n <X className=\"h-4 w-4\" />\n </button>\n )}\n {suffix && (\n <span className=\"text-muted-foreground\">{suffix}</span>\n )}\n </div>\n )}\n </div>\n\n {showError && hasError && (\n <p\n id={`${inputId}-error`}\n className=\"text-sm text-destructive\"\n role=\"alert\"\n >\n {errorMessage}\n </p>\n )}\n \n {helperText && !hasError && (\n <p\n id={`${inputId}-helper`}\n className=\"text-sm text-muted-foreground\"\n >\n {helperText}\n </p>\n )}\n </div>\n );\n}\n\n// Use forwardRef with generic support\nexport const TextBox = forwardRef(TextBoxInner) as <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>(\n props: TextBoxProps<TFieldValues, TName> & { ref?: React.ForwardedRef<HTMLInputElement> }\n) => React.ReactElement;\n\n(TextBox as React.FC).displayName = \"TextBox\";\n"],"names":["cva","label","useId","useContext","FormConfigContext","useRHFFormContext","useEffect","useController","cn","jsxs","Label","labelVariants","jsx","TextBoxPrimitive","X","forwardRef"],"mappings":";;;;;;;;;;;;AAaA,MAAM,kBAAkBA,uBAAAA;AAAAA,EACtB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA;AAAA,MAEN,SAAS;AAAA,QACP,SAAS;AAAA,QACT,OAAO;A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O;AAAA,QACd,WAAU;AAAA,QACV,MAAK;AAAA,QAEJ,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAIJ,cAAc,CAAC,YACdA,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAI,GAAG,OAAO;AAAA,QACd,WAAU;AAAA,QAET,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GAEJ;AAEJ;AAGO,MAAM,UAAUG,MAAAA,WAAW,YAAY;AAO7C,QAAqB,cAAc;;"}
|
|
1
|
+
{"version":3,"file":"TextBox.cjs","sources":["../../../../src/components/Form/TextBox.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, useId, useContext, useEffect } from \"react\";\nimport type { InputHTMLAttributes, ReactNode } from \"react\";\nimport { useController, useFormContext as useRHFFormContext, type FieldValues, type FieldPath, type Control } from \"react-hook-form\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../utils/cn\";\nimport { FormConfigContext, type FormConfig, type FieldValidationRules } from \"../Form/context\";\nimport { labelVariants } from \"./variants\";\nimport { TextBoxPrimitive } from \"../../primitives/textbox\";\nimport { Label } from \"../../primitives/label\";\nimport { X } from \"lucide-react\";\n\nconst textBoxVariants = cva(\n \"\",\n {\n variants: {\n size: {\n sm: \"h-8 text-xs px-2\",\n md: \"h-10 text-sm px-3\",\n lg: \"h-12 text-base px-4\",\n },\n variant: {\n default: \"border-input focus-visible:ring-ring\",\n error: \"border-destructive focus-visible:ring-destructive\",\n success: \"border-green-500 focus-visible:ring-green-500\",\n },\n },\n defaultVariants: {\n size: \"md\",\n variant: \"default\",\n },\n }\n);\n\n/**\n * Validation rule with optional custom message\n */\ntype ValidationRule<T> = T | { value: T; message: string };\n\nexport interface TextBoxProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"name\" | \"prefix\" | \"pattern\" | \"required\" | \"minLength\" | \"maxLength\">,\n VariantProps<typeof textBoxVariants> {\n /** Field name - required for form integration */\n name: TName;\n /** Label text for the input */\n label?: string;\n /** Helper text displayed below the input */\n helperText?: string;\n /** Whether to show the error message */\n showError?: boolean;\n /** Custom error message (overrides form error) */\n error?: string;\n /** Whether the input should take full width */\n fullWidth?: boolean;\n /** Prefix element */\n prefix?: ReactNode;\n /** Suffix element */\n suffix?: ReactNode;\n /** Allow clear button */\n allowClear?: boolean;\n /** Callback when clear is clicked */\n onClear?: () => void;\n /** External control (for use outside Form) */\n control?: Control<TFieldValues>;\n \n // Validation props\n /** Field is required */\n required?: boolean | string;\n /** Minimum length for strings */\n minLength?: ValidationRule<number>;\n /** Maximum length for strings */\n maxLength?: ValidationRule<number>;\n /** Minimum value for numbers */\n minValue?: ValidationRule<number>;\n /** Maximum value for numbers */\n maxValue?: ValidationRule<number>;\n /** Regex pattern for validation */\n pattern?: ValidationRule<RegExp>;\n /** Email validation */\n email?: boolean | string;\n /** URL validation */\n url?: boolean | string;\n /** Custom validation function */\n validate?: (value: unknown) => boolean | string | Promise<boolean | string>;\n}\n\n/**\n * TextBox component with form integration and automatic validation registration\n * \n * This is a wrapper around the shadcn/ui Input primitive that adds:\n * - Form integration with react-hook-form\n * - Automatic validation registration\n * - Label, helper text, and error message support\n * - Prefix/suffix elements\n * - Clear button functionality\n * \n * @example\n * ```tsx\n * // Inside a Form component - validation is automatically registered\n * <Form onSubmit={handleSubmit} defaultValues={{ username: \"\", email: \"\" }}>\n * <TextBox name=\"username\" label=\"Username\" required minLength={3} maxLength={50} />\n * <TextBox name=\"email\" label=\"Email\" type=\"email\" required email />\n * <TextBox name=\"website\" label=\"Website\" url />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * ```\n */\nfunction TextBoxInner<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>(\n {\n name,\n label,\n helperText,\n showError = true,\n error: customError,\n size,\n variant,\n fullWidth = true,\n className,\n disabled,\n prefix,\n suffix,\n allowClear,\n onClear,\n id: providedId,\n control: externalControl,\n // Validation props\n required,\n minLength,\n maxLength,\n minValue,\n maxValue,\n pattern,\n email,\n url,\n validate,\n ...props\n }: TextBoxProps<TFieldValues, TName>,\n ref: React.ForwardedRef<HTMLInputElement>\n) {\n const generatedId = useId();\n const inputId = providedId ?? generatedId;\n \n // Try to get form context\n const formConfigContext = useContext(FormConfigContext);\n const formConfig: FormConfig = formConfigContext ?? {};\n\n // Get form context from react-hook-form\n const rhfContext = useRHFFormContext<TFieldValues>();\n const control = externalControl ?? rhfContext?.control;\n\n // Destructure stable function references so the effect doesn't depend on the\n // context object identity (which changes every render due to inline construction).\n const registerFieldValidation = formConfigContext?.registerFieldValidation;\n const unregisterFieldValidation = formConfigContext?.unregisterFieldValidation;\n\n // Register validation rules with the form\n useEffect(() => {\n if (registerFieldValidation) {\n const rules: FieldValidationRules = {};\n\n if (required !== undefined) rules.required = required;\n if (minLength !== undefined) rules.minLength = minLength;\n if (maxLength !== undefined) rules.maxLength = maxLength;\n if (minValue !== undefined) rules.min = minValue;\n if (maxValue !== undefined) rules.max = maxValue;\n if (pattern !== undefined) rules.pattern = pattern;\n if (email !== undefined) rules.email = email;\n if (url !== undefined) rules.url = url;\n if (validate !== undefined) rules.validate = validate;\n\n // Determine field type and auto-infer rules from input type\n const inputType = props.type ?? \"text\";\n let fieldType: \"string\" | \"number\" | \"date\" = \"string\";\n\n if (inputType === \"number\") {\n fieldType = \"number\";\n } else if (inputType === \"date\") {\n fieldType = \"date\";\n } else if (inputType === \"email\" && rules.email === undefined) {\n rules.email = true;\n } else if (inputType === \"url\" && rules.url === undefined) {\n rules.url = true;\n } else if (inputType === \"tel\" && rules.pattern === undefined) {\n rules.pattern = { value: /^\\+?[\\d\\s\\-().]{7,}$/, message: \"Invalid phone number\" };\n }\n\n registerFieldValidation({\n name: name as string,\n type: fieldType,\n rules,\n });\n\n return () => {\n unregisterFieldValidation?.(name as string);\n };\n }\n }, [\n registerFieldValidation,\n unregisterFieldValidation,\n name,\n required,\n minLength,\n maxLength,\n minValue,\n maxValue,\n pattern,\n email,\n url,\n validate,\n props.type,\n ]);\n\n // Use controller for form integration\n const { field, fieldState } = useController<TFieldValues, TName>({\n name,\n control,\n });\n\n const fieldError = fieldState.error?.message;\n const errorMessage = customError ?? fieldError;\n const hasError = !!errorMessage;\n \n // Merge sizes - prop takes precedence over form config\n const effectiveSize = size ?? formConfig.size ?? \"md\";\n const effectiveDisabled = disabled ?? formConfig.disabled;\n \n // Determine variant based on error state\n const effectiveVariant = hasError ? \"error\" : variant;\n\n const handleClear = () => {\n field.onChange(\"\");\n onClear?.();\n };\n\n return (\n <div className={cn(\"space-y-1.5\", fullWidth && \"w-full\")}>\n {label && (\n <Label\n htmlFor={inputId}\n className={labelVariants({ required: !!required })}\n >\n {label}\n {formConfig.colon && \":\"}\n </Label>\n )}\n \n <div className=\"relative\">\n {prefix && (\n <div className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\">\n {prefix}\n </div>\n )}\n \n <TextBoxPrimitive\n {...props}\n {...field}\n ref={(node) => {\n // Handle both refs\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n field.ref(node);\n }}\n id={inputId}\n disabled={effectiveDisabled}\n aria-invalid={hasError}\n aria-describedby={\n hasError\n ? `${inputId}-error`\n : helperText\n ? `${inputId}-helper`\n : undefined\n }\n className={cn(\n textBoxVariants({ size: effectiveSize, variant: effectiveVariant }),\n prefix && \"pl-10\",\n (suffix || allowClear) && \"pr-10\",\n className\n )}\n />\n\n {(suffix || (allowClear && field.value)) && (\n <div className=\"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-1\">\n {allowClear && field.value && (\n <button\n type=\"button\"\n onClick={handleClear}\n className=\"text-muted-foreground hover:text-foreground transition-colors\"\n tabIndex={-1}\n >\n <X className=\"h-4 w-4\" />\n </button>\n )}\n {suffix && (\n <span className=\"text-muted-foreground\">{suffix}</span>\n )}\n </div>\n )}\n </div>\n\n {showError && hasError && (\n <p\n id={`${inputId}-error`}\n className=\"text-sm text-destructive\"\n role=\"alert\"\n >\n {errorMessage}\n </p>\n )}\n \n {helperText && !hasError && (\n <p\n id={`${inputId}-helper`}\n className=\"text-sm text-muted-foreground\"\n >\n {helperText}\n </p>\n )}\n </div>\n );\n}\n\n// Use forwardRef with generic support\nexport const TextBox = forwardRef(TextBoxInner) as <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>(\n props: TextBoxProps<TFieldValues, TName> & { ref?: React.ForwardedRef<HTMLInputElement> }\n) => React.ReactElement;\n\n(TextBox as React.FC).displayName = \"TextBox\";\n"],"names":["cva","label","useId","useContext","FormConfigContext","useRHFFormContext","useEffect","useController","cn","jsxs","Label","labelVariants","jsx","TextBoxPrimitive","X","forwardRef"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,kBAAkBA,uBAAAA;AAAAA,EACtB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA;AAAA,MAEN,SAAS;AAAA,QACP,SAAS;AAAA,QACT,OAAO;AAAA,QACP,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,IAEF,iBAAiB;AAAA,MACf,MAAM;AAAA,MACN,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ;AA6EA,SAAS,aAIP;AAAA,EACE;AAAA,EAAA,OACAC;AAAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,IAAI;AAAA,EACJ,SAAS;AAAA;AAAA,EAET;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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ACA,IAAI;AAAA,UACJ,UAAU;AAAA,UACV,gBAAc;AAAA,UACd,oBACE,WACI,GAAG,OAAO,WACV,aACA,GAAG,OAAO,YACV;AAAA,UAEN,WAAWL,GAAAA;AAAAA,YACT,gBAAgB,EAAE,MAAM,eAAe,SAAS,kBAAkB;AAAA,YAClE,UAAU;AAAA,aACT,UAAU,eAAe;AAAA,YAC1B;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,OAGA,UAAW,cAAc,MAAM,UAC/BC,gCAAC,OAAA,EAAI,WAAU,qEACZ,UAAA;AAAA,QAAA,cAAc,MAAM,SACnBG,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAS;AAAA,YACT,WAAU;AAAA,YACV,UAAU;AAAA,YAEV,UAAAA,2BAAAA,IAACE,YAAAA,GAAA,EAAE,WAAU,UAAA,CAAU;AAAA,UAAA;AAAA,QAAA;AAAA,QAG1B,UACCF,2BAAAA,IAAC,QAAA,EAAK,WAAU,yBAAyB,UAAA,OAAA,CAAO;AAAA,MAAA,EAAA,CAEpD;AAAA,IAAA,GAEJ;AAAA,IAEC,aAAa,YACZA,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAI,GAAG,OAAO;AAAA,QACd,WAAU;AAAA,QACV,MAAK;AAAA,QAEJ,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAIJ,cAAc,CAAC,YACdA,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAI,GAAG,OAAO;AAAA,QACd,WAAU;AAAA,QAET,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GAEJ;AAEJ;AAGO,MAAM,UAAUG,MAAAA,WAAW,YAAY;AAO7C,QAAqB,cAAc;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.cjs","sources":["../../../../src/components/Form/context.ts"],"sourcesContent":["'use client';\n\nimport { createContext, useCallback, useRef } from \"react\";\r\nimport type { UseFormReturn, FieldValues } from \"react-hook-form\";\r\nimport { z } from \"zod\";\r\n\r\n/**\r\n * Validation rule types that can be applied to form fields\r\n */\r\nexport interface FieldValidationRules {\r\n /** Field is required */\r\n required?: boolean | string;\r\n /** Minimum length for strings */\r\n minLength?: number | { value: number; message: string };\r\n /** Maximum length for strings */\r\n maxLength?: number | { value: number; message: string };\r\n /** Minimum value for numbers */\r\n min?: number | { value: number; message: string };\r\n /** Maximum value for numbers */\r\n max?: number | { value: number; message: string };\r\n /** Regex pattern for validation */\r\n pattern?: RegExp | { value: RegExp; message: string };\r\n /** Email validation */\r\n email?: boolean | string;\r\n /** URL validation */\r\n url?: boolean | string;\r\n /** Custom validation function */\r\n validate?: (value: unknown) => boolean | string | Promise<boolean | string>;\r\n}\r\n\r\n/**\r\n * Form configuration options\r\n */\r\nexport interface FormConfig {\r\n /** Show validation errors inline */\r\n showInlineErrors?: boolean;\r\n /** Validate on blur */\r\n validateOnBlur?: boolean;\r\n /** Validate on change */\r\n validateOnChange?: boolean;\r\n /** Size of form controls */\r\n size?: \"sm\" | \"md\" | \"lg\";\r\n /** Layout direction */\r\n layout?: \"horizontal\" | \"vertical\" | \"inline\";\r\n /** Label width for horizontal layout */\r\n labelWidth?: string | number;\r\n /** Whether form is disabled */\r\n disabled?: boolean;\r\n /** Colon after label */\r\n colon?: boolean;\r\n}\r\n\r\n/**\r\n * Field registration info\r\n */\r\nexport interface FieldRegistration {\r\n name: string;\r\n type: \"string\" | \"number\" | \"boolean\" | \"date\" | \"array\";\r\n rules: FieldValidationRules;\r\n}\r\n\r\n/**\r\n * Form context value\r\n */\r\nexport interface FormContextValue<TFieldValues extends FieldValues = FieldValues>\r\n extends FormConfig {\r\n form: UseFormReturn<TFieldValues>;\r\n /** Register a field's validation rules */\r\n registerFieldValidation: (field: FieldRegistration) => void;\r\n /** Unregister a field's validation rules */\r\n unregisterFieldValidation: (name: string) => void;\r\n /** Get current validation schema */\r\n getValidationSchema: () => z.ZodObject<Record<string, z.ZodTypeAny>>;\r\n /** Trigger validation for a specific field */\r\n triggerValidation: (name: string) => Promise<boolean>;\r\n}\r\n\r\n/**\r\n * Default form configuration\r\n */\r\nexport const defaultFormConfig: FormConfig = {\r\n showInlineErrors: true,\r\n validateOnBlur: true,\r\n validateOnChange: false,\r\n size: \"md\",\r\n layout: \"vertical\",\r\n disabled: false,\r\n colon: true,\r\n};\r\n\r\n/**\r\n * Form context for sharing form state and configuration\r\n */\r\nexport const FormConfigContext = createContext<FormContextValue | null>(null);\r\n\r\n/**\r\n * Build a Zod schema from validation rules\r\n */\r\nexport function buildZodSchemaFromRules(\r\n type: FieldRegistration[\"type\"],\r\n rules: FieldValidationRules\r\n): z.ZodTypeAny {\r\n // Helper to extract value and message\r\n const getValueAndMessage = <T>(\r\n rule: T | { value: T; message: string } | undefined,\r\n defaultMessage: string\r\n ): { value: T; message: string } | null => {\r\n if (rule === undefined) return null;\r\n if (typeof rule === \"object\" && rule !== null && \"value\" in rule) {\r\n return rule as { value: T; message: string };\r\n }\r\n return { value: rule as T, message: defaultMessage };\r\n };\r\n\r\n // Build string schema\r\n if (type === \"string\") {\r\n let schema = z.string();\r\n\r\n const minLengthRule = getValueAndMessage(\r\n rules.minLength,\r\n `Minimum ${typeof rules.minLength === \"number\" ? rules.minLength : (rules.minLength as { value: number })?.value} characters required`\r\n );\r\n if (minLengthRule) {\r\n schema = schema.min(minLengthRule.value as number, minLengthRule.message);\r\n }\r\n\r\n const maxLengthRule = getValueAndMessage(\r\n rules.maxLength,\r\n `Maximum ${typeof rules.maxLength === \"number\" ? rules.maxLength : (rules.maxLength as { value: number })?.value} characters allowed`\r\n );\r\n if (maxLengthRule) {\r\n schema = schema.max(maxLengthRule.value as number, maxLengthRule.message);\r\n }\r\n\r\n if (rules.pattern !== undefined) {\r\n const patternRule = rules.pattern instanceof RegExp\r\n ? { value: rules.pattern, message: \"Invalid format\" }\r\n : rules.pattern;\r\n schema = schema.regex(patternRule.value, patternRule.message);\r\n }\r\n\r\n if (rules.email) {\r\n const message = typeof rules.email === \"string\" ? rules.email : \"Invalid email address\";\r\n schema = schema.email(message);\r\n }\r\n\r\n if (rules.url) {\r\n const message = typeof rules.url === \"string\" ? rules.url : \"Invalid URL\";\r\n schema = schema.url(message);\r\n }\r\n\r\n // Handle required - for strings, require non-empty\r\n if (rules.required) {\r\n const message = typeof rules.required === \"string\" ? rules.required : \"This field is required\";\r\n schema = schema.min(1, message);\r\n return schema;\r\n }\r\n\r\n return schema.optional();\r\n }\r\n\r\n // Build number schema\r\n if (type === \"number\") {\r\n let schema = z.coerce.number();\r\n\r\n const minRule = getValueAndMessage(\r\n rules.min,\r\n `Minimum value is ${typeof rules.min === \"number\" ? rules.min : (rules.min as { value: number })?.value}`\r\n );\r\n if (minRule) {\r\n schema = schema.min(minRule.value as number, minRule.message);\r\n }\r\n\r\n const maxRule = getValueAndMessage(\r\n rules.max,\r\n `Maximum value is ${typeof rules.max === \"number\" ? rules.max : (rules.max as { value: number })?.value}`\r\n );\r\n if (maxRule) {\r\n schema = schema.max(maxRule.value as number, maxRule.message);\r\n }\r\n\r\n if (!rules.required) {\r\n return schema.optional();\r\n }\r\n return schema;\r\n }\r\n\r\n // Build boolean schema\r\n if (type === \"boolean\") {\r\n const schema = z.boolean();\r\n if (rules.required) {\r\n // For required boolean, must be true (like accepting terms)\r\n return schema.refine((val) => val === true, {\r\n message: typeof rules.required === \"string\" ? rules.required : \"This field is required\",\r\n });\r\n }\r\n return schema.optional();\r\n }\r\n\r\n // Build date schema\r\n if (type === \"date\") {\r\n const schema = z.coerce.date();\r\n if (!rules.required) {\r\n return schema.optional();\r\n }\r\n return schema;\r\n }\r\n\r\n // Build array schema\r\n if (type === \"array\") {\r\n let schema = z.array(z.unknown());\r\n if (rules.required) {\r\n const message = typeof rules.required === \"string\" ? rules.required : \"This field is required\";\r\n schema = schema.min(1, message);\r\n }\r\n return schema;\r\n }\r\n\r\n // Default fallback\r\n return z.unknown();\r\n}\r\n\r\n/**\r\n * Hook to manage field validations\r\n */\r\nexport function useFieldValidationRegistry() {\r\n const fieldsRef = useRef<Map<string, FieldRegistration>>(new Map());\r\n\r\n const registerFieldValidation = useCallback((field: FieldRegistration) => {\r\n fieldsRef.current.set(field.name, field);\r\n }, []);\r\n\r\n const unregisterFieldValidation = useCallback((name: string) => {\r\n fieldsRef.current.delete(name);\r\n }, []);\r\n\r\n const getValidationSchema = useCallback(() => {\r\n const shape: Record<string, z.ZodTypeAny> = {};\r\n \r\n fieldsRef.current.forEach((field) => {\r\n shape[field.name] = buildZodSchemaFromRules(field.type, field.rules);\r\n });\r\n\r\n return z.object(shape);\r\n }, []);\r\n\r\n return {\r\n registerFieldValidation,\r\n unregisterFieldValidation,\r\n getValidationSchema,\r\n fieldsRef,\r\n };\r\n}\r\n"],"names":["createContext","z","useRef","useCallback"],"mappings":";;;;AAgFO,MAAM,oBAAgC;AAAA,EAC3C,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,OAAO;AACT;AAKO,MAAM,oBAAoBA,MAAAA,cAAuC,IAAI;AAKrE,SAAS,wBACd,MACA,OACc;AAEd,QAAM,qBAAqB,CACzB,MACA,mBACyC;AACzC,QAAI,SAAS,OAAW,QAAO;AAC/B,QAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,WAAW,MAAM;AAChE,aAAO;AAAA,IACT;AACA,WAAO,EAAE,OAAO,MAAW,SAAS,eAAA;AAAA,EACtC;AAGA,MAAI,SAAS,UAAU;AACrB,QAAI,SAASC,IAAAA,EAAE,OAAA;AAEf,UAAM,gBAAgB;AAAA,MACpB,MAAM;AAAA,MACN,WAAW,OAAO,MAAM,cAAc,WAAW,MAAM,YAAa,MAAM,WAAiC,KAAK;AAAA,IAAA;AAElH,QAAI,eAAe;AACjB,eAAS,OAAO,IAAI,cAAc,OAAiB,cAAc,OAAO;AAAA,IAC1E;AAEA,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AAI,wBAAwB,MAAM,MAAM,MAAM,KAAK;AAAA,IACrE,CAAC;AAED,WAAOF,IAAAA,EAAE,OAAO,KAAK;AAAA,EACvB,GAAG,CAAA,CAAE;AAEL,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;;;;;"}
|
|
1
|
+
{"version":3,"file":"context.cjs","sources":["../../../../src/components/Form/context.ts"],"sourcesContent":["'use client';\n\nimport { createContext, useCallback, useRef } from \"react\";\r\nimport type { UseFormReturn, FieldValues } from \"react-hook-form\";\r\nimport { z } from \"zod\";\r\n\r\n/**\r\n * Validation rule types that can be applied to form fields\r\n */\r\nexport interface FieldValidationRules {\r\n /** Field is required */\r\n required?: boolean | string;\r\n /** Minimum length for strings */\r\n minLength?: number | { value: number; message: string };\r\n /** Maximum length for strings */\r\n maxLength?: number | { value: number; message: string };\r\n /** Minimum value for numbers */\r\n min?: number | { value: number; message: string };\r\n /** Maximum value for numbers */\r\n max?: number | { value: number; message: string };\r\n /** Regex pattern for validation */\r\n pattern?: RegExp | { value: RegExp; message: string };\r\n /** Email validation */\r\n email?: boolean | string;\r\n /** URL validation */\r\n url?: boolean | string;\r\n /** Custom validation function */\r\n validate?: (value: unknown) => boolean | string | Promise<boolean | string>;\r\n}\r\n\r\n/**\r\n * Form configuration options\r\n */\r\nexport interface FormConfig {\r\n /** Show validation errors inline */\r\n showInlineErrors?: boolean;\r\n /** Validate on blur */\r\n validateOnBlur?: boolean;\r\n /** Validate on change */\r\n validateOnChange?: boolean;\r\n /** Size of form controls */\r\n size?: \"sm\" | \"md\" | \"lg\";\r\n /** Layout direction */\r\n layout?: \"horizontal\" | \"vertical\" | \"inline\";\r\n /** Label width for horizontal layout */\r\n labelWidth?: string | number;\r\n /** Whether form is disabled */\r\n disabled?: boolean;\r\n /** Colon after label */\r\n colon?: boolean;\r\n}\r\n\r\n/**\r\n * Field registration info\r\n */\r\nexport interface FieldRegistration {\r\n name: string;\r\n type: \"string\" | \"number\" | \"boolean\" | \"date\" | \"array\";\r\n rules: FieldValidationRules;\r\n}\r\n\r\n/**\r\n * Form context value\r\n */\r\nexport interface FormContextValue<TFieldValues extends FieldValues = FieldValues>\r\n extends FormConfig {\r\n form: UseFormReturn<TFieldValues>;\r\n /** Register a field's validation rules */\r\n registerFieldValidation: (field: FieldRegistration) => void;\r\n /** Unregister a field's validation rules */\r\n unregisterFieldValidation: (name: string) => void;\r\n /** Get current validation schema */\r\n getValidationSchema: () => z.ZodObject<Record<string, z.ZodTypeAny>>;\r\n /** Trigger validation for a specific field */\r\n triggerValidation: (name: string) => Promise<boolean>;\r\n}\r\n\r\n/**\r\n * Default form configuration\r\n */\r\nexport const defaultFormConfig: FormConfig = {\r\n showInlineErrors: true,\r\n validateOnBlur: true,\r\n validateOnChange: false,\r\n size: \"md\",\r\n layout: \"vertical\",\r\n disabled: false,\r\n colon: true,\r\n};\r\n\r\n/**\r\n * Form context for sharing form state and configuration\r\n */\r\nexport const FormConfigContext = createContext<FormContextValue | null>(null);\r\n\r\n/**\r\n * Build a Zod schema from validation rules\r\n */\r\nexport function buildZodSchemaFromRules(\r\n type: FieldRegistration[\"type\"],\r\n rules: FieldValidationRules\r\n): z.ZodTypeAny {\r\n // Helper to extract value and message\r\n const getValueAndMessage = <T>(\r\n rule: T | { value: T; message: string } | undefined,\r\n defaultMessage: string\r\n ): { value: T; message: string } | null => {\r\n if (rule === undefined) return null;\r\n if (typeof rule === \"object\" && rule !== null && \"value\" in rule) {\r\n return rule as { value: T; message: string };\r\n }\r\n return { value: rule as T, message: defaultMessage };\r\n };\r\n\r\n // Build string schema\r\n if (type === \"string\") {\r\n let schema = z.string();\r\n\r\n const minLengthRule = getValueAndMessage(\r\n rules.minLength,\r\n `Minimum ${typeof rules.minLength === \"number\" ? rules.minLength : (rules.minLength as { value: number })?.value} characters required`\r\n );\r\n if (minLengthRule) {\r\n schema = schema.min(minLengthRule.value as number, minLengthRule.message);\r\n }\r\n\r\n const maxLengthRule = getValueAndMessage(\r\n rules.maxLength,\r\n `Maximum ${typeof rules.maxLength === \"number\" ? rules.maxLength : (rules.maxLength as { value: number })?.value} characters allowed`\r\n );\r\n if (maxLengthRule) {\r\n schema = schema.max(maxLengthRule.value as number, maxLengthRule.message);\r\n }\r\n\r\n if (rules.pattern !== undefined) {\r\n const patternRule = rules.pattern instanceof RegExp\r\n ? { value: rules.pattern, message: \"Invalid format\" }\r\n : rules.pattern;\r\n schema = schema.regex(patternRule.value, patternRule.message);\r\n }\r\n\r\n if (rules.email) {\r\n const message = typeof rules.email === \"string\" ? rules.email : \"Invalid email address\";\r\n schema = schema.email(message);\r\n }\r\n\r\n if (rules.url) {\r\n const message = typeof rules.url === \"string\" ? rules.url : \"Invalid URL\";\r\n schema = schema.url(message);\r\n }\r\n\r\n // Handle required - for strings, require non-empty\r\n if (rules.required) {\r\n const message = typeof rules.required === \"string\" ? rules.required : \"This field is required\";\r\n schema = schema.min(1, message);\r\n return schema;\r\n }\r\n\r\n return schema.optional();\r\n }\r\n\r\n // Build number schema\r\n if (type === \"number\") {\r\n let schema = z.coerce.number();\r\n\r\n const minRule = getValueAndMessage(\r\n rules.min,\r\n `Minimum value is ${typeof rules.min === \"number\" ? rules.min : (rules.min as { value: number })?.value}`\r\n );\r\n if (minRule) {\r\n schema = schema.min(minRule.value as number, minRule.message);\r\n }\r\n\r\n const maxRule = getValueAndMessage(\r\n rules.max,\r\n `Maximum value is ${typeof rules.max === \"number\" ? rules.max : (rules.max as { value: number })?.value}`\r\n );\r\n if (maxRule) {\r\n schema = schema.max(maxRule.value as number, maxRule.message);\r\n }\r\n\r\n if (!rules.required) {\r\n return schema.optional();\r\n }\r\n return schema;\r\n }\r\n\r\n // Build boolean schema\r\n if (type === \"boolean\") {\r\n const schema = z.boolean();\r\n if (rules.required) {\r\n // For required boolean, must be true (like accepting terms)\r\n return schema.refine((val) => val === true, {\r\n message: typeof rules.required === \"string\" ? rules.required : \"This field is required\",\r\n });\r\n }\r\n return schema.optional();\r\n }\r\n\r\n // Build date schema\r\n if (type === \"date\") {\r\n const schema = z.coerce.date();\r\n if (!rules.required) {\r\n return schema.optional();\r\n }\r\n return schema;\r\n }\r\n\r\n // Build array schema\r\n if (type === \"array\") {\r\n let schema = z.array(z.unknown());\r\n if (rules.required) {\r\n const message = typeof rules.required === \"string\" ? rules.required : \"This field is required\";\r\n schema = schema.min(1, message);\r\n }\r\n return schema;\r\n }\r\n\r\n // Default fallback\r\n return z.unknown();\r\n}\r\n\r\n/**\r\n * Hook to manage field validations\r\n */\r\nexport function useFieldValidationRegistry() {\r\n const fieldsRef = useRef<Map<string, FieldRegistration>>(new Map());\r\n\r\n const registerFieldValidation = useCallback((field: FieldRegistration) => {\r\n fieldsRef.current.set(field.name, field);\r\n }, []);\r\n\r\n const unregisterFieldValidation = useCallback((name: string) => {\r\n fieldsRef.current.delete(name);\r\n }, []);\r\n\r\n const getValidationSchema = useCallback(() => {\r\n const shape: Record<string, z.ZodTypeAny> = {};\r\n \r\n fieldsRef.current.forEach((field) => {\r\n shape[field.name] = buildZodSchemaFromRules(field.type, field.rules);\r\n });\r\n\r\n return z.object(shape);\r\n }, []);\r\n\r\n return {\r\n registerFieldValidation,\r\n unregisterFieldValidation,\r\n getValidationSchema,\r\n fieldsRef,\r\n };\r\n}\r\n"],"names":["createContext","z","useRef","useCallback"],"mappings":";;;;;AAgFO,MAAM,oBAAgC;AAAA,EAC3C,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,OAAO;AACT;AAKO,MAAM,oBAAoBA,MAAAA,cAAuC,IAAI;AAKrE,SAAS,wBACd,MACA,OACc;AAEd,QAAM,qBAAqB,CACzB,MACA,mBACyC;AACzC,QAAI,SAAS,OAAW,QAAO;AAC/B,QAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,WAAW,MAAM;AAChE,aAAO;AAAA,IACT;AACA,WAAO,E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AACxE,cAAU,QAAQ,IAAI,MAAM,MAAM,KAAK;AAAA,EACzC,GAAG,CAAA,CAAE;AAEL,QAAM,4BAA4BA,kBAAY,CAAC,SAAiB;AAC9D,cAAU,QAAQ,OAAO,IAAI;AAAA,EAC/B,GAAG,CAAA,CAAE;AAEL,QAAM,sBAAsBA,MAAAA,YAAY,MAAM;AAC5C,UAAM,QAAsC,CAAA;AAE5C,cAAU,QAAQ,QAAQ,CAAC,UAAU;AACnC,YAAM,MAAM,IAAI,IAAI,wBAAwB,MAAM,MAAM,MAAM,KAAK;AAAA,IACrE,CAAC;AAED,WAAOF,IAAAA,EAAE,OAAO,KAAK;AAAA,EACvB,GAAG,CAAA,CAAE;AAEL,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.cjs","sources":["../../../../src/components/Form/hooks.ts"],"sourcesContent":["'use client';\n\nimport { useContext } from \"react\";\r\nimport {\r\n useFormContext as useRHFFormContext,\r\n useController,\r\n type FieldValues,\r\n type FieldPath,\r\n type UseControllerProps,\r\n type UseControllerReturn,\r\n} from \"react-hook-form\";\r\nimport { FormConfigContext, type FormContextValue, type FormConfig } from \"./context\";\r\n\r\n/**\r\n * Hook to access form configuration context\r\n */\r\nexport function useFormConfig<TFieldValues extends FieldValues = FieldValues>(): FormContextValue<TFieldValues> {\r\n const context = useContext(FormConfigContext) as FormContextValue<TFieldValues> | null;\r\n if (!context) {\r\n throw new Error(\"useFormConfig must be used within a Form component\");\r\n }\r\n return context;\r\n}\r\n\r\n/**\r\n * Hook to access react-hook-form context directly\r\n */\r\nexport function useForm<TFieldValues extends FieldValues = FieldValues>() {\r\n return useRHFFormContext<TFieldValues>();\r\n}\r\n\r\n/**\r\n * Hook to create a controlled field with form context awareness\r\n */\r\nexport function useFormField<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\r\n>(\r\n props: UseControllerProps<TFieldValues, TName>\r\n): UseControllerReturn<TFieldValues, TName> & { config: FormConfig } {\r\n const { form, ...config } = useFormConfig<TFieldValues>();\r\n const controller = useController<TFieldValues, TName>({\r\n ...props,\r\n control: form.control,\r\n });\r\n\r\n return {\r\n ...controller,\r\n config,\r\n };\r\n}\r\n\r\n/**\r\n * Hook to get field error\r\n */\r\nexport function useFieldError<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\r\n>(name: TName): string | undefined {\r\n const { form } = useFormConfig<TFieldValues>();\r\n const error = form.formState.errors[name];\r\n return error?.message as string | undefined;\r\n}\r\n"],"names":["context","useContext","FormConfigContext","useRHFFormContext","useController"],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.cjs","sources":["../../../../src/components/Form/hooks.ts"],"sourcesContent":["'use client';\n\nimport { useContext } from \"react\";\r\nimport {\r\n useFormContext as useRHFFormContext,\r\n useController,\r\n type FieldValues,\r\n type FieldPath,\r\n type UseControllerProps,\r\n type UseControllerReturn,\r\n} from \"react-hook-form\";\r\nimport { FormConfigContext, type FormContextValue, type FormConfig } from \"./context\";\r\n\r\n/**\r\n * Hook to access form configuration context\r\n */\r\nexport function useFormConfig<TFieldValues extends FieldValues = FieldValues>(): FormContextValue<TFieldValues> {\r\n const context = useContext(FormConfigContext) as FormContextValue<TFieldValues> | null;\r\n if (!context) {\r\n throw new Error(\"useFormConfig must be used within a Form component\");\r\n }\r\n return context;\r\n}\r\n\r\n/**\r\n * Hook to access react-hook-form context directly\r\n */\r\nexport function useForm<TFieldValues extends FieldValues = FieldValues>() {\r\n return useRHFFormContext<TFieldValues>();\r\n}\r\n\r\n/**\r\n * Hook to create a controlled field with form context awareness\r\n */\r\nexport function useFormField<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\r\n>(\r\n props: UseControllerProps<TFieldValues, TName>\r\n): UseControllerReturn<TFieldValues, TName> & { config: FormConfig } {\r\n const { form, ...config } = useFormConfig<TFieldValues>();\r\n const controller = useController<TFieldValues, TName>({\r\n ...props,\r\n control: form.control,\r\n });\r\n\r\n return {\r\n ...controller,\r\n config,\r\n };\r\n}\r\n\r\n/**\r\n * Hook to get field error\r\n */\r\nexport function useFieldError<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\r\n>(name: TName): string | undefined {\r\n const { form } = useFormConfig<TFieldValues>();\r\n const error = form.formState.errors[name];\r\n return error?.message as string | undefined;\r\n}\r\n"],"names":["context","useContext","FormConfigContext","useRHFFormContext","useController"],"mappings":";;;;;;AAgBO,SAAS,gBAAgG;AAC9G,QAAMA,YAAUC,MAAAA,WAAWC,yBAAiB;AAC5C,MAAI,CAACF,WAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,SAAOA;AACT;AAKO,SAAS,UAA0D;AACxE,SAAOG,6BAAA;AACT;AAKO,SAAS,aAId,OACmE;AACnE,QAAM,EAAE,MAAM,GAAG,OAAA,IAAW,cAAA;AAC5B,QAAM,aAAaC,cAAAA,cAAmC;AAAA,IACpD,GAAG;AAAA,IACH,SAAS,KAAK;AAAA,EAAA,CACf;AAED,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,EAAA;AAEJ;AAKO,SAAS,cAGd,MAAiC;AACjC,QAAM,EAAE,KAAA,IAAS,cAAA;AACjB,QAAM,QAAQ,KAAK,UAAU,OAAO,IAAI;AACxC,SAAO,OAAO;AAChB;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variants.cjs","sources":["../../../../src/components/Form/variants.ts"],"sourcesContent":["import { cva } from \"class-variance-authority\";\r\n\r\n/**\r\n * Shared label variant for all form field components.\r\n * Shows a required asterisk when required=true.\r\n */\r\nexport const labelVariants = cva(\"block text-sm font-medium mb-1.5\", {\r\n variants: {\r\n required: {\r\n true: \"after:content-['*'] after:ml-0.5 after:text-destructive\",\r\n false: \"\",\r\n },\r\n },\r\n defaultVariants: {\r\n required: false,\r\n },\r\n});\r\n"],"names":["cva"],"mappings":"
|
|
1
|
+
{"version":3,"file":"variants.cjs","sources":["../../../../src/components/Form/variants.ts"],"sourcesContent":["import { cva } from \"class-variance-authority\";\r\n\r\n/**\r\n * Shared label variant for all form field components.\r\n * Shows a required asterisk when required=true.\r\n */\r\nexport const labelVariants = cva(\"block text-sm font-medium mb-1.5\", {\r\n variants: {\r\n required: {\r\n true: \"after:content-['*'] after:ml-0.5 after:text-destructive\",\r\n false: \"\",\r\n },\r\n },\r\n defaultVariants: {\r\n required: false,\r\n },\r\n});\r\n"],"names":["cva"],"mappings":";;;;AAMO,MAAM,gBAAgBA,uBAAAA,IAAI,oCAAoC;AAAA,EACnE,UAAU;AAAA,IACR,UAAU;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,IAAA;AAAA,EACT;AAAA,EAEF,iBAAiB;AAAA,IACf,UAAU;AAAA,EAAA;AAEd,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.cjs","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Input as InputPrimitive } from \"../../primitives/input\"\n\nexport type InputProps = ComponentPropsWithoutRef<typeof InputPrimitive>\n\nexport const Input = forwardRef<\n ElementRef<typeof InputPrimitive>,\n InputProps\n>((props, ref) => <InputPrimitive ref={ref} {...props} />)\nInput.displayName = \"Input\"\n"],"names":["forwardRef","InputPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Input.cjs","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Input as InputPrimitive } from \"../../primitives/input\"\n\nexport type InputProps = ComponentPropsWithoutRef<typeof InputPrimitive>\n\nexport const Input = forwardRef<\n ElementRef<typeof InputPrimitive>,\n InputProps\n>((props, ref) => <InputPrimitive ref={ref} {...props} />)\nInput.displayName = \"Input\"\n"],"names":["forwardRef","InputPrimitive"],"mappings":";;;;;;AAMO,MAAM,QAAQA,MAAAA,WAGnB,CAAC,OAAO,uCAASC,MAAAA,OAAA,EAAe,KAAW,GAAG,OAAO,CAAE;AACzD,MAAM,cAAc;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.cjs","sources":["../../../../src/components/Label/Label.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Label as LabelPrimitive } from \"../../primitives/label\"\n\nexport type LabelProps = ComponentPropsWithoutRef<typeof LabelPrimitive>\n\nexport const Label = forwardRef<\n ElementRef<typeof LabelPrimitive>,\n LabelProps\n>((props, ref) => <LabelPrimitive ref={ref} {...props} />)\nLabel.displayName = \"Label\"\n"],"names":["forwardRef","LabelPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Label.cjs","sources":["../../../../src/components/Label/Label.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Label as LabelPrimitive } from \"../../primitives/label\"\n\nexport type LabelProps = ComponentPropsWithoutRef<typeof LabelPrimitive>\n\nexport const Label = forwardRef<\n ElementRef<typeof LabelPrimitive>,\n LabelProps\n>((props, ref) => <LabelPrimitive ref={ref} {...props} />)\nLabel.displayName = \"Label\"\n"],"names":["forwardRef","LabelPrimitive"],"mappings":";;;;;;AAMO,MAAM,QAAQA,MAAAA,WAGnB,CAAC,OAAO,uCAASC,MAAAA,OAAA,EAAe,KAAW,GAAG,OAAO,CAAE;AACzD,MAAM,cAAc;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Separator.cjs","sources":["../../../../src/components/Separator/Separator.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Separator as SeparatorPrimitive } from \"../../primitives/separator\"\n\nexport const Separator = forwardRef<\n ElementRef<typeof SeparatorPrimitive>,\n ComponentPropsWithoutRef<typeof SeparatorPrimitive>\n>((props, ref) => <SeparatorPrimitive ref={ref} {...props} />)\nSeparator.displayName = \"Separator\"\n"],"names":["forwardRef","SeparatorPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Separator.cjs","sources":["../../../../src/components/Separator/Separator.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Separator as SeparatorPrimitive } from \"../../primitives/separator\"\n\nexport const Separator = forwardRef<\n ElementRef<typeof SeparatorPrimitive>,\n ComponentPropsWithoutRef<typeof SeparatorPrimitive>\n>((props, ref) => <SeparatorPrimitive ref={ref} {...props} />)\nSeparator.displayName = \"Separator\"\n"],"names":["forwardRef","SeparatorPrimitive"],"mappings":";;;;;;AAIO,MAAM,YAAYA,MAAAA,WAGvB,CAAC,OAAO,uCAASC,UAAAA,WAAA,EAAmB,KAAW,GAAG,OAAO,CAAE;AAC7D,UAAU,cAAc;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.cjs","sources":["../../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport {\n Tabs as TabsPrimitive,\n TabsList as TabsListPrimitive,\n TabsTrigger as TabsTriggerPrimitive,\n TabsContent as TabsContentPrimitive,\n} from \"../../primitives/tabs\"\n\nexport const Tabs = forwardRef<\n ElementRef<typeof TabsPrimitive>,\n ComponentPropsWithoutRef<typeof TabsPrimitive>\n>((props, ref) => <TabsPrimitive ref={ref} {...props} />)\nTabs.displayName = \"Tabs\"\n\nexport const TabsList = forwardRef<\n ElementRef<typeof TabsListPrimitive>,\n ComponentPropsWithoutRef<typeof TabsListPrimitive>\n>((props, ref) => <TabsListPrimitive ref={ref} {...props} />)\nTabsList.displayName = \"TabsList\"\n\nexport const TabsTrigger = forwardRef<\n ElementRef<typeof TabsTriggerPrimitive>,\n ComponentPropsWithoutRef<typeof TabsTriggerPrimitive>\n>((props, ref) => <TabsTriggerPrimitive ref={ref} {...props} />)\nTabsTrigger.displayName = \"TabsTrigger\"\n\nexport const TabsContent = forwardRef<\n ElementRef<typeof TabsContentPrimitive>,\n ComponentPropsWithoutRef<typeof TabsContentPrimitive>\n>((props, ref) => <TabsContentPrimitive ref={ref} {...props} />)\nTabsContent.displayName = \"TabsContent\"\n"],"names":["forwardRef","TabsPrimitive","TabsListPrimitive","TabsTriggerPrimitive","TabsContentPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tabs.cjs","sources":["../../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport {\n Tabs as TabsPrimitive,\n TabsList as TabsListPrimitive,\n TabsTrigger as TabsTriggerPrimitive,\n TabsContent as TabsContentPrimitive,\n} from \"../../primitives/tabs\"\n\nexport const Tabs = forwardRef<\n ElementRef<typeof TabsPrimitive>,\n ComponentPropsWithoutRef<typeof TabsPrimitive>\n>((props, ref) => <TabsPrimitive ref={ref} {...props} />)\nTabs.displayName = \"Tabs\"\n\nexport const TabsList = forwardRef<\n ElementRef<typeof TabsListPrimitive>,\n ComponentPropsWithoutRef<typeof TabsListPrimitive>\n>((props, ref) => <TabsListPrimitive ref={ref} {...props} />)\nTabsList.displayName = \"TabsList\"\n\nexport const TabsTrigger = forwardRef<\n ElementRef<typeof TabsTriggerPrimitive>,\n ComponentPropsWithoutRef<typeof TabsTriggerPrimitive>\n>((props, ref) => <TabsTriggerPrimitive ref={ref} {...props} />)\nTabsTrigger.displayName = \"TabsTrigger\"\n\nexport const TabsContent = forwardRef<\n ElementRef<typeof TabsContentPrimitive>,\n ComponentPropsWithoutRef<typeof TabsContentPrimitive>\n>((props, ref) => <TabsContentPrimitive ref={ref} {...props} />)\nTabsContent.displayName = \"TabsContent\"\n"],"names":["forwardRef","TabsPrimitive","TabsListPrimitive","TabsTriggerPrimitive","TabsContentPrimitive"],"mappings":";;;;;;AASO,MAAM,OAAOA,MAAAA,WAGlB,CAAC,OAAO,uCAASC,KAAAA,MAAA,EAAc,KAAW,GAAG,OAAO,CAAE;AACxD,KAAK,cAAc;AAEZ,MAAM,WAAWD,MAAAA,WAGtB,CAAC,OAAO,uCAASE,KAAAA,UAAA,EAAkB,KAAW,GAAG,OAAO,CAAE;AAC5D,SAAS,cAAc;AAEhB,MAAM,cAAcF,MAAAA,WAGzB,CAAC,OAAO,uCAASG,KAAAA,aAAA,EAAqB,KAAW,GAAG,OAAO,CAAE;AAC/D,YAAY,cAAc;AAEnB,MAAM,cAAcH,MAAAA,WAGzB,CAAC,OAAO,uCAASI,KAAAA,aAAA,EAAqB,KAAW,GAAG,OAAO,CAAE;AAC/D,YAAY,cAAc;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.cjs","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Textarea as TextareaPrimitive } from \"../../primitives/textarea\"\n\nexport type TextareaProps = ComponentPropsWithoutRef<typeof TextareaPrimitive>\n\nexport const Textarea = forwardRef<\n ElementRef<typeof TextareaPrimitive>,\n TextareaProps\n>((props, ref) => <TextareaPrimitive ref={ref} {...props} />)\nTextarea.displayName = \"Textarea\"\n"],"names":["forwardRef","TextareaPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Textarea.cjs","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport { Textarea as TextareaPrimitive } from \"../../primitives/textarea\"\n\nexport type TextareaProps = ComponentPropsWithoutRef<typeof TextareaPrimitive>\n\nexport const Textarea = forwardRef<\n ElementRef<typeof TextareaPrimitive>,\n TextareaProps\n>((props, ref) => <TextareaPrimitive ref={ref} {...props} />)\nTextarea.displayName = \"Textarea\"\n"],"names":["forwardRef","TextareaPrimitive"],"mappings":";;;;;;AAMO,MAAM,WAAWA,MAAAA,WAGtB,CAAC,OAAO,uCAASC,SAAAA,UAAA,EAAkB,KAAW,GAAG,OAAO,CAAE;AAC5D,SAAS,cAAc;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDebounce.cjs","sources":["../../../src/hooks/useDebounce.ts"],"sourcesContent":["'use client';\n\nimport { useState, useEffect } from \"react\";\r\n\r\n/**\r\n * A hook that debounces a value by a specified delay\r\n * @param value - The value to debounce\r\n * @param delay - The delay in milliseconds (default: 500)\r\n * @returns The debounced value\r\n */\r\nexport function useDebounce<T>(value: T, delay = 500): T {\r\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\r\n\r\n useEffect(() => {\r\n const timer = setTimeout(() => {\r\n setDebouncedValue(value);\r\n }, delay);\r\n\r\n return () => {\r\n clearTimeout(timer);\r\n };\r\n }, [value, delay]);\r\n\r\n return debouncedValue;\r\n}\r\n"],"names":["useState","useEffect"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDebounce.cjs","sources":["../../../src/hooks/useDebounce.ts"],"sourcesContent":["'use client';\n\nimport { useState, useEffect } from \"react\";\r\n\r\n/**\r\n * A hook that debounces a value by a specified delay\r\n * @param value - The value to debounce\r\n * @param delay - The delay in milliseconds (default: 500)\r\n * @returns The debounced value\r\n */\r\nexport function useDebounce<T>(value: T, delay = 500): T {\r\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\r\n\r\n useEffect(() => {\r\n const timer = setTimeout(() => {\r\n setDebouncedValue(value);\r\n }, delay);\r\n\r\n return () => {\r\n clearTimeout(timer);\r\n };\r\n }, [value, delay]);\r\n\r\n return debouncedValue;\r\n}\r\n"],"names":["useState","useEffect"],"mappings":";;;;AAUO,SAAS,YAAe,OAAU,QAAQ,KAAQ;AACvD,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,MAAAA,SAAY,KAAK;AAE7DC,QAAAA,UAAU,MAAM;AACd,UAAM,QAAQ,WAAW,MAAM;AAC7B,wBAAkB,KAAK;AAAA,IACzB,GAAG,KAAK;AAER,WAAO,MAAM;AACX,mBAAa,KAAK;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,OAAO,KAAK,CAAC;AAEjB,SAAO;AACT;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToast.cjs","sources":["../../../src/hooks/useToast.ts"],"sourcesContent":["'use client';\n\nimport * as React from \"react\"\nimport type { ToastActionElement, ToastProps } from \"../primitives/toast\"\n\nconst TOAST_LIMIT = 1\nconst TOAST_REMOVE_DELAY = 1000000\n\ntype ToasterToast = ToastProps & {\n id: string\n title?: React.ReactNode\n description?: React.ReactNode\n action?: ToastActionElement\n}\n\nconst actionTypes = {\n ADD_TOAST: \"ADD_TOAST\",\n UPDATE_TOAST: \"UPDATE_TOAST\",\n DISMISS_TOAST: \"DISMISS_TOAST\",\n REMOVE_TOAST: \"REMOVE_TOAST\",\n} as const\n\nlet count = 0\nfunction genId() {\n count = (count + 1) % Number.MAX_SAFE_INTEGER\n return count.toString()\n}\n\ntype ActionType = typeof actionTypes\ntype Action =\n | { type: ActionType[\"ADD_TOAST\"]; toast: ToasterToast }\n | { type: ActionType[\"UPDATE_TOAST\"]; toast: Partial<ToasterToast> }\n | { type: ActionType[\"DISMISS_TOAST\"]; toastId?: ToasterToast[\"id\"] }\n | { type: ActionType[\"REMOVE_TOAST\"]; toastId?: ToasterToast[\"id\"] }\n\ninterface State {\n toasts: ToasterToast[]\n}\n\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()\n\nconst addToRemoveQueue = (toastId: string) => {\n if (toastTimeouts.has(toastId)) return\n const timeout = setTimeout(() => {\n toastTimeouts.delete(toastId)\n dispatch({ type: \"REMOVE_TOAST\", toastId })\n }, TOAST_REMOVE_DELAY)\n toastTimeouts.set(toastId, timeout)\n}\n\nexport const reducer = (state: State, action: Action): State => {\n switch (action.type) {\n case \"ADD_TOAST\":\n return { ...state, toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT) }\n case \"UPDATE_TOAST\":\n return { ...state, toasts: state.toasts.map((t) => t.id === action.toast.id ? { ...t, ...action.toast } : t) }\n case \"DISMISS_TOAST\": {\n const { toastId } = action\n if (toastId) {\n addToRemoveQueue(toastId)\n } else {\n state.toasts.forEach((t) => addToRemoveQueue(t.id))\n }\n return { ...state, toasts: state.toasts.map((t) => t.id === toastId || toastId === undefined ? { ...t, open: false } : t) }\n }\n case \"REMOVE_TOAST\":\n return action.toastId === undefined\n ? { ...state, toasts: [] }\n : { ...state, toasts: state.toasts.filter((t) => t.id !== action.toastId) }\n }\n}\n\nconst listeners: Array<(state: State) => void> = []\nlet memoryState: State = { toasts: [] }\n\nfunction dispatch(action: Action) {\n memoryState = reducer(memoryState, action)\n listeners.forEach((l) => l(memoryState))\n}\n\ntype Toast = Omit<ToasterToast, \"id\">\n\nfunction toast({ ...props }: Toast) {\n const id = genId()\n const update = (props: ToasterToast) => dispatch({ type: \"UPDATE_TOAST\", toast: { ...props, id } })\n const dismiss = () => dispatch({ type: \"DISMISS_TOAST\", toastId: id })\n\n dispatch({\n type: \"ADD_TOAST\",\n toast: {\n ...props,\n id,\n open: true,\n onOpenChange: (open) => { if (!open) dismiss() },\n },\n })\n\n return { id, dismiss, update }\n}\n\nfunction useToast() {\n const [state, setState] = React.useState<State>(memoryState)\n\n React.useEffect(() => {\n listeners.push(setState)\n return () => {\n const index = listeners.indexOf(setState)\n if (index > -1) listeners.splice(index, 1)\n }\n }, [state])\n\n return {\n ...state,\n toast,\n dismiss: (toastId?: string) => dispatch({ type: \"DISMISS_TOAST\", toastId }),\n }\n}\n\nexport { useToast, toast }\n"],"names":["props","React"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useToast.cjs","sources":["../../../src/hooks/useToast.ts"],"sourcesContent":["'use client';\n\nimport * as React from \"react\"\nimport type { ToastActionElement, ToastProps } from \"../primitives/toast\"\n\nconst TOAST_LIMIT = 1\nconst TOAST_REMOVE_DELAY = 1000000\n\ntype ToasterToast = ToastProps & {\n id: string\n title?: React.ReactNode\n description?: React.ReactNode\n action?: ToastActionElement\n}\n\nconst actionTypes = {\n ADD_TOAST: \"ADD_TOAST\",\n UPDATE_TOAST: \"UPDATE_TOAST\",\n DISMISS_TOAST: \"DISMISS_TOAST\",\n REMOVE_TOAST: \"REMOVE_TOAST\",\n} as const\n\nlet count = 0\nfunction genId() {\n count = (count + 1) % Number.MAX_SAFE_INTEGER\n return count.toString()\n}\n\ntype ActionType = typeof actionTypes\ntype Action =\n | { type: ActionType[\"ADD_TOAST\"]; toast: ToasterToast }\n | { type: ActionType[\"UPDATE_TOAST\"]; toast: Partial<ToasterToast> }\n | { type: ActionType[\"DISMISS_TOAST\"]; toastId?: ToasterToast[\"id\"] }\n | { type: ActionType[\"REMOVE_TOAST\"]; toastId?: ToasterToast[\"id\"] }\n\ninterface State {\n toasts: ToasterToast[]\n}\n\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()\n\nconst addToRemoveQueue = (toastId: string) => {\n if (toastTimeouts.has(toastId)) return\n const timeout = setTimeout(() => {\n toastTimeouts.delete(toastId)\n dispatch({ type: \"REMOVE_TOAST\", toastId })\n }, TOAST_REMOVE_DELAY)\n toastTimeouts.set(toastId, timeout)\n}\n\nexport const reducer = (state: State, action: Action): State => {\n switch (action.type) {\n case \"ADD_TOAST\":\n return { ...state, toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT) }\n case \"UPDATE_TOAST\":\n return { ...state, toasts: state.toasts.map((t) => t.id === action.toast.id ? { ...t, ...action.toast } : t) }\n case \"DISMISS_TOAST\": {\n const { toastId } = action\n if (toastId) {\n addToRemoveQueue(toastId)\n } else {\n state.toasts.forEach((t) => addToRemoveQueue(t.id))\n }\n return { ...state, toasts: state.toasts.map((t) => t.id === toastId || toastId === undefined ? { ...t, open: false } : t) }\n }\n case \"REMOVE_TOAST\":\n return action.toastId === undefined\n ? { ...state, toasts: [] }\n : { ...state, toasts: state.toasts.filter((t) => t.id !== action.toastId) }\n }\n}\n\nconst listeners: Array<(state: State) => void> = []\nlet memoryState: State = { toasts: [] }\n\nfunction dispatch(action: Action) {\n memoryState = reducer(memoryState, action)\n listeners.forEach((l) => l(memoryState))\n}\n\ntype Toast = Omit<ToasterToast, \"id\">\n\nfunction toast({ ...props }: Toast) {\n const id = genId()\n const update = (props: ToasterToast) => dispatch({ type: \"UPDATE_TOAST\", toast: { ...props, id } })\n const dismiss = () => dispatch({ type: \"DISMISS_TOAST\", toastId: id })\n\n dispatch({\n type: \"ADD_TOAST\",\n toast: {\n ...props,\n id,\n open: true,\n onOpenChange: (open) => { if (!open) dismiss() },\n },\n })\n\n return { id, dismiss, update }\n}\n\nfunction useToast() {\n const [state, setState] = React.useState<State>(memoryState)\n\n React.useEffect(() => {\n listeners.push(setState)\n return () => {\n const index = listeners.indexOf(setState)\n if (index > -1) listeners.splice(index, 1)\n }\n }, [state])\n\n return {\n ...state,\n toast,\n dismiss: (toastId?: string) => dispatch({ type: \"DISMISS_TOAST\", toastId }),\n }\n}\n\nexport { useToast, toast }\n"],"names":["props","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,cAAc;AACpB,MAAM,qBAAqB;AAgB3B,IAAI,QAAQ;AACZ,SAAS,QAAQ;AACf,WAAS,QAAQ,KAAK,OAAO;AAC7B,SAAO,MAAM,SAAA;AACf;AAaA,MAAM,oCAAoB,IAAA;AAE1B,MAAM,mBAAmB,CAAC,YAAoB;AAC5C,MAAI,cAAc,IAAI,OAAO,EAAG;AAChC,QAAM,UAAU,WAAW,MAAM;AAC/B,kBAAc,OAAO,OAAO;AAC5B,aAAS,E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SAAS,EAAE,MAAM,gBAAgB,OAAO,EAAE,GAAGA,QAAO,GAAA,GAAM;AAClG,QAAM,UAAU,MAAM,SAAS,EAAE,MAAM,iBAAiB,SAAS,IAAI;AAErE,WAAS;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,MACA,MAAM;AAAA,MACN,cAAc,CAAC,SAAS;AAAE,YAAI,CAAC,KAAM,SAAA;AAAA,MAAU;AAAA,IAAA;AAAA,EACjD,CACD;AAED,SAAO,EAAE,IAAI,SAAS,OAAA;AACxB;AAEA,SAAS,WAAW;AAClB,QAAM,CAAC,OAAO,QAAQ,IAAIC,iBAAM,SAAgB,WAAW;AAE3DA,mBAAM,UAAU,MAAM;AACpB,cAAU,KAAK,QAAQ;AACvB,WAAO,MAAM;AACX,YAAM,QAAQ,UAAU,QAAQ,QAAQ;AACxC,UAAI,QAAQ,GAAI,WAAU,OAAO,OAAO,CAAC;AAAA,IAC3C;AAAA,EACF,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA,SAAS,CAAC,YAAqB,SAAS,EAAE,MAAM,iBAAiB,SAAS;AAAA,EAAA;AAE9E;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToggle.cjs","sources":["../../../src/hooks/useToggle.ts"],"sourcesContent":["'use client';\n\nimport { useState, useCallback } from \"react\";\r\n\r\n/**\r\n * A hook that returns a boolean state and a function to toggle it\r\n * @param initialValue - The initial value of the toggle (default: false)\r\n * @returns A tuple containing the current value and a toggle function\r\n */\r\nexport function useToggle(initialValue = false): [boolean, () => void] {\r\n const [value, setValue] = useState(initialValue);\r\n\r\n const toggle = useCallback(() => {\r\n setValue((prev) => !prev);\r\n }, []);\r\n\r\n return [value, toggle];\r\n}\r\n"],"names":["useState","useCallback"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useToggle.cjs","sources":["../../../src/hooks/useToggle.ts"],"sourcesContent":["'use client';\n\nimport { useState, useCallback } from \"react\";\r\n\r\n/**\r\n * A hook that returns a boolean state and a function to toggle it\r\n * @param initialValue - The initial value of the toggle (default: false)\r\n * @returns A tuple containing the current value and a toggle function\r\n */\r\nexport function useToggle(initialValue = false): [boolean, () => void] {\r\n const [value, setValue] = useState(initialValue);\r\n\r\n const toggle = useCallback(() => {\r\n setValue((prev) => !prev);\r\n }, []);\r\n\r\n return [value, toggle];\r\n}\r\n"],"names":["useState","useCallback"],"mappings":";;;;AASO,SAAS,UAAU,eAAe,OAA8B;AACrE,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAS,YAAY;AAE/C,QAAM,SAASC,MAAAA,YAAY,MAAM;AAC/B,aAAS,CAAC,SAAS,CAAC,IAAI;AAAA,EAC1B,GAAG,CAAA,CAAE;AAEL,SAAO,CAAC,OAAO,MAAM;AACvB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sources":["../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport {\n Alert as AlertPrimitive,\n AlertTitle as AlertTitlePrimitive,\n AlertDescription as AlertDescriptionPrimitive,\n} from \"../../primitives/alert\"\n\nexport const Alert = forwardRef<\n ElementRef<typeof AlertPrimitive>,\n ComponentPropsWithoutRef<typeof AlertPrimitive>\n>((props, ref) => <AlertPrimitive ref={ref} {...props} />)\nAlert.displayName = \"Alert\"\n\nexport const AlertTitle = forwardRef<\n ElementRef<typeof AlertTitlePrimitive>,\n ComponentPropsWithoutRef<typeof AlertTitlePrimitive>\n>((props, ref) => <AlertTitlePrimitive ref={ref} {...props} />)\nAlertTitle.displayName = \"AlertTitle\"\n\nexport const AlertDescription = forwardRef<\n ElementRef<typeof AlertDescriptionPrimitive>,\n ComponentPropsWithoutRef<typeof AlertDescriptionPrimitive>\n>((props, ref) => <AlertDescriptionPrimitive ref={ref} {...props} />)\nAlertDescription.displayName = \"AlertDescription\"\n"],"names":["AlertPrimitive","AlertTitlePrimitive","AlertDescriptionPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Alert.js","sources":["../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport {\n Alert as AlertPrimitive,\n AlertTitle as AlertTitlePrimitive,\n AlertDescription as AlertDescriptionPrimitive,\n} from \"../../primitives/alert\"\n\nexport const Alert = forwardRef<\n ElementRef<typeof AlertPrimitive>,\n ComponentPropsWithoutRef<typeof AlertPrimitive>\n>((props, ref) => <AlertPrimitive ref={ref} {...props} />)\nAlert.displayName = \"Alert\"\n\nexport const AlertTitle = forwardRef<\n ElementRef<typeof AlertTitlePrimitive>,\n ComponentPropsWithoutRef<typeof AlertTitlePrimitive>\n>((props, ref) => <AlertTitlePrimitive ref={ref} {...props} />)\nAlertTitle.displayName = \"AlertTitle\"\n\nexport const AlertDescription = forwardRef<\n ElementRef<typeof AlertDescriptionPrimitive>,\n ComponentPropsWithoutRef<typeof AlertDescriptionPrimitive>\n>((props, ref) => <AlertDescriptionPrimitive ref={ref} {...props} />)\nAlertDescription.displayName = \"AlertDescription\"\n"],"names":["AlertPrimitive","AlertTitlePrimitive","AlertDescriptionPrimitive"],"mappings":";;;;AAQO,MAAM,QAAQ,WAGnB,CAAC,OAAO,4BAASA,SAAA,EAAe,KAAW,GAAG,OAAO,CAAE;AACzD,MAAM,cAAc;AAEb,MAAM,aAAa,WAGxB,CAAC,OAAO,4BAASC,cAAA,EAAoB,KAAW,GAAG,OAAO,CAAE;AAC9D,WAAW,cAAc;AAElB,MAAM,mBAAmB,WAG9B,CAAC,OAAO,4BAASC,oBAAA,EAA0B,KAAW,GAAG,OAAO,CAAE;AACpE,iBAAiB,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport {\n Avatar as AvatarPrimitive,\n AvatarImage as AvatarImagePrimitive,\n AvatarFallback as AvatarFallbackPrimitive,\n} from \"../../primitives/avatar\"\n\nexport const Avatar = forwardRef<\n ElementRef<typeof AvatarPrimitive>,\n ComponentPropsWithoutRef<typeof AvatarPrimitive>\n>((props, ref) => <AvatarPrimitive ref={ref} {...props} />)\nAvatar.displayName = \"Avatar\"\n\nexport const AvatarImage = forwardRef<\n ElementRef<typeof AvatarImagePrimitive>,\n ComponentPropsWithoutRef<typeof AvatarImagePrimitive>\n>((props, ref) => <AvatarImagePrimitive ref={ref} {...props} />)\nAvatarImage.displayName = \"AvatarImage\"\n\nexport const AvatarFallback = forwardRef<\n ElementRef<typeof AvatarFallbackPrimitive>,\n ComponentPropsWithoutRef<typeof AvatarFallbackPrimitive>\n>((props, ref) => <AvatarFallbackPrimitive ref={ref} {...props} />)\nAvatarFallback.displayName = \"AvatarFallback\"\n"],"names":["AvatarPrimitive","AvatarImagePrimitive","AvatarFallbackPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Avatar.js","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport {\n Avatar as AvatarPrimitive,\n AvatarImage as AvatarImagePrimitive,\n AvatarFallback as AvatarFallbackPrimitive,\n} from \"../../primitives/avatar\"\n\nexport const Avatar = forwardRef<\n ElementRef<typeof AvatarPrimitive>,\n ComponentPropsWithoutRef<typeof AvatarPrimitive>\n>((props, ref) => <AvatarPrimitive ref={ref} {...props} />)\nAvatar.displayName = \"Avatar\"\n\nexport const AvatarImage = forwardRef<\n ElementRef<typeof AvatarImagePrimitive>,\n ComponentPropsWithoutRef<typeof AvatarImagePrimitive>\n>((props, ref) => <AvatarImagePrimitive ref={ref} {...props} />)\nAvatarImage.displayName = \"AvatarImage\"\n\nexport const AvatarFallback = forwardRef<\n ElementRef<typeof AvatarFallbackPrimitive>,\n ComponentPropsWithoutRef<typeof AvatarFallbackPrimitive>\n>((props, ref) => <AvatarFallbackPrimitive ref={ref} {...props} />)\nAvatarFallback.displayName = \"AvatarFallback\"\n"],"names":["AvatarPrimitive","AvatarImagePrimitive","AvatarFallbackPrimitive"],"mappings":";;;;AAQO,MAAM,SAAS,WAGpB,CAAC,OAAO,4BAASA,UAAA,EAAgB,KAAW,GAAG,OAAO,CAAE;AAC1D,OAAO,cAAc;AAEd,MAAM,cAAc,WAGzB,CAAC,OAAO,4BAASC,eAAA,EAAqB,KAAW,GAAG,OAAO,CAAE;AAC/D,YAAY,cAAc;AAEnB,MAAM,iBAAiB,WAG5B,CAAC,OAAO,4BAASC,kBAAA,EAAwB,KAAW,GAAG,OAAO,CAAE;AAClE,eAAe,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import { Badge as BadgePrimitive, badgeVariants as badgeVariantsPrimitive } from \"../../primitives/badge\"\nimport type { BadgeProps as BadgePrimitiveProps } from \"../../primitives/badge\"\n\nexport type BadgeProps = BadgePrimitiveProps\n\nexport function Badge(props: BadgeProps) {\n return <BadgePrimitive {...props} />\n}\nBadge.displayName = \"Badge\"\n\nexport const badgeVariants = badgeVariantsPrimitive\n"],"names":["BadgePrimitive","badgeVariantsPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import { Badge as BadgePrimitive, badgeVariants as badgeVariantsPrimitive } from \"../../primitives/badge\"\nimport type { BadgeProps as BadgePrimitiveProps } from \"../../primitives/badge\"\n\nexport type BadgeProps = BadgePrimitiveProps\n\nexport function Badge(props: BadgeProps) {\n return <BadgePrimitive {...props} />\n}\nBadge.displayName = \"Badge\"\n\nexport const badgeVariants = badgeVariantsPrimitive\n"],"names":["BadgePrimitive","badgeVariantsPrimitive"],"mappings":";;;AAKO,SAAS,MAAM,OAAmB;AACvC,SAAO,oBAACA,SAAA,EAAgB,GAAG,MAAA,CAAO;AACpC;AACA,MAAM,cAAc;AAEb,MAAM,gBAAgBC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../utils/cn\";\nimport { ButtonPrimitive, buttonVariants as buttonVariantsPrimitive } from \"../../primitives/button\"\n\nexport const buttonVariants = buttonVariantsPrimitive;\n\ntype PrimitiveVariant = NonNullable<VariantProps<typeof buttonVariants>[\"variant\"]>;\ntype PrimitiveSize = NonNullable<VariantProps<typeof buttonVariants>[\"size\"]>;\n\nconst variantMap: Record<string, PrimitiveVariant> = {\n primary: \"default\",\n secondary: \"secondary\",\n outline: \"outline\",\n ghost: \"ghost\",\n danger: \"destructive\",\n};\n\nconst sizeMap: Record<string, PrimitiveSize> = {\n sm: \"sm\",\n md: \"default\",\n lg: \"lg\",\n};\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** Visual style variant */\n variant?: keyof typeof variantMap;\n /** Size of the button */\n size?: keyof typeof sizeMap;\n /** Stretch button to full container width */\n fullWidth?: boolean;\n /** Show a loading spinner and disable interaction */\n loading?: boolean;\n /** Render as child element via Slot (e.g. wrap a Link) */\n asChild?: boolean;\n children: ReactNode;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n children,\n variant = \"primary\",\n size = \"md\",\n fullWidth = false,\n loading = false,\n disabled,\n className,\n asChild = false,\n style,\n ...props\n },\n ref\n) {\n return (\n <ButtonPrimitive\n ref={ref}\n variant={variantMap[variant]}\n size={sizeMap[size]}\n asChild={asChild}\n disabled={disabled || loading}\n className={cn(fullWidth && \"w-full\", \"relative cursor-pointer\", className)}\n style={style}\n {...props}\n >\n {asChild ? (\n children\n ) : (\n <>\n {loading && (\n <span className=\"absolute inset-0 flex items-center justify-center\">\n <span className=\"size-4 border-2 border-current border-r-transparent rounded-full animate-spin\" />\n </span>\n )}\n <span className={cn(\"inline-flex items-center gap-2\", loading && \"invisible\")}>{children}</span>\n </>\n )}\n </ButtonPrimitive>\n );\n});\n\nButton.displayName = \"Button\";\n"],"names":["buttonVariantsPrimitive","Button"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../utils/cn\";\nimport { ButtonPrimitive, buttonVariants as buttonVariantsPrimitive } from \"../../primitives/button\"\n\nexport const buttonVariants = buttonVariantsPrimitive;\n\ntype PrimitiveVariant = NonNullable<VariantProps<typeof buttonVariants>[\"variant\"]>;\ntype PrimitiveSize = NonNullable<VariantProps<typeof buttonVariants>[\"size\"]>;\n\nconst variantMap: Record<string, PrimitiveVariant> = {\n primary: \"default\",\n secondary: \"secondary\",\n outline: \"outline\",\n ghost: \"ghost\",\n danger: \"destructive\",\n};\n\nconst sizeMap: Record<string, PrimitiveSize> = {\n sm: \"sm\",\n md: \"default\",\n lg: \"lg\",\n};\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** Visual style variant */\n variant?: keyof typeof variantMap;\n /** Size of the button */\n size?: keyof typeof sizeMap;\n /** Stretch button to full container width */\n fullWidth?: boolean;\n /** Show a loading spinner and disable interaction */\n loading?: boolean;\n /** Render as child element via Slot (e.g. wrap a Link) */\n asChild?: boolean;\n children: ReactNode;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n children,\n variant = \"primary\",\n size = \"md\",\n fullWidth = false,\n loading = false,\n disabled,\n className,\n asChild = false,\n style,\n ...props\n },\n ref\n) {\n return (\n <ButtonPrimitive\n ref={ref}\n variant={variantMap[variant]}\n size={sizeMap[size]}\n asChild={asChild}\n disabled={disabled || loading}\n className={cn(fullWidth && \"w-full\", \"relative cursor-pointer\", className)}\n style={style}\n {...props}\n >\n {asChild ? (\n children\n ) : (\n <>\n {loading && (\n <span className=\"absolute inset-0 flex items-center justify-center\">\n <span className=\"size-4 border-2 border-current border-r-transparent rounded-full animate-spin\" />\n </span>\n )}\n <span className={cn(\"inline-flex items-center gap-2\", loading && \"invisible\")}>{children}</span>\n </>\n )}\n </ButtonPrimitive>\n );\n});\n\nButton.displayName = \"Button\";\n"],"names":["buttonVariantsPrimitive","Button"],"mappings":";;;;;;AAKO,MAAM,iBAAiBA;AAK9B,MAAM,aAA+C;AAAA,EACnD,SAAS;AAAA,EACT,WAAW;AAAA,EACX,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AACV;AAEA,MAAM,UAAyC;AAAA,EAC7C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAgBO,MAAM,SAAS,WAA2C,SAASC,QACxE;AAAA,EACE;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,SAAS,WAAW,OAAO;AAAA,MAC3B,MAAM,QAAQ,IAAI;AAAA,MAClB;AAAA,MACA,UAAU,YAAY;AAAA,MACtB,WAAW,GAAG,aAAa,UAAU,2BAA2B,SAAS;AAAA,MACzE;AAAA,MACC,GAAG;AAAA,MAEH,UAAA,UACC,WAEA,qBAAA,UAAA,EACG,UAAA;AAAA,QAAA,WACC,oBAAC,UAAK,WAAU,qDACd,8BAAC,QAAA,EAAK,WAAU,iFAAgF,EAAA,CAClG;AAAA,QAEF,oBAAC,UAAK,WAAW,GAAG,kCAAkC,WAAW,WAAW,GAAI,SAAA,CAAS;AAAA,MAAA,EAAA,CAC3F;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;AAED,OAAO,cAAc;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
3
|
import { forwardRef } from "react";
|
|
3
4
|
import { Card as Card$1, CardContent as CardContent$1, CardDescription as CardDescription$1, CardFooter as CardFooter$1, CardHeader as CardHeader$1, CardTitle as CardTitle$1 } from "../../primitives/card.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../../../src/components/Card/Card.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport {\n Card as CardPrimitive,\n CardHeader as CardHeaderPrimitive,\n CardTitle as CardTitlePrimitive,\n CardDescription as CardDescriptionPrimitive,\n CardContent as CardContentPrimitive,\n CardFooter as CardFooterPrimitive,\n} from \"../../primitives/card\"\n\nexport const Card = forwardRef<\n ElementRef<typeof CardPrimitive>,\n ComponentPropsWithoutRef<typeof CardPrimitive>\n>((props, ref) => <CardPrimitive ref={ref} {...props} />)\nCard.displayName = \"Card\"\n\nexport const CardHeader = forwardRef<\n ElementRef<typeof CardHeaderPrimitive>,\n ComponentPropsWithoutRef<typeof CardHeaderPrimitive>\n>((props, ref) => <CardHeaderPrimitive ref={ref} {...props} />)\nCardHeader.displayName = \"CardHeader\"\n\nexport const CardTitle = forwardRef<\n ElementRef<typeof CardTitlePrimitive>,\n ComponentPropsWithoutRef<typeof CardTitlePrimitive>\n>((props, ref) => <CardTitlePrimitive ref={ref} {...props} />)\nCardTitle.displayName = \"CardTitle\"\n\nexport const CardDescription = forwardRef<\n ElementRef<typeof CardDescriptionPrimitive>,\n ComponentPropsWithoutRef<typeof CardDescriptionPrimitive>\n>((props, ref) => <CardDescriptionPrimitive ref={ref} {...props} />)\nCardDescription.displayName = \"CardDescription\"\n\nexport const CardContent = forwardRef<\n ElementRef<typeof CardContentPrimitive>,\n ComponentPropsWithoutRef<typeof CardContentPrimitive>\n>((props, ref) => <CardContentPrimitive ref={ref} {...props} />)\nCardContent.displayName = \"CardContent\"\n\nexport const CardFooter = forwardRef<\n ElementRef<typeof CardFooterPrimitive>,\n ComponentPropsWithoutRef<typeof CardFooterPrimitive>\n>((props, ref) => <CardFooterPrimitive ref={ref} {...props} />)\nCardFooter.displayName = \"CardFooter\"\n"],"names":["CardPrimitive","CardHeaderPrimitive","CardTitlePrimitive","CardDescriptionPrimitive","CardContentPrimitive","CardFooterPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../../src/components/Card/Card.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\"\nimport {\n Card as CardPrimitive,\n CardHeader as CardHeaderPrimitive,\n CardTitle as CardTitlePrimitive,\n CardDescription as CardDescriptionPrimitive,\n CardContent as CardContentPrimitive,\n CardFooter as CardFooterPrimitive,\n} from \"../../primitives/card\"\n\nexport const Card = forwardRef<\n ElementRef<typeof CardPrimitive>,\n ComponentPropsWithoutRef<typeof CardPrimitive>\n>((props, ref) => <CardPrimitive ref={ref} {...props} />)\nCard.displayName = \"Card\"\n\nexport const CardHeader = forwardRef<\n ElementRef<typeof CardHeaderPrimitive>,\n ComponentPropsWithoutRef<typeof CardHeaderPrimitive>\n>((props, ref) => <CardHeaderPrimitive ref={ref} {...props} />)\nCardHeader.displayName = \"CardHeader\"\n\nexport const CardTitle = forwardRef<\n ElementRef<typeof CardTitlePrimitive>,\n ComponentPropsWithoutRef<typeof CardTitlePrimitive>\n>((props, ref) => <CardTitlePrimitive ref={ref} {...props} />)\nCardTitle.displayName = \"CardTitle\"\n\nexport const CardDescription = forwardRef<\n ElementRef<typeof CardDescriptionPrimitive>,\n ComponentPropsWithoutRef<typeof CardDescriptionPrimitive>\n>((props, ref) => <CardDescriptionPrimitive ref={ref} {...props} />)\nCardDescription.displayName = \"CardDescription\"\n\nexport const CardContent = forwardRef<\n ElementRef<typeof CardContentPrimitive>,\n ComponentPropsWithoutRef<typeof CardContentPrimitive>\n>((props, ref) => <CardContentPrimitive ref={ref} {...props} />)\nCardContent.displayName = \"CardContent\"\n\nexport const CardFooter = forwardRef<\n ElementRef<typeof CardFooterPrimitive>,\n ComponentPropsWithoutRef<typeof CardFooterPrimitive>\n>((props, ref) => <CardFooterPrimitive ref={ref} {...props} />)\nCardFooter.displayName = \"CardFooter\"\n"],"names":["CardPrimitive","CardHeaderPrimitive","CardTitlePrimitive","CardDescriptionPrimitive","CardContentPrimitive","CardFooterPrimitive"],"mappings":";;;;AAWO,MAAM,OAAO,WAGlB,CAAC,OAAO,4BAASA,QAAA,EAAc,KAAW,GAAG,OAAO,CAAE;AACxD,KAAK,cAAc;AAEZ,MAAM,aAAa,WAGxB,CAAC,OAAO,4BAASC,cAAA,EAAoB,KAAW,GAAG,OAAO,CAAE;AAC9D,WAAW,cAAc;AAElB,MAAM,YAAY,WAGvB,CAAC,OAAO,4BAASC,aAAA,EAAmB,KAAW,GAAG,OAAO,CAAE;AAC7D,UAAU,cAAc;AAEjB,MAAM,kBAAkB,WAG7B,CAAC,OAAO,4BAASC,mBAAA,EAAyB,KAAW,GAAG,OAAO,CAAE;AACnE,gBAAgB,cAAc;AAEvB,MAAM,cAAc,WAGzB,CAAC,OAAO,4BAASC,eAAA,EAAqB,KAAW,GAAG,OAAO,CAAE;AAC/D,YAAY,cAAc;AAEnB,MAAM,aAAa,WAGxB,CAAC,OAAO,4BAASC,cAAA,EAAoB,KAAW,GAAG,OAAO,CAAE;AAC9D,WAAW,cAAc;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
3
|
import { forwardRef } from "react";
|
|
3
4
|
import { DropdownMenu as DropdownMenu$1, DropdownMenuCheckboxItem as DropdownMenuCheckboxItem$1, DropdownMenuContent as DropdownMenuContent$1, DropdownMenuGroup as DropdownMenuGroup$1, DropdownMenuItem as DropdownMenuItem$1, DropdownMenuLabel as DropdownMenuLabel$1, DropdownMenuPortal as DropdownMenuPortal$1, DropdownMenuRadioGroup as DropdownMenuRadioGroup$1, DropdownMenuRadioItem as DropdownMenuRadioItem$1, DropdownMenuSeparator as DropdownMenuSeparator$1, DropdownMenuShortcut as DropdownMenuShortcut$1, DropdownMenuSub as DropdownMenuSub$1, DropdownMenuSubContent as DropdownMenuSubContent$1, DropdownMenuSubTrigger as DropdownMenuSubTrigger$1, DropdownMenuTrigger as DropdownMenuTrigger$1 } from "../../primitives/dropdown-menu.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.js","sources":["../../../src/components/DropdownMenu/DropdownMenu.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef, HTMLAttributes } from \"react\"\nimport {\n DropdownMenu as DropdownMenuPrimitive,\n DropdownMenuTrigger as DropdownMenuTriggerPrimitive,\n DropdownMenuContent as DropdownMenuContentPrimitive,\n DropdownMenuItem as DropdownMenuItemPrimitive,\n DropdownMenuCheckboxItem as DropdownMenuCheckboxItemPrimitive,\n DropdownMenuRadioItem as DropdownMenuRadioItemPrimitive,\n DropdownMenuLabel as DropdownMenuLabelPrimitive,\n DropdownMenuSeparator as DropdownMenuSeparatorPrimitive,\n DropdownMenuShortcut as DropdownMenuShortcutPrimitive,\n DropdownMenuGroup as DropdownMenuGroupPrimitive,\n DropdownMenuPortal as DropdownMenuPortalPrimitive,\n DropdownMenuSub as DropdownMenuSubPrimitive,\n DropdownMenuSubContent as DropdownMenuSubContentPrimitive,\n DropdownMenuSubTrigger as DropdownMenuSubTriggerPrimitive,\n DropdownMenuRadioGroup as DropdownMenuRadioGroupPrimitive,\n} from \"../../primitives/dropdown-menu\"\n\n// Root / context-only components (no DOM element to ref)\nexport function DropdownMenu(props: ComponentPropsWithoutRef<typeof DropdownMenuPrimitive>) {\n return <DropdownMenuPrimitive {...props} />\n}\n\nexport function DropdownMenuPortal(props: ComponentPropsWithoutRef<typeof DropdownMenuPortalPrimitive>) {\n return <DropdownMenuPortalPrimitive {...props} />\n}\n\nexport function DropdownMenuSub(props: ComponentPropsWithoutRef<typeof DropdownMenuSubPrimitive>) {\n return <DropdownMenuSubPrimitive {...props} />\n}\n\n// DOM-rendering components (forwardRef)\nexport const DropdownMenuTrigger = forwardRef<\n ElementRef<typeof DropdownMenuTriggerPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuTriggerPrimitive>\n>((props, ref) => <DropdownMenuTriggerPrimitive ref={ref} {...props} />)\nDropdownMenuTrigger.displayName = \"DropdownMenuTrigger\"\n\nexport const DropdownMenuGroup = forwardRef<\n ElementRef<typeof DropdownMenuGroupPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuGroupPrimitive>\n>((props, ref) => <DropdownMenuGroupPrimitive ref={ref} {...props} />)\nDropdownMenuGroup.displayName = \"DropdownMenuGroup\"\n\nexport const DropdownMenuRadioGroup = forwardRef<\n ElementRef<typeof DropdownMenuRadioGroupPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuRadioGroupPrimitive>\n>((props, ref) => <DropdownMenuRadioGroupPrimitive ref={ref} {...props} />)\nDropdownMenuRadioGroup.displayName = \"DropdownMenuRadioGroup\"\n\nexport const DropdownMenuContent = forwardRef<\n ElementRef<typeof DropdownMenuContentPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuContentPrimitive>\n>((props, ref) => <DropdownMenuContentPrimitive ref={ref} {...props} />)\nDropdownMenuContent.displayName = \"DropdownMenuContent\"\n\nexport const DropdownMenuSubContent = forwardRef<\n ElementRef<typeof DropdownMenuSubContentPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuSubContentPrimitive>\n>((props, ref) => <DropdownMenuSubContentPrimitive ref={ref} {...props} />)\nDropdownMenuSubContent.displayName = \"DropdownMenuSubContent\"\n\nexport const DropdownMenuSubTrigger = forwardRef<\n ElementRef<typeof DropdownMenuSubTriggerPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuSubTriggerPrimitive>\n>((props, ref) => <DropdownMenuSubTriggerPrimitive ref={ref} {...props} />)\nDropdownMenuSubTrigger.displayName = \"DropdownMenuSubTrigger\"\n\nexport const DropdownMenuItem = forwardRef<\n ElementRef<typeof DropdownMenuItemPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuItemPrimitive>\n>((props, ref) => <DropdownMenuItemPrimitive ref={ref} {...props} />)\nDropdownMenuItem.displayName = \"DropdownMenuItem\"\n\nexport const DropdownMenuCheckboxItem = forwardRef<\n ElementRef<typeof DropdownMenuCheckboxItemPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuCheckboxItemPrimitive>\n>((props, ref) => <DropdownMenuCheckboxItemPrimitive ref={ref} {...props} />)\nDropdownMenuCheckboxItem.displayName = \"DropdownMenuCheckboxItem\"\n\nexport const DropdownMenuRadioItem = forwardRef<\n ElementRef<typeof DropdownMenuRadioItemPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuRadioItemPrimitive>\n>((props, ref) => <DropdownMenuRadioItemPrimitive ref={ref} {...props} />)\nDropdownMenuRadioItem.displayName = \"DropdownMenuRadioItem\"\n\nexport const DropdownMenuLabel = forwardRef<\n ElementRef<typeof DropdownMenuLabelPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuLabelPrimitive>\n>((props, ref) => <DropdownMenuLabelPrimitive ref={ref} {...props} />)\nDropdownMenuLabel.displayName = \"DropdownMenuLabel\"\n\nexport const DropdownMenuSeparator = forwardRef<\n ElementRef<typeof DropdownMenuSeparatorPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuSeparatorPrimitive>\n>((props, ref) => <DropdownMenuSeparatorPrimitive ref={ref} {...props} />)\nDropdownMenuSeparator.displayName = \"DropdownMenuSeparator\"\n\n// Utility span — no ref needed\nexport function DropdownMenuShortcut(props: HTMLAttributes<HTMLSpanElement>) {\n return <DropdownMenuShortcutPrimitive {...props} />\n}\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\"\n"],"names":["DropdownMenuPrimitive","DropdownMenuPortalPrimitive","DropdownMenuSubPrimitive","DropdownMenuTriggerPrimitive","DropdownMenuGroupPrimitive","DropdownMenuRadioGroupPrimitive","DropdownMenuContentPrimitive","DropdownMenuSubContentPrimitive","DropdownMenuSubTriggerPrimitive","DropdownMenuItemPrimitive","DropdownMenuCheckboxItemPrimitive","DropdownMenuRadioItemPrimitive","DropdownMenuLabelPrimitive","DropdownMenuSeparatorPrimitive","DropdownMenuShortcutPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"DropdownMenu.js","sources":["../../../src/components/DropdownMenu/DropdownMenu.tsx"],"sourcesContent":["import { forwardRef } from \"react\"\nimport type { ComponentPropsWithoutRef, ElementRef, HTMLAttributes } from \"react\"\nimport {\n DropdownMenu as DropdownMenuPrimitive,\n DropdownMenuTrigger as DropdownMenuTriggerPrimitive,\n DropdownMenuContent as DropdownMenuContentPrimitive,\n DropdownMenuItem as DropdownMenuItemPrimitive,\n DropdownMenuCheckboxItem as DropdownMenuCheckboxItemPrimitive,\n DropdownMenuRadioItem as DropdownMenuRadioItemPrimitive,\n DropdownMenuLabel as DropdownMenuLabelPrimitive,\n DropdownMenuSeparator as DropdownMenuSeparatorPrimitive,\n DropdownMenuShortcut as DropdownMenuShortcutPrimitive,\n DropdownMenuGroup as DropdownMenuGroupPrimitive,\n DropdownMenuPortal as DropdownMenuPortalPrimitive,\n DropdownMenuSub as DropdownMenuSubPrimitive,\n DropdownMenuSubContent as DropdownMenuSubContentPrimitive,\n DropdownMenuSubTrigger as DropdownMenuSubTriggerPrimitive,\n DropdownMenuRadioGroup as DropdownMenuRadioGroupPrimitive,\n} from \"../../primitives/dropdown-menu\"\n\n// Root / context-only components (no DOM element to ref)\nexport function DropdownMenu(props: ComponentPropsWithoutRef<typeof DropdownMenuPrimitive>) {\n return <DropdownMenuPrimitive {...props} />\n}\n\nexport function DropdownMenuPortal(props: ComponentPropsWithoutRef<typeof DropdownMenuPortalPrimitive>) {\n return <DropdownMenuPortalPrimitive {...props} />\n}\n\nexport function DropdownMenuSub(props: ComponentPropsWithoutRef<typeof DropdownMenuSubPrimitive>) {\n return <DropdownMenuSubPrimitive {...props} />\n}\n\n// DOM-rendering components (forwardRef)\nexport const DropdownMenuTrigger = forwardRef<\n ElementRef<typeof DropdownMenuTriggerPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuTriggerPrimitive>\n>((props, ref) => <DropdownMenuTriggerPrimitive ref={ref} {...props} />)\nDropdownMenuTrigger.displayName = \"DropdownMenuTrigger\"\n\nexport const DropdownMenuGroup = forwardRef<\n ElementRef<typeof DropdownMenuGroupPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuGroupPrimitive>\n>((props, ref) => <DropdownMenuGroupPrimitive ref={ref} {...props} />)\nDropdownMenuGroup.displayName = \"DropdownMenuGroup\"\n\nexport const DropdownMenuRadioGroup = forwardRef<\n ElementRef<typeof DropdownMenuRadioGroupPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuRadioGroupPrimitive>\n>((props, ref) => <DropdownMenuRadioGroupPrimitive ref={ref} {...props} />)\nDropdownMenuRadioGroup.displayName = \"DropdownMenuRadioGroup\"\n\nexport const DropdownMenuContent = forwardRef<\n ElementRef<typeof DropdownMenuContentPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuContentPrimitive>\n>((props, ref) => <DropdownMenuContentPrimitive ref={ref} {...props} />)\nDropdownMenuContent.displayName = \"DropdownMenuContent\"\n\nexport const DropdownMenuSubContent = forwardRef<\n ElementRef<typeof DropdownMenuSubContentPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuSubContentPrimitive>\n>((props, ref) => <DropdownMenuSubContentPrimitive ref={ref} {...props} />)\nDropdownMenuSubContent.displayName = \"DropdownMenuSubContent\"\n\nexport const DropdownMenuSubTrigger = forwardRef<\n ElementRef<typeof DropdownMenuSubTriggerPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuSubTriggerPrimitive>\n>((props, ref) => <DropdownMenuSubTriggerPrimitive ref={ref} {...props} />)\nDropdownMenuSubTrigger.displayName = \"DropdownMenuSubTrigger\"\n\nexport const DropdownMenuItem = forwardRef<\n ElementRef<typeof DropdownMenuItemPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuItemPrimitive>\n>((props, ref) => <DropdownMenuItemPrimitive ref={ref} {...props} />)\nDropdownMenuItem.displayName = \"DropdownMenuItem\"\n\nexport const DropdownMenuCheckboxItem = forwardRef<\n ElementRef<typeof DropdownMenuCheckboxItemPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuCheckboxItemPrimitive>\n>((props, ref) => <DropdownMenuCheckboxItemPrimitive ref={ref} {...props} />)\nDropdownMenuCheckboxItem.displayName = \"DropdownMenuCheckboxItem\"\n\nexport const DropdownMenuRadioItem = forwardRef<\n ElementRef<typeof DropdownMenuRadioItemPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuRadioItemPrimitive>\n>((props, ref) => <DropdownMenuRadioItemPrimitive ref={ref} {...props} />)\nDropdownMenuRadioItem.displayName = \"DropdownMenuRadioItem\"\n\nexport const DropdownMenuLabel = forwardRef<\n ElementRef<typeof DropdownMenuLabelPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuLabelPrimitive>\n>((props, ref) => <DropdownMenuLabelPrimitive ref={ref} {...props} />)\nDropdownMenuLabel.displayName = \"DropdownMenuLabel\"\n\nexport const DropdownMenuSeparator = forwardRef<\n ElementRef<typeof DropdownMenuSeparatorPrimitive>,\n ComponentPropsWithoutRef<typeof DropdownMenuSeparatorPrimitive>\n>((props, ref) => <DropdownMenuSeparatorPrimitive ref={ref} {...props} />)\nDropdownMenuSeparator.displayName = \"DropdownMenuSeparator\"\n\n// Utility span — no ref needed\nexport function DropdownMenuShortcut(props: HTMLAttributes<HTMLSpanElement>) {\n return <DropdownMenuShortcutPrimitive {...props} />\n}\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\"\n"],"names":["DropdownMenuPrimitive","DropdownMenuPortalPrimitive","DropdownMenuSubPrimitive","DropdownMenuTriggerPrimitive","DropdownMenuGroupPrimitive","DropdownMenuRadioGroupPrimitive","DropdownMenuContentPrimitive","DropdownMenuSubContentPrimitive","DropdownMenuSubTriggerPrimitive","DropdownMenuItemPrimitive","DropdownMenuCheckboxItemPrimitive","DropdownMenuRadioItemPrimitive","DropdownMenuLabelPrimitive","DropdownMenuSeparatorPrimitive","DropdownMenuShortcutPrimitive"],"mappings":";;;;AAqBO,SAAS,aAAa,OAA+D;AAC1F,SAAO,oBAACA,gBAAA,EAAuB,GAAG,MAAA,CAAO;AAC3C;AAEO,SAAS,mBAAmB,OAAqE;AACtG,SAAO,oBAACC,sBAAA,EAA6B,GAAG,MAAA,CAAO;AACjD;AAEO,SAAS,gBAAgB,OAAkE;AAChG,SAAO,oBAACC,mBAAA,EAA0B,GAAG,MAAA,CAAO;AAC9C;AAGO,MAAM,sBAAsB,WAGjC,CAAC,OAAO,4BAASC,uBAAA,EAA6B,KAAW,GAAG,OAAO,CAAE;AACvE,oBAAoB,cAAc;AAE3B,MAAM,oBAAoB,WAG/B,CAAC,OAAO,4BAASC,qBAAA,EAA2B,KAAW,GAAG,OAAO,CAAE;AACrE,kBAAkB,cAAc;AAEzB,MAAM,yBAAyB,WAGpC,CAAC,OAAO,4BAASC,0BAAA,EAAgC,KAAW,GAAG,OAAO,CAAE;AAC1E,uBAAuB,cAAc;AAE9B,MAAM,sBAAsB,WAGjC,CAAC,OAAO,4BAASC,uBAAA,EAA6B,KAAW,GAAG,OAAO,CAAE;AACvE,oBAAoB,cAAc;AAE3B,MAAM,yBAAyB,WAGpC,CAAC,OAAO,4BAASC,0BAAA,EAAgC,KAAW,GAAG,OAAO,CAAE;AAC1E,uBAAuB,cAAc;AAE9B,MAAM,yBAAyB,WAGpC,CAAC,OAAO,4BAASC,0BAAA,EAAgC,KAAW,GAAG,OAAO,CAAE;AAC1E,uBAAuB,cAAc;AAE9B,MAAM,mBAAmB,WAG9B,CAAC,OAAO,4BAASC,oBAAA,EAA0B,KAAW,GAAG,OAAO,CAAE;AACpE,iBAAiB,cAAc;AAExB,MAAM,2BAA2B,WAGtC,CAAC,OAAO,4BAASC,4BAAA,EAAkC,KAAW,GAAG,OAAO,CAAE;AAC5E,yBAAyB,cAAc;AAEhC,MAAM,wBAAwB,WAGnC,CAAC,OAAO,4BAASC,yBAAA,EAA+B,KAAW,GAAG,OAAO,CAAE;AACzE,sBAAsB,cAAc;AAE7B,MAAM,oBAAoB,WAG/B,CAAC,OAAO,4BAASC,qBAAA,EAA2B,KAAW,GAAG,OAAO,CAAE;AACrE,kBAAkB,cAAc;AAEzB,MAAM,wBAAwB,WAGnC,CAAC,OAAO,4BAASC,yBAAA,EAA+B,KAAW,GAAG,OAAO,CAAE;AACzE,sBAAsB,cAAc;AAG7B,SAAS,qBAAqB,OAAwC;AAC3E,SAAO,oBAACC,wBAAA,EAA+B,GAAG,MAAA,CAAO;AACnD;AACA,qBAAqB,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../../src/components/Form/Checkbox.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, useId, useContext, useEffect } from \"react\";\nimport type { ReactNode, ComponentPropsWithoutRef } from \"react\";\nimport { useController, useFormContext as useRHFFormContext, type FieldValues, type FieldPath, type Control } from \"react-hook-form\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../utils/cn\";\nimport { FormConfigContext, type FormConfig, type FieldValidationRules } from \"../Form/context\";\nimport { Checkbox as ShadcnCheckbox } from \"../../primitives/checkbox\";\nimport { Label } from \"../../primitives/label\";\nimport type * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\n\nconst checkboxSizeVariants = cva(\n \"\",\n {\n variants: {\n size: {\n sm: \"h-4 w-4\",\n md: \"h-5 w-5\",\n lg: \"h-6 w-6\",\n },\n },\n defaultVariants: {\n size: \"md\",\n },\n }\n);\n\nconst labelVariants = cva(\n \"text-sm font-medium cursor-pointer select-none\",\n {\n variants: {\n required: {\n true: \"after:content-['*'] after:ml-0.5 after:text-destructive\",\n false: \"\",\n },\n disabled: {\n true: \"cursor-not-allowed opacity-50\",\n false: \"\",\n },\n },\n defaultVariants: {\n required: false,\n disabled: false,\n },\n }\n);\n\nexport interface CheckboxProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> extends Omit<ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, \"name\" | \"checked\" | \"onCheckedChange\" | \"required\">,\n VariantProps<typeof checkboxSizeVariants> {\n /** Field name - required for form integration */\n name: TName;\n /** Label text for the checkbox */\n label?: ReactNode;\n /** Helper text displayed below the checkbox */\n helperText?: string;\n /** Whether to show the error message */\n showError?: boolean;\n /** Custom error message (overrides form error) */\n error?: string;\n /** External control (for use outside Form) */\n control?: Control<TFieldValues>;\n /** Variant style */\n variant?: \"default\" | \"error\";\n \n // Validation props\n /** Field is required (must be checked) */\n required?: boolean | string;\n /** Custom validation function */\n validate?: (value: unknown) => boolean | string | Promise<boolean | string>;\n}\n\n/**\n * Checkbox component with form integration\n * \n * This is a wrapper around the shadcn/ui Checkbox primitive that adds:\n * - Form integration with react-hook-form\n * - Automatic validation registration\n * - Label, helper text, and error message support\n * \n * @example\n * ```tsx\n * // Inside a Form component\n * <Checkbox name=\"terms\" label=\"I agree to the terms and conditions\" required />\n * <Checkbox name=\"newsletter\" label=\"Subscribe to newsletter\" />\n * ```\n */\nfunction CheckboxInner<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>(\n {\n name,\n label,\n helperText,\n showError = true,\n error: customError,\n size,\n variant,\n className,\n disabled,\n id: providedId,\n control: externalControl,\n // Validation props\n required,\n validate,\n ...props\n }: CheckboxProps<TFieldValues, TName>,\n ref: React.ForwardedRef<React.ElementRef<typeof CheckboxPrimitive.Root>>\n) {\n const generatedId = useId();\n const inputId = providedId ?? generatedId;\n \n // Try to get form context\n const formConfigContext = useContext(FormConfigContext);\n const formConfig: FormConfig = formConfigContext ?? {};\n \n // Get form context from react-hook-form\n const rhfContext = useRHFFormContext<TFieldValues>();\n const control = externalControl ?? rhfContext?.control;\n\n // Register validation rules with the form\n useEffect(() => {\n if (formConfigContext?.registerFieldValidation) {\n const rules: FieldValidationRules = {};\n \n if (required !== undefined) rules.required = required;\n if (validate !== undefined) rules.validate = validate;\n\n formConfigContext.registerFieldValidation({\n name: name as string,\n type: \"boolean\",\n rules,\n });\n\n return () => {\n formConfigContext.unregisterFieldValidation(name as string);\n };\n }\n }, [formConfigContext, name, required, validate]);\n\n // Use controller for form integration\n const { field, fieldState } = useController<TFieldValues, TName>({\n name,\n control,\n });\n\n const fieldError = fieldState.error?.message;\n const errorMessage = customError ?? fieldError;\n const hasError = !!errorMessage;\n \n // Merge sizes - prop takes precedence over form config\n const effectiveSize = size ?? formConfig.size ?? \"md\";\n const effectiveDisabled = disabled ?? formConfig.disabled;\n \n // Determine variant based on error state\n const effectiveVariant = hasError ? \"error\" : variant;\n\n return (\n <div className=\"space-y-1.5\">\n <div className=\"flex items-center gap-2\">\n <ShadcnCheckbox\n {...props}\n ref={ref}\n id={inputId}\n checked={field.value ?? false}\n onCheckedChange={(checked) => field.onChange(checked === true)}\n onBlur={field.onBlur}\n disabled={effectiveDisabled}\n aria-invalid={hasError}\n aria-describedby={\n hasError\n ? `${inputId}-error`\n : helperText\n ? `${inputId}-helper`\n : undefined\n }\n className={cn(\n checkboxSizeVariants({ size: effectiveSize }),\n effectiveVariant === \"error\" && \"border-destructive\",\n className\n )}\n />\n \n {label && (\n <Label\n htmlFor={inputId}\n className={labelVariants({ required: !!required, disabled: effectiveDisabled })}\n >\n {label}\n </Label>\n )}\n </div>\n\n {showError && hasError && (\n <p\n id={`${inputId}-error`}\n className=\"text-sm text-destructive ml-7\"\n role=\"alert\"\n >\n {errorMessage}\n </p>\n )}\n \n {helperText && !hasError && (\n <p\n id={`${inputId}-helper`}\n className=\"text-sm text-muted-foreground ml-7\"\n >\n {helperText}\n </p>\n )}\n </div>\n );\n}\n\n// Use forwardRef with generic support\nexport const Checkbox = forwardRef(CheckboxInner) as <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>(\n props: CheckboxProps<TFieldValues, TName> & { ref?: React.ForwardedRef<React.ElementRef<typeof CheckboxPrimitive.Root>> }\n) => React.ReactElement;\n\n(Checkbox as React.FC).displayName = \"Checkbox\";\n"],"names":["useRHFFormContext","ShadcnCheckbox"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../src/components/Form/Checkbox.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, useId, useContext, useEffect } from \"react\";\nimport type { ReactNode, ComponentPropsWithoutRef } from \"react\";\nimport { useController, useFormContext as useRHFFormContext, type FieldValues, type FieldPath, type Control } from \"react-hook-form\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../utils/cn\";\nimport { FormConfigContext, type FormConfig, type FieldValidationRules } from \"../Form/context\";\nimport { Checkbox as ShadcnCheckbox } from \"../../primitives/checkbox\";\nimport { Label } from \"../../primitives/label\";\nimport type * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\n\nconst checkboxSizeVariants = cva(\n \"\",\n {\n variants: {\n size: {\n sm: \"h-4 w-4\",\n md: \"h-5 w-5\",\n lg: \"h-6 w-6\",\n },\n },\n defaultVariants: {\n size: \"md\",\n },\n }\n);\n\nconst labelVariants = cva(\n \"text-sm font-medium cursor-pointer select-none\",\n {\n variants: {\n required: {\n true: \"after:content-['*'] after:ml-0.5 after:text-destructive\",\n false: \"\",\n },\n disabled: {\n true: \"cursor-not-allowed opacity-50\",\n false: \"\",\n },\n },\n defaultVariants: {\n required: false,\n disabled: false,\n },\n }\n);\n\nexport interface CheckboxProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> extends Omit<ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, \"name\" | \"checked\" | \"onCheckedChange\" | \"required\">,\n VariantProps<typeof checkboxSizeVariants> {\n /** Field name - required for form integration */\n name: TName;\n /** Label text for the checkbox */\n label?: ReactNode;\n /** Helper text displayed below the checkbox */\n helperText?: string;\n /** Whether to show the error message */\n showError?: boolean;\n /** Custom error message (overrides form error) */\n error?: string;\n /** External control (for use outside Form) */\n control?: Control<TFieldValues>;\n /** Variant style */\n variant?: \"default\" | \"error\";\n \n // Validation props\n /** Field is required (must be checked) */\n required?: boolean | string;\n /** Custom validation function */\n validate?: (value: unknown) => boolean | string | Promise<boolean | string>;\n}\n\n/**\n * Checkbox component with form integration\n * \n * This is a wrapper around the shadcn/ui Checkbox primitive that adds:\n * - Form integration with react-hook-form\n * - Automatic validation registration\n * - Label, helper text, and error message support\n * \n * @example\n * ```tsx\n * // Inside a Form component\n * <Checkbox name=\"terms\" label=\"I agree to the terms and conditions\" required />\n * <Checkbox name=\"newsletter\" label=\"Subscribe to newsletter\" />\n * ```\n */\nfunction CheckboxInner<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>(\n {\n name,\n label,\n helperText,\n showError = true,\n error: customError,\n size,\n variant,\n className,\n disabled,\n id: providedId,\n control: externalControl,\n // Validation props\n required,\n validate,\n ...props\n }: CheckboxProps<TFieldValues, TName>,\n ref: React.ForwardedRef<React.ElementRef<typeof CheckboxPrimitive.Root>>\n) {\n const generatedId = useId();\n const inputId = providedId ?? generatedId;\n \n // Try to get form context\n const formConfigContext = useContext(FormConfigContext);\n const formConfig: FormConfig = formConfigContext ?? {};\n \n // Get form context from react-hook-form\n const rhfContext = useRHFFormContext<TFieldValues>();\n const control = externalControl ?? rhfContext?.control;\n\n // Register validation rules with the form\n useEffect(() => {\n if (formConfigContext?.registerFieldValidation) {\n const rules: FieldValidationRules = {};\n \n if (required !== undefined) rules.required = required;\n if (validate !== undefined) rules.validate = validate;\n\n formConfigContext.registerFieldValidation({\n name: name as string,\n type: \"boolean\",\n rules,\n });\n\n return () => {\n formConfigContext.unregisterFieldValidation(name as string);\n };\n }\n }, [formConfigContext, name, required, validate]);\n\n // Use controller for form integration\n const { field, fieldState } = useController<TFieldValues, TName>({\n name,\n control,\n });\n\n const fieldError = fieldState.error?.message;\n const errorMessage = customError ?? fieldError;\n const hasError = !!errorMessage;\n \n // Merge sizes - prop takes precedence over form config\n const effectiveSize = size ?? formConfig.size ?? \"md\";\n const effectiveDisabled = disabled ?? formConfig.disabled;\n \n // Determine variant based on error state\n const effectiveVariant = hasError ? \"error\" : variant;\n\n return (\n <div className=\"space-y-1.5\">\n <div className=\"flex items-center gap-2\">\n <ShadcnCheckbox\n {...props}\n ref={ref}\n id={inputId}\n checked={field.value ?? false}\n onCheckedChange={(checked) => field.onChange(checked === true)}\n onBlur={field.onBlur}\n disabled={effectiveDisabled}\n aria-invalid={hasError}\n aria-describedby={\n hasError\n ? `${inputId}-error`\n : helperText\n ? `${inputId}-helper`\n : undefined\n }\n className={cn(\n checkboxSizeVariants({ size: effectiveSize }),\n effectiveVariant === \"error\" && \"border-destructive\",\n className\n )}\n />\n \n {label && (\n <Label\n htmlFor={inputId}\n className={labelVariants({ required: !!required, disabled: effectiveDisabled })}\n >\n {label}\n </Label>\n )}\n </div>\n\n {showError && hasError && (\n <p\n id={`${inputId}-error`}\n className=\"text-sm text-destructive ml-7\"\n role=\"alert\"\n >\n {errorMessage}\n </p>\n )}\n \n {helperText && !hasError && (\n <p\n id={`${inputId}-helper`}\n className=\"text-sm text-muted-foreground ml-7\"\n >\n {helperText}\n </p>\n )}\n </div>\n );\n}\n\n// Use forwardRef with generic support\nexport const Checkbox = forwardRef(CheckboxInner) as <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>(\n props: CheckboxProps<TFieldValues, TName> & { ref?: React.ForwardedRef<React.ElementRef<typeof CheckboxPrimitive.Root>> }\n) => React.ReactElement;\n\n(Checkbox as React.FC).displayName = \"Checkbox\";\n"],"names":["useRHFFormContext","ShadcnCheckbox"],"mappings":";;;;;;;;;AAYA,MAAM,uBAAuB;AAAA,EAC3B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA;AAAA,IACN;AAAA,IAEF,iBAAiB;AAAA,MACf,MAAM;AAAA,IAAA;AAAA,EACR;AAEJ;AAEA,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,UAAU;AAAA,QACR,MAAM;AAAA,QACN,OAAO;AAAA,MAAA;AAAA,MAET,UAAU;AAAA,QACR,MAAM;AAAA,QACN,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,IAEF,iBAAiB;AAAA,MACf,UAAU;AAAA,MACV,UAAU;AAAA,IAAA;AAAA,EACZ;AAEJ;AA4CA,SAAS,cAIP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,IAAI;AAAA,EACJ,SAAS;AAAA;AAAA,EAET;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,cAAc,MAAA;AACpB,QAAM,UAAU,cAAc;AAG9B,QAAM,oBAAoB,WAAW,iBAAiB;AACtD,QAAM,aAAyB,qBAAqB,CAAA;AAGpD,QAAM,aAAaA,eAAA;AACnB,QAAM,UAAU,mBAAmB,YAAY;AAG/C,YAAU,MAAM;AACd,QAAI,mBAAmB,yBAAyB;AAC9C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