diff --git a/packages/calcite-components/src/components.d.ts b/packages/calcite-components/src/components.d.ts index 459c8b51ce6..28c6c632337 100644 --- a/packages/calcite-components/src/components.d.ts +++ b/packages/calcite-components/src/components.d.ts @@ -2845,6 +2845,10 @@ export namespace Components { * Sets the item as focusable. Only one item should be focusable within a list. */ "active": boolean; + /** + * Sets the item to display a border. + */ + "bordered": boolean; /** * When `true`, a close button is added to the component. */ @@ -10362,6 +10366,10 @@ declare namespace LocalJSX { * Sets the item as focusable. Only one item should be focusable within a list. */ "active"?: boolean; + /** + * Sets the item to display a border. + */ + "bordered"?: boolean; /** * When `true`, a close button is added to the component. */ diff --git a/packages/calcite-components/src/components/handle/handle.scss b/packages/calcite-components/src/components/handle/handle.scss index 2ca02c8f619..09bfd0ddbd1 100644 --- a/packages/calcite-components/src/components/handle/handle.scss +++ b/packages/calcite-components/src/components/handle/handle.scss @@ -8,8 +8,7 @@ items-center justify-center self-stretch - border-none - bg-transparent; + border-none; color: theme("borderColor.color.input"); padding-block: theme("spacing.3"); padding-inline: theme("spacing.1"); diff --git a/packages/calcite-components/src/components/list-item-group/list-item-group.scss b/packages/calcite-components/src/components/list-item-group/list-item-group.scss index eda0e772932..0a124c6627b 100644 --- a/packages/calcite-components/src/components/list-item-group/list-item-group.scss +++ b/packages/calcite-components/src/components/list-item-group/list-item-group.scss @@ -1,6 +1,5 @@ :host { @apply flex flex-col bg-foreground-1; - --calcite-list-item-spacing-indent: theme("spacing.4"); } :host([filter-hidden]) { @@ -15,20 +14,6 @@ .heading { @apply p-0; - padding-inline-start: calc( - var(--calcite-list-item-spacing-indent) * var(--calcite-list-item-spacing-indent-multiplier) - ); -} - -::slotted(calcite-list-item) { - @apply shadow-border-top; - margin-block-start: 1px; -} - -// removes shadow for the first item of the group for both filtered and unfiltered items. -::slotted(calcite-list-item:nth-child(1 of :not([hidden]))) { - @apply shadow-none; - margin-block-start: 0px; } @include base-component(); diff --git a/packages/calcite-components/src/components/list-item-group/list-item-group.tsx b/packages/calcite-components/src/components/list-item-group/list-item-group.tsx index 87943ce6967..3d393b6892d 100644 --- a/packages/calcite-components/src/components/list-item-group/list-item-group.tsx +++ b/packages/calcite-components/src/components/list-item-group/list-item-group.tsx @@ -1,14 +1,4 @@ -import { - Component, - Element, - Event, - EventEmitter, - h, - Host, - Prop, - State, - VNode, -} from "@stencil/core"; +import { Component, Element, Event, EventEmitter, h, Host, Prop, VNode } from "@stencil/core"; import { connectInteractive, disconnectInteractive, @@ -17,7 +7,6 @@ import { updateHostInteraction, } from "../../utils/interactive"; import { MAX_COLUMNS } from "../list-item/resources"; -import { getDepth } from "../list-item/utils"; import { CSS } from "./resources"; /** * @slot - A slot for adding `calcite-list-item` and `calcite-list-item-group` elements. @@ -71,8 +60,6 @@ export class ListItemGroup implements InteractiveComponent { // -------------------------------------------------------------------------- connectedCallback(): void { - const { el } = this; - this.visualLevel = getDepth(el, true); connectInteractive(this); } @@ -92,8 +79,6 @@ export class ListItemGroup implements InteractiveComponent { @Element() el: HTMLCalciteListItemGroupElement; - @State() visualLevel: number = null; - // -------------------------------------------------------------------------- // // Render Methods @@ -101,14 +86,11 @@ export class ListItemGroup implements InteractiveComponent { // -------------------------------------------------------------------------- render(): VNode { - const { disabled, heading, visualLevel } = this; + const { disabled, heading } = this; return ( - + {heading} diff --git a/packages/calcite-components/src/components/list-item/list-item.scss b/packages/calcite-components/src/components/list-item/list-item.scss index 3beec9c28d6..e74fe808d6c 100755 --- a/packages/calcite-components/src/components/list-item/list-item.scss +++ b/packages/calcite-components/src/components/list-item/list-item.scss @@ -1,11 +1,29 @@ :host { - @apply flex flex-col; + @apply flex flex-col bg-foreground-1; --calcite-list-item-icon-color: theme("colors.brand"); - --calcite-list-item-spacing-indent: theme("spacing.4"); +} + +:host([filter-hidden]), +:host([closed]) { + @apply hidden; +} + +.wrapper--bordered { + border-block-end: 1px solid var(--calcite-color-border-3); } @include disabled(); +.indent { + @apply flex + flex-col + border-solid + border-0 + border-color-3; + + margin-inline-start: var(--calcite-list-item-spacing-indent, theme("spacing.6")); +} + .container { @apply bg-foreground-1 box-border @@ -14,9 +32,6 @@ * { @apply box-border; } - padding-inline-start: calc( - var(--calcite-list-item-spacing-indent) * var(--calcite-list-item-spacing-indent-multiplier) - ); } .container--hover:hover { @@ -47,7 +62,7 @@ } .nested-container { - @apply bg-foreground-1 flex flex-col; + @apply flex flex-col; } .nested-container--hidden { @@ -122,13 +137,14 @@ td:focus { .content-start, .content-end { @apply flex-auto; + + ::slotted(calcite-icon) { + @apply self-center mx-3; + } } .content-bottom { - @apply bg-foreground-1 flex flex-col; - padding-inline-start: calc( - var(--calcite-list-item-spacing-indent) * var(--calcite-list-item-spacing-indent-multiplier) - ); + @apply flex flex-col; } .content-container--has-center-content .content-start, @@ -171,6 +187,11 @@ td:focus { .drag-container, .open-container { @apply flex items-center; + + calcite-action, + calcite-handle { + @apply self-stretch; + } } .open-container, @@ -178,13 +199,6 @@ td:focus { @apply cursor-pointer; } -.content-start, -.content-end { - ::slotted(calcite-icon) { - @apply self-center mx-3; - } -} - .actions-start, .actions-end { @apply p-0; @@ -198,13 +212,8 @@ td:focus { } } -::slotted(calcite-list-item), -::slotted(calcite-list) { - @apply border-solid border-0 border-t border-color-3; -} - ::slotted(calcite-list:empty) { - @apply py-3; + @apply border-t-0; } @include base-component(); diff --git a/packages/calcite-components/src/components/list-item/list-item.tsx b/packages/calcite-components/src/components/list-item/list-item.tsx index cf7d33c6bdb..4b379ba1107 100644 --- a/packages/calcite-components/src/components/list-item/list-item.tsx +++ b/packages/calcite-components/src/components/list-item/list-item.tsx @@ -97,6 +97,13 @@ export class ListItem } } + /** + * Sets the item to display a border. + * + * @internal + */ + @Prop() bordered = false; + /** When `true`, a close button is added to the component. */ @Prop({ reflect: true }) closable = false; @@ -312,8 +319,6 @@ export class ListItem @State() level: number = null; - @State() visualLevel: number = null; - @State() parentListEl: HTMLCalciteListElement; @State() openable = false; @@ -355,7 +360,6 @@ export class ListItem const { el } = this; this.parentListEl = el.closest(listSelector); this.level = getDepth(el) + 1; - this.visualLevel = getDepth(el, true); this.setSelectionDefaults(); } @@ -560,13 +564,9 @@ export class ListItem } renderContentBottom(): VNode { - const { hasContentBottom, visualLevel } = this; + const { hasContentBottom } = this; return ( -