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

feat(block): add icon start/end properties (deprecate icon slot and status), add actions-end slot (deprecate control), add content-start #9535

Merged
merged 23 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from 21 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
26 changes: 26 additions & 0 deletions packages/calcite-components/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,18 @@ export namespace Components {
* Specifies the heading level of the component's `heading` for proper document structure, without affecting visual styling.
*/
"headingLevel": HeadingLevel;
/**
* Specifies an icon to display at the end of the component.
*/
"iconEnd": string;
/**
* Displays the `iconStart` and/or `iconEnd` as flipped when the element direction is right-to-left (`"rtl"`).
*/
"iconFlipRtl": FlipContext;
/**
* Specifies an icon to display at the start of the component.
*/
"iconStart": string;
/**
* When `true`, a busy indicator is displayed.
*/
Expand All @@ -636,6 +648,7 @@ export namespace Components {
"setFocus": () => Promise<void>;
/**
* Displays a status-related indicator icon.
* @deprecated Use `icon-start` instead.
*/
"status": Status;
}
Expand Down Expand Up @@ -8324,6 +8337,18 @@ declare namespace LocalJSX {
* Specifies the heading level of the component's `heading` for proper document structure, without affecting visual styling.
*/
"headingLevel"?: HeadingLevel;
/**
* Specifies an icon to display at the end of the component.
*/
"iconEnd"?: string;
/**
* Displays the `iconStart` and/or `iconEnd` as flipped when the element direction is right-to-left (`"rtl"`).
*/
"iconFlipRtl"?: FlipContext;
/**
* Specifies an icon to display at the start of the component.
*/
"iconStart"?: string;
/**
* When `true`, a busy indicator is displayed.
*/
Expand Down Expand Up @@ -8367,6 +8392,7 @@ declare namespace LocalJSX {
"overlayPositioning"?: OverlayPositioning;
/**
* Displays a status-related indicator icon.
* @deprecated Use `icon-start` instead.
*/
"status"?: Status;
}
Expand Down
50 changes: 39 additions & 11 deletions packages/calcite-components/src/components/block/block.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
@import "../../assets/styles/header";

.header {
@apply justify-start p-0;
@apply justify-start;
padding: var(--calcite-spacing-md);
}

.header,
Expand All @@ -31,11 +32,27 @@
.header-container {
@apply grid items-stretch;
grid-template: auto / auto 1fr auto auto;
grid-template-areas: "handle header control menu";
grid-column: header-start / menu-end;
grid-template-areas: "handle header control menu actions-end";
grid-column: header-start / actions-end;
grid-row: 1 / 2;
}

.content-start,
.icon,
.icon--start,
.icon--end {
margin-inline-end: var(--calcite-spacing-md);
}

.icon--start,
.icon--end {
@apply text-color-3;
}

.actions-end {
grid-area: actions-end;
}

.toggle {
@apply font-sans
focus-base
Expand All @@ -47,9 +64,10 @@
justify-between
border-none
p-0;
text-align: initial;

text-align: initial;
background-color: transparent;

&:hover {
@apply bg-foreground-2;
}
Expand All @@ -69,7 +87,6 @@ calcite-handle {

.title {
@apply m-0;
padding: theme("spacing.3");
}

.header .title .heading {
Expand All @@ -93,9 +110,7 @@ calcite-handle {
}

.icon {
Elijbet marked this conversation as resolved.
Show resolved Hide resolved
display: flex;
margin-inline-start: theme("spacing.3");
margin-inline-end: 0px;
@apply flex;
}

.status-icon.valid {
Expand All @@ -118,16 +133,21 @@ calcite-handle {
}
}

.icon-end-container {
@apply flex items-center;

margin-inline-start: auto;
}

.toggle-icon {
@apply text-color-3
transition-color
my-3
self-center
justify-self-end
duration-150
ease-in-out;
margin-inline-end: theme("spacing.3");
margin-inline-start: auto;

margin-inline-end: var(--calcite-spacing-md);
}

.toggle:hover .toggle-icon {
Expand All @@ -144,6 +164,10 @@ calcite-handle {
padding-inline: var(--calcite-block-padding, var(--calcite-spacing-md));
}

.content-start {
@apply text-color-3 flex items-center;
}

.control-container {
@apply m-0 flex;
grid-area: control;
Expand All @@ -153,6 +177,10 @@ calcite-action-menu {
grid-area: menu;
}

.actions-end {
@apply flex items-stretch;
}

:host([open]) {
@apply my-2;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,38 @@ export const icons_TestOnly = (): string => html`
</calcite-block-section>
</calcite-block>
`;

export const iconStartEnd = (): string => html`
<h1>content-start and actions-end</h1>

<calcite-block
heading="Valid status"
description="summary"
collapsible
icon-start="pen"
icon-end="pen"
style="width: 500px"
>
<calcite-icon
icon="compass"
slot="content-start"
style="color: var(--calcite-color-status-success)"
scale="s"
></calcite-icon>
<calcite-action appearance="transparent" icon="ellipsis" text="menu" label="menu" slot="actions-end" />
</calcite-block>

<h1>loading and actions-end</h1>

<calcite-block
heading="Valid status"
collapsible
status="valid"
icon-start="pen"
icon-end="pen"
loading
style="width: 500px"
>
<calcite-action appearance="transparent" icon="ellipsis" text="menu" label="menu" slot="actions-end" />
</calcite-block>
`;
Loading
Loading