@djangocfg/ui-core 2.1.207 → 2.1.209
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/package.json +4 -4
- package/src/components/slider.story.tsx +21 -0
- package/src/components/slider.tsx +32 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/ui-core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.209",
|
|
4
4
|
"description": "Pure React UI component library without Next.js dependencies - for Electron, Vite, CRA apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui-components",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"playground": "playground dev"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
|
-
"@djangocfg/i18n": "^2.1.
|
|
84
|
+
"@djangocfg/i18n": "^2.1.209",
|
|
85
85
|
"react-device-detect": "^2.2.3",
|
|
86
86
|
"consola": "^3.4.2",
|
|
87
87
|
"lucide-react": "^0.545.0",
|
|
@@ -143,9 +143,9 @@
|
|
|
143
143
|
"vaul": "1.1.2"
|
|
144
144
|
},
|
|
145
145
|
"devDependencies": {
|
|
146
|
-
"@djangocfg/i18n": "^2.1.
|
|
146
|
+
"@djangocfg/i18n": "^2.1.209",
|
|
147
147
|
"@djangocfg/playground": "workspace:*",
|
|
148
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
148
|
+
"@djangocfg/typescript-config": "^2.1.209",
|
|
149
149
|
"@types/node": "^24.7.2",
|
|
150
150
|
"@types/react": "^19.1.0",
|
|
151
151
|
"@types/react-dom": "^19.1.0",
|
|
@@ -111,3 +111,24 @@ export const Disabled = () => (
|
|
|
111
111
|
<Slider defaultValue={[50]} max={100} disabled />
|
|
112
112
|
</div>
|
|
113
113
|
);
|
|
114
|
+
|
|
115
|
+
export const Vertical = () => {
|
|
116
|
+
const [value, setValue] = useState([70]);
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<div className="flex items-start gap-8">
|
|
120
|
+
<div className="flex flex-col items-center gap-2">
|
|
121
|
+
<span className="text-sm text-muted-foreground">{value[0]}%</span>
|
|
122
|
+
<Slider
|
|
123
|
+
orientation="vertical"
|
|
124
|
+
value={value}
|
|
125
|
+
onValueChange={setValue}
|
|
126
|
+
max={100}
|
|
127
|
+
step={5}
|
|
128
|
+
className="h-32"
|
|
129
|
+
/>
|
|
130
|
+
<Label>Volume</Label>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
);
|
|
134
|
+
};
|
|
@@ -9,21 +9,38 @@ import { cn } from '../lib/utils';
|
|
|
9
9
|
const Slider = React.forwardRef<
|
|
10
10
|
React.ElementRef<typeof SliderPrimitive.Root>,
|
|
11
11
|
React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
|
|
12
|
-
>(({ className, ...props }, ref) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
>(({ className, orientation = 'horizontal', ...props }, ref) => {
|
|
13
|
+
const isVertical = orientation === 'vertical';
|
|
14
|
+
return (
|
|
15
|
+
<SliderPrimitive.Root
|
|
16
|
+
ref={ref}
|
|
17
|
+
orientation={orientation}
|
|
18
|
+
className={cn(
|
|
19
|
+
"relative flex touch-none select-none",
|
|
20
|
+
isVertical
|
|
21
|
+
? "flex-col items-center"
|
|
22
|
+
: "flex-row items-center w-full",
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
>
|
|
27
|
+
<SliderPrimitive.Track
|
|
28
|
+
className={cn(
|
|
29
|
+
"relative overflow-hidden rounded-full bg-primary/20",
|
|
30
|
+
isVertical ? "w-1.5 h-full grow" : "h-1.5 w-full grow"
|
|
31
|
+
)}
|
|
32
|
+
>
|
|
33
|
+
<SliderPrimitive.Range
|
|
34
|
+
className={cn(
|
|
35
|
+
"absolute bg-primary",
|
|
36
|
+
isVertical ? "w-full bottom-0" : "h-full left-0"
|
|
37
|
+
)}
|
|
38
|
+
/>
|
|
39
|
+
</SliderPrimitive.Track>
|
|
40
|
+
<SliderPrimitive.Thumb className="block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50" />
|
|
41
|
+
</SliderPrimitive.Root>
|
|
42
|
+
);
|
|
43
|
+
})
|
|
27
44
|
Slider.displayName = SliderPrimitive.Root.displayName
|
|
28
45
|
|
|
29
46
|
export { Slider }
|