@delightui/components 0.1.105 → 0.1.107
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 +104 -1
- package/dist/cjs/components/molecules/Modal/DemoModal.d.ts +8 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/ModalContext.d.ts +41 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/ModalContext.types.d.ts +87 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/index.d.ts +3 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/useModal.d.ts +34 -0
- package/dist/cjs/components/molecules/Modal/index.d.ts +2 -0
- package/dist/cjs/components/molecules/index.d.ts +2 -0
- package/dist/cjs/library.css +19 -6
- package/dist/cjs/library.js +3 -3
- package/dist/cjs/library.js.map +1 -1
- package/dist/esm/components/molecules/Modal/DemoModal.d.ts +8 -0
- package/dist/esm/components/molecules/Modal/ModalContext/ModalContext.d.ts +41 -0
- package/dist/esm/components/molecules/Modal/ModalContext/ModalContext.types.d.ts +87 -0
- package/dist/esm/components/molecules/Modal/ModalContext/index.d.ts +3 -0
- package/dist/esm/components/molecules/Modal/ModalContext/useModal.d.ts +34 -0
- package/dist/esm/components/molecules/Modal/index.d.ts +2 -0
- package/dist/esm/components/molecules/index.d.ts +2 -0
- package/dist/esm/library.css +19 -6
- package/dist/esm/library.js +3 -3
- package/dist/esm/library.js.map +1 -1
- package/dist/index.d.ts +108 -2
- package/docs/README.md +264 -0
- package/docs/components/atoms/ActionImage.md +119 -0
- package/docs/components/atoms/Button.md +197 -0
- package/docs/components/atoms/Checkbox.md +299 -0
- package/docs/components/atoms/CheckboxItem.md +314 -0
- package/docs/components/atoms/Chip.md +380 -0
- package/docs/components/atoms/CustomToggle.md +270 -0
- package/docs/components/atoms/Icon.md +365 -0
- package/docs/components/atoms/IconButton.md +407 -0
- package/docs/components/atoms/Image.md +448 -0
- package/docs/components/atoms/Input.md +430 -0
- package/docs/components/atoms/ListItem.md +502 -0
- package/docs/components/atoms/Password.md +472 -0
- package/docs/components/atoms/RadioButton.md +614 -0
- package/docs/components/atoms/RadioButtonItem.md +588 -0
- package/docs/components/atoms/ResponsiveComponent.md +612 -0
- package/docs/components/atoms/SelectListItem.md +609 -0
- package/docs/components/atoms/Slider.md +605 -0
- package/docs/components/atoms/Spinner.md +605 -0
- package/docs/components/atoms/Text.md +463 -0
- package/docs/components/atoms/TextArea.md +670 -0
- package/docs/components/atoms/ToastNotification.md +668 -0
- package/docs/components/atoms/Toggle.md +737 -0
- package/docs/components/atoms/ToggleButton.md +751 -0
- package/docs/components/atoms/Tooltip.md +391 -0
- package/docs/components/molecules/Accordion.md +440 -0
- package/docs/components/molecules/AccordionGroup.md +547 -0
- package/docs/components/molecules/ActionCard.md +546 -0
- package/docs/components/molecules/Breadcrumb.md +403 -0
- package/docs/components/molecules/Breadcrumbs.md +485 -0
- package/docs/components/molecules/ButtonGroup.md +383 -0
- package/docs/components/molecules/Card.md +298 -0
- package/docs/components/molecules/ChipInput.md +646 -0
- package/docs/components/molecules/ContextMenu.md +768 -0
- package/docs/components/molecules/CustomTimeSelector.md +116 -0
- package/docs/components/molecules/DatePicker.md +516 -0
- package/docs/components/molecules/DateTimeSelector.md +166 -0
- package/docs/components/molecules/FormField.md +312 -0
- package/docs/components/molecules/Grid.md +577 -0
- package/docs/components/molecules/GridItem.md +834 -0
- package/docs/components/molecules/GridList.md +244 -0
- package/docs/components/molecules/List.md +485 -0
- package/docs/components/molecules/Modal.md +470 -0
- package/docs/components/molecules/ModalFooter.md +702 -0
- package/docs/components/molecules/ModalHeader.md +756 -0
- package/docs/components/molecules/ModalProvider.md +205 -0
- package/docs/components/molecules/Nav.md +530 -0
- package/docs/components/molecules/NavItem.md +572 -0
- package/docs/components/molecules/NavLink.md +499 -0
- package/docs/components/molecules/Option.md +521 -0
- package/docs/components/molecules/Pagination.md +592 -0
- package/docs/components/molecules/PaginationNumberField.md +722 -0
- package/docs/components/molecules/Popover.md +516 -0
- package/docs/components/molecules/ProgressBar.md +624 -0
- package/docs/components/molecules/RadioGroup.md +831 -0
- package/docs/components/molecules/RepeaterList.md +185 -0
- package/docs/components/molecules/Select.md +402 -0
- package/docs/components/molecules/SortableTrigger.md +82 -0
- package/docs/components/molecules/useModal.md +379 -0
- package/docs/components/organisms/Dropzone.md +346 -0
- package/docs/components/organisms/DropzoneClear.md +135 -0
- package/docs/components/organisms/DropzoneContent.md +216 -0
- package/docs/components/organisms/DropzoneFilename.md +191 -0
- package/docs/components/organisms/DropzoneSupportedFormats.md +184 -0
- package/docs/components/organisms/DropzoneTrigger.md +209 -0
- package/docs/components/organisms/Form.md +533 -0
- package/docs/components/organisms/SlideOutPanel.md +662 -0
- package/docs/components/organisms/TabContent.md +902 -0
- package/docs/components/organisms/TabItem.md +1091 -0
- package/docs/components/organisms/Table.md +611 -0
- package/docs/components/organisms/TableBody.md +679 -0
- package/docs/components/organisms/TableCell.md +482 -0
- package/docs/components/organisms/TableHeader.md +513 -0
- package/docs/components/organisms/TableHeaderCell.md +661 -0
- package/docs/components/organisms/TableRow.md +715 -0
- package/docs/components/organisms/Tabs.md +1330 -0
- package/docs/components/utils/ConditionalView.md +568 -0
- package/docs/components/utils/RenderStateView.md +726 -0
- package/docs/components/utils/WrapTextNodes.md +614 -0
- package/package.json +3 -2
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
# Slider
|
|
2
|
+
|
|
3
|
+
A versatile slider component that allows users to select numeric values within a specified range. It supports both single-value and range selection modes, with customizable min/max values, step sizes, and display options. The component integrates seamlessly with forms and provides visual feedback for the selected values.
|
|
4
|
+
|
|
5
|
+
## Aliases
|
|
6
|
+
|
|
7
|
+
- Slider
|
|
8
|
+
- Range
|
|
9
|
+
- RangeSlider
|
|
10
|
+
|
|
11
|
+
## Props Breakdown
|
|
12
|
+
|
|
13
|
+
**Extends:** `HTMLAttributes<HTMLDivElement>` and `ControlledFormComponentProps<number | [number, number]>`
|
|
14
|
+
|
|
15
|
+
| Prop | Type | Default | Required | Description |
|
|
16
|
+
|------|------|---------|----------|-------------|
|
|
17
|
+
| `min` | `number` | `0` | No | The minimum value of the slider |
|
|
18
|
+
| `max` | `number` | `100` | No | The maximum value of the slider |
|
|
19
|
+
| `step` | `number` | `1` | No | The step size for the slider |
|
|
20
|
+
| `showMin` | `boolean` | `false` | No | Whether to display the minimum value label |
|
|
21
|
+
| `showMax` | `boolean` | `false` | No | Whether to display the maximum value label |
|
|
22
|
+
| `showValueOnThumb` | `boolean` | `false` | No | Whether to show the current value on the slider thumb |
|
|
23
|
+
| `enableRange` | `boolean` | `false` | No | Whether to enable range selection (two thumbs) |
|
|
24
|
+
| `className` | `string` | `undefined` | No | Additional class for styling |
|
|
25
|
+
| `initialValue` | `number \| [number, number]` | `undefined` | No | The initial value for the field |
|
|
26
|
+
| `checked` | `boolean` | `undefined` | No | The initial value for the field |
|
|
27
|
+
| `value` | `number \| [number, number]` | `undefined` | No | The current value of the form field |
|
|
28
|
+
| `onValueChange` | `(value: number \| [number, number]) => void` | `undefined` | No | Callback function that is called when the field value changes |
|
|
29
|
+
| `disabled` | `boolean` | `false` | No | Whether the form field is disabled and cannot be interacted with |
|
|
30
|
+
| `required` | `boolean` | `false` | No | Whether the form field must have a value |
|
|
31
|
+
| `invalid` | `boolean` | `false` | No | Whether the form field's current value is invalid |
|
|
32
|
+
| `id` | `string` | `undefined` | No | Id for the form field |
|
|
33
|
+
|
|
34
|
+
Plus all standard HTML div attributes (id, title, aria-*, data-*, etc.).
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
### Basic Slider
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { Slider } from '@delightui/components';
|
|
42
|
+
|
|
43
|
+
function BasicSliderExample() {
|
|
44
|
+
const [value, setValue] = useState(50);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div>
|
|
48
|
+
<p>Value: {value}</p>
|
|
49
|
+
<Slider
|
|
50
|
+
value={value}
|
|
51
|
+
onValueChange={setValue}
|
|
52
|
+
min={0}
|
|
53
|
+
max={100}
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Slider with Min/Max Labels
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import { Slider } from '@delightui/components';
|
|
64
|
+
|
|
65
|
+
function SliderWithLabelsExample() {
|
|
66
|
+
const [value, setValue] = useState(25);
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div>
|
|
70
|
+
<p>Selected Value: {value}</p>
|
|
71
|
+
<Slider
|
|
72
|
+
value={value}
|
|
73
|
+
onValueChange={setValue}
|
|
74
|
+
min={0}
|
|
75
|
+
max={100}
|
|
76
|
+
showMin
|
|
77
|
+
showMax
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Slider with Value on Thumb
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import { Slider } from '@delightui/components';
|
|
88
|
+
|
|
89
|
+
function SliderWithThumbValueExample() {
|
|
90
|
+
const [value, setValue] = useState(75);
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<Slider
|
|
94
|
+
value={value}
|
|
95
|
+
onValueChange={setValue}
|
|
96
|
+
min={0}
|
|
97
|
+
max={100}
|
|
98
|
+
showValueOnThumb
|
|
99
|
+
showMin
|
|
100
|
+
showMax
|
|
101
|
+
/>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Range Slider
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
import { Slider } from '@delightui/components';
|
|
110
|
+
|
|
111
|
+
function RangeSliderExample() {
|
|
112
|
+
const [range, setRange] = useState<[number, number]>([20, 80]);
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<div>
|
|
116
|
+
<p>Range: {range[0]} - {range[1]}</p>
|
|
117
|
+
<Slider
|
|
118
|
+
value={range}
|
|
119
|
+
onValueChange={setRange}
|
|
120
|
+
min={0}
|
|
121
|
+
max={100}
|
|
122
|
+
enableRange
|
|
123
|
+
showMin
|
|
124
|
+
showMax
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Custom Step Size
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
import { Slider } from '@delightui/components';
|
|
135
|
+
|
|
136
|
+
function CustomStepSliderExample() {
|
|
137
|
+
const [value, setValue] = useState(50);
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '20px' }}>
|
|
141
|
+
<div>
|
|
142
|
+
<p>Step 1: {value}</p>
|
|
143
|
+
<Slider
|
|
144
|
+
value={value}
|
|
145
|
+
onValueChange={setValue}
|
|
146
|
+
min={0}
|
|
147
|
+
max={100}
|
|
148
|
+
step={1}
|
|
149
|
+
showValueOnThumb
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<div>
|
|
154
|
+
<p>Step 5: {Math.round(value / 5) * 5}</p>
|
|
155
|
+
<Slider
|
|
156
|
+
value={Math.round(value / 5) * 5}
|
|
157
|
+
onValueChange={(v) => setValue(v as number)}
|
|
158
|
+
min={0}
|
|
159
|
+
max={100}
|
|
160
|
+
step={5}
|
|
161
|
+
showValueOnThumb
|
|
162
|
+
/>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
<div>
|
|
166
|
+
<p>Step 10: {Math.round(value / 10) * 10}</p>
|
|
167
|
+
<Slider
|
|
168
|
+
value={Math.round(value / 10) * 10}
|
|
169
|
+
onValueChange={(v) => setValue(v as number)}
|
|
170
|
+
min={0}
|
|
171
|
+
max={100}
|
|
172
|
+
step={10}
|
|
173
|
+
showValueOnThumb
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Form Integration
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
import { Form, FormField, Slider, Button, Text } from '@delightui/components';
|
|
185
|
+
|
|
186
|
+
function SliderFormExample() {
|
|
187
|
+
const handleSubmit = (data: any) => {
|
|
188
|
+
console.log('Form submitted:', data);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<Form onSubmit={handleSubmit}>
|
|
193
|
+
<FormField
|
|
194
|
+
name="volume"
|
|
195
|
+
label="Volume Level"
|
|
196
|
+
required
|
|
197
|
+
>
|
|
198
|
+
<Slider
|
|
199
|
+
min={0}
|
|
200
|
+
max={100}
|
|
201
|
+
step={5}
|
|
202
|
+
showMin
|
|
203
|
+
showMax
|
|
204
|
+
showValueOnThumb
|
|
205
|
+
initialValue={50}
|
|
206
|
+
/>
|
|
207
|
+
</FormField>
|
|
208
|
+
|
|
209
|
+
<FormField
|
|
210
|
+
name="priceRange"
|
|
211
|
+
label="Price Range"
|
|
212
|
+
>
|
|
213
|
+
<Slider
|
|
214
|
+
min={0}
|
|
215
|
+
max={1000}
|
|
216
|
+
step={10}
|
|
217
|
+
enableRange
|
|
218
|
+
initialValue={[100, 800]}
|
|
219
|
+
showMin
|
|
220
|
+
showMax
|
|
221
|
+
/>
|
|
222
|
+
</FormField>
|
|
223
|
+
|
|
224
|
+
<FormField
|
|
225
|
+
name="difficulty"
|
|
226
|
+
label="Difficulty Level"
|
|
227
|
+
>
|
|
228
|
+
<Slider
|
|
229
|
+
min={1}
|
|
230
|
+
max={10}
|
|
231
|
+
step={1}
|
|
232
|
+
initialValue={5}
|
|
233
|
+
showValueOnThumb
|
|
234
|
+
/>
|
|
235
|
+
</FormField>
|
|
236
|
+
|
|
237
|
+
<Button type="submit">
|
|
238
|
+
Save Settings
|
|
239
|
+
</Button>
|
|
240
|
+
</Form>
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Price Range Filter
|
|
246
|
+
|
|
247
|
+
```tsx
|
|
248
|
+
import { Slider, Text } from '@delightui/components';
|
|
249
|
+
|
|
250
|
+
function PriceRangeFilterExample() {
|
|
251
|
+
const [priceRange, setPriceRange] = useState<[number, number]>([50, 500]);
|
|
252
|
+
|
|
253
|
+
const formatPrice = (value: number) => `$${value}`;
|
|
254
|
+
|
|
255
|
+
return (
|
|
256
|
+
<div style={{ padding: '20px', border: '1px solid #ccc', borderRadius: '8px' }}>
|
|
257
|
+
<Text weight="bold" style={{ marginBottom: '16px' }}>
|
|
258
|
+
Filter by Price
|
|
259
|
+
</Text>
|
|
260
|
+
|
|
261
|
+
<Text size="small" color="secondary" style={{ marginBottom: '12px' }}>
|
|
262
|
+
Price Range: {formatPrice(priceRange[0])} - {formatPrice(priceRange[1])}
|
|
263
|
+
</Text>
|
|
264
|
+
|
|
265
|
+
<Slider
|
|
266
|
+
value={priceRange}
|
|
267
|
+
onValueChange={setPriceRange}
|
|
268
|
+
min={0}
|
|
269
|
+
max={1000}
|
|
270
|
+
step={10}
|
|
271
|
+
enableRange
|
|
272
|
+
showMin
|
|
273
|
+
showMax
|
|
274
|
+
/>
|
|
275
|
+
|
|
276
|
+
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '8px' }}>
|
|
277
|
+
<Text size="small">Min: {formatPrice(priceRange[0])}</Text>
|
|
278
|
+
<Text size="small">Max: {formatPrice(priceRange[1])}</Text>
|
|
279
|
+
</div>
|
|
280
|
+
</div>
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Temperature Control
|
|
286
|
+
|
|
287
|
+
```tsx
|
|
288
|
+
import { Slider, Text } from '@delightui/components';
|
|
289
|
+
|
|
290
|
+
function TemperatureControlExample() {
|
|
291
|
+
const [temperature, setTemperature] = useState(72);
|
|
292
|
+
|
|
293
|
+
const getTemperatureColor = (temp: number) => {
|
|
294
|
+
if (temp < 60) return '#0066cc';
|
|
295
|
+
if (temp < 70) return '#00cc66';
|
|
296
|
+
if (temp < 80) return '#ffcc00';
|
|
297
|
+
return '#ff6600';
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
const getTemperatureLabel = (temp: number) => {
|
|
301
|
+
if (temp < 60) return 'Cool';
|
|
302
|
+
if (temp < 70) return 'Comfortable';
|
|
303
|
+
if (temp < 80) return 'Warm';
|
|
304
|
+
return 'Hot';
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
return (
|
|
308
|
+
<div style={{
|
|
309
|
+
padding: '20px',
|
|
310
|
+
border: '1px solid #ccc',
|
|
311
|
+
borderRadius: '8px',
|
|
312
|
+
backgroundColor: '#f8f9fa'
|
|
313
|
+
}}>
|
|
314
|
+
<Text weight="bold" style={{ marginBottom: '16px' }}>
|
|
315
|
+
Thermostat Control
|
|
316
|
+
</Text>
|
|
317
|
+
|
|
318
|
+
<div style={{ textAlign: 'center', marginBottom: '20px' }}>
|
|
319
|
+
<Text
|
|
320
|
+
size="xlarge"
|
|
321
|
+
weight="bold"
|
|
322
|
+
style={{ color: getTemperatureColor(temperature) }}
|
|
323
|
+
>
|
|
324
|
+
{temperature}°F
|
|
325
|
+
</Text>
|
|
326
|
+
<Text
|
|
327
|
+
size="small"
|
|
328
|
+
style={{
|
|
329
|
+
display: 'block',
|
|
330
|
+
color: getTemperatureColor(temperature),
|
|
331
|
+
marginTop: '4px'
|
|
332
|
+
}}
|
|
333
|
+
>
|
|
334
|
+
{getTemperatureLabel(temperature)}
|
|
335
|
+
</Text>
|
|
336
|
+
</div>
|
|
337
|
+
|
|
338
|
+
<Slider
|
|
339
|
+
value={temperature}
|
|
340
|
+
onValueChange={setTemperature}
|
|
341
|
+
min={50}
|
|
342
|
+
max={90}
|
|
343
|
+
step={1}
|
|
344
|
+
showMin
|
|
345
|
+
showMax
|
|
346
|
+
showValueOnThumb
|
|
347
|
+
/>
|
|
348
|
+
</div>
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### Audio Equalizer
|
|
354
|
+
|
|
355
|
+
```tsx
|
|
356
|
+
import { Slider, Text } from '@delightui/components';
|
|
357
|
+
|
|
358
|
+
function AudioEqualizerExample() {
|
|
359
|
+
const [frequencies, setFrequencies] = useState({
|
|
360
|
+
bass: 50,
|
|
361
|
+
midrange: 50,
|
|
362
|
+
treble: 50
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
const updateFrequency = (freq: string, value: number) => {
|
|
366
|
+
setFrequencies(prev => ({ ...prev, [freq]: value }));
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
return (
|
|
370
|
+
<div style={{
|
|
371
|
+
padding: '20px',
|
|
372
|
+
border: '1px solid #ccc',
|
|
373
|
+
borderRadius: '8px',
|
|
374
|
+
backgroundColor: '#1a1a1a',
|
|
375
|
+
color: 'white'
|
|
376
|
+
}}>
|
|
377
|
+
<Text weight="bold" style={{ marginBottom: '20px', color: 'white' }}>
|
|
378
|
+
Audio Equalizer
|
|
379
|
+
</Text>
|
|
380
|
+
|
|
381
|
+
<div style={{ display: 'flex', gap: '24px' }}>
|
|
382
|
+
<div style={{ flex: 1 }}>
|
|
383
|
+
<Text size="small" weight="medium" style={{ marginBottom: '8px', color: 'white' }}>
|
|
384
|
+
Bass
|
|
385
|
+
</Text>
|
|
386
|
+
<div style={{ height: '150px', display: 'flex', alignItems: 'center' }}>
|
|
387
|
+
<Slider
|
|
388
|
+
value={frequencies.bass}
|
|
389
|
+
onValueChange={(value) => updateFrequency('bass', value as number)}
|
|
390
|
+
min={0}
|
|
391
|
+
max={100}
|
|
392
|
+
step={1}
|
|
393
|
+
style={{ transform: 'rotate(-90deg)', width: '120px' }}
|
|
394
|
+
/>
|
|
395
|
+
</div>
|
|
396
|
+
<Text size="small" style={{ textAlign: 'center', color: '#ccc' }}>
|
|
397
|
+
{frequencies.bass}%
|
|
398
|
+
</Text>
|
|
399
|
+
</div>
|
|
400
|
+
|
|
401
|
+
<div style={{ flex: 1 }}>
|
|
402
|
+
<Text size="small" weight="medium" style={{ marginBottom: '8px', color: 'white' }}>
|
|
403
|
+
Midrange
|
|
404
|
+
</Text>
|
|
405
|
+
<div style={{ height: '150px', display: 'flex', alignItems: 'center' }}>
|
|
406
|
+
<Slider
|
|
407
|
+
value={frequencies.midrange}
|
|
408
|
+
onValueChange={(value) => updateFrequency('midrange', value as number)}
|
|
409
|
+
min={0}
|
|
410
|
+
max={100}
|
|
411
|
+
step={1}
|
|
412
|
+
style={{ transform: 'rotate(-90deg)', width: '120px' }}
|
|
413
|
+
/>
|
|
414
|
+
</div>
|
|
415
|
+
<Text size="small" style={{ textAlign: 'center', color: '#ccc' }}>
|
|
416
|
+
{frequencies.midrange}%
|
|
417
|
+
</Text>
|
|
418
|
+
</div>
|
|
419
|
+
|
|
420
|
+
<div style={{ flex: 1 }}>
|
|
421
|
+
<Text size="small" weight="medium" style={{ marginBottom: '8px', color: 'white' }}>
|
|
422
|
+
Treble
|
|
423
|
+
</Text>
|
|
424
|
+
<div style={{ height: '150px', display: 'flex', alignItems: 'center' }}>
|
|
425
|
+
<Slider
|
|
426
|
+
value={frequencies.treble}
|
|
427
|
+
onValueChange={(value) => updateFrequency('treble', value as number)}
|
|
428
|
+
min={0}
|
|
429
|
+
max={100}
|
|
430
|
+
step={1}
|
|
431
|
+
style={{ transform: 'rotate(-90deg)', width: '120px' }}
|
|
432
|
+
/>
|
|
433
|
+
</div>
|
|
434
|
+
<Text size="small" style={{ textAlign: 'center', color: '#ccc' }}>
|
|
435
|
+
{frequencies.treble}%
|
|
436
|
+
</Text>
|
|
437
|
+
</div>
|
|
438
|
+
</div>
|
|
439
|
+
</div>
|
|
440
|
+
);
|
|
441
|
+
}
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Age Range Selector
|
|
445
|
+
|
|
446
|
+
```tsx
|
|
447
|
+
import { Slider, Text } from '@delightui/components';
|
|
448
|
+
|
|
449
|
+
function AgeRangeSelectorExample() {
|
|
450
|
+
const [ageRange, setAgeRange] = useState<[number, number]>([18, 65]);
|
|
451
|
+
|
|
452
|
+
return (
|
|
453
|
+
<div style={{ padding: '20px', border: '1px solid #ccc', borderRadius: '8px' }}>
|
|
454
|
+
<Text weight="bold" style={{ marginBottom: '16px' }}>
|
|
455
|
+
Target Age Range
|
|
456
|
+
</Text>
|
|
457
|
+
|
|
458
|
+
<Text style={{ marginBottom: '12px' }}>
|
|
459
|
+
Ages {ageRange[0]} to {ageRange[1]} years old
|
|
460
|
+
</Text>
|
|
461
|
+
|
|
462
|
+
<Slider
|
|
463
|
+
value={ageRange}
|
|
464
|
+
onValueChange={setAgeRange}
|
|
465
|
+
min={13}
|
|
466
|
+
max={100}
|
|
467
|
+
step={1}
|
|
468
|
+
enableRange
|
|
469
|
+
showMin
|
|
470
|
+
showMax
|
|
471
|
+
/>
|
|
472
|
+
|
|
473
|
+
<div style={{ marginTop: '16px', display: 'flex', justifyContent: 'space-between' }}>
|
|
474
|
+
<div>
|
|
475
|
+
<Text size="small" color="secondary">Minimum Age</Text>
|
|
476
|
+
<Text weight="medium">{ageRange[0]}</Text>
|
|
477
|
+
</div>
|
|
478
|
+
<div style={{ textAlign: 'right' }}>
|
|
479
|
+
<Text size="small" color="secondary">Maximum Age</Text>
|
|
480
|
+
<Text weight="medium">{ageRange[1]}</Text>
|
|
481
|
+
</div>
|
|
482
|
+
</div>
|
|
483
|
+
</div>
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
### Disabled Slider
|
|
489
|
+
|
|
490
|
+
```tsx
|
|
491
|
+
import { Slider, Text } from '@delightui/components';
|
|
492
|
+
|
|
493
|
+
function DisabledSliderExample() {
|
|
494
|
+
return (
|
|
495
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '20px' }}>
|
|
496
|
+
<div>
|
|
497
|
+
<Text weight="bold" style={{ marginBottom: '8px' }}>
|
|
498
|
+
Enabled Slider
|
|
499
|
+
</Text>
|
|
500
|
+
<Slider
|
|
501
|
+
value={75}
|
|
502
|
+
min={0}
|
|
503
|
+
max={100}
|
|
504
|
+
showMin
|
|
505
|
+
showMax
|
|
506
|
+
showValueOnThumb
|
|
507
|
+
/>
|
|
508
|
+
</div>
|
|
509
|
+
|
|
510
|
+
<div>
|
|
511
|
+
<Text weight="bold" style={{ marginBottom: '8px' }}>
|
|
512
|
+
Disabled Slider
|
|
513
|
+
</Text>
|
|
514
|
+
<Slider
|
|
515
|
+
value={75}
|
|
516
|
+
min={0}
|
|
517
|
+
max={100}
|
|
518
|
+
disabled
|
|
519
|
+
showMin
|
|
520
|
+
showMax
|
|
521
|
+
showValueOnThumb
|
|
522
|
+
/>
|
|
523
|
+
</div>
|
|
524
|
+
|
|
525
|
+
<div>
|
|
526
|
+
<Text weight="bold" style={{ marginBottom: '8px' }}>
|
|
527
|
+
Disabled Range Slider
|
|
528
|
+
</Text>
|
|
529
|
+
<Slider
|
|
530
|
+
value={[25, 75]}
|
|
531
|
+
min={0}
|
|
532
|
+
max={100}
|
|
533
|
+
enableRange
|
|
534
|
+
disabled
|
|
535
|
+
showMin
|
|
536
|
+
showMax
|
|
537
|
+
/>
|
|
538
|
+
</div>
|
|
539
|
+
</div>
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
### Custom Range Example
|
|
545
|
+
|
|
546
|
+
```tsx
|
|
547
|
+
import { Slider, Text } from '@delightui/components';
|
|
548
|
+
|
|
549
|
+
function CustomRangeExample() {
|
|
550
|
+
const [value, setValue] = useState(2.5);
|
|
551
|
+
|
|
552
|
+
return (
|
|
553
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '20px' }}>
|
|
554
|
+
<div>
|
|
555
|
+
<Text weight="bold" style={{ marginBottom: '8px' }}>
|
|
556
|
+
Decimal Values (0.0 - 5.0)
|
|
557
|
+
</Text>
|
|
558
|
+
<Text size="small" color="secondary" style={{ marginBottom: '8px' }}>
|
|
559
|
+
Current: {value.toFixed(1)}
|
|
560
|
+
</Text>
|
|
561
|
+
<Slider
|
|
562
|
+
value={value}
|
|
563
|
+
onValueChange={setValue}
|
|
564
|
+
min={0}
|
|
565
|
+
max={5}
|
|
566
|
+
step={0.1}
|
|
567
|
+
showMin
|
|
568
|
+
showMax
|
|
569
|
+
showValueOnThumb
|
|
570
|
+
/>
|
|
571
|
+
</div>
|
|
572
|
+
|
|
573
|
+
<div>
|
|
574
|
+
<Text weight="bold" style={{ marginBottom: '8px' }}>
|
|
575
|
+
Large Range (0 - 10,000)
|
|
576
|
+
</Text>
|
|
577
|
+
<Slider
|
|
578
|
+
value={5000}
|
|
579
|
+
min={0}
|
|
580
|
+
max={10000}
|
|
581
|
+
step={100}
|
|
582
|
+
showMin
|
|
583
|
+
showMax
|
|
584
|
+
showValueOnThumb
|
|
585
|
+
/>
|
|
586
|
+
</div>
|
|
587
|
+
|
|
588
|
+
<div>
|
|
589
|
+
<Text weight="bold" style={{ marginBottom: '8px' }}>
|
|
590
|
+
Negative Range (-100 to 100)
|
|
591
|
+
</Text>
|
|
592
|
+
<Slider
|
|
593
|
+
value={0}
|
|
594
|
+
min={-100}
|
|
595
|
+
max={100}
|
|
596
|
+
step={5}
|
|
597
|
+
showMin
|
|
598
|
+
showMax
|
|
599
|
+
showValueOnThumb
|
|
600
|
+
/>
|
|
601
|
+
</div>
|
|
602
|
+
</div>
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
```
|