@theroutingcompany/components 0.0.90 → 0.0.91-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theroutingcompany/components",
3
- "version": "0.0.90",
3
+ "version": "0.0.91-alpha.0",
4
4
  "description": "The Routing Company Components",
5
5
  "main": "./dist/trc-components.umd.js",
6
6
  "module": "./dist/trc-components.es.js",
@@ -95,7 +95,7 @@
95
95
  "@react-stately/overlays": "^3.5.2",
96
96
  "@react-stately/radio": "^3.8.1",
97
97
  "@react-stately/searchfield": "^3.4.2",
98
- "@react-stately/select": "^3.5.1",
98
+ "@react-stately/select": "^3.6.4",
99
99
  "@react-stately/selection": "^3.13.1",
100
100
  "@react-stately/toggle": "^3.7.2",
101
101
  "@react-stately/tree": "^3.7.6",
@@ -0,0 +1,15 @@
1
+ import type { AriaPopoverProps } from '@react-aria/overlays';
2
+ import type { OverlayTriggerState } from '@react-stately/overlays';
3
+ import * as React from 'react';
4
+ interface BoxPopoverProps extends Omit<AriaPopoverProps, 'popoverRef'> {
5
+ children: React.ReactNode;
6
+ state: OverlayTriggerState;
7
+ popoverRef?: React.RefObject<HTMLDivElement>;
8
+ isTargetWidth?: boolean;
9
+ width?: string;
10
+ }
11
+ export declare function BoxPopover(props: Omit<BoxPopoverProps, 'triggerRef'> & {
12
+ targetRef: React.RefObject<HTMLElement>;
13
+ disableFocusManagement?: boolean;
14
+ }): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -1,9 +1,9 @@
1
1
  import { type DateValue } from '@internationalized/date';
2
2
  import type { CalendarProps } from '@react-aria/calendar';
3
- export declare const Calendar: {
4
- ({ timeZone, value, focusedValue, onChange, defaultValue, defaultFocusedValue, ...props }: CalendarProps<DateValue> & {
5
- timeZone: string;
6
- }): import("react/jsx-runtime").JSX.Element;
7
- displayName: string;
8
- };
3
+ import React from 'react';
4
+ export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps<DateValue> & {
5
+ timeZone: string;
6
+ onPrev?: (() => void) | undefined;
7
+ onNext?: (() => void) | undefined;
8
+ } & React.RefAttributes<HTMLDivElement>>;
9
9
  export default Calendar;
@@ -3,4 +3,3 @@ export * from './CalendarGrid';
3
3
  export * from './CalendarHeader';
4
4
  export * from './RangeCalendar';
5
5
  export * from './Calendar';
6
- export * from './TimeDateSelect';
@@ -0,0 +1,2 @@
1
+ declare const FormInputExample: () => import("react/jsx-runtime").JSX.Element;
2
+ export default FormInputExample;
@@ -60,11 +60,15 @@ export declare const TextAreaFormControl: import("react").ForwardRefExoticCompon
60
60
  maxLength?: number | undefined;
61
61
  minLength?: number | undefined;
62
62
  readOnly?: boolean | undefined;
63
- required?: unknown;
63
+ required?: boolean | undefined;
64
64
  description?: ReactNode;
65
65
  onFocusChange?: ((isFocused: boolean) => void) | undefined;
66
66
  excludeFromTabOrder?: boolean | undefined;
67
+ validationState?: import("@react-types/shared").ValidationState | undefined;
68
+ isInvalid?: boolean | undefined;
67
69
  errorMessage?: ReactNode | ((v: import("@react-types/shared").ValidationResult) => ReactNode);
70
+ validationBehavior?: "aria" | "native" | undefined;
71
+ validate?: ((value: unknown) => true | import("@react-types/shared").ValidationError | null | undefined) | undefined;
68
72
  } & import("components/Input/InputBase").InputBaseProps & {
69
73
  rows?: number | undefined;
70
74
  errorMessage?: ReactNode;
@@ -1,18 +1,18 @@
1
- import { type CalendarDateTime } from '@internationalized/date';
2
- import type { AriaDateFieldOptions } from '@react-aria/datepicker';
3
- import type { DateFieldStateOptions } from '@react-stately/datepicker';
4
- export declare const DateField: import("styled-components").StyledComponent<"div", any, {
5
- paddingSize: string;
6
- invalid?: boolean | undefined;
7
- }, never>;
8
- export type DateInputProps = {
1
+ import { CalendarDateTime } from '@internationalized/date';
2
+ export declare const getPreviousMonth: (val?: CalendarDateTime) => CalendarDateTime | undefined;
3
+ export declare const getNextMonth: (val?: CalendarDateTime) => CalendarDateTime | undefined;
4
+ interface DateInputProps {
5
+ timeZone?: string;
9
6
  value?: CalendarDateTime;
10
- defaultValue?: CalendarDateTime;
11
7
  onChange?: (value: CalendarDateTime) => void;
8
+ defaultValue?: CalendarDateTime;
12
9
  label?: string;
10
+ labelId?: string;
11
+ inputId?: string;
12
+ tooltipIcon?: string;
13
13
  tooltipContent?: string;
14
- granularity?: 'day' | 'hour' | 'minute';
15
- paddingSize?: string;
16
- timeZone: string;
17
- } & AriaDateFieldOptions<CalendarDateTime> & Omit<DateFieldStateOptions<CalendarDateTime>, 'locale' | 'createCalendar'>;
18
- export declare function DateInput({ granularity, paddingSize, timeZone, value, defaultValue, onChange, ...props }: DateInputProps): import("react/jsx-runtime").JSX.Element;
14
+ boldLabel?: boolean;
15
+ hideLabel?: boolean;
16
+ }
17
+ export declare function DateInput({ label, labelId, inputId, timeZone, hideLabel, boldLabel, ...props }: DateInputProps): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -1,15 +1,19 @@
1
- /// <reference types="react" />
2
- import { type TODOFIXME } from 'helpers';
3
1
  export { Time } from '@internationalized/date';
4
2
  export declare const TimeWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
5
3
  export declare const TimeField: import("styled-components").StyledComponent<"div", any, {}, never>;
6
4
  interface TimeInputProps {
7
5
  label?: string;
8
- defaultValue?: TODOFIXME;
9
- value?: TODOFIXME;
10
- onChange?: TODOFIXME;
11
- hourCycle?: 12 | 24;
6
+ labelId?: string;
7
+ inputId?: string;
8
+ tooltipIcon?: string;
9
+ tooltipContent?: string;
10
+ boldLabel?: boolean;
11
+ hideLabel?: boolean;
12
+ defaultValue?: string;
13
+ value?: string;
14
+ onChange?: () => void;
15
+ hourCycle?: '12' | '24';
16
+ interval?: number;
12
17
  errorMessage?: string;
13
- wrapper?: React.ComponentType<TODOFIXME>;
14
18
  }
15
- export declare function TimeInput({ ...props }: TimeInputProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function TimeInput({ label, labelId, inputId, hideLabel, boldLabel, interval, hourCycle, ...props }: TimeInputProps): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,7 @@
1
- import * as React from 'react';
2
1
  import type { AriaListBoxOptions } from '@react-aria/listbox';
3
- import type { AriaPopoverProps } from '@react-aria/overlays';
4
2
  import type { ListState } from '@react-stately/list';
5
- import type { OverlayTriggerState } from '@react-stately/overlays';
6
3
  import type { MultiSelectState } from 'components/MultiSelect/useMultiSelectState';
4
+ import * as React from 'react';
7
5
  interface ListBoxProps extends AriaListBoxOptions<unknown> {
8
6
  listBoxRef?: React.RefObject<HTMLUListElement>;
9
7
  state: ListState<unknown>;
@@ -29,14 +27,4 @@ export declare function OptionLabel({ children }: {
29
27
  export declare function OptionDescription({ children }: {
30
28
  children: React.ReactNode;
31
29
  }): import("react/jsx-runtime").JSX.Element;
32
- interface ListBoxPopoverProps extends Omit<AriaPopoverProps, 'popoverRef'> {
33
- children: React.ReactNode;
34
- state: OverlayTriggerState;
35
- popoverRef?: React.RefObject<HTMLDivElement>;
36
- isTargetWidth?: boolean;
37
- width?: string;
38
- }
39
- export declare function ListBoxPopover(props: Omit<ListBoxPopoverProps, 'triggerRef'> & {
40
- targetRef: React.RefObject<HTMLElement>;
41
- }): import("react/jsx-runtime").JSX.Element;
42
30
  export {};
@@ -1,7 +1,7 @@
1
1
  import type { CollectionChildren } from '@react-types/shared';
2
2
  import React from 'react';
3
3
  import { useMultiSelectState } from './useMultiSelectState';
4
- export { Item as MultiSelectItem, Section as MultiSelectSection, } from '@react-stately/collections';
4
+ export { Item as MultiSelectItem, Section as MultiSelectSection } from '@react-stately/collections';
5
5
  export type OptionItem = {
6
6
  children?: never;
7
7
  id: string;
@@ -29,7 +29,7 @@ type MultiSelectProps = {
29
29
  /** The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with. */
30
30
  disabledKeys?: Parameters<typeof useMultiSelectState>['0']['disabledKeys'];
31
31
  excludeFromTabOrder?: boolean;
32
- items: Option[];
32
+ items?: Option[];
33
33
  /** Whether the field can be emptied. */
34
34
  isClearable?: boolean;
35
35
  /** Whether the field is disabled. */
@@ -42,6 +42,7 @@ type MultiSelectProps = {
42
42
  isOpen?: boolean;
43
43
  /** The content to display as the label. */
44
44
  label?: string;
45
+ boldLabel?: boolean;
45
46
  /** The content to display as the placeholder. */
46
47
  placeholder?: string;
47
48
  /** Handler that is called when the select's open state changes. */
@@ -57,8 +58,15 @@ type MultiSelectProps = {
57
58
  isInvalid?: boolean;
58
59
  errorMessage?: string;
59
60
  };
60
- export declare const MultiSelectComponent: React.ForwardRefExoticComponent<MultiSelectProps & React.RefAttributes<HTMLButtonElement>>;
61
- export declare const MultiSelect: React.ForwardRefExoticComponent<MultiSelectProps & {
62
- /** Item objects in the collection. */
63
- options: Option[];
64
- } & React.RefAttributes<HTMLButtonElement>>;
61
+ export declare const MultiSelectComponent: {
62
+ (props: MultiSelectProps): import("react/jsx-runtime").JSX.Element;
63
+ displayName: string;
64
+ };
65
+ type MultiSelectContainerProps = Omit<MultiSelectProps, 'children'> & {
66
+ items?: OptionItem[];
67
+ children?: CollectionChildren<Option>;
68
+ };
69
+ export declare const MultiSelect: {
70
+ ({ items, ...props }: MultiSelectContainerProps): import("react/jsx-runtime").JSX.Element;
71
+ displayName: string;
72
+ };
@@ -1,12 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  import { type AriaSearchFieldProps } from '@react-aria/searchfield';
3
3
  export declare const Search: import("react").ForwardRefExoticComponent<{
4
+ boldLabel?: boolean | undefined;
4
5
  size: 'small' | 'large';
5
6
  leadingIcon?: boolean | undefined;
6
7
  hideLabel?: boolean | undefined;
8
+ hideIcon?: boolean | undefined;
7
9
  height?: string | undefined;
8
10
  } & Omit<AriaSearchFieldProps, "isDisabled" | "isRequired" | "isReadOnly"> & {
9
11
  disabled?: boolean | undefined;
10
- required?: unknown;
12
+ required?: boolean | undefined;
11
13
  readOnly?: boolean | undefined;
12
14
  } & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,5 +1,7 @@
1
1
  import type { AriaSelectProps } from '@react-types/select';
2
- export { Item as SingleSelectItem, Section as SingleSelectSection, } from '@react-stately/collections';
2
+ import type { CollectionChildren } from '@react-types/shared';
3
+ import * as React from 'react';
4
+ export { Item as SingleSelectItem, Section as SingleSelectSection } from '@react-stately/collections';
3
5
  type SingleSelectProps<T> = AriaSelectProps<T> & {
4
6
  placeholder?: string;
5
7
  tooltipIcon?: string;
@@ -11,8 +13,29 @@ type PlaceholderProps = {
11
13
  fontSize?: number | string;
12
14
  };
13
15
  export declare const Placeholder: import("styled-components").StyledComponent<"span", any, PlaceholderProps, never>;
14
- export declare function SingleSelect<T extends object>(props: SingleSelectProps<T> & {
15
- hideLabel?: boolean | undefined;
16
- errorMessage?: string;
17
- isInvalid: boolean;
18
- }): import("react/jsx-runtime").JSX.Element;
16
+ export declare const TriggerButton: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<{
17
+ 'data-id'?: string | undefined;
18
+ children?: React.ReactNode;
19
+ tabIndex?: number | undefined;
20
+ cursor?: string | undefined;
21
+ } & import("..").BoxProps & React.RefAttributes<HTMLDivElement>>, any, {
22
+ as: string;
23
+ } & TriggerButtonProps, "as">;
24
+ export interface TriggerButtonProps {
25
+ isOpen?: boolean;
26
+ }
27
+ type SingleSelectItemProps = {
28
+ key: string;
29
+ name: string;
30
+ };
31
+ declare const SingleSelect: {
32
+ <T extends object>(props: Omit<SingleSelectProps<T>, "children"> & {
33
+ boldLabel?: boolean | undefined;
34
+ hideLabel?: boolean | undefined;
35
+ errorMessage?: string | undefined;
36
+ isInvalid?: boolean | undefined;
37
+ children?: ((item: CollectionChildren<SingleSelectItemProps>) => React.ReactElement) | undefined;
38
+ }): import("react/jsx-runtime").JSX.Element;
39
+ displayName: string;
40
+ };
41
+ export { SingleSelect };
@@ -1 +1,3 @@
1
1
  export * from './useWindowEvent';
2
+ export * from './useOutsideClick';
3
+ export * from './usePrevious';
@@ -0,0 +1 @@
1
+ export declare const useOutsideClick: (ref: React.RefObject<HTMLElement>, onOutsideClick: () => void) => void;
@@ -0,0 +1,2 @@
1
+ declare function usePrevious<T>(value: any): T | undefined;
2
+ export default usePrevious;
package/types/index.d.ts CHANGED
@@ -1,2 +1,8 @@
1
+ import { type Node } from "@react-types/shared";
1
2
  export * from './components';
2
3
  export * from './helpers';
4
+ declare module '@react-stately/select' {
5
+ interface SingleSelectListState<T> {
6
+ selectedItem: Node<T> | null;
7
+ }
8
+ }
@@ -1,31 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import React from 'react';
3
- import * as SelectPrimitive from '@radix-ui/react-select';
4
- export declare const TriggerContent: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>>, any, {}, never>;
5
- export declare const DropdownContent: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>>, any, {}, never>;
6
- export interface TimeDateSelectOutput {
7
- day: number;
8
- month: number;
9
- year: number;
10
- hour: DatePart;
11
- minute: DatePart;
12
- second: DatePart;
13
- millisecond: DatePart;
14
- timeZone: string;
15
- }
16
- export interface TimeDateSelectProps {
17
- dateString?: string;
18
- defaultDateString?: string;
19
- timeZone: string;
20
- onChange?: (date: TimeDateSelectOutput) => void;
21
- }
22
- type DatePart = number | undefined;
23
- /**
24
- * @deprecated Please use DateInput instead
25
- */
26
- export declare const TimeDateSelect: React.ForwardRefExoticComponent<TimeDateSelectProps & React.RefAttributes<HTMLDivElement>>;
27
- export interface TimeDateSelectItemProps extends SelectPrimitive.SelectItemProps {
28
- children: ReactNode;
29
- }
30
- export declare const TimeDateSelectItem: React.ForwardRefExoticComponent<TimeDateSelectItemProps & React.RefAttributes<HTMLDivElement>>;
31
- export {};