@alexandregme/zljs 1.16.0 → 1.18.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.
@@ -1,6 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { SemanticColor } from '../index.js';
3
+ import { SemanticColor, ReduxProviderProps } from '../index.js';
4
+ import { ThunkDispatch, UnknownAction, Reducer } from '@reduxjs/toolkit';
4
5
 
5
6
  interface RootLayoutProps {
6
7
  children: ReactNode;
@@ -25,5 +26,19 @@ interface LinkProps {
25
26
 
26
27
  declare const Link: ({ children, href, color }: LinkProps) => react.JSX.Element;
27
28
 
28
- export { Link, NotFound, RootLayout };
29
- export type { LinkProps, NotFoundProps, RootLayoutProps };
29
+ type AppProvidersProps = ReduxProviderProps;
30
+
31
+ declare const AppProviders: ({ children, ...store }: AppProvidersProps) => react.JSX.Element;
32
+
33
+ type InitPageFunction = (dispatch: ThunkDispatch<any, undefined, UnknownAction>) => void;
34
+ interface PageConfigProps {
35
+ children: ReactNode;
36
+ title: string;
37
+ reducers?: Record<string, Reducer>;
38
+ initPage?: InitPageFunction;
39
+ }
40
+
41
+ declare const PageConfig: ({ children, title, reducers, initPage, }: PageConfigProps) => react.JSX.Element;
42
+
43
+ export { AppProviders, Link, NotFound, PageConfig, RootLayout };
44
+ export type { AppProvidersProps, InitPageFunction, LinkProps, NotFoundProps, PageConfigProps, RootLayoutProps };
@@ -1,8 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  Heading,
4
- Text
5
- } from "../chunk-CXA5QIHP.js";
4
+ Loader,
5
+ ReduxProvider,
6
+ Text,
7
+ Toaster,
8
+ usePageStore,
9
+ useRouterStore
10
+ } from "../chunk-BYW2ZJKS.js";
6
11
 
7
12
  // core/next/root-layout/root-layout.styles.ts
8
13
  import { tv } from "tailwind-variants";
@@ -74,8 +79,58 @@ var NotFound = ({
74
79
  /* @__PURE__ */ jsx3(Link, { href: backHref, children: backLabel })
75
80
  ] });
76
81
  };
82
+
83
+ // core/next/app-providers/app-providers.tsx
84
+ import { useEffect } from "react";
85
+ import { usePathname } from "next/navigation.js";
86
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
87
+ var AppProviders = ({ children, ...store }) => {
88
+ const pathname = usePathname();
89
+ const setRoute = useRouterStore((s) => s.setRoute);
90
+ useEffect(() => {
91
+ if (pathname) {
92
+ setRoute(`${pathname}${window.location.search}`);
93
+ }
94
+ }, [pathname, setRoute]);
95
+ return /* @__PURE__ */ jsxs2(ReduxProvider, { ...store, children: [
96
+ /* @__PURE__ */ jsx4(Loader, {}),
97
+ /* @__PURE__ */ jsx4(Toaster, {}),
98
+ children
99
+ ] });
100
+ };
101
+
102
+ // core/next/page-config/page-config.tsx
103
+ import { useEffect as useEffect2 } from "react";
104
+ import { useDispatch, useStore } from "react-redux";
105
+ import { Fragment, jsx as jsx5 } from "react/jsx-runtime";
106
+ var PageConfig = ({
107
+ children,
108
+ title,
109
+ reducers,
110
+ initPage
111
+ }) => {
112
+ const store = useStore();
113
+ const dispatch = useDispatch();
114
+ const setTitle = usePageStore((s) => s.setTitle);
115
+ useEffect2(() => {
116
+ if (reducers) {
117
+ store.setDynamicReducers(reducers);
118
+ }
119
+ }, [reducers]);
120
+ useEffect2(() => {
121
+ setTitle(title);
122
+ }, [title, setTitle]);
123
+ useEffect2(() => {
124
+ if (initPage) {
125
+ initPage(dispatch);
126
+ }
127
+ }, []);
128
+ return /* @__PURE__ */ jsx5(Fragment, { children });
129
+ };
77
130
  export {
131
+ AppProviders,
78
132
  Link,
79
133
  NotFound,
134
+ PageConfig,
80
135
  RootLayout
81
136
  };
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from 'react';
2
+ import { Reducer, Middleware } from '@reduxjs/toolkit';
3
+
4
+ /**
5
+ * Semantic colors for action-oriented components (Button, Heading, etc.)
6
+ */
7
+ type SemanticColor = "primary" | "success" | "danger" | "warning" | "info" | "muted" | "none";
8
+ /**
9
+ * Literal colors for data visualization components (StatsCard, etc.)
10
+ */
11
+ type DataColor = "blue" | "red" | "yellow" | "green" | "gray" | "orange";
12
+
13
+ interface ReduxProviderProps {
14
+ children: ReactNode;
15
+ reducers?: Record<string, Reducer>;
16
+ middlewares?: Middleware[];
17
+ preloadedState?: Record<string, unknown>;
18
+ coreReducers?: Record<string, Reducer>;
19
+ }
20
+
21
+ export type { DataColor as D, ReduxProviderProps as R, SemanticColor as S };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexandregme/zljs",
3
- "version": "1.16.0",
3
+ "version": "1.18.0",
4
4
  "description": "Opinionated, accessible React component library for enterprise apps (Next.js, Tailwind CSS v4).",
