Skip to content

Commit 63912e6

Browse files
authoredApr 15, 2020
docs(ui-shell): add JSDoc annotations (carbon-design-system#5862)
Closes carbon-design-system#5668.
1 parent b145c27 commit 63912e6

File tree

5 files changed

+72
-13
lines changed

5 files changed

+72
-13
lines changed
 

‎packages/components/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ demo/hot
99
!demo/index.js
1010
!demo/components.js
1111
dist
12+
docs/js
1213

1314
# Test reports
1415
tests/a11y-results

‎packages/components/src/components/ui-shell/header-nav.js

+17-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,18 @@ import settings from '../../globals/js/settings';
1414

1515
const toArray = arrayLike => Array.prototype.slice.call(arrayLike);
1616

17-
export default class HeaderNav extends mixin(
18-
createComponent,
19-
initComponentBySearch,
20-
handles
21-
) {
17+
class HeaderNav extends mixin(createComponent, initComponentBySearch, handles) {
18+
/**
19+
* Header nav.
20+
* @extends CreateComponent
21+
* @extends InitComponentBySearch
22+
* @extends Handles
23+
* @param {HTMLElement} element The element working as an header nav.
24+
* @param {object} [options] The component options.
25+
* @param {string} [options.selectorSubmenu] The CSS selector to find sub menus.
26+
* @param {string} [options.selectorSubmenuLink] The CSS selector to find the trigger buttons of sub menus.
27+
* @param {string} [options.selectorSubmenuItem] The CSS selector to find the sub menu items.
28+
*/
2229
constructor(element, options) {
2330
super(element, options);
2431
this.manage(on(this.element, 'keydown', this._handleKeyDown));
@@ -92,6 +99,9 @@ export default class HeaderNav extends mixin(
9299
* @member HeaderNav.options
93100
* @type {object}
94101
* @property {string} selectorInit The data attribute to find side navs.
102+
* @property {string} [selectorSubmenu] The CSS selector to find sub menus.
103+
* @property {string} [selectorSubmenuLink] The CSS selector to find the trigger buttons of sub menus.
104+
* @property {string} [selectorSubmenuItem] The CSS selector to find the sub menu items.
95105
*/
96106
static get options() {
97107
const { prefix } = settings;
@@ -117,3 +127,5 @@ export default class HeaderNav extends mixin(
117127
FORWARD: 1,
118128
};
119129
}
130+
131+
export default HeaderNav;

‎packages/components/src/components/ui-shell/header-submenu.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,22 @@ import eventMatches from '../../globals/js/misc/event-matches';
1616
const forEach = /* #__PURE__ */ (() => Array.prototype.forEach)();
1717
const toArray = arrayLike => Array.prototype.slice.call(arrayLike);
1818

19-
export default class HeaderSubmenu extends mixin(
19+
class HeaderSubmenu extends mixin(
2020
createComponent,
2121
initComponentBySearch,
2222
handles
2323
) {
24+
/**
25+
* Sub menus in header nav.
26+
* @extends CreateComponent
27+
* @extends InitComponentBySearch
28+
* @extends Handles
29+
* @param {HTMLElement} element The element working as a submenu in header nav.
30+
* @param {object} [options] The component options.
31+
* @param {string} [options.selectorTrigger] The CSS selector to find the trigger button.
32+
* @param {string} [options.selectorItem] The CSS selector to find the menu items.
33+
* @param {string} [options.attribExpanded] The attribute that represents the expanded/collapsed state.
34+
*/
2435
constructor(element, options) {
2536
super(element, options);
2637
const hasFocusOut = 'onfocusout' in window;
@@ -282,6 +293,9 @@ export default class HeaderSubmenu extends mixin(
282293
* @member HeaderSubmenu.options
283294
* @type {object}
284295
* @property {string} selectorInit The data attribute to find side navs.
296+
* @property {string} [selectorTrigger] The CSS selector to find the trigger button.
297+
* @property {string} [selectorItem] The CSS selector to find the menu items.
298+
* @property {string} [attribExpanded] The attribute that represents the expanded/collapsed state.
285299
*/
286300
static get options() {
287301
const { prefix } = settings;
@@ -306,3 +320,5 @@ export default class HeaderSubmenu extends mixin(
306320
FORWARD: 1,
307321
};
308322
}
323+
324+
export default HeaderSubmenu;

‎packages/components/src/components/ui-shell/product-switcher.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import onFocusOutByKeyboard from '../../globals/js/misc/on-focus-by-keyboard';
55

66
let seq = 0;
77

8-
export default class ProductSwitcher extends NavigationMenuPanel {
8+
class ProductSwitcher extends NavigationMenuPanel {
99
/**
10-
* A navigation menu
10+
* A navigation menu.
1111
* @extends NavigationMenuPanel
1212
* @param {HTMLElement} element The element working as a selector.
1313
* @param {object} [options] The component options.
@@ -195,3 +195,5 @@ export default class ProductSwitcher extends NavigationMenuPanel {
195195
});
196196
}
197197
}
198+
199+
export default ProductSwitcher;

‎packages/components/src/components/ui-shell/side-nav.js

+33-5
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,34 @@ import eventMatches from '../../globals/js/misc/event-matches';
1515

1616
const { prefix } = settings;
1717

18-
export default class SideNav extends mixin(
19-
createComponent,
20-
initComponentBySearch,
21-
handles
22-
) {
18+
class SideNav extends mixin(createComponent, initComponentBySearch, handles) {
2319
/**
2420
* The map associating DOM element and copy button UI instance.
2521
* @member SideNav.components
2622
* @type {WeakMap}
2723
*/
2824
static components /* #__PURE_CLASS_PROPERTY__ */ = new WeakMap();
2925

26+
/**
27+
* Side nav.
28+
* @extends CreateComponent
29+
* @extends InitComponentBySearch
30+
* @extends Handles
31+
* @param {HTMLElement} element The element working as a side nav.
32+
* @param {object} [options] The component options.
33+
* @param {string} [options.selectorSideNavToggle]
34+
* The CSS selector to find the toggle button.
35+
* @param {string} [options.selectorSideNavSubmenu] The CSS selector to find the trigger buttons for sub nav items.
36+
* @param {string} [options.selectorSideNavItem] The CSS selector to find the nav items.
37+
* @param {string} [options.selectorSideNavLink] The CSS selector to find the interactive potions in non-nested nav items.
38+
* @param {string} [options.selectorSideNavLinkCurrent]
39+
* The CSS selector to find the interactive potion in active non-nested nav item.
40+
* @param {string} [options.classSideNavExpanded] The CSS class for the expanded state.
41+
* @param {string} [options.classSideNavItemActive]
42+
* The CSS class for the active/inactive state for nav items.
43+
* @param {string} [options.classSideNavLinkCurrent]
44+
* The CSS class for the active/inactive state of the interactive potion in non-nested nav items.
45+
*/
3046
constructor(element, options) {
3147
super(element, options);
3248
this.manage(on(element, 'click', this._handleClick));
@@ -118,6 +134,16 @@ export default class SideNav extends mixin(
118134
* @member SideNav.options
119135
* @type {object}
120136
* @property {string} selectorInit The data attribute to find side navs.
137+
* @property {string} [selectorSideNavToggle] The CSS selector to find the toggle button.
138+
* @property {string} [selectorSideNavSubmenu] The CSS selector to find the trigger buttons for sub nav items.
139+
* @property {string} [selectorSideNavItem] The CSS selector to find the nav items.
140+
* @property {string} [selectorSideNavLink] The CSS selector to find the interactive portions in non-nested nav items.
141+
* @property {string} [selectorSideNavLinkCurrent]
142+
* The CSS selector to find the interactive potion in active non-nested nav item.
143+
* @property {string} [classSideNavExpanded] The CSS class for the expanded state.
144+
* @property {string} [classSideNavItemActive] The CSS class for the active/inactive state for nav items.
145+
* @property {string} [classSideNavLinkCurrent]
146+
* The CSS class for the active/inactive state of the interactive portion in non-nested nav items.
121147
*/
122148
static options /* #__PURE_CLASS_PROPERTY__ */ = {
123149
selectorInit: '[data-side-nav]',
@@ -131,3 +157,5 @@ export default class SideNav extends mixin(
131157
classSideNavLinkCurrent: `${prefix}--side-nav__link--current`,
132158
};
133159
}
160+
161+
export default SideNav;

0 commit comments

Comments
 (0)
Please sign in to comment.