@insession/design-system 1.3.1 → 1.4.1
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.
- package/CHANGELOG.md +35 -0
- package/LICENSE +21 -0
- package/README.md +150 -15
- package/base.css +75 -0
- package/components.css +306 -0
- package/dist/styles.css +2168 -0
- package/package.json +20 -8
- package/theme.css +17 -5
package/components.css
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/* @insession/design-system — Tailwind ユーティリティで表現していない部品 CSS。
|
|
2
|
+
*
|
|
3
|
+
* ── なぜこのファイルが必要か ───────────────────────────
|
|
4
|
+
* このパッケージの一部のコンポーネントは、**パッケージのどこにも定義が無いクラス名**と
|
|
5
|
+
* **@keyframes** を参照していた。定義は消費側 insession-app の巨大な legacy CSS
|
|
6
|
+
* (products/insession/apps/web/src/style.css)にしか存在せず、publish された中身だけでは
|
|
7
|
+
* 完成しない状態だった。結果として insession-app の外では以下が静かに崩れていた:
|
|
8
|
+
*
|
|
9
|
+
* .modal / .modal-backdrop / .modal-close → Modal の既定経路(title/footer を渡さない呼び方)
|
|
10
|
+
* と、それに載る ConfirmModal / ProfileModal
|
|
11
|
+
* .bottom-sheet* → BottomSheet 全体
|
|
12
|
+
* .google-icon → GoogleIcon
|
|
13
|
+
* @keyframes card-in / fade-in → Modal(既定経路・DS 構造の両方)・BottomSheet
|
|
14
|
+
* @keyframes pop-in → Badge
|
|
15
|
+
* @keyframes snackbar-in → Toast(variant="snackbar")
|
|
16
|
+
* @keyframes ring-timer-urgent-pulse → RingTimer(urgent 脈動)
|
|
17
|
+
*
|
|
18
|
+
* ここへ移植して、パッケージ単体で完成するようにした。値は insession-app の legacy CSS の
|
|
19
|
+
* 実値をそのまま持ってきており、短縮エイリアス変数(--surface / --text-dim 等)だけを
|
|
20
|
+
* theme.css の正式なトークン名(--color-surface / --color-text-dim 等)へ書き換えている。
|
|
21
|
+
*
|
|
22
|
+
* ── レイヤー ─────────────────────────────────────
|
|
23
|
+
* @layer components に置く。Tailwind の utilities レイヤーより先に来るので、消費側が
|
|
24
|
+
* `className` でユーティリティを足せば上書きできる(例 `<Modal className="w-[600px]">`)。
|
|
25
|
+
* また、レイヤーに属さない消費側の CSS はこれらより常に強い。
|
|
26
|
+
*
|
|
27
|
+
* ⚠ insession-app は自分の legacy CSS でこれらを定義済みなので、このファイルを読み込む必要は
|
|
28
|
+
* ない(読み込むと二重定義になる。insession-app の legacy は @layer legacy にあり、こちらの
|
|
29
|
+
* @layer components より弱いため、こちらが勝ってしまう点に注意)。
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
@layer components {
|
|
33
|
+
/* ---- Modal(既定経路: title/footer を渡さない呼び方) ---- */
|
|
34
|
+
|
|
35
|
+
.modal-backdrop {
|
|
36
|
+
position: fixed;
|
|
37
|
+
inset: 0;
|
|
38
|
+
z-index: var(--z-modal);
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
padding: 20px;
|
|
43
|
+
/* 透過した暗幕 + 軽いブラー(背景が少し透ける表現)。 */
|
|
44
|
+
background: color-mix(in srgb, #000 32%, transparent);
|
|
45
|
+
backdrop-filter: blur(6px);
|
|
46
|
+
-webkit-backdrop-filter: blur(6px);
|
|
47
|
+
animation: fade-in 0.2s ease both;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.modal {
|
|
51
|
+
position: relative;
|
|
52
|
+
background: var(--color-surface);
|
|
53
|
+
border: 1px solid var(--color-border-strong);
|
|
54
|
+
border-radius: var(--radius-card);
|
|
55
|
+
padding: 34px 34px 30px;
|
|
56
|
+
width: min(400px, 92vw);
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
gap: 14px;
|
|
60
|
+
box-shadow: var(--shadow-overlay);
|
|
61
|
+
animation: card-in 0.4s var(--ease-spring) both;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* 既定経路のモーダルは中央寄せの h2 と、装飾済みの submit ボタンを前提にしている
|
|
65
|
+
(ConfirmModal の <h2>、および消費側のフォーム型モーダル)。 */
|
|
66
|
+
.modal h2 {
|
|
67
|
+
font-size: 17px;
|
|
68
|
+
font-weight: 700;
|
|
69
|
+
text-align: center;
|
|
70
|
+
margin-bottom: 6px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* ⚠ この規則は「ホストアプリがグローバルな `button {}` で塗りを与えている」前提の互換規則で、
|
|
74
|
+
余白と字間だけを足す。単体では塗りが付かない(このパッケージは消費側の raw な HTML 要素に
|
|
75
|
+
グローバルスタイルを当てない方針なので、塗りは持ち込まない)。
|
|
76
|
+
新しい消費側は既定経路に raw な <button>/<input> を置かず、DS 構造(title/footer)+ <Button> /
|
|
77
|
+
<Input> を使うこと。 */
|
|
78
|
+
.modal button[type="submit"] {
|
|
79
|
+
margin-top: 6px;
|
|
80
|
+
padding: 14px;
|
|
81
|
+
font-size: 15px;
|
|
82
|
+
letter-spacing: 0.08em;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* モーダル右上のクローズアイコン。
|
|
86
|
+
移植元では グローバルな `button {}` ルールが背景・枠・カーソルを与えていたため、
|
|
87
|
+
単体で完成するよう明示的に書き下している。 */
|
|
88
|
+
.modal-close {
|
|
89
|
+
position: absolute;
|
|
90
|
+
top: 16px;
|
|
91
|
+
right: 16px;
|
|
92
|
+
width: 30px;
|
|
93
|
+
height: 30px;
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
justify-content: center;
|
|
97
|
+
padding: 0;
|
|
98
|
+
border: 1px solid transparent;
|
|
99
|
+
border-radius: 50%;
|
|
100
|
+
background: transparent;
|
|
101
|
+
color: var(--color-text-dim);
|
|
102
|
+
font-family: var(--font-display);
|
|
103
|
+
font-size: 21px;
|
|
104
|
+
font-weight: 700;
|
|
105
|
+
line-height: 1;
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
transition:
|
|
108
|
+
background 0.18s ease,
|
|
109
|
+
color 0.18s ease;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.modal-close:hover {
|
|
113
|
+
background: color-mix(in srgb, var(--color-text) 6%, transparent);
|
|
114
|
+
color: var(--color-text);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* ---- BottomSheet ---- */
|
|
118
|
+
|
|
119
|
+
/* ⚠ 移植元には `@media (min-width: 769px) { .bottom-sheet-backdrop { display: none } }` が
|
|
120
|
+
あるが、これは「デスクトップでは常設 sidebar を使う」という insession-app 固有の方針なので
|
|
121
|
+
持ち込まない。汎用の BottomSheet が自分でデスクトップ表示を封じるのは正しくない。
|
|
122
|
+
ブレークポイントで出し分けたい消費側は自分で制御する。 */
|
|
123
|
+
.bottom-sheet-backdrop {
|
|
124
|
+
position: fixed;
|
|
125
|
+
inset: 0;
|
|
126
|
+
z-index: var(--z-modal);
|
|
127
|
+
display: flex;
|
|
128
|
+
align-items: flex-end;
|
|
129
|
+
background: color-mix(in srgb, var(--color-bg) 55%, transparent);
|
|
130
|
+
backdrop-filter: blur(2px);
|
|
131
|
+
-webkit-backdrop-filter: blur(2px);
|
|
132
|
+
animation: card-in 0.2s var(--ease-spring) both;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.bottom-sheet {
|
|
136
|
+
position: relative;
|
|
137
|
+
width: 100%;
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-direction: column;
|
|
140
|
+
min-height: 0;
|
|
141
|
+
/* シートは --color-bg / 上端 22px 角丸 / 下辺なし / 強めの上向き影。 */
|
|
142
|
+
background: var(--color-bg);
|
|
143
|
+
border: 1px solid var(--color-border);
|
|
144
|
+
border-bottom: none;
|
|
145
|
+
border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
|
|
146
|
+
box-shadow: 0 -16px 34px -18px color-mix(in srgb, var(--color-shadow) 80%, transparent);
|
|
147
|
+
transition: height 0.28s var(--ease-spring);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.bottom-sheet--mid {
|
|
151
|
+
height: 68dvh;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.bottom-sheet--full {
|
|
155
|
+
height: 94dvh;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.bottom-sheet-handle-area {
|
|
159
|
+
display: flex;
|
|
160
|
+
justify-content: center;
|
|
161
|
+
flex-shrink: 0;
|
|
162
|
+
padding: 10px 0 6px;
|
|
163
|
+
cursor: grab;
|
|
164
|
+
touch-action: none;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.bottom-sheet-handle {
|
|
168
|
+
width: 38px;
|
|
169
|
+
height: 5px;
|
|
170
|
+
border-radius: var(--radius-pill);
|
|
171
|
+
background: var(--color-text-dim);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/* 移植元ではグローバルな `button {}` ルールに寄りかかっていた分を明示的に書き下している。
|
|
175
|
+
⚠ 1点だけ移植元と異なる: × グリフを中央に置くための flex 指定を足した。移植元は
|
|
176
|
+
padding: 0 の 36px 角丸ボックスに flex 指定が無く、グリフが左上に寄っていた(モバイル
|
|
177
|
+
専用の導線なので露見しにくい状態だった)。既存の消費側 insession-app は自分の legacy CSS で
|
|
178
|
+
描画を続けるため、この修正の影響を受けるのは新しい消費側だけ。 */
|
|
179
|
+
.bottom-sheet-close {
|
|
180
|
+
position: absolute;
|
|
181
|
+
top: 8px;
|
|
182
|
+
right: 8px;
|
|
183
|
+
width: 36px;
|
|
184
|
+
height: 36px;
|
|
185
|
+
display: flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
justify-content: center;
|
|
188
|
+
padding: 0;
|
|
189
|
+
border: 1px solid transparent;
|
|
190
|
+
border-radius: 50%;
|
|
191
|
+
background: var(--color-surface);
|
|
192
|
+
color: var(--color-text-dim);
|
|
193
|
+
font-family: var(--font-display);
|
|
194
|
+
font-size: 18px;
|
|
195
|
+
font-weight: 700;
|
|
196
|
+
line-height: 1;
|
|
197
|
+
cursor: pointer;
|
|
198
|
+
box-shadow: none;
|
|
199
|
+
transition:
|
|
200
|
+
background 0.18s ease,
|
|
201
|
+
color 0.18s ease;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.bottom-sheet-close:hover {
|
|
205
|
+
background: var(--color-surface-hover);
|
|
206
|
+
color: var(--color-text);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.bottom-sheet-body {
|
|
210
|
+
flex: 1;
|
|
211
|
+
min-height: 0;
|
|
212
|
+
display: flex;
|
|
213
|
+
flex-direction: column;
|
|
214
|
+
overflow: hidden;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* ---- GoogleIcon ---- */
|
|
218
|
+
|
|
219
|
+
.google-icon {
|
|
220
|
+
flex-shrink: 0;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* ---- @keyframes ----
|
|
224
|
+
* コンポーネントは `animate-[card-in_0.4s_var(--ease-spring)_both]` のような Tailwind の
|
|
225
|
+
* arbitrary animation ユーティリティでこれらを参照する。ユーティリティ側は名前を書くだけで
|
|
226
|
+
* @keyframes 本体は生成しないため、ここが定義の単一ソースになる。 */
|
|
227
|
+
|
|
228
|
+
/* Modal(既定経路・DS 構造)/ BottomSheet backdrop の入場。 */
|
|
229
|
+
@keyframes card-in {
|
|
230
|
+
from {
|
|
231
|
+
opacity: 0;
|
|
232
|
+
transform: translateY(18px) scale(0.97);
|
|
233
|
+
}
|
|
234
|
+
to {
|
|
235
|
+
opacity: 1;
|
|
236
|
+
transform: none;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* .modal-backdrop の暗幕フェード。 */
|
|
241
|
+
@keyframes fade-in {
|
|
242
|
+
from {
|
|
243
|
+
opacity: 0;
|
|
244
|
+
}
|
|
245
|
+
to {
|
|
246
|
+
opacity: 1;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/* Badge の出現。 */
|
|
251
|
+
@keyframes pop-in {
|
|
252
|
+
0% {
|
|
253
|
+
opacity: 0;
|
|
254
|
+
transform: scale(0.85);
|
|
255
|
+
}
|
|
256
|
+
60% {
|
|
257
|
+
transform: scale(1.04);
|
|
258
|
+
}
|
|
259
|
+
100% {
|
|
260
|
+
opacity: 1;
|
|
261
|
+
transform: scale(1);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/* Toast(variant="snackbar")の固定表示。translate(-50%, …) で終わるので、
|
|
266
|
+
中央寄せの transform はこのキーフレームが担う(ユーティリティ側では持たない)。 */
|
|
267
|
+
@keyframes snackbar-in {
|
|
268
|
+
from {
|
|
269
|
+
opacity: 0;
|
|
270
|
+
transform: translate(-50%, 14px);
|
|
271
|
+
}
|
|
272
|
+
to {
|
|
273
|
+
opacity: 1;
|
|
274
|
+
transform: translate(-50%, 0);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* RingTimer の urgent 脈動。 */
|
|
279
|
+
@keyframes ring-timer-urgent-pulse {
|
|
280
|
+
0%,
|
|
281
|
+
100% {
|
|
282
|
+
transform: scale(1);
|
|
283
|
+
}
|
|
284
|
+
50% {
|
|
285
|
+
transform: scale(1.07);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/* ---- モーションの抑制 ----
|
|
290
|
+
* 移植元は `*, *::before, *::after` にグローバルな抑制をかけているが、ライブラリが消費側の
|
|
291
|
+
* アニメーション全部を止めてよい理由は無いので、このパッケージが自分で動かすものだけを止める。
|
|
292
|
+
* ユーティリティで animate-* を当てている部品(Modal の DS 構造 / Badge / Toast / RingTimer)は
|
|
293
|
+
* クラス名が一意でないため、animation を持つ要素を横断で止める指定を @layer components 内に
|
|
294
|
+
* 置く(レイヤー外の消費側 CSS には勝てないので、消費側が上書きしたい場合はそれが通る)。 */
|
|
295
|
+
@media (prefers-reduced-motion: reduce) {
|
|
296
|
+
.modal-backdrop,
|
|
297
|
+
.modal,
|
|
298
|
+
.bottom-sheet-backdrop {
|
|
299
|
+
animation: none;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.bottom-sheet {
|
|
303
|
+
transition: none;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|