@alexandregme/zljs 1.6.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
@@ -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";
@@ -220,27 +220,50 @@ var wrapper = tv2({
220
220
  base: "flex flex-col gap-1"
221
221
  });
222
222
  var innerWrapper = tv2({
223
- 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
+ }
224
233
  });
225
234
  var checkbox = tv2({
226
- 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
+ }
227
246
  });
228
247
  var label = tv2({
229
- base: "text-sm text-gray-700 select-none cursor-pointer"
248
+ base: "min-w-0 flex-1 text-sm text-gray-700 select-none"
230
249
  });
231
250
 
232
251
  // core/forms/checkbox/checkbox.tsx
233
252
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
234
253
  var Checkbox = ({
235
254
  label: labelText,
255
+ "aria-label": ariaLabel,
256
+ variant,
257
+ size,
236
258
  checked,
237
259
  disabled,
238
260
  error,
239
261
  onChange
240
262
  }) => {
241
263
  const id = useId();
264
+ const errorId = `${id}-error`;
242
265
  return /* @__PURE__ */ jsxs2("div", { className: wrapper(), children: [
243
- /* @__PURE__ */ jsxs2("div", { className: innerWrapper(), children: [
266
+ /* @__PURE__ */ jsxs2("label", { htmlFor: id, className: innerWrapper({ variant }), children: [
244
267
  /* @__PURE__ */ jsx3(
245
268
  "input",
246
269
  {
@@ -249,12 +272,15 @@ var Checkbox = ({
249
272
  checked,
250
273
  disabled,
251
274
  onChange,
252
- className: checkbox()
275
+ "aria-label": ariaLabel,
276
+ "aria-invalid": error ? true : void 0,
277
+ "aria-describedby": error ? errorId : void 0,
278
+ className: checkbox({ size })
253
279
  }
254
280
  ),
255
- /* @__PURE__ */ jsx3("label", { htmlFor: id, className: label(), children: labelText })
281
+ /* @__PURE__ */ jsx3("span", { className: label(), children: labelText })
256
282
  ] }),
257
- error && /* @__PURE__ */ jsx3(Error, { message: error })
283
+ error && /* @__PURE__ */ jsx3(Error, { id: errorId, message: error })
258
284
  ] });
259
285
  };
260
286
 
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.6.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",