@herca/r-kit 0.0.35 → 0.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/components/calendar/index.cjs +443 -1469
  2. package/dist/components/calendar/index.cjs.map +1 -1
  3. package/dist/components/calendar/index.js +429 -1455
  4. package/dist/components/calendar/index.js.map +1 -1
  5. package/dist/components/checkbox/index.d.cts +2 -2
  6. package/dist/components/checkbox/index.d.ts +2 -2
  7. package/dist/components/date-picker/index.cjs +1641 -2667
  8. package/dist/components/date-picker/index.cjs.map +1 -1
  9. package/dist/components/date-picker/index.js +1629 -2655
  10. package/dist/components/date-picker/index.js.map +1 -1
  11. package/dist/components/modal/index.d.cts +3 -3
  12. package/dist/components/modal/index.d.ts +3 -3
  13. package/dist/components/sidebar/index.cjs.map +1 -1
  14. package/dist/components/sidebar/index.js.map +1 -1
  15. package/dist/components/switch/index.d.cts +1 -1
  16. package/dist/components/switch/index.d.ts +1 -1
  17. package/dist/{hooks/use-copy.cjs → components/useCopy/index.cjs} +3 -3
  18. package/dist/components/useCopy/index.cjs.map +1 -0
  19. package/dist/{hooks/use-copy.js → components/useCopy/index.js} +3 -3
  20. package/dist/components/useCopy/index.js.map +1 -0
  21. package/dist/{hooks/use-mobile.cjs → components/useIsMobile/index.cjs} +3 -3
  22. package/dist/components/useIsMobile/index.cjs.map +1 -0
  23. package/dist/{hooks/use-mobile.js → components/useIsMobile/index.js} +3 -3
  24. package/dist/components/useIsMobile/index.js.map +1 -0
  25. package/package.json +2 -2
  26. package/dist/hooks/use-copy.cjs.map +0 -1
  27. package/dist/hooks/use-copy.js.map +0 -1
  28. package/dist/hooks/use-mobile.cjs.map +0 -1
  29. package/dist/hooks/use-mobile.js.map +0 -1
  30. /package/dist/{hooks/use-copy.d.cts → components/useCopy/index.d.cts} +0 -0
  31. /package/dist/{hooks/use-copy.d.ts → components/useCopy/index.d.ts} +0 -0
  32. /package/dist/{hooks/use-mobile.d.cts → components/useIsMobile/index.d.cts} +0 -0
  33. /package/dist/{hooks/use-mobile.d.ts → components/useIsMobile/index.d.ts} +0 -0
@@ -1,14 +1,12 @@
1
- import * as React283 from 'react';
2
- import React283__default, { createContext, forwardRef, useRef, useState, useImperativeHandle, useEffect, useMemo } from 'react';
3
- import clsx10, { clsx } from 'clsx';
1
+ import * as React280 from 'react';
2
+ import React280__default, { createContext, useState, useEffect, useMemo } from 'react';
3
+ import clsx5, { clsx } from 'clsx';
4
4
  import { twMerge } from 'tailwind-merge';
5
5
  import { cva } from 'class-variance-authority';
6
6
  import { Slot } from '@radix-ui/react-slot';
7
7
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
8
- import '@radix-ui/react-collapsible';
9
- import '@radix-ui/react-dialog';
10
- import * as TooltipPrimitive from '@radix-ui/react-tooltip';
11
8
  import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
9
+ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
12
10
 
13
11
  // src/components/calendar/calendar.tsx
14
12
  function cn(...inputs) {
@@ -5566,109 +5564,167 @@ var ButtonNavigator = ({
5566
5564
  }
5567
5565
  );
5568
5566
  };
5569
- cva(
5570
- "flex items-center justify-center rounded border transition-all focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:outline-none",
5571
- {
5572
- variants: {
5573
- size: {
5574
- sm: "h-4 w-4",
5575
- md: "h-5 w-5",
5576
- lg: "h-6 w-6"
5577
- },
5578
- color: {
5579
- primary: "border-primary-1000 focus-visible:ring-primary-900",
5580
- secondary: "border-gray-600 focus-visible:ring-gray-500",
5581
- success: "border-success-500 focus-visible:ring-success-400",
5582
- danger: "border-danger-500 focus-visible:ring-danger-400",
5583
- warning: "border-warning-500 focus-visible:ring-warning-400",
5584
- info: "border-info-500 focus-visible:ring-info-400",
5585
- orange: "border-orange-500 focus-visible:ring-orange-400",
5586
- purple: "border-purple-500 focus-visible:ring-purple-400",
5587
- gray: "border-gray-600 focus-visible:ring-gray-500"
5588
- },
5589
- checked: {
5590
- true: "",
5591
- false: ""
5592
- }
5593
- },
5594
- compoundVariants: [
5595
- // Checked state - background sesuai color
5596
- {
5597
- checked: true,
5598
- color: "primary",
5599
- class: "bg-primary-1000 border-primary-1000"
5600
- },
5601
- {
5602
- checked: true,
5603
- color: "secondary",
5604
- class: "border-gray-600 bg-gray-600"
5605
- },
5606
- {
5607
- checked: true,
5608
- color: "success",
5609
- class: "bg-success-500 border-success-500"
5610
- },
5611
- {
5612
- checked: true,
5613
- color: "danger",
5614
- class: "bg-danger-500 border-danger-500"
5615
- },
5616
- {
5617
- checked: true,
5618
- color: "warning",
5619
- class: "bg-warning-500 border-warning-500"
5620
- },
5621
- { checked: true, color: "info", class: "bg-info-500 border-info-500" },
5622
- {
5623
- checked: true,
5624
- color: "orange",
5625
- class: "border-orange-500 bg-orange-500"
5626
- },
5627
- {
5628
- checked: true,
5629
- color: "purple",
5630
- class: "border-purple-500 bg-purple-500"
5631
- },
5632
- { checked: true, color: "gray", class: "border-gray-600 bg-gray-600" },
5633
- // Unchecked state - background white
5634
- { checked: false, class: "bg-white" }
5635
- ],
5636
- defaultVariants: {
5637
- size: "md",
5638
- color: "primary",
5639
- checked: false
5567
+ function Dropdown({
5568
+ children,
5569
+ ...props
5570
+ }) {
5571
+ return /* @__PURE__ */ jsx(DropdownMenu.Root, { ...props, children });
5572
+ }
5573
+ function DropdownTrigger({
5574
+ children,
5575
+ ...props
5576
+ }) {
5577
+ return /* @__PURE__ */ jsx(DropdownMenu.Trigger, { ...props, children });
5578
+ }
5579
+ function DropdownContent({
5580
+ children,
5581
+ className,
5582
+ portalProps,
5583
+ ...props
5584
+ }) {
5585
+ return /* @__PURE__ */ jsx(DropdownMenu.Portal, { ...portalProps, children: /* @__PURE__ */ jsx(
5586
+ DropdownMenu.Content,
5587
+ {
5588
+ sideOffset: props.sideOffset ?? 15,
5589
+ className: cn(
5590
+ "shadow-dropdown flex flex-col gap-1 rounded-xl border border-gray-200 bg-white p-3",
5591
+ className
5592
+ ),
5593
+ ...props,
5594
+ children
5640
5595
  }
5641
- }
5642
- );
5643
- cva("transition-all", {
5596
+ ) });
5597
+ }
5598
+ function DropdownItem({
5599
+ children,
5600
+ className,
5601
+ ...props
5602
+ }) {
5603
+ return /* @__PURE__ */ jsx(
5604
+ DropdownMenu.Item,
5605
+ {
5606
+ className: cn(
5607
+ "hover:bg-primary-50 hover:border-primary-300 flex cursor-pointer flex-row items-center gap-2 rounded-lg border border-gray-200 px-3 py-2 outline-0 transition-all",
5608
+ className
5609
+ ),
5610
+ ...props,
5611
+ children
5612
+ }
5613
+ );
5614
+ }
5615
+ var TextVariants = cva("font-metropolis", {
5644
5616
  variants: {
5645
- size: {
5646
- sm: "h-3 w-3",
5647
- md: "h-4 w-4",
5648
- lg: "h-5 w-5"
5617
+ variant: {
5618
+ h1: "text-[36px] leading-[46px]",
5619
+ h2: "text-[32px] leading-[42px]",
5620
+ h3: "text-[28px] leading-[38px]",
5621
+ h4: "text-[24px] leading-[34px]",
5622
+ p1: "text-[20px] leading-[30px]",
5623
+ p2: "text-[18px] leading-[28px]",
5624
+ p3: "text-[16px] leading-[26px]",
5625
+ t1: "text-[14px] leading-[24px]",
5626
+ t2: "text-[12px] leading-[20px]",
5627
+ t3: "text-[10px] leading-[14px]",
5628
+ t4: "text-[8px] leading-[10px]"
5629
+ },
5630
+ weight: {
5631
+ regular: "font-normal",
5632
+ medium: "font-medium",
5633
+ semibold: "font-semibold",
5634
+ bold: "font-bold"
5649
5635
  },
5650
5636
  color: {
5651
- primary: "text-white",
5652
- secondary: "text-white",
5653
- success: "text-white",
5654
- danger: "text-white",
5655
- warning: "text-white",
5656
- info: "text-white",
5657
- orange: "text-white",
5658
- purple: "text-white",
5659
- gray: "text-white"
5637
+ default: "",
5638
+ muted: "text-gray-400",
5639
+ primary: "text-primary-500",
5640
+ success: "text-success-500",
5641
+ warning: "text-warning-500",
5642
+ orange: "text-orange-500",
5643
+ danger: "text-danger-500",
5644
+ info: "text-info-500",
5645
+ purple: "text-purple-500",
5646
+ gray: "text-gray-500"
5647
+ },
5648
+ align: {
5649
+ start: "text-left",
5650
+ center: "text-center",
5651
+ end: "text-right",
5652
+ justify: "text-justify"
5660
5653
  },
5661
- icon: {
5662
- check: "",
5663
- minus: ""
5654
+ numberOfLines: {
5655
+ 1: "line-clamp-1",
5656
+ 2: "line-clamp-2",
5657
+ 3: "line-clamp-3",
5658
+ 4: "line-clamp-4"
5664
5659
  }
5665
5660
  },
5666
5661
  defaultVariants: {
5667
- size: "md",
5668
- color: "primary",
5669
- icon: "check"
5662
+ variant: "t2",
5663
+ weight: "regular",
5664
+ color: "default",
5665
+ align: "start"
5670
5666
  }
5671
5667
  });
5668
+ function Text({
5669
+ as: TextComponent = "p",
5670
+ align,
5671
+ color,
5672
+ numberOfLines,
5673
+ variant,
5674
+ weight,
5675
+ value,
5676
+ children,
5677
+ className
5678
+ }) {
5679
+ const content = value ?? children;
5680
+ return /* @__PURE__ */ jsx(
5681
+ TextComponent,
5682
+ {
5683
+ className: cn(
5684
+ TextVariants({
5685
+ variant,
5686
+ weight,
5687
+ color,
5688
+ align,
5689
+ numberOfLines
5690
+ }),
5691
+ className
5692
+ ),
5693
+ children: content
5694
+ }
5695
+ );
5696
+ }
5697
+ function ButtonMore({ count, onClick }) {
5698
+ return /* @__PURE__ */ jsx(
5699
+ "button",
5700
+ {
5701
+ type: "button",
5702
+ onClick,
5703
+ className: "h-full w-full cursor-pointer px-1 transition-colors hover:bg-gray-50",
5704
+ title: `+${count} more`,
5705
+ children: /* @__PURE__ */ jsxs(Text, { weight: "medium", className: "line-clamp-1 text-gray-700", children: [
5706
+ "+",
5707
+ count,
5708
+ " more"
5709
+ ] })
5710
+ }
5711
+ );
5712
+ }
5713
+ var inputVariants = cva(
5714
+ "w-full min-w-0 rounded-lg border bg-transparent px-3 py-2 text-base font-medium text-gray-800 shadow-xs transition outline-none placeholder:text-gray-500",
5715
+ {
5716
+ variants: {
5717
+ size: {
5718
+ sm: "h-8 text-xs",
5719
+ md: "h-9 text-sm",
5720
+ lg: "h-10 text-base"
5721
+ }
5722
+ },
5723
+ defaultVariants: {
5724
+ size: "md"
5725
+ }
5726
+ }
5727
+ );
5672
5728
  var FormDescription = ({
5673
5729
  className,
5674
5730
  children
@@ -5722,7 +5778,7 @@ var FormLabel = ({
5722
5778
  var FormHint = ({ className, children }) => {
5723
5779
  return /* @__PURE__ */ jsx("p", { className: cn("text-xs text-gray-700", className), children });
5724
5780
  };
5725
- var FormField = React283__default.forwardRef(
5781
+ var FormField = React280__default.forwardRef(
5726
5782
  function FormField2({
5727
5783
  label,
5728
5784
  description,
@@ -5743,222 +5799,38 @@ var FormField = React283__default.forwardRef(
5743
5799
  ] });
5744
5800
  }
5745
5801
  );
5746
- createContext(void 0);
5747
- cva(
5748
- "inline-flex cursor-pointer items-center justify-center rounded-lg border transition-all duration-200",
5749
- {
5750
- variants: {
5751
- size: {
5752
- sm: "p-1.5 text-xs",
5753
- md: "p-2 text-sm",
5754
- lg: "px-3 py-2 text-base"
5755
- },
5756
- color: {
5757
- primary: "",
5758
- success: "",
5759
- danger: "",
5760
- warning: "",
5761
- info: "",
5762
- purple: "",
5763
- orange: "",
5764
- gray: ""
5765
- },
5766
- state: {
5767
- default: "",
5768
- selected: "",
5769
- disabled: ""
5770
- },
5771
- block: {
5772
- true: "w-full",
5773
- false: ""
5774
- }
5775
- },
5776
- compoundVariants: [
5777
- // Default color variants
5778
- {
5779
- color: "gray",
5780
- state: "default",
5781
- className: "border-gray-00 bg-white text-gray-700 hover:bg-gray-100"
5782
- },
5783
- {
5784
- color: "gray",
5785
- state: "selected",
5786
- className: "border-gray-400 bg-gray-200 text-gray-800"
5787
- },
5788
- {
5789
- color: "gray",
5790
- state: "disabled",
5791
- className: "cursor-not-allowed border-gray-200 bg-gray-100 text-gray-400"
5792
- },
5793
- // Primary color variants
5794
- {
5795
- color: "primary",
5796
- state: "default",
5797
- className: "border-primary-200 text-primary-1000 hover:bg-primary-50 bg-white"
5798
- },
5799
- {
5800
- color: "primary",
5801
- state: "selected",
5802
- className: "bg-primary-50 border-primary-200 text-primary-1000"
5803
- },
5804
- {
5805
- color: "primary",
5806
- state: "disabled",
5807
- className: "bg-primary-100 border-primary-200 text-primary-300 cursor-not-allowed"
5808
- },
5809
- // Success color variants
5810
- {
5811
- color: "success",
5812
- state: "default",
5813
- className: "border-success-300 text-success-500 hover:bg-success-50 bg-white"
5814
- },
5815
- {
5816
- color: "success",
5817
- state: "selected",
5818
- className: "bg-success-100 border-success-200 text-success-500"
5819
- },
5820
- {
5821
- color: "success",
5822
- state: "disabled",
5823
- className: "bg-success-100 border-success-200 text-success-300 cursor-not-allowed"
5824
- },
5825
- // Danger color variants
5826
- {
5827
- color: "danger",
5828
- state: "default",
5829
- className: "border-danger-200 text-danger-500 hover:bg-danger-50 bg-white"
5830
- },
5831
- {
5832
- color: "danger",
5833
- state: "selected",
5834
- className: "bg-danger-100 border-danger-200 text-danger-500"
5835
- },
5836
- {
5837
- color: "danger",
5838
- state: "disabled",
5839
- className: "bg-danger-100 border-danger-200 text-danger-300 cursor-not-allowed"
5840
- },
5841
- // Warning color variants
5842
- {
5843
- color: "warning",
5844
- state: "default",
5845
- className: "border-warning-300 text-warning-400 hover:bg-warning-50 bg-white"
5846
- },
5847
- {
5848
- color: "warning",
5849
- state: "selected",
5850
- className: "bg-warning-100 border-warning-300 text-warning-500"
5851
- },
5852
- {
5853
- color: "warning",
5854
- state: "disabled",
5855
- className: "bg-warning-100 border-warning-200 text-warning-300 cursor-not-allowed"
5856
- },
5857
- // Info color variants
5858
- {
5859
- color: "info",
5860
- state: "default",
5861
- className: "border-info-200 text-info-500 hover:bg-info-50 bg-white"
5862
- },
5863
- {
5864
- color: "info",
5865
- state: "selected",
5866
- className: "bg-info-100 border-info-200 text-info-500"
5867
- },
5868
- {
5869
- color: "info",
5870
- state: "disabled",
5871
- className: "bg-info-100 border-info-200 text-info-300 cursor-not-allowed"
5872
- },
5873
- // Purple color variants
5874
- {
5875
- color: "purple",
5876
- state: "default",
5877
- className: "border-purple-200 bg-white text-purple-500 hover:bg-purple-50"
5878
- },
5879
- {
5880
- color: "purple",
5881
- state: "selected",
5882
- className: "border-purple-200 bg-purple-100 text-purple-500"
5883
- },
5884
- {
5885
- color: "purple",
5886
- state: "disabled",
5887
- className: "cursor-not-allowed border-purple-200 bg-purple-100 text-purple-300"
5888
- },
5889
- // Orange color variants
5890
- {
5891
- color: "orange",
5892
- state: "default",
5893
- className: "border-orange-200 bg-white text-orange-500 hover:bg-orange-50"
5894
- },
5895
- {
5896
- color: "orange",
5897
- state: "selected",
5898
- className: "border-orange-200 bg-orange-100 text-orange-500"
5899
- },
5900
- {
5901
- color: "orange",
5902
- state: "disabled",
5903
- className: "cursor-not-allowed border-orange-200 bg-orange-100 text-orange-300"
5904
- }
5905
- ],
5906
- defaultVariants: {
5907
- size: "md",
5908
- color: "primary",
5909
- state: "default",
5910
- block: false
5911
- }
5912
- }
5913
- );
5914
- createContext(null);
5915
- var inputVariants = cva(
5916
- "w-full min-w-0 rounded-lg border bg-transparent px-3 py-2 text-base font-medium text-gray-800 shadow-xs transition outline-none placeholder:text-gray-500",
5917
- {
5918
- variants: {
5919
- size: {
5920
- sm: "h-8 text-xs",
5921
- md: "h-9 text-sm",
5922
- lg: "h-10 text-base"
5923
- }
5924
- },
5925
- defaultVariants: {
5926
- size: "md"
5927
- }
5928
- }
5929
- );
5930
- var Input = React283.forwardRef(
5931
- ({
5932
- className,
5933
- leftAddon,
5934
- rightAddon,
5935
- type = "text",
5936
- label,
5937
- hint,
5938
- errorMessages,
5939
- size,
5940
- inputSize,
5941
- description,
5942
- leftAddonClassName,
5943
- rightAddonClassName,
5944
- mergedAddon,
5945
- isError,
5946
- onContainerResize,
5947
- ...props
5948
- }, ref) => {
5949
- const hasError = fieldHasError(errorMessages) ?? isError;
5950
- const generatedId = React283.useId();
5951
- const fieldRef = React283.useRef(null);
5952
- React283.useEffect(() => {
5953
- if (!fieldRef.current || !onContainerResize) return;
5954
- const ro = new ResizeObserver(([entry]) => {
5955
- onContainerResize(entry.contentRect.width);
5956
- });
5957
- ro.observe(fieldRef.current);
5958
- return () => ro.disconnect();
5959
- }, [onContainerResize]);
5960
- return /* @__PURE__ */ jsx(
5961
- FormField,
5802
+ var Input = React280.forwardRef(
5803
+ ({
5804
+ className,
5805
+ leftAddon,
5806
+ rightAddon,
5807
+ type = "text",
5808
+ label,
5809
+ hint,
5810
+ errorMessages,
5811
+ size,
5812
+ inputSize,
5813
+ description,
5814
+ leftAddonClassName,
5815
+ rightAddonClassName,
5816
+ mergedAddon,
5817
+ isError,
5818
+ onContainerResize,
5819
+ ...props
5820
+ }, ref) => {
5821
+ const hasError = fieldHasError(errorMessages) ?? isError;
5822
+ const generatedId = React280.useId();
5823
+ const fieldRef = React280.useRef(null);
5824
+ React280.useEffect(() => {
5825
+ if (!fieldRef.current || !onContainerResize) return;
5826
+ const ro = new ResizeObserver(([entry]) => {
5827
+ onContainerResize(entry.contentRect.width);
5828
+ });
5829
+ ro.observe(fieldRef.current);
5830
+ return () => ro.disconnect();
5831
+ }, [onContainerResize]);
5832
+ return /* @__PURE__ */ jsx(
5833
+ FormField,
5962
5834
  {
5963
5835
  ref: fieldRef,
5964
5836
  label,
@@ -6029,1147 +5901,182 @@ var Input = React283.forwardRef(
6029
5901
  }
6030
5902
  );
6031
5903
  Input.displayName = "Input";
6032
- var MOBILE_BREAKPOINT = 768;
6033
- function useIsMobile() {
6034
- const [isMobile, setIsMobile] = React283.useState(false);
6035
- React283.useEffect(() => {
6036
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
6037
- const onChange = () => {
6038
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
6039
- };
6040
- mql.addEventListener("change", onChange);
6041
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
6042
- return () => mql.removeEventListener("change", onChange);
6043
- }, []);
6044
- return !!isMobile;
6045
- }
6046
- React283__default.createContext(
6047
- null
6048
- );
6049
- function TooltipProvider({
6050
- delayDuration = 0,
6051
- ...props
6052
- }) {
6053
- return /* @__PURE__ */ jsx(
6054
- TooltipPrimitive.Provider,
6055
- {
6056
- "data-slot": "tooltip-provider",
6057
- delayDuration,
6058
- ...props
6059
- }
6060
- );
6061
- }
6062
- function Tooltip({
6063
- ...props
6064
- }) {
6065
- return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
6066
- }
6067
- function TooltipTrigger({
6068
- ...props
6069
- }) {
6070
- return /* @__PURE__ */ jsx(
6071
- TooltipPrimitive.Trigger,
6072
- {
6073
- "data-slot": "tooltip-trigger",
6074
- type: "button",
6075
- ...props
6076
- }
6077
- );
6078
- }
6079
- function TooltipContent({
6080
- className,
6081
- sideOffset = 0,
6082
- children,
6083
- ...props
6084
- }) {
6085
- return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
6086
- TooltipPrimitive.Content,
6087
- {
6088
- "data-slot": "tooltip-content",
6089
- sideOffset,
6090
- className: cn(
6091
- "text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md bg-gray-900 px-3 py-1.5 text-xs text-balance text-white",
6092
- className
6093
- ),
6094
- ...props,
6095
- children: [
6096
- children,
6097
- /* @__PURE__ */ jsx(TooltipPrimitive.Arrow, { className: "z-50 size-2.5 -translate-y-1 rounded-xs bg-transparent fill-gray-900" })
6098
- ]
6099
- }
6100
- ) });
6101
- }
6102
- cva(
6103
- "relative z-50 w-full rounded-2xl bg-white shadow-xl focus:outline-none",
6104
- {
6105
- variants: {
6106
- size: {
6107
- xs: "max-w-[327px]",
6108
- sm: "max-w-[480px]",
6109
- md: "max-w-[700px]",
6110
- lg: "max-w-[1000px]",
6111
- full: "mx-4 max-w-full"
6112
- },
6113
- state: {
6114
- open: "animate-modal-scale-in",
6115
- closed: "animate-modal-scale-out"
6116
- }
6117
- },
6118
- defaultVariants: {
6119
- size: "md"
6120
- }
6121
- }
6122
- );
6123
- cva("fixed inset-0 z-[999] m-0 flex p-4", {
6124
- variants: {
6125
- position: {
6126
- center: "items-center justify-center",
6127
- top: "items-start justify-center",
6128
- bottom: "items-end justify-center"
6129
- },
6130
- state: {
6131
- open: "animate-modal-fade-in",
6132
- closed: "animate-modal-fade-out"
6133
- }
6134
- },
6135
- defaultVariants: {
6136
- position: "center"
6137
- }
6138
- });
6139
- var TextVariants = cva("font-metropolis", {
6140
- variants: {
6141
- variant: {
6142
- h1: "text-[36px] leading-[46px]",
6143
- h2: "text-[32px] leading-[42px]",
6144
- h3: "text-[28px] leading-[38px]",
6145
- h4: "text-[24px] leading-[34px]",
6146
- p1: "text-[20px] leading-[30px]",
6147
- p2: "text-[18px] leading-[28px]",
6148
- p3: "text-[16px] leading-[26px]",
6149
- t1: "text-[14px] leading-[24px]",
6150
- t2: "text-[12px] leading-[20px]",
6151
- t3: "text-[10px] leading-[14px]",
6152
- t4: "text-[8px] leading-[10px]"
6153
- },
6154
- weight: {
6155
- regular: "font-normal",
6156
- medium: "font-medium",
6157
- semibold: "font-semibold",
6158
- bold: "font-bold"
6159
- },
6160
- color: {
6161
- default: "",
6162
- muted: "text-gray-400",
6163
- primary: "text-primary-500",
6164
- success: "text-success-500",
6165
- warning: "text-warning-500",
6166
- orange: "text-orange-500",
6167
- danger: "text-danger-500",
6168
- info: "text-info-500",
6169
- purple: "text-purple-500",
6170
- gray: "text-gray-500"
6171
- },
6172
- align: {
6173
- start: "text-left",
6174
- center: "text-center",
6175
- end: "text-right",
6176
- justify: "text-justify"
6177
- },
6178
- numberOfLines: {
6179
- 1: "line-clamp-1",
6180
- 2: "line-clamp-2",
6181
- 3: "line-clamp-3",
6182
- 4: "line-clamp-4"
6183
- }
6184
- },
6185
- defaultVariants: {
6186
- variant: "t2",
6187
- weight: "regular",
6188
- color: "default",
6189
- align: "start"
6190
- }
6191
- });
6192
- function Text({
6193
- as: TextComponent = "p",
6194
- align,
6195
- color,
6196
- numberOfLines,
6197
- variant,
6198
- weight,
6199
- value,
6200
- children,
6201
- className
6202
- }) {
6203
- const content = value ?? children;
6204
- return /* @__PURE__ */ jsx(
6205
- TextComponent,
6206
- {
6207
- className: cn(
6208
- TextVariants({
6209
- variant,
6210
- weight,
6211
- color,
6212
- align,
6213
- numberOfLines
6214
- }),
6215
- className
6216
- ),
6217
- children: content
6218
- }
6219
- );
6220
- }
6221
- var inputFileVariants = cva("", {
6222
- variants: {
6223
- variant: {
6224
- primary: "bg-primary-1000 *:*:text-white border-primary-1000 focus-within:outline-primary-900 hover:bg-primary-1000",
6225
- //prettier-ignore
6226
- secondary: "bg-transparent *:*:text-primary-1000 border-primary-1000 focus-within:outline-primary-900 hover:bg-primary-50",
6227
- //prettier-ignore
6228
- gray: "bg-gray-700 *:*:text-white border-gray-700 focus-within:outline-gray-700 hover:bg-gray-700",
6229
- //prettier-ignore
6230
- medium: "",
6231
- large: ""
6232
- }
6233
- }
6234
- });
6235
-
6236
- // src/components/input-file/helpers.ts
6237
- var getIconName = ({
6238
- file,
6239
- fileType
6240
- }) => {
6241
- const type = file?.type ?? fileType;
6242
- const ext = file?.name.split(".").pop()?.toLowerCase();
6243
- if (type !== void 0 && type?.startsWith("image/")) {
6244
- return null;
6245
- }
6246
- if (type !== void 0 && type?.includes("spreadsheet") || ext === "xls" || ext === "xlsx") {
6247
- return "xls";
6248
- }
6249
- if (type !== void 0 && type?.includes("word") || ext === "doc" || ext === "docx") {
6250
- return "doc";
6251
- }
6252
- if (type !== void 0 && type?.startsWith("video/") || ext === "mkv" || ext === "mp4") {
6253
- return "mp4";
6254
- }
6255
- if (type !== void 0 && type?.startsWith("audio/") || ext === "mp3") {
6256
- return "mp3";
6257
- }
6258
- if (type !== void 0 && type?.includes("pdf") || ext === "pdf") {
6259
- return "pdf";
6260
- }
6261
- return "doc";
6262
- };
6263
- var ModalPreviewAttachment = ({
6264
- onClose,
6265
- open,
6266
- src,
6267
- name,
6268
- type,
6269
- iframeProps,
6270
- audioProps,
6271
- videoProps
6272
- }) => {
6273
- const [zoom, setZoom] = useState(1);
6274
- const [isDragging, setIsDragging] = useState(false);
6275
- const [position, setPosition] = useState({ x: 0, y: 0 });
6276
- const [dragStart, setDragStart] = useState({ x: 0, y: 0 });
6277
- const isImage = type.startsWith("image/");
6278
- const isMp3 = type.startsWith("audio/");
6279
- const isVideo = type.startsWith("video/");
6280
- const isPdf = type === "application/pdf";
6281
- const iconName = getIconName({ fileType: type });
6282
- const MIN_ZOOM = 0.5;
6283
- const MAX_ZOOM = 5;
6284
- const ZOOM_STEP = 0.5;
6285
- const handleZoomIn = () => {
6286
- setZoom((prev) => Math.min(prev + ZOOM_STEP, MAX_ZOOM));
6287
- };
6288
- const handleZoomOut = () => {
6289
- setZoom((prev) => {
6290
- const newZoom = Math.max(prev - ZOOM_STEP, MIN_ZOOM);
6291
- if (newZoom <= 1) {
6292
- setPosition({ x: 0, y: 0 });
6293
- }
6294
- return newZoom;
6295
- });
6296
- };
6297
- const handleMouseDown = (e) => {
6298
- if (zoom > 1) {
6299
- setIsDragging(true);
6300
- setDragStart({
6301
- x: e.clientX - position.x,
6302
- y: e.clientY - position.y
6303
- });
6304
- }
6305
- };
6306
- const handleMouseMove = (e) => {
6307
- if (isDragging && zoom > 1) {
6308
- setPosition({
6309
- x: e.clientX - dragStart.x,
6310
- y: e.clientY - dragStart.y
6311
- });
6312
- }
6313
- };
6314
- const handleMouseUp = () => {
6315
- setIsDragging(false);
6316
- };
6317
- const handleDownload = () => {
6318
- const link = document.createElement("a");
6319
- link.href = src;
6320
- link.download = name;
6321
- document.body.appendChild(link);
6322
- link.click();
6323
- document.body.removeChild(link);
6324
- };
6325
- useEffect(() => {
6326
- if (!open.isOpen) {
6327
- setZoom(1);
6328
- setPosition({ x: 0, y: 0 });
6329
- setIsDragging(false);
6330
- }
6331
- }, [open.isOpen]);
6332
- useEffect(() => {
6333
- document.body.style.overflow = open.isOpen ? "hidden" : "unset";
6334
- }, [open.isOpen]);
6335
- if (!open.isOpen) return null;
6336
- return /* @__PURE__ */ jsxs("div", { className: cn("fixed inset-0 z-20"), children: [
6337
- /* @__PURE__ */ jsx(
6338
- "div",
6339
- {
6340
- className: cn(
6341
- `fixed inset-0 z-10 size-full bg-black/40 transition-all`,
6342
- open.isVisible ? "opacity-100" : "opacity-0"
6343
- ),
6344
- onClick: onClose
6345
- }
6346
- ),
6347
- /* @__PURE__ */ jsxs(
6348
- "div",
6349
- {
6350
- className: cn(
6351
- "relative z-20 container mx-auto flex h-full flex-col items-center gap-6 py-10 transition-all",
6352
- open.isVisible ? "translate-y-0 opacity-100" : "-translate-y-10 opacity-0"
6353
- ),
6354
- children: [
6355
- /* @__PURE__ */ jsxs("div", { className: "flex w-full justify-between", children: [
6356
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
6357
- /* @__PURE__ */ jsx("button", { onClick: onClose, className: "cursor-pointer", type: "button", children: /* @__PURE__ */ jsx(Icon, { name: "times", color: "white" }) }),
6358
- /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
6359
- iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, size: 48 }),
6360
- /* @__PURE__ */ jsx(
6361
- Text,
6362
- {
6363
- value: name,
6364
- variant: "p3",
6365
- weight: "semibold",
6366
- className: "text-white!"
6367
- }
6368
- )
6369
- ] })
6370
- ] }),
6371
- isImage && /* @__PURE__ */ jsx(
6372
- ZoomController,
6373
- {
6374
- onDownload: handleDownload,
6375
- onZoomIn: handleZoomIn,
6376
- onZoomOut: handleZoomOut,
6377
- maxZoom: MAX_ZOOM,
6378
- minZoom: MIN_ZOOM,
6379
- zoom
6380
- }
6381
- )
6382
- ] }),
6383
- isImage && /* @__PURE__ */ jsxs(Fragment, { children: [
6384
- /* @__PURE__ */ jsx(
6385
- "div",
6386
- {
6387
- className: "scrollbar-hide relative flex size-full justify-center overflow-auto rounded-xl",
6388
- onMouseDown: handleMouseDown,
6389
- onMouseMove: handleMouseMove,
6390
- onMouseUp: handleMouseUp,
6391
- onMouseLeave: handleMouseUp,
6392
- style: {
6393
- cursor: zoom > 1 ? isDragging ? "grabbing" : "grab" : "default"
6394
- },
6395
- children: /* @__PURE__ */ jsx(
6396
- "img",
6397
- {
6398
- src,
6399
- alt: name,
6400
- draggable: false,
6401
- className: "h-full rounded-xl object-contain select-none",
6402
- style: {
6403
- transform: `scale(${zoom}) translate(${position.x / zoom}px, ${position.y / zoom}px)`,
6404
- transformOrigin: "top left",
6405
- transition: isDragging ? "none" : "transform 0.2s ease-out"
6406
- }
6407
- }
6408
- )
6409
- }
6410
- ),
6411
- zoom > 1 && /* @__PURE__ */ jsx("div", { className: "absolute bottom-14 left-1/2 -translate-x-1/2 rounded-lg bg-black/60 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
6412
- Text,
6413
- {
6414
- value: "Click and drag to pan \u2022 Scroll to zoom",
6415
- variant: "t3",
6416
- className: "text-white/80!"
6417
- }
6418
- ) })
6419
- ] }),
6420
- isVideo && /* @__PURE__ */ jsx("div", { className: "flex size-full overflow-auto", children: /* @__PURE__ */ jsx(
6421
- "video",
6422
- {
6423
- src,
6424
- controls: true,
6425
- className: cn(
6426
- "h-full w-full rounded-xl object-contain",
6427
- videoProps?.className
6428
- ),
6429
- ...videoProps
6430
- }
6431
- ) }),
6432
- isPdf && /* @__PURE__ */ jsx("div", { className: "flex size-full overflow-auto", children: /* @__PURE__ */ jsx(
6433
- "iframe",
6434
- {
6435
- src,
6436
- className: cn("h-full w-full", iframeProps?.className),
6437
- ...iframeProps
6438
- }
6439
- ) }),
6440
- isMp3 && /* @__PURE__ */ jsx("div", { className: "flex size-full items-center justify-center overflow-auto", children: /* @__PURE__ */ jsx(
6441
- "audio",
6442
- {
6443
- src,
6444
- controls: true,
6445
- className: cn("h-full w-full", audioProps?.className),
6446
- ...audioProps
6447
- }
6448
- ) })
6449
- ]
6450
- }
6451
- )
6452
- ] });
6453
- };
6454
- var ZoomController = ({
6455
- zoom,
6456
- onZoomIn,
6457
- onZoomOut,
6458
- onDownload,
6459
- maxZoom,
6460
- minZoom
6461
- }) => {
6462
- return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6463
- /* @__PURE__ */ jsx(
6464
- Button,
6465
- {
6466
- size: "icon",
6467
- onClick: onZoomIn,
6468
- disabled: zoom >= maxZoom,
6469
- type: "button",
6470
- children: /* @__PURE__ */ jsx(Icon, { name: "search-plus-fill" })
6471
- }
6472
- ),
6473
- /* @__PURE__ */ jsx(
6474
- Button,
6475
- {
6476
- size: "icon",
6477
- onClick: onZoomOut,
6478
- disabled: zoom <= minZoom,
6479
- type: "button",
6480
- children: /* @__PURE__ */ jsx(Icon, { name: "search-minus-fill" })
6481
- }
6482
- ),
6483
- /* @__PURE__ */ jsxs(Button, { color: "secondary", onClick: onDownload, children: [
6484
- /* @__PURE__ */ jsx(Icon, { name: "download" }),
6485
- /* @__PURE__ */ jsx(
6486
- Text,
6487
- {
6488
- as: "span",
6489
- value: "Download",
6490
- weight: "medium",
6491
- className: "text-primary-1000!"
6492
- }
6493
- )
6494
- ] })
6495
- ] });
6496
- };
6497
- var PreviewItem = ({
6498
- data,
6499
- onRemove,
6500
- onReplace,
6501
- disabled = false,
6502
- labelCustomName = "Attachment File",
6503
- onCustomNameChange,
6504
- customNamePlaceholder = "Name Attachment",
6505
- customName,
6506
- audioPlayerProps,
6507
- pdfViewerProps,
6508
- videoPlayerProps
6509
- }) => {
6510
- const [previewShow, setPreviewShow] = useState({
6511
- isOpen: false,
6512
- isVisible: false
6513
- });
6514
- const isImage = data?.file?.type.startsWith("image/");
6515
- const isMp3 = data?.file?.type.startsWith("audio/");
6516
- const isVideo = data?.file?.type.startsWith("video/");
6517
- const isPdf = data?.file?.type === "application/pdf";
6518
- const isNotViewable = !isImage && !isMp3 && !isVideo && !isPdf;
6519
- const iconName = getIconName({ file: data.file });
6520
- const handleOpenPreview = () => {
6521
- setPreviewShow({
6522
- isOpen: true,
6523
- isVisible: false
6524
- });
6525
- requestAnimationFrame(() => {
6526
- setPreviewShow({
6527
- isOpen: true,
6528
- isVisible: true
6529
- });
6530
- });
6531
- };
6532
- const handleClosePreview = () => {
6533
- setPreviewShow((s) => ({ ...s, isVisible: false }));
6534
- setTimeout(() => {
6535
- setPreviewShow({ isOpen: false, isVisible: false });
6536
- }, 200);
6537
- };
6538
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
6539
- !!onCustomNameChange && /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-2", children: [
6540
- /* @__PURE__ */ jsx(FormLabel, { children: labelCustomName }),
6541
- /* @__PURE__ */ jsx(
6542
- Input,
6543
- {
6544
- type: "text",
6545
- onChange: onCustomNameChange,
6546
- placeholder: customNamePlaceholder,
6547
- value: customName,
6548
- className: "truncate"
6549
- }
6550
- )
6551
- ] }),
6552
- /* @__PURE__ */ jsxs(
6553
- "div",
6554
- {
6555
- className: cn(
6556
- "flex w-full items-center justify-between rounded-lg border border-gray-200 p-2"
6557
- ),
6558
- children: [
6559
- /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-2 overflow-hidden", children: [
6560
- /* @__PURE__ */ jsx(
6561
- "button",
6562
- {
6563
- type: "button",
6564
- className: "cursor-pointer disabled:cursor-not-allowed",
6565
- onClick: handleOpenPreview,
6566
- disabled: isNotViewable,
6567
- children: data.file.type.startsWith("image/") ? /* @__PURE__ */ jsx(
6568
- "img",
6569
- {
6570
- src: data.preview,
6571
- alt: data.file.name,
6572
- className: "size-11 rounded-md object-cover"
6573
- }
6574
- ) : /* @__PURE__ */ jsx(Icon, { name: iconName ?? "doc", className: "size-11" })
6575
- }
6576
- ),
6577
- /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
6578
- /* @__PURE__ */ jsx(
6579
- Text,
6580
- {
6581
- as: "h3",
6582
- value: data.file.name,
6583
- variant: "t1",
6584
- weight: "semibold",
6585
- className: "truncate"
6586
- }
6587
- ),
6588
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1", children: [
6589
- /* @__PURE__ */ jsx(
6590
- Text,
6591
- {
6592
- value: `${(data.file.size / 1024 / 1024).toFixed(2)} MB`,
6593
- className: "truncate text-gray-700!"
6594
- }
6595
- ),
6596
- (Boolean(data?.hint) || Boolean(data?.errorMessage)) && /* @__PURE__ */ jsx(Text, { value: "\u2022", className: "truncate text-gray-700!" }),
6597
- Boolean(data?.hint) && /* @__PURE__ */ jsx(
6598
- Text,
6599
- {
6600
- value: data?.hint ?? "",
6601
- className: "truncate text-gray-700!"
6602
- }
6603
- ),
6604
- Boolean(data?.hint) && Boolean(data?.errorMessage) && /* @__PURE__ */ jsx(Text, { value: "\u2022", className: "truncate text-gray-700!" }),
6605
- Boolean(data?.errorMessage) && /* @__PURE__ */ jsx(Text, { value: data?.errorMessage ?? "", color: "danger" })
6606
- ] })
6607
- ] })
6608
- ] }),
6609
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6610
- Boolean(data?.errorMessage) && /* @__PURE__ */ jsxs(Fragment, { children: [
6611
- /* @__PURE__ */ jsx(
6612
- "button",
6613
- {
6614
- type: "button",
6615
- onClick: onReplace,
6616
- disabled,
6617
- className: "cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",
6618
- title: "Replace file",
6619
- children: /* @__PURE__ */ jsx(Icon, { name: "rotate-right", className: "size-4 text-gray-700" })
6620
- }
6621
- ),
6622
- /* @__PURE__ */ jsx(
6623
- Icon,
6624
- {
6625
- name: "exclamation-triangle",
6626
- className: "text-danger-500 size-4"
6627
- }
6628
- )
6629
- ] }),
6630
- /* @__PURE__ */ jsx(
6631
- "button",
6632
- {
6633
- type: "button",
6634
- onClick: onRemove,
6635
- disabled,
6636
- className: "cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",
6637
- children: /* @__PURE__ */ jsx(Icon, { name: "times", className: "size-4 text-gray-700" })
6638
- }
6639
- )
6640
- ] })
6641
- ]
6642
- }
6643
- ),
6644
- /* @__PURE__ */ jsx(
6645
- ModalPreviewAttachment,
6646
- {
6647
- type: data?.file?.type,
6648
- name: data?.customName ?? data?.file?.name,
6649
- src: data?.preview,
6650
- open: previewShow,
6651
- onClose: () => handleClosePreview(),
6652
- audioProps: audioPlayerProps,
6653
- videoProps: videoPlayerProps,
6654
- iframeProps: pdfViewerProps
6655
- }
6656
- )
6657
- ] });
6658
- };
6659
- var InputFile = forwardRef(
6660
- ({
6661
- value,
6662
- onChange,
6663
- multiple = false,
6664
- accept,
6665
- maxSize,
6666
- maxFiles,
6667
- disabled = false,
6668
- variant = "primary",
6669
- buttonLabel = "Choose File",
6670
- label = "Choose File",
6671
- hint = "JPG, PNG, dan PDF (Max. 5MB)",
6672
- errorMessage,
6673
- maxSizeErrorMessage,
6674
- maxFilesErrorMessage,
6675
- customNamePlaceholder,
6676
- useCustomName,
6677
- pdfViewerProps,
6678
- audioPlayerProps,
6679
- videoPlayerProps
6680
- }, ref) => {
6681
- const inputRef = useRef(null);
6682
- const replaceInputRef = useRef(null);
6683
- const [internalFiles, setInternalFiles] = useState([]);
6684
- const [replaceIndex, setReplaceIndex] = useState(null);
6685
- const [customNames, setCustomNames] = useState({});
6686
- const [isDragging, setIsDragging] = useState(false);
6687
- const files = value ?? internalFiles;
6688
- const setFiles = onChange ?? setInternalFiles;
6689
- const processFiles = (selectedFiles) => {
6690
- if (maxFiles !== void 0 && files.length + selectedFiles.length > maxFiles) {
6691
- alert(maxFilesErrorMessage ?? `Maksimal ${maxFiles} file`);
6692
- return;
6693
- }
6694
- if (maxSize !== void 0) {
6695
- const oversized = selectedFiles.filter((file) => file.size > maxSize);
6696
- if (oversized.length > 0) {
6697
- alert(
6698
- maxSizeErrorMessage ?? `File ${oversized.map((f) => f.name).join(", ")} melebihi ukuran maksimal ${(maxSize / 1024 / 1024).toFixed(2)} MB`
6699
- );
6700
- return;
6701
- }
6702
- }
6703
- const mapped = selectedFiles.map((file) => ({
6704
- id: crypto.randomUUID(),
6705
- file,
6706
- customName: file.name,
6707
- preview: URL.createObjectURL(file)
6708
- }));
6709
- setFiles([...files, ...mapped]);
6710
- };
6711
- const handleChange = (e) => {
6712
- const selected = Array.from(e.target.files ?? []);
6713
- processFiles(selected);
6714
- if (inputRef.current) {
6715
- inputRef.current.value = "";
6716
- }
6717
- };
6718
- const handleChangeCustomName = ({
6719
- e,
6720
- i
6721
- }) => {
6722
- if (replaceIndex !== null) return;
6723
- const val = e.target.value;
6724
- setCustomNames((prev) => ({
6725
- ...prev,
6726
- [i]: val
6727
- }));
6728
- };
6729
- const handleReplace = (e) => {
6730
- if (replaceIndex === null) return;
6731
- const selected = e.target.files?.[0];
6732
- if (!selected) return;
6733
- if (maxSize !== void 0 && selected.size > maxSize) {
6734
- alert(
6735
- maxSizeErrorMessage ?? `File ${selected.name} melebihi ukuran maksimal ${(maxSize / 1024 / 1024).toFixed(2)} MB`
6736
- );
6737
- return;
6738
- }
6739
- URL.revokeObjectURL(files[replaceIndex].preview);
6740
- const newFileItem = {
6741
- file: selected,
6742
- preview: URL.createObjectURL(selected)
6743
- };
6744
- const newFiles = [...files];
6745
- newFiles[replaceIndex] = newFileItem;
6746
- setFiles(newFiles);
6747
- setReplaceIndex(null);
6748
- if (replaceInputRef.current) {
6749
- replaceInputRef.current.value = "";
6750
- }
6751
- };
6752
- const removeFile = (index) => {
6753
- const newFiles = files.filter((_, i) => i !== index);
6754
- URL.revokeObjectURL(files[index].preview);
6755
- setFiles(newFiles);
6756
- };
6757
- const clearAll = () => {
6758
- files.forEach((f) => URL.revokeObjectURL(f.preview));
6759
- setFiles([]);
6760
- if (inputRef.current) {
6761
- inputRef.current.value = "";
6762
- }
6763
- };
6764
- const triggerReplace = (index) => {
6765
- setReplaceIndex(index);
6766
- replaceInputRef.current?.click();
6767
- };
6768
- const openFilePicker = () => {
6769
- inputRef.current?.click();
6770
- };
6771
- const handleDragEnter = (e) => {
6772
- e.preventDefault();
6773
- e.stopPropagation();
6774
- if (disabled) return;
6775
- setIsDragging(true);
6776
- };
6777
- const handleDragLeave = (e) => {
6778
- e.preventDefault();
6779
- e.stopPropagation();
6780
- if (disabled) return;
6781
- const rect = e.currentTarget.getBoundingClientRect();
6782
- const x = e.clientX;
6783
- const y = e.clientY;
6784
- if (x <= rect.left || x >= rect.right || y <= rect.top || y >= rect.bottom) {
6785
- setIsDragging(false);
6786
- }
6787
- };
6788
- const handleDragOver = (e) => {
6789
- e.preventDefault();
6790
- e.stopPropagation();
6791
- };
6792
- const handleDrop = (e) => {
6793
- e.preventDefault();
6794
- e.stopPropagation();
6795
- if (disabled) return;
6796
- setIsDragging(false);
6797
- const droppedFiles = Array.from(e.dataTransfer.files);
6798
- let filteredFiles = droppedFiles;
6799
- if (accept !== void 0) {
6800
- const acceptedTypes = accept.split(",").map((type) => type.trim());
6801
- filteredFiles = droppedFiles.filter((file) => {
6802
- return acceptedTypes.some((acceptedType) => {
6803
- if (acceptedType.startsWith(".")) {
6804
- return file.name.endsWith(acceptedType);
6805
- }
6806
- if (acceptedType.endsWith("/*")) {
6807
- const baseType = acceptedType.split("/")[0];
6808
- return file.type.startsWith(baseType + "/");
6809
- }
6810
- return file.type === acceptedType;
6811
- });
6812
- });
6813
- if (filteredFiles.length !== droppedFiles.length) {
6814
- alert(
6815
- `Beberapa file tidak sesuai dengan tipe yang diizinkan: ${accept}`
6816
- );
6817
- }
6818
- }
6819
- if (filteredFiles.length > 0) {
6820
- processFiles(filteredFiles);
6821
- }
6822
- };
6823
- useImperativeHandle(ref, () => ({
6824
- clearAll,
6825
- openFilePicker,
6826
- getFiles: () => files.map((f, i) => {
6827
- const base = { ...f };
6828
- if (useCustomName !== void 0) {
6829
- base.customName = customNames[i] ?? f.customName ?? f.file.name;
6830
- }
6831
- return base;
6832
- })
6833
- }));
6834
- useEffect(() => {
6835
- return () => files.forEach((f) => URL.revokeObjectURL(f.preview));
6836
- }, [files]);
6837
- const isDefault = variant === "primary" || variant === "secondary" || variant === "gray";
6838
- const isSized = variant === "medium" || variant === "large";
6839
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
6840
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
6841
- /* @__PURE__ */ jsxs(
6842
- "label",
6843
- {
6844
- className: cn(
6845
- inputFileVariants({ variant }),
6846
- "group relative flex items-center gap-2 rounded-lg border px-3 py-2 transition-all",
6847
- isDefault && "w-fit outline-2 outline-offset-1 outline-transparent",
6848
- //prettier-ignore
6849
- isSized && "w-full border-dashed border-gray-400 bg-gray-50",
6850
- //prettier-ignore
6851
- variant === "large" && errorMessage !== void 0 && "border-danger-500",
6852
- variant === "large" && "flex-col items-center p-5!",
6853
- variant === "large" && isDragging && "border-primary-500 bg-primary-50",
6854
- //prettier-ignore
6855
- disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
6856
- ),
6857
- onDragEnter: variant === "large" ? handleDragEnter : void 0,
6858
- onDragLeave: variant === "large" ? handleDragLeave : void 0,
6859
- onDragOver: variant === "large" ? handleDragOver : void 0,
6860
- onDrop: variant === "large" ? handleDrop : void 0,
6861
- children: [
6862
- isDefault && /* @__PURE__ */ jsx(Icon, { name: "upload" }),
6863
- isSized && /* @__PURE__ */ jsx(Icon, { name: "cloud-upload", size: variant === "large" ? 125 : 40 }),
6864
- /* @__PURE__ */ jsxs(
6865
- "div",
6866
- {
6867
- className: cn(
6868
- "flex flex-1 flex-col",
6869
- variant === "large" && "*:text-center"
6870
- ),
6871
- children: [
6872
- /* @__PURE__ */ jsx(
6873
- Text,
6874
- {
6875
- as: "h3",
6876
- value: label,
6877
- weight: "semibold",
6878
- className: cn(isSized && "text-gray-800!")
6879
- }
6880
- ),
6881
- isSized && /* @__PURE__ */ jsx(
6882
- Text,
6883
- {
6884
- as: "p",
6885
- value: variant === "large" && !isDragging && !hint ? `Klik atau drag & drop file disini` : hint,
6886
- className: "text-gray-600!"
6887
- }
6888
- )
6889
- ]
6890
- }
6891
- ),
6892
- errorMessage !== void 0 && variant === "large" && /* @__PURE__ */ jsx(
6893
- Text,
6894
- {
6895
- value: errorMessage,
6896
- variant: "t3",
6897
- className: "text-left",
6898
- color: "danger"
6899
- }
6900
- ),
6901
- isSized && /* @__PURE__ */ jsx(Button, { onClick: () => inputRef.current?.click(), type: "button", children: /* @__PURE__ */ jsx(
6902
- Text,
6903
- {
6904
- as: "span",
6905
- value: buttonLabel,
6906
- weight: "semibold",
6907
- className: "text-white!"
6908
- }
6909
- ) }),
6910
- /* @__PURE__ */ jsx(
6911
- "input",
6912
- {
6913
- ref: inputRef,
6914
- type: "file",
6915
- multiple,
6916
- accept,
6917
- onChange: handleChange,
6918
- disabled,
6919
- className: "absolute inset-0 -z-10 cursor-pointer opacity-0"
6920
- }
6921
- )
6922
- ]
6923
- }
6924
- ),
6925
- errorMessage !== void 0 && variant === "medium" && /* @__PURE__ */ jsx(
6926
- Text,
6927
- {
6928
- value: errorMessage,
6929
- variant: "t3",
6930
- className: "text-left",
6931
- color: "danger"
6932
- }
6933
- )
6934
- ] }),
6935
- /* @__PURE__ */ jsx(
6936
- "input",
6937
- {
6938
- ref: replaceInputRef,
6939
- type: "file",
6940
- accept,
6941
- onChange: handleReplace,
6942
- className: "hidden"
6943
- }
6944
- ),
6945
- files.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
6946
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
6947
- /* @__PURE__ */ jsx(
6948
- Text,
6949
- {
6950
- value: "Selected Files",
6951
- variant: "t1",
6952
- weight: "semibold",
6953
- as: "h1"
6954
- }
6955
- ),
6956
- /* @__PURE__ */ jsx(
6957
- "button",
6958
- {
6959
- type: "button",
6960
- onClick: clearAll,
6961
- disabled,
6962
- className: "cursor-pointer disabled:opacity-50",
6963
- children: /* @__PURE__ */ jsx(Text, { value: "Clear", weight: "semibold", color: "danger" })
6964
- }
6965
- )
6966
- ] }),
6967
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: files.map((item, i) => /* @__PURE__ */ jsx(
6968
- PreviewItem,
6969
- {
6970
- data: item,
6971
- audioPlayerProps,
6972
- pdfViewerProps,
6973
- videoPlayerProps,
6974
- onRemove: () => removeFile(i),
6975
- onReplace: () => triggerReplace(i),
6976
- labelCustomName: item?.label,
6977
- customNamePlaceholder,
6978
- onCustomNameChange: useCustomName !== void 0 ? (e) => handleChangeCustomName?.({ e, i }) : void 0,
6979
- customName: customNames[i] ?? item.customName ?? item.file.name,
6980
- disabled
6981
- },
6982
- item?.id
6983
- )) })
6984
- ] })
6985
- ] });
6986
- }
6987
- );
6988
- InputFile.displayName = "InputFile";
6989
- cva("", {
6990
- variants: {
6991
- size: {
6992
- sm: "px-0 text-xs",
6993
- md: "text-md",
6994
- lg: "text-lg"
6995
- },
6996
- controlIconSize: {
6997
- sm: "size-[10px]",
6998
- md: "size-[14px]",
6999
- lg: "size-[16px]"
7000
- },
7001
- height: {
7002
- sm: "h-[22px]",
7003
- md: "h-[30px]",
7004
- lg: "h-[40px]"
7005
- },
7006
- variant: {
7007
- primary: "border-0",
7008
- secondary: "border border-gray-500"
7009
- }
7010
- },
7011
- defaultVariants: {
7012
- size: "md"
7013
- }
7014
- });
7015
- function Dropdown({
7016
- children,
7017
- ...props
7018
- }) {
7019
- return /* @__PURE__ */ jsx(DropdownMenu.Root, { ...props, children });
7020
- }
7021
- function DropdownTrigger({
7022
- children,
7023
- ...props
7024
- }) {
7025
- return /* @__PURE__ */ jsx(DropdownMenu.Trigger, { ...props, children });
7026
- }
7027
- function DropdownContent({
7028
- children,
7029
- className,
7030
- portalProps,
7031
- ...props
7032
- }) {
7033
- return /* @__PURE__ */ jsx(DropdownMenu.Portal, { ...portalProps, children: /* @__PURE__ */ jsx(
7034
- DropdownMenu.Content,
7035
- {
7036
- sideOffset: props.sideOffset ?? 15,
7037
- className: cn(
7038
- "shadow-dropdown flex flex-col gap-1 rounded-xl border border-gray-200 bg-white p-3",
7039
- className
7040
- ),
7041
- ...props,
7042
- children
7043
- }
7044
- ) });
7045
- }
7046
- function DropdownItem({
7047
- children,
7048
- className,
7049
- ...props
7050
- }) {
7051
- return /* @__PURE__ */ jsx(
7052
- DropdownMenu.Item,
7053
- {
7054
- className: cn(
7055
- "hover:bg-primary-50 hover:border-primary-300 flex cursor-pointer flex-row items-center gap-2 rounded-lg border border-gray-200 px-3 py-2 outline-0 transition-all",
7056
- className
7057
- ),
7058
- ...props,
7059
- children
7060
- }
7061
- );
7062
- }
7063
- cva("", {
7064
- variants: {
7065
- tableRow: {
7066
- "basic": "",
7067
- "bordered": "",
7068
- "stripped": "",
7069
- "hovered": "",
7070
- "row-bordered": "border-y border-gray-300",
7071
- "wrapped-row-bordered": "border-y border-gray-300",
7072
- "headed": ""
7073
- }
7074
- }
7075
- });
7076
- createContext({});
7077
- createContext({});
7078
5904
 
