@sula-tech/webcomponents 0.20.1 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +7 -3
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{sula-avatar_31.cjs.entry.js → sula-avatar_32.cjs.entry.js} +453 -84
- package/dist/cjs/sula-avatar_32.cjs.entry.js.map +1 -0
- package/dist/cjs/{sula-menu.model-BDxbWyPG.js → sula-calendar.model-BI5cNrUo.js} +8 -2
- package/dist/cjs/sula-calendar.model-BI5cNrUo.js.map +1 -0
- package/dist/cjs/sula-toast-stack.cjs.entry.js +4 -4
- package/dist/cjs/sula-toast.cjs.entry.js +2 -2
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/sula-calendar/model/sula-calendar.model.js +6 -0
- package/dist/collection/components/sula-calendar/model/sula-calendar.model.js.map +1 -0
- package/dist/collection/components/sula-calendar/sula-calendar.css +1 -0
- package/dist/collection/components/sula-calendar/sula-calendar.js +792 -0
- package/dist/collection/components/sula-calendar/sula-calendar.js.map +1 -0
- package/dist/collection/components/sula-calendar/sula-calendar.stories.js +309 -0
- package/dist/collection/components/sula-calendar/sula-calendar.stories.js.map +1 -0
- package/dist/collection/components/sula-checkbox/sula-checkbox.js +3 -3
- package/dist/collection/components/sula-chip/model/sula-chip.model.js +5 -0
- package/dist/collection/components/sula-chip/model/sula-chip.model.js.map +1 -1
- package/dist/collection/components/sula-chip/sula-chip.css +1 -1
- package/dist/collection/components/sula-chip/sula-chip.js +40 -5
- package/dist/collection/components/sula-chip/sula-chip.js.map +1 -1
- package/dist/collection/components/sula-chip/sula-chip.stories.js +14 -1
- package/dist/collection/components/sula-chip/sula-chip.stories.js.map +1 -1
- package/dist/collection/components/sula-dropdown/sula-dropdown.js +3 -3
- package/dist/collection/components/sula-icon/sula-icon.css +1 -1
- package/dist/collection/components/sula-icon/sula-icon.js +1 -1
- package/dist/collection/components/sula-icon-picker/sula-icon-picker.js +2 -2
- package/dist/collection/components/sula-loader/sula-loader.js +1 -1
- package/dist/collection/components/sula-menu/sula-menu.js +8 -8
- package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.css +1 -1
- package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.js +1 -1
- package/dist/collection/components/sula-progress-bar/sula-progress-bar.js +2 -2
- package/dist/collection/components/sula-radio-button/sula-radio-button.js +2 -2
- package/dist/collection/components/sula-search-bar/sula-search-bar.js +2 -2
- package/dist/collection/components/sula-segmented-control/sula-segmented-control.js +1 -1
- package/dist/collection/components/sula-switch/sula-switch.js +4 -4
- package/dist/collection/components/sula-table/sula-table.js +3 -3
- package/dist/collection/components/sula-table-body/sula-table-body.js +1 -1
- package/dist/collection/components/sula-table-cell/sula-table-cell.js +2 -2
- package/dist/collection/components/sula-table-head-cell/sula-table-head-cell.js +2 -2
- package/dist/collection/components/sula-table-header/sula-table-header.js +1 -1
- package/dist/collection/components/sula-table-row/sula-table-row.js +1 -1
- package/dist/collection/components/sula-tag/sula-tag.js +3 -3
- package/dist/collection/components/sula-textarea/sula-textarea.js +6 -6
- package/dist/collection/components/sula-textfield/sula-textfield.css +1 -1
- package/dist/collection/components/sula-textfield/sula-textfield.js +27 -3
- package/dist/collection/components/sula-textfield/sula-textfield.js.map +1 -1
- package/dist/collection/components/sula-textfield/sula-textfield.stories.js +9 -0
- package/dist/collection/components/sula-textfield/sula-textfield.stories.js.map +1 -1
- package/dist/collection/components/sula-tiles/sula-tiles.js +1 -1
- package/dist/collection/components/sula-timeline-list/sula-timeline-list.js +1 -1
- package/dist/collection/components/sula-toast/sula-toast.js +2 -2
- package/dist/collection/components/sula-toast-stack/sula-toast-stack.js +4 -4
- package/dist/collection/components/sula-toggle/sula-toggle.js +1 -1
- package/dist/collection/components/sula-tooltip/sula-tooltip.js +1 -1
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/{p-b7t6bSNa.js → p-CXm0qTFO.js} +4 -4
- package/dist/components/{p-b7t6bSNa.js.map → p-CXm0qTFO.js.map} +1 -1
- package/dist/components/p-Cp_4qTxj.js +10 -0
- package/dist/components/p-Cp_4qTxj.js.map +1 -0
- package/dist/components/{p-DmQoJS86.js → p-D5G0T47I.js} +5 -5
- package/dist/components/{p-DmQoJS86.js.map → p-D5G0T47I.js.map} +1 -1
- package/dist/components/p-DGAtNvje.js +555 -0
- package/dist/components/p-DGAtNvje.js.map +1 -0
- package/dist/components/{p-CJ2i2jVV.js → p-DwyYG9oc.js} +5 -5
- package/dist/components/{p-CJ2i2jVV.js.map → p-DwyYG9oc.js.map} +1 -1
- package/dist/components/{p-DmCNhtp_.js → p-MPkJUrNl.js} +3 -3
- package/dist/components/{p-DmCNhtp_.js.map → p-MPkJUrNl.js.map} +1 -1
- package/dist/components/{p-DGfvh6dZ.js → p-fAOl4EhI.js} +5 -5
- package/dist/components/{p-DGfvh6dZ.js.map → p-fAOl4EhI.js.map} +1 -1
- package/dist/components/{p-DqRqPukj.js → p-jplrktAF.js} +4 -4
- package/dist/components/{p-DqRqPukj.js.map → p-jplrktAF.js.map} +1 -1
- package/dist/components/{p-D0ZAC0yK.js → p-t7f_qmad.js} +7 -7
- package/dist/components/{p-D0ZAC0yK.js.map → p-t7f_qmad.js.map} +1 -1
- package/dist/components/sula-avatar.js +1 -1
- package/dist/components/sula-badge.js +1 -1
- package/dist/components/sula-breadcrumb.js +1 -1
- package/dist/components/sula-button.js +1 -1
- package/dist/components/sula-calendar.d.ts +11 -0
- package/dist/components/sula-calendar.js +411 -0
- package/dist/components/sula-calendar.js.map +1 -0
- package/dist/components/sula-checkbox.js +4 -4
- package/dist/components/sula-chip.js +22 -7
- package/dist/components/sula-chip.js.map +1 -1
- package/dist/components/sula-dropdown.js +1 -1
- package/dist/components/sula-icon-picker.js +6 -6
- package/dist/components/sula-icon.js +1 -1
- package/dist/components/sula-loader.js +1 -1
- package/dist/components/sula-menu-select-list.js +1 -1
- package/dist/components/sula-menu.js +9 -9
- package/dist/components/sula-modal.js +3 -3
- package/dist/components/sula-progress-bar.js +3 -3
- package/dist/components/sula-radio-button.js +2 -2
- package/dist/components/sula-search-bar.js +1 -1
- package/dist/components/sula-segmented-control.js +2 -2
- package/dist/components/sula-switch.js +4 -4
- package/dist/components/sula-table-body.js +1 -1
- package/dist/components/sula-table-cell.js +2 -2
- package/dist/components/sula-table-head-cell.js +2 -2
- package/dist/components/sula-table-header.js +1 -1
- package/dist/components/sula-table-row.js +1 -1
- package/dist/components/sula-table.js +3 -3
- package/dist/components/sula-tag.js +4 -4
- package/dist/components/sula-textarea.js +6 -6
- package/dist/components/sula-textfield.js +1 -545
- package/dist/components/sula-textfield.js.map +1 -1
- package/dist/components/sula-tiles.js +2 -2
- package/dist/components/sula-timeline-list.js +2 -2
- package/dist/components/sula-toast-stack.js +6 -6
- package/dist/components/sula-toast.js +1 -1
- package/dist/components/sula-toggle.js +2 -2
- package/dist/components/sula-tooltip.js +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{sula-avatar_31.entry.js → sula-avatar_32.entry.js} +447 -79
- package/dist/esm/sula-avatar_32.entry.js.map +1 -0
- package/dist/esm/{sula-menu.model-Cs9RR1ZV.js → sula-calendar.model-BbsLJDfp.js} +9 -3
- package/dist/esm/sula-calendar.model-BbsLJDfp.js.map +1 -0
- package/dist/esm/sula-toast-stack.entry.js +4 -4
- package/dist/esm/sula-toast.entry.js +2 -2
- package/dist/esm/webcomponents.js +1 -1
- package/dist/types/components/sula-calendar/model/sula-calendar.model.d.ts +28 -0
- package/dist/types/components/sula-calendar/sula-calendar.d.ts +134 -0
- package/dist/types/components/sula-calendar/sula-calendar.stories.d.ts +169 -0
- package/dist/types/components/sula-chip/model/sula-chip.model.d.ts +4 -0
- package/dist/types/components/sula-chip/sula-chip.d.ts +5 -1
- package/dist/types/components/sula-chip/sula-chip.stories.d.ts +12 -1
- package/dist/types/components/sula-textfield/sula-textfield.d.ts +4 -0
- package/dist/types/components/sula-textfield/sula-textfield.stories.d.ts +8 -0
- package/dist/types/components.d.ts +221 -2
- package/dist/types/index.d.ts +2 -0
- package/dist/webcomponents/index.esm.js +1 -1
- package/dist/webcomponents/{p-f4ef50ea.entry.js → p-22b10b91.entry.js} +840 -355
- package/dist/webcomponents/p-22b10b91.entry.js.map +1 -0
- package/dist/webcomponents/{p-Cs9RR1ZV.js → p-BbsLJDfp.js} +11 -4
- package/dist/webcomponents/p-BbsLJDfp.js.map +1 -0
- package/dist/webcomponents/{p-170854a5.entry.js → p-c552c435.entry.js} +16 -16
- package/dist/webcomponents/{p-c58125e1.entry.js → p-df271629.entry.js} +6 -6
- package/dist/webcomponents/webcomponents.esm.js +48 -23
- package/package.json +1 -1
- package/dist/cjs/sula-avatar_31.cjs.entry.js.map +0 -1
- package/dist/cjs/sula-menu.model-BDxbWyPG.js.map +0 -1
- package/dist/esm/sula-avatar_31.entry.js.map +0 -1
- package/dist/esm/sula-menu.model-Cs9RR1ZV.js.map +0 -1
- package/dist/webcomponents/p-Cs9RR1ZV.js.map +0 -1
- package/dist/webcomponents/p-f4ef50ea.entry.js.map +0 -1
- /package/dist/webcomponents/{p-170854a5.entry.js.map → p-c552c435.entry.js.map} +0 -0
- /package/dist/webcomponents/{p-c58125e1.entry.js.map → p-df271629.entry.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h, d as Host } from './p-DYfmicjp.js';
|
|
2
|
-
import { d as defineCustomElement$2 } from './p-
|
|
2
|
+
import { d as defineCustomElement$2 } from './p-jplrktAF.js';
|
|
3
3
|
|
|
4
4
|
var SulaTagSize;
|
|
5
5
|
(function (SulaTagSize) {
|
|
@@ -106,14 +106,14 @@ const SulaTag$1 = /*@__PURE__*/ proxyCustomElement(class SulaTag extends H {
|
|
|
106
106
|
return iconStatusStyles[this.iconStatus];
|
|
107
107
|
}
|
|
108
108
|
render() {
|
|
109
|
-
return (h(Host, { key: '
|
|
109
|
+
return (h(Host, { key: '8ddb621cbe7fa787e005c2d72ec5df82c516d709' }, h("div", { key: '2a30403369f1757ed5795ec0d23d78c9cca4e98f', class: {
|
|
110
110
|
'flex items-center rounded-xxl w-fit': true,
|
|
111
111
|
[this.getSizeClass()]: true,
|
|
112
112
|
[this.getAppearanceClass()]: true,
|
|
113
|
-
} }, this.icon && (h("div", { key: '
|
|
113
|
+
} }, this.icon && (h("div", { key: 'b35fb727c68ac25ae3fbccacd993287e12fd755a', class: {
|
|
114
114
|
'flex justify-center items-center mr-8 rounded-full leading-4 px-2 py-1': true,
|
|
115
115
|
[this.getIconStatusClass()]: true,
|
|
116
|
-
} }, h("sula-icon", { key: '
|
|
116
|
+
} }, h("sula-icon", { key: '0ecdbf180a03a57f3f913f06c371a1138ae09f0b', icon: this.icon, "custom-class": "text-base text-negative-negative-1 leading-4" }))), h("span", { key: 'a606e8bbc39519cf3a58bd36600bcc3a7eb6acd0', class: {
|
|
117
117
|
'text-base leading-4': true,
|
|
118
118
|
[this.getTextColorClass()]: true,
|
|
119
119
|
[this.getTextWeightClass()]: true,
|
|
@@ -138,32 +138,32 @@ const SulaTextarea$1 = /*@__PURE__*/ proxyCustomElement(class SulaTextarea exten
|
|
|
138
138
|
}
|
|
139
139
|
render() {
|
|
140
140
|
const containerHeight = this.rows * 24 + 48;
|
|
141
|
-
return (h(Host, { key: '
|
|
141
|
+
return (h(Host, { key: 'bf4aca878efb401ad8b5fb18a53cc858a93da300', ref: node => (this.node = node) }, h("div", { key: '041c8aed055f587ba2fd9cc47bf7b0e99ba74919' }, h("div", { key: 'f690ef863419421c9f1958ff6c2802b5d6b89d9f', id: "textarea-container", class: {
|
|
142
142
|
'relative border rounded-sm px-16 py-12 outline-none caret-brand-primary': true,
|
|
143
143
|
'textarea-focus': this.textareaIsFocused && !this.disabled && this.status === SulaTextareaStatus.Default,
|
|
144
144
|
'textarea-error': this.status === SulaTextareaStatus.Error && !this.disabled,
|
|
145
145
|
'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,
|
|
146
146
|
'bg-surface-body border-line-input cursor-text': !this.disabled,
|
|
147
|
-
}, style: { height: `${containerHeight}px` }, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleTextareaClick }, h("label", { key: '
|
|
147
|
+
}, style: { height: `${containerHeight}px` }, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleTextareaClick }, h("label", { key: '5a0aea44ed5f5acdb16edc4aaeefd0255355617c', class: {
|
|
148
148
|
'text-base top-16 left-12 absolute transition-all duration-200 ease-in-out pointer-events-none z-10 w-[85%]': true,
|
|
149
149
|
'text-text-primary': !this.disabled && (this.isActive || this.status === SulaTextareaStatus.Default),
|
|
150
150
|
'text-text-disabled': this.disabled,
|
|
151
151
|
'bg-surface-body': !this.disabled && this.isActive,
|
|
152
|
-
}, ref: node => (this.labelElement = node) }, this.label), h("label", { key: '
|
|
152
|
+
}, ref: node => (this.labelElement = node) }, this.label), h("label", { key: 'c8a10d13f47a06c3214f0941681679f1bb72624d', class: {
|
|
153
153
|
'absolute font-bold transition-all duration-200 ease-in-out pointer-events-none z-10 active-label hidden from-down': true,
|
|
154
154
|
'text-sm top-12 left-16': this.isActive,
|
|
155
155
|
'text-text-primary': !this.disabled && (this.isActive || this.status === SulaTextareaStatus.Default),
|
|
156
156
|
'text-text-disabled': this.disabled,
|
|
157
157
|
'bg-surface-body': !this.disabled && this.isActive,
|
|
158
|
-
}, ref: node => (this.activeLabelElement = node) }, this.label), h("textarea", { key: '
|
|
158
|
+
}, ref: node => (this.activeLabelElement = node) }, this.label), h("textarea", { key: '2feca4f9fc99c132f38d1e6c3e7ecab9098b4ef1', ref: node => (this.textareaElement = node), placeholder: this.isActive ? this.placeholder : '', rows: this.rows, maxLength: this.maxLength, disabled: this.disabled, class: {
|
|
159
159
|
'w-full h-full outline-none text-base bg-transparent border-none resize-none': true,
|
|
160
160
|
'text-text-primary': !this.disabled,
|
|
161
161
|
'text-text-disabled cursor-not-allowed overflow-hidden': this.disabled,
|
|
162
|
-
}, style: { paddingTop: this.isActive ? `${this.labelPadding}px` : '0' }, onInput: this.handleTextareaChanges, onFocus: this.handleTextareaFocus, onBlur: this.handleBlur, value: this.textValue })), (this.helpText || this.maxLength) && (h("div", { key: '
|
|
162
|
+
}, style: { paddingTop: this.isActive ? `${this.labelPadding}px` : '0' }, onInput: this.handleTextareaChanges, onFocus: this.handleTextareaFocus, onBlur: this.handleBlur, value: this.textValue })), (this.helpText || this.maxLength) && (h("div", { key: '51ab3de5f54360ab8f086d525caad6c92a8e6f0c', class: "flex justify-between items-center px-16 mt-4 text-sm" }, this.helpText && (h("div", { key: 'e1f86704a5b7f9f5226a3ca6f6a4370437b56a9c', id: "textarea-help-text", class: {
|
|
163
163
|
'text-text-primary': this.status === SulaTextareaStatus.Default && !this.disabled,
|
|
164
164
|
'text-feedback-error': this.status === SulaTextareaStatus.Error && !this.disabled,
|
|
165
165
|
'text-text-disabled': this.disabled,
|
|
166
|
-
} }, this.helpText)), this.maxLength && (h("div", { key: '
|
|
166
|
+
} }, this.helpText)), this.maxLength && (h("div", { key: '1f461b6e46d4522f140162048535284ea377d654', id: "max-length-container", class: {
|
|
167
167
|
'text-text-primary': this.status === SulaTextareaStatus.Default && !this.disabled,
|
|
168
168
|
'text-feedback-error': this.status === SulaTextareaStatus.Error && !this.disabled,
|
|
169
169
|
'text-text-disabled': this.disabled,
|
|
@@ -1,548 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { g as getDefaultExportFromCjs } from './p-B85MJLTf.js';
|
|
3
|
-
import { d as defineCustomElement$2 } from './p-DqRqPukj.js';
|
|
4
|
-
|
|
5
|
-
var SulaTextfieldType;
|
|
6
|
-
(function (SulaTextfieldType) {
|
|
7
|
-
SulaTextfieldType["Text"] = "text";
|
|
8
|
-
SulaTextfieldType["Password"] = "password";
|
|
9
|
-
})(SulaTextfieldType || (SulaTextfieldType = {}));
|
|
10
|
-
var SulaTextfieldStatus;
|
|
11
|
-
(function (SulaTextfieldStatus) {
|
|
12
|
-
SulaTextfieldStatus["Default"] = "default";
|
|
13
|
-
SulaTextfieldStatus["Error"] = "error";
|
|
14
|
-
})(SulaTextfieldStatus || (SulaTextfieldStatus = {}));
|
|
15
|
-
|
|
16
|
-
var vanillaMasker$1 = {exports: {}};
|
|
17
|
-
|
|
18
|
-
var vanillaMasker = vanillaMasker$1.exports;
|
|
19
|
-
|
|
20
|
-
var hasRequiredVanillaMasker;
|
|
21
|
-
|
|
22
|
-
function requireVanillaMasker () {
|
|
23
|
-
if (hasRequiredVanillaMasker) return vanillaMasker$1.exports;
|
|
24
|
-
hasRequiredVanillaMasker = 1;
|
|
25
|
-
(function (module, exports) {
|
|
26
|
-
(function(root, factory) {
|
|
27
|
-
{
|
|
28
|
-
module.exports = factory();
|
|
29
|
-
}
|
|
30
|
-
}(vanillaMasker, function() {
|
|
31
|
-
var DIGIT = "9",
|
|
32
|
-
ALPHA = "A",
|
|
33
|
-
ALPHANUM = "S",
|
|
34
|
-
BY_PASS_KEYS = [9, 16, 17, 18, 36, 37, 38, 39, 40, 91, 92, 93],
|
|
35
|
-
isAllowedKeyCode = function(keyCode) {
|
|
36
|
-
for (var i = 0, len = BY_PASS_KEYS.length; i < len; i++) {
|
|
37
|
-
if (keyCode == BY_PASS_KEYS[i]) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return true;
|
|
42
|
-
},
|
|
43
|
-
mergeMoneyOptions = function(opts) {
|
|
44
|
-
opts = opts || {};
|
|
45
|
-
opts = {
|
|
46
|
-
delimiter: opts.delimiter || ".",
|
|
47
|
-
lastOutput: opts.lastOutput,
|
|
48
|
-
precision: opts.hasOwnProperty("precision") ? opts.precision : 2,
|
|
49
|
-
separator: opts.separator || ",",
|
|
50
|
-
showSignal: opts.showSignal,
|
|
51
|
-
suffixUnit: opts.suffixUnit && (" " + opts.suffixUnit.replace(/[\s]/g,'')) || "",
|
|
52
|
-
unit: opts.unit && (opts.unit.replace(/[\s]/g,'') + " ") || "",
|
|
53
|
-
zeroCents: opts.zeroCents
|
|
54
|
-
};
|
|
55
|
-
opts.moneyPrecision = opts.zeroCents ? 0 : opts.precision;
|
|
56
|
-
return opts;
|
|
57
|
-
},
|
|
58
|
-
// Fill wildcards past index in output with placeholder
|
|
59
|
-
addPlaceholdersToOutput = function(output, index, placeholder) {
|
|
60
|
-
for (; index < output.length; index++) {
|
|
61
|
-
if(output[index] === DIGIT || output[index] === ALPHA || output[index] === ALPHANUM) {
|
|
62
|
-
output[index] = placeholder;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return output;
|
|
66
|
-
}
|
|
67
|
-
;
|
|
68
|
-
|
|
69
|
-
var VanillaMasker = function(elements) {
|
|
70
|
-
this.elements = elements;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
VanillaMasker.prototype.unbindElementToMask = function() {
|
|
74
|
-
for (var i = 0, len = this.elements.length; i < len; i++) {
|
|
75
|
-
this.elements[i].lastOutput = "";
|
|
76
|
-
this.elements[i].onkeyup = false;
|
|
77
|
-
this.elements[i].onkeydown = false;
|
|
78
|
-
|
|
79
|
-
if (this.elements[i].value.length) {
|
|
80
|
-
this.elements[i].value = this.elements[i].value.replace(/\D/g, '');
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
VanillaMasker.prototype.bindElementToMask = function(maskFunction) {
|
|
86
|
-
var that = this,
|
|
87
|
-
onType = function(e) {
|
|
88
|
-
e = e || window.event;
|
|
89
|
-
var source = e.target || e.srcElement;
|
|
90
|
-
|
|
91
|
-
if (isAllowedKeyCode(e.keyCode)) {
|
|
92
|
-
setTimeout(function() {
|
|
93
|
-
that.opts.lastOutput = source.lastOutput;
|
|
94
|
-
source.value = VMasker[maskFunction](source.value, that.opts);
|
|
95
|
-
source.lastOutput = source.value;
|
|
96
|
-
if (source.setSelectionRange && that.opts.suffixUnit) {
|
|
97
|
-
source.setSelectionRange(source.value.length, (source.value.length - that.opts.suffixUnit.length));
|
|
98
|
-
}
|
|
99
|
-
}, 0);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
;
|
|
103
|
-
for (var i = 0, len = this.elements.length; i < len; i++) {
|
|
104
|
-
this.elements[i].lastOutput = "";
|
|
105
|
-
this.elements[i].onkeyup = onType;
|
|
106
|
-
if (this.elements[i].value.length) {
|
|
107
|
-
this.elements[i].value = VMasker[maskFunction](this.elements[i].value, this.opts);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
VanillaMasker.prototype.maskMoney = function(opts) {
|
|
113
|
-
this.opts = mergeMoneyOptions(opts);
|
|
114
|
-
this.bindElementToMask("toMoney");
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
VanillaMasker.prototype.maskNumber = function() {
|
|
118
|
-
this.opts = {};
|
|
119
|
-
this.bindElementToMask("toNumber");
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
VanillaMasker.prototype.maskAlphaNum = function() {
|
|
123
|
-
this.opts = {};
|
|
124
|
-
this.bindElementToMask("toAlphaNumeric");
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
VanillaMasker.prototype.maskPattern = function(pattern) {
|
|
128
|
-
this.opts = {pattern: pattern};
|
|
129
|
-
this.bindElementToMask("toPattern");
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
VanillaMasker.prototype.unMask = function() {
|
|
133
|
-
this.unbindElementToMask();
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
var VMasker = function(el) {
|
|
137
|
-
if (!el) {
|
|
138
|
-
throw new Error("VanillaMasker: There is no element to bind.");
|
|
139
|
-
}
|
|
140
|
-
var elements = ("length" in el) ? (el.length ? el : []) : [el];
|
|
141
|
-
return new VanillaMasker(elements);
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
VMasker.toMoney = function(value, opts) {
|
|
145
|
-
opts = mergeMoneyOptions(opts);
|
|
146
|
-
if (opts.zeroCents) {
|
|
147
|
-
opts.lastOutput = opts.lastOutput || "";
|
|
148
|
-
var zeroMatcher = ("("+ opts.separator +"[0]{0,"+ opts.precision +"})"),
|
|
149
|
-
zeroRegExp = new RegExp(zeroMatcher, "g"),
|
|
150
|
-
digitsLength = value.toString().replace(/[\D]/g, "").length || 0,
|
|
151
|
-
lastDigitLength = opts.lastOutput.toString().replace(/[\D]/g, "").length || 0
|
|
152
|
-
;
|
|
153
|
-
value = value.toString().replace(zeroRegExp, "");
|
|
154
|
-
if (digitsLength < lastDigitLength) {
|
|
155
|
-
value = value.slice(0, value.length - 1);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
var number = value.toString().replace(/[\D]/g, ""),
|
|
159
|
-
clearDelimiter = new RegExp("^(0|\\"+ opts.delimiter +")"),
|
|
160
|
-
clearSeparator = new RegExp("(\\"+ opts.separator +")$"),
|
|
161
|
-
money = number.substr(0, number.length - opts.moneyPrecision),
|
|
162
|
-
masked = money.substr(0, money.length % 3),
|
|
163
|
-
cents = new Array(opts.precision + 1).join("0")
|
|
164
|
-
;
|
|
165
|
-
money = money.substr(money.length % 3, money.length);
|
|
166
|
-
for (var i = 0, len = money.length; i < len; i++) {
|
|
167
|
-
if (i % 3 === 0) {
|
|
168
|
-
masked += opts.delimiter;
|
|
169
|
-
}
|
|
170
|
-
masked += money[i];
|
|
171
|
-
}
|
|
172
|
-
masked = masked.replace(clearDelimiter, "");
|
|
173
|
-
masked = masked.length ? masked : "0";
|
|
174
|
-
var signal = "";
|
|
175
|
-
if(opts.showSignal === true) {
|
|
176
|
-
signal = value < 0 || (value.startsWith && value.startsWith('-')) ? "-" : "";
|
|
177
|
-
}
|
|
178
|
-
if (!opts.zeroCents) {
|
|
179
|
-
var beginCents = number.length - opts.precision,
|
|
180
|
-
centsValue = number.substr(beginCents, opts.precision),
|
|
181
|
-
centsLength = centsValue.length,
|
|
182
|
-
centsSliced = (opts.precision > centsLength) ? opts.precision : centsLength
|
|
183
|
-
;
|
|
184
|
-
cents = (cents + centsValue).slice(-centsSliced);
|
|
185
|
-
}
|
|
186
|
-
var output = opts.unit + signal + masked + opts.separator + cents;
|
|
187
|
-
return output.replace(clearSeparator, "") + opts.suffixUnit;
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
VMasker.toPattern = function(value, opts) {
|
|
191
|
-
var pattern = (typeof opts === 'object' ? opts.pattern : opts),
|
|
192
|
-
patternChars = pattern.replace(/\W/g, ''),
|
|
193
|
-
output = pattern.split(""),
|
|
194
|
-
values = value.toString().replace(/\W/g, ""),
|
|
195
|
-
charsValues = values.replace(/\W/g, ''),
|
|
196
|
-
index = 0,
|
|
197
|
-
i,
|
|
198
|
-
outputLength = output.length,
|
|
199
|
-
placeholder = (typeof opts === 'object' ? opts.placeholder : undefined)
|
|
200
|
-
;
|
|
201
|
-
|
|
202
|
-
for (i = 0; i < outputLength; i++) {
|
|
203
|
-
// Reached the end of input
|
|
204
|
-
if (index >= values.length) {
|
|
205
|
-
if (patternChars.length == charsValues.length) {
|
|
206
|
-
return output.join("");
|
|
207
|
-
}
|
|
208
|
-
else if ((placeholder !== undefined) && (patternChars.length > charsValues.length)) {
|
|
209
|
-
return addPlaceholdersToOutput(output, i, placeholder).join("");
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
// Remaining chars in input
|
|
216
|
-
else {
|
|
217
|
-
if ((output[i] === DIGIT && values[index].match(/[0-9]/)) ||
|
|
218
|
-
(output[i] === ALPHA && values[index].match(/[a-zA-Z]/)) ||
|
|
219
|
-
(output[i] === ALPHANUM && values[index].match(/[0-9a-zA-Z]/))) {
|
|
220
|
-
output[i] = values[index++];
|
|
221
|
-
} else if (output[i] === DIGIT || output[i] === ALPHA || output[i] === ALPHANUM) {
|
|
222
|
-
if(placeholder !== undefined){
|
|
223
|
-
return addPlaceholdersToOutput(output, i, placeholder).join("");
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
return output.slice(0, i).join("");
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return output.join("").substr(0, i);
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
VMasker.toNumber = function(value) {
|
|
235
|
-
return value.toString().replace(/(?!^-)[^0-9]/g, "");
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
VMasker.toAlphaNumeric = function(value) {
|
|
239
|
-
return value.toString().replace(/[^a-z0-9 ]+/i, "");
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
return VMasker;
|
|
243
|
-
}));
|
|
244
|
-
} (vanillaMasker$1));
|
|
245
|
-
return vanillaMasker$1.exports;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
var vanillaMaskerExports = requireVanillaMasker();
|
|
249
|
-
var VMasker = /*@__PURE__*/getDefaultExportFromCjs(vanillaMaskerExports);
|
|
250
|
-
|
|
251
|
-
const sulaTextfieldCss = "*,:after,:before{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{font-family:Figtree;line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.block{display:block}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.outline{outline-style:solid}:host,:host button,:host input,:host option,:host select,:host textarea{font-family:Figtree,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}:host{display:block}.button-focus{outline:2px solid var(--color-feedback-informational)!important;outline-offset:2px!important}.button-error{outline:2px solid var(--color-feedback-error)!important;outline-offset:2px!important}.from-down{animation:from-down .2s ease-in-out}.from-up{animation:from-up .2s ease-in-out}@keyframes from-down{0%{opacity:0;transform:translateY(75%)}to{opacity:1;transform:translateY(0)}}@keyframes from-up{0%{opacity:0;transform:translateY(-75%)}to{opacity:1;transform:translateY(0)}}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:300;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Light.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:300;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-LightItalic.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:400;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Regular.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:400;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Italic.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:500;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Medium.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:500;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-MediumItalic.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:600;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-SemiBold.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:600;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-SemiBoldItalic.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:700;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Bold.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:700;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-BoldItalic.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:800;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-ExtraBold.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:800;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-ExtraBoldItalic.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:900;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Black.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:900;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-BlackItalic.ttf) format(\"truetype\")}:root{--color-green-50:#f1f9f4;--color-green-100:#e6f4ed;--color-green-200:#cae7d8;--color-green-300:#a0d4b8;--color-green-400:#68bb8e;--color-green-500:#04843f;--color-green-600:#037236;--color-green-700:#03632f;--color-green-800:#035428;--color-green-900:#024521;--color-green-950:#012b15;--color-red-50:#fef6f6;--color-red-100:#fde8e8;--color-red-200:#fad1d1;--color-red-300:#f7abab;--color-red-400:#f17474;--color-red-500:#c80505;--color-red-600:#b30404;--color-red-700:#9f0404;--color-red-800:#860303;--color-red-900:#6d0303;--color-red-950:#330d00;--color-yellow-50:#fdf4e7;--color-yellow-100:#fcedd9;--color-yellow-200:#fae0bd;--color-yellow-300:#f6c788;--color-yellow-400:#f3b159;--color-yellow-500:#ef9928;--color-yellow-600:#e49226;--color-yellow-700:#d17e10;--color-yellow-800:#b46d0e;--color-yellow-900:#93590b;--color-yellow-950:#402705;--color-orange-50:#fef4f1;--color-orange-100:#fde8e2;--color-orange-200:#fbd2c6;--color-orange-300:#f8b4a0;--color-orange-400:#f58e70;--color-orange-500:#f05223;--color-orange-600:#ea4210;--color-orange-700:#d23b0e;--color-orange-800:#b5330c;--color-orange-900:#942a0a;--color-orange-950:#401204;--color-blue-50:#ecf0f9;--color-blue-100:#dde3f4;--color-blue-200:#b2c2e5;--color-blue-300:#7994d2;--color-blue-400:#4066bf;--color-blue-500:#001e64;--color-blue-600:#001c5c;--color-blue-700:#00174c;--color-blue-800:#00123d;--color-blue-900:#000f33;--color-blue-950:#000d2b;--color-ambar-50:#fff6eb;--color-ambar-100:#ffefdc;--color-ambar-200:#fedfb9;--color-ambar-300:#fdca8b;--color-ambar-400:#fdb359;--color-ambar-500:#fc9c26;--color-ambar-600:#ec8403;--color-ambar-700:#d87803;--color-ambar-800:#ba6803;--color-ambar-900:#975402;--color-ambar-950:#402301;--color-gray-50:#fff;--color-gray-100:#f3f4f4;--color-gray-200:#e5e6e6;--color-gray-300:#bfc0c0;--color-gray-400:#acaeae;--color-gray-500:#949595;--color-gray-600:#737575;--color-gray-700:#6c6e6e;--color-gray-800:#313333;--color-gray-900:#272929;--color-gray-950:#191d1d;--color-white-opacity-50:#ffffff0d;--color-white-opacity-100:#ffffff1a;--color-white-opacity-200:#ffffff26;--color-white-opacity-300:#ffffff45;--color-white-opacity-400:#ffffff5c;--color-white-opacity-500:#ffffff80;--color-white-opacity-600:#ffffff8c;--color-white-opacity-700:#ffffffa3;--color-white-opacity-800:#ffffffba;--color-white-opacity-900:#fffc;--color-white-opacity-950:#ffffffe8;--color-ciano-50:#f1f6fe;--color-ciano-100:#dfeafc;--color-ciano-200:#c3d9f9;--color-ciano-300:#90b9f4;--color-ciano-400:#5d98ee;--color-ciano-500:#1769e0;--color-ciano-600:#155fcb;--color-ciano-700:#1355b4;--color-ciano-800:#104899;--color-ciano-900:#0d3b7d;--color-ciano-950:#071e40;--color-extra-color-blue-light:#e7f0f4;--color-extra-color-blue-dark:#162931;--color-black-opacity-50:rgba(25,29,29,.02);--color-black-opacity-100:rgba(25,29,29,.05);--color-black-opacity-200:rgba(25,29,29,.11);--color-black-opacity-300:rgba(25,29,29,.28);--color-black-opacity-400:rgba(25,29,29,.36);--color-black-opacity-500:rgba(25,29,29,.44);--color-black-opacity-600:rgba(25,29,29,.62);--color-black-opacity-700:rgba(25,29,29,.64);--color-black-opacity-800:rgba(25,29,29,.72);--color-black-opacity-900:rgba(25,29,29,.8);--color-black-opacity-950:rgba(25,29,29,.96);--color-shadow-opacity-50:rgba(0,0,0,.04);--color-shadow-opacity-100:rgba(0,0,0,.06);--color-shadow-opacity-200:rgba(0,0,0,.12);--color-shadow-opacity-300:rgba(0,0,0,.2);--color-shadow-opacity-400:rgba(0,0,0,.32);--color-shadow-opacity-500:rgba(0,0,0,.5);--color-shadow-opacity-600:rgba(0,0,0,.55);--color-shadow-opacity-700:rgba(0,0,0,.64);--color-shadow-opacity-800:rgba(0,0,0,.73);--color-shadow-opacity-900:rgba(0,0,0,.8);--color-shadow-opacity-950:rgba(0,0,0,.91);--color-feedback-success:#04843f;--color-feedback-error:#c80505;--color-feedback-informational:#1355b4;--color-feedback-alert:#ef9928;--color-brand-primary:#f05223;--color-brand-secondary:#001c5c;--color-brand-tertiary-1:#1769e0;--color-brand-tertiary-2:#fc9c26;--color-surface-body:#fff;--color-surface-on-body:#f3f4f4;--color-surface-on-body-blue:#e7f0f4;--color-surface-on-body-brand:#fff6eb;--color-surface-on-body-feedback-success:#e6f4ed;--color-surface-on-body-feedback-error:#fde8e8;--color-surface-on-body-feedback-alert:#fdf4e7;--color-surface-on-body-feedback-info:#dfeafc;--color-text-brand:#f05223;--color-text-primary:#313333;--color-text-secondary:#6c6e6e;--color-text-disabled:#949595;--color-text-link:#1355b4;--color-states-empty-bg-hover:rgba(25,29,29,.05);--color-states-empty-bg-pressed:rgba(25,29,29,.11);--color-states-bg-disabled:rgba(25,29,29,.02);--color-states-bg-focus:#1355b4;--color-states-primary-hover:#ea4210;--color-states-primary-pressed:#d23b0e;--color-states-danger-hover:#b30404;--color-states-danger-pressed:#9f0404;--color-states-negative-hover:#e5e6e6;--color-states-negative-pressed:#bfc0c0;--color-icon-primary:#6c6e6e;--color-icon-secondary:#fff;--color-icon-tertiary:#b30404;--color-icon-disabled:#acaeae;--color-neutral-neutral-1:#fff;--color-neutral-neutral-2:#f3f4f4;--color-neutral-neutral-3:#acaeae;--color-neutral-neutral-4:#949595;--color-neutral-neutral-5:#737575;--color-neutral-neutral-6:#6c6e6e;--color-neutral-neutral-7:#313333;--color-neutral-neutral-8:#272929;--color-negative-negative-1:#fff;--color-negative-negative-2:#313333;--color-opacity-body:#fffc;--color-opacity-on-body:rgba(25,29,29,.02);--color-opacity-overlay:rgba(25,29,29,.62);--color-opacity-on-overlay:#ffffff1a;--color-opacity-toast:#ffffff45;--color-line-input:#949595;--color-line-general-strong:#bfc0c0;--color-line-general:#e5e6e6;--color-line-hair:rgba(25,29,29,.05);--color-box-shadow-body:#fff;--color-box-shadow-shadow-color-1:rgba(0,0,0,.04);--color-box-shadow-shadow-color-2:rgba(0,0,0,.06)}.static{position:static}.mt-4{margin-top:.25rem}.flex{display:flex}.hidden{display:none}.h-\\[72px\\]{height:72px}.w-full{width:100%}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.rounded-sm{border-radius:.75rem}.border{border-width:1px}.border-line-general{border-color:var(--color-line-general)}.border-line-input{border-color:var(--color-line-input)}.bg-states-bg-disabled{background-color:var(--color-states-bg-disabled)}.bg-surface-body{background-color:var(--color-surface-body)}.bg-transparent{background-color:transparent}.px-16{padding-left:1rem;padding-right:1rem}.pr-12{padding-right:.75rem}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-bold{font-weight:700}.text-feedback-error{color:var(--color-feedback-error)}.text-icon-disabled{color:var(--color-icon-disabled)}.text-icon-primary{color:var(--color-icon-primary)}.text-text-disabled{color:var(--color-text-disabled)}.text-text-primary{color:var(--color-text-primary)}.caret-brand-primary{caret-color:var(--color-brand-primary)}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}";
|
|
252
|
-
|
|
253
|
-
const SulaTextfield$1 = /*@__PURE__*/ proxyCustomElement(class SulaTextfield extends H {
|
|
254
|
-
constructor() {
|
|
255
|
-
super();
|
|
256
|
-
this.__registerHost();
|
|
257
|
-
this.__attachShadow();
|
|
258
|
-
this.valueChanged = createEvent(this, "valueChanged");
|
|
259
|
-
this.valueChangedWithoutMask = createEvent(this, "valueChangedWithoutMask");
|
|
260
|
-
this.focusedOn = createEvent(this, "focusedOn");
|
|
261
|
-
this.focusedOut = createEvent(this, "focusedOut");
|
|
262
|
-
/**
|
|
263
|
-
* The textfield type
|
|
264
|
-
*/
|
|
265
|
-
this.type = SulaTextfieldType.Text;
|
|
266
|
-
/**
|
|
267
|
-
* The textfield status
|
|
268
|
-
*/
|
|
269
|
-
this.status = SulaTextfieldStatus.Default;
|
|
270
|
-
this.inputIsOpen = false;
|
|
271
|
-
this.textValue = '';
|
|
272
|
-
this.showPassword = false;
|
|
273
|
-
this.inputIsFocused = false;
|
|
274
|
-
this.handleInputClick = () => {
|
|
275
|
-
this.toggleOptions(true);
|
|
276
|
-
};
|
|
277
|
-
this.handleInputChanges = (event) => {
|
|
278
|
-
const newValue = event.target.value;
|
|
279
|
-
let valueToPersist = newValue;
|
|
280
|
-
if (this.hasMaskPatternConfigured() && this.inputElement) {
|
|
281
|
-
this.handleInputMask(newValue);
|
|
282
|
-
valueToPersist = this.inputElement.value;
|
|
283
|
-
}
|
|
284
|
-
this.valueChangedWithoutMask.emit(valueToPersist.replace(/\D/g, ''));
|
|
285
|
-
this.textValue = valueToPersist;
|
|
286
|
-
this.value = valueToPersist;
|
|
287
|
-
this.valueChanged.emit(valueToPersist);
|
|
288
|
-
};
|
|
289
|
-
this.handleFocus = () => {
|
|
290
|
-
if (this.disabled)
|
|
291
|
-
return;
|
|
292
|
-
this.toggleOptions(true);
|
|
293
|
-
this.inputElement.focus();
|
|
294
|
-
};
|
|
295
|
-
this.handleBlur = () => {
|
|
296
|
-
this.toggleOptions(false);
|
|
297
|
-
this.focusedOut.emit();
|
|
298
|
-
this.inputIsFocused = false;
|
|
299
|
-
};
|
|
300
|
-
this.handleInputFocus = () => {
|
|
301
|
-
this.focusedOn.emit();
|
|
302
|
-
this.inputIsFocused = true;
|
|
303
|
-
};
|
|
304
|
-
this.handleIconClick = (event) => {
|
|
305
|
-
if (this.type === SulaTextfieldType.Password) {
|
|
306
|
-
event.stopPropagation();
|
|
307
|
-
this.handlePasswordIconClicked();
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
watchValueHandler(newValue) {
|
|
312
|
-
const normalizedValue = newValue || '';
|
|
313
|
-
this.textValue = normalizedValue;
|
|
314
|
-
if (this.inputElement && this.inputElement.value !== normalizedValue) {
|
|
315
|
-
const cursorPosition = this.inputElement.selectionStart;
|
|
316
|
-
this.inputElement.value = normalizedValue;
|
|
317
|
-
if (this.hasMaskPatternConfigured()) {
|
|
318
|
-
this.handleInputMask(normalizedValue);
|
|
319
|
-
this.textValue = this.inputElement.value;
|
|
320
|
-
}
|
|
321
|
-
if (this.inputIsFocused && cursorPosition !== null) {
|
|
322
|
-
const newPosition = Math.min(cursorPosition, this.inputElement.value.length);
|
|
323
|
-
this.inputElement.setSelectionRange(newPosition, newPosition);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
if (this.textValue && this.textValue.trim().length > 0) {
|
|
327
|
-
this.inputIsOpen = true;
|
|
328
|
-
this.changeElementsStyle();
|
|
329
|
-
}
|
|
330
|
-
else if (!this.inputIsFocused) {
|
|
331
|
-
this.inputIsOpen = false;
|
|
332
|
-
this.changeElementsStyle();
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
watchMaskPatternHandler() {
|
|
336
|
-
this.syncMaskState();
|
|
337
|
-
}
|
|
338
|
-
watchMaskPatternSwitchMaxLengthHandler() {
|
|
339
|
-
this.syncMaskState();
|
|
340
|
-
}
|
|
341
|
-
handleClick(event) {
|
|
342
|
-
if (!this.node || !this.inputIsFocused)
|
|
343
|
-
return;
|
|
344
|
-
const clickInside = this.node.contains(event.target);
|
|
345
|
-
if (!clickInside) {
|
|
346
|
-
this.toggleOptions(false);
|
|
347
|
-
this.focusedOut.emit();
|
|
348
|
-
this.inputIsFocused = false;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
componentWillLoad() {
|
|
352
|
-
if (this.value && this.value.trim().length > 0) {
|
|
353
|
-
this.textValue = this.value;
|
|
354
|
-
this.inputIsOpen = true;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
componentDidLoad() {
|
|
358
|
-
if (this.value && this.value.trim().length > 0 && this.inputElement) {
|
|
359
|
-
this.inputElement.value = this.value;
|
|
360
|
-
this.textValue = this.value;
|
|
361
|
-
}
|
|
362
|
-
if (this.textValue && this.textValue.trim().length > 0) {
|
|
363
|
-
this.changeElementsStyle();
|
|
364
|
-
}
|
|
365
|
-
if (this.hasMaskPatternConfigured() && this.inputElement) {
|
|
366
|
-
this.handleInputMask();
|
|
367
|
-
this.textValue = this.inputElement.value;
|
|
368
|
-
this.value = this.inputElement.value;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
toggleOptions(inputIsOpen) {
|
|
372
|
-
if ((this.inputIsOpen && this.textValue && this.textValue.length > 0) || this.disabled)
|
|
373
|
-
return;
|
|
374
|
-
this.inputIsOpen = inputIsOpen;
|
|
375
|
-
this.changeElementsStyle();
|
|
376
|
-
this.inputElement.focus();
|
|
377
|
-
}
|
|
378
|
-
changeElementsStyle() {
|
|
379
|
-
if (!this.inputContainer || !this.labelElement)
|
|
380
|
-
return;
|
|
381
|
-
this.inputContainer.style.display = this.inputIsOpen ? 'flex' : 'none';
|
|
382
|
-
this.labelElement.style.display = this.inputIsOpen ? 'none' : 'block';
|
|
383
|
-
if (!this.inputIsOpen) {
|
|
384
|
-
this.labelElement.classList.add('from-up');
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
handleInputMask(inputValue) {
|
|
388
|
-
var _a, _b;
|
|
389
|
-
if (!this.inputElement)
|
|
390
|
-
return;
|
|
391
|
-
const valueWithoutMask = ((_a = inputValue !== null && inputValue !== void 0 ? inputValue : this.inputElement.value) !== null && _a !== void 0 ? _a : '').replace(/[^a-zA-Z0-9]/g, '');
|
|
392
|
-
const maskPattern = this.getMaskPatternByValueLength(valueWithoutMask, (_b = inputValue !== null && inputValue !== void 0 ? inputValue : this.inputElement.value) !== null && _b !== void 0 ? _b : '');
|
|
393
|
-
if (!maskPattern)
|
|
394
|
-
return;
|
|
395
|
-
VMasker(this.inputElement).unMask();
|
|
396
|
-
this.inputElement.value = VMasker.toPattern(valueWithoutMask, maskPattern);
|
|
397
|
-
}
|
|
398
|
-
syncMaskState() {
|
|
399
|
-
if (!this.inputElement)
|
|
400
|
-
return;
|
|
401
|
-
if (!this.hasMaskPatternConfigured()) {
|
|
402
|
-
VMasker(this.inputElement).unMask();
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
this.handleInputMask();
|
|
406
|
-
this.textValue = this.inputElement.value;
|
|
407
|
-
this.value = this.inputElement.value;
|
|
408
|
-
}
|
|
409
|
-
hasMaskPatternConfigured() {
|
|
410
|
-
return this.getMaskPatterns().length > 0;
|
|
411
|
-
}
|
|
412
|
-
getMaskPatterns() {
|
|
413
|
-
if (Array.isArray(this.maskPattern)) {
|
|
414
|
-
return this.maskPattern.map(pattern => pattern === null || pattern === void 0 ? void 0 : pattern.trim()).filter(Boolean);
|
|
415
|
-
}
|
|
416
|
-
if (typeof this.maskPattern === 'string' && this.maskPattern.trim().length > 0) {
|
|
417
|
-
return [this.maskPattern.trim()];
|
|
418
|
-
}
|
|
419
|
-
return [];
|
|
420
|
-
}
|
|
421
|
-
getMaskPatternByValueLength(inputValue, rawInputValue) {
|
|
422
|
-
const patterns = this.getMaskPatterns();
|
|
423
|
-
if (patterns.length === 0)
|
|
424
|
-
return undefined;
|
|
425
|
-
if (patterns.length === 1)
|
|
426
|
-
return patterns[0];
|
|
427
|
-
const currentValueLength = (inputValue !== null && inputValue !== void 0 ? inputValue : '').length;
|
|
428
|
-
const providedSwitchLengths = this.normalizeProvidedSwitchLengths();
|
|
429
|
-
if (providedSwitchLengths.length === 0) {
|
|
430
|
-
return this.getMaskPatternByAutoInference(patterns, currentValueLength, rawInputValue);
|
|
431
|
-
}
|
|
432
|
-
for (let i = 0; i < providedSwitchLengths.length; i++) {
|
|
433
|
-
if (currentValueLength <= providedSwitchLengths[i]) {
|
|
434
|
-
return patterns[Math.min(i, patterns.length - 1)];
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
return patterns[patterns.length - 1];
|
|
438
|
-
}
|
|
439
|
-
getMaskPatternByAutoInference(patterns, currentValueLength, rawInputValue) {
|
|
440
|
-
const capacities = patterns.map(pattern => (pattern.match(/[9AS]/g) || []).length);
|
|
441
|
-
const eligibleCapacities = capacities.filter(capacity => capacity >= currentValueLength && capacity > 0);
|
|
442
|
-
if (eligibleCapacities.length === 0) {
|
|
443
|
-
return patterns[patterns.length - 1];
|
|
444
|
-
}
|
|
445
|
-
const selectedCapacity = Math.min(...eligibleCapacities);
|
|
446
|
-
const candidateIndexes = capacities
|
|
447
|
-
.map((capacity, index) => ({ capacity, index }))
|
|
448
|
-
.filter(item => item.capacity === selectedCapacity)
|
|
449
|
-
.map(item => item.index);
|
|
450
|
-
if (candidateIndexes.length === 1) {
|
|
451
|
-
return patterns[candidateIndexes[0]];
|
|
452
|
-
}
|
|
453
|
-
const rawLiterals = (rawInputValue !== null && rawInputValue !== void 0 ? rawInputValue : '').replace(/[a-zA-Z0-9]/g, '');
|
|
454
|
-
if (rawLiterals.length > 0) {
|
|
455
|
-
for (const candidateIndex of candidateIndexes) {
|
|
456
|
-
const patternLiterals = patterns[candidateIndex].replace(/[9AS]/g, '');
|
|
457
|
-
if (patternLiterals === rawLiterals) {
|
|
458
|
-
return patterns[candidateIndex];
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
return patterns[candidateIndexes[0]];
|
|
463
|
-
}
|
|
464
|
-
normalizeProvidedSwitchLengths() {
|
|
465
|
-
if (Array.isArray(this.maskPatternSwitchMaxLength)) {
|
|
466
|
-
return this.maskPatternSwitchMaxLength.filter(value => Number.isFinite(value) && value > 0).sort((a, b) => a - b);
|
|
467
|
-
}
|
|
468
|
-
if (typeof this.maskPatternSwitchMaxLength === 'number' && Number.isFinite(this.maskPatternSwitchMaxLength) && this.maskPatternSwitchMaxLength > 0) {
|
|
469
|
-
return [this.maskPatternSwitchMaxLength];
|
|
470
|
-
}
|
|
471
|
-
return [];
|
|
472
|
-
}
|
|
473
|
-
handlePasswordIconClicked() {
|
|
474
|
-
const cursorPosition = this.inputElement.selectionStart;
|
|
475
|
-
const inputValue = this.inputElement.value;
|
|
476
|
-
const inputType = this.showPassword ? SulaTextfieldType.Password : SulaTextfieldType.Text;
|
|
477
|
-
this.inputElement.setAttribute('type', inputType);
|
|
478
|
-
this.showPassword = !this.showPassword;
|
|
479
|
-
setTimeout(() => {
|
|
480
|
-
this.inputElement.value = inputValue;
|
|
481
|
-
this.inputElement.setSelectionRange(cursorPosition, cursorPosition);
|
|
482
|
-
}, 0);
|
|
483
|
-
}
|
|
484
|
-
getInputIcon() {
|
|
485
|
-
if (this.type === SulaTextfieldType.Password) {
|
|
486
|
-
return this.showPassword ? 'ph ph-eye' : 'ph ph-eye-slash';
|
|
487
|
-
}
|
|
488
|
-
return this.icon;
|
|
489
|
-
}
|
|
490
|
-
render() {
|
|
491
|
-
return (h(Host, { key: '5c2b2b3218e8d0858b579df86dad374ae60cb103', ref: node => (this.node = node) }, h("div", { key: 'c54d988b3491f3e8bd5c25a8f7a0021eec6adf54' }, h("div", { key: 'fd2556d6d56c398fa2c76b5cece0cd842000a8e5', id: "button-container", class: {
|
|
492
|
-
'flex items-center border rounded-sm px-16 outline-none h-[72px] caret-brand-primary': true,
|
|
493
|
-
'flex-row justify-between': !!this.icon || this.type === SulaTextfieldType.Password,
|
|
494
|
-
'button-focus': this.inputIsFocused && !this.disabled && this.status === SulaTextfieldStatus.Default,
|
|
495
|
-
'button-error': this.status === SulaTextfieldStatus.Error && !this.disabled,
|
|
496
|
-
'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,
|
|
497
|
-
'bg-surface-body border-line-input cursor-pointer': !this.disabled,
|
|
498
|
-
}, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleInputClick }, h("div", { key: 'a0ab64b006237a998de114d8671ef932e7dcc8bf', class: { 'hidden flex-col w-full': true, 'pr-12': !!this.icon }, ref: node => (this.inputContainer = node) }, h("label", { key: '3e0af67fd2a749bcda1888c59094b9e0ab79f762', class: { 'font-bold text-sm from-down': true, 'text-text-primary': !this.disabled, 'text-text-disabled': this.disabled } }, this.label), h("input", { key: '6ed0a1cf3519c72e0652aed663c3f07c112409b8', type: this.type, ref: node => (this.inputElement = node), placeholder: this.placeholder, class: { 'outline-none text-base bg-transparent': true, 'text-text-primary': !this.disabled, 'text-text-disabled': this.disabled }, onInput: this.handleInputChanges, onFocus: this.handleInputFocus, value: this.textValue, disabled: this.disabled })), h("div", { key: 'd5a64486fba491f11fa92e33121c884d9a99c7e6', id: "textfield-label", class: { 'text-base flex items-center': true, 'text-text-primary': !this.disabled, 'text-text-disabled': this.disabled }, ref: node => (this.labelElement = node) }, this.label), (!!this.icon || this.type === SulaTextfieldType.Password) && (h("div", { key: 'c70def3ff8c94a66084cc4e74193dff8eee880b2', class: "flex items-center justify-center", onClick: this.handleIconClick }, h("sula-icon", { key: 'bb13ef942a6a9bb2c907c8429c2aca918903f68d', icon: this.getInputIcon(), customClass: `text-2xl ${this.disabled ? 'text-icon-disabled' : 'text-icon-primary'}` })))), (this.helpText || this.maxLength) && !this.disabled && (h("div", { key: '96a3eb6bbb052794590d40522e2102ff2b5783a8', class: "flex justify-between items-center px-16 mt-4 text-sm" }, this.helpText && (h("div", { key: '146d4c4646e3b20894bd8397de7a49c069305514', id: "textfield-help-text", class: { 'text-text-primary': this.status === SulaTextfieldStatus.Default, 'text-feedback-error': this.status === SulaTextfieldStatus.Error } }, this.helpText)), this.maxLength && (h("div", { key: '9537098a6cdda2977062e7b6100e0d652fa90477', id: "max-length-container", class: { 'text-text-primary': this.status === SulaTextfieldStatus.Default, 'text-feedback-error': this.status === SulaTextfieldStatus.Error } }, this.textValue ? this.textValue.length : 0, "/", this.maxLength)))))));
|
|
499
|
-
}
|
|
500
|
-
static get watchers() { return {
|
|
501
|
-
"value": ["watchValueHandler"],
|
|
502
|
-
"maskPattern": ["watchMaskPatternHandler"],
|
|
503
|
-
"maskPatternSwitchMaxLength": ["watchMaskPatternSwitchMaxLengthHandler"]
|
|
504
|
-
}; }
|
|
505
|
-
static get style() { return sulaTextfieldCss; }
|
|
506
|
-
}, [1, "sula-textfield", {
|
|
507
|
-
"value": [1025],
|
|
508
|
-
"type": [1],
|
|
509
|
-
"status": [1025],
|
|
510
|
-
"label": [1],
|
|
511
|
-
"placeholder": [1],
|
|
512
|
-
"disabled": [1028],
|
|
513
|
-
"helpText": [1, "help-text"],
|
|
514
|
-
"maxLength": [2, "max-length"],
|
|
515
|
-
"icon": [1],
|
|
516
|
-
"maskPattern": [1, "mask-pattern"],
|
|
517
|
-
"maskPatternSwitchMaxLength": [2, "mask-pattern-switch-max-length"],
|
|
518
|
-
"inputIsOpen": [32],
|
|
519
|
-
"textValue": [32],
|
|
520
|
-
"showPassword": [32],
|
|
521
|
-
"inputIsFocused": [32]
|
|
522
|
-
}, [[4, "click", "handleClick"]], {
|
|
523
|
-
"value": ["watchValueHandler"],
|
|
524
|
-
"maskPattern": ["watchMaskPatternHandler"],
|
|
525
|
-
"maskPatternSwitchMaxLength": ["watchMaskPatternSwitchMaxLengthHandler"]
|
|
526
|
-
}]);
|
|
527
|
-
function defineCustomElement$1() {
|
|
528
|
-
if (typeof customElements === "undefined") {
|
|
529
|
-
return;
|
|
530
|
-
}
|
|
531
|
-
const components = ["sula-textfield", "sula-icon"];
|
|
532
|
-
components.forEach(tagName => { switch (tagName) {
|
|
533
|
-
case "sula-textfield":
|
|
534
|
-
if (!customElements.get(tagName)) {
|
|
535
|
-
customElements.define(tagName, SulaTextfield$1);
|
|
536
|
-
}
|
|
537
|
-
break;
|
|
538
|
-
case "sula-icon":
|
|
539
|
-
if (!customElements.get(tagName)) {
|
|
540
|
-
defineCustomElement$2();
|
|
541
|
-
}
|
|
542
|
-
break;
|
|
543
|
-
} });
|
|
544
|
-
}
|
|
545
|
-
defineCustomElement$1();
|
|
1
|
+
import { S as SulaTextfield$1, d as defineCustomElement$1 } from './p-DGAtNvje.js';
|
|
546
2
|
|
|
547
3
|
const SulaTextfield = SulaTextfield$1;
|
|
548
4
|
const defineCustomElement = defineCustomElement$1;
|