@bloomreach/react-banana-ui 1.30.0 → 1.31.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.
- package/dist/bloomreach-react-banana-ui.es.js +2549 -2477
- package/dist/bloomreach-react-banana-ui.es.js.map +1 -1
- package/dist/bloomreach-react-banana-ui.umd.js +18 -18
- package/dist/bloomreach-react-banana-ui.umd.js.map +1 -1
- package/dist/components/data-display/input-tag/input-tag.stories.d.ts +2 -0
- package/dist/components/inputs/autocomplete/autocomplete.stories.d.ts +4 -0
- package/dist/components/inputs/calendar/use-calendar-state.d.ts +1 -1
- package/dist/components/inputs/calendar/use-calendar.d.ts +1 -1
- package/dist/components/inputs/calendar-cell/calendar-cell.types.d.ts +7 -3
- package/dist/components/inputs/calendar-grid/calendar-grid.types.d.ts +7 -3
- package/dist/components/inputs/date-picker/date-picker.stories.d.ts +2 -0
- package/dist/components/inputs/date-picker/use-date-picker-state.d.ts +1 -1
- package/dist/components/inputs/date-picker/use-date-picker.d.ts +1 -1
- package/dist/components/inputs/date-range-picker/date-range-picker.d.ts +24 -0
- package/dist/components/inputs/date-range-picker/date-range-picker.qa.stories.d.ts +5 -0
- package/dist/components/inputs/date-range-picker/date-range-picker.stories.d.ts +10 -0
- package/dist/components/inputs/date-range-picker/date-range-picker.types.d.ts +46 -0
- package/dist/components/inputs/date-range-picker/index.d.ts +2 -0
- package/dist/components/inputs/date-range-picker/use-date-range-picker-state.d.ts +3 -0
- package/dist/components/inputs/date-range-picker/use-date-range-picker.d.ts +19 -0
- package/dist/components/inputs/date-segments/date-segments.d.ts +8 -0
- package/dist/components/inputs/date-segments/date-segments.types.d.ts +7 -0
- package/dist/components/inputs/date-segments/index.d.ts +2 -0
- package/dist/components/inputs/range-calendar/index.d.ts +2 -0
- package/dist/components/inputs/range-calendar/range-calendar-base.d.ts +7 -0
- package/dist/components/inputs/range-calendar/range-calendar.d.ts +16 -0
- package/dist/components/inputs/range-calendar/range-calendar.types.d.ts +27 -0
- package/dist/components/inputs/range-calendar/use-range-calendar-state.d.ts +3 -0
- package/dist/components/inputs/range-calendar/use-range-calendar.d.ts +10 -0
- package/dist/components/popovers/popup/popup-content/popup-content.types.d.ts +4 -0
- package/dist/react-banana-ui.css +1 -1
- package/dist/utils/date/aria-date-conversion.d.ts +19 -11
- package/dist/utils/types/date.types.d.ts +6 -0
- package/dist/utils/types/index.d.ts +2 -1
- package/package.json +2 -2
|
@@ -5,5 +5,7 @@ export default meta;
|
|
|
5
5
|
export type Story = StoryObj<typeof InputTag>;
|
|
6
6
|
export declare const Basic: Story;
|
|
7
7
|
export declare const Controlled: Story;
|
|
8
|
+
export declare const ReadOnly: Story;
|
|
9
|
+
export declare const Disabled: Story;
|
|
8
10
|
export declare const AllStates: Story;
|
|
9
11
|
export declare const AllStatesWithIcon: Story;
|
|
@@ -11,6 +11,10 @@ export declare const ControlledSingleValue: Story;
|
|
|
11
11
|
export declare const Multiple: Story<(typeof fruits)[0], true>;
|
|
12
12
|
export declare const DefaultValueMultiple: Story<(typeof fruits)[0], true>;
|
|
13
13
|
export declare const ControlledMultipleValue: Story<(typeof fruits)[0], true>;
|
|
14
|
+
export declare const Disabled: Story;
|
|
15
|
+
export declare const DisabledMultiple: Story<(typeof fruits)[0], true>;
|
|
16
|
+
export declare const ReadOnly: Story;
|
|
17
|
+
export declare const ReadOnlyMultiple: Story<(typeof fruits)[0], true>;
|
|
14
18
|
export declare const HideSelectedOptions: Story<string, true>;
|
|
15
19
|
export declare const GroupedOptions: Story<{
|
|
16
20
|
firstLetter: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CalendarState } from '@react-stately/calendar';
|
|
2
2
|
import { DOMAttributes } from 'react';
|
|
3
3
|
import { ButtonProps } from '../../buttons';
|
|
4
|
-
export declare
|
|
4
|
+
export declare const useCalendar: (state: CalendarState) => {
|
|
5
5
|
calendarProps: DOMAttributes<HTMLElement>;
|
|
6
6
|
nextButtonProps: ButtonProps;
|
|
7
7
|
prevButtonProps: ButtonProps;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CalendarDate } from '@internationalized/date';
|
|
2
|
-
import { CalendarState } from '@react-stately/calendar';
|
|
2
|
+
import { CalendarState, RangeCalendarState } from '@react-stately/calendar';
|
|
3
3
|
export interface CalendarCellProps {
|
|
4
4
|
/**
|
|
5
5
|
* Custom class name for the container of the component.
|
|
@@ -10,7 +10,11 @@ export interface CalendarCellProps {
|
|
|
10
10
|
*/
|
|
11
11
|
date: CalendarDate;
|
|
12
12
|
/**
|
|
13
|
-
* The state of the calendar. Use `useCalendarState` to get it.
|
|
13
|
+
* The state of the calendar. Use `useCalendarState` or `useRangeCalendarState` to get it.
|
|
14
14
|
*/
|
|
15
|
-
state: CalendarState;
|
|
15
|
+
state: CalendarState | RangeCalendarState;
|
|
16
|
+
/**
|
|
17
|
+
* The current month of the calendar.
|
|
18
|
+
*/
|
|
19
|
+
currentMonth?: CalendarDate;
|
|
16
20
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { CalendarState } from '@react-stately/calendar';
|
|
1
|
+
import { CalendarState, RangeCalendarState } from '@react-stately/calendar';
|
|
2
2
|
export interface CalendarGridProps {
|
|
3
3
|
/**
|
|
4
4
|
* Custom class name for the container of the component.
|
|
5
5
|
*/
|
|
6
6
|
className?: string;
|
|
7
7
|
/**
|
|
8
|
-
* The state for the calendar from `useCalendarState` hook.
|
|
8
|
+
* The state for the calendar from `useCalendarState` or `useRangeCalendarState` hook.
|
|
9
9
|
*/
|
|
10
|
-
state: CalendarState;
|
|
10
|
+
state: CalendarState | RangeCalendarState;
|
|
11
|
+
/**
|
|
12
|
+
* The months offset for the calendar.
|
|
13
|
+
*/
|
|
14
|
+
offset?: number;
|
|
11
15
|
}
|
|
@@ -3,4 +3,4 @@ import { DatePickerProps } from './date-picker.types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Custom hook that manages the state for a date picker component.
|
|
5
5
|
*/
|
|
6
|
-
export declare
|
|
6
|
+
export declare const useDatePickerState: (props: DatePickerProps) => DatePickerState;
|
|
@@ -5,7 +5,7 @@ import { DatePickerProps } from './date-picker.types';
|
|
|
5
5
|
/**
|
|
6
6
|
* Custom hook for the DatePicker component.
|
|
7
7
|
*/
|
|
8
|
-
export declare
|
|
8
|
+
export declare const useDatePicker: (props: DatePickerProps, state: DatePickerState) => {
|
|
9
9
|
calendarState: CalendarState;
|
|
10
10
|
dateInputProps: DateInputProps;
|
|
11
11
|
lockFocus: boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DateRangePickerProps } from './date-range-picker.types';
|
|
2
|
+
/**
|
|
3
|
+
* The `DateRangePicker` component is a composite component that provides a way to select a range of dates.
|
|
4
|
+
*
|
|
5
|
+
* ### Usage
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import { DateRangePicker } from '@bloomreach/react-banana-ui';
|
|
9
|
+
*
|
|
10
|
+
* export default function MyCustomComponent() {
|
|
11
|
+
* return <DateRangePicker
|
|
12
|
+
* placeholderValue={new Date('2999-12-31')}
|
|
13
|
+
* defaultValue={new Date('2999-12-30')}
|
|
14
|
+
* minDate={new Date('2999-12-01')}
|
|
15
|
+
* onChange={(value, context) => {
|
|
16
|
+
* console.log('Changed value', value); // => `Date` object
|
|
17
|
+
* console.log('Context', context); // => Validation information use it if you want to show validation message
|
|
18
|
+
* }}
|
|
19
|
+
* />;
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare const DateRangePicker: import('react').ForwardRefExoticComponent<DateRangePickerProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export default DateRangePicker;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as DateRangePicker } from './date-range-picker';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: Meta<typeof DateRangePicker>;
|
|
4
|
+
export default meta;
|
|
5
|
+
export type Story = StoryObj<typeof DateRangePicker>;
|
|
6
|
+
export declare const Basic: Story;
|
|
7
|
+
export declare const WithValue: Story;
|
|
8
|
+
export declare const Controlled: Story;
|
|
9
|
+
export declare const Readonly: Story;
|
|
10
|
+
export declare const Disabled: Story;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DateRangeValue } from '../../../utils/types/date.types';
|
|
2
|
+
interface DateRangeChangeHandlerContext {
|
|
3
|
+
}
|
|
4
|
+
export interface DateRangePickerProps {
|
|
5
|
+
/**
|
|
6
|
+
* Custom class name for the container of the component.
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The default value of the date range picker.
|
|
11
|
+
*/
|
|
12
|
+
defaultValue?: DateRangeValue;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the date range picker is disabled.
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The maximum date that can be selected.
|
|
19
|
+
*/
|
|
20
|
+
maxDate?: Date;
|
|
21
|
+
/**
|
|
22
|
+
* The minimum date that can be selected.
|
|
23
|
+
*/
|
|
24
|
+
minDate?: Date;
|
|
25
|
+
/**
|
|
26
|
+
* The callback function that is called when the value of the date range picker changes.
|
|
27
|
+
*/
|
|
28
|
+
onChange?: (value: DateRangeValue | null, context: DateRangeChangeHandlerContext) => void;
|
|
29
|
+
/**
|
|
30
|
+
* The placeholder value of the date range picker.
|
|
31
|
+
*/
|
|
32
|
+
placeholderValue?: Date;
|
|
33
|
+
/**
|
|
34
|
+
* Whether the date range picker is read-only.
|
|
35
|
+
*/
|
|
36
|
+
readOnly?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the date range picker is required.
|
|
39
|
+
*/
|
|
40
|
+
required?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The value of the date range
|
|
43
|
+
*/
|
|
44
|
+
value?: DateRangeValue;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useRangeCalendarState } from '../range-calendar/use-range-calendar-state';
|
|
2
|
+
import { DateRangePickerAria } from '@react-aria/datepicker';
|
|
3
|
+
import { DateFieldState, DateRangePickerState } from '@react-stately/datepicker';
|
|
4
|
+
import { InputHTMLAttributes, RefObject } from 'react';
|
|
5
|
+
import { PopupProps } from '../../popovers';
|
|
6
|
+
import { RangeCalendarProps } from '../range-calendar/range-calendar.types';
|
|
7
|
+
import { DateRangePickerProps } from './date-range-picker.types';
|
|
8
|
+
export declare const useDateRangePicker: (props: DateRangePickerProps, state: DateRangePickerState, ref: RefObject<Element>) => {
|
|
9
|
+
calendarProps: RangeCalendarProps;
|
|
10
|
+
calendarState: ReturnType<typeof useRangeCalendarState>;
|
|
11
|
+
dialogProps: DateRangePickerAria["dialogProps"];
|
|
12
|
+
groupProps: DateRangePickerAria["groupProps"];
|
|
13
|
+
hiddenInputEndProps: InputHTMLAttributes<HTMLInputElement>;
|
|
14
|
+
hiddenInputStartProps: InputHTMLAttributes<HTMLInputElement>;
|
|
15
|
+
lockFocus: boolean;
|
|
16
|
+
popupProps: PopupProps;
|
|
17
|
+
stateEnd: DateFieldState;
|
|
18
|
+
stateStart: DateFieldState;
|
|
19
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DateSegmentsProps, DateSegmentsRef } from './date-segments.types';
|
|
2
|
+
/**
|
|
3
|
+
* The `DateSegments` component is used to render the segments of a date input.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
declare const DateSegments: import('react').ForwardRefExoticComponent<DateSegmentsProps & import('react').RefAttributes<DateSegmentsRef>>;
|
|
8
|
+
export default DateSegments;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RangeCalendarBaseProps } from './range-calendar.types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* The component is used inside range datepicker component to allow lift state up.
|
|
5
|
+
*/
|
|
6
|
+
declare const RangeCalendarBase: import('react').ForwardRefExoticComponent<RangeCalendarBaseProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export default RangeCalendarBase;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RangeCalendarProps } from './range-calendar.types';
|
|
2
|
+
/**
|
|
3
|
+
* The component description.
|
|
4
|
+
*
|
|
5
|
+
* ### Usage
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import { RangeCalendar } from '@bloomreach/react-banana-ui';
|
|
9
|
+
*
|
|
10
|
+
* export default function MyCustomComponent() {
|
|
11
|
+
* return <RangeCalendar>Write an example of component usage</RangeCalendar>;
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
declare const RangeCalendar: import('react').ForwardRefExoticComponent<RangeCalendarProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export default RangeCalendar;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RangeCalendarState } from '@react-stately/calendar';
|
|
2
|
+
import { DateRangeValue } from '../../../utils/types/date.types';
|
|
3
|
+
import { CalendarProps } from '../calendar/calendar.types';
|
|
4
|
+
import { useRangeCalendarState } from './use-range-calendar-state';
|
|
5
|
+
export interface RangeCalendarBaseProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
state: RangeCalendarState;
|
|
8
|
+
}
|
|
9
|
+
export interface RangeCalendarProps extends Omit<CalendarProps, 'defaultValue' | 'onChange' | 'value'> {
|
|
10
|
+
/**
|
|
11
|
+
* Custom class name for the container of the component.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The dates that are selected when the range calendar first mounts (uncontrolled).
|
|
16
|
+
*/
|
|
17
|
+
defaultValue?: DateRangeValue;
|
|
18
|
+
/**
|
|
19
|
+
* Handler that is called when the selected dates change.
|
|
20
|
+
*/
|
|
21
|
+
onChange?: (value: DateRangeValue | null) => void;
|
|
22
|
+
state?: ReturnType<typeof useRangeCalendarState>;
|
|
23
|
+
/**
|
|
24
|
+
* The selected dates (controlled).
|
|
25
|
+
*/
|
|
26
|
+
value?: DateRangeValue | null;
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RangeCalendarState } from '@react-stately/calendar';
|
|
2
|
+
import { DOMAttributes, RefObject } from 'react';
|
|
3
|
+
import { ButtonProps } from '../../buttons';
|
|
4
|
+
export declare const useRangeCalendar: (state: RangeCalendarState, ref: RefObject<Element>) => {
|
|
5
|
+
calendarProps: DOMAttributes<HTMLElement>;
|
|
6
|
+
leftTitle: string;
|
|
7
|
+
nextButtonProps: ButtonProps;
|
|
8
|
+
prevButtonProps: ButtonProps;
|
|
9
|
+
rightTitle: string;
|
|
10
|
+
};
|
|
@@ -14,6 +14,10 @@ export interface PopupContentProps {
|
|
|
14
14
|
* Custom class name for the container of the component.
|
|
15
15
|
*/
|
|
16
16
|
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The initial focus index of the popup.
|
|
19
|
+
*/
|
|
20
|
+
initialFocus?: number;
|
|
17
21
|
/**
|
|
18
22
|
* If `true`, the popup will always be mounted in the DOM.
|
|
19
23
|
* @default false
|