@ikatec/nebula-react 1.0.27 → 1.1.0-beta.1

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.mjs CHANGED
@@ -7,7 +7,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
7
  import * as PopoverPrimitive from '@radix-ui/react-popover';
8
8
  import * as LabelPrimitive from '@radix-ui/react-label';
9
9
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
10
- import { ChevronRight, Check, Circle, CircleX, Eye, EyeOff, X, Minus, ClockIcon, ChevronsLeft, ChevronLeft, ChevronsRight, MoreHorizontal, ChevronDown, ChevronLeftIcon, ChevronDownIcon, ChevronRightIcon, CalendarIcon, ImageUpIcon, XIcon, UserIcon, MinusIcon, PlusIcon, PhoneIcon, FileTextIcon, FileAudioIcon, FileVideoIcon, Info, CircleCheckBig } from 'lucide-react';
10
+ import { ChevronRight, Check, Circle, CircleX, Eye, EyeOff, X, Minus, ClockIcon, ChevronsLeft, ChevronLeft, ChevronsRight, MoreHorizontal, ChevronDown, ChevronLeftIcon, ChevronDownIcon, ChevronRightIcon, CalendarIcon, ImageUpIcon, XIcon, MinusIcon, PlusIcon, UserIcon, LoaderCircleIcon, CheckIcon, PhoneIcon, FileTextIcon, FileAudioIcon, FileVideoIcon, Info, CircleCheckBig } from 'lucide-react';
11
11
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
12
12
  import Select, { components } from 'react-select';
13
13
  import Creatable from 'react-select/creatable';
@@ -28,6 +28,7 @@ import { DayPicker } from 'react-day-picker';
28
28
  import { ptBR, enUS, es } from 'react-day-picker/locale';
29
29
  import { useMask } from '@react-input/mask';
30
30
  import * as SliderPrimitive from '@radix-ui/react-slider';
31
+ import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
31
32
 
32
33
  // src/button.tsx
33
34
 
