myoperator-ui 0.0.70 → 0.0.72

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 (2) hide show
  1. package/dist/index.js +262 -235
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -243,6 +243,7 @@ const buttonVariants = cva(
243
243
  lg: "py-3 px-6 [&_svg]:size-5",
244
244
  icon: "h-8 w-8 rounded-md",
245
245
  "icon-sm": "h-7 w-7 rounded-md",
246
+ "icon-lg": "h-10 w-10 rounded-md",
246
247
  },
247
248
  },
248
249
  defaultVariants: {
@@ -325,8 +326,9 @@ export { Button, buttonVariants }
325
326
  },
326
327
  "badge": {
327
328
  name: "badge",
328
- description: "A status badge component with active, failed, and disabled variants",
329
+ description: "A status badge component with active, failed, disabled, outline, secondary, and destructive variants",
329
330
  dependencies: [
331
+ "@radix-ui/react-slot",
330
332
  "class-variance-authority",
331
333
  "clsx",
332
334
  "tailwind-merge"
@@ -335,6 +337,7 @@ export { Button, buttonVariants }
335
337
  {
336
338
  name: "badge.tsx",
337
339
  content: prefixTailwindClasses(`import * as React from "react"
340
+ import { Slot } from "@radix-ui/react-slot"
338
341
  import { cva, type VariantProps } from "class-variance-authority"
339
342
 
340
343
  import { cn } from "../../lib/utils"
@@ -348,10 +351,15 @@ const badgeVariants = cva(
348
351
  {
349
352
  variants: {
350
353
  variant: {
354
+ // Status-based variants (existing)
351
355
  active: "bg-[#E5FFF5] text-[#00A651]",
352
356
  failed: "bg-[#FFECEC] text-[#FF3B3B]",
353
357
  disabled: "bg-[#F3F5F6] text-[#6B7280]",
354
358
  default: "bg-[#F3F5F6] text-[#333333]",
359
+ // shadcn-style variants (new)
360
+ secondary: "bg-[#F3F4F6] text-[#333333]",
361
+ outline: "border border-[#E5E7EB] bg-transparent text-[#333333]",
362
+ destructive: "bg-[#FFECEC] text-[#FF3B3B]",
355
363
  },
356
364
  size: {
357
365
  default: "px-3 py-1",
@@ -374,7 +382,11 @@ const badgeVariants = cva(
374
382
  * <Badge variant="active">Active</Badge>
375
383
  * <Badge variant="failed">Failed</Badge>
376
384
  * <Badge variant="disabled">Disabled</Badge>
385
+ * <Badge variant="outline">Outline</Badge>
386
+ * <Badge variant="secondary">Secondary</Badge>
387
+ * <Badge variant="destructive">Destructive</Badge>
377
388
  * <Badge variant="active" leftIcon={<CheckIcon />}>Active</Badge>
389
+ * <Badge asChild><a href="/status">View Status</a></Badge>
378
390
  * \`\`\`
379
391
  */
380
392
  export interface BadgeProps
@@ -384,12 +396,30 @@ export interface BadgeProps
384
396
  leftIcon?: React.ReactNode
385
397
  /** Icon displayed on the right side of the badge text */
386
398
  rightIcon?: React.ReactNode
399
+ /** Render as child element using Radix Slot */
400
+ asChild?: boolean
387
401
  }
388
402
 
389
403
  const Badge = React.forwardRef<HTMLDivElement, BadgeProps>(
390
- ({ className, variant, size, leftIcon, rightIcon, children, ...props }, ref) => {
404
+ ({ className, variant, size, leftIcon, rightIcon, asChild = false, children, ...props }, ref) => {
405
+ const Comp = asChild ? Slot : "div"
406
+
407
+ // When using asChild, we can't wrap the child with extra elements
408
+ // The child must receive the className and ref directly
409
+ if (asChild) {
410
+ return (
411
+ <Comp
412
+ className={cn(badgeVariants({ variant, size, className }), "gap-1")}
413
+ ref={ref}
414
+ {...props}
415
+ >
416
+ {children}
417
+ </Comp>
418
+ )
419
+ }
420
+
391
421
  return (
392
- <div
422
+ <Comp
393
423
  className={cn(badgeVariants({ variant, size, className }), "gap-1")}
394
424
  ref={ref}
395
425
  {...props}
@@ -397,7 +427,7 @@ const Badge = React.forwardRef<HTMLDivElement, BadgeProps>(
397
427
  {leftIcon && <span className="[&_svg]:size-3">{leftIcon}</span>}
398
428
  {children}
399
429
  {rightIcon && <span className="[&_svg]:size-3">{rightIcon}</span>}
400
- </div>
430
+ </Comp>
401
431
  )
402
432
  }
403
433
  )
@@ -678,8 +708,9 @@ export {
678
708
  },
679
709
  "checkbox": {
680
710
  name: "checkbox",
681
- description: "A tri-state checkbox component with label support (checked, unchecked, indeterminate)",
711
+ description: "A tri-state checkbox component with label support (checked, unchecked, indeterminate). Built on Radix UI Checkbox.",
682
712
  dependencies: [
713
+ "@radix-ui/react-checkbox",
683
714
  "class-variance-authority",
684
715
  "clsx",
685
716
  "tailwind-merge",
@@ -689,6 +720,7 @@ export {
689
720
  {
690
721
  name: "checkbox.tsx",
691
722
  content: prefixTailwindClasses(`import * as React from "react"
723
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
692
724
  import { cva, type VariantProps } from "class-variance-authority"
693
725
  import { Check, Minus } from "lucide-react"
694
726
 
@@ -698,7 +730,7 @@ import { cn } from "../../lib/utils"
698
730
  * Checkbox box variants (the outer container)
699
731
  */
700
732
  const checkboxVariants = cva(
701
- "inline-flex items-center justify-center rounded border-2 transition-colors duration-200 ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#343E55] focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
733
+ "peer inline-flex items-center justify-center shrink-0 rounded border-2 transition-colors duration-200 ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#343E55] focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-[#343E55] data-[state=checked]:border-[#343E55] data-[state=checked]:text-white data-[state=indeterminate]:bg-[#343E55] data-[state=indeterminate]:border-[#343E55] data-[state=indeterminate]:text-white data-[state=unchecked]:bg-white data-[state=unchecked]:border-[#E5E7EB] data-[state=unchecked]:hover:border-[#9CA3AF]",
702
734
  {
703
735
  variants: {
704
736
  size: {
@@ -748,7 +780,7 @@ const labelSizeVariants = cva("", {
748
780
  export type CheckedState = boolean | "indeterminate"
749
781
 
750
782
  /**
751
- * A tri-state checkbox component with label support
783
+ * A tri-state checkbox component with label support. Built on Radix UI Checkbox primitive.
752
784
  *
753
785
  * @example
754
786
  * \`\`\`tsx
@@ -756,101 +788,113 @@ export type CheckedState = boolean | "indeterminate"
756
788
  * <Checkbox size="sm" disabled />
757
789
  * <Checkbox checked="indeterminate" label="Select all" />
758
790
  * <Checkbox label="Accept terms" labelPosition="right" />
791
+ * <Checkbox id="terms" label="Accept terms" separateLabel />
759
792
  * \`\`\`
760
793
  */
761
794
  export interface CheckboxProps
762
- extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onChange">,
795
+ extends Omit<React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, "onChange">,
763
796
  VariantProps<typeof checkboxVariants> {
764
- /** Whether the checkbox is checked, unchecked, or indeterminate */
765
- checked?: CheckedState
766
- /** Default checked state for uncontrolled usage */
767
- defaultChecked?: boolean
768
- /** Callback when checked state changes */
769
- onCheckedChange?: (checked: CheckedState) => void
770
797
  /** Optional label text */
771
798
  label?: string
772
799
  /** Position of the label */
773
800
  labelPosition?: "left" | "right"
801
+ /** Class name applied to the checkbox element */
802
+ checkboxClassName?: string
803
+ /** Class name applied to the label element */
804
+ labelClassName?: string
805
+ /** If true, uses separate labels with htmlFor/id association instead of wrapping the input. Requires id prop. */
806
+ separateLabel?: boolean
774
807
  }
775
808
 
776
- const Checkbox = React.forwardRef<HTMLButtonElement, CheckboxProps>(
809
+ const Checkbox = React.forwardRef<
810
+ React.ElementRef<typeof CheckboxPrimitive.Root>,
811
+ CheckboxProps
812
+ >(
777
813
  (
778
814
  {
779
815
  className,
780
816
  size,
781
- checked: controlledChecked,
782
- defaultChecked = false,
783
- onCheckedChange,
784
- disabled,
785
817
  label,
786
818
  labelPosition = "right",
787
- onClick,
819
+ checkboxClassName,
820
+ labelClassName,
821
+ separateLabel = false,
822
+ id,
823
+ disabled,
788
824
  ...props
789
825
  },
790
826
  ref
791
827
  ) => {
792
- const [internalChecked, setInternalChecked] = React.useState<CheckedState>(defaultChecked)
793
-
794
- const isControlled = controlledChecked !== undefined
795
- const checkedState = isControlled ? controlledChecked : internalChecked
796
-
797
- const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
798
- if (disabled) return
799
-
800
- // Cycle through states: unchecked -> checked -> unchecked
801
- // (indeterminate is typically set programmatically, not through user clicks)
802
- const newValue = checkedState === true ? false : true
803
-
804
- if (!isControlled) {
805
- setInternalChecked(newValue)
806
- }
807
-
808
- onCheckedChange?.(newValue)
809
-
810
- // Call external onClick if provided
811
- onClick?.(e)
812
- }
813
-
814
- const isChecked = checkedState === true
815
- const isIndeterminate = checkedState === "indeterminate"
816
-
817
828
  const checkbox = (
818
- <button
819
- type="button"
820
- role="checkbox"
821
- aria-checked={isIndeterminate ? "mixed" : isChecked}
829
+ <CheckboxPrimitive.Root
822
830
  ref={ref}
831
+ id={id}
823
832
  disabled={disabled}
824
- onClick={handleClick}
825
833
  className={cn(
826
- checkboxVariants({ size, className }),
834
+ checkboxVariants({ size }),
827
835
  "cursor-pointer",
828
- isChecked || isIndeterminate
829
- ? "bg-[#343E55] border-[#343E55] text-white"
830
- : "bg-white border-[#E5E7EB] hover:border-[#9CA3AF]"
836
+ className,
837
+ checkboxClassName
831
838
  )}
832
839
  {...props}
833
840
  >
834
- {isChecked && (
835
- <Check className={cn(iconSizeVariants({ size }), "stroke-[3]")} />
836
- )}
837
- {isIndeterminate && (
838
- <Minus className={cn(iconSizeVariants({ size }), "stroke-[3]")} />
839
- )}
840
- </button>
841
+ <CheckboxPrimitive.Indicator className="flex items-center justify-center">
842
+ {props.checked === "indeterminate" ? (
843
+ <Minus className={cn(iconSizeVariants({ size }), "stroke-[3]")} />
844
+ ) : (
845
+ <Check className={cn(iconSizeVariants({ size }), "stroke-[3]")} />
846
+ )}
847
+ </CheckboxPrimitive.Indicator>
848
+ </CheckboxPrimitive.Root>
841
849
  )
842
850
 
843
851
  if (label) {
852
+ // separateLabel mode: use htmlFor/id association instead of wrapping
853
+ if (separateLabel && id) {
854
+ return (
855
+ <div className="inline-flex items-center gap-2">
856
+ {labelPosition === "left" && (
857
+ <label
858
+ htmlFor={id}
859
+ className={cn(
860
+ labelSizeVariants({ size }),
861
+ "text-[#333333] cursor-pointer",
862
+ disabled && "opacity-50 cursor-not-allowed",
863
+ labelClassName
864
+ )}
865
+ >
866
+ {label}
867
+ </label>
868
+ )}
869
+ {checkbox}
870
+ {labelPosition === "right" && (
871
+ <label
872
+ htmlFor={id}
873
+ className={cn(
874
+ labelSizeVariants({ size }),
875
+ "text-[#333333] cursor-pointer",
876
+ disabled && "opacity-50 cursor-not-allowed",
877
+ labelClassName
878
+ )}
879
+ >
880
+ {label}
881
+ </label>
882
+ )}
883
+ </div>
884
+ )
885
+ }
886
+
887
+ // Default: wrapping label
844
888
  return (
845
- <label className="inline-flex items-center gap-2 cursor-pointer">
889
+ <label className={cn("inline-flex items-center gap-2 cursor-pointer", disabled && "cursor-not-allowed")}>
846
890
  {labelPosition === "left" && (
847
- <span className={cn(labelSizeVariants({ size }), "text-[#333333]", disabled && "opacity-50")}>
891
+ <span className={cn(labelSizeVariants({ size }), "text-[#333333]", disabled && "opacity-50", labelClassName)}>
848
892
  {label}
849
893
  </span>
850
894
  )}
851
895
  {checkbox}
852
896
  {labelPosition === "right" && (
853
- <span className={cn(labelSizeVariants({ size }), "text-[#333333]", disabled && "opacity-50")}>
897
+ <span className={cn(labelSizeVariants({ size }), "text-[#333333]", disabled && "opacity-50", labelClassName)}>
854
898
  {label}
855
899
  </span>
856
900
  )}
@@ -868,27 +912,29 @@ export { Checkbox, checkboxVariants }
868
912
  }
869
913
  ]
870
914
  },
871
- "toggle": {
872
- name: "toggle",
873
- description: "A toggle/switch component for boolean inputs with on/off states",
915
+ "switch": {
916
+ name: "switch",
917
+ description: "A switch/toggle component for boolean inputs with on/off states. Built on Radix UI Switch.",
874
918
  dependencies: [
919
+ "@radix-ui/react-switch",
875
920
  "class-variance-authority",
876
921
  "clsx",
877
922
  "tailwind-merge"
878
923
  ],
879
924
  files: [
880
925
  {
881
- name: "toggle.tsx",
926
+ name: "switch.tsx",
882
927
  content: prefixTailwindClasses(`import * as React from "react"
928
+ import * as SwitchPrimitives from "@radix-ui/react-switch"
883
929
  import { cva, type VariantProps } from "class-variance-authority"
884
930
 
885
931
  import { cn } from "../../lib/utils"
886
932
 
887
933
  /**
888
- * Toggle track variants (the outer container)
934
+ * Switch track variants (the outer container)
889
935
  */
890
- const toggleVariants = cva(
891
- "relative inline-flex shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#343E55] focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
936
+ const switchVariants = cva(
937
+ "peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#343E55] focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-[#343E55] data-[state=unchecked]:bg-[#E5E7EB]",
892
938
  {
893
939
  variants: {
894
940
  size: {
@@ -904,124 +950,107 @@ const toggleVariants = cva(
904
950
  )
905
951
 
906
952
  /**
907
- * Toggle thumb variants (the sliding circle)
953
+ * Switch thumb variants (the sliding circle)
908
954
  */
909
- const toggleThumbVariants = cva(
910
- "pointer-events-none inline-block rounded-full bg-white shadow-lg ring-0 transition-transform duration-200 ease-in-out",
955
+ const switchThumbVariants = cva(
956
+ "pointer-events-none block rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=unchecked]:translate-x-0",
911
957
  {
912
958
  variants: {
913
959
  size: {
914
- default: "h-5 w-5",
915
- sm: "h-4 w-4",
916
- lg: "h-6 w-6",
917
- },
918
- checked: {
919
- true: "",
920
- false: "translate-x-0",
960
+ default: "h-5 w-5 data-[state=checked]:translate-x-5",
961
+ sm: "h-4 w-4 data-[state=checked]:translate-x-4",
962
+ lg: "h-6 w-6 data-[state=checked]:translate-x-7",
921
963
  },
922
964
  },
923
- compoundVariants: [
924
- { size: "default", checked: true, className: "translate-x-5" },
925
- { size: "sm", checked: true, className: "translate-x-4" },
926
- { size: "lg", checked: true, className: "translate-x-7" },
927
- ],
928
965
  defaultVariants: {
929
966
  size: "default",
930
- checked: false,
931
967
  },
932
968
  }
933
969
  )
934
970
 
935
971
  /**
936
- * A toggle/switch component for boolean inputs with on/off states
972
+ * Label text size variants
973
+ */
974
+ const labelSizeVariants = cva("", {
975
+ variants: {
976
+ size: {
977
+ default: "text-sm",
978
+ sm: "text-xs",
979
+ lg: "text-base",
980
+ },
981
+ },
982
+ defaultVariants: {
983
+ size: "default",
984
+ },
985
+ })
986
+
987
+ /**
988
+ * A switch/toggle component for boolean inputs with on/off states
937
989
  *
938
990
  * @example
939
991
  * \`\`\`tsx
940
- * <Toggle checked={isEnabled} onCheckedChange={setIsEnabled} />
941
- * <Toggle size="sm" disabled />
942
- * <Toggle size="lg" checked label="Enable notifications" />
992
+ * <Switch checked={isEnabled} onCheckedChange={setIsEnabled} />
993
+ * <Switch size="sm" disabled />
994
+ * <Switch size="lg" checked label="Enable notifications" />
943
995
  * \`\`\`
944
996
  */
945
- export interface ToggleProps
946
- extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onChange">,
947
- VariantProps<typeof toggleVariants> {
948
- /** Whether the toggle is checked/on */
949
- checked?: boolean
950
- /** Default checked state for uncontrolled usage */
951
- defaultChecked?: boolean
952
- /** Callback when checked state changes */
953
- onCheckedChange?: (checked: boolean) => void
997
+ export interface SwitchProps
998
+ extends Omit<React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>, "onChange">,
999
+ VariantProps<typeof switchVariants> {
954
1000
  /** Optional label text */
955
1001
  label?: string
956
1002
  /** Position of the label */
957
1003
  labelPosition?: "left" | "right"
958
1004
  }
959
1005
 
960
- const Toggle = React.forwardRef<HTMLButtonElement, ToggleProps>(
1006
+ const Switch = React.forwardRef<
1007
+ React.ElementRef<typeof SwitchPrimitives.Root>,
1008
+ SwitchProps
1009
+ >(
961
1010
  (
962
1011
  {
963
1012
  className,
964
1013
  size,
965
- checked: controlledChecked,
966
- defaultChecked = false,
967
- onCheckedChange,
968
- disabled,
969
1014
  label,
970
1015
  labelPosition = "right",
1016
+ disabled,
971
1017
  ...props
972
1018
  },
973
1019
  ref
974
1020
  ) => {
975
- const [internalChecked, setInternalChecked] = React.useState(defaultChecked)
976
-
977
- const isControlled = controlledChecked !== undefined
978
- const isChecked = isControlled ? controlledChecked : internalChecked
979
-
980
- const handleClick = () => {
981
- if (disabled) return
982
-
983
- const newValue = !isChecked
984
-
985
- if (!isControlled) {
986
- setInternalChecked(newValue)
987
- }
988
-
989
- onCheckedChange?.(newValue)
990
- }
991
-
992
- const toggle = (
993
- <button
994
- type="button"
995
- role="switch"
996
- aria-checked={isChecked}
997
- ref={ref}
1021
+ const switchElement = (
1022
+ <SwitchPrimitives.Root
1023
+ className={cn(switchVariants({ size, className }))}
998
1024
  disabled={disabled}
999
- onClick={handleClick}
1000
- className={cn(
1001
- toggleVariants({ size, className }),
1002
- isChecked ? "bg-[#343E55]" : "bg-[#E5E7EB]"
1003
- )}
1025
+ ref={ref}
1004
1026
  {...props}
1005
1027
  >
1006
- <span
1007
- className={cn(
1008
- toggleThumbVariants({ size, checked: isChecked })
1009
- )}
1010
- />
1011
- </button>
1028
+ <SwitchPrimitives.Thumb className={cn(switchThumbVariants({ size }))} />
1029
+ </SwitchPrimitives.Root>
1012
1030
  )
1013
1031
 
1014
1032
  if (label) {
1015
1033
  return (
1016
- <label className="inline-flex items-center gap-2 cursor-pointer">
1034
+ <label className={cn(
1035
+ "inline-flex items-center gap-2 cursor-pointer",
1036
+ disabled && "cursor-not-allowed"
1037
+ )}>
1017
1038
  {labelPosition === "left" && (
1018
- <span className={cn("text-sm text-[#333333]", disabled && "opacity-50")}>
1039
+ <span className={cn(
1040
+ labelSizeVariants({ size }),
1041
+ "text-[#333333]",
1042
+ disabled && "opacity-50"
1043
+ )}>
1019
1044
  {label}
1020
1045
  </span>
1021
1046
  )}
1022
- {toggle}
1047
+ {switchElement}
1023
1048
  {labelPosition === "right" && (
1024
- <span className={cn("text-sm text-[#333333]", disabled && "opacity-50")}>
1049
+ <span className={cn(
1050
+ labelSizeVariants({ size }),
1051
+ "text-[#333333]",
1052
+ disabled && "opacity-50"
1053
+ )}>
1025
1054
  {label}
1026
1055
  </span>
1027
1056
  )}
@@ -1029,12 +1058,12 @@ const Toggle = React.forwardRef<HTMLButtonElement, ToggleProps>(
1029
1058
  )
1030
1059
  }
1031
1060
 
1032
- return toggle
1061
+ return switchElement
1033
1062
  }
1034
1063
  )
1035
- Toggle.displayName = "Toggle"
1064
+ Switch.displayName = "Switch"
1036
1065
 
1037
- export { Toggle, toggleVariants }
1066
+ export { Switch, switchVariants }
1038
1067
  `, prefix)
1039
1068
  }
1040
1069
  ]
@@ -1942,7 +1971,7 @@ const MultiSelect = React.forwardRef<HTMLButtonElement, MultiSelectProps>(
1942
1971
  const isSelected = selectedValues.includes(option.value)
1943
1972
  const isDisabled =
1944
1973
  option.disabled ||
1945
- (!isSelected && maxSelections && selectedValues.length >= maxSelections)
1974
+ (!isSelected && maxSelections !== undefined && maxSelections > 0 && selectedValues.length >= maxSelections)
1946
1975
 
1947
1976
  return (
1948
1977
  <button
@@ -2023,7 +2052,7 @@ export { MultiSelect, multiSelectTriggerVariants }
2023
2052
  import { cva, type VariantProps } from "class-variance-authority"
2024
2053
 
2025
2054
  import { cn } from "../../lib/utils"
2026
- import { Toggle, type ToggleProps } from "./toggle"
2055
+ import { Switch, type SwitchProps } from "./switch"
2027
2056
 
2028
2057
  /**
2029
2058
  * Table size variants for row height.
@@ -2287,16 +2316,16 @@ const TableAvatar = ({ initials, color = "#7C3AED" }: TableAvatarProps) => (
2287
2316
  TableAvatar.displayName = "TableAvatar"
2288
2317
 
2289
2318
  /**
2290
- * Toggle component optimized for table cells
2319
+ * Switch component optimized for table cells (previously TableToggle)
2291
2320
  */
2292
- export interface TableToggleProps extends Omit<ToggleProps, 'size'> {
2293
- /** Size of the toggle - defaults to 'sm' for tables */
2321
+ export interface TableToggleProps extends Omit<SwitchProps, 'size'> {
2322
+ /** Size of the switch - defaults to 'sm' for tables */
2294
2323
  size?: 'sm' | 'default'
2295
2324
  }
2296
2325
 
2297
2326
  const TableToggle = React.forwardRef<HTMLButtonElement, TableToggleProps>(
2298
2327
  ({ size = 'sm', ...props }, ref) => (
2299
- <Toggle ref={ref} size={size} {...props} />
2328
+ <Switch ref={ref} size={size} {...props} />
2300
2329
  )
2301
2330
  )
2302
2331
  TableToggle.displayName = "TableToggle"
@@ -2686,9 +2715,9 @@ export { Tag, TagGroup, tagVariants }
2686
2715
  }
2687
2716
  ]
2688
2717
  },
2689
- "collapsible": {
2690
- name: "collapsible",
2691
- description: "An expandable/collapsible section component with single or multiple mode support",
2718
+ "accordion": {
2719
+ name: "accordion",
2720
+ description: "An expandable/collapsible accordion component with single or multiple mode support",
2692
2721
  dependencies: [
2693
2722
  "class-variance-authority",
2694
2723
  "clsx",
@@ -2697,7 +2726,7 @@ export { Tag, TagGroup, tagVariants }
2697
2726
  ],
2698
2727
  files: [
2699
2728
  {
2700
- name: "collapsible.tsx",
2729
+ name: "accordion.tsx",
2701
2730
  content: prefixTailwindClasses(`import * as React from "react"
2702
2731
  import { cva, type VariantProps } from "class-variance-authority"
2703
2732
  import { ChevronDown } from "lucide-react"
@@ -2705,9 +2734,9 @@ import { ChevronDown } from "lucide-react"
2705
2734
  import { cn } from "../../lib/utils"
2706
2735
 
2707
2736
  /**
2708
- * Collapsible root variants
2737
+ * Accordion root variants
2709
2738
  */
2710
- const collapsibleVariants = cva("w-full", {
2739
+ const accordionVariants = cva("w-full", {
2711
2740
  variants: {
2712
2741
  variant: {
2713
2742
  default: "",
@@ -2720,9 +2749,9 @@ const collapsibleVariants = cva("w-full", {
2720
2749
  })
2721
2750
 
2722
2751
  /**
2723
- * Collapsible item variants
2752
+ * Accordion item variants
2724
2753
  */
2725
- const collapsibleItemVariants = cva("", {
2754
+ const accordionItemVariants = cva("", {
2726
2755
  variants: {
2727
2756
  variant: {
2728
2757
  default: "",
@@ -2735,9 +2764,9 @@ const collapsibleItemVariants = cva("", {
2735
2764
  })
2736
2765
 
2737
2766
  /**
2738
- * Collapsible trigger variants
2767
+ * Accordion trigger variants
2739
2768
  */
2740
- const collapsibleTriggerVariants = cva(
2769
+ const accordionTriggerVariants = cva(
2741
2770
  "flex w-full items-center justify-between text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#343E55] focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
2742
2771
  {
2743
2772
  variants: {
@@ -2753,9 +2782,9 @@ const collapsibleTriggerVariants = cva(
2753
2782
  )
2754
2783
 
2755
2784
  /**
2756
- * Collapsible content variants
2785
+ * Accordion content variants
2757
2786
  */
2758
- const collapsibleContentVariants = cva(
2787
+ const accordionContentVariants = cva(
2759
2788
  "overflow-hidden transition-all duration-300 ease-in-out",
2760
2789
  {
2761
2790
  variants: {
@@ -2771,49 +2800,49 @@ const collapsibleContentVariants = cva(
2771
2800
  )
2772
2801
 
2773
2802
  // Types
2774
- type CollapsibleType = "single" | "multiple"
2803
+ type AccordionType = "single" | "multiple"
2775
2804
 
2776
- interface CollapsibleContextValue {
2777
- type: CollapsibleType
2805
+ interface AccordionContextValue {
2806
+ type: AccordionType
2778
2807
  value: string[]
2779
2808
  onValueChange: (value: string[]) => void
2780
2809
  variant: "default" | "bordered"
2781
2810
  }
2782
2811
 
2783
- interface CollapsibleItemContextValue {
2812
+ interface AccordionItemContextValue {
2784
2813
  value: string
2785
2814
  isOpen: boolean
2786
2815
  disabled?: boolean
2787
2816
  }
2788
2817
 
2789
2818
  // Contexts
2790
- const CollapsibleContext = React.createContext<CollapsibleContextValue | null>(null)
2791
- const CollapsibleItemContext = React.createContext<CollapsibleItemContextValue | null>(null)
2819
+ const AccordionContext = React.createContext<AccordionContextValue | null>(null)
2820
+ const AccordionItemContext = React.createContext<AccordionItemContextValue | null>(null)
2792
2821
 
2793
- function useCollapsibleContext() {
2794
- const context = React.useContext(CollapsibleContext)
2822
+ function useAccordionContext() {
2823
+ const context = React.useContext(AccordionContext)
2795
2824
  if (!context) {
2796
- throw new Error("Collapsible components must be used within a Collapsible")
2825
+ throw new Error("Accordion components must be used within an Accordion")
2797
2826
  }
2798
2827
  return context
2799
2828
  }
2800
2829
 
2801
- function useCollapsibleItemContext() {
2802
- const context = React.useContext(CollapsibleItemContext)
2830
+ function useAccordionItemContext() {
2831
+ const context = React.useContext(AccordionItemContext)
2803
2832
  if (!context) {
2804
- throw new Error("CollapsibleTrigger/CollapsibleContent must be used within a CollapsibleItem")
2833
+ throw new Error("AccordionTrigger/AccordionContent must be used within an AccordionItem")
2805
2834
  }
2806
2835
  return context
2807
2836
  }
2808
2837
 
2809
2838
  /**
2810
- * Root collapsible component that manages state
2839
+ * Root accordion component that manages state
2811
2840
  */
2812
- export interface CollapsibleProps
2841
+ export interface AccordionProps
2813
2842
  extends React.HTMLAttributes<HTMLDivElement>,
2814
- VariantProps<typeof collapsibleVariants> {
2843
+ VariantProps<typeof accordionVariants> {
2815
2844
  /** Whether only one item can be open at a time ('single') or multiple ('multiple') */
2816
- type?: CollapsibleType
2845
+ type?: AccordionType
2817
2846
  /** Controlled value - array of open item values */
2818
2847
  value?: string[]
2819
2848
  /** Default open items for uncontrolled usage */
@@ -2822,7 +2851,7 @@ export interface CollapsibleProps
2822
2851
  onValueChange?: (value: string[]) => void
2823
2852
  }
2824
2853
 
2825
- const Collapsible = React.forwardRef<HTMLDivElement, CollapsibleProps>(
2854
+ const Accordion = React.forwardRef<HTMLDivElement, AccordionProps>(
2826
2855
  (
2827
2856
  {
2828
2857
  className,
@@ -2862,35 +2891,35 @@ const Collapsible = React.forwardRef<HTMLDivElement, CollapsibleProps>(
2862
2891
  )
2863
2892
 
2864
2893
  return (
2865
- <CollapsibleContext.Provider value={contextValue}>
2894
+ <AccordionContext.Provider value={contextValue}>
2866
2895
  <div
2867
2896
  ref={ref}
2868
- className={cn(collapsibleVariants({ variant, className }))}
2897
+ className={cn(accordionVariants({ variant, className }))}
2869
2898
  {...props}
2870
2899
  >
2871
2900
  {children}
2872
2901
  </div>
2873
- </CollapsibleContext.Provider>
2902
+ </AccordionContext.Provider>
2874
2903
  )
2875
2904
  }
2876
2905
  )
2877
- Collapsible.displayName = "Collapsible"
2906
+ Accordion.displayName = "Accordion"
2878
2907
 
2879
2908
  /**
2880
- * Individual collapsible item
2909
+ * Individual accordion item
2881
2910
  */
2882
- export interface CollapsibleItemProps
2911
+ export interface AccordionItemProps
2883
2912
  extends React.HTMLAttributes<HTMLDivElement>,
2884
- VariantProps<typeof collapsibleItemVariants> {
2913
+ VariantProps<typeof accordionItemVariants> {
2885
2914
  /** Unique value for this item */
2886
2915
  value: string
2887
2916
  /** Whether this item is disabled */
2888
2917
  disabled?: boolean
2889
2918
  }
2890
2919
 
2891
- const CollapsibleItem = React.forwardRef<HTMLDivElement, CollapsibleItemProps>(
2920
+ const AccordionItem = React.forwardRef<HTMLDivElement, AccordionItemProps>(
2892
2921
  ({ className, value, disabled, children, ...props }, ref) => {
2893
- const { value: openValues, variant } = useCollapsibleContext()
2922
+ const { value: openValues, variant } = useAccordionContext()
2894
2923
  const isOpen = openValues.includes(value)
2895
2924
 
2896
2925
  const contextValue = React.useMemo(
@@ -2903,35 +2932,35 @@ const CollapsibleItem = React.forwardRef<HTMLDivElement, CollapsibleItemProps>(
2903
2932
  )
2904
2933
 
2905
2934
  return (
2906
- <CollapsibleItemContext.Provider value={contextValue}>
2935
+ <AccordionItemContext.Provider value={contextValue}>
2907
2936
  <div
2908
2937
  ref={ref}
2909
2938
  data-state={isOpen ? "open" : "closed"}
2910
- className={cn(collapsibleItemVariants({ variant, className }))}
2939
+ className={cn(accordionItemVariants({ variant, className }))}
2911
2940
  {...props}
2912
2941
  >
2913
2942
  {children}
2914
2943
  </div>
2915
- </CollapsibleItemContext.Provider>
2944
+ </AccordionItemContext.Provider>
2916
2945
  )
2917
2946
  }
2918
2947
  )
2919
- CollapsibleItem.displayName = "CollapsibleItem"
2948
+ AccordionItem.displayName = "AccordionItem"
2920
2949
 
2921
2950
  /**
2922
- * Trigger button that toggles the collapsible item
2951
+ * Trigger button that toggles the accordion item
2923
2952
  */
2924
- export interface CollapsibleTriggerProps
2953
+ export interface AccordionTriggerProps
2925
2954
  extends React.ButtonHTMLAttributes<HTMLButtonElement>,
2926
- VariantProps<typeof collapsibleTriggerVariants> {
2955
+ VariantProps<typeof accordionTriggerVariants> {
2927
2956
  /** Whether to show the chevron icon */
2928
2957
  showChevron?: boolean
2929
2958
  }
2930
2959
 
2931
- const CollapsibleTrigger = React.forwardRef<HTMLButtonElement, CollapsibleTriggerProps>(
2960
+ const AccordionTrigger = React.forwardRef<HTMLButtonElement, AccordionTriggerProps>(
2932
2961
  ({ className, showChevron = true, children, ...props }, ref) => {
2933
- const { type, value: openValues, onValueChange, variant } = useCollapsibleContext()
2934
- const { value, isOpen, disabled } = useCollapsibleItemContext()
2962
+ const { type, value: openValues, onValueChange, variant } = useAccordionContext()
2963
+ const { value, isOpen, disabled } = useAccordionItemContext()
2935
2964
 
2936
2965
  const handleClick = () => {
2937
2966
  if (disabled) return
@@ -2958,7 +2987,7 @@ const CollapsibleTrigger = React.forwardRef<HTMLButtonElement, CollapsibleTrigge
2958
2987
  aria-expanded={isOpen}
2959
2988
  disabled={disabled}
2960
2989
  onClick={handleClick}
2961
- className={cn(collapsibleTriggerVariants({ variant, className }))}
2990
+ className={cn(accordionTriggerVariants({ variant, className }))}
2962
2991
  {...props}
2963
2992
  >
2964
2993
  <span className="flex-1">{children}</span>
@@ -2974,19 +3003,19 @@ const CollapsibleTrigger = React.forwardRef<HTMLButtonElement, CollapsibleTrigge
2974
3003
  )
2975
3004
  }
2976
3005
  )
2977
- CollapsibleTrigger.displayName = "CollapsibleTrigger"
3006
+ AccordionTrigger.displayName = "AccordionTrigger"
2978
3007
 
2979
3008
  /**
2980
3009
  * Content that is shown/hidden when the item is toggled
2981
3010
  */
2982
- export interface CollapsibleContentProps
3011
+ export interface AccordionContentProps
2983
3012
  extends React.HTMLAttributes<HTMLDivElement>,
2984
- VariantProps<typeof collapsibleContentVariants> {}
3013
+ VariantProps<typeof accordionContentVariants> {}
2985
3014
 
2986
- const CollapsibleContent = React.forwardRef<HTMLDivElement, CollapsibleContentProps>(
3015
+ const AccordionContent = React.forwardRef<HTMLDivElement, AccordionContentProps>(
2987
3016
  ({ className, children, ...props }, ref) => {
2988
- const { variant } = useCollapsibleContext()
2989
- const { isOpen } = useCollapsibleItemContext()
3017
+ const { variant } = useAccordionContext()
3018
+ const { isOpen } = useAccordionItemContext()
2990
3019
  const contentRef = React.useRef<HTMLDivElement>(null)
2991
3020
  const [height, setHeight] = React.useState<number | undefined>(undefined)
2992
3021
 
@@ -3000,7 +3029,7 @@ const CollapsibleContent = React.forwardRef<HTMLDivElement, CollapsibleContentPr
3000
3029
  return (
3001
3030
  <div
3002
3031
  ref={ref}
3003
- className={cn(collapsibleContentVariants({ variant, className }))}
3032
+ className={cn(accordionContentVariants({ variant, className }))}
3004
3033
  style={{ height: height !== undefined ? \`\${height}px\` : undefined }}
3005
3034
  aria-hidden={!isOpen}
3006
3035
  {...props}
@@ -3012,17 +3041,17 @@ const CollapsibleContent = React.forwardRef<HTMLDivElement, CollapsibleContentPr
3012
3041
  )
3013
3042
  }
3014
3043
  )
3015
- CollapsibleContent.displayName = "CollapsibleContent"
3044
+ AccordionContent.displayName = "AccordionContent"
3016
3045
 
3017
3046
  export {
3018
- Collapsible,
3019
- CollapsibleItem,
3020
- CollapsibleTrigger,
3021
- CollapsibleContent,
3022
- collapsibleVariants,
3023
- collapsibleItemVariants,
3024
- collapsibleTriggerVariants,
3025
- collapsibleContentVariants,
3047
+ Accordion,
3048
+ AccordionItem,
3049
+ AccordionTrigger,
3050
+ AccordionContent,
3051
+ accordionVariants,
3052
+ accordionItemVariants,
3053
+ accordionTriggerVariants,
3054
+ accordionContentVariants,
3026
3055
  }
3027
3056
  `, prefix)
3028
3057
  }
@@ -3037,7 +3066,7 @@ export {
3037
3066
  ],
3038
3067
  internalDependencies: [
3039
3068
  "checkbox",
3040
- "collapsible"
3069
+ "accordion"
3041
3070
  ],
3042
3071
  isMultiFile: true,
3043
3072
  directory: "event-selector",
@@ -3235,16 +3264,16 @@ EventSelector.displayName = "EventSelector"
3235
3264
  import { cn } from "../../../lib/utils"
3236
3265
  import { Checkbox, type CheckedState } from "../checkbox"
3237
3266
  import {
3238
- Collapsible,
3239
- CollapsibleItem,
3240
- CollapsibleTrigger,
3241
- CollapsibleContent,
3242
- } from "../collapsible"
3267
+ Accordion,
3268
+ AccordionItem,
3269
+ AccordionTrigger,
3270
+ AccordionContent,
3271
+ } from "../accordion"
3243
3272
  import { EventItemComponent } from "./event-item"
3244
3273
  import type { EventGroupComponentProps } from "./types"
3245
3274
 
3246
3275
  /**
3247
- * Event group with collapsible section and group-level checkbox
3276
+ * Event group with accordion section and group-level checkbox
3248
3277
  */
3249
3278
  export const EventGroupComponent = React.forwardRef<
3250
3279
  HTMLDivElement,
@@ -3311,9 +3340,9 @@ export const EventGroupComponent = React.forwardRef<
3311
3340
  className={cn("bg-[#F9FAFB] rounded-lg", className)}
3312
3341
  {...props}
3313
3342
  >
3314
- <Collapsible type="multiple">
3315
- <CollapsibleItem value={group.id}>
3316
- <CollapsibleTrigger
3343
+ <Accordion type="multiple">
3344
+ <AccordionItem value={group.id}>
3345
+ <AccordionTrigger
3317
3346
  showChevron={true}
3318
3347
  className="w-full p-4 hover:bg-[#F3F4F6] rounded-lg"
3319
3348
  >
@@ -3343,8 +3372,8 @@ export const EventGroupComponent = React.forwardRef<
3343
3372
  </span>
3344
3373
  )}
3345
3374
  </div>
3346
- </CollapsibleTrigger>
3347
- <CollapsibleContent>
3375
+ </AccordionTrigger>
3376
+ <AccordionContent>
3348
3377
  <div className="border-t border-[#E5E7EB]">
3349
3378
  {events.length > 0 ? (
3350
3379
  events.map((event) => (
@@ -3367,9 +3396,9 @@ export const EventGroupComponent = React.forwardRef<
3367
3396
  </div>
3368
3397
  )}
3369
3398
  </div>
3370
- </CollapsibleContent>
3371
- </CollapsibleItem>
3372
- </Collapsible>
3399
+ </AccordionContent>
3400
+ </AccordionItem>
3401
+ </Accordion>
3373
3402
  </div>
3374
3403
  )
3375
3404
  }
@@ -3854,9 +3883,7 @@ KeyValueRow.displayName = "KeyValueRow"
3854
3883
  },
3855
3884
  {
3856
3885
  name: "types.ts",
3857
- content: prefixTailwindClasses(`import * as React from "react"
3858
-
3859
- /**
3886
+ content: prefixTailwindClasses(`/**
3860
3887
  * Represents a single key-value pair
3861
3888
  */
3862
3889
  export interface KeyValuePair {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myoperator-ui",
3
- "version": "0.0.70",
3
+ "version": "0.0.72",
4
4
  "description": "CLI for adding myOperator UI components to your project",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",