@carbonid1/design-system 5.17.0 → 5.18.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/dist/Button/Button.js +1 -1
- package/dist/Input/Input.d.ts +3 -0
- package/dist/Input/Input.js +6 -0
- package/dist/Input/Input.types.d.ts +3 -0
- package/dist/Input/Input.types.js +1 -0
- package/dist/InputGroup/InputGroup.d.ts +6 -0
- package/dist/InputGroup/InputGroup.js +27 -0
- package/dist/InputGroup/InputGroup.types.d.ts +10 -0
- package/dist/InputGroup/InputGroup.types.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
package/dist/Button/Button.js
CHANGED
|
@@ -4,7 +4,7 @@ import { cn } from '../helpers/cn/cn';
|
|
|
4
4
|
import { Button as ButtonPrimitive } from '@base-ui/react/button';
|
|
5
5
|
import { cva } from 'class-variance-authority';
|
|
6
6
|
import { Loader2 } from 'lucide-react';
|
|
7
|
-
const buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-
|
|
7
|
+
const buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-[color,background-color,opacity,transform] outline-hidden select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
10
10
|
ghost: 'hover:bg-accent aria-expanded:bg-accent dark:hover:bg-accent/50',
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Input as BaseInput } from '@base-ui/react/input';
|
|
4
|
+
import { cn } from '../helpers/cn/cn';
|
|
5
|
+
const Input = ({ className, ...props }) => (_jsx(BaseInput, { ...props, "data-slot": "input", className: cn('border-input-border bg-surface-inset inset-shadow-surface text-foreground placeholder:text-muted-foreground h-9 w-full min-w-0 rounded-lg border px-3 py-1 text-sm outline-hidden dark:inset-shadow-none', 'enabled:hover:border-ring', 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3', 'forced-colors:focus-visible:ring-0 forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-offset-2 forced-colors:focus-visible:outline-[Highlight]', 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50', 'aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 aria-invalid:ring-3', className) }));
|
|
6
|
+
export { Input };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { InputGroupActionProps, InputGroupControlProps, InputGroupRootProps } from './InputGroup.types';
|
|
2
|
+
export declare const InputGroup: {
|
|
3
|
+
Root: ({ className, onPointerDown, ...props }: InputGroupRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
Control: ({ className, ...props }: InputGroupControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Action: ({ className, variant, size, replacesNativePicker, ...props }: InputGroupActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Input as BaseInput } from '@base-ui/react/input';
|
|
4
|
+
import { Button } from '../Button/Button';
|
|
5
|
+
import { cn } from '../helpers/cn/cn';
|
|
6
|
+
const Root = ({ className, onPointerDown, ...props }) => {
|
|
7
|
+
const focusControlFromShell = (event) => {
|
|
8
|
+
onPointerDown?.(event);
|
|
9
|
+
if (event.defaultPrevented || event.button !== 0 || event.target !== event.currentTarget)
|
|
10
|
+
return;
|
|
11
|
+
event.preventDefault();
|
|
12
|
+
event.currentTarget
|
|
13
|
+
.querySelector('[data-slot="input-group-control"]')
|
|
14
|
+
?.focus();
|
|
15
|
+
};
|
|
16
|
+
return (_jsx("div", { ...props, "data-slot": "input-group", onPointerDown: focusControlFromShell, className: cn('border-input-border bg-surface-inset inset-shadow-surface flex min-h-11 w-full min-w-0 items-center gap-1 rounded-lg border p-2 dark:inset-shadow-none', 'has-[[data-slot=input-group-control]:enabled]:hover:border-ring', 'has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-3', 'has-[[data-slot=input-group-control][aria-invalid=true]]:border-destructive has-[[data-slot=input-group-control][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot=input-group-control][aria-invalid=true]]:border-destructive/50 dark:has-[[data-slot=input-group-control][aria-invalid=true]]:ring-destructive/40 has-[[data-slot=input-group-control][aria-invalid=true]]:ring-3', 'forced-colors:has-[[data-slot=input-group-control]:focus-visible]:ring-0 forced-colors:has-[[data-slot=input-group-control]:focus-visible]:outline-2 forced-colors:has-[[data-slot=input-group-control]:focus-visible]:outline-offset-2 forced-colors:has-[[data-slot=input-group-control]:focus-visible]:outline-[Highlight]', '[&:has([data-native-picker-action])_[data-slot=input-group-control]::-webkit-calendar-picker-indicator]:hidden', className) }));
|
|
17
|
+
};
|
|
18
|
+
const Control = ({ className, ...props }) => (_jsx(BaseInput, { ...props, "data-slot": "input-group-control", className: cn('text-foreground placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent px-2 py-1 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50 forced-colors:focus-visible:outline-none', className) }));
|
|
19
|
+
const Action = ({ className, variant = 'subtle', size = 'icon', replacesNativePicker = false, ...props }) => (_jsx(Button, { ...props, "data-slot": "input-group-action", "data-native-picker-action": replacesNativePicker ? '' : undefined, variant: variant, size: size, className: cn('rounded-md',
|
|
20
|
+
// Firefox does not expose its native date indicator to author CSS, so it keeps that
|
|
21
|
+
// affordance and omits the replacement action instead of rendering two calendar buttons.
|
|
22
|
+
replacesNativePicker && 'supports-[-moz-appearance:none]:hidden', className) }));
|
|
23
|
+
export const InputGroup = {
|
|
24
|
+
Root,
|
|
25
|
+
Control,
|
|
26
|
+
Action,
|
|
27
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Input as BaseInput } from '@base-ui/react/input';
|
|
2
|
+
import type { ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
import type { ButtonProps } from '../Button/Button.types';
|
|
4
|
+
type InputGroupRootProps = ComponentPropsWithoutRef<'div'>;
|
|
5
|
+
type InputGroupControlProps = BaseInput.Props;
|
|
6
|
+
type InputGroupActionProps = ButtonProps & {
|
|
7
|
+
/** Replaces the native date affordance where the browser lets author CSS hide it. */
|
|
8
|
+
replacesNativePicker?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type { InputGroupActionProps, InputGroupControlProps, InputGroupRootProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ export { Badge, badgeVariants } from './Badge/Badge';
|
|
|
3
3
|
export type { BadgeProps } from './Badge/Badge.types';
|
|
4
4
|
export { Button, buttonVariants } from './Button/Button';
|
|
5
5
|
export type { ButtonProps } from './Button/Button.types';
|
|
6
|
+
export { Input } from './Input/Input';
|
|
7
|
+
export type { InputProps } from './Input/Input.types';
|
|
8
|
+
export { InputGroup } from './InputGroup/InputGroup';
|
|
9
|
+
export type { InputGroupActionProps, InputGroupControlProps, InputGroupRootProps, } from './InputGroup/InputGroup.types';
|
|
6
10
|
export { Card, cardVariants } from './Card/Card';
|
|
7
11
|
export type { CardActionProps, CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardRootProps, CardTitleProps, } from './Card/Card.types';
|
|
8
12
|
export { Kbd, kbdVariants } from './Kbd/Kbd';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { HotkeysProvider as HotkeysProviderHook, isHotkeyPressed as isHotkeyPressedHook, useHotkeys as useHotkeysHook, useHotkeysContext as useHotkeysContextHook, useRecordHotkeys as useRecordHotkeysHook, } from 'react-hotkeys-hook';
|
|
2
2
|
export { Badge, badgeVariants } from './Badge/Badge';
|
|
3
3
|
export { Button, buttonVariants } from './Button/Button';
|
|
4
|
+
export { Input } from './Input/Input';
|
|
5
|
+
export { InputGroup } from './InputGroup/InputGroup';
|
|
4
6
|
export { Card, cardVariants } from './Card/Card';
|
|
5
7
|
export { Kbd, kbdVariants } from './Kbd/Kbd';
|
|
6
8
|
export { Text, textVariants } from './Text/Text';
|