@rovula/ui 0.0.71 → 0.0.72

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.
@@ -1,5 +1,13 @@
1
1
  import * as React from "react";
2
2
  import * as SliderPrimitive from "@radix-ui/react-slider";
3
- declare const Slider: React.ForwardRefExoticComponent<Omit<SliderPrimitive.SliderProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
3
+ export interface CustomSliderProps extends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {
4
+ trackClassName?: string;
5
+ rangeClassName?: string;
6
+ thumbClassName?: string;
7
+ trackStyle?: React.CSSProperties;
8
+ thumbStyle?: React.CSSProperties;
9
+ rangeStyle?: React.CSSProperties;
10
+ }
11
+ declare const Slider: React.ForwardRefExoticComponent<CustomSliderProps & React.RefAttributes<HTMLSpanElement>>;
4
12
  export type SliderProps = React.ComponentProps<typeof Slider>;
5
13
  export { Slider };
@@ -1,12 +1,19 @@
1
1
  import React from "react";
2
+ import type { StoryObj } from "@storybook/react";
2
3
  declare const meta: {
3
4
  title: string;
4
- component: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-slider").SliderProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
5
+ component: React.ForwardRefExoticComponent<import("./Slider").CustomSliderProps & React.RefAttributes<HTMLSpanElement>>;
5
6
  tags: string[];
6
7
  parameters: {
7
8
  layout: string;
8
9
  };
9
10
  decorators: ((Story: import("@storybook/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
11
+ trackClassName?: string | undefined;
12
+ rangeClassName?: string | undefined;
13
+ thumbClassName?: string | undefined;
14
+ trackStyle?: React.CSSProperties | undefined;
15
+ thumbStyle?: React.CSSProperties | undefined;
16
+ rangeStyle?: React.CSSProperties | undefined;
10
17
  suppressHydrationWarning?: boolean | undefined | undefined;
11
18
  className?: string | undefined | undefined;
12
19
  color?: string | undefined | undefined;
@@ -303,3 +310,4 @@ export declare const Default: {
303
310
  };
304
311
  render: (args: {}) => import("react/jsx-runtime").JSX.Element;
305
312
  };
313
+ export declare const GradientColor: StoryObj;
package/dist/index.d.ts CHANGED
@@ -506,7 +506,15 @@ declare const InputFilter: React__default.ForwardRefExoticComponent<{
506
506
  }) => ReactNode;
507
507
  } & Omit<InputProps, "onSelect" | "value"> & React__default.RefAttributes<HTMLInputElement>>;
508
508
 
509
- declare const Slider: React.ForwardRefExoticComponent<Omit<SliderPrimitive.SliderProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
509
+ interface CustomSliderProps extends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {
510
+ trackClassName?: string;
511
+ rangeClassName?: string;
512
+ thumbClassName?: string;
513
+ trackStyle?: React.CSSProperties;
514
+ thumbStyle?: React.CSSProperties;
515
+ rangeStyle?: React.CSSProperties;
516
+ }
517
+ declare const Slider: React.ForwardRefExoticComponent<CustomSliderProps & React.RefAttributes<HTMLSpanElement>>;
510
518
  type SliderProps = React.ComponentProps<typeof Slider>;
511
519
 
512
520
  declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -760,4 +768,4 @@ declare function usePrevious<T>(value: T): T | undefined;
760
768
 
761
769
  declare function cn(...inputs: ClassValue[]): string;
762
770
 
763
- export { ActionButton, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Button, type ButtonProps, Calendar, Checkbox, Collapsible, DataTable, type DataTableProps, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Dropdown, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type DropdownProps, FocusedScrollView, Icon, Input, InputFilter, type InputFilterProps, type InputProps, Label, Loading, Navbar, type NavbarProps, type Options$1 as Options, Popover, PopoverContent, PopoverTrigger, ProgressBar, Search, type SearchProps, Slider, type SliderProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, Text, TextInput, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipSimple, TooltipTrigger, Tree, type TreeData, TreeItem, type TreeItemProps, type TreeProps, cn, getEndDateOfDay, getStartDateOfDay, getStartEndTimestampOfDay, getTimestampUTC, reducer, resloveTimestamp, toast, usePrevious, useToast };
771
+ export { ActionButton, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Button, type ButtonProps, Calendar, Checkbox, Collapsible, type CustomSliderProps, DataTable, type DataTableProps, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Dropdown, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type DropdownProps, FocusedScrollView, Icon, Input, InputFilter, type InputFilterProps, type InputProps, Label, Loading, Navbar, type NavbarProps, type Options$1 as Options, Popover, PopoverContent, PopoverTrigger, ProgressBar, Search, type SearchProps, Slider, type SliderProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, Text, TextInput, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipSimple, TooltipTrigger, Tree, type TreeData, TreeItem, type TreeItemProps, type TreeProps, cn, getEndDateOfDay, getStartDateOfDay, getStartEndTimestampOfDay, getTimestampUTC, reducer, resloveTimestamp, toast, usePrevious, useToast };
@@ -2559,6 +2559,10 @@ input[type=number] {
2559
2559
  height: 100%;
2560
2560
  }
2561
2561
 
2562
+ .h-1 {
2563
+ height: 0.25rem;
2564
+ }
2565
+
2562
2566
  .h-1\/2 {
2563
2567
  height: 50%;
2564
2568
  }
@@ -3002,6 +3006,12 @@ input[type=number] {
3002
3006
  margin-bottom: calc(1rem * var(--tw-space-y-reverse));
3003
3007
  }
3004
3008
 
3009
+ .space-y-8 > :not([hidden]) ~ :not([hidden]) {
3010
+ --tw-space-y-reverse: 0;
3011
+ margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));
3012
+ margin-bottom: calc(2rem * var(--tw-space-y-reverse));
3013
+ }
3014
+
3005
3015
  .self-center {
3006
3016
  align-self: center;
3007
3017
  }
@@ -3392,6 +3402,11 @@ input[type=number] {
3392
3402
  border-color: color-mix(in srgb, var(--state-color-warning-stroke) calc(100% * var(--tw-border-opacity, 1)), transparent);
3393
3403
  }
3394
3404
 
3405
+ .border-white {
3406
+ --tw-border-opacity: 1;
3407
+ border-color: rgb(255 255 255 / var(--tw-border-opacity, 1));
3408
+ }
3409
+
3395
3410
  .border-b-\[rgb\(var\(--navbar-border-color\)\)\] {
3396
3411
  border-bottom-color: rgb(var(--navbar-border-color));
3397
3412
  }
@@ -4945,6 +4960,30 @@ input[type=number] {
4945
4960
  background-color: color-mix(in srgb, var(--other-transparency-white-8) calc(100% * var(--tw-bg-opacity, 1)), transparent);
4946
4961
  }
4947
4962
 
4963
+ .bg-gradient-to-r {
4964
+ background-image: linear-gradient(to right, var(--tw-gradient-stops));
4965
+ }
4966
+
4967
+ .from-\[\#848484\] {
4968
+ --tw-gradient-from: #848484 var(--tw-gradient-from-position);
4969
+ --tw-gradient-to: rgb(132 132 132 / 0) var(--tw-gradient-to-position);
4970
+ --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
4971
+ }
4972
+
4973
+ .from-black {
4974
+ --tw-gradient-from: #000 var(--tw-gradient-from-position);
4975
+ --tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);
4976
+ --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
4977
+ }
4978
+
4979
+ .to-\[\#A00202\] {
4980
+ --tw-gradient-to: #A00202 var(--tw-gradient-to-position);
4981
+ }
4982
+
4983
+ .to-white {
4984
+ --tw-gradient-to: #fff var(--tw-gradient-to-position);
4985
+ }
4986
+
4948
4987
  .fill-action-button-icon-active {
4949
4988
  fill: color-mix(in srgb, var(--action-button-icon-active-text) calc(100% * 1), transparent);
4950
4989
  }
@@ -6023,11 +6062,6 @@ input[type=number] {
6023
6062
  --tw-ring-color: color-mix(in srgb, var(--input-color-error) calc(100% * var(--tw-ring-opacity, 1)), transparent);
6024
6063
  }
6025
6064
 
6026
- .ring-primary {
6027
- --tw-ring-opacity: 1;
6028
- --tw-ring-color: color-mix(in srgb, var(--state-color-primary-default) calc(100% * var(--tw-ring-opacity, 1)), transparent);
6029
- }
6030
-
6031
6065
  .ring-offset-background {
6032
6066
  --tw-ring-offset-color: color-mix(in srgb, var(--background) calc(100% * 1), transparent);
6033
6067
  }
@@ -6037,6 +6071,11 @@ input[type=number] {
6037
6071
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
6038
6072
  }
6039
6073
 
6074
+ .drop-shadow {
6075
+ --tw-drop-shadow: drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06));
6076
+ filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
6077
+ }
6078
+
6040
6079
  .filter {
6041
6080
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
6042
6081
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rovula/ui",
3
- "version": "0.0.71",
3
+ "version": "0.0.72",
4
4
  "main": "dist/cjs/bundle.js",
5
5
  "module": "dist/esm/bundle.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { useState } from "react";
2
2
  import type { Meta, StoryObj } from "@storybook/react";
3
3
  import { Slider } from "./Slider";
4
4
 
@@ -13,7 +13,7 @@ const meta = {
13
13
  },
14
14
  decorators: [
15
15
  (Story) => (
16
- <div className="p-5 flex w-full">
16
+ <div className="p-5 flex w-full bg-background">
17
17
  <Story />
18
18
  </div>
19
19
  ),
@@ -45,3 +45,84 @@ export const Default = {
45
45
  );
46
46
  },
47
47
  } satisfies StoryObj;
48
+
49
+ export const GradientColor: StoryObj = {
50
+ render: () => {
51
+ const [exposure, setExposure] = useState([50]);
52
+ const [empty, setEmpty] = useState([50]);
53
+ const [rainbow, setRainbow] = useState([50]);
54
+ const [darkRed, setDarkRed] = useState([50]);
55
+
56
+ return (
57
+ <div className="w-[400px] p-6 space-y-8 rounded-md shadow-lg bg-surface">
58
+ {/* Exposure (Black to White) */}
59
+ <Slider
60
+ value={exposure}
61
+ onValueChange={setExposure}
62
+ className="bg-grey-transparent-24"
63
+ trackClassName="h-1 rounded-full bg-grey-transparent-24 bg-gradient-to-r from-black to-white"
64
+ rangeClassName="bg-unset"
65
+ thumbClassName="bg-white border border-white shadow"
66
+ thumbStyle={{
67
+ filter: "drop-shadow(0px 6px 12px rgba(0, 0, 0, 0.12))",
68
+ }}
69
+ min={0}
70
+ max={100}
71
+ step={1}
72
+ />
73
+
74
+ {/* Empty (no gradient) */}
75
+ <Slider
76
+ value={empty}
77
+ onValueChange={setEmpty}
78
+ className="bg-grey-transparent-24"
79
+ trackClassName="h-1 rounded-full bg-grey-transparent-24"
80
+ rangeClassName="bg-unset"
81
+ thumbClassName="bg-white border border-white shadow"
82
+ thumbStyle={{
83
+ filter: "drop-shadow(0px 6px 12px rgba(0, 0, 0, 0.12))",
84
+ }}
85
+ min={0}
86
+ max={100}
87
+ step={1}
88
+ />
89
+
90
+ {/* Rainbow (custom linear-gradient via style) */}
91
+ <Slider
92
+ value={rainbow}
93
+ onValueChange={setRainbow}
94
+ className="bg-grey-transparent-24"
95
+ trackClassName="h-1 rounded-full bg-grey-transparent-24"
96
+ trackStyle={{
97
+ backgroundImage:
98
+ "linear-gradient(90deg, #F00 0%, #FF8502 11.54%, #F2FF05 23.08%, #06F90F 35.58%, #00E6FF 48.56%, #0404FF 61.54%, #AB02FF 74.52%, #FF069E 87.5%, #FF0408 100%)",
99
+ }}
100
+ rangeClassName="bg-unset"
101
+ thumbClassName="bg-white border border-white shadow"
102
+ thumbStyle={{
103
+ filter: "drop-shadow(0px 6px 12px rgba(0, 0, 0, 0.12))",
104
+ }}
105
+ min={0}
106
+ max={100}
107
+ step={1}
108
+ />
109
+
110
+ {/* Dark Red Gradient */}
111
+ <Slider
112
+ value={darkRed}
113
+ onValueChange={setDarkRed}
114
+ className="bg-grey-transparent-24"
115
+ trackClassName="h-1 rounded-full bg-grey-transparent-24 bg-gradient-to-r from-[#848484] to-[#A00202]"
116
+ rangeClassName="bg-unset"
117
+ thumbClassName="bg-white border border-white shadow"
118
+ thumbStyle={{
119
+ filter: "drop-shadow(0px 6px 12px rgba(0, 0, 0, 0.12))",
120
+ }}
121
+ min={0}
122
+ max={100}
123
+ step={1}
124
+ />
125
+ </div>
126
+ );
127
+ },
128
+ };
@@ -2,30 +2,67 @@
2
2
 
3
3
  import * as React from "react";
4
4
  import * as SliderPrimitive from "@radix-ui/react-slider";
5
-
6
5
  import { cn } from "@/utils/cn";
7
6
 
7
+ export interface CustomSliderProps
8
+ extends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {
9
+ trackClassName?: string;
10
+ rangeClassName?: string;
11
+ thumbClassName?: string;
12
+ trackStyle?: React.CSSProperties;
13
+ thumbStyle?: React.CSSProperties;
14
+ rangeStyle?: React.CSSProperties;
15
+ }
16
+
8
17
  const Slider = React.forwardRef<
9
18
  React.ElementRef<typeof SliderPrimitive.Root>,
10
- React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
11
- >(({ className, ...props }, ref) => (
12
- <SliderPrimitive.Root
13
- ref={ref}
14
- className={cn(
15
- "relative flex w-full touch-none select-none items-center",
16
- className
17
- )}
18
- {...props}
19
- >
20
- <SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full bg-grey-50">
21
- <SliderPrimitive.Range className="absolute h-full bg-primary" />
22
- </SliderPrimitive.Track>
23
- {/* <SliderPrimitive.Thumb className="block cursor-pointer h-5 w-5 rounded-full border-[3px] border-primary bg-background ring-offset-background ring-primary transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" /> */}
24
- <SliderPrimitive.Thumb className="block cursor-pointer h-5 w-5 rounded-full border-[3px] border-primary bg-background ring-0 outline-none disabled:pointer-events-none disabled:opacity-50" />
25
- </SliderPrimitive.Root>
26
- ));
19
+ CustomSliderProps
20
+ >(
21
+ (
22
+ {
23
+ className,
24
+ trackClassName,
25
+ rangeClassName,
26
+ thumbClassName,
27
+ thumbStyle,
28
+ trackStyle,
29
+ rangeStyle,
30
+ ...props
31
+ },
32
+ ref
33
+ ) => (
34
+ <SliderPrimitive.Root
35
+ ref={ref}
36
+ className={cn(
37
+ "relative flex w-full touch-none select-none items-center",
38
+ className
39
+ )}
40
+ {...props}
41
+ >
42
+ <SliderPrimitive.Track
43
+ className={cn(
44
+ "relative h-2 w-full grow overflow-hidden rounded-full bg-grey-50",
45
+ trackClassName
46
+ )}
47
+ style={trackStyle}
48
+ >
49
+ <SliderPrimitive.Range
50
+ className={cn("absolute h-full bg-primary", rangeClassName)}
51
+ style={rangeStyle}
52
+ />
53
+ </SliderPrimitive.Track>
54
+ <SliderPrimitive.Thumb
55
+ className={cn(
56
+ "block h-5 w-5 cursor-pointer rounded-full border-[3px] border-primary bg-background outline-none ring-0 transition-colors disabled:pointer-events-none disabled:opacity-50",
57
+ thumbClassName
58
+ )}
59
+ style={thumbStyle}
60
+ />
61
+ </SliderPrimitive.Root>
62
+ )
63
+ );
64
+
27
65
  Slider.displayName = SliderPrimitive.Root.displayName;
28
66
 
29
67
  export type SliderProps = React.ComponentProps<typeof Slider>;
30
-
31
68
  export { Slider };