carbon-react 119.6.1 → 119.6.3

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 (107) hide show
  1. package/esm/__internal__/input/input-presentation.component.d.ts +3 -1
  2. package/esm/__internal__/input/input-presentation.component.js +3 -0
  3. package/esm/__internal__/input/input-presentation.style.d.ts +1 -1
  4. package/esm/__internal__/input/input-presentation.style.js +4 -2
  5. package/esm/__internal__/popover/popover.component.d.ts +4 -1
  6. package/esm/__internal__/sticky-footer/sticky-footer.component.js +2 -2
  7. package/esm/__spec_helper__/test-utils.js +1 -0
  8. package/esm/components/badge/badge.style.js +1 -1
  9. package/esm/components/date/__internal__/date-formats/index.d.ts +3 -6
  10. package/esm/components/date/__internal__/date-formats/index.js +3 -3
  11. package/esm/components/date/__internal__/date-picker/date-picker.component.d.ts +38 -0
  12. package/esm/components/date/__internal__/date-picker/date-picker.component.js +243 -34
  13. package/esm/components/date/__internal__/date-picker/day-picker.style.d.ts +2 -0
  14. package/esm/components/date/__internal__/date-picker/index.d.ts +2 -0
  15. package/esm/components/date/__internal__/navbar/button.style.d.ts +4 -0
  16. package/esm/components/date/__internal__/navbar/index.d.ts +2 -0
  17. package/esm/components/date/__internal__/navbar/navbar.component.d.ts +8 -0
  18. package/esm/components/date/__internal__/navbar/navbar.component.js +7 -9
  19. package/esm/components/date/__internal__/navbar/navbar.style.d.ts +2 -0
  20. package/esm/components/date/__internal__/utils.d.ts +14 -0
  21. package/esm/components/date/__internal__/utils.js +22 -18
  22. package/esm/components/date/__internal__/weekday/abbr.style.d.ts +2 -0
  23. package/esm/components/date/__internal__/weekday/index.d.ts +2 -0
  24. package/esm/components/date/__internal__/weekday/weekday.component.d.ts +8 -0
  25. package/esm/components/date/__internal__/weekday/weekday.component.js +1 -6
  26. package/esm/components/date/__internal__/weekday/weekday.style.d.ts +2 -0
  27. package/esm/components/date/date.component.d.ts +43 -0
  28. package/esm/components/date/date.component.js +781 -60
  29. package/esm/components/date/date.style.d.ts +6 -0
  30. package/esm/components/date/date.style.js +3 -8
  31. package/esm/components/date/index.d.ts +2 -2
  32. package/esm/components/date-range/date-range.component.d.ts +88 -0
  33. package/esm/components/date-range/date-range.component.js +22 -102
  34. package/esm/components/date-range/date-range.context.d.ts +22 -0
  35. package/esm/components/date-range/date-range.style.d.ts +6 -0
  36. package/esm/components/date-range/date-range.style.js +1 -1
  37. package/esm/components/date-range/index.d.ts +3 -3
  38. package/esm/components/form/form.style.js +14 -21
  39. package/esm/components/menu/menu-item/menu-item.style.js +1 -1
  40. package/esm/components/pill/pill.style.js +17 -21
  41. package/esm/components/portrait/portrait.config.js +1 -1
  42. package/esm/components/simple-color-picker/simple-color/simple-color.style.js +3 -3
  43. package/esm/components/textbox/textbox.component.js +1 -0
  44. package/esm/components/tooltip/tooltip.component.js +3 -1
  45. package/esm/hooks/__internal__/useFloating/useFloating.d.ts +4 -1
  46. package/esm/style/themes/medium/index.js +1 -0
  47. package/esm/style/themes/small/index.js +1 -0
  48. package/lib/__internal__/input/input-presentation.component.d.ts +3 -1
  49. package/lib/__internal__/input/input-presentation.component.js +3 -0
  50. package/lib/__internal__/input/input-presentation.style.d.ts +1 -1
  51. package/lib/__internal__/input/input-presentation.style.js +4 -2
  52. package/lib/__internal__/popover/popover.component.d.ts +4 -1
  53. package/lib/__internal__/sticky-footer/sticky-footer.component.js +1 -1
  54. package/lib/__spec_helper__/test-utils.js +1 -0
  55. package/lib/components/badge/badge.style.js +1 -1
  56. package/lib/components/date/__internal__/date-formats/index.d.ts +3 -6
  57. package/lib/components/date/__internal__/date-formats/index.js +3 -3
  58. package/lib/components/date/__internal__/date-picker/date-picker.component.d.ts +38 -0
  59. package/lib/components/date/__internal__/date-picker/date-picker.component.js +243 -35
  60. package/lib/components/date/__internal__/date-picker/day-picker.style.d.ts +2 -0
  61. package/lib/components/date/__internal__/date-picker/index.d.ts +2 -0
  62. package/lib/components/date/__internal__/navbar/button.style.d.ts +4 -0
  63. package/lib/components/date/__internal__/navbar/index.d.ts +2 -0
  64. package/lib/components/date/__internal__/navbar/navbar.component.d.ts +8 -0
  65. package/lib/components/date/__internal__/navbar/navbar.component.js +8 -9
  66. package/lib/components/date/__internal__/navbar/navbar.style.d.ts +2 -0
  67. package/lib/components/date/__internal__/utils.d.ts +14 -0
  68. package/lib/components/date/__internal__/utils.js +22 -18
  69. package/lib/components/date/__internal__/weekday/abbr.style.d.ts +2 -0
  70. package/lib/components/date/__internal__/weekday/index.d.ts +2 -0
  71. package/lib/components/date/__internal__/weekday/weekday.component.d.ts +8 -0
  72. package/lib/components/date/__internal__/weekday/weekday.component.js +2 -6
  73. package/lib/components/date/__internal__/weekday/weekday.style.d.ts +2 -0
  74. package/lib/components/date/date.component.d.ts +43 -0
  75. package/lib/components/date/date.component.js +781 -60
  76. package/lib/components/date/date.style.d.ts +6 -0
  77. package/lib/components/date/date.style.js +3 -8
  78. package/lib/components/date/index.d.ts +2 -2
  79. package/lib/components/date-range/date-range.component.d.ts +88 -0
  80. package/lib/components/date-range/date-range.component.js +23 -102
  81. package/lib/components/date-range/date-range.context.d.ts +22 -0
  82. package/lib/components/date-range/date-range.style.d.ts +6 -0
  83. package/lib/components/date-range/date-range.style.js +1 -1
  84. package/lib/components/date-range/index.d.ts +3 -3
  85. package/lib/components/form/form.style.js +14 -21
  86. package/lib/components/menu/menu-item/menu-item.style.js +1 -1
  87. package/lib/components/pill/pill.style.js +17 -21
  88. package/lib/components/portrait/portrait.config.js +1 -1
  89. package/lib/components/simple-color-picker/simple-color/simple-color.style.js +3 -3
  90. package/lib/components/textbox/textbox.component.js +1 -0
  91. package/lib/components/tooltip/tooltip.component.js +3 -1
  92. package/lib/hooks/__internal__/useFloating/useFloating.d.ts +4 -1
  93. package/lib/style/themes/medium/index.js +1 -0
  94. package/lib/style/themes/small/index.js +1 -0
  95. package/package.json +1 -1
  96. package/esm/components/date/__internal__/date-picker/date-picker.d.ts +0 -27
  97. package/esm/components/date/__internal__/navbar/navbar.d.ts +0 -8
  98. package/esm/components/date/__internal__/weekday/weekday.d.ts +0 -13
  99. package/esm/components/date/date.d.ts +0 -52
  100. package/esm/components/date-range/date-range-context.d.ts +0 -17
  101. package/esm/components/date-range/date-range.d.ts +0 -92
  102. package/lib/components/date/__internal__/date-picker/date-picker.d.ts +0 -27
  103. package/lib/components/date/__internal__/navbar/navbar.d.ts +0 -8
  104. package/lib/components/date/__internal__/weekday/weekday.d.ts +0 -13
  105. package/lib/components/date/date.d.ts +0 -52
  106. package/lib/components/date-range/date-range-context.d.ts +0 -17
  107. package/lib/components/date-range/date-range.d.ts +0 -92
