@meduza/ui-kit-2 0.8.629 → 0.8.690

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 (36) hide show
  1. package/dist/ListViewSwitcher/ListViewSwitcher.types.d.ts +6 -0
  2. package/dist/ListViewSwitcher/index.d.ts +3 -0
  3. package/dist/SvgSymbol/SvgSymbol.types.d.ts +1 -1
  4. package/dist/Switcher/Switcher.types.d.ts +2 -3
  5. package/dist/ToolbarButton/ToolbarButton.types.d.ts +1 -1
  6. package/dist/index.d.ts +1 -0
  7. package/dist/types.d.ts +1 -1
  8. package/dist/ui-kit-2.cjs.development.js +254 -232
  9. package/dist/ui-kit-2.cjs.development.js.map +1 -1
  10. package/dist/ui-kit-2.cjs.production.min.js +1 -1
  11. package/dist/ui-kit-2.cjs.production.min.js.map +1 -1
  12. package/dist/ui-kit-2.esm.js +254 -233
  13. package/dist/ui-kit-2.esm.js.map +1 -1
  14. package/dist/ui-kit-game.css +138 -31
  15. package/dist/ui-kit.css +138 -31
  16. package/package.json +1 -1
  17. package/src/EmbedBlock/EmbedBlock.module.css +9 -0
  18. package/src/EmbedBlock/EmbedBlock.tsx +15 -4
  19. package/src/Image/index.tsx +1 -4
  20. package/src/ListViewSwitcher/ListViewSwitcher.module.css +109 -0
  21. package/src/ListViewSwitcher/ListViewSwitcher.stories.module.css +6 -0
  22. package/src/ListViewSwitcher/ListViewSwitcher.stories.tsx +38 -0
  23. package/src/ListViewSwitcher/ListViewSwitcher.test.tsx +35 -0
  24. package/src/ListViewSwitcher/ListViewSwitcher.types.ts +7 -0
  25. package/src/ListViewSwitcher/index.tsx +30 -0
  26. package/src/Spoiler/Spoiler.module.css +10 -9
  27. package/src/SvgSymbol/SvgSymbol.types.ts +0 -2
  28. package/src/Switcher/Switcher.module.css +4 -21
  29. package/src/Switcher/Switcher.stories.module.css +3 -21
  30. package/src/Switcher/Switcher.stories.tsx +13 -32
  31. package/src/Switcher/Switcher.types.ts +2 -4
  32. package/src/Switcher/index.tsx +7 -7
  33. package/src/ToolbarButton/ToolbarButton.types.ts +0 -2
  34. package/src/_storybook/PreviewWrapper/index.tsx +0 -1
  35. package/src/index.tsx +1 -0
  36. package/src/types.ts +0 -3
@@ -599,6 +599,8 @@
599
599
  -moz-user-select: none;
600
600
 
601
601
  user-select: none;
602
+
603
+ gap: 6px;
602
604
  }
603
605
 
604
606
  .Switcher-module_dark__1QQsH {
@@ -679,33 +681,14 @@
679
681
  left: 18px;
680
682
  }
681
683
 
682
- .Switcher-module_children__uLapU.Switcher-module_left__5-HNa {
683
- margin-right: 6px;
684
- }
685
-
686
- .Switcher-module_children__uLapU.Switcher-module_right__82Edk {
687
- margin-left: 6px;
688
- }
689
-
690
- /* panel */
691
-
692
- .Switcher-module_isInPanel__-nBSf .Switcher-module_children__uLapU {
693
-
694
- color: #999;
695
-
696
- font-size: 13px;
697
- letter-spacing: 0.5px;
698
- text-transform: uppercase;
699
- }
700
-
701
684
  /* menu */
702
685
 
703
686
  .Switcher-module_isInMenu__RQVhp {
704
687
  font-weight: normal;
705
688
  }
706
689
 
