myoperator-ui 0.0.71 → 0.0.73

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 (3) hide show
  1. package/README.md +5 -5
  2. package/dist/index.js +209 -262
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -143,19 +143,19 @@ npx myoperator-ui update --help
143
143
 
144
144
  | Component | Description |
145
145
  |-----------|-------------|
146
- | `badge` | Status badge with active, failed, and disabled variants |
147
- | `button` | Customizable button with variants, sizes, icons, and loading state |
148
- | `checkbox` | Tri-state checkbox component with label support (checked, unchecked, indeterminate) |
149
- | `collapsible` | Expandable/collapsible section component with single or multiple mode support |
146
+ | `accordion` | Expandable/collapsible accordion component with single or multiple mode support |
147
+ | `badge` | Status badge with active, failed, disabled, outline, secondary, destructive variants and asChild support |
148
+ | `button` | Customizable button with variants, sizes (including icon-lg), icons, and loading state |
149
+ | `checkbox` | Tri-state checkbox built on Radix UI with label support (checked, unchecked, indeterminate) |
150
150
  | `dropdown-menu` | Dropdown menu for displaying actions and options |
151
151
  | `input` | Basic input component |
152
152
  | `multi-select` | Multi-select dropdown with search, tags, and keyboard navigation |
153
153
  | `select` | Single select dropdown component |
154
154
  | `select-field` | Select field with label, helper text, and validation states |
155
+ | `switch` | Switch component built on Radix UI for boolean inputs with on/off states |
155
156
  | `table` | Composable table with size variants, loading/empty states, sticky columns |
156
157
  | `tag` | Tag component for event labels with optional bold label prefix |
157
158
  | `text-field` | Text input with label, icons, prefix/suffix, validation states, and character count |
158
- | `toggle` | Toggle/switch component for boolean inputs with on/off states |
159
159
 
160
160
  ## Configuration