@@ -2241,12 +2242,13 @@ var InputText = React8.forwardRef(
2241
2242
  "div",
2242
2243
  {
2243
2244
  className: cn(
2244
- "w-full flex outline-none",
2245
+ "flex outline-none",
2245
2246
  "rounded-input",
2246
2247
  "border border-inputText-border-default focus-within:ring-[3px] focus-within:ring-inputText-border-focus focus-within:border-inputText-border-focus",
2247
2248
  "focus-within:text-inputText-text-focus placeholder:text-inputText-text-default disabled:text-inputText-text-disabled",
2248
2249
  isError && "border-inputText-border-danger focus-within:border-inputText-border-danger focus-within:ring-button-danger-border-focus",
2249
- disabled && "pointer-events-none"
2250
+ disabled && "pointer-events-none",
2251
+ className
2250
2252
  ),
2251
2253
  children: [
2252
2254
  /* @__PURE__ */ jsxs("div", { className: "nebula-ds relative w-full", children: [
@@ -2255,7 +2257,7 @@ var InputText = React8.forwardRef(
2255
2257
  {
2256
2258
  ref,
2257
2259
  className: cn(
2258
- "w-full h-10 outline-none text-sm leading-none font-medium",
2260
+ "h-10 outline-none text-sm leading-none font-medium",
2259
2261
  "bg-inputText-background-default disabled:bg-inputText-background-disabled",
2260
2262
  "text-inputText-text-filled",
2261
2263
  "disabled:cursor-not-allowed",
@@ -2267,7 +2269,7 @@ var InputText = React8.forwardRef(
2267
2269
  "pr-10": initialInputType === "password",
2268
2270
  "pr-10 pl-4": !!icon && iconPlacement === "end" && initialInputType !== "password"
2269
2271
  },
2270
- className
2272
+ "!w-full"
2271
2273
  ),
2272
2274
  ...{ ...props, icon: void 0, iconPlacement: void 0 },
2273
2275
  disabled,
@@ -3476,10 +3478,11 @@ var PhoneInput = React8__default.forwardRef(({ className, ...props }, ref) => {
3476
3478
  "data-slot": "phone-input",
3477
3479
  ref,
3478
3480
  className: cn(
3479
- "-ms-px rounded-s-none shadow-none focus-visible:z-10 ring-0 focus:ring-0 border-0 w-full h-auto",
3481
+ "-ms-px rounded-s-none shadow-none focus-visible:z-10 ring-0 focus-within:ring-0 border-0 w-full h-auto",
3480
3482
  className
3481
3483
  ),
3482
- ...props
3484
+ ...props,
3485
+ type: "text"
3483
3486
  }
3484
3487
  )
3485
3488
  ] });
@@ -4965,113 +4968,6 @@ var TextArea = React8.forwardRef(
4965
4968
  }
4966
4969
  );
4967
4970
  TextArea.displayName = "TextArea";
4968
- var ProfileImage = ({
4969
- maxSizeMB = 2,
4970
- subtitle,
4971
- onError,
4972
- maxFiles = Infinity,
4973
- onRemove,
4974
- image,
4975
- ...rest
4976
- }) => {
4977
- const maxSize = maxSizeMB * 1024 * 1024;
4978
- const id = useId();
4979
- const [
4980
- { files, isDragging, errors },
4981
- {
4982
- handleDragEnter,
4983
- handleDragLeave,
4984
- handleDragOver,
4985
- handleDrop,
4986
- openFileDialog,
4987
- removeFile,
4988
- getInputProps
4989
- }
4990
- ] = useFileUpload({
4991
- initialFiles: image ? [
4992
- {
4993
- id,
4994
- url: image,
4995
- name: image,
4996
- size: 0,
4997
- type: "image"
4998
- }
4999
- ] : [],
5000
- multiple: false,
5001
- maxSize: maxSize > 0 ? maxSize : void 0,
5002
- accept: "image/*",
5003
- ...rest,
5004
- maxFiles
5005
- });
5006
- useEffect(() => {
5007
- onError?.(errors);
5008
- }, [errors, onError]);
5009
- const [file] = files;
5010
- return /* @__PURE__ */ jsxs("div", { className: "nebula-ds flex flex-col gap-3", children: [
5011
- /* @__PURE__ */ jsx("div", { className: "nebula-ds flex justify-center", children: /* @__PURE__ */ jsxs(
5012
- "div",
5013
- {
5014
- role: "button",
5015
- onClick: openFileDialog,
5016
- onDragEnter: handleDragEnter,
5017
- onDragLeave: handleDragLeave,
5018
- onDragOver: handleDragOver,
5019
- onDrop: handleDrop,
5020
- "data-dragging": isDragging || void 0,
5021
- className: cn(
5022
- "relative border border-transparent rounded-full size-fit",
5023
- "bg-fileUpload-background hover:bg-fileUpload-backgroundHover transition-colors",
5024
- !file && "border-dashed border-fileUpload-border"
5025
- ),
5026
- "data-testid": "select-image-profile",
5027
- children: [
5028
- /* @__PURE__ */ jsx(
5029
- "input",
5030
- {
5031
- ...getInputProps(),
5032
- className: "nebula-ds sr-only",
5033
- "aria-label": "Upload file"
5034
- }
5035
- ),
5036
- /* @__PURE__ */ jsxs(
5037
- "div",
5038
- {
5039
- className: "nebula-ds flex size-12 shrink-0 items-center justify-center rounded-full",
5040
- "aria-hidden": "true",
5041
- children: [
5042
- file && file.preview && /* @__PURE__ */ jsx(
5043
- "img",
5044
- {
5045
- src: file.preview,
5046
- alt: file.file.name,
5047
- className: "nebula-ds rounded-[inherit] object-cover h-full w-full"
5048
- }
5049
- ),
5050
- !file && /* @__PURE__ */ jsx(UserIcon, { className: "nebula-ds size-4 opacity-60 text-fileUpload-icon" })
5051
- ]
5052
- }
5053
- ),
5054
- file && /* @__PURE__ */ jsx(
5055
- "button",
5056
- {
5057
- className: "nebula-ds box-border absolute flex items-center justify-center -top-1 -right-1 rounded-full size-5 text-profileImage-removeImageButton-icon border-2 border-profileImage-removeImageButton-border bg-profileImage-removeImageButton-background hover:bg-profileImage-removeImageButton-hover",
5058
- "data-testid": "remove-profile-image",
5059
- onClick: (e) => {
5060
- e.stopPropagation();
5061
- removeFile(file.id);
5062
- onRemove?.();
5063
- },
5064
- type: "button",
5065
- children: /* @__PURE__ */ jsx(XIcon, { className: "nebula-ds size-2" })
5066
- }
5067
- )
5068
- ]
5069
- }
5070
- ) }),
5071
- !!subtitle && /* @__PURE__ */ jsx(Paragraph, { className: "nebula-ds text-center", size: "sm", children: subtitle })
5072
- ] });
5073
- };
5074
- ProfileImage.displayName = "ProfileImage";
5075
4971
  function clamp(value, min, max) {
5076
4972
  return Math.min(Math.max(value, min), max);
5077
4973
  }
@@ -5959,8 +5855,8 @@ function Cropper2({
5959
5855
  onOpenChange,
5960
5856
  open,
5961
5857
  previewUrl,
5962
- onRemove: removeFile,
5963
5858
  onApply,
5859
+ onCancelCrop,
5964
5860
  rounded = false,
5965
5861
  portal = false
5966
5862
  }) {
@@ -5973,7 +5869,6 @@ function Cropper2({
5973
5869
  const handleApply = async () => {
5974
5870
  if (!previewUrl || !croppedAreaPixels) {
5975
5871
  if (previewUrl) {
5976
- removeFile();
5977
5872
  setCroppedAreaPixels(null);
5978
5873
  }
5979
5874
  return;
@@ -5994,6 +5889,13 @@ function Cropper2({
5994
5889
  onOpenChange(false);
5995
5890
  }
5996
5891
  };
5892
+ const handleCancelCrop = () => {
5893
+ setFinalImageUrl(null);
5894
+ setCroppedAreaPixels(null);
5895
+ setZoom(1);
5896
+ onOpenChange?.(false);
5897
+ onCancelCrop?.();
5898
+ };
5997
5899
  useEffect(() => {
5998
5900
  const currentFinalUrl = finalImageUrl;
5999
5901
  return () => {
@@ -6003,94 +5905,649 @@ function Cropper2({
6003
5905
  };
6004
5906
  }, [finalImageUrl]);
6005
5907
  const { cropper } = useNebulaI18n().messages;
6006
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(
6007
- DialogContent,
5908
+ return /* @__PURE__ */ jsx(
5909
+ Dialog,
6008
5910
  {
6009
- className: "nebula-ds gap-0 p-0 sm:max-w-140 *:[button]:hidden border border-cropper-dialogBorderColor",
6010
- portal,
6011
- showClose: false,
6012
- onOpenAutoFocus: (e) => e.preventDefault(),
6013
- children: [
6014
- /* @__PURE__ */ jsx(DialogHeader, { className: "nebula-ds contents space-y-0 text-left", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "nebula-ds flex items-center justify-between p-4 text-base", children: [
6015
- /* @__PURE__ */ jsxs("div", { className: "nebula-ds flex items-center gap-2", children: [
5911
+ open,
5912
+ onOpenChange: (isOpen) => {
5913
+ if (!isOpen && !finalImageUrl) {
5914
+ handleCancelCrop();
5915
+ }
5916
+ onOpenChange?.(isOpen);
5917
+ },
5918
+ children: /* @__PURE__ */ jsxs(
5919
+ DialogContent,
5920
+ {
5921
+ className: "nebula-ds gap-0 p-0 sm:max-w-140 *:[button]:hidden border border-cropper-dialogBorderColor",
5922
+ portal,
5923
+ showClose: false,
5924
+ onOpenAutoFocus: (e) => e.preventDefault(),
5925
+ children: [
5926
+ /* @__PURE__ */ jsx(DialogHeader, { className: "nebula-ds contents space-y-0 text-left", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "nebula-ds flex items-center justify-between p-4 text-base", children: [
5927
+ /* @__PURE__ */ jsxs("div", { className: "nebula-ds flex items-center gap-2", children: [
5928
+ /* @__PURE__ */ jsx(
5929
+ Button,
5930
+ {
5931
+ icon: true,
5932
+ type: "button",
5933
+ variant: "ghost",
5934
+ onClick: handleCancelCrop,
5935
+ "aria-label": "close-cropper-dialog",
5936
+ "data-testid": "close-cropper-dialog",
5937
+ size: "sm",
5938
+ children: /* @__PURE__ */ jsx(XIcon, { "aria-hidden": "true" })
5939
+ }
5940
+ ),
5941
+ cropper.dialogTitle
5942
+ ] }),
5943
+ /* @__PURE__ */ jsx(
5944
+ Button,
5945
+ {
5946
+ autoFocus: false,
5947
+ onClick: handleApply,
5948
+ disabled: !previewUrl,
5949
+ variant: "primary",
5950
+ size: "sm",
5951
+ type: "button",
5952
+ "aria-label": "apply-cropper-image",
5953
+ "data-testid": "apply-cropper-image",
5954
+ children: cropper.applyButtonLabel
5955
+ }
5956
+ )
5957
+ ] }) }),
5958
+ previewUrl && /* @__PURE__ */ jsxs(
5959
+ CropperRoot2,
5960
+ {
5961
+ className: "nebula-ds h-96 sm:h-120",
5962
+ image: previewUrl,
5963
+ zoom,
5964
+ onCropChange: handleCropChange,
5965
+ onZoomChange: setZoom,
5966
+ children: [
5967
+ /* @__PURE__ */ jsx(CropperDescription2, {}),
5968
+ /* @__PURE__ */ jsx(CropperImage2, {}),
5969
+ /* @__PURE__ */ jsx(CropperCropArea2, { rounded })
5970
+ ]
5971
+ }
5972
+ ),
5973
+ /* @__PURE__ */ jsx(DialogFooter, { className: "nebula-ds border-t border-t-cropper-dialogBorderColor px-4 py-6", children: /* @__PURE__ */ jsxs("div", { className: "nebula-ds mx-auto flex w-full max-w-80 items-center gap-4", children: [
5974
+ /* @__PURE__ */ jsx(
5975
+ MinusIcon,
5976
+ {
5977
+ className: "nebula-ds shrink-0 size-5 text-cropper-sliderIconColor",
5978
+ size: 16,
5979
+ "aria-hidden": "true"
5980
+ }
5981
+ ),
5982
+ /* @__PURE__ */ jsx(
5983
+ Slider,
5984
+ {
5985
+ defaultValue: [1],
5986
+ value: [zoom],
5987
+ min: 1,
5988
+ max: 3,
5989
+ step: 0.1,
5990
+ onValueChange: (value) => setZoom(value[0]),
5991
+ "aria-label": "Zoom slider"
5992
+ }
5993
+ ),
5994
+ /* @__PURE__ */ jsx(
5995
+ PlusIcon,
5996
+ {
5997
+ className: "nebula-ds shrink-0 size-5 text-cropper-sliderIconColor",
5998
+ size: 16,
5999
+ "aria-hidden": "true"
6000
+ }
6001
+ )
6002
+ ] }) })
6003
+ ]
6004
+ }
6005
+ )
6006
+ }
6007
+ );
6008
+ }
6009
+ var ProfileImage = ({
6010
+ maxSizeMB = 5,
6011
+ subtitle,
6012
+ onError,
6013
+ maxFiles = Infinity,
6014
+ onRemove,
6015
+ image,
6016
+ cropperProps,
6017
+ onChange
6018
+ }) => {
6019
+ const maxSize = maxSizeMB * 1024 * 1024;
6020
+ const id = useId();
6021
+ const withCropper = useMemo(() => !!cropperProps, [cropperProps]);
6022
+ const handleFileChange = (file2, blob) => {
6023
+ if (!file2) {
6024
+ return;
6025
+ }
6026
+ let fileLike = file2;
6027
+ if (withCropper && !blob) {
6028
+ return;
6029
+ }
6030
+ if (withCropper && blob) {
6031
+ fileLike = new File([blob], file2.name, { type: file2.type });
6032
+ }
6033
+ onChange?.(fileLike);
6034
+ };
6035
+ const [
6036
+ { files, isDragging, errors },
6037
+ {
6038
+ handleDragEnter,
6039
+ handleDragLeave,
6040
+ handleDragOver,
6041
+ handleDrop,
6042
+ openFileDialog,
6043
+ removeFile,
6044
+ getInputProps
6045
+ }
6046
+ ] = useFileUpload({
6047
+ maxFiles,
6048
+ initialFiles: image ? [
6049
+ {
6050
+ id,
6051
+ url: image,
6052
+ name: image,
6053
+ size: 0,
6054
+ type: "image"
6055
+ }
6056
+ ] : [],
6057
+ multiple: false,
6058
+ maxSize: maxSize > 0 ? maxSize : void 0,
6059
+ accept: "image/*",
6060
+ onFilesChange([file2]) {
6061
+ handleFileChange(file2?.file);
6062
+ }
6063
+ });
6064
+ const [finalImageUrl, setFinalImageUrl] = useState(null);
6065
+ const [isDialogOpen, setIsDialogOpen] = useState(false);
6066
+ useEffect(() => {
6067
+ onError?.(errors);
6068
+ }, [errors, onError]);
6069
+ const [file] = files;
6070
+ const fileId = file?.id;
6071
+ const previousFileIdRef = useRef(null);
6072
+ const previewUrl = file?.preview || null;
6073
+ const profileImagePreview = useMemo(() => {
6074
+ if (withCropper) return finalImageUrl;
6075
+ return previewUrl;
6076
+ }, [previewUrl, withCropper, finalImageUrl]);
6077
+ useEffect(() => {
6078
+ if (!withCropper) return;
6079
+ if (fileId && fileId !== previousFileIdRef.current) {
6080
+ setIsDialogOpen(true);
6081
+ }
6082
+ previousFileIdRef.current = fileId;
6083
+ }, [fileId, withCropper]);
6084
+ const handleApply = async (croppedUrl, croppedBlob) => {
6085
+ try {
6086
+ const newFinalUrl = URL.createObjectURL(croppedBlob);
6087
+ if (finalImageUrl) {
6088
+ URL.revokeObjectURL(finalImageUrl);
6089
+ }
6090
+ setFinalImageUrl(newFinalUrl);
6091
+ handleFileChange(file?.file, croppedBlob);
6092
+ setIsDialogOpen(false);
6093
+ } catch (error2) {
6094
+ setIsDialogOpen(false);
6095
+ }
6096
+ };
6097
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
6098
+ /* @__PURE__ */ jsxs("div", { className: "nebula-ds flex flex-col gap-3", children: [
6099
+ /* @__PURE__ */ jsx("div", { className: "nebula-ds flex justify-center", children: /* @__PURE__ */ jsxs(
6100
+ "div",
6101
+ {
6102
+ role: "button",
6103
+ onClick: openFileDialog,
6104
+ onDragEnter: handleDragEnter,
6105
+ onDragLeave: handleDragLeave,
6106
+ onDragOver: handleDragOver,
6107
+ onDrop: handleDrop,
6108
+ "data-dragging": isDragging || void 0,
6109
+ className: cn(
6110
+ "relative border border-transparent rounded-full size-fit",
6111
+ "bg-fileUpload-background hover:bg-fileUpload-backgroundHover transition-colors",
6112
+ !file && "border-dashed border-fileUpload-border"
6113
+ ),
6114
+ "data-testid": "select-image-profile",
6115
+ children: [
6016
6116
  /* @__PURE__ */ jsx(
6017
- Button,
6117
+ "input",
6018
6118
  {
6019
- icon: true,
6020
- type: "button",
6021
- variant: "ghost",
6022
- onClick: () => onOpenChange(false),
6023
- "aria-label": "close-cropper-dialog",
6024
- "data-testid": "close-cropper-dialog",
6025
- size: "sm",
6026
- children: /* @__PURE__ */ jsx(XIcon, { "aria-hidden": "true" })
6119
+ ...getInputProps(),
6120
+ className: "nebula-ds sr-only",
6121
+ "aria-label": "Upload file"
6027
6122
  }
6028
6123
  ),
6029
- cropper.dialogTitle
6030
- ] }),
6031
- /* @__PURE__ */ jsx(
6032
- Button,
6033
- {
6034
- autoFocus: false,
6035
- onClick: handleApply,
6036
- disabled: !previewUrl,
6037
- variant: "primary",
6038
- size: "sm",
6039
- type: "button",
6040
- "aria-label": "apply-cropper-image",
6041
- "data-testid": "apply-cropper-image",
6042
- children: cropper.applyButtonLabel
6043
- }
6044
- )
6045
- ] }) }),
6046
- previewUrl && /* @__PURE__ */ jsxs(
6047
- CropperRoot2,
6124
+ /* @__PURE__ */ jsxs(
6125
+ "div",
6126
+ {
6127
+ className: "nebula-ds flex size-12 shrink-0 items-center justify-center rounded-full",
6128
+ "aria-hidden": "true",
6129
+ children: [
6130
+ profileImagePreview && /* @__PURE__ */ jsx(
6131
+ "img",
6132
+ {
6133
+ src: profileImagePreview,
6134
+ alt: fileId,
6135
+ className: "nebula-ds rounded-[inherit] object-cover h-full w-full"
6136
+ }
6137
+ ),
6138
+ !file && /* @__PURE__ */ jsx(UserIcon, { className: "nebula-ds size-4 opacity-60 text-fileUpload-icon" })
6139
+ ]
6140
+ }
6141
+ ),
6142
+ profileImagePreview && file && /* @__PURE__ */ jsx(
6143
+ "button",
6144
+ {
6145
+ className: "nebula-ds box-border absolute flex items-center justify-center -top-1 -right-1 rounded-full size-5 text-profileImage-removeImageButton-icon border-2 border-profileImage-removeImageButton-border bg-profileImage-removeImageButton-background hover:bg-profileImage-removeImageButton-hover",
6146
+ "data-testid": "remove-profile-image",
6147
+ onClick: (e) => {
6148
+ e.stopPropagation();
6149
+ removeFile(file.id);
6150
+ setFinalImageUrl(null);
6151
+ onChange?.(void 0);
6152
+ onRemove?.();
6153
+ },
6154
+ type: "button",
6155
+ children: /* @__PURE__ */ jsx(XIcon, { className: "nebula-ds size-2" })
6156
+ }
6157
+ )
6158
+ ]
6159
+ }
6160
+ ) }),
6161
+ !!subtitle && /* @__PURE__ */ jsx(Paragraph, { className: "nebula-ds text-center", size: "sm", children: subtitle })
6162
+ ] }),
6163
+ withCropper && /* @__PURE__ */ jsx(
6164
+ Cropper2,
6165
+ {
6166
+ ...cropperProps,
6167
+ open: isDialogOpen,
6168
+ previewUrl,
6169
+ onOpenChange: setIsDialogOpen,
6170
+ onApply: handleApply,
6171
+ onCancelCrop: () => {
6172
+ fileId && removeFile(fileId);
6173
+ setFinalImageUrl(null);
6174
+ onChange?.(void 0);
6175
+ }
6176
+ }
6177
+ )
6178
+ ] });
6179
+ };
6180
+ ProfileImage.displayName = "ProfileImage";
6181
+ function RadioGroup2({
6182
+ className,
6183
+ ...props
6184
+ }) {
6185
+ return /* @__PURE__ */ jsx(
6186
+ RadioGroupPrimitive.Root,
6187
+ {
6188
+ "data-slot": "radio-group",
6189
+ className: cn("grid gap-3", className),
6190
+ ...props
6191
+ }
6192
+ );
6193
+ }
6194
+ function RadioGroupItem({
6195
+ className,
6196
+ ...props
6197
+ }) {
6198
+ return /* @__PURE__ */ jsx(
6199
+ RadioGroupPrimitive.Item,
6200
+ {
6201
+ "data-slot": "radio-group-item",
6202
+ className: cn(
6203
+ `
6204
+ border-2
6205
+ data-[state=checked]:border-4
6206
+
6207
+ border-radio-border-unselected-default
6208
+ data-[state=checked]:border-radio-background-selected-default
6209
+ hover:border-radio-border-unselected-hover
6210
+ data-[state=checked]:hover:border-radio-background-selected-hover
6211
+
6212
+ bg-radio-background-unselected-default
6213
+ data-[state=checked]:bg-radio-background-unselected-default
6214
+ hover:bg-radio-background-unselected-hover
6215
+ data-[state=checked]:hover:bg-radio-background-unselected-hover
6216
+
6217
+ disabled:border-radio-border-unselected-disabled
6218
+ disabled:bg-radio-background-unselected-disabled
6219
+ data-[state=checked]:disabled:bg-radio-background-unselected-default
6220
+ data-[state=checked]:disabled:border-radio-background-selected-disabled
6221
+
6222
+ focus-visible:ring-[2px]
6223
+ focus-visible:border-radio-border-selected-focus
6224
+
6225
+ aria-invalid:ring-destructive/20
6226
+ dark:aria-invalid:ring-destructive/40
6227
+ aria-invalid:border-destructive
6228
+
6229
+ aspect-square
6230
+ size-4
6231
+ shrink-0
6232
+ rounded-full
6233
+ shadow-xs
6234
+ transition-all
6235
+ outline-none
6236
+ disabled:cursor-not-allowed
6237
+ `,
6238
+ className
6239
+ ),
6240
+ ...props,
6241
+ children: /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, { className: "nebula-ds flex items-center justify-center text-current", children: /* @__PURE__ */ jsx("div", { className: "nebula-ds rounded-full w-2 h-2" }) })
6242
+ }
6243
+ );
6244
+ }
6245
+ var StepperContext = createContext(void 0);
6246
+ var StepItemContext = createContext(
6247
+ void 0
6248
+ );
6249
+ var useStepper = () => {
6250
+ const context = useContext(StepperContext);
6251
+ if (!context) {
6252
+ throw new Error("useStepper must be used within a Stepper");
6253
+ }
6254
+ return context;
6255
+ };
6256
+ var useStepItem = () => {
6257
+ const context = useContext(StepItemContext);
6258
+ if (!context) {
6259
+ throw new Error("useStepItem must be used within a StepperItem");
6260
+ }
6261
+ return context;
6262
+ };
6263
+ function Stepper({
6264
+ defaultValue = 0,
6265
+ value,
6266
+ onValueChange,
6267
+ orientation = "horizontal",
6268
+ className,
6269
+ ...props
6270
+ }) {
6271
+ const [activeStep, setInternalStep] = React8.useState(defaultValue);
6272
+ const setActiveStep = React8.useCallback(
6273
+ (step) => {
6274
+ if (value === void 0) {
6275
+ setInternalStep(step);
6276
+ }
6277
+ onValueChange?.(step);
6278
+ },
6279
+ [value, onValueChange]
6280
+ );
6281
+ const currentStep = value ?? activeStep;
6282
+ return /* @__PURE__ */ jsx(
6283
+ StepperContext.Provider,
6284
+ {
6285
+ value: {
6286
+ activeStep: currentStep,
6287
+ setActiveStep,
6288
+ orientation
6289
+ },
6290
+ children: /* @__PURE__ */ jsx(
6291
+ "div",
6292
+ {
6293
+ "data-slot": "stepper",
6294
+ className: cn(
6295
+ `
6296
+ group/stepper
6297
+ gap-2
6298
+ inline-flex
6299
+ data-[orientation=horizontal]:w-full
6300
+ data-[orientation=horizontal]:flex-row
6301
+ data-[orientation=vertical]:flex-col
6302
+ `,
6303
+ className
6304
+ ),
6305
+ "data-orientation": orientation,
6306
+ ...props
6307
+ }
6308
+ )
6309
+ }
6310
+ );
6311
+ }
6312
+ function StepperItem({
6313
+ step,
6314
+ completed = false,
6315
+ disabled = false,
6316
+ loading = false,
6317
+ className,
6318
+ children,
6319
+ ...props
6320
+ }) {
6321
+ const { activeStep } = useStepper();
6322
+ const state = completed || step < activeStep ? "completed" : activeStep === step ? "active" : "inactive";
6323
+ const isLoading = loading && step === activeStep;
6324
+ return /* @__PURE__ */ jsx(
6325
+ StepItemContext.Provider,
6326
+ {
6327
+ value: { step, state, isDisabled: disabled, isLoading },
6328
+ children: /* @__PURE__ */ jsx(
6329
+ "div",
6330
+ {
6331
+ "data-slot": "stepper-item",
6332
+ className: cn(
6333
+ `
6334
+ group/step
6335
+ gap-2
6336
+ flex
6337
+ items-center
6338
+ group-data-[orientation=horizontal]/stepper:flex-row
6339
+ group-data-[orientation=vertical]/stepper:flex-col
6340
+ group-data-[orientation=vertical]/stepper:items-start
6341
+ `,
6342
+ className
6343
+ ),
6344
+ "data-state": state,
6345
+ ...isLoading ? { "data-loading": true } : {},
6346
+ ...props,
6347
+ children
6348
+ }
6349
+ )
6350
+ }
6351
+ );
6352
+ }
6353
+ function StepperTrigger({
6354
+ asChild = false,
6355
+ className,
6356
+ children,
6357
+ isClickable = true,
6358
+ ...props
6359
+ }) {
6360
+ const { setActiveStep } = useStepper();
6361
+ const { step, isDisabled } = useStepItem();
6362
+ if (asChild) {
6363
+ const Comp = asChild ? Slot : "span";
6364
+ return /* @__PURE__ */ jsx(Comp, { "data-slot": "stepper-trigger", className, children });
6365
+ }
6366
+ return /* @__PURE__ */ jsx(
6367
+ "button",
6368
+ {
6369
+ "data-slot": "stepper-trigger",
6370
+ className: cn(
6371
+ `
6372
+ gap-2
6373
+ inline-flex
6374
+ items-center
6375
+ rounded-full
6376
+ outline-none
6377
+ focus-visible:z-10
6378
+ focus-visible:border-ring
6379
+ focus-visible:ring-ring/50
6380
+ focus-visible:ring-[3px]
6381
+ disabled:pointer-events-none
6382
+ disabled:opacity-50
6383
+ `,
6384
+ className
6385
+ ),
6386
+ onClick: () => isClickable ? setActiveStep(step) : null,
6387
+ disabled: isDisabled,
6388
+ ...props,
6389
+ children
6390
+ }
6391
+ );
6392
+ }
6393
+ function StepperIndicator({
6394
+ asChild = false,
6395
+ className,
6396
+ children,
6397
+ ...props
6398
+ }) {
6399
+ const { state, step, isLoading } = useStepItem();
6400
+ return /* @__PURE__ */ jsx(
6401
+ "span",
6402
+ {
6403
+ "data-slot": "stepper-indicator",
6404
+ className: cn(
6405
+ `
6406
+ flex
6407
+ size-5
6408
+ shrink-0
6409
+ items-center
6410
+ justify-center
6411
+ rounded-full
6412
+ font-semibold
6413
+ text-xs
6414
+ transition-colors
6415
+ bg-stepper-background-default
6416
+ text-stepper-count-default
6417
+ data-[state=active]:bg-stepper-background-active
6418
+ data-[state=active]:text-stepper-count-active
6419
+ data-[state=completed]:bg-stepper-background-active
6420
+ data-[state=completed]:text-stepper-count-active
6421
+ `,
6422
+ className
6423
+ ),
6424
+ "data-state": state,
6425
+ ...props,
6426
+ children: asChild ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
6427
+ isLoading ? /* @__PURE__ */ jsx(
6428
+ LoaderCircleIcon,
6048
6429
  {
6049
- className: "nebula-ds h-96 sm:h-120",
6050
- image: previewUrl,
6051
- zoom,
6052
- onCropChange: handleCropChange,
6053
- onZoomChange: setZoom,
6054
- children: [
6055
- /* @__PURE__ */ jsx(CropperDescription2, {}),
6056
- /* @__PURE__ */ jsx(CropperImage2, {}),
6057
- /* @__PURE__ */ jsx(CropperCropArea2, { rounded })
6058
- ]
6430
+ className: "nebula-ds animate-spin",
6431
+ size: 14,
6432
+ "aria-hidden": "true"
6433
+ }
6434
+ ) : /* @__PURE__ */ jsx(
6435
+ "span",
6436
+ {
6437
+ className: cn(
6438
+ `
6439
+ transition-all
6440
+ group-data-[state=completed]/step:scale-0
6441
+ group-data-[state=completed]/step:opacity-0
6442
+ `
6443
+ ),
6444
+ children: step
6059
6445
  }
6060
6446
  ),
6061
- /* @__PURE__ */ jsx(DialogFooter, { className: "nebula-ds border-t border-t-cropper-dialogBorderColor px-4 py-6", children: /* @__PURE__ */ jsxs("div", { className: "nebula-ds mx-auto flex w-full max-w-80 items-center gap-4", children: [
6062
- /* @__PURE__ */ jsx(
6063
- MinusIcon,
6064
- {
6065
- className: "nebula-ds shrink-0 size-5 text-cropper-sliderIconColor",
6066
- size: 16,
6067
- "aria-hidden": "true"
6068
- }
6069
- ),
6070
- /* @__PURE__ */ jsx(
6071
- Slider,
6072
- {
6073
- defaultValue: [1],
6074
- value: [zoom],
6075
- min: 1,
6076
- max: 3,
6077
- step: 0.1,
6078
- onValueChange: (value) => setZoom(value[0]),
6079
- "aria-label": "Zoom slider"
6080
- }
6081
- ),
6082
- /* @__PURE__ */ jsx(
6083
- PlusIcon,
6084
- {
6085
- className: "nebula-ds shrink-0 size-5 text-cropper-sliderIconColor",
6086
- size: 16,
6087
- "aria-hidden": "true"
6088
- }
6089
- )
6090
- ] }) })
6091
- ]
6447
+ /* @__PURE__ */ jsx(
6448
+ CheckIcon,
6449
+ {
6450
+ className: cn(
6451
+ `
6452
+ absolute
6453
+ scale-0
6454
+ opacity-0
6455
+ transition-all
6456
+ group-data-[state=completed]/step:scale-100
6457
+ group-data-[state=completed]/step:opacity-100
6458
+ `
6459
+ ),
6460
+ size: 16,
6461
+ "aria-hidden": "true"
6462
+ }
6463
+ )
6464
+ ] })
6092
6465
  }
6093
- ) });
6466
+ );
6467
+ }
6468
+ function StepperTitle({
6469
+ className,
6470
+ ...props
6471
+ }) {
6472
+ const { state } = useStepItem();
6473
+ return /* @__PURE__ */ jsx(
6474
+ "h3",
6475
+ {
6476
+ "data-slot": "stepper-title",
6477
+ className: cn(
6478
+ `
6479
+ text-sm
6480
+ font-medium
6481
+ text-stepper-title-default
6482
+ data-[state=active]:text-stepper-title-active
6483
+ data-[state=completed]:text-stepper-title-active
6484
+ `,
6485
+ className
6486
+ ),
6487
+ "data-state": state,
6488
+ ...props
6489
+ }
6490
+ );
6491
+ }
6492
+ function StepperDescription({
6493
+ className,
6494
+ ...props
6495
+ }) {
6496
+ return /* @__PURE__ */ jsx(
6497
+ "p",
6498
+ {
6499
+ "data-slot": "stepper-description",
6500
+ className: cn(
6501
+ `
6502
+ text-sm
6503
+ text-muted-foreground
6504
+ `,
6505
+ className
6506
+ ),
6507
+ ...props
6508
+ }
6509
+ );
6510
+ }
6511
+ function StepperSeparator({
6512
+ className,
6513
+ ...props
6514
+ }) {
6515
+ const { step } = useStepItem();
6516
+ const { activeStep, orientation } = useStepper();
6517
+ const separatorState = step < activeStep ? "completed" : "inactive";
6518
+ const line = /* @__PURE__ */ jsx(
6519
+ "div",
6520
+ {
6521
+ "data-slot": "stepper-separator",
6522
+ "data-orientation": orientation,
6523
+ className: cn(
6524
+ `
6525
+ rounded-full
6526
+ bg-stepper-separator-default
6527
+ `,
6528
+ orientation === "horizontal" && `
6529
+ w-5
6530
+ h-[2px]
6531
+ flex-1
6532
+ `,
6533
+ orientation === "vertical" && `
6534
+ w-[2px]
6535
+ h-5
6536
+ flex-none
6537
+ `,
6538
+ separatorState === "completed" && `
6539
+ bg-stepper-separator-active
6540
+ `,
6541
+ className
6542
+ ),
6543
+ "data-state": separatorState,
6544
+ ...props
6545
+ }
6546
+ );
6547
+ if (orientation === "vertical") {
6548
+ return /* @__PURE__ */ jsx("div", { className: "nebula-ds flex w-5 justify-center", children: line });
6549
+ }
6550
+ return line;
6094
6551
  }
