alope-ui 1.1.3 → 1.1.5
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 +580 -446
- package/dist/components/Avatar/Avatar.d.ts +38 -0
- package/dist/components/Avatar/AvatarGroup.d.ts +10 -0
- package/dist/components/FileUpload/FIleUpload.d.ts +14 -0
- package/dist/components/Pagination/Pagination.d.ts +22 -0
- package/dist/components/Skeleton/Skeleton.d.ts +10 -0
- package/dist/components/Spinner/Spinner.d.ts +23 -0
- package/dist/components/Table/Table.d.ts +34 -0
- package/dist/components/Tabs/Tabs.d.ts +57 -0
- package/dist/components/Textarea/Textarea.d.ts +8 -0
- package/dist/components/Toggle/Toggle.d.ts +27 -0
- package/dist/components/Tooltip/Tooltip.d.ts +14 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/index.css +1 -1
- package/dist/main.cjs +339 -287
- package/dist/main.d.ts +11 -0
- package/package.json +14 -1
package/README.md
CHANGED
|
@@ -1727,21 +1727,21 @@ import { Pagination } from "alope-ui";
|
|
|
1727
1727
|
|
|
1728
1728
|
### Props
|
|
1729
1729
|
|
|
1730
|
-
| Prop
|
|
1731
|
-
|
|
|
1732
|
-
| `currentPage`
|
|
1733
|
-
| `onPageChange`
|
|
1734
|
-
| `count`
|
|
1735
|
-
| `pageSize`
|
|
1736
|
-
| `totalPages`
|
|
1737
|
-
| `format`
|
|
1738
|
-
| `simplified`
|
|
1739
|
-
| `asLink`
|
|
1740
|
-
| `getPageHref`
|
|
1741
|
-
| `siblingCount`
|
|
1742
|
-
| `prevIcon`
|
|
1743
|
-
| `nextIcon`
|
|
1744
|
-
| `size`
|
|
1730
|
+
| Prop | Type | Default | Description |
|
|
1731
|
+
| -------------- | -------------------------- | ----------- | -------------------------------------------------------- |
|
|
1732
|
+
| `currentPage` | `number` | `required` | Current active page number |
|
|
1733
|
+
| `onPageChange` | `(page: number) => void` | `required` | Callback function when page changes |
|
|
1734
|
+
| `count` | `number` | `undefined` | Total number of items |
|
|
1735
|
+
| `pageSize` | `number` | `undefined` | Number of items per page |
|
|
1736
|
+
| `totalPages` | `number` | `undefined` | Total number of pages (deprecated, use count + pageSize) |
|
|
1737
|
+
| `format` | `'none' \| 'long'` | `'none'` | Format for displaying page info |
|
|
1738
|
+
| `simplified` | `boolean` | `false` | Show simplified pagination (prev/next only) |
|
|
1739
|
+
| `asLink` | `boolean` | `false` | Render pagination buttons as links |
|
|
1740
|
+
| `getPageHref` | `(page: number) => string` | `undefined` | Custom href generator for pagination links |
|
|
1741
|
+
| `siblingCount` | `number` | `1` | Number of page buttons to show on each side |
|
|
1742
|
+
| `prevIcon` | `React.ReactNode` | `'<'` | Custom icon for previous button |
|
|
1743
|
+
| `nextIcon` | `React.ReactNode` | `'>'` | Custom icon for next button |
|
|
1744
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'sm'` | Size variant of pagination buttons |
|
|
1745
1745
|
|
|
1746
1746
|
### Basic Pagination
|
|
1747
1747
|
|
|
@@ -1784,7 +1784,9 @@ const SimplifiedExample = () => {
|
|
|
1784
1784
|
### Pagination with Format
|
|
1785
1785
|
|
|
1786
1786
|
```jsx
|
|
1787
|
-
{
|
|
1787
|
+
{
|
|
1788
|
+
/* None Format - Shows page numbers */
|
|
1789
|
+
}
|
|
1788
1790
|
<Pagination
|
|
1789
1791
|
currentPage={currentPage}
|
|
1790
1792
|
count={100}
|
|
@@ -1792,9 +1794,11 @@ const SimplifiedExample = () => {
|
|
|
1792
1794
|
onPageChange={setCurrentPage}
|
|
1793
1795
|
format="none"
|
|
1794
1796
|
simplified
|
|
1795
|
-
|
|
1797
|
+
/>;
|
|
1796
1798
|
|
|
1797
|
-
{
|
|
1799
|
+
{
|
|
1800
|
+
/* Long Format - Shows item range */
|
|
1801
|
+
}
|
|
1798
1802
|
<Pagination
|
|
1799
1803
|
currentPage={currentPage}
|
|
1800
1804
|
count={100}
|
|
@@ -1802,51 +1806,59 @@ const SimplifiedExample = () => {
|
|
|
1802
1806
|
onPageChange={setCurrentPage}
|
|
1803
1807
|
format="long"
|
|
1804
1808
|
simplified
|
|
1805
|
-
|
|
1809
|
+
/>;
|
|
1806
1810
|
```
|
|
1807
1811
|
|
|
1808
1812
|
### Sizes
|
|
1809
1813
|
|
|
1810
1814
|
```jsx
|
|
1811
|
-
{
|
|
1815
|
+
{
|
|
1816
|
+
/* Small Size */
|
|
1817
|
+
}
|
|
1812
1818
|
<Pagination
|
|
1813
1819
|
currentPage={currentPage}
|
|
1814
1820
|
count={100}
|
|
1815
1821
|
pageSize={10}
|
|
1816
1822
|
onPageChange={setCurrentPage}
|
|
1817
1823
|
size="sm"
|
|
1818
|
-
|
|
1824
|
+
/>;
|
|
1819
1825
|
|
|
1820
|
-
{
|
|
1826
|
+
{
|
|
1827
|
+
/* Medium Size */
|
|
1828
|
+
}
|
|
1821
1829
|
<Pagination
|
|
1822
1830
|
currentPage={currentPage}
|
|
1823
1831
|
count={100}
|
|
1824
1832
|
pageSize={10}
|
|
1825
1833
|
onPageChange={setCurrentPage}
|
|
1826
1834
|
size="md"
|
|
1827
|
-
|
|
1835
|
+
/>;
|
|
1828
1836
|
|
|
1829
|
-
{
|
|
1837
|
+
{
|
|
1838
|
+
/* Large Size */
|
|
1839
|
+
}
|
|
1830
1840
|
<Pagination
|
|
1831
1841
|
currentPage={currentPage}
|
|
1832
1842
|
count={100}
|
|
1833
1843
|
pageSize={10}
|
|
1834
1844
|
onPageChange={setCurrentPage}
|
|
1835
1845
|
size="lg"
|
|
1836
|
-
|
|
1846
|
+
/>;
|
|
1837
1847
|
```
|
|
1838
1848
|
|
|
1839
1849
|
### Custom Sibling Count
|
|
1840
1850
|
|
|
1841
1851
|
```jsx
|
|
1842
|
-
{
|
|
1852
|
+
{
|
|
1853
|
+
/* Show 2 page buttons on each side */
|
|
1854
|
+
}
|
|
1843
1855
|
<Pagination
|
|
1844
1856
|
currentPage={currentPage}
|
|
1845
1857
|
count={100}
|
|
1846
1858
|
pageSize={10}
|
|
1847
1859
|
onPageChange={setCurrentPage}
|
|
1848
1860
|
siblingCount={2}
|
|
1849
|
-
|
|
1861
|
+
/>;
|
|
1850
1862
|
```
|
|
1851
1863
|
|
|
1852
1864
|
### Custom Icons
|
|
@@ -1861,7 +1873,7 @@ import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
|
1861
1873
|
onPageChange={setCurrentPage}
|
|
1862
1874
|
prevIcon={<ChevronLeft size={16} />}
|
|
1863
1875
|
nextIcon={<ChevronRight size={16} />}
|
|
1864
|
-
|
|
1876
|
+
/>;
|
|
1865
1877
|
```
|
|
1866
1878
|
|
|
1867
1879
|
### As Links
|
|
@@ -1880,12 +1892,14 @@ import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
|
1880
1892
|
### Using TotalPages (Legacy)
|
|
1881
1893
|
|
|
1882
1894
|
```jsx
|
|
1883
|
-
{
|
|
1895
|
+
{
|
|
1896
|
+
/* This approach is deprecated, prefer using count + pageSize */
|
|
1897
|
+
}
|
|
1884
1898
|
<Pagination
|
|
1885
1899
|
currentPage={currentPage}
|
|
1886
1900
|
totalPages={10}
|
|
1887
1901
|
onPageChange={setCurrentPage}
|
|
1888
|
-
|
|
1902
|
+
/>;
|
|
1889
1903
|
```
|
|
1890
1904
|
|
|
1891
1905
|
---
|
|
@@ -1903,26 +1917,26 @@ import type { Column } from "alope-ui";
|
|
|
1903
1917
|
|
|
1904
1918
|
### Props
|
|
1905
1919
|
|
|
1906
|
-
| Prop
|
|
1907
|
-
|
|
|
1908
|
-
| `columns`
|
|
1909
|
-
| `data`
|
|
1910
|
-
| `striped`
|
|
1911
|
-
| `stripeColor`
|
|
1912
|
-
| `headerClassName`
|
|
1913
|
-
| `dataColumnClassName`
|
|
1914
|
-
| `dataRowClassName`
|
|
1915
|
-
| `tableClassName`
|
|
1916
|
-
| `captionClassName`
|
|
1917
|
-
| `containerClassName`
|
|
1918
|
-
| `customEmptyData`
|
|
1919
|
-
| `size`
|
|
1920
|
-
| `caption`
|
|
1921
|
-
| `captionPosition`
|
|
1922
|
-
| `stickyHeader`
|
|
1923
|
-
| `selectable`
|
|
1924
|
-
| `onSelectionChange`
|
|
1925
|
-
| `selectedRows`
|
|
1920
|
+
| Prop | Type | Default | Description |
|
|
1921
|
+
| --------------------- | ------------------------- | ----------- | ------------------------------------ |
|
|
1922
|
+
| `columns` | `Column<T>[]` | `required` | Array of column configurations |
|
|
1923
|
+
| `data` | `T[]` | `required` | Array of data objects to display |
|
|
1924
|
+
| `striped` | `boolean` | `false` | Enable alternating row colors |
|
|
1925
|
+
| `stripeColor` | `string` | `undefined` | Custom color for striped rows |
|
|
1926
|
+
| `headerClassName` | `string` | `""` | CSS class for table header |
|
|
1927
|
+
| `dataColumnClassName` | `string` | `""` | CSS class for data cells |
|
|
1928
|
+
| `dataRowClassName` | `string` | `""` | CSS class for data rows |
|
|
1929
|
+
| `tableClassName` | `string` | `""` | CSS class for table element |
|
|
1930
|
+
| `captionClassName` | `string` | `""` | CSS class for caption |
|
|
1931
|
+
| `containerClassName` | `string` | `""` | CSS class for container |
|
|
1932
|
+
| `customEmptyData` | `React.ReactNode` | `undefined` | Custom message when no data |
|
|
1933
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Size variant of table |
|
|
1934
|
+
| `caption` | `string` | `undefined` | Table caption text |
|
|
1935
|
+
| `captionPosition` | `'top' \| 'bottom'` | `'bottom'` | Position of caption |
|
|
1936
|
+
| `stickyHeader` | `boolean` | `false` | Make header sticky on scroll |
|
|
1937
|
+
| `selectable` | `boolean` | `false` | Enable row selection with checkboxes |
|
|
1938
|
+
| `onSelectionChange` | `(selected: T[]) => void` | `undefined` | Callback when selection changes |
|
|
1939
|
+
| `selectedRows` | `T[]` | `[]` | Array of selected rows |
|
|
1926
1940
|
|
|
1927
1941
|
### Column Type
|
|
1928
1942
|
|
|
@@ -1941,10 +1955,10 @@ import { Table } from "alope-ui";
|
|
|
1941
1955
|
import type { Column } from "alope-ui";
|
|
1942
1956
|
|
|
1943
1957
|
type User = {
|
|
1944
|
-
id: number
|
|
1945
|
-
name: string
|
|
1946
|
-
email: string
|
|
1947
|
-
role: string
|
|
1958
|
+
id: number,
|
|
1959
|
+
name: string,
|
|
1960
|
+
email: string,
|
|
1961
|
+
role: string,
|
|
1948
1962
|
};
|
|
1949
1963
|
|
|
1950
1964
|
const columns: Column<User>[] = [
|
|
@@ -1967,28 +1981,36 @@ const BasicExample = () => {
|
|
|
1967
1981
|
### Striped Table
|
|
1968
1982
|
|
|
1969
1983
|
```jsx
|
|
1970
|
-
<Table columns={columns} data={data} striped
|
|
1984
|
+
<Table columns={columns} data={data} striped />;
|
|
1971
1985
|
|
|
1972
|
-
{
|
|
1986
|
+
{
|
|
1987
|
+
/* With custom stripe color */
|
|
1988
|
+
}
|
|
1973
1989
|
<Table
|
|
1974
1990
|
columns={columns}
|
|
1975
1991
|
data={data}
|
|
1976
1992
|
striped
|
|
1977
1993
|
stripeColor="bg-blue-50 dark:bg-blue-900"
|
|
1978
|
-
|
|
1994
|
+
/>;
|
|
1979
1995
|
```
|
|
1980
1996
|
|
|
1981
1997
|
### Sizes
|
|
1982
1998
|
|
|
1983
1999
|
```jsx
|
|
1984
|
-
{
|
|
1985
|
-
|
|
2000
|
+
{
|
|
2001
|
+
/* Small Size */
|
|
2002
|
+
}
|
|
2003
|
+
<Table columns={columns} data={data} size="sm" />;
|
|
1986
2004
|
|
|
1987
|
-
{
|
|
1988
|
-
|
|
2005
|
+
{
|
|
2006
|
+
/* Medium Size */
|
|
2007
|
+
}
|
|
2008
|
+
<Table columns={columns} data={data} size="md" />;
|
|
1989
2009
|
|
|
1990
|
-
{
|
|
1991
|
-
|
|
2010
|
+
{
|
|
2011
|
+
/* Large Size */
|
|
2012
|
+
}
|
|
2013
|
+
<Table columns={columns} data={data} size="lg" />;
|
|
1992
2014
|
```
|
|
1993
2015
|
|
|
1994
2016
|
### Custom Rendering
|
|
@@ -2046,21 +2068,25 @@ const SelectableExample = () => {
|
|
|
2046
2068
|
### With Caption
|
|
2047
2069
|
|
|
2048
2070
|
```jsx
|
|
2049
|
-
{
|
|
2071
|
+
{
|
|
2072
|
+
/* Caption at bottom */
|
|
2073
|
+
}
|
|
2050
2074
|
<Table
|
|
2051
2075
|
columns={columns}
|
|
2052
2076
|
data={data}
|
|
2053
2077
|
caption="User Management Table"
|
|
2054
2078
|
captionPosition="bottom"
|
|
2055
|
-
|
|
2079
|
+
/>;
|
|
2056
2080
|
|
|
2057
|
-
{
|
|
2081
|
+
{
|
|
2082
|
+
/* Caption at top */
|
|
2083
|
+
}
|
|
2058
2084
|
<Table
|
|
2059
2085
|
columns={columns}
|
|
2060
2086
|
data={data}
|
|
2061
2087
|
caption="User Management Table"
|
|
2062
2088
|
captionPosition="top"
|
|
2063
|
-
|
|
2089
|
+
/>;
|
|
2064
2090
|
```
|
|
2065
2091
|
|
|
2066
2092
|
### Custom Empty State
|
|
@@ -2173,19 +2199,19 @@ import { Tooltip } from "alope-ui";
|
|
|
2173
2199
|
|
|
2174
2200
|
### Props
|
|
2175
2201
|
|
|
2176
|
-
| Prop | Type
|
|
2177
|
-
| ------------------- |
|
|
2178
|
-
| `children` | `React.ReactNode`
|
|
2179
|
-
| `text` | `string`
|
|
2180
|
-
| `showArrow` | `boolean`
|
|
2181
|
-
| `placement` | `'top' \| 'bottom' \| 'left' \| 'right'`
|
|
2182
|
-
| `offset` | `number`
|
|
2183
|
-
| `bgColor` | `string`
|
|
2184
|
-
| `isOpen` | `boolean`
|
|
2185
|
-
| `onOpenChange` | `(open: boolean) => void`
|
|
2186
|
-
| `disabled` | `boolean`
|
|
2187
|
-
| `animationDuration` | `number`
|
|
2188
|
-
| `delay` | `number`
|
|
2202
|
+
| Prop | Type | Default | Description |
|
|
2203
|
+
| ------------------- | ---------------------------------------- | -------------------------------- | --------------------------------------- |
|
|
2204
|
+
| `children` | `React.ReactNode` | `required` | Element that triggers the tooltip |
|
|
2205
|
+
| `text` | `string` | `required` | Text content of the tooltip |
|
|
2206
|
+
| `showArrow` | `boolean` | `true` | Show arrow pointing to trigger element |
|
|
2207
|
+
| `placement` | `'top' \| 'bottom' \| 'left' \| 'right'` | `'top'` | Position of tooltip relative to trigger |
|
|
2208
|
+
| `offset` | `number` | `8` | Distance from trigger element (in px) |
|
|
2209
|
+
| `bgColor` | `string` | `'bg-gray-800 dark:bg-gray-600'` | Background color class |
|
|
2210
|
+
| `isOpen` | `boolean` | `undefined` | Controlled visibility state |
|
|
2211
|
+
| `onOpenChange` | `(open: boolean) => void` | `undefined` | Callback when visibility changes |
|
|
2212
|
+
| `disabled` | `boolean` | `false` | Disable tooltip functionality |
|
|
2213
|
+
| `animationDuration` | `number` | `300` | Animation duration (in ms) |
|
|
2214
|
+
| `delay` | `number` | `700` | Delay before showing tooltip (in ms) |
|
|
2189
2215
|
|
|
2190
2216
|
### Basic Tooltip
|
|
2191
2217
|
|
|
@@ -2206,25 +2232,33 @@ const BasicExample = () => {
|
|
|
2206
2232
|
### Placement
|
|
2207
2233
|
|
|
2208
2234
|
```jsx
|
|
2209
|
-
{
|
|
2235
|
+
{
|
|
2236
|
+
/* Top Placement */
|
|
2237
|
+
}
|
|
2210
2238
|
<Tooltip text="Tooltip on top" placement="top">
|
|
2211
2239
|
<button>Top</button>
|
|
2212
|
-
</Tooltip
|
|
2240
|
+
</Tooltip>;
|
|
2213
2241
|
|
|
2214
|
-
{
|
|
2242
|
+
{
|
|
2243
|
+
/* Bottom Placement */
|
|
2244
|
+
}
|
|
2215
2245
|
<Tooltip text="Tooltip on bottom" placement="bottom">
|
|
2216
2246
|
<button>Bottom</button>
|
|
2217
|
-
</Tooltip
|
|
2247
|
+
</Tooltip>;
|
|
2218
2248
|
|
|
2219
|
-
{
|
|
2249
|
+
{
|
|
2250
|
+
/* Left Placement */
|
|
2251
|
+
}
|
|
2220
2252
|
<Tooltip text="Tooltip on left" placement="left">
|
|
2221
2253
|
<button>Left</button>
|
|
2222
|
-
</Tooltip
|
|
2254
|
+
</Tooltip>;
|
|
2223
2255
|
|
|
2224
|
-
{
|
|
2256
|
+
{
|
|
2257
|
+
/* Right Placement */
|
|
2258
|
+
}
|
|
2225
2259
|
<Tooltip text="Tooltip on right" placement="right">
|
|
2226
2260
|
<button>Right</button>
|
|
2227
|
-
</Tooltip
|
|
2261
|
+
</Tooltip>;
|
|
2228
2262
|
```
|
|
2229
2263
|
|
|
2230
2264
|
### Without Arrow
|
|
@@ -2238,15 +2272,19 @@ const BasicExample = () => {
|
|
|
2238
2272
|
### Custom Offset
|
|
2239
2273
|
|
|
2240
2274
|
```jsx
|
|
2241
|
-
{
|
|
2275
|
+
{
|
|
2276
|
+
/* Small offset */
|
|
2277
|
+
}
|
|
2242
2278
|
<Tooltip text="Close to element" offset={4}>
|
|
2243
2279
|
<button>Small Offset</button>
|
|
2244
|
-
</Tooltip
|
|
2280
|
+
</Tooltip>;
|
|
2245
2281
|
|
|
2246
|
-
{
|
|
2282
|
+
{
|
|
2283
|
+
/* Large offset */
|
|
2284
|
+
}
|
|
2247
2285
|
<Tooltip text="Far from element" offset={16}>
|
|
2248
2286
|
<button>Large Offset</button>
|
|
2249
|
-
</Tooltip
|
|
2287
|
+
</Tooltip>;
|
|
2250
2288
|
```
|
|
2251
2289
|
|
|
2252
2290
|
### Custom Background Color
|
|
@@ -2280,9 +2318,7 @@ const ControlledExample = () => {
|
|
|
2280
2318
|
isOpen={isOpen}
|
|
2281
2319
|
onOpenChange={setIsOpen}
|
|
2282
2320
|
>
|
|
2283
|
-
<button onClick={() => setIsOpen(!isOpen)}>
|
|
2284
|
-
Click to toggle
|
|
2285
|
-
</button>
|
|
2321
|
+
<button onClick={() => setIsOpen(!isOpen)}>Click to toggle</button>
|
|
2286
2322
|
</Tooltip>
|
|
2287
2323
|
</div>
|
|
2288
2324
|
);
|
|
@@ -2292,29 +2328,37 @@ const ControlledExample = () => {
|
|
|
2292
2328
|
### Custom Animation
|
|
2293
2329
|
|
|
2294
2330
|
```jsx
|
|
2295
|
-
{
|
|
2331
|
+
{
|
|
2332
|
+
/* Fast animation */
|
|
2333
|
+
}
|
|
2296
2334
|
<Tooltip text="Fast animation" animationDuration={150}>
|
|
2297
2335
|
<button>Fast</button>
|
|
2298
|
-
</Tooltip
|
|
2336
|
+
</Tooltip>;
|
|
2299
2337
|
|
|
2300
|
-
{
|
|
2338
|
+
{
|
|
2339
|
+
/* Slow animation */
|
|
2340
|
+
}
|
|
2301
2341
|
<Tooltip text="Slow animation" animationDuration={600}>
|
|
2302
2342
|
<button>Slow</button>
|
|
2303
|
-
</Tooltip
|
|
2343
|
+
</Tooltip>;
|
|
2304
2344
|
```
|
|
2305
2345
|
|
|
2306
2346
|
### Custom Delay
|
|
2307
2347
|
|
|
2308
2348
|
```jsx
|
|
2309
|
-
{
|
|
2349
|
+
{
|
|
2350
|
+
/* No delay */
|
|
2351
|
+
}
|
|
2310
2352
|
<Tooltip text="Instant tooltip" delay={0}>
|
|
2311
2353
|
<button>No Delay</button>
|
|
2312
|
-
</Tooltip
|
|
2354
|
+
</Tooltip>;
|
|
2313
2355
|
|
|
2314
|
-
{
|
|
2356
|
+
{
|
|
2357
|
+
/* Long delay */
|
|
2358
|
+
}
|
|
2315
2359
|
<Tooltip text="Patient tooltip" delay={1500}>
|
|
2316
2360
|
<button>Long Delay</button>
|
|
2317
|
-
</Tooltip
|
|
2361
|
+
</Tooltip>;
|
|
2318
2362
|
```
|
|
2319
2363
|
|
|
2320
2364
|
### Disabled Tooltip
|
|
@@ -2396,13 +2440,13 @@ import { Spinner } from "alope-ui";
|
|
|
2396
2440
|
|
|
2397
2441
|
### Props
|
|
2398
2442
|
|
|
2399
|
-
| Prop | Type
|
|
2400
|
-
| ----------- |
|
|
2401
|
-
| `size` | `'sm' \| 'md' \| 'lg'`
|
|
2443
|
+
| Prop | Type | Default | Description |
|
|
2444
|
+
| ----------- | ------------------------------------------------------------------------- | ----------- | ------------------------------- |
|
|
2445
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Size of the spinner |
|
|
2402
2446
|
| `color` | `'primary' \| 'error' \| 'warning' \| 'success' \| 'info' \| 'secondary'` | `'primary'` | Color variant of the spinner |
|
|
2403
|
-
| `className` | `string`
|
|
2404
|
-
| `duration` | `number`
|
|
2405
|
-
| `thickness` | `number`
|
|
2447
|
+
| `className` | `string` | `""` | Additional CSS classes |
|
|
2448
|
+
| `duration` | `number` | `1000` | Animation duration (in ms) |
|
|
2449
|
+
| `thickness` | `number` | `undefined` | Custom border thickness (in px) |
|
|
2406
2450
|
|
|
2407
2451
|
### Basic Spinner
|
|
2408
2452
|
|
|
@@ -2417,56 +2461,82 @@ const BasicExample = () => {
|
|
|
2417
2461
|
### Sizes
|
|
2418
2462
|
|
|
2419
2463
|
```jsx
|
|
2420
|
-
{
|
|
2421
|
-
|
|
2464
|
+
{
|
|
2465
|
+
/* Small Size */
|
|
2466
|
+
}
|
|
2467
|
+
<Spinner size="sm" />;
|
|
2422
2468
|
|
|
2423
|
-
{
|
|
2424
|
-
|
|
2469
|
+
{
|
|
2470
|
+
/* Medium Size */
|
|
2471
|
+
}
|
|
2472
|
+
<Spinner size="md" />;
|
|
2425
2473
|
|
|
2426
|
-
{
|
|
2427
|
-
|
|
2474
|
+
{
|
|
2475
|
+
/* Large Size */
|
|
2476
|
+
}
|
|
2477
|
+
<Spinner size="lg" />;
|
|
2428
2478
|
```
|
|
2429
2479
|
|
|
2430
2480
|
### Colors
|
|
2431
2481
|
|
|
2432
2482
|
```jsx
|
|
2433
|
-
{
|
|
2434
|
-
|
|
2483
|
+
{
|
|
2484
|
+
/* Primary Color */
|
|
2485
|
+
}
|
|
2486
|
+
<Spinner color="primary" />;
|
|
2435
2487
|
|
|
2436
|
-
{
|
|
2437
|
-
|
|
2488
|
+
{
|
|
2489
|
+
/* Error Color */
|
|
2490
|
+
}
|
|
2491
|
+
<Spinner color="error" />;
|
|
2438
2492
|
|
|
2439
|
-
{
|
|
2440
|
-
|
|
2493
|
+
{
|
|
2494
|
+
/* Warning Color */
|
|
2495
|
+
}
|
|
2496
|
+
<Spinner color="warning" />;
|
|
2441
2497
|
|
|
2442
|
-
{
|
|
2443
|
-
|
|
2498
|
+
{
|
|
2499
|
+
/* Success Color */
|
|
2500
|
+
}
|
|
2501
|
+
<Spinner color="success" />;
|
|
2444
2502
|
|
|
2445
|
-
{
|
|
2446
|
-
|
|
2503
|
+
{
|
|
2504
|
+
/* Info Color */
|
|
2505
|
+
}
|
|
2506
|
+
<Spinner color="info" />;
|
|
2447
2507
|
|
|
2448
|
-
{
|
|
2449
|
-
|
|
2508
|
+
{
|
|
2509
|
+
/* Secondary Color */
|
|
2510
|
+
}
|
|
2511
|
+
<Spinner color="secondary" />;
|
|
2450
2512
|
```
|
|
2451
2513
|
|
|
2452
2514
|
### Custom Duration
|
|
2453
2515
|
|
|
2454
2516
|
```jsx
|
|
2455
|
-
{
|
|
2456
|
-
|
|
2517
|
+
{
|
|
2518
|
+
/* Fast animation */
|
|
2519
|
+
}
|
|
2520
|
+
<Spinner duration={500} />;
|
|
2457
2521
|
|
|
2458
|
-
{
|
|
2459
|
-
|
|
2522
|
+
{
|
|
2523
|
+
/* Slow animation */
|
|
2524
|
+
}
|
|
2525
|
+
<Spinner duration={2000} />;
|
|
2460
2526
|
```
|
|
2461
2527
|
|
|
2462
2528
|
### Custom Thickness
|
|
2463
2529
|
|
|
2464
2530
|
```jsx
|
|
2465
|
-
{
|
|
2466
|
-
|
|
2531
|
+
{
|
|
2532
|
+
/* Thin spinner */
|
|
2533
|
+
}
|
|
2534
|
+
<Spinner thickness={1} />;
|
|
2467
2535
|
|
|
2468
|
-
{
|
|
2469
|
-
|
|
2536
|
+
{
|
|
2537
|
+
/* Thick spinner */
|
|
2538
|
+
}
|
|
2539
|
+
<Spinner thickness={6} />;
|
|
2470
2540
|
```
|
|
2471
2541
|
|
|
2472
2542
|
### Combined Customization
|
|
@@ -2596,14 +2666,14 @@ import { Skeleton } from "alope-ui";
|
|
|
2596
2666
|
|
|
2597
2667
|
### Props
|
|
2598
2668
|
|
|
2599
|
-
| Prop | Type
|
|
2600
|
-
| ----------- |
|
|
2601
|
-
| `width` | `string`
|
|
2602
|
-
| `height` | `string`
|
|
2603
|
-
| `rounded` | `boolean`
|
|
2604
|
-
| `isLoading` | `boolean`
|
|
2605
|
-
| `children` | `React.ReactNode`
|
|
2606
|
-
| `animode` | `'shimmer' \| 'flash'`
|
|
2669
|
+
| Prop | Type | Default | Description |
|
|
2670
|
+
| ----------- | ---------------------- | ----------- | -------------------------------------- |
|
|
2671
|
+
| `width` | `string` | `undefined` | Width of the skeleton (CSS value) |
|
|
2672
|
+
| `height` | `string` | `undefined` | Height of the skeleton (CSS value) |
|
|
2673
|
+
| `rounded` | `boolean` | `false` | Apply rounded shape (full circle/pill) |
|
|
2674
|
+
| `isLoading` | `boolean` | `true` | Show skeleton or actual content |
|
|
2675
|
+
| `children` | `React.ReactNode` | `undefined` | Content to render when not loading |
|
|
2676
|
+
| `animode` | `'shimmer' \| 'flash'` | `'flash'` | Animation mode for the skeleton |
|
|
2607
2677
|
|
|
2608
2678
|
### Basic Skeleton
|
|
2609
2679
|
|
|
@@ -2638,37 +2708,53 @@ const SkeletonWithChildren = () => {
|
|
|
2638
2708
|
### Animation Modes
|
|
2639
2709
|
|
|
2640
2710
|
```jsx
|
|
2641
|
-
{
|
|
2642
|
-
|
|
2711
|
+
{
|
|
2712
|
+
/* Flash animation */
|
|
2713
|
+
}
|
|
2714
|
+
<Skeleton width="200px" height="20px" animode="flash" />;
|
|
2643
2715
|
|
|
2644
|
-
{
|
|
2645
|
-
|
|
2716
|
+
{
|
|
2717
|
+
/* Shimmer animation */
|
|
2718
|
+
}
|
|
2719
|
+
<Skeleton width="200px" height="20px" animode="shimmer" />;
|
|
2646
2720
|
```
|
|
2647
2721
|
|
|
2648
2722
|
### Rounded Skeleton
|
|
2649
2723
|
|
|
2650
2724
|
```jsx
|
|
2651
|
-
{
|
|
2652
|
-
|
|
2725
|
+
{
|
|
2726
|
+
/* Rounded rectangle */
|
|
2727
|
+
}
|
|
2728
|
+
<Skeleton width="100px" height="100px" rounded />;
|
|
2653
2729
|
|
|
2654
|
-
{
|
|
2655
|
-
|
|
2730
|
+
{
|
|
2731
|
+
/* Avatar skeleton */
|
|
2732
|
+
}
|
|
2733
|
+
<Skeleton width="48px" height="48px" rounded />;
|
|
2656
2734
|
```
|
|
2657
2735
|
|
|
2658
2736
|
### Different Sizes
|
|
2659
2737
|
|
|
2660
2738
|
```jsx
|
|
2661
|
-
{
|
|
2662
|
-
|
|
2739
|
+
{
|
|
2740
|
+
/* Small */
|
|
2741
|
+
}
|
|
2742
|
+
<Skeleton width="100px" height="16px" />;
|
|
2663
2743
|
|
|
2664
|
-
{
|
|
2665
|
-
|
|
2744
|
+
{
|
|
2745
|
+
/* Medium */
|
|
2746
|
+
}
|
|
2747
|
+
<Skeleton width="200px" height="20px" />;
|
|
2666
2748
|
|
|
2667
|
-
{
|
|
2668
|
-
|
|
2749
|
+
{
|
|
2750
|
+
/* Large */
|
|
2751
|
+
}
|
|
2752
|
+
<Skeleton width="300px" height="24px" />;
|
|
2669
2753
|
|
|
2670
|
-
{
|
|
2671
|
-
|
|
2754
|
+
{
|
|
2755
|
+
/* Full width */
|
|
2756
|
+
}
|
|
2757
|
+
<Skeleton width="100%" height="20px" />;
|
|
2672
2758
|
```
|
|
2673
2759
|
|
|
2674
2760
|
### Text Skeleton
|
|
@@ -2783,15 +2869,15 @@ import { useState, useEffect } from "react";
|
|
|
2783
2869
|
import { Skeleton } from "alope-ui";
|
|
2784
2870
|
|
|
2785
2871
|
type User = {
|
|
2786
|
-
id: number
|
|
2787
|
-
name: string
|
|
2788
|
-
email: string
|
|
2789
|
-
avatar: string
|
|
2872
|
+
id: number,
|
|
2873
|
+
name: string,
|
|
2874
|
+
email: string,
|
|
2875
|
+
avatar: string,
|
|
2790
2876
|
};
|
|
2791
2877
|
|
|
2792
2878
|
const UserProfile = () => {
|
|
2793
2879
|
const [isLoading, setIsLoading] = useState(true);
|
|
2794
|
-
const [user, setUser] = useState<User | null>
|
|
2880
|
+
const [user, setUser] = (useState < User) | (null > null);
|
|
2795
2881
|
|
|
2796
2882
|
useEffect(() => {
|
|
2797
2883
|
const fetchUser = async () => {
|
|
@@ -2875,15 +2961,15 @@ import { Toggle } from "alope-ui";
|
|
|
2875
2961
|
|
|
2876
2962
|
### Props
|
|
2877
2963
|
|
|
2878
|
-
| Prop
|
|
2879
|
-
|
|
|
2880
|
-
| `variant`
|
|
2881
|
-
| `customSize`
|
|
2882
|
-
| `thumbShape`
|
|
2883
|
-
| `label`
|
|
2884
|
-
| `wrapperClassName`
|
|
2885
|
-
| `labelClassName`
|
|
2886
|
-
| `...props`
|
|
2964
|
+
| Prop | Type | Default | Description |
|
|
2965
|
+
| ------------------ | ------------------------------------------------------------------------- | ----------- | ----------------------------------- |
|
|
2966
|
+
| `variant` | `'primary' \| 'error' \| 'warning' \| 'success' \| 'info' \| 'secondary'` | `'primary'` | Color variant of the toggle |
|
|
2967
|
+
| `customSize` | `'sm' \| 'md' \| 'lg'` | `'md'` | Size of the toggle switch |
|
|
2968
|
+
| `thumbShape` | `'stadium' \| 'rounded'` | `'stadium'` | Shape of the toggle thumb |
|
|
2969
|
+
| `label` | `string` | `undefined` | Label text displayed next to toggle |
|
|
2970
|
+
| `wrapperClassName` | `string` | `""` | CSS class for wrapper element |
|
|
2971
|
+
| `labelClassName` | `string` | `""` | CSS class for label text |
|
|
2972
|
+
| `...props` | `InputHTMLAttributes<HTMLInputElement>` | - | All standard HTML input attributes |
|
|
2887
2973
|
|
|
2888
2974
|
### Basic Toggle
|
|
2889
2975
|
|
|
@@ -2916,101 +3002,123 @@ const BasicExample = () => {
|
|
|
2916
3002
|
### Variants
|
|
2917
3003
|
|
|
2918
3004
|
```jsx
|
|
2919
|
-
{
|
|
3005
|
+
{
|
|
3006
|
+
/* Primary Variant */
|
|
3007
|
+
}
|
|
2920
3008
|
<Toggle
|
|
2921
3009
|
checked={isChecked}
|
|
2922
3010
|
onChange={(e) => setIsChecked(e.target.checked)}
|
|
2923
3011
|
variant="primary"
|
|
2924
3012
|
label="Primary"
|
|
2925
|
-
|
|
3013
|
+
/>;
|
|
2926
3014
|
|
|
2927
|
-
{
|
|
3015
|
+
{
|
|
3016
|
+
/* Error Variant */
|
|
3017
|
+
}
|
|
2928
3018
|
<Toggle
|
|
2929
3019
|
checked={isChecked}
|
|
2930
3020
|
onChange={(e) => setIsChecked(e.target.checked)}
|
|
2931
3021
|
variant="error"
|
|
2932
3022
|
label="Error"
|
|
2933
|
-
|
|
3023
|
+
/>;
|
|
2934
3024
|
|
|
2935
|
-
{
|
|
3025
|
+
{
|
|
3026
|
+
/* Warning Variant */
|
|
3027
|
+
}
|
|
2936
3028
|
<Toggle
|
|
2937
3029
|
checked={isChecked}
|
|
2938
3030
|
onChange={(e) => setIsChecked(e.target.checked)}
|
|
2939
3031
|
variant="warning"
|
|
2940
3032
|
label="Warning"
|
|
2941
|
-
|
|
3033
|
+
/>;
|
|
2942
3034
|
|
|
2943
|
-
{
|
|
3035
|
+
{
|
|
3036
|
+
/* Success Variant */
|
|
3037
|
+
}
|
|
2944
3038
|
<Toggle
|
|
2945
3039
|
checked={isChecked}
|
|
2946
3040
|
onChange={(e) => setIsChecked(e.target.checked)}
|
|
2947
3041
|
variant="success"
|
|
2948
3042
|
label="Success"
|
|
2949
|
-
|
|
3043
|
+
/>;
|
|
2950
3044
|
|
|
2951
|
-
{
|
|
3045
|
+
{
|
|
3046
|
+
/* Info Variant */
|
|
3047
|
+
}
|
|
2952
3048
|
<Toggle
|
|
2953
3049
|
checked={isChecked}
|
|
2954
3050
|
onChange={(e) => setIsChecked(e.target.checked)}
|
|
2955
3051
|
variant="info"
|
|
2956
3052
|
label="Info"
|
|
2957
|
-
|
|
3053
|
+
/>;
|
|
2958
3054
|
|
|
2959
|
-
{
|
|
3055
|
+
{
|
|
3056
|
+
/* Secondary Variant */
|
|
3057
|
+
}
|
|
2960
3058
|
<Toggle
|
|
2961
3059
|
checked={isChecked}
|
|
2962
3060
|
onChange={(e) => setIsChecked(e.target.checked)}
|
|
2963
3061
|
variant="secondary"
|
|
2964
3062
|
label="Secondary"
|
|
2965
|
-
|
|
3063
|
+
/>;
|
|
2966
3064
|
```
|
|
2967
3065
|
|
|
2968
3066
|
### Sizes
|
|
2969
3067
|
|
|
2970
3068
|
```jsx
|
|
2971
|
-
{
|
|
3069
|
+
{
|
|
3070
|
+
/* Small Size */
|
|
3071
|
+
}
|
|
2972
3072
|
<Toggle
|
|
2973
3073
|
checked={isChecked}
|
|
2974
3074
|
onChange={(e) => setIsChecked(e.target.checked)}
|
|
2975
3075
|
customSize="sm"
|
|
2976
3076
|
label="Small"
|
|
2977
|
-
|
|
3077
|
+
/>;
|
|
2978
3078
|
|
|
2979
|
-
{
|
|
3079
|
+
{
|
|
3080
|
+
/* Medium Size */
|
|
3081
|
+
}
|
|
2980
3082
|
<Toggle
|
|
2981
3083
|
checked={isChecked}
|
|
2982
3084
|
onChange={(e) => setIsChecked(e.target.checked)}
|
|
2983
3085
|
customSize="md"
|
|
2984
3086
|
label="Medium"
|
|
2985
|
-
|
|
3087
|
+
/>;
|
|
2986
3088
|
|
|
2987
|
-
{
|
|
3089
|
+
{
|
|
3090
|
+
/* Large Size */
|
|
3091
|
+
}
|
|
2988
3092
|
<Toggle
|
|
2989
3093
|
checked={isChecked}
|
|
2990
3094
|
onChange={(e) => setIsChecked(e.target.checked)}
|
|
2991
3095
|
customSize="lg"
|
|
2992
3096
|
label="Large"
|
|
2993
|
-
|
|
3097
|
+
/>;
|
|
2994
3098
|
```
|
|
2995
3099
|
|
|
2996
3100
|
### Thumb Shapes
|
|
2997
3101
|
|
|
2998
3102
|
```jsx
|
|
2999
|
-
{
|
|
3103
|
+
{
|
|
3104
|
+
/* Stadium Shape (Fully Rounded) */
|
|
3105
|
+
}
|
|
3000
3106
|
<Toggle
|
|
3001
3107
|
checked={isChecked}
|
|
3002
3108
|
onChange={(e) => setIsChecked(e.target.checked)}
|
|
3003
3109
|
thumbShape="stadium"
|
|
3004
3110
|
label="Stadium"
|
|
3005
|
-
|
|
3111
|
+
/>;
|
|
3006
3112
|
|
|
3007
|
-
{
|
|
3113
|
+
{
|
|
3114
|
+
/* Rounded Shape (Slightly Rounded) */
|
|
3115
|
+
}
|
|
3008
3116
|
<Toggle
|
|
3009
3117
|
checked={isChecked}
|
|
3010
3118
|
onChange={(e) => setIsChecked(e.target.checked)}
|
|
3011
3119
|
thumbShape="rounded"
|
|
3012
3120
|
label="Rounded"
|
|
3013
|
-
|
|
3121
|
+
/>;
|
|
3014
3122
|
```
|
|
3015
3123
|
|
|
3016
3124
|
### Disabled State
|
|
@@ -3049,34 +3157,35 @@ const CompleteExample = () => {
|
|
|
3049
3157
|
autoSave: false,
|
|
3050
3158
|
});
|
|
3051
3159
|
|
|
3052
|
-
const handleToggle =
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3160
|
+
const handleToggle =
|
|
3161
|
+
(key: string) => (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
3162
|
+
setSettings((prev) => ({
|
|
3163
|
+
...prev,
|
|
3164
|
+
[key]: e.target.checked,
|
|
3165
|
+
}));
|
|
3166
|
+
};
|
|
3058
3167
|
|
|
3059
3168
|
return (
|
|
3060
3169
|
<div className="space-y-4">
|
|
3061
3170
|
<Toggle
|
|
3062
3171
|
checked={settings.notifications}
|
|
3063
|
-
onChange={handleToggle(
|
|
3172
|
+
onChange={handleToggle("notifications")}
|
|
3064
3173
|
variant="primary"
|
|
3065
3174
|
customSize="md"
|
|
3066
3175
|
label="Enable notifications"
|
|
3067
3176
|
/>
|
|
3068
|
-
|
|
3177
|
+
|
|
3069
3178
|
<Toggle
|
|
3070
3179
|
checked={settings.darkMode}
|
|
3071
|
-
onChange={handleToggle(
|
|
3180
|
+
onChange={handleToggle("darkMode")}
|
|
3072
3181
|
variant="secondary"
|
|
3073
3182
|
customSize="md"
|
|
3074
3183
|
label="Dark mode"
|
|
3075
3184
|
/>
|
|
3076
|
-
|
|
3185
|
+
|
|
3077
3186
|
<Toggle
|
|
3078
3187
|
checked={settings.autoSave}
|
|
3079
|
-
onChange={handleToggle(
|
|
3188
|
+
onChange={handleToggle("autoSave")}
|
|
3080
3189
|
variant="success"
|
|
3081
3190
|
customSize="md"
|
|
3082
3191
|
label="Auto-save documents"
|
|
@@ -3100,17 +3209,17 @@ import { FileUpload } from "alope-ui";
|
|
|
3100
3209
|
|
|
3101
3210
|
### Props
|
|
3102
3211
|
|
|
3103
|
-
| Prop
|
|
3104
|
-
|
|
|
3105
|
-
| `onFilesChange`
|
|
3106
|
-
| `acceptedFiles`
|
|
3107
|
-
| `maxFiles`
|
|
3108
|
-
| `maxKiloByte`
|
|
3109
|
-
| `mode`
|
|
3110
|
-
| `clearable`
|
|
3111
|
-
| `inputLabel`
|
|
3112
|
-
| `helperText`
|
|
3113
|
-
| `mediaCapture`
|
|
3212
|
+
| Prop | Type | Default | Description |
|
|
3213
|
+
| --------------- | --------------------------- | ------------ | ---------------------------------------------- |
|
|
3214
|
+
| `onFilesChange` | `(files: File[]) => void` | `required` | Callback fired when files change |
|
|
3215
|
+
| `acceptedFiles` | `string` | `'image/*'` | Accepted file types (MIME types or extensions) |
|
|
3216
|
+
| `maxFiles` | `number` | `1` | Maximum number of files allowed |
|
|
3217
|
+
| `maxKiloByte` | `number` | `2048` | Maximum file size in kilobytes |
|
|
3218
|
+
| `mode` | `'dropzone' \| 'textinput'` | `'dropzone'` | Display mode of the file upload |
|
|
3219
|
+
| `clearable` | `boolean` | `true` | Show clear button on file previews |
|
|
3220
|
+
| `inputLabel` | `string` | `undefined` | Label for text input mode button |
|
|
3221
|
+
| `helperText` | `string` | `undefined` | Helper text displayed below the input |
|
|
3222
|
+
| `mediaCapture` | `'user' \| 'environment'` | `undefined` | Camera capture mode (for mobile devices) |
|
|
3114
3223
|
|
|
3115
3224
|
### Basic FileUpload (Dropzone Mode)
|
|
3116
3225
|
|
|
@@ -3152,53 +3261,55 @@ const BasicExample = () => {
|
|
|
3152
3261
|
### Custom File Types
|
|
3153
3262
|
|
|
3154
3263
|
```jsx
|
|
3155
|
-
{
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
/>
|
|
3264
|
+
{
|
|
3265
|
+
/* Accept only images */
|
|
3266
|
+
}
|
|
3267
|
+
<FileUpload acceptedFiles="image/*" onFilesChange={setFiles} />;
|
|
3160
3268
|
|
|
3161
|
-
{
|
|
3269
|
+
{
|
|
3270
|
+
/* Accept specific image types */
|
|
3271
|
+
}
|
|
3162
3272
|
<FileUpload
|
|
3163
3273
|
acceptedFiles="image/png, image/jpeg, image/jpg"
|
|
3164
3274
|
onFilesChange={setFiles}
|
|
3165
|
-
|
|
3275
|
+
/>;
|
|
3166
3276
|
|
|
3167
|
-
{
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
/>
|
|
3277
|
+
{
|
|
3278
|
+
/* Accept PDFs */
|
|
3279
|
+
}
|
|
3280
|
+
<FileUpload acceptedFiles="application/pdf" onFilesChange={setFiles} />;
|
|
3172
3281
|
|
|
3173
|
-
{
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
/>
|
|
3282
|
+
{
|
|
3283
|
+
/* Accept by file extension */
|
|
3284
|
+
}
|
|
3285
|
+
<FileUpload acceptedFiles=".pdf, .doc, .docx" onFilesChange={setFiles} />;
|
|
3178
3286
|
|
|
3179
|
-
{
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
/>
|
|
3287
|
+
{
|
|
3288
|
+
/* Accept multiple types */
|
|
3289
|
+
}
|
|
3290
|
+
<FileUpload acceptedFiles="image/*, .pdf, .doc" onFilesChange={setFiles} />;
|
|
3184
3291
|
```
|
|
3185
3292
|
|
|
3186
3293
|
### File Size Limit
|
|
3187
3294
|
|
|
3188
3295
|
```jsx
|
|
3189
|
-
{
|
|
3296
|
+
{
|
|
3297
|
+
/* 5MB limit */
|
|
3298
|
+
}
|
|
3190
3299
|
<FileUpload
|
|
3191
3300
|
maxKiloByte={5120}
|
|
3192
3301
|
onFilesChange={setFiles}
|
|
3193
3302
|
helperText="Maximum file size: 5MB"
|
|
3194
|
-
|
|
3303
|
+
/>;
|
|
3195
3304
|
|
|
3196
|
-
{
|
|
3305
|
+
{
|
|
3306
|
+
/* 500KB limit */
|
|
3307
|
+
}
|
|
3197
3308
|
<FileUpload
|
|
3198
3309
|
maxKiloByte={512}
|
|
3199
3310
|
onFilesChange={setFiles}
|
|
3200
3311
|
helperText="Maximum file size: 500KB"
|
|
3201
|
-
|
|
3312
|
+
/>;
|
|
3202
3313
|
```
|
|
3203
3314
|
|
|
3204
3315
|
### With Helper Text
|
|
@@ -3213,28 +3324,29 @@ const BasicExample = () => {
|
|
|
3213
3324
|
### Camera Capture (Mobile)
|
|
3214
3325
|
|
|
3215
3326
|
```jsx
|
|
3216
|
-
{
|
|
3327
|
+
{
|
|
3328
|
+
/* Use front camera */
|
|
3329
|
+
}
|
|
3217
3330
|
<FileUpload
|
|
3218
3331
|
acceptedFiles="image/*"
|
|
3219
3332
|
mediaCapture="user"
|
|
3220
3333
|
onFilesChange={setFiles}
|
|
3221
|
-
|
|
3334
|
+
/>;
|
|
3222
3335
|
|
|
3223
|
-
{
|
|
3336
|
+
{
|
|
3337
|
+
/* Use back camera */
|
|
3338
|
+
}
|
|
3224
3339
|
<FileUpload
|
|
3225
3340
|
acceptedFiles="image/*"
|
|
3226
3341
|
mediaCapture="environment"
|
|
3227
3342
|
onFilesChange={setFiles}
|
|
3228
|
-
|
|
3343
|
+
/>;
|
|
3229
3344
|
```
|
|
3230
3345
|
|
|
3231
3346
|
### Non-clearable Files
|
|
3232
3347
|
|
|
3233
3348
|
```jsx
|
|
3234
|
-
<FileUpload
|
|
3235
|
-
onFilesChange={setFiles}
|
|
3236
|
-
clearable={false}
|
|
3237
|
-
/>
|
|
3349
|
+
<FileUpload onFilesChange={setFiles} clearable={false} />
|
|
3238
3350
|
```
|
|
3239
3351
|
|
|
3240
3352
|
### Complete Example with Dropzone Mode
|
|
@@ -3254,7 +3366,7 @@ const DropzoneExample = () => {
|
|
|
3254
3366
|
return (
|
|
3255
3367
|
<div className="max-w-2xl mx-auto p-6">
|
|
3256
3368
|
<h2 className="text-xl font-bold mb-4">Upload Your Images</h2>
|
|
3257
|
-
|
|
3369
|
+
|
|
3258
3370
|
<FileUpload
|
|
3259
3371
|
mode="dropzone"
|
|
3260
3372
|
acceptedFiles="image/png, image/jpeg, image/jpg"
|
|
@@ -3263,7 +3375,7 @@ const DropzoneExample = () => {
|
|
|
3263
3375
|
onFilesChange={handleFilesChange}
|
|
3264
3376
|
helperText="Upload up to 3 images. Max 5MB per file."
|
|
3265
3377
|
/>
|
|
3266
|
-
|
|
3378
|
+
|
|
3267
3379
|
{uploadedFiles.length > 0 && (
|
|
3268
3380
|
<div className="mt-4">
|
|
3269
3381
|
<p className="font-medium">Selected files:</p>
|
|
@@ -3291,7 +3403,7 @@ const TextInputExample = () => {
|
|
|
3291
3403
|
return (
|
|
3292
3404
|
<div className="max-w-2xl mx-auto p-6">
|
|
3293
3405
|
<h2 className="text-xl font-bold mb-4">Upload Documents</h2>
|
|
3294
|
-
|
|
3406
|
+
|
|
3295
3407
|
<FileUpload
|
|
3296
3408
|
mode="textinput"
|
|
3297
3409
|
acceptedFiles=".pdf, .doc, .docx"
|
|
@@ -3321,13 +3433,13 @@ import type { TextareaType } from "alope-ui";
|
|
|
3321
3433
|
|
|
3322
3434
|
### Props
|
|
3323
3435
|
|
|
3324
|
-
| Prop | Type
|
|
3325
|
-
| ----------------- |
|
|
3326
|
-
| `label` | `string`
|
|
3327
|
-
| `error` | `string`
|
|
3328
|
-
| `autoResize` | `boolean`
|
|
3329
|
-
| `customClassName` | `string`
|
|
3330
|
-
| `...props` | `InputHTMLAttributes<HTMLTextAreaElement>`
|
|
3436
|
+
| Prop | Type | Default | Description |
|
|
3437
|
+
| ----------------- | ------------------------------------------ | ----------- | -------------------------------------- |
|
|
3438
|
+
| `label` | `string` | `undefined` | Label text displayed above textarea |
|
|
3439
|
+
| `error` | `string` | `undefined` | Error message displayed below textarea |
|
|
3440
|
+
| `autoResize` | `boolean` | `false` | Enable auto-resize based on content |
|
|
3441
|
+
| `customClassName` | `string` | `""` | Custom CSS class for textarea element |
|
|
3442
|
+
| `...props` | `InputHTMLAttributes<HTMLTextAreaElement>` | - | All standard HTML textarea attributes |
|
|
3331
3443
|
|
|
3332
3444
|
### Basic Textarea
|
|
3333
3445
|
|
|
@@ -3381,7 +3493,7 @@ const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
|
3381
3493
|
onChange={handleChange}
|
|
3382
3494
|
error={error}
|
|
3383
3495
|
placeholder="Enter at least 10 characters..."
|
|
3384
|
-
|
|
3496
|
+
/>;
|
|
3385
3497
|
```
|
|
3386
3498
|
|
|
3387
3499
|
### Auto-Resize Textarea
|
|
@@ -3442,12 +3554,12 @@ const CompleteExample = () => {
|
|
|
3442
3554
|
|
|
3443
3555
|
const handleSubmit = (e: React.FormEvent) => {
|
|
3444
3556
|
e.preventDefault();
|
|
3445
|
-
|
|
3557
|
+
|
|
3446
3558
|
if (feedback.length < 20) {
|
|
3447
3559
|
setError("Feedback must be at least 20 characters");
|
|
3448
3560
|
return;
|
|
3449
3561
|
}
|
|
3450
|
-
|
|
3562
|
+
|
|
3451
3563
|
console.log("Feedback submitted:", feedback);
|
|
3452
3564
|
setFeedback("");
|
|
3453
3565
|
setError("");
|
|
@@ -3463,7 +3575,7 @@ const CompleteExample = () => {
|
|
|
3463
3575
|
return (
|
|
3464
3576
|
<form onSubmit={handleSubmit} className="max-w-lg mx-auto p-6">
|
|
3465
3577
|
<h2 className="text-xl font-bold mb-4">Share Your Feedback</h2>
|
|
3466
|
-
|
|
3578
|
+
|
|
3467
3579
|
<Textarea
|
|
3468
3580
|
label="Feedback"
|
|
3469
3581
|
name="feedback"
|
|
@@ -3474,11 +3586,11 @@ const CompleteExample = () => {
|
|
|
3474
3586
|
placeholder="Tell us what you think... (minimum 20 characters)"
|
|
3475
3587
|
customClassName="mb-4"
|
|
3476
3588
|
/>
|
|
3477
|
-
|
|
3589
|
+
|
|
3478
3590
|
<p className="text-sm text-gray-500 mb-4">
|
|
3479
3591
|
Character count: {feedback.length}
|
|
3480
3592
|
</p>
|
|
3481
|
-
|
|
3593
|
+
|
|
3482
3594
|
<button
|
|
3483
3595
|
type="submit"
|
|
3484
3596
|
className="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700"
|
|
@@ -3500,17 +3612,16 @@ const FormExample = () => {
|
|
|
3500
3612
|
const [formData, setFormData] = useState({
|
|
3501
3613
|
name: "",
|
|
3502
3614
|
message: "",
|
|
3503
|
-
comments: ""
|
|
3615
|
+
comments: "",
|
|
3504
3616
|
});
|
|
3505
3617
|
|
|
3506
|
-
const handleChange =
|
|
3507
|
-
e: React.ChangeEvent<HTMLTextAreaElement>
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
}
|
|
3513
|
-
};
|
|
3618
|
+
const handleChange =
|
|
3619
|
+
(field: string) => (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
3620
|
+
setFormData((prev) => ({
|
|
3621
|
+
...prev,
|
|
3622
|
+
[field]: e.target.value,
|
|
3623
|
+
}));
|
|
3624
|
+
};
|
|
3514
3625
|
|
|
3515
3626
|
return (
|
|
3516
3627
|
<div className="space-y-4 max-w-lg mx-auto p-6">
|
|
@@ -3518,16 +3629,16 @@ const FormExample = () => {
|
|
|
3518
3629
|
label="Message"
|
|
3519
3630
|
name="message"
|
|
3520
3631
|
value={formData.message}
|
|
3521
|
-
onChange={handleChange(
|
|
3632
|
+
onChange={handleChange("message")}
|
|
3522
3633
|
placeholder="Your message..."
|
|
3523
3634
|
rows={4}
|
|
3524
3635
|
/>
|
|
3525
|
-
|
|
3636
|
+
|
|
3526
3637
|
<Textarea
|
|
3527
3638
|
label="Additional Comments"
|
|
3528
3639
|
name="comments"
|
|
3529
3640
|
value={formData.comments}
|
|
3530
|
-
onChange={handleChange(
|
|
3641
|
+
onChange={handleChange("comments")}
|
|
3531
3642
|
placeholder="Any additional comments..."
|
|
3532
3643
|
autoResize
|
|
3533
3644
|
/>
|
|
@@ -3551,17 +3662,17 @@ import type { Tabs as TabType } from "alope-ui";
|
|
|
3551
3662
|
|
|
3552
3663
|
### Props
|
|
3553
3664
|
|
|
3554
|
-
| Prop
|
|
3555
|
-
|
|
|
3556
|
-
| `tabs`
|
|
3557
|
-
| `variant`
|
|
3558
|
-
| `fitted`
|
|
3559
|
-
| `wrapperClassName`
|
|
3560
|
-
| `buttonClassName`
|
|
3561
|
-
| `activeClassName`
|
|
3562
|
-
| `inactiveClassName`
|
|
3563
|
-
| `activeTab`
|
|
3564
|
-
| `onTabChange`
|
|
3665
|
+
| Prop | Type | Default | Description |
|
|
3666
|
+
| ------------------- | ------------------------------------------------------------------- | ----------- | ------------------------------ |
|
|
3667
|
+
| `tabs` | `TabType[]` | `required` | Array of tab objects |
|
|
3668
|
+
| `variant` | `'line' \| 'solid' \| 'subtle' \| 'inline' \| 'outline' \| 'plain'` | `'line'` | Visual variant style |
|
|
3669
|
+
| `fitted` | `boolean` | `false` | Make tabs fill available width |
|
|
3670
|
+
| `wrapperClassName` | `string` | `""` | Wrapper container CSS class |
|
|
3671
|
+
| `buttonClassName` | `string` | `""` | Tab button CSS class |
|
|
3672
|
+
| `activeClassName` | `string` | `""` | Active tab CSS class |
|
|
3673
|
+
| `inactiveClassName` | `string` | `""` | Inactive tab CSS class |
|
|
3674
|
+
| `activeTab` | `number` | `undefined` | Controlled active tab index |
|
|
3675
|
+
| `onTabChange` | `(index: number) => void` | `undefined` | Callback when tab changes |
|
|
3565
3676
|
|
|
3566
3677
|
### Tab Object Type
|
|
3567
3678
|
|
|
@@ -3571,7 +3682,7 @@ type Tabs = {
|
|
|
3571
3682
|
content: React.ReactNode;
|
|
3572
3683
|
disabled?: boolean;
|
|
3573
3684
|
link?: string;
|
|
3574
|
-
}
|
|
3685
|
+
};
|
|
3575
3686
|
```
|
|
3576
3687
|
|
|
3577
3688
|
### Basic Tabs
|
|
@@ -3602,30 +3713,44 @@ const BasicExample = () => {
|
|
|
3602
3713
|
### Variants
|
|
3603
3714
|
|
|
3604
3715
|
```jsx
|
|
3605
|
-
{
|
|
3606
|
-
|
|
3716
|
+
{
|
|
3717
|
+
/* Line Variant */
|
|
3718
|
+
}
|
|
3719
|
+
<Tabs tabs={tabs} variant="line" />;
|
|
3607
3720
|
|
|
3608
|
-
{
|
|
3609
|
-
|
|
3721
|
+
{
|
|
3722
|
+
/* Solid Variant */
|
|
3723
|
+
}
|
|
3724
|
+
<Tabs tabs={tabs} variant="solid" />;
|
|
3610
3725
|
|
|
3611
|
-
{
|
|
3612
|
-
|
|
3726
|
+
{
|
|
3727
|
+
/* Subtle Variant */
|
|
3728
|
+
}
|
|
3729
|
+
<Tabs tabs={tabs} variant="subtle" />;
|
|
3613
3730
|
|
|
3614
|
-
{
|
|
3615
|
-
|
|
3731
|
+
{
|
|
3732
|
+
/* Inline Variant */
|
|
3733
|
+
}
|
|
3734
|
+
<Tabs tabs={tabs} variant="inline" />;
|
|
3616
3735
|
|
|
3617
|
-
{
|
|
3618
|
-
|
|
3736
|
+
{
|
|
3737
|
+
/* Outline Variant */
|
|
3738
|
+
}
|
|
3739
|
+
<Tabs tabs={tabs} variant="outline" />;
|
|
3619
3740
|
|
|
3620
|
-
{
|
|
3621
|
-
|
|
3741
|
+
{
|
|
3742
|
+
/* Plain Variant */
|
|
3743
|
+
}
|
|
3744
|
+
<Tabs tabs={tabs} variant="plain" />;
|
|
3622
3745
|
```
|
|
3623
3746
|
|
|
3624
3747
|
### Fitted Tabs
|
|
3625
3748
|
|
|
3626
3749
|
```jsx
|
|
3627
|
-
{
|
|
3628
|
-
|
|
3750
|
+
{
|
|
3751
|
+
/* Tabs will fill the available width equally */
|
|
3752
|
+
}
|
|
3753
|
+
<Tabs tabs={tabs} fitted />;
|
|
3629
3754
|
```
|
|
3630
3755
|
|
|
3631
3756
|
### Controlled Tabs
|
|
@@ -3648,13 +3773,7 @@ const ControlledExample = () => {
|
|
|
3648
3773
|
},
|
|
3649
3774
|
];
|
|
3650
3775
|
|
|
3651
|
-
return
|
|
3652
|
-
<Tabs
|
|
3653
|
-
tabs={tabs}
|
|
3654
|
-
activeTab={activeTab}
|
|
3655
|
-
onTabChange={setActiveTab}
|
|
3656
|
-
/>
|
|
3657
|
-
);
|
|
3776
|
+
return <Tabs tabs={tabs} activeTab={activeTab} onTabChange={setActiveTab} />;
|
|
3658
3777
|
};
|
|
3659
3778
|
```
|
|
3660
3779
|
|
|
@@ -3673,7 +3792,7 @@ const tabs = [
|
|
|
3673
3792
|
},
|
|
3674
3793
|
];
|
|
3675
3794
|
|
|
3676
|
-
<Tabs tabs={tabs}
|
|
3795
|
+
<Tabs tabs={tabs} />;
|
|
3677
3796
|
```
|
|
3678
3797
|
|
|
3679
3798
|
### Tabs with Links
|
|
@@ -3692,7 +3811,7 @@ const tabs = [
|
|
|
3692
3811
|
},
|
|
3693
3812
|
];
|
|
3694
3813
|
|
|
3695
|
-
<Tabs tabs={tabs}
|
|
3814
|
+
<Tabs tabs={tabs} />;
|
|
3696
3815
|
```
|
|
3697
3816
|
|
|
3698
3817
|
### Custom Styling
|
|
@@ -3783,19 +3902,19 @@ import { Avatar } from "alope-ui";
|
|
|
3783
3902
|
|
|
3784
3903
|
### Props
|
|
3785
3904
|
|
|
3786
|
-
| Prop
|
|
3787
|
-
|
|
|
3788
|
-
| `imageSrc`
|
|
3789
|
-
| `fallbackName`
|
|
3790
|
-
| `fallbackColor`
|
|
3791
|
-
| `shape`
|
|
3792
|
-
| `variant`
|
|
3793
|
-
| `size`
|
|
3794
|
-
| `ring`
|
|
3795
|
-
| `ringClassName`
|
|
3796
|
-
| `alt`
|
|
3797
|
-
| `status`
|
|
3798
|
-
| `className`
|
|
3905
|
+
| Prop | Type | Default | Description |
|
|
3906
|
+
| --------------- | ------------------------------------------------------------------------- | ----------- | ------------------------------ |
|
|
3907
|
+
| `imageSrc` | `string` | `undefined` | URL of the avatar image |
|
|
3908
|
+
| `fallbackName` | `string` | `undefined` | Name to generate initials from |
|
|
3909
|
+
| `fallbackColor` | `'primary' \| 'error' \| 'warning' \| 'success' \| 'info' \| 'secondary'` | `'primary'` | Background color for fallback |
|
|
3910
|
+
| `shape` | `'sharp' \| 'cornered' \| 'rounded'` | `'rounded'` | Shape of the avatar |
|
|
3911
|
+
| `variant` | `'solid' \| 'outline'` | `'solid'` | Visual variant style |
|
|
3912
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Size of the avatar |
|
|
3913
|
+
| `ring` | `boolean` | `false` | Show ring around avatar |
|
|
3914
|
+
| `ringClassName` | `string` | `""` | Custom ring CSS class |
|
|
3915
|
+
| `alt` | `string` | `'avatar'` | Alt text for image |
|
|
3916
|
+
| `status` | `'online' \| 'offline'` | `undefined` | Status indicator |
|
|
3917
|
+
| `className` | `string` | `""` | Additional CSS class |
|
|
3799
3918
|
|
|
3800
3919
|
### Basic Avatar
|
|
3801
3920
|
|
|
@@ -3804,10 +3923,7 @@ import { Avatar } from "alope-ui";
|
|
|
3804
3923
|
|
|
3805
3924
|
const BasicExample = () => {
|
|
3806
3925
|
return (
|
|
3807
|
-
<Avatar
|
|
3808
|
-
imageSrc="https://i.pravatar.cc/150?img=1"
|
|
3809
|
-
alt="User Avatar"
|
|
3810
|
-
/>
|
|
3926
|
+
<Avatar imageSrc="https://i.pravatar.cc/150?img=1" alt="User Avatar" />
|
|
3811
3927
|
);
|
|
3812
3928
|
};
|
|
3813
3929
|
```
|
|
@@ -3815,129 +3931,133 @@ const BasicExample = () => {
|
|
|
3815
3931
|
### Fallback with Initials
|
|
3816
3932
|
|
|
3817
3933
|
```jsx
|
|
3818
|
-
{
|
|
3819
|
-
|
|
3934
|
+
{
|
|
3935
|
+
/* Avatar with fallback name */
|
|
3936
|
+
}
|
|
3937
|
+
<Avatar fallbackName="John Doe" />;
|
|
3820
3938
|
|
|
3821
|
-
{
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
/>
|
|
3939
|
+
{
|
|
3940
|
+
/* Avatar with no image (shows initials) */
|
|
3941
|
+
}
|
|
3942
|
+
<Avatar imageSrc="invalid-url.jpg" fallbackName="Jane Smith" />;
|
|
3826
3943
|
```
|
|
3827
3944
|
|
|
3828
3945
|
### Sizes
|
|
3829
3946
|
|
|
3830
3947
|
```jsx
|
|
3831
|
-
{
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
/>
|
|
3948
|
+
{
|
|
3949
|
+
/* Small */
|
|
3950
|
+
}
|
|
3951
|
+
<Avatar imageSrc="https://i.pravatar.cc/150?img=1" size="sm" />;
|
|
3836
3952
|
|
|
3837
|
-
{
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
/>
|
|
3953
|
+
{
|
|
3954
|
+
/* Medium */
|
|
3955
|
+
}
|
|
3956
|
+
<Avatar imageSrc="https://i.pravatar.cc/150?img=1" size="md" />;
|
|
3842
3957
|
|
|
3843
|
-
{
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
/>
|
|
3958
|
+
{
|
|
3959
|
+
/* Large */
|
|
3960
|
+
}
|
|
3961
|
+
<Avatar imageSrc="https://i.pravatar.cc/150?img=1" size="lg" />;
|
|
3848
3962
|
```
|
|
3849
3963
|
|
|
3850
3964
|
### Shapes
|
|
3851
3965
|
|
|
3852
3966
|
```jsx
|
|
3853
|
-
{
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
/>
|
|
3967
|
+
{
|
|
3968
|
+
/* Sharp corners */
|
|
3969
|
+
}
|
|
3970
|
+
<Avatar imageSrc="https://i.pravatar.cc/150?img=1" shape="sharp" />;
|
|
3858
3971
|
|
|
3859
|
-
{
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
/>
|
|
3972
|
+
{
|
|
3973
|
+
/* Cornered (slightly rounded) */
|
|
3974
|
+
}
|
|
3975
|
+
<Avatar imageSrc="https://i.pravatar.cc/150?img=1" shape="cornered" />;
|
|
3864
3976
|
|
|
3865
|
-
{
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
/>
|
|
3977
|
+
{
|
|
3978
|
+
/* Rounded (circular) */
|
|
3979
|
+
}
|
|
3980
|
+
<Avatar imageSrc="https://i.pravatar.cc/150?img=1" shape="rounded" />;
|
|
3870
3981
|
```
|
|
3871
3982
|
|
|
3872
3983
|
### Variants
|
|
3873
3984
|
|
|
3874
3985
|
```jsx
|
|
3875
|
-
{
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
/>
|
|
3986
|
+
{
|
|
3987
|
+
/* Solid variant */
|
|
3988
|
+
}
|
|
3989
|
+
<Avatar fallbackName="John Doe" variant="solid" />;
|
|
3880
3990
|
|
|
3881
|
-
{
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
/>
|
|
3991
|
+
{
|
|
3992
|
+
/* Outline variant */
|
|
3993
|
+
}
|
|
3994
|
+
<Avatar fallbackName="John Doe" variant="outline" />;
|
|
3886
3995
|
```
|
|
3887
3996
|
|
|
3888
3997
|
### Fallback Colors
|
|
3889
3998
|
|
|
3890
3999
|
```jsx
|
|
3891
|
-
{
|
|
3892
|
-
|
|
4000
|
+
{
|
|
4001
|
+
/* Primary color */
|
|
4002
|
+
}
|
|
4003
|
+
<Avatar fallbackName="John Doe" fallbackColor="primary" />;
|
|
3893
4004
|
|
|
3894
|
-
{
|
|
3895
|
-
|
|
4005
|
+
{
|
|
4006
|
+
/* Error color */
|
|
4007
|
+
}
|
|
4008
|
+
<Avatar fallbackName="John Doe" fallbackColor="error" />;
|
|
3896
4009
|
|
|
3897
|
-
{
|
|
3898
|
-
|
|
4010
|
+
{
|
|
4011
|
+
/* Warning color */
|
|
4012
|
+
}
|
|
4013
|
+
<Avatar fallbackName="John Doe" fallbackColor="warning" />;
|
|
3899
4014
|
|
|
3900
|
-
{
|
|
3901
|
-
|
|
4015
|
+
{
|
|
4016
|
+
/* Success color */
|
|
4017
|
+
}
|
|
4018
|
+
<Avatar fallbackName="John Doe" fallbackColor="success" />;
|
|
3902
4019
|
|
|
3903
|
-
{
|
|
3904
|
-
|
|
4020
|
+
{
|
|
4021
|
+
/* Info color */
|
|
4022
|
+
}
|
|
4023
|
+
<Avatar fallbackName="John Doe" fallbackColor="info" />;
|
|
3905
4024
|
|
|
3906
|
-
{
|
|
3907
|
-
|
|
4025
|
+
{
|
|
4026
|
+
/* Secondary color */
|
|
4027
|
+
}
|
|
4028
|
+
<Avatar fallbackName="John Doe" fallbackColor="secondary" />;
|
|
3908
4029
|
```
|
|
3909
4030
|
|
|
3910
4031
|
### With Ring
|
|
3911
4032
|
|
|
3912
4033
|
```jsx
|
|
3913
|
-
{
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
/>
|
|
4034
|
+
{
|
|
4035
|
+
/* Default ring */
|
|
4036
|
+
}
|
|
4037
|
+
<Avatar imageSrc="https://i.pravatar.cc/150?img=1" ring />;
|
|
3918
4038
|
|
|
3919
|
-
{
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
4039
|
+
{
|
|
4040
|
+
/* Custom ring color */
|
|
4041
|
+
}
|
|
4042
|
+
<Avatar
|
|
4043
|
+
imageSrc="https://i.pravatar.cc/150?img=1"
|
|
4044
|
+
ring
|
|
3923
4045
|
ringClassName="ring-success dark:ring-success-dark"
|
|
3924
|
-
|
|
4046
|
+
/>;
|
|
3925
4047
|
```
|
|
3926
4048
|
|
|
3927
4049
|
### Status Indicator
|
|
3928
4050
|
|
|
3929
4051
|
```jsx
|
|
3930
|
-
{
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
/>
|
|
4052
|
+
{
|
|
4053
|
+
/* Online status */
|
|
4054
|
+
}
|
|
4055
|
+
<Avatar imageSrc="https://i.pravatar.cc/150?img=1" status="online" />;
|
|
3935
4056
|
|
|
3936
|
-
{
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
/>
|
|
4057
|
+
{
|
|
4058
|
+
/* Offline status */
|
|
4059
|
+
}
|
|
4060
|
+
<Avatar imageSrc="https://i.pravatar.cc/150?img=1" status="offline" />;
|
|
3941
4061
|
```
|
|
3942
4062
|
|
|
3943
4063
|
### Complete Example
|
|
@@ -3957,7 +4077,7 @@ const CompleteExample = () => {
|
|
|
3957
4077
|
status="online"
|
|
3958
4078
|
alt="John Doe Avatar"
|
|
3959
4079
|
/>
|
|
3960
|
-
|
|
4080
|
+
|
|
3961
4081
|
<Avatar
|
|
3962
4082
|
imageSrc="https://i.pravatar.cc/150?img=2"
|
|
3963
4083
|
fallbackName="Jane Smith"
|
|
@@ -3985,13 +4105,13 @@ import type { AvatarGroupProps } from "alope-ui";
|
|
|
3985
4105
|
|
|
3986
4106
|
### Props
|
|
3987
4107
|
|
|
3988
|
-
| Prop
|
|
3989
|
-
|
|
|
3990
|
-
| `avatars`
|
|
3991
|
-
| `maxVisible`
|
|
3992
|
-
| `size`
|
|
3993
|
-
| `overlap`
|
|
3994
|
-
| `className`
|
|
4108
|
+
| Prop | Type | Default | Description |
|
|
4109
|
+
| ------------ | ---------------------- | ---------- | --------------------------------- |
|
|
4110
|
+
| `avatars` | `AvatarProps[]` | `required` | Array of avatar configurations |
|
|
4111
|
+
| `maxVisible` | `number` | `3` | Maximum number of visible avatars |
|
|
4112
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Size of all avatars in the group |
|
|
4113
|
+
| `overlap` | `string` | `'-ml-3'` | CSS class for overlap spacing |
|
|
4114
|
+
| `className` | `string` | `""` | Additional CSS class |
|
|
3995
4115
|
|
|
3996
4116
|
### Basic AvatarGroup
|
|
3997
4117
|
|
|
@@ -4020,34 +4140,48 @@ const avatars = [
|
|
|
4020
4140
|
{ imageSrc: "https://i.pravatar.cc/150?img=5", fallbackName: "User 5" },
|
|
4021
4141
|
];
|
|
4022
4142
|
|
|
4023
|
-
{
|
|
4024
|
-
|
|
4143
|
+
{
|
|
4144
|
+
/* Show only 3 avatars, rest shown as "+2" */
|
|
4145
|
+
}
|
|
4146
|
+
<AvatarGroup avatars={avatars} maxVisible={3} />;
|
|
4025
4147
|
```
|
|
4026
4148
|
|
|
4027
4149
|
### Different Sizes
|
|
4028
4150
|
|
|
4029
4151
|
```jsx
|
|
4030
|
-
{
|
|
4031
|
-
|
|
4152
|
+
{
|
|
4153
|
+
/* Small size */
|
|
4154
|
+
}
|
|
4155
|
+
<AvatarGroup avatars={avatars} size="sm" />;
|
|
4032
4156
|
|
|
4033
|
-
{
|
|
4034
|
-
|
|
4157
|
+
{
|
|
4158
|
+
/* Medium size */
|
|
4159
|
+
}
|
|
4160
|
+
<AvatarGroup avatars={avatars} size="md" />;
|
|
4035
4161
|
|
|
4036
|
-
{
|
|
4037
|
-
|
|
4162
|
+
{
|
|
4163
|
+
/* Large size */
|
|
4164
|
+
}
|
|
4165
|
+
<AvatarGroup avatars={avatars} size="lg" />;
|
|
4038
4166
|
```
|
|
4039
4167
|
|
|
4040
4168
|
### Custom Overlap
|
|
4041
4169
|
|
|
4042
4170
|
```jsx
|
|
4043
|
-
{
|
|
4044
|
-
|
|
4171
|
+
{
|
|
4172
|
+
/* More overlap */
|
|
4173
|
+
}
|
|
4174
|
+
<AvatarGroup avatars={avatars} overlap="-ml-4" />;
|
|
4045
4175
|
|
|
4046
|
-
{
|
|
4047
|
-
|
|
4176
|
+
{
|
|
4177
|
+
/* Less overlap */
|
|
4178
|
+
}
|
|
4179
|
+
<AvatarGroup avatars={avatars} overlap="-ml-2" />;
|
|
4048
4180
|
|
|
4049
|
-
{
|
|
4050
|
-
|
|
4181
|
+
{
|
|
4182
|
+
/* No overlap */
|
|
4183
|
+
}
|
|
4184
|
+
<AvatarGroup avatars={avatars} overlap="" />;
|
|
4051
4185
|
```
|
|
4052
4186
|
|
|
4053
4187
|
### Complete AvatarGroup Example
|
|
@@ -4057,28 +4191,28 @@ import { AvatarGroup } from "alope-ui";
|
|
|
4057
4191
|
|
|
4058
4192
|
const CompleteGroupExample = () => {
|
|
4059
4193
|
const teamMembers = [
|
|
4060
|
-
{
|
|
4061
|
-
imageSrc: "https://i.pravatar.cc/150?img=1",
|
|
4194
|
+
{
|
|
4195
|
+
imageSrc: "https://i.pravatar.cc/150?img=1",
|
|
4062
4196
|
fallbackName: "John Doe",
|
|
4063
|
-
status: "online"
|
|
4197
|
+
status: "online",
|
|
4064
4198
|
},
|
|
4065
|
-
{
|
|
4066
|
-
imageSrc: "https://i.pravatar.cc/150?img=2",
|
|
4199
|
+
{
|
|
4200
|
+
imageSrc: "https://i.pravatar.cc/150?img=2",
|
|
4067
4201
|
fallbackName: "Jane Smith",
|
|
4068
|
-
status: "online"
|
|
4202
|
+
status: "online",
|
|
4069
4203
|
},
|
|
4070
|
-
{
|
|
4071
|
-
imageSrc: "https://i.pravatar.cc/150?img=3",
|
|
4204
|
+
{
|
|
4205
|
+
imageSrc: "https://i.pravatar.cc/150?img=3",
|
|
4072
4206
|
fallbackName: "Bob Wilson",
|
|
4073
|
-
status: "offline"
|
|
4207
|
+
status: "offline",
|
|
4074
4208
|
},
|
|
4075
|
-
{
|
|
4209
|
+
{
|
|
4076
4210
|
fallbackName: "Alice Brown",
|
|
4077
|
-
fallbackColor: "success"
|
|
4211
|
+
fallbackColor: "success",
|
|
4078
4212
|
},
|
|
4079
|
-
{
|
|
4213
|
+
{
|
|
4080
4214
|
fallbackName: "Charlie Davis",
|
|
4081
|
-
fallbackColor: "info"
|
|
4215
|
+
fallbackColor: "info",
|
|
4082
4216
|
},
|
|
4083
4217
|
];
|
|
4084
4218
|
|
|
@@ -4109,4 +4243,4 @@ MIT License – Free to use, modify, and distribute.
|
|
|
4109
4243
|
|
|
4110
4244
|
## 🙌 Thank You
|
|
4111
4245
|
|
|
4112
|
-
Thank you for using **ALOPE UI Library**. We hope this helps you build beautiful and functional user interfaces with ease.
|
|
4246
|
+
Thank you for using **ALOPE UI Library**. We hope this helps you build beautiful and functional user interfaces with ease.
|