@alexandregme/zljs 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/dist/index.d.ts CHANGED
@@ -184,6 +184,15 @@ interface HeadingProps {
184
184
 
185
185
  declare const Heading: ({ children, level, color }: HeadingProps) => react.JSX.Element;
186
186
 
187
+ type TextVariant = "body" | "caption" | "display";
188
+ interface TextProps {
189
+ children: string | number;
190
+ as?: "p" | "span";
191
+ variant?: TextVariant;
192
+ }
193
+
194
+ declare const Text: ({ children, as: Tag, variant, }: TextProps) => react.JSX.Element;
195
+
187
196
  interface SidebarItem {
188
197
  icon: IconName;
189
198
  label: string;
@@ -443,5 +452,5 @@ declare class HTTPClient {
443
452
  patch<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T | undefined>;
444
453
  }
445
454
 
446
- export { AppWrapper, Button, Checkbox, ConnectedModal, DataGrid, DocumentWrapper, Error, Form, GlobalState, HTTPClient, Heading, Icon, Input, Loader, Modal, PageWrapper, Radio, Select, Sidebar, Spinner, StatsCard, Tag, TextArea, Toaster, WhatsAppButton, splitURLasPath, useAppStore, useModalStore, usePageStore, useRouterStore, useToastStore };
447
- export type { AppState, AppWrapperProps, ButtonProps, ButtonVariant, CheckboxProps, ConnectedModalProps, DataGridColumn, DataGridProps, DocumentWrapperProps, ErrorProps, ExtendedStore, FormProps, GlobalStateProps, HeadingProps, HttpClientConfig, HttpRequestConfig, IconName, InitPageFunction, InputProps, LoaderProps, ModalEntry, ModalProps, ModalState, PageState, PageWrapperProps, RadioProps, RouterState, SelectOption, SelectProps, SidebarItem, SidebarProps, SidebarSection, SidebarUser, SpinnerProps, StatsCardProps, TagProps, TextAreaProps, Toast, ToastState, ToastType, WhatsAppButtonProps };
455
+ export { AppWrapper, Button, Checkbox, ConnectedModal, DataGrid, DocumentWrapper, Error, Form, GlobalState, HTTPClient, Heading, Icon, Input, Loader, Modal, PageWrapper, Radio, Select, Sidebar, Spinner, StatsCard, Tag, Text, TextArea, Toaster, WhatsAppButton, splitURLasPath, useAppStore, useModalStore, usePageStore, useRouterStore, useToastStore };
456
+ export type { AppState, AppWrapperProps, ButtonProps, ButtonVariant, CheckboxProps, ConnectedModalProps, DataGridColumn, DataGridProps, DocumentWrapperProps, ErrorProps, ExtendedStore, FormProps, GlobalStateProps, HeadingProps, HttpClientConfig, HttpRequestConfig, IconName, InitPageFunction, InputProps, LoaderProps, ModalEntry, ModalProps, ModalState, PageState, PageWrapperProps, RadioProps, RouterState, SelectOption, SelectProps, SidebarItem, SidebarProps, SidebarSection, SidebarUser, SpinnerProps, StatsCardProps, TagProps, TextAreaProps, TextProps, TextVariant, Toast, ToastState, ToastType, WhatsAppButtonProps };
package/dist/index.js CHANGED
@@ -769,13 +769,38 @@ var Heading = ({ children, level = 1, color }) => {
769
769
  return /* @__PURE__ */ jsx15(Tag2, { className: heading({ level, color }), children });
770
770
  };
771
771
 
772
+ // core/text/text.styles.ts
773
+ import { tv as tv10 } from "tailwind-variants";
774
+ var text = tv10({
775
+ variants: {
776
+ variant: {
777
+ body: "text-base",
778
+ caption: "text-sm",
779
+ display: "text-3xl font-bold"
780
+ }
781
+ },
782
+ defaultVariants: {
783
+ variant: "body"
784
+ }
785
+ });
786
+
787
+ // core/text/text.tsx
788
+ import { jsx as jsx16 } from "react/jsx-runtime";
789
+ var Text = ({
790
+ children,
791
+ as: Tag2 = "p",
792
+ variant = "body"
793
+ }) => {
794
+ return /* @__PURE__ */ jsx16(Tag2, { "data-testid": "text", className: text({ variant }), children });
795
+ };
796
+
772
797
  // core/sidebar/sidebar.tsx
773
798
  import { useState as useState3 } from "react";
774
799
  import Link from "next/link";
775
800
 
776
801
  // core/sidebar/sidebar.styles.ts
777
- import { tv as tv10 } from "tailwind-variants";
778
- var sidebar = tv10({
802
+ import { tv as tv11 } from "tailwind-variants";
803
+ var sidebar = tv11({
779
804
  base: "h-screen bg-neutral-800 text-neutral-300 flex flex-col overflow-hidden transition-all duration-200",
780
805
  variants: {
781
806
  collapsed: {
@@ -787,16 +812,16 @@ var sidebar = tv10({
787
812
  collapsed: false
788
813
  }
789
814
  });
790
- var nav = tv10({
815
+ var nav = tv11({
791
816
  base: "flex-1 min-h-0 overflow-y-auto overflow-x-hidden"
792
817
  });
793
- var header2 = tv10({
818
+ var header2 = tv11({
794
819
  base: "shrink-0 border-b border-neutral-600/50 grid p-2"
795
820
  });
796
- var section = tv10({
821
+ var section = tv11({
797
822
  base: "border-b border-neutral-600/50 last:border-b-0 grid gap-1 p-2"
798
823
  });
799
- var item = tv10({
824
+ var item = tv11({
800
825
  base: "flex w-full items-center rounded-md text-sm whitespace-nowrap transition-colors cursor-pointer p-1",
801
826
  variants: {
802
827
  active: {
@@ -808,10 +833,10 @@ var item = tv10({
808
833
  active: false
809
834
  }
810
835
  });
811
- var itemIcon = tv10({
836
+ var itemIcon = tv11({
812
837
  base: "p-2"
813
838
  });
814
- var itemLabel = tv10({
839
+ var itemLabel = tv11({
815
840
  base: "truncate transition-all duration-200",
816
841
  variants: {
817
842
  collapsed: {
@@ -823,27 +848,27 @@ var itemLabel = tv10({
823
848
  collapsed: false
824
849
  }
825
850
  });
826
- var footer = tv10({
851
+ var footer = tv11({
827
852
  base: "shrink-0 border-t border-neutral-600/50 p-3 flex items-center gap-3 whitespace-nowrap"
828
853
  });
829
- var avatar = tv10({
854
+ var avatar = tv11({
830
855
  base: "shrink-0 w-8 h-8 rounded-full bg-neutral-600 text-white text-xs font-medium flex items-center justify-center"
831
856
  });
832
- var userInfo = tv10({
857
+ var userInfo = tv11({
833
858
  base: "flex flex-col min-w-0"
834
859
  });
835
- var userName = tv10({
860
+ var userName = tv11({
836
861
  base: "text-sm text-white truncate"
837
862
  });
838
- var userEmail = tv10({
863
+ var userEmail = tv11({
839
864
  base: "text-xs text-neutral-400"
840
865
  });
841
- var toggleButton = tv10({
866
+ var toggleButton = tv11({
842
867
  base: "shrink-0 border-t border-neutral-600/50 grid p-2 [&>button]:justify-start [&>button]:overflow-hidden [&>button]:whitespace-nowrap"
843
868
  });
844
869
 
845
870
  // core/sidebar/sidebar.tsx
846
- import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
871
+ import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
847
872
  var getInitials = (name) => {
848
873
  const parts = name.trim().split(/\s+/);
849
874
  if (parts.length >= 2) {
@@ -864,19 +889,19 @@ var Sidebar = ({
864
889
  const [collapsed, setCollapsed] = useState3(defaultCollapsed);
865
890
  const initials = getInitials(user.name);
866
891
  return /* @__PURE__ */ jsxs12("aside", { className: sidebar({ collapsed }), children: [
867
- homeHref && /* @__PURE__ */ jsx16(
892
+ homeHref && /* @__PURE__ */ jsx17(
868
893
  Link,
869
894
  {
870
895
  href: homeHref,
871
896
  className: header2(),
872
897
  "aria-label": homeLabel || "Home",
873
898
  children: /* @__PURE__ */ jsxs12("span", { className: item({ active: homeHref === activeHref }), children: [
874
- /* @__PURE__ */ jsx16("span", { className: itemIcon(), children: /* @__PURE__ */ jsx16(Icon, { name: "Home" }) }),
875
- /* @__PURE__ */ jsx16("span", { className: itemLabel({ collapsed }), children: homeLabel })
899
+ /* @__PURE__ */ jsx17("span", { className: itemIcon(), children: /* @__PURE__ */ jsx17(Icon, { name: "Home" }) }),
900
+ /* @__PURE__ */ jsx17("span", { className: itemLabel({ collapsed }), children: homeLabel })
876
901
  ] })
877
902
  }
878
903
  ),
879
- /* @__PURE__ */ jsx16("nav", { "aria-label": "Main navigation", className: nav(), children: sections.map((sectionData, i) => /* @__PURE__ */ jsx16("div", { className: section(), children: sectionData.items.map((sidebarItem) => {
904
+ /* @__PURE__ */ jsx17("nav", { "aria-label": "Main navigation", className: nav(), children: sections.map((sectionData, i) => /* @__PURE__ */ jsx17("div", { className: section(), children: sectionData.items.map((sidebarItem) => {
880
905
  const isActive = sidebarItem.href === activeHref;
881
906
  return /* @__PURE__ */ jsxs12(
882
907
  Link,
@@ -885,20 +910,20 @@ var Sidebar = ({
885
910
  className: item({ active: isActive }),
886
911
  ...isActive && { "aria-current": "page" },
887
912
  children: [
888
- /* @__PURE__ */ jsx16("span", { className: itemIcon(), children: /* @__PURE__ */ jsx16(Icon, { name: sidebarItem.icon }) }),
889
- /* @__PURE__ */ jsx16("span", { className: itemLabel({ collapsed }), children: sidebarItem.label })
913
+ /* @__PURE__ */ jsx17("span", { className: itemIcon(), children: /* @__PURE__ */ jsx17(Icon, { name: sidebarItem.icon }) }),
914
+ /* @__PURE__ */ jsx17("span", { className: itemLabel({ collapsed }), children: sidebarItem.label })
890
915
  ]
891
916
  },
892
917
  sidebarItem.href
893
918
  );
894
919
  }) }, i)) }),
895
920
  /* @__PURE__ */ jsxs12("div", { className: footer(), children: [
896
- /* @__PURE__ */ jsx16("div", { className: avatar(), children: initials }),
921
+ /* @__PURE__ */ jsx17("div", { className: avatar(), children: initials }),
897
922
  /* @__PURE__ */ jsxs12("div", { className: userInfo(), children: [
898
- /* @__PURE__ */ jsx16("span", { className: userName(), children: user.name }),
899
- /* @__PURE__ */ jsx16("span", { className: userEmail(), children: user.email })
923
+ /* @__PURE__ */ jsx17("span", { className: userName(), children: user.name }),
924
+ /* @__PURE__ */ jsx17("span", { className: userEmail(), children: user.email })
900
925
  ] }),
901
- /* @__PURE__ */ jsx16(
926
+ /* @__PURE__ */ jsx17(
902
927
  Button,
903
928
  {
904
929
  variant: "ghost",
@@ -908,7 +933,7 @@ var Sidebar = ({
908
933
  }
909
934
  )
910
935
  ] }),
911
- /* @__PURE__ */ jsx16("div", { className: toggleButton(), children: /* @__PURE__ */ jsx16(
936
+ /* @__PURE__ */ jsx17("div", { className: toggleButton(), children: /* @__PURE__ */ jsx17(
912
937
  Button,
913
938
  {
914
939
  variant: "ghost",
@@ -957,7 +982,7 @@ var useToastStore = create()(
957
982
  );
958
983
 
959
984
  // core/toaster/toaster.tsx
960
- import { jsx as jsx17 } from "react/jsx-runtime";
985
+ import { jsx as jsx18 } from "react/jsx-runtime";
961
986
  var Toaster = () => {
962
987
  const toasts = useToastStore((s) => s.toasts);
963
988
  const removeToast = useToastStore((s) => s.removeToast);
@@ -970,7 +995,7 @@ var Toaster = () => {
970
995
  removeToast(t.id);
971
996
  });
972
997
  }, [toasts, removeToast]);
973
- return /* @__PURE__ */ jsx17(
998
+ return /* @__PURE__ */ jsx18(
974
999
  SonnerToaster,
975
1000
  {
976
1001
  position: "bottom-right",
@@ -1049,7 +1074,7 @@ import {
1049
1074
  combineReducers,
1050
1075
  configureStore
1051
1076
  } from "@reduxjs/toolkit";
1052
- import { jsx as jsx18 } from "react/jsx-runtime";
1077
+ import { jsx as jsx19 } from "react/jsx-runtime";
1053
1078
  var store;
1054
1079
  var persistentReducers = {};
1055
1080
  var dynamicReducers = {};
@@ -1088,7 +1113,7 @@ var GlobalState = ({
1088
1113
  preloadedState,
1089
1114
  coreReducers
1090
1115
  );
1091
- return /* @__PURE__ */ jsx18(Provider, { store: reduxStore, children });
1116
+ return /* @__PURE__ */ jsx19(Provider, { store: reduxStore, children });
1092
1117
  };
1093
1118
 
1094
1119
  // core/state/router/router.store.ts
@@ -1147,7 +1172,7 @@ var usePageStore = create5()(
1147
1172
  import { useEffect as useEffect2 } from "react";
1148
1173
  import { useDispatch, useStore } from "react-redux";
1149
1174
  import { useRouter } from "next/compat/router";
1150
- import { Fragment as Fragment4, jsx as jsx19 } from "react/jsx-runtime";
1175
+ import { Fragment as Fragment4, jsx as jsx20 } from "react/jsx-runtime";
1151
1176
  var PageWrapper = ({
1152
1177
  reducers,
1153
1178
  title: title2,
@@ -1171,11 +1196,11 @@ var PageWrapper = ({
1171
1196
  initPage(dispatch);
1172
1197
  }
1173
1198
  }, []);
1174
- return /* @__PURE__ */ jsx19(Fragment4, { children });
1199
+ return /* @__PURE__ */ jsx20(Fragment4, { children });
1175
1200
  };
1176
1201
 
1177
1202
  // core/connected-modal/connected-modal.tsx
1178
- import { jsx as jsx20 } from "react/jsx-runtime";
1203
+ import { jsx as jsx21 } from "react/jsx-runtime";
1179
1204
  var ConnectedModal = ({
1180
1205
  modalId,
1181
1206
  title: title2,
@@ -1185,7 +1210,7 @@ var ConnectedModal = ({
1185
1210
  }) => {
1186
1211
  const isOpen = useModalStore((s) => s.isOpen(modalId));
1187
1212
  const closeModal = useModalStore((s) => s.closeModal);
1188
- return /* @__PURE__ */ jsx20(
1213
+ return /* @__PURE__ */ jsx21(
1189
1214
  Modal,
1190
1215
  {
1191
1216
  open: isOpen,
@@ -1202,34 +1227,34 @@ var ConnectedModal = ({
1202
1227
  import { LoaderCircle } from "lucide-react";
1203
1228
 
1204
1229
  // core/spinner/spinner.styles.ts
1205
- import { tv as tv11 } from "tailwind-variants";
1206
- var spinner = tv11({
1230
+ import { tv as tv12 } from "tailwind-variants";
1231
+ var spinner = tv12({
1207
1232
  base: "animate-spin w-20 h-20 text-white stroke-[0.3]"
1208
1233
  });
1209
1234
 
1210
1235
  // core/spinner/spinner.tsx
1211
- import { jsx as jsx21 } from "react/jsx-runtime";
1212
- var Spinner = ({ className }) => /* @__PURE__ */ jsx21(LoaderCircle, { className: spinner({ className }), strokeWidth: 1 });
1236
+ import { jsx as jsx22 } from "react/jsx-runtime";
1237
+ var Spinner = ({ className }) => /* @__PURE__ */ jsx22(LoaderCircle, { className: spinner({ className }), strokeWidth: 1 });
1213
1238
 
1214
1239
  // core/loader/loader.styles.ts
1215
- import { tv as tv12 } from "tailwind-variants";
1216
- var overlay2 = tv12({
1240
+ import { tv as tv13 } from "tailwind-variants";
1241
+ var overlay2 = tv13({
1217
1242
  base: "flex fixed justify-center items-center w-full h-full bg-black/20 z-50"
1218
1243
  });
1219
1244
 
1220
1245
  // core/loader/loader.tsx
1221
- import { jsx as jsx22 } from "react/jsx-runtime";
1246
+ import { jsx as jsx23 } from "react/jsx-runtime";
1222
1247
  var Loader = ({ label: label5 = "Loading" }) => {
1223
1248
  const fetching = useAppStore((s) => s.fetching);
1224
1249
  if (!fetching) return null;
1225
- return /* @__PURE__ */ jsx22("div", { role: "status", "aria-label": label5, className: overlay2(), children: /* @__PURE__ */ jsx22(Spinner, {}) });
1250
+ return /* @__PURE__ */ jsx23("div", { role: "status", "aria-label": label5, className: overlay2(), children: /* @__PURE__ */ jsx23(Spinner, {}) });
1226
1251
  };
1227
1252
 
1228
1253
  // core/app-wrapper/app-wrapper.tsx
1229
1254
  import { useEffect as useEffect3 } from "react";
1230
1255
  import { useRouter as useRouter2 } from "next/compat/router";
1231
1256
  import { SessionProvider } from "next-auth/react";
1232
- import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
1257
+ import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
1233
1258
  var AppWrapper = ({
1234
1259
  children,
1235
1260
  reducers,
@@ -1243,15 +1268,15 @@ var AppWrapper = ({
1243
1268
  setRoute(router.asPath);
1244
1269
  }
1245
1270
  }, [router?.isReady, router?.asPath, setRoute]);
1246
- return /* @__PURE__ */ jsx23(SessionProvider, { children: /* @__PURE__ */ jsxs13(
1271
+ return /* @__PURE__ */ jsx24(SessionProvider, { children: /* @__PURE__ */ jsxs13(
1247
1272
  GlobalState,
1248
1273
  {
1249
1274
  reducers,
1250
1275
  middlewares,
1251
1276
  coreReducers,
1252
1277
  children: [
1253
- /* @__PURE__ */ jsx23(Loader, {}),
1254
- /* @__PURE__ */ jsx23(Toaster, {}),
1278
+ /* @__PURE__ */ jsx24(Loader, {}),
1279
+ /* @__PURE__ */ jsx24(Toaster, {}),
1255
1280
  children
1256
1281
  ]
1257
1282
  }
@@ -1259,13 +1284,13 @@ var AppWrapper = ({
1259
1284
  };
1260
1285
 
1261
1286
  // core/document-wrapper/document-wrapper.tsx
1262
- import { jsx as jsx24 } from "react/jsx-runtime";
1287
+ import { jsx as jsx25 } from "react/jsx-runtime";
1263
1288
  var DocumentWrapper = ({
1264
1289
  children,
1265
1290
  lang = "pt-BR",
1266
1291
  className
1267
1292
  }) => {
1268
- return /* @__PURE__ */ jsx24("html", { lang, children: /* @__PURE__ */ jsx24("body", { className, children }) });
1293
+ return /* @__PURE__ */ jsx25("html", { lang, children: /* @__PURE__ */ jsx25("body", { className, children }) });
1269
1294
  };
1270
1295
 
1271
1296
  // core/http/http.client.ts
@@ -1364,6 +1389,7 @@ export {
1364
1389
  Spinner,
1365
1390
  StatsCard,
1366
1391
  Tag,
1392
+ Text,
1367
1393
  TextArea,
1368
1394
  Toaster,
1369
1395
  WhatsAppButton,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexandregme/zljs",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Opinionated, accessible React component library for enterprise apps (Next.js, Tailwind CSS v4).",
5
5
  "keywords": [
6
6
  "react",