diff --git a/.github/skills/token-system/references/architecture.md b/.github/skills/token-system/references/architecture.md index 7ccfcc1b2c..e6aaeb296e 100644 --- a/.github/skills/token-system/references/architecture.md +++ b/.github/skills/token-system/references/architecture.md @@ -34,6 +34,7 @@ Figma (design decisions) - Font-family stack strings - Embedded SVG icon data URIs - Sass maps +- Heading marker SVG and dimensions (`$ouds-heading-large-marker-img/-width/-height`, set to `null` for a brand without a marker) --- diff --git a/.github/skills/validate-tokens/SKILL.md b/.github/skills/validate-tokens/SKILL.md index ab2a9ed309..ed8720bf56 100644 --- a/.github/skills/validate-tokens/SKILL.md +++ b/.github/skills/validate-tokens/SKILL.md @@ -21,7 +21,7 @@ Read all 3 files and extract `$ouds-*` definitions: ## Step 2 — Identify component SCSS files -All `scss/_*.scss` + `scss/forms/_*.scss`, excluding: `_variables.scss`, `_config.scss`, `_functions.scss`, `_mixins.scss`, `_maps.scss`, `_root.scss`, `_reboot.scss`, `_utilities.scss`, `_helpers.scss`, `_grid.scss`, `_containers.scss`, `_images.scss`, `_type.scss`, `_transitions.scss`, `_forms.scss`, `_variables-dark.scss` +All `scss/_*.scss` + `scss/forms/_*.scss`, excluding: `_variables.scss`, `_config.scss`, `_functions.scss`, `_mixins.scss`, `_maps.scss`, `_root.scss`, `_reboot.scss`, `_utilities.scss`, `_helpers.scss`, `_grid.scss`, `_containers.scss`, `_images.scss`, `_transitions.scss`, `_forms.scss`, `_variables-dark.scss` --- diff --git a/packages/migrate/src/migrate.spec.mjs b/packages/migrate/src/migrate.spec.mjs index 74ce0d513a..2fd44d3507 100644 --- a/packages/migrate/src/migrate.spec.mjs +++ b/packages/migrate/src/migrate.spec.mjs @@ -77,7 +77,7 @@ describe('Migrate', () => { }) expect(getReplacementsWarnings()).toEqual([ - 'initialism class is deprecated in tests/source-boosted.html. See: https://web.unified-design-system.orange.com/docs/foundation/typography', + 'initialism class is deprecated in tests/source-boosted.html. See: https://web.unified-design-system.orange.com/docs/foundation/reboot', 'container class is deprecated in tests/source-boosted.html. See: https://web.unified-design-system.orange.com/docs/layout/containers', 'container-md class is deprecated in tests/source-boosted.html. See: https://web.unified-design-system.orange.com/docs/layout/containers', 'bg-supporting-purple class is deprecated in tests/source-boosted.html. See: https://web.unified-design-system.orange.com/docs/utilities/background', diff --git a/packages/migrate/src/replacements/common.mjs b/packages/migrate/src/replacements/common.mjs index fa20ee917d..a70928370b 100644 --- a/packages/migrate/src/replacements/common.mjs +++ b/packages/migrate/src/replacements/common.mjs @@ -20,7 +20,7 @@ export const commonReplacements = [ ['display-4', 'h1'], ['display-5', 'h2'], ['display-6', 'h3'], - [...warnForClass('initialism', { link: 'https://web.unified-design-system.orange.com/docs/foundation/typography' })], + [...warnForClass('initialism', { link: 'https://web.unified-design-system.orange.com/docs/foundation/reboot' })], // Layout [...warnForClass('container', { link: 'https://web.unified-design-system.orange.com/docs/layout/containers' })], diff --git a/packages/orange-compact/scss/ouds-web.scss b/packages/orange-compact/scss/ouds-web.scss index 52b776ab4e..9828082612 100644 --- a/packages/orange-compact/scss/ouds-web.scss +++ b/packages/orange-compact/scss/ouds-web.scss @@ -15,7 +15,7 @@ // Layout & components @import "@ouds/web-common/scss/root"; @import "@ouds/web-common/scss/reboot"; -@import "@ouds/web-common/scss/type"; +@import "@ouds/web-common/scss/typography"; @import "@ouds/web-common/scss/images"; @import "@ouds/web-common/scss/containers"; @import "@ouds/web-common/scss/grid"; diff --git a/packages/orange-compact/scss/tokens/_composite.scss b/packages/orange-compact/scss/tokens/_composite.scss index d1552b8d94..6c04c7a768 100644 --- a/packages/orange-compact/scss/tokens/_composite.scss +++ b/packages/orange-compact/scss/tokens/_composite.scss @@ -63,6 +63,12 @@ $ouds-font-family-monospace-stack: Menlo, monospace !default; // scss-docs-end ouds-composite-font-monospace +// scss-docs-start ouds-composite-typography +// NB: Set here the marker SVG exported from Figma, including paddings, with no `fill` attributes. Set it to null if there is not marker available for this theme. +$ouds-heading-large-marker-img: url("data:image/svg+xml,") !default; +$ouds-heading-large-marker-width: 30px !default; +$ouds-heading-large-marker-height: 12px !default; +// scss-docs-end ouds-composite-typography // stylelint-enable value-keyword-case, scss/dollar-variable-colon-space-after //// ****** ICONS as data URIs ****** diff --git a/packages/orange/scss/ouds-web.scss b/packages/orange/scss/ouds-web.scss index a04255da7e..6ebd60f25b 100644 --- a/packages/orange/scss/ouds-web.scss +++ b/packages/orange/scss/ouds-web.scss @@ -15,7 +15,7 @@ // Layout & components @import "@ouds/web-common/scss/root"; @import "@ouds/web-common/scss/reboot"; -@import "@ouds/web-common/scss/type"; +@import "@ouds/web-common/scss/typography"; @import "@ouds/web-common/scss/images"; @import "@ouds/web-common/scss/containers"; @import "@ouds/web-common/scss/grid"; diff --git a/packages/orange/scss/tokens/_composite.scss b/packages/orange/scss/tokens/_composite.scss index 23fedaee2a..71180641b7 100644 --- a/packages/orange/scss/tokens/_composite.scss +++ b/packages/orange/scss/tokens/_composite.scss @@ -63,6 +63,12 @@ $ouds-font-family-monospace-stack: Menlo, monospace !default; // scss-docs-end ouds-composite-font-monospace +// scss-docs-start ouds-composite-typography +// NB: Set here the marker SVG exported from Figma, including paddings, with no `fill` attributes. Set it to null if there is not marker available for this theme. +$ouds-heading-large-marker-img: url("data:image/svg+xml,") !default; +$ouds-heading-large-marker-width: 30px !default; +$ouds-heading-large-marker-height: 12px !default; +// scss-docs-end ouds-composite-typography // stylelint-enable value-keyword-case, scss/dollar-variable-colon-space-after //// ****** ICONS as data URIs ****** diff --git a/packages/sosh/scss/ouds-web.scss b/packages/sosh/scss/ouds-web.scss index 0a22761efd..f3fec81f59 100644 --- a/packages/sosh/scss/ouds-web.scss +++ b/packages/sosh/scss/ouds-web.scss @@ -15,7 +15,7 @@ // Layout & components @import "@ouds/web-common/scss/root"; @import "@ouds/web-common/scss/reboot"; -@import "@ouds/web-common/scss/type"; +@import "@ouds/web-common/scss/typography"; @import "@ouds/web-common/scss/images"; @import "@ouds/web-common/scss/containers"; @import "@ouds/web-common/scss/grid"; diff --git a/packages/sosh/scss/tokens/_composite.scss b/packages/sosh/scss/tokens/_composite.scss index 13af8565f1..1bca288afa 100644 --- a/packages/sosh/scss/tokens/_composite.scss +++ b/packages/sosh/scss/tokens/_composite.scss @@ -54,6 +54,12 @@ $ouds-font-family-monospace-stack: Menlo, monospace !default; // scss-docs-end ouds-composite-font-monospace +// scss-docs-start ouds-composite-typography +// NB: Set here the marker SVG exported from Figma, including paddings, with no `fill` attributes. Set it to null if there is not marker available for this theme. +$ouds-heading-large-marker-img: null !default; +$ouds-heading-large-marker-width: 0 !default; +$ouds-heading-large-marker-height: 0 !default; +// scss-docs-end ouds-composite-typography // stylelint-enable value-keyword-case, scss/dollar-variable-colon-space-after //// ****** ICONS as data URIs ****** diff --git a/scss/_reboot.scss b/scss/_reboot.scss index d2c98c0eed..57ee4ae3fb 100644 --- a/scss/_reboot.scss +++ b/scss/_reboot.scss @@ -260,8 +260,29 @@ dd { // Blockquote +.blockquote, // deprecated in OUDS Web v1.6 blockquote { margin: 0 0 $ouds-space-fixed-medium; // OUDS mod: instead of `0 0 1rem` + + > p { + @include get-font-size("body-large"); + } + + > :last-child { + margin-bottom: 0; + } +} + +.blockquote-footer, // deprecated in OUDS Web v1.6 +blockquote + figcaption { + margin-top: -$ouds-space-fixed-medium; + margin-bottom: $ouds-space-fixed-medium; + @include get-font-size("body-small"); + color: var(--#{$prefix}color-content-muted); + + &::before { + content: "\2014\00A0"; // em dash, nbsp + } } // OUDS mod: No italic @@ -397,7 +418,6 @@ pre { margin-bottom: $ouds-space-fixed-medium; // 2 // OUDS mod: instead of `1rem` overflow: auto; // 3 @include get-font-size("code-medium"); // OUDS mod: instead of `font-size: $code-font-size` - color: $pre-color; // Account for some code outputs that place code tags in pre tags code { @@ -411,7 +431,6 @@ var, // OUDS mod code { font-size: $code-font-size; font-style: normal; // OUDS mod: is italic in all browsers - color: var(--#{$prefix}color-content-muted); word-wrap: break-word; } diff --git a/scss/_type.scss b/scss/_typography.scss similarity index 63% rename from scss/_type.scss rename to scss/_typography.scss index f9eca36bf8..49ffdb5064 100644 --- a/scss/_type.scss +++ b/scss/_typography.scss @@ -25,6 +25,18 @@ @extend h6; } +@if ($ouds-typography-heading-large-marker and $ouds-heading-large-marker-img) { + .h2.marker::after, + h2.marker::after, // stylelint-disable-line selector-no-qualifying-type + .fs-hl.marker::after { // TODO not sure of this one because `.fs-hl` is not completely an equivalent of h2 (it is not bold) + display: block; + width: $ouds-heading-large-marker-width; + height: $ouds-heading-large-marker-height; + content: ""; + background-color: $ouds-typography-color-content-marker; + mask-image: #{escape-svg($ouds-heading-large-marker-img)}; + } +} .lead { @include get-font-size("body-large"); // OUDS mod: instead of `font-size: $lead-font-size` @@ -78,29 +90,3 @@ // Misc // -// Builds on `abbr` -// OUDS mod: no .initialism - -// Blockquotes -.blockquote { - margin-bottom: $blockquote-margin-y; - - > p { - @include get-font-size("body-large"); // OUDS mod: instead of `font-size: $blockquote-font-size` in `.blockquote` - } - - > :last-child { - margin-bottom: 0; - } -} - -.blockquote-footer { - margin-top: -$blockquote-margin-y; - margin-bottom: $blockquote-margin-y; - @include get-font-size("body-small"); // OUDS mod: instead of `font-size: $blockquote-footer-font-size` - color: $blockquote-footer-color; - - &::before { - content: "\2014\00A0"; // em dash, nbsp - } -} diff --git a/scss/_variables.scss b/scss/_variables.scss index 994cb23bcf..ebb5d65bc0 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -747,11 +747,6 @@ $text-muted: var(--#{$prefix}secondary-color) !default; // Depr // OUDS mod: no $initialism-font-size -$blockquote-margin-y: $ouds-space-fixed-medium !default; // OUDS mod: instead of `1rem` -// OUDS mod: no `$blockquote-font-size` -$blockquote-footer-color: var(--#{$prefix}color-content-muted) !default; // OUDS mod: instead of `$gray-600` -// OUDS mod: no `$blockquote-footer-font-size` - $hr-margin-y: $ouds-space-fixed-medium !default; // OUDS mod: instead of `$spacer !default;` $hr-color: $ouds-color-border-default !default; // OUDS mod: instead of `inherit !default;` @@ -1930,8 +1925,6 @@ $kbd-font-size: $code-font-size !default; $kbd-color: var(--#{$prefix}color-content-inverse) !default; // OUDS mod: instead of `var(--#{$prefix}body-bg)` $kbd-bg: var(--#{$prefix}color-surface-inverse-high) !default; // OUDS mod: instead of `var(--#{$prefix}body-color)` $nested-kbd-font-weight: null !default; // Deprecated in Bootstrap v5.2.0, removing in v6 - -$pre-color: var(--#{$prefix}color-content-muted) !default; // instead of `null` // End mod // diff --git a/scss/tests/snapshot-tests/__snapshots__/ouds-web-bootstrap.css b/scss/tests/snapshot-tests/__snapshots__/ouds-web-bootstrap.css index 3674a89b61..0cf31d28e7 100644 --- a/scss/tests/snapshot-tests/__snapshots__/ouds-web-bootstrap.css +++ b/scss/tests/snapshot-tests/__snapshots__/ouds-web-bootstrap.css @@ -1238,9 +1238,38 @@ dd { margin-left: 0; } +.blockquote, blockquote { margin: 0 0 16px; } +.blockquote > p, +blockquote > p { + max-width: var(--bs-font-max-width-body-large); + font-size: var(--bs-font-size-body-large); + line-height: var(--bs-font-line-height-body-large); + /* rtl:remove */ + letter-spacing: var(--bs-font-letter-spacing-body-large); +} +.blockquote > :last-child, +blockquote > :last-child { + margin-bottom: 0; +} + +.blockquote-footer, +blockquote + figcaption { + margin-top: -16px; + margin-bottom: 16px; + max-width: var(--bs-font-max-width-body-small); + font-size: var(--bs-font-size-body-small); + line-height: var(--bs-font-line-height-body-small); + /* rtl:remove */ + letter-spacing: var(--bs-font-letter-spacing-body-small); + color: var(--bs-color-content-muted); +} +.blockquote-footer::before, +blockquote + figcaption::before { + content: "— "; +} i, em, @@ -1341,7 +1370,6 @@ pre { line-height: var(--bs-font-line-height-code-medium); /* rtl:remove */ letter-spacing: var(--bs-font-letter-spacing-code-medium); - color: var(--bs-color-content-muted); } pre code { font-size: inherit; @@ -1353,7 +1381,6 @@ var, code { font-size: 0.875em; font-style: normal; - color: var(--bs-color-content-muted); word-wrap: break-word; } @@ -1600,6 +1627,18 @@ dialog, opacity: 0.5; } +.h2.marker::after, +h2.marker::after, +.fs-hl.marker::after { + display: block; + width: 30px; + height: 12px; + content: ""; + background-color: var(--bs-color-content-brand-primary); + -webkit-mask-image: url("data:image/svg+xml,%3csvg width='30' height='12' viewBox='0 0 30 12' xmlns='http://www.w3.org/2000/svg'%3e%3crect y='4' width='30' height='6'/%3e%3c/svg%3e"); + mask-image: url("data:image/svg+xml,%3csvg width='30' height='12' viewBox='0 0 30 12' xmlns='http://www.w3.org/2000/svg'%3e%3crect y='4' width='30' height='6'/%3e%3c/svg%3e"); +} + .lead { max-width: var(--bs-font-max-width-body-large); font-size: var(--bs-font-size-body-large); @@ -1711,34 +1750,6 @@ dialog, margin-right: 0.25rem; } -.blockquote { - margin-bottom: 16px; -} -.blockquote > p { - max-width: var(--bs-font-max-width-body-large); - font-size: var(--bs-font-size-body-large); - line-height: var(--bs-font-line-height-body-large); - /* rtl:remove */ - letter-spacing: var(--bs-font-letter-spacing-body-large); -} -.blockquote > :last-child { - margin-bottom: 0; -} - -.blockquote-footer { - margin-top: -16px; - margin-bottom: 16px; - max-width: var(--bs-font-max-width-body-small); - font-size: var(--bs-font-size-body-small); - line-height: var(--bs-font-line-height-body-small); - /* rtl:remove */ - letter-spacing: var(--bs-font-letter-spacing-body-small); - color: var(--bs-color-content-muted); -} -.blockquote-footer::before { - content: "— "; -} - .img-fluid { max-width: 100%; height: auto; diff --git a/scss/tests/snapshot-tests/__snapshots__/ouds-web.css b/scss/tests/snapshot-tests/__snapshots__/ouds-web.css index 97592d73bd..adc9ea7f47 100644 --- a/scss/tests/snapshot-tests/__snapshots__/ouds-web.css +++ b/scss/tests/snapshot-tests/__snapshots__/ouds-web.css @@ -1073,9 +1073,38 @@ dd { margin-left: 0; } +.blockquote, blockquote { margin: 0 0 16px; } +.blockquote > p, +blockquote > p { + max-width: var(--bs-font-max-width-body-large); + font-size: var(--bs-font-size-body-large); + line-height: var(--bs-font-line-height-body-large); + /* rtl:remove */ + letter-spacing: var(--bs-font-letter-spacing-body-large); +} +.blockquote > :last-child, +blockquote > :last-child { + margin-bottom: 0; +} + +.blockquote-footer, +blockquote + figcaption { + margin-top: -16px; + margin-bottom: 16px; + max-width: var(--bs-font-max-width-body-small); + font-size: var(--bs-font-size-body-small); + line-height: var(--bs-font-line-height-body-small); + /* rtl:remove */ + letter-spacing: var(--bs-font-letter-spacing-body-small); + color: var(--bs-color-content-muted); +} +.blockquote-footer::before, +blockquote + figcaption::before { + content: "— "; +} i, em, @@ -1176,7 +1205,6 @@ pre { line-height: var(--bs-font-line-height-code-medium); /* rtl:remove */ letter-spacing: var(--bs-font-letter-spacing-code-medium); - color: var(--bs-color-content-muted); } pre code { font-size: inherit; @@ -1188,7 +1216,6 @@ var, code { font-size: 0.875em; font-style: normal; - color: var(--bs-color-content-muted); word-wrap: break-word; } @@ -1435,6 +1462,18 @@ dialog, opacity: 0.5; } +.h2.marker::after, +h2.marker::after, +.fs-hl.marker::after { + display: block; + width: 30px; + height: 12px; + content: ""; + background-color: var(--bs-color-content-brand-primary); + -webkit-mask-image: url("data:image/svg+xml,%3csvg width='30' height='12' viewBox='0 0 30 12' xmlns='http://www.w3.org/2000/svg'%3e%3crect y='4' width='30' height='6'/%3e%3c/svg%3e"); + mask-image: url("data:image/svg+xml,%3csvg width='30' height='12' viewBox='0 0 30 12' xmlns='http://www.w3.org/2000/svg'%3e%3crect y='4' width='30' height='6'/%3e%3c/svg%3e"); +} + .lead { max-width: var(--bs-font-max-width-body-large); font-size: var(--bs-font-size-body-large); @@ -1492,34 +1531,6 @@ dialog, margin-right: 0.25rem; } -.blockquote { - margin-bottom: 16px; -} -.blockquote > p { - max-width: var(--bs-font-max-width-body-large); - font-size: var(--bs-font-size-body-large); - line-height: var(--bs-font-line-height-body-large); - /* rtl:remove */ - letter-spacing: var(--bs-font-letter-spacing-body-large); -} -.blockquote > :last-child { - margin-bottom: 0; -} - -.blockquote-footer { - margin-top: -16px; - margin-bottom: 16px; - max-width: var(--bs-font-max-width-body-small); - font-size: var(--bs-font-size-body-small); - line-height: var(--bs-font-line-height-body-small); - /* rtl:remove */ - letter-spacing: var(--bs-font-letter-spacing-body-small); - color: var(--bs-color-content-muted); -} -.blockquote-footer::before { - content: "— "; -} - .img-fluid { max-width: 100%; height: auto; diff --git a/site/data/_components-versions.yml b/site/data/_components-versions.yml index 79eac0dcbb..cfee770198 100644 --- a/site/data/_components-versions.yml +++ b/site/data/_components-versions.yml @@ -22,6 +22,8 @@ value: '1.2.0' - name: 'badge-icon' value: '1.3.0' +- name: 'body' + value: '1.0.0' - name: 'bottom_sheet' value: '0.0.0' - name: 'breadcrumb' @@ -36,6 +38,10 @@ value: '2.4.0' - name: 'circular-progress-indicator' value: '1.2.0' +- name: 'code' + value: '1.0.0' +- name: 'display' + value: '1.0.0' - name: 'divider' value: '1.0.0' - name: 'expand-button' @@ -50,12 +56,16 @@ value: '1.5.0' - name: 'fullscreen-dialog-web' value: '1.0.0' +- name: 'heading' + value: '1.1.0' - name: 'inline-alert' value: '1.0.0' - name: 'input-tag' value: '1.2.0' - name: 'interactive-icon' value: '1.1.0' +- name: 'label' + value: '1.0.0' - name: 'linear-progress-indicator' value: '1.1.0' - name: 'link' @@ -114,5 +124,4 @@ value: '1.0.0' - name: 'toolbar-top' value: '1.1.0' -- name: 'typography' - value: '1.1.0' + diff --git a/site/data/components-details.ts b/site/data/components-details.ts index 50d5a115d1..c3d401582a 100644 --- a/site/data/components-details.ts +++ b/site/data/components-details.ts @@ -49,6 +49,15 @@ export const componentsDetails: ComponentCardData[] = [ Beware

