@stackloop/ui 4.0.9 → 4.1.0
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 +59 -4
- package/dist/Accordion.d.ts +18 -0
- package/dist/assets/index-B5bbIoAj.js +17 -0
- package/dist/assets/index-s9Mdf6_E.css +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.html +2 -2
- package/dist/index.js +1375 -1278
- package/dist/index.js.map +1 -1
- package/dist/stackloop-ui.css +1 -1
- package/package.json +1 -1
- package/dist/assets/index-DHBqG65w.js +0 -17
- package/dist/assets/index-Z5A9fp3I.css +0 -1
package/README.md
CHANGED
|
@@ -47,7 +47,6 @@ If using Tailwind CSS v4 with `@theme`, the library's theme variables are alread
|
|
|
47
47
|
@theme {
|
|
48
48
|
/* Override library colors */
|
|
49
49
|
--color-primary: #your-color;
|
|
50
|
-
--color-primary-dark: #your-darker-color;
|
|
51
50
|
--color-border: #your-border-color;
|
|
52
51
|
--color-border-dark: #your-darker-border;
|
|
53
52
|
--color-secondary: #your-secondary-bg;
|
|
@@ -88,7 +87,6 @@ The library uses a simplified color system with semantic variables:
|
|
|
88
87
|
| Variable | Default | Description |
|
|
89
88
|
|----------|---------|-------------|
|
|
90
89
|
| `--color-primary` | `#525252` | Primary brand color |
|
|
91
|
-
| `--color-primary-dark` | `#404040` | Darker primary variant |
|
|
92
90
|
| `--color-border` | `#e5e5e5` | Default border color |
|
|
93
91
|
| `--color-border-dark` | `#d4d4d4` | Darker border variant |
|
|
94
92
|
| `--color-secondary` | `#fafafa` | Secondary background |
|
|
@@ -110,7 +108,6 @@ Create a custom theme file or extend the existing one:
|
|
|
110
108
|
@theme {
|
|
111
109
|
/* Brand colors */
|
|
112
110
|
--color-primary: #3b82f6;
|
|
113
|
-
--color-primary-dark: #2563eb;
|
|
114
111
|
|
|
115
112
|
/* Borders */
|
|
116
113
|
--color-border: #e2e8f0;
|
|
@@ -163,7 +160,7 @@ import { Button, Modal } from '@stackloop/ui'
|
|
|
163
160
|
|
|
164
161
|
Components with the `animate` prop:
|
|
165
162
|
|
|
166
|
-
- `AudioRecorder`, `Badge`, `BottomSheet`, `Button`, `Card`, `CameraCapture`, `Checkbox`, `CountrySelect`, `DatePicker`, `Drawer`, `Dropdown`, `DualSlider`, `FileUploader`, `FloatingActionButton`, `Input`, `Modal`, `MultiSelect`, `Pagination`, `PhoneInput`, `RadioPills`, `Select`, `Slider`, `Spinner`, `StepProgress`, `Table`, `Textarea`, `ThumbnailGrid`, `Toggle`, `ToastProvider`
|
|
163
|
+
- `Accordion`, `AudioRecorder`, `Badge`, `BottomSheet`, `Button`, `Card`, `CameraCapture`, `Checkbox`, `CountrySelect`, `DatePicker`, `Drawer`, `Dropdown`, `DualSlider`, `FileUploader`, `FloatingActionButton`, `Input`, `Modal`, `MultiSelect`, `Pagination`, `PhoneInput`, `RadioPills`, `Select`, `Slider`, `Spinner`, `StepProgress`, `Table`, `Textarea`, `ThumbnailGrid`, `Toggle`, `ToastProvider`
|
|
167
164
|
|
|
168
165
|
## Ripple Behavior
|
|
169
166
|
|
|
@@ -1245,6 +1242,64 @@ Call `setupRippleEffects()` only once per app (for example in `main.tsx`) to avo
|
|
|
1245
1242
|
<ThumbnailGrid items={items} onRemove={(id)=>{}} />
|
|
1246
1243
|
```
|
|
1247
1244
|
|
|
1245
|
+
**Accordion**:
|
|
1246
|
+
- **Description:** Expandable/collapsible content sections with smooth animations. Supports single or multiple open items with customizable styling.
|
|
1247
|
+
- **Props:**
|
|
1248
|
+
- **`items`**: `{ id: string; title: string|ReactNode; content: string|ReactNode; disabled?: boolean; icon?: ReactNode }[]` — required.
|
|
1249
|
+
- **`variant`**: `'default'|'bordered'` — default: `'default'`. Controls border styling (top border only for default, full border for bordered).
|
|
1250
|
+
- **`allowMultiple`**: `boolean` — default: `false`. When `false`, only one item can be open at a time. When `true`, multiple items can be open.
|
|
1251
|
+
- **`defaultOpen`**: `string[]` — default: `[]`. Array of item IDs that should be open initially.
|
|
1252
|
+
- **`onChange`**: `(openItems: string[]) => void` — optional. Called whenever the open state changes.
|
|
1253
|
+
- **`className`**: `string` — optional.
|
|
1254
|
+
- **Features:**
|
|
1255
|
+
- Smooth height and opacity animations on expand/collapse using Framer Motion.
|
|
1256
|
+
- No rounded borders, only border-top styling for clean appearance.
|
|
1257
|
+
- Optional icons support for each accordion item.
|
|
1258
|
+
- Disabled state support for individual items.
|
|
1259
|
+
- Hover effects and smooth transitions.
|
|
1260
|
+
- **Usage:**
|
|
1261
|
+
|
|
1262
|
+
```jsx
|
|
1263
|
+
import { Accordion } from '@stackloop/ui'
|
|
1264
|
+
|
|
1265
|
+
// Single open mode (default)
|
|
1266
|
+
<Accordion
|
|
1267
|
+
items={[
|
|
1268
|
+
{
|
|
1269
|
+
id: 'item1',
|
|
1270
|
+
title: 'Question 1',
|
|
1271
|
+
content: 'Answer 1'
|
|
1272
|
+
},
|
|
1273
|
+
{
|
|
1274
|
+
id: 'item2',
|
|
1275
|
+
title: 'Question 2',
|
|
1276
|
+
content: 'Answer 2'
|
|
1277
|
+
}
|
|
1278
|
+
]}
|
|
1279
|
+
defaultOpen={['item1']}
|
|
1280
|
+
/>
|
|
1281
|
+
|
|
1282
|
+
// Multiple open mode
|
|
1283
|
+
<Accordion
|
|
1284
|
+
items={[
|
|
1285
|
+
{
|
|
1286
|
+
id: 'section1',
|
|
1287
|
+
title: 'Section 1',
|
|
1288
|
+
content: 'Content 1',
|
|
1289
|
+
icon: <Icon />
|
|
1290
|
+
},
|
|
1291
|
+
{
|
|
1292
|
+
id: 'section2',
|
|
1293
|
+
title: 'Section 2',
|
|
1294
|
+
content: 'Content 2'
|
|
1295
|
+
}
|
|
1296
|
+
]}
|
|
1297
|
+
allowMultiple={true}
|
|
1298
|
+
defaultOpen={['section1']}
|
|
1299
|
+
onChange={(openItems) => console.log(openItems)}
|
|
1300
|
+
/>
|
|
1301
|
+
```
|
|
1302
|
+
|
|
1248
1303
|
**Card**:
|
|
1249
1304
|
- **Description:** Generic card container with variants and content subcomponents.
|
|
1250
1305
|
- **Props:**
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface AccordionItemProps {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string | React.ReactNode;
|
|
5
|
+
content: string | React.ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface AccordionProps {
|
|
10
|
+
items: AccordionItemProps[];
|
|
11
|
+
variant?: 'default' | 'bordered';
|
|
12
|
+
allowMultiple?: boolean;
|
|
13
|
+
defaultOpen?: string[];
|
|
14
|
+
className?: string;
|
|
15
|
+
onChange?: (openItems: string[]) => void;
|
|
16
|
+
animate?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const Accordion: React.FC<AccordionProps>;
|