@wallarm-org/design-system 0.8.0 → 0.9.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.
@@ -0,0 +1,13 @@
1
+ import type { FC, HTMLAttributes, MouseEventHandler, ReactNode, Ref } from 'react';
2
+ import type { VariantProps } from 'class-variance-authority';
3
+ import { cardVariants } from './classes';
4
+ type CardVariantProps = Omit<VariantProps<typeof cardVariants>, 'interactive' | 'disabled'>;
5
+ export interface CardProps extends CardVariantProps, Omit<HTMLAttributes<HTMLDivElement>, 'color'> {
6
+ ref?: Ref<HTMLDivElement>;
7
+ asChild?: boolean;
8
+ disabled?: boolean;
9
+ onClick?: MouseEventHandler<HTMLDivElement>;
10
+ children?: ReactNode;
11
+ }
12
+ export declare const Card: FC<CardProps>;
13
+ export {};
@@ -0,0 +1,32 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { cn } from "../../utils/cn.js";
4
+ import { cardVariants } from "./classes.js";
5
+ const INTERACTIVE_SELECTORS = 'a[href],button,input,select,textarea,[tabindex]';
6
+ const Card = ({ ref, color = 'primary', asChild = false, disabled = false, className, children, ...props })=>{
7
+ const Comp = asChild ? Slot : 'div';
8
+ const interactive = Object.keys(props).some((key)=>key.startsWith('on') && 'function' == typeof props[key]);
9
+ const handleClick = (e)=>{
10
+ if (!props.onClick) return;
11
+ const target = e.target;
12
+ const card = e.currentTarget;
13
+ if (target !== card && target.closest(INTERACTIVE_SELECTORS) !== card) return;
14
+ props.onClick(e);
15
+ };
16
+ return /*#__PURE__*/ jsx(Comp, {
17
+ ...props,
18
+ ref: ref,
19
+ "data-slot": "card",
20
+ tabIndex: interactive && !disabled ? 0 : void 0,
21
+ "aria-disabled": disabled || void 0,
22
+ onClick: disabled ? void 0 : handleClick,
23
+ className: cn(cardVariants({
24
+ color,
25
+ interactive,
26
+ disabled
27
+ }), className),
28
+ children: children
29
+ });
30
+ };
31
+ Card.displayName = 'Card';
32
+ export { Card };
@@ -0,0 +1,7 @@
1
+ import type { FC, HTMLAttributes, ReactNode, Ref } from 'react';
2
+ export interface CardContentProps extends HTMLAttributes<HTMLDivElement> {
3
+ ref?: Ref<HTMLDivElement>;
4
+ asChild?: boolean;
5
+ children?: ReactNode;
6
+ }
7
+ export declare const CardContent: FC<CardContentProps>;
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { cn } from "../../utils/cn.js";
4
+ const CardContent = ({ ref, asChild = false, className, children, ...props })=>{
5
+ const Comp = asChild ? Slot : 'div';
6
+ return /*#__PURE__*/ jsx(Comp, {
7
+ ...props,
8
+ ref: ref,
9
+ "data-slot": "card-content",
10
+ className: cn('px-16 text-md', className),
11
+ children: children
12
+ });
13
+ };
14
+ CardContent.displayName = 'CardContent';
15
+ export { CardContent };
@@ -0,0 +1,7 @@
1
+ import type { FC, HTMLAttributes, ReactNode, Ref } from 'react';
2
+ export interface CardFooterProps extends HTMLAttributes<HTMLDivElement> {
3
+ ref?: Ref<HTMLDivElement>;
4
+ asChild?: boolean;
5
+ children?: ReactNode;
6
+ }
7
+ export declare const CardFooter: FC<CardFooterProps>;
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { cn } from "../../utils/cn.js";
4
+ const CardFooter = ({ ref, asChild = false, className, children, ...props })=>{
5
+ const Comp = asChild ? Slot : 'div';
6
+ return /*#__PURE__*/ jsx(Comp, {
7
+ ...props,
8
+ ref: ref,
9
+ "data-slot": "card-footer",
10
+ className: cn('mt-auto flex items-center justify-end gap-8 px-16', className),
11
+ children: children
12
+ });
13
+ };
14
+ CardFooter.displayName = 'CardFooter';
15
+ export { CardFooter };
@@ -0,0 +1,7 @@
1
+ import type { FC, HTMLAttributes, ReactNode, Ref } from 'react';
2
+ export interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {
3
+ ref?: Ref<HTMLDivElement>;
4
+ asChild?: boolean;
5
+ children?: ReactNode;
6
+ }
7
+ export declare const CardHeader: FC<CardHeaderProps>;
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { cn } from "../../utils/cn.js";
4
+ const CardHeader = ({ ref, asChild = false, className, children, ...props })=>{
5
+ const Comp = asChild ? Slot : 'div';
6
+ return /*#__PURE__*/ jsx(Comp, {
7
+ ...props,
8
+ ref: ref,
9
+ "data-slot": "card-header",
10
+ className: cn('flex items-center justify-between gap-8 px-16', className),
11
+ children: children
12
+ });
13
+ };
14
+ CardHeader.displayName = 'CardHeader';
15
+ export { CardHeader };
@@ -0,0 +1,7 @@
1
+ import type { FC, HTMLAttributes, ReactNode, Ref } from 'react';
2
+ export interface CardTitleProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
3
+ ref?: Ref<HTMLDivElement>;
4
+ icon?: ReactNode;
5
+ children?: ReactNode;
6
+ }
7
+ export declare const CardTitle: FC<CardTitleProps>;
@@ -0,0 +1,23 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../utils/cn.js";
3
+ import { Text } from "../Text/index.js";
4
+ const CardTitle = ({ ref, icon, className, children, ...props })=>/*#__PURE__*/ jsxs("div", {
5
+ ...props,
6
+ ref: ref,
7
+ "data-slot": "card-title",
8
+ className: cn('flex items-center gap-8', className),
9
+ children: [
10
+ icon && /*#__PURE__*/ jsx("span", {
11
+ className: "shrink-0",
12
+ children: icon
13
+ }),
14
+ /*#__PURE__*/ jsx(Text, {
15
+ size: "md",
16
+ weight: "medium",
17
+ color: "primary",
18
+ children: children
19
+ })
20
+ ]
21
+ });
22
+ CardTitle.displayName = 'CardTitle';
23
+ export { CardTitle };
@@ -0,0 +1,5 @@
1
+ export declare const cardVariants: (props?: ({
2
+ color?: "primary" | "secondary" | null | undefined;
3
+ interactive?: boolean | null | undefined;
4
+ disabled?: boolean | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -0,0 +1,28 @@
1
+ import { cva } from "class-variance-authority";
2
+ const cardVariants = cva('flex flex-col gap-8 rounded-8 border-1 shadow-sm min-w-[240px] overflow-hidden py-16 transition-colors duration-200', {
3
+ variants: {
4
+ color: {
5
+ primary: 'bg-bg-surface-1 border-border-primary-light',
6
+ secondary: 'bg-bg-light-primary border-border-primary-light'
7
+ },
8
+ interactive: {
9
+ true: [
10
+ 'cursor-pointer overlay',
11
+ 'hover:not-disabled:overlay-states-primary-hover',
12
+ '[&:active:not(:has(a:active,button:active,input:active,select:active,textarea:active))]:not-disabled:overlay-states-primary-pressed',
13
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-primary'
14
+ ],
15
+ false: ''
16
+ },
17
+ disabled: {
18
+ true: 'opacity-50 pointer-events-none cursor-not-allowed',
19
+ false: ''
20
+ }
21
+ },
22
+ defaultVariants: {
23
+ color: 'primary',
24
+ interactive: false,
25
+ disabled: false
26
+ }
27
+ });
28
+ export { cardVariants };
@@ -0,0 +1,6 @@
1
+ export { Card, type CardProps } from './Card';
2
+ export { CardContent, type CardContentProps } from './CardContent';
3
+ export { CardFooter, type CardFooterProps } from './CardFooter';
4
+ export { CardHeader, type CardHeaderProps } from './CardHeader';
5
+ export { CardTitle, type CardTitleProps } from './CardTitle';
6
+ export { cardVariants } from './classes';
@@ -0,0 +1,7 @@
1
+ import { Card } from "./Card.js";
2
+ import { CardContent } from "./CardContent.js";
3
+ import { CardFooter } from "./CardFooter.js";
4
+ import { CardHeader } from "./CardHeader.js";
5
+ import { CardTitle } from "./CardTitle.js";
6
+ import { cardVariants } from "./classes.js";
7
+ export { Card, CardContent, CardFooter, CardHeader, CardTitle, cardVariants };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { Alert, AlertClose, type AlertCloseProps, type AlertColor, AlertContent, type AlertContentProps, AlertControls, type AlertControlsProps, AlertDescription, type AlertDescriptionProps, AlertIcon, type AlertIconProps, type AlertProps, AlertTitle, type AlertTitleProps, } from './components/Alert';
2
2
  export { Badge, type BadgeProps } from './components/Badge';
3
3
  export { Button, type ButtonProps } from './components/Button';
4
+ export { Card, CardContent, type CardContentProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, cardVariants, } from './components/Card';
4
5
  export { Checkbox, CheckboxDescription, type CheckboxDescriptionProps, CheckboxGroup, type CheckboxGroupProps, CheckboxIndicator, CheckboxLabel, type CheckboxLabelProps, type CheckboxProps, } from './components/Checkbox';
5
6
  export { Code, type CodeProps } from './components/Code';
6
7
  export { Country, CountryFlag, type CountryFlagProps, CountryName, type CountryNameProps, type CountryProps, } from './components/Country';
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Alert, AlertClose, AlertContent, AlertControls, AlertDescription, AlertIcon, AlertTitle } from "./components/Alert/index.js";
2
2
  import { Badge } from "./components/Badge/index.js";
3
3
  import { Button } from "./components/Button/index.js";
4
+ import { Card, CardContent, CardFooter, CardHeader, CardTitle, cardVariants } from "./components/Card/index.js";
4
5
  import { Checkbox, CheckboxDescription, CheckboxGroup, CheckboxIndicator, CheckboxLabel } from "./components/Checkbox/index.js";
5
6
  import { Code } from "./components/Code/index.js";
6
7
  import { Country, CountryFlag, CountryName } from "./components/Country/index.js";
@@ -40,4 +41,4 @@ import { Toast, ToastActions, Toaster, toaster } from "./components/Toast/index.
40
41
  import { ToggleButton } from "./components/ToggleButton/index.js";
41
42
  import { Tooltip, TooltipContent, TooltipTrigger } from "./components/Tooltip/index.js";
42
43
  import { Tour, beaconStepEffect, useTour, waitForStepEvent } from "./components/Tour/index.js";
43
- export { Alert, AlertClose, AlertContent, AlertControls, AlertDescription, AlertIcon, AlertTitle, Badge, Button, Checkbox, CheckboxDescription, CheckboxGroup, CheckboxIndicator, CheckboxLabel, Code, Country, CountryFlag, CountryName, DateTime, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerFooter, DrawerFooterControls, DrawerHeader, DrawerPositioner, DrawerResizeHandle, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuContextTrigger, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDescription, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, DropdownMenuTriggerItem, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Flex, HStack, Heading, Input, InputGroup, InputGroupAddon, InputGroupInput, InputGroupText, Ip, IpAddress, IpCountry, IpList, IpPort, IpProvider, Kbd, KbdGroup, Link, Loader, NumberInput, NumericBadge, OverflowTooltip, OverflowTooltipContent, Popover, PopoverContent, PopoverTrigger, QueryBar, QueryBarChip, QueryBarFieldMenu, QueryBarOperatorMenu, Radio, RadioDescription, RadioGroup, RadioIndicator, RadioLabel, ScrollArea, ScrollAreaContent, ScrollAreaCorner, ScrollAreaScrollbar, ScrollAreaViewport, SegmentedControl, SegmentedControlButton, SegmentedControlItem, SegmentedControlSeparator, SegmentedTabs, SegmentedTabsButton, SegmentedTabsContent, SegmentedTabsList, SegmentedTabsSeparator, SegmentedTabsTrigger, SegmentedTabsTriggerButton, Select, SelectButton, SelectClearTrigger, SelectContent, SelectFooter, SelectGroup, SelectGroupLabel, SelectHeader, SelectInput, SelectOption, SelectOptionDescription, SelectOptionIndicator, SelectOptionText, SelectPositioner, SelectSearchInput, SelectSeparator, Separator, Skeleton, Stack, Switch, SwitchControl, SwitchDescription, SwitchLabel, Table, TableActionBar, TableEmptyState, TableSettingsMenu, Tabs, TabsButton, TabsContent, TabsLineActions, TabsList, TabsSeparator, TabsTrigger, Tag, TagClose, Text, Textarea, ThemeProvider, Toast, ToastActions, Toaster, ToggleButton, Tooltip, TooltipContent, TooltipTrigger, Tour, VStack, beaconStepEffect, createTableColumnHelper, datacenters, drawerContentVariants, drawerPositionerVariants, proxyTypes, sourceLabels, toaster, useDrawerContext, useTheme, useTour, waitForStepEvent };
44
+ export { Alert, AlertClose, AlertContent, AlertControls, AlertDescription, AlertIcon, AlertTitle, Badge, Button, Card, CardContent, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxDescription, CheckboxGroup, CheckboxIndicator, CheckboxLabel, Code, Country, CountryFlag, CountryName, DateTime, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerFooter, DrawerFooterControls, DrawerHeader, DrawerPositioner, DrawerResizeHandle, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuContextTrigger, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDescription, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, DropdownMenuTriggerItem, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Flex, HStack, Heading, Input, InputGroup, InputGroupAddon, InputGroupInput, InputGroupText, Ip, IpAddress, IpCountry, IpList, IpPort, IpProvider, Kbd, KbdGroup, Link, Loader, NumberInput, NumericBadge, OverflowTooltip, OverflowTooltipContent, Popover, PopoverContent, PopoverTrigger, QueryBar, QueryBarChip, QueryBarFieldMenu, QueryBarOperatorMenu, Radio, RadioDescription, RadioGroup, RadioIndicator, RadioLabel, ScrollArea, ScrollAreaContent, ScrollAreaCorner, ScrollAreaScrollbar, ScrollAreaViewport, SegmentedControl, SegmentedControlButton, SegmentedControlItem, SegmentedControlSeparator, SegmentedTabs, SegmentedTabsButton, SegmentedTabsContent, SegmentedTabsList, SegmentedTabsSeparator, SegmentedTabsTrigger, SegmentedTabsTriggerButton, Select, SelectButton, SelectClearTrigger, SelectContent, SelectFooter, SelectGroup, SelectGroupLabel, SelectHeader, SelectInput, SelectOption, SelectOptionDescription, SelectOptionIndicator, SelectOptionText, SelectPositioner, SelectSearchInput, SelectSeparator, Separator, Skeleton, Stack, Switch, SwitchControl, SwitchDescription, SwitchLabel, Table, TableActionBar, TableEmptyState, TableSettingsMenu, Tabs, TabsButton, TabsContent, TabsLineActions, TabsList, TabsSeparator, TabsTrigger, Tag, TagClose, Text, Textarea, ThemeProvider, Toast, ToastActions, Toaster, ToggleButton, Tooltip, TooltipContent, TooltipTrigger, Tour, VStack, beaconStepEffect, cardVariants, createTableColumnHelper, datacenters, drawerContentVariants, drawerPositionerVariants, proxyTypes, sourceLabels, toaster, useDrawerContext, useTheme, useTour, waitForStepEvent };