Skip to content

Commit

Permalink
Allow any for value
Browse files Browse the repository at this point in the history
  • Loading branch information
mj12albert committed Dec 2, 2024
1 parent 7e9c9a9 commit 98746a3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/data/api/toggle-group-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": { "name": "func" },
"default": "NOOP",
"signature": {
"type": "function(groupValue: Array<string>, event: Event) => void",
"type": "function(groupValue: Array<any>, event: Event) => void",
"describedArgs": ["groupValue", "event"]
}
},
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/generated/toggle-group-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"description": "The open state of the ToggleGroup represented by an array of\nthe values of all pressed `<ToggleGroup.Item/>`s\nThis is the uncontrolled counterpart of `value`."
},
"onValueChange": {
"type": "function(groupValue: Array<string>, event: Event) => void",
"type": "function(groupValue: Array<any>, event: Event) => void",
"default": "NOOP",
"description": "Callback fired when the pressed states of the ToggleGroup changes."
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/toggle-group/root/ToggleGroupRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ ToggleGroupRoot.propTypes /* remove-proptypes */ = {
/**
* Callback fired when the pressed states of the ToggleGroup changes.
*
* @param {string[]} groupValue An array of the `value`s of all the pressed items.
* @param {any[]} groupValue An array of the `value`s of all the pressed items.
* @param {Event} event The event source of the callback.
*
* @default NOOP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import * as React from 'react';

export interface ToggleGroupRootContext {
value: readonly string[];
value: readonly any[];
setGroupValue: (newValue: string, nextPressed: boolean, event: Event) => void;
disabled: boolean;
}
Expand Down
12 changes: 6 additions & 6 deletions packages/react/src/toggle-group/root/useToggleGroupRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function useToggleGroupRoot(
});

const setGroupValue = useEventCallback((newValue: string, nextPressed: boolean, event: Event) => {
let newGroupValue: string[] | undefined;
let newGroupValue: any[] | undefined;
if (toggleMultiple) {
newGroupValue = groupValue.slice();
if (nextPressed) {
Expand Down Expand Up @@ -67,20 +67,20 @@ export namespace UseToggleGroupRoot {
* the values of all pressed `<ToggleGroup.Item/>`s
* This is the controlled counterpart of `defaultValue`.
*/
value?: readonly string[];
value?: readonly any[];
/**
* The open state of the ToggleGroup represented by an array of
* the values of all pressed `<ToggleGroup.Item/>`s
* This is the uncontrolled counterpart of `value`.
*/
defaultValue?: readonly string[];
defaultValue?: readonly any[];
/**
* Callback fired when the pressed states of the ToggleGroup changes.
*
* @param {string[]} groupValue An array of the `value`s of all the pressed items.
* @param {any[]} groupValue An array of the `value`s of all the pressed items.
* @param {Event} event The event source of the callback.
*/
onValueChange: (groupValue: string[], event: Event) => void;
onValueChange: (groupValue: any[], event: Event) => void;
/**
* When `true` the component is disabled
* @false
Expand Down Expand Up @@ -110,6 +110,6 @@ export namespace UseToggleGroupRoot {
* The value of the ToggleGroup represented by an array of values
* of the items that are pressed
*/
value: readonly string[];
value: readonly any[];
}
}

0 comments on commit 98746a3

Please sign in to comment.