igniteui-webcomponents 7.1.2 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/components/banner/banner.d.ts +53 -17
- package/components/banner/banner.js +5 -0
- package/components/banner/banner.js.map +1 -1
- package/components/button/button-base.d.ts +80 -26
- package/components/button/button-base.js +64 -23
- package/components/button/button-base.js.map +1 -1
- package/components/button/button.d.ts +12 -3
- package/components/button/button.js +1 -1
- package/components/button/button.js.map +1 -1
- package/components/button/icon-button.d.ts +25 -9
- package/components/button/icon-button.js +2 -2
- package/components/button/icon-button.js.map +1 -1
- package/components/button-group/themes/shared/button/button.common.css.js +1 -1
- package/components/button-group/themes/shared/button/button.common.css.js.map +1 -1
- package/components/button-group/themes/shared/button/button.indigo.css.js +1 -1
- package/components/button-group/themes/shared/button/button.indigo.css.js.map +1 -1
- package/components/calendar/base.d.ts +5 -4
- package/components/calendar/base.js +3 -2
- package/components/calendar/base.js.map +1 -1
- package/components/calendar/calendar.js +17 -13
- package/components/calendar/calendar.js.map +1 -1
- package/components/calendar/days-view/days-view.d.ts +1 -0
- package/components/calendar/days-view/days-view.js +7 -4
- package/components/calendar/days-view/days-view.js.map +1 -1
- package/components/calendar/helpers.d.ts +1 -1
- package/components/calendar/helpers.js.map +1 -1
- package/components/chat/chat-message.js +8 -8
- package/components/chat/chat-message.js.map +1 -1
- package/components/chat/chat-state.d.ts +3 -1
- package/components/chat/chat-state.js +3 -2
- package/components/chat/chat-state.js.map +1 -1
- package/components/chat/chat.d.ts +5 -1
- package/components/chat/chat.js +14 -4
- package/components/chat/chat.js.map +1 -1
- package/components/checkbox/checkbox.js +1 -0
- package/components/checkbox/checkbox.js.map +1 -1
- package/components/checkbox/switch.js +1 -0
- package/components/checkbox/switch.js.map +1 -1
- package/components/combo/combo.d.ts +1 -0
- package/components/combo/combo.js +7 -0
- package/components/combo/combo.js.map +1 -1
- package/components/combo/controllers/navigation.js +3 -0
- package/components/combo/controllers/navigation.js.map +1 -1
- package/components/common/controllers/command.d.ts +62 -0
- package/components/common/controllers/command.js +25 -0
- package/components/common/controllers/command.js.map +1 -0
- package/components/common/controllers/id-resolver.d.ts +31 -0
- package/components/common/controllers/id-resolver.js +136 -0
- package/components/common/controllers/id-resolver.js.map +1 -0
- package/components/common/i18n/EN/calendar.resources.d.ts +16 -14
- package/components/common/i18n/EN/calendar.resources.js +1 -1
- package/components/common/i18n/EN/calendar.resources.js.map +1 -1
- package/components/common/i18n/EN/chat.resources.d.ts +10 -8
- package/components/common/i18n/EN/chat.resources.js.map +1 -1
- package/components/common/i18n/EN/date-picker.resources.d.ts +8 -0
- package/components/common/i18n/EN/date-picker.resources.js +8 -0
- package/components/common/i18n/EN/date-picker.resources.js.map +1 -0
- package/components/common/i18n/EN/date-range-picker.resources.d.ts +9 -7
- package/components/common/i18n/EN/date-range-picker.resources.js +1 -1
- package/components/common/i18n/EN/date-range-picker.resources.js.map +1 -1
- package/components/common/i18n/i18n-controller.d.ts +14 -11
- package/components/common/i18n/i18n-controller.js +33 -41
- package/components/common/i18n/i18n-controller.js.map +1 -1
- package/components/common/i18n/utils.d.ts +8 -2
- package/components/common/i18n/utils.js +52 -44
- package/components/common/i18n/utils.js.map +1 -1
- package/components/common/mixins/alert.d.ts +47 -9
- package/components/common/mixins/alert.js +55 -12
- package/components/common/mixins/alert.js.map +1 -1
- package/components/common/mixins/forms/associated.js +11 -0
- package/components/common/mixins/forms/associated.js.map +1 -1
- package/components/common/mixins/forms/form-transformers.d.ts +1 -1
- package/components/common/mixins/forms/form-transformers.js.map +1 -1
- package/components/common/mixins/forms/types.d.ts +5 -0
- package/components/common/mixins/forms/types.js.map +1 -1
- package/components/common/mixins/mask-behavior.d.ts +73 -0
- package/components/common/mixins/mask-behavior.js +159 -0
- package/components/common/mixins/mask-behavior.js.map +1 -0
- package/components/common/templates/input-shell.d.ts +24 -0
- package/components/common/templates/input-shell.js +43 -0
- package/components/common/templates/input-shell.js.map +1 -0
- package/components/common/templates/masked-input.d.ts +39 -0
- package/components/common/templates/masked-input.js +37 -0
- package/components/common/templates/masked-input.js.map +1 -0
- package/components/common/util.d.ts +11 -0
- package/components/common/util.js +20 -0
- package/components/common/util.js.map +1 -1
- package/components/date-picker/date-picker.d.ts +6 -4
- package/components/date-picker/date-picker.js +16 -5
- package/components/date-picker/date-picker.js.map +1 -1
- package/components/date-range-picker/date-range-input.d.ts +60 -0
- package/components/date-range-picker/date-range-input.js +251 -0
- package/components/date-range-picker/date-range-input.js.map +1 -0
- package/components/date-range-picker/date-range-mask-parser.d.ts +106 -0
- package/components/date-range-picker/date-range-mask-parser.js +121 -0
- package/components/date-range-picker/date-range-mask-parser.js.map +1 -0
- package/components/date-range-picker/date-range-picker.d.ts +17 -11
- package/components/date-range-picker/date-range-picker.js +89 -61
- package/components/date-range-picker/date-range-picker.js.map +1 -1
- package/components/date-range-picker/predefined-ranges-area.d.ts +4 -4
- package/components/date-range-picker/predefined-ranges-area.js +8 -4
- package/components/date-range-picker/predefined-ranges-area.js.map +1 -1
- package/components/date-range-picker/validators.d.ts +5 -19
- package/components/date-range-picker/validators.js +20 -16
- package/components/date-range-picker/validators.js.map +1 -1
- package/components/date-time-input/date-time-input.base.d.ts +155 -0
- package/components/date-time-input/date-time-input.base.js +275 -0
- package/components/date-time-input/date-time-input.base.js.map +1 -0
- package/components/date-time-input/date-time-input.d.ts +33 -122
- package/components/date-time-input/date-time-input.js +45 -258
- package/components/date-time-input/date-time-input.js.map +1 -1
- package/components/date-time-input/datetime-mask-parser.d.ts +11 -1
- package/components/date-time-input/datetime-mask-parser.js +5 -5
- package/components/date-time-input/datetime-mask-parser.js.map +1 -1
- package/components/dialog/dialog.d.ts +88 -31
- package/components/dialog/dialog.js +29 -31
- package/components/dialog/dialog.js.map +1 -1
- package/components/file-input/file-input.d.ts +1 -1
- package/components/input/input-base.d.ts +2 -10
- package/components/input/input-base.js +11 -57
- package/components/input/input-base.js.map +1 -1
- package/components/input/input.d.ts +1 -1
- package/components/input/input.js +1 -0
- package/components/input/input.js.map +1 -1
- package/components/input/themes/dark/input.shared.css.d.ts +1 -0
- package/components/input/themes/dark/input.shared.css.js +3 -0
- package/components/input/themes/dark/input.shared.css.js.map +1 -0
- package/components/input/themes/light/input.shared.css.js +1 -1
- package/components/input/themes/light/input.shared.css.js.map +1 -1
- package/components/input/themes/shared/input.common.css.js +1 -1
- package/components/input/themes/shared/input.common.css.js.map +1 -1
- package/components/input/themes/shared/input.material.css.js +1 -1
- package/components/input/themes/shared/input.material.css.js.map +1 -1
- package/components/input/themes/themes.js +4 -3
- package/components/input/themes/themes.js.map +1 -1
- package/components/mask-input/mask-input.d.ts +9 -4
- package/components/mask-input/mask-input.js +30 -36
- package/components/mask-input/mask-input.js.map +1 -1
- package/components/nav-drawer/nav-drawer.d.ts +93 -17
- package/components/nav-drawer/nav-drawer.js +148 -21
- package/components/nav-drawer/nav-drawer.js.map +1 -1
- package/components/nav-drawer/themes/container.base.css.js +1 -1
- package/components/nav-drawer/themes/container.base.css.js.map +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.common.css.js +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.common.css.js.map +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.fluent.css.js +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.fluent.css.js.map +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.indigo.css.js +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.indigo.css.js.map +1 -1
- package/components/radio/radio.js +1 -0
- package/components/radio/radio.js.map +1 -1
- package/components/snackbar/snackbar.d.ts +9 -5
- package/components/snackbar/snackbar.js +6 -8
- package/components/snackbar/snackbar.js.map +1 -1
- package/components/snackbar/themes/snackbar.base.css.js +1 -1
- package/components/snackbar/themes/snackbar.base.css.js.map +1 -1
- package/components/stepper/step.d.ts +1 -1
- package/components/stepper/step.js +4 -4
- package/components/stepper/step.js.map +1 -1
- package/components/stepper/stepper.js +5 -0
- package/components/stepper/stepper.js.map +1 -1
- package/components/stepper/themes/step/step.base.css.js +1 -1
- package/components/stepper/themes/step/step.base.css.js.map +1 -1
- package/components/stepper/themes/stepper/stepper.base.css.js +1 -1
- package/components/stepper/themes/stepper/stepper.base.css.js.map +1 -1
- package/components/toast/themes/toast.base.css.js +1 -1
- package/components/toast/themes/toast.base.css.js.map +1 -1
- package/components/toast/toast.d.ts +9 -2
- package/components/toast/toast.js +0 -2
- package/components/toast/toast.js.map +1 -1
- package/components/types.d.ts +4 -0
- package/components/types.js.map +1 -1
- package/custom-elements.json +34882 -28909
- package/igniteui-webcomponents.css-data.json +1 -1
- package/igniteui-webcomponents.html-data.json +1 -1
- package/index.d.ts +5 -2
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/skills/igniteui-wc-choose-components/SKILL.md +23 -6
- package/skills/igniteui-wc-choose-components/reference/mcp-setup.md +82 -0
- package/skills/igniteui-wc-generate-from-image-design/references/component-mapping.md +4 -2
- package/web-types.json +2 -2
- package/components/mask-input/mask-input-base.d.ts +0 -51
- package/components/mask-input/mask-input-base.js +0 -146
- package/components/mask-input/mask-input-base.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,55 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [7.2.0] - 2026-05-27
|
|
8
|
+
### Added
|
|
9
|
+
- #### Date Range Picker
|
|
10
|
+
- Added support for editing the date range value directly via a single input field. [#1733](https://github.com/IgniteUI/igniteui-webcomponents/pull/1733)
|
|
11
|
+
- #### Nav Drawer
|
|
12
|
+
- The drawer for non-relative positions are now implemented using the native Popover API, providing built-in modal semantics, focus trapping, and accessibility support. [#2194](https://github.com/IgniteUI/igniteui-webcomponents/pull/2194)
|
|
13
|
+
- Added `keepOpenOnEscape` property — prevents the drawer from closing when the user presses the **Escape** key (non-relative positions only). [#2194](https://github.com/IgniteUI/igniteui-webcomponents/pull/2194)
|
|
14
|
+
- Added `igcClosing` event — emitted just before the drawer is closed by user interaction. Cancelable. [#2194](https://github.com/IgniteUI/igniteui-webcomponents/pull/2194)
|
|
15
|
+
- Added `igcClosed` event — emitted just after the drawer is closed by user interaction. [#2194](https://github.com/IgniteUI/igniteui-webcomponents/pull/2194)
|
|
16
|
+
- #### Invoker Commands API
|
|
17
|
+
- `igc-button` and `igc-icon-button` now support `command` and `commandfor` properties, enabling declarative control of target components without JavaScript. [#2225](https://github.com/IgniteUI/igniteui-webcomponents/pull/2225)
|
|
18
|
+
- `igc-banner`, `igc-dialog`, `igc-nav-drawer`, `igc-snackbar`, and `igc-toast` now respond to `--show`, `--hide`, and `--toggle` commands dispatched by an invoker button. [#2225](https://github.com/IgniteUI/igniteui-webcomponents/pull/2225)
|
|
19
|
+
- #### Snackbar
|
|
20
|
+
- Added `positioning` property (`viewport` | `container`). The component now renders as a popover in the browser top layer. Setting `positioning` to `container` anchors the component to its nearest visible ancestor instead of the viewport. [#2203](https://github.com/IgniteUI/igniteui-webcomponents/pull/2203)
|
|
21
|
+
- #### Toast
|
|
22
|
+
- Added `positioning` property (`viewport` | `container`). The component now renders as a popover in the browser top layer. Setting `positioning` to `container` anchors the component to its nearest visible ancestor instead of the viewport. [#2203](https://github.com/IgniteUI/igniteui-webcomponents/pull/2203)
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- #### AI-Assisted Development
|
|
26
|
+
- Updated and enhanced the library provided skills [#2232](https://github.com/IgniteUI/igniteui-webcomponents/pull/2232)
|
|
27
|
+
- #### Form controls
|
|
28
|
+
- `IgcInput`, `IgcMaskInput`, `IgcDateTimeInput`, `IgcCheckbox`, `IgcRadio`, `IgcSwitch`, `IgcDatePicker`, and `IgcDateRangePicker` now submit their associated form on **Enter** key press, matching native browser behavior. [#2213](https://github.com/IgniteUI/igniteui-webcomponents/pull/2213)
|
|
29
|
+
- #### Input
|
|
30
|
+
- Added theming support for `date`, `time`, `datetime-local`, `week`, and `month` input types, ensuring consistent styles and floating label behavior across all supported themes. [#2223](https://github.com/IgniteUI/igniteui-webcomponents/pull/2223)
|
|
31
|
+
- #### Nav Drawer
|
|
32
|
+
- The `overlay` CSS part has been removed. Users of the component can target the `base` part's `::backdrop` pseudo-element, the
|
|
33
|
+
`--ig-overlay-background-color` variable or use the theming package. [#2194](https://github.com/IgniteUI/igniteui-webcomponents/pull/2194)
|
|
34
|
+
|
|
35
|
+
### Deprecated
|
|
36
|
+
- #### Localization
|
|
37
|
+
- The old resource string interfaces for `Calendar`, `Chat`, `Date Picker`, and `Date Range Picker` are deprecated. Components now use the new `igniteui-i18n` resource keys. Setting individual `resourceStrings` properties directly is no longer supported; provide a complete resource strings object instead. [#2169](https://github.com/IgniteUI/igniteui-webcomponents/pull/2169)
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
- #### Button Group
|
|
41
|
+
- Selected state border color mismatch in focused and hover states. [#2219](https://github.com/IgniteUI/igniteui-webcomponents/pull/2219)
|
|
42
|
+
- #### Combo
|
|
43
|
+
- Display value not restored correctly when tabbing out in single-select mode with a partial search text. [#2224](https://github.com/IgniteUI/igniteui-webcomponents/pull/2224)
|
|
44
|
+
- #### Stepper
|
|
45
|
+
- Step components connected to the DOM before their parent stepper now correctly receive context after being adopted by a stepper. [#2228](https://github.com/IgniteUI/igniteui-webcomponents/pull/2228)
|
|
46
|
+
|
|
47
|
+
## [7.1.3] - 2026-04-28
|
|
48
|
+
### Changed
|
|
49
|
+
- #### AI-Assisted Development
|
|
50
|
+
- Updated and enhanced the library provided skills [#2207](https://github.com/IgniteUI/igniteui-webcomponents/pull/2207)
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
- #### Stepper
|
|
54
|
+
- In horizontal orientation, the content area height can now driven by the active step's content instead of always being sized to the tallest step. A new `--body-grid-rows` CSS custom property controls the internal row sizing of each step body — its default value of `1fr` expands the body to fit its content, while setting it to `0fr` collapses the body to zero height, enabling fully variable step heights. [#2209](https://github.com/IgniteUI/igniteui-webcomponents/issues/2209)
|
|
55
|
+
|
|
7
56
|
## [7.1.2] - 2026-04-22
|
|
8
57
|
### Changed
|
|
9
58
|
- #### AI-Assisted Development
|
|
@@ -1306,6 +1355,8 @@ Initial release of Ignite UI Web Components
|
|
|
1306
1355
|
- Ripple component
|
|
1307
1356
|
- Switch component
|
|
1308
1357
|
|
|
1358
|
+
[7.2.0]: https://github.com/IgniteUI/igniteui-webcomponents/compare/7.1.3...7.2.0
|
|
1359
|
+
[7.1.3]: https://github.com/IgniteUI/igniteui-webcomponents/compare/7.1.2...7.1.3
|
|
1309
1360
|
[7.1.2]: https://github.com/IgniteUI/igniteui-webcomponents/compare/7.1.1...7.1.2
|
|
1310
1361
|
[7.1.1]: https://github.com/IgniteUI/igniteui-webcomponents/compare/7.1.0...7.1.1
|
|
1311
1362
|
[7.1.0]: https://github.com/IgniteUI/igniteui-webcomponents/compare/7.0.1...7.1.0
|
|
@@ -6,23 +6,38 @@ export interface IgcBannerComponentEventMap {
|
|
|
6
6
|
}
|
|
7
7
|
declare const IgcBannerComponent_base: Constructor<import("../common/mixins/event-emitter.js").EventEmitterInterface<IgcBannerComponentEventMap>> & Constructor<LitElement>;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* A non-modal notification banner that displays important, concise messages
|
|
10
|
+
* requiring user acknowledgement.
|
|
11
|
+
*
|
|
12
|
+
* The banner slides into view with an animated grow transition and renders
|
|
13
|
+
* inline, pushing the surrounding page content rather than overlaying it.
|
|
14
|
+
*
|
|
15
|
+
* The component integrates with the
|
|
16
|
+
* [Invoker Commands API](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API):
|
|
17
|
+
* an Ignite button or a native `<button>` with `command="--show"` / `"--hide"` /
|
|
18
|
+
* `"--toggle"` and `commandfor` pointing to this element will call the
|
|
19
|
+
* corresponding method declaratively without any JavaScript.
|
|
10
20
|
*
|
|
11
21
|
* @element igc-banner
|
|
12
22
|
*
|
|
13
|
-
* @
|
|
14
|
-
*
|
|
15
|
-
*
|
|
23
|
+
* @fires igcClosing - Emitted just before the banner closes in response to the
|
|
24
|
+
* default action button being clicked. Cancelable — call
|
|
25
|
+
* `event.preventDefault()` to abort the closing sequence.
|
|
26
|
+
* @fires igcClosed - Emitted after the banner has fully closed and its exit
|
|
27
|
+
* animation has completed.
|
|
16
28
|
*
|
|
17
|
-
* @
|
|
18
|
-
* @
|
|
29
|
+
* @slot - The banner message text content.
|
|
30
|
+
* @slot prefix - An icon or illustration rendered to the left of the message.
|
|
31
|
+
* Useful for reinforcing the message type (info, warning, success, etc.).
|
|
32
|
+
* @slot actions - Custom action elements rendered in the banner's action area.
|
|
33
|
+
* When provided, replaces the default "OK" dismiss button.
|
|
19
34
|
*
|
|
20
|
-
* @csspart base - The
|
|
21
|
-
* @csspart spacer - The inner wrapper that
|
|
22
|
-
* @csspart message - The
|
|
23
|
-
* @csspart illustration - The
|
|
24
|
-
* @csspart content - The
|
|
25
|
-
* @csspart actions - The
|
|
35
|
+
* @csspart base - The root wrapper element of the banner.
|
|
36
|
+
* @csspart spacer - The inner wrapper that controls the spacing around the banner content.
|
|
37
|
+
* @csspart message - The container that holds the illustration and text content.
|
|
38
|
+
* @csspart illustration - The container for the prefix slot (icon/illustration).
|
|
39
|
+
* @csspart content - The container for the default message slot.
|
|
40
|
+
* @csspart actions - The container for the action buttons slot.
|
|
26
41
|
*/
|
|
27
42
|
export default class IgcBannerComponent extends IgcBannerComponent_base {
|
|
28
43
|
static readonly tagName = "igc-banner";
|
|
@@ -31,17 +46,38 @@ export default class IgcBannerComponent extends IgcBannerComponent_base {
|
|
|
31
46
|
private readonly _bannerRef;
|
|
32
47
|
private readonly _player;
|
|
33
48
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
49
|
+
* Whether the banner is open.
|
|
50
|
+
*
|
|
51
|
+
* Setting this property programmatically will immediately show or hide the
|
|
52
|
+
* banner without animation and without emitting close events.
|
|
53
|
+
* Prefer the `show()`, `hide()`, and `toggle()` methods for animated
|
|
54
|
+
* transitions.
|
|
55
|
+
* @attr open
|
|
56
|
+
* @default false
|
|
36
57
|
*/
|
|
37
58
|
open: boolean;
|
|
38
59
|
constructor();
|
|
39
60
|
private _handleClick;
|
|
40
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Opens the banner with an animated grow-in transition.
|
|
63
|
+
*
|
|
64
|
+
* Returns `true` when the banner was successfully opened, or `false` if
|
|
65
|
+
* it was already open.
|
|
66
|
+
*/
|
|
41
67
|
show(): Promise<boolean>;
|
|
42
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Closes the banner with an animated grow-out transition.
|
|
70
|
+
*
|
|
71
|
+
* Returns `true` when the banner was successfully closed, or `false` if
|
|
72
|
+
* it was already closed.
|
|
73
|
+
*/
|
|
43
74
|
hide(): Promise<boolean>;
|
|
44
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* Toggles the banner open or closed depending on its current state.
|
|
77
|
+
*
|
|
78
|
+
* Equivalent to calling `show()` when closed and `hide()` when open.
|
|
79
|
+
* Returns `true` when the transition completed successfully.
|
|
80
|
+
*/
|
|
45
81
|
toggle(): Promise<boolean>;
|
|
46
82
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
47
83
|
}
|
|
@@ -11,6 +11,7 @@ import { addAnimationController } from '../../animations/player.js';
|
|
|
11
11
|
import { growVerIn, growVerOut } from '../../animations/presets/grow/index.js';
|
|
12
12
|
import { addThemingController } from '../../theming/theming-controller.js';
|
|
13
13
|
import IgcButtonComponent from '../button/button.js';
|
|
14
|
+
import { addCommandController } from '../common/controllers/command.js';
|
|
14
15
|
import { addInternalsController } from '../common/controllers/internals.js';
|
|
15
16
|
import { addSlotController, setSlots } from '../common/controllers/slot.js';
|
|
16
17
|
import { registerComponent } from '../common/definitions/register.js';
|
|
@@ -36,6 +37,10 @@ export default class IgcBannerComponent extends EventEmitterMixin(LitElement) {
|
|
|
36
37
|
ariaLive: 'polite',
|
|
37
38
|
},
|
|
38
39
|
});
|
|
40
|
+
addCommandController(this)
|
|
41
|
+
.set('--show', this.show)
|
|
42
|
+
.set('--hide', this.hide)
|
|
43
|
+
.set('--toggle', this.toggle);
|
|
39
44
|
}
|
|
40
45
|
async _handleClick() {
|
|
41
46
|
if (this.emitEvent('igcClosing', { cancelable: true })) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner.js","sourceRoot":"","sources":["../../../src/components/banner/banner.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,kBAAkB,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"banner.js","sourceRoot":"","sources":["../../../src/components/banner/banner.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU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EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC/C,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA;aACF,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI;;;;;;;;;;;;;;;yBAezC,IAAI,CAAC,YAAY;;;;;;;KAOrC,CAAC;IACJ,CAAC;;AA5FM;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDACvB","sourcesContent":["import { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\nimport { addAnimationController } from '../../animations/player.js';\nimport { growVerIn, growVerOut } from '../../animations/presets/grow/index.js';\nimport { addThemingController } from '../../theming/theming-controller.js';\nimport IgcButtonComponent from '../button/button.js';\nimport { addCommandController } from '../common/controllers/command.js';\nimport { addInternalsController } from '../common/controllers/internals.js';\nimport { addSlotController, setSlots } from '../common/controllers/slot.js';\nimport { registerComponent } from '../common/definitions/register.js';\nimport type { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport { styles } from './themes/banner.base.css.js';\nimport { all } from './themes/themes.js';\n\nexport interface IgcBannerComponentEventMap {\n igcClosing: CustomEvent<void>;\n igcClosed: CustomEvent<void>;\n}\n\n/**\n * A non-modal notification banner that displays important, concise messages\n * requiring user acknowledgement.\n *\n * The banner slides into view with an animated grow transition and renders\n * inline, pushing the surrounding page content rather than overlaying it.\n *\n * The component integrates with the\n * [Invoker Commands API](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API):\n * an Ignite button or a native `<button>` with `command=\"--show\"` / `\"--hide\"` /\n * `\"--toggle\"` and `commandfor` pointing to this element will call the\n * corresponding method declaratively without any JavaScript.\n *\n * @element igc-banner\n *\n * @fires igcClosing - Emitted just before the banner closes in response to the\n * default action button being clicked. Cancelable — call\n * `event.preventDefault()` to abort the closing sequence.\n * @fires igcClosed - Emitted after the banner has fully closed and its exit\n * animation has completed.\n *\n * @slot - The banner message text content.\n * @slot prefix - An icon or illustration rendered to the left of the message.\n * Useful for reinforcing the message type (info, warning, success, etc.).\n * @slot actions - Custom action elements rendered in the banner's action area.\n * When provided, replaces the default \"OK\" dismiss button.\n *\n * @csspart base - The root wrapper element of the banner.\n * @csspart spacer - The inner wrapper that controls the spacing around the banner content.\n * @csspart message - The container that holds the illustration and text content.\n * @csspart illustration - The container for the prefix slot (icon/illustration).\n * @csspart content - The container for the default message slot.\n * @csspart actions - The container for the action buttons slot.\n */\nexport default class IgcBannerComponent extends EventEmitterMixin<\n IgcBannerComponentEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static readonly tagName = 'igc-banner';\n public static styles = [styles];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcBannerComponent, IgcButtonComponent);\n }\n\n private readonly _bannerRef = createRef<HTMLElement>();\n private readonly _player = addAnimationController(this, this._bannerRef);\n\n /**\n * Whether the banner is open.\n *\n * Setting this property programmatically will immediately show or hide the\n * banner without animation and without emitting close events.\n * Prefer the `show()`, `hide()`, and `toggle()` methods for animated\n * transitions.\n * @attr open\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n constructor() {\n super();\n\n addThemingController(this, all);\n addSlotController(this, { slots: setSlots('prefix', 'actions') });\n addInternalsController(this, {\n initialARIA: {\n role: 'status',\n ariaLive: 'polite',\n },\n });\n addCommandController(this)\n .set('--show', this.show)\n .set('--hide', this.hide)\n .set('--toggle', this.toggle);\n }\n\n private async _handleClick(): Promise<void> {\n if (this.emitEvent('igcClosing', { cancelable: true })) {\n await this.hide();\n this.emitEvent('igcClosed');\n }\n }\n\n /**\n * Opens the banner with an animated grow-in transition.\n *\n * Returns `true` when the banner was successfully opened, or `false` if\n * it was already open.\n */\n public async show(): Promise<boolean> {\n if (this.open) {\n return false;\n }\n\n this.open = true;\n return this._player.playExclusive(growVerIn());\n }\n\n /**\n * Closes the banner with an animated grow-out transition.\n *\n * Returns `true` when the banner was successfully closed, or `false` if\n * it was already closed.\n */\n public async hide(): Promise<boolean> {\n if (!this.open) {\n return false;\n }\n\n await this._player.playExclusive(growVerOut());\n this.open = false;\n return true;\n }\n\n /**\n * Toggles the banner open or closed depending on its current state.\n *\n * Equivalent to calling `show()` when closed and `hide()` when open.\n * Returns `true` when the transition completed successfully.\n */\n public async toggle(): Promise<boolean> {\n return this.open ? this.hide() : this.show();\n }\n\n protected override render() {\n return html`\n <div ${ref(this._bannerRef)} part=\"base\" .inert=${!this.open}>\n <div part=\"spacer\">\n <div part=\"message\">\n <div part=\"illustration\">\n <slot name=\"prefix\"></slot>\n </div>\n <div part=\"content\">\n <slot></slot>\n </div>\n </div>\n <div part=\"actions\">\n <slot name=\"actions\">\n <igc-button\n type=\"button\"\n variant=\"flat\"\n @click=${this._handleClick}\n >OK</igc-button\n >\n </slot>\n </div>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-banner': IgcBannerComponent;\n }\n}\n"]}
|
|
@@ -5,57 +5,111 @@ export interface IgcButtonEventMap {
|
|
|
5
5
|
blur: FocusEvent;
|
|
6
6
|
}
|
|
7
7
|
declare const IgcButtonBaseComponent_base: Constructor<import("../common//mixins/event-emitter.js").EventEmitterInterface<IgcButtonEventMap>> & Constructor<LitElement>;
|
|
8
|
+
/**
|
|
9
|
+
* Abstract base class shared by `igc-button` and `igc-icon-button`.
|
|
10
|
+
*
|
|
11
|
+
* Provides common form-association behavior, link-button rendering
|
|
12
|
+
* (renders as `<a>` when `href` is set), keyboard focus-ring management,
|
|
13
|
+
* and the Invoker Commands API (`command` / `commandfor`).
|
|
14
|
+
*
|
|
15
|
+
* Concrete subclasses must implement `_renderContent()` to supply the
|
|
16
|
+
* visual content projected inside the native `<button>` or `<a>` element.
|
|
17
|
+
*/
|
|
8
18
|
export declare abstract class IgcButtonBaseComponent extends IgcButtonBaseComponent_base {
|
|
9
19
|
static readonly formAssociated = true;
|
|
10
|
-
protected readonly _internals: import("../common/controllers/internals.js").ElementInternalsController;
|
|
11
20
|
private readonly _focusRingManager;
|
|
12
|
-
|
|
13
|
-
private readonly
|
|
21
|
+
private readonly _internals;
|
|
22
|
+
private readonly _resolver;
|
|
23
|
+
private _disabled;
|
|
24
|
+
private _commandfor;
|
|
25
|
+
private _commandForElement;
|
|
26
|
+
private readonly _nativeButton?;
|
|
14
27
|
/**
|
|
15
|
-
* The type of the button
|
|
16
|
-
*
|
|
28
|
+
* The type of the button, which determines its behavior and semantics.
|
|
29
|
+
* - `'button'` – no default action; useful for custom JavaScript handlers.
|
|
30
|
+
* - `'submit'` – submits the associated form when clicked.
|
|
31
|
+
* - `'reset'` – resets the associated form fields to their initial values.
|
|
32
|
+
*
|
|
33
|
+
* Ignored when the button is rendered as a link (i.e. `href` is set).
|
|
34
|
+
* @attr type
|
|
35
|
+
* @default 'button'
|
|
17
36
|
*/
|
|
18
37
|
type: 'button' | 'reset' | 'submit';
|
|
19
38
|
/**
|
|
20
|
-
* The URL the button points to.
|
|
21
|
-
*
|
|
39
|
+
* The URL the button points to. When set, the component renders as an
|
|
40
|
+
* `<a>` element instead of a `<button>`, enabling navigation on click.
|
|
41
|
+
* Use together with `target`, `download`, and `rel` for full anchor semantics.
|
|
42
|
+
* @attr href
|
|
22
43
|
*/
|
|
23
44
|
href?: string;
|
|
24
45
|
/**
|
|
25
|
-
* Prompts to
|
|
26
|
-
*
|
|
46
|
+
* Prompts the browser to download the linked resource rather than navigating
|
|
47
|
+
* to it. The optional value is used as the suggested file name.
|
|
48
|
+
* Only effective when `href` is set.
|
|
49
|
+
* @attr download
|
|
27
50
|
*/
|
|
28
51
|
download?: string;
|
|
29
52
|
/**
|
|
30
|
-
* Where to
|
|
31
|
-
*
|
|
53
|
+
* Where to open the linked document. Only effective when `href` is set.
|
|
54
|
+
* - `'_self'` – current browsing context (default browser behavior).
|
|
55
|
+
* - `'_blank'` – new tab or window.
|
|
56
|
+
* - `'_parent'` – parent browsing context; falls back to `_self` if none.
|
|
57
|
+
* - `'_top'` – top-level browsing context; falls back to `_self` if none.
|
|
58
|
+
* @attr target
|
|
32
59
|
*/
|
|
33
60
|
target?: '_blank' | '_parent' | '_self' | '_top';
|
|
34
61
|
/**
|
|
35
|
-
* The relationship
|
|
36
|
-
*
|
|
37
|
-
*
|
|
62
|
+
* The relationship between the current document and the linked URL.
|
|
63
|
+
* Accepts a space-separated list of link types (e.g. `'noopener noreferrer'`).
|
|
64
|
+
* Only effective when `href` is set. When `target="_blank"` is used,
|
|
65
|
+
* setting `rel="noopener noreferrer"` is strongly recommended for security.
|
|
66
|
+
* @attr rel
|
|
38
67
|
*/
|
|
39
68
|
rel?: string;
|
|
40
69
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
70
|
+
* When set, the button will be disabled and non-interactive.
|
|
71
|
+
*
|
|
72
|
+
* @attr disabled
|
|
73
|
+
* @default false
|
|
43
74
|
*/
|
|
44
75
|
set disabled(value: boolean);
|
|
45
76
|
get disabled(): boolean;
|
|
46
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* The command to invoke on the target element specified by `commandfor`.
|
|
79
|
+
* Part of the [Invoker Commands](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API) API.
|
|
80
|
+
* Custom commands must start with two dashes (e.g. `'--my-command'`).
|
|
81
|
+
* @attr command
|
|
82
|
+
*/
|
|
83
|
+
command?: string;
|
|
84
|
+
/**
|
|
85
|
+
* The ID of the target element for the invoker command.
|
|
86
|
+
* Part of the [Invoker Commands API](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API).
|
|
87
|
+
* @attr commandfor
|
|
88
|
+
*/
|
|
89
|
+
set commandfor(value: string | null);
|
|
90
|
+
get commandfor(): string | null;
|
|
91
|
+
/**
|
|
92
|
+
* The target element for the invoker command. Resolved from the `commandfor` ID.
|
|
93
|
+
*/
|
|
94
|
+
get commandForElement(): Element | null;
|
|
95
|
+
set commandForElement(value: Element | null);
|
|
96
|
+
/**
|
|
97
|
+
* The `<form>` element the button is associated with.
|
|
98
|
+
* Resolved through the standard form-association mechanism — either the
|
|
99
|
+
* closest ancestor `<form>` or the form referenced by the button's `form`
|
|
100
|
+
* attribute. Returns `null` when no form is associated.
|
|
101
|
+
* Relevant only when `type` is `'submit'` or `'reset'`.
|
|
102
|
+
*/
|
|
47
103
|
get form(): HTMLFormElement | null;
|
|
48
|
-
|
|
49
|
-
focus(options?: FocusOptions): void;
|
|
50
|
-
/** Simulates a mouse click on the element */
|
|
51
|
-
click(): void;
|
|
52
|
-
/** Removes focus from the button. */
|
|
53
|
-
blur(): void;
|
|
104
|
+
protected firstUpdated(): void;
|
|
54
105
|
protected _handleClick(): void;
|
|
55
106
|
protected formDisabledCallback(state: boolean): void;
|
|
56
|
-
private
|
|
57
|
-
|
|
58
|
-
|
|
107
|
+
private _resolveCommandForElement;
|
|
108
|
+
/** Simulates a mouse click on the button, triggering its click handler and any associated form action. */
|
|
109
|
+
click(): void;
|
|
110
|
+
private _renderButton;
|
|
111
|
+
private _renderLinkButton;
|
|
112
|
+
protected abstract _renderContent(): TemplateResult;
|
|
59
113
|
protected render(): TemplateResult<1>;
|
|
60
114
|
}
|
|
61
115
|
export {};
|
|
@@ -4,21 +4,26 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html, LitElement
|
|
7
|
+
import { html, LitElement } from 'lit';
|
|
8
8
|
import { property, query } from 'lit/decorators.js';
|
|
9
9
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
10
10
|
import { addKeyboardFocusRing } from '../common/controllers/focus-ring.js';
|
|
11
|
+
import { addIdRefResolver } from '../common/controllers/id-resolver.js';
|
|
11
12
|
import { addInternalsController } from '../common/controllers/internals.js';
|
|
12
13
|
import { blazorDeepImport } from '../common/decorators/blazorDeepImport.js';
|
|
13
14
|
import { shadowOptions } from '../common/decorators/shadow-options.js';
|
|
14
15
|
import { EventEmitterMixin } from '../common//mixins/event-emitter.js';
|
|
15
16
|
import { partMap } from '../common/part-map.js';
|
|
17
|
+
import { bindIf, getElementByIdFromRoot } from '../common/util.js';
|
|
16
18
|
let IgcButtonBaseComponent = class IgcButtonBaseComponent extends EventEmitterMixin(LitElement) {
|
|
17
19
|
constructor() {
|
|
18
20
|
super(...arguments);
|
|
19
|
-
this._internals = addInternalsController(this);
|
|
20
21
|
this._focusRingManager = addKeyboardFocusRing(this);
|
|
22
|
+
this._internals = addInternalsController(this);
|
|
23
|
+
this._resolver = addIdRefResolver(this, this._resolveCommandForElement);
|
|
21
24
|
this._disabled = false;
|
|
25
|
+
this._commandfor = null;
|
|
26
|
+
this._commandForElement = null;
|
|
22
27
|
this.type = 'button';
|
|
23
28
|
}
|
|
24
29
|
static { this.formAssociated = true; }
|
|
@@ -29,62 +34,92 @@ let IgcButtonBaseComponent = class IgcButtonBaseComponent extends EventEmitterMi
|
|
|
29
34
|
get disabled() {
|
|
30
35
|
return this._disabled;
|
|
31
36
|
}
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
set commandfor(value) {
|
|
38
|
+
this._commandfor = value;
|
|
39
|
+
if (value) {
|
|
40
|
+
this._resolver.observe();
|
|
41
|
+
this._commandForElement = getElementByIdFromRoot(this, value);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this._commandForElement = null;
|
|
45
|
+
this._resolver.unobserve();
|
|
46
|
+
}
|
|
34
47
|
}
|
|
35
|
-
|
|
36
|
-
this.
|
|
48
|
+
get commandfor() {
|
|
49
|
+
return this._commandfor;
|
|
37
50
|
}
|
|
38
|
-
|
|
39
|
-
this.
|
|
51
|
+
get commandForElement() {
|
|
52
|
+
return this._commandForElement;
|
|
40
53
|
}
|
|
41
|
-
|
|
42
|
-
this.
|
|
54
|
+
set commandForElement(value) {
|
|
55
|
+
this._commandForElement = value;
|
|
56
|
+
this.requestUpdate();
|
|
43
57
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
get form() {
|
|
59
|
+
return this._internals.form;
|
|
60
|
+
}
|
|
61
|
+
firstUpdated() {
|
|
62
|
+
if (this._commandfor) {
|
|
63
|
+
this._commandForElement = getElementByIdFromRoot(this, this._commandfor);
|
|
64
|
+
this.requestUpdate();
|
|
47
65
|
}
|
|
48
|
-
|
|
49
|
-
|
|
66
|
+
}
|
|
67
|
+
_handleClick() {
|
|
68
|
+
switch (this.type) {
|
|
69
|
+
case 'submit':
|
|
70
|
+
this.form?.requestSubmit();
|
|
71
|
+
break;
|
|
72
|
+
case 'reset':
|
|
73
|
+
this.form?.reset();
|
|
74
|
+
break;
|
|
50
75
|
}
|
|
51
76
|
}
|
|
52
77
|
formDisabledCallback(state) {
|
|
53
78
|
this._disabled = state;
|
|
54
79
|
this.requestUpdate();
|
|
55
80
|
}
|
|
56
|
-
|
|
81
|
+
_resolveCommandForElement(ids) {
|
|
82
|
+
if (this._commandfor && ids.has(this._commandfor)) {
|
|
83
|
+
this._commandForElement = getElementByIdFromRoot(this, this._commandfor);
|
|
84
|
+
this.requestUpdate();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
click() {
|
|
88
|
+
this._nativeButton?.click();
|
|
89
|
+
}
|
|
90
|
+
_renderButton() {
|
|
57
91
|
return html `
|
|
58
92
|
<button
|
|
93
|
+
command=${ifDefined(this.command)}
|
|
94
|
+
.commandForElement=${this._commandForElement}
|
|
59
95
|
part=${partMap({ base: true, focused: this._focusRingManager.focused })}
|
|
60
|
-
aria-label=${
|
|
96
|
+
aria-label=${bindIf(this.ariaLabel, this.ariaLabel)}
|
|
61
97
|
?disabled=${this.disabled}
|
|
62
98
|
type=${ifDefined(this.type)}
|
|
63
99
|
@click=${this._handleClick}
|
|
64
100
|
>
|
|
65
|
-
${this.
|
|
101
|
+
${this._renderContent()}
|
|
66
102
|
</button>
|
|
67
103
|
`;
|
|
68
104
|
}
|
|
69
|
-
|
|
105
|
+
_renderLinkButton() {
|
|
70
106
|
return html `
|
|
71
107
|
<a
|
|
72
108
|
part=${partMap({ base: true, focused: this._focusRingManager.focused })}
|
|
73
109
|
role="button"
|
|
74
|
-
aria-label=${
|
|
110
|
+
aria-label=${bindIf(this.ariaLabel, this.ariaLabel)}
|
|
75
111
|
aria-disabled=${this.disabled}
|
|
76
112
|
href=${ifDefined(this.href)}
|
|
77
113
|
target=${ifDefined(this.target)}
|
|
78
114
|
download=${ifDefined(this.download)}
|
|
79
115
|
rel=${ifDefined(this.rel)}
|
|
80
116
|
>
|
|
81
|
-
${this.
|
|
117
|
+
${this._renderContent()}
|
|
82
118
|
</a>
|
|
83
119
|
`;
|
|
84
120
|
}
|
|
85
121
|
render() {
|
|
86
|
-
|
|
87
|
-
return link ? this.renderLinkButton() : this.renderButton();
|
|
122
|
+
return this.href != null ? this._renderLinkButton() : this._renderButton();
|
|
88
123
|
}
|
|
89
124
|
};
|
|
90
125
|
__decorate([
|
|
@@ -108,6 +143,12 @@ __decorate([
|
|
|
108
143
|
__decorate([
|
|
109
144
|
property({ type: Boolean, reflect: true })
|
|
110
145
|
], IgcButtonBaseComponent.prototype, "disabled", null);
|
|
146
|
+
__decorate([
|
|
147
|
+
property({ reflect: true })
|
|
148
|
+
], IgcButtonBaseComponent.prototype, "command", void 0);
|
|
149
|
+
__decorate([
|
|
150
|
+
property({ attribute: 'commandfor' })
|
|
151
|
+
], IgcButtonBaseComponent.prototype, "commandfor", null);
|
|
111
152
|
IgcButtonBaseComponent = __decorate([
|
|
112
153
|
blazorDeepImport,
|
|
113
154
|
shadowOptions({ delegatesFocus: true })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-base.js","sourceRoot":"","sources":["../../../src/components/button/button-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IAAI,CAAC,QAAQ,CAAC;cAC7B,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;;UAEvB,IAAI,CAAC,aAAa,EAAE;;KAEzB,CAAC;IACJ,CAAC;IAIkB,MAAM;QACvB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;QACrC,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;IAC9D,CAAC;;AA9HgB;IADhB,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC;6DACsB;AAQ5C;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDAC0B;AAO/C;IADN,QAAQ,EAAE;oDACU;AAOd;IADN,QAAQ,EAAE;wDACc;AAOlB;IADN,QAAQ,EAAE;sDAC6C;AAQjD;IADN,QAAQ,EAAE;mDACS;AAOpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sDAI1C;AA3DmB,sBAAsB;IAF3C,gBAAgB;IAChB,aAAa,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;GAClB,sBAAsB,CA2I3C","sourcesContent":["import { html, LitElement, nothing, type TemplateResult } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { addKeyboardFocusRing } from '../common/controllers/focus-ring.js';\nimport { addInternalsController } from '../common/controllers/internals.js';\nimport { blazorDeepImport } from '../common/decorators/blazorDeepImport.js';\nimport { shadowOptions } from '../common/decorators/shadow-options.js';\nimport type { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common//mixins/event-emitter.js';\nimport { partMap } from '../common/part-map.js';\n\nexport interface IgcButtonEventMap {\n // For analyzer meta only:\n /* skipWCPrefix */\n focus: FocusEvent;\n /* skipWCPrefix */\n blur: FocusEvent;\n}\n\n@blazorDeepImport\n@shadowOptions({ delegatesFocus: true })\nexport abstract class IgcButtonBaseComponent extends EventEmitterMixin<\n IgcButtonEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static readonly formAssociated = true;\n\n protected readonly _internals = addInternalsController(this);\n private readonly _focusRingManager = addKeyboardFocusRing(this);\n\n protected _disabled = false;\n\n @query('[part=\"base\"]', true)\n private readonly _nativeButton!: HTMLButtonElement;\n\n /* alternateName: displayType */\n /**\n * The type of the button. Defaults to `button`.\n * @attr\n */\n @property({ reflect: true })\n public type: 'button' | 'reset' | 'submit' = 'button';\n\n /**\n * The URL the button points to.\n * @attr\n */\n @property()\n public href?: string;\n\n /**\n * Prompts to save the linked URL instead of navigating to it.\n * @attr\n */\n @property()\n public download?: string;\n\n /**\n * Where to display the linked URL, as the name for a browsing context.\n * @attr\n */\n @property()\n public target?: '_blank' | '_parent' | '_self' | '_top';\n\n /**\n * The relationship of the linked URL.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types\n * @attr\n */\n @property()\n public rel?: string;\n\n /**\n * The disabled state of the component\n * @attr [disabled=false]\n */\n @property({ type: Boolean, reflect: true })\n public set disabled(value: boolean) {\n this._disabled = value;\n this.toggleAttribute('disabled', Boolean(this._disabled));\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n\n /* blazorCSSuppress */\n /* alternateType: object */\n /** Returns the HTMLFormElement associated with this element. */\n public get form(): HTMLFormElement | null {\n return this._internals.form;\n }\n\n /* alternateName: focusComponent */\n /** Sets focus in the button. */\n public override focus(options?: FocusOptions): void {\n this._nativeButton.focus(options);\n }\n\n /** Simulates a mouse click on the element */\n public override click(): void {\n this._nativeButton.click();\n }\n\n /* alternateName: blurComponent */\n /** Removes focus from the button. */\n public override blur(): void {\n this._nativeButton.blur();\n }\n\n protected _handleClick(): void {\n if (this.type === 'submit') {\n this.form?.requestSubmit();\n } else if (this.type === 'reset') {\n this.form?.reset();\n }\n }\n\n protected formDisabledCallback(state: boolean): void {\n this._disabled = state;\n this.requestUpdate();\n }\n\n private renderButton() {\n return html`\n <button\n part=${partMap({ base: true, focused: this._focusRingManager.focused })}\n aria-label=${ifDefined(this.ariaLabel ?? nothing)}\n ?disabled=${this.disabled}\n type=${ifDefined(this.type)}\n @click=${this._handleClick}\n >\n ${this.renderContent()}\n </button>\n `;\n }\n\n private renderLinkButton() {\n return html`\n <a\n part=${partMap({ base: true, focused: this._focusRingManager.focused })}\n role=\"button\"\n aria-label=${ifDefined(this.ariaLabel ?? nothing)}\n aria-disabled=${this.disabled}\n href=${ifDefined(this.href)}\n target=${ifDefined(this.target)}\n download=${ifDefined(this.download)}\n rel=${ifDefined(this.rel)}\n >\n ${this.renderContent()}\n </a>\n `;\n }\n\n protected abstract renderContent(): TemplateResult;\n\n protected override render() {\n const link = this.href !== undefined;\n return link ? this.renderLinkButton() : this.renderButton();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"button-base.js","sourceRoot":"","sources":["../../../src/components/button/button-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,m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,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sDAI1C;AAaM;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uDACJ;AAQxB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;wDAUrC;AAvHmB,sBAAsB;IAF3C,gBAAgB;IAChB,aAAa,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;GAClB,sBAAsB,CA+O3C","sourcesContent":["import { html, LitElement, type TemplateResult } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { addKeyboardFocusRing } from '../common/controllers/focus-ring.js';\nimport { addIdRefResolver } from '../common/controllers/id-resolver.js';\nimport { addInternalsController } from '../common/controllers/internals.js';\nimport { blazorDeepImport } from '../common/decorators/blazorDeepImport.js';\nimport { shadowOptions } from '../common/decorators/shadow-options.js';\nimport type { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common//mixins/event-emitter.js';\nimport { partMap } from '../common/part-map.js';\nimport { bindIf, getElementByIdFromRoot } from '../common/util.js';\n\nexport interface IgcButtonEventMap {\n // For analyzer meta only:\n /* skipWCPrefix */\n focus: FocusEvent;\n /* skipWCPrefix */\n blur: FocusEvent;\n}\n\n/**\n * Abstract base class shared by `igc-button` and `igc-icon-button`.\n *\n * Provides common form-association behavior, link-button rendering\n * (renders as `<a>` when `href` is set), keyboard focus-ring management,\n * and the Invoker Commands API (`command` / `commandfor`).\n *\n * Concrete subclasses must implement `_renderContent()` to supply the\n * visual content projected inside the native `<button>` or `<a>` element.\n */\n@blazorDeepImport\n@shadowOptions({ delegatesFocus: true })\nexport abstract class IgcButtonBaseComponent extends EventEmitterMixin<\n IgcButtonEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static readonly formAssociated = true;\n\n //#region Internal state\n\n private readonly _focusRingManager = addKeyboardFocusRing(this);\n private readonly _internals = addInternalsController(this);\n private readonly _resolver = addIdRefResolver(\n this,\n this._resolveCommandForElement\n );\n\n private _disabled = false;\n private _commandfor: string | null = null;\n private _commandForElement: Element | null = null;\n\n @query('[part=\"base\"]', true)\n private readonly _nativeButton?: HTMLButtonElement | HTMLAnchorElement;\n\n //#endregion\n\n //#region Public properties\n\n /* alternateName: displayType */\n /**\n * The type of the button, which determines its behavior and semantics.\n * - `'button'` – no default action; useful for custom JavaScript handlers.\n * - `'submit'` – submits the associated form when clicked.\n * - `'reset'` – resets the associated form fields to their initial values.\n *\n * Ignored when the button is rendered as a link (i.e. `href` is set).\n * @attr type\n * @default 'button'\n */\n @property({ reflect: true })\n public type: 'button' | 'reset' | 'submit' = 'button';\n\n /**\n * The URL the button points to. When set, the component renders as an\n * `<a>` element instead of a `<button>`, enabling navigation on click.\n * Use together with `target`, `download`, and `rel` for full anchor semantics.\n * @attr href\n */\n @property()\n public href?: string;\n\n /**\n * Prompts the browser to download the linked resource rather than navigating\n * to it. The optional value is used as the suggested file name.\n * Only effective when `href` is set.\n * @attr download\n */\n @property()\n public download?: string;\n\n /**\n * Where to open the linked document. Only effective when `href` is set.\n * - `'_self'` – current browsing context (default browser behavior).\n * - `'_blank'` – new tab or window.\n * - `'_parent'` – parent browsing context; falls back to `_self` if none.\n * - `'_top'` – top-level browsing context; falls back to `_self` if none.\n * @attr target\n */\n @property()\n public target?: '_blank' | '_parent' | '_self' | '_top';\n\n /**\n * The relationship between the current document and the linked URL.\n * Accepts a space-separated list of link types (e.g. `'noopener noreferrer'`).\n * Only effective when `href` is set. When `target=\"_blank\"` is used,\n * setting `rel=\"noopener noreferrer\"` is strongly recommended for security.\n * @attr rel\n */\n @property()\n public rel?: string;\n\n /**\n * When set, the button will be disabled and non-interactive.\n *\n * @attr disabled\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public set disabled(value: boolean) {\n this._disabled = value;\n this.toggleAttribute('disabled', Boolean(this._disabled));\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n * The command to invoke on the target element specified by `commandfor`.\n * Part of the [Invoker Commands](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API) API.\n * Custom commands must start with two dashes (e.g. `'--my-command'`).\n * @attr command\n */\n @property({ reflect: true })\n public command?: string;\n\n /**\n * The ID of the target element for the invoker command.\n * Part of the [Invoker Commands API](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API).\n * @attr commandfor\n */\n @property({ attribute: 'commandfor' })\n public set commandfor(value: string | null) {\n this._commandfor = value;\n if (value) {\n this._resolver.observe();\n this._commandForElement = getElementByIdFromRoot(this, value);\n } else {\n this._commandForElement = null;\n this._resolver.unobserve();\n }\n }\n\n public get commandfor(): string | null {\n return this._commandfor;\n }\n\n /* blazorCSSuppress */\n /**\n * The target element for the invoker command. Resolved from the `commandfor` ID.\n */\n public get commandForElement(): Element | null {\n return this._commandForElement;\n }\n\n /* blazorCSSuppress */\n public set commandForElement(value: Element | null) {\n this._commandForElement = value;\n this.requestUpdate();\n }\n\n /* blazorCSSuppress */\n /* alternateType: object */\n /**\n * The `<form>` element the button is associated with.\n * Resolved through the standard form-association mechanism — either the\n * closest ancestor `<form>` or the form referenced by the button's `form`\n * attribute. Returns `null` when no form is associated.\n * Relevant only when `type` is `'submit'` or `'reset'`.\n */\n public get form(): HTMLFormElement | null {\n return this._internals.form;\n }\n\n //#endregion\n\n //#region Lifecycle\n\n protected override firstUpdated(): void {\n if (this._commandfor) {\n this._commandForElement = getElementByIdFromRoot(this, this._commandfor);\n this.requestUpdate();\n }\n }\n\n //#endregion\n\n //#region Event handlers\n\n protected _handleClick(): void {\n switch (this.type) {\n case 'submit':\n this.form?.requestSubmit();\n break;\n case 'reset':\n this.form?.reset();\n break;\n }\n }\n\n protected formDisabledCallback(state: boolean): void {\n this._disabled = state;\n this.requestUpdate();\n }\n\n //#endregion\n\n private _resolveCommandForElement(ids: Set<string>): void {\n if (this._commandfor && ids.has(this._commandfor)) {\n this._commandForElement = getElementByIdFromRoot(this, this._commandfor);\n this.requestUpdate();\n }\n }\n\n //#region Public API\n\n /** Simulates a mouse click on the button, triggering its click handler and any associated form action. */\n public override click(): void {\n this._nativeButton?.click();\n }\n\n //#endregion\n\n private _renderButton() {\n return html`\n <button\n command=${ifDefined(this.command)}\n .commandForElement=${this._commandForElement}\n part=${partMap({ base: true, focused: this._focusRingManager.focused })}\n aria-label=${bindIf(this.ariaLabel, this.ariaLabel)}\n ?disabled=${this.disabled}\n type=${ifDefined(this.type)}\n @click=${this._handleClick}\n >\n ${this._renderContent()}\n </button>\n `;\n }\n\n private _renderLinkButton() {\n return html`\n <a\n part=${partMap({ base: true, focused: this._focusRingManager.focused })}\n role=\"button\"\n aria-label=${bindIf(this.ariaLabel, this.ariaLabel)}\n aria-disabled=${this.disabled}\n href=${ifDefined(this.href)}\n target=${ifDefined(this.target)}\n download=${ifDefined(this.download)}\n rel=${ifDefined(this.rel)}\n >\n ${this._renderContent()}\n </a>\n `;\n }\n\n protected abstract _renderContent(): TemplateResult;\n\n protected override render() {\n return this.href != null ? this._renderLinkButton() : this._renderButton();\n }\n}\n"]}
|
|
@@ -4,6 +4,10 @@ import { IgcButtonBaseComponent } from './button-base.js';
|
|
|
4
4
|
* Represents a clickable button, used to submit forms or anywhere in a
|
|
5
5
|
* document for accessible, standard button functionality.
|
|
6
6
|
*
|
|
7
|
+
* The button supports multiple visual variants, can render as an anchor
|
|
8
|
+
* (`<a>`) element when the `href` attribute is set, and is fully
|
|
9
|
+
* form-associated, acting as a native `submit` or `reset` control.
|
|
10
|
+
*
|
|
7
11
|
* @element igc-button
|
|
8
12
|
*
|
|
9
13
|
* @slot - Renders the label of the button.
|
|
@@ -19,12 +23,17 @@ export default class IgcButtonComponent extends IgcButtonBaseComponent {
|
|
|
19
23
|
protected static styles: import("lit").CSSResult[];
|
|
20
24
|
static register(): void;
|
|
21
25
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
26
|
+
* The variant of the button which determines its visual appearance.
|
|
27
|
+
* - `contained` – filled background; highest visual emphasis (default).
|
|
28
|
+
* - `outlined` – transparent background with a visible border.
|
|
29
|
+
* - `flat` – no background or border; lowest visual emphasis.
|
|
30
|
+
* - `fab` – floating action button shape; typically used for primary actions.
|
|
31
|
+
* @attr variant
|
|
32
|
+
* @default 'contained'
|
|
24
33
|
*/
|
|
25
34
|
variant: ButtonVariant;
|
|
26
35
|
constructor();
|
|
27
|
-
protected
|
|
36
|
+
protected _renderContent(): import("lit-html").TemplateResult<1>;
|
|
28
37
|
}
|
|
29
38
|
declare global {
|
|
30
39
|
interface HTMLElementTagNameMap {
|