dustyui 1.0.1 → 1.0.2
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/Badge/Badge.cjs +28 -3
- package/dist/Badge/Badge.d.ts +16 -5
- package/dist/Badge/Badge.js +28 -3
- package/dist/Badge/Badge.module.css +24 -2
- package/dist/Button/Button.cjs +35 -3
- package/dist/Button/Button.d.ts +14 -6
- package/dist/Button/Button.js +38 -4
- package/dist/Button/Button.module.css +34 -5
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/styles/tokens.css +15 -0
- package/package.json +5 -2
package/dist/Badge/Badge.cjs
CHANGED
|
@@ -32,10 +32,35 @@ __export(Badge_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(Badge_exports);
|
|
34
34
|
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_react2 = require("react");
|
|
36
|
+
var import_clsx = __toESM(require("clsx"));
|
|
35
37
|
var import_Badge_module = __toESM(require("./Badge.module.css"));
|
|
36
|
-
const Badge = (
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
const Badge = (0, import_react2.forwardRef)(
|
|
39
|
+
({
|
|
40
|
+
label,
|
|
41
|
+
icon,
|
|
42
|
+
iconPosition = "left",
|
|
43
|
+
announce = false,
|
|
44
|
+
dataTestId,
|
|
45
|
+
className
|
|
46
|
+
}, ref) => {
|
|
47
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
48
|
+
"span",
|
|
49
|
+
{
|
|
50
|
+
ref,
|
|
51
|
+
className: (0, import_clsx.default)(import_Badge_module.default.badge, className),
|
|
52
|
+
"data-testid": dataTestId,
|
|
53
|
+
"data-icon-position": iconPosition,
|
|
54
|
+
role: announce ? "status" : void 0,
|
|
55
|
+
"aria-live": announce ? "polite" : void 0
|
|
56
|
+
},
|
|
57
|
+
icon && iconPosition === "left" && /* @__PURE__ */ import_react.default.createElement("span", { className: import_Badge_module.default.icon, "aria-hidden": "true" }, icon),
|
|
58
|
+
/* @__PURE__ */ import_react.default.createElement("span", { className: import_Badge_module.default.label }, label),
|
|
59
|
+
icon && iconPosition === "right" && /* @__PURE__ */ import_react.default.createElement("span", { className: import_Badge_module.default.icon, "aria-hidden": "true" }, icon)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
Badge.displayName = "Badge";
|
|
39
64
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
65
|
0 && (module.exports = {
|
|
41
66
|
Badge
|
package/dist/Badge/Badge.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import React, { type ReactNode } from "react";
|
|
2
|
+
interface BadgeProps {
|
|
3
|
+
/** Visible text inside the badge. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Optional icon */
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
/** Where to place the icon relative to the label. */
|
|
8
|
+
iconPosition?: "left" | "right";
|
|
9
|
+
/** If true, announces updates to assistive tech (use when value changes dynamically). */
|
|
10
|
+
announce?: boolean;
|
|
11
|
+
/** Test hook. */
|
|
12
|
+
dataTestId?: string;
|
|
13
|
+
/** Extra class on the root element. */
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
|
|
6
17
|
export {};
|
package/dist/Badge/Badge.js
CHANGED
|
@@ -1,8 +1,33 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
2
4
|
import styles from "./Badge.module.css";
|
|
3
|
-
const Badge = (
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
const Badge = forwardRef(
|
|
6
|
+
({
|
|
7
|
+
label,
|
|
8
|
+
icon,
|
|
9
|
+
iconPosition = "left",
|
|
10
|
+
announce = false,
|
|
11
|
+
dataTestId,
|
|
12
|
+
className
|
|
13
|
+
}, ref) => {
|
|
14
|
+
return /* @__PURE__ */ React.createElement(
|
|
15
|
+
"span",
|
|
16
|
+
{
|
|
17
|
+
ref,
|
|
18
|
+
className: clsx(styles.badge, className),
|
|
19
|
+
"data-testid": dataTestId,
|
|
20
|
+
"data-icon-position": iconPosition,
|
|
21
|
+
role: announce ? "status" : void 0,
|
|
22
|
+
"aria-live": announce ? "polite" : void 0
|
|
23
|
+
},
|
|
24
|
+
icon && iconPosition === "left" && /* @__PURE__ */ React.createElement("span", { className: styles.icon, "aria-hidden": "true" }, icon),
|
|
25
|
+
/* @__PURE__ */ React.createElement("span", { className: styles.label }, label),
|
|
26
|
+
icon && iconPosition === "right" && /* @__PURE__ */ React.createElement("span", { className: styles.icon, "aria-hidden": "true" }, icon)
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
Badge.displayName = "Badge";
|
|
6
31
|
export {
|
|
7
32
|
Badge
|
|
8
33
|
};
|
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
.badge {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
font-size: 0.75rem;
|
|
5
|
+
line-height: 1rem;
|
|
6
|
+
padding: 0.125rem 0.625rem;
|
|
7
|
+
font-weight: 600;
|
|
8
|
+
border: 1px solid var(--color-gray-300);
|
|
9
|
+
width: max-content;
|
|
10
|
+
border-radius: 12px;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: 4px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.icon {
|
|
16
|
+
width: 0.875rem;
|
|
17
|
+
height: 0.875rem;
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
line-height: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.label {
|
|
25
|
+
white-space: nowrap;
|
|
4
26
|
}
|
package/dist/Button/Button.cjs
CHANGED
|
@@ -32,10 +32,42 @@ __export(Button_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(Button_exports);
|
|
34
34
|
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_clsx = __toESM(require("clsx"));
|
|
35
36
|
var import_Button_module = __toESM(require("./Button.module.css"));
|
|
36
|
-
const Button = (
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
const Button = (0, import_react.forwardRef)(
|
|
38
|
+
({
|
|
39
|
+
children,
|
|
40
|
+
variant = "primary",
|
|
41
|
+
loading = false,
|
|
42
|
+
dataTestId,
|
|
43
|
+
className,
|
|
44
|
+
disabled,
|
|
45
|
+
type = "button",
|
|
46
|
+
...props
|
|
47
|
+
}, ref) => {
|
|
48
|
+
const isDisabled = disabled || loading;
|
|
49
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
50
|
+
"button",
|
|
51
|
+
{
|
|
52
|
+
ref,
|
|
53
|
+
type,
|
|
54
|
+
className: (0, import_clsx.default)(
|
|
55
|
+
import_Button_module.default.button,
|
|
56
|
+
import_Button_module.default[variant],
|
|
57
|
+
isDisabled && import_Button_module.default.disabled,
|
|
58
|
+
className
|
|
59
|
+
),
|
|
60
|
+
"data-testid": dataTestId,
|
|
61
|
+
"data-variant": variant,
|
|
62
|
+
"aria-busy": loading || void 0,
|
|
63
|
+
disabled: isDisabled,
|
|
64
|
+
...props
|
|
65
|
+
},
|
|
66
|
+
children
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
Button.displayName = "Button";
|
|
39
71
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
72
|
0 && (module.exports = {
|
|
41
73
|
Button
|
package/dist/Button/Button.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import React, { type ButtonHTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
/** Content inside the button */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Visual style variant */
|
|
6
|
+
variant?: "primary" | "secondary";
|
|
7
|
+
/** Show as busy (disables interaction + aria-busy) */
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
/** Test hook. */
|
|
10
|
+
dataTestId?: string;
|
|
11
|
+
/** Additional CSS class names */
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
package/dist/Button/Button.js
CHANGED
|
@@ -1,8 +1,42 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React, {
|
|
2
|
+
forwardRef
|
|
3
|
+
} from "react";
|
|
4
|
+
import clsx from "clsx";
|
|
2
5
|
import styles from "./Button.module.css";
|
|
3
|
-
const Button = (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
const Button = forwardRef(
|
|
7
|
+
({
|
|
8
|
+
children,
|
|
9
|
+
variant = "primary",
|
|
10
|
+
loading = false,
|
|
11
|
+
dataTestId,
|
|
12
|
+
className,
|
|
13
|
+
disabled,
|
|
14
|
+
type = "button",
|
|
15
|
+
...props
|
|
16
|
+
}, ref) => {
|
|
17
|
+
const isDisabled = disabled || loading;
|
|
18
|
+
return /* @__PURE__ */ React.createElement(
|
|
19
|
+
"button",
|
|
20
|
+
{
|
|
21
|
+
ref,
|
|
22
|
+
type,
|
|
23
|
+
className: clsx(
|
|
24
|
+
styles.button,
|
|
25
|
+
styles[variant],
|
|
26
|
+
isDisabled && styles.disabled,
|
|
27
|
+
className
|
|
28
|
+
),
|
|
29
|
+
"data-testid": dataTestId,
|
|
30
|
+
"data-variant": variant,
|
|
31
|
+
"aria-busy": loading || void 0,
|
|
32
|
+
disabled: isDisabled,
|
|
33
|
+
...props
|
|
34
|
+
},
|
|
35
|
+
children
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
Button.displayName = "Button";
|
|
6
40
|
export {
|
|
7
41
|
Button
|
|
8
42
|
};
|
|
@@ -1,8 +1,37 @@
|
|
|
1
1
|
.button {
|
|
2
|
-
|
|
3
|
-
color: white;
|
|
2
|
+
display: inline-block;
|
|
4
3
|
padding: 0.75rem 1.5rem;
|
|
5
|
-
border-radius:
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
border-radius: 8px;
|
|
5
|
+
font-weight: var(--weight-semibold);
|
|
6
|
+
text-decoration: none;
|
|
7
|
+
line-height: 1;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* Primary: filled black */
|
|
11
|
+
.primary {
|
|
12
|
+
background-color: var(--color-black);
|
|
13
|
+
color: var(--color-white);
|
|
14
|
+
border: 1px solid var(--color-black);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.primary:hover {
|
|
18
|
+
background-color: var(--color-black-700);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Secondary: outline black */
|
|
22
|
+
.secondary {
|
|
23
|
+
background-color: transparent;
|
|
24
|
+
color: var(--color-black);
|
|
25
|
+
border: 1px solid var(--color-black);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.secondary:hover {
|
|
29
|
+
background-color: var(--color-gray-200);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Disabled state */
|
|
33
|
+
.disabled {
|
|
34
|
+
opacity: 0.5;
|
|
35
|
+
cursor: not-allowed;
|
|
36
|
+
pointer-events: none;
|
|
8
37
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -22,6 +22,7 @@ __export(src_exports, {
|
|
|
22
22
|
Button: () => import_Button.Button
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(src_exports);
|
|
25
|
+
var import_tokens = require("./styles/tokens.css");
|
|
25
26
|
var import_Badge = require("./Badge/Badge");
|
|
26
27
|
var import_Button = require("./Button/Button");
|
|
27
28
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/* Color Variables */
|
|
3
|
+
--color-black: #222222;
|
|
4
|
+
--color-black-800: #2a2a2a;
|
|
5
|
+
--color-black-700: #2f2f2f;
|
|
6
|
+
--color-gray-700: #444444;
|
|
7
|
+
--color-gray-600: #666666;
|
|
8
|
+
--color-gray-500: #999999;
|
|
9
|
+
--color-gray-400: #bbbbbb;
|
|
10
|
+
--color-gray-300: #dddddd;
|
|
11
|
+
--color-gray-200: #eeeeee;
|
|
12
|
+
--color-gray-100: #f5f5f5;
|
|
13
|
+
--color-gray-50: #fcfcfc;
|
|
14
|
+
--color-white: #fafafa;
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dustyui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A minimalist, neutral-toned React UI component library styled with CSS Modules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "rm -rf dist && tsup && tsc -p tsconfig.build.json && cpy \"src/**/*.
|
|
27
|
+
"build": "rm -rf dist && tsup && tsc -p tsconfig.build.json && cpy \"src/**/*.css\" dist --parents",
|
|
28
28
|
"typecheck": "tsc --noEmit",
|
|
29
29
|
"format": "prettier --check .",
|
|
30
30
|
"format:fix": "prettier --write .",
|
|
@@ -61,5 +61,8 @@
|
|
|
61
61
|
"require": "./dist/index.cjs",
|
|
62
62
|
"types": "./dist/index.d.ts"
|
|
63
63
|
}
|
|
64
|
+
},
|
|
65
|
+
"dependencies": {
|
|
66
|
+
"clsx": "^2.1.1"
|
|
64
67
|
}
|
|
65
68
|
}
|