From 101b98d3e14a220fe6fde8ae943baecca23baf10 Mon Sep 17 00:00:00 2001 From: Haz Date: Tue, 14 Jul 2020 01:56:15 -0300 Subject: [PATCH] feat: Add stable `id.setBaseId` method --- packages/reakit/src/Composite/__keys.ts | 2 +- packages/reakit/src/Dialog/__keys.ts | 2 +- packages/reakit/src/Disclosure/__keys.ts | 2 +- packages/reakit/src/Form/__keys.ts | 2 +- packages/reakit/src/Grid/__keys.ts | 2 +- packages/reakit/src/Id/IdState.ts | 5 ++--- packages/reakit/src/Id/__keys.ts | 6 +----- packages/reakit/src/Menu/__keys.ts | 2 +- packages/reakit/src/Popover/__keys.ts | 2 +- packages/reakit/src/Radio/__keys.ts | 2 +- packages/reakit/src/Rover/__keys.ts | 2 +- packages/reakit/src/Tab/__keys.ts | 2 +- packages/reakit/src/Toolbar/__keys.ts | 2 +- packages/reakit/src/Tooltip/__keys.ts | 2 +- 14 files changed, 15 insertions(+), 20 deletions(-) diff --git a/packages/reakit/src/Composite/__keys.ts b/packages/reakit/src/Composite/__keys.ts index 88c16132a0..a4c8a24aad 100644 --- a/packages/reakit/src/Composite/__keys.ts +++ b/packages/reakit/src/Composite/__keys.ts @@ -2,7 +2,7 @@ const COMPOSITE_STATE_KEYS = [ "baseId", "unstable_idCountRef", - "unstable_setBaseId", + "setBaseId", "unstable_virtual", "rtl", "orientation", diff --git a/packages/reakit/src/Dialog/__keys.ts b/packages/reakit/src/Dialog/__keys.ts index 71068cdb18..d4186a8d34 100644 --- a/packages/reakit/src/Dialog/__keys.ts +++ b/packages/reakit/src/Dialog/__keys.ts @@ -5,7 +5,7 @@ const DIALOG_STATE_KEYS = [ "visible", "animated", "animating", - "unstable_setBaseId", + "setBaseId", "show", "hide", "toggle", diff --git a/packages/reakit/src/Disclosure/__keys.ts b/packages/reakit/src/Disclosure/__keys.ts index a100de2258..69390ef069 100644 --- a/packages/reakit/src/Disclosure/__keys.ts +++ b/packages/reakit/src/Disclosure/__keys.ts @@ -5,7 +5,7 @@ const DISCLOSURE_STATE_KEYS = [ "visible", "animated", "animating", - "unstable_setBaseId", + "setBaseId", "show", "hide", "toggle", diff --git a/packages/reakit/src/Form/__keys.ts b/packages/reakit/src/Form/__keys.ts index 5135b4eaf1..596ead444a 100644 --- a/packages/reakit/src/Form/__keys.ts +++ b/packages/reakit/src/Form/__keys.ts @@ -11,7 +11,7 @@ const FORM_STATE_KEYS = [ "submitting", "submitSucceed", "submitFailed", - "unstable_setBaseId", + "setBaseId", "reset", "validate", "submit", diff --git a/packages/reakit/src/Grid/__keys.ts b/packages/reakit/src/Grid/__keys.ts index 43b3190403..4efae7b9e8 100644 --- a/packages/reakit/src/Grid/__keys.ts +++ b/packages/reakit/src/Grid/__keys.ts @@ -13,7 +13,7 @@ const GRID_STATE_KEYS = [ "unstable_moves", "unstable_angular", "unstable_hasActiveWidget", - "unstable_setBaseId", + "setBaseId", "registerItem", "unregisterItem", "registerGroup", diff --git a/packages/reakit/src/Id/IdState.ts b/packages/reakit/src/Id/IdState.ts index e0b65a8770..dcc587a721 100644 --- a/packages/reakit/src/Id/IdState.ts +++ b/packages/reakit/src/Id/IdState.ts @@ -20,7 +20,7 @@ export type unstable_IdActions = { /** * Sets `baseId`. */ - unstable_setBaseId: React.Dispatch>; + setBaseId: React.Dispatch>; }; export type unstable_IdInitialState = Partial>; @@ -36,10 +36,9 @@ export function unstable_useIdState( const [baseId, setBaseId] = React.useState( () => initialBaseId || generateId() ); - return { baseId, - unstable_setBaseId: setBaseId, + setBaseId, unstable_idCountRef: idCountRef, }; } diff --git a/packages/reakit/src/Id/__keys.ts b/packages/reakit/src/Id/__keys.ts index c8110f7d1b..c43ca0e77a 100644 --- a/packages/reakit/src/Id/__keys.ts +++ b/packages/reakit/src/Id/__keys.ts @@ -1,7 +1,3 @@ // Automatically generated -const ID_STATE_KEYS = [ - "baseId", - "unstable_idCountRef", - "unstable_setBaseId", -] as const; +const ID_STATE_KEYS = ["baseId", "unstable_idCountRef", "setBaseId"] as const; export const ID_KEYS = [...ID_STATE_KEYS, "id"] as const; diff --git a/packages/reakit/src/Menu/__keys.ts b/packages/reakit/src/Menu/__keys.ts index 11ed03ae0d..a5c7cb0f31 100644 --- a/packages/reakit/src/Menu/__keys.ts +++ b/packages/reakit/src/Menu/__keys.ts @@ -14,7 +14,7 @@ const MENU_BAR_STATE_KEYS = [ "unstable_angular", "unstable_hasActiveWidget", "unstable_values", - "unstable_setBaseId", + "setBaseId", "registerItem", "unregisterItem", "registerGroup", diff --git a/packages/reakit/src/Popover/__keys.ts b/packages/reakit/src/Popover/__keys.ts index a8fd7dbe89..c24ce027c0 100644 --- a/packages/reakit/src/Popover/__keys.ts +++ b/packages/reakit/src/Popover/__keys.ts @@ -5,7 +5,7 @@ const POPOVER_STATE_KEYS = [ "visible", "animated", "animating", - "unstable_setBaseId", + "setBaseId", "show", "hide", "toggle", diff --git a/packages/reakit/src/Radio/__keys.ts b/packages/reakit/src/Radio/__keys.ts index 67412fd07f..0135b8352c 100644 --- a/packages/reakit/src/Radio/__keys.ts +++ b/packages/reakit/src/Radio/__keys.ts @@ -14,7 +14,7 @@ const RADIO_STATE_KEYS = [ "unstable_angular", "unstable_hasActiveWidget", "state", - "unstable_setBaseId", + "setBaseId", "registerItem", "unregisterItem", "registerGroup", diff --git a/packages/reakit/src/Rover/__keys.ts b/packages/reakit/src/Rover/__keys.ts index 73cfca6b5f..717cd7a3e3 100644 --- a/packages/reakit/src/Rover/__keys.ts +++ b/packages/reakit/src/Rover/__keys.ts @@ -8,7 +8,7 @@ const ROVER_STATE_KEYS = [ "unstable_pastId", "unstable_moves", "loop", - "unstable_setBaseId", + "setBaseId", "register", "unregister", "move", diff --git a/packages/reakit/src/Tab/__keys.ts b/packages/reakit/src/Tab/__keys.ts index c7163ef06f..6a00dcebf2 100644 --- a/packages/reakit/src/Tab/__keys.ts +++ b/packages/reakit/src/Tab/__keys.ts @@ -16,7 +16,7 @@ const TAB_STATE_KEYS = [ "selectedId", "panels", "manual", - "unstable_setBaseId", + "setBaseId", "registerItem", "unregisterItem", "registerGroup", diff --git a/packages/reakit/src/Toolbar/__keys.ts b/packages/reakit/src/Toolbar/__keys.ts index e0ab582a53..e24895bcdd 100644 --- a/packages/reakit/src/Toolbar/__keys.ts +++ b/packages/reakit/src/Toolbar/__keys.ts @@ -13,7 +13,7 @@ const TOOLBAR_STATE_KEYS = [ "unstable_moves", "unstable_angular", "unstable_hasActiveWidget", - "unstable_setBaseId", + "setBaseId", "registerItem", "unregisterItem", "registerGroup", diff --git a/packages/reakit/src/Tooltip/__keys.ts b/packages/reakit/src/Tooltip/__keys.ts index d8ed3efb96..e1d3ccdd7b 100644 --- a/packages/reakit/src/Tooltip/__keys.ts +++ b/packages/reakit/src/Tooltip/__keys.ts @@ -5,7 +5,7 @@ const TOOLTIP_STATE_KEYS = [ "visible", "animated", "animating", - "unstable_setBaseId", + "setBaseId", "show", "hide", "toggle",