@charcoal-ui/react 5.11.0 → 6.0.0-beta.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 (42) hide show
  1. package/dist/components/Checkbox/index.d.ts.map +1 -1
  2. package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
  3. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  4. package/dist/components/Modal/index.d.ts +2 -2
  5. package/dist/components/Modal/index.d.ts.map +1 -1
  6. package/dist/components/Modal/useCustomModalOverlay.d.ts +1 -1
  7. package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
  8. package/dist/components/SegmentedControl/RadioGroupContext.d.ts +1 -1
  9. package/dist/components/SegmentedControl/RadioGroupContext.d.ts.map +1 -1
  10. package/dist/components/SegmentedControl/index.d.ts.map +1 -1
  11. package/dist/components/Switch/index.d.ts.map +1 -1
  12. package/dist/components/TagItem/index.d.ts.map +1 -1
  13. package/dist/components/TextField/index.d.ts.map +1 -1
  14. package/dist/core/OverlayProvider.d.ts +1 -1
  15. package/dist/core/OverlayProvider.d.ts.map +1 -1
  16. package/dist/core/SSRProvider.d.ts +1 -1
  17. package/dist/core/SSRProvider.d.ts.map +1 -1
  18. package/dist/index.cjs +2 -2
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.js +2 -2
  21. package/dist/index.js.map +1 -1
  22. package/package.json +15 -24
  23. package/src/__tests__/css-output.test.ts +2 -1
  24. package/src/components/Checkbox/__snapshots__/index.css.snap +1 -0
  25. package/src/components/Checkbox/index.tsx +1 -1
  26. package/src/components/DropdownSelector/Popover/index.tsx +2 -1
  27. package/src/components/DropdownSelector/index.tsx +3 -2
  28. package/src/components/Modal/Dialog/index.tsx +1 -1
  29. package/src/components/Modal/index.story.tsx +9 -9
  30. package/src/components/Modal/index.tsx +4 -3
  31. package/src/components/Modal/useCustomModalOverlay.tsx +6 -5
  32. package/src/components/Radio/__snapshots__/index.css.snap +1 -0
  33. package/src/components/SegmentedControl/RadioGroupContext.tsx +1 -1
  34. package/src/components/SegmentedControl/index.tsx +5 -5
  35. package/src/components/Switch/__snapshots__/index.css.snap +1 -0
  36. package/src/components/Switch/index.tsx +1 -1
  37. package/src/components/TagItem/index.tsx +2 -2
  38. package/src/components/TextArea/index.tsx +2 -2
  39. package/src/components/TextEllipsis/__snapshots__/index.css.snap +1 -0
  40. package/src/components/TextField/index.tsx +3 -3
  41. package/src/core/OverlayProvider.tsx +1 -1
  42. package/src/core/SSRProvider.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charcoal-ui/react",
3
- "version": "5.11.0",
3
+ "version": "6.0.0-beta.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -20,47 +20,37 @@
20
20
  "*.css"
21
21
  ],
22
22
  "devDependencies": {
23
- "@react-types/dialog": "^3.5.15",
24
- "@react-types/switch": "^3.1.2",
25
23
  "@testing-library/jest-dom": "^6.6.3",
26
24
  "@testing-library/react": "^16.2.0",
27
25
  "@testing-library/user-event": "^13.5.0",
28
- "@types/glob": "^8.1.0",
29
26
  "@types/react": "^18.3.3",
30
27
  "@types/react-dom": "^18.3.0",
31
- "@types/react-router-dom": "^5.3.3",
32
28
  "@types/warning": "^3.0.4",
29
+ "@vitejs/plugin-react": "^4.3.1",
30
+ "@vitest/browser": "^2.1.9",
33
31
  "autoprefixer": "^10.4.19",
34
32
  "jsdom": "^24.1.0",
33
+ "playwright": "^1.58.2",
35
34
  "postcss-nested": "^7.0.2",
36
35
  "react": "^18.3.1",
36
+ "react-aria": "3.48.0",
37
37
  "react-dom": "^18.3.1",
38
- "react-router-dom": "^6.2.1"
38
+ "react-stately": "3.46.0"
39
39
  },
40
40
  "dependencies": {
41
- "@react-aria/button": "^3.9.1",
42
- "@react-aria/checkbox": "^3.13.0",
43
- "@react-aria/dialog": "^3.5.10",
44
- "@react-aria/focus": "^3.16.0",
45
- "@react-aria/overlays": "^3.20.0",
46
- "@react-aria/radio": "^3.10.0",
47
- "@react-aria/ssr": "^3.9.1",
48
- "@react-aria/switch": "^3.6.0",
49
- "@react-aria/utils": "^3.23.0",
50
- "@react-aria/visually-hidden": "^3.8.8",
51
41
  "@react-spring/web": "^10",
52
- "@react-stately/radio": "^3.10.2",
53
42
  "polished": "^4.1.4",
54
43
  "react-compiler-runtime": "1.0.0",
55
- "react-stately": "^3.26.0",
56
44
  "warning": "^4.0.3",
57
- "@charcoal-ui/foundation": "5.11.0",
58
- "@charcoal-ui/icons": "5.11.0",
59
- "@charcoal-ui/theme": "5.11.0",
60
- "@charcoal-ui/utils": "5.11.0"
45
+ "@charcoal-ui/foundation": "6.0.0-beta.0",
46
+ "@charcoal-ui/theme": "6.0.0-beta.0",
47
+ "@charcoal-ui/icons": "6.0.0-beta.0",
48
+ "@charcoal-ui/utils": "6.0.0-beta.0"
61
49
  },
62
50
  "peerDependencies": {
63
- "react": ">=17.0.0"
51
+ "react": ">=17.0.0",
52
+ "react-aria": ">=3.48.0",
53
+ "react-stately": ">=3.46.0"
64
54
  },
65
55
  "files": [
66
56
  "src",
@@ -81,6 +71,7 @@
81
71
  "build:dts": "tsc --project tsconfig.build.json --pretty --emitDeclarationOnly",
82
72
  "typecheck": "tsc --project tsconfig.build.json --pretty --noEmit",
83
73
  "clean": "rimraf dist .tsbuildinfo",
84
- "test": "vitest run --passWithNoTests"
74
+ "test": "vitest run --passWithNoTests",
75
+ "test:browser": "vitest run --config vitest.browser.config.ts"
85
76
  }
86
77
  }
@@ -72,6 +72,7 @@ describe('CSS nesting output equivalence', () => {
72
72
  '__snapshots__',
73
73
  'index.css.snap',
74
74
  )
75
- await expect(canonicalize(result.root)).toMatchFileSnapshot(snapshotPath)
75
+ const expected = await fs.readFile(snapshotPath, 'utf-8')
76
+ expect(canonicalize(result.root)).toBe(expected)
76
77
  })
77
78
  })
@@ -20,3 +20,4 @@
20
20
  font-size: 14px;
21
21
  line-height: 20px;
22
22
  }
23
+
@@ -1,9 +1,9 @@
1
1
  import './index.css'
2
2
 
3
3
  import { forwardRef, memo } from 'react'
4
- import { useId } from '@react-aria/utils'
5
4
  import CheckboxInput, { CheckboxInputProps } from './CheckboxInput'
6
5
  import { CheckboxWithLabel } from './CheckboxWithLabel'
6
+ import { useId } from 'react-aria/useId'
7
7
 
8
8
  export type CheckboxProps = CheckboxInputProps
9
9
 
@@ -1,9 +1,10 @@
1
1
  import './index.css'
2
2
 
3
3
  import { RefObject, useContext, useRef, ReactNode } from 'react'
4
- import { DismissButton, Overlay, usePopover } from '@react-aria/overlays'
5
4
  import { ModalBackgroundContext } from '../../Modal/ModalBackgroundContext'
6
5
  import { usePreventScroll } from './usePreventScroll'
6
+ import { DismissButton, Overlay } from 'react-aria/Overlay'
7
+ import { usePopover } from 'react-aria/usePopover'
7
8
 
8
9
  export type PopoverProps = {
9
10
  isOpen: boolean
@@ -7,12 +7,13 @@ import { DropdownPopover } from './DropdownPopover'
7
7
  import { findPreviewRecursive } from './utils/findPreviewRecursive'
8
8
  import MenuList, { MenuListChildren } from './MenuList'
9
9
  import { getValuesRecursive } from './MenuList/internals/getValuesRecursive'
10
- import { useVisuallyHidden } from '@react-aria/visually-hidden'
11
10
  import { AssistiveText } from '../TextField/AssistiveText'
12
11
  import { useClassNames } from '../../_lib/useClassNames'
13
- import { useId } from '@react-aria/utils'
14
12
  import { PopoverProps } from './Popover'
15
13
 
14
+ import { useVisuallyHidden } from 'react-aria/VisuallyHidden'
15
+ import { useId } from 'react-aria/useId'
16
+
16
17
  export type DropdownSelectorProps = {
17
18
  label: string
18
19
  value: string
@@ -1,6 +1,6 @@
1
1
  import { forwardRef } from 'react'
2
2
  import * as React from 'react'
3
- import { useDialog } from '@react-aria/dialog'
3
+ import { useDialog } from 'react-aria/useDialog'
4
4
  import { useForwardedRef } from '../../../_lib/useForwardedRef'
5
5
  import { Size, BottomSheet } from '..'
6
6
 
@@ -1,6 +1,5 @@
1
1
  import Modal, { ModalDismissButton, ModalProps } from '.'
2
- import { OverlayProvider } from '@react-aria/overlays'
3
- import { useOverlayTriggerState } from 'react-stately'
2
+ import { useOverlayTriggerState } from 'react-stately/useOverlayTriggerState'
4
3
  import Button from '../Button'
5
4
  import {
6
5
  ModalAlign,
@@ -13,6 +12,9 @@ import DropdownSelector from '../DropdownSelector'
13
12
  import Checkbox from '../Checkbox'
14
13
  import DropdownMenuItem from '../DropdownSelector/DropdownMenuItem'
15
14
  import { Meta, StoryObj } from '@storybook/react-vite'
15
+ import { OverlayProvider } from 'react-aria'
16
+
17
+ const defaultOpen = !!process.env.TEST
16
18
 
17
19
  export default {
18
20
  title: 'react/Modal',
@@ -38,7 +40,7 @@ export default {
38
40
  },
39
41
  },
40
42
  render: function Render(args) {
41
- const state = useOverlayTriggerState({})
43
+ const state = useOverlayTriggerState({ defaultOpen })
42
44
  return (
43
45
  // Application must be wrapped in an OverlayProvider so that it can be
44
46
  // hidden from screen readers when a modal opens.
@@ -138,13 +140,12 @@ export const FullBottomSheet: StoryObj<typeof Modal> = {
138
140
  bottomSheet: 'full',
139
141
  },
140
142
  render: function Render(args) {
141
- const state = useOverlayTriggerState({})
143
+ const state = useOverlayTriggerState({ defaultOpen })
142
144
  return (
143
145
  // Application must be wrapped in an OverlayProvider so that it can be
144
146
  // hidden from screen readers when a modal opens.
145
147
  <OverlayProvider>
146
148
  <Button onClick={() => state.open()}>Open Modal</Button>
147
-
148
149
  <Modal
149
150
  {...args}
150
151
  isDismissable
@@ -184,13 +185,12 @@ export const FullBottomSheet: StoryObj<typeof Modal> = {
184
185
 
185
186
  export const BottomSheet: StoryObj<typeof Modal> = {
186
187
  render: function Render(args) {
187
- const state = useOverlayTriggerState({})
188
+ const state = useOverlayTriggerState({ defaultOpen })
188
189
  return (
189
190
  // Application must be wrapped in an OverlayProvider so that it can be
190
191
  // hidden from screen readers when a modal opens.
191
192
  <OverlayProvider>
192
193
  <Button onClick={() => state.open()}>Open Modal</Button>
193
-
194
194
  <Modal
195
195
  {...args}
196
196
  isOpen={state.isOpen}
@@ -224,7 +224,7 @@ export const BottomSheet: StoryObj<typeof Modal> = {
224
224
 
225
225
  export const NotDismmissableStory: StoryObj<typeof Modal> = {
226
226
  render: function Render(args) {
227
- const state = useOverlayTriggerState({})
227
+ const state = useOverlayTriggerState({ defaultOpen })
228
228
  return (
229
229
  <OverlayProvider>
230
230
  <Button onClick={() => state.open()}>Open Modal</Button>
@@ -254,7 +254,7 @@ export const NotDismmissableStory: StoryObj<typeof Modal> = {
254
254
 
255
255
  export const BackgroundScroll: StoryObj<typeof Modal> = {
256
256
  render: function Render(args) {
257
- const state = useOverlayTriggerState({})
257
+ const state = useOverlayTriggerState({ defaultOpen })
258
258
  return (
259
259
  <OverlayProvider>
260
260
  <div
@@ -1,11 +1,9 @@
1
1
  import { useContext, forwardRef, memo } from 'react'
2
2
  import * as React from 'react'
3
- import { Overlay } from '@react-aria/overlays'
4
- import type { AriaDialogProps } from '@react-types/dialog'
3
+ import type { AriaDialogProps } from 'react-aria/useDialog'
5
4
  import { animated, useTransition, easings } from '@react-spring/web'
6
5
  import Button, { ButtonProps } from '../Button'
7
6
  import IconButton, { IconButtonProps } from '../IconButton'
8
- import { useObjectRef } from '@react-aria/utils'
9
7
  import { Dialog } from './Dialog'
10
8
  import { ModalBackgroundContext } from './ModalBackgroundContext'
11
9
  import {
@@ -16,6 +14,9 @@ import {
16
14
 
17
15
  import './index.css'
18
16
 
17
+ import { Overlay } from 'react-aria/Overlay'
18
+ import { useObjectRef } from 'react-aria/useObjectRef'
19
+
19
20
  export type BottomSheet = boolean | 'full'
20
21
  export type Size = 'S' | 'M' | 'L'
21
22
 
@@ -1,12 +1,13 @@
1
1
  import * as React from 'react'
2
+ import { ariaHideOutside } from 'react-aria/private/overlays/ariaHideOutside'
3
+ import { useOverlayFocusContain } from 'react-aria/private/overlays/Overlay'
4
+ import { usePreventScroll } from '../DropdownSelector/Popover/usePreventScroll'
5
+
2
6
  import {
3
7
  AriaModalOverlayProps,
4
8
  ModalOverlayAria,
5
- ariaHideOutside,
6
- useOverlay,
7
- useOverlayFocusContain,
8
- } from '@react-aria/overlays'
9
- import { usePreventScroll } from '../DropdownSelector/Popover/usePreventScroll'
9
+ } from 'react-aria/useModalOverlay'
10
+ import { useOverlay } from 'react-aria/useOverlay'
10
11
 
11
12
  /**
12
13
  * We want to enable scrolling on the modal background,
@@ -16,3 +16,4 @@
16
16
  line-height: 22px;
17
17
  color: var(--charcoal-text2);
18
18
  }
19
+
@@ -1,6 +1,6 @@
1
1
  import { createContext, useContext } from 'react'
2
2
  import * as React from 'react'
3
- import type { RadioGroupState } from '@react-stately/radio'
3
+ import { RadioGroupState } from 'react-stately/useRadioGroupState'
4
4
 
5
5
  const RadioContext = createContext<RadioGroupState | null>(null)
6
6
 
@@ -1,16 +1,16 @@
1
1
  import { ReactNode, forwardRef, memo, useMemo, useRef } from 'react'
2
2
  import * as React from 'react'
3
- import { useRadioGroupState } from '@react-stately/radio'
3
+ import { RadioProvider, useRadioContext } from './RadioGroupContext'
4
+ import { useClassNames } from '../../_lib/useClassNames'
5
+ import './index.css'
4
6
  import {
5
7
  AriaRadioGroupProps,
6
8
  AriaRadioProps,
7
9
  useRadio,
8
10
  useRadioGroup,
9
- } from '@react-aria/radio'
10
- import { RadioProvider, useRadioContext } from './RadioGroupContext'
11
- import { useClassNames } from '../../_lib/useClassNames'
11
+ } from 'react-aria/useRadioGroup'
12
12
 
13
- import './index.css'
13
+ import { useRadioGroupState } from 'react-stately/useRadioGroupState'
14
14
 
15
15
  type SegmentedControlItem = {
16
16
  label: React.ReactNode
@@ -21,3 +21,4 @@
21
21
  line-height: 22px;
22
22
  color: var(--charcoal-text2);
23
23
  }
24
+
@@ -1,9 +1,9 @@
1
1
  import './index.css'
2
2
 
3
3
  import { memo, forwardRef } from 'react'
4
- import { useId } from '@react-aria/utils'
5
4
  import SwitchInput, { type SwitchInputProps } from './SwitchInput'
6
5
  import { SwitchWithLabel } from './SwitchWithLabel'
6
+ import { useId } from 'react-aria/useId'
7
7
 
8
8
  export type SwitchProps = SwitchInputProps
9
9
 
@@ -1,10 +1,10 @@
1
1
  import React, { forwardRef, memo, useMemo, ForwardedRef, type JSX } from 'react'
2
- import { useObjectRef } from '@react-aria/utils'
3
2
  import Icon from '../Icon'
4
3
  import { useClassNames } from '../../_lib/useClassNames'
5
-
6
4
  import './index.css'
7
5
 
6
+ import { useObjectRef } from 'react-aria/useObjectRef'
7
+
8
8
  type SizeMap = {
9
9
  S: 32
10
10
  M: 40
@@ -1,6 +1,5 @@
1
1
  import './index.css'
2
2
 
3
- import { useVisuallyHidden } from '@react-aria/visually-hidden'
4
3
  import {
5
4
  forwardRef,
6
5
  useCallback,
@@ -13,9 +12,10 @@ import {
13
12
  import FieldLabel from '../FieldLabel'
14
13
  import { countCodePointsInString, mergeRefs } from '../../_lib'
15
14
  import { useFocusWithClick } from '../TextField/useFocusWithClick'
16
- import { useId } from '@react-aria/utils'
17
15
  import { AssistiveText } from '../TextField/AssistiveText'
18
16
  import { useClassNames } from '../../_lib/useClassNames'
17
+ import { useVisuallyHidden } from 'react-aria/VisuallyHidden'
18
+ import { useId } from 'react-aria/useId'
19
19
 
20
20
  /**
21
21
  * `TextArea` を `imperativeRef` から操作するためのハンドル
@@ -18,3 +18,4 @@
18
18
  text-overflow: ellipsis;
19
19
  white-space: nowrap;
20
20
  }
21
+
@@ -1,14 +1,14 @@
1
1
  import './index.css'
2
2
 
3
- import { useVisuallyHidden } from '@react-aria/visually-hidden'
4
3
  import { ReactNode, useCallback, useEffect, useRef, useState } from 'react'
5
4
  import * as React from 'react'
6
5
  import FieldLabel from '../FieldLabel'
7
- import { countCodePointsInString } from '../../_lib'
6
+ import { countCodePointsInString, mergeRefs } from '../../_lib'
8
7
  import { useFocusWithClick } from './useFocusWithClick'
9
- import { mergeRefs, useId } from '@react-aria/utils'
10
8
  import { AssistiveText } from './AssistiveText'
11
9
  import { useClassNames } from '../../_lib/useClassNames'
10
+ import { useVisuallyHidden } from 'react-aria/VisuallyHidden'
11
+ import { useId } from 'react-aria/useId'
12
12
 
13
13
  export type TextFieldProps = {
14
14
  prefix?: ReactNode
@@ -1 +1 @@
1
- export { OverlayProvider } from '@react-aria/overlays'
1
+ export { OverlayProvider } from 'react-aria/private/overlays/useModal'
@@ -1,5 +1,5 @@
1
- import { SSRProvider as OriginSSRProvider } from '@react-aria/ssr'
2
1
  import { version, Fragment } from 'react'
2
+ import { SSRProvider as OriginSSRProvider } from 'react-aria/SSRProvider'
3
3
 
4
4
  export function isReactVersionOver(minVersion: number): boolean {
5
5
  // version history on the react side: https://github.com/facebook/react/commits/main/packages/shared/ReactVersion.js