707
- .Switcher-module_isInMenu__RQVhp .Switcher-module_children__uLapU {
708
- margin-right: 8px;
690
+ .Switcher-module_isInMenu__RQVhp {
691
+ gap: 8px;
709
692
  }
710
693
 
711
694
  .Switcher-module_isInMenu__RQVhp .Switcher-module_control__60WMX {
@@ -733,7 +716,6 @@
733
716
  /* live */
734
717
 
735
718
  .Switcher-module_isInLive__ZyMCT .Switcher-module_children__uLapU {
736
-
737
719
  color: #7f7f7f;
738
720
 
739
721
  font-size: 13px;
@@ -2778,6 +2760,18 @@
2778
2760
  position: relative;
2779
2761
  }
2780
2762
 
2763
+ .EmbedBlock-module_wrapper__ynT7R.EmbedBlock-module_isProportional__x8-8g {
2764
+ width: 100%;
2765
+ max-height: 70vh;
2766
+ }
2767
+
2768
+ @media only screen and (min-width: 40.625em) {
2769
+
2770
+ .EmbedBlock-module_wrapper__ynT7R.EmbedBlock-module_isProportional__x8-8g {
2771
+ max-height: 90vh;
2772
+ }
2773
+ }
2774
+
2781
2775
  .EmbedBlock-module_wrapper__ynT7R .EmbedBlock-module_objectWrap__qpbni {
2782
2776
  position: static;
2783
2777
  }
@@ -5925,11 +5919,10 @@ a mark {
5925
5919
  margin-top: 0;
5926
5920
  margin-bottom: 18px;
5927
5921
 
5928
- font-weight: 700;
5929
- font-size: 21px;
5930
-
5931
5922
  font-family: 'Proxima Nova', 'Arial', 'Helvetica Neue', sans-serif;
5932
- line-height: 26px;
5923
+ font-size: calc(17rem / 16);
5924
+ font-weight: 700;
5925
+ line-height: calc(21rem / 16);
5933
5926
  }
5934
5927
 
5935
5928
  @media only screen and (min-width: 32em) {
@@ -5937,8 +5930,8 @@ a mark {
5937
5930
  .Spoiler-module_header__iEKsQ h3 {
5938
5931
  margin-bottom: 20px;
5939
5932
 
5940
- font-size: 28px;
5941
- line-height: 34px;
5933
+ font-size: 21px;
5934
+ line-height: 28px;
5942
5935
  }
5943
5936
  }
5944
5937
 
@@ -5993,9 +5986,11 @@ a mark {
5993
5986
  margin-left: -20px;
5994
5987
  padding: 12px 20px 20px;
5995
5988
 
5996
- background-image: linear-gradient(180deg,
5997
- rgba(255, 255, 255, 0) 0%,
5998
- #fff 64%);
5989
+ background-image: linear-gradient(
5990
+ 180deg,
5991
+ rgba(255, 255, 255, 0) 0%,
5992
+ #fff 64%
5993
+ );
5999
5994
 
6000
5995
  animation: Spoiler-module_spoilerSticky__YTiyF 500ms ease both;
6001
5996
  }
@@ -6904,6 +6899,118 @@ a mark {
6904
6899
  --metaFill: currentColor;
6905
6900
  }
6906
6901
 
6902
+ .ListViewSwitcher-module_root__pBsR5 {
6903
+ position: relative;
6904
+
6905
+ display: flex;
6906
+ align-items: center;
6907
+ flex-flow: row nowrap;
6908
+
6909
+ cursor: pointer;
6910
+ -webkit-user-select: none;
6911
+ -moz-user-select: none;
6912
+ user-select: none;
6913
+
6914
+ border-radius: 40px;
6915
+ background-color: #fff;
6916
+ }
6917
+
6918
+ .ListViewSwitcher-module_input__vtDVD {
6919
+ position: absolute;
6920
+ top: 0;
6921
+ left: 0;
6922
+
6923
+ visibility: hidden;
6924
+ }
6925
+
6926
+ .ListViewSwitcher-module_knob__g-OZ2 {
6927
+ position: relative;
6928
+ z-index: 200;
6929
+
6930
+ display: block;
6931
+
6932
+ transition: 0.25s ease-in-out;
6933
+
6934
+ border-radius: 15px;
6935
+ background: #000;
6936
+ }
6937
+
6938
+ .ListViewSwitcher-module_sm__y1teD {
6939
+ width: 35px;
6940
+ height: 18px;
6941
+ padding: 2px;
6942
+ }
6943
+
6944
+ .ListViewSwitcher-module_md__0M8KR {
6945
+ width: 52px;
6946
+ height: 26px;
6947
+ padding: 2px 3px;
6948
+ }
6949
+
6950
+ .ListViewSwitcher-module_md__0M8KR .ListViewSwitcher-module_knob__g-OZ2 {
6951
+ width: 22px;
6952
+ height: 22px;
6953
+ }
6954
+
6955
+ .ListViewSwitcher-module_grid__qBmnM,
6956
+ .ListViewSwitcher-module_list__NORMp {
6957
+ position: absolute;
6958
+
6959
+ background-size: contain;
6960
+ background-repeat: no-repeat;
6961
+ }
6962
+
6963
+ .ListViewSwitcher-module_grid__qBmnM {
6964
+ background-image: url("data:image/svg+xml,%3Csvg width='13' height='13' viewBox='0 0 13 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='.359' y='.5' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3Crect x='.359' y='7.078' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3Crect x='6.938' y='.5' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3Crect x='6.938' y='7.078' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3C/svg%3E");
6965
+ }
6966
+
6967
+ .ListViewSwitcher-module_list__NORMp {
6968
+ background-image: url("data:image/svg+xml,%3Csvg width='13' height='13' viewBox='0 0 13 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='.359' y='.5' width='12' height='3' rx='1.044' fill='%23000'/%3E%3Crect x='.359' y='5' width='12' height='3' rx='1.044' fill='%23000'/%3E%3Crect x='.359' y='9.5' width='12' height='3' rx='1.044' fill='%23000'/%3E%3C/svg%3E");
6969
+ }
6970
+
6971
+ .ListViewSwitcher-module_md__0M8KR .ListViewSwitcher-module_input__vtDVD:checked ~ .ListViewSwitcher-module_knob__g-OZ2 {
6972
+ transform: translateX(24px);
6973
+ }
6974
+
6975
+ .ListViewSwitcher-module_md__0M8KR .ListViewSwitcher-module_grid__qBmnM,
6976
+ .ListViewSwitcher-module_md__0M8KR .ListViewSwitcher-module_list__NORMp {
6977
+ width: 13px;
6978
+ height: 13px;
6979
+ top: 7px;
6980
+ }
6981
+
6982
+ .ListViewSwitcher-module_md__0M8KR .ListViewSwitcher-module_grid__qBmnM {
6983
+ left: 10px;
6984
+ }
6985
+
6986
+ .ListViewSwitcher-module_md__0M8KR .ListViewSwitcher-module_list__NORMp {
6987
+ right: 10px;
6988
+ }
6989
+
6990
+ .ListViewSwitcher-module_sm__y1teD .ListViewSwitcher-module_grid__qBmnM {
6991
+ left: 5px;
6992
+ }
6993
+
6994
+ .ListViewSwitcher-module_sm__y1teD .ListViewSwitcher-module_list__NORMp {
6995
+ right: 5px;
6996
+ }
6997
+
6998
+ .ListViewSwitcher-module_sm__y1teD .ListViewSwitcher-module_knob__g-OZ2 {
6999
+ width: 14px;
7000
+ height: 14px;
7001
+ }
7002
+
7003
+ .ListViewSwitcher-module_sm__y1teD .ListViewSwitcher-module_grid__qBmnM,
7004
+ .ListViewSwitcher-module_sm__y1teD .ListViewSwitcher-module_list__NORMp {
7005
+ width: 8px;
7006
+ height: 8px;
7007
+ top: 5px;
7008
+ }
7009
+
7010
+ .ListViewSwitcher-module_sm__y1teD .ListViewSwitcher-module_input__vtDVD:checked ~ .ListViewSwitcher-module_knob__g-OZ2 {
7011
+ transform: translateX(16px);
7012
+ }
7013
+
6907
7014
  .ToolbarButton-module_root__upsEH {
6908
7015
  display: block;
6909
7016
 
package/dist/ui-kit.css CHANGED
@@ -599,6 +599,8 @@
599
599
  -moz-user-select: none;
600
600
 
601
601
  user-select: none;
602
+
603
+ gap: 6px;
602
604
  }
603
605
 
604
606
  .Switcher-module_dark__1QQsH {
@@ -679,33 +681,14 @@
679
681
  left: 18px;
680
682
  }
681
683
 
682
- .Switcher-module_children__uLapU.Switcher-module_left__5-HNa {
683
- margin-right: 6px;
684
- }
685
-
686
- .Switcher-module_children__uLapU.Switcher-module_right__82Edk {
687
- margin-left: 6px;
688
- }
689
-
690
- /* panel */
691
-
692
- .Switcher-module_isInPanel__-nBSf .Switcher-module_children__uLapU {
693
-
694
- color: #999;
695
-
696
- font-size: 13px;
697
- letter-spacing: 0.5px;
698
- text-transform: uppercase;
699
- }
700
-
701
684
  /* menu */
702
685
 
703
686
  .Switcher-module_isInMenu__RQVhp {
704
687
  font-weight: normal;
705
688
  }
706
689
 
707
- .Switcher-module_isInMenu__RQVhp .Switcher-module_children__uLapU {
708
- margin-right: 8px;
690
+ .Switcher-module_isInMenu__RQVhp {
691
+ gap: 8px;
709
692
  }
710
693
 
711
694
  .Switcher-module_isInMenu__RQVhp .Switcher-module_control__60WMX {
@@ -733,7 +716,6 @@
733
716
  /* live */
734
717
 
735
718
  .Switcher-module_isInLive__ZyMCT .Switcher-module_children__uLapU {
736
-
737
719
  color: #7f7f7f;
738
720
 
739
721
  font-size: 13px;
@@ -2778,6 +2760,18 @@
2778
2760
  position: relative;
2779
2761
  }
2780
2762
 
2763
+ .EmbedBlock-module_wrapper__ynT7R.EmbedBlock-module_isProportional__x8-8g {
2764
+ width: 100%;
2765
+ max-height: 70vh;
2766
+ }
2767
+
2768
+ @media only screen and (min-width: 64em) {
2769
+
2770
+ .EmbedBlock-module_wrapper__ynT7R.EmbedBlock-module_isProportional__x8-8g {
2771
+ max-height: 90vh;
2772
+ }
2773
+ }
2774
+
2781
2775
  .EmbedBlock-module_wrapper__ynT7R .EmbedBlock-module_objectWrap__qpbni {
2782
2776
  position: static;
2783
2777
  }
@@ -5925,11 +5919,10 @@ a mark {
5925
5919
  margin-top: 0;
5926
5920
  margin-bottom: 18px;
5927
5921
 
5928
- font-weight: 700;
5929
- font-size: 21px;
5930
-
5931
5922
  font-family: 'Proxima Nova', 'Arial', 'Helvetica Neue', sans-serif;
5932
- line-height: 26px;
5923
+ font-size: calc(17rem / 16);
5924
+ font-weight: 700;
5925
+ line-height: calc(21rem / 16);
5933
5926
  }
5934
5927
 
5935
5928
  @media only screen and (min-width: 32em) {
@@ -5937,8 +5930,8 @@ a mark {
5937
5930
  .Spoiler-module_header__iEKsQ h3 {
5938
5931
  margin-bottom: 20px;
5939
5932
 
5940
- font-size: 28px;
5941
- line-height: 34px;
5933
+ font-size: 21px;
5934
+ line-height: 28px;
5942
5935
  }
5943
5936
  }
5944
5937
 
@@ -5993,9 +5986,11 @@ a mark {
5993
5986
  margin-left: -20px;
5994
5987
  padding: 12px 20px 20px;
5995
5988
 
5996
- background-image: linear-gradient(180deg,
5997
- rgba(255, 255, 255, 0) 0%,
5998
- #fff 64%);
5989
+ background-image: linear-gradient(
5990
+ 180deg,
5991
+ rgba(255, 255, 255, 0) 0%,
5992
+ #fff 64%
5993
+ );
5999
5994
 
6000
5995
  animation: Spoiler-module_spoilerSticky__YTiyF 500ms ease both;
6001
5996
  }
@@ -6904,6 +6899,118 @@ a mark {
6904
6899
  --metaFill: currentColor;
6905
6900
  }
6906
6901
 
6902
+ .ListViewSwitcher-module_root__pBsR5 {
6903
+ position: relative;
6904
+
6905
+ display: flex;
6906
+ align-items: center;
6907
+ flex-flow: row nowrap;
6908
+
6909
+ cursor: pointer;
6910
+ -webkit-user-select: none;
6911
+ -moz-user-select: none;
6912
+ user-select: none;
6913
+
6914
+ border-radius: 40px;
6915
+ background-color: #fff;
6916
+ }
6917
+
6918
+ .ListViewSwitcher-module_input__vtDVD {
6919
+ position: absolute;
6920
+ top: 0;
6921
+ left: 0;
6922
+
6923
+ visibility: hidden;
6924
+ }
6925
+
6926
+ .ListViewSwitcher-module_knob__g-OZ2 {
6927
+ position: relative;
6928
+ z-index: 200;
6929
+
6930
+ display: block;
6931
+
6932
+ transition: 0.25s ease-in-out;
6933
+
6934
+ border-radius: 15px;
6935
+ background: #000;
6936
+ }
6937
+
6938
+ .ListViewSwitcher-module_sm__y1teD {
6939
+ width: 35px;
6940
+ height: 18px;
6941
+ padding: 2px;
6942
+ }
6943
+
6944
+ .ListViewSwitcher-module_md__0M8KR {
6945
+ width: 52px;
6946
+ height: 26px;
6947
+ padding: 2px 3px;
6948
+ }
6949
+
6950
+ .ListViewSwitcher-module_md__0M8KR .ListViewSwitcher-module_knob__g-OZ2 {
6951
+ width: 22px;
6952
+ height: 22px;
6953
+ }
6954
+
6955
+ .ListViewSwitcher-module_grid__qBmnM,
6956
+ .ListViewSwitcher-module_list__NORMp {
6957
+ position: absolute;
6958
+
6959
+ background-size: contain;
6960
+ background-repeat: no-repeat;
6961
+ }
6962
+
6963
+ .ListViewSwitcher-module_grid__qBmnM {
6964
+ background-image: url("data:image/svg+xml,%3Csvg width='13' height='13' viewBox='0 0 13 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='.359' y='.5' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3Crect x='.359' y='7.078' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3Crect x='6.938' y='.5' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3Crect x='6.938' y='7.078' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3C/svg%3E");
6965
+ }
6966
+
6967
+ .ListViewSwitcher-module_list__NORMp {
6968
+ background-image: url("data:image/svg+xml,%3Csvg width='13' height='13' viewBox='0 0 13 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='.359' y='.5' width='12' height='3' rx='1.044' fill='%23000'/%3E%3Crect x='.359' y='5' width='12' height='3' rx='1.044' fill='%23000'/%3E%3Crect x='.359' y='9.5' width='12' height='3' rx='1.044' fill='%23000'/%3E%3C/svg%3E");
6969
+ }
6970
+
6971
+ .ListViewSwitcher-module_md__0M8KR .ListViewSwitcher-module_input__vtDVD:checked ~ .ListViewSwitcher-module_knob__g-OZ2 {
6972
+ transform: translateX(24px);
6973
+ }
6974
+
6975
+ .ListViewSwitcher-module_md__0M8KR .ListViewSwitcher-module_grid__qBmnM,
6976
+ .ListViewSwitcher-module_md__0M8KR .ListViewSwitcher-module_list__NORMp {
6977
+ width: 13px;
6978
+ height: 13px;
6979
+ top: 7px;
6980
+ }
6981
+
6982
+ .ListViewSwitcher-module_md__0M8KR .ListViewSwitcher-module_grid__qBmnM {
6983
+ left: 10px;
6984
+ }
6985
+
6986
+ .ListViewSwitcher-module_md__0M8KR .ListViewSwitcher-module_list__NORMp {
6987
+ right: 10px;
6988
+ }
6989
+
6990
+ .ListViewSwitcher-module_sm__y1teD .ListViewSwitcher-module_grid__qBmnM {
6991
+ left: 5px;
6992
+ }
6993
+
6994
+ .ListViewSwitcher-module_sm__y1teD .ListViewSwitcher-module_list__NORMp {
6995
+ right: 5px;
6996
+ }
6997
+
6998
+ .ListViewSwitcher-module_sm__y1teD .ListViewSwitcher-module_knob__g-OZ2 {
6999
+ width: 14px;
7000
+ height: 14px;
7001
+ }
7002
+
7003
+ .ListViewSwitcher-module_sm__y1teD .ListViewSwitcher-module_grid__qBmnM,
7004
+ .ListViewSwitcher-module_sm__y1teD .ListViewSwitcher-module_list__NORMp {
7005
+ width: 8px;
7006
+ height: 8px;
7007
+ top: 5px;
7008
+ }
7009
+
7010
+ .ListViewSwitcher-module_sm__y1teD .ListViewSwitcher-module_input__vtDVD:checked ~ .ListViewSwitcher-module_knob__g-OZ2 {
7011
+ transform: translateX(16px);
7012
+ }
7013
+
6907
7014
  .ToolbarButton-module_root__upsEH {
6908
7015
  display: block;
6909
7016
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.8.629",
2
+ "version": "0.8.690",
3
3
  "license": "MIT",
4
4
  "description": "UIKit for Meduza",
5
5
  "repository": "https://github.com/meduza-corp/ui-kit-2.git",
@@ -250,6 +250,15 @@
250
250
  position: relative;
251
251
  }
252
252
 
253
+ .wrapper.isProportional {
254
+ width: 100%;
255
+ max-height: 70vh;
256
+
257
+ @media $landscapeTablet {
258
+ max-height: 90vh;
259
+ }
260
+ }
261
+
253
262
  .wrapper .objectWrap {
254
263
  position: static;
255
264
  }
@@ -98,7 +98,13 @@ export const EmbedBlock: React.FC<EmbedBlockProps> = ({
98
98
  default: {
99
99
  return (
100
100
  <div className={styles.object}>
101
- <div className={styles.wrapper} style={style}>
101
+ <div
102
+ className={makeClassName([
103
+ [styles.wrapper, true],
104
+ [styles.isProportional, isProportional]
105
+ ])}
106
+ style={style}
107
+ >
102
108
  <DangerousHTML className={styles.objectWrap} html={html} />
103
109
  </div>
104
110
  </div>
@@ -108,8 +114,7 @@ export const EmbedBlock: React.FC<EmbedBlockProps> = ({
108
114
  }
109
115
 
110
116
  if (isProportional) {
111
- style.paddingBottom = `${(block.data.height / block.data.width) * 100}%`
112
- style.height = 0
117
+ style.aspectRatio = `${block.data.width} / ${block.data.height}`
113
118
  }
114
119
 
115
120
  let classNames: ClassNames = [
@@ -142,7 +147,13 @@ export const EmbedBlock: React.FC<EmbedBlockProps> = ({
142
147
  <figure className={makeClassName(classNames)}>
143
148
  {children && (
144
149
  <div className={styles.object}>
145
- <div className={styles.wrapper} style={style}>
150
+ <div
151
+ className={makeClassName([
152
+ [styles.wrapper, true],
153
+ [styles.isProportional, isProportional]
154
+ ])}
155
+ style={style}
156
+ >
146
157
  <div className={styles.objectWrap}>{children}</div>
147
158
  </div>
148
159
  </div>
@@ -38,10 +38,7 @@ export const Image: React.FC<ImageProps> = ({
38
38
  }
39
39
 
40
40
  const pictureStyles = {
41
- paddingBottom:
42
- styleContext === 'isInDynamicBlock'
43
- ? '100%'
44
- : `${100 / (ratio || width / height)}%`
41
+ paddingBottom: `${100 / (ratio || width / height)}%`
45
42
  }
46
43
 
47
44
  /* fallback w325 url until w6 was released */
@@ -0,0 +1,109 @@
1
+ .root {
2
+ position: relative;
3
+
4
+ display: flex;
5
+ align-items: center;
6
+ flex-flow: row nowrap;
7
+
8
+ cursor: pointer;
9
+ user-select: none;
10
+
11
+ border-radius: 40px;
12
+ background-color: #fff;
13
+ }
14
+
15
+ .input {
16
+ position: absolute;
17
+ top: 0;
18
+ left: 0;
19
+
20
+ visibility: hidden;
21
+ }
22
+
23
+ .knob {
24
+ position: relative;
25
+ z-index: $zIndex-2;
26
+
27
+ display: block;
28
+
29
+ transition: 0.25s ease-in-out;
30
+
31
+ border-radius: 15px;
32
+ background: #000;
33
+ }
34
+
35
+ .sm {
36
+ width: 35px;
37
+ height: 18px;
38
+ padding: 2px;
39
+ }
40
+
41
+ .md {
42
+ width: 52px;
43
+ height: 26px;
44
+ padding: 2px 3px;
45
+ }
46
+
47
+ .md .knob {
48
+ width: 22px;
49
+ height: 22px;
50
+ }
51
+
52
+ .grid,
53
+ .list {
54
+ position: absolute;
55
+
56
+ background-size: contain;
57
+ background-repeat: no-repeat;
58
+ }
59
+
60
+ .grid {
61
+ background-image: url("data:image/svg+xml,%3Csvg width='13' height='13' viewBox='0 0 13 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='.359' y='.5' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3Crect x='.359' y='7.078' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3Crect x='6.938' y='.5' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3Crect x='6.938' y='7.078' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3C/svg%3E");
62
+ }
63
+
64
+ .list {
65
+ background-image: url("data:image/svg+xml,%3Csvg width='13' height='13' viewBox='0 0 13 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='.359' y='.5' width='12' height='3' rx='1.044' fill='%23000'/%3E%3Crect x='.359' y='5' width='12' height='3' rx='1.044' fill='%23000'/%3E%3Crect x='.359' y='9.5' width='12' height='3' rx='1.044' fill='%23000'/%3E%3C/svg%3E");
66
+ }
67
+
68
+ .md .input:checked ~ .knob {
69
+ transform: translateX(24px);
70
+ }
71
+
72
+ .md .grid,
73
+ .md .list {
74
+ width: 13px;
75
+ height: 13px;
76
+ top: 7px;
77
+ }
78
+
79
+ .md .grid {
80
+ left: 10px;
81
+ }
82
+
83
+ .md .list {
84
+ right: 10px;
85
+ }
86
+
87
+ .sm .grid {
88
+ left: 5px;
89
+ }
90
+
91
+ .sm .list {
92
+ right: 5px;
93
+ }
94
+
95
+ .sm .knob {
96
+ width: 14px;
97
+ height: 14px;
98
+ }
99
+
100
+ .sm .grid,
101
+ .sm .list {
102
+ width: 8px;
103
+ height: 8px;
104
+ top: 5px;
105
+ }
106
+
107
+ .sm .input:checked ~ .knob {
108
+ transform: translateX(16px);
109
+ }
@@ -0,0 +1,6 @@
1
+ .root {
2
+ display: flex;
3
+ flex-flow: row wrap;
4
+
5
+ gap: 24px;
6
+ }
@@ -0,0 +1,38 @@
1
+ import React, { useState } from 'react'
2
+ import { ListViewSwitcher } from '.'
3
+ import { PreviewWrapper } from '../_storybook/PreviewWrapper'
4
+
5
+ import styles from './ListViewSwitcher.stories.module.css'
6
+
7
+ export default {
8
+ title: 'Main / ListViewSwitcher',
9
+ component: ListViewSwitcher,
10
+ parameters: {
11
+ themeWrapperSideBySide: true
12
+ }
13
+ }
14
+
15
+ const Example: React.FC = () => {
16
+ const [enabledOne, setEnabledOne] = useState(false)
17
+ const [enabledTwo, setEnabledTwo] = useState(false)
18
+ return (
19
+ <div className={styles.root}>
20
+ <ListViewSwitcher
21
+ enabled={enabledOne}
22
+ size="sm"
23
+ onChange={(e) => setEnabledOne(e.target.checked)}
24
+ />
25
+ <ListViewSwitcher
26
+ enabled={enabledTwo}
27
+ size="md"
28
+ onChange={(e) => setEnabledTwo(e.target.checked)}
29
+ />
30
+ </div>
31
+ )
32
+ }
33
+
34
+ export const Default: React.FC = () => (
35
+ <PreviewWrapper theme="dark">
36
+ <Example />
37
+ </PreviewWrapper>
38
+ )