Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
1c0d644
feat(InternalLabel): add internal label across form components
aPreciado88 Jul 11, 2025
dc6b904
feat(InternalLabel): fix dev merge conflicts
aPreciado88 Jul 11, 2025
5ed7e17
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Jul 14, 2025
0d74296
feat(internalLabel): add internal label across form components
aPreciado88 Jul 24, 2025
a513f7a
feat(internalLabel): remove asterisk
aPreciado88 Jul 24, 2025
cbd0167
feat(internalLabel): fix merge conflicts
aPreciado88 Jul 24, 2025
6502a47
feat(internalLabel): update ariaLabel prop
aPreciado88 Jul 25, 2025
01fe6e3
feat(internalLabel): update ariaLabel property
aPreciado88 Jul 28, 2025
507e3cd
feat(internalLabel): skip autocomplete slot test
aPreciado88 Jul 28, 2025
9479fb0
feat(internalLabel): fix auto-complete slots e2e test
aPreciado88 Jul 29, 2025
f619f62
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Jul 29, 2025
15d5283
feat(internalLabel): remove translation strings
aPreciado88 Jul 30, 2025
c6c4457
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Jul 31, 2025
abde880
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Jul 31, 2025
ed99785
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Jul 31, 2025
0295f03
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Aug 1, 2025
4d2d7b5
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Aug 1, 2025
df1a156
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Aug 1, 2025
8bf0381
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Aug 4, 2025
7422503
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Aug 4, 2025
a77ea50
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Aug 5, 2025
be2bb3d
feat(internalLabel): add global css variables
aPreciado88 Aug 7, 2025
bf21d7d
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Aug 7, 2025
43a8d40
feat(internalLabel): remove CHANGELOG_BETA.md
aPreciado88 Aug 7, 2025
1e8d3e8
feat(internalLabel): remove CHANGELOG_BETA.md
aPreciado88 Aug 7, 2025
d776f6c
feat(internalLabel): remove CHANGELOG_BETA.md changes
aPreciado88 Aug 7, 2025
5e5f0ec
feat(internalLabel): update internal label slot and prop names
aPreciado88 Aug 7, 2025
9f03b2d
feat(internalLabel): update labelText prop description
aPreciado88 Aug 7, 2025
31ee3fd
feat(internalLabel): add cursor:help when hovering required indicator…
aPreciado88 Aug 8, 2025
9adc38e
feat(internalLabel): add internalLabel css updates
aPreciado88 Aug 8, 2025
a8997f5
feat(internalLabel): add internal label line-height
aPreciado88 Aug 13, 2025
61ceaf9
feat(internalLabel): add internal label center alignment prop
aPreciado88 Aug 13, 2025
54636b2
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Aug 15, 2025
9843bf4
feat: move label-content slot into internalLabel.tsx
aPreciado88 Aug 18, 2025
27e99df
feat: remove anonymous functions being passed to internalLabel and as…
aPreciado88 Aug 18, 2025
dff28c8
feat: revert to using ariaLabel={getLabelText(this)} for a11y
aPreciado88 Aug 19, 2025
c0b3073
feat: consolidate internalLabel spacing props
aPreciado88 Aug 19, 2025
474db76
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Aug 19, 2025
71f7270
feat: remove remaining spaceBottom prop
aPreciado88 Aug 19, 2025
a7449c6
feat: add internal label stories file
aPreciado88 Aug 19, 2025
8fd0ff0
feat: add <label> to internalLabel functional component
aPreciado88 Aug 20, 2025
41d0c8d
feat: add id to internalLabel.tsx
aPreciado88 Aug 20, 2025
43ddcb7
feat: remove internalLabe individual stories
aPreciado88 Aug 20, 2025
8edd23a
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Aug 21, 2025
3b2a6b0
feat: update internal label stories title
aPreciado88 Aug 21, 2025
ef28bd6
feat: split up internal label stories
aPreciado88 Aug 21, 2025
d1e623e
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Aug 21, 2025
7b8ae84
feat: remove id from internalLabel
aPreciado88 Aug 26, 2025
48b4473
feat: rename internalLabel props
aPreciado88 Aug 27, 2025
3503459
feat: add internalLabel common tests
aPreciado88 Aug 28, 2025
2695bcb
feat: import CSS classes into internalLabel.ts common test
aPreciado88 Aug 28, 2025
74c87d5
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Aug 28, 2025
66ebc5c
feat: rename internalLabel props
aPreciado88 Sep 2, 2025
062068f
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 Sep 2, 2025
267a98e
feat: fix merge conflicts
aPreciado88 Sep 3, 2025
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
75 changes: 75 additions & 0 deletions packages/calcite-components/src/assets/styles/includes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,81 @@
}
}

// mixin for the container of label displayed with form-associated components
@mixin form-internal-label() {
.internal-label-alignment--center {
align-items: center;
}

.internal-label-alignment--end {
align-items: end;
}

.internal-label--container {
display: flex;
justify-content: space-between;
color: var(--calcite-color-text-1);
}

.internal-label-required--indicator {
font-weight: var(--calcite-font-weight-medium);
color: var(--calcite-color-status-danger);
padding-inline: var(--calcite-spacing-base);
&:hover {
cursor: help;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirming this cursor usage cc @SkyeSeitz @ashetland

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had mentioned it in the design file, but don't have to move forward with it if we don't want to.

}
}

.internal-label--text {
line-height: 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use a token?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found these tokens with value of 1. Which one would be good to use in this case?

var(--calcite-opacity-100)
var(--calcite-opacity-full)
var(--calcite-z-index)
var(--calcite-z-index-1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aPreciado88 it should be a var for line height. We can't just use any 1 value. Otherwise, its not using the correct token for its purpose.

@ashetland can you chime in?

These are the ones I see: https://developers.arcgis.com/calcite-design-system/foundations/tokens/reference/#font

image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I recall, we were unable to get the correct alignment using our tokens. @aPreciado88 did we try var(--calcite-font-line-height-relative)? That should be the same as setting line-height: 1;, I believe.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashetland I tried var(--calcite-font-line-height-relative) but didn't work, it pushes the text to the bottom.

Copy link
Copy Markdown
Contributor

@ashetland ashetland Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-base for 1 / 100% I think works. For calcite-font-line-height-relative, auto isn't a valid value. I think we could set that one to normal and we'd cover all the bases.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#12783 created. To confirm, the relative line-height additions listed in this issue are all we need here?

Copy link
Copy Markdown
Member

@driskull driskull Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the compiled css for Calcite, it does seem like this is a bug:

--calcite-font-line-height-relative: auto;

auto isn't a valid value for line-height in CSS so we should get this fixed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@driskull my issue proposes changing --calcite-font-line-height-relative's value to normal - is that a valid alternative to what we assume auto was intended to be?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that seems correct 👍

}

:host([scale="s"]) {
.internal-label-spacing--bottom {
margin-block-end: var(--calcite-spacing-xxs);
}
.internal-label-spacing-inline--end {
margin-inline-end: var(--calcite-spacing-sm);
}
.internal-label-spacing-inline--start {
margin-inline-start: var(--calcite-spacing-sm);
}
.internal-label--text {
font-size: var(--calcite-font-size--2);
}
}

:host([scale="m"]) {
.internal-label-spacing--bottom {
margin-block-end: var(--calcite-spacing-sm);
}
.internal-label-spacing-inline--end {
margin-inline-end: var(--calcite-spacing-sm);
}
.internal-label-spacing-inline--start {
margin-inline-start: var(--calcite-spacing-sm);
}
.internal-label--text {
font-size: var(--calcite-font-size--1);
}
}

:host([scale="l"]) {
.internal-label-spacing--bottom {
margin-block-end: var(--calcite-spacing-sm);
}
.internal-label-spacing-inline--end {
margin-inline-end: var(--calcite-spacing-md);
}
.internal-label-spacing-inline--start {
margin-inline-start: var(--calcite-spacing-md);
}
.internal-label--text {
font-size: var(--calcite-font-size-0);
}
}
}

// mixin for the container of validation messages displayed below form-associated components
@mixin form-validation-message() {
.validation-container {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
focusable,
formAssociated,
hidden,
internalLabel,
labelable,
openClose,
reflects,
Expand Down Expand Up @@ -478,6 +479,10 @@ describe("calcite-autocomplete", () => {
focusable("calcite-autocomplete");
});

describe("InternalLabel", () => {
internalLabel(`calcite-autocomplete`);
});

it("should set screen reader list attribute 'aria-live' to 'polite'", async () => {
const page = await newE2EPage();
await page.setContent(simpleHTML);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
@apply sr-only;
}

@include form-internal-label();
@include form-validation-message();
@include hidden-form-input();
@include base-component();
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
import { toggleOpenClose, OpenCloseComponent } from "../../utils/openCloseComponent";
import { Alignment, Scale, Status } from "../interfaces";
import { IconNameOrString } from "../icon/interfaces";
import { connectLabel, disconnectLabel, LabelableComponent } from "../../utils/label";
import { connectLabel, disconnectLabel, LabelableComponent, getLabelText } from "../../utils/label";
import { TextualInputComponent } from "../input/common/input";
import {
afterConnectDefaultValueSet,
Expand All @@ -53,6 +53,7 @@ import type { Input } from "../input/input";
import type { AutocompleteItem } from "../autocomplete-item/autocomplete-item";
import type { AutocompleteItemGroup } from "../autocomplete-item-group/autocomplete-item-group";
import type { Label } from "../label/label";
import { InternalLabel } from "../functional/InternalLabel";
import { Validation } from "../functional/Validation";
import { createObserver } from "../../utils/observers";
import { useSetFocus } from "../../controllers/useSetFocus";
Expand All @@ -73,6 +74,7 @@ declare global {
* @slot - A slot for adding `calcite-autocomplete-item` elements.
* @slot content-bottom - A slot for adding content below `calcite-autocomplete-item` elements.
* @slot content-top - A slot for adding content above `calcite-autocomplete-item` elements.
* @slot label-content - A slot for rendering content next to the component's `labelText`.
*/
export class Autocomplete
extends LitElement
Expand Down Expand Up @@ -206,6 +208,9 @@ export class Autocomplete
/** Accessible name for the component. */
@property() label: string;

/** When provided, displays label text on the component. */
@property() labelText: string;

/** When present, a busy indicator is displayed. */
@property({ reflect: true }) loading = false;

Expand Down Expand Up @@ -781,11 +786,20 @@ export class Autocomplete

return (
<InteractiveContainer disabled={disabled}>
{this.labelText && (
<InternalLabel
labelText={this.labelText}
onClick={this.onLabelClick}
required={this.required}
tooltipText={this.messages.required}
/>
)}
<div class={CSS.inputContainer}>
<calcite-input
alignment={this.alignment}
aria-activedescendant={this.activeDescendant}
aria-controls={listId}
aria-label={getLabelText(this)}
aria-owns={listId}
ariaAutoComplete="list"
ariaExpanded={isOpen}
Expand Down Expand Up @@ -817,6 +831,7 @@ export class Autocomplete
prefixText={this.prefixText}
readOnly={this.readOnly}
ref={this.setReferenceEl}
required={this.required}
role="combobox"
scale={this.scale}
status={this.status}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,4 +415,3 @@ export const emptyHeader = (): string => html`
</calcite-label>
</calcite-block>
`;

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import {
focusable,
formAssociated,
hidden,
internalLabel,
HYDRATED_ATTR,
labelable,
t9n,
themed,
} from "../../tests/commonTests";
import { html } from "../../../support/formatting";
Expand Down Expand Up @@ -184,6 +186,10 @@ describe("calcite-checkbox", () => {
});
});

describe("InternalLabel", () => {
internalLabel(`calcite-checkbox`);
});

describe("WCAG AA recommended minimum 24px click area", () => {
const testCheckboxClick = async (scale: Scale, maxExtraPixels: number, direction: "ltr" | "rtl"): Promise<void> => {
const page = await newE2EPage();
Expand Down Expand Up @@ -225,6 +231,10 @@ describe("calcite-checkbox", () => {
});
});

describe("translation support", () => {
t9n("calcite-checkbox");
});

describe("theme", () => {
describe("default", () => {
themed(html` <calcite-checkbox name="s-unchecked" scale="s"></calcite-checkbox> `, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
}
}

@include form-internal-label();
@include disabled();
@include hidden-form-input();
@include base-component();
26 changes: 26 additions & 0 deletions packages/calcite-components/src/components/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ import { connectLabel, disconnectLabel, getLabelText, LabelableComponent } from
import { Scale, Status } from "../interfaces";
import { CSS_UTILITY } from "../../utils/resources";
import type { Label } from "../label/label";
import { InternalLabel } from "../functional/InternalLabel";
import { useT9n } from "../../controllers/useT9n";
import { useSetFocus } from "../../controllers/useSetFocus";
import { CSS } from "./resources";
import { styles } from "./checkbox.scss";
import T9nStrings from "./assets/t9n/messages.en.json";

declare global {
interface DeclareElements {
Expand Down Expand Up @@ -59,6 +62,13 @@ export class Checkbox

private toggleEl = createRef<HTMLDivElement>();

/**
* Made into a prop for testing purposes only
*
* @private
*/
messages = useT9n<typeof T9nStrings>();

private focusSetter = useSetFocus<this>()(this);

// #endregion
Expand Down Expand Up @@ -97,6 +107,12 @@ export class Checkbox
/** Accessible name for the component. */
@property() label: string;

/** When provided, displays label text on the component. */
@property() labelText: string;

/** Use this property to override individual strings used by the component. */
@property() messageOverrides?: typeof this.messages._overrides;

/**
* Specifies the name of the component.
*
Expand Down Expand Up @@ -254,6 +270,7 @@ export class Checkbox
<div
ariaChecked={this.checked}
ariaLabel={getLabelText(this)}
ariaRequired={this.required}
class={{
[CSS.toggle]: true,
[CSS_UTILITY.rtl]: rtl,
Expand All @@ -269,6 +286,15 @@ export class Checkbox
</svg>
<slot />
</div>
{this.labelText && (
<InternalLabel
bottomSpacingDisabled={true}
labelText={this.labelText}
required={this.required}
spacingInlineStart={true}
tooltipText={this.messages.required}
/>
)}
<HiddenFormInputSlot component={this} />
</InteractiveContainer>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
focusable,
formAssociated,
hidden,
internalLabel,
labelable,
openClose,
reflects,
Expand Down Expand Up @@ -150,6 +151,10 @@ describe("calcite-combobox", () => {
`);
});

describe("InternalLabel", () => {
internalLabel(`calcite-combobox`);
});

describe("honors hidden attribute", () => {
hidden("calcite-combobox");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,5 @@ calcite-chip {
padding-block-start: var(--calcite-internal-combobox-spacing-unit-l);
}

@include form-internal-label();
@include input-placeholder-text();
18 changes: 17 additions & 1 deletion packages/calcite-components/src/components/combobox/combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import { DEBOUNCE } from "../../utils/resources";
import { Scale, SelectionMode, Status } from "../interfaces";
import { CSS as XButtonCSS, XButton } from "../functional/XButton";
import { getIconScale, isHidden } from "../../utils/component";
import { InternalLabel } from "../functional/InternalLabel";
import { Validation } from "../functional/Validation";
import { IconNameOrString } from "../icon/interfaces";
import { useT9n } from "../../controllers/useT9n";
Expand Down Expand Up @@ -79,7 +80,10 @@ declare global {
}
}

/** @slot - A slot for adding `calcite-combobox-item`s. */
/**
* @slot - A slot for adding `calcite-combobox-item`s.
* @slot label-content - A slot for rendering content next to the component's `labelText`.
*/
export class Combobox
extends LitElement
implements
Expand Down Expand Up @@ -369,6 +373,9 @@ export class Combobox
*/
@property() label: string;

/** When provided, displays label text on the component. */
@property() labelText: string;

/** Specifies the maximum number of `calcite-combobox-item`s (including nested children) to display before displaying a scrollbar. */
@property({ reflect: true }) maxItems = 0;

Expand Down Expand Up @@ -1757,6 +1764,7 @@ export class Combobox
placeholder={placeholder}
readOnly={this.readOnly}
ref={this.textInput}
required={this.required}
role="combobox"
tabIndex={this.activeChipIndex === -1 ? 0 : -1}
type="text"
Expand Down Expand Up @@ -1897,6 +1905,14 @@ export class Combobox

return (
<InteractiveContainer disabled={this.disabled}>
{this.labelText && (
<InternalLabel
labelText={this.labelText}
onClick={this.onLabelClick}
required={this.required}
tooltipText={this.messages.required}
/>
)}
<div
ariaLive="polite"
class={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ export const ICONS = {
chevronUp: "chevron-up",
chevronDown: "chevron-down",
};

export const SLOTS = {
labelContent: "label-content",
};
Loading
Loading