Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/little-feet-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@kaizen/components': patch
---

Update Label and LabelledMessage components to CSS from SCSS
97 changes: 97 additions & 0 deletions packages/components/src/Label/Label.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
@layer kz-components {
:root {
--label-start-margin: var(--spacing-xs);
--dt-color-form-text-color: var(--color-purple-800);
}

.label {
--icon-vertical-align: text-bottom;
}

.label,
:global(.ideal-sans) .label {
/* override Murmur global styles :( */
opacity: inherit;
color: var(--dt-color-form-text-color);
visibility: visible;
width: 100%;
text-align: start;
}

.reversed {
color: var(--color-white);

a {
color: var(--color-white);

&:hover {
text-decoration: none;
}
}
}

.disabled {
opacity: 0.3;
}

/* ///////////////////////////////////////////////////
//// LABEL TYPES
//////////////////////////////////////////////////// */

/* This is to override bootstrap styles. Remove when appropriate */
.text,
:global(.ideal-sans) .text {
font-family: var(--typography-heading-6-font-family);
font-size: var(--typography-heading-6-font-size);
line-height: var(--typography-heading-6-line-height);
letter-spacing: var(--typography-heading-6-letter-spacing);
font-weight: var(--typography-heading-6-font-weight);
}

.checkboxOrRadio,
.checkbox,
.radio,
:global(.ideal-sans) .checkboxOrRadio {
display: flex;
font-family: var(--typography-paragraph-body-font-family);
font-size: var(--typography-paragraph-body-font-size);
line-height: var(--typography-paragraph-body-line-height);
letter-spacing: var(--typography-paragraph-body-letter-spacing);
font-weight: var(--typography-paragraph-body-font-weight);
}

.toggle {
display: flex;
justify-content: space-between;
align-items: center;
font-family: var(--typography-paragraph-body-font-family);
font-size: var(--typography-paragraph-body-font-size);
line-height: var(--typography-paragraph-body-line-height);
letter-spacing: var(--typography-paragraph-body-letter-spacing);
font-weight: var(--typography-paragraph-body-font-weight);
}

.checkbox,
.radio,
.toggle {
/* apply padding when label is inline with form control */
.prependedLabel {
order: -1; /* place label before the control */
margin-inline-end: var(--label-start-margin);
}

.appendedLabel {
margin-inline-start: var(--label-start-margin);
}
}

.prominent {
font-family: var(--typography-heading-4-font-family);
font-weight: var(--typography-heading-4-font-weight);
font-size: var(--typography-heading-4-font-size);
line-height: var(--typography-heading-4-line-height);
letter-spacing: var(--typography-heading-4-letter-spacing);
display: block;
margin-bottom: var(--spacing-xs);
}
}
105 changes: 0 additions & 105 deletions packages/components/src/Label/Label.module.scss

This file was deleted.

2 changes: 1 addition & 1 deletion packages/components/src/Label/Label.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { type LabelHTMLAttributes } from 'react'
import classnames from 'classnames'
import { type OverrideClassName } from '~components/types/OverrideClassName'
import styles from './Label.module.scss'
import styles from './Label.module.css'

type LabelType = 'text' | 'checkbox' | 'toggle' | 'radio'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import { type Meta } from '@storybook/react'
import { Link } from '~components/Link'
import { StickerSheet, type StickerSheetStory } from '~storybook/components/StickerSheet'
import { Label, type LabelProps } from '../index'
import { BlockLabelTypes, InlineLabelTypes } from '../types'
Expand Down Expand Up @@ -35,12 +36,14 @@ const InlineControl = ({ labelText, ...props }: WrapperProps): JSX.Element => (
labelText={
<span data-sb-a11y-color-contrast-disable={props['data-sb-a11y-color-contrast-disable']}>
{labelText}{' '}
<a
<Link
href="/"
Copy link
Contributor Author

@mia-nguyen0411 mia-nguyen0411 Feb 27, 2026

Choose a reason for hiding this comment

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

Using Link component instead of <a> after checking with the team. Expected Storybook and Chromatic changes but users will not see any changes from their end. This only change the preview

Changes on Storybook and Chromatic checks are approved because these changes are expected.

isInline={true}
{...(props.reversed ? { variant: 'white' } : {})}
data-sb-a11y-color-contrast-disable={props['data-sb-a11y-color-contrast-disable']}
>
a
</a>
</Link>
</span>
}
>
Expand All @@ -55,12 +58,14 @@ const BlockControl = ({ labelText, ...props }: WrapperProps): JSX.Element => (
labelText={
<span data-sb-a11y-color-contrast-disable={props['data-sb-a11y-color-contrast-disable']}>
{labelText}{' '}
<a
<Link
href="/"
isInline={true}
{...(props.reversed ? { variant: 'white' } : {})}
data-sb-a11y-color-contrast-disable={props['data-sb-a11y-color-contrast-disable']}
>
anchor
</a>
</Link>
</span>
}
/>
Expand Down
Copy link
Contributor Author

@mia-nguyen0411 mia-nguyen0411 Feb 26, 2026

Choose a reason for hiding this comment

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

There were no font-family or font-size for this component which does not align to the preview in the docs. Will find the appropriate value for this

Update: After confirmed with team, the component behaves as expected and inherits page styles, so leaving it as-is is fine

Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
@import '~@kaizen/design-tokens/sass/spacing';

@layer kz-components {
.labelledMessage {
display: inline-flex;
white-space: nowrap;
}

.labelSeparator {
margin-inline-end: $spacing-6;
margin-inline-end: var(--spacing-6);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { type HTMLAttributes } from 'react'
import classnames from 'classnames'
import { type OverrideClassName } from '~components/types/OverrideClassName'
import styles from './LabelledMessage.module.scss'
import styles from './LabelledMessage.module.css'

export type LabelledMessageProps = {
label: string | React.ReactElement
Expand Down
Loading