` }, + { + name: 'Body', + link: 'typography#body', + category: 'Content display', + snippet: ` +

+ Body +

` + }, { name: 'Breadcrumb', category: 'Navigation', @@ -93,6 +102,24 @@ export const componentsDetails: ComponentCardData[] = [ ` }, + { + name: 'Code', + link: 'typography#code', + category: 'Content display', + snippet: ` + + Code + ` + }, + { + name: 'Display', + link: 'typography#display', + category: 'Content display', + snippet: ` +

+ Display +

` + }, { name: 'Divider', category: 'Layout', @@ -209,6 +236,15 @@ export const componentsDetails: ComponentCardData[] = [ ` }, + { + name: 'Heading', + link: 'typography#heading', + category: 'Content display', + snippet: ` +

+ Heading +

` + }, { name: 'Inline alert', slug: 'inline-alert', @@ -227,6 +263,15 @@ export const componentsDetails: ComponentCardData[] = [ category: 'Indicator', snippet: `` }, + { + name: 'Label', + link: 'typography#label', + category: 'Content display', + snippet: ` +

+ Label +

` + }, { name: 'Link', link: 'links', diff --git a/site/data/sidebar-components.yml b/site/data/sidebar-components.yml index 481752de3a..95f8fd06af 100644 --- a/site/data/sidebar-components.yml +++ b/site/data/sidebar-components.yml @@ -28,6 +28,7 @@ - title: Tags - title: Text area - title: Text input + - title: Typography - title: Coming soon icon: component-atom diff --git a/site/data/sidebar-foundation.yml b/site/data/sidebar-foundation.yml index 29566259aa..94775aeae6 100644 --- a/site/data/sidebar-foundation.yml +++ b/site/data/sidebar-foundation.yml @@ -10,7 +10,6 @@ - title: Themes - title: CSS variables - title: Reboot - - title: Typography - title: Icons - title: Images coming_soon: true diff --git a/site/src/assets/examples/cheatsheet/index.astro b/site/src/assets/examples/cheatsheet/index.astro index df9fafbca2..cc2d541b72 100644 --- a/site/src/assets/examples/cheatsheet/index.astro +++ b/site/src/assets/examples/cheatsheet/index.astro @@ -77,7 +77,7 @@ export const body_class = 'bg-body-tertiary'

Typography

- Documentation + Documentation
diff --git a/site/src/content/docs/components/bullet-list.mdx b/site/src/content/docs/components/bullet-list.mdx index cc1b86a6d3..7435edf373 100644 --- a/site/src/content/docs/components/bullet-list.mdx +++ b/site/src/content/docs/components/bullet-list.mdx @@ -268,7 +268,7 @@ Bare lists have no markers, but retains indentation for alignment. ## Text style -By default bullet lists text is displayed as [body large]([[docsref:/foundation/typography#regular-texts]]) and in bold, you can use the following classes to change these defaults. +By default bullet lists text is displayed as [body large]([[docsref:/components/typography#body]]) and in bold, you can use the following classes to change these defaults. ### Body medium diff --git a/site/src/content/docs/components/typography.mdx b/site/src/content/docs/components/typography.mdx new file mode 100644 index 0000000000..0a55856d9c --- /dev/null +++ b/site/src/content/docs/components/typography.mdx @@ -0,0 +1,568 @@ +--- +title: Typography +description: Typography is a set of UI elements that structure and style text content, including headings, display text, body text, labels, and code, used to establish visual hierarchy and ensure consistent, accessible reading across OUDS Web. +aliases: + - "/docs/components/typography/" + - "/docs/foundation/typography/" + - "/docs/content/typography/" +toc: true +types: + - Heading + - Display + - Body + - Label + - Code +--- + +import { getTokenValue } from '@libs/sass-variables' + +export const headingLevel = [ + "heading-xlarge", + "heading-large", + "heading-medium", + "heading-small", + "body-large", + "body-medium" +] + +export const displayLevel = [ + "display-large", + "display-medium", + "display-small" +] + +export const textLevel = [ + "body-large", + "body-medium", + "body-small" +] + +export const labelLevel = [ + "label-xlarge", + "label-large", + "label-medium", + "label-small" +] + +export const screenSize = [ + "mobile", + "tablet", + "desktop" +] + + + You can find the OUDS design guidelines here: [heading guidelines](https://r.orange.fr/r/S-ouds-doc-heading), [display guidelines](https://r.orange.fr/r/S-ouds-doc-display), [body guidelines](https://r.orange.fr/r/S-ouds-doc-body), [label guidelines](https://r.orange.fr/r/S-ouds-doc-label), [code guidelines](https://r.orange.fr/r/S-ouds-doc-code). + + +## Overview + +### Component types + +
    +
  • +
    +
    +
    +

    Display

    +
    +
    +
    Display is a UI element that styles typography for impactful content like landing pages, marketing campaigns, and key messages.
    +
    +
  • +
  • +
    +
    +
    +

    Heading

    +
    +
    +
    Heading is a UI element that styles typography to structure content and define the hierarchy of information within an interface.
    +
    +
  • +
  • +
    +
    +
    +

    Body

    +
    +
    +
    Body is a UI element that styles typography for common text content like paragraphs, descriptions, and informational messages.
    +
    +
  • +
  • +
    +
    +
    +

    Label

    +
    +
    +
    Label is a UI element that styles typography for compact interface components such as buttons, form fields, badges, and other small elements.
    +
    +
  • +
  • +
    +
    +
    + Code +
    +
    +
    Code is a UI element that styles typography for technical content like code snippets, commands, system values, and identifiers.
    +
    +
  • +
+ +### Approach + +Typography elements are provided as components that include the `font-family`, `font-size`, `line-height`, `letter-spacing`, `max-width`, and for some of them, `font-weight`. However, certain elements can be modified using our utilities. Take a look at our [font weight utilities]([[docsref:/utilities/text#font-weight]]), [icon sizing utilities]([[docsref:/utilities/icons-sizing]]), [color utilities]([[docsref:/utilities/color]]), and the `.mw-none` class in [width utilities]([[docsref:/utilities/sizing]]). + +### Accessibility + +To ensure accessibility, make sure you choose the HTML tags you use, based on their **semantic meaning**; whether it is a heading, plain text, or a snippet of code, you should not use the same tag, regardless of how it appears on screen. Each tag conveys its own semantic meaning, which is communicated to screen readers. + +## [[comp]] Display + +Display is a UI element that styles typography for impactful content like landing pages, marketing campaigns, and key messages. + +The display features large type sizes that capture attention and create strong visual emphasis. Variants automatically adjust across breakpoints to maintain a consistent visual hierarchy on all screen sizes. Use it sparingly to preserve its impact and effectiveness. + +Display has three size levels: large, medium, and small. Each one sets `font-size`, and also `line-height`, `letter-spacing`, `font-weight: bold`, and `max-width`. Display uses the [OUDS Web font stack]([[docsref:/foundation/reboot#font-stack]]). + +Please note that: +- You have to use the appropriate HTML tag to convey the right semantic meaning. +- The `.display-*` classes are equivalent to the [font size text utilities]([[docsref:/utilities/text#font-size]]) `.fs-dl`, `.fs-dm`, and `.fs-ds`, except for the `font-weight`. +- If you want to get rid of the `max-width`, please use to use our `.mw-none` [width utility]([[docsref:/utilities/sizing]]). +- You should not use any icon with our `.display-*` font sizes, because we prefer to keep the place for the text. + +Here are the associated `font-size`s depending on the breakpoints: + +
+ + + + + + + + + + + { + displayLevel.map((level) => ( + + + { + screenSize.map((size) => ( + + )) + } + + )) + } + +
Display referenceFont size from `2xs` to `sm`Font size from `md` to `lg`Font size for `xl` and upper
+ {level === 'display-large' && (<>Display large ({'.display-large'}))} + {level === 'display-medium' && (<>Display medium ({'.display-medium'}))} + {level === 'display-small' && (<>Display small ({'.display-small'}))} + + {(getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2)) / 16}rem ({getTokenValue(`$ouds-font-size-${level}-${size}`)}) +
+
+ +
+ See more details about the display classes + +
+ + + + + + + + + + + { + displayLevel.map((level) => ( + + + { + screenSize.map((size) => ( + + )) + } + + )) + } + +
Display referenceFont size from `2xs` to `sm`Font size from `md` to `lg`Font size for `xl` and upper
+ {level === 'display-large' && (<>Display large ({'.display-large'}))} + {level === 'display-medium' && (<>Display medium ({'.display-medium'}))} + {level === 'display-small' && (<>Display small ({'.display-small'}))} + +
    +
  • font-size: {(getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2)) / 16}rem
  • +
  • line-height: {Math.round(((getTokenValue(`$ouds-font-line-height-${level}-${size}`).slice(0, -2)) / (getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2))) * 10000) / 10000}
  • +
  • letter-spacing: {(getTokenValue(`$ouds-font-letter-spacing-${level}-${size}`).slice(0, -2)) / 16}rem
  • +
  • max-width: {(getTokenValue(`$ouds-size-max-width-${level}-${size}`).slice(0, -2)) / 16}rem
  • +
+
+
+
+ +Display large + +

Display medium

+ +

Display small

`} /> + +## [[comp]] Heading + +Heading is a UI element that styles typography to structure content and define the hierarchy of information within an interface. + +The heading features multiple sizes options, to help users quickly understand the organization of a page or section. Variants automatically adjust across breakpoints to ensure optimal readability on all devices. Heading serve as the primary entry point for visual navigation. + +All HTML headings, `

` through `

`, are available. Each one sets `font-size`, and also `line-height`, `letter-spacing`, `font-weight: bold`, and `max-width`. `.h1` through `.h6` classes are also available, for when you want to match the font styling of a heading but cannot use the associated HTML element. Heading uses the [OUDS Web font stack]([[docsref:/foundation/reboot#font-stack]]). + +Please note that: +- You have to use the appropriate HTML tag to convey the right semantic meaning. A heading tag meaning is not reflected by the corresponding class on a `

` tag. +- The heading tags and classes are equivalent to the [font size text utilities]([[docsref:/utilities/text#font-size]]) `.fs-hxl`, `.fs-hl`, `.fs-hm`, `.fs-hs`, `.fs-bl`, and `.fs-bm`, except for the `font-weight`. +- If you want to get rid of the `max-width`, please use to use our `.mw-none` [width utility]([[docsref:/utilities/sizing]]). +- If you want to get rid of the `margin-bottom`, please use our `.mb-none` [spacing utility]([[docsref:/utilities/spacing#margin-and-padding]]). +- You can easily add an icon with your headings using our [heading icon size utilities]([[docsref:/utilities/icons-sizing#heading]]). + +Here are the associated `font-size`s depending on the breakpoints: + +

+ + + + + + + + + + + { + headingLevel.map((level) => ( + + + { + screenSize.map((size) => ( + + )) + } + + )) + } + +
Heading referenceFont size from `2xs` to `sm`Font size from `md` to `lg`Font size for `xl` and upper
+ {level === 'heading-xlarge' && (<>Heading xlarge ({'

'} or .h1))} + {level === 'heading-large' && (<>Heading large ({'

'} or .h2))} + {level === 'heading-medium' && (<>Heading medium ({'

'} or .h3))} + {level === 'heading-small' && (<>Heading small ({'

'} or .h4))} + {level === 'body-large' && (<>Heading 5 ({'
'} or .h5))} + {level === 'body-medium' && (<>Heading 6 ({'
'} or .h6))} +

+ {(getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2)) / 16}rem ({getTokenValue(`$ouds-font-size-${level}-${size}`)}) +
+
+ +
+ See more details about the heading classes + +
+ + + + + + + + + + + { + headingLevel.map((level) => ( + + + { + screenSize.map((size) => ( + + )) + } + + )) + } + +
Heading referenceFont size from `2xs` to `sm`Font size from `md` to `lg`Font size for `xl` and upper
+ {level === 'heading-xlarge' && (<>Heading xlarge ({'

'} or .h1))} + {level === 'heading-large' && (<>Heading large ({'

'} or .h2))} + {level === 'heading-medium' && (<>Heading medium ({'

'} or .h3))} + {level === 'heading-small' && (<>Heading small ({'

'} or .h4))} + {level === 'body-large' && (<>Heading 5 ({'
'} or .h5))} + {level === 'body-medium' && (<>Heading 6 ({'
'} or .h6))} +

+
    +
  • font-size: {(getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2)) / 16}rem
  • +
  • line-height: {Math.round(((getTokenValue( `$ouds-font-line-height-${level}-${size}`).slice(0, -2)) / (getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2))) * 10000) / 10000}
  • +
  • letter-spacing: {(getTokenValue(`$ouds-font-letter-spacing-${level}-${size}`).slice(0, -2)) / 16}rem
  • +
  • max-width: {(getTokenValue(`$ouds-size-max-width-${level}-${size}`).slice(0, -2)) / 16}rem
  • +
+
+
+
+ + + Heading 5 and heading 6 references do not exist in the brand guidelines; they are included here for consistency and continuity of HTML pages. + + +h1. OUDS Web heading
+ +

h2. OUDS Web heading

+ +

h3. OUDS Web heading

+ +

h4. OUDS Web heading

+ +
h5. OUDS Web heading
+ +
h6. OUDS Web heading
`} /> + +h2. OUDS Web heading looking like h1 + +

