matcha-components 1.0.5 → 1.0.7
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 +239 -2
- package/assets/open_in_new.png +0 -0
- package/ng-package.json +7 -0
- package/package.json +10 -23
- package/src/documentation/presentation.mdx +105 -0
- package/src/foundation/borders/borders.mdx +180 -0
- package/src/foundation/colors/base/amber.mdx +235 -0
- package/src/foundation/colors/base/blue.mdx +235 -0
- package/src/foundation/colors/base/cyan.mdx +235 -0
- package/src/foundation/colors/base/deep-orange.mdx +235 -0
- package/src/foundation/colors/base/deep-purple.mdx +235 -0
- package/src/foundation/colors/base/green.mdx +235 -0
- package/src/foundation/colors/base/indigo.mdx +235 -0
- package/src/foundation/colors/base/light-blue.mdx +235 -0
- package/src/foundation/colors/base/light-green.mdx +235 -0
- package/src/foundation/colors/base/lime.mdx +235 -0
- package/src/foundation/colors/base/orange.mdx +235 -0
- package/src/foundation/colors/base/pink.mdx +235 -0
- package/src/foundation/colors/base/purple.mdx +235 -0
- package/src/foundation/colors/base/red.mdx +235 -0
- package/src/foundation/colors/base/teal.mdx +235 -0
- package/src/foundation/colors/base/yellow.mdx +235 -0
- package/src/foundation/colors/base-colors.mdx +144 -0
- package/src/foundation/colors/surface-colors.mdx +93 -0
- package/src/foundation/colors/theme/accent.mdx +235 -0
- package/src/foundation/colors/theme/primary.mdx +235 -0
- package/src/foundation/colors/theme/warn.mdx +235 -0
- package/src/foundation/colors/theme-colors.mdx +133 -0
- package/src/foundation/sizes/heights.mdx +232 -0
- package/src/foundation/sizes/max-heights.mdx +237 -0
- package/src/foundation/sizes/max-width.mdx +236 -0
- package/src/foundation/sizes/min-heights.mdx +237 -0
- package/src/foundation/sizes/min-width.mdx +236 -0
- package/src/foundation/sizes/sizes.mdx +219 -0
- package/src/foundation/sizes/widths.mdx +234 -0
- package/src/foundation/spacing/margins.mdx +183 -0
- package/src/foundation/spacing/paddings.mdx +156 -0
- package/src/foundation/typography/colors.mdx +26 -0
- package/src/foundation/typography/font-size.mdx +57 -0
- package/src/foundation/typography/font-weight.mdx +65 -0
- package/src/foundation/typography/helpers.mdx +86 -0
- package/src/foundation/typography/letter-spacing.mdx +35 -0
- package/src/foundation/typography/line-height.mdx +52 -0
- package/src/foundation/typography/message-box.mdx +43 -0
- package/src/foundation/typography/text-align.mdx +22 -0
- package/src/foundation/typography/text-styles.mdx +88 -0
- package/src/lib/matcha-autocomplete/autocomplete-overview.directive.ts +16 -0
- package/src/lib/matcha-autocomplete/autocomplete.argtypes.ts +64 -0
- package/src/lib/matcha-autocomplete/autocomplete.directive.ts +14 -0
- package/src/lib/matcha-autocomplete/autocomplete.mdx +112 -0
- package/src/lib/matcha-autocomplete/autocomplete.module.ts +14 -0
- package/src/lib/matcha-autocomplete/autocomplete.stories.ts +104 -0
- package/src/lib/matcha-autocomplete/example/autocomplete-auto-active-first-option-example.css +9 -0
- package/src/lib/matcha-autocomplete/example/autocomplete-auto-active-first-option-example.html +9 -0
- package/src/lib/matcha-autocomplete/example/autocomplete-auto-active-first-option-example.ts +37 -0
- package/src/lib/matcha-autocomplete/example/autocomplete-overview-example.css +19 -0
- package/src/lib/matcha-autocomplete/example/autocomplete-overview-example.html +17 -0
- package/src/lib/matcha-autocomplete/example/autocomplete-overview-example.ts +70 -0
- package/src/lib/matcha-badge/badge.argtypes.ts +77 -0
- package/src/lib/matcha-badge/badge.directive.ts +11 -0
- package/src/lib/matcha-badge/badge.mdx +69 -0
- package/src/lib/matcha-badge/badge.module.ts +9 -0
- package/src/lib/matcha-badge/badge.stories.ts +79 -0
- package/src/lib/matcha-bottom-sheet/bottom-sheet-overview-example-sheet.html +21 -0
- package/src/lib/matcha-bottom-sheet/bottom-sheet-overview-example.component.ts +34 -0
- package/src/lib/matcha-bottom-sheet/bottom-sheet-overview-example.html +2 -0
- package/src/lib/matcha-bottom-sheet/bottom-sheet.argtypes.ts +117 -0
- package/src/lib/matcha-bottom-sheet/bottom-sheet.directive.ts +16 -0
- package/src/lib/matcha-bottom-sheet/bottom-sheet.mdx +69 -0
- package/src/lib/matcha-bottom-sheet/bottom-sheet.module.ts +9 -0
- package/src/lib/matcha-bottom-sheet/bottom-sheet.stories.ts +39 -0
- package/src/lib/matcha-button/button-overview-example.component.ts +18 -0
- package/src/lib/matcha-button/button-overview-example.html +118 -0
- package/src/lib/matcha-button/button-overview-example.scss +31 -0
- package/src/lib/matcha-button/button.argtypes.ts +20 -0
- package/src/lib/matcha-button/button.directive.ts +39 -0
- package/src/lib/matcha-button/button.mdx +171 -0
- package/src/lib/matcha-button/button.module.ts +10 -0
- package/src/lib/matcha-button/button.stories.ts +38 -0
- package/src/lib/matcha-button/button.stories.ts.TXT +111 -0
- package/src/lib/matcha-button-toggle/button-toggle.argtype.ts +115 -0
- package/src/lib/matcha-button-toggle/button-toggle.directive.ts +13 -0
- package/src/lib/matcha-button-toggle/button-toggle.mdx +63 -0
- package/src/lib/matcha-button-toggle/button-toggle.module.ts +14 -0
- package/src/lib/matcha-button-toggle/button-toggle.stories.ts +64 -0
- package/src/lib/matcha-button-toggle/matcha-button-toggle.directive.ts +15 -0
- package/src/lib/matcha-card/card-argtype.ts +54 -0
- package/src/lib/matcha-card/card-header.html +10 -0
- package/src/lib/matcha-card/card-title-group.html +12 -0
- package/src/lib/matcha-card/card.component.html +3 -0
- package/src/lib/matcha-card/card.component.scss +0 -0
- package/src/lib/matcha-card/card.component.spec.ts +21 -0
- package/src/lib/matcha-card/card.component.ts +47 -0
- package/src/lib/matcha-card/card.mdx +43 -0
- package/src/lib/matcha-card/card.module.ts +10 -0
- package/src/lib/matcha-card/card.stories.ts +92 -0
- package/src/lib/matcha-checkbox/checkbox.argtype.ts +79 -0
- package/src/lib/matcha-checkbox/checkbox.directive.ts +14 -0
- package/src/lib/matcha-checkbox/checkbox.mdx +76 -0
- package/src/lib/matcha-checkbox/checkbox.module.ts +9 -0
- package/src/lib/matcha-checkbox/checkbox.stories.ts +161 -0
- package/src/lib/matcha-checkbox/checkbox.stories.txt +74 -0
- package/src/lib/matcha-chips/chips.module.ts +12 -0
- package/src/lib/matcha-chips/matcha-chips.directive.ts +16 -0
- package/src/lib/matcha-components.module.ts +43 -0
- package/src/lib/matcha-datepicker/datepicker.argtypes.ts +63 -0
- package/src/lib/matcha-datepicker/datepicker.directive.ts +14 -0
- package/src/lib/matcha-datepicker/datepicker.mdx +73 -0
- package/src/lib/matcha-datepicker/datepicker.module.ts +9 -0
- package/src/lib/matcha-datepicker/datepicker.stories.ts +277 -0
- package/src/lib/matcha-dialog/confirmation-dialog.component.ts +39 -0
- package/src/lib/matcha-dialog/confirmation-dialog.stories.ts +21 -0
- package/src/lib/matcha-dialog/dialog.module.ts +14 -0
- package/src/lib/matcha-dialog/matcha-dialog.directive.ts +16 -0
- package/src/lib/matcha-dialog2/confirmation-dialog.component.ts.txt +54 -0
- package/src/lib/matcha-dialog2/confirmation-dialog.stories.ts.txt +24 -0
- package/src/lib/matcha-divider/divider.argtypes.ts +18 -0
- package/src/lib/matcha-divider/divider.directive.ts +16 -0
- package/src/lib/matcha-divider/divider.mdx +51 -0
- package/src/lib/matcha-divider/divider.module.ts +10 -0
- package/src/lib/matcha-divider/divider.stories.ts +49 -0
- package/src/lib/matcha-elevation/elevation.argtypes.ts +16 -0
- package/src/lib/matcha-elevation/elevation.directive.ts +24 -0
- package/src/lib/matcha-elevation/elevation.mdx +50 -0
- package/src/lib/matcha-elevation/elevation.module.ts +10 -0
- package/src/lib/matcha-elevation/elevation.stories.ts +50 -0
- package/src/lib/matcha-expansion/expansion.argtypes.ts +44 -0
- package/src/lib/matcha-expansion/expansion.directive.ts +11 -0
- package/src/lib/matcha-expansion/expansion.mdx +69 -0
- package/src/lib/matcha-expansion/expansion.module.ts +10 -0
- package/src/lib/matcha-expansion/expansion.stories.ts +67 -0
- package/src/lib/matcha-forms/form-field-argtype.ts +60 -0
- package/src/lib/matcha-forms/form-field.directive.ts +11 -0
- package/src/lib/matcha-forms/form-field.mdx +20 -0
- package/src/lib/matcha-forms/form-field.stories.ts +341 -0
- package/src/lib/matcha-forms/forms.module.ts +10 -0
- package/src/lib/matcha-headers/headers.argtype.ts +14 -0
- package/src/lib/matcha-headers/headers.mdx +94 -0
- package/src/lib/matcha-headers/headers.module.ts +12 -0
- package/src/lib/matcha-headers/headers.stories.ts +88 -0
- package/src/lib/matcha-headers/headine/headline.component.html +1 -0
- package/src/lib/matcha-headers/headine/headline.component.scss +0 -0
- package/src/lib/matcha-headers/headine/headline.component.ts +20 -0
- package/src/lib/matcha-headers/subhead/subhead.component.html +1 -0
- package/src/lib/matcha-headers/subhead/subhead.component.scss +0 -0
- package/src/lib/matcha-headers/subhead/subhead.component.ts +20 -0
- package/src/lib/matcha-headers/title/title.component.html +1 -0
- package/src/lib/matcha-headers/title/title.component.scss +0 -0
- package/src/lib/matcha-headers/title/title.component.ts +20 -0
- package/src/lib/matcha-icon/icon-argtype.ts +36 -0
- package/src/lib/matcha-icon/icon.component.html +3 -0
- package/src/lib/matcha-icon/icon.component.scss +0 -0
- package/src/lib/matcha-icon/icon.component.ts +34 -0
- package/src/lib/matcha-icon/icon.mdx +60 -0
- package/src/lib/matcha-icon/icon.module.ts +10 -0
- package/src/lib/matcha-icon/icon.stories.ts +416 -0
- package/src/lib/matcha-input/input.argtypes.ts +42 -0
- package/src/lib/matcha-input/input.directive.ts +11 -0
- package/src/lib/matcha-input/input.mdx +73 -0
- package/src/lib/matcha-input/input.module.ts +9 -0
- package/src/lib/matcha-input/input.stories.ts +97 -0
- package/src/lib/matcha-list/list.argtypes.ts +44 -0
- package/src/lib/matcha-list/list.directive.ts +11 -0
- package/src/lib/matcha-list/list.mdx +69 -0
- package/src/lib/matcha-list/list.module.ts +10 -0
- package/src/lib/matcha-list/list.stories.ts +101 -0
- package/src/lib/matcha-menu/menu.argtypes.ts +114 -0
- package/src/lib/matcha-menu/menu.directive.ts +16 -0
- package/src/lib/matcha-menu/menu.mdx +59 -0
- package/src/lib/matcha-menu/menu.module.ts +10 -0
- package/src/lib/matcha-menu/menu.stories.ts +122 -0
- package/src/lib/matcha-paginator/paginator-overview-example.component.ts +13 -0
- package/src/lib/matcha-paginator/paginator-overview-example.css +0 -0
- package/src/lib/matcha-paginator/paginator-overview-example.html +1 -0
- package/src/lib/matcha-paginator/paginator.argtypes.ts +11 -0
- package/src/lib/matcha-paginator/paginator.directive.ts +16 -0
- package/src/lib/matcha-paginator/paginator.mdx +53 -0
- package/src/lib/matcha-paginator/paginator.module.ts +10 -0
- package/src/lib/matcha-paginator/paginator.stories.ts +34 -0
- package/src/lib/matcha-progress-bar/progress-bar.argtype.ts +48 -0
- package/src/lib/matcha-progress-bar/progress-bar.directive.ts +16 -0
- package/src/lib/matcha-progress-bar/progress-bar.mdx +95 -0
- package/src/lib/matcha-progress-bar/progress-bar.module.ts +14 -0
- package/src/lib/matcha-progress-bar/progress-bar.stories.ts +89 -0
- package/src/lib/matcha-progress-spinner/progress-spinner.argtype.ts +65 -0
- package/src/lib/matcha-progress-spinner/progress-spinner.directive.ts +16 -0
- package/src/lib/matcha-progress-spinner/progress-spinner.mdx +43 -0
- package/src/lib/matcha-progress-spinner/progress-spinner.module.ts +14 -0
- package/src/lib/matcha-progress-spinner/progress-spinner.stories.ts +44 -0
- package/src/lib/matcha-radio-button/matcha-radio-button.argtype.ts +85 -0
- package/src/lib/matcha-radio-button/matcha-radio-button.directive.ts +16 -0
- package/src/lib/matcha-radio-button/matcha-radio-button.stories.ts +44 -0
- package/src/lib/matcha-radio-button/radio-button.module.ts +12 -0
- package/src/lib/matcha-select/select.argtypes.ts +265 -0
- package/src/lib/matcha-select/select.directive.ts +11 -0
- package/src/lib/matcha-select/select.mdx +54 -0
- package/src/lib/matcha-select/select.module.ts +10 -0
- package/src/lib/matcha-select/select.stories.ts +164 -0
- package/src/lib/matcha-select/select.stories.txt +109 -0
- package/src/lib/matcha-sidenav/sidenav.argtypes.ts +60 -0
- package/src/lib/matcha-sidenav/sidenav.directive.ts +11 -0
- package/src/lib/matcha-sidenav/sidenav.mdx +57 -0
- package/src/lib/matcha-sidenav/sidenav.module.ts +10 -0
- package/src/lib/matcha-sidenav/sidenav.stories.ts +79 -0
- package/src/lib/matcha-slide-toggle/slide-toggle.argtype.ts +66 -0
- package/src/lib/matcha-slide-toggle/slide-toggle.directive.ts +16 -0
- package/src/lib/matcha-slide-toggle/slide-toggle.mdx +92 -0
- package/src/lib/matcha-slide-toggle/slide-toggle.module.ts +12 -0
- package/src/lib/matcha-slide-toggle/slide-toggle.stories.ts +167 -0
- package/src/lib/matcha-slider/matcha-slider.directive.ts +16 -0
- package/src/lib/matcha-slider/slider.argtypes.ts +83 -0
- package/src/lib/matcha-slider/slider.mdx +45 -0
- package/src/lib/matcha-slider/slider.module.ts +12 -0
- package/src/lib/matcha-slider/slider.stories.ts +149 -0
- package/src/lib/matcha-snackbar/snack-bar-overview-example.component.ts +23 -0
- package/src/lib/matcha-snackbar/snack-bar-overview-example.css +3 -0
- package/src/lib/matcha-snackbar/snack-bar-overview-example.html +11 -0
- package/src/lib/matcha-snackbar/snack-bar.argtypes.ts +11 -0
- package/src/lib/matcha-snackbar/snack-bar.directive.ts +11 -0
- package/src/lib/matcha-snackbar/snack-bar.mdx +53 -0
- package/src/lib/matcha-snackbar/snack-bar.module.ts +10 -0
- package/src/lib/matcha-snackbar/snack-bar.stories.ts +34 -0
- package/src/lib/matcha-sort-header/example/sort-overview-example.component.ts +67 -0
- package/src/lib/matcha-sort-header/example/sort-overview-example.css +3 -0
- package/src/lib/matcha-sort-header/example/sort-overview-example.html +21 -0
- package/src/lib/matcha-sort-header/sort-header.argtypes.ts +11 -0
- package/src/lib/matcha-sort-header/sort-header.directive.ts +16 -0
- package/src/lib/matcha-sort-header/sort-header.mdx +78 -0
- package/src/lib/matcha-sort-header/sort-header.module.ts +10 -0
- package/src/lib/matcha-sort-header/sort-header.stories.ts +34 -0
- package/src/lib/matcha-stepper/stepper.argtypes.ts +92 -0
- package/src/lib/matcha-stepper/stepper.directive.ts +16 -0
- package/src/lib/matcha-stepper/stepper.mdx +68 -0
- package/src/lib/matcha-stepper/stepper.module.ts +10 -0
- package/src/lib/matcha-stepper/stepper.stories.ts +163 -0
- package/src/lib/matcha-table/example/table-basic-example.component.ts +37 -0
- package/src/lib/matcha-table/example/table-basic-example.css +0 -0
- package/src/lib/matcha-table/example/table-basic-example.html +35 -0
- package/src/lib/matcha-table/table.argtypes.ts +11 -0
- package/src/lib/matcha-table/table.directive.ts +16 -0
- package/src/lib/matcha-table/table.mdx +78 -0
- package/src/lib/matcha-table/table.module.ts +10 -0
- package/src/lib/matcha-table/table.stories.ts +34 -0
- package/src/lib/matcha-tabs/tabs.argtypes.ts +11 -0
- package/src/lib/matcha-tabs/tabs.directive.ts +17 -0
- package/src/lib/matcha-tabs/tabs.mdx +69 -0
- package/src/lib/matcha-tabs/tabs.module.ts +10 -0
- package/src/lib/matcha-tabs/tabs.stories.ts +49 -0
- package/src/lib/matcha-tabs/tabs.stories.txt +18 -0
- package/src/lib/matcha-toolbar/toolbar.argtypes.ts +20 -0
- package/src/lib/matcha-toolbar/toolbar.directive.ts +11 -0
- package/src/lib/matcha-toolbar/toolbar.mdx +57 -0
- package/src/lib/matcha-toolbar/toolbar.module.ts +10 -0
- package/src/lib/matcha-toolbar/toolbar.stories.ts +100 -0
- package/src/lib/matcha-tooltip/tooltip.argtypes.ts +11 -0
- package/src/lib/matcha-tooltip/tooltip.directive.ts +16 -0
- package/src/lib/matcha-tooltip/tooltip.mdx +69 -0
- package/src/lib/matcha-tooltip/tooltip.module.ts +10 -0
- package/src/lib/matcha-tooltip/tooltip.stories.ts +79 -0
- package/src/lib/matcha-tree/tree.argtypes.ts +42 -0
- package/src/lib/matcha-tree/tree.directive.ts +16 -0
- package/src/lib/matcha-tree/tree.mdx +49 -0
- package/src/lib/matcha-tree/tree.module.ts +10 -0
- package/src/lib/matcha-tree/tree.stories.ts +130 -0
- package/src/public-api.ts +92 -0
- package/tsconfig.lib.json +18 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +14 -0
- package/esm2022/lib/matcha-button/matcha-button.component.mjs +0 -12
- package/esm2022/lib/matcha-card/matcha-card-content/matcha-card-content.component.mjs +0 -12
- package/esm2022/lib/matcha-card/matcha-card-footer/matcha-card-footer.component.mjs +0 -12
- package/esm2022/lib/matcha-card/matcha-card-header/matcha-card-header.component.mjs +0 -12
- package/esm2022/lib/matcha-card/matcha-card.component.mjs +0 -12
- package/esm2022/lib/matcha-card/matcha-card.module.mjs +0 -40
- package/esm2022/lib/matcha-components.module.mjs +0 -27
- package/esm2022/matcha-components.mjs +0 -5
- package/esm2022/public-api.mjs +0 -20
- package/fesm2022/matcha-components.mjs +0 -113
- package/fesm2022/matcha-components.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/matcha-button/matcha-button.component.d.ts +0 -5
- package/lib/matcha-card/matcha-card-content/matcha-card-content.component.d.ts +0 -5
- package/lib/matcha-card/matcha-card-footer/matcha-card-footer.component.d.ts +0 -5
- package/lib/matcha-card/matcha-card-header/matcha-card-header.component.d.ts +0 -5
- package/lib/matcha-card/matcha-card.component.d.ts +0 -5
- package/lib/matcha-card/matcha-card.module.d.ts +0 -11
- package/lib/matcha-components.module.d.ts +0 -8
- package/public-api.d.ts +0 -7
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export const autocompleteArgtypes = {
|
|
2
|
+
autoActiveFirstOption: {
|
|
3
|
+
description:
|
|
4
|
+
'Whether the first option should be highlighted when the autocomplete panel is opened.',
|
|
5
|
+
defaultValue: false,
|
|
6
|
+
},
|
|
7
|
+
class: {
|
|
8
|
+
description:
|
|
9
|
+
'Classes to be applied to the autocomplete panel inside of the overlay container.',
|
|
10
|
+
},
|
|
11
|
+
disableRipple: {
|
|
12
|
+
description: 'Whether ripples are disabled.',
|
|
13
|
+
},
|
|
14
|
+
panelWidth: {
|
|
15
|
+
description:
|
|
16
|
+
'Specifies the width of the autocomplete panel. (Can be any CSS sizing value)',
|
|
17
|
+
},
|
|
18
|
+
onClosed: {
|
|
19
|
+
description:
|
|
20
|
+
'Event that is emitted when the autocomplete panel is closed.',
|
|
21
|
+
action: 'onClosed',
|
|
22
|
+
},
|
|
23
|
+
onOpened: {
|
|
24
|
+
description:
|
|
25
|
+
'Event that is emitted when the autocomplete panel is opened.',
|
|
26
|
+
action: 'onOpened',
|
|
27
|
+
},
|
|
28
|
+
onOptionActivated: {
|
|
29
|
+
description:
|
|
30
|
+
'Event that is emitted when an option is activated using the keyboard.',
|
|
31
|
+
action: 'onOptionActivated',
|
|
32
|
+
},
|
|
33
|
+
onOptionSelected: {
|
|
34
|
+
description: 'Event that is emitted when an option is selected.',
|
|
35
|
+
action: 'onOptionSelected',
|
|
36
|
+
},
|
|
37
|
+
autocompleteTriggerDisabled: {
|
|
38
|
+
description: 'Whether the autocomplete is disabled.',
|
|
39
|
+
defaultValue: false,
|
|
40
|
+
},
|
|
41
|
+
autocompleteTriggerPosition: {
|
|
42
|
+
description:
|
|
43
|
+
'Position of the autocomplete panel relative to the trigger element.',
|
|
44
|
+
options: [null, 'auto', 'above', 'below'],
|
|
45
|
+
control: { type: 'select' },
|
|
46
|
+
},
|
|
47
|
+
label: {
|
|
48
|
+
description: 'Label of the autocomplete',
|
|
49
|
+
defaultValue: 'Number',
|
|
50
|
+
table: {
|
|
51
|
+
defaultValue: { summary: 'Number' },
|
|
52
|
+
},
|
|
53
|
+
control: 'text',
|
|
54
|
+
},
|
|
55
|
+
color: {
|
|
56
|
+
description: 'Theme color palette',
|
|
57
|
+
control: 'select',
|
|
58
|
+
defaultValue: 'accent',
|
|
59
|
+
table: {
|
|
60
|
+
defaultValue: { summary: 'accent' },
|
|
61
|
+
},
|
|
62
|
+
options: ['primary', 'accent', 'warn'],
|
|
63
|
+
},
|
|
64
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Directive, ElementRef, Renderer2 } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Directive({
|
|
4
|
+
selector: '[matcha-autocomplete]'
|
|
5
|
+
})
|
|
6
|
+
export class MatchaAutocompleteDirective {
|
|
7
|
+
|
|
8
|
+
constructor(
|
|
9
|
+
private _elementRef: ElementRef,
|
|
10
|
+
private _renderer: Renderer2
|
|
11
|
+
) {
|
|
12
|
+
this._renderer.addClass(this._elementRef.nativeElement,'matcha-autocomplete')
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Story } from "@storybook/blocks";
|
|
2
|
+
import { Meta } from "@storybook/addon-docs";
|
|
3
|
+
import * as ComponentStories from "./autocomplete.stories";
|
|
4
|
+
|
|
5
|
+
<Meta title="Atoms / Autocomplete / Documentação" />
|
|
6
|
+
|
|
7
|
+
# Autocomplete
|
|
8
|
+
|
|
9
|
+
> _autocomplete_ "ESCREVER DEFINIÇÃO DO ATÔMICO"
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
### Modes
|
|
14
|
+
|
|
15
|
+
<div class="d-flex-column gap-16">
|
|
16
|
+
<div class="d-flex-column">
|
|
17
|
+
<div class="matcha-card background-surface d-flex-column gap-16">
|
|
18
|
+
<span class="h5">Autocomplete - Default</span>
|
|
19
|
+
<div class="matcha-card background-bg">
|
|
20
|
+
<Story of={ComponentStories.AutocompleteDefault} />
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div class="d-flex-column">
|
|
24
|
+
```html
|
|
25
|
+
<form class="example-form">
|
|
26
|
+
<mat-form-field class="example-full-width">
|
|
27
|
+
<mat-label>Number</mat-label>
|
|
28
|
+
<input type="text"
|
|
29
|
+
placeholder="Pick one"
|
|
30
|
+
aria-label="Number"
|
|
31
|
+
matInput
|
|
32
|
+
[formControl]="myControl"
|
|
33
|
+
[matAutocomplete]="auto">
|
|
34
|
+
<mat-autocomplete autoActiveFirstOption #auto="matAutocomplete">
|
|
35
|
+
<mat-option *ngFor="let option of filteredOptions | async" [value]="option">
|
|
36
|
+
{{option}}
|
|
37
|
+
</mat-option>
|
|
38
|
+
</mat-autocomplete>
|
|
39
|
+
</mat-form-field>
|
|
40
|
+
</form>
|
|
41
|
+
```
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<br />
|
|
49
|
+
|
|
50
|
+
### Installation
|
|
51
|
+
|
|
52
|
+
`import {MatAutocompleteModule} from '@angular/material/autocomplete';`
|
|
53
|
+
|
|
54
|
+
[Official documentation](https://material.angular.io/components/autocomplete/overview)
|
|
55
|
+
|
|
56
|
+
<br />
|
|
57
|
+
<div class="d-flex-column gap-16">
|
|
58
|
+
<div class="d-flex-column">
|
|
59
|
+
<div class="matcha-card background-surface d-flex-column gap-16">
|
|
60
|
+
<div class="d-flex-column">
|
|
61
|
+
```ts
|
|
62
|
+
import {Component, OnInit} from '@angular/core';
|
|
63
|
+
import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms';
|
|
64
|
+
import {Observable} from 'rxjs';
|
|
65
|
+
import {map, startWith} from 'rxjs/operators';
|
|
66
|
+
import {NgFor, AsyncPipe} from '@angular/common';
|
|
67
|
+
import {MatAutocompleteModule} from '@angular/material/autocomplete';
|
|
68
|
+
import {MatInputModule} from '@angular/material/input';
|
|
69
|
+
import {MatFormFieldModule} from '@angular/material/form-field';
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @title Highlight the first autocomplete option
|
|
73
|
+
*/
|
|
74
|
+
@Component({
|
|
75
|
+
selector: 'autocomplete-auto-active-first-option-example',
|
|
76
|
+
templateUrl: 'autocomplete-auto-active-first-option-example.html',
|
|
77
|
+
styleUrls: ['autocomplete-auto-active-first-option-example.css'],
|
|
78
|
+
standalone: true,
|
|
79
|
+
imports: [
|
|
80
|
+
FormsModule,
|
|
81
|
+
MatFormFieldModule,
|
|
82
|
+
MatInputModule,
|
|
83
|
+
MatAutocompleteModule,
|
|
84
|
+
ReactiveFormsModule,
|
|
85
|
+
NgFor,
|
|
86
|
+
AsyncPipe,
|
|
87
|
+
],
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
export class AutocompleteAutoActiveFirstOptionExample implements OnInit {
|
|
91
|
+
myControl = new FormControl('');
|
|
92
|
+
options: string[] = ['One', 'Two', 'Three'];
|
|
93
|
+
filteredOptions: Observable<string[]>;
|
|
94
|
+
|
|
95
|
+
ngOnInit() {
|
|
96
|
+
this.filteredOptions = this.myControl.valueChanges.pipe(
|
|
97
|
+
startWith(''),
|
|
98
|
+
map(value => this._filter(value || '')),
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private _filter(value: string): string[] {
|
|
103
|
+
const filterValue = value.toLowerCase();
|
|
104
|
+
return this.options.filter(option => option.toLowerCase().includes(filterValue));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { MatchaAutocompleteDirective } from './autocomplete.directive';
|
|
4
|
+
import { MatchaAutocompleteOverviewDirective } from './autocomplete-overview.directive';
|
|
5
|
+
|
|
6
|
+
@NgModule({
|
|
7
|
+
declarations: [
|
|
8
|
+
MatchaAutocompleteDirective,
|
|
9
|
+
MatchaAutocompleteOverviewDirective,
|
|
10
|
+
],
|
|
11
|
+
imports: [],
|
|
12
|
+
exports: [MatchaAutocompleteDirective, MatchaAutocompleteOverviewDirective],
|
|
13
|
+
})
|
|
14
|
+
export class MatchaAutocompleteModule {}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { applicationConfig, Meta, moduleMetadata, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { NgFor, AsyncPipe } from '@angular/common';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
+
import { map, startWith } from 'rxjs';
|
|
6
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
7
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
8
|
+
import { MatInputModule } from '@angular/material/input';
|
|
9
|
+
import { provideAnimations } from '@angular/platform-browser/animations';
|
|
10
|
+
import { autocompleteArgtypes } from './autocomplete.argtypes';
|
|
11
|
+
import { AutocompleteAutoActiveFirstOptionExample } from './example/autocomplete-auto-active-first-option-example';
|
|
12
|
+
import { AutocompleteOverviewExample } from './example/autocomplete-overview-example';
|
|
13
|
+
import { MatchaAutocompleteModule } from './autocomplete.module';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
title: 'Atoms / Autocomplete',
|
|
17
|
+
component: AutocompleteOverviewExample,
|
|
18
|
+
decorators: [
|
|
19
|
+
applicationConfig({
|
|
20
|
+
providers: [provideAnimations()],
|
|
21
|
+
}),
|
|
22
|
+
moduleMetadata({
|
|
23
|
+
imports: [CommonModule, FormsModule, MatFormFieldModule, MatInputModule, MatAutocompleteModule, ReactiveFormsModule, NgFor, AsyncPipe, MatchaAutocompleteModule],
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
// tags: ['autodocs'],
|
|
27
|
+
args: {
|
|
28
|
+
label: 'Number',
|
|
29
|
+
autoActiveFirstOption: false,
|
|
30
|
+
class: '',
|
|
31
|
+
color: 'accent',
|
|
32
|
+
disableRipple: false,
|
|
33
|
+
panelWidth: '',
|
|
34
|
+
autocompleteTriggerDisabled: false,
|
|
35
|
+
autocompleteTriggerPosition: 'auto',
|
|
36
|
+
},
|
|
37
|
+
argTypes: autocompleteArgtypes,
|
|
38
|
+
parameters: {
|
|
39
|
+
controls: { expanded: true },
|
|
40
|
+
},
|
|
41
|
+
} as Meta;
|
|
42
|
+
|
|
43
|
+
function _filter(value: string): string[] {
|
|
44
|
+
const filterValue = value.toLowerCase();
|
|
45
|
+
return options.filter((option) => option.toLowerCase().includes(filterValue));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const myControl = new FormControl();
|
|
49
|
+
const options = ['One', 'Two', 'Three', 'Four'];
|
|
50
|
+
const filteredOptions = myControl.valueChanges.pipe(
|
|
51
|
+
startWith(''),
|
|
52
|
+
map((value) => _filter(value || ''))
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
export const AutocompleteDefault: StoryObj = {
|
|
56
|
+
render: (args) => ({
|
|
57
|
+
props: {
|
|
58
|
+
...args,
|
|
59
|
+
myControl,
|
|
60
|
+
options,
|
|
61
|
+
filteredOptions,
|
|
62
|
+
},
|
|
63
|
+
template: `
|
|
64
|
+
<div class="matcha-card background-surface">
|
|
65
|
+
<form>
|
|
66
|
+
<mat-form-field matcha-autocomplete appearance="outline" [color]="color">
|
|
67
|
+
<mat-label>{{label}}</mat-label>
|
|
68
|
+
<input type="text"
|
|
69
|
+
placeholder="Pick one"
|
|
70
|
+
aria-label="Number"
|
|
71
|
+
matInput
|
|
72
|
+
[formControl]="myControl"
|
|
73
|
+
[matAutocomplete]="auto"
|
|
74
|
+
[matAutocompleteDisabled]="autocompleteTriggerDisabled"
|
|
75
|
+
[matAutocompletePosition]="autocompleteTriggerPosition">
|
|
76
|
+
<mat-autocomplete #auto="matAutocomplete"
|
|
77
|
+
[autoActiveFirstOption]="autoActiveFirstOption"
|
|
78
|
+
[class]="class"
|
|
79
|
+
[disableRipple]="disableRipple"
|
|
80
|
+
[panelWidth]="panelWidth"
|
|
81
|
+
(closed)="onClosed()"
|
|
82
|
+
(opened)="onOpened()"
|
|
83
|
+
(optionActivated)="onOptionActivated($event)"
|
|
84
|
+
(optionSelected)="onOptionSelected($event)">
|
|
85
|
+
<mat-option *ngFor="let option of filteredOptions | async" [value]="option">
|
|
86
|
+
{{option}}
|
|
87
|
+
</mat-option>
|
|
88
|
+
</mat-autocomplete>
|
|
89
|
+
</mat-form-field>
|
|
90
|
+
</form>
|
|
91
|
+
</div>
|
|
92
|
+
`,
|
|
93
|
+
}),
|
|
94
|
+
name: 'Autocomplete Default',
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const AutocompleteAutoActiveFirstOptionOverview: StoryObj<AutocompleteOverviewExample> = {
|
|
98
|
+
render: (args) => ({
|
|
99
|
+
props: {
|
|
100
|
+
...args,
|
|
101
|
+
},
|
|
102
|
+
}),
|
|
103
|
+
name: 'Active First Option',
|
|
104
|
+
};
|
package/src/lib/matcha-autocomplete/example/autocomplete-auto-active-first-option-example.html
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<form class="example-form">
|
|
2
|
+
<mat-form-field class="example-full-width" appearance="outline" [color]="color">
|
|
3
|
+
<mat-label>Number</mat-label>
|
|
4
|
+
<input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="myControl" [matAutocomplete]="auto" />
|
|
5
|
+
<mat-autocomplete autoActiveFirstOption #auto="matAutocomplete">
|
|
6
|
+
<mat-option *ngFor="let option of filteredOptions | async" [value]="option"> {{option}} </mat-option>
|
|
7
|
+
</mat-autocomplete>
|
|
8
|
+
</mat-form-field>
|
|
9
|
+
</form>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Component, OnInit } from '@angular/core';
|
|
2
|
+
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { map, startWith } from 'rxjs/operators';
|
|
5
|
+
import { NgFor, AsyncPipe } from '@angular/common';
|
|
6
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
7
|
+
import { MatInputModule } from '@angular/material/input';
|
|
8
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @title Highlight the first autocomplete option
|
|
12
|
+
*/
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'autocomplete-auto-active-first-option-example',
|
|
15
|
+
templateUrl: 'autocomplete-auto-active-first-option-example.html',
|
|
16
|
+
styleUrls: ['autocomplete-auto-active-first-option-example.css'],
|
|
17
|
+
standalone: true,
|
|
18
|
+
imports: [FormsModule, MatFormFieldModule, MatInputModule, MatAutocompleteModule, ReactiveFormsModule, NgFor, AsyncPipe],
|
|
19
|
+
})
|
|
20
|
+
export class AutocompleteAutoActiveFirstOptionExample implements OnInit {
|
|
21
|
+
myControl = new FormControl('');
|
|
22
|
+
options: string[] = ['One', 'Two', 'Three'];
|
|
23
|
+
filteredOptions!: Observable<string[]>;
|
|
24
|
+
|
|
25
|
+
ngOnInit() {
|
|
26
|
+
this.filteredOptions = this.myControl.valueChanges.pipe(
|
|
27
|
+
startWith(''),
|
|
28
|
+
map((value) => this._filter(value || ''))
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private _filter(value: string): string[] {
|
|
33
|
+
const filterValue = value.toLowerCase();
|
|
34
|
+
|
|
35
|
+
return this.options.filter((option) => option.toLowerCase().includes(filterValue));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.example-form {
|
|
2
|
+
min-width: 150px;
|
|
3
|
+
max-width: 500px;
|
|
4
|
+
width: 100%;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.example-full-width {
|
|
8
|
+
width: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.example-option-img {
|
|
12
|
+
vertical-align: middle;
|
|
13
|
+
margin-right: 8px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
[dir='rtl'] .example-option-img {
|
|
17
|
+
margin-right: 0;
|
|
18
|
+
margin-left: 8px;
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<form class="example-form">
|
|
2
|
+
<mat-form-field class="example-full-width" appearance="outline" [color]="color">
|
|
3
|
+
<mat-label>State</mat-label>
|
|
4
|
+
<input matInput aria-label="State" [matAutocomplete]="auto" [formControl]="stateCtrl" />
|
|
5
|
+
<mat-autocomplete #auto="matAutocomplete">
|
|
6
|
+
<mat-option *ngFor="let state of filteredStates | async" [value]="state.name">
|
|
7
|
+
<img alt="" class="example-option-img" [src]="state.flag" height="25" />
|
|
8
|
+
<span>{{state.name}}</span> |
|
|
9
|
+
<small>Population: {{state.population}}</small>
|
|
10
|
+
</mat-option>
|
|
11
|
+
</mat-autocomplete>
|
|
12
|
+
</mat-form-field>
|
|
13
|
+
|
|
14
|
+
<br />
|
|
15
|
+
|
|
16
|
+
<mat-slide-toggle [checked]="stateCtrl.disabled" (change)="stateCtrl.disabled ? stateCtrl.enable() : stateCtrl.disable()"> Disable Input? </mat-slide-toggle>
|
|
17
|
+
</form>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { map, startWith } from 'rxjs/operators';
|
|
5
|
+
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
6
|
+
import { NgFor, AsyncPipe } from '@angular/common';
|
|
7
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
8
|
+
import { MatInputModule } from '@angular/material/input';
|
|
9
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
10
|
+
|
|
11
|
+
export interface State {
|
|
12
|
+
flag: string;
|
|
13
|
+
name: string;
|
|
14
|
+
population: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @title Autocomplete overview
|
|
19
|
+
*/
|
|
20
|
+
@Component({
|
|
21
|
+
selector: 'autocomplete-overview-example',
|
|
22
|
+
templateUrl: 'autocomplete-overview-example.html',
|
|
23
|
+
styleUrls: ['autocomplete-overview-example.css'],
|
|
24
|
+
standalone: true,
|
|
25
|
+
imports: [FormsModule, MatFormFieldModule, MatInputModule, MatAutocompleteModule, ReactiveFormsModule, NgFor, MatSlideToggleModule, AsyncPipe],
|
|
26
|
+
})
|
|
27
|
+
export class AutocompleteOverviewExample {
|
|
28
|
+
stateCtrl = new FormControl('');
|
|
29
|
+
filteredStates: Observable<State[]>;
|
|
30
|
+
|
|
31
|
+
states: State[] = [
|
|
32
|
+
{
|
|
33
|
+
name: 'Arkansas',
|
|
34
|
+
population: '2.978M',
|
|
35
|
+
// https://commons.wikimedia.org/wiki/File:Flag_of_Arkansas.svg
|
|
36
|
+
flag: 'https://upload.wikimedia.org/wikipedia/commons/9/9d/Flag_of_Arkansas.svg',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'California',
|
|
40
|
+
population: '39.14M',
|
|
41
|
+
// https://commons.wikimedia.org/wiki/File:Flag_of_California.svg
|
|
42
|
+
flag: 'https://upload.wikimedia.org/wikipedia/commons/0/01/Flag_of_California.svg',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'Florida',
|
|
46
|
+
population: '20.27M',
|
|
47
|
+
// https://commons.wikimedia.org/wiki/File:Flag_of_Florida.svg
|
|
48
|
+
flag: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Flag_of_Florida.svg',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Texas',
|
|
52
|
+
population: '27.47M',
|
|
53
|
+
// https://commons.wikimedia.org/wiki/File:Flag_of_Texas.svg
|
|
54
|
+
flag: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Flag_of_Texas.svg',
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
constructor() {
|
|
59
|
+
this.filteredStates = this.stateCtrl.valueChanges.pipe(
|
|
60
|
+
startWith(''),
|
|
61
|
+
map((state) => (state ? this._filterStates(state) : this.states.slice()))
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private _filterStates(value: string): State[] {
|
|
66
|
+
const filterValue = value.toLowerCase();
|
|
67
|
+
|
|
68
|
+
return this.states.filter((state) => state.name.toLowerCase().includes(filterValue));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export const badgeArgtypes = {
|
|
2
|
+
matBadgeColor: {
|
|
3
|
+
description: 'The color of the badge. Can be primary, accent, or warn.',
|
|
4
|
+
control: 'select',
|
|
5
|
+
options: ['primary', 'accent', 'warn'],
|
|
6
|
+
defaultValue: 'primary',
|
|
7
|
+
table: {
|
|
8
|
+
type: { summary: 'ThemePalette' },
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
matBadge: {
|
|
12
|
+
description: 'The content for the badge',
|
|
13
|
+
control: 'text',
|
|
14
|
+
defaultValue: '',
|
|
15
|
+
table: {
|
|
16
|
+
type: { summary: 'string | number | undefined | null' },
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
matBadgeDescription: {
|
|
20
|
+
description: 'Message used to describe the decorated element via aria-describedby',
|
|
21
|
+
control: 'text',
|
|
22
|
+
defaultValue: '',
|
|
23
|
+
table: {
|
|
24
|
+
type: { summary: 'string' },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
matBadgeDisabled: {
|
|
28
|
+
description: 'Whether the component is disabled.',
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
defaultValue: false,
|
|
31
|
+
table: {
|
|
32
|
+
type: { summary: 'boolean' },
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
matBadgeHidden: {
|
|
36
|
+
description: 'Whether the badge is hidden.',
|
|
37
|
+
control: 'boolean',
|
|
38
|
+
defaultValue: false,
|
|
39
|
+
table: {
|
|
40
|
+
type: { summary: 'boolean' },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
matBadgeOverlap: {
|
|
44
|
+
description: 'Whether the badge should overlap its contents or not',
|
|
45
|
+
control: 'boolean',
|
|
46
|
+
defaultValue: true,
|
|
47
|
+
table: {
|
|
48
|
+
type: { summary: 'boolean' },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
matBadgePosition: {
|
|
52
|
+
description: 'Position the badge should reside. Accepts any combination of "above"|"below" and "before"|"after"',
|
|
53
|
+
control: 'text',
|
|
54
|
+
defaultValue: 'above after',
|
|
55
|
+
table: {
|
|
56
|
+
type: { summary: 'MatBadgePosition' },
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
matBadgeSize: {
|
|
60
|
+
description: 'Size of the badge. Can be "small", "medium", or "large".',
|
|
61
|
+
control: 'select',
|
|
62
|
+
options: ['small', 'medium', 'large'],
|
|
63
|
+
defaultValue: 'medium',
|
|
64
|
+
table: {
|
|
65
|
+
type: { summary: 'MatBadgeSize' },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
color: {
|
|
69
|
+
description: 'Theme color palette',
|
|
70
|
+
control: 'select',
|
|
71
|
+
defaultValue: 'accent',
|
|
72
|
+
table: {
|
|
73
|
+
defaultValue: { summary: 'accent' },
|
|
74
|
+
},
|
|
75
|
+
options: ['primary', 'accent', 'warn'],
|
|
76
|
+
},
|
|
77
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Directive, ElementRef, Renderer2 } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Directive({
|
|
4
|
+
selector: '[matcha-badge]',
|
|
5
|
+
})
|
|
6
|
+
export class MatchaBadgeDirective {
|
|
7
|
+
constructor(private _elementRef: ElementRef, private _renderer: Renderer2) {
|
|
8
|
+
//this._elementRef.nativeElement.style.backgroundColor = 'grey';
|
|
9
|
+
this._renderer.addClass(this._elementRef.nativeElement, 'matcha-badge');
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Story } from "@storybook/blocks";
|
|
2
|
+
import { Meta } from "@storybook/addon-docs";
|
|
3
|
+
import * as ComponentStories from "./badge.stories";
|
|
4
|
+
|
|
5
|
+
<Meta title="Atoms / Badge / Documentação" />
|
|
6
|
+
|
|
7
|
+
# Badge
|
|
8
|
+
|
|
9
|
+
> _badge_ "ESCREVER DEFINIÇÃO DO ATÔMICO"
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
### Modes
|
|
14
|
+
|
|
15
|
+
<div class="d-flex-column gap-16">
|
|
16
|
+
<div class="d-flex-column">
|
|
17
|
+
<div class="matcha-card background-surface d-flex-column gap-16">
|
|
18
|
+
<span class="h5">Badge overview</span>
|
|
19
|
+
<div class="matcha-card background-bg">
|
|
20
|
+
<Story of={ComponentStories.BadgeOverview} />
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div class="d-flex-column">
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<div matBadge="4" matBadgeOverlap="false" class="demo-section">Text with a badge</div>
|
|
27
|
+
|
|
28
|
+
<div matBadge="1" matBadgeSize="large" class="demo-section">Text with large badge</div>
|
|
29
|
+
|
|
30
|
+
<div class="demo-section">
|
|
31
|
+
Button with a badge on the left
|
|
32
|
+
<button mat-raised-button color="primary"
|
|
33
|
+
matBadge="8" matBadgePosition="before" matBadgeColor="accent">
|
|
34
|
+
Action
|
|
35
|
+
</button>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<div class="demo-section">
|
|
39
|
+
Button toggles badge visibility
|
|
40
|
+
<button mat-raised-button matBadge="7" [matBadgeHidden]="hidden" (click)="toggleBadgeVisibility()">
|
|
41
|
+
Hide
|
|
42
|
+
</button>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div class="demo-section">
|
|
46
|
+
Icon with a badge
|
|
47
|
+
<mat-icon matBadge="15" matBadgeColor="warn">home</mat-icon>
|
|
48
|
+
<!-- Include text description of the icon's meaning for screen-readers -->
|
|
49
|
+
<span class="cdk-visually-hidden">
|
|
50
|
+
Example with a home icon with overlaid badge showing the number 15
|
|
51
|
+
</span>
|
|
52
|
+
</div>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<br />
|
|
62
|
+
|
|
63
|
+
### Installation
|
|
64
|
+
|
|
65
|
+
`import {MatBadgeModule} from '@angular/material/badge';`
|
|
66
|
+
|
|
67
|
+
[Official documentation](https://https://material.angular.io/components/badge/overview)
|
|
68
|
+
|
|
69
|
+
<br />
|