@beehexa/design-rules 2611.5.5 → 2611.6.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.
Files changed (190) hide show
  1. package/README.md +1 -1
  2. package/dist/catalog.json +908 -208
  3. package/dist/docs/public/_redirects +2 -2
  4. package/dist/docs/scripts/color-pairs.mjs +4 -0
  5. package/dist/docs/src/components/ChildPages.astro +8 -1
  6. package/dist/docs/src/components/ColorDemo.astro +12 -9
  7. package/dist/docs/src/components/DocsFooter.astro +1 -1
  8. package/dist/docs/src/components/HelpOptions.astro +8 -6
  9. package/dist/docs/src/components/IconBrowser.astro +2 -2
  10. package/dist/docs/src/components/LayoutDemo.astro +178 -99
  11. package/dist/docs/src/components/NativeControlsDemo.astro +165 -40
  12. package/dist/docs/src/components/NativeFlowDemo.astro +206 -0
  13. package/dist/docs/src/components/PhaseTable.astro +9 -5
  14. package/dist/docs/src/components/RoleGuides.astro +30 -22
  15. package/dist/docs/src/components/RuleDemo.astro +111 -0
  16. package/dist/docs/src/components/ShapeDemo.astro +24 -36
  17. package/dist/docs/src/components/SiteHeader.astro +1 -1
  18. package/dist/docs/src/components/SpacingDemo.astro +2 -0
  19. package/dist/docs/src/components/SwitchToggle.astro +13 -0
  20. package/dist/docs/src/components/SystemAreas.astro +9 -6
  21. package/dist/docs/src/components/TableOfContents.astro +1 -1
  22. package/dist/docs/src/components/TokenSearch.astro +64 -0
  23. package/dist/docs/src/components/TokenTable.astro +14 -9
  24. package/dist/docs/src/components/TypeDemo.astro +1 -1
  25. package/dist/docs/src/components/logos/LogoClearSpace.astro +1 -1
  26. package/dist/docs/src/content/components/button/accessibility.mdx +3 -3
  27. package/dist/docs/src/content/components/button/changelog.mdx +1 -1
  28. package/dist/docs/src/content/components/button/examples.mdx +10 -23
  29. package/dist/docs/src/content/components/button/meta.json +5 -1
  30. package/dist/docs/src/content/components/button/usage.mdx +13 -26
  31. package/dist/docs/src/content/components/resizable-panel/meta.json +5 -1
  32. package/dist/docs/src/content/{foundations/styles/scrollbars.mdx → components/scrollbar/code.mdx} +20 -39
  33. package/dist/docs/src/content/components/scrollbar/meta.json +9 -0
  34. package/dist/docs/src/content/components/scrollbar/usage.mdx +36 -0
  35. package/dist/docs/src/content/components/switch/accessibility.mdx +28 -0
  36. package/dist/docs/src/content/components/switch/examples.mdx +35 -0
  37. package/dist/docs/src/content/components/switch/meta.json +9 -0
  38. package/dist/docs/src/content/components/switch/usage.mdx +44 -0
  39. package/dist/docs/src/content/foundations/guidelines/accessibility/statement.mdx +4 -2
  40. package/dist/docs/src/content/foundations/guidelines/accessibility/testing.mdx +1 -1
  41. package/dist/docs/src/content/foundations/guidelines/accessibility.mdx +1 -1
  42. package/dist/docs/src/content/foundations/guidelines/content/messages.mdx +67 -0
  43. package/dist/docs/src/content/foundations/guidelines/content/numbers-dates-and-currency.mdx +72 -0
  44. package/dist/docs/src/content/foundations/guidelines/content/style-and-grammar.mdx +92 -0
  45. package/dist/docs/src/content/foundations/guidelines/content/terms.mdx +57 -0
  46. package/dist/docs/src/content/foundations/guidelines/content/voice-and-tone.mdx +48 -0
  47. package/dist/docs/src/content/foundations/guidelines/content.mdx +22 -17
  48. package/dist/docs/src/content/foundations/styles/border.mdx +5 -6
  49. package/dist/docs/src/content/foundations/styles/color/accessibility.mdx +31 -7
  50. package/dist/docs/src/content/foundations/styles/color/dark-mode.mdx +66 -6
  51. package/dist/docs/src/content/foundations/styles/color/palette.mdx +2 -2
  52. package/dist/docs/src/content/foundations/styles/color/usage.mdx +5 -5
  53. package/dist/docs/src/content/foundations/styles/data-visualization.mdx +33 -78
  54. package/dist/docs/src/content/foundations/styles/elevation.mdx +2 -2
  55. package/dist/docs/src/content/foundations/styles/icons/accessibility.mdx +1 -1
  56. package/dist/docs/src/content/foundations/styles/icons/code.mdx +1 -1
  57. package/dist/docs/src/content/foundations/styles/icons/library.mdx +2 -2
  58. package/dist/docs/src/content/foundations/styles/icons/usage.mdx +0 -3
  59. package/dist/docs/src/content/foundations/styles/interaction-states.mdx +40 -14
  60. package/dist/docs/src/content/foundations/styles/layout/app-frame.mdx +4 -9
  61. package/dist/docs/src/content/foundations/styles/layout/grid.mdx +1 -1
  62. package/dist/docs/src/content/foundations/styles/layout/overlays.mdx +3 -0
  63. package/dist/docs/src/content/foundations/styles/logos/downloads-and-terms.mdx +3 -3
  64. package/dist/docs/src/content/foundations/styles/logos/using-the-logo.mdx +1 -1
  65. package/dist/docs/src/content/foundations/styles/motion.mdx +2 -0
  66. package/dist/docs/src/content/foundations/styles/radius.mdx +38 -27
  67. package/dist/docs/src/content/foundations/styles/size-and-density.mdx +7 -6
  68. package/dist/docs/src/content/foundations/styles/spacing.mdx +1 -1
  69. package/dist/docs/src/content/foundations/styles/typography/code.mdx +1 -1
  70. package/dist/docs/src/content/foundations/styles/typography/usage.mdx +7 -0
  71. package/dist/docs/src/content/foundations/styles/z-index.mdx +3 -16
  72. package/dist/docs/src/content/foundations/tokens/all-tokens.mdx +51 -2
  73. package/dist/docs/src/content/foundations/tokens/index.mdx +91 -6
  74. package/dist/docs/src/content/get-started/content.mdx +25 -3
  75. package/dist/docs/src/content/get-started/design.mdx +34 -15
  76. package/dist/docs/src/content/get-started/develop.mdx +83 -28
  77. package/dist/docs/src/content/get-started/get-help.mdx +21 -5
  78. package/dist/docs/src/content/get-started/index.mdx +11 -12
  79. package/dist/docs/src/content/tools/ant-design-vue-theme.mdx +176 -48
  80. package/dist/docs/src/content/tools/application-content.mdx +52 -13
  81. package/dist/docs/src/content/tools/editors.mdx +36 -28
  82. package/dist/docs/src/content/tools/mermaid.mdx +42 -9
  83. package/dist/docs/src/content/tools/vueflow.mdx +56 -7
  84. package/dist/docs/src/content-vi/components/button/accessibility.mdx +51 -0
  85. package/dist/docs/src/content-vi/components/button/changelog.mdx +6 -0
  86. package/dist/docs/src/content-vi/components/button/examples.mdx +27 -0
  87. package/dist/docs/src/content-vi/components/button/usage.mdx +31 -0
  88. package/dist/docs/src/content-vi/components/resizable-panel/accessibility.mdx +58 -0
  89. package/dist/docs/src/content-vi/components/resizable-panel/changelog.mdx +20 -0
  90. package/dist/docs/src/content-vi/components/resizable-panel/code.mdx +78 -0
  91. package/dist/docs/src/content-vi/components/resizable-panel/examples.mdx +83 -0
  92. package/dist/docs/src/content-vi/components/resizable-panel/usage.mdx +97 -0
  93. package/dist/docs/src/content-vi/components/scrollbar/code.mdx +71 -0
  94. package/dist/docs/src/content-vi/components/scrollbar/usage.mdx +36 -0
  95. package/dist/docs/src/content-vi/components/switch/accessibility.mdx +28 -0
  96. package/dist/docs/src/content-vi/components/switch/examples.mdx +35 -0
  97. package/dist/docs/src/content-vi/components/switch/usage.mdx +44 -0
  98. package/dist/docs/src/content-vi/foundations/guidelines/accessibility/statement.mdx +4 -2
  99. package/dist/docs/src/content-vi/foundations/guidelines/accessibility/testing.mdx +1 -1
  100. package/dist/docs/src/content-vi/foundations/guidelines/accessibility.mdx +1 -1
  101. package/dist/docs/src/content-vi/foundations/guidelines/content/messages.mdx +67 -0
  102. package/dist/docs/src/content-vi/foundations/guidelines/content/numbers-dates-and-currency.mdx +71 -0
  103. package/dist/docs/src/content-vi/foundations/guidelines/content/style-and-grammar.mdx +91 -0
  104. package/dist/docs/src/content-vi/foundations/guidelines/content/terms.mdx +57 -0
  105. package/dist/docs/src/content-vi/foundations/guidelines/content/voice-and-tone.mdx +48 -0
  106. package/dist/docs/src/content-vi/foundations/guidelines/content.mdx +24 -19
  107. package/dist/docs/src/content-vi/foundations/styles/border.mdx +5 -5
  108. package/dist/docs/src/content-vi/foundations/styles/color/accessibility.mdx +30 -7
  109. package/dist/docs/src/content-vi/foundations/styles/color/dark-mode.mdx +65 -6
  110. package/dist/docs/src/content-vi/foundations/styles/color/palette.mdx +2 -2
  111. package/dist/docs/src/content-vi/foundations/styles/color/usage.mdx +5 -5
  112. package/dist/docs/src/content-vi/foundations/styles/data-visualization.mdx +31 -1
  113. package/dist/docs/src/content-vi/foundations/styles/elevation.mdx +2 -2
  114. package/dist/docs/src/content-vi/foundations/styles/icons/accessibility.mdx +1 -1
  115. package/dist/docs/src/content-vi/foundations/styles/icons/code.mdx +1 -1
  116. package/dist/docs/src/content-vi/foundations/styles/icons/library.mdx +2 -2
  117. package/dist/docs/src/content-vi/foundations/styles/icons/usage.mdx +0 -3
  118. package/dist/docs/src/content-vi/foundations/styles/interaction-states.mdx +54 -12
  119. package/dist/docs/src/content-vi/foundations/styles/layout/app-frame.mdx +4 -9
  120. package/dist/docs/src/content-vi/foundations/styles/layout/grid.mdx +1 -1
  121. package/dist/docs/src/content-vi/foundations/styles/layout/overlays.mdx +3 -0
  122. package/dist/docs/src/content-vi/foundations/styles/logos/downloads-and-terms.mdx +3 -3
  123. package/dist/docs/src/content-vi/foundations/styles/motion.mdx +2 -0
  124. package/dist/docs/src/content-vi/foundations/styles/radius.mdx +38 -27
  125. package/dist/docs/src/content-vi/foundations/styles/size-and-density.mdx +7 -6
  126. package/dist/docs/src/content-vi/foundations/styles/spacing.mdx +1 -1
  127. package/dist/docs/src/content-vi/foundations/styles/typography/code.mdx +1 -1
  128. package/dist/docs/src/content-vi/foundations/styles/typography/usage.mdx +7 -0
  129. package/dist/docs/src/content-vi/foundations/styles/z-index.mdx +3 -16
  130. package/dist/docs/src/content-vi/foundations/tokens/all-tokens.mdx +51 -2
  131. package/dist/docs/src/content-vi/foundations/tokens/index.mdx +90 -5
  132. package/dist/docs/src/content-vi/get-started/content.mdx +36 -0
  133. package/dist/docs/src/content-vi/get-started/design.mdx +49 -0
  134. package/dist/docs/src/content-vi/get-started/develop.mdx +110 -0
  135. package/dist/docs/src/content-vi/get-started/get-help.mdx +35 -0
  136. package/dist/docs/src/content-vi/get-started/index.mdx +49 -0
  137. package/dist/docs/src/content-vi/release-phases/index.mdx +11 -0
  138. package/dist/docs/src/content-vi/tools/ai-agents.mdx +36 -0
  139. package/dist/docs/src/content-vi/tools/ant-design-vue-theme.mdx +676 -0
  140. package/dist/docs/src/content-vi/tools/application-content.mdx +171 -0
  141. package/dist/docs/src/content-vi/tools/editors.mdx +254 -0
  142. package/dist/docs/src/content-vi/tools/eslint.mdx +15 -0
  143. package/dist/docs/src/content-vi/tools/index.mdx +7 -0
  144. package/dist/docs/src/content-vi/tools/mermaid.mdx +179 -0
  145. package/dist/docs/src/content-vi/tools/stylelint.mdx +18 -0
  146. package/dist/docs/src/content-vi/tools/vueflow.mdx +189 -0
  147. package/dist/docs/src/content.config.ts +12 -1
  148. package/dist/docs/src/lib/dates.ts +8 -0
  149. package/dist/docs/src/lib/i18n.ts +1 -0
  150. package/dist/docs/src/lib/navigation.ts +6 -4
  151. package/dist/docs/src/lib/token-descriptions-vi.ts +247 -11
  152. package/dist/docs/src/lib/tokens.ts +3 -0
  153. package/dist/docs/src/styles/chrome.css +8 -8
  154. package/dist/docs/src/styles/color.css +31 -31
  155. package/dist/docs/src/styles/docs.css +55 -40
  156. package/dist/docs/src/styles/elevation.css +1 -1
  157. package/dist/docs/src/styles/global.css +13 -4
  158. package/dist/docs/src/styles/icons.css +16 -16
  159. package/dist/docs/src/styles/kit.css +29 -10
  160. package/dist/docs/src/styles/layout.css +16 -11
  161. package/dist/docs/src/styles/logos.css +24 -24
  162. package/dist/docs/src/styles/opacity.css +3 -3
  163. package/dist/docs/src/styles/rules.css +24 -0
  164. package/dist/docs/src/styles/shapes.css +2 -2
  165. package/dist/docs/src/styles/tokens.css +228 -147
  166. package/dist/docs/src/styles/tokens.js +88 -62
  167. package/dist/docs/src/styles/typography.css +9 -9
  168. package/dist/docs/src/styles/zindex.css +6 -5
  169. package/dist/docs/tokens/color.json +24 -14
  170. package/dist/docs/tokens/components.json +39 -0
  171. package/dist/docs/tokens/content.json +103 -10
  172. package/dist/docs/tokens/diagram.json +490 -49
  173. package/dist/docs/tokens/editor.json +128 -22
  174. package/dist/docs/tokens/flow.json +412 -80
  175. package/dist/docs/tokens/layout.json +13 -4
  176. package/dist/docs/tokens/motion.json +11 -0
  177. package/dist/docs/tokens/radius.json +9 -9
  178. package/dist/docs/tokens/renderer.json +8 -0
  179. package/dist/docs/tokens/resize.json +84 -15
  180. package/dist/docs/tokens/scrollbar.json +42 -7
  181. package/dist/docs/tokens/size.json +6 -6
  182. package/dist/docs/tokens/spacing.json +1 -1
  183. package/dist/docs/tokens/switch.json +314 -59
  184. package/dist/docs/tokens/typography.json +1 -1
  185. package/dist/docs/tokens/visualization.json +465 -53
  186. package/dist/docs/tokens/z-index.json +0 -10
  187. package/dist/index.js +908 -208
  188. package/package.json +1 -1
  189. package/dist/docs/src/brand/structure-proposal.md +0 -227
  190. package/dist/docs/src/content/components/button/code.mdx +0 -34
