@alexandregme/zljs 3.9.0 → 3.10.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/CHANGELOG.md +10 -1
- package/dist/index.d.ts +25 -2
- package/dist/index.js +57 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,14 @@ A change that needs action in an app has a **Migration** note. When updating, re
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [3.10.0] - 2026-11-12
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- `Tabs`, which splits a page into panels and shows one at a time. It takes `tabs`, each with an `id`, a `label`, its panel in `children`, and optionally a `subtitle` under the label and a `count` at the right edge of the tab, and an `aria-label` that names the list. `defaultTab` picks the tab selected at first, and `onChange` is called with the `id` of the tab the user selects. A border goes around the tabs and the panel. Only the selected panel is rendered, and the URL doesn't change. In a parent with a height, the panel fills what the list of tabs leaves
|
|
16
|
+
- The types `TabsProps` and `TabsItem`
|
|
17
|
+
- `@radix-ui/react-tabs` as a dependency
|
|
18
|
+
|
|
11
19
|
## [3.9.0] - 2026-11-12
|
|
12
20
|
|
|
13
21
|
### Changed
|
|
@@ -471,7 +479,8 @@ Replace the shade with the class of the `color` being tested, for example `/(^|\
|
|
|
471
479
|
|
|
472
480
|
The message of `Error` is `text-zl-danger`. `none` and `ghost` didn't change.
|
|
473
481
|
|
|
474
|
-
[Unreleased]: https://github.com/alexandregme/zljs/compare/v3.
|
|
482
|
+
[Unreleased]: https://github.com/alexandregme/zljs/compare/v3.10.0...HEAD
|
|
483
|
+
[3.10.0]: https://github.com/alexandregme/zljs/compare/v3.9.0...v3.10.0
|
|
475
484
|
[3.9.0]: https://github.com/alexandregme/zljs/compare/v3.8.0...v3.9.0
|
|
476
485
|
[3.8.0]: https://github.com/alexandregme/zljs/compare/v3.7.0...v3.8.0
|
|
477
486
|
[3.7.0]: https://github.com/alexandregme/zljs/compare/v3.6.0...v3.7.0
|
package/dist/index.d.ts
CHANGED
|
@@ -266,6 +266,29 @@ interface SidebarProps {
|
|
|
266
266
|
|
|
267
267
|
declare const Sidebar: ({ sections, user, activeHref, defaultCollapsed, collapseLabel, homeHref, homeLabel, onLogout, }: SidebarProps) => react.JSX.Element;
|
|
268
268
|
|
|
269
|
+
interface TabsItem {
|
|
270
|
+
/** Unique among the tabs. `defaultTab` and `onChange` use it. */
|
|
271
|
+
id: string;
|
|
272
|
+
label: string;
|
|
273
|
+
/** Shows under `label`, in the tab. */
|
|
274
|
+
subtitle?: string;
|
|
275
|
+
/** Shows at the right edge of the tab, such as how many rows the panel has. */
|
|
276
|
+
count?: number;
|
|
277
|
+
/** The panel of the tab. Only the selected one is rendered. */
|
|
278
|
+
children: ReactNode;
|
|
279
|
+
}
|
|
280
|
+
interface TabsProps {
|
|
281
|
+
tabs: TabsItem[];
|
|
282
|
+
/** Names the list of tabs for screen readers. */
|
|
283
|
+
"aria-label": string;
|
|
284
|
+
/** The `id` of the tab selected at first. The first tab when not set. */
|
|
285
|
+
defaultTab?: string;
|
|
286
|
+
/** Called with the `id` of the tab the user selected. */
|
|
287
|
+
onChange?: (id: string) => void;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
declare const Tabs: ({ tabs, "aria-label": ariaLabel, defaultTab, onChange, }: TabsProps) => react.JSX.Element;
|
|
291
|
+
|
|
269
292
|
type TagColor = Exclude<SemanticColor, "none"> | AuxiliaryColor;
|
|
270
293
|
interface TagProps {
|
|
271
294
|
children: ReactNode;
|
|
@@ -574,5 +597,5 @@ declare const useAuth: () => UseAuthResult;
|
|
|
574
597
|
|
|
575
598
|
declare const ZustandProviders: ({ children, auth }: ZustandProvidersProps) => react.JSX.Element;
|
|
576
599
|
|
|
577
|
-
export { AccessPending, AuthAdapter, AuthProvider, AuthSession, Authorized, AuxiliaryColor, Button, Card, Checkbox, ConnectedModal, DataColor, DataGrid, Error, Form, HTTPClient, Heading, Icon, Input, Loader, Login, Modal, Radio, ReduxProvider, ReduxProviderProps, Select, SemanticColor, Sidebar, SignOutButton, Spinner, StatsCard, Tag, Text, TextArea, Toaster, WhatsAppButton, ZustandProviders, ZustandProvidersProps, appInitialState, getAuthSession, splitURLasPath, useAppStore, useAuth, usePageStore, useRouterStore, useToastStore };
|
|
578
|
-
export type { AppState, AuthorizedProps, ButtonColor, ButtonProps, ButtonVariant, CardProps, CheckboxProps, CheckboxVariant, ConnectedModalProps, DataGridColumn, DataGridProps, ErrorProps, FormProps, HeadingProps, HttpClientConfig, HttpRequestConfig, IconName, IconProps, InputProps, LoaderProps, LoginProvider, LoginVendor, ModalProps, PageState, RadioProps, ReduxStore, RouterState, SelectOption, SelectProps, SidebarItem, SidebarProps, SidebarSection, SidebarUser, Size, SpinnerProps, SpinnerVariant, StatsCardProps, TagColor, TagProps, TextAreaProps, TextProps, TextVariant, Toast, ToastState, ToastType, WhatsAppButtonProps };
|
|
600
|
+
export { AccessPending, AuthAdapter, AuthProvider, AuthSession, Authorized, AuxiliaryColor, Button, Card, Checkbox, ConnectedModal, DataColor, DataGrid, Error, Form, HTTPClient, Heading, Icon, Input, Loader, Login, Modal, Radio, ReduxProvider, ReduxProviderProps, Select, SemanticColor, Sidebar, SignOutButton, Spinner, StatsCard, Tabs, Tag, Text, TextArea, Toaster, WhatsAppButton, ZustandProviders, ZustandProvidersProps, appInitialState, getAuthSession, splitURLasPath, useAppStore, useAuth, usePageStore, useRouterStore, useToastStore };
|
|
601
|
+
export type { AppState, AuthorizedProps, ButtonColor, ButtonProps, ButtonVariant, CardProps, CheckboxProps, CheckboxVariant, ConnectedModalProps, DataGridColumn, DataGridProps, ErrorProps, FormProps, HeadingProps, HttpClientConfig, HttpRequestConfig, IconName, IconProps, InputProps, LoaderProps, LoginProvider, LoginVendor, ModalProps, PageState, RadioProps, ReduxStore, RouterState, SelectOption, SelectProps, SidebarItem, SidebarProps, SidebarSection, SidebarUser, Size, SpinnerProps, SpinnerVariant, StatsCardProps, TabsItem, TabsProps, TagColor, TagProps, TextAreaProps, TextProps, TextVariant, Toast, ToastState, ToastType, WhatsAppButtonProps };
|
package/dist/index.js
CHANGED
|
@@ -782,6 +782,62 @@ var Sidebar = ({
|
|
|
782
782
|
] });
|
|
783
783
|
};
|
|
784
784
|
|
|
785
|
+
// core/tabs/tabs.tsx
|
|
786
|
+
import * as RadixTabs from "@radix-ui/react-tabs";
|
|
787
|
+
|
|
788
|
+
// core/tabs/tabs.styles.ts
|
|
789
|
+
import { tv as tv10 } from "tailwind-variants";
|
|
790
|
+
var tabs = tv10({
|
|
791
|
+
slots: {
|
|
792
|
+
// A border around the tabs and the panel, which holds them together. Takes
|
|
793
|
+
// the height of a parent that has one, and the panel gets what the list
|
|
794
|
+
// leaves, so a panel can fill the page. With no height around it, both
|
|
795
|
+
// follow their content.
|
|
796
|
+
base: "flex h-full w-full flex-col overflow-hidden rounded-lg border border-gray-200",
|
|
797
|
+
list: "flex shrink-0 overflow-x-auto border-b border-gray-200",
|
|
798
|
+
// A line between the tabs, and the selected one stands out three ways: a
|
|
799
|
+
// white background next to the gray ones, a line under it and its label in
|
|
800
|
+
// the primary color. A tab grows to share the width of the list and never
|
|
801
|
+
// shrinks under its content, so the list scrolls when they don't fit. The
|
|
802
|
+
// outline sits inside the tab, because the border clips what overflows it.
|
|
803
|
+
// The first and the last tab follow the round corners of the border, so
|
|
804
|
+
// the outline does too.
|
|
805
|
+
tab: "flex min-h-11 min-w-max shrink-0 grow basis-0 cursor-pointer items-center justify-between gap-3 border-r border-b-2 border-r-gray-200 border-b-transparent bg-gray-50 px-4 py-2 text-left text-gray-700 first:rounded-tl-[calc(var(--radius-lg)-1px)] last:rounded-tr-[calc(var(--radius-lg)-1px)] last:border-r-0 hover:text-gray-900 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-zl-primary data-[state=active]:border-b-zl-primary data-[state=active]:bg-white data-[state=active]:text-zl-primary",
|
|
806
|
+
// The label and the subtitle on the left, and the count at the right edge.
|
|
807
|
+
text: "flex flex-col justify-center gap-0.5 [&>:first-child]:font-medium",
|
|
808
|
+
panel: "min-h-0 flex-1 overflow-auto p-4 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-zl-primary"
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
|
|
812
|
+
// core/tabs/tabs.tsx
|
|
813
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
814
|
+
var Tabs = ({
|
|
815
|
+
tabs: tabs2,
|
|
816
|
+
"aria-label": ariaLabel,
|
|
817
|
+
defaultTab = tabs2[0]?.id,
|
|
818
|
+
onChange
|
|
819
|
+
}) => {
|
|
820
|
+
const { base, list, tab, text, panel } = tabs();
|
|
821
|
+
return /* @__PURE__ */ jsxs11(
|
|
822
|
+
RadixTabs.Root,
|
|
823
|
+
{
|
|
824
|
+
className: base(),
|
|
825
|
+
defaultValue: defaultTab,
|
|
826
|
+
onValueChange: onChange,
|
|
827
|
+
children: [
|
|
828
|
+
/* @__PURE__ */ jsx13(RadixTabs.List, { className: list(), "aria-label": ariaLabel, children: tabs2.map(({ id, label: label5, subtitle, count }) => /* @__PURE__ */ jsxs11(RadixTabs.Trigger, { value: id, className: tab(), children: [
|
|
829
|
+
/* @__PURE__ */ jsxs11("span", { className: text(), children: [
|
|
830
|
+
/* @__PURE__ */ jsx13(Text, { as: "span", children: label5 }),
|
|
831
|
+
subtitle && /* @__PURE__ */ jsx13(Text, { as: "span", variant: "caption", color: "muted", children: subtitle })
|
|
832
|
+
] }),
|
|
833
|
+
count !== void 0 && /* @__PURE__ */ jsx13(Tag, { color: "primary", size: "md", children: count })
|
|
834
|
+
] }, id)) }),
|
|
835
|
+
tabs2.map(({ id, children }) => /* @__PURE__ */ jsx13(RadixTabs.Content, { value: id, className: panel(), children }, id))
|
|
836
|
+
]
|
|
837
|
+
}
|
|
838
|
+
);
|
|
839
|
+
};
|
|
840
|
+
|
|
785
841
|
// core/http/http.client.ts
|
|
786
842
|
import axios from "axios";
|
|
787
843
|
var HTTPClient = class {
|
|
@@ -880,6 +936,7 @@ export {
|
|
|
880
936
|
SignOutButton,
|
|
881
937
|
Spinner,
|
|
882
938
|
StatsCard,
|
|
939
|
+
Tabs,
|
|
883
940
|
Tag,
|
|
884
941
|
Text,
|
|
885
942
|
TextArea,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexandregme/zljs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"description": "Opinionated, accessible React component library for enterprise apps (Next.js, Tailwind CSS v4).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"@ag-grid-community/locale": "^36.2.0",
|
|
76
76
|
"@hookform/resolvers": "^5.2.2",
|
|
77
77
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
78
|
+
"@radix-ui/react-tabs": "^1.2.1",
|
|
78
79
|
"ag-grid-community": "^36.2.0",
|
|
79
80
|
"ag-grid-react": "^36.2.0",
|
|
80
81
|
"axios": "^1.13.5",
|