h3. OUDS Web heading looking like h2

+ +

h2. OUDS Web heading looking like h3

+ +

h2. OUDS Web heading looking like h4

+ +

h2. OUDS Web heading looking like h5

+ +

h2. OUDS Web heading looking like h6

`} /> + + +### Heading with marker + +A brand-colored marker can be displayed below the heading large (`

` or `.h2`), to enhance its visual emphasis and reinforce information hierarchy, by adding the `.marker` class. + +h2. OUDS Web heading with marker

+ +

h3. OUDS Web heading looking like h2 with marker

`} /> +
+ +## [[comp]] Body + +Body is a UI element that styles typography for common text content like paragraphs, descriptions, and informational messages. + +The body features multiple size options, to allow content importance to be expressed while maintaining consistency. Variants automatically adjust across breakpoints to ensure optimal readability on all devices. Body prioritize readability and provide a comfortable reading experience. + +Body text has three size levels: large (for emphasis), medium (default), and small (for supporting information). Each one sets `font-size`, `line-height`, `letter-spacing`, and `max-width`. Body has a `font-weight: normal` by default and it uses the [OUDS Web font stack]([[docsref:/foundation/reboot#font-stack]]). + +Please note that: +- You have to use the appropriate HTML tag to convey the right semantic meaning, generally a `

`. +- The `.lead`, `

` and `.small` or `` texts are equivalent to the [font size text utilities]([[docsref:/utilities/text#font-size]]) `.fs-bl`, `.fs-bm`, and `.fs-bs`. +- You can use other font weights as needed through our [font weight utilities]([[docsref:/utilities/text#font-weight]]). +- If you want to get rid of the `max-width`, please use to use our `.mw-none` [width utility]([[docsref:/utilities/sizing]]). +- If you want to get rid of the `margin-bottom` applied on `

` elements, please use our `.mb-none` [spacing utility]([[docsref:/utilities/spacing#margin-and-padding]]). +- You can easily add an icon with your body texts using our [body text icon size utilities]([[docsref:/utilities/icons-sizing#body]]). + + + By default, body medium is set on the `:root` element, and the `max-width` property is applied to `

` elements. + + +Here are the associated `font-size`s depending on the breakpoints: + +

+ + + + + + + + + + + { + textLevel.map((level) => ( + + + { + screenSize.map((size) => ( + + )) + } + + )) + } + +
Body referenceFont size from `2xs` to `sm`Font size from `md` to `lg`Font size for `xl` and upper
+ {level === 'body-large' && (<>Body large ({'.lead'} or .fs-bl))} + {level === 'body-medium' && (<>Body medium (default {'

'} or .fs-bm))} + {level === 'body-small' && (<>Body small ({'.small'}, {''} or .fs-bs))} +

+ {(getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2)) / 16}rem ({getTokenValue(`$ouds-font-size-${level}-${size}`)}) +
+
+ +
+ See more details about the body classes +
+ + + + + + + + + + + { + textLevel.map((level) => ( + + + { + screenSize.map((size) => ( + + )) + } + + )) + } + +
Body referenceFont size from `2xs` to `sm`Font size from `md` to `lg`Font size for `xl` and upper
+ {level === 'body-large' && (<>Body large ({'.lead'} or .fs-bl))} + {level === 'body-medium' && (<>Body medium (default {'

'} or .fs-bm))} + {level === 'body-small' && (<>Body small ({'.small'} or {''} or .fs-bs))} +

+
    +
  • font-size: {(getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2)) / 16}rem
  • +
  • line-height: {Math.round(((getTokenValue(`$ouds-font-line-height-${level}-${size}`).slice(0, -2)) / (getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2))) * 10000) / 10000}
  • +
  • letter-spacing: {(getTokenValue(`$ouds-font-letter-spacing-${level}-${size}`).slice(0, -2)) / 16}rem
  • +
  • max-width: {(getTokenValue(`$ouds-size-max-width-${level}-${size}`).slice(0, -2)) / 16}rem
  • +
+
+
+
+ + + This is a body large paragraph. It stands out from regular paragraphs. +

+ +

+ This is another body large paragraph. +

+ +

This is a regular body medium paragraph.

+ +

This is a body small paragraph.

+ +

This is another body small paragraph.

`} /> + +## [[comp]] Label + +Label is a UI element that styles typography for compact interface components such as buttons, form fields, badges, and other small elements. + +The label is non-responsive and maintains a fixed size across all breakpoints. This ensures visual consistency and predictable behavior within space-constrained UI elements. Labels are preferred when content is displayed within small components. + +Labels have four size levels: xlarge, large, medium, and small. Each one sets `font-size`, `line-height`, `letter-spacing`, and `max-width`. Label uses the [OUDS Web font stack]([[docsref:/foundation/reboot#font-stack]]). + +Please note that: +- You have to use the appropriate HTML tag to convey the right semantic meaning, generally a `

