@coreui/react-pro 4.12.0-rc.0 → 5.0.0-alpha.0

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 (33) hide show
  1. package/README.md +1 -1
  2. package/dist/components/date-range-picker/CDateRangePicker copy.d.ts +114 -0
  3. package/dist/components/dropdown/CDropdown.d.ts +1 -1
  4. package/dist/components/multi-select/CMultiSelect.d.ts +2 -2
  5. package/dist/components/multi-select-new/CMultiSelect.d.ts +133 -0
  6. package/dist/components/multi-select-new/CMultiSelectNativeSelect.d.ts +7 -0
  7. package/dist/components/multi-select-new/CMultiSelectNew.d.ts +121 -0
  8. package/dist/components/multi-select-new/CMultiSelectOptions.d.ts +16 -0
  9. package/dist/components/multi-select-new/CMultiSelectSelection.d.ts +11 -0
  10. package/dist/components/multi-select-new/index.d.ts +2 -0
  11. package/dist/components/multi-select-new/types.d.ts +15 -0
  12. package/dist/components/multi-select-new/utils.d.ts +11 -0
  13. package/dist/components/picker/CPicker copy.d.ts +82 -0
  14. package/dist/components/picker copy/CPicker.d.ts +82 -0
  15. package/dist/components/popover/CPopover.d.ts +3 -3
  16. package/dist/components/smart-table/CSmartTableCleaner.d.ts +7 -0
  17. package/dist/components/tooltip/CTooltip.d.ts +3 -3
  18. package/dist/hooks/index.d.ts +2 -1
  19. package/dist/index.es.js +101 -39
  20. package/dist/index.es.js.map +1 -1
  21. package/dist/index.js +101 -38
  22. package/dist/index.js.map +1 -1
  23. package/package.json +12 -12
  24. package/src/components/date-range-picker/CDateRangePicker.tsx +18 -35
  25. package/src/components/dropdown/CDropdown.tsx +1 -1
  26. package/src/components/multi-select/CMultiSelect.tsx +17 -8
  27. package/src/components/multi-select/CMultiSelectSelection.tsx +1 -3
  28. package/src/components/picker/CPicker.tsx +2 -11
  29. package/src/components/popover/CPopover.tsx +3 -3
  30. package/src/components/time-picker/CTimePicker.tsx +15 -29
  31. package/src/components/tooltip/CTooltip.tsx +3 -3
  32. package/src/hooks/index.ts +2 -1
  33. package/src/utils/getRTLPlacement.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreui/react-pro",
3
- "version": "4.12.0-rc.0",
3
+ "version": "5.0.0-alpha.0",
4
4
  "description": "UI Components Library for React.js",
5
5
  "keywords": [
6
6
  "react",
@@ -40,31 +40,31 @@
40
40
  "@coreui/icons": "^3.0.1",
41
41
  "@coreui/icons-react": "^2.1.0",
42
42
  "@popperjs/core": "^2.11.8",
43
- "@rollup/plugin-commonjs": "^25.0.1",
43
+ "@rollup/plugin-commonjs": "^25.0.2",
44
44
  "@rollup/plugin-node-resolve": "^15.1.0",
45
- "@rollup/plugin-typescript": "^11.1.1",
45
+ "@rollup/plugin-typescript": "^11.1.2",
46
46
  "@testing-library/jest-dom": "^5.16.5",
47
47
  "@testing-library/react": "^14.0.0",
48
- "@types/react": "18.2.12",
49
- "@types/react-dom": "^18.2.5",
48
+ "@types/react": "18.2.14",
49
+ "@types/react-dom": "^18.2.6",
50
50
  "@types/react-transition-group": "^4.4.6",
51
51
  "classnames": "^2.3.2",
52
52
  "date-fns": "^2.30.0",
53
- "jest": "^29.5.0",
54
- "jest-environment-jsdom": "^29.5.0",
53
+ "jest": "^29.6.0",
54
+ "jest-environment-jsdom": "^29.6.0",
55
55
  "prop-types": "^15.8.1",
56
56
  "react": "^18.2.0",
57
57
  "react-device-detect": "^2.2.3",
58
58
  "react-dom": "^18.2.0",
59
59
  "react-popper": "^2.3.0",
60
60
  "react-transition-group": "^4.4.5",
61
- "rollup": "^3.25.1",
62
- "ts-jest": "^29.1.0",
63
- "tslib": "^2.5.3",
64
- "typescript": "^4.9.5"
61
+ "rollup": "^3.26.1",
62
+ "ts-jest": "^29.1.1",
63
+ "tslib": "^2.6.0",
64
+ "typescript": "^5.1.6"
65
65
  },
66
66
  "peerDependencies": {
67
- "@coreui/coreui-pro": ">=4.5.0",
67
+ "@coreui/coreui-pro": ">=5.0.0-alpha.0",
68
68
  "react": ">=17",
69
69
  "react-dom": ">=17"
70
70
  }
@@ -403,10 +403,10 @@ export const CDateRangePicker = forwardRef<HTMLDivElement | HTMLLIElement, CDate
403
403
  }
404
404
 
405
405
  const InputGroup = () => (
406
- <div className="input-group picker-input-group">
406
+ <div className="date-picker-input-group">
407
407
  <input
408
408
  autoComplete="off"
409
- className={classNames('form-control date-picker-input', {
409
+ className={classNames('date-picker-input', {
410
410
  hover: inputStartHoverValue,
411
411
  })}
412
412
  // delay={true}
@@ -425,15 +425,11 @@ export const CDateRangePicker = forwardRef<HTMLDivElement | HTMLLIElement, CDate
425
425
  onClick={() => setSelectEndDate(false)}
426
426
  ref={inputStartRef}
427
427
  />
428
- {range && separator !== false && (
429
- <span className="input-group-text">
430
- <span className="picker-input-group-icon date-picker-arrow-icon"></span>
431
- </span>
432
- )}
428
+ {range && separator !== false && <div className="date-picker-separator" />}
433
429
  {range && (
434
430
  <input
435
431
  autoComplete="off"
436
- className={classNames('form-control date-picker-input', {
432
+ className={classNames('date-picker-input', {
437
433
  hover: inputEndHoverValue,
438
434
  })}
439
435
  // delay={true}
@@ -453,32 +449,18 @@ export const CDateRangePicker = forwardRef<HTMLDivElement | HTMLLIElement, CDate
453
449
  ref={inputEndRef}
454
450
  />
455
451
  )}
456
- {(indicator || cleaner) && (
457
- <span className="input-group-text">
458
- {indicator && (
459
- <span className="picker-input-group-indicator">
460
- {typeof indicator === 'boolean' ? (
461
- <span className="picker-input-group-icon date-picker-input-icon" />
462
- ) : (
463
- indicator
464
- )}
465
- </span>
466
- )}
467
- {cleaner && (_startDate || _endDate) && (
468
- <span
469
- className="picker-input-group-cleaner"
470
- role="button"
471
- onClick={(event) => handleClear(event)}
472
- >
473
- {typeof cleaner === 'boolean' ? (
474
- <span className="picker-input-group-icon date-picker-cleaner-icon" />
475
- ) : (
476
- cleaner
477
- )}
478
- </span>
479
- )}
480
- </span>
481
- )}
452
+ {indicator &&
453
+ (typeof indicator === 'boolean' ? <div className="date-picker-indicator" /> : indicator)}
454
+ {cleaner &&
455
+ (_startDate || _endDate) &&
456
+ (typeof cleaner === 'boolean' ? (
457
+ <div className="date-picker-cleaner" onClick={(event) => handleClear(event)} />
458
+ ) : (
459
+ React.isValidElement(cleaner) &&
460
+ React.cloneElement(cleaner as React.ReactElement<any>, {
461
+ onClick: (event: React.MouseEvent<HTMLElement>) => handleClear(event),
462
+ })
463
+ ))}
482
464
  </div>
483
465
  )
484
466
 
@@ -507,9 +489,10 @@ export const CDateRangePicker = forwardRef<HTMLDivElement | HTMLLIElement, CDate
507
489
  className,
508
490
  )}
509
491
  disabled={disabled}
492
+ dropdownClassNames="date-picker-dropdown"
510
493
  footer={footer || timepicker}
511
494
  footerContent={
512
- <div className="picker-footer">
495
+ <div className="date-picker-footer">
513
496
  {todayButton && (
514
497
  <CButton
515
498
  className="me-auto"
@@ -66,7 +66,7 @@ export interface CDropdownProps extends HTMLAttributes<HTMLDivElement | HTMLLIEl
66
66
  /**
67
67
  * Callback fired when the component requests to be hidden.
68
68
  *
69
- * @since 4.9.0-beta.2
69
+ * @since 4.9.0
70
70
  */
71
71
  onHide?: () => void
72
72
  /**
@@ -102,13 +102,13 @@ export interface CMultiSelectProps
102
102
  /**
103
103
  * Custom template for options.
104
104
  *
105
- * @since 4.12.0-rc.0
105
+ * @since 4.12.0
106
106
  */
107
107
  optionsTemplate?: (option: Option) => ReactNode
108
108
  /**
109
109
  * Custom template for options groups.
110
110
  *
111
- * @since 4.12.0-rc.0
111
+ * @since 4.12.0
112
112
  */
113
113
  optionsGroupsTemplate?: (option: OptionsGroup) => ReactNode
114
114
  /**
@@ -451,9 +451,7 @@ export const CMultiSelect = forwardRef<HTMLDivElement, CMultiSelectProps>(
451
451
  className={classNames(
452
452
  'form-multi-select',
453
453
  {
454
- 'form-multi-select-with-cleaner': cleaner,
455
454
  [`form-multi-select-${size}`]: size,
456
- 'form-multi-select-selection-tags': multiple && selectionType === 'tags',
457
455
  disabled,
458
456
  'is-invalid': invalid,
459
457
  'is-valid': valid,
@@ -501,13 +499,24 @@ export const CMultiSelect = forwardRef<HTMLDivElement, CMultiSelectProps>(
501
499
  ></input>
502
500
  )}
503
501
  </CMultiSelectSelection>
504
- {!disabled && cleaner && selected.length > 0 && (
502
+ <div className="form-multi-select-buttons">
503
+ {!disabled && cleaner && selected.length > 0 && (
504
+ <button
505
+ type="button"
506
+ className="form-multi-select-cleaner"
507
+ onClick={() => handleDeselectAll()}
508
+ ></button>
509
+ )}
505
510
  <button
506
511
  type="button"
507
- className="form-multi-select-selection-cleaner"
508
- onClick={() => handleDeselectAll()}
512
+ className="form-multi-select-indicator"
513
+ onClick={(event) => {
514
+ event.preventDefault()
515
+ event.stopPropagation()
516
+ setVisible(!_visible)
517
+ }}
509
518
  ></button>
510
- )}
519
+ </div>
511
520
  </div>
512
521
  <div className="form-multi-select-dropdown" role="menu" ref={dropdownRef}>
513
522
  {multiple && selectAll && (
@@ -54,9 +54,7 @@ export const CMultiSelectSelection = forwardRef<HTMLSpanElement, CMultiSelectSel
54
54
  className="form-multi-select-tag-delete"
55
55
  aria-label="Close"
56
56
  onClick={() => onRemove && onRemove(option)}
57
- >
58
- <span aria-hidden="true">×</span>
59
- </button>
57
+ />
60
58
  )}
61
59
  </span>
62
60
  )
@@ -141,7 +141,7 @@ export const CPicker = forwardRef<HTMLDivElement | HTMLLIElement, CPickerProps>(
141
141
  default: {
142
142
  return (
143
143
  <div
144
- className={classNames('dropdown', 'picker', className, {
144
+ className={classNames(className, {
145
145
  show: _visible,
146
146
  })}
147
147
  onClick={() => !disabled && setVisible(true)}
@@ -152,16 +152,7 @@ export const CPicker = forwardRef<HTMLDivElement | HTMLLIElement, CPickerProps>(
152
152
  React.cloneElement(toggler as React.ReactElement<any>, {
153
153
  ref: togglerRef,
154
154
  })}
155
- <div
156
- className={classNames(
157
- 'dropdown-menu',
158
- {
159
- show: _visible,
160
- },
161
- dropdownClassNames,
162
- )}
163
- ref={dropdownRef}
164
- >
155
+ <div className={dropdownClassNames} ref={dropdownRef}>
165
156
  {children}
166
157
  {footer && footerContent}
167
158
  </div>
@@ -13,7 +13,7 @@ export interface CPopoverProps extends Omit<HTMLAttributes<HTMLDivElement>, 'tit
13
13
  /**
14
14
  * Apply a CSS fade transition to the popover.
15
15
  *
16
- * @since 4.9.0-beta.2
16
+ * @since 4.9.0
17
17
  */
18
18
  animation?: boolean
19
19
  /**
@@ -31,13 +31,13 @@ export interface CPopoverProps extends Omit<HTMLAttributes<HTMLDivElement>, 'tit
31
31
  /**
32
32
  * The delay for displaying and hiding the popover (in milliseconds). When a numerical value is provided, the delay applies to both the hide and show actions. The object structure for specifying the delay is as follows: delay: `{ 'show': 500, 'hide': 100 }`.
33
33
  *
34
- * @since 4.9.0-beta.2
34
+ * @since 4.9.0
35
35
  */
36
36
  delay?: number | { show: number; hide: number }
37
37
  /**
38
38
  * Specify the desired order of fallback placements by providing a list of placements as an array. The placements should be prioritized based on preference.
39
39
  *
40
- * @since 4.9.0-beta.2
40
+ * @since 4.9.0
41
41
  */
42
42
  fallbackPlacements?: Placements | Placements[]
43
43
  /**
@@ -272,10 +272,10 @@ export const CTimePicker = forwardRef<HTMLDivElement | HTMLLIElement, CTimePicke
272
272
  }
273
273
 
274
274
  const InputGroup = () => (
275
- <div className="input-group picker-input-group">
275
+ <div className="time-picker-input-group">
276
276
  <input
277
277
  autoComplete="off"
278
- className="form-control"
278
+ className="time-picker-input"
279
279
  // delay={true}
280
280
  disabled={disabled}
281
281
  onChange={(event) =>
@@ -286,32 +286,18 @@ export const CTimePicker = forwardRef<HTMLDivElement | HTMLLIElement, CTimePicke
286
286
  required={required}
287
287
  ref={inputRef}
288
288
  />
289
- {(indicator || cleaner) && (
290
- <span className="input-group-text">
291
- {indicator && (
292
- <span className="picker-input-group-indicator">
293
- {typeof indicator === 'boolean' ? (
294
- <span className="picker-input-group-icon time-picker-input-icon" />
295
- ) : (
296
- indicator
297
- )}
298
- </span>
299
- )}
300
- {cleaner && date && (
301
- <span
302
- className="picker-input-group-cleaner"
303
- role="button"
304
- onClick={(event) => handleClear(event)}
305
- >
306
- {typeof cleaner === 'boolean' ? (
307
- <span className="picker-input-group-icon time-picker-cleaner-icon" />
308
- ) : (
309
- cleaner
310
- )}
311
- </span>
312
- )}
313
- </span>
314
- )}
289
+ {indicator &&
290
+ (typeof indicator === 'boolean' ? <div className="time-picker-indicator" /> : indicator)}
291
+ {cleaner &&
292
+ date &&
293
+ (typeof cleaner === 'boolean' ? (
294
+ <div className="time-picker-cleaner" onClick={(event) => handleClear(event)} />
295
+ ) : (
296
+ React.isValidElement(cleaner) &&
297
+ React.cloneElement(cleaner as React.ReactElement<any>, {
298
+ onClick: (event: React.MouseEvent<HTMLElement>) => handleClear(event),
299
+ })
300
+ ))}
315
301
  </div>
316
302
  )
317
303
 
@@ -448,7 +434,7 @@ export const CTimePicker = forwardRef<HTMLDivElement | HTMLLIElement, CTimePicke
448
434
  dropdownClassNames="time-picker-dropdown"
449
435
  footer={footer}
450
436
  footerContent={
451
- <div className="picker-footer">
437
+ <div className="time-picker-footer">
452
438
  {cancelButton && (
453
439
  <CButton
454
440
  color={cancelButtonColor}
@@ -13,7 +13,7 @@ export interface CTooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'con
13
13
  /**
14
14
  * Apply a CSS fade transition to the tooltip.
15
15
  *
16
- * @since 4.9.0-beta.2
16
+ * @since 4.9.0
17
17
  */
18
18
  animation?: boolean
19
19
  /**
@@ -27,13 +27,13 @@ export interface CTooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'con
27
27
  /**
28
28
  * The delay for displaying and hiding the tooltip (in milliseconds). When a numerical value is provided, the delay applies to both the hide and show actions. The object structure for specifying the delay is as follows: delay: `{ 'show': 500, 'hide': 100 }`.
29
29
  *
30
- * @since 4.9.0-beta.2
30
+ * @since 4.9.0
31
31
  */
32
32
  delay?: number | { show: number; hide: number }
33
33
  /**
34
34
  * Specify the desired order of fallback placements by providing a list of placements as an array. The placements should be prioritized based on preference.
35
35
  *
36
- * @since 4.9.0-beta.2
36
+ * @since 4.9.0
37
37
  */
38
38
  fallbackPlacements?: Placements | Placements[]
39
39
  /**
@@ -1,5 +1,6 @@
1
+ import { useColorModes } from './useColorModes'
1
2
  import { useForkedRef } from './useForkedRef'
2
3
  import { usePopper } from './usePopper'
3
4
  import { useStateWithCallback } from './useStateWithCallback'
4
5
 
5
- export { useForkedRef, usePopper, useStateWithCallback }
6
+ export { useColorModes, useForkedRef, usePopper, useStateWithCallback }
@@ -1,5 +1,5 @@
1
1
  import { Placement } from '@popperjs/core'
2
- import { isRTL } from '../utils'
2
+ import isRTL from './isRTL'
3
3
 
4
4
  const getRTLPlacement = (placement: string, element: HTMLDivElement | null): Placement => {
5
5
  switch (placement) {