@coreui/react 4.10.0 → 5.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreui/react",
3
- "version": "4.10.0",
3
+ "version": "5.0.0-alpha.1",
4
4
  "description": "UI Components Library for React.js",
5
5
  "keywords": [
6
6
  "react",
@@ -38,29 +38,29 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@popperjs/core": "^2.11.8",
41
- "@rollup/plugin-commonjs": "^25.0.3",
41
+ "@rollup/plugin-commonjs": "^25.0.2",
42
42
  "@rollup/plugin-node-resolve": "^15.1.0",
43
43
  "@rollup/plugin-typescript": "^11.1.2",
44
- "@testing-library/jest-dom": "^5.17.0",
44
+ "@testing-library/jest-dom": "^5.16.5",
45
45
  "@testing-library/react": "^14.0.0",
46
- "@types/react": "18.2.18",
47
- "@types/react-dom": "^18.2.7",
46
+ "@types/react": "18.2.14",
47
+ "@types/react-dom": "^18.2.6",
48
48
  "@types/react-transition-group": "^4.4.6",
49
49
  "classnames": "^2.3.2",
50
- "jest": "^29.6.2",
51
- "jest-environment-jsdom": "^29.6.2",
50
+ "jest": "^29.6.0",
51
+ "jest-environment-jsdom": "^29.6.0",
52
52
  "prop-types": "^15.8.1",
53
53
  "react": "^18.2.0",
54
54
  "react-dom": "^18.2.0",
55
55
  "react-popper": "^2.3.0",
56
56
  "react-transition-group": "^4.4.5",
57
- "rollup": "^3.27.0",
57
+ "rollup": "^3.26.1",
58
58
  "ts-jest": "^29.1.1",
59
- "tslib": "^2.6.1",
60
- "typescript": "^4.9.5"
59
+ "tslib": "^2.6.0",
60
+ "typescript": "^5.1.6"
61
61
  },
62
62
  "peerDependencies": {
63
- "@coreui/coreui": "4.3.0",
63
+ "@coreui/coreui": "^5.0.0-alpha.2",
64
64
  "react": ">=17",
65
65
  "react-dom": ">=17"
66
66
  }
@@ -226,11 +226,11 @@ export const CCarousel = forwardRef<HTMLDivElement, CCarouselProps>(
226
226
  className={classNames(
227
227
  'carousel slide',
228
228
  {
229
- 'carousel-dark': dark,
230
229
  'carousel-fade': transition === 'crossfade',
231
230
  },
232
231
  className,
233
232
  )}
233
+ {...(dark && { 'data-coreui-theme': 'dark' })}
234
234
  onMouseEnter={_pause}
235
235
  onMouseLeave={cycle}
236
236
  {...(touch && { onTouchStart: handleTouchStart, onTouchMove: handleTouchMove })}
@@ -244,20 +244,24 @@ export const CCarousel = forwardRef<HTMLDivElement, CCarouselProps>(
244
244
  }}
245
245
  >
246
246
  {indicators && (
247
- <ol className="carousel-indicators">
247
+ <div className="carousel-indicators">
248
248
  {Array.from({ length: itemsNumber }, (_, i) => i).map((index) => {
249
249
  return (
250
- <li
250
+ <button
251
251
  key={`indicator${index}`}
252
252
  onClick={() => {
253
253
  !animating && handleIndicatorClick(index)
254
254
  }}
255
- className={active === index ? 'active' : ''}
255
+ className={classNames({
256
+ active: active === index
257
+ })}
256
258
  data-coreui-target=""
259
+ {...(active === index && { 'aria-current': true })}
260
+ aria-label={`Slide ${index + 1}`}
257
261
  />
258
262
  )
259
263
  })}
260
- </ol>
264
+ </div>
261
265
  )}
262
266
  <div className="carousel-inner">
