chore(ui): align frontend on shadcn kit

Design system:
- add semantic --success/--warning OKLCH tokens across themes; replace
  hardcoded green/amber feedback colors and their manual dark: overrides
- drop the unused @emotion dependency

Kit usage:
- migrate raw <button>/<input> to ui-kit components (actions) or
  <div>/<span> (non-action surfaces); keep genuinely custom looks as
  raw HTML with their own styles
- make kit usage prop-only (no className overrides): add Button
  size="icon-sm", Badge "warning" variant + "pill" shape
- extract a shared Tabs primitive (segmented/underline) and migrate
  Inboxes + UserProfile onto it
- tokenize z-index tiers as z-overlay/z-dropdown/z-tooltip
- export variant types (ButtonVariant/Size, BadgeVariant/Shape, TabsVariant)
- document the kit and its policy in components/ui/README.md
This commit is contained in:
johnnyjoygh 2026-06-21 09:17:04 +08:00
parent 3b07f78fd8
commit f5a60263b2
43 changed files with 343 additions and 533 deletions

View file

@ -19,8 +19,6 @@
"dependencies": {
"@connectrpc/connect": "^2.1.1",
"@connectrpc/connect-web": "^2.1.1",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@github/relative-time-element": "^5.0.0",
"@radix-ui/react-checkbox": "^1.3.3",
"@radix-ui/react-dialog": "^1.1.15",

View file

@ -14,12 +14,6 @@ importers:
'@connectrpc/connect-web':
specifier: ^2.1.1
version: 2.1.1(@bufbuild/protobuf@2.12.0)(@connectrpc/connect@2.1.1(@bufbuild/protobuf@2.12.0))
'@emotion/react':
specifier: ^11.14.0
version: 11.14.0(@types/react@19.2.14)(react@19.2.6)
'@emotion/styled':
specifier: ^11.14.1
version: 11.14.1(@emotion/react@11.14.0(@types/react@19.2.14)(react@19.2.6))(@types/react@19.2.14)(react@19.2.6)
'@github/relative-time-element':
specifier: ^5.0.0
version: 5.0.0
@ -548,60 +542,6 @@ packages:
'@emnapi/wasi-threads@1.2.1':
resolution: {integrity: sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==}
'@emotion/babel-plugin@11.13.5':
resolution: {integrity: sha512-pxHCpT2ex+0q+HH91/zsdHkw/lXd468DIN2zvfvLtPKLLMo6gQj7oLObq8PhkrxOZb/gGCq03S3Z7PDhS8pduQ==}
'@emotion/cache@11.14.0':
resolution: {integrity: sha512-L/B1lc/TViYk4DcpGxtAVbx0ZyiKM5ktoIyafGkH6zg/tj+mA+NE//aPYKG0k8kCHSHVJrpLpcAlOBEXQ3SavA==}
'@emotion/hash@0.9.2':
resolution: {integrity: sha512-MyqliTZGuOm3+5ZRSaaBGP3USLw6+EGykkwZns2EPC5g8jJ4z9OrdZY9apkl3+UP9+sdz76YYkwCKP5gh8iY3g==}
'@emotion/is-prop-valid@1.4.0':
resolution: {integrity: sha512-QgD4fyscGcbbKwJmqNvUMSE02OsHUa+lAWKdEUIJKgqe5IwRSKd7+KhibEWdaKwgjLj0DRSHA9biAIqGBk05lw==}
'@emotion/memoize@0.9.0':
resolution: {integrity: sha512-30FAj7/EoJ5mwVPOWhAyCX+FPfMDrVecJAM+Iw9NRoSl4BBAQeqj4cApHHUXOVvIPgLVDsCFoz/hGD+5QQD1GQ==}
'@emotion/react@11.14.0':
resolution: {integrity: sha512-O000MLDBDdk/EohJPFUqvnp4qnHeYkVP5B0xEG0D/L7cOKP9kefu2DXn8dj74cQfsEzUqh+sr1RzFqiL1o+PpA==}
peerDependencies:
'@types/react': '*'
react: '>=16.8.0'
peerDependenciesMeta:
'@types/react':
optional: true
'@emotion/serialize@1.3.3':
resolution: {integrity: sha512-EISGqt7sSNWHGI76hC7x1CksiXPahbxEOrC5RjmFRJTqLyEK9/9hZvBbiYn70dw4wuwMKiEMCUlR6ZXTSWQqxA==}
'@emotion/sheet@1.4.0':
resolution: {integrity: sha512-fTBW9/8r2w3dXWYM4HCB1Rdp8NLibOw2+XELH5m5+AkWiL/KqYX6dc0kKYlaYyKjrQ6ds33MCdMPEwgs2z1rqg==}
'@emotion/styled@11.14.1':
resolution: {integrity: sha512-qEEJt42DuToa3gurlH4Qqc1kVpNq8wO8cJtDzU46TjlzWjDlsVyevtYCRijVq3SrHsROS+gVQ8Fnea108GnKzw==}
peerDependencies:
'@emotion/react': ^11.0.0-rc.0
'@types/react': '*'
react: '>=16.8.0'
peerDependenciesMeta:
'@types/react':
optional: true
'@emotion/unitless@0.10.0':
resolution: {integrity: sha512-dFoMUuQA20zvtVTuxZww6OHoJYgrzfKM1t52mVySDJnMSEa08ruEvdYQbhvyu6soU+NeLVd3yKfTfT0NeV6qGg==}
'@emotion/use-insertion-effect-with-fallbacks@1.2.0':
resolution: {integrity: sha512-yJMtVdH59sxi/aVJBpk9FQq+OR8ll5GT8oWd57UpeaKEVGab41JWaCFA7FRLoMLloOZF/c/wsPoe+bfGmRKgDg==}
peerDependencies:
react: '>=16.8.0'
'@emotion/utils@1.4.2':
resolution: {integrity: sha512-3vLclRofFziIa3J2wDh9jjbkUz9qk5Vi3IZ/FSTKViB0k+ef0fPV7dYrUIugbgupYDx7v9ud/SjrtEP8Y4xLoA==}
'@emotion/weak-memoize@0.4.0':
resolution: {integrity: sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg==}
'@exodus/bytes@1.15.0':
resolution: {integrity: sha512-UY0nlA+feH81UGSHv92sLEPLCeZFjXOuHhrIo0HQydScuQc8s0A7kL/UdgwgDq8g8ilksmuoF35YVTNphV2aBQ==}
engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0}
@ -1672,9 +1612,6 @@ packages:
'@types/node@24.12.2':
resolution: {integrity: sha512-A1sre26ke7HDIuY/M23nd9gfB+nrmhtYyMINbjI1zHJxYteKR6qSMX56FsmjMcDb3SMcjJg5BiRRgOCC/yBD0g==}
'@types/parse-json@4.0.2':
resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==}
'@types/qs@6.15.1':
resolution: {integrity: sha512-GZHUBZR9hckSUhrxmp1nG6NwdpM9fCunJwyThLW1X3AyHgd9IlHb6VANpQQqDr2o/qQp6McZ3y/IA2rVzKzSbw==}
@ -1777,10 +1714,6 @@ packages:
resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==}
engines: {node: '>=12'}
babel-plugin-macros@3.1.0:
resolution: {integrity: sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==}
engines: {node: '>=10', npm: '>=6'}
babel-plugin-polyfill-corejs2@0.4.17:
resolution: {integrity: sha512-aTyf30K/rqAsNwN76zYrdtx8obu0E4KoUME29B1xj+B3WxgvWkp943vYQ+z8Mv3lw9xHXMHpvSPOBxzAkIa94w==}
peerDependencies:
@ -1823,10 +1756,6 @@ packages:
buffer-from@1.1.2:
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
callsites@3.1.0:
resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
engines: {node: '>=6'}
caniuse-lite@1.0.30001792:
resolution: {integrity: sha512-hVLMUZFgR4JJ6ACt1uEESvQN1/dBVqPAKY0hgrV70eN3391K6juAfTjKZLKvOMsx8PxA7gsY1/tLMMTcfFLLpw==}
@ -1882,9 +1811,6 @@ packages:
confbox@0.1.8:
resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==}
convert-source-map@1.9.0:
resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==}
convert-source-map@2.0.0:
resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}
@ -1904,10 +1830,6 @@ packages:
cose-base@2.2.0:
resolution: {integrity: sha512-AzlgcsCbUMymkADOJtQm3wO9S3ltPfYOFD5033keQn9NJzIbtnZj+UdBJe7DYml/8TdbtHJW3j58SOnKhWY/5g==}
cosmiconfig@7.1.0:
resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==}
engines: {node: '>=10'}
css-tree@3.2.1:
resolution: {integrity: sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==}
engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0}
@ -2137,9 +2059,6 @@ packages:
resolution: {integrity: sha512-zwfzJecQ/Uej6tusMqwAqU/6KL2XaB2VZ2Jg54Je6ahNBGNH6Ek6g3jjNCF0fG9EWQKGZNddNjU5F1ZQn/sBnA==}
engines: {node: '>=20.19.0'}
error-ex@1.3.4:
resolution: {integrity: sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==}
es-errors@1.3.0:
resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}
engines: {node: '>= 0.4'}
@ -2151,10 +2070,6 @@ packages:
resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}
engines: {node: '>=6'}
escape-string-regexp@4.0.0:
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
engines: {node: '>=10'}
escape-string-regexp@5.0.0:
resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==}
engines: {node: '>=12'}
@ -2185,9 +2100,6 @@ packages:
picomatch:
optional: true
find-root@1.1.0:
resolution: {integrity: sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==}
fsevents@2.3.3:
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
@ -2266,9 +2178,6 @@ packages:
resolution: {integrity: sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==}
engines: {node: '>=12.0.0'}
hoist-non-react-statics@3.3.2:
resolution: {integrity: sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==}
html-encoding-sniffer@6.0.0:
resolution: {integrity: sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==}
engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0}
@ -2297,10 +2206,6 @@ packages:
resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}
engines: {node: '>=0.10.0'}
import-fresh@3.3.1:
resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==}
engines: {node: '>=6'}
indent-string@4.0.0:
resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==}
engines: {node: '>=8'}
@ -2321,9 +2226,6 @@ packages:
is-alphanumerical@2.0.1:
resolution: {integrity: sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==}
is-arrayish@0.2.1:
resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==}
is-core-module@2.16.1:
resolution: {integrity: sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==}
engines: {node: '>= 0.4'}
@ -2362,9 +2264,6 @@ packages:
engines: {node: '>=6'}
hasBin: true
json-parse-even-better-errors@2.3.1:
resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==}
json5@2.2.3:
resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==}
engines: {node: '>=6'}
@ -2469,9 +2368,6 @@ packages:
resolution: {integrity: sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==}
engines: {node: '>= 12.0.0'}
lines-and-columns@1.2.4:
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
linkifyjs@4.3.3:
resolution: {integrity: sha512-P8aEP5U/D1/IlTY2OeYsErdwh9bGuLE30NcXtKEjgdHcahveQoQwM2yZNsioQHsWFz0P7KKudisbrzCgR0sDHg==}
@ -2695,17 +2591,9 @@ packages:
package-manager-detector@1.6.0:
resolution: {integrity: sha512-61A5ThoTiDG/C8s8UMZwSorAGwMJ0ERVGj2OjoW5pAalsNOg15+iQiPzrLJ4jhZ1HJzmC2PIHT2oEiH3R5fzNA==}
parent-module@1.0.1:
resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==}
engines: {node: '>=6'}
parse-entities@4.0.2:
resolution: {integrity: sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==}
parse-json@5.2.0:
resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==}
engines: {node: '>=8'}
parse5@7.3.0:
resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==}
@ -2718,10 +2606,6 @@ packages:
path-parse@1.0.7:
resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
path-type@4.0.0:
resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}
engines: {node: '>=8'}
pathe@2.0.3:
resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==}
@ -2823,9 +2707,6 @@ packages:
typescript:
optional: true
react-is@16.13.1:
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
react-is@17.0.2:
resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==}
@ -2937,10 +2818,6 @@ packages:
resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
engines: {node: '>=0.10.0'}
resolve-from@4.0.0:
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
engines: {node: '>=4'}
resolve@1.22.12:
resolution: {integrity: sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==}
engines: {node: '>= 0.4'}
@ -2990,10 +2867,6 @@ packages:
source-map-support@0.5.21:
resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==}
source-map@0.5.7:
resolution: {integrity: sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==}
engines: {node: '>=0.10.0'}
source-map@0.6.1:
resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}
engines: {node: '>=0.10.0'}
@ -3020,9 +2893,6 @@ packages:
style-to-object@1.0.14:
resolution: {integrity: sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw==}
stylis@4.2.0:
resolution: {integrity: sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw==}
stylis@4.4.0:
resolution: {integrity: sha512-5Z9ZpRzfuH6l/UAvCPAPUo3665Nk2wLaZU3x+TLHKVzIz33+sbJqbtrYoC3KD4/uVOr2Zp+L0LySezP9OHV9yA==}
@ -3329,10 +3199,6 @@ packages:
yallist@3.1.1:
resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}
yaml@1.10.3:
resolution: {integrity: sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA==}
engines: {node: '>= 6'}
zwitch@2.0.4:
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
@ -3599,89 +3465,6 @@ snapshots:
tslib: 2.8.1
optional: true
'@emotion/babel-plugin@11.13.5':
dependencies:
'@babel/helper-module-imports': 7.28.6
'@babel/runtime': 7.29.2
'@emotion/hash': 0.9.2
'@emotion/memoize': 0.9.0
'@emotion/serialize': 1.3.3
babel-plugin-macros: 3.1.0
convert-source-map: 1.9.0
escape-string-regexp: 4.0.0
find-root: 1.1.0
source-map: 0.5.7
stylis: 4.2.0
transitivePeerDependencies:
- supports-color
'@emotion/cache@11.14.0':
dependencies:
'@emotion/memoize': 0.9.0
'@emotion/sheet': 1.4.0
'@emotion/utils': 1.4.2
'@emotion/weak-memoize': 0.4.0
stylis: 4.2.0
'@emotion/hash@0.9.2': {}
'@emotion/is-prop-valid@1.4.0':
dependencies:
'@emotion/memoize': 0.9.0
'@emotion/memoize@0.9.0': {}
'@emotion/react@11.14.0(@types/react@19.2.14)(react@19.2.6)':
dependencies:
'@babel/runtime': 7.29.2
'@emotion/babel-plugin': 11.13.5
'@emotion/cache': 11.14.0
'@emotion/serialize': 1.3.3
'@emotion/use-insertion-effect-with-fallbacks': 1.2.0(react@19.2.6)
'@emotion/utils': 1.4.2
'@emotion/weak-memoize': 0.4.0
hoist-non-react-statics: 3.3.2
react: 19.2.6
optionalDependencies:
'@types/react': 19.2.14
transitivePeerDependencies:
- supports-color
'@emotion/serialize@1.3.3':
dependencies:
'@emotion/hash': 0.9.2
'@emotion/memoize': 0.9.0
'@emotion/unitless': 0.10.0
'@emotion/utils': 1.4.2
csstype: 3.2.3
'@emotion/sheet@1.4.0': {}
'@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.2.14)(react@19.2.6))(@types/react@19.2.14)(react@19.2.6)':
dependencies:
'@babel/runtime': 7.29.2
'@emotion/babel-plugin': 11.13.5
'@emotion/is-prop-valid': 1.4.0
'@emotion/react': 11.14.0(@types/react@19.2.14)(react@19.2.6)
'@emotion/serialize': 1.3.3
'@emotion/use-insertion-effect-with-fallbacks': 1.2.0(react@19.2.6)
'@emotion/utils': 1.4.2
react: 19.2.6
optionalDependencies:
'@types/react': 19.2.14
transitivePeerDependencies:
- supports-color
'@emotion/unitless@0.10.0': {}
'@emotion/use-insertion-effect-with-fallbacks@1.2.0(react@19.2.6)':
dependencies:
react: 19.2.6
'@emotion/utils@1.4.2': {}
'@emotion/weak-memoize@0.4.0': {}
'@exodus/bytes@1.15.0': {}
'@floating-ui/core@1.7.5':
@ -4739,8 +4522,6 @@ snapshots:
dependencies:
undici-types: 7.16.0
'@types/parse-json@4.0.2': {}
'@types/qs@6.15.1': {}
'@types/react-dom@19.2.3(@types/react@19.2.14)':
@ -4836,12 +4617,6 @@ snapshots:
assertion-error@2.0.1: {}
babel-plugin-macros@3.1.0:
dependencies:
'@babel/runtime': 7.29.2
cosmiconfig: 7.1.0
resolve: 1.22.12
babel-plugin-polyfill-corejs2@0.4.17(@babel/core@7.29.0):
dependencies:
'@babel/compat-data': 7.29.3
@ -4890,8 +4665,6 @@ snapshots:
buffer-from@1.1.2: {}
callsites@3.1.0: {}
caniuse-lite@1.0.30001792: {}
ccount@2.0.1: {}
@ -4935,8 +4708,6 @@ snapshots:
confbox@0.1.8: {}
convert-source-map@1.9.0: {}
convert-source-map@2.0.0: {}
cookie@1.1.1: {}
@ -4955,14 +4726,6 @@ snapshots:
dependencies:
layout-base: 2.0.1
cosmiconfig@7.1.0:
dependencies:
'@types/parse-json': 4.0.2
import-fresh: 3.3.1
parse-json: 5.2.0
path-type: 4.0.0
yaml: 1.10.3
css-tree@3.2.1:
dependencies:
mdn-data: 2.27.1
@ -5208,18 +4971,12 @@ snapshots:
entities@8.0.0: {}
error-ex@1.3.4:
dependencies:
is-arrayish: 0.2.1
es-errors@1.3.0: {}
es-module-lexer@2.1.0: {}
escalade@3.2.0: {}
escape-string-regexp@4.0.0: {}
escape-string-regexp@5.0.0: {}
estree-util-is-identifier-name@3.0.0: {}
@ -5238,8 +4995,6 @@ snapshots:
optionalDependencies:
picomatch: 4.0.4
find-root@1.1.0: {}
fsevents@2.3.3:
optional: true
@ -5377,10 +5132,6 @@ snapshots:
highlight.js@11.11.1: {}
hoist-non-react-statics@3.3.2:
dependencies:
react-is: 16.13.1
html-encoding-sniffer@6.0.0:
dependencies:
'@exodus/bytes': 1.15.0
@ -5405,11 +5156,6 @@ snapshots:
dependencies:
safer-buffer: 2.1.2
import-fresh@3.3.1:
dependencies:
parent-module: 1.0.1
resolve-from: 4.0.0
indent-string@4.0.0: {}
inline-style-parser@0.2.7: {}
@ -5425,8 +5171,6 @@ snapshots:
is-alphabetical: 2.0.1
is-decimal: 2.0.1
is-arrayish@0.2.1: {}
is-core-module@2.16.1:
dependencies:
hasown: 2.0.3
@ -5471,8 +5215,6 @@ snapshots:
jsesc@3.1.0: {}
json-parse-even-better-errors@2.3.1: {}
json5@2.2.3: {}
katex@0.16.45:
@ -5549,8 +5291,6 @@ snapshots:
lightningcss-win32-arm64-msvc: 1.32.0
lightningcss-win32-x64-msvc: 1.32.0
lines-and-columns@1.2.4: {}
linkifyjs@4.3.3: {}
lodash-es@4.18.1: {}
@ -6003,10 +5743,6 @@ snapshots:
package-manager-detector@1.6.0: {}
parent-module@1.0.1:
dependencies:
callsites: 3.1.0
parse-entities@4.0.2:
dependencies:
'@types/unist': 2.0.11
@ -6017,13 +5753,6 @@ snapshots:
is-decimal: 2.0.1
is-hexadecimal: 2.0.1
parse-json@5.2.0:
dependencies:
'@babel/code-frame': 7.29.0
error-ex: 1.3.4
json-parse-even-better-errors: 2.3.1
lines-and-columns: 1.2.4
parse5@7.3.0:
dependencies:
entities: 6.0.1
@ -6036,8 +5765,6 @@ snapshots:
path-parse@1.0.7: {}
path-type@4.0.0: {}
pathe@2.0.3: {}
picocolors@1.1.1: {}
@ -6170,8 +5897,6 @@ snapshots:
react-dom: 19.2.6(react@19.2.6)
typescript: 6.0.3
react-is@16.13.1: {}
react-is@17.0.2: {}
react-leaflet-cluster@4.1.3(@react-leaflet/core@3.0.0(leaflet@1.9.4)(react-dom@19.2.6(react@19.2.6))(react@19.2.6))(leaflet@1.9.4)(react-dom@19.2.6(react@19.2.6))(react-leaflet@5.0.0(leaflet@1.9.4)(react-dom@19.2.6(react@19.2.6))(react@19.2.6))(react@19.2.6):
@ -6328,8 +6053,6 @@ snapshots:
require-from-string@2.0.2: {}
resolve-from@4.0.0: {}
resolve@1.22.12:
dependencies:
es-errors: 1.3.0
@ -6392,8 +6115,6 @@ snapshots:
buffer-from: 1.1.2
source-map: 0.6.1
source-map@0.5.7: {}
source-map@0.6.1: {}
space-separated-tokens@2.0.2: {}
@ -6419,8 +6140,6 @@ snapshots:
dependencies:
inline-style-parser: 0.2.7
stylis@4.2.0: {}
stylis@4.4.0: {}
supports-preserve-symlinks-flag@1.0.0: {}
@ -6663,6 +6382,4 @@ snapshots:
yallist@3.1.1: {}
yaml@1.10.3: {}
zwitch@2.0.4: {}

View file

@ -27,7 +27,7 @@ export const CalendarCell = memo((props: CalendarCellProps) => {
const smallExtraClasses = size === "small" ? `${SMALL_CELL_SIZE.dimensions} min-h-0` : "";
const baseClasses = cn(
"aspect-square w-full flex items-center justify-center text-center transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-2 select-none border border-border/10 bg-muted/20",
"aspect-square w-full flex items-center justify-center text-center transition-all duration-150 select-none border border-border/10 bg-muted/20",
sizeConfig.font,
sizeConfig.borderRadius,
smallExtraClasses,
@ -42,6 +42,7 @@ export const CalendarCell = memo((props: CalendarCellProps) => {
const intensityClass = getCellIntensityClass(day, maxCount);
const buttonClasses = cn(
"h-auto p-0",
baseClasses,
intensityClass,
getCalendarCellStateClass(day),

View file

@ -104,7 +104,7 @@ export const AttachmentUnusedRows = ({ items }: { items: AttachmentLibraryListIt
{items.map((item) => (
<article
key={item.attachment.name}
className="flex items-center gap-2.5 rounded-[18px] border border-amber-200/70 bg-amber-50/50 p-3 shadow-sm shadow-black/[0.02] dark:border-amber-900/50 dark:bg-amber-950/10"
className="flex items-center gap-2.5 rounded-[18px] border border-warning/30 bg-warning/5 p-3 shadow-sm shadow-black/[0.02]"
>
<AttachmentThumb item={item} className="h-10 w-10 shrink-0" />
@ -118,10 +118,7 @@ export const AttachmentUnusedRows = ({ items }: { items: AttachmentLibraryListIt
</div>
</div>
<AttachmentOpenButton
className="text-amber-900/80 hover:text-amber-950 dark:text-amber-100/80 dark:hover:text-amber-50"
href={item.sourceUrl}
/>
<AttachmentOpenButton className="text-warning/90 hover:text-warning" href={item.sourceUrl} />
</article>
))}
</div>

View file

@ -52,10 +52,7 @@ export const AttachmentSourceChip = ({
if (!memoName) {
return (
<Badge
variant="outline"
className="rounded-full border-amber-300/70 bg-amber-50/70 px-1.5 py-0.5 text-[11px] text-amber-900 dark:border-amber-700/60 dark:bg-amber-950/20 dark:text-amber-100"
>
<Badge variant="warning" shape="pill" className="px-1.5 py-0.5 text-[11px]">
{t(unlinkedLabelKey)}
</Badge>
);

View file

@ -53,7 +53,7 @@ export const AttachmentLibraryUnusedPanel = ({ count, isDeleting, isExpanded, on
const t = useTranslate();
return (
<div className="rounded-2xl border border-amber-200/70 bg-amber-50/50 p-4 dark:border-amber-900/50 dark:bg-amber-950/10">
<div className="rounded-2xl border border-warning/30 bg-warning/5 p-4">
<div className="flex flex-col gap-3 md:flex-row md:items-center md:justify-between">
<div className="min-w-0">
<div className="text-sm font-medium text-foreground">
@ -63,7 +63,7 @@ export const AttachmentLibraryUnusedPanel = ({ count, isDeleting, isExpanded, on
</div>
<div className="flex flex-wrap items-center gap-2">
<Button type="button" variant="outline" className="rounded-full border-amber-300/70 bg-background/80 px-3" onClick={onToggle}>
<Button type="button" variant="outline" className="rounded-full border-warning/40 bg-background/80 px-3" onClick={onToggle}>
{isExpanded ? t("common.close") : t("attachment-library.labels.unused")}
</Button>
<Button variant="destructive" className="rounded-full" onClick={onDelete} disabled={isDeleting}>

View file

@ -16,7 +16,7 @@ const AttachmentMediaCard = ({ item, onPreview }: { item: AttachmentLibraryMedia
return (
<article className="overflow-hidden rounded-[20px] border border-border/60 bg-background/90 shadow-sm shadow-black/[0.03]">
<button type="button" className="relative block w-full cursor-pointer text-left" onClick={onPreview}>
<div className="relative block w-full cursor-pointer text-left" onClick={onPreview}>
<div className="relative aspect-[5/4] overflow-hidden bg-muted/40">
{item.kind === "video" ? (
<>
@ -45,7 +45,7 @@ const AttachmentMediaCard = ({ item, onPreview }: { item: AttachmentLibraryMedia
<img src={item.posterUrl} alt={item.filename} className="h-full w-full object-cover" loading="lazy" decoding="async" />
)}
</div>
</button>
</div>
<div className="flex flex-col gap-2 p-3">
<div className="flex items-start justify-between gap-2">

View file

@ -211,7 +211,7 @@ function CreateWebhookDialog({ open, onOpenChange, webhookName, onSuccess }: Pro
disabled={!state.signingSecret}
aria-label={t("setting.webhook.create-dialog.copy-secret")}
>
{secretCopied ? <CheckIcon className="h-4 w-4 text-green-500" /> : <CopyIcon className="h-4 w-4" />}
{secretCopied ? <CheckIcon className="h-4 w-4 text-success" /> : <CopyIcon className="h-4 w-4" />}
</Button>
<Button type="button" variant="outline" onClick={handleGenerateSecret}>
{t("setting.webhook.create-dialog.generate-secret")}

View file

@ -47,13 +47,12 @@ export const LocaleSearchList = (props: LocaleSearchListProps) => {
</div>
<div className="mt-1 min-h-0 flex-1 touch-pan-y overflow-y-auto p-1" role="listbox" aria-label={t("common.language")}>
{filteredLocales.map((locale) => (
<button
type="button"
<div
key={locale}
role="option"
aria-selected={value === locale}
className={cn(
"flex h-8 w-full items-center gap-2 rounded-sm px-2 text-left text-sm outline-hidden transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground",
"flex h-8 w-full cursor-pointer items-center gap-2 rounded-sm px-2 text-left text-sm outline-hidden transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground",
value === locale && "bg-accent/60",
)}
onClick={() => onChange(locale)}
@ -63,7 +62,7 @@ export const LocaleSearchList = (props: LocaleSearchListProps) => {
<span className="shrink-0 text-xs text-muted-foreground">{locale}</span>
</span>
{value === locale ? <CheckIcon className="size-4 shrink-0 text-primary" /> : <span className="size-4 shrink-0" />}
</button>
</div>
))}
{filteredLocales.length === 0 && (
<div className="px-2 py-6 text-center text-sm">

View file

@ -29,7 +29,7 @@ export const Mention: React.FC<MentionProps> = ({
return (
<a
href={`/u/${username}`}
className={cn("text-blue-600 underline-offset-2 hover:underline dark:text-blue-400", className)}
className={cn("text-primary underline-offset-2 hover:underline", className)}
data-mention={username}
title={`@${username}`}
{...props}

View file

@ -59,7 +59,7 @@ function ShareLinkRow({ share, memoName }: ShareLinkRowProps) {
<span className="truncate font-mono text-xs text-muted-foreground">{url}</span>
<div className="flex shrink-0 items-center gap-1">
<Button variant="ghost" size="icon" className="h-7 w-7" onClick={handleCopy} title={t("memo.share.copy")}>
{copied ? <CheckIcon className="h-3.5 w-3.5 text-green-500" /> : <CopyIcon className="h-3.5 w-3.5" />}
{copied ? <CheckIcon className="h-3.5 w-3.5 text-success" /> : <CopyIcon className="h-3.5 w-3.5" />}
</Button>
<Button
variant="ghost"

View file

@ -6,7 +6,7 @@ import type { FocusModeExitButtonProps, FocusModeOverlayProps } from "../types";
export function FocusModeOverlay({ isActive, onToggle }: FocusModeOverlayProps) {
if (!isActive) return null;
return <button type="button" className={FOCUS_MODE_STYLES.backdrop} onClick={onToggle} aria-label="Exit focus mode" />;
return <div className={FOCUS_MODE_STYLES.backdrop} onClick={onToggle} aria-label="Exit focus mode" />;
}
export function FocusModeExitButton({ isActive, onToggle, title }: FocusModeExitButtonProps) {

View file

@ -11,6 +11,7 @@ import {
SearchIcon,
XIcon,
} from "lucide-react";
import { Button } from "@/components/ui/button";
import { FilterFactor, getMemoFilterKey, MemoFilter, useMemoFilterContext } from "@/contexts/MemoFilterContext";
import { useTranslate } from "@/utils/i18n";
@ -87,13 +88,11 @@ const MemoFilters = () => {
>
{Icon && <Icon className="w-3.5 h-3.5 text-muted-foreground shrink-0" />}
<span className="text-foreground/80 font-medium max-w-32 truncate">{getFilterDisplayText(filter)}</span>
<button
onClick={() => handleRemoveFilter(filter)}
className="ml-0.5 -mr-1 p-0.5 text-muted-foreground/60 hover:text-destructive hover:bg-destructive/10 rounded-full transition-colors"
aria-label="Remove filter"
>
<XIcon className="w-3 h-3" />
</button>
<span className="ml-0.5 -mr-1">
<Button variant="ghost" size="icon-sm" onClick={() => handleRemoveFilter(filter)} aria-label="Remove filter">
<XIcon className="w-3 h-3" />
</Button>
</span>
</div>
);
})}

View file

@ -4,6 +4,7 @@ import type { AttachmentItem, LocalFile } from "@/components/MemoEditor/types/at
import { getAudioRecordingTimeLabel, toAttachmentItems } from "@/components/MemoEditor/types/attachment";
import MetadataSection from "@/components/MemoMetadata/MetadataSection";
import PreviewImageDialog from "@/components/PreviewImageDialog";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb";
import { formatFileSize, getFileTypeLabel } from "@/utils/format";
@ -33,56 +34,50 @@ const AttachmentItemActions: FC<{
return (
<div className="shrink-0 flex items-center gap-0.5">
{onMoveUp && (
<button
type="button"
<Button
variant="ghost"
size="icon-sm"
onClick={(event) => {
stopPropagation(event);
onMoveUp();
}}
disabled={!canMoveUp}
className={cn(
"touch-manipulation rounded p-0.5 transition-colors hover:bg-accent active:bg-accent",
!canMoveUp && "cursor-not-allowed opacity-20 hover:bg-transparent",
)}
title="Move up"
aria-label="Move attachment up"
>
<ChevronUpIcon className="h-3 w-3 text-muted-foreground" />
</button>
</Button>
)}
{onMoveDown && (
<button
type="button"
<Button
variant="ghost"
size="icon-sm"
onClick={(event) => {
stopPropagation(event);
onMoveDown();
}}
disabled={!canMoveDown}
className={cn(
"touch-manipulation rounded p-0.5 transition-colors hover:bg-accent active:bg-accent",
!canMoveDown && "cursor-not-allowed opacity-20 hover:bg-transparent",
)}
title="Move down"
aria-label="Move attachment down"
>
<ChevronDownIcon className="h-3 w-3 text-muted-foreground" />
</button>
</Button>
)}
{onRemove && (
<button
type="button"
<Button
variant="ghost"
size="icon-sm"
onClick={(event) => {
stopPropagation(event);
onRemove();
}}
className="ml-0.5 touch-manipulation rounded p-0.5 transition-colors hover:bg-destructive/10 active:bg-destructive/10"
title="Remove"
aria-label="Remove attachment"
>
<XIcon className="h-3 w-3 text-muted-foreground hover:text-destructive" />
</button>
</Button>
)}
</div>
);
@ -141,8 +136,7 @@ const AttachmentItemCard: FC<{
<div className="flex items-center gap-1.5">
<div className="relative flex h-6 w-6 shrink-0 items-center justify-center overflow-hidden rounded bg-muted/40">
{(category === "image" || category === "motion") && thumbnailUrl ? (
<button
type="button"
<div
onClick={(event) => {
event.stopPropagation();
onPreview?.();
@ -151,13 +145,13 @@ const AttachmentItemCard: FC<{
aria-label={`Preview ${filename}`}
>
<img src={thumbnailUrl} alt="" className="h-full w-full object-cover" />
</button>
</div>
) : isVoiceNote ? (
<>
<button
type="button"
onClick={handleAudioToggle}
className="flex size-full items-center justify-center rounded bg-muted/40 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
className="flex size-full items-center justify-center rounded bg-muted/40 text-muted-foreground hover:bg-accent hover:text-foreground"
aria-label={isPlaying ? t("editor.audio-recorder.pause-recording") : t("editor.audio-recorder.play-recording")}
>
{isPlaying ? <PauseIcon className="h-3.5 w-3.5" /> : <PlayIcon className="h-3.5 w-3.5 translate-x-[0.5px]" />}
@ -179,7 +173,7 @@ const AttachmentItemCard: FC<{
event.stopPropagation();
onPreview?.();
}}
className="flex size-full items-center justify-center rounded bg-muted/40 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
className="flex size-full items-center justify-center rounded bg-muted/40 text-muted-foreground hover:bg-accent hover:text-foreground"
aria-label={`Preview ${filename}`}
>
<PlayIcon className="h-3.5 w-3.5 translate-x-[0.5px]" />

View file

@ -78,13 +78,13 @@ const VisualTile = ({
children,
}: PropsWithChildren<{ className?: string; onPreview?: () => void; overlayLabel?: string }>) => {
return (
<button type="button" className={cn(VISUAL_TILE_BUTTON_CLASS, className)} onClick={onPreview}>
<div className={cn(VISUAL_TILE_BUTTON_CLASS, className)} onClick={onPreview}>
<div className={MEDIA_HOVER_SURFACE_CLASS}>
{children}
<div className={MEDIA_HOVER_GRADIENT_CLASS} aria-hidden />
</div>
{overlayLabel && <div className={OVERFLOW_TILE_OVERLAY_CLASS}>{overlayLabel}</div>}
</button>
</div>
);
};

View file

@ -1,5 +1,6 @@
import { PauseIcon, PlayIcon } from "lucide-react";
import { useEffect, useRef, useState } from "react";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import { formatFileSize, getFileTypeLabel } from "@/utils/format";
import { formatAudioTime } from "./attachmentHelpers";
@ -134,14 +135,14 @@ const AudioAttachmentItem = ({ filename, sourceUrl, mimeType, size, title, compa
</div>
</div>
<button
type="button"
<Button
variant="outline"
size="icon-sm"
onClick={togglePlayback}
className="inline-flex size-5.5 shrink-0 items-center justify-center rounded-md border border-border/45 bg-background/90 text-foreground transition-colors hover:bg-muted/45"
aria-label={isPlaying ? `Pause ${displayTitle}` : `Play ${displayTitle}`}
>
{isPlaying ? <PauseIcon className="size-2.5" /> : <PlayIcon className="size-2.5 translate-x-[0.5px]" />}
</button>
</Button>
</div>
<div className={cn("mt-1", compact ? "space-y-1.5" : "flex items-center gap-1")}>
@ -157,14 +158,14 @@ const AudioAttachmentItem = ({ filename, sourceUrl, mimeType, size, title, compa
<div className={cn("flex items-center", compact ? "justify-between gap-2" : "shrink-0 gap-1")}>
<div className="shrink-0 text-[10px] tabular-nums text-muted-foreground">{timeLabel}</div>
<button
type="button"
<Button
variant="ghost"
size="sm"
onClick={handlePlaybackRateChange}
className="inline-flex h-5 shrink-0 items-center justify-center rounded-md border border-transparent px-1 text-[10px] font-medium text-muted-foreground transition-colors hover:border-border/40 hover:text-foreground"
aria-label={`Playback speed ${playbackRate}x for ${displayTitle}`}
>
{playbackRate}x
</button>
</Button>
</div>
</div>

View file

@ -1,5 +1,6 @@
import { MapPinIcon, XIcon } from "lucide-react";
import type { FC } from "react";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import type { Location } from "@/types/proto/api/v1/memo_service_pb";
import { getLocationCoordinatesText, getLocationDisplayText } from "./locationHelpers";
@ -30,15 +31,9 @@ const LocationDisplayEditor: FC<LocationDisplayEditorProps> = ({ location, onRem
</div>
{onRemove && (
<button
type="button"
onClick={onRemove}
className="p-0.5 rounded hover:bg-destructive/10 active:bg-destructive/10 transition-colors touch-manipulation shrink-0 ml-auto"
title="Remove"
aria-label="Remove location"
>
<Button variant="ghost" size="icon-sm" onClick={onRemove} title="Remove" aria-label="Remove location">
<XIcon className="w-3 h-3 text-muted-foreground hover:text-destructive" />
</button>
</Button>
)}
</div>
);

View file

@ -1,17 +1,16 @@
import { MapPinIcon } from "lucide-react";
import { useState } from "react";
import { LazyLocationPicker } from "@/components/map/LazyLocationPicker";
import { Button } from "@/components/ui/button";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
import { cn } from "@/lib/utils";
import type { Location } from "@/types/proto/api/v1/memo_service_pb";
import { getLocationCoordinatesText, getLocationDisplayText } from "./locationHelpers";
interface LocationDisplayViewProps {
location?: Location;
className?: string;
}
const LocationDisplayView = ({ location, className }: LocationDisplayViewProps) => {
const LocationDisplayView = ({ location }: LocationDisplayViewProps) => {
const [popoverOpen, setPopoverOpen] = useState<boolean>(false);
if (!location) {
@ -23,20 +22,13 @@ const LocationDisplayView = ({ location, className }: LocationDisplayViewProps)
return (
<Popover open={popoverOpen} onOpenChange={setPopoverOpen}>
<PopoverTrigger asChild>
<button
type="button"
className={cn(
"w-full flex flex-row gap-2 cursor-pointer",
"relative inline-flex items-center gap-1.5 px-2 h-7 rounded-md border border-border bg-muted/20 hover:bg-accent/20 text-muted-foreground hover:text-foreground text-xs transition-colors",
className,
)}
>
<Button variant="outline" size="sm">
<span className="shrink-0 text-muted-foreground">
<MapPinIcon className="w-3.5 h-3.5" />
</span>
<span className="text-nowrap opacity-80">[{getLocationCoordinatesText(location, 2)}]</span>
<span className="text-nowrap truncate">{displayText}</span>
</button>
</Button>
</PopoverTrigger>
<PopoverContent align="start">
<div className="min-w-80 sm:w-lg flex flex-col justify-start items-start">

View file

@ -1,4 +1,5 @@
import type { LucideIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
export interface SectionHeaderTab {
@ -25,16 +26,17 @@ const SectionHeader = ({ icon: Icon, title, count, tabs }: SectionHeaderProps) =
<div className="flex items-center gap-0.5">
{tabs.map((tab, idx) => (
<div key={tab.id} className="flex items-center gap-0.5">
<button
type="button"
<Button
variant="ghost"
size="sm"
onClick={tab.onClick}
className={cn(
"text-xs px-0 py-0 transition-colors",
"h-auto text-xs px-0 py-0 hover:bg-transparent",
tab.active ? "text-muted-foreground" : "text-muted-foreground/60 hover:text-muted-foreground",
)}
>
{tab.label} ({tab.count})
</button>
</Button>
{idx < tabs.length - 1 && <span className="text-muted-foreground/40 font-mono text-xs">/</span>}
</div>
))}

View file

@ -12,12 +12,9 @@ const BlurOverlay: React.FC<{ onClick?: () => void }> = ({ onClick }) => {
const t = useTranslate();
return (
<div className="absolute inset-0 z-10 pt-4 flex items-center justify-center" onClick={onClick}>
<button
type="button"
className="rounded-lg border border-border bg-card px-2 py-1 text-xs text-muted-foreground transition-colors hover:border-accent hover:bg-accent hover:text-foreground"
>
<div className="rounded-lg border border-border bg-card px-2 py-1 text-xs text-muted-foreground transition-colors hover:border-accent hover:bg-accent hover:text-foreground">
{t("memo.click-to-show-sensitive-content")}
</button>
</div>
</div>
);
};

View file

@ -45,7 +45,10 @@ const MemoHeader: React.FC<MemoHeaderProps> = ({ showCreator, showVisibility, sh
);
const timeTooltip = {
createdAt: createTime ? `${t("common.created-at")}: ${createTime.toLocaleString(i18n.language)}` : undefined,
updatedAt: updateTime ? `${t("common.last-updated-at")}: ${updateTime.toLocaleString(i18n.language)}` : undefined,
updatedAt:
updateTime && (!createTime || updateTime.getTime() !== createTime.getTime())
? `${t("common.last-updated-at")}: ${updateTime.toLocaleString(i18n.language)}`
: undefined,
};
return (
@ -122,13 +125,12 @@ const CreatorDisplay: React.FC<CreatorDisplayProps> = ({ creator, displayTime, t
{creator.displayName || creator.username}
</Link>
<TimeTooltip content={timeTooltip}>
<button
type="button"
<span
className="w-auto -mt-0.5 text-xs leading-tight text-muted-foreground select-none cursor-pointer hover:opacity-80 transition-colors text-left"
onClick={onGotoDetail}
>
{displayTime}
</button>
</span>
</TimeTooltip>
</div>
</div>
@ -157,13 +159,12 @@ interface TimeDisplayProps {
const TimeDisplay: React.FC<TimeDisplayProps> = ({ displayTime, timeTooltip, onGotoDetail }) => (
<TimeTooltip content={timeTooltip}>
<button
type="button"
<span
className="w-auto text-sm leading-tight text-muted-foreground select-none cursor-pointer hover:text-foreground transition-colors text-left"
onClick={onGotoDetail}
>
{displayTime}
</button>
</span>
</TimeTooltip>
);

View file

@ -1,7 +1,6 @@
import { SearchIcon } from "lucide-react";
import { useRef, useState } from "react";
import { useMemoFilterContext } from "@/contexts/MemoFilterContext";
import { cn } from "@/lib/utils";
import { useTranslate } from "@/utils/i18n";
import MemoDisplaySettingMenu from "./MemoDisplaySettingMenu";
@ -36,7 +35,7 @@ const SearchBar = () => {
<div className="relative w-full h-auto flex flex-row justify-start items-center">
<SearchIcon className="absolute left-2 w-4 h-auto opacity-40 text-sidebar-foreground" />
<input
className={cn("w-full text-sidebar-foreground leading-6 bg-sidebar border border-border text-sm rounded-lg p-1 pl-8 outline-0")}
className="w-full text-sidebar-foreground leading-6 bg-sidebar border border-border text-sm rounded-lg p-1 pl-8 outline-0"
placeholder={t("memo.search-placeholder")}
value={queryText}
onChange={onTextChange}

View file

@ -13,10 +13,8 @@ const InfoChip = ({ label, value, tooltip, className }: Props) => {
const chip = (
<Badge
variant="outline"
className={cn(
"max-w-full items-start gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-normal leading-4 whitespace-nowrap",
className,
)}
shape="pill"
className={cn("max-w-full items-start gap-1.5 px-2.5 py-1 text-[11px] font-normal leading-4 whitespace-nowrap", className)}
>
<span className="text-muted-foreground">{label}</span>
<span className="max-w-[20rem] truncate text-foreground">{value}</span>

View file

@ -127,14 +127,14 @@ const MemoRelatedSettings = () => {
{memoRelatedSetting.reactions.map((reactionType) => (
<Badge key={reactionType} variant="outline" className="flex h-8 items-center gap-2 rounded-md px-2.5 font-normal">
<span>{reactionType}</span>
<button
type="button"
className="text-muted-foreground transition-colors hover:text-destructive"
<Button
variant="ghost"
size="icon-sm"
onClick={() => updatePartialSetting({ reactions: memoRelatedSetting.reactions.filter((r) => r !== reactionType) })}
aria-label={t("setting.memo.remove-reaction")}
>
<X className="size-3.5" />
</button>
</Button>
</Badge>
))}
</div>

View file

@ -70,22 +70,10 @@ export const MonthNavigator = memo(({ visibleMonth, onMonthChange, activityStats
</Dialog>
<nav className="flex items-center shrink-0" aria-label="Month navigation">
<Button
variant="ghost"
size="sm"
onClick={handlePrevMonth}
aria-label="Previous month"
className="h-7 w-7 p-0 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/40"
>
<Button variant="ghost" size="icon-sm" onClick={handlePrevMonth} aria-label="Previous month">
<ChevronLeftIcon className="w-4 h-4" />
</Button>
<Button
variant="ghost"
size="sm"
onClick={handleNextMonth}
aria-label="Next month"
className="h-7 w-7 p-0 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/40"
>
<Button variant="ghost" size="icon-sm" onClick={handleNextMonth} aria-label="Next month">
<ChevronRightIcon className="w-4 h-4" />
</Button>
</nav>

View file

@ -69,11 +69,9 @@ const GlassButton = ({ icon, onClick, ariaLabel, title }: GlassButtonProps) => {
aria-label={ariaLabel}
title={title}
className={cn(
"h-8 w-8 flex items-center justify-center rounded-lg",
"cursor-pointer transition-all duration-200",
"inline-flex items-center justify-center h-8 w-8 rounded-lg",
"border border-border/80 bg-background/88 text-foreground shadow-sm backdrop-blur-md",
"hover:scale-105 hover:bg-background hover:shadow-md active:scale-95",
"focus:outline-none focus:ring-2 focus:ring-ring/60",
)}
>
{icon}

View file

@ -0,0 +1,50 @@
# UI Kit (`components/ui`)
shadcn/ui primitives ("new-york" style, zinc base, lucide icons, CSS variables).
This folder is the **single source of styling truth**. Read this before adding a
component or reaching for `className` on a kit component.
## The one rule: use props, not `className`
Consumers style kit components through **`variant` / `size` / `shape` props only**
— do **not** pass `className` to add colors, sizing, borders, or hover states.
- Need a look that no prop provides, but it recurs? **Add a variant here.**
- Need layout/positioning (margins, absolute)? Put it on a **wrapper** element.
- The element is genuinely bespoke (data-driven background, glass/blur, a
contextual one-off)? Don't fight the kit — use a **raw HTML element** with its
own classes. It is not a kit component.
Color comes from the semantic OKLCH tokens documented in
[`../../themes/COLOR_GUIDE.md`](../../themes/COLOR_GUIDE.md) (`--primary`,
`--muted-foreground`, `--success`, `--warning`, …). Never hardcode `gray-500` /
`amber-50` palette classes.
## Variant catalog
| Component | variant | size / shape | Notes |
| --- | --- | --- | --- |
| **Button** | default · destructive · outline · secondary · ghost · link | size: default · sm · lg · icon · **icon-sm** | `icon-sm` (`size-6`) is local — for dense/compact icon buttons. Auto-sizes unsized `svg` children to `size-4`. |
| **Badge** | default · secondary · destructive · outline · **warning** | shape: default · **pill** | `warning` + `shape` are local additions. `pill` = `rounded-full`. |
| **Tabs** | — | variant: **segmented** · **underline** | Local component (not upstream shadcn). Context-based `Tabs`/`TabsList`/`TabsTrigger`, no Radix. `underline` relies on the consumer's own divider. |
| **Dialog** | — | size: sm · default · lg · xl · 2xl · full | Local `size` variants + auto-focus prevention on open. |
| **Select** | — | size: xs · sm · default | Local `size` prop on the trigger. |
| **DropdownMenu** | item: default · destructive | — | Local destructive item variant + a sub-menu hover-delay hook. |
Each cva component also exports its variant types, e.g. `ButtonVariant`,
`ButtonSize`, `BadgeVariant`, `BadgeShape`, `TabsVariant` — use these instead of
re-deriving `VariantProps`.
## Layering (z-index tiers)
Defined once as Tailwind tokens in `themes/default.css` (`--z-index-*`) and used
by the primitives — do not hardcode `z-[60]`-style literals:
| Utility | Value | Used by |
| --- | --- | --- |
| `z-overlay` | 50 | Dialog / Sheet overlay + content |
| `z-dropdown` | 60 | Select / DropdownMenu / Popover content |
| `z-tooltip` | 70 | Tooltip content + arrow |
A dropdown inside a dialog needs `z-dropdown` (already the default) so it renders
above the overlay; a tooltip sits above everything.

View file

@ -12,10 +12,16 @@ const badgeVariants = cva(
secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
destructive: "border-transparent bg-destructive text-destructive-foreground [a&]:hover:bg-destructive/90",
outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
warning: "border-warning/40 bg-warning/10 text-warning",
},
shape: {
default: "",
pill: "rounded-full",
},
},
defaultVariants: {
variant: "default",
shape: "default",
},
},
);
@ -23,12 +29,15 @@ const badgeVariants = cva(
function Badge({
className,
variant,
shape,
asChild = false,
...props
}: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
const Comp = asChild ? Slot : "span";
return <Comp data-slot="badge" className={cn(badgeVariants({ variant }), className)} {...props} />;
return <Comp data-slot="badge" className={cn(badgeVariants({ variant, shape }), className)} {...props} />;
}
export { Badge, badgeVariants };
export type BadgeVariant = VariantProps<typeof badgeVariants>["variant"];
export type BadgeShape = VariantProps<typeof badgeVariants>["shape"];

View file

@ -20,6 +20,7 @@ const buttonVariants = cva(
sm: "h-7 rounded-md gap-1 px-2 has-[>svg]:px-2",
lg: "h-9 rounded-md px-4",
icon: "size-8",
"icon-sm": "size-6",
},
},
defaultVariants: {
@ -43,3 +44,5 @@ const Button = React.forwardRef<
Button.displayName = "Button";
export { Button, buttonVariants };
export type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
export type ButtonSize = VariantProps<typeof buttonVariants>["size"];

View file

@ -20,7 +20,7 @@ const DialogOverlay = React.forwardRef<
ref={ref}
data-slot="dialog-overlay"
className={cn(
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-foreground/50",
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-overlay bg-foreground/50",
className,
)}
{...props}
@ -29,7 +29,7 @@ const DialogOverlay = React.forwardRef<
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
const dialogContentVariants = cva(
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 flex flex-col translate-x-[-50%] translate-y-[-50%] rounded-lg border shadow-lg duration-200 max-h-[calc(100vh-2rem)] sm:max-h-[calc(100vh-3rem)] md:max-h-[calc(100vh-4rem)]",
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-overlay flex flex-col translate-x-[-50%] translate-y-[-50%] rounded-lg border shadow-lg duration-200 max-h-[calc(100vh-2rem)] sm:max-h-[calc(100vh-3rem)] md:max-h-[calc(100vh-4rem)]",
{
variants: {
size: {

View file

@ -31,7 +31,7 @@ const DropdownMenuContent = React.forwardRef<
data-slot="dropdown-menu-content"
sideOffset={sideOffset}
className={cn(
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[60] max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-dropdown max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
className,
)}
{...props}
@ -188,7 +188,7 @@ function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<ty
<DropdownMenuPrimitive.SubContent
data-slot="dropdown-menu-sub-content"
className={cn(
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[60] min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-dropdown min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
className,
)}
{...props}

View file

@ -26,7 +26,7 @@ const PopoverContent = React.forwardRef<
align={align}
sideOffset={sideOffset}
className={cn(
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[60] w-auto origin-(--radix-popover-content-transform-origin) rounded-md border p-1 shadow-md outline-hidden",
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-dropdown w-auto origin-(--radix-popover-content-transform-origin) rounded-md border p-1 shadow-md outline-hidden",
className,
)}
{...props}

View file

@ -47,7 +47,7 @@ function SelectContent({ className, children, position = "popper", ...props }: R
<SelectPrimitive.Content
data-slot="select-content"
className={cn(
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-[60] max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-dropdown max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
position === "popper" &&
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className,

View file

@ -36,7 +36,7 @@ const SheetOverlay = React.forwardRef<
ref={ref}
data-slot="sheet-overlay"
className={cn(
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-foreground/50",
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-overlay bg-foreground/50",
className,
)}
{...props}
@ -58,7 +58,7 @@ const SheetContent = React.forwardRef<
ref={ref}
data-slot="sheet-content"
className={cn(
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-overlay flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
side === "right" &&
"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
side === "left" &&

View file

@ -0,0 +1,99 @@
import { cva } from "class-variance-authority";
import { createContext, useContext } from "react";
import { cn } from "@/lib/utils";
type TabsVariant = "segmented" | "underline";
interface TabsContextValue {
value: string;
onValueChange: (value: string) => void;
variant: TabsVariant;
}
const TabsContext = createContext<TabsContextValue | null>(null);
const useTabsContext = () => {
const context = useContext(TabsContext);
if (!context) {
throw new Error("Tabs.* components must be rendered within <Tabs>");
}
return context;
};
const tabsListVariants = cva("flex flex-row", {
variants: {
variant: {
segmented: "gap-1",
underline: "gap-1",
},
},
defaultVariants: { variant: "segmented" },
});
const tabsTriggerVariants = cva(
"inline-flex items-center justify-center gap-1.5 whitespace-nowrap text-sm font-medium transition-colors cursor-pointer disabled:pointer-events-none disabled:opacity-50 [&_svg]:shrink-0",
{
variants: {
variant: {
segmented: "rounded-md px-3 py-1.5",
underline: "rounded-t-lg rounded-b-none border-b-2 px-3 py-2",
},
active: { true: "", false: "" },
},
compoundVariants: [
{ variant: "segmented", active: true, className: "bg-background text-foreground shadow-sm" },
{ variant: "segmented", active: false, className: "text-muted-foreground hover:bg-background/50 hover:text-foreground" },
{ variant: "underline", active: true, className: "border-primary bg-primary/5 text-primary" },
{
variant: "underline",
active: false,
className: "border-transparent text-muted-foreground hover:bg-muted/50 hover:text-foreground",
},
],
defaultVariants: { variant: "segmented", active: false },
},
);
interface TabsProps extends Omit<React.ComponentProps<"div">, "onChange"> {
value: string;
onValueChange: (value: string) => void;
variant?: TabsVariant;
}
function Tabs({ value, onValueChange, variant = "segmented", children, ...props }: TabsProps) {
return (
<TabsContext.Provider value={{ value, onValueChange, variant }}>
<div {...props}>{children}</div>
</TabsContext.Provider>
);
}
function TabsList({ className, ...props }: React.ComponentProps<"div">) {
const { variant } = useTabsContext();
return <div role="tablist" className={cn(tabsListVariants({ variant }), className)} {...props} />;
}
interface TabsTriggerProps extends Omit<React.ComponentProps<"button">, "value"> {
value: string;
}
function TabsTrigger({ value, className, onClick, ...props }: TabsTriggerProps) {
const { value: activeValue, onValueChange, variant } = useTabsContext();
const active = activeValue === value;
return (
<button
type="button"
role="tab"
aria-selected={active}
onClick={(event) => {
onValueChange(value);
onClick?.(event);
}}
className={cn(tabsTriggerVariants({ variant, active }), className)}
{...props}
/>
);
}
export type { TabsVariant };
export { Tabs, TabsList, TabsTrigger, tabsListVariants, tabsTriggerVariants };

View file

@ -33,13 +33,13 @@ const TooltipContent = React.forwardRef<
data-slot="tooltip-content"
sideOffset={sideOffset}
className={cn(
"bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[70] w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
"bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-tooltip w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
className,
)}
{...props}
>
{children}
<TooltipPrimitive.Arrow className="bg-primary fill-primary z-[70] size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
<TooltipPrimitive.Arrow className="bg-primary fill-primary z-tooltip size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
</TooltipPrimitive.Content>
</TooltipPrimitive.Portal>
);

View file

@ -6,9 +6,9 @@ import MemoCommentMessage from "@/components/Inbox/MemoCommentMessage";
import MemoMentionMessage from "@/components/Inbox/MemoMentionMessage";
import MobileHeader from "@/components/MobileHeader";
import Placeholder from "@/components/Placeholder";
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
import useMediaQuery from "@/hooks/useMediaQuery";
import { useNotifications } from "@/hooks/useUserQueries";
import { cn } from "@/lib/utils";
import { UserNotification, UserNotification_Status, UserNotification_Type } from "@/types/proto/api/v1/user_service_pb";
import { useTranslate } from "@/utils/i18n";
@ -55,43 +55,21 @@ const Inboxes = () => {
{/* Filter Tabs */}
<div className="w-full px-4 py-2 border-b border-border bg-muted/30">
<div className="flex flex-row gap-1">
<button
onClick={() => setFilter("all")}
className={cn(
"px-3 py-1.5 text-sm font-medium rounded-md transition-colors",
filter === "all"
? "bg-background text-foreground shadow-sm"
: "text-muted-foreground hover:text-foreground hover:bg-background/50",
)}
>
{t("common.all")} ({allNotifications.length})
</button>
<button
onClick={() => setFilter("unread")}
className={cn(
"px-3 py-1.5 text-sm font-medium rounded-md transition-colors flex items-center gap-1.5",
filter === "unread"
? "bg-background text-foreground shadow-sm"
: "text-muted-foreground hover:text-foreground hover:bg-background/50",
)}
>
<InboxIcon className="w-3.5 h-auto" />
{t("inbox.unread")} ({unreadCount})
</button>
<button
onClick={() => setFilter("archived")}
className={cn(
"px-3 py-1.5 text-sm font-medium rounded-md transition-colors flex items-center gap-1.5",
filter === "archived"
? "bg-background text-foreground shadow-sm"
: "text-muted-foreground hover:text-foreground hover:bg-background/50",
)}
>
<ArchiveIcon className="w-3.5 h-auto" />
{t("common.archived")} ({archivedCount})
</button>
</div>
<Tabs value={filter} onValueChange={(value) => setFilter(value as typeof filter)} variant="segmented">
<TabsList>
<TabsTrigger value="all">
{t("common.all")} ({allNotifications.length})
</TabsTrigger>
<TabsTrigger value="unread">
<InboxIcon className="w-3.5 h-auto" />
{t("inbox.unread")} ({unreadCount})
</TabsTrigger>
<TabsTrigger value="archived">
<ArchiveIcon className="w-3.5 h-auto" />
{t("common.archived")} ({archivedCount})
</TabsTrigger>
</TabsList>
</Tabs>
</div>
{/* Notifications List */}

View file

@ -153,10 +153,9 @@ const ShortcutGuide = ({ onUseExample }: ShortcutGuideProps) => {
{shortcutExamples.map((example) => {
const Icon = example.icon;
return (
<button
<div
key={example.filter}
type="button"
className="group rounded-md border border-transparent p-2 text-left transition-colors hover:border-border hover:bg-muted/50"
className="group cursor-pointer rounded-md border border-transparent p-2 text-left transition-colors hover:border-border hover:bg-muted/50"
onClick={() => onUseExample(example)}
>
<span className="flex items-center gap-2 text-sm font-medium text-foreground">
@ -165,7 +164,7 @@ const ShortcutGuide = ({ onUseExample }: ShortcutGuideProps) => {
</span>
<span className="mt-1 block font-mono text-xs leading-5 text-muted-foreground">{example.filter}</span>
<span className="mt-1 block text-xs leading-5 text-muted-foreground">{example.description}</span>
</button>
</div>
);
})}
</div>

View file

@ -1,5 +1,5 @@
import copy from "copy-to-clipboard";
import { ExternalLinkIcon, LayoutListIcon, type LucideIcon, MapIcon } from "lucide-react";
import { ExternalLinkIcon, LayoutListIcon, MapIcon } from "lucide-react";
import { lazy, Suspense } from "react";
import { toast } from "react-hot-toast";
import { useParams, useSearchParams } from "react-router-dom";
@ -7,9 +7,9 @@ import MemoView from "@/components/MemoView";
import PagedMemoList from "@/components/PagedMemoList";
import UserAvatar from "@/components/UserAvatar";
import { Button } from "@/components/ui/button";
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { useMemoFilters, useMemoSorting } from "@/hooks";
import { useUser } from "@/hooks/useUserQueries";
import { cn } from "@/lib/utils";
import { State } from "@/types/proto/api/v1/common_pb";
import { Memo } from "@/types/proto/api/v1/memo_service_pb";
import { useTranslate } from "@/utils/i18n";
@ -18,32 +18,6 @@ type TabView = "memos" | "map";
const UserMemoMap = lazy(() => import("@/components/UserMemoMap"));
const TabButton = ({
icon: Icon,
label,
isActive,
onClick,
}: {
icon: LucideIcon;
label: string;
isActive: boolean;
onClick: () => void;
}) => (
<button
type="button"
onClick={onClick}
className={cn(
"flex items-center gap-2 px-3 py-2 text-sm font-medium transition-all duration-200 border-b-2 rounded-t-lg",
isActive
? "border-primary text-primary bg-primary/5"
: "border-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50",
)}
>
<Icon className="h-4 w-4" />
{label}
</button>
);
interface User {
name: string;
username: string;
@ -117,13 +91,18 @@ const UserProfile = () => {
<div className="border-b border-border/10 mb-4">
<div className="mx-auto flex max-w-2xl">
<TabButton
icon={LayoutListIcon}
label={t("common.memos")}
isActive={activeTab === "memos"}
onClick={() => toggleTab("memos")}
/>
<TabButton icon={MapIcon} label={t("common.map")} isActive={activeTab === "map"} onClick={() => toggleTab("map")} />
<Tabs value={activeTab} onValueChange={(value) => toggleTab(value as TabView)} variant="underline">
<TabsList>
<TabsTrigger value="memos">
<LayoutListIcon className="h-4 w-4" />
{t("common.memos")}
</TabsTrigger>
<TabsTrigger value="map">
<MapIcon className="h-4 w-4" />
{t("common.map")}
</TabsTrigger>
</TabsList>
</Tabs>
</div>
</div>

View file

@ -92,17 +92,25 @@ The color system supports both light and dark themes automatically through CSS c
### ⚠️ Feedback Colors
| Variable | Light Theme | Dark Theme | Usage |
| -------------------------- | ----------- | ---------- | ------------------------------- |
| `--destructive` | Very dark | Red | Error states, dangerous actions |
| `--destructive-foreground` | White | White | Text on destructive backgrounds |
| Variable | Light Theme | Dark Theme | Usage |
| -------------------------- | ----------- | ------------- | ---------------------------------- |
| `--destructive` | Very dark | Red | Error states, dangerous actions |
| `--destructive-foreground` | White | White | Text on destructive backgrounds |
| `--success` | Green | Brighter green| Confirmation states (copied, saved)|
| `--success-foreground` | Near white | Near black | Text on success backgrounds |
| `--warning` | Amber | Brighter amber| Caution states (unused, deprecated)|
| `--warning-foreground` | Dark | Dark | Text on warning backgrounds |
**When to use:**
- Error messages
- Delete buttons
- Warning alerts
- Validation failures
- Error messages, delete buttons, validation failures → `--destructive`
- Success confirmations (e.g. "copied ✓", saved) → `--success`
- Non-critical caution (e.g. unused attachments) → `--warning`
For tinted treatments (badges, panels), pair the token with an opacity modifier
the same way `--destructive` is used, e.g. `border-warning/30 bg-warning/10 text-warning`.
This auto-adapts across themes — never hardcode `amber-*` / `green-*` palette classes
or add manual `dark:` overrides for feedback states.
### 📊 Data Visualization
@ -260,39 +268,27 @@ To ensure proper contrast and accessibility:
## Z-Index Hierarchy
The application uses a structured z-index hierarchy to ensure proper layering of UI components:
The layering tiers are defined once as Tailwind tokens in `default.css`
(`--z-index-overlay/dropdown/tooltip`) and consumed via named utilities — do not
hardcode `z-[60]`-style literals.
| Component Type | Z-Index | Usage |
| ----------------- | -------- | ------------------------------------- |
| **Base Content** | `z-0` | Normal page content |
| **Overlays** | `z-50` | Dialog/Sheet backgrounds |
| **Modal Content** | `z-50` | Dialog/Sheet content |
| **Dropdowns** | `z-[60]` | Select, DropdownMenu, Popover content |
| **Tooltips** | `z-[70]` | Tooltip content (highest priority) |
| Component Type | Utility | Value | Usage |
| ----------------- | ------------- | ----- | ------------------------------------- |
| **Base Content** | `z-0` | 0 | Normal page content |
| **Overlays** | `z-overlay` | 50 | Dialog/Sheet backgrounds |
| **Modal Content** | `z-overlay` | 50 | Dialog/Sheet content |
| **Dropdowns** | `z-dropdown` | 60 | Select, DropdownMenu, Popover content |
| **Tooltips** | `z-tooltip` | 70 | Tooltip content (highest priority) |
### Rules
1. **Dialog/Sheet**: Use `z-50` for both overlay and content
2. **Interactive Elements**: Use `z-[60]` for dropdowns inside dialogs
3. **Tooltips**: Use `z-[70]` to appear above all other elements
1. **Dialog/Sheet**: Use `z-overlay` for both overlay and content
2. **Interactive Elements**: Use `z-dropdown` for dropdowns inside dialogs
3. **Tooltips**: Use `z-tooltip` to appear above all other elements
4. **Always test**: Ensure Select/DropdownMenu works inside Dialog/Sheet
### Example
```tsx
// ✅ Correct: Select inside Dialog will appear above dialog content
<Dialog>
<DialogContent>
<Select>
<SelectContent className="z-[60]">
{" "}
{/* Higher than dialog */}
<SelectItem>Option 1</SelectItem>
</SelectContent>
</Select>
</DialogContent>
</Dialog>
```
These are already the defaults baked into the `ui/` primitives, so a `Select`
inside a `Dialog` renders above the overlay without any extra `z-*` class.
---

View file

@ -30,6 +30,12 @@
--destructive: oklch(0.64 0.18 24);
--destructive-foreground: oklch(0.98 0.004 255);
/* Feedback - success (green) and warning (amber), tuned brighter for dark surfaces */
--success: oklch(0.7 0.15 155);
--success-foreground: oklch(0.2 0.03 155);
--warning: oklch(0.78 0.14 75);
--warning-foreground: oklch(0.25 0.03 75);
/* Borders - --border for layout dividers, --input for form field borders */
--border: oklch(0.38 0.01 255);
--input: oklch(0.42 0.011 255);

View file

@ -15,6 +15,10 @@
--accent-foreground: oklch(0.2671 0.0196 98.939);
--destructive: oklch(0.5 0.12 25);
--destructive-foreground: oklch(1 0 0);
--success: oklch(0.55 0.13 150);
--success-foreground: oklch(0.98 0.01 150);
--warning: oklch(0.62 0.12 70);
--warning-foreground: oklch(0.25 0.03 75);
--border: oklch(0.8847 0.0069 97.3627);
--input: oklch(0.7621 0.0156 98.3528);
--ring: oklch(0.45 0.08 250);
@ -56,6 +60,10 @@
--color-accent-foreground: var(--accent-foreground);
--color-destructive: var(--destructive);
--color-destructive-foreground: var(--destructive-foreground);
--color-success: var(--success);
--color-success-foreground: var(--success-foreground);
--color-warning: var(--warning);
--color-warning-foreground: var(--warning-foreground);
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
@ -80,4 +88,10 @@
--shadow-lg: var(--shadow-lg);
--shadow-xl: var(--shadow-xl);
--shadow-2xl: var(--shadow-2xl);
/* Layering tiers — keep overlays/dropdowns/tooltips stacked consistently.
Used by the ui/ primitives via z-overlay / z-dropdown / z-tooltip. */
--z-index-overlay: 50;
--z-index-dropdown: 60;
--z-index-tooltip: 70;
}

View file

@ -15,6 +15,10 @@
--accent-foreground: oklch(0.25 0.02 65);
--destructive: oklch(0.48 0.15 25);
--destructive-foreground: oklch(0.98 0.008 80);
--success: oklch(0.55 0.13 150);
--success-foreground: oklch(0.98 0.01 150);
--warning: oklch(0.6 0.12 65);
--warning-foreground: oklch(0.25 0.03 70);
--border: oklch(0.85 0.025 72);
--input: oklch(0.8 0.03 75);
--ring: oklch(0.45 0.08 45);