@redvars/peacock 3.10.1 → 3.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BaseInput-CV0pZgSb.js +58 -0
- package/dist/BaseInput-CV0pZgSb.js.map +1 -0
- package/dist/app-bar.js +16 -16
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/assets/theme.d.ts +66 -0
- package/dist/assets/theme.js +134 -0
- package/dist/assets/tokens.css +1 -1
- package/dist/assets/tokens.css.map +1 -1
- package/dist/base-progress-CLZTRveO.js +33 -0
- package/dist/base-progress-CLZTRveO.js.map +1 -0
- package/dist/bottom-sheet.js +1 -1
- package/dist/button-group.js +9 -7
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +225 -187
- package/dist/button.js.map +1 -1
- package/dist/cb-divider.js +7 -6
- package/dist/cb-divider.js.map +1 -1
- package/dist/cb-group-base-D9gv7SDY.js +114 -0
- package/dist/cb-group-base-D9gv7SDY.js.map +1 -0
- package/dist/cb-group-base-DsX_2aFl.js +325 -0
- package/dist/cb-group-base-DsX_2aFl.js.map +1 -0
- package/dist/cb-group.js +96 -0
- package/dist/cb-group.js.map +1 -0
- package/dist/cb-rule.js +212 -0
- package/dist/cb-rule.js.map +1 -0
- package/dist/{chart-bar-CapLbc2e.js → chart-bar-D5dGFJfK.js} +2 -2
- package/dist/{chart-bar-CapLbc2e.js.map → chart-bar-D5dGFJfK.js.map} +1 -1
- package/dist/chart-bar.js +1 -1
- package/dist/chart-stacked-bar.js +1 -1
- package/dist/checkbox.js +78 -53
- package/dist/checkbox.js.map +1 -1
- package/dist/chip-set.js +52 -0
- package/dist/chip-set.js.map +1 -0
- package/dist/chip.js +8 -6
- package/dist/chip.js.map +1 -1
- package/dist/circular-progress.js +177 -0
- package/dist/circular-progress.js.map +1 -0
- package/dist/code-editor.js +129 -72
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +2 -38
- package/dist/code-highlighter.js.map +1 -1
- package/dist/color-field.js +309 -0
- package/dist/color-field.js.map +1 -0
- package/dist/color-picker.js +26 -15
- package/dist/color-picker.js.map +1 -1
- package/dist/condition-builder.js +90 -35
- package/dist/condition-builder.js.map +1 -1
- package/dist/copy-to-clipboard-upGx-Ueo.js +39 -0
- package/dist/copy-to-clipboard-upGx-Ueo.js.map +1 -0
- package/dist/custom-elements-jsdocs.json +1140 -398
- package/dist/custom-elements.json +9065 -3989
- package/dist/date-picker.js +241 -0
- package/dist/date-picker.js.map +1 -0
- package/dist/{element-internals-2CMts_0M.js → delegate-py-Ets8N.js} +2 -43
- package/dist/delegate-py-Ets8N.js.map +1 -0
- package/dist/element-internals-QME0yEz4.js +43 -0
- package/dist/element-internals-QME0yEz4.js.map +1 -0
- package/dist/fab.js +51 -49
- package/dist/fab.js.map +1 -1
- package/dist/field.js +27 -0
- package/dist/field.js.map +1 -1
- package/dist/flow.js +5 -5
- package/dist/form-associated-Bhwwr6dT.js +162 -0
- package/dist/form-associated-Bhwwr6dT.js.map +1 -0
- package/dist/{form-associated-BXADnjOB.js → form-submitter-DPI4L6gj.js} +3 -159
- package/dist/form-submitter-DPI4L6gj.js.map +1 -0
- package/dist/html-editor.js +3 -1
- package/dist/html-editor.js.map +1 -1
- package/dist/icon-button.js +195 -156
- package/dist/icon-button.js.map +1 -1
- package/dist/image.js +2 -2
- package/dist/index.js +36 -11
- package/dist/index.js.map +1 -1
- package/dist/input.js +259 -0
- package/dist/input.js.map +1 -0
- package/dist/item.js +2 -1
- package/dist/item.js.map +1 -1
- package/dist/linear-progress.js +192 -0
- package/dist/linear-progress.js.map +1 -0
- package/dist/{list-AdO-PUq_.js → list-item.js} +12 -222
- package/dist/list-item.js.map +1 -0
- package/dist/list.js +225 -6
- package/dist/list.js.map +1 -1
- package/dist/loader-full.js +31 -8
- package/dist/loader-full.js.map +1 -1
- package/dist/loader.js +58 -25
- package/dist/loader.js.map +1 -1
- package/dist/markdown-editor.js +5 -3
- package/dist/markdown-editor.js.map +1 -1
- package/dist/menu-item.js +30 -30
- package/dist/navigation-bar-item.js +41 -0
- package/dist/navigation-bar-item.js.map +1 -0
- package/dist/navigation-bar.js +128 -0
- package/dist/navigation-bar.js.map +1 -0
- package/dist/navigation-drawer-item.js +236 -0
- package/dist/navigation-drawer-item.js.map +1 -0
- package/dist/navigation-drawer.js +293 -0
- package/dist/navigation-drawer.js.map +1 -0
- package/dist/navigation-rail.js +1 -1
- package/dist/number-field.js +280 -0
- package/dist/number-field.js.map +1 -0
- package/dist/pagination.js +1 -1
- package/dist/radio-group.js +209 -0
- package/dist/radio-group.js.map +1 -0
- package/dist/radio.js +47 -37
- package/dist/radio.js.map +1 -1
- package/dist/segmented-button-group.js +12 -0
- package/dist/segmented-button-group.js.map +1 -1
- package/dist/segmented-button.js +10 -6
- package/dist/segmented-button.js.map +1 -1
- package/dist/select.js +653 -0
- package/dist/select.js.map +1 -0
- package/dist/side-sheet.js +1 -1
- package/dist/sidebar-menu-item.js +273 -0
- package/dist/sidebar-menu-item.js.map +1 -0
- package/dist/sidebar-menu.js +193 -0
- package/dist/sidebar-menu.js.map +1 -0
- package/dist/sidebar-sub-menu.js +301 -0
- package/dist/sidebar-sub-menu.js.map +1 -0
- package/dist/slider.js +76 -24
- package/dist/slider.js.map +1 -1
- package/dist/snackbar.js +3 -3
- package/dist/snackbar.js.map +1 -1
- package/dist/split-button.js +2 -2
- package/dist/src/__internal/utils/size.d.ts +9 -0
- package/dist/src/button/ButtonTypes.d.ts +1 -1
- package/dist/src/checkbox/checkbox.d.ts +28 -22
- package/dist/src/chip/chip/chip.d.ts +3 -0
- package/dist/src/chip/tag/tag.d.ts +5 -1
- package/dist/src/code-editor/code-editor.d.ts +37 -10
- package/dist/src/color-field/color-field.d.ts +55 -0
- package/dist/src/color-field/index.d.ts +1 -0
- package/dist/src/color-picker/color-picker.d.ts +1 -1
- package/dist/src/condition-builder/cb-divider.d.ts +3 -1
- package/dist/src/condition-builder/cb-drag.d.ts +10 -0
- package/dist/src/condition-builder/cb-group-base.d.ts +59 -0
- package/dist/src/condition-builder/cb-group.d.ts +34 -0
- package/dist/src/condition-builder/cb-rule.d.ts +32 -0
- package/dist/src/condition-builder/cb-types.d.ts +13 -0
- package/dist/src/condition-builder/condition-builder.d.ts +35 -14
- package/dist/src/condition-builder/index.d.ts +3 -3
- package/dist/src/date-picker/date-picker.d.ts +0 -1
- package/dist/src/index.d.ts +6 -4
- package/dist/src/input/BaseInput.d.ts +21 -3
- package/dist/src/input/input.d.ts +15 -7
- package/dist/src/navigation-bar/index.d.ts +2 -0
- package/dist/src/navigation-bar/navigation-bar-item.d.ts +23 -0
- package/dist/src/navigation-bar/navigation-bar.d.ts +44 -0
- package/dist/src/navigation-drawer/index.d.ts +2 -0
- package/dist/src/navigation-drawer/navigation-drawer-item.d.ts +48 -0
- package/dist/src/navigation-drawer/navigation-drawer.d.ts +70 -0
- package/dist/src/number-field/number-field.d.ts +0 -1
- package/dist/src/radio/index.d.ts +1 -0
- package/dist/src/radio/radio-group.d.ts +50 -0
- package/dist/src/radio/radio.d.ts +18 -18
- package/dist/src/segmented-button/segmented-button-group.d.ts +5 -0
- package/dist/src/segmented-button/segmented-button.d.ts +2 -1
- package/dist/src/select/select.d.ts +6 -0
- package/dist/src/slider/slider.d.ts +14 -5
- package/dist/src/switch/switch.d.ts +22 -26
- package/dist/src/tabs/tabs.d.ts +3 -0
- package/dist/src/textarea/textarea.d.ts +0 -1
- package/dist/src/time-picker/time-picker.d.ts +0 -1
- package/dist/src/toolbar/toolbar.d.ts +7 -4
- package/dist/src/url-field/url-field.d.ts +0 -1
- package/dist/svg.js +5 -5
- package/dist/switch.js +413 -0
- package/dist/switch.js.map +1 -0
- package/dist/tab.js +2 -1
- package/dist/tab.js.map +1 -1
- package/dist/tabs.js +10 -8
- package/dist/tabs.js.map +1 -1
- package/dist/tag.js +349 -0
- package/dist/tag.js.map +1 -0
- package/dist/test/code-editor.test.d.ts +1 -0
- package/dist/test/color-field.test.d.ts +1 -0
- package/dist/test/color-picker.test.d.ts +1 -0
- package/dist/test/condition-builder.test.d.ts +1 -0
- package/dist/test/field.test.d.ts +1 -0
- package/dist/test/form-controls.test.d.ts +1 -0
- package/dist/test/icon.test.d.ts +1 -1
- package/dist/test/input.test.d.ts +1 -0
- package/dist/test/navigation.test.d.ts +1 -0
- package/dist/test/segmented-button.test.d.ts +1 -0
- package/dist/test/slider.test.d.ts +1 -0
- package/dist/textarea.js +237 -0
- package/dist/textarea.js.map +1 -0
- package/dist/time-picker.js +241 -0
- package/dist/time-picker.js.map +1 -0
- package/dist/toolbar.js +26 -9
- package/dist/toolbar.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/url-field.js +298 -0
- package/dist/url-field.js.map +1 -0
- package/package.json +29 -8
- package/readme.md +2 -2
- package/scss/tokens.css +175 -18
- package/src/__internal/utils/size.ts +23 -0
- package/src/app-bar/app-bar.scss +4 -16
- package/src/bottom-sheet/bottom-sheet.scss +1 -1
- package/src/button/ButtonTypes.ts +2 -0
- package/src/button/button/button-base.scss +84 -84
- package/src/button/button/button-colors.scss +14 -2
- package/src/button/button/button-layers.scss +71 -71
- package/src/button/button/button-shapes.scss +2 -2
- package/src/button/button/button-sizes.scss +35 -35
- package/src/button/button/button.scss +1 -1
- package/src/button/button/button.ts +1 -2
- package/src/button/button-group/button-group.scss +5 -5
- package/src/button/fab/fab-sizes.scss +15 -15
- package/src/button/fab/fab.scss +32 -32
- package/src/button/icon-button/icon-button-sizes.scss +7 -7
- package/src/chart-bar/chart-bar.scss +1 -1
- package/src/checkbox/checkbox.scss +7 -6
- package/src/checkbox/checkbox.ts +92 -40
- package/src/chip/chip/chip.ts +8 -5
- package/src/chip/chip-set/chip-set.ts +2 -0
- package/src/chip/tag/tag-colors.scss +1 -1
- package/src/chip/tag/tag-sizes.scss +9 -0
- package/src/chip/tag/tag.scss +1 -1
- package/src/chip/tag/tag.ts +20 -9
- package/src/code-editor/code-editor.scss +8 -3
- package/src/code-editor/code-editor.ts +148 -79
- package/src/code-highlighter/code-highlighter.scss +1 -1
- package/src/color-field/color-field.scss +48 -0
- package/src/color-field/color-field.ts +239 -0
- package/src/color-field/index.ts +1 -0
- package/src/color-picker/color-picker.scss +33 -15
- package/src/color-picker/color-picker.ts +2 -1
- package/src/condition-builder/cb-divider.scss +4 -5
- package/src/condition-builder/cb-divider.ts +3 -1
- package/src/condition-builder/cb-drag.ts +35 -0
- package/src/condition-builder/cb-group-base.scss +97 -0
- package/src/condition-builder/cb-group-base.ts +335 -0
- package/src/condition-builder/cb-group.scss +21 -0
- package/src/condition-builder/cb-group.ts +72 -0
- package/src/condition-builder/cb-rule.scss +90 -0
- package/src/condition-builder/cb-rule.ts +129 -0
- package/src/condition-builder/cb-types.ts +16 -0
- package/src/condition-builder/condition-builder.scss +12 -9
- package/src/condition-builder/condition-builder.ts +77 -17
- package/src/condition-builder/index.ts +7 -3
- package/src/date-picker/date-picker.ts +2 -3
- package/src/field/field.scss +34 -0
- package/src/flow/flow.scss +5 -5
- package/src/image/image.scss +2 -2
- package/src/index.ts +14 -6
- package/src/input/BaseInput.ts +54 -4
- package/src/input/input.ts +104 -79
- package/src/list/list-item.ts +2 -0
- package/src/loader.ts +34 -19
- package/src/markdown-editor/markdown-editor.scss +2 -2
- package/src/menu/menu-item/menu-item.scss +30 -30
- package/src/navigation-bar/index.ts +2 -0
- package/src/navigation-bar/navigation-bar-item.ts +25 -0
- package/src/navigation-bar/navigation-bar.scss +27 -0
- package/src/navigation-bar/navigation-bar.ts +96 -0
- package/src/navigation-drawer/index.ts +2 -0
- package/src/navigation-drawer/navigation-drawer-item.scss +82 -0
- package/src/navigation-drawer/navigation-drawer-item.ts +133 -0
- package/src/navigation-drawer/navigation-drawer.scss +99 -0
- package/src/navigation-drawer/navigation-drawer.ts +196 -0
- package/src/navigation-rail/navigation-rail.scss +1 -1
- package/src/number-field/number-field.ts +2 -3
- package/src/pagination/pagination.scss +1 -1
- package/src/progress/circular-progress/circular-progress.ts +2 -0
- package/src/progress/linear-progress/linear-progress.ts +2 -0
- package/src/radio/index.ts +1 -0
- package/src/radio/radio-group.scss +39 -0
- package/src/radio/radio-group.ts +167 -0
- package/src/radio/radio.ts +74 -31
- package/src/segmented-button/segmented-button-group.ts +12 -0
- package/src/segmented-button/segmented-button.ts +12 -6
- package/src/select/select.ts +21 -1
- package/src/side-sheet/side-sheet.scss +1 -1
- package/src/sidebar-menu/sidebar-menu-item.scss +1 -1
- package/src/sidebar-menu/sidebar-menu-item.ts +2 -0
- package/src/sidebar-menu/sidebar-menu.ts +2 -0
- package/src/sidebar-menu/sidebar-sub-menu.scss +1 -1
- package/src/sidebar-menu/sidebar-sub-menu.ts +2 -0
- package/src/slider/slider.scss +3 -3
- package/src/slider/slider.ts +119 -31
- package/src/snackbar/snackbar.ts +3 -3
- package/src/split-button/split-button-colors.scss +2 -2
- package/src/svg/svg.scss +5 -5
- package/src/switch/switch.scss +0 -1
- package/src/switch/switch.ts +82 -47
- package/src/tabs/tab.scss +2 -1
- package/src/tabs/tabs.ts +14 -8
- package/src/textarea/textarea.ts +2 -3
- package/src/time-picker/time-picker.ts +2 -3
- package/src/toolbar/toolbar.scss +4 -4
- package/src/toolbar/toolbar.ts +12 -5
- package/src/url-field/url-field.ts +2 -3
- package/dist/BaseInput-CU1zZYKc.js +0 -27
- package/dist/BaseInput-CU1zZYKc.js.map +0 -1
- package/dist/brand-loader.js +0 -358
- package/dist/brand-loader.js.map +0 -1
- package/dist/cb-compound-expression.js +0 -133
- package/dist/cb-compound-expression.js.map +0 -1
- package/dist/cb-expression.js +0 -78
- package/dist/cb-expression.js.map +0 -1
- package/dist/cb-predicate.js +0 -141
- package/dist/cb-predicate.js.map +0 -1
- package/dist/element-internals-2CMts_0M.js.map +0 -1
- package/dist/form-associated-BXADnjOB.js.map +0 -1
- package/dist/list-AdO-PUq_.js.map +0 -1
- package/dist/select-DkyRqUTI.js +0 -3955
- package/dist/select-DkyRqUTI.js.map +0 -1
- package/dist/src/brand-loader/brand-loader.d.ts +0 -33
- package/dist/src/brand-loader/index.d.ts +0 -2
- package/dist/src/condition-builder/cb-compound-expression.d.ts +0 -30
- package/dist/src/condition-builder/cb-expression.d.ts +0 -30
- package/dist/src/condition-builder/cb-predicate.d.ts +0 -29
- package/src/brand-loader/brand-loader.scss +0 -270
- package/src/brand-loader/brand-loader.ts +0 -115
- package/src/brand-loader/index.ts +0 -2
- package/src/condition-builder/cb-compound-expression.scss +0 -41
- package/src/condition-builder/cb-compound-expression.ts +0 -79
- package/src/condition-builder/cb-expression.scss +0 -13
- package/src/condition-builder/cb-expression.ts +0 -48
- package/src/condition-builder/cb-predicate.scss +0 -35
- package/src/condition-builder/cb-predicate.ts +0 -101
- /package/dist/test/{brand-loader.test.d.ts → button.test.d.ts} +0 -0
package/dist/snackbar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snackbar.js","sources":["../../src/snackbar/snackbar.ts"],"sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport styles from './snackbar.scss';\nimport IndividualComponent from '@/IndividualComponent.js';\n\ntype SnackbarCloseReason = 'timeout' | 'dismiss' | 'action' | 'programmatic';\n\n/**\n * @label Snackbar\n * @tag wc-snackbar\n * @rawTag snackbar\n * @summary Snackbars provide brief messages about app processes at the bottom of the screen.\n *\n * @cssprop --snackbar-container-color - Container color for the snackbar.\n * @cssprop --snackbar-label-text-color - Label text color for the snackbar.\n * @cssprop --snackbar-action-text-color - Action text color.\n * @cssprop --snackbar-close-icon-color - Close icon color.\n * @cssprop --snackbar-border-radius - Border radius of the snackbar surface.\n * @cssprop --snackbar-offset-inline - Inline offset from viewport edges.\n * @cssprop --snackbar-offset-bottom - Bottom offset from viewport edge.\n * @cssprop --snackbar-z-index - Stacking order for the snackbar.\n *\n * @example\n * ```html\n * <wc-snackbar preview message=\"Message archived\" action-label=\"Undo\"></wc-snackbar>\n * ```\n * @tags display, feedback\n */\n@IndividualComponent\nexport class Snackbar extends LitElement {\n static styles = [styles];\n\n private static readonly GLOBAL_OPEN_EVENT = 'wc-snackbar-will-open';\n\n private static readonly EXIT_ANIMATION_MS = 180;\n\n /** Whether the snackbar is currently visible. */\n @property({ type: Boolean, reflect: true }) open = false;\n\n /** The message text to display. Can also be provided via the default slot. */\n @property({ type: String }) message = '';\n\n /** Label for the optional action button. When empty, no action button is rendered. */\n @property({ type: String, attribute: 'action-label' }) actionLabel = '';\n\n /** When true, a dismiss icon button is shown on the trailing end. */\n @property({ type: Boolean, attribute: 'show-close-icon' })\n showCloseIcon = false;\n\n /** Auto-hide duration in milliseconds. Set to `0` to disable auto-hide. */\n @property({ type: Number }) duration = 4000;\n\n /** When true, the snackbar content is allowed to wrap to multiple lines. */\n @property({ type: Boolean, reflect: true }) multiline = false;\n\n /** When true, renders the snackbar in a static preview state (always visible, no animation). */\n @property({ type: Boolean, reflect: true }) preview = false;\n\n /** True while the exit animation is running before the snackbar fully closes. */\n @state() private dismissing = false;\n\n // ── Private fields ────────────────────────────────────────────────────────\n\n /** Timer handle for the auto-hide timeout. */\n private hideTimer: ReturnType<typeof setTimeout> | null = null;\n\n /** Timer handle for the exit animation duration timeout. */\n private exitTimer: ReturnType<typeof setTimeout> | null = null;\n\n private readonly handleGlobalSnackbarOpen = (\n event: Event,\n ) => {\n const { source } = (event as CustomEvent<{ source?: Snackbar }>).detail;\n if (source && source !== this) {\n this.hide();\n }\n };\n\n connectedCallback() {\n super.connectedCallback();\n document.addEventListener(\n Snackbar.GLOBAL_OPEN_EVENT,\n this.handleGlobalSnackbarOpen,\n );\n }\n\n disconnectedCallback() {\n document.removeEventListener(\n Snackbar.GLOBAL_OPEN_EVENT,\n this.handleGlobalSnackbarOpen,\n );\n this.clearExitTimer();\n this.clearTimer();\n super.disconnectedCallback();\n }\n\n protected updated(changedProperties: Map<string, unknown>) {\n if (changedProperties.has('open')) {\n if (this.open) {\n document.dispatchEvent(\n new CustomEvent(Snackbar.GLOBAL_OPEN_EVENT, {\n detail: { source: this },\n }),\n );\n }\n\n this.scheduleAutoHide();\n }\n }\n\n // ── Public methods ────────────────────────────────────────────────────────\n\n show() {\n this.dismissing = false;\n this.clearExitTimer();\n if (!this.open) {\n this.open = true;\n return;\n }\n\n this.scheduleAutoHide();\n }\n\n hide() {\n this.close('programmatic');\n }\n\n private close(reason: SnackbarCloseReason) {\n if (!this.open || this.dismissing) {\n return;\n }\n\n this.clearTimer();\n this.dismissing = true;\n this.clearExitTimer();\n this.exitTimer = setTimeout(() => {\n this.completeDismiss();\n }, Snackbar.EXIT_ANIMATION_MS);\n\n this.dispatchEvent(\n new CustomEvent('snackbar-close', {\n detail: { reason },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private completeDismiss() {\n this.clearExitTimer();\n this.dismissing = false;\n this.open = false;\n }\n\n private dispatchActionEvent() {\n this.dispatchEvent(\n new CustomEvent('snackbar-action', {\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private handleActionClick() {\n this.dispatchActionEvent();\n this.close('action');\n }\n\n private handleCloseClick() {\n this.close('dismiss');\n }\n\n private clearTimer() {\n if (this.hideTimer !== null) {\n clearTimeout(this.hideTimer);\n this.hideTimer = null;\n }\n }\n\n private clearExitTimer() {\n if (this.exitTimer !== null) {\n clearTimeout(this.exitTimer);\n this.exitTimer = null;\n }\n }\n\n private handleAnimationEnd(event: AnimationEvent) {\n if (event.animationName === 'snackbar-exit' && this.dismissing) {\n this.completeDismiss();\n }\n }\n\n private scheduleAutoHide() {\n this.clearTimer();\n if (!this.open || this.duration <= 0) {\n return;\n }\n\n this.hideTimer = setTimeout(() => {\n this.close('timeout');\n }, this.duration);\n }\n\n render() {\n const liveRole =\n this.actionLabel || this.showCloseIcon ? 'alert' : 'status';\n\n return html`\n <div\n class=${classMap({\n snackbar: true,\n open: !this.preview && this.open,\n preview: this.preview,\n dismissing: this.dismissing,\n multiline: this.multiline,\n })}\n role=${liveRole}\n aria-live=\"polite\"\n @animationend=${this.handleAnimationEnd}\n >\n <div class=\"label\">\n <slot>${this.message}</slot>\n </div>\n\n ${this.actionLabel\n ? html`<wc-button class=\"action\" variant='text' size='small' @click=${this.handleActionClick}>\n ${this.actionLabel}\n </wc-button>`\n : nothing}\n\n ${this.showCloseIcon\n ? html`<wc-icon-button\n class=\"close\"\n variant='text' \n size='small'\n aria-label=\"Dismiss notification\"\n @click=${this.handleCloseClick}\n >\n <wc-icon name=\"close\"></wc-icon>\n </wc-icon-button>`\n : nothing}\n </div>\n `;\n }\n}\n"],"names":["LitElement","html","classMap","nothing","styles","property","state"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;;;;;;;;;;;;;;;;;;;;AAoBG;AAEI,IAAM,QAAQ,GAAA,UAAA,GAAd,MAAM,QAAS,SAAQA,GAAU,CAAA;AAAjC,IAAA,WAAA,GAAA;;;QAQuC,IAAA,CAAA,IAAI,GAAG,KAAK;;QAG5B,IAAA,CAAA,OAAO,GAAG,EAAE;;QAGe,IAAA,CAAA,WAAW,GAAG,EAAE;;QAIvE,IAAA,CAAA,aAAa,GAAG,KAAK;;QAGO,IAAA,CAAA,QAAQ,GAAG,IAAI;;QAGC,IAAA,CAAA,SAAS,GAAG,KAAK;;QAGjB,IAAA,CAAA,OAAO,GAAG,KAAK;;QAG1C,IAAA,CAAA,UAAU,GAAG,KAAK;;;QAK3B,IAAA,CAAA,SAAS,GAAyC,IAAI;;QAGtD,IAAA,CAAA,SAAS,GAAyC,IAAI;AAE7C,QAAA,IAAA,CAAA,wBAAwB,GAAG,CAC1C,KAAY,KACV;AACF,YAAA,MAAM,EAAE,MAAM,EAAE,GAAI,KAA4C,CAAC,MAAM;AACvE,YAAA,IAAI,MAAM,IAAI,MAAM,KAAK,IAAI,EAA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CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAG3C,UAAA,CAAA;AAAhB,IAAAC,CAAK;AAA8B,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AA9BzB,QAAQ,GAAA,UAAA,GAAA,UAAA,CAAA;IADpB;AACY,CAAA,EAAA,QAAQ,CAuNpB;;;;"}
|
|
1
|
+
{"version":3,"file":"snackbar.js","sources":["../../src/snackbar/snackbar.ts"],"sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport styles from './snackbar.scss';\nimport IndividualComponent from '@/IndividualComponent.js';\n\ntype SnackbarCloseReason = 'timeout' | 'dismiss' | 'action' | 'programmatic';\n\n/**\n * @label Snackbar\n * @tag wc-snackbar\n * @rawTag snackbar\n * @summary Snackbars provide brief messages about app processes at the bottom of the screen.\n *\n * @cssprop --snackbar-container-color - Container color for the snackbar.\n * @cssprop --snackbar-label-text-color - Label text color for the snackbar.\n * @cssprop --snackbar-action-text-color - Action text color.\n * @cssprop --snackbar-close-icon-color - Close icon color.\n * @cssprop --snackbar-border-radius - Border radius of the snackbar surface.\n * @cssprop --snackbar-offset-inline - Inline offset from viewport edges.\n * @cssprop --snackbar-offset-bottom - Bottom offset from viewport edge.\n * @cssprop --snackbar-z-index - Stacking order for the snackbar.\n *\n * @example\n * ```html\n * <wc-snackbar preview message=\"Message archived\" action-label=\"Undo\"></wc-snackbar>\n * ```\n * @tags display, feedback\n */\n@IndividualComponent\nexport class Snackbar extends LitElement {\n static styles = [styles];\n\n private static readonly GLOBAL_OPEN_EVENT = 'wc-snackbar-will-open';\n\n private static readonly EXIT_ANIMATION_MS = 180;\n\n /** Whether the snackbar is currently visible. */\n @property({ type: Boolean, reflect: true }) open = false;\n\n /** The message text to display. Can also be provided via the default slot. */\n @property({ type: String }) message = '';\n\n /** Label for the optional action button. When empty, no action button is rendered. */\n @property({ type: String, attribute: 'action-label' }) actionLabel = '';\n\n /** When true, a dismiss icon button is shown on the trailing end. */\n @property({ type: Boolean, attribute: 'show-close-icon' })\n showCloseIcon = false;\n\n /** Auto-hide duration in milliseconds. Set to `0` to disable auto-hide. */\n @property({ type: Number }) duration = 4000;\n\n /** When true, the snackbar content is allowed to wrap to multiple lines. */\n @property({ type: Boolean, reflect: true }) multiline = false;\n\n /** When true, renders the snackbar in a static preview state (always visible, no animation). */\n @property({ type: Boolean, reflect: true }) preview = false;\n\n /** True while the exit animation is running before the snackbar fully closes. */\n @state() private dismissing = false;\n\n // ── Private fields ────────────────────────────────────────────────────────\n\n /** Timer handle for the auto-hide timeout. */\n private hideTimer: ReturnType<typeof setTimeout> | null = null;\n\n /** Timer handle for the exit animation duration timeout. */\n private exitTimer: ReturnType<typeof setTimeout> | null = null;\n\n private readonly handleGlobalSnackbarOpen = (\n event: Event,\n ) => {\n const { source } = (event as CustomEvent<{ source?: Snackbar }>).detail;\n if (source && source !== this) {\n this.hide();\n }\n };\n\n connectedCallback() {\n super.connectedCallback();\n document.addEventListener(\n Snackbar.GLOBAL_OPEN_EVENT,\n this.handleGlobalSnackbarOpen,\n );\n }\n\n disconnectedCallback() {\n document.removeEventListener(\n Snackbar.GLOBAL_OPEN_EVENT,\n this.handleGlobalSnackbarOpen,\n );\n this.clearExitTimer();\n this.clearTimer();\n super.disconnectedCallback();\n }\n\n protected updated(changedProperties: Map<string, unknown>) {\n if (changedProperties.has('open')) {\n if (this.open) {\n document.dispatchEvent(\n new CustomEvent(Snackbar.GLOBAL_OPEN_EVENT, {\n detail: { source: this },\n }),\n );\n }\n\n this.scheduleAutoHide();\n }\n }\n\n // ── Public methods ────────────────────────────────────────────────────────\n\n show() {\n this.dismissing = false;\n this.clearExitTimer();\n if (!this.open) {\n this.open = true;\n return;\n }\n\n this.scheduleAutoHide();\n }\n\n hide() {\n this.close('programmatic');\n }\n\n private close(reason: SnackbarCloseReason) {\n if (!this.open || this.dismissing) {\n return;\n }\n\n this.clearTimer();\n this.dismissing = true;\n this.clearExitTimer();\n this.exitTimer = setTimeout(() => {\n this.completeDismiss();\n }, Snackbar.EXIT_ANIMATION_MS);\n\n this.dispatchEvent(\n new CustomEvent('snackbar-close', {\n detail: { reason },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private completeDismiss() {\n this.clearExitTimer();\n this.dismissing = false;\n this.open = false;\n }\n\n private dispatchActionEvent() {\n this.dispatchEvent(\n new CustomEvent('snackbar-action', {\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private handleActionClick() {\n this.dispatchActionEvent();\n this.close('action');\n }\n\n private handleCloseClick() {\n this.close('dismiss');\n }\n\n private clearTimer() {\n if (this.hideTimer !== null) {\n clearTimeout(this.hideTimer);\n this.hideTimer = null;\n }\n }\n\n private clearExitTimer() {\n if (this.exitTimer !== null) {\n clearTimeout(this.exitTimer);\n this.exitTimer = null;\n }\n }\n\n private handleAnimationEnd(event: AnimationEvent) {\n if (event.animationName === 'snackbar-exit' && this.dismissing) {\n this.completeDismiss();\n }\n }\n\n private scheduleAutoHide() {\n this.clearTimer();\n if (!this.open || this.duration <= 0) {\n return;\n }\n\n this.hideTimer = setTimeout(() => {\n this.close('timeout');\n }, this.duration);\n }\n\n render() {\n const liveRole =\n this.actionLabel || this.showCloseIcon ? 'alert' : 'status';\n\n return html`\n <div\n class=${classMap({\n snackbar: true,\n open: !this.preview && this.open,\n preview: this.preview,\n dismissing: this.dismissing,\n multiline: this.multiline,\n })}\n role=${liveRole}\n aria-live=\"polite\"\n @animationend=${this.handleAnimationEnd}\n >\n <div class=\"label\">\n <slot>${this.message}</slot>\n </div>\n\n ${this.actionLabel\n ? html`<wc-button class=\"action\" variant='text' size='sm' @click=${this.handleActionClick}>\n ${this.actionLabel}\n </wc-button>`\n : nothing}\n\n ${this.showCloseIcon\n ? html`<wc-icon-button\n class=\"close\"\n variant='text'\n size='sm'\n aria-label=\"Dismiss notification\"\n @click=${this.handleCloseClick}\n >\n <wc-icon name=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primary]) {
|
|
|
139
139
|
:host([color=on-surface]) {
|
|
140
140
|
--filled-split-button-container-color: var(--color-on-surface);
|
|
141
141
|
--filled-split-button-label-text-color: var(--color-surface);
|
|
142
|
-
--tonal-split-button-container-color: var(--color-on-surface-
|
|
142
|
+
--tonal-split-button-container-color: var(--color-on-surface-variant);
|
|
143
143
|
--tonal-split-button-label-text-color: var(--color-surface-container-high);
|
|
144
144
|
--outlined-split-button-outline-color: var(--color-on-surface);
|
|
145
145
|
--outlined-split-button-label-text-color: var(--color-on-surface);
|
|
@@ -149,7 +149,7 @@ var css_248z$1 = i`:host([color=primary]) {
|
|
|
149
149
|
--filled-split-button-container-color: var(--color-surface-container-high);
|
|
150
150
|
--filled-split-button-label-text-color: var(--color-on-surface);
|
|
151
151
|
--tonal-split-button-container-color: var(--color-surface-container-high);
|
|
152
|
-
--tonal-split-button-label-text-color: var(--color-on-surface
|
|
152
|
+
--tonal-split-button-label-text-color: var(--color-on-surface);
|
|
153
153
|
--outlined-split-button-outline-color: var(--color-on-surface);
|
|
154
154
|
--outlined-split-button-label-text-color: var(--color-on-surface);
|
|
155
155
|
}`;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The size scale components share. Only button-like components add `xs` and `xl`. */
|
|
2
|
+
export type Size = 'sm' | 'md' | 'lg';
|
|
3
|
+
/** Long size names some components accepted before the `sm|md|lg` scale. Deprecated. */
|
|
4
|
+
export type LegacySize = 'small' | 'medium' | 'large';
|
|
5
|
+
/**
|
|
6
|
+
* Maps a size attribute onto the `sm|md|lg` scale, accepting the deprecated long names.
|
|
7
|
+
* Unknown values fall back to `fallback`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeSize(size: string | null | undefined, fallback?: Size): Size;
|
|
@@ -2,4 +2,4 @@ export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
|
2
2
|
export type ButtonLevel = 'primary' | 'secondary' | 'tertiary' | 'danger';
|
|
3
3
|
export type ButtonShape = 'round' | 'square';
|
|
4
4
|
export type ButtonVariant = 'elevated' | 'filled' | 'tonal' | 'outlined' | 'text' | 'neo';
|
|
5
|
-
export type ButtonColor = 'primary' | 'success' | 'danger' | 'warning' | 'surface' | 'on-surface';
|
|
5
|
+
export type ButtonColor = 'primary' | 'secondary' | 'tertiary' | 'success' | 'danger' | 'warning' | 'surface' | 'on-surface';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
+
import { type FormRestoreState, type FormValue, getFormState, getFormValue } from '@/__internal/mixins/form-associated.js';
|
|
3
|
+
declare const Checkbox_base: import("../__internal/mixins/mixin.js").MixinReturn<(abstract new (...args: any[]) => import("@/__internal/mixins/element-internals.js").WithElementInternals) & typeof LitElement & import("@/__internal/mixins/form-associated.js").FormAssociatedConstructor, import("@/__internal/mixins/form-associated.js").FormAssociated>;
|
|
2
4
|
/**
|
|
3
5
|
* @label Checkbox
|
|
4
6
|
* @tag wc-checkbox
|
|
@@ -7,35 +9,37 @@ import { LitElement } from 'lit';
|
|
|
7
9
|
* @overview
|
|
8
10
|
* <p>Checkboxes allow users to select one or more items from a set. Checkboxes can turn an option on or off.</p>
|
|
9
11
|
* <p>checkboxes feature a smooth animation and clear visual states for checked, unchecked, and indeterminate.</p>
|
|
12
|
+
* <p>The checkbox is form-associated: when <code>checked</code>, it submits <code>on</code> under its <code>name</code>.</p>
|
|
10
13
|
* @cssprop --checkbox-size: Size of the checkbox container.
|
|
11
14
|
* @cssprop --checkbox-selected-color: Color of the checkbox when selected.
|
|
12
15
|
* @cssprop --checkbox-unselected-color: Color of the checkbox border when unselected.
|
|
13
16
|
* @cssprop --checkbox-checkmark-color: Color of the checkmark icon.
|
|
14
17
|
* @cssprop --checkbox-state-layer-size: Size of the state layer for touch target.
|
|
15
|
-
* @fires {CustomEvent} change - Dispatched when the checkbox value
|
|
18
|
+
* @fires {CustomEvent} change - Dispatched when the checkbox is toggled. Detail: `{ checked, value, originalEvent }`.
|
|
16
19
|
* @fires {CustomEvent} blur - Dispatched when the checkbox loses focus.
|
|
17
20
|
* @fires {CustomEvent} focus - Dispatched when the checkbox receives focus.
|
|
18
21
|
* @tags input, form
|
|
19
22
|
*
|
|
20
23
|
* @example
|
|
21
24
|
* ```html
|
|
22
|
-
* <wc-checkbox label="Accept terms"></wc-checkbox>
|
|
25
|
+
* <wc-checkbox label="Accept terms" checked></wc-checkbox>
|
|
23
26
|
* ```
|
|
24
27
|
*/
|
|
25
|
-
export declare class Checkbox extends
|
|
28
|
+
export declare class Checkbox extends Checkbox_base {
|
|
26
29
|
static styles: import("lit").CSSResultGroup[];
|
|
27
|
-
/**
|
|
28
|
-
* The input field name.
|
|
29
|
-
*/
|
|
30
|
-
name: string;
|
|
31
30
|
/**
|
|
32
31
|
* The checkbox label.
|
|
33
32
|
*/
|
|
34
33
|
label: string;
|
|
35
34
|
/**
|
|
36
|
-
*
|
|
35
|
+
* Whether the checkbox is checked.
|
|
36
|
+
*/
|
|
37
|
+
checked: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use `checked`. Kept as an alias of `checked`.
|
|
37
40
|
*/
|
|
38
|
-
value: boolean;
|
|
41
|
+
get value(): boolean;
|
|
42
|
+
set value(value: boolean);
|
|
39
43
|
/**
|
|
40
44
|
* If true, displays the checkbox in an indeterminate state.
|
|
41
45
|
*/
|
|
@@ -57,10 +61,6 @@ export declare class Checkbox extends LitElement {
|
|
|
57
61
|
* If true, the checkbox is readonly. Defaults to `false`.
|
|
58
62
|
*/
|
|
59
63
|
readonly: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* If true, the user cannot interact with the checkbox. Defaults to `false`.
|
|
62
|
-
*/
|
|
63
|
-
disabled: boolean;
|
|
64
64
|
/**
|
|
65
65
|
* Configuration object for aria attributes.
|
|
66
66
|
*/
|
|
@@ -72,12 +72,25 @@ export declare class Checkbox extends LitElement {
|
|
|
72
72
|
/** True when slotted label content is present. */
|
|
73
73
|
private slotHasContent;
|
|
74
74
|
private containerElement?;
|
|
75
|
-
private nativeElement?;
|
|
76
75
|
/** Captured `tabindex` attribute value forwarded to the inner container. */
|
|
77
76
|
private tabindex?;
|
|
77
|
+
/** `checked` when first connected; `form.reset()` returns to it. */
|
|
78
|
+
private defaultChecked?;
|
|
78
79
|
connectedCallback(): void;
|
|
79
80
|
disconnectedCallback(): void;
|
|
80
81
|
firstUpdated(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Sets focus on the checkbox.
|
|
84
|
+
*/
|
|
85
|
+
focus(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Removes focus from the checkbox.
|
|
88
|
+
*/
|
|
89
|
+
blur(): void;
|
|
90
|
+
[getFormValue](): FormValue | null;
|
|
91
|
+
[getFormState](): FormValue | null;
|
|
92
|
+
formResetCallback(): void;
|
|
93
|
+
formStateRestoreCallback(state: FormRestoreState | null): void;
|
|
81
94
|
private handleInitialAttributes;
|
|
82
95
|
private windowMouseUp;
|
|
83
96
|
private windowKeyUp;
|
|
@@ -87,13 +100,6 @@ export declare class Checkbox extends LitElement {
|
|
|
87
100
|
private blurHandler;
|
|
88
101
|
private focusHandler;
|
|
89
102
|
private handleKeyUp;
|
|
90
|
-
/**
|
|
91
|
-
* Sets focus on the checkbox.
|
|
92
|
-
*/
|
|
93
|
-
focus(): void;
|
|
94
|
-
/**
|
|
95
|
-
* Removes focus from the checkbox.
|
|
96
|
-
*/
|
|
97
|
-
blur(): void;
|
|
98
103
|
render(): import("lit-html").TemplateResult<1>;
|
|
99
104
|
}
|
|
105
|
+
export {};
|
|
@@ -7,6 +7,9 @@ declare const Chip_base: import("../../__internal/mixins/mixin.js").MixinReturn<
|
|
|
7
7
|
* @summary Chip component for displaying compact information with optional actions.
|
|
8
8
|
* @tags display
|
|
9
9
|
*
|
|
10
|
+
* @fires {CustomEvent} dismiss - Dispatched when the dismiss button of a `dismissible` chip is clicked.
|
|
11
|
+
* @fires {CustomEvent} tag--dismiss - Deprecated alias of `dismiss`, fired alongside it.
|
|
12
|
+
*
|
|
10
13
|
* @example
|
|
11
14
|
* ```html
|
|
12
15
|
* <wc-chip>Chip content</wc-chip>
|
|
@@ -6,6 +6,9 @@ import { LitElement } from 'lit';
|
|
|
6
6
|
* @summary Tag component for displaying labels or values with optional dismiss functionality.
|
|
7
7
|
* @tags display
|
|
8
8
|
*
|
|
9
|
+
* @fires {CustomEvent} dismiss - Dispatched when the dismiss button is clicked.
|
|
10
|
+
* @fires {CustomEvent} tag--dismiss - Deprecated alias of `dismiss`, fired alongside it.
|
|
11
|
+
*
|
|
9
12
|
* @example
|
|
10
13
|
* ```html
|
|
11
14
|
* <wc-tag color="red">Tag</wc-tag>
|
|
@@ -18,7 +21,8 @@ export declare class Tag extends LitElement {
|
|
|
18
21
|
variant: 'elevated' | 'filled' | 'tonal' | 'outlined';
|
|
19
22
|
/** Tag color. */
|
|
20
23
|
color?: 'default' | 'blue' | 'green' | 'red' | 'yellow';
|
|
21
|
-
size
|
|
24
|
+
/** Tag size. Possible values are `"sm"`, `"md"`, `"lg"`. Defaults to `"md"`. */
|
|
25
|
+
size?: 'sm' | 'md' | 'lg';
|
|
22
26
|
private _dismissClickHandler;
|
|
23
27
|
private __renderDismissButton;
|
|
24
28
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
1
2
|
import BaseInput from '../input/BaseInput.js';
|
|
3
|
+
export type CodeEditorLanguage = 'javascript' | 'json' | 'html' | 'css' | 'scss';
|
|
2
4
|
/**
|
|
3
5
|
* @label Code Editor
|
|
4
6
|
* @tag wc-code-editor
|
|
@@ -7,42 +9,67 @@ import BaseInput from '../input/BaseInput.js';
|
|
|
7
9
|
* @summary A Monaco-based code editing component with syntax highlighting and theming.
|
|
8
10
|
* @overview
|
|
9
11
|
* - CodeEditor wraps Monaco Editor as a web component.
|
|
10
|
-
* - Supports
|
|
12
|
+
* - Supports JavaScript, JSON, HTML, CSS and SCSS, read-only mode, line numbers, minimap, and dark/light theme.
|
|
13
|
+
* - Has a copy button; hide it with `hide-copy`.
|
|
11
14
|
* - Emits `change` when content is edited and updates value from property changes.
|
|
12
15
|
*
|
|
16
|
+
* @cssprop --code-editor-height - Height of the editor. Defaults to 300px.
|
|
17
|
+
*
|
|
18
|
+
* @fires {Event} change - Dispatched when the user edits the content.
|
|
19
|
+
* @fires {CustomEvent<{value: string}>} copied - Dispatched after the copy button copies the content.
|
|
20
|
+
*
|
|
13
21
|
* @example
|
|
14
22
|
* ```html
|
|
15
23
|
* <wc-code-editor
|
|
16
|
-
* language="
|
|
24
|
+
* language="css"
|
|
25
|
+
* readonly
|
|
17
26
|
* style="width: 100%; --code-editor-height: 10rem;"
|
|
18
|
-
* value="
|
|
19
|
-
* lineNumbers="on"
|
|
20
|
-
* minimap="false">
|
|
27
|
+
* value=":root { --color-primary: #6341d5; }">
|
|
21
28
|
* </wc-code-editor>
|
|
22
29
|
* ```
|
|
23
30
|
* @tags input, editor
|
|
24
31
|
*/
|
|
25
32
|
export default class CodeEditor extends BaseInput {
|
|
26
33
|
static styles: import("lit").CSSResultGroup[];
|
|
27
|
-
|
|
34
|
+
/** The code shown in the editor. Updated as the user types. */
|
|
28
35
|
value: string;
|
|
29
|
-
|
|
36
|
+
/** Language used for syntax highlighting. Can be changed after the editor loads. */
|
|
37
|
+
language: CodeEditorLanguage;
|
|
38
|
+
/** Extra source loaded as a separate model, e.g. type definitions for completions. */
|
|
30
39
|
libSource: any;
|
|
40
|
+
/** Whether line numbers show in the gutter. */
|
|
31
41
|
lineNumbers: 'off' | 'on';
|
|
42
|
+
/** Shows the minimap. Leave the attribute out to hide it. */
|
|
32
43
|
minimap: boolean;
|
|
44
|
+
/** Hides the copy button. */
|
|
45
|
+
hideCopy: boolean;
|
|
46
|
+
/** Shows a "Read Only" badge while the editor is read-only or disabled. */
|
|
47
|
+
showReadonlyBadge: boolean;
|
|
48
|
+
/** Whether the page is in dark mode; picks the Monaco theme. */
|
|
33
49
|
private _isDarkMode;
|
|
50
|
+
/** Whether the editor text has focus. */
|
|
34
51
|
private hasFocus;
|
|
52
|
+
/** Whether the copy button was just used; shows a check for a few seconds. */
|
|
53
|
+
private _copied;
|
|
54
|
+
/** The Monaco editor instance, once loaded. */
|
|
35
55
|
private editorMonacoInstance?;
|
|
36
56
|
private editorElement;
|
|
57
|
+
/** The Monaco API returned by modern-monaco's init(). */
|
|
37
58
|
monaco: any;
|
|
59
|
+
/** Stops listening for theme changes. */
|
|
60
|
+
private __unobserveTheme?;
|
|
61
|
+
/** Resets the copied state of the copy button. */
|
|
62
|
+
private __copiedTimer?;
|
|
38
63
|
connectedCallback(): void;
|
|
39
64
|
disconnectedCallback(): void;
|
|
40
65
|
protected firstUpdated(): void;
|
|
41
|
-
protected updated(changedProperties:
|
|
42
|
-
private libSourceChanged;
|
|
43
|
-
private getTheme;
|
|
66
|
+
protected updated(changedProperties: PropertyValues<this>): void;
|
|
44
67
|
initializeMonaco(): Promise<void>;
|
|
45
68
|
setFocus(): Promise<void>;
|
|
46
69
|
setBlur(): Promise<void>;
|
|
70
|
+
private libSourceChanged;
|
|
71
|
+
private getTheme;
|
|
72
|
+
private __handleCopyClick;
|
|
73
|
+
private renderToolbar;
|
|
47
74
|
render(): import("lit-html").TemplateResult<1>;
|
|
48
75
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import BaseInput from '../input/BaseInput.js';
|
|
2
|
+
import type { Popover } from '../popover/popover.js';
|
|
3
|
+
/**
|
|
4
|
+
* @label Color Field
|
|
5
|
+
* @tag wc-color-field
|
|
6
|
+
* @rawTag color-field
|
|
7
|
+
*
|
|
8
|
+
* @summary A text field for a hex color, with a swatch that opens a color picker.
|
|
9
|
+
* @overview
|
|
10
|
+
* <p>Color field shows the current color as a swatch next to its hex value. Type a hex value, or
|
|
11
|
+
* click the swatch to pick one with <code>wc-color-picker</code> in a popover.</p>
|
|
12
|
+
* <p>It is form-associated: the hex value is submitted under its <code>name</code>.</p>
|
|
13
|
+
*
|
|
14
|
+
* @fires {CustomEvent<{value: string}>} input - Dispatched while the color changes in the picker.
|
|
15
|
+
* @fires {CustomEvent<{value: string}>} change - Dispatched when a color is committed, from the picker or the text field.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```html
|
|
19
|
+
* <wc-color-field label="Brand color" value="#7c5df0"></wc-color-field>
|
|
20
|
+
* ```
|
|
21
|
+
* @tags input, form
|
|
22
|
+
*/
|
|
23
|
+
export declare class ColorField extends BaseInput {
|
|
24
|
+
static styles: import("lit").CSSResultGroup[];
|
|
25
|
+
/** The color as a 6-digit hex string, such as `"#7c5df0"`. */
|
|
26
|
+
value: string;
|
|
27
|
+
/** Label shown above the field. */
|
|
28
|
+
label: string;
|
|
29
|
+
/** Helper text shown below the field. */
|
|
30
|
+
helperText: string;
|
|
31
|
+
/** Visual variant of the field. */
|
|
32
|
+
variant: 'filled' | 'outlined' | 'default';
|
|
33
|
+
/** Where the picker opens, relative to the field. */
|
|
34
|
+
placement: Popover['placement'];
|
|
35
|
+
/** Text in the hex input; differs from `value` while the user is typing. */
|
|
36
|
+
private draft;
|
|
37
|
+
private focused;
|
|
38
|
+
private pickerOpen;
|
|
39
|
+
/** True after the user typed something that is not a hex color. */
|
|
40
|
+
private invalid;
|
|
41
|
+
private popoverElement?;
|
|
42
|
+
private inputElement?;
|
|
43
|
+
protected willUpdate(changed: Map<PropertyKey, unknown>): void;
|
|
44
|
+
focus(): void;
|
|
45
|
+
/** Opens the color picker. */
|
|
46
|
+
showPicker(): void;
|
|
47
|
+
private commit;
|
|
48
|
+
private handleSwatchClick;
|
|
49
|
+
private handleTextInput;
|
|
50
|
+
private handleTextChange;
|
|
51
|
+
private handleTextKeyDown;
|
|
52
|
+
private handlePickerInput;
|
|
53
|
+
private handlePickerChange;
|
|
54
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ColorField } from './color-field.js';
|
|
@@ -59,7 +59,7 @@ export declare class ColorPicker extends LitElement {
|
|
|
59
59
|
/** The last `value` we set ourselves, used to skip redundant re-syncs in `updated`. */
|
|
60
60
|
private _lastEmittedValue;
|
|
61
61
|
connectedCallback(): void;
|
|
62
|
-
|
|
62
|
+
willUpdate(changed: Map<PropertyKey, unknown>): void;
|
|
63
63
|
private _syncFromValue;
|
|
64
64
|
private _computeHex;
|
|
65
65
|
private _emitValue;
|
|
@@ -3,7 +3,9 @@ import { LitElement } from 'lit';
|
|
|
3
3
|
* @label CB Divider
|
|
4
4
|
* @tag wc-cb-divider
|
|
5
5
|
* @rawTag cb-divider
|
|
6
|
-
* @summary A divider line used within a condition builder to visually connect
|
|
6
|
+
* @summary A divider line used within a condition builder to visually connect rules with an operator.
|
|
7
|
+
* @cssprop --cb-divider-line-color - Color of the divider line.
|
|
8
|
+
* @cssprop --cb-divider-arm-length - Length of the connecting arms drawn by `connect-start` and `connect-end`.
|
|
7
9
|
* @tags condition-builder
|
|
8
10
|
*
|
|
9
11
|
* @example
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CbRule } from './cb-rule.js';
|
|
2
|
+
export declare function getActiveRule(): CbRule | null;
|
|
3
|
+
export declare function setActiveRule(rule: CbRule | null): void;
|
|
4
|
+
/**
|
|
5
|
+
* Makes `clear` the current drop target's cleanup, running the previous one
|
|
6
|
+
* so only one group shows a drop indicator at a time. Pass `null` to clear.
|
|
7
|
+
*/
|
|
8
|
+
export declare function claimDropTarget(clear: (() => void) | null): void;
|
|
9
|
+
/** Clears the drop target if `clear` still owns it. */
|
|
10
|
+
export declare function releaseDropTarget(clear: () => void): void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { LitElement, nothing, type TemplateResult } from 'lit';
|
|
2
|
+
import type { CbRule } from './cb-rule.js';
|
|
3
|
+
import type { CbOperator } from './cb-types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Shared behaviour of `wc-condition-builder` and `wc-cb-group`: the And/Or
|
|
6
|
+
* operator pill, the bracket joining the items, and dropping dragged rules.
|
|
7
|
+
*/
|
|
8
|
+
export declare class CbGroupBase extends LitElement {
|
|
9
|
+
/** Viewport Y of the middle of an item's first row, where the bracket meets it. */
|
|
10
|
+
private static _rowCenter;
|
|
11
|
+
/** The logical operator joining the rules and groups in this group. */
|
|
12
|
+
operator: CbOperator;
|
|
13
|
+
/** Number of rules and groups in the default slot. */
|
|
14
|
+
private _itemCount;
|
|
15
|
+
/** Y of the drop indicator inside `.items`, or `null` when nothing is dragged over. */
|
|
16
|
+
private _dropIndicatorTop;
|
|
17
|
+
/** Whether the operator menu is open. */
|
|
18
|
+
private _menuOpen;
|
|
19
|
+
private readonly _itemsEl?;
|
|
20
|
+
private readonly _connectorEl?;
|
|
21
|
+
private readonly _pillEl?;
|
|
22
|
+
private readonly _menuEl?;
|
|
23
|
+
/** Id linking the operator pill to its menu. */
|
|
24
|
+
private readonly _menuId;
|
|
25
|
+
/** Re-measures the bracket when any item changes size. */
|
|
26
|
+
private readonly _resizeObserver;
|
|
27
|
+
/** Index the dragged rule would be inserted at, or -1. */
|
|
28
|
+
private _dropIndex;
|
|
29
|
+
connectedCallback(): void;
|
|
30
|
+
disconnectedCallback(): void;
|
|
31
|
+
updated(): void;
|
|
32
|
+
/** The rules and groups in this group, in order. */
|
|
33
|
+
get items(): HTMLElement[];
|
|
34
|
+
/**
|
|
35
|
+
* Moves `rule` into this group at `index` (counted without the rule itself).
|
|
36
|
+
* Fires a cancelable `rule-move` event first. Returns whether it moved.
|
|
37
|
+
*/
|
|
38
|
+
moveRule(rule: CbRule, index: number): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Viewport Y of the middle of this group's first row. A parent group aligns
|
|
41
|
+
* its bracket to it.
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
firstRowCenter(): number;
|
|
45
|
+
private _onSlotChange;
|
|
46
|
+
/** Spans the bracket from the first to the last item's first row. */
|
|
47
|
+
private _layoutConnector;
|
|
48
|
+
private _onPillClick;
|
|
49
|
+
private _onMenuActivate;
|
|
50
|
+
private readonly _clearDropIndicator;
|
|
51
|
+
private _onDragOver;
|
|
52
|
+
private _onDragLeave;
|
|
53
|
+
private _onDrop;
|
|
54
|
+
/** Content placed after the items; each group type renders its own actions. */
|
|
55
|
+
protected renderFooter(): TemplateResult | typeof nothing;
|
|
56
|
+
private _renderConnector;
|
|
57
|
+
private _renderOperatorMenu;
|
|
58
|
+
render(): TemplateResult<1>;
|
|
59
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CbGroupBase } from './cb-group-base.js';
|
|
2
|
+
/**
|
|
3
|
+
* @label CB Group
|
|
4
|
+
* @tag wc-cb-group
|
|
5
|
+
* @rawTag cb-group
|
|
6
|
+
* @summary A bordered, nested group of rules in a condition builder, joined by its own And/Or operator.
|
|
7
|
+
* @overview
|
|
8
|
+
* <p>A bracket on the left joins the group's rules, with a pill to switch between And and Or. Rules can be dragged into, out of and within the group.</p>
|
|
9
|
+
* @tags condition-builder
|
|
10
|
+
*
|
|
11
|
+
* @fires {CustomEvent<{operator: 'and' | 'or'}>} operator-change - Dispatched when the user picks a different operator.
|
|
12
|
+
* @fires {CustomEvent<{rule: CbRule, from: HTMLElement | null, to: HTMLElement, index: number}>} rule-move - Dispatched before a rule is moved into this group. Cancelable: unless prevented, the group moves the rule.
|
|
13
|
+
* @fires {CustomEvent<{group: HTMLElement}>} add-rule - Dispatched when the default "Add condition" link is clicked.
|
|
14
|
+
*
|
|
15
|
+
* @slot - Rules (`wc-cb-rule`) and nested groups.
|
|
16
|
+
* @slot actions - Replaces the default "Add condition" link.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```html
|
|
20
|
+
* <wc-cb-group operator="or">
|
|
21
|
+
* <wc-cb-rule>
|
|
22
|
+
* <wc-input placeholder="Value"></wc-input>
|
|
23
|
+
* </wc-cb-rule>
|
|
24
|
+
* <wc-cb-rule>
|
|
25
|
+
* <wc-input placeholder="Value"></wc-input>
|
|
26
|
+
* </wc-cb-rule>
|
|
27
|
+
* </wc-cb-group>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare class CbGroup extends CbGroupBase {
|
|
31
|
+
static styles: import("lit").CSSResultGroup[];
|
|
32
|
+
private _onAddRuleClick;
|
|
33
|
+
protected renderFooter(): import("lit-html").TemplateResult<1>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* @label CB Rule
|
|
4
|
+
* @tag wc-cb-rule
|
|
5
|
+
* @rawTag cb-rule
|
|
6
|
+
* @summary One condition row in a condition builder: a drag handle, the slotted field, operator and value controls, and a remove button.
|
|
7
|
+
* @overview
|
|
8
|
+
* <p>Drag the handle to reorder the rule, or to move it into another group. With the handle focused, ArrowUp and ArrowDown move the rule within its group.</p>
|
|
9
|
+
* @tags condition-builder
|
|
10
|
+
*
|
|
11
|
+
* @cssprop --cb-rule-field-height - Height of the slotted fields (wc-select, wc-input…). Defaults to `2.5rem`.
|
|
12
|
+
*
|
|
13
|
+
* @fires {CustomEvent<{rule: CbRule, group: HTMLElement | null}>} rule-remove - Dispatched when the remove button is clicked. Cancelable: unless prevented, the rule removes itself.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```html
|
|
17
|
+
* <wc-cb-rule>
|
|
18
|
+
* <wc-select placeholder="Field"></wc-select>
|
|
19
|
+
* <wc-select placeholder="Operator"></wc-select>
|
|
20
|
+
* <wc-input placeholder="Value"></wc-input>
|
|
21
|
+
* </wc-cb-rule>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class CbRule extends LitElement {
|
|
25
|
+
static styles: import("lit").CSSResultGroup[];
|
|
26
|
+
private readonly _handleEl?;
|
|
27
|
+
private _onDragStart;
|
|
28
|
+
private _onDragEnd;
|
|
29
|
+
private _onHandleKeyDown;
|
|
30
|
+
private _onRemoveClick;
|
|
31
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CbGroupBase } from './cb-group-base.js';
|
|
2
|
+
import type { CbRule } from './cb-rule.js';
|
|
3
|
+
export type CbOperator = 'and' | 'or';
|
|
4
|
+
export interface CbRuleMoveDetail {
|
|
5
|
+
rule: CbRule;
|
|
6
|
+
from: HTMLElement | null;
|
|
7
|
+
to: CbGroupBase;
|
|
8
|
+
index: number;
|
|
9
|
+
}
|
|
10
|
+
export interface CbRuleRemoveDetail {
|
|
11
|
+
rule: CbRule;
|
|
12
|
+
group: HTMLElement | null;
|
|
13
|
+
}
|
|
@@ -1,27 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CbGroupBase } from './cb-group-base.js';
|
|
2
2
|
/**
|
|
3
3
|
* @label Condition Builder
|
|
4
4
|
* @tag wc-condition-builder
|
|
5
5
|
* @rawTag condition-builder
|
|
6
|
-
* @summary A
|
|
6
|
+
* @summary A query builder for composing filter conditions from rules and nested groups joined by And/Or.
|
|
7
|
+
* @overview
|
|
8
|
+
* <p>The condition builder is the root group of a query. It holds rules (<code>wc-cb-rule</code>) and bordered nested groups (<code>wc-cb-group</code>), each joined by a bracket with an And/Or pill.</p>
|
|
9
|
+
* <ul>
|
|
10
|
+
* <li>Click the pill to switch a group between And and Or.</li>
|
|
11
|
+
* <li>Drag a rule by its handle to reorder it or move it between groups.</li>
|
|
12
|
+
* <li>Removing, moving and switching are built in; adding rules and groups is up to you, since only you know what a new rule contains. Listen for <code>add-rule</code> and <code>add-group</code>.</li>
|
|
13
|
+
* </ul>
|
|
7
14
|
* @tags condition-builder
|
|
8
15
|
*
|
|
16
|
+
* @fires {CustomEvent<{operator: 'and' | 'or'}>} operator-change - Dispatched when the user picks a different operator, on this or a nested group.
|
|
17
|
+
* @fires {CustomEvent<{rule: CbRule, from: HTMLElement | null, to: HTMLElement, index: number}>} rule-move - Dispatched before a rule is moved. Cancelable: unless prevented, the target group moves the rule.
|
|
18
|
+
* @fires {CustomEvent<{rule: CbRule, group: HTMLElement | null}>} rule-remove - Dispatched when a rule's remove button is clicked. Cancelable: unless prevented, the rule removes itself.
|
|
19
|
+
* @fires {CustomEvent<{group: HTMLElement}>} add-rule - Dispatched when "Add rule" (or a nested group's "Add condition") is clicked.
|
|
20
|
+
* @fires {CustomEvent<{group: HTMLElement}>} add-group - Dispatched when "Add inner group" is clicked.
|
|
21
|
+
*
|
|
22
|
+
* @slot - Rules (`wc-cb-rule`) and groups (`wc-cb-group`).
|
|
23
|
+
* @slot actions - Replaces the default "Add rule" and "Add inner group" buttons.
|
|
24
|
+
* @slot actions-end - Actions aligned to the end of the footer, such as a "Run query" button.
|
|
25
|
+
*
|
|
9
26
|
* @example
|
|
10
27
|
* ```html
|
|
11
|
-
* <wc-condition-builder>
|
|
12
|
-
* <wc-cb-
|
|
13
|
-
* <wc-
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
28
|
+
* <wc-condition-builder operator="and">
|
|
29
|
+
* <wc-cb-rule>
|
|
30
|
+
* <wc-input placeholder="Value"></wc-input>
|
|
31
|
+
* </wc-cb-rule>
|
|
32
|
+
* <wc-cb-group operator="or">
|
|
33
|
+
* <wc-cb-rule>
|
|
34
|
+
* <wc-input placeholder="Value"></wc-input>
|
|
35
|
+
* </wc-cb-rule>
|
|
36
|
+
* <wc-cb-rule>
|
|
37
|
+
* <wc-input placeholder="Value"></wc-input>
|
|
38
|
+
* </wc-cb-rule>
|
|
39
|
+
* </wc-cb-group>
|
|
40
|
+
* <wc-button slot="actions-end">Run query</wc-button>
|
|
21
41
|
* </wc-condition-builder>
|
|
22
42
|
* ```
|
|
23
43
|
*/
|
|
24
|
-
export declare class ConditionBuilder extends
|
|
44
|
+
export declare class ConditionBuilder extends CbGroupBase {
|
|
25
45
|
static styles: import("lit").CSSResultGroup[];
|
|
26
|
-
|
|
46
|
+
private _dispatchAdd;
|
|
47
|
+
protected renderFooter(): import("lit-html").TemplateResult<1>;
|
|
27
48
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ConditionBuilder } from './condition-builder.js';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export { CbExpression } from './cb-expression.js';
|
|
2
|
+
export { CbGroup } from './cb-group.js';
|
|
3
|
+
export { CbRule } from './cb-rule.js';
|
|
5
4
|
export { CbDivider } from './cb-divider.js';
|
|
5
|
+
export type { CbOperator, CbRuleMoveDetail, CbRuleRemoveDetail, } from './cb-types.js';
|