`. +- You can use other font weights as needed through our [font weight utilities]([[docsref:/utilities/text#font-weight]]). +- If you want to get rid of the `max-width`, please use to use our `.mw-none` [width utility]([[docsref:/utilities/sizing]]). + +Here are the associated `font-size`s: + +

+ + + + + + + + + { + labelLevel.map((level) => ( + + + + + + + )) + } + +
Label referenceFont size
+ {level === 'label-xlarge' && (<>Label xlarge ({'.fs-lxl'}))} + {level === 'label-large' && (<>Label large ({'.fs-ll'}))} + {level === 'label-medium' && (<>Label medium (default {'.fs-lm'}))} + {level === 'label-small' && (<>Label small ({'.fs-ls'}))} + + {(getTokenValue(`$ouds-font-size-${level}`).slice(0, -2)) / 16}rem ({getTokenValue(`$ouds-font-size-${level}`)}) +
+
+ +
+ See more details about the label classes +
+ + + + + + + + + + + { + labelLevel.map((level) => ( + + + { + screenSize.map((size) => ( + + )) + } + + )) + } + +
Label referenceFont size from `2xs` to `sm`Font size from `md` to `lg`Font size for `xl` and upper
+ {level === 'label-xlarge' && (<>Label xlarge ({'.fs-lxl'}))} + {level === 'label-large' && (<>Label large ({'.fs-ll'}))} + {level === 'label-medium' && (<>Label medium ({'.fs-lm'}))} + {level === 'label-small' && (<>Label small ({'.fs-ls'}))} + +
    +
  • font-size: {(getTokenValue(`$ouds-font-size-${level}`).slice(0, -2)) / 16}rem
  • +
  • line-height: {Math.round(((getTokenValue(`$ouds-font-line-height-${level}`).slice(0, -2)) / (getTokenValue(`$ouds-font-size-${level}`).slice(0, -2))) * 10000) / 10000}
  • +
  • letter-spacing: {(getTokenValue(`$ouds-font-letter-spacing-${level}`).slice(0, -2)) / 16}rem
  • +
  • max-width: {(getTokenValue(`$ouds-size-max-width-${level}-${size}`).slice(0, -2)) / 16}rem
  • +
+
+
+
+ +Label xlarge text

+ +

Label large text

+ +

Label medium text

+ +

Label small text

`} /> + +## [[comp]] Code + +Code element is a UI element that styles typography for technical content like code snippets, commands, system values, and identifiers. + +The code employs a monospace typeface to maintain character alignment and enhance the readability of structured content. Offered in one size, it ensures a uniform presentation of technical information across the product. Its application should be restricted to content that necessitates a precise code-like representation. + +Use the `` element to mark short code snippets within text. The `` element uses the [monospace code font stack]([[docsref:/foundation/reboot#font-stack]]) and is styled to stand out from surrounding text. + +<section> should be wrapped as inline.`} /> diff --git a/site/src/content/docs/dual-mode.mdx b/site/src/content/docs/dual-mode.mdx index b1e7220afa..3afc3d32d4 100644 --- a/site/src/content/docs/dual-mode.mdx +++ b/site/src/content/docs/dual-mode.mdx @@ -438,7 +438,7 @@ In this scenario, you will have access to OUDS Web on defined elements and child // Layout & components @import "@ouds/web-common/scss/root"; @import "@ouds/web-common/scss/reboot"; - @import "@ouds/web-common/scss/type"; + @import "@ouds/web-common/scss/typography"; @import "@ouds/web-common/scss/containers"; @import "@ouds/web-common/scss/grid"; @import "@ouds/web-common/scss/table"; // Draft and might change diff --git a/site/src/content/docs/foundation/reboot.mdx b/site/src/content/docs/foundation/reboot.mdx index 2f245c6c4a..82699212b9 100644 --- a/site/src/content/docs/foundation/reboot.mdx +++ b/site/src/content/docs/foundation/reboot.mdx @@ -1,6 +1,6 @@ --- title: Reboot -description: Reboot, a collection of element-specific CSS changes in a single file, kickstart OUDS Web to provide an elegant, consistent, and simple baseline to build upon. +description: Reboot sets consistent default styles for HTML elements and gives OUDS Web a simple starting point. aliases: - "/content/" - "/docs/content/" @@ -16,18 +16,21 @@ import { getTokenValue } from '@libs/sass-variables' ## Approach -Reboot builds upon Normalize, providing many HTML elements with somewhat opinionated styles using only element selectors. Additional styling is done only with classes. For example, we reboot some `` styles for a simpler baseline and later provide `.table`, `.table-bordered`, and more. +Reboot is a shared SCSS file imported after the root styles and before typography, layout, and component styles in each [theme]([[docsref:/foundation/themes]]) stylesheet. This order sets the basic styles first, later styles can then build on or override them. -Here are our guidelines and reasons for choosing what to override in Reboot: +Reboot builds on Normalize and sets default styles using element selectors. For example, reboot resets the default styling of lists, while the [Bullet list component]([[docsref:/components/bullet-list]]) offers more stylized lists using classes such as `.bullet-list` or `.bullet-list-default-color`. -- Update some browser default values to use `px`s instead of `em`s for fixed component spacing, to keep as much space as possible for meaningful content on zoom. -- Avoid `margin-top`. Vertical margins can collapse, yielding unexpected results. More importantly though, a single direction of `margin` is a simpler mental model. -- For easier scaling across device sizes, block elements should use `px`s for `margin`s. -- Keep declarations of `font`-related properties to a minimum, using `inherit` whenever possible. We use `max-width` on all font references for readability reasons. If you want to get rid of the `max-width`, please make sure to use our `.mw-none` [width utility]([[docsref:/utilities/sizing]]). +Reboot follows these guidelines: -## CSS variables +- Use `px` instead of `em` for fixed spacing, so zoom leaves more room for content. +- Avoid `margin-top`. Vertical margins can collapse; using only one margin direction keeps spacing predictable. +- Use `px` margins on block elements to make spacing consistent across screen sizes. +- Set as few font properties as possible and use `inherit` where possible. +- Text has a `max-width` for readability. Remove it with the `.mw-none` [width utility]([[docsref:/utilities/sizing]]) when needed. -OUDS Web standards require `@import`s across all our CSS bundles (including `ouds-web.css`, `ouds-web-reboot.css`, and `ouds-web-grid.css`) to include `_root.scss`. This adds `:root` level CSS variables to all bundles, regardless of how many of them are used in that bundle. Ultimately OUDS Web will continue to see more [CSS variables]([[docsref:/foundation/css-variables]]) added over time, in order to provide more real-time customization without the need to always recompile Sass. Our approach is to take our source Sass variables and transform them into CSS variables. That way, even if you don’t use CSS variables, you still have all the power of Sass. **This is still in-progress and will take time to fully implement.** +### CSS variables + +Every OUDS Web CSS bundle (like `ouds-web.css`, `ouds-web-reboot.css`, or `ouds-web-grid.css`) includes `_root.scss`, which defines root-level [CSS variables]([[docsref:/foundation/css-variables]]) (also called custom properties). These variables are generated from Sass variables. For example, consider these `:root` CSS variables for common `:root` styles: @@ -43,48 +46,36 @@ Which allows you to make real-time customizations however you like: `} /> -## Page defaults +### Page defaults -The `:root` and child elements are updated to provide better page-wide defaults. More specifically: +Reboot sets consistent defaults for the page: -- The `box-sizing` is globally set on every element—including `*::before` and `*::after`, to `border-box`. This ensures that the declared width of element is never exceeded due to padding or border. -- No base `font-size` is declared on the ``, but `16px` is assumed (the browser default). `font-size: 1rem` is applied on the `:root` children for easy responsive type-scaling via media queries while respecting user preferences and ensuring a more accessible approach. This browser default can be overridden by modifying the `$font-size-root` variable. -- The `:root` children also sets a global `font-family`, `font-weight`, `line-height`, and `color`. This is inherited later by some form elements to prevent font inconsistencies. -- For safety, the `:root` children has a declared `background-color`, defaulting to `#fff`. +- Every element, including `*::before` and `*::after`, uses `box-sizing: border-box`. Padding and borders are included in the declared width. +- Reboot does not set a font size on ``, so `1rem` follows the browser default (usually `16px`) and respects user preferences. Direct children of the root use `font-size: 1rem`. Set a new `$font-size-root` to override the browser default. +- Direct children of the root receive the base `font-family`, `font-weight`, `line-height`, `color`, and `background-color`. -## Font stack -OUDS Web uses custom fonts loaded from a CDN, to ensure optimum text rendering on every device and OS, and to benefit from the browser's cache. +### Font stack +OUDS Web loads custom brand fonts from a CDN, to ensure optimum text rendering on every device and OS, and to benefit from the browser's cache. -OUDS Web utilizes a “native font stack” or “system font stack” — as a fallback for custom font — for optimum text rendering on every device and OS. These system fonts have been designed specifically with today’s devices in mind, with improved rendering on screens, variable font support, and more. Read more about [native font stacks in this *Smashing Magazine* article](https://www.smashingmagazine.com/2015/11/using-system-ui-fonts-practical-guide/). +If a custom font is unavailable, OUDS Web uses a system font stack for clear text rendering across devices. This stack is applied globally and defined here: -This `font-family` is applied to the `` and automatically inherited globally throughout OUDS Web. To switch the global `font-family`, update `$font-family-base` and recompile OUDS Web. -The font faces are generated directly in the `_root.scss` file, based on the `$custom-font-cdn-urls` map variable. You can customize these URLs if needed (for example, to avoid loading resources from the Internet). -The following `font-family` is applied on every code basis element. To switch the global `font-family`, update `$font-family-code` and recompile OUDS Web. +Font-face rules are generated in `_root.scss` from the `$custom-font-cdn-urls` map. Update the URLs if you host the fonts elsewhere. + +Code elements use the monospace stack below: ## Headings -All heading elements—`

`—`

` have their `margin-top` removed, margin-bottom: {getTokenValue('$ouds-space-fixed-medium')} set, and `line-height` tightened. While headings inherit their `color` by default, you can also override it via optional CSS variable, `--bs-heading-color`. - - -| Heading | Example | -| --- | --- | -| `

` |

h1. OUDS Web heading

| -| `

` |

h2. OUDS Web heading

| -| `

` |

h3. OUDS Web heading

| -| `

` |

h4. OUDS Web heading

| -| `
` |

h5. OUDS Web heading

| -| `
` |

h6. OUDS Web heading

| -
+All heading elements—`

`—`

` have their `margin-top` removed, margin-bottom: {getTokenValue('$ouds-space-fixed-medium')} set, and `line-height` tightened. While headings inherit their `color` by default, you can also override it via optional CSS variable, `--bs-heading-color`. `

`—`

` elements are associated to [heading typography]([[docsref:/components/typography#heading]]). If you want to get rid of the `margin-bottom`, please use to use our `.mw-none` [width utility]([[docsref:/utilities/sizing]]). ## Paragraphs -All `

` elements have their `margin-top` removed and margin-bottom: {getTokenValue('$ouds-space-fixed-medium')} set for easy spacing. If you want to get rid of the `margin-bottom`, please make sure to use our `.mb-none` [spacing utilities]([[docsref:/utilities/spacing]]). +All `

` elements have their `margin-top` removed and margin-bottom: {getTokenValue('$ouds-space-fixed-medium')} set for easy spacing. `

` uses [body medium typography]([[docsref:/components/typography#body]]). If you want to get rid of the `margin-bottom`, please use to use our `.mw-none` [width utility]([[docsref:/utilities/sizing]]). This is an example paragraph which is long enough so it’s easy to see and compare the max-width in action and compare it to the one below.

This is an example paragraph which is long enough so it’s easy to see and compare the max-width in action and compare it to the one above.

@@ -168,13 +159,46 @@ For simpler styling, clear hierarchy, and better spacing, description lists have
Definition for this other term.
`} /> -## Inline code +## Inline text elements + +Styling for common inline HTML5 elements. + +You can use the mark tag to highlight text.

+

This line of text is meant to be treated as deleted text.

+

This line of text is meant to be treated as no longer accurate.

+

This line of text is meant to be treated as an addition to the document.

+

This line of text will render as underlined.

+

This line of text is meant to be treated as fine print.

+

This line rendered as bold text.

+

This line rendered as bold text too, but would natively be italicized.

`} /> + +Beware that those tags should be used for semantic purpose: + +- `` represents text which is marked or highlighted for reference or notation purposes. +- `` represents side-comments and small print, like copyright and legal text. It uses [body small typography]([[docsref:/components/typography#body]]). +- `` represents element that are no longer relevant or no longer accurate. +- `` represents a span of inline text which should be rendered in a way that indicates that it has a non-textual annotation. + +If you want to style your text, you should use the following classes instead: + +- `.mark` will apply the same styles as ``. +- `.small` will apply the same styles as ``. +- `.text-decoration-underline` will apply the same styles as ``. +- `.text-decoration-line-through` will apply the same styles as ``. + +While not shown above, feel free to use `` and `` in HTML5. `` is meant to highlight words or phrases without conveying additional importance, while `` is mostly for voice, technical terms, etc. + +## Code + +`` element uses [code typography]([[docsref:/components/typography#code]]). + +### Inline code Wrap inline snippets of code with ``. Be sure to escape HTML angle brackets. <section> should be wrapped as inline.`} /> -## Code blocks +### Code blocks Use `
`s for multiple lines of code. Once again, be sure to escape any angle brackets in the code for proper rendering. The `
` element is reset to remove its `margin-top` and use `px` units for its `margin-bottom`.
 
@@ -182,20 +206,20 @@ Use `
`s for multiple lines of code. Once again, be sure to escape any angle
   <p>And another line of sample text here...</p>
   
`} /> -## Variables +### Variables For indicating variables use the `` tag. y = mx + b`} /> -## User input +### User input Use the `` to indicate input that is typically entered via keyboard. cd followed by the name of the directory.
To edit settings, press Ctrl + ,`} /> -## Sample output +### Sample output For indicating sample output from a program use the `` tag. @@ -382,9 +406,7 @@ Reboot includes an enhancement for `role="button"` to change the default cursor Non-button element button`} /> -## Misc elements - -### Address +## Address The `
` element is updated to reset the browser default `font-style` from `italic` to `normal`. `line-height` is also now inherited, and margin-bottom: {getTokenValue('$ouds-space-fixed-medium')} has been added. `
`s are for presenting contact information for the nearest ancestor (or an entire body of work). Preserve formatting by ending lines with `
`. @@ -400,12 +422,20 @@ The `
` element is updated to reset the browser default `font-style` fro first.last@example.com
`} /> -### Blockquote +## Blockquote + +For quoting blocks of content from another source within your document, wrap `
` around any HTML as the quote. The default `margin` on blockquotes is `1em 40px`, so we reset that to 0 0 {getTokenValue('$ouds-space-fixed-medium')} for something more consistent with other elements. `
` uses [body large text]([[docsref:/components/typography#body]]). -The default `margin` on blockquotes is `1em 40px`, so we reset that to 0 0 {getTokenValue('$ouds-space-fixed-medium')} for something more consistent with other elements. + +

A well-known quote, contained in a blockquote element.

+
`} /> - -
+### Naming a source + +The HTML spec requires that blockquote attribution be placed outside the `
`. When providing attribution, wrap your `
` in a `
` and use a `
`. Be sure to wrap the name of the source work in `` as well. `
` after `
` uses [body small typography]([[docsref:/components/typography#body]]). + + +

A well-known quote, contained in a blockquote element.

@@ -413,13 +443,36 @@ The default `margin` on blockquotes is `1em 40px`, so we reset that to 0 0
`} /> -### Inline elements +### Alignment +{/* TODO See if we keep it: its just some tips to use our utilities, I don't think this is very useful here */} + +Use text and spacing utilities as needed to change the alignment of your blockquote. + + +
+

A well-known quote, contained in a blockquote element.

