@ramong26/xp-components 1.0.16 → 1.0.17
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 +110 -244
- package/dist/index.css +492 -980
- package/dist/index.d.cts +22 -4
- package/dist/index.d.ts +22 -4
- package/dist/index.mjs +110 -244
- package/dist/paper-DM7JLBKK.png +0 -0
- package/package.json +90 -90
package/dist/index.mjs
CHANGED
|
@@ -25,180 +25,123 @@ var App_default = App;
|
|
|
25
25
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
26
26
|
var Button = ({
|
|
27
27
|
children,
|
|
28
|
-
variant = "
|
|
28
|
+
variant = "primary",
|
|
29
|
+
size = "md",
|
|
30
|
+
className,
|
|
29
31
|
...rest
|
|
30
32
|
}) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
className: `btn btn--${variant}`,
|
|
35
|
-
...rest,
|
|
36
|
-
style: { backgroundImage: `url(/assets/paper.png)` },
|
|
37
|
-
children
|
|
38
|
-
}
|
|
39
|
-
);
|
|
33
|
+
const resolvedVariant = variant === "default" ? "primary" : variant;
|
|
34
|
+
const classes = ["btn", `btn--${resolvedVariant}`, `btn--${size}`, className].filter(Boolean).join(" ");
|
|
35
|
+
return /* @__PURE__ */ jsx2("button", { className: classes, ...rest, children });
|
|
40
36
|
};
|
|
41
37
|
var Button_default = Button;
|
|
42
38
|
|
|
43
39
|
// src/components/Carousel/Carousel.tsx
|
|
44
40
|
import { useState as useState2, useEffect } from "react";
|
|
45
41
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
46
|
-
var paperTexture = "/xp-components/assets/paper.png";
|
|
47
42
|
var Carousel = ({
|
|
48
43
|
items,
|
|
49
44
|
autoPlay = false,
|
|
50
45
|
interval = 3e3,
|
|
46
|
+
variant = "default",
|
|
47
|
+
showIndicators = true,
|
|
48
|
+
className,
|
|
51
49
|
...rest
|
|
52
50
|
}) => {
|
|
53
51
|
const [currentIndex, setCurrentIndex] = useState2(0);
|
|
54
52
|
const [touchStartX, setTouchStartX] = useState2(null);
|
|
55
53
|
const [touchEndX, setTouchEndX] = useState2(null);
|
|
56
|
-
const handleTouchStart = (e) =>
|
|
57
|
-
|
|
58
|
-
};
|
|
59
|
-
const handleTouchMove = (e) => {
|
|
60
|
-
setTouchEndX(e.touches[0].clientX);
|
|
61
|
-
};
|
|
54
|
+
const handleTouchStart = (e) => setTouchStartX(e.touches[0].clientX);
|
|
55
|
+
const handleTouchMove = (e) => setTouchEndX(e.touches[0].clientX);
|
|
62
56
|
const handleTouchEnd = () => {
|
|
63
57
|
if (touchStartX === null || touchEndX === null) return;
|
|
64
58
|
const delta = touchStartX - touchEndX;
|
|
65
|
-
if (delta > 50)
|
|
66
|
-
|
|
67
|
-
} else if (delta < -50) {
|
|
68
|
-
setCurrentIndex((prev) => (prev - 1 + items.length) % items.length);
|
|
69
|
-
}
|
|
59
|
+
if (delta > 50) setCurrentIndex((prev) => (prev + 1) % items.length);
|
|
60
|
+
if (delta < -50) setCurrentIndex((prev) => (prev - 1 + items.length) % items.length);
|
|
70
61
|
setTouchStartX(null);
|
|
71
62
|
setTouchEndX(null);
|
|
72
63
|
};
|
|
73
64
|
useEffect(() => {
|
|
74
|
-
if (!autoPlay) return;
|
|
75
|
-
const timer = setInterval(() =>
|
|
76
|
-
setCurrentIndex((prev) => (prev + 1) % items.length);
|
|
77
|
-
}, interval);
|
|
65
|
+
if (!autoPlay || items.length < 2) return;
|
|
66
|
+
const timer = setInterval(() => setCurrentIndex((prev) => (prev + 1) % items.length), interval);
|
|
78
67
|
return () => clearInterval(timer);
|
|
79
68
|
}, [autoPlay, interval, items.length]);
|
|
80
|
-
return /* @__PURE__ */ jsxs2(
|
|
81
|
-
"div",
|
|
82
|
-
|
|
83
|
-
className: "
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
children: items.map((item, index) => /* @__PURE__ */ jsxs2(
|
|
100
|
-
"li",
|
|
101
|
-
{
|
|
102
|
-
className: "carousel__item",
|
|
103
|
-
onClick: item.onClick,
|
|
104
|
-
"aria-hidden": index !== currentIndex,
|
|
105
|
-
children: [
|
|
106
|
-
item.image && /* @__PURE__ */ jsx3(
|
|
107
|
-
"img",
|
|
108
|
-
{
|
|
109
|
-
src: item.image,
|
|
110
|
-
alt: item.title ?? "",
|
|
111
|
-
className: "carousel__image",
|
|
112
|
-
style: {
|
|
113
|
-
backgroundImage: `url(${paperTexture})`,
|
|
114
|
-
...item.imageStyle
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
),
|
|
118
|
-
/* @__PURE__ */ jsxs2("div", { className: "carousel__content", children: [
|
|
119
|
-
item.title && /* @__PURE__ */ jsx3("h2", { className: "carousel__title", children: item.title }),
|
|
120
|
-
item.text && /* @__PURE__ */ jsx3("p", { className: "carousel__text", children: item.text })
|
|
121
|
-
] })
|
|
122
|
-
]
|
|
123
|
-
},
|
|
124
|
-
index
|
|
125
|
-
))
|
|
126
|
-
}
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
),
|
|
130
|
-
/* @__PURE__ */ jsx3("div", { className: "carousel__indicators", children: items.map((_, index) => /* @__PURE__ */ jsx3(
|
|
131
|
-
"button",
|
|
132
|
-
{
|
|
133
|
-
style: { backgroundImage: `url(${paperTexture})` },
|
|
134
|
-
className: `carousel__indicator ${index === currentIndex ? "active" : ""}`,
|
|
135
|
-
onClick: () => setCurrentIndex(index),
|
|
136
|
-
"aria-label": `Go to slide ${index + 1}`
|
|
137
|
-
},
|
|
138
|
-
index
|
|
139
|
-
)) })
|
|
140
|
-
]
|
|
141
|
-
}
|
|
142
|
-
);
|
|
69
|
+
return /* @__PURE__ */ jsxs2("div", { className: ["carousel", `carousel--${variant}`, className].filter(Boolean).join(" "), children: [
|
|
70
|
+
/* @__PURE__ */ jsx3("div", { className: "carousel__container", ...rest, onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd, children: /* @__PURE__ */ jsx3("ul", { className: "carousel__list", style: { transform: `translateX(-${currentIndex * 100}%)` }, children: items.map((item, index) => /* @__PURE__ */ jsxs2("li", { className: "carousel__item", onClick: item.onClick, "aria-hidden": index !== currentIndex, children: [
|
|
71
|
+
item.image && /* @__PURE__ */ jsx3("img", { src: item.image, alt: item.title ?? "", className: "carousel__image", style: item.imageStyle }),
|
|
72
|
+
/* @__PURE__ */ jsxs2("div", { className: "carousel__content", children: [
|
|
73
|
+
item.title && /* @__PURE__ */ jsx3("h2", { className: "carousel__title", children: item.title }),
|
|
74
|
+
item.text && /* @__PURE__ */ jsx3("p", { className: "carousel__text", children: item.text })
|
|
75
|
+
] })
|
|
76
|
+
] }, index)) }) }),
|
|
77
|
+
showIndicators && /* @__PURE__ */ jsx3("div", { className: "carousel__indicators", children: items.map((_, index) => /* @__PURE__ */ jsx3(
|
|
78
|
+
"button",
|
|
79
|
+
{
|
|
80
|
+
className: `carousel__indicator ${index === currentIndex ? "active" : ""}`,
|
|
81
|
+
onClick: () => setCurrentIndex(index),
|
|
82
|
+
"aria-label": `Go to slide ${index + 1}`,
|
|
83
|
+
type: "button"
|
|
84
|
+
},
|
|
85
|
+
index
|
|
86
|
+
)) })
|
|
87
|
+
] });
|
|
143
88
|
};
|
|
144
89
|
var Carousel_default = Carousel;
|
|
145
90
|
|
|
146
91
|
// src/components/Checkbox/Checkbox.tsx
|
|
147
92
|
import React2 from "react";
|
|
148
93
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
149
|
-
var
|
|
150
|
-
var Checkbox = ({ label, ...rest }) => {
|
|
94
|
+
var Checkbox = ({ label, variant = "default", className, ...rest }) => {
|
|
151
95
|
const reactId = React2.useId();
|
|
152
96
|
const id = rest.id ?? reactId;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
type: "checkbox",
|
|
159
|
-
className: "checkbox_input",
|
|
160
|
-
...rest,
|
|
161
|
-
style: { backgroundImage: `url(${paperTexture2})` }
|
|
162
|
-
}
|
|
163
|
-
),
|
|
164
|
-
label
|
|
97
|
+
const classes = ["checkbox", `checkbox--${variant}`, className].filter(Boolean).join(" ");
|
|
98
|
+
return /* @__PURE__ */ jsxs3("label", { htmlFor: id, className: classes, children: [
|
|
99
|
+
/* @__PURE__ */ jsx4("input", { id, type: "checkbox", className: "checkbox__input", ...rest }),
|
|
100
|
+
/* @__PURE__ */ jsx4("span", { className: "checkbox__box", "aria-hidden": "true" }),
|
|
101
|
+
/* @__PURE__ */ jsx4("span", { className: "checkbox__label", children: label })
|
|
165
102
|
] });
|
|
166
103
|
};
|
|
167
104
|
var Checkbox_default = Checkbox;
|
|
168
105
|
|
|
169
106
|
// src/components/Chips/Chips.tsx
|
|
170
107
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
171
|
-
var paperTexture3 = "/xp-components/assets/paper.png";
|
|
172
108
|
var Chips = ({
|
|
173
109
|
children,
|
|
174
110
|
onRemove,
|
|
175
111
|
selected,
|
|
176
112
|
onClick,
|
|
113
|
+
variant = "default",
|
|
114
|
+
className,
|
|
177
115
|
...rest
|
|
178
116
|
}) => {
|
|
117
|
+
const classes = ["chip", `chip--${variant}`, selected && "is-selected", className].filter(Boolean).join(" ");
|
|
179
118
|
return /* @__PURE__ */ jsxs4(
|
|
180
119
|
"div",
|
|
181
120
|
{
|
|
182
|
-
|
|
183
|
-
className: `chip${selected ? " selected" : ""}`,
|
|
121
|
+
className: classes,
|
|
184
122
|
role: onClick ? "button" : void 0,
|
|
185
123
|
tabIndex: onClick ? 0 : void 0,
|
|
186
124
|
onClick,
|
|
187
|
-
onKeyDown: (e) =>
|
|
125
|
+
onKeyDown: (e) => {
|
|
126
|
+
if (onClick && (e.key === "Enter" || e.key === " ")) {
|
|
127
|
+
e.preventDefault();
|
|
128
|
+
onClick();
|
|
129
|
+
}
|
|
130
|
+
},
|
|
188
131
|
...rest,
|
|
189
132
|
children: [
|
|
190
|
-
/* @__PURE__ */ jsx5("span", { className: "
|
|
133
|
+
/* @__PURE__ */ jsx5("span", { className: "chip__label", children }),
|
|
191
134
|
onRemove && /* @__PURE__ */ jsx5(
|
|
192
135
|
"button",
|
|
193
136
|
{
|
|
194
137
|
type: "button",
|
|
195
|
-
className: "
|
|
138
|
+
className: "chip__remove",
|
|
196
139
|
"aria-label": "Remove chip",
|
|
197
140
|
onClick: (e) => {
|
|
198
141
|
e.stopPropagation();
|
|
199
142
|
onRemove();
|
|
200
143
|
},
|
|
201
|
-
children: "
|
|
144
|
+
children: "x"
|
|
202
145
|
}
|
|
203
146
|
)
|
|
204
147
|
]
|
|
@@ -210,37 +153,20 @@ var Chips_default = Chips;
|
|
|
210
153
|
// src/components/Input/Input.tsx
|
|
211
154
|
import { useId } from "react";
|
|
212
155
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
213
|
-
var paperTexture4 = "/xp-components/assets/paper.png";
|
|
214
156
|
var Input = ({
|
|
215
157
|
label,
|
|
216
158
|
variant = "default",
|
|
217
159
|
id: propId,
|
|
218
160
|
type = "text",
|
|
219
|
-
className
|
|
161
|
+
className,
|
|
220
162
|
...rest
|
|
221
163
|
}) => {
|
|
222
164
|
const reactId = useId();
|
|
223
165
|
const id = propId || reactId;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
id,
|
|
229
|
-
type,
|
|
230
|
-
className: `input input--${variant} ${className}`,
|
|
231
|
-
style: { backgroundImage: `url(${paperTexture4})` },
|
|
232
|
-
...rest
|
|
233
|
-
}
|
|
234
|
-
),
|
|
235
|
-
variant === "title" && label && /* @__PURE__ */ jsx6(
|
|
236
|
-
"label",
|
|
237
|
-
{
|
|
238
|
-
htmlFor: id,
|
|
239
|
-
className: "input__placeholder",
|
|
240
|
-
style: { backgroundImage: `url(${paperTexture4})` },
|
|
241
|
-
children: label
|
|
242
|
-
}
|
|
243
|
-
)
|
|
166
|
+
const classes = ["input", `input--${variant}`, className].filter(Boolean).join(" ");
|
|
167
|
+
return /* @__PURE__ */ jsxs5("div", { className: "input__wrapper", children: [
|
|
168
|
+
/* @__PURE__ */ jsx6("input", { id, type, className: classes, ...rest }),
|
|
169
|
+
(variant === "title" || variant === "search") && label && /* @__PURE__ */ jsx6("label", { htmlFor: id, className: "input__label", children: label })
|
|
244
170
|
] });
|
|
245
171
|
};
|
|
246
172
|
var Input_default = Input;
|
|
@@ -248,14 +174,7 @@ var Input_default = Input;
|
|
|
248
174
|
// src/components/Select/Select.tsx
|
|
249
175
|
import { useState as useState3, useRef, useEffect as useEffect2, useMemo } from "react";
|
|
250
176
|
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
251
|
-
var
|
|
252
|
-
var Select = ({
|
|
253
|
-
label,
|
|
254
|
-
options,
|
|
255
|
-
value,
|
|
256
|
-
onChange,
|
|
257
|
-
...rest
|
|
258
|
-
}) => {
|
|
177
|
+
var Select = ({ label, options, value, onChange, variant = "default", className, ...rest }) => {
|
|
259
178
|
const [open, setOpen] = useState3(false);
|
|
260
179
|
const [focusedIdx, setFocusedIdx] = useState3(null);
|
|
261
180
|
const rootRef = useRef(null);
|
|
@@ -268,22 +187,21 @@ var Select = ({
|
|
|
268
187
|
}
|
|
269
188
|
};
|
|
270
189
|
window.addEventListener("mousedown", handleClickOutside);
|
|
271
|
-
return () =>
|
|
272
|
-
|
|
273
|
-
};
|
|
274
|
-
}, [open]);
|
|
190
|
+
return () => window.removeEventListener("mousedown", handleClickOutside);
|
|
191
|
+
}, []);
|
|
275
192
|
const handleKeyDown = (e) => {
|
|
193
|
+
if (!open && (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ")) {
|
|
194
|
+
e.preventDefault();
|
|
195
|
+
setOpen(true);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
276
198
|
if (!open) return;
|
|
277
199
|
if (e.key === "ArrowDown") {
|
|
278
200
|
e.preventDefault();
|
|
279
|
-
setFocusedIdx(
|
|
280
|
-
(prev) => prev === null || prev === options.length - 1 ? 0 : prev + 1
|
|
281
|
-
);
|
|
201
|
+
setFocusedIdx((prev) => prev === null || prev === options.length - 1 ? 0 : prev + 1);
|
|
282
202
|
} else if (e.key === "ArrowUp") {
|
|
283
203
|
e.preventDefault();
|
|
284
|
-
setFocusedIdx(
|
|
285
|
-
(prev) => prev === null || prev === 0 ? options.length - 1 : prev - 1
|
|
286
|
-
);
|
|
204
|
+
setFocusedIdx((prev) => prev === null || prev === 0 ? options.length - 1 : prev - 1);
|
|
287
205
|
} else if (e.key === "Enter" && focusedIdx !== null) {
|
|
288
206
|
e.preventDefault();
|
|
289
207
|
const selectedOption = options[focusedIdx];
|
|
@@ -303,20 +221,16 @@ var Select = ({
|
|
|
303
221
|
var _a;
|
|
304
222
|
if (open) (_a = ulRef.current) == null ? void 0 : _a.focus();
|
|
305
223
|
}, [open]);
|
|
306
|
-
const selectedLabel = useMemo(
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
);
|
|
313
|
-
return /* @__PURE__ */ jsxs6("div", { className: "select", ref: rootRef, children: [
|
|
314
|
-
/* @__PURE__ */ jsx7(
|
|
224
|
+
const selectedLabel = useMemo(() => {
|
|
225
|
+
var _a;
|
|
226
|
+
return ((_a = options.find((opt) => opt.value === value)) == null ? void 0 : _a.label) ?? label;
|
|
227
|
+
}, [options, value, label]);
|
|
228
|
+
return /* @__PURE__ */ jsxs6("div", { className: ["select", `select--${variant}`, className].filter(Boolean).join(" "), ref: rootRef, children: [
|
|
229
|
+
/* @__PURE__ */ jsxs6(
|
|
315
230
|
"button",
|
|
316
231
|
{
|
|
317
232
|
...rest,
|
|
318
233
|
className: "select__button",
|
|
319
|
-
style: { backgroundImage: `url(${paperTexture5})` },
|
|
320
234
|
onClick: () => setOpen((v) => !v),
|
|
321
235
|
type: "button",
|
|
322
236
|
"aria-haspopup": "listbox",
|
|
@@ -324,38 +238,30 @@ var Select = ({
|
|
|
324
238
|
"aria-controls": "select-list",
|
|
325
239
|
"aria-label": label,
|
|
326
240
|
onKeyDown: handleKeyDown,
|
|
327
|
-
children:
|
|
241
|
+
children: [
|
|
242
|
+
/* @__PURE__ */ jsx7("span", { children: selectedLabel }),
|
|
243
|
+
/* @__PURE__ */ jsx7("span", { className: "select__caret", "aria-hidden": "true", children: open ? "-" : "+" })
|
|
244
|
+
]
|
|
328
245
|
}
|
|
329
246
|
),
|
|
330
|
-
open && /* @__PURE__ */ jsx7(
|
|
331
|
-
"
|
|
247
|
+
open && /* @__PURE__ */ jsx7("ul", { className: "select__list", role: "listbox", id: "select-list", onKeyDown: handleKeyDown, ref: ulRef, tabIndex: -1, children: options.map((opt, idx) => /* @__PURE__ */ jsx7(
|
|
248
|
+
"li",
|
|
332
249
|
{
|
|
333
|
-
className: "
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
setOpen(false);
|
|
349
|
-
setFocusedIdx(null);
|
|
350
|
-
},
|
|
351
|
-
onMouseEnter: () => setFocusedIdx(idx),
|
|
352
|
-
onMouseLeave: () => setFocusedIdx(null),
|
|
353
|
-
children: opt.label
|
|
354
|
-
},
|
|
355
|
-
opt.value
|
|
356
|
-
))
|
|
357
|
-
}
|
|
358
|
-
)
|
|
250
|
+
className: `select__item ${focusedIdx === idx ? "is-focused" : ""} ${value === opt.value ? "is-selected" : ""}`,
|
|
251
|
+
role: "option",
|
|
252
|
+
tabIndex: focusedIdx === idx ? 0 : -1,
|
|
253
|
+
"aria-selected": value === opt.value,
|
|
254
|
+
onClick: () => {
|
|
255
|
+
onChange == null ? void 0 : onChange(opt.value);
|
|
256
|
+
setOpen(false);
|
|
257
|
+
setFocusedIdx(null);
|
|
258
|
+
},
|
|
259
|
+
onMouseEnter: () => setFocusedIdx(idx),
|
|
260
|
+
onMouseLeave: () => setFocusedIdx(null),
|
|
261
|
+
children: opt.label
|
|
262
|
+
},
|
|
263
|
+
opt.value
|
|
264
|
+
)) })
|
|
359
265
|
] });
|
|
360
266
|
};
|
|
361
267
|
var Select_default = Select;
|
|
@@ -363,14 +269,15 @@ var Select_default = Select;
|
|
|
363
269
|
// src/components/Slider/Slider.tsx
|
|
364
270
|
import React5, { useState as useState4 } from "react";
|
|
365
271
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
366
|
-
var paperTexture6 = "/xp-components/assets/paper.png";
|
|
367
272
|
var Slider = ({
|
|
368
273
|
min = 0,
|
|
369
274
|
max = 100,
|
|
370
275
|
step = 1,
|
|
371
276
|
value,
|
|
372
277
|
onChange,
|
|
373
|
-
showValue = true
|
|
278
|
+
showValue = true,
|
|
279
|
+
variant = "default",
|
|
280
|
+
className
|
|
374
281
|
}) => {
|
|
375
282
|
const [internalValue, setInternalValue] = useState4(value ?? min);
|
|
376
283
|
const handleChange = (e) => {
|
|
@@ -383,11 +290,10 @@ var Slider = ({
|
|
|
383
290
|
setInternalValue(value);
|
|
384
291
|
}
|
|
385
292
|
}, [value]);
|
|
386
|
-
return /* @__PURE__ */ jsxs7("div", { className: "slider", children: [
|
|
293
|
+
return /* @__PURE__ */ jsxs7("div", { className: ["slider", `slider--${variant}`, className].filter(Boolean).join(" "), children: [
|
|
387
294
|
/* @__PURE__ */ jsx8(
|
|
388
295
|
"input",
|
|
389
296
|
{
|
|
390
|
-
style: { backgroundImage: `url(${paperTexture6})` },
|
|
391
297
|
type: "range",
|
|
392
298
|
min,
|
|
393
299
|
max,
|
|
@@ -397,14 +303,7 @@ var Slider = ({
|
|
|
397
303
|
className: "slider__input"
|
|
398
304
|
}
|
|
399
305
|
),
|
|
400
|
-
showValue && /* @__PURE__ */ jsx8(
|
|
401
|
-
"span",
|
|
402
|
-
{
|
|
403
|
-
style: { backgroundImage: ` url(${paperTexture6})` },
|
|
404
|
-
className: "slider__value",
|
|
405
|
-
children: internalValue
|
|
406
|
-
}
|
|
407
|
-
)
|
|
306
|
+
showValue && /* @__PURE__ */ jsx8("span", { className: "slider__value", children: internalValue })
|
|
408
307
|
] });
|
|
409
308
|
};
|
|
410
309
|
var Slider_default = Slider;
|
|
@@ -412,28 +311,13 @@ var Slider_default = Slider;
|
|
|
412
311
|
// src/components/Switch/Switch.tsx
|
|
413
312
|
import React6 from "react";
|
|
414
313
|
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
415
|
-
var
|
|
416
|
-
var Switch = ({ label, disabled, ...rest }) => {
|
|
314
|
+
var Switch = ({ label, disabled, variant = "default", className, ...rest }) => {
|
|
417
315
|
const reactId = React6.useId();
|
|
418
316
|
const id = rest.id ?? reactId;
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
id,
|
|
424
|
-
type: "checkbox",
|
|
425
|
-
className: "switch__input",
|
|
426
|
-
disabled,
|
|
427
|
-
...rest
|
|
428
|
-
}
|
|
429
|
-
),
|
|
430
|
-
/* @__PURE__ */ jsx9(
|
|
431
|
-
"span",
|
|
432
|
-
{
|
|
433
|
-
className: "switch__slider",
|
|
434
|
-
style: { backgroundImage: `url(${paperTexture7})` }
|
|
435
|
-
}
|
|
436
|
-
),
|
|
317
|
+
const classes = ["switch", `switch--${variant}`, disabled && "switch--disabled", className].filter(Boolean).join(" ");
|
|
318
|
+
return /* @__PURE__ */ jsxs8("label", { className: classes, htmlFor: id, children: [
|
|
319
|
+
/* @__PURE__ */ jsx9("input", { id, type: "checkbox", className: "switch__input", disabled, ...rest }),
|
|
320
|
+
/* @__PURE__ */ jsx9("span", { className: "switch__slider" }),
|
|
437
321
|
label && /* @__PURE__ */ jsx9("span", { className: "switch__label", children: label })
|
|
438
322
|
] });
|
|
439
323
|
};
|
|
@@ -441,7 +325,6 @@ var Switch_default = Switch;
|
|
|
441
325
|
|
|
442
326
|
// src/components/Tag/Tag.tsx
|
|
443
327
|
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
444
|
-
var paperTexture8 = "/xp-components/assets/paper.png";
|
|
445
328
|
var Tag = ({
|
|
446
329
|
children,
|
|
447
330
|
variant = "default",
|
|
@@ -452,28 +335,11 @@ var Tag = ({
|
|
|
452
335
|
className = "",
|
|
453
336
|
...rest
|
|
454
337
|
}) => {
|
|
455
|
-
return /* @__PURE__ */ jsxs9(
|
|
456
|
-
"span",
|
|
457
|
-
{
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
style: { backgroundImage: `url(${paperTexture8})` },
|
|
461
|
-
children: [
|
|
462
|
-
icon && /* @__PURE__ */ jsx10("span", { className: "tag__icon", children: icon }),
|
|
463
|
-
children,
|
|
464
|
-
closable && /* @__PURE__ */ jsx10(
|
|
465
|
-
"button",
|
|
466
|
-
{
|
|
467
|
-
type: "button",
|
|
468
|
-
onClick: onClose,
|
|
469
|
-
className: "tag__close",
|
|
470
|
-
"aria-label": "\uB2EB\uAE30",
|
|
471
|
-
children: "\xD7"
|
|
472
|
-
}
|
|
473
|
-
)
|
|
474
|
-
]
|
|
475
|
-
}
|
|
476
|
-
);
|
|
338
|
+
return /* @__PURE__ */ jsxs9("span", { ...rest, className: ["tag", `tag--${variant}`, `tag--${size}`, className].filter(Boolean).join(" "), children: [
|
|
339
|
+
icon && /* @__PURE__ */ jsx10("span", { className: "tag__icon", children: icon }),
|
|
340
|
+
/* @__PURE__ */ jsx10("span", { className: "tag__label", children }),
|
|
341
|
+
closable && /* @__PURE__ */ jsx10("button", { type: "button", onClick: onClose, className: "tag__close", "aria-label": "Close tag", children: "x" })
|
|
342
|
+
] });
|
|
477
343
|
};
|
|
478
344
|
var Tag_default = Tag;
|
|
479
345
|
export {
|
|
Binary file
|