7079
5905
  // src/components/date-picker/helpers.ts
7080
- function formatDateLocal(date) {
7081
- const y = date.getFullYear();
7082
- const m = String(date.getMonth() + 1).padStart(2, "0");
7083
- const d = String(date.getDate()).padStart(2, "0");
7084
- return `${y}-${m}-${d}`;
7085
- }
7086
- cva(
7087
- "relative inline-flex shrink-0 rounded-full transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
7088
- {
7089
- variants: {
7090
- size: {
7091
- sm: "h-5 w-9",
7092
- md: "h-6 w-11",
7093
- lg: "h-7 w-14"
7094
- },
7095
- color: {
7096
- primary: "data-[state=checked]:bg-primary-1000 focus-visible:ring-primary-900",
7097
- secondary: "focus-visible:ring-gray-500 data-[state=checked]:bg-gray-600",
7098
- success: "data-[state=checked]:bg-success-500 focus-visible:ring-success-400",
7099
- danger: "data-[state=checked]:bg-danger-500 focus-visible:ring-danger-400",
7100
- warning: "data-[state=checked]:bg-warning-500 focus-visible:ring-warning-400",
7101
- info: "data-[state=checked]:bg-info-500 focus-visible:ring-info-400",
7102
- orange: "focus-visible:ring-orange-400 data-[state=checked]:bg-orange-500",
7103
- purple: "focus-visible:ring-purple-400 data-[state=checked]:bg-purple-500",
7104
- gray: "focus-visible:ring-gray-600 data-[state=checked]:bg-gray-700"
7105
- }
7106
- },
7107
- defaultVariants: {
7108
- size: "md",
7109
- color: "primary"
7110
- }
7111
- }
7112
- );
5906
+ function formatDateLocal(date) {
5907
+ const y = date.getFullYear();
5908
+ const m = String(date.getMonth() + 1).padStart(2, "0");
5909
+ const d = String(date.getDate()).padStart(2, "0");
5910
+ return `${y}-${m}-${d}`;
5911
+ }
7113
5912
  cva(
7114
- "pointer-events-none absolute top-0.5 inline-block rounded-full bg-white shadow-lg ring-0 transition-transform",
5913
+ "inline-flex cursor-pointer items-center justify-center rounded-lg border transition-all duration-200",
7115
5914
  {
7116
5915
  variants: {
7117
5916
  size: {
7118
- sm: "h-4 w-4 data-[state=checked]:translate-x-4.5 data-[state=unchecked]:translate-x-0.5",
7119
- md: "h-5 w-5 data-[state=checked]:translate-x-5.5 data-[state=unchecked]:translate-x-0.5",
7120
- lg: "h-6 w-6 data-[state=checked]:translate-x-7.5 data-[state=unchecked]:translate-x-0.5"
5917
+ sm: "p-1.5 text-xs",
5918
+ md: "p-2 text-sm",
5919
+ lg: "px-3 py-2 text-base"
5920
+ },
5921
+ color: {
5922
+ primary: "",
5923
+ success: "",
5924
+ danger: "",
5925
+ warning: "",
5926
+ info: "",
5927
+ purple: "",
5928
+ orange: "",
5929
+ gray: ""
5930
+ },
5931
+ state: {
5932
+ default: "",
5933
+ selected: "",
5934
+ disabled: ""
5935
+ },
5936
+ block: {
5937
+ true: "w-full",
5938
+ false: ""
7121
5939
  }
7122
5940
  },
5941
+ compoundVariants: [
5942
+ // Default color variants
5943
+ {
5944
+ color: "gray",
5945
+ state: "default",
5946
+ className: "border-gray-00 bg-white text-gray-700 hover:bg-gray-100"
5947
+ },
5948
+ {
5949
+ color: "gray",
5950
+ state: "selected",
5951
+ className: "border-gray-400 bg-gray-200 text-gray-800"
5952
+ },
5953
+ {
5954
+ color: "gray",
5955
+ state: "disabled",
5956
+ className: "cursor-not-allowed border-gray-200 bg-gray-100 text-gray-400"
5957
+ },
5958
+ // Primary color variants
5959
+ {
5960
+ color: "primary",
5961
+ state: "default",
5962
+ className: "border-primary-200 text-primary-1000 hover:bg-primary-50 bg-white"
5963
+ },
5964
+ {
5965
+ color: "primary",
5966
+ state: "selected",
5967
+ className: "bg-primary-50 border-primary-200 text-primary-1000"
5968
+ },
5969
+ {
5970
+ color: "primary",
5971
+ state: "disabled",
5972
+ className: "bg-primary-100 border-primary-200 text-primary-300 cursor-not-allowed"
5973
+ },
5974
+ // Success color variants
5975
+ {
5976
+ color: "success",
5977
+ state: "default",
5978
+ className: "border-success-300 text-success-500 hover:bg-success-50 bg-white"
5979
+ },
5980
+ {
5981
+ color: "success",
5982
+ state: "selected",
5983
+ className: "bg-success-100 border-success-200 text-success-500"
5984
+ },
5985
+ {
5986
+ color: "success",
5987
+ state: "disabled",
5988
+ className: "bg-success-100 border-success-200 text-success-300 cursor-not-allowed"
5989
+ },
5990
+ // Danger color variants
5991
+ {
5992
+ color: "danger",
5993
+ state: "default",
5994
+ className: "border-danger-200 text-danger-500 hover:bg-danger-50 bg-white"
5995
+ },
5996
+ {
5997
+ color: "danger",
5998
+ state: "selected",
5999
+ className: "bg-danger-100 border-danger-200 text-danger-500"
6000
+ },
6001
+ {
6002
+ color: "danger",
6003
+ state: "disabled",
6004
+ className: "bg-danger-100 border-danger-200 text-danger-300 cursor-not-allowed"
6005
+ },
6006
+ // Warning color variants
6007
+ {
6008
+ color: "warning",
6009
+ state: "default",
6010
+ className: "border-warning-300 text-warning-400 hover:bg-warning-50 bg-white"
6011
+ },
6012
+ {
6013
+ color: "warning",
6014
+ state: "selected",
6015
+ className: "bg-warning-100 border-warning-300 text-warning-500"
6016
+ },
6017
+ {
6018
+ color: "warning",
6019
+ state: "disabled",
6020
+ className: "bg-warning-100 border-warning-200 text-warning-300 cursor-not-allowed"
6021
+ },
6022
+ // Info color variants
6023
+ {
6024
+ color: "info",
6025
+ state: "default",
6026
+ className: "border-info-200 text-info-500 hover:bg-info-50 bg-white"
6027
+ },
6028
+ {
6029
+ color: "info",
6030
+ state: "selected",
6031
+ className: "bg-info-100 border-info-200 text-info-500"
6032
+ },
6033
+ {
6034
+ color: "info",
6035
+ state: "disabled",
6036
+ className: "bg-info-100 border-info-200 text-info-300 cursor-not-allowed"
6037
+ },
6038
+ // Purple color variants
6039
+ {
6040
+ color: "purple",
6041
+ state: "default",
6042
+ className: "border-purple-200 bg-white text-purple-500 hover:bg-purple-50"
6043
+ },
6044
+ {
6045
+ color: "purple",
6046
+ state: "selected",
6047
+ className: "border-purple-200 bg-purple-100 text-purple-500"
6048
+ },
6049
+ {
6050
+ color: "purple",
6051
+ state: "disabled",
6052
+ className: "cursor-not-allowed border-purple-200 bg-purple-100 text-purple-300"
6053
+ },
6054
+ // Orange color variants
6055
+ {
6056
+ color: "orange",
6057
+ state: "default",
6058
+ className: "border-orange-200 bg-white text-orange-500 hover:bg-orange-50"
6059
+ },
6060
+ {
6061
+ color: "orange",
6062
+ state: "selected",
6063
+ className: "border-orange-200 bg-orange-100 text-orange-500"
6064
+ },
6065
+ {
6066
+ color: "orange",
6067
+ state: "disabled",
6068
+ className: "cursor-not-allowed border-orange-200 bg-orange-100 text-orange-300"
6069
+ }
6070
+ ],
7123
6071
  defaultVariants: {
7124
- size: "md"
6072
+ size: "md",
6073
+ color: "primary",
6074
+ state: "default",
6075
+ block: false
7125
6076
  }
7126
6077
  }
7127
6078
  );
