Skip to content

Commit

Permalink
Comment headers (deephaven#2071)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Jun 12, 2024
1 parent b50841d commit 5f68de3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { PickerNormalizedPropsT } from './PickerProps';
import { usePickerScrollOnOpen } from './usePickerScrollOnOpen';
import { Section } from '../shared';

/** Props that are derived by `usePickerNormalizedProps` */
export type UsePickerNormalizedDerivedProps<THtml extends HTMLElement> = {
children: (itemOrSection: NormalizedItem | NormalizedSection) => JSX.Element;
forceRerenderKey: Key;
Expand All @@ -26,21 +27,27 @@ export type UsePickerNormalizedDerivedProps<THtml extends HTMLElement> = {
onOpenChange: (isOpen: boolean) => void;
};

/**
* Props that are passed through untouched. (should exclude all of the
* destructured props passed into `usePickerNormalizedProps` that are not in the
* spread ...props)
*/
export type UsePickerNormalizedPassthroughProps<TProps> = Omit<
PickerNormalizedPropsT<TProps>,
| 'normalizedItems'
| 'tooltip'
| 'selectedKey'
| 'defaultSelectedKey'
| 'disabledKeys'
| 'showItemIcons'
| 'getInitialScrollPosition'
| 'normalizedItems'
| 'onChange'
| 'onOpenChange'
| 'onScroll'
| 'onSelectionChange'
| 'selectedKey'
| 'showItemIcons'
| 'tooltip'
>;

/** Props passed to `usePickerNormalizedProps` hook. */
export type UsePickerNormalizedProps<
TProps,
THtml extends HTMLElement,
Expand All @@ -51,17 +58,17 @@ export function usePickerNormalizedProps<
TProps,
THtml extends HTMLElement = HTMLElement,
>({
normalizedItems,
tooltip = true,
selectedKey,
defaultSelectedKey,
disabledKeys,
showItemIcons,
getInitialScrollPosition,
normalizedItems,
onChange,
onOpenChange,
onScroll = EMPTY_FUNCTION,
onSelectionChange,
selectedKey,
showItemIcons,
tooltip = true,
...props
}: PickerNormalizedPropsT<TProps>): UsePickerNormalizedProps<TProps, THtml> {
const tooltipOptions = useMemo(
Expand Down
9 changes: 7 additions & 2 deletions packages/components/src/spectrum/picker/usePickerProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type { PickerPropsT } from './PickerProps';
import usePickerItemScale from './usePickerItemScale';
import usePickerScrollOnOpen from './usePickerScrollOnOpen';

/** Props that are derived. */
/** Props that are derived by `usePickerProps`. */
export type UsePickerDerivedProps<THtml extends HTMLElement> = {
children: (SectionElement<unknown> | ItemElement<unknown>)[];
defaultSelectedKey?: ItemKey | undefined;
Expand All @@ -28,7 +28,11 @@ export type UsePickerDerivedProps<THtml extends HTMLElement> = {
onSelectionChange: ((key: ItemKey | null) => void) | undefined;
};

/** Props that are passed through untouched. */
/**
* Props that are passed through untouched. (should exclude all of the
* destructured props passed into `usePickerProps` that are not in the spread
* ...props)
) */
export type UsePickerPassthroughProps<TProps> = Omit<
PickerPropsT<TProps>,
| 'children'
Expand All @@ -41,6 +45,7 @@ export type UsePickerPassthroughProps<TProps> = Omit<
| 'onSelectionChange'
>;

/** Props passed to `usePickerProps` hook. */
export type UsePickerProps<
TProps,
THtml extends HTMLElement,
Expand Down

0 comments on commit 5f68de3

Please sign in to comment.