@bloomreach/react-banana-ui 1.32.1 → 1.33.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 (109) hide show
  1. package/README.md +229 -50
  2. package/dist/bloomreach-react-banana-ui.es.js +12415 -11640
  3. package/dist/bloomreach-react-banana-ui.es.js.map +1 -1
  4. package/dist/bloomreach-react-banana-ui.umd.js +18 -43
  5. package/dist/bloomreach-react-banana-ui.umd.js.map +1 -1
  6. package/dist/components/data-display/actions-container/actions-container.types.d.ts +2 -2
  7. package/dist/components/data-display/badge/badge.types.d.ts +2 -2
  8. package/dist/components/data-display/description/description.types.d.ts +2 -2
  9. package/dist/components/data-display/header/header.types.d.ts +2 -2
  10. package/dist/components/data-display/index.d.ts +1 -11
  11. package/dist/components/data-display/internal.d.ts +1 -1
  12. package/dist/components/data-display/table/index.d.ts +8 -2
  13. package/dist/components/data-display/table/table/index.d.ts +2 -0
  14. package/dist/components/data-display/tags/index.d.ts +4 -0
  15. package/dist/components/data-display/{tag → tags/tag}/tag.types.d.ts +2 -2
  16. package/dist/components/data-display/{tag-group → tags/tag-group}/tag-group.types.d.ts +2 -2
  17. package/dist/components/date/date-range-quick-selections/date-range-quick-selections.d.ts +9 -0
  18. package/dist/components/date/date-range-quick-selections/date-range-quick-selections.types.d.ts +25 -0
  19. package/dist/components/date/date-range-quick-selections/index.d.ts +2 -0
  20. package/dist/components/date/date-time-picker/date-time-picker.stories.d.ts +6 -0
  21. package/dist/components/date/date-time-picker/date-time-picker.types.d.ts +23 -1
  22. package/dist/components/date/date-time-range-picker/date-time-range-picker.stories.d.ts +11 -0
  23. package/dist/components/date/date-time-range-picker/date-time-range-picker.types.d.ts +86 -1
  24. package/dist/components/date/date-time-range-picker/index.d.ts +1 -0
  25. package/dist/components/dropdowns/menu/menu.stories.d.ts +9 -1
  26. package/dist/components/inputs/autocomplete/autocomplete.types.d.ts +8 -1
  27. package/dist/components/inputs/autocomplete-field/autocomplete-field.d.ts +26 -0
  28. package/dist/components/inputs/autocomplete-field/autocomplete-field.qa.stories.d.ts +34 -0
  29. package/dist/components/inputs/autocomplete-field/autocomplete-field.stories.d.ts +43 -0
  30. package/dist/components/inputs/autocomplete-field/autocomplete-field.types.d.ts +34 -0
  31. package/dist/components/inputs/autocomplete-field/index.d.ts +2 -0
  32. package/dist/components/inputs/base-field/base-field.types.d.ts +4 -0
  33. package/dist/components/inputs/index.d.ts +1 -0
  34. package/dist/components/inputs/input-field/input-field.stories.d.ts +1 -0
  35. package/dist/components/inputs/internal.d.ts +1 -0
  36. package/dist/components/inputs/select-field/select-field.stories.d.ts +1 -0
  37. package/dist/components/inputs/text-field/text-field.stories.d.ts +1 -0
  38. package/dist/components/lists/listbox-item/listbox-item.types.d.ts +9 -1
  39. package/dist/components/lists/listbox-separator/index.d.ts +2 -0
  40. package/dist/components/lists/listbox-separator/listbox-separator.d.ts +24 -0
  41. package/dist/components/lists/listbox-separator/listbox-separator.types.d.ts +6 -0
  42. package/dist/components/popovers/tooltip/tooltip.qa.stories.d.ts +8 -2
  43. package/dist/components/popovers/tooltip/tooltip.stories.d.ts +43 -13
  44. package/dist/components/popovers/tooltip/tooltip.types.d.ts +6 -0
  45. package/dist/react-banana-ui.css +1 -1
  46. package/dist/utils/date/date-utils.d.ts +3 -1
  47. package/dist/utils/date-range-presets.d.ts +144 -0
  48. package/dist/utils/hooks/index.d.ts +1 -0
  49. package/dist/utils/hooks/use-sync-max-height.d.ts +8 -0
  50. package/dist/utils/index.d.ts +2 -0
  51. package/dist/utils/use-id.d.ts +39 -0
  52. package/package.json +42 -42
  53. package/dist/components/dropdowns/menu/menu/menu.stories.d.ts +0 -6
  54. package/dist/components/dropdowns/menu/menu-button/menu-button.stories.d.ts +0 -6
  55. package/dist/components/dropdowns/menu/menu-content/menu-content.stories.d.ts +0 -10
  56. package/dist/components/dropdowns/menu/menu-group/menu-group.stories.d.ts +0 -6
  57. package/dist/components/dropdowns/menu/menu-group-label/menu-group-label.stories.d.ts +0 -6
  58. package/dist/components/dropdowns/menu/menu-item/menu-item.stories.d.ts +0 -6
  59. package/dist/components/dropdowns/menu/menu-separator/menu-separator.stories.d.ts +0 -6
  60. package/dist/components/inputs/base-field/generate-field-id.d.ts +0 -4
  61. /package/dist/components/data-display/table/{table-context.d.ts → table/table-context.d.ts} +0 -0
  62. /package/dist/components/data-display/table/{table-section-context.d.ts → table/table-section-context.d.ts} +0 -0
  63. /package/dist/components/data-display/table/{table.d.ts → table/table.d.ts} +0 -0
  64. /package/dist/components/data-display/table/{table.qa.stories.d.ts → table/table.qa.stories.d.ts} +0 -0
  65. /package/dist/components/data-display/table/{table.stories.d.ts → table/table.stories.d.ts} +0 -0
  66. /package/dist/components/data-display/table/{table.types.d.ts → table/table.types.d.ts} +0 -0
  67. /package/dist/components/data-display/{table-body → table/table-body}/index.d.ts +0 -0
  68. /package/dist/components/data-display/{table-body → table/table-body}/table-body.d.ts +0 -0
  69. /package/dist/components/data-display/{table-body → table/table-body}/table-body.types.d.ts +0 -0
  70. /package/dist/components/data-display/{table-cell → table/table-cell}/index.d.ts +0 -0
  71. /package/dist/components/data-display/{table-cell → table/table-cell}/table-cell.d.ts +0 -0
  72. /package/dist/components/data-display/{table-cell → table/table-cell}/table-cell.types.d.ts +0 -0
  73. /package/dist/components/data-display/{table-cell-action → table/table-cell-action}/index.d.ts +0 -0
  74. /package/dist/components/data-display/{table-cell-action → table/table-cell-action}/table-cell-action.d.ts +0 -0
  75. /package/dist/components/data-display/{table-cell-action → table/table-cell-action}/table-cell-action.types.d.ts +0 -0
  76. /package/dist/components/data-display/{table-foot → table/table-foot}/index.d.ts +0 -0
  77. /package/dist/components/data-display/{table-foot → table/table-foot}/table-foot.d.ts +0 -0
  78. /package/dist/components/data-display/{table-foot → table/table-foot}/table-foot.types.d.ts +0 -0
  79. /package/dist/components/data-display/{table-head → table/table-head}/index.d.ts +0 -0
  80. /package/dist/components/data-display/{table-head → table/table-head}/table-head.d.ts +0 -0
  81. /package/dist/components/data-display/{table-head → table/table-head}/table-head.types.d.ts +0 -0
  82. /package/dist/components/data-display/{table-row → table/table-row}/index.d.ts +0 -0
  83. /package/dist/components/data-display/{table-row → table/table-row}/table-row-context.d.ts +0 -0
  84. /package/dist/components/data-display/{table-row → table/table-row}/table-row.d.ts +0 -0
  85. /package/dist/components/data-display/{table-row → table/table-row}/table-row.types.d.ts +0 -0
  86. /package/dist/components/data-display/{table-sort-label → table/table-sort-label}/index.d.ts +0 -0
  87. /package/dist/components/data-display/{table-sort-label → table/table-sort-label}/table-sort-label.d.ts +0 -0
  88. /package/dist/components/data-display/{table-sort-label → table/table-sort-label}/table-sort-label.types.d.ts +0 -0
  89. /package/dist/components/data-display/{asset-tag → tags/asset-tag}/asset-tag.d.ts +0 -0
  90. /package/dist/components/data-display/{asset-tag → tags/asset-tag}/asset-tag.qa.stories.d.ts +0 -0
  91. /package/dist/components/data-display/{asset-tag → tags/asset-tag}/asset-tag.stories.d.ts +0 -0
  92. /package/dist/components/data-display/{asset-tag → tags/asset-tag}/asset-tag.types.d.ts +0 -0
  93. /package/dist/components/data-display/{asset-tag → tags/asset-tag}/index.d.ts +0 -0
  94. /package/dist/components/data-display/{filter-tag → tags/filter-tag}/filter-tag.d.ts +0 -0
  95. /package/dist/components/data-display/{filter-tag → tags/filter-tag}/filter-tag.qa.stories.d.ts +0 -0
  96. /package/dist/components/data-display/{filter-tag → tags/filter-tag}/filter-tag.stories.d.ts +0 -0
  97. /package/dist/components/data-display/{filter-tag → tags/filter-tag}/filter-tag.types.d.ts +0 -0
  98. /package/dist/components/data-display/{filter-tag → tags/filter-tag}/index.d.ts +0 -0
  99. /package/dist/components/data-display/{input-tag → tags/input-tag}/index.d.ts +0 -0
  100. /package/dist/components/data-display/{input-tag → tags/input-tag}/input-tag.d.ts +0 -0
  101. /package/dist/components/data-display/{input-tag → tags/input-tag}/input-tag.qa.stories.d.ts +0 -0
  102. /package/dist/components/data-display/{input-tag → tags/input-tag}/input-tag.stories.d.ts +0 -0
  103. /package/dist/components/data-display/{input-tag → tags/input-tag}/input-tag.types.d.ts +0 -0
  104. /package/dist/components/data-display/{tag → tags/tag}/index.d.ts +0 -0
  105. /package/dist/components/data-display/{tag → tags/tag}/tag.d.ts +0 -0
  106. /package/dist/components/data-display/{tag-group → tags/tag-group}/index.d.ts +0 -0
  107. /package/dist/components/data-display/{tag-group → tags/tag-group}/tag-group.d.ts +0 -0
  108. /package/dist/components/data-display/{tag-group → tags/tag-group}/tag-group.qa.stories.d.ts +0 -0
  109. /package/dist/components/data-display/{tag-group → tags/tag-group}/tag-group.stories.d.ts +0 -0
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
- export interface ActionsContainerProps {
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ export interface ActionsContainerProps extends HTMLAttributes<HTMLDivElement> {
3
3
  /**
4
4
  * The content of the component.
5
5
  */
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
- export interface BadgeProps {
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ export interface BadgeProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content'> {
3
3
  /**
4
4
  * The badge will be added as a notification relative to this node.
5
5
  */
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
- export interface DescriptionProps {
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ export interface DescriptionProps extends HTMLAttributes<HTMLDivElement> {
3
3
  /**
4
4
  * The content of the component.
5
5
  */
@@ -1,5 +1,5 @@
1
- import { MouseEventHandler, ReactNode } from 'react';
2
- export interface HeaderProps {
1
+ import { HTMLAttributes, MouseEventHandler, ReactNode } from 'react';
2
+ export interface HeaderProps extends HTMLAttributes<HTMLDivElement> {
3
3
  /**
4
4
  * The title of the component.
5
5
  */
@@ -1,18 +1,8 @@
1
1
  export * from './actions-container';
2
- export * from './asset-tag';
3
2
  export * from './badge';
4
3
  export * from './description';
5
- export * from './filter-tag';
6
4
  export * from './header';
7
- export * from './input-tag';
8
5
  export * from './table';
9
- export * from './table-body';
10
- export * from './table-cell';
11
- export * from './table-cell-action';
12
- export * from './table-foot';
13
- export * from './table-head';
14
- export * from './table-row';
15
- export * from './table-sort-label';
16
- export * from './tag-group';
6
+ export * from './tags';
17
7
  export * from './trend-marker';
18
8
  export * from './typography';
@@ -1 +1 @@
1
- export * from './tag';
1
+ export * from './tags/tag';
@@ -1,2 +1,8 @@
1
- export { default as Table } from './table';
2
- export type { TableProps } from './table.types';
1
+ export * from './table';
2
+ export * from './table-body';
3
+ export * from './table-cell';
4
+ export * from './table-cell-action';
5
+ export * from './table-foot';
6
+ export * from './table-head';
7
+ export * from './table-row';
8
+ export * from './table-sort-label';
@@ -0,0 +1,2 @@
1
+ export { default as Table } from './table';
2
+ export type { TableProps } from './table.types';
@@ -0,0 +1,4 @@
1
+ export * from './asset-tag';
2
+ export * from './filter-tag';
3
+ export * from './input-tag';
4
+ export * from './tag-group';
@@ -1,5 +1,5 @@
1
- import { KeyboardEvent, MouseEvent, ReactElement, ReactNode } from 'react';
2
- export interface TagProps {
1
+ import { HTMLAttributes, KeyboardEvent, MouseEvent, ReactElement, ReactNode } from 'react';
2
+ export interface TagProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> {
3
3
  /**
4
4
  * If `true`, the tag has borders.
5
5
  * @default false
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
- export interface TagGroupProps {
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ export interface TagGroupProps extends HTMLAttributes<HTMLDivElement> {
3
3
  /**
4
4
  * The content of the component.
5
5
  */
@@ -0,0 +1,9 @@
1
+ import { DateRangeQuickSelectionsProps } from './date-range-quick-selections.types';
2
+ /**
3
+ * DateRangeQuickSelections displays a list of preset date range options
4
+ * for quick selection in a date range picker.
5
+ *
6
+ * @internal
7
+ */
8
+ declare const DateRangeQuickSelections: import('react').ForwardRefExoticComponent<DateRangeQuickSelectionsProps & import('react').RefAttributes<HTMLUListElement>>;
9
+ export default DateRangeQuickSelections;
@@ -0,0 +1,25 @@
1
+ import { DateRangeValue } from '../../../utils/types/date.types';
2
+ import { DateRangePreset } from '../date-time-range-picker/date-time-range-picker.types';
3
+ /**
4
+ * Props for the DateRangeQuickSelections component.
5
+ */
6
+ export interface DateRangeQuickSelectionsProps {
7
+ /**
8
+ * Custom class name for the component.
9
+ */
10
+ className?: string;
11
+ /**
12
+ * Array of preset date range options to display.
13
+ */
14
+ presets: DateRangePreset[];
15
+ /**
16
+ * The ID of the currently selected preset.
17
+ */
18
+ selectedPresetId?: DateRangePreset['id'];
19
+ /**
20
+ * Handler called when a preset is selected.
21
+ * @param presetId - The ID of the selected preset
22
+ * @param value - The date range value from the preset
23
+ */
24
+ onPresetSelect: (presetId: string, value: DateRangeValue) => void;
25
+ }
@@ -0,0 +1,2 @@
1
+ export { default as DateRangeQuickSelections } from './date-range-quick-selections';
2
+ export type { DateRangeQuickSelectionsProps } from './date-range-quick-selections.types';
@@ -10,8 +10,14 @@ export declare const GranularityComparison: Story;
10
10
  export declare const HourCycleComparison: Story;
11
11
  export declare const WithMinMaxDates: Story;
12
12
  export declare const ErrorState: Story;
13
+ export declare const WithLabel: Story;
14
+ export declare const WithLabelAndHelperText: Story;
15
+ export declare const WithLabelHelperTextAndTooltip: Story;
16
+ export declare const WithLabelAndError: Story;
17
+ export declare const RequiredWithLabel: Story;
13
18
  export declare const Disabled: Story;
14
19
  export declare const ReadOnly: Story;
20
+ export declare const Clearable: Story;
15
21
  export declare const LocaleComparison: Story;
16
22
  export declare const WithTimezone: Story;
17
23
  export declare const EventHandlers: Story;
@@ -1,7 +1,7 @@
1
1
  import { DateFieldAria, DatePickerAria } from '@react-aria/datepicker';
2
2
  import { CalendarState } from '@react-stately/calendar';
3
3
  import { DateFieldState, DatePickerState } from '@react-stately/datepicker';
4
- import { DOMAttributes, FocusEventHandler, InputHTMLAttributes, KeyboardEventHandler, MouseEventHandler, RefObject } from 'react';
4
+ import { DOMAttributes, FocusEventHandler, InputHTMLAttributes, KeyboardEventHandler, MouseEventHandler, ReactNode, RefObject } from 'react';
5
5
  import { DateValidationResult } from '../../../utils/date';
6
6
  import { ButtonProps } from '../../buttons';
7
7
  /**
@@ -26,6 +26,13 @@ export interface DateTimePickerProps {
26
26
  * Custom class name for the container of the dropdown component.
27
27
  */
28
28
  className?: string;
29
+ /**
30
+ * Whether the date-time picker should display a clear button.
31
+ * When enabled, shows a button to clear the current value.
32
+ * The clear button is hidden when the picker is disabled, read-only, or has no value.
33
+ * @default false
34
+ */
35
+ clearable?: boolean;
29
36
  /**
30
37
  * The date and time that is selected when the component first mounts (uncontrolled).
31
38
  * Should be a JavaScript Date object representing the initial value.
@@ -57,6 +64,11 @@ export interface DateTimePickerProps {
57
64
  * @default 'minute'
58
65
  */
59
66
  granularity?: 'day' | 'hour' | 'minute' | 'second';
67
+ /**
68
+ * The helper text content displayed below the input field.
69
+ * Use this to provide additional context or validation messages.
70
+ */
71
+ helperText?: ReactNode;
60
72
  /**
61
73
  * Whether to display time in 12 or 24 hour format.
62
74
  * By default, this is determined by the user's locale.
@@ -70,6 +82,11 @@ export interface DateTimePickerProps {
70
82
  * Used for accessibility and form association.
71
83
  */
72
84
  id?: string;
85
+ /**
86
+ * The label content for the date-time picker.
87
+ * Displays above the input field to describe its purpose.
88
+ */
89
+ label?: ReactNode;
73
90
  /**
74
91
  * The locale to use for formatting the date and time.
75
92
  * Follows BCP 47 language tag format (e.g., 'en-US', 'de-DE', 'ja-JP').
@@ -181,6 +198,11 @@ export interface DateTimePickerProps {
181
198
  * @default false
182
199
  */
183
200
  showTimezone?: boolean;
201
+ /**
202
+ * Tooltip content to display when hovering over the info icon next to the label.
203
+ * Only displays when a label is provided.
204
+ */
205
+ tooltip?: ReactNode;
184
206
  /**
185
207
  * The current date and time value (controlled).
186
208
  * Should be a JavaScript Date object representing the current value,
@@ -10,10 +10,21 @@ export declare const GranularityComparison: Story;
10
10
  export declare const HourCycleComparison: Story;
11
11
  export declare const WithMinMaxDates: Story;
12
12
  export declare const ErrorState: Story;
13
+ export declare const WithLabel: Story;
14
+ export declare const WithLabelAndHelperText: Story;
15
+ export declare const WithLabelHelperTextAndTooltip: Story;
16
+ export declare const WithLabelAndError: Story;
17
+ export declare const RequiredWithLabel: Story;
13
18
  export declare const Disabled: Story;
14
19
  export declare const ReadOnly: Story;
20
+ export declare const Clearable: Story;
15
21
  export declare const LocaleComparison: Story;
16
22
  export declare const WithTimezoneDisplay: Story;
17
23
  export declare const RangeScenarios: Story;
18
24
  export declare const InteractiveDemo: Story;
19
25
  export declare const ComplexValidation: Story;
26
+ export declare const WithQuickSelections: Story;
27
+ export declare const CustomPresets: Story;
28
+ export declare const QuickSelectionsWithTime: Story;
29
+ export declare const ComprehensivePresetLibrary: Story;
30
+ export declare const BuilderFunctionsDemo: Story;
@@ -2,7 +2,7 @@ import { DateFieldAria, DateRangePickerAria } from '@react-aria/datepicker';
2
2
  import { RangeCalendarState } from '@react-stately/calendar';
3
3
  import { DateFieldState, DateRangePickerState } from '@react-stately/datepicker';
4
4
  import { GroupDOMAttributes } from '@react-types/shared';
5
- import { DOMAttributes, FocusEventHandler, InputHTMLAttributes, KeyboardEventHandler, MouseEventHandler, RefObject } from 'react';
5
+ import { DOMAttributes, FocusEventHandler, InputHTMLAttributes, KeyboardEventHandler, MouseEventHandler, ReactNode, RefObject } from 'react';
6
6
  import { DateValidationResult } from '../../../utils/date';
7
7
  import { DateRangeValue } from '../../../utils/types/date.types';
8
8
  import { ButtonProps } from '../../buttons';
@@ -16,6 +16,32 @@ export interface DateTimeRangePickerChangeHandlerContext extends DateValidationR
16
16
  */
17
17
  valid: boolean;
18
18
  }
19
+ /**
20
+ * Represents a preset date range option for quick selection.
21
+ */
22
+ export interface DateRangePreset {
23
+ /**
24
+ * Whether this preset is disabled.
25
+ */
26
+ disabled?: boolean;
27
+ /**
28
+ * Function that returns the date range value for this preset.
29
+ * Called when the preset is selected.
30
+ */
31
+ getValue: () => DateRangeValue;
32
+ /**
33
+ * Optional icon to display before the label.
34
+ */
35
+ icon?: React.ReactNode;
36
+ /**
37
+ * Unique identifier for the preset.
38
+ */
39
+ id: string;
40
+ /**
41
+ * Display label for the preset.
42
+ */
43
+ label: React.ReactNode;
44
+ }
19
45
  /**
20
46
  * Props for the DateTimeRangePicker component.
21
47
  *
@@ -28,6 +54,13 @@ export interface DateTimeRangePickerProps {
28
54
  * Custom class name for the container of the component.
29
55
  */
30
56
  className?: string;
57
+ /**
58
+ * Whether the date-time range picker should display a clear button.
59
+ * When enabled, shows a button to clear the current range value.
60
+ * The clear button is hidden when the picker is disabled, read-only, or has no value.
61
+ * @default false
62
+ */
63
+ clearable?: boolean;
31
64
  /**
32
65
  * The date and time range that is selected when the component first mounts (uncontrolled).
33
66
  * Should be an object with start and end Date objects representing the initial range.
@@ -59,6 +92,11 @@ export interface DateTimeRangePickerProps {
59
92
  * @default 'minute'
60
93
  */
61
94
  granularity?: 'day' | 'hour' | 'minute' | 'second';
95
+ /**
96
+ * The helper text content displayed below the input field.
97
+ * Use this to provide additional context or validation messages.
98
+ */
99
+ helperText?: ReactNode;
62
100
  /**
63
101
  * The hour cycle to use for formatting the date and time.
64
102
  * @default 12
@@ -69,6 +107,11 @@ export interface DateTimeRangePickerProps {
69
107
  * Used for accessibility and form association.
70
108
  */
71
109
  id?: string;
110
+ /**
111
+ * The label content for the date-time range picker.
112
+ * Displays above the input field to describe its purpose.
113
+ */
114
+ label?: ReactNode;
72
115
  /**
73
116
  * The locale to use for formatting the date and time.
74
117
  * Follows BCP 47 language tag format (e.g., 'en-US', 'de-DE', 'ja-JP').
@@ -155,6 +198,14 @@ export interface DateTimeRangePickerProps {
155
198
  * ```
156
199
  */
157
200
  onOpenChange?: (open: boolean) => void;
201
+ /**
202
+ * Handler that is called when a preset is selected.
203
+ * Receives the preset ID and the calculated date range value.
204
+ *
205
+ * @param presetId - The ID of the selected preset
206
+ * @param value - The date range value calculated from the preset
207
+ */
208
+ onPresetSelect?: (presetId: string, value: DateRangeValue) => void;
158
209
  /**
159
210
  * A placeholder date that influences the format and default values of empty segments.
160
211
  * This date is used to determine the format and structure but is not the actual value.
@@ -165,6 +216,35 @@ export interface DateTimeRangePickerProps {
165
216
  * @example new Date('2024-12-31T23:59:59') // Shows full format structure
166
217
  */
167
218
  placeholderValue?: Date;
219
+ /**
220
+ * Array of preset date range options for quick selection.
221
+ * When provided, displays a sidebar with these preset options.
222
+ * Users can click on presets to quickly select common date ranges.
223
+ *
224
+ * @example
225
+ * ```tsx
226
+ * const presets: DateRangePreset[] = [
227
+ * {
228
+ * id: 'today',
229
+ * label: 'Today',
230
+ * getValue: () => ({
231
+ * start: startOfDay(new Date()),
232
+ * end: endOfDay(new Date())
233
+ * })
234
+ * },
235
+ * {
236
+ * id: 'last-7-days',
237
+ * label: 'Last 7 days',
238
+ * getValue: () => ({
239
+ * start: startOfDay(subDays(new Date(), 6)),
240
+ * end: endOfDay(new Date())
241
+ * })
242
+ * }
243
+ * ];
244
+ * return <DateTimeRangePicker presets={presets} />;
245
+ * ```
246
+ */
247
+ presets?: DateRangePreset[];
168
248
  /**
169
249
  * Whether the date-time range picker is read-only.
170
250
  * When true, the user can see the value but cannot edit it.
@@ -183,6 +263,11 @@ export interface DateTimeRangePickerProps {
183
263
  * @default false
184
264
  */
185
265
  showTimezone?: boolean;
266
+ /**
267
+ * Tooltip content to display when hovering over the info icon next to the label.
268
+ * Only displays when a label is provided.
269
+ */
270
+ tooltip?: ReactNode;
186
271
  /**
187
272
  * The current date and time range value (controlled).
188
273
  * Should be a DateRangeValue object with start and end Date objects,
@@ -1,2 +1,3 @@
1
+ export * from '../../../utils/date-range-presets';
1
2
  export { default as DateTimeRangePicker } from './date-time-range-picker';
2
3
  export type { DateTimeRangePickerChangeHandlerContext, DateTimeRangePickerProps } from './date-time-range-picker.types';
@@ -3,5 +3,13 @@ import { Meta, StoryObj } from '@storybook/react-vite';
3
3
  declare const meta: Meta<typeof Menu>;
4
4
  export type Story = StoryObj<typeof Menu>;
5
5
  export default meta;
6
- export declare const GlobalRankingRule: Story;
6
+ export declare const Basic: Story;
7
+ export declare const WithIcons: Story;
8
+ export declare const WithGroups: Story;
9
+ export declare const WithDisabledItems: Story;
10
+ export declare const ButtonVariants: Story;
7
11
  export declare const SplitButton: Story;
12
+ export declare const Placements: Story;
13
+ export declare const WithClickHandlers: Story;
14
+ export declare const ControlledMenu: Story;
15
+ export declare const RealWorldExample: Story;
@@ -62,6 +62,10 @@ export interface AutocompleteProps<AutocompleteOption extends NonNullable<unknow
62
62
  * @default false
63
63
  */
64
64
  hideSelectedOptions?: boolean;
65
+ /**
66
+ * The `id` of the autocomplete element.
67
+ */
68
+ id?: string;
65
69
  /**
66
70
  * The input value.
67
71
  */
@@ -96,8 +100,11 @@ export interface AutocompleteProps<AutocompleteOption extends NonNullable<unknow
96
100
  onClose?: () => void;
97
101
  /**
98
102
  * Callback fired when the input value changes.
103
+ * @param event The event source of the callback
104
+ * @param value The new value of the input
105
+ * @param reason The reason for the input change ('input' | 'reset' | 'clear')
99
106
  */
100
- onInputChange?: (event: SyntheticEvent, value: string) => void;
107
+ onInputChange?: (event: SyntheticEvent, value: string, reason?: string) => void;
101
108
  /**
102
109
  * Callback fired when the popup opens.
103
110
  */
@@ -0,0 +1,26 @@
1
+ import { AutocompleteFieldComponentType } from './autocomplete-field.types';
2
+ /**
3
+ * The `AutocompleteField` component provides a complete field layout for the Autocomplete component,
4
+ * including label, helper text, and tooltip support. It allows users to search for value(s) to select
5
+ * from a list with enhanced form integration.
6
+ *
7
+ * ### Usage
8
+ *
9
+ * ```tsx
10
+ * import { AutocompleteField } from '@bloomreach/react-banana-ui';
11
+ *
12
+ * export default function MyAutocompleteField() {
13
+ * return (
14
+ * <AutocompleteField
15
+ * label="Select a fruit"
16
+ * helperText="Choose your favorite fruit"
17
+ * options={['Banana', 'Apple', 'Orange', 'Pineapple', 'Strawberry', 'Grape', 'Watermelon']}
18
+ * placeholder="Search fruits..."
19
+ * onChange={(_, newValue) => console.log(newValue)}
20
+ * />
21
+ * );
22
+ * }
23
+ * ```
24
+ */
25
+ declare const _default: AutocompleteFieldComponentType;
26
+ export default _default;
@@ -0,0 +1,34 @@
1
+ import { Meta } from '@storybook/react-vite';
2
+ import { AutocompleteField } from '.';
3
+ import { Story } from './autocomplete-field.stories';
4
+ declare const meta: Meta<typeof AutocompleteField>;
5
+ export default meta;
6
+ export declare const Basic: Story;
7
+ export declare const DifferentStates: Story;
8
+ export declare const FullWidth: Story;
9
+ export declare const Single: Story;
10
+ export declare const ControlledSingleValue: Story;
11
+ export declare const Multiple: Story<string, true>;
12
+ export declare const DefaultValueMultiple: Story<string, true>;
13
+ export declare const ControlledMultipleValue: Story<string, true>;
14
+ export declare const HideSelectedOptions: Story<string, true>;
15
+ export declare const GroupedOptions: Story<{
16
+ firstLetter: string;
17
+ label: string;
18
+ }>;
19
+ export declare const DisabledOptions: Story<{
20
+ id: number;
21
+ label: string;
22
+ }>;
23
+ export declare const FreeSoloSingle: Story<string, false, true>;
24
+ export declare const FreeSoloMultiple: Story<string, true, true>;
25
+ export declare const CustomOptionRendering: Story<{
26
+ icon: React.ReactElement;
27
+ name: string;
28
+ }, true, true>;
29
+ export declare const Clearable: Story;
30
+ export declare const Disabled: Story;
31
+ export declare const ReadOnly: Story;
32
+ export declare const Loading: Story;
33
+ export declare const WithTooltip: Story;
34
+ export declare const SetError: Story;
@@ -0,0 +1,43 @@
1
+ import { default as AutocompleteField } from './autocomplete-field';
2
+ import { Meta, StoryObj } from '@storybook/react-vite';
3
+ import { ReactElement } from 'react';
4
+ declare const meta: Meta<typeof AutocompleteField>;
5
+ export default meta;
6
+ export type Story<Value extends NonNullable<unknown> = string, Multiple extends boolean = false, FreeSolo extends boolean = false> = StoryObj<typeof AutocompleteField<Value, Multiple, FreeSolo>>;
7
+ declare const fruits: string[];
8
+ export declare const Basic: Story;
9
+ export declare const WithLabel: Story;
10
+ export declare const WithTooltip: Story;
11
+ export declare const WithHelperText: Story;
12
+ export declare const CompleteField: Story;
13
+ export declare const FullWidth: Story;
14
+ export declare const DefaultValue: Story;
15
+ export declare const ControlledSingleValue: Story;
16
+ export declare const Multiple: Story<(typeof fruits)[0], true>;
17
+ export declare const DefaultValueMultiple: Story<(typeof fruits)[0], true>;
18
+ export declare const ControlledMultipleValue: Story<(typeof fruits)[0], true>;
19
+ export declare const Clearable: Story;
20
+ export declare const Disabled: Story;
21
+ export declare const DisabledMultiple: Story<(typeof fruits)[0], true>;
22
+ export declare const ReadOnly: Story;
23
+ export declare const ReadOnlyMultiple: Story<(typeof fruits)[0], true>;
24
+ export declare const Error: Story;
25
+ export declare const SetError: Story;
26
+ export declare const HideSelectedOptions: Story<string, true>;
27
+ export declare const GroupedOptions: Story<{
28
+ firstLetter: string;
29
+ label: string;
30
+ }>;
31
+ export declare const DisabledOptions: Story<{
32
+ id: number;
33
+ label: string;
34
+ }>;
35
+ export declare const FreeSoloSingle: Story<string, false, true>;
36
+ export declare const FreeSoloMultiple: Story<string, true, true>;
37
+ export declare const Loading: Story;
38
+ export declare const CustomOptionRendering: Story<{
39
+ icon: ReactElement;
40
+ name: string;
41
+ }, true, true>;
42
+ export declare const FieldsInColumn: Story;
43
+ export declare const FieldsInRow: Story;
@@ -0,0 +1,34 @@
1
+ import { ForwardedRef, ReactElement, ReactNode } from 'react';
2
+ import { AutocompleteProps } from '../../internal';
3
+ export interface AutocompleteFieldComponentType {
4
+ <AutocompleteOption extends NonNullable<unknown>, Multiple extends boolean = false, FreeSolo extends boolean = false>(props: AutocompleteFieldProps<AutocompleteOption, Multiple, FreeSolo> & {
5
+ ref?: ForwardedRef<HTMLElement>;
6
+ }): null | ReactElement;
7
+ displayName?: string;
8
+ }
9
+ export interface AutocompleteFieldProps<AutocompleteOption extends NonNullable<unknown>, Multiple extends boolean, FreeSolo extends boolean> extends AutocompleteProps<AutocompleteOption, Multiple, FreeSolo> {
10
+ /**
11
+ * Custom class name for the container of the component.
12
+ */
13
+ className?: string;
14
+ /**
15
+ * If `true`, the ``field` will indicate an error and set the `aria-invalid` attribute for `input`.
16
+ */
17
+ error?: boolean;
18
+ /**
19
+ * If `true`, the field will take up the full width of its container.
20
+ */
21
+ fullWidth?: boolean;
22
+ /**
23
+ * The helper text content.
24
+ */
25
+ helperText?: ReactNode;
26
+ /**
27
+ * The label content.
28
+ */
29
+ label?: ReactNode;
30
+ /**
31
+ * Tooltip to display when the field has label.
32
+ */
33
+ tooltip?: ReactNode;
34
+ }
@@ -0,0 +1,2 @@
1
+ export { default as AutocompleteField } from './autocomplete-field';
2
+ export * from './autocomplete-field.types';
@@ -33,6 +33,10 @@ export interface BaseFieldProps {
33
33
  * The metadata content.
34
34
  */
35
35
  metadata?: ReactNode;
36
+ /**
37
+ * If `true`, the field will display a red asterisk next to the label to indicate it is required.
38
+ */
39
+ required?: boolean;
36
40
  /**
37
41
  * Tooltip to display when the field has label.
38
42
  */
@@ -1,4 +1,5 @@
1
1
  export * from './autocomplete';
2
+ export * from './autocomplete-field';
2
3
  export * from './checkbox';
3
4
  export * from './checkbox-field';
4
5
  export * from './checkbox-group';
@@ -14,6 +14,7 @@ export declare const CompleteField: Story;
14
14
  export declare const Disabled: Story;
15
15
  export declare const ReadOnly: Story;
16
16
  export declare const Error: Story;
17
+ export declare const Required: Story;
17
18
  export declare const FullWidth: Story;
18
19
  export declare const CompleteFieldFullWidth: Story;
19
20
  export declare const Controlled: Story;
@@ -1,3 +1,4 @@
1
+ export * from './autocomplete';
1
2
  export * from './base-field';
2
3
  export * from './base-input';
3
4
  export * from './checkbox';
@@ -8,6 +8,7 @@ export declare const WithLabel: Story;
8
8
  export declare const WithTooltip: Story;
9
9
  export declare const WithHelperText: Story;
10
10
  export declare const CompleteField: Story;
11
+ export declare const Required: Story;
11
12
  export declare const FullWidth: Story;
12
13
  export declare const ControlledSingleSelect: Story;
13
14
  export declare const Multiple: Story<string, true>;
@@ -12,6 +12,7 @@ export declare const CompleteField: Story;
12
12
  export declare const Disabled: Story;
13
13
  export declare const ReadOnly: Story;
14
14
  export declare const Error: Story;
15
+ export declare const Required: Story;
15
16
  export declare const ManuallyResizable: Story;
16
17
  export declare const MinRows: Story;
17
18
  export declare const AutoSize: Story;
@@ -1,4 +1,4 @@
1
- import { HTMLAttributes, ReactNode } from 'react';
1
+ import { HTMLAttributes, MouseEventHandler, ReactNode } from 'react';
2
2
  export interface ListboxItemProps {
3
3
  /**
4
4
  * The type of the check mark icon.
@@ -21,6 +21,10 @@ export interface ListboxItemProps {
21
21
  * If `true`, the item will be highlighted.
22
22
  */
23
23
  highlighted?: boolean;
24
+ /**
25
+ * The onClick handler for the list box item.
26
+ */
27
+ onClick?: MouseEventHandler<HTMLLIElement>;
24
28
  /**
25
29
  * The role of the list box item.
26
30
  * @default 'option'
@@ -30,4 +34,8 @@ export interface ListboxItemProps {
30
34
  * If `true`, the item will be selected.
31
35
  */
32
36
  selected?: boolean;
37
+ /**
38
+ * Icon displayed at the start of the item (before the content).
39
+ */
40
+ startIcon?: ReactNode;
33
41
  }
@@ -0,0 +1,2 @@
1
+ export { default as ListboxSeparator } from './listbox-separator';
2
+ export type { ListboxSeparatorProps } from './listbox-separator.types';