263
267
  {Children.map(children, (child, index) => {
@@ -7,18 +7,24 @@ export interface CCloseButtonProps extends HTMLAttributes<HTMLButtonElement> {
7
7
  * A string of all className you want applied to the base component.
8
8
  */
9
9
  className?: string
10
+ /**
11
+ * Invert the default color.
12
+ */
13
+ dark?: boolean
10
14
  /**
11
15
  * Toggle the disabled state for the component.
12
16
  */
13
17
  disabled?: boolean
14
18
  /**
15
19
  * Change the default color to white.
20
+ *
21
+ * @deprecated 5.0.0
16
22
  */
17
23
  white?: boolean
18
24
  }
19
25
 
20
26
  export const CCloseButton = forwardRef<HTMLButtonElement, CCloseButtonProps>(
21
- ({ className, disabled, white, ...rest }, ref) => {
27
+ ({ className, dark, disabled, white, ...rest }, ref) => {
22
28
  return (
23
29
  <button
24
30
  type="button"
@@ -33,6 +39,7 @@ export const CCloseButton = forwardRef<HTMLButtonElement, CCloseButtonProps>(
33
39
  )}
34
40
  aria-label="Close"
35
41
  disabled={disabled}
42
+ {...(dark && { 'data-coreui-theme': 'dark' })}
36
43
  {...rest}
37
44
  ref={ref}
38
45
  />
@@ -42,6 +49,7 @@ export const CCloseButton = forwardRef<HTMLButtonElement, CCloseButtonProps>(
42
49
 
43
50
  CCloseButton.propTypes = {
44
51
  className: PropTypes.string,
52
+ dark: PropTypes.bool,
45
53
  disabled: PropTypes.bool,
46
54
  white: PropTypes.bool,
47
55
  }
@@ -46,7 +46,6 @@ export const CDropdownMenu = forwardRef<HTMLDivElement | HTMLUListElement, CDrop
46
46
  className={classNames(
47
47
  'dropdown-menu',
48
48
  {
49
- 'dropdown-menu-dark': dark,
50
49
  show: visible,
51
50
  },
52
51
  alignment && alignmentClassNames(alignment),
@@ -56,6 +55,7 @@ export const CDropdownMenu = forwardRef<HTMLDivElement | HTMLUListElement, CDrop
56
55
  role="menu"
57
56
  aria-hidden={!visible}
58
57
  {...(!popper && { 'data-coreui-popper': 'static' })}
58
+ {...(dark && { 'data-coreui-theme': 'dark' })}
59
59
  {...rest}
60
60
  >
61
61
  {Component === 'ul'
@@ -19,7 +19,7 @@ export interface CNavProps
19
19
  /**
20
20
  * Set the nav variant to tabs or pills.
21
21
  */
22
- variant?: 'tabs' | 'pills'
22
+ variant?: 'pills' | 'tabs' | 'underline'
23
23
  }
24
24
 
25
25
  export const CNav = forwardRef<HTMLDivElement | HTMLUListElement | HTMLOListElement, CNavProps>(
@@ -49,7 +49,7 @@ CNav.propTypes = {
49
49
  className: PropTypes.string,
50
50
  component: PropTypes.elementType,
51
51
  layout: PropTypes.oneOf(['fill', 'justified']),
52
- variant: PropTypes.oneOf(['tabs', 'pills']),
52
+ variant: PropTypes.oneOf(['pills', 'tabs', 'underline']),
53
53
  }
54
54
 
55
55
  CNav.displayName = 'CNav'
@@ -17,7 +17,7 @@ export interface CNavbarProps extends HTMLAttributes<HTMLDivElement> {
17
17
  */
18
18
  color?: Colors
19
19
  /**
20
- * Sets if the color of text should be colored for a light or dark dark background.
20
+ * Sets if the color of text should be colored for a light or dark background.
21
21
  */
22
22
  colorScheme?: 'dark' | 'light'
23
23
  /**
@@ -59,12 +59,12 @@ export const CNavbar = forwardRef<HTMLDivElement, CNavbarProps>(
59
59
  'navbar',
60
60
  {
61
61
  [`bg-${color}`]: color,
62
- [`navbar-${colorScheme}`]: colorScheme,
63
62
  [typeof expand === 'boolean' ? 'navbar-expand' : `navbar-expand-${expand}`]: expand,
64
63
  },
65
64
  placement,
66
65
  className,
67
66
  )}
67
+ {...(colorScheme && { 'data-coreui-theme': colorScheme })}
68
68
  {...rest}
69
69
  ref={ref}
70
70
  >
@@ -17,6 +17,10 @@ export interface COffcanvasProps extends HTMLAttributes<HTMLDivElement> {
17
17
  * A string of all className you want applied to the base component.
18
18
  */
19
19
  className?: string
20
+ /**
21
+ * Sets a darker color scheme.
22
+ */
23
+ dark?: boolean
20
24
  /**
21
25
  * Closes the offcanvas when escape key is pressed.
22
26
  */
@@ -59,6 +63,7 @@ export const COffcanvas = forwardRef<HTMLDivElement, COffcanvasProps>(
59
63
  children,
60
64
  backdrop = true,
61
65
  className,
66
+ dark,
62
67
  keyboard = true,
63
68
  onHide,
64
69
  onShow,
@@ -135,6 +140,7 @@ export const COffcanvas = forwardRef<HTMLDivElement, COffcanvasProps>(
135
140
  role="dialog"
136
141
  tabIndex={-1}
137
142
  onKeyDown={handleKeyDown}
143
+ {...(dark && { 'data-coreui-theme': 'dark' })}
138
144
  {...rest}
139
145
  ref={forkedRef}
140
146
  >
@@ -161,6 +167,7 @@ COffcanvas.propTypes = {
161
167
  backdrop: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf<'static'>(['static'])]),
162
168
  children: PropTypes.node,
163
169
  className: PropTypes.string,
170
+ dark: PropTypes.bool,
164
171
  keyboard: PropTypes.bool,
165
172
  onHide: PropTypes.func,
166
173
  onShow: PropTypes.func,
@@ -1,4 +1,5 @@
1
+ import { useColorModes } from './useColorModes'
1
2
  import { useForkedRef } from './useForkedRef'
2
3
  import { usePopper } from './usePopper'
3
4
 
4
- export { useForkedRef, usePopper }
5
+ export { useColorModes, useForkedRef, usePopper }