@kushagradhawan/kookie-ui 0.1.24 → 0.1.26
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/components.css +316 -658
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.d.ts.map +1 -1
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/index.js.map +3 -3
- package/dist/cjs/components/sidebar.d.ts.map +1 -1
- package/dist/cjs/components/sidebar.js +1 -1
- package/dist/cjs/components/sidebar.js.map +2 -2
- package/dist/cjs/components/user-card.d.ts +12 -0
- package/dist/cjs/components/user-card.d.ts.map +1 -0
- package/dist/cjs/components/user-card.js +2 -0
- package/dist/cjs/components/user-card.js.map +7 -0
- package/dist/cjs/components/user-card.props.d.ts +63 -0
- package/dist/cjs/components/user-card.props.d.ts.map +1 -0
- package/dist/cjs/components/user-card.props.js +2 -0
- package/dist/cjs/components/user-card.props.js.map +7 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +3 -3
- package/dist/esm/components/sidebar.d.ts.map +1 -1
- package/dist/esm/components/sidebar.js +1 -1
- package/dist/esm/components/sidebar.js.map +2 -2
- package/dist/esm/components/user-card.d.ts +12 -0
- package/dist/esm/components/user-card.d.ts.map +1 -0
- package/dist/esm/components/user-card.js +2 -0
- package/dist/esm/components/user-card.js.map +7 -0
- package/dist/esm/components/user-card.props.d.ts +63 -0
- package/dist/esm/components/user-card.props.d.ts.map +1 -0
- package/dist/esm/components/user-card.props.js +2 -0
- package/dist/esm/components/user-card.props.js.map +7 -0
- package/package.json +1 -1
- package/src/components/_internal/base-menu.css +5 -5
- package/src/components/image.css +1 -1
- package/src/components/index.css +1 -0
- package/src/components/index.tsx +1 -0
- package/src/components/sidebar.css +333 -245
- package/src/components/sidebar.tsx +26 -5
- package/src/components/user-card.css +29 -0
- package/src/components/user-card.props.tsx +45 -0
- package/src/components/user-card.tsx +102 -0
- package/src/styles/tokens/transition.css +5 -5
- package/styles.css +321 -663
- package/tokens/base.css +5 -5
- package/tokens.css +5 -5
|
@@ -240,6 +240,8 @@ const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>((props, forwarded
|
|
|
240
240
|
data-accent-color={resolvedColor}
|
|
241
241
|
data-high-contrast={highContrast || undefined}
|
|
242
242
|
data-side={side}
|
|
243
|
+
data-type={type}
|
|
244
|
+
data-collapsible={collapsible}
|
|
243
245
|
data-panel-background={panelBackground}
|
|
244
246
|
>
|
|
245
247
|
{children}
|
|
@@ -270,6 +272,8 @@ const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>((props, forwarded
|
|
|
270
272
|
data-accent-color={resolvedColor}
|
|
271
273
|
data-high-contrast={highContrast || undefined}
|
|
272
274
|
data-side={side}
|
|
275
|
+
data-type={type}
|
|
276
|
+
data-collapsible={collapsible}
|
|
273
277
|
data-panel-background={panelBackground}
|
|
274
278
|
>
|
|
275
279
|
{children}
|
|
@@ -286,7 +290,12 @@ interface SidebarContentProps extends React.ComponentPropsWithoutRef<'div'> {}
|
|
|
286
290
|
const SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(
|
|
287
291
|
({ className, children, ...props }, forwardedRef) => {
|
|
288
292
|
const context = React.useContext(SidebarContext);
|
|
289
|
-
const {
|
|
293
|
+
const {
|
|
294
|
+
size = '2',
|
|
295
|
+
menuVariant = 'soft',
|
|
296
|
+
type = 'sidebar',
|
|
297
|
+
collapsible = 'none',
|
|
298
|
+
} = context || {};
|
|
290
299
|
|
|
291
300
|
return (
|
|
292
301
|
<ScrollArea type="auto">
|
|
@@ -294,11 +303,14 @@ const SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(
|
|
|
294
303
|
{...props}
|
|
295
304
|
ref={forwardedRef}
|
|
296
305
|
className={classNames(
|
|
306
|
+
'rt-BaseMenuContent',
|
|
297
307
|
'rt-SidebarContent',
|
|
298
308
|
`rt-r-size-${size}`,
|
|
299
309
|
`rt-menu-variant-${menuVariant}`,
|
|
300
310
|
className,
|
|
301
311
|
)}
|
|
312
|
+
data-type={type}
|
|
313
|
+
data-collapsible={collapsible}
|
|
302
314
|
>
|
|
303
315
|
{children}
|
|
304
316
|
</div>
|
|
@@ -420,7 +432,11 @@ interface SidebarMenuProps extends React.ComponentPropsWithoutRef<'ul'> {}
|
|
|
420
432
|
|
|
421
433
|
const SidebarMenu = React.forwardRef<HTMLUListElement, SidebarMenuProps>(
|
|
422
434
|
({ className, ...props }, forwardedRef) => (
|
|
423
|
-
<ul
|
|
435
|
+
<ul
|
|
436
|
+
{...props}
|
|
437
|
+
ref={forwardedRef}
|
|
438
|
+
className={classNames('rt-BaseMenuViewport', 'rt-SidebarMenu', className)}
|
|
439
|
+
/>
|
|
424
440
|
),
|
|
425
441
|
);
|
|
426
442
|
SidebarMenu.displayName = 'Sidebar.Menu';
|
|
@@ -466,7 +482,7 @@ const SidebarMenuButton = React.forwardRef<HTMLButtonElement, SidebarMenuButtonP
|
|
|
466
482
|
<Comp
|
|
467
483
|
{...props}
|
|
468
484
|
ref={forwardedRef}
|
|
469
|
-
className={classNames('rt-reset', 'rt-SidebarMenuButton', className)}
|
|
485
|
+
className={classNames('rt-reset', 'rt-BaseMenuItem', 'rt-SidebarMenuButton', className)}
|
|
470
486
|
data-active={isActive || undefined}
|
|
471
487
|
data-highlighted={isHighlighted || undefined}
|
|
472
488
|
onMouseEnter={(event) => {
|
|
@@ -558,6 +574,7 @@ const SidebarMenuSubTrigger = React.forwardRef<
|
|
|
558
574
|
asChild={asChild}
|
|
559
575
|
className={classNames(
|
|
560
576
|
'rt-reset',
|
|
577
|
+
'rt-BaseMenuItem',
|
|
561
578
|
'rt-SidebarMenuButton',
|
|
562
579
|
'rt-SidebarMenuSubTrigger',
|
|
563
580
|
className,
|
|
@@ -617,7 +634,11 @@ interface SidebarGroupProps extends React.ComponentPropsWithoutRef<'div'> {}
|
|
|
617
634
|
|
|
618
635
|
const SidebarGroup = React.forwardRef<HTMLDivElement, SidebarGroupProps>(
|
|
619
636
|
({ className, ...props }, forwardedRef) => (
|
|
620
|
-
<div
|
|
637
|
+
<div
|
|
638
|
+
{...props}
|
|
639
|
+
ref={forwardedRef}
|
|
640
|
+
className={classNames('rt-BaseMenuGroup', 'rt-SidebarGroup', className)}
|
|
641
|
+
/>
|
|
621
642
|
),
|
|
622
643
|
);
|
|
623
644
|
SidebarGroup.displayName = 'Sidebar.Group';
|
|
@@ -634,7 +655,7 @@ const SidebarGroupLabel = React.forwardRef<HTMLDivElement, SidebarGroupLabelProp
|
|
|
634
655
|
<Comp
|
|
635
656
|
{...props}
|
|
636
657
|
ref={forwardedRef}
|
|
637
|
-
className={classNames('rt-SidebarGroupLabel', className)}
|
|
658
|
+
className={classNames('rt-BaseMenuLabel', 'rt-SidebarGroupLabel', className)}
|
|
638
659
|
/>
|
|
639
660
|
);
|
|
640
661
|
},
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* UserCard component styles */
|
|
2
|
+
.rt-UserCard {
|
|
3
|
+
/* Base styles inherited from Card */
|
|
4
|
+
|
|
5
|
+
/* Size-specific gap adjustments */
|
|
6
|
+
&:where(.rt-r-size-1) {
|
|
7
|
+
& :where(.rt-Flex) {
|
|
8
|
+
gap: var(--space-2);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&:where(.rt-r-size-2) {
|
|
13
|
+
& :where(.rt-Flex) {
|
|
14
|
+
gap: var(--space-3);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&:where(.rt-r-size-3) {
|
|
19
|
+
& :where(.rt-Flex) {
|
|
20
|
+
gap: var(--space-4);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&:where(.rt-r-size-4) {
|
|
25
|
+
& :where(.rt-Flex) {
|
|
26
|
+
gap: var(--space-5);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { asChildPropDef } from '../props/as-child.prop.js';
|
|
2
|
+
import { accentColorPropDef } from '../props/color.prop.js';
|
|
3
|
+
import { highContrastPropDef } from '../props/high-contrast.prop.js';
|
|
4
|
+
import { radiusPropDef } from '../props/radius.prop.js';
|
|
5
|
+
|
|
6
|
+
import type { PropDef } from '../props/prop-def.js';
|
|
7
|
+
|
|
8
|
+
const sizes = ['1', '2', '3', '4'] as const;
|
|
9
|
+
const variants = ['ghost', 'surface', 'classic'] as const;
|
|
10
|
+
const avatarVariants = ['solid', 'soft', 'surface', 'outline'] as const;
|
|
11
|
+
const panelBackgrounds = ['solid', 'translucent'] as const;
|
|
12
|
+
|
|
13
|
+
const userCardPropDefs = {
|
|
14
|
+
...asChildPropDef,
|
|
15
|
+
size: { type: 'enum', className: 'rt-r-size', values: sizes, default: '2', responsive: true },
|
|
16
|
+
variant: { type: 'enum', className: 'rt-variant', values: variants, default: 'surface' },
|
|
17
|
+
|
|
18
|
+
// Content props
|
|
19
|
+
src: { type: 'string' },
|
|
20
|
+
fallback: { type: 'ReactNode', required: true },
|
|
21
|
+
name: { type: 'string', required: true },
|
|
22
|
+
description: { type: 'string' },
|
|
23
|
+
|
|
24
|
+
// Avatar styling
|
|
25
|
+
avatarVariant: { type: 'enum', values: avatarVariants, default: 'soft' },
|
|
26
|
+
...radiusPropDef,
|
|
27
|
+
|
|
28
|
+
// Card styling
|
|
29
|
+
...accentColorPropDef,
|
|
30
|
+
...highContrastPropDef,
|
|
31
|
+
panelBackground: { type: 'enum', values: panelBackgrounds, default: undefined },
|
|
32
|
+
flush: { type: 'boolean', default: false },
|
|
33
|
+
} satisfies {
|
|
34
|
+
size: PropDef<(typeof sizes)[number]>;
|
|
35
|
+
variant: PropDef<(typeof variants)[number]>;
|
|
36
|
+
src: PropDef<string>;
|
|
37
|
+
fallback: PropDef<React.ReactNode>;
|
|
38
|
+
name: PropDef<string>;
|
|
39
|
+
description: PropDef<string>;
|
|
40
|
+
avatarVariant: PropDef<(typeof avatarVariants)[number]>;
|
|
41
|
+
panelBackground: PropDef<(typeof panelBackgrounds)[number] | undefined>;
|
|
42
|
+
flush: PropDef<boolean>;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { userCardPropDefs };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
|
|
6
|
+
import { userCardPropDefs } from './user-card.props.js';
|
|
7
|
+
import { Avatar } from './avatar.js';
|
|
8
|
+
import { Card } from './card.js';
|
|
9
|
+
import { Text } from './text.js';
|
|
10
|
+
import { Flex } from './flex.js';
|
|
11
|
+
import { extractProps } from '../helpers/extract-props.js';
|
|
12
|
+
import { getSubtree } from '../helpers/get-subtree.js';
|
|
13
|
+
import { marginPropDefs } from '../props/margin.props.js';
|
|
14
|
+
import { useThemeContext } from './theme.js';
|
|
15
|
+
|
|
16
|
+
import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';
|
|
17
|
+
import type { MarginProps } from '../props/margin.props.js';
|
|
18
|
+
import type { GetPropDefTypes } from '../props/prop-def.js';
|
|
19
|
+
|
|
20
|
+
type UserCardOwnProps = GetPropDefTypes<typeof userCardPropDefs>;
|
|
21
|
+
|
|
22
|
+
type UserCardElement = React.ElementRef<'div'>;
|
|
23
|
+
interface UserCardProps
|
|
24
|
+
extends ComponentPropsWithout<'div', RemovedProps>,
|
|
25
|
+
MarginProps,
|
|
26
|
+
UserCardOwnProps {}
|
|
27
|
+
|
|
28
|
+
const UserCard = React.forwardRef<UserCardElement, UserCardProps>((props, forwardedRef) => {
|
|
29
|
+
const themeContext = useThemeContext();
|
|
30
|
+
const resolvedPanelBackground = props.panelBackground ?? themeContext.panelBackground;
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
asChild,
|
|
34
|
+
children,
|
|
35
|
+
className,
|
|
36
|
+
src,
|
|
37
|
+
fallback,
|
|
38
|
+
name,
|
|
39
|
+
description,
|
|
40
|
+
avatarVariant,
|
|
41
|
+
radius,
|
|
42
|
+
color,
|
|
43
|
+
panelBackground,
|
|
44
|
+
flush,
|
|
45
|
+
...restProps
|
|
46
|
+
} = extractProps(props, userCardPropDefs, marginPropDefs);
|
|
47
|
+
|
|
48
|
+
// Size mappings for avatar and text
|
|
49
|
+
const sizeMap = {
|
|
50
|
+
'1': { avatar: '1', name: '1', description: '0' },
|
|
51
|
+
'2': { avatar: '2', name: '2', description: '1' },
|
|
52
|
+
'3': { avatar: '3', name: '3', description: '2' },
|
|
53
|
+
'4': { avatar: '4', name: '4', description: '3' },
|
|
54
|
+
} as const;
|
|
55
|
+
|
|
56
|
+
const currentSize = props.size || '2';
|
|
57
|
+
const sizes = sizeMap[currentSize as keyof typeof sizeMap];
|
|
58
|
+
|
|
59
|
+
const content = (
|
|
60
|
+
<Flex align="center" gap="3">
|
|
61
|
+
<Avatar
|
|
62
|
+
size={sizes.avatar as any}
|
|
63
|
+
variant={avatarVariant}
|
|
64
|
+
radius={radius}
|
|
65
|
+
src={src}
|
|
66
|
+
fallback={fallback!}
|
|
67
|
+
color={color}
|
|
68
|
+
highContrast={props.highContrast}
|
|
69
|
+
/>
|
|
70
|
+
<Flex direction="column" gap="0" style={{ minWidth: 0 }}>
|
|
71
|
+
<Text size={sizes.name as any} weight="medium" truncate>
|
|
72
|
+
{name}
|
|
73
|
+
</Text>
|
|
74
|
+
{description && (
|
|
75
|
+
<Text size={sizes.description as any} color="gray" truncate>
|
|
76
|
+
{description}
|
|
77
|
+
</Text>
|
|
78
|
+
)}
|
|
79
|
+
</Flex>
|
|
80
|
+
</Flex>
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<Card
|
|
85
|
+
{...restProps}
|
|
86
|
+
asChild={asChild}
|
|
87
|
+
size={props.size}
|
|
88
|
+
variant={props.variant}
|
|
89
|
+
panelBackground={resolvedPanelBackground}
|
|
90
|
+
flush={flush}
|
|
91
|
+
ref={forwardedRef}
|
|
92
|
+
className={classNames('rt-UserCard', className)}
|
|
93
|
+
>
|
|
94
|
+
{getSubtree({ asChild, children }, content)}
|
|
95
|
+
</Card>
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
UserCard.displayName = 'UserCard';
|
|
100
|
+
|
|
101
|
+
export { UserCard };
|
|
102
|
+
export type { UserCardProps };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
.radix-themes {
|
|
2
2
|
/* Duration tokens */
|
|
3
|
-
--duration-1:
|
|
4
|
-
--duration-2:
|
|
5
|
-
--duration-3:
|
|
6
|
-
--duration-4:
|
|
7
|
-
--duration-5:
|
|
3
|
+
--duration-1: 75ms; /* Micro interactions */
|
|
4
|
+
--duration-2: 125ms; /* Fast transitions */
|
|
5
|
+
--duration-3: 175ms; /* Standard transitions */
|
|
6
|
+
--duration-4: 225ms; /* Slower transitions */
|
|
7
|
+
--duration-5: 325ms; /* Slow animations */
|
|
8
8
|
|
|
9
9
|
/* Easing tokens */
|
|
10
10
|
--ease-1: ease-out; /* Fast start, slow end */
|