@alexandregme/zljs 0.3.11 → 0.4.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
@@ -6,13 +6,6 @@ import * as zustand from 'zustand';
6
6
  import { Store, Reducer, Middleware, Dispatch } from '@reduxjs/toolkit';
7
7
  import 'react-hook-form';
8
8
 
9
- declare const iconNames: readonly ["Check", "X", "Plus", "Minus", "Search", "Menu", "ChevronDown", "ChevronUp", "ChevronLeft", "ChevronRight", "Pencil", "Trash2", "Save", "RefreshCw", "Home", "MessageSquare", "Users", "Store", "ShoppingCart", "BarChart3", "Brain", "Send", "LogOut", "User", "Key", "Contact", "Package", "Warehouse", "HandCoins", "Stethoscope", "LogIn", "Megaphone", "LayoutDashboard", "Smile", "Frown", "Cat", "ArrowRight", "Loader", "CheckCircle", "XCircle", "AlertTriangle", "Info", "Map", "CloudDownload", "Wrench", "GitMerge", "SiWhatsapp", "SiFacebook", "SiInstagram", "SiShopify"];
10
-
11
- type IconName = (typeof iconNames)[number];
12
- interface IconProps {
13
- name: IconName;
14
- }
15
-
16
9
  /**
17
10
  * Semantic colors for action-oriented components (Button, Heading, etc.)
18
11
  */
@@ -22,12 +15,26 @@ type SemanticColor = "primary" | "success" | "danger" | "warning" | "info" | "no
22
15
  */
23
16
  type DataColor = "blue" | "red" | "yellow" | "green" | "gray" | "orange";
24
17
 
18
+ /**
19
+ * Sizes shared by every sized component (Icon, Button, Input, etc.)
20
+ */
21
+ type Size = "sm" | "md";
22
+
23
+ declare const iconNames: readonly ["Check", "X", "Plus", "Minus", "Search", "Menu", "ChevronDown", "ChevronUp", "ChevronLeft", "ChevronRight", "Pencil", "Trash2", "Save", "RefreshCw", "Home", "MessageSquare", "Users", "Store", "ShoppingCart", "BarChart3", "Brain", "Send", "LogOut", "User", "Key", "Contact", "Package", "Warehouse", "HandCoins", "Stethoscope", "LogIn", "Megaphone", "LayoutDashboard", "Smile", "Frown", "Cat", "ArrowRight", "Loader", "CheckCircle", "XCircle", "AlertTriangle", "Info", "SiWhatsapp", "SiFacebook", "SiInstagram", "SiShopify"];
24
+
25
+ type IconName = (typeof iconNames)[number];
26
+ interface IconProps {
27
+ name: IconName;
28
+ size?: Size;
29
+ }
30
+
25
31
  type ButtonVariant = "default" | "icon" | "ghost" | "link";
