Revert "Refactor prop types to omit redundant null for null | HTMLElement types" (#1008)

#996
This commit is contained in:
Eric Liu 2022-01-14 11:29:37 -10:00 committed by GitHub
commit 653a601f9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 35 additions and 40 deletions

View file

@ -658,7 +658,7 @@ export interface ComboBoxItem {
| Prop name | Kind | Reactive | Type | Default value | Description |
| :--------------- | :-------------------- | :------- | :---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| listRef | <code>let</code> | Yes | <code>HTMLDivElement</code> | <code>null</code> | Obtain a reference to the list HTML element |
| listRef | <code>let</code> | Yes | <code>null &#124; HTMLDivElement</code> | <code>null</code> | Obtain a reference to the list HTML element |
| ref | <code>let</code> | Yes | <code>null &#124; HTMLInputElement</code> | <code>null</code> | Obtain a reference to the input HTML element |
| open | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Set to `true` to open the combobox menu dropdown |
| value | <code>let</code> | Yes | <code>string</code> | <code>""</code> | Specify the selected combobox value |
@ -782,12 +782,12 @@ None.
### Props
| Prop name | Kind | Reactive | Type | Default value | Description |
| :-------- | :--------------- | :------- | :-------------------------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| :-------- | :--------------- | :------- | :-------------------------------------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| ref | <code>let</code> | Yes | <code>null &#124; HTMLUListElement</code> | <code>null</code> | Obtain a reference to the unordered list HTML element |
| y | <code>let</code> | Yes | <code>number</code> | <code>0</code> | Specify the vertical offset of the menu position |
| x | <code>let</code> | Yes | <code>number</code> | <code>0</code> | Specify the horizontal offset of the menu position |
| open | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Set to `true` to open the menu<br />Either `x` and `y` must be greater than zero |
| target | <code>let</code> | No | <code>HTMLElement &#124; HTMLElement[]</code> | <code>null</code> | Specify an element or list of elements to trigger the context menu.<br />If no element is specified, the context menu applies to the entire window |
| target | <code>let</code> | No | <code>null &#124; HTMLElement &#124; HTMLElement[]</code> | <code>null</code> | Specify an element or list of elements to trigger the context menu.<br />If no element is specified, the context menu applies to the entire window |
### Slots
@ -2413,8 +2413,8 @@ export interface MultiSelectItem {
| Prop name | Kind | Reactive | Type | Default value | Description |
| :---------------- | :--------------- | :------- | :--------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------- |
| selectionRef | <code>let</code> | Yes | <code>HTMLDivElement</code> | <code>null</code> | Obtain a reference to the selection element |
| fieldRef | <code>let</code> | Yes | <code>HTMLDivElement</code> | <code>null</code> | Obtain a reference to the field box element |
| selectionRef | <code>let</code> | Yes | <code>null &#124; HTMLDivElement</code> | <code>null</code> | Obtain a reference to the selection element |
| fieldRef | <code>let</code> | Yes | <code>null &#124; HTMLDivElement</code> | <code>null</code> | Obtain a reference to the field box element |
| multiSelectRef | <code>let</code> | Yes | <code>null &#124; HTMLDivElement</code> | <code>null</code> | Obtain a reference to the outer div element |
| inputRef | <code>let</code> | Yes | <code>null &#124; HTMLInputElement</code> | <code>null</code> | Obtain a reference to the input HTML element |
| open | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Set to `true` to open the dropdown |
@ -4615,8 +4615,8 @@ None.
### Props
| Prop name | Kind | Reactive | Type | Default value | Description |
| :--------- | :--------------- | :------- | :-------------------------------- | ------------------ | --------------------------------------------- |
| ref | <code>let</code> | Yes | <code>HTMLInputElement</code> | <code>null</code> | Obtain a reference to the input HTML element |
| :--------- | :--------------- | :------- | :---------------------------------------- | ------------------ | --------------------------------------------- |
| ref | <code>let</code> | Yes | <code>null &#124; HTMLInputElement</code> | <code>null</code> | Obtain a reference to the input HTML element |
| expanded | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Set to `true` to expand the search bar |
| value | <code>let</code> | Yes | <code>number &#124; string</code> | <code>""</code> | Specify the value of the search input |
| persistent | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to keep the search bar expanded |

View file

@ -1604,7 +1604,7 @@
"name": "listRef",
"kind": "let",
"description": "Obtain a reference to the list HTML element",
"type": "HTMLDivElement",
"type": "null | HTMLDivElement",
"value": "null",
"isFunction": false,
"isFunctionDeclaration": false,
@ -1824,7 +1824,7 @@
"name": "target",
"kind": "let",
"description": "Specify an element or list of elements to trigger the context menu.\nIf no element is specified, the context menu applies to the entire window",
"type": "HTMLElement | HTMLElement[]",
"type": "null | HTMLElement | HTMLElement[]",
"value": "null",
"isFunction": false,
"isFunctionDeclaration": false,
@ -6700,7 +6700,7 @@
"name": "fieldRef",
"kind": "let",
"description": "Obtain a reference to the field box element",
"type": "HTMLDivElement",
"type": "null | HTMLDivElement",
"value": "null",
"isFunction": false,
"isFunctionDeclaration": false,
@ -6711,7 +6711,7 @@
"name": "selectionRef",
"kind": "let",
"description": "Obtain a reference to the selection element",
"type": "HTMLDivElement",
"type": "null | HTMLDivElement",
"value": "null",
"isFunction": false,
"isFunctionDeclaration": false,
@ -12818,7 +12818,7 @@
"name": "ref",
"kind": "let",
"description": "Obtain a reference to the input HTML element",
"type": "HTMLInputElement",
"type": "null | HTMLInputElement",
"value": "null",
"isFunction": false,
"isFunctionDeclaration": false,

View file

@ -90,7 +90,7 @@
/**
* Obtain a reference to the list HTML element
* @type {HTMLDivElement}
* @type {null | HTMLDivElement}
*/
export let listRef = null;

View file

@ -6,7 +6,7 @@
/**
* Specify an element or list of elements to trigger the context menu.
* If no element is specified, the context menu applies to the entire window
* @type {HTMLElement | HTMLElement[]}
* @type {null | HTMLElement | HTMLElement[]}
*/
export let target = null;

View file

@ -21,7 +21,7 @@
/**
* Obtain a reference to the input HTML element
* @type {HTMLInputElement}
* @type {null | HTMLInputElement}
*/
export let ref = null;

View file

@ -136,13 +136,13 @@
/**
* Obtain a reference to the field box element
* @type {HTMLDivElement}
* @type {null | HTMLDivElement}
*/
export let fieldRef = null;
/**
* Obtain a reference to the selection element
* @type {HTMLDivElement}
* @type {null | HTMLDivElement}
*/
export let selectionRef = null;

View file

@ -22,7 +22,7 @@
/**
* Finds the nearest parent tree node
* @param {HTMLElement} node
* @returns {HTMLElement}
* @returns {null | HTMLElement}
*/
function findParentTreeNode(node) {
if (node.classList.contains("bx--tree-parent-node")) return node;

View file

@ -9,7 +9,6 @@
];
let ref: ComboBox;
let listRef: HTMLDivElement = null;
$: ref?.clear({ focus: false });
$: ref?.clear();
@ -21,7 +20,6 @@
titleText="Contact"
placeholder="Select contact method"
items="{items}"
bind:listRef
/>
<ComboBox

View file

@ -9,16 +9,13 @@
import CopyFile16 from "carbon-icons-svelte/lib/CopyFile16";
import Cut16 from "carbon-icons-svelte/lib/Cut16";
let target: HTMLElement = null;
let selectedId = "0";
let selectedIds = [];
$: console.log("selectedId", selectedId);
</script>
<div bind:this="{target}"></div>
<ContextMenu open on:open="{(e) => console.log(e.detail)}" bind:target>
<ContextMenu open on:open="{(e) => console.log(e.detail)}">
<ContextMenuOption
kind="danger"
indented

View file

@ -135,7 +135,7 @@ export interface ComboBoxProps
* Obtain a reference to the list HTML element
* @default null
*/
listRef?: HTMLDivElement;
listRef?: null | HTMLDivElement;
}
export default class ComboBox extends SvelteComponentTyped<

View file

@ -8,7 +8,7 @@ export interface ContextMenuProps
* If no element is specified, the context menu applies to the entire window
* @default null
*/
target?: HTMLElement | HTMLElement[];
target?: null | HTMLElement | HTMLElement[];
/**
* Set to `true` to open the menu

View file

@ -37,7 +37,7 @@ export interface ToolbarSearchProps
* Obtain a reference to the input HTML element
* @default null
*/
ref?: HTMLInputElement;
ref?: null | HTMLInputElement;
}
export default class ToolbarSearch extends SvelteComponentTyped<

View file

@ -197,13 +197,13 @@ export interface MultiSelectProps
* Obtain a reference to the field box element
* @default null
*/
fieldRef?: HTMLDivElement;
fieldRef?: null | HTMLDivElement;
/**
* Obtain a reference to the selection element
* @default null
*/
selectionRef?: HTMLDivElement;
selectionRef?: null | HTMLDivElement;
}
export default class MultiSelect extends SvelteComponentTyped<