@redvars/peacock 3.8.1 → 3.8.2
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/dist/{BaseInput-14YmcfK7.js → BaseInput-CU1zZYKc.js} +3 -3
- package/dist/{BaseInput-14YmcfK7.js.map → BaseInput-CU1zZYKc.js.map} +1 -1
- package/dist/ButtonConstants-CahP2_NA.js +4 -0
- package/dist/ButtonConstants-CahP2_NA.js.map +1 -0
- package/dist/{IndividualComponent-DUINtMGK.js → IndividualComponent-Bdwyrvd6.js} +2 -2
- package/dist/{IndividualComponent-DUINtMGK.js.map → IndividualComponent-Bdwyrvd6.js.map} +1 -1
- package/dist/{NativeHyperlinkMixin-DrYXyfMQ.js → NativeHyperlinkMixin-D9J4aBTy.js} +4 -30
- package/dist/NativeHyperlinkMixin-D9J4aBTy.js.map +1 -0
- package/dist/accordion-item.js +338 -0
- package/dist/accordion-item.js.map +1 -0
- package/dist/accordion.js +159 -0
- package/dist/accordion.js.map +1 -0
- package/dist/alert.js +190 -0
- package/dist/alert.js.map +1 -0
- package/dist/app-bar.js +324 -0
- package/dist/app-bar.js.map +1 -0
- package/dist/assets/components.css +1 -1
- package/dist/assets/components.css.map +1 -1
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/attachable-controller-CAKVrfcG.js +119 -0
- package/dist/attachable-controller-CAKVrfcG.js.map +1 -0
- package/dist/avatar.js +114 -0
- package/dist/avatar.js.map +1 -0
- package/dist/badge.js +91 -0
- package/dist/badge.js.map +1 -0
- package/dist/base-Cl6v8-BZ.js +9 -0
- package/dist/base-Cl6v8-BZ.js.map +1 -0
- package/dist/bottom-sheet.js +14 -5
- package/dist/bottom-sheet.js.map +1 -1
- package/dist/breadcrumb-item.js +163 -0
- package/dist/breadcrumb-item.js.map +1 -0
- package/dist/breadcrumb.js +95 -0
- package/dist/breadcrumb.js.map +1 -0
- package/dist/button-group.js +87 -137
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +863 -133
- package/dist/button.js.map +1 -1
- package/dist/calendar-column-view.js +8 -4
- package/dist/calendar-column-view.js.map +1 -1
- package/dist/calendar-month-view.js +8 -4
- package/dist/calendar-month-view.js.map +1 -1
- package/dist/calendar.js +8 -4
- package/dist/calendar.js.map +1 -1
- package/dist/canvas.js +8 -4
- package/dist/canvas.js.map +1 -1
- package/dist/card-content.js +1 -1
- package/dist/card.js +23 -45
- package/dist/card.js.map +1 -1
- package/dist/cb-compound-expression.js +6 -2
- package/dist/cb-compound-expression.js.map +1 -1
- package/dist/cb-divider.js +7 -3
- package/dist/cb-divider.js.map +1 -1
- package/dist/cb-expression.js +6 -2
- package/dist/cb-expression.js.map +1 -1
- package/dist/cb-predicate.js +7 -3
- package/dist/cb-predicate.js.map +1 -1
- package/dist/{chart-bar-cn6rrna-.js → chart-bar-CYoGNXnK.js} +6 -2
- package/dist/{chart-bar-cn6rrna-.js.map → chart-bar-CYoGNXnK.js.map} +1 -1
- package/dist/chart-bar.js +7 -6
- package/dist/chart-bar.js.map +1 -1
- package/dist/chart-doughnut.js +8 -3
- package/dist/chart-doughnut.js.map +1 -1
- package/dist/chart-pie.js +8 -3
- package/dist/chart-pie.js.map +1 -1
- package/dist/chart-stacked-bar.js +7 -6
- package/dist/chart-stacked-bar.js.map +1 -1
- package/dist/checkbox.js +526 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/chip.js +459 -0
- package/dist/chip.js.map +1 -0
- package/dist/{class-map-YU7g0o3B.js → class-map-DG7CA1et.js} +2 -2
- package/dist/{class-map-YU7g0o3B.js.map → class-map-DG7CA1et.js.map} +1 -1
- package/dist/clock.js +6 -2
- package/dist/clock.js.map +1 -1
- package/dist/code-editor.js +45 -30
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +9 -5
- package/dist/code-highlighter.js.map +1 -1
- package/dist/condition-builder.js +5 -1
- package/dist/condition-builder.js.map +1 -1
- package/dist/container.js +141 -0
- package/dist/container.js.map +1 -0
- package/dist/custom-elements-jsdocs.json +721 -769
- package/dist/custom-elements.json +3213 -1979
- package/dist/datasource-B2eRh6Or.js +108 -0
- package/dist/datasource-B2eRh6Or.js.map +1 -0
- package/dist/dispatch-event-utils-CuEqjlPT.js.map +1 -1
- package/dist/divider.js +135 -0
- package/dist/divider.js.map +1 -0
- package/dist/dropdown-button.js +11 -6
- package/dist/dropdown-button.js.map +1 -1
- package/dist/element-internals-2CMts_0M.js +290 -0
- package/dist/element-internals-2CMts_0M.js.map +1 -0
- package/dist/elevation.js +94 -0
- package/dist/elevation.js.map +1 -0
- package/dist/empty-state.js +194 -0
- package/dist/empty-state.js.map +1 -0
- package/dist/{event-manager-D-QCmUgR.js → event-manager-DTyX2uYD.js} +2 -2
- package/dist/{event-manager-D-QCmUgR.js.map → event-manager-DTyX2uYD.js.map} +1 -1
- package/dist/fab.js +138 -145
- package/dist/fab.js.map +1 -1
- package/dist/field.js +461 -0
- package/dist/field.js.map +1 -0
- package/dist/{popover-DUPmMVWS.js → floating-controller-CnUZnOhK.js} +2 -171
- package/dist/floating-controller-CnUZnOhK.js.map +1 -0
- package/dist/{flow-designer-node-BWrPuxAR.js → flow-designer-node-DsVwQTac.js} +7 -3
- package/dist/{flow-designer-node-BWrPuxAR.js.map → flow-designer-node-DsVwQTac.js.map} +1 -1
- package/dist/flow-designer-node.js +3 -3
- package/dist/flow-designer.js +19 -12
- package/dist/flow-designer.js.map +1 -1
- package/dist/focus-ring.js +126 -0
- package/dist/focus-ring.js.map +1 -0
- package/dist/form-associated-BXADnjOB.js +388 -0
- package/dist/form-associated-BXADnjOB.js.map +1 -0
- package/dist/html-editor.js +21 -9
- package/dist/html-editor.js.map +1 -1
- package/dist/hyperlink-DLvb6MXE.js +98 -0
- package/dist/hyperlink-DLvb6MXE.js.map +1 -0
- package/dist/icon-button.js +1064 -0
- package/dist/icon-button.js.map +1 -0
- package/dist/icon.js +170 -0
- package/dist/icon.js.map +1 -0
- package/dist/if-defined-BXZpRQ4P.js +10 -0
- package/dist/if-defined-BXZpRQ4P.js.map +1 -0
- package/dist/image.js +201 -0
- package/dist/image.js.map +1 -0
- package/dist/index.js +73 -20
- package/dist/index.js.map +1 -1
- package/dist/is-dark-mode-DOcaw4Yq.js.map +1 -1
- package/dist/is-link-Dk2OV3PM.js +6 -0
- package/dist/is-link-Dk2OV3PM.js.map +1 -0
- package/dist/item.js +212 -0
- package/dist/item.js.map +1 -0
- package/dist/link.js +75 -0
- package/dist/link.js.map +1 -0
- package/dist/list-D6JLh1uh.js +352 -0
- package/dist/list-D6JLh1uh.js.map +1 -0
- package/dist/list.js +14 -0
- package/dist/list.js.map +1 -0
- package/dist/{peacock-loader.js → loader.js} +83 -22
- package/dist/loader.js.map +1 -0
- package/dist/menu-item.js +318 -0
- package/dist/menu-item.js.map +1 -0
- package/dist/menu.js +534 -0
- package/dist/menu.js.map +1 -0
- package/dist/modal.js +9 -5
- package/dist/modal.js.map +1 -1
- package/dist/navigation-rail-item.js +385 -0
- package/dist/navigation-rail-item.js.map +1 -0
- package/dist/navigation-rail.js +217 -0
- package/dist/navigation-rail.js.map +1 -0
- package/dist/notification-manager.js +8 -4
- package/dist/notification-manager.js.map +1 -1
- package/dist/notification.js +8 -4
- package/dist/notification.js.map +1 -1
- package/dist/number-counter.js +7 -3
- package/dist/number-counter.js.map +1 -1
- package/dist/{observe-slot-change-D8Xg-kSS.js → observe-slot-change-DPxaZrZF.js} +3 -4
- package/dist/observe-slot-change-DPxaZrZF.js.map +1 -0
- package/dist/option.js +121 -0
- package/dist/option.js.map +1 -0
- package/dist/pagination.js +255 -0
- package/dist/pagination.js.map +1 -0
- package/dist/popover-content.js +7 -3
- package/dist/popover-content.js.map +1 -1
- package/dist/popover.js +175 -3
- package/dist/popover.js.map +1 -1
- package/dist/{property-1psGvXOq.js → property-B49QQ8pS.js} +2 -2
- package/dist/{property-1psGvXOq.js.map → property-B49QQ8pS.js.map} +1 -1
- package/dist/query-CHb9Ft_d.js +10 -0
- package/dist/query-CHb9Ft_d.js.map +1 -0
- package/dist/query-assigned-elements-BJaGSqM0.js +10 -0
- package/dist/query-assigned-elements-BJaGSqM0.js.map +1 -0
- package/dist/radio.js +476 -0
- package/dist/radio.js.map +1 -0
- package/dist/ripple.js +506 -0
- package/dist/ripple.js.map +1 -0
- package/dist/search.js +12 -7
- package/dist/search.js.map +1 -1
- package/dist/segmented-button-group.js +137 -0
- package/dist/segmented-button-group.js.map +1 -0
- package/dist/segmented-button.js +289 -0
- package/dist/segmented-button.js.map +1 -0
- package/dist/select-Dwtk0RIU.js +3937 -0
- package/dist/select-Dwtk0RIU.js.map +1 -0
- package/dist/side-sheet.js +8 -4
- package/dist/side-sheet.js.map +1 -1
- package/dist/skeleton.js +122 -0
- package/dist/skeleton.js.map +1 -0
- package/dist/slider.js +346 -0
- package/dist/slider.js.map +1 -0
- package/dist/snackbar.js +335 -0
- package/dist/snackbar.js.map +1 -0
- package/dist/spinner.js +100 -0
- package/dist/spinner.js.map +1 -0
- package/dist/split-button.js +10 -5
- package/dist/split-button.js.map +1 -1
- package/dist/spread-B5cgadZl.js +32 -0
- package/dist/spread-B5cgadZl.js.map +1 -0
- package/dist/src/__internal/aria/aria.d.ts +98 -0
- package/dist/src/__internal/aria/delegate.d.ts +54 -0
- package/dist/src/__internal/events/dispatch-hooks.d.ts +80 -0
- package/dist/src/__internal/mixins/element-internals.d.ts +40 -0
- package/dist/src/__internal/mixins/form-associated.d.ts +174 -0
- package/dist/src/__internal/mixins/form-submitter.d.ts +59 -0
- package/dist/src/__internal/mixins/hyperlink.d.ts +42 -0
- package/dist/src/__internal/mixins/mixin.d.ts +49 -0
- package/dist/src/{__utils → __internal/utils}/observe-slot-change.d.ts +1 -0
- package/dist/src/accordion/accordion-item.d.ts +3 -1
- package/dist/src/accordion/accordion.d.ts +1 -1
- package/dist/src/alert/alert.d.ts +43 -0
- package/dist/src/alert/index.d.ts +1 -0
- package/dist/src/app-bar/app-bar.d.ts +92 -0
- package/dist/src/app-bar/index.d.ts +1 -0
- package/dist/src/avatar/avatar.d.ts +2 -0
- package/dist/src/bottom-sheet/bottom-sheet.d.ts +1 -1
- package/dist/src/breadcrumb/breadcrumb-item/breadcrumb-item.d.ts +1 -0
- package/dist/src/button/ButtonTypes.d.ts +5 -0
- package/dist/src/button/base-button/base-button.d.ts +18 -0
- package/dist/src/button/button/button.d.ts +29 -37
- package/dist/src/button/button-group/button-group.d.ts +17 -18
- package/dist/src/{fab → button/fab}/fab.d.ts +8 -26
- package/dist/src/button/icon-button/icon-button.d.ts +20 -27
- package/dist/src/button/index.d.ts +1 -0
- package/dist/src/calendar/calendar.d.ts +1 -1
- package/dist/src/canvas/canvas.d.ts +1 -1
- package/dist/src/card/card.d.ts +5 -6
- package/dist/src/chart-bar/chart-bar.d.ts +1 -1
- package/dist/src/chart-bar/chart-stacked-bar.d.ts +1 -1
- package/dist/src/checkbox/checkbox.d.ts +5 -1
- package/dist/src/chip/chip/chip.d.ts +9 -8
- package/dist/src/container/container.d.ts +5 -1
- package/dist/src/divider/divider.d.ts +2 -0
- package/dist/src/empty-state/empty-state.d.ts +1 -0
- package/dist/src/field/field.d.ts +19 -1
- package/dist/src/focus-ring/focus-ring.d.ts +3 -7
- package/dist/src/html-editor/html-editor.d.ts +1 -1
- package/dist/src/icon/icon.d.ts +9 -4
- package/dist/src/image/image.d.ts +4 -0
- package/dist/src/index.d.ts +7 -6
- package/dist/src/item/item.d.ts +20 -29
- package/dist/src/link/link.d.ts +1 -1
- package/dist/src/list/list-item.d.ts +7 -5
- package/dist/src/list/list.d.ts +3 -2
- package/dist/src/menu/menu/menu.d.ts +14 -0
- package/dist/src/menu/menu-item/menu-item.d.ts +10 -2
- package/dist/src/modal/modal.d.ts +1 -1
- package/dist/src/navigation-rail/navigation-rail-item.d.ts +5 -4
- package/dist/src/navigation-rail/navigation-rail.d.ts +1 -1
- package/dist/src/radio/radio.d.ts +5 -0
- package/dist/src/ripple/ripple.d.ts +10 -1
- package/dist/src/search/search.d.ts +1 -1
- package/dist/src/segmented-button/segmented-button-group.d.ts +2 -2
- package/dist/src/segmented-button/segmented-button.d.ts +2 -0
- package/dist/src/side-sheet/side-sheet.d.ts +1 -1
- package/dist/src/skeleton/skeleton.d.ts +1 -0
- package/dist/src/slider/slider.d.ts +1 -0
- package/dist/src/snackbar/snackbar.d.ts +12 -2
- package/dist/src/svg/svg.d.ts +5 -0
- package/dist/src/table/table.d.ts +5 -0
- package/dist/src/tabs/tab.d.ts +2 -7
- package/dist/src/toolbar/toolbar.d.ts +2 -2
- package/dist/{state-DwbEjqVk.js → state-DkTK9EGF.js} +2 -2
- package/dist/{state-DwbEjqVk.js.map → state-DkTK9EGF.js.map} +1 -1
- package/dist/{style-map-DVmWOuYy.js → style-map-BQD5Et1D.js} +2 -2
- package/dist/{style-map-DVmWOuYy.js.map → style-map-BQD5Et1D.js.map} +1 -1
- package/dist/sub-menu.js +241 -0
- package/dist/sub-menu.js.map +1 -0
- package/dist/svg.js +273 -0
- package/dist/svg.js.map +1 -0
- package/dist/tab-group.js +188 -0
- package/dist/tab-group.js.map +1 -0
- package/dist/tab-panel.js +61 -0
- package/dist/tab-panel.js.map +1 -0
- package/dist/tab.js +658 -0
- package/dist/tab.js.map +1 -0
- package/dist/table.js +620 -0
- package/dist/table.js.map +1 -0
- package/dist/tabs.js +240 -0
- package/dist/tabs.js.map +1 -0
- package/dist/throttle-C7ZAPqtu.js +24 -0
- package/dist/throttle-C7ZAPqtu.js.map +1 -0
- package/dist/toolbar.js +9 -5
- package/dist/toolbar.js.map +1 -1
- package/dist/tooltip.js +270 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{unsafe-html-BsGUjx94.js → unsafe-html-Ct0N2_UU.js} +2 -2
- package/dist/{unsafe-html-BsGUjx94.js.map → unsafe-html-Ct0N2_UU.js.map} +1 -1
- package/dist/when-DEJm_QN9.js +9 -0
- package/dist/when-DEJm_QN9.js.map +1 -0
- package/package.json +4 -2
- package/readme.md +3 -3
- package/scss/mixin.scss +8 -6
- package/src/__internal/aria/aria.ts +293 -0
- package/src/__internal/aria/delegate.ts +206 -0
- package/src/__internal/events/dispatch-hooks.ts +182 -0
- package/src/__internal/mixins/element-internals.ts +73 -0
- package/src/__internal/mixins/form-associated.ts +295 -0
- package/src/__internal/mixins/form-submitter.ts +133 -0
- package/src/__internal/mixins/hyperlink.ts +71 -0
- package/src/__internal/mixins/mixin.ts +58 -0
- package/src/{__utils → __internal/utils}/observe-slot-change.ts +2 -5
- package/src/accordion/accordion-item.ts +6 -2
- package/src/accordion/accordion.ts +4 -2
- package/src/accordion/demo/index.html +95 -90
- package/src/alert/alert.scss +82 -0
- package/src/{banner/banner.ts → alert/alert.ts} +22 -22
- package/src/alert/index.ts +1 -0
- package/src/app-bar/app-bar-colors.scss +17 -0
- package/src/app-bar/app-bar.scss +165 -0
- package/src/app-bar/app-bar.ts +155 -0
- package/src/app-bar/index.ts +1 -0
- package/src/avatar/avatar.ts +4 -0
- package/src/badge/badge.ts +2 -0
- package/src/bottom-sheet/bottom-sheet.ts +8 -2
- package/src/breadcrumb/breadcrumb/breadcrumb.ts +2 -0
- package/src/breadcrumb/breadcrumb-item/breadcrumb-item.ts +3 -0
- package/src/button/ButtonTypes.ts +17 -0
- package/src/button/base-button/base-button.ts +85 -0
- package/src/button/button/button-base.scss +306 -0
- package/src/button/button/button-colors.scss +27 -32
- package/src/button/button/button-layers.scss +126 -39
- package/src/button/button/button-shapes.scss +73 -0
- package/src/button/button/button.scss +12 -286
- package/src/button/button/button.ts +174 -194
- package/src/button/button-group/button-group.scss +43 -36
- package/src/button/button-group/button-group.ts +26 -137
- package/src/{fab → button/fab}/fab-colors.scss +0 -10
- package/src/button/fab/fab-sizes.scss +37 -0
- package/src/button/fab/fab.scss +172 -0
- package/src/{fab → button/fab}/fab.ts +69 -105
- package/src/button/icon-button/icon-button-sizes.scss +18 -3
- package/src/button/icon-button/icon-button.scss +5 -0
- package/src/button/icon-button/icon-button.ts +111 -141
- package/src/button/index.ts +7 -0
- package/src/calendar/calendar.ts +2 -2
- package/src/canvas/canvas.ts +2 -2
- package/src/card/card.scss +3 -3
- package/src/card/card.ts +20 -40
- package/src/chart-bar/chart-bar.ts +2 -2
- package/src/chart-bar/chart-stacked-bar.ts +2 -2
- package/src/checkbox/checkbox.ts +12 -4
- package/src/chip/chip/chip.scss +1 -1
- package/src/chip/chip/chip.ts +35 -55
- package/src/chip/demo/index.html +30 -26
- package/src/code-editor/code-editor.ts +68 -58
- package/src/code-editor/demo/index.html +32 -27
- package/src/code-highlighter/code-highlighter.ts +1 -1
- package/src/code-highlighter/demo/index.html +24 -21
- package/src/container/container.ts +8 -2
- package/src/date-picker/date-picker.ts +2 -3
- package/src/divider/divider.ts +5 -1
- package/src/dropdown-button/demo/index.html +106 -101
- package/src/dropdown-button/dropdown-button.ts +1 -1
- package/src/elevation/elevation.ts +2 -0
- package/src/empty-state/empty-state.ts +3 -0
- package/src/field/field.ts +52 -33
- package/src/focus-ring/focus-ring.ts +5 -7
- package/src/html-editor/html-editor.ts +28 -16
- package/src/icon/datasource.ts +1 -1
- package/src/icon/icon.ts +27 -15
- package/src/image/image.ts +18 -6
- package/src/index.ts +24 -6
- package/src/input/input.ts +2 -2
- package/src/item/item.scss +126 -162
- package/src/item/item.ts +70 -323
- package/src/link/link.ts +3 -1
- package/src/list/list-item.scss +43 -31
- package/src/list/list-item.ts +79 -75
- package/src/list/list.scss +1 -13
- package/src/list/list.ts +6 -3
- package/src/{peacock-loader.ts → loader.ts} +91 -79
- package/src/menu/menu/menu.scss +14 -11
- package/src/menu/menu/menu.ts +20 -8
- package/src/menu/menu-item/menu-item.scss +35 -3
- package/src/menu/menu-item/menu-item.ts +40 -34
- package/src/menu/sub-menu/sub-menu.ts +3 -0
- package/src/modal/modal.ts +2 -2
- package/src/navigation-rail/navigation-rail-item.ts +21 -36
- package/src/navigation-rail/navigation-rail.scss +1 -0
- package/src/navigation-rail/navigation-rail.ts +4 -2
- package/src/number-field/number-field.ts +2 -2
- package/src/pagination/pagination.ts +2 -0
- package/src/popover/popover.ts +3 -3
- package/src/radio/radio.ts +13 -5
- package/src/ripple/ripple.ts +14 -1
- package/src/search/search.ts +3 -3
- package/src/segmented-button/segmented-button-group.ts +8 -4
- package/src/segmented-button/segmented-button.ts +4 -0
- package/src/select/option.ts +2 -0
- package/src/side-sheet/side-sheet.ts +2 -2
- package/src/sidebar-menu/sidebar-menu-item.ts +3 -2
- package/src/skeleton/skeleton.ts +3 -0
- package/src/slider/slider.ts +4 -1
- package/src/snackbar/snackbar.ts +40 -25
- package/src/spinner/spinner.ts +2 -0
- package/src/svg/svg.ts +27 -9
- package/src/switch/switch.ts +1 -1
- package/src/table/table.ts +16 -3
- package/src/tabs/demo/index.html +79 -79
- package/src/tabs/tab-group.ts +2 -0
- package/src/tabs/tab-panel.ts +2 -0
- package/src/tabs/tab.scss +4 -4
- package/src/tabs/tab.ts +16 -39
- package/src/tabs/tabs.ts +2 -0
- package/src/textarea/textarea.ts +2 -2
- package/src/time-picker/time-picker.ts +2 -2
- package/src/toolbar/toolbar.ts +3 -3
- package/src/tooltip/tooltip.ts +14 -8
- package/src/url-field/url-field.ts +2 -3
- package/dist/ButtonConstants-D06bY4uy.js +0 -114
- package/dist/ButtonConstants-D06bY4uy.js.map +0 -1
- package/dist/NativeHyperlinkMixin-DrYXyfMQ.js.map +0 -1
- package/dist/banner.js +0 -186
- package/dist/banner.js.map +0 -1
- package/dist/button-colors-D7sJyPy8.js +0 -586
- package/dist/button-colors-D7sJyPy8.js.map +0 -1
- package/dist/icon-CueRR7wx.js +0 -260
- package/dist/icon-CueRR7wx.js.map +0 -1
- package/dist/icon-button-CAzYr_qr.js +0 -318
- package/dist/icon-button-CAzYr_qr.js.map +0 -1
- package/dist/navigation-rail-CM_svs5_.js +0 -14184
- package/dist/navigation-rail-CM_svs5_.js.map +0 -1
- package/dist/observe-slot-change-D8Xg-kSS.js.map +0 -1
- package/dist/peacock-loader.js.map +0 -1
- package/dist/popover-DUPmMVWS.js.map +0 -1
- package/dist/query-QBcUV-L_.js +0 -15
- package/dist/query-QBcUV-L_.js.map +0 -1
- package/dist/src/banner/banner.d.ts +0 -43
- package/dist/src/banner/index.d.ts +0 -1
- package/dist/src/button/GroupButtonInterface.d.ts +0 -4
- package/src/banner/banner.scss +0 -82
- package/src/banner/index.ts +0 -1
- package/src/button/GroupButtonInterface.ts +0 -4
- package/src/button/button/only-button.scss +0 -13
- package/src/fab/fab-sizes.scss +0 -37
- package/src/fab/fab.scss +0 -143
- /package/dist/src/{__controllers → __internal/controllers}/attachable-controller.d.ts +0 -0
- /package/dist/src/{__controllers → __internal/controllers}/floating-controller.d.ts +0 -0
- /package/dist/src/{__directive → __internal/directive}/spread.d.ts +0 -0
- /package/dist/src/{__mixins → __internal/mixins}/MixinConstructor.d.ts +0 -0
- /package/dist/src/{__mixins → __internal/mixins}/NativeButtonMixin.d.ts +0 -0
- /package/dist/src/{__mixins → __internal/mixins}/NativeHyperlinkMixin.d.ts +0 -0
- /package/dist/src/{__utils → __internal/utils}/cache-fetch.d.ts +0 -0
- /package/dist/src/{__utils → __internal/utils}/copy-to-clipboard.d.ts +0 -0
- /package/dist/src/{__utils → __internal/utils}/dispatch-event-utils.d.ts +0 -0
- /package/dist/src/{__utils → __internal/utils}/is-dark-mode.d.ts +0 -0
- /package/dist/src/{__utils → __internal/utils}/is-in-viewport.d.ts +0 -0
- /package/dist/src/{__utils → __internal/utils}/is-link.d.ts +0 -0
- /package/dist/src/{__utils → __internal/utils}/observe-theme-change.d.ts +0 -0
- /package/dist/src/{__utils → __internal/utils}/sanitize-svg.d.ts +0 -0
- /package/dist/src/{__utils → __internal/utils}/throttle.d.ts +0 -0
- /package/dist/src/{fab → button/fab}/index.d.ts +0 -0
- /package/dist/src/{peacock-loader.d.ts → loader.d.ts} +0 -0
- /package/dist/test/{banner.test.d.ts → alert.test.d.ts} +0 -0
- /package/src/{__controllers → __internal/controllers}/attachable-controller.ts +0 -0
- /package/src/{__controllers → __internal/controllers}/floating-controller.ts +0 -0
- /package/src/{__directive → __internal/directive}/spread.ts +0 -0
- /package/src/{__mixins → __internal/mixins}/MixinConstructor.ts +0 -0
- /package/src/{__mixins → __internal/mixins}/NativeButtonMixin.ts +0 -0
- /package/src/{__mixins → __internal/mixins}/NativeHyperlinkMixin.ts +0 -0
- /package/src/{__mixins → __internal/mixins}/README.md +0 -0
- /package/src/{__utils → __internal/utils}/cache-fetch.ts +0 -0
- /package/src/{__utils → __internal/utils}/copy-to-clipboard.ts +0 -0
- /package/src/{__utils → __internal/utils}/dispatch-event-utils.ts +0 -0
- /package/src/{__utils → __internal/utils}/is-dark-mode.ts +0 -0
- /package/src/{__utils → __internal/utils}/is-in-viewport.ts +0 -0
- /package/src/{__utils → __internal/utils}/is-link.ts +0 -0
- /package/src/{__utils → __internal/utils}/observe-theme-change.ts +0 -0
- /package/src/{__utils → __internal/utils}/sanitize-svg.ts +0 -0
- /package/src/{__utils → __internal/utils}/throttle.ts +0 -0
- /package/src/{fab → button/fab}/index.ts +0 -0
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
import { html, LitElement, nothing } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
2
|
+
import { property, query } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
5
|
import { when } from 'lit/directives/when.js';
|
|
6
6
|
import IndividualComponent from '@/IndividualComponent.js';
|
|
7
7
|
import styles from './button.scss';
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import { GroupButtonInterface } from '@/button/GroupButtonInterface.js';
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
ButtonSize,
|
|
11
|
+
ButtonLevel,
|
|
12
|
+
ButtonShape,
|
|
13
|
+
ButtonVariant,
|
|
14
|
+
ButtonColor,
|
|
15
|
+
} from '@/button/ButtonTypes.js';
|
|
16
|
+
import { isLink } from '@/__internal/utils/is-link.js';
|
|
17
|
+
import { observerSlotChangesWithCallback } from '@/__internal/utils/observe-slot-change.js';
|
|
19
18
|
import {
|
|
20
19
|
dispatchActivationClick,
|
|
21
20
|
isActivationClick,
|
|
22
|
-
} from '@/
|
|
21
|
+
} from '@/__internal/utils/dispatch-event-utils.js';
|
|
23
22
|
import { DISABLED_REASON_ID } from '@/button/ButtonConstants.js';
|
|
23
|
+
import { mixinDelegatesAria } from '@/__internal/aria/delegate.js';
|
|
24
|
+
import { ARIAMixinStrict } from '@/__internal/aria/aria.js';
|
|
25
|
+
import { mixinFormSubmitter } from '@/__internal/mixins/form-submitter.js';
|
|
26
|
+
import { mixinElementInternals } from '@/__internal/mixins/element-internals.js';
|
|
27
|
+
import { mixinBaseButton } from '../base-button/base-button.js';
|
|
28
|
+
import { mixinFormAssociated } from '@/__internal/mixins/form-associated.js';
|
|
29
|
+
import { mixinHyperlink } from '@/__internal/mixins/hyperlink.js';
|
|
30
|
+
export type {
|
|
31
|
+
ButtonSize,
|
|
32
|
+
ButtonLevel,
|
|
33
|
+
ButtonShape,
|
|
34
|
+
ButtonVariant,
|
|
35
|
+
ButtonColor,
|
|
36
|
+
} from '@/button/ButtonTypes.js';
|
|
24
37
|
|
|
25
38
|
/**
|
|
26
39
|
* @label Button
|
|
@@ -65,17 +78,26 @@ import { DISABLED_REASON_ID } from '@/button/ButtonConstants.js';
|
|
|
65
78
|
* @tags display
|
|
66
79
|
*/
|
|
67
80
|
@IndividualComponent
|
|
68
|
-
export class Button
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
export class Button extends mixinBaseButton(
|
|
82
|
+
mixinHyperlink(
|
|
83
|
+
mixinDelegatesAria(
|
|
84
|
+
mixinFormSubmitter(
|
|
85
|
+
mixinFormAssociated(mixinElementInternals(LitElement)),
|
|
86
|
+
),
|
|
87
|
+
),
|
|
88
|
+
),
|
|
89
|
+
) {
|
|
90
|
+
// ── Static ───────────────────────────────────────────────────────────────
|
|
91
|
+
|
|
92
|
+
/** @nocollapse */ // eslint-disable-next-line
|
|
93
|
+
static override shadowRootOptions: ShadowRootInit = {
|
|
94
|
+
mode: 'open',
|
|
95
|
+
delegatesFocus: true,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
static override styles = [styles];
|
|
99
|
+
|
|
100
|
+
// ── Properties ───────────────────────────────────────────────────────────
|
|
79
101
|
|
|
80
102
|
/**
|
|
81
103
|
* Icon alignment.
|
|
@@ -88,13 +110,15 @@ export class Button
|
|
|
88
110
|
* Button size.
|
|
89
111
|
* Possible values are `"xs"`, `"sm"`, `"md"`, `"lg"`, `"xl"`. Defaults to `"sm"`.
|
|
90
112
|
*/
|
|
91
|
-
@property({ reflect: true }) size:
|
|
113
|
+
@property({ reflect: true }) size: ButtonSize = 'sm';
|
|
92
114
|
|
|
93
115
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
116
|
+
* Level is preset of color and variant. If Level provided it overrides the default color and variant.
|
|
96
117
|
*/
|
|
97
|
-
@property({ type: String })
|
|
118
|
+
@property({ type: String }) level?: ButtonLevel;
|
|
119
|
+
|
|
120
|
+
/** Shape of the button container. */
|
|
121
|
+
@property({ type: String, reflect: true }) shape: ButtonShape = 'square';
|
|
98
122
|
|
|
99
123
|
/**
|
|
100
124
|
* The visual style of the button.
|
|
@@ -106,45 +130,64 @@ export class Button
|
|
|
106
130
|
* `"tonal"` is a light color button.
|
|
107
131
|
* `"elevated"` is elevated button
|
|
108
132
|
*/
|
|
109
|
-
@property({ reflect: true }) variant:
|
|
110
|
-
| 'elevated'
|
|
111
|
-
| 'filled'
|
|
112
|
-
| 'tonal'
|
|
113
|
-
| 'outlined'
|
|
114
|
-
| 'text'
|
|
115
|
-
| 'neo' = 'filled';
|
|
133
|
+
@property({ reflect: true }) variant: ButtonVariant = 'filled';
|
|
116
134
|
|
|
117
135
|
/**
|
|
118
136
|
* Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.
|
|
119
137
|
*/
|
|
120
|
-
@property({ reflect: true }) color:
|
|
121
|
-
| 'primary'
|
|
122
|
-
| 'success'
|
|
123
|
-
| 'danger'
|
|
124
|
-
| 'warning'
|
|
125
|
-
| 'surface'
|
|
126
|
-
| 'on-surface' = 'primary';
|
|
138
|
+
@property({ reflect: true }) color: ButtonColor = 'primary';
|
|
127
139
|
|
|
128
|
-
/**
|
|
129
|
-
|
|
130
|
-
*/
|
|
131
|
-
@property({ reflect: true })
|
|
132
|
-
configAria?: { [key: string]: any };
|
|
140
|
+
/** When true, renders the button in a loading skeleton state. */
|
|
141
|
+
@property({ type: Boolean, reflect: true }) skeleton: boolean = false;
|
|
133
142
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
143
|
+
/** When true, the button acts as a toggle. Use with `selected`. */
|
|
144
|
+
@property({ type: Boolean, reflect: true }) toggle: boolean = false;
|
|
137
145
|
|
|
138
|
-
|
|
139
|
-
|
|
146
|
+
/** When true (and `toggle` is set), the button is in the selected/pressed state. */
|
|
147
|
+
@property({ type: Boolean, reflect: true }) selected: boolean = false;
|
|
148
|
+
|
|
149
|
+
/** Optional tooltip text displayed on hover. */
|
|
150
|
+
@property() tooltip?: string;
|
|
151
|
+
|
|
152
|
+
// ── Queries ───────────────────────────────────────────────────────────────
|
|
153
|
+
|
|
154
|
+
@query('.button') private readonly buttonElement!: HTMLElement | null;
|
|
155
|
+
|
|
156
|
+
// ── Private fields ────────────────────────────────────────────────────────
|
|
157
|
+
|
|
158
|
+
/** Cleanup returned by observerSlotChangesWithCallback for the icon slot. */
|
|
159
|
+
private __iconSlotCleanup: (() => void) | null = null;
|
|
160
|
+
|
|
161
|
+
/** Cleanup returned by observerSlotChangesWithCallback for the label slot. */
|
|
162
|
+
private __labelSlotCleanup: (() => void) | null = null;
|
|
163
|
+
|
|
164
|
+
// ── Constructor ───────────────────────────────────────────────────────────
|
|
165
|
+
|
|
166
|
+
constructor() {
|
|
167
|
+
super();
|
|
168
|
+
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
140
169
|
}
|
|
141
170
|
|
|
142
|
-
|
|
143
|
-
this.__dispatchClickWithThrottle = throttle(
|
|
144
|
-
this.__dispatchClick,
|
|
145
|
-
this.throttleDelay,
|
|
146
|
-
);
|
|
171
|
+
// ── Lifecycle ─────────────────────────────────────────────────────────────
|
|
147
172
|
|
|
173
|
+
override disconnectedCallback() {
|
|
174
|
+
// disconnect slot observers first to avoid callbacks during teardown
|
|
175
|
+
try {
|
|
176
|
+
this.__iconSlotCleanup?.();
|
|
177
|
+
} catch (e) {
|
|
178
|
+
/* ignore */
|
|
179
|
+
}
|
|
180
|
+
try {
|
|
181
|
+
this.__labelSlotCleanup?.();
|
|
182
|
+
} catch (e) {
|
|
183
|
+
/* ignore */
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
super.disconnectedCallback();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
override firstUpdated(changedProperties: Map<PropertyKey, unknown>) {
|
|
190
|
+
super.firstUpdated(changedProperties);
|
|
148
191
|
this.__convertTypeToVariantAndColor();
|
|
149
192
|
// Initialize slot presence tracking for smooth transitions when label/icon are added/removed
|
|
150
193
|
const iconSlot = this.renderRoot.querySelector(
|
|
@@ -174,43 +217,53 @@ export class Button
|
|
|
174
217
|
}
|
|
175
218
|
}
|
|
176
219
|
|
|
220
|
+
// ── Public methods ────────────────────────────────────────────────────────
|
|
221
|
+
|
|
222
|
+
override focus() {
|
|
223
|
+
this.buttonElement?.focus();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
override blur() {
|
|
227
|
+
this.buttonElement?.blur();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// ── Private methods ───────────────────────────────────────────────────────
|
|
231
|
+
|
|
177
232
|
__convertTypeToVariantAndColor() {
|
|
178
|
-
if (this.
|
|
233
|
+
if (this.level === 'primary') {
|
|
179
234
|
this.color = 'primary';
|
|
180
235
|
this.variant = 'filled';
|
|
181
|
-
} else if (this.
|
|
236
|
+
} else if (this.level === 'secondary') {
|
|
182
237
|
this.color = 'surface';
|
|
183
|
-
this.variant = '
|
|
184
|
-
} else if (this.
|
|
238
|
+
this.variant = 'tonal';
|
|
239
|
+
} else if (this.level === 'tertiary') {
|
|
185
240
|
this.color = 'primary';
|
|
186
241
|
this.variant = 'text';
|
|
187
|
-
} else if (this.
|
|
242
|
+
} else if (this.level === 'danger') {
|
|
188
243
|
this.color = 'danger';
|
|
189
244
|
this.variant = 'filled';
|
|
190
245
|
}
|
|
191
246
|
}
|
|
192
247
|
|
|
193
|
-
|
|
194
|
-
|
|
248
|
+
__dispatchClick = (event: MouseEvent | KeyboardEvent) => {
|
|
249
|
+
// If the button is soft-disabled or a disabled link, we need to explicitly
|
|
250
|
+
// prevent the click from propagating to other event listeners as well as
|
|
251
|
+
// prevent the default action.
|
|
252
|
+
if (this.softDisabled || (this.disabled && this.href) || this.skeleton) {
|
|
253
|
+
event.stopImmediatePropagation();
|
|
254
|
+
event.preventDefault();
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
195
257
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
${when(
|
|
200
|
-
this.variant === 'neo',
|
|
201
|
-
() => html`<div class="neo-background"></div>`,
|
|
202
|
-
)}
|
|
203
|
-
<div class="background"></div>
|
|
204
|
-
${when(
|
|
205
|
-
this.variant === 'outlined' || this.variant === 'neo',
|
|
206
|
-
() => html`<div class="outline"></div>`,
|
|
207
|
-
)}
|
|
208
|
-
<wc-ripple class="ripple" for=${buttonId}></wc-ripple>
|
|
209
|
-
<wc-skeleton class="skeleton"></wc-skeleton>
|
|
258
|
+
if (!isActivationClick(event) || !this.buttonElement) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
210
261
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
262
|
+
this.focus();
|
|
263
|
+
dispatchActivationClick(this.buttonElement);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// ── Render helpers ────────────────────────────────────────────────────────
|
|
214
267
|
|
|
215
268
|
renderButtonElement() {
|
|
216
269
|
const isElementLink = isLink(this);
|
|
@@ -222,6 +275,9 @@ export class Button
|
|
|
222
275
|
'trailing-icon': this.trailingIcon,
|
|
223
276
|
};
|
|
224
277
|
|
|
278
|
+
// Needed for closure conformance
|
|
279
|
+
const { ariaLabel, ariaHasPopup, ariaExpanded } = this as ARIAMixinStrict;
|
|
280
|
+
|
|
225
281
|
if (isElementLink) {
|
|
226
282
|
return html`<a
|
|
227
283
|
class=${classMap(cssClasses)}
|
|
@@ -229,16 +285,13 @@ export class Button
|
|
|
229
285
|
href=${this.href}
|
|
230
286
|
target=${this.target}
|
|
231
287
|
tabindex=${this.disabled ? '-1' : '0'}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
@keyup=${this.__handlePress}
|
|
236
|
-
role="button"
|
|
288
|
+
aria-label="${ariaLabel || nothing}"
|
|
289
|
+
aria-haspopup="${ariaHasPopup || nothing}"
|
|
290
|
+
aria-expanded="${ariaExpanded || nothing}"
|
|
237
291
|
aria-describedby=${ifDefined(
|
|
238
292
|
this.softDisabled ? DISABLED_REASON_ID : undefined,
|
|
239
293
|
)}
|
|
240
294
|
?aria-disabled=${this.softDisabled}
|
|
241
|
-
${spread(this.configAria)}
|
|
242
295
|
>
|
|
243
296
|
${this.renderButtonContent()}
|
|
244
297
|
</a>`;
|
|
@@ -246,21 +299,18 @@ export class Button
|
|
|
246
299
|
return html`<button
|
|
247
300
|
class=${classMap(cssClasses)}
|
|
248
301
|
id="button"
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
@keydown=${this.__handlePress}
|
|
253
|
-
@keyup=${this.__handlePress}
|
|
302
|
+
aria-label="${ariaLabel || nothing}"
|
|
303
|
+
aria-haspopup="${ariaHasPopup || nothing}"
|
|
304
|
+
aria-expanded="${ariaExpanded || nothing}"
|
|
254
305
|
aria-describedby=${ifDefined(
|
|
255
306
|
this.softDisabled ? DISABLED_REASON_ID : undefined,
|
|
256
307
|
)}
|
|
257
308
|
?aria-disabled=${this.softDisabled}
|
|
258
309
|
?disabled=${this.disabled}
|
|
259
|
-
${spread(this.configAria)}
|
|
260
310
|
>
|
|
261
311
|
${this.renderButtonContent()}
|
|
262
312
|
</button>
|
|
263
|
-
${this.
|
|
313
|
+
${this.renderTooltip()}`;
|
|
264
314
|
}
|
|
265
315
|
|
|
266
316
|
renderButtonContent() {
|
|
@@ -268,106 +318,10 @@ export class Button
|
|
|
268
318
|
<slot class="label"></slot>
|
|
269
319
|
<div class="touch"></div>
|
|
270
320
|
|
|
271
|
-
${this.
|
|
321
|
+
${this.renderDisabledReason(this.softDisabled)}`;
|
|
272
322
|
}
|
|
273
323
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
@property({ type: Boolean, reflect: true }) toggle: boolean = false;
|
|
277
|
-
|
|
278
|
-
@property({ type: Boolean, reflect: true }) selected: boolean = false;
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
|
|
282
|
-
*/
|
|
283
|
-
@property() throttleDelay = 200;
|
|
284
|
-
|
|
285
|
-
@property() tooltip?: string;
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* States
|
|
289
|
-
*/
|
|
290
|
-
@property({ type: Boolean, reflect: true })
|
|
291
|
-
pressed = false;
|
|
292
|
-
|
|
293
|
-
// Query the internal control (button or link) on demand instead of
|
|
294
|
-
// keeping a persistent query reference.
|
|
295
|
-
|
|
296
|
-
// cleanup functions returned by observerSlotChangesWithCallback
|
|
297
|
-
private __iconSlotCleanup: (() => void) | null = null;
|
|
298
|
-
|
|
299
|
-
private __labelSlotCleanup: (() => void) | null = null;
|
|
300
|
-
|
|
301
|
-
override connectedCallback() {
|
|
302
|
-
super.connectedCallback();
|
|
303
|
-
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
304
|
-
window.addEventListener('mouseup', this.__handlePress);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
override disconnectedCallback() {
|
|
308
|
-
// disconnect slot observers first to avoid callbacks during teardown
|
|
309
|
-
try {
|
|
310
|
-
this.__iconSlotCleanup?.();
|
|
311
|
-
} catch (e) {
|
|
312
|
-
/* ignore */
|
|
313
|
-
}
|
|
314
|
-
try {
|
|
315
|
-
this.__labelSlotCleanup?.();
|
|
316
|
-
} catch (e) {
|
|
317
|
-
/* ignore */
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
window.removeEventListener('mouseup', this.__handlePress);
|
|
321
|
-
this.removeEventListener('click', this.__dispatchClickWithThrottle);
|
|
322
|
-
super.disconnectedCallback();
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
__handlePress = (event: KeyboardEvent | MouseEvent) => {
|
|
326
|
-
if (this.disabled || this.skeleton || this.softDisabled) return;
|
|
327
|
-
this.pressed =
|
|
328
|
-
(event instanceof KeyboardEvent &&
|
|
329
|
-
event.type === 'keydown' &&
|
|
330
|
-
(event.key === 'Enter' || event.key === ' ')) ||
|
|
331
|
-
event.type === 'mousedown';
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
__dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =
|
|
335
|
-
event => {
|
|
336
|
-
this.__dispatchClick(event);
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
__dispatchClick = (event: MouseEvent | KeyboardEvent) => {
|
|
340
|
-
// If the button is soft-disabled or a disabled link, we need to explicitly
|
|
341
|
-
// prevent the click from propagating to other event listeners as well as
|
|
342
|
-
// prevent the default action.
|
|
343
|
-
if (this.softDisabled || (this.disabled && this.href) || this.skeleton) {
|
|
344
|
-
event.stopImmediatePropagation();
|
|
345
|
-
event.preventDefault();
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
const control = this.getControl();
|
|
350
|
-
|
|
351
|
-
if (!isActivationClick(event) || !control) {
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
if (this.toggle) {
|
|
356
|
-
this.selected = !this.selected;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
this.focus();
|
|
360
|
-
dispatchActivationClick(control);
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
private getControl(): HTMLElement | null {
|
|
364
|
-
return (
|
|
365
|
-
(this.renderRoot?.querySelector('#button') as HTMLElement | null) ??
|
|
366
|
-
(this.renderRoot?.querySelector('#link') as HTMLElement | null)
|
|
367
|
-
);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
__renderDisabledReason(softDisabled: boolean) {
|
|
324
|
+
renderDisabledReason(softDisabled: boolean) {
|
|
371
325
|
if (softDisabled)
|
|
372
326
|
return html`<div
|
|
373
327
|
id=${DISABLED_REASON_ID}
|
|
@@ -380,11 +334,37 @@ export class Button
|
|
|
380
334
|
return nothing;
|
|
381
335
|
}
|
|
382
336
|
|
|
383
|
-
|
|
337
|
+
renderTooltip() {
|
|
384
338
|
if (this.tooltip) {
|
|
385
339
|
const buttonId = isLink(this) ? 'link' : 'button';
|
|
386
|
-
return html`<wc-tooltip class="tooltip" for=${buttonId}
|
|
340
|
+
return html`<wc-tooltip class="tooltip" for=${buttonId}
|
|
341
|
+
>${this.tooltip}</wc-tooltip
|
|
342
|
+
>`;
|
|
387
343
|
}
|
|
388
344
|
return nothing;
|
|
389
345
|
}
|
|
346
|
+
|
|
347
|
+
// ── Render ────────────────────────────────────────────────────────────────
|
|
348
|
+
|
|
349
|
+
override render() {
|
|
350
|
+
const buttonId = isLink(this) ? 'link' : 'button';
|
|
351
|
+
|
|
352
|
+
return html`
|
|
353
|
+
<wc-focus-ring class="focus-ring" for=${buttonId}></wc-focus-ring>
|
|
354
|
+
<wc-elevation class="elevation"></wc-elevation>
|
|
355
|
+
${when(
|
|
356
|
+
this.variant === 'neo',
|
|
357
|
+
() => html`<div class="neo-background"></div>`,
|
|
358
|
+
)}
|
|
359
|
+
<div class="background"></div>
|
|
360
|
+
${when(
|
|
361
|
+
this.variant === 'outlined' || this.variant === 'neo',
|
|
362
|
+
() => html`<div class="outline"></div>`,
|
|
363
|
+
)}
|
|
364
|
+
<wc-ripple class="ripple" for=${buttonId}></wc-ripple>
|
|
365
|
+
<wc-skeleton class="skeleton"></wc-skeleton>
|
|
366
|
+
|
|
367
|
+
${this.renderButtonElement()} ${this.renderTooltip()}
|
|
368
|
+
`;
|
|
369
|
+
}
|
|
390
370
|
}
|
|
@@ -4,61 +4,68 @@
|
|
|
4
4
|
|
|
5
5
|
$border-width: 0.0625rem;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
:host {
|
|
8
|
+
--button-group-spacing: unset;
|
|
8
9
|
display: flex;
|
|
9
|
-
gap: var(--
|
|
10
|
+
gap: var(--button-group-spacing, var(--private-button-group-spacing));
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
|
|
13
13
|
// Size-specific rules (can be overridden by variant rules below)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
--
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
.button-group.size-sm,
|
|
21
|
-
.button-group.size-small {
|
|
22
|
-
--_button-group-gap: 0.125rem;
|
|
23
|
-
--button-container-padding: 1.5rem;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.button-group.size-md,
|
|
27
|
-
.button-group.size-medium {
|
|
28
|
-
--_button-group-gap: 0.125rem;
|
|
14
|
+
:host([size='xs']),
|
|
15
|
+
:host([size='extra-small']) {
|
|
16
|
+
--private-button-group-spacing: var(--spacing-200);
|
|
29
17
|
}
|
|
30
18
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
--
|
|
19
|
+
:host([size='sm']),
|
|
20
|
+
:host([size='small']) {
|
|
21
|
+
--private-button-group-spacing: var(--spacing-150);
|
|
34
22
|
}
|
|
35
23
|
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
:host([size='md']),
|
|
25
|
+
:host([size='medium']),
|
|
26
|
+
:host([size='lg']),
|
|
27
|
+
:host([size='large']),
|
|
28
|
+
:host([size='xl']),
|
|
29
|
+
:host([size='extra-large']) {
|
|
30
|
+
--private-button-group-spacing: var(--spacing-100);
|
|
38
31
|
}
|
|
39
32
|
|
|
40
|
-
|
|
41
33
|
// Standard variant: buttons with a visible gap, each keeping their own shape
|
|
42
|
-
|
|
43
|
-
--
|
|
34
|
+
:host([connected]) {
|
|
35
|
+
--private-button-group-spacing: var(--spacing-025);
|
|
44
36
|
}
|
|
45
37
|
|
|
46
|
-
|
|
47
38
|
// Connected variant: buttons with a 2px gap; outer buttons have fully rounded outer
|
|
48
39
|
// corners while middle buttons keep standard rounded corners (handled via JS for
|
|
49
40
|
// per-position corner overrides, including vertical orientation).
|
|
50
|
-
|
|
51
|
-
--
|
|
41
|
+
:host([connected]) slot::slotted(*) {
|
|
42
|
+
--button-container-shape-start-start: var(--shape-corner-medium);
|
|
43
|
+
--button-container-shape-end-start: var(--shape-corner-medium);
|
|
44
|
+
--button-container-shape-start-end: var(--shape-corner-medium);
|
|
45
|
+
--button-container-shape-end-end: var(--shape-corner-medium);
|
|
46
|
+
--button-container-shape-variant: round;
|
|
52
47
|
}
|
|
53
48
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
:host([connected]) slot::slotted(:first-child:not([selected])) {
|
|
50
|
+
--button-container-shape-start-start: calc(var(--button-height) / 2);
|
|
51
|
+
--button-container-shape-end-start: calc(var(--button-height) / 2);
|
|
52
|
+
--button-container-shape-start-end: var(--shape-corner-medium);
|
|
53
|
+
--button-container-shape-end-end: var(--shape-corner-medium);
|
|
54
|
+
--button-container-shape-variant: round;
|
|
58
55
|
}
|
|
59
56
|
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
:host([connected]) slot::slotted(:last-child:not([selected])) {
|
|
58
|
+
--button-container-shape-start-start: var(--shape-corner-medium);
|
|
59
|
+
--button-container-shape-end-start: var(--shape-corner-medium);
|
|
60
|
+
--button-container-shape-start-end: calc(var(--button-height) / 2);
|
|
61
|
+
--button-container-shape-end-end: calc(var(--button-height) / 2);
|
|
62
|
+
--button-container-shape-variant: round;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
:host([connected]) slot::slotted(:only-child:not([selected])) {
|
|
66
|
+
--button-container-shape-start-start: var(--shape-corner-medium);
|
|
67
|
+
--button-container-shape-end-start: var(--shape-corner-medium);
|
|
68
|
+
--button-container-shape-start-end: var(--shape-corner-medium);
|
|
69
|
+
--button-container-shape-end-end: var(--shape-corner-medium);
|
|
70
|
+
--button-container-shape-variant: round;
|
|
71
|
+
}
|