Skip to content

Commit d424c4a

Browse files
authored
[♻️]: Refactor to cleanup apis (#97)
* Remove unnecessary children filtering * Update documentation * Update version
1 parent 269269c commit d424c4a

File tree

8 files changed

+14
-18
lines changed

8 files changed

+14
-18
lines changed

lib/Dialog/Dialog.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type OwnProps = {
5858
/**
5959
* Used to keep mounting when more control is needed.\
6060
* Useful when controlling animation with React animation libraries.
61+
*
6162
* @default false
6263
*/
6364
keepMounted?: boolean;

lib/Portal/Portal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type Props = {
1717
children: React.ReactNode;
1818
/**
1919
* If `true`, the `children` will be under the DOM hierarchy of the parent component.
20+
*
2021
* @default false
2122
*/
2223
disabled?: boolean;

lib/RadioGroup/RadioGroup.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type OwnProps = {
5252
};
5353
/**
5454
* The orientation of the group.
55+
*
5556
* @default "vertical"
5657
*/
5758
orientation?: "horizontal" | "vertical";

lib/TabGroup/TabGroup.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import * as React from "react";
2-
import { SystemError, logger } from "../internals";
2+
import { SystemError } from "../internals";
33
import type { MergeElementProps } from "../types";
44
import {
55
componentWithForwardedRef,
6-
isFragment,
76
useControlledProp,
87
useForkedRefs,
98
useIsMounted,
@@ -35,12 +34,14 @@ type OwnProps = {
3534
/**
3635
* Indicates whether the element's orientation is horizontal or vertical.
3736
* This effects the keyboard interactions.
37+
*
3838
* @default "horizontal"
3939
*/
4040
orientation?: "horizontal" | "vertical";
4141
/**
4242
* If `automatic`, tabs are automatically activated and their panel is displayed when they receive focus.
4343
* If `manual`, users activate a tab and display its panel by focusing them and pressing `Space` or `Enter`.
44+
*
4445
* @default "manual"
4546
*/
4647
keyboardActivationBehavior?: "manual" | "automatic";
@@ -53,7 +54,7 @@ export type Props = Omit<
5354

5455
const TabGroupBase = (props: Props, ref: React.Ref<HTMLDivElement>) => {
5556
const {
56-
children: childrenProp,
57+
children,
5758
className,
5859
onActiveTabChange,
5960
defaultActiveTab,
@@ -78,19 +79,6 @@ const TabGroupBase = (props: Props, ref: React.Ref<HTMLDivElement>) => {
7879
null,
7980
);
8081

81-
const children = React.Children.map(childrenProp, child => {
82-
if (!React.isValidElement(child) || isFragment(child)) {
83-
logger(
84-
"The <TabGroup.Root> component doesn't accept `Fragment` or any invalid element as children.",
85-
{ scope: "TabGroup", type: "error" },
86-
);
87-
88-
return null;
89-
}
90-
91-
return child as React.ReactElement;
92-
});
93-
9482
const handleChange = (tabValue: string) => {
9583
if (!isMounted()) return;
9684

lib/Toggle/Toggle.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,25 @@ type OwnProps = {
4646
value?: string;
4747
/**
4848
* If `true`, the toggle will be focused automatically.
49+
*
4950
* @default false
5051
*/
5152
autoFocus?: boolean;
5253
/**
5354
* If `true`, the toggle will be pressed.
55+
*
5456
* @default false
5557
*/
5658
pressed?: boolean;
5759
/**
5860
* The default state of `pressed`. Use when the component is not controlled.
61+
*
5962
* @default false
6063
*/
6164
defaultPressed?: boolean;
6265
/**
6366
* If `true`, the toggle will be disabled.
67+
*
6468
* @default false
6569
*/
6670
disabled?: boolean;

lib/ToggleGroup/ToggleGroup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export type Props = Omit<
5757
| {
5858
multiple: true;
5959
/**
60-
* The value of the active toggle.
60+
* The value of the active toggles.
6161
*/
6262
value?: string[];
6363
/**

lib/internals/FocusRedirect/FocusRedirect.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export type Props = {
1616
children: JSX.Element;
1717
/**
1818
* If `true`, the focus will be redirected here (once!).
19+
*
1920
* @default false
2021
*/
2122
enabled?: boolean;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@styleless-ui/react",
3-
"version": "1.0.0-rc.5",
3+
"version": "1.0.0-rc.6",
44
"description": "Completely unstyled, headless and accessible React UI components.",
55
"author": "mimshins <mostafa.sh.coderino@gmail.com>",
66
"license": "MIT",

0 commit comments

Comments
 (0)