@os-design/core 1.0.303 → 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.
Files changed (206) hide show
  1. package/dist/Alert/index.d.ts +3 -2
  2. package/dist/Alert/index.d.ts.map +1 -1
  3. package/dist/Alert/index.js +1 -1
  4. package/dist/Avatar/index.d.ts +3 -2
  5. package/dist/Avatar/index.d.ts.map +1 -1
  6. package/dist/Avatar/index.js +1 -1
  7. package/dist/AvatarSkeleton/index.d.ts +3 -2
  8. package/dist/AvatarSkeleton/index.d.ts.map +1 -1
  9. package/dist/AvatarSkeleton/index.js +1 -1
  10. package/dist/Badge/index.d.ts +3 -2
  11. package/dist/Badge/index.d.ts.map +1 -1
  12. package/dist/Badge/index.js +1 -1
  13. package/dist/Breadcrumb/index.d.ts +1 -1
  14. package/dist/Breadcrumb/index.d.ts.map +1 -1
  15. package/dist/Breadcrumb/index.js +10 -6
  16. package/dist/Button/index.d.ts +1 -1
  17. package/dist/Button/index.d.ts.map +1 -1
  18. package/dist/ButtonLink/index.d.ts +183 -168
  19. package/dist/ButtonLink/index.d.ts.map +1 -1
  20. package/dist/ButtonLink/index.js +1 -1
  21. package/dist/Checkbox/index.d.ts +3 -2
  22. package/dist/Checkbox/index.d.ts.map +1 -1
  23. package/dist/Checkbox/index.js +1 -1
  24. package/dist/CheckboxSkeleton/index.d.ts +3 -2
  25. package/dist/CheckboxSkeleton/index.d.ts.map +1 -1
  26. package/dist/CheckboxSkeleton/index.js +1 -1
  27. package/dist/DateCalendar/Calendar.d.ts.map +1 -1
  28. package/dist/DateCalendar/index.d.ts +3 -2
  29. package/dist/DateCalendar/index.d.ts.map +1 -1
  30. package/dist/DateCalendar/index.js +2 -1
  31. package/dist/DatePicker/index.d.ts +4 -4
  32. package/dist/DatePicker/index.d.ts.map +1 -1
  33. package/dist/DatePicker/index.js +2 -1
  34. package/dist/Drawer/index.d.ts +1 -1
  35. package/dist/Drawer/index.d.ts.map +1 -1
  36. package/dist/Form/index.d.ts +3 -2
  37. package/dist/Form/index.d.ts.map +1 -1
  38. package/dist/Form/index.js +1 -1
  39. package/dist/FormDivider/index.d.ts +3 -2
  40. package/dist/FormDivider/index.d.ts.map +1 -1
  41. package/dist/FormDivider/index.js +1 -1
  42. package/dist/FormItem/index.d.ts +8 -2
  43. package/dist/FormItem/index.d.ts.map +1 -1
  44. package/dist/FormItem/index.js +13 -2
  45. package/dist/Gallery/index.d.ts +1 -1
  46. package/dist/Gallery/index.d.ts.map +1 -1
  47. package/dist/Gallery/index.js +1 -0
  48. package/dist/Image/index.d.ts +3 -2
  49. package/dist/Image/index.d.ts.map +1 -1
  50. package/dist/Image/index.js +1 -1
  51. package/dist/Input/index.d.ts +2 -2
  52. package/dist/Input/index.d.ts.map +1 -1
  53. package/dist/InputDateUnstyled/index.d.ts +3 -2
  54. package/dist/InputDateUnstyled/index.d.ts.map +1 -1
  55. package/dist/InputDateUnstyled/index.js +2 -2
  56. package/dist/InputNumber/index.d.ts.map +1 -1
  57. package/dist/InputSearch/index.d.ts.map +1 -1
  58. package/dist/Link/index.d.ts +1 -1
  59. package/dist/Link/index.d.ts.map +1 -1
  60. package/dist/LinkButton/index.d.ts +3 -2
  61. package/dist/LinkButton/index.d.ts.map +1 -1
  62. package/dist/LinkButton/index.js +1 -1
  63. package/dist/List/WindowScroller.js +1 -1
  64. package/dist/ListItemActions/index.d.ts +1 -1
  65. package/dist/ListItemActions/index.d.ts.map +1 -1
  66. package/dist/ListItemActions/index.js +1 -0
  67. package/dist/ListItemLink/index.d.ts +3 -2
  68. package/dist/ListItemLink/index.d.ts.map +1 -1
  69. package/dist/ListItemLink/index.js +1 -1
  70. package/dist/ListItemSkeleton/index.d.ts.map +1 -1
  71. package/dist/ListSkeleton/index.d.ts.map +1 -1
  72. package/dist/LogoLink/index.d.ts +3 -2
  73. package/dist/LogoLink/index.d.ts.map +1 -1
  74. package/dist/LogoLink/index.js +1 -1
  75. package/dist/Menu/index.d.ts.map +1 -1
  76. package/dist/Menu/index.js +3 -1
  77. package/dist/MenuDivider/index.d.ts +3 -2
  78. package/dist/MenuDivider/index.d.ts.map +1 -1
  79. package/dist/MenuDivider/index.js +1 -1
  80. package/dist/MenuGroup/index.d.ts +1 -1
  81. package/dist/MenuGroup/index.d.ts.map +1 -1
  82. package/dist/MenuItem/index.d.ts.map +1 -1
  83. package/dist/MenuItem/index.js +1 -1
  84. package/dist/Modal/index.d.ts +1 -1
  85. package/dist/Modal/index.d.ts.map +1 -1
  86. package/dist/Modal/index.js +6 -2
  87. package/dist/Navigation/index.d.ts +1 -1
  88. package/dist/Navigation/index.d.ts.map +1 -1
  89. package/dist/Navigation/utils/useScrollFlags.d.ts +1 -1
  90. package/dist/Navigation/utils/useScrollFlags.d.ts.map +1 -1
  91. package/dist/NavigationItem/index.d.ts +1 -1
  92. package/dist/NavigationItem/index.d.ts.map +1 -1
  93. package/dist/PageContent/index.d.ts +3 -2
  94. package/dist/PageContent/index.d.ts.map +1 -1
  95. package/dist/PageContent/index.js +1 -1
  96. package/dist/PageHeader/index.d.ts +1 -1
  97. package/dist/PageHeader/index.d.ts.map +1 -1
  98. package/dist/PageHeaderInputSearch/index.d.ts.map +1 -1
  99. package/dist/ParagraphSkeleton/index.d.ts.map +1 -1
  100. package/dist/ParagraphSkeleton/index.js +1 -0
  101. package/dist/Popover/index.d.ts +5 -5
  102. package/dist/Popover/index.d.ts.map +1 -1
  103. package/dist/Popover/index.js +4 -2
  104. package/dist/Progress/index.d.ts +3 -2
  105. package/dist/Progress/index.d.ts.map +1 -1
  106. package/dist/Progress/index.js +4 -2
  107. package/dist/RadioGroup/index.d.ts +3 -2
  108. package/dist/RadioGroup/index.d.ts.map +1 -1
  109. package/dist/RadioGroup/index.js +1 -1
  110. package/dist/Result/index.d.ts +1 -1
  111. package/dist/Result/index.d.ts.map +1 -1
  112. package/dist/ScrollButton/utils/useVisibility.d.ts.map +1 -1
  113. package/dist/ScrollButton/utils/useVisibility.js +1 -0
  114. package/dist/Select/index.d.ts +1 -1
  115. package/dist/Select/index.d.ts.map +1 -1
  116. package/dist/Select/index.js +3 -1
  117. package/dist/Skeleton/index.d.ts +3 -2
  118. package/dist/Skeleton/index.d.ts.map +1 -1
  119. package/dist/Skeleton/index.js +1 -1
  120. package/dist/Switch/index.d.ts +3 -2
  121. package/dist/Switch/index.d.ts.map +1 -1
  122. package/dist/Switch/index.js +1 -1
  123. package/dist/Tag/index.d.ts +1 -1
  124. package/dist/Tag/index.d.ts.map +1 -1
  125. package/dist/TagLink/index.d.ts +3 -2
  126. package/dist/TagLink/index.d.ts.map +1 -1
  127. package/dist/TagLink/index.js +1 -1
  128. package/dist/TagList/index.d.ts +3 -2
  129. package/dist/TagList/index.d.ts.map +1 -1
  130. package/dist/TagList/index.js +1 -1
  131. package/dist/TagListSkeleton/index.d.ts.map +1 -1
  132. package/dist/TagListSkeleton/index.js +1 -0
  133. package/dist/TagSkeleton/index.d.ts.map +1 -1
  134. package/dist/TextArea/index.d.ts +2 -2
  135. package/dist/TextArea/index.d.ts.map +1 -1
  136. package/dist/ThemeSwitcher/index.d.ts +29 -15
  137. package/dist/ThemeSwitcher/index.d.ts.map +1 -1
  138. package/dist/TimeGrid/index.d.ts +5 -4
  139. package/dist/TimeGrid/index.d.ts.map +1 -1
  140. package/dist/TimeGrid/index.js +1 -1
  141. package/dist/TimeList/index.d.ts +4 -3
  142. package/dist/TimeList/index.d.ts.map +1 -1
  143. package/dist/TimeList/index.js +1 -1
  144. package/dist/Video/index.d.ts +3 -2
  145. package/dist/Video/index.d.ts.map +1 -1
  146. package/dist/Video/index.js +1 -1
  147. package/package.json +15 -15
  148. package/src/Alert/index.tsx +2 -2
  149. package/src/Avatar/index.tsx +2 -2
  150. package/src/AvatarSkeleton/index.tsx +2 -2
  151. package/src/Badge/index.tsx +2 -2
  152. package/src/Breadcrumb/index.tsx +21 -17
  153. package/src/Button/index.tsx +5 -3
  154. package/src/ButtonLink/index.tsx +2 -2
  155. package/src/Checkbox/index.tsx +4 -3
  156. package/src/CheckboxSkeleton/index.tsx +2 -2
  157. package/src/DateCalendar/index.tsx +3 -2
  158. package/src/DatePicker/index.tsx +4 -3
  159. package/src/Drawer/index.tsx +1 -1
  160. package/src/Form/index.tsx +2 -2
  161. package/src/FormDivider/index.tsx +2 -2
  162. package/src/FormItem/index.tsx +20 -3
  163. package/src/Gallery/index.tsx +2 -1
  164. package/src/GlobalStyles/index.mdx +1 -1
  165. package/src/Image/index.tsx +2 -2
  166. package/src/Input/index.tsx +2 -2
  167. package/src/InputDateUnstyled/index.tsx +3 -3
  168. package/src/InputNumber/index.tsx +4 -2
  169. package/src/InputSearch/index.tsx +4 -2
  170. package/src/Link/index.tsx +1 -1
  171. package/src/LinkButton/index.tsx +2 -2
  172. package/src/List/WindowScroller.tsx +1 -1
  173. package/src/ListItemActions/index.tsx +2 -1
  174. package/src/ListItemLink/index.tsx +2 -2
  175. package/src/ListItemSkeleton/index.tsx +4 -2
  176. package/src/ListSkeleton/index.tsx +2 -1
  177. package/src/LogoLink/index.tsx +3 -6
  178. package/src/Menu/index.tsx +1 -0
  179. package/src/MenuDivider/index.tsx +2 -2
  180. package/src/MenuGroup/index.tsx +4 -3
  181. package/src/MenuItem/index.tsx +5 -3
  182. package/src/Modal/index.tsx +3 -1
  183. package/src/Navigation/index.tsx +1 -1
  184. package/src/Navigation/utils/useScrollFlags.ts +1 -1
  185. package/src/NavigationItem/index.tsx +2 -4
  186. package/src/PageContent/index.tsx +2 -2
  187. package/src/PageHeader/index.tsx +1 -1
  188. package/src/PageHeaderInputSearch/index.tsx +4 -2
  189. package/src/ParagraphSkeleton/index.tsx +1 -0
  190. package/src/Popover/index.tsx +7 -6
  191. package/src/Progress/index.tsx +3 -2
  192. package/src/RadioGroup/index.tsx +6 -4
  193. package/src/Result/index.tsx +1 -1
  194. package/src/ScrollButton/utils/useVisibility.ts +1 -0
  195. package/src/Select/index.tsx +3 -4
  196. package/src/Skeleton/index.tsx +2 -2
  197. package/src/Switch/index.tsx +2 -2
  198. package/src/Tag/index.tsx +1 -1
  199. package/src/TagLink/index.tsx +2 -2
  200. package/src/TagList/index.tsx +2 -2
  201. package/src/TagListSkeleton/index.tsx +1 -0
  202. package/src/TagSkeleton/index.tsx +1 -2
  203. package/src/TextArea/index.tsx +2 -2
  204. package/src/TimeGrid/index.tsx +2 -2
  205. package/src/TimeList/index.tsx +2 -2
  206. package/src/Video/index.tsx +2 -2
@@ -63,7 +63,7 @@ const RightButton = styled(NavButton)`
63
63
  right: 0.2em;
64
64
  `;
65
65
 
66
- type JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;
66
+ type JsxDivProps = Omit<React.JSX.IntrinsicElements['div'], 'ref'>;
67
67
  export interface GalleryProps extends JsxDivProps {
68
68
  /**
69
69
  * The image urls.
@@ -125,6 +125,7 @@ const Gallery = forwardRef<HTMLDivElement, GalleryProps>(
125
125
 
126
126
  // Update the image if the index was changed
127
127
  useEffect(() => {
128
+ // eslint-disable-next-line react-hooks/set-state-in-effect
128
129
  setImageUrl(imageIndex !== null ? urls[imageIndex] : undefined);
129
130
  }, [imageIndex, urls]);
130
131
 
@@ -1,4 +1,4 @@
1
- import { Meta, Canvas } from '@storybook/blocks';
1
+ import { Meta, Canvas } from '@storybook/addon-docs/blocks';
2
2
  import * as Stories from './index.stories';
3
3
 
4
4
  <Meta title='Global styles' />
@@ -1,12 +1,12 @@
1
1
  import { css } from '@emotion/react';
2
2
  import styled from '@emotion/styled';
3
3
  import { omitEmotionProps } from '@os-design/utils';
4
- import { forwardRef, useCallback } from 'react';
4
+ import React, { forwardRef, useCallback } from 'react';
5
5
 
6
6
  const EMPTY_IMAGE =
7
7
  'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mO8+R8AArcB2pIvCSwAAAAASUVORK5CYII=';
8
8
 
9
- type JsxImgProps = Omit<JSX.IntrinsicElements['img'], 'sizes' | 'ref'>;
9
+ type JsxImgProps = Omit<React.JSX.IntrinsicElements['img'], 'sizes' | 'ref'>;
10
10
  export interface ImageProps extends JsxImgProps {
11
11
  /**
12
12
  * The image URL.
@@ -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
- extends Omit<InputProps, 'type' | 'value' | 'onChange'> {
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
- extends Omit<InputProps, 'type' | 'onChange'> {
13
+ export interface InputSearchProps extends Omit<
14
+ InputProps,
15
+ 'type' | 'onChange'
16
+ > {
15
17
  /**
16
18
  * The locale.
17
19
  * @default undefined
@@ -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.
@@ -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
- extends Omit<ListItemProps, 'title' | 'description' | 'actions'> {
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 Omit<ListProps, 'itemCount' | 'itemRenderer' | 'children'>,
9
+ extends
10
+ Omit<ListProps, 'itemCount' | 'itemRenderer' | 'children'>,
10
11
  Pick<
11
12
  ListItemSkeletonProps,
12
13
  | 'hasDescription'
@@ -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
  */
@@ -68,6 +68,7 @@ const Menu = forwardRef<HTMLDivElement, MenuProps>(
68
68
  const isMinXs = useIsMinWidth('xs');
69
69
 
70
70
  const menuId = useMemo(
71
+ // eslint-disable-next-line react-hooks/purity
71
72
  () => id || `menu-${Math.random().toString(36).slice(2, 11)}`,
72
73
  [id]
73
74
  );
@@ -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;
@@ -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 } = child.props;
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);
@@ -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
- extends Omit<ButtonProps, 'type' | 'wide' | 'size'> {
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;
@@ -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
  );
@@ -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.
@@ -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
- extends Omit<InputSearchProps, 'size' | 'locale'> {
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} />
@@ -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
  );
@@ -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
  );
@@ -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
- extends Omit<ButtonProps, 'type' | 'wide' | 'size'> {
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 {
@@ -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.
@@ -19,6 +19,7 @@ const useVisibility = ({
19
19
 
20
20
  // Update the visibility of the button when the user scrolls the container
21
21
  const updateVisibility = useCallback(() => {
22
+ // eslint-disable-next-line no-useless-assignment
22
23
  let offset = 0;
23
24
 
24
25
  if (!container) {
@@ -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
  );
@@ -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.
@@ -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
  /**
@@ -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'> &
@@ -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.
@@ -26,6 +26,7 @@ const TagListSkeleton = forwardRef<HTMLDivElement, TagListSkeletonProps>(
26
26
  {Array(tagsCount)
27
27
  .fill(0)
28
28
  .map(() => {
29
+ // eslint-disable-next-line react-hooks/globals
29
30
  tagIndex += 1;
30
31
  return <TagSkeleton key={tagIndex} width={width} />;
31
32
  })}
@@ -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