@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.cjs
CHANGED
|
@@ -70,180 +70,123 @@ var App_default = App;
|
|
|
70
70
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
71
71
|
var Button = ({
|
|
72
72
|
children,
|
|
73
|
-
variant = "
|
|
73
|
+
variant = "primary",
|
|
74
|
+
size = "md",
|
|
75
|
+
className,
|
|
74
76
|
...rest
|
|
75
77
|
}) => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
className: `btn btn--${variant}`,
|
|
80
|
-
...rest,
|
|
81
|
-
style: { backgroundImage: `url(/assets/paper.png)` },
|
|
82
|
-
children
|
|
83
|
-
}
|
|
84
|
-
);
|
|
78
|
+
const resolvedVariant = variant === "default" ? "primary" : variant;
|
|
79
|
+
const classes = ["btn", `btn--${resolvedVariant}`, `btn--${size}`, className].filter(Boolean).join(" ");
|
|
80
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: classes, ...rest, children });
|
|
85
81
|
};
|
|
86
82
|
var Button_default = Button;
|
|
87
83
|
|
|
88
84
|
// src/components/Carousel/Carousel.tsx
|
|
89
85
|
var import_react2 = require("react");
|
|
90
86
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
91
|
-
var paperTexture = "/xp-components/assets/paper.png";
|
|
92
87
|
var Carousel = ({
|
|
93
88
|
items,
|
|
94
89
|
autoPlay = false,
|
|
95
90
|
interval = 3e3,
|
|
91
|
+
variant = "default",
|
|
92
|
+
showIndicators = true,
|
|
93
|
+
className,
|
|
96
94
|
...rest
|
|
97
95
|
}) => {
|
|
98
96
|
const [currentIndex, setCurrentIndex] = (0, import_react2.useState)(0);
|
|
99
97
|
const [touchStartX, setTouchStartX] = (0, import_react2.useState)(null);
|
|
100
98
|
const [touchEndX, setTouchEndX] = (0, import_react2.useState)(null);
|
|
101
|
-
const handleTouchStart = (e) =>
|
|
102
|
-
|
|
103
|
-
};
|
|
104
|
-
const handleTouchMove = (e) => {
|
|
105
|
-
setTouchEndX(e.touches[0].clientX);
|
|
106
|
-
};
|
|
99
|
+
const handleTouchStart = (e) => setTouchStartX(e.touches[0].clientX);
|
|
100
|
+
const handleTouchMove = (e) => setTouchEndX(e.touches[0].clientX);
|
|
107
101
|
const handleTouchEnd = () => {
|
|
108
102
|
if (touchStartX === null || touchEndX === null) return;
|
|
109
103
|
const delta = touchStartX - touchEndX;
|
|
110
|
-
if (delta > 50)
|
|
111
|
-
|
|
112
|
-
} else if (delta < -50) {
|
|
113
|
-
setCurrentIndex((prev) => (prev - 1 + items.length) % items.length);
|
|
114
|
-
}
|
|
104
|
+
if (delta > 50) setCurrentIndex((prev) => (prev + 1) % items.length);
|
|
105
|
+
if (delta < -50) setCurrentIndex((prev) => (prev - 1 + items.length) % items.length);
|
|
115
106
|
setTouchStartX(null);
|
|
116
107
|
setTouchEndX(null);
|
|
117
108
|
};
|
|
118
109
|
(0, import_react2.useEffect)(() => {
|
|
119
|
-
if (!autoPlay) return;
|
|
120
|
-
const timer = setInterval(() =>
|
|
121
|
-
setCurrentIndex((prev) => (prev + 1) % items.length);
|
|
122
|
-
}, interval);
|
|
110
|
+
if (!autoPlay || items.length < 2) return;
|
|
111
|
+
const timer = setInterval(() => setCurrentIndex((prev) => (prev + 1) % items.length), interval);
|
|
123
112
|
return () => clearInterval(timer);
|
|
124
113
|
}, [autoPlay, interval, items.length]);
|
|
125
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
126
|
-
"div",
|
|
127
|
-
|
|
128
|
-
className: "
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
145
|
-
"li",
|
|
146
|
-
{
|
|
147
|
-
className: "carousel__item",
|
|
148
|
-
onClick: item.onClick,
|
|
149
|
-
"aria-hidden": index !== currentIndex,
|
|
150
|
-
children: [
|
|
151
|
-
item.image && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
152
|
-
"img",
|
|
153
|
-
{
|
|
154
|
-
src: item.image,
|
|
155
|
-
alt: item.title ?? "",
|
|
156
|
-
className: "carousel__image",
|
|
157
|
-
style: {
|
|
158
|
-
backgroundImage: `url(${paperTexture})`,
|
|
159
|
-
...item.imageStyle
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
),
|
|
163
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "carousel__content", children: [
|
|
164
|
-
item.title && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: "carousel__title", children: item.title }),
|
|
165
|
-
item.text && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "carousel__text", children: item.text })
|
|
166
|
-
] })
|
|
167
|
-
]
|
|
168
|
-
},
|
|
169
|
-
index
|
|
170
|
-
))
|
|
171
|
-
}
|
|
172
|
-
)
|
|
173
|
-
}
|
|
174
|
-
),
|
|
175
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "carousel__indicators", children: items.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
176
|
-
"button",
|
|
177
|
-
{
|
|
178
|
-
style: { backgroundImage: `url(${paperTexture})` },
|
|
179
|
-
className: `carousel__indicator ${index === currentIndex ? "active" : ""}`,
|
|
180
|
-
onClick: () => setCurrentIndex(index),
|
|
181
|
-
"aria-label": `Go to slide ${index + 1}`
|
|
182
|
-
},
|
|
183
|
-
index
|
|
184
|
-
)) })
|
|
185
|
-
]
|
|
186
|
-
}
|
|
187
|
-
);
|
|
114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: ["carousel", `carousel--${variant}`, className].filter(Boolean).join(" "), children: [
|
|
115
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "carousel__container", ...rest, onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "carousel__list", style: { transform: `translateX(-${currentIndex * 100}%)` }, children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { className: "carousel__item", onClick: item.onClick, "aria-hidden": index !== currentIndex, children: [
|
|
116
|
+
item.image && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("img", { src: item.image, alt: item.title ?? "", className: "carousel__image", style: item.imageStyle }),
|
|
117
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "carousel__content", children: [
|
|
118
|
+
item.title && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: "carousel__title", children: item.title }),
|
|
119
|
+
item.text && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "carousel__text", children: item.text })
|
|
120
|
+
] })
|
|
121
|
+
] }, index)) }) }),
|
|
122
|
+
showIndicators && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "carousel__indicators", children: items.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
123
|
+
"button",
|
|
124
|
+
{
|
|
125
|
+
className: `carousel__indicator ${index === currentIndex ? "active" : ""}`,
|
|
126
|
+
onClick: () => setCurrentIndex(index),
|
|
127
|
+
"aria-label": `Go to slide ${index + 1}`,
|
|
128
|
+
type: "button"
|
|
129
|
+
},
|
|
130
|
+
index
|
|
131
|
+
)) })
|
|
132
|
+
] });
|
|
188
133
|
};
|
|
189
134
|
var Carousel_default = Carousel;
|
|
190
135
|
|
|
191
136
|
// src/components/Checkbox/Checkbox.tsx
|
|
192
137
|
var import_react3 = __toESM(require("react"), 1);
|
|
193
138
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
194
|
-
var
|
|
195
|
-
var Checkbox = ({ label, ...rest }) => {
|
|
139
|
+
var Checkbox = ({ label, variant = "default", className, ...rest }) => {
|
|
196
140
|
const reactId = import_react3.default.useId();
|
|
197
141
|
const id = rest.id ?? reactId;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
type: "checkbox",
|
|
204
|
-
className: "checkbox_input",
|
|
205
|
-
...rest,
|
|
206
|
-
style: { backgroundImage: `url(${paperTexture2})` }
|
|
207
|
-
}
|
|
208
|
-
),
|
|
209
|
-
label
|
|
142
|
+
const classes = ["checkbox", `checkbox--${variant}`, className].filter(Boolean).join(" ");
|
|
143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { htmlFor: id, className: classes, children: [
|
|
144
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { id, type: "checkbox", className: "checkbox__input", ...rest }),
|
|
145
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "checkbox__box", "aria-hidden": "true" }),
|
|
146
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "checkbox__label", children: label })
|
|
210
147
|
] });
|
|
211
148
|
};
|
|
212
149
|
var Checkbox_default = Checkbox;
|
|
213
150
|
|
|
214
151
|
// src/components/Chips/Chips.tsx
|
|
215
152
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
216
|
-
var paperTexture3 = "/xp-components/assets/paper.png";
|
|
217
153
|
var Chips = ({
|
|
218
154
|
children,
|
|
219
155
|
onRemove,
|
|
220
156
|
selected,
|
|
221
157
|
onClick,
|
|
158
|
+
variant = "default",
|
|
159
|
+
className,
|
|
222
160
|
...rest
|
|
223
161
|
}) => {
|
|
162
|
+
const classes = ["chip", `chip--${variant}`, selected && "is-selected", className].filter(Boolean).join(" ");
|
|
224
163
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
225
164
|
"div",
|
|
226
165
|
{
|
|
227
|
-
|
|
228
|
-
className: `chip${selected ? " selected" : ""}`,
|
|
166
|
+
className: classes,
|
|
229
167
|
role: onClick ? "button" : void 0,
|
|
230
168
|
tabIndex: onClick ? 0 : void 0,
|
|
231
169
|
onClick,
|
|
232
|
-
onKeyDown: (e) =>
|
|
170
|
+
onKeyDown: (e) => {
|
|
171
|
+
if (onClick && (e.key === "Enter" || e.key === " ")) {
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
onClick();
|
|
174
|
+
}
|
|
175
|
+
},
|
|
233
176
|
...rest,
|
|
234
177
|
children: [
|
|
235
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "chip__label", children }),
|
|
236
179
|
onRemove && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
237
180
|
"button",
|
|
238
181
|
{
|
|
239
182
|
type: "button",
|
|
240
|
-
className: "
|
|
183
|
+
className: "chip__remove",
|
|
241
184
|
"aria-label": "Remove chip",
|
|
242
185
|
onClick: (e) => {
|
|
243
186
|
e.stopPropagation();
|
|
244
187
|
onRemove();
|
|
245
188
|
},
|
|
246
|
-
children: "
|
|
189
|
+
children: "x"
|
|
247
190
|
}
|
|
248
191
|
)
|
|
249
192
|
]
|
|
@@ -255,37 +198,20 @@ var Chips_default = Chips;
|
|
|
255
198
|
// src/components/Input/Input.tsx
|
|
256
199
|
var import_react4 = require("react");
|
|
257
200
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
258
|
-
var paperTexture4 = "/xp-components/assets/paper.png";
|
|
259
201
|
var Input = ({
|
|
260
202
|
label,
|
|
261
203
|
variant = "default",
|
|
262
204
|
id: propId,
|
|
263
205
|
type = "text",
|
|
264
|
-
className
|
|
206
|
+
className,
|
|
265
207
|
...rest
|
|
266
208
|
}) => {
|
|
267
209
|
const reactId = (0, import_react4.useId)();
|
|
268
210
|
const id = propId || reactId;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
id,
|
|
274
|
-
type,
|
|
275
|
-
className: `input input--${variant} ${className}`,
|
|
276
|
-
style: { backgroundImage: `url(${paperTexture4})` },
|
|
277
|
-
...rest
|
|
278
|
-
}
|
|
279
|
-
),
|
|
280
|
-
variant === "title" && label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
281
|
-
"label",
|
|
282
|
-
{
|
|
283
|
-
htmlFor: id,
|
|
284
|
-
className: "input__placeholder",
|
|
285
|
-
style: { backgroundImage: `url(${paperTexture4})` },
|
|
286
|
-
children: label
|
|
287
|
-
}
|
|
288
|
-
)
|
|
211
|
+
const classes = ["input", `input--${variant}`, className].filter(Boolean).join(" ");
|
|
212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "input__wrapper", children: [
|
|
213
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { id, type, className: classes, ...rest }),
|
|
214
|
+
(variant === "title" || variant === "search") && label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: id, className: "input__label", children: label })
|
|
289
215
|
] });
|
|
290
216
|
};
|
|
291
217
|
var Input_default = Input;
|
|
@@ -293,14 +219,7 @@ var Input_default = Input;
|
|
|
293
219
|
// src/components/Select/Select.tsx
|
|
294
220
|
var import_react5 = require("react");
|
|
295
221
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
296
|
-
var
|
|
297
|
-
var Select = ({
|
|
298
|
-
label,
|
|
299
|
-
options,
|
|
300
|
-
value,
|
|
301
|
-
onChange,
|
|
302
|
-
...rest
|
|
303
|
-
}) => {
|
|
222
|
+
var Select = ({ label, options, value, onChange, variant = "default", className, ...rest }) => {
|
|
304
223
|
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
305
224
|
const [focusedIdx, setFocusedIdx] = (0, import_react5.useState)(null);
|
|
306
225
|
const rootRef = (0, import_react5.useRef)(null);
|
|
@@ -313,22 +232,21 @@ var Select = ({
|
|
|
313
232
|
}
|
|
314
233
|
};
|
|
315
234
|
window.addEventListener("mousedown", handleClickOutside);
|
|
316
|
-
return () =>
|
|
317
|
-
|
|
318
|
-
};
|
|
319
|
-
}, [open]);
|
|
235
|
+
return () => window.removeEventListener("mousedown", handleClickOutside);
|
|
236
|
+
}, []);
|
|
320
237
|
const handleKeyDown = (e) => {
|
|
238
|
+
if (!open && (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ")) {
|
|
239
|
+
e.preventDefault();
|
|
240
|
+
setOpen(true);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
321
243
|
if (!open) return;
|
|
322
244
|
if (e.key === "ArrowDown") {
|
|
323
245
|
e.preventDefault();
|
|
324
|
-
setFocusedIdx(
|
|
325
|
-
(prev) => prev === null || prev === options.length - 1 ? 0 : prev + 1
|
|
326
|
-
);
|
|
246
|
+
setFocusedIdx((prev) => prev === null || prev === options.length - 1 ? 0 : prev + 1);
|
|
327
247
|
} else if (e.key === "ArrowUp") {
|
|
328
248
|
e.preventDefault();
|
|
329
|
-
setFocusedIdx(
|
|
330
|
-
(prev) => prev === null || prev === 0 ? options.length - 1 : prev - 1
|
|
331
|
-
);
|
|
249
|
+
setFocusedIdx((prev) => prev === null || prev === 0 ? options.length - 1 : prev - 1);
|
|
332
250
|
} else if (e.key === "Enter" && focusedIdx !== null) {
|
|
333
251
|
e.preventDefault();
|
|
334
252
|
const selectedOption = options[focusedIdx];
|
|
@@ -348,20 +266,16 @@ var Select = ({
|
|
|
348
266
|
var _a;
|
|
349
267
|
if (open) (_a = ulRef.current) == null ? void 0 : _a.focus();
|
|
350
268
|
}, [open]);
|
|
351
|
-
const selectedLabel = (0, import_react5.useMemo)(
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
);
|
|
358
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "select", ref: rootRef, children: [
|
|
359
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
269
|
+
const selectedLabel = (0, import_react5.useMemo)(() => {
|
|
270
|
+
var _a;
|
|
271
|
+
return ((_a = options.find((opt) => opt.value === value)) == null ? void 0 : _a.label) ?? label;
|
|
272
|
+
}, [options, value, label]);
|
|
273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: ["select", `select--${variant}`, className].filter(Boolean).join(" "), ref: rootRef, children: [
|
|
274
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
360
275
|
"button",
|
|
361
276
|
{
|
|
362
277
|
...rest,
|
|
363
278
|
className: "select__button",
|
|
364
|
-
style: { backgroundImage: `url(${paperTexture5})` },
|
|
365
279
|
onClick: () => setOpen((v) => !v),
|
|
366
280
|
type: "button",
|
|
367
281
|
"aria-haspopup": "listbox",
|
|
@@ -369,38 +283,30 @@ var Select = ({
|
|
|
369
283
|
"aria-controls": "select-list",
|
|
370
284
|
"aria-label": label,
|
|
371
285
|
onKeyDown: handleKeyDown,
|
|
372
|
-
children:
|
|
286
|
+
children: [
|
|
287
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: selectedLabel }),
|
|
288
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "select__caret", "aria-hidden": "true", children: open ? "-" : "+" })
|
|
289
|
+
]
|
|
373
290
|
}
|
|
374
291
|
),
|
|
375
|
-
open && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
376
|
-
"
|
|
292
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: "select__list", role: "listbox", id: "select-list", onKeyDown: handleKeyDown, ref: ulRef, tabIndex: -1, children: options.map((opt, idx) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
293
|
+
"li",
|
|
377
294
|
{
|
|
378
|
-
className: "
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
setOpen(false);
|
|
394
|
-
setFocusedIdx(null);
|
|
395
|
-
},
|
|
396
|
-
onMouseEnter: () => setFocusedIdx(idx),
|
|
397
|
-
onMouseLeave: () => setFocusedIdx(null),
|
|
398
|
-
children: opt.label
|
|
399
|
-
},
|
|
400
|
-
opt.value
|
|
401
|
-
))
|
|
402
|
-
}
|
|
403
|
-
)
|
|
295
|
+
className: `select__item ${focusedIdx === idx ? "is-focused" : ""} ${value === opt.value ? "is-selected" : ""}`,
|
|
296
|
+
role: "option",
|
|
297
|
+
tabIndex: focusedIdx === idx ? 0 : -1,
|
|
298
|
+
"aria-selected": value === opt.value,
|
|
299
|
+
onClick: () => {
|
|
300
|
+
onChange == null ? void 0 : onChange(opt.value);
|
|
301
|
+
setOpen(false);
|
|
302
|
+
setFocusedIdx(null);
|
|
303
|
+
},
|
|
304
|
+
onMouseEnter: () => setFocusedIdx(idx),
|
|
305
|
+
onMouseLeave: () => setFocusedIdx(null),
|
|
306
|
+
children: opt.label
|
|
307
|
+
},
|
|
308
|
+
opt.value
|
|
309
|
+
)) })
|
|
404
310
|
] });
|
|
405
311
|
};
|
|
406
312
|
var Select_default = Select;
|
|
@@ -408,14 +314,15 @@ var Select_default = Select;
|
|
|
408
314
|
// src/components/Slider/Slider.tsx
|
|
409
315
|
var import_react6 = __toESM(require("react"), 1);
|
|
410
316
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
411
|
-
var paperTexture6 = "/xp-components/assets/paper.png";
|
|
412
317
|
var Slider = ({
|
|
413
318
|
min = 0,
|
|
414
319
|
max = 100,
|
|
415
320
|
step = 1,
|
|
416
321
|
value,
|
|
417
322
|
onChange,
|
|
418
|
-
showValue = true
|
|
323
|
+
showValue = true,
|
|
324
|
+
variant = "default",
|
|
325
|
+
className
|
|
419
326
|
}) => {
|
|
420
327
|
const [internalValue, setInternalValue] = (0, import_react6.useState)(value ?? min);
|
|
421
328
|
const handleChange = (e) => {
|
|
@@ -428,11 +335,10 @@ var Slider = ({
|
|
|
428
335
|
setInternalValue(value);
|
|
429
336
|
}
|
|
430
337
|
}, [value]);
|
|
431
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "slider", children: [
|
|
338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: ["slider", `slider--${variant}`, className].filter(Boolean).join(" "), children: [
|
|
432
339
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
433
340
|
"input",
|
|
434
341
|
{
|
|
435
|
-
style: { backgroundImage: `url(${paperTexture6})` },
|
|
436
342
|
type: "range",
|
|
437
343
|
min,
|
|
438
344
|
max,
|
|
@@ -442,14 +348,7 @@ var Slider = ({
|
|
|
442
348
|
className: "slider__input"
|
|
443
349
|
}
|
|
444
350
|
),
|
|
445
|
-
showValue && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
446
|
-
"span",
|
|
447
|
-
{
|
|
448
|
-
style: { backgroundImage: ` url(${paperTexture6})` },
|
|
449
|
-
className: "slider__value",
|
|
450
|
-
children: internalValue
|
|
451
|
-
}
|
|
452
|
-
)
|
|
351
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "slider__value", children: internalValue })
|
|
453
352
|
] });
|
|
454
353
|
};
|
|
455
354
|
var Slider_default = Slider;
|
|
@@ -457,28 +356,13 @@ var Slider_default = Slider;
|
|
|
457
356
|
// src/components/Switch/Switch.tsx
|
|
458
357
|
var import_react7 = __toESM(require("react"), 1);
|
|
459
358
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
460
|
-
var
|
|
461
|
-
var Switch = ({ label, disabled, ...rest }) => {
|
|
359
|
+
var Switch = ({ label, disabled, variant = "default", className, ...rest }) => {
|
|
462
360
|
const reactId = import_react7.default.useId();
|
|
463
361
|
const id = rest.id ?? reactId;
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
id,
|
|
469
|
-
type: "checkbox",
|
|
470
|
-
className: "switch__input",
|
|
471
|
-
disabled,
|
|
472
|
-
...rest
|
|
473
|
-
}
|
|
474
|
-
),
|
|
475
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
476
|
-
"span",
|
|
477
|
-
{
|
|
478
|
-
className: "switch__slider",
|
|
479
|
-
style: { backgroundImage: `url(${paperTexture7})` }
|
|
480
|
-
}
|
|
481
|
-
),
|
|
362
|
+
const classes = ["switch", `switch--${variant}`, disabled && "switch--disabled", className].filter(Boolean).join(" ");
|
|
363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: classes, htmlFor: id, children: [
|
|
364
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { id, type: "checkbox", className: "switch__input", disabled, ...rest }),
|
|
365
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "switch__slider" }),
|
|
482
366
|
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "switch__label", children: label })
|
|
483
367
|
] });
|
|
484
368
|
};
|
|
@@ -486,7 +370,6 @@ var Switch_default = Switch;
|
|
|
486
370
|
|
|
487
371
|
// src/components/Tag/Tag.tsx
|
|
488
372
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
489
|
-
var paperTexture8 = "/xp-components/assets/paper.png";
|
|
490
373
|
var Tag = ({
|
|
491
374
|
children,
|
|
492
375
|
variant = "default",
|
|
@@ -497,28 +380,11 @@ var Tag = ({
|
|
|
497
380
|
className = "",
|
|
498
381
|
...rest
|
|
499
382
|
}) => {
|
|
500
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
501
|
-
"span",
|
|
502
|
-
{
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
style: { backgroundImage: `url(${paperTexture8})` },
|
|
506
|
-
children: [
|
|
507
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "tag__icon", children: icon }),
|
|
508
|
-
children,
|
|
509
|
-
closable && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
510
|
-
"button",
|
|
511
|
-
{
|
|
512
|
-
type: "button",
|
|
513
|
-
onClick: onClose,
|
|
514
|
-
className: "tag__close",
|
|
515
|
-
"aria-label": "\uB2EB\uAE30",
|
|
516
|
-
children: "\xD7"
|
|
517
|
-
}
|
|
518
|
-
)
|
|
519
|
-
]
|
|
520
|
-
}
|
|
521
|
-
);
|
|
383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { ...rest, className: ["tag", `tag--${variant}`, `tag--${size}`, className].filter(Boolean).join(" "), children: [
|
|
384
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "tag__icon", children: icon }),
|
|
385
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "tag__label", children }),
|
|
386
|
+
closable && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", onClick: onClose, className: "tag__close", "aria-label": "Close tag", children: "x" })
|
|
387
|
+
] });
|
|
522
388
|
};
|
|
523
389
|
var Tag_default = Tag;
|
|
524
390
|
// Annotate the CommonJS export names for ESM import in node:
|