7128
- cva("", {
7129
- variants: {
7130
- bg: {
7131
- danger: "bg-danger-50",
7132
- gray: "bg-gray-400",
7133
- info: "bg-info-50",
7134
- orange: "bg-orange-50",
7135
- primary: "bg-primary-1000",
7136
- success: "bg-success-50",
7137
- purple: "bg-purple-50",
7138
- secondary: "bg-white",
7139
- warning: "bg-warning-50"
7140
- },
7141
- text: {
7142
- danger: "text-danger-500",
7143
- gray: "text-gray-700",
7144
- info: "text-info-500",
7145
- orange: "text-orange-500",
7146
- primary: "text-white",
7147
- success: "text-success-500",
7148
- purple: "text-purple-500",
7149
- secondary: "text-primary-1000",
7150
- warning: "text-warning-500"
7151
- }
7152
- }
7153
- });
7154
6079
  createContext(null);
7155
- createContext(void 0);
7156
- createContext(null);
7157
- function ButtonMore({ count, onClick }) {
7158
- return /* @__PURE__ */ jsx(
7159
- "button",
7160
- {
7161
- type: "button",
7162
- onClick,
7163
- className: "h-full w-full cursor-pointer px-1 transition-colors hover:bg-gray-50",
7164
- title: `+${count} more`,
7165
- children: /* @__PURE__ */ jsxs(Text, { weight: "medium", className: "line-clamp-1 text-gray-700", children: [
7166
- "+",
7167
- count,
7168
- " more"
7169
- ] })
7170
- }
7171
- );
7172
- }
7173
6080
 