+
+
+ Someone famous in Source Title +
+ `} /> + + +
+

A well-known quote, contained in a blockquote element.

+
+
+ Someone famous in Source Title +
+ `} /> + +## Abbreviations -The `` element receives basic styling to make it stand out amongst paragraph text. +Stylized implementation of HTML’s `` element for abbreviations and acronyms to show the expanded version on hover. Abbreviations have a default underline and gain a help cursor to provide additional context on hover and to users of assistive technologies. HTML abbreviation element.`} /> -### Summary +## Summary The default `cursor` on summary is `text`, so we reset that to `pointer` to convey that the element can be interacted with by clicking on it. diff --git a/site/src/content/docs/foundation/tokens.mdx b/site/src/content/docs/foundation/tokens.mdx index 8a2dd01767..266e8d22c9 100644 --- a/site/src/content/docs/foundation/tokens.mdx +++ b/site/src/content/docs/foundation/tokens.mdx @@ -56,7 +56,7 @@ We build our Sass variables following the architecture of the design tokens: - Ex: `ouds/color/content/on/brand-primary` becomes `$ouds-color-content-on-brand-primary`, `ouds/elevation/blur/emphasized` becomes `$ouds-elevation-blur-emphasized`. - [Composite tokens](#composite-tokens): `$ouds-elevation-{token-name}` - Ex: `ouds/elevation/**/emphasized` are aggregated via `$ouds-elevation-emphasized`. - - Our font tokens are aggregated in a mixin [`get-font-size()`]([[docsref:/foundation/typography/#text-style-for-custom-components]]) that takes the font reference name as a parameter. So `ouds/font/**/body-large` are aggregated via `get-font-size("body-large")`. + - Our font tokens are aggregated in a mixin `get-font-size()` that takes the font reference name as a parameter. So `ouds/font/**/body-large` are aggregated via `get-font-size("body-large")`. - [Component tokens](#component-tokens): `$ouds-{component-name}-{token-name}` - Ex: `ouds/button/color/bg/minimal/hover` becomes `$ouds-button-color-bg-minimal-hover`. @@ -70,6 +70,6 @@ We build our CSS variables following the architecture of the design tokens: - Our scaled spacing are only declared as CSS variables `--bs-space-scaled-{size}`. It’s equivalent to `ouds/space/scaled/{size}` in Figma. Prefer using our [utilities]([[docsref:/utilities#using-our-utilities]]) when possible. - Our colors and elevation colors are declared as CSS variables `--bs-color-{token-name}`. It’s equivalent to `ouds/color/{token-name}` in Figma. Prefer using our [utilities]([[docsref:/utilities#using-our-utilities]]) when possible. - Our icon sizes are declared as CSS variables `--bs-icon-{size}`. It’s equivalent to `ouds/size/icon/{size}` in Figma. Prefer using our [utilities]([[docsref:/utilities#using-our-utilities]]) when possible. - - Our font tokens are aggregated in a mixin [`get-font-size()`]([[docsref:/foundation/typography/#text-style-for-custom-components]]) that takes the font reference name as a parameter. So `ouds/font/**/body-large` are aggregated via `get-font-size("body-large")`. Don’t use our CSS variables for font alone. + - Our font tokens are aggregated in a mixin `get-font-size()` that takes the font reference name as a parameter. So `ouds/font/**/body-large` are aggregated via `get-font-size("body-large")`. Don’t use our CSS variables for font alone. - [Composite tokens](#composite-tokens): We don’t have any composite token transformed into a CSS variable, but they are available as [Sass variables](#sass-variables). - [Component tokens](#component-tokens): We don’t have any component token transformed into a CSS variable. The only CSS variables that we have for components are the ones that we need to build the component internally. diff --git a/site/src/content/docs/foundation/typography.mdx b/site/src/content/docs/foundation/typography.mdx deleted file mode 100644 index b9af3d0db4..0000000000 --- a/site/src/content/docs/foundation/typography.mdx +++ /dev/null @@ -1,507 +0,0 @@ ---- -title: Typography -description: Documentation and examples for OUDS Web typography, including global settings, headings, body text, lists, and more. -aliases: - - "/docs/content/typography/" - - "/docs/foundation/typography/" -toc: true ---- - -import { getTokenValue } from '@libs/sass-variables' - -export const headingLevel = [ - "heading-xlarge", - "heading-large", - "heading-medium", - "heading-small", - "body-large", - "body-medium" -] - -export const displayLevel = [ - "display-large", - "display-medium", - "display-small" -] - -export const textLevel = [ - "body-large", - "body-medium", - "body-small" -] - -export const labelLevel = [ - "label-xlarge", - "label-large", - "label-medium", - "label-small" -] - -export const screenSize = [ - "mobile", - "tablet", - "desktop" -] - -## Global settings - -OUDS Web sets basic global display, typography, and link styles. When more control is needed, check out the [textual utility classes]([[docsref:/utilities/text]]). - -- Use a [font stack]([[docsref:/foundation/reboot#font-stack]]) of a custom font with native fonts fallback that selects the best `font-family` for each OS and device. -- For a more inclusive and accessible type scale, we use the browser’s default root `font-size` (typically 16px) so visitors can customize their browser defaults as needed. -- Use the `$font-family-base`, `$font-size-base`, and `$line-height-base` attributes as our typographic base applied to the `:root` children. -- Use `max-width` on all font references for readability reasons. If you want to get rid of the `max-width`, please make sure to use our `.mw-none` [width utility]([[docsref:/utilities/sizing]]). -- Use `--bs-color-bg-primary` to set a `background-color` on the `:root` children (`#fff` by default). - -These styles can be found within `_reboot.scss`, and the global variables are defined in `_variables.scss`. Make sure to set `$font-size-base` in `rem`. - - - If you need need to include a font reference inside a custom component, please refer to our [font mixin section](#sass-mixins). - - -## Headings - -All HTML headings, `

` through `

`, are available. Each class sets `font-size` but also `line-height`, `letter-spacing`, `font-weight: bold`, and `max-width`. Here are the associated `font-size`s depending on the breakpoints. If you want to get rid of the `max-width`, please make sure to use our `.mw-none` [width utility]([[docsref:/utilities/sizing]]). - -
-
- - - - - - - - - -{ - headingLevel.map((level) => ( - - - { - screenSize.map((size) => ( - - )) - } - - )) -} - -
Heading referenceValues from `2xs` to `sm`Values from `md` to `lg`Values for `xl` and upper
- {level === 'heading-xlarge' && (<>Heading xlarge ({'

'}
))} - {level === 'heading-large' && (<>Heading large ({'

'}
))} - {level === 'heading-medium' && (<>Heading medium ({'

'}
))} - {level === 'heading-small' && (<>Heading small ({'

'}
))} - {level === 'body-large' && (<>Body large ({'
'}
))} - {level === 'body-medium' && (<>Body medium ({'
'}
))} -
- {(getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2)) / 16}rem ({getTokenValue(`$ouds-font-size-${level}-${size}`)}) -
-
- - -
- See more details about the heading classes - -
- - - - - - - - - - - { - headingLevel.map((level) => ( - - - { - screenSize.map((size) => ( - - )) - } - - )) - } - -
Heading referenceValues from `2xs` to `sm`Values from `md` to `lg`Values for `xl` and upper
- {level === 'heading-xlarge' && (<>Heading xlarge ({'

'}
))} - {level === 'heading-large' && (<>Heading large ({'

'}
))} - {level === 'heading-medium' && (<>Heading medium ({'

'}
))} - {level === 'heading-small' && (<>Heading small ({'

'}
))} - {level === 'body-large' && (<>Body large ({'
'}
))} - {level === 'body-medium' && (<>Body medium ({'
'}
))} -
-
    -
  • font-size: {(getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2)) / 16}rem
  • -
  • line-height: {Math.round(((getTokenValue( `$ouds-font-line-height-${level}-${size}`).slice(0, -2)) / (getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2))) * 10000) / 10000}
  • -
  • letter-spacing: {(getTokenValue(`$ouds-font-letter-spacing-${level}-${size}`).slice(0, -2)) / 16}rem
  • -
  • max-width: {(getTokenValue(`$ouds-size-max-width-${level}-${size}`).slice(0, -2)) / 16}rem
  • -
-
-
-
- -h1. OUDS Web heading -

h2. OUDS Web heading

-

h3. OUDS Web heading

-

h4. OUDS Web heading

-
h5. OUDS Web heading
-
h6. OUDS Web heading
`} /> - -`.h1` through `.h6` classes are also available, for when you want to match the font styling of a heading but cannot use the associated HTML element. - -h1. OUDS Web heading

-

h2. OUDS Web heading

-

h3. OUDS Web heading

-

h4. OUDS Web heading

-

h5. OUDS Web heading

-

h6. OUDS Web heading

`} /> - -You can easily add an icon with your font reference using [our icon size utilities]([[docsref:/utilities/icons-sizing]]). - -## Display headings - -Traditional heading elements are designed to work best in the meat of your page content. When you need a heading to stand out, consider using a **display heading**—a larger, slightly more opinionated heading style. - -We provide `.display-*` from `large` through `small`. Each class sets `font-size` but also `line-height`, `letter-spacing`, `font-weight: bold`, and `max-width`. If you want to get rid of the `max-width`, please make sure to use our `.mw-none` [width utility]([[docsref:/utilities/sizing]]). Here are the associated `font-size`s depending on the breakpoints. - - -
- - - - - - - - - - - { - displayLevel.map((level) => ( - - - { - screenSize.map((size) => ( - - )) - } - - )) - } - -
Display referenceValues from `2xs` to `sm`Values from `md` to `lg`Values for `xl` and upper
- {level === 'display-large' && (<>Display large ({'.display-large'}))} - {level === 'display-medium' && (<>Display medium ({'.display-medium'}))} - {level === 'display-small' && (<>Display small ({'.display-small'}))} - - {(getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2)) / 16}rem ({getTokenValue(`$ouds-font-size-${level}-${size}`)}) -
-
- - -
- See more details about the display classes - -
- - - - - - - - - - - { - displayLevel.map((level) => ( - - - { - screenSize.map((size) => ( - - )) - } - - )) - } - -
Display referenceValues from `2xs` to `sm`Values from `md` to `lg`Values for `xl` and upper
- {level === 'display-large' && (<>Display large ({'.display-large'}))} - {level === 'display-medium' && (<>Display medium ({'.display-medium'}))} - {level === 'display-small' && (<>Display small ({'.display-small'}))} - -
    -
  • font-size: {(getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2)) / 16}rem
  • -
  • line-height: {Math.round(((getTokenValue(`$ouds-font-line-height-${level}-${size}`).slice(0, -2)) / (getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2))) * 10000) / 10000}
  • -
  • letter-spacing: {(getTokenValue(`$ouds-font-letter-spacing-${level}-${size}`).slice(0, -2)) / 16}rem
  • -
  • max-width: {(getTokenValue(`$ouds-size-max-width-${level}-${size}`).slice(0, -2)) / 16}rem
  • -
-
-
-
- -Display large -

Display medium

-

Display small

`} /> - -Display headings are configured via the `$display-font-sizes` Sass map and the variable `$display-font-weight`. - -Display headings are customizable via three variables, `$display-font-family`, `$display-font-style` and `$display-line-height`. - - - -Traditional heading elements are designed to work best in the meat of your page content. When you need a heading to stand out, consider using a **display heading**—a larger, slightly more opinionated heading style. - -Display 1 -

Display 2

-

Display 3

-

Display 4

-

Display 5

-

Display 6

`} /> - -Display headings are configured via the `$display-font-sizes` Sass map and two variables, `$display-font-weight` and `$display-line-height`. - -Display headings are customizable via two variables, `$display-font-family` and `$display-font-style`. - -
- - - -## Regular texts - -Since only [headings](#headings), [display headings](#display-headings) and `strong` text are meant to use **Bold** in main content, other contents should use `normal` font-weight. Each class sets `font-size` but also `line-height`, `letter-spacing`, and `max-width`. If you want to get rid of the `max-width`, please make sure to use our `.mw-none` [width utility]([[docsref:/utilities/sizing]]). Here are the associated `font-size`s depending on the breakpoints. See our [Font utilities]([[docsref:/utilities/text#font-size]]). - - - Body medium is set by default on `:root` children but we don’t set the `max-width` property for usability reasons. - - - -
- - - - - - - - - - - { - [ ...textLevel, ...labelLevel].map((level) => ( - - - { - screenSize.map((size) => ( - - )) - } - - )) - } - -
Regular text referenceValues from `2xs` to `sm`Values from `md` to `lg`Values for `xl` and upper
- {level === 'body-large' && (<>Body large ({'.lead'}))} - {level === 'body-medium' && (<>Body medium (default {'

'}))} - {level === 'body-small' && (<>Body small ({'.small'} or {''}))} - {level === 'label-xlarge' && (<>Label xlarge ({'.fs-lxl'}))} - {level === 'label-large' && (<>Label large ({'.fs-ll'}))} - {level === 'label-medium' && (<>Label medium ({'.fs-lm'}))} - {level === 'label-small' && (<>Label small ({'.fs-ls'}))} -

- {!level.includes('label-') - && (<>{(getTokenValue(`$ouds-font-size-${level}-${size}`).slice(0, -2)) / 16}rem ({getTokenValue(`$ouds-font-size-${level}-${size}`)}))} - {level.includes('label-') - && (<>{(getTokenValue(`$ouds-font-size-${level}`).slice(0, -2)) / 16}rem ({getTokenValue(`$ouds-font-size-${level}`)}))} -
-
- -
- See more details about the regular text classes -
- - - - - - - - - - - { - [ ...textLevel, ...labelLevel].map((level) => ( - - - { - screenSize.map((size) => ( - - )) - } - - )) - } - -
Regular text referenceValues from `2xs` to `sm`Values from `md` to `lg`Values for `xl` and upper
- {level === 'body-large' && (<>Body large ({'.lead'}))} - {level === 'body-medium' && (<>Body medium (default {'

'}))} - {level === 'body-small' && (<>Body small ({'.small'} or {''}))} - {level === 'label-xlarge' && (<>Label xlarge ({'.fs-lxl'}))} - {level === 'label-large' && (<>Label large ({'.fs-ll'}))} - {level === 'label-medium' && (<>Label medium ({'.fs-lm'}))} - {level === 'label-small' && (<>Label small ({'.fs-ls'}))} -

-
    -
  • font-size: {(getTokenValue(`$ouds-font-size-${level}${!level.includes('label-') ? '-' + size : ''}`).slice(0, -2)) / 16}rem
  • -
  • line-height: {Math.round(((getTokenValue(`$ouds-font-line-height-${level}${!level.includes('label-') ? '-' + size : ''}`).slice(0, -2)) / (getTokenValue(`$ouds-font-size-${level}${!level.includes('label-') ? '-' + size : ''}`).slice(0, -2))) * 10000) / 10000}
  • -
  • letter-spacing: {(getTokenValue(`$ouds-font-letter-spacing-${level}${!level.includes('label-') ? '-' + size : ''}`).slice(0, -2)) / 16}rem
  • -
  • max-width: {(getTokenValue(`$ouds-size-max-width-${level}-${size}`).slice(0, -2)) / 16}rem
  • -
-
-
-
- -You can easily add an icon with your font reference using [our icon size utilities]([[docsref:/utilities/icons-sizing]]). - -### Lead - -Make a paragraph stand out by adding `.lead`. It uses [Regular text](#regular-texts) body large. - - - This is a lead paragraph. It stands out from regular paragraphs. -

`} /> - -### Small - -Render a paragraph with a small `font-size` by adding `.small` or use ``. It uses [Regular text](#regular-texts) body small. - - - This is a small paragraph. -

