@dropi/ui 0.1.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/LICENSE +21 -0
- package/dist/cjs/dropi-badge.cjs.entry.js +37 -0
- package/dist/cjs/dropi-button.cjs.entry.js +81 -0
- package/dist/cjs/dropi-checkbox.cjs.entry.js +36 -0
- package/dist/cjs/dropi-icon.cjs.entry.js +50 -0
- package/dist/cjs/dropi-input.cjs.entry.js +210 -0
- package/dist/cjs/dropi-radio-button.cjs.entry.js +47 -0
- package/dist/cjs/dropi-select.cjs.entry.js +335 -0
- package/dist/cjs/dropi-switch.cjs.entry.js +30 -0
- package/dist/cjs/dropi-tag.cjs.entry.js +68 -0
- package/dist/cjs/dropi-text-area.cjs.entry.js +103 -0
- package/dist/cjs/dropi-ui.cjs.js +24 -0
- package/dist/cjs/index-CuGLZVqo.js +1743 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +12 -0
- package/dist/collection/assets/icons/symbol/svg/sprite.css.svg +1 -0
- package/dist/collection/collection-manifest.json +22 -0
- package/dist/collection/components/dropi-badge/dropi-badge.css +41 -0
- package/dist/collection/components/dropi-badge/dropi-badge.js +72 -0
- package/dist/collection/components/dropi-button/dropi-button.css +169 -0
- package/dist/collection/components/dropi-button/dropi-button.js +277 -0
- package/dist/collection/components/dropi-checkbox/dropi-checkbox.css +47 -0
- package/dist/collection/components/dropi-checkbox/dropi-checkbox.js +103 -0
- package/dist/collection/components/dropi-icon/dropi-icon.css +19 -0
- package/dist/collection/components/dropi-icon/dropi-icon.js +142 -0
- package/dist/collection/components/dropi-input/dropi-input.css +168 -0
- package/dist/collection/components/dropi-input/dropi-input.js +735 -0
- package/dist/collection/components/dropi-radio-button/dropi-radio-button.css +59 -0
- package/dist/collection/components/dropi-radio-button/dropi-radio-button.js +181 -0
- package/dist/collection/components/dropi-select/dropi-select.css +364 -0
- package/dist/collection/components/dropi-select/dropi-select.js +932 -0
- package/dist/collection/components/dropi-select/select.types.js +1 -0
- package/dist/collection/components/dropi-switch/dropi-switch.css +57 -0
- package/dist/collection/components/dropi-switch/dropi-switch.js +96 -0
- package/dist/collection/components/dropi-tag/dropi-tag.css +40 -0
- package/dist/collection/components/dropi-tag/dropi-tag.js +190 -0
- package/dist/collection/components/dropi-text-area/dropi-text-area.css +97 -0
- package/dist/collection/components/dropi-text-area/dropi-text-area.js +457 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/utils.js +3 -0
- package/dist/collection/utils/utils.unit.test.js +16 -0
- package/dist/components/dropi-badge.d.ts +11 -0
- package/dist/components/dropi-badge.js +1 -0
- package/dist/components/dropi-button.d.ts +11 -0
- package/dist/components/dropi-button.js +1 -0
- package/dist/components/dropi-checkbox.d.ts +11 -0
- package/dist/components/dropi-checkbox.js +1 -0
- package/dist/components/dropi-icon.d.ts +11 -0
- package/dist/components/dropi-icon.js +1 -0
- package/dist/components/dropi-input.d.ts +11 -0
- package/dist/components/dropi-input.js +1 -0
- package/dist/components/dropi-radio-button.d.ts +11 -0
- package/dist/components/dropi-radio-button.js +1 -0
- package/dist/components/dropi-select.d.ts +11 -0
- package/dist/components/dropi-select.js +1 -0
- package/dist/components/dropi-switch.d.ts +11 -0
- package/dist/components/dropi-switch.js +1 -0
- package/dist/components/dropi-tag.d.ts +11 -0
- package/dist/components/dropi-tag.js +1 -0
- package/dist/components/dropi-text-area.d.ts +11 -0
- package/dist/components/dropi-text-area.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/p-MNma8N1x.js +1 -0
- package/dist/dropi-ui/dropi-ui.css +1 -0
- package/dist/dropi-ui/dropi-ui.esm.js +1 -0
- package/dist/dropi-ui/index.esm.js +0 -0
- package/dist/dropi-ui/p-1a28b8f5.entry.js +1 -0
- package/dist/dropi-ui/p-21abf91a.entry.js +1 -0
- package/dist/dropi-ui/p-52291024.entry.js +1 -0
- package/dist/dropi-ui/p-54502c46.entry.js +1 -0
- package/dist/dropi-ui/p-6f0aa619.entry.js +1 -0
- package/dist/dropi-ui/p-9c7076d3.entry.js +1 -0
- package/dist/dropi-ui/p-DFz-gwFP.js +2 -0
- package/dist/dropi-ui/p-a1944f3d.entry.js +1 -0
- package/dist/dropi-ui/p-c7b9cbda.entry.js +1 -0
- package/dist/dropi-ui/p-dd089a60.entry.js +1 -0
- package/dist/dropi-ui/p-f785011f.entry.js +1 -0
- package/dist/esm/dropi-badge.entry.js +35 -0
- package/dist/esm/dropi-button.entry.js +79 -0
- package/dist/esm/dropi-checkbox.entry.js +34 -0
- package/dist/esm/dropi-icon.entry.js +48 -0
- package/dist/esm/dropi-input.entry.js +208 -0
- package/dist/esm/dropi-radio-button.entry.js +45 -0
- package/dist/esm/dropi-select.entry.js +333 -0
- package/dist/esm/dropi-switch.entry.js +28 -0
- package/dist/esm/dropi-tag.entry.js +66 -0
- package/dist/esm/dropi-text-area.entry.js +101 -0
- package/dist/esm/dropi-ui.js +20 -0
- package/dist/esm/index-DFz-gwFP.js +1734 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +10 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/dropi-badge/dropi-badge.d.ts +12 -0
- package/dist/types/components/dropi-button/dropi-button.d.ts +35 -0
- package/dist/types/components/dropi-checkbox/dropi-checkbox.d.ts +16 -0
- package/dist/types/components/dropi-icon/dropi-icon.d.ts +25 -0
- package/dist/types/components/dropi-input/dropi-input.d.ts +92 -0
- package/dist/types/components/dropi-radio-button/dropi-radio-button.d.ts +25 -0
- package/dist/types/components/dropi-select/dropi-select.d.ts +103 -0
- package/dist/types/components/dropi-select/select.types.d.ts +23 -0
- package/dist/types/components/dropi-switch/dropi-switch.d.ts +15 -0
- package/dist/types/components/dropi-tag/dropi-tag.d.ts +25 -0
- package/dist/types/components/dropi-text-area/dropi-text-area.d.ts +53 -0
- package/dist/types/components.d.ts +1549 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/stencil-public-runtime.d.ts +1860 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/dist/types/utils/utils.unit.test.d.ts +1 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +50 -0
- package/readme.md +89 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-CuGLZVqo.js');
|
|
4
|
+
|
|
5
|
+
const dropiBadgeCss = () => `:host{display:inline-flex}*,*::before,*::after{box-sizing:border-box}.tag-state{border-radius:12px;padding:2px 10px;display:flex;align-items:center;gap:4px}.tag-state svg{width:13px}.tag-state p{font-size:13px;font-weight:500;line-height:20px;margin:0;padding:0}.tag-state.active{background:var(--Success-Success-50, #e7f8f3);color:var(--Success-Success-500, #0abb87)}.tag-state.pending{color:var(--Orange-orange-500, #f49a3d);background:var(--Orange-orange-50, #fef5ec)}.tag-state.canceled,.tag-state.frozen{color:var(--Gray-Gray-500, #69738c);background:var(--Gray-Gray-50, #f7f8fa)}`;
|
|
6
|
+
|
|
7
|
+
const DropiBadge = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
}
|
|
11
|
+
/** Badge state: pending | active | canceled | frozen */
|
|
12
|
+
state = 'pending';
|
|
13
|
+
stateText = {
|
|
14
|
+
pending: 'Pendiente',
|
|
15
|
+
active: 'Activo',
|
|
16
|
+
canceled: 'Cancelado',
|
|
17
|
+
frozen: 'Congelado',
|
|
18
|
+
};
|
|
19
|
+
renderIcon() {
|
|
20
|
+
if (this.state === 'active') {
|
|
21
|
+
return (index.h("svg", { width: "17", height: "17", viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M11.5444 5.87067L12.5389 6.88004L8.43554 10.9225C8.16142 11.1966 7.80087 11.3333 7.43892 11.3333C7.07696 11.3333 6.71287 11.1952 6.43592 10.919L4.46533 9.00929L5.45204 7.99142L7.43042 9.90887L11.5444 5.87067ZM17 8.5C17 13.187 13.187 17 8.5 17C3.81296 17 0 13.187 0 8.5C0 3.81296 3.81296 0 8.5 0C13.187 0 17 3.81296 17 8.5ZM15.5833 8.5C15.5833 4.59425 12.4057 1.41667 8.5 1.41667C4.59425 1.41667 1.41667 4.59425 1.41667 8.5C1.41667 12.4057 4.59425 15.5833 8.5 15.5833C12.4057 15.5833 15.5833 12.4057 15.5833 8.5Z", fill: "currentColor" })));
|
|
22
|
+
}
|
|
23
|
+
if (this.state === 'pending') {
|
|
24
|
+
return (index.h("svg", { width: "17", height: "17", viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M8.5 17C3.81296 17 0 13.187 0 8.5C0 3.81296 3.81296 0 8.5 0C13.187 0 17 3.81296 17 8.5C17 13.187 13.187 17 8.5 17ZM8.5 1.41667C4.59425 1.41667 1.41667 4.59425 1.41667 8.5C1.41667 12.4057 4.59425 15.5833 8.5 15.5833C12.4057 15.5833 15.5833 12.4057 15.5833 8.5C15.5833 4.59425 12.4057 1.41667 8.5 1.41667ZM9.20833 8.5V4.25C9.20833 3.859 8.891 3.54167 8.5 3.54167C8.109 3.54167 7.79167 3.859 7.79167 4.25V7.79167H5.66667C5.27567 7.79167 4.95833 8.109 4.95833 8.5C4.95833 8.891 5.27567 9.20833 5.66667 9.20833H8.5C8.891 9.20833 9.20833 8.891 9.20833 8.5Z", fill: "currentColor" })));
|
|
25
|
+
}
|
|
26
|
+
if (this.state === 'canceled') {
|
|
27
|
+
return (index.h("svg", { width: "12", height: "14", viewBox: "0 0 14 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M11.5497 4.86859V5.76046C12.1075 6.00391 12.5823 6.40464 12.916 6.91364C13.2497 7.42264 13.4279 8.01785 13.4287 8.62648V12.3844C13.4277 13.2146 13.0974 14.0106 12.5103 14.5976C11.9233 15.1847 11.1273 15.515 10.2971 15.516H4.03392C3.20368 15.515 2.40773 15.1847 1.82066 14.5976C1.23359 14.0106 0.903338 13.2146 0.902344 12.3844V8.62648C0.903144 8.01785 1.08129 7.42264 1.41498 6.91364C1.74868 6.40464 2.22347 6.00391 2.78129 5.76046V4.86859C2.78129 3.70582 3.2432 2.59068 4.0654 1.76848C4.8876 0.946282 6.00274 0.484375 7.1655 0.484375C8.32827 0.484375 9.44341 0.946282 10.2656 1.76848C11.0878 2.59068 11.5497 3.70582 11.5497 4.86859ZM4.95114 2.65422C4.36386 3.24151 4.03392 4.03804 4.03392 4.86859V5.4949H10.2971V4.86859C10.2971 4.03804 9.96715 3.24151 9.37986 2.65422C8.79258 2.06694 7.99605 1.73701 7.1655 1.73701C6.33496 1.73701 5.53843 2.06694 4.95114 2.65422ZM11.6257 13.713C11.9781 13.3606 12.176 12.8827 12.176 12.3844V8.62648C12.176 8.12815 11.9781 7.65023 11.6257 7.29786C11.2733 6.94549 10.7954 6.74753 10.2971 6.74753H4.03392C3.53559 6.74753 3.05768 6.94549 2.70531 7.29786C2.35294 7.65023 2.15498 8.12815 2.15498 8.62648V12.3844C2.15498 12.8827 2.35294 13.3606 2.70531 13.713C3.05768 14.0654 3.53559 14.2633 4.03392 14.2633H10.2971C10.7954 14.2633 11.2733 14.0654 11.6257 13.713ZM6.72263 9.43615C6.84009 9.31869 6.99939 9.25271 7.1655 9.25271C7.33161 9.25271 7.49092 9.31869 7.60837 9.43615C7.72583 9.55361 7.79182 9.71291 7.79182 9.87902V11.1317C7.79182 11.2978 7.72583 11.4571 7.60837 11.5745C7.49092 11.692 7.33161 11.758 7.1655 11.758C6.99939 11.758 6.84009 11.692 6.72263 11.5745C6.60517 11.4571 6.53919 11.2978 6.53919 11.1317V9.87902C6.53919 9.71291 6.60517 9.55361 6.72263 9.43615Z", fill: "currentColor" })));
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
return (index.h("div", { key: 'b66590d82d7dd760badcfb76c72eb3d589073721', class: `tag-state ${this.state}` }, this.renderIcon(), index.h("p", { key: '82ae7072f3ac6d96ed02db8289f0f98f070a882d' }, this.stateText[this.state])));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
DropiBadge.style = dropiBadgeCss();
|
|
36
|
+
|
|
37
|
+
exports.dropi_badge = DropiBadge;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-CuGLZVqo.js');
|
|
4
|
+
|
|
5
|
+
const dropiButtonCss = () => `:host{display:inline-block}*,*::before,*::after{box-sizing:border-box}.btn{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:var(--Size-1, 4px);border-radius:var(--Border-2, 8px);font-weight:700;min-width:33px;line-height:110%;cursor:pointer;white-space:nowrap;transition:background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s ease}.btn:active{transition:transform 0.01s ease-out;transform:scale(0.98)}.btn:hover:not(:active){transform:scale(1.01)}.btn.without-text{gap:0}.btn.large{padding:var(--Size-4, 16px);font-size:var(--Size-4, 16px);height:48px}.btn.normal{padding:var(--Size-3, 12px);font-size:var(--font-size-s, 12px);height:40px}.btn.small{padding:var(--Size-2, 8px);font-size:var(--Size-3, 12px);height:29px}.btn.disabled,.btn.loading{cursor:not-allowed;pointer-events:none}.btn.primary.default{background:var(--Primary-Primary-500, #f49a3d);color:var(--Neutral-White, #fff)}.btn.primary.default:hover{background:var(--Primary-Primary-600, #e58017)}.btn.primary.success{background:var(--Success-Success-500, #0abb87);color:var(--Neutral-White, #fff)}.btn.primary.success:hover{background:var(--Success-Success-600, #09aa7b)}.btn.primary.info{background:var(--Info-Info-500, #50a5f1);color:var(--Neutral-White, #fff)}.btn.primary.info:hover{background:var(--Info-Info-600, #4996db)}.btn.primary.error{background:var(--Error-Error-500, #f46a6b);color:var(--Neutral-White, #fff)}.btn.primary.error:hover{background:var(--Error-Error-600, #de6061)}.btn.primary.warning{background:var(--Warning-Warning-500, #f1b44c);color:var(--Neutral-White, #fff)}.btn.primary.warning:hover{background:var(--Warning-Warning-600, #dba445)}.btn.primary.legacy{background:var(--Secondary-Secondary-500, #008dbf);color:var(--Neutral-White, #fff)}.btn.primary.legacy:hover{background:var(--Secondary-Secondary-600, #007199)}.btn.primary.disabled.default{background:var(--Primary-Primary-300, #f2bc85);color:var(--Neutral-White, #fff)}.btn.primary.disabled.success{background:var(--Success-Success-300, #5bd1af);color:var(--Neutral-White, #fff)}.btn.primary.disabled.info{background:var(--Info-Info-300, #8ac3f6);color:var(--Neutral-White, #fff)}.btn.primary.disabled.error{background:var(--Error-Error-300, #f89b9c);color:var(--Neutral-White, #fff)}.btn.primary.disabled.warning{background:var(--Warning-Warning-300, #f6cd87);color:var(--Neutral-White, #fff)}.btn.primary.disabled.legacy{background:var(--Secondary-Secondary-300, #62bad9);color:var(--Neutral-White, #fff)}.btn.secondary{background:var(--Neutral-White, #fff);border:1px solid}.btn.secondary.default{border-color:var(--Primary-Primary-500, #f49a3d);color:var(--Primary-Primary-500, #f49a3d)}.btn.secondary.default:hover{color:var(--Primary-Primary-600, #e58017);border-color:var(--Primary-Primary-600, #e58017)}.btn.secondary.success{border-color:var(--Success-Success-500, #0abb87);color:var(--Success-Success-500, #0abb87)}.btn.secondary.success:hover{color:var(--Success-Success-600, #09aa7b);border-color:var(--Success-Success-600, #09aa7b)}.btn.secondary.info{border-color:var(--Info-Info-500, #50a5f1);color:var(--Info-Info-500, #50a5f1)}.btn.secondary.info:hover{color:var(--Info-Info-600, #4996db);border-color:var(--Info-Info-600, #4996db)}.btn.secondary.error{border-color:var(--Error-Error-500, #f46a6b);color:var(--Error-Error-500, #f46a6b)}.btn.secondary.error:hover{color:var(--Error-Error-600, #de6061);border-color:var(--Error-Error-600, #de6061)}.btn.secondary.warning{border-color:var(--Warning-Warning-500, #f1b44c);color:var(--Warning-Warning-500, #f1b44c)}.btn.secondary.warning:hover{color:var(--Warning-Warning-600, #dba445);border-color:var(--Warning-Warning-600, #dba445)}.btn.secondary.legacy{border-color:var(--Secondary-Secondary-500, #008dbf);color:var(--Secondary-Secondary-500, #008dbf)}.btn.secondary.legacy:hover{color:var(--Secondary-Secondary-600, #007199);border-color:var(--Secondary-Secondary-600, #007199)}.btn.secondary.disabled.default{border-color:var(--Primary-Primary-300, #f2bc85);color:var(--Primary-Primary-300, #f2bc85)}.btn.secondary.disabled.success{border-color:var(--Success-Success-300, #5bd1af);color:var(--Success-Success-300, #5bd1af)}.btn.secondary.disabled.info{border-color:var(--Info-Info-300, #8ac3f6);color:var(--Info-Info-300, #8ac3f6)}.btn.secondary.disabled.error{border-color:var(--Error-Error-300, #f89b9c);color:var(--Error-Error-300, #f89b9c)}.btn.secondary.disabled.warning{border-color:var(--Warning-Warning-300, #f6cd87);color:var(--Warning-Warning-300, #f6cd87)}.btn.secondary.disabled.legacy{border-color:var(--Secondary-Secondary-300, #62bad9);color:var(--Secondary-Secondary-300, #62bad9)}.btn.tertiary{background:none;border:none}.btn.tertiary.default,.btn.tertiary.legacy{border:1px solid var(--Gray-Gray-200, #c3c9d9);color:var(--Gray-Gray-500, #69738c)}.btn.tertiary.default:hover,.btn.tertiary.legacy:hover{border-color:var(--Gray-Gray-400, #858ea6);color:var(--Gray-Gray-600, #475066)}.btn.tertiary.success{color:var(--Success-Success-500, #0abb87)}.btn.tertiary.success:hover{background:var(--Success-Success-50, #e7f8f3)}.btn.tertiary.info{color:var(--Info-Info-500, #50a5f1)}.btn.tertiary.info:hover{background:var(--Info-Info-50, #eef6fe)}.btn.tertiary.error{color:var(--Error-Error-500, #f46a6b)}.btn.tertiary.error:hover{background:var(--Error-Error-50, #fef0f0)}.btn.tertiary.warning{color:var(--Warning-Warning-500, #f1b44c)}.btn.tertiary.warning:hover{background:var(--Warning-Warning-50, #fef8ed)}.btn.tertiary.dropdown{color:var(--Gray-Gray-500, #69738c);font-weight:400;font-size:14px;background:transparent}.btn.tertiary.disabled.default,.btn.tertiary.disabled.legacy{border:1px solid var(--Gray-Gray-200, #c3c9d9);color:var(--Gray-Gray-400, #858ea6)}.btn.tertiary.disabled.success{color:var(--Success-Success-300, #5bd1af)}.btn.tertiary.disabled.info{color:var(--Info-Info-300, #8ac3f6)}.btn.tertiary.disabled.error{color:var(--Error-Error-300, #f89b9c)}.btn.tertiary.disabled.warning{color:var(--Warning-Warning-300, #f6cd87)}.spin{animation:spin 1s linear infinite}@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}`;
|
|
6
|
+
|
|
7
|
+
const DropiButton = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
this.dropiClick = index.createEvent(this, "dropiClick");
|
|
11
|
+
}
|
|
12
|
+
/** Visual color palette */
|
|
13
|
+
type = 'default';
|
|
14
|
+
/** Primary (filled) | Secondary (outlined) | Tertiary (ghost) */
|
|
15
|
+
severity = 'primary';
|
|
16
|
+
/** Button size */
|
|
17
|
+
size = 'normal';
|
|
18
|
+
/** Button state */
|
|
19
|
+
state = 'default';
|
|
20
|
+
/** Icon name to show before the text */
|
|
21
|
+
preIcon = '';
|
|
22
|
+
/** Icon name to show after the text */
|
|
23
|
+
postIcon = '';
|
|
24
|
+
/** Button label */
|
|
25
|
+
text = '';
|
|
26
|
+
/** Emitted on click (not emitted when disabled or loading) */
|
|
27
|
+
dropiClick;
|
|
28
|
+
colorMap = {
|
|
29
|
+
default: 'Primary-Primary-',
|
|
30
|
+
success: 'Success-Success-',
|
|
31
|
+
error: 'Error-Error-',
|
|
32
|
+
info: 'Info-Info-',
|
|
33
|
+
legacy: 'Secondary-Secondary-',
|
|
34
|
+
warning: 'Warning-Warning-',
|
|
35
|
+
dropdown: 'Gray-Gray-',
|
|
36
|
+
};
|
|
37
|
+
get iconSize() {
|
|
38
|
+
if (this.size === 'large')
|
|
39
|
+
return '24px';
|
|
40
|
+
if (this.size === 'small')
|
|
41
|
+
return '16px';
|
|
42
|
+
return '18px';
|
|
43
|
+
}
|
|
44
|
+
get color() {
|
|
45
|
+
const intensity = this.state === 'disabled' ? '300' : '500';
|
|
46
|
+
return (this.colorMap[this.type] ?? 'Primary-Primary-') + intensity;
|
|
47
|
+
}
|
|
48
|
+
get fontColor() {
|
|
49
|
+
if (this.severity === 'tertiary') {
|
|
50
|
+
return this.type === 'default' || this.type === 'legacy' ? 'Gray-Gray-500' : this.color;
|
|
51
|
+
}
|
|
52
|
+
if (this.severity === 'secondary')
|
|
53
|
+
return this.color;
|
|
54
|
+
return 'Neutral-White';
|
|
55
|
+
}
|
|
56
|
+
handleClick(e) {
|
|
57
|
+
if (this.state !== 'disabled' && this.state !== 'loading') {
|
|
58
|
+
this.dropiClick.emit(e);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
renderLoadingSpinner() {
|
|
62
|
+
return (index.h("svg", { class: "spin", width: this.iconSize, height: this.iconSize, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M22.8 12C23.4627 12 24.0062 11.4614 23.9401 10.802C23.8232 9.6371 23.5362 8.49339 23.0866 7.4078C22.4835 5.95189 21.5996 4.62902 20.4853 3.51472C19.371 2.40042 18.0481 1.5165 16.5922 0.913445C15.5066 0.463778 14.3629 0.17683 13.198 0.0599502C12.5386 -0.00621439 12 0.537258 12 1.2C12 1.86274 12.5393 2.39227 13.1969 2.4749C14.0463 2.58164 14.8795 2.80176 15.6738 3.13076C16.8385 3.6132 17.8968 4.32033 18.7882 5.21177C19.6797 6.10322 20.3868 7.16151 20.8692 8.32624C21.1982 9.12051 21.4184 9.95367 21.5251 10.8031C21.6077 11.4607 22.1373 12 22.8 12Z", fill: `var(--${this.fontColor})` })));
|
|
63
|
+
}
|
|
64
|
+
render() {
|
|
65
|
+
const isDisabled = this.state === 'disabled' || this.state === 'loading';
|
|
66
|
+
const hasText = this.text !== '';
|
|
67
|
+
const showPostIcon = this.postIcon !== '' || this.type === 'dropdown';
|
|
68
|
+
const dropdownIcon = this.type === 'dropdown' ? 'Dropdown-down' : this.postIcon;
|
|
69
|
+
return (index.h("button", { key: '6cde7f2616d1cff9e3304481f2a0c38aabc34192', class: {
|
|
70
|
+
btn: true,
|
|
71
|
+
'without-text': !hasText,
|
|
72
|
+
[this.severity]: true,
|
|
73
|
+
[this.type]: true,
|
|
74
|
+
[this.size]: true,
|
|
75
|
+
[this.state]: true,
|
|
76
|
+
}, disabled: isDisabled, onClick: (e) => this.handleClick(e) }, this.preIcon && (index.h("dropi-icon", { key: '769cea8fce2947552462aa2cbbb09d64df952c76', name: this.preIcon, width: this.iconSize, height: this.iconSize, color: this.fontColor })), hasText && index.h("span", { key: 'f66ad80283d54f643cf37ea702145127b90d4ce4', class: "text" }, this.text), showPostIcon && (index.h("dropi-icon", { key: '4fd9c7d7d029c3316bc0492576cda0cca74fa460', name: dropdownIcon, width: this.iconSize, height: this.iconSize, color: this.fontColor })), this.state === 'loading' && this.renderLoadingSpinner(), index.h("slot", { key: '3280c56a28ea40016d35e186b9997635b8ba881b' })));
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
DropiButton.style = dropiButtonCss();
|
|
80
|
+
|
|
81
|
+
exports.dropi_button = DropiButton;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-CuGLZVqo.js');
|
|
4
|
+
|
|
5
|
+
const dropiCheckboxCss = () => `:host{display:inline-block}*,*::before,*::after{box-sizing:border-box}.container-dropi-checkbox{display:inline-block}.check{width:20px;height:20px;border-radius:var(--Border-1, 4px);cursor:pointer;transition:background-color 0.3s ease-in-out, border-style 0.3s ease-in-out}.noCheck{border-style:solid;border-width:2px;border-color:var(--Gray-Gray-200, #c3c9d9);display:flex;justify-content:center;align-items:center}.noCheck svg{visibility:hidden}.isCheck{display:flex;background-color:var(--Primary-Primary-500, #f49a3d);justify-content:center;align-items:center}.disabled{background-color:var(--Gray-Gray-50, #f7f8fa);border-color:var(--Gray-Gray-100, #e6eaf2);cursor:not-allowed}`;
|
|
6
|
+
|
|
7
|
+
const DropiCheckbox = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
this.dropiChange = index.createEvent(this, "dropiChange");
|
|
11
|
+
}
|
|
12
|
+
/** Whether the checkbox is checked */
|
|
13
|
+
checked = false;
|
|
14
|
+
/** Whether the checkbox is disabled */
|
|
15
|
+
disabled = false;
|
|
16
|
+
/** Emitted when the checked state changes */
|
|
17
|
+
dropiChange;
|
|
18
|
+
changeState() {
|
|
19
|
+
if (this.disabled)
|
|
20
|
+
return;
|
|
21
|
+
this.checked = !this.checked;
|
|
22
|
+
this.dropiChange.emit(this.checked);
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return (index.h("div", { key: 'e5c7ef2fd09e5e18b71cbbdd96cc13d4fd99b8a5', class: "container-dropi-checkbox", onClick: () => this.changeState() }, index.h("div", { key: '2b6a006125e8e68fbba9285451d0d7a578c183d2', class: {
|
|
26
|
+
check: true,
|
|
27
|
+
isCheck: this.checked,
|
|
28
|
+
noCheck: !this.checked,
|
|
29
|
+
disabled: this.disabled,
|
|
30
|
+
} }, index.h("svg", { key: 'ce19f7e7e1159ee2915a78827775bd969484aa4a', xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none" }, index.h("path", { key: 'f41304ce433c5ea47f8eb964278e1a4c2c8184b2', d: "M20.5991 5.69251L9.08325 17.2075C9.00583 17.2852 8.91382 17.3469 8.8125 17.389C8.71118 17.4311 8.60255 17.4527 8.49283 17.4527C8.38312 17.4527 8.27449 17.4311 8.17317 17.389C8.07185 17.3469 7.97984 17.2852 7.90242 17.2075L3.44908 12.75C3.37166 12.6723 3.27965 12.6106 3.17833 12.5685C3.07701 12.5264 2.96838 12.5048 2.85867 12.5048C2.74896 12.5048 2.64032 12.5264 2.53901 12.5685C2.43769 12.6106 2.34568 12.6723 2.26825 12.75C2.19052 12.8274 2.12884 12.9194 2.08676 13.0208C2.04467 13.1221 2.02301 13.2307 2.02301 13.3404C2.02301 13.4501 2.04467 13.5588 2.08676 13.6601C2.12884 13.7614 2.19052 13.8534 2.26825 13.9308L6.72325 18.385C7.19321 18.8541 7.83008 19.1175 8.49408 19.1175C9.15809 19.1175 9.79496 18.8541 10.2649 18.385L21.7799 6.87251C21.8575 6.7951 21.9191 6.70314 21.9611 6.6019C22.0031 6.50065 22.0247 6.39212 22.0247 6.28251C22.0247 6.17289 22.0031 6.06436 21.9611 5.96312C21.9191 5.86188 21.8575 5.76992 21.7799 5.69251C21.7025 5.61478 21.6105 5.5531 21.5092 5.51101C21.4078 5.46893 21.2992 5.44727 21.1895 5.44727C21.0798 5.44727 20.9712 5.46893 20.8698 5.51101C20.7685 5.5531 20.6765 5.61478 20.5991 5.69251Z", fill: "#FFFFFF" })))));
|
|
31
|
+
}
|
|
32
|
+
static get formAssociated() { return true; }
|
|
33
|
+
};
|
|
34
|
+
DropiCheckbox.style = dropiCheckboxCss();
|
|
35
|
+
|
|
36
|
+
exports.dropi_checkbox = DropiCheckbox;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-CuGLZVqo.js');
|
|
4
|
+
|
|
5
|
+
const dropiIconCss = () => `:host{display:inline-flex;align-items:center;justify-content:center;fill:var(--icon-fill, currentColor)}svg{fill:inherit}.spin{animation:spin 1s linear infinite}@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}`;
|
|
6
|
+
|
|
7
|
+
const DropiIcon = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
}
|
|
11
|
+
get el() { return index.getElement(this); }
|
|
12
|
+
/** Icon name matching the id in the SVG sprite */
|
|
13
|
+
name = '';
|
|
14
|
+
/** Width of the icon (CSS value) */
|
|
15
|
+
width = '24px';
|
|
16
|
+
/** Height of the icon (CSS value) */
|
|
17
|
+
height = '24px';
|
|
18
|
+
/**
|
|
19
|
+
* Color of the icon. Accepts:
|
|
20
|
+
* - Hex color: `#ff0000`
|
|
21
|
+
* - CSS variable name without `--`: `Primary-Primary-500`
|
|
22
|
+
* - `currentColor` to inherit
|
|
23
|
+
*/
|
|
24
|
+
color = 'currentColor';
|
|
25
|
+
colorChanged() {
|
|
26
|
+
this.applyColor();
|
|
27
|
+
}
|
|
28
|
+
componentDidLoad() {
|
|
29
|
+
this.applyColor();
|
|
30
|
+
}
|
|
31
|
+
applyColor() {
|
|
32
|
+
const fill = this.color.startsWith('#')
|
|
33
|
+
? this.color
|
|
34
|
+
: this.color === 'currentColor'
|
|
35
|
+
? 'currentColor'
|
|
36
|
+
: `var(--${this.color})`;
|
|
37
|
+
this.el.style.setProperty('--icon-fill', fill);
|
|
38
|
+
}
|
|
39
|
+
render() {
|
|
40
|
+
return (index.h("svg", { key: 'e71bfb0be9f68882bbd7314d0f6f3fd877fccf07', width: this.width, height: this.height, class: { spin: this.name === 'Spinner' }, "aria-hidden": "true" }, index.h("use", { key: 'e6905c3ba9c68f463db62cde2cd64ce51093c2c0', href: `/assets/icons/symbol/svg/sprite.css.svg#${this.name}` })));
|
|
41
|
+
}
|
|
42
|
+
static get watchers() { return {
|
|
43
|
+
"color": [{
|
|
44
|
+
"colorChanged": 0
|
|
45
|
+
}]
|
|
46
|
+
}; }
|
|
47
|
+
};
|
|
48
|
+
DropiIcon.style = dropiIconCss();
|
|
49
|
+
|
|
50
|
+
exports.dropi_icon = DropiIcon;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-CuGLZVqo.js');
|
|
4
|
+
|
|
5
|
+
const dropiInputCss = () => `:host{display:block;width:100%;text-align:left}*,*::before,*::after{box-sizing:border-box}.fixed-label-container{display:flex;width:100%;flex-direction:column;align-items:flex-start;gap:8px;text-align:left}.input-label{color:var(--Gray-Gray-600, #475066);font-size:var(--font-size-xs, 10px);font-weight:var(--font-weight-regular, 400)}.asterisk{color:var(--Error-Error-500, #f46a6b)}.form-group{position:relative;width:100%;text-align:left}.input-container{position:relative}.icon-input{position:absolute;top:10px;left:5px;z-index:1}.icon-input-password{position:absolute;top:10px;right:13px;cursor:pointer;z-index:1}.form-control{box-sizing:border-box;width:100%;padding:var(--Size-2, 8px);border:1px solid var(--Gray-Gray-200, #c3c9d9);border-radius:var(--Border-2, 8px);background:var(--Neutral-White, #fff);font-size:var(--font-size-s, 12px);font-family:inherit;color:var(--Gray-Gray-700, #32394d);transition:border-color 0.3s ease-in-out;height:40px;outline:none;appearance:none;text-align:left}.form-control::placeholder{color:transparent;transition:color 0.2s ease-in-out}.form-control:focus::placeholder,.fixed-label-input::placeholder{color:var(--Gray-Gray-400, #858ea6)}.form-control:focus{border-color:var(--Info-Info-500, #50a5f1)}.form-control-valid{border-color:var(--Gray-Gray-400, #858ea6) !important;color:var(--Gray-Gray-600, #475066)}.form-control-invalid{border-color:var(--Error-Error-500, #f46a6b) !important;color:var(--Gray-Gray-600, #475066)}.form-control:disabled{border-color:var(--Gray-Gray-200, #c3c9d9) !important;color:var(--Gray-Gray-400, #858ea6);background-color:var(--Gray-Gray-50, #f7f8fa);cursor:not-allowed}.padding-icon{padding-left:28px}.text-password{-webkit-text-security:disc;text-security:disc}label.label-bottom{position:absolute;font-weight:var(--font-weight-regular, 400);top:10px;font-size:var(--font-size-s, 12px);color:var(--Gray-Gray-500, #69738c);left:10px;transition:all 0.2s ease-in-out;pointer-events:none;overflow:hidden;width:90%;white-space:nowrap}.form-control:focus+label.label-bottom,.form-control:not(:placeholder-shown)+label.label-bottom{top:-22px;left:0;font-size:var(--font-size-xs, 10px);color:var(--Gray-Gray-600, #475066);width:unset}.form-control:disabled+label.label-bottom{color:var(--Gray-Gray-400, #858ea6)}.form-control-helper{display:flex;position:absolute;top:100%;left:0;gap:4px;align-items:center;margin-top:4px}.form-control-helper span{display:block;color:var(--Gray-Gray-600, #475066);font-size:var(--font-size-xs, 10px)}.invalid-color{color:var(--Error-Error-500, #f46a6b) !important}.disabled-helper{color:var(--Gray-Gray-400, #858ea6) !important}`;
|
|
6
|
+
|
|
7
|
+
const DropiInput = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
this.dropiInput = index.createEvent(this, "dropiInput");
|
|
11
|
+
this.dropiChange = index.createEvent(this, "dropiChange");
|
|
12
|
+
this.dropiFocus = index.createEvent(this, "dropiFocus");
|
|
13
|
+
this.dropiBlur = index.createEvent(this, "dropiBlur");
|
|
14
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
15
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
19
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
internals;
|
|
23
|
+
// ── Identification ──────────────────────────────────────────
|
|
24
|
+
/** Input id. Defaults to label value. */
|
|
25
|
+
inputId = '';
|
|
26
|
+
/** Name attribute for native form submission */
|
|
27
|
+
name = '';
|
|
28
|
+
// ── Content ─────────────────────────────────────────────────
|
|
29
|
+
/** Floating or fixed label text */
|
|
30
|
+
label = '';
|
|
31
|
+
/** Placeholder text (visible in fixedLabel mode or on focus) */
|
|
32
|
+
placeholder = ' ';
|
|
33
|
+
/** Current value (controlled) */
|
|
34
|
+
value = '';
|
|
35
|
+
/** Max character length */
|
|
36
|
+
maxlength;
|
|
37
|
+
// ── Behavior ────────────────────────────────────────────────
|
|
38
|
+
/** Disable the input */
|
|
39
|
+
disabled = false;
|
|
40
|
+
/** Mark as required (shows asterisk when showAsterisk is true) */
|
|
41
|
+
required = false;
|
|
42
|
+
/** Show the required asterisk on the label */
|
|
43
|
+
showAsterisk = true;
|
|
44
|
+
/** Show label above the input (fixed), instead of floating inside */
|
|
45
|
+
fixedLabel = false;
|
|
46
|
+
/** Keyboard input mode hint */
|
|
47
|
+
inputMode = 'text';
|
|
48
|
+
// ── Input type modifiers ────────────────────────────────────
|
|
49
|
+
/** Show password visibility toggle (renders as password field) */
|
|
50
|
+
passwordInput = false;
|
|
51
|
+
/** Apply thousand separator formatting (e.g. 1,000,000) */
|
|
52
|
+
moneyFormat = false;
|
|
53
|
+
/** Apply thousand separator without currency symbol */
|
|
54
|
+
thousandSeparator = false;
|
|
55
|
+
/** Only allow numeric characters */
|
|
56
|
+
onlyNumbers = false;
|
|
57
|
+
/** Allow decimal point when onlyNumbers is true */
|
|
58
|
+
allowDecimals = false;
|
|
59
|
+
/** Only allow letter characters */
|
|
60
|
+
onlyLetters = false;
|
|
61
|
+
// ── Icon ────────────────────────────────────────────────────
|
|
62
|
+
/** Icon name shown inside the input (only visible when value is not empty) */
|
|
63
|
+
icon = '';
|
|
64
|
+
/** Color token for the icon */
|
|
65
|
+
iconColor = 'Gray-Gray-400';
|
|
66
|
+
// ── Validation ──────────────────────────────────────────────
|
|
67
|
+
/** Mark the field as invalid (consumer-controlled) */
|
|
68
|
+
invalid = false;
|
|
69
|
+
/** Helper / error text shown below the field */
|
|
70
|
+
helperText = '';
|
|
71
|
+
/** Only show helperText when the field is invalid */
|
|
72
|
+
showHelperOnlyOnError = false;
|
|
73
|
+
// ── Internal state ──────────────────────────────────────────
|
|
74
|
+
showPassword = false;
|
|
75
|
+
touched = false;
|
|
76
|
+
// ── Events ──────────────────────────────────────────────────
|
|
77
|
+
/** Emitted on every keystroke with the current value */
|
|
78
|
+
dropiInput;
|
|
79
|
+
/** Emitted on blur with the final value */
|
|
80
|
+
dropiChange;
|
|
81
|
+
/** Emitted on focus */
|
|
82
|
+
dropiFocus;
|
|
83
|
+
/** Emitted on blur */
|
|
84
|
+
dropiBlur;
|
|
85
|
+
valueChanged(val) {
|
|
86
|
+
this.internals.setFormValue(val);
|
|
87
|
+
}
|
|
88
|
+
disabledChanged(val) {
|
|
89
|
+
this.internals.setValidity(val ? { customError: true } : {}, val ? 'Field is disabled' : '');
|
|
90
|
+
}
|
|
91
|
+
componentWillLoad() {
|
|
92
|
+
this.internals.setFormValue(this.value ?? '');
|
|
93
|
+
}
|
|
94
|
+
// ── Handlers ────────────────────────────────────────────────
|
|
95
|
+
handleInput(e) {
|
|
96
|
+
let val = e.target.value;
|
|
97
|
+
if (this.onlyNumbers)
|
|
98
|
+
val = this.filterNumbers(val);
|
|
99
|
+
if (this.onlyLetters)
|
|
100
|
+
val = this.filterLetters(val);
|
|
101
|
+
if (this.moneyFormat || this.thousandSeparator)
|
|
102
|
+
val = this.formatThousands(val, this.moneyFormat);
|
|
103
|
+
this.value = val;
|
|
104
|
+
this.internals.setFormValue(val);
|
|
105
|
+
this.dropiInput.emit(val);
|
|
106
|
+
}
|
|
107
|
+
handleKeyDown(e) {
|
|
108
|
+
if (this.onlyNumbers && !this.isAllowedNumberKey(e)) {
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
}
|
|
111
|
+
if (this.onlyLetters && !this.isAllowedLetterKey(e)) {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
handleFocus() {
|
|
116
|
+
this.dropiFocus.emit();
|
|
117
|
+
}
|
|
118
|
+
handleBlur() {
|
|
119
|
+
this.touched = true;
|
|
120
|
+
this.dropiChange.emit(this.value);
|
|
121
|
+
this.dropiBlur.emit();
|
|
122
|
+
}
|
|
123
|
+
togglePassword() {
|
|
124
|
+
if (this.disabled)
|
|
125
|
+
return;
|
|
126
|
+
this.showPassword = !this.showPassword;
|
|
127
|
+
}
|
|
128
|
+
// ── Helpers ─────────────────────────────────────────────────
|
|
129
|
+
filterNumbers(val) {
|
|
130
|
+
const pattern = this.allowDecimals ? /[^0-9.]/g : /[^0-9]/g;
|
|
131
|
+
return val.replace(pattern, '');
|
|
132
|
+
}
|
|
133
|
+
filterLetters(val) {
|
|
134
|
+
return val.replace(/[^a-zA-ZáéíóúÁÉÍÓÚñÑüÜ\s]/g, '');
|
|
135
|
+
}
|
|
136
|
+
isAllowedNumberKey(e) {
|
|
137
|
+
const allowed = ['Backspace', 'Delete', 'ArrowLeft', 'ArrowRight', 'Tab', 'Enter', 'Home', 'End'];
|
|
138
|
+
if (allowed.includes(e.key))
|
|
139
|
+
return true;
|
|
140
|
+
if (e.ctrlKey || e.metaKey)
|
|
141
|
+
return true; // copy/paste/select-all
|
|
142
|
+
if (/^[0-9]$/.test(e.key))
|
|
143
|
+
return true;
|
|
144
|
+
if (this.allowDecimals && e.key === '.')
|
|
145
|
+
return true;
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
isAllowedLetterKey(e) {
|
|
149
|
+
const allowed = ['Backspace', 'Delete', 'ArrowLeft', 'ArrowRight', 'Tab', 'Enter', 'Home', 'End', ' '];
|
|
150
|
+
if (allowed.includes(e.key))
|
|
151
|
+
return true;
|
|
152
|
+
if (e.ctrlKey || e.metaKey)
|
|
153
|
+
return true;
|
|
154
|
+
return /^[a-zA-ZáéíóúÁÉÍÓÚñÑüÜ]$/.test(e.key);
|
|
155
|
+
}
|
|
156
|
+
formatThousands(val, withCurrency) {
|
|
157
|
+
const raw = val.replace(/[^0-9.]/g, '');
|
|
158
|
+
const [integer, decimal] = raw.split('.');
|
|
159
|
+
const formatted = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
160
|
+
const result = decimal !== undefined ? `${formatted}.${decimal}` : formatted;
|
|
161
|
+
return withCurrency ? `$${result}` : result;
|
|
162
|
+
}
|
|
163
|
+
// ── Computed ─────────────────────────────────────────────────
|
|
164
|
+
get resolvedId() {
|
|
165
|
+
return this.inputId || this.label;
|
|
166
|
+
}
|
|
167
|
+
get inputType() {
|
|
168
|
+
if (this.passwordInput)
|
|
169
|
+
return this.showPassword ? 'text' : 'password';
|
|
170
|
+
return 'text';
|
|
171
|
+
}
|
|
172
|
+
get showHelper() {
|
|
173
|
+
if (!this.helperText)
|
|
174
|
+
return false;
|
|
175
|
+
if (this.showHelperOnlyOnError)
|
|
176
|
+
return this.invalid && this.touched;
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
get isInvalid() {
|
|
180
|
+
return this.invalid && this.touched;
|
|
181
|
+
}
|
|
182
|
+
// ── Render ───────────────────────────────────────────────────
|
|
183
|
+
render() {
|
|
184
|
+
const showAsterisk = this.required && this.showAsterisk && !this.disabled;
|
|
185
|
+
const showIconInline = !!this.icon && !!this.value;
|
|
186
|
+
return (index.h("div", { key: '4ea9c2118e6452345a2a92eedc807e6d94019784', class: { 'fixed-label-container': this.fixedLabel } }, this.fixedLabel && (index.h("div", { key: 'b8c1269e9d583becd9614f6f3c28f6a2b536f18f', class: "input-label Body-S-Regular" }, this.label, showAsterisk && index.h("span", { key: '945665772caab1a1c95f1a054dea1b8dd88287a3', class: "asterisk" }, " *"))), index.h("div", { key: 'f550584dde83c907429255d9a98b8a59ff322cbb', class: "form-group" }, index.h("div", { key: '6cc46f5822e62d59bb211e7d9eb7909ab2b833c9', class: "input-container" }, showIconInline && (index.h("dropi-icon", { key: 'c860e808ae7cd805aa9c430d52743f7eab0aaeba', class: "icon-input", name: this.icon, color: this.iconColor, width: "20px", height: "20px" })), this.passwordInput && (index.h("dropi-icon", { key: 'ba571d4d14ec2a911a8b0bd4cdc7a8481aebe746', class: "icon-input-password", name: this.showPassword ? 'Eye' : 'Eye-crossed', width: "20px", height: "20px", color: "Gray-Gray-500", onClick: () => this.togglePassword() })), index.h("input", { key: 'aad18a94d94c9600236bac7c23e38b1c1c41f06a', id: this.resolvedId, class: {
|
|
187
|
+
'form-control': true,
|
|
188
|
+
'form-control-valid': !this.isInvalid && this.touched && !!this.value,
|
|
189
|
+
'form-control-invalid': this.isInvalid,
|
|
190
|
+
'padding-icon': showIconInline,
|
|
191
|
+
'text-password': this.passwordInput && !this.showPassword,
|
|
192
|
+
'fixed-label-input': this.fixedLabel,
|
|
193
|
+
}, type: this.inputType, value: this.value, placeholder: this.fixedLabel ? this.placeholder : ' ', disabled: this.disabled, required: this.required, maxLength: this.maxlength, inputMode: this.inputMode, "data-cy": undefined, onInput: (e) => this.handleInput(e), onKeyDown: (e) => this.handleKeyDown(e), onFocus: () => this.handleFocus(), onBlur: () => this.handleBlur() }), !this.fixedLabel && (index.h("label", { key: '8ba7ea50525aa8990662d45829ba732094c41f80', class: "Body-S-Regular label-bottom", htmlFor: this.resolvedId }, this.label, showAsterisk && index.h("span", { key: '3916d3de6392da62b8086920cd2fce3b96238416', class: "asterisk" }, " *"))), this.showHelper && (index.h("div", { key: '83e17f7d0cdb503b86fd035775e1cb45d9f41709', class: "form-control-helper" }, this.isInvalid && (index.h("dropi-icon", { key: '4e034348270853f8a3aafbbbb938a5974076aebd', name: "Warning-circle", width: "12px", height: "12px", color: "Error-Error-500" })), index.h("span", { key: '7832f200ccc6f6273d65012b9e642c313399a277', class: {
|
|
194
|
+
'disabled-helper': this.disabled,
|
|
195
|
+
'invalid-color': this.isInvalid,
|
|
196
|
+
} }, this.helperText)))))));
|
|
197
|
+
}
|
|
198
|
+
static get formAssociated() { return true; }
|
|
199
|
+
static get watchers() { return {
|
|
200
|
+
"value": [{
|
|
201
|
+
"valueChanged": 0
|
|
202
|
+
}],
|
|
203
|
+
"disabled": [{
|
|
204
|
+
"disabledChanged": 0
|
|
205
|
+
}]
|
|
206
|
+
}; }
|
|
207
|
+
};
|
|
208
|
+
DropiInput.style = dropiInputCss();
|
|
209
|
+
|
|
210
|
+
exports.dropi_input = DropiInput;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-CuGLZVqo.js');
|
|
4
|
+
|
|
5
|
+
const dropiRadioButtonCss = () => `:host{display:inline-block}*,*::before,*::after{box-sizing:border-box}.dropi-radio-button{display:flex;align-items:center;justify-content:flex-start;gap:20px}label{display:flex;align-items:center;gap:8px;cursor:pointer;color:var(--Gray-Gray-700, #32394d);font-size:var(--font-size-s, 12px);font-weight:var(--font-weight-regular, 400);line-height:1.5}input[type='radio']{appearance:none;width:20px;height:20px;border:2px solid var(--Gray-Gray-200, #c3c9d9);border-radius:50%;background-color:transparent;position:relative;cursor:pointer;outline:none;flex-shrink:0;display:flex;justify-content:center;align-items:center}input[type='radio']::before{content:'';position:absolute;top:3px;left:3px;width:10px;height:10px;background-color:var(--Primary-Primary-400, #f7b46f);border-radius:50%;display:none}input[type='radio']:checked{border:2px solid var(--Primary-Primary-500, #f49a3d)}input[type='radio']:checked::before{display:block}`;
|
|
6
|
+
|
|
7
|
+
const DropiRadioButton = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
this.dropiChange = index.createEvent(this, "dropiChange");
|
|
11
|
+
}
|
|
12
|
+
/** Label text displayed next to the radio */
|
|
13
|
+
label = '';
|
|
14
|
+
/** Input name (for grouping radio buttons) */
|
|
15
|
+
name = 'radio';
|
|
16
|
+
/** Input id */
|
|
17
|
+
inputId = 'radioButton';
|
|
18
|
+
/** Whether this radio is selected */
|
|
19
|
+
checked = false;
|
|
20
|
+
/**
|
|
21
|
+
* Set to true to programmatically reset this radio to unchecked.
|
|
22
|
+
* Useful when the parent needs to clear a group.
|
|
23
|
+
*/
|
|
24
|
+
resetTrigger = false;
|
|
25
|
+
/** Emitted when the radio is selected */
|
|
26
|
+
dropiChange;
|
|
27
|
+
onResetTrigger(val) {
|
|
28
|
+
if (val)
|
|
29
|
+
this.checked = false;
|
|
30
|
+
}
|
|
31
|
+
handleChange(e) {
|
|
32
|
+
this.checked = e.target.checked;
|
|
33
|
+
this.dropiChange.emit(e);
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
return (index.h("div", { key: '3b31699bf088bee52465981074c0aea48b6fe112', class: "dropi-radio-button" }, index.h("label", { key: '072d19bd9c88739b849db0e264c65183eaab2132', htmlFor: this.inputId }, index.h("input", { key: '82d1600002e9dc2795cdc5c731997742adc8e2db', id: this.inputId, type: "radio", name: this.name, checked: this.checked, onChange: (e) => this.handleChange(e) }), this.label)));
|
|
37
|
+
}
|
|
38
|
+
static get formAssociated() { return true; }
|
|
39
|
+
static get watchers() { return {
|
|
40
|
+
"resetTrigger": [{
|
|
41
|
+
"onResetTrigger": 0
|
|
42
|
+
}]
|
|
43
|
+
}; }
|
|
44
|
+
};
|
|
45
|
+
DropiRadioButton.style = dropiRadioButtonCss();
|
|
46
|
+
|
|
47
|
+
exports.dropi_radio_button = DropiRadioButton;
|