@adam-milo/ui 1.0.20 → 1.0.21

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/index8.js CHANGED
@@ -1,81 +1,95 @@
1
- import { jsxs as u, jsx as s } from "react/jsx-runtime";
2
- import { forwardRef as j, useId as C, useRef as g, useCallback as k } from "react";
3
- import { cn as y } from "./index17.js";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useId, useRef, useCallback } from "react";
3
+ import { cn } from "./index17.js";
4
4
  /* empty css */
5
- const x = j(
5
+ const Radio = forwardRef(
6
6
  ({
7
- label: d,
8
- error: r,
9
- helperText: o,
10
- className: _,
11
- id: f,
12
- required: n,
13
- disabled: l,
14
- checked: $,
15
- "data-cy": h,
16
- "data-testid": N,
17
- ...R
18
- }, a) => {
19
- const b = C(), e = f || b, p = `${e}-error`, m = `${e}-helper`, t = h || "radio", i = N || "radio", w = g(null), I = k(
20
- (c) => {
21
- w.current = c, a && (typeof a == "function" ? a(c) : "current" in a && (a.current = c));
7
+ label,
8
+ error,
9
+ helperText,
10
+ className,
11
+ id: providedId,
12
+ required,
13
+ disabled,
14
+ checked,
15
+ "data-cy": dataCy,
16
+ "data-testid": dataTestId,
17
+ ...props
18
+ }, ref) => {
19
+ const generatedId = useId();
20
+ const id = providedId || generatedId;
21
+ const errorId = `${id}-error`;
22
+ const helperId = `${id}-helper`;
23
+ const finalDataCy = dataCy || "radio";
24
+ const finalTestId = dataTestId || "radio";
25
+ const internalRef = useRef(null);
26
+ const combinedRef = useCallback(
27
+ (element) => {
28
+ internalRef.current = element;
29
+ if (!ref) return;
30
+ if (typeof ref === "function") {
31
+ ref(element);
32
+ } else if ("current" in ref) {
33
+ ref.current = element;
34
+ }
22
35
  },
23
- [a]
24
- ), v = d && n && !d.includes("*") ? `${d} *` : d;
25
- return /* @__PURE__ */ u(
36
+ [ref]
37
+ );
38
+ const displayLabel = label && required && !label.includes("*") ? `${label} *` : label;
39
+ return /* @__PURE__ */ jsxs(
26
40
  "div",
27
41
  {
28
- className: y("radio-wrapper", l && "radio-wrapper--disabled"),
29
- "data-cy": `${t}-wrapper`,
30
- "data-testid": `${i}-wrapper`,
42
+ className: cn("radio-wrapper", disabled && "radio-wrapper--disabled"),
43
+ "data-cy": `${finalDataCy}-wrapper`,
44
+ "data-testid": `${finalTestId}-wrapper`,
31
45
  children: [
32
- /* @__PURE__ */ u("div", { className: "radio__container", children: [
33
- /* @__PURE__ */ s(
46
+ /* @__PURE__ */ jsxs("div", { className: "radio__container", children: [
47
+ /* @__PURE__ */ jsx(
34
48
  "input",
35
49
  {
36
- ref: I,
37
- id: e,
50
+ ref: combinedRef,
51
+ id,
38
52
  type: "radio",
39
- checked: $,
40
- className: y("radio__input", r && "radio__input--error", _),
41
- "aria-describedby": r ? p : o ? m : void 0,
42
- "data-cy": t,
43
- "data-testid": i,
44
- disabled: l,
45
- required: n,
46
- ...R
53
+ checked,
54
+ className: cn("radio__input", error && "radio__input--error", className),
55
+ "aria-describedby": error ? errorId : helperText ? helperId : void 0,
56
+ "data-cy": finalDataCy,
57
+ "data-testid": finalTestId,
58
+ disabled,
59
+ required,
60
+ ...props
47
61
  }
48
62
  ),
49
- d && /* @__PURE__ */ s(
63
+ label && /* @__PURE__ */ jsx(
50
64
  "label",
51
65
  {
52
- htmlFor: e,
66
+ htmlFor: id,
53
67
  className: "radio__label",
54
- "data-cy": `${t}-label`,
55
- "data-testid": `${i}-label`,
56
- children: v
68
+ "data-cy": `${finalDataCy}-label`,
69
+ "data-testid": `${finalTestId}-label`,
70
+ children: displayLabel
57
71
  }
58
72
  )
59
73
  ] }),
60
- r && /* @__PURE__ */ s(
74
+ error && /* @__PURE__ */ jsx(
61
75
  "span",
62
76
  {
63
- id: p,
77
+ id: errorId,
64
78
  className: "radio__error",
65
79
  role: "alert",
66
- "data-cy": `${t}-error`,
67
- "data-testid": `${i}-error`,
68
- children: r
80
+ "data-cy": `${finalDataCy}-error`,
81
+ "data-testid": `${finalTestId}-error`,
82
+ children: error
69
83
  }
70
84
  ),
71
- o && !r && /* @__PURE__ */ s(
85
+ helperText && !error && /* @__PURE__ */ jsx(
72
86
  "span",
73
87
  {
74
- id: m,
88
+ id: helperId,
75
89
  className: "radio__helper",
76
- "data-cy": `${t}-helper`,
77
- "data-testid": `${i}-helper`,
78
- children: o
90
+ "data-cy": `${finalDataCy}-helper`,
91
+ "data-testid": `${finalTestId}-helper`,
92
+ children: helperText
79
93
  }
80
94
  )
81
95
  ]
@@ -83,7 +97,7 @@ const x = j(
83
97
  );
84
98
  }
85
99
  );
86
- x.displayName = "Radio";
100
+ Radio.displayName = "Radio";
87
101
  export {
88
- x as Radio
102
+ Radio
89
103
  };
package/dist/index9.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),b=require("react"),T=require("@radix-ui/react-tabs"),g=require("./index17.cjs");;/* empty css */function m(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,s.get?s:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const n=m(T),u=n.Root,f=b.forwardRef(({className:a,"data-cy":t,"data-testid":e,...s},r)=>{const i=t||"tabs-list",c=e||"tabs-list";return d.jsx(n.List,{ref:r,className:g.cn("tabs-list",a),"data-cy":i,"data-testid":c,...s})});f.displayName=n.List.displayName;const l=b.forwardRef(({className:a,value:t,"data-cy":e,"data-testid":s,...r},i)=>{const c=e||(t?`tabs-trigger-${t}`:"tabs-trigger"),o=s||(t?`tabs-trigger-${t}`:"tabs-trigger");return d.jsx(n.Trigger,{ref:i,className:g.cn("tabs-trigger",a),value:t,"data-cy":c,"data-testid":o,...r})});l.displayName=n.Trigger.displayName;const y=b.forwardRef(({className:a,value:t,"data-cy":e,"data-testid":s,...r},i)=>{const c=e||(t?`tabs-content-${t}`:"tabs-content"),o=s||(t?`tabs-content-${t}`:"tabs-content");return d.jsx(n.Content,{ref:i,className:g.cn("tabs-content",a),value:t,"data-cy":c,"data-testid":o,...r})});y.displayName=n.Content.displayName;exports.Tabs=u;exports.TabsContent=y;exports.TabsList=f;exports.TabsTrigger=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("react"),a=require("@radix-ui/react-tabs"),s=require("./index17.cjs");function r(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t)for(const a in t)if("default"!==a){const s=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,s.get?s:{enumerable:!0,get:()=>t[a]})}return e.default=t,Object.freeze(e)};/* empty css */const i=r(a),n=i.Root,c=e.forwardRef(({className:e,"data-cy":a,"data-testid":r,...n},c)=>{const o=a||"tabs-list",d=r||"tabs-list";return t.jsx(i.List,{ref:c,className:s.cn("tabs-list",e),"data-cy":o,"data-testid":d,...n})});c.displayName=i.List.displayName;const o=e.forwardRef(({className:e,value:a,"data-cy":r,"data-testid":n,...c},o)=>{const d=r||(a?`tabs-trigger-${a}`:"tabs-trigger"),l=n||(a?`tabs-trigger-${a}`:"tabs-trigger");return t.jsx(i.Trigger,{ref:o,className:s.cn("tabs-trigger",e),value:a,"data-cy":d,"data-testid":l,...c})});o.displayName=i.Trigger.displayName;const d=e.forwardRef(({className:e,value:a,"data-cy":r,"data-testid":n,...c},o)=>{const d=r||(a?`tabs-content-${a}`:"tabs-content"),l=n||(a?`tabs-content-${a}`:"tabs-content");return t.jsx(i.Content,{ref:o,className:s.cn("tabs-content",e),value:a,"data-cy":d,"data-testid":l,...c})});d.displayName=i.Content.displayName,exports.Tabs=n,exports.TabsContent=d,exports.TabsList=c,exports.TabsTrigger=o;
package/dist/index9.js CHANGED
@@ -1,61 +1,65 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import { forwardRef as m } from "react";
3
- import * as a from "@radix-ui/react-tabs";
4
- import { cn as b } from "./index17.js";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import * as TabsPrimitive from "@radix-ui/react-tabs";
4
+ import { cn } from "./index17.js";
5
5
  /* empty css */
6
- const C = a.Root, g = m(
7
- ({ className: s, "data-cy": t, "data-testid": i, ...n }, r) => {
8
- const e = t || "tabs-list", o = i || "tabs-list";
9
- return /* @__PURE__ */ c(
10
- a.List,
6
+ const Tabs = TabsPrimitive.Root;
7
+ const TabsList = forwardRef(
8
+ ({ className, "data-cy": dataCy, "data-testid": dataTestId, ...props }, ref) => {
9
+ const finalDataCy = dataCy || "tabs-list";
10
+ const finalTestId = dataTestId || "tabs-list";
11
+ return /* @__PURE__ */ jsx(
12
+ TabsPrimitive.List,
11
13
  {
12
- ref: r,
13
- className: b("tabs-list", s),
14
- "data-cy": e,
15
- "data-testid": o,
16
- ...n
14
+ ref,
15
+ className: cn("tabs-list", className),
16
+ "data-cy": finalDataCy,
17
+ "data-testid": finalTestId,
18
+ ...props
17
19
  }
18
20
  );
19
21
  }
20
22
  );
21
- g.displayName = a.List.displayName;
22
- const y = m(
23
- ({ className: s, value: t, "data-cy": i, "data-testid": n, ...r }, e) => {
24
- const o = i || (t ? `tabs-trigger-${t}` : "tabs-trigger"), d = n || (t ? `tabs-trigger-${t}` : "tabs-trigger");
25
- return /* @__PURE__ */ c(
26
- a.Trigger,
23
+ TabsList.displayName = TabsPrimitive.List.displayName;
24
+ const TabsTrigger = forwardRef(
25
+ ({ className, value, "data-cy": dataCy, "data-testid": dataTestId, ...props }, ref) => {
26
+ const finalDataCy = dataCy || (value ? `tabs-trigger-${value}` : "tabs-trigger");
27
+ const finalTestId = dataTestId || (value ? `tabs-trigger-${value}` : "tabs-trigger");
28
+ return /* @__PURE__ */ jsx(
29
+ TabsPrimitive.Trigger,
27
30
  {
28
- ref: e,
29
- className: b("tabs-trigger", s),
30
- value: t,
31
- "data-cy": o,
32
- "data-testid": d,
33
- ...r
31
+ ref,
32
+ className: cn("tabs-trigger", className),
33
+ value,
34
+ "data-cy": finalDataCy,
35
+ "data-testid": finalTestId,
36
+ ...props
34
37
  }
35
38
  );
36
39
  }
37
40
  );
38
- y.displayName = a.Trigger.displayName;
39
- const f = m(
40
- ({ className: s, value: t, "data-cy": i, "data-testid": n, ...r }, e) => {
41
- const o = i || (t ? `tabs-content-${t}` : "tabs-content"), d = n || (t ? `tabs-content-${t}` : "tabs-content");
42
- return /* @__PURE__ */ c(
43
- a.Content,
41
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
42
+ const TabsContent = forwardRef(
43
+ ({ className, value, "data-cy": dataCy, "data-testid": dataTestId, ...props }, ref) => {
44
+ const finalDataCy = dataCy || (value ? `tabs-content-${value}` : "tabs-content");
45
+ const finalTestId = dataTestId || (value ? `tabs-content-${value}` : "tabs-content");
46
+ return /* @__PURE__ */ jsx(
47
+ TabsPrimitive.Content,
44
48
  {
45
- ref: e,
46
- className: b("tabs-content", s),
47
- value: t,
48
- "data-cy": o,
49
- "data-testid": d,
50
- ...r
49
+ ref,
50
+ className: cn("tabs-content", className),
51
+ value,
52
+ "data-cy": finalDataCy,
53
+ "data-testid": finalTestId,
54
+ ...props
51
55
  }
52
56
  );
53
57
  }
54
58
  );
55
- f.displayName = a.Content.displayName;
59
+ TabsContent.displayName = TabsPrimitive.Content.displayName;
56
60
  export {
57
- C as Tabs,
58
- f as TabsContent,
59
- g as TabsList,
60
- y as TabsTrigger
61
+ Tabs,
62
+ TabsContent,
63
+ TabsList,
64
+ TabsTrigger
61
65
  };
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Development-only utilities
3
+ * These functions are optimized away in production builds
4
+ */
5
+ /**
6
+ * Logs a warning message only in development mode
7
+ * In production builds, this function call is stripped by the bundler
8
+ *
9
+ * @param message - The warning message to display
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * devWarn('Component: Invalid prop value provided');
14
+ * ```
15
+ */
16
+ export declare const devWarn: (message: string) => void;
17
+ /**
18
+ * Logs an error message only in development mode
19
+ * In production builds, this function call is stripped by the bundler
20
+ *
21
+ * @param message - The error message to display
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * devError('Component: Critical error occurred');
26
+ * ```
27
+ */
28
+ export declare const devError: (message: string) => void;
29
+ /**
30
+ * Logs an info message only in development mode
31
+ * In production builds, this function call is stripped by the bundler
32
+ *
33
+ * @param message - The info message to display
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * devLog('Component: Rendering with props:', props);
38
+ * ```
39
+ */
40
+ export declare const devLog: (message: string, ...args: unknown[]) => void;
41
+ //# sourceMappingURL=dev-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/dev-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO,GAAI,SAAS,MAAM,KAAG,IAIzC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,GAAI,SAAS,MAAM,KAAG,IAI1C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM,GAAI,SAAS,MAAM,EAAE,GAAG,MAAM,OAAO,EAAE,KAAG,IAI5D,CAAC"}
@@ -1,6 +1,17 @@
1
+ import { ClassValue } from 'clsx';
2
+
1
3
  /**
2
- * Combines class names conditionally
4
+ * Combines class names conditionally with proper Tailwind class merging
5
+ * Uses clsx for conditional classes and tailwind-merge to resolve conflicts
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * cn('text-red-500', 'text-blue-500') // => 'text-blue-500' (last class wins)
10
+ * cn('p-4', undefined, false, 'bg-white') // => 'p-4 bg-white'
11
+ * cn({ 'hidden': isHidden, 'block': !isHidden }) // => 'hidden' or 'block'
12
+ * ```
3
13
  */
4
- export declare function cn(...classes: (string | undefined | null | false)[]): string;
14
+ export declare function cn(...inputs: ClassValue[]): string;
5
15
  export declare function generateId(prefix?: string): string;
16
+ export { devWarn, devError, devLog } from './dev-utils';
6
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,KAAK,CAAC,EAAE,GAAG,MAAM,CAE5E;AAMD,wBAAgB,UAAU,CAAC,MAAM,SAAO,GAAG,MAAM,CAGhD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAG7C;;;;;;;;;;GAUG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAElD;AAMD,wBAAgB,UAAU,CAAC,MAAM,SAAO,GAAG,MAAM,CAGhD;AAGD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adam-milo/ui",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "type": "module",
5
5
  "description": "Adam Milo Design System - UI Component Library",
6
6
  "keywords": [
@@ -63,7 +63,8 @@
63
63
  "@adam-milo/tokens": "*",
64
64
  "@radix-ui/react-dialog": "^1.0.5",
65
65
  "@radix-ui/react-tabs": "^1.0.4",
66
- "clsx": "^2.1.0"
66
+ "clsx": "^2.1.0",
67
+ "tailwind-merge": "^3.4.0"
67
68
  },
68
69
  "devDependencies": {
69
70
  "@testing-library/jest-dom": "^6.1.5",
@@ -81,6 +82,7 @@
81
82
  "react-dom": "^18.2.0",
82
83
  "tailwindcss": "^3.4.0",
83
84
  "tailwindcss-rtl": "^0.9.0",
85
+ "terser": "^5.44.1",
84
86
  "typescript": "^5.3.0",
85
87
  "vite": "^5.0.8",
86
88
  "vite-plugin-dts": "^3.7.0",