adminium 1.0.1-patch.2 → 1.0.1-patch.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -15,7 +15,7 @@ var react = require('motion/react');
15
15
  var CheckboxPrimitive = require('@radix-ui/react-checkbox');
16
16
  var reactTable = require('@tanstack/react-table');
17
17
  var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
18
- var reactHookForm = require('react-hook-form');
18
+ var SeparatorPrimitive = require('@radix-ui/react-separator');
19
19
 
20
20
  function _interopNamespace(e) {
21
21
  if (e && e.__esModule) return e;
@@ -40,6 +40,7 @@ var HoverCardPrimitive__namespace = /*#__PURE__*/_interopNamespace(HoverCardPrim
40
40
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
41
41
  var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
42
42
  var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
43
+ var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
43
44
 
44
45
  // src/lib/utils.ts
45
46
  function cn(...inputs) {
@@ -3745,122 +3746,228 @@ function Label2({
3745
3746
  }
3746
3747
  );
3747
3748
  }
3748
- var Form = reactHookForm.FormProvider;
3749
- var FormFieldContext = React__namespace.createContext(
3750
- {}
3751
- );
3752
- var FormField = ({
3753
- ...props
3754
- }) => {
3755
- return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
3756
- };
3757
- var useFormField = () => {
3758
- const fieldContext = React__namespace.useContext(FormFieldContext);
3759
- const itemContext = React__namespace.useContext(FormItemContext);
3760
- const { getFieldState, formState } = reactHookForm.useFormContext();
3761
- const fieldState = getFieldState(fieldContext.name, formState);
3762
- if (!fieldContext) {
3763
- throw new Error("useFormField should be used within <FormField>");
3764
- }
3765
- const { id } = itemContext;
3766
- return {
3767
- id,
3768
- name: fieldContext.name,
3769
- formItemId: `${id}-form-item`,
3770
- formDescriptionId: `${id}-form-item-description`,
3771
- formMessageId: `${id}-form-item-message`,
3772
- ...fieldState
3773
- };
3774
- };
3775
- var FormItemContext = React__namespace.createContext(
3776
- {}
3749
+ var Separator2 = React__namespace.forwardRef(
3750
+ ({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3751
+ SeparatorPrimitive__namespace.Root,
3752
+ {
3753
+ ref,
3754
+ decorative,
3755
+ orientation,
3756
+ className: cn(
3757
+ "shrink-0 bg-border",
3758
+ orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
3759
+ className
3760
+ ),
3761
+ ...props
3762
+ }
3763
+ )
3777
3764
  );
3778
- function FormItem({
3765
+ Separator2.displayName = SeparatorPrimitive__namespace.Root.displayName;
3766
+ function FieldSet({ className, ...props }) {
3767
+ return /* @__PURE__ */ jsxRuntime.jsx(
3768
+ "fieldset",
3769
+ {
3770
+ "data-slot": "field-set",
3771
+ className: cn(
3772
+ "flex flex-col gap-6",
3773
+ "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
3774
+ className
3775
+ ),
3776
+ ...props
3777
+ }
3778
+ );
3779
+ }
3780
+ function FieldLegend({
3779
3781
  className,
3782
+ variant = "legend",
3780
3783
  ...props
3781
3784
  }) {
3782
- const id = React__namespace.useId();
3783
- return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx(FormItemInner, { className, ...props }) });
3785
+ return /* @__PURE__ */ jsxRuntime.jsx(
3786
+ "legend",
3787
+ {
3788
+ "data-slot": "field-legend",
3789
+ "data-variant": variant,
3790
+ className: cn(
3791
+ "mb-3 font-medium",
3792
+ "data-[variant=legend]:text-base",
3793
+ "data-[variant=label]:text-sm",
3794
+ className
3795
+ ),
3796
+ ...props
3797
+ }
3798
+ );
3784
3799
  }
3785
- function FormItemInner({
3800
+ function FieldGroup({ className, ...props }) {
3801
+ return /* @__PURE__ */ jsxRuntime.jsx(
3802
+ "div",
3803
+ {
3804
+ "data-slot": "field-group",
3805
+ className: cn(
3806
+ "group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",
3807
+ className
3808
+ ),
3809
+ ...props
3810
+ }
3811
+ );
3812
+ }
3813
+ var fieldVariants = classVarianceAuthority.cva(
3814
+ "group/field data-[invalid=true]:text-destructive flex w-full gap-3",
3815
+ {
3816
+ variants: {
3817
+ orientation: {
3818
+ vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
3819
+ horizontal: [
3820
+ "flex-row items-center",
3821
+ "[&>[data-slot=field-label]]:flex-auto",
3822
+ "has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px has-[>[data-slot=field-content]]:items-start"
3823
+ ],
3824
+ responsive: [
3825
+ "@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto flex-col [&>*]:w-full [&>.sr-only]:w-auto",
3826
+ "@md/field-group:[&>[data-slot=field-label]]:flex-auto",
3827
+ "@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
3828
+ ]
3829
+ }
3830
+ },
3831
+ defaultVariants: {
3832
+ orientation: "vertical"
3833
+ }
3834
+ }
3835
+ );
3836
+ function Field({
3786
3837
  className,
3838
+ orientation = "vertical",
3787
3839
  ...props
3788
3840
  }) {
3789
- const { error } = useFormField();
3790
3841
  return /* @__PURE__ */ jsxRuntime.jsx(
3791
3842
  "div",
3792
3843
  {
3793
- "data-slot": "form-item",
3794
- className: cn("flex flex-col gap-2.5", className),
3795
- "data-invalid": !!error,
3844
+ role: "group",
3845
+ "data-slot": "field",
3846
+ "data-orientation": orientation,
3847
+ className: cn(fieldVariants({ orientation }), className),
3796
3848
  ...props
3797
3849
  }
3798
3850
  );
3799
3851
  }
3800
- function FormLabel({
3852
+ function FieldContent({ className, ...props }) {
3853
+ return /* @__PURE__ */ jsxRuntime.jsx(
3854
+ "div",
3855
+ {
3856
+ "data-slot": "field-content",
3857
+ className: cn(
3858
+ "group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
3859
+ className
3860
+ ),
3861
+ ...props
3862
+ }
3863
+ );
3864
+ }
3865
+ function FieldLabel({
3801
3866
  className,
3802
3867
  ...props
3803
3868
  }) {
3804
- const { formItemId } = useFormField();
3805
3869
  return /* @__PURE__ */ jsxRuntime.jsx(
3806
3870
  Label2,
3807
3871
  {
3808
- "data-slot": "form-label",
3809
- className: cn("font-medium text-foreground", className),
3810
- htmlFor: formItemId,
3872
+ "data-slot": "field-label",
3873
+ className: cn(
3874
+ "group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
3875
+ "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>[data-slot=field]]:p-4",
3876
+ "has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",
3877
+ className
3878
+ ),
3811
3879
  ...props
3812
3880
  }
3813
3881
  );
3814
3882
  }
3815
- function FormControl({ ...props }) {
3816
- const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
3883
+ function FieldTitle({ className, ...props }) {
3817
3884
  return /* @__PURE__ */ jsxRuntime.jsx(
3818
- SlotPrimitive2.Slot,
3885
+ "div",
3819
3886
  {
3820
- "data-slot": "form-control",
3821
- id: formItemId,
3822
- "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
3823
- "aria-invalid": !!error,
3887
+ "data-slot": "field-label",
3888
+ className: cn(
3889
+ "flex w-fit items-center gap-2 text-sm font-medium leading-snug group-data-[disabled=true]/field:opacity-50",
3890
+ className
3891
+ ),
3824
3892
  ...props
3825
3893
  }
3826
3894
  );
3827
3895
  }
3828
- function FormDescription({
3896
+ function FieldDescription({ className, ...props }) {
3897
+ return /* @__PURE__ */ jsxRuntime.jsx(
3898
+ "p",
3899
+ {
3900
+ "data-slot": "field-description",
3901
+ className: cn(
3902
+ "text-muted-foreground text-sm font-normal leading-normal group-has-[[data-orientation=horizontal]]/field:text-balance",
3903
+ "nth-last-2:-mt-1 last:mt-0 [[data-variant=legend]+&]:-mt-1.5",
3904
+ "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
3905
+ className
3906
+ ),
3907
+ ...props
3908
+ }
3909
+ );
3910
+ }
3911
+ function FieldSeparator({
3912
+ children,
3829
3913
  className,
3830
3914
  ...props
3831
3915
  }) {
3832
- const { formDescriptionId, error } = useFormField();
3833
- if (error) {
3834
- return null;
3835
- }
3836
- return /* @__PURE__ */ jsxRuntime.jsx(
3916
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3837
3917
  "div",
3838
3918
  {
3839
- "data-slot": "form-description",
3840
- id: formDescriptionId,
3841
- className: cn("text-xs text-muted-foreground -mt-0.5", className),
3842
- ...props
3919
+ "data-slot": "field-separator",
3920
+ "data-content": !!children,
3921
+ className: cn(
3922
+ "relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
3923
+ className
3924
+ ),
3925
+ ...props,
3926
+ children: [
3927
+ /* @__PURE__ */ jsxRuntime.jsx(Separator2, { className: "absolute inset-0 top-1/2" }),
3928
+ children && /* @__PURE__ */ jsxRuntime.jsx(
3929
+ "span",
3930
+ {
3931
+ className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2",
3932
+ "data-slot": "field-separator-content",
3933
+ children
3934
+ }
3935
+ )
3936
+ ]
3843
3937
  }
3844
3938
  );
3845
3939
  }
3846
- function FormMessage({
3940
+ function FieldError({
3847
3941
  className,
3848
3942
  children,
3943
+ errors,
3849
3944
  ...props
3850
3945
  }) {
3851
- const { error, formMessageId } = useFormField();
3852
- const body = error ? String(error?.message) : children;
3853
- if (!body) {
3946
+ const content = React.useMemo(() => {
3947
+ if (children) {
3948
+ return children;
3949
+ }
3950
+ if (!errors) {
3951
+ return null;
3952
+ }
3953
+ if (errors?.length === 1 && errors[0]?.message) {
3954
+ return errors[0].message;
3955
+ }
3956
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "ml-4 flex list-disc flex-col gap-1", children: errors.map(
3957
+ (error, index) => error?.message && /* @__PURE__ */ jsxRuntime.jsx("li", { children: error.message }, index)
3958
+ ) });
3959
+ }, [children, errors]);
3960
+ if (!content) {
3854
3961
  return null;
3855
3962
  }
3856
3963
  return /* @__PURE__ */ jsxRuntime.jsx(
3857
3964
  "div",
3858
3965
  {
3859
- "data-slot": "form-message",
3860
- id: formMessageId,
3861
- className: cn("-mt-0.5 text-xs font-normal text-destructive", className),
3966
+ role: "alert",
3967
+ "data-slot": "field-error",
3968
+ className: cn("text-destructive text-sm font-normal", className),
3862
3969
  ...props,
3863
- children: body
3970
+ children: content
3864
3971
  }
3865
3972
  );
3866
3973
  }
@@ -4199,13 +4306,16 @@ exports.DropdownMenuSub = DropdownMenuSub;
4199
4306
  exports.DropdownMenuSubContent = DropdownMenuSubContent;
4200
4307
  exports.DropdownMenuSubTrigger = DropdownMenuSubTrigger;
4201
4308
  exports.DropdownMenuTrigger = DropdownMenuTrigger;
4202
- exports.Form = Form;
4203
- exports.FormControl = FormControl;
4204
- exports.FormDescription = FormDescription;
4205
- exports.FormField = FormField;
4206
- exports.FormItem = FormItem;
4207
- exports.FormLabel = FormLabel;
4208
- exports.FormMessage = FormMessage;
4309
+ exports.Field = Field;
4310
+ exports.FieldContent = FieldContent;
4311
+ exports.FieldDescription = FieldDescription;
4312
+ exports.FieldError = FieldError;
4313
+ exports.FieldGroup = FieldGroup;
4314
+ exports.FieldLabel = FieldLabel;
4315
+ exports.FieldLegend = FieldLegend;
4316
+ exports.FieldSeparator = FieldSeparator;
4317
+ exports.FieldSet = FieldSet;
4318
+ exports.FieldTitle = FieldTitle;
4209
4319
  exports.HoverCard = HoverCard;
4210
4320
  exports.HoverCardContent = HoverCardContent;
4211
4321
  exports.HoverCardTrigger = HoverCardTrigger;
@@ -4232,6 +4342,7 @@ exports.SelectScrollUpButton = SelectScrollUpButton;
4232
4342
  exports.SelectSeparator = SelectSeparator;
4233
4343
  exports.SelectTrigger = SelectTrigger;
4234
4344
  exports.SelectValue = SelectValue;
4345
+ exports.Separator = Separator2;
4235
4346
  exports.Sheet = Sheet;
4236
4347
  exports.SheetBody = SheetBody;
4237
4348
  exports.SheetClose = SheetClose;
@@ -4254,7 +4365,6 @@ exports.labelVariants = labelVariants;
4254
4365
  exports.selectTriggerVariants = selectTriggerVariants;
4255
4366
  exports.useCopyToClipboard = useCopyToClipboard;
4256
4367
  exports.useDataGrid = useDataGrid;
4257
- exports.useFormField = useFormField;
4258
4368
  exports.useIsMobile = useIsMobile;
4259
4369
  exports.useMounted = useMounted;
4260
4370
  //# sourceMappingURL=index.cjs.map