@os-design/core 1.0.304 → 1.0.305
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Alert/index.d.ts +3 -2
- package/dist/Alert/index.d.ts.map +1 -1
- package/dist/Alert/index.js +1 -1
- package/dist/Avatar/index.d.ts +3 -2
- package/dist/Avatar/index.d.ts.map +1 -1
- package/dist/Avatar/index.js +1 -1
- package/dist/AvatarSkeleton/index.d.ts +3 -2
- package/dist/AvatarSkeleton/index.d.ts.map +1 -1
- package/dist/AvatarSkeleton/index.js +1 -1
- package/dist/Badge/index.d.ts +3 -2
- package/dist/Badge/index.d.ts.map +1 -1
- package/dist/Badge/index.js +1 -1
- package/dist/Breadcrumb/index.d.ts +1 -1
- package/dist/Breadcrumb/index.d.ts.map +1 -1
- package/dist/Breadcrumb/index.js +10 -6
- package/dist/Button/index.d.ts +1 -1
- package/dist/Button/index.d.ts.map +1 -1
- package/dist/ButtonLink/index.d.ts +183 -168
- package/dist/ButtonLink/index.d.ts.map +1 -1
- package/dist/ButtonLink/index.js +1 -1
- package/dist/Checkbox/index.d.ts +3 -2
- package/dist/Checkbox/index.d.ts.map +1 -1
- package/dist/Checkbox/index.js +1 -1
- package/dist/CheckboxSkeleton/index.d.ts +3 -2
- package/dist/CheckboxSkeleton/index.d.ts.map +1 -1
- package/dist/CheckboxSkeleton/index.js +1 -1
- package/dist/DateCalendar/Calendar.d.ts.map +1 -1
- package/dist/DateCalendar/index.d.ts +3 -2
- package/dist/DateCalendar/index.d.ts.map +1 -1
- package/dist/DateCalendar/index.js +2 -1
- package/dist/DatePicker/index.d.ts +4 -4
- package/dist/DatePicker/index.d.ts.map +1 -1
- package/dist/DatePicker/index.js +2 -1
- package/dist/Drawer/index.d.ts +1 -1
- package/dist/Drawer/index.d.ts.map +1 -1
- package/dist/Form/index.d.ts +3 -2
- package/dist/Form/index.d.ts.map +1 -1
- package/dist/Form/index.js +1 -1
- package/dist/FormDivider/index.d.ts +3 -2
- package/dist/FormDivider/index.d.ts.map +1 -1
- package/dist/FormDivider/index.js +1 -1
- package/dist/FormItem/index.d.ts +3 -2
- package/dist/FormItem/index.d.ts.map +1 -1
- package/dist/FormItem/index.js +4 -2
- package/dist/Gallery/index.d.ts +1 -1
- package/dist/Gallery/index.d.ts.map +1 -1
- package/dist/Gallery/index.js +1 -0
- package/dist/Image/index.d.ts +3 -2
- package/dist/Image/index.d.ts.map +1 -1
- package/dist/Image/index.js +1 -1
- package/dist/Input/index.d.ts +2 -2
- package/dist/Input/index.d.ts.map +1 -1
- package/dist/InputDateUnstyled/index.d.ts +3 -2
- package/dist/InputDateUnstyled/index.d.ts.map +1 -1
- package/dist/InputDateUnstyled/index.js +2 -2
- package/dist/InputNumber/index.d.ts.map +1 -1
- package/dist/InputSearch/index.d.ts.map +1 -1
- package/dist/Link/index.d.ts +1 -1
- package/dist/Link/index.d.ts.map +1 -1
- package/dist/LinkButton/index.d.ts +3 -2
- package/dist/LinkButton/index.d.ts.map +1 -1
- package/dist/LinkButton/index.js +1 -1
- package/dist/List/WindowScroller.js +1 -1
- package/dist/ListItemActions/index.d.ts +1 -1
- package/dist/ListItemActions/index.d.ts.map +1 -1
- package/dist/ListItemActions/index.js +1 -0
- package/dist/ListItemLink/index.d.ts +3 -2
- package/dist/ListItemLink/index.d.ts.map +1 -1
- package/dist/ListItemLink/index.js +1 -1
- package/dist/ListItemSkeleton/index.d.ts.map +1 -1
- package/dist/ListSkeleton/index.d.ts.map +1 -1
- package/dist/LogoLink/index.d.ts +3 -2
- package/dist/LogoLink/index.d.ts.map +1 -1
- package/dist/LogoLink/index.js +1 -1
- package/dist/Menu/index.d.ts.map +1 -1
- package/dist/Menu/index.js +3 -1
- package/dist/MenuDivider/index.d.ts +3 -2
- package/dist/MenuDivider/index.d.ts.map +1 -1
- package/dist/MenuDivider/index.js +1 -1
- package/dist/MenuGroup/index.d.ts +1 -1
- package/dist/MenuGroup/index.d.ts.map +1 -1
- package/dist/MenuItem/index.d.ts.map +1 -1
- package/dist/MenuItem/index.js +1 -1
- package/dist/Modal/index.d.ts +1 -1
- package/dist/Modal/index.d.ts.map +1 -1
- package/dist/Modal/index.js +6 -2
- package/dist/Navigation/index.d.ts +1 -1
- package/dist/Navigation/index.d.ts.map +1 -1
- package/dist/Navigation/utils/useScrollFlags.d.ts +1 -1
- package/dist/Navigation/utils/useScrollFlags.d.ts.map +1 -1
- package/dist/NavigationItem/index.d.ts +1 -1
- package/dist/NavigationItem/index.d.ts.map +1 -1
- package/dist/PageContent/index.d.ts +3 -2
- package/dist/PageContent/index.d.ts.map +1 -1
- package/dist/PageContent/index.js +1 -1
- package/dist/PageHeader/index.d.ts +1 -1
- package/dist/PageHeader/index.d.ts.map +1 -1
- package/dist/PageHeaderInputSearch/index.d.ts.map +1 -1
- package/dist/ParagraphSkeleton/index.d.ts.map +1 -1
- package/dist/ParagraphSkeleton/index.js +1 -0
- package/dist/Popover/index.d.ts +5 -5
- package/dist/Popover/index.d.ts.map +1 -1
- package/dist/Popover/index.js +4 -2
- package/dist/Progress/index.d.ts +3 -2
- package/dist/Progress/index.d.ts.map +1 -1
- package/dist/Progress/index.js +4 -2
- package/dist/RadioGroup/index.d.ts +3 -2
- package/dist/RadioGroup/index.d.ts.map +1 -1
- package/dist/RadioGroup/index.js +1 -1
- package/dist/Result/index.d.ts +1 -1
- package/dist/Result/index.d.ts.map +1 -1
- package/dist/ScrollButton/utils/useVisibility.d.ts.map +1 -1
- package/dist/ScrollButton/utils/useVisibility.js +1 -0
- package/dist/Select/index.d.ts +1 -1
- package/dist/Select/index.d.ts.map +1 -1
- package/dist/Select/index.js +3 -1
- package/dist/Skeleton/index.d.ts +3 -2
- package/dist/Skeleton/index.d.ts.map +1 -1
- package/dist/Skeleton/index.js +1 -1
- package/dist/Switch/index.d.ts +3 -2
- package/dist/Switch/index.d.ts.map +1 -1
- package/dist/Switch/index.js +1 -1
- package/dist/Tag/index.d.ts +1 -1
- package/dist/Tag/index.d.ts.map +1 -1
- package/dist/TagLink/index.d.ts +3 -2
- package/dist/TagLink/index.d.ts.map +1 -1
- package/dist/TagLink/index.js +1 -1
- package/dist/TagList/index.d.ts +3 -2
- package/dist/TagList/index.d.ts.map +1 -1
- package/dist/TagList/index.js +1 -1
- package/dist/TagListSkeleton/index.d.ts.map +1 -1
- package/dist/TagListSkeleton/index.js +1 -0
- package/dist/TagSkeleton/index.d.ts.map +1 -1
- package/dist/TextArea/index.d.ts +2 -2
- package/dist/TextArea/index.d.ts.map +1 -1
- package/dist/ThemeSwitcher/index.d.ts +29 -15
- package/dist/ThemeSwitcher/index.d.ts.map +1 -1
- package/dist/TimeGrid/index.d.ts +5 -4
- package/dist/TimeGrid/index.d.ts.map +1 -1
- package/dist/TimeGrid/index.js +1 -1
- package/dist/TimeList/index.d.ts +4 -3
- package/dist/TimeList/index.d.ts.map +1 -1
- package/dist/TimeList/index.js +1 -1
- package/dist/Video/index.d.ts +3 -2
- package/dist/Video/index.d.ts.map +1 -1
- package/dist/Video/index.js +1 -1
- package/package.json +15 -15
- package/src/Alert/index.tsx +2 -2
- package/src/Avatar/index.tsx +2 -2
- package/src/AvatarSkeleton/index.tsx +2 -2
- package/src/Badge/index.tsx +2 -2
- package/src/Breadcrumb/index.tsx +21 -17
- package/src/Button/index.tsx +5 -3
- package/src/ButtonLink/index.tsx +2 -2
- package/src/Checkbox/index.tsx +4 -3
- package/src/CheckboxSkeleton/index.tsx +2 -2
- package/src/DateCalendar/index.tsx +3 -2
- package/src/DatePicker/index.tsx +4 -3
- package/src/Drawer/index.tsx +1 -1
- package/src/Form/index.tsx +2 -2
- package/src/FormDivider/index.tsx +2 -2
- package/src/FormItem/index.tsx +3 -2
- package/src/Gallery/index.tsx +2 -1
- package/src/GlobalStyles/index.mdx +1 -1
- package/src/Image/index.tsx +2 -2
- package/src/Input/index.tsx +2 -2
- package/src/InputDateUnstyled/index.tsx +3 -3
- package/src/InputNumber/index.tsx +4 -2
- package/src/InputSearch/index.tsx +4 -2
- package/src/Link/index.tsx +1 -1
- package/src/LinkButton/index.tsx +2 -2
- package/src/List/WindowScroller.tsx +1 -1
- package/src/ListItemActions/index.tsx +2 -1
- package/src/ListItemLink/index.tsx +2 -2
- package/src/ListItemSkeleton/index.tsx +4 -2
- package/src/ListSkeleton/index.tsx +2 -1
- package/src/LogoLink/index.tsx +3 -6
- package/src/Menu/index.tsx +1 -0
- package/src/MenuDivider/index.tsx +2 -2
- package/src/MenuGroup/index.tsx +4 -3
- package/src/MenuItem/index.tsx +5 -3
- package/src/Modal/index.tsx +3 -1
- package/src/Navigation/index.tsx +1 -1
- package/src/Navigation/utils/useScrollFlags.ts +1 -1
- package/src/NavigationItem/index.tsx +2 -4
- package/src/PageContent/index.tsx +2 -2
- package/src/PageHeader/index.tsx +1 -1
- package/src/PageHeaderInputSearch/index.tsx +4 -2
- package/src/ParagraphSkeleton/index.tsx +1 -0
- package/src/Popover/index.tsx +7 -6
- package/src/Progress/index.tsx +3 -2
- package/src/RadioGroup/index.tsx +6 -4
- package/src/Result/index.tsx +1 -1
- package/src/ScrollButton/utils/useVisibility.ts +1 -0
- package/src/Select/index.tsx +3 -4
- package/src/Skeleton/index.tsx +2 -2
- package/src/Switch/index.tsx +2 -2
- package/src/Tag/index.tsx +1 -1
- package/src/TagLink/index.tsx +2 -2
- package/src/TagList/index.tsx +2 -2
- package/src/TagListSkeleton/index.tsx +1 -0
- package/src/TagSkeleton/index.tsx +1 -2
- package/src/TextArea/index.tsx +2 -2
- package/src/TimeGrid/index.tsx +2 -2
- package/src/TimeList/index.tsx +2 -2
- package/src/Video/index.tsx +2 -2
package/src/Input/index.tsx
CHANGED
|
@@ -21,7 +21,7 @@ import React, {
|
|
|
21
21
|
import getFocusableElements from './utils/getFocusableElements.js';
|
|
22
22
|
|
|
23
23
|
type JsxInputProps = Omit<
|
|
24
|
-
JSX.IntrinsicElements['input'],
|
|
24
|
+
React.JSX.IntrinsicElements['input'],
|
|
25
25
|
'value' | 'onChange' | 'size' | 'ref'
|
|
26
26
|
>;
|
|
27
27
|
export interface InputProps extends JsxInputProps, WithSize {
|
|
@@ -71,7 +71,7 @@ export interface InputProps extends JsxInputProps, WithSize {
|
|
|
71
71
|
* The props of the input container.
|
|
72
72
|
* @default undefined
|
|
73
73
|
*/
|
|
74
|
-
containerProps?: JSX.IntrinsicElements['div'];
|
|
74
|
+
containerProps?: React.JSX.IntrinsicElements['div'];
|
|
75
75
|
/**
|
|
76
76
|
* The input value.
|
|
77
77
|
* @default undefined
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import React, {
|
|
2
2
|
forwardRef,
|
|
3
3
|
useCallback,
|
|
4
4
|
useEffect,
|
|
@@ -37,7 +37,7 @@ export interface Selection {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
type JsxInputProps = Omit<
|
|
40
|
-
JSX.IntrinsicElements['input'],
|
|
40
|
+
React.JSX.IntrinsicElements['input'],
|
|
41
41
|
'value' | 'defaultValue' | 'onChange' | 'ref'
|
|
42
42
|
>;
|
|
43
43
|
|
|
@@ -432,7 +432,7 @@ const InputDateUnstyled = forwardRef<HTMLInputElement, InputDateUnstyledProps>(
|
|
|
432
432
|
const prev = prevToken(start, formatRef.current, tokens);
|
|
433
433
|
if (!prev) return;
|
|
434
434
|
|
|
435
|
-
let substr
|
|
435
|
+
let substr;
|
|
436
436
|
if (prev.token === 'aa') {
|
|
437
437
|
// Move the caret to the start of the meridiem token and erase
|
|
438
438
|
// all the characters of this token.
|
|
@@ -12,8 +12,10 @@ import defaultLocale, {
|
|
|
12
12
|
type InputNumberLocale,
|
|
13
13
|
} from './utils/defaultLocale.js';
|
|
14
14
|
|
|
15
|
-
export interface InputNumberProps
|
|
16
|
-
|
|
15
|
+
export interface InputNumberProps extends Omit<
|
|
16
|
+
InputProps,
|
|
17
|
+
'type' | 'value' | 'onChange'
|
|
18
|
+
> {
|
|
17
19
|
/**
|
|
18
20
|
* The minimum value.
|
|
19
21
|
* @default 0
|
|
@@ -10,8 +10,10 @@ import defaultLocale, {
|
|
|
10
10
|
type InputSearchLocale,
|
|
11
11
|
} from './utils/defaultLocale.js';
|
|
12
12
|
|
|
13
|
-
export interface InputSearchProps
|
|
14
|
-
|
|
13
|
+
export interface InputSearchProps extends Omit<
|
|
14
|
+
InputProps,
|
|
15
|
+
'type' | 'onChange'
|
|
16
|
+
> {
|
|
15
17
|
/**
|
|
16
18
|
* The locale.
|
|
17
19
|
* @default undefined
|
package/src/Link/index.tsx
CHANGED
|
@@ -15,7 +15,7 @@ export interface ReactRouterLinkProps {
|
|
|
15
15
|
replace?: boolean;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
type JsxAProps = Omit<JSX.IntrinsicElements['a'], 'ref'>;
|
|
18
|
+
type JsxAProps = Omit<React.JSX.IntrinsicElements['a'], 'ref'>;
|
|
19
19
|
export interface LinkProps extends JsxAProps, ReactRouterLinkProps, WithSize {
|
|
20
20
|
/**
|
|
21
21
|
* Type of the underline styles.
|
package/src/LinkButton/index.tsx
CHANGED
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
} from '@os-design/styles';
|
|
8
8
|
import { clr } from '@os-design/theming';
|
|
9
9
|
import { omitEmotionProps } from '@os-design/utils';
|
|
10
|
-
import { forwardRef } from 'react';
|
|
10
|
+
import React, { forwardRef } from 'react';
|
|
11
11
|
import {
|
|
12
12
|
DisabledWrapper,
|
|
13
13
|
underlineAlwaysStyles,
|
|
14
14
|
underlineHoverStyles,
|
|
15
15
|
} from '../Link/index.js';
|
|
16
16
|
|
|
17
|
-
type JsxButtonProps = Omit<JSX.IntrinsicElements['button'], 'ref'>;
|
|
17
|
+
type JsxButtonProps = Omit<React.JSX.IntrinsicElements['button'], 'ref'>;
|
|
18
18
|
|
|
19
19
|
export interface LinkButtonProps extends JsxButtonProps, WithSize {
|
|
20
20
|
/**
|
|
@@ -25,7 +25,7 @@ const WindowScroller: React.FC<WindowScrollerProps> = ({
|
|
|
25
25
|
onScroll = () => {},
|
|
26
26
|
children,
|
|
27
27
|
}) => {
|
|
28
|
-
const onScrollRef = useRef<WindowScrollerProps['onScroll']>();
|
|
28
|
+
const onScrollRef = useRef<WindowScrollerProps['onScroll']>(undefined);
|
|
29
29
|
|
|
30
30
|
useEffect(() => {
|
|
31
31
|
onScrollRef.current = onScroll;
|
|
@@ -21,7 +21,7 @@ export interface ListItemAction extends Omit<ButtonProps, 'type' | 'wide'> {
|
|
|
21
21
|
icon: React.ReactElement;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
type JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;
|
|
24
|
+
type JsxDivProps = Omit<React.JSX.IntrinsicElements['div'], 'ref'>;
|
|
25
25
|
export interface ListItemActionsProps extends JsxDivProps, WithSize {
|
|
26
26
|
/**
|
|
27
27
|
* Buttons to control the item.
|
|
@@ -158,6 +158,7 @@ const ListItemActions = forwardRef<HTMLDivElement, ListItemActionsProps>(
|
|
|
158
158
|
if (actions.length === 0) return null;
|
|
159
159
|
const items = actions.map(
|
|
160
160
|
({ icon, onClick = () => {}, ...actionRest }) => {
|
|
161
|
+
// eslint-disable-next-line react-hooks/globals
|
|
161
162
|
actionIndex += 1;
|
|
162
163
|
return (
|
|
163
164
|
<Button
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
2
|
import { resetFocusStyles } from '@os-design/styles';
|
|
3
3
|
import { clr, type Color } from '@os-design/theming';
|
|
4
|
-
import { forwardRef } from 'react';
|
|
4
|
+
import React, { forwardRef } from 'react';
|
|
5
5
|
import type { LinkProps, ReactRouterLinkProps } from '../Link/index.js';
|
|
6
6
|
import ListItem, { type ListItemProps } from '../ListItem/index.js';
|
|
7
7
|
|
|
8
|
-
type JsxAProps = Omit<JSX.IntrinsicElements['a'], 'ref'>;
|
|
8
|
+
type JsxAProps = Omit<React.JSX.IntrinsicElements['a'], 'ref'>;
|
|
9
9
|
export type ListItemLinkProps = JsxAProps &
|
|
10
10
|
ReactRouterLinkProps &
|
|
11
11
|
Pick<LinkProps, 'as'> &
|
|
@@ -3,8 +3,10 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import ListItem, { type ListItemProps } from '../ListItem/index.js';
|
|
4
4
|
import Skeleton from '../Skeleton/index.js';
|
|
5
5
|
|
|
6
|
-
export interface ListItemSkeletonProps
|
|
7
|
-
|
|
6
|
+
export interface ListItemSkeletonProps extends Omit<
|
|
7
|
+
ListItemProps,
|
|
8
|
+
'title' | 'description' | 'actions'
|
|
9
|
+
> {
|
|
8
10
|
/**
|
|
9
11
|
* The description placeholder.
|
|
10
12
|
* @default false
|
|
@@ -6,7 +6,8 @@ import ListItemSkeleton, {
|
|
|
6
6
|
} from '../ListItemSkeleton/index.js';
|
|
7
7
|
|
|
8
8
|
export interface ListSkeletonProps
|
|
9
|
-
extends
|
|
9
|
+
extends
|
|
10
|
+
Omit<ListProps, 'itemCount' | 'itemRenderer' | 'children'>,
|
|
10
11
|
Pick<
|
|
11
12
|
ListItemSkeletonProps,
|
|
12
13
|
| 'hasDescription'
|
package/src/LogoLink/index.tsx
CHANGED
|
@@ -8,15 +8,12 @@ import {
|
|
|
8
8
|
} from '@os-design/styles';
|
|
9
9
|
import { useTheme } from '@os-design/theming';
|
|
10
10
|
import { omitEmotionProps } from '@os-design/utils';
|
|
11
|
-
import { forwardRef } from 'react';
|
|
11
|
+
import React, { forwardRef } from 'react';
|
|
12
12
|
import type { LinkProps, ReactRouterLinkProps } from '../Link/index.js';
|
|
13
13
|
|
|
14
|
-
type JsxAProps = Omit<JSX.IntrinsicElements['a'], 'ref'>;
|
|
14
|
+
type JsxAProps = Omit<React.JSX.IntrinsicElements['a'], 'ref'>;
|
|
15
15
|
export interface LogoLinkProps
|
|
16
|
-
extends JsxAProps,
|
|
17
|
-
ReactRouterLinkProps,
|
|
18
|
-
Pick<LinkProps, 'as'>,
|
|
19
|
-
WithSize {
|
|
16
|
+
extends JsxAProps, ReactRouterLinkProps, Pick<LinkProps, 'as'>, WithSize {
|
|
20
17
|
/**
|
|
21
18
|
* The source of the logo image.
|
|
22
19
|
*/
|
package/src/Menu/index.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
2
|
import { clr } from '@os-design/theming';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
4
|
|
|
5
|
-
export type MenuDividerProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;
|
|
5
|
+
export type MenuDividerProps = Omit<React.JSX.IntrinsicElements['div'], 'ref'>;
|
|
6
6
|
|
|
7
7
|
const Container = styled.div`
|
|
8
8
|
padding-top: 0.4em;
|
package/src/MenuGroup/index.tsx
CHANGED
|
@@ -5,10 +5,10 @@ import { ellipsisStyles } from '@os-design/styles';
|
|
|
5
5
|
import { clr } from '@os-design/theming';
|
|
6
6
|
import { useForwardedState } from '@os-design/utils';
|
|
7
7
|
import React, { forwardRef, useCallback, useContext, useMemo } from 'react';
|
|
8
|
-
import MenuItem from '../MenuItem/index.js';
|
|
8
|
+
import MenuItem, { type MenuItemProps } from '../MenuItem/index.js';
|
|
9
9
|
|
|
10
10
|
type JsxDivProps = Omit<
|
|
11
|
-
JSX.IntrinsicElements['div'],
|
|
11
|
+
React.JSX.IntrinsicElements['div'],
|
|
12
12
|
'defaultValue' | 'value' | 'onChange' | 'ref'
|
|
13
13
|
>;
|
|
14
14
|
interface BaseMenuGroupProps<T> extends JsxDivProps {
|
|
@@ -138,7 +138,8 @@ const MenuGroup = forwardRef<HTMLDivElement, MenuGroupProps>(
|
|
|
138
138
|
React.Children.map(children, (child) => {
|
|
139
139
|
if (!React.isValidElement(child) || child.type !== MenuItem)
|
|
140
140
|
return child;
|
|
141
|
-
const { value: childValue, onClick: childOnClick } =
|
|
141
|
+
const { value: childValue, onClick: childOnClick } =
|
|
142
|
+
child.props as MenuItemProps;
|
|
142
143
|
const selected =
|
|
143
144
|
(multiple && (forwardedValue || []).includes(childValue)) ||
|
|
144
145
|
(!multiple && forwardedValue === childValue);
|
package/src/MenuItem/index.tsx
CHANGED
|
@@ -8,8 +8,10 @@ import { omitEmotionProps } from '@os-design/utils';
|
|
|
8
8
|
import { forwardRef, useCallback, useContext, useEffect, useRef } from 'react';
|
|
9
9
|
import Button, { type ButtonProps } from '../Button/index.js';
|
|
10
10
|
|
|
11
|
-
export interface MenuItemProps
|
|
12
|
-
|
|
11
|
+
export interface MenuItemProps extends Omit<
|
|
12
|
+
ButtonProps,
|
|
13
|
+
'type' | 'wide' | 'size'
|
|
14
|
+
> {
|
|
13
15
|
/**
|
|
14
16
|
* Whether the menu item is selected.
|
|
15
17
|
* @default false
|
|
@@ -63,7 +65,7 @@ const SelectedIcon = styled(Check)`
|
|
|
63
65
|
const MenuItem = forwardRef<HTMLButtonElement, MenuItemProps>(
|
|
64
66
|
({ selected = false, value, right, onClick = () => {}, ...rest }, ref) => {
|
|
65
67
|
const { closeOnSelect, onClose } = useContext(MenuContext);
|
|
66
|
-
const onClickRef = useRef<MenuItemProps['onClick']>();
|
|
68
|
+
const onClickRef = useRef<MenuItemProps['onClick']>(undefined);
|
|
67
69
|
|
|
68
70
|
useEffect(() => {
|
|
69
71
|
onClickRef.current = onClick;
|
package/src/Modal/index.tsx
CHANGED
|
@@ -24,7 +24,7 @@ import FocusLock from 'react-focus-lock';
|
|
|
24
24
|
import Button from '../Button/index.js';
|
|
25
25
|
import defaultLocale, { type ModalLocale } from './utils/defaultLocale.js';
|
|
26
26
|
|
|
27
|
-
type JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;
|
|
27
|
+
type JsxDivProps = Omit<React.JSX.IntrinsicElements['div'], 'ref'>;
|
|
28
28
|
export interface ModalProps extends JsxDivProps, WithSize {
|
|
29
29
|
/**
|
|
30
30
|
* The title of the modal.
|
|
@@ -312,10 +312,12 @@ const Modal = forwardRef<HTMLDivElement, ModalProps>(
|
|
|
312
312
|
useBodyScroll(!visible);
|
|
313
313
|
|
|
314
314
|
const titleId = useMemo(
|
|
315
|
+
// eslint-disable-next-line react-hooks/purity
|
|
315
316
|
() => `modal-title-${Math.random().toString(36).slice(2, 11)}`,
|
|
316
317
|
[]
|
|
317
318
|
);
|
|
318
319
|
const bodyId = useMemo(
|
|
320
|
+
// eslint-disable-next-line react-hooks/purity
|
|
319
321
|
() => id || `modal-body-${Math.random().toString(36).slice(2, 11)}`,
|
|
320
322
|
[id]
|
|
321
323
|
);
|
package/src/Navigation/index.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { omitEmotionProps } from '@os-design/utils';
|
|
|
7
7
|
import React, { forwardRef, useRef } from 'react';
|
|
8
8
|
import useScrollFlags from './utils/useScrollFlags.js';
|
|
9
9
|
|
|
10
|
-
type JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;
|
|
10
|
+
type JsxDivProps = Omit<React.JSX.IntrinsicElements['div'], 'ref'>;
|
|
11
11
|
export interface NavigationProps extends JsxDivProps {
|
|
12
12
|
/**
|
|
13
13
|
* The top component in the side navigator.
|
|
@@ -7,7 +7,7 @@ interface UseScrollFlagsRes {
|
|
|
7
7
|
hasNext: boolean;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const useScrollFlags = (ref: RefObject<Element>): UseScrollFlagsRes => {
|
|
10
|
+
const useScrollFlags = (ref: RefObject<Element | null>): UseScrollFlagsRes => {
|
|
11
11
|
const [hasPrev, setHasPrev] = useState(false);
|
|
12
12
|
const [hasNext, setHasNext] = useState(false);
|
|
13
13
|
const isMinMd = useIsMinWidth('md');
|
|
@@ -7,11 +7,9 @@ import { omitEmotionProps } from '@os-design/utils';
|
|
|
7
7
|
import React, { forwardRef } from 'react';
|
|
8
8
|
import type { LinkProps, ReactRouterLinkProps } from '../Link/index.js';
|
|
9
9
|
|
|
10
|
-
type JsxAProps = Omit<JSX.IntrinsicElements['a'], 'ref'>;
|
|
10
|
+
type JsxAProps = Omit<React.JSX.IntrinsicElements['a'], 'ref'>;
|
|
11
11
|
export interface NavigationItemProps
|
|
12
|
-
extends JsxAProps,
|
|
13
|
-
ReactRouterLinkProps,
|
|
14
|
-
Pick<LinkProps, 'as'> {
|
|
12
|
+
extends JsxAProps, ReactRouterLinkProps, Pick<LinkProps, 'as'> {
|
|
15
13
|
/**
|
|
16
14
|
* The icon of the item.
|
|
17
15
|
* @default undefined
|
|
@@ -3,10 +3,10 @@ import styled from '@emotion/styled';
|
|
|
3
3
|
import { m } from '@os-design/media';
|
|
4
4
|
import { horizontalPaddingStyles } from '@os-design/styles';
|
|
5
5
|
import { omitEmotionProps } from '@os-design/utils';
|
|
6
|
-
import { forwardRef, useContext } from 'react';
|
|
6
|
+
import React, { forwardRef, useContext } from 'react';
|
|
7
7
|
import LayoutContext from '../Layout/LayoutContext.js';
|
|
8
8
|
|
|
9
|
-
type JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;
|
|
9
|
+
type JsxDivProps = Omit<React.JSX.IntrinsicElements['div'], 'ref'>;
|
|
10
10
|
export interface PageContentProps extends JsxDivProps {
|
|
11
11
|
/**
|
|
12
12
|
* Whether there is the list in the page content.
|
package/src/PageHeader/index.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import Button from '../Button/index.js';
|
|
|
10
10
|
import LayoutContext from '../Layout/LayoutContext.js';
|
|
11
11
|
import defaultLocale, { type PageHeaderLocale } from './utils/defaultLocale.js';
|
|
12
12
|
|
|
13
|
-
type JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;
|
|
13
|
+
type JsxDivProps = Omit<React.JSX.IntrinsicElements['div'], 'ref'>;
|
|
14
14
|
export interface PageHeaderProps extends JsxDivProps {
|
|
15
15
|
/**
|
|
16
16
|
* The title of the page.
|
|
@@ -12,8 +12,10 @@ import defaultLocale, {
|
|
|
12
12
|
type PageHeaderInputSearchLocale,
|
|
13
13
|
} from './utils/defaultLocale.js';
|
|
14
14
|
|
|
15
|
-
export interface PageHeaderInputSearchProps
|
|
16
|
-
|
|
15
|
+
export interface PageHeaderInputSearchProps extends Omit<
|
|
16
|
+
InputSearchProps,
|
|
17
|
+
'size' | 'locale'
|
|
18
|
+
> {
|
|
17
19
|
/**
|
|
18
20
|
* The locale.
|
|
19
21
|
* @default undefined
|
|
@@ -48,6 +48,7 @@ const ParagraphSkeleton = forwardRef<HTMLDivElement, ParagraphSkeletonProps>(
|
|
|
48
48
|
{Array(rows)
|
|
49
49
|
.fill(0)
|
|
50
50
|
.map((_, index) => {
|
|
51
|
+
// eslint-disable-next-line react-hooks/globals
|
|
51
52
|
key += 1;
|
|
52
53
|
return (
|
|
53
54
|
<Skeleton key={key} width={index < rows - 1 ? '100%' : width} />
|
package/src/Popover/index.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
useForwardedRef,
|
|
13
13
|
useResizeObserver,
|
|
14
14
|
} from '@os-design/utils';
|
|
15
|
-
import {
|
|
15
|
+
import React, {
|
|
16
16
|
forwardRef,
|
|
17
17
|
type RefCallback,
|
|
18
18
|
type RefObject,
|
|
@@ -28,18 +28,18 @@ import usePopoverPosition, {
|
|
|
28
28
|
type Size,
|
|
29
29
|
} from './utils/usePopoverPosition.js';
|
|
30
30
|
|
|
31
|
-
type JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;
|
|
31
|
+
type JsxDivProps = Omit<React.JSX.IntrinsicElements['div'], 'ref'>;
|
|
32
32
|
export interface PopoverProps extends JsxDivProps, WithSize {
|
|
33
33
|
/**
|
|
34
34
|
* Where the popover will be rendered.
|
|
35
35
|
* @default document.body
|
|
36
36
|
*/
|
|
37
|
-
container?: RefObject<Element> | Element | null;
|
|
37
|
+
container?: RefObject<Element | null> | Element | null;
|
|
38
38
|
/**
|
|
39
39
|
* The element next to which the popover appears.
|
|
40
40
|
* @default undefined
|
|
41
41
|
*/
|
|
42
|
-
trigger?: RefObject<Element> | Element | Rect | null;
|
|
42
|
+
trigger?: RefObject<Element | null> | Element | Rect | null;
|
|
43
43
|
/**
|
|
44
44
|
* On which side of the element the popover will appear.
|
|
45
45
|
* @default top
|
|
@@ -185,7 +185,7 @@ const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
185
185
|
}, [popoverRef]);
|
|
186
186
|
useResizeObserver(popoverRef.current, popoverResizeListener);
|
|
187
187
|
|
|
188
|
-
const containerRef = useMemo<RefObject<Element>>(() => {
|
|
188
|
+
const containerRef = useMemo<RefObject<Element | null>>(() => {
|
|
189
189
|
if (typeof window === 'undefined') {
|
|
190
190
|
return { current: null };
|
|
191
191
|
}
|
|
@@ -249,7 +249,7 @@ const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
249
249
|
containerListener
|
|
250
250
|
);
|
|
251
251
|
|
|
252
|
-
const triggerRef = useMemo<RefObject<Element>>(() => {
|
|
252
|
+
const triggerRef = useMemo<RefObject<Element | null>>(() => {
|
|
253
253
|
if (!trigger || 'top' in trigger) {
|
|
254
254
|
return { current: null };
|
|
255
255
|
}
|
|
@@ -283,6 +283,7 @@ const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
283
283
|
|
|
284
284
|
// Set the aria tags to support accessibility features
|
|
285
285
|
const popoverId = useMemo(
|
|
286
|
+
// eslint-disable-next-line react-hooks/purity
|
|
286
287
|
() => id || `popover-${Math.random().toString(36).slice(2, 11)}`,
|
|
287
288
|
[id]
|
|
288
289
|
);
|
package/src/Progress/index.tsx
CHANGED
|
@@ -2,9 +2,9 @@ import styled from '@emotion/styled';
|
|
|
2
2
|
import { type WithSize, sizeStyles, transitionStyles } from '@os-design/styles';
|
|
3
3
|
import { clr } from '@os-design/theming';
|
|
4
4
|
import { omitEmotionProps } from '@os-design/utils';
|
|
5
|
-
import { forwardRef, useMemo } from 'react';
|
|
5
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
type JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;
|
|
7
|
+
type JsxDivProps = Omit<React.JSX.IntrinsicElements['div'], 'ref'>;
|
|
8
8
|
export interface ProgressProps extends JsxDivProps, WithSize {
|
|
9
9
|
/**
|
|
10
10
|
* The percentage of completion.
|
|
@@ -71,6 +71,7 @@ const Progress = forwardRef<HTMLDivElement, ProgressProps>(
|
|
|
71
71
|
}, [percent]);
|
|
72
72
|
|
|
73
73
|
const textId = useMemo(
|
|
74
|
+
// eslint-disable-next-line react-hooks/purity
|
|
74
75
|
() => `progress-bar-text-${Math.random().toString(36).slice(2, 11)}`,
|
|
75
76
|
[]
|
|
76
77
|
);
|
package/src/RadioGroup/index.tsx
CHANGED
|
@@ -4,11 +4,13 @@ import { m } from '@os-design/media';
|
|
|
4
4
|
import type { WithSize } from '@os-design/styles';
|
|
5
5
|
import { clr } from '@os-design/theming';
|
|
6
6
|
import { omitEmotionProps, useForwardedState } from '@os-design/utils';
|
|
7
|
-
import { forwardRef } from 'react';
|
|
7
|
+
import React, { forwardRef } from 'react';
|
|
8
8
|
import Button, { type ButtonProps } from '../Button/index.js';
|
|
9
9
|
|
|
10
|
-
export interface RadioGroupOption
|
|
11
|
-
|
|
10
|
+
export interface RadioGroupOption extends Omit<
|
|
11
|
+
ButtonProps,
|
|
12
|
+
'type' | 'wide' | 'size'
|
|
13
|
+
> {
|
|
12
14
|
/**
|
|
13
15
|
* The title of the option.
|
|
14
16
|
*/
|
|
@@ -20,7 +22,7 @@ export interface RadioGroupOption
|
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
type JsxDivProps = Omit<
|
|
23
|
-
JSX.IntrinsicElements['div'],
|
|
25
|
+
React.JSX.IntrinsicElements['div'],
|
|
24
26
|
'value' | 'defaultValue' | 'onChange' | 'ref'
|
|
25
27
|
>;
|
|
26
28
|
export interface RadioGroupProps extends JsxDivProps, WithSize {
|
package/src/Result/index.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import { clr } from '@os-design/theming';
|
|
|
5
5
|
import { omitEmotionProps } from '@os-design/utils';
|
|
6
6
|
import React, { forwardRef } from 'react';
|
|
7
7
|
|
|
8
|
-
type JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;
|
|
8
|
+
type JsxDivProps = Omit<React.JSX.IntrinsicElements['div'], 'ref'>;
|
|
9
9
|
export interface ResultProps extends JsxDivProps, WithSize {
|
|
10
10
|
/**
|
|
11
11
|
* The title of the result.
|
package/src/Select/index.tsx
CHANGED
|
@@ -42,13 +42,11 @@ export interface Option extends MenuItemProps {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
type JsxDivProps = Omit<
|
|
45
|
-
JSX.IntrinsicElements['div'],
|
|
45
|
+
React.JSX.IntrinsicElements['div'],
|
|
46
46
|
'value' | 'defaultValue' | 'onChange' | 'ref'
|
|
47
47
|
>;
|
|
48
48
|
interface BaseSelectProps<T>
|
|
49
|
-
extends JsxDivProps,
|
|
50
|
-
WithSize,
|
|
51
|
-
Pick<PopoverProps, 'placement'> {
|
|
49
|
+
extends JsxDivProps, WithSize, Pick<PopoverProps, 'placement'> {
|
|
52
50
|
/**
|
|
53
51
|
* Options of the select.
|
|
54
52
|
* @default undefined
|
|
@@ -523,6 +521,7 @@ const Select = forwardRef<HTMLDivElement, SelectProps>(
|
|
|
523
521
|
}, []);
|
|
524
522
|
|
|
525
523
|
const listBoxId = useMemo(
|
|
524
|
+
// eslint-disable-next-line react-hooks/purity
|
|
526
525
|
() => `listbox-${Math.random().toString(36).slice(2, 11)}`,
|
|
527
526
|
[]
|
|
528
527
|
);
|
package/src/Skeleton/index.tsx
CHANGED
|
@@ -2,9 +2,9 @@ import { keyframes } from '@emotion/react';
|
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import { clr } from '@os-design/theming';
|
|
4
4
|
import { omitEmotionProps } from '@os-design/utils';
|
|
5
|
-
import { forwardRef } from 'react';
|
|
5
|
+
import React, { forwardRef } from 'react';
|
|
6
6
|
|
|
7
|
-
type JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;
|
|
7
|
+
type JsxDivProps = Omit<React.JSX.IntrinsicElements['div'], 'ref'>;
|
|
8
8
|
export interface SkeletonProps extends JsxDivProps {
|
|
9
9
|
/**
|
|
10
10
|
* The width of the skeleton.
|
package/src/Switch/index.tsx
CHANGED
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
} from '@os-design/styles';
|
|
9
9
|
import { clr } from '@os-design/theming';
|
|
10
10
|
import { omitEmotionProps, useForwardedState } from '@os-design/utils';
|
|
11
|
-
import { forwardRef, useCallback } from 'react';
|
|
11
|
+
import React, { forwardRef, useCallback } from 'react';
|
|
12
12
|
|
|
13
13
|
type JsxButtonProps = Omit<
|
|
14
|
-
JSX.IntrinsicElements['button'],
|
|
14
|
+
React.JSX.IntrinsicElements['button'],
|
|
15
15
|
'value' | 'defaultValue' | 'onChange' | 'onClick' | 'ref'
|
|
16
16
|
>;
|
|
17
17
|
export interface SwitchProps extends JsxButtonProps, WithSize {
|
package/src/Tag/index.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import { clr } from '@os-design/theming';
|
|
|
9
9
|
import { omitEmotionProps } from '@os-design/utils';
|
|
10
10
|
import React, { forwardRef } from 'react';
|
|
11
11
|
|
|
12
|
-
type JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;
|
|
12
|
+
type JsxDivProps = Omit<React.JSX.IntrinsicElements['div'], 'ref'>;
|
|
13
13
|
|
|
14
14
|
export interface BaseTagProps extends WithSize {
|
|
15
15
|
/**
|
package/src/TagLink/index.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
2
|
import { clr } from '@os-design/theming';
|
|
3
3
|
import { omitEmotionProps } from '@os-design/utils';
|
|
4
|
-
import { forwardRef } from 'react';
|
|
4
|
+
import React, { forwardRef } from 'react';
|
|
5
5
|
import type { LinkProps, ReactRouterLinkProps } from '../Link/index.js';
|
|
6
6
|
import {
|
|
7
7
|
type BaseTagProps,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
TagContainer,
|
|
11
11
|
} from '../Tag/index.js';
|
|
12
12
|
|
|
13
|
-
type JsxAProps = Omit<JSX.IntrinsicElements['a'], 'ref'>;
|
|
13
|
+
type JsxAProps = Omit<React.JSX.IntrinsicElements['a'], 'ref'>;
|
|
14
14
|
export type TagLinkProps = JsxAProps &
|
|
15
15
|
ReactRouterLinkProps &
|
|
16
16
|
Pick<LinkProps, 'as'> &
|
package/src/TagList/index.tsx
CHANGED
|
@@ -3,10 +3,10 @@ import styled from '@emotion/styled';
|
|
|
3
3
|
import { Down, Up } from '@os-design/icons';
|
|
4
4
|
import { type WithSize, sizeStyles } from '@os-design/styles';
|
|
5
5
|
import { omitEmotionProps } from '@os-design/utils';
|
|
6
|
-
import { forwardRef, useState } from 'react';
|
|
6
|
+
import React, { forwardRef, useState } from 'react';
|
|
7
7
|
import Button from '../Button/index.js';
|
|
8
8
|
|
|
9
|
-
type JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;
|
|
9
|
+
type JsxDivProps = Omit<React.JSX.IntrinsicElements['div'], 'ref'>;
|
|
10
10
|
export interface TagListProps extends JsxDivProps, WithSize {
|
|
11
11
|
/**
|
|
12
12
|
* Whether the tag list is collapsible.
|
|
@@ -5,8 +5,7 @@ import { forwardRef } from 'react';
|
|
|
5
5
|
import Skeleton, { type SkeletonProps } from '../Skeleton/index.js';
|
|
6
6
|
|
|
7
7
|
export interface TagSkeletonProps
|
|
8
|
-
extends Omit<SkeletonProps, 'width'>,
|
|
9
|
-
WithSize {
|
|
8
|
+
extends Omit<SkeletonProps, 'width'>, WithSize {
|
|
10
9
|
/**
|
|
11
10
|
* The width of the skeleton.
|
|
12
11
|
* @default 6em
|
package/src/TextArea/index.tsx
CHANGED
|
@@ -17,7 +17,7 @@ import { InputContainer, StyledInput } from '../Input/index.js';
|
|
|
17
17
|
import getFocusableElements from '../Input/utils/getFocusableElements.js';
|
|
18
18
|
|
|
19
19
|
type JsxTextAreaProps = Omit<
|
|
20
|
-
JSX.IntrinsicElements['textarea'],
|
|
20
|
+
React.JSX.IntrinsicElements['textarea'],
|
|
21
21
|
'value' | 'onChange' | 'ref'
|
|
22
22
|
>;
|
|
23
23
|
export interface TextAreaProps extends JsxTextAreaProps, WithSize {
|
|
@@ -62,7 +62,7 @@ export interface TextAreaProps extends JsxTextAreaProps, WithSize {
|
|
|
62
62
|
* The props of the textarea container.
|
|
63
63
|
* @default undefined
|
|
64
64
|
*/
|
|
65
|
-
containerProps?: JSX.IntrinsicElements['div'];
|
|
65
|
+
containerProps?: React.JSX.IntrinsicElements['div'];
|
|
66
66
|
/**
|
|
67
67
|
* The textarea value.
|
|
68
68
|
* @default undefined
|
package/src/TimeGrid/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { omitEmotionProps, useForwardedState } from '@os-design/utils';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
import { clr } from '@os-design/theming';
|
|
@@ -12,7 +12,7 @@ interface Time {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
type JsxDivProps = Omit<
|
|
15
|
-
JSX.IntrinsicElements['div'],
|
|
15
|
+
React.JSX.IntrinsicElements['div'],
|
|
16
16
|
'defaultValue' | 'onChange' | 'ref'
|
|
17
17
|
>;
|
|
18
18
|
export interface TimeGridProps extends JsxDivProps {
|