Skip to content

Commit cbf381d

Browse files
committed
[skip ci] repo-sync
1 parent 7be37ac commit cbf381d

File tree

103 files changed

+8824
-1781
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+8824
-1781
lines changed

.eslintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rules": {
3+
"react/prop-types": "off"
4+
}
5+
}

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
node_modules
2-
.DS_Store
1+
node_modules/
2+
lib/
3+
yarn-error.log

index.ts

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ export {
1414
AlertDialogAction,
1515
AlertDialogCancel,
1616
} from "./src/AlertDialog"
17+
export * from "./src/Add"
18+
export { AutoGrid, type AutoGridProps } from "./src/AutoGrid"
1719
export { Avatar, AvatarImage, AvatarFallback } from "./src/Avatar"
18-
export { Button } from "./src/Button"
20+
export { Button, getButtonClasses } from "./src/Button"
1921
export type { ButtonProps } from "./src/Button"
2022
export { Checkbox } from "./src/Checkbox"
2123
export { Chip } from "./src/Chip"
22-
export { Collapsible, CollapsibleTrigger, CollapsibleContent } from "./src/Collapsible"
2324

2425
export {
2526
Dialog,
@@ -52,22 +53,15 @@ export {
5253
} from "./src/DropdownMenu"
5354
export { HoverCard, HoverCardTrigger, HoverCardContent } from "./src/HoverCard"
5455
export { IconButton } from "./src/IconButton"
55-
export { Input } from "./src/Input"
56+
export { Input, type InputProps } from "./src/Input"
5657
export { Label } from "./src/Label"
5758
export { Popover, PopoverContent, PopoverRoot, PopoverTrigger, PopoverPortal } from "./src/Popover"
58-
export { Progress } from "./src/Progress"
59-
export { RadioGroup, RadioGroupItem } from "./src/RadioGroup"
59+
export { RichTooltip, type RichTooltipProps, type RichTooltipAction } from "./src/RichTooltip"
60+
export { Progress, ProgressVariant } from "./src/Progress"
61+
export { RadioGroup, RadioGroupItem, LabeledRadioGroupItem } from "./src/RadioGroup"
6062
export { ScrollArea, ScrollBar } from "./src/ScrollArea"
61-
export {
62-
Select,
63-
SelectGroup,
64-
SelectValue,
65-
SelectTrigger,
66-
SelectContent,
67-
SelectLabel,
68-
SelectItem,
69-
SelectSeparator,
70-
} from "./src/Select"
63+
export * from "./src/Select"
64+
export * from "./src/Autocomplete"
7165
export { Separator } from "./src/Separator"
7266
export { Slider } from "./src/Slider"
7367
export { Switch } from "./src/Switch"
@@ -81,10 +75,16 @@ export {
8175
TableCell,
8276
TableCaption,
8377
} from "./src/Table"
84-
export { Tabs, TabsList, TabsTrigger, TabsContent } from "./src/Tabs"
78+
export * from "./src/Tabs"
8579
export { Toggle } from "./src/Toggle"
8680
export { ToggleGroup, ToggleGroupItem } from "./src/ToggleGroup"
87-
81+
export {
82+
ModalDialog,
83+
type ModalProps,
84+
type ModalDialogInstance,
85+
type ModalAction,
86+
type SecondaryModalAction,
87+
} from "./src/ModalDialog"
8888
export { DropdownButton } from "./src/DropdownButton"
8989
export {
9090
Tooltip,
@@ -94,9 +94,14 @@ export {
9494
TooltipRoot,
9595
TooltipPortal,
9696
} from "./src/Tooltip"
97-
export { DataTable, DataTableRowContext } from "./src/DataTable"
97+
export { Count, type CountProps, CountSize, CountTheme } from "./src/Count"
98+
export * from "./src/DataTable"
9899
export { FixedText } from "./src/FixedText"
99100
export { Slot } from "@radix-ui/react-slot"
100101
export * from "./src/index"
101-
export { Select as EnchangedSelect, SelectVariant } from "./src/Select/Select"
102102
export { CodeExample } from "./src/CodeExample"
103+
export { SegmentedToggle, type SegmentedToggleProps, type SegmentItem } from "./src/SegmentedToggle"
104+
export * from "./src/DataTable/components"
105+
export * from "./src/SkeletonWrapper"
106+
export { Loading } from "./src/Loading"
107+
export * from "./src/Toast"

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
"main": "index.ts",
66
"peerDependencies": {
77
"@loft-enterprise/client": "0.1.0",
8-
"@loft-enterprise/icons": "*",
9-
"framer-motion": "9.0.1",
108
"tailwindcss": "3.4.0"
119
},
1210
"dependencies": {
@@ -37,6 +35,9 @@
3735
"@radix-ui/react-toggle-group": "1.0.4",
3836
"@radix-ui/react-toolbar": "1.0.4",
3937
"@radix-ui/react-tooltip": "1.0.7",
40-
"react-select": "^5.8.0"
38+
"focus-trap-react": "11.0.4",
39+
"framer-motion": "9.0.1",
40+
"react-day-picker": "9.3.0",
41+
"recharts": "2.13.3"
4142
}
4243
}

src/Accordion.tsx

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,42 @@
1+
import DownOutlined from "@ant-design/icons/DownOutlined"
12
import * as AccordionPrimitive from "@radix-ui/react-accordion"
23
import * as React from "react"
34

45
import cn from "../clsx"
5-
import { DownOutlined } from "@loft-enterprise/icons"
66

77
const Accordion = AccordionPrimitive.Root
88

99
const AccordionItem = React.forwardRef<
1010
React.ElementRef<typeof AccordionPrimitive.Item>,
1111
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
1212
>(({ className, ...props }, ref) => (
13-
<AccordionPrimitive.Item ref={ref} className={className} {...props} />
13+
<AccordionPrimitive.Item ref={ref} className={cn("group/accordion", className)} {...props} />
1414
))
1515
AccordionItem.displayName = "AccordionItem"
1616

17+
type TAccordionTriggerProps = React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> & {
18+
customTrigger?: React.ReactNode
19+
}
20+
1721
const AccordionTrigger = React.forwardRef<
1822
React.ElementRef<typeof AccordionPrimitive.Trigger>,
19-
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
20-
>(({ className, children, ...props }, ref) => (
21-
<AccordionPrimitive.Header>
22-
<AccordionPrimitive.Trigger
23-
ref={ref}
24-
className={cn(
25-
"group/accordion flex cursor-pointer items-center justify-between bg-transparent p-2 transition-all [&[aria-expanded=true]>svg]:rotate-180",
26-
className
27-
)}
28-
{...props}>
29-
{children}
23+
TAccordionTriggerProps
24+
>(({ className, children, customTrigger, ...props }, ref) => (
25+
<AccordionPrimitive.Trigger
26+
ref={ref}
27+
className={cn(
28+
"group/accordion flex cursor-pointer items-center justify-between bg-transparent p-2 transition-all [&[aria-expanded=true]>svg]:rotate-180",
29+
className
30+
)}
31+
{...props}>
32+
{children}
33+
{customTrigger ?? (
3034
<DownOutlined
3135
className="transition-transform
32-
duration-200 ease-in-out *:size-3 group-aria-[expanded=true]/accordion:rotate-180"
36+
duration-200 ease-in-out *:size-3 group-aria-[expanded=true]/accordion:rotate-180"
3337
/>
34-
</AccordionPrimitive.Trigger>
35-
</AccordionPrimitive.Header>
38+
)}
39+
</AccordionPrimitive.Trigger>
3640
))
3741
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
3842

@@ -42,7 +46,7 @@ const AccordionContent = React.forwardRef<
4246
>(({ className, children, ...props }, ref) => (
4347
<AccordionPrimitive.Content
4448
ref={ref}
45-
className="overflow-hidden transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
49+
className="w-full overflow-hidden transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
4650
{...props}>
4751
<div className={cn("", className)}>{children}</div>
4852
</AccordionPrimitive.Content>

src/Add.tsx

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import cn from "clsx"
2+
import React from "react"
3+
4+
import { PlusOutlined } from "@loft-enterprise/icons"
5+
6+
export type AddProps = {
7+
label: React.ReactNode
8+
icon?: React.ReactNode
9+
className?: string
10+
disabled?: boolean
11+
onAddRequested?: () => void
12+
}
13+
14+
export function Add({ label, icon, onAddRequested, disabled, className }: AddProps) {
15+
return (
16+
<div
17+
role="button"
18+
onClick={(e) => {
19+
e.stopPropagation()
20+
21+
if (!onAddRequested || disabled) {
22+
return
23+
}
24+
25+
onAddRequested()
26+
}}
27+
aria-disabled={disabled}
28+
tabIndex={0}
29+
onKeyDown={(e) => {
30+
e.stopPropagation()
31+
32+
if (!onAddRequested || disabled) {
33+
return
34+
}
35+
36+
if (e.key === "Enter" || e.key === " ") {
37+
e.preventDefault()
38+
onAddRequested()
39+
}
40+
}}
41+
className={cn(
42+
"flex w-full cursor-pointer flex-row items-center rounded-md",
43+
"justify-center border border-divider-main p-2.5 text-primaryColor-main",
44+
"select-none gap-1 text-xs font-semibold focus-visible:outline",
45+
{ "!cursor-default !border-divider-light !text-neutral-main": disabled },
46+
className
47+
)}>
48+
{icon || <PlusOutlined className={"size-3 *:size-3"} />}
49+
{label}
50+
</div>
51+
)
52+
}

0 commit comments

Comments
 (0)