@alexandregme/zljs 1.5.0 → 1.7.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.
@@ -33,11 +33,11 @@ var error = tv({
33
33
 
34
34
  // core/forms/error/error.tsx
35
35
  import { jsx as jsx2 } from "react/jsx-runtime";
36
- var Error = ({ message }) => {
36
+ var Error = ({ id, message }) => {
37
37
  if (!message) {
38
38
  return null;
39
39
  }
40
- return /* @__PURE__ */ jsx2("span", { role: "alert", className: error(), children: message });
40
+ return /* @__PURE__ */ jsx2("span", { id, role: "alert", className: error(), children: message });
41
41
  };
42
42
 
43
43
  // core/forms/input/input.styles.ts
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import 'react-hook-form';
9
9
  /**
10
10
  * Semantic colors for action-oriented components (Button, Heading, etc.)
11
11
  */
12
- type SemanticColor = "primary" | "success" | "danger" | "warning" | "info" | "none";
12
+ type SemanticColor = "primary" | "success" | "danger" | "warning" | "info" | "muted" | "none";
13
13
  /**
14
14
  * Literal colors for data visualization components (StatsCard, etc.)
15
15
  */
@@ -69,21 +69,26 @@ interface DataGridProps<T extends Record<string, unknown> = Record<string, unkno
69
69
 
70
70
  declare const DataGrid: <T extends Record<string, unknown> = Record<string, unknown>>({ columns, data, showSearch, }: DataGridProps<T>) => react.JSX.Element;
71
71
 
72
+ type CheckboxVariant = "default" | "card";
72
73
  interface CheckboxProps {
73
- label: string;
74
+ label: ReactNode;
75
+ "aria-label"?: string;
76
+ variant?: CheckboxVariant;
77
+ size?: Size;
74
78
  checked?: boolean;
75
79
  disabled?: boolean;
76
80
  error?: string;
77
81
  onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
78
82
  }
79
83
 
80
- declare const Checkbox: ({ label: labelText, checked, disabled, error, onChange, }: CheckboxProps) => react.JSX.Element;
84
+ declare const Checkbox: ({ label: labelText, "aria-label": ariaLabel, variant, size, checked, disabled, error, onChange, }: CheckboxProps) => react.JSX.Element;
81
85
 
82
86
  interface ErrorProps {
87
+ id?: string;
83
88
  message: string;
84
89
  }
85
90
 
86
- declare const Error: ({ message }: ErrorProps) => react.JSX.Element | null;
91
+ declare const Error: ({ id, message }: ErrorProps) => react.JSX.Element | null;
87
92
 
88
93
  interface FormProps {
89
94
  children: ReactNode;
@@ -459,4 +464,4 @@ declare class HTTPClient {
459
464
  }
460
465
 
461
466
  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 };
462
- export type { AppState, AppWrapperProps, ButtonColor, ButtonProps, ButtonVariant, CheckboxProps, ConnectedModalProps, DataColor, DataGridColumn, DataGridProps, DocumentWrapperProps, ErrorProps, ExtendedStore, FormProps, GlobalStateProps, HeadingProps, HttpClientConfig, HttpRequestConfig, IconName, IconProps, InitPageFunction, InputProps, LoaderProps, ModalEntry, ModalProps, ModalState, PageState, PageWrapperProps, RadioProps, RouterState, SelectOption, SelectProps, SemanticColor, SidebarItem, SidebarProps, SidebarSection, SidebarUser, Size, SpinnerProps, SpinnerVariant, StatsCardProps, TagProps, TextAreaProps, TextProps, TextVariant, Toast, ToastState, ToastType, WhatsAppButtonProps };
467
+ export type { AppState, AppWrapperProps, ButtonColor, ButtonProps, ButtonVariant, CheckboxProps, CheckboxVariant, ConnectedModalProps, DataColor, DataGridColumn, DataGridProps, DocumentWrapperProps, ErrorProps, ExtendedStore, FormProps, GlobalStateProps, HeadingProps, HttpClientConfig, HttpRequestConfig, IconName, IconProps, InitPageFunction, InputProps, LoaderProps, ModalEntry, ModalProps, ModalState, PageState, PageWrapperProps, RadioProps, RouterState, SelectOption, SelectProps, SemanticColor, SidebarItem, SidebarProps, SidebarSection, SidebarUser, Size, SpinnerProps, SpinnerVariant, StatsCardProps, TagProps, TextAreaProps, TextProps, TextVariant, Toast, ToastState, ToastType, WhatsAppButtonProps };
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  FormInput,
5
5
  FormProvider,
6
6
  Input
7
- } from "./chunk-WAQLH7A5.js";
7
+ } from "./chunk-GDE6UMXP.js";
8
8
 
9
9
  // core/icon/icon.tsx
10
10
  import * as LucideIcons from "lucide-react";
@@ -62,6 +62,7 @@ var button = tv({
62
62
  danger: "bg-red-600 hover:bg-red-700 focus-visible:outline-red-600",
63
63
  warning: "bg-yellow-500 hover:bg-yellow-600 focus-visible:outline-yellow-700 text-gray-900",
64
64
  info: "bg-cyan-700 hover:bg-cyan-800 focus-visible:outline-cyan-700",
65
+ muted: "bg-gray-500 hover:bg-gray-600 focus-visible:outline-gray-500",
65
66
  ghost: "bg-transparent text-current hover:text-current hover:bg-neutral-500/20",
66
67
  none: ""
67
68
  },
@@ -125,6 +126,11 @@ var button = tv({
125
126
  color: "info",
126
127
  class: "text-cyan-700 hover:text-cyan-900"
127
128
  },
129
+ {
130
+ variant: "link",
131
+ color: "muted",
132
+ class: "text-gray-500 hover:text-gray-700"
133
+ },
128
134
  {
129
135
  variant: "link",
130
136
  color: "none",
@@ -214,27 +220,50 @@ var wrapper = tv2({
214
220
  base: "flex flex-col gap-1"
215
221
  });
216
222
  var innerWrapper = tv2({
217
- base: "flex items-center gap-2"
223
+ base: "flex cursor-pointer has-disabled:cursor-not-allowed",
224
+ variants: {
225
+ variant: {
226
+ default: "w-fit items-center gap-2",
227
+ card: "items-start gap-3 rounded-lg border border-gray-500 p-3 has-checked:border-blue-600 has-checked:ring-1 has-checked:ring-blue-600 has-disabled:bg-gray-100"
228
+ }
229
+ },
230
+ defaultVariants: {
231
+ variant: "default"
232
+ }
218
233
  });
219
234
  var checkbox = tv2({
220
- base: "w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500 disabled:cursor-not-allowed"
235
+ base: "shrink-0 text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500 disabled:cursor-not-allowed",
236
+ variants: {
237
+ size: {
238
+ sm: "w-3.5 h-3.5",
239
+ md: "w-4 h-4",
240
+ lg: "w-5 h-5"
241
+ }
242
+ },
243
+ defaultVariants: {
244
+ size: "md"
245
+ }
221
246
  });
222
247
  var label = tv2({
223
- base: "text-sm text-gray-700 select-none cursor-pointer"
248
+ base: "min-w-0 flex-1 text-sm text-gray-700 select-none"
224
249
  });
225
250
 
226
251
  // core/forms/checkbox/checkbox.tsx
227
252
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
228
253
  var Checkbox = ({
229
254
  label: labelText,
255
+ "aria-label": ariaLabel,
256
+ variant,
257
+ size,
230
258
  checked,
231
259
  disabled,
232
260
  error,
233
261
  onChange
234
262
  }) => {
235
263
  const id = useId();
264
+ const errorId = `${id}-error`;
236
265
  return /* @__PURE__ */ jsxs2("div", { className: wrapper(), children: [
237
- /* @__PURE__ */ jsxs2("div", { className: innerWrapper(), children: [
266
+ /* @__PURE__ */ jsxs2("label", { htmlFor: id, className: innerWrapper({ variant }), children: [
238
267
  /* @__PURE__ */ jsx3(
239
268
  "input",
240
269
  {
@@ -243,12 +272,15 @@ var Checkbox = ({
243
272
  checked,
244
273
  disabled,
245
274
  onChange,
246
- className: checkbox()
275
+ "aria-label": ariaLabel,
276
+ "aria-invalid": error ? true : void 0,
277
+ "aria-describedby": error ? errorId : void 0,
278
+ className: checkbox({ size })
247
279
  }
248
280
  ),
249
- /* @__PURE__ */ jsx3("label", { htmlFor: id, className: label(), children: labelText })
281
+ /* @__PURE__ */ jsx3("span", { className: label(), children: labelText })
250
282
  ] }),
251
- error && /* @__PURE__ */ jsx3(Error, { message: error })
283
+ error && /* @__PURE__ */ jsx3(Error, { id: errorId, message: error })
252
284
  ] });
253
285
  };
254
286
 
@@ -659,6 +691,7 @@ var text = tv8({
659
691
  danger: "text-red-600",
660
692
  warning: "text-yellow-700",
661
693
  info: "text-sky-700",
694
+ muted: "text-gray-500",
662
695
  none: ""
663
696
  }
664
697
  },
@@ -831,6 +864,7 @@ var heading = tv11({
831
864
  danger: "text-red-600",
832
865
  warning: "text-yellow-700",
833
866
  info: "text-sky-700",
867
+ muted: "text-gray-500",
834
868
  none: ""
835
869
  }
836
870
  },
package/dist/rhf/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  FormInput,
4
4
  FormProvider
5
- } from "../chunk-WAQLH7A5.js";
5
+ } from "../chunk-GDE6UMXP.js";
6
6
  export {
7
7
  FormInput,
8
8
  FormProvider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexandregme/zljs",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "Opinionated, accessible React component library for enterprise apps (Next.js, Tailwind CSS v4).",
5
5
  "keywords": [
6
6
  "react",