diff --git a/projects/composition/src/app/pages/progress-circular-page/progress-circular-page.component.html b/projects/composition/src/app/pages/progress-circular-page/progress-circular-page.component.html
index a1bff2128..2d6de447a 100644
--- a/projects/composition/src/app/pages/progress-circular-page/progress-circular-page.component.html
+++ b/projects/composition/src/app/pages/progress-circular-page/progress-circular-page.component.html
@@ -8,19 +8,23 @@
Loader component
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/projects/composition/src/app/pages/progress-circular-page/progress-circular-page.component.ts b/projects/composition/src/app/pages/progress-circular-page/progress-circular-page.component.ts
index edba8620b..47a9aebdb 100644
--- a/projects/composition/src/app/pages/progress-circular-page/progress-circular-page.component.ts
+++ b/projects/composition/src/app/pages/progress-circular-page/progress-circular-page.component.ts
@@ -2,14 +2,17 @@ import { Component } from '@angular/core';
import { RouterModule } from '@angular/router';
import { CpsIconComponent, CpsProgressCircularComponent } from 'cps-ui-kit';
import { ComponentDocsViewerComponent } from '../../components/component-docs-viewer/component-docs-viewer.component';
+import { CodeExampleComponent } from '../../components/code-example/code-example.component';
import ComponentData from '../../api-data/cps-progress-circular.json';
+import { progressCircularExamples } from './progress-circular-page.examples';
@Component({
imports: [
CpsIconComponent,
CpsProgressCircularComponent,
ComponentDocsViewerComponent,
- RouterModule
+ RouterModule,
+ CodeExampleComponent
],
selector: 'app-progress-circular-page',
templateUrl: './progress-circular-page.component.html',
@@ -18,4 +21,5 @@ import ComponentData from '../../api-data/cps-progress-circular.json';
})
export class ProgressCircularPageComponent {
componentData = ComponentData;
+ readonly examples = progressCircularExamples;
}
diff --git a/projects/composition/src/app/pages/progress-circular-page/progress-circular-page.examples.ts b/projects/composition/src/app/pages/progress-circular-page/progress-circular-page.examples.ts
new file mode 100644
index 000000000..7a2c51e64
--- /dev/null
+++ b/projects/composition/src/app/pages/progress-circular-page/progress-circular-page.examples.ts
@@ -0,0 +1,23 @@
+export const progressCircularExamples: Record<
+ string,
+ { html: string; ts?: string }
+> = {
+ variants: {
+ html: `
+
+
+
+
+
+
`
+ }
+};
diff --git a/projects/composition/src/app/pages/progress-linear-page/progress-linear-page.component.html b/projects/composition/src/app/pages/progress-linear-page/progress-linear-page.component.html
index 9366a925d..eb1e96dba 100644
--- a/projects/composition/src/app/pages/progress-linear-page/progress-linear-page.component.html
+++ b/projects/composition/src/app/pages/progress-linear-page/progress-linear-page.component.html
@@ -1,24 +1,26 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/projects/composition/src/app/pages/progress-linear-page/progress-linear-page.component.ts b/projects/composition/src/app/pages/progress-linear-page/progress-linear-page.component.ts
index 2277a136a..478c81dc6 100644
--- a/projects/composition/src/app/pages/progress-linear-page/progress-linear-page.component.ts
+++ b/projects/composition/src/app/pages/progress-linear-page/progress-linear-page.component.ts
@@ -1,11 +1,16 @@
import { Component } from '@angular/core';
import { CpsProgressLinearComponent } from 'cps-ui-kit';
-
import ComponentData from '../../api-data/cps-progress-linear.json';
import { ComponentDocsViewerComponent } from '../../components/component-docs-viewer/component-docs-viewer.component';
+import { CodeExampleComponent } from '../../components/code-example/code-example.component';
+import { progressLinearExamples } from './progress-linear-page.examples';
@Component({
- imports: [CpsProgressLinearComponent, ComponentDocsViewerComponent],
+ imports: [
+ CpsProgressLinearComponent,
+ ComponentDocsViewerComponent,
+ CodeExampleComponent
+ ],
selector: 'app-progress-linear-page',
templateUrl: './progress-linear-page.component.html',
styleUrls: ['./progress-linear-page.component.scss'],
@@ -13,4 +18,5 @@ import { ComponentDocsViewerComponent } from '../../components/component-docs-vi
})
export class ProgressLinearPageComponent {
componentData = ComponentData;
+ readonly examples = progressLinearExamples;
}
diff --git a/projects/composition/src/app/pages/progress-linear-page/progress-linear-page.examples.ts b/projects/composition/src/app/pages/progress-linear-page/progress-linear-page.examples.ts
new file mode 100644
index 000000000..bd6c95375
--- /dev/null
+++ b/projects/composition/src/app/pages/progress-linear-page/progress-linear-page.examples.ts
@@ -0,0 +1,29 @@
+export const progressLinearExamples: Record<
+ string,
+ { html: string; ts?: string }
+> = {
+ variants: {
+ html: `
+
+
+
+
+
+
+
+
`
+ }
+};
diff --git a/projects/composition/src/app/pages/radio-page/radio-page.component.html b/projects/composition/src/app/pages/radio-page/radio-page.component.html
index ad0b037ce..70fde3e68 100644
--- a/projects/composition/src/app/pages/radio-page/radio-page.component.html
+++ b/projects/composition/src/app/pages/radio-page/radio-page.component.html
@@ -1,6 +1,9 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Selected value: {{ syncVal }}
+
+
+
-
+
diff --git a/projects/composition/src/app/pages/radio-page/radio-page.component.scss b/projects/composition/src/app/pages/radio-page/radio-page.component.scss
index 766e0aa98..f768e508f 100644
--- a/projects/composition/src/app/pages/radio-page/radio-page.component.scss
+++ b/projects/composition/src/app/pages/radio-page/radio-page.component.scss
@@ -1,9 +1,3 @@
-.radiogroups-group {
- gap: 2.25rem;
- display: flex;
- flex-direction: column;
-}
-
.sync-val-example {
.sync-val {
margin-top: 1rem;
diff --git a/projects/composition/src/app/pages/radio-page/radio-page.component.ts b/projects/composition/src/app/pages/radio-page/radio-page.component.ts
index 45f3a5883..f70572799 100644
--- a/projects/composition/src/app/pages/radio-page/radio-page.component.ts
+++ b/projects/composition/src/app/pages/radio-page/radio-page.component.ts
@@ -15,9 +15,10 @@ import {
CpsSelectComponent,
CpsRadioOption
} from 'cps-ui-kit';
-
import ComponentData from '../../api-data/cps-radio-group.json';
import { ComponentDocsViewerComponent } from '../../components/component-docs-viewer/component-docs-viewer.component';
+import { CodeExampleComponent } from '../../components/code-example/code-example.component';
+import { radioExamples } from './radio-page.examples';
@Component({
imports: [
@@ -27,7 +28,8 @@ import { ComponentDocsViewerComponent } from '../../components/component-docs-vi
CpsRadioComponent,
CpsSelectComponent,
CpsCheckboxComponent,
- ComponentDocsViewerComponent
+ ComponentDocsViewerComponent,
+ CodeExampleComponent
],
selector: 'app-radio-page',
templateUrl: './radio-page.component.html',
@@ -35,6 +37,7 @@ import { ComponentDocsViewerComponent } from '../../components/component-docs-vi
host: { class: 'composition-page' }
})
export class RadioPageComponent implements OnInit {
+ readonly examples = radioExamples;
form!: UntypedFormGroup;
options: CpsRadioOption[] = [
@@ -106,7 +109,7 @@ export class RadioPageComponent implements OnInit {
if (!val) return null;
if (val !== 'third') {
- return { mustMatch8Dig: 'Only third option must be selected' };
+ return { mustSelectThird: 'Only third option must be selected' };
}
return null;
}
diff --git a/projects/composition/src/app/pages/radio-page/radio-page.examples.ts b/projects/composition/src/app/pages/radio-page/radio-page.examples.ts
new file mode 100644
index 000000000..85bc6fde3
--- /dev/null
+++ b/projects/composition/src/app/pages/radio-page/radio-page.examples.ts
@@ -0,0 +1,198 @@
+const radioOptionsTs = `
+options: CpsRadioOption[] = [
+ { label: 'Option 1', value: 'first' },
+ { label: 'Option 2', value: 'second' },
+ { label: 'Option 3', value: 'third' }
+];`;
+
+export const radioExamples: Record = {
+ requiredRadioGroup: {
+ html: `
+`,
+ ts: `
+private readonly _formBuilder = inject(UntypedFormBuilder);
+
+${radioOptionsTs.trim()}
+
+form!: UntypedFormGroup;
+
+ngOnInit() {
+ this.form = this._formBuilder.group({
+ requiredRadio: [
+ '',
+ [
+ Validators.required,
+ (control: AbstractControl): ValidationErrors | null =>
+ this._checkThirdSelected(control)
+ ]
+ ]
+ });
+}
+
+private _checkThirdSelected(control: AbstractControl): ValidationErrors | null {
+ const val = control.value;
+ if (!val) return null;
+
+ if (val !== 'third') {
+ return { mustSelectThird: 'Only third option must be selected' };
+ }
+ return null;
+}`
+ },
+
+ tooltipRadioGroup: {
+ html: `
+
+`,
+ ts: radioOptionsTs
+ },
+
+ verticalRadioGroup: {
+ html: `
+
+`,
+ ts: radioOptionsTs
+ },
+
+ disabledVerticalRadioGroup: {
+ html: `
+
+`,
+ ts: radioOptionsTs
+ },
+
+ partiallyDisabledRadioGroup: {
+ html: `
+
+`,
+ ts: `
+partiallyDisabledOptions: CpsRadioOption[] = [
+ {
+ label: 'Option 1',
+ value: 'first',
+ disabled: true,
+ tooltip: 'First option is currently unavailable'
+ },
+ { label: 'Option 2', value: 'second' },
+ {
+ label: 'Option 3',
+ value: 'third',
+ disabled: true,
+ tooltip: 'Third option is currently unavailable'
+ },
+ { label: 'Option 4', value: 'fourth' }
+];`
+ },
+
+ twoWayBindingRadioGroup: {
+ html: `
+
+
+
+
Selected value: {{ syncVal }}
+
`,
+ ts: `
+${radioOptionsTs.trim()}
+
+syncVal = 'first';`
+ },
+
+ customContentRadioGroup: {
+ html: `
+
+
+
+ On the
+
+
+ of every
+
+
+ month(s) at
+
+
+ :
+
+
+
+
+
+
+`,
+ ts: `
+dayOptions = [
+ { name: '1st day', data: { code: '1' } },
+ { name: '2nd day', data: { code: '2' } },
+ { name: '3rd day', data: { code: '3' } }
+];
+
+monthOptions = [...Array(12).keys()].map((n) => ({
+ name: n + 1,
+ data: { code: n + 1 }
+}));
+
+hourOptions = [...Array(24).keys()].map((n) => ({
+ name: n,
+ data: { code: n }
+}));
+
+minuteOptions = [...Array(60).keys()].map((n) => ({
+ name: n,
+ data: { code: n }
+}));`
+ }
+};