diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index e565a00a..49b4e968 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -1,6 +1,6 @@ # Component Index -> 167 components exported from carbon-components-svelte@0.33.0. +> 168 components exported from carbon-components-svelte@0.33.0. ## Components @@ -27,6 +27,7 @@ - [`ContextMenu`](#contextmenu) - [`ContextMenuDivider`](#contextmenudivider) - [`ContextMenuGroup`](#contextmenugroup) +- [`ContextMenuInner`](#contextmenuinner) - [`ContextMenuOption`](#contextmenuoption) - [`ContextMenuRadioGroup`](#contextmenuradiogroup) - [`Copy`](#copy) @@ -737,7 +738,7 @@ None. | Prop name | Kind | Reactive | Type | Default value | Description | | :-------- | :--------------- | :------- | :---------------------------------------- | ------------------ | -------------------------------------------------------------------------------- | -| ref | let | Yes | null | HTMLUListElement | null | Obtain a reference to the unordered list HTML element | +| ref | let | Yes | HTMLUListElement | null | null | Obtain a reference to the unordered list HTML element | | y | let | Yes | number | 0 | Specify the vertical offset of the menu position | | x | let | Yes | number | 0 | Specify the horizontal offset of the menu position | | open | let | Yes | boolean | false | Set to `true` to open the menu
Either `x` and `y` must be greater than zero | @@ -750,12 +751,7 @@ None. ### Events -| Event name | Type | Detail | -| :--------- | :--------- | :----- | -| click | forwarded | -- | -| keydown | forwarded | -- | -| open | dispatched | -- | -| close | dispatched | -- | +None. ## `ContextMenuDivider` @@ -790,6 +786,32 @@ None. None. +## `ContextMenuInner` + +### Props + +| Prop name | Kind | Reactive | Type | Default value | Description | +| :-------- | :--------------- | :------- | :---------------------------------------- | ------------------ | -------------------------------------------------------------------------------- | +| ref | let | Yes | null | HTMLUListElement | null | Obtain a reference to the unordered list HTML element | +| y | let | Yes | number | 0 | Specify the vertical offset of the menu position | +| x | let | Yes | number | 0 | Specify the horizontal offset of the menu position | +| open | let | Yes | boolean | false | Set to `true` to open the menu
Either `x` and `y` must be greater than zero | + +### Slots + +| Slot name | Default | Props | Fallback | +| :-------- | :------ | :---- | :------- | +| -- | Yes | -- | -- | + +### Events + +| Event name | Type | Detail | +| :--------- | :--------- | :----- | +| click | forwarded | -- | +| keydown | forwarded | -- | +| open | dispatched | -- | +| close | dispatched | -- | + ## `ContextMenuOption` ### Props diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index bccb25f4..24755368 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -1,5 +1,5 @@ { - "total": 167, + "total": 168, "components": [ { "moduleName": "Accordion", @@ -1609,7 +1609,7 @@ "name": "ref", "kind": "let", "description": "Obtain a reference to the unordered list HTML element", - "type": "null | HTMLUListElement", + "type": "HTMLUListElement | null", "value": "null", "isFunction": false, "constant": false, @@ -1617,14 +1617,8 @@ } ], "slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }], - "events": [ - { "type": "forwarded", "name": "click", "element": "ul" }, - { "type": "forwarded", "name": "keydown", "element": "ul" }, - { "type": "dispatched", "name": "open" }, - { "type": "dispatched", "name": "close" } - ], - "typedefs": [], - "rest_props": { "type": "Element", "name": "ul" } + "events": [], + "typedefs": [] }, { "moduleName": "ContextMenuDivider", @@ -1662,6 +1656,61 @@ "events": [], "typedefs": [] }, + { + "moduleName": "ContextMenuInner", + "filePath": "src/ContextMenu/ContextMenuInner.svelte", + "props": [ + { + "name": "open", + "kind": "let", + "description": "Set to `true` to open the menu\nEither `x` and `y` must be greater than zero", + "type": "boolean", + "value": "false", + "isFunction": false, + "constant": false, + "reactive": true + }, + { + "name": "x", + "kind": "let", + "description": "Specify the horizontal offset of the menu position", + "type": "number", + "value": "0", + "isFunction": false, + "constant": false, + "reactive": true + }, + { + "name": "y", + "kind": "let", + "description": "Specify the vertical offset of the menu position", + "type": "number", + "value": "0", + "isFunction": false, + "constant": false, + "reactive": true + }, + { + "name": "ref", + "kind": "let", + "description": "Obtain a reference to the unordered list HTML element", + "type": "null | HTMLUListElement", + "value": "null", + "isFunction": false, + "constant": false, + "reactive": true + } + ], + "slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }], + "events": [ + { "type": "forwarded", "name": "click", "element": "ul" }, + { "type": "forwarded", "name": "keydown", "element": "ul" }, + { "type": "dispatched", "name": "open" }, + { "type": "dispatched", "name": "close" } + ], + "typedefs": [], + "rest_props": { "type": "Element", "name": "ul" } + }, { "moduleName": "ContextMenuOption", "filePath": "src/ContextMenu/ContextMenuOption.svelte", diff --git a/preprocess/api.json b/preprocess/api.json index a25317b5..6e696de7 100644 --- a/preprocess/api.json +++ b/preprocess/api.json @@ -76,6 +76,9 @@ "ContextMenuGroup": { "path": "carbon-components-svelte/src/ContextMenu/ContextMenuGroup.svelte" }, + "ContextMenuInner": { + "path": "carbon-components-svelte/src/ContextMenu/ContextMenuInner.svelte" + }, "ContextMenuOption": { "path": "carbon-components-svelte/src/ContextMenu/ContextMenuOption.svelte" }, diff --git a/types/ContextMenu/ContextMenu.d.ts b/types/ContextMenu/ContextMenu.d.ts index 17a4b547..f174d631 100644 --- a/types/ContextMenu/ContextMenu.d.ts +++ b/types/ContextMenu/ContextMenu.d.ts @@ -1,8 +1,7 @@ /// import { SvelteComponentTyped } from "svelte"; -export interface ContextMenuProps - extends svelte.JSX.HTMLAttributes { +export interface ContextMenuProps { /** * Set to `true` to open the menu * Either `x` and `y` must be greater than zero @@ -26,16 +25,11 @@ export interface ContextMenuProps * Obtain a reference to the unordered list HTML element * @default null */ - ref?: null | HTMLUListElement; + ref?: HTMLUListElement | null; } export default class ContextMenu extends SvelteComponentTyped< ContextMenuProps, - { - click: WindowEventMap["click"]; - keydown: WindowEventMap["keydown"]; - open: CustomEvent; - close: CustomEvent; - }, + {}, { default: {} } > {} diff --git a/types/ContextMenu/ContextMenuInner.d.ts b/types/ContextMenu/ContextMenuInner.d.ts new file mode 100644 index 00000000..3db8a08e --- /dev/null +++ b/types/ContextMenu/ContextMenuInner.d.ts @@ -0,0 +1,41 @@ +/// +import { SvelteComponentTyped } from "svelte"; + +export interface ContextMenuInnerProps + extends svelte.JSX.HTMLAttributes { + /** + * Set to `true` to open the menu + * Either `x` and `y` must be greater than zero + * @default false + */ + open?: boolean; + + /** + * Specify the horizontal offset of the menu position + * @default 0 + */ + x?: number; + + /** + * Specify the vertical offset of the menu position + * @default 0 + */ + y?: number; + + /** + * Obtain a reference to the unordered list HTML element + * @default null + */ + ref?: null | HTMLUListElement; +} + +export default class ContextMenuInner extends SvelteComponentTyped< + ContextMenuInnerProps, + { + click: WindowEventMap["click"]; + keydown: WindowEventMap["keydown"]; + open: CustomEvent; + close: CustomEvent; + }, + { default: {} } +> {} diff --git a/types/index.d.ts b/types/index.d.ts index f1446a1b..73eec917 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -13,6 +13,7 @@ export { default as CheckboxSkeleton } from "./Checkbox/CheckboxSkeleton"; export { default as ContentSwitcher } from "./ContentSwitcher/ContentSwitcher"; export { default as Switch } from "./ContentSwitcher/Switch"; export { default as ContextMenu } from "./ContextMenu/ContextMenu"; +export { default as ContextMenuInner } from "./ContextMenu/ContextMenuInner"; export { default as ContextMenuDivider } from "./ContextMenu/ContextMenuDivider"; export { default as ContextMenuGroup } from "./ContextMenu/ContextMenuGroup"; export { default as ContextMenuOption } from "./ContextMenu/ContextMenuOption";