@coreui/react-pro 4.8.0 → 4.9.0-next.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 (166) hide show
  1. package/README.md +1 -1
  2. package/dist/components/alert/CAlert.d.ts +1 -1
  3. package/dist/components/avatar/CAvatar.d.ts +1 -1
  4. package/dist/components/badge/CBadge.d.ts +1 -1
  5. package/dist/components/button/CButton.d.ts +1 -1
  6. package/dist/components/calendar/index.d.ts +2 -0
  7. package/dist/components/calendar/utils.d.ts +22 -0
  8. package/dist/components/callout/CCallout.d.ts +1 -1
  9. package/dist/components/card/CCard.d.ts +1 -1
  10. package/dist/components/date-picker/CDatePicker.d.ts +1 -1
  11. package/dist/components/date-range-picker/CDateRangePicker.d.ts +3 -3
  12. package/dist/components/date-range-picker/utils.d.ts +1 -0
  13. package/dist/components/dropdown/CDropdown.d.ts +1 -1
  14. package/dist/components/dropdown/CDropdownToggle.d.ts +1 -1
  15. package/dist/components/element-cover/CElementCover.d.ts +0 -4
  16. package/dist/components/element-cover/index.d.ts +2 -0
  17. package/dist/components/form/CFormCheck.d.ts +1 -1
  18. package/dist/components/index.d.ts +1 -0
  19. package/dist/components/list-group/CListGroupItem.d.ts +4 -5
  20. package/dist/components/multi-select/CMultiSelect.d.ts +1 -13
  21. package/dist/components/multi-select/CMultiSelectNativeSelect.d.ts +1 -1
  22. package/dist/components/multi-select/CMultiSelectOptions.d.ts +1 -1
  23. package/dist/components/multi-select/CMultiSelectSelection.d.ts +1 -1
  24. package/dist/components/multi-select/types.d.ts +14 -0
  25. package/dist/components/multi-select/utils.d.ts +6 -0
  26. package/dist/components/navbar/CNavbar.d.ts +1 -1
  27. package/dist/components/offcanvas/COffcanvas.d.ts +7 -1
  28. package/dist/components/picker/CPicker.d.ts +1 -1
  29. package/dist/components/placeholder/CPlaceholder.d.ts +1 -1
  30. package/dist/components/popover/CPopover.d.ts +1 -1
  31. package/dist/components/progress/CProgressBar.d.ts +1 -1
  32. package/dist/components/smart-table/CSmartTableBody.d.ts +6 -5
  33. package/dist/components/smart-table/CSmartTableHead.d.ts +6 -3
  34. package/dist/components/smart-table/CSmartTableInterface.d.ts +38 -59
  35. package/dist/components/smart-table/types.d.ts +53 -0
  36. package/dist/components/smart-table/utils.d.ts +16 -0
  37. package/dist/components/spinner/CSpinner.d.ts +1 -1
  38. package/dist/components/table/CTable.d.ts +2 -18
  39. package/dist/components/table/CTableBody.d.ts +1 -1
  40. package/dist/components/table/CTableDataCell.d.ts +1 -1
  41. package/dist/components/table/CTableFoot.d.ts +1 -1
  42. package/dist/components/table/CTableHead.d.ts +1 -1
  43. package/dist/components/table/CTableHeaderCell.d.ts +1 -1
  44. package/dist/components/table/CTableRow.d.ts +1 -1
  45. package/dist/components/table/types.d.ts +17 -0
  46. package/dist/components/table/utils.d.ts +5 -0
  47. package/dist/components/time-picker/types.d.ts +15 -0
  48. package/dist/components/time-picker/utils.d.ts +23 -0
  49. package/dist/components/toast/CToast.d.ts +1 -1
  50. package/dist/components/toast/CToastClose.d.ts +1 -1
  51. package/dist/components/tooltip/CTooltip.d.ts +1 -1
  52. package/dist/components/virtual-scroller/CVirtualScroller.d.ts +0 -8
  53. package/dist/components/widgets/CWidgetStatsA.d.ts +1 -1
  54. package/dist/components/widgets/CWidgetStatsB.d.ts +1 -1
  55. package/dist/components/widgets/CWidgetStatsC.d.ts +1 -1
  56. package/dist/components/widgets/CWidgetStatsD.d.ts +1 -1
  57. package/dist/components/widgets/CWidgetStatsF.d.ts +1 -1
  58. package/dist/hooks/index.d.ts +3 -0
  59. package/dist/hooks/useForkedRef.d.ts +7 -0
  60. package/dist/hooks/useStateWithCallback.d.ts +2 -0
  61. package/dist/index.es.js +1171 -1109
  62. package/dist/index.es.js.map +1 -1
  63. package/dist/index.js +1171 -1108
  64. package/dist/index.js.map +1 -1
  65. package/dist/props.d.ts +8 -0
  66. package/dist/types.d.ts +7 -0
  67. package/dist/utils/index.d.ts +2 -3
  68. package/dist/utils/isObjectInArray.d.ts +2 -0
  69. package/package.json +11 -11
  70. package/src/components/accordion/CAccordionBody.tsx +1 -0
  71. package/src/components/accordion/CAccordionCollapse.tsx +1 -0
  72. package/src/components/alert/CAlert.tsx +3 -2
  73. package/src/components/avatar/CAvatar.tsx +2 -8
  74. package/src/components/backdrop/CBackdrop.tsx +2 -2
  75. package/src/components/badge/CBadge.tsx +2 -10
  76. package/src/components/button/CButton.tsx +3 -1
  77. package/src/components/calendar/CCalendar.tsx +351 -240
  78. package/src/components/calendar/index.ts +3 -0
  79. package/src/{utils/calendar.ts → components/calendar/utils.ts} +1 -47
  80. package/src/components/callout/CCallout.tsx +2 -1
  81. package/src/components/card/CCard.tsx +2 -1
  82. package/src/components/carousel/CCarousel.tsx +1 -1
  83. package/src/components/carousel/CCarouselItem.tsx +1 -1
  84. package/src/components/collapse/CCollapse.tsx +1 -1
  85. package/src/components/date-picker/CDatePicker.tsx +1 -1
  86. package/src/components/date-range-picker/CDateRangePicker.tsx +4 -4
  87. package/src/components/date-range-picker/utils.ts +49 -0
  88. package/src/components/dropdown/CDropdown.tsx +3 -2
  89. package/src/components/dropdown/CDropdownItem.tsx +1 -2
  90. package/src/components/dropdown/CDropdownMenu.tsx +2 -1
  91. package/src/components/dropdown/CDropdownToggle.tsx +5 -4
  92. package/src/components/element-cover/CElementCover.tsx +16 -22
  93. package/src/components/element-cover/index.ts +3 -0
  94. package/src/components/form/CFormCheck.tsx +3 -3
  95. package/src/components/form/CFormControlValidation.tsx +0 -1
  96. package/src/components/form/CFormControlWrapper.tsx +0 -1
  97. package/src/components/form/CFormInput.tsx +8 -4
  98. package/src/components/form/CFormRange.tsx +1 -2
  99. package/src/components/form/CFormSelect.tsx +1 -2
  100. package/src/components/form/CFormTextarea.tsx +1 -2
  101. package/src/components/index.ts +1 -0
  102. package/src/components/list-group/CListGroupItem.tsx +8 -8
  103. package/src/components/list-group/CListGroupItem.tsx~HEAD +3 -1
  104. package/src/components/modal/CModal.tsx +2 -2
  105. package/src/components/modal/CModalHeader.tsx +3 -2
  106. package/src/components/multi-select/CMultiSelect.tsx +15 -74
  107. package/src/components/multi-select/CMultiSelectNativeSelect.tsx +1 -1
  108. package/src/components/multi-select/CMultiSelectOptions.tsx +2 -2
  109. package/src/components/multi-select/CMultiSelectSelection.tsx +1 -1
  110. package/src/components/multi-select/types.ts +15 -0
  111. package/src/components/multi-select/utils.ts +92 -0
  112. package/src/components/nav/CNavItem.tsx +1 -0
  113. package/src/components/nav/CNavLink.tsx +4 -3
  114. package/src/components/navbar/CNavbar.tsx +2 -1
  115. package/src/components/offcanvas/COffcanvas.tsx +38 -19
  116. package/src/components/picker/CPicker.tsx +1 -1
  117. package/src/components/placeholder/CPlaceholder.tsx +2 -1
  118. package/src/components/popover/CPopover.tsx +2 -1
  119. package/src/components/progress/CProgress.tsx +1 -0
  120. package/src/components/progress/CProgressBar.tsx +2 -1
  121. package/src/components/sidebar/CSidebar.tsx +3 -2
  122. package/src/components/smart-table/CSmartTable.tsx +263 -257
  123. package/src/components/smart-table/CSmartTableBody.tsx +98 -107
  124. package/src/components/smart-table/CSmartTableCleaner.tsx +1 -1
  125. package/src/components/smart-table/CSmartTableFilter.tsx +1 -3
  126. package/src/components/smart-table/CSmartTableHead.tsx +56 -103
  127. package/src/components/smart-table/CSmartTableInterface.tsx +49 -71
  128. package/src/components/smart-table/CSmartTableItemsPerPageSelector.tsx +1 -2
  129. package/src/components/smart-table/types.ts +65 -0
  130. package/src/components/smart-table/utils.ts +199 -0
  131. package/src/components/spinner/CSpinner.tsx +2 -1
  132. package/src/components/table/CTable.tsx +25 -59
  133. package/src/components/table/CTableBody.tsx +2 -1
  134. package/src/components/table/CTableDataCell.tsx +2 -1
  135. package/src/components/table/CTableFoot.tsx +2 -1
  136. package/src/components/table/CTableHead.tsx +2 -1
  137. package/src/components/table/CTableHeaderCell.tsx +2 -1
  138. package/src/components/table/CTableRow.tsx +2 -1
  139. package/src/components/table/types.ts +20 -0
  140. package/src/components/table/utils.ts +29 -0
  141. package/src/components/tabs/CTabPane.tsx +2 -1
  142. package/src/components/time-picker/CTimePicker.tsx +48 -23
  143. package/src/components/time-picker/CTimePickerRollCol.tsx +1 -1
  144. package/src/components/time-picker/types.ts +15 -0
  145. package/src/{utils/time.ts → components/time-picker/utils.ts} +43 -2
  146. package/src/components/toast/CToast.tsx +4 -4
  147. package/src/components/toast/CToastClose.tsx +2 -2
  148. package/src/components/toast/CToaster.tsx +2 -1
  149. package/src/components/tooltip/CTooltip.tsx +3 -2
  150. package/src/components/virtual-scroller/CVirtualScroller.tsx +32 -55
  151. package/src/components/widgets/CWidgetStatsA.tsx +3 -3
  152. package/src/components/widgets/CWidgetStatsB.tsx +4 -4
  153. package/src/components/widgets/CWidgetStatsC.tsx +4 -4
  154. package/src/components/widgets/CWidgetStatsD.tsx +4 -5
  155. package/src/components/widgets/CWidgetStatsE.tsx +1 -2
  156. package/src/components/widgets/CWidgetStatsF.tsx +3 -4
  157. package/src/{components/Types.tsx → props.ts} +1 -68
  158. package/src/types.ts +68 -0
  159. package/src/utils/index.ts +2 -3
  160. package/src/utils/isObjectInArray.ts +14 -0
  161. package/src/components/multi-select/CMultiSelectCleaner.tsx +0 -18
  162. package/src/utils/getNextSibling.ts +0 -18
  163. package/src/utils/getPreviousSibling.ts +0 -18
  164. /package/src/{utils/hooks → hooks}/index.ts +0 -0
  165. /package/src/{utils/hooks → hooks}/useForkedRef.ts +0 -0
  166. /package/src/{utils/hooks → hooks}/useStateWithCallback.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  import React, { TdHTMLAttributes, ThHTMLAttributes } from 'react';