@@ -1,37 +1,45 @@
1
1
  ---
2
- // Three role cards on Get started, each with the four pages to read first.
2
+ import { langOf, localize } from '../lib/i18n';
3
+
4
+ // Three role cards on Get started, each with the pages to read first.
5
+ const lang = langOf(Astro.url.pathname);
6
+ const vi = lang === 'vi';
7
+ const L = (en: string, viText: string) => (vi ? viText : en);
3
8
  const roles = [
4
9
  {
5
- title: 'Design',
10
+ id: 'design',
11
+ title: L('Design', 'Thiết kế'),
6
12
  href: '/get-started/design/',
7
- summary: 'Build screens from tokens and components.',
13
+ summary: L('Build screens from tokens and components, and design every state.', 'Dựng màn hình từ token và component, và thiết kế đủ mọi trạng thái.'),
8
14
  links: [
9
- ['Start from tokens', '/foundations/tokens/'],
10
- ['Use existing components', '/components/'],
11
- ['Design for every state', '/foundations/styles/interaction-states/'],
12
- ['Check accessibility early', '/foundations/guidelines/accessibility/'],
15
+ [L('Tokens overview', 'Tổng quan token'), '/foundations/tokens/'],
16
+ [L('Components', 'Component'), '/components/'],
17
+ [L('Interaction states', 'Trạng thái tương tác'), '/foundations/styles/interaction-states/'],
18
+ [L('Accessibility', 'Khả năng tiếp cận'), '/foundations/guidelines/accessibility/'],
13
19
  ],
14
20
  },
15
21
  {
16
- title: 'Develop',
22
+ id: 'develop',
23
+ title: L('Develop', 'Phát triển'),
17
24
  href: '/get-started/develop/',
18
- summary: 'Ship the tokens and lint rules.',
25
+ summary: L('Add the token package and build screens that match the guidance.', 'Thêm gói token và dựng màn hình đúng theo hướng dẫn.'),
19
26
  links: [
20
- ['Use the token CSS', '/foundations/tokens/all-tokens/'],
21
- ['Build for keyboard and focus', '/foundations/guidelines/accessibility/keyboard-and-focus/'],
22
- ['Add the lint rules', '/tools/stylelint/'],
23
- ['Docs for AI agents', '/tools/ai-agents/'],
27
+ [L('All design tokens', 'Tất cả design token'), '/foundations/tokens/all-tokens/'],
28
+ [L('Keyboard and focus', 'Bàn phím và focus'), '/foundations/guidelines/accessibility/keyboard-and-focus/'],
29
+ [L('Accessibility testing', 'Kiểm thử khả năng tiếp cận'), '/foundations/guidelines/accessibility/testing/'],
30
+ [L('Docs for AI agents', 'Tài liệu cho AI agent'), '/tools/ai-agents/'],
24
31
  ],
25
32
  },
26
33
  {
27
- title: 'Content',
34
+ id: 'content',
35
+ title: L('Content', 'Nội dung'),
28
36
  href: '/get-started/content/',
29
- summary: 'Write clear, consistent product copy.',
37
+ summary: L('Write product copy that is clear, short and the same everywhere.', 'Viết nội dung sản phẩm rõ ràng, ngắn gọn và thống nhất ở mọi nơi.'),
30
38
  links: [
31
- ['Content guidelines', '/foundations/guidelines/content/'],
32
- ['Quick rules', '/get-started/content/#quick-rules'],
33
- ['Button labels', '/components/button/usage/'],
34
- ['Accessible wording', '/foundations/guidelines/accessibility/'],
39
+ [L('Voice and tone', 'Giọng văn'), '/foundations/guidelines/content/voice-and-tone/'],
40
+ [L('Messages', 'Thông báo'), '/foundations/guidelines/content/messages/'],
41
+ [L('Terms', 'Thuật ngữ'), '/foundations/guidelines/content/terms/'],
42
+ [L('Numbers, dates and currency', 'Số, ngày và tiền tệ'), '/foundations/guidelines/content/numbers-dates-and-currency/'],
35
43
  ],
36
44
  },
37
45
  ];
@@ -39,10 +47,10 @@ const roles = [
39
47
 
40
48
  <div class="role-cards">
41
49
  {roles.map((role) => (
42
- <section class="role-card" aria-labelledby={`role-${role.title.toLowerCase()}`}>
43
- <h3 id={`role-${role.title.toLowerCase()}`}><a href={role.href}>{role.title} guide →</a></h3>
50
+ <section class="role-card" aria-labelledby={`role-${role.id}`}>
51
+ <h3 id={`role-${role.id}`}><a href={localize(role.href, lang)}>{role.title} <span aria-hidden="true">→</span></a></h3>
44
52
  <p>{role.summary}</p>
45
- <ul>{role.links.map(([label, href]) => <li><a href={href}>{label}</a></li>)}</ul>
53
+ <ul>{role.links.map(([label, href]) => <li><a href={localize(href, lang)}>{label}</a></li>)}</ul>
46
54
  </section>
47
55
  ))}
48
56
  </div>
@@ -0,0 +1,111 @@
1
+ ---
2
+ // Do and don't pictures for Interaction states, Typography usage and Size and density.
3
+ // Every value is a token; the Don't side shows the mistake its caption names. Each picture is
4
+ // role="img" named by its caption, so the deliberately faded Don't controls are not read as content.
5
+ import '../styles/layout.css';
6
+ import '../styles/rules.css';
7
+ import X from '@lucide/astro/icons/x';
8
+ import { langOf } from '../lib/i18n';
9
+
10
+ interface Props {
11
+ /** states: selected | focus | opacity. type: style | caps | truncate. size: row | target. */
12
+ item: 'selected' | 'focus' | 'opacity' | 'style' | 'caps' | 'truncate' | 'row' | 'target';
13
+ }
14
+ const { item } = Astro.props;
15
+ const vi = langOf(Astro.url.pathname) === 'vi';
16
+ const L = (en: string, viText: string) => (vi ? viText : en);
17
+
18
+ const captions: Record<Props['item'], [string, string]> = {
19
+ selected: [
20
+ L('Show the selected item with the selected fill and the yellow bar, so it doesn’t rely on colour.', 'Mục đang chọn có nền chọn và dải vàng, nên không chỉ dựa vào màu.'),
21
+ L('Don’t show selection with a text colour alone. People with low colour vision can’t see it.', 'Không thể hiện mục đang chọn chỉ bằng màu chữ. Người khó phân biệt màu sẽ không thấy.'),
22
+ ],
23
+ focus: [
24
+ L('Keep the focus ring: 2 px, 2 px outside the control, on every element that takes focus.', 'Giữ vòng focus: dày 2 px, cách control 2 px, trên mọi phần tử nhận focus.'),
25
+ L('Don’t replace the focus ring with a hover fill. Keyboard users lose track of where they are.', 'Không thay vòng focus bằng nền hover. Người dùng bàn phím sẽ không biết mình đang ở đâu.'),
26
+ ],
27
+ opacity: [
28
+ L('Show hover with the hover token, one step along the scale.', 'Thể hiện hover bằng token hover, một bậc trên thang.'),
29
+ L('Don’t fade a control to show a state. The background shows through and the text loses contrast.', 'Không làm mờ control để thể hiện trạng thái. Nền lộ ra và chữ mất tương phản.'),
30
+ ],
31
+ style: [
32
+ L('Use a text style as a whole: size, weight and line height together.', 'Dùng trọn một kiểu chữ: cỡ, độ đậm và chiều cao dòng đi cùng nhau.'),
33
+ L('Don’t take a style’s size and set your own weight or line height. The near miss looks like a mistake.', 'Không lấy cỡ chữ của một kiểu rồi tự đặt độ đậm hay chiều cao dòng. Kiểu gần giống trông như lỗi.'),
34
+ ],
35
+ caps: [
36
+ L('Write in sentence case.', 'Viết hoa chữ đầu câu.'),
37
+ L('Don’t set text in all caps. It is slower to read, and Vietnamese marks crowd the line above.', 'Không viết hoa toàn bộ. Chữ khó đọc hơn, và dấu tiếng Việt chen vào dòng trên.'),
38
+ ],
39
+ truncate: [
40
+ L('Let a long name wrap, so people can read all of it.', 'Cho tên dài xuống dòng, để người dùng đọc được hết.'),
41
+ L('Don’t cut off text people need to tell items apart.', 'Không cắt chữ mà người dùng cần để phân biệt các mục.'),
42
+ ],
43
+ row: [
44
+ L('Give the controls in one row the same height.', 'Các control trong một hàng cao bằng nhau.'),
45
+ L('Don’t mix heights in one row. Edges and text no longer line up.', 'Không trộn chiều cao trong một hàng. Cạnh và chữ không còn thẳng hàng.'),
46
+ ],
47
+ target: [
48
+ L('Give a small icon button an area of at least 24 × 24 px that responds to a click.', 'Nút icon nhỏ cần vùng nhận click ít nhất 24 × 24 px.'),
49
+ L('Don’t make the clickable area the size of the icon. It is hard to hit.', 'Không để vùng click chỉ bằng icon. Rất khó bấm trúng.'),
50
+ ],
51
+ };
52
+ const longName = L('Online store to ERP, orders and refunds', 'Cửa hàng online sang ERP, đơn hàng và hoàn tiền');
53
+ ---
54
+
55
+ <div class="sp-dd">
56
+ {(['do', 'dont'] as const).map((side) => {
57
+ const dont = side === 'dont';
58
+ return (
59
+ <figure class={`sp-dd-panel is-${side}`}>
60
+ <figcaption><span aria-hidden="true">{dont ? '✕' : '✓'}</span> {dont ? L('Don’t', 'Không nên') : L('Do', 'Nên')}</figcaption>
61
+ <div class="sp-dd-stage" role="img" aria-label={captions[item][dont ? 1 : 0]}>
62
+ {item === 'selected' && (
63
+ <div class="rd-col">
64
+ <span class="kit-nav-item">{L('Orders', 'Đơn hàng')}</span>
65
+ <span class={dont ? 'kit-nav-item rd-dd-color-only' : 'kit-nav-item is-selected'}>{L('Inventory', 'Tồn kho')}</span>
66
+ <span class="kit-nav-item">{L('Customers', 'Khách hàng')}</span>
67
+ </div>
68
+ )}
69
+ {item === 'focus' && (
70
+ <span class={dont ? 'bh-button rd-dd-no-ring' : 'bh-button rd-focus'}>{L('Cancel', 'Hủy')}</span>
71
+ )}
72
+ {item === 'opacity' && (
73
+ <div class="rd-row">
74
+ <span class="bh-button bh-button-primary">{L('Save', 'Lưu')}</span>
75
+ <span class={dont ? 'bh-button bh-button-primary rd-dd-faded' : 'bh-button bh-button-primary rd-hover'} data-sample={L('Save', 'Lưu')} />
76
+ <span class="rd-caption">{L('Rest, hover', 'Nghỉ, hover')}</span>
77
+ </div>
78
+ )}
79
+ {item === 'style' && (
80
+ <div class="rd-col">
81
+ <span class={dont ? 'rd-dd-near-miss' : 'rd-title'}>{L('Sync settings', 'Cài đặt đồng bộ')}</span>
82
+ <span class="rd-body">{L('Orders sync every 5 minutes.', 'Đơn hàng đồng bộ mỗi 5 phút.')}</span>
83
+ </div>
84
+ )}
85
+ {item === 'caps' && (
86
+ <span class={dont ? 'rd-label rd-dd-caps' : 'rd-label'}>{L('Sync orders now', 'Đồng bộ đơn hàng ngay')}</span>
87
+ )}
88
+ {item === 'truncate' && (
89
+ <div class="rd-card">
90
+ <span class={dont ? 'rd-title rd-dd-cut' : 'rd-title'}>{longName}</span>
91
+ <span class="rd-body">{L('Every 5 minutes', 'Mỗi 5 phút')}</span>
92
+ </div>
93
+ )}
94
+ {item === 'row' && (
95
+ <div class="rd-row">
96
+ <span class={dont ? 'kit-input rd-dd-tall rd-row' : 'kit-input rd-row'}>{L('Search orders', 'Tìm đơn hàng')}</span>
97
+ <span class="bh-button bh-button-primary">{L('Search', 'Tìm')}</span>
98
+ </div>
99
+ )}
100
+ {item === 'target' && (
101
+ <div class="rd-row">
102
+ <span class={dont ? 'rd-target rd-dd-small-target' : 'rd-target'}><X /></span>
103
+ <span class="rd-caption">{dont ? L('16 × 16 px', '16 × 16 px') : L('24 × 24 px', '24 × 24 px')}</span>
104
+ </div>
105
+ )}
106
+ </div>
107
+ <p>{captions[item][dont ? 1 : 0]}</p>
108
+ </figure>
109
+ );
110
+ })}
111
+ </div>
@@ -8,6 +8,7 @@ import { tokenDescriptionsVi } from '../lib/token-descriptions-vi';
8
8
  import { langOf } from '../lib/i18n';
9
9
  import Pin from './ShapePin.astro';
10
10
  import CircleAlert from '@lucide/astro/icons/circle-alert';
11
+ import Play from '@lucide/astro/icons/play';
11
12
 
12
13
  interface Props {
13
14
  kind: 'radius-scale' | 'radius-use' | 'nesting' | 'focus-radius' | 'border-scale' | 'border-use' | 'dodont';
@@ -20,7 +21,8 @@ const L = (en: string, viText: string) => (vi ? viText : en);
20
21
 
21
22
  const toPx = (value: string) => (value.endsWith('rem') ? parseFloat(value) * 16 : parseFloat(value) || 0);
22
23
  const use = (t: { name: string; description: string }) => (vi ? tokenDescriptionsVi[t.name] ?? t.description : t.description).replace(/^\d+( px)?\. /, '');
23
- const radii = tokensByPrefix('radius').map((t) => ({ ...t, px: toPx(t.resolved), use: use(t) })).sort((a, b) => a.px - b.px);
24
+ // The scale demo lists the eight steps only (tier 1); role tokens are on the page's By role table.
25
+ const radii = tokensByPrefix('radius').filter((t) => !t.family).map((t) => ({ ...t, px: toPx(t.resolved), use: use(t) })).sort((a, b) => a.px - b.px);
24
26
  const widths = tokensByPrefix('border.width').map((t) => ({ ...t, px: toPx(t.resolved), use: use(t) })).sort((a, b) => a.px - b.px);
25
27
 
26
28
  const tick = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.5 8.5l3 3 6-7"/></svg>';
@@ -59,7 +61,7 @@ const tick = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-
59
61
  )}
