@willphan1712000/frontend 1.0.0 → 1.0.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 +4 -25
- package/dist/index.js +322 -78
- package/dist/index.mjs +322 -78
- package/package.json +1 -1
- package/dist/index.css +0 -233
package/README.md
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
<img style="width: 15%" src="./will.png">
|
|
2
2
|
|
|
3
|
-
## Will-js is a
|
|
3
|
+
## Will-js is a Frontend package developed by Will Phan that makes Fronted development easy with pre-built UI components
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
## Key Benefits
|
|
8
|
-
|
|
9
|
-
- Simple syntax that includes object-oriented programming techniques
|
|
10
|
-
- Pre-built functionalities that handle difficult tasks in Full-stack Development
|
|
11
|
-
- Provides flexibility, maintainability, and extensibility
|
|
5
|
+
## UI Components
|
|
12
6
|
|
|
13
7
|
## Technology
|
|
14
8
|
|
|
@@ -16,27 +10,12 @@
|
|
|
16
10
|
|
|
17
11
|
## Installation
|
|
18
12
|
|
|
19
|
-
###
|
|
20
|
-
|
|
21
|
-
There is a file called W.ts that exports $$ function, this is the root function to use every other functions and classes.
|
|
22
|
-
Simply import $$ to every ts files that you want to use Will-js
|
|
23
|
-
|
|
24
|
-
```ts
|
|
25
|
-
import { $$ } from "path/of/your/project/Web-Development/W";
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Options 2: Install from npm
|
|
13
|
+
### Install from npm
|
|
29
14
|
|
|
30
15
|
Run this command in your terminal (note: this assumes you have installed Nodejs)
|
|
31
16
|
|
|
32
17
|
```npm
|
|
33
|
-
npm i @willphan1712000/
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Then import $$ function to every ts files that you want to use Will-js as an entry point where you can access every features of the library
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
import { $$ } from "@willphan1712000/w";
|
|
18
|
+
npm i @willphan1712000/frontend
|
|
40
19
|
```
|
|
41
20
|
|
|
42
21
|
## How to use Will-js
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,19 @@ function _array_like_to_array(arr, len) {
|
|
|
7
7
|
function _array_with_holes(arr) {
|
|
8
8
|
if (Array.isArray(arr)) return arr;
|
|
9
9
|
}
|
|
10
|
+
function _define_property(obj, key, value) {
|
|
11
|
+
if (key in obj) {
|
|
12
|
+
Object.defineProperty(obj, key, {
|
|
13
|
+
value: value,
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true
|
|
17
|
+
});
|
|
18
|
+
} else {
|
|
19
|
+
obj[key] = value;
|
|
20
|
+
}
|
|
21
|
+
return obj;
|
|
22
|
+
}
|
|
10
23
|
function _iterable_to_array_limit(arr, i) {
|
|
11
24
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
12
25
|
if (_i == null) return;
|
|
@@ -34,6 +47,45 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
34
47
|
function _non_iterable_rest() {
|
|
35
48
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
36
49
|
}
|
|
50
|
+
function _object_spread(target) {
|
|
51
|
+
for(var i = 1; i < arguments.length; i++){
|
|
52
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
53
|
+
var ownKeys = Object.keys(source);
|
|
54
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
55
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
56
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
ownKeys.forEach(function(key) {
|
|
60
|
+
_define_property(target, key, source[key]);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return target;
|
|
64
|
+
}
|
|
65
|
+
function ownKeys(object, enumerableOnly) {
|
|
66
|
+
var keys = Object.keys(object);
|
|
67
|
+
if (Object.getOwnPropertySymbols) {
|
|
68
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
69
|
+
if (enumerableOnly) {
|
|
70
|
+
symbols = symbols.filter(function(sym) {
|
|
71
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
keys.push.apply(keys, symbols);
|
|
75
|
+
}
|
|
76
|
+
return keys;
|
|
77
|
+
}
|
|
78
|
+
function _object_spread_props(target, source) {
|
|
79
|
+
source = source != null ? source : {};
|
|
80
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
81
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
82
|
+
} else {
|
|
83
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
84
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return target;
|
|
88
|
+
}
|
|
37
89
|
function _sliced_to_array(arr, i) {
|
|
38
90
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
39
91
|
}
|
|
@@ -124,25 +176,80 @@ function useMyContext() {
|
|
|
124
176
|
}
|
|
125
177
|
// src/components/DropdownSelect/Dropdown.tsx
|
|
126
178
|
var import_react2 = require("react");
|
|
127
|
-
//
|
|
128
|
-
var
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
179
|
+
// src/components/DropdownSelect/styles.ts
|
|
180
|
+
var styles = {
|
|
181
|
+
select_box: {
|
|
182
|
+
borderRadius: "10px",
|
|
183
|
+
border: "solid 1px #dadada",
|
|
184
|
+
padding: "5px 10px",
|
|
185
|
+
display: "flex",
|
|
186
|
+
justifyContent: "space-between",
|
|
187
|
+
alignItems: "center",
|
|
188
|
+
cursor: "pointer"
|
|
189
|
+
},
|
|
190
|
+
value: {
|
|
191
|
+
marginRight: "auto"
|
|
192
|
+
},
|
|
193
|
+
close: {
|
|
194
|
+
borderRadius: "50%",
|
|
195
|
+
width: "20px",
|
|
196
|
+
height: "20px",
|
|
197
|
+
display: "flex",
|
|
198
|
+
justifyContent: "center",
|
|
199
|
+
alignItems: "center"
|
|
200
|
+
},
|
|
201
|
+
element: {
|
|
202
|
+
display: "flex",
|
|
203
|
+
padding: "5px",
|
|
204
|
+
borderRadius: "10px",
|
|
205
|
+
justifyContent: "flex-start",
|
|
206
|
+
alignItems: "center",
|
|
207
|
+
cursor: "pointer"
|
|
208
|
+
},
|
|
209
|
+
dropdown: {
|
|
210
|
+
position: "absolute",
|
|
211
|
+
boxSizing: "border-box",
|
|
212
|
+
width: "100%",
|
|
213
|
+
left: "0",
|
|
214
|
+
display: "flex",
|
|
215
|
+
flexDirection: "column",
|
|
216
|
+
border: "solid 1px #dadada",
|
|
217
|
+
borderRadius: "10px",
|
|
218
|
+
padding: "5px",
|
|
219
|
+
maxHeight: "300px",
|
|
220
|
+
overflowY: "auto",
|
|
221
|
+
backgroundColor: "white"
|
|
222
|
+
},
|
|
223
|
+
search_border: {
|
|
224
|
+
position: "sticky",
|
|
225
|
+
top: 0,
|
|
226
|
+
left: 0,
|
|
227
|
+
boxSizing: "border-box",
|
|
228
|
+
width: "100%",
|
|
229
|
+
backgroundColor: "white",
|
|
230
|
+
marginBottom: "5px"
|
|
231
|
+
},
|
|
232
|
+
search: {
|
|
233
|
+
width: "100%",
|
|
234
|
+
borderRadius: "5px",
|
|
235
|
+
padding: "5px",
|
|
236
|
+
border: "solid 1px #dadada",
|
|
237
|
+
display: "flex",
|
|
238
|
+
justifyContent: "flex-start",
|
|
239
|
+
alignItems: "center",
|
|
240
|
+
boxSizing: "border-box"
|
|
241
|
+
}
|
|
136
242
|
};
|
|
243
|
+
var styles_default = styles;
|
|
137
244
|
// src/components/DropdownSelect/Search.tsx
|
|
138
245
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
139
246
|
var Search = function(param) {
|
|
140
247
|
var options = param.options, onSearch = param.onSearch;
|
|
141
248
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
142
|
-
|
|
249
|
+
style: styles_default.search_border,
|
|
143
250
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
144
251
|
placeholder: "Search",
|
|
145
|
-
|
|
252
|
+
style: styles_default.search,
|
|
146
253
|
id: "search",
|
|
147
254
|
name: "search",
|
|
148
255
|
onChange: function(e) {
|
|
@@ -159,7 +266,8 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
|
159
266
|
var Dropdown = function() {
|
|
160
267
|
var _useMyContext = useMyContext(), options = _useMyContext.options, onChange = _useMyContext.onChange, setOpen = _useMyContext.setOpen;
|
|
161
268
|
var _ref = _sliced_to_array((0, import_react2.useState)(true), 2), isVisible = _ref[0], setVisible = _ref[1];
|
|
162
|
-
var _ref1 = _sliced_to_array((0, import_react2.useState)(
|
|
269
|
+
var _ref1 = _sliced_to_array((0, import_react2.useState)(-1), 2), keyOnHover = _ref1[0], setKeyOnHover = _ref1[1];
|
|
270
|
+
var _ref2 = _sliced_to_array((0, import_react2.useState)(options), 2), optionsCopy = _ref2[0], setOption = _ref2[1];
|
|
163
271
|
var dropdownRef = (0, import_react2.useRef)(null);
|
|
164
272
|
var handleResize = function() {
|
|
165
273
|
var dropdown = dropdownRef.current;
|
|
@@ -181,13 +289,12 @@ var Dropdown = function() {
|
|
|
181
289
|
};
|
|
182
290
|
}, []);
|
|
183
291
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", {
|
|
184
|
-
className: dropdownSelect_module_default.dropdown,
|
|
185
292
|
ref: dropdownRef,
|
|
186
|
-
style: isVisible ? {
|
|
293
|
+
style: isVisible ? _object_spread_props(_object_spread({}, styles_default.dropdown), {
|
|
187
294
|
top: "calc(100% + 5px)"
|
|
188
|
-
} : {
|
|
295
|
+
}) : _object_spread_props(_object_spread({}, styles_default.dropdown), {
|
|
189
296
|
bottom: "calc(100% + 5px)"
|
|
190
|
-
},
|
|
297
|
+
}),
|
|
191
298
|
children: [
|
|
192
299
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Search_default, {
|
|
193
300
|
options: options,
|
|
@@ -195,13 +302,21 @@ var Dropdown = function() {
|
|
|
195
302
|
}),
|
|
196
303
|
optionsCopy.map(function(option, key) {
|
|
197
304
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", {
|
|
198
|
-
|
|
305
|
+
style: _object_spread_props(_object_spread({}, styles_default.element), {
|
|
306
|
+
backgroundColor: keyOnHover === key ? "#f0f0f0" : "#fff"
|
|
307
|
+
}),
|
|
199
308
|
onClick: function() {
|
|
200
309
|
onChange(option.value);
|
|
201
310
|
setOpen(function(prev) {
|
|
202
311
|
return !prev;
|
|
203
312
|
});
|
|
204
313
|
},
|
|
314
|
+
onMouseEnter: function() {
|
|
315
|
+
return setKeyOnHover(key);
|
|
316
|
+
},
|
|
317
|
+
onMouseLeave: function() {
|
|
318
|
+
return setKeyOnHover(-1);
|
|
319
|
+
},
|
|
205
320
|
children: option.label
|
|
206
321
|
}, key);
|
|
207
322
|
})
|
|
@@ -215,6 +330,7 @@ var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
|
215
330
|
var DropdownSelect = function(param) {
|
|
216
331
|
var options = param.options, value = param.value, onChange = param.onChange, _param_width = param.width, width = _param_width === void 0 ? "200" : _param_width;
|
|
217
332
|
var _ref = _sliced_to_array((0, import_react3.useState)(false), 2), open = _ref[0], setOpen = _ref[1];
|
|
333
|
+
var _ref1 = _sliced_to_array((0, import_react3.useState)(false), 2), isHoverClose = _ref1[0], setHoverClose = _ref1[1];
|
|
218
334
|
var selectRef = (0, import_react3.useRef)(null);
|
|
219
335
|
var clickHandler = function(e) {
|
|
220
336
|
var select = selectRef.current;
|
|
@@ -243,7 +359,7 @@ var DropdownSelect = function(param) {
|
|
|
243
359
|
ref: selectRef,
|
|
244
360
|
children: [
|
|
245
361
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", {
|
|
246
|
-
|
|
362
|
+
style: styles_default.select_box,
|
|
247
363
|
onClick: function() {
|
|
248
364
|
return setOpen(function(prev) {
|
|
249
365
|
return !prev;
|
|
@@ -251,11 +367,13 @@ var DropdownSelect = function(param) {
|
|
|
251
367
|
},
|
|
252
368
|
children: [
|
|
253
369
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", {
|
|
254
|
-
|
|
370
|
+
style: styles_default.value,
|
|
255
371
|
children: value
|
|
256
372
|
}),
|
|
257
373
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", {
|
|
258
|
-
|
|
374
|
+
style: _object_spread_props(_object_spread({}, styles_default.close), {
|
|
375
|
+
backgroundColor: isHoverClose ? "#f0f0f0" : "#fff"
|
|
376
|
+
}),
|
|
259
377
|
title: "clear",
|
|
260
378
|
onClick: function() {
|
|
261
379
|
onChange("");
|
|
@@ -263,6 +381,12 @@ var DropdownSelect = function(param) {
|
|
|
263
381
|
return !prev;
|
|
264
382
|
});
|
|
265
383
|
},
|
|
384
|
+
onMouseEnter: function() {
|
|
385
|
+
return setHoverClose(true);
|
|
386
|
+
},
|
|
387
|
+
onMouseLeave: function() {
|
|
388
|
+
return setHoverClose(false);
|
|
389
|
+
},
|
|
266
390
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_io.IoMdClose, {})
|
|
267
391
|
})
|
|
268
392
|
]
|
|
@@ -275,15 +399,6 @@ var DropdownSelect = function(param) {
|
|
|
275
399
|
var DropdownSelect_default = DropdownSelect;
|
|
276
400
|
// src/components/RangeSlider/RangeSlider.tsx
|
|
277
401
|
var import_react4 = require("react");
|
|
278
|
-
// scss-module:./rangeSlider.module.css#scss-module
|
|
279
|
-
var rangeSlider_module_default = {
|
|
280
|
-
"slider_border": "rangeSlider-module__slider_border___CoeFx",
|
|
281
|
-
"thumb": "rangeSlider-module__thumb___OnFSM",
|
|
282
|
-
"thumb_shadow": "rangeSlider-module__thumb_shadow___L16TY",
|
|
283
|
-
"fill": "rangeSlider-module__fill___urGCN",
|
|
284
|
-
"rest": "rangeSlider-module__rest___pO2pi",
|
|
285
|
-
"value": "rangeSlider-module__value___Evg0D"
|
|
286
|
-
};
|
|
287
402
|
// src/components/RangeSlider/functions.ts
|
|
288
403
|
function encode(value, min, max) {
|
|
289
404
|
return (parseInt(value) - parseInt(min)) * 100 / (parseInt(max) - parseInt(min));
|
|
@@ -291,6 +406,70 @@ function encode(value, min, max) {
|
|
|
291
406
|
function decode(percent, min, max) {
|
|
292
407
|
return Math.round(parseInt(min) + percent * (parseInt(max) - parseInt(min)));
|
|
293
408
|
}
|
|
409
|
+
// src/components/RangeSlider/styles.ts
|
|
410
|
+
var styles2 = {
|
|
411
|
+
slider_border: {
|
|
412
|
+
position: "relative",
|
|
413
|
+
display: "flex",
|
|
414
|
+
gap: "5px",
|
|
415
|
+
flexDirection: "column",
|
|
416
|
+
height: "10px"
|
|
417
|
+
},
|
|
418
|
+
thumb: {
|
|
419
|
+
width: "17px",
|
|
420
|
+
height: "17px",
|
|
421
|
+
cursor: "pointer",
|
|
422
|
+
position: "absolute",
|
|
423
|
+
borderRadius: "50%",
|
|
424
|
+
top: "50%",
|
|
425
|
+
transform: "translate(-50%, -50%)",
|
|
426
|
+
zIndex: 1
|
|
427
|
+
},
|
|
428
|
+
thumb_shadow: {
|
|
429
|
+
content: '""',
|
|
430
|
+
position: "absolute",
|
|
431
|
+
top: "-9px",
|
|
432
|
+
left: "-9px",
|
|
433
|
+
width: "35px",
|
|
434
|
+
height: "35px",
|
|
435
|
+
opacity: 0.2,
|
|
436
|
+
zIndex: -1,
|
|
437
|
+
borderRadius: "50%",
|
|
438
|
+
scale: "0",
|
|
439
|
+
transition: "scale .1s linear"
|
|
440
|
+
},
|
|
441
|
+
fill: {
|
|
442
|
+
position: "absolute",
|
|
443
|
+
left: 0,
|
|
444
|
+
top: 0,
|
|
445
|
+
height: "100%",
|
|
446
|
+
borderRadius: "5px",
|
|
447
|
+
cursor: "pointer"
|
|
448
|
+
},
|
|
449
|
+
rest: {
|
|
450
|
+
position: "absolute",
|
|
451
|
+
top: "50%",
|
|
452
|
+
transform: "translateY(-50%)",
|
|
453
|
+
opacity: 0.3,
|
|
454
|
+
width: "100%",
|
|
455
|
+
height: "70%",
|
|
456
|
+
borderRadius: "5px",
|
|
457
|
+
cursor: "pointer"
|
|
458
|
+
},
|
|
459
|
+
value: {
|
|
460
|
+
position: "absolute",
|
|
461
|
+
bottom: "30px",
|
|
462
|
+
left: "50%",
|
|
463
|
+
transform: "translateX(-50%)",
|
|
464
|
+
transformOrigin: "bottom left",
|
|
465
|
+
backgroundColor: "#f0f0f7",
|
|
466
|
+
borderRadius: "5px",
|
|
467
|
+
padding: "5px",
|
|
468
|
+
scale: "0",
|
|
469
|
+
transition: "scale .1s linear"
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
var styles_default2 = styles2;
|
|
294
473
|
// src/components/RangeSlider/RangeSlider.tsx
|
|
295
474
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
296
475
|
var RangeSlider = function(param) {
|
|
@@ -347,10 +526,9 @@ var RangeSlider = function(param) {
|
|
|
347
526
|
isMouseDown
|
|
348
527
|
]);
|
|
349
528
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", {
|
|
350
|
-
|
|
351
|
-
style: {
|
|
529
|
+
style: _object_spread_props(_object_spread({}, styles_default2.slider_border), {
|
|
352
530
|
width: "".concat(width, "px")
|
|
353
|
-
},
|
|
531
|
+
}),
|
|
354
532
|
onMouseDown: function(e) {
|
|
355
533
|
handleDrag(true, e);
|
|
356
534
|
setMouseDown(true);
|
|
@@ -362,18 +540,16 @@ var RangeSlider = function(param) {
|
|
|
362
540
|
ref: sliderBorderRef,
|
|
363
541
|
children: [
|
|
364
542
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", {
|
|
365
|
-
|
|
366
|
-
style: {
|
|
543
|
+
style: _object_spread_props(_object_spread({}, styles_default2.fill), {
|
|
367
544
|
background: color,
|
|
368
545
|
width: "".concat(percentage, "%")
|
|
369
|
-
}
|
|
546
|
+
})
|
|
370
547
|
}),
|
|
371
548
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", {
|
|
372
|
-
|
|
373
|
-
style: {
|
|
549
|
+
style: _object_spread_props(_object_spread({}, styles_default2.thumb), {
|
|
374
550
|
background: color,
|
|
375
551
|
left: "".concat(percentage, "%")
|
|
376
|
-
},
|
|
552
|
+
}),
|
|
377
553
|
onMouseMove: function() {
|
|
378
554
|
return setHover(true);
|
|
379
555
|
},
|
|
@@ -382,63 +558,107 @@ var RangeSlider = function(param) {
|
|
|
382
558
|
},
|
|
383
559
|
children: [
|
|
384
560
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", {
|
|
385
|
-
|
|
386
|
-
style: {
|
|
561
|
+
style: _object_spread_props(_object_spread({}, styles_default2.value), {
|
|
387
562
|
scale: isMouseDown || isHover ? "1" : "0"
|
|
388
|
-
},
|
|
563
|
+
}),
|
|
389
564
|
children: value
|
|
390
565
|
}),
|
|
391
566
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", {
|
|
392
|
-
|
|
393
|
-
style: {
|
|
567
|
+
style: _object_spread_props(_object_spread({}, styles_default2.thumb_shadow), {
|
|
394
568
|
background: color,
|
|
395
569
|
scale: isMouseDown || isHover ? "1" : "0"
|
|
396
|
-
}
|
|
570
|
+
})
|
|
397
571
|
})
|
|
398
572
|
]
|
|
399
573
|
}),
|
|
400
574
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", {
|
|
401
|
-
|
|
402
|
-
style: {
|
|
575
|
+
style: _object_spread_props(_object_spread({}, styles_default2.rest), {
|
|
403
576
|
background: color
|
|
404
|
-
}
|
|
577
|
+
})
|
|
405
578
|
})
|
|
406
579
|
]
|
|
407
580
|
});
|
|
408
581
|
};
|
|
409
582
|
var RangeSlider_default = RangeSlider;
|
|
410
|
-
//
|
|
411
|
-
var
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
583
|
+
// src/components/OptionSlider/styles.ts
|
|
584
|
+
var styles3 = {
|
|
585
|
+
border: {
|
|
586
|
+
borderRadius: "10px",
|
|
587
|
+
overflow: "auto",
|
|
588
|
+
boxShadow: "rgba(0, 0, 0, 0.16) 0px 1px 4px",
|
|
589
|
+
aspectRatio: "4",
|
|
590
|
+
display: "flex",
|
|
591
|
+
flexDirection: "row",
|
|
592
|
+
position: "relative",
|
|
593
|
+
scrollbarWidth: "none",
|
|
594
|
+
msOverflowStyle: "none",
|
|
595
|
+
boxSizing: "border-box",
|
|
596
|
+
margin: 0,
|
|
597
|
+
padding: 0
|
|
598
|
+
},
|
|
599
|
+
background: {
|
|
600
|
+
position: "relative",
|
|
601
|
+
width: "100%",
|
|
602
|
+
height: "100%",
|
|
603
|
+
opacity: "0.3",
|
|
604
|
+
boxSizing: "border-box",
|
|
605
|
+
margin: 0,
|
|
606
|
+
padding: 0
|
|
607
|
+
},
|
|
608
|
+
options: {
|
|
609
|
+
height: "100%",
|
|
610
|
+
padding: "5px",
|
|
611
|
+
gap: "5px",
|
|
612
|
+
position: "absolute",
|
|
613
|
+
top: "50%",
|
|
614
|
+
transform: "translateY(-50%)",
|
|
615
|
+
left: 0,
|
|
616
|
+
display: "flex",
|
|
617
|
+
flexDirection: "row",
|
|
618
|
+
justifyContent: "center",
|
|
619
|
+
alignItems: "center",
|
|
620
|
+
boxSizing: "border-box",
|
|
621
|
+
margin: 0
|
|
622
|
+
},
|
|
623
|
+
element: {
|
|
624
|
+
display: "flex",
|
|
625
|
+
justifyContent: "center",
|
|
626
|
+
alignItems: "center",
|
|
627
|
+
cursor: "pointer",
|
|
628
|
+
width: "auto",
|
|
629
|
+
height: "100%",
|
|
630
|
+
aspectRatio: "1 / 1",
|
|
631
|
+
borderRadius: "50%",
|
|
632
|
+
overflow: "hidden",
|
|
633
|
+
border: "solid 1px #000",
|
|
634
|
+
boxSizing: "border-box",
|
|
635
|
+
margin: 0,
|
|
636
|
+
padding: 0
|
|
637
|
+
}
|
|
416
638
|
};
|
|
639
|
+
var styles_default3 = styles3;
|
|
417
640
|
// src/components/OptionSlider/OptionSlider.tsx
|
|
418
641
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
419
642
|
var OptionSlider = function(param) {
|
|
420
643
|
var value = param.value, onChange = param.onChange, _param_width = param.width, width = _param_width === void 0 ? "200" : _param_width, options = param.options, _param_color = param.color, color = _param_color === void 0 ? "#f0f0f7" : _param_color;
|
|
421
644
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", {
|
|
422
|
-
|
|
423
|
-
style: {
|
|
645
|
+
style: _object_spread_props(_object_spread({}, styles_default3.border), {
|
|
424
646
|
width: "".concat(width, "px")
|
|
425
|
-
},
|
|
647
|
+
}),
|
|
426
648
|
children: [
|
|
427
649
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", {
|
|
428
|
-
|
|
429
|
-
style: {
|
|
650
|
+
style: _object_spread_props(_object_spread({}, styles_default3.background), {
|
|
430
651
|
background: color
|
|
431
|
-
}
|
|
652
|
+
})
|
|
432
653
|
}),
|
|
433
654
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", {
|
|
434
|
-
|
|
655
|
+
style: styles_default3.options,
|
|
435
656
|
children: options.map(function(option, key) {
|
|
436
657
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", {
|
|
437
|
-
style: {
|
|
658
|
+
style: _object_spread_props(_object_spread({}, styles_default3.element), {
|
|
438
659
|
background: color,
|
|
439
660
|
border: value === option.value ? "solid 2px #000" : "solid 1px #000"
|
|
440
|
-
},
|
|
441
|
-
className: optionSlider_module_default.element,
|
|
661
|
+
}),
|
|
442
662
|
onClick: function() {
|
|
443
663
|
return onChange(option.value);
|
|
444
664
|
},
|
|
@@ -453,12 +673,6 @@ var OptionSlider = function(param) {
|
|
|
453
673
|
var OptionSlider_default = OptionSlider;
|
|
454
674
|
// src/components/ColorPickerSlider/ColorPickerSlider.tsx
|
|
455
675
|
var import_react5 = require("react");
|
|
456
|
-
// scss-module:./colorPickerSlider.module.css#scss-module
|
|
457
|
-
var colorPickerSlider_module_default = {
|
|
458
|
-
"border": "colorPickerSlider-module__border___-6cw8",
|
|
459
|
-
"thumb": "colorPickerSlider-module__thumb___p2fHW",
|
|
460
|
-
"label": "colorPickerSlider-module__label___Aa0AV"
|
|
461
|
-
};
|
|
462
676
|
// src/components/ColorPickerSlider/functions.ts
|
|
463
677
|
function encode2(color) {
|
|
464
678
|
var h = hexToHsl(color).h;
|
|
@@ -562,6 +776,39 @@ function hslToHex(h, s, l) {
|
|
|
562
776
|
};
|
|
563
777
|
return "#".concat(toHex(r)).concat(toHex(g)).concat(toHex(b));
|
|
564
778
|
}
|
|
779
|
+
// src/components/ColorPickerSlider/styles.ts
|
|
780
|
+
var styles4 = {
|
|
781
|
+
border: {
|
|
782
|
+
background: "linear-gradient(to right, hsl(0, 100%, 50%), hsl(60, 100%, 50%), hsl(120, 100%, 50%), hsl(180, 100%, 50%), hsl(240, 100%, 50%), hsl(300, 100%, 50%), hsl(0, 100%, 50%))",
|
|
783
|
+
borderRadius: "10px",
|
|
784
|
+
aspectRatio: 20,
|
|
785
|
+
cursor: "pointer",
|
|
786
|
+
appearance: "none",
|
|
787
|
+
outline: "none",
|
|
788
|
+
position: "relative"
|
|
789
|
+
},
|
|
790
|
+
thumb: {
|
|
791
|
+
borderRadius: "50%",
|
|
792
|
+
aspectRatio: 1,
|
|
793
|
+
position: "absolute",
|
|
794
|
+
top: "50%",
|
|
795
|
+
transform: "translate(-50%, -50%)",
|
|
796
|
+
boxShadow: "rgba(0, 0, 0, 0.24) 0px 3px 8px",
|
|
797
|
+
border: "solid 2px #fff"
|
|
798
|
+
},
|
|
799
|
+
label: {
|
|
800
|
+
position: "absolute",
|
|
801
|
+
bottom: "200%",
|
|
802
|
+
transform: "translateX(-50%)",
|
|
803
|
+
borderRadius: "5px",
|
|
804
|
+
padding: "5px",
|
|
805
|
+
fontSize: "15px",
|
|
806
|
+
background: "#f0f0f7",
|
|
807
|
+
transition: "scale .1s linear",
|
|
808
|
+
transformOrigin: "bottom left"
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
var styles_default4 = styles4;
|
|
565
812
|
// src/components/ColorPickerSlider/ColorPickerSlider.tsx
|
|
566
813
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
567
814
|
var ColorPickerSlider = function(param) {
|
|
@@ -613,10 +860,9 @@ var ColorPickerSlider = function(param) {
|
|
|
613
860
|
isMouseDown
|
|
614
861
|
]);
|
|
615
862
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", {
|
|
616
|
-
|
|
617
|
-
style: {
|
|
863
|
+
style: _object_spread_props(_object_spread({}, styles_default4.border), {
|
|
618
864
|
width: "".concat(width, "px")
|
|
619
|
-
},
|
|
865
|
+
}),
|
|
620
866
|
onMouseDown: function(e) {
|
|
621
867
|
handleDrag(true, e);
|
|
622
868
|
setMouseDown(true);
|
|
@@ -628,12 +874,11 @@ var ColorPickerSlider = function(param) {
|
|
|
628
874
|
ref: sliderBorderRef,
|
|
629
875
|
children: [
|
|
630
876
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
|
|
631
|
-
|
|
632
|
-
style: {
|
|
877
|
+
style: _object_spread_props(_object_spread({}, styles_default4.thumb), {
|
|
633
878
|
width: "".concat(parseInt(width) * 0.1, "px"),
|
|
634
879
|
background: value,
|
|
635
880
|
left: "".concat(percentage, "%")
|
|
636
|
-
},
|
|
881
|
+
}),
|
|
637
882
|
onMouseMove: function() {
|
|
638
883
|
return setHover(true);
|
|
639
884
|
},
|
|
@@ -642,11 +887,10 @@ var ColorPickerSlider = function(param) {
|
|
|
642
887
|
}
|
|
643
888
|
}),
|
|
644
889
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
|
|
645
|
-
|
|
646
|
-
style: {
|
|
890
|
+
style: _object_spread_props(_object_spread({}, styles_default4.label), {
|
|
647
891
|
left: "".concat(percentage, "%"),
|
|
648
892
|
scale: isHover || isMouseDown ? "1" : "0"
|
|
649
|
-
},
|
|
893
|
+
}),
|
|
650
894
|
children: value
|
|
651
895
|
})
|
|
652
896
|
]
|