@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/index.cjs +1 -1
- package/dist/index.js +53 -53
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +38 -36
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +82 -76
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +50 -49
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +30 -30
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +348 -209
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +92 -82
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +32 -31
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +10 -7
- package/dist/index2.cjs +1 -1
- package/dist/index2.js +26 -26
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +84 -66
- package/dist/index31.cjs +1 -0
- package/dist/index31.js +9 -0
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +71 -64
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +130 -104
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +136 -107
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +76 -61
- package/dist/index8.cjs +1 -1
- package/dist/index8.js +68 -54
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +47 -43
- package/dist/src/lib/dev-utils.d.ts +41 -0
- package/dist/src/lib/dev-utils.d.ts.map +1 -0
- package/dist/src/lib/index.d.ts +13 -2
- package/dist/src/lib/index.d.ts.map +1 -1
- package/package.json +4 -2
package/dist/index8.js
CHANGED
|
@@ -1,81 +1,95 @@
|
|
|
1
|
-
import { jsxs
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import { cn
|
|
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
|
|
5
|
+
const Radio = forwardRef(
|
|
6
6
|
({
|
|
7
|
-
label
|
|
8
|
-
error
|
|
9
|
-
helperText
|
|
10
|
-
className
|
|
11
|
-
id:
|
|
12
|
-
required
|
|
13
|
-
disabled
|
|
14
|
-
checked
|
|
15
|
-
"data-cy":
|
|
16
|
-
"data-testid":
|
|
17
|
-
...
|
|
18
|
-
},
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
[
|
|
24
|
-
)
|
|
25
|
-
|
|
36
|
+
[ref]
|
|
37
|
+
);
|
|
38
|
+
const displayLabel = label && required && !label.includes("*") ? `${label} *` : label;
|
|
39
|
+
return /* @__PURE__ */ jsxs(
|
|
26
40
|
"div",
|
|
27
41
|
{
|
|
28
|
-
className:
|
|
29
|
-
"data-cy": `${
|
|
30
|
-
"data-testid": `${
|
|
42
|
+
className: cn("radio-wrapper", disabled && "radio-wrapper--disabled"),
|
|
43
|
+
"data-cy": `${finalDataCy}-wrapper`,
|
|
44
|
+
"data-testid": `${finalTestId}-wrapper`,
|
|
31
45
|
children: [
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ jsxs("div", { className: "radio__container", children: [
|
|
47
|
+
/* @__PURE__ */ jsx(
|
|
34
48
|
"input",
|
|
35
49
|
{
|
|
36
|
-
ref:
|
|
37
|
-
id
|
|
50
|
+
ref: combinedRef,
|
|
51
|
+
id,
|
|
38
52
|
type: "radio",
|
|
39
|
-
checked
|
|
40
|
-
className:
|
|
41
|
-
"aria-describedby":
|
|
42
|
-
"data-cy":
|
|
43
|
-
"data-testid":
|
|
44
|
-
disabled
|
|
45
|
-
required
|
|
46
|
-
...
|
|
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
|
-
|
|
63
|
+
label && /* @__PURE__ */ jsx(
|
|
50
64
|
"label",
|
|
51
65
|
{
|
|
52
|
-
htmlFor:
|
|
66
|
+
htmlFor: id,
|
|
53
67
|
className: "radio__label",
|
|
54
|
-
"data-cy": `${
|
|
55
|
-
"data-testid": `${
|
|
56
|
-
children:
|
|
68
|
+
"data-cy": `${finalDataCy}-label`,
|
|
69
|
+
"data-testid": `${finalTestId}-label`,
|
|
70
|
+
children: displayLabel
|
|
57
71
|
}
|
|
58
72
|
)
|
|
59
73
|
] }),
|
|
60
|
-
|
|
74
|
+
error && /* @__PURE__ */ jsx(
|
|
61
75
|
"span",
|
|
62
76
|
{
|
|
63
|
-
id:
|
|
77
|
+
id: errorId,
|
|
64
78
|
className: "radio__error",
|
|
65
79
|
role: "alert",
|
|
66
|
-
"data-cy": `${
|
|
67
|
-
"data-testid": `${
|
|
68
|
-
children:
|
|
80
|
+
"data-cy": `${finalDataCy}-error`,
|
|
81
|
+
"data-testid": `${finalTestId}-error`,
|
|
82
|
+
children: error
|
|
69
83
|
}
|
|
70
84
|
),
|
|
71
|
-
|
|
85
|
+
helperText && !error && /* @__PURE__ */ jsx(
|
|
72
86
|
"span",
|
|
73
87
|
{
|
|
74
|
-
id:
|
|
88
|
+
id: helperId,
|
|
75
89
|
className: "radio__helper",
|
|
76
|
-
"data-cy": `${
|
|
77
|
-
"data-testid": `${
|
|
78
|
-
children:
|
|
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
|
-
|
|
100
|
+
Radio.displayName = "Radio";
|
|
87
101
|
export {
|
|
88
|
-
|
|
102
|
+
Radio
|
|
89
103
|
};
|
package/dist/index9.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import * as
|
|
4
|
-
import { cn
|
|
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
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
13
|
-
className:
|
|
14
|
-
"data-cy":
|
|
15
|
-
"data-testid":
|
|
16
|
-
...
|
|
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
|
-
|
|
22
|
-
const
|
|
23
|
-
({ className
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
29
|
-
className:
|
|
30
|
-
value
|
|
31
|
-
"data-cy":
|
|
32
|
-
"data-testid":
|
|
33
|
-
...
|
|
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
|
-
|
|
39
|
-
const
|
|
40
|
-
({ className
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
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
|
|
46
|
-
className:
|
|
47
|
-
value
|
|
48
|
-
"data-cy":
|
|
49
|
-
"data-testid":
|
|
50
|
-
...
|
|
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
|
-
|
|
59
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
56
60
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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"}
|
package/dist/src/lib/index.d.ts
CHANGED
|
@@ -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(...
|
|
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":"
|
|
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.
|
|
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",
|