@@ -1,8 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { Strategy, Middleware, Placement } from "@floating-ui/dom";
3
+ declare type CustomRefObject<T> = {
4
+ current?: T | null;
5
+ };
3
6
  export interface UseFloatingProps {
4
7
  isOpen?: boolean;
5
- reference: React.RefObject<HTMLElement | null>;
8
+ reference: CustomRefObject<HTMLElement | null>;
6
9
  floating: React.RefObject<HTMLElement | null>;
7
10
  strategy?: Strategy;
8
11
  middleware?: Middleware[];
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _ = require("..");
8
+ /* eslint-disable no-console */
8
9
  var _default = (() => {
9
10
  console.warn(`"Medium Theme" has been renamed to "Aegean".
10
11
  All references to that theme should be updated to:
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _ = require("..");
8
+ /* eslint-disable no-console */
8
9
  var _default = (() => {
9
10
  console.warn(`"Small Theme" has been renamed to "Mint".
10
11
  All references to that theme should be updated to:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "119.6.1",
3
+ "version": "119.6.3",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",
@@ -1,27 +0,0 @@
1
- import * as React from "react";
2
- import { DayPickerProps } from "react-day-picker";
3
-
4
- export interface DatePickerProps extends Pick<DayPickerProps, "onDayClick"> {
5
- /** Boolean to toggle where DatePicker is rendered in relation to the Date Input */
6
- disablePortal?: boolean;
7
- /** Minimum possible date YYYY-MM-DD */
8
- minDate?: string;
9
- /** Maximum possible date YYYY-MM-DD */
10
- maxDate?: string;
11
- /** Pass any props that match the DayPickerProps interface to override default behaviors */
12
- pickerProps?: DayPickerProps;
13
- /** Element that the DatePicker will be displayed under */
14
- inputElement: React.RefObject<HTMLElement>;
15
- /** Currently selected date */
16
- selectedDays?: Date;
17
- /** Callback to handle mousedown event on picker container */
18
- pickerMouseDown?: () => void;
19
- /** Sets whether the picker should be displayed */
20
- open?: boolean;
21
- }
22
-
23
- declare function DatePicker(
24
- props: DatePickerProps & React.RefAttributes<HTMLElement>
25
- ): JSX.Element;
26
-
27
- export default DatePicker;
@@ -1,8 +0,0 @@
1
- export interface NavbarProps {
2
- onPreviousClick?: () => void;
3
- onNextClick?: () => void;
4
- }
5
-
6
- declare function Navbar(props: NavbarProps): JSX.Element;
7
-
8
- export default Navbar;
@@ -1,13 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface WeekdayProps {
4
- className?: string;
5
- title?: string;
6
- children?: React.ReactNode;
7
- }
8
-
9
- declare function Weekday(
10
- props: WeekdayProps & React.RefAttributes<HTMLElement>
11
- ): JSX.Element;
12
-
13
- export default Weekday;
@@ -1,52 +0,0 @@
1
- import { DayPickerProps } from "react-day-picker";
2
- import { TextboxProps } from "../textbox";
3
-
4
- export interface DateChangeEvent {
5
- target: {
6
- value: {
7
- formattedValue: string;
8
- rawValue: string;
9
- };
10
- };
11
- }
12
-
13
- export interface DateInputProps
14
- extends Omit<
15
- TextboxProps,
16
- | "value"
17
- | "formattedValue"
18
- | "rawValue"
19
- | "onChange"
20
- | "onMouseDown"
21
- | "onChangeDeferred"
22
- | "deferTimeout"
23
- | "children"
24
- | "leftChildren"
25
- | "placeholder"
26
- | "iconOnClick"
27
- | "iconOnMouseDown"
28
- | "enforceCharacterLimit"
29
- | "characterLimit"
30
- | "iconTabIndex"
31
- > {
32
- /** Boolean to allow the input to have an empty value */
33
- allowEmptyValue?: boolean;
34
- /** Boolean to toggle where DatePicker is rendered in relation to the Date Input */
35
- disablePortal?: boolean;
36
- /** Minimum possible date YYYY-MM-DD */
37
- minDate?: string;
38
- /** Maximum possible date YYYY-MM-DD */
39
- maxDate?: string;
40
- /** Specify a callback triggered on change */
41
- onChange: (ev: DateChangeEvent) => void;
42
- /** The current date string */
43
- value: string;
44
- /** Pass any props that match the DayPickerProps interface to override default behaviors */
45
- pickerProps?: DayPickerProps;
46
- }
47
-
48
- declare function DateInput(
49
- props: SimpleSelectProps & React.RefAttributes<HTMLInputElement>
50
- ): JSX.Element;
51
-
52
- export default DateInput;
@@ -1,17 +0,0 @@
1
- import * as React from "react";
2
-
3
- interface DateInputRefMap {
4
- isBlurBlocked: { current: boolean };
5
- setOpen: null | ((open: boolean) => void);
6
- }
7
-
8
- export interface DateRangeContextProps {
9
- inputRefMap: {
10
- start: DateInputRefMap;
11
- end: DateInputRefMap;
12
- };
13
- setInputRefMap: (newState: DateInputRefMap) => void;
14
- }
15
-
16
- declare const DateRangeContext: React.Context<DateRangeContextProps>;
17
- export default DateRangeContext;
@@ -1,92 +0,0 @@
1
- import * as React from "react";
2
- import { MarginProps } from "styled-system";
3
- import { DateInputProps } from "../date/date";
4
-
5
- export interface DateRangeChangeEvent {
6
- target: {
7
- value: [
8
- {
9
- formattedValue: string;
10
- rawValue: string;
11
- },
12
- {
13
- formattedValue: string;
14
- rawValue: string;
15
- }
16
- ];
17
- };
18
- }
19
-
20
- export interface DateRangeProps extends MarginProps {
21
- /** Props for the child end Date component */
22
- endDateProps?: Partial<DateInputProps>;
23
- /** Optional label for endDate field */
24
- endLabel?: string;
25
- /**
26
- * Indicate that error has occurred on end date
27
- * Pass string to display icon, tooltip and red border
28
- * Pass true boolean to only display red border
29
- */
30
- endError?: boolean | string;
31
- /**
32
- * Indicate additional information for end date
33
- * Pass string to display icon, tooltip and blue border
34
- * Pass true boolean to only display blue border
35
- */
36
- endInfo?: boolean | string;
37
- /**
38
- * Indicate that warning has occurred on end date
39
- * Pass string to display icon, tooltip and orange border
40
- * Pass true boolean to only display orange border
41
- */
42
- endWarning?: boolean | string;
43
- /**
44
- * A React ref to pass to the second of the two Date Input fields
45
- */
46
- endRef?: React.ForwardedRef<HTMLInputElement>;
47
- /** An optional string prop to provide an id to the component */
48
- id?: string;
49
- /** Display labels inline */
50
- labelsInline?: boolean;
51
- /** An optional string prop to provide a name to the component */
52
- name?: string;
53
- /** Specify a callback triggered on change */
54
- onChange: (ev: DateRangeChangeEvent) => void;
55
- /** Specify a callback triggered on blur */
56
- onBlur?: (ev: DateRangeChangeEvent) => void;
57
- /** Props for the child start Date component */
58
- startDateProps?: Partial<DateInputProps>;
59
- /** Optional label for startDate field */
60
- startLabel?: string;
61
- /**
62
- * Indicate that error has occurred on start date
63
- * Pass string to display icon, tooltip and red border
64
- * Pass true boolean to only display red border
65
- */
66
- startError?: boolean | string;
67
- /**
68
- * Indicate that warning has occurred on start date
69
- * Pass string to display icon, tooltip and orange border
70
- * Pass true boolean to only display orange border
71
- */
72
- startWarning?: boolean | string;
73
- /** Indicate additional information for start date
74
- * Pass string to display icon, tooltip and blue border
75
- * Pass true boolean to only display blue border
76
- */
77
- startInfo?: boolean | string;
78
- /**
79
- * A React ref to pass to the first of the two Date Input fields
80
- */
81
- startRef?: React.ForwardedRef<HTMLInputElement>;
82
- /** An array containing the value of startDate and endDate */
83
- value: string[];
84
- /** When true, validation icons will be placed on labels instead of being placed on the inputs */
85
- validationOnLabel?: boolean;
86
- /** Overrides the default tooltip position */
87
- tooltipPosition?: "top" | "bottom" | "left" | "right";
88
- }
89
-
90
- declare function DateRange(props: DateRangeProps): JSX.Element;
91
-
92
- export default DateRange;
@@ -1,27 +0,0 @@
1
- import * as React from "react";
2
- import { DayPickerProps } from "react-day-picker";
3
-
4
- export interface DatePickerProps extends Pick<DayPickerProps, "onDayClick"> {
5
- /** Boolean to toggle where DatePicker is rendered in relation to the Date Input */
6
- disablePortal?: boolean;
7
- /** Minimum possible date YYYY-MM-DD */
8
- minDate?: string;
9
- /** Maximum possible date YYYY-MM-DD */
10
- maxDate?: string;
11
- /** Pass any props that match the DayPickerProps interface to override default behaviors */
12
- pickerProps?: DayPickerProps;
13
- /** Element that the DatePicker will be displayed under */
14
- inputElement: React.RefObject<HTMLElement>;
15
- /** Currently selected date */
16
- selectedDays?: Date;
17
- /** Callback to handle mousedown event on picker container */
18
- pickerMouseDown?: () => void;
19
- /** Sets whether the picker should be displayed */
20
- open?: boolean;
21
- }
22
-
23
- declare function DatePicker(
24
- props: DatePickerProps & React.RefAttributes<HTMLElement>
25
- ): JSX.Element;
26
-
27
- export default DatePicker;
@@ -1,8 +0,0 @@
1
- export interface NavbarProps {
2
- onPreviousClick?: () => void;
3
- onNextClick?: () => void;
4
- }
5
-
6
- declare function Navbar(props: NavbarProps): JSX.Element;
7
-
8
- export default Navbar;
@@ -1,13 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface WeekdayProps {
4
- className?: string;
5
- title?: string;
6
- children?: React.ReactNode;
7
- }
8
-
9
- declare function Weekday(
10
- props: WeekdayProps & React.RefAttributes<HTMLElement>
11
- ): JSX.Element;
12
-
13
- export default Weekday;
@@ -1,52 +0,0 @@
1
- import { DayPickerProps } from "react-day-picker";
2
- import { TextboxProps } from "../textbox";
3
-
4
- export interface DateChangeEvent {
5
- target: {
6
- value: {
7
- formattedValue: string;
8
- rawValue: string;
9
- };
10
- };
11
- }
12
-
13
- export interface DateInputProps
14
- extends Omit<
15
- TextboxProps,
16
- | "value"
17
- | "formattedValue"
18
- | "rawValue"
19
- | "onChange"
20
- | "onMouseDown"
21
- | "onChangeDeferred"
22
- | "deferTimeout"
23
- | "children"
24
- | "leftChildren"
25
- | "placeholder"
26
- | "iconOnClick"
27
- | "iconOnMouseDown"
28
- | "enforceCharacterLimit"
29
- | "characterLimit"
30
- | "iconTabIndex"
31
- > {
32
- /** Boolean to allow the input to have an empty value */
33
- allowEmptyValue?: boolean;
34
- /** Boolean to toggle where DatePicker is rendered in relation to the Date Input */
35
- disablePortal?: boolean;
36
- /** Minimum possible date YYYY-MM-DD */
37
- minDate?: string;
38
- /** Maximum possible date YYYY-MM-DD */
39
- maxDate?: string;
40
- /** Specify a callback triggered on change */
41
- onChange: (ev: DateChangeEvent) => void;
42
- /** The current date string */
43
- value: string;
44
- /** Pass any props that match the DayPickerProps interface to override default behaviors */
45
- pickerProps?: DayPickerProps;
46
- }
47
-
48
- declare function DateInput(
49
- props: SimpleSelectProps & React.RefAttributes<HTMLInputElement>
50
- ): JSX.Element;
51
-
52
- export default DateInput;
@@ -1,17 +0,0 @@
1
- import * as React from "react";
2
-
3
- interface DateInputRefMap {
4
- isBlurBlocked: { current: boolean };
5
- setOpen: null | ((open: boolean) => void);
6
- }
7
-
8
- export interface DateRangeContextProps {
9
- inputRefMap: {
10
- start: DateInputRefMap;
11
- end: DateInputRefMap;
12
- };
13
- setInputRefMap: (newState: DateInputRefMap) => void;
14
- }
15
-
16
- declare const DateRangeContext: React.Context<DateRangeContextProps>;
17
- export default DateRangeContext;
@@ -1,92 +0,0 @@
1
- import * as React from "react";
2
- import { MarginProps } from "styled-system";
3
- import { DateInputProps } from "../date/date";
4
-
5
- export interface DateRangeChangeEvent {
6
- target: {
7
- value: [
8
- {
9
- formattedValue: string;
10
- rawValue: string;
11
- },
12
- {
13
- formattedValue: string;
14
- rawValue: string;
15
- }
16
- ];
17
- };
18
- }
19
-
20
- export interface DateRangeProps extends MarginProps {
21
- /** Props for the child end Date component */
22
- endDateProps?: Partial<DateInputProps>;
23
- /** Optional label for endDate field */
24
- endLabel?: string;
25
- /**
26
- * Indicate that error has occurred on end date
27
- * Pass string to display icon, tooltip and red border
28
- * Pass true boolean to only display red border
29
- */
30
- endError?: boolean | string;
31
- /**
32
- * Indicate additional information for end date
33
- * Pass string to display icon, tooltip and blue border
34
- * Pass true boolean to only display blue border
35
- */
36
- endInfo?: boolean | string;
37
- /**
38
- * Indicate that warning has occurred on end date
39
- * Pass string to display icon, tooltip and orange border
40
- * Pass true boolean to only display orange border
41
- */
42
- endWarning?: boolean | string;
43
- /**
44
- * A React ref to pass to the second of the two Date Input fields
45
- */
46
- endRef?: React.ForwardedRef<HTMLInputElement>;
47
- /** An optional string prop to provide an id to the component */
48
- id?: string;
49
- /** Display labels inline */
50
- labelsInline?: boolean;
51
- /** An optional string prop to provide a name to the component */
52
- name?: string;
53
- /** Specify a callback triggered on change */
54
- onChange: (ev: DateRangeChangeEvent) => void;
55
- /** Specify a callback triggered on blur */
56
- onBlur?: (ev: DateRangeChangeEvent) => void;
57
- /** Props for the child start Date component */
58
- startDateProps?: Partial<DateInputProps>;
59
- /** Optional label for startDate field */
60
- startLabel?: string;
61
- /**
62
- * Indicate that error has occurred on start date
63
- * Pass string to display icon, tooltip and red border
64
- * Pass true boolean to only display red border
65
- */
66
- startError?: boolean | string;
67
- /**
68
- * Indicate that warning has occurred on start date
69
- * Pass string to display icon, tooltip and orange border
70
- * Pass true boolean to only display orange border
71
- */
72
- startWarning?: boolean | string;
73
- /** Indicate additional information for start date
74
- * Pass string to display icon, tooltip and blue border
75
- * Pass true boolean to only display blue border
76
- */
77
- startInfo?: boolean | string;
78
- /**
79
- * A React ref to pass to the first of the two Date Input fields
80
- */
81
- startRef?: React.ForwardedRef<HTMLInputElement>;
82
- /** An array containing the value of startDate and endDate */
83
- value: string[];
84
- /** When true, validation icons will be placed on labels instead of being placed on the inputs */
85
- validationOnLabel?: boolean;
86
- /** Overrides the default tooltip position */
87
- tooltipPosition?: "top" | "bottom" | "left" | "right";
88
- }
89
-
90
- declare function DateRange(props: DateRangeProps): JSX.Element;
91
-
92
- export default DateRange;