@jixic/react-ui 0.1.0 → 0.1.1
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 +42 -1
- package/dist/index.cjs +282 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +78 -2
- package/dist/index.d.ts +78 -2
- package/dist/index.js +271 -42
- package/dist/index.js.map +1 -1
- package/dist/styles.css +242 -1
- package/package.json +30 -2
package/README.md
CHANGED
|
@@ -1,15 +1,46 @@
|
|
|
1
1
|
# @jixic/react-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Accessible React UI components, TypeScript primitives, design tokens, and CSS themes for React and Next.js web applications.
|
|
4
|
+
|
|
5
|
+
## Links
|
|
6
|
+
|
|
7
|
+
- npm: [@jixic/react-ui](https://www.npmjs.com/package/@jixic/react-ui)
|
|
8
|
+
- GitHub: [virendrapsamrat/-jixic-react-ui](https://github.com/virendrapsamrat/-jixic-react-ui)
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Use `@jixic/react-ui` when you want a small, typed, accessible component library with a consistent visual system and no required app framework. The package is designed for discoverability on npm with clear keywords, public repository metadata, install examples, and package docs.
|
|
13
|
+
|
|
14
|
+
## Platform Support
|
|
15
|
+
|
|
16
|
+
| Platform | Status | Notes |
|
|
17
|
+
| ------------ | --------- | ---------------------------------------------------------------------------- |
|
|
18
|
+
| React web | Supported | Uses DOM elements and the compiled stylesheet. |
|
|
19
|
+
| Next.js | Supported | Import `@jixic/react-ui/styles.css` once in the root layout or app shell. |
|
|
20
|
+
| React Native | Roadmap | Planned as a separate native package that can share tokens and API patterns. |
|
|
21
|
+
|
|
22
|
+
This package is not currently a React Native package because it ships DOM components and CSS. React Native UI support should live in a sibling package such as `@jixic/react-native-ui`.
|
|
4
23
|
|
|
5
24
|
## Install
|
|
6
25
|
|
|
26
|
+
Install the package with React and React DOM. They are peer dependencies and are not bundled.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install @jixic/react-ui react react-dom
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
yarn add @jixic/react-ui react react-dom
|
|
34
|
+
```
|
|
35
|
+
|
|
7
36
|
```bash
|
|
8
37
|
pnpm add @jixic/react-ui react react-dom
|
|
9
38
|
```
|
|
10
39
|
|
|
11
40
|
## Usage
|
|
12
41
|
|
|
42
|
+
Import the compiled stylesheet once in your application root, then import components from `@jixic/react-ui`.
|
|
43
|
+
|
|
13
44
|
```tsx
|
|
14
45
|
import { Button, Card, CardContent, Input } from "@jixic/react-ui";
|
|
15
46
|
import "@jixic/react-ui/styles.css";
|
|
@@ -27,3 +58,13 @@ export function Example() {
|
|
|
27
58
|
```
|
|
28
59
|
|
|
29
60
|
Set `data-ui-theme="dark"` on any parent element to enable dark theme tokens.
|
|
61
|
+
|
|
62
|
+
## Package Details
|
|
63
|
+
|
|
64
|
+
- Supports React `>=18.2.0` and React `>=19.0.0`.
|
|
65
|
+
- Includes components for actions, forms, feedback, overlays, navigation, loading states, and display surfaces.
|
|
66
|
+
- Includes TypeScript declarations.
|
|
67
|
+
- Provides ESM and CommonJS builds.
|
|
68
|
+
- Exposes the compiled stylesheet at `@jixic/react-ui/styles.css`.
|
|
69
|
+
- Ships only package files from `dist`, `README.md`, `CHANGELOG.md`, and `LICENSE`.
|
|
70
|
+
- Search-friendly metadata covers React UI, React components, TypeScript, accessibility, design systems, themes, CSS variables, and Next.js.
|
package/dist/index.cjs
CHANGED
|
@@ -22,17 +22,26 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
22
22
|
var index_exports = {};
|
|
23
23
|
__export(index_exports, {
|
|
24
24
|
Alert: () => Alert,
|
|
25
|
+
Avatar: () => Avatar,
|
|
25
26
|
Badge: () => Badge,
|
|
26
27
|
Button: () => Button,
|
|
27
28
|
Card: () => Card,
|
|
28
29
|
CardContent: () => CardContent,
|
|
29
30
|
CardFooter: () => CardFooter,
|
|
30
31
|
CardHeader: () => CardHeader,
|
|
32
|
+
Checkbox: () => Checkbox,
|
|
31
33
|
EmptyState: () => EmptyState,
|
|
32
34
|
Input: () => Input,
|
|
33
35
|
Modal: () => Modal,
|
|
36
|
+
Radio: () => Radio,
|
|
37
|
+
RadioGroup: () => RadioGroup,
|
|
38
|
+
Select: () => Select,
|
|
34
39
|
Skeleton: () => Skeleton,
|
|
35
40
|
Spinner: () => Spinner,
|
|
41
|
+
Switch: () => Switch,
|
|
42
|
+
Tabs: () => Tabs,
|
|
43
|
+
Textarea: () => Textarea,
|
|
44
|
+
Tooltip: () => Tooltip,
|
|
36
45
|
colors: () => colors,
|
|
37
46
|
spacing: () => spacing,
|
|
38
47
|
typography: () => typography
|
|
@@ -66,20 +75,27 @@ var Alert = (0, import_react.forwardRef)(function Alert2({ children, className,
|
|
|
66
75
|
);
|
|
67
76
|
});
|
|
68
77
|
|
|
78
|
+
// src/components/Avatar/Avatar.tsx
|
|
79
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
80
|
+
function Avatar({ alt, className, fallback, size = "md", src, ...props }) {
|
|
81
|
+
const initials = fallback ?? alt.split(" ").filter(Boolean).slice(0, 2).map((part) => part[0]?.toUpperCase()).join("");
|
|
82
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: cx("ui-avatar", `ui-avatar-${size}`, className), ...props, children: src ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("img", { alt, className: "ui-avatar-image", src }) : initials });
|
|
83
|
+
}
|
|
84
|
+
|
|
69
85
|
// src/components/Badge/Badge.tsx
|
|
70
86
|
var import_react2 = require("react");
|
|
71
|
-
var
|
|
87
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
72
88
|
var Badge = (0, import_react2.forwardRef)(function Badge2({ className, variant = "neutral", ...props }, ref) {
|
|
73
|
-
return /* @__PURE__ */ (0,
|
|
89
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cx("ui-badge", `ui-badge-${variant}`, className), ref, ...props });
|
|
74
90
|
});
|
|
75
91
|
|
|
76
92
|
// src/components/Button/Button.tsx
|
|
77
93
|
var import_react3 = require("react");
|
|
78
94
|
|
|
79
95
|
// src/components/Spinner/Spinner.tsx
|
|
80
|
-
var
|
|
96
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
81
97
|
function Spinner({ className, label = "Loading", size = "md", ...props }) {
|
|
82
|
-
return /* @__PURE__ */ (0,
|
|
98
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
83
99
|
"span",
|
|
84
100
|
{
|
|
85
101
|
"aria-label": label,
|
|
@@ -91,7 +107,7 @@ function Spinner({ className, label = "Loading", size = "md", ...props }) {
|
|
|
91
107
|
}
|
|
92
108
|
|
|
93
109
|
// src/components/Button/Button.tsx
|
|
94
|
-
var
|
|
110
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
95
111
|
var Button = (0, import_react3.forwardRef)(function Button2({
|
|
96
112
|
children,
|
|
97
113
|
className,
|
|
@@ -104,7 +120,7 @@ var Button = (0, import_react3.forwardRef)(function Button2({
|
|
|
104
120
|
variant = "primary",
|
|
105
121
|
...props
|
|
106
122
|
}, ref) {
|
|
107
|
-
return /* @__PURE__ */ (0,
|
|
123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
108
124
|
"button",
|
|
109
125
|
{
|
|
110
126
|
className: cx(
|
|
@@ -119,8 +135,8 @@ var Button = (0, import_react3.forwardRef)(function Button2({
|
|
|
119
135
|
type,
|
|
120
136
|
...props,
|
|
121
137
|
children: [
|
|
122
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
123
|
-
/* @__PURE__ */ (0,
|
|
138
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, { label: "Loading", size: "sm" }) : leftIcon,
|
|
139
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children }),
|
|
124
140
|
!isLoading ? rightIcon : null
|
|
125
141
|
]
|
|
126
142
|
}
|
|
@@ -129,43 +145,74 @@ var Button = (0, import_react3.forwardRef)(function Button2({
|
|
|
129
145
|
|
|
130
146
|
// src/components/Card/Card.tsx
|
|
131
147
|
var import_react4 = require("react");
|
|
132
|
-
var
|
|
148
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
133
149
|
var Card = (0, import_react4.forwardRef)(function Card2({ className, ...props }, ref) {
|
|
134
|
-
return /* @__PURE__ */ (0,
|
|
150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cx("ui-card", className), ref, ...props });
|
|
135
151
|
});
|
|
136
152
|
var CardHeader = (0, import_react4.forwardRef)(function CardHeader2({ className, ...props }, ref) {
|
|
137
|
-
return /* @__PURE__ */ (0,
|
|
153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cx("ui-card-header", className), ref, ...props });
|
|
138
154
|
});
|
|
139
155
|
var CardContent = (0, import_react4.forwardRef)(function CardContent2({ className, ...props }, ref) {
|
|
140
|
-
return /* @__PURE__ */ (0,
|
|
156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cx("ui-card-content", className), ref, ...props });
|
|
141
157
|
});
|
|
142
158
|
var CardFooter = (0, import_react4.forwardRef)(function CardFooter2({ className, ...props }, ref) {
|
|
143
|
-
return /* @__PURE__ */ (0,
|
|
159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cx("ui-card-footer", className), ref, ...props });
|
|
144
160
|
});
|
|
145
161
|
|
|
146
|
-
// src/components/
|
|
162
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
147
163
|
var import_react5 = require("react");
|
|
148
|
-
var
|
|
149
|
-
var
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
164
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
165
|
+
var Checkbox = (0, import_react5.forwardRef)(function Checkbox2({ className, description, error, id, label, ...props }, ref) {
|
|
166
|
+
const generatedId = (0, import_react5.useId)();
|
|
167
|
+
const checkboxId = id ?? generatedId;
|
|
168
|
+
const descriptionId = description ? `${checkboxId}-description` : void 0;
|
|
169
|
+
const errorId = error ? `${checkboxId}-error` : void 0;
|
|
170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "ui-choice-field", children: [
|
|
171
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "ui-choice", children: [
|
|
172
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
173
|
+
"input",
|
|
174
|
+
{
|
|
175
|
+
"aria-describedby": cx(descriptionId, errorId) || void 0,
|
|
176
|
+
"aria-invalid": error ? true : void 0,
|
|
177
|
+
className: cx("ui-checkbox", className),
|
|
178
|
+
id: checkboxId,
|
|
179
|
+
ref,
|
|
180
|
+
type: "checkbox",
|
|
181
|
+
...props
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "ui-choice-copy", children: [
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ui-choice-label", children: label }),
|
|
186
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ui-choice-description", id: descriptionId, children: description }) : null
|
|
187
|
+
] })
|
|
188
|
+
] }),
|
|
189
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "ui-field-error", id: errorId, role: "alert", children: error }) : null
|
|
190
|
+
] });
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// src/components/EmptyState/EmptyState.tsx
|
|
194
|
+
var import_react6 = require("react");
|
|
195
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
196
|
+
var EmptyState = (0, import_react6.forwardRef)(function EmptyState2({ action, className, description, icon, title, ...props }, ref) {
|
|
197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: cx("ui-empty-state", className), ref, ...props, children: [
|
|
198
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { "aria-hidden": "true", children: icon }) : null,
|
|
199
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h2", { className: "ui-empty-state-title", children: title }),
|
|
200
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "ui-empty-state-description", children: description }) : null,
|
|
154
201
|
action
|
|
155
202
|
] });
|
|
156
203
|
});
|
|
157
204
|
|
|
158
205
|
// src/components/Input/Input.tsx
|
|
159
|
-
var
|
|
160
|
-
var
|
|
161
|
-
var Input = (0,
|
|
162
|
-
const generatedId = (0,
|
|
206
|
+
var import_react7 = require("react");
|
|
207
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
208
|
+
var Input = (0, import_react7.forwardRef)(function Input2({ className, error, helperText, id, label, ...props }, ref) {
|
|
209
|
+
const generatedId = (0, import_react7.useId)();
|
|
163
210
|
const inputId = id ?? generatedId;
|
|
164
211
|
const descriptionId = helperText ? `${inputId}-help` : void 0;
|
|
165
212
|
const errorId = error ? `${inputId}-error` : void 0;
|
|
166
|
-
return /* @__PURE__ */ (0,
|
|
167
|
-
label ? /* @__PURE__ */ (0,
|
|
168
|
-
/* @__PURE__ */ (0,
|
|
213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ui-input-field", children: [
|
|
214
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "ui-label", htmlFor: inputId, children: label }) : null,
|
|
215
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
169
216
|
"input",
|
|
170
217
|
{
|
|
171
218
|
"aria-describedby": cx(descriptionId, errorId) || void 0,
|
|
@@ -176,14 +223,14 @@ var Input = (0, import_react6.forwardRef)(function Input2({ className, error, he
|
|
|
176
223
|
...props
|
|
177
224
|
}
|
|
178
225
|
),
|
|
179
|
-
helperText ? /* @__PURE__ */ (0,
|
|
180
|
-
error ? /* @__PURE__ */ (0,
|
|
226
|
+
helperText ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "ui-field-help", id: descriptionId, children: helperText }) : null,
|
|
227
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "ui-field-error", id: errorId, role: "alert", children: error }) : null
|
|
181
228
|
] });
|
|
182
229
|
});
|
|
183
230
|
|
|
184
231
|
// src/components/Modal/Modal.tsx
|
|
185
|
-
var
|
|
186
|
-
var
|
|
232
|
+
var import_react8 = require("react");
|
|
233
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
187
234
|
function getFocusable(container) {
|
|
188
235
|
return Array.from(
|
|
189
236
|
container.querySelectorAll(
|
|
@@ -191,10 +238,10 @@ function getFocusable(container) {
|
|
|
191
238
|
)
|
|
192
239
|
).filter((element) => !element.hasAttribute("disabled") && element.tabIndex !== -1);
|
|
193
240
|
}
|
|
194
|
-
var Modal = (0,
|
|
195
|
-
const titleId = (0,
|
|
196
|
-
const dialogRef = (0,
|
|
197
|
-
(0,
|
|
241
|
+
var Modal = (0, import_react8.forwardRef)(function Modal2({ children, className, closeLabel = "Close dialog", isOpen, onOpenChange, title, ...props }, ref) {
|
|
242
|
+
const titleId = (0, import_react8.useId)();
|
|
243
|
+
const dialogRef = (0, import_react8.useRef)(null);
|
|
244
|
+
(0, import_react8.useEffect)(() => {
|
|
198
245
|
if (!isOpen) {
|
|
199
246
|
return;
|
|
200
247
|
}
|
|
@@ -238,7 +285,7 @@ var Modal = (0, import_react7.forwardRef)(function Modal2({ children, className,
|
|
|
238
285
|
first.focus();
|
|
239
286
|
}
|
|
240
287
|
}
|
|
241
|
-
return /* @__PURE__ */ (0,
|
|
288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ui-modal-overlay", onClick: handleOverlayClick, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
242
289
|
"div",
|
|
243
290
|
{
|
|
244
291
|
"aria-labelledby": titleId,
|
|
@@ -256,9 +303,9 @@ var Modal = (0, import_react7.forwardRef)(function Modal2({ children, className,
|
|
|
256
303
|
role: "dialog",
|
|
257
304
|
...props,
|
|
258
305
|
children: [
|
|
259
|
-
/* @__PURE__ */ (0,
|
|
260
|
-
/* @__PURE__ */ (0,
|
|
261
|
-
/* @__PURE__ */ (0,
|
|
306
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "ui-modal-header", children: [
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "ui-modal-title", id: titleId, children: title }),
|
|
308
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
262
309
|
"button",
|
|
263
310
|
{
|
|
264
311
|
"aria-label": closeLabel,
|
|
@@ -269,17 +316,80 @@ var Modal = (0, import_react7.forwardRef)(function Modal2({ children, className,
|
|
|
269
316
|
}
|
|
270
317
|
)
|
|
271
318
|
] }),
|
|
272
|
-
/* @__PURE__ */ (0,
|
|
319
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ui-modal-body", children })
|
|
273
320
|
]
|
|
274
321
|
}
|
|
275
322
|
) });
|
|
276
323
|
});
|
|
277
324
|
|
|
325
|
+
// src/components/Radio/Radio.tsx
|
|
326
|
+
var import_react9 = require("react");
|
|
327
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
328
|
+
var Radio = (0, import_react9.forwardRef)(function Radio2({ className, description, id, label, ...props }, ref) {
|
|
329
|
+
const generatedId = (0, import_react9.useId)();
|
|
330
|
+
const radioId = id ?? generatedId;
|
|
331
|
+
const descriptionId = description ? `${radioId}-description` : void 0;
|
|
332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "ui-choice", children: [
|
|
333
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
334
|
+
"input",
|
|
335
|
+
{
|
|
336
|
+
"aria-describedby": descriptionId,
|
|
337
|
+
className: cx("ui-radio", className),
|
|
338
|
+
id: radioId,
|
|
339
|
+
ref,
|
|
340
|
+
type: "radio",
|
|
341
|
+
...props
|
|
342
|
+
}
|
|
343
|
+
),
|
|
344
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "ui-choice-copy", children: [
|
|
345
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "ui-choice-label", children: label }),
|
|
346
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "ui-choice-description", id: descriptionId, children: description }) : null
|
|
347
|
+
] })
|
|
348
|
+
] });
|
|
349
|
+
});
|
|
350
|
+
function RadioGroup({ children, error, label }) {
|
|
351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("fieldset", { className: "ui-radio-group", children: [
|
|
352
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("legend", { className: "ui-label", children: label }),
|
|
353
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "ui-radio-options", children }),
|
|
354
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "ui-field-error", role: "alert", children: error }) : null
|
|
355
|
+
] });
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// src/components/Select/Select.tsx
|
|
359
|
+
var import_react10 = require("react");
|
|
360
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
361
|
+
var Select = (0, import_react10.forwardRef)(function Select2({ className, error, helperText, id, label, options, placeholder, ...props }, ref) {
|
|
362
|
+
const generatedId = (0, import_react10.useId)();
|
|
363
|
+
const selectId = id ?? generatedId;
|
|
364
|
+
const descriptionId = helperText ? `${selectId}-help` : void 0;
|
|
365
|
+
const errorId = error ? `${selectId}-error` : void 0;
|
|
366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "ui-input-field", children: [
|
|
367
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "ui-label", htmlFor: selectId, children: label }) : null,
|
|
368
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
369
|
+
"select",
|
|
370
|
+
{
|
|
371
|
+
"aria-describedby": cx(descriptionId, errorId) || void 0,
|
|
372
|
+
"aria-invalid": error ? true : void 0,
|
|
373
|
+
className: cx("ui-input", "ui-select", error && "ui-input-error", className),
|
|
374
|
+
id: selectId,
|
|
375
|
+
ref,
|
|
376
|
+
...props,
|
|
377
|
+
children: [
|
|
378
|
+
placeholder ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", disabled: true, children: placeholder }) : null,
|
|
379
|
+
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { disabled: option.disabled, value: option.value, children: option.label }, option.value))
|
|
380
|
+
]
|
|
381
|
+
}
|
|
382
|
+
),
|
|
383
|
+
helperText ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "ui-field-help", id: descriptionId, children: helperText }) : null,
|
|
384
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "ui-field-error", id: errorId, role: "alert", children: error }) : null
|
|
385
|
+
] });
|
|
386
|
+
});
|
|
387
|
+
|
|
278
388
|
// src/components/Skeleton/Skeleton.tsx
|
|
279
|
-
var
|
|
280
|
-
var
|
|
281
|
-
var Skeleton = (0,
|
|
282
|
-
return /* @__PURE__ */ (0,
|
|
389
|
+
var import_react11 = require("react");
|
|
390
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
391
|
+
var Skeleton = (0, import_react11.forwardRef)(function Skeleton2({ className, height = "1rem", style, width = "100%", ...props }, ref) {
|
|
392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
283
393
|
"div",
|
|
284
394
|
{
|
|
285
395
|
"aria-hidden": "true",
|
|
@@ -291,6 +401,125 @@ var Skeleton = (0, import_react8.forwardRef)(function Skeleton2({ className, hei
|
|
|
291
401
|
);
|
|
292
402
|
});
|
|
293
403
|
|
|
404
|
+
// src/components/Switch/Switch.tsx
|
|
405
|
+
var import_react12 = require("react");
|
|
406
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
407
|
+
var Switch = (0, import_react12.forwardRef)(function Switch2({ className, description, id, label, ...props }, ref) {
|
|
408
|
+
const generatedId = (0, import_react12.useId)();
|
|
409
|
+
const switchId = id ?? generatedId;
|
|
410
|
+
const descriptionId = description ? `${switchId}-description` : void 0;
|
|
411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "ui-switch", children: [
|
|
412
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "ui-choice-copy", children: [
|
|
413
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "ui-choice-label", children: label }),
|
|
414
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "ui-choice-description", id: descriptionId, children: description }) : null
|
|
415
|
+
] }),
|
|
416
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
417
|
+
"input",
|
|
418
|
+
{
|
|
419
|
+
"aria-describedby": descriptionId,
|
|
420
|
+
className: cx("ui-switch-input", className),
|
|
421
|
+
id: switchId,
|
|
422
|
+
ref,
|
|
423
|
+
role: "switch",
|
|
424
|
+
type: "checkbox",
|
|
425
|
+
...props
|
|
426
|
+
}
|
|
427
|
+
),
|
|
428
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": "true", className: "ui-switch-track", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "ui-switch-thumb" }) })
|
|
429
|
+
] });
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
// src/components/Tabs/Tabs.tsx
|
|
433
|
+
var import_react13 = require("react");
|
|
434
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
435
|
+
function Tabs({
|
|
436
|
+
"aria-label": ariaLabel,
|
|
437
|
+
className,
|
|
438
|
+
defaultValue,
|
|
439
|
+
items,
|
|
440
|
+
onValueChange,
|
|
441
|
+
value
|
|
442
|
+
}) {
|
|
443
|
+
const generatedId = (0, import_react13.useId)();
|
|
444
|
+
const firstEnabledValue = (0, import_react13.useMemo)(() => items.find((item) => !item.disabled)?.value, [items]);
|
|
445
|
+
const [internalValue, setInternalValue] = (0, import_react13.useState)(defaultValue ?? firstEnabledValue);
|
|
446
|
+
const selectedValue = value ?? internalValue;
|
|
447
|
+
const selectedItem = items.find((item) => item.value === selectedValue) ?? items[0];
|
|
448
|
+
function selectTab(nextValue) {
|
|
449
|
+
setInternalValue(nextValue);
|
|
450
|
+
onValueChange?.(nextValue);
|
|
451
|
+
}
|
|
452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cx("ui-tabs", className), children: [
|
|
453
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { "aria-label": ariaLabel, className: "ui-tab-list", role: "tablist", children: items.map((item) => {
|
|
454
|
+
const isSelected = item.value === selectedItem?.value;
|
|
455
|
+
const tabId = `${generatedId}-${item.value}-tab`;
|
|
456
|
+
const panelId = `${generatedId}-${item.value}-panel`;
|
|
457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
458
|
+
"button",
|
|
459
|
+
{
|
|
460
|
+
"aria-controls": panelId,
|
|
461
|
+
"aria-selected": isSelected,
|
|
462
|
+
className: "ui-tab",
|
|
463
|
+
disabled: item.disabled,
|
|
464
|
+
id: tabId,
|
|
465
|
+
onClick: () => selectTab(item.value),
|
|
466
|
+
role: "tab",
|
|
467
|
+
tabIndex: isSelected ? 0 : -1,
|
|
468
|
+
type: "button",
|
|
469
|
+
children: item.label
|
|
470
|
+
},
|
|
471
|
+
item.value
|
|
472
|
+
);
|
|
473
|
+
}) }),
|
|
474
|
+
selectedItem ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
475
|
+
"div",
|
|
476
|
+
{
|
|
477
|
+
"aria-labelledby": `${generatedId}-${selectedItem.value}-tab`,
|
|
478
|
+
className: "ui-tab-panel",
|
|
479
|
+
id: `${generatedId}-${selectedItem.value}-panel`,
|
|
480
|
+
role: "tabpanel",
|
|
481
|
+
children: selectedItem.content
|
|
482
|
+
}
|
|
483
|
+
) : null
|
|
484
|
+
] });
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// src/components/Textarea/Textarea.tsx
|
|
488
|
+
var import_react14 = require("react");
|
|
489
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
490
|
+
var Textarea = (0, import_react14.forwardRef)(function Textarea2({ className, error, helperText, id, label, rows = 4, ...props }, ref) {
|
|
491
|
+
const generatedId = (0, import_react14.useId)();
|
|
492
|
+
const textareaId = id ?? generatedId;
|
|
493
|
+
const descriptionId = helperText ? `${textareaId}-help` : void 0;
|
|
494
|
+
const errorId = error ? `${textareaId}-error` : void 0;
|
|
495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "ui-input-field", children: [
|
|
496
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { className: "ui-label", htmlFor: textareaId, children: label }) : null,
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
498
|
+
"textarea",
|
|
499
|
+
{
|
|
500
|
+
"aria-describedby": cx(descriptionId, errorId) || void 0,
|
|
501
|
+
"aria-invalid": error ? true : void 0,
|
|
502
|
+
className: cx("ui-input", "ui-textarea", error && "ui-input-error", className),
|
|
503
|
+
id: textareaId,
|
|
504
|
+
ref,
|
|
505
|
+
rows,
|
|
506
|
+
...props
|
|
507
|
+
}
|
|
508
|
+
),
|
|
509
|
+
helperText ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "ui-field-help", id: descriptionId, children: helperText }) : null,
|
|
510
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "ui-field-error", id: errorId, role: "alert", children: error }) : null
|
|
511
|
+
] });
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
515
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
516
|
+
function Tooltip({ children, content }) {
|
|
517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "ui-tooltip", children: [
|
|
518
|
+
children,
|
|
519
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "ui-tooltip-content", role: "tooltip", children: content })
|
|
520
|
+
] });
|
|
521
|
+
}
|
|
522
|
+
|
|
294
523
|
// src/tokens/colors.ts
|
|
295
524
|
var colors = {
|
|
296
525
|
background: "var(--ui-color-background)",
|
|
@@ -333,17 +562,26 @@ var typography = {
|
|
|
333
562
|
// Annotate the CommonJS export names for ESM import in node:
|
|
334
563
|
0 && (module.exports = {
|
|
335
564
|
Alert,
|
|
565
|
+
Avatar,
|
|
336
566
|
Badge,
|
|
337
567
|
Button,
|
|
338
568
|
Card,
|
|
339
569
|
CardContent,
|
|
340
570
|
CardFooter,
|
|
341
571
|
CardHeader,
|
|
572
|
+
Checkbox,
|
|
342
573
|
EmptyState,
|
|
343
574
|
Input,
|
|
344
575
|
Modal,
|
|
576
|
+
Radio,
|
|
577
|
+
RadioGroup,
|
|
578
|
+
Select,
|
|
345
579
|
Skeleton,
|
|
346
580
|
Spinner,
|
|
581
|
+
Switch,
|
|
582
|
+
Tabs,
|
|
583
|
+
Textarea,
|
|
584
|
+
Tooltip,
|
|
347
585
|
colors,
|
|
348
586
|
spacing,
|
|
349
587
|
typography
|