-

- This is a small paragraph. -

`} /> - -## Inline text elements - -Styling for common inline HTML5 elements. - -You can use the mark tag to highlight text.

-

This line of text is meant to be treated as deleted text.

-

This line of text is meant to be treated as no longer accurate.

-

This line of text is meant to be treated as an addition to the document.

-

This line of text will render as underlined.

-

This line of text is meant to be treated as fine print.

-

This line rendered as bold text.

-

This line rendered as bold text too, but would natively be italicized.

`} /> - -Beware that those tags should be used for semantic purpose: - -- `` represents text which is marked or highlighted for reference or notation purposes. -- `` represents side-comments and small print, like copyright and legal text. It uses [Regular text](#regular-texts) body small. -- `` represents element that are no longer relevant or no longer accurate. -- `` represents a span of inline text which should be rendered in a way that indicates that it has a non-textual annotation. - -If you want to style your text, you should use the following classes instead: - -- `.mark` will apply the same styles as ``. -- `.small` will apply the same styles as ``. -- `.text-decoration-underline` will apply the same styles as ``. -- `.text-decoration-line-through` will apply the same styles as ``. - -While not shown above, feel free to use `` and `` in HTML5. `` is meant to highlight words or phrases without conveying additional importance, while `` is mostly for voice, technical terms, etc. - -## Text utilities - -Change text alignment, transform, style, weight, line-height, decoration and color with our [text utilities]([[docsref:/utilities/text]]) and [color utilities]([[docsref:/utilities/color]]). - -## Abbreviations - -Stylized implementation of HTML’s `` element for abbreviations and acronyms to show the expanded version on hover. Abbreviations have a default underline and gain a help cursor to provide additional context on hover and to users of assistive technologies. - -attr

`} /> - -## Blockquotes - -For quoting blocks of content from another source within your document. Wrap `
` around any HTML as the quote. It uses [Regular text](#regular-texts) body large. - - -

A well-known quote, contained in a blockquote element.

-
`} /> - -### Naming a source - -The HTML spec requires that blockquote attribution be placed outside the `
`. When providing attribution, wrap your `
` in a `
` and use a `
` or a block level element (e.g., `

`) with the `.blockquote-footer` class. Be sure to wrap the name of the source work in `` as well. It uses [Regular text](#regular-texts) body small. - - -

-

A well-known quote, contained in a blockquote element.

-
- -
`} /> - -### Alignment - -Use text utilities as needed to change the alignment of your blockquote. - - -
-

A well-known quote, contained in a blockquote element.

-
- - `} /> - - -
-

A well-known quote, contained in a blockquote element.

-
- - `} /> - -## Lists - - - Please refer to the [Bullet list component]([[docsref:/components/bullet-list#utilities]]) for `.list-unstyled` and `.list-inline` documentation. - - -### Description list alignment - -Align terms and descriptions horizontally by using our grid system’s predefined classes (or semantic mixins). For longer terms, you can optionally add a `.text-truncate` class to truncate the text with an ellipsis. - - -
Description lists
-
A description list is perfect for defining terms.
- -
Term
-
-

Definition for the term.

-

And some more placeholder definition text.

