@alexandregme/zljs 2.1.2 → 2.2.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
+ ## [2.2.0] - 2026-11-10
12
+
13
+ ### Added
14
+
15
+ - `Card`, a surface with a border, rounded corners and a soft shadow, which groups what belongs together. `title`, `titleLevel` and `message` show a header above the children, and `color` sets the border, a light background and the shadow from the theme. It takes the width of its parent
16
+
11
17
  ## [2.1.2] - 2026-11-04
12
18
 
13
19
  ### Fixed
@@ -375,7 +381,8 @@ Replace the shade with the class of the `color` being tested, for example `/(^|\
375
381
 
376
382
  The message of `Error` is `text-zl-danger`. `none` and `ghost` didn't change.
377
383
 
378
- [Unreleased]: https://github.com/alexandregme/zljs/compare/v2.1.2...HEAD
384
+ [Unreleased]: https://github.com/alexandregme/zljs/compare/v2.2.0...HEAD
385
+ [2.2.0]: https://github.com/alexandregme/zljs/compare/v2.1.2...v2.2.0
379
386
  [2.1.2]: https://github.com/alexandregme/zljs/compare/v2.1.0...v2.1.2
380
387
  [2.1.0]: https://github.com/alexandregme/zljs/compare/v2.0.1...v2.1.0
381
388
  [2.0.1]: https://github.com/alexandregme/zljs/compare/v2.0.0...v2.0.1
package/dist/index.d.ts CHANGED
@@ -430,6 +430,20 @@ interface ConnectedModalProps {
430
430
 
431
431
  declare const ConnectedModal: ({ modalId, title, description, size, children, }: ConnectedModalProps) => react.JSX.Element;
432
432
 
433
+ interface CardProps {
434
+ children: ReactNode;
435
+ /** Shows above the children, as a heading. */
436
+ title?: string;
437
+ /** The heading level of `title`: 1 when the card is the whole page. */
438
+ titleLevel?: 1 | 2 | 3 | 4 | 5 | 6;
439
+ /** Shows under `title`. Muted on a white card. */
440
+ message?: string;
441
+ /** The border and a light background in that color. `none` is white. */
442
+ color?: SemanticColor;
443
+ }
444
+
445
+ declare const Card: ({ children, title, titleLevel, message, color, }: CardProps) => react.JSX.Element;
446
+
433
447
  type SpinnerVariant = "circle" | "dots" | "refresh";
434
448
  interface SpinnerProps {
435
449
  variant?: SpinnerVariant;
@@ -468,5 +482,5 @@ declare class HTTPClient {
468
482
  patch<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T | undefined>;
469
483
  }
470
484
 
471
- export { AuxiliaryColor, Button, Checkbox, ConnectedModal, DataColor, DataGrid, Error, Form, HTTPClient, Heading, Icon, Input, Loader, Modal, Radio, ReduxProvider, ReduxProviderProps, Select, SemanticColor, Sidebar, Spinner, StatsCard, Tag, Text, TextArea, Toaster, WhatsAppButton, splitURLasPath, useAppStore, useModalStore, usePageStore, useRouterStore, useToastStore };
472
- export type { AppState, ButtonColor, ButtonProps, ButtonVariant, CheckboxProps, CheckboxVariant, ConnectedModalProps, DataGridColumn, DataGridProps, ErrorProps, FormProps, HeadingProps, HttpClientConfig, HttpRequestConfig, IconName, IconProps, InputProps, LoaderProps, ModalEntry, ModalProps, ModalState, PageState, RadioProps, ReduxStore, RouterState, SelectOption, SelectProps, SidebarItem, SidebarProps, SidebarSection, SidebarUser, Size, SpinnerProps, SpinnerVariant, StatsCardProps, TagColor, TagProps, TextAreaProps, TextProps, TextVariant, Toast, ToastState, ToastType, WhatsAppButtonProps };
485
+ export { AuxiliaryColor, Button, Card, Checkbox, ConnectedModal, DataColor, DataGrid, Error, Form, HTTPClient, Heading, Icon, Input, Loader, Modal, Radio, ReduxProvider, ReduxProviderProps, Select, SemanticColor, Sidebar, Spinner, StatsCard, Tag, Text, TextArea, Toaster, WhatsAppButton, splitURLasPath, useAppStore, useModalStore, usePageStore, useRouterStore, useToastStore };
486
+ export type { AppState, ButtonColor, ButtonProps, ButtonVariant, CardProps, CheckboxProps, CheckboxVariant, ConnectedModalProps, DataGridColumn, DataGridProps, ErrorProps, FormProps, HeadingProps, HttpClientConfig, HttpRequestConfig, IconName, IconProps, InputProps, LoaderProps, ModalEntry, ModalProps, ModalState, PageState, RadioProps, ReduxStore, RouterState, SelectOption, SelectProps, SidebarItem, SidebarProps, SidebarSection, SidebarUser, Size, SpinnerProps, SpinnerVariant, StatsCardProps, TagColor, TagProps, TextAreaProps, TextProps, TextVariant, Toast, ToastState, ToastType, WhatsAppButtonProps };
package/dist/index.js CHANGED
@@ -1042,6 +1042,57 @@ var ConnectedModal = ({
1042
1042
  );
1043
1043
  };
1044
1044
 
1045
+ // core/card/card.styles.ts
1046
+ import { tv as tv12 } from "tailwind-variants";
1047
+ var card = tv12({
1048
+ slots: {
1049
+ // A soft, wide shadow in the color of the card. shadow-sm only spreads 1 to
1050
+ // 3px and reads as part of the border on a white page.
1051
+ base: "flex flex-col gap-6 w-full p-6 rounded-2xl border shadow-lg",
1052
+ header: "flex flex-col gap-1"
1053
+ },
1054
+ variants: {
1055
+ color: {
1056
+ primary: {
1057
+ base: "border-zl-primary bg-zl-primary/15 shadow-zl-primary/20"
1058
+ },
1059
+ success: {
1060
+ base: "border-zl-success bg-zl-success/15 shadow-zl-success/20"
1061
+ },
1062
+ danger: { base: "border-zl-danger bg-zl-danger/15 shadow-zl-danger/20" },
1063
+ warning: {
1064
+ base: "border-zl-warning bg-zl-warning/15 shadow-zl-warning/20"
1065
+ },
1066
+ info: { base: "border-zl-info bg-zl-info/15 shadow-zl-info/20" },
1067
+ muted: { base: "border-zl-muted bg-zl-muted/15 shadow-zl-muted/20" },
1068
+ none: { base: "border-gray-200 bg-white shadow-black/12" }
1069
+ }
1070
+ },
1071
+ defaultVariants: {
1072
+ color: "none"
1073
+ }
1074
+ });
1075
+
1076
+ // core/card/card.tsx
1077
+ import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
1078
+ var Card = ({
1079
+ children,
1080
+ title: title2,
1081
+ titleLevel = 2,
1082
+ message,
1083
+ color = "none"
1084
+ }) => {
1085
+ const { base, header: header3 } = card({ color });
1086
+ const messageColor = color === "none" ? "muted" : "none";
1087
+ return /* @__PURE__ */ jsxs13("div", { "data-testid": "card", className: base(), children: [
1088
+ (title2 || message) && /* @__PURE__ */ jsxs13("div", { className: header3(), children: [
1089
+ title2 && /* @__PURE__ */ jsx16(Heading, { level: titleLevel, children: title2 }),
1090
+ message && /* @__PURE__ */ jsx16(Text, { color: messageColor, children: message })
1091
+ ] }),
1092
+ children
1093
+ ] });
1094
+ };
1095
+
1045
1096
  // core/http/http.client.ts
1046
1097
  import axios from "axios";
1047
1098
  var HTTPClient = class {
@@ -1115,6 +1166,7 @@ var HTTPClient = class {
1115
1166
  };
1116
1167
  export {
1117
1168
  Button,
1169
+ Card,
1118
1170
  Checkbox,
1119
1171
  ConnectedModal,
1120
1172
  DataGrid,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexandregme/zljs",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "description": "Opinionated, accessible React component library for enterprise apps (Next.js, Tailwind CSS v4).",
5
5
  "keywords": [
6
6
  "react",