@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
|
@@ -27,7 +27,7 @@ export const EunomiaSchedulerEventCardTagName = "eun-scheduler-event";
|
|
|
27
27
|
* The accessible name still includes the time either way, only the
|
|
28
28
|
* visual line disappears.
|
|
29
29
|
*
|
|
30
|
-
* There are
|
|
30
|
+
* There are three appearances. Default renders an opaque tint, with
|
|
31
31
|
* color mixed toward the current theme's own surface color, automatically
|
|
32
32
|
* light in light mode and dark in dark mode with no extra work needed.
|
|
33
33
|
* Transparent mixes the same accent toward transparent instead, for a
|
|
@@ -41,7 +41,7 @@ export const EunomiaSchedulerEventCardTagName = "eun-scheduler-event";
|
|
|
41
41
|
* @prop {Date} start - The event's start time, shown as the chip's compact time label
|
|
42
42
|
* @prop {Date} [end] - The event's end time. Used only to build a fuller accessible name, such as "Team sync, 9:00 AM to 10:00 AM", never shown visually on the chip
|
|
43
43
|
* @prop {string} [color='blue'] - The event's accent color : one of the six preset names (red/purple/yellow/blue/green/pink), each with its own tuned two-tone CSS, or a `#rrggbb` hex string for a fully custom color
|
|
44
|
-
* @prop {'default' | 'transparent' | 'ghost'} [
|
|
44
|
+
* @prop {'default' | 'transparent' | 'ghost'} [appearance='default'] - How the chip's surface is drawn
|
|
45
45
|
* @prop {'row' | 'column'} [direction='column'] - Column stacks the title above the time as two lines. Row lays them out side by side on one line instead, the title truncating with an ellipsis while the time never does, for the month view's single-day chips on desktop, where a cell is wide but not tall
|
|
46
46
|
* @attr {'row' | 'column'} [direction='column'] - Column stacks the title above the time as two lines. Row lays them out side by side on one line instead
|
|
47
47
|
* @prop {string} [locale] - The locale used to format the time label. Defaults to the runtime's own
|
|
@@ -52,8 +52,8 @@ export const EunomiaSchedulerEventCardTagName = "eun-scheduler-event";
|
|
|
52
52
|
* @cssprop [--scheduler-event-bar-width] - Sets the width of the color bar
|
|
53
53
|
* @cssprop [--scheduler-event-gap] - Sets the gap between the bar and the text
|
|
54
54
|
* @cssprop [--scheduler-event-padding] - Sets the inner padding
|
|
55
|
-
* @cssprop [--scheduler-event-opaque-tint] - Sets the mix percentage for the default
|
|
56
|
-
* @cssprop [--scheduler-event-transparent-tint] - Sets the mix percentage for the transparent
|
|
55
|
+
* @cssprop [--scheduler-event-opaque-tint] - Sets the mix percentage for the default appearance's background
|
|
56
|
+
* @cssprop [--scheduler-event-transparent-tint] - Sets the mix percentage for the transparent appearance's background
|
|
57
57
|
* @cssprop [--scheduler-event-title-color] - Sets the title text color
|
|
58
58
|
* @cssprop [--scheduler-event-time-color] - Sets the time text color
|
|
59
59
|
* @element eun-scheduler-event
|
|
@@ -75,10 +75,10 @@ let EunomiaSchedulerEventCard = EunomiaSchedulerEventCard_1 = class EunomiaSched
|
|
|
75
75
|
*/
|
|
76
76
|
this.color = "blue";
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* How the chip's surface is drawn.
|
|
79
79
|
* @default default
|
|
80
80
|
*/
|
|
81
|
-
this.
|
|
81
|
+
this.appearance = "default";
|
|
82
82
|
/**
|
|
83
83
|
* `column` stacks the title above the time (two lines) ; `row` lays them
|
|
84
84
|
* out side by side on one line instead, the title truncating with an
|
|
@@ -184,7 +184,7 @@ __decorate([
|
|
|
184
184
|
], EunomiaSchedulerEventCard.prototype, "color", void 0);
|
|
185
185
|
__decorate([
|
|
186
186
|
property({ reflect: true })
|
|
187
|
-
], EunomiaSchedulerEventCard.prototype, "
|
|
187
|
+
], EunomiaSchedulerEventCard.prototype, "appearance", void 0);
|
|
188
188
|
__decorate([
|
|
189
189
|
property({ reflect: true })
|
|
190
190
|
], EunomiaSchedulerEventCard.prototype, "direction", void 0);
|
|
@@ -7,8 +7,8 @@ import { css } from "lit";
|
|
|
7
7
|
* [--scheduler-event-bar-width] - Set a custom width for the color bar
|
|
8
8
|
* [--scheduler-event-gap] - Set a custom gap between the bar and the text
|
|
9
9
|
* [--scheduler-event-padding] - Set a custom inner padding
|
|
10
|
-
* [--scheduler-event-opaque-tint] - Set a custom mix percentage for the `default`
|
|
11
|
-
* [--scheduler-event-transparent-tint] - Set a custom mix percentage for the `transparent`
|
|
10
|
+
* [--scheduler-event-opaque-tint] - Set a custom mix percentage for the `default` appearance's background (mixed against the current theme's own `--eun-surface-color`, so it's automatically a light tint in light mode and a dark tint in dark mode)
|
|
11
|
+
* [--scheduler-event-transparent-tint] - Set a custom mix percentage for the `transparent` appearance's background (mixed against `transparent`)
|
|
12
12
|
* [--scheduler-event-title-color] - Set a custom title text color
|
|
13
13
|
* [--scheduler-event-time-color] - Set a custom time text color
|
|
14
14
|
*/
|
|
@@ -74,7 +74,7 @@ const base = css `
|
|
|
74
74
|
outline 0.2s ease-out;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
:host([
|
|
77
|
+
:host([appearance="transparent"]) #chip {
|
|
78
78
|
background: color-mix(
|
|
79
79
|
in srgb,
|
|
80
80
|
var(--_tintBase) var(--scheduler-event-transparent-tint, 22%),
|
|
@@ -82,12 +82,12 @@ const base = css `
|
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
:host([
|
|
85
|
+
:host([appearance="ghost"]) #chip {
|
|
86
86
|
background: transparent;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
:host([
|
|
90
|
-
:host([
|
|
89
|
+
:host([appearance="ghost"]) #chip:hover,
|
|
90
|
+
:host([appearance="ghost"]) #chip:hover {
|
|
91
91
|
background: color-mix(
|
|
92
92
|
in srgb,
|
|
93
93
|
var(--_tintBase) var(--scheduler-event-transparent-tint, 22%),
|
|
@@ -39,7 +39,7 @@ const PRIORITIES = [
|
|
|
39
39
|
"high",
|
|
40
40
|
"critical",
|
|
41
41
|
];
|
|
42
|
-
const
|
|
42
|
+
const PRIORITY_COLOR = {
|
|
43
43
|
low: "success",
|
|
44
44
|
high: "warning",
|
|
45
45
|
critical: "critical",
|
|
@@ -651,7 +651,7 @@ let EunomiaSchedulerEventEditor = class EunomiaSchedulerEventEditor extends LitE
|
|
|
651
651
|
<eun-button
|
|
652
652
|
appearance="default"
|
|
653
653
|
id="guest-add-button"
|
|
654
|
-
|
|
654
|
+
color="secondary"
|
|
655
655
|
aria-label=${this.addGuestLabel}
|
|
656
656
|
@click=${this.handleAddGuestClick}
|
|
657
657
|
>
|
|
@@ -710,7 +710,7 @@ let EunomiaSchedulerEventEditor = class EunomiaSchedulerEventEditor extends LitE
|
|
|
710
710
|
${PRIORITIES.map((priority) => html `
|
|
711
711
|
<eun-toggle-item
|
|
712
712
|
value=${priority}
|
|
713
|
-
|
|
713
|
+
color=${ifDefined(PRIORITY_COLOR[priority])}
|
|
714
714
|
>
|
|
715
715
|
${priorityLabel(priority)}
|
|
716
716
|
</eun-toggle-item>
|
|
@@ -741,7 +741,7 @@ let EunomiaSchedulerEventEditor = class EunomiaSchedulerEventEditor extends LitE
|
|
|
741
741
|
<div id="actions">
|
|
742
742
|
${this.event
|
|
743
743
|
? html `
|
|
744
|
-
<eun-button
|
|
744
|
+
<eun-button color="critical" @click=${this.requestDelete}>
|
|
745
745
|
${this.deleteLabel}
|
|
746
746
|
</eun-button>
|
|
747
747
|
`
|
|
@@ -750,7 +750,7 @@ let EunomiaSchedulerEventEditor = class EunomiaSchedulerEventEditor extends LitE
|
|
|
750
750
|
<eun-button appearance="ghost" @click=${this.handleCancelClick}>
|
|
751
751
|
${this.cancelLabel}
|
|
752
752
|
</eun-button>
|
|
753
|
-
<eun-button
|
|
753
|
+
<eun-button color="primary" @click=${this.handleSaveClick}>
|
|
754
754
|
${this.saveLabel}
|
|
755
755
|
</eun-button>
|
|
756
756
|
</div>
|
|
@@ -104,14 +104,14 @@ export function renderEventPopover(props) {
|
|
|
104
104
|
: html `
|
|
105
105
|
<div class="event-popover-actions">
|
|
106
106
|
<eun-button
|
|
107
|
-
|
|
107
|
+
color="critical"
|
|
108
108
|
size="s"
|
|
109
109
|
appearance="outline"
|
|
110
110
|
rounded
|
|
111
111
|
@click=${onDelete}
|
|
112
112
|
>${deleteLabel}</eun-button
|
|
113
113
|
>
|
|
114
|
-
<eun-button
|
|
114
|
+
<eun-button color="primary" size="s" rounded @click=${onEdit}
|
|
115
115
|
>${editLabel}</eun-button
|
|
116
116
|
>
|
|
117
117
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TemplateResult } from "lit";
|
|
2
2
|
import { EunomiaSchedulerEvent } from "./scheduler.types.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { EunomiaSchedulerEventAppearance } from "../scheduler-event/scheduler-event.js";
|
|
4
4
|
/**
|
|
5
5
|
* Props for {@link renderHourGrid}.
|
|
6
6
|
*/
|
|
@@ -12,7 +12,7 @@ export interface HourGridProps {
|
|
|
12
12
|
slotDuration: number;
|
|
13
13
|
locale?: string;
|
|
14
14
|
slotHeight: number;
|
|
15
|
-
|
|
15
|
+
eventAppearance: EunomiaSchedulerEventAppearance;
|
|
16
16
|
onSlotClick: (start: Date) => void;
|
|
17
17
|
onEventClick: (event: EunomiaSchedulerEvent, domEvent: MouseEvent) => void;
|
|
18
18
|
draggingEventId?: string | null;
|
|
@@ -102,7 +102,7 @@ export function renderHourGrid(props) {
|
|
|
102
102
|
.start=${slot.event.start}
|
|
103
103
|
.end=${slot.event.end}
|
|
104
104
|
color=${slot.event.color}
|
|
105
|
-
|
|
105
|
+
appearance=${props.eventAppearance}
|
|
106
106
|
hide-time
|
|
107
107
|
@click=${(domEvent) => props.onEventClick(slot.event, domEvent)}
|
|
108
108
|
></eun-scheduler-event>
|
|
@@ -139,7 +139,7 @@ export function renderHourGrid(props) {
|
|
|
139
139
|
*/
|
|
140
140
|
/* eslint-disable lit-a11y/click-events-have-key-events */
|
|
141
141
|
function renderDayColumn(day, props, now, hourCount) {
|
|
142
|
-
const { events, dayStartHour, dayEndHour, slotDuration, slotHeight,
|
|
142
|
+
const { events, dayStartHour, dayEndHour, slotDuration, slotHeight, eventAppearance, onSlotClick, onEventClick, draggingEventId, onEventDragStart, } = props;
|
|
143
143
|
const gridStartMinutes = dayStartHour * 60;
|
|
144
144
|
const gridEndMinutes = dayEndHour * 60;
|
|
145
145
|
const dayEvents = timedEventsForDay(events, day);
|
|
@@ -210,7 +210,7 @@ function renderDayColumn(day, props, now, hourCount) {
|
|
|
210
210
|
.start=${slot.event.start}
|
|
211
211
|
.end=${slot.event.end}
|
|
212
212
|
color=${slot.event.color}
|
|
213
|
-
|
|
213
|
+
appearance=${eventAppearance}
|
|
214
214
|
?hide-time=${height < CONDENSED_HEIGHT_THRESHOLD}
|
|
215
215
|
@click=${(domEvent) => onEventClick(slot.event, domEvent)}
|
|
216
216
|
></eun-scheduler-event>
|
|
@@ -13,10 +13,10 @@ import { EunomiaSchedulerEvent } from "./scheduler.types.js";
|
|
|
13
13
|
export declare const MONTH_EVENT_ROW_HEIGHT = 22;
|
|
14
14
|
/**
|
|
15
15
|
* Props for {@link renderSchedulerMonthView}. Deliberately has no
|
|
16
|
-
* `
|
|
17
|
-
* its own bar
|
|
16
|
+
* `eventAppearance` field, unlike `HourGridProps` : month view always picks
|
|
17
|
+
* its own bar appearance itself (`ghost` unless the event spans multiple
|
|
18
18
|
* days — see {@link renderMonthWeek}), regardless of `eun-calendar`'s own
|
|
19
|
-
* `
|
|
19
|
+
* `eventAppearance` prop, which only reaches day/week/work-week's chips.
|
|
20
20
|
*/
|
|
21
21
|
export interface MonthViewProps {
|
|
22
22
|
displayedMonth: Date;
|
|
@@ -74,7 +74,7 @@ function slotsTouchingDay(slots, dayIndex) {
|
|
|
74
74
|
* about and never needs to visually split a bar around a day that ran out
|
|
75
75
|
* of room.
|
|
76
76
|
*
|
|
77
|
-
* Each bar's own
|
|
77
|
+
* Each bar's own appearance is `ghost` (no fill, just the accent bar and
|
|
78
78
|
* text — the density this view actually needs, a whole week's worth of
|
|
79
79
|
* single-day bars packed into a few rows) unless {@link isMultiDay}, which
|
|
80
80
|
* keeps `default`'s opaque tint instead : a bar spanning several day
|
|
@@ -120,7 +120,7 @@ function renderMonthWeek(week, props) {
|
|
|
120
120
|
.start=${slot.event.start}
|
|
121
121
|
.end=${slot.event.end}
|
|
122
122
|
color=${slot.event.color}
|
|
123
|
-
|
|
123
|
+
appearance=${isMultiDay(slot.event) ? "default" : "ghost"}
|
|
124
124
|
direction=${desktop ? "row" : "column"}
|
|
125
125
|
?hide-time=${!desktop || !!slot.event.allDay}
|
|
126
126
|
@click=${(domEvent) => onEventClick(slot.event, domEvent)}
|
|
@@ -2,7 +2,7 @@ import { TemplateResult } from "lit";
|
|
|
2
2
|
import { EunomiaIconName } from "../../../components/content/icon/icon.type.js";
|
|
3
3
|
import { EunomiaDropdownOption } from "../../../components/action/dropdown-button/dropdown-button.js";
|
|
4
4
|
import { EunomiaTableColumnSort } from "../table-column/table-column.js";
|
|
5
|
-
import {
|
|
5
|
+
import { EunomiaActionColor } from "../../../types/variant.type.js";
|
|
6
6
|
/**
|
|
7
7
|
* A single action rendered in `eun-table-action-bar`'s center region — a
|
|
8
8
|
* plain button, or a dropdown when `dropdown` is set.
|
|
@@ -11,7 +11,7 @@ export interface EunomiaTableAction {
|
|
|
11
11
|
key: string;
|
|
12
12
|
label: string;
|
|
13
13
|
icon?: EunomiaIconName;
|
|
14
|
-
|
|
14
|
+
color?: EunomiaActionColor;
|
|
15
15
|
dropdown?: EunomiaDropdownOption[];
|
|
16
16
|
disabled?: boolean;
|
|
17
17
|
}
|
|
@@ -56,7 +56,11 @@ export interface EunomiaTableRowButtonActionDef<T extends object = Record<string
|
|
|
56
56
|
type?: "button";
|
|
57
57
|
label: string;
|
|
58
58
|
icon?: EunomiaIconName;
|
|
59
|
-
|
|
59
|
+
/**
|
|
60
|
+
* The button's color. Once set, the button gets a pale tinted surface in
|
|
61
|
+
* that color ; left unset, it stays a neutral ghost button.
|
|
62
|
+
*/
|
|
63
|
+
color?: EunomiaActionColor;
|
|
60
64
|
disabled?: (row: T) => boolean;
|
|
61
65
|
onClick: (row: T, index: number) => void;
|
|
62
66
|
}
|
|
@@ -104,13 +104,13 @@ let EunomiaTableActionBar = class EunomiaTableActionBar extends LitElement {
|
|
|
104
104
|
this.dispatchEvent(new TableActionEvent(action.key, event.key));
|
|
105
105
|
}
|
|
106
106
|
renderAction(action) {
|
|
107
|
-
const isCritical = action.
|
|
107
|
+
const isCritical = action.color === "critical";
|
|
108
108
|
if (action.dropdown) {
|
|
109
109
|
return html `
|
|
110
110
|
<eun-dropdown-button
|
|
111
111
|
label=${action.label}
|
|
112
112
|
icon=${ifDefined(action.icon)}
|
|
113
|
-
|
|
113
|
+
color=${ifDefined(isCritical ? "critical" : undefined)}
|
|
114
114
|
appearance=${isCritical ? "default" : "flat"}
|
|
115
115
|
.options=${action.dropdown}
|
|
116
116
|
?disabled=${action.disabled}
|
|
@@ -129,7 +129,7 @@ let EunomiaTableActionBar = class EunomiaTableActionBar extends LitElement {
|
|
|
129
129
|
}
|
|
130
130
|
return html `
|
|
131
131
|
<eun-button
|
|
132
|
-
|
|
132
|
+
color=${ifDefined(isCritical ? "critical" : undefined)}
|
|
133
133
|
label=${action.label}
|
|
134
134
|
appearance=${isCritical ? "default" : "flat"}
|
|
135
135
|
?disabled=${action.disabled}
|
|
@@ -105,8 +105,8 @@ function buildRowActionElement(action, row, index) {
|
|
|
105
105
|
const el = document.createElement(EunomiaButtonTagName);
|
|
106
106
|
el.setAttribute("slot", "action");
|
|
107
107
|
el.size = "xs";
|
|
108
|
-
if (action.
|
|
109
|
-
el.
|
|
108
|
+
if (action.color) {
|
|
109
|
+
el.color = action.color;
|
|
110
110
|
el.appearance = "default";
|
|
111
111
|
}
|
|
112
112
|
else {
|
package/dist/i18n/en.d.ts
CHANGED
package/dist/i18n/en.js
CHANGED
package/dist/i18n/fr.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { EunomiaInfiniteList, EunomiaInfiniteListTagName, } from "./components/l
|
|
|
4
4
|
export { EunomiaDivider, EunomiaDividerTagName, } from "./components/layout/divider/divider.js";
|
|
5
5
|
export type { EunomiaDividerOrientation } from "./components/layout/divider/divider.js";
|
|
6
6
|
export { EunomiaButton, EunomiaButtonTagName, } from "./components/action/button/button.js";
|
|
7
|
-
export type {
|
|
7
|
+
export type { EunomiaActionColor, EunomiaSeverity, EunomiaAppearance, EunomiaFieldAppearance, EunomiaTone, EunomiaSize, } from "./types/variant.type.js";
|
|
8
8
|
export { EunomiaFab, EunomiaFabTagName } from "./components/action/fab/fab.js";
|
|
9
9
|
export type { EunomiaFabPosition } from "./components/action/fab/fab.js";
|
|
10
10
|
export { EunomiaDropdownButton, EunomiaDropdownButtonTagName, } from "./components/action/dropdown-button/dropdown-button.js";
|
|
@@ -21,7 +21,7 @@ export { EunomiaTag, EunomiaTagTagName } from "./components/content/tag/tag.js";
|
|
|
21
21
|
export { EunomiaChip, EunomiaChipTagName, } from "./components/content/chip/chip.js";
|
|
22
22
|
export type { EunomiaChipColor, EunomiaChipAppearance, EunomiaChipSeverity, EunomiaChipSize, EunomiaChipAvatarShape, } from "./components/content/chip/chip.js";
|
|
23
23
|
export { EunomiaBadge, EunomiaBadgeTagName, } from "./components/content/badge/badge.js";
|
|
24
|
-
export type { EunomiaBadgeSize,
|
|
24
|
+
export type { EunomiaBadgeSize, EunomiaBadgeColor, } from "./components/content/badge/badge.js";
|
|
25
25
|
export { EunomiaCollapse, EunomiaCollapseTagName, } from "./components/content/collapse/collapse.js";
|
|
26
26
|
export { EunomiaCard, EunomiaCardTagName, } from "./components/content/card/card.js";
|
|
27
27
|
export { EunomiaImageCard, EunomiaImageCardTagName, } from "./components/content/card/image-card.js";
|
|
@@ -90,7 +90,7 @@ export type { EunomiaSkeletonVariant } from "./components/loader/skeleton/skelet
|
|
|
90
90
|
export { EunomiaScheduler, EunomiaSchedulerTagName, } from "./features/scheduler/scheduler/scheduler.js";
|
|
91
91
|
export { EunomiaCalendar, EunomiaCalendarTagName, } from "./features/scheduler/calendar/calendar.js";
|
|
92
92
|
export { EunomiaSchedulerEventCard, EunomiaSchedulerEventCardTagName, } from "./features/scheduler/scheduler-event/scheduler-event.js";
|
|
93
|
-
export type {
|
|
93
|
+
export type { EunomiaSchedulerEventAppearance } from "./features/scheduler/scheduler-event/scheduler-event.js";
|
|
94
94
|
export { EunomiaSchedulerEventEditor, EunomiaSchedulerEventEditorTagName, } from "./features/scheduler/scheduler-event-editor/scheduler-event-editor.js";
|
|
95
95
|
export type { EunomiaSchedulerEvent, EunomiaSchedulerEventColor, EunomiaSchedulerEventPriority, EunomiaSchedulerGuest, EunomiaSchedulerGuestStatus, EunomiaSchedulerView, } from "./features/scheduler/shared/scheduler.types.js";
|
|
96
96
|
export { EunomiaTable, EunomiaTableTagName, } from "./features/table/table/table.js";
|
package/dist/jsx.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="index.d.ts" />
|
|
2
2
|
/**
|
|
3
|
-
* JSX/TSX support for every `eun-*` tag: `<eun-button
|
|
3
|
+
* JSX/TSX support for every `eun-*` tag: `<eun-button color="primary">`
|
|
4
4
|
* type-checks in a `.tsx` file the same way a native `<button>` does, with
|
|
5
5
|
* prop autocomplete and invalid-prop rejection, once this module has been
|
|
6
6
|
* imported anywhere in the program.
|
|
@@ -3,29 +3,30 @@ import { CommandMixinInterface } from "./command.mixin.js";
|
|
|
3
3
|
import { DisabledMixinInterface } from "./disabled.mixin.js";
|
|
4
4
|
import { PopoverMixinInterface } from "./popover.mixin.js";
|
|
5
5
|
import { Constructor } from "../utils/constructor.type.js";
|
|
6
|
-
import {
|
|
6
|
+
import { EunomiaActionColor, EunomiaAppearance, EunomiaSize, EunomiaTone } from "../types/variant.type.js";
|
|
7
7
|
/**
|
|
8
8
|
* The button's native HTML mechanism when clicked inside a form — distinct
|
|
9
|
-
* from every other component's `
|
|
9
|
+
* from every other component's `color`/`appearance`, and left as `type`
|
|
10
10
|
* since it mirrors the real `<button type>` attribute.
|
|
11
11
|
*/
|
|
12
12
|
export type ButtonType = "submit" | "reset" | "button";
|
|
13
13
|
/**
|
|
14
|
-
* All available
|
|
15
|
-
* {@link
|
|
14
|
+
* All available colors for the button component: the semantic
|
|
15
|
+
* {@link EunomiaActionColor} set, plus the neutral, non-semantic grey tones
|
|
16
16
|
* borrowed from {@link EunomiaTone} (`light`/`medium`/`dark`), the same
|
|
17
17
|
* vocabulary `eun-tag`'s `color` uses. They cover a de-emphasized action,
|
|
18
18
|
* such as a secondary link next to a colored CTA, without resorting to
|
|
19
19
|
* manual `--button-*` cssprop overrides.
|
|
20
20
|
*/
|
|
21
|
-
export type
|
|
21
|
+
export type ButtonColor = EunomiaActionColor | Extract<EunomiaTone, "light" | "medium" | "dark">;
|
|
22
22
|
/**
|
|
23
23
|
* All available sizes for the button component.
|
|
24
24
|
*/
|
|
25
25
|
export type ButtonSize = EunomiaSize;
|
|
26
26
|
/**
|
|
27
|
-
* All available button surface treatments —
|
|
28
|
-
*
|
|
27
|
+
* All available button surface treatments — every {@link EunomiaAppearance}
|
|
28
|
+
* value except the field-only `underline` and the scheduler-only
|
|
29
|
+
* `transparent`, since a button (unlike a passive display
|
|
29
30
|
* component) has a hover/focus/active state for `ghost` to reveal itself
|
|
30
31
|
* on, and can be visually elevated (`raised`) the way a static piece of
|
|
31
32
|
* content never is. Not part of {@link ButtonMixinInterface} itself : only
|
|
@@ -33,14 +34,14 @@ export type ButtonSize = EunomiaSize;
|
|
|
33
34
|
* (a floating action button has no `stroke`/`raised`/`flat`/`ghost` look of
|
|
34
35
|
* its own).
|
|
35
36
|
*/
|
|
36
|
-
export type EunomiaButtonAppearance = EunomiaAppearance
|
|
37
|
+
export type EunomiaButtonAppearance = Extract<EunomiaAppearance, "default" | "fill" | "outline" | "flat" | "raised" | "ghost">;
|
|
37
38
|
/**
|
|
38
39
|
* Interface for the ButtonMixin.
|
|
39
40
|
* Extend this in components if needed.
|
|
40
41
|
*/
|
|
41
42
|
export declare class ButtonMixinInterface {
|
|
42
43
|
type?: ButtonType;
|
|
43
|
-
|
|
44
|
+
color?: ButtonColor;
|
|
44
45
|
fixedColor?: boolean;
|
|
45
46
|
size?: ButtonSize;
|
|
46
47
|
rounded?: boolean;
|
|
@@ -22,14 +22,16 @@ export const ButtonMixin = (superClass) => {
|
|
|
22
22
|
super(...arguments);
|
|
23
23
|
/**
|
|
24
24
|
* The button type: "submit", "reset", or "button".
|
|
25
|
-
* Determines behavior when clicked inside a form.
|
|
25
|
+
* Determines behavior when clicked inside a form. Only reflected once it
|
|
26
|
+
* differs from the default, so an SSR framework doesn't see an
|
|
27
|
+
* attribute it never rendered.
|
|
26
28
|
* @default "button"
|
|
27
29
|
*/
|
|
28
30
|
this.type = "button";
|
|
29
31
|
/**
|
|
30
32
|
* Keeps a `light` or `dark` button white or black in every theme.
|
|
31
33
|
* Without it, they follow the grey scale, which flips with the active
|
|
32
|
-
* theme. Has no effect on the other
|
|
34
|
+
* theme. Has no effect on the other colors.
|
|
33
35
|
* @default false
|
|
34
36
|
*/
|
|
35
37
|
this.fixedColor = false;
|
|
@@ -61,13 +63,14 @@ export const ButtonMixin = (superClass) => {
|
|
|
61
63
|
* Lifecycle hook: adds keyboard and click listeners, and sets the
|
|
62
64
|
* default role to "button" if not already defined.
|
|
63
65
|
*
|
|
64
|
-
* Skipped entirely when `href` is set
|
|
66
|
+
* Skipped entirely when `href` is set, or when a native `<a>` is slotted
|
|
67
|
+
* as a direct child : that anchor (internal or the consumer's own)
|
|
65
68
|
* already provides native role, focus and activation semantics, so the
|
|
66
69
|
* host must stay out of the way rather than duplicate them.
|
|
67
70
|
*/
|
|
68
71
|
connectedCallback() {
|
|
69
72
|
super.connectedCallback?.();
|
|
70
|
-
if (this.href) {
|
|
73
|
+
if (this.href || this.querySelector(":scope > a")) {
|
|
71
74
|
return;
|
|
72
75
|
}
|
|
73
76
|
if (!this.hasAttribute("role")) {
|
|
@@ -154,11 +157,16 @@ export const ButtonMixin = (superClass) => {
|
|
|
154
157
|
}
|
|
155
158
|
}
|
|
156
159
|
__decorate([
|
|
157
|
-
property({
|
|
160
|
+
property({
|
|
161
|
+
reflect: true,
|
|
162
|
+
converter: {
|
|
163
|
+
toAttribute: (value) => (value === "button" ? null : value),
|
|
164
|
+
},
|
|
165
|
+
})
|
|
158
166
|
], ButtonMixinClass.prototype, "type", void 0);
|
|
159
167
|
__decorate([
|
|
160
168
|
property({ reflect: true })
|
|
161
|
-
], ButtonMixinClass.prototype, "
|
|
169
|
+
], ButtonMixinClass.prototype, "color", void 0);
|
|
162
170
|
__decorate([
|
|
163
171
|
property({ type: Boolean, reflect: true, attribute: "fixed-color" })
|
|
164
172
|
], ButtonMixinClass.prototype, "fixedColor", void 0);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, nothing, TemplateResult } from "lit";
|
|
2
2
|
import { Constructor } from "../utils/constructor.type.js";
|
|
3
|
+
import { LocalizableMixinInterface } from "./localizable.mixin.js";
|
|
3
4
|
/**
|
|
4
5
|
* The native `target` values a card can be given, mirroring
|
|
5
6
|
* `eun-button`/`eun-link`'s own `target` type.
|
|
@@ -15,7 +16,7 @@ export declare class CardLinkMixinInterface {
|
|
|
15
16
|
get isExternal(): boolean;
|
|
16
17
|
get linkAriaLabel(): string | undefined;
|
|
17
18
|
renderNewTabHint(): TemplateResult | typeof nothing;
|
|
18
|
-
renderExternalLinkBadge(): TemplateResult | typeof nothing;
|
|
19
|
+
renderExternalLinkBadge(slottedBlank?: boolean): TemplateResult | typeof nothing;
|
|
19
20
|
renderCardLink(id: string, content: TemplateResult, className?: string): TemplateResult;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
@@ -37,4 +38,4 @@ export declare class CardLinkMixinInterface {
|
|
|
37
38
|
* @param superClass - The base class to extend (must include LitElement).
|
|
38
39
|
* @returns A class extended with the card link behavior.
|
|
39
40
|
*/
|
|
40
|
-
export declare const CardLinkMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<CardLinkMixinInterface> & T;
|
|
41
|
+
export declare const CardLinkMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<CardLinkMixinInterface & LocalizableMixinInterface> & T;
|
|
@@ -8,6 +8,7 @@ import { html, nothing } from "lit";
|
|
|
8
8
|
import { property } from "lit/decorators.js";
|
|
9
9
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
10
|
import { handleLinkNavigation } from "../utils/navigation.utils.js";
|
|
11
|
+
import { LocalizableMixin, } from "./localizable.mixin.js";
|
|
11
12
|
/**
|
|
12
13
|
* CardLinkMixin adds the "link state" shared by every card in this family
|
|
13
14
|
* (`eun-card`, `eun-image-card`, `eun-sliding-card`) : `href`/`target`/
|
|
@@ -28,7 +29,7 @@ import { handleLinkNavigation } from "../utils/navigation.utils.js";
|
|
|
28
29
|
* @returns A class extended with the card link behavior.
|
|
29
30
|
*/
|
|
30
31
|
export const CardLinkMixin = (superClass) => {
|
|
31
|
-
class CardLinkMixinClass extends superClass {
|
|
32
|
+
class CardLinkMixinClass extends LocalizableMixin(superClass) {
|
|
32
33
|
/**
|
|
33
34
|
* Whether the link, if any, opens in a new tab.
|
|
34
35
|
*/
|
|
@@ -44,7 +45,9 @@ export const CardLinkMixin = (superClass) => {
|
|
|
44
45
|
*/
|
|
45
46
|
get linkAriaLabel() {
|
|
46
47
|
const label = this.ariaLabel ?? undefined;
|
|
47
|
-
return this.isExternal && label
|
|
48
|
+
return this.isExternal && label
|
|
49
|
+
? `${label} (${this.dictionary.link.opensInNewTab})`
|
|
50
|
+
: label;
|
|
48
51
|
}
|
|
49
52
|
/**
|
|
50
53
|
* Gives an SPA router (Next.js, Angular, React Router, Vue Router, ...)
|
|
@@ -71,16 +74,20 @@ export const CardLinkMixin = (superClass) => {
|
|
|
71
74
|
if (!(this.href && this.isExternal) || this.ariaLabel) {
|
|
72
75
|
return nothing;
|
|
73
76
|
}
|
|
74
|
-
|
|
77
|
+
const hint = this.dictionary.link.opensInNewTab;
|
|
78
|
+
return html `<span class="sr-only"> (${hint})</span>`;
|
|
75
79
|
}
|
|
76
80
|
/**
|
|
77
81
|
* The absolute, top-right external-link badge shown when `href` and
|
|
78
82
|
* `target="_blank"` are both set — purely decorative (`aria-hidden`),
|
|
79
83
|
* the accessible "(opens in a new tab)" wording lives on the `<a>`
|
|
80
84
|
* itself (see {@link linkAriaLabel}/{@link renderNewTabHint}).
|
|
85
|
+
*
|
|
86
|
+
* @param slottedBlank whether a slotted anchor, rather than `href`,
|
|
87
|
+
* opens in a new tab (its wording goes on its own aria-description).
|
|
81
88
|
*/
|
|
82
|
-
renderExternalLinkBadge() {
|
|
83
|
-
if (!(this.href && this.isExternal)) {
|
|
89
|
+
renderExternalLinkBadge(slottedBlank = false) {
|
|
90
|
+
if (!(this.href && this.isExternal) && !slottedBlank) {
|
|
84
91
|
return nothing;
|
|
85
92
|
}
|
|
86
93
|
return html `
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LitElement } from
|
|
2
|
-
import { Constructor } from
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import { Constructor } from "../utils/constructor.type.js";
|
|
3
3
|
/**
|
|
4
4
|
* Interface defining the contract for components using DisabledMixin.
|
|
5
5
|
*/
|
|
@@ -11,7 +11,7 @@ export declare class DisabledMixinInterface {
|
|
|
11
11
|
*
|
|
12
12
|
* When the `disabled` property changes, it automatically updates:
|
|
13
13
|
* - `tabindex` (to prevent focus when disabled),
|
|
14
|
-
* - `aria-disabled` for accessibility.
|
|
14
|
+
* - `aria-disabled` for accessibility, only present while disabled.
|
|
15
15
|
*
|
|
16
16
|
* @param superClass - The base class to extend.
|
|
17
17
|
* @returns A new class extending the base with `disabled` behavior.
|
|
@@ -4,13 +4,13 @@ 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 { property } from
|
|
7
|
+
import { property } from "lit/decorators.js";
|
|
8
8
|
/**
|
|
9
9
|
* A mixin that adds a `disabled` property to a LitElement component.
|
|
10
10
|
*
|
|
11
11
|
* When the `disabled` property changes, it automatically updates:
|
|
12
12
|
* - `tabindex` (to prevent focus when disabled),
|
|
13
|
-
* - `aria-disabled` for accessibility.
|
|
13
|
+
* - `aria-disabled` for accessibility, only present while disabled.
|
|
14
14
|
*
|
|
15
15
|
* @param superClass - The base class to extend.
|
|
16
16
|
* @returns A new class extending the base with `disabled` behavior.
|
|
@@ -34,9 +34,14 @@ export const DisabledMixin = (superClass) => {
|
|
|
34
34
|
*/
|
|
35
35
|
updated(_changedProperties) {
|
|
36
36
|
super.updated(_changedProperties);
|
|
37
|
-
if (_changedProperties.has(
|
|
38
|
-
this.setAttribute(
|
|
39
|
-
|
|
37
|
+
if (_changedProperties.has("disabled")) {
|
|
38
|
+
this.setAttribute("tabindex", this.disabled ? "-1" : "0");
|
|
39
|
+
if (this.disabled) {
|
|
40
|
+
this.setAttribute("aria-disabled", "true");
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
this.removeAttribute("aria-disabled");
|
|
44
|
+
}
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
47
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import { Constructor } from "../utils/constructor.type.js";
|
|
3
|
+
import { EunomiaFieldAppearance } from "../types/variant.type.js";
|
|
4
|
+
/**
|
|
5
|
+
* Interface defining the contract for components using FieldAppearanceMixin.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FieldAppearanceMixinInterface {
|
|
8
|
+
appearance?: EunomiaFieldAppearance;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A mixin that adds an `appearance` property to a text-like form field
|
|
12
|
+
* component, controlling how its surface is drawn: bordered box
|
|
13
|
+
* (`outline`, default), muted background with no border (`flat`), or a
|
|
14
|
+
* bottom-only border (`underline`).
|
|
15
|
+
*
|
|
16
|
+
* @param superClass - The base class to extend.
|
|
17
|
+
* @returns A new class extending the base with `appearance` behavior.
|
|
18
|
+
*/
|
|
19
|
+
export declare const FieldAppearanceMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<FieldAppearanceMixinInterface> & T;
|