-
- -
Another term
-
This definition is short, so no extra paragraphs or anything.
- -
Truncated term is truncated
-
This can be useful when space is tight. Adds an ellipsis at the end.
- -
Nesting
-
-
-
Nested definition list
-
I heard you like definition lists. Let me put a definition list inside your definition list.
-
-
- `} /> diff --git a/site/src/content/docs/getting-started/migration-from-boosted.mdx b/site/src/content/docs/getting-started/migration-from-boosted.mdx index 9e284d0086..8b363ca2b3 100644 --- a/site/src/content/docs/getting-started/migration-from-boosted.mdx +++ b/site/src/content/docs/getting-started/migration-from-boosted.mdx @@ -66,7 +66,7 @@ Read more about the [font stack]([[docsref:/foundation/reboot#font-stack]]) for ### Typography -- New Body fonts’ sizes are now responsive and can change depending on the screen size. See [Typography]([[docsref:/foundation/typography]]) for more details. +- New Body fonts’ sizes are now responsive and can change depending on the screen size. See [Typography]([[docsref:/components/typography]]) for more details. - New A `max-width` has been added on all font references for readability reasons. If you want to get rid of the `max-width`, please use our `.mw-none` width utility. @@ -76,6 +76,8 @@ Read more about the [font stack]([[docsref:/foundation/reboot#font-stack]]) for - Breaking Abbreviation class `.initialism` has been removed. +- Warning `.blockquote` and `.blockquote-footer` class have been deprecated, you can use `
` and `
` instead. Read more in our [reboot page, blockquote section]([[docsref:/foundation/reboot#blockquote]]). + - Warning Default spacing values now use `px`s instead of `em`s for fixed component spacing, to keep as much space as possible for meaningful content on zoom. ## Layout @@ -902,6 +904,8 @@ See [our new Text Area page]([[docsref:/components/text-area]]) for more informa - Warning `scss/mixins/_alert.scss` doesn’t exist anymore. If you were importing it in your project, please make sure to remove it. +- Breaking `scss/_type.scss` has been renamed to `scss/_typography.scss`. If you were importing it in your project, please make sure to update it accordingly. + - Warning `scss/vendor/_rfs.scss` has been removed. It was deprecated and should not have been used. - Breaking `font-size()` mixin has been removed. Please refer to `get-font-size()` mixin instead. @@ -2345,9 +2349,11 @@ See [our new Text Area page]([[docsref:/components/text-area]]) for more informa Warning Dropped Sass variables:
  • $blockquote-font-size
  • +
  • $blockquote-footer-color
  • $blockquote-footer-font-size
  • $blockquote-line-height
  • $blockquote-letter-spacing
  • +
  • $blockquote-margin-y
  • $boosted-prefix
  • $boosted-variable-prefix
  • $border-color-subtle
  • @@ -2707,7 +2713,7 @@ See [our new Text Area page]([[docsref:/components/text-area]]) for more informa ## Sass -- New The mixin `get-font-size({font-size-ref})` has been added, where `font-size-ref` is one of: `"code-medium"`, `"label-small"`, `"label-medium"`, `"label-large"`, `"label-xlarge"`, `"body-small"`, `"body-medium"`, `"body-large"`, `"heading-small"`, `"heading-medium"`, `"heading-large"`, `"heading-xlarge"`, `"display-small"`, `"display-medium"`, `"display-large"`. If you have/need any `font-size` in one of your SCSS classes, please consider using this mixin instead. See [Typography Sass mixins]([[docsref:/foundation/typography#sass-mixins]]) for more details. +- New The mixin `get-font-size({font-size-ref})` has been added, where `font-size-ref` is one of: `"code-medium"`, `"label-small"`, `"label-medium"`, `"label-large"`, `"label-xlarge"`, `"body-small"`, `"body-medium"`, `"body-large"`, `"heading-small"`, `"heading-medium"`, `"heading-large"`, `"heading-xlarge"`, `"display-small"`, `"display-medium"`, `"display-large"`. If you have/need any `font-size` in one of your SCSS classes, please consider using this mixin instead. See [Typography Sass mixins]([[docsref:/utilities/text]]) for more details. {/* TODO text to adapt and link to change */ } - Warning `color-mode({mode}, {root}, {inverted-mode})` mixin signature has changed. We now provide an `$inverted-mode` parameter that is set by default to `light` or `dark` depending on the `$mode`. It allows you to precise another mode to be the inverse of a certain mode. diff --git a/site/src/content/docs/getting-started/sass.mdx b/site/src/content/docs/getting-started/sass.mdx index 3169f64ad7..22c0f98a35 100644 --- a/site/src/content/docs/getting-started/sass.mdx +++ b/site/src/content/docs/getting-started/sass.mdx @@ -88,7 +88,7 @@ In your `custom.scss`, you’ll import OUDS Web’s source Sass files. You have // 7. Include any other optional stylesheet partials as desired; list below is not inclusive of all available stylesheets @import "../node_modules/@ouds/web-common/scss/utilities"; @import "../node_modules/@ouds/web-common/scss/reboot"; -@import "../node_modules/@ouds/web-common/scss/type"; +@import "../node_modules/@ouds/web-common/scss/typography"; @import "../node_modules/@ouds/web-common/scss/images"; @import "../node_modules/@ouds/web-common/scss/containers"; @import "../node_modules/@ouds/web-common/scss/grid"; @@ -171,7 +171,7 @@ $body-color: #111; // Optional OUDS Web components here @import "../node_modules/@ouds/web-common/scss/reboot"; -@import "../node_modules/@ouds/web-common/scss/type"; +@import "../node_modules/@ouds/web-common/scss/typography"; // etc ``` @@ -237,7 +237,7 @@ $theme-colors: map-remove($theme-colors, "info", "light", "dark"); // Optional @import "../node_modules/@ouds/web-common/scss/reboot"; -@import "../node_modules/@ouds/web-common/scss/type"; +@import "../node_modules/@ouds/web-common/scss/typography"; // etc ``` diff --git a/site/src/content/docs/getting-started/update-guide.mdx b/site/src/content/docs/getting-started/update-guide.mdx index d77dd8fd77..072e340c3f 100644 --- a/site/src/content/docs/getting-started/update-guide.mdx +++ b/site/src/content/docs/getting-started/update-guide.mdx @@ -63,6 +63,18 @@ toc: true - New Categorical tag has been implemented. Read more in our [tags page]([[docsref:/components/tags#categorical-tag]]). +#### Typography + +- New Heading has been implemented, and `.marker` class has been added for 'orange' and 'orange-compact' themes. Read more in our [typography/heading paragraph]([[docsref:/components/typography#heading]]). + +- New Display has been implemented. Read more in our [typography/display paragraph]([[docsref:/components/typography#display]]). + +- New Body has been implemented. Read more in our [typography/body paragraph]([[docsref:/components/typography#body]]). + +- New Label has been implemented. Read more in our [typography/label paragraph]([[docsref:/components/typography#label]]). + +- New Code has been implemented. Read more in our [typography/code paragraph]([[docsref:/components/typography#code]]). + ### Tools - Info OUDS Web's AI agent skills now have a [dedicated repository](https://github.com/Orange-OpenSource/ouds-web-skills). To install or update them, run `npx skills add Orange-OpenSource/ouds-web-skills`. @@ -74,10 +86,19 @@ toc: true - version 2.7.0 of [the components design tokens](https://r.orange.fr/r/S-ouds-doc-token-component-changelog) - version 2.7.0 of [the semantic design tokens](https://r.orange.fr/r/S-ouds-doc-token-semantic-changelog) +### Sass + +- Breaking `_type.scss` has been renamed to `_typography.scss` for more consistency. You will need to change this name if you create your own custom import. + +### Reboot + +- Warning `.blockquote` and `.blockquote-footer` class have been deprecated, you can use `
    ` and `
    ` instead. Read more in our [reboot page, blockquote section]([[docsref:/foundation/reboot#blockquote]]). + ### Dual mode -1. Update `@ouds/web-common` and `@ouds/web-[theme]` to v1.5.0. +1. Update `@ouds/web-common` and `@ouds/web-[theme]` to v1.6.0. 2. Remove `@import "boosted/scss/dropdown";` from the Boosted custom import stack. +3. Change `@import "@ouds/web-common/scss/type";` to `@import "@ouds/web-common/scss/typography";` in the OUDS Web custom import stack. ## v1.5.0 [[version-changelog-link]] @@ -213,7 +234,7 @@ toc: true #### Text -- New Labels have been added to font size text utilities : `.fs-lxl`, `.fs-ll`, `.fs-lm`, `.fs-ls` are now available. Read more in our [typography page]([[docsref:foundation/typography#regular-texts]]). +- New Labels have been added to font size text utilities: `.fs-lxl`, `.fs-ll`, `.fs-lm`, `.fs-ls` are now available. Read more in our [text utilities page]([[docsref:utilities/text#font-size]]). ### CSS and Sass variables @@ -2574,7 +2595,7 @@ toc: true ### Sass mixins -- New The mixin `get-font-size({font-size-ref})` has been added, where `font-size-ref` is one of: `"code-medium"`, `"label-small"`, `"label-medium"`, `"label-large"`, `"label-xlarge"`, `"body-small"`, `"body-medium"`, `"body-large"`, `"heading-small"`, `"heading-medium"`, `"heading-large"`, `"heading-xlarge"`, `"display-small"`, `"display-medium"`, `"display-large"`. If you have/need any `font-size` in one of your SCSS classes, please consider using this mixin instead. See [Typography Sass mixins]([[docsref:/foundation/typography#sass-mixins]]) for more details. +- New The mixin `get-font-size({font-size-ref})` has been added, where `font-size-ref` is one of: `"code-medium"`, `"label-small"`, `"label-medium"`, `"label-large"`, `"label-xlarge"`, `"body-small"`, `"body-medium"`, `"body-large"`, `"heading-small"`, `"heading-medium"`, `"heading-large"`, `"heading-xlarge"`, `"display-small"`, `"display-medium"`, `"display-large"`. If you have/need any `font-size` in one of your SCSS classes, please consider using this mixin instead. See [Typography Sass mixins]([[docsref:/utilities/text]]) for more details. {/* TODO text to adapt and link to change */ } - New `color-mode({mode}, {root}, {inverted-mode})` mixin. diff --git a/site/src/content/docs/utilities.mdx b/site/src/content/docs/utilities.mdx index 636c91eea1..2d65dbf50f 100644 --- a/site/src/content/docs/utilities.mdx +++ b/site/src/content/docs/utilities.mdx @@ -64,6 +64,6 @@ Variables names can be easily inferred from token names, [this is explained in t | An opacity using a standard token `ouds/opacity/*`. Be careful where the token is applied. | `ouds/opacity/medium` | `none` | `$ouds-opacity-medium` | | A shadow using a composite token like `ouds/elevation/*`. | `ouds/elevation/**/emphasized` | `none` | `$ouds-elevation-emphasized` | | A spacing using a standard token `ouds/space/{scaled\|fixed}/*` or `ouds/space/{column-gap\|row-gap}/*`. | `ouds/space/scaled/2xlarge`
    `ouds/space/fixed/medium`
    `ouds/space/row-gap/none` | `--bs-space-scaled-2xlarge`
    `none`
    `none` | `none`
    `$ouds-space-fixed-medium`
    `$ouds-space-row-gap-none` | - | A text using a named typography reference or tokens like `ouds/font/*` or `font-ref/size/weight`. | `ouds/font/**/body-large`
    `Body/Large/Strong` | `get-font-size("body-large")`
    `none`
    As you can see, this one is a bit special and calls a mixin [`get-font-size()`]([[docsref:/foundation/typography/#text-style-for-custom-components]]). | `none`
    `$ouds-font-weight-web-body-strong` | + | A text using a named typography reference or tokens like `ouds/font/*` or `font-ref/size/weight`. | `ouds/font/**/body-large`
    `Body/Large/Strong` | `get-font-size("body-large")`
    `none`
    As you can see, this one is a bit special and calls a mixin [`get-font-size()`]([[docsref:/utilities/text]]). { /* TODO adapt the texts and change the link */ } | `none`
    `$ouds-font-weight-web-body-strong` | | A spacing using a grid token `ouds/grid/*` | `ouds/grid/column-gap`
    `ouds/grid/margin` | `--bs-grid-gap`
    `--bs-grid-margin` | `none`
    `none` | diff --git a/site/src/content/docs/utilities/icons-sizing.mdx b/site/src/content/docs/utilities/icons-sizing.mdx index 5660872a32..95485d2a11 100644 --- a/site/src/content/docs/utilities/icons-sizing.mdx +++ b/site/src/content/docs/utilities/icons-sizing.mdx @@ -68,9 +68,9 @@ Every icon size utility class presented in here has the common following code: -## Headings +## Heading -Here are the rules to follow for headings. These icons’ sizes are responsive. +Here are the rules to follow for [headings]([[docsref:/components/typography#heading]]). These icons’ sizes are responsive.
    See the sizes associated to classes @@ -254,13 +254,13 @@ Here are the rules to follow for headings. These icons’ sizes are responsive.
    H6 with small icon
    `} /> -## Display headings +## Display -You should not use any icon with our `.display-*` font sizes, because we prefer to keep the place for the text. +You should not use any icon with our [display texts]([[docsref:/components/typography#display]]), because we prefer to keep the place for the text. -## Regular texts +## Body -Here are the rules to follow for regular texts. These icons’ sizes are responsive. +Here are the rules to follow for [body texts]([[docsref:/components/typography#body]]). These icons’ sizes are responsive.
    See the sizes associated to classes diff --git a/site/src/content/docs/utilities/sizing.mdx b/site/src/content/docs/utilities/sizing.mdx index 8501c85456..32a07179f3 100644 --- a/site/src/content/docs/utilities/sizing.mdx +++ b/site/src/content/docs/utilities/sizing.mdx @@ -34,7 +34,7 @@ You can also use `max-width: 100%;` and `max-height: 100%;` utilities as needed.
    Max-height 100%
    `} /> -You can also use in some cases (mainly [font references]([[docsref:/foundation/typography]])) `max-width: none` utility as needed. +You can also use in some cases (mainly [typography components]([[docsref:/components/typography]])) `max-width: none` utility as needed.
    Max-width none
    diff --git a/site/src/content/docs/utilities/text.mdx b/site/src/content/docs/utilities/text.mdx index 457d8601f6..bdc39f81c1 100644 --- a/site/src/content/docs/utilities/text.mdx +++ b/site/src/content/docs/utilities/text.mdx @@ -111,6 +111,8 @@ Note how `.text-capitalize` only changes the first letter of each word, leaving ## Font size +{ /* TODO ajouter marker sur fs-hl */ } + Quickly change the `font-size` of text. Sizing for these utilities matches our predefined typography placeholders. Don’t forget to add one of our [`font-weight`](#font-weight) utility when needed. These classes change the `font-size` but also the `line-height`, the `letter-spacing` and the `max-width`. If you want to get rid of the `max-width`, please make sure to use our `.mw-none` [width utility]([[docsref:/utilities/sizing]]). @@ -282,7 +284,7 @@ Quickly change the `font-weight` of text with these utilities. `font-weight` uti - The medium font-weight can only be used with `label` and `body` [font references]([[docsref:/foundation/typography/#regular-texts]]). + The medium font-weight can only be used with [body text]([[docsref:/components/typography#body]]) and [label text]([[docsref:/components/typography#label]]). Bold text.

    diff --git a/site/src/scss/_component-examples.scss b/site/src/scss/_component-examples.scss index dca844d1f3..2f774d6ed6 100644 --- a/site/src/scss/_component-examples.scss +++ b/site/src/scss/_component-examples.scss @@ -423,6 +423,11 @@ // OUDS mod: no .bd-content .bd-code-snippet +// For code elements outside of code snippets, use muted color by default +code { + color: var(--#{$prefix}color-content-muted); +} + // OUDS mod // scss-docs-start sticker-fs-4xlarge .sticker-fs-4xlarge { diff --git a/skills/using-ouds-web-version-major-minor/SKILL.md b/skills/using-ouds-web-version-major-minor/SKILL.md index b26f4ebc43..9041ba674f 100644 --- a/skills/using-ouds-web-version-major-minor/SKILL.md +++ b/skills/using-ouds-web-version-major-minor/SKILL.md @@ -110,7 +110,6 @@ Always pin `` to a specific release (e.g. `1.4.0`) rather than leaving ### Foundation - [Approach](references/foundation/approach.md) - Design principles -- [Typography](references/foundation/typography.md) - Headings, body text, display, font mixins - [Colors](references/foundation/colors.md) - Available raw colors - [Color modes](references/foundation/color-modes.md) - Light/dark/root/root-inverted themes - [Tokens](references/foundation/tokens.md) - Raw/semantic/composite/component token architecture @@ -157,6 +156,7 @@ Always pin `` to a specific release (e.g. `1.4.0`) rather than leaving - [Table](references/components/table.md) - Opt-in table styling (draft component) - [Text area](references/components/text-area.md) - Multiline inputs - [Text input](references/components/text-input.md) - Single-line inputs +- [Typography](references/components/typography.md) - Headings (+ heading marker), display, body, label, code ### Not yet documented (do not invent markup) diff --git a/skills/using-ouds-web-version-major-minor/references/components/typography.md b/skills/using-ouds-web-version-major-minor/references/components/typography.md new file mode 100644 index 0000000000..506a2f40f5 --- /dev/null +++ b/skills/using-ouds-web-version-major-minor/references/components/typography.md @@ -0,0 +1,135 @@ +# Typography + +Typography is a set of UI elements that structure and style text content. Five types: **Heading**, **Display**, **Body**, **Label**, **Code**. + +Use the HTML tag matching the **semantic meaning** of the content (heading, paragraph, code snippet, etc.) — never pick a tag just because of how it looks on screen; appearance is handled by the class/token, not the tag. + +## Heading + +HTML `

    ` through `

    ` — each sets `font-size`, `line-height`, `letter-spacing`, `font-weight: bold`, and `max-width` (remove with `.mw-none` [width utility](../utilities/sizing.md)). Responsive across 3 breakpoint ranges. + +| Heading | Element | Breakpoints 2xs–sm | Breakpoints md–lg | Breakpoints xl+ | +| -------------- | ------- | ------------------ | ----------------- | --------------- | +| Heading xlarge | `

    ` | token-based | token-based | token-based | +| Heading large | `

    ` | token-based | token-based | token-based | +| Heading medium | `

    ` | token-based | token-based | token-based | +| Heading small | `

    ` | token-based | token-based | token-based | +| Body large | `

    ` | token-based | token-based | token-based | +| Body medium | `
    ` | token-based | token-based | token-based | + +```html +

    h1. OUDS Web heading

    +

    h2. OUDS Web heading

    +

    h3. OUDS Web heading

    +

    h4. OUDS Web heading

    +
    h5. OUDS Web heading
    +
    h6. OUDS Web heading
    +``` + +Classes `.h1` through `.h6` are also available, for when a heading needs to be styled like another level without using the associated HTML element: + +```html +

    h2 element styled like a h1

    +

    h3 element styled like a h2

    +``` + +> **Prefer the real heading element:** use `

    `–`

    ` to represent headings in the document structure. Use `.h1`–`.h6` only to give an *actual heading* a visual size different from its semantic level (e.g. `

    `) — never on a non-heading element such as `

    `: screen reader users rely on real heading elements to navigate the page, and a styled `

    ` is invisible to that navigation. + +### Heading with marker + +A brand-colored marker can be displayed below a heading large (`

    ` or `.h2`) to reinforce visual emphasis and information hierarchy. Add the `.marker` class: + +```html +

    h2. OUDS Web heading with marker

    +

    h3 element styled like a h2, with marker

    +``` + +> **Brand-dependent:** the marker only renders if the active theme defines the `$ouds-typography-heading-large-marker` flag and a `$ouds-heading-large-marker-img` asset. It is available on Orange and Orange Compact; Sosh does not define a marker image, so `.marker` has no visible effect there. + +## Display + +Larger, more opinionated heading styles for impactful content (landing pages, marketing, key messages). Use sparingly. **OUDS Web uses named sizes, not numbers.** + +| Class | Description | +| ----------------- | ---------------- | +| `.display-large` | Largest display | +| `.display-medium` | Medium display | +| `.display-small` | Smallest display | + +```html +

    Display large

    +

    Display medium

    +

    Display small

    +``` + +> **Not Bootstrap:** Bootstrap uses `.display-1` through `.display-6`. OUDS Web uses `.display-large`, `.display-medium`, `.display-small`. With `$enable-bootstrap-compatibility: true`, `.display-1` through `.display-6` are also available. + +`.display-large`/`.display-medium`/`.display-small` are equivalent to the font-size text utilities `.fs-dl`/`.fs-dm`/`.fs-ds` (except for `font-weight`) — both also set `line-height`, `letter-spacing`, and `max-width`. + +Sass: `$display-font-sizes`, `$display-font-weight`, `$display-font-family`, `$display-font-style`, `$display-line-height`. + +## Body + +Regular body text, used for paragraphs, descriptions, and informational messages. Only headings, display headings, and `` text use **bold** by default; body text uses `normal` font-weight (overridable via [font weight utilities](../utilities/text.md)). Body medium is set by default on the `:root` element. + +| Reference | Class/Element | +| ----------- | --------------------- | +| Body large | `.lead` | +| Body medium | Default `

    ` | +| Body small | `.small` or `` | + +```html +

    This is a lead paragraph. It stands out from regular paragraphs.

    + +

    This is a regular body paragraph.

    + +

    This is a small paragraph.

    +

    This is another small paragraph.

    +``` + +`.lead`, default `

    `, and `.small`/`` are equivalent to the font-size text utilities `.fs-bl`, `.fs-bm`, `.fs-bs` — all of them also set `line-height`, `letter-spacing`, and `max-width`. Use the appropriate HTML tag to convey the right semantic meaning (generally a `

    `). + +> For other inline text elements (``, ``, ``, ``, ``) and blockquotes, see [Reboot](../foundation/reboot.md). + +## Label + +Label is non-responsive text for compact UI components such as buttons, form fields, badges, and tags — single value regardless of breakpoint, unlike Heading/Display/Body (responsive). Four size levels, `normal` font-weight by default: + +| Class | Level | +| ---------- | -------------- | +| `.fs-lxl` | Label xlarge | +| `.fs-ll` | Label large | +| `.fs-lm` | Label medium | +| `.fs-ls` | Label small | + +```html +Label medium text +``` + +## Code + +Styles technical content like code snippets, commands, system values, and identifiers, using a monospace typeface. Single size — reserve it for content that genuinely needs a code-like representation. + +> **Color:** `` and `

    ` no longer force a muted text color by default (the library leaves `color` to inherit the surrounding text color). If a muted appearance is desired, apply it explicitly, e.g. `color: var(--bs-color-content-muted)`.
    +
    +### Inline code
    +
    +```html
    +For example, <section> should be wrapped as inline.
    +```
    +
    +### Code blocks
    +
    +Use `
    ` for multiple lines; `
    ` preserves whitespace/indentation, `` marks the content as code.
    +
    +```html
    +
    
    +if (document.getElementById('myId')) {
    +  document.getElementById('myId').addEventListener('click', () => {
    +    ...
    +  })
    +}
    +
    +``` + +> To size text in a custom component rather than using one of the classes above, use the `get-font-size()` composite-token mixin — see [Tokens](../foundation/tokens.md#composite-tokens). diff --git a/skills/using-ouds-web-version-major-minor/references/foundation/reboot.md b/skills/using-ouds-web-version-major-minor/references/foundation/reboot.md index bf039b610c..99dbb73661 100644 --- a/skills/using-ouds-web-version-major-minor/references/foundation/reboot.md +++ b/skills/using-ouds-web-version-major-minor/references/foundation/reboot.md @@ -15,7 +15,7 @@ Element-specific CSS changes providing a consistent baseline. Builds on Normaliz - `box-sizing: border-box` globally on all elements (including `::before`/`::after`) - No base `font-size` on `` (browser default 16px assumed); `font-size: 1rem` on `:root` children - `:root` children set `font-family`, `font-weight`, `line-height`, `color` -- `background-color` on `:root` children defaults to `#fff` +- `background-color` on `:root` children set via `--bs-color-bg-primary` ## Font Stack @@ -32,6 +32,21 @@ Custom fonts loaded from CDN with native font stack as fallback. Font faces gene `

    `: `margin-top` removed, `margin-bottom` set to `$ouds-space-fixed-medium`. Remove with `.mb-none`. +## Inline Text Elements + +```html +

    You can use the mark tag to highlight text.

    +

    This line of text is meant to be treated as deleted text.

    +

    This line of text is meant to be treated as no longer accurate.

    +

    This line of text is meant to be treated as an addition to the document.

    +

    This line of text will render as underlined.

    +

    This line of text is meant to be treated as fine print.

    +

    This line rendered as bold text.

    +

    This line rendered as bold text too, but would natively be italicized.

    +``` + +Use these tags for semantic purpose: `` (marked/highlighted for reference), `` (side-comments, legal text — uses [body small](../components/typography.md#body)), `` (no longer relevant/accurate), `` (non-textual annotation). To style text without the semantic meaning, use the equivalent classes instead: `.mark`, `.small`, `.text-decoration-underline` (like ``), `.text-decoration-line-through` (like ``). `` and `` remain available for highlighting without added importance / voice & technical terms. + ## Links - Bold and underlined by default @@ -64,6 +79,33 @@ Use appropriate `data-bs-theme` and `.bg-surface-*` classes: Styled via `border-top`, inherits `border-color` via `color`. Customize with border utilities. See Divider component. +## Blockquotes + +Style applies directly to the bare `
    ` element — the `.blockquote` class is deprecated (since v1.6), do not use it in new code. Uses [body large text](../components/typography.md#body). + +```html +
    +

    A well-known quote, contained in a blockquote element.

    +
    +``` + +### Naming a source + +The HTML spec requires attribution to be placed outside the `
    `. Wrap the `
    ` in a `
    ` and add a plain `
    ` (no class) **immediately after** the `
    ` — it gets its styling (dash prefix, body small text) from the adjacent-sibling selector `blockquote + figcaption`. Wrap the source name in ``. + +```html +
    +
    +

    A well-known quote, contained in a blockquote element.

    +
    +
    + Someone famous in Source Title +
    +
    +``` + +> **Deprecation (v1.6.0):** `.blockquote` and `.blockquote-footer` are deprecated (they still work for now). Use the plain `
    ` element, followed by `
    ` for the attribution. + ## Lists Refer to Bullet list component for `
      `/`
        ` styling, `.list-unstyled`, `.list-inline`. diff --git a/skills/using-ouds-web-version-major-minor/references/foundation/tokens.md b/skills/using-ouds-web-version-major-minor/references/foundation/tokens.md index f7c100cfa3..967940ba80 100644 --- a/skills/using-ouds-web-version-major-minor/references/foundation/tokens.md +++ b/skills/using-ouds-web-version-major-minor/references/foundation/tokens.md @@ -28,6 +28,26 @@ OUDS Web design tokens (from Figma) are structured in a **three-tier architectur - Aggregations of several semantic tokens (or brand-specific icons), e.g. shadow/elevation tokens and typographic definitions - Already exposed via utilities/components — **usable directly** +### Font tokens: `get-font-size()` mixin + +Font tokens can't be used as plain Sass/CSS variables — they're aggregated into the `get-font-size()` mixin, which takes the font reference name as a parameter. Use it to size text in custom components. Levels: heading (`heading-xlarge/large/medium/small`), body (`body-large/medium/small`), label (`label-xlarge/large/medium/small`). + +```scss +.my-custom-component { + @include get-font-size("label-medium"); +} +``` + +Outputs: + +```css +.my-custom-component { + font-size: var(--bs-font-size-label-medium); + line-height: var(--bs-font-line-height-label-medium); + letter-spacing: var(--bs-font-letter-spacing-label-medium); /* ltr only */ +} +``` + ## Component tokens - File: `@ouds/web-{brand}/scss/tokens/_component.scss` diff --git a/skills/using-ouds-web-version-major-minor/references/foundation/typography.md b/skills/using-ouds-web-version-major-minor/references/foundation/typography.md deleted file mode 100644 index 54f73683b3..0000000000 --- a/skills/using-ouds-web-version-major-minor/references/foundation/typography.md +++ /dev/null @@ -1,168 +0,0 @@ -# Typography - -Global typography settings, headings, body text, display headings, and text utilities. - -## Global Settings - -- Custom font stack with native font fallback per OS/device -- Browser default root `font-size` (16px) — set `$font-size-base` in `rem` -- `max-width` applied on all font references for readability — remove with `.mw-none` utility -- `--bs-color-bg-primary` sets `background-color` on `:root` children -- Sass variables: `$font-family-base`, `$font-size-base`, `$line-height-base` -- Styles in `_reboot.scss`, variables in `_variables.scss` - -## Headings - -HTML `

        ` through `

        ` — each sets `font-size`, `line-height`, `letter-spacing`, `font-weight: bold`, and `max-width`. Responsive across 3 ranges. - -| Heading | Element | Breakpoints 2xs–sm | Breakpoints md–lg | Breakpoints xl+ | -| -------------- | ------- | ------------------ | ----------------- | --------------- | -| Heading xlarge | `

        ` | token-based | token-based | token-based | -| Heading large | `

        ` | token-based | token-based | token-based | -| Heading medium | `

        ` | token-based | token-based | token-based | -| Heading small | `

        ` | token-based | token-based | token-based | -| Body large | `

        ` | token-based | token-based | token-based | -| Body medium | `
        ` | token-based | token-based | token-based | - -```html -

        h1. OUDS Web heading

        -

        h2. OUDS Web heading

        -

        h3. OUDS Web heading

        -

        h4. OUDS Web heading

        -
        h5. OUDS Web heading
        -
        h6. OUDS Web heading
        -``` - -Classes `.h1` through `.h6` available for matching heading styling without the HTML element: - -```html -

        h1. OUDS Web heading

        -``` - -## Display Headings - -Larger, more opinionated heading styles. **OUDS Web uses named sizes, not numbers.** - -| Class | Description | -| ----------------- | ---------------- | -| `.display-large` | Largest display | -| `.display-medium` | Medium display | -| `.display-small` | Smallest display | - -```html -

        Display large

        -

        Display medium

        -

        Display small

        -``` - -> **Not Bootstrap:** Bootstrap uses `.display-1` through `.display-6`. OUDS Web uses `.display-large`, `.display-medium`, `.display-small`. - -With `$enable-bootstrap-compatibility: true`, `.display-1` through `.display-6` are also available. - -Sass: `$display-font-sizes`, `$display-font-weight`, `$display-font-family`, `$display-font-style`, `$display-line-height`. - -## Regular Texts - -Only headings, display headings, and `` text use **bold**. Other content uses `normal` font-weight. - -| Reference | Class/Element | -| ----------- | --------------------- | -| Body large | `.lead` | -| Body medium | Default `

        ` | -| Body small | `.small` or `` | - -### Lead - -```html -

        - This is a lead paragraph. It stands out from regular paragraphs. -

        -``` - -### Small - -```html -

        This is a small paragraph.

        -

        This is a small paragraph.

        -``` - -## Inline Text Elements - -```html -

        You can use the mark tag to highlight text.

        -

        This line of text is meant to be treated as deleted text.

        -

        This line of text is meant to be treated as no longer accurate.

        -

        - This line of text is meant to be treated as an addition to the - document. -

        -

        This line of text will render as underlined.

        -

        This line of text is meant to be treated as fine print.

        -

        This line rendered as bold text.

        -

        - This line rendered as bold text too, but would natively be - italicized. -

        -``` - -Equivalent classes: `.mark`, `.small`, `.text-decoration-underline`, `.text-decoration-line-through`. - -## Blockquotes - -Uses body large text. Wrap with `
        `. - -```html -
        -

        A well-known quote, contained in a blockquote element.

        -
        -``` - -### With Attribution - -```html -
        -
        -

        A well-known quote, contained in a blockquote element.

        -
        - -
        -``` - -## Label utility classes (v1.4.0+) - -In addition to heading/body font-size utilities, dedicated **label** font-size classes are available (non-responsive, single value regardless of breakpoint), for UI labels such as form labels, buttons, tags, badges: - -| Class | Level | -| ---------- | -------------- | -| `.fs-lxl` | Label xlarge | -| `.fs-ll` | Label large | -| `.fs-lm` | Label medium | -| `.fs-ls` | Label small | - -```html -Label medium text -``` - -## Sass Mixin: `get-font-size()` - -For custom components, use the `get-font-size()` mixin. Label levels: `small`, `medium`, `large`, `xlarge`. - -```scss -.my-custom-component { - @include get-font-size("label-medium"); -} -``` - -Outputs: - -```css -.my-custom-component { - font-size: var(--bs-font-size-label-medium); - line-height: var(--bs-font-line-height-label-medium); - letter-spacing: var(--bs-font-letter-spacing-label-medium); /* ltr only */ -} -``` diff --git a/skills/using-ouds-web-version-major-minor/references/getting-started/sass.md b/skills/using-ouds-web-version-major-minor/references/getting-started/sass.md index 288b4f46a5..9b7860ccc2 100644 --- a/skills/using-ouds-web-version-major-minor/references/getting-started/sass.md +++ b/skills/using-ouds-web-version-major-minor/references/getting-started/sass.md @@ -49,7 +49,7 @@ your-project/ // 7. Optional partials @import "../node_modules/@ouds/web-common/scss/utilities"; @import "../node_modules/@ouds/web-common/scss/reboot"; -@import "../node_modules/@ouds/web-common/scss/type"; +@import "../node_modules/@ouds/web-common/scss/typography"; @import "../node_modules/@ouds/web-common/scss/images"; @import "../node_modules/@ouds/web-common/scss/containers"; @import "../node_modules/@ouds/web-common/scss/grid"; diff --git a/skills/using-ouds-web-version-major-minor/references/getting-started/update-guide.md b/skills/using-ouds-web-version-major-minor/references/getting-started/update-guide.md index f69c9590b2..99b6eb5e3b 100644 --- a/skills/using-ouds-web-version-major-minor/references/getting-started/update-guide.md +++ b/skills/using-ouds-web-version-major-minor/references/getting-started/update-guide.md @@ -7,12 +7,18 @@ ### Breaking changes - **Alerts**: action links placed inside `.alert-container`, after `.alert-text-container`, must use the compact link variant: `.link.link-compact`. Action links placed inside `.alert-action-container`, beside the close button, continue to use the regular `.link`. +- **Blockquotes**: `.blockquote` and `.blockquote-footer` classes deprecated (still working) - use the `
        ` element directly, followed by a plain `
        ` immediately after it (`blockquote + figcaption`), inside a `
        `. ### New - **Buttons**: Expand button implemented - **Links**: Expand link implemented - **Tags**: Categorical tag implemented +- **Typography**: optional heading marker — add `.marker` to a heading large (`

        `/`.h2`) to display a brand-colored marker below it (Orange, Orange Compact; no visible effect on Sosh). + +### Components + +- `` and `
        ` no longer force a muted text color by default; they now inherit the surrounding text color.
         
         ## v1.5.0
         
        diff --git a/skills/using-ouds-web-version-major-minor/references/utilities/figma-tokens.md b/skills/using-ouds-web-version-major-minor/references/utilities/figma-tokens.md
        index 2ec5e9a98c..93d40ec9ab 100644
        --- a/skills/using-ouds-web-version-major-minor/references/utilities/figma-tokens.md
        +++ b/skills/using-ouds-web-version-major-minor/references/utilities/figma-tokens.md
        @@ -34,5 +34,5 @@ Use when there is no utility class, when applying a token on a pseudo-element, o
         | Opacity `ouds/opacity/*`                              | `ouds/opacity/medium`                                                  | none                                                            | `$ouds-opacity-medium`                                         |
         | Shadow `ouds/elevation/*`                              | `ouds/elevation/**/emphasized`                                         | none                                                            | `$ouds-elevation-emphasized`                                   |
         | Spacing `ouds/space/*`                                 | `ouds/space/scaled/2xlarge`
        `ouds/space/fixed/medium` | `--bs-space-scaled-2xlarge`
        none | none
        `$ouds-space-fixed-medium` | -| Typography `ouds/font/*` or `font-ref/size/weight` | `ouds/font/**/body-large` | Use the `get-font-size()` Sass mixin (see [typography](../foundation/typography.md)) | `$ouds-font-weight-web-body-strong` (weight only) | +| Typography `ouds/font/*` or `font-ref/size/weight` | `ouds/font/**/body-large` | Use the `get-font-size()` Sass mixin (see [Tokens](../foundation/tokens.md#composite-tokens)) | `$ouds-font-weight-web-body-strong` (weight only) | | Grid `ouds/grid/*` | `ouds/grid/column-gap`
        `ouds/grid/margin` | `--bs-grid-gap`
        `--bs-grid-margin` | none |