@charcoal-ui/react 6.1.0-beta.5 → 6.1.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 (35) hide show
  1. package/dist/components/Notification/NotificationRegion.cjs +11 -6
  2. package/dist/components/Notification/NotificationRegion.cjs.map +1 -1
  3. package/dist/components/Notification/NotificationRegion.d.ts +2 -1
  4. package/dist/components/Notification/NotificationRegion.d.ts.map +1 -1
  5. package/dist/components/Notification/NotificationRegion.js +12 -7
  6. package/dist/components/Notification/NotificationRegion.js.map +1 -1
  7. package/dist/components/Notification/Snackbar/index.d.ts +1 -0
  8. package/dist/components/Notification/Snackbar/index.d.ts.map +1 -1
  9. package/dist/components/Notification/Snackbar/index2.cjs.map +1 -1
  10. package/dist/components/Notification/Snackbar/index2.js.map +1 -1
  11. package/dist/components/Notification/types.d.ts +5 -0
  12. package/dist/components/Notification/types.d.ts.map +1 -1
  13. package/dist/components/TextField/index.d.ts +0 -2
  14. package/dist/components/TextField/index.d.ts.map +1 -1
  15. package/dist/components/TextField/index2.cjs.map +1 -1
  16. package/dist/components/TextField/index2.js.map +1 -1
  17. package/dist/index.css +1518 -1515
  18. package/dist/layered.css +1518 -1515
  19. package/dist/layered.css.map +1 -1
  20. package/package.json +4 -7
  21. package/src/components/Notification/NotificationRegion.browser.test.tsx +120 -0
  22. package/src/components/Notification/NotificationRegion.tsx +14 -8
  23. package/src/components/Notification/Snackbar/__snapshots__/index.css.snap +5 -6
  24. package/src/components/Notification/Snackbar/index.css +7 -6
  25. package/src/components/Notification/Snackbar/index.story.tsx +4 -1
  26. package/src/components/Notification/Snackbar/index.test.tsx +5 -2
  27. package/src/components/Notification/Snackbar/index.tsx +1 -0
  28. package/src/components/Notification/Toast/__snapshots__/index.css.snap +5 -5
  29. package/src/components/Notification/Toast/index.css +7 -5
  30. package/src/components/Notification/Toast/index.story.tsx +4 -1
  31. package/src/components/Notification/Toast/index.test.tsx +5 -2
  32. package/src/components/Notification/__snapshots__/layout.css.snap +8 -4
  33. package/src/components/Notification/layout.css +8 -4
  34. package/src/components/Notification/types.ts +5 -0
  35. package/src/components/TextField/index.tsx +0 -1
@@ -1,19 +1,18 @@
1
- .charcoal-snackbar-region {
1
+ .charcoal-notification-region {
2
2
  --charcoal-snackbar-offset: 16px;
3
3
  }
4
4
 
5
5
  .charcoal-snackbar-region[data-position='top'] {
6
6
  --charcoal-snackbar-enter-offset: calc(-1 * var(--charcoal-space-30));
7
- top: calc(
8
- env(safe-area-inset-top, 0px) + max(var(--charcoal-snackbar-offset), 16px)
9
- );
7
+ position: sticky;
8
+ top: calc(env(safe-area-inset-top, 0px) + var(--charcoal-snackbar-offset));
10
9
  }
11
10
 
12
11
  .charcoal-snackbar-region[data-position='bottom'] {
13
12
  --charcoal-snackbar-enter-offset: var(--charcoal-space-30);
13
+ position: fixed;
14
14
  bottom: calc(
15
- env(safe-area-inset-bottom, 0px) +
16
- max(var(--charcoal-snackbar-offset), 16px)
15
+ env(safe-area-inset-bottom, 0px) + var(--charcoal-snackbar-offset)
17
16
  );
18
17
  }
19
18
 
@@ -1,20 +1,21 @@
1
- .charcoal-snackbar-region {
1
+ .charcoal-notification-region {
2
2
  --charcoal-snackbar-offset: 16px;
3
+ }
3
4
 
5
+ .charcoal-snackbar-region {
4
6
  &[data-position='top'] {
5
7
  --charcoal-snackbar-enter-offset: calc(-1 * var(--charcoal-space-30));
6
8
 
7
- top: calc(
8
- env(safe-area-inset-top, 0px) + max(var(--charcoal-snackbar-offset), 16px)
9
- );
9
+ position: sticky;
10
+ top: calc(env(safe-area-inset-top, 0px) + var(--charcoal-snackbar-offset));
10
11
  }
11
12
 
12
13
  &[data-position='bottom'] {
13
14
  --charcoal-snackbar-enter-offset: var(--charcoal-space-30);
14
15
 
16
+ position: fixed;
15
17
  bottom: calc(
16
- env(safe-area-inset-bottom, 0px) +
17
- max(var(--charcoal-snackbar-offset), 16px)
18
+ env(safe-area-inset-bottom, 0px) + var(--charcoal-snackbar-offset)
18
19
  );
19
20
  }
20
21
  }
@@ -34,7 +34,6 @@ export default {
34
34
  args: {
35
35
  message: '保存しました',
36
36
  position: 'bottom',
37
- offset: 16,
38
37
  duration: 5000,
39
38
  order: 'queue',
40
39
  dim: false,
@@ -50,6 +49,10 @@ export default {
50
49
  control: { type: 'number', min: 0, step: 1 },
51
50
  table: { category: 'Hook', defaultValue: { summary: '16' } },
52
51
  },
52
+ headerOffset: {
53
+ control: { type: 'number', min: 0, step: 1 },
54
+ table: { category: 'Hook', defaultValue: { summary: '0' } },
55
+ },
53
56
  duration: {
54
57
  control: { type: 'number', min: 0, step: 500 },
55
58
  description: '表示時間(ミリ秒)',
@@ -288,7 +288,7 @@ describe('Snackbar', () => {
288
288
  action: <button type="button">取り消す</button>,
289
289
  })
290
290
 
291
- expect(screen.getByRole('region')).toHaveAttribute(
291
+ expect(document.querySelector('.charcoal-snackbar-region')).toHaveAttribute(
292
292
  'data-position',
293
293
  'bottom',
294
294
  )
@@ -299,7 +299,10 @@ describe('Snackbar', () => {
299
299
 
300
300
  show('保存しました')
301
301
 
302
- expect(screen.getByRole('region')).toHaveAttribute('data-position', 'top')
302
+ expect(document.querySelector('.charcoal-snackbar-region')).toHaveAttribute(
303
+ 'data-position',
304
+ 'top',
305
+ )
303
306
  })
304
307
 
305
308
  it('supports a custom z-index and portal container', () => {
@@ -17,6 +17,7 @@ export type SnackbarRootAttributes = {
17
17
  export type ShowSnackbarOptions = {
18
18
  action?: ReactNode
19
19
  onClose?: (reason: SnackbarCloseReason) => void
20
+ /** スナックバー自体にdata属性を渡せる */
20
21
  rootAttributes?: SnackbarRootAttributes
21
22
  }
22
23
 
@@ -1,18 +1,18 @@
1
- .charcoal-toast-region {
1
+ .charcoal-notification-region {
2
2
  --charcoal-toast-offset: 16px;
3
3
  }
4
4
 
5
5
  .charcoal-toast-region[data-position='top'] {
6
+ position: sticky;
6
7
  --charcoal-toast-enter-offset: calc(-1 * var(--charcoal-space-30));
7
- top: calc(
8
- env(safe-area-inset-top, 0px) + max(var(--charcoal-toast-offset), 16px)
9
- );
8
+ top: calc(env(safe-area-inset-top, 0px) + var(--charcoal-toast-offset));
10
9
  }
11
10
 
12
11
  .charcoal-toast-region[data-position='bottom'] {
12
+ position: fixed;
13
13
  --charcoal-toast-enter-offset: var(--charcoal-space-30);
14
14
  bottom: calc(
15
- env(safe-area-inset-bottom, 0px) + max(var(--charcoal-toast-offset), 16px)
15
+ env(safe-area-inset-bottom, 0px) + var(--charcoal-toast-offset)
16
16
  );
17
17
  }
18
18
 
@@ -1,19 +1,21 @@
1
- .charcoal-toast-region {
1
+ .charcoal-notification-region {
2
2
  --charcoal-toast-offset: 16px;
3
+ }
3
4
 
5
+ .charcoal-toast-region {
4
6
  &[data-position='top'] {
7
+ position: sticky;
5
8
  --charcoal-toast-enter-offset: calc(-1 * var(--charcoal-space-30));
6
9
 
7
- top: calc(
8
- env(safe-area-inset-top, 0px) + max(var(--charcoal-toast-offset), 16px)
9
- );
10
+ top: calc(env(safe-area-inset-top, 0px) + var(--charcoal-toast-offset));
10
11
  }
11
12
 
12
13
  &[data-position='bottom'] {
14
+ position: fixed;
13
15
  --charcoal-toast-enter-offset: var(--charcoal-space-30);
14
16
 
15
17
  bottom: calc(
16
- env(safe-area-inset-bottom, 0px) + max(var(--charcoal-toast-offset), 16px)
18
+ env(safe-area-inset-bottom, 0px) + var(--charcoal-toast-offset)
17
19
  );
18
20
  }
19
21
  }
@@ -34,7 +34,6 @@ export default {
34
34
  args: {
35
35
  message: '保存しました',
36
36
  position: 'top',
37
- offset: 16,
38
37
  duration: 5000,
39
38
  order: 'queue',
40
39
  zIndex: 20,
@@ -50,6 +49,10 @@ export default {
50
49
  control: { type: 'number', min: 0, step: 1 },
51
50
  table: { category: 'Hook', defaultValue: { summary: '16' } },
52
51
  },
52
+ headerOffset: {
53
+ control: { type: 'number', min: 0, step: 1 },
54
+ table: { category: 'Hook', defaultValue: { summary: '0' } },
55
+ },
53
56
  duration: {
54
57
  control: { type: 'number', min: 0, step: 500 },
55
58
  description: '表示時間(ミリ秒)',
@@ -177,7 +177,10 @@ describe('Toast', () => {
177
177
 
178
178
  show('保存しました', { type: 'success' })
179
179
 
180
- expect(screen.getByRole('region')).toHaveAttribute('data-position', 'top')
180
+ expect(document.querySelector('.charcoal-toast-region')).toHaveAttribute(
181
+ 'data-position',
182
+ 'top',
183
+ )
181
184
  })
182
185
 
183
186
  it('places a toast at the bottom when requested', () => {
@@ -185,7 +188,7 @@ describe('Toast', () => {
185
188
 
186
189
  show('保存しました', { type: 'success' })
187
190
 
188
- expect(screen.getByRole('region')).toHaveAttribute(
191
+ expect(document.querySelector('.charcoal-toast-region')).toHaveAttribute(
189
192
  'data-position',
190
193
  'bottom',
191
194
  )
@@ -1,11 +1,15 @@
1
1
  .charcoal-notification-region {
2
- position: fixed;
3
2
  left: 0;
4
3
  right: 0;
5
- display: grid;
6
- justify-content: center;
7
- pointer-events: none;
8
4
  box-sizing: border-box;
5
+ position: absolute;
6
+ width: 100%;
7
+ height: 100%;
8
+ display: flex;
9
+ flex-direction: column;
10
+ align-items: center;
11
+ pointer-events: none;
12
+ top: 0;
9
13
  }
10
14
 
11
15
  .charcoal-notification {
@@ -1,11 +1,15 @@
1
1
  .charcoal-notification-region {
2
- position: fixed;
3
2
  left: 0;
4
3
  right: 0;
5
- display: grid;
6
- justify-content: center;
7
- pointer-events: none;
8
4
  box-sizing: border-box;
5
+ position: absolute;
6
+ width: 100%;
7
+ height: 100%;
8
+ display: flex;
9
+ flex-direction: column;
10
+ align-items: center;
11
+ pointer-events: none;
12
+ top: 0;
9
13
  }
10
14
 
11
15
  .charcoal-notification {
@@ -9,6 +9,11 @@ export type UseNotificationOptions = {
9
9
  * @default 16
10
10
  */
11
11
  offset?: number
12
+ /**
13
+ * スクロールに追従しないヘッダーの高さを指定する
14
+ * @default 0
15
+ */
16
+ headerOffset?: number
12
17
  /**
13
18
  * 通知を表示する時間(ミリ秒)。負の値は 0、数値でない値は 5000 として扱う
14
19
  * @default 5000
@@ -26,7 +26,6 @@ export type TextFieldProps = {
26
26
  requiredText?: string
27
27
  disabled?: boolean
28
28
  subLabel?: React.ReactNode
29
- rdfaPrefix?: string
30
29
 
31
30
  getCount?: (value: string) => number
32
31
  } & Omit<React.ComponentPropsWithoutRef<'input'>, 'prefix' | 'onChange'>