Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
e60cb1a
chore: add skipStorybook option fro ui component generator
miladfm May 29, 2025
e4365ba
chore: add central configuration for stories subComponent docs
miladfm May 29, 2025
bc3c319
chore: fix ui core component name generator
miladfm May 29, 2025
e33e9cd
chore: fix storybook auto generated file for ui component generator
miladfm May 29, 2025
c9b2065
feat(accordion): create empty library and component for accordion
miladfm May 29, 2025
252434d
chore: update cSpell configuration to include additional words
miladfm Jun 7, 2025
f473d85
feat(common-icons): add minus icon to the icon set
miladfm Jun 7, 2025
26f9338
feat(common-utils): add animation and math, improve selection
miladfm Jun 7, 2025
d64e136
feat(storybook-addon-theme): add any selection for single control, ad…
miladfm Jun 7, 2025
f7f04d8
chore: add postcss `where` selector plugin for and apply it to all th…
miladfm Jun 7, 2025
b25e755
feat(angular-accordion): implement angular accordion with overview ex…
miladfm Jun 7, 2025
1cd0c86
feat(accordion): add react, fix angular, add cocokits theme
miladfm Jun 15, 2025
150e842
feat(accordion): enhance TypeScript type parsing and accordion compon…
miladfm Jun 15, 2025
6685036
fix(accordion): fix doc and typedoc redering
miladfm Jun 15, 2025
917713d
fix(accordion): update package dependencies for angular and react acc…
miladfm Jun 15, 2025
e5bd4c2
fix(angular-accordion): correct project path references in project.json
miladfm Jun 19, 2025
45d6564
fix(react-accordion): update useCreateAccordionStore to require confi…
miladfm Jun 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"ignoreFiles": ["node_modules/**", "dist/**"],
"plugins": ["stylelint-scss"],
"rules": {
"no-duplicate-selectors": null,
"scss/dollar-variable-pattern": "[a-zA-Z0-9-_]*",
"scss/at-mixin-pattern": "[a-zA-Z0-9-_]*",
"scss/load-no-partial-leading-underscore": null,
Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{
"eslint.validate": ["json"],
"cSpell.dictionaries": ["lorem-ipsum"],
"cSpell.words": [
"autodocs",
"camelcase",
"Checkmark",
"compodoc",
"cssmodule",
"griffel",
"mixedmark",
"ochin",
"prismjs",
"radi",
"sbdocs",
"shiki",
"shikijs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const meta: StoriesMeta = {
},
cckAddon: {
componentName: 'overlay',
subcomponentNames: {
OverlayService: null,
subcomponents: {
OverlayService: { name: null },
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ export function getMergeThemesStep3Scss() {
@include Cocokits.components_avatar;
@include Cocokits.components_avatar_group;
@include Cocokits.components_avatar_label;
@include Cocokits.components_accordion;
@include Cocokits.components_accordion_header;
@include Cocokits.components_accordion_panel;

`);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
The core wrapper that manages the state and structure of all panels. It handles global behavior such as single/multiple expansion, nesting, accessibility, and keyboard control.

**Features:**
- **Custom Icon Template:**
Allow developers to define a custom template for the expand/collapse icon, supporting branding or UI consistency.

- **Expansion Mode:**
Support both single and multiple expanded panels simultaneously, configurable via input.

- **Icon Position:**
Provide option to render the expand/collapse icon on either the left or right side of the header.

- **Custom Header:**
Support default text headers or fully custom templates for complete flexibility in UI design.

- **Toggle Animation:**
Option to enable or disable transition animation for smoother or snappier UX.

- **Disabled Panel:**
Disable specific panels to prevent user interaction and indicate non-interactive state.

- **Dynamic Control:**
Expose imperative methods to programmatically expand or collapse individual panels or groups.

- **Expand/Collapse All:**
Allow batch toggle actions to expand or collapse all panels at once, useful in dashboards or summaries.

- **Nested Support:**
Support placing accordions inside accordion content, enabling complex hierarchical layouts.
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { applicationConfig, moduleMetadata } from '@storybook/angular';

import {
AccordionComponent,
AccordionHeaderComponent,
AccordionHeaderIconTemplateDirective,
AccordionPanelComponent,
} from '@cocokits/angular-accordion';
import { IconButtonComponent } from '@cocokits/angular-button';
import { SvgIconComponent } from '@cocokits/angular-icon';
import { StoriesMeta, withThemeConfigProvider, withWrapperDecorator } from '@cocokits/storybook-addon-theme-angular';

import descriptionMd from './description.md';
import ngTemplateMd from './ng-templates.md';

export { Default } from './overview/default.stories';
export { Type } from './overview/type.stories';
export { Size } from './overview/size.stories';
export { Color } from './overview/color.stories';
export { Disabled } from './overview/disabled.stories';
export { CustomIcon } from './overview/custom-icon.stories';
export { Nested } from './overview/nested.stories';
export { Control } from './overview/control.stories';

const meta: StoriesMeta = {
component: AccordionComponent,
title: 'UI Components/Accordion',
tags: ['status:new'],
subcomponents: [AccordionPanelComponent, AccordionHeaderComponent],
decorators: [
withWrapperDecorator({ insideBox: true }, { width: '400px' }),
applicationConfig({
providers: [withThemeConfigProvider()],
}),
moduleMetadata({
imports: [
IconButtonComponent,
SvgIconComponent,
AccordionPanelComponent,
AccordionHeaderComponent,
AccordionHeaderIconTemplateDirective,
],
}),
],
parameters: {
docs: {
description: {
component: [descriptionMd].join('\n'),
},
},
cckAddon: {
componentName: 'accordion',
ngTemplateMarkdown: ngTemplateMd,
subcomponents: {
AccordionPanelComponent: {
name: 'accordionPanel',
description:
'A collapsible section inside an accordion. Each panel works independently but syncs with the parent for state tracking and expansion logic.',
argsTypes: {
value: {
table: {
type: { summary: 'TValue[] | TValue' },
defaultValue: { summary: 'A unique ID is generated automatically' },
},
},
disabled: { table: { type: { summary: 'boolean' }, defaultValue: { summary: '' } } },
},
},
AccordionHeaderComponent: {
name: 'accordionHeader',
description:
'Acts as the toggle button for the panel. It can be styled or fully replaced using custom children, enabling full flexibility in the header’s layout and content.',
},
},
},
},
argTypes: {
expanded: { table: { type: { summary: 'TValue[] | TValue' }, defaultValue: { summary: '' } } },
expandedChange: { table: { category: 'outputs', type: { summary: 'TValue[] | TValue' } } },
iconPosition: { table: { type: { summary: 'left | right' }, defaultValue: { summary: 'right' } } },
toggleTrigger: { table: { type: { summary: 'header | icon' }, defaultValue: { summary: 'header' } } },
},
};
export default meta;
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
### Custom Accordion Header Icon
Use this template to display a custom icon inside the accordion header. This is helpful when you want full control over how the expand/collapse icon looks or behaves depending on the state of the accordion.

**Selector:** `ng-template[cckAccordionHeaderIcon]`

**Reference:** `AccordionHeaderIconTemplateDirective`


It can be defined at two levels:

- Under `cck-accordion:` applies to all panels
- Under each `cck-accordion-panel`: applies only to the target panel


**Context Properties:**

| Name | Type | Description |
|---------------|------ ----|--------------------------------------|
| `isExpanded` | `boolean` | Whether the accordion is expanded. |
| `disabled ` | `boolean` | Whether the accordion is disabled. |

**Usage Example:**

```html
<cck-accordion>
<ng-template cckAccordionHeaderIcon let-isExpanded="isExpanded" let-disabled="disabled">
<button cck-icon-button>
<cck-svg-icon
[icon]="isExpanded ? Icons.arrowUp : Icons.arrowDown"
[style.opacity]="disabled ? 0.5 : 1"
/>
</button>
</ng-template>
</cck-accordion>
```

For advance example check the overview tab

**Important:** When this template is used, the default expand/collapse icon along with all its functionality (such as animation, hover effects, etc.) will be removed. However, the click handler remains unchanged, and only the custom icon from your template will be rendered.
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { AccordionComponent } from '@cocokits/angular-accordion';
import { CCK_CONTROL, renderWithPageTab, renderWithThemeProp } from '@cocokits/storybook-addon-theme';
import { StoryObj } from '@cocokits/storybook-addon-theme-angular';

export const Color: StoryObj<AccordionComponent> = {
name: 'Color',
parameters: {
docs: {
description: {
story: 'Color options enable seamless integration with various themes or to highlight specific actions.',
},
},
cckAddon: {
renderConditions: [renderWithThemeProp('color'), renderWithPageTab('Overview')],
singleControls: ['type'],
source: [
{
filename: 'example.component.html',
language: 'angular-html',
code: `
<% themeComponentConfig.color.values.map(color => { %>
<cck-accordion
<% if (typeof type !== 'undefined') { %> type='<%= type %>' <% } %>
color='<%= color %>'
>
<cck-accordion-panel>
<cck-accordion-header>Accordion Header 1</cck-accordion-header>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</cck-accordion-panel>

<cck-accordion-panel>
<cck-accordion-header>Accordion Header 2</cck-accordion-header>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</cck-accordion-panel>

<cck-accordion-panel>
<cck-accordion-header>Accordion Header 3</cck-accordion-header>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</cck-accordion-panel>
</cck-accordion>
<% }) %>
`,
},
],
controls: [CCK_CONTROL.type()],
},
},
render: (args) => ({
props: {
...args,
},
template: `
@for (color of cckControl.themeComponentConfig.color.values; let col = $index; track color) {
<h4 class='cck-doc-story__header'>{{color}}</h4>
<cck-accordion [type]="cckControl.type" [color]="color">
<h5 style="width: 100%; margin: 0">{{ color }}</h5>
<cck-accordion-panel>
<cck-accordion-header>Accordion Header 1</cck-accordion-header>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</cck-accordion-panel>

<cck-accordion-panel>
<cck-accordion-header>Accordion Header 2</cck-accordion-header>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</cck-accordion-panel>

<cck-accordion-panel>
<cck-accordion-header>Accordion Header 3</cck-accordion-header>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</cck-accordion-panel>
</cck-accordion>
}
`,
}),
};
Loading