@eunomia/elements 1.0.0-beta.6 → 1.0.0-beta.7
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/README.md +1 -1
- package/dist/cdn/components/chunks/{chunk-JYIIWN2P.js → chunk-36KLGY6U.js} +8 -8
- package/dist/cdn/components/chunks/chunk-3BMACIDO.js +1 -0
- package/dist/cdn/components/chunks/{chunk-KDN4O5W2.js → chunk-3PNGQEG4.js} +3 -3
- package/dist/cdn/components/chunks/{chunk-ZKZV2YG5.js → chunk-5XPOGBPL.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-LMVW522V.js → chunk-62RLISRD.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-PMPSJG5V.js → chunk-6FYW5TQU.js} +3 -3
- package/dist/cdn/components/chunks/chunk-AK2DIJX7.js +1 -0
- package/dist/cdn/components/chunks/chunk-B5XMGWM7.js +10 -0
- package/dist/cdn/components/chunks/chunk-BVASCT2V.js +109 -0
- package/dist/cdn/components/chunks/{chunk-VYFR364B.js → chunk-DGI7TKCU.js} +14 -9
- package/dist/cdn/components/chunks/chunk-GVS6IUKC.js +1 -0
- package/dist/cdn/components/chunks/chunk-GWLD2I3P.js +8 -0
- package/dist/cdn/components/chunks/{chunk-UDVB4LAE.js → chunk-I4ERDXSM.js} +5 -3
- package/dist/cdn/components/chunks/{chunk-QZ5SHR3I.js → chunk-J3SZBXM6.js} +2 -2
- package/dist/cdn/components/chunks/{chunk-MOMYII3P.js → chunk-LVKMAHMU.js} +10 -0
- package/dist/cdn/components/chunks/{chunk-XDPRWUKN.js → chunk-MQQJ6DID.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-SZYEBMG6.js → chunk-PXF554MD.js} +1 -1
- package/dist/cdn/components/chunks/chunk-QL5GSW2A.js +1 -0
- package/dist/cdn/components/chunks/{chunk-7KKWYPHY.js → chunk-QXQ25SQS.js} +21 -19
- package/dist/cdn/components/chunks/{chunk-L2ADCEN7.js → chunk-SVGWCKWT.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-MQQ4BGVJ.js → chunk-TFTRCIIK.js} +7 -6
- package/dist/cdn/components/chunks/chunk-TLBXTBMM.js +46 -0
- package/dist/cdn/components/chunks/chunk-UVHVQRPT.js +1 -0
- package/dist/cdn/components/chunks/chunk-WW4BTWMH.js +1 -0
- package/dist/cdn/components/chunks/{chunk-2Y2EU2CI.js → chunk-Z3OFIE7S.js} +1 -1
- package/dist/cdn/components/eun-alert.js +13 -6
- package/dist/cdn/components/eun-animate.js +3 -3
- package/dist/cdn/components/eun-badge.js +1 -1
- package/dist/cdn/components/eun-button.js +1 -1
- package/dist/cdn/components/eun-calendar.js +2 -2
- package/dist/cdn/components/eun-card.js +4 -4
- package/dist/cdn/components/eun-carousel.js +21 -18
- package/dist/cdn/components/eun-check-card.js +1 -1
- package/dist/cdn/components/eun-checkbox-list.js +11 -8
- package/dist/cdn/components/eun-checkbox.js +1 -1
- package/dist/cdn/components/eun-chip.js +3 -3
- package/dist/cdn/components/eun-color-picker.js +60 -68
- package/dist/cdn/components/eun-counter.js +10 -10
- package/dist/cdn/components/eun-date-picker.js +47 -46
- package/dist/cdn/components/eun-description-list.js +2 -2
- package/dist/cdn/components/eun-divider.js +3 -3
- package/dist/cdn/components/eun-drawer.js +5 -5
- package/dist/cdn/components/eun-dropdown-button.js +1 -1
- package/dist/cdn/components/eun-fab.js +2 -2
- 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 +10 -10
- package/dist/cdn/components/eun-infinite-list.js +1 -1
- package/dist/cdn/components/eun-input-file.js +21 -21
- package/dist/cdn/components/eun-input-phone.js +10 -9
- package/dist/cdn/components/eun-input.js +1 -1
- package/dist/cdn/components/eun-link.js +2 -2
- package/dist/cdn/components/eun-loader.js +1 -1
- package/dist/cdn/components/eun-modal.js +13 -13
- package/dist/cdn/components/eun-pagination.js +16 -16
- package/dist/cdn/components/eun-password-strength.js +14 -10
- package/dist/cdn/components/eun-radio-card.js +1 -1
- package/dist/cdn/components/eun-radio-list.js +11 -8
- package/dist/cdn/components/eun-radio.js +1 -1
- package/dist/cdn/components/eun-rating.js +276 -0
- package/dist/cdn/components/eun-scheduler-event-editor.js +10 -10
- package/dist/cdn/components/eun-scheduler-event.js +1 -1
- package/dist/cdn/components/eun-scheduler.js +28 -28
- package/dist/cdn/components/eun-search.js +19 -21
- package/dist/cdn/components/eun-select.js +27 -27
- package/dist/cdn/components/eun-sidebar.js +10 -8
- package/dist/cdn/components/eun-skeleton.js +1 -1
- package/dist/cdn/components/eun-slider.js +3 -3
- package/dist/cdn/components/eun-sliding-card.js +1 -1
- package/dist/cdn/components/eun-step.js +5 -4
- package/dist/cdn/components/eun-stepper.js +25 -25
- package/dist/cdn/components/eun-switch.js +1 -1
- package/dist/cdn/components/eun-tab-group.js +4 -4
- 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-tag.js +3 -3
- package/dist/cdn/components/eun-textarea.js +39 -34
- package/dist/cdn/components/eun-time-picker.js +15 -14
- package/dist/cdn/components/eun-toast.js +19 -10
- package/dist/cdn/components/eun-toggle-group.js +6 -4
- package/dist/cdn/components/eun-toggle-item.js +1 -1
- package/dist/cdn/components/eun-toggle.js +2 -2
- package/dist/cdn/components/eun-toolbar.js +5 -5
- package/dist/cdn/components/eun-tooltip.js +3 -3
- package/dist/components/action/button/button.d.ts +2 -1
- package/dist/components/action/button/button.js +3 -2
- package/dist/components/action/button/button.styles.js +10 -5
- package/dist/components/action/dropdown-button/dropdown-button.js +10 -5
- package/dist/components/action/toggle/toggle-group.js +1 -1
- package/dist/components/action/toggle/toggle-group.styles.js +4 -2
- package/dist/components/action/toggle/toggle.js +1 -1
- package/dist/components/alert/alert/alert.d.ts +9 -7
- package/dist/components/alert/alert/alert.js +11 -14
- package/dist/components/alert/alert/alert.styles.js +9 -2
- package/dist/components/alert/drawer/drawer.d.ts +5 -5
- package/dist/components/alert/drawer/drawer.js +8 -12
- package/dist/components/alert/drawer/drawer.styles.js +1 -1
- package/dist/components/alert/modal/modal.d.ts +10 -10
- package/dist/components/alert/modal/modal.js +13 -25
- package/dist/components/alert/toast/toast.d.ts +7 -5
- package/dist/components/alert/toast/toast.js +9 -13
- package/dist/components/alert/toast/toast.styles.js +15 -6
- package/dist/components/content/badge/badge.js +2 -2
- package/dist/components/content/card/card.js +1 -1
- package/dist/components/content/card/card.styles.js +2 -2
- package/dist/components/content/chip/chip.d.ts +4 -4
- package/dist/components/content/chip/chip.js +8 -8
- package/dist/components/content/description-list/description-list.js +3 -3
- package/dist/components/content/icon/icon.d.ts +3 -0
- package/dist/components/content/icon/icon.js +3 -0
- package/dist/components/content/icon/icon.style.d.ts +2 -0
- package/dist/components/content/icon/icon.style.js +4 -0
- package/dist/components/content/image-carousel/image-carousel.d.ts +12 -12
- package/dist/components/content/image-carousel/image-carousel.js +24 -24
- package/dist/components/content/password-strength/password-strength.d.ts +21 -6
- package/dist/components/content/password-strength/password-strength.js +37 -16
- package/dist/components/content/password-strength/password-strength.styles.js +4 -0
- package/dist/components/content/tag/tag.js +2 -2
- package/dist/components/content/tooltip/tooltip.js +3 -3
- package/dist/components/form/checkbox/check-card.d.ts +1 -0
- package/dist/components/form/checkbox/check-card.js +1 -0
- package/dist/components/form/checkbox/checkbox-list.d.ts +17 -0
- package/dist/components/form/checkbox/checkbox-list.js +39 -10
- package/dist/components/form/checkbox/checkbox.d.ts +1 -0
- package/dist/components/form/checkbox/checkbox.js +3 -1
- package/dist/components/form/checkbox/checkbox.styles.js +3 -2
- package/dist/components/form/color-picker/color-picker.d.ts +41 -28
- package/dist/components/form/color-picker/color-picker.js +66 -50
- package/dist/components/form/color-picker/color-picker.styles.js +1 -1
- package/dist/components/form/counter/counter.d.ts +22 -18
- package/dist/components/form/counter/counter.js +59 -61
- package/dist/components/form/date-picker/date-picker.d.ts +27 -6
- package/dist/components/form/date-picker/date-picker.js +75 -54
- package/dist/components/form/input/input.d.ts +38 -39
- package/dist/components/form/input/input.js +85 -109
- package/dist/components/form/input-file/input-file.d.ts +26 -13
- package/dist/components/form/input-file/input-file.js +35 -35
- package/dist/components/form/input-file/input-file.styles.js +4 -4
- package/dist/components/form/input-phone/input-phone.d.ts +22 -5
- package/dist/components/form/input-phone/input-phone.js +41 -13
- package/dist/components/form/radio/radio-card.d.ts +1 -0
- package/dist/components/form/radio/radio-card.js +1 -0
- package/dist/components/form/radio/radio-list.d.ts +23 -7
- package/dist/components/form/radio/radio-list.js +47 -22
- package/dist/components/form/radio/radio.d.ts +1 -0
- package/dist/components/form/radio/radio.js +1 -0
- package/dist/components/form/rating/rating.d.ts +349 -0
- package/dist/components/form/rating/rating.js +665 -0
- package/dist/components/form/rating/rating.styles.d.ts +1 -0
- package/dist/components/form/rating/rating.styles.js +213 -0
- package/dist/components/form/search/search.d.ts +8 -8
- package/dist/components/form/search/search.js +23 -41
- package/dist/components/form/select/select.d.ts +23 -10
- package/dist/components/form/select/select.js +59 -41
- package/dist/components/form/shared-styles/listbox.styles.js +10 -0
- package/dist/components/form/slider/slider.d.ts +7 -8
- package/dist/components/form/slider/slider.js +9 -12
- package/dist/components/form/switch/switch.d.ts +1 -0
- package/dist/components/form/switch/switch.js +1 -0
- package/dist/components/form/textarea/textarea.d.ts +89 -23
- package/dist/components/form/textarea/textarea.js +192 -43
- package/dist/components/form/time-picker/time-picker-columns.d.ts +2 -2
- package/dist/components/form/time-picker/time-picker-columns.js +8 -8
- package/dist/components/form/time-picker/time-picker.d.ts +24 -8
- package/dist/components/form/time-picker/time-picker.js +59 -38
- package/dist/components/layout/animate/animate.js +1 -1
- package/dist/components/layout/animate/animate.styles.js +2 -2
- package/dist/components/layout/divider/divider.js +1 -1
- package/dist/components/layout/divider/divider.styles.js +1 -1
- package/dist/components/loader/loader/loader.js +2 -2
- package/dist/components/loader/loader/loader.styles.js +14 -12
- package/dist/components/loader/skeleton/skeleton.js +1 -1
- package/dist/components/navigation/carousel/carousel.d.ts +31 -7
- package/dist/components/navigation/carousel/carousel.js +74 -35
- package/dist/components/navigation/carousel/carousel.styles.js +5 -2
- package/dist/components/navigation/pagination/pagination.d.ts +23 -21
- package/dist/components/navigation/pagination/pagination.js +30 -53
- package/dist/components/navigation/sidebar/sidebar.d.ts +15 -13
- package/dist/components/navigation/sidebar/sidebar.js +21 -33
- package/dist/components/navigation/sidebar/sidebar.styles.js +5 -3
- package/dist/components/navigation/stepper/step.js +9 -8
- package/dist/components/navigation/stepper/stepper.js +12 -5
- package/dist/components/navigation/tabs/tab-group/tab-group.js +2 -2
- package/dist/components/navigation/tabs/tab-group/tab-group.styles.js +2 -2
- package/dist/components/navigation/toolbar/toolbar.d.ts +13 -13
- package/dist/components/navigation/toolbar/toolbar.js +20 -34
- package/dist/features/scheduler/calendar/calendar.js +1 -1
- package/dist/features/scheduler/scheduler/scheduler.d.ts +7 -7
- package/dist/features/scheduler/scheduler/scheduler.js +15 -24
- package/dist/features/scheduler/scheduler-event/scheduler-event.js +3 -3
- package/dist/features/scheduler/scheduler-event/scheduler-event.styles.js +1 -1
- package/dist/features/scheduler/scheduler-event-editor/scheduler-event-editor.d.ts +6 -4
- package/dist/features/scheduler/scheduler-event-editor/scheduler-event-editor.js +6 -7
- package/dist/i18n/en.d.ts +68 -0
- package/dist/i18n/en.js +68 -0
- package/dist/i18n/fr.js +68 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/mixins/button.mixin.js +3 -2
- package/dist/mixins/check.mixin.js +11 -10
- package/dist/mixins/disabled.mixin.d.ts +5 -0
- package/dist/mixins/disabled.mixin.js +21 -1
- package/dist/mixins/editable.mixin.js +28 -5
- package/dist/mixins/field-appearance.mixin.js +3 -2
- package/dist/mixins/form.mixin.d.ts +4 -0
- package/dist/mixins/form.mixin.js +87 -13
- package/dist/mixins/localizable.mixin.d.ts +1 -1
- package/dist/mixins/localizable.mixin.js +1 -1
- package/dist/mixins/radio.mixin.js +11 -10
- package/dist/mixins/readonly.mixin.d.ts +2 -1
- package/dist/mixins/readonly.mixin.js +10 -3
- package/dist/ssr/alert-ssr.css +187 -0
- package/dist/ssr/badge-ssr.css +67 -0
- package/dist/ssr/breadcrumb-ssr.css +41 -0
- package/dist/ssr/card-ssr.css +27 -15
- package/dist/ssr/carousel-ssr.css +238 -0
- package/dist/ssr/checkbox-ssr.css +67 -0
- package/dist/ssr/chip-ssr.css +242 -0
- package/dist/ssr/collapse-ssr.css +151 -0
- package/dist/ssr/field-ssr.css +163 -0
- package/dist/ssr/icon-ssr.css +266 -0
- package/dist/ssr/image-carousel-ssr.css +24 -0
- package/dist/ssr/links-ssr.css +7 -1
- package/dist/ssr/pagination-ssr.css +4 -0
- package/dist/ssr/rating-ssr.css +254 -0
- package/dist/ssr/sidebar-ssr.css +9 -1
- package/dist/ssr/skeleton-ssr.css +63 -0
- package/dist/ssr/tabs-ssr.css +129 -0
- package/dist/ssr/toggle-group-ssr.css +182 -0
- package/dist/ssr/toolbar-ssr.css +31 -2
- package/dist/utils/implicit-submission.utils.d.ts +18 -0
- package/dist/utils/implicit-submission.utils.js +79 -0
- package/dist/utils/listbox-options.utils.d.ts +11 -0
- package/dist/utils/listbox-options.utils.js +41 -3
- package/package.json +26 -7
- package/dist/cdn/components/chunks/chunk-4PI6RDUS.js +0 -1
- package/dist/cdn/components/chunks/chunk-A3X4KD2X.js +0 -1
- package/dist/cdn/components/chunks/chunk-BQFJR2UP.js +0 -110
- package/dist/cdn/components/chunks/chunk-G5SBDQQ3.js +0 -1
- package/dist/cdn/components/chunks/chunk-KSZRQRN4.js +0 -1
- package/dist/cdn/components/chunks/chunk-PE4DAXHQ.js +0 -3
- package/dist/cdn/components/chunks/chunk-RS7TWEMQ.js +0 -1
- package/dist/cdn/components/chunks/chunk-VOTRXBDS.js +0 -38
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { LitElement, PropertyValues, TemplateResult } from "lit";
|
|
2
|
+
import { DisabledMixinInterface } from "../../../mixins/disabled.mixin.js";
|
|
3
|
+
import { ReadonlyMixinInterface } from "../../../mixins/readonly.mixin.js";
|
|
4
|
+
import { ValidatorsMixinInterface } from "../../../mixins/validators.mixin.js";
|
|
5
|
+
import { FormMixinInterface } from "../../../mixins/form.mixin.js";
|
|
6
|
+
import { FormLabelMixinInterface } from "../../../mixins/form-label.mixin.js";
|
|
7
|
+
import { LocalizableMixinInterface } from "../../../mixins/localizable.mixin.js";
|
|
8
|
+
import { EunomiaIconName } from "../../content/icon/icon.type.js";
|
|
9
|
+
import { Constructor } from "../../../utils/constructor.type.js";
|
|
10
|
+
/**
|
|
11
|
+
* Tag name of the rating component.
|
|
12
|
+
*/
|
|
13
|
+
export declare const EunomiaRatingTagName = "eun-rating";
|
|
14
|
+
/**
|
|
15
|
+
* The granularity a rating can be picked at: whole icons, or halves.
|
|
16
|
+
*/
|
|
17
|
+
export type EunomiaRatingStep = 1 | 0.5;
|
|
18
|
+
/**
|
|
19
|
+
* Type of the rating base used to declare every necessary Mixin interface elements.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
type EunomiaRatingBase = LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface<number | undefined> & FormMixinInterface<number | undefined> & FormLabelMixinInterface & LocalizableMixinInterface;
|
|
23
|
+
declare const EunomiaRatingMixinBase: Constructor<EunomiaRatingBase>;
|
|
24
|
+
/**
|
|
25
|
+
* A rating shown as a row of icons, stars by default, that someone fills to
|
|
26
|
+
* give a score, or that simply displays one, such as a product's average
|
|
27
|
+
* review.
|
|
28
|
+
*
|
|
29
|
+
* Picking a score renders one native radio button per possible value,
|
|
30
|
+
* grouped in a radio group, so assistive technology announces each option
|
|
31
|
+
* as "3 out of 5", and the field takes part in forms like every other one.
|
|
32
|
+
* With displayOnly, the icons are rendered as a single image whose
|
|
33
|
+
* accessible name reads the score, such as "Rating: 4.5 out of 5".
|
|
34
|
+
*
|
|
35
|
+
* @slot [label] - Custom label content, falling back to the label property. Not rendered while displayOnly is set
|
|
36
|
+
* @slot [instructions] - Custom instructions content, falling back to the instructions property. Not rendered while displayOnly is set
|
|
37
|
+
* @prop {string} label - The title label of the field. While displayOnly is set, it isn't shown and starts the accessible name instead
|
|
38
|
+
* @prop {string} instructions - Instructions displayed below the label
|
|
39
|
+
* @prop {string} name - The field name
|
|
40
|
+
* @prop {number} value - The current rating. Empty when nothing is picked yet
|
|
41
|
+
* @prop {number} defaultValue - The rating applied when the field connects, and restored on form reset
|
|
42
|
+
* @attr {number} [default-value] - The rating applied when the field connects, and restored on form reset
|
|
43
|
+
* @prop {number} [max=5] - The number of icons, which is also the highest rating
|
|
44
|
+
* @prop {1 | 0.5} [step=1] - Whether a rating is picked by whole icons or by halves
|
|
45
|
+
* @prop {boolean} [displayOnly=false] - Only displays the rating, which can then be any decimal value, such as an average
|
|
46
|
+
* @attr {boolean} [display-only=false] - Only displays the rating, which can then be any decimal value, such as an average
|
|
47
|
+
* @prop {boolean} [clearable=false] - Shows a button that removes the rating, once one is picked
|
|
48
|
+
* @prop {string} [clearLabel] - The accessible label of the clear button. Defaults to the localized string for the current locale (English: "Clear rating")
|
|
49
|
+
* @attr {string} [clear-label] - The accessible label of the clear button
|
|
50
|
+
* @prop {import('../../content/icon/icon.type.js').EunomiaIconName} [icon='star'] - The icon drawn for the filled part of the rating
|
|
51
|
+
* @prop {import('../../content/icon/icon.type.js').EunomiaIconName} [emptyIcon='star_border'] - The icon drawn for the empty part of the rating. Keep its shape different from icon, so the rating doesn't rely on color alone
|
|
52
|
+
* @attr {import('../../content/icon/icon.type.js').EunomiaIconName} [empty-icon='star_border'] - The icon drawn for the empty part of the rating
|
|
53
|
+
* @prop {string} [locale] - The language of the accessible labels and of the decimal separator. Defaults to the shared default locale
|
|
54
|
+
* @prop {boolean} [disabled=false] - Whether the field is disabled
|
|
55
|
+
* @prop {boolean} [readonly=false] - Whether the field is read only
|
|
56
|
+
* @prop {boolean} [required=false] - Whether a rating must be picked
|
|
57
|
+
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
58
|
+
* @attr {boolean} [hide-error=false] - Whether the errors are hidden. The hint stays visible
|
|
59
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
60
|
+
* @prop {string} [error] - An error computed outside the field, by the form or by the server. While set, the field is invalid and shows this message right away
|
|
61
|
+
* @prop {string} hint - A short message displayed under the field
|
|
62
|
+
* @prop {Array<import('../../../types/form-validators.type.js').Validators<number | undefined>>} validators - The list of validation rules applied to the rating
|
|
63
|
+
* @fires {ChangeEvent} eunchange - Fired whenever the rating is picked, changed or cleared
|
|
64
|
+
* @cssprop [--rating-size] - Sets the width and height of each icon
|
|
65
|
+
* @cssprop [--rating-gap] - Sets the space between two icons
|
|
66
|
+
* @cssprop [--rating-color] - Sets the color of the filled icons
|
|
67
|
+
* @cssprop [--rating-empty-color] - Sets the color of the empty icons
|
|
68
|
+
* @cssprop [--rating-error-color] - Sets the color of the error message, and of the empty icons while in error
|
|
69
|
+
* @cssprop [--rating-hint-color] - Sets the color of the hint message
|
|
70
|
+
* @cssprop [--rating-focus-outline-color] - Sets the color of the focus outline drawn around the focused icon and the clear button
|
|
71
|
+
* @cssprop [--field-label-font-size] - Sets the font size of the label
|
|
72
|
+
* @cssprop [--field-message-font-size] - Sets the font size of the hint, error messages and instructions
|
|
73
|
+
* @element eun-rating
|
|
74
|
+
*/
|
|
75
|
+
export declare class EunomiaRating extends EunomiaRatingMixinBase {
|
|
76
|
+
/**
|
|
77
|
+
* Styles to import to the component.
|
|
78
|
+
*
|
|
79
|
+
* @static
|
|
80
|
+
* @internal
|
|
81
|
+
* @readonly
|
|
82
|
+
*/
|
|
83
|
+
static readonly styles: import("lit").CSSResult[];
|
|
84
|
+
/**
|
|
85
|
+
* Every change is a complete choice, so its error shows right away.
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
errorOnChange: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* The number of icons, which is also the highest rating.
|
|
91
|
+
* @default 5
|
|
92
|
+
*/
|
|
93
|
+
max: number;
|
|
94
|
+
/**
|
|
95
|
+
* Whether a rating is picked by whole icons or by halves. Any other value
|
|
96
|
+
* falls back to `1`.
|
|
97
|
+
* @default 1
|
|
98
|
+
*/
|
|
99
|
+
step: EunomiaRatingStep;
|
|
100
|
+
/**
|
|
101
|
+
* Only displays the rating, which can then be any decimal value, such as
|
|
102
|
+
* an average. The field is then neither focusable nor editable.
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
displayOnly: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Shows a button that removes the rating, once one is picked.
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
clearable: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* The accessible label of the clear button. Defaults to the localized
|
|
113
|
+
* string for the current locale.
|
|
114
|
+
*/
|
|
115
|
+
clearLabel?: string;
|
|
116
|
+
/**
|
|
117
|
+
* The icon drawn for the filled part of the rating.
|
|
118
|
+
* @default star
|
|
119
|
+
*/
|
|
120
|
+
icon: EunomiaIconName;
|
|
121
|
+
/**
|
|
122
|
+
* The icon drawn for the empty part of the rating. Its shape differs from
|
|
123
|
+
* {@link icon} by default, so the rating never relies on color alone.
|
|
124
|
+
* @default star_border
|
|
125
|
+
*/
|
|
126
|
+
emptyIcon: EunomiaIconName;
|
|
127
|
+
/**
|
|
128
|
+
* The rating previewed while a mouse hovers the icons.
|
|
129
|
+
* @internal
|
|
130
|
+
*/
|
|
131
|
+
private hoverValue?;
|
|
132
|
+
/**
|
|
133
|
+
* The current rating, `undefined` while nothing is picked. Overrides the
|
|
134
|
+
* accessor inherited from `FormMixin` to give it a `Number` converter, as
|
|
135
|
+
* `eun-slider` does, and to clamp every assignment within `0`/`max` : `0`
|
|
136
|
+
* or less means no rating. Snapping to `step` happens in
|
|
137
|
+
* {@link willUpdate}, once `displayOnly` is known, since a displayed
|
|
138
|
+
* average keeps its exact decimals.
|
|
139
|
+
*/
|
|
140
|
+
get value(): number | undefined;
|
|
141
|
+
set value(value: number | undefined);
|
|
142
|
+
/**
|
|
143
|
+
* The rating applied on connection and form reset. Overrides the accessor
|
|
144
|
+
* inherited from `FormMixin` for the same reason as {@link value}.
|
|
145
|
+
*/
|
|
146
|
+
get defaultValue(): number | undefined;
|
|
147
|
+
set defaultValue(value: number | undefined);
|
|
148
|
+
/**
|
|
149
|
+
* The radio group element.
|
|
150
|
+
* @internal
|
|
151
|
+
*/
|
|
152
|
+
private readonly itemsEl?;
|
|
153
|
+
/**
|
|
154
|
+
* The number of icons drawn, `max` rounded to a whole number of at least
|
|
155
|
+
* one.
|
|
156
|
+
* @private
|
|
157
|
+
*/
|
|
158
|
+
private get count();
|
|
159
|
+
/**
|
|
160
|
+
* The step actually applied, `step` restricted to `1` or `0.5`.
|
|
161
|
+
* @private
|
|
162
|
+
*/
|
|
163
|
+
private get resolvedStep();
|
|
164
|
+
/**
|
|
165
|
+
* Clamps a value within `0`/`max`, turning anything empty, invalid, or at
|
|
166
|
+
* `0` or below into `undefined`.
|
|
167
|
+
*
|
|
168
|
+
* @param value the value to clamp.
|
|
169
|
+
* @returns the clamped value.
|
|
170
|
+
* @private
|
|
171
|
+
*/
|
|
172
|
+
private clamp;
|
|
173
|
+
/**
|
|
174
|
+
* Clamps a value, then snaps it to the nearest `step` unless the rating
|
|
175
|
+
* is only displayed.
|
|
176
|
+
*
|
|
177
|
+
* @param value the value to normalize.
|
|
178
|
+
* @returns the normalized value.
|
|
179
|
+
* @private
|
|
180
|
+
*/
|
|
181
|
+
private snap;
|
|
182
|
+
/**
|
|
183
|
+
* Formats a number in the current locale, such as `4,5` in French.
|
|
184
|
+
*
|
|
185
|
+
* @param value the number to format.
|
|
186
|
+
* @returns the formatted number.
|
|
187
|
+
* @private
|
|
188
|
+
*/
|
|
189
|
+
private format;
|
|
190
|
+
/**
|
|
191
|
+
* The accessible text of a value, such as "3 out of 5".
|
|
192
|
+
*
|
|
193
|
+
* @param value the value to describe.
|
|
194
|
+
* @returns the localized text.
|
|
195
|
+
* @private
|
|
196
|
+
*/
|
|
197
|
+
private valueText;
|
|
198
|
+
/**
|
|
199
|
+
* The radio input matching a value, if rendered.
|
|
200
|
+
*
|
|
201
|
+
* @param value the value to look for.
|
|
202
|
+
* @returns the matching radio input.
|
|
203
|
+
* @private
|
|
204
|
+
*/
|
|
205
|
+
private radioFor;
|
|
206
|
+
/**
|
|
207
|
+
* The value of the group's single tab stop: the current rating, or the
|
|
208
|
+
* lowest one while nothing is picked.
|
|
209
|
+
* @private
|
|
210
|
+
*/
|
|
211
|
+
private get tabStopValue();
|
|
212
|
+
/**
|
|
213
|
+
* The host is never a tab stop of its own : sequential navigation goes
|
|
214
|
+
* straight to the radio group inside, in both directions, and
|
|
215
|
+
* {@link focus} covers a direct call on the host.
|
|
216
|
+
*/
|
|
217
|
+
protected get hostTabStop(): boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Returns the radio to focus on validation errors.
|
|
220
|
+
*
|
|
221
|
+
* @returns the group's tab stop, if rendered.
|
|
222
|
+
*/
|
|
223
|
+
getFocusAnchor(): HTMLElement | undefined;
|
|
224
|
+
/**
|
|
225
|
+
* Focuses the group's tab stop.
|
|
226
|
+
*/
|
|
227
|
+
focus(options?: FocusOptions): void;
|
|
228
|
+
/**
|
|
229
|
+
* Applies a value picked by the user, and notifies consumers when it
|
|
230
|
+
* actually changed.
|
|
231
|
+
*
|
|
232
|
+
* @param value the picked value, `undefined` to clear the rating.
|
|
233
|
+
* @private
|
|
234
|
+
*/
|
|
235
|
+
private pick;
|
|
236
|
+
/**
|
|
237
|
+
* Whether the user can't change the rating right now.
|
|
238
|
+
* @private
|
|
239
|
+
*/
|
|
240
|
+
private get locked();
|
|
241
|
+
/**
|
|
242
|
+
* The value under the pointer : the whole icon, or its first half while
|
|
243
|
+
* `step` is `0.5`, mirrored in a right-to-left layout. The gap after an
|
|
244
|
+
* icon counts as that whole icon, so moving across the row never empties
|
|
245
|
+
* the hover preview between two icons.
|
|
246
|
+
*
|
|
247
|
+
* @param event the pointer event.
|
|
248
|
+
* @returns the value under the pointer, if over or past an icon.
|
|
249
|
+
* @private
|
|
250
|
+
*/
|
|
251
|
+
private valueAtPointer;
|
|
252
|
+
/**
|
|
253
|
+
* Picks the value under the pointer. The radios themselves ignore the
|
|
254
|
+
* pointer, so a whole icon stays one target even while `step` is `0.5`.
|
|
255
|
+
*
|
|
256
|
+
* @param event the click event.
|
|
257
|
+
* @private
|
|
258
|
+
*/
|
|
259
|
+
private readonly handleClick;
|
|
260
|
+
/**
|
|
261
|
+
* Previews the value under a mouse pointer.
|
|
262
|
+
*
|
|
263
|
+
* @param event the pointer event.
|
|
264
|
+
* @private
|
|
265
|
+
*/
|
|
266
|
+
private readonly handlePointerMove;
|
|
267
|
+
/**
|
|
268
|
+
* Ends the hover preview.
|
|
269
|
+
* @private
|
|
270
|
+
*/
|
|
271
|
+
private readonly handlePointerLeave;
|
|
272
|
+
/**
|
|
273
|
+
* Applies a radio checked natively, by Space or by assistive technology.
|
|
274
|
+
*
|
|
275
|
+
* @param event the native change event.
|
|
276
|
+
* @private
|
|
277
|
+
*/
|
|
278
|
+
private readonly handleChange;
|
|
279
|
+
/**
|
|
280
|
+
* Keeps a radio from being checked while readonly, since the HTML
|
|
281
|
+
* `readonly` attribute has no effect on radios.
|
|
282
|
+
*
|
|
283
|
+
* @param event the click event dispatched on a radio.
|
|
284
|
+
* @private
|
|
285
|
+
*/
|
|
286
|
+
private readonly handleRadioClick;
|
|
287
|
+
/**
|
|
288
|
+
* Moves the rating with the arrow keys, Home and End, without wrapping
|
|
289
|
+
* around as native radios do, and blocks every change while readonly.
|
|
290
|
+
*
|
|
291
|
+
* @param event the keyboard event.
|
|
292
|
+
* @private
|
|
293
|
+
*/
|
|
294
|
+
private readonly handleKeydown;
|
|
295
|
+
/**
|
|
296
|
+
* Removes the rating, then moves focus to the group, since the clear
|
|
297
|
+
* button disappears with it.
|
|
298
|
+
* @private
|
|
299
|
+
*/
|
|
300
|
+
private readonly handleClear;
|
|
301
|
+
/**
|
|
302
|
+
* Snaps the value to `step` and keeps it within `max` whenever either of
|
|
303
|
+
* them, the value, or `displayOnly` changes. Done before render so the
|
|
304
|
+
* correction lands in the update already in progress, and before
|
|
305
|
+
* `FormMixin` validates the value.
|
|
306
|
+
*
|
|
307
|
+
* @param changed the changed properties.
|
|
308
|
+
*/
|
|
309
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
310
|
+
/**
|
|
311
|
+
* Renders one icon, its empty shape with the filled one clipped on top.
|
|
312
|
+
*
|
|
313
|
+
* @param fill how much of the icon is filled, from `0` to `1`.
|
|
314
|
+
* @returns the rendered icon.
|
|
315
|
+
* @private
|
|
316
|
+
*/
|
|
317
|
+
private renderIcon;
|
|
318
|
+
/**
|
|
319
|
+
* Renders the radio of one value, with the ring drawn around its area
|
|
320
|
+
* while it has keyboard focus.
|
|
321
|
+
*
|
|
322
|
+
* @param value the value of the radio.
|
|
323
|
+
* @returns the rendered radio.
|
|
324
|
+
* @private
|
|
325
|
+
*/
|
|
326
|
+
private renderRadio;
|
|
327
|
+
/**
|
|
328
|
+
* Renders the rating as a single image, its accessible name reading the
|
|
329
|
+
* score.
|
|
330
|
+
* @private
|
|
331
|
+
*/
|
|
332
|
+
private renderDisplay;
|
|
333
|
+
/**
|
|
334
|
+
* Renders the clear button, once a rating is picked and can be changed.
|
|
335
|
+
* @private
|
|
336
|
+
*/
|
|
337
|
+
private renderClear;
|
|
338
|
+
/**
|
|
339
|
+
* Renders the rating template.
|
|
340
|
+
* @returns The rendered HTML template
|
|
341
|
+
*/
|
|
342
|
+
render(): TemplateResult;
|
|
343
|
+
}
|
|
344
|
+
declare global {
|
|
345
|
+
interface HTMLElementTagNameMap {
|
|
346
|
+
[EunomiaRatingTagName]: EunomiaRating;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
export {};
|