@xuefx/ui 1.0.2 → 1.0.4
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/README.md +70 -0
- package/dist/index.es.js +11 -12
- package/dist/index.umd.js +1 -1
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# @xuefx/ui
|
|
2
|
+
|
|
3
|
+
React UI component library. Powered by [Tailwind CSS](https://tailwindcss.com) + [CVA](https://cva.style).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @xuefx/ui @xuefx/ui-theme
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import '@xuefx/ui-theme/styles.css'; // design tokens
|
|
15
|
+
import '@xuefx/ui/style.css'; // component styles
|
|
16
|
+
import { Button, Alert, AlertTitle, AlertDescription } from '@xuefx/ui';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Components
|
|
20
|
+
|
|
21
|
+
### Button
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
import { Button } from '@xuefx/ui';
|
|
25
|
+
|
|
26
|
+
<Button>Default</Button>
|
|
27
|
+
<Button variant="destructive">Delete</Button>
|
|
28
|
+
<Button variant="outline">Outline</Button>
|
|
29
|
+
<Button variant="secondary">Secondary</Button>
|
|
30
|
+
<Button variant="ghost">Ghost</Button>
|
|
31
|
+
<Button variant="link">Link</Button>
|
|
32
|
+
|
|
33
|
+
<Button size="sm">Small</Button>
|
|
34
|
+
<Button size="lg">Large</Button>
|
|
35
|
+
<Button size="icon">★</Button>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Alert
|
|
39
|
+
|
|
40
|
+
```jsx
|
|
41
|
+
import { Alert, AlertTitle, AlertDescription } from '@xuefx/ui';
|
|
42
|
+
|
|
43
|
+
<Alert>
|
|
44
|
+
<AlertTitle>Info</AlertTitle>
|
|
45
|
+
<AlertDescription>This is a message.</AlertDescription>
|
|
46
|
+
</Alert>
|
|
47
|
+
|
|
48
|
+
<Alert variant="destructive">
|
|
49
|
+
<AlertTitle>Error</AlertTitle>
|
|
50
|
+
<AlertDescription>Something went wrong.</AlertDescription>
|
|
51
|
+
</Alert>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Styling
|
|
55
|
+
|
|
56
|
+
All components render semantic CSS classes (`fx-btn`, `fx-btn-primary`, `fx-alert`, etc.) — override them with plain CSS:
|
|
57
|
+
|
|
58
|
+
```css
|
|
59
|
+
.fx-btn { border-radius: 12px; }
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Theming
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
import { ThemeProvider, createTheme, themes } from '@xuefx/ui-theme';
|
|
66
|
+
|
|
67
|
+
<ThemeProvider theme={themes.green}>
|
|
68
|
+
<App />
|
|
69
|
+
</ThemeProvider>
|
|
70
|
+
```
|
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "@xuefx/ui-theme/styles.css";
|
|
2
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
3
2
|
import i from "react";
|
|
4
3
|
import { cva as f } from "class-variance-authority";
|
|
@@ -29,12 +28,12 @@ const m = f("fx-btn", {
|
|
|
29
28
|
size: "default"
|
|
30
29
|
}
|
|
31
30
|
}), x = i.forwardRef(
|
|
32
|
-
({ className: t, variant:
|
|
31
|
+
({ className: t, variant: e, size: r, type: a = "button", children: s, ...o }, d) => /* @__PURE__ */ n(
|
|
33
32
|
"button",
|
|
34
33
|
{
|
|
35
34
|
ref: d,
|
|
36
35
|
type: a,
|
|
37
|
-
className: l(m({ variant:
|
|
36
|
+
className: l(m({ variant: e, size: r, className: t })),
|
|
38
37
|
...o,
|
|
39
38
|
children: s
|
|
40
39
|
}
|
|
@@ -51,34 +50,34 @@ const b = f("fx-alert", {
|
|
|
51
50
|
defaultVariants: {
|
|
52
51
|
variant: "default"
|
|
53
52
|
}
|
|
54
|
-
}), p = i.forwardRef(({ className: t, variant:
|
|
53
|
+
}), p = i.forwardRef(({ className: t, variant: e, children: r, ...a }, s) => /* @__PURE__ */ n(
|
|
55
54
|
"div",
|
|
56
55
|
{
|
|
57
56
|
ref: s,
|
|
58
57
|
role: "alert",
|
|
59
|
-
className: l(b({ variant:
|
|
58
|
+
className: l(b({ variant: e, className: t })),
|
|
60
59
|
...a,
|
|
61
|
-
children:
|
|
60
|
+
children: r
|
|
62
61
|
}
|
|
63
62
|
));
|
|
64
63
|
p.displayName = "Alert";
|
|
65
|
-
const v = i.forwardRef(({ className: t, children:
|
|
64
|
+
const v = i.forwardRef(({ className: t, children: e, ...r }, a) => /* @__PURE__ */ n(
|
|
66
65
|
"h5",
|
|
67
66
|
{
|
|
68
67
|
ref: a,
|
|
69
68
|
className: l("fx-alert-title", t),
|
|
70
|
-
...
|
|
71
|
-
children:
|
|
69
|
+
...r,
|
|
70
|
+
children: e
|
|
72
71
|
}
|
|
73
72
|
));
|
|
74
73
|
v.displayName = "AlertTitle";
|
|
75
|
-
const N = i.forwardRef(({ className: t, children:
|
|
74
|
+
const N = i.forwardRef(({ className: t, children: e, ...r }, a) => /* @__PURE__ */ n(
|
|
76
75
|
"div",
|
|
77
76
|
{
|
|
78
77
|
ref: a,
|
|
79
78
|
className: l("fx-alert-desc", t),
|
|
80
|
-
...
|
|
81
|
-
children:
|
|
79
|
+
...r,
|
|
80
|
+
children: e
|
|
82
81
|
}
|
|
83
82
|
));
|
|
84
83
|
N.displayName = "AlertDescription";
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(t,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("react/jsx-runtime"),require("react"),require("class-variance-authority"),require("clsx"),require("tailwind-merge")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","class-variance-authority","clsx","tailwind-merge"],r):(t=typeof globalThis<"u"?globalThis:t||self,r(t.ImxUI={},t.jsxRuntime,t.React,t.classVarianceAuthority,t.clsx,t.tailwindMerge))})(this,function(t,r,l,u,m,v){"use strict";function s(...e){return v.twMerge(m.clsx(e))}const y=u.cva("fx-btn",{variants:{variant:{default:"fx-btn-primary",destructive:"fx-btn-destructive",outline:"fx-btn-outline",secondary:"fx-btn-secondary",ghost:"fx-btn-ghost",link:"fx-btn-link"},size:{default:"fx-btn-md",sm:"fx-btn-sm",lg:"fx-btn-lg",icon:"fx-btn-icon"}},defaultVariants:{variant:"default",size:"default"}}),c=l.forwardRef(({className:e,variant:n,size:a,type:i="button",children:f,...p},A)=>r.jsx("button",{ref:A,type:i,className:s(y({variant:n,size:a,className:e})),...p,children:f}));c.displayName="Button";const b=u.cva("fx-alert",{variants:{variant:{default:"fx-alert-default",destructive:"fx-alert-destructive"}},defaultVariants:{variant:"default"}}),d=l.forwardRef(({className:e,variant:n,children:a,...i},f)=>r.jsx("div",{ref:f,role:"alert",className:s(b({variant:n,className:e})),...i,children:a}));d.displayName="Alert";const o=l.forwardRef(({className:e,children:n,...a},i)=>r.jsx("h5",{ref:i,className:s("fx-alert-title",e),...a,children:n}));o.displayName="AlertTitle";const x=l.forwardRef(({className:e,children:n,...a},i)=>r.jsx("div",{ref:i,className:s("fx-alert-desc",e),...a,children:n}));x.displayName="AlertDescription",t.Alert=d,t.AlertDescription=x,t.AlertTitle=o,t.Button=c,t.cn=s,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xuefx/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "React UI component library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.es.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"class-variance-authority": "^0.7.1",
|
|
23
23
|
"clsx": "^2.1.1",
|
|
24
24
|
"tailwind-merge": "^3.6.0",
|
|
25
|
-
"@xuefx/ui-theme": "^1.0.
|
|
25
|
+
"@xuefx/ui-theme": "^1.0.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"tailwindcss": "^3.4.17"
|