welcome-ui 0.0.0-dev.1759222868187 → 0.0.0-dev.1759252708223
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/4CMBR7SL-DXQR7a9T.js +308 -0
- package/dist/{ASMQKSDT-CyLroRiC.js → ASMQKSDT-GE79MhKX.js} +12 -12
- package/dist/{AXB53BZF-DBGkYxAF.js → AXB53BZF-ClCOTGI-.js} +3 -3
- package/dist/Accordion.js +3 -3
- package/dist/{BYC7LY2E-sahp7oqU.js → BYC7LY2E-DeD1QoQl.js} +108 -108
- package/dist/Button.js +1 -1
- package/dist/Checkbox.js +1 -1
- package/dist/Drawer.js +4 -4
- package/dist/DropdownMenu.js +140 -139
- package/dist/FieldGroup.css +1 -0
- package/dist/FieldGroup.js +17 -0
- package/dist/ITI7HKP4-MlgGFEDr.js +187 -0
- package/dist/InputText.css +1 -1
- package/dist/InputText.js +34 -34
- package/dist/{JC64G2H7-oyI4lllS.js → JC64G2H7-jNBZrGfv.js} +126 -126
- package/dist/{KUU7WJ55-iyg84yrl.js → KUU7WJ55-CRa_letc.js} +1 -1
- package/dist/{LVA2YJMS-BmLXjKP9.js → LVA2YJMS-C6Bdr5Em.js} +35 -35
- package/dist/Label.js +13 -13
- package/dist/{MTZPJQMC-CEQxLFTu.js → MTZPJQMC-DgscjgO6.js} +2 -2
- package/dist/Modal.js +3 -3
- package/dist/{NLEBE274-BPGIVzin.js → NLEBE274-BlP1TDp5.js} +16 -16
- package/dist/{P2CTZE2T-CHi91Yb8.js → P2CTZE2T-DqsBJuIy.js} +32 -32
- package/dist/{P4IRICAX-CIAVAXlF.js → P4IRICAX-CvgWqpy0.js} +3 -3
- package/dist/Popover.js +3 -3
- package/dist/{QYJ6MIDR-DRpzeJNT.js → QYJ6MIDR-BWg_HLyh.js} +3 -3
- package/dist/Radio.css +1 -1
- package/dist/Radio.js +39 -38
- package/dist/RadioGroup.css +1 -0
- package/dist/RadioGroup.js +72 -0
- package/dist/RadioTab.js +1 -1
- package/dist/{SYRFVSLH-vrz7_KNH.js → SYRFVSLH-D5X1Ofws.js} +3 -3
- package/dist/Slider.css +1 -0
- package/dist/Slider.js +423 -0
- package/dist/Tabs.js +79 -78
- package/dist/Toggle.js +1 -1
- package/dist/Tooltip.js +31 -31
- package/dist/{VGCJ63VH-CV_AMRHp.js → VGCJ63VH-Bdd6jzVW.js} +31 -31
- package/dist/{X5NMLKT6-DqDJBMYO.js → X5NMLKT6-C7-nsL44.js} +2 -2
- package/dist/{YV4JVR4I-CvfP1OCB.js → YV4JVR4I-BN6SUVuh.js} +54 -54
- package/dist/types/components/FieldGroup/index.d.ts +1 -0
- package/dist/types/components/FieldGroup/types.d.ts +8 -0
- package/dist/types/components/Label/index.d.ts +1 -1
- package/dist/types/components/RadioGroup/index.d.ts +2 -0
- package/dist/types/components/RadioGroup/types.d.ts +17 -0
- package/dist/types/components/Slider/Range.d.ts +6 -0
- package/dist/types/components/Slider/index.d.ts +10 -0
- package/dist/types/components/Slider/types.d.ts +28 -0
- package/package.json +1 -1
- package/dist/ITI7HKP4-BwM8j6XI.js +0 -488
package/dist/Slider.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer components{._slider-root_4d202_2{display:flex;flex-direction:column;position:relative;width:100%}._range-root_4d202_8{width:100%;display:flex;flex-direction:column;position:relative}._input-wrapper_4d202_14{align-items:center;display:flex;gap:var(--spacing-sm);--inputTextWrapperWidth: 72px}._hint_4d202_20{margin-top:0}._slider-wrapper_4d202_23{display:flex;flex-direction:column;flex-grow:1;height:1.25rem;position:relative}._range-wrapper_4d202_30{position:relative;flex-grow:1}._tick-markers_4d202_34{height:24px;margin-left:10px;margin-right:10px;margin-top:5px;position:relative}._input-range-wrapper_4d202_41{height:1.25rem;padding-bottom:var(--spacing-sm);position:relative;padding-top:var(--spacing-sm);width:100%;--inputTextWrapperWidth: 72px}._input-range_4d202_41{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;height:var(--spacing-xs);margin:auto 0}._input-range_4d202_41::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--color-neutral-90);border:var(--border-width-md) solid var(--color-neutral-10);border-radius:50%;cursor:pointer;height:1.25rem;width:1.25rem;transform:scale(1);border:var(--border-width-md) solid var(--borderColor, var(--color-neutral-10));transition:background-color var(--duration-medium),border-color var(--duration-medium),transform .1s ease-in-out}._input-range_4d202_41::-moz-range-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--color-neutral-90);border:var(--border-width-md) solid var(--color-neutral-10);border-radius:50%;cursor:pointer;height:1.25rem;width:1.25rem;transform:scale(1);border:var(--border-width-md) solid var(--borderColor, var(--color-neutral-10));transition:background-color var(--duration-medium),border-color var(--duration-medium),transform .1s ease-in-out}._input-range_4d202_41:active,._input-range_4d202_41:focus-visible{outline:none}._input-range_4d202_41:active::-webkit-slider-thumb,._input-range_4d202_41:focus-visible::-webkit-slider-thumb{transform:scale(1.2);outline:var(--border-width-md) solid var(--color-yellow-40)}._input-range_4d202_41:active::-moz-range-thumb,._input-range_4d202_41:focus-visible::-moz-range-thumb{transform:scale(1.2);outline:var(--border-width-md) solid var(--color-yellow-40)}._input-range_4d202_41:disabled{background-image:linear-gradient(var(--color-beige-60),var(--color-beige-60));cursor:not-allowed}._input-range_4d202_41:disabled::-webkit-slider-thumb{background-color:var(--color-beige-60);cursor:not-allowed}._input-range_4d202_41:disabled::-moz-range-thumb{background-color:var(--color-beige-60);cursor:not-allowed}._input-range_4d202_41:disabled:active::-webkit-slider-thumb{transform:none;outline:none}._input-range_4d202_41:disabled:active::-moz-range-thumb{transform:none;outline:none}._border-selector-secondary-blue_4d202_110{--borderColor: var(--color-secondary-blue)}._border-selector-secondary-green_4d202_113{--borderColor: var(--color-secondary-green)}._border-selector-secondary-orange_4d202_116{--borderColor: var(--color-secondary-orange)}._border-selector-secondary-pink_4d202_119{--borderColor: var(--color-secondary-pink)}._border-selector-secondary-teal_4d202_122{--borderColor: var(--color-secondary-teal)}._border-selector-secondary-violet_4d202_125{--borderColor: var(--color-secondary-violet)}._slider-input-range_4d202_128{background-color:var(--color-beige-40);background-image:linear-gradient(var(--color-yellow-40),var(--color-yellow-40));cursor:pointer;background-repeat:no-repeat;border-radius:0}._range-input-range_4d202_135{pointer-events:none;position:absolute;outline:none;z-index:1}._range-input-range_4d202_135::-webkit-slider-thumb{pointer-events:all;position:relative}._range-input-range_4d202_135::-moz-range-thumb{pointer-events:all;position:relative}._output_4d202_149{opacity:0;visibility:hidden;transition:opacity .15s ease-in-out,visibility .15s ease-in-out,transform .15s ease-in-out;position:absolute;text-align:center;transform:translate(-50%,calc(-100% + -var(--spacing-xs)))}._output-visible_4d202_157{opacity:100;visibility:visible;transform:translate(-50%,calc(-100% + -var(--spacing-sm)))}._tooltip_4d202_162{background-color:var(--color-neutral-90);border:var(--border-width-sm) solid var(--color-neutral-70);color:var(--color-neutral-10);flex:1 1 auto;margin:auto;min-width:var(--spacing-xxs);padding:var(--spacing-xs) var(--spacing-sm)}._thick_4d202_171{position:absolute;flex-direction:column}._thick_4d202_171:before{content:"";position:absolute;background-color:var(--color-neutral-30);height:6px;width:1px}._thick-label_4d202_182{position:absolute;top:0;transform:translate(-50%,50%);white-space:nowrap}._range-track_4d202_188{position:absolute;width:100%;height:var(--spacing-xs);background-color:var(--color-beige-40)}._range_4d202_8{position:absolute;width:100%;height:var(--spacing-xs);background-color:var(--color-yellow-40)}._range-disabled_4d202_200{background-image:linear-gradient(var(--color-beige-60),var(--color-beige-60));cursor:not-allowed}}
|
package/dist/Slider.js
ADDED
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as R, jsx as l, Fragment as ie } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as Y, useState as D, useRef as A, useCallback as Z, useEffect as U, useId as ee } from "react";
|
|
4
|
+
import { Hint as H } from "./Hint.js";
|
|
5
|
+
import { InputText as O } from "./InputText.js";
|
|
6
|
+
import { Text as re } from "./Text.js";
|
|
7
|
+
import { c as ne } from "./classNames-qiokGROM.js";
|
|
8
|
+
const oe = "_hint_4d202_20", se = "_output_4d202_149", ce = "_tooltip_4d202_162", ue = "_thick_4d202_171", de = "_range_4d202_8", te = {
|
|
9
|
+
"slider-root": "_slider-root_4d202_2",
|
|
10
|
+
"range-root": "_range-root_4d202_8",
|
|
11
|
+
"input-wrapper": "_input-wrapper_4d202_14",
|
|
12
|
+
hint: oe,
|
|
13
|
+
"slider-wrapper": "_slider-wrapper_4d202_23",
|
|
14
|
+
"range-wrapper": "_range-wrapper_4d202_30",
|
|
15
|
+
"tick-markers": "_tick-markers_4d202_34",
|
|
16
|
+
"input-range-wrapper": "_input-range-wrapper_4d202_41",
|
|
17
|
+
"input-range": "_input-range_4d202_41",
|
|
18
|
+
"border-selector-secondary-blue": "_border-selector-secondary-blue_4d202_110",
|
|
19
|
+
"border-selector-secondary-green": "_border-selector-secondary-green_4d202_113",
|
|
20
|
+
"border-selector-secondary-orange": "_border-selector-secondary-orange_4d202_116",
|
|
21
|
+
"border-selector-secondary-pink": "_border-selector-secondary-pink_4d202_119",
|
|
22
|
+
"border-selector-secondary-teal": "_border-selector-secondary-teal_4d202_122",
|
|
23
|
+
"border-selector-secondary-violet": "_border-selector-secondary-violet_4d202_125",
|
|
24
|
+
"slider-input-range": "_slider-input-range_4d202_128",
|
|
25
|
+
"range-input-range": "_range-input-range_4d202_135",
|
|
26
|
+
output: se,
|
|
27
|
+
"output-visible": "_output-visible_4d202_157",
|
|
28
|
+
tooltip: ce,
|
|
29
|
+
thick: ue,
|
|
30
|
+
"thick-label": "_thick-label_4d202_182",
|
|
31
|
+
"range-track": "_range-track_4d202_188",
|
|
32
|
+
range: de,
|
|
33
|
+
"range-disabled": "_range-disabled_4d202_200"
|
|
34
|
+
}, X = 20, g = ne(te), P = ({
|
|
35
|
+
min: d,
|
|
36
|
+
step: _,
|
|
37
|
+
toCompare: p,
|
|
38
|
+
value: k
|
|
39
|
+
}) => {
|
|
40
|
+
let h = Math.min(k, p - 1 * _);
|
|
41
|
+
return h = Math.max(h, d), q(h, _);
|
|
42
|
+
}, T = ({
|
|
43
|
+
max: d,
|
|
44
|
+
step: _,
|
|
45
|
+
toCompare: p,
|
|
46
|
+
value: k
|
|
47
|
+
}) => {
|
|
48
|
+
let h = Math.max(k, p + 1 * _);
|
|
49
|
+
return h = Math.min(h, d), q(h, _);
|
|
50
|
+
}, fe = Y(
|
|
51
|
+
({
|
|
52
|
+
borderSelectorColor: d,
|
|
53
|
+
className: _,
|
|
54
|
+
disabled: p,
|
|
55
|
+
hint: k,
|
|
56
|
+
label: h,
|
|
57
|
+
max: a,
|
|
58
|
+
min: t,
|
|
59
|
+
onChange: v,
|
|
60
|
+
step: i = 1,
|
|
61
|
+
tooltip: M,
|
|
62
|
+
type: m,
|
|
63
|
+
value: f,
|
|
64
|
+
values: B,
|
|
65
|
+
...W
|
|
66
|
+
}, G) => {
|
|
67
|
+
const [o, V] = D(t), [s, x] = D(a), [K, N] = D(t), [y, b] = D(a), z = A(null), E = A(null), $ = A(null), C = A(null), L = A(null), [S, j] = D(!1), [n, c] = D(!1), ae = (e) => {
|
|
68
|
+
const r = P({
|
|
69
|
+
min: t,
|
|
70
|
+
step: i,
|
|
71
|
+
toCompare: s,
|
|
72
|
+
value: parseInt(e.target.value, 10)
|
|
73
|
+
});
|
|
74
|
+
N(r), V(r), e.target.value = r.toString();
|
|
75
|
+
}, le = (e) => {
|
|
76
|
+
const r = T({
|
|
77
|
+
max: a,
|
|
78
|
+
step: i,
|
|
79
|
+
toCompare: o,
|
|
80
|
+
value: parseInt(e.target.value, 10)
|
|
81
|
+
});
|
|
82
|
+
b(r), x(r), e.target.value = r.toString();
|
|
83
|
+
}, Q = (e, r) => {
|
|
84
|
+
if (e.preventDefault(), r === "min") {
|
|
85
|
+
let u = o;
|
|
86
|
+
e.key === "ArrowRight" && (u = P({ min: t, step: i, toCompare: s, value: u + i })), e.key === "ArrowLeft" && (u = P({ min: t, step: i, toCompare: s, value: u - i })), N(u), V(u), v({ max: s, min: u });
|
|
87
|
+
}
|
|
88
|
+
if (r === "max") {
|
|
89
|
+
let u = s;
|
|
90
|
+
e.key === "ArrowRight" && (u = T({ max: a, step: i, toCompare: o, value: u + i })), e.key === "ArrowLeft" && (u = T({ max: a, step: i, toCompare: o, value: u - i })), b(u), x(u), v({ max: u, min: o });
|
|
91
|
+
}
|
|
92
|
+
}, I = Z(
|
|
93
|
+
(e) => {
|
|
94
|
+
const r = Math.round((e - t) / (a - t) * 100);
|
|
95
|
+
return r < 0 ? 0 : r > 100 ? 100 : r;
|
|
96
|
+
},
|
|
97
|
+
[t, a]
|
|
98
|
+
);
|
|
99
|
+
U(() => {
|
|
100
|
+
if (E.current) {
|
|
101
|
+
const e = I(o), r = I(parseInt(E.current.value, 10));
|
|
102
|
+
$.current && ($.current.style.left = `${e}%`, $.current.style.width = `${r - e}%`);
|
|
103
|
+
}
|
|
104
|
+
}, [o, I]), U(() => {
|
|
105
|
+
if (z.current) {
|
|
106
|
+
const e = I(parseInt(z.current.value, 10)), r = I(s);
|
|
107
|
+
if ($.current && ($.current.style.width = `${r - e}%`), C.current) {
|
|
108
|
+
const u = I(o) / 100;
|
|
109
|
+
C.current.style.left = `calc(${u * 100}% + ${(0.5 - u) * X}px)`;
|
|
110
|
+
}
|
|
111
|
+
if (L.current) {
|
|
112
|
+
const u = I(s) / 100;
|
|
113
|
+
L.current.style.left = `calc(${u * 100}% + ${(0.5 - u) * X}px)`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}, [o, s, I]), U(() => {
|
|
117
|
+
if (f) {
|
|
118
|
+
if (!isNaN(f.min) && f.min !== o) {
|
|
119
|
+
const e = P({ min: t, step: i, toCompare: s, value: f.min || t });
|
|
120
|
+
V(e), N(e);
|
|
121
|
+
}
|
|
122
|
+
if (!isNaN(f.max) && f.max !== s) {
|
|
123
|
+
const e = T({ max: a, step: i, toCompare: o, value: f.max || a });
|
|
124
|
+
x(e), b(e);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}, [f]);
|
|
128
|
+
const J = ee();
|
|
129
|
+
return /* @__PURE__ */ R("div", { className: g("range-root", _), ref: G, children: [
|
|
130
|
+
h ? /* @__PURE__ */ l(re, { as: "label", htmlFor: `${J}-min`, variant: "sm", children: h }) : null,
|
|
131
|
+
/* @__PURE__ */ R("div", { className: g("input-wrapper"), children: [
|
|
132
|
+
(m === "inline" || m === "fields") && (m === "fields" ? /* @__PURE__ */ l(
|
|
133
|
+
O,
|
|
134
|
+
{
|
|
135
|
+
disabled: p,
|
|
136
|
+
max: s,
|
|
137
|
+
min: t,
|
|
138
|
+
onBlur: () => {
|
|
139
|
+
const e = P({
|
|
140
|
+
min: t,
|
|
141
|
+
step: i,
|
|
142
|
+
toCompare: s,
|
|
143
|
+
value: K
|
|
144
|
+
});
|
|
145
|
+
N(e), V(e), v({ max: s, min: e });
|
|
146
|
+
},
|
|
147
|
+
onChange: (e) => {
|
|
148
|
+
let r = parseInt(e.target.value, 10);
|
|
149
|
+
isNaN(r) && (r = 0), N(r);
|
|
150
|
+
},
|
|
151
|
+
onKeyDown: (e) => {
|
|
152
|
+
if (e.key === "Enter") {
|
|
153
|
+
const r = P({
|
|
154
|
+
min: t,
|
|
155
|
+
step: i,
|
|
156
|
+
toCompare: s,
|
|
157
|
+
value: K
|
|
158
|
+
});
|
|
159
|
+
N(r), V(r), v({ max: s, min: r });
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
size: "sm",
|
|
163
|
+
type: "number",
|
|
164
|
+
value: K.toString()
|
|
165
|
+
}
|
|
166
|
+
) : /* @__PURE__ */ l("div", { children: t })),
|
|
167
|
+
/* @__PURE__ */ R("div", { className: g("range-wrapper"), children: [
|
|
168
|
+
M ? /* @__PURE__ */ R(ie, { children: [
|
|
169
|
+
/* @__PURE__ */ l(
|
|
170
|
+
"output",
|
|
171
|
+
{
|
|
172
|
+
className: g("output", S && "output-visible"),
|
|
173
|
+
ref: C,
|
|
174
|
+
children: /* @__PURE__ */ l("div", { children: o })
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
/* @__PURE__ */ l(
|
|
178
|
+
"output",
|
|
179
|
+
{
|
|
180
|
+
className: g("output", n && "output-visible"),
|
|
181
|
+
ref: L,
|
|
182
|
+
children: /* @__PURE__ */ l("div", { children: s })
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
] }) : null,
|
|
186
|
+
/* @__PURE__ */ R("div", { className: g("input-range-wrapper"), children: [
|
|
187
|
+
/* @__PURE__ */ l(
|
|
188
|
+
"input",
|
|
189
|
+
{
|
|
190
|
+
...W,
|
|
191
|
+
className: g(
|
|
192
|
+
"input-range",
|
|
193
|
+
"range-input-range",
|
|
194
|
+
d && `border-selector-${d}`
|
|
195
|
+
),
|
|
196
|
+
disabled: p,
|
|
197
|
+
id: `${J}-min`,
|
|
198
|
+
max: a,
|
|
199
|
+
min: t,
|
|
200
|
+
onChange: ae,
|
|
201
|
+
onKeyDown: (e) => Q(e, "min"),
|
|
202
|
+
onMouseDown: () => {
|
|
203
|
+
M && S === !1 && j(!0);
|
|
204
|
+
},
|
|
205
|
+
onMouseUp: () => {
|
|
206
|
+
v({ max: s, min: o }), M && j(!1);
|
|
207
|
+
},
|
|
208
|
+
ref: z,
|
|
209
|
+
step: i,
|
|
210
|
+
type: "range",
|
|
211
|
+
value: o
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
/* @__PURE__ */ l(
|
|
215
|
+
"input",
|
|
216
|
+
{
|
|
217
|
+
...W,
|
|
218
|
+
className: g(
|
|
219
|
+
"input-range",
|
|
220
|
+
"range-input-range",
|
|
221
|
+
d && `border-selector-${d}`
|
|
222
|
+
),
|
|
223
|
+
disabled: p,
|
|
224
|
+
id: `${J}-max`,
|
|
225
|
+
max: a,
|
|
226
|
+
min: t,
|
|
227
|
+
onChange: le,
|
|
228
|
+
onKeyDown: (e) => Q(e, "max"),
|
|
229
|
+
onMouseDown: () => {
|
|
230
|
+
M && n === !1 && c(!0);
|
|
231
|
+
},
|
|
232
|
+
onMouseUp: () => {
|
|
233
|
+
v({ max: s, min: o }), M && c(!1);
|
|
234
|
+
},
|
|
235
|
+
ref: E,
|
|
236
|
+
step: i,
|
|
237
|
+
type: "range",
|
|
238
|
+
value: s
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
/* @__PURE__ */ l("div", { className: g("range-track") }),
|
|
242
|
+
/* @__PURE__ */ l("div", { className: g("range", p && "range-disabled"), ref: $ })
|
|
243
|
+
] }),
|
|
244
|
+
B ? /* @__PURE__ */ l("div", { className: g("thicks-markers"), children: B.reduce((e, r) => e.includes(r) ? e : [...e, r], []).filter((e) => e >= t && e <= a).map((e, r) => /* @__PURE__ */ l(
|
|
245
|
+
"div",
|
|
246
|
+
{
|
|
247
|
+
className: g("thick"),
|
|
248
|
+
style: { left: `${I(e)}%` },
|
|
249
|
+
children: /* @__PURE__ */ l(H, { className: g("thick-label"), children: e })
|
|
250
|
+
},
|
|
251
|
+
`${e}-${r}`
|
|
252
|
+
)) }) : null
|
|
253
|
+
] }),
|
|
254
|
+
(m === "inline" || m === "fields") && (m === "fields" ? /* @__PURE__ */ l(
|
|
255
|
+
O,
|
|
256
|
+
{
|
|
257
|
+
disabled: p,
|
|
258
|
+
max: a,
|
|
259
|
+
min: o + 1,
|
|
260
|
+
onBlur: () => {
|
|
261
|
+
const e = T({
|
|
262
|
+
max: a,
|
|
263
|
+
step: i,
|
|
264
|
+
toCompare: o,
|
|
265
|
+
value: y
|
|
266
|
+
});
|
|
267
|
+
b(e), x(e), v({ max: e, min: o });
|
|
268
|
+
},
|
|
269
|
+
onChange: (e) => {
|
|
270
|
+
let r = parseInt(e.target.value, 10);
|
|
271
|
+
isNaN(r) && (r = 0), b(r);
|
|
272
|
+
},
|
|
273
|
+
onKeyDown: (e) => {
|
|
274
|
+
if (e.key === "Enter") {
|
|
275
|
+
const r = T({
|
|
276
|
+
max: a,
|
|
277
|
+
step: i,
|
|
278
|
+
toCompare: o,
|
|
279
|
+
value: y
|
|
280
|
+
});
|
|
281
|
+
b(r), x(r), v({ max: r, min: o });
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
size: "sm",
|
|
285
|
+
type: "number",
|
|
286
|
+
value: y.toString()
|
|
287
|
+
}
|
|
288
|
+
) : /* @__PURE__ */ l("div", { children: a }))
|
|
289
|
+
] }),
|
|
290
|
+
k ? /* @__PURE__ */ l(H, { className: g("hint"), children: k }) : null
|
|
291
|
+
] });
|
|
292
|
+
}
|
|
293
|
+
), pe = 20, q = (d, _) => Math.round(d / _) * _, F = (d, _, p, k) => (d = q(d, k), d < _ ? _ : d > p ? p : d), w = ne(te), _e = Y(
|
|
294
|
+
({
|
|
295
|
+
borderSelectorColor: d,
|
|
296
|
+
className: _,
|
|
297
|
+
disabled: p,
|
|
298
|
+
hint: k,
|
|
299
|
+
label: h,
|
|
300
|
+
max: a,
|
|
301
|
+
min: t,
|
|
302
|
+
onChange: v,
|
|
303
|
+
step: i = 1,
|
|
304
|
+
tooltip: M,
|
|
305
|
+
type: m,
|
|
306
|
+
value: f,
|
|
307
|
+
values: B,
|
|
308
|
+
...W
|
|
309
|
+
}, G) => {
|
|
310
|
+
const o = A(null), V = A(null), [s, x] = D(!1), [K, N] = D(F(f, t, a, i)), [y, b] = D(F(f, t, a, i)), z = (n) => {
|
|
311
|
+
n = q(n, i), b(n);
|
|
312
|
+
}, E = (n) => {
|
|
313
|
+
n.preventDefault();
|
|
314
|
+
let c = y;
|
|
315
|
+
n.key === "ArrowRight" && (c = F(c + i, t, a, i)), n.key === "ArrowLeft" && (c = F(c - i, t, a, i)), b(c), N(c), v(c);
|
|
316
|
+
}, $ = (n) => {
|
|
317
|
+
let c = parseInt(n.target.value, 10);
|
|
318
|
+
isNaN(c) && (c = 0), N(c);
|
|
319
|
+
}, C = () => {
|
|
320
|
+
const n = F(K, t, a, i);
|
|
321
|
+
N(n), b(n), v(n);
|
|
322
|
+
}, L = (n) => {
|
|
323
|
+
n.key === "Enter" && C();
|
|
324
|
+
}, S = Z(
|
|
325
|
+
(n) => Math.round((n - t) / (a - t) * 100),
|
|
326
|
+
[t, a]
|
|
327
|
+
);
|
|
328
|
+
U(() => {
|
|
329
|
+
if (o.current && (o.current.style.backgroundSize = `${S(y)}% 100%`), V.current) {
|
|
330
|
+
const n = S(y) / 100;
|
|
331
|
+
V.current.style.left = `calc(${n * 100}% + ${(0.5 - n) * pe}px)`;
|
|
332
|
+
}
|
|
333
|
+
}, [y, S]), U(() => {
|
|
334
|
+
!isNaN(f) && f !== y && f && (z(f), N(f));
|
|
335
|
+
}, [f]);
|
|
336
|
+
const j = ee();
|
|
337
|
+
return /* @__PURE__ */ R("div", { className: w("slider-root", _), ref: G, children: [
|
|
338
|
+
h ? /* @__PURE__ */ l(re, { as: "label", htmlFor: j, variant: "sm", children: h }) : null,
|
|
339
|
+
/* @__PURE__ */ R("div", { className: w("input-wrapper"), children: [
|
|
340
|
+
(m === "inline" || m === "left-field") && (m === "left-field" ? /* @__PURE__ */ l(
|
|
341
|
+
O,
|
|
342
|
+
{
|
|
343
|
+
disabled: p,
|
|
344
|
+
max: a,
|
|
345
|
+
min: t,
|
|
346
|
+
onBlur: C,
|
|
347
|
+
onChange: $,
|
|
348
|
+
onKeyDown: L,
|
|
349
|
+
size: "sm",
|
|
350
|
+
type: "number",
|
|
351
|
+
value: K.toString()
|
|
352
|
+
}
|
|
353
|
+
) : /* @__PURE__ */ l("div", { children: t })),
|
|
354
|
+
/* @__PURE__ */ R("div", { className: w("slider-wrapper"), children: [
|
|
355
|
+
/* @__PURE__ */ l(
|
|
356
|
+
"input",
|
|
357
|
+
{
|
|
358
|
+
className: w(
|
|
359
|
+
"input-range",
|
|
360
|
+
"slider-input-range",
|
|
361
|
+
d && `border-selector-${d}`
|
|
362
|
+
),
|
|
363
|
+
disabled: p,
|
|
364
|
+
id: j,
|
|
365
|
+
list: "tickmarks",
|
|
366
|
+
max: a,
|
|
367
|
+
min: t,
|
|
368
|
+
onChange: (n) => {
|
|
369
|
+
const c = parseInt(n.target.value, 10);
|
|
370
|
+
z(c), N(c);
|
|
371
|
+
},
|
|
372
|
+
onKeyDown: E,
|
|
373
|
+
onMouseDown: () => {
|
|
374
|
+
M && s === !1 && x(!0);
|
|
375
|
+
},
|
|
376
|
+
onMouseUp: () => {
|
|
377
|
+
v(y), M && x(!1);
|
|
378
|
+
},
|
|
379
|
+
ref: o,
|
|
380
|
+
step: i,
|
|
381
|
+
type: "range",
|
|
382
|
+
value: y,
|
|
383
|
+
...W
|
|
384
|
+
}
|
|
385
|
+
),
|
|
386
|
+
M ? /* @__PURE__ */ l("output", { className: w("output", s && "output-visible"), ref: V, children: /* @__PURE__ */ l("div", { className: w("tooltip"), children: y }) }) : null,
|
|
387
|
+
B ? /* @__PURE__ */ l("div", { className: w("thick-markers"), children: B.reduce((n, c) => n.includes(c) ? n : [...n, c], []).filter((n) => n >= t && n <= a).map((n, c) => /* @__PURE__ */ l(
|
|
388
|
+
"div",
|
|
389
|
+
{
|
|
390
|
+
className: w("thick"),
|
|
391
|
+
style: { left: `${S(n)}%` },
|
|
392
|
+
children: /* @__PURE__ */ l(H, { className: w("thick-label"), children: n })
|
|
393
|
+
},
|
|
394
|
+
`${n}-${c}`
|
|
395
|
+
)) }) : null
|
|
396
|
+
] }),
|
|
397
|
+
(m === "inline" || m === "right-field") && (m === "right-field" ? /* @__PURE__ */ l(
|
|
398
|
+
O,
|
|
399
|
+
{
|
|
400
|
+
className: w("input-text"),
|
|
401
|
+
disabled: p,
|
|
402
|
+
max: a,
|
|
403
|
+
min: t,
|
|
404
|
+
onBlur: C,
|
|
405
|
+
onChange: $,
|
|
406
|
+
onKeyDown: L,
|
|
407
|
+
size: "sm",
|
|
408
|
+
type: "number",
|
|
409
|
+
value: K.toString()
|
|
410
|
+
}
|
|
411
|
+
) : /* @__PURE__ */ l("div", { children: a }))
|
|
412
|
+
] }),
|
|
413
|
+
k ? /* @__PURE__ */ l(H, { className: w("hint"), children: k }) : null
|
|
414
|
+
] });
|
|
415
|
+
}
|
|
416
|
+
), ke = Object.assign(_e, { Range: fe });
|
|
417
|
+
export {
|
|
418
|
+
ke as Slider,
|
|
419
|
+
_e as SliderComponent,
|
|
420
|
+
F as ensureMinMax,
|
|
421
|
+
q as round,
|
|
422
|
+
pe as thumbWidth
|
|
423
|
+
};
|