atlas-react-kit 0.8.1 → 0.8.2
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 +1 -1
- package/DESIGN_RULES.md +4 -3
- package/README.md +2 -2
- package/dist/internal/tabs-styles.d.ts +13 -1
- package/dist/internal/tabs-styles.js +21 -1
- package/dist/tabs.d.ts +3 -2
- package/dist/tabs.js +9 -7
- package/package.json +1 -1
package/COMPONENTS.md
CHANGED
|
@@ -43,7 +43,7 @@ no root component barrel.
|
|
|
43
43
|
| `switch` | `Switch`; settings that apply immediately; square track and thumb |
|
|
44
44
|
| `table` | Table, header, body, footer, row, head, cell, caption; root scroller is `min-w-0 overflow-x-auto` with a fade cue; cells are `px-2` below `sm` |
|
|
45
45
|
| `table-body-skeleton` | `TableBodySkeleton`; `columns`, optional `rows` (default 5) |
|
|
46
|
-
| `tabs` | `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`, `TabsNav`, `tabsListVariants`, `tabsTriggerVariants`; list `variant` is `default` or `line`; style `TabsNav` links with `tabsTriggerVariants()`; `TabsNav` / `TabsList` scroll horizontally only (`overflow-y` hidden, edge fade, active item into view) — do not wrap them in `overflow-x-auto`
|
|
46
|
+
| `tabs` | `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`, `TabsNav`, `tabsListVariants`, `tabsTriggerVariants`; list `variant` is `default` or `line`; style `TabsNav` links with `tabsTriggerVariants()`; `TabsNav` / `TabsList` scroll horizontally only (`overflow-y` hidden, `p-1` counted in the scroller height, edge fade, active item into view) — do not wrap them in `overflow-x-auto` |
|
|
47
47
|
| `toast` | `Toaster`, `toast`; mount one `Toaster` (`position`, `closeButton` (default on), `expand`, `visibleToasts`, `duration`), then `toast(message, options)`, `.success`, `.info`, `.warning`, `.error`, `.loading`, `.dismiss(id?)`. Options: `id` (replaces that toast), `description`, `duration`, `action` / `cancel` as `{ label, onClick }`. Kit-owned API: no toast library is exposed |
|
|
48
48
|
| `toggle` | `Toggle`, `toggleVariants`, `selectedToggleChrome`; `variant`, `size`. Pressed state is the selected wash, text, and border via `data-state=on`, `aria-pressed`, and `aria-checked` |
|
|
49
49
|
| `toggle-group` | `ToggleGroup`, `ToggleGroupItem`; `variant`, `size`. Items share `toggleVariants`, so single (radio) and multiple selections match a pressed `Toggle` |
|
package/DESIGN_RULES.md
CHANGED
|
@@ -105,9 +105,10 @@ Use `Tabs` with actual `TabsContent` panels. For URL view switches, use a labell
|
|
|
105
105
|
`TabsNav` with links and `aria-current="page"` on the active link. The optional
|
|
106
106
|
Next adapter provides `TabsNavLink` with this behavior. `TabsNav` and `TabsList`
|
|
107
107
|
scroll overflowing labels inside themselves (`overflow-x-auto overflow-y-hidden`,
|
|
108
|
-
with padding for the active border and focus ring
|
|
109
|
-
`Table`). Do not wrap them in another
|
|
110
|
-
`overflow-y: auto` and a stray
|
|
108
|
+
with padding for the active border and focus ring counted in the scroller
|
|
109
|
+
height, and an edge fade like `Table`). Do not wrap them in another
|
|
110
|
+
`overflow-x-auto` — that pairing forces `overflow-y: auto` and a stray
|
|
111
|
+
vertical scrollbar.
|
|
111
112
|
|
|
112
113
|
Use `FormTextField`, `FormSelectField`, `FormDatePickerField`,
|
|
113
114
|
`FormDateTimePickerField`, `FormMarkdownField`, and `FormFeedbackField` for
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ keeping locally (`InfoTip`, `ColorLegend`, `SearchPicker`, `Markdown`,
|
|
|
7
7
|
React 19 and Tailwind 4 are required.
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
npm install --save-exact atlas-react-kit@0.8.
|
|
10
|
+
npm install --save-exact atlas-react-kit@0.8.2
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Import components by subpath:
|
|
@@ -116,7 +116,7 @@ artifact with the package owner's npm login:
|
|
|
116
116
|
```sh
|
|
117
117
|
mkdir -p release-artifacts
|
|
118
118
|
npm pack --pack-destination release-artifacts
|
|
119
|
-
npm publish ./release-artifacts/atlas-react-kit-0.8.
|
|
119
|
+
npm publish ./release-artifacts/atlas-react-kit-0.8.2.tgz --access public
|
|
120
120
|
```
|
|
121
121
|
|
|
122
122
|
See [CONTRIBUTING.md](./CONTRIBUTING.md) for adding components, the browser
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
declare const tabsListVariants: (props?: ({
|
|
2
2
|
variant?: "default" | "line" | null | undefined;
|
|
3
3
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Horizontal scroller around a tab row. `p-1` leaves room for the active
|
|
6
|
+
* border and focus ring; the height is the `h-11` list plus that padding
|
|
7
|
+
* (`h-13` = 44px + 8px) so the list fits the content box. Putting padding
|
|
8
|
+
* on an overflow box without this height makes `scrollHeight` 4px taller
|
|
9
|
+
* than `clientHeight` (48 vs 44) and a vertical scrollbar appears if
|
|
10
|
+
* `overflow-y` is not hidden. Line variant adds `pb-2` for the underline
|
|
11
|
+
* (`h-14` = 44px + 4px + 8px).
|
|
12
|
+
*/
|
|
13
|
+
declare const tabsScrollerVariants: (props?: ({
|
|
14
|
+
variant?: "default" | "line" | null | undefined;
|
|
15
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
4
16
|
declare const tabsTriggerVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
5
|
-
export { tabsListVariants, tabsTriggerVariants };
|
|
17
|
+
export { tabsListVariants, tabsScrollerVariants, tabsTriggerVariants };
|
|
@@ -11,6 +11,26 @@ const tabsListVariants = cva('group/tabs-list inline-flex w-max min-w-full items
|
|
|
11
11
|
variant: "default",
|
|
12
12
|
},
|
|
13
13
|
});
|
|
14
|
+
/**
|
|
15
|
+
* Horizontal scroller around a tab row. `p-1` leaves room for the active
|
|
16
|
+
* border and focus ring; the height is the `h-11` list plus that padding
|
|
17
|
+
* (`h-13` = 44px + 8px) so the list fits the content box. Putting padding
|
|
18
|
+
* on an overflow box without this height makes `scrollHeight` 4px taller
|
|
19
|
+
* than `clientHeight` (48 vs 44) and a vertical scrollbar appears if
|
|
20
|
+
* `overflow-y` is not hidden. Line variant adds `pb-2` for the underline
|
|
21
|
+
* (`h-14` = 44px + 4px + 8px).
|
|
22
|
+
*/
|
|
23
|
+
const tabsScrollerVariants = cva("relative box-border w-full min-w-0 max-w-full overflow-x-auto overflow-y-hidden overscroll-x-contain p-1 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden", {
|
|
24
|
+
variants: {
|
|
25
|
+
variant: {
|
|
26
|
+
default: 'group-data-[orientation="horizontal"]/tabs:h-13',
|
|
27
|
+
line: 'group-data-[orientation="horizontal"]/tabs:h-14 pb-2',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
variant: "default",
|
|
32
|
+
},
|
|
33
|
+
});
|
|
14
34
|
const tabsTriggerVariants = cva([
|
|
15
35
|
focusRing,
|
|
16
36
|
disabledState,
|
|
@@ -22,4 +42,4 @@ const tabsTriggerVariants = cva([
|
|
|
22
42
|
selectedState.active,
|
|
23
43
|
'after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation="horizontal"]/tabs:after:inset-x-0 group-data-[orientation="horizontal"]/tabs:after:bottom-[-5px] group-data-[orientation="horizontal"]/tabs:after:h-0.5 group-data-[orientation="vertical"]/tabs:after:inset-y-0 group-data-[orientation="vertical"]/tabs:after:-right-1 group-data-[orientation="vertical"]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state="active"]:after:opacity-100',
|
|
24
44
|
]);
|
|
25
|
-
export { tabsListVariants, tabsTriggerVariants };
|
|
45
|
+
export { tabsListVariants, tabsScrollerVariants, tabsTriggerVariants };
|
package/dist/tabs.d.ts
CHANGED
|
@@ -15,8 +15,9 @@ declare function TabsContent({ className, ...props }: React.ComponentProps<typeo
|
|
|
15
15
|
* `TabsNavLink` does this for you).
|
|
16
16
|
*
|
|
17
17
|
* Overflow is handled here: the row scrolls horizontally only, with padding
|
|
18
|
-
* for active borders and focus rings
|
|
19
|
-
*
|
|
18
|
+
* for active borders and focus rings counted in the scroller height (so the
|
|
19
|
+
* list cannot overflow on y), an edge fade while it overflows, and the
|
|
20
|
+
* active link scrolled into view on mount. Do not wrap it in
|
|
20
21
|
* `overflow-x-auto`.
|
|
21
22
|
*/
|
|
22
23
|
declare function TabsNav({ className, children, ...props }: React.ComponentProps<"nav"> & {
|
package/dist/tabs.js
CHANGED
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import {} from "class-variance-authority";
|
|
5
5
|
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
6
6
|
import { focusRing } from "./internal/styles.js";
|
|
7
|
-
import { tabsListVariants, tabsTriggerVariants, } from "./internal/tabs-styles.js";
|
|
7
|
+
import { tabsListVariants, tabsScrollerVariants, tabsTriggerVariants, } from "./internal/tabs-styles.js";
|
|
8
8
|
import { useHorizontalOverflow } from "./internal/use-horizontal-overflow.js";
|
|
9
9
|
import { cn } from "./utils.js";
|
|
10
10
|
function Tabs({ className, orientation = "horizontal", ...props }) {
|
|
@@ -13,9 +13,10 @@ function Tabs({ className, orientation = "horizontal", ...props }) {
|
|
|
13
13
|
/**
|
|
14
14
|
* Horizontal scroller around a tab row. `overflow-x: auto` alone would
|
|
15
15
|
* compute `overflow-y` to `auto` as well (CSS overflow pairing), so the
|
|
16
|
-
* active tab's border and focus ring grow a vertical scrollbar.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* active tab's border and focus ring grow a vertical scrollbar. Pad for
|
|
17
|
+
* those strokes *inside* the box (`h-13` = `h-11` list + `p-1`), clip the
|
|
18
|
+
* y axis as a backstop, and fade the edges while the row overflows —
|
|
19
|
+
* same cue as `Table`.
|
|
19
20
|
*/
|
|
20
21
|
function TabsScroller({ variant = "default", children, }) {
|
|
21
22
|
const ref = React.useRef(null);
|
|
@@ -31,7 +32,7 @@ function TabsScroller({ variant = "default", children, }) {
|
|
|
31
32
|
behavior: "auto",
|
|
32
33
|
});
|
|
33
34
|
}, []);
|
|
34
|
-
return (_jsx("div", { ref: ref, "data-slot": "tabs-scroller", "data-variant": variant, tabIndex: overflowing ? 0 : undefined, className: cn(focusRing,
|
|
35
|
+
return (_jsx("div", { ref: ref, "data-slot": "tabs-scroller", "data-variant": variant, tabIndex: overflowing ? 0 : undefined, className: cn(focusRing, tabsScrollerVariants({ variant })), children: children }));
|
|
35
36
|
}
|
|
36
37
|
function TabsList({ className, variant = "default", ...props }) {
|
|
37
38
|
return (_jsx(TabsScroller, { variant: variant ?? "default", children: _jsx(TabsPrimitive.List, { "data-slot": "tabs-list", "data-variant": variant, className: cn(tabsListVariants({ variant }),
|
|
@@ -53,8 +54,9 @@ function TabsContent({ className, ...props }) {
|
|
|
53
54
|
* `TabsNavLink` does this for you).
|
|
54
55
|
*
|
|
55
56
|
* Overflow is handled here: the row scrolls horizontally only, with padding
|
|
56
|
-
* for active borders and focus rings
|
|
57
|
-
*
|
|
57
|
+
* for active borders and focus rings counted in the scroller height (so the
|
|
58
|
+
* list cannot overflow on y), an edge fade while it overflows, and the
|
|
59
|
+
* active link scrolled into view on mount. Do not wrap it in
|
|
58
60
|
* `overflow-x-auto`.
|
|
59
61
|
*/
|
|
60
62
|
function TabsNav({ className, children, ...props }) {
|