60
62
 
61
63
  {kind === 'radius-use' && (
62
- <div class:list={['sh-ex-grid', 'sh-root', { 'is-one': item === '0' || item === '150' }]}>
64
+ <div class:list={['sh-ex-grid', 'sh-root', { 'is-one': item === '0' || item === '200' }]}>
63
65
  {item === '0' && (
64
66
  <div class="sh-ex">
65
67
  <Pin label="radius.0" r="0px">
@@ -82,24 +84,25 @@ const tick = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-
82
84
  )}
83
85
  {item === '050' && (
84
86
  <Fragment>
85
- <div class="sh-ex"><Pin label="radius.050" r="var(--bh-radius-050)"><span class="sp-btn is-primary">{L('Connect', 'Kết nối')}</span></Pin></div>
86
- <div class="sh-ex"><Pin label="radius.050" r="var(--bh-radius-050)"><span class="sp-input" style="width: 14rem"><span style="width: var(--bh-space-control-x)"></span><span>mystore.example.com</span></span></Pin></div>
87
- <div class="sh-ex"><Pin label="radius.050" r="var(--bh-radius-050)"><span class="sh-tag">{L('Online store', 'Cửa hàng online')}</span></Pin></div>
87
+ <div class="sh-ex"><Pin label="radius.050" r="var(--bh-radius-050)"><span class="sh-tag">Backend</span></Pin></div>
88
88
  <div class="sh-ex"><Pin label="radius.050" r="var(--bh-radius-050)"><span class="kit-label">{L('Synced', 'Đã đồng bộ')}</span></Pin></div>
89
+ <div class="sh-ex"><Pin label="radius.050" r="var(--bh-radius-050)"><span class="sh-tip">{L('Copied to clipboard', 'Đã sao chép')}</span></Pin></div>
89
90
  <div class="sh-ex"><Pin label="radius.050" r="var(--bh-radius-050)"><span class="sp-btn is-small">{L('Retry', 'Thử lại')}</span></Pin></div>
90
91
  <div class="sh-ex"><span class="sh-menu"><span>{L('Edit mapping', 'Sửa mapping')}</span><Pin label="radius.050" r="var(--bh-radius-050)" len="600"><span class="is-on" style="flex: 1">{L('Run sync now', 'Đồng bộ ngay')}</span></Pin><span>{L('Pause', 'Tạm dừng')}</span></span></div>
91
92
  </Fragment>
92
93
  )}
93
94
  {item === '075' && (
94
95
  <Fragment>
95
- <div class="sh-ex"><Pin label="radius.075" r="var(--bh-radius-075)"><span class="kit-nav-item is-selected" style="width: 12rem">{L('Tasks', 'Tác vụ')}</span></Pin></div>
96
+ <div class="sh-ex"><Pin label="radius.075" r="var(--bh-radius-075)"><span class="sp-btn is-primary">{L('Connect', 'Kết nối')}</span></Pin></div>
97
+ <div class="sh-ex"><Pin label="radius.075" r="var(--bh-radius-075)"><span class="sp-input"><span style="width: var(--bh-space-150)"></span><span>mystore.example.com</span></span></Pin></div>
98
+ <div class="sh-ex"><Pin label="radius.075" r="var(--bh-radius-075)"><span class="kit-nav-item is-selected" style="padding-inline-end: var(--bh-space-1000)">{L('Tasks', 'Tác vụ')}</span></Pin></div>
96
99
  </Fragment>
97
100
  )}
98
101
  {item === '100' && (
99
102
  <Fragment>
100
- <div class="sh-ex"><Pin label="radius.100" r="var(--bh-radius-100)"><span class="sh-tip">{L('Copied to clipboard', 'Đã sao chép')}</span></Pin></div>
101
- <div class="sh-ex"><Pin label="radius.100" r="var(--bh-radius-100)"><span class="kit-banner is-danger"><CircleAlert size={16} aria-hidden="true" />{L('Sync failed for 12 orders. Retrying in 5 minutes.', 'Đồng bộ lỗi 12 đơn hàng. Thử lại sau 5 phút.')}</span></Pin></div>
102
103
  <div class="sh-ex"><Pin label="radius.100" r="var(--bh-radius-100)"><span class="sh-card"><b>{L('Online store', 'Cửa hàng online')}</b><span>{L('Connected · last sync 2 minutes ago', 'Đã kết nối · đồng bộ lần cuối 2 phút trước')}</span></span></Pin></div>
104
+ <div class="sh-ex"><Pin label="radius.100" r="var(--bh-radius-100)"><span class="sh-menu"><span>{L('Edit mapping', 'Sửa mapping')}</span><span>{L('Run sync now', 'Đồng bộ ngay')}</span><span>{L('Pause', 'Tạm dừng')}</span></span></Pin></div>
105
+ <div class="sh-ex"><Pin label="radius.100" r="var(--bh-radius-100)"><span class="kit-banner is-danger"><CircleAlert size={16} aria-hidden="true" />{L('Sync failed for 12 orders. Retrying in 5 minutes.', 'Đồng bộ lỗi 12 đơn hàng. Thử lại sau 5 phút.')}</span></Pin></div>
103
106
  <div class="sh-ex"><Pin label="radius.100" r="var(--bh-radius-100)"><span class="sh-group"><span class="is-on">{L('Orders', 'Đơn hàng')}</span><span>{L('Products', 'Sản phẩm')}</span></span></Pin></div>
104
107
  </Fragment>
105
108
  )}
@@ -130,7 +133,7 @@ const tick = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-
130
133
  {item === '200' && (
131
134
  <div class="sh-ex">
132
135
  <Pin label="radius.200" r="var(--bh-radius-200)">
133
- <span class="sh-swatch" style="border-radius: var(--bh-radius-200)" role="img" aria-label={L('16 px scale value; no current component role', 'Giá trị thang 16 px; chưa gán vai trò component hiện tại')}></span>
136
+ <span class="sh-media" role="img" aria-label={L('A video preview with 16 px corners', 'Khung xem video bo góc 16 px')}><Play size={24} aria-hidden="true" /></span>
134
137
  </Pin>
135
138
  </div>
136
139
  )}
@@ -163,37 +166,22 @@ const tick = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-
163
166
  <figcaption>{L('No role: an image in a drawer, 8 px from the edge', 'Không có vai trò: ảnh trong drawer, cách mép 8 px')}</figcaption>
164
167
  </figure>
165
168
  <figure class="sh-nest">
166
- <div class="sh-outer" style="border-radius: var(--bh-radius-card); padding: var(--bh-space-050)"><span class="sh-inner" style="border-radius: var(--bh-radius-control); min-height: var(--bh-size-control-default)">{L('Button', 'Nút')}</span></div>
167
- <span class="sh-sum">{L('Role: 4', 'Vai trò: 4')}</span>
168
- <figcaption>{L('Has a role: a button in a card keeps 4 px', 'Có vai trò: nút trong card giữ 4 px')}</figcaption>
169
+ <div class="sh-outer" style="border-radius: var(--bh-radius-100); padding: var(--bh-space-050)"><span class="sh-inner" style="border-radius: var(--bh-radius-075); min-height: var(--bh-size-control-default)">{L('Button', 'Nút')}</span></div>
170
+ <span class="sh-sum">{L('Role: 6', 'Vai trò: 6')}</span>
171
+ <figcaption>{L('Has a role: a button in a card keeps 6 px', 'Có vai trò: nút trong card giữ 6 px')}</figcaption>
169
172
  </figure>
170
173
  <figure class="sh-nest">
171
- <div class="sh-outer" style="border-radius: var(--bh-radius-control); padding: var(--bh-space-050)"><span class="sh-inner" style="border-radius: var(--bh-radius-pill); min-height: var(--bh-space-250)">{L('Chip', 'Chip')}</span></div>
174
+ <div class="sh-outer" style="border-radius: var(--bh-radius-075); padding: var(--bh-space-050)"><span class="sh-inner" style="border-radius: var(--bh-radius-full); min-height: var(--bh-space-250)">{L('Chip', 'Chip')}</span></div>
172
175
  <span class="sh-sum">{L('Role: full', 'Vai trò: full')}</span>
173
176
  <figcaption>{L('Has a role: a chip in an input stays fully round', 'Có vai trò: chip trong ô nhập vẫn bo tròn hẳn')}</figcaption>
174
177
  </figure>
175
- <figure class="sh-nest">
176
- <div class="sh-outer" style="border-radius: var(--bh-radius-050); padding: var(--bh-space-050)"><span class="sh-inner" style="border-radius: var(--bh-radius-050)">{L('Menu item', 'Mục menu')}</span></div>
177
- <span class="sh-sum">{L('4 ≥ 4: keep role 4', '4 ≥ 4: giữ vai trò 4')}</span>
178
- <figcaption>{L('Menu frame and items keep their 4 px role', 'Khung và mục menu giữ vai trò 4 px')}</figcaption>
179
- </figure>
180
- <figure class="sh-nest">
181
- <div class="sh-outer" style="border-radius: var(--bh-radius-100); padding: var(--bh-space-075)"><span class="sh-inner" style="border-radius: var(--bh-radius-025); min-height: var(--bh-space-250)">{L('Inset image', 'Ảnh lồng bên trong')}</span></div>
182
- <span class="sh-sum">8 − 6 = 2</span>
183
- <figcaption>{L('Card, image 6 px from the edge', 'Card, ảnh cách mép 6 px')}</figcaption>
184
- </figure>
185
- <figure class="sh-nest">
186
- <div class="sh-outer" style="border-radius: var(--bh-radius-100); padding: var(--bh-space-300)"><span class="sh-inner" style="border-radius: var(--bh-radius-050); min-height: var(--bh-size-control-default)">{L('Button', 'Nút')}</span></div>
187
- <span class="sh-sum">24 &gt; 8</span>
188
- <figcaption>{L('Padding larger than the radius: the button keeps its own 4 px', 'Padding lớn hơn radius: nút giữ 4 px của nó')}</figcaption>
189
- </figure>
190
178
  </div>
191
179
  )}