161
161
 
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
@@ -760,128 +792,60 @@ export type CheckedState = boolean | "indeterminate"
760
792
  * \`\`\`
761
793
  */
762
794
  export interface CheckboxProps
763
- extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onChange">,
795
+ extends Omit<React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, "onChange">,
764
796
  VariantProps<typeof checkboxVariants> {
765
- /** Whether the checkbox is checked, unchecked, or indeterminate */
766
- checked?: CheckedState
767
- /** Default checked state for uncontrolled usage */
768
- defaultChecked?: boolean
769
- /** Callback when checked state changes */
770
- onCheckedChange?: (checked: CheckedState) => void
771
797
  /** Optional label text */
772
798
  label?: string
773
799
  /** Position of the label */
774
800
  labelPosition?: "left" | "right"
775
- /** The label of the checkbox for accessibility */
776
- ariaLabel?: string
777
- /** The ID of an element describing the checkbox */
778
- ariaLabelledBy?: string
779
- /** If true, the checkbox automatically receives focus */
780
- autoFocus?: boolean
781
801
  /** Class name applied to the checkbox element */
782
802
  checkboxClassName?: string
783
803
  /** Class name applied to the label element */
784
804
  labelClassName?: string
785
- /** The name of the checkbox, used for form submission */
786
- name?: string
787
- /** The value submitted with the form when checked */
788
- value?: string
789
805
  /** If true, uses separate labels with htmlFor/id association instead of wrapping the input. Requires id prop. */
790
806
  separateLabel?: boolean
791
807
  }
792
808
 
793
- const Checkbox = React.forwardRef<HTMLButtonElement, CheckboxProps>(
809
+ const Checkbox = React.forwardRef<
810
+ React.ElementRef<typeof CheckboxPrimitive.Root>,
811
+ CheckboxProps
812
+ >(
794
813
  (
795
814
  {
796
815
  className,
797
816
  size,
798
- checked: controlledChecked,
799
- defaultChecked = false,
800
- onCheckedChange,
801
- disabled,
802
817
  label,
803
818
  labelPosition = "right",
804
- ariaLabel,
805
- ariaLabelledBy,
806
- autoFocus,
807
819
  checkboxClassName,
808
820
  labelClassName,
809
- name,
810
- value,
811
821
  separateLabel = false,
812
822
  id,
813
- onClick,
823
+ disabled,
814
824
  ...props
815
825
  },
816
826
  ref
817
827
  ) => {
818
- const [internalChecked, setInternalChecked] = React.useState<CheckedState>(defaultChecked)
819
- const checkboxRef = React.useRef<HTMLButtonElement>(null)
820
-
821
- // Merge refs
822
- React.useImperativeHandle(ref, () => checkboxRef.current!)
823
-
824
- // Handle autoFocus
825
- React.useEffect(() => {
826
- if (autoFocus && checkboxRef.current) {
827
- checkboxRef.current.focus()
828
- }
829
- }, [autoFocus])
830
-
831
- const isControlled = controlledChecked !== undefined
832
- const checkedState = isControlled ? controlledChecked : internalChecked
833
-
834
- const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
835
- if (disabled) return
836
-
837
- // Cycle through states: unchecked -> checked -> unchecked
838
- // (indeterminate is typically set programmatically, not through user clicks)
839
- const newValue = checkedState === true ? false : true
840
-
841
- if (!isControlled) {
842
- setInternalChecked(newValue)
843
- }
844
-
845
- onCheckedChange?.(newValue)
846
-
847
- // Call external onClick if provided
848
- onClick?.(e)
849
- }
850
-
851
- const isChecked = checkedState === true
852
- const isIndeterminate = checkedState === "indeterminate"
853
-
854
828
  const checkbox = (
855
- <button
856
- type="button"
857
- role="checkbox"
858
- aria-checked={isIndeterminate ? "mixed" : isChecked}
859
- aria-label={ariaLabel}
860
- aria-labelledby={ariaLabelledBy}
861
- ref={checkboxRef}
829
+ <CheckboxPrimitive.Root
830
+ ref={ref}
862
831
  id={id}
863
832
  disabled={disabled}
864
- onClick={handleClick}
865
- data-name={name}
866
- data-value={value}
867
833
  className={cn(
868
834
  checkboxVariants({ size }),
869
835
  "cursor-pointer",
870
- isChecked || isIndeterminate
871
- ? "bg-[#343E55] border-[#343E55] text-white"
872
- : "bg-white border-[#E5E7EB] hover:border-[#9CA3AF]",
873
836
  className,
874
837
  checkboxClassName
875
838
  )}
876
839
  {...props}
877
840
  >
878
- {isChecked && (
879
- <Check className={cn(iconSizeVariants({ size }), "stroke-[3]")} />
880
- )}
881
- {isIndeterminate && (
882
- <Minus className={cn(iconSizeVariants({ size }), "stroke-[3]")} />
883
- )}
884
- </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>
885
849
  )
886
850
 
887
851
  if (label) {
@@ -948,27 +912,29 @@ export { Checkbox, checkboxVariants }
948
912
  }
949
913
  ]
950
914
  },
951
- "toggle": {
952
- name: "toggle",
953
- 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.",
954
918
  dependencies: [
919
+ "@radix-ui/react-switch",
955
920
  "class-variance-authority",
956
921
  "clsx",
957
922
  "tailwind-merge"
958
923
  ],
959
924
  files: [
960
925
  {
961
- name: "toggle.tsx",
926
+ name: "switch.tsx",
962
927
  content: prefixTailwindClasses(`import * as React from "react"
928
+ import * as SwitchPrimitives from "@radix-ui/react-switch"
963
929
  import { cva, type VariantProps } from "class-variance-authority"
964
930
 
965
931
  import { cn } from "../../lib/utils"
966
932
 
967
933
  /**
968
- * Toggle track variants (the outer container)
934
+ * Switch track variants (the outer container)
969
935
  */