7174
6081
  // src/components/calendar/helpers/create-date-style-helpers.ts
7175
6082
  function createDateStyleHelpers({
@@ -7246,6 +6153,59 @@ function createDateStyleHelpers({
7246
6153
  };
7247
6154
  return { getBackgroundClass, getTextColorClass, getCursorClass, getDayStyle };
7248
6155
  }
6156
+ function TooltipProvider({
6157
+ delayDuration = 0,
6158
+ ...props
6159
+ }) {
6160
+ return /* @__PURE__ */ jsx(
6161
+ TooltipPrimitive.Provider,
6162
+ {
6163
+ "data-slot": "tooltip-provider",
6164
+ delayDuration,
6165
+ ...props
6166
+ }
6167
+ );
6168
+ }
6169
+ function Tooltip({
6170
+ ...props
6171
+ }) {
6172
+ return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
6173
+ }
6174
+ function TooltipTrigger({
6175
+ ...props
6176
+ }) {
6177
+ return /* @__PURE__ */ jsx(
6178
+ TooltipPrimitive.Trigger,
6179
+ {
6180
+ "data-slot": "tooltip-trigger",
6181
+ type: "button",
6182
+ ...props
6183
+ }
6184
+ );
6185
+ }
6186
+ function TooltipContent({
6187
+ className,
6188
+ sideOffset = 0,
6189
+ children,
6190
+ ...props
6191
+ }) {
6192
+ return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
6193
+ TooltipPrimitive.Content,
6194
+ {
6195
+ "data-slot": "tooltip-content",
6196
+ sideOffset,
6197
+ className: cn(
6198
+ "text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md bg-gray-900 px-3 py-1.5 text-xs text-balance text-white",
6199
+ className
6200
+ ),
6201
+ ...props,
6202
+ children: [
6203
+ children,
6204
+ /* @__PURE__ */ jsx(TooltipPrimitive.Arrow, { className: "z-50 size-2.5 -translate-y-1 rounded-xs bg-transparent fill-gray-900" })
6205
+ ]
6206
+ }
6207
+ ) });
6208
+ }
7249
6209
  var date_size_map = {
7250
6210
  md: "size-7.5",
7251
6211
  sm: "size-6",
@@ -7288,7 +6248,7 @@ function CalendarDayItem({
7288
6248
  style: styleHelpers.getDayStyle(),
7289
6249
  onClick: () => onClick(day),
7290
6250
  disabled: isDisabled && isCurrentMonth,
7291
- className: clsx10(
6251
+ className: clsx5(
7292
6252
  date_size_map[size ?? "md"],
7293
6253
  styleHelpers.getCursorClass(),
7294
6254
  styleHelpers.getTextColorClass(),
@@ -7310,7 +6270,7 @@ function CalendarDayItem({
7310
6270
  /* @__PURE__ */ jsx(
7311
6271
  "h5",
7312
6272
  {
7313
- className: clsx10(
6273
+ className: clsx5(
7314
6274
  "font-metropolis text-xs transition-colors",
7315
6275
  variant === "default" && "grid size-8 place-items-center justify-center rounded-full",
7316
6276
  //prettier-ignore
@@ -7385,7 +6345,7 @@ function EventBar({
7385
6345
  onMouseEnter: () => setHovered(true),
7386
6346
  onMouseLeave: () => setHovered(false),
7387
6347
  onMouseMove: handleMouseMove,
7388
- className: clsx10(
6348
+ className: clsx5(
7389
6349
  "relative mx-0.5 mt-1 flex items-center justify-between gap-3 overflow-hidden rounded p-1 text-[11px] leading-5 font-medium md:p-1.5",
7390
6350
  onClick && "cursor-pointer"
7391
6351
  ),
@@ -7432,13 +6392,27 @@ function EventBar({
7432
6392
  }
7433
6393
  }
7434
6394
  ),
7435
- /* @__PURE__ */ jsx(Text, { variant: "t3", className: clsx10("text-gray-800"), children: segment.event.label })
6395
+ /* @__PURE__ */ jsx(Text, { variant: "t3", className: clsx5("text-gray-800"), children: segment.event.label })
7436
6396
  ] })
7437
6397
  ] })
7438
6398
  }
7439
6399
  )
7440
6400
  ] });
7441
6401
  }
6402
+ var MOBILE_BREAKPOINT = 768;
6403
+ function useIsMobile() {
6404
+ const [isMobile, setIsMobile] = React280.useState(false);
6405
+ React280.useEffect(() => {
6406
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
6407
+ const onChange = () => {
6408
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
6409
+ };
6410
+ mql.addEventListener("change", onChange);
6411
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
6412
+ return () => mql.removeEventListener("change", onChange);
6413
+ }, []);
6414
+ return !!isMobile;
6415
+ }
7442
6416
  function CalendarGrid({
7443
6417
  days: days2,
7444
6418
  helpers,
@@ -7461,7 +6435,7 @@ function CalendarGrid({
7461
6435
  return /* @__PURE__ */ jsx(
7462
6436
  "div",
7463
6437
  {
7464
- className: clsx10(
6438
+ className: clsx5(
7465
6439
  "relative",
7466
6440
  variant === "compact" && size === "sm" && "space-y-1"
7467
6441
  ),
@@ -7552,7 +6526,7 @@ function CalendarGrid({
7552
6526
  return /* @__PURE__ */ jsxs(
7553
6527
  "div",
7554
6528
  {
7555
- className: clsx10(
6529
+ className: clsx5(
7556
6530
  "relative",
7557
6531
  variant === "default" && "border-b border-gray-300 last:border-b-0!",
7558
6532
  //prettier-ignore
@@ -7562,7 +6536,7 @@ function CalendarGrid({
7562
6536
  /* @__PURE__ */ jsx(
7563
6537
  "div",
7564
6538
  {
7565
- className: clsx10(
6539
+ className: clsx5(
7566
6540
  "grid w-full grid-cols-7",
7567
6541
  variant === "default" && "*:border-r *:border-gray-300 [&>*:nth-last-child(1)]:border-r-0",
7568
6542
  //prettier-ignore
@@ -7831,7 +6805,7 @@ function DaysOfWeek({
7831
6805
  return /* @__PURE__ */ jsxs(
7832
6806
  "div",
7833
6807
  {
7834
- className: clsx10(
6808
+ className: clsx5(
7835
6809
  "grid justify-items-center",
7836
6810
  variant === "compact" && "calendar-cols mb-3 gap-x-1 *:text-center!",
7837
6811
  variant === "default" && "w-full bg-gray-100 *:p-3 *:w-full *:text-start! *:border-r *:border-gray-300 *:last:border-r-0",
@@ -7852,7 +6826,7 @@ function DaysOfWeek({
7852
6826
  as: "h5",
7853
6827
  weight: variant === "compact" ? "medium" : "semibold",
7854
6828
  value: day,
7855
- className: clsx10(
6829
+ className: clsx5(
7856
6830
  variant === "compact" && "text-gray-600!",
7857
6831
  variant === "default" && "text-gray-900! uppercase"
7858
6832
  ),
@@ -8043,7 +7017,7 @@ var Calendar2 = ({
8043
7017
  setSelectedType(type);
8044
7018
  }
8045
7019
  }, [type]);
8046
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: clsx10(variant === "default" && "flex flex-col gap-2"), children: [
7020
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: clsx5(variant === "default" && "flex flex-col gap-2"), children: [
8047
7021
  variant === "default" && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
8048
7022
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6", children: [
8049
7023
  /* @__PURE__ */ jsxs("div", { className: "*:cursor-pointer", children: [
@@ -8116,7 +7090,7 @@ var Calendar2 = ({
8116
7090
  setSelectedType(option.value);
8117
7091
  onTypeChange?.(option.value);
8118
7092
  },
8119
- className: clsx10(
7093
+ className: clsx5(
8120
7094
  (selectedType === option.value || index === selectedTypeIndex) && "bg-primary-50!"
8121
7095
  ),
8122
7096
  children: /* @__PURE__ */ jsx(Text, { className: "text-gray-900", children: option.label })