@beemafrica/ui 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beemafrica/ui",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Shared Beem UI components built on shadcn/Radix",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,8 +1,7 @@
1
- import * as React from "react"
1
+ import { cn } from "@beemafrica/ui/lib/utils"
2
2
  import { cva, type VariantProps } from "class-variance-authority"
3
3
  import { Slot } from "radix-ui"
4
-
5
- import { cn } from "@beemafrica/ui/lib/utils"
4
+ import type * as React from "react"
6
5
 
7
6
  const badgeVariants = cva(
8
7
  "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
@@ -1,9 +1,5 @@
1
1
  "use client"
2
2
 
3
- import * as React from "react"
4
- import { Command as CommandPrimitive } from "cmdk"
5
-
6
- import { cn } from "@beemafrica/ui/lib/utils"
7
3
  import {
8
4
  Dialog,
9
5
  DialogContent,
@@ -15,7 +11,11 @@ import {
15
11
  InputGroup,
16
12
  InputGroupAddon,
17
13
  } from "@beemafrica/ui/components/input-group"
18
- import { SearchIcon, CheckIcon } from "lucide-react"
14
+
15
+ import { cn } from "@beemafrica/ui/lib/utils"
16
+ import { Command as CommandPrimitive } from "cmdk"
17
+ import { CheckIcon, SearchIcon } from "lucide-react"
18
+ import type * as React from "react"
19
19
 
20
20
  function Command({
21
21
  className,
@@ -185,11 +185,11 @@ function CommandShortcut({
185
185
  export {
186
186
  Command,
187
187
  CommandDialog,
188
- CommandInput,
189
- CommandList,
190
188
  CommandEmpty,
191
189
  CommandGroup,
190
+ CommandInput,
192
191
  CommandItem,
193
- CommandShortcut,
192
+ CommandList,
194
193
  CommandSeparator,
194
+ CommandShortcut,
195
195
  }
@@ -1,12 +1,11 @@
1
1
  "use client"
2
2
 
3
- import * as React from "react"
4
- import { cva, type VariantProps } from "class-variance-authority"
5
-
6
- import { cn } from "@beemafrica/ui/lib/utils"
7
3
  import { Button } from "@beemafrica/ui/components/button"
8
4
  import { Input } from "@beemafrica/ui/components/input"
9
5
  import { Textarea } from "@beemafrica/ui/components/textarea"
6
+ import { cn } from "@beemafrica/ui/lib/utils"
7
+ import { cva, type VariantProps } from "class-variance-authority"
8
+ import type * as React from "react"
10
9
 
11
10
  function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
12
11
  return (
@@ -150,7 +149,7 @@ export {
150
149
  InputGroup,
151
150
  InputGroupAddon,
152
151
  InputGroupButton,
153
- InputGroupText,
154
152
  InputGroupInput,
153
+ InputGroupText,
155
154
  InputGroupTextarea,
156
155
  }
@@ -1,9 +1,8 @@
1
1
  "use client"
2
2
 
3
- import * as React from "react"
4
- import { RadioGroup as RadioGroupPrimitive } from "radix-ui"
5
-
6
3
  import { cn } from "@beemafrica/ui/lib/utils"
4
+ import { RadioGroup as RadioGroupPrimitive } from "radix-ui"
5
+ import type * as React from "react"
7
6
 
8
7
  function RadioGroup({
9
8
  className,
@@ -0,0 +1,33 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Switch as SwitchPrimitive } from "radix-ui"
5
+
6
+ import { cn } from "@beemafrica/ui/lib/utils"
7
+
8
+ function Switch({
9
+ className,
10
+ size = "default",
11
+ ...props
12
+ }: React.ComponentProps<typeof SwitchPrimitive.Root> & {
13
+ size?: "sm" | "default"
14
+ }) {
15
+ return (
16
+ <SwitchPrimitive.Root
17
+ data-slot="switch"
18
+ data-size={size}
19
+ className={cn(
20
+ "peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",
21
+ className
22
+ )}
23
+ {...props}
24
+ >
25
+ <SwitchPrimitive.Thumb
26
+ data-slot="switch-thumb"
27
+ className="pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] rtl:group-data-[size=default]/switch:data-checked:-translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] rtl:group-data-[size=sm]/switch:data-checked:-translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 rtl:group-data-[size=default]/switch:data-unchecked:-translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 rtl:group-data-[size=sm]/switch:data-unchecked:-translate-x-0 dark:data-unchecked:bg-foreground"
28
+ />
29
+ </SwitchPrimitive.Root>
30
+ )
31
+ }
32
+
33
+ export { Switch }
@@ -1,3 +1,5 @@
1
+ "use client"
2
+
1
3
  import { Avatar, AvatarFallback } from "@beemafrica/ui/components/avatar"
2
4
  import { Button } from "@beemafrica/ui/components/button"
3
5
  import {
@@ -6,20 +8,20 @@ import {
6
8
  CollapsibleTrigger,
7
9
  } from "@beemafrica/ui/components/collapsible"
8
10
  import { cn } from "@beemafrica/ui/lib/utils"
9
- import { ChevronRightIcon } from "lucide-react"
11
+ import { ChevronRightIcon, ExternalLink } from "lucide-react"
10
12
 
11
13
  interface History {
12
14
  label: string
13
15
  value: string
14
16
  }
15
17
  interface TicketProps {
16
- key: number
17
18
  user_initial?: string
18
19
  user_name?: string
19
20
  message?: string
20
21
  time?: string
21
22
  type?: string
22
23
  history?: History[]
24
+ click: () => void
23
25
  }
24
26
 
25
27
  function Ticket({
@@ -29,6 +31,7 @@ function Ticket({
29
31
  message,
30
32
  time,
31
33
  history,
34
+ click,
32
35
  }: TicketProps) {
33
36
  let avatar_background = ""
34
37
  let container_background = ""
@@ -72,42 +75,45 @@ function Ticket({
72
75
  className={cn(
73
76
  container_background,
74
77
  border,
75
- "py-[14px] px-[16px] rounded-[12px] border shadow-sm flex flex-col gap-3"
78
+ "py-[14px] px-[16px] rounded-[12px] border shadow-sm flex flex-col gap-3 cursor-pointer"
76
79
  )}
77
80
  >
78
- <div className="flex flex-row items-center justify-between">
79
- <div className="flex flex-row gap-1.5 items-center">
80
- <Avatar
81
- className={cn(
82
- avatar_background,
83
- "inline-flex size-[30px] select-none items-center justify-center overflow-hidden rounded-full align-middle"
84
- )}
85
- >
86
- <AvatarFallback
81
+ <button type="button" onClick={click} className="w-full text-left">
82
+ <div className="flex flex-row items-center justify-between">
83
+ <div className="flex flex-row gap-1.5 items-center">
84
+ <Avatar
87
85
  className={cn(
88
86
  avatar_background,
89
- "leading-1 flex size-full items-center justify-center text-[12px] text-white font-semibold"
87
+ "inline-flex size-[30px] select-none items-center justify-center overflow-hidden rounded-full align-middle"
90
88
  )}
91
- delayMs={600}
92
89
  >
93
- <p>{user_initial ?? "N/A"}</p>
94
- </AvatarFallback>
95
- </Avatar>
90
+ <AvatarFallback
91
+ className={cn(
92
+ avatar_background,
93
+ "leading-1 flex size-full items-center justify-center text-[12px] text-white font-semibold"
94
+ )}
95
+ delayMs={600}
96
+ >
97
+ <p>{user_initial ?? "N/A"}</p>
98
+ </AvatarFallback>
99
+ </Avatar>
96
100
 
97
- {user_name && <p className="font-bold text-black">{user_name}</p>}
98
- <p
99
- className={cn(
100
- pill_background,
101
- pill_text_color,
102
- "py-[3px] px-[10px] rounded-[9999px] text-xs"
103
- )}
104
- >
105
- {ticket_type}
106
- </p>
107
- </div>
101
+ {user_name && <p className="font-bold text-black">{user_name}</p>}
102
+ <p
103
+ className={cn(
104
+ pill_background,
105
+ pill_text_color,
106
+ "py-[3px] px-[10px] rounded-[9999px] text-xs"
107
+ )}
108
+ >
109
+ {ticket_type}
110
+ </p>
111
+ <ExternalLink size="12px" className="text-[#6B7B8D]" />
112
+ </div>
108
113
 
109
- {time && <p className="text-[#98A9B8] text-[11.5px]">{time} </p>}
110
- </div>
114
+ {time && <p className="text-[#98A9B8] text-[11.5px]">{time} </p>}
115
+ </div>
116
+ </button>
111
117
 
112
118
  {message && <p className="leading-snug">{message}</p>}
113
119
  {history && history.length > 0 && (