@cargosense/cargo-design-system 1.0.11 → 1.0.13
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/assets/index.cjs.js +3 -3
- package/dist/assets/index.cjs.js.map +1 -1
- package/dist/assets/index.es.js +23 -21
- package/dist/assets/index.es.js.map +1 -1
- package/dist/molecules/index.cjs.js +12 -12
- package/dist/molecules/index.cjs.js.map +1 -1
- package/dist/molecules/index.es.js +39 -27
- package/dist/molecules/index.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -297,7 +297,7 @@
|
|
|
297
297
|
|
|
298
298
|
`;static properties={name:{type:String,reflect:!0},type:{type:String,reflect:!0,converter:t=>["text","date","time","number","tel","url","phone","email","password"].includes(t)?t:"text"},disabled:{type:Boolean,reflect:!0},placeholder:{type:String,reflect:!0},readOnly:{type:Boolean,reflect:!0,attribute:"read-only"},required:{type:Boolean,reflect:!0},pattern:{type:String},error:{type:Boolean,reflect:!0},value:{type:String,reflect:!0},fullWidth:{type:Boolean,reflect:!0,attribute:"full-width"},variant:{type:String,reflect:!0},size:{type:String,reflect:!0,converter:t=>["sm","md","lg"].includes(t)?t:"md"},iconLeft:{type:String,reflect:!0,attribute:"icon-left"},iconRight:{type:String,reflect:!0,attribute:"icon-right"}};handleKeyPress(t){return this.dispatchEvent(new CustomEvent("keypress",{detail:{value:t.target.value,key:t.keyCode}})),t.key==="Enter"&&this.dispatchEvent(new CustomEvent("onenter",{detail:{value:t.target.value}})),this.dispatchEvent(new CustomEvent("onkeyup",{detail:{value:t.target.value,key:t.keyCode}})),this._internals.setFormValue(t.target.value),this.value=t.target.value,t.target.value}handleInput(t){return this.dispatchEvent(new CustomEvent("input",{detail:{value:t.target.value}})),this._internals.setFormValue(t.target.value),this.value=t.target.value,t.target.value}handleChange(t){return this.dispatchEvent(new CustomEvent("onchange",{detail:{value:t.target.value}})),this._internals.setFormValue(t.target.value),this.value=t.target.value,t.target.value}handleFocus(t){return this.dispatchEvent(new CustomEvent("onblur",{detail:{value:t.target.value}})),this._internals.setFormValue(t.target.value),this.value=t.target.value,t.target}constructor(){super(),this.value="",this.placeholder="",this.pattern="",this.variant="solid",this.size="md",this._internals=this.attachInternals()}render(){return e.x`
|
|
299
299
|
${this.iconLeft?e.x`<span class="icon-left-container"><cd-icon name="${this.iconLeft}" size="sm" class="icon-left"></cd-icon></span>`:""}
|
|
300
|
-
<input id='${this.name}' class="${this.iconLeft?"icon-spacing-left":""} ${this.iconRight?" icon-spacing-right":""} ${this.disabled?" disabled":""} ${this.error?" input-error":""} ${this.fullWidth?" full-width":""} ${this.variant==="dashed"?" dashed":this.variant=="dotted"?" dotted":""} ${this.size}" type="${this.type}" placeholder="${this.placeholder}" ?required=${this.required} .value="${this.value}" ?readonly=${this.readOnly} ?disabled=${this.disabled} .pattern="${this.pattern}" @input="${this.handleInput}" @change="${this.handleChange}" @blur="${this.handleFocus}" @keypress=${this.handleKeyPress}/>
|
|
300
|
+
<input id='${this.name}' class="${this.iconLeft?"icon-spacing-left":""} ${this.iconRight?" icon-spacing-right":""} ${this.disabled?" disabled":""} ${this.error?" input-error":""} ${this.fullWidth?" full-width":""} ${this.variant==="dashed"?" dashed":this.variant=="dotted"?" dotted":""} ${this.size}" type="${this.type}" placeholder="${this.placeholder}" ?required=${e.o(this.required)} .value="${this.value}" ?readonly=${this.readOnly} ?disabled=${this.disabled} .pattern="${this.pattern}" @input="${this.handleInput}" @change="${this.handleChange}" @blur="${this.handleFocus}" @keypress=${this.handleKeyPress}/>
|
|
301
301
|
${this.iconRight?e.x`<span class="icon-right-container"><cd-icon name="${this.iconRight}" size="sm" class="icon-right" color='${e.o(this.error?"var(--input-error-border-color)":void 0)}'></cd-icon></span>`:""}
|
|
302
302
|
`}focus(){if(!this.shadowRoot){console.warn("Input element is not yet connected to the DOM.");return}if(!this.shadowRoot.querySelector("input")){console.warn("Input element is not found in the shadow DOM.");return}this.shadowRoot.querySelector("input").focus()}}function k(){typeof window<"u"&&!customElements.get("cd-input")&&customElements.define("cd-input",s)}e.registerNavImage();class l extends e.i{static styles=e.i$1`
|
|
303
303
|
@font-face {
|
|
@@ -695,7 +695,7 @@
|
|
|
695
695
|
${this.variant==="default"?e.x`<a href="${e.o(this.link)}" class="value"><slot></slot></a>`:""}
|
|
696
696
|
${this.variant==="dropdown"?e.x`<span class="dropdown-value"><slot></slot></span>`:""}
|
|
697
697
|
${this.variant==="arrow"?e.x`<a href="${e.o(this.link)}" class="arrow-value"><slot></slot><cd-icon name="arrow" size="sm"></cd-icon></a>`:""}
|
|
698
|
-
`}}function C(){typeof window<"u"&&!customElements.get("cd-value")&&customElements.define("cd-value",h)}e.registerIcon();class
|
|
698
|
+
`}}function C(){typeof window<"u"&&!customElements.get("cd-value")&&customElements.define("cd-value",h)}e.registerIcon();class b extends e.i{static styles=e.i$1`
|
|
699
699
|
@font-face {
|
|
700
700
|
font-family: 'Geist';
|
|
701
701
|
src: url(${e.r(e.fontURL)}) format('woff');
|
|
@@ -901,7 +901,7 @@
|
|
|
901
901
|
${this.iconRight||this.collapsed?e.x`<span @click="${this.expandInput}" class="${this.collapsed?"icon-collapsed-container":"icon-right-container"}"><cd-icon name="search" class="${this.collapsed?"icon-collapsed "+this.size:"icon-right"}" variant="light-slate"></cd-icon></span>`:""}
|
|
902
902
|
${this.closeIcon?e.x`<span class="${this.collapsed?"hidden":"active"}" id='closeIcon' tabindex='0'><cd-icon name="exit" id="close-icon" class="icon close ${this.collapsed?"hidden-icon":"active-icon"}" @click="${this.collapseInput}"></cd-icon></span>`:""}
|
|
903
903
|
</div>
|
|
904
|
-
`}firstUpdated(){if(!this.shadowRoot){console.warn("Shadow DOM is not available.");return}this.shadowRoot.querySelector(".active")&&this.shadowRoot.querySelector(".active").addEventListener("keydown",t=>{t.keyCode===13&&this.collapseInput()})}focus(){if(!this.shadowRoot){console.warn("Input element is not yet connected to the DOM.");return}if(!this.shadowRoot.querySelector("input")){console.warn("Input element is not found in the shadow DOM.");return}this.shadowRoot.querySelector("#search-input").focus()}expandInput(){this.collapsed&&(this.collapsed=!1,this.shadowRoot.querySelector("#search-input").focus(),this.shadowRoot.querySelector("#close-icon").classList.remove("hidden-icon"),this.shadowRoot.querySelector("#close-icon").classList.remove("hidden"),this.shadowRoot.querySelector("#close-icon").classList.add("active-icon"),this.shadowRoot.querySelector("#close-icon").classList.add("active"),this.requestUpdate(),this.shadowRoot.querySelector("#closeIcon").addEventListener("keydown",t=>{t.key==="Enter"&&this.collapseInput()}))}collapseInput(){this.collapsed||(this.collapsed=!0,this.value="",this.shadowRoot.querySelector("#close-icon").classList.add("hidden-icon"),this.shadowRoot.querySelector("#close-icon").classList.add("hidden"),this.shadowRoot.querySelector("#close-icon").classList.remove("active"),this.shadowRoot.querySelector("#close-icon").classList.remove("active-icon"),this.dispatchEvent(new CustomEvent("collapsed",{detail:{closed:!0},bubbles:!0,composed:!0})),this.requestUpdate())}}function T(){typeof window<"u"&&!customElements.get("cd-search")&&customElements.define("cd-search",
|
|
904
|
+
`}firstUpdated(){if(!this.shadowRoot){console.warn("Shadow DOM is not available.");return}this.shadowRoot.querySelector(".active")&&this.shadowRoot.querySelector(".active").addEventListener("keydown",t=>{t.keyCode===13&&this.collapseInput()})}focus(){if(!this.shadowRoot){console.warn("Input element is not yet connected to the DOM.");return}if(!this.shadowRoot.querySelector("input")){console.warn("Input element is not found in the shadow DOM.");return}this.shadowRoot.querySelector("#search-input").focus()}expandInput(){this.collapsed&&(this.collapsed=!1,this.shadowRoot.querySelector("#search-input").focus(),this.shadowRoot.querySelector("#close-icon").classList.remove("hidden-icon"),this.shadowRoot.querySelector("#close-icon").classList.remove("hidden"),this.shadowRoot.querySelector("#close-icon").classList.add("active-icon"),this.shadowRoot.querySelector("#close-icon").classList.add("active"),this.requestUpdate(),this.shadowRoot.querySelector("#closeIcon").addEventListener("keydown",t=>{t.key==="Enter"&&this.collapseInput()}))}collapseInput(){this.collapsed||(this.collapsed=!0,this.value="",this.shadowRoot.querySelector("#close-icon").classList.add("hidden-icon"),this.shadowRoot.querySelector("#close-icon").classList.add("hidden"),this.shadowRoot.querySelector("#close-icon").classList.remove("active"),this.shadowRoot.querySelector("#close-icon").classList.remove("active-icon"),this.dispatchEvent(new CustomEvent("collapsed",{detail:{closed:!0},bubbles:!0,composed:!0})),this.requestUpdate())}}function T(){typeof window<"u"&&!customElements.get("cd-search")&&customElements.define("cd-search",b)}e.registerIcon();class v extends e.i{static styles=e.i$1`
|
|
905
905
|
@font-face {
|
|
906
906
|
font-family: 'Geist';
|
|
907
907
|
src: url(${e.r(e.fontURL)}) format('woff');
|
|
@@ -1014,7 +1014,7 @@
|
|
|
1014
1014
|
<slot name="end"></slot>
|
|
1015
1015
|
</div>
|
|
1016
1016
|
</div>
|
|
1017
|
-
`}toggleActive(){this.active=!this.active}setActive(t){if(typeof t!="boolean")throw new TypeError("Active must be a boolean");if(this.disabled)throw new Error("Cannot set active state when the tab is disabled");this.active=t}setDisabled(t){if(typeof t!="boolean")throw new TypeError("Disabled must be a boolean");if(this.active&&t)throw new Error("Cannot disable an active tab");this.disabled=t}}function I(){typeof window<"u"&&!customElements.get("cd-tab")&&customElements.define("cd-tab",
|
|
1017
|
+
`}toggleActive(){this.active=!this.active}setActive(t){if(typeof t!="boolean")throw new TypeError("Active must be a boolean");if(this.disabled)throw new Error("Cannot set active state when the tab is disabled");this.active=t}setDisabled(t){if(typeof t!="boolean")throw new TypeError("Disabled must be a boolean");if(this.active&&t)throw new Error("Cannot disable an active tab");this.disabled=t}}function I(){typeof window<"u"&&!customElements.get("cd-tab")&&customElements.define("cd-tab",v)}class f extends e.i{static styles=e.i$1`
|
|
1018
1018
|
@font-face {
|
|
1019
1019
|
font-family: 'Geist';
|
|
1020
1020
|
src: url(${e.r(e.fontURL)}) format('woff');
|
|
@@ -1041,7 +1041,7 @@
|
|
|
1041
1041
|
<div class='container ${this.variant}'>
|
|
1042
1042
|
<slot></slot>
|
|
1043
1043
|
</div>
|
|
1044
|
-
`}}function
|
|
1044
|
+
`}}function q(){typeof window<"u"&&!customElements.get("cd-tab-container")&&customElements.define("cd-tab-container",f)}i();class g extends e.i{static formAssociated=!0;static distinctTimezones=["Etc/GMT+12","Pacific/Pago_Pago","Pacific/Honolulu","America/Anchorage","America/Los_Angeles","America/Denver","America/Chicago","America/New_York","America/Halifax","America/Argentina/Buenos_Aires","America/Noronha","Atlantic/Azores","Europe/London","Europe/Paris","Europe/Bucharest","Europe/Moscow","Asia/Tehran","Asia/Dubai","Asia/Kabul","Asia/Karachi","Asia/Kolkata","Asia/Kathmandu","Asia/Dhaka","Asia/Yangon","Asia/Bangkok","Asia/Shanghai","Australia/Eucla","Asia/Tokyo","Australia/Darwin","Australia/Sydney","Australia/Lord_Howe","Pacific/Noumea","Pacific/Auckland","Pacific/Chatham","Pacific/Tongatapu","Pacific/Kiritimati"];static styles=e.i$1`
|
|
1045
1045
|
@font-face {
|
|
1046
1046
|
font-family: 'Geist';
|
|
1047
1047
|
src: url(${e.r(e.fontURL)}) format('woff');
|
|
@@ -1138,13 +1138,13 @@
|
|
|
1138
1138
|
color: var(--input-error-border-color);
|
|
1139
1139
|
}
|
|
1140
1140
|
|
|
1141
|
-
`;static properties={value:{type:String,reflect:!0},name:{type:String,reflect:!0},shortcut:{type:String,reflect:!0},error:{type:Boolean,reflect:!0,attribute:"error"},disabled:{type:Boolean,reflect:!0},form:{type:String,reflect:!0,attribute:"form"},size:{type:String,reflect:!0,attribute:"size",converter:t=>["sm","md","lg"].includes(t)?t:"md"},fullWidth:{type:Boolean,reflect:!0,attribute:"full-width"},variant:{type:String,reflect:!0,attribute:"variant",converter:t=>["dashed","dotted"].includes(t)?t:"default"},timezone:{type:String,reflect:!0,attribute:"timezone",converter:t=>distinctTimezones.includes(t)?t:"America/New_York"}};constructor(){super(),this.value="",this.shortcut=void 0,this.disabled=void 0,this.form=void 0,this.size="md",this.fullWidth=!1,this.variant="default",this.timezone="America/New_York",this._internals=this.attachInternals(),this._internals.setValidity({customError:this.errorText&&this.errorText.length>0||!1})}handleChange=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);handleInput=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("input",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);handleFocus=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("focus",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);handleBlur=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("blur",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);render(){return e.x`
|
|
1141
|
+
`;static properties={value:{type:String,reflect:!0},name:{type:String,reflect:!0},required:{type:Boolean,reflect:!0,attribute:"required",converter:t=>t===""||t===!0},shortcut:{type:String,reflect:!0},error:{type:Boolean,reflect:!0,attribute:"error"},disabled:{type:Boolean,reflect:!0},form:{type:String,reflect:!0,attribute:"form"},size:{type:String,reflect:!0,attribute:"size",converter:t=>["sm","md","lg"].includes(t)?t:"md"},fullWidth:{type:Boolean,reflect:!0,attribute:"full-width"},variant:{type:String,reflect:!0,attribute:"variant",converter:t=>["dashed","dotted"].includes(t)?t:"default"},timezone:{type:String,reflect:!0,attribute:"timezone",converter:t=>distinctTimezones.includes(t)?t:"America/New_York"}};constructor(){super(),this.value="",this.shortcut=void 0,this.disabled=void 0,this.form=void 0,this.size="md",this.fullWidth=!1,this.variant="default",this.timezone="America/New_York",this.error=!1,this.name=void 0,this.required=!1,this._internals=this.attachInternals(),this._internals.setValidity({customError:this.errorText&&this.errorText.length>0||!1})}handleChange=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);handleInput=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("input",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);handleFocus=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("focus",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);handleBlur=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("blur",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);render(){return e.x`
|
|
1142
1142
|
<div class='container'>
|
|
1143
|
-
<input class='${this.error?"input-error":""} ${this.disabled?"disabled":""} ${this.fullWidth?"full-width":""} ${this.variant} ${this.size}' type='date' id='${this.name|"date"}' name='${this.name|"date"}' .value='${this.value}' @change='${this.handleChange}' @focus='${this.handleFocus}' @blur='${this.handleBlur}' @input='${this.handleInput}' ?disabled='${this.disabled}' />
|
|
1143
|
+
<input class='${this.error?"input-error":""} ${this.disabled?"disabled":""} ${this.fullWidth?"full-width":""} ${this.variant} ${this.size}' type='date' id='${this.name|"date"}' name='${this.name|"date"}' .value='${this.value}' @change='${this.handleChange}' @focus='${this.handleFocus}' @blur='${this.handleBlur}' @input='${this.handleInput}' ?disabled='${this.disabled}' ?required='${e.o(this.required)}' />
|
|
1144
1144
|
${this.shortcut?e.x`<cd-button variant='primary' ?disabled='${this.disabled}'>${this.shortcut}</cd-button>`:""}
|
|
1145
1145
|
</div>
|
|
1146
1146
|
|
|
1147
|
-
`}firstUpdated(){if(!this.shadowRoot){console.warn("Shadow DOM not available, DateComponent may not render correctly.");return}this.shadowRoot.querySelector("cd-button")&&this.shadowRoot.querySelector("cd-button").addEventListener("button-click",()=>{this.setValue(this.dateNow()),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))})}dateNow(){let t=new Date().toLocaleString("en-US",{timeZone:this.timezone});return new Date(t).toISOString().slice(0,10)}setValue(t){this.value=t,this._internals.setFormValue(t),this.requestUpdate()}setError(t){if(typeof t!="error"){console.warn("Error text must be a string");return}this.error=t,this._internals.setValidity({customError:t}),this.requestUpdate()}setDisabled(t){this.disabled=t,this._internals.setValidity({customError:t}),this.requestUpdate()}}function
|
|
1147
|
+
`}firstUpdated(){if(!this.shadowRoot){console.warn("Shadow DOM not available, DateComponent may not render correctly.");return}this.shadowRoot.querySelector("cd-button")&&this.shadowRoot.querySelector("cd-button").addEventListener("button-click",()=>{this.setValue(this.dateNow()),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))})}dateNow(){let t=new Date().toLocaleString("en-US",{timeZone:this.timezone});return new Date(t).toISOString().slice(0,10)}setValue(t){this.value=t,this._internals.setFormValue(t),this.requestUpdate()}setError(t){if(typeof t!="error"){console.warn("Error text must be a string");return}this.error=t,this._internals.setValidity({customError:t}),this.requestUpdate()}setDisabled(t){this.disabled=t,this._internals.setValidity({customError:t}),this.requestUpdate()}}function B(){typeof window<"u"&&!customElements.get("cd-date")&&customElements.define("cd-date",g)}i();class m extends e.i{static formAssociated=!0;static distinctTimezones=["Etc/GMT+12","Pacific/Pago_Pago","Pacific/Honolulu","America/Anchorage","America/Los_Angeles","America/Denver","America/Chicago","America/New_York","America/Halifax","America/Argentina/Buenos_Aires","America/Noronha","Atlantic/Azores","Europe/London","Europe/Paris","Europe/Bucharest","Europe/Moscow","Asia/Tehran","Asia/Dubai","Asia/Kabul","Asia/Karachi","Asia/Kolkata","Asia/Kathmandu","Asia/Dhaka","Asia/Yangon","Asia/Bangkok","Asia/Shanghai","Australia/Eucla","Asia/Tokyo","Australia/Darwin","Australia/Sydney","Australia/Lord_Howe","Pacific/Noumea","Pacific/Auckland","Pacific/Chatham","Pacific/Tongatapu","Pacific/Kiritimati"];static styles=e.i$1`
|
|
1148
1148
|
@font-face {
|
|
1149
1149
|
font-family: 'Geist';
|
|
1150
1150
|
src: url(${e.r(e.fontURL)}) format('woff');
|
|
@@ -1241,12 +1241,12 @@
|
|
|
1241
1241
|
height: 36px;
|
|
1242
1242
|
padding: 0 var(--input-horizontal-inline-padding-sm, 12px);
|
|
1243
1243
|
}
|
|
1244
|
-
`;static properties={name:{type:String,reflect:!0},value:{type:String,reflect:!0},shortcut:{type:String,reflect:!0},error:{type:Boolean,reflect:!0,attribute:"error"},disabled:{type:Boolean,reflect:!0},form:{type:String,reflect:!0,attribute:"form"},size:{type:String,reflect:!0,attribute:"size",converter:t=>["sm","md","lg"].includes(t)?t:"md"},fullWidth:{type:Boolean,reflect:!0,attribute:"full-width"},variant:{type:String,reflect:!0,attribute:"variant",converter:t=>["dashed","dotted"].includes(t)?t:"default"},timezone:{type:String,reflect:!0,attribute:"timezone",converter:t=>distinctTimezones.includes(t)?t:"America/New_York"}};constructor(){super(),this.value="",this.shortcut=void 0,this.error=!1,this.disabled=void 0,this.form=void 0,this.size="md",this.fullWidth=!1,this.variant="default",this.timezone="America/New_York",this._internals=this.attachInternals(),this._internals.setValidity({customError:this.errorText&&this.errorText.length>0||!1})}handleChange=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);handleInput=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("input",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);handleFocus=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("focus",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);handleBlur=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("blur",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);render(){return e.x`
|
|
1244
|
+
`;static properties={name:{type:String,reflect:!0},required:{type:Boolean,reflect:!0,attribute:"required",converter:t=>t===""||t===!0},value:{type:String,reflect:!0},shortcut:{type:String,reflect:!0},error:{type:Boolean,reflect:!0,attribute:"error"},disabled:{type:Boolean,reflect:!0},form:{type:String,reflect:!0,attribute:"form"},size:{type:String,reflect:!0,attribute:"size",converter:t=>["sm","md","lg"].includes(t)?t:"md"},fullWidth:{type:Boolean,reflect:!0,attribute:"full-width"},variant:{type:String,reflect:!0,attribute:"variant",converter:t=>["dashed","dotted"].includes(t)?t:"default"},timezone:{type:String,reflect:!0,attribute:"timezone",converter:t=>distinctTimezones.includes(t)?t:"America/New_York"}};constructor(){super(),this.name=void 0,this.required=!1,this.value="",this.shortcut=void 0,this.error=!1,this.disabled=void 0,this.form=void 0,this.size="md",this.fullWidth=!1,this.variant="default",this.timezone="America/New_York",this._internals=this.attachInternals(),this._internals.setValidity({customError:this.errorText&&this.errorText.length>0||!1})}handleChange=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);handleInput=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("input",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);handleFocus=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("focus",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);handleBlur=t=>(this.value=t.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("blur",{detail:{value:this.value},bubbles:!0,composed:!0})),this.value);render(){return e.x`
|
|
1245
1245
|
<div class='container'>
|
|
1246
|
-
<input class='${this.error?"input-error":""} ${this.disabled?"disabled":""} ${this.fullWidth?"full-width":""} ${this.variant} ${this.size}' type='time' id='${this.name|"time"}' name='${this.name|"time"}' .value='${this.value}' @change='${this.handleChange}' @focus='${this.handleFocus}' @blur='${this.handleBlur}' @input='${this.handleInput}' ?disabled='${this.disabled}' />
|
|
1246
|
+
<input class='${this.error?"input-error":""} ${this.disabled?"disabled":""} ${this.fullWidth?"full-width":""} ${this.variant} ${this.size}' type='time' id='${this.name|"time"}' name='${this.name|"time"}' .value='${this.value}' @change='${this.handleChange}' @focus='${this.handleFocus}' @blur='${this.handleBlur}' @input='${this.handleInput}' ?disabled='${this.disabled}' ?required='${e.o(this.required)}' />
|
|
1247
1247
|
${this.shortcut?e.x`<cd-button variant='primary' ?disabled='${this.disabled}'>${this.shortcut}</cd-button>`:""}
|
|
1248
1248
|
</div>
|
|
1249
|
-
`}firstUpdated(){if(!this.shadowRoot){console.warn("Shadow DOM not available, TimeComponent may not render correctly.");return}this.shadowRoot.querySelector("cd-button")&&this.shadowRoot.querySelector("cd-button").addEventListener("button-click",()=>{this.setValue(this.timeNow()),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))})}timeNow(){let t=new Date().toLocaleString("en-US",{timeZone:this.timezone||"America/New_York"});if(t.split(" ")[2]==="PM"){let o=t.split(" ");t=Number(o[1].split(":")[0])+12+":"+o[1].split(":")[1]+":"+o[1].split(":")[2]}else t=t.split(" ")[1];return t}setValue(t){this.value=t,this._internals.setFormValue(t),this.requestUpdate()}setError(t){if(typeof t!="error"){console.warn("Error text must be a string");return}this.error=t,this._internals.setValidity({customError:t}),this.requestUpdate()}setDisabled(t){this.disabled=t,this._internals.setValidity({customError:t}),this.requestUpdate()}}function
|
|
1249
|
+
`}firstUpdated(){if(!this.shadowRoot){console.warn("Shadow DOM not available, TimeComponent may not render correctly.");return}this.shadowRoot.querySelector("cd-button")&&this.shadowRoot.querySelector("cd-button").addEventListener("button-click",()=>{this.setValue(this.timeNow()),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))})}timeNow(){let t=new Date().toLocaleString("en-US",{timeZone:this.timezone||"America/New_York"});if(t.split(" ")[2]==="PM"){let o=t.split(" ");t=Number(o[1].split(":")[0])+12+":"+o[1].split(":")[1]+":"+o[1].split(":")[2]}else t=t.split(" ")[1];return t}setValue(t){this.value=t,this._internals.setFormValue(t),this.requestUpdate()}setError(t){if(typeof t!="error"){console.warn("Error text must be a string");return}this.error=t,this._internals.setValidity({customError:t}),this.requestUpdate()}setDisabled(t){this.disabled=t,this._internals.setValidity({customError:t}),this.requestUpdate()}}function R(){typeof window<"u"&&!customElements.get("cd-time")&&customElements.define("cd-time",m)}e.registerIcon();class x extends e.i{static styles=e.i$1`
|
|
1250
1250
|
@font-face {
|
|
1251
1251
|
font-family: 'GeistMono';
|
|
1252
1252
|
src: url(${e.r(e.fontURL$1)}) format('woff');
|
|
@@ -1313,5 +1313,5 @@
|
|
|
1313
1313
|
<div class="icon-container ${this.variant}" @click="${this._handleIconClick}">
|
|
1314
1314
|
${this.icon?e.x`<cd-icon name="${this.icon}" size="${this.size|"md"}"></cd-icon>`:e.x`<slot></slot>`}
|
|
1315
1315
|
</div>
|
|
1316
|
-
`}}function
|
|
1316
|
+
`}}function L(){typeof window<"u"&&!customElements.get("cd-icon-container")&&customElements.define("cd-icon-container",x)}exports.Button=a;exports.DateComponent=g;exports.Header=n;exports.IconContainer=x;exports.Input=s;exports.NavBar=l;exports.NavItem=c;exports.NavProfile=p;exports.Search=b;exports.Tab=v;exports.TabContainer=f;exports.Table=d;exports.TimeComponent=m;exports.ToolTip=u;exports.Value=h;exports.registerButton=i;exports.registerDate=B;exports.registerHeader=w;exports.registerIconContainer=L;exports.registerInput=k;exports.registerNavBar=$;exports.registerNavItem=E;exports.registerNavProfile=A;exports.registerSearch=T;exports.registerTab=I;exports.registerTabContainer=q;exports.registerTable=z;exports.registerTime=R;exports.registerToolTip=S;exports.registerValue=C;
|
|
1317
1317
|
//# sourceMappingURL=index.cjs.js.map
|