6095
6552
 
6096
6553
  // src/tailwind.ts
@@ -6103,4 +6560,4 @@ var tailwind = {
6103
6560
  // plugin: () => require("tailwindcss")("node_modules/@nebulareact/dist/tailwind.config.js"),
6104
6561
  };
6105
6562
 
6106
- export { Accordion, AccordionContent, AccordionDescription, AccordionItem, AccordionTitle, AccordionTrigger, ActionBar, ActionBarButton, ActionBarClose, ActionBarContent, ActionBarDivider, ActionBarPortal, ActionBarTrigger, Alert, AlertButton, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AlertTitle, StyledAsync as Async, StyledAsyncCreatable as AsyncCreatable, Badge, Box, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Caption, Checkbox, StyledCreatable as Creatable, Cropper2 as Cropper, CropperCropArea2 as CropperCropArea, CropperDescription2 as CropperDescription, CropperImage2 as CropperImage, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FileUpload, FileUploadError, Heading, InputDatePickerSingle, InputDateTimePickerSingle, InputPhone, InputText, InputTime, Label, Link, NebulaI18nProvider, Pagination, Paragraph, Popover, PopoverContent, PopoverTrigger, ProfileImage, StyledSelect as Select, Separator2 as Separator, Skeleton, Slider, Space, SpaceDirectionEnum, SpaceSizeEnum, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TextArea, Toaster, Tooltip, alertVariants, badgeSizeEnum, badgeVariantEnum, buttonSizeEnum, buttonVariantEnum, buttonVariantsConfig, dateIsAvailable, formatBytes, getNebulaLanguage, localeByi18nKey, messages19 as messages, separatorVariants, setNebulaLanguage, tagVariantsEnum, tailwind, toast, useClickOutside, useFileUpload, useKeyPress, useNebulaI18n };
6563
+ export { Accordion, AccordionContent, AccordionDescription, AccordionItem, AccordionTitle, AccordionTrigger, ActionBar, ActionBarButton, ActionBarClose, ActionBarContent, ActionBarDivider, ActionBarPortal, ActionBarTrigger, Alert, AlertButton, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AlertTitle, StyledAsync as Async, StyledAsyncCreatable as AsyncCreatable, Badge, Box, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Caption, Checkbox, StyledCreatable as Creatable, Cropper2 as Cropper, CropperCropArea2 as CropperCropArea, CropperDescription2 as CropperDescription, CropperImage2 as CropperImage, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FileUpload, FileUploadError, Heading, InputDatePickerSingle, InputDateTimePickerSingle, InputPhone, InputText, InputTime, Label, Link, NebulaI18nProvider, Pagination, Paragraph, Popover, PopoverContent, PopoverTrigger, ProfileImage, RadioGroup2 as RadioGroup, RadioGroupItem, StyledSelect as Select, Separator2 as Separator, Skeleton, Slider, Space, SpaceDirectionEnum, SpaceSizeEnum, Stepper, StepperDescription, StepperIndicator, StepperItem, StepperSeparator, StepperTitle, StepperTrigger, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TextArea, Toaster, Tooltip, alertVariants, badgeSizeEnum, badgeVariantEnum, buttonSizeEnum, buttonVariantEnum, buttonVariantsConfig, dateIsAvailable, formatBytes, getNebulaLanguage, localeByi18nKey, messages19 as messages, separatorVariants, setNebulaLanguage, tagVariantsEnum, tailwind, toast, useClickOutside, useFileUpload, useKeyPress, useNebulaI18n };