@npm-questionpro/wick-ui-lib 2.0.0-next.32 → 2.0.0-next.34

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.
@@ -1,26 +1,42 @@
1
1
  import { DateRange, Matcher, PropsMulti, PropsRange, PropsSingle } from 'react-day-picker';
2
2
  import React from 'react';
3
3
  type ISharedProps = {
4
+ /** Earliest selectable and navigable date. Months before this are unreachable. */
4
5
  min?: Date;
6
+ /** Latest selectable and navigable date. Months after this are unreachable. */
5
7
  max?: Date;
8
+ /** Dates to disable. Accepts any react-day-picker Matcher — e.g. `{before: new Date()}` or `{dayOfWeek: [0, 6]}`. */
6
9
  disabled?: Matcher | Matcher[];
7
10
  };
8
11
  type ISingleProps = ISharedProps & {
12
+ /** @default 'single' */
9
13
  mode?: 'single';
14
+ /** Controlled selected date. */
10
15
  selected?: Date;
16
+ /** Called when the user selects or deselects a date. */
11
17
  onSelect?: PropsSingle['onSelect'];
18
+ /** Prevents deselecting the current date when clicked again. */
12
19
  required?: boolean;
20
+ /** Initial month to display on mount. Falls back to the current month. */
21
+ defaultMonth?: Date;
13
22
  };
14
23
  type IMultipleProps = ISharedProps & {
15
24
  mode: 'multiple';
25
+ /** Controlled array of selected dates. */
16
26
  selected?: Date[];
27
+ /** Called when the selection changes. */
17
28
  onSelect?: PropsMulti['onSelect'];
18
29
  };
19
30
  type IRangeProps = ISharedProps & {
20
31
  mode: 'range';
32
+ /** Controlled selected range with `from` and `to`. */
21
33
  selected?: DateRange;
34
+ /** Called when the range changes. */
22
35
  onSelect?: PropsRange['onSelect'];
36
+ /** Which panel shows the current month — the other panel shows the adjacent month. @default 'end' */
23
37
  currentMonthPosition?: 'start' | 'end';
38
+ /** Initial month to display on mount. Overrides the `currentMonthPosition` default. */
39
+ defaultMonth?: Date;
24
40
  };
25
41
  export type IWuCalendarProps = ISingleProps | IMultipleProps | IRangeProps;
26
42
  /**
@@ -4,6 +4,7 @@ type IRangeCalendarProps = Partial<PropsBase> & {
4
4
  selected?: DateRange;
5
5
  onSelect?: PropsRange['onSelect'];
6
6
  currentMonthPosition?: 'start' | 'end';
7
+ defaultMonth?: Date;
7
8
  };
8
- export declare function RangeCalendar({ disabled, selected, onSelect, currentMonthPosition, ...dayPickerProps }: IRangeCalendarProps): React.JSX.Element;
9
+ export declare function RangeCalendar({ disabled, selected, onSelect, currentMonthPosition, defaultMonth, ...dayPickerProps }: IRangeCalendarProps): React.JSX.Element;
9
10
  export {};
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { DropdownMenuGroup } from '@/base/ui/dropdownMenu';
2
3
  export declare const WuMenuItemGroup: React.FC<React.ComponentProps<typeof DropdownMenuGroup> & {
3
4
  /**
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  export interface IWuMenuRadioItemOption {
2
3
  value: string;
3
4
  /**
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { DropdownMenuSub } from '@/base/ui/dropdownMenu';
2
3
  export interface IWuSubMenuProps extends Omit<React.ComponentProps<typeof DropdownMenuSub>, 'onOpenChange'> {
3
4
  /**
@@ -2,11 +2,22 @@ import React from 'react';
2
2
  import { IWuCalendarProps } from '../../calendar';
3
3
  import { IPickerShellProps } from '../_shared/PickerShell';
4
4
  export interface IWuDatePickerProps extends IPickerShellProps {
5
+ /** Controlled selected date. Accepts a `Date` object or an ISO date string. */
5
6
  value?: Date | string;
7
+ /** Called when the user confirms a selection via Apply. */
6
8
  onChange?: (date?: Date) => void;
9
+ /** Earliest selectable and navigable date. */
7
10
  minDate?: Date;
11
+ /** Latest selectable and navigable date. */
8
12
  maxDate?: Date;
13
+ /** Dates to disable. Accepts any react-day-picker Matcher — e.g. `{before: new Date()}`. */
9
14
  disabledDate?: IWuCalendarProps['disabled'];
15
+ /** Prevents Apply until a date is selected. */
10
16
  required?: boolean;
11
17
  }
18
+ /**
19
+ * Popover-based single date picker with a calendar, label, and Apply / Reset actions.
20
+ *
21
+ * @summary Pick a single date from a popover calendar; supports controlled value, bounds, and disabled dates.
22
+ */
12
23
  export declare function WuDatePicker({ value, onChange, minDate, maxDate, disabledDate, required, Label, onReset, formatString, ...props }: IWuDatePickerProps): React.JSX.Element;
