@redvars/peacock 3.8.1 → 3.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/babel-DBsfpl3B.js +18 -0
- package/dist/babel-DBsfpl3B.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 +45 -52
- 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 +82 -11216
- package/dist/code-highlighter.js.map +1 -1
- package/dist/color-picker.js +701 -0
- package/dist/color-picker.js.map +1 -0
- 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 +823 -778
- package/dist/custom-elements.json +4067 -2207
- 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/estree-C2LDzX4U.js +47 -0
- package/dist/estree-C2LDzX4U.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 +139 -148
- 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-D22sQuVy.js +27 -0
- package/dist/html-D22sQuVy.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-_g_oLekF.js +14095 -0
- package/dist/index-_g_oLekF.js.map +1 -0
- package/dist/index.js +74 -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 +213 -0
- package/dist/item.js.map +1 -0
- package/dist/link.js +75 -0
- package/dist/link.js.map +1 -0
- package/dist/list-H0itjRte.js +526 -0
- package/dist/list-H0itjRte.js.map +1 -0
- package/dist/list.js +14 -0
- package/dist/list.js.map +1 -0
- package/dist/{peacock-loader.js → loader.js} +87 -22
- package/dist/loader.js.map +1 -0
- package/dist/menu-item.js +388 -0
- package/dist/menu-item.js.map +1 -0
- package/dist/menu.js +520 -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 +400 -0
- package/dist/navigation-rail-item.js.map +1 -0
- package/dist/navigation-rail.js +219 -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/pierre-dark-DFWl0m-C.js +4 -0
- package/dist/pierre-dark-DFWl0m-C.js.map +1 -0
- package/dist/pierre-light-BEkAPImt.js +4 -0
- package/dist/pierre-light-BEkAPImt.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/postcss-BhbitHaI.js +64 -0
- package/dist/postcss-BhbitHaI.js.map +1 -0
- 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-CspawZ18.js +3944 -0
- package/dist/select-CspawZ18.js.map +1 -0
- package/dist/side-sheet.js +9 -5
- 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/code-highlighter/code-highlighter.d.ts +2 -2
- package/dist/src/color-picker/color-picker.d.ts +85 -0
- package/dist/src/color-picker/index.d.ts +1 -0
- 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 +8 -6
- package/dist/src/item/item.d.ts +19 -29
- package/dist/src/link/link.d.ts +1 -1
- package/dist/src/list/list-item.d.ts +10 -6
- package/dist/src/list/list.d.ts +27 -2
- package/dist/src/menu/menu/menu.d.ts +14 -0
- package/dist/src/menu/menu-item/menu-item.d.ts +11 -4
- 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/standalone-Ccq0tWwA.js +32 -0
- package/dist/standalone-Ccq0tWwA.js.map +1 -0
- 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 +246 -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 +4 -4
- package/scss/mixin.scss +9 -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 +307 -0
- package/src/button/button/button-colors.scss +27 -32
- package/src/button/button/button-layers.scss +126 -43
- 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 -109
- 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 +21 -8
- 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 +95 -40
- package/src/code-highlighter/demo/index.html +24 -21
- package/src/color-picker/color-picker.scss +217 -0
- package/src/color-picker/color-picker.ts +478 -0
- package/src/color-picker/index.ts +1 -0
- 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 +25 -6
- package/src/input/input.ts +2 -2
- package/src/item/item.scss +127 -161
- package/src/item/item.ts +69 -323
- package/src/link/link.ts +3 -1
- package/src/list/list-item.scss +48 -32
- package/src/list/list-item.ts +109 -79
- package/src/list/list.scss +1 -13
- package/src/list/list.ts +170 -5
- package/src/{peacock-loader.ts → loader.ts} +95 -79
- package/src/menu/menu/menu.scss +15 -26
- package/src/menu/menu/menu.ts +20 -9
- package/src/menu/menu-item/menu-item.scss +82 -20
- package/src/menu/menu-item/menu-item.ts +85 -46
- package/src/menu/sub-menu/sub-menu.scss +5 -1
- package/src/menu/sub-menu/sub-menu.ts +3 -0
- package/src/modal/modal.ts +2 -2
- package/src/navigation-rail/navigation-rail-item.scss +25 -8
- package/src/navigation-rail/navigation-rail-item.ts +21 -36
- package/src/navigation-rail/navigation-rail.scss +25 -21
- 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 +3 -3
- package/src/sidebar-menu/sidebar-menu-item.scss +12 -6
- 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
package/src/checkbox/checkbox.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { html, LitElement, svg } from 'lit';
|
|
1
|
+
import { html, LitElement, svg } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
-
import { spread } from '@/
|
|
4
|
+
import { spread } from '@/__internal/directive/spread.js';
|
|
5
5
|
import styles from './checkbox.scss';
|
|
6
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @label Checkbox
|
|
@@ -11,7 +12,7 @@ import styles from './checkbox.scss';
|
|
|
11
12
|
* @summary Captures boolean input with an optional indeterminate mode.
|
|
12
13
|
* @overview
|
|
13
14
|
* <p>Checkboxes allow users to select one or more items from a set. Checkboxes can turn an option on or off.</p>
|
|
14
|
-
* <p>
|
|
15
|
+
* <p>checkboxes feature a smooth animation and clear visual states for checked, unchecked, and indeterminate.</p>
|
|
15
16
|
* @cssprop --checkbox-size: Size of the checkbox container.
|
|
16
17
|
* @cssprop --checkbox-selected-color: Color of the checkbox when selected.
|
|
17
18
|
* @cssprop --checkbox-unselected-color: Color of the checkbox border when unselected.
|
|
@@ -27,6 +28,7 @@ import styles from './checkbox.scss';
|
|
|
27
28
|
* <wc-checkbox label="Accept terms"></wc-checkbox>
|
|
28
29
|
* ```
|
|
29
30
|
*/
|
|
31
|
+
@IndividualComponent
|
|
30
32
|
export class Checkbox extends LitElement {
|
|
31
33
|
static styles = [styles];
|
|
32
34
|
|
|
@@ -91,12 +93,15 @@ export class Checkbox extends LitElement {
|
|
|
91
93
|
@property({ type: Object })
|
|
92
94
|
configAria: Record<string, string> = {};
|
|
93
95
|
|
|
96
|
+
/** True while the checkbox container has keyboard focus. */
|
|
94
97
|
@state()
|
|
95
98
|
private hasFocus = false;
|
|
96
99
|
|
|
100
|
+
/** True while the user is actively pressing the checkbox (mouse/keyboard). */
|
|
97
101
|
@state()
|
|
98
102
|
private isActive = false;
|
|
99
103
|
|
|
104
|
+
/** True when slotted label content is present. */
|
|
100
105
|
@state()
|
|
101
106
|
private slotHasContent = false;
|
|
102
107
|
|
|
@@ -106,6 +111,9 @@ export class Checkbox extends LitElement {
|
|
|
106
111
|
@query('.input-native')
|
|
107
112
|
private nativeElement?: HTMLInputElement;
|
|
108
113
|
|
|
114
|
+
// ── Private fields ────────────────────────────────────────────────────────
|
|
115
|
+
|
|
116
|
+
/** Captured `tabindex` attribute value forwarded to the inner container. */
|
|
109
117
|
private tabindex?: string;
|
|
110
118
|
|
|
111
119
|
connectedCallback() {
|
|
@@ -257,7 +265,7 @@ export class Checkbox extends LitElement {
|
|
|
257
265
|
${spread(this.configAria)}
|
|
258
266
|
>
|
|
259
267
|
<wc-ripple class="ripple"></wc-ripple>
|
|
260
|
-
<wc-focus-ring class="focus-ring" for=
|
|
268
|
+
<wc-focus-ring class="focus-ring" for="container"></wc-focus-ring>
|
|
261
269
|
<div class="outline"></div>
|
|
262
270
|
<div class="background"></div>
|
|
263
271
|
<svg class="icon" viewBox="0 0 12 12">
|
package/src/chip/chip/chip.scss
CHANGED
package/src/chip/chip/chip.ts
CHANGED
|
@@ -2,18 +2,22 @@ import { html, LitElement, nothing } from 'lit';
|
|
|
2
2
|
import { property, query, state } 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
|
-
import { observerSlotChangesWithCallback } from '@/
|
|
5
|
+
import { observerSlotChangesWithCallback } from '@/__internal/utils/observe-slot-change.js';
|
|
6
6
|
import {
|
|
7
7
|
dispatchActivationClick,
|
|
8
8
|
isActivationClick,
|
|
9
|
-
} from '@/
|
|
10
|
-
import { isLink } from '@/
|
|
9
|
+
} from '@/__internal/utils/dispatch-event-utils.js';
|
|
10
|
+
import { isLink } from '@/__internal/utils/is-link.js';
|
|
11
|
+
import { throttle } from '@/__internal/utils/throttle.js';
|
|
11
12
|
import styles from './chip.scss';
|
|
12
13
|
import sizeStyles from './chip-sizes.scss';
|
|
13
|
-
import { spread } from '@/
|
|
14
|
+
import { spread } from '@/__internal/directive/spread.js';
|
|
14
15
|
import { DISABLED_REASON_ID } from '@/button/ButtonConstants.js';
|
|
15
|
-
import
|
|
16
|
-
import
|
|
16
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
17
|
+
import { mixinBaseButton } from '@/button/base-button/base-button.js';
|
|
18
|
+
import { mixinHyperlink } from '@/__internal/mixins/hyperlink.js';
|
|
19
|
+
import { mixinDelegatesAria } from '@/__internal/aria/delegate.js';
|
|
20
|
+
import { mixinElementInternals } from '@/__internal/mixins/element-internals.js';
|
|
17
21
|
|
|
18
22
|
/**
|
|
19
23
|
* @label Chip
|
|
@@ -27,7 +31,16 @@ import NativeHyperlinkMixin from '@/__mixins/NativeHyperlinkMixin.js';
|
|
|
27
31
|
* <wc-chip>Chip content</wc-chip>
|
|
28
32
|
* ```
|
|
29
33
|
*/
|
|
30
|
-
|
|
34
|
+
@IndividualComponent
|
|
35
|
+
export class Chip extends mixinBaseButton(
|
|
36
|
+
mixinHyperlink(mixinDelegatesAria(mixinElementInternals(LitElement))),
|
|
37
|
+
) {
|
|
38
|
+
/** @nocollapse */ // eslint-disable-next-line
|
|
39
|
+
static override shadowRootOptions: ShadowRootInit = {
|
|
40
|
+
mode: 'open',
|
|
41
|
+
delegatesFocus: true,
|
|
42
|
+
};
|
|
43
|
+
|
|
31
44
|
// Define styles (Lit handles Scoping via Shadow DOM by default)
|
|
32
45
|
// You would typically import your tag.scss.js here or use the css tag
|
|
33
46
|
static styles = [styles, sizeStyles];
|
|
@@ -41,53 +54,30 @@ export class Chip extends NativeButtonMixin(NativeHyperlinkMixin(LitElement)) {
|
|
|
41
54
|
@property({ reflect: true })
|
|
42
55
|
configAria?: { [key: string]: any };
|
|
43
56
|
|
|
57
|
+
/** True when the `icon` slot contains at least one node. */
|
|
44
58
|
@state() private _hasIconSlotContent = false;
|
|
45
59
|
|
|
60
|
+
/** When true, renders the chip in a loading skeleton state. */
|
|
46
61
|
@property({ type: Boolean, reflect: true }) skeleton: boolean = false;
|
|
47
62
|
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
/** When true, the chip is in the selected/pressed state. */
|
|
50
64
|
@property({ type: Boolean, reflect: true }) selected: boolean = false;
|
|
51
65
|
|
|
52
66
|
/**
|
|
53
|
-
* Sets the delay for throttle in milliseconds.
|
|
67
|
+
* Sets the delay for throttle in milliseconds. When null (default), no throttle is applied.
|
|
54
68
|
*/
|
|
55
|
-
@property() throttleDelay
|
|
69
|
+
@property() throttleDelay?: number;
|
|
56
70
|
|
|
71
|
+
/** Optional tooltip text displayed on hover. */
|
|
57
72
|
@property() tooltip?: string;
|
|
58
73
|
|
|
59
|
-
@property({ type: Boolean, reflect: true })
|
|
60
|
-
pressed = false;
|
|
61
|
-
|
|
62
74
|
@query('.button') readonly buttonElement!: HTMLElement | null;
|
|
63
75
|
|
|
64
|
-
|
|
65
|
-
super
|
|
76
|
+
constructor() {
|
|
77
|
+
super();
|
|
66
78
|
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
67
|
-
window.addEventListener('mouseup', this.__handlePress);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
override disconnectedCallback() {
|
|
71
|
-
window.removeEventListener('mouseup', this.__handlePress);
|
|
72
|
-
this.removeEventListener('click', this.__dispatchClickWithThrottle);
|
|
73
|
-
super.disconnectedCallback();
|
|
74
79
|
}
|
|
75
80
|
|
|
76
|
-
__handlePress = (event: KeyboardEvent | MouseEvent) => {
|
|
77
|
-
if (this.disabled || this.skeleton || this.softDisabled) return;
|
|
78
|
-
if (
|
|
79
|
-
event instanceof KeyboardEvent &&
|
|
80
|
-
event.type === 'keydown' &&
|
|
81
|
-
(event.key === 'Enter' || event.key === ' ')
|
|
82
|
-
) {
|
|
83
|
-
this.pressed = true;
|
|
84
|
-
} else if (event.type === 'mousedown') {
|
|
85
|
-
this.pressed = true;
|
|
86
|
-
} else {
|
|
87
|
-
this.pressed = false;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
81
|
__dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =
|
|
92
82
|
event => {
|
|
93
83
|
this.__dispatchClick(event);
|
|
@@ -107,10 +97,6 @@ export class Chip extends NativeButtonMixin(NativeHyperlinkMixin(LitElement)) {
|
|
|
107
97
|
return;
|
|
108
98
|
}
|
|
109
99
|
|
|
110
|
-
if (this.toggle) {
|
|
111
|
-
this.selected = !this.selected;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
100
|
this.focus();
|
|
115
101
|
dispatchActivationClick(this.buttonElement);
|
|
116
102
|
};
|
|
@@ -130,7 +116,7 @@ export class Chip extends NativeButtonMixin(NativeHyperlinkMixin(LitElement)) {
|
|
|
130
116
|
|
|
131
117
|
__renderTooltip() {
|
|
132
118
|
if (this.tooltip) {
|
|
133
|
-
return html`<wc-tooltip class="tooltip"
|
|
119
|
+
return html`<wc-tooltip class="tooltip" for="button"
|
|
134
120
|
>${this.tooltip}</wc-tooltip
|
|
135
121
|
>`;
|
|
136
122
|
}
|
|
@@ -146,6 +132,12 @@ export class Chip extends NativeButtonMixin(NativeHyperlinkMixin(LitElement)) {
|
|
|
146
132
|
}
|
|
147
133
|
|
|
148
134
|
override firstUpdated() {
|
|
135
|
+
if (typeof this.throttleDelay === 'number') {
|
|
136
|
+
this.__dispatchClickWithThrottle = throttle(
|
|
137
|
+
this.__dispatchClick,
|
|
138
|
+
this.throttleDelay,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
149
141
|
observerSlotChangesWithCallback(
|
|
150
142
|
this.renderRoot.querySelector('slot[name="icon"]'),
|
|
151
143
|
hasContent => {
|
|
@@ -157,12 +149,10 @@ export class Chip extends NativeButtonMixin(NativeHyperlinkMixin(LitElement)) {
|
|
|
157
149
|
|
|
158
150
|
private _dismissClickHandler(e: MouseEvent) {
|
|
159
151
|
e.stopPropagation();
|
|
160
|
-
const detail = { value: this.value || this.textContent?.trim() };
|
|
161
152
|
|
|
162
153
|
// Custom Event: tag--dismiss
|
|
163
154
|
this.dispatchEvent(
|
|
164
155
|
new CustomEvent('tag--dismiss', {
|
|
165
|
-
detail,
|
|
166
156
|
bubbles: true,
|
|
167
157
|
composed: true,
|
|
168
158
|
}),
|
|
@@ -201,7 +191,6 @@ export class Chip extends NativeButtonMixin(NativeHyperlinkMixin(LitElement)) {
|
|
|
201
191
|
button: true,
|
|
202
192
|
selected: this.selected,
|
|
203
193
|
dismissible: this.dismissible,
|
|
204
|
-
pressed: this.pressed,
|
|
205
194
|
'icon-slot-has-content': this._hasIconSlotContent,
|
|
206
195
|
};
|
|
207
196
|
|
|
@@ -209,11 +198,6 @@ export class Chip extends NativeButtonMixin(NativeHyperlinkMixin(LitElement)) {
|
|
|
209
198
|
return html`<button
|
|
210
199
|
class=${classMap(cssClasses)}
|
|
211
200
|
id="button"
|
|
212
|
-
type=${this.htmlType}
|
|
213
|
-
@click=${this.__dispatchClickWithThrottle}
|
|
214
|
-
@mousedown=${this.__handlePress}
|
|
215
|
-
@keydown=${this.__handlePress}
|
|
216
|
-
@keyup=${this.__handlePress}
|
|
217
201
|
aria-describedby=${ifDefined(
|
|
218
202
|
this.softDisabled ? DISABLED_REASON_ID : undefined,
|
|
219
203
|
)}
|
|
@@ -230,10 +214,6 @@ export class Chip extends NativeButtonMixin(NativeHyperlinkMixin(LitElement)) {
|
|
|
230
214
|
href=${this.href}
|
|
231
215
|
target=${this.target}
|
|
232
216
|
tabindex=${this.disabled ? '-1' : '0'}
|
|
233
|
-
@click=${this.__dispatchClick}
|
|
234
|
-
@mousedown=${this.__handlePress}
|
|
235
|
-
@keydown=${this.__handlePress}
|
|
236
|
-
@keyup=${this.__handlePress}
|
|
237
217
|
role="button"
|
|
238
218
|
aria-describedby=${ifDefined(
|
|
239
219
|
this.softDisabled ? DISABLED_REASON_ID : undefined,
|
package/src/chip/demo/index.html
CHANGED
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
|
-
<html lang=
|
|
3
|
-
<head>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
<html lang="en-GB">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta
|
|
6
|
+
name="viewport"
|
|
7
|
+
content="width=device-width, initial-scale=1.0, viewport-fit=cover"
|
|
8
|
+
/>
|
|
9
|
+
<link rel="stylesheet" href="/dist/assets/styles/tokens.css" />
|
|
10
|
+
<link
|
|
11
|
+
href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap"
|
|
12
|
+
rel="stylesheet"
|
|
13
|
+
/>
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
</head>
|
|
19
|
-
<body>
|
|
15
|
+
<style>
|
|
16
|
+
body {
|
|
17
|
+
background: #fafafa;
|
|
18
|
+
}
|
|
19
|
+
.text-body {
|
|
20
|
+
padding: 0;
|
|
21
|
+
margin: 0 !important;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
24
|
+
</head>
|
|
25
|
+
<body>
|
|
26
|
+
<p-chip color="red">Link</p-chip>
|
|
27
|
+
<p-chip color="green">Link</p-chip>
|
|
28
|
+
<p-chip color="blue">Link</p-chip>
|
|
29
|
+
<p-chip color="yellow">Link</p-chip>
|
|
30
|
+
<p-chip color="purple">Link</p-chip>
|
|
20
31
|
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
<p-chip color='blue'>Link</p-chip>
|
|
24
|
-
<p-chip color='yellow'>Link</p-chip>
|
|
25
|
-
<p-chip color='purple'>Link</p-chip>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<script type='module' src='/dist/peacock-loader.js'></script>
|
|
29
|
-
</body>
|
|
32
|
+
<script type="module" src="/dist/loader.js"></script>
|
|
33
|
+
</body>
|
|
30
34
|
</html>
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { html, nothing } from 'lit';
|
|
2
2
|
import { property, state, query } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
-
import {init} from 'modern-monaco';
|
|
4
|
+
import { init } from 'modern-monaco';
|
|
5
5
|
import IndividualComponent from '@/IndividualComponent.js';
|
|
6
6
|
import BaseInput from '../input/BaseInput.js';
|
|
7
|
-
import { observeThemeChange } from '../
|
|
8
|
-
import { redispatchEvent } from '../
|
|
9
|
-
import {
|
|
10
|
-
isDarkMode,
|
|
11
|
-
} from '@/__utils/is-dark-mode.js';
|
|
7
|
+
import { observeThemeChange } from '../__internal/utils/observe-theme-change.js';
|
|
8
|
+
import { redispatchEvent } from '../__internal/utils/dispatch-event-utils.js';
|
|
9
|
+
import { isDarkMode } from '@/__internal/utils/is-dark-mode.js';
|
|
12
10
|
|
|
13
11
|
import styles from './code-editor.scss';
|
|
14
12
|
|
|
@@ -32,14 +30,19 @@ import styles from './code-editor.scss';
|
|
|
32
30
|
getWorkerUrl(moduleId: string, label: string) {
|
|
33
31
|
const workersDir = new URL('monaco/workers/', import.meta.url);
|
|
34
32
|
switch (label) {
|
|
35
|
-
case 'json':
|
|
36
|
-
|
|
37
|
-
case '
|
|
33
|
+
case 'json':
|
|
34
|
+
return `${workersDir}json.worker.js`;
|
|
35
|
+
case 'css':
|
|
36
|
+
return `${workersDir}css.worker.js`;
|
|
37
|
+
case 'html':
|
|
38
|
+
return `${workersDir}html.worker.js`;
|
|
38
39
|
case 'typescript':
|
|
39
|
-
case 'javascript':
|
|
40
|
-
|
|
40
|
+
case 'javascript':
|
|
41
|
+
return `${workersDir}ts.worker.js`;
|
|
42
|
+
default:
|
|
43
|
+
return `${workersDir}editor.worker.js`;
|
|
41
44
|
}
|
|
42
|
-
}
|
|
45
|
+
},
|
|
43
46
|
};
|
|
44
47
|
|
|
45
48
|
/**
|
|
@@ -67,31 +70,30 @@ import styles from './code-editor.scss';
|
|
|
67
70
|
*/
|
|
68
71
|
@IndividualComponent
|
|
69
72
|
export default class CodeEditor extends BaseInput {
|
|
70
|
-
|
|
71
73
|
static styles = [styles];
|
|
72
74
|
|
|
73
|
-
@property({ type: String })
|
|
74
|
-
name =
|
|
75
|
+
@property({ type: String })
|
|
76
|
+
name = '';
|
|
75
77
|
|
|
76
|
-
@property({ type: String })
|
|
78
|
+
@property({ type: String })
|
|
77
79
|
value = '';
|
|
78
80
|
|
|
79
|
-
@property({ type: String })
|
|
81
|
+
@property({ type: String })
|
|
80
82
|
language: 'javascript' | 'json' | 'html' = 'javascript';
|
|
81
83
|
|
|
82
|
-
@property({ type: Object })
|
|
84
|
+
@property({ type: Object })
|
|
83
85
|
libSource: any;
|
|
84
86
|
|
|
85
|
-
@property({ type: String })
|
|
87
|
+
@property({ type: String })
|
|
86
88
|
lineNumbers: 'off' | 'on' = 'on';
|
|
87
89
|
|
|
88
|
-
@property({ type: Boolean })
|
|
90
|
+
@property({ type: Boolean })
|
|
89
91
|
minimap = false;
|
|
90
92
|
|
|
91
93
|
@state() private _isDarkMode: boolean = isDarkMode();
|
|
92
94
|
|
|
93
95
|
@state() private hasFocus = false;
|
|
94
|
-
|
|
96
|
+
|
|
95
97
|
// Type the instance correctly using the npm package types
|
|
96
98
|
@state() private editorMonacoInstance?: any;
|
|
97
99
|
|
|
@@ -120,49 +122,48 @@ export default class CodeEditor extends BaseInput {
|
|
|
120
122
|
protected updated(changedProperties: any) {
|
|
121
123
|
if (changedProperties.has('libSource')) this.libSourceChanged();
|
|
122
124
|
|
|
123
|
-
if (
|
|
125
|
+
if (
|
|
126
|
+
changedProperties.has('disabled') ||
|
|
127
|
+
changedProperties.has('readonly')
|
|
128
|
+
) {
|
|
124
129
|
this.editorMonacoInstance?.updateOptions({
|
|
125
130
|
readOnly: this.disabled || this.readonly,
|
|
126
131
|
});
|
|
127
132
|
}
|
|
128
133
|
|
|
129
134
|
if (changedProperties.has('value')) {
|
|
130
|
-
if (
|
|
135
|
+
if (
|
|
136
|
+
this.editorMonacoInstance &&
|
|
137
|
+
this.editorMonacoInstance.getValue() !== this.value
|
|
138
|
+
) {
|
|
131
139
|
this.editorMonacoInstance.setValue(this.value || '');
|
|
132
140
|
}
|
|
133
141
|
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
142
|
+
}
|
|
137
143
|
|
|
138
144
|
private libSourceChanged() {
|
|
139
145
|
const libUri = 'java://peacock.redvars.com/lib.java';
|
|
140
146
|
const libModel = this.monaco.editor.getModel(this.monaco.Uri.parse(libUri));
|
|
141
|
-
|
|
147
|
+
|
|
142
148
|
if (libModel) libModel.dispose();
|
|
143
|
-
|
|
149
|
+
|
|
144
150
|
if (this.libSource) {
|
|
145
151
|
this.monaco.editor.createModel(
|
|
146
152
|
this.libSource,
|
|
147
153
|
this.language,
|
|
148
|
-
this.monaco.Uri.parse(libUri)
|
|
154
|
+
this.monaco.Uri.parse(libUri),
|
|
149
155
|
);
|
|
150
156
|
}
|
|
151
157
|
}
|
|
152
158
|
|
|
153
|
-
|
|
154
159
|
private getTheme() {
|
|
155
160
|
return this._isDarkMode ? 'github-dark' : 'github-light';
|
|
156
161
|
}
|
|
157
162
|
|
|
158
163
|
async initializeMonaco() {
|
|
159
164
|
this.monaco = await init({
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
"github-dark",
|
|
163
|
-
],
|
|
164
|
-
});
|
|
165
|
-
|
|
165
|
+
themes: ['github-light', 'github-dark'],
|
|
166
|
+
});
|
|
166
167
|
|
|
167
168
|
this.editorMonacoInstance = this.monaco.editor.create(this.editorElement, {
|
|
168
169
|
value: this.value,
|
|
@@ -170,11 +171,9 @@ export default class CodeEditor extends BaseInput {
|
|
|
170
171
|
language: this.language,
|
|
171
172
|
minimap: { enabled: this.minimap },
|
|
172
173
|
theme: this.getTheme(),
|
|
173
|
-
readOnly: this.disabled || this.readonly
|
|
174
|
+
readOnly: this.disabled || this.readonly,
|
|
174
175
|
});
|
|
175
176
|
|
|
176
|
-
|
|
177
|
-
|
|
178
177
|
if (this.libSource) {
|
|
179
178
|
this.libSourceChanged();
|
|
180
179
|
}
|
|
@@ -183,7 +182,10 @@ export default class CodeEditor extends BaseInput {
|
|
|
183
182
|
if (!e.isFlush) {
|
|
184
183
|
const newValue = this.editorMonacoInstance!.getValue();
|
|
185
184
|
this.value = newValue;
|
|
186
|
-
redispatchEvent(
|
|
185
|
+
redispatchEvent(
|
|
186
|
+
this,
|
|
187
|
+
new Event('change', { bubbles: true, composed: true }),
|
|
188
|
+
);
|
|
187
189
|
}
|
|
188
190
|
});
|
|
189
191
|
|
|
@@ -192,18 +194,25 @@ export default class CodeEditor extends BaseInput {
|
|
|
192
194
|
});
|
|
193
195
|
|
|
194
196
|
this.editorMonacoInstance.onDidBlurEditorText(() => {
|
|
195
|
-
this.hasFocus = false
|
|
197
|
+
this.hasFocus = false;
|
|
196
198
|
});
|
|
197
199
|
}
|
|
198
200
|
|
|
201
|
+
async setFocus() {
|
|
202
|
+
this.editorMonacoInstance?.focus();
|
|
203
|
+
}
|
|
199
204
|
|
|
200
|
-
async
|
|
201
|
-
|
|
202
|
-
|
|
205
|
+
async setBlur() {
|
|
206
|
+
this.editorMonacoInstance?.trigger(
|
|
207
|
+
'keyboard',
|
|
208
|
+
'type',
|
|
209
|
+
'',
|
|
210
|
+
); /* Focus hack or use blur if available */
|
|
211
|
+
}
|
|
203
212
|
|
|
204
213
|
render() {
|
|
205
214
|
return html`
|
|
206
|
-
|
|
215
|
+
<wc-field
|
|
207
216
|
?required=${this.required}
|
|
208
217
|
?disabled=${this.disabled}
|
|
209
218
|
?readonly=${this.readonly}
|
|
@@ -211,21 +220,22 @@ export default class CodeEditor extends BaseInput {
|
|
|
211
220
|
?focused=${this.hasFocus}
|
|
212
221
|
.host=${this}
|
|
213
222
|
class="${classMap({
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
223
|
+
'code-editor-component': true,
|
|
224
|
+
disabled: this.disabled,
|
|
225
|
+
})}"
|
|
217
226
|
>
|
|
218
|
-
${
|
|
219
|
-
? html`<wc-tag class="read-only-tag" color="red">Read Only</wc-tag>`
|
|
220
|
-
: nothing
|
|
221
|
-
}
|
|
227
|
+
${this.disabled || this.readonly
|
|
228
|
+
? html`<wc-tag class="read-only-tag" color="red">Read Only</wc-tag>`
|
|
229
|
+
: nothing}
|
|
222
230
|
<div class="editor"></div>
|
|
223
|
-
${!this.editorMonacoInstance
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
231
|
+
${!this.editorMonacoInstance
|
|
232
|
+
? html`
|
|
233
|
+
<div class="code-editor-loader">
|
|
234
|
+
<wc-spinner></wc-spinner> Loading...
|
|
235
|
+
</div>
|
|
236
|
+
`
|
|
237
|
+
: nothing}
|
|
228
238
|
</wc-field>
|
|
229
239
|
`;
|
|
230
240
|
}
|
|
231
|
-
}
|
|
241
|
+
}
|
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
|
-
<html lang=
|
|
3
|
-
<head>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
2
|
+
<html lang="en-GB" data-theme="dark">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta
|
|
6
|
+
name="viewport"
|
|
7
|
+
content="width=device-width, initial-scale=1.0, viewport-fit=cover"
|
|
8
|
+
/>
|
|
9
|
+
<link rel="stylesheet" href="/dist/assets/styles.css" />
|
|
10
|
+
<link
|
|
11
|
+
href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap"
|
|
12
|
+
rel="stylesheet"
|
|
13
|
+
/>
|
|
14
|
+
|
|
15
|
+
<style>
|
|
16
|
+
body {
|
|
17
|
+
background: var(--color-surface);
|
|
18
|
+
}
|
|
19
|
+
</style>
|
|
20
|
+
</head>
|
|
21
|
+
<body>
|
|
22
|
+
<code-editor
|
|
23
|
+
style="height: 400px"
|
|
24
|
+
id="business-rule-editor"
|
|
25
|
+
language="javascript"
|
|
26
|
+
></code-editor>
|
|
27
|
+
|
|
28
|
+
<script type="module">
|
|
29
|
+
import '/dist/loader.js';
|
|
30
|
+
|
|
31
|
+
document.getElementById('business-rule-editor').value = `/**
|
|
25
32
|
* Sample Code
|
|
26
33
|
*/
|
|
27
34
|
function myBusinessRuleFunction(){
|
|
@@ -30,8 +37,6 @@
|
|
|
30
37
|
let c = a + b;
|
|
31
38
|
console.log(c);
|
|
32
39
|
}`;
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
</body>
|
|
40
|
+
</script>
|
|
41
|
+
</body>
|
|
37
42
|
</html>
|