Skip to content

[pull] main from coreui:main #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 63 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
746377d
docs: improve internal linking
mrholek Dec 29, 2024
72ec01f
feat(CSidebar): add 'as' prop to CSidebar
Dec 30, 2024
caa1007
Merge pull request #421 from matt-jb/add-as-prop-to-sidebar
mrholek Dec 31, 2024
8d2d46b
docs: update `@coreui/react` library imports
mrholek Jan 2, 2025
b14949c
Merge pull request #422 from mrholek/main
mrholek Jan 2, 2025
c54a0ab
chore: update dependencies and devDependencies
mrholek Jan 2, 2025
36814f6
chore: update dependencies and devDependencies
mrholek Jan 2, 2025
c2d2e7d
fix: lock the version of `@types/prop-types` to prevent `children` pr…
mrholek Jan 2, 2025
b1ede20
tests: update tests
mrholek Jan 3, 2025
e457ffe
fix(CModal): disable emitting the `onClose` event twice
mrholek Jan 3, 2025
454be70
Merge pull request #423 from mrholek/main
mrholek Jan 3, 2025
cdb4712
chore: clean-up
mrholek Jan 3, 2025
3f03770
refactor(useColorModes): replace `window` with `globalThis`
mrholek Jan 3, 2025
4bfeee2
Merge pull request #424 from mrholek/main
mrholek Jan 3, 2025
d5b9a4d
chore: clean-up
mrholek Jan 3, 2025
acceb01
build: update ESLint to v9.x
mrholek Jan 8, 2025
3a57192
build: migrate `.prettierrc.js` to `eslint.config.mjs`
mrholek Jan 8, 2025
cb1ef1f
Merge pull request #429 from mrholek/main
mrholek Jan 8, 2025
7c91c99
feat(CDropdown, CPopover, CTooltip): allow passing custom popper conf…
mrholek Jan 28, 2025
161bbd1
fix(CAccordion): add a missing ID attribute to the accordion collapse…
mrholek Jan 28, 2025
35276cb
docs: update API documentation
mrholek Feb 6, 2025
58ace1b
fix(useColorModes): replace `globalThis` with `window` for SSR support
mrholek Feb 6, 2025
d2ca48d
chore: update dependencies and devDependencies
mrholek Feb 6, 2025
92609b2
refactor(CDropdown): remove `aria-hidden` to improve component access…
mrholek Feb 6, 2025
9f24e2f
chore: update the current year to 2025
mrholek Feb 7, 2025
be8ae22
release: v5.5.0
mrholek Feb 7, 2025
ef0e750
docs: update content
mrholek Feb 16, 2025
e53f0fe
chore: update dependencies and devDependencies
mrholek Feb 16, 2025
9d74c9c
refactor: migrate to Sass modules
mrholek Feb 16, 2025
d260367
docs: remove double # in links
mrholek Apr 16, 2025
bb614f2
docs: update link to features
mrholek Apr 16, 2025
25e8ff4
fix(CDropdown): incorrect menu positioning when the toggler is re-ren…
mrholek Apr 29, 2025
46c4007
chore: update dependencies and devDependencies
mrholek Apr 29, 2025
57b0f90
tests: update tests
mrholek Apr 29, 2025
f451d62
refactor: improve typings
mrholek Apr 29, 2025
e0f155f
refactor(CTabs): fully implement a controlled/uncontrolled pattern
mrholek Apr 29, 2025
d8fd24a
chore: clean-up
mrholek Apr 29, 2025
adc116d
refactor(CAccordion): move the context outside the component
mrholek Apr 30, 2025
c719c6e
refactor(CToast): move the context outside the component
mrholek Apr 30, 2025
b6dc072
refactor(CSidebarNav): move the context outside the component
mrholek Apr 30, 2025
ad0ef5e
refactor(CProgress): move the context outside the component
mrholek Apr 30, 2025
de2290b
refactor(CCarousel): move the context outside the component
mrholek Apr 30, 2025
56e615d
refactor(CModal): move the context outside the component
mrholek Apr 30, 2025
08dde3d
refactor(CModal): move the context outside the component
mrholek Apr 30, 2025
cb15c39
docs: upadte API documentation
mrholek Apr 30, 2025
e1ab484
docs: add "use with Bootstrap"
mrholek May 1, 2025
4f128a0
docs: update bootstrap styles
mrholek May 1, 2025
f80bc4a
release: v5.6.0
mrholek May 1, 2025
fd9f2a8
docs: add withPrefix to urls
mrholek May 15, 2025
07027d1
docs: update links to API
mrholek May 15, 2025
0b7cbd8
feat(CButton): add support for unthemed outline and ghost buttons
mrholek May 19, 2025
1ad29c6
feat(CNav): add enclosed variants
mrholek May 19, 2025
bee8617
feat(CTabs): add enclosed variants
mrholek May 19, 2025
3b37bd9
chore: update dependencies and devDependencies
mrholek May 19, 2025
932d00f
release: v5.7.0
mrholek May 19, 2025
c727396
refactor(CButton): improve variants handling
mrholek May 29, 2025
38fc15a
docs: update content
mrholek Jun 8, 2025
90d8100
refactor: update tabs component
mrholek Jun 12, 2025
a2d3eb5
fix(CDropdown): prevent unnecessary re-rendering
mrholek Jul 6, 2025
5688b61
refactor(CDropdown): optimize menu visibility toggling
mrholek Jul 12, 2025
a6d3bb5
chore: update dependencies and devDependencies
mrholek Jul 12, 2025
1969a64
release: v5.7.1
mrholek Jul 13, 2025
44a6c98
docs: update schema markup
mrholek Jul 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs: update content
  • Loading branch information
mrholek committed Feb 16, 2025
commit ef0e750557f4327b5b6f887ed36151f79dffd152
7 changes: 1 addition & 6 deletions packages/docs/content/components/alert/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ React Alert is prepared for any length of text, as well as an optional close but

<ExampleSnippet component="AlertExample" componentName="React Alert" />

<Callout color="info" title="Conveying meaning to assistive technologies">
Using color to add meaning only provides a visual indication, which will not be conveyed to
users of assistive technologies – such as screen readers. Ensure that information denoted by the
color is either obvious from the content itself (e.g. the visible text), or is included through
alternative means, such as additional text hidden with the `.visually-hidden` class.
</Callout>
<Callout color="warning" type="colorAssistiveTechnologies" />

### Live example

Expand Down
6 changes: 3 additions & 3 deletions packages/docs/content/components/button-group/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Wrap a series of `<CButton>` components in `<CButtonGroup>`.

<ExampleSnippet component="ButtonGroupExample" componentName="React Button Group" />

<Callout color="info" title="Conveying meaning to assistive technologies">
For assistive technologies (ex. screen readers) to communicate that a series of buttons are grouped, a proper <code>role</code> attribute has to be provided. For button groups, this should be <code>role="group"</code>, while toolbars should have a <code>role="toolbar"</code>.
<Callout color="info" title={<>Ensure the correct <code>role</code> and provide a label</>}>
For assistive technologies (ex. screen readers) to communicate that a series of buttons are grouped, a proper `role` attribute has to be provided. For button groups, this should be `role="group"`, while toolbars should have a `role="toolbar"`.

Besides, groups and toolbars should be provided an understandable label, as most assistive technologies will otherwise not declare them, despite the appearance of the specific role attribute. In the following examples provided here, we apply <code>aria-label</code>, but options such as <code>aria-labelledby</code> can also be used.
Besides, groups and toolbars should be provided an understandable label, as most assistive technologies will otherwise not declare them, despite the appearance of the specific role attribute. In the following examples provided here, we apply `aria-label`, but options such as `aria-labelledby` can also be used.
</Callout>

These classes can also be added to groups of links, as an alternative to the [`CNav`](./../navs-tabs/#base-nav) components.
Expand Down
7 changes: 1 addition & 6 deletions packages/docs/content/components/button/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ CoreUI includes a bunch of predefined buttons components, each serving its own s

<ExampleSnippet component="ButtonExample" componentName="React Button" />

<Callout color="info" title="Conveying meaning to assistive technologies">
Using color to add meaning only provides a visual indication, which will not be conveyed to users
of assistive technologies – such as screen readers. Ensure that information denoted by the color
is either obvious from the content itself (e.g. the visible text), or is included through
alternative means, such as additional text hidden with the `.visually-hidden` class.
</Callout>
<Callout color="warning" type="colorAssistiveTechnologies" />

## Disable text wrapping

Expand Down
7 changes: 1 addition & 6 deletions packages/docs/content/components/callout/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ Callout component is prepared for any length of text, as well as an optional ele

<ExampleSnippet component="CalloutExample" componentName="React Callout" />

<Callout color="info" title="Conveying meaning to assistive technologies">
Using color to add meaning only provides a visual indication, which will not be conveyed to
users of assistive technologies – such as screen readers. Ensure that information denoted by the
color is either obvious from the content itself (e.g. the visible text), or is included through
alternative means, such as additional text hidden with the `.visually-hidden` class.
</Callout>
<Callout color="warning" type="colorAssistiveTechnologies" />

## API

Expand Down
7 changes: 1 addition & 6 deletions packages/docs/content/components/card/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,7 @@ Use `color` property to change the appearance of a card.

<ExampleSnippet component="CardStylesBackgroundAndColorExample" componentName="React Card" />

<Callout color="info" title="Conveying meaning to assistive technologies">
Using color to add meaning only provides a visual indication, which will not be conveyed to
users of assistive technologies – such as screen readers. Ensure that information denoted by the
color is either obvious from the content itself (e.g. the visible text), or is included through
alternative means, such as additional text hidden with the `.visually-hidden` class.
</Callout>
<Callout color="warning" type="colorAssistiveTechnologies" />

### Border

Expand Down
7 changes: 1 addition & 6 deletions packages/docs/content/components/list-group/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,7 @@ Contextual classes also work with `<a>`s or `<button>`s. Note the addition of th

<ExampleSnippet component="ListGroupContextualClasses2Example" componentName="React List Group" />

<Callout color="info" title="Conveying meaning to assistive technologies">
Using color to add meaning only provides a visual indication, which will not be conveyed to
users of assistive technologies – such as screen readers. Ensure that information denoted by the
color is either obvious from the content itself (e.g. the visible text), or is included through
alternative means, such as additional text hidden with the `.visually-hidden` class.
</Callout>
<Callout color="warning" type="colorAssistiveTechnologies" />

## With badges

Expand Down
83 changes: 76 additions & 7 deletions packages/docs/content/customize/sass.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ your-project/

In your `custom.scss`, you'll import CoreUI's source Sass files. You have two options: include all of CoreUI, or pick the parts you need. We encourage the latter, though be aware there are some requirements and dependencies across our components. You also will need to include some JavaScript for our plugins.

<Callout color="info" type="dartSassModules" />

```scss
@use "sass:map";
@use "@coreui/coreui/scss/variables" as *;

$custom-colors: (
"custom-color": #900
);

$theme-colors: map.merge($theme-colors, $custom-colors);

@use "@coreui/coreui/scss/coreui";
```

<Callout color="warning" type="dartSassDeprecations" />

```scss
// Custom.scss
// Option A: Include all of CoreUI
Expand Down Expand Up @@ -92,6 +109,17 @@ Variable overrides must come after our functions are imported, but before the re

Here's an example that changes the `background-color` and `color` for the `<body>` when importing and compiling CoreUI for Bootstrap via npm:

<Callout color="info" type="dartSassModules" />

```scss
@use "@coreui/coreui/scss/coreui" with (
$body-bg: #000,
$body-color: #111
)
```

<Callout color="warning" type="dartSassDeprecations" />

```scss
// Required
@import "../node_modules/@coreui/coreui/scss/functions";
Expand Down Expand Up @@ -142,6 +170,23 @@ $theme-colors: (

Add new colors to `$theme-colors`, or any other map, by creating a new Sass map with your custom values and merging it with the original map. In this case, we'll create a new `$custom-colors` map and merge it with `$theme-colors`.

<Callout color="info" type="dartSassModules" />

```scss
@use "sass:map";
@use "@coreui/coreui/scss/variables" as *;

$custom-colors: (
"custom-color": #900
);

$theme-colors: map.merge($theme-colors, $custom-colors);

@use "@coreui/coreui/scss/coreui";
```

<Callout color="warning" type="dartSassDeprecations" />

```scss
// Create your own map
$custom-colors: (
Expand All @@ -156,6 +201,21 @@ $theme-colors: map-merge($theme-colors, $custom-colors);

To remove colors from `$theme-colors`, or any other map, use `map-remove`. Be aware you must insert it between our requirements and options:

<Callout color="info" type="dartSassModules" />

```scss
@use "sass:map";
@use "@coreui/coreui/scss/variables" as *;
@use "@coreui/coreui/scss/maps" as *;

$theme-colors: map-remove($theme-colors, "info", "light", "dark");
$theme-colors-border-subtle: map.remove($theme-colors-border-subtle, "info", "light", "dark");

@use "@coreui/coreui/scss/coreui";
```

<Callout color="warning" type="dartSassDeprecations" />

```scss
// Required
@import "../node_modules/@coreui/coreui/scss/functions";
Expand Down Expand Up @@ -213,6 +273,8 @@ You can lighten or darken colors with CoreUI's `tint-color()` and `shade-color()
In practice, you'd call the function and pass in the color and weight parameters.

```scss
@use "@coreui/coreui/scss/functions/color" as *;

.custom-element {
color: tint-color($primary, 10%);
}
Expand All @@ -231,6 +293,8 @@ An additional function we include in CoreUI for Bootstrap is the color contrast
For example, to generate color swatches from our `$theme-colors` map:

```scss
@use "@coreui/coreui/scss/functions/color-contrast" as *;

@each $color, $value in $theme-colors {
.swatch-#{$color} {
color: color-contrast($value);
Expand All @@ -241,6 +305,8 @@ For example, to generate color swatches from our `$theme-colors` map:
It can also be used for one-off contrast needs:

```scss
@use "@coreui/coreui/scss/functions/color-contrast" as *;

.custom-element {
color: color-contrast(#000); // returns `color: #fff`
}
Expand All @@ -249,6 +315,8 @@ It can also be used for one-off contrast needs:
You can also specify a base color with our color map functions:

```scss
@use "@coreui/coreui/scss/functions/color-contrast" as *;

.custom-element {
color: color-contrast($dark); // returns `color: #fff`
}
Expand All @@ -265,6 +333,8 @@ We use the `add` and `subtract` functions to wrap the CSS `calc` function. The p
Example where the calc is valid:

```scss
@use "@coreui/coreui/scss/functions/math" as *;

$border-radius: .25rem;
$border-width: 1px;

Expand All @@ -282,6 +352,8 @@ $border-width: 1px;
Example where the calc is invalid:

```scss
@use "@coreui/coreui/scss/functions/math" as *;

$border-radius: .25rem;
$border-width: 0;

Expand All @@ -304,15 +376,12 @@ Our `@coreui/coreui/scss/mixins/` directory has a ton of mixins that power parts

A shorthand mixin for the `prefers-color-scheme` media query is available with support for `light`, `dark`, and custom color schemes.

```scss
@mixin color-scheme($name) {
@media (prefers-color-scheme: #{$name}) {
@content;
}
}
```

<ScssDocs file="mixins/_color-scheme.scss" capture="mixin-color-scheme" />

```scss
@use "@coreui/coreui/scss/mixins/color-scheme" as *;

.custom-element {
@include color-scheme(dark) {
// Insert dark mode styles here
Expand Down
85 changes: 81 additions & 4 deletions packages/docs/src/components/Callout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,91 @@ import React, { FC, ReactNode } from 'react'
export interface CalloutProps {
children: ReactNode
color: string
title?: string
title?: string | ReactNode
type?: string
}

const Callout: FC<CalloutProps> = ({ children, color, title }) => {
const description = (type: string) => {
switch (type) {
case 'colorAssistiveTechnologies': {
return (
<>
<h5>Conveying meaning to assistive technologies</h5>
<p>
Using color to add meaning only provides a visual indication, which will not be conveyed
to users of assistive technologies – such as screen readers. Ensure that information
denoted by the color is either obvious from the content itself (e.g. the visible text),
or is included through alternative means, such as additional text hidden with the{' '}
<code>.visually-hidden</code> class.
</p>
</>
)
}
case 'dartSassModules': {
return (
<>
<p>
<strong>Heads up!</strong> Since <code>@coreui/coreui</code> v5.3.0 and{' '}
<code>@coreui/coreui-pro</code> v5.10.0, we support Sass modules.
</p>
<p>
You can now use the modern <code>@use</code> and <code>@forward</code> rules instead of{' '}
<code>@import</code>, which is deprecated and will be removed in Dart Sass 3.0.0. Using{' '}
<code>@import</code> will result in a compilation warning. You can learn more about this
transition{' '}
<a
href="https://sass-lang.com/documentation/breaking-changes/import/"
target="_blank"
rel="noreferrer"
>
here
</a>
.
</p>
</>
)
}
case 'dartSassDeprecations': {
return (
<>
<p>
<strong>
Sass <code>@import</code> are deprecated and will be removed in Dart Sass 3.0.0.!
</strong>
</p>
<p>
You can also use <code>@import</code> rules, but please be aware that they are
deprecated and will be removed in Dart Sass 3.0.0, resulting in a compilation warning.
You can learn more about this deprecation{' '}
<a
href="https://sass-lang.com/documentation/breaking-changes/import/"
target="_blank"
rel="noreferrer"
>
here
</a>
.
</p>
</>
)
}
default: {
return ''
}
}
}

const Callout: FC<CalloutProps> = ({ children, color, title, type }) => {
return (
<div className={`docs-callout docs-callout-${color}`}>
{title && <h5>{title}</h5>}
{children}
{type ? (
description(type)
) : (
<>
{title && <h5>{title}</h5>}
{children}
</>
)}
</div>
)
}
Expand Down
26 changes: 18 additions & 8 deletions packages/docs/src/components/ScssDocs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ export interface ScssDocsProps {
capture: string
}

const unindent = (text: string) => {
const lines = text.split('\n')
// Find first non-empty line to determine indentation
const firstLine = lines.find((line) => line.trim().length > 0) || ''
const indentMatch = firstLine.match(/^( *)/)
const indent = indentMatch ? indentMatch[1] : ''
const regex = new RegExp(`^${indent}`)
return lines
.map((line) => line.replace(regex, ''))
.join('\n')
.trimEnd()
}

const ScssDocs = ({ file, capture }: ScssDocsProps) => {
;(typeof global === 'undefined' ? window : global).Prism = Prism
// eslint-disable-next-line unicorn/prefer-module
Expand All @@ -31,11 +44,11 @@ const ScssDocs = ({ file, capture }: ScssDocsProps) => {

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const _file = data.allFile.edges.find((node: any) => node.node.relativePath === file)
const captureStart = `// scss-docs-start ${capture}`
const captureEnd = `// scss-docs-end ${capture}`
const re = new RegExp(`${captureStart}((?:.|\n)*)${captureEnd}`)
const captureStart = `// scss-docs-start ${capture}\n`
const captureEnd = `// scss-docs-end ${capture}\n`
const re = new RegExp(`${captureStart}([\\s\\S]*?)${captureEnd}`, 'm')
const captured = re.exec(_file.node.internal.content)
const code = captured ? captured[1].trim() : undefined
const code = captured ? captured[1] : undefined

if (code === undefined) {
console.error(`Can't find "${capture}" in ${_file.node.relativePath}`)
Expand All @@ -45,10 +58,7 @@ const ScssDocs = ({ file, capture }: ScssDocsProps) => {
code && (
<div className="highlight mb-3">
<Highlight
code={code
.replaceAll('--#{$prefix}', '--cui-')
.replaceAll('\n -', '\n-')
.replaceAll('\n @', '\n@')}
code={unindent(code).replaceAll('--#{$prefix}', '--cui-')}
language="scss"
theme={{ plain: {}, styles: [] }}
>
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy