Skip to content
Snippets Groups Projects
Commit 750cadf6 authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

chore: mark inputs as required

parent 959a5975
No related branches found
No related tags found
2 merge requests!783V3.0.0,!669chore: mark inputs as required
Showing
with 30 additions and 20 deletions
...@@ -28,7 +28,7 @@ import { ModalV3Component } from './v3/modal/modal.component'; ...@@ -28,7 +28,7 @@ import { ModalV3Component } from './v3/modal/modal.component';
import { RadioV3Component } from './v3/radio/radio.component'; import { RadioV3Component } from './v3/radio/radio.component';
import { SearchBarV3Component } from './v3/search-bar/search-bar.component'; import { SearchBarV3Component } from './v3/search-bar/search-bar.component';
import { SwitchComponent } from './v3/switch/switch.component'; import { SwitchComponent } from './v3/switch/switch.component';
import { TagItemV3Component } from './v3/tag/tag-item/tag-item.component'; import { TagItemV3Component } from './v3/tag-item/tag-item.component';
import { TextareaV3Component } from './v3/textarea/textarea.component'; import { TextareaV3Component } from './v3/textarea/textarea.component';
export { export {
......
...@@ -6,9 +6,13 @@ import { Component, Input } from '@angular/core'; ...@@ -6,9 +6,13 @@ import { Component, Input } from '@angular/core';
styleUrls: ['./svg-icon.component.scss'], styleUrls: ['./svg-icon.component.scss'],
}) })
export class SvgIconComponent { export class SvgIconComponent {
@Input() icon: string; /** Id of svg to use */
@Input({ required: true }) icon: string;
/** Folder of the sprite to use */
@Input({ required: true }) type: string;
@Input() iconClass: string; @Input() iconClass: string;
@Input() type: string;
@Input() iconColor = 'none'; @Input() iconColor = 'none';
@Input() title: string = null; @Input() title: string = null;
} }
...@@ -7,12 +7,12 @@ import { ButtonTypeV3 } from './button-type.enum'; ...@@ -7,12 +7,12 @@ import { ButtonTypeV3 } from './button-type.enum';
styleUrls: ['./button.component.scss'], styleUrls: ['./button.component.scss'],
}) })
export class ButtonV3Component { export class ButtonV3Component {
/** Button label */
@Input({ required: true }) label: string;
/** HTML type of the button */ /** HTML type of the button */
@Input() type: 'submit' | 'button' | 'reset' = 'button'; @Input() type: 'submit' | 'button' | 'reset' = 'button';
/** Button label */
@Input() label = 'Bouton';
/** What variant should be the button ? */ /** What variant should be the button ? */
@Input() variant?: ButtonTypeV3 = ButtonTypeV3.Primary; @Input() variant?: ButtonTypeV3 = ButtonTypeV3.Primary;
......
...@@ -7,6 +7,9 @@ import { ButtonTypeV3 } from '../button-type.enum'; ...@@ -7,6 +7,9 @@ import { ButtonTypeV3 } from '../button-type.enum';
styleUrls: ['../button.component.scss'], styleUrls: ['../button.component.scss'],
}) })
export class IconButtonV3Component { export class IconButtonV3Component {
/** Icon name */
@Input({ required: true }) iconName: string;
/** HTML type of the button */ /** HTML type of the button */
@Input() type: 'submit' | 'button' | 'reset' = 'button'; @Input() type: 'submit' | 'button' | 'reset' = 'button';
...@@ -22,9 +25,6 @@ export class IconButtonV3Component { ...@@ -22,9 +25,6 @@ export class IconButtonV3Component {
/** Folder of the icon ex: assets/ico */ /** Folder of the icon ex: assets/ico */
@Input() iconFolder = 'ico'; @Input() iconFolder = 'ico';
/** Icon name */
@Input() iconName: string;
/** Icon color, defaults to none as the svg-icon does */ /** Icon color, defaults to none as the svg-icon does */
@Input() iconColor = 'none'; @Input() iconColor = 'none';
......
...@@ -10,7 +10,7 @@ export class CheckboxV3Component { ...@@ -10,7 +10,7 @@ export class CheckboxV3Component {
@Input() id: string; @Input() id: string;
/** Checked ? */ /** Checked ? */
@Input() checked: boolean; @Input({ required: true }) checked: boolean;
/** Indeterminate (half-checked) ? */ /** Indeterminate (half-checked) ? */
@Input() indeterminate?: boolean; @Input() indeterminate?: boolean;
......
...@@ -13,11 +13,15 @@ import { CollapseType } from './collapse.type'; ...@@ -13,11 +13,15 @@ import { CollapseType } from './collapse.type';
export class CollapseComponent implements AfterContentInit { export class CollapseComponent implements AfterContentInit {
@ContentChild(CollapseHeaderComponent) title: CollapseHeaderComponent; @ContentChild(CollapseHeaderComponent) title: CollapseHeaderComponent;
@ContentChild(CollapseContentComponent) content: CollapseContentComponent; @ContentChild(CollapseContentComponent) content: CollapseContentComponent;
@Input() variant?: CollapseType = CollapseType.Regular; @Input() variant?: CollapseType = CollapseType.Regular;
/** Adapts border-radius and right padding */ /** Adapts border-radius and right padding */
@Input() size?: 'small' | 'medium' = 'small'; @Input() size?: 'small' | 'medium' = 'small';
/** Box-shadow when expanded? */ /** Box-shadow when expanded? */
@Input() boxShadow? = false; @Input() boxShadow? = false;
/** Default expanded value */ /** Default expanded value */
@Input() expanded? = false; @Input() expanded? = false;
......
...@@ -7,15 +7,15 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; ...@@ -7,15 +7,15 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
}) })
export class LabelCheckboxV3Component { export class LabelCheckboxV3Component {
/** Label text to display */ /** Label text to display */
@Input() label: string; @Input({ required: true }) label: string;
/** HTML for that will control checkbox */ /** HTML for that will control checkbox */
@Input() for: string; @Input({ required: true }) for: string;
/** What size should the checkbox be ? */ /** What size should the checkbox be ? */
@Input() size?: 'small' | 'medium' = 'small'; @Input() size?: 'small' | 'medium' = 'small';
@Input() checked: boolean; @Input({ required: true }) checked: boolean;
@Input() indeterminate?: boolean; @Input() indeterminate?: boolean;
......
...@@ -7,8 +7,8 @@ import { ButtonTypeV3 } from '../button/button-type.enum'; ...@@ -7,8 +7,8 @@ import { ButtonTypeV3 } from '../button/button-type.enum';
styleUrls: ['./modal.component.scss'], styleUrls: ['./modal.component.scss'],
}) })
export class ModalV3Component { export class ModalV3Component {
/* Is modal openned ? */ /* Is modal opened ? */
@Input() public opened: boolean; @Input({ required: true }) public opened: boolean;
/* Content of the modal (between title and buttons) */ /* Content of the modal (between title and buttons) */
@Input() public content: string; @Input() public content: string;
......
...@@ -10,7 +10,7 @@ export class RadioV3Component { ...@@ -10,7 +10,7 @@ export class RadioV3Component {
@Input() id: string; @Input() id: string;
/** Checked ? */ /** Checked ? */
@Input() checked: boolean; @Input({ required: true }) checked: boolean;
/** What size should the checkbox be ? */ /** What size should the checkbox be ? */
@Input() size?: 'small' | 'medium' = 'medium'; @Input() size?: 'small' | 'medium' = 'medium';
......
...@@ -8,9 +8,11 @@ import { ButtonTypeV3 } from '../button/button-type.enum'; ...@@ -8,9 +8,11 @@ import { ButtonTypeV3 } from '../button/button-type.enum';
}) })
export class SearchBarV3Component { export class SearchBarV3Component {
@Input() placeholder = 'Rechercher'; @Input() placeholder = 'Rechercher';
@Input() value = ''; @Input({ required: true }) value = '';
/** Triggers when input changes */ /** Triggers when input changes */
@Output() valueChange = new EventEmitter<string>(); @Output() valueChange = new EventEmitter<string>();
/** Triggers when button is clicked or Enter is pressed on input */ /** Triggers when button is clicked or Enter is pressed on input */
@Output() search = new EventEmitter<string>(); @Output() search = new EventEmitter<string>();
......
...@@ -7,10 +7,10 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; ...@@ -7,10 +7,10 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
}) })
export class SwitchComponent { export class SwitchComponent {
/** Label text to display */ /** Label text to display */
@Input() label: string; @Input({ required: true }) label: string;
/** Switch checked value */ /** Switch checked value */
@Input() checked: boolean; @Input({ required: true }) checked: boolean;
/** Status text for the switch */ /** Status text for the switch */
@Input() checkedText?: string = 'Activé'; @Input() checkedText?: string = 'Activé';
......
...@@ -2,7 +2,7 @@ import { CommonModule } from '@angular/common'; ...@@ -2,7 +2,7 @@ import { CommonModule } from '@angular/common';
import { EventEmitter } from '@angular/core'; import { EventEmitter } from '@angular/core';
import type { Meta, StoryObj } from '@storybook/angular'; import type { Meta, StoryObj } from '@storybook/angular';
import { moduleMetadata } from '@storybook/angular'; import { moduleMetadata } from '@storybook/angular';
import { SvgIconComponent } from '../../../svg-icon/svg-icon.component'; import { SvgIconComponent } from '../../svg-icon/svg-icon.component';
import { TagItemV3Component } from './tag-item.component'; import { TagItemV3Component } from './tag-item.component';
// More on how to set up stories at: https://storybook.js.org/docs/angular/writing-stories/introduction // More on how to set up stories at: https://storybook.js.org/docs/angular/writing-stories/introduction
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment