@ramong26/xp-components 1.0.10 → 1.0.14
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 +1 -1
- package/dist/index.cjs +572 -0
- package/dist/index.css +1164 -1
- package/dist/index.d.cts +122 -2
- package/dist/index.d.ts +122 -2
- package/dist/index.mjs +508 -1
- package/package.json +15 -15
- package/dist/index.cjs.js +0 -52
package/README.md
CHANGED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,572 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
App: () => App_default,
|
|
34
|
+
Button: () => Button_exports,
|
|
35
|
+
Carousel: () => Carousel_exports,
|
|
36
|
+
Checkbox: () => Checkbox_exports,
|
|
37
|
+
Chips: () => Chips_exports,
|
|
38
|
+
Input: () => Input_exports,
|
|
39
|
+
Select: () => Select_exports,
|
|
40
|
+
Slider: () => Slider_exports,
|
|
41
|
+
Switch: () => Switch_exports,
|
|
42
|
+
Tag: () => Tag_exports
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(index_exports);
|
|
45
|
+
|
|
46
|
+
// src/App.tsx
|
|
47
|
+
var import_react = require("react");
|
|
48
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
49
|
+
function App() {
|
|
50
|
+
const [count, setCount] = (0, import_react.useState)(0);
|
|
51
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
52
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { children: "Vite + React" }),
|
|
53
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "card", children: [
|
|
54
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { onClick: () => setCount((count2) => count2 + 1), children: [
|
|
55
|
+
"count is ",
|
|
56
|
+
count
|
|
57
|
+
] }),
|
|
58
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
59
|
+
"Edit ",
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: "src/App.tsx" }),
|
|
61
|
+
" and save to test HMR"
|
|
62
|
+
] })
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "read-the-docs", children: "Click on the Vite and React logos to learn more" })
|
|
65
|
+
] });
|
|
66
|
+
}
|
|
67
|
+
var App_default = App;
|
|
68
|
+
|
|
69
|
+
// src/components/Button/Button.tsx
|
|
70
|
+
var Button_exports = {};
|
|
71
|
+
__export(Button_exports, {
|
|
72
|
+
default: () => Button_default
|
|
73
|
+
});
|
|
74
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
75
|
+
var Button = ({
|
|
76
|
+
children,
|
|
77
|
+
variant = "default",
|
|
78
|
+
...rest
|
|
79
|
+
}) => {
|
|
80
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
81
|
+
"button",
|
|
82
|
+
{
|
|
83
|
+
className: `btn btn--${variant}`,
|
|
84
|
+
...rest,
|
|
85
|
+
style: { backgroundImage: `url(/assets/paper.png)` },
|
|
86
|
+
children
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
var Button_default = Button;
|
|
91
|
+
|
|
92
|
+
// src/components/Carousel/Carousel.tsx
|
|
93
|
+
var Carousel_exports = {};
|
|
94
|
+
__export(Carousel_exports, {
|
|
95
|
+
default: () => Carousel_default
|
|
96
|
+
});
|
|
97
|
+
var import_react2 = require("react");
|
|
98
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
99
|
+
var paperTexture = "/xp-components/assets/paper.png";
|
|
100
|
+
var Carousel = ({
|
|
101
|
+
items,
|
|
102
|
+
autoPlay = false,
|
|
103
|
+
interval = 3e3,
|
|
104
|
+
...rest
|
|
105
|
+
}) => {
|
|
106
|
+
const [currentIndex, setCurrentIndex] = (0, import_react2.useState)(0);
|
|
107
|
+
const [touchStartX, setTouchStartX] = (0, import_react2.useState)(null);
|
|
108
|
+
const [touchEndX, setTouchEndX] = (0, import_react2.useState)(null);
|
|
109
|
+
const handleTouchStart = (e) => {
|
|
110
|
+
setTouchStartX(e.touches[0].clientX);
|
|
111
|
+
};
|
|
112
|
+
const handleTouchMove = (e) => {
|
|
113
|
+
setTouchEndX(e.touches[0].clientX);
|
|
114
|
+
};
|
|
115
|
+
const handleTouchEnd = () => {
|
|
116
|
+
if (touchStartX === null || touchEndX === null) return;
|
|
117
|
+
const delta = touchStartX - touchEndX;
|
|
118
|
+
if (delta > 50) {
|
|
119
|
+
setCurrentIndex((prev) => (prev + 1) % items.length);
|
|
120
|
+
} else if (delta < -50) {
|
|
121
|
+
setCurrentIndex((prev) => (prev - 1 + items.length) % items.length);
|
|
122
|
+
}
|
|
123
|
+
setTouchStartX(null);
|
|
124
|
+
setTouchEndX(null);
|
|
125
|
+
};
|
|
126
|
+
(0, import_react2.useEffect)(() => {
|
|
127
|
+
if (!autoPlay) return;
|
|
128
|
+
const timer = setInterval(() => {
|
|
129
|
+
setCurrentIndex((prev) => (prev + 1) % items.length);
|
|
130
|
+
}, interval);
|
|
131
|
+
return () => clearInterval(timer);
|
|
132
|
+
}, [autoPlay, interval, items.length]);
|
|
133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
className: "carousel",
|
|
137
|
+
style: { backgroundImage: `url(${paperTexture})` },
|
|
138
|
+
children: [
|
|
139
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
140
|
+
"div",
|
|
141
|
+
{
|
|
142
|
+
className: "carousel__container",
|
|
143
|
+
...rest,
|
|
144
|
+
onTouchStart: handleTouchStart,
|
|
145
|
+
onTouchMove: handleTouchMove,
|
|
146
|
+
onTouchEnd: handleTouchEnd,
|
|
147
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
148
|
+
"ul",
|
|
149
|
+
{
|
|
150
|
+
className: "carousel__list",
|
|
151
|
+
style: { transform: `translateX(-${currentIndex * 100}%)` },
|
|
152
|
+
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
153
|
+
"li",
|
|
154
|
+
{
|
|
155
|
+
className: "carousel__item",
|
|
156
|
+
onClick: item.onClick,
|
|
157
|
+
"aria-hidden": index !== currentIndex,
|
|
158
|
+
children: [
|
|
159
|
+
item.image && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
160
|
+
"img",
|
|
161
|
+
{
|
|
162
|
+
src: item.image,
|
|
163
|
+
alt: item.title ?? "",
|
|
164
|
+
className: "carousel__image",
|
|
165
|
+
style: {
|
|
166
|
+
backgroundImage: `url(${paperTexture})`,
|
|
167
|
+
...item.imageStyle
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "carousel__content", children: [
|
|
172
|
+
item.title && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: "carousel__title", children: item.title }),
|
|
173
|
+
item.text && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "carousel__text", children: item.text })
|
|
174
|
+
] })
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
index
|
|
178
|
+
))
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "carousel__indicators", children: items.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
184
|
+
"button",
|
|
185
|
+
{
|
|
186
|
+
style: { backgroundImage: `url(${paperTexture})` },
|
|
187
|
+
className: `carousel__indicator ${index === currentIndex ? "active" : ""}`,
|
|
188
|
+
onClick: () => setCurrentIndex(index),
|
|
189
|
+
"aria-label": `Go to slide ${index + 1}`
|
|
190
|
+
},
|
|
191
|
+
index
|
|
192
|
+
)) })
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
};
|
|
197
|
+
var Carousel_default = Carousel;
|
|
198
|
+
|
|
199
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
200
|
+
var Checkbox_exports = {};
|
|
201
|
+
__export(Checkbox_exports, {
|
|
202
|
+
default: () => Checkbox_default
|
|
203
|
+
});
|
|
204
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
205
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
206
|
+
var paperTexture2 = "/xp-components/assets/paper.png";
|
|
207
|
+
var Checkbox = ({ label, ...rest }) => {
|
|
208
|
+
const reactId = import_react3.default.useId();
|
|
209
|
+
const id = rest.id ?? reactId;
|
|
210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { htmlFor: id, className: "checkbox", children: [
|
|
211
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
212
|
+
"input",
|
|
213
|
+
{
|
|
214
|
+
id,
|
|
215
|
+
type: "checkbox",
|
|
216
|
+
className: "checkbox_input",
|
|
217
|
+
...rest,
|
|
218
|
+
style: { backgroundImage: `url(${paperTexture2})` }
|
|
219
|
+
}
|
|
220
|
+
),
|
|
221
|
+
label
|
|
222
|
+
] });
|
|
223
|
+
};
|
|
224
|
+
var Checkbox_default = Checkbox;
|
|
225
|
+
|
|
226
|
+
// src/components/Chips/Chips.tsx
|
|
227
|
+
var Chips_exports = {};
|
|
228
|
+
__export(Chips_exports, {
|
|
229
|
+
default: () => Chips_default
|
|
230
|
+
});
|
|
231
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
232
|
+
var paperTexture3 = "/xp-components/assets/paper.png";
|
|
233
|
+
var Chips = ({
|
|
234
|
+
children,
|
|
235
|
+
onRemove,
|
|
236
|
+
selected,
|
|
237
|
+
onClick,
|
|
238
|
+
...rest
|
|
239
|
+
}) => {
|
|
240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
241
|
+
"div",
|
|
242
|
+
{
|
|
243
|
+
style: { backgroundImage: `url(${paperTexture3})` },
|
|
244
|
+
className: `chip${selected ? " selected" : ""}`,
|
|
245
|
+
role: onClick ? "button" : void 0,
|
|
246
|
+
tabIndex: onClick ? 0 : void 0,
|
|
247
|
+
onClick,
|
|
248
|
+
onKeyDown: (e) => onClick && e.key === "Enter" && onClick(),
|
|
249
|
+
...rest,
|
|
250
|
+
children: [
|
|
251
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "chip-label", children }),
|
|
252
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
253
|
+
"button",
|
|
254
|
+
{
|
|
255
|
+
type: "button",
|
|
256
|
+
className: "chip-remove",
|
|
257
|
+
"aria-label": "Remove chip",
|
|
258
|
+
onClick: (e) => {
|
|
259
|
+
e.stopPropagation();
|
|
260
|
+
onRemove();
|
|
261
|
+
},
|
|
262
|
+
children: "\xD7"
|
|
263
|
+
}
|
|
264
|
+
)
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
};
|
|
269
|
+
var Chips_default = Chips;
|
|
270
|
+
|
|
271
|
+
// src/components/Input/Input.tsx
|
|
272
|
+
var Input_exports = {};
|
|
273
|
+
__export(Input_exports, {
|
|
274
|
+
default: () => Input_default
|
|
275
|
+
});
|
|
276
|
+
var import_react4 = require("react");
|
|
277
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
278
|
+
var paperTexture4 = "/xp-components/assets/paper.png";
|
|
279
|
+
var Input = ({
|
|
280
|
+
label,
|
|
281
|
+
variant = "default",
|
|
282
|
+
id: propId,
|
|
283
|
+
type = "text",
|
|
284
|
+
className = "",
|
|
285
|
+
...rest
|
|
286
|
+
}) => {
|
|
287
|
+
const reactId = (0, import_react4.useId)();
|
|
288
|
+
const id = propId || reactId;
|
|
289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `input__wrapper`, children: [
|
|
290
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
291
|
+
"input",
|
|
292
|
+
{
|
|
293
|
+
id,
|
|
294
|
+
type,
|
|
295
|
+
className: `input input--${variant} ${className}`,
|
|
296
|
+
style: { backgroundImage: `url(${paperTexture4})` },
|
|
297
|
+
...rest
|
|
298
|
+
}
|
|
299
|
+
),
|
|
300
|
+
variant === "title" && label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
301
|
+
"label",
|
|
302
|
+
{
|
|
303
|
+
htmlFor: id,
|
|
304
|
+
className: "input__placeholder",
|
|
305
|
+
style: { backgroundImage: `url(${paperTexture4})` },
|
|
306
|
+
children: label
|
|
307
|
+
}
|
|
308
|
+
)
|
|
309
|
+
] });
|
|
310
|
+
};
|
|
311
|
+
var Input_default = Input;
|
|
312
|
+
|
|
313
|
+
// src/components/Select/Select.tsx
|
|
314
|
+
var Select_exports = {};
|
|
315
|
+
__export(Select_exports, {
|
|
316
|
+
default: () => Select_default
|
|
317
|
+
});
|
|
318
|
+
var import_react5 = require("react");
|
|
319
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
320
|
+
var paperTexture5 = "/xp-components/assets/paper.png";
|
|
321
|
+
var Select = ({
|
|
322
|
+
label,
|
|
323
|
+
options,
|
|
324
|
+
value,
|
|
325
|
+
onChange,
|
|
326
|
+
...rest
|
|
327
|
+
}) => {
|
|
328
|
+
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
329
|
+
const [focusedIdx, setFocusedIdx] = (0, import_react5.useState)(null);
|
|
330
|
+
const rootRef = (0, import_react5.useRef)(null);
|
|
331
|
+
const ulRef = (0, import_react5.useRef)(null);
|
|
332
|
+
(0, import_react5.useEffect)(() => {
|
|
333
|
+
const handleClickOutside = (event) => {
|
|
334
|
+
if (rootRef.current && !rootRef.current.contains(event.target)) {
|
|
335
|
+
setOpen(false);
|
|
336
|
+
setFocusedIdx(null);
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
window.addEventListener("mousedown", handleClickOutside);
|
|
340
|
+
return () => {
|
|
341
|
+
window.removeEventListener("mousedown", handleClickOutside);
|
|
342
|
+
};
|
|
343
|
+
}, [open]);
|
|
344
|
+
const handleKeyDown = (e) => {
|
|
345
|
+
if (!open) return;
|
|
346
|
+
if (e.key === "ArrowDown") {
|
|
347
|
+
e.preventDefault();
|
|
348
|
+
setFocusedIdx(
|
|
349
|
+
(prev) => prev === null || prev === options.length - 1 ? 0 : prev + 1
|
|
350
|
+
);
|
|
351
|
+
} else if (e.key === "ArrowUp") {
|
|
352
|
+
e.preventDefault();
|
|
353
|
+
setFocusedIdx(
|
|
354
|
+
(prev) => prev === null || prev === 0 ? options.length - 1 : prev - 1
|
|
355
|
+
);
|
|
356
|
+
} else if (e.key === "Enter" && focusedIdx !== null) {
|
|
357
|
+
e.preventDefault();
|
|
358
|
+
const selectedOption = options[focusedIdx];
|
|
359
|
+
onChange == null ? void 0 : onChange(selectedOption.value);
|
|
360
|
+
setOpen(false);
|
|
361
|
+
setFocusedIdx(null);
|
|
362
|
+
} else if (e.key === "Escape") {
|
|
363
|
+
setOpen(false);
|
|
364
|
+
setFocusedIdx(null);
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
(0, import_react5.useEffect)(() => {
|
|
368
|
+
if (open) setFocusedIdx(0);
|
|
369
|
+
else setFocusedIdx(null);
|
|
370
|
+
}, [open]);
|
|
371
|
+
(0, import_react5.useEffect)(() => {
|
|
372
|
+
var _a;
|
|
373
|
+
if (open) (_a = ulRef.current) == null ? void 0 : _a.focus();
|
|
374
|
+
}, [open]);
|
|
375
|
+
const selectedLabel = (0, import_react5.useMemo)(
|
|
376
|
+
() => {
|
|
377
|
+
var _a;
|
|
378
|
+
return ((_a = options.find((opt) => opt.value === value)) == null ? void 0 : _a.label) ?? label;
|
|
379
|
+
},
|
|
380
|
+
[options, value, label]
|
|
381
|
+
);
|
|
382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "select", ref: rootRef, children: [
|
|
383
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
384
|
+
"button",
|
|
385
|
+
{
|
|
386
|
+
...rest,
|
|
387
|
+
className: "select__button",
|
|
388
|
+
style: { backgroundImage: `url(${paperTexture5})` },
|
|
389
|
+
onClick: () => setOpen((v) => !v),
|
|
390
|
+
type: "button",
|
|
391
|
+
"aria-haspopup": "listbox",
|
|
392
|
+
"aria-expanded": open,
|
|
393
|
+
"aria-controls": "select-list",
|
|
394
|
+
"aria-label": label,
|
|
395
|
+
onKeyDown: handleKeyDown,
|
|
396
|
+
children: selectedLabel
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
400
|
+
"ul",
|
|
401
|
+
{
|
|
402
|
+
className: "select__list",
|
|
403
|
+
style: { backgroundImage: `url(${paperTexture5})` },
|
|
404
|
+
role: "listbox",
|
|
405
|
+
id: "select-list",
|
|
406
|
+
onKeyDown: handleKeyDown,
|
|
407
|
+
ref: ulRef,
|
|
408
|
+
children: options.map((opt, idx) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
409
|
+
"li",
|
|
410
|
+
{
|
|
411
|
+
className: `select__item ${focusedIdx === idx ? "focused" : ""}`,
|
|
412
|
+
role: "option",
|
|
413
|
+
tabIndex: focusedIdx === idx ? 0 : -1,
|
|
414
|
+
"aria-selected": value === opt.value,
|
|
415
|
+
onClick: () => {
|
|
416
|
+
onChange == null ? void 0 : onChange(opt.value);
|
|
417
|
+
setOpen(false);
|
|
418
|
+
setFocusedIdx(null);
|
|
419
|
+
},
|
|
420
|
+
onMouseEnter: () => setFocusedIdx(idx),
|
|
421
|
+
onMouseLeave: () => setFocusedIdx(null),
|
|
422
|
+
children: opt.label
|
|
423
|
+
},
|
|
424
|
+
opt.value
|
|
425
|
+
))
|
|
426
|
+
}
|
|
427
|
+
)
|
|
428
|
+
] });
|
|
429
|
+
};
|
|
430
|
+
var Select_default = Select;
|
|
431
|
+
|
|
432
|
+
// src/components/Slider/Slider.tsx
|
|
433
|
+
var Slider_exports = {};
|
|
434
|
+
__export(Slider_exports, {
|
|
435
|
+
default: () => Slider_default
|
|
436
|
+
});
|
|
437
|
+
var import_react6 = __toESM(require("react"), 1);
|
|
438
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
439
|
+
var paperTexture6 = "/xp-components/assets/paper.png";
|
|
440
|
+
var Slider = ({
|
|
441
|
+
min = 0,
|
|
442
|
+
max = 100,
|
|
443
|
+
step = 1,
|
|
444
|
+
value,
|
|
445
|
+
onChange,
|
|
446
|
+
showValue = true
|
|
447
|
+
}) => {
|
|
448
|
+
const [internalValue, setInternalValue] = (0, import_react6.useState)(value ?? min);
|
|
449
|
+
const handleChange = (e) => {
|
|
450
|
+
const newValue = Number(e.target.value);
|
|
451
|
+
setInternalValue(newValue);
|
|
452
|
+
onChange == null ? void 0 : onChange(newValue);
|
|
453
|
+
};
|
|
454
|
+
import_react6.default.useEffect(() => {
|
|
455
|
+
if (typeof value === "number") {
|
|
456
|
+
setInternalValue(value);
|
|
457
|
+
}
|
|
458
|
+
}, [value]);
|
|
459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "slider", children: [
|
|
460
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
461
|
+
"input",
|
|
462
|
+
{
|
|
463
|
+
style: { backgroundImage: `url(${paperTexture6})` },
|
|
464
|
+
type: "range",
|
|
465
|
+
min,
|
|
466
|
+
max,
|
|
467
|
+
step,
|
|
468
|
+
value: internalValue,
|
|
469
|
+
onChange: handleChange,
|
|
470
|
+
className: "slider__input"
|
|
471
|
+
}
|
|
472
|
+
),
|
|
473
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
474
|
+
"span",
|
|
475
|
+
{
|
|
476
|
+
style: { backgroundImage: ` url(${paperTexture6})` },
|
|
477
|
+
className: "slider__value",
|
|
478
|
+
children: internalValue
|
|
479
|
+
}
|
|
480
|
+
)
|
|
481
|
+
] });
|
|
482
|
+
};
|
|
483
|
+
var Slider_default = Slider;
|
|
484
|
+
|
|
485
|
+
// src/components/Switch/Switch.tsx
|
|
486
|
+
var Switch_exports = {};
|
|
487
|
+
__export(Switch_exports, {
|
|
488
|
+
default: () => Switch_default
|
|
489
|
+
});
|
|
490
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
491
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
492
|
+
var paperTexture7 = "/xp-components/assets/paper.png";
|
|
493
|
+
var Switch = ({ label, disabled, ...rest }) => {
|
|
494
|
+
const reactId = import_react7.default.useId();
|
|
495
|
+
const id = rest.id ?? reactId;
|
|
496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: `switch${disabled ? " switch--disabled" : ""}`, children: [
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
498
|
+
"input",
|
|
499
|
+
{
|
|
500
|
+
id,
|
|
501
|
+
type: "checkbox",
|
|
502
|
+
className: "switch__input",
|
|
503
|
+
disabled,
|
|
504
|
+
...rest
|
|
505
|
+
}
|
|
506
|
+
),
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
508
|
+
"span",
|
|
509
|
+
{
|
|
510
|
+
className: "switch__slider",
|
|
511
|
+
style: { backgroundImage: `url(${paperTexture7})` }
|
|
512
|
+
}
|
|
513
|
+
),
|
|
514
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "switch__label", children: label })
|
|
515
|
+
] });
|
|
516
|
+
};
|
|
517
|
+
var Switch_default = Switch;
|
|
518
|
+
|
|
519
|
+
// src/components/Tag/Tag.tsx
|
|
520
|
+
var Tag_exports = {};
|
|
521
|
+
__export(Tag_exports, {
|
|
522
|
+
default: () => Tag_default
|
|
523
|
+
});
|
|
524
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
525
|
+
var paperTexture8 = "/xp-components/assets/paper.png";
|
|
526
|
+
var Tag = ({
|
|
527
|
+
children,
|
|
528
|
+
variant = "default",
|
|
529
|
+
size = "md",
|
|
530
|
+
icon,
|
|
531
|
+
closable,
|
|
532
|
+
onClose,
|
|
533
|
+
className = "",
|
|
534
|
+
...rest
|
|
535
|
+
}) => {
|
|
536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
537
|
+
"span",
|
|
538
|
+
{
|
|
539
|
+
...rest,
|
|
540
|
+
className: `tag tag--${variant} tag--${size} ${className}`,
|
|
541
|
+
style: { backgroundImage: `url(${paperTexture8})` },
|
|
542
|
+
children: [
|
|
543
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "tag__icon", children: icon }),
|
|
544
|
+
children,
|
|
545
|
+
closable && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
546
|
+
"button",
|
|
547
|
+
{
|
|
548
|
+
type: "button",
|
|
549
|
+
onClick: onClose,
|
|
550
|
+
className: "tag__close",
|
|
551
|
+
"aria-label": "\uB2EB\uAE30",
|
|
552
|
+
children: "\xD7"
|
|
553
|
+
}
|
|
554
|
+
)
|
|
555
|
+
]
|
|
556
|
+
}
|
|
557
|
+
);
|
|
558
|
+
};
|
|
559
|
+
var Tag_default = Tag;
|
|
560
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
561
|
+
0 && (module.exports = {
|
|
562
|
+
App,
|
|
563
|
+
Button,
|
|
564
|
+
Carousel,
|
|
565
|
+
Checkbox,
|
|
566
|
+
Chips,
|
|
567
|
+
Input,
|
|
568
|
+
Select,
|
|
569
|
+
Slider,
|
|
570
|
+
Switch,
|
|
571
|
+
Tag
|
|
572
|
+
});
|