@mhmo91/schmancy 0.4.20 → 0.4.22
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/{avatar-BoOnOo3X.cjs → avatar-CRWIpCVJ.cjs} +2 -2
- package/dist/{avatar-BoOnOo3X.cjs.map → avatar-CRWIpCVJ.cjs.map} +1 -1
- package/dist/{avatar-7Rif8_0P.js → avatar-CZ4ubNmx.js} +3 -3
- package/dist/{avatar-7Rif8_0P.js.map → avatar-CZ4ubNmx.js.map} +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -7
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +154 -156
- package/dist/input-BN9xQTH0.cjs +111 -0
- package/dist/{input-DcWJTrr9.cjs.map → input-BN9xQTH0.cjs.map} +1 -1
- package/dist/{input-P8bwT-4D.js → input-DHNBYBq4.js} +5 -1
- package/dist/{input-P8bwT-4D.js.map → input-DHNBYBq4.js.map} +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.js +5 -1
- package/dist/{media-BG2j6r0I.js → media-DHgb7H9L.js} +21 -27
- package/dist/{media-BG2j6r0I.js.map → media-DHgb7H9L.js.map} +1 -1
- package/dist/{media-C_UPDRKi.cjs → media-hg61JS4R.cjs} +6 -6
- package/dist/{media-C_UPDRKi.cjs.map → media-hg61JS4R.cjs.map} +1 -1
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/package.json +1 -1
- package/types/mixins/index.d.ts +1 -0
- package/types/src/busy/spinner.d.ts +1 -0
- package/types/src/card/actions.d.ts +3 -3
- package/types/src/card/content.d.ts +0 -3
- package/types/src/card/media.d.ts +1 -0
- package/types/src/chips/chip.d.ts +1 -1
- package/types/src/chips/chips.d.ts +1 -1
- package/types/src/date-range/date-range-dialog.d.ts +28 -0
- package/types/src/date-range/date-range-helpers.d.ts +27 -0
- package/types/src/date-range/date-range-presets.d.ts +18 -0
- package/types/src/date-range/date-range.d.ts +1 -27
- package/types/src/date-range-inline/date-range-inline.d.ts +111 -0
- package/types/src/date-range-inline/index.d.ts +2 -0
- package/types/src/index.d.ts +2 -0
- package/types/src/input/index.d.ts +2 -2
- package/types/src/input/input.d.ts +118 -34
- package/types/src/progress/index.d.ts +1 -0
- package/types/src/progress/progress.d.ts +17 -0
- package/types/src/radio-group/radio-button.d.ts +1 -1
- package/types/src/radio-group/radio-group.d.ts +1 -1
- package/dist/input-DcWJTrr9.cjs +0 -111
- package/types/src/data/countries.d.ts +0 -5
- package/types/src/data/index.d.ts +0 -1
- package/types/src/notification/$notification.d.ts +0 -13
- package/types/src/store/action-creator.d.ts +0 -8
- package/types/src/store/clear.d.ts +0 -1
- package/types/src/v2/form.d.ts +0 -51
- package/types/src/v2/index.d.ts +0 -2
- package/types/src/v2/input.d.ts +0 -71
|
@@ -16,35 +16,33 @@ type EventDetails = {
|
|
|
16
16
|
export type SchmancyInputInputEvent = CustomEvent<EventDetails>;
|
|
17
17
|
export type SchmancyInputChangeEvent = CustomEvent<EventDetails>;
|
|
18
18
|
export type SchmancyInputEnterEvent = CustomEvent<EventDetails>;
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Size variants for the input.
|
|
21
|
+
* - sm: Small, compact input (40px height)
|
|
22
|
+
* - md: Medium input (50px height, default)
|
|
23
|
+
* - lg: Large, spacious input (60px height)
|
|
24
|
+
*/
|
|
25
|
+
export type InputSize = 'sm' | 'md' | 'lg';
|
|
26
|
+
declare const SchmancyInput_base: import("@mixins/index").Constructor<import("@mixins/index").IFormFieldMixin> & import("@mixins/index").Constructor<import("@mixins/index").ITailwindElementMixin> & import("@mixins/index").Constructor<LitElement> & import("@mixins/index").Constructor<import("@mixins/index").IBaseMixin>;
|
|
27
|
+
/**
|
|
28
|
+
* Enhanced version of the SchmancyInput component with improved form integration
|
|
29
|
+
* and compatibility with legacy API.
|
|
30
|
+
*
|
|
31
|
+
* This component uses the native form association API and maintains parity with
|
|
32
|
+
* native input behaviors while providing a stylish, accessible interface.
|
|
33
|
+
*/
|
|
20
34
|
export default class SchmancyInput extends SchmancyInput_base {
|
|
21
|
-
/**
|
|
35
|
+
/** Auto-incrementing counter for generating unique IDs */
|
|
22
36
|
static _idCounter: number;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* The label for the control. If populated, we render a `<label for="...">`.
|
|
26
|
-
* If empty, we add an `aria-label` to the <input> for better screenreader support.
|
|
27
|
-
*/
|
|
28
|
-
label: string;
|
|
37
|
+
/** Override value to be string only for input element */
|
|
38
|
+
value: string;
|
|
29
39
|
/**
|
|
30
40
|
* The type of input. (e.g. 'text', 'password', 'email', etc.)
|
|
31
41
|
*/
|
|
32
42
|
type: HTMLInputElement['type'];
|
|
33
|
-
/**
|
|
34
|
-
* Name attribute (for form submissions). By default, a unique fallback.
|
|
35
|
-
*/
|
|
36
|
-
name: string;
|
|
37
43
|
placeholder: string;
|
|
38
|
-
/** Current value of the input. */
|
|
39
|
-
value: string;
|
|
40
44
|
/** Pattern validation attribute. */
|
|
41
45
|
pattern?: string;
|
|
42
|
-
/** Whether the control is required for form validation. */
|
|
43
|
-
required: boolean;
|
|
44
|
-
/** Whether the control is disabled. */
|
|
45
|
-
disabled: boolean;
|
|
46
|
-
/** Whether the input is read-only. */
|
|
47
|
-
readonly: boolean;
|
|
48
46
|
/** If true, we visually show a pointer cursor even if readOnly. */
|
|
49
47
|
clickable: boolean;
|
|
50
48
|
/** Whether browser spellcheck is enabled. */
|
|
@@ -70,47 +68,133 @@ export default class SchmancyInput extends SchmancyInput_base {
|
|
|
70
68
|
*/
|
|
71
69
|
tabIndex: number;
|
|
72
70
|
/**
|
|
73
|
-
*
|
|
71
|
+
* The size of the input.
|
|
72
|
+
* - 'sm': Small, compact size
|
|
73
|
+
* - 'md': Medium size (default)
|
|
74
|
+
* - 'lg': Large size
|
|
74
75
|
*/
|
|
75
|
-
|
|
76
|
+
size: InputSize;
|
|
76
77
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
78
|
+
* Controls when validation should show.
|
|
79
|
+
* - 'always' - Always show validation
|
|
80
|
+
* - 'touched' - Only show after field has been focused and then blurred
|
|
81
|
+
* - 'dirty' - Only show after value has changed
|
|
82
|
+
* - 'submitted' - Only show after form submission
|
|
79
83
|
*/
|
|
80
|
-
|
|
84
|
+
validateOn: 'always' | 'touched' | 'dirty' | 'submitted';
|
|
85
|
+
/**
|
|
86
|
+
* For datalist support
|
|
87
|
+
*/
|
|
88
|
+
list?: string;
|
|
81
89
|
private inputElement;
|
|
82
90
|
private inputRef;
|
|
83
|
-
|
|
91
|
+
/**
|
|
92
|
+
* For integration with browser's autofill support
|
|
93
|
+
*/
|
|
94
|
+
private isAutofilled;
|
|
95
|
+
/**
|
|
96
|
+
* Track user interaction state for validation
|
|
97
|
+
*/
|
|
98
|
+
private touched;
|
|
99
|
+
private dirty;
|
|
100
|
+
private submitted;
|
|
101
|
+
/**
|
|
102
|
+
* Store the default value for reset behavior
|
|
103
|
+
*/
|
|
104
|
+
private defaultValue;
|
|
84
105
|
protected static shadowRootOptions: {
|
|
85
106
|
delegatesFocus: boolean;
|
|
86
107
|
mode: ShadowRootMode;
|
|
87
108
|
serializable?: boolean;
|
|
88
109
|
slotAssignment?: SlotAssignmentMode;
|
|
89
110
|
};
|
|
90
|
-
private
|
|
91
|
-
constructor();
|
|
111
|
+
private formResetObserver?;
|
|
92
112
|
/**
|
|
93
113
|
* If user did not provide an ID, auto-generate one so <label for="...">
|
|
94
114
|
* and various aria-* attributes can reference it.
|
|
95
115
|
*/
|
|
96
116
|
protected willUpdate(changedProps: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
97
|
-
/** The form this element is associated with, if any. */
|
|
98
|
-
get form(): HTMLFormElement;
|
|
99
117
|
protected updated(changedProps: Map<string, unknown>): void;
|
|
100
118
|
/**
|
|
101
|
-
*
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
119
|
+
* Connect to the closest form element and set up form integration
|
|
120
|
+
*/
|
|
121
|
+
connectedCallback(): void;
|
|
122
|
+
/**
|
|
123
|
+
* Set up form integration with ElementInternals
|
|
124
|
+
*/
|
|
125
|
+
private setupFormIntegration;
|
|
126
|
+
/**
|
|
127
|
+
* Set up external label association for native HTML label support
|
|
128
|
+
*/
|
|
129
|
+
private setupExternalLabelAssociation;
|
|
130
|
+
disconnectedCallback(): void;
|
|
131
|
+
/**
|
|
132
|
+
* Reset the input to its default state
|
|
133
|
+
*/
|
|
134
|
+
private resetToDefault;
|
|
135
|
+
/**
|
|
136
|
+
* Determines if validation errors should be shown based on current state
|
|
137
|
+
* and validation strategy
|
|
138
|
+
*/
|
|
139
|
+
private shouldShowValidation;
|
|
140
|
+
/**
|
|
141
|
+
* Validate input based on required, pattern, etc.
|
|
142
|
+
* This mimics native validation behavior
|
|
143
|
+
*/
|
|
144
|
+
private validateInput;
|
|
145
|
+
/**
|
|
146
|
+
* Check validity without showing validation UI
|
|
105
147
|
*/
|
|
106
148
|
checkValidity(): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Show validation UI and check validity
|
|
151
|
+
*/
|
|
107
152
|
reportValidity(): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Set a custom validation error message
|
|
155
|
+
*/
|
|
108
156
|
setCustomValidity(message: string): void;
|
|
109
157
|
firstUpdated(): void;
|
|
158
|
+
/**
|
|
159
|
+
* Set up input event handling for value changes
|
|
160
|
+
*/
|
|
161
|
+
private setupInputEvents;
|
|
162
|
+
/**
|
|
163
|
+
* Set up focus/blur event handling
|
|
164
|
+
*/
|
|
165
|
+
private setupFocusBlurEvents;
|
|
166
|
+
/**
|
|
167
|
+
* Set up autofill detection
|
|
168
|
+
*/
|
|
169
|
+
private setupAutofillDetection;
|
|
170
|
+
/**
|
|
171
|
+
* Set up enter key event handling
|
|
172
|
+
*/
|
|
173
|
+
private setupEnterKeyEvents;
|
|
110
174
|
/** Selects all text within the input. */
|
|
111
175
|
select(): void;
|
|
112
176
|
/** Returns the native validity state of the inner <input>. */
|
|
113
177
|
getValidity(): ValidityState | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* Sets the selection range. Mirrors native input.setSelectionRange
|
|
180
|
+
*/
|
|
181
|
+
setSelectionRange(start: number, end: number, direction?: 'forward' | 'backward' | 'none'): void;
|
|
182
|
+
/**
|
|
183
|
+
* Returns the selected text within the input (start position)
|
|
184
|
+
*/
|
|
185
|
+
get selectionStart(): number | null;
|
|
186
|
+
/**
|
|
187
|
+
* Returns the selected text within the input (end position)
|
|
188
|
+
*/
|
|
189
|
+
get selectionEnd(): number | null;
|
|
190
|
+
/**
|
|
191
|
+
* Returns the direction of selection
|
|
192
|
+
*/
|
|
193
|
+
get selectionDirection(): 'forward' | 'backward' | 'none' | null;
|
|
194
|
+
/**
|
|
195
|
+
* Sets the range of text to be selected.
|
|
196
|
+
*/
|
|
197
|
+
setRangeText(replacement: string, start?: number, end?: number, selectMode?: 'select' | 'start' | 'end' | 'preserve'): void;
|
|
114
198
|
/**
|
|
115
199
|
* Override to forward focus to the internal <input>.
|
|
116
200
|
* Also dispatch a 'focus' event for external listeners.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './progress';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare const SchmancyProgress_base: import("@mixins/index").Constructor<CustomElementConstructor> & import("@mixins/index").Constructor<import("@mixins/index").ITailwindElementMixin> & import("@mixins/index").Constructor<import("lit").LitElement> & import("@mixins/index").Constructor<import("@mixins/index").IBaseMixin>;
|
|
2
|
+
export default class SchmancyProgress extends SchmancyProgress_base {
|
|
3
|
+
value: number;
|
|
4
|
+
max: number;
|
|
5
|
+
indeterminate: boolean;
|
|
6
|
+
size: 'sm' | 'md' | 'lg';
|
|
7
|
+
color: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success';
|
|
8
|
+
glass: boolean;
|
|
9
|
+
private get percentage();
|
|
10
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
'schmancy-progress': SchmancyProgress;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const RadioButton_base: import("@mixins/index").Constructor<import("
|
|
1
|
+
declare const RadioButton_base: import("@mixins/index").Constructor<import("@mixins/index").IFormFieldMixin> & import("@mixins/index").Constructor<CustomElementConstructor> & import("@mixins/index").Constructor<import("@mixins/index").ITailwindElementMixin> & import("@mixins/index").Constructor<import("lit").LitElement> & import("@mixins/index").Constructor<import("@mixins/index").IBaseMixin>;
|
|
2
2
|
export declare class RadioButton extends RadioButton_base {
|
|
3
3
|
value: string;
|
|
4
4
|
checked: boolean;
|
|
@@ -5,7 +5,7 @@ export type SchmancyRadioGroupOption = {
|
|
|
5
5
|
export type SchmancyRadioGroupChangeEvent = CustomEvent<{
|
|
6
6
|
value: string;
|
|
7
7
|
}>;
|
|
8
|
-
declare const RadioGroup_base: import("@mixins/index").Constructor<import("
|
|
8
|
+
declare const RadioGroup_base: import("@mixins/index").Constructor<import("@mixins/index").IFormFieldMixin> & import("@mixins/index").Constructor<CustomElementConstructor> & import("@mixins/index").Constructor<import("@mixins/index").ITailwindElementMixin> & import("@mixins/index").Constructor<import("lit").LitElement> & import("@mixins/index").Constructor<import("@mixins/index").IBaseMixin>;
|
|
9
9
|
export declare class RadioGroup extends RadioGroup_base {
|
|
10
10
|
label: string;
|
|
11
11
|
name: string;
|
package/dist/input-DcWJTrr9.cjs
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";const h=require("lit"),i=require("lit/decorators.js"),d=require("lit/directives/if-defined.js"),y=require("lit/directives/ref.js"),b=require("lit/directives/when.js"),r=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const E=require("./tailwind.mixin-DNME2oUL.cjs"),v=require("./ripple-C2BHbhcS.cjs"),f=require("./theme.interface-Xg5Zi46a.cjs"),w=require("./formField.mixin-BrHllh45.cjs"),g="/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */:host{width:100%;min-width:calc(var(--spacing,.25rem)*0);box-sizing:border-box;max-width:100%;display:block}.date-input-container{width:100%;min-width:0;width:100%!important;max-width:100%!important}input{appearance:none;border-radius:8px;width:-webkit-fill-available;font-size:16px}input[type=number]::-webkit-inner-spin-button{appearance:none;margin:calc(var(--spacing,.25rem)*0)}input[type=number]::-webkit-outer-spin-button{appearance:none;margin:calc(var(--spacing,.25rem)*0)}input[type=number]{appearance:textfield}input:-webkit-autofill{animation-name:onAutoFillStart;-webkit-box-shadow:0 0 0 30px var(--schmancy-sys-color-surface-highest)inset!important;-webkit-text-fill-color:var(--schmancy-sys-color-surface-on)!important}input:autofill{background-color:var(--schmancy-sys-color-surface-highest)!important;color:var(--schmancy-sys-color-surface-on)!important}input[type=date],input[type=datetime-local],input[type=time],input[type=month],input[type=week]{appearance:none;width:100%;line-height:inherit;border-radius:8px;min-width:100%;max-width:100%;margin:0;display:block;overflow:hidden;border-radius:8px!important;width:100%!important}input::-webkit-datetime-edit{align-items:center;width:100%;height:100%;margin:0;padding:0;display:flex}input::-webkit-datetime-edit-fields-wrapper{align-items:center;width:100%;height:100%;margin:0;padding:0;display:flex}input::-webkit-datetime-edit{flex:1;width:100%}input::-webkit-datetime-edit-fields-wrapper{flex:1;justify-content:space-between;width:100%}input::-webkit-datetime-edit-text{align-items:center;display:flex}input::-webkit-datetime-edit-day-field{flex-shrink:0;padding:0 2px}input::-webkit-datetime-edit-month-field{flex-shrink:0;padding:0 2px}input::-webkit-datetime-edit-year-field{flex-shrink:0;padding:0 2px}input::-webkit-datetime-edit-hour-field{flex-shrink:0;padding:0 2px}input::-webkit-datetime-edit-minute-field{flex-shrink:0;padding:0 2px}input::-webkit-datetime-edit-second-field{flex-shrink:0;padding:0 2px}input::-webkit-datetime-edit-millisecond-field{flex-shrink:0;padding:0 2px}input::-webkit-datetime-edit-meridiem-field{flex-shrink:0;padding:0 2px}input[type=date]::-webkit-calendar-picker-indicator{opacity:.5;cursor:pointer}input[type=datetime-local]::-webkit-calendar-picker-indicator{opacity:.5;cursor:pointer}input[type=time]::-webkit-calendar-picker-indicator{opacity:.5;cursor:pointer}input[type=month]::-webkit-calendar-picker-indicator{opacity:.5;cursor:pointer}input[type=week]::-webkit-calendar-picker-indicator{opacity:.5;cursor:pointer}@-moz-document url-prefix(){input[type=date],input[type=datetime-local],input[type=time]{min-height:inherit}}@supports (-webkit-touch-callout:none){input[type=date],input[type=datetime-local],input[type=time],input[type=month],input[type=week]{appearance:none;border-radius:0;width:-webkit-fill-available!important;width:fill-available!important;padding-left:12px!important;padding-right:12px!important}input::-webkit-datetime-edit{width:100%!important;padding-left:0!important;padding-right:0!important}input::-webkit-datetime-edit-fields-wrapper{width:100%!important;margin:0!important;padding:0!important}}";var k=Object.defineProperty,x=Object.getOwnPropertyDescriptor,n=(t,e,a,p)=>{for(var c,u=p>1?void 0:p?x(e,a):e,m=t.length-1;m>=0;m--)(c=t[m])&&(u=(p?c(e,a,u):c(u))||u);return p&&u&&k(e,a,u),u};let s=class extends E.TailwindElement(g){constructor(){if(super(),this.id="",this.label="",this.type="text",this.name=`name_${Date.now()}`,this.placeholder="",this.value="",this.required=!1,this.disabled=!1,this.readonly=!1,this.clickable=!1,this.spellcheck=!1,this.align="left",this.autofocus=!1,this.autocomplete="on",this.tabIndex=0,this.error=!1,this.size="md",this.validateOn="touched",this.validationMessage="",this.inputRef=y.createRef(),this.isAutofilled=!1,this.touched=!1,this.dirty=!1,this.submitted=!1,this.defaultValue="","attachInternals"in this)try{this.internals=this.attachInternals()}catch{this.internals=void 0}}willUpdate(t){this.id||(this.id="sch-input-"+s._idCounter++),super.willUpdate(t)}get form(){return this.internals?.form??null}updated(t){super.updated(t),t.has("value")&&(this.value!==this.defaultValue&&(this.dirty=!0),this.internals?.setFormValue(this.value),this.validateInput()),t.has("error")&&this.updateValidityState(),!this.hasUpdated&&t.has("value")&&(this.defaultValue=this.value)}connectedCallback(){super.connectedCallback(),this.defaultValue=this.value,this.setupFormIntegration(),this.setupExternalLabelAssociation()}setupFormIntegration(){this.internals?.form&&(this.formResetObserver=new MutationObserver(t=>{for(const e of t)e.type==="attributes"&&e.attributeName==="reset"&&this.resetToDefault()}),this.formResetObserver.observe(this.internals.form,{attributes:!0,childList:!1,subtree:!1}),this.internals.form.addEventListener("reset",()=>{this.resetToDefault()}),this.internals.form.addEventListener("submit",()=>{this.submitted=!0,this.validateInput(!0)}))}setupExternalLabelAssociation(){if(this.id){const t=()=>{document.querySelectorAll(`label[for="${this.id}"]`).forEach(e=>{e.addEventListener("click",()=>{this.focus()})})};document.readyState==="complete"?t():document.addEventListener("DOMContentLoaded",t)}}disconnectedCallback(){super.disconnectedCallback(),this.formResetObserver&&this.formResetObserver.disconnect(),this.id&&document.querySelectorAll(`label[for="${this.id}"]`).forEach(t=>{t.removeEventListener("click",()=>{this.focus()})})}resetToDefault(){this.value=this.defaultValue,this.touched=!1,this.dirty=!1,this.submitted=!1,this.error=!1,this.validationMessage="",this.dispatchEvent(new CustomEvent("reset",{bubbles:!0}))}shouldShowValidation(t=!1){if(t)return!0;switch(this.validateOn){case"always":return!0;case"touched":default:return this.touched;case"dirty":return this.dirty;case"submitted":return this.submitted}}updateValidityState(){this.error?this.validationMessage?this.internals?.setValidity({customError:!0},this.validationMessage,this.inputElement):this.internals?.setValidity({customError:!0},"Invalid input",this.inputElement):this.internals?.setValidity({})}validateInput(t=!1){if(this.disabled)return;const e=this.shouldShowValidation(t),a=this.inputElement?.validity??{customError:!1,valid:!0},p=!a.valid&&!a.customError;e&&p?(this.error=!0,this.validationMessage=this.inputElement?.validationMessage||""):a.valid?(this.error=!1,a.customError||(this.validationMessage="")):e||(this.error=!1),this.updateValidityState()}checkValidity(){const t=this.inputRef.value?.checkValidity()??!0;return this.internals&&!t?(this.internals.checkValidity(),!1):t}reportValidity(){this.touched=!0,this.submitted=!0;const t=this.inputRef.value?.reportValidity()??!0;return this.validateInput(!0),this.internals&&!t?(this.internals.reportValidity(),!1):t}setCustomValidity(t){this.inputRef.value&&this.inputRef.value.setCustomValidity(t),this.validationMessage=t,this.error=t!==""&&this.shouldShowValidation(),this.internals&&(t?this.internals.setValidity({customError:!0},t,this.inputElement):this.internals.setValidity({}))}firstUpdated(){this.autofocus&&setTimeout(()=>{this.focus()},0),this.setupInputEvents(),this.setupFocusBlurEvents(),this.setupAutofillDetection(),this.setupEnterKeyEvents()}setupInputEvents(){r.fromEvent(this.inputElement,"input").pipe(r.map(t=>{const e=t;return{value:t.target.value,inputType:e.inputType,data:e.data,isComposing:e.isComposing,originalEvent:t}}),r.takeUntil(this.disconnecting)).subscribe(t=>{this.value=t.value,this.dirty=this.value!==this.defaultValue;const e=new CustomEvent("input",{detail:{value:t.value},bubbles:!0,composed:!0});Object.defineProperties(e,{inputType:{value:t.inputType},data:{value:t.data},isComposing:{value:t.isComposing}}),this.dispatchEvent(e),this.validateInput()}),r.fromEvent(this.inputElement,"change").pipe(r.map(t=>t.target.value),r.distinctUntilChanged(),r.takeUntil(this.disconnecting)).subscribe(t=>{this.value=t,this.dirty=this.value!==this.defaultValue,this.dispatchEvent(new CustomEvent("change",{detail:{value:t},bubbles:!0,composed:!0})),this.validateInput()})}setupFocusBlurEvents(){r.fromEvent(this.inputElement,"focus").pipe(r.takeUntil(this.disconnecting)).subscribe(t=>{const e=new CustomEvent("focus",{bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed});Object.defineProperties(e,{relatedTarget:{value:t.relatedTarget}}),this.dispatchEvent(e)}),r.fromEvent(this.inputElement,"blur").pipe(r.takeUntil(this.disconnecting)).subscribe(t=>{this.touched=!0,this.disabled||this.validateInput();const e=new CustomEvent("blur",{bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed});Object.defineProperties(e,{relatedTarget:{value:t.relatedTarget}}),this.dispatchEvent(e)})}setupAutofillDetection(){r.fromEvent(this.inputElement,"animationstart").pipe(r.filter(t=>t.animationName==="onAutoFillStart"),r.takeUntil(this.disconnecting)).subscribe(t=>{const{value:e}=t.target;this.value=e,this.isAutofilled=!0,this.dirty=this.value!==this.defaultValue,this.dispatchEvent(new CustomEvent("autofill",{detail:{value:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:e},bubbles:!0,composed:!0}))}),r.fromEvent(this.inputElement,"animationstart").pipe(r.filter(t=>t.animationName==="onAutoFillCancel"),r.takeUntil(this.disconnecting)).subscribe(()=>{this.isAutofilled=!1})}setupEnterKeyEvents(){r.fromEvent(this.inputElement,"keyup").pipe(r.filter(t=>t.key==="Enter"),r.takeUntil(this.disconnecting)).subscribe(t=>{const{value:e}=t.target;this.value=e,this.dirty=this.value!==this.defaultValue;const a=new CustomEvent("enter",{detail:{value:e},bubbles:!0,composed:!0});Object.defineProperties(a,{key:{value:"Enter"},code:{value:"Enter"},keyCode:{value:13},which:{value:13}}),this.dispatchEvent(a)})}select(){return this.inputRef.value?.select()}getValidity(){return this.inputRef.value?.validity}setSelectionRange(t,e,a){this.inputRef.value?.setSelectionRange(t,e,a)}get selectionStart(){return this.inputRef.value?.selectionStart??null}get selectionEnd(){return this.inputRef.value?.selectionEnd??null}get selectionDirection(){return this.inputRef.value?.selectionDirection??null}setRangeText(t,e,a,p){e!==void 0&&a!==void 0?this.inputRef.value?.setRangeText(t,e,a,p):this.inputRef.value?.setRangeText(t)}focus(t){this.inputRef.value?.focus(t),this.dispatchEvent(new Event("focus"))}click(){this.inputRef.value?.click(),this.dispatchEvent(new Event("click"))}blur(){this.inputRef.value?.blur(),this.dispatchEvent(new Event("blur"))}render(){const{height:t,padding:e,fontSize:a}=(()=>{switch(this.size){case"sm":return{height:"40px",padding:"0 8px",fontSize:"0.875rem"};case"lg":return{height:"60px",padding:"0 20px",fontSize:"1.125rem"};default:return{height:"50px",padding:"0 16px",fontSize:"1rem"}}})(),p={"w-full flex-1 rounded-[8px] border-0 bg-surface-highest text-surface-on":!0,"outline-secondary-default focus:outline-1 ":!0,"outline-secondary-default focus:outline-1":!0,"disabled:opacity-40 disabled:cursor-not-allowed":!0,"placeholder:text-muted":!0,"ring-0 ring-inset focus:ring-1 focus:ring-inset":!0,"ring-secondary-default ring-outline focus:ring-secondary-default":!this.error,"ring-error-default focus:ring-error-default":this.error,"caret-transparent focus:outline-hidden cursor-pointer text-select-none":this.readonly,"cursor-pointer":this.clickable,"text-center":this.align==="center","text-right":this.align==="right",autofilled:this.isAutofilled},c={"opacity-40":this.disabled,"block mb-[4px]":!0,"text-sm":this.size==="sm","text-base":this.size==="md","text-lg":this.size==="lg"},u={height:t,padding:e,fontSize:a};return h.html`
|
|
2
|
-
${b.when(this.label,()=>h.html`
|
|
3
|
-
<label
|
|
4
|
-
for=${this.id}
|
|
5
|
-
id="label-${this.id}"
|
|
6
|
-
class=${this.classMap(c)}
|
|
7
|
-
${v.color({color:this.error?f.SchmancyTheme.sys.color.error.default:f.SchmancyTheme.sys.color.primary.default})}
|
|
8
|
-
>
|
|
9
|
-
<schmancy-typography type="label" token=${this.size==="sm"?"sm":this.size==="lg"?"lg":"md"}>
|
|
10
|
-
${this.label}
|
|
11
|
-
</schmancy-typography>
|
|
12
|
-
</label>
|
|
13
|
-
`)}
|
|
14
|
-
|
|
15
|
-
<input
|
|
16
|
-
${v.color({bgColor:f.SchmancyTheme.sys.color.surface.highest,color:f.SchmancyTheme.sys.color.surface.on})}
|
|
17
|
-
${y.ref(this.inputRef)}
|
|
18
|
-
id=${this.id}
|
|
19
|
-
name=${this.name}
|
|
20
|
-
class=${this.classMap(p)}
|
|
21
|
-
style=${this.styleMap(u)}
|
|
22
|
-
.value=${this.value}
|
|
23
|
-
.type=${this.type}
|
|
24
|
-
.autocomplete=${this.autocomplete}
|
|
25
|
-
.spellcheck=${this.spellcheck}
|
|
26
|
-
placeholder=${this.placeholder}
|
|
27
|
-
inputmode=${d.ifDefined(this.inputmode)}
|
|
28
|
-
pattern=${d.ifDefined(this.pattern)}
|
|
29
|
-
step=${d.ifDefined(this.step)}
|
|
30
|
-
minlength=${d.ifDefined(this.minlength)}
|
|
31
|
-
maxlength=${d.ifDefined(this.maxlength)}
|
|
32
|
-
min=${d.ifDefined(this.min)}
|
|
33
|
-
max=${d.ifDefined(this.max)}
|
|
34
|
-
list=${d.ifDefined(this.list)}
|
|
35
|
-
?required=${this.required}
|
|
36
|
-
?disabled=${this.disabled}
|
|
37
|
-
?readonly=${this.readonly}
|
|
38
|
-
aria-invalid=${this.error?"true":"false"}
|
|
39
|
-
aria-required=${this.required?"true":"false"}
|
|
40
|
-
aria-labelledby=${this.label?`label-${this.id}`:h.nothing}
|
|
41
|
-
aria-describedby=${this.hint?`hint-${this.id}`:h.nothing}
|
|
42
|
-
aria-label=${d.ifDefined(this.label?void 0:this.placeholder||"Input")}
|
|
43
|
-
aria-autocomplete=${this.list?"list":"none"}
|
|
44
|
-
/>
|
|
45
|
-
|
|
46
|
-
${b.when(this.hint,()=>h.html`
|
|
47
|
-
<div
|
|
48
|
-
id="hint-${this.id}"
|
|
49
|
-
class="${this.size==="sm"?"pt-[1px] text-xs":this.size==="lg"?"pt-[3px] text-base":"pt-[2px] text-sm"}"
|
|
50
|
-
${v.color({color:this.error?f.SchmancyTheme.sys.color.error.default:f.SchmancyTheme.sys.color.primary.default})}
|
|
51
|
-
>
|
|
52
|
-
<schmancy-typography
|
|
53
|
-
align="left"
|
|
54
|
-
type="label"
|
|
55
|
-
token=${this.size==="sm"?"sm":this.size==="lg"?"lg":"md"}
|
|
56
|
-
>
|
|
57
|
-
${this.hint}
|
|
58
|
-
</schmancy-typography>
|
|
59
|
-
</div>
|
|
60
|
-
`)}
|
|
61
|
-
`}};s._idCounter=0,s.formAssociated=!0,s.shadowRootOptions={...h.LitElement.shadowRootOptions,delegatesFocus:!0},n([i.property({reflect:!0})],s.prototype,"id",2),n([i.property({type:String})],s.prototype,"label",2),n([i.property({reflect:!0})],s.prototype,"type",2),n([i.property()],s.prototype,"name",2),n([i.property()],s.prototype,"placeholder",2),n([i.property({type:String,reflect:!0})],s.prototype,"value",2),n([i.property({type:String,reflect:!0})],s.prototype,"pattern",2),n([i.property({type:Boolean,reflect:!0})],s.prototype,"required",2),n([i.property({type:Boolean,reflect:!0})],s.prototype,"disabled",2),n([i.property({type:Boolean,reflect:!0})],s.prototype,"readonly",2),n([i.property({type:Boolean,reflect:!0})],s.prototype,"clickable",2),n([i.property({type:Boolean,reflect:!0})],s.prototype,"spellcheck",2),n([i.property({type:String,reflect:!0})],s.prototype,"align",2),n([i.property()],s.prototype,"inputmode",2),n([i.property({type:Number,reflect:!0})],s.prototype,"minlength",2),n([i.property({type:Number})],s.prototype,"maxlength",2),n([i.property()],s.prototype,"min",2),n([i.property()],s.prototype,"max",2),n([i.property({type:Number,reflect:!0})],s.prototype,"step",2),n([i.property({type:Boolean})],s.prototype,"autofocus",2),n([i.property({type:String,reflect:!0})],s.prototype,"autocomplete",2),n([i.property({type:Number,reflect:!0})],s.prototype,"tabIndex",2),n([i.property()],s.prototype,"hint",2),n([i.property({type:Boolean,reflect:!0})],s.prototype,"error",2),n([i.property({type:String,reflect:!0})],s.prototype,"size",2),n([i.property({type:String})],s.prototype,"validateOn",2),n([i.property({type:String})],s.prototype,"list",2),n([i.property({type:String})],s.prototype,"validationMessage",2),n([i.query("input")],s.prototype,"inputElement",2),n([i.state()],s.prototype,"isAutofilled",2),n([i.state()],s.prototype,"touched",2),n([i.state()],s.prototype,"dirty",2),n([i.state()],s.prototype,"submitted",2),n([i.state()],s.prototype,"defaultValue",2),s=n([i.customElement("sch-input")],s);var $=Object.defineProperty,S=Object.getOwnPropertyDescriptor,o=(t,e,a,p)=>{for(var c,u=p>1?void 0:p?S(e,a):e,m=t.length-1;m>=0;m--)(c=t[m])&&(u=(p?c(e,a,u):c(u))||u);return p&&u&&$(e,a,u),u};let l=class extends w.SchmancyFormField(g){constructor(){super(...arguments),this.value="",this.type="text",this.placeholder="",this.clickable=!1,this.spellcheck=!1,this.align="left",this.autofocus=!1,this.autocomplete="on",this.tabIndex=0,this.size="md",this.validateOn="touched",this.inputRef=y.createRef(),this.isAutofilled=!1,this.touched=!1,this.dirty=!1,this.submitted=!1,this.defaultValue=""}willUpdate(t){this.id||(this.id="sch-input-"+l._idCounter++),super.willUpdate(t)}updated(t){super.updated(t),t.has("value")&&(this.value!==this.defaultValue&&(this.dirty=!0),this.validateInput()),!this.hasUpdated&&t.has("value")&&(this.defaultValue=this.value)}connectedCallback(){super.connectedCallback(),this.defaultValue=this.value,this.setupFormIntegration(),this.setupExternalLabelAssociation()}setupFormIntegration(){this.form&&(this.formResetObserver=new MutationObserver(t=>{for(const e of t)e.type==="attributes"&&e.attributeName==="reset"&&this.resetToDefault()}),this.formResetObserver.observe(this.form,{attributes:!0,childList:!1,subtree:!1}),this.form.addEventListener("reset",()=>{this.resetToDefault()}),this.form.addEventListener("submit",()=>{this.submitted=!0,this.validateInput(!0)}))}setupExternalLabelAssociation(){if(this.id){const t=()=>{document.querySelectorAll(`label[for="${this.id}"]`).forEach(e=>{e.addEventListener("click",()=>{this.focus()})})};document.readyState==="complete"?t():document.addEventListener("DOMContentLoaded",t)}}disconnectedCallback(){super.disconnectedCallback(),this.formResetObserver&&this.formResetObserver.disconnect(),this.id&&document.querySelectorAll(`label[for="${this.id}"]`).forEach(t=>{t.removeEventListener("click",()=>{this.focus()})})}resetToDefault(){this.value=this.defaultValue,this.touched=!1,this.dirty=!1,this.submitted=!1,this.error=!1,this.validationMessage="",this.dispatchEvent(new CustomEvent("reset",{bubbles:!0}))}shouldShowValidation(t=!1){if(t)return!0;switch(this.validateOn){case"always":return!0;case"touched":default:return this.touched;case"dirty":return this.dirty;case"submitted":return this.submitted}}validateInput(t=!1){if(this.disabled)return;const e=this.shouldShowValidation(t),a=this.inputElement?.validity??{customError:!1,valid:!0},p=!a.valid&&!a.customError;e&&p?(this.error=!0,this.validationMessage=this.inputElement?.validationMessage||""):a.valid?(this.error=!1,a.customError||(this.validationMessage="")):e||(this.error=!1)}checkValidity(){const t=this.inputRef.value?.checkValidity()??!0,e=super.checkValidity();return t&&e}reportValidity(){this.touched=!0,this.submitted=!0;const t=this.inputRef.value?.reportValidity()??!0;this.validateInput(!0);const e=super.reportValidity();return t&&e}setCustomValidity(t){this.inputRef.value&&this.inputRef.value.setCustomValidity(t),super.setCustomValidity(t),this.error=t!==""&&this.shouldShowValidation()}firstUpdated(){this.autofocus&&setTimeout(()=>{this.focus()},0),this.setupInputEvents(),this.setupFocusBlurEvents(),this.setupAutofillDetection(),this.setupEnterKeyEvents()}setupInputEvents(){r.fromEvent(this.inputElement,"input").pipe(r.map(t=>{const e=t;return{value:t.target.value,inputType:e.inputType,data:e.data,isComposing:e.isComposing,originalEvent:t}}),r.takeUntil(this.disconnecting)).subscribe(t=>{this.value=t.value,this.dirty=this.value!==this.defaultValue;const e=new CustomEvent("input",{detail:{value:t.value},bubbles:!0,composed:!0});Object.defineProperties(e,{inputType:{value:t.inputType},data:{value:t.data},isComposing:{value:t.isComposing}}),this.dispatchEvent(e),this.validateInput()}),r.fromEvent(this.inputElement,"change").pipe(r.map(t=>t.target.value),r.distinctUntilChanged(),r.takeUntil(this.disconnecting)).subscribe(t=>{this.value=t,this.dirty=this.value!==this.defaultValue,this.emitChange({value:t}),this.validateInput()})}setupFocusBlurEvents(){r.fromEvent(this.inputElement,"focus").pipe(r.takeUntil(this.disconnecting)).subscribe(t=>{const e=new CustomEvent("focus",{bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed});Object.defineProperties(e,{relatedTarget:{value:t.relatedTarget}}),this.dispatchEvent(e)}),r.fromEvent(this.inputElement,"blur").pipe(r.takeUntil(this.disconnecting)).subscribe(t=>{this.touched=!0,this.disabled||this.validateInput();const e=new CustomEvent("blur",{bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed});Object.defineProperties(e,{relatedTarget:{value:t.relatedTarget}}),this.dispatchEvent(e)})}setupAutofillDetection(){r.fromEvent(this.inputElement,"animationstart").pipe(r.filter(t=>t.animationName==="onAutoFillStart"),r.takeUntil(this.disconnecting)).subscribe(t=>{const{value:e}=t.target;this.value=e,this.isAutofilled=!0,this.dirty=this.value!==this.defaultValue,this.dispatchEvent(new CustomEvent("autofill",{detail:{value:e},bubbles:!0,composed:!0})),this.emitChange({value:e})}),r.fromEvent(this.inputElement,"animationstart").pipe(r.filter(t=>t.animationName==="onAutoFillCancel"),r.takeUntil(this.disconnecting)).subscribe(()=>{this.isAutofilled=!1})}setupEnterKeyEvents(){r.fromEvent(this.inputElement,"keydown").pipe(r.filter(t=>t.key==="Enter"),r.takeUntil(this.disconnecting)).subscribe(t=>{const{value:e}=t.target;this.value!==e&&(this.value=e,this.dirty=this.value!==this.defaultValue),this.inputElement.blur();const a=new CustomEvent("enter",{detail:{value:this.value},bubbles:!0,composed:!0});Object.defineProperties(a,{key:{value:"Enter"},code:{value:"Enter"},keyCode:{value:13},which:{value:13}}),this.dispatchEvent(a)})}select(){return this.inputRef.value?.select()}getValidity(){return this.inputRef.value?.validity}setSelectionRange(t,e,a){this.inputRef.value?.setSelectionRange(t,e,a)}get selectionStart(){return this.inputRef.value?.selectionStart??null}get selectionEnd(){return this.inputRef.value?.selectionEnd??null}get selectionDirection(){return this.inputRef.value?.selectionDirection??null}setRangeText(t,e,a,p){e!==void 0&&a!==void 0?this.inputRef.value?.setRangeText(t,e,a,p):this.inputRef.value?.setRangeText(t)}focus(t){this.inputRef.value?.focus(t),this.dispatchEvent(new Event("focus"))}click(){this.inputRef.value?.click(),this.dispatchEvent(new Event("click"))}blur(){this.inputRef.value?.blur(),this.dispatchEvent(new Event("blur"))}render(){const{height:t,padding:e,fontSize:a}=(()=>{switch(this.size){case"sm":return{height:"40px",padding:"0 8px",fontSize:"0.875rem"};case"lg":return{height:"60px",padding:"0 20px",fontSize:"1.125rem"};default:return{height:"50px",padding:"0 16px",fontSize:"1rem"}}})(),p=["date","datetime-local","time","month","week"].includes(this.type),c={"block w-full min-w-0 rounded-[8px] border-0 bg-surface-highest text-surface-on":!0,"outline-secondary-default focus:outline-1":!0,"disabled:opacity-40 disabled:cursor-not-allowed":!0,"placeholder:text-muted":!0,"ring-0 ring-inset focus:ring-1 focus:ring-inset":!0,"ring-secondary-default ring-outline focus:ring-secondary-default":!this.error,"ring-error-default focus:ring-error-default":this.error,"caret-transparent focus:outline-hidden cursor-pointer select-none":this.readonly,"cursor-pointer":this.clickable,"text-left":this.align==="left"||p,"text-center":this.align==="center"&&!p,"text-right":this.align==="right"&&!p,autofilled:this.isAutofilled},u={"block mb-1 font-medium":!0,"opacity-40":this.disabled,"text-sm":this.size==="sm","text-base":this.size==="md","text-lg":this.size==="lg","text-primary-default":!this.error,"text-error-default":this.error},m={height:t,padding:e,fontSize:a,lineHeight:t};return h.html`
|
|
62
|
-
<div class="w-full min-w-0 ${p?"date-input-container":""}">
|
|
63
|
-
${b.when(this.label,()=>h.html`
|
|
64
|
-
<label
|
|
65
|
-
for=${this.id}
|
|
66
|
-
class=${this.classMap(u)}
|
|
67
|
-
>
|
|
68
|
-
${this.label}
|
|
69
|
-
</label>
|
|
70
|
-
`)}
|
|
71
|
-
|
|
72
|
-
<input
|
|
73
|
-
${y.ref(this.inputRef)}
|
|
74
|
-
id=${this.id}
|
|
75
|
-
name=${this.name}
|
|
76
|
-
class=${this.classMap(c)}
|
|
77
|
-
style=${this.styleMap(m)}
|
|
78
|
-
.value=${this.value}
|
|
79
|
-
.type=${this.type}
|
|
80
|
-
.autocomplete=${this.autocomplete}
|
|
81
|
-
.spellcheck=${this.spellcheck}
|
|
82
|
-
placeholder=${this.placeholder}
|
|
83
|
-
inputmode=${d.ifDefined(this.inputmode)}
|
|
84
|
-
pattern=${d.ifDefined(this.pattern)}
|
|
85
|
-
step=${d.ifDefined(this.step)}
|
|
86
|
-
minlength=${d.ifDefined(this.minlength)}
|
|
87
|
-
maxlength=${d.ifDefined(this.maxlength)}
|
|
88
|
-
min=${d.ifDefined(this.min)}
|
|
89
|
-
max=${d.ifDefined(this.max)}
|
|
90
|
-
list=${d.ifDefined(this.list)}
|
|
91
|
-
?required=${this.required}
|
|
92
|
-
?disabled=${this.disabled}
|
|
93
|
-
?readonly=${this.readonly}
|
|
94
|
-
aria-invalid=${this.error?"true":"false"}
|
|
95
|
-
aria-required=${this.required?"true":"false"}
|
|
96
|
-
aria-labelledby=${this.label?`label-${this.id}`:h.nothing}
|
|
97
|
-
aria-describedby=${this.hint||this.validationMessage?`hint-${this.id}`:h.nothing}
|
|
98
|
-
aria-label=${d.ifDefined(this.label?void 0:this.placeholder||"Input")}
|
|
99
|
-
/>
|
|
100
|
-
|
|
101
|
-
${b.when(this.hint||this.error&&this.validationMessage,()=>h.html`
|
|
102
|
-
<div
|
|
103
|
-
id="hint-${this.id}"
|
|
104
|
-
class="mt-1 text-sm ${this.error?"text-error-default":"text-surface-onVariant"}"
|
|
105
|
-
>
|
|
106
|
-
${this.error&&this.validationMessage?this.validationMessage:this.hint}
|
|
107
|
-
</div>
|
|
108
|
-
`)}
|
|
109
|
-
</div>
|
|
110
|
-
`}};l._idCounter=0,l.shadowRootOptions={...h.LitElement.shadowRootOptions,delegatesFocus:!0},o([i.property({type:String,reflect:!0})],l.prototype,"value",2),o([i.property({reflect:!0})],l.prototype,"type",2),o([i.property()],l.prototype,"placeholder",2),o([i.property({type:String,reflect:!0})],l.prototype,"pattern",2),o([i.property({type:Boolean,reflect:!0})],l.prototype,"clickable",2),o([i.property({type:Boolean,reflect:!0})],l.prototype,"spellcheck",2),o([i.property({type:String,reflect:!0})],l.prototype,"align",2),o([i.property()],l.prototype,"inputmode",2),o([i.property({type:Number,reflect:!0})],l.prototype,"minlength",2),o([i.property({type:Number})],l.prototype,"maxlength",2),o([i.property()],l.prototype,"min",2),o([i.property()],l.prototype,"max",2),o([i.property({type:Number,reflect:!0})],l.prototype,"step",2),o([i.property({type:Boolean})],l.prototype,"autofocus",2),o([i.property({type:String,reflect:!0})],l.prototype,"autocomplete",2),o([i.property({type:Number,reflect:!0})],l.prototype,"tabIndex",2),o([i.property({type:String,reflect:!0})],l.prototype,"size",2),o([i.property({type:String})],l.prototype,"validateOn",2),o([i.property({type:String})],l.prototype,"list",2),o([i.query("input")],l.prototype,"inputElement",2),o([i.state()],l.prototype,"isAutofilled",2),o([i.state()],l.prototype,"touched",2),o([i.state()],l.prototype,"dirty",2),o([i.state()],l.prototype,"submitted",2),o([i.state()],l.prototype,"defaultValue",2),l=o([i.customElement("schmancy-input")],l);
|
|
111
|
-
//# sourceMappingURL=input-DcWJTrr9.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './countries';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SchmancyNotification } from './notification';
|
|
2
|
-
export type TNotification = 'success' | 'error' | 'warning' | 'info';
|
|
3
|
-
export type TNotificationConfig = {
|
|
4
|
-
action?: typeof Function;
|
|
5
|
-
duration?: number;
|
|
6
|
-
};
|
|
7
|
-
export declare const $notify: {
|
|
8
|
-
success: (message: string, config?: TNotificationConfig) => SchmancyNotification;
|
|
9
|
-
error: (message: string, config?: TNotificationConfig) => SchmancyNotification;
|
|
10
|
-
warning: (message: string, config?: TNotificationConfig) => SchmancyNotification;
|
|
11
|
-
info: (message: string, config?: TNotificationConfig) => SchmancyNotification;
|
|
12
|
-
dismiss: (component: SchmancyNotification) => void;
|
|
13
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type Action<T = any> = {
|
|
2
|
-
type: string;
|
|
3
|
-
payload?: T;
|
|
4
|
-
};
|
|
5
|
-
export type ActionCreator<P = void, R = void> = P extends void ? () => R : (payload: P) => R;
|
|
6
|
-
export type ActionCreatorMap<T> = {
|
|
7
|
-
[K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => R : never;
|
|
8
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function contextClear(): void;
|
package/types/src/v2/form.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
declare const SchForm_base: import("../../mixins").Constructor<CustomElementConstructor> & import("../../mixins").Constructor<import("@mixins/tailwind.mixin").ITailwindElementMixin> & import("../../mixins").Constructor<import("lit").LitElement> & import("../../mixins").Constructor<import("../../mixins").IBaseMixin>;
|
|
2
|
-
/**
|
|
3
|
-
* A form component that enforces native browser validation
|
|
4
|
-
* for all contained form elements.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```html
|
|
8
|
-
* <sch-form @submit=${handleSubmit}>
|
|
9
|
-
* <sch-input label="Name" required></sch-input>
|
|
10
|
-
* <schmancy-button type="submit">Submit</schmancy-button>
|
|
11
|
-
* </sch-form>
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export declare class SchForm extends SchForm_base {
|
|
15
|
-
/**
|
|
16
|
-
* If true, form validation will be skipped
|
|
17
|
-
*/
|
|
18
|
-
novalidate: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* The form's submission method (get or post)
|
|
21
|
-
*/
|
|
22
|
-
method: 'get' | 'post';
|
|
23
|
-
/**
|
|
24
|
-
* The URL to submit the form to
|
|
25
|
-
*/
|
|
26
|
-
action: string;
|
|
27
|
-
/**
|
|
28
|
-
* The form's encoding type
|
|
29
|
-
*/
|
|
30
|
-
enctype: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
|
|
31
|
-
/**
|
|
32
|
-
* Reference to the internal form element
|
|
33
|
-
*/
|
|
34
|
-
formElement: HTMLFormElement;
|
|
35
|
-
/**
|
|
36
|
-
* Handle form submission
|
|
37
|
-
* This is the key method that ensures browser validation works
|
|
38
|
-
*/
|
|
39
|
-
private handleSubmit;
|
|
40
|
-
/**
|
|
41
|
-
* Reset the form
|
|
42
|
-
*/
|
|
43
|
-
reset(): void;
|
|
44
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
45
|
-
}
|
|
46
|
-
declare global {
|
|
47
|
-
interface HTMLElementTagNameMap {
|
|
48
|
-
'sch-form': SchForm;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
export {};
|
package/types/src/v2/index.d.ts
DELETED
package/types/src/v2/input.d.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
declare const SchInput_base: import("../../mixins").Constructor<import("@mixins/formField.mixin").IFormFieldMixin> & import("../../mixins").Constructor<import("../../mixins").ITailwindElementMixin> & import("../../mixins").Constructor<import("lit").LitElement> & import("../../mixins").Constructor<import("../../mixins").IBaseMixin>;
|
|
2
|
-
/**
|
|
3
|
-
* A simplified input component that works with browser validation.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```html
|
|
7
|
-
* <sch-input
|
|
8
|
-
* label="Email"
|
|
9
|
-
* name="email"
|
|
10
|
-
* required
|
|
11
|
-
* type="email"
|
|
12
|
-
* ></sch-input>
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export default class SchInput extends SchInput_base {
|
|
16
|
-
/**
|
|
17
|
-
* The type of input (text, email, password, etc.)
|
|
18
|
-
*/
|
|
19
|
-
type: string;
|
|
20
|
-
/**
|
|
21
|
-
* Placeholder text
|
|
22
|
-
*/
|
|
23
|
-
placeholder: string;
|
|
24
|
-
/**
|
|
25
|
-
* Minimum input length
|
|
26
|
-
*/
|
|
27
|
-
minlength?: number;
|
|
28
|
-
/**
|
|
29
|
-
* Maximum input length
|
|
30
|
-
*/
|
|
31
|
-
maxlength?: number;
|
|
32
|
-
/**
|
|
33
|
-
* Pattern for validation
|
|
34
|
-
*/
|
|
35
|
-
pattern?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Whether to enable autocomplete
|
|
38
|
-
*/
|
|
39
|
-
autocomplete: string;
|
|
40
|
-
/**
|
|
41
|
-
* Reference to the internal input element
|
|
42
|
-
*/
|
|
43
|
-
private inputRef;
|
|
44
|
-
/**
|
|
45
|
-
* Handle input change
|
|
46
|
-
*/
|
|
47
|
-
private handleInput;
|
|
48
|
-
/**
|
|
49
|
-
* Focus the input
|
|
50
|
-
*/
|
|
51
|
-
focus(options?: FocusOptions): void;
|
|
52
|
-
/**
|
|
53
|
-
* Blur the input
|
|
54
|
-
*/
|
|
55
|
-
blur(): void;
|
|
56
|
-
/**
|
|
57
|
-
* Let the browser handle validation
|
|
58
|
-
*/
|
|
59
|
-
checkValidity(): boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Use the browser's built-in validation UI
|
|
62
|
-
*/
|
|
63
|
-
reportValidity(): boolean;
|
|
64
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
65
|
-
}
|
|
66
|
-
declare global {
|
|
67
|
-
interface HTMLElementTagNameMap {
|
|
68
|
-
'sch-input': SchInput;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
export {};
|