@mhmo91/schmancy 0.4.21 → 0.4.23

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.
Files changed (72) hide show
  1. package/ai/context.md +25 -2
  2. package/ai/store.md +4 -4
  3. package/dist/ai/context.md +25 -2
  4. package/dist/ai/store.md +4 -4
  5. package/dist/{avatar-CQceYbCt.cjs → avatar-D1ojwes6.cjs} +2 -2
  6. package/dist/{avatar-CQceYbCt.cjs.map → avatar-D1ojwes6.cjs.map} +1 -1
  7. package/dist/{avatar-CPbVhMW7.js → avatar-DzJUPJtZ.js} +4 -4
  8. package/dist/{avatar-CPbVhMW7.js.map → avatar-DzJUPJtZ.js.map} +1 -1
  9. package/dist/badge.cjs +1 -1
  10. package/dist/badge.js +1 -1
  11. package/dist/content-drawer.cjs +1 -1
  12. package/dist/content-drawer.js +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +192 -190
  15. package/dist/input-BN9xQTH0.cjs +111 -0
  16. package/dist/{input-DcWJTrr9.cjs.map → input-BN9xQTH0.cjs.map} +1 -1
  17. package/dist/{input-P8bwT-4D.js → input-DHNBYBq4.js} +5 -1
  18. package/dist/{input-P8bwT-4D.js.map → input-DHNBYBq4.js.map} +1 -1
  19. package/dist/input.cjs +1 -1
  20. package/dist/input.js +5 -1
  21. package/dist/nav-drawer.cjs +1 -1
  22. package/dist/nav-drawer.js +1 -1
  23. package/dist/{selector-hook-CYMLsOvh.cjs → selector-hook-Bf_lCnGW.cjs} +2 -2
  24. package/dist/{selector-hook-CYMLsOvh.cjs.map → selector-hook-Bf_lCnGW.cjs.map} +1 -1
  25. package/dist/{selector-hook-BvXML7_4.js → selector-hook-DPe2CGKx.js} +21 -21
  26. package/dist/{selector-hook-BvXML7_4.js.map → selector-hook-DPe2CGKx.js.map} +1 -1
  27. package/dist/{sheet-BiUUD0Td.cjs → sheet-BVr3bq9r.cjs} +2 -2
  28. package/dist/{sheet-BiUUD0Td.cjs.map → sheet-BVr3bq9r.cjs.map} +1 -1
  29. package/dist/{sheet-WpG2m2yT.js → sheet-CdcA_ZIk.js} +2 -2
  30. package/dist/{sheet-WpG2m2yT.js.map → sheet-CdcA_ZIk.js.map} +1 -1
  31. package/dist/sheet.cjs +1 -1
  32. package/dist/sheet.js +2 -2
  33. package/dist/{sheet.service-COPNmxwp.js → sheet.service-CKznL-dB.js} +125 -111
  34. package/dist/{sheet.service-COPNmxwp.js.map → sheet.service-CKznL-dB.js.map} +1 -1
  35. package/dist/{sheet.service-B5sh8d0k.cjs → sheet.service-D_jE8pUg.cjs} +3 -3
  36. package/dist/{sheet.service-B5sh8d0k.cjs.map → sheet.service-D_jE8pUg.cjs.map} +1 -1
  37. package/dist/store.cjs +1 -1
  38. package/dist/store.js +1 -1
  39. package/dist/teleport.cjs +1 -1
  40. package/dist/teleport.js +1 -1
  41. package/dist/theme.cjs +1 -1
  42. package/dist/theme.js +1 -1
  43. package/package.json +1 -1
  44. package/types/mixins/index.d.ts +1 -0
  45. package/types/src/busy/spinner.d.ts +1 -0
  46. package/types/src/card/actions.d.ts +3 -3
  47. package/types/src/card/content.d.ts +0 -3
  48. package/types/src/card/media.d.ts +1 -0
  49. package/types/src/chips/chip.d.ts +1 -1
  50. package/types/src/chips/chips.d.ts +1 -1
  51. package/types/src/date-range/date-range-dialog.d.ts +28 -0
  52. package/types/src/date-range/date-range-helpers.d.ts +27 -0
  53. package/types/src/date-range/date-range-presets.d.ts +18 -0
  54. package/types/src/date-range/date-range.d.ts +1 -27
  55. package/types/src/date-range-inline/date-range-inline.d.ts +111 -0
  56. package/types/src/date-range-inline/index.d.ts +2 -0
  57. package/types/src/index.d.ts +2 -0
  58. package/types/src/input/index.d.ts +2 -2
  59. package/types/src/input/input.d.ts +118 -34
  60. package/types/src/progress/index.d.ts +1 -0
  61. package/types/src/progress/progress.d.ts +17 -0
  62. package/types/src/radio-group/radio-button.d.ts +1 -1
  63. package/types/src/radio-group/radio-group.d.ts +1 -1
  64. package/dist/input-DcWJTrr9.cjs +0 -111
  65. package/types/src/data/countries.d.ts +0 -5
  66. package/types/src/data/index.d.ts +0 -1
  67. package/types/src/notification/$notification.d.ts +0 -13
  68. package/types/src/store/action-creator.d.ts +0 -8
  69. package/types/src/store/clear.d.ts +0 -1
  70. package/types/src/v2/form.d.ts +0 -51
  71. package/types/src/v2/index.d.ts +0 -2
  72. package/types/src/v2/input.d.ts +0 -71
@@ -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("../../mixins/formField.mixin").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>;
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;
@@ -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,5 +0,0 @@
1
- declare const _default: {
2
- name: string;
3
- code: string;
4
- }[];
5
- export default _default;
@@ -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;
@@ -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 {};
@@ -1,2 +0,0 @@
1
- export * from './form';
2
- export * from './input';
@@ -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 {};