5
5
  "keywords": [
6
6
  "react",
@@ -128,7 +128,6 @@
128
128
  "peerDependencies": {
129
129
  "@reduxjs/toolkit": "^2.0.0",
130
130
  "next": ">=16.0.0",
131
- "next-auth": "^4.0.0",
132
131
  "react": "^19.0.0",
133
132
  "react-dom": "^19.0.0",
134
133
  "react-redux": "^9.0.0"
@@ -1,83 +0,0 @@
1
- "use client";
2
-
3
- // core/text/text.styles.ts
4
- import { tv } from "tailwind-variants";
5
-
6
- // core/types/colors/colors.const.ts
7
- var semanticTextColors = {
8
- primary: "text-zl-primary",
9
- success: "text-zl-success",
10
- danger: "text-zl-danger",
11
- warning: "text-zl-warning",
12
- info: "text-zl-info",
13
- muted: "text-zl-muted",
14
- none: ""
15
- };
16
-
17
- // core/text/text.styles.ts
18
- var text = tv({
19
- variants: {
20
- variant: {
21
- body: "text-base",
22
- caption: "text-sm",
23
- display: "text-3xl font-bold"
24
- },
25
- color: semanticTextColors
26
- },
27
- defaultVariants: {
28
- variant: "body"
29
- }
30
- });
31
-
32
- // core/text/text.tsx
33
- import { jsx } from "react/jsx-runtime";
34
- var Text = ({
35
- children,
36
- as: Tag = "p",
37
- variant = "body",
38
- color
39
- }) => {
40
- return /* @__PURE__ */ jsx(Tag, { "data-testid": "text", className: text({ variant, color }), children });
41
- };
42
-
43
- // core/heading/heading.const.ts
44
- var headingTags = {
45
- 1: "h1",
46
- 2: "h2",
47
- 3: "h3",
48
- 4: "h4",
49
- 5: "h5",
50
- 6: "h6"
51
- };
52
-
53
- // core/heading/heading.styles.ts
54
- import { tv as tv2 } from "tailwind-variants";
55
- var heading = tv2({
56
- variants: {
57
- level: {
58
- 1: "text-3xl font-bold",
59
- 2: "text-2xl font-bold",
60
- 3: "text-xl font-semibold",
61
- 4: "text-lg font-semibold",
62
- 5: "text-base font-medium",
63
- 6: "text-sm font-medium"
64
- },
65
- color: semanticTextColors
66
- },
67
- defaultVariants: {
68
- level: 1
69
- }
70
- });
71
-
72
- // core/heading/heading.tsx
73
- import { jsx as jsx2 } from "react/jsx-runtime";
74
- var Heading = ({ children, level = 1, color }) => {
75
- const Tag = headingTags[level];
76
- return /* @__PURE__ */ jsx2(Tag, { className: heading({ level, color }), children });
77
- };
78
-
79
- export {
80
- semanticTextColors,
81
- Text,
82
- Heading
83
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * Semantic colors for action-oriented components (Button, Heading, etc.)
3
- */
4
- type SemanticColor = "primary" | "success" | "danger" | "warning" | "info" | "muted" | "none";
5
- /**
6
- * Literal colors for data visualization components (StatsCard, etc.)
7
- */
8
- type DataColor = "blue" | "red" | "yellow" | "green" | "gray" | "orange";
9
-
10
- export type { DataColor as D, SemanticColor as S };