uikit-react-public 0.29.5 → 0.30.0

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 (148) hide show
  1. package/dist/components/Accordion/Accordion.stories.d.ts +1 -1
  2. package/dist/components/Alert/Alert.stories.d.ts +1 -1
  3. package/dist/components/AppHeader/AppHeader.stories.d.ts +1 -1
  4. package/dist/components/AppMenu/AppMenu.stories.d.ts +1 -1
  5. package/dist/components/Avatar/Avatar.stories.d.ts +1 -1
  6. package/dist/components/Badge/Badge.stories.d.ts +1 -1
  7. package/dist/components/BaseCheckbox/BaseCheckbox.stories.d.ts +1 -1
  8. package/dist/components/Blanket/Blanket.stories.d.ts +1 -1
  9. package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +1 -1
  10. package/dist/components/Button/Button.stories.d.ts +1 -1
  11. package/dist/components/Calendar/Calendar.stories.d.ts +1 -1
  12. package/dist/components/Calendar/subcomponents/Day.stories.d.ts +1 -1
  13. package/dist/components/Checkbox/Checkbox.stories.d.ts +1 -1
  14. package/dist/components/Chip/Chip.stories.d.ts +1 -1
  15. package/dist/components/Datepicker/Datepicker.stories.d.ts +1 -1
  16. package/dist/components/Dialog/Dialog.stories.d.ts +1 -1
  17. package/dist/components/Divider/Divider.stories.d.ts +1 -1
  18. package/dist/components/Dropdown/Dropdown.stories.d.ts +1 -1
  19. package/dist/components/FeedbackDialog/FeedbackDialog.stories.d.ts +1 -1
  20. package/dist/components/Field/Field.stories.d.ts +1 -1
  21. package/dist/components/FileInput/FileInput.stories.d.ts +1 -1
  22. package/dist/components/Footer/Footer.stories.d.ts +1 -1
  23. package/dist/components/Header/Header.stories.d.ts +1 -1
  24. package/dist/components/Heading/Heading.stories.d.ts +1 -1
  25. package/dist/components/Icon/Icon.stories.d.ts +1 -1
  26. package/dist/components/IconButton/IconButton.stories.d.ts +1 -1
  27. package/dist/components/Input/Input.stories.d.ts +1 -1
  28. package/dist/components/Label/Label.stories.d.ts +1 -1
  29. package/dist/components/Layout/Layout.stories.d.ts +1 -1
  30. package/dist/components/Link/Link.stories.d.ts +1 -1
  31. package/dist/components/Main/Main.stories.d.ts +1 -1
  32. package/dist/components/Modal/Modal.stories.d.ts +1 -1
  33. package/dist/components/NativeDatepicker/NativeDatepicker.stories.d.ts +1 -1
  34. package/dist/components/Overlay/Overlay.d.ts +14 -3
  35. package/dist/components/Overlay/Overlay.stories.d.ts +33 -4
  36. package/dist/components/Overlay/__tests__/Overlay.test.d.ts +1 -0
  37. package/dist/components/Overlay/index.d.ts +1 -1
  38. package/dist/components/Pagination/Pagination.stories.d.ts +1 -1
  39. package/dist/components/Paragraph/Paragraph.stories.d.ts +1 -1
  40. package/dist/components/Radio/Radio.stories.d.ts +1 -1
  41. package/dist/components/Search/Search.stories.d.ts +1 -1
  42. package/dist/components/Select/Select.stories.d.ts +13 -1
  43. package/dist/components/Select/Select.types.d.ts +7 -0
  44. package/dist/components/Select/subcomponents/CustomSelect.d.ts +1 -1
  45. package/dist/components/Select/subcomponents/Panel.d.ts +8 -2
  46. package/dist/components/Snackbar/Snackbar.stories.d.ts +1 -1
  47. package/dist/components/Spinner/Spinner.stories.d.ts +1 -1
  48. package/dist/components/StandaloneLink/StandaloneLink.stories.d.ts +1 -1
  49. package/dist/components/Table/Table.stories.d.ts +1 -1
  50. package/dist/components/Table/subcomponents/Cell/Cell.stories.d.ts +2 -2
  51. package/dist/components/Table/subcomponents/HeadCell/HeadCell.stories.d.ts +2 -2
  52. package/dist/components/Tabs/Tab.d.ts +11 -5
  53. package/dist/components/Tabs/TabContext.d.ts +14 -8
  54. package/dist/components/Tabs/Tabs.d.ts +25 -8
  55. package/dist/components/Tabs/Tabs.stories.d.ts +5 -9
  56. package/dist/components/Tabs/TabsList.d.ts +9 -0
  57. package/dist/components/Tabs/TabsPanel.d.ts +10 -0
  58. package/dist/components/Tabs/index.d.ts +2 -1
  59. package/dist/components/Textarea/Textarea.stories.d.ts +1 -1
  60. package/dist/components/Timepicker/Timepicker.stories.d.ts +1 -1
  61. package/dist/components/Toggle/Toggle.stories.d.ts +1 -1
  62. package/dist/components/Tooltip/Tooltip.stories.d.ts +1 -1
  63. package/dist/components/UclLogo/UclLogo.stories.d.ts +1 -1
  64. package/dist/components/WeekPicker/WeekPicker.stories.d.ts +1 -1
  65. package/dist/components/index.d.ts +1 -1
  66. package/dist/index.js +5094 -4723
  67. package/lib/Welcome.mdx +1 -1
  68. package/lib/components/Accordion/Accordion.stories.tsx +1 -1
  69. package/lib/components/Alert/Alert.mdx +1 -1
  70. package/lib/components/Alert/Alert.stories.tsx +1 -1
  71. package/lib/components/AppHeader/AppHeader.stories.tsx +1 -1
  72. package/lib/components/AppMenu/AppMenu.stories.tsx +1 -1
  73. package/lib/components/Avatar/Avatar.mdx +1 -1
  74. package/lib/components/Avatar/Avatar.stories.tsx +1 -1
  75. package/lib/components/Badge/Badge.stories.tsx +1 -1
  76. package/lib/components/BaseCheckbox/BaseCheckbox.stories.tsx +2 -2
  77. package/lib/components/Blanket/Blanket.stories.tsx +1 -1
  78. package/lib/components/Breadcrumbs/Breadcrumbs.stories.tsx +1 -1
  79. package/lib/components/Button/Button.mdx +1 -1
  80. package/lib/components/Button/Button.stories.tsx +2 -2
  81. package/lib/components/Calendar/Calendar.stories.tsx +2 -2
  82. package/lib/components/Calendar/subcomponents/Day.stories.tsx +1 -1
  83. package/lib/components/Checkbox/Checkbox.stories.tsx +2 -2
  84. package/lib/components/Chip/Chip.stories.tsx +2 -2
  85. package/lib/components/Datepicker/Datepicker.stories.tsx +2 -2
  86. package/lib/components/Dialog/Dialog.stories.tsx +1 -1
  87. package/lib/components/Divider/Divider.stories.tsx +1 -1
  88. package/lib/components/Dropdown/Dropdown.stories.tsx +1 -1
  89. package/lib/components/FeedbackDialog/FeedbackDialog.stories.tsx +1 -1
  90. package/lib/components/Field/Field.stories.tsx +2 -2
  91. package/lib/components/FileInput/FileInput.stories.tsx +1 -1
  92. package/lib/components/Footer/Footer.stories.tsx +1 -1
  93. package/lib/components/Header/Header.mdx +1 -1
  94. package/lib/components/Header/Header.stories.tsx +1 -1
  95. package/lib/components/Heading/Documentation.mdx +1 -1
  96. package/lib/components/Heading/Heading.stories.tsx +1 -1
  97. package/lib/components/Icon/Icon.stories.tsx +1 -1
  98. package/lib/components/IconButton/IconButton.stories.tsx +1 -1
  99. package/lib/components/Input/Documentation.mdx +1 -1
  100. package/lib/components/Input/Input.stories.tsx +1 -1
  101. package/lib/components/Label/Label.stories.tsx +1 -1
  102. package/lib/components/Layout/Layout.stories.tsx +1 -1
  103. package/lib/components/Link/Link.stories.tsx +1 -1
  104. package/lib/components/Main/Main.stories.tsx +1 -1
  105. package/lib/components/Modal/Modal.stories.tsx +1 -1
  106. package/lib/components/NativeDatepicker/NativeDatepicker.stories.tsx +2 -2
  107. package/lib/components/Overlay/Overlay.stories.tsx +1 -1
  108. package/lib/components/Overlay/Overlay.tsx +64 -21
  109. package/lib/components/Overlay/__tests__/Overlay.test.tsx +81 -0
  110. package/lib/components/Overlay/index.ts +1 -1
  111. package/lib/components/Pagination/Pagination.stories.tsx +1 -1
  112. package/lib/components/Paragraph/Paragraph.stories.tsx +1 -1
  113. package/lib/components/Radio/Radio.stories.tsx +2 -2
  114. package/lib/components/Search/Search.stories.tsx +1 -1
  115. package/lib/components/Select/Select.mdx +1 -1
  116. package/lib/components/Select/Select.stories.tsx +9 -2
  117. package/lib/components/Select/Select.tsx +7 -0
  118. package/lib/components/Select/Select.types.ts +9 -2
  119. package/lib/components/Select/__tests__/Select.test.tsx +181 -1
  120. package/lib/components/Select/subcomponents/CustomSelect.tsx +109 -27
  121. package/lib/components/Select/subcomponents/Panel.tsx +40 -10
  122. package/lib/components/Snackbar/Snackbar.stories.tsx +1 -1
  123. package/lib/components/Spinner/Spinner.stories.tsx +1 -1
  124. package/lib/components/StandaloneLink/StandaloneLink.stories.tsx +1 -1
  125. package/lib/components/Table/Table.stories.tsx +1 -1
  126. package/lib/components/Table/subcomponents/Cell/Cell.stories.tsx +2 -2
  127. package/lib/components/Table/subcomponents/HeadCell/HeadCell.stories.tsx +1 -1
  128. package/lib/components/Tabs/Tab.tsx +209 -36
  129. package/lib/components/Tabs/TabContext.tsx +20 -7
  130. package/lib/components/Tabs/Tabs.stories.tsx +87 -68
  131. package/lib/components/Tabs/Tabs.tsx +129 -37
  132. package/lib/components/Tabs/TabsList.tsx +134 -0
  133. package/lib/components/Tabs/TabsPanel.tsx +55 -0
  134. package/lib/components/Tabs/__tests__/Tabs.test.tsx +173 -105
  135. package/lib/components/Tabs/index.ts +8 -1
  136. package/lib/components/Textarea/Textarea.stories.tsx +1 -1
  137. package/lib/components/Timepicker/Timepicker.stories.tsx +1 -1
  138. package/lib/components/Toggle/Documentation.mdx +1 -1
  139. package/lib/components/Toggle/Toggle.stories.tsx +1 -1
  140. package/lib/components/Tooltip/Tooltip.stories.tsx +1 -1
  141. package/lib/components/UclLogo/UclLogo.stories.tsx +1 -1
  142. package/lib/components/WeekPicker/WeekPicker.stories.tsx +2 -2
  143. package/lib/components/common/Common.mdx +1 -1
  144. package/lib/components/index.ts +7 -1
  145. package/lib/theme/Icons.mdx +1 -1
  146. package/lib/theme/Typography.mdx +1 -1
  147. package/package.json +8 -11
  148. package/lib/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +0 -185
package/lib/Welcome.mdx CHANGED
@@ -1,4 +1,4 @@
1
- import { Meta } from "@storybook/blocks";
1
+ import { Meta } from "@storybook/addon-docs/blocks";
2
2
  import { UclLogo } from "./components/";
3
3
 
4
4
  <Meta title="Welcome" />
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import Accordion from './Accordion';
3
3
 
4
4
  const meta = {
@@ -1,5 +1,5 @@
1
1
  import * as AlertStories from './Alert.stories';
2
- import { Meta, Title, Subtitle, Canvas, Controls } from '@storybook/blocks';
2
+ import { Meta, Title, Subtitle, Canvas, Controls } from '@storybook/addon-docs/blocks';
3
3
 
4
4
  <Meta of={AlertStories} />
5
5
  <Title />
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import Alert from './Alert';
3
3
  import { theme } from '../../theme';
4
4
 
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import { css } from '@emotion/css';
3
3
 
4
4
  import AppHeader from './AppHeader';
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import { Link as InternalLink } from 'wouter';
3
3
  import AppMenu from './AppMenu';
4
4
  import Icon from '../Icon/Icon';
@@ -1,5 +1,5 @@
1
1
  import * as AvatarStories from "./Avatar.stories";
2
- import { Meta, Title, Subtitle, Canvas, Controls, ArgTypes } from "@storybook/blocks";
2
+ import { Meta, Title, Subtitle, Canvas, Controls, ArgTypes } from "@storybook/addon-docs/blocks";
3
3
 
4
4
  export const usage = {
5
5
  image: `<Avatar
@@ -1,5 +1,5 @@
1
1
  import type { CSSProperties } from 'react';
2
- import type { Meta, StoryObj } from '@storybook/react';
2
+ import type { Meta, StoryObj } from '@storybook/react-vite';
3
3
  import Avatar, { type AvatarProps } from './Avatar';
4
4
  import sampleAvatarPhoto from '../../../public/sample-avatar-photo.jpg';
5
5
 
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import { css } from '@emotion/css';
3
3
  import Badge from './Badge';
4
4
  import { type BadgeVariant } from './Badge';
@@ -1,5 +1,5 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { useArgs } from '@storybook/preview-api';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { useArgs } from 'storybook/preview-api';
3
3
 
4
4
  import BaseCheckbox from './BaseCheckbox';
5
5
  import Icon from '../Icon';
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties } from 'react';
2
- import type { Meta, StoryObj } from '@storybook/react';
2
+ import type { Meta, StoryObj } from '@storybook/react-vite';
3
3
  import Blanket from './Blanket';
4
4
 
5
5
  const meta = {
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
 
3
3
  import Breadcrumbs from './Breadcrumbs';
4
4
 
@@ -7,7 +7,7 @@ import {
7
7
  Canvas,
8
8
  Controls,
9
9
  ArgTypes,
10
- } from '@storybook/blocks';
10
+ } from '@storybook/addon-docs/blocks';
11
11
 
12
12
  export const usage = {
13
13
  default: `<Button>Default Button</Button>`,
@@ -1,5 +1,5 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { useArgs } from '@storybook/preview-api';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { useArgs } from 'storybook/preview-api';
3
3
  import Button from './Button';
4
4
  import Icon from '../Icon';
5
5
  import { theme } from '../../theme';
@@ -1,6 +1,6 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import Calendar from './Calendar';
3
- import { useArgs } from '@storybook/preview-api';
3
+ import { useArgs } from 'storybook/preview-api';
4
4
  import type { AcademicWeek } from './Calendar.types';
5
5
 
6
6
  const meta = {
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import Day from './Day';
3
3
 
4
4
  const meta = {
@@ -1,5 +1,5 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { useArgs } from '@storybook/preview-api';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { useArgs } from 'storybook/preview-api';
3
3
 
4
4
  import Checkbox from './Checkbox';
5
5
 
@@ -1,5 +1,5 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { useArgs } from '@storybook/preview-api';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { useArgs } from 'storybook/preview-api';
3
3
 
4
4
  import Chip from './Chip';
5
5
 
@@ -1,5 +1,5 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { useArgs } from '@storybook/preview-api';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { useArgs } from 'storybook/preview-api';
3
3
  import Datepicker from './Datepicker';
4
4
  import Field from '../Field';
5
5
  import Label from '../Label';
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import Dialog from './Dialog';
3
3
 
4
4
  const meta = {
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
 
3
3
  import Divider from './Divider';
4
4
 
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import { css } from '@emotion/css';
3
3
  import Dropdown from './Dropdown';
4
4
  import Button from '../Button';
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import FeedbackDialog from './FeedbackDialog';
3
3
 
4
4
  const meta = {
@@ -1,6 +1,6 @@
1
1
  import { useState } from 'react';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
- import { useArgs } from '@storybook/preview-api';
2
+ import type { Meta, StoryObj } from '@storybook/react-vite';
3
+ import { useArgs } from 'storybook/preview-api';
4
4
  import { css } from '@emotion/css';
5
5
  import Field from './Field';
6
6
  // Direct imports to avoid circular dependency warning at build time due to context
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import FileInput from './FileInput';
3
3
 
4
4
  const meta = {
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
 
3
3
  import Footer from './Footer';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import * as HeaderStories from "./Header.stories";
2
- import { Meta, Title, Subtitle, Canvas, Controls } from "@storybook/blocks";
2
+ import { Meta, Title, Subtitle, Canvas, Controls } from "@storybook/addon-docs/blocks";
3
3
 
4
4
  export const usage = {
5
5
  default: `<Header title='App Name' />`,
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import Header from './Header';
3
3
  import Menu from '../Menu';
4
4
  import Icon from '../Icon';
@@ -7,7 +7,7 @@ import {
7
7
  Controls,
8
8
  Source,
9
9
  ArgTypes,
10
- } from '@storybook/blocks';
10
+ } from '@storybook/addon-docs/blocks';
11
11
 
12
12
  export const usage = {
13
13
  default: `<Heading>Default Heading</Heading>`,
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
 
3
3
  import Heading from './Heading';
4
4
 
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import Icon from './Icon';
3
3
  import { ComponentType } from 'react';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { ComponentType } from 'react';
2
- import type { Meta, StoryObj } from '@storybook/react';
2
+ import type { Meta, StoryObj } from '@storybook/react-vite';
3
3
  import IconButton from './IconButton';
4
4
  import Icon from '../Icon/Icon';
5
5
 
@@ -7,7 +7,7 @@ import {
7
7
  Controls,
8
8
  Source,
9
9
  ArgTypes,
10
- } from '@storybook/blocks';
10
+ } from '@storybook/addon-docs/blocks';
11
11
 
12
12
  export const usage = {
13
13
  default: `<Input />`,
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import { Input } from '../../../lib';
3
3
  import { Icon } from '../../../lib';
4
4
 
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
 
3
3
  import Label from './Label';
4
4
 
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import { css } from '@emotion/css';
3
3
  import { useTheme } from '../../theme';
4
4
  import Layout from './Layout';
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
 
3
3
  import Link from './Link';
4
4
 
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import Main from './Main';
3
3
 
4
4
  const meta = {
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import Modal from './Modal';
3
3
  import Button from '../Button/Button';
4
4
  import Text from '../Paragraph/Paragraph';
@@ -1,5 +1,5 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { useArgs } from '@storybook/preview-api';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { useArgs } from 'storybook/preview-api';
3
3
  import NativeDatepicker from './NativeDatepicker';
4
4
 
5
5
  const meta = {
@@ -1,5 +1,5 @@
1
1
  import { useRef } from 'react';
2
- import type { Meta, StoryObj } from '@storybook/react';
2
+ import type { Meta, StoryObj } from '@storybook/react-vite';
3
3
  import { css } from '@emotion/css';
4
4
  import Overlay from './Overlay';
5
5
 
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  HTMLAttributes,
3
+ CSSProperties,
3
4
  forwardRef,
4
5
  memo,
5
6
  useLayoutEffect,
@@ -15,8 +16,11 @@ import {
15
16
  flip as fuiFlip,
16
17
  shift as fuiShift,
17
18
  offset as fuiOffset,
19
+ size as fuiSize,
18
20
  autoUpdate,
19
21
  Placement,
22
+ type FlipOptions,
23
+ type ShiftOptions,
20
24
  // Strategy,
21
25
  } from '@floating-ui/react-dom';
22
26
 
@@ -26,19 +30,29 @@ import Blanket from '../Blanket';
26
30
 
27
31
  export const NAME = 'ucl-overlay';
28
32
 
29
- export interface OverlayProps
30
- extends HTMLAttributes<HTMLDivElement> {
33
+ type OverlaySizeOptions = {
34
+ padding?: number;
35
+ matchReferenceWidth?: boolean;
36
+ };
37
+
38
+ export type OverlaySize = {
39
+ referenceWidth: number;
40
+ availableWidth: number;
41
+ availableHeight: number;
42
+ };
43
+
44
+ export interface OverlayProps extends HTMLAttributes<HTMLDivElement> {
31
45
  reference: RefObject<HTMLElement | null>;
32
46
  placement?: Placement;
33
47
  blanket?: boolean;
34
- flip?: boolean;
35
- shift?: boolean;
48
+ flip?: boolean | FlipOptions;
49
+ shift?: boolean | ShiftOptions;
36
50
  offset?: number;
51
+ size?: boolean | OverlaySizeOptions;
37
52
  arrow?: ReactElement;
38
53
  arrowClassName?: string;
39
- onBlanketClick?: (
40
- ev: React.MouseEvent<HTMLDivElement>
41
- ) => void;
54
+ onSizeChange?: (size: OverlaySize) => void;
55
+ onBlanketClick?: (ev: React.MouseEvent<HTMLDivElement>) => void;
42
56
  }
43
57
 
44
58
  export type Ref = HTMLDivElement | null;
@@ -52,27 +66,51 @@ const Overlay = forwardRef<Ref, OverlayProps>(
52
66
  flip = true,
53
67
  shift = true,
54
68
  offset = 0,
69
+ size = false,
55
70
  arrow,
56
71
  className,
72
+ style: inlineStyle,
57
73
  arrowClassName,
74
+ onSizeChange,
58
75
  onBlanketClick,
59
76
  children,
60
77
  ...props
61
78
  }: OverlayProps,
62
79
  forwardedRef
63
80
  ) => {
64
- const ref = useRef(null);
81
+ const ref = useRef<HTMLDivElement | null>(null);
65
82
  const arrowRef = useRef<HTMLElement>(null);
66
83
 
67
- useImperativeHandle<Ref, Ref>(
68
- forwardedRef,
69
- () => ref.current
70
- );
84
+ useImperativeHandle<Ref, Ref>(forwardedRef, () => ref.current);
71
85
 
72
86
  const fuiMiddleware = [];
73
- if (flip) fuiMiddleware.push(fuiFlip());
74
- if (shift) fuiMiddleware.push(fuiShift());
87
+ if (flip) fuiMiddleware.push(fuiFlip(typeof flip === 'object' ? flip : {}));
88
+ if (shift)
89
+ fuiMiddleware.push(fuiShift(typeof shift === 'object' ? shift : {}));
75
90
  if (offset) fuiMiddleware.push(fuiOffset(offset));
91
+ if (size) {
92
+ const sizeOptions = typeof size === 'object' ? size : {};
93
+ const { padding = 0, matchReferenceWidth = false } = sizeOptions;
94
+
95
+ fuiMiddleware.push(
96
+ fuiSize({
97
+ padding,
98
+ apply({ availableWidth, availableHeight, elements, rects }) {
99
+ const { style } = elements.floating;
100
+
101
+ onSizeChange?.({
102
+ referenceWidth: rects.reference.width,
103
+ availableWidth: Math.max(0, availableWidth),
104
+ availableHeight: Math.max(0, availableHeight),
105
+ });
106
+
107
+ if (matchReferenceWidth) {
108
+ style.minWidth = `${rects.reference.width}px`;
109
+ }
110
+ },
111
+ })
112
+ );
113
+ }
76
114
 
77
115
  const {
78
116
  x,
@@ -88,9 +126,8 @@ const Overlay = forwardRef<Ref, OverlayProps>(
88
126
  whileElementsMounted: autoUpdate,
89
127
  });
90
128
 
91
- const overlayPlacement = currentPlacement.split(
92
- '-'
93
- )[0] as 'left' | 'right' | 'top' | 'bottom';
129
+ const overlayPlacement = currentPlacement.split('-')[0] as
130
+ 'left' | 'right' | 'top' | 'bottom';
94
131
 
95
132
  useLayoutEffect(() => {
96
133
  refs.setReference(reference.current);
@@ -135,9 +172,7 @@ const Overlay = forwardRef<Ref, OverlayProps>(
135
172
  let ArrowComp = null;
136
173
 
137
174
  if (arrow) {
138
- const arrowElement = arrow as ReactElement<
139
- HTMLAttributes<HTMLElement>
140
- >;
175
+ const arrowElement = arrow as ReactElement<HTMLAttributes<HTMLElement>>;
141
176
 
142
177
  arrowStyle = cx(
143
178
  arrowBaseStyle,
@@ -177,12 +212,20 @@ const Overlay = forwardRef<Ref, OverlayProps>(
177
212
  <>
178
213
  {blanket && <Blanket onClick={onBlanketClick} />}
179
214
  <div
180
- ref={refs.setFloating}
215
+ ref={(node) => {
216
+ ref.current = node;
217
+ refs.setFloating(node);
218
+ }}
181
219
  className={style}
182
220
  style={{
221
+ ...(inlineStyle as CSSProperties),
183
222
  position: strategy,
184
223
  left: x ?? 0,
185
224
  top: y ?? 0,
225
+ visibility:
226
+ x === null || y === null
227
+ ? 'hidden'
228
+ : (inlineStyle as CSSProperties | undefined)?.visibility,
186
229
  }}
187
230
  {...props}
188
231
  >
@@ -0,0 +1,81 @@
1
+ import { afterEach, describe, expect, test, vi } from 'vitest';
2
+ import { useRef } from 'react';
3
+ import { render, waitFor } from '@testing-library/react';
4
+ import Overlay from '../Overlay';
5
+
6
+ describe('Overlay', () => {
7
+ afterEach(() => {
8
+ vi.restoreAllMocks();
9
+ });
10
+
11
+ test('reports viewport sizing when size is enabled', async () => {
12
+ vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(
13
+ function (this: HTMLElement) {
14
+ if (this.classList.contains('ucl-overlay')) {
15
+ return {
16
+ x: 0,
17
+ y: 48,
18
+ top: 48,
19
+ left: 0,
20
+ right: 120,
21
+ bottom: 88,
22
+ width: 120,
23
+ height: 40,
24
+ toJSON: () => {},
25
+ };
26
+ }
27
+
28
+ return {
29
+ x: 0,
30
+ y: 0,
31
+ top: 0,
32
+ left: 0,
33
+ right: 240,
34
+ bottom: 48,
35
+ width: 240,
36
+ height: 48,
37
+ toJSON: () => {},
38
+ };
39
+ }
40
+ );
41
+ const handleSizeChange = vi.fn();
42
+
43
+ const TestOverlay = () => {
44
+ const reference = useRef<HTMLButtonElement>(null);
45
+
46
+ return (
47
+ <>
48
+ <button
49
+ ref={reference}
50
+ type='button'
51
+ >
52
+ Anchor
53
+ </button>
54
+ <Overlay
55
+ reference={reference}
56
+ size={{ matchReferenceWidth: true }}
57
+ onSizeChange={handleSizeChange}
58
+ >
59
+ Content
60
+ </Overlay>
61
+ </>
62
+ );
63
+ };
64
+
65
+ const result = render(<TestOverlay />);
66
+ const overlay = result.container.querySelector('.ucl-overlay');
67
+
68
+ expect(overlay).toBeInTheDocument();
69
+
70
+ await waitFor(() => {
71
+ expect(overlay).toHaveStyle({
72
+ minWidth: '240px',
73
+ });
74
+ expect(handleSizeChange).toHaveBeenCalledWith({
75
+ referenceWidth: 240,
76
+ availableWidth: expect.any(Number),
77
+ availableHeight: expect.any(Number),
78
+ });
79
+ });
80
+ });
81
+ });
@@ -1,2 +1,2 @@
1
1
  export { default } from './Overlay';
2
- export type { OverlayProps } from './Overlay';
2
+ export type { OverlayProps, OverlaySize } from './Overlay';
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import Pagination from './Pagination';
3
3
 
4
4
  const meta = {
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import Paragraph from './Paragraph';
3
3
  import { Link } from '../';
4
4
 
@@ -1,5 +1,5 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { useArgs } from '@storybook/preview-api';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { useArgs } from 'storybook/preview-api';
3
3
 
4
4
  import Radio from './Radio';
5
5
 
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import Search from './Search';
3
3
 
4
4
  const meta = {
@@ -1,5 +1,5 @@
1
1
  import * as SelectStories from "./Select.stories";
2
- import { Meta, Title, Subtitle, Canvas, Controls, ArgTypes } from "@storybook/blocks";
2
+ import { Meta, Title, Subtitle, Canvas, Controls, ArgTypes } from "@storybook/addon-docs/blocks";
3
3
 
4
4
  export const usage = {
5
5
  default: `<Select
@@ -1,5 +1,5 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { useArgs } from '@storybook/preview-api';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { useArgs } from 'storybook/preview-api';
3
3
  import Select from './Select';
4
4
  import { css } from '@emotion/css';
5
5
 
@@ -100,6 +100,13 @@ const meta = {
100
100
  control: { type: 'boolean' },
101
101
  table: { type: { summary: 'boolean' } },
102
102
  },
103
+ dropdownWidth: {
104
+ description:
105
+ 'Control whether the options panel grows to content or matches the Select width',
106
+ control: { type: 'radio' },
107
+ options: ['content', 'match-select'],
108
+ table: { type: { summary: "'content' | 'match-select'" } },
109
+ },
103
110
  panelClassName: {
104
111
  description: 'Custom className for the options panel',
105
112
  control: { type: 'text' },