Skip to content

Commit

Permalink
fix(types): annotate boolean prop types explicitly as booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
borisdiakur committed Sep 2, 2021
1 parent 26ef523 commit c1e3b38
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/liquid/components/ld-button/ld-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class LdButton {
private button!: HTMLElement

/** Disabled state of the button. */
@Prop() disabled = false
@Prop() disabled: boolean

/** Size of the button. */
@Prop() size?: 'sm' | 'lg'
Expand Down
2 changes: 1 addition & 1 deletion src/liquid/components/ld-button/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ You can align the text inside the button using the `align-text` propperty.
| Property | Attribute | Description | Type | Default |
| ---------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------- |
| `alignText` | `align-text` | Align text. | `"left" \| "right"` | `undefined` |
| `disabled` | `disabled` | Disabled state of the button. | `boolean` | `false` |
| `disabled` | `disabled` | Disabled state of the button. | `boolean` | `undefined` |
| `href` | `href` | Transforms the button to an anchor element. See [mdn docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-href) for more information on the `href` attribute. | `string` | `undefined` |
| `justifyContent` | `justify-content` | Justify content. | `"between" \| "end" \| "start"` | `undefined` |
| `key` | `key` | for tracking the node's identity when working with lists | `string \| number` | `undefined` |
Expand Down
4 changes: 2 additions & 2 deletions src/liquid/components/ld-checkbox/ld-checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ export class LdCheckbox {
@Prop() tone: 'dark'

/** Disabled state of the checkbox. */
@Prop() disabled = false
@Prop() disabled: boolean

/** The input value. */
@Prop({ mutable: true, reflect: true }) checked: boolean

/** Set this property to `true` in order to mark the checkbox visually as invalid. */
@Prop() invalid: false
@Prop() invalid: boolean

private handleBlur(ev) {
setTimeout(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/liquid/components/ld-checkbox/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ The `ld-checkbox` Web Component provides a low level API for integrating the com
| Property | Attribute | Description | Type | Default |
| ---------- | ---------- | ------------------------------------------------------------------------------ | ------------------------- | ----------- |
| `checked` | `checked` | The input value. | `boolean` | `undefined` |
| `disabled` | `disabled` | Disabled state of the checkbox. | `boolean` | `false` |
| `disabled` | `disabled` | Disabled state of the checkbox. | `boolean` | `undefined` |
| `invalid` | `invalid` | Set this property to `true` in order to mark the checkbox visually as invalid. | `boolean` | `undefined` |
| `key` | `key` | for tracking the node's identity when working with lists | `string \| number` | `undefined` |
| `mode` | `mode` | Display mode. | `"danger" \| "highlight"` | `undefined` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class LdInputMessage {
* Thus the message is read aloud before the next element that received the focus
* is announced to the user.
*/
@Prop() covert = false
@Prop() covert: boolean

render() {
let cl = 'ld-input-message'
Expand Down
2 changes: 1 addition & 1 deletion src/liquid/components/ld-input-message/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ This component is meant to be used in conjunction with the [`ld-input`](componen

| Property | Attribute | Description | Type | Default |
| -------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ----------- |
| `covert` | `covert` | This property does **not** change the visual appearance of the input message. Set this property to `true` if the message is hidden initially and change it to `false` as soon as you make the message visible again. It changes the `aria-hidden` attribute on the slot which is wrapped by an element that has an `aria-live` attribute with the value `assertive`. This means that the slot is wrapped by a so called “live region”, which is conveyed to screen readers and other assistive technology. The value “assertive” emphasizes the importance of the message and causes screen readers to interrupt their current tasks to read aloud this message. Thus the message is read aloud before the next element that received the focus is announced to the user. | `boolean` | `false` |
| `covert` | `covert` | This property does **not** change the visual appearance of the input message. Set this property to `true` if the message is hidden initially and change it to `false` as soon as you make the message visible again. It changes the `aria-hidden` attribute on the slot which is wrapped by an element that has an `aria-live` attribute with the value `assertive`. This means that the slot is wrapped by a so called “live region”, which is conveyed to screen readers and other assistive technology. The value “assertive” emphasizes the importance of the message and causes screen readers to interrupt their current tasks to read aloud this message. Thus the message is read aloud before the next element that received the focus is announced to the user. | `boolean` | `undefined` |
| `key` | `key` | for tracking the node's identity when working with lists | `string \| number` | `undefined` |
| `mode` | `mode` | Input message mode. | `"error" \| "info" \| "valid"` | `'error'` |
| `ref` | `ref` | reference to component | `any` | `undefined` |
Expand Down
2 changes: 1 addition & 1 deletion src/liquid/components/ld-input/ld-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class LdInput {
@Prop({ mutable: true, reflect: true }) value: string

/** Set this property to `true` in order to mark the field visually as invalid. */
@Prop() invalid = false
@Prop() invalid: boolean

/** The input placeholder. */
@Prop() placeholder: string
Expand Down
2 changes: 1 addition & 1 deletion src/liquid/components/ld-input/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ The `ld-input` Web Component does not provide any properties or methods for vali

| Property | Attribute | Description | Type | Default |
| ------------- | ------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------ | ----------- |
| `invalid` | `invalid` | Set this property to `true` in order to mark the field visually as invalid. | `boolean` | `false` |
| `invalid` | `invalid` | Set this property to `true` in order to mark the field visually as invalid. | `boolean` | `undefined` |
| `key` | `key` | for tracking the node's identity when working with lists | `string \| number` | `undefined` |
| `multiline` | `multiline` | Uses textarea instead of input internally. Setting this attribute to true disables the attribute type and both slots. | `boolean` | `undefined` |
| `placeholder` | `placeholder` | The input placeholder. | `string` | `undefined` |
Expand Down
4 changes: 2 additions & 2 deletions src/liquid/components/ld-option/ld-option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export class LdOption {
/**
* If present, this boolean attribute indicates that the option is selected.
*/
@Prop() selected = false
@Prop() selected: boolean

/**
* Disables the option.
*/
@Prop() disabled = false
@Prop() disabled: boolean

componentWillLoad() {
applyPropAliases.apply(this)
Expand Down
4 changes: 2 additions & 2 deletions src/liquid/components/ld-option/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

| Property | Attribute | Description | Type | Default |
| ---------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----------- |
| `disabled` | `disabled` | Disables the option. | `boolean` | `false` |
| `disabled` | `disabled` | Disables the option. | `boolean` | `undefined` |
| `key` | `key` | for tracking the node's identity when working with lists | `string \| number` | `undefined` |
| `ref` | `ref` | reference to component | `any` | `undefined` |
| `selected` | `selected` | If present, this boolean attribute indicates that the option is selected. | `boolean` | `false` |
| `selected` | `selected` | If present, this boolean attribute indicates that the option is selected. | `boolean` | `undefined` |
| `value` | `value` | The content of this attribute represents the value to be submitted with the form, should this option be selected. If this attribute is omitted, the value is taken from the text content of the option element. | `string` | `undefined` |


Expand Down
4 changes: 2 additions & 2 deletions src/liquid/components/ld-radio/ld-radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ export class LdRadio {
@Prop() tone: 'dark'

/** Disabled state of the radio. */
@Prop() disabled = false
@Prop() disabled: boolean

/** The input value. */
@Prop({ mutable: true, reflect: true }) checked: boolean

/** Set this property to `true` in order to mark the radio visually as invalid. */
@Prop() invalid: false
@Prop() invalid: boolean

private handleBlur(ev) {
setTimeout(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/liquid/components/ld-radio/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ The `ld-radio` Web Component provides a low level API for integrating the compon
| Property | Attribute | Description | Type | Default |
| ---------- | ---------- | --------------------------------------------------------------------------- | ------------------------- | ----------- |
| `checked` | `checked` | The input value. | `boolean` | `undefined` |
| `disabled` | `disabled` | Disabled state of the radio. | `boolean` | `false` |
| `disabled` | `disabled` | Disabled state of the radio. | `boolean` | `undefined` |
| `invalid` | `invalid` | Set this property to `true` in order to mark the radio visually as invalid. | `boolean` | `undefined` |
| `key` | `key` | for tracking the node's identity when working with lists | `string \| number` | `undefined` |
| `mode` | `mode` | Display mode. | `"danger" \| "highlight"` | `undefined` |
Expand Down
8 changes: 4 additions & 4 deletions src/liquid/components/ld-select/ld-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ export class LdSelect {
@Prop() name: string

/** Multiselect mode. */
@Prop() multiple = false
@Prop() multiple: boolean

/** Disabled state of the component. */
@Prop() disabled = false
@Prop() disabled: boolean

/** Set this property to `true` in order to mark the select visually as invalid. */
@Prop() invalid = false
@Prop() invalid: boolean

/**
* Prevents a state with no options selected after
* initial selection in single select mode.
*/
@Prop() preventDeselection = false
@Prop() preventDeselection: boolean

// prettier-ignore
/**
Expand Down
Loading

0 comments on commit c1e3b38

Please sign in to comment.