@alexandregme/zljs 3.20.0 → 3.21.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 CHANGED
@@ -8,6 +8,12 @@ A change that needs action in an app has a **Migration** note. When updating, re
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [3.21.0] - 2026-11-21
12
+
13
+ ### Added
14
+
15
+ - `Disclosure`: a line that opens and closes what is under it, made with the native `details` element. `summary` is the line that always shows and `children` is what it hides. `defaultOpen` starts it open, and `variant="outlined"` draws a border around it, for an item of a list. The types `DisclosureProps` and `DisclosureVariant` come with it
16
+
11
17
  ## [3.20.0] - 2026-11-21
12
18
 
13
19
  ### Added
@@ -611,7 +617,8 @@ Replace the shade with the class of the `color` being tested, for example `/(^|\
611
617
 
612
618
  The message of `Error` is `text-zl-danger`. `none` and `ghost` didn't change.
613
619
 
614
- [Unreleased]: https://github.com/alexandregme/zljs/compare/v3.20.0...HEAD
620
+ [Unreleased]: https://github.com/alexandregme/zljs/compare/v3.21.0...HEAD
621
+ [3.21.0]: https://github.com/alexandregme/zljs/compare/v3.20.0...v3.21.0
615
622
  [3.20.0]: https://github.com/alexandregme/zljs/compare/v3.19.0...v3.20.0
616
623
  [3.19.0]: https://github.com/alexandregme/zljs/compare/v3.18.0...v3.19.0
617
624
  [3.18.0]: https://github.com/alexandregme/zljs/compare/v3.17.0...v3.18.0
package/dist/index.d.ts CHANGED
@@ -193,6 +193,20 @@ type TextAreaProps = TextAreaName & {
193
193
 
194
194
  declare const TextArea: ({ label: labelText, "aria-label": ariaLabel, name, placeholder, autoComplete, value, rows, error, disabled, required, onChange, onBlur, onKeyDown, ref, }: TextAreaProps) => react.JSX.Element;
195
195
 
196
+ type DisclosureVariant = "plain" | "outlined";
197
+ interface DisclosureProps {
198
+ /** Hidden until the user opens it. */
199
+ children: ReactNode;
200
+ /** Always visible: the line the user clicks to open and close. */
201
+ summary: ReactNode;
202
+ /** Starts open. The user can still close it. */
203
+ defaultOpen?: boolean;
204
+ /** `outlined` draws a border around it, for an item of a list. */
205
+ variant?: DisclosureVariant;
206
+ }
207
+
208
+ declare const Disclosure: ({ children, summary, defaultOpen, variant, }: DisclosureProps) => react.JSX.Element;
209
+
196
210
  declare const Icon: ({ name, size, color, "aria-label": ariaLabel, }: IconProps) => react.JSX.Element;
197
211
 
198
212
  interface StatsCardProps {
@@ -775,5 +789,5 @@ declare const useAuth: () => UseAuthResult;
775
789
 
776
790
  declare const ZustandProviders: ({ children, auth }: ZustandProvidersProps) => react.JSX.Element;
777
791
 
778
- export { AccessPending, AuthAdapter, AuthProvider, AuthSession, Authorized, AuxiliaryColor, Button, Card, Checkbox, ConnectedModal, DataColor, DataGrid, Error, Form, HTTPClient, Heading, Icon, Input, InstallAppButton, Loader, Login, Modal, Navigation, Radio, ReduxProvider, ReduxProviderProps, Select, SemanticColor, ShareAppButton, Sidebar, SignOutButton, Spinner, StatsCard, Tabs, Tag, Text, TextArea, Toaster, TopNav, WhatsAppButton, ZustandProviders, ZustandProvidersProps, appInitialState, getAuthSession, splitURLasPath, toast, useAppStore, useAuth, useInstallApp, useIsDesktop, usePageStore, useRouterStore, useToastStore };
779
- export type { AppState, AuthorizedProps, ButtonColor, ButtonProps, ButtonVariant, CardProps, CheckboxProps, CheckboxVariant, ConnectedModalProps, DataGridColumn, DataGridProps, ErrorProps, FormProps, HeadingProps, HttpClientConfig, HttpRequestConfig, IconName, IconProps, IconSize, InputProps, InstallApp, InstallAppButtonProps, InstallAppWay, LoaderProps, LoginProvider, LoginVendor, ModalProps, NavigationMode, NavigationProps, PageState, RadioProps, ReduxStore, RouterState, SelectOption, SelectProps, ShareAppButtonProps, SidebarItem, SidebarProps, SidebarSection, SidebarUser, Size, SpinnerProps, SpinnerVariant, StatsCardProps, TabsItem, TabsProps, TagColor, TagProps, TextAreaProps, TextProps, TextVariant, Toast, ToastState, ToastType, TopNavProps, WhatsAppButtonProps };
792
+ export { AccessPending, AuthAdapter, AuthProvider, AuthSession, Authorized, AuxiliaryColor, Button, Card, Checkbox, ConnectedModal, DataColor, DataGrid, Disclosure, Error, Form, HTTPClient, Heading, Icon, Input, InstallAppButton, Loader, Login, Modal, Navigation, Radio, ReduxProvider, ReduxProviderProps, Select, SemanticColor, ShareAppButton, Sidebar, SignOutButton, Spinner, StatsCard, Tabs, Tag, Text, TextArea, Toaster, TopNav, WhatsAppButton, ZustandProviders, ZustandProvidersProps, appInitialState, getAuthSession, splitURLasPath, toast, useAppStore, useAuth, useInstallApp, useIsDesktop, usePageStore, useRouterStore, useToastStore };
793
+ export type { AppState, AuthorizedProps, ButtonColor, ButtonProps, ButtonVariant, CardProps, CheckboxProps, CheckboxVariant, ConnectedModalProps, DataGridColumn, DataGridProps, DisclosureProps, DisclosureVariant, ErrorProps, FormProps, HeadingProps, HttpClientConfig, HttpRequestConfig, IconName, IconProps, IconSize, InputProps, InstallApp, InstallAppButtonProps, InstallAppWay, LoaderProps, LoginProvider, LoginVendor, ModalProps, NavigationMode, NavigationProps, PageState, RadioProps, ReduxStore, RouterState, SelectOption, SelectProps, ShareAppButtonProps, SidebarItem, SidebarProps, SidebarSection, SidebarUser, Size, SpinnerProps, SpinnerVariant, StatsCardProps, TabsItem, TabsProps, TagColor, TagProps, TextAreaProps, TextProps, TextVariant, Toast, ToastState, ToastType, TopNavProps, WhatsAppButtonProps };
package/dist/index.js CHANGED
@@ -584,9 +584,44 @@ var DataGrid = ({
584
584
  ] });
585
585
  };
586
586
 
587
- // core/stats-card/stats-card.styles.ts
587
+ // core/disclosure/disclosure.styles.ts
588
588
  import { tv as tv8 } from "tailwind-variants";
589
- var statsCard = tv8({
589
+ var disclosure = tv8({
590
+ slots: {
591
+ base: "w-full",
592
+ // outline-current: the summary has no color of its own, so the outline follows the text around it.
593
+ summary: "cursor-pointer rounded-sm py-1 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current",
594
+ content: "pt-2"
595
+ },
596
+ variants: {
597
+ variant: {
598
+ plain: {},
599
+ outlined: { base: "rounded-lg border border-gray-200 bg-white p-3" }
600
+ }
601
+ },
602
+ defaultVariants: {
603
+ variant: "plain"
604
+ }
605
+ });
606
+
607
+ // core/disclosure/disclosure.tsx
608
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
609
+ var Disclosure = ({
610
+ children,
611
+ summary,
612
+ defaultOpen = false,
613
+ variant = "plain"
614
+ }) => {
615
+ const { base, summary: summaryClass, content } = disclosure({ variant });
616
+ return /* @__PURE__ */ jsxs9("details", { className: base(), open: defaultOpen, children: [
617
+ /* @__PURE__ */ jsx10("summary", { "data-testid": "disclosure-summary", className: summaryClass(), children: summary }),
618
+ /* @__PURE__ */ jsx10("div", { "data-testid": "disclosure-content", className: content(), children })
619
+ ] });
620
+ };
621
+
622
+ // core/stats-card/stats-card.styles.ts
623
+ import { tv as tv9 } from "tailwind-variants";
624
+ var statsCard = tv9({
590
625
  base: "p-4 rounded-lg",
591
626
  variants: {
592
627
  color: {
@@ -601,11 +636,11 @@ var statsCard = tv8({
601
636
  });
602
637
 
603
638
  // core/stats-card/stats-card.tsx
604
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
639
+ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
605
640
  var StatsCard = ({ label: label5, value, color }) => {
606
- return /* @__PURE__ */ jsxs9("div", { "data-testid": "stats-card", className: statsCard({ color }), children: [
607
- /* @__PURE__ */ jsx10(Text, { variant: "caption", children: label5 }),
608
- /* @__PURE__ */ jsx10(Text, { variant: "display", children: value })
641
+ return /* @__PURE__ */ jsxs10("div", { "data-testid": "stats-card", className: statsCard({ color }), children: [
642
+ /* @__PURE__ */ jsx11(Text, { variant: "caption", children: label5 }),
643
+ /* @__PURE__ */ jsx11(Text, { variant: "display", children: value })
609
644
  ] });
610
645
  };
611
646
 
@@ -615,7 +650,7 @@ var whatsappAppUrl = "whatsapp://send";
615
650
  var whatsappMobileUserAgent = /Android|iPhone|iPad|iPod/i;
616
651
 
617
652
  // core/whatsapp-button/whatsapp-button.tsx
618
- import { jsx as jsx11 } from "react/jsx-runtime";
653
+ import { jsx as jsx12 } from "react/jsx-runtime";
619
654
  var WhatsAppButton = ({
620
655
  phone,
621
656
  message,
@@ -640,15 +675,15 @@ var WhatsAppButton = ({
640
675
  }
641
676
  onClick?.();
642
677
  };
643
- return /* @__PURE__ */ jsx11(Button, { color: "success", icon: "SiWhatsapp", onClick: handleClick, children });
678
+ return /* @__PURE__ */ jsx12(Button, { color: "success", icon: "SiWhatsapp", onClick: handleClick, children });
644
679
  };
645
680
 
646
681
  // core/tabs/tabs.tsx
647
682
  import * as RadixTabs from "@radix-ui/react-tabs";
648
683
 
649
684
  // core/tabs/tabs.styles.ts
650
- import { tv as tv9 } from "tailwind-variants";
651
- var tabs = tv9({
685
+ import { tv as tv10 } from "tailwind-variants";
686
+ var tabs = tv10({
652
687
  slots: {
653
688
  // A border around the tabs and the panel, which holds them together. Takes
654
689
  // the height of a parent that has one, and the panel gets what the list
@@ -671,7 +706,7 @@ var tabs = tv9({
671
706
  });
672
707
 
673
708
  // core/tabs/tabs.tsx
674
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
709
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
675
710
  var Tabs = ({
676
711
  tabs: tabs2,
677
712
  "aria-label": ariaLabel,
@@ -679,21 +714,21 @@ var Tabs = ({
679
714
  onChange
680
715
  }) => {
681
716
  const { base, list, tab, text, panel } = tabs();
682
- return /* @__PURE__ */ jsxs10(
717
+ return /* @__PURE__ */ jsxs11(
683
718
  RadixTabs.Root,
684
719
  {
685
720
  className: base(),
686
721
  defaultValue: defaultTab,
687
722
  onValueChange: onChange,
688
723
  children: [
689
- /* @__PURE__ */ jsx12(RadixTabs.List, { className: list(), "aria-label": ariaLabel, children: tabs2.map(({ id, label: label5, subtitle, count }) => /* @__PURE__ */ jsxs10(RadixTabs.Trigger, { value: id, className: tab(), children: [
690
- /* @__PURE__ */ jsxs10("span", { className: text(), children: [
691
- /* @__PURE__ */ jsx12(Text, { as: "span", children: label5 }),
692
- subtitle && /* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", color: "muted", children: subtitle })
724
+ /* @__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: [
725
+ /* @__PURE__ */ jsxs11("span", { className: text(), children: [
726
+ /* @__PURE__ */ jsx13(Text, { as: "span", children: label5 }),
727
+ subtitle && /* @__PURE__ */ jsx13(Text, { as: "span", variant: "caption", color: "muted", children: subtitle })
693
728
  ] }),
694
- count !== void 0 && /* @__PURE__ */ jsx12(Tag, { color: "primary", size: "md", children: count })
729
+ count !== void 0 && /* @__PURE__ */ jsx13(Tag, { color: "primary", size: "md", children: count })
695
730
  ] }, id)) }),
696
- tabs2.map(({ id, children }) => /* @__PURE__ */ jsx12(RadixTabs.Content, { value: id, className: panel(), children }, id))
731
+ tabs2.map(({ id, children }) => /* @__PURE__ */ jsx13(RadixTabs.Content, { value: id, className: panel(), children }, id))
697
732
  ]
698
733
  }
699
734
  );
@@ -779,6 +814,7 @@ export {
779
814
  Checkbox,
780
815
  ConnectedModal,
781
816
  DataGrid,
817
+ Disclosure,
782
818
  Error,
783
819
  Form,
784
820
  FormInput,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexandregme/zljs",
3
- "version": "3.20.0",
3
+ "version": "3.21.0",
4
4
  "description": "Opinionated, accessible React component library for enterprise apps (Next.js, Tailwind CSS v4).",
5
5
  "keywords": [
6
6
  "react",