970
- const toggleVariants = cva(
971
- "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]",
972
938
  {
973
939
  variants: {
974
940
  size: {
@@ -984,124 +950,107 @@ const toggleVariants = cva(
984
950
  )
985
951
 
986
952
  /**
987
- * Toggle thumb variants (the sliding circle)
953
+ * Switch thumb variants (the sliding circle)
988
954
  */
989
- const toggleThumbVariants = cva(
990
- "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",
991
957
  {
992
958
  variants: {
993
959
  size: {
994
- default: "h-5 w-5",
995
- sm: "h-4 w-4",
996
- lg: "h-6 w-6",
997
- },
998
- checked: {
999
- true: "",
1000
- 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",
1001
963
  },
1002
964
  },
1003
- compoundVariants: [
1004
- { size: "default", checked: true, className: "translate-x-5" },
1005
- { size: "sm", checked: true, className: "translate-x-4" },
1006
- { size: "lg", checked: true, className: "translate-x-7" },
1007
- ],
1008
965
  defaultVariants: {
1009
966
  size: "default",
1010
- checked: false,
1011
967
  },
1012
968
  }
1013
969
  )
1014
970
 
1015
971
  /**
1016
- * 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
1017
989
  *
1018
990
  * @example
1019
991
  * \`\`\`tsx
1020
- * <Toggle checked={isEnabled} onCheckedChange={setIsEnabled} />
1021
- * <Toggle size="sm" disabled />
1022
- * <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" />
1023
995
  * \`\`\`
1024
996
  */
1025
- export interface ToggleProps
1026
- extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onChange">,
1027
- VariantProps<typeof toggleVariants> {
1028
- /** Whether the toggle is checked/on */
1029
- checked?: boolean
1030
- /** Default checked state for uncontrolled usage */
1031
- defaultChecked?: boolean
1032
- /** Callback when checked state changes */
1033
- onCheckedChange?: (checked: boolean) => void
997
+ export interface SwitchProps
998
+ extends Omit<React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>, "onChange">,
999
+ VariantProps<typeof switchVariants> {
1034
1000
  /** Optional label text */
1035
1001
  label?: string
1036
1002
  /** Position of the label */
1037
1003
  labelPosition?: "left" | "right"
1038
1004
  }
1039
1005
 
1040
- const Toggle = React.forwardRef<HTMLButtonElement, ToggleProps>(
1006
+ const Switch = React.forwardRef<
1007
+ React.ElementRef<typeof SwitchPrimitives.Root>,
1008
+ SwitchProps
1009
+ >(
1041
1010
  (
1042
1011
  {
1043
1012
  className,
1044
1013
  size,
1045
- checked: controlledChecked,
1046
- defaultChecked = false,
1047
- onCheckedChange,
1048
- disabled,
1049
1014
  label,
1050
1015
  labelPosition = "right",
1016
+ disabled,
1051
1017
  ...props
1052
1018
  },
1053
1019
  ref
1054
1020
  ) => {
1055
- const [internalChecked, setInternalChecked] = React.useState(defaultChecked)
1056
-
1057
- const isControlled = controlledChecked !== undefined
1058
- const isChecked = isControlled ? controlledChecked : internalChecked
1059
-
1060
- const handleClick = () => {
1061
- if (disabled) return
1062
-
1063
- const newValue = !isChecked
1064
-
1065
- if (!isControlled) {
1066
- setInternalChecked(newValue)
1067
- }
1068
-
1069
- onCheckedChange?.(newValue)
1070
- }
1071
-
1072
- const toggle = (
1073
- <button
1074
- type="button"
1075
- role="switch"
1076
- aria-checked={isChecked}
1077
- ref={ref}
1021
+ const switchElement = (
1022
+ <SwitchPrimitives.Root
1023
+ className={cn(switchVariants({ size, className }))}
1078
1024
  disabled={disabled}
1079
- onClick={handleClick}
1080
- className={cn(
1081
- toggleVariants({ size, className }),
1082
- isChecked ? "bg-[#343E55]" : "bg-[#E5E7EB]"
1083
- )}
1025
+ ref={ref}
1084
1026
  {...props}
1085
1027
  >
1086
- <span
1087
- className={cn(
1088
- toggleThumbVariants({ size, checked: isChecked })
1089
- )}
1090
- />
1091
- </button>
1028
+ <SwitchPrimitives.Thumb className={cn(switchThumbVariants({ size }))} />
1029
+ </SwitchPrimitives.Root>
1092
1030
  )
1093
1031
 
1094
1032
  if (label) {
1095
1033
  return (
1096
- <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
+ )}>
1097
1038
  {labelPosition === "left" && (
1098
- <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
+ )}>
1099
1044
  {label}
1100
1045
  </span>
1101
1046
  )}
1102
- {toggle}
1047
+ {switchElement}
1103
1048
  {labelPosition === "right" && (
1104
- <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
+ )}>
1105
1054
  {label}
1106
1055
  </span>
1107
1056
  )}
@@ -1109,12 +1058,12 @@ const Toggle = React.forwardRef<HTMLButtonElement, ToggleProps>(
1109
1058
  )
1110
1059
  }
1111
1060
 
1112
- return toggle
1061
+ return switchElement
1113
1062
  }
1114
1063
  )
1115
- Toggle.displayName = "Toggle"
1064
+ Switch.displayName = "Switch"
1116
1065
 
1117
- export { Toggle, toggleVariants }
1066
+ export { Switch, switchVariants }
1118
1067
  `, prefix)
1119
1068
  }
1120
1069
  ]
@@ -2022,7 +1971,7 @@ const MultiSelect = React.forwardRef<HTMLButtonElement, MultiSelectProps>(
2022
1971
  const isSelected = selectedValues.includes(option.value)
2023
1972
  const isDisabled =
2024
1973
  option.disabled ||
2025
- (!isSelected && maxSelections && selectedValues.length >= maxSelections)
1974
+ (!isSelected && maxSelections !== undefined && maxSelections > 0 && selectedValues.length >= maxSelections)
2026
1975
 
2027
1976
  return (
2028
1977
  <button
@@ -2103,7 +2052,7 @@ export { MultiSelect, multiSelectTriggerVariants }
2103
2052
  import { cva, type VariantProps } from "class-variance-authority"
2104
2053
 
2105
2054
  import { cn } from "../../lib/utils"
2106
- import { Toggle, type ToggleProps } from "./toggle"
2055
+ import { Switch, type SwitchProps } from "./switch"
2107
2056
 
2108
2057
  /**
2109
2058
  * Table size variants for row height.
@@ -2367,16 +2316,16 @@ const TableAvatar = ({ initials, color = "#7C3AED" }: TableAvatarProps) => (
2367
2316
  TableAvatar.displayName = "TableAvatar"
2368
2317
 
2369
2318
  /**
2370
- * Toggle component optimized for table cells
2319
+ * Switch component optimized for table cells (previously TableToggle)
2371
2320
  */
2372
- export interface TableToggleProps extends Omit<ToggleProps, 'size'> {
2373
- /** 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 */
2374
2323
  size?: 'sm' | 'default'
2375
2324
  }
2376
2325
 
2377
2326
  const TableToggle = React.forwardRef<HTMLButtonElement, TableToggleProps>(
2378
2327
  ({ size = 'sm', ...props }, ref) => (
2379
- <Toggle ref={ref} size={size} {...props} />
2328
+ <Switch ref={ref} size={size} {...props} />
2380
2329
  )
2381
2330
  )
2382
2331
  TableToggle.displayName = "TableToggle"
@@ -2766,9 +2715,9 @@ export { Tag, TagGroup, tagVariants }
2766
2715
  }
2767
2716
  ]
2768
2717
  },
2769
- "collapsible": {
2770
- name: "collapsible",
2771
- 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",
2772
2721
  dependencies: [
2773
2722
  "class-variance-authority",
2774
2723
  "clsx",
@@ -2777,7 +2726,7 @@ export { Tag, TagGroup, tagVariants }
2777
2726
  ],
2778
2727
  files: [
2779
2728
  {
2780
- name: "collapsible.tsx",
2729
+ name: "accordion.tsx",
2781
2730
  content: prefixTailwindClasses(`import * as React from "react"
2782
2731
  import { cva, type VariantProps } from "class-variance-authority"
2783
2732
  import { ChevronDown } from "lucide-react"
@@ -2785,9 +2734,9 @@ import { ChevronDown } from "lucide-react"
2785
2734
  import { cn } from "../../lib/utils"
2786
2735
 
2787
2736
  /**
2788
- * Collapsible root variants
2737
+ * Accordion root variants
2789
2738
  */
2790
- const collapsibleVariants = cva("w-full", {
2739
+ const accordionVariants = cva("w-full", {
2791
2740
  variants: {
2792
2741
  variant: {
2793
2742
  default: "",
@@ -2800,9 +2749,9 @@ const collapsibleVariants = cva("w-full", {
2800
2749
  })
2801
2750
 
2802
2751
  /**
2803
- * Collapsible item variants
2752
+ * Accordion item variants
2804
2753
  */
2805
- const collapsibleItemVariants = cva("", {
2754
+ const accordionItemVariants = cva("", {
2806
2755
  variants: {
2807
2756
  variant: {
2808
2757
  default: "",
@@ -2815,9 +2764,9 @@ const collapsibleItemVariants = cva("", {
2815
2764
  })
2816
2765
 
2817
2766
  /**
2818
- * Collapsible trigger variants
2767
+ * Accordion trigger variants
2819
2768
  */
2820
- const collapsibleTriggerVariants = cva(
2769
+ const accordionTriggerVariants = cva(
2821
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",
2822
2771
  {
2823
2772
  variants: {
@@ -2833,9 +2782,9 @@ const collapsibleTriggerVariants = cva(
2833
2782
  )
2834
2783
 
2835
2784
  /**
2836
- * Collapsible content variants
2785
+ * Accordion content variants
2837
2786
  */
2838
- const collapsibleContentVariants = cva(
2787
+ const accordionContentVariants = cva(
2839
2788
  "overflow-hidden transition-all duration-300 ease-in-out",
2840
2789
  {
2841
2790
  variants: {
@@ -2851,49 +2800,49 @@ const collapsibleContentVariants = cva(
2851
2800
  )
2852
2801
 
2853
2802
  // Types
2854
- type CollapsibleType = "single" | "multiple"
2803
+ type AccordionType = "single" | "multiple"
2855
2804
 
2856
- interface CollapsibleContextValue {
2857
- type: CollapsibleType
2805
+ interface AccordionContextValue {
2806
+ type: AccordionType
2858
2807
  value: string[]
2859
2808
  onValueChange: (value: string[]) => void
2860
2809
  variant: "default" | "bordered"
2861
2810
  }
2862
2811
 
2863
- interface CollapsibleItemContextValue {
2812
+ interface AccordionItemContextValue {
2864
2813
  value: string
2865
2814
  isOpen: boolean
2866
2815
  disabled?: boolean
2867
2816
  }
2868
2817
 
2869
2818
  // Contexts
2870
- const CollapsibleContext = React.createContext<CollapsibleContextValue | null>(null)
2871
- const CollapsibleItemContext = React.createContext<CollapsibleItemContextValue | null>(null)
2819
+ const AccordionContext = React.createContext<AccordionContextValue | null>(null)
2820
+ const AccordionItemContext = React.createContext<AccordionItemContextValue | null>(null)
2872
2821
 
2873
- function useCollapsibleContext() {
2874
- const context = React.useContext(CollapsibleContext)
2822
+ function useAccordionContext() {
2823
+ const context = React.useContext(AccordionContext)
2875
2824
  if (!context) {
2876
- throw new Error("Collapsible components must be used within a Collapsible")
2825
+ throw new Error("Accordion components must be used within an Accordion")
2877
2826
  }
2878
2827
  return context
2879
2828
  }
2880
2829
 
2881
- function useCollapsibleItemContext() {
2882
- const context = React.useContext(CollapsibleItemContext)
2830
+ function useAccordionItemContext() {
2831
+ const context = React.useContext(AccordionItemContext)
2883
2832
  if (!context) {
2884
- throw new Error("CollapsibleTrigger/CollapsibleContent must be used within a CollapsibleItem")
2833
+ throw new Error("AccordionTrigger/AccordionContent must be used within an AccordionItem")
2885
2834
  }
2886
2835
  return context
2887
2836
  }
2888
2837
 
2889
2838
  /**
2890
- * Root collapsible component that manages state
2839
+ * Root accordion component that manages state
2891
2840
  */
2892
- export interface CollapsibleProps
2841
+ export interface AccordionProps
2893
2842
  extends React.HTMLAttributes<HTMLDivElement>,
2894
- VariantProps<typeof collapsibleVariants> {
2843
+ VariantProps<typeof accordionVariants> {
2895
2844
  /** Whether only one item can be open at a time ('single') or multiple ('multiple') */
2896
- type?: CollapsibleType
2845
+ type?: AccordionType
2897
2846
  /** Controlled value - array of open item values */
2898
2847
  value?: string[]
2899
2848
  /** Default open items for uncontrolled usage */
@@ -2902,7 +2851,7 @@ export interface CollapsibleProps
2902
2851
  onValueChange?: (value: string[]) => void
2903
2852
  }
2904
2853
 
2905
- const Collapsible = React.forwardRef<HTMLDivElement, CollapsibleProps>(
2854
+ const Accordion = React.forwardRef<HTMLDivElement, AccordionProps>(
2906
2855
  (
2907
2856
  {
2908
2857
  className,
@@ -2942,35 +2891,35 @@ const Collapsible = React.forwardRef<HTMLDivElement, CollapsibleProps>(
2942
2891
  )
2943
2892
 
2944
2893
  return (
2945
- <CollapsibleContext.Provider value={contextValue}>
2894
+ <AccordionContext.Provider value={contextValue}>
2946
2895
  <div
2947
2896
  ref={ref}
2948
- className={cn(collapsibleVariants({ variant, className }))}
2897
+ className={cn(accordionVariants({ variant, className }))}
2949
2898
  {...props}
2950
2899
  >
2951
2900
  {children}
2952
2901
  </div>
2953
- </CollapsibleContext.Provider>
2902
+ </AccordionContext.Provider>
2954
2903
  )
2955
2904
  }
2956
2905
  )
2957
- Collapsible.displayName = "Collapsible"
2906
+ Accordion.displayName = "Accordion"
2958
2907
 
2959
2908
  /**
2960
- * Individual collapsible item
2909
+ * Individual accordion item
2961
2910
  */
2962
- export interface CollapsibleItemProps
2911
+ export interface AccordionItemProps
2963
2912
  extends React.HTMLAttributes<HTMLDivElement>,
2964
- VariantProps<typeof collapsibleItemVariants> {
2913
+ VariantProps<typeof accordionItemVariants> {
2965
2914
  /** Unique value for this item */
2966
2915
  value: string
2967
2916
  /** Whether this item is disabled */
2968
2917
  disabled?: boolean
2969
2918
  }
2970
2919
 
2971
- const CollapsibleItem = React.forwardRef<HTMLDivElement, CollapsibleItemProps>(
2920
+ const AccordionItem = React.forwardRef<HTMLDivElement, AccordionItemProps>(
2972
2921
  ({ className, value, disabled, children, ...props }, ref) => {
2973
- const { value: openValues, variant } = useCollapsibleContext()
2922
+ const { value: openValues, variant } = useAccordionContext()
2974
2923
  const isOpen = openValues.includes(value)
2975
2924
 
2976
2925
  const contextValue = React.useMemo(
@@ -2983,35 +2932,35 @@ const CollapsibleItem = React.forwardRef<HTMLDivElement, CollapsibleItemProps>(
2983
2932
  )
2984
2933
 
2985
2934
  return (
2986
- <CollapsibleItemContext.Provider value={contextValue}>
2935
+ <AccordionItemContext.Provider value={contextValue}>
2987
2936
  <div
2988
2937
  ref={ref}
2989
2938
  data-state={isOpen ? "open" : "closed"}
2990
- className={cn(collapsibleItemVariants({ variant, className }))}
2939
+ className={cn(accordionItemVariants({ variant, className }))}
2991
2940
  {...props}
2992
2941
  >
2993
2942
  {children}
2994
2943
  </div>
2995
- </CollapsibleItemContext.Provider>
2944
+ </AccordionItemContext.Provider>
2996
2945
  )
2997
2946
  }
2998
2947
  )
2999
- CollapsibleItem.displayName = "CollapsibleItem"
2948
+ AccordionItem.displayName = "AccordionItem"
3000
2949
 
3001
2950
  /**
3002
- * Trigger button that toggles the collapsible item
2951
+ * Trigger button that toggles the accordion item
3003
2952
  */
3004
- export interface CollapsibleTriggerProps
2953
+ export interface AccordionTriggerProps
3005
2954
  extends React.ButtonHTMLAttributes<HTMLButtonElement>,
3006
- VariantProps<typeof collapsibleTriggerVariants> {
2955
+ VariantProps<typeof accordionTriggerVariants> {
3007
2956
  /** Whether to show the chevron icon */
3008
2957
  showChevron?: boolean
3009
2958
  }
3010
2959
 
3011
- const CollapsibleTrigger = React.forwardRef<HTMLButtonElement, CollapsibleTriggerProps>(
2960
+ const AccordionTrigger = React.forwardRef<HTMLButtonElement, AccordionTriggerProps>(
3012
2961
  ({ className, showChevron = true, children, ...props }, ref) => {
3013
- const { type, value: openValues, onValueChange, variant } = useCollapsibleContext()
3014
- const { value, isOpen, disabled } = useCollapsibleItemContext()
2962
+ const { type, value: openValues, onValueChange, variant } = useAccordionContext()
2963
+ const { value, isOpen, disabled } = useAccordionItemContext()
3015
2964
 
3016
2965
  const handleClick = () => {
3017
2966
  if (disabled) return
@@ -3038,7 +2987,7 @@ const CollapsibleTrigger = React.forwardRef<HTMLButtonElement, CollapsibleTrigge
3038
2987
  aria-expanded={isOpen}
3039
2988
  disabled={disabled}
3040
2989
  onClick={handleClick}
3041
- className={cn(collapsibleTriggerVariants({ variant, className }))}
2990
+ className={cn(accordionTriggerVariants({ variant, className }))}
3042
2991
  {...props}
3043
2992
  >
3044
2993
  <span className="flex-1">{children}</span>
@@ -3054,19 +3003,19 @@ const CollapsibleTrigger = React.forwardRef<HTMLButtonElement, CollapsibleTrigge
3054
3003
  )
3055
3004
  }
3056
3005
  )
3057
- CollapsibleTrigger.displayName = "CollapsibleTrigger"
3006
+ AccordionTrigger.displayName = "AccordionTrigger"
3058
3007
 
3059
3008
  /**
3060
3009
  * Content that is shown/hidden when the item is toggled
3061
3010
  */
3062
- export interface CollapsibleContentProps
3011
+ export interface AccordionContentProps
3063
3012
  extends React.HTMLAttributes<HTMLDivElement>,
3064
- VariantProps<typeof collapsibleContentVariants> {}
3013
+ VariantProps<typeof accordionContentVariants> {}
3065
3014
 
3066
- const CollapsibleContent = React.forwardRef<HTMLDivElement, CollapsibleContentProps>(
3015
+ const AccordionContent = React.forwardRef<HTMLDivElement, AccordionContentProps>(
3067
3016
  ({ className, children, ...props }, ref) => {
3068
- const { variant } = useCollapsibleContext()
3069
- const { isOpen } = useCollapsibleItemContext()
3017
+ const { variant } = useAccordionContext()
3018
+ const { isOpen } = useAccordionItemContext()
3070
3019
  const contentRef = React.useRef<HTMLDivElement>(null)
3071
3020
  const [height, setHeight] = React.useState<number | undefined>(undefined)
3072
3021
 
@@ -3080,7 +3029,7 @@ const CollapsibleContent = React.forwardRef<HTMLDivElement, CollapsibleContentPr
3080
3029
  return (
3081
3030
  <div
3082
3031
  ref={ref}
3083
- className={cn(collapsibleContentVariants({ variant, className }))}
3032
+ className={cn(accordionContentVariants({ variant, className }))}
3084
3033
  style={{ height: height !== undefined ? \`\${height}px\` : undefined }}
3085
3034
  aria-hidden={!isOpen}
3086
3035
  {...props}
@@ -3092,17 +3041,17 @@ const CollapsibleContent = React.forwardRef<HTMLDivElement, CollapsibleContentPr
3092
3041
  )
3093
3042
  }
3094
3043
  )
3095
- CollapsibleContent.displayName = "CollapsibleContent"
3044
+ AccordionContent.displayName = "AccordionContent"
3096
3045
 
3097
3046
  export {
3098
- Collapsible,
3099
- CollapsibleItem,
3100
- CollapsibleTrigger,
3101
- CollapsibleContent,
3102
- collapsibleVariants,
3103
- collapsibleItemVariants,
3104
- collapsibleTriggerVariants,
3105
- collapsibleContentVariants,
3047
+ Accordion,
3048
+ AccordionItem,
3049
+ AccordionTrigger,
3050
+ AccordionContent,
3051
+ accordionVariants,
3052
+ accordionItemVariants,
3053
+ accordionTriggerVariants,
3054
+ accordionContentVariants,
3106
3055
  }
3107
3056
  `, prefix)
3108
3057
  }
@@ -3117,7 +3066,7 @@ export {
3117
3066
  ],
3118
3067
  internalDependencies: [
3119
3068
  "checkbox",
3120
- "collapsible"
3069
+ "accordion"
3121
3070
  ],
3122
3071
  isMultiFile: true,
3123
3072
  directory: "event-selector",
@@ -3315,16 +3264,16 @@ EventSelector.displayName = "EventSelector"
3315
3264
  import { cn } from "../../../lib/utils"
3316
3265
  import { Checkbox, type CheckedState } from "../checkbox"
3317
3266
  import {
3318
- Collapsible,
3319
- CollapsibleItem,
3320
- CollapsibleTrigger,
3321
- CollapsibleContent,
3322
- } from "../collapsible"
3267
+ Accordion,
3268
+ AccordionItem,
3269
+ AccordionTrigger,
3270
+ AccordionContent,
3271
+ } from "../accordion"
3323
3272
  import { EventItemComponent } from "./event-item"
3324
3273
  import type { EventGroupComponentProps } from "./types"
3325
3274
 
3326
3275
  /**
3327
- * Event group with collapsible section and group-level checkbox
3276
+ * Event group with accordion section and group-level checkbox
3328
3277
  */
3329
3278
  export const EventGroupComponent = React.forwardRef<
3330
3279
  HTMLDivElement,
@@ -3391,9 +3340,9 @@ export const EventGroupComponent = React.forwardRef<
3391
3340
  className={cn("bg-[#F9FAFB] rounded-lg", className)}
3392
3341
  {...props}
3393
3342
  >
3394
- <Collapsible type="multiple">
3395
- <CollapsibleItem value={group.id}>
3396
- <CollapsibleTrigger
3343
+ <Accordion type="multiple">
3344
+ <AccordionItem value={group.id}>
3345
+ <AccordionTrigger
3397
3346
  showChevron={true}
3398
3347
  className="w-full p-4 hover:bg-[#F3F4F6] rounded-lg"
3399
3348
  >
@@ -3423,8 +3372,8 @@ export const EventGroupComponent = React.forwardRef<
3423
3372
  </span>
3424
3373
  )}
3425
3374
  </div>
3426
- </CollapsibleTrigger>
3427
- <CollapsibleContent>
3375
+ </AccordionTrigger>
3376
+ <AccordionContent>
3428
3377
  <div className="border-t border-[#E5E7EB]">
3429
3378
  {events.length > 0 ? (
3430
3379
  events.map((event) => (
@@ -3447,9 +3396,9 @@ export const EventGroupComponent = React.forwardRef<
3447
3396
  </div>
3448
3397
  )}
3449
3398
  </div>
3450
- </CollapsibleContent>
3451
- </CollapsibleItem>
3452
- </Collapsible>
3399
+ </AccordionContent>
3400
+ </AccordionItem>
3401
+ </Accordion>
3453
3402
  </div>
3454
3403
  )
3455
3404
  }
@@ -3934,9 +3883,7 @@ KeyValueRow.displayName = "KeyValueRow"
3934
3883
  },
3935
3884
  {
3936
3885
  name: "types.ts",
3937
- content: prefixTailwindClasses(`import * as React from "react"
3938
-
3939
- /**
3886
+ content: prefixTailwindClasses(`/**
3940
3887
  * Represents a single key-value pair
3941
3888
  */
3942
3889
  export interface KeyValuePair {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myoperator-ui",
3
- "version": "0.0.71",
3
+ "version": "0.0.73",
4
4
  "description": "CLI for adding myOperator UI components to your project",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",