Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dropdown-group): Remove undocumented properties from the Host element. #2059 #2100

Merged
merged 1 commit into from
May 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
:host([scale="s"]) {
.container--s {
@apply text--2h;
.dropdown-title {
@apply p-2;
}
}

:host([scale="m"]) {
.container--m {
@apply text--1h;
.dropdown-title {
@apply p-3;
}
}

:host([scale="l"]) {
.container--l {
@apply text-1h;
.dropdown-title {
@apply p-4;
Expand Down
22 changes: 19 additions & 3 deletions src/components/calcite-dropdown-group/calcite-dropdown-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
import { getElementDir, getElementProp } from "../../utils/dom";
import { GroupRegistration, ItemRegistration } from "../calcite-dropdown/interfaces";
import { SelectionMode } from "./interfaces";
import { Scale } from "../interfaces";
import { CSS } from "./resources";

@Component({
tag: "calcite-dropdown-group",
Expand Down Expand Up @@ -39,6 +41,11 @@ export class CalciteDropdownGroup {
none (no active items), defaults to single */
@Prop({ reflect: true }) selectionMode: SelectionMode = "single";

/**
* Specifies the size of the action.
*/
@Prop({ reflect: true }) scale: Scale;

//--------------------------------------------------------------------------
//
// Events
Expand Down Expand Up @@ -91,7 +98,7 @@ export class CalciteDropdownGroup {

render(): VNode {
const dir = getElementDir(this.el);
const scale = getElementProp(this.el, "scale", "m");
const scale: Scale = this.scale || getElementProp(this.el, "scale", "m");
const groupTitle = this.groupTitle ? (
<span aria-hidden="true" class="dropdown-title" ref={this.setDropdownTitleRef}>
{this.groupTitle}
Expand All @@ -104,8 +111,17 @@ export class CalciteDropdownGroup {
) : null;

return (
<Host role="menu" scale={scale} title={this.groupTitle}>
<div dir={dir}>
<Host role="menu">
<div
class={{
container: true,
caripizza marked this conversation as resolved.
Show resolved Hide resolved
[CSS.containerSmall]: scale === "s",
[CSS.containerMedium]: scale === "m",
[CSS.containerLarge]: scale === "l"
}}
dir={dir}
title={this.groupTitle}
>
{dropdownSeparator}
{groupTitle}
<slot />
Expand Down
5 changes: 5 additions & 0 deletions src/components/calcite-dropdown-group/resources.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const CSS = {
containerSmall: "container--s",
containerMedium: "container--m",
containerLarge: "container--l"
};