192
180
 
193
181
  {kind === 'focus-radius' && (
194
182
  <figure class="sh-fig sh-root">
195
183
  <div class="sh-stage">
196
- <span class="sh-col"><span class="sp-btn is-primary sh-ring">{L('Connect', 'Kết nối')}</span><span class="sh-label">{L('Outside: ring radius 4 + 2 = 6', 'Ra ngoài: radius của ring 4 + 2 = 6')}</span></span>
184
+ <span class="sh-col"><span class="sp-btn is-primary sh-ring">{L('Connect', 'Kết nối')}</span><span class="sh-label">{L('Outside: ring radius 6 + 2 = 8', 'Ra ngoài: radius của ring 6 + 2 = 8')}</span></span>
197
185
  <span class="sh-col"><span class="sh-menu"><span>{L('Edit mapping', 'Sửa mapping')}</span><span class="is-focus">{L('Run sync now', 'Đồng bộ ngay')}</span><span>{L('Pause', 'Tạm dừng')}</span></span><span class="sh-label">{L('Inside a clipping box: offset −2', 'Trong khung bị cắt: offset −2')}</span></span>
198
186
  </div>
199
187
  <figcaption><span>{L('The ring is the element’s radius + 2 px. In code the browser draws it; in design files, draw it as radius + 2.', 'Ring có radius bằng radius của phần tử + 2 px. Trong code trình duyệt tự vẽ; trong file thiết kế, vẽ ring với radius + 2.')}</span></figcaption>
@@ -204,7 +192,7 @@ const tick = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-
204
192
  <div class="sh-ex-grid sh-root">
205
193
  {item === 'default' && (
206
194
  <Fragment>
207
- <div class="sh-ex is-b"><Pin solid label="border.width.default" at="bottom"><span class="sp-input" style="width: 15rem"><span style="width: var(--bh-space-150)"></span><span>mystore.example.com</span></span></Pin></div>
195
+ <div class="sh-ex is-b"><Pin solid label="border.width.default" at="bottom"><span class="sp-input"><span style="width: var(--bh-space-150)"></span><span>mystore.example.com</span></span></Pin></div>
208
196
  <div class="sh-ex is-b"><Pin solid label="border.width.default" at="bottom"><span class="sh-card"><b>{L('Online store', 'Cửa hàng online')}</b><span>{L('Connected · last sync 2 minutes ago', 'Đã kết nối · đồng bộ lần cuối 2 phút trước')}</span></span></Pin></div>
209
197
  </Fragment>
210
198
  )}
@@ -244,16 +232,16 @@ const tick = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-
244
232
  <figure class="sp-dd-panel is-do">
245
233
  <figcaption><span aria-hidden="true">✓</span> {L('Do', 'Nên')}</figcaption>
246
234
  <div class="sp-dd-stage">
247
- {item === 'nested' && <div class="sh-outer" style="border-radius: var(--bh-radius-150); padding: var(--bh-space-100); width: 13rem"><span class="sh-inner" style="border-radius: var(--bh-radius-050); min-height: 4rem">{L('Nested control group', 'Nhóm control lồng nhau')}</span></div>}
248
- {item === 'controls' && <span class="sh-row"><span class="sp-input" style="width: 11rem"><span style="width: var(--bh-space-150)"></span><span>{L('Search orders', 'Tìm đơn hàng')}</span></span><span class="sp-btn is-primary">{L('Search', 'Tìm')}</span></span>}
235
+ {item === 'nested' && <div class="sh-outer" style="border-radius: var(--bh-radius-150); padding: var(--bh-space-050)"><span class="sh-inner" style="border-radius: var(--bh-radius-100); min-height: var(--bh-space-800); padding-inline: var(--bh-space-800)">{L('Image', 'Ảnh')}</span></div>}
236
+ {item === 'controls' && <span class="sh-row"><span class="sp-input"><span style="width: var(--bh-space-150)"></span><span>{L('Search orders', 'Tìm đơn hàng')}</span></span><span class="sp-btn is-primary">{L('Search', 'Tìm')}</span></span>}
249
237
  {item === 'corners' && <span class="sh-alert"><b>{L('Before the first sync', 'Trước lần đồng bộ đầu tiên')}</b><span>{L('Map the order fields.', 'Hãy ánh xạ các trường đơn hàng.')}</span></span>}
250
238
  {item === 'selected' && <span class="sh-tabs"><span class="is-on">{L('Overview', 'Tổng quan')}</span><span>{L('Mappings', 'Mapping')}</span><span>{L('History', 'Lịch sử')}</span></span>}
251
239
  {item === 'accent' && <span class="sh-alert"><b>{L('Before the first sync', 'Trước lần đồng bộ đầu tiên')}</b><span>{L('Map the order fields.', 'Hãy ánh xạ các trường đơn hàng.')}</span></span>}
252
240
  {item === 'cards' && <span class="sh-card"><b>{L('Online store', 'Cửa hàng online')}</b><span>{L('Connected', 'Đã kết nối')}</span></span>}
253
241
  </div>
254
242
  <p>
255
- {item === 'nested' && L('The inner group keeps its 4 px role; here it also matches the outer radius minus padding: 12 − 8 = 4.', 'Nhóm bên trong giữ vai trò 4 px; ở đây cũng bằng radius ngoài trừ padding: 12 − 8 = 4.')}
256
- {item === 'controls' && L('Give inputs and buttons the same 4 px, so a row of controls lines up.', 'Ô nhập và nút dùng chung 4 px, để một hàng control thẳng hàng.')}
243
+ {item === 'nested' && L('An image has no role, so take the padding off the outer radius: 12 − 4 = 8. The two curves run side by side.', 'Ảnh không có vai trò, nên lấy radius ngoài trừ padding: 12 − 4 = 8. Hai đường cong chạy song song.')}
244
+ {item === 'controls' && L('Give inputs and buttons the same 6 px, so a row of controls lines up.', 'Ô nhập và nút dùng chung 6 px, để một hàng control thẳng hàng.')}
257
245
  {item === 'corners' && L('Round all four corners and let the accent bar follow them.', 'Bo cả bốn góc và để thanh accent chạy theo góc.')}
258
246
  {item === 'selected' && L('Mark the selected tab with a 2 px bar in the selected colour.', 'Đánh dấu tab đang chọn bằng thanh 2 px màu selected.')}
259
247
  {item === 'accent' && L('Put the 4 px accent on one edge only.', 'Chỉ đặt accent 4 px ở một cạnh.')}
@@ -263,8 +251,8 @@ const tick = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-
263
251
  <figure class="sp-dd-panel is-dont">
264
252
  <figcaption><span aria-hidden="true">✕</span> {L('Don’t', 'Không nên')}</figcaption>
265
253
  <div class="sp-dd-stage">
266
- {item === 'nested' && <div class="sh-outer" style="border-radius: var(--bh-radius-150); padding: var(--bh-space-100); width: 13rem"><span class="sh-inner" style="border-radius: var(--bh-radius-150); min-height: 4rem">{L('Nested control group', 'Nhóm control lồng nhau')}</span></div>}
267
- {item === 'controls' && <span class="sh-row"><span class="sp-input" style="width: 11rem; border-radius: var(--bh-radius-050)"><span style="width: var(--bh-space-150)"></span><span>{L('Search orders', 'Tìm đơn hàng')}</span></span><span class="sp-btn is-primary" style="border-radius: var(--bh-radius-full)">{L('Search', 'Tìm')}</span></span>}
254
+ {item === 'nested' && <div class="sh-outer" style="border-radius: var(--bh-radius-150); padding: var(--bh-space-050)"><span class="sh-inner" style="border-radius: var(--bh-radius-150); min-height: var(--bh-space-800); padding-inline: var(--bh-space-800)">{L('Image', 'Ảnh')}</span></div>}
255
+ {item === 'controls' && <span class="sh-row"><span class="sp-input" style="border-radius: var(--bh-radius-050)"><span style="width: var(--bh-space-150)"></span><span>{L('Search orders', 'Tìm đơn hàng')}</span></span><span class="sp-btn is-primary" style="border-radius: var(--bh-radius-full)">{L('Search', 'Tìm')}</span></span>}
268
256
  {item === 'corners' && <span class="sh-alert is-squared"><b>{L('Before the first sync', 'Trước lần đồng bộ đầu tiên')}</b><span>{L('Map the order fields.', 'Hãy ánh xạ các trường đơn hàng.')}</span></span>}
269
257
  {item === 'selected' && <span class="sh-tabs" style="--sh-sel: var(--bh-border-width-accent)"><span class="is-on">{L('Overview', 'Tổng quan')}</span><span>{L('Mappings', 'Mapping')}</span><span>{L('History', 'Lịch sử')}</span></span>}
270
258
  {item === 'accent' && <span class="sh-alert is-boxed"><b>{L('Before the first sync', 'Trước lần đồng bộ đầu tiên')}</b><span>{L('Map the order fields.', 'Hãy ánh xạ các trường đơn hàng.')}</span></span>}
@@ -59,7 +59,7 @@ const otherHref = localize(base, otherLang);
59
59
  <button class="icon-button search-open" type="button" aria-label={T.search} data-search-open>
60
60
  <SearchIcon size={20} />
61
61
  </button>
62
- {viPublic && <a class="icon-button lang-switch" href={otherHref} hreflang={otherLang} lang={otherLang} aria-label={T.otherLang} title={T.otherLang}>{T.otherLangShort}</a>}
62
+ {viPublic && <a class="icon-button lang-switch" href={otherHref} hreflang={otherLang} lang={otherLang} aria-label={`${T.otherLang} (${T.otherLangShort})`} title={T.otherLang}>{T.otherLangShort}</a>}
63
63
  <button class="icon-button" type="button" aria-label={T.themeDark} data-theme-toggle data-label-dark={T.themeDark} data-label-light={T.themeLight}>
64
64
  <Moon size={20} class="theme-moon" />
65
65
  <Sun size={20} class="theme-sun" />
@@ -17,7 +17,9 @@ const L = (en: string, viText: string) => (vi ? viText : en);
17
17
 
18
18
  // Rem to px at the default 16 px root size.
19
19
  const toPx = (value: string) => (value.endsWith('rem') ? parseFloat(value) * 16 : parseFloat(value) || 0);
20
+ // The scale lists the steps only (tier 1); family tokens are on the page's Tokens section.
20
21
  const scale = tokensByPrefix('space')
22
+ .filter((t) => !t.family)
21
23
  .map((t) => ({ ...t, px: toPx(t.resolved), use: (vi ? tokenDescriptionsVi[t.name] ?? t.description : t.description).replace(/^\d+( px)?\. /, '') }))
22
24
  .sort((a, b) => a.px - b.px);
23
25
 
@@ -0,0 +1,13 @@
1
+ ---
2
+ // Lets the live switch examples turn on and off. The examples only change aria-checked;
3
+ // a product saves the setting at this point.
4
+ ---
5
+
6
+ <script>
7
+ for (const button of document.querySelectorAll<HTMLButtonElement>('.code-preview .bh-switch')) {
8
+ button.addEventListener('click', () => {
9
+ if (button.disabled) return;
10
+ button.setAttribute('aria-checked', String(button.getAttribute('aria-checked') !== 'true'));
11
+ });
12
+ }
13
+ </script>
@@ -1,25 +1,28 @@
1
1
  ---
2
2
  import { getCollection } from 'astro:content';
3
+ import { langOf, localize } from '../lib/i18n';
3
4
 
4
5
  // What is in the system, with live page counts.
6
+ const lang = langOf(Astro.url.pathname);
7
+ const vi = lang === 'vi';
5
8
  const docs = await getCollection('docs');
6
9
  const count = (section: string) => docs.filter((entry) => entry.id.startsWith(`${section}/`)).length;
7
10
  const components = (await getCollection('components')).length;
8
11
  const news = (await getCollection('news')).length;
9
- const plural = (n: number, word: string) => `${n} ${word}${n === 1 ? '' : 's'}`;
12
+ const plural = (n: number, en: string, viWord: string) => (vi ? `${n} ${viWord}` : `${n} ${en}${n === 1 ? '' : 's'}`);
10
13
 
11
14
  const areas = [
12
- { title: 'Foundations', href: '/foundations/', text: 'Tokens, guidelines and styles such as color, type and logos.', meta: plural(count('foundations'), 'page') },
13
- { title: 'Components', href: '/components/', text: 'Building blocks with usage, code and accessibility notes.', meta: plural(components, 'component') },
14
- { title: 'Tools', href: '/tools/', text: 'Lint rules and docs for AI agents.', meta: plural(count('tools'), 'tool') },
15
- { title: 'News', href: '/news/', text: 'Changes to the system, newest first.', meta: plural(news, 'post') },
15
+ { title: vi ? 'Nền tảng' : 'Foundations', href: '/foundations/', text: vi ? 'Token, nguyên tắc và kiểu dáng như màu, chữ và logo.' : 'Tokens, guidelines and styles such as colour, type and logos.', meta: plural(count('foundations'), 'page', 'trang') },
16
+ { title: vi ? 'Component' : 'Components', href: '/components/', text: vi ? 'Các khối dựng giao diện, kèm cách dùng, code và khả năng tiếp cận.' : 'Building blocks with usage, code and accessibility guidance.', meta: plural(components, 'component', 'component') },
17
+ { title: vi ? 'Công cụ' : 'Tools', href: '/tools/', text: vi ? 'Quy tắc lint và tài liệu cho AI agent.' : 'Lint rules and docs for AI agents.', meta: plural(count('tools'), 'page', 'trang') },
18
+ { title: vi ? 'Tin mới' : 'News', href: '/news/', text: vi ? 'Những thay đổi của hệ thống, mới nhất trước.' : 'Changes to the system, newest first.', meta: plural(news, 'post', 'bài') },
16
19
  ];
17
20
  ---
18
21
 
19
22
  <ul class="card-grid area-grid">
20
23
  {areas.map((area) => (
21
24
  <li>
22
- <a class="card" href={area.href}>
25
+ <a class="card" href={localize(area.href, lang)}>
23
26
  {area.title}
24
27
  <p>{area.text}</p>
25
28
  <span class="card-meta">{area.meta}</span>
@@ -41,7 +41,7 @@ const headings = Astro.props.headings.filter((heading) => heading.depth === 2 ||
41
41
  /* The folded list's chevron: a 16 px Lucide icon next to the 14 px label, 4 px apart. */
42
42
  .toc-menu summary { display: flex; align-items: center; gap: var(--bh-space-050); }
43
43
  .toc-menu summary::after { content: none; }
44
- .toc-menu :global(.toc-menu-chevron) { flex: none; transition: transform 150ms ease; }
44
+ .toc-menu :global(.toc-menu-chevron) { flex: none; transition: transform var(--bh-motion-expand); }
45
45
  .toc-menu[open] :global(.toc-menu-chevron) { transform: rotate(180deg); }
46
46
  @media (prefers-reduced-motion: reduce) { .toc-menu :global(.toc-menu-chevron) { transition: none; } }
47
47
  </style>
@@ -0,0 +1,64 @@
1
+ ---
2
+ import { langOf } from '../lib/i18n';
3
+
4
+ // Filter box for the All design tokens page. Hides the rows, and whole groups, that do not
5
+ // match. Without JavaScript the box stays hidden and every token is listed.
6
+ const vi = langOf(Astro.url.pathname) === 'vi';
7
+ const L = (en: string, viText: string) => (vi ? viText : en);
8
+ ---
9
+
10
+ <div class="token-search" data-token-search hidden>
11
+ <label class="kit-field">
12
+ <span>{L('Filter tokens', 'Lọc token')}</span>
13
+ <input class="kit-input" type="search" autocomplete="off" spellcheck="false"
14
+ placeholder={L('Name, value or use, such as "focus" or "card"', 'Tên, giá trị hoặc công dụng, ví dụ "focus" hoặc "card"')} />
15
+ </label>
16
+ <p class="token-search-status" role="status" aria-live="polite"
17
+ data-one={L('1 token matches.', '1 token khớp.')}
18
+ data-many={L('{n} tokens match.', '{n} token khớp.')}
19
+ data-none={L('No token matches. Try a shorter word.', 'Không có token nào khớp. Thử từ ngắn hơn.')}></p>
20
+ </div>
21
+
22
+ <script>
23
+ const box = document.querySelector<HTMLElement>('[data-token-search]');
24
+ if (box) {
25
+ box.hidden = false;
26
+ const input = box.querySelector('input')!;
27
+ const status = box.querySelector<HTMLElement>('.token-search-status')!;
28
+ // Each h2 after the box starts a group; its blocks run until the next h2.
29
+ const groups: { blocks: HTMLElement[]; rows: HTMLElement[] }[] = [];
30
+ let node = box.nextElementSibling as HTMLElement | null;
31
+ while (node) {
32
+ if (node.tagName === 'H2') groups.push({ blocks: [node], rows: [] });
33
+ else if (groups.length) {
34
+ groups.at(-1)!.blocks.push(node);
35
+ groups.at(-1)!.rows.push(...node.querySelectorAll<HTMLElement>('tr[data-search]'));
36
+ }
37
+ node = node.nextElementSibling as HTMLElement | null;
38
+ }
39
+ const tables = [...document.querySelectorAll<HTMLElement>('.prose .table-wrap')];
40
+ const filter = () => {
41
+ // "color.text", "color-text" and "--bh-color-text" all find the same token.
42
+ const q = input.value.trim().toLowerCase().replace(/^--bh-/, '').replace(/[-.]/g, ' ');
43
+ let count = 0;
44
+ for (const group of groups) {
45
+ let shown = 0;
46
+ for (const row of group.rows) {
47
+ const hit = !q || row.dataset.search!.includes(q);
48
+ row.hidden = !hit;
49
+ if (hit) shown++;
50
+ }
51
+ count += shown;
52
+ for (const block of group.blocks) block.hidden = shown === 0 && group.rows.length > 0;
53
+ }
54
+ for (const wrap of tables) {
55
+ wrap.hidden = wrap.querySelectorAll('tr[data-search]:not([hidden])').length === 0;
56
+ // The "Family tokens" line belongs to the table after it.
57
+ const title = wrap.previousElementSibling as HTMLElement | null;
58
+ if (title?.classList.contains('token-table-title')) title.hidden = wrap.hidden;
59
+ }
60
+ status.textContent = !q ? '' : count === 0 ? status.dataset.none! : count === 1 ? status.dataset.one! : status.dataset.many!.replace('{n}', String(count));
61
+ };
62
+ input.addEventListener('input', filter);
63
+ }
64
+ </script>
@@ -7,27 +7,32 @@ import { langOf } from '../lib/i18n';
7
7
  interface Props {
8
8
  prefix: string;
9
9
  /** Show only the scale or only the family tokens. */
10
- only?: 'scale' | 'family';
10
+ only?: 'scale' | 'family' | 'component';
11
11
  }
12
12
 
13
13
  // Scale tokens (tier 1) and role tokens of a family (tier 2) are listed in two tables, so people
14
14
  // see the raw steps apart from the tokens to use for a kind of element.
15
15
  const all = tokensByPrefix(Astro.props.prefix);
16
- const scale = all.filter((token) => !token.family);
17
- const roles = all.filter((token) => token.family);
16
+ // Component tokens (tier 3) come last, in their own table.
17
+ const scale = all.filter((token) => !token.family && !token.component);
18
+ const roles = all.filter((token) => token.family && !token.component);
19
+ const comps = all.filter((token) => token.component);
18
20
  const only = Astro.props.only;
19
21
  const groups = only
20
- ? [{ title: null, tokens: only === 'family' ? roles : scale }]
21
- : roles.length && scale.length
22
- ? [{ title: null, tokens: scale }, { title: true, tokens: roles }]
23
- : [{ title: null, tokens: all }];
22
+ ? [{ title: null, tokens: only === 'family' ? roles : only === 'component' ? comps : scale }]
23
+ : [
24
+ { title: null, tokens: scale },
25
+ { title: scale.length ? 'family' : null, tokens: roles },
26
+ { title: scale.length || roles.length ? 'component' : null, tokens: comps },
27
+ ].filter((group) => group.tokens.length);
24
28
  const vi = langOf(Astro.url.pathname) === 'vi';
25
29
  const L = (en: string, viText: string) => (vi ? viText : en);
26
30
  const describe = (name: string, en: string) => (vi ? tokenDescriptionsVi[name] ?? en : en);
27
31
  ---
28
32
 
29
33
  {groups.map(({ title, tokens }) => (<>
30
- {title && <p class="token-table-title"><strong>{L('Family tokens', 'Token theo nhóm')}</strong> · {L('Use these for a kind of element; each points to a step of the scale above.', 'Dùng cho từng loại phần tử; mỗi token trỏ tới một bậc của thang ở trên.')}</p>}
34
+ {title === 'family' && <p class="token-table-title"><strong>{L('Family tokens', 'Token theo nhóm')}</strong> · {L('Use these for a kind of element; each points to a step of the scale above.', 'Dùng cho từng loại phần tử; mỗi token trỏ tới một bậc của thang ở trên.')}</p>}
35
+ {title === 'component' && <p class="token-table-title"><strong>{L('Component tokens', 'Token của component')}</strong> · {L('Used inside one component only.', 'Chỉ dùng bên trong một component.')}</p>}
31
36
  <div class="table-wrap">
32
37
  <table class="token-table">
33
38
  <thead>
@@ -35,7 +40,7 @@ const describe = (name: string, en: string) => (vi ? tokenDescriptionsVi[name] ?
35
40
  </thead>
36
41
  <tbody>
37
42
  {tokens.map((token) => (
38
- <tr>
43
+ <tr data-search={[token.name, token.value, token.resolved, token.darkResolved ?? '', describe(token.name, token.description)].join(' ').toLowerCase().replace(/[-.]/g, ' ')}>
39
44
  <td><code>{token.cssVar}</code></td>
40
45
  <td>
41
46
  <span class="token-value">
@@ -240,7 +240,7 @@ const features = [
240
240
  <div class="type-leading">
241
241
  {cols.map((c) => (
242
242
  <figure class={c.bad ? 'is-bad' : ''}>
243
- <p class="type-leading-text" lang={c.lang} style={`font-family:var(--bh-font-family-sans);font-size:14px;font-weight:400;line-height:${c.lh}px;--lh:${c.lh}px`}>{c.text.map((line, i) => <>{i > 0 && <br />}{line}</>)}</p>
243
+ <p class="type-leading-text" lang={c.lang} style={`font-family:var(--bh-font-family-sans);font-size:var(--bh-font-size-200);font-weight:var(--bh-font-weight-regular);line-height:${c.lh}px;--lh:${c.lh}px`}>{c.text.map((line, i) => <>{i > 0 && <br />}{line}</>)}</p>
244
244
  <figcaption><b>{c.title}</b><span>{c.note}</span></figcaption>
245
245
  </figure>
246
246
  ))}
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  // Clear space: x on every side, where x is the x-height of the wordmark, which is also one side of
3
- // the hexagon. Drawn the way GitLab shows its own: a grid of quarter-x cells on which every edge of
3
+ // the hexagon. Drawn as a grid of quarter-x cells on which every edge of
4
4
  // the logo and of the margin is a line; the margin is tinted; the wordmark's own "x", set in the
5
5
  // corner, is the unit.
6
6
  import { COLORS, ICON_H, ICON_PATH, ICON_SCALE, ICON_TOP, WORDMARKS, X_HEIGHT } from '../../lib/logo-geometry';
@@ -45,7 +45,7 @@ description: How Button meets WCAG 2.2 AA, its keys, what it gives you and what
45
45
 
46
46
  | Check | Status | Date |
47
47
  | --- | --- | --- |
48
- | Automated (axe, WCAG 2.2 AA), light and dark | Passed | 4 Nov 2026 |
49
- | Keyboard | Passed | 4 Nov 2026 |
50
- | Touch target, phone screen size | Passed | 4 Nov 2026 |
48
+ | Automated (axe, WCAG 2.2 AA), light and dark | Passed | 4 November 2026 |
49
+ | Keyboard | Passed | 4 November 2026 |
50
+ | Touch target, phone screen size | Passed | 4 November 2026 |
51
51
  | Screen readers (NVDA, VoiceOver) | Planned | |