@siemens/ix 0.0.0-pr-1724-20250228145306 → 0.0.0-pr-1724-20250305102750
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/components/ix-application-header.js +1 -1
- package/components/ix-basic-navigation.js +1 -1
- package/components/ix-checkbox-group.js +3 -3
- package/components/ix-checkbox.js +1 -1
- package/components/ix-custom-field.js +3 -3
- package/components/ix-date-input.js +4 -4
- package/components/ix-drawer.js +1 -1
- package/components/ix-drawer.js.map +1 -1
- package/components/ix-field-label.js +1 -1
- package/components/ix-field-wrapper.js +1 -1
- package/components/ix-helper-text.js +1 -1
- package/components/ix-input.js +4 -4
- package/components/ix-map-navigation.js +1 -1
- package/components/ix-number-input.js +4 -4
- package/components/ix-pagination.js +3 -3
- package/components/ix-radio-group.js +3 -3
- package/components/ix-select.js +1 -1
- package/components/ix-textarea.js +4 -4
- package/components/{p-195f3939.js → p-0736463a.js} +2 -1
- package/components/p-0736463a.js.map +1 -0
- package/components/{p-3843fd6b.js → p-6bc5e411.js} +2 -2
- package/components/{p-3843fd6b.js.map → p-6bc5e411.js.map} +1 -1
- package/components/{p-d54870ca.js → p-90900090.js} +2 -2
- package/components/{p-d54870ca.js.map → p-90900090.js.map} +1 -1
- package/components/{p-cf69fbf3.js → p-9c587ccc.js} +4 -4
- package/components/{p-cf69fbf3.js.map → p-9c587ccc.js.map} +1 -1
- package/components/{p-518dfb05.js → p-bbb5e21c.js} +2 -2
- package/components/{p-518dfb05.js.map → p-bbb5e21c.js.map} +1 -1
- package/components/{p-383f1dc5.js → p-eb4725aa.js} +4 -5
- package/components/p-eb4725aa.js.map +1 -0
- package/dist/cjs/{input.util-94fe9055.js → input.util-622a9947.js} +2 -2
- package/dist/cjs/{input.util-94fe9055.js.map → input.util-622a9947.js.map} +1 -1
- package/dist/cjs/ix-application-header.cjs.entry.js +3 -4
- package/dist/cjs/ix-application-header.cjs.entry.js.map +1 -1
- package/dist/cjs/ix-checkbox-group.cjs.entry.js +1 -1
- package/dist/cjs/ix-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/ix-custom-field.cjs.entry.js +1 -1
- package/dist/cjs/ix-date-input.cjs.entry.js +2 -2
- package/dist/cjs/ix-drawer.cjs.entry.js +1 -1
- package/dist/cjs/ix-drawer.cjs.entry.js.map +1 -1
- package/dist/cjs/ix-field-label_2.cjs.entry.js +1 -1
- package/dist/cjs/ix-helper-text.cjs.entry.js +1 -1
- package/dist/cjs/ix-input.cjs.entry.js +2 -2
- package/dist/cjs/ix-number-input.cjs.entry.js +2 -2
- package/dist/cjs/ix-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/ix-select.cjs.entry.js +1 -1
- package/dist/cjs/ix-textarea.cjs.entry.js +2 -2
- package/dist/cjs/{validation-190c7a84.js → validation-f917b33d.js} +2 -1
- package/dist/cjs/validation-f917b33d.js.map +1 -0
- package/dist/collection/components/application-header/application-header.js +3 -4
- package/dist/collection/components/application-header/application-header.js.map +1 -1
- package/dist/collection/components/drawer/drawer.css +0 -1
- package/dist/collection/components/utils/input/validation.js +1 -0
- package/dist/collection/components/utils/input/validation.js.map +1 -1
- package/dist/esm/{input.util-0475b865.js → input.util-0c139612.js} +2 -2
- package/dist/esm/{input.util-0475b865.js.map → input.util-0c139612.js.map} +1 -1
- package/dist/esm/ix-application-header.entry.js +3 -4
- package/dist/esm/ix-application-header.entry.js.map +1 -1
- package/dist/esm/ix-checkbox-group.entry.js +1 -1
- package/dist/esm/ix-checkbox.entry.js +1 -1
- package/dist/esm/ix-custom-field.entry.js +1 -1
- package/dist/esm/ix-date-input.entry.js +2 -2
- package/dist/esm/ix-drawer.entry.js +1 -1
- package/dist/esm/ix-drawer.entry.js.map +1 -1
- package/dist/esm/ix-field-label_2.entry.js +1 -1
- package/dist/esm/ix-helper-text.entry.js +1 -1
- package/dist/esm/ix-input.entry.js +2 -2
- package/dist/esm/ix-number-input.entry.js +2 -2
- package/dist/esm/ix-radio-group.entry.js +1 -1
- package/dist/esm/ix-select.entry.js +1 -1
- package/dist/esm/ix-textarea.entry.js +2 -2
- package/dist/esm/{validation-8c30a49b.js → validation-0bc90f82.js} +2 -1
- package/dist/esm/validation-0bc90f82.js.map +1 -0
- package/dist/siemens-ix/{p-14600cc1.entry.js → p-00579239.entry.js} +2 -2
- package/dist/siemens-ix/{p-8fd85ca3.entry.js → p-278c0495.entry.js} +2 -2
- package/dist/siemens-ix/p-2f450062.entry.js +2 -0
- package/dist/siemens-ix/p-2f450062.entry.js.map +1 -0
- package/dist/siemens-ix/{p-52320e1a.entry.js → p-880fabd1.entry.js} +2 -2
- package/dist/siemens-ix/{p-c5908bd1.entry.js → p-a01a79dc.entry.js} +2 -2
- package/dist/siemens-ix/p-a36a5376.entry.js +2 -0
- package/dist/siemens-ix/p-a36a5376.entry.js.map +1 -0
- package/dist/siemens-ix/{p-ece2b51c.entry.js → p-a677c9b7.entry.js} +2 -2
- package/dist/siemens-ix/{p-ccd19790.entry.js → p-aeacf0af.entry.js} +2 -2
- package/dist/siemens-ix/p-bf21e93a.js +2 -0
- package/dist/siemens-ix/{p-2afe3e27.js → p-cf6ae656.js} +2 -2
- package/dist/siemens-ix/p-cf6ae656.js.map +1 -0
- package/dist/siemens-ix/{p-366ffd65.entry.js → p-db44269c.entry.js} +2 -2
- package/dist/siemens-ix/{p-67e6dbcb.entry.js → p-e366946a.entry.js} +2 -2
- package/dist/siemens-ix/{p-7d5da89d.entry.js → p-ece55b76.entry.js} +2 -2
- package/dist/siemens-ix/{p-c9373966.entry.js → p-f051760c.entry.js} +2 -2
- package/dist/siemens-ix/{p-5d0353d3.entry.js → p-f937ad39.entry.js} +2 -2
- package/dist/siemens-ix/siemens-ix.esm.js +1 -1
- package/hydrate/index.js +5 -5
- package/hydrate/index.mjs +5 -5
- package/package.json +1 -1
- package/components/p-195f3939.js.map +0 -1
- package/components/p-383f1dc5.js.map +0 -1
- package/dist/cjs/validation-190c7a84.js.map +0 -1
- package/dist/esm/validation-8c30a49b.js.map +0 -1
- package/dist/siemens-ix/p-2afe3e27.js.map +0 -1
- package/dist/siemens-ix/p-3b98cd89.entry.js +0 -2
- package/dist/siemens-ix/p-3b98cd89.entry.js.map +0 -1
- package/dist/siemens-ix/p-4b4437ec.js +0 -2
- package/dist/siemens-ix/p-e5a2d990.entry.js +0 -2
- package/dist/siemens-ix/p-e5a2d990.entry.js.map +0 -1
- /package/dist/siemens-ix/{p-14600cc1.entry.js.map → p-00579239.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-8fd85ca3.entry.js.map → p-278c0495.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-52320e1a.entry.js.map → p-880fabd1.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-c5908bd1.entry.js.map → p-a01a79dc.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-ece2b51c.entry.js.map → p-a677c9b7.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-ccd19790.entry.js.map → p-aeacf0af.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-4b4437ec.js.map → p-bf21e93a.js.map} +0 -0
- /package/dist/siemens-ix/{p-366ffd65.entry.js.map → p-db44269c.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-67e6dbcb.entry.js.map → p-e366946a.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-7d5da89d.entry.js.map → p-ece55b76.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-c9373966.entry.js.map → p-f051760c.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-5d0353d3.entry.js.map → p-f937ad39.entry.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as ApplicationHeader, d as defineCustomElement$1 } from './p-
|
|
1
|
+
import { A as ApplicationHeader, d as defineCustomElement$1 } from './p-eb4725aa.js';
|
|
2
2
|
|
|
3
3
|
const IxApplicationHeader = ApplicationHeader;
|
|
4
4
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -2,7 +2,7 @@ import { p as proxyCustomElement, H, h, d as Host } from './p-1335fdb8.js';
|
|
|
2
2
|
import { u as useContextProvider, A as ApplicationLayoutContext } from './p-10a522ca.js';
|
|
3
3
|
import { a as applicationLayoutService } from './p-fbe017b7.js';
|
|
4
4
|
import { m as menuController } from './p-c146af8e.js';
|
|
5
|
-
import { d as defineCustomElement$7 } from './p-
|
|
5
|
+
import { d as defineCustomElement$7 } from './p-eb4725aa.js';
|
|
6
6
|
import { d as defineCustomElement$6 } from './p-0b95bd20.js';
|
|
7
7
|
import { d as defineCustomElement$5 } from './p-afca111c.js';
|
|
8
8
|
import { d as defineCustomElement$4 } from './p-52986d0e.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h, d as Host } from './p-1335fdb8.js';
|
|
2
|
-
import { H as HookValidationLifecycle } from './p-
|
|
3
|
-
import { d as defineCustomElement$5 } from './p-
|
|
4
|
-
import { d as defineCustomElement$4 } from './p-
|
|
2
|
+
import { H as HookValidationLifecycle } from './p-0736463a.js';
|
|
3
|
+
import { d as defineCustomElement$5 } from './p-90900090.js';
|
|
4
|
+
import { d as defineCustomElement$4 } from './p-bbb5e21c.js';
|
|
5
5
|
import { d as defineCustomElement$3 } from './p-034cb9b3.js';
|
|
6
6
|
import { d as defineCustomElement$2 } from './p-b08c1f61.js';
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, e as createEvent, h, d as Host } from './p-1335fdb8.js';
|
|
2
|
-
import { H as HookValidationLifecycle } from './p-
|
|
2
|
+
import { H as HookValidationLifecycle } from './p-0736463a.js';
|
|
3
3
|
import { m as makeRef } from './p-ce563a48.js';
|
|
4
4
|
import { a as a11yBoolean } from './p-5fe87e71.js';
|
|
5
5
|
import { d as defineCustomElement$2 } from './p-b08c1f61.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h, d as Host } from './p-1335fdb8.js';
|
|
2
|
-
import { H as HookValidationLifecycle } from './p-
|
|
3
|
-
import { d as defineCustomElement$5 } from './p-
|
|
4
|
-
import { d as defineCustomElement$4 } from './p-
|
|
2
|
+
import { H as HookValidationLifecycle } from './p-0736463a.js';
|
|
3
|
+
import { d as defineCustomElement$5 } from './p-90900090.js';
|
|
4
|
+
import { d as defineCustomElement$4 } from './p-bbb5e21c.js';
|
|
5
5
|
import { d as defineCustomElement$3 } from './p-034cb9b3.js';
|
|
6
6
|
import { d as defineCustomElement$2 } from './p-b08c1f61.js';
|
|
7
7
|
|
|
@@ -2,15 +2,15 @@ import { p as proxyCustomElement, H, e as createEvent, h, d as Host } from './p-
|
|
|
2
2
|
import { g as iconCalendar } from './p-f3850b4f.js';
|
|
3
3
|
import { D as DateTime_1 } from './p-f5e574da.js';
|
|
4
4
|
import { d as dropdownController } from './p-7aa26727.js';
|
|
5
|
-
import { a as addDisposableChangesAndVisibilityObservers, b as adjustPaddingForStartAndEnd, S as SlotEnd, c as SlotStart } from './p-
|
|
6
|
-
import { H as HookValidationLifecycle, c as createClassMutationObserver } from './p-
|
|
5
|
+
import { a as addDisposableChangesAndVisibilityObservers, b as adjustPaddingForStartAndEnd, S as SlotEnd, c as SlotStart } from './p-6bc5e411.js';
|
|
6
|
+
import { H as HookValidationLifecycle, c as createClassMutationObserver } from './p-0736463a.js';
|
|
7
7
|
import { m as makeRef } from './p-ce563a48.js';
|
|
8
8
|
import { d as defineCustomElement$b } from './p-16bd09ff.js';
|
|
9
9
|
import { d as defineCustomElement$a } from './p-cedd3dfb.js';
|
|
10
10
|
import { d as defineCustomElement$9 } from './p-a1f78828.js';
|
|
11
11
|
import { d as defineCustomElement$8 } from './p-0b95bd20.js';
|
|
12
|
-
import { d as defineCustomElement$7 } from './p-
|
|
13
|
-
import { d as defineCustomElement$6 } from './p-
|
|
12
|
+
import { d as defineCustomElement$7 } from './p-90900090.js';
|
|
13
|
+
import { d as defineCustomElement$6 } from './p-bbb5e21c.js';
|
|
14
14
|
import { d as defineCustomElement$5 } from './p-afca111c.js';
|
|
15
15
|
import { d as defineCustomElement$4 } from './p-79bcd614.js';
|
|
16
16
|
import { d as defineCustomElement$3 } from './p-034cb9b3.js';
|
package/components/ix-drawer.js
CHANGED
|
@@ -3,7 +3,7 @@ import { a as anime } from './p-71206084.js';
|
|
|
3
3
|
import { d as defineCustomElement$3 } from './p-afca111c.js';
|
|
4
4
|
import { d as defineCustomElement$2 } from './p-79bcd614.js';
|
|
5
5
|
|
|
6
|
-
const drawerCss = ":host{top:0;right:0;box-shadow:var(--theme-box-shadow-level-3);display:block;position:absolute;justify-content:flex-start;align-items:center;opacity:0;max-height:100vh;min-height:1.5rem;background-color:var(--theme-color-1);border-radius:0.25rem
|
|
6
|
+
const drawerCss = ":host{top:0;right:0;box-shadow:var(--theme-box-shadow-level-3);display:block;position:absolute;justify-content:flex-start;align-items:center;opacity:0;max-height:100vh;min-height:1.5rem;background-color:var(--theme-color-1);border-radius:0.25rem}:host *,:host *::after,:host *::before{box-sizing:border-box}:host ::-webkit-scrollbar-button{display:none}@-moz-document url-prefix(){:host *{scrollbar-color:var(--theme-scrollbar-thumb--background) var(--theme-scrollbar-track--background);scrollbar-width:thin}}:host ::-webkit-scrollbar{width:0.5rem;height:0.5rem}:host ::-webkit-scrollbar-track{border-radius:5px;background:var(--theme-scrollbar-track--background)}:host ::-webkit-scrollbar-track:hover{background:var(--theme-scrollbar-track--background--hover)}:host ::-webkit-scrollbar-thumb{border-radius:5px;background:var(--theme-scrollbar-thumb--background)}:host ::-webkit-scrollbar-thumb:hover{background:var(--theme-scrollbar-thumb--background--hover)}:host ::-webkit-scrollbar-corner{display:none}:host .drawer-container{z-index:100}:host .header{display:flex;position:relative;align-items:center;justify-content:flex-end;padding:0.5rem;width:100%;order:1}:host .header .header-content{flex-grow:1;margin-right:1rem}:host .content{position:relative;flex:1;order:2;height:100%;width:100%;overflow-y:auto}:host(.display-none){display:none}";
|
|
7
7
|
const IxDrawerStyle0 = drawerCss;
|
|
8
8
|
|
|
9
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B,EACD,KAAK,EAAE;gBACL,KAAK,EAAE,GAAG;gBACV,WAAW,EAAE,GAAG,IAAI,CAAC,QAAQ,KAAK;gBAClC,MAAM,EAAE,IAAI,CAAC,UAAU,GAAG,MAAM,GAAG,MAAM;gBACzC,QAAQ,EAAE,QAAQ;aACnB,EACD,GAAG,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,UAAU,GAAG,EAAiB,CAAC,iBACtC,WAAW,EACvB,EAAE,EAAC,eAAe,IAElB,4DACE,KAAK,EAAE;gBACL,KAAK,EACH,IAAI,CAAC,KAAK,KAAK,MAAM;sBACjB,MAAM;sBACN,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK;aACnD,IAED,4DAAK,KAAK,EAAC,QAAQ,IACjB,4DAAK,KAAK,EAAC,gBAAgB,IACzB,6DAAM,IAAI,EAAC,QAAQ,GAAQ,CACvB,EACN,uEACE,KAAK,EAAC,cAAc,EACpB,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI,CAAC,WAAW,GAAG,OAAO,GAAG,MAAM;aAC7C,EACD,IAAI,EAAE,OAAO,EACb,IAAI,EAAC,IAAI,EACT,KAAK,QACL,OAAO,EAAE,MAAM,IAAI,CAAC,cAAc,EAAE,iBACxB,cAAc,GACV,CACd,EACN,4DACE,KAAK,EAAC,SAAS,EACf,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI,CAAC,WAAW,GAAG,OAAO,GAAG,MAAM;aAC7C,IAED,8DAAa,CACT,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;AAjLc,eAAQ,GAAG,GAAH,CAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/drawer/drawer.scss?tag=ix-drawer&encapsulation=shadow","src/components/drawer/drawer.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n@import 'mixins/shadow-dom/component';\n@import 'mixins/shadows';\n@import 'common-variables';\n\n:host {\n @include ix-component;\n\n top: 0;\n right: 0;\n @include box-shadow(3);\n\n display: block;\n position: absolute;\n justify-content: flex-start;\n align-items: center;\n opacity: 0;\n\n max-height: 100vh;\n min-height: $large-space;\n background-color: var(--theme-color-1);\n border-radius: $default-border-radius;\n\n transition: all var(--theme-medium-time) ease-out;\n\n .drawer-container {\n z-index: 100;\n }\n\n .header {\n display: flex;\n position: relative;\n align-items: center;\n justify-content: flex-end;\n padding: 0.5rem;\n width: 100%;\n order: 1;\n\n .header-content {\n flex-grow: 1;\n margin-right: $default-space;\n }\n }\n\n .content {\n position: relative;\n flex: 1;\n order: 2;\n height: 100%;\n width: 100%;\n overflow-y: auto;\n }\n}\n\n:host(.display-none) {\n display: none;\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport anime from 'animejs';\n\n@Component({\n tag: 'ix-drawer',\n styleUrl: 'drawer.scss',\n shadow: true,\n})\nexport class Drawer {\n /**\n * Show or hide the drawer\n */\n @Prop({ mutable: true }) show = false;\n\n /**\n * Fired in case of an outside click during drawer showed state\n */\n @Prop() closeOnClickOutside = true;\n\n /**\n * Render the drawer with maximum height\n */\n @Prop() fullHeight = false;\n\n /**\n * Min width interpreted as REM\n */\n @Prop() minWidth = 16;\n\n /**\n * Max width interpreted as REM\n */\n @Prop() maxWidth = 28;\n\n /**\n * Width interpreted as REM if not set to 'auto'\n */\n @Prop() width: number | 'auto' = this.minWidth;\n\n /**\n * Fire event after drawer is open\n */\n @Event() open!: EventEmitter;\n\n /**\n * Fire event after drawer is close\n */\n @Event() drawerClose!: EventEmitter;\n\n toggle = false;\n\n private static duration = 300;\n private callback = this.clickedOutside.bind(this);\n private divElement?: HTMLElement;\n\n @State() showContent = true;\n\n @Watch('show')\n onShowChanged(newValue: boolean, oldValue?: boolean) {\n if (newValue === oldValue) {\n return;\n }\n\n this.toggleDrawer(newValue);\n }\n\n /**\n * Toggle or define show state of drawer\n * @param show Overwrite toggle state with boolean\n */\n @Method()\n async toggleDrawer(show?: boolean): Promise<void> {\n show = show ?? !this.show;\n\n if (show) {\n const { defaultPrevented } = this.open.emit();\n\n if (defaultPrevented) {\n return;\n }\n\n this.show = true;\n if (!this.toggle && this.divElement) {\n this.slideInRight(this.divElement);\n setTimeout(() => {\n window.addEventListener('mousedown', this.callback);\n }, Drawer.duration);\n }\n } else {\n const { defaultPrevented } = this.drawerClose.emit();\n\n if (defaultPrevented) {\n return;\n }\n\n this.show = false;\n\n if (this.toggle && this.divElement) {\n this.slideOutRight(this.divElement);\n }\n\n window.removeEventListener('mousedown', this.callback);\n }\n\n this.toggle = this.show;\n\n return Promise.resolve();\n }\n\n private onCloseClicked() {\n this.toggleDrawer(false);\n }\n\n private clickedOutside(evt: any) {\n if (!this.closeOnClickOutside) {\n return;\n }\n\n const target = evt.target;\n const closestElement = target.closest('#div-container');\n const btn = target.closest('#drawer-btn');\n\n if (\n evt.target.type !== 'button' &&\n closestElement !== this.divElement &&\n target !== btn\n ) {\n this.show = false;\n }\n }\n\n private getConstrainedWidth(width: number) {\n return Math.min(Math.max(width, this.minWidth), this.maxWidth);\n }\n\n private slideOutRight(el: HTMLElement) {\n const initialWidth = `${this.getConstrainedWidth(\n this.width === 'auto' ? this.minWidth : this.width\n )}rem`;\n\n anime({\n targets: el,\n duration: Drawer.duration,\n width: [initialWidth, 0],\n opacity: [1, 0],\n easing: 'easeInSine',\n complete: () => {\n el.classList.add('display-none');\n },\n });\n }\n\n private slideInRight(el: HTMLElement) {\n const targetWidth = `${this.getConstrainedWidth(\n this.width === 'auto' ? this.minWidth : this.width\n )}rem`;\n\n anime({\n targets: el,\n duration: Drawer.duration,\n width: [0, targetWidth],\n opacity: [0, 1],\n easing: 'easeOutSine',\n begin: () => {\n el.classList.remove('display-none');\n },\n complete: () => {\n this.showContent = true;\n },\n });\n }\n\n componentDidLoad() {\n this.toggleDrawer(this.show);\n }\n\n render() {\n return (\n <Host\n class={{\n 'drawer-container': true,\n 'display-none': true,\n }}\n style={{\n width: '0',\n 'max-width': `${this.maxWidth}rem`,\n height: this.fullHeight ? '100%' : 'auto',\n overflow: 'hidden',\n }}\n ref={(el) => (this.divElement = el as HTMLElement)}\n data-testid=\"container\"\n id=\"div-container\"\n >\n <div\n style={{\n width:\n this.width === 'auto'\n ? 'auto'\n : `${this.getConstrainedWidth(this.width)}rem`,\n }}\n >\n <div class=\"header\">\n <div class=\"header-content\">\n <slot name=\"header\"></slot>\n </div>\n <ix-icon-button\n class=\"close-button\"\n style={{\n display: this.showContent ? 'block' : 'none',\n }}\n icon={'close'}\n size=\"24\"\n ghost\n onClick={() => this.onCloseClicked()}\n data-testid=\"close-button\"\n ></ix-icon-button>\n </div>\n <div\n class=\"content\"\n style={{\n display: this.showContent ? 'block' : 'none',\n }}\n >\n <slot></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"ix-drawer.js","mappings":";;;;;AAAA,MAAM,SAAS,GAAG,o0CAAo0C,CAAC;AACv1C,uBAAe,SAAS;;MC0BX,MAAM;IALnB;;;;;;;;;QAS2B,SAAI,GAAG,KAAK,CAAC;;;;QAK9B,wBAAmB,GAAG,IAAI,CAAC;;;;QAK3B,eAAU,GAAG,KAAK,CAAC;;;;QAKnB,aAAQ,GAAG,EAAE,CAAC;;;;QAKd,aAAQ,GAAG,EAAE,CAAC;;;;QAKd,UAAK,GAAoB,IAAI,CAAC,QAAQ,CAAC;QAY/C,WAAM,GAAG,KAAK,CAAC;QAGP,aAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAGzC,gBAAW,GAAG,IA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,GAAQ,CACvB,EACN,uEACE,KAAK,EAAC,cAAc,EACpB,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI,CAAC,WAAW,GAAG,OAAO,GAAG,MAAM;aAC7C,EACD,IAAI,EAAE,OAAO,EACb,IAAI,EAAC,IAAI,EACT,KAAK,QACL,OAAO,EAAE,MAAM,IAAI,CAAC,cAAc,EAAE,iBACxB,cAAc,GACV,CACd,EACN,4DACE,KAAK,EAAC,SAAS,EACf,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI,CAAC,WAAW,GAAG,OAAO,GAAG,MAAM;aAC7C,IAED,8DAAa,CACT,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;AAjLc,eAAQ,GAAG,GAAH,CAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/drawer/drawer.scss?tag=ix-drawer&encapsulation=shadow","src/components/drawer/drawer.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n@import 'mixins/shadow-dom/component';\n@import 'mixins/shadows';\n@import 'common-variables';\n\n:host {\n @include ix-component;\n\n top: 0;\n right: 0;\n @include box-shadow(3);\n\n display: block;\n position: absolute;\n justify-content: flex-start;\n align-items: center;\n opacity: 0;\n\n max-height: 100vh;\n min-height: $large-space;\n background-color: var(--theme-color-1);\n border-radius: $default-border-radius;\n\n .drawer-container {\n z-index: 100;\n }\n\n .header {\n display: flex;\n position: relative;\n align-items: center;\n justify-content: flex-end;\n padding: 0.5rem;\n width: 100%;\n order: 1;\n\n .header-content {\n flex-grow: 1;\n margin-right: $default-space;\n }\n }\n\n .content {\n position: relative;\n flex: 1;\n order: 2;\n height: 100%;\n width: 100%;\n overflow-y: auto;\n }\n}\n\n:host(.display-none) {\n display: none;\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport anime from 'animejs';\n\n@Component({\n tag: 'ix-drawer',\n styleUrl: 'drawer.scss',\n shadow: true,\n})\nexport class Drawer {\n /**\n * Show or hide the drawer\n */\n @Prop({ mutable: true }) show = false;\n\n /**\n * Fired in case of an outside click during drawer showed state\n */\n @Prop() closeOnClickOutside = true;\n\n /**\n * Render the drawer with maximum height\n */\n @Prop() fullHeight = false;\n\n /**\n * Min width interpreted as REM\n */\n @Prop() minWidth = 16;\n\n /**\n * Max width interpreted as REM\n */\n @Prop() maxWidth = 28;\n\n /**\n * Width interpreted as REM if not set to 'auto'\n */\n @Prop() width: number | 'auto' = this.minWidth;\n\n /**\n * Fire event after drawer is open\n */\n @Event() open!: EventEmitter;\n\n /**\n * Fire event after drawer is close\n */\n @Event() drawerClose!: EventEmitter;\n\n toggle = false;\n\n private static duration = 300;\n private callback = this.clickedOutside.bind(this);\n private divElement?: HTMLElement;\n\n @State() showContent = true;\n\n @Watch('show')\n onShowChanged(newValue: boolean, oldValue?: boolean) {\n if (newValue === oldValue) {\n return;\n }\n\n this.toggleDrawer(newValue);\n }\n\n /**\n * Toggle or define show state of drawer\n * @param show Overwrite toggle state with boolean\n */\n @Method()\n async toggleDrawer(show?: boolean): Promise<void> {\n show = show ?? !this.show;\n\n if (show) {\n const { defaultPrevented } = this.open.emit();\n\n if (defaultPrevented) {\n return;\n }\n\n this.show = true;\n if (!this.toggle && this.divElement) {\n this.slideInRight(this.divElement);\n setTimeout(() => {\n window.addEventListener('mousedown', this.callback);\n }, Drawer.duration);\n }\n } else {\n const { defaultPrevented } = this.drawerClose.emit();\n\n if (defaultPrevented) {\n return;\n }\n\n this.show = false;\n\n if (this.toggle && this.divElement) {\n this.slideOutRight(this.divElement);\n }\n\n window.removeEventListener('mousedown', this.callback);\n }\n\n this.toggle = this.show;\n\n return Promise.resolve();\n }\n\n private onCloseClicked() {\n this.toggleDrawer(false);\n }\n\n private clickedOutside(evt: any) {\n if (!this.closeOnClickOutside) {\n return;\n }\n\n const target = evt.target;\n const closestElement = target.closest('#div-container');\n const btn = target.closest('#drawer-btn');\n\n if (\n evt.target.type !== 'button' &&\n closestElement !== this.divElement &&\n target !== btn\n ) {\n this.show = false;\n }\n }\n\n private getConstrainedWidth(width: number) {\n return Math.min(Math.max(width, this.minWidth), this.maxWidth);\n }\n\n private slideOutRight(el: HTMLElement) {\n const initialWidth = `${this.getConstrainedWidth(\n this.width === 'auto' ? this.minWidth : this.width\n )}rem`;\n\n anime({\n targets: el,\n duration: Drawer.duration,\n width: [initialWidth, 0],\n opacity: [1, 0],\n easing: 'easeInSine',\n complete: () => {\n el.classList.add('display-none');\n },\n });\n }\n\n private slideInRight(el: HTMLElement) {\n const targetWidth = `${this.getConstrainedWidth(\n this.width === 'auto' ? this.minWidth : this.width\n )}rem`;\n\n anime({\n targets: el,\n duration: Drawer.duration,\n width: [0, targetWidth],\n opacity: [0, 1],\n easing: 'easeOutSine',\n begin: () => {\n el.classList.remove('display-none');\n },\n complete: () => {\n this.showContent = true;\n },\n });\n }\n\n componentDidLoad() {\n this.toggleDrawer(this.show);\n }\n\n render() {\n return (\n <Host\n class={{\n 'drawer-container': true,\n 'display-none': true,\n }}\n style={{\n width: '0',\n 'max-width': `${this.maxWidth}rem`,\n height: this.fullHeight ? '100%' : 'auto',\n overflow: 'hidden',\n }}\n ref={(el) => (this.divElement = el as HTMLElement)}\n data-testid=\"container\"\n id=\"div-container\"\n >\n <div\n style={{\n width:\n this.width === 'auto'\n ? 'auto'\n : `${this.getConstrainedWidth(this.width)}rem`,\n }}\n >\n <div class=\"header\">\n <div class=\"header-content\">\n <slot name=\"header\"></slot>\n </div>\n <ix-icon-button\n class=\"close-button\"\n style={{\n display: this.showContent ? 'block' : 'none',\n }}\n icon={'close'}\n size=\"24\"\n ghost\n onClick={() => this.onCloseClicked()}\n data-testid=\"close-button\"\n ></ix-icon-button>\n </div>\n <div\n class=\"content\"\n style={{\n display: this.showContent ? 'block' : 'none',\n }}\n >\n <slot></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h, d as Host } from './p-1335fdb8.js';
|
|
2
|
-
import { c as createClassMutationObserver, a as checkFieldClasses } from './p-
|
|
2
|
+
import { c as createClassMutationObserver, a as checkFieldClasses } from './p-0736463a.js';
|
|
3
3
|
import { r as renderHelperText } from './p-6abf0b6d.js';
|
|
4
4
|
import { d as defineCustomElement$2 } from './p-b08c1f61.js';
|
|
5
5
|
|
package/components/ix-input.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, e as createEvent, h, d as Host } from './p-1335fdb8.js';
|
|
2
2
|
import { m as iconEye, n as iconEyeCancelled } from './p-f3850b4f.js';
|
|
3
|
-
import { H as HookValidationLifecycle } from './p-
|
|
3
|
+
import { H as HookValidationLifecycle } from './p-0736463a.js';
|
|
4
4
|
import { m as makeRef } from './p-ce563a48.js';
|
|
5
|
-
import { m as mapValidationResult, a as addDisposableChangesAndVisibilityObservers, b as adjustPaddingForStartAndEnd, c as SlotStart, I as InputElement, d as checkAllowedKeys, o as onInputBlur, S as SlotEnd, g as getAriaAttributesForInput } from './p-
|
|
6
|
-
import { d as defineCustomElement$7 } from './p-
|
|
7
|
-
import { d as defineCustomElement$6 } from './p-
|
|
5
|
+
import { m as mapValidationResult, a as addDisposableChangesAndVisibilityObservers, b as adjustPaddingForStartAndEnd, c as SlotStart, I as InputElement, d as checkAllowedKeys, o as onInputBlur, S as SlotEnd, g as getAriaAttributesForInput } from './p-6bc5e411.js';
|
|
6
|
+
import { d as defineCustomElement$7 } from './p-90900090.js';
|
|
7
|
+
import { d as defineCustomElement$6 } from './p-bbb5e21c.js';
|
|
8
8
|
import { d as defineCustomElement$5 } from './p-afca111c.js';
|
|
9
9
|
import { d as defineCustomElement$4 } from './p-79bcd614.js';
|
|
10
10
|
import { d as defineCustomElement$3 } from './p-034cb9b3.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, e as createEvent, h, d as Host } from './p-1335fdb8.js';
|
|
2
2
|
import { a as anime } from './p-71206084.js';
|
|
3
3
|
import { u as useContextProvider, A as ApplicationLayoutContext } from './p-10a522ca.js';
|
|
4
|
-
import { d as defineCustomElement$8 } from './p-
|
|
4
|
+
import { d as defineCustomElement$8 } from './p-eb4725aa.js';
|
|
5
5
|
import { d as defineCustomElement$7 } from './p-0b95bd20.js';
|
|
6
6
|
import { d as defineCustomElement$6 } from './p-afca111c.js';
|
|
7
7
|
import { d as defineCustomElement$5 } from './p-7de0e09c.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, e as createEvent, h, d as Host } from './p-1335fdb8.js';
|
|
2
2
|
import { o as iconMinus, p as iconPlus } from './p-f3850b4f.js';
|
|
3
|
-
import { H as HookValidationLifecycle } from './p-
|
|
3
|
+
import { H as HookValidationLifecycle } from './p-0736463a.js';
|
|
4
4
|
import { m as makeRef } from './p-ce563a48.js';
|
|
5
|
-
import { m as mapValidationResult, a as addDisposableChangesAndVisibilityObservers, b as adjustPaddingForStartAndEnd, c as SlotStart, I as InputElement, d as checkAllowedKeys, o as onInputBlur, S as SlotEnd, e as checkInternalValidity } from './p-
|
|
6
|
-
import { d as defineCustomElement$7 } from './p-
|
|
7
|
-
import { d as defineCustomElement$6 } from './p-
|
|
5
|
+
import { m as mapValidationResult, a as addDisposableChangesAndVisibilityObservers, b as adjustPaddingForStartAndEnd, c as SlotStart, I as InputElement, d as checkAllowedKeys, o as onInputBlur, S as SlotEnd, e as checkInternalValidity } from './p-6bc5e411.js';
|
|
6
|
+
import { d as defineCustomElement$7 } from './p-90900090.js';
|
|
7
|
+
import { d as defineCustomElement$6 } from './p-bbb5e21c.js';
|
|
8
8
|
import { d as defineCustomElement$5 } from './p-afca111c.js';
|
|
9
9
|
import { d as defineCustomElement$4 } from './p-79bcd614.js';
|
|
10
10
|
import { d as defineCustomElement$3 } from './p-034cb9b3.js';
|
|
@@ -3,11 +3,11 @@ import { B as BaseButton } from './p-c64938b0.js';
|
|
|
3
3
|
import { a as a11yBoolean } from './p-5fe87e71.js';
|
|
4
4
|
import { d as defineCustomElement$c } from './p-0b95bd20.js';
|
|
5
5
|
import { d as defineCustomElement$b } from './p-2f0b446c.js';
|
|
6
|
-
import { d as defineCustomElement$a } from './p-
|
|
7
|
-
import { d as defineCustomElement$9 } from './p-
|
|
6
|
+
import { d as defineCustomElement$a } from './p-90900090.js';
|
|
7
|
+
import { d as defineCustomElement$9 } from './p-bbb5e21c.js';
|
|
8
8
|
import { d as defineCustomElement$8 } from './p-650a4e29.js';
|
|
9
9
|
import { d as defineCustomElement$7 } from './p-afca111c.js';
|
|
10
|
-
import { d as defineCustomElement$6 } from './p-
|
|
10
|
+
import { d as defineCustomElement$6 } from './p-9c587ccc.js';
|
|
11
11
|
import { d as defineCustomElement$5 } from './p-b57fae9c.js';
|
|
12
12
|
import { d as defineCustomElement$4 } from './p-79bcd614.js';
|
|
13
13
|
import { d as defineCustomElement$3 } from './p-034cb9b3.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, e as createEvent, h, d as Host } from './p-1335fdb8.js';
|
|
2
|
-
import { H as HookValidationLifecycle } from './p-
|
|
3
|
-
import { d as defineCustomElement$5 } from './p-
|
|
4
|
-
import { d as defineCustomElement$4 } from './p-
|
|
2
|
+
import { H as HookValidationLifecycle } from './p-0736463a.js';
|
|
3
|
+
import { d as defineCustomElement$5 } from './p-90900090.js';
|
|
4
|
+
import { d as defineCustomElement$4 } from './p-bbb5e21c.js';
|
|
5
5
|
import { d as defineCustomElement$3 } from './p-034cb9b3.js';
|
|
6
6
|
import { d as defineCustomElement$2 } from './p-b08c1f61.js';
|
|
7
7
|
|
package/components/ix-select.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, e as createEvent, h, d as Host } from './p-1335fdb8.js';
|
|
2
|
-
import { H as HookValidationLifecycle } from './p-
|
|
2
|
+
import { H as HookValidationLifecycle } from './p-0736463a.js';
|
|
3
3
|
import { m as makeRef } from './p-ce563a48.js';
|
|
4
|
-
import { m as mapValidationResult, T as TextareaElement, o as onInputBlur } from './p-
|
|
5
|
-
import { d as defineCustomElement$5 } from './p-
|
|
6
|
-
import { d as defineCustomElement$4 } from './p-
|
|
4
|
+
import { m as mapValidationResult, T as TextareaElement, o as onInputBlur } from './p-6bc5e411.js';
|
|
5
|
+
import { d as defineCustomElement$5 } from './p-90900090.js';
|
|
6
|
+
import { d as defineCustomElement$4 } from './p-bbb5e21c.js';
|
|
7
7
|
import { d as defineCustomElement$3 } from './p-034cb9b3.js';
|
|
8
8
|
import { d as defineCustomElement$2 } from './p-b08c1f61.js';
|
|
9
9
|
|
|
@@ -103,6 +103,7 @@ function HookValidationLifecycle(options) {
|
|
|
103
103
|
if (host && checkIfRequiredFunction) {
|
|
104
104
|
host.removeEventListener('valueChange', checkIfRequiredFunction);
|
|
105
105
|
host.removeEventListener('ixBlur', checkIfRequiredFunction);
|
|
106
|
+
checkIfRequiredFunction = null;
|
|
106
107
|
}
|
|
107
108
|
return disconnectedCallback === null || disconnectedCallback === void 0 ? void 0 : disconnectedCallback.call(this);
|
|
108
109
|
};
|
|
@@ -111,4 +112,4 @@ function HookValidationLifecycle(options) {
|
|
|
111
112
|
|
|
112
113
|
export { HookValidationLifecycle as H, checkFieldClasses as a, createClassMutationObserver as c, shouldSuppressInternalValidation as s };
|
|
113
114
|
|
|
114
|
-
//# sourceMappingURL=p-
|
|
115
|
+
//# sourceMappingURL=p-0736463a.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-0736463a.js","mappings":";;AAAA;;;;;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BAAqB,EAAE;gBACjC,qBAAqB,CAAC,OAAO,EAAE,CAAC;gBAChC,qBAAqB,GAAG,IAAI,CAAC;aAC9B;YAED,IAAI,IAAI,IAAI,uBAAuB,EAAE;gBACnC,IAAI,CAAC,mBAAmB,CAAC,aAAa,EAAE,uBAAuB,CAAC,CAAC;gBACjE,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,uBAAuB,CAAC,CAAC;gBAC5D,uBAAuB,GAAG,IAAI,CAAC;aAChC;YAED,OAAO,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,IAAI,CAAC,IAAI,CAAC,CAAC;SACzC,CAAC;KACH,CAAC;AACJ;;;;","names":[],"sources":["src/components/utils/input/validation.ts"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getElement } from '@stencil/core';\nimport { HTMLIxFormComponentElement, IxFormComponent } from '.';\nimport { IxComponent } from '../internal';\n\nexport type ClassMutationObserver = {\n destroy: () => void;\n};\n\nexport async function isTouched<T>(host: IxFormComponent<T>) {\n if (typeof host.isTouched === 'function') {\n return host.isTouched();\n }\n}\n\nexport async function shouldSuppressInternalValidation<T>(\n host: IxFormComponent<T>\n) {\n if (\n host.getAssociatedFormElement &&\n typeof host.getAssociatedFormElement === 'function'\n ) {\n const form = await host.getAssociatedFormElement();\n\n if (!form) {\n return false;\n }\n\n return form.noValidate;\n }\n\n return false;\n}\n\nexport function createClassMutationObserver(\n element: HTMLElement,\n callback: () => void,\n options?: {\n includeChildren?: boolean;\n }\n): ClassMutationObserver {\n const observer = new MutationObserver(callback);\n observer.observe(element, {\n subtree: options?.includeChildren,\n childList: options?.includeChildren,\n attributes: true,\n attributeFilter: ['class'],\n });\n\n return {\n destroy() {\n observer.disconnect();\n },\n };\n}\n\nexport type ValidationResultProperty =\n | 'isInvalid'\n | 'isInvalidByRequired'\n | 'isValid'\n | 'isInfo'\n | 'isWarning';\nexport type ValidationResults = Record<ValidationResultProperty, boolean>;\n\nfunction containsClass(\n hostElement: HTMLIxFormComponentElement<unknown>,\n className: string,\n includeChildren: boolean\n) {\n return (\n hostElement.classList.contains(`${className}`) ||\n (includeChildren ? !!hostElement.querySelector(`.${className}`) : false)\n );\n}\n\nexport function checkFieldClasses(\n hostElement: HTMLIxFormComponentElement<unknown>,\n includeChildren = false\n): ValidationResults {\n return {\n isInvalid: containsClass(hostElement, 'ix-invalid', includeChildren),\n isInvalidByRequired: containsClass(\n hostElement,\n 'ix-invalid--required',\n includeChildren\n ),\n isValid: containsClass(hostElement, 'ix-valid', includeChildren),\n isInfo: containsClass(hostElement, 'ix-info', includeChildren),\n isWarning: containsClass(hostElement, 'ix-warning', includeChildren),\n };\n}\n\nexport function HookValidationLifecycle(options?: {\n includeChildren?: boolean;\n}) {\n return (proto: IxComponent, methodName: string) => {\n let checkIfRequiredFunction: (() => Promise<void>) | null;\n let classMutationObserver: ClassMutationObserver | null;\n const { componentWillLoad, disconnectedCallback, connectedCallback } =\n proto;\n\n proto.connectedCallback = function () {\n const host = getElement(\n this\n ) as unknown as HTMLIxFormComponentElement<unknown>;\n\n checkIfRequiredFunction = async () => {\n const skipValidation = await shouldSuppressInternalValidation(host);\n if (skipValidation) {\n return;\n }\n\n if (host.hasValidValue && typeof host.hasValidValue === 'function') {\n const hasValue = await host.hasValidValue();\n const touched = await isTouched(host);\n if (host.required) {\n host.classList.toggle('ix-invalid--required', !hasValue && touched);\n } else {\n host.classList.remove('ix-invalid--required');\n }\n }\n\n if (\n host.getValidityState &&\n typeof host.getValidityState === 'function'\n ) {\n const validityState = await host.getValidityState();\n\n host.classList.toggle(\n `ix-invalid--validity-patternMismatch`,\n validityState.patternMismatch\n );\n }\n };\n\n host.addEventListener('valueChange', checkIfRequiredFunction);\n host.addEventListener('ixBlur', checkIfRequiredFunction);\n setTimeout(checkIfRequiredFunction);\n return connectedCallback?.call(this);\n };\n\n proto.componentWillLoad = function () {\n const host = getElement(\n this\n ) as unknown as HTMLIxFormComponentElement<unknown>;\n classMutationObserver = createClassMutationObserver(\n host,\n () => {\n const result = checkFieldClasses(host, options?.includeChildren);\n proto[methodName].call(this, result);\n },\n options\n );\n const result = checkFieldClasses(host, options?.includeChildren);\n proto[methodName].call(this, result);\n return componentWillLoad?.call(this);\n };\n\n proto.disconnectedCallback = function () {\n const host = getElement(this);\n\n if (host && classMutationObserver) {\n classMutationObserver.destroy();\n classMutationObserver = null;\n }\n\n if (host && checkIfRequiredFunction) {\n host.removeEventListener('valueChange', checkIfRequiredFunction);\n host.removeEventListener('ixBlur', checkIfRequiredFunction);\n checkIfRequiredFunction = null;\n }\n\n return disconnectedCallback?.call(this);\n };\n };\n}\n"],"version":3}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h } from './p-1335fdb8.js';
|
|
2
2
|
import { a as a11yBoolean } from './p-5fe87e71.js';
|
|
3
|
-
import { s as shouldSuppressInternalValidation } from './p-
|
|
3
|
+
import { s as shouldSuppressInternalValidation } from './p-0736463a.js';
|
|
4
4
|
import { c as createMutationObserver } from './p-e898862b.js';
|
|
5
5
|
import { a as convertToRemString } from './p-360b158e.js';
|
|
6
6
|
import { a as anime } from './p-71206084.js';
|
|
@@ -199,4 +199,4 @@ function observeElementUntilVisible(hostElement, updateCallback) {
|
|
|
199
199
|
|
|
200
200
|
export { InputElement as I, SlotEnd as S, TextareaElement as T, addDisposableChangesAndVisibilityObservers as a, adjustPaddingForStartAndEnd as b, SlotStart as c, checkAllowedKeys as d, checkInternalValidity as e, getAriaAttributesForInput as g, mapValidationResult as m, onInputBlur as o };
|
|
201
201
|
|
|
202
|
-
//# sourceMappingURL=p-
|
|
202
|
+
//# sourceMappingURL=p-6bc5e411.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-3843fd6b.js","mappings":";;;;;;;AAAA;;;;;;;;SAYgB,eAAe,CAAC,KAmB/B;IACC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B,CACjC,WAAwB,EACxB,cAA0B;IAE1B,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,CAAC,CAAC,OAAO;QAC5D,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK;YACpB,IAAI,KAAK,CAAC,cAAc,EAAE;gBACxB,cAAc,EAAE,CAAC;aAClB;SACF,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,oBAAoB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1C,OAAO,oBAAoB,CAAC;AAC9B;;;;","names":[],"sources":["src/components/input/input.fc.tsx","src/components/input/input.animation.ts","src/components/input/input.util.ts"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { h, FunctionalComponent } from '@stencil/core';\nimport { MakeRef } from '../utils/make-ref';\nimport { A11yAttributes } from '../utils/a11y';\n\nexport function TextareaElement(props: {\n resizeBehavior: 'both' | 'horizontal' | 'vertical' | 'none';\n textareaHeight?: string;\n textareaWidth?: string;\n textareaRows?: number;\n textareaCols?: number;\n disabled: boolean;\n readonly: boolean;\n maxLength?: number;\n minLength?: number;\n isInvalid: boolean;\n required: boolean;\n value: string;\n placeholder?: string;\n textAreaRef: (el: HTMLTextAreaElement | undefined) => void;\n valueChange: (value: string) => void;\n updateFormInternalValue: (value: string) => void;\n onBlur: () => void;\n ariaAttributes?: A11yAttributes;\n}) {\n return (\n <textarea\n readOnly={props.readonly}\n disabled={props.disabled}\n maxLength={props.maxLength}\n minLength={props.minLength}\n cols={props.textareaCols}\n rows={props.textareaRows}\n ref={props.textAreaRef}\n class={{\n 'is-invalid': props.isInvalid,\n }}\n required={props.required}\n value={props.value}\n placeholder={props.placeholder}\n onInput={(inputEvent) => {\n const target = inputEvent.target as HTMLInputElement;\n props.updateFormInternalValue(target.value);\n props.valueChange(target.value);\n }}\n onBlur={() => props.onBlur()}\n style={{\n resize: props.resizeBehavior,\n height: props.textareaHeight,\n width: props.textareaWidth,\n }}\n {...props.ariaAttributes}\n ></textarea>\n );\n}\n\nexport function InputElement(props: {\n id: string;\n disabled: boolean;\n readonly: boolean;\n maxLength?: string | number;\n minLength?: string | number;\n max?: string | number;\n min?: string | number;\n pattern?: string;\n type: string;\n isInvalid: boolean;\n required: boolean;\n value: string | number;\n placeholder?: string;\n inputRef: (el: HTMLInputElement | undefined) => void;\n onKeyPress: (event: KeyboardEvent) => void;\n valueChange: (value: string) => void;\n updateFormInternalValue: (value: string) => void;\n onBlur: () => void;\n ariaAttributes?: A11yAttributes;\n}) {\n return (\n <input\n id={props.id}\n autoComplete=\"off\"\n readOnly={props.readonly}\n disabled={props.disabled}\n min={props.min}\n max={props.max}\n maxLength={props.maxLength ? Number(props.maxLength) : undefined}\n minLength={props.maxLength ? Number(props.minLength) : undefined}\n ref={props.inputRef}\n pattern={props.pattern}\n type={props.type}\n class={{\n 'is-invalid': props.isInvalid,\n }}\n required={props.required}\n value={props.value}\n placeholder={props.placeholder}\n onKeyPress={(event) => props.onKeyPress(event)}\n onInput={(inputEvent) => {\n const target = inputEvent.target as HTMLInputElement;\n props.updateFormInternalValue(target.value);\n props.valueChange(target.value);\n }}\n onBlur={() => props.onBlur()}\n {...props.ariaAttributes}\n ></input>\n );\n}\n\nexport const SlotEnd: FunctionalComponent<{\n slotEndRef: MakeRef<HTMLDivElement>;\n onSlotChange?: (e: Event) => void;\n}> = (props, children) => {\n return (\n <div class=\"end-container\" ref={props.slotEndRef}>\n <slot name=\"end\" onSlotchange={props.onSlotChange}></slot>\n {children}\n </div>\n );\n};\n\nexport const SlotStart: FunctionalComponent<{\n slotStartRef: MakeRef<HTMLDivElement>;\n onSlotChange?: (e: Event) => void;\n}> = (props) => {\n return (\n <div class=\"start-container\" ref={props.slotStartRef}>\n <slot name=\"start\" onSlotchange={props.onSlotChange}></slot>\n </div>\n );\n};\n","/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport anime from 'animejs';\n\nexport function shakeInput(input: HTMLInputElement) {\n const xMax = 5;\n anime({\n targets: input,\n duration: 200,\n easing: 'easeInOutSine',\n loop: 2,\n translateX: [\n {\n value: xMax * -1,\n },\n {\n value: xMax,\n },\n {\n value: xMax / -2,\n },\n {\n value: xMax / 2,\n },\n {\n value: 0,\n },\n ],\n });\n}\n","/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { A11yAttributes, a11yBoolean } from '../utils/a11y';\nimport {\n IxFormComponent,\n IxInputFieldComponent,\n ValidationResults,\n shouldSuppressInternalValidation,\n} from '../utils/input';\nimport { createMutationObserver } from '../utils/mutation-observer';\nimport { convertToRemString } from '../utils/rwd.util';\nimport { generateUUID } from '../utils/uuid';\nimport { shakeInput } from './input.animation';\n\nexport function createIdIfNotExists(\n element: IxFormComponent,\n idPrefix: string = 'input'\n) {\n return element.hasAttribute('id')\n ? element.getAttribute('id')\n : `${idPrefix}-${generateUUID()}`;\n}\n\nexport function mapValidationResult<T>(\n ref: IxInputFieldComponent<T>,\n result: ValidationResults\n) {\n ref.isInvalid = result.isInvalid || result.isInvalidByRequired;\n ref.isValid = result.isValid;\n ref.isInfo = result.isInfo;\n ref.isWarning = result.isWarning;\n}\n\nexport function checkAllowedKeys<T>(\n comp: IxInputFieldComponent<T>,\n event: KeyboardEvent\n) {\n if (comp.allowedCharactersPattern) {\n const regex = new RegExp(comp.allowedCharactersPattern);\n if (!regex.test(event.key)) {\n event.preventDefault();\n shakeInput(comp.inputRef.current);\n }\n }\n}\n\nexport async function checkInternalValidity<T>(\n comp: IxFormComponent<T>,\n input: HTMLInputElement | HTMLTextAreaElement\n) {\n const validityState = input.validity;\n\n const eventResult = comp.validityStateChange.emit(validityState);\n\n if (eventResult.defaultPrevented) {\n return;\n }\n\n if (!comp.value) {\n return;\n }\n\n const skipValidation = await shouldSuppressInternalValidation(comp);\n if (skipValidation) {\n return;\n }\n\n const { valid } = validityState;\n comp.hostElement.classList.toggle('ix-invalid--validity-invalid', !valid);\n}\n\nexport function onInputBlur<T>(\n comp: IxFormComponent<T>,\n input?: HTMLInputElement | HTMLTextAreaElement | null\n) {\n comp.ixBlur.emit();\n\n if (!input) {\n throw new Error('Input element is not available');\n }\n\n input.setAttribute('data-ix-touched', 'true');\n checkInternalValidity(comp, input);\n}\n\nexport function applyPaddingEnd(\n inputElement: HTMLElement | null,\n width: number,\n options: {\n slotEnd: boolean;\n additionalPaddingRight?: string;\n }\n) {\n if (!inputElement) {\n return;\n }\n\n const remInPixels = 16;\n const padding = convertToRemString(width + remInPixels / 2);\n\n if (options.slotEnd) {\n inputElement.style.paddingRight = `calc(${padding} + ${\n options.additionalPaddingRight ?? '0rem'\n })`;\n } else {\n inputElement.style.paddingLeft = padding;\n }\n}\n\nexport function adjustPaddingForStartAndEnd(\n startElement: HTMLElement | null,\n endElement: HTMLElement | null,\n inputElement: HTMLElement | null\n) {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (startElement) {\n const startBoundingRect = startElement.getBoundingClientRect();\n if (startBoundingRect) {\n applyPaddingEnd(inputElement, startBoundingRect.width, {\n slotEnd: false,\n });\n }\n }\n\n if (endElement) {\n const endBoundingRect = endElement.getBoundingClientRect();\n if (endBoundingRect) {\n applyPaddingEnd(inputElement, endBoundingRect.width, {\n slotEnd: true,\n });\n }\n }\n });\n });\n}\n\nexport function getAriaAttributesForInput(\n component: IxInputFieldComponent\n): A11yAttributes {\n const inputAria: A11yAttributes = {\n 'aria-invalid': `${a11yBoolean(component.isInvalid)}`,\n 'aria-required': `${a11yBoolean(component.required)}`,\n };\n\n if (component.isInvalid && component.invalidText) {\n inputAria['aria-errormessage'] = component.invalidText;\n }\n return inputAria;\n}\n\nexport type DisposableChangesAndVisibilityObservers = () => void;\n\nexport const addDisposableChangesAndVisibilityObservers = (\n element: HTMLElement,\n callback: () => void\n): DisposableChangesAndVisibilityObservers => {\n const intersectionObserver = observeElementUntilVisible(element, callback);\n const mutationObserver = createMutationObserver(callback);\n\n mutationObserver.observe(element, {\n subtree: true,\n attributes: true,\n });\n\n return () => {\n intersectionObserver.disconnect();\n mutationObserver.disconnect();\n };\n};\n\nfunction observeElementUntilVisible(\n hostElement: HTMLElement,\n updateCallback: () => void\n): IntersectionObserver {\n const intersectionObserver = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n updateCallback();\n }\n });\n });\n\n intersectionObserver.observe(hostElement);\n return intersectionObserver;\n}\n"],"version":3}
|
|
1
|
+
{"file":"p-6bc5e411.js","mappings":";;;;;;;AAAA;;;;;;;;SAYgB,eAAe,CAAC,KAmB/B;IACC,QACE,8BACE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,IAAI,EAAE,KAAK,CAAC,YAAY,EACxB,IAAI,EAAE,KAAK,CAAC,YAAY,EACxB,GAAG,EAAE,KAAK,CAAC,WAAW,EACtB,KAAK,EAAE;YACL,YAAY,EAAE,KAAK,CAAC,SAAS;SAC9B,EACD,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,OAAO,EAAE,CAAC,UAAU;YAClB,MAAM,MAAM,GAAG,UAAU,CAAC,MAA0B,CAAC;YACrD,KAAK,CAAC,uBAAuB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5C,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SACjC,EACD,MAAM,EAAE,MAAM,KAAK,CAAC,MAA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S,CAAC,WAAW,EAAE;QAChD,SAAS,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC,WAAW,CAAC;KACxD;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;MAIY,0CAA0C,GAAG,CACxD,OAAoB,EACpB,QAAoB;IAEpB,MAAM,oBAAoB,GAAG,0BAA0B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC3E,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IAE1D,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE;QAChC,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,IAAI;KACjB,CAAC,CAAC;IAEH,OAAO;QACL,oBAAoB,CAAC,UAAU,EAAE,CAAC;QAClC,gBAAgB,CAAC,UAAU,EAAE,CAAC;KAC/B,CAAC;AACJ,EAAE;AAEF,SAAS,0BAA0B,CACjC,WAAwB,EACxB,cAA0B;IAE1B,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,CAAC,CAAC,OAAO;QAC5D,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK;YACpB,IAAI,KAAK,CAAC,cAAc,EAAE;gBACxB,cAAc,EAAE,CAAC;aAClB;SACF,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,oBAAoB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1C,OAAO,oBAAoB,CAAC;AAC9B;;;;","names":[],"sources":["src/components/input/input.fc.tsx","src/components/input/input.animation.ts","src/components/input/input.util.ts"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { h, FunctionalComponent } from '@stencil/core';\nimport { MakeRef } from '../utils/make-ref';\nimport { A11yAttributes } from '../utils/a11y';\n\nexport function TextareaElement(props: {\n resizeBehavior: 'both' | 'horizontal' | 'vertical' | 'none';\n textareaHeight?: string;\n textareaWidth?: string;\n textareaRows?: number;\n textareaCols?: number;\n disabled: boolean;\n readonly: boolean;\n maxLength?: number;\n minLength?: number;\n isInvalid: boolean;\n required: boolean;\n value: string;\n placeholder?: string;\n textAreaRef: (el: HTMLTextAreaElement | undefined) => void;\n valueChange: (value: string) => void;\n updateFormInternalValue: (value: string) => void;\n onBlur: () => void;\n ariaAttributes?: A11yAttributes;\n}) {\n return (\n <textarea\n readOnly={props.readonly}\n disabled={props.disabled}\n maxLength={props.maxLength}\n minLength={props.minLength}\n cols={props.textareaCols}\n rows={props.textareaRows}\n ref={props.textAreaRef}\n class={{\n 'is-invalid': props.isInvalid,\n }}\n required={props.required}\n value={props.value}\n placeholder={props.placeholder}\n onInput={(inputEvent) => {\n const target = inputEvent.target as HTMLInputElement;\n props.updateFormInternalValue(target.value);\n props.valueChange(target.value);\n }}\n onBlur={() => props.onBlur()}\n style={{\n resize: props.resizeBehavior,\n height: props.textareaHeight,\n width: props.textareaWidth,\n }}\n {...props.ariaAttributes}\n ></textarea>\n );\n}\n\nexport function InputElement(props: {\n id: string;\n disabled: boolean;\n readonly: boolean;\n maxLength?: string | number;\n minLength?: string | number;\n max?: string | number;\n min?: string | number;\n pattern?: string;\n type: string;\n isInvalid: boolean;\n required: boolean;\n value: string | number;\n placeholder?: string;\n inputRef: (el: HTMLInputElement | undefined) => void;\n onKeyPress: (event: KeyboardEvent) => void;\n valueChange: (value: string) => void;\n updateFormInternalValue: (value: string) => void;\n onBlur: () => void;\n ariaAttributes?: A11yAttributes;\n}) {\n return (\n <input\n id={props.id}\n autoComplete=\"off\"\n readOnly={props.readonly}\n disabled={props.disabled}\n min={props.min}\n max={props.max}\n maxLength={props.maxLength ? Number(props.maxLength) : undefined}\n minLength={props.maxLength ? Number(props.minLength) : undefined}\n ref={props.inputRef}\n pattern={props.pattern}\n type={props.type}\n class={{\n 'is-invalid': props.isInvalid,\n }}\n required={props.required}\n value={props.value}\n placeholder={props.placeholder}\n onKeyPress={(event) => props.onKeyPress(event)}\n onInput={(inputEvent) => {\n const target = inputEvent.target as HTMLInputElement;\n props.updateFormInternalValue(target.value);\n props.valueChange(target.value);\n }}\n onBlur={() => props.onBlur()}\n {...props.ariaAttributes}\n ></input>\n );\n}\n\nexport const SlotEnd: FunctionalComponent<{\n slotEndRef: MakeRef<HTMLDivElement>;\n onSlotChange?: (e: Event) => void;\n}> = (props, children) => {\n return (\n <div class=\"end-container\" ref={props.slotEndRef}>\n <slot name=\"end\" onSlotchange={props.onSlotChange}></slot>\n {children}\n </div>\n );\n};\n\nexport const SlotStart: FunctionalComponent<{\n slotStartRef: MakeRef<HTMLDivElement>;\n onSlotChange?: (e: Event) => void;\n}> = (props) => {\n return (\n <div class=\"start-container\" ref={props.slotStartRef}>\n <slot name=\"start\" onSlotchange={props.onSlotChange}></slot>\n </div>\n );\n};\n","/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport anime from 'animejs';\n\nexport function shakeInput(input: HTMLInputElement) {\n const xMax = 5;\n anime({\n targets: input,\n duration: 200,\n easing: 'easeInOutSine',\n loop: 2,\n translateX: [\n {\n value: xMax * -1,\n },\n {\n value: xMax,\n },\n {\n value: xMax / -2,\n },\n {\n value: xMax / 2,\n },\n {\n value: 0,\n },\n ],\n });\n}\n","/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { A11yAttributes, a11yBoolean } from '../utils/a11y';\nimport {\n IxFormComponent,\n IxInputFieldComponent,\n ValidationResults,\n shouldSuppressInternalValidation,\n} from '../utils/input';\nimport { createMutationObserver } from '../utils/mutation-observer';\nimport { convertToRemString } from '../utils/rwd.util';\nimport { generateUUID } from '../utils/uuid';\nimport { shakeInput } from './input.animation';\n\nexport function createIdIfNotExists(\n element: IxFormComponent,\n idPrefix: string = 'input'\n) {\n return element.hasAttribute('id')\n ? element.getAttribute('id')\n : `${idPrefix}-${generateUUID()}`;\n}\n\nexport function mapValidationResult<T>(\n ref: IxInputFieldComponent<T>,\n result: ValidationResults\n) {\n ref.isInvalid = result.isInvalid || result.isInvalidByRequired;\n ref.isValid = result.isValid;\n ref.isInfo = result.isInfo;\n ref.isWarning = result.isWarning;\n}\n\nexport function checkAllowedKeys<T>(\n comp: IxInputFieldComponent<T>,\n event: KeyboardEvent\n) {\n if (comp.allowedCharactersPattern) {\n const regex = new RegExp(comp.allowedCharactersPattern);\n if (!regex.test(event.key)) {\n event.preventDefault();\n shakeInput(comp.inputRef.current);\n }\n }\n}\n\nexport async function checkInternalValidity<T>(\n comp: IxFormComponent<T>,\n input: HTMLInputElement | HTMLTextAreaElement\n) {\n const validityState = input.validity;\n\n const eventResult = comp.validityStateChange.emit(validityState);\n\n if (eventResult.defaultPrevented) {\n return;\n }\n\n if (!comp.value) {\n return;\n }\n\n const skipValidation = await shouldSuppressInternalValidation(comp);\n if (skipValidation) {\n return;\n }\n\n const { valid } = validityState;\n comp.hostElement.classList.toggle('ix-invalid--validity-invalid', !valid);\n}\n\nexport function onInputBlur<T>(\n comp: IxFormComponent<T>,\n input?: HTMLInputElement | HTMLTextAreaElement | null\n) {\n comp.ixBlur.emit();\n\n if (!input) {\n throw new Error('Input element is not available');\n }\n\n input.setAttribute('data-ix-touched', 'true');\n checkInternalValidity(comp, input);\n}\n\nexport function applyPaddingEnd(\n inputElement: HTMLElement | null,\n width: number,\n options: {\n slotEnd: boolean;\n additionalPaddingRight?: string;\n }\n) {\n if (!inputElement) {\n return;\n }\n\n const remInPixels = 16;\n const padding = convertToRemString(width + remInPixels / 2);\n\n if (options.slotEnd) {\n inputElement.style.paddingRight = `calc(${padding} + ${\n options.additionalPaddingRight ?? '0rem'\n })`;\n } else {\n inputElement.style.paddingLeft = padding;\n }\n}\n\nexport function adjustPaddingForStartAndEnd(\n startElement: HTMLElement | null,\n endElement: HTMLElement | null,\n inputElement: HTMLElement | null\n) {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (startElement) {\n const startBoundingRect = startElement.getBoundingClientRect();\n if (startBoundingRect) {\n applyPaddingEnd(inputElement, startBoundingRect.width, {\n slotEnd: false,\n });\n }\n }\n\n if (endElement) {\n const endBoundingRect = endElement.getBoundingClientRect();\n if (endBoundingRect) {\n applyPaddingEnd(inputElement, endBoundingRect.width, {\n slotEnd: true,\n });\n }\n }\n });\n });\n}\n\nexport function getAriaAttributesForInput(\n component: IxInputFieldComponent\n): A11yAttributes {\n const inputAria: A11yAttributes = {\n 'aria-invalid': `${a11yBoolean(component.isInvalid)}`,\n 'aria-required': `${a11yBoolean(component.required)}`,\n };\n\n if (component.isInvalid && component.invalidText) {\n inputAria['aria-errormessage'] = component.invalidText;\n }\n return inputAria;\n}\n\nexport type DisposableChangesAndVisibilityObservers = () => void;\n\nexport const addDisposableChangesAndVisibilityObservers = (\n element: HTMLElement,\n callback: () => void\n): DisposableChangesAndVisibilityObservers => {\n const intersectionObserver = observeElementUntilVisible(element, callback);\n const mutationObserver = createMutationObserver(callback);\n\n mutationObserver.observe(element, {\n subtree: true,\n attributes: true,\n });\n\n return () => {\n intersectionObserver.disconnect();\n mutationObserver.disconnect();\n };\n};\n\nfunction observeElementUntilVisible(\n hostElement: HTMLElement,\n updateCallback: () => void\n): IntersectionObserver {\n const intersectionObserver = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n updateCallback();\n }\n });\n });\n\n intersectionObserver.observe(hostElement);\n return intersectionObserver;\n}\n"],"version":3}
|
|
@@ -2,7 +2,7 @@ import { p as proxyCustomElement, H, h, d as Host } from './p-1335fdb8.js';
|
|
|
2
2
|
import { b as a11yHostAttributes } from './p-5fe87e71.js';
|
|
3
3
|
import { m as makeRef } from './p-ce563a48.js';
|
|
4
4
|
import { d as defineCustomElement$1 } from './p-b08c1f61.js';
|
|
5
|
-
import { c as createClassMutationObserver } from './p-
|
|
5
|
+
import { c as createClassMutationObserver } from './p-0736463a.js';
|
|
6
6
|
|
|
7
7
|
function isIxInputFieldComponent(obj) {
|
|
8
8
|
return (obj &&
|
|
@@ -159,4 +159,4 @@ function defineCustomElement() {
|
|
|
159
159
|
|
|
160
160
|
export { FormFieldLabel as F, defineCustomElement as d };
|
|
161
161
|
|
|
162
|
-
//# sourceMappingURL=p-
|
|
162
|
+
//# sourceMappingURL=p-90900090.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-d54870ca.js","mappings":";;;;;;SAkGgB,uBAAuB,CACrC,GAAqC;IAErC,QACE,GAAG;QACH,0BAA0B,IAAI,GAAG;QACjC,OAAO,GAAG,CAAC,wBAAwB,KAAK,UAAU;QAClD,uBAAuB,IAAI,GAAG;QAC9B,OAAO,GAAG,CAAC,qBAAqB,KAAK,UAAU,EAC/C;AACJ;;AC5GA,MAAM,aAAa,GAAG,uFAAuF,CAAC;AAC9G,2BAAe,aAAa;;MCwBf,cAAc;IAL3B;;;;;QAyB2B,cAAS,GAAY,KAAK,CAAC;QAEnC,oBAAe,GAAG,IAAI,gBAAgB,CAAC,MACtD,IAAI,CAAC,qBAAqB,EAAE,CAC7B,CAAC;QAGM,mBAAc,GAAmB,EAAE,CAAC;QAC3B,aAAQ,GAAG,OAAO,EAAoB,CAAC;KAiJzD;IA/IC,iBAAiB;QACf,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC/B,IAAI,CAAC,0BAA0B,EAAE,CAAC;KACnC;IAED,oBAAoB;QAClB,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;SACnC;QACD,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC7B,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;SACrC;QACD,IAAI,IAAI,CAAC,uBAAuB,EAAE;YAChC,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAAC;SACxC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CAAC;SAClD;KACF;IAED,MAAM;QACJ,QACE,EAAC,IAAI,qDAAC,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,IACtC,4EACE,OAAO,EAAE,IAAI,CAAC,OAAO,IACjB,IAAI,CAAC,cAAc,IACvB,GAAG,EAAE,IAAI,CAAC,QAAQ,KAElB,sEACE,KAAK,EAAE,IAAI,CAAC,SAAS,GAAG,OAAO,GAAG,MAAM,EACxC,MAAM,EAAC,OAAO,IAEd,8DAAa,EACZ,IAAI,CAAC,QAAQ,IAAI,yEAAoB,CACxB,CACV,CACH,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/utils/input/index.ts","src/components/field-label/field-label.scss?tag=ix-field-label&encapsulation=shadow","src/components/field-label/field-label.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { EventEmitter } from '@stencil/core';\nimport { IxComponent } from '../internal';\n\nexport * from './validation';\n\nexport interface FieldWrapperInterface {\n /**\n * Label for the field component\n */\n label?: string;\n /**\n * Show text below the field component which show additional information\n */\n helperText?: string;\n /**\n * Info text for the field component\n */\n infoText?: string;\n /**\n * Warning text for the field component\n */\n warningText?: string;\n /**\n * Error text for the field component\n */\n invalidText?: string;\n /**\n * Valid text for the field component\n */\n validText?: string;\n /**\n * Show helper, info, warning, error and valid text as tooltip\n */\n showTextAsTooltip?: boolean;\n}\n\nexport type HTMLIxFormComponentElement<T> = HTMLElement & IxFormComponent<T>;\nexport type HTMLIxInputFieldComponentElement<T> =\n HTMLIxFormComponentElement<T> & IxInputFieldComponent<T>;\n\nexport interface IxFormValidationState {\n // Annotate as @State()\n isInvalid: boolean;\n // Annotate as @State()\n isValid: boolean;\n // Annotate as @State()\n isInfo: boolean;\n // Annotate as @State()\n isWarning: boolean;\n}\n\nexport interface IxFormComponent<T = string> extends IxComponent {\n // Private internal\n formInternals: ElementInternals;\n\n // Annotate as @Prop({ reflect: true })\n required?: boolean;\n // Annotate as @Prop({ reflect: true })\n name?: string;\n // Annotate as @Prop()\n value?: T;\n // Annotate as @Prop()\n disabled: boolean;\n\n valueChange: EventEmitter<T>;\n updateFormInternalValue(value: T): void;\n hasValidValue(): Promise<boolean>;\n getValidityState?(): Promise<ValidityState>;\n getAssociatedFormElement(): Promise<HTMLFormElement | null>;\n isTouched?(): Promise<boolean>;\n}\n\nexport interface IxInputFieldComponent<T = string>\n extends IxFormComponent<T>,\n IxFormValidationState,\n FieldWrapperInterface {\n // Annotate as @Prop()\n placeholder?: string;\n // Annotate as @Prop()\n readonly: boolean;\n\n ixBlur: EventEmitter<void>;\n\n // Annotate as @Method()\n getNativeInputElement(): Promise<HTMLInputElement | HTMLTextAreaElement>;\n\n // Annotate as @Method()\n focusInput(): void;\n}\n\nexport function isIxInputFieldComponent<T>(\n obj: HTMLElement | IxFormComponent<T>\n): obj is HTMLIxInputFieldComponentElement<T> {\n return (\n obj &&\n 'getAssociatedFormElement' in obj &&\n typeof obj.getAssociatedFormElement === 'function' &&\n 'getNativeInputElement' in obj &&\n typeof obj.getNativeInputElement === 'function'\n );\n}\n","/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n:host {\n display: inline-block;\n position: relative;\n\n margin-top: 0.5rem;\n margin-bottom: 0.25rem;\n}\n","/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { Component, Element, h, Host, Prop, Watch } from '@stencil/core';\nimport { A11yAttributes, a11yHostAttributes } from '../utils/a11y';\nimport {\n ClassMutationObserver,\n createClassMutationObserver,\n HTMLIxFormComponentElement,\n isIxInputFieldComponent,\n} from '../utils/input';\nimport { IxComponent } from '../utils/internal';\nimport { MakeRef, makeRef } from '../utils/make-ref';\n\n@Component({\n tag: 'ix-field-label',\n styleUrl: 'field-label.scss',\n shadow: true,\n})\nexport class FormFieldLabel implements IxComponent {\n @Element() hostElement!: HTMLIxFieldLabelElement;\n\n /**\n * A value is required or must be checked for the form to be submittable\n */\n @Prop({ reflect: true, mutable: true }) required?: boolean;\n\n /**\n * The id of the form element that the label is associated with\n */\n @Prop({ reflect: true }) htmlFor?: string;\n\n /** @internal */\n @Prop() controlRef?:\n | MakeRef<HTMLElement>\n | MakeRef<HTMLInputElement>\n | MakeRef<HTMLTextAreaElement>;\n\n /** @internal */\n @Prop({ mutable: true }) isInvalid: boolean = false;\n\n private readonly htmlForObserver = new MutationObserver(() =>\n this.checkForInternalState()\n );\n private htmlForClassObserver?: ClassMutationObserver;\n private controlRefClassObserver?: ClassMutationObserver;\n private a11yAttributes: A11yAttributes = {};\n private readonly labelRef = makeRef<HTMLLabelElement>();\n\n connectedCallback() {\n this.registerHtmlForObserver();\n this.registerControlRefObserver();\n }\n\n disconnectedCallback(): void {\n if (this.htmlForObserver) {\n this.htmlForObserver.disconnect();\n }\n if (this.htmlForClassObserver) {\n this.htmlForClassObserver.destroy();\n }\n if (this.controlRefClassObserver) {\n this.controlRefClassObserver.destroy();\n }\n }\n\n componentWillRender() {\n this.checkForInternalState();\n }\n\n componentWillLoad(): void | Promise<void> {\n this.a11yAttributes = a11yHostAttributes(this.hostElement);\n }\n\n @Watch('htmlFor')\n private registerHtmlForObserver() {\n if (typeof window === 'undefined') {\n return;\n }\n\n if (this.htmlForObserver) {\n this.htmlForObserver.disconnect();\n }\n\n if (this.htmlFor) {\n this.htmlForObserver.observe(window.document, {\n childList: true,\n subtree: true,\n });\n }\n }\n\n @Watch('controlRef')\n private async registerControlRefObserver() {\n if (typeof window === 'undefined') {\n return;\n }\n\n if (this.controlRefClassObserver) {\n this.controlRefClassObserver.destroy();\n }\n\n if (this.controlRef) {\n const input = await this.controlRef.waitForCurrent();\n\n this.controlRefClassObserver = createClassMutationObserver(input, () =>\n this.checkForInvalidState(input)\n );\n }\n }\n\n private registerHtmlForClassObserver(\n forElement: HTMLIxFormComponentElement<unknown>\n ) {\n if (this.htmlForClassObserver) {\n this.htmlForClassObserver.destroy();\n }\n\n this.htmlForClassObserver = createClassMutationObserver(forElement, () =>\n this.checkForInvalidState(forElement)\n );\n }\n\n private checkForInvalidState(elementToCheck: HTMLElement) {\n this.isInvalid =\n elementToCheck.classList.contains('is-invalid') ||\n elementToCheck.classList.contains('ix-invalid');\n }\n\n private async checkForInternalState() {\n if (this.htmlFor) {\n const forElement = document.getElementById(\n this.htmlFor\n ) as HTMLIxFormComponentElement<unknown>;\n if (forElement) {\n if (typeof forElement.required === 'boolean') {\n this.required = forElement.required;\n }\n\n this.registerHtmlForClassObserver(forElement);\n this.checkForInvalidState(forElement);\n }\n }\n\n if (this.controlRef) {\n const input = await this.controlRef.waitForCurrent();\n this.required = (\n input as HTMLInputElement | HTMLTextAreaElement\n ).required;\n }\n }\n\n private async focusOnClick() {\n if (this.htmlFor) {\n const target = document.getElementById(this.htmlFor);\n if (target) {\n let input: HTMLElement | null = null;\n if (isIxInputFieldComponent(target)) {\n input = await target.getNativeInputElement();\n } else {\n input = target;\n }\n if (typeof input.focus === 'function') {\n input.focus();\n }\n }\n }\n\n if (this.controlRef) {\n (await this.controlRef.waitForCurrent()).focus();\n }\n }\n\n render() {\n return (\n <Host onClick={() => this.focusOnClick()}>\n <label\n htmlFor={this.htmlFor}\n {...this.a11yAttributes}\n ref={this.labelRef}\n >\n <ix-typography\n color={this.isInvalid ? 'alarm' : 'soft'}\n format=\"label\"\n >\n <slot></slot>\n {this.required && <span> *</span>}\n </ix-typography>\n </label>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"p-90900090.js","mappings":";;;;;;SAkGgB,uBAAuB,CACrC,GAAqC;IAErC,QACE,GAAG;QACH,0BAA0B,IAAI,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[],"sources":["src/components/utils/input/index.ts","src/components/field-label/field-label.scss?tag=ix-field-label&encapsulation=shadow","src/components/field-label/field-label.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { EventEmitter } from '@stencil/core';\nimport { IxComponent } from '../internal';\n\nexport * from './validation';\n\nexport interface FieldWrapperInterface {\n /**\n * Label for the field component\n */\n label?: string;\n /**\n * Show text below the field component which show additional information\n */\n helperText?: string;\n /**\n * Info text for the field component\n */\n infoText?: string;\n /**\n * Warning text for the field component\n */\n warningText?: string;\n /**\n * Error text for the field component\n */\n invalidText?: string;\n /**\n * Valid text for the field component\n */\n validText?: string;\n /**\n * Show helper, info, warning, error and valid text as tooltip\n */\n showTextAsTooltip?: boolean;\n}\n\nexport type HTMLIxFormComponentElement<T> = HTMLElement & IxFormComponent<T>;\nexport type HTMLIxInputFieldComponentElement<T> =\n HTMLIxFormComponentElement<T> & IxInputFieldComponent<T>;\n\nexport interface IxFormValidationState {\n // Annotate as @State()\n isInvalid: boolean;\n // Annotate as @State()\n isValid: boolean;\n // Annotate as @State()\n isInfo: boolean;\n // Annotate as @State()\n isWarning: boolean;\n}\n\nexport interface IxFormComponent<T = string> extends IxComponent {\n // Private internal\n formInternals: ElementInternals;\n\n // Annotate as @Prop({ reflect: true })\n required?: boolean;\n // Annotate as @Prop({ reflect: true })\n name?: string;\n // Annotate as @Prop()\n value?: T;\n // Annotate as @Prop()\n disabled: boolean;\n\n valueChange: EventEmitter<T>;\n updateFormInternalValue(value: T): void;\n hasValidValue(): Promise<boolean>;\n getValidityState?(): Promise<ValidityState>;\n getAssociatedFormElement(): Promise<HTMLFormElement | null>;\n isTouched?(): Promise<boolean>;\n}\n\nexport interface IxInputFieldComponent<T = string>\n extends IxFormComponent<T>,\n IxFormValidationState,\n FieldWrapperInterface {\n // Annotate as @Prop()\n placeholder?: string;\n // Annotate as @Prop()\n readonly: boolean;\n\n ixBlur: EventEmitter<void>;\n\n // Annotate as @Method()\n getNativeInputElement(): Promise<HTMLInputElement | HTMLTextAreaElement>;\n\n // Annotate as @Method()\n focusInput(): void;\n}\n\nexport function isIxInputFieldComponent<T>(\n obj: HTMLElement | IxFormComponent<T>\n): obj is HTMLIxInputFieldComponentElement<T> {\n return (\n obj &&\n 'getAssociatedFormElement' in obj &&\n typeof obj.getAssociatedFormElement === 'function' &&\n 'getNativeInputElement' in obj &&\n typeof obj.getNativeInputElement === 'function'\n );\n}\n","/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n:host {\n display: inline-block;\n position: relative;\n\n margin-top: 0.5rem;\n margin-bottom: 0.25rem;\n}\n","/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { Component, Element, h, Host, Prop, Watch } from '@stencil/core';\nimport { A11yAttributes, a11yHostAttributes } from '../utils/a11y';\nimport {\n ClassMutationObserver,\n createClassMutationObserver,\n HTMLIxFormComponentElement,\n isIxInputFieldComponent,\n} from '../utils/input';\nimport { IxComponent } from '../utils/internal';\nimport { MakeRef, makeRef } from '../utils/make-ref';\n\n@Component({\n tag: 'ix-field-label',\n styleUrl: 'field-label.scss',\n shadow: true,\n})\nexport class FormFieldLabel implements IxComponent {\n @Element() hostElement!: HTMLIxFieldLabelElement;\n\n /**\n * A value is required or must be checked for the form to be submittable\n */\n @Prop({ reflect: true, mutable: true }) required?: boolean;\n\n /**\n * The id of the form element that the label is associated with\n */\n @Prop({ reflect: true }) htmlFor?: string;\n\n /** @internal */\n @Prop() controlRef?:\n | MakeRef<HTMLElement>\n | MakeRef<HTMLInputElement>\n | MakeRef<HTMLTextAreaElement>;\n\n /** @internal */\n @Prop({ mutable: true }) isInvalid: boolean = false;\n\n private readonly htmlForObserver = new MutationObserver(() =>\n this.checkForInternalState()\n );\n private htmlForClassObserver?: ClassMutationObserver;\n private controlRefClassObserver?: ClassMutationObserver;\n private a11yAttributes: A11yAttributes = {};\n private readonly labelRef = makeRef<HTMLLabelElement>();\n\n connectedCallback() {\n this.registerHtmlForObserver();\n this.registerControlRefObserver();\n }\n\n disconnectedCallback(): void {\n if (this.htmlForObserver) {\n this.htmlForObserver.disconnect();\n }\n if (this.htmlForClassObserver) {\n this.htmlForClassObserver.destroy();\n }\n if (this.controlRefClassObserver) {\n this.controlRefClassObserver.destroy();\n }\n }\n\n componentWillRender() {\n this.checkForInternalState();\n }\n\n componentWillLoad(): void | Promise<void> {\n this.a11yAttributes = a11yHostAttributes(this.hostElement);\n }\n\n @Watch('htmlFor')\n private registerHtmlForObserver() {\n if (typeof window === 'undefined') {\n return;\n }\n\n if (this.htmlForObserver) {\n this.htmlForObserver.disconnect();\n }\n\n if (this.htmlFor) {\n this.htmlForObserver.observe(window.document, {\n childList: true,\n subtree: true,\n });\n }\n }\n\n @Watch('controlRef')\n private async registerControlRefObserver() {\n if (typeof window === 'undefined') {\n return;\n }\n\n if (this.controlRefClassObserver) {\n this.controlRefClassObserver.destroy();\n }\n\n if (this.controlRef) {\n const input = await this.controlRef.waitForCurrent();\n\n this.controlRefClassObserver = createClassMutationObserver(input, () =>\n this.checkForInvalidState(input)\n );\n }\n }\n\n private registerHtmlForClassObserver(\n forElement: HTMLIxFormComponentElement<unknown>\n ) {\n if (this.htmlForClassObserver) {\n this.htmlForClassObserver.destroy();\n }\n\n this.htmlForClassObserver = createClassMutationObserver(forElement, () =>\n this.checkForInvalidState(forElement)\n );\n }\n\n private checkForInvalidState(elementToCheck: HTMLElement) {\n this.isInvalid =\n elementToCheck.classList.contains('is-invalid') ||\n elementToCheck.classList.contains('ix-invalid');\n }\n\n private async checkForInternalState() {\n if (this.htmlFor) {\n const forElement = document.getElementById(\n this.htmlFor\n ) as HTMLIxFormComponentElement<unknown>;\n if (forElement) {\n if (typeof forElement.required === 'boolean') {\n this.required = forElement.required;\n }\n\n this.registerHtmlForClassObserver(forElement);\n this.checkForInvalidState(forElement);\n }\n }\n\n if (this.controlRef) {\n const input = await this.controlRef.waitForCurrent();\n this.required = (\n input as HTMLInputElement | HTMLTextAreaElement\n ).required;\n }\n }\n\n private async focusOnClick() {\n if (this.htmlFor) {\n const target = document.getElementById(this.htmlFor);\n if (target) {\n let input: HTMLElement | null = null;\n if (isIxInputFieldComponent(target)) {\n input = await target.getNativeInputElement();\n } else {\n input = target;\n }\n if (typeof input.focus === 'function') {\n input.focus();\n }\n }\n }\n\n if (this.controlRef) {\n (await this.controlRef.waitForCurrent()).focus();\n }\n }\n\n render() {\n return (\n <Host onClick={() => this.focusOnClick()}>\n <label\n htmlFor={this.htmlFor}\n {...this.a11yAttributes}\n ref={this.labelRef}\n >\n <ix-typography\n color={this.isInvalid ? 'alarm' : 'soft'}\n format=\"label\"\n >\n <slot></slot>\n {this.required && <span> *</span>}\n </ix-typography>\n </label>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, e as createEvent, h, d as Host } from './p-1335fdb8.js';
|
|
2
2
|
import { a as a11yBoolean } from './p-5fe87e71.js';
|
|
3
3
|
import { A as ArrowFocusController, d as defineCustomElement$a } from './p-0b95bd20.js';
|
|
4
|
-
import { H as HookValidationLifecycle } from './p-
|
|
4
|
+
import { H as HookValidationLifecycle } from './p-0736463a.js';
|
|
5
5
|
import { O as OnListener } from './p-b1c62982.js';
|
|
6
6
|
import { m as makeRef } from './p-ce563a48.js';
|
|
7
7
|
import { c as createMutationObserver } from './p-e898862b.js';
|
|
8
8
|
import { d as defineCustomElement$9 } from './p-2f0b446c.js';
|
|
9
|
-
import { d as defineCustomElement$8 } from './p-
|
|
10
|
-
import { d as defineCustomElement$7 } from './p-
|
|
9
|
+
import { d as defineCustomElement$8 } from './p-90900090.js';
|
|
10
|
+
import { d as defineCustomElement$7 } from './p-bbb5e21c.js';
|
|
11
11
|
import { d as defineCustomElement$6 } from './p-650a4e29.js';
|
|
12
12
|
import { d as defineCustomElement$5 } from './p-afca111c.js';
|
|
13
13
|
import { d as defineCustomElement$4 } from './p-b57fae9c.js';
|
|
@@ -785,4 +785,4 @@ function defineCustomElement() {
|
|
|
785
785
|
|
|
786
786
|
export { Select as S, defineCustomElement as d };
|
|
787
787
|
|
|
788
|
-
//# sourceMappingURL=p-
|
|
788
|
+
//# sourceMappingURL=p-9c587ccc.js.map
|