2
- import { Colors } from '../Types';
2
+ import type { Colors } from '../../types';
3
3
  export interface CTableDataCellProps extends Omit<TdHTMLAttributes<HTMLTableCellElement>, 'align'>, Omit<ThHTMLAttributes<HTMLTableCellElement>, 'align'> {
4
4
  /**
5
5
  * Highlight a table row or cell.
@@ -1,5 +1,5 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
- import { Colors } from '../Types';
2
+ import type { Colors } from '../../types';
3
3
  export interface CTableFootProps extends HTMLAttributes<HTMLTableSectionElement> {
4
4
  /**
5
5
  * A string of all className you want applied to the component.
@@ -1,5 +1,5 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
- import { Colors } from '../Types';
2
+ import type { Colors } from '../../types';
3
3
  export interface CTableHeadProps extends HTMLAttributes<HTMLTableSectionElement> {
4
4
  /**
5
5
  * A string of all className you want applied to the component.
@@ -1,5 +1,5 @@
1
1
  import React, { ThHTMLAttributes } from 'react';
2
- import { Colors } from '../Types';
2
+ import type { Colors } from '../../types';
3
3
  export interface CTableHeaderCellProps extends ThHTMLAttributes<HTMLTableCellElement> {
4
4
  /**
5
5
  * A string of all className you want applied to the component.
@@ -1,5 +1,5 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
- import { Colors } from '../Types';
2
+ import type { Colors } from '../../types';
3
3
  export interface CTableRowProps extends HTMLAttributes<HTMLTableRowElement> {
4
4
  /**
5
5
  * Highlight a table row or cell..
@@ -0,0 +1,17 @@
1
+ import { CTableDataCellProps } from '../table/CTableDataCell';
2
+ import { CTableHeaderCellProps } from '../table/CTableHeaderCell';
3
+ import { CTableRowProps } from '../table/CTableRow';
4
+ export type Column = {
5
+ label?: string;
6
+ key: string;
7
+ _style?: any;
8
+ _props?: CTableHeaderCellProps;
9
+ };
10
+ export type FooterItem = {
11
+ label?: string;
12
+ _props?: CTableDataCellProps;
13
+ };
14
+ export type Item = {
15
+ [key: string]: number | string | any;
16
+ _props?: CTableRowProps;
17
+ };
@@ -0,0 +1,5 @@
1
+ import type { Column, Item } from './types';
2
+ export declare const pretifyName: (name: string) => string;
3
+ export declare const getColumnLabel: (column: Column | string) => string;
4
+ export declare const getColumnNames: (columns: (string | Column)[] | undefined, items?: Item[]) => string[] | undefined;
5
+ export declare const getColumnNamesFromItems: (items: Item[]) => string[];
@@ -0,0 +1,15 @@
1
+ export type LocalizedTimePartials = {
2
+ listOfHours: {
3
+ value: number;
4
+ label: string;
5
+ }[];
6
+ listOfMinutes: {
7
+ value: number;
8
+ label: string;
9
+ }[];
10
+ listOfSeconds: {
11
+ value: number;
12
+ label: string;
13
+ }[];
14
+ hour12: boolean;
15
+ };
@@ -0,0 +1,23 @@
1
+ import type { LocalizedTimePartials } from './types';
2
+ export declare const convert12hTo24h: (abbr: 'am' | 'pm', hour: number) => number;
3
+ export declare const convert24hTo12h: (hour: number) => number;
4
+ export declare const convertTimeToDate: (time: Date | string | null | undefined) => Date | null;
5
+ export declare const getAmPm: (date: Date, locale: string) => "am" | "pm";
6
+ export declare const getListOfHours: (locale: string, ampm?: 'auto' | boolean) => {
7
+ value: number;
8
+ label: string;
9
+ }[];
10
+ export declare const getListOfMinutes: (locale: string, valueAsString?: boolean) => {
11
+ value: string | number;
12
+ label: string;
13
+ }[];
14
+ export declare const getListOfSeconds: (locale: string, valueAsString?: boolean) => {
15
+ value: string | number;
16
+ label: string;
17
+ }[];
18
+ export declare const getLocalizedTimePartials: (locale: string, ampm?: 'auto' | boolean) => LocalizedTimePartials;
19
+ export declare const getSelectedHour: (date: Date | null, locale: string, ampm?: 'auto' | boolean) => number | "";
20
+ export declare const getSelectedMinutes: (date: Date | null) => number | "";
21
+ export declare const getSelectedSeconds: (date: Date | null) => number | "";
22
+ export declare const isAmPm: (locale: string) => boolean;
23
+ export declare const isValidTime: (time: string) => number | false;
@@ -1,5 +1,5 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
- import { Colors } from '../Types';
2
+ import type { Colors } from '../../types';
3
3
  export interface CToastProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
4
4
  /**
5
5
  * Apply a CSS fade transition to the toast.
@@ -1,6 +1,6 @@
1
1
  import React, { ElementType } from 'react';
2
+ import { CButtonProps } from '../button/CButton';
2
3
  import { CCloseButtonProps } from '../close-button/CCloseButton';
3
- import type { CButtonProps } from '../button/CButton';
4
4
  type CombineButtonProps = CCloseButtonProps & CButtonProps;
5
5
  export interface CToastCloseProps extends CombineButtonProps {
6
6
  /**
@@ -1,5 +1,5 @@
1
1
  import { FC, HTMLAttributes, ReactNode } from 'react';
2
- import { Triggers } from '../Types';
2
+ import type { Triggers } from '../../types';
3
3
  export interface CTooltipProps extends HTMLAttributes<HTMLDivElement> {
4
4
  /**
5
5
  * A string of all className you want applied to the component.
@@ -4,14 +4,6 @@ export interface CVirtualScrollerProps extends Omit<HTMLAttributes<HTMLDivElemen
4
4
  * A string of all className you want applied to the base component.
5
5
  */
6
6
  className?: string;
7
- /**
8
- * Single item height.
9
- */
10
- itemHeight?: number | 'auto';
11
- /**
12
- * Number of items.
13
- */
14
- itemsNumber?: number;
15
7
  /**
16
8
  * Event fires when the component has been scrolled.
17
9
  */
@@ -1,5 +1,5 @@
1
1
  import React, { HTMLAttributes, ReactNode } from 'react';
2
- import { Colors } from '../Types';
2
+ import type { Colors } from '../../types';
3
3
  export interface CWidgetStatsAProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
4
4
  /**
5
5
  * Action node for your component.
@@ -1,6 +1,6 @@
1
1
  import React, { HTMLAttributes, ReactNode } from 'react';
2
- import { Colors } from '../Types';
3
2
  import { CProgressProps } from '../progress/CProgress';
3
+ import type { Colors } from '../../types';
4
4
  export interface CWidgetStatsBProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
5
5
  /**
6
6
  * A string of all className you want applied to the base component.
@@ -1,6 +1,6 @@
1
1
  import React, { HTMLAttributes, ReactNode } from 'react';
2
- import { Colors } from '../Types';
3
2
  import { CProgressProps } from '../progress/CProgress';
3
+ import type { Colors } from '../../types';
4
4
  export interface CWidgetStatsCProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
5
5
  /**
6
6
  * A string of all className you want applied to the base component.
@@ -1,5 +1,5 @@
1
1
  import React, { HTMLAttributes, ReactNode } from 'react';
2
- import { Colors } from '../Types';
2
+ import type { Colors } from '../../types';
3
3
  type Value = {
4
4
  title?: string | ReactNode;
5
5
  value?: number | string | ReactNode;
@@ -1,5 +1,5 @@
1
1
  import React, { HTMLAttributes, ReactNode } from 'react';
2
- import { Colors } from '../Types';
2
+ import type { Colors } from '../../types';
3
3
  export interface CWidgetStatsFProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
4
4
  /**
5
5
  * A string of all className you want applied to the base component.
@@ -0,0 +1,3 @@
1
+ import { useForkedRef } from './useForkedRef';
2
+ import { useStateWithCallback } from './useStateWithCallback';
3
+ export { useForkedRef, useStateWithCallback };
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export type AssignableRef<ValueType> = {
3
+ bivarianceHack(instance: ValueType | null): void;
4
+ }['bivarianceHack'] | React.MutableRefObject<ValueType | null>;
5
+ export declare function useForkedRef<RefValueType = any>(...refs: (AssignableRef<RefValueType> | null | undefined)[]): ((node: any) => void) | null;
6
+ export declare function assignRef<RefValueType = any>(ref: AssignableRef<RefValueType> | null | undefined, value: any): void;
7
+ export declare function isFunction(value: any): value is Function;
@@ -0,0 +1,2 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ export declare const useStateWithCallback: <S>(initialState: S, handler?: ((prevState: S) => void) | undefined, runHandler?: boolean) => [S, Dispatch<SetStateAction<S>>];