@ptengine/design-components 0.3.0 → 0.4.0
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/README.md +3 -1
- package/dist/index.cjs +14 -14
- package/dist/index.js +2309 -1938
- package/package.json +3 -3
- package/src/components/ui/calendar.tsx +33 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ptengine/design-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "PT-AI-Components — PTEngine 基于 shadcn/ui 的 React 组件库",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
@@ -88,11 +88,11 @@
|
|
|
88
88
|
"class-variance-authority": "^0.7.1",
|
|
89
89
|
"clsx": "^2.1.1",
|
|
90
90
|
"cmdk": "^1.1.1",
|
|
91
|
-
"date-fns": "^
|
|
91
|
+
"date-fns": "^4.1.0",
|
|
92
92
|
"embla-carousel-react": "^8.6.0",
|
|
93
93
|
"input-otp": "^1.4.2",
|
|
94
94
|
"lucide-react": "^0.577.0",
|
|
95
|
-
"react-day-picker": "^
|
|
95
|
+
"react-day-picker": "^10.0.1",
|
|
96
96
|
"react-resizable-panels": "^2.1.9",
|
|
97
97
|
"recharts": "^2.15.4",
|
|
98
98
|
"sonner": "^2.0.7",
|
|
@@ -13,46 +13,46 @@ function Calendar({ className, classNames, showOutsideDays = true, ...props }: C
|
|
|
13
13
|
showOutsideDays={showOutsideDays}
|
|
14
14
|
className={cn('p-[12px]', className)}
|
|
15
15
|
classNames={{
|
|
16
|
-
months: 'flex flex-col
|
|
17
|
-
month: '
|
|
18
|
-
|
|
16
|
+
months: 'relative flex flex-col gap-[16px] sm:flex-row',
|
|
17
|
+
month: 'flex flex-col gap-[16px]',
|
|
18
|
+
month_caption: 'flex h-[28px] items-center justify-center',
|
|
19
19
|
caption_label: 'text-[14px] leading-[20px] font-medium text-foreground',
|
|
20
|
-
nav: '
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
props.mode === 'range'
|
|
31
|
-
? '[&:has(>.day-range-end)]:rounded-r-[var(--pt-radius-md)] [&:has(>.day-range-start)]:rounded-l-[var(--pt-radius-md)] first:[&:has([aria-selected])]:rounded-l-[var(--pt-radius-md)] last:[&:has([aria-selected])]:rounded-r-[var(--pt-radius-md)]'
|
|
32
|
-
: '[&:has([aria-selected])]:rounded-[var(--pt-radius-md)]'
|
|
33
|
-
),
|
|
34
|
-
day: cn(
|
|
20
|
+
nav: 'absolute inset-x-0 top-0 z-10 flex items-center justify-between',
|
|
21
|
+
button_previous: cn(buttonVariants({ variant: 'ghost' }), 'h-[28px] w-[28px] p-0'),
|
|
22
|
+
button_next: cn(buttonVariants({ variant: 'ghost' }), 'h-[28px] w-[28px] p-0'),
|
|
23
|
+
month_grid: 'w-full border-collapse',
|
|
24
|
+
weekdays: 'flex',
|
|
25
|
+
weekday:
|
|
26
|
+
'w-[32px] rounded-[var(--pt-radius-md)] text-[12px] leading-[16px] font-normal text-muted-foreground',
|
|
27
|
+
week: 'mt-[8px] flex w-full',
|
|
28
|
+
day: 'relative p-0 text-center text-[14px] leading-[20px] focus-within:relative focus-within:z-20',
|
|
29
|
+
day_button: cn(
|
|
35
30
|
buttonVariants({ variant: 'ghost' }),
|
|
36
31
|
'h-[32px] w-[32px] p-0 font-normal aria-selected:opacity-100'
|
|
37
32
|
),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
'bg-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
/* range 端点:黑底白字按钮;格子层同时铺 8% 底带并只圆外侧角,
|
|
34
|
+
让中段底带连续延伸到端点下方不断开 */
|
|
35
|
+
range_start:
|
|
36
|
+
'day-range-start bg-selected rounded-l-[var(--pt-radius-md)] [&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:font-medium',
|
|
37
|
+
range_end:
|
|
38
|
+
'day-range-end bg-selected rounded-r-[var(--pt-radius-md)] [&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:font-medium',
|
|
39
|
+
/* 单选模式选中=黑底白字;range 模式交给 range_start/end/middle 三键,不在此重复设底 */
|
|
40
|
+
selected:
|
|
41
|
+
props.mode === 'range'
|
|
42
|
+
? undefined
|
|
43
|
+
: '[&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:font-medium',
|
|
44
|
+
today: '[&>button]:bg-selected',
|
|
45
|
+
outside: 'day-outside text-muted-foreground aria-selected:text-muted-foreground',
|
|
46
|
+
disabled: 'text-muted-foreground opacity-50',
|
|
47
|
+
range_middle: 'bg-selected [&>button]:bg-transparent [&>button]:font-normal',
|
|
48
|
+
hidden: 'invisible',
|
|
47
49
|
...classNames
|
|
48
50
|
}}
|
|
49
51
|
components={{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<ChevronRight className={cn('h-[16px] w-[16px]', className)} {...props} />
|
|
55
|
-
)
|
|
52
|
+
Chevron: ({ orientation }) => {
|
|
53
|
+
const Icon = orientation === 'left' ? ChevronLeft : ChevronRight;
|
|
54
|
+
return <Icon className="h-[16px] w-[16px]" />;
|
|
55
|
+
}
|
|
56
56
|
}}
|
|
57
57
|
{...props}
|
|
58
58
|
/>
|