@charcoal-ui/react 6.0.0-rc.1 → 6.0.0-rc.3

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 (50) hide show
  1. package/dist/components/Carousel/CarouselItem.d.ts +10 -0
  2. package/dist/components/Carousel/CarouselItem.d.ts.map +1 -0
  3. package/dist/components/Carousel/carouselStore.d.ts +25 -0
  4. package/dist/components/Carousel/carouselStore.d.ts.map +1 -0
  5. package/dist/components/Carousel/index.d.ts +61 -0
  6. package/dist/components/Carousel/index.d.ts.map +1 -0
  7. package/dist/components/Carousel/intersectionObserver.d.ts +7 -0
  8. package/dist/components/Carousel/intersectionObserver.d.ts.map +1 -0
  9. package/dist/components/Carousel/resizeObserver.d.ts +6 -0
  10. package/dist/components/Carousel/resizeObserver.d.ts.map +1 -0
  11. package/dist/components/Carousel/store.d.ts +7 -0
  12. package/dist/components/Carousel/store.d.ts.map +1 -0
  13. package/dist/components/Carousel/useCarouselScroller.d.ts +18 -0
  14. package/dist/components/Carousel/useCarouselScroller.d.ts.map +1 -0
  15. package/dist/components/Icon/index.d.ts +1 -1
  16. package/dist/components/Icon/index.d.ts.map +1 -1
  17. package/dist/index.cjs +2 -2
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.css +319 -1
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +2 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/layered.css +319 -1
  25. package/dist/layered.css.map +1 -1
  26. package/package.json +5 -5
  27. package/src/__tests__/fixtures/legacy-v1-index.css +1836 -0
  28. package/src/__tests__/token-v1-compat.test.ts +118 -0
  29. package/src/__tests__/token-v1-remap.test.ts +133 -0
  30. package/src/components/Carousel/CarouselItem.tsx +56 -0
  31. package/src/components/Carousel/MIGRATION.md +117 -0
  32. package/src/components/Carousel/Migration.mdx +8 -0
  33. package/src/components/Carousel/__snapshots__/index.css.snap +274 -0
  34. package/src/components/Carousel/carouselStore.test.ts +38 -0
  35. package/src/components/Carousel/carouselStore.ts +48 -0
  36. package/src/components/Carousel/index.css +274 -0
  37. package/src/components/Carousel/index.story.tsx +169 -0
  38. package/src/components/Carousel/index.test.tsx +666 -0
  39. package/src/components/Carousel/index.tsx +278 -0
  40. package/src/components/Carousel/intersectionObserver.test.ts +68 -0
  41. package/src/components/Carousel/intersectionObserver.ts +58 -0
  42. package/src/components/Carousel/resizeObserver.test.ts +60 -0
  43. package/src/components/Carousel/resizeObserver.ts +35 -0
  44. package/src/components/Carousel/store.test.ts +25 -0
  45. package/src/components/Carousel/store.ts +27 -0
  46. package/src/components/Carousel/useCarouselScroller.ts +158 -0
  47. package/src/components/Icon/index.tsx +2 -1
  48. package/src/components/Modal/__snapshots__/index.css.snap +1 -1
  49. package/src/components/Modal/index.css +1 -1
  50. package/src/index.ts +12 -0
package/dist/layered.css CHANGED
@@ -421,6 +421,49 @@
421
421
  grid-template-columns: 1fr;
422
422
  grid-gap: 8px;
423
423
  }
424
+ .charcoal-icon {
425
+ display: inline-flex;
426
+ width: var(--charcoal-icon-size);
427
+ height: var(--charcoal-icon-size);
428
+ }
429
+
430
+ pixiv-icon:not(:defined) {
431
+ --pixiv-icon-base: 24px;
432
+ --pixiv-icon-scale: 1;
433
+ --pixiv-icon-size: calc(var(--pixiv-icon-base) * var(--pixiv-icon-scale));
434
+
435
+ display: inline-flex;
436
+ /* --charcoal-icon-size がセットされていればそれを優先、
437
+ なければ name / scale から導出した --pixiv-icon-size をフォールバック */
438
+ width: var(--charcoal-icon-size, var(--pixiv-icon-size));
439
+ height: var(--charcoal-icon-size, var(--pixiv-icon-size));
440
+ }
441
+
442
+ pixiv-icon:not(:defined)[name^='16/'] {
443
+ --pixiv-icon-base: 16px;
444
+ --pixiv-icon-size: 16px;
445
+ }
446
+
447
+ pixiv-icon:not(:defined)[name^='24/'][scale='2'] {
448
+ --pixiv-icon-scale: 2;
449
+ }
450
+
451
+ pixiv-icon:not(:defined)[name^='24/'][scale='3'] {
452
+ --pixiv-icon-scale: 3;
453
+ }
454
+
455
+ pixiv-icon:not(:defined)[name^='32/'] {
456
+ --pixiv-icon-base: 32px;
457
+ --pixiv-icon-size: 32px;
458
+ }
459
+
460
+ pixiv-icon:not(:defined)[name^='Inline/'] {
461
+ --pixiv-icon-base: 16px;
462
+ }
463
+
464
+ pixiv-icon:not(:defined)[name^='Inline/'][scale='2'] {
465
+ --pixiv-icon-scale: 2;
466
+ }
424
467
  .charcoal-multi-select {
425
468
  display: grid;
426
469
  grid-template-columns: auto 1fr;
@@ -956,7 +999,7 @@
956
999
  padding: 40px 0;
957
1000
  box-sizing: border-box;
958
1001
 
959
- background-color: var(--charcoal-color-container-neutral-default);
1002
+ background-color: var(--charcoal-color-background-overlay);
960
1003
  }
961
1004
 
962
1005
  @media (max-width: 743px) {
@@ -1781,6 +1824,281 @@
1781
1824
  .charcoal-pagination-spacer.charcoal-icon-button:disabled {
1782
1825
  opacity: 1;
1783
1826
  }
1827
+ .charcoal-carousel {
1828
+ position: relative;
1829
+ display: block;
1830
+ }
1831
+
1832
+ .charcoal-carousel[data-full-width='true'] {
1833
+ width: 100vw;
1834
+ margin-inline: calc(50% - 50vw);
1835
+ }
1836
+
1837
+ .charcoal-carousel__viewport {
1838
+ position: relative;
1839
+ }
1840
+
1841
+ .charcoal-carousel__scroller {
1842
+ position: relative;
1843
+ display: flex;
1844
+ gap: 24px;
1845
+ overflow-x: auto;
1846
+ overflow-y: hidden;
1847
+ overscroll-behavior-x: contain;
1848
+ scroll-behavior: smooth;
1849
+ scrollbar-width: none;
1850
+ outline: none;
1851
+ }
1852
+
1853
+ .charcoal-carousel__scroller::-webkit-scrollbar {
1854
+ display: none;
1855
+ }
1856
+
1857
+ .charcoal-carousel__scroller[data-focus-visible] {
1858
+ box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
1859
+ }
1860
+
1861
+ .charcoal-carousel[data-size='S'] .charcoal-carousel__scroller {
1862
+ gap: 0;
1863
+ }
1864
+
1865
+ /* スクロールスナップ type は prop(scrollSnap.type)で scroller に出し分ける。
1866
+ align は基底 .charcoal-carousel__item の後(後述)に置く(no-descending-specificity 回避)。
1867
+ 未指定時の既定(M=none / S=mandatory / align=center)は JS 側で data 属性に解決する。 */
1868
+ .charcoal-carousel[data-scroll-snap-type='none'] .charcoal-carousel__scroller {
1869
+ scroll-snap-type: none;
1870
+ }
1871
+
1872
+ .charcoal-carousel[data-scroll-snap-type='proximity']
1873
+ .charcoal-carousel__scroller {
1874
+ scroll-snap-type: x proximity;
1875
+ }
1876
+
1877
+ .charcoal-carousel[data-scroll-snap-type='mandatory']
1878
+ .charcoal-carousel__scroller {
1879
+ scroll-snap-type: x mandatory;
1880
+ }
1881
+
1882
+ /* グラデーション: はみ出してスクロール可能な側のみ、端のアイテムを背景色(白)へ
1883
+ フェードさせる。mask による透過ではなく、72px の「背景色→透明」オーバーレイを
1884
+ ビューポートに重ねて白で覆う。スクロール可能な側だけ data-can-prev/next で出し分ける。 */
1885
+ .charcoal-carousel[data-has-gradient='true']
1886
+ .charcoal-carousel__viewport::before,
1887
+ .charcoal-carousel[data-has-gradient='true']
1888
+ .charcoal-carousel__viewport::after {
1889
+ content: '';
1890
+ position: absolute;
1891
+ top: 0;
1892
+ bottom: 0;
1893
+ width: 72px;
1894
+ pointer-events: none;
1895
+ opacity: 0;
1896
+ transition: 0.2s opacity;
1897
+ z-index: 1;
1898
+ }
1899
+
1900
+ .charcoal-carousel[data-has-gradient='true']
1901
+ .charcoal-carousel__viewport::before {
1902
+ left: 0;
1903
+ background: linear-gradient(to right, #fff, transparent);
1904
+ }
1905
+
1906
+ .charcoal-carousel[data-has-gradient='true']
1907
+ .charcoal-carousel__viewport::after {
1908
+ right: 0;
1909
+ background: linear-gradient(to left, #fff, transparent);
1910
+ }
1911
+
1912
+ .charcoal-carousel[data-has-gradient='true'][data-can-prev='true']
1913
+ .charcoal-carousel__viewport::before {
1914
+ opacity: 1;
1915
+ }
1916
+
1917
+ .charcoal-carousel[data-has-gradient='true'][data-can-next='true']
1918
+ .charcoal-carousel__viewport::after {
1919
+ opacity: 1;
1920
+ }
1921
+
1922
+ .charcoal-carousel__item {
1923
+ flex: 0 0 auto;
1924
+ min-width: 0;
1925
+ }
1926
+
1927
+ .charcoal-carousel[data-size='S'] .charcoal-carousel__item {
1928
+ flex: 0 0 100%;
1929
+ }
1930
+
1931
+ /* scroll-snap-align は prop(scrollSnap.align)で出し分ける。基底 .charcoal-carousel__item
1932
+ より後に置くことで no-descending-specificity を回避する。 */
1933
+ .charcoal-carousel[data-scroll-snap-align='center'] .charcoal-carousel__item {
1934
+ scroll-snap-align: center;
1935
+ }
1936
+
1937
+ .charcoal-carousel[data-scroll-snap-align='start'] .charcoal-carousel__item {
1938
+ scroll-snap-align: start;
1939
+ }
1940
+
1941
+ /* ── Navigation Buttons (charcoal IconButton, variant=Overlay size=S) ── */
1942
+
1943
+ /* マスクと同じ 72px 1fr 72px グリッド。各ボタンは 72px ゾーンの中央に置く。 */
1944
+ .charcoal-carousel__navigation {
1945
+ position: absolute;
1946
+ inset: 0;
1947
+ pointer-events: none;
1948
+ display: grid;
1949
+ grid-template-columns: 72px 1fr 72px;
1950
+ align-items: center;
1951
+ /* 白フェード(z-index: 1)より上にボタンを表示する */
1952
+ z-index: 2;
1953
+ /* sandbox 同様、通常は隠してカルーセル hover 時にフェードイン表示する。 */
1954
+ opacity: 0;
1955
+ transition: 0.4s opacity;
1956
+ }
1957
+ .charcoal-carousel__navigation[data-visible='false'] {
1958
+ display: none;
1959
+ }
1960
+
1961
+ /* hover で表示。キーボード操作でも到達できるよう focus-within でも表示する。 */
1962
+ .charcoal-carousel:hover .charcoal-carousel__navigation,
1963
+ .charcoal-carousel:focus-within .charcoal-carousel__navigation {
1964
+ opacity: 1;
1965
+ }
1966
+
1967
+ .charcoal-carousel__navigation__item {
1968
+ pointer-events: auto;
1969
+ }
1970
+
1971
+ .charcoal-carousel__navigation__item[data-direction='prev'] {
1972
+ grid-column: 1;
1973
+ justify-self: center;
1974
+ }
1975
+
1976
+ .charcoal-carousel__navigation__item[data-direction='next'] {
1977
+ grid-column: 3;
1978
+ justify-self: center;
1979
+ }
1980
+
1981
+ /* スクロール端では非表示。IconButton の disabled スタイル(opacity:0.32)より
1982
+ 高い詳細度で打ち消すため、ルートを前置する。 */
1983
+ .charcoal-carousel .charcoal-carousel__navigation__item[data-hidden='true'] {
1984
+ opacity: 0;
1985
+ pointer-events: none;
1986
+ }
1987
+
1988
+ /* タッチデバイスではナビゲーションボタンを出さず、スワイプ操作に委ねる。 */
1989
+ @media (hover: none) and (pointer: coarse) {
1990
+ .charcoal-carousel__navigation {
1991
+ display: none;
1992
+ }
1993
+ }
1994
+
1995
+ /* ── Indicator: JS Fallback ── */
1996
+
1997
+ .charcoal-carousel__indicator {
1998
+ display: flex;
1999
+ justify-content: center;
2000
+ align-items: center;
2001
+ height: 40px;
2002
+ gap: 8px;
2003
+ }
2004
+
2005
+ .charcoal-carousel__indicator[data-visible='false'] {
2006
+ display: none;
2007
+ }
2008
+
2009
+ .charcoal-carousel__indicator__item {
2010
+ -webkit-appearance: none;
2011
+ -moz-appearance: none;
2012
+ appearance: none;
2013
+ box-sizing: border-box;
2014
+ width: 8px;
2015
+ height: 8px;
2016
+ padding: 0;
2017
+ border: 0;
2018
+ border-radius: 50%;
2019
+ background-color: var(--charcoal-color-text-tertiary-default);
2020
+ cursor: pointer;
2021
+ transition: 0.2s background-color;
2022
+ }
2023
+
2024
+ .charcoal-carousel__indicator__item:hover {
2025
+ background-color: var(--charcoal-color-text-secondary-default);
2026
+ }
2027
+
2028
+ .charcoal-carousel__indicator__item:focus-visible {
2029
+ outline: 2px solid rgba(0, 150, 250, 0.56);
2030
+ outline-offset: 2px;
2031
+ }
2032
+
2033
+ .charcoal-carousel__indicator__item[data-active='true'] {
2034
+ background-color: var(--charcoal-color-text-default);
2035
+ }
2036
+
2037
+ /* ── CSS Scroll Markers (progressive enhancement) ── */
2038
+
2039
+ /* CSS Scroll Markers / Anchor Positioning は新しい仕様で、stylelint がプロパティ・
2040
+ 擬似要素・擬似クラスを未知と判定するため、この @supports ブロックでは該当ルールを無効化する。 */
2041
+ /* stylelint-disable property-no-unknown, selector-pseudo-element-no-unknown, selector-pseudo-class-no-unknown */
2042
+ @supports (scroll-marker-group: after) {
2043
+ .charcoal-carousel[data-indicator='true'] {
2044
+ padding-bottom: 40px;
2045
+ }
2046
+
2047
+ .charcoal-carousel__scroller {
2048
+ anchor-name: --charcoal-carousel;
2049
+ scroll-marker-group: after;
2050
+ }
2051
+
2052
+ .charcoal-carousel__scroller::scroll-button(*) {
2053
+ content: none;
2054
+ }
2055
+
2056
+ .charcoal-carousel__scroller::scroll-marker-group {
2057
+ display: flex;
2058
+ justify-content: center;
2059
+ align-items: center;
2060
+ height: 40px;
2061
+ gap: 8px;
2062
+
2063
+ position: absolute;
2064
+ position-anchor: --charcoal-carousel;
2065
+ top: anchor(bottom);
2066
+ justify-self: anchor-center;
2067
+ }
2068
+
2069
+ .charcoal-carousel[data-indicator='false'] .charcoal-carousel__scroller {
2070
+ scroll-marker-group: none;
2071
+ }
2072
+
2073
+ .charcoal-carousel__item::scroll-marker {
2074
+ content: '';
2075
+ width: 8px;
2076
+ height: 8px;
2077
+ border: 0;
2078
+ border-radius: 50%;
2079
+ background-color: var(--charcoal-color-text-tertiary-default);
2080
+ cursor: pointer;
2081
+ transition: 0.2s background-color;
2082
+ }
2083
+
2084
+ .charcoal-carousel__item::scroll-marker:hover {
2085
+ background-color: var(--charcoal-color-text-secondary-default);
2086
+ }
2087
+
2088
+ .charcoal-carousel__item::scroll-marker:focus {
2089
+ outline: 2px solid rgba(0, 150, 250, 0.56);
2090
+ outline-offset: 2px;
2091
+ }
2092
+
2093
+ .charcoal-carousel__item::scroll-marker:target-current {
2094
+ background-color: var(--charcoal-color-text-default);
2095
+ }
2096
+
2097
+ .charcoal-carousel__indicator {
2098
+ display: none;
2099
+ }
2100
+ }
2101
+ /* stylelint-enable property-no-unknown, selector-pseudo-element-no-unknown, selector-pseudo-class-no-unknown */
1784
2102
  .charcoal-focus-ring:is(
1785
2103
  :not(:disabled):not([aria-disabled]),
1786
2104
  [aria-disabled='false']