@eunomia/elements 1.0.0-beta.4 → 1.0.0-beta.5
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/cdn/components/chunks/{chunk-SIHZFOTK.js → chunk-2XASWWKR.js} +1 -1
- package/dist/cdn/components/chunks/chunk-32DTNR52.js +1 -0
- package/dist/cdn/components/chunks/chunk-3MTUVMM5.js +1 -0
- package/dist/cdn/components/chunks/chunk-5GKM5DIB.js +1 -0
- package/dist/cdn/components/chunks/{chunk-GSJEJLFA.js → chunk-6ETDXUH2.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-EJIX2D4Z.js → chunk-AIS3UICU.js} +7 -7
- package/dist/cdn/components/chunks/{chunk-BMQOI7HX.js → chunk-DKOPI7QA.js} +99 -55
- package/dist/cdn/components/chunks/{chunk-NHFWATVN.js → chunk-EAKYD33D.js} +3 -3
- package/dist/cdn/components/chunks/{chunk-EOWBYZV7.js → chunk-IDKZKLJR.js} +5 -5
- package/dist/cdn/components/chunks/chunk-JRGM3W7I.js +53 -0
- package/dist/cdn/components/chunks/{chunk-UAGCQF23.js → chunk-L65WUTXM.js} +5 -5
- package/dist/cdn/components/chunks/chunk-LFCXUVDO.js +1 -0
- package/dist/cdn/components/chunks/{chunk-YGUJJ25C.js → chunk-MPQP4R54.js} +2 -2
- package/dist/cdn/components/chunks/{chunk-RJCJXB7Y.js → chunk-NBIENHLV.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-4MXL6PZC.js → chunk-OW7XKDCH.js} +13 -13
- package/dist/cdn/components/chunks/{chunk-IJ5WFMK4.js → chunk-SD2WHGPF.js} +7 -6
- package/dist/cdn/components/chunks/chunk-SJWRE6PW.js +1 -0
- package/dist/cdn/components/eun-animate.js +5 -3
- package/dist/cdn/components/eun-badge.js +7 -7
- package/dist/cdn/components/eun-breadcrumb-item.js +1 -1
- package/dist/cdn/components/eun-breadcrumb.js +1 -1
- package/dist/cdn/components/eun-button.js +1 -1
- package/dist/cdn/components/eun-calendar.js +13 -13
- package/dist/cdn/components/eun-card.js +42 -3
- package/dist/cdn/components/eun-carousel.js +2 -2
- package/dist/cdn/components/eun-check-card.js +1 -1
- package/dist/cdn/components/eun-checkbox-list.js +1 -1
- package/dist/cdn/components/eun-checkbox.js +1 -1
- package/dist/cdn/components/eun-chip.js +1 -1
- package/dist/cdn/components/eun-collapse.js +39 -20
- package/dist/cdn/components/eun-color-picker.js +3 -3
- package/dist/cdn/components/eun-counter.js +8 -8
- package/dist/cdn/components/eun-date-picker.js +19 -19
- package/dist/cdn/components/eun-drawer.js +9 -9
- package/dist/cdn/components/eun-dropdown-button.js +1 -1
- package/dist/cdn/components/eun-fab.js +6 -6
- package/dist/cdn/components/eun-icon.js +1 -1
- package/dist/cdn/components/eun-image-card.js +1 -1
- package/dist/cdn/components/eun-image-carousel.js +3 -3
- package/dist/cdn/components/eun-input-file.js +1 -1
- package/dist/cdn/components/eun-input-phone.js +18 -18
- package/dist/cdn/components/eun-input.js +1 -1
- package/dist/cdn/components/eun-link.js +116 -18
- package/dist/cdn/components/eun-modal.js +15 -15
- package/dist/cdn/components/eun-radio-card.js +1 -1
- package/dist/cdn/components/eun-radio-list.js +1 -1
- package/dist/cdn/components/eun-radio.js +1 -1
- package/dist/cdn/components/eun-scheduler-event-editor.js +7 -7
- package/dist/cdn/components/eun-scheduler-event.js +1 -1
- package/dist/cdn/components/eun-scheduler.js +18 -18
- package/dist/cdn/components/eun-search.js +15 -15
- package/dist/cdn/components/eun-select.js +2 -2
- package/dist/cdn/components/eun-slider.js +1 -1
- package/dist/cdn/components/eun-sliding-card.js +1 -1
- package/dist/cdn/components/eun-switch.js +1 -1
- package/dist/cdn/components/eun-tab-group.js +1 -1
- package/dist/cdn/components/eun-tab.js +1 -1
- package/dist/cdn/components/eun-table-action-bar.js +1 -1
- package/dist/cdn/components/eun-table.js +1 -1
- package/dist/cdn/components/eun-textarea.js +2 -2
- package/dist/cdn/components/eun-time-picker.js +11 -11
- package/dist/cdn/components/eun-toggle-group.js +30 -22
- package/dist/cdn/components/eun-toggle-item.js +10 -8
- package/dist/cdn/components/eun-toggle.js +1 -1
- package/dist/cdn/components/eun-toolbar.js +1 -1
- package/dist/components/action/button/button.d.ts +44 -17
- package/dist/components/action/button/button.js +100 -22
- package/dist/components/action/button/button.styles.js +77 -39
- package/dist/components/action/dropdown-button/dropdown-button.d.ts +8 -8
- package/dist/components/action/dropdown-button/dropdown-button.js +7 -7
- package/dist/components/action/fab/fab.d.ts +7 -6
- package/dist/components/action/fab/fab.js +11 -8
- package/dist/components/action/fab/fab.styles.js +4 -4
- package/dist/components/action/link/link.d.ts +65 -6
- package/dist/components/action/link/link.js +176 -20
- package/dist/components/action/link/link.styles.js +86 -1
- package/dist/components/action/shared-styles/button-palette.styles.d.ts +3 -3
- package/dist/components/action/shared-styles/button-palette.styles.js +14 -14
- package/dist/components/action/toggle/toggle-group.d.ts +15 -5
- package/dist/components/action/toggle/toggle-group.js +42 -17
- package/dist/components/action/toggle/toggle-group.styles.d.ts +2 -1
- package/dist/components/action/toggle/toggle-group.styles.js +15 -7
- package/dist/components/action/toggle/toggle-item.d.ts +4 -4
- package/dist/components/action/toggle/toggle-item.js +2 -2
- package/dist/components/action/toggle/toggle-item.styles.js +8 -6
- package/dist/components/alert/drawer/drawer.js +1 -1
- package/dist/components/alert/modal/modal.d.ts +8 -8
- package/dist/components/alert/modal/modal.js +11 -11
- package/dist/components/content/badge/badge.d.ts +6 -6
- package/dist/components/content/badge/badge.js +4 -4
- package/dist/components/content/badge/badge.styles.js +4 -4
- package/dist/components/content/card/card.d.ts +32 -4
- package/dist/components/content/card/card.js +64 -4
- package/dist/components/content/card/card.styles.js +33 -1
- package/dist/components/content/card/image-card.d.ts +2 -1
- package/dist/components/content/card/image-card.js +1 -0
- package/dist/components/content/card/sliding-card.d.ts +2 -1
- package/dist/components/content/card/sliding-card.js +1 -0
- package/dist/components/content/collapse/collapse.d.ts +29 -11
- package/dist/components/content/collapse/collapse.js +53 -23
- package/dist/components/content/collapse/collapse.styles.js +13 -0
- package/dist/components/content/icon/icon.d.ts +12 -2
- package/dist/components/content/icon/icon.js +52 -22
- package/dist/components/content/icon/icon.style.d.ts +2 -0
- package/dist/components/content/icon/icon.style.js +4 -1
- package/dist/components/content/shared-styles/card-link.styles.js +1 -0
- package/dist/components/form/color-picker/color-picker.d.ts +3 -3
- package/dist/components/form/color-picker/color-picker.js +4 -4
- package/dist/components/form/counter/counter.d.ts +3 -3
- package/dist/components/form/counter/counter.js +3 -3
- package/dist/components/form/counter/counter.styles.js +5 -5
- package/dist/components/form/date-picker/date-picker.d.ts +3 -3
- package/dist/components/form/date-picker/date-picker.js +3 -3
- package/dist/components/form/date-picker/date-picker.styles.js +5 -5
- package/dist/components/form/input/input.d.ts +3 -3
- package/dist/components/form/input/input.js +4 -4
- package/dist/components/form/input-phone/input-phone.d.ts +3 -3
- package/dist/components/form/input-phone/input-phone.js +3 -3
- package/dist/components/form/input-phone/input-phone.styles.js +12 -12
- package/dist/components/form/search/search.styles.js +3 -3
- package/dist/components/form/select/select.d.ts +3 -3
- package/dist/components/form/select/select.js +3 -3
- package/dist/components/form/shared-styles/field.styles.js +5 -5
- package/dist/components/form/textarea/textarea.d.ts +3 -3
- package/dist/components/form/textarea/textarea.js +4 -4
- package/dist/components/form/time-picker/time-picker.d.ts +3 -3
- package/dist/components/form/time-picker/time-picker.js +3 -3
- package/dist/components/form/time-picker/time-picker.styles.js +5 -5
- package/dist/components/layout/animate/animate.d.ts +8 -0
- package/dist/components/layout/animate/animate.js +20 -8
- package/dist/features/scheduler/calendar/calendar.d.ts +6 -6
- package/dist/features/scheduler/calendar/calendar.js +9 -9
- package/dist/features/scheduler/scheduler/scheduler.d.ts +6 -6
- package/dist/features/scheduler/scheduler/scheduler.js +13 -13
- package/dist/features/scheduler/scheduler-event/scheduler-event.d.ts +10 -8
- package/dist/features/scheduler/scheduler-event/scheduler-event.js +7 -7
- package/dist/features/scheduler/scheduler-event/scheduler-event.styles.js +6 -6
- package/dist/features/scheduler/scheduler-event-editor/scheduler-event-editor.js +5 -5
- package/dist/features/scheduler/shared/scheduler-event-popover.js +2 -2
- package/dist/features/scheduler/shared/scheduler-hour-grid.d.ts +2 -2
- package/dist/features/scheduler/shared/scheduler-hour-grid.js +3 -3
- package/dist/features/scheduler/shared/scheduler-month-view.d.ts +3 -3
- package/dist/features/scheduler/shared/scheduler-month-view.js +2 -2
- package/dist/features/table/table/table.types.d.ts +7 -3
- package/dist/features/table/table-action-bar/table-action-bar.js +3 -3
- package/dist/features/table/table-managed/table-managed.js +2 -2
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.js +3 -0
- package/dist/i18n/fr.js +3 -0
- package/dist/index.d.ts +3 -3
- package/dist/jsx.d.ts +1 -1
- package/dist/mixins/button.mixin.d.ts +10 -9
- package/dist/mixins/button.mixin.js +14 -6
- package/dist/mixins/card-link.mixin.d.ts +3 -2
- package/dist/mixins/card-link.mixin.js +12 -5
- package/dist/mixins/disabled.mixin.d.ts +3 -3
- package/dist/mixins/disabled.mixin.js +10 -5
- package/dist/mixins/field-appearance.mixin.d.ts +19 -0
- package/dist/mixins/{field-variant.mixin.js → field-appearance.mixin.js} +11 -11
- package/dist/ssr/animate-ssr.css +26 -72
- package/dist/ssr/links-ssr.css +35 -0
- package/dist/ssr/overlay-ssr.css +0 -41
- package/dist/ssr/rich-text.css +38 -0
- package/dist/ssr/sidebar-ssr.css +0 -38
- package/dist/ssr/toolbar-ssr.css +73 -39
- package/dist/types/variant.type.d.ts +26 -10
- package/dist/utils/navigation.utils.d.ts +14 -0
- package/dist/utils/navigation.utils.js +33 -0
- package/dist/utils/new-tab-anchor.controller.d.ts +44 -0
- package/dist/utils/new-tab-anchor.controller.js +102 -0
- package/dist/utils/severity-icon.utils.d.ts +1 -1
- package/dist/utils/severity-icon.utils.js +1 -1
- package/dist/utils/theme-generator.utils.d.ts +3 -1
- package/dist/utils/theme-generator.utils.js +3 -1
- package/package.json +8 -2
- package/dist/cdn/components/chunks/chunk-2JLDJFYD.js +0 -48
- package/dist/cdn/components/chunks/chunk-ATH2OAMU.js +0 -1
- package/dist/cdn/components/chunks/chunk-BKHD4S57.js +0 -1
- package/dist/cdn/components/chunks/chunk-T7WABJEJ.js +0 -1
- package/dist/cdn/components/chunks/chunk-XSMCT4DF.js +0 -1
- package/dist/mixins/field-variant.mixin.d.ts +0 -22
|
@@ -4,6 +4,18 @@ 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
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
8
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12
|
+
};
|
|
13
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
14
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
15
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
16
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
17
|
+
};
|
|
18
|
+
var _EunomiaButton_blockedAnchor, _EunomiaButton_newTab;
|
|
7
19
|
import { customElement, property } from "lit/decorators.js";
|
|
8
20
|
import { html, LitElement, nothing } from "lit";
|
|
9
21
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
@@ -11,7 +23,9 @@ import { ButtonMixin, } from "../../../mixins/button.mixin.js";
|
|
|
11
23
|
import { buttonStyles } from "./button.styles.js";
|
|
12
24
|
import { CommandMixin } from "../../../mixins/command.mixin.js";
|
|
13
25
|
import { DisabledMixin } from "../../../mixins/disabled.mixin.js";
|
|
14
|
-
import { handleLinkNavigation } from "../../../utils/navigation.utils.js";
|
|
26
|
+
import { handleLinkNavigation, warnIgnoredHostLinkAttributes, } from "../../../utils/navigation.utils.js";
|
|
27
|
+
import { LocalizableMixin } from "../../../mixins/localizable.mixin.js";
|
|
28
|
+
import { NewTabAnchorController } from "../../../utils/new-tab-anchor.controller.js";
|
|
15
29
|
import { resolveIcon } from "../../../utils/severity-icon.utils.js";
|
|
16
30
|
/**
|
|
17
31
|
* Tag name of the button component.
|
|
@@ -19,50 +33,51 @@ import { resolveIcon } from "../../../utils/severity-icon.utils.js";
|
|
|
19
33
|
export const EunomiaButtonTagName = "eun-button";
|
|
20
34
|
/**
|
|
21
35
|
* A clickable control for performing an action or navigating to a link,
|
|
22
|
-
* available in several
|
|
36
|
+
* available in several colors, sizes, and surface styles.
|
|
23
37
|
*
|
|
24
38
|
* @slot [default] - The button content
|
|
25
39
|
* @slot [start] - An icon or other content shown at the start of the button. Takes priority over the default icon from icon or severity. Leave empty to let one of those render instead
|
|
26
|
-
* @slot [end] - An icon or other content shown at the end of the button. Ignored when
|
|
40
|
+
* @slot [end] - An icon or other content shown at the end of the button. Ignored when the button opens a link in a new tab, through href and target or a slotted anchor, since an external link indicator takes its place
|
|
27
41
|
* @prop {'button' | 'submit' | 'reset'} [type='button'] - The button's native type. Ignored when href is set
|
|
28
|
-
* @prop {'primary' | 'secondary' | 'critical' | 'success' | 'warning' | 'light' | 'medium' | 'dark'} [
|
|
29
|
-
* @prop {boolean} [fixedColor=false] - Keeps a light or dark button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other
|
|
30
|
-
* @attr {boolean} [fixed-color=false] - Keeps a light or dark button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other
|
|
42
|
+
* @prop {'primary' | 'secondary' | 'critical' | 'success' | 'warning' | 'light' | 'medium' | 'dark'} [color='primary'] - The color applied to the button. light/medium/dark are neutral grey tones with no semantic meaning, matching eun-tag's color scale, for a de-emphasized action next to a semantically-colored one
|
|
43
|
+
* @prop {boolean} [fixedColor=false] - Keeps a light or dark button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other colors
|
|
44
|
+
* @attr {boolean} [fixed-color=false] - Keeps a light or dark button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other colors
|
|
31
45
|
* @prop {import('../../content/icon/icon.type.js').EunomiaIconName} icon - An optional leading icon, shown at the start of the button. Ignored once something is slotted into start, and overridden by the default icon from severity when both are set
|
|
32
|
-
* @prop {'info' | 'success' | 'warning' | 'critical' | 'neutral'} severity - The severity of the action this button leads to. When set, it supplies a default leading icon unless icon is also set or something is slotted into start. It has no effect on color, which is still controlled by
|
|
46
|
+
* @prop {'info' | 'success' | 'warning' | 'critical' | 'neutral'} severity - The severity of the action this button leads to. When set, it supplies a default leading icon unless icon is also set or something is slotted into start. It has no effect on color, which is still controlled by color
|
|
33
47
|
* @prop {'xs' | 's' | 'm' | 'l' | 'xl'} [size='m'] - The size of the button
|
|
34
48
|
* @prop {boolean} rounded - Whether the button has fully rounded corners
|
|
35
49
|
* @prop {boolean} slide - Whether the button uses a sliding open animation
|
|
36
50
|
* @prop {boolean} full - Whether the button stretches to fill 100% of the width available from its parent, instead of sizing to its content. Its content stays centered once stretched
|
|
37
51
|
* @prop {boolean} [disabled=false] - Whether the button is disabled. For a link button, this removes the href instead, since links have no native disabled state
|
|
38
52
|
* @prop {string} href - The URL the button navigates to. When set, the button renders as a link instead of a button
|
|
39
|
-
* @prop {'_blank' | '_self' | '_parent' | '_top'} target - Where to open the linked URL. Only used when href is set. Opening in a new tab automatically adds an external link icon and announces it to assistive technology
|
|
53
|
+
* @prop {'_blank' | '_self' | '_parent' | '_top'} target - Where to open the linked URL. Only used when href is set. Opening in a new tab automatically adds an external link icon and announces it to assistive technology, in the current locale. A slotted anchor opening in a new tab gets the same icon and announcement
|
|
54
|
+
* @prop {string} [locale] - The locale used to resolve the "opens in a new tab" announcement. Defaults to the one set with setDefaultLocale, English otherwise
|
|
40
55
|
* @prop {string} download - The filename used when the linked URL is downloaded instead of navigated to. Only used when href is set
|
|
41
56
|
* @prop {boolean} [loading=false] - Whether the button shows a loading indicator. Like disabled, it blocks interaction, but keeps the original content in place so the button doesn't change size
|
|
42
57
|
* @prop {string} [loadingLabel='Loading…'] - The accessible label announced while the button is loading
|
|
43
58
|
* @prop {string} command - The command sent to the element targeted by commandFor when the button is clicked, following the Invoker Commands API
|
|
44
59
|
* @prop {string} commandFor - The id of the element that command is sent to
|
|
45
60
|
* @attr {string} aria-label - The accessible label for the button. When the button opens a link in a new tab, this automatically gets a note appended announcing it
|
|
46
|
-
* @prop {'default' | 'fill' | 'outline' | 'flat' | 'raised' | 'ghost'} [appearance='fill'] - The button's surface style. Fill is a solid, colored background with light text. Default is a paler tint of the same color. Outline keeps the color as a border instead of a fill. Flat always renders a muted, low emphasis surface regardless of
|
|
61
|
+
* @prop {'default' | 'fill' | 'outline' | 'flat' | 'raised' | 'ghost'} [appearance='fill'] - The button's surface style. Fill is a solid, colored background with light text. Default is a paler tint of the same color. Outline keeps the color as a border instead of a fill. Flat always renders a muted, low emphasis surface regardless of color. Raised adds a drop shadow. Ghost shows no surface at rest, only gaining a border and a tinted background on hover, focus, or press
|
|
47
62
|
* @fires click - Fired when the button is activated by mouse, Enter, or Space
|
|
48
63
|
* @fires {NavigationEvent} eunnavigate - Fired before following href, so a client-side router can intercept the navigation. Not fired for downloads, and cancelable
|
|
49
64
|
* @cssprop [--button-background] - Sets the background color
|
|
50
65
|
* @cssprop [--button-background-hover] - Sets the background color on hover
|
|
51
66
|
* @cssprop [--button-background-active] - Sets the background color while pressed
|
|
52
67
|
* @cssprop [--button-text] - Sets the text color
|
|
53
|
-
* @cssprop [--button-padding] - Sets the button's padding
|
|
54
|
-
* @cssprop [--button-border-radius] - Sets the corner radius of the button
|
|
68
|
+
* @cssprop [--button-padding] - Sets the button's padding, for every size
|
|
69
|
+
* @cssprop [--button-border-radius] - Sets the corner radius of the button, for every size and over rounded
|
|
55
70
|
* @cssprop [--button-focus-outline] - Sets the color of the focus outline
|
|
56
71
|
* @cssprop [--button-transition] - Sets the duration of the button's transitions
|
|
57
72
|
* @cssprop [--button-shadow] - Sets a box shadow. None is applied by default
|
|
58
73
|
* @cssprop [--button-shadow-hover] - Sets the box shadow on hover, falling back to button-shadow when unset
|
|
59
|
-
* @cssprop [--button-border-color] - Sets the border color, overriding the color the active
|
|
74
|
+
* @cssprop [--button-border-color] - Sets the border color, overriding the color the active color would otherwise use
|
|
60
75
|
* @cssprop [--button-border-color-hover] - Sets the border color on hover or focus, falling back to button-border-color when unset
|
|
61
76
|
* @cssprop [--button-border-size] - Sets the width of the border
|
|
62
77
|
* @cssprop [--button-full] - Set to true to stretch the button like the full attribute does. Unlike the attribute, a container query can set it, keeping the responsive behavior in pure CSS. Needs a browser supporting the CSS if() function
|
|
63
78
|
* @element eun-button
|
|
64
79
|
*/
|
|
65
|
-
let EunomiaButton = class EunomiaButton extends ButtonMixin(CommandMixin(DisabledMixin(LitElement))) {
|
|
80
|
+
let EunomiaButton = class EunomiaButton extends ButtonMixin(CommandMixin(DisabledMixin(LocalizableMixin(LitElement)))) {
|
|
66
81
|
constructor() {
|
|
67
82
|
super(...arguments);
|
|
68
83
|
/**
|
|
@@ -72,13 +87,13 @@ let EunomiaButton = class EunomiaButton extends ButtonMixin(CommandMixin(Disable
|
|
|
72
87
|
this.loadingLabel = "Loading…";
|
|
73
88
|
/**
|
|
74
89
|
* The button's surface treatment. `fill` is a solid, opaque
|
|
75
|
-
* `
|
|
90
|
+
* `color`-colored background with light text ; `default` is a pale
|
|
76
91
|
* tinted wash of the same color ; `outline` drops the fill for a colored
|
|
77
92
|
* border ; `flat` always renders the same muted, low-emphasis surface
|
|
78
|
-
* regardless of `
|
|
93
|
+
* regardless of `color` ; `raised` adds a drop shadow ; `ghost` has no
|
|
79
94
|
* visible surface at rest at all — a border (and a tinted background)
|
|
80
95
|
* only appear on hover/focus/active, defaulting to a neutral gray when
|
|
81
|
-
* `
|
|
96
|
+
* `color` isn't also set.
|
|
82
97
|
* @default fill
|
|
83
98
|
*/
|
|
84
99
|
this.appearance = "fill";
|
|
@@ -89,6 +104,25 @@ let EunomiaButton = class EunomiaButton extends ButtonMixin(CommandMixin(Disable
|
|
|
89
104
|
* @default false
|
|
90
105
|
*/
|
|
91
106
|
this.full = false;
|
|
107
|
+
/**
|
|
108
|
+
* Whether {@link syncSlottedAnchor} is the one that took the slotted
|
|
109
|
+
* anchor out of the tab order, so it only ever restores what it changed.
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
_EunomiaButton_blockedAnchor.set(this, void 0);
|
|
113
|
+
/**
|
|
114
|
+
* Announces the slotted anchor opening in a new tab.
|
|
115
|
+
* @internal
|
|
116
|
+
*/
|
|
117
|
+
_EunomiaButton_newTab.set(this, new NewTabAnchorController(this, () => this.slottedAnchor, () => this.dictionary.link.opensInNewTab));
|
|
118
|
+
/**
|
|
119
|
+
* Re-renders when the default slot changes, so an anchor added or removed
|
|
120
|
+
* after the first render switches between the two modes.
|
|
121
|
+
* @private
|
|
122
|
+
*/
|
|
123
|
+
this.handleDefaultSlotChange = () => {
|
|
124
|
+
this.requestUpdate();
|
|
125
|
+
};
|
|
92
126
|
}
|
|
93
127
|
/**
|
|
94
128
|
* Lifecycle hook called whenever reactive properties change. Manages the
|
|
@@ -105,6 +139,13 @@ let EunomiaButton = class EunomiaButton extends ButtonMixin(CommandMixin(Disable
|
|
|
105
139
|
*/
|
|
106
140
|
updated(_changedProperties) {
|
|
107
141
|
super.updated(_changedProperties);
|
|
142
|
+
const anchor = this.slottedAnchor;
|
|
143
|
+
if (anchor) {
|
|
144
|
+
this.removeAttribute("tabindex");
|
|
145
|
+
this.syncSlottedAnchor(anchor);
|
|
146
|
+
warnIgnoredHostLinkAttributes(this);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
108
149
|
if (_changedProperties.has("href") ||
|
|
109
150
|
_changedProperties.has("disabled") ||
|
|
110
151
|
_changedProperties.has("loading")) {
|
|
@@ -117,21 +158,55 @@ let EunomiaButton = class EunomiaButton extends ButtonMixin(CommandMixin(Disable
|
|
|
117
158
|
}
|
|
118
159
|
}
|
|
119
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* The native `<a>` slotted as a direct child while `href` is unset, which
|
|
163
|
+
* then acts as the button's link : it's in the light DOM, so it's part of
|
|
164
|
+
* the server-rendered HTML, and a framework's own link component can be
|
|
165
|
+
* that anchor. Navigation, `target`/`rel` and the new-tab hint are the
|
|
166
|
+
* consumer's own in this mode.
|
|
167
|
+
* @internal
|
|
168
|
+
*/
|
|
169
|
+
get slottedAnchor() {
|
|
170
|
+
return this.href ? null : this.querySelector(":scope > a");
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Links have no native disabled state : while `disabled` or `loading`,
|
|
174
|
+
* the slotted anchor is announced as disabled and taken out of the tab
|
|
175
|
+
* order (its pointer events are cut by the stylesheet), then restored.
|
|
176
|
+
* @param anchor the slotted anchor.
|
|
177
|
+
* @private
|
|
178
|
+
*/
|
|
179
|
+
syncSlottedAnchor(anchor) {
|
|
180
|
+
if (this.disabled || this.loading) {
|
|
181
|
+
anchor.setAttribute("aria-disabled", "true");
|
|
182
|
+
anchor.setAttribute("tabindex", "-1");
|
|
183
|
+
__classPrivateFieldSet(this, _EunomiaButton_blockedAnchor, anchor, "f");
|
|
184
|
+
}
|
|
185
|
+
else if (__classPrivateFieldGet(this, _EunomiaButton_blockedAnchor, "f") === anchor) {
|
|
186
|
+
anchor.removeAttribute("aria-disabled");
|
|
187
|
+
anchor.removeAttribute("tabindex");
|
|
188
|
+
__classPrivateFieldSet(this, _EunomiaButton_blockedAnchor, undefined, "f");
|
|
189
|
+
}
|
|
190
|
+
}
|
|
120
191
|
/**
|
|
121
192
|
* Renders the end-of-content slot, replaced by an external-link indicator
|
|
122
|
-
* (icon + accessible hint) when navigating away in a new tab.
|
|
193
|
+
* (icon + accessible hint) when navigating away in a new tab. A slotted
|
|
194
|
+
* anchor gets the icon only : the hint would sit outside it, so it's
|
|
195
|
+
* announced through its aria-description instead.
|
|
123
196
|
* @private
|
|
124
197
|
*/
|
|
125
198
|
renderEndContent() {
|
|
126
|
-
|
|
199
|
+
const hrefBlank = !!this.href && this.target === "_blank";
|
|
200
|
+
const newTabHint = this.dictionary.link.opensInNewTab;
|
|
201
|
+
if (!hrefBlank && !__classPrivateFieldGet(this, _EunomiaButton_newTab, "f").isBlank) {
|
|
127
202
|
return html `<slot name="end"></slot>`;
|
|
128
203
|
}
|
|
129
204
|
return html `
|
|
130
205
|
<span id="external-link-icon">
|
|
131
206
|
<eun-icon name="arrow_forward" shape="round" size="12"></eun-icon>
|
|
132
|
-
${this.ariaLabel
|
|
207
|
+
${!hrefBlank || this.ariaLabel
|
|
133
208
|
? nothing
|
|
134
|
-
: html `<span class="sr-only"> (
|
|
209
|
+
: html `<span class="sr-only"> (${newTabHint})</span>`}
|
|
135
210
|
</span>
|
|
136
211
|
`;
|
|
137
212
|
}
|
|
@@ -152,7 +227,7 @@ let EunomiaButton = class EunomiaButton extends ButtonMixin(CommandMixin(Disable
|
|
|
152
227
|
></eun-icon>`
|
|
153
228
|
: nothing}
|
|
154
229
|
</slot>
|
|
155
|
-
<slot></slot>
|
|
230
|
+
<slot @slotchange=${this.handleDefaultSlotChange}></slot>
|
|
156
231
|
${this.renderEndContent()}
|
|
157
232
|
`;
|
|
158
233
|
if (!this.loading) {
|
|
@@ -197,7 +272,7 @@ let EunomiaButton = class EunomiaButton extends ButtonMixin(CommandMixin(Disable
|
|
|
197
272
|
rel=${ifDefined(isBlank ? "noopener noreferrer" : undefined)}
|
|
198
273
|
download=${ifDefined(this.download)}
|
|
199
274
|
aria-label=${ifDefined(isBlank && this.ariaLabel
|
|
200
|
-
? `${this.ariaLabel} (
|
|
275
|
+
? `${this.ariaLabel} (${this.dictionary.link.opensInNewTab})`
|
|
201
276
|
: (this.ariaLabel ?? undefined))}
|
|
202
277
|
aria-disabled=${ifDefined(this.disabled ? "true" : undefined)}
|
|
203
278
|
aria-busy=${ifDefined(this.loading ? "true" : undefined)}
|
|
@@ -210,6 +285,7 @@ let EunomiaButton = class EunomiaButton extends ButtonMixin(CommandMixin(Disable
|
|
|
210
285
|
return html `
|
|
211
286
|
<div
|
|
212
287
|
id="button"
|
|
288
|
+
class=${ifDefined(this.slottedAnchor ? "slotted-link" : undefined)}
|
|
213
289
|
aria-busy=${ifDefined(this.loading ? "true" : undefined)}
|
|
214
290
|
>
|
|
215
291
|
${content}
|
|
@@ -217,6 +293,8 @@ let EunomiaButton = class EunomiaButton extends ButtonMixin(CommandMixin(Disable
|
|
|
217
293
|
`;
|
|
218
294
|
}
|
|
219
295
|
};
|
|
296
|
+
_EunomiaButton_blockedAnchor = new WeakMap();
|
|
297
|
+
_EunomiaButton_newTab = new WeakMap();
|
|
220
298
|
/**
|
|
221
299
|
* Style to import to the component.
|
|
222
300
|
*
|
|
@@ -4,28 +4,21 @@ import { buttonPaletteStyles } from "../shared-styles/button-palette.styles.js";
|
|
|
4
4
|
* Base style for button.
|
|
5
5
|
*
|
|
6
6
|
* Custom css variables:
|
|
7
|
-
* [--button-background] - Set a custom background color, for every appearance and
|
|
7
|
+
* [--button-background] - Set a custom background color, for every appearance and color
|
|
8
8
|
* [--button-background-hover] - Set a custom button background color for hover state. Derived from --button-background when only that one is set
|
|
9
9
|
* [--button-background-active] - Set a custom button background color for active state. Derived from --button-background when only that one is set
|
|
10
|
-
* [--button-text] - Set a custom button text color, for every appearance and
|
|
11
|
-
* [--button-padding] - Set a custom padding to the button
|
|
12
|
-
* [--button-border-radius] - Set a custom radius to the button border
|
|
10
|
+
* [--button-text] - Set a custom button text color, for every appearance and color
|
|
11
|
+
* [--button-padding] - Set a custom padding to the button, for every size
|
|
12
|
+
* [--button-border-radius] - Set a custom radius to the button border, for every size and over `rounded`
|
|
13
13
|
* [--button-focus-outline] - Set a custom color to the focus outline
|
|
14
14
|
* [--button-transition] - Set a custom button transition time
|
|
15
15
|
* [--button-shadow] - Set a custom box shadow to the button (used by the `raised` variant)
|
|
16
16
|
* [--button-shadow-hover] - Set a custom box shadow to the button on hover state (used by the `raised` variant)
|
|
17
|
-
* [--button-border-color] - Set a custom border color, for every appearance and
|
|
17
|
+
* [--button-border-color] - Set a custom border color, for every appearance and color
|
|
18
18
|
* [--button-border-color-hover] - Set a custom border color for hover/focus-visible state, falling back to --button-border-color
|
|
19
19
|
* [--button-border-size] - Set a custom border width
|
|
20
20
|
* [--button-full] - Set to `true` to get the same result as the `full` attribute. Meant to be set from a container query
|
|
21
21
|
*/
|
|
22
|
-
/*
|
|
23
|
-
* The variant fills the palette slots (see {@link buttonPaletteStyles}), the
|
|
24
|
-
* appearance reads them into --_bg / --_bg-hover / --_bg-active / --_fg /
|
|
25
|
-
* --_bd, and #button finally reads those *behind* the --button-* custom
|
|
26
|
-
* properties, so a custom property always wins over any variant, appearance
|
|
27
|
-
* and state. Only `disabled` stays above them, so it never loses its look.
|
|
28
|
-
*/
|
|
29
22
|
const base = css `
|
|
30
23
|
:host {
|
|
31
24
|
--_focusIndicator: var(--button-focus-outline, var(--_ring));
|
|
@@ -35,14 +28,11 @@ const base = css `
|
|
|
35
28
|
var(--button-background) 76%,
|
|
36
29
|
black
|
|
37
30
|
);
|
|
38
|
-
--
|
|
39
|
-
|
|
40
|
-
var(--eun-
|
|
41
|
-
);
|
|
42
|
-
--_padding: var(
|
|
43
|
-
--button-padding,
|
|
44
|
-
var(--eun-space-s, 8px) calc(var(--eun-space-l, 32px) / 2)
|
|
45
|
-
);
|
|
31
|
+
--_defaultBorderRadius: var(--eun-border-radius-m, 8px);
|
|
32
|
+
--_defaultPadding: var(--eun-space-s, 8px)
|
|
33
|
+
calc(var(--eun-space-l, 32px) / 2);
|
|
34
|
+
--_borderRadius: var(--button-border-radius, var(--_defaultBorderRadius));
|
|
35
|
+
--_padding: var(--button-padding, var(--_defaultPadding));
|
|
46
36
|
--_boxShadow: var(--button-shadow, none);
|
|
47
37
|
--_boxShadow-hover: var(--button-shadow-hover, var(--_boxShadow));
|
|
48
38
|
--_transition: var(--button-transition, 0.2s);
|
|
@@ -73,30 +63,32 @@ const base = css `
|
|
|
73
63
|
}
|
|
74
64
|
:host([size="xs"]) {
|
|
75
65
|
--_fontSize: var(--eun-font-size-xs, 10px);
|
|
76
|
-
--
|
|
66
|
+
--_defaultPadding: var(--eun-space-xxs, 1.6px) var(--eun-space-xs, 4px);
|
|
77
67
|
--_lineHeight: 10px;
|
|
78
|
-
--
|
|
68
|
+
--_defaultBorderRadius: var(--eun-border-radius-s, 999px);
|
|
79
69
|
}
|
|
80
70
|
:host([size="s"]) {
|
|
81
71
|
--_fontSize: var(--eun-font-size-xs, 10px);
|
|
82
|
-
--
|
|
72
|
+
--_defaultPadding: calc(var(--eun-space-s) / 2) var(--eun-space-s);
|
|
83
73
|
--_lineHeight: 10px;
|
|
84
|
-
--
|
|
74
|
+
--_defaultBorderRadius: var(--eun-border-radius-s, 999px);
|
|
85
75
|
}
|
|
86
76
|
:host([size="l"]) {
|
|
87
77
|
--_fontSize: var(--eun-font-size-m, 16px);
|
|
88
78
|
--_gap: var(--eun-space-m, 16px);
|
|
89
|
-
--
|
|
79
|
+
--_defaultPadding: calc(var(--eun-space-s, 8px) * 1.25)
|
|
80
|
+
var(--eun-space-l, 32px);
|
|
90
81
|
--_lineHeight: 1.1rem;
|
|
91
82
|
}
|
|
92
83
|
:host([size="xl"]) {
|
|
93
84
|
--_fontSize: var(--eun-font-size-l, 1.3rem);
|
|
94
85
|
--_gap: var(--eun-space-m, 16px);
|
|
95
|
-
--
|
|
86
|
+
--_defaultPadding: calc(var(--eun-space-s, 8px) * 1.5)
|
|
87
|
+
var(--eun-space-l, 32px);
|
|
96
88
|
--_lineHeight: 1.3rem;
|
|
97
89
|
}
|
|
98
90
|
:host([rounded]) {
|
|
99
|
-
--
|
|
91
|
+
--_defaultBorderRadius: var(--eun-border-radius-xl, 999px);
|
|
100
92
|
}
|
|
101
93
|
slot::slotted(*) {
|
|
102
94
|
color: var(--_textColor);
|
|
@@ -178,6 +170,53 @@ const base = css `
|
|
|
178
170
|
border: 0;
|
|
179
171
|
}
|
|
180
172
|
`;
|
|
173
|
+
const slottedLink = css `
|
|
174
|
+
#button.slotted-link {
|
|
175
|
+
position: relative;
|
|
176
|
+
}
|
|
177
|
+
::slotted(a) {
|
|
178
|
+
color: inherit;
|
|
179
|
+
text-decoration: none;
|
|
180
|
+
outline: none !important;
|
|
181
|
+
}
|
|
182
|
+
::slotted(a)::after {
|
|
183
|
+
content: "";
|
|
184
|
+
position: absolute;
|
|
185
|
+
inset: calc(-1 * var(--_borderSize));
|
|
186
|
+
border-radius: var(--_borderRadius);
|
|
187
|
+
outline: 2px solid transparent;
|
|
188
|
+
transition: outline ease-out var(--_transition);
|
|
189
|
+
}
|
|
190
|
+
::slotted(a:focus-visible)::after {
|
|
191
|
+
outline-offset: 2px;
|
|
192
|
+
outline-color: var(--_focusIndicator);
|
|
193
|
+
}
|
|
194
|
+
:host(:focus-within) #button.slotted-link {
|
|
195
|
+
box-shadow: var(--_boxShadow-hover);
|
|
196
|
+
border-color: var(
|
|
197
|
+
--button-border-color-hover,
|
|
198
|
+
var(--button-border-color, var(--_bd))
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
:host(:not([disabled]):focus-within) #button.slotted-link {
|
|
202
|
+
background: var(
|
|
203
|
+
--button-background-hover,
|
|
204
|
+
var(--_hoverFromCustom, var(--_bg-hover))
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
:host([slide]:focus-within) #button.slotted-link {
|
|
208
|
+
grid-template-columns: auto 1fr auto;
|
|
209
|
+
}
|
|
210
|
+
:host([slide]:focus-within) #button.slotted-link slot:not([name]) {
|
|
211
|
+
margin-left: var(--_gap);
|
|
212
|
+
opacity: 1;
|
|
213
|
+
}
|
|
214
|
+
:host([disabled]) ::slotted(a),
|
|
215
|
+
:host([loading]) ::slotted(a) {
|
|
216
|
+
pointer-events: none;
|
|
217
|
+
cursor: inherit;
|
|
218
|
+
}
|
|
219
|
+
`;
|
|
181
220
|
const appearances = css `
|
|
182
221
|
:host([appearance="fill"]),
|
|
183
222
|
:host(:not([appearance])) {
|
|
@@ -208,7 +247,7 @@ const appearances = css `
|
|
|
208
247
|
--_fg: var(--_accent);
|
|
209
248
|
--_bd: transparent;
|
|
210
249
|
}
|
|
211
|
-
:host([appearance="ghost"]:not([
|
|
250
|
+
:host([appearance="ghost"]:not([color])) {
|
|
212
251
|
--_accent: var(--eun-text-secondary, #484e61);
|
|
213
252
|
--_wash-hover: var(--eun-content-hover, #edeff0);
|
|
214
253
|
--_wash-active: var(--eun-disabled-color, #ecedf0);
|
|
@@ -239,7 +278,6 @@ const appearances = css `
|
|
|
239
278
|
--_bd: transparent;
|
|
240
279
|
}
|
|
241
280
|
|
|
242
|
-
/* States : a custom background wins, derived when only the rest one is set. */
|
|
243
281
|
:host(:not([disabled])) #button:is(:hover, :focus-visible),
|
|
244
282
|
:host(:not([disabled]):focus-visible) #button {
|
|
245
283
|
background: var(
|
|
@@ -260,28 +298,27 @@ const appearances = css `
|
|
|
260
298
|
);
|
|
261
299
|
}
|
|
262
300
|
|
|
263
|
-
/* A solid semantic button darkens instead of switching color. */
|
|
264
301
|
:host(
|
|
265
302
|
[appearance="fill"]:is(
|
|
266
|
-
[
|
|
267
|
-
[
|
|
268
|
-
[
|
|
303
|
+
[color="critical"],
|
|
304
|
+
[color="success"],
|
|
305
|
+
[color="warning"]
|
|
269
306
|
):not([disabled]):is(:hover, :focus-visible)
|
|
270
307
|
)
|
|
271
308
|
#button,
|
|
272
309
|
:host(
|
|
273
310
|
[appearance="fill"]:is(
|
|
274
|
-
[
|
|
275
|
-
[
|
|
276
|
-
[
|
|
311
|
+
[color="critical"],
|
|
312
|
+
[color="success"],
|
|
313
|
+
[color="warning"]
|
|
277
314
|
):not([disabled])
|
|
278
315
|
)
|
|
279
316
|
#button:is(:hover, :focus-visible) {
|
|
280
317
|
filter: brightness(0.9);
|
|
281
318
|
}
|
|
282
|
-
:host([appearance="fill"][
|
|
283
|
-
:host([appearance="fill"][
|
|
284
|
-
:host([appearance="fill"][
|
|
319
|
+
:host([appearance="fill"][color="critical"]:not([disabled])) #button:active,
|
|
320
|
+
:host([appearance="fill"][color="success"]:not([disabled])) #button:active,
|
|
321
|
+
:host([appearance="fill"][color="warning"]:not([disabled])) #button:active {
|
|
285
322
|
filter: brightness(0.8);
|
|
286
323
|
}
|
|
287
324
|
`;
|
|
@@ -364,6 +401,7 @@ export const buttonStyles = [
|
|
|
364
401
|
appearances,
|
|
365
402
|
disabled,
|
|
366
403
|
slide,
|
|
404
|
+
slottedLink,
|
|
367
405
|
fullVariable,
|
|
368
406
|
full,
|
|
369
407
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement, TemplateResult } from "lit";
|
|
2
2
|
import { DropdownMenuContainer } from "../../../utils/dropdown-menu.utils.js";
|
|
3
3
|
import { EunomiaIconName } from "../../content/icon/icon.type.js";
|
|
4
|
-
import { ButtonSize,
|
|
4
|
+
import { ButtonSize, ButtonColor, EunomiaButtonAppearance } from "../../../mixins/button.mixin.js";
|
|
5
5
|
import { EunomiaSeverity } from "../../../types/variant.type.js";
|
|
6
6
|
/**
|
|
7
7
|
* Tag name of the dropdown-button component.
|
|
@@ -25,7 +25,7 @@ export interface EunomiaDropdownOption {
|
|
|
25
25
|
export type EunomiaDropdownPlacement = "top-start" | "top" | "top-end" | "right" | "bottom-end" | "bottom" | "bottom-start" | "left";
|
|
26
26
|
/**
|
|
27
27
|
* A button that opens a menu of actions on click. Its trigger is a regular
|
|
28
|
-
* button, so every button
|
|
28
|
+
* button, so every button color, size, and appearance works the same way.
|
|
29
29
|
*
|
|
30
30
|
* Choosing an option doesn't persist a value on the component itself, since
|
|
31
31
|
* this is a menu of actions rather than a form field. Each choice fires an
|
|
@@ -47,16 +47,16 @@ export type EunomiaDropdownPlacement = "top-start" | "top" | "top-end" | "right"
|
|
|
47
47
|
* @slot start - An icon or other content shown at the start of the trigger. Takes priority over the default icon from icon or severity
|
|
48
48
|
* @prop {string} label - The trigger button's label
|
|
49
49
|
* @prop {import('../../content/icon/icon.type.js').EunomiaIconName} icon - An optional leading icon for the trigger button. Ignored once something is slotted into start, and overridden by the default icon from severity when both are set
|
|
50
|
-
* @prop {'info' | 'success' | 'warning' | 'critical' | 'neutral'} severity - The severity of the action this trigger leads to. When set, it supplies a default leading icon unless icon is also set or something is slotted into start. It has no effect on color, which is still controlled by
|
|
50
|
+
* @prop {'info' | 'success' | 'warning' | 'critical' | 'neutral'} severity - The severity of the action this trigger leads to. When set, it supplies a default leading icon unless icon is also set or something is slotted into start. It has no effect on color, which is still controlled by color
|
|
51
51
|
* @prop {Array<EunomiaDropdownOption>} [options=[]] - The menu options
|
|
52
52
|
* @attr {string} [options] - The menu options, written as a JSON string for use directly in markup instead of the JavaScript property
|
|
53
53
|
* @prop {string[]} [disabledKeys=[]] - Keys of options to disable in addition to any option already marked disabled
|
|
54
54
|
* @attr {string} [disabled-keys] - The disabled option keys, written as a JSON string for use directly in markup instead of the JavaScript property
|
|
55
55
|
* @prop {boolean} [disabled=false] - Whether the trigger button is disabled
|
|
56
56
|
* @prop {'xs' | 's' | 'm' | 'l' | 'xl'} [size='m'] - The size of the trigger button
|
|
57
|
-
* @prop {'primary' | 'secondary' | 'critical' | 'success' | 'warning'}
|
|
58
|
-
* @prop {boolean} [fixedColor=false] - Keeps a light or dark trigger button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other
|
|
59
|
-
* @attr {boolean} [fixed-color=false] - Keeps a light or dark trigger button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other
|
|
57
|
+
* @prop {'primary' | 'secondary' | 'critical' | 'success' | 'warning'} color - The color applied to the trigger button
|
|
58
|
+
* @prop {boolean} [fixedColor=false] - Keeps a light or dark trigger button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other colors
|
|
59
|
+
* @attr {boolean} [fixed-color=false] - Keeps a light or dark trigger button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other colors
|
|
60
60
|
* @prop {boolean} [rounded=false] - Whether the trigger button has fully rounded corners
|
|
61
61
|
* @prop {'default' | 'fill' | 'outline' | 'flat' | 'raised' | 'ghost'} [appearance='default'] - The trigger button's surface style, using the same values as the button component. Defaults to a paler tint rather than a solid fill, since a menu trigger reads better as a lighter weight control than a standalone primary action
|
|
62
62
|
* @prop {EunomiaDropdownPlacement} [placement='bottom-start'] - Where the menu opens relative to the trigger
|
|
@@ -100,7 +100,7 @@ export declare class EunomiaDropdownButton extends LitElement implements Dropdow
|
|
|
100
100
|
* trigger `eun-button`. By default, once `severity` is set and `icon`
|
|
101
101
|
* isn't (and nothing is slotted into `start`), the leading icon is set
|
|
102
102
|
* according to it — same vocabulary as `eun-alert`/`eun-tag`. Has no
|
|
103
|
-
* effect on color, which stays driven by `
|
|
103
|
+
* effect on color, which stays driven by `color` : the two genuinely
|
|
104
104
|
* differ here, since a full severity range (`info`/`neutral` included)
|
|
105
105
|
* doesn't have a matching action color.
|
|
106
106
|
*/
|
|
@@ -134,7 +134,7 @@ export declare class EunomiaDropdownButton extends LitElement implements Dropdow
|
|
|
134
134
|
/**
|
|
135
135
|
* Forwarded to the trigger `eun-button`.
|
|
136
136
|
*/
|
|
137
|
-
|
|
137
|
+
color?: ButtonColor;
|
|
138
138
|
/**
|
|
139
139
|
* Forwarded to the trigger `eun-button`.
|
|
140
140
|
* @default false
|
|
@@ -18,7 +18,7 @@ import { resolveIcon } from "../../../utils/severity-icon.utils.js";
|
|
|
18
18
|
export const EunomiaDropdownButtonTagName = "eun-dropdown-button";
|
|
19
19
|
/**
|
|
20
20
|
* A button that opens a menu of actions on click. Its trigger is a regular
|
|
21
|
-
* button, so every button
|
|
21
|
+
* button, so every button color, size, and appearance works the same way.
|
|
22
22
|
*
|
|
23
23
|
* Choosing an option doesn't persist a value on the component itself, since
|
|
24
24
|
* this is a menu of actions rather than a form field. Each choice fires an
|
|
@@ -40,16 +40,16 @@ export const EunomiaDropdownButtonTagName = "eun-dropdown-button";
|
|
|
40
40
|
* @slot start - An icon or other content shown at the start of the trigger. Takes priority over the default icon from icon or severity
|
|
41
41
|
* @prop {string} label - The trigger button's label
|
|
42
42
|
* @prop {import('../../content/icon/icon.type.js').EunomiaIconName} icon - An optional leading icon for the trigger button. Ignored once something is slotted into start, and overridden by the default icon from severity when both are set
|
|
43
|
-
* @prop {'info' | 'success' | 'warning' | 'critical' | 'neutral'} severity - The severity of the action this trigger leads to. When set, it supplies a default leading icon unless icon is also set or something is slotted into start. It has no effect on color, which is still controlled by
|
|
43
|
+
* @prop {'info' | 'success' | 'warning' | 'critical' | 'neutral'} severity - The severity of the action this trigger leads to. When set, it supplies a default leading icon unless icon is also set or something is slotted into start. It has no effect on color, which is still controlled by color
|
|
44
44
|
* @prop {Array<EunomiaDropdownOption>} [options=[]] - The menu options
|
|
45
45
|
* @attr {string} [options] - The menu options, written as a JSON string for use directly in markup instead of the JavaScript property
|
|
46
46
|
* @prop {string[]} [disabledKeys=[]] - Keys of options to disable in addition to any option already marked disabled
|
|
47
47
|
* @attr {string} [disabled-keys] - The disabled option keys, written as a JSON string for use directly in markup instead of the JavaScript property
|
|
48
48
|
* @prop {boolean} [disabled=false] - Whether the trigger button is disabled
|
|
49
49
|
* @prop {'xs' | 's' | 'm' | 'l' | 'xl'} [size='m'] - The size of the trigger button
|
|
50
|
-
* @prop {'primary' | 'secondary' | 'critical' | 'success' | 'warning'}
|
|
51
|
-
* @prop {boolean} [fixedColor=false] - Keeps a light or dark trigger button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other
|
|
52
|
-
* @attr {boolean} [fixed-color=false] - Keeps a light or dark trigger button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other
|
|
50
|
+
* @prop {'primary' | 'secondary' | 'critical' | 'success' | 'warning'} color - The color applied to the trigger button
|
|
51
|
+
* @prop {boolean} [fixedColor=false] - Keeps a light or dark trigger button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other colors
|
|
52
|
+
* @attr {boolean} [fixed-color=false] - Keeps a light or dark trigger button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other colors
|
|
53
53
|
* @prop {boolean} [rounded=false] - Whether the trigger button has fully rounded corners
|
|
54
54
|
* @prop {'default' | 'fill' | 'outline' | 'flat' | 'raised' | 'ghost'} [appearance='default'] - The trigger button's surface style, using the same values as the button component. Defaults to a paler tint rather than a solid fill, since a menu trigger reads better as a lighter weight control than a standalone primary action
|
|
55
55
|
* @prop {EunomiaDropdownPlacement} [placement='bottom-start'] - Where the menu opens relative to the trigger
|
|
@@ -1071,7 +1071,7 @@ let EunomiaDropdownButton = class EunomiaDropdownButton extends LitElement {
|
|
|
1071
1071
|
id="trigger"
|
|
1072
1072
|
type="button"
|
|
1073
1073
|
size=${this.size}
|
|
1074
|
-
|
|
1074
|
+
color=${ifDefined(this.color)}
|
|
1075
1075
|
?fixed-color=${this.fixedColor}
|
|
1076
1076
|
appearance=${this.appearance}
|
|
1077
1077
|
?rounded=${this.rounded}
|
|
@@ -1128,7 +1128,7 @@ __decorate([
|
|
|
1128
1128
|
], EunomiaDropdownButton.prototype, "size", void 0);
|
|
1129
1129
|
__decorate([
|
|
1130
1130
|
property({ reflect: true })
|
|
1131
|
-
], EunomiaDropdownButton.prototype, "
|
|
1131
|
+
], EunomiaDropdownButton.prototype, "color", void 0);
|
|
1132
1132
|
__decorate([
|
|
1133
1133
|
property({ type: Boolean, reflect: true, attribute: "fixed-color" })
|
|
1134
1134
|
], EunomiaDropdownButton.prototype, "fixedColor", void 0);
|
|
@@ -8,10 +8,10 @@ export declare const EunomiaFabTagName = "eun-fab";
|
|
|
8
8
|
* The corner a positioned FAB is fixed to.
|
|
9
9
|
*/
|
|
10
10
|
export type EunomiaFabPosition = "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
11
|
-
declare const EunomiaFab_base: import("../../../utils/constructor.type.js").Constructor<import("../../../mixins/button.mixin.js").ButtonMixinInterface> & import("../../../utils/constructor.type.js").Constructor<import("../../../mixins/command.mixin.js").CommandMixinInterface> & import("../../../utils/constructor.type.js").Constructor<import("../../../mixins/disabled.mixin.js").DisabledMixinInterface> & typeof LitElement;
|
|
11
|
+
declare const EunomiaFab_base: import("../../../utils/constructor.type.js").Constructor<import("../../../mixins/button.mixin.js").ButtonMixinInterface> & import("../../../utils/constructor.type.js").Constructor<import("../../../mixins/command.mixin.js").CommandMixinInterface> & import("../../../utils/constructor.type.js").Constructor<import("../../../mixins/disabled.mixin.js").DisabledMixinInterface> & import("../../../utils/constructor.type.js").Constructor<import("../../../mixins/localizable.mixin.js").LocalizableMixinInterface> & typeof LitElement;
|
|
12
12
|
/**
|
|
13
13
|
* A circular icon button for a screen's single primary action. It shares
|
|
14
|
-
* its
|
|
14
|
+
* its color, size, href, loading, and keyboard behavior with the regular
|
|
15
15
|
* button.
|
|
16
16
|
*
|
|
17
17
|
* When label is set, the button becomes extendable. It stays a plain circle
|
|
@@ -25,13 +25,14 @@ declare const EunomiaFab_base: import("../../../utils/constructor.type.js").Cons
|
|
|
25
25
|
* @prop {EunomiaIconName} icon - The icon displayed at all times
|
|
26
26
|
* @prop {string} label - An optional text label, revealed on hover or focus by the slide animation. Omit it for an icon only button
|
|
27
27
|
* @prop {'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'} position - Fixes the button to a corner of the viewport. Left unset, the button follows the normal document flow
|
|
28
|
-
* @prop {'primary' | 'secondary' | 'critical' | 'success' | 'warning'} [
|
|
29
|
-
* @prop {boolean} [fixedColor=false] - Keeps a light or dark button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other
|
|
30
|
-
* @attr {boolean} [fixed-color=false] - Keeps a light or dark button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other
|
|
28
|
+
* @prop {'primary' | 'secondary' | 'critical' | 'success' | 'warning'} [color='primary'] - The color applied to the button
|
|
29
|
+
* @prop {boolean} [fixedColor=false] - Keeps a light or dark button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other colors
|
|
30
|
+
* @attr {boolean} [fixed-color=false] - Keeps a light or dark button white or black in every theme. Without it, they follow the grey scale, which flips with the active theme. Has no effect on the other colors
|
|
31
31
|
* @prop {'xs' | 's' | 'm' | 'l' | 'xl'} [size='m'] - The size of the button
|
|
32
32
|
* @prop {boolean} [disabled=false] - Whether the button is disabled. For a link button, this removes the href instead, since links have no native disabled state
|
|
33
33
|
* @prop {string} href - The URL the button navigates to. When set, the button renders as a link instead of a button
|
|
34
34
|
* @prop {'_blank' | '_self' | '_parent' | '_top'} target - Where to open the linked URL. Only used when href is set. Opening in a new tab automatically announces it to assistive technology, and adds an external link icon when label is also set
|
|
35
|
+
* @prop {string} [locale] - The locale used to resolve the "opens in a new tab" announcement. Defaults to the one set with setDefaultLocale, English otherwise
|
|
35
36
|
* @prop {string} download - The filename used when the linked URL is downloaded instead of navigated to. Only used when href is set
|
|
36
37
|
* @prop {boolean} [loading=false] - Whether the button shows a loading indicator. Like disabled, it blocks interaction, but keeps the icon and label in place so the button doesn't change size
|
|
37
38
|
* @prop {string} [loadingLabel='Loading…'] - The accessible label announced while the button is loading
|
|
@@ -40,7 +41,7 @@ declare const EunomiaFab_base: import("../../../utils/constructor.type.js").Cons
|
|
|
40
41
|
* @attr {string} aria-label - The accessible label for the button. Required when label isn't set, since an icon alone has no accessible name, and recommended even when it is if the label text alone doesn't describe the action
|
|
41
42
|
* @fires click - Fired when the button is activated by mouse, Enter, or Space
|
|
42
43
|
* @fires {NavigationEvent} eunnavigate - Fired before following href, so a client-side router can intercept the navigation. Not fired for downloads, and cancelable
|
|
43
|
-
* @cssprop [--fab-background] - Sets the background color, for every
|
|
44
|
+
* @cssprop [--fab-background] - Sets the background color, for every color
|
|
44
45
|
* @cssprop [--fab-background-hover] - Sets the background color on hover
|
|
45
46
|
* @cssprop [--fab-text] - Sets the color of the text and icon
|
|
46
47
|
* @cssprop [--fab-focus-outline] - Sets the color of the focus outline
|