Skip to content

Commit

Permalink
refactor(rac): infer types where possible
Browse files Browse the repository at this point in the history
Change-Id: I8d58f83c490cf32bcc697585ec96ad2ce17fe6f8
GitOrigin-RevId: f0e4f193b0755867ee6a9a87d2d3df3a4a99c37b
  • Loading branch information
sarahsga authored and actions-user committed Sep 24, 2024
1 parent 7e2b99b commit c9983b5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 20 deletions.
4 changes: 2 additions & 2 deletions plasmicpkgs/react-aria/src/registerButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function registerButton(
type: "boolean",
displayName: "Submits form?",
defaultValueHint: false,
hidden: (ps: BaseButtonProps) => Boolean(ps.resetsForm),
hidden: (props) => Boolean(props.resetsForm),
description:
"Whether clicking this button should submit the enclosing form.",
advanced: true,
Expand All @@ -103,7 +103,7 @@ export function registerButton(
type: "boolean",
displayName: "Resets form?",
defaultValueHint: false,
hidden: (ps: BaseButtonProps) => Boolean(ps.submitsForm),
hidden: (props) => Boolean(props.submitsForm),
description:
"Whether clicking this button should reset the enclosing form.",
advanced: true,
Expand Down
5 changes: 1 addition & 4 deletions plasmicpkgs/react-aria/src/registerComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ export function registerComboBox(loader?: Registerable) {
editOnly: true,
uncontrolledProp: "defaultSelectedKey",
displayName: "Initial selected key",
options: (
_props: BaseComboboxProps,
ctx: BaseComboboxControlContextData | null
) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),
options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),
// React Aria ComboBox do not support multiple comboBoxions yet
multiSelect: false,
},
Expand Down
5 changes: 1 addition & 4 deletions plasmicpkgs/react-aria/src/registerPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,7 @@ export function registerPopover(
type: "boolean",
description:
"Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.",
defaultValueHint: (
_ps: BasePopoverProps,
ctx: PopoverControlContextData | null
) => ctx?.defaultShouldFlip ?? true,
defaultValueHint: (_props, ctx) => ctx?.defaultShouldFlip ?? true,
},
placement: {
type: "choice",
Expand Down
12 changes: 3 additions & 9 deletions plasmicpkgs/react-aria/src/registerSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function registerSelect(loader?: Registerable) {
value: "Selected value...",
},
],
hidden: (ps) => !ps.customize,
hidden: (props) => !props.customize,
},
className: {
type: "class",
Expand Down Expand Up @@ -169,10 +169,7 @@ export function registerSelect(loader?: Registerable) {
editOnly: true,
uncontrolledProp: "defaultSelectedKey",
displayName: "Initial selected key",
options: (
_props: BaseSelectProps,
ctx: BaseSelectControlContextData | null
) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),
options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),
// React Aria Select do not support multiple selections yet
multiSelect: false,
},
Expand All @@ -184,10 +181,7 @@ export function registerSelect(loader?: Registerable) {
type: "choice",
description:
"The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.",
options: (
_props: BaseSelectProps,
ctx: BaseSelectControlContextData | null
) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),
options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),
multiSelect: true,
advanced: true,
},
Expand Down
2 changes: 1 addition & 1 deletion plasmicpkgs/react-aria/src/registerSliderThumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function registerSliderThumb(
children: {
type: "slot",
mergeWithParent: true,
hidden: (ps: BaseSliderThumbProps) => !ps.advanced,
hidden: (props) => !props.advanced,
},
},
trapsFocus: true,
Expand Down

0 comments on commit c9983b5

Please sign in to comment.