@repobit/dex-system-design 0.25.11 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +195 -0
- package/README.md +131 -8
- package/package.json +95 -13
- package/schemas/component-manifest.json +3294 -405
- package/schemas/manifest-omissions.json +173 -0
- package/src/blog/src/breakpoints.js +6 -6
- package/src/blog/src/content/blog-atoms-showcase.js +1 -1
- package/src/blog/src/content/blog-page-layout.js +2 -2
- package/src/blog/src/lib/article-toc.js +7 -7
- package/src/blog/src/shell/blog-shell.js +1 -1
- package/src/blog/src/tokens/blog.js +2 -2
- package/src/blog/src/tokens/core.js +34 -35
- package/src/blog/src/tokens/legacy.js +0 -9
- package/src/blog/tokens/blog.js +2 -2
- package/src/blog/tokens/core.js +34 -35
- package/src/blog/tokens/legacy.js +0 -9
- package/src/blog/tokens.css +36 -46
- package/src/components/accordion/accordion-bg.css.js +83 -59
- package/src/components/accordion/accordion-bg.js +29 -10
- package/src/components/accordion/accordion-bg.stories.js +67 -67
- package/src/components/accordion/accordion-keyboard.js +80 -0
- package/src/components/accordion/accordion.css.js +142 -80
- package/src/components/accordion/accordion.js +37 -10
- package/src/components/accordion/accordion.stories.js +7 -7
- package/src/components/agent-endpoints/agent-endpoints.css.js +36 -39
- package/src/components/agent-endpoints/agent-endpoints.js +30 -20
- package/src/components/agent-endpoints/agent-endpoints.stories.js +1 -1
- package/src/components/ai-guardian-demo.stories.js +91 -91
- package/src/components/alert/alert.css.js +198 -0
- package/src/components/alert/alert.js +103 -0
- package/src/components/alert/alert.stories.js +206 -0
- package/src/components/anchor/anchor-nav.css.js +213 -101
- package/src/components/anchor/anchor-nav.js +26 -40
- package/src/components/anchor/anchor.stories.js +22 -12
- package/src/components/annotation/annotation.css.js +58 -0
- package/src/components/annotation/annotation.js +67 -0
- package/src/components/annotation/annotation.stories.js +63 -0
- package/src/components/architecture.stories.js +285 -0
- package/src/components/atoms.stories.js +342 -0
- package/src/components/avatar/avatar.css.js +67 -0
- package/src/components/avatar/avatar.js +42 -0
- package/src/components/avatar/avatar.stories.js +95 -0
- package/src/components/awards/awards-flex.css.js +209 -23
- package/src/components/awards/awards-flex.js +66 -7
- package/src/components/awards/awards-flex.stories.js +1 -1
- package/src/components/awards/{awards-light.stories.js → awards-summary.stories.js} +54 -64
- package/src/components/awards/awards.css.js +116 -58
- package/src/components/awards/awards.js +102 -28
- package/src/components/awards/awards.stories.js +1 -1
- package/src/components/back/back.css.js +51 -22
- package/src/components/back/back.js +28 -7
- package/src/components/back/back.stories.js +9 -3
- package/src/components/badge/badge.css.js +158 -46
- package/src/components/badge/badge.js +62 -74
- package/src/components/badge/badge.stories.js +176 -248
- package/src/components/bento-grid/bento-grid.css.js +21 -16
- package/src/components/bento-grid/bento-grid.js +16 -4
- package/src/components/bento-grid/bento-grid.stories.js +19 -18
- package/src/components/bento-grid/bento-item.css.js +52 -28
- package/src/components/bento-grid/bento-item.js +2 -2
- package/src/components/blockquote/blockquote.css.js +47 -0
- package/src/components/blockquote/blockquote.js +29 -0
- package/src/components/blockquote/blockquote.stories.js +62 -0
- package/src/components/breadcrumb/breadcrumb.css.js +92 -22
- package/src/components/breadcrumb/breadcrumb.js +56 -11
- package/src/components/button/button.css.js +531 -161
- package/src/components/button/button.js +206 -214
- package/src/components/button/button.stories.js +322 -174
- package/src/components/caption/caption.css.js +21 -0
- package/src/components/caption/caption.js +31 -0
- package/src/components/caption/caption.stories.js +62 -0
- package/src/components/card-features/card-features.css.js +14 -22
- package/src/components/card-features/card-features.js +68 -9
- package/src/components/card-features/card-features.stories.js +11 -11
- package/src/components/cards/card.css.js +60 -81
- package/src/components/cards/card.js +56 -25
- package/src/components/cards/card.stories.js +39 -39
- package/src/components/carousel/carousel.css.js +93 -99
- package/src/components/carousel/carousel.js +32 -4
- package/src/components/checkbox/checkbox.css.js +111 -93
- package/src/components/checkbox/checkbox.js +64 -90
- package/src/components/checkbox/checkbox.stories.js +96 -29
- package/src/components/code/code.css.js +70 -0
- package/src/components/code/code.js +40 -0
- package/src/components/code/code.stories.js +73 -0
- package/src/components/compare/compare.css.js +179 -43
- package/src/components/compare/compare.js +52 -25
- package/src/components/compare/compare.stories.js +61 -4
- package/src/components/comparison-panel/comparison-panel.css.js +38 -51
- package/src/components/comparison-panel/comparison-panel.js +5 -4
- package/src/components/comparison-panel/comparison-panel.stories.js +1 -1
- package/src/components/compatibility-table/compatibility-table.css.js +180 -80
- package/src/components/compatibility-table/compatibility-table.js +37 -9
- package/src/components/control-alignment.stories.js +393 -0
- package/src/components/cta-banner/cta-banner.css.js +41 -13
- package/src/components/cta-banner/cta-banner.js +6 -5
- package/src/components/cta-banner/cta-banner.stories.js +43 -98
- package/src/components/display/display.css.js +25 -1
- package/src/components/display/display.js +46 -13
- package/src/components/display/display.stories.js +270 -40
- package/src/components/divider/divider-horizontal.js +21 -5
- package/src/components/divider/divider-vertical.js +15 -7
- package/src/components/divider/divider.css.js +2 -2
- package/src/components/divider/divider.stories.js +38 -34
- package/src/components/dropdown/dropdown.css.js +93 -126
- package/src/components/dropdown/dropdown.js +114 -34
- package/src/components/dropdown/dropdown.stories.js +56 -24
- package/src/components/features/features.css.js +24 -11
- package/src/components/features/features.js +7 -3
- package/src/components/features/features.stories.js +37 -37
- package/src/components/features-tab/features-tab.css.js +19 -8
- package/src/components/features-tab/features-tab.js +6 -5
- package/src/components/features-tab/features-tab.stories.js +23 -23
- package/src/components/fieldset/fieldset.css.js +30 -0
- package/src/components/fieldset/fieldset.js +28 -0
- package/src/components/fieldset/fieldset.stories.js +84 -0
- package/src/components/footer/footer-links-group.css.js +10 -14
- package/src/components/footer/footer-links-group.js +4 -3
- package/src/components/footer/footer-lp.css.js +59 -30
- package/src/components/footer/footer-lp.js +17 -12
- package/src/components/footer/footer-lp.stories.js +63 -75
- package/src/components/footer/footer-nav-menu.css.js +26 -4
- package/src/components/footer/footer-nav-menu.js +3 -2
- package/src/components/footer/footer.css.js +146 -264
- package/src/components/footer/footer.js +176 -106
- package/src/components/footer/footer.stories.js +9 -9
- package/src/components/footer/localeMap.js +1 -1
- package/src/components/grid/grid.css.js +1 -1
- package/src/components/grid/grid.js +49 -7
- package/src/components/grid/grid.stories.js +111 -0
- package/src/components/header/header-code.css.js +61 -51
- package/src/components/header/header-code.js +28 -14
- package/src/components/header/header-code.stories.js +5 -5
- package/src/components/header/header.css.js +655 -176
- package/src/components/header/header.js +269 -36
- package/src/components/header/header.stories.js +841 -18
- package/src/components/heading/heading.css.js +14 -17
- package/src/components/heading/heading.js +48 -33
- package/src/components/heading/heading.stories.js +27 -25
- package/src/components/help-text/help-text.css.js +21 -0
- package/src/components/help-text/help-text.js +25 -0
- package/src/components/help-text/help-text.stories.js +66 -0
- package/src/components/highlight/highlight.css.js +86 -64
- package/src/components/highlight/highlight.js +18 -27
- package/src/components/highlight/highlight.stories.js +14 -3
- package/src/components/icons/analysis-icon.js +6 -16
- package/src/components/icons/arrow-down-icon.js +6 -19
- package/src/components/icons/arrow-icon.js +44 -0
- package/src/components/icons/arrow-right-icon.js +30 -23
- package/src/components/icons/arrow-up-icon.js +19 -18
- package/src/components/icons/bd-ai-icon.js +1 -1
- package/src/components/icons/brand-marks.stories.js +279 -0
- package/src/components/icons/brand-signature-icon.js +42 -0
- package/src/components/icons/check-icon.js +27 -0
- package/src/components/icons/circle-info-icon.js +33 -0
- package/src/components/icons/close-icon.js +6 -18
- package/src/components/icons/family-icon.js +8 -20
- package/src/components/icons/globe-icon.js +6 -18
- package/src/components/icons/guide-icon.js +6 -18
- package/src/components/icons/icon-element.js +99 -0
- package/src/components/icons/icons.js +36 -0
- package/src/components/icons/icons.stories.js +184 -52
- package/src/components/icons/individual-icon.js +6 -18
- package/src/components/icons/laurel-icon.js +9 -19
- package/src/components/icons/machine-learning-icon.js +6 -17
- package/src/components/icons/marks.js +41 -0
- package/src/components/icons/minus-icon.js +7 -21
- package/src/components/icons/missing-icon.js +52 -0
- package/src/components/icons/plus-icon.js +7 -21
- package/src/components/icons/quote-icon.js +19 -19
- package/src/components/image/image.css.js +72 -25
- package/src/components/image/image.js +11 -6
- package/src/components/image/image.stories.js +2 -2
- package/src/components/input/custom-form.stories.js +214 -62
- package/src/components/input/input-clipboard.css.js +51 -144
- package/src/components/input/input-clipboard.js +31 -15
- package/src/components/input/input.css.js +8 -146
- package/src/components/input/input.js +93 -38
- package/src/components/install-options/install-options.css.js +84 -77
- package/src/components/install-options/install-options.js +33 -30
- package/src/components/install-options/install-options.stories.js +3 -3
- package/src/components/label/label.css.js +35 -0
- package/src/components/label/label.js +38 -0
- package/src/components/label/label.stories.js +82 -0
- package/src/components/light-carousel/light-carousel.css.js +111 -63
- package/src/components/light-carousel/light-carousel.js +85 -11
- package/src/components/light-carousel/light-carousel.stories.js +126 -82
- package/src/components/link/link.css.js +150 -99
- package/src/components/link/link.js +86 -11
- package/src/components/link/link.stories.js +124 -30
- package/src/components/list/list-item/list-item.css.js +74 -22
- package/src/components/list/list-item/list-item.js +32 -10
- package/src/components/list/list-item/list-item.stories.js +23 -23
- package/src/components/list/list.css.js +8 -2
- package/src/components/list/list.js +3 -2
- package/src/components/list/list.stories.js +222 -0
- package/src/components/modal/modal.css.js +114 -24
- package/src/components/modal/modal.js +83 -7
- package/src/components/modal/modal.stories.js +9 -9
- package/src/components/overview/overview.css.js +19 -14
- package/src/components/overview/overview.js +6 -5
- package/src/components/overview/overview.stories.js +10 -10
- package/src/components/page-switcher/page-switcher.css.js +97 -40
- package/src/components/page-switcher/page-switcher.js +28 -5
- package/src/components/page-switcher/page-switcher.stories.js +95 -0
- package/src/components/paragraph/paragraph.css.js +15 -10
- package/src/components/paragraph/paragraph.js +41 -44
- package/src/components/paragraph/paragraph.stories.js +56 -21
- package/src/components/picture/picture.css.js +103 -44
- package/src/components/picture/picture.js +100 -30
- package/src/components/picture/picture.stories.js +1 -1
- package/src/components/pricing-cards/new-pricing-card.js +3 -3
- package/src/components/pricing-cards/new-pricing.css.js +24 -15
- package/src/components/pricing-cards/pricing-card-actions.css.js +1 -1
- package/src/components/pricing-cards/pricing-card-actions.js +3 -4
- package/src/components/pricing-cards/pricing-card-container.css.js +3 -3
- package/src/components/pricing-cards/pricing-card-container.js +3 -2
- package/src/components/pricing-cards/pricing-card-header.css.js +10 -8
- package/src/components/pricing-cards/pricing-card-header.js +6 -7
- package/src/components/pricing-cards/pricing-card-pricing.css.js +16 -9
- package/src/components/pricing-cards/pricing-card-pricing.js +8 -6
- package/src/components/pricing-cards/pricing-card-show-more.css.js +11 -3
- package/src/components/pricing-cards/pricing-card-show-more.js +8 -3
- package/src/components/pricing-cards/pricing-card.css.js +244 -190
- package/src/components/pricing-cards/pricing-card.js +54 -70
- package/src/components/pricing-cards/pricing-feature-item.css.js +25 -8
- package/src/components/pricing-cards/pricing-feature-item.js +8 -3
- package/src/components/process-steps/process-steps.css.js +26 -14
- package/src/components/process-steps/process-steps.js +23 -6
- package/src/components/process-steps/process-steps.stories.js +1 -1
- package/src/components/progress/progress.css.js +80 -0
- package/src/components/progress/progress.js +42 -0
- package/src/components/progress/progress.stories.js +79 -0
- package/src/components/quick-answer/quick-answer.css.js +75 -13
- package/src/components/quick-answer/quick-answer.js +8 -3
- package/src/components/radio/radio.css.js +92 -128
- package/src/components/radio/radio.js +106 -127
- package/src/components/radio/radio.stories.js +54 -19
- package/src/components/review/review-grid.css.js +5 -6
- package/src/components/review/review-grid.js +14 -11
- package/src/components/review/review.css.js +11 -6
- package/src/components/review/review.js +3 -8
- package/src/components/shared/ensemble.css.js +93 -0
- package/src/components/shared/form-field.css.js +206 -0
- package/src/components/shared/prop-vocabulary.js +48 -0
- package/src/components/shared/token-scales.js +306 -0
- package/src/components/skeleton/skeleton.css.js +34 -0
- package/src/components/skeleton/skeleton.js +32 -0
- package/src/components/skeleton/skeleton.stories.js +70 -0
- package/src/components/spinner/spinner.css.js +62 -0
- package/src/components/spinner/spinner.js +38 -0
- package/src/components/spinner/spinner.stories.js +92 -0
- package/src/components/spotlight-section/spotlight-section.css.js +14 -13
- package/src/components/spotlight-section/spotlight-section.js +42 -39
- package/src/components/switch/switch.css.js +103 -0
- package/src/components/switch/switch.js +44 -0
- package/src/components/switch/switch.stories.js +86 -0
- package/src/components/tab-list/content-switcher.stories.js +189 -0
- package/src/components/tab-list/tab-list.css.js +250 -0
- package/src/components/tab-list/tab-list.js +184 -0
- package/src/components/tab-list/tab-list.stories.js +221 -0
- package/src/components/tabs/tabs.css.js +14 -123
- package/src/components/tabs/tabs.js +16 -19
- package/src/components/tabs/tabs.stories.js +95 -95
- package/src/components/tag/tag.css.js +54 -0
- package/src/components/tag/tag.js +32 -0
- package/src/components/tag/tag.stories.js +126 -0
- package/src/components/terminal/terminal-message.css.js +164 -60
- package/src/components/terminal/terminal-message.js +5 -5
- package/src/components/terminal/terminal-message.stories.js +70 -1
- package/src/components/termsOfUse/terms.css.js +25 -20
- package/src/components/termsOfUse/terms.js +13 -9
- package/src/components/termsOfUse/terms.stories.js +1 -1
- package/src/components/textarea/textarea.css.js +51 -0
- package/src/components/textarea/textarea.js +136 -0
- package/src/components/textarea/textarea.stories.js +191 -0
- package/src/components/tooltip/tooltip.css.js +75 -0
- package/src/components/tooltip/tooltip.js +156 -0
- package/src/components/tooltip/tooltip.stories.js +161 -0
- package/src/components/trust-panel/trust-panel.css.js +85 -33
- package/src/components/trust-panel/trust-panel.js +18 -10
- package/src/components/trust-panel/trust-panel.stories.js +1 -1
- package/src/components/ultimate-security-demo.stories.js +431 -0
- package/src/components/video/video.css.js +17 -0
- package/src/components/video/video.js +40 -0
- package/src/components/video/video.stories.js +106 -0
- package/src/components/video-player/video-player.css.js +67 -11
- package/src/components/video-player/video-player.js +35 -4
- package/src/components/video-player/video-player.stories.js +1 -1
- package/src/components/visual-alignment.stories.js +411 -0
- package/src/components/visually-hidden/visually-hidden.css.js +24 -0
- package/src/components/visually-hidden/visually-hidden.js +16 -0
- package/src/components/visually-hidden/visually-hidden.stories.js +56 -0
- package/src/stories/Button.stories.js +17 -17
- package/src/stories/Header.stories.js +10 -10
- package/src/stories/Page.js +1 -1
- package/src/stories/Page.stories.js +6 -6
- package/src/tokens/borders.stories.js +339 -0
- package/src/tokens/color-responsibilities.stories.js +227 -0
- package/src/tokens/dark-derivation.js +309 -0
- package/src/tokens/dark-findings.js +197 -0
- package/src/tokens/dark-mode.stories.js +207 -0
- package/src/tokens/dimension.stories.js +251 -0
- package/src/tokens/elevation.stories.js +143 -0
- package/src/tokens/focus.stories.js +276 -0
- package/src/tokens/fonts.css +20 -20
- package/src/tokens/fonts.stories.js +354 -374
- package/src/tokens/layout.css +25 -11
- package/src/tokens/motion.stories.js +231 -0
- package/src/tokens/shape.stories.js +272 -0
- package/src/tokens/spacing-rhythm.stories.js +359 -0
- package/src/tokens/spacing.stories.js +208 -703
- package/src/tokens/story-chrome.js +503 -0
- package/src/tokens/surfaces.stories.js +224 -0
- package/src/tokens/text-on-surface.stories.js +164 -0
- package/src/tokens/token-map.js +220 -0
- package/src/tokens/token-map.stories.js +257 -0
- package/src/tokens/token-purposes.js +266 -0
- package/src/tokens/tokens-grid.stories.js +388 -900
- package/src/tokens/tokens.css +1633 -1045
- package/src/tokens/tokens.js +1130 -492
- package/src/tokens/tokens.stories.js +137 -47
- package/src/tokens/type-ceiling-words.js +299 -0
- package/src/tokens/typography.stories.js +1003 -965
- package/src/tokens/vertical-rhythm.stories.js +224 -0
- package/src/components/awards/awards-icon.js +0 -56
- package/src/components/awards/awards-light.js +0 -240
- package/src/components/banner/banner.js +0 -60
- package/src/components/banner/banner.stories.js +0 -51
- package/src/components/button/icons.js +0 -24
- package/src/components/input/index.js +0 -0
- package/src/components/light-carousel/light-carousel-simple.css.js +0 -183
- package/src/components/light-carousel/light-carousel-simple.js +0 -74
- package/src/tokens/colors.js +0 -121
- package/src/tokens/typography.css.js +0 -207
- package/src/tokens/typography.js +0 -0
|
@@ -2,29 +2,57 @@ import { html } from 'lit';
|
|
|
2
2
|
import './checkbox.js';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
title : '
|
|
5
|
+
title : 'Atoms/Checkbox',
|
|
6
6
|
tags : ['autodocs'],
|
|
7
7
|
parameters: {
|
|
8
8
|
docs: {
|
|
9
9
|
description: {
|
|
10
10
|
component: `
|
|
11
|
-
**BdCheckbox** is a
|
|
11
|
+
**BdCheckbox** is a three-state checkbox: unchecked, checked and
|
|
12
|
+
indeterminate.
|
|
12
13
|
|
|
13
14
|
### Usage
|
|
14
15
|
\`\`\`html
|
|
15
|
-
<bd-checkbox label="Accept terms"
|
|
16
|
-
<bd-checkbox label="Disabled" disabled></bd-checkbox>
|
|
16
|
+
<bd-checkbox label="Accept terms"></bd-checkbox>
|
|
17
17
|
<bd-checkbox label="Pre-checked" checked></bd-checkbox>
|
|
18
|
+
<bd-checkbox label="Select all" indeterminate></bd-checkbox>
|
|
19
|
+
<bd-checkbox label="Unavailable" disabled></bd-checkbox>
|
|
20
|
+
|
|
21
|
+
<!-- the label is slotted, so it can carry markup -->
|
|
22
|
+
<bd-checkbox>I agree to the <a href="/terms">Terms of Use</a></bd-checkbox>
|
|
18
23
|
\`\`\`
|
|
19
24
|
|
|
25
|
+
### States
|
|
26
|
+
| State | |
|
|
27
|
+
|---|---|
|
|
28
|
+
| \`checked\` | Draws a tick. |
|
|
29
|
+
| \`indeterminate\` | Draws a dash and announces \`aria-checked="mixed"\`. Takes precedence over \`checked\`, and clicking it resolves to checked, as a native checkbox does. |
|
|
30
|
+
| \`disabled\` | Greys the box and the label, and drops the row out of the tab order. Exempt from contrast under WCAG 1.4.3. |
|
|
31
|
+
|
|
32
|
+
Both marks are drawn in \`currentColor\` with flat caps and a mitred join, so
|
|
33
|
+
they read sharp against the square corners of the box.
|
|
34
|
+
|
|
20
35
|
### Accessibility
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- \`
|
|
36
|
+
- The **whole row is the control**, not just the box. Clicking the label
|
|
37
|
+
toggles, and the target measures 25px tall against the 24px WCAG 2.5.8 asks
|
|
38
|
+
for — a 20px box on its own cannot reach it.
|
|
39
|
+
- \`role="checkbox"\` with \`aria-checked\` reporting \`true\`, \`false\` or
|
|
40
|
+
\`mixed\`, plus \`aria-disabled\`.
|
|
41
|
+
- Space toggles. Enter also toggles as a convenience: this control is not
|
|
42
|
+
form-associated, so Enter has nothing else to do here.
|
|
43
|
+
- The focus ring appears on keyboard navigation only, via \`:focus-visible\`,
|
|
44
|
+
and is inset evenly on all four sides.
|
|
45
|
+
- \`tabindex="-1"\` when disabled.
|
|
46
|
+
|
|
47
|
+
### Not form-associated
|
|
48
|
+
\`name\` and \`value\` are carried on the \`change\` event, but this element does
|
|
49
|
+
**not** participate in form submission — a \`<form>\` containing it yields no
|
|
50
|
+
\`FormData\` entry, because there is no native input behind it. Read the state
|
|
51
|
+
from the event or the \`checked\` property instead.
|
|
25
52
|
|
|
26
53
|
### Events
|
|
27
|
-
- \`change\` —
|
|
54
|
+
- \`change\` — \`detail: { checked, value }\`, where \`value\` is the \`value\` prop
|
|
55
|
+
when checked and \`null\` when not.
|
|
28
56
|
`
|
|
29
57
|
}
|
|
30
58
|
}
|
|
@@ -32,28 +60,33 @@ export default {
|
|
|
32
60
|
argTypes: {
|
|
33
61
|
label: {
|
|
34
62
|
control : 'text',
|
|
35
|
-
description: '
|
|
36
|
-
table : { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Content' }
|
|
37
|
-
},
|
|
38
|
-
name: {
|
|
39
|
-
control : 'text',
|
|
40
|
-
description: 'Form field name',
|
|
41
|
-
table : { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Form' }
|
|
42
|
-
},
|
|
43
|
-
value: {
|
|
44
|
-
control : 'text',
|
|
45
|
-
description: 'Value emitted in the `change` event detail when checked',
|
|
46
|
-
table : { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Form' }
|
|
63
|
+
description: 'Label text. Fallback for the default slot, so slotted content wins over it.',
|
|
64
|
+
table : { type: { summary: 'string' }, defaultValue: { summary: "''" }, category: 'Content' }
|
|
47
65
|
},
|
|
48
66
|
checked: {
|
|
49
67
|
control : 'boolean',
|
|
50
|
-
description: '
|
|
68
|
+
description: 'Draws a tick. Ignored while `indeterminate` is set.',
|
|
69
|
+
table : { type: { summary: 'boolean' }, defaultValue: { summary: 'false' }, category: 'State' }
|
|
70
|
+
},
|
|
71
|
+
indeterminate: {
|
|
72
|
+
control : 'boolean',
|
|
73
|
+
description: 'The mixed state. Draws a dash, announces `aria-checked="mixed"`, and takes precedence over `checked`.',
|
|
51
74
|
table : { type: { summary: 'boolean' }, defaultValue: { summary: 'false' }, category: 'State' }
|
|
52
75
|
},
|
|
53
76
|
disabled: {
|
|
54
77
|
control : 'boolean',
|
|
55
|
-
description: '
|
|
78
|
+
description: 'Blocks interaction, greys the box and label, and sets `tabindex="-1"`.',
|
|
56
79
|
table : { type: { summary: 'boolean' }, defaultValue: { summary: 'false' }, category: 'State' }
|
|
80
|
+
},
|
|
81
|
+
name: {
|
|
82
|
+
control : 'text',
|
|
83
|
+
description: 'Carried on the `change` event only — this element does not participate in form submission.',
|
|
84
|
+
table : { type: { summary: 'string' }, defaultValue: { summary: "''" }, category: 'Data' }
|
|
85
|
+
},
|
|
86
|
+
value: {
|
|
87
|
+
control : 'text',
|
|
88
|
+
description: 'Emitted in the `change` event detail when checked, `null` when not.',
|
|
89
|
+
table : { type: { summary: 'string' }, defaultValue: { summary: "''" }, category: 'Data' }
|
|
57
90
|
}
|
|
58
91
|
}
|
|
59
92
|
};
|
|
@@ -64,11 +97,19 @@ const render = (args) => html`
|
|
|
64
97
|
name="${args.name}"
|
|
65
98
|
value="${args.value}"
|
|
66
99
|
?checked="${args.checked}"
|
|
100
|
+
?indeterminate="${args.indeterminate}"
|
|
67
101
|
?disabled="${args.disabled}"
|
|
68
102
|
></bd-checkbox>
|
|
69
103
|
`;
|
|
70
104
|
|
|
71
|
-
const defaultArgs = {
|
|
105
|
+
const defaultArgs = {
|
|
106
|
+
label : 'Accept terms and conditions',
|
|
107
|
+
name : 'terms',
|
|
108
|
+
value : 'accepted',
|
|
109
|
+
checked : false,
|
|
110
|
+
indeterminate: false,
|
|
111
|
+
disabled : false
|
|
112
|
+
};
|
|
72
113
|
|
|
73
114
|
// ─── Stories ───────────────────────────────────────────────────────────────
|
|
74
115
|
|
|
@@ -106,13 +147,39 @@ export const AllStates = {
|
|
|
106
147
|
name : 'All States',
|
|
107
148
|
render: () => html`
|
|
108
149
|
<div style="display:flex; flex-direction:column; gap:12px;">
|
|
109
|
-
<bd-checkbox label="Unchecked"
|
|
110
|
-
<bd-checkbox label="Checked"
|
|
111
|
-
<bd-checkbox label="
|
|
112
|
-
<bd-checkbox label="Disabled
|
|
150
|
+
<bd-checkbox label="Unchecked" name="s1" value="1"></bd-checkbox>
|
|
151
|
+
<bd-checkbox label="Checked" name="s2" value="2" checked></bd-checkbox>
|
|
152
|
+
<bd-checkbox label="Indeterminate" name="s3" value="3" indeterminate></bd-checkbox>
|
|
153
|
+
<bd-checkbox label="Disabled unchecked" name="s4" value="4" disabled></bd-checkbox>
|
|
154
|
+
<bd-checkbox label="Disabled checked" name="s5" value="5" checked disabled></bd-checkbox>
|
|
155
|
+
<bd-checkbox label="Disabled indeterminate" name="s6" value="6" indeterminate disabled></bd-checkbox>
|
|
156
|
+
</div>
|
|
157
|
+
`,
|
|
158
|
+
parameters: { docs: { description: { story: 'Every state: the three check states across enabled and disabled. Checked draws a tick and indeterminate a dash, both in currentColor.' } } }
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const Indeterminate = {
|
|
162
|
+
name : 'Indeterminate',
|
|
163
|
+
render: () => html`
|
|
164
|
+
<div style="display:flex; flex-direction:column; gap:var(--spacing-12);">
|
|
165
|
+
<bd-checkbox label="Select all" indeterminate></bd-checkbox>
|
|
166
|
+
<div style="margin-left:var(--spacing-24); display:flex; flex-direction:column; gap:var(--spacing-12);">
|
|
167
|
+
<bd-checkbox label="First" checked></bd-checkbox>
|
|
168
|
+
<bd-checkbox label="Second"></bd-checkbox>
|
|
169
|
+
</div>
|
|
113
170
|
</div>
|
|
114
171
|
`,
|
|
115
|
-
parameters: { docs: { description: { story: '
|
|
172
|
+
parameters: { docs: { description: { story: 'The mixed state, for a parent over a partially selected group. Announced as `aria-checked="mixed"`, and clicking it resolves to checked the way a native checkbox does.' } } }
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const SlottedLabel = {
|
|
176
|
+
name : 'Slotted label',
|
|
177
|
+
render: () => html`
|
|
178
|
+
<bd-checkbox>
|
|
179
|
+
I agree to the <a href="#" @click=${(e) => e.preventDefault()}>Terms of Use</a>
|
|
180
|
+
</bd-checkbox>
|
|
181
|
+
`,
|
|
182
|
+
parameters: { docs: { description: { story: 'The label accepts markup through the default slot, so a link can sit inside it. The `label` prop still works as the fallback.' } } }
|
|
116
183
|
};
|
|
117
184
|
|
|
118
185
|
export const Group = {
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
/** Styled entirely from design tokens — see npm run lint:tokens. */
|
|
4
|
+
export const codeCSS = css`
|
|
5
|
+
:host { display: inline; }
|
|
6
|
+
|
|
7
|
+
/* Scoped to the inline case: block mode nests a <code> inside the <pre>,
|
|
8
|
+
and an unscoped code selector would give it the inline chrome too. */
|
|
9
|
+
:host(:not([block])) code {
|
|
10
|
+
font-family: var(--typography-code-inline-fontFamily);
|
|
11
|
+
font-size: var(--typography-code-inline-fontSize);
|
|
12
|
+
font-weight: var(--typography-code-inline-fontWeight);
|
|
13
|
+
line-height: var(--typography-code-inline-lineHeight);
|
|
14
|
+
letter-spacing: var(--typography-code-inline-letterSpacing);
|
|
15
|
+
/* an explicit colour, not an inherited one: the background is fixed, so
|
|
16
|
+
inheriting a light foreground from a dark section put white on
|
|
17
|
+
neutral-50 at 1.12:1 */
|
|
18
|
+
color: var(--color-text-primary);
|
|
19
|
+
background: var(--color-surface-subtle);
|
|
20
|
+
padding: 0 var(--spacing-4);
|
|
21
|
+
border-radius: var(--radius-sm);
|
|
22
|
+
/* a token name is one long unbreakable word, so let it break rather than
|
|
23
|
+
overflow a narrow column */
|
|
24
|
+
overflow-wrap: break-word;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:host([block]) { display: block; }
|
|
28
|
+
|
|
29
|
+
:host([block]) pre {
|
|
30
|
+
margin: 0;
|
|
31
|
+
font-family: var(--typography-code-block-fontFamily);
|
|
32
|
+
font-size: var(--typography-code-block-fontSize);
|
|
33
|
+
font-weight: var(--typography-code-block-fontWeight);
|
|
34
|
+
line-height: var(--typography-code-block-lineHeight);
|
|
35
|
+
letter-spacing: var(--typography-code-block-letterSpacing);
|
|
36
|
+
color: var(--color-text-primary);
|
|
37
|
+
background: var(--color-surface-subtle);
|
|
38
|
+
padding: var(--spacing-16);
|
|
39
|
+
/* --radius-xl, not --radius-3xl. 24px was the only use of the top step in
|
|
40
|
+
the whole atom layer — the Radius Census story labelled the row "code
|
|
41
|
+
block, and nothing else" — and because the focus ring is a box-shadow
|
|
42
|
+
that follows the element's own shape, it also made this the only atom
|
|
43
|
+
whose ring was a 24px rounded rectangle where every other one is 4-8px.
|
|
44
|
+
12px still reads softer than a control, which is the point of the
|
|
45
|
+
difference, without being the outlier. */
|
|
46
|
+
border-radius: var(--radius-xl);
|
|
47
|
+
overflow-x: auto;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* the nested <code> carries the semantics only; the <pre> does the styling */
|
|
51
|
+
:host([block]) code {
|
|
52
|
+
font: inherit;
|
|
53
|
+
letter-spacing: inherit;
|
|
54
|
+
color: inherit;
|
|
55
|
+
background: none;
|
|
56
|
+
padding: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* the block is focusable so it can be scrolled from the keyboard, so it
|
|
60
|
+
needs a visible focus indicator of its own */
|
|
61
|
+
:host([block]) pre:focus-visible {
|
|
62
|
+
/* the one focus ring — see Foundations/Focus. A two-colour ring whose
|
|
63
|
+
white inner band keeps it visible on a coloured or dark surface, which a
|
|
64
|
+
single-colour outline cannot do. */
|
|
65
|
+
outline: none;
|
|
66
|
+
box-shadow: var(--focus-outline-primary);
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
export default codeCSS;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { LitElement, html } from 'lit';
|
|
2
|
+
// Installs the design tokens into document scope; see src/tokens/tokens.js
|
|
3
|
+
import '../../tokens/tokens.js';
|
|
4
|
+
import { codeCSS } from './code.css.js';
|
|
5
|
+
|
|
6
|
+
export class BdCode extends LitElement {
|
|
7
|
+
static styles = [codeCSS];
|
|
8
|
+
|
|
9
|
+
static properties = {
|
|
10
|
+
block: { type: Boolean, reflect: true },
|
|
11
|
+
label: { type: String }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
this.block = false;
|
|
17
|
+
this.label = '';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
render() {
|
|
21
|
+
// Block mode nests <code> inside <pre>: <pre> carries the preformatted
|
|
22
|
+
// whitespace, <code> carries "this is code". A bare <pre> is only
|
|
23
|
+
// preformatted text, so assistive tech got no signal it was code at all,
|
|
24
|
+
// even though the inline variant gave one.
|
|
25
|
+
//
|
|
26
|
+
// The <pre> scrolls horizontally, and a scrollable region that cannot be
|
|
27
|
+
// focused cannot be scrolled from the keyboard (WCAG 2.1.1). tabindex
|
|
28
|
+
// makes it reachable; role and label give it something to announce, since
|
|
29
|
+
// a focusable element with no accessible name says nothing.
|
|
30
|
+
return this.block
|
|
31
|
+
? html`<pre
|
|
32
|
+
tabindex="0"
|
|
33
|
+
role="region"
|
|
34
|
+
aria-label="${this.label || 'Code'}"
|
|
35
|
+
><code><slot></slot></code></pre>`
|
|
36
|
+
: html`<code><slot></slot></code>`;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
customElements.define('bd-code', BdCode);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import './code.js';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title : 'Atoms/Code',
|
|
6
|
+
tags : ['autodocs'],
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: `
|
|
11
|
+
**BdCode** renders code, inline in prose or as a block.
|
|
12
|
+
|
|
13
|
+
### Usage
|
|
14
|
+
\`\`\`html
|
|
15
|
+
Use <bd-code>var(--color-blue-500)</bd-code> rather than a hex value.
|
|
16
|
+
|
|
17
|
+
<bd-code block>.button {
|
|
18
|
+
padding: var(--spacing-12) var(--spacing-24);
|
|
19
|
+
}</bd-code>
|
|
20
|
+
|
|
21
|
+
<bd-code block label="Button styles">…</bd-code>
|
|
22
|
+
\`\`\`
|
|
23
|
+
|
|
24
|
+
### Props
|
|
25
|
+
| Prop | Values | Default |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| \`block\` | boolean — renders a \`<pre><code>\` block instead of inline \`<code>\` | \`false\` |
|
|
28
|
+
| \`label\` | accessible name for the scrollable block. Block mode only. | \`Code\` |
|
|
29
|
+
|
|
30
|
+
### Inline versus block
|
|
31
|
+
Inline renders a single \`<code>\` with a tinted background. Block nests
|
|
32
|
+
\`<code>\` inside \`<pre>\` — \`<pre>\` carries the preformatted whitespace and
|
|
33
|
+
\`<code>\` carries "this is code", which is the spec's pairing for a code block.
|
|
34
|
+
|
|
35
|
+
### The block is keyboard-scrollable
|
|
36
|
+
A long line scrolls horizontally, and a scrollable region that cannot be
|
|
37
|
+
focused cannot be scrolled from the keyboard. The block therefore takes
|
|
38
|
+
\`tabindex="0"\` with \`role="region"\` and an accessible name from \`label\`,
|
|
39
|
+
defaulting to "Code", and shows a focus ring when reached by Tab.
|
|
40
|
+
|
|
41
|
+
### Notes
|
|
42
|
+
The inline variant sets its colour explicitly rather than inheriting, so it
|
|
43
|
+
stays legible inside a dark section — an inherited light foreground on the
|
|
44
|
+
fixed tint measured 1.12:1.
|
|
45
|
+
|
|
46
|
+
Long unbroken tokens in inline code wrap rather than overflow a narrow column.
|
|
47
|
+
`
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
argTypes: {
|
|
52
|
+
block: {
|
|
53
|
+
control : 'boolean',
|
|
54
|
+
description: 'Render a pre/code block instead of inline code.',
|
|
55
|
+
table : { type: { summary: 'boolean' }, defaultValue: { summary: "false" }, category: 'Structure' }
|
|
56
|
+
},
|
|
57
|
+
label: {
|
|
58
|
+
control : 'text',
|
|
59
|
+
description: 'Accessible name for the scrollable block, announced on focus. Block mode only.',
|
|
60
|
+
table : { type: { summary: 'string' }, defaultValue: { summary: "Code" }, category: 'Accessibility' }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const Inline = () => html`
|
|
66
|
+
Use <bd-code>var(--color-blue-500)</bd-code> rather than a hex value.
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
export const Block = () => html`
|
|
70
|
+
<bd-code block>.button {
|
|
71
|
+
padding: var(--spacing-12) var(--spacing-20);
|
|
72
|
+
}</bd-code>
|
|
73
|
+
`;
|