aural-ui 2.1.1 → 2.1.2
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.
|
@@ -29,7 +29,7 @@ A customizable range slider component built with Radix UI primitives and design
|
|
|
29
29
|
- **Orientation Support**: Horizontal and vertical orientations
|
|
30
30
|
- **Range & Single Value**: Support for both single value and range selection
|
|
31
31
|
- **Label Display**: Configurable thumb labels with custom text or values
|
|
32
|
-
- **
|
|
32
|
+
- **Align Thumb**: Optional thumb alignment
|
|
33
33
|
- **Accessibility**: Built with Radix UI for keyboard navigation and screen reader support
|
|
34
34
|
- **Custom Styling**: Flexible class override system for complete customization
|
|
35
35
|
- **Touch Support**: Touch-friendly interaction on mobile devices
|
|
@@ -51,7 +51,7 @@ interface SliderProps extends React.ComponentProps<typeof SliderPrimitive.Root>
|
|
|
51
51
|
size?: "sm" | "md" | "lg"
|
|
52
52
|
showLabel?: boolean // Show/hide thumb labels
|
|
53
53
|
label?: string // Custom label text (overrides value display)
|
|
54
|
-
|
|
54
|
+
alignThumb?: "bottom" | "top" | "center" // align thumb alignment
|
|
55
55
|
classes?: {
|
|
56
56
|
root?: string // Override root container styles
|
|
57
57
|
track?: string // Override track background styles
|
|
@@ -68,8 +68,8 @@ interface SliderProps extends React.ComponentProps<typeof SliderPrimitive.Root>
|
|
|
68
68
|
- **label**: Custom text to display instead of values
|
|
69
69
|
- **Value Display**: Automatic value display when no custom label provided
|
|
70
70
|
|
|
71
|
-
###
|
|
72
|
-
- **
|
|
71
|
+
### Align Thumb
|
|
72
|
+
- **alignThumb**: Optional centered positioning for thumbs
|
|
73
73
|
- **Track Alignment**: Conditional styling for track-thumb alignment
|
|
74
74
|
|
|
75
75
|
### Enhanced Styling
|
|
@@ -106,11 +106,11 @@ interface SliderProps extends React.ComponentProps<typeof SliderPrimitive.Root>
|
|
|
106
106
|
/>
|
|
107
107
|
\`\`\`
|
|
108
108
|
|
|
109
|
-
###
|
|
109
|
+
### Align Thumb
|
|
110
110
|
\`\`\`tsx
|
|
111
111
|
<Slider
|
|
112
112
|
defaultValue={[60]}
|
|
113
|
-
|
|
113
|
+
alignThumb={"top"}
|
|
114
114
|
/>
|
|
115
115
|
\`\`\`
|
|
116
116
|
|
|
@@ -157,9 +157,10 @@ interface SliderProps extends React.ComponentProps<typeof SliderPrimitive.Root>
|
|
|
157
157
|
control: "text",
|
|
158
158
|
description: "Custom label text (overrides value display)",
|
|
159
159
|
},
|
|
160
|
-
|
|
161
|
-
control: "
|
|
162
|
-
|
|
160
|
+
alignThumb: {
|
|
161
|
+
control: "select",
|
|
162
|
+
options: ["bottom", "top", "center"],
|
|
163
|
+
description: "Thumb alignment",
|
|
163
164
|
},
|
|
164
165
|
orientation: {
|
|
165
166
|
control: "select",
|
|
@@ -373,50 +374,50 @@ export const Sizes: Story = {
|
|
|
373
374
|
),
|
|
374
375
|
}
|
|
375
376
|
|
|
376
|
-
// 5.
|
|
377
|
-
export const
|
|
377
|
+
// 5. Align Thumb
|
|
378
|
+
export const AlignThumb: Story = {
|
|
378
379
|
render: () => (
|
|
379
380
|
<div className="w-80 space-y-6 p-8">
|
|
380
381
|
<div className="mb-6">
|
|
381
|
-
<h3 className="mb-2 text-lg font-medium text-white">
|
|
382
|
+
<h3 className="mb-2 text-lg font-medium text-white">Align Thumb</h3>
|
|
382
383
|
<p className="text-fm-secondary text-sm">
|
|
383
|
-
Compare default and
|
|
384
|
+
Compare default, centered and top thumb alignment
|
|
384
385
|
</p>
|
|
385
386
|
</div>
|
|
386
387
|
|
|
387
388
|
<div className="space-y-6">
|
|
388
389
|
<div>
|
|
389
390
|
<label className="mb-2 block text-sm font-medium text-white">
|
|
390
|
-
Default
|
|
391
|
+
Default alignment
|
|
391
392
|
</label>
|
|
392
393
|
<Slider
|
|
393
394
|
defaultValue={[50]}
|
|
394
395
|
variant="primary"
|
|
395
|
-
|
|
396
|
+
alignThumb={"bottom"}
|
|
396
397
|
showLabel={true}
|
|
397
398
|
/>
|
|
398
399
|
</div>
|
|
399
400
|
|
|
400
401
|
<div>
|
|
401
402
|
<label className="mb-2 block text-sm font-medium text-white">
|
|
402
|
-
Centered
|
|
403
|
+
Centered Thumb
|
|
403
404
|
</label>
|
|
404
405
|
<Slider
|
|
405
406
|
defaultValue={[50]}
|
|
406
407
|
variant="primary"
|
|
407
|
-
|
|
408
|
+
alignThumb={"center"}
|
|
408
409
|
showLabel={true}
|
|
409
410
|
/>
|
|
410
411
|
</div>
|
|
411
412
|
|
|
412
413
|
<div>
|
|
413
|
-
<label className="mb-
|
|
414
|
-
|
|
414
|
+
<label className="mb-5 block text-sm font-medium text-white">
|
|
415
|
+
Top Thumbs
|
|
415
416
|
</label>
|
|
416
417
|
<Slider
|
|
417
|
-
defaultValue={[
|
|
418
|
+
defaultValue={[50]}
|
|
418
419
|
variant="positive"
|
|
419
|
-
|
|
420
|
+
alignThumb={"top"}
|
|
420
421
|
showLabel={true}
|
|
421
422
|
/>
|
|
422
423
|
</div>
|
|
@@ -800,7 +801,7 @@ export const CompleteShowcase: Story = {
|
|
|
800
801
|
max={30}
|
|
801
802
|
size="lg"
|
|
802
803
|
showLabel={true}
|
|
803
|
-
|
|
804
|
+
alignThumb={"center"}
|
|
804
805
|
/>
|
|
805
806
|
</div>
|
|
806
807
|
</div>
|
|
@@ -69,7 +69,7 @@ interface SliderProps
|
|
|
69
69
|
size?: "sm" | "md" | "lg"
|
|
70
70
|
showLabel?: boolean
|
|
71
71
|
label?: string
|
|
72
|
-
|
|
72
|
+
alignThumb?: "center" | "bottom" | "top"
|
|
73
73
|
classes?: {
|
|
74
74
|
root?: string
|
|
75
75
|
track?: string
|
|
@@ -88,7 +88,7 @@ function Slider({
|
|
|
88
88
|
max = 100,
|
|
89
89
|
showLabel = true,
|
|
90
90
|
label,
|
|
91
|
-
|
|
91
|
+
alignThumb = "bottom",
|
|
92
92
|
classes = {},
|
|
93
93
|
...props
|
|
94
94
|
}: SliderProps) {
|
|
@@ -120,7 +120,13 @@ function Slider({
|
|
|
120
120
|
data-slot="slider-track"
|
|
121
121
|
className={cn(
|
|
122
122
|
"bg-fm-surface-tertiary/40 relative grow overflow-hidden data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full",
|
|
123
|
-
{
|
|
123
|
+
{
|
|
124
|
+
"data-[orientation=horizontal]:[&_~_span]:-top-3.5":
|
|
125
|
+
alignThumb === "top",
|
|
126
|
+
"data-[orientation=horizontal]:[&_~_span]:top-0":
|
|
127
|
+
alignThumb === "bottom",
|
|
128
|
+
},
|
|
129
|
+
|
|
124
130
|
sliderSizeVariants({ size }),
|
|
125
131
|
classes?.track
|
|
126
132
|
)}
|