@stackloop/ui 4.0.10 → 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 CHANGED
@@ -160,7 +160,7 @@ import { Button, Modal } from '@stackloop/ui'
160
160
 
161
161
  Components with the `animate` prop:
162
162
 
163
- - `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`
164
164
 
165
165
  ## Ripple Behavior
166
166
 
@@ -1242,6 +1242,64 @@ Call `setupRippleEffects()` only once per app (for example in `main.tsx`) to avo
1242
1242
  <ThumbnailGrid items={items} onRemove={(id)=>{}} />
1243
1243
  ```
1244
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
+
1245
1303
  **Card**:
1246
1304
  - **Description:** Generic card container with variants and content subcomponents.
1247
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>;