This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @fileOverview | |
* localStorage, sessionStorage のごく薄いラッパー。 | |
* Cookie 無効環境でストレージにアクセスしたときに発生する例外を捕捉しスクリプトが止まらないようにする。 | |
*/ | |
type storageType = 'localStorage' | 'sessionStorage' | |
class WebStorage { | |
constructor(private storageType: storageType) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rollFocus(backFlag) { | |
let focusIndex | |
const currentIndex = this.tabbableElements.indexOf(document.activeElement) | |
if (currentIndex < 0) { | |
focusIndex = 0 | |
} else { | |
const tabbableLength = this.tabbableElements.length | |
const direction = backFlag ? -1 : 1 | |
focusIndex = (currentIndex + direction + tabbableLength) % tabbableLength | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 画像の回転を取得する | |
* @returns {number} 回転を表す数字。正しく表示するために数字に応じて以下の処理をする: | |
* 1: 何もしない | |
* 2: 左右反転 | |
* 3: 180度回転 | |
* 4: 180度回転し、左右反転 | |
* 5: 時計回りに90度回転し、左右反転 | |
* 6: 時計回りに90度回転 | |
* 7: 時計回りに270度回転し、左右反転 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 引数を起点に兄弟要素、親の兄弟要素、さらに親の兄弟要素、…を取得する | |
* @param {Element} baseElement | |
* @return {[Element]} 対象となるHTML要素 | |
*/ | |
export function collectAllSiblings(baseElement) { | |
const targets = [] | |
let current = baseElement | |
while (current && current !== document.body) { | |
const siblings = Array.from(current.parentNode.children) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@charset "UTF-8"; | |
.Textarea { | |
@at-root { | |
& { | |
position: relative; | |
color: inherit; | |
font-size: rem(16px); | |
line-height: 1.8; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@charset "UTF-8"; | |
.TextInput { | |
@at-root { | |
& { | |
width: 100%; | |
height: rem(40px); | |
padding: 0 rem(14px); | |
border: 0; | |
color: inherit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@charset "UTF-8"; | |
.Radio { | |
@at-root { | |
& { | |
position: relative; | |
z-index: 0; | |
display: inline-flex; | |
justify-content: flex-start; | |
align-items: baseline; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@charset "UTF-8"; | |
.Checkbox { | |
@at-root { | |
@function checked-icon($color: #fff) { | |
$color: '' + $color; | |
$color: '%23' + str-slice($color, 2); | |
@return 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M9%2016.17L4.83%2012l-1.42%201.41L9%2019%2021%207l-1.41-1.41z%22%20fill%3D%22#{$color}%22%2F%3E%3C%2Fsvg%3E'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let scrollbarWidth; | |
export default function measureScrollBarWidth(opts = {}) { | |
const { force = false } = opts; | |
if (force || typeof scrollbarWidth === "undefined") { | |
const div = document.createElement("div"); | |
div.style.position = "absolute"; | |
div.style.overflowY = "scroll"; | |
div.style.width = div.style.height = "100px"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.smooth-scroll { | |
transition: transform 0.5s ease-out !important; | |
} | |
.smooth-scroll-fixed { | |
display: none !important; | |
} |