@beehexa/design-rules 0.0.0-stage → 2611.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -2
- package/dist/AGENTS.md +24 -0
- package/dist/catalog.json +1814 -0
- package/dist/docs/public/_redirects +7 -0
- package/dist/docs/public/apple-touch-icon.png +0 -0
- package/dist/docs/public/brand/logos/app/apple-touch-icon.png +0 -0
- package/dist/docs/public/brand/logos/app/avatar-800.png +0 -0
- package/dist/docs/public/brand/logos/app/icon-192.png +0 -0
- package/dist/docs/public/brand/logos/app/icon-512.png +0 -0
- package/dist/docs/public/brand/logos/app/icon-maskable-512.png +0 -0
- package/dist/docs/public/brand/logos/archive/d-550/beehexa-horizontal-1-light.svg +1 -0
- package/dist/docs/public/brand/logos/archive/d-550/beehexa-horizontal-2-dark.svg +1 -0
- package/dist/docs/public/brand/logos/archive/d-550/beehexa-horizontal-3-white.svg +1 -0
- package/dist/docs/public/brand/logos/archive/d-550/beehexa-horizontal-4-graphite.svg +1 -0
- package/dist/docs/public/brand/logos/archive/d-550/hexasync-horizontal-1-light.svg +1 -0
- package/dist/docs/public/brand/logos/archive/d-550/hexasync-horizontal-2-dark.svg +1 -0
- package/dist/docs/public/brand/logos/archive/d-550/hexasync-horizontal-3-white.svg +1 -0
- package/dist/docs/public/brand/logos/archive/d-550/hexasync-horizontal-4-graphite.svg +1 -0
- package/dist/docs/public/brand/logos/archive/d-550/ui/beehexa-d-550-dark.svg +1 -0
- package/dist/docs/public/brand/logos/archive/d-550/ui/beehexa-d-550-light.svg +1 -0
- package/dist/docs/public/brand/logos/archive/d-550/ui/beehexa-design-d-550-dark.svg +1 -0
- package/dist/docs/public/brand/logos/archive/d-550/ui/beehexa-design-d-550-light.svg +1 -0
- package/dist/docs/public/brand/logos/archive/d-550/ui/hexasync-d-550-dark.svg +1 -0
- package/dist/docs/public/brand/logos/archive/d-550/ui/hexasync-d-550-light.svg +1 -0
- package/dist/docs/public/brand/logos/archive/d-550/ui/png/beehexa-design-d-550-dark@3x.png +0 -0
- package/dist/docs/public/brand/logos/archive/d-550/ui/png/beehexa-design-d-550-light@3x.png +0 -0
- package/dist/docs/public/brand/logos/beehexa-logo.zip +0 -0
- package/dist/docs/public/brand/logos/fig/anatomy-en.png +0 -0
- package/dist/docs/public/brand/logos/fig/anatomy-vi.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-dark-12.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-dark-14.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-dark-28.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-dark-32.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-dark-56.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-graphite-28.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-graphite-32.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-light-14.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-light-21.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-light-22.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-light-24.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-light-28.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-light-32.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-light-36-7c3aed7c3aed.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-light-36-swap.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-light-36.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-light-56.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-white-20.png +0 -0
- package/dist/docs/public/brand/logos/fig/beehexa-white-32.png +0 -0
- package/dist/docs/public/brand/logos/fig/clearspace.png +0 -0
- package/dist/docs/public/brand/logos/fig/construction-en.png +0 -0
- package/dist/docs/public/brand/logos/fig/construction-vi.png +0 -0
- package/dist/docs/public/brand/logos/fig/container-en.png +0 -0
- package/dist/docs/public/brand/logos/fig/container-vi.png +0 -0
- package/dist/docs/public/brand/logos/fig/hexasync-dark-20.png +0 -0
- package/dist/docs/public/brand/logos/fig/hexasync-dark-28.png +0 -0
- package/dist/docs/public/brand/logos/fig/hexasync-dark-48.png +0 -0
- package/dist/docs/public/brand/logos/fig/hexasync-light-19.png +0 -0
- package/dist/docs/public/brand/logos/fig/hexasync-light-28.png +0 -0
- package/dist/docs/public/brand/logos/fig/hexasync-light-48.png +0 -0
- package/dist/docs/public/brand/logos/fig/icon-graphite-14.png +0 -0
- package/dist/docs/public/brand/logos/fig/icon-graphite-16.png +0 -0
- package/dist/docs/public/brand/logos/fig/icon-light-16.png +0 -0
- package/dist/docs/public/brand/logos/fig/icon-light-24.png +0 -0
- package/dist/docs/public/brand/logos/fig/icon-light-48.png +0 -0
- package/dist/docs/public/brand/logos/fig/icon-light-92.png +0 -0
- package/dist/docs/public/brand/logos/fig/meaning-bee-en.png +0 -0
- package/dist/docs/public/brand/logos/fig/meaning-bee-vi.png +0 -0
- package/dist/docs/public/brand/logos/fig/meaning-outline-en.png +0 -0
- package/dist/docs/public/brand/logos/fig/meaning-outline-vi.png +0 -0
- package/dist/docs/public/brand/logos/fig/meaning-stack-en.png +0 -0
- package/dist/docs/public/brand/logos/fig/meaning-stack-vi.png +0 -0
- package/dist/docs/public/brand/logos/fig/misuse-serif.png +0 -0
- package/dist/docs/public/brand/logos/icon/beehexa-icon-graphite.svg +1 -0
- package/dist/docs/public/brand/logos/icon/beehexa-icon-white.svg +1 -0
- package/dist/docs/public/brand/logos/icon/beehexa-icon-yellow.svg +1 -0
- package/dist/docs/public/brand/logos/lockups/beehexa-horizontal-1-light.svg +1 -0
- package/dist/docs/public/brand/logos/lockups/beehexa-horizontal-2-dark.svg +1 -0
- package/dist/docs/public/brand/logos/lockups/beehexa-horizontal-3-white.svg +1 -0
- package/dist/docs/public/brand/logos/lockups/beehexa-horizontal-4-graphite.svg +1 -0
- package/dist/docs/public/brand/logos/lockups/hexasync-horizontal-1-light.svg +1 -0
- package/dist/docs/public/brand/logos/lockups/hexasync-horizontal-2-dark.svg +1 -0
- package/dist/docs/public/brand/logos/lockups/hexasync-horizontal-3-white.svg +1 -0
- package/dist/docs/public/brand/logos/lockups/hexasync-horizontal-4-graphite.svg +1 -0
- package/dist/docs/public/brand/logos/ui/beehexa-dark.svg +1 -0
- package/dist/docs/public/brand/logos/ui/beehexa-design-dark.svg +1 -0
- package/dist/docs/public/brand/logos/ui/beehexa-design-light.svg +1 -0
- package/dist/docs/public/brand/logos/ui/beehexa-icon-yellow.svg +1 -0
- package/dist/docs/public/brand/logos/ui/beehexa-light.svg +1 -0
- package/dist/docs/public/brand/logos/ui/hexasync-dark.svg +1 -0
- package/dist/docs/public/brand/logos/ui/hexasync-light.svg +1 -0
- package/dist/docs/public/brand/logos/ui/png/beehexa-design-dark@3x.png +0 -0
- package/dist/docs/public/brand/logos/ui/png/beehexa-design-light@3x.png +0 -0
- package/dist/docs/public/favicon.ico +0 -0
- package/dist/docs/public/favicon.svg +1 -0
- package/dist/docs/public/fonts/LICENSE-Inter.txt +93 -0
- package/dist/docs/public/fonts/LICENSE-JetBrainsMono.txt +93 -0
- package/dist/docs/public/fonts/inter-latin-ext-opsz-wght-italic.woff2 +0 -0
- package/dist/docs/public/fonts/inter-latin-ext-opsz-wght-normal.woff2 +0 -0
- package/dist/docs/public/fonts/inter-latin-opsz-wght-italic.woff2 +0 -0
- package/dist/docs/public/fonts/inter-latin-opsz-wght-normal.woff2 +0 -0
- package/dist/docs/public/fonts/inter-vietnamese-opsz-wght-italic.woff2 +0 -0
- package/dist/docs/public/fonts/inter-vietnamese-opsz-wght-normal.woff2 +0 -0
- package/dist/docs/public/fonts/jetbrains-mono-latin-ext-wght-normal.woff2 +0 -0
- package/dist/docs/public/fonts/jetbrains-mono-latin-wght-normal.woff2 +0 -0
- package/dist/docs/public/fonts/jetbrains-mono-vietnamese-wght-normal.woff2 +0 -0
- package/dist/docs/public/icon-192.png +0 -0
- package/dist/docs/public/icon-512.png +0 -0
- package/dist/docs/public/icon-maskable-512.png +0 -0
- package/dist/docs/public/robots.txt +4 -0
- package/dist/docs/public/site.webmanifest +21 -0
- package/dist/docs/scripts/color-pairs.mjs +46 -0
- package/dist/docs/scripts/contrast-exceptions.mjs +6 -0
- package/dist/docs/scripts/token-utils.d.mts +26 -0
- package/dist/docs/scripts/token-utils.mjs +114 -0
- package/dist/docs/src/brand/Beehexa-brandguide-full-mar12.pdf +0 -0
- package/dist/docs/src/brand/color+typoDirections.pdf +0 -0
- package/dist/docs/src/brand/structure-proposal.md +227 -0
- package/dist/docs/src/components/ChildPages.astro +25 -0
- package/dist/docs/src/components/CodeExample.astro +18 -0
- package/dist/docs/src/components/ColorDemo.astro +794 -0
- package/dist/docs/src/components/ColorExample.astro +32 -0
- package/dist/docs/src/components/ColorSwatch.astro +20 -0
- package/dist/docs/src/components/ComponentTabs.astro +21 -0
- package/dist/docs/src/components/DocsFooter.astro +25 -0
- package/dist/docs/src/components/HelpOptions.astro +20 -0
- package/dist/docs/src/components/IconBrowser.astro +257 -0
- package/dist/docs/src/components/IconDemo.astro +185 -0
- package/dist/docs/src/components/InDevelopment.astro +29 -0
- package/dist/docs/src/components/LayoutDemo.astro +384 -0
- package/dist/docs/src/components/Logo.astro +25 -0
- package/dist/docs/src/components/PhaseTable.astro +22 -0
- package/dist/docs/src/components/RoleGuides.astro +48 -0
- package/dist/docs/src/components/ShapeDemo.astro +239 -0
- package/dist/docs/src/components/ShapePin.astro +22 -0
- package/dist/docs/src/components/Sidebar.astro +206 -0
- package/dist/docs/src/components/SiteHeader.astro +211 -0
- package/dist/docs/src/components/SpacingDemo.astro +172 -0
- package/dist/docs/src/components/StatusBadge.astro +22 -0
- package/dist/docs/src/components/SystemAreas.astro +29 -0
- package/dist/docs/src/components/TableOfContents.astro +47 -0
- package/dist/docs/src/components/TokenTable.astro +40 -0
- package/dist/docs/src/components/TypeDemo.astro +249 -0
- package/dist/docs/src/components/logos/Fig.astro +28 -0
- package/dist/docs/src/components/logos/LogoAnatomy.astro +101 -0
- package/dist/docs/src/components/logos/LogoClearSpace.astro +81 -0
- package/dist/docs/src/components/logos/LogoColourVersions.astro +45 -0
- package/dist/docs/src/components/logos/LogoConstruction.astro +84 -0
- package/dist/docs/src/components/logos/LogoContainer.astro +84 -0
- package/dist/docs/src/components/logos/LogoHero.astro +42 -0
- package/dist/docs/src/components/logos/LogoInUse.astro +197 -0
- package/dist/docs/src/components/logos/LogoMeanings.astro +75 -0
- package/dist/docs/src/components/logos/LogoMinSize.astro +55 -0
- package/dist/docs/src/components/logos/LogoMistakes.astro +109 -0
- package/dist/docs/src/components/logos/LogoMisuse.astro +96 -0
- package/dist/docs/src/components/logos/LogoPair.astro +26 -0
- package/dist/docs/src/components/logos/LogoSvg.astro +68 -0
- package/dist/docs/src/content/components/button/accessibility.mdx +18 -0
- package/dist/docs/src/content/components/button/changelog.mdx +6 -0
- package/dist/docs/src/content/components/button/code.mdx +27 -0
- package/dist/docs/src/content/components/button/examples.mdx +21 -0
- package/dist/docs/src/content/components/button/meta.json +5 -0
- package/dist/docs/src/content/components/button/usage.mdx +18 -0
- package/dist/docs/src/content/foundations/guidelines/accessibility.mdx +19 -0
- package/dist/docs/src/content/foundations/guidelines/content.mdx +25 -0
- package/dist/docs/src/content/foundations/index.mdx +9 -0
- package/dist/docs/src/content/foundations/styles/border.mdx +89 -0
- package/dist/docs/src/content/foundations/styles/color/accessibility.mdx +32 -0
- package/dist/docs/src/content/foundations/styles/color/dark-mode.mdx +22 -0
- package/dist/docs/src/content/foundations/styles/color/index.mdx +65 -0
- package/dist/docs/src/content/foundations/styles/color/palette.mdx +57 -0
- package/dist/docs/src/content/foundations/styles/color/tokens.mdx +55 -0
- package/dist/docs/src/content/foundations/styles/color/usage.mdx +111 -0
- package/dist/docs/src/content/foundations/styles/data-visualization.mdx +11 -0
- package/dist/docs/src/content/foundations/styles/elevation.mdx +12 -0
- package/dist/docs/src/content/foundations/styles/icons/accessibility.mdx +72 -0
- package/dist/docs/src/content/foundations/styles/icons/code.mdx +171 -0
- package/dist/docs/src/content/foundations/styles/icons/index.mdx +62 -0
- package/dist/docs/src/content/foundations/styles/icons/library.mdx +19 -0
- package/dist/docs/src/content/foundations/styles/icons/usage.mdx +100 -0
- package/dist/docs/src/content/foundations/styles/illustration.mdx +9 -0
- package/dist/docs/src/content/foundations/styles/interaction-states.mdx +49 -0
- package/dist/docs/src/content/foundations/styles/layout/app-frame.mdx +81 -0
- package/dist/docs/src/content/foundations/styles/layout/breakpoints.mdx +56 -0
- package/dist/docs/src/content/foundations/styles/layout/grid.mdx +87 -0
- package/dist/docs/src/content/foundations/styles/layout/index.mdx +24 -0
- package/dist/docs/src/content/foundations/styles/layout/overlays.mdx +45 -0
- package/dist/docs/src/content/foundations/styles/layout/page-widths.mdx +38 -0
- package/dist/docs/src/content/foundations/styles/logos/downloads-and-terms.mdx +65 -0
- package/dist/docs/src/content/foundations/styles/logos/index.mdx +64 -0
- package/dist/docs/src/content/foundations/styles/logos/placement-and-containers.mdx +96 -0
- package/dist/docs/src/content/foundations/styles/logos/product-logos.mdx +56 -0
- package/dist/docs/src/content/foundations/styles/logos/using-the-logo.mdx +70 -0
- package/dist/docs/src/content/foundations/styles/motion.mdx +11 -0
- package/dist/docs/src/content/foundations/styles/opacity.mdx +9 -0
- package/dist/docs/src/content/foundations/styles/radius.mdx +98 -0
- package/dist/docs/src/content/foundations/styles/size-and-density.mdx +41 -0
- package/dist/docs/src/content/foundations/styles/spacing.mdx +70 -0
- package/dist/docs/src/content/foundations/styles/typography/code.mdx +53 -0
- package/dist/docs/src/content/foundations/styles/typography/index.mdx +58 -0
- package/dist/docs/src/content/foundations/styles/typography/usage.mdx +144 -0
- package/dist/docs/src/content/foundations/styles/typography/vietnamese.mdx +46 -0
- package/dist/docs/src/content/foundations/styles/z-index.mdx +9 -0
- package/dist/docs/src/content/foundations/tokens/all-tokens.mdx +36 -0
- package/dist/docs/src/content/foundations/tokens/index.mdx +27 -0
- package/dist/docs/src/content/get-started/content.mdx +14 -0
- package/dist/docs/src/content/get-started/design.mdx +30 -0
- package/dist/docs/src/content/get-started/develop.mdx +59 -0
- package/dist/docs/src/content/get-started/get-help.mdx +19 -0
- package/dist/docs/src/content/get-started/index.mdx +50 -0
- package/dist/docs/src/content/news/2026-10-16-site-structure.md +15 -0
- package/dist/docs/src/content/news/2026-10-20-docs-site.md +13 -0
- package/dist/docs/src/content/release-phases/index.mdx +12 -0
- package/dist/docs/src/content/tools/ai-agents.mdx +49 -0
- package/dist/docs/src/content/tools/ant-design-vue-theme.mdx +138 -0
- package/dist/docs/src/content/tools/eslint.mdx +15 -0
- package/dist/docs/src/content/tools/index.mdx +7 -0
- package/dist/docs/src/content/tools/stylelint.mdx +19 -0
- package/dist/docs/src/content-vi/foundations/styles/border.mdx +89 -0
- package/dist/docs/src/content-vi/foundations/styles/color/accessibility.mdx +32 -0
- package/dist/docs/src/content-vi/foundations/styles/color/dark-mode.mdx +22 -0
- package/dist/docs/src/content-vi/foundations/styles/color/index.mdx +65 -0
- package/dist/docs/src/content-vi/foundations/styles/color/palette.mdx +57 -0
- package/dist/docs/src/content-vi/foundations/styles/color/tokens.mdx +55 -0
- package/dist/docs/src/content-vi/foundations/styles/color/usage.mdx +111 -0
- package/dist/docs/src/content-vi/foundations/styles/data-visualization.mdx +11 -0
- package/dist/docs/src/content-vi/foundations/styles/icons/accessibility.mdx +72 -0
- package/dist/docs/src/content-vi/foundations/styles/icons/code.mdx +170 -0
- package/dist/docs/src/content-vi/foundations/styles/icons/index.mdx +62 -0
- package/dist/docs/src/content-vi/foundations/styles/icons/library.mdx +19 -0
- package/dist/docs/src/content-vi/foundations/styles/icons/usage.mdx +100 -0
- package/dist/docs/src/content-vi/foundations/styles/illustration.mdx +9 -0
- package/dist/docs/src/content-vi/foundations/styles/interaction-states.mdx +49 -0
- package/dist/docs/src/content-vi/foundations/styles/layout/app-frame.mdx +77 -0
- package/dist/docs/src/content-vi/foundations/styles/layout/breakpoints.mdx +56 -0
- package/dist/docs/src/content-vi/foundations/styles/layout/grid.mdx +87 -0
- package/dist/docs/src/content-vi/foundations/styles/layout/index.mdx +24 -0
- package/dist/docs/src/content-vi/foundations/styles/layout/page-widths.mdx +34 -0
- package/dist/docs/src/content-vi/foundations/styles/logos/downloads-and-terms.mdx +65 -0
- package/dist/docs/src/content-vi/foundations/styles/logos/index.mdx +64 -0
- package/dist/docs/src/content-vi/foundations/styles/logos/placement-and-containers.mdx +96 -0
- package/dist/docs/src/content-vi/foundations/styles/logos/product-logos.mdx +56 -0
- package/dist/docs/src/content-vi/foundations/styles/logos/using-the-logo.mdx +70 -0
- package/dist/docs/src/content-vi/foundations/styles/opacity.mdx +9 -0
- package/dist/docs/src/content-vi/foundations/styles/radius.mdx +98 -0
- package/dist/docs/src/content-vi/foundations/styles/size-and-density.mdx +41 -0
- package/dist/docs/src/content-vi/foundations/styles/spacing.mdx +70 -0
- package/dist/docs/src/content-vi/foundations/styles/typography/code.mdx +53 -0
- package/dist/docs/src/content-vi/foundations/styles/typography/index.mdx +58 -0
- package/dist/docs/src/content-vi/foundations/styles/typography/usage.mdx +144 -0
- package/dist/docs/src/content-vi/foundations/styles/typography/vietnamese.mdx +46 -0
- package/dist/docs/src/content-vi/foundations/styles/z-index.mdx +9 -0
- package/dist/docs/src/content.config.ts +68 -0
- package/dist/docs/src/lib/brand.ts +57 -0
- package/dist/docs/src/lib/contrast.ts +34 -0
- package/dist/docs/src/lib/i18n.ts +152 -0
- package/dist/docs/src/lib/icons.ts +46 -0
- package/dist/docs/src/lib/logo-geometry.ts +30 -0
- package/dist/docs/src/lib/lucide-categories.json +1 -0
- package/dist/docs/src/lib/lucide-data.ts +40 -0
- package/dist/docs/src/lib/navigation.ts +222 -0
- package/dist/docs/src/lib/release-phases.ts +10 -0
- package/dist/docs/src/lib/routes.ts +40 -0
- package/dist/docs/src/lib/token-descriptions-vi.ts +40 -0
- package/dist/docs/src/lib/tokens.ts +67 -0
- package/dist/docs/src/lib/tri-grid.ts +28 -0
- package/dist/docs/src/styles/chrome.css +122 -0
- package/dist/docs/src/styles/color.css +270 -0
- package/dist/docs/src/styles/docs.css +323 -0
- package/dist/docs/src/styles/global.css +66 -0
- package/dist/docs/src/styles/icons.css +135 -0
- package/dist/docs/src/styles/layout.css +165 -0
- package/dist/docs/src/styles/logos.css +236 -0
- package/dist/docs/src/styles/shapes.css +139 -0
- package/dist/docs/src/styles/tokens.css +461 -0
- package/dist/docs/src/styles/tokens.js +425 -0
- package/dist/docs/src/styles/typography.css +91 -0
- package/dist/docs/tokens/border.json +26 -0
- package/dist/docs/tokens/breakpoints.json +8 -0
- package/dist/docs/tokens/color.json +1350 -0
- package/dist/docs/tokens/elevation.json +26 -0
- package/dist/docs/tokens/layout.json +29 -0
- package/dist/docs/tokens/motion.json +12 -0
- package/dist/docs/tokens/radius.json +44 -0
- package/dist/docs/tokens/size.json +13 -0
- package/dist/docs/tokens/spacing.json +18 -0
- package/dist/docs/tokens/states.json +12 -0
- package/dist/docs/tokens/typography.json +220 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +1823 -0
- package/package.json +36 -4
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Illustrations for the Radius and Border pages. Every corner and line uses its token
|
|
3
|
+
// (tokens/radius.json, tokens/border.json), so each figure shows the real value.
|
|
4
|
+
import '../styles/layout.css';
|
|
5
|
+
import '../styles/shapes.css';
|
|
6
|
+
import { tokensByPrefix } from '../lib/tokens';
|
|
7
|
+
import { tokenDescriptionsVi } from '../lib/token-descriptions-vi';
|
|
8
|
+
import { langOf } from '../lib/i18n';
|
|
9
|
+
import Pin from './ShapePin.astro';
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
kind: 'radius-scale' | 'radius-use' | 'nesting' | 'focus-radius' | 'border-scale' | 'border-use' | 'dodont';
|
|
13
|
+
/** radius-use: '0' | '050' | '100' | '150' | '200' | 'full'. border-use: 'default' | 'selected' | 'focused' | 'accent'. dodont: see below. */
|
|
14
|
+
item?: string;
|
|
15
|
+
}
|
|
16
|
+
const { kind, item } = Astro.props;
|
|
17
|
+
const vi = langOf(Astro.url.pathname) === 'vi';
|
|
18
|
+
const L = (en: string, viText: string) => (vi ? viText : en);
|
|
19
|
+
|
|
20
|
+
const toPx = (value: string) => (value.endsWith('rem') ? parseFloat(value) * 16 : parseFloat(value) || 0);
|
|
21
|
+
const use = (t: { name: string; description: string }) => (vi ? tokenDescriptionsVi[t.name] ?? t.description : t.description).replace(/^\d+( px)?\. /, '');
|
|
22
|
+
const radii = tokensByPrefix('radius').map((t) => ({ ...t, px: toPx(t.resolved), use: use(t) })).sort((a, b) => a.px - b.px);
|
|
23
|
+
const widths = tokensByPrefix('border.width').map((t) => ({ ...t, px: toPx(t.resolved), use: use(t) })).sort((a, b) => a.px - b.px);
|
|
24
|
+
|
|
25
|
+
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>';
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
{kind === 'radius-scale' && (
|
|
29
|
+
<ul class="sh-scale sh-root" aria-label={L('Radius scale', 'Thang bo góc')}>
|
|
30
|
+
{radii.map((t) => (
|
|
31
|
+
<li>
|
|
32
|
+
<span class="sh-name"><code>{t.name}</code><small>{t.cssVar}</small></span>
|
|
33
|
+
<span class="sh-px">{t.px >= 999 ? L('Pill', 'Viên thuốc') : `${t.px} px`}</span>
|
|
34
|
+
<span class="sh-prev" aria-hidden="true"><span class="sh-swatch" style={`border-radius: var(${t.cssVar})`}></span></span>
|
|
35
|
+
<span class="sh-use">{t.use}</span>
|
|
36
|
+
</li>
|
|
37
|
+
))}
|
|
38
|
+
</ul>
|
|
39
|
+
)}
|
|
40
|
+
|
|
41
|
+
{kind === 'border-scale' && (
|
|
42
|
+
<ul class="sh-scale sh-root" aria-label={L('Border widths', 'Độ dày viền')}>
|
|
43
|
+
{widths.map((t) => (
|
|
44
|
+
<li>
|
|
45
|
+
<span class="sh-name"><code>{t.name}</code><small>{t.cssVar}</small></span>
|
|
46
|
+
<span class="sh-px">{t.px} px</span>
|
|
47
|
+
<span class="sh-prev" aria-hidden="true">
|
|
48
|
+
{t.name === 'border.width.accent'
|
|
49
|
+
? <span class="sh-line sh-accent-prev"></span>
|
|
50
|
+
: t.name === 'border.width.focused'
|
|
51
|
+
? <span class="sh-line sh-ring" style="border-width: var(--bh-border-width-default); border-color: var(--bh-color-border-bold)"></span>
|
|
52
|
+
: <span class="sh-line" style={`border-width: var(${t.cssVar})`}></span>}
|
|
53
|
+
</span>
|
|
54
|
+
<span class="sh-use">{t.use}</span>
|
|
55
|
+
</li>
|
|
56
|
+
))}
|
|
57
|
+
</ul>
|
|
58
|
+
)}
|
|
59
|
+
|
|
60
|
+
{kind === 'radius-use' && (
|
|
61
|
+
<div class:list={['sh-ex-grid', 'sh-root', { 'is-one': item === '0' || item === '200' }]}>
|
|
62
|
+
{item === '0' && (
|
|
63
|
+
<div class="sh-ex">
|
|
64
|
+
<Pin label="radius.0" r="0px">
|
|
65
|
+
<div class="sh-frame" role="img" aria-label={L('A full-width table with square corners', 'Bảng tràn hết chiều ngang, góc vuông')}>
|
|
66
|
+
<header>{L('Sync logs', 'Nhật ký đồng bộ')}</header>
|
|
67
|
+
<div class="sh-table">
|
|
68
|
+
<span><em>10:42:07</em>{L('Order #10293 to ERP', 'Đơn #10293 sang ERP')}<em>{L('Synced', 'Đã đồng bộ')}</em></span>
|
|
69
|
+
<span><em>10:42:11</em>{L('Order #10295 to ERP', 'Đơn #10295 sang ERP')}<em>{L('Synced', 'Đã đồng bộ')}</em></span>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</Pin>
|
|
73
|
+
</div>
|
|
74
|
+
)}
|
|
75
|
+
{item === '050' && (
|
|
76
|
+
<Fragment>
|
|
77
|
+
<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>
|
|
78
|
+
<div class="sh-ex"><Pin label="radius.050" r="var(--bh-radius-050)"><span class="sh-badge">3</span></Pin></div>
|
|
79
|
+
<div class="sh-ex"><span class="sh-row"><Pin label="radius.050" r="var(--bh-radius-050)"><span class="sh-check" set:html={tick}></span></Pin><span>{L('Sync stock', 'Đồng bộ tồn kho')}</span></span></div>
|
|
80
|
+
<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>
|
|
81
|
+
</Fragment>
|
|
82
|
+
)}
|
|
83
|
+
{item === '100' && (
|
|
84
|
+
<Fragment>
|
|
85
|
+
<div class="sh-ex"><Pin label="radius.100" r="var(--bh-radius-100)"><span class="sp-btn is-primary">{L('Connect', 'Kết nối')}</span></Pin></div>
|
|
86
|
+
<div class="sh-ex"><Pin label="radius.100" r="var(--bh-radius-100)"><span class="sp-input" style="width: 14rem"><span style="width: var(--bh-space-150)"></span><span>mystore.example.com</span></span></Pin></div>
|
|
87
|
+
<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>
|
|
88
|
+
<div class="sh-ex"><Pin label="radius.100" r="var(--bh-radius-100)"><span class="sh-alert"><b>{L('Sync failed for 12 orders', 'Đồng bộ lỗi 12 đơn hàng')}</b><span>{L('Retrying in 5 minutes.', 'Thử lại sau 5 phút.')}</span></span></Pin></div>
|
|
89
|
+
</Fragment>
|
|
90
|
+
)}
|
|
91
|
+
{item === '150' && (
|
|
92
|
+
<Fragment>
|
|
93
|
+
<div class="sh-ex"><Pin label="radius.150" r="var(--bh-radius-150)"><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>
|
|
94
|
+
<div class="sh-ex"><Pin label="radius.150" r="var(--bh-radius-150)"><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>
|
|
95
|
+
</Fragment>
|
|
96
|
+
)}
|
|
97
|
+
{item === '200' && (
|
|
98
|
+
<div class="sh-ex">
|
|
99
|
+
<Pin label="radius.200" r="var(--bh-radius-200)">
|
|
100
|
+
<span class="sh-dialog" role="img" aria-label={L('A dialog with 16 px corners', 'Dialog bo góc 16 px')}>
|
|
101
|
+
<b>{L('Disconnect the online store?', 'Ngắt kết nối cửa hàng online?')}</b>
|
|
102
|
+
<p>{L('Orders stop syncing until you connect again.', 'Đơn hàng sẽ ngừng đồng bộ cho đến khi bạn kết nối lại.')}</p>
|
|
103
|
+
<span class="sh-row"><span class="sp-btn">{L('Cancel', 'Huỷ')}</span><span class="sp-btn is-primary">{L('Disconnect', 'Ngắt kết nối')}</span></span>
|
|
104
|
+
</span>
|
|
105
|
+
</Pin>
|
|
106
|
+
</div>
|
|
107
|
+
)}
|
|
108
|
+
{item === 'full' && (
|
|
109
|
+
<Fragment>
|
|
110
|
+
<div class="sh-ex"><Pin label="radius.full" r="calc(var(--bh-space-600) / 2)"><span class="sh-avatar">TN</span></Pin></div>
|
|
111
|
+
<div class="sh-ex"><Pin label="radius.full" r="calc(var(--bh-size-control-small) / 2)"><span class="sh-switch" role="img" aria-label={L('Switch, on', 'Switch, đang bật')}></span></Pin></div>
|
|
112
|
+
<div class="sh-ex"><Pin label="radius.full" r="calc(var(--bh-size-control-default) / 2)"><span class="sh-chip">{L('Online store', 'Cửa hàng online')}<span aria-hidden="true">×</span></span></Pin></div>
|
|
113
|
+
<div class="sh-ex"><Pin label="radius.full" r="calc(var(--bh-size-control-small) / 2)"><span class="sh-tag is-pill">{L('Connected', 'Đã kết nối')}</span></Pin></div>
|
|
114
|
+
</Fragment>
|
|
115
|
+
)}
|
|
116
|
+
</div>
|
|
117
|
+
)}
|
|
118
|
+
|
|
119
|
+
{kind === 'nesting' && (
|
|
120
|
+
<div class="sh-nest-grid sh-root">
|
|
121
|
+
<figure class="sh-nest">
|
|
122
|
+
<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)">{L('Image', 'Ảnh')}</span></div>
|
|
123
|
+
<span class="sh-sum">12 − 4 = 8</span>
|
|
124
|
+
<figcaption>{L('Card, image 4 px from the edge', 'Card, ảnh cách mép 4 px')}</figcaption>
|
|
125
|
+
</figure>
|
|
126
|
+
<figure class="sh-nest">
|
|
127
|
+
<div class="sh-outer" style="border-radius: var(--bh-radius-200); padding: var(--bh-space-100)"><span class="sh-inner" style="border-radius: var(--bh-radius-100)">{L('Button', 'Nút')}</span></div>
|
|
128
|
+
<span class="sh-sum">16 − 8 = 8</span>
|
|
129
|
+
<figcaption>{L('Group of controls, 8 px padding', 'Nhóm control, padding 8 px')}</figcaption>
|
|
130
|
+
</figure>
|
|
131
|
+
<figure class="sh-nest">
|
|
132
|
+
<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-050)">{L('Menu item', 'Mục menu')}</span></div>
|
|
133
|
+
<span class="sh-sum">8 − 4 = 4</span>
|
|
134
|
+
<figcaption>{L('Menu, items 4 px from the edge', 'Menu, mục cách mép 4 px')}</figcaption>
|
|
135
|
+
</figure>
|
|
136
|
+
<figure class="sh-nest">
|
|
137
|
+
<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('Chip', 'Chip')}</span></div>
|
|
138
|
+
<span class="sh-sum">8 − 6 = 2</span>
|
|
139
|
+
<figcaption>{L('Input, chip 6 px from the edge', 'Ô nhập, chip cách mép 6 px')}</figcaption>
|
|
140
|
+
</figure>
|
|
141
|
+
<figure class="sh-nest">
|
|
142
|
+
<div class="sh-outer" style="border-radius: var(--bh-radius-150); padding: var(--bh-space-300)"><span class="sh-inner" style="border-radius: var(--bh-radius-100); min-height: var(--bh-size-control-default)">{L('Button', 'Nút')}</span></div>
|
|
143
|
+
<span class="sh-sum">24 > 12</span>
|
|
144
|
+
<figcaption>{L('Padding larger than the radius: the button keeps its own 8 px', 'Padding lớn hơn radius: nút giữ 8 px của nó')}</figcaption>
|
|
145
|
+
</figure>
|
|
146
|
+
</div>
|
|
147
|
+
)}
|
|
148
|
+
|
|
149
|
+
{kind === 'focus-radius' && (
|
|
150
|
+
<figure class="sh-fig sh-root">
|
|
151
|
+
<div class="sh-stage">
|
|
152
|
+
<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 8 + 2 = 10', 'Ra ngoài: radius của ring 8 + 2 = 10')}</span></span>
|
|
153
|
+
<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>
|
|
154
|
+
</div>
|
|
155
|
+
<figcaption><span>{L('The browser draws the ring around the corner, so it needs no radius token of its own.', 'Trình duyệt tự vẽ ring theo góc, nên ring không cần token radius riêng.')}</span></figcaption>
|
|
156
|
+
</figure>
|
|
157
|
+
)}
|
|
158
|
+
|
|
159
|
+
{kind === 'border-use' && (
|
|
160
|
+
<div class="sh-ex-grid sh-root">
|
|
161
|
+
{item === 'default' && (
|
|
162
|
+
<Fragment>
|
|
163
|
+
<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>
|
|
164
|
+
<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>
|
|
165
|
+
</Fragment>
|
|
166
|
+
)}
|
|
167
|
+
{item === 'selected' && (
|
|
168
|
+
<Fragment>
|
|
169
|
+
<div class="sh-ex is-b"><span class="sh-tabs"><Pin solid label="border.width.selected" at="bottom"><span class="is-on">{L('Overview', 'Tổng quan')}</span></Pin><span>{L('Mappings', 'Mapping')}</span><span>{L('History', 'Lịch sử')}</span></span></div>
|
|
170
|
+
<div class="sh-ex is-b"><Pin solid label="border.width.selected" at="bottom"><span class="sh-card is-selected"><b>{L('Every 15 minutes', 'Mỗi 15 phút')}</b><span>{L('Selected schedule', 'Lịch đang chọn')}</span></span></Pin></div>
|
|
171
|
+
<div class="sh-ex is-b is-span is-left"><span class="sh-nav"><span>{L('Dashboard', 'Bảng điều khiển')}</span><Pin solid label="border.width.selected" at="left" lenNarrow="600"><span class="is-on">{L('Integrations', 'Tích hợp')}</span></Pin><span>{L('Logs', 'Nhật ký')}</span></span></div>
|
|
172
|
+
</Fragment>
|
|
173
|
+
)}
|
|
174
|
+
{item === 'focused' && (
|
|
175
|
+
<Fragment>
|
|
176
|
+
<div class="sh-ex is-b"><Pin solid label="border.width.focused" at="bottom" len="400"><span class="sp-btn sh-ring">{L('Test connection', 'Kiểm tra kết nối')}</span></Pin></div>
|
|
177
|
+
<div class="sh-ex is-b"><span class="sh-menu"><span>{L('Edit mapping', 'Sửa mapping')}</span><span>{L('Pause', 'Tạm dừng')}</span><Pin solid label="border.width.focused" at="bottom" len="400"><span class="is-focus">{L('Run sync now', 'Đồng bộ ngay')}</span></Pin></span></div>
|
|
178
|
+
</Fragment>
|
|
179
|
+
)}
|
|
180
|
+
{item === 'accent' && (
|
|
181
|
+
<Fragment>
|
|
182
|
+
<div class="sh-ex is-b is-span is-left"><Pin solid label="border.width.accent" at="left" wide><span class="sh-alert"><b>{L('Sync failed for 12 orders', 'Đồng bộ lỗi 12 đơn hàng')}</b><span>{L('The store returned 429. Retrying in 5 minutes.', 'Cửa hàng trả về 429. Thử lại sau 5 phút.')}</span></span></Pin></div>
|
|
183
|
+
<div class="sh-ex is-b is-span is-left"><Pin solid label="border.width.accent" at="left"><p class="sh-quote">{L('Use one radius for every control.', 'Mọi control dùng chung một radius.')}</p></Pin></div>
|
|
184
|
+
<div class="sh-ex is-b is-span is-left">
|
|
185
|
+
<span class="sh-frame">
|
|
186
|
+
<div class="sh-table">
|
|
187
|
+
<span><em>10:42:07</em>{L('Order #10293', 'Đơn #10293')}<em>{L('Synced', 'Đã đồng bộ')}</em></span>
|
|
188
|
+
<Pin solid label="border.width.accent" at="left" lenNarrow="800"><span class="is-error"><em>10:42:09</em>{L('Order #10294', 'Đơn #10294')}<em>{L('Failed', 'Lỗi')}</em></span></Pin>
|
|
189
|
+
<span><em>10:42:11</em>{L('Order #10295', 'Đơn #10295')}<em>{L('Synced', 'Đã đồng bộ')}</em></span>
|
|
190
|
+
</div>
|
|
191
|
+
</span>
|
|
192
|
+
</div>
|
|
193
|
+
</Fragment>
|
|
194
|
+
)}
|
|
195
|
+
</div>
|
|
196
|
+
)}
|
|
197
|
+
|
|
198
|
+
{kind === 'dodont' && (
|
|
199
|
+
<div class="sp-dd sh-root">
|
|
200
|
+
<figure class="sp-dd-panel is-do">
|
|
201
|
+
<figcaption><span aria-hidden="true">✓</span> {L('Do', 'Nên')}</figcaption>
|
|
202
|
+
<div class="sp-dd-stage">
|
|
203
|
+
{item === 'nested' && <div class="sh-outer" style="border-radius: var(--bh-radius-200); padding: var(--bh-space-100); width: 13rem"><span class="sh-inner" style="border-radius: var(--bh-radius-100); min-height: 4rem">{L('Button group', 'Nhóm nút')}</span></div>}
|
|
204
|
+
{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>}
|
|
205
|
+
{item === 'corners' && <span class="sh-alert"><b>{L('Sync failed', 'Đồng bộ lỗi')}</b><span>{L('12 orders were not sent.', '12 đơn chưa được gửi.')}</span></span>}
|
|
206
|
+
{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>}
|
|
207
|
+
{item === 'accent' && <span class="sh-alert"><b>{L('Sync failed', 'Đồng bộ lỗi')}</b><span>{L('12 orders were not sent.', '12 đơn chưa được gửi.')}</span></span>}
|
|
208
|
+
{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>}
|
|
209
|
+
</div>
|
|
210
|
+
<p>
|
|
211
|
+
{item === 'nested' && L('Take the padding off the outer radius: 16 − 8 = 8. The two curves run side by side.', 'Lấy radius ngoài trừ padding: 16 − 8 = 8. Hai đường cong chạy song song.')}
|
|
212
|
+
{item === 'controls' && L('Give inputs and buttons the same 8 px, so a row of controls lines up.', 'Ô nhập và nút dùng chung 8 px, để một hàng control thẳng hàng.')}
|
|
213
|
+
{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.')}
|
|
214
|
+
{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.')}
|
|
215
|
+
{item === 'accent' && L('Put the 4 px accent on one edge only.', 'Chỉ đặt accent 4 px ở một cạnh.')}
|
|
216
|
+
{item === 'cards' && L('Give cards a 1 px border. Selection adds the 2 px border.', 'Card dùng viền 1 px. Khi chọn mới dùng viền 2 px.')}
|
|
217
|
+
</p>
|
|
218
|
+
</figure>
|
|
219
|
+
<figure class="sp-dd-panel is-dont">
|
|
220
|
+
<figcaption><span aria-hidden="true">✕</span> {L('Don’t', 'Không nên')}</figcaption>
|
|
221
|
+
<div class="sp-dd-stage">
|
|
222
|
+
{item === 'nested' && <div class="sh-outer" style="border-radius: var(--bh-radius-200); padding: var(--bh-space-100); width: 13rem"><span class="sh-inner" style="border-radius: var(--bh-radius-200); min-height: 4rem">{L('Button group', 'Nhóm nút')}</span></div>}
|
|
223
|
+
{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>}
|
|
224
|
+
{item === 'corners' && <span class="sh-alert is-squared"><b>{L('Sync failed', 'Đồng bộ lỗi')}</b><span>{L('12 orders were not sent.', '12 đơn chưa được gửi.')}</span></span>}
|
|
225
|
+
{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>}
|
|
226
|
+
{item === 'accent' && <span class="sh-alert is-boxed"><b>{L('Sync failed', 'Đồng bộ lỗi')}</b><span>{L('12 orders were not sent.', '12 đơn chưa được gửi.')}</span></span>}
|
|
227
|
+
{item === 'cards' && <span class="sh-card" style="border-width: var(--bh-border-width-selected); border-color: var(--bh-color-border-bold)"><b>{L('Online store', 'Cửa hàng online')}</b><span>{L('Connected', 'Đã kết nối')}</span></span>}
|
|
228
|
+
</div>
|
|
229
|
+
<p>
|
|
230
|
+
{item === 'nested' && L('The same 16 px inside and out. The gap is wider at the corners than along the sides.', 'Trong và ngoài cùng 16 px. Khoảng hở ở góc rộng hơn ở hai cạnh.')}
|
|
231
|
+
{item === 'controls' && L('A 4 px input next to a pill button. The row looks like two different products.', 'Ô nhập 4 px cạnh nút viên thuốc. Hàng control trông như của hai sản phẩm khác nhau.')}
|
|
232
|
+
{item === 'corners' && L('Square only the left corners. One box ends up with two radii.', 'Chỉ làm vuông hai góc trái. Một hộp có hai radius khác nhau.')}
|
|
233
|
+
{item === 'selected' && L('Use the 4 px accent for a selected tab. Accent is for status and emphasis.', 'Dùng accent 4 px cho tab đang chọn. Accent dành cho trạng thái và nhấn mạnh.')}
|
|
234
|
+
{item === 'accent' && L('Draw 4 px all the way round. The alert shouts and the message gets lost.', 'Vẽ 4 px quanh cả hộp. Alert quá nặng và nội dung bị lấn át.')}
|
|
235
|
+
{item === 'cards' && L('Give every card a 2 px border. Nothing can show selection any more.', 'Card nào cũng viền 2 px. Không còn cách nào để báo trạng thái đang chọn.')}
|
|
236
|
+
</p>
|
|
237
|
+
</figure>
|
|
238
|
+
</div>
|
|
239
|
+
)}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Points at the part of an example that the token sets, the way a spec redline does: a Beehexa
|
|
3
|
+
// hexagon on that spot, the corner's own curve traced inside it (radius pins), and a line to the
|
|
4
|
+
// token name.
|
|
5
|
+
interface Props {
|
|
6
|
+
label: string;
|
|
7
|
+
/** corner: the bottom-left corner. bottom / top: the middle of the bottom or top edge. left: the middle of the left edge. */
|
|
8
|
+
at?: 'corner' | 'bottom' | 'top' | 'left';
|
|
9
|
+
/** The element's radius, e.g. var(--bh-radius-100). Draws the curve inside the hexagon. Leave out for border pins. */
|
|
10
|
+
r?: string;
|
|
11
|
+
/** Line length as a space token step, e.g. '300' for space.300. */
|
|
12
|
+
len?: string;
|
|
13
|
+
/** Let the pinned element take the full width of its column (alerts, tables). */
|
|
14
|
+
wide?: boolean;
|
|
15
|
+
/** A small solid hexagon and a dark line, as on the Border page. */
|
|
16
|
+
solid?: boolean;
|
|
17
|
+
/** Line length when a left pin drops down on narrow screens. */
|
|
18
|
+
lenNarrow?: string;
|
|
19
|
+
}
|
|
20
|
+
const { label, at = 'corner', r, len = '300', wide = false, solid = false, lenNarrow } = Astro.props;
|
|
21
|
+
---
|
|
22
|
+
<span class:list={['sh-pin', { 'is-wide': wide }]}><slot /><span class:list={['sh-anno', `is-${at}`, { 'is-solid': solid }]} style={`--sh-len: var(--bh-space-${len});${lenNarrow ? ` --sh-len-n: var(--bh-space-${lenNarrow});` : ''}${r ? ` --sh-r: ${r};` : ''}`} aria-hidden="true"><i class="sh-mark">{r && <b class="sh-arc"></b>}</i><b class="sh-ln"></b><code>{label}</code></span></span>
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The one navigation tree for the design system. Every section (level 1) starts open, so the
|
|
3
|
+
// whole system is visible on arrival; its whole row opens and closes it, and its first page
|
|
4
|
+
// (Overview) is the section's landing page. A page with sub-pages (level 2, such as Logos or
|
|
5
|
+
// Typography) is a folder row that links to its first page: a plain click opens the folder and
|
|
6
|
+
// goes there, or only closes it when open; modified clicks open the page in a new tab.
|
|
7
|
+
// Nothing closes on its own: opening, closing or following a link never changes another
|
|
8
|
+
// branch. What the reader opened or closed is kept for the browser tab.
|
|
9
|
+
import { isCurrent, type SectionId, type Sidebar } from '../lib/navigation';
|
|
10
|
+
import StatusBadge from './StatusBadge.astro';
|
|
11
|
+
import ChevronRight from '@lucide/astro/icons/chevron-right';
|
|
12
|
+
import X from '@lucide/astro/icons/x';
|
|
13
|
+
import { basePath, langOf, localize, t } from '../lib/i18n';
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
tree: (Sidebar & { id: SectionId })[];
|
|
17
|
+
current?: SectionId;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const { tree } = Astro.props;
|
|
21
|
+
const lang = langOf(Astro.url.pathname);
|
|
22
|
+
const T = t(lang);
|
|
23
|
+
const path = basePath(Astro.url.pathname);
|
|
24
|
+
const L = (href: string) => localize(href, lang);
|
|
25
|
+
const current = (href: string) => (isCurrent(href, path) ? 'page' : undefined);
|
|
26
|
+
const slug = (href: string) => href.replace(/[^a-z0-9]+/gi, '-').replace(/^-|-$/g, '');
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<nav class="sidebar" id="docs-sidebar" aria-label={T.designSystem}>
|
|
30
|
+
<div class="sidebar-head">
|
|
31
|
+
<span class="sidebar-title">{T.designSystem}</span>
|
|
32
|
+
<button class="sidebar-close" type="button" data-drawer-close aria-label={T.closeMenu}>
|
|
33
|
+
<X size={20} />
|
|
34
|
+
</button>
|
|
35
|
+
</div>
|
|
36
|
+
<ul class="sidebar-tree">
|
|
37
|
+
{tree.map((section) => {
|
|
38
|
+
const showBadge = (status?: string) => status && status !== 'ga' && !section.sharedStatus;
|
|
39
|
+
const branchId = `branch-${section.id}`;
|
|
40
|
+
return (
|
|
41
|
+
<li class="sidebar-section">
|
|
42
|
+
<button class="sidebar-section-toggle" type="button" aria-expanded="true" aria-controls={branchId} data-branch-toggle>
|
|
43
|
+
<span class="sidebar-section-title">{section.title}</span>
|
|
44
|
+
{section.sharedStatus && section.sharedStatus !== 'ga' && <StatusBadge status={section.sharedStatus} link={false} />}
|
|
45
|
+
<ChevronRight size={16} class="sidebar-chevron" />
|
|
46
|
+
</button>
|
|
47
|
+
<div class="sidebar-branch" id={branchId}>
|
|
48
|
+
{section.groups.map((group) => (
|
|
49
|
+
<div class="sidebar-group">
|
|
50
|
+
{group.label && <p class="sidebar-label">{group.label}</p>}
|
|
51
|
+
<ul>
|
|
52
|
+
{group.items.map((item) => {
|
|
53
|
+
if (!item.children) {
|
|
54
|
+
return (
|
|
55
|
+
<li>
|
|
56
|
+
<a href={L(item.href)} class="sidebar-item" aria-current={current(item.href)}>
|
|
57
|
+
<span>{item.title}</span>
|
|
58
|
+
{showBadge(item.status) && <StatusBadge status={item.status!} link={false} />}
|
|
59
|
+
</a>
|
|
60
|
+
</li>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
const hasCurrent = item.children.some((child) => isCurrent(child.href, path));
|
|
64
|
+
const subId = `sub-${slug(item.href)}`;
|
|
65
|
+
return (
|
|
66
|
+
<li>
|
|
67
|
+
<a href={L(item.children[0].href)} class="sidebar-item has-children" aria-expanded={hasCurrent ? 'true' : 'false'} aria-controls={subId} data-branch-toggle data-has-current={hasCurrent ? '' : undefined}>
|
|
68
|
+
<span>{item.title}</span>
|
|
69
|
+
{showBadge(item.status) && <StatusBadge status={item.status!} link={false} />}
|
|
70
|
+
<ChevronRight size={16} class="sidebar-chevron" />
|
|
71
|
+
</a>
|
|
72
|
+
<ul class="sidebar-children" id={subId} hidden={!hasCurrent}>
|
|
73
|
+
{item.children.map((child) => (
|
|
74
|
+
<li>
|
|
75
|
+
<a href={L(child.href)} class="sidebar-child" aria-current={current(child.href)}>
|
|
76
|
+
<span>{child.title}</span>
|
|
77
|
+
{showBadge(child.status) && child.status !== item.status && <StatusBadge status={child.status!} link={false} />}
|
|
78
|
+
</a>
|
|
79
|
+
</li>
|
|
80
|
+
))}
|
|
81
|
+
</ul>
|
|
82
|
+
</li>
|
|
83
|
+
);
|
|
84
|
+
})}
|
|
85
|
+
</ul>
|
|
86
|
+
</div>
|
|
87
|
+
))}
|
|
88
|
+
</div>
|
|
89
|
+
</li>
|
|
90
|
+
);
|
|
91
|
+
})}
|
|
92
|
+
</ul>
|
|
93
|
+
</nav>
|
|
94
|
+
|
|
95
|
+
<script is:inline>
|
|
96
|
+
// Runs before the first paint, so the tree never flashes into a different state.
|
|
97
|
+
// State for this browser tab: { branches: { id: open }, scroll: { href, y } }.
|
|
98
|
+
// Only branches the reader opened or closed are stored; the rest keep their defaults
|
|
99
|
+
// (sections open, folders closed unless they hold the current page).
|
|
100
|
+
(() => {
|
|
101
|
+
const nav = document.getElementById('docs-sidebar');
|
|
102
|
+
if (!nav) return;
|
|
103
|
+
const KEY = 'bh-sidebar';
|
|
104
|
+
let state = {};
|
|
105
|
+
try {
|
|
106
|
+
state = JSON.parse(sessionStorage.getItem(KEY) || '{}') || {};
|
|
107
|
+
} catch {}
|
|
108
|
+
if (typeof state.branches !== 'object' || !state.branches) state.branches = {};
|
|
109
|
+
const save = () => {
|
|
110
|
+
try {
|
|
111
|
+
sessionStorage.setItem(KEY, JSON.stringify(state));
|
|
112
|
+
} catch {}
|
|
113
|
+
};
|
|
114
|
+
const toggleFor = (id) => nav.querySelector('[data-branch-toggle][aria-controls="' + id + '"]');
|
|
115
|
+
const setOpen = (id, open) => {
|
|
116
|
+
const branch = document.getElementById(id);
|
|
117
|
+
const toggle = toggleFor(id);
|
|
118
|
+
if (!branch || !toggle) return;
|
|
119
|
+
branch.hidden = !open;
|
|
120
|
+
toggle.setAttribute('aria-expanded', String(open));
|
|
121
|
+
};
|
|
122
|
+
// Open and close with a short slide (height, margins and fade), unless the reader asked
|
|
123
|
+
// for reduced motion. A new click during the slide reverses it from where it is.
|
|
124
|
+
const still = matchMedia('(prefers-reduced-motion: reduce)');
|
|
125
|
+
const slide = (id, open) => {
|
|
126
|
+
const branch = document.getElementById(id);
|
|
127
|
+
const toggle = toggleFor(id);
|
|
128
|
+
if (!branch || !toggle) return;
|
|
129
|
+
toggle.setAttribute('aria-expanded', String(open));
|
|
130
|
+
if (still.matches || !branch.animate) {
|
|
131
|
+
branch.hidden = !open;
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const from = branch.hidden ? 0 : branch.getBoundingClientRect().height;
|
|
135
|
+
branch.getAnimations().forEach((a) => a.cancel());
|
|
136
|
+
branch.hidden = false;
|
|
137
|
+
const cs = getComputedStyle(branch);
|
|
138
|
+
const full = { height: branch.scrollHeight + 'px', marginTop: cs.marginTop, marginBottom: cs.marginBottom, opacity: 1 };
|
|
139
|
+
const none = { height: '0px', marginTop: '0px', marginBottom: '0px', opacity: 0 };
|
|
140
|
+
const start = from && from !== branch.scrollHeight ? { ...(open ? none : full), height: from + 'px' } : open ? none : full;
|
|
141
|
+
const anim = branch.animate([start, open ? full : none], { duration: open ? 220 : 180, easing: 'cubic-bezier(0.2, 0, 0, 1)' });
|
|
142
|
+
branch.style.overflow = 'hidden';
|
|
143
|
+
anim.onfinish = () => {
|
|
144
|
+
branch.style.overflow = '';
|
|
145
|
+
if (toggle.getAttribute('aria-expanded') !== 'true') branch.hidden = true;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const returning = Object.keys(state.branches).length > 0 || 'scroll' in state;
|
|
150
|
+
for (const [id, open] of Object.entries(state.branches)) setOpen(id, Boolean(open));
|
|
151
|
+
|
|
152
|
+
// The branches that hold the current page always open, so the reader sees where they are.
|
|
153
|
+
const here = nav.querySelector('[aria-current="page"]');
|
|
154
|
+
const reveal = [];
|
|
155
|
+
for (let el = here?.parentElement; el && el !== nav; el = el.parentElement) {
|
|
156
|
+
if (el.matches('.sidebar-branch, .sidebar-children') && el.id) {
|
|
157
|
+
// Remember it as opened, so it stays open after the reader moves on. If it was closed
|
|
158
|
+
// on the previous page, draw it closed and slide it open after the first paint.
|
|
159
|
+
const wasOpen = el.matches('.sidebar-branch') ? state.branches[el.id] !== false : state.branches[el.id] === true;
|
|
160
|
+
if (returning && !wasOpen) {
|
|
161
|
+
setOpen(el.id, false);
|
|
162
|
+
reveal.push(el.id);
|
|
163
|
+
} else setOpen(el.id, true);
|
|
164
|
+
state.branches[el.id] = true;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Coming from a sidebar link: keep the clicked link at the same height as before.
|
|
169
|
+
// Otherwise bring the current page into view if it is below the fold.
|
|
170
|
+
const scroll = state.scroll;
|
|
171
|
+
delete state.scroll;
|
|
172
|
+
save();
|
|
173
|
+
const link = scroll && scroll.href === location.pathname ? nav.querySelector('a[href="' + scroll.href + '"]') : null;
|
|
174
|
+
if (link) nav.scrollTop = link.offsetTop - scroll.y;
|
|
175
|
+
else if (here && here.offsetTop + here.offsetHeight > nav.clientHeight - 24) nav.scrollTop = here.offsetTop - nav.clientHeight / 3;
|
|
176
|
+
|
|
177
|
+
if (reveal.length) requestAnimationFrame(() => requestAnimationFrame(() => reveal.forEach((id) => slide(id, true))));
|
|
178
|
+
|
|
179
|
+
nav.querySelectorAll('[data-branch-toggle]').forEach((button) =>
|
|
180
|
+
button.addEventListener('click', (event) => {
|
|
181
|
+
// A folder row is a real link to its first page, so Ctrl/Cmd/Shift-click, middle-click
|
|
182
|
+
// and the right-click menu open it in a new tab or window as usual.
|
|
183
|
+
if (event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;
|
|
184
|
+
const id = button.getAttribute('aria-controls');
|
|
185
|
+
const open = button.getAttribute('aria-expanded') !== 'true';
|
|
186
|
+
state.branches[id] = open;
|
|
187
|
+
// Opening a folder goes straight to its first page (the link does it, at once), unless
|
|
188
|
+
// the reader is already in it. The next page draws the folder already open.
|
|
189
|
+
if (open && button.hasAttribute('href') && !button.hasAttribute('data-has-current')) {
|
|
190
|
+
save();
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
event.preventDefault();
|
|
194
|
+
save();
|
|
195
|
+
slide(id, open);
|
|
196
|
+
}),
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
nav.addEventListener('click', (event) => {
|
|
200
|
+
const a = event.target.closest('a[href]');
|
|
201
|
+
if (event.defaultPrevented || !a || a.origin !== location.origin) return;
|
|
202
|
+
state.scroll = { href: a.pathname, y: a.offsetTop - nav.scrollTop };
|
|
203
|
+
save();
|
|
204
|
+
});
|
|
205
|
+
})();
|
|
206
|
+
</script>
|