Skip to content

Commit 60d6836

Browse files
feat: Expose type aliases for custom string union property types (#1656)
* Removed non-functional `blazorTypeOverride` decorator * Marked igc-carousel-slide/igc-step `toggleAnimation` methods internal and deprecated --------- Co-authored-by: Radoslav Karaivanov <[email protected]>
1 parent 21cd28d commit 60d6836

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+241
-144
lines changed

CHANGELOG.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77
## [Unreleased]
88
### Added
99
- New File Input Component(`igc-file-input`)
10+
- Exposed more public API type aliases for component property types like `ButtonVariant`, `PickerMode`, `StepperOrientation`, `HorizontalTransitionAnimation` (carousel and horizontal stepper) and more.
1011

1112
### Deprecated
12-
Some event argument types have been renamed for consistency:
13-
- `CheckboxChangeEventArgs` deprecated, use `IgcCheckboxChangeEventArgs` instead.
14-
- `RadioChangeEventArgs` deprecated, use `IgcRadioChangeEventArgs` instead.
15-
- `IgcRangeSliderValue` deprecated, use `IgcRangeSliderValueEventArgs` instead.
16-
- `IgcActiveStepChangingArgs` deprecated, use `IgcActiveStepChangingEventArgs` instead.
17-
- `IgcActiveStepChangedArgs` deprecated, use `IgcActiveStepChangedEventArgs` instead.
13+
- Some event argument types have been renamed for consistency:
14+
- `CheckboxChangeEventArgs` deprecated, use `IgcCheckboxChangeEventArgs` instead.
15+
- `RadioChangeEventArgs` deprecated, use `IgcRadioChangeEventArgs` instead.
16+
- `IgcRangeSliderValue` deprecated, use `IgcRangeSliderValueEventArgs` instead.
17+
- `IgcActiveStepChangingArgs` deprecated, use `IgcActiveStepChangingEventArgs` instead.
18+
- `IgcActiveStepChangedArgs` deprecated, use `IgcActiveStepChangedEventArgs` instead.
19+
- Carousel Slide's `toggleAnimation` is now marked internal and deprecated for use in favor of parent Carousel's `select` method.
20+
- Stepper Step's `toggleAnimation` is now marked internal and deprecated for use in favor of parent Stepper's `navigateTo` method.
1821

1922
### Fixed
2023
- Setting validation properties on a pristine non-dirty form associated element does not apply invalid styles [#1632](https://github.com/IgniteUI/igniteui-webcomponents/issues/1632)

src/components/avatar/avatar.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ifDefined } from 'lit/directives/if-defined.js';
55
import { themes } from '../../theming/theming-decorator.js';
66
import { watch } from '../common/decorators/watch.js';
77
import { registerComponent } from '../common/definitions/register.js';
8+
import type { AvatarShape } from '../types.js';
89
import { styles } from './themes/avatar.base.css.js';
910
import { styles as shared } from './themes/shared/avatar.common.css.js';
1011
import { all } from './themes/themes.js';
@@ -63,7 +64,7 @@ export default class IgcAvatarComponent extends LitElement {
6364
* @attr
6465
*/
6566
@property({ reflect: true })
66-
public shape: 'circle' | 'rounded' | 'square' = 'square';
67+
public shape: AvatarShape = 'square';
6768

6869
constructor() {
6970
super();

src/components/badge/badge.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { property } from 'lit/decorators.js';
44
import { themes } from '../../theming/theming-decorator.js';
55
import { watch } from '../common/decorators/watch.js';
66
import { registerComponent } from '../common/definitions/register.js';
7-
import type { StyleVariant } from '../types.js';
7+
import type { BadgeShape, StyleVariant } from '../types.js';
88
import { styles } from './themes/badge.base.css.js';
99
import { styles as shared } from './themes/shared/badge.common.css.js';
1010
import { all } from './themes/themes.js';
@@ -50,7 +50,7 @@ export default class IgcBadgeComponent extends LitElement {
5050
* @attr
5151
*/
5252
@property({ reflect: true })
53-
public shape: 'rounded' | 'square' = 'rounded';
53+
public shape: BadgeShape = 'rounded';
5454

5555
constructor() {
5656
super();

src/components/button-group/button-group.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { registerComponent } from '../common/definitions/register.js';
1111
import type { Constructor } from '../common/mixins/constructor.js';
1212
import { EventEmitterMixin } from '../common/mixins/event-emitter.js';
1313
import { findElementFromEventPath, last } from '../common/util.js';
14+
import type { ButtonGroupSelection, ContentOrientation } from '../types.js';
1415
import { styles } from './themes/group.base.css.js';
1516
import { all } from './themes/group.js';
1617
import { styles as shared } from './themes/shared/group/group.common.css.js';
@@ -91,14 +92,14 @@ export default class IgcButtonGroupComponent extends EventEmitterMixin<
9192
* @attr
9293
*/
9394
@property({ reflect: true })
94-
public alignment: 'horizontal' | 'vertical' = 'horizontal';
95+
public alignment: ContentOrientation = 'horizontal';
9596

9697
/**
9798
* Controls the mode of selection for the button group.
9899
* @attr
99100
*/
100101
@property({ reflect: false })
101-
public selection: 'single' | 'single-required' | 'multiple' = 'single';
102+
public selection: ButtonGroupSelection = 'single';
102103

103104
/**
104105
* Gets/Sets the currently selected buttons (their values).

src/components/button/button.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { property } from 'lit/decorators.js';
33

44
import { themes } from '../../theming/theming-decorator.js';
55
import { registerComponent } from '../common/definitions/register.js';
6+
import type { ButtonVariant } from '../types.js';
67
import { IgcButtonBaseComponent } from './button-base.js';
78
import { styles } from './themes/button/button.base.css.js';
89
import { styles as shared } from './themes/button/shared/button.common.css.js';
@@ -37,7 +38,7 @@ export default class IgcButtonComponent extends IgcButtonBaseComponent {
3738
* @attr
3839
*/
3940
@property({ reflect: true })
40-
public variant: 'flat' | 'contained' | 'outlined' | 'fab' = 'contained';
41+
public variant: ButtonVariant = 'contained';
4142

4243
protected renderContent() {
4344
return html`

src/components/button/icon-button.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
registerIconFromText as registerIconFromText_impl,
1111
registerIcon as registerIcon_impl,
1212
} from '../icon/icon.registry.js';
13+
import type { IconButtonVariant } from '../types.js';
1314
import { IgcButtonBaseComponent } from './button-base.js';
1415
import { styles } from './themes/icon-button/icon-button.base.css.js';
1516
import { styles as shared } from './themes/icon-button/shared/icon-button.common.css.js';
@@ -58,7 +59,7 @@ export default class IgcIconButtonComponent extends IgcButtonBaseComponent {
5859
* @attr
5960
*/
6061
@property({ reflect: true })
61-
public variant: 'flat' | 'contained' | 'outlined' = 'contained';
62+
public variant: IconButtonVariant = 'contained';
6263

6364
protected renderContent() {
6465
return html`

src/components/calendar/base.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import { watch } from '../common/decorators/watch.js';
77
import { first } from '../common/util.js';
88
import { convertToDate, convertToDates, getWeekDayNumber } from './helpers.js';
99
import { CalendarDay } from './model.js';
10-
import type { DateRangeDescriptor, WeekDays } from './types.js';
10+
import type {
11+
CalendarSelection,
12+
DateRangeDescriptor,
13+
WeekDays,
14+
} from './types.js';
1115

1216
@blazorIndirectRender
1317
@blazorDeepImport
@@ -105,7 +109,7 @@ export class IgcCalendarBaseComponent extends LitElement {
105109
* @attr selection
106110
*/
107111
@property()
108-
public selection: 'single' | 'multiple' | 'range' = 'single';
112+
public selection: CalendarSelection = 'single';
109113

110114
/**
111115
* Whether to show the week numbers.

src/components/calendar/calendar.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
partNameMap,
3333
} from '../common/util.js';
3434
import IgcIconComponent from '../icon/icon.js';
35+
import type { ContentOrientation } from '../types.js';
3536
import { IgcCalendarBaseComponent } from './base.js';
3637
import IgcDaysViewComponent from './days-view/days-view.js';
3738
import {
@@ -46,7 +47,11 @@ import { CalendarDay } from './model.js';
4647
import IgcMonthsViewComponent from './months-view/months-view.js';
4748
import { styles } from './themes/calendar.base.css.js';
4849
import { all } from './themes/calendar.js';
49-
import type { IgcCalendarComponentEventMap } from './types.js';
50+
import type {
51+
CalendarActiveView,
52+
CalendarHeaderOrientation,
53+
IgcCalendarComponentEventMap,
54+
} from './types.js';
5055
import IgcYearsViewComponent from './years-view/years-view.js';
5156

5257
export const focusActiveDate = Symbol();
@@ -186,15 +191,15 @@ export default class IgcCalendarComponent extends EventEmitterMixin<
186191
* @attr header-orientation
187192
*/
188193
@property({ reflect: true, attribute: 'header-orientation' })
189-
public headerOrientation: 'vertical' | 'horizontal' = 'horizontal';
194+
public headerOrientation: CalendarHeaderOrientation = 'horizontal';
190195

191196
/**
192197
* The orientation of the calendar months when more than one month
193198
* is being shown.
194199
* @attr orientation
195200
*/
196201
@property()
197-
public orientation: 'vertical' | 'horizontal' = 'horizontal';
202+
public orientation: ContentOrientation = 'horizontal';
198203

199204
/**
200205
* The number of months displayed in the days view.
@@ -208,7 +213,7 @@ export default class IgcCalendarComponent extends EventEmitterMixin<
208213
* @attr active-view
209214
*/
210215
@property({ attribute: 'active-view' })
211-
public activeView: 'days' | 'months' | 'years' = 'days';
216+
public activeView: CalendarActiveView = 'days';
212217

213218
/** The options used to format the months and the weekdays in the calendar views. */
214219
@property({ attribute: false })

src/components/calendar/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export type WeekDays =
2121
| 'thursday'
2222
| 'friday'
2323
| 'saturday';
24+
export type CalendarActiveView = 'days' | 'months' | 'years';
25+
export type CalendarHeaderOrientation = 'horizontal' | 'vertical';
26+
export type CalendarSelection = 'single' | 'multiple' | 'range';
2427

2528
export interface IgcCalendarComponentEventMap {
2629
igcChange: CustomEvent<Date | Date[]>;

src/components/card/card.actions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { property } from 'lit/decorators.js';
33

44
import { themes } from '../../theming/theming-decorator.js';
55
import { registerComponent } from '../common/definitions/register.js';
6+
import type { ContentOrientation } from '../types.js';
67
import { all } from './themes/actions.js';
78
import { styles } from './themes/card.actions.base.css.js';
89

@@ -28,7 +29,7 @@ export default class IgcCardActionsComponent extends LitElement {
2829
* @attr
2930
*/
3031
@property({ reflect: true })
31-
public orientation: 'vertical' | 'horizontal' = 'horizontal';
32+
public orientation: ContentOrientation = 'horizontal';
3233

3334
protected override render() {
3435
return html`

0 commit comments

Comments
 (0)