@ebrains/components 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components.cjs.js +1 -1
- package/dist/cjs/{eds-avatar_28.cjs.entry.js → eds-avatar_29.cjs.entry.js} +172 -53
- package/dist/cjs/index-88c8039f.js +2 -6
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/eds-input-elements/eds-input/eds-input.js +62 -2
- package/dist/collection/components/eds-input-field/eds-input-field.js +100 -26
- package/dist/collection/components/eds-input-field/eds-input-field.stories.js +19 -1
- package/dist/collection/components/eds-table/eds-table.js +7 -12
- package/dist/collection/components/eds-toast/eds-toast.js +20 -1
- package/dist/collection/shared-ui/eds-form/eds-form.js +20 -14
- package/dist/collection/utils/eds-form/formValidators.js +1 -1
- package/dist/collection/utils/eds-form/individualValidator.js +15 -1
- package/dist/collection/utils/eds-form/validateInput.js +1 -1
- package/dist/components/components.esm.js +1 -1
- package/dist/components/eds-form.js +37 -17
- package/dist/components/eds-input-field2.js +48 -22
- package/dist/components/eds-input2.js +14 -2
- package/dist/components/eds-table2.js +7 -12
- package/dist/components/eds-toast2.js +4 -2
- package/dist/components/p-b998223d.entry.js +1 -0
- package/dist/esm/components.js +1 -1
- package/dist/esm/{eds-avatar_28.entry.js → eds-avatar_29.entry.js} +172 -54
- package/dist/esm/index-fdb33359.js +2 -6
- package/dist/esm/loader.js +1 -1
- package/dist/hydrate/index.js +109 -54
- package/dist/hydrate/index.mjs +109 -54
- package/dist/stencil.config.js +7 -1
- package/dist/types/components/eds-input-elements/eds-input/eds-input.d.ts +3 -0
- package/dist/types/components/eds-input-field/eds-input-field.d.ts +8 -2
- package/dist/types/components/eds-input-field/eds-input-field.stories.d.ts +12 -0
- package/dist/types/components/eds-toast/eds-toast.d.ts +5 -0
- package/dist/types/components.d.ts +50 -4
- package/dist/types/utils/eds-form/individualValidator.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/eds-toast.cjs.entry.js +0 -77
- package/dist/components/p-326d9e55.entry.js +0 -1
- package/dist/components/p-4ffdf8ac.entry.js +0 -1
- package/dist/esm/eds-toast.entry.js +0 -73
|
@@ -51,7 +51,7 @@ isFieldVisible) {
|
|
|
51
51
|
const inputEl = findFieldElement(formEl, field.name);
|
|
52
52
|
if (inputEl) {
|
|
53
53
|
const value = inputEl.value;
|
|
54
|
-
const fieldErrors = validateField(field.name, value, field.type, field.required, field.maxlength);
|
|
54
|
+
const fieldErrors = validateField(field.name, value, field.type, field.required, field.maxlength, field.min, field.max);
|
|
55
55
|
if (fieldErrors.length > 0) {
|
|
56
56
|
errors[field.name] = fieldErrors;
|
|
57
57
|
hasError = true;
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
// utils/validators.ts
|
|
2
|
-
export function validateField(name, value, type, required, maxLength) {
|
|
2
|
+
export function validateField(name, value, type, required, maxLength, min, max) {
|
|
3
3
|
const errors = [];
|
|
4
4
|
if (required && !value) {
|
|
5
5
|
errors.push(`${name} is required.`);
|
|
6
6
|
}
|
|
7
|
+
if (type === 'number') {
|
|
8
|
+
const parsed = typeof value === 'number' ? value : parseFloat(value);
|
|
9
|
+
if (isNaN(parsed)) {
|
|
10
|
+
errors.push(`${name} must be a valid number.`);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
if (typeof min === 'number' && parsed < min) {
|
|
14
|
+
errors.push(`${name} must be greater than or equal to ${min}.`);
|
|
15
|
+
}
|
|
16
|
+
if (typeof max === 'number' && parsed > max) {
|
|
17
|
+
errors.push(`${name} must be less than or equal to ${max}.`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
7
21
|
if (maxLength && typeof value === 'string' && value.length > maxLength) {
|
|
8
22
|
errors.push(`${name} must be at most ${maxLength} characters.`);
|
|
9
23
|
}
|
|
@@ -12,7 +12,7 @@ export function validateInputField(field, value, formEl) {
|
|
|
12
12
|
}
|
|
13
13
|
return validateSingleBox(field.name, field.required, formEl);
|
|
14
14
|
}
|
|
15
|
-
return validateField(field.name, value, field.type, field.required, field.maxlength);
|
|
15
|
+
return validateField(field.name, value, field.type, field.required, field.maxlength, field.min, field.max);
|
|
16
16
|
}
|
|
17
17
|
export function isFieldVisible(field, values) {
|
|
18
18
|
if (!field.condition) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as a}from"./p-28ae3f3a.js";export{s as setNonce}from"./p-28ae3f3a.js";import{g as t}from"./p-e1255160.js";(()=>{const a=import.meta.url,s={};return""!==a&&(s.resourcesUrl=new URL(".",a).href),e(s)})().then((async e=>(await t(),a(JSON.parse('[["p-4ffdf8ac",[[1,"eds-form",{"name":[1],"setFormUrl":[4,"set-form-url"],"formBtn":[4,"form-btn"],"formBtnLabel":[1,"form-btn-label"],"errorMessage":[1,"error-message"],"fields":[1],"initData":[16],"values":[32],"isSubmitting":[32],"hasError":[32],"errors":[32],"parsedFields":[32],"setData":[64],"getData":[64]},null,{"fields":["parseFields"]}],[1,"eds-fullscreen-menu",{"links":[1],"menuLinks":[1,"menu-links"],"homeUrl":[1,"home-url"],"inverseHeader":[4,"inverse-header"],"isMenuOpen":[32]},[[16,"toggleheadermenu","handleToggleMenu"]]],[1,"eds-user",{"user":[1025]}],[1,"eds-header",{"homeUrl":[513,"home-url"],"links":[1],"headerVariant":[513,"header-variant"],"menuEnabled":[4,"menu-enabled"],"isMenuOpen":[32],"isUserMenuOpen":[32],"isAuthenticated":[32]},[[16,"authStatusChanged","onAuthStatusChanged"]]],[1,"eds-steps-v2",{"steps":[1],"type":[1],"imageSrc":[1,"image-src"],"imageWidth":[2,"image-width"],"bg":[4],"message":[1],"activeStep":[32]},null,{"activeStep":["activeStepChanged"]}],[1,"eds-modal",{"heading":[1,"title"],"truncate":[2],"position":[1],"inverseHeader":[4,"inverse-header"],"isOpen":[32],"open":[64],"close":[64],"toggle":[64]},[[0,"eds-modal-open","handleGlobalOpen"],[0,"eds-modal-close","handleGlobalClose"],[8,"keydown","handleKeyDown"]]],[1,"eds-tabs",{"identifier":[1,"id"],"navAriaLabel":[1,"nav-aria-label"],"tabs":[1],"parsedTabs":[32],"activeIndex":[32]},null,{"tabs":["parseTabs"]}],[1,"eds-footer",{"social":[4],"enableScrollTop":[4,"enable-scroll-top"],"fundedBy":[1,"funded-by"],"rightsReserved":[1,"rights-reserved"],"cookiesPreferences":[1,"cookies-preferences"],"enableCookiesSettings":[4,"enable-cookies-settings"],"backToTopAriaLabel":[1,"back-to-top-aria-label"],"showMatomoNotice":[32]}],[1,"eds-dropdown",{"icon":[1],"label":[1],"rounded":[4],"ariaLabel":[1,"aria-label"],"asNav":[4,"as-nav"],"dropdownPos":[1,"dropdown-pos"],"dropdownOffset":[4,"dropdown-offset"],"intent":[1],"isOpen":[32],"focusIndex":[32]},[[8,"click","handleWindowClick"],[8,"keydown","handleKeyDown"]]],[1,"eds-steps",{"steps":[1],"type":[1],"activeStep":[32]},null,{"activeStep":["activeStepChanged"]}],[1,"eds-social-networks",{"heading":[1,"title"]}],[1,"eds-table",{"data":[1,"table-data"],"endpoint":[1],"config":[1],"rowsPerPage":[2,"rows-per-page"],"paginationEnabled":[4,"pagination-enabled"],"searchEnabled":[4,"search-enabled"],"hostWidth":[1,"host-width"],"columnSize":[1,"column-size"],"actions":[1],"actionTemplate":[16],"parsedActions":[32],"dataColumns":[32],"tbData":[32],"columns":[32],"currentPage":[32],"parsedConfig":[32],"totalRows":[32],"searchQuery":[32],"containerWidth":[32]},null,{"data":["handleDataChange","parseData"],"config":["handleConfigChange"],"actions":["handleActionsChange"]}],[1,"eds-pagination",{"currentPage":[2,"current-page"],"lastPage":[2,"last-page"],"perPage":[2,"per-page"],"total":[2],"url":[1],"mode":[1],"prevLabel":[1,"prev-label"],"nextLabel":[1,"next-label"],"prevUrl":[1,"prev-url"],"nextUrl":[1,"next-url"],"links":[32]},null,{"currentPage":["onPageOrLastPageChange"],"lastPage":["onPageOrLastPageChange"]}],[1,"eds-block-break",{"inverse":[4]}],[1,"eds-input-field",{"name":[1],"inputId":[1,"input-id"],"placeholder":[1],"disabled":[4],"required":[4],"label":[1],"hint":[1],"icon":[1],"link":[16],"message":[1],"error":[4],"checked":[4],"errorMessage":[1,"error-message"],"value":[8],"maxLength":[2,"max-length"],"options":[1],"type":[1],"onChangeNative":[16],"onInput":[16],"exposeValueEvents":[4,"expose-value-events"]}],[1,"eds-avatar",{"firstName":[1,"first-name"],"lastName":[1,"last-name"],"picture":[1],"initials":[1],"color":[1]}],[0,"eds-input",{"name":[1],"inputId":[1,"input-id"],"placeholder":[1],"disabled":[4],"hasMessage":[4,"has-message"],"error":[4],"checked":[4],"type":[1],"required":[4],"value":[8],"icon":[1],"maxLength":[2,"max-length"],"options":[16],"extraClass":[1,"extra-class"],"innerVal":[32],"maxLengthReached":[32]},null,{"value":["onValueChanged"]}],[1,"eds-input-footer",{"name":[1],"errorMessage":[1,"error-message"],"message":[1],"error":[4],"link":[16]}],[0,"eds-input-search",{"name":[1],"inputId":[1,"input-id"],"placeholder":[1],"value":[1],"disabled":[4],"required":[4],"decorate":[1],"label":[1],"getInputElement":[64]}],[0,"eds-input-select",{"inputId":[1,"input-id"],"name":[1],"placeholder":[1],"disabled":[4],"hasMessage":[4,"has-message"],"error":[4],"required":[4],"options":[16],"value":[8]}],[1,"eds-input-label",{"label":[1],"name":[1],"required":[4],"disabled":[4]}],[0,"eds-input-range",{"name":[1],"inputId":[1,"input-id"],"disabled":[4],"required":[4],"min":[2],"max":[2],"step":[2],"value":[2],"sliderVal":[32],"getInputElement":[64]},null,{"value":["onValueChange"]}],[1,"eds-tag",{"label":[1],"intent":[1],"size":[1]}],[1,"eds-logo",{"href":[1],"orientation":[1],"type":[1],"label":[1]}],[1,"eds-img",{"src":[1],"alt":[1],"width":[2],"height":[2],"srcset":[1],"sizes":[1],"formats":[16],"lazyload":[4],"withBg":[4,"with-bg"],"loaded":[32],"showBg":[32]}],[1,"eds-link",{"label":[1],"intent":[1],"icon":[1],"iconPos":[1,"icon-pos"],"iconSmall":[4,"icon-small"],"size":[1],"external":[4],"current":[4],"download":[4],"url":[1],"ariaLabel":[1,"aria-label"],"disabled":[4],"hideLabelOnSmallScreen":[4,"hide-label-on-small-screen"],"extraClass":[1,"extra-class"]},[[0,"parentContext","handleParentContext"]]],[1,"eds-button",{"label":[1],"ariaLabel":[1,"aria-label"],"elementType":[1,"element-type"],"intent":[1],"loading":[4],"disabled":[4],"pill":[4],"icon":[1],"size":[1],"iconPos":[1,"icon-pos"],"iconSmall":[4,"icon-small"],"extraClass":[1,"extra-class"],"triggerClick":[16]},[[0,"parentContext","handleParentContext"]]],[0,"eds-icon-wrapper",{"icon":[1],"class":[1],"IconComponent":[32]},null,{"icon":["iconChanged"]}]]],["p-41316de1",[[0,"eds-trl",{"applications":[1]}]]],["p-5873fcd0",[[1,"logo-space"]]],["p-71f0c1ec",[[1,"svg-repository"]]],["p-cd0fb6c7",[[0,"docs-palettes",{"tabIndex":[2,"tab-index"]}]]],["p-b7a29cf7",[[0,"components-section",{"tabIndex":[2,"tab-index"]}]]],["p-adbd0d7b",[[1,"eds-card-section",{"cards":[1],"occupyCols":[2,"occupy-cols"]}]]],["p-835b48f4",[[1,"eds-timeline",{"events":[1],"selectedEvent":[32],"parsedEvents":[32]},null,{"events":["parseEvents"]}]]],["p-5f64fbb0",[[0,"docs-tokens",{"tabIndex":[2,"tab-index"]}]]],["p-1f5c19b9",[[1,"eds-card-tool",{"cardTitle":[1,"card-title"],"url":[1],"description":[1],"image":[8],"avatar":[1],"shortAbbreviation":[1,"short-abbreviation"],"headingLevel":[1,"heading-level"],"tags":[8],"tiny":[4],"bg":[4],"withHover":[4,"with-hover"],"external":[4],"hierarchy":[4]}]]],["p-c0900e8c",[[0,"eds-cookies-preference",{"buttonText":[1,"button-text"],"intent":[1],"showMatomoNotice":[32],"noticeKey":[32]}]]],["p-a6cdf11b",[[1,"eds-app-root",{"isAuthenticated":[32]}]]],["p-f189be4f",[[0,"eds-card-project",{"image":[8],"editorialTitle":[1,"editorial-title"],"headingLevel":[1,"heading-level"],"categoryTitle":[1,"category-title"],"color":[1],"bgOnHover":[4,"bg-on-hover"],"vertical":[4],"titleProject":[1,"title-project"],"url":[1],"parsedImage":[32]}]]],["p-fd4aed5a",[[1,"eds-feedback",{"headingLevel":[1,"heading-level"],"type":[1],"count":[2],"label":[1],"description":[1],"textMapping":[1,"text-mapping"],"selectedRating":[32]},[[16,"rating","ratingUpdated"]]]]],["p-bf1552ed",[[1,"eds-toast-manager",{"toasts":[32]}]]],["p-598f203e",[[0,"incorrect-use-of-colors"]]],["p-4185659c",[[0,"logo-variations-tabs",{"tabIndex":[2,"tab-index"]}]]],["p-3024b7cf",[[0,"correct-use-of-colors"]]],["p-b630e51a",[[1,"eds-breadcrumb",{"items":[1],"intent":[1],"parsedItems":[32],"isSmallScreen":[32],"maxVisibleItems":[32]},null,{"items":["parseItems"]}]]],["p-776b21cf",[[1,"eds-frame",{"frameLabel":[1,"frame-label"],"frameSrc":[1,"frame-src"],"urlLabel":[1,"url-label"],"errorMessage":[1,"error-message"],"url":[1],"intent":[1],"size":[1],"iframeError":[32]}]]],["p-94de9aaf",[[0,"token-ratios"]]],["p-463abb12",[[0,"token-typography"]]],["p-11efb1d1",[[1,"eds-card-tags",{"accent":[4],"tags":[16]}]]],["p-b073d78f",[[1,"eds-gauge",{"size":[2],"valueMin":[2,"value-min"],"valueMax":[2,"value-max"],"value":[2],"thickness":[2],"variant":[1]}]]],["p-19d586e6",[[0,"eds-icon-arrow-diagonal",{"class":[1]}]]],["p-d4f239d7",[[0,"eds-icon-arrow-right",{"class":[1]}]]],["p-f221eca2",[[0,"eds-icon-bluesky",{"class":[1]}]]],["p-6f9ab63c",[[0,"eds-icon-bookmark",{"class":[1]}]]],["p-c91b4eec",[[0,"eds-icon-chevron-down",{"class":[1]}]]],["p-023bc47c",[[0,"eds-icon-chevron-left",{"class":[1]}]]],["p-f2416727",[[0,"eds-icon-chevron-right",{"class":[1]}]]],["p-50f43dfd",[[0,"eds-icon-chevron-up",{"class":[1]}]]],["p-9a4b5746",[[0,"eds-icon-close",{"class":[1]}]]],["p-750e3ec8",[[0,"eds-icon-copy",{"class":[1]}]]],["p-e8f0d7fc",[[0,"eds-icon-eu",{"class":[1]}]]],["p-177103fd",[[0,"eds-icon-external",{"class":[1]}]]],["p-42295abe",[[0,"eds-icon-facebook",{"class":[1]}]]],["p-424e91b3",[[0,"eds-icon-gitlab",{"class":[1]}]]],["p-563d56c0",[[0,"eds-icon-linkedin",{"class":[1]}]]],["p-95518776",[[0,"eds-icon-loader",{"class":[1]}]]],["p-9d64d1fd",[[0,"eds-icon-mastodon",{"class":[1]}]]],["p-ab4447f6",[[0,"eds-icon-menu",{"class":[1]}]]],["p-fd85675b",[[0,"eds-icon-minus",{"class":[1]}]]],["p-99d9bb29",[[0,"eds-icon-more",{"class":[1]}]]],["p-1de8401b",[[0,"eds-icon-paper",{"class":[1]}]]],["p-4dcdd4d9",[[0,"eds-icon-plus",{"class":[1]}]]],["p-e5113509",[[0,"eds-icon-portal",{"class":[1]}]]],["p-7502b8b4",[[0,"eds-icon-private",{"class":[1]}]]],["p-43cff423",[[0,"eds-icon-public",{"class":[1]}]]],["p-321a950b",[[0,"eds-icon-search",{"class":[1]}]]],["p-38c9aee7",[[0,"eds-icon-star",{"class":[1]}]]],["p-ffccfeb6",[[0,"eds-icon-success",{"class":[1]}]]],["p-9c823b5e",[[0,"eds-icon-thumbs-down",{"class":[1]}]]],["p-45f21238",[[0,"eds-icon-thumbs-up",{"class":[1]}]]],["p-4fad9296",[[0,"eds-icon-tutorial",{"class":[1]}]]],["p-5827fd52",[[0,"eds-icon-twitter",{"class":[1]}]]],["p-4bdf1589",[[0,"eds-icon-unknown",{"class":[1]}]]],["p-158c95bc",[[0,"eds-icon-updown",{"class":[1]}]]],["p-d3bb444a",[[0,"eds-icon-user",{"class":[1]}]]],["p-5c5dfc4a",[[0,"eds-icon-youtube",{"class":[1]}]]],["p-8c0b0121",[[1,"eds-pie",{"size":[2],"slices":[1],"thickness":[2],"display":[1],"legend":[4],"colorScheme":[1,"color-scheme"]}]]],["p-1c3f1440",[[1,"eds-switch",{"checked":[1540],"disabled":[4],"labelOn":[1,"label-on"],"labelOff":[1,"label-off"]}]]],["p-0c465a1e",[[1,"eds-tooltip",{"content":[1]},[[1,"mouseenter","handleHover"]]]]],["p-5ba5708a",[[1,"logo-wrong-usage"]]],["p-77527268",[[0,"token-spacing"]]],["p-b5e64725",[[1,"eds-accordion",{"heading":[1,"title"],"description":[1],"switchBg":[4,"switch-bg"],"expanded":[4],"clampText":[4,"clamp-text"],"isExpanded":[32],"panelHeight":[32],"shortContent":[32],"headerHeight":[32]}]]],["p-bb9af709",[[1,"eds-matomo-notice",{"heading":[1,"title"],"description":[1],"optOutMessage":[1,"opt-out-message"],"forceShow":[4,"force-show"],"showNotice":[32]},[[16,"cookies","toggleCookiesConsent"]]]]],["p-8ba5feea",[[1,"eds-rating",{"ratingType":[1,"rating-type"],"ratingCount":[2,"rating-count"],"selectedRating":[32]}]]],["p-4188643f",[[1,"eds-spinner",{"size":[1],"thickness":[1],"borderColor":[1,"border-color"],"bottomColor":[1,"bottom-color"],"background":[1],"fullscreen":[4]}]]],["p-cfccddc3",[[1,"eds-splash-screen",{"inverse":[4],"initPromise":[16],"isVisible":[32]},[[8,"hideSplash","handleHideSplash"]],{"initPromise":["watchInitPromise"]}]]],["p-326d9e55",[[1,"eds-toast",{"message":[1],"intent":[1],"duration":[2],"visible":[32]}]]],["p-940c1a08",[[1,"eds-progress-bar",{"value":[1026],"rounded":[4],"updateValue":[64]}]]],["p-14679a86",[[1,"eds-card-generic",{"cardTitle":[1,"card-title"],"url":[1],"description":[1],"image":[8],"avatar":[1],"shortAbbreviation":[1,"short-abbreviation"],"headingLevel":[1,"heading-level"],"tags":[1],"tiny":[4],"bg":[4],"withHover":[4,"with-hover"],"hierarchy":[4],"parsedImage":[32]},[[0,"parentContext","handleParentContext"]]]]],["p-33a5fa80",[[1,"logo-variations-horizontal"],[1,"logo-variations-vertical",{"orientation":[1],"type":[1]}]]],["p-deb9bbed",[[1,"eds-alert",{"message":[1],"pressableLabel":[1,"pressable-label"],"pressableUrl":[1,"pressable-url"],"direction":[1],"intent":[1],"brd":[1],"withBtn":[32]}]]],["p-9f35fe5f",[[0,"token-list",{"show":[1]}],[0,"token-radii"],[0,"token-shadows"]]],["p-c3c61a32",[[1,"eds-section-core",{"tag":[1],"sectionTitle":[1,"section-title"],"headingLevel":[1,"heading-level"]}],[0,"eds-section-heading",{"sectionTitle":[1,"section-title"],"withContainer":[4,"with-container"],"headingLevel":[1,"heading-level"],"tag":[1],"spacingLarge":[4,"spacing-large"]}]]],["p-fe167c78",[[1,"eds-code-block",{"code":[1],"language":[1],"copied":[32]}]]],["p-21cb7ef6",[[0,"gradient-secondary-palette"],[0,"color-primary-palette"],[0,"color-secondary-palette",{"show":[1]}],[0,"color-support-palette"],[0,"gradient-primary-palette"],[0,"gradient-support-palette"]]],["p-66f4cdd9",[[1,"eds-card-desc",{"description":[1],"truncate":[4],"truncateLines":[1,"truncate-lines"]}],[1,"eds-card-title",{"url":[1],"titleClass":[1,"title-class"],"headingLevel":[1,"heading-level"],"externalLink":[4,"external-link"],"cardTitle":[1,"card-title"],"hierarchy":[4]}]]]]'),e))));
|
|
1
|
+
import{p as e,b as a}from"./p-28ae3f3a.js";export{s as setNonce}from"./p-28ae3f3a.js";import{g as t}from"./p-e1255160.js";(()=>{const a=import.meta.url,s={};return""!==a&&(s.resourcesUrl=new URL(".",a).href),e(s)})().then((async e=>(await t(),a(JSON.parse('[["p-b998223d",[[1,"eds-form",{"name":[1],"setFormUrl":[4,"set-form-url"],"formBtn":[4,"form-btn"],"formBtnLabel":[1,"form-btn-label"],"errorMessage":[1,"error-message"],"fields":[1],"initData":[16],"values":[32],"isSubmitting":[32],"hasError":[32],"errors":[32],"parsedFields":[32],"setData":[64],"getData":[64]},null,{"fields":["parseFields"]}],[1,"eds-fullscreen-menu",{"links":[1],"menuLinks":[1,"menu-links"],"homeUrl":[1,"home-url"],"inverseHeader":[4,"inverse-header"],"isMenuOpen":[32]},[[16,"toggleheadermenu","handleToggleMenu"]]],[1,"eds-user",{"user":[1025]}],[1,"eds-header",{"homeUrl":[513,"home-url"],"links":[1],"headerVariant":[513,"header-variant"],"menuEnabled":[4,"menu-enabled"],"isMenuOpen":[32],"isUserMenuOpen":[32],"isAuthenticated":[32]},[[16,"authStatusChanged","onAuthStatusChanged"]]],[1,"eds-steps-v2",{"steps":[1],"type":[1],"imageSrc":[1,"image-src"],"imageWidth":[2,"image-width"],"bg":[4],"message":[1],"activeStep":[32]},null,{"activeStep":["activeStepChanged"]}],[1,"eds-modal",{"heading":[1,"title"],"truncate":[2],"position":[1],"inverseHeader":[4,"inverse-header"],"isOpen":[32],"open":[64],"close":[64],"toggle":[64]},[[0,"eds-modal-open","handleGlobalOpen"],[0,"eds-modal-close","handleGlobalClose"],[8,"keydown","handleKeyDown"]]],[1,"eds-tabs",{"identifier":[1,"id"],"navAriaLabel":[1,"nav-aria-label"],"tabs":[1],"parsedTabs":[32],"activeIndex":[32]},null,{"tabs":["parseTabs"]}],[1,"eds-footer",{"social":[4],"enableScrollTop":[4,"enable-scroll-top"],"fundedBy":[1,"funded-by"],"rightsReserved":[1,"rights-reserved"],"cookiesPreferences":[1,"cookies-preferences"],"enableCookiesSettings":[4,"enable-cookies-settings"],"backToTopAriaLabel":[1,"back-to-top-aria-label"],"showMatomoNotice":[32]}],[1,"eds-dropdown",{"icon":[1],"label":[1],"rounded":[4],"ariaLabel":[1,"aria-label"],"asNav":[4,"as-nav"],"dropdownPos":[1,"dropdown-pos"],"dropdownOffset":[4,"dropdown-offset"],"intent":[1],"isOpen":[32],"focusIndex":[32]},[[8,"click","handleWindowClick"],[8,"keydown","handleKeyDown"]]],[1,"eds-steps",{"steps":[1],"type":[1],"activeStep":[32]},null,{"activeStep":["activeStepChanged"]}],[1,"eds-toast",{"message":[1],"intent":[1],"duration":[2],"visible":[32]}],[1,"eds-social-networks",{"heading":[1,"title"]}],[1,"eds-table",{"data":[1,"table-data"],"endpoint":[1],"config":[1],"rowsPerPage":[2,"rows-per-page"],"paginationEnabled":[4,"pagination-enabled"],"searchEnabled":[4,"search-enabled"],"hostWidth":[1,"host-width"],"columnSize":[1,"column-size"],"actions":[1],"actionTemplate":[16],"parsedActions":[32],"dataColumns":[32],"tbData":[32],"columns":[32],"currentPage":[32],"parsedConfig":[32],"totalRows":[32],"searchQuery":[32],"containerWidth":[32]},null,{"data":["handleDataChange","parseData"],"config":["handleConfigChange"],"actions":["handleActionsChange"]}],[1,"eds-pagination",{"currentPage":[2,"current-page"],"lastPage":[2,"last-page"],"perPage":[2,"per-page"],"total":[2],"url":[1],"mode":[1],"prevLabel":[1,"prev-label"],"nextLabel":[1,"next-label"],"prevUrl":[1,"prev-url"],"nextUrl":[1,"next-url"],"links":[32]},null,{"currentPage":["onPageOrLastPageChange"],"lastPage":["onPageOrLastPageChange"]}],[1,"eds-block-break",{"inverse":[4]}],[1,"eds-input-field",{"name":[1],"inputId":[1,"input-id"],"placeholder":[1],"disabled":[4],"required":[4],"label":[1],"hint":[1],"icon":[1],"link":[16],"message":[1],"error":[4],"checked":[4],"errorMessage":[1,"error-message"],"value":[8],"maxLength":[2,"max-length"],"min":[2],"max":[2],"step":[2],"options":[1],"type":[1],"onChangeNative":[16],"onInput":[16],"exposeValueEvents":[4,"expose-value-events"]}],[1,"eds-avatar",{"firstName":[1,"first-name"],"lastName":[1,"last-name"],"picture":[1],"initials":[1],"color":[1]}],[0,"eds-input",{"name":[1],"inputId":[1,"input-id"],"placeholder":[1],"disabled":[4],"hasMessage":[4,"has-message"],"error":[4],"checked":[4],"type":[1],"required":[4],"value":[8],"icon":[1],"maxLength":[2,"max-length"],"options":[16],"extraClass":[1,"extra-class"],"min":[2],"max":[2],"step":[2],"innerVal":[32],"maxLengthReached":[32]},null,{"value":["onValueChanged"]}],[1,"eds-input-footer",{"name":[1],"errorMessage":[1,"error-message"],"message":[1],"error":[4],"link":[16]}],[0,"eds-input-search",{"name":[1],"inputId":[1,"input-id"],"placeholder":[1],"value":[1],"disabled":[4],"required":[4],"decorate":[1],"label":[1],"getInputElement":[64]}],[0,"eds-input-select",{"inputId":[1,"input-id"],"name":[1],"placeholder":[1],"disabled":[4],"hasMessage":[4,"has-message"],"error":[4],"required":[4],"options":[16],"value":[8]}],[1,"eds-input-label",{"label":[1],"name":[1],"required":[4],"disabled":[4]}],[0,"eds-input-range",{"name":[1],"inputId":[1,"input-id"],"disabled":[4],"required":[4],"min":[2],"max":[2],"step":[2],"value":[2],"sliderVal":[32],"getInputElement":[64]},null,{"value":["onValueChange"]}],[1,"eds-tag",{"label":[1],"intent":[1],"size":[1]}],[1,"eds-logo",{"href":[1],"orientation":[1],"type":[1],"label":[1]}],[1,"eds-img",{"src":[1],"alt":[1],"width":[2],"height":[2],"srcset":[1],"sizes":[1],"formats":[16],"lazyload":[4],"withBg":[4,"with-bg"],"loaded":[32],"showBg":[32]}],[1,"eds-link",{"label":[1],"intent":[1],"icon":[1],"iconPos":[1,"icon-pos"],"iconSmall":[4,"icon-small"],"size":[1],"external":[4],"current":[4],"download":[4],"url":[1],"ariaLabel":[1,"aria-label"],"disabled":[4],"hideLabelOnSmallScreen":[4,"hide-label-on-small-screen"],"extraClass":[1,"extra-class"]},[[0,"parentContext","handleParentContext"]]],[1,"eds-button",{"label":[1],"ariaLabel":[1,"aria-label"],"elementType":[1,"element-type"],"intent":[1],"loading":[4],"disabled":[4],"pill":[4],"icon":[1],"size":[1],"iconPos":[1,"icon-pos"],"iconSmall":[4,"icon-small"],"extraClass":[1,"extra-class"],"triggerClick":[16]},[[0,"parentContext","handleParentContext"]]],[0,"eds-icon-wrapper",{"icon":[1],"class":[1],"IconComponent":[32]},null,{"icon":["iconChanged"]}]]],["p-41316de1",[[0,"eds-trl",{"applications":[1]}]]],["p-5873fcd0",[[1,"logo-space"]]],["p-71f0c1ec",[[1,"svg-repository"]]],["p-cd0fb6c7",[[0,"docs-palettes",{"tabIndex":[2,"tab-index"]}]]],["p-b7a29cf7",[[0,"components-section",{"tabIndex":[2,"tab-index"]}]]],["p-adbd0d7b",[[1,"eds-card-section",{"cards":[1],"occupyCols":[2,"occupy-cols"]}]]],["p-835b48f4",[[1,"eds-timeline",{"events":[1],"selectedEvent":[32],"parsedEvents":[32]},null,{"events":["parseEvents"]}]]],["p-5f64fbb0",[[0,"docs-tokens",{"tabIndex":[2,"tab-index"]}]]],["p-1f5c19b9",[[1,"eds-card-tool",{"cardTitle":[1,"card-title"],"url":[1],"description":[1],"image":[8],"avatar":[1],"shortAbbreviation":[1,"short-abbreviation"],"headingLevel":[1,"heading-level"],"tags":[8],"tiny":[4],"bg":[4],"withHover":[4,"with-hover"],"external":[4],"hierarchy":[4]}]]],["p-c0900e8c",[[0,"eds-cookies-preference",{"buttonText":[1,"button-text"],"intent":[1],"showMatomoNotice":[32],"noticeKey":[32]}]]],["p-a6cdf11b",[[1,"eds-app-root",{"isAuthenticated":[32]}]]],["p-f189be4f",[[0,"eds-card-project",{"image":[8],"editorialTitle":[1,"editorial-title"],"headingLevel":[1,"heading-level"],"categoryTitle":[1,"category-title"],"color":[1],"bgOnHover":[4,"bg-on-hover"],"vertical":[4],"titleProject":[1,"title-project"],"url":[1],"parsedImage":[32]}]]],["p-fd4aed5a",[[1,"eds-feedback",{"headingLevel":[1,"heading-level"],"type":[1],"count":[2],"label":[1],"description":[1],"textMapping":[1,"text-mapping"],"selectedRating":[32]},[[16,"rating","ratingUpdated"]]]]],["p-bf1552ed",[[1,"eds-toast-manager",{"toasts":[32]}]]],["p-598f203e",[[0,"incorrect-use-of-colors"]]],["p-4185659c",[[0,"logo-variations-tabs",{"tabIndex":[2,"tab-index"]}]]],["p-3024b7cf",[[0,"correct-use-of-colors"]]],["p-b630e51a",[[1,"eds-breadcrumb",{"items":[1],"intent":[1],"parsedItems":[32],"isSmallScreen":[32],"maxVisibleItems":[32]},null,{"items":["parseItems"]}]]],["p-776b21cf",[[1,"eds-frame",{"frameLabel":[1,"frame-label"],"frameSrc":[1,"frame-src"],"urlLabel":[1,"url-label"],"errorMessage":[1,"error-message"],"url":[1],"intent":[1],"size":[1],"iframeError":[32]}]]],["p-94de9aaf",[[0,"token-ratios"]]],["p-463abb12",[[0,"token-typography"]]],["p-11efb1d1",[[1,"eds-card-tags",{"accent":[4],"tags":[16]}]]],["p-b073d78f",[[1,"eds-gauge",{"size":[2],"valueMin":[2,"value-min"],"valueMax":[2,"value-max"],"value":[2],"thickness":[2],"variant":[1]}]]],["p-19d586e6",[[0,"eds-icon-arrow-diagonal",{"class":[1]}]]],["p-d4f239d7",[[0,"eds-icon-arrow-right",{"class":[1]}]]],["p-f221eca2",[[0,"eds-icon-bluesky",{"class":[1]}]]],["p-6f9ab63c",[[0,"eds-icon-bookmark",{"class":[1]}]]],["p-c91b4eec",[[0,"eds-icon-chevron-down",{"class":[1]}]]],["p-023bc47c",[[0,"eds-icon-chevron-left",{"class":[1]}]]],["p-f2416727",[[0,"eds-icon-chevron-right",{"class":[1]}]]],["p-50f43dfd",[[0,"eds-icon-chevron-up",{"class":[1]}]]],["p-9a4b5746",[[0,"eds-icon-close",{"class":[1]}]]],["p-750e3ec8",[[0,"eds-icon-copy",{"class":[1]}]]],["p-e8f0d7fc",[[0,"eds-icon-eu",{"class":[1]}]]],["p-177103fd",[[0,"eds-icon-external",{"class":[1]}]]],["p-42295abe",[[0,"eds-icon-facebook",{"class":[1]}]]],["p-424e91b3",[[0,"eds-icon-gitlab",{"class":[1]}]]],["p-563d56c0",[[0,"eds-icon-linkedin",{"class":[1]}]]],["p-95518776",[[0,"eds-icon-loader",{"class":[1]}]]],["p-9d64d1fd",[[0,"eds-icon-mastodon",{"class":[1]}]]],["p-ab4447f6",[[0,"eds-icon-menu",{"class":[1]}]]],["p-fd85675b",[[0,"eds-icon-minus",{"class":[1]}]]],["p-99d9bb29",[[0,"eds-icon-more",{"class":[1]}]]],["p-1de8401b",[[0,"eds-icon-paper",{"class":[1]}]]],["p-4dcdd4d9",[[0,"eds-icon-plus",{"class":[1]}]]],["p-e5113509",[[0,"eds-icon-portal",{"class":[1]}]]],["p-7502b8b4",[[0,"eds-icon-private",{"class":[1]}]]],["p-43cff423",[[0,"eds-icon-public",{"class":[1]}]]],["p-321a950b",[[0,"eds-icon-search",{"class":[1]}]]],["p-38c9aee7",[[0,"eds-icon-star",{"class":[1]}]]],["p-ffccfeb6",[[0,"eds-icon-success",{"class":[1]}]]],["p-9c823b5e",[[0,"eds-icon-thumbs-down",{"class":[1]}]]],["p-45f21238",[[0,"eds-icon-thumbs-up",{"class":[1]}]]],["p-4fad9296",[[0,"eds-icon-tutorial",{"class":[1]}]]],["p-5827fd52",[[0,"eds-icon-twitter",{"class":[1]}]]],["p-4bdf1589",[[0,"eds-icon-unknown",{"class":[1]}]]],["p-158c95bc",[[0,"eds-icon-updown",{"class":[1]}]]],["p-d3bb444a",[[0,"eds-icon-user",{"class":[1]}]]],["p-5c5dfc4a",[[0,"eds-icon-youtube",{"class":[1]}]]],["p-8c0b0121",[[1,"eds-pie",{"size":[2],"slices":[1],"thickness":[2],"display":[1],"legend":[4],"colorScheme":[1,"color-scheme"]}]]],["p-1c3f1440",[[1,"eds-switch",{"checked":[1540],"disabled":[4],"labelOn":[1,"label-on"],"labelOff":[1,"label-off"]}]]],["p-0c465a1e",[[1,"eds-tooltip",{"content":[1]},[[1,"mouseenter","handleHover"]]]]],["p-5ba5708a",[[1,"logo-wrong-usage"]]],["p-77527268",[[0,"token-spacing"]]],["p-bb9af709",[[1,"eds-matomo-notice",{"heading":[1,"title"],"description":[1],"optOutMessage":[1,"opt-out-message"],"forceShow":[4,"force-show"],"showNotice":[32]},[[16,"cookies","toggleCookiesConsent"]]]]],["p-8ba5feea",[[1,"eds-rating",{"ratingType":[1,"rating-type"],"ratingCount":[2,"rating-count"],"selectedRating":[32]}]]],["p-4188643f",[[1,"eds-spinner",{"size":[1],"thickness":[1],"borderColor":[1,"border-color"],"bottomColor":[1,"bottom-color"],"background":[1],"fullscreen":[4]}]]],["p-cfccddc3",[[1,"eds-splash-screen",{"inverse":[4],"initPromise":[16],"isVisible":[32]},[[8,"hideSplash","handleHideSplash"]],{"initPromise":["watchInitPromise"]}]]],["p-940c1a08",[[1,"eds-progress-bar",{"value":[1026],"rounded":[4],"updateValue":[64]}]]],["p-14679a86",[[1,"eds-card-generic",{"cardTitle":[1,"card-title"],"url":[1],"description":[1],"image":[8],"avatar":[1],"shortAbbreviation":[1,"short-abbreviation"],"headingLevel":[1,"heading-level"],"tags":[1],"tiny":[4],"bg":[4],"withHover":[4,"with-hover"],"hierarchy":[4],"parsedImage":[32]},[[0,"parentContext","handleParentContext"]]]]],["p-33a5fa80",[[1,"logo-variations-horizontal"],[1,"logo-variations-vertical",{"orientation":[1],"type":[1]}]]],["p-b5e64725",[[1,"eds-accordion",{"heading":[1,"title"],"description":[1],"switchBg":[4,"switch-bg"],"expanded":[4],"clampText":[4,"clamp-text"],"isExpanded":[32],"panelHeight":[32],"shortContent":[32],"headerHeight":[32]}]]],["p-deb9bbed",[[1,"eds-alert",{"message":[1],"pressableLabel":[1,"pressable-label"],"pressableUrl":[1,"pressable-url"],"direction":[1],"intent":[1],"brd":[1],"withBtn":[32]}]]],["p-fe167c78",[[1,"eds-code-block",{"code":[1],"language":[1],"copied":[32]}]]],["p-9f35fe5f",[[0,"token-list",{"show":[1]}],[0,"token-radii"],[0,"token-shadows"]]],["p-c3c61a32",[[1,"eds-section-core",{"tag":[1],"sectionTitle":[1,"section-title"],"headingLevel":[1,"heading-level"]}],[0,"eds-section-heading",{"sectionTitle":[1,"section-title"],"withContainer":[4,"with-container"],"headingLevel":[1,"heading-level"],"tag":[1],"spacingLarge":[4,"spacing-large"]}]]],["p-21cb7ef6",[[0,"gradient-secondary-palette"],[0,"color-primary-palette"],[0,"color-secondary-palette",{"show":[1]}],[0,"color-support-palette"],[0,"gradient-primary-palette"],[0,"gradient-support-palette"]]],["p-66f4cdd9",[[1,"eds-card-desc",{"description":[1],"truncate":[4],"truncateLines":[1,"truncate-lines"]}],[1,"eds-card-title",{"url":[1],"titleClass":[1,"title-class"],"headingLevel":[1,"heading-level"],"externalLink":[4,"external-link"],"cardTitle":[1,"card-title"],"hierarchy":[4]}]]]]'),e))));
|
|
@@ -12,11 +12,25 @@ import { d as defineCustomElement$3 } from './eds-input-search2.js';
|
|
|
12
12
|
import { d as defineCustomElement$2 } from './eds-input-select2.js';
|
|
13
13
|
|
|
14
14
|
// utils/validators.ts
|
|
15
|
-
function validateField(name, value, type, required, maxLength) {
|
|
15
|
+
function validateField(name, value, type, required, maxLength, min, max) {
|
|
16
16
|
const errors = [];
|
|
17
17
|
if (required && !value) {
|
|
18
18
|
errors.push(`${name} is required.`);
|
|
19
19
|
}
|
|
20
|
+
if (type === 'number') {
|
|
21
|
+
const parsed = typeof value === 'number' ? value : parseFloat(value);
|
|
22
|
+
if (isNaN(parsed)) {
|
|
23
|
+
errors.push(`${name} must be a valid number.`);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
if (typeof min === 'number' && parsed < min) {
|
|
27
|
+
errors.push(`${name} must be greater than or equal to ${min}.`);
|
|
28
|
+
}
|
|
29
|
+
if (typeof max === 'number' && parsed > max) {
|
|
30
|
+
errors.push(`${name} must be less than or equal to ${max}.`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
20
34
|
if (maxLength && typeof value === 'string' && value.length > maxLength) {
|
|
21
35
|
errors.push(`${name} must be at most ${maxLength} characters.`);
|
|
22
36
|
}
|
|
@@ -110,7 +124,7 @@ isFieldVisible) {
|
|
|
110
124
|
const inputEl = findFieldElement(formEl, field.name);
|
|
111
125
|
if (inputEl) {
|
|
112
126
|
const value = inputEl.value;
|
|
113
|
-
const fieldErrors = validateField(field.name, value, field.type, field.required, field.maxlength);
|
|
127
|
+
const fieldErrors = validateField(field.name, value, field.type, field.required, field.maxlength, field.min, field.max);
|
|
114
128
|
if (fieldErrors.length > 0) {
|
|
115
129
|
errors[field.name] = fieldErrors;
|
|
116
130
|
hasError = true;
|
|
@@ -135,7 +149,7 @@ function validateInputField(field, value, formEl) {
|
|
|
135
149
|
}
|
|
136
150
|
return validateSingleBox(field.name, field.required, formEl);
|
|
137
151
|
}
|
|
138
|
-
return validateField(field.name, value, field.type, field.required, field.maxlength);
|
|
152
|
+
return validateField(field.name, value, field.type, field.required, field.maxlength, field.min, field.max);
|
|
139
153
|
}
|
|
140
154
|
|
|
141
155
|
/**
|
|
@@ -210,11 +224,12 @@ const EdsForm$1 = /*@__PURE__*/ proxyCustomElement(class EdsForm extends HTMLEle
|
|
|
210
224
|
linkElement.dispatchEvent(event);
|
|
211
225
|
}
|
|
212
226
|
isFieldVisible(field) {
|
|
213
|
-
if (!field.condition)
|
|
227
|
+
if (!field.condition)
|
|
214
228
|
return true;
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
|
|
229
|
+
const actual = this.values[field.condition.field];
|
|
230
|
+
const expected = field.condition.value;
|
|
231
|
+
// Handle loose match between booleans and strings
|
|
232
|
+
return String(actual) === String(expected);
|
|
218
233
|
}
|
|
219
234
|
validateForm() {
|
|
220
235
|
const { errors, hasError } = validateFormFields(this.parsedFields, this.formEl, this.values, (field, values) => {
|
|
@@ -301,6 +316,7 @@ const EdsForm$1 = /*@__PURE__*/ proxyCustomElement(class EdsForm extends HTMLEle
|
|
|
301
316
|
}
|
|
302
317
|
handleChange(e, field) {
|
|
303
318
|
const target = e.target;
|
|
319
|
+
let newValue = target.value;
|
|
304
320
|
if (target.type === 'checkbox') {
|
|
305
321
|
// Get the current comma separated string or default to an empty string.
|
|
306
322
|
const currentStr = this.values[field.name] || '';
|
|
@@ -316,13 +332,14 @@ const EdsForm$1 = /*@__PURE__*/ proxyCustomElement(class EdsForm extends HTMLEle
|
|
|
316
332
|
// Remove the value from the array if the checkbox is unchecked.
|
|
317
333
|
valuesArray = valuesArray.filter((item) => item !== target.value);
|
|
318
334
|
}
|
|
319
|
-
|
|
320
|
-
this.values = Object.assign(Object.assign({}, this.values), { [field.name]: valuesArray.join(',') });
|
|
335
|
+
newValue = valuesArray.join(',');
|
|
321
336
|
}
|
|
322
|
-
else {
|
|
323
|
-
|
|
324
|
-
|
|
337
|
+
else if (target.type === 'radio') {
|
|
338
|
+
if (!target.checked)
|
|
339
|
+
return; // Only react to the selected radio
|
|
340
|
+
newValue = target.value;
|
|
325
341
|
}
|
|
342
|
+
this.values = Object.assign(Object.assign({}, this.values), { [field.name]: newValue });
|
|
326
343
|
// If it’s the password field, return here for no event emission
|
|
327
344
|
if (field.name === 'password') {
|
|
328
345
|
return;
|
|
@@ -331,13 +348,16 @@ const EdsForm$1 = /*@__PURE__*/ proxyCustomElement(class EdsForm extends HTMLEle
|
|
|
331
348
|
this.form.emit({
|
|
332
349
|
event: 'change',
|
|
333
350
|
field: field.name,
|
|
334
|
-
value:
|
|
351
|
+
value: newValue,
|
|
335
352
|
message: `${field.name} updated`
|
|
336
353
|
//data: this.makeFormData()
|
|
337
354
|
});
|
|
338
355
|
}
|
|
339
356
|
handleInput(e, field) {
|
|
340
357
|
const target = e.target;
|
|
358
|
+
if (target.type === 'radio' && !target.checked)
|
|
359
|
+
return;
|
|
360
|
+
const newValue = target.value;
|
|
341
361
|
// Update the field's value in state.
|
|
342
362
|
//this.values = { ...this.values, [field.name]: target.value };
|
|
343
363
|
// Create a copy of the current errors.
|
|
@@ -357,7 +377,7 @@ const EdsForm$1 = /*@__PURE__*/ proxyCustomElement(class EdsForm extends HTMLEle
|
|
|
357
377
|
this.form.emit({
|
|
358
378
|
event: 'input',
|
|
359
379
|
field: field.name,
|
|
360
|
-
value:
|
|
380
|
+
value: newValue,
|
|
361
381
|
message: `${field.name} updated`
|
|
362
382
|
//data: this.makeFormData()
|
|
363
383
|
});
|
|
@@ -421,13 +441,13 @@ const EdsForm$1 = /*@__PURE__*/ proxyCustomElement(class EdsForm extends HTMLEle
|
|
|
421
441
|
render() {
|
|
422
442
|
const hiddenFields = this.parsedFields.filter((field) => field.type === 'hidden');
|
|
423
443
|
const otherFields = this.parsedFields.filter((field) => field.type !== 'hidden');
|
|
424
|
-
return (h("form", { key: '
|
|
444
|
+
return (h("form", { key: '98825e73a0279bed49b82caf2cc0529f30b53c70', ref: (el) => (this.formEl = el), autocomplete: "on", onSubmit: this.handleSubmit }, h("div", { key: '6b9abe2a6c2d091d57ea9ca383d9edb5d48445dc' }, h("slot", { key: '930bcd24d9b1c6ec1b29ccb1c3150897fa9d0a35' }), hiddenFields.map((field, index) => (h("eds-input", { key: index, type: "hidden", name: field.name, value: field.value }))), otherFields.map((field, index) => {
|
|
425
445
|
var _a, _b;
|
|
426
446
|
if (!this.isFieldVisible(field)) {
|
|
427
447
|
return null;
|
|
428
448
|
}
|
|
429
|
-
return (h("eds-input-field", { key: index, name: field.name, id: `${this.name}_${field.name}`, label: field.label, placeholder: field.placeholder, value: this.values[field.name] || null, type: field.type, icon: field.icon || null, disabled: field.disabled, required: field.required, maxLength: field.maxlength, hint: field.hint, link: field.link, message: field.message, error: ((_a = this.errors[field.name]) === null || _a === void 0 ? void 0 : _a.length) > 0, errorMessage: (_b = this.errors[field.name]) === null || _b === void 0 ? void 0 : _b.join('<br />'), onInput: (e) => this.handleInput(e, field), onChangeNative: (e) => this.handleChange(e, field), class: index > 0 ? 'mt-20' : '', options: field.options }));
|
|
430
|
-
})), this.formBtn && (h("div", { key: '
|
|
449
|
+
return (h("eds-input-field", { key: index, name: field.name, id: `${this.name}_${field.name}`, label: field.label, placeholder: field.placeholder, value: this.values[field.name] || null, min: field.min, max: field.max, step: field.step, type: field.type, icon: field.icon || null, disabled: field.disabled, required: field.required, maxLength: field.maxlength, hint: field.hint, link: field.link, message: field.message, error: ((_a = this.errors[field.name]) === null || _a === void 0 ? void 0 : _a.length) > 0, errorMessage: (_b = this.errors[field.name]) === null || _b === void 0 ? void 0 : _b.join('<br />'), onInput: (e) => this.handleInput(e, field), onChangeNative: (e) => this.handleChange(e, field), class: index > 0 ? 'mt-20' : '', options: field.options }));
|
|
450
|
+
})), this.formBtn && (h("div", { key: 'e0ab2f16ff4a677a2b09a1069212e374f6d6eff8', class: "mt-20" }, h("eds-button", { key: '781250d5e456a3f0176ade6e28356063c6981bb7', intent: "primary", label: this.formBtnLabel, disabled: this.isSubmitting, loading: this.isSubmitting, onClick: () => this.handleSubmit() })))));
|
|
431
451
|
}
|
|
432
452
|
get el() { return this; }
|
|
433
453
|
static get watchers() { return {
|
|
@@ -18,19 +18,52 @@ const EdsInputField = /*@__PURE__*/ proxyCustomElement(class EdsInputField exten
|
|
|
18
18
|
this.edsinput = createEvent(this, "edsinput", 7);
|
|
19
19
|
this.edschange = createEvent(this, "edschange", 7);
|
|
20
20
|
this.handleNativeInput = (ev) => {
|
|
21
|
-
var _a;
|
|
21
|
+
var _a, _b;
|
|
22
22
|
(_a = this.onInput) === null || _a === void 0 ? void 0 : _a.call(this, ev);
|
|
23
23
|
if (this.shouldEmitValue()) {
|
|
24
|
-
const
|
|
25
|
-
|
|
24
|
+
const target = ev.target;
|
|
25
|
+
let value = target.value;
|
|
26
|
+
if (this.type === 'checkbox' && ((_b = this.parsedOptions) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
27
|
+
// checkbox group case
|
|
28
|
+
const checkboxes = this.hostEl.querySelectorAll(`input[type="checkbox"][name="${this.name}"]`);
|
|
29
|
+
value = Array.from(checkboxes)
|
|
30
|
+
.filter(cb => cb.checked)
|
|
31
|
+
.map(cb => cb.value);
|
|
32
|
+
}
|
|
33
|
+
else if (this.type === 'checkbox') {
|
|
34
|
+
value = target.checked;
|
|
35
|
+
}
|
|
36
|
+
else if (this.type === 'radio') {
|
|
37
|
+
value = target.value;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
value = target.value;
|
|
41
|
+
}
|
|
42
|
+
this.edsinput.emit({ value });
|
|
26
43
|
}
|
|
27
44
|
};
|
|
28
45
|
this.handleNativeChange = (ev) => {
|
|
29
|
-
var _a;
|
|
46
|
+
var _a, _b;
|
|
30
47
|
(_a = this.onChangeNative) === null || _a === void 0 ? void 0 : _a.call(this, ev);
|
|
31
48
|
if (this.shouldEmitValue()) {
|
|
32
49
|
const target = ev.target;
|
|
33
|
-
|
|
50
|
+
let value = target.value;
|
|
51
|
+
if (this.type === 'checkbox' && ((_b = this.parsedOptions) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
52
|
+
// checkbox group case
|
|
53
|
+
const checkboxes = this.hostEl.querySelectorAll(`input[type="checkbox"][name="${this.name}"]`);
|
|
54
|
+
value = Array.from(checkboxes)
|
|
55
|
+
.filter(cb => cb.checked)
|
|
56
|
+
.map(cb => cb.value);
|
|
57
|
+
}
|
|
58
|
+
else if (this.type === 'checkbox') {
|
|
59
|
+
value = target.checked;
|
|
60
|
+
}
|
|
61
|
+
else if (this.type === 'radio') {
|
|
62
|
+
value = target.value;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
value = target.value;
|
|
66
|
+
}
|
|
34
67
|
this.edschange.emit({ value });
|
|
35
68
|
}
|
|
36
69
|
};
|
|
@@ -49,6 +82,9 @@ const EdsInputField = /*@__PURE__*/ proxyCustomElement(class EdsInputField exten
|
|
|
49
82
|
this.errorMessage = undefined;
|
|
50
83
|
this.value = undefined;
|
|
51
84
|
this.maxLength = undefined;
|
|
85
|
+
this.min = undefined;
|
|
86
|
+
this.max = undefined;
|
|
87
|
+
this.step = undefined;
|
|
52
88
|
this.options = undefined;
|
|
53
89
|
this.type = 'text';
|
|
54
90
|
this.onChangeNative = undefined;
|
|
@@ -73,22 +109,9 @@ const EdsInputField = /*@__PURE__*/ proxyCustomElement(class EdsInputField exten
|
|
|
73
109
|
return [];
|
|
74
110
|
}
|
|
75
111
|
render() {
|
|
76
|
-
const inputOpts = {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
placeholder: this.placeholder,
|
|
80
|
-
disabled: this.disabled,
|
|
81
|
-
onInput: this.handleNativeInput,
|
|
82
|
-
onChange: this.handleNativeChange,
|
|
83
|
-
type: this.type,
|
|
84
|
-
required: this.required,
|
|
85
|
-
value: this.value,
|
|
86
|
-
error: this.error,
|
|
87
|
-
icon: this.icon,
|
|
88
|
-
checked: this.checked
|
|
89
|
-
};
|
|
90
|
-
return (h("div", { key: '6f048dc1418d0738fc097d3c48148ccfdf70fbdc' }, this.type === 'checkbox' || this.type === 'radio' ? (this.parsedOptions.length > 0 ? (h("fieldset", { class: "space-y-4 mt-8" }, h("div", { class: "flex justify-between" }, this.label && (h("eds-input-label", { name: this.inputId || this.name, label: this.label, required: this.required })), this.hint && (h("p", { id: `${this.name}-hint`, class: "f-ui-05 text-lighter mt-8 ml-8" }, this.hint))), this.parsedOptions.map((option) => (h("div", { class: "flex items-center gap-x-2", key: option.value }, h("eds-input", Object.assign({}, inputOpts, { value: option.value, checked: typeof this.value === 'string' &&
|
|
91
|
-
this.value.split(',').includes(String(option.value)) })), h("eds-input-label", { name: `${this.name}-${option.value}`, label: option.label })))))) : (h("div", { class: "flex items-center gap-x-8" }, h("eds-input", Object.assign({}, inputOpts, { value: this.value, checked: this.value === 'on' })), this.label && (h("eds-input-label", { name: this.inputId || this.name, label: this.label, disabled: this.disabled, required: this.required }))))) : (h("div", null, h("div", { class: "flex justify-between" }, this.label && (h("eds-input-label", { name: this.inputId || this.name, label: this.label, disabled: this.disabled, required: this.required })), this.hint && (h("p", { id: `${this.name}-hint`, class: "f-ui-05 text-lighter mt-8 ml-8" }, this.hint))), this.type === 'select' ? (h("eds-input-select", Object.assign({}, inputOpts, { options: this.parsedOptions }))) : this.type === 'file' ? (h("input", { type: "file", id: this.inputId || this.name, name: this.name, onChange: this.onChangeNative, disabled: this.disabled, required: this.required })) : this.type === 'search' ? (h("eds-input-search", { name: "search-box" })) : this.type === 'range' ? ((() => {
|
|
112
|
+
const inputOpts = Object.assign({ name: this.name, id: this.inputId, placeholder: this.placeholder, disabled: this.disabled, onInput: this.handleNativeInput, onChange: this.handleNativeChange, type: this.type, required: this.required, value: this.value, error: this.error, icon: this.icon, checked: this.checked }, (this.type === 'number' ? { min: this.min, max: this.max, step: this.step } : {}));
|
|
113
|
+
return (h("div", { key: '48926c14240f7e26d2277729d829d98ab17f9eee' }, this.type === 'checkbox' || this.type === 'radio' ? (this.parsedOptions.length > 0 ? (h("fieldset", { class: "space-y-4 mt-8" }, h("div", { class: "flex justify-between" }, this.label && (h("eds-input-label", { name: this.inputId || this.name, label: this.label, required: this.required })), this.hint && (h("p", { id: `${this.name}-hint`, class: "f-ui-05 text-lighter mt-8 ml-8" }, this.hint))), this.parsedOptions.map((option) => (h("div", { class: "flex items-center gap-x-2", key: option.value }, h("eds-input", Object.assign({}, inputOpts, { value: option.value, checked: typeof this.value === 'string' &&
|
|
114
|
+
this.value.split(',').includes(String(option.value)) })), h("eds-input-label", { name: `${this.name}-${option.value}`, label: option.label })))))) : (h("div", { class: "flex items-center gap-x-8" }, h("eds-input", Object.assign({}, inputOpts, { value: this.value, checked: this.value === 'on' || this.checked })), this.label && (h("eds-input-label", { name: this.inputId || this.name, label: this.label, disabled: this.disabled, required: this.required }))))) : (h("div", null, h("div", { class: "flex justify-between" }, this.label && (h("eds-input-label", { name: this.inputId || this.name, label: this.label, disabled: this.disabled, required: this.required })), this.hint && (h("p", { id: `${this.name}-hint`, class: "f-ui-05 text-lighter mt-8 ml-8" }, this.hint))), this.type === 'select' ? (h("eds-input-select", Object.assign({}, inputOpts, { options: this.parsedOptions }))) : this.type === 'file' ? (h("input", { type: "file", id: this.inputId || this.name, name: this.name, onChange: this.onChangeNative, disabled: this.disabled, required: this.required })) : this.type === 'search' ? (h("eds-input-search", { name: "search-box" })) : this.type === 'range' ? ((() => {
|
|
92
115
|
var _a, _b, _c;
|
|
93
116
|
const rangeProps = {
|
|
94
117
|
name: inputOpts.name,
|
|
@@ -101,7 +124,7 @@ const EdsInputField = /*@__PURE__*/ proxyCustomElement(class EdsInputField exten
|
|
|
101
124
|
const opt = this.parsedOptions;
|
|
102
125
|
const numberValue = typeof this.value === 'string' ? parseFloat(this.value) : this.value || 0;
|
|
103
126
|
return (h("eds-input-range", Object.assign({}, rangeProps, { min: (_a = opt[0]) === null || _a === void 0 ? void 0 : _a.value, max: (_b = opt[1]) === null || _b === void 0 ? void 0 : _b.value, step: (_c = opt[2]) === null || _c === void 0 ? void 0 : _c.value, value: numberValue })));
|
|
104
|
-
})()) : (h("eds-input", Object.assign({}, inputOpts))))), h("div", { key: '
|
|
127
|
+
})()) : (h("eds-input", Object.assign({}, inputOpts))))), h("div", { key: '72b565ac1c52a56d7e563e227baf187d72f2ba21', class: "mt-4" }, h("eds-input-footer", { key: '65c40184d6fd5dfc730a46ffe8e826687c7d6f36', id: `${this.name}-footer`, name: this.name, message: this.message, "error-message": this.errorMessage, error: this.error, link: this.link }))));
|
|
105
128
|
}
|
|
106
129
|
get hostEl() { return this; }
|
|
107
130
|
static get style() { return EdsInputFieldStyle0; }
|
|
@@ -121,6 +144,9 @@ const EdsInputField = /*@__PURE__*/ proxyCustomElement(class EdsInputField exten
|
|
|
121
144
|
"errorMessage": [1, "error-message"],
|
|
122
145
|
"value": [8],
|
|
123
146
|
"maxLength": [2, "max-length"],
|
|
147
|
+
"min": [2],
|
|
148
|
+
"max": [2],
|
|
149
|
+
"step": [2],
|
|
124
150
|
"options": [1],
|
|
125
151
|
"type": [1],
|
|
126
152
|
"onChangeNative": [16],
|
|
@@ -26,6 +26,9 @@ const EdsInput = /*@__PURE__*/ proxyCustomElement(class EdsInput extends HTMLEle
|
|
|
26
26
|
this.maxLength = undefined;
|
|
27
27
|
this.options = [];
|
|
28
28
|
this.extraClass = undefined;
|
|
29
|
+
this.min = undefined;
|
|
30
|
+
this.max = undefined;
|
|
31
|
+
this.step = undefined;
|
|
29
32
|
this.innerVal = '';
|
|
30
33
|
this.maxLengthReached = false;
|
|
31
34
|
}
|
|
@@ -48,12 +51,18 @@ const EdsInput = /*@__PURE__*/ proxyCustomElement(class EdsInput extends HTMLEle
|
|
|
48
51
|
render() {
|
|
49
52
|
const withIcon = !!this.icon;
|
|
50
53
|
const describedBy = this.hasMessage || this.error ? `${this.name}-error` : '';
|
|
51
|
-
return (h("div", { key: '
|
|
54
|
+
return (h("div", { key: '8645092d1b4c53609cbac2077fd0575f7bae4aaa', class: "relative flex items-center" }, this.type === 'textarea' ? (h("textarea", { id: this.inputId || this.name, name: this.name, placeholder: this.placeholder, value: this.innerVal.toString(), required: this.required, disabled: this.disabled, class: `min-h-80 input input-textarea ${withIcon ? 'input-with-icon' : ''} ${this.error ? 'input-error' : ''} ${this.extraClass}`, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, maxlength: this.maxLength, onInput: this.handleInput, onChange: this.handleInput })) : this.type === 'select' ? (h("select", { id: this.inputId || this.name, name: this.name, required: this.required, disabled: this.disabled, class: `input input-select ${this.error ? 'input-error' : ''} ${this.extraClass}`, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, onInput: this.handleInput, onChange: this.handleInput }, this.options.map((option) => (h("option", { value: option.value, selected: option.value === this.innerVal, key: option.value }, option.label))))) : (h("input", Object.assign({ id: this.inputId || this.name, name: this.name, placeholder: this.placeholder, value: this.innerVal.toString(), required: this.required, disabled: this.disabled, type: this.type, checked: ['radio', 'checkbox'].includes(this.type) ? this.checked : undefined }, (this.type === 'number'
|
|
55
|
+
? {
|
|
56
|
+
min: this.min,
|
|
57
|
+
max: this.max,
|
|
58
|
+
step: this.step,
|
|
59
|
+
}
|
|
60
|
+
: {}), { class: `
|
|
52
61
|
${this.extraClass || ''}
|
|
53
62
|
input ${this.type === 'radio' ? 'input-radio' : this.type === 'checkbox' ? 'input-checkbox' : ''}
|
|
54
63
|
${withIcon && this.type !== 'radio' && this.type !== 'checkbox' ? 'input-icon pl-36' : ''}
|
|
55
64
|
${this.error ? 'input-error' : ''}
|
|
56
|
-
`, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, maxlength: this.maxLength, onInput: this.handleInput, onChange: this.handleInput })), this.maxLength && this.type === 'textarea' && (h("span", { key: '
|
|
65
|
+
`, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, maxlength: this.maxLength, onInput: this.handleInput, onChange: this.handleInput }))), this.maxLength && this.type === 'textarea' && (h("span", { key: '3cbf1dbffabb0cb895c6b69651933867584606d0', class: `input-counter f-ui-05 absolute bottom-8 right-8 ${this.maxLengthReached ? 'input-counter-error' : ''}` }, this.maxLength)), this.icon && (h("eds-icon-wrapper", { key: 'fb3a7051ecb72a5f425a0590dae14ee731e40a60', class: `absolute top-1/2 left-[4px] -translate-y-1/2 ${this.disabled ? 'text-lightest' : 'text-lightest'}`, icon: this.icon }))));
|
|
57
66
|
}
|
|
58
67
|
get el() { return this; }
|
|
59
68
|
static get watchers() { return {
|
|
@@ -74,6 +83,9 @@ const EdsInput = /*@__PURE__*/ proxyCustomElement(class EdsInput extends HTMLEle
|
|
|
74
83
|
"maxLength": [2, "max-length"],
|
|
75
84
|
"options": [16],
|
|
76
85
|
"extraClass": [1, "extra-class"],
|
|
86
|
+
"min": [2],
|
|
87
|
+
"max": [2],
|
|
88
|
+
"step": [2],
|
|
77
89
|
"innerVal": [32],
|
|
78
90
|
"maxLengthReached": [32]
|
|
79
91
|
}, undefined, {
|
|
@@ -189,10 +189,9 @@ const EdsTable = /*@__PURE__*/ proxyCustomElement(class EdsTable extends HTMLEle
|
|
|
189
189
|
}
|
|
190
190
|
updateColumns() {
|
|
191
191
|
var _a, _b;
|
|
192
|
-
//
|
|
192
|
+
// Grab all data‐keys from the first row (if any) as before:
|
|
193
193
|
this.columns = this.tbData.length > 0 ? Object.keys(this.tbData[0]) : [];
|
|
194
|
-
//
|
|
195
|
-
// (you can call it anything; we’ll detect it in render())
|
|
194
|
+
// Instead of pushing each action.name, add just a single “actions” column
|
|
196
195
|
if (((_b = (_a = this.parsedActions) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0 && this.tbData.length > 0) {
|
|
197
196
|
this.columns.push('actions');
|
|
198
197
|
}
|
|
@@ -219,30 +218,26 @@ const EdsTable = /*@__PURE__*/ proxyCustomElement(class EdsTable extends HTMLEle
|
|
|
219
218
|
const columnWidth = visibleColumnsCount > 0 ? Math.floor((currentContainerWidth / visibleColumnsCount) * this.divisionFactor()) : 100;
|
|
220
219
|
const paginatedRows = this.getPaginatedRows();
|
|
221
220
|
const lastPage = Math.ceil(this.totalRows / this.rowsPerPage);
|
|
222
|
-
return (h("div", { key: '
|
|
221
|
+
return (h("div", { key: 'f188b98870101f250e8515178d50763bb708ade5' }, this.searchEnabled && (h("div", { key: '96f046ad286df6cb46e9f9f6d3e45a69f90af108' }, h("eds-input-field", { key: 1, name: "search", "aria-label": "Search", type: "text", placeholder: "Search...", onInput: (event) => this.handleSearch(event) }))), h("div", { key: 'bbf27504732266f3e3ae299fcf742a653a23fdef', class: "mt-20" }, h("table", { key: 'a1c76a7b0d4c4a1382c34cf58a49896567610403', class: "block overflow-x-auto mt-6 p-0" }, h("thead", { key: 'ea7e4b5d1c48c63094a96ba5c8fb38bf8e805024' }, h("tr", { key: '6e49bc93f9678f5f6449269728ca893a88ceb51a', class: "m-0 p-0 border border-softer even:bg-inverse-softer" }, this.columns.map((col) => {
|
|
223
222
|
var _a;
|
|
224
|
-
// 3) For the “actions” column, override the header to “Actions”
|
|
225
223
|
if (col === 'actions') {
|
|
226
|
-
|
|
227
|
-
return (h("th", { class: "m-0 py-8 border border-softer f-ui-02 break-words", style: { minWidth: `${columnWidth - 4}px` } }, "Actions"));
|
|
224
|
+
return (h("th", { class: "m-0 py-8 border border-softer f-ui-02 break-words", style: { minWidth: `${columnWidth - 4}px` } }));
|
|
228
225
|
}
|
|
229
|
-
// Otherwise, render column name or action label if you do want to override:
|
|
230
226
|
if (!((_a = this.parsedConfig[col]) === null || _a === void 0 ? void 0 : _a.hidden)) {
|
|
231
227
|
return (h("th", { class: "m-0 py-8 border border-softer f-ui-02 break-words", style: { minWidth: `${columnWidth - 4}px` } }, this.capitalize(col)));
|
|
232
228
|
}
|
|
233
229
|
return null;
|
|
234
|
-
}))), h("tbody", { key: '
|
|
230
|
+
}))), h("tbody", { key: '7f09b3133241c4a19ad75c27134c04192e9dc357' }, paginatedRows.map((row) => (h("tr", { class: "m-0 p-0 border border-softer even:bg-inverse-softer" }, this.columns.map((col) => {
|
|
235
231
|
var _a;
|
|
236
232
|
if (col === 'actions') {
|
|
237
|
-
// 4) Render ALL actions inside a single <td> for this row:
|
|
238
233
|
return (h("td", { class: "text-center border border-softer m-0 f-ui-02 break-words actions-cell", style: { minWidth: `${columnWidth - 4}px` } }, h("div", { style: { display: 'flex', gap: '0.5rem', justifyContent: 'center', flexWrap: 'wrap' } }, this.parsedActions.map((act) => (h("span", { style: { whiteSpace: 'nowrap' } }, this.renderSingleActionCell(act.name, row)))))));
|
|
239
234
|
}
|
|
240
235
|
if (!((_a = this.parsedConfig[col]) === null || _a === void 0 ? void 0 : _a.hidden)) {
|
|
241
|
-
// Regular data cell
|
|
236
|
+
// Regular data cell
|
|
242
237
|
return (h("td", { class: "text-center border border-softer m-0 py-8 f-ui-2 break-words", style: { minWidth: `${columnWidth - 4}px` } }, this.renderCell(row[col], col)));
|
|
243
238
|
}
|
|
244
239
|
return null;
|
|
245
|
-
}))))))), this.shouldEnablePagination() && (h("div", { key: '
|
|
240
|
+
}))))))), this.shouldEnablePagination() && (h("div", { key: 'ceb320ba2e1cb14e4220c653c92bb2a9e8bf3593', class: "mt-20" }, h("eds-pagination", { key: '19c22566443e476742fd7f5e232c9240ecb34bec', currentPage: this.currentPage, lastPage: lastPage, perPage: this.rowsPerPage, total: this.totalRows, mode: "default" })))));
|
|
246
241
|
}
|
|
247
242
|
get hostEl() { return this; }
|
|
248
243
|
static get watchers() { return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { c as cva } from './index2.js';
|
|
3
3
|
import { d as defineCustomElement$2 } from './eds-button2.js';
|
|
4
4
|
import { d as defineCustomElement$1 } from './eds-icon-wrapper2.js';
|
|
@@ -6,7 +6,7 @@ import { d as defineCustomElement$1 } from './eds-icon-wrapper2.js';
|
|
|
6
6
|
const edsToastCss = ".relative{position:relative}.right-4{right:0.25rem}.bottom-4{bottom:0.25rem}.w-auto{width:auto}.flex{display:flex}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-4{gap:0.25rem}.f-ui-01{font-family:var(--f-ui-01-fontFamily);font-weight:var(--f-ui-01-fontWeight);font-size:var(--f-ui-01-fontSize);line-height:var(--f-ui-01-lineHeight);letter-spacing:var(--f-ui-01-letterSpacing)}.ml-8{margin-left:0.5rem}.p-12{padding:0.75rem}.rounded-lg{border-radius:16px}.shadow-md{--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),\n 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),\n var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.bg-dark{background-color:var(--grey-300)}.bg-success{background-color:var(--green-200)}.bg-error{background-color:var(--red-200)}.bg-warning{background-color:var(--yellow-200)}.text-light{color:var(--grey-700)}.text-current{color:currentColor}.text-default{color:var(--black)}";
|
|
7
7
|
const EdsToastStyle0 = edsToastCss;
|
|
8
8
|
|
|
9
|
-
const toastStyles = cva(['relative
|
|
9
|
+
const toastStyles = cva(['relative bottom-4 w-auto p-12 rounded-lg shadow-md'], {
|
|
10
10
|
variants: {
|
|
11
11
|
intent: {
|
|
12
12
|
default: 'bg-dark text-light',
|
|
@@ -24,10 +24,12 @@ const EdsToast = /*@__PURE__*/ proxyCustomElement(class EdsToast extends HTMLEle
|
|
|
24
24
|
super();
|
|
25
25
|
this.__registerHost();
|
|
26
26
|
this.__attachShadow();
|
|
27
|
+
this.toast = createEvent(this, "toast", 7);
|
|
27
28
|
/**
|
|
28
29
|
* Dismisses the toast.
|
|
29
30
|
*/
|
|
30
31
|
this.dismissToast = () => {
|
|
32
|
+
this.toast.emit({ visible: false, label: 'dismissed' });
|
|
31
33
|
this.visible = false;
|
|
32
34
|
};
|
|
33
35
|
this.message = undefined;
|