@@ -4,16 +4,32 @@ import { IPickerShellProps } from '../_shared/PickerShell';
4
4
  import { DateRange } from 'react-day-picker';
5
5
  import { IRangeHeaderProps } from './internal/RangeHeader';
6
6
  export interface IWuDateRangePickerProps extends Omit<IPickerShellProps, 'onChange' | 'children' | 'value'> {
7
+ /** Controlled selected date range with `from` and `to`. */
7
8
  value?: DateRange;
9
+ /** Called when the user confirms a range via Apply. */
8
10
  onChange?: (range?: DateRange) => void;
11
+ /** Called when the user clicks Reset. */
9
12
  onReset?: () => void;
13
+ /** Earliest selectable and navigable date. */
10
14
  minDate?: Date;
15
+ /** Latest selectable and navigable date. */
11
16
  maxDate?: Date;
17
+ /** Dates to disable. Accepts any react-day-picker Matcher. */
12
18
  disabledDate?: IWuCalendarProps['disabled'];
19
+ /** Additional preset items appended to the header dropdown. Each item needs a unique `value` number. */
13
20
  presetRanges?: IRangeHeaderProps['presetRanges'];
21
+ /** Whether to include the built-in presets (Last week, Last month…). @default true */
14
22
  append?: IRangeHeaderProps['append'];
23
+ /** Whether rolling presets (e.g. Last week) include today as the end date. @default false */
15
24
  includeToday?: IRangeHeaderProps['includeToday'];
25
+ /** Which panel shows the current month when no selection is present. @default 'end' */
16
26
  currentMonthPosition?: 'start' | 'end';
27
+ /** Prevents Apply until both `from` and `to` are selected. */
17
28
  required?: boolean;
18
29
  }
30
+ /**
31
+ * Popover-based date range picker with preset shortcuts, inline text inputs, and Apply / Reset actions.
32
+ *
33
+ * @summary Pick a date range from a popover calendar; supports preset shortcuts, bounds, and controlled value.
34
+ */
19
35
  export declare function WuDateRangePicker({ value, onChange, onReset, minDate, maxDate, disabledDate, Label, presetRanges, append, includeToday, currentMonthPosition, required, formatString, onOpenChange, ...props }: IWuDateRangePickerProps): React.JSX.Element;
@@ -3,6 +3,8 @@ import { DateRange } from 'react-day-picker';
3
3
  export type IPresetItem = {
4
4
  label: string;
5
5
  value: number;
6
+ /** Hardcoded date range — when present, used as-is instead of computing from `value` */
7
+ range?: DateRange;
6
8
  };
7
9
  export interface IRangeHeaderProps {
8
10
  presetRanges?: IPresetItem[];
@@ -0,0 +1,13 @@
1
+ import { ToggleGroup } from '@base-ui/react/toggle-group';
2
+ import React from 'react';
3
+ export interface IWuSegmentedSelectorProps extends Omit<ToggleGroup.Props, 'value' | 'defaultValue' | 'onValueChange' | 'onChange' | 'multiple' | 'orientation'> {
4
+ value?: string;
5
+ defaultValue?: string;
6
+ onChange?: (value: string) => void;
7
+ size?: 'sm' | 'md' | 'lg';
8
+ iconOnly?: boolean;
9
+ }
10
+ export declare const WuSegmentedSelector: {
11
+ ({ value, defaultValue, onChange, size, iconOnly, disabled, className, children, ...props }: IWuSegmentedSelectorProps): React.JSX.Element;
12
+ displayName: string;
13
+ };
@@ -0,0 +1,2 @@
1
+ import { type RefObject } from 'react';
2
+ export declare function useSegmentedIndicator(rootRef: RefObject<HTMLDivElement | null>, selectionKey: unknown): void;
@@ -0,0 +1,4 @@
1
+ export { WuSegmentedSelector } from './WuSegmentedSelector';
2
+ export type { IWuSegmentedSelectorProps } from './WuSegmentedSelector';
3
+ export { WuSegmentedSelectorItem } from './subComponents/WuSegmentedSelectorItem';
4
+ export type { IWuSegmentedSelectorItemProps } from './subComponents/WuSegmentedSelectorItem';
@@ -0,0 +1,6 @@
1
+ import { Toggle } from '@base-ui/react/toggle';
2
+ export interface IWuSegmentedSelectorItemProps extends Omit<Toggle.Props, 'className'> {
3
+ value: string;
4
+ className?: string;
5
+ }
6
+ export declare const WuSegmentedSelectorItem: import("react").ForwardRefExoticComponent<Omit<IWuSegmentedSelectorItemProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
package/dist/index.d.ts CHANGED
@@ -34,7 +34,7 @@ export * from './components/pagination';
34
34
  export * from './components/popover';
35
35
  export * from './components/radio';
36
36
  export * from './components/scrollArea';
37
- export * from './components/segment';
37
+ export * from './components/segmentedSelector';
38
38
  export * from './components/select';
39
39
  export * from './components/sidebar';
40
40
  export * from './components/spotlight';