@repobit/dex-system-design 0.25.12 → 1.0.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 +204 -0
- package/README.md +131 -8
- package/package.json +96 -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
|
@@ -3,7 +3,7 @@ import './divider-horizontal.js';
|
|
|
3
3
|
import './divider-vertical.js';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
title : '
|
|
6
|
+
title : 'Atoms/Divider',
|
|
7
7
|
tags : ['autodocs'],
|
|
8
8
|
parameters: {
|
|
9
9
|
docs: {
|
|
@@ -16,8 +16,8 @@ Two divider components are available:
|
|
|
16
16
|
|
|
17
17
|
### Usage
|
|
18
18
|
\`\`\`html
|
|
19
|
-
<bd-divider-horizontal width="100%" color="
|
|
20
|
-
<bd-divider-vertical height="
|
|
19
|
+
<bd-divider-horizontal width="100%" color="primary" opacity="0.5"></bd-divider-horizontal>
|
|
20
|
+
<bd-divider-vertical height="24" thickness="2px" color="error" opacity="1"></bd-divider-vertical>
|
|
21
21
|
\`\`\`
|
|
22
22
|
`
|
|
23
23
|
}
|
|
@@ -26,13 +26,14 @@ Two divider components are available:
|
|
|
26
26
|
argTypes: {
|
|
27
27
|
width: {
|
|
28
28
|
control : 'text',
|
|
29
|
-
description: '(Horizontal)
|
|
29
|
+
description: '(Horizontal) Layout length for how far the rule spans, e.g. "100%". This is layout, not a design-token decision.',
|
|
30
30
|
table : { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Horizontal' }
|
|
31
31
|
},
|
|
32
32
|
hColor: {
|
|
33
|
-
control : '
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
control : { type: 'select' },
|
|
34
|
+
options : ['primary', 'strong', 'muted', 'subtle', 'inverse', 'success', 'warning', 'error'],
|
|
35
|
+
description: '(Horizontal) A semantic colour role, not a CSS colour.',
|
|
36
|
+
table : { type: { summary: 'string' }, defaultValue: { summary: 'subtle' }, category: 'Horizontal' }
|
|
36
37
|
},
|
|
37
38
|
hOpacity: {
|
|
38
39
|
control : 'text',
|
|
@@ -40,9 +41,11 @@ Two divider components are available:
|
|
|
40
41
|
table : { type: { summary: 'string' }, defaultValue: { summary: '0.25' }, category: 'Horizontal' }
|
|
41
42
|
},
|
|
42
43
|
height: {
|
|
43
|
-
control
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
control: { type: 'select' },
|
|
45
|
+
options: ['0', '1', '2', '4', '6', '8', '10', '12', '14', '16', '18', '20', '22', '24',
|
|
46
|
+
'28', '32', '36', '40', '44', '48', '52', '56', '64', '80', '96', '112', '128'],
|
|
47
|
+
description: '(Vertical) A spacing step. Resolves to `var(--spacing-N)`.',
|
|
48
|
+
table : { type: { summary: 'string' }, defaultValue: { summary: '16' }, category: 'Vertical' }
|
|
46
49
|
},
|
|
47
50
|
thickness: {
|
|
48
51
|
control : 'text',
|
|
@@ -50,9 +53,10 @@ Two divider components are available:
|
|
|
50
53
|
table : { type: { summary: 'string' }, defaultValue: { summary: '1px' }, category: 'Vertical' }
|
|
51
54
|
},
|
|
52
55
|
vColor: {
|
|
53
|
-
control : '
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
control : { type: 'select' },
|
|
57
|
+
options : ['primary', 'strong', 'muted', 'subtle', 'inverse', 'success', 'warning', 'error'],
|
|
58
|
+
description: '(Vertical) A semantic colour role, not a CSS colour.',
|
|
59
|
+
table : { type: { summary: 'string' }, defaultValue: { summary: 'subtle' }, category: 'Vertical' }
|
|
56
60
|
},
|
|
57
61
|
vOpacity: {
|
|
58
62
|
control : 'text',
|
|
@@ -80,9 +84,9 @@ export const HorizontalCustomColor = {
|
|
|
80
84
|
name : 'Horizontal — Custom Color',
|
|
81
85
|
render: () => html`
|
|
82
86
|
<div style="display:flex; flex-direction:column; gap:16px;">
|
|
83
|
-
<bd-divider-horizontal width="100%" color="
|
|
84
|
-
<bd-divider-horizontal width="100%" color="
|
|
85
|
-
<bd-divider-horizontal width="100%" color="
|
|
87
|
+
<bd-divider-horizontal width="100%" color="primary" opacity="1"></bd-divider-horizontal>
|
|
88
|
+
<bd-divider-horizontal width="100%" color="error" opacity="1"></bd-divider-horizontal>
|
|
89
|
+
<bd-divider-horizontal width="100%" color="inverse" opacity="1" style="background:#333; padding:4px;"></bd-divider-horizontal>
|
|
86
90
|
</div>
|
|
87
91
|
`,
|
|
88
92
|
parameters: { docs: { description: { story: 'Horizontal dividers with custom color values at full opacity.' } } }
|
|
@@ -92,10 +96,10 @@ export const HorizontalOpacities = {
|
|
|
92
96
|
name : 'Horizontal — Opacity Variants',
|
|
93
97
|
render: () => html`
|
|
94
98
|
<div style="display:flex; flex-direction:column; gap:12px;">
|
|
95
|
-
<bd-divider-horizontal width="100%" color="
|
|
96
|
-
<bd-divider-horizontal width="100%" color="
|
|
97
|
-
<bd-divider-horizontal width="100%" color="
|
|
98
|
-
<bd-divider-horizontal width="100%" color="
|
|
99
|
+
<bd-divider-horizontal width="100%" color="primary" opacity="1"></bd-divider-horizontal>
|
|
100
|
+
<bd-divider-horizontal width="100%" color="primary" opacity="0.5"></bd-divider-horizontal>
|
|
101
|
+
<bd-divider-horizontal width="100%" color="primary" opacity="0.25"></bd-divider-horizontal>
|
|
102
|
+
<bd-divider-horizontal width="100%" color="primary" opacity="0.1"></bd-divider-horizontal>
|
|
99
103
|
</div>
|
|
100
104
|
`,
|
|
101
105
|
parameters: { docs: { description: { story: 'Four opacity levels: 1, 0.5, 0.25, 0.1.' } } }
|
|
@@ -103,7 +107,7 @@ export const HorizontalOpacities = {
|
|
|
103
107
|
|
|
104
108
|
export const HorizontalFixedWidth = {
|
|
105
109
|
name : 'Horizontal — Fixed Width',
|
|
106
|
-
render : () => html`<bd-divider-horizontal width="200px" color="
|
|
110
|
+
render : () => html`<bd-divider-horizontal width="200px" color="primary" opacity="1"></bd-divider-horizontal>`,
|
|
107
111
|
parameters: { docs: { description: { story: 'Horizontal divider with a fixed pixel width of 200px.' } } }
|
|
108
112
|
};
|
|
109
113
|
|
|
@@ -126,9 +130,9 @@ export const VerticalCustomHeight = {
|
|
|
126
130
|
render: () => html`
|
|
127
131
|
<div style="display:flex; align-items:center; gap:8px; height:60px;">
|
|
128
132
|
<span>Home</span>
|
|
129
|
-
<bd-divider-vertical height="
|
|
133
|
+
<bd-divider-vertical height="40"></bd-divider-vertical>
|
|
130
134
|
<span>Products</span>
|
|
131
|
-
<bd-divider-vertical height="
|
|
135
|
+
<bd-divider-vertical height="40"></bd-divider-vertical>
|
|
132
136
|
<span>Contact</span>
|
|
133
137
|
</div>
|
|
134
138
|
`,
|
|
@@ -139,9 +143,9 @@ export const VerticalCustomThickness = {
|
|
|
139
143
|
name : 'Vertical — Custom Thickness',
|
|
140
144
|
render: () => html`
|
|
141
145
|
<div style="display:flex; align-items:center; gap:16px; height:40px;">
|
|
142
|
-
<bd-divider-vertical height="
|
|
143
|
-
<bd-divider-vertical height="
|
|
144
|
-
<bd-divider-vertical height="
|
|
146
|
+
<bd-divider-vertical height="32" thickness="1px" color="primary" opacity="1"></bd-divider-vertical>
|
|
147
|
+
<bd-divider-vertical height="32" thickness="2px" color="primary" opacity="1"></bd-divider-vertical>
|
|
148
|
+
<bd-divider-vertical height="32" thickness="4px" color="primary" opacity="1"></bd-divider-vertical>
|
|
145
149
|
</div>
|
|
146
150
|
`,
|
|
147
151
|
parameters: { docs: { description: { story: 'Three thickness values: 1px, 2px, 4px.' } } }
|
|
@@ -151,9 +155,9 @@ export const VerticalCustomColor = {
|
|
|
151
155
|
name : 'Vertical — Custom Color',
|
|
152
156
|
render: () => html`
|
|
153
157
|
<div style="display:flex; align-items:center; gap:16px; height:40px;">
|
|
154
|
-
<bd-divider-vertical height="
|
|
155
|
-
<bd-divider-vertical height="
|
|
156
|
-
<bd-divider-vertical height="
|
|
158
|
+
<bd-divider-vertical height="32" thickness="2px" color="primary" opacity="1"></bd-divider-vertical>
|
|
159
|
+
<bd-divider-vertical height="32" thickness="2px" color="error" opacity="1"></bd-divider-vertical>
|
|
160
|
+
<bd-divider-vertical height="32" thickness="2px" color="success" opacity="1"></bd-divider-vertical>
|
|
157
161
|
</div>
|
|
158
162
|
`,
|
|
159
163
|
parameters: { docs: { description: { story: 'Blue, red, and green vertical dividers.' } } }
|
|
@@ -167,12 +171,12 @@ export const BothTypes = {
|
|
|
167
171
|
<div>
|
|
168
172
|
<div style="display:flex; align-items:center; gap:12px; margin-bottom:16px;">
|
|
169
173
|
<span>Home</span>
|
|
170
|
-
<bd-divider-vertical height="
|
|
174
|
+
<bd-divider-vertical height="20" thickness="1px" color="primary" opacity="1"></bd-divider-vertical>
|
|
171
175
|
<span>Products</span>
|
|
172
|
-
<bd-divider-vertical height="
|
|
176
|
+
<bd-divider-vertical height="20" thickness="1px" color="primary" opacity="1"></bd-divider-vertical>
|
|
173
177
|
<span>Contact</span>
|
|
174
178
|
</div>
|
|
175
|
-
<bd-divider-horizontal width="100%" color="
|
|
179
|
+
<bd-divider-horizontal width="100%" color="primary" opacity="0.25"></bd-divider-horizontal>
|
|
176
180
|
<p style="margin-top:16px;">Content below the divider.</p>
|
|
177
181
|
</div>
|
|
178
182
|
`,
|
|
@@ -181,7 +185,7 @@ export const BothTypes = {
|
|
|
181
185
|
|
|
182
186
|
export const PlaygroundHorizontal = {
|
|
183
187
|
name : '🛝 Playground — Horizontal',
|
|
184
|
-
args : { width: '100%', hColor: '
|
|
188
|
+
args : { width: '100%', hColor: 'primary', hOpacity: '0.5' },
|
|
185
189
|
render: (args) => html`
|
|
186
190
|
<bd-divider-horizontal width="${args.width}" color="${args.hColor}" opacity="${args.hOpacity}"></bd-divider-horizontal>
|
|
187
191
|
`,
|
|
@@ -190,7 +194,7 @@ export const PlaygroundHorizontal = {
|
|
|
190
194
|
|
|
191
195
|
export const PlaygroundVertical = {
|
|
192
196
|
name : '🛝 Playground — Vertical',
|
|
193
|
-
args : { height: '
|
|
197
|
+
args : { height: '32', thickness: '1px', vColor: 'primary', vOpacity: '1' },
|
|
194
198
|
render: (args) => html`
|
|
195
199
|
<div style="display:flex; align-items:center; gap:8px; height:50px;">
|
|
196
200
|
<span>Left</span>
|
|
@@ -1,138 +1,105 @@
|
|
|
1
1
|
import { css } from "lit";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* What a select adds to the shared field chrome: the native control is
|
|
5
|
+
* suppressed and a chevron is drawn in its place.
|
|
6
|
+
*
|
|
7
|
+
* Everything else — label, sizes, states, help text — comes from
|
|
8
|
+
* shared/form-field.css.js.
|
|
9
|
+
*/
|
|
3
10
|
export default css`
|
|
4
|
-
|
|
11
|
+
/* The caret is a sibling of the select rather than a pseudo-element, because a
|
|
12
|
+
select cannot carry a reliable one of its own.
|
|
13
|
+
|
|
14
|
+
This wrapper used to set color: var(--form-input-default-color) purely so
|
|
15
|
+
currentColor on the mark resolved to the field's ink instead of whatever the
|
|
16
|
+
page happened to carry. The caret names its own role now, so that
|
|
17
|
+
declaration had no remaining reader and is gone. */
|
|
18
|
+
.select-wrap {
|
|
19
|
+
position: relative;
|
|
5
20
|
display: block;
|
|
6
|
-
width: 90%;
|
|
7
21
|
}
|
|
8
22
|
|
|
9
|
-
.input-
|
|
10
|
-
display: flex;
|
|
11
|
-
flex-direction: column;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
label {
|
|
15
|
-
margin-bottom: 4px;
|
|
16
|
-
font-weight: 500;
|
|
17
|
-
color: var(--color-neutral-900);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.form-label__required {
|
|
21
|
-
color: var(--color-red-500);
|
|
22
|
-
margin-left: var(--spacing-4);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.label-sm {
|
|
26
|
-
font-size: var(--typography-fontSize-xs);
|
|
27
|
-
font-weight: var(--typography-fontWeight-bold);
|
|
28
|
-
line-height: var(--typography-lineHeight-normal);
|
|
29
|
-
letter-spacing: var(--typography-letterSpacing-wide);
|
|
30
|
-
margin-bottom: var(--spacing-4);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.label-md {
|
|
34
|
-
font-size: var(--typography-fontSize-sm);
|
|
35
|
-
font-weight: var(--typography-fontWeight-bold);
|
|
36
|
-
line-height: var(--typography-lineHeight-normal);
|
|
37
|
-
margin-bottom: var(--spacing-4);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.label-lg {
|
|
41
|
-
font-size: var(--typography-fontSize-lg);
|
|
42
|
-
font-weight: var(--typography-fontWeight-bold);
|
|
43
|
-
line-height: var(--typography-lineHeight-normal);
|
|
44
|
-
margin-bottom: var(--spacing-8);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
select {
|
|
48
|
-
width: 100%;
|
|
49
|
-
font-family: var(--typography-fontFamily-sans, sans-serif);
|
|
50
|
-
border: var(--border-width-1, 1px) solid var(--color-neutral-300);
|
|
51
|
-
background-color: var(--color-neutral-0);
|
|
52
|
-
color: var(--color-neutral-900);
|
|
53
|
-
line-height: var(--typography-lineHeight-normal, 1.5);
|
|
54
|
-
transition: border-color 0.3s ease, background-color 0.3s ease,
|
|
55
|
-
box-shadow 0.3s ease;
|
|
56
|
-
outline: none;
|
|
23
|
+
select.form-input-bd {
|
|
57
24
|
appearance: none;
|
|
58
25
|
-webkit-appearance: none;
|
|
59
26
|
-moz-appearance: none;
|
|
60
|
-
background-image: url('data:image/svg+xml;utf8,<svg fill="%23000000" height="20" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5H7z"/></svg>');
|
|
61
|
-
background-repeat: no-repeat;
|
|
62
|
-
background-position: right var(--spacing-16) center;
|
|
63
|
-
background-size: 1rem;
|
|
64
|
-
padding-right: var(--spacing-28);
|
|
65
27
|
cursor: pointer;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
28
|
+
/* Clearance for the chevron: its own width plus the gap on either side.
|
|
29
|
+
This used to be a padding-right on a bare select type selector, which the
|
|
30
|
+
.input-* size classes then overrode with the padding shorthand — they
|
|
31
|
+
are a class each and beat a type selector — so the clearance never
|
|
32
|
+
applied and a long option ran underneath the chevron. Typing it onto
|
|
33
|
+
select.form-input-bd outranks them. */
|
|
34
|
+
padding-inline-end: calc(var(--icon-sm-size) + var(--spacing-12) * 2);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* bd-arrow-down-icon, positioned over the select. Three versions of this mark,
|
|
38
|
+
and the progression is the point:
|
|
39
|
+
|
|
40
|
+
background-image an encoded SVG carrying fill="%23000000" -- black,
|
|
41
|
+
percent-encoded inside a url(), which no theme could
|
|
42
|
+
reach and no lint could see
|
|
43
|
+
mask the same encoded SVG, alpha only, so the mark finally
|
|
44
|
+
took currentColor and followed the field's own ink
|
|
45
|
+
the atom what it is now
|
|
46
|
+
|
|
47
|
+
The mask fixed the colour and left the real problem: the glyph was still a
|
|
48
|
+
drawing encoded in a stylesheet, invisible to check:icons, and it was a
|
|
49
|
+
SOLID TRIANGLE where every other disclosure control in the package uses a
|
|
50
|
+
chevron -- which is also what this file's Figma Dropdown has always shown.
|
|
51
|
+
A select cannot carry a reliable pseudo-element of its own, but it can have
|
|
52
|
+
a sibling, so the caret is now the same atom the accordion uses. */
|
|
53
|
+
.select-caret {
|
|
54
|
+
/* muted at rest, brand when open -- the same pair bd-anchor-nav's mobile
|
|
55
|
+
toggle uses, and converged on deliberately. This was action/primary in
|
|
56
|
+
both states, which says "this control opens" and says nothing about
|
|
57
|
+
whether it IS open; the rotation carried that alone. Letting the colour
|
|
58
|
+
carry it too is the answer the other disclosure control already gave.
|
|
59
|
+
|
|
60
|
+
Measured on all four grounds a caret sits on, against the 3:1 WCAG
|
|
61
|
+
1.4.11 asks of non-text UI -- and muted beats action/primary on every
|
|
62
|
+
one of them:
|
|
63
|
+
|
|
64
|
+
white error tint success tint disabled
|
|
65
|
+
text/muted 6.59 5.95 6.25 5.12
|
|
66
|
+
text/brand 6.18 5.58 5.86 4.80
|
|
67
|
+
action/primary 4.53 4.10 4.30 3.52
|
|
68
|
+
|
|
69
|
+
The disabled rule below is (0,3,0) against this (0,1,0), so a disabled
|
|
70
|
+
field keeps its grey and never shows the open colour. */
|
|
71
|
+
color: var(--color-text-muted);
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: 50%;
|
|
74
|
+
right: var(--spacing-12);
|
|
75
|
+
transform: translateY(-50%);
|
|
76
|
+
pointer-events: none;
|
|
77
|
+
/* normal, not fast: bd-anchor-nav's chevron turns on the same gesture and
|
|
78
|
+
already used it, and two durations for one motion is the kind of thing
|
|
79
|
+
nobody notices as a decision and everybody notices as an inconsistency. */
|
|
80
|
+
transition: transform var(--transition-duration-normal) var(--transition-easing-smooth),
|
|
81
|
+
color var(--transition-duration-normal) var(--transition-easing-smooth);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Rotated rather than swapped for bd-arrow-up-icon, which is the same drawing
|
|
85
|
+
the other way up. One element means the mark cannot change weight as it
|
|
86
|
+
turns, and a transform can be animated where a DOM swap cannot. The weight
|
|
87
|
+
argument was the sharper one when this was written -- arrow-up was still on
|
|
88
|
+
the lighter Eclipse weight while arrow-down was on fill -- and although the
|
|
89
|
+
two now agree, rotating keeps them from drifting apart again here. */
|
|
90
|
+
.select-caret--open {
|
|
91
|
+
transform: translateY(-50%) rotate(180deg);
|
|
92
|
+
color: var(--color-text-brand);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@media (prefers-reduced-motion: reduce) {
|
|
96
|
+
.select-caret {
|
|
97
|
+
transition: none;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* The chevron is part of the control, so it greys with it. */
|
|
102
|
+
.select-wrap:has(.form-input--disabled) .select-caret {
|
|
103
|
+
color: var(--form-input-disabled-color);
|
|
137
104
|
}
|
|
138
105
|
`;
|
|
@@ -1,30 +1,99 @@
|
|
|
1
|
-
import { LitElement, html } from "lit";
|
|
2
|
-
|
|
1
|
+
import { LitElement, html, nothing } from "lit";
|
|
2
|
+
// Installs the design tokens into document scope; see src/tokens/tokens.js
|
|
3
|
+
import "../../tokens/tokens.js";
|
|
4
|
+
import "../icons/arrow-down-icon.js";
|
|
5
|
+
import { formFieldCSS } from "../shared/form-field.css.js";
|
|
3
6
|
import dropdownCSS from "../dropdown/dropdown.css.js";
|
|
7
|
+
import { resolveSize } from '../shared/prop-vocabulary.js';
|
|
4
8
|
|
|
5
9
|
|
|
6
10
|
class CustomDropdown extends LitElement {
|
|
7
11
|
static properties = {
|
|
8
12
|
label : { type: String },
|
|
9
13
|
options : { type: Array },
|
|
14
|
+
size : { type: String, reflect: true },
|
|
15
|
+
/** @deprecated pass `size`. It named the size, not the kind. */
|
|
10
16
|
kind : { type: String },
|
|
11
17
|
required : { type: Boolean },
|
|
12
18
|
tooltip : { type: String },
|
|
13
19
|
invalid : { type: Boolean },
|
|
14
20
|
validated: { type: Boolean },
|
|
15
|
-
disabled : { type: Boolean }
|
|
21
|
+
disabled : { type: Boolean },
|
|
22
|
+
/* Whether the native picker is showing. A best effort, not a fact: a
|
|
23
|
+
<select> renders its popup in the OS, so the page is never told when it
|
|
24
|
+
opens or closes. See _onSelectMouseDown. */
|
|
25
|
+
_open : { type: Boolean, state: true }
|
|
16
26
|
};
|
|
17
27
|
|
|
18
28
|
constructor() {
|
|
19
29
|
super();
|
|
20
|
-
|
|
30
|
+
/* No default copy — see the note in input.js. */
|
|
31
|
+
this.label = "";
|
|
21
32
|
this.options = [];
|
|
22
|
-
this.
|
|
33
|
+
this.size = "md";
|
|
34
|
+
this.kind = "";
|
|
23
35
|
this.required = false;
|
|
24
36
|
this.tooltip = "";
|
|
25
37
|
this.invalid = false;
|
|
26
38
|
this.validated = false;
|
|
27
39
|
this.disabled = false;
|
|
40
|
+
this._open = false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* WHY THIS IS APPROXIMATED RATHER THAN OBSERVED.
|
|
44
|
+
A native select's picker is drawn by the operating system, so there is no
|
|
45
|
+
event for "opened" and no state to read. Chrome 152 does support
|
|
46
|
+
`select:open` and a `toggle` event, but only for a CUSTOMIZABLE select
|
|
47
|
+
(appearance: base-select) -- this field is appearance: none, and Safari and
|
|
48
|
+
Firefox have neither, so a CSS-only answer does not ship.
|
|
49
|
+
|
|
50
|
+
What is left is inference from the interactions that open a picker, plus
|
|
51
|
+
every signal that proves one has CLOSED. Opening is easy; closing is where
|
|
52
|
+
this gets hard, because dismissing a picker without choosing consumes the
|
|
53
|
+
click inside the popup. The page never sees it and the select keeps focus,
|
|
54
|
+
so `blur` does not arrive until the NEXT click somewhere -- which showed up
|
|
55
|
+
as a chevron stuck pointing up. Hence three closing signals, not one:
|
|
56
|
+
|
|
57
|
+
change a value was chosen
|
|
58
|
+
blur focus left the field
|
|
59
|
+
window focus the picker is a separate native window, so the browser
|
|
60
|
+
window becomes key again when it closes. This is the
|
|
61
|
+
one that catches dismiss-without-choosing.
|
|
62
|
+
pointerdown anywhere outside this element, capture phase
|
|
63
|
+
|
|
64
|
+
The last two can only ever fire when the picker is already shut, so they
|
|
65
|
+
add no false closes. Escape remains unobservable on macOS, which does not
|
|
66
|
+
deliver that keystroke to the page while the popup holds the keyboard; the
|
|
67
|
+
window-focus signal covers it only if focus actually moved. */
|
|
68
|
+
connectedCallback() {
|
|
69
|
+
super.connectedCallback();
|
|
70
|
+
this._onWindowFocus = () => { if (this._open) this._open = false; };
|
|
71
|
+
this._onDocPointerDown = e => {
|
|
72
|
+
if (this._open && e.composedPath()[0] !== this.shadowRoot?.querySelector("select")) this._open = false;
|
|
73
|
+
};
|
|
74
|
+
window.addEventListener("focus", this._onWindowFocus);
|
|
75
|
+
document.addEventListener("pointerdown", this._onDocPointerDown, true);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
disconnectedCallback() {
|
|
79
|
+
window.removeEventListener("focus", this._onWindowFocus);
|
|
80
|
+
document.removeEventListener("pointerdown", this._onDocPointerDown, true);
|
|
81
|
+
super.disconnectedCallback();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
_onSelectMouseDown() {
|
|
85
|
+
/* clicking an open picker closes it, so this toggles rather than sets */
|
|
86
|
+
this._open = !this._open;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
_onSelectKeyDown(e) {
|
|
90
|
+
if (e.key === "Enter" || e.key === " " || (e.altKey && (e.key === "ArrowDown" || e.key === "ArrowUp"))) {
|
|
91
|
+
this._open = true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
_closePicker() {
|
|
96
|
+
this._open = false;
|
|
28
97
|
}
|
|
29
98
|
|
|
30
99
|
set options(val) {
|
|
@@ -42,18 +111,25 @@ class CustomDropdown extends LitElement {
|
|
|
42
111
|
get options() {
|
|
43
112
|
return this._options;
|
|
44
113
|
}
|
|
114
|
+
willUpdate(changed) {
|
|
115
|
+
// kind said "size" on these three and nothing else in the system,
|
|
116
|
+
// so it moved; see shared/prop-vocabulary.js
|
|
117
|
+
if (changed.has("kind") && this.kind) this.size = this.kind;
|
|
118
|
+
if (changed.has("size") || changed.has("kind")) this.size = resolveSize(this.size);
|
|
119
|
+
}
|
|
120
|
+
|
|
45
121
|
render() {
|
|
46
122
|
const inputClass = {
|
|
47
123
|
sm: "input-sm",
|
|
48
124
|
md: "input-md",
|
|
49
125
|
lg: "input-lg"
|
|
50
|
-
}[this.
|
|
126
|
+
}[this.size];
|
|
51
127
|
|
|
52
128
|
const labelClass = {
|
|
53
129
|
sm: "label-sm",
|
|
54
130
|
md: "label-md",
|
|
55
131
|
lg: "label-lg"
|
|
56
|
-
}[this.
|
|
132
|
+
}[this.size];
|
|
57
133
|
|
|
58
134
|
const inputStateClass = this.disabled
|
|
59
135
|
? "form-input--disabled"
|
|
@@ -71,32 +147,36 @@ class CustomDropdown extends LitElement {
|
|
|
71
147
|
|
|
72
148
|
return html`
|
|
73
149
|
<div class="input-container">
|
|
74
|
-
|
|
75
|
-
${
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
150
|
+
${this.label
|
|
151
|
+
? html`<label for="custom-dropdown" class="form-label ${labelClass}">
|
|
152
|
+
${this.label}
|
|
153
|
+
${this.required
|
|
154
|
+
? html`<span class="form-label__required" aria-hidden="true">*</span>`
|
|
155
|
+
: ""}
|
|
156
|
+
</label>`
|
|
157
|
+
: nothing}
|
|
158
|
+
<div class="select-wrap">
|
|
159
|
+
<select
|
|
160
|
+
id="custom-dropdown"
|
|
161
|
+
class="form-input-bd ${inputClass} ${inputStateClass}"
|
|
162
|
+
?required="${this.required}"
|
|
163
|
+
?disabled="${this.disabled}"
|
|
164
|
+
@mousedown="${this._onSelectMouseDown}"
|
|
165
|
+
@keydown="${this._onSelectKeyDown}"
|
|
166
|
+
@change="${this._closePicker}"
|
|
167
|
+
@blur="${this._closePicker}"
|
|
168
|
+
>
|
|
169
|
+
${this.options.map(
|
|
170
|
+
(option, index) => html`<option value="${option}" ?selected="${index === 0}">
|
|
171
|
+
${option}
|
|
172
|
+
</option>`
|
|
173
|
+
)}
|
|
174
|
+
</select>
|
|
175
|
+
<bd-arrow-down-icon
|
|
176
|
+
size="sm"
|
|
177
|
+
class="select-caret ${this._open ? "select-caret--open" : ""}"
|
|
178
|
+
></bd-arrow-down-icon>
|
|
179
|
+
</div>
|
|
100
180
|
${this.tooltip
|
|
101
181
|
? html`<div class="form-help-text ${helpTextClass}">
|
|
102
182
|
${this.tooltip}
|
|
@@ -106,6 +186,6 @@ class CustomDropdown extends LitElement {
|
|
|
106
186
|
`;
|
|
107
187
|
}
|
|
108
188
|
}
|
|
109
|
-
CustomDropdown.styles = [
|
|
189
|
+
CustomDropdown.styles = [formFieldCSS, dropdownCSS];
|
|
110
190
|
|
|
111
191
|
customElements.define("bd-custom-dropdown", CustomDropdown);
|