26
32
  interface ButtonProps {
27
33
  children?: ReactNode;
28
34
  type?: "button" | "submit" | "reset";
29
35
  variant?: ButtonVariant;
30
36
  color?: SemanticColor;
37
+ size?: Size;
31
38
  icon?: IconName;
32
39
  iconPosition?: "left" | "right";
33
40
  disabled?: boolean;
@@ -35,7 +42,7 @@ interface ButtonProps {
35
42
  onClick?: () => void;
36
43
  }
37
44
 
38
- declare const Button: ({ children, type, variant: variantProp, color, icon, iconPosition, disabled, "aria-label": ariaLabel, onClick, }: ButtonProps) => react.JSX.Element;
45
+ declare const Button: ({ children, type, variant: variantProp, color, size, icon, iconPosition, disabled, "aria-label": ariaLabel, onClick, }: ButtonProps) => react.JSX.Element;
39
46
 
40
47
  interface DataGridCellParams<T extends Record<string, unknown> = Record<string, unknown>> {
41
48
  value?: any;
@@ -138,7 +145,7 @@ interface TextAreaProps {
138
145
 
139
146
  declare const TextArea: ({ label: labelText, placeholder, value, rows, error, disabled, onChange, }: TextAreaProps) => react.JSX.Element;
140
147
 
141
- declare const Icon: ({ name }: IconProps) => react.JSX.Element;
148
+ declare const Icon: ({ name, size }: IconProps) => react.JSX.Element;
142
149
 
143
150
  interface StatsCardProps {
144
151
  label: string;
@@ -204,11 +211,11 @@ declare const Sidebar: ({ sections, user, activeHref, defaultCollapsed, collapse
204
211
 
205
212
  interface TagProps {
206
213
  children: ReactNode;
207
- color?: "blue" | "green" | "red" | "yellow" | "gray";
214
+ color?: DataColor;
208
215
  onRemove?: () => void;
209
- className?: string;
210
216
  }
211
- declare const Tag: ({ children, color, onRemove, className, }: TagProps) => react.JSX.Element;
217
+
218
+ declare const Tag: ({ children, color, onRemove }: TagProps) => react.JSX.Element;
212
219
 
213
220
  declare const Toaster: () => react.JSX.Element;
214
221
 
package/dist/index.js CHANGED
@@ -8,19 +8,27 @@ import {
8
8
 
9
9
  // core/icon/icon.tsx
10
10
  import * as LucideIcons from "lucide-react";
11
+
12
+ // core/icon/icon.const.ts
11
13
  import { SiWhatsapp, SiFacebook, SiInstagram, SiShopify } from "react-icons/si";
12
- import { Fragment, jsx } from "react/jsx-runtime";
13
- var brandIcons = {
14
+ var iconBrands = {
14
15
  SiWhatsapp,
15
16
  SiFacebook,
16
17
  SiInstagram,
17
18
  SiShopify
18
19
  };
19
- var Icon = ({ name }) => {
20
+ var iconSizes = {
21
+ sm: 12,
22
+ md: 16
23
+ };
24
+
25
+ // core/icon/icon.tsx
26
+ import { Fragment, jsx } from "react/jsx-runtime";
27
+ var Icon = ({ name, size = "md" }) => {
20
28
  const isBrand = name.startsWith("Si");
21
- const IconComponent = isBrand ? brandIcons[name] : LucideIcons[name];
29
+ const IconComponent = isBrand ? iconBrands[name] : LucideIcons[name];
22
30
  if (!IconComponent) return /* @__PURE__ */ jsx(Fragment, {});
23
- return /* @__PURE__ */ jsx("span", { "data-testid": name, children: /* @__PURE__ */ jsx(IconComponent, { size: 16 }) });
31
+ return /* @__PURE__ */ jsx("span", { "data-testid": name, children: /* @__PURE__ */ jsx(IconComponent, { size: iconSizes[size] }) });
24
32
  };
25
33
 
26
34
  // core/button/button.styles.ts
@@ -41,9 +49,23 @@ var button = tv({
41
49
  warning: "bg-yellow-500 hover:bg-yellow-600 focus:ring-yellow-500 text-gray-900",
42
50
  info: "bg-cyan-500 hover:bg-cyan-600 focus:ring-cyan-500",
43
51
  none: ""
52
+ },
53
+ size: {
54
+ sm: "",
55
+ md: ""
44
56
  }
45
57
  },
46
58
  compoundVariants: [
59
+ {
60
+ variant: "default",
61
+ size: "sm",
62
+ class: "px-2 py-1 text-xs gap-1"
63
+ },
64
+ {
65
+ variant: "icon",
66
+ size: "sm",
67
+ class: "p-0.5"
68
+ },
47
69
  {
48
70
  variant: "link",
49
71
  color: "primary",
@@ -62,7 +84,8 @@ var button = tv({
62
84
  ],
63
85
  defaultVariants: {
64
86
  variant: "default",
65
- color: "primary"
87
+ color: "primary",
88
+ size: "md"
66
89
  }
67
90
  });
68
91
 
@@ -73,6 +96,7 @@ var Button = ({
73
96
  type = "button",
74
97
  variant: variantProp,
75
98
  color = "primary",
99
+ size = "md",
76
100
  icon,
77
101
  iconPosition = "left",
78
102
  disabled = false,
@@ -85,7 +109,7 @@ var Button = ({
85
109
  if (!icon) {
86
110
  return children;
87
111
  }
88
- const iconElement = /* @__PURE__ */ jsx2(Icon, { name: icon });
112
+ const iconElement = /* @__PURE__ */ jsx2(Icon, { name: icon, size });
89
113
  if (isIconOnly) {
90
114
  return iconElement;
91
115
  }
@@ -106,7 +130,8 @@ var Button = ({
106
130
  "aria-label": ariaLabel,
107
131
  className: button({
108
132
  variant,
109
- color: variant === "icon" || variant === "ghost" ? "none" : color
133
+ color: variant === "icon" || variant === "ghost" ? "none" : color,
134
+ size
110
135
  }),
111
136
  children: renderContent()
112
137
  }
@@ -373,7 +398,8 @@ var tag = tv7({
373
398
  green: "bg-green-100 text-green-700",
374
399
  red: "bg-red-100 text-red-700",
375
400
  yellow: "bg-yellow-100 text-yellow-700",
376
- gray: "bg-slate-100 text-slate-700"
401
+ gray: "bg-slate-100 text-slate-700",
402
+ orange: "bg-orange-100 text-orange-700"
377
403
  }
378
404
  },
379
405
  defaultVariants: {
@@ -383,24 +409,10 @@ var tag = tv7({
383
409
 
384
410
  // core/tag/tag.tsx
385
411
  import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
386
- var Tag = ({
387
- children,
388
- color = "blue",
389
- onRemove,
390
- className
391
- }) => {
392
- return /* @__PURE__ */ jsxs7("span", { className: tag({ color, className }), children: [
412
+ var Tag = ({ children, color = "blue", onRemove }) => {
413
+ return /* @__PURE__ */ jsxs7("span", { "data-testid": "tag", className: tag({ color }), children: [
393
414
  children,
394
- onRemove && /* @__PURE__ */ jsx9(
395
- "button",
396
- {
397
- type: "button",
398
- onClick: onRemove,
399
- className: "ml-1 hover:opacity-70 focus:outline-none",
400
- "aria-label": "Remover",
401
- children: "\xD7"
402
- }
403
- )
415
+ onRemove && /* @__PURE__ */ jsx9(Button, { size: "sm", icon: "X", "aria-label": "Remover", onClick: onRemove })
404
416
  ] });
405
417
  };
406
418
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexandregme/zljs",
3
- "version": "0.3.11",
3
+ "version": "0.4.0",
4
4
  "description": "Opinionated, accessible React component library for enterprise apps (Next.js, Tailwind CSS v4).",
5
5
  "keywords": [
6
6
  "react",