@coreui/react 4.4.0 → 4.4.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.
Files changed (37) hide show
  1. package/README.md +1 -1
  2. package/dist/components/Types.d.ts +6 -6
  3. package/dist/components/button/CButton.d.ts +4 -3
  4. package/dist/components/dropdown/CDropdown.d.ts +3 -3
  5. package/dist/components/dropdown/CDropdownItem.d.ts +1 -1
  6. package/dist/components/form/CFormCheck.d.ts +1 -1
  7. package/dist/components/form/CFormLabel.d.ts +2 -2
  8. package/dist/components/form/CFormRange.d.ts +1 -1
  9. package/dist/components/form/CFormSelect.d.ts +1 -1
  10. package/dist/components/form/CInputGroupText.d.ts +2 -2
  11. package/dist/components/form/index.d.ts +3 -1
  12. package/dist/components/grid/CCol.d.ts +3 -3
  13. package/dist/components/grid/CRow.d.ts +1 -1
  14. package/dist/components/header/CHeaderBrand.d.ts +2 -2
  15. package/dist/components/link/CLink.d.ts +2 -2
  16. package/dist/components/list-group/CListGroupItem.d.ts +3 -3
  17. package/dist/components/nav/CNavLink.d.ts +1 -1
  18. package/dist/components/toast/CToastClose.d.ts +4 -1
  19. package/dist/components/widgets/CWidgetStatsD.d.ts +1 -1
  20. package/dist/index.es.js +1 -6
  21. package/dist/index.es.js.map +1 -1
  22. package/dist/index.js +300 -310
  23. package/dist/index.js.map +1 -1
  24. package/dist/utils/hooks/useForkedRef.d.ts +1 -1
  25. package/package.json +9 -10
  26. package/src/components/button/CButton.tsx +3 -3
  27. package/src/components/form/CFormLabel.tsx +2 -2
  28. package/src/components/form/CFormRange.tsx +1 -1
  29. package/src/components/form/CInputGroupText.tsx +3 -2
  30. package/src/components/form/__tests__/CFormRange.spec.tsx +2 -2
  31. package/src/components/form/__tests__/CInputGroupText.spec.tsx +9 -0
  32. package/src/components/form/__tests__/__snapshots__/CInputGroupText.spec.tsx.snap +11 -0
  33. package/src/components/form/index.ts +4 -0
  34. package/src/components/header/CHeaderBrand.tsx +3 -2
  35. package/src/components/link/CLink.tsx +2 -2
  36. package/src/components/list-group/CListGroupItem.tsx +2 -2
  37. package/src/components/toast/CToastClose.tsx +4 -1
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare type AssignableRef<ValueType> = {
2
+ export type AssignableRef<ValueType> = {
3
3
  bivarianceHack(instance: ValueType | null): void;
4
4
  }['bivarianceHack'] | React.MutableRefObject<ValueType | null>;
5
5
  export declare function useForkedRef<RefValueType = any>(...refs: (AssignableRef<RefValueType> | null | undefined)[]): ((node: any) => void) | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreui/react",
3
- "version": "4.4.0",
3
+ "version": "4.4.1",
4
4
  "description": "UI Components Library for React.js",
5
5
  "keywords": [
6
6
  "react",
@@ -32,16 +32,16 @@
32
32
  "src/"
33
33
  ],
34
34
  "scripts": {
35
- "build": "rollup -c"
35
+ "build": "rollup -c --bundleConfigAsCjs"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@popperjs/core": "^2.11.5",
39
- "@rollup/plugin-commonjs": "^22.0.2",
40
- "@rollup/plugin-node-resolve": "^13.3.0",
41
- "@rollup/plugin-typescript": "^8.5.0",
39
+ "@rollup/plugin-commonjs": "^23.0.4",
40
+ "@rollup/plugin-node-resolve": "^15.0.1",
41
+ "@rollup/plugin-typescript": "^10.0.1",
42
42
  "@testing-library/jest-dom": "^5.16.5",
43
43
  "@testing-library/react": "^13.4.0",
44
- "@types/react": "18.0.19",
44
+ "@types/react": "18.0.26",
45
45
  "@types/react-dom": "^18.0.6",
46
46
  "@types/react-transition-group": "^4.4.5",
47
47
  "classnames": "^2.3.2",
@@ -50,10 +50,9 @@
50
50
  "react-dom": "^18.2.0",
51
51
  "react-popper": "^2.2.5",
52
52
  "react-transition-group": "^4.4.5",
53
- "rollup": "^2.79.0",
54
- "rollup-plugin-peer-deps-external": "^2.2.4",
55
- "tslib": "^2.4.0",
56
- "typescript": "^4.8.3"
53
+ "rollup": "^3.7.2",
54
+ "tslib": "^2.4.1",
55
+ "typescript": "^4.9.4"
57
56
  },
58
57
  "peerDependencies": {
59
58
  "react": ">=17",
@@ -1,11 +1,11 @@
1
- import React, { ButtonHTMLAttributes, ElementType, forwardRef } from 'react'
1
+ import React, { ElementType, forwardRef } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import classNames from 'classnames'
4
4
 
5
5
  import { Colors, Shapes, colorPropType } from '../Types'
6
- import { CLink } from '../link/CLink'
6
+ import { CLink, CLinkProps } from '../link/CLink'
7
7
 
8
- export interface CButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
8
+ export interface CButtonProps extends Omit<CLinkProps, 'size'> {
9
9
  /**
10
10
  * Toggle the active state for the component.
11
11
  */
@@ -1,8 +1,8 @@
1
- import React, { forwardRef, AllHTMLAttributes } from 'react'
1
+ import React, { forwardRef, LabelHTMLAttributes } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import classNames from 'classnames'
4
4
 
5
- export interface CFormLabelProps extends AllHTMLAttributes<HTMLLabelElement> {
5
+ export interface CFormLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
6
6
  /**
7
7
  * A string of all className you want applied to the component.
8
8
  */
@@ -38,7 +38,7 @@ export interface CFormRangeProps extends InputHTMLAttributes<HTMLInputElement> {
38
38
  /**
39
39
  * Specifies the interval between legal numbers in the component.
40
40
  */
41
- steps: number
41
+ step?: number
42
42
  /**
43
43
  * The `value` attribute of component.
44
44
  *
@@ -1,8 +1,9 @@
1
- import React, { ElementType, forwardRef, HTMLAttributes } from 'react'
1
+ import React, { ElementType, forwardRef, LabelHTMLAttributes } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import classNames from 'classnames'
4
4
 
5
- export interface CInputGroupTextProps extends HTMLAttributes<HTMLLabelElement | HTMLSpanElement> {
5
+ export interface CInputGroupTextProps
6
+ extends LabelHTMLAttributes<HTMLLabelElement | HTMLSpanElement> {
6
7
  /**
7
8
  * A string of all className you want applied to the component.
8
9
  */
@@ -4,7 +4,7 @@ import '@testing-library/jest-dom/extend-expect'
4
4
  import { CFormRange } from '../../../index'
5
5
 
6
6
  test('loads and displays CFormRange component', async () => {
7
- const { container } = render(<CFormRange steps={3} />)
7
+ const { container } = render(<CFormRange step={3} />)
8
8
  expect(container).toMatchSnapshot()
9
9
  })
10
10
 
@@ -12,7 +12,7 @@ test('CFormRange customize', async () => {
12
12
  const { container } = render(
13
13
  <CFormRange
14
14
  className="bazinga"
15
- steps={2}
15
+ step={2}
16
16
  disabled={true}
17
17
  max={150}
18
18
  min={20}
@@ -8,6 +8,15 @@ test('loads and displays CInputGroupText component', async () => {
8
8
  expect(container).toMatchSnapshot()
9
9
  })
10
10
 
11
+ test('renders CInputGroupText component as a label', async () => {
12
+ const { container } = render(
13
+ <CInputGroupText component="label" htmlFor="input">
14
+ Test
15
+ </CInputGroupText>,
16
+ )
17
+ expect(container).toMatchSnapshot()
18
+ })
19
+
11
20
  test('CInputGroupText customize', async () => {
12
21
  const { container } = render(<CInputGroupText className="bazinga">Test</CInputGroupText>)
13
22
  expect(container).toMatchSnapshot()
@@ -19,3 +19,14 @@ exports[`loads and displays CInputGroupText component 1`] = `
19
19
  </span>
20
20
  </div>
21
21
  `;
22
+
23
+ exports[`renders CInputGroupText component as a label 1`] = `
24
+ <div>
25
+ <label
26
+ class="input-group-text"
27
+ for="input"
28
+ >
29
+ Test
30
+ </label>
31
+ </div>
32
+ `;
@@ -1,5 +1,7 @@
1
1
  import { CForm } from './CForm'
2
2
  import { CFormCheck } from './CFormCheck'
3
+ import { CFormControlValidation } from './CFormControlValidation'
4
+ import { CFormControlWrapper } from './CFormControlWrapper'
3
5
  import { CFormFeedback } from './CFormFeedback'
4
6
  import { CFormFloating } from './CFormFloating'
5
7
  import { CFormInput } from './CFormInput'
@@ -15,6 +17,8 @@ import { CInputGroupText } from './CInputGroupText'
15
17
  export {
16
18
  CForm,
17
19
  CFormCheck,
20
+ CFormControlValidation,
21
+ CFormControlWrapper,
18
22
  CFormFeedback,
19
23
  CFormFloating,
20
24
  CFormInput,
@@ -1,8 +1,9 @@
1
- import React, { ElementType, forwardRef, HTMLAttributes } from 'react'
1
+ import React, { ElementType, forwardRef, AnchorHTMLAttributes } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import classNames from 'classnames'
4
4
 
5
- export interface CHeaderBrandProps extends HTMLAttributes<HTMLAnchorElement | HTMLSpanElement> {
5
+ export interface CHeaderBrandProps
6
+ extends AnchorHTMLAttributes<HTMLAnchorElement | HTMLSpanElement> {
6
7
  /**
7
8
  * A string of all className you want applied to the component.
8
9
  */
@@ -2,7 +2,7 @@ import React, { AllHTMLAttributes, ElementType, forwardRef, MouseEvent } from 'r
2
2
  import PropTypes from 'prop-types'
3
3
  import classNames from 'classnames'
4
4
 
5
- export interface CLinkProps extends AllHTMLAttributes<HTMLElement> {
5
+ export interface CLinkProps extends AllHTMLAttributes<HTMLButtonElement | HTMLAnchorElement> {
6
6
  /**
7
7
  * Toggle the active state for the component.
8
8
  */
@@ -36,7 +36,7 @@ export const CLink = forwardRef<HTMLButtonElement | HTMLAnchorElement, CLinkProp
36
36
  {...(active && { 'aria-current': 'page' })}
37
37
  {...(Component === 'a' && disabled && { 'aria-disabled': true, tabIndex: -1 })}
38
38
  {...((Component === 'a' || Component === 'button') && {
39
- onClick: (event: MouseEvent<HTMLElement>) => {
39
+ onClick: (event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {
40
40
  event.preventDefault
41
41
  !disabled && rest.onClick && rest.onClick(event)
42
42
  },
@@ -1,4 +1,4 @@
1
- import React, { ElementType, HTMLAttributes, forwardRef } from 'react'
1
+ import React, { ElementType, AnchorHTMLAttributes, forwardRef } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import classNames from 'classnames'
4
4
 
@@ -6,7 +6,7 @@ import { Colors, colorPropType } from '../Types'
6
6
  import { CLink } from '../link/CLink'
7
7
 
8
8
  export interface CListGroupItemProps
9
- extends HTMLAttributes<HTMLLIElement | HTMLAnchorElement | HTMLButtonElement> {
9
+ extends AnchorHTMLAttributes<HTMLLIElement | HTMLAnchorElement | HTMLButtonElement> {
10
10
  /**
11
11
  * Toggle the active state for the component.
12
12
  */
@@ -3,7 +3,10 @@ import PropTypes from 'prop-types'
3
3
  import { CToastContext } from './CToast'
4
4
  import { CCloseButton, CCloseButtonProps } from '../close-button/CCloseButton'
5
5
 
6
- export interface CToastCloseProps extends CCloseButtonProps {
6
+ import type { CButtonProps } from '../button/CButton'
7
+
8
+ type CombineButtonProps = CCloseButtonProps & CButtonProps
9
+ export interface CToastCloseProps extends CombineButtonProps {
7
10
  /**
8
11
  * Component used for the root node. Either a string to use a HTML element or a component.
9
12
  */