atlas-react-kit 0.4.0 → 0.5.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/COMPONENTS.md +122 -39
- package/DESIGN_RULES.md +66 -19
- package/README.md +56 -10
- package/dist/accordion.d.ts +8 -0
- package/dist/accordion.js +20 -0
- package/dist/alert.d.ts +19 -0
- package/dist/alert.js +37 -0
- package/dist/avatar.d.ts +9 -0
- package/dist/avatar.js +16 -0
- package/dist/badge.d.ts +2 -2
- package/dist/breadcrumb.d.ts +16 -0
- package/dist/breadcrumb.js +33 -0
- package/dist/button.d.ts +6 -5
- package/dist/button.js +6 -5
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +19 -1
- package/dist/card.d.ts +2 -2
- package/dist/card.js +6 -6
- package/dist/combobox.d.ts +4 -1
- package/dist/combobox.js +10 -5
- package/dist/date-picker.js +14 -3
- package/dist/date-time-picker.d.ts +36 -0
- package/dist/date-time-picker.js +105 -0
- package/dist/dropdown-menu.d.ts +26 -0
- package/dist/dropdown-menu.js +56 -0
- package/dist/error-boundary.d.ts +1 -1
- package/dist/field.js +1 -1
- package/dist/form/date-time-picker-field.d.ts +16 -0
- package/dist/form/date-time-picker-field.js +12 -0
- package/dist/form/text-field.d.ts +7 -1
- package/dist/form/text-field.js +3 -3
- package/dist/pagination.d.ts +18 -0
- package/dist/pagination.js +35 -0
- package/dist/progress.d.ts +8 -0
- package/dist/progress.js +13 -0
- package/dist/radio-group.d.ts +13 -0
- package/dist/radio-group.js +20 -0
- package/dist/spinner.d.ts +8 -0
- package/dist/spinner.js +13 -0
- package/dist/switch.d.ts +9 -0
- package/dist/switch.js +14 -0
- package/dist/table.d.ts +7 -0
- package/dist/table.js +32 -3
- package/dist/tabs.d.ts +6 -3
- package/dist/tabs.js +5 -2
- package/dist/theme-provider.d.ts +2 -1
- package/dist/theme-provider.js +28 -4
- package/dist/toggle.js +1 -1
- package/dist/tooltip.d.ts +15 -0
- package/dist/tooltip.js +26 -0
- package/package.json +58 -5
- package/skills/atlas-react-kit/SKILL.md +139 -0
- package/theme.css +44 -5
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Page links for long lists and tables. Links are plain anchors so the page
|
|
4
|
+
* lives in the URL; pass `onClick` with `href` for client-side routing.
|
|
5
|
+
*/
|
|
6
|
+
declare function Pagination({ className, ...props }: React.ComponentProps<"nav">): React.JSX.Element;
|
|
7
|
+
declare function PaginationContent({ className, ...props }: React.ComponentProps<"ul">): React.JSX.Element;
|
|
8
|
+
declare function PaginationItem({ ...props }: React.ComponentProps<"li">): React.JSX.Element;
|
|
9
|
+
type PaginationLinkProps = {
|
|
10
|
+
isActive?: boolean;
|
|
11
|
+
size?: "default" | "icon";
|
|
12
|
+
} & React.ComponentProps<"a">;
|
|
13
|
+
/** The current page gets `aria-current="page"` and the selected wash. */
|
|
14
|
+
declare function PaginationLink({ className, isActive, size, ...props }: PaginationLinkProps): React.JSX.Element;
|
|
15
|
+
declare function PaginationPrevious({ className, children, ...props }: React.ComponentProps<typeof PaginationLink>): React.JSX.Element;
|
|
16
|
+
declare function PaginationNext({ className, children, ...props }: React.ComponentProps<typeof PaginationLink>): React.JSX.Element;
|
|
17
|
+
declare function PaginationEllipsis({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
18
|
+
export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon, } from "lucide-react";
|
|
4
|
+
import { buttonVariants } from "./button.js";
|
|
5
|
+
import { cn } from "./utils.js";
|
|
6
|
+
/**
|
|
7
|
+
* Page links for long lists and tables. Links are plain anchors so the page
|
|
8
|
+
* lives in the URL; pass `onClick` with `href` for client-side routing.
|
|
9
|
+
*/
|
|
10
|
+
function Pagination({ className, ...props }) {
|
|
11
|
+
return (_jsx("nav", { "aria-label": "Pagination", "data-slot": "pagination", className: cn("mx-auto flex w-full justify-center", className), ...props }));
|
|
12
|
+
}
|
|
13
|
+
function PaginationContent({ className, ...props }) {
|
|
14
|
+
return (_jsx("ul", { "data-slot": "pagination-content", className: cn("flex flex-row items-center gap-1", className), ...props }));
|
|
15
|
+
}
|
|
16
|
+
function PaginationItem({ ...props }) {
|
|
17
|
+
return _jsx("li", { "data-slot": "pagination-item", ...props });
|
|
18
|
+
}
|
|
19
|
+
/** The current page gets `aria-current="page"` and the selected wash. */
|
|
20
|
+
function PaginationLink({ className, isActive, size = "icon", ...props }) {
|
|
21
|
+
return (_jsx("a", { "aria-current": isActive ? "page" : undefined, "data-slot": "pagination-link", "data-active": isActive, className: cn(buttonVariants({
|
|
22
|
+
variant: isActive ? "outline" : "ghost",
|
|
23
|
+
size: size === "icon" ? "icon-sm" : "sm",
|
|
24
|
+
}), "font-medium tracking-normal normal-case tabular-nums data-[active=true]:border-primary data-[active=true]:bg-selected data-[active=true]:text-selected-foreground", className), ...props }));
|
|
25
|
+
}
|
|
26
|
+
function PaginationPrevious({ className, children = "Previous", ...props }) {
|
|
27
|
+
return (_jsxs(PaginationLink, { "aria-label": "Go to previous page", size: "default", className: cn("gap-1 px-2.5 sm:pl-2", className), ...props, children: [_jsx(ChevronLeftIcon, { "data-icon": "inline-start" }), _jsx("span", { className: "hidden sm:block", children: children })] }));
|
|
28
|
+
}
|
|
29
|
+
function PaginationNext({ className, children = "Next", ...props }) {
|
|
30
|
+
return (_jsxs(PaginationLink, { "aria-label": "Go to next page", size: "default", className: cn("gap-1 px-2.5 sm:pr-2", className), ...props, children: [_jsx("span", { className: "hidden sm:block", children: children }), _jsx(ChevronRightIcon, { "data-icon": "inline-end" })] }));
|
|
31
|
+
}
|
|
32
|
+
function PaginationEllipsis({ className, ...props }) {
|
|
33
|
+
return (_jsxs("span", { "aria-hidden": true, "data-slot": "pagination-ellipsis", className: cn("flex size-9 items-center justify-center text-muted-foreground", className), ...props, children: [_jsx(MoreHorizontalIcon, { className: "size-4" }), _jsx("span", { className: "sr-only", children: "More pages" })] }));
|
|
34
|
+
}
|
|
35
|
+
export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Progress as ProgressPrimitive } from "radix-ui";
|
|
3
|
+
/**
|
|
4
|
+
* Determinate progress (uploads, multi-step jobs). `value` is 0–100; omit
|
|
5
|
+
* it for an indeterminate state and pair the bar with a visible label.
|
|
6
|
+
*/
|
|
7
|
+
declare function Progress({ className, value, ...props }: React.ComponentProps<typeof ProgressPrimitive.Root>): React.JSX.Element;
|
|
8
|
+
export { Progress };
|
package/dist/progress.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Progress as ProgressPrimitive } from "radix-ui";
|
|
5
|
+
import { cn } from "./utils.js";
|
|
6
|
+
/**
|
|
7
|
+
* Determinate progress (uploads, multi-step jobs). `value` is 0–100; omit
|
|
8
|
+
* it for an indeterminate state and pair the bar with a visible label.
|
|
9
|
+
*/
|
|
10
|
+
function Progress({ className, value, ...props }) {
|
|
11
|
+
return (_jsx(ProgressPrimitive.Root, { "data-slot": "progress", value: value, className: cn("relative h-2 w-full overflow-hidden rounded-none bg-primary/15", className), ...props, children: _jsx(ProgressPrimitive.Indicator, { "data-slot": "progress-indicator", className: "h-full w-full flex-1 bg-primary transition-transform", style: { transform: `translateX(-${100 - (value ?? 0)}%)` } }) }));
|
|
12
|
+
}
|
|
13
|
+
export { Progress };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
|
|
3
|
+
/**
|
|
4
|
+
* One choice from a short, visible list. Arrow keys move the selection.
|
|
5
|
+
* Use `Select` or `Combobox` when the list is long.
|
|
6
|
+
*/
|
|
7
|
+
declare function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>): React.JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* Radio dot. Radios stay round (a circle, per the shape rules) so they read
|
|
10
|
+
* differently from square checkboxes.
|
|
11
|
+
*/
|
|
12
|
+
declare function RadioGroupItem({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Item>): React.JSX.Element;
|
|
13
|
+
export { RadioGroup, RadioGroupItem };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
|
|
5
|
+
import { cn } from "./utils.js";
|
|
6
|
+
/**
|
|
7
|
+
* One choice from a short, visible list. Arrow keys move the selection.
|
|
8
|
+
* Use `Select` or `Combobox` when the list is long.
|
|
9
|
+
*/
|
|
10
|
+
function RadioGroup({ className, ...props }) {
|
|
11
|
+
return (_jsx(RadioGroupPrimitive.Root, { "data-slot": "radio-group", className: cn("grid gap-3", className), ...props }));
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Radio dot. Radios stay round (a circle, per the shape rules) so they read
|
|
15
|
+
* differently from square checkboxes.
|
|
16
|
+
*/
|
|
17
|
+
function RadioGroupItem({ className, ...props }) {
|
|
18
|
+
return (_jsx(RadioGroupPrimitive.Item, { "data-slot": "radio-group-item", className: cn("peer relative flex aspect-square size-4.5 shrink-0 items-center justify-center rounded-full border border-input bg-transparent shadow-xs transition-shadow outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-checked:border-primary", className), ...props, children: _jsx(RadioGroupPrimitive.Indicator, { "data-slot": "radio-group-indicator", className: "flex items-center justify-center", children: _jsx("span", { className: "size-2 rounded-full bg-primary" }) }) }));
|
|
19
|
+
}
|
|
20
|
+
export { RadioGroup, RadioGroupItem };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Indeterminate loading indicator for a button or small region. Announced as
|
|
4
|
+
* "Loading" by default; pass `aria-label` for something more specific. Use
|
|
5
|
+
* `Skeleton` or `TableBodySkeleton` when the layout of the result is known.
|
|
6
|
+
*/
|
|
7
|
+
declare function Spinner({ className, "aria-label": ariaLabel, ...props }: React.ComponentProps<"svg">): React.JSX.Element;
|
|
8
|
+
export { Spinner };
|
package/dist/spinner.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Loader2Icon } from "lucide-react";
|
|
4
|
+
import { cn } from "./utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* Indeterminate loading indicator for a button or small region. Announced as
|
|
7
|
+
* "Loading" by default; pass `aria-label` for something more specific. Use
|
|
8
|
+
* `Skeleton` or `TableBodySkeleton` when the layout of the result is known.
|
|
9
|
+
*/
|
|
10
|
+
function Spinner({ className, "aria-label": ariaLabel = "Loading", ...props }) {
|
|
11
|
+
return (_jsx(Loader2Icon, { role: "status", "aria-label": ariaLabel, "data-slot": "spinner", className: cn("size-4 animate-spin", className), ...props }));
|
|
12
|
+
}
|
|
13
|
+
export { Spinner };
|
package/dist/switch.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
3
|
+
/**
|
|
4
|
+
* On/off setting that applies immediately (notifications, dark mode). Use
|
|
5
|
+
* `Checkbox` for choices submitted with a form. Square like the other
|
|
6
|
+
* primitives; checked uses the primary fill, as `Checkbox` does.
|
|
7
|
+
*/
|
|
8
|
+
declare function Switch({ className, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root>): React.JSX.Element;
|
|
9
|
+
export { Switch };
|
package/dist/switch.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
5
|
+
import { cn } from "./utils.js";
|
|
6
|
+
/**
|
|
7
|
+
* On/off setting that applies immediately (notifications, dark mode). Use
|
|
8
|
+
* `Checkbox` for choices submitted with a form. Square like the other
|
|
9
|
+
* primitives; checked uses the primary fill, as `Checkbox` does.
|
|
10
|
+
*/
|
|
11
|
+
function Switch({ className, ...props }) {
|
|
12
|
+
return (_jsx(SwitchPrimitive.Root, { "data-slot": "switch", className: cn("peer inline-flex h-5 w-9 shrink-0 items-center rounded-none border border-transparent bg-input p-0.5 shadow-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-checked:bg-primary dark:bg-input/80 dark:data-checked:bg-primary", className), ...props, children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: "pointer-events-none block size-3.5 rounded-none bg-background shadow-sm ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground" }) }));
|
|
13
|
+
}
|
|
14
|
+
export { Switch };
|
package/dist/table.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Data table. The root is a `min-w-0 overflow-x-auto` scroller so nowrap
|
|
4
|
+
* columns scroll inside the table instead of widening a card or panel.
|
|
5
|
+
* While it overflows, the scroller joins the tab order so keyboard users can
|
|
6
|
+
* scroll it with the arrow keys (WCAG 2.1.1).
|
|
7
|
+
* Cell padding is `px-2` below `sm` and the original `p-3` from `sm` up.
|
|
8
|
+
*/
|
|
2
9
|
declare function Table({ className, ...props }: React.ComponentProps<"table">): React.JSX.Element;
|
|
3
10
|
declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
|
|
4
11
|
declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
|
package/dist/table.js
CHANGED
|
@@ -2,8 +2,37 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cn } from "./utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* True while the element's content is wider than its box. Re-checked when
|
|
7
|
+
* the container or its content resizes.
|
|
8
|
+
*/
|
|
9
|
+
function useHorizontalOverflow(ref) {
|
|
10
|
+
const [overflowing, setOverflowing] = React.useState(false);
|
|
11
|
+
React.useEffect(() => {
|
|
12
|
+
const element = ref.current;
|
|
13
|
+
if (!element || typeof ResizeObserver === "undefined")
|
|
14
|
+
return;
|
|
15
|
+
const check = () => setOverflowing(element.scrollWidth > element.clientWidth + 1);
|
|
16
|
+
check();
|
|
17
|
+
const observer = new ResizeObserver(check);
|
|
18
|
+
observer.observe(element);
|
|
19
|
+
if (element.firstElementChild)
|
|
20
|
+
observer.observe(element.firstElementChild);
|
|
21
|
+
return () => observer.disconnect();
|
|
22
|
+
}, [ref]);
|
|
23
|
+
return overflowing;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Data table. The root is a `min-w-0 overflow-x-auto` scroller so nowrap
|
|
27
|
+
* columns scroll inside the table instead of widening a card or panel.
|
|
28
|
+
* While it overflows, the scroller joins the tab order so keyboard users can
|
|
29
|
+
* scroll it with the arrow keys (WCAG 2.1.1).
|
|
30
|
+
* Cell padding is `px-2` below `sm` and the original `p-3` from `sm` up.
|
|
31
|
+
*/
|
|
5
32
|
function Table({ className, ...props }) {
|
|
6
|
-
|
|
33
|
+
const containerRef = React.useRef(null);
|
|
34
|
+
const scrollable = useHorizontalOverflow(containerRef);
|
|
35
|
+
return (_jsx("div", { ref: containerRef, "data-slot": "table-container", tabIndex: scrollable ? 0 : undefined, className: "relative w-full min-w-0 max-w-full overflow-x-auto overscroll-x-contain outline-none focus-visible:ring-2 focus-visible:ring-ring/30", children: _jsx("table", { "data-slot": "table", className: cn("w-full min-w-full caption-bottom text-sm", className), ...props }) }));
|
|
7
36
|
}
|
|
8
37
|
function TableHeader({ className, ...props }) {
|
|
9
38
|
return (_jsx("thead", { "data-slot": "table-header", className: cn("[&_tr]:border-b", className), ...props }));
|
|
@@ -18,10 +47,10 @@ function TableRow({ className, ...props }) {
|
|
|
18
47
|
return (_jsx("tr", { "data-slot": "table-row", className: cn("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-selected", className), ...props }));
|
|
19
48
|
}
|
|
20
49
|
function TableHead({ className, ...props }) {
|
|
21
|
-
return (_jsx("th", { "data-slot": "table-head", className: cn("h-
|
|
50
|
+
return (_jsx("th", { "data-slot": "table-head", className: cn("h-10 px-2 text-left align-middle text-xs font-medium tracking-wider whitespace-nowrap text-muted-foreground uppercase sm:h-12 sm:px-3 [&:has([role=checkbox])]:pr-0", className), ...props }));
|
|
22
51
|
}
|
|
23
52
|
function TableCell({ className, ...props }) {
|
|
24
|
-
return (_jsx("td", { "data-slot": "table-cell", className: cn("
|
|
53
|
+
return (_jsx("td", { "data-slot": "table-cell", className: cn("px-2 py-2 align-middle whitespace-nowrap sm:p-3 [&:has([role=checkbox])]:pr-0", className), ...props }));
|
|
25
54
|
}
|
|
26
55
|
function TableCaption({ className, ...props }) {
|
|
27
56
|
return (_jsx("caption", { "data-slot": "table-caption", className: cn("mt-4 text-sm text-muted-foreground", className), ...props }));
|
package/dist/tabs.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
4
|
-
import { tabsListVariants } from "./internal/tabs-styles.js";
|
|
4
|
+
import { tabsListVariants, tabsTriggerVariants } from "./internal/tabs-styles.js";
|
|
5
5
|
declare function Tabs({ className, orientation, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>): React.JSX.Element;
|
|
6
6
|
declare function TabsList({ className, variant, ...props }: React.ComponentProps<typeof TabsPrimitive.List> & VariantProps<typeof tabsListVariants>): React.JSX.Element;
|
|
7
7
|
declare function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>): React.JSX.Element;
|
|
@@ -9,9 +9,12 @@ declare function TabsContent({ className, ...props }: React.ComponentProps<typeo
|
|
|
9
9
|
/**
|
|
10
10
|
* Tab-styled links for a view switcher that changes the URL. Use this, not
|
|
11
11
|
* `Tabs` + `TabsTrigger asChild`, when there are no `TabsContent` panels:
|
|
12
|
-
* tabs would point assistive tech at panels that don't exist.
|
|
12
|
+
* tabs would point assistive tech at panels that don't exist. Style each link
|
|
13
|
+
* with `tabsTriggerVariants()` and mark the active one with
|
|
14
|
+
* `data-state="active"` and `aria-current="page"` (the Next adapter
|
|
15
|
+
* `TabsNavLink` does this for you).
|
|
13
16
|
*/
|
|
14
17
|
declare function TabsNav({ className, children, ...props }: React.ComponentProps<"nav"> & {
|
|
15
18
|
"aria-label": string;
|
|
16
19
|
}): React.JSX.Element;
|
|
17
|
-
export { Tabs, TabsList, TabsTrigger, TabsContent, TabsNav, tabsListVariants };
|
|
20
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, TabsNav, tabsListVariants, tabsTriggerVariants, };
|
package/dist/tabs.js
CHANGED
|
@@ -20,9 +20,12 @@ function TabsContent({ className, ...props }) {
|
|
|
20
20
|
/**
|
|
21
21
|
* Tab-styled links for a view switcher that changes the URL. Use this, not
|
|
22
22
|
* `Tabs` + `TabsTrigger asChild`, when there are no `TabsContent` panels:
|
|
23
|
-
* tabs would point assistive tech at panels that don't exist.
|
|
23
|
+
* tabs would point assistive tech at panels that don't exist. Style each link
|
|
24
|
+
* with `tabsTriggerVariants()` and mark the active one with
|
|
25
|
+
* `data-state="active"` and `aria-current="page"` (the Next adapter
|
|
26
|
+
* `TabsNavLink` does this for you).
|
|
24
27
|
*/
|
|
25
28
|
function TabsNav({ className, children, ...props }) {
|
|
26
29
|
return (_jsx("nav", { "data-slot": "tabs-nav", "data-orientation": "horizontal", className: cn("group/tabs", className), ...props, children: _jsx("div", { "data-slot": "tabs-list", "data-variant": "default", className: tabsListVariants(), children: children }) }));
|
|
27
30
|
}
|
|
28
|
-
export { Tabs, TabsList, TabsTrigger, TabsContent, TabsNav, tabsListVariants };
|
|
31
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, TabsNav, tabsListVariants, tabsTriggerVariants, };
|
package/dist/theme-provider.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { useTheme, type ThemeProviderProps as NextThemesProviderProps } from "ne
|
|
|
3
3
|
export type ThemeProviderProps = NextThemesProviderProps & {
|
|
4
4
|
/**
|
|
5
5
|
* When true, pressing `d` toggles dark/light unless focus is in an editable
|
|
6
|
-
* field. Defaults to
|
|
6
|
+
* field or a widget with letter typeahead (such as `Select`). Defaults to
|
|
7
|
+
* true.
|
|
7
8
|
*/
|
|
8
9
|
enableShortcut?: boolean;
|
|
9
10
|
};
|
package/dist/theme-provider.js
CHANGED
|
@@ -2,22 +2,46 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { ThemeProvider as NextThemesProvider, useTheme, } from "next-themes";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Targets where a bare `d` is input, not a shortcut: native and ARIA text
|
|
7
|
+
* fields, plus widgets with letter typeahead (Select trigger and list, menus,
|
|
8
|
+
* trees, grids).
|
|
9
|
+
*/
|
|
10
|
+
const KEY_CONSUMING_SELECTOR = [
|
|
11
|
+
"input",
|
|
12
|
+
"textarea",
|
|
13
|
+
"select",
|
|
14
|
+
"[contenteditable]:not([contenteditable='false'])",
|
|
15
|
+
...[
|
|
16
|
+
"textbox",
|
|
17
|
+
"searchbox",
|
|
18
|
+
"spinbutton",
|
|
19
|
+
"combobox",
|
|
20
|
+
"listbox",
|
|
21
|
+
"menu",
|
|
22
|
+
"menubar",
|
|
23
|
+
"tree",
|
|
24
|
+
"treegrid",
|
|
25
|
+
"grid",
|
|
26
|
+
].map((role) => `[role="${role}"]`),
|
|
27
|
+
].join(", ");
|
|
28
|
+
function isKeyConsumingTarget(target) {
|
|
7
29
|
if (!(target instanceof HTMLElement))
|
|
8
30
|
return false;
|
|
9
|
-
return Boolean(target.closest(
|
|
31
|
+
return Boolean(target.closest(KEY_CONSUMING_SELECTOR));
|
|
10
32
|
}
|
|
11
33
|
/** Listens for the optional `d` shortcut inside an existing theme context. */
|
|
12
34
|
function ThemeShortcut() {
|
|
13
35
|
const { resolvedTheme, setTheme } = useTheme();
|
|
14
36
|
React.useEffect(() => {
|
|
15
37
|
function onKeyDown(event) {
|
|
38
|
+
if (event.defaultPrevented || event.repeat || event.isComposing)
|
|
39
|
+
return;
|
|
16
40
|
if (event.metaKey || event.ctrlKey || event.altKey)
|
|
17
41
|
return;
|
|
18
42
|
if (event.key !== "d" && event.key !== "D")
|
|
19
43
|
return;
|
|
20
|
-
if (
|
|
44
|
+
if (isKeyConsumingTarget(event.target))
|
|
21
45
|
return;
|
|
22
46
|
event.preventDefault();
|
|
23
47
|
setTheme(resolvedTheme === "dark" ? "light" : "dark");
|
package/dist/toggle.js
CHANGED
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
import { Toggle as TogglePrimitive } from "radix-ui";
|
|
6
6
|
import { cn } from "./utils.js";
|
|
7
|
-
const toggleVariants = cva("group/toggle inline-flex items-center justify-center gap-1.5 rounded-none text-xs font-semibold tracking-widest whitespace-nowrap uppercase transition-colors outline-none hover:border-primary hover:bg-selected hover:text-
|
|
7
|
+
const toggleVariants = cva("group/toggle inline-flex items-center justify-center gap-1.5 rounded-none text-xs font-semibold tracking-widest whitespace-nowrap uppercase transition-colors outline-none hover:border-primary hover:bg-selected hover:text-selected-foreground focus-visible:border-primary focus-visible:text-selected-foreground focus-visible:ring-[3px] focus-visible:ring-primary/30 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-selected aria-pressed:text-selected-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5", {
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
10
10
|
default: "bg-transparent",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
3
|
+
/**
|
|
4
|
+
* Shares open delay across tooltips. `Tooltip` adds one per instance, so a
|
|
5
|
+
* provider at the app root is optional; add it to tune `delayDuration`.
|
|
6
|
+
*/
|
|
7
|
+
declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): React.JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* Short label for an icon button or truncated text. Opens on hover and
|
|
10
|
+
* keyboard focus; put essential information in visible text instead.
|
|
11
|
+
*/
|
|
12
|
+
declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): React.JSX.Element;
|
|
13
|
+
declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): React.JSX.Element;
|
|
14
|
+
declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): React.JSX.Element;
|
|
15
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
package/dist/tooltip.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
5
|
+
import { cn } from "./utils.js";
|
|
6
|
+
/**
|
|
7
|
+
* Shares open delay across tooltips. `Tooltip` adds one per instance, so a
|
|
8
|
+
* provider at the app root is optional; add it to tune `delayDuration`.
|
|
9
|
+
*/
|
|
10
|
+
function TooltipProvider({ delayDuration = 0, ...props }) {
|
|
11
|
+
return (_jsx(TooltipPrimitive.Provider, { "data-slot": "tooltip-provider", delayDuration: delayDuration, ...props }));
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Short label for an icon button or truncated text. Opens on hover and
|
|
15
|
+
* keyboard focus; put essential information in visible text instead.
|
|
16
|
+
*/
|
|
17
|
+
function Tooltip({ ...props }) {
|
|
18
|
+
return (_jsx(TooltipProvider, { children: _jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) }));
|
|
19
|
+
}
|
|
20
|
+
function TooltipTrigger({ ...props }) {
|
|
21
|
+
return _jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
22
|
+
}
|
|
23
|
+
function TooltipContent({ className, sideOffset = 4, children, ...props }) {
|
|
24
|
+
return (_jsx(TooltipPrimitive.Portal, { children: _jsxs(TooltipPrimitive.Content, { "data-slot": "tooltip-content", sideOffset: sideOffset, className: cn("z-50 w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) rounded-none bg-foreground px-3 py-1.5 text-xs text-balance text-background duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-[state=instant-open]:animate-in data-[state=instant-open]:fade-in-0", className), ...props, children: [children, _jsx(TooltipPrimitive.Arrow, { className: "fill-foreground" })] }) }));
|
|
25
|
+
}
|
|
26
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atlas-react-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Shared React components and Tailwind theme for Atlas",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,16 +13,33 @@
|
|
|
13
13
|
"theme.css",
|
|
14
14
|
"DESIGN_RULES.md",
|
|
15
15
|
"COMPONENTS.md",
|
|
16
|
-
"NOTICE"
|
|
16
|
+
"NOTICE",
|
|
17
|
+
"skills"
|
|
17
18
|
],
|
|
18
19
|
"sideEffects": [
|
|
19
20
|
"**/*.css"
|
|
20
21
|
],
|
|
21
22
|
"exports": {
|
|
23
|
+
"./accordion": {
|
|
24
|
+
"types": "./dist/accordion.d.ts",
|
|
25
|
+
"default": "./dist/accordion.js"
|
|
26
|
+
},
|
|
27
|
+
"./alert": {
|
|
28
|
+
"types": "./dist/alert.d.ts",
|
|
29
|
+
"default": "./dist/alert.js"
|
|
30
|
+
},
|
|
31
|
+
"./avatar": {
|
|
32
|
+
"types": "./dist/avatar.d.ts",
|
|
33
|
+
"default": "./dist/avatar.js"
|
|
34
|
+
},
|
|
22
35
|
"./badge": {
|
|
23
36
|
"types": "./dist/badge.d.ts",
|
|
24
37
|
"default": "./dist/badge.js"
|
|
25
38
|
},
|
|
39
|
+
"./breadcrumb": {
|
|
40
|
+
"types": "./dist/breadcrumb.d.ts",
|
|
41
|
+
"default": "./dist/breadcrumb.js"
|
|
42
|
+
},
|
|
26
43
|
"./button": {
|
|
27
44
|
"types": "./dist/button.d.ts",
|
|
28
45
|
"default": "./dist/button.js"
|
|
@@ -47,10 +64,18 @@
|
|
|
47
64
|
"types": "./dist/date-picker.d.ts",
|
|
48
65
|
"default": "./dist/date-picker.js"
|
|
49
66
|
},
|
|
67
|
+
"./date-time-picker": {
|
|
68
|
+
"types": "./dist/date-time-picker.d.ts",
|
|
69
|
+
"default": "./dist/date-time-picker.js"
|
|
70
|
+
},
|
|
50
71
|
"./dialog": {
|
|
51
72
|
"types": "./dist/dialog.d.ts",
|
|
52
73
|
"default": "./dist/dialog.js"
|
|
53
74
|
},
|
|
75
|
+
"./dropdown-menu": {
|
|
76
|
+
"types": "./dist/dropdown-menu.d.ts",
|
|
77
|
+
"default": "./dist/dropdown-menu.js"
|
|
78
|
+
},
|
|
54
79
|
"./empty-panel": {
|
|
55
80
|
"types": "./dist/empty-panel.d.ts",
|
|
56
81
|
"default": "./dist/empty-panel.js"
|
|
@@ -71,10 +96,22 @@
|
|
|
71
96
|
"types": "./dist/label.d.ts",
|
|
72
97
|
"default": "./dist/label.js"
|
|
73
98
|
},
|
|
99
|
+
"./pagination": {
|
|
100
|
+
"types": "./dist/pagination.d.ts",
|
|
101
|
+
"default": "./dist/pagination.js"
|
|
102
|
+
},
|
|
74
103
|
"./popover": {
|
|
75
104
|
"types": "./dist/popover.d.ts",
|
|
76
105
|
"default": "./dist/popover.js"
|
|
77
106
|
},
|
|
107
|
+
"./progress": {
|
|
108
|
+
"types": "./dist/progress.d.ts",
|
|
109
|
+
"default": "./dist/progress.js"
|
|
110
|
+
},
|
|
111
|
+
"./radio-group": {
|
|
112
|
+
"types": "./dist/radio-group.d.ts",
|
|
113
|
+
"default": "./dist/radio-group.js"
|
|
114
|
+
},
|
|
78
115
|
"./select": {
|
|
79
116
|
"types": "./dist/select.d.ts",
|
|
80
117
|
"default": "./dist/select.js"
|
|
@@ -87,13 +124,21 @@
|
|
|
87
124
|
"types": "./dist/skeleton.d.ts",
|
|
88
125
|
"default": "./dist/skeleton.js"
|
|
89
126
|
},
|
|
127
|
+
"./sonner": {
|
|
128
|
+
"types": "./dist/sonner.d.ts",
|
|
129
|
+
"default": "./dist/sonner.js"
|
|
130
|
+
},
|
|
90
131
|
"./sortable-table-head": {
|
|
91
132
|
"types": "./dist/sortable-table-head.d.ts",
|
|
92
133
|
"default": "./dist/sortable-table-head.js"
|
|
93
134
|
},
|
|
94
|
-
"./
|
|
95
|
-
"types": "./dist/
|
|
96
|
-
"default": "./dist/
|
|
135
|
+
"./spinner": {
|
|
136
|
+
"types": "./dist/spinner.d.ts",
|
|
137
|
+
"default": "./dist/spinner.js"
|
|
138
|
+
},
|
|
139
|
+
"./switch": {
|
|
140
|
+
"types": "./dist/switch.d.ts",
|
|
141
|
+
"default": "./dist/switch.js"
|
|
97
142
|
},
|
|
98
143
|
"./table": {
|
|
99
144
|
"types": "./dist/table.d.ts",
|
|
@@ -123,10 +168,18 @@
|
|
|
123
168
|
"types": "./dist/toggle-group.d.ts",
|
|
124
169
|
"default": "./dist/toggle-group.js"
|
|
125
170
|
},
|
|
171
|
+
"./tooltip": {
|
|
172
|
+
"types": "./dist/tooltip.d.ts",
|
|
173
|
+
"default": "./dist/tooltip.js"
|
|
174
|
+
},
|
|
126
175
|
"./form/date-picker-field": {
|
|
127
176
|
"types": "./dist/form/date-picker-field.d.ts",
|
|
128
177
|
"default": "./dist/form/date-picker-field.js"
|
|
129
178
|
},
|
|
179
|
+
"./form/date-time-picker-field": {
|
|
180
|
+
"types": "./dist/form/date-time-picker-field.d.ts",
|
|
181
|
+
"default": "./dist/form/date-time-picker-field.js"
|
|
182
|
+
},
|
|
130
183
|
"./form/field-error": {
|
|
131
184
|
"types": "./dist/form/field-error.d.ts",
|
|
132
185
|
"default": "./dist/form/field-error.js"
|