Skip to content

Commit aeb5301

Browse files
Merge pull request #52 from rhinobase/rc
fix(ui): added isReadOnly prop & improved isDisabled prop to form components
2 parents f2958a5 + eae0c92 commit aeb5301

File tree

179 files changed

+1710
-1347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+1710
-1347
lines changed

apps/docs/.storybook/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import path from "path";
1+
import path from "node:path";
22
import type { StorybookConfig } from "@storybook/react-vite";
33
import { mergeConfig } from "vite";
44

apps/docs/app/Wrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22
import { usePathname, useSearchParams } from "next/navigation";
3-
import { PropsWithChildren, useEffect, useState } from "react";
3+
import { type PropsWithChildren, useEffect, useState } from "react";
44
import { Hero } from "../components/Hero";
55
import { Layout } from "../components/Layout";
66
import { MobileNavigation } from "../components/MobileNavigation";

apps/docs/app/docs/components/radio/page.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ This component is built on top of [Radix Radio Group](https://www.radix-ui.com/p
126126
| ---------- | -------------------------------------------------------- | -------------------------- | ------- |
127127
| size | Size of the radio group component and its subcomponents. | `"sm"` or `"md"` or `"lg"` | `"md"` |
128128
| isDisabled | To manage disabled state. | `boolean` | `false` |
129+
| isReadOnly | To manage readonly state. | `boolean` | `false` |
129130

130131
### RadioGroupItem
131132

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
title: Slider
3+
nextjs:
4+
metadata:
5+
title: Slider
6+
description: An input where the user selects a value from within a given range.
7+
twitter:
8+
title: Slider
9+
images:
10+
url: https://rafty.rhinobase.io/api/og?title=Slider
11+
openGraph:
12+
title: Slider
13+
images:
14+
url: https://rafty.rhinobase.io/api/og?title=Slider
15+
---
16+
17+
An input where the user selects a value from within a given range.
18+
19+
This component is made on top of [Radix UIs Slider Component](https://www.radix-ui.com/primitives/docs/components/slider) with our styling conventions. This component has been shared with you, ensuring that all its native properties are accessible.
20+
21+
## Anatomy
22+
23+
Import the component.
24+
25+
```jsx
26+
import { Slider, SliderRange, SliderThumb, SliderTrack } from "@rafty/ui";
27+
28+
<Slider>
29+
<SliderTrack>
30+
<SliderRange />
31+
</SliderTrack>
32+
<SliderThumb />
33+
</Slider>;
34+
```
35+
36+
## ColorScheme
37+
38+
There are 5 `colorScheme` options in badge: `primary` (default), `secondary`, `error`, `info`, `success` & `warning`.
39+
40+
{% example %}
41+
42+
```jsx
43+
<Slider colorScheme="secondary" defaultValue={[20]}>
44+
<SliderTrack>
45+
<SliderRange />
46+
</SliderTrack>
47+
<SliderThumb />
48+
</Slider>
49+
```
50+
51+
{% /example %}
52+
53+
## Size
54+
55+
There are 3 `size` options available: `sm`, `md` (default) & `lg`
56+
57+
{% example %}
58+
59+
```jsx
60+
<Slider size="sm" defaultValue={[20]}>
61+
<SliderTrack>
62+
<SliderRange />
63+
</SliderTrack>
64+
<SliderThumb />
65+
</Slider>
66+
```
67+
68+
{% /example %}
69+
70+
## Range Slider
71+
72+
Slider accepts value in array and returns value in array in `onValueChange` function, so it can be used as `Range Slider`. You just need to pass more than one values in `value` and `defaultValue` props and put the same number of `<SliderThumb />`.
73+
74+
{% example %}
75+
76+
```jsx
77+
<Slider defaultValue={[20, 80]}>
78+
<SliderTrack>
79+
<SliderRange />
80+
</SliderTrack>
81+
<SliderThumb />
82+
<SliderThumb />
83+
</Slider>
84+
```
85+
86+
{% /example %}
87+
88+
## Props
89+
90+
---
91+
92+
### Slider
93+
94+
This component is built on top of [Radix Slider](https://www.radix-ui.com/primitives/docs/components/slider#root).
95+
96+
| Property | Description | Type | Default |
97+
| ----------- | ------------------------------------- | ----------------------------------------------------------------------------------- | ----------- |
98+
| size | Size of the Slider component. | `"sm"` or `"md"` or `"lg"` | `"md"` |
99+
| colorScheme | Color Scheme of the Slider component. | `"primary"` or `"secondary"` or `"error"` or `"success"` or `"warning"` or `"info"` | `"primary"` |
100+
| isDisabled | To manage disabled state. | `boolean` | `false` |
101+
| isReadOnly | To manage readonly state. | `boolean` | `false` |
102+
103+
### SliderTrack
104+
105+
This component is built on top of [Radix Slider Track](https://www.radix-ui.com/primitives/docs/components/slider#track).
106+
107+
### SliderRange
108+
109+
This component is built on top of [Radix Slider Range](https://www.radix-ui.com/primitives/docs/components/slider#range).
110+
111+
### SliderThumb
112+
113+
This component is built on top of [Radix Slider Thumb](https://www.radix-ui.com/primitives/docs/components/slider#thumb).

apps/docs/app/docs/examples/ExampleCodeRepo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Image, { StaticImageData } from "next/image";
1+
import Image, { type StaticImageData } from "next/image";
22
import Link from "next/link";
33
import { Fragment } from "react";
44
import NextjsIcon from "../../../public/frameworks/nextjs.svg";

apps/docs/app/docs/examples/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Metadata } from "next";
1+
import type { Metadata } from "next";
22
import { DocsLayout } from "../../../components/DocsLayout";
33
import { ExampleCodeRepo } from "./ExampleCodeRepo";
44

apps/docs/app/docs/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PropsWithChildren } from "react";
1+
import type { PropsWithChildren } from "react";
22
import { Layout } from "../../components/Layout";
33

44
export default function DocsLayout({ children }: PropsWithChildren) {

apps/docs/app/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { GoogleAnalytics } from "@next/third-parties/google";
22
import { classNames } from "@rafty/ui";
3-
import { type Metadata } from "next";
3+
import type { Metadata } from "next";
44
import { Inter } from "next/font/google";
55
import localFont from "next/font/local";
66
import type { PropsWithChildren } from "react";

apps/docs/app/providers.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22
import { ThemeProvider } from "next-themes";
3-
import { PropsWithChildren } from "react";
3+
import type { PropsWithChildren } from "react";
44

55
export function Providers({ children }: PropsWithChildren) {
66
return (

apps/docs/app/sitemap.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import path from "path";
1+
import path from "node:path";
22
import glob from "fast-glob";
3-
import { MetadataRoute } from "next";
3+
import type { MetadataRoute } from "next";
44

55
export default function sitemap(): MetadataRoute.Sitemap {
66
const pagesDir = path.resolve("./app");

0 commit comments

Comments
 (0)