@charcoal-ui/react 6.1.0-beta.3 → 6.1.0-beta.4

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 (33) hide show
  1. package/dist/_lib/compat.d.ts +4 -3
  2. package/dist/_lib/compat.d.ts.map +1 -1
  3. package/dist/components/Notification/Snackbar/index.d.ts +4 -0
  4. package/dist/components/Notification/Snackbar/index.d.ts.map +1 -1
  5. package/dist/components/Notification/Snackbar/index2.cjs +11 -8
  6. package/dist/components/Notification/Snackbar/index2.cjs.map +1 -1
  7. package/dist/components/Notification/Snackbar/index2.js +12 -9
  8. package/dist/components/Notification/Snackbar/index2.js.map +1 -1
  9. package/dist/components/Notification/Toast/index2.js +20 -16
  10. package/dist/components/Notification/Toast/index2.js.map +1 -1
  11. package/dist/components/Notification/useNotificationQueue.cjs +11 -11
  12. package/dist/components/Notification/useNotificationQueue.cjs.map +1 -1
  13. package/dist/components/Notification/useNotificationQueue.d.ts +2 -1
  14. package/dist/components/Notification/useNotificationQueue.d.ts.map +1 -1
  15. package/dist/components/Notification/useNotificationQueue.js +11 -11
  16. package/dist/components/Notification/useNotificationQueue.js.map +1 -1
  17. package/dist/components/Pagination/index2.js +60 -52
  18. package/dist/components/Pagination/index2.js.map +1 -1
  19. package/dist/index.css +853 -854
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/layered.css +853 -854
  23. package/dist/layered.css.map +1 -1
  24. package/package.json +5 -5
  25. package/src/_lib/compat.ts +4 -3
  26. package/src/components/Carousel/__snapshots__/index.css.snap +4 -4
  27. package/src/components/Carousel/index.css +4 -4
  28. package/src/components/Notification/Snackbar/index.test.tsx +25 -4
  29. package/src/components/Notification/Snackbar/index.tsx +16 -1
  30. package/src/components/Notification/useNotificationQueue.ts +16 -15
  31. package/src/components/Pagination/__snapshots__/index.css.snap +0 -1
  32. package/src/components/Pagination/index.css +0 -1
  33. package/src/index.ts +1 -0
@@ -18,11 +18,13 @@ export function useNotificationQueue<
18
18
  {
19
19
  duration: durationOption,
20
20
  order = 'queue',
21
+ animateReplace = false,
21
22
  timeoutReason,
22
23
  unmountedReason,
23
24
  }: {
24
25
  duration?: number
25
26
  order?: NotificationOrder
27
+ animateReplace?: boolean
26
28
  timeoutReason?: TCloseReason
27
29
  unmountedReason?: TCloseReason
28
30
  } = {},
@@ -57,24 +59,20 @@ export function useNotificationQueue<
57
59
  return
58
60
  }
59
61
 
60
- function notifyActive() {
61
- const active = activeRef.current
62
- if (active === undefined || active.notified) return
63
- active.notified = true
64
- const reason = active.reason ?? timeoutReason
65
- if (reason !== undefined) {
66
- active.onClose?.(reason)
67
- }
68
- }
69
-
70
62
  function finish() {
63
+ const active = activeRef.current
71
64
  activeRef.current = undefined
72
65
  update()
66
+ if (active !== undefined && !active.notified) {
67
+ active.notified = true
68
+ const reason = active.reason ?? timeoutReason
69
+ if (reason !== undefined) {
70
+ active.onClose?.(reason)
71
+ }
72
+ }
73
73
  playNextRef.current?.()
74
74
  }
75
75
 
76
- notifyActive()
77
-
78
76
  if (hoverRef.current.active) {
79
77
  hoverRef.current.pending = () => wrapUpdate(update, 'remove')
80
78
  return
@@ -90,6 +88,7 @@ export function useNotificationQueue<
90
88
  finish()
91
89
  return
92
90
  }
91
+
93
92
  const item: HTMLDivElement = itemRef.current
94
93
 
95
94
  // allow-discreteが Newly Available で使えないので、要素の削除をアニメーション完了まで待つ
@@ -129,8 +128,10 @@ export function useNotificationQueue<
129
128
  return () => {
130
129
  const active = activeRef.current
131
130
  if (active !== undefined && !active.notified) {
132
- if (unmountedReason !== undefined) {
133
- active.onClose?.(unmountedReason)
131
+ active.notified = true
132
+ const reason = active.reason ?? unmountedReason
133
+ if (reason !== undefined) {
134
+ active.onClose?.(reason)
134
135
  }
135
136
  }
136
137
  activeRef.current = undefined
@@ -181,7 +182,7 @@ export function useNotificationQueue<
181
182
  if (active === undefined) return
182
183
 
183
184
  active.reason = 'replaced' as TCloseReason
184
- replaceRef.current = true
185
+ replaceRef.current = !animateReplace
185
186
  hoverRef.current.active = false
186
187
  const pending = hoverRef.current.pending
187
188
  hoverRef.current.pending = undefined
@@ -39,7 +39,6 @@
39
39
  * Safari doesn't correctly repaint the elements when they're reordered in response to interaction.
40
40
  * This forces it to repaint them. This doesn't work if put on the parents either, has to be here.
41
41
  */
42
- /* stylelint-disable-next-line property-no-vendor-prefix */
43
42
  -webkit-transform: translateZ(0);
44
43
  color: var(--charcoal-color-text-tertiary-default);
45
44
  background-color: transparent;
@@ -39,7 +39,6 @@
39
39
  * Safari doesn't correctly repaint the elements when they're reordered in response to interaction.
40
40
  * This forces it to repaint them. This doesn't work if put on the parents either, has to be here.
41
41
  */
42
- /* stylelint-disable-next-line property-no-vendor-prefix */
43
42
  -webkit-transform: translateZ(0);
44
43
 
45
44
  color: var(--charcoal-color-text-tertiary-default);
package/src/index.ts CHANGED
@@ -112,6 +112,7 @@ export {
112
112
  type SnackbarProps as UnstableSnackbarProps,
113
113
  type UseSnackbarProps as unstable_UseSnackbarProps,
114
114
  type SnackbarCloseReason as unstable_SnackbarCloseReason,
115
+ type SnackbarRootAttributes as unstable_SnackbarRootAttributes,
115
116
  type ShowSnackbarOptions as unstable_ShowSnackbarOptions,
116
117
  } from './components/Notification/Snackbar'
117
118
  export {