@public-ui/components 1.6.0-rc.10 → 1.6.0-rc.11
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/custom-elements.json +1 -1
- package/dist/cjs/{controller-c3dbd7c8.js → controller-20c47dac.js} +1 -1
- package/dist/cjs/{controller-c3dbd7c8.js.map → controller-20c47dac.js.map} +1 -1
- package/dist/cjs/{controller-318123f0.js → controller-6aabbf41.js} +1 -1
- package/dist/cjs/{controller-318123f0.js.map → controller-6aabbf41.js.map} +1 -1
- package/dist/cjs/{controller-aff1063a.js → controller-9a10b30b.js} +1 -1
- package/dist/cjs/{controller-aff1063a.js.map → controller-9a10b30b.js.map} +1 -1
- package/dist/cjs/{controller-6d3e3486.js → controller-d513b916.js} +1 -1
- package/dist/cjs/{controller-6d3e3486.js.map → controller-d513b916.js.map} +1 -1
- package/dist/cjs/{controller-icon-d20f7f1b.js → controller-icon-d2ec9da9.js} +1 -1
- package/dist/cjs/{controller-icon-d20f7f1b.js.map → controller-icon-d2ec9da9.js.map} +1 -1
- package/dist/cjs/kol-badge.cjs.entry.js +1 -1
- package/dist/cjs/kol-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/kol-button-wc_2.cjs.entry.js +1 -1
- package/dist/cjs/kol-button-wc_2.cjs.entry.js.map +1 -1
- package/dist/cjs/kol-icon.cjs.entry.js +1 -1
- package/dist/cjs/kol-input-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/kol-input-color.cjs.entry.js +1 -1
- package/dist/cjs/kol-input-date.cjs.entry.js +1 -1
- package/dist/cjs/kol-input-email.cjs.entry.js +1 -1
- package/dist/cjs/kol-input-file.cjs.entry.js +1 -1
- package/dist/cjs/kol-input-number.cjs.entry.js +1 -1
- package/dist/cjs/kol-input-password.cjs.entry.js +1 -1
- package/dist/cjs/kol-input-radio.cjs.entry.js +1 -1
- package/dist/cjs/kol-input-range.cjs.entry.js +1 -1
- package/dist/cjs/kol-input-text.cjs.entry.js +1 -1
- package/dist/cjs/kol-link-group.cjs.entry.js +1 -1
- package/dist/cjs/kol-link-wc.cjs.entry.js +1 -1
- package/dist/cjs/kol-link-wc.cjs.entry.js.map +1 -1
- package/dist/cjs/kol-modal.cjs.entry.js +1 -1
- package/dist/cjs/kol-nav.cjs.entry.js +1 -1
- package/dist/cjs/kol-progress.cjs.entry.js +1 -1
- package/dist/cjs/kol-select.cjs.entry.js +1 -1
- package/dist/cjs/kol-skip-nav.cjs.entry.js +1 -1
- package/dist/cjs/kol-span-wc.cjs.entry.js +1 -1
- package/dist/cjs/kol-split-button.cjs.entry.js +1 -1
- package/dist/cjs/kol-symbol.cjs.entry.js +1 -1
- package/dist/cjs/kol-tabs.cjs.entry.js +1 -1
- package/dist/cjs/kol-textarea.cjs.entry.js +1 -1
- package/dist/cjs/kol-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/kol-version.cjs.entry.js +1 -1
- package/dist/cjs/{label-62d191b9.js → label-5738ac71.js} +1 -1
- package/dist/cjs/label-5738ac71.js.map +1 -0
- package/dist/components/component5.js +1 -1
- package/dist/components/component5.js.map +1 -1
- package/dist/components/component8.js +1 -1
- package/dist/components/component8.js.map +1 -1
- package/dist/components/label.js +1 -1
- package/dist/components/label.js.map +1 -1
- package/dist/esm/{controller-1ef374de.js → controller-0a60db6b.js} +1 -1
- package/dist/esm/{controller-1ef374de.js.map → controller-0a60db6b.js.map} +1 -1
- package/dist/esm/{controller-7726af85.js → controller-3b1a37ac.js} +1 -1
- package/dist/esm/{controller-7726af85.js.map → controller-3b1a37ac.js.map} +1 -1
- package/dist/esm/{controller-01bbe05c.js → controller-d9fb3dc1.js} +1 -1
- package/dist/esm/{controller-01bbe05c.js.map → controller-d9fb3dc1.js.map} +1 -1
- package/dist/esm/{controller-3950f463.js → controller-ff99125c.js} +1 -1
- package/dist/esm/{controller-3950f463.js.map → controller-ff99125c.js.map} +1 -1
- package/dist/esm/{controller-icon-d403e7d6.js → controller-icon-ba3c5351.js} +1 -1
- package/dist/esm/{controller-icon-d403e7d6.js.map → controller-icon-ba3c5351.js.map} +1 -1
- package/dist/esm/kol-badge.entry.js +1 -1
- package/dist/esm/kol-breadcrumb.entry.js +1 -1
- package/dist/esm/kol-button-wc_2.entry.js +1 -1
- package/dist/esm/kol-button-wc_2.entry.js.map +1 -1
- package/dist/esm/kol-icon.entry.js +1 -1
- package/dist/esm/kol-input-checkbox.entry.js +1 -1
- package/dist/esm/kol-input-color.entry.js +1 -1
- package/dist/esm/kol-input-date.entry.js +1 -1
- package/dist/esm/kol-input-email.entry.js +1 -1
- package/dist/esm/kol-input-file.entry.js +1 -1
- package/dist/esm/kol-input-number.entry.js +1 -1
- package/dist/esm/kol-input-password.entry.js +1 -1
- package/dist/esm/kol-input-radio.entry.js +1 -1
- package/dist/esm/kol-input-range.entry.js +1 -1
- package/dist/esm/kol-input-text.entry.js +1 -1
- package/dist/esm/kol-link-group.entry.js +1 -1
- package/dist/esm/kol-link-wc.entry.js +1 -1
- package/dist/esm/kol-link-wc.entry.js.map +1 -1
- package/dist/esm/kol-modal.entry.js +1 -1
- package/dist/esm/kol-nav.entry.js +1 -1
- package/dist/esm/kol-progress.entry.js +1 -1
- package/dist/esm/kol-select.entry.js +1 -1
- package/dist/esm/kol-skip-nav.entry.js +1 -1
- package/dist/esm/kol-span-wc.entry.js +1 -1
- package/dist/esm/kol-split-button.entry.js +1 -1
- package/dist/esm/kol-symbol.entry.js +1 -1
- package/dist/esm/kol-tabs.entry.js +1 -1
- package/dist/esm/kol-textarea.entry.js +1 -1
- package/dist/esm/kol-tooltip.entry.js +1 -1
- package/dist/esm/kol-version.entry.js +1 -1
- package/dist/esm/{label-2a601017.js → label-bd9566f6.js} +1 -1
- package/dist/esm/label-bd9566f6.js.map +1 -0
- package/dist/kolibri/{controller-1ef374de.js → controller-0a60db6b.js} +1 -1
- package/dist/kolibri/{controller-7726af85.js → controller-3b1a37ac.js} +1 -1
- package/dist/kolibri/{controller-01bbe05c.js → controller-d9fb3dc1.js} +1 -1
- package/dist/kolibri/{controller-3950f463.js → controller-ff99125c.js} +1 -1
- package/dist/kolibri/{controller-icon-d403e7d6.js → controller-icon-ba3c5351.js} +1 -1
- package/dist/kolibri/kol-badge.entry.js +1 -1
- package/dist/kolibri/kol-breadcrumb.entry.js +1 -1
- package/dist/kolibri/kol-button-wc_2.entry.js +1 -1
- package/dist/kolibri/kol-button-wc_2.entry.js.map +1 -1
- package/dist/kolibri/kol-icon.entry.js +1 -1
- package/dist/kolibri/kol-input-checkbox.entry.js +1 -1
- package/dist/kolibri/kol-input-color.entry.js +1 -1
- package/dist/kolibri/kol-input-color.entry.js.map +1 -1
- package/dist/kolibri/kol-input-date.entry.js +1 -1
- package/dist/kolibri/kol-input-email.entry.js +1 -1
- package/dist/kolibri/kol-input-file.entry.js +1 -1
- package/dist/kolibri/kol-input-number.entry.js +1 -1
- package/dist/kolibri/kol-input-password.entry.js +1 -1
- package/dist/kolibri/kol-input-radio.entry.js +1 -1
- package/dist/kolibri/kol-input-range.entry.js +1 -1
- package/dist/kolibri/kol-input-text.entry.js +1 -1
- package/dist/kolibri/kol-link-group.entry.js +1 -1
- package/dist/kolibri/kol-link-wc.entry.js +1 -1
- package/dist/kolibri/kol-link-wc.entry.js.map +1 -1
- package/dist/kolibri/kol-modal.entry.js +1 -1
- package/dist/kolibri/kol-nav.entry.js +1 -1
- package/dist/kolibri/kol-progress.entry.js +1 -1
- package/dist/kolibri/kol-select.entry.js +1 -1
- package/dist/kolibri/kol-skip-nav.entry.js +1 -1
- package/dist/kolibri/kol-span-wc.entry.js +1 -1
- package/dist/kolibri/kol-split-button.entry.js +1 -1
- package/dist/kolibri/kol-symbol.entry.js +1 -1
- package/dist/kolibri/kol-tabs.entry.js +1 -1
- package/dist/kolibri/kol-textarea.entry.js +1 -1
- package/dist/kolibri/kol-tooltip.entry.js +1 -1
- package/dist/kolibri/kol-version.entry.js +1 -1
- package/dist/kolibri/label-bd9566f6.js +4 -0
- package/dist/kolibri/{label-2a601017.js.map → label-bd9566f6.js.map} +1 -1
- package/doc/modal.md +1 -1
- package/jest-test-results.json +1 -1
- package/package.json +1 -1
- package/dist/cjs/label-62d191b9.js.map +0 -1
- package/dist/esm/label-2a601017.js.map +0 -1
- package/dist/kolibri/label-2a601017.js +0 -4
- /package/dist/kolibri/{controller-1ef374de.js.map → controller-0a60db6b.js.map} +0 -0
- /package/dist/kolibri/{controller-7726af85.js.map → controller-3b1a37ac.js.map} +0 -0
- /package/dist/kolibri/{controller-01bbe05c.js.map → controller-d9fb3dc1.js.map} +0 -0
- /package/dist/kolibri/{controller-3950f463.js.map → controller-ff99125c.js.map} +0 -0
- /package/dist/kolibri/{controller-icon-d403e7d6.js.map → controller-icon-ba3c5351.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* KoliBri - The accessible HTML-Standard
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as i,H as o,g as e}from"./index-2c046ff1.js";import{a as s}from"./i18n-64b07ed9.js";import{v as n}from"./label-
|
|
4
|
+
import{r as t,h as i,H as o,g as e}from"./index-2c046ff1.js";import{a as s}from"./i18n-64b07ed9.js";import{v as n}from"./label-bd9566f6.js";import{d as a,f as l,c as r}from"./a11y.tipps-e607b8b3.js";import{L as d}from"./dev.utils-8aef00f6.js";import{a as h,s as b,e as u,d as c,k as p}from"./prop.validators-683bb1d0.js";import"./index-d8ac1088.js";import"./index-37b5cbcf.js";import"./reuse-c2156413.js";const f=new Set(['"left", "right"']),g=new Set(['"bottom", "top"']),v=new Set([...f,...g]),m=(t,e,i)=>{h(t,e,(t=>"bottom"===t||"left"===t||"right"===t||"top"===t),v,i)},k=":host{--a11y-min-size:44px;font-size:inherit}*{hyphens:auto;letter-spacing:inherit;word-break:break-word;word-spacing:inherit}[role='button'],button:not([role='link']),kol-input .input{min-height:var(--a11y-min-size);min-width:var(--a11y-min-size)}a,button,h1,h2,h3,h4,h5,h6,input,option,select,textarea{font-family:inherit;font-size:inherit}:is(a,button){background-color:transparent;border:none;margin:0;padding:0;width:100%;}:host{max-width:100%}*{box-sizing:border-box}kol-span-wc{display:grid;place-items:center}kol-span-wc>span{display:flex;place-items:center}a,button{cursor:pointer}button,input,option,select,textarea{font-family:inherit}.icon-only>kol-span-wc>span>span{display:none}:host{display:block}kol-button-group-wc{display:inline-flex;flex-wrap:wrap}kol-button-group-wc button{border-bottom-color:transparent;border-bottom-style:solid;display:block}div.grid,div[role='tabpanel']{height:100%}:host>.tabs-align-right{display:grid;grid-template-columns:1fr auto}:host>.tabs-align-right kol-button-group-wc{display:grid;order:2}:host>.tabs-align-left{display:grid;grid-template-columns:auto 1fr}:host>.tabs-align-left kol-button-group-wc{display:grid;order:0}:host>.tabs-align-bottom{display:grid;grid-template-rows:1fr auto}:host>.tabs-align-bottom kol-button-group-wc{order:2}:host>.tabs-align-bottom kol-button-group-wc>div{display:flex}:host>.tabs-align-bottom>kol-button-group-wc>div>div:first-child{margin:0 1em 0 0}:host>.tabs-align-bottom>kol-button-group-wc>div>div{margin:0 1em}:host>.tabs-align-top{display:grid;grid-template-rows:auto 1fr}:host>.tabs-align-top kol-button-group-wc{order:0}:host>.tabs-align-top kol-button-group-wc>div{display:flex}:host>.tabs-align-top>kol-button-group-wc>div>div:first-child{margin:0 1em 0 0}:host>.tabs-align-top>kol-button-group-wc>div>div{margin:0 1em}:host>div{display:grid}:host>.tabs-align-left kol-button-group-wc,:host>.tabs-align-top kol-button-group-wc{order:0}:host>.tabs-align-bottom kol-button-group-wc,:host>.tabs-align-right kol-button-group-wc{order:1}:host>div.tabs-align-left kol-button-group-wc>div,:host>div.tabs-align-left kol-button-group-wc>div>div,:host>div.tabs-align-right kol-button-group-wc>div,:host>div.tabs-align-right kol-button-group-wc>div>div{display:grid}:host>div.tabs-align-left kol-button-group-wc>div>div kol-button-wc,:host>div.tabs-align-right kol-button-group-wc>div>div kol-button-wc{width:100%}:host>div.tabs-align-bottom kol-button-group-wc div,:host>div.tabs-align-top kol-button-group-wc div{display:flex;flex-wrap:wrap}",w=class{constructor(e){t(this,e),this.onCreateLabel=`${s("kol-new")} …`,this.showCreateTab=!1,this.nextPossibleTabIndex=(t,e,i)=>{if(i>0){if(e+i<t.length)return t[e+i]._disabled?this.nextPossibleTabIndex(t,e,i+1):e+i}else if(i<0&&e+i>=0)return t[e+i]._disabled?this.nextPossibleTabIndex(t,e,i-1):e+i;return e},this.onKeyDown=t=>{const e=setTimeout((()=>{clearTimeout(e);let i=null;switch(t.key){case"ArrowRight":i=this.nextPossibleTabIndex(this.state._tabs,this.state._selected,1);break;case"ArrowLeft":i=this.nextPossibleTabIndex(this.state._tabs,this.state._selected,-1)}null!==i&&this.onSelect(t,i,!0)}),250)},this.onClickSelect=(t,e)=>{this.onSelect(t,e,!0)},this.onMouseDown=t=>{t.stopPropagation()},this.callbacks={onClick:this.onClickSelect,onMouseDown:this.onMouseDown},this.catchTabPanelHost=t=>{this.tabPanelHost=t},this.selectNextNotDisabledTab=(t,e,i=!0,o)=>{if(t>e.length-1&&(t=e.length-1),t<0&&(t=0),Array.isArray(e)&&e[t]&&e[t]._disabled){if(!0===i){if(t<e.length-1)return this.selectNextNotDisabledTab(t+1,e,!0,o||t);t=o||t,i=!1}if(!1===i){if(t>0)return this.selectNextNotDisabledTab(t-1,e,!1,o||t);a("[KolTabs] Alle Tabs sind deaktiviert und somit kann kein Tab angezeigt werden.")}}return t},this.syncSelectedAndTabs=(t,e,i,a)=>{let o,s;o="_selected"===a?t:this.state._selected,s="_tabs"===a?t:this.state._tabs,s.length>0&&e.set("_selected",this.selectNextNotDisabledTab(o,s))},this.handleTabPanels=()=>{var t,e,i;if(this.tabPanelHost instanceof HTMLDivElement)for(let a=this.tabPanelHost.children.length;a<this.state._tabs.length;a++){const o=document.createElement("div");o.setAttribute("aria-labelledby",`tab-${a}`),o.setAttribute("id",`tabpanel-${a}`),o.setAttribute("role","tabpanel"),o.setAttribute("hidden","");const s=document.createElement("slot");s.setAttribute("name",`tabpanel-slot-${a}`),o.appendChild(s),this.tabPanelHost.appendChild(o),(null===(t=this.host)||void 0===t?void 0:t.children)instanceof HTMLCollection&&(null===(e=this.host)||void 0===e?void 0:e.children[a])&&(null===(i=this.host)||void 0===i||i.children[a].setAttribute("slot",`tabpanel-slot-${a}`))}},this.onCreate=t=>{var e,i;t.stopPropagation(),"function"==typeof(null===(e=this.state._on)||void 0===e?void 0:e.onCreate)&&(null===(i=this.state._on)||void 0===i||i.onCreate(t))},this._ariaLabel=void 0,this._label=void 0,this._on=void 0,this._selected=0,this._tabs=void 0,this._tabsAlign="top",this.state={_label:"…",_selected:0,_tabs:[],_tabsAlign:"top"}}renderButtonGroup(){return i("kol-button-group-wc",{role:"tablist","aria-label":this.state._label,onKeyDown:this.onKeyDown},this.state._tabs.map(((t,e)=>i("kol-button-wc",{_disabled:t._disabled,_icon:t._icon,_hideLabel:t._hideLabel||t._iconOnly,_label:t._label,_on:this.callbacks,_tabIndex:this.state._selected===e?0:-1,_tooltipAlign:t._tooltipAlign,_variant:this.state._selected===e?"custom":void 0,_customClass:this.state._selected===e?"selected":void 0,_ariaControls:`tabpanel-${e}`,_ariaSelected:this.state._selected===e,_id:`tab-${e}`,_role:"tab",_value:e}))),this.showCreateTab&&i("kol-button-wc",{class:"create-button",_label:this.onCreateLabel,_on:{onClick:this.onCreate}}))}render(){return i(o,null,i("div",{ref:t=>{this.tabPanelsElement=t},class:{[`tabs-align-${this.state._tabsAlign}`]:!0}},this.renderButtonGroup(),i("div",{ref:this.catchTabPanelHost})))}validateAriaLabel(t){this.validateLabel(t)}validateLabel(t){n(this,t)}validateOn(t){if("object"==typeof t&&null!==t){l("[KolTabs] Prüfen, wie man auch einen EventCallback einzeln ändern kann.");const e={};"function"!=typeof t.onCreate&&"object"!=typeof t.onCreate||("object"==typeof t.onCreate?("string"==typeof t.onCreate.label&&t.onCreate.label.length>0?this.onCreateLabel=t.onCreate.label:d.debug("[KolTabs] Der Label-Text für Neu in {\n onCreate: {\n label: string (!),\n callback: Function\n }\n} ist nicht korrekt gesetzt."),"function"==typeof t.onCreate.callback?e.onCreate=t.onCreate.callback:d.debug("[KolTabs] Die onCreate-Callback-Funktion für Neu in {\n onCreate: {\n label: string,\n callback: Function (!)\n }\n} ist nicht korrekt gesetzt.")):e.onCreate=t.onCreate,this.showCreateTab="function"==typeof e.onCreate),"function"==typeof t.onSelect&&(e.onSelect=t.onSelect),b(this,"_on",e)}}validateSelected(t){u(this,"_selected",t,{hooks:{beforePatch:this.syncSelectedAndTabs}})}validateTabs(t){c(this,"_tabs",(t=>"object"==typeof t&&null!==t&&"string"==typeof t._label&&t._label.length>0),t,void 0,{hooks:{beforePatch:this.syncSelectedAndTabs}}),r("KolTabs",this.state._tabs.length)}validateTabsAlign(t){m(this,"_tabsAlign",t)}componentWillLoad(){this.validateLabel(this._label||this._ariaLabel),this.validateOn(this._on),this.validateSelected(this._selected),this.validateTabs(this._tabs),this.validateTabsAlign(this._tabsAlign)}componentDidRender(){if(this.handleTabPanels(),this.tabPanelHost instanceof HTMLDivElement)for(let t=0;t<this.tabPanelHost.children.length;t++)t!==this.state._selected?this.tabPanelHost.children[t].setAttribute("hidden",""):this.tabPanelHost.children[t].removeAttribute("hidden")}onSelect(t,e,i=!1){var a,o;this._selected=e,"function"==typeof(null===(a=this._on)||void 0===a?void 0:a.onSelect)&&(null===(o=this._on)||void 0===o||o.onSelect(t,e)),!0===i&&(this.selectedTimeout=setTimeout((()=>{if(clearTimeout(this.selectedTimeout),this.tabPanelsElement){const t=p(`button#tab-${e}`,this.tabPanelsElement);null==t||t.focus()}}),250))}get host(){return e(this)}static get watchers(){return{_ariaLabel:["validateAriaLabel"],_label:["validateLabel"],_on:["validateOn"],_selected:["validateSelected"],_tabs:["validateTabs"],_tabsAlign:["validateTabsAlign"]}}};w.style={default:k};export{w as kol_tabs};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* KoliBri - The accessible HTML-Standard
|
|
3
3
|
*/
|
|
4
|
-
import{h as t,H as e,r as i,g as a}from"./index-2c046ff1.js";import{n as s}from"./dev.utils-8aef00f6.js";import{b as n,e as l,w as h,a as r,s as d}from"./prop.validators-683bb1d0.js";import{a as o}from"./reuse-c2156413.js";import{I as u,g as p}from"./controller-
|
|
4
|
+
import{h as t,H as e,r as i,g as a}from"./index-2c046ff1.js";import{n as s}from"./dev.utils-8aef00f6.js";import{b as n,e as l,w as h,a as r,s as d}from"./prop.validators-683bb1d0.js";import{a as o}from"./reuse-c2156413.js";import{I as u,g as p}from"./controller-d9fb3dc1.js";import"./a11y.tipps-e607b8b3.js";import"./index-37b5cbcf.js";import"./label-bd9566f6.js";import"./tab-index-6d37f269.js";class c extends u{constructor(t,e,a){super(t,e,a),this.afterSyncCharCounter=()=>{"string"==typeof this.component._value&&this.component._value.length>0&&(this.component.state._currentLength=this.component._value.length)},this.component=t}validateHasCounter(t){n(this.component,"_hasCounter",t,{hooks:{afterPatch:this.afterSyncCharCounter}})}validateMaxLength(t){l(this.component,"_maxLength",t,{hooks:{afterPatch:this.afterSyncCharCounter},min:0})}validatePlaceholder(t){h(this.component,"_placeholder",t)}validateReadOnly(t){n(this.component,"_readOnly",t)}validateResize(t){r(this.component,"_resize",(t=>"string"==typeof t&&("both"===t||"horizontal"===t||"none"===t||"vertical"===t)),new Set("String {both, horizontal, vertical, none}"),t)}validateRequired(t){n(this.component,"_required",t)}validateRows(t){l(this.component,"_rows",t)}validateValue(t){h(this.component,"_value",t,{hooks:{afterPatch:this.afterSyncCharCounter}}),this.setFormAssociatedValue(this.component._value)}componentWillLoad(){super.componentWillLoad(),this.validateHasCounter(this.component._hasCounter),this.validateMaxLength(this.component._maxLength),this.validatePlaceholder(this.component._placeholder),this.validateReadOnly(this.component._readOnly),this.validateResize(this.component._resize),this.validateRequired(this.component._required),this.validateRows(this.component._rows),this.validateValue(this.component._value)}}const f=":host{--a11y-min-size:44px;font-size:inherit}*{hyphens:auto;letter-spacing:inherit;word-break:break-word;word-spacing:inherit}[role='button'],button:not([role='link']),kol-input .input{min-height:var(--a11y-min-size);min-width:var(--a11y-min-size)}a,button,h1,h2,h3,h4,h5,h6,input,option,select,textarea{font-family:inherit;font-size:inherit}:is(a,button){background-color:transparent;border:none;margin:0;padding:0;width:100%;}:host{max-width:100%}*{box-sizing:border-box}kol-span-wc{display:grid;place-items:center}kol-span-wc>span{display:flex;place-items:center}a,button{cursor:pointer}button,input,option,select,textarea{font-family:inherit}.icon-only>kol-span-wc>span>span{display:none}.required label>span::after,.required legend>span::after{content:'*'}:host{display:block}input,textarea{cursor:text}input[type='checkbox'],input[type='color'],input[type='file'],input[type='radio'],input[type='range'],label,option,select{cursor:pointer}input[type='color'],input[type='date'],input[type='datetime-local'],input[type='email'],input[type='file'],input[type='month'],input[type='number'],input[type='password'],input[type='search'],input[type='tel'],input[type='text'],input[type='time'],input[type='url'],input[type='week'],select:not([multiple]),select[multiple] option,textarea{font-size:1rem;width:100%}input[type='file']{padding:calc((var(--a11y-min-size) - 1rem) / 10) 0.5em}select[multiple] option{padding:calc((var(--a11y-min-size) - 1rem) / 2) 0.5em}kol-input.disabled :is(button,input,label,option,select,textarea){cursor:not-allowed;opacity:0.5}kol-input{display:grid}kol-input [slot='input']{flex-grow:1}input:not([type='checkbox'],[type='radio']),select:not([multiple]){height:2.75em}input:focus,option:focus,select:focus,textarea:focus{outline:0}.input{display:flex;align-items:center}.input>kol-icon{display:grid;height:var(--a11y-min-size);place-items:center}",v=t=>{t.style.overflow="hidden";const e=t.rows,a=t.clientHeight/e;t.rows=1;const i=Math.round(t.scrollHeight/a);return t.rows=e,i},y=class{render(){const{ariaDescribedBy:a}=p(this.state),i=""===this.state._label,s="…"===this.state._label;return t(e,{class:{"has-value":this.state._hasValue}},t("kol-input",{class:{textarea:!0,"hide-label":!!this.state._hideLabel,"has-counter":!!this.state._hasCounter},_alert:this.state._alert,_currentLength:this.state._currentLength,_disabled:this.state._disabled,_error:this.state._error,_hasCounter:this.state._hasCounter,_hideLabel:this.state._hideLabel,_hint:this.state._hint,_id:this.state._id,_maxLength:this.state._maxLength,_readOnly:this.state._readOnly,_required:this.state._required,_touched:this.state._touched,onClick:()=>{var t;return null===(t=this.ref)||void 0===t?void 0:t.focus()}},t("span",{slot:"label"},i?t("slot",{name:"expert"}):s?t("slot",null):this.state._label),t("div",{slot:"input"},t("textarea",Object.assign({ref:this.catchRef,title:"",accessKey:this.state._accessKey,"aria-describedby":a.length>0?a.join(" "):void 0,"aria-labelledby":`${this.state._id}-label`,autoCapitalize:"off",autoCorrect:"off",disabled:this.state._disabled,id:this.state._id,maxlength:this.state._maxLength,name:this.state._name,readOnly:this.state._readOnly,required:this.state._required,rows:this.state._rows,placeholder:this.state._placeholder,spellcheck:"false"},this.controller.onFacade,{onKeyUp:this.onChange,style:{resize:this.state._resize},value:this.state._value})))))}constructor(t){i(this,t),this.catchRef=t=>{this.ref=t,o(this.host,this.ref)},this.onChange=t=>{this.ref instanceof HTMLTextAreaElement&&(d(this,"_currentLength",this.ref.value.length),this.state._adjustHeight&&(this._rows=v(this.ref))),"function"==typeof this.controller.onFacade.onChange&&this.controller.onFacade.onChange(t)},this._accessKey=void 0,this._adjustHeight=!1,this._alert=!0,this._disabled=void 0,this._error=void 0,this._hasCounter=void 0,this._hideLabel=void 0,this._hint="",this._id=void 0,this._label=void 0,this._maxLength=void 0,this._name=void 0,this._on=void 0,this._placeholder=void 0,this._readOnly=void 0,this._resize="vertical",this._required=void 0,this._rows=void 0,this._syncValueBySelector=void 0,this._tabIndex=void 0,this._touched=!1,this._value=void 0,this.state={_adjustHeight:!1,_currentLength:0,_hasValue:!1,_id:s(),_label:!1,_resize:"vertical"},this.controller=new c(this,"textarea",this.host)}validateAccessKey(t){this.controller.validateAccessKey(t)}validateAdjustHeight(t){this.controller.validateAdjustHeight(t)}validateAlert(t){this.controller.validateAlert(t)}validateDisabled(t){this.controller.validateDisabled(t)}validateError(t){this.controller.validateError(t)}validateHasCounter(t){this.controller.validateHasCounter(t)}validateHideLabel(t){this.controller.validateHideLabel(t)}validateHint(t){this.controller.validateHint(t)}validateId(t){this.controller.validateId(t)}validateLabel(t){this.controller.validateLabel(t)}validateMaxLength(t){this.controller.validateMaxLength(t)}validateName(t){this.controller.validateName(t)}validateOn(t){this.controller.validateOn(t)}validatePlaceholder(t){this.controller.validatePlaceholder(t)}validateReadOnly(t){this.controller.validateReadOnly(t)}validateResize(t){this.controller.validateResize(t)}validateRequired(t){this.controller.validateRequired(t)}validateRows(t){this.controller.validateRows(t)}validateSyncValueBySelector(t){this.controller.validateSyncValueBySelector(t)}validateTabIndex(t){this.controller.validateTabIndex(t)}validateTouched(t){this.controller.validateTouched(t)}validateValue(t){this.controller.validateValue(t)}componentWillLoad(){this._alert=!0===this._alert,this._touched=!0===this._touched,this.controller.componentWillLoad(),this.state._hasValue=!!this.state._value,this.controller.addValueChangeListener((t=>this.state._hasValue=!!t))}get host(){return a(this)}static get watchers(){return{_accessKey:["validateAccessKey"],_adjustHeight:["validateAdjustHeight"],_alert:["validateAlert"],_disabled:["validateDisabled"],_error:["validateError"],_hasCounter:["validateHasCounter"],_hideLabel:["validateHideLabel"],_hint:["validateHint"],_id:["validateId"],_label:["validateLabel"],_maxLength:["validateMaxLength"],_name:["validateName"],_on:["validateOn"],_placeholder:["validatePlaceholder"],_readOnly:["validateReadOnly"],_resize:["validateResize"],_required:["validateRequired"],_rows:["validateRows"],_syncValueBySelector:["validateSyncValueBySelector"],_tabIndex:["validateTabIndex"],_touched:["validateTouched"],_value:["validateValue"]}}};y.style={default:f};export{y as kol_textarea};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* KoliBri - The accessible HTML-Standard
|
|
3
3
|
*/
|
|
4
|
-
import{r as i,h as t,H as s}from"./index-2c046ff1.js";import{c as o,b as e,o as a,f as n,s as h,a as l}from"./floating-ui.dom.esm-805abd08.js";import{w as r}from"./button-link-2ad7f3cf.js";import{v as d}from"./label-
|
|
4
|
+
import{r as i,h as t,H as s}from"./index-2c046ff1.js";import{c as o,b as e,o as a,f as n,s as h,a as l}from"./floating-ui.dom.esm-805abd08.js";import{w as r}from"./button-link-2ad7f3cf.js";import{v as d}from"./label-bd9566f6.js";import{g as p,n as c}from"./dev.utils-8aef00f6.js";import{w as f}from"./prop.validators-683bb1d0.js";import{p as m}from"./reuse-c2156413.js";import"./a11y.tipps-e607b8b3.js";import"./index-37b5cbcf.js";const u=new Set;function b(t){u.forEach((t=>{t.style.setProperty("z-index","999")})),u.add(t),t.style.setProperty("z-index","1000")}function v(t){if(u.delete(t),u.size>0){const t=Array.from(u).pop();t&&t.style.setProperty("z-index","1000")}}const x=":host{--a11y-min-size:44px;font-size:inherit}*{hyphens:auto;letter-spacing:inherit;word-break:break-word;word-spacing:inherit}[role='button'],button:not([role='link']),kol-input .input{min-height:var(--a11y-min-size);min-width:var(--a11y-min-size)}a,button,h1,h2,h3,h4,h5,h6,input,option,select,textarea{font-family:inherit;font-size:inherit}:is(a,button){background-color:transparent;border:none;margin:0;padding:0;width:100%;}:host{max-width:100%}*{box-sizing:border-box}kol-span-wc{display:grid;place-items:center}kol-span-wc>span{display:flex;place-items:center}a,button{cursor:pointer}button,input,option,select,textarea{font-family:inherit}.icon-only>kol-span-wc>span>span{display:none}kol-tooltip #floating{animation-duration:0.5s;animation-iteration-count:1;animation-name:fadeInOpacity;animation-timing-function:ease-in;box-sizing:border-box;display:none;position:absolute;visibility:hidden;width:max-content;top:0;left:0}kol-tooltip #arrow{height:10px;position:absolute;transform:rotate(45deg);width:10px;z-index:999}kol-tooltip .area{background-color:#fff;color:#000}kol-tooltip kol-span-wc{position:relative;z-index:1000}@keyframes fadeInOpacity{0%{opacity:0}100%{opacity:1}}",y=class{constructor(t){i(this,t),this.alignTooltip=()=>{var t;if("test"!==m&&this.previousSibling&&this.tooltipElement){const i=this.previousSibling,e=this.tooltipElement,s=this.arrowElement,r=[a(null!==(t=null==s?void 0:s.offsetHeight)&&void 0!==t?t:10),n(),h()];s&&r.push(l({element:s})),o(i,e,{placement:this.state._align,middleware:r}).then((({x:t,y:i,middlewareData:o,placement:n})=>{var l,r;Object.assign(e.style,{left:`${t}px`,top:`${i}px`,visibility:"visible"}),s&&((null===(l=o.arrow)||void 0===l?void 0:l.x)?Object.assign(s.style,{left:`${o.arrow.x}px`,top:"bottom"===n?-s.offsetHeight/2+"px":"",bottom:"top"===n?-s.offsetHeight/2+"px":""}):(null===(r=o.arrow)||void 0===r?void 0:r.y)&&Object.assign(s.style,{left:"right"===n?-s.offsetWidth/2+"px":"",right:"left"===n?-s.offsetWidth/2+"px":"",top:`${o.arrow.y}px`}))}))}},this.showTooltip=()=>{if(this.previousSibling&&this.tooltipElement){b(this.tooltipElement),this.tooltipElement.style.setProperty("display","block"),p().body.addEventListener("keyup",this.hideTooltipByEscape);const t=this.previousSibling,i=this.tooltipElement;this.cleanupAutoPositioning=e(t,i,this.alignTooltip)}},this.hideTooltip=()=>{this.tooltipElement&&(v(this.tooltipElement),this.tooltipElement.style.setProperty("display","none"),this.tooltipElement.style.setProperty("visibility","hidden"),this.cleanupAutoPositioning&&(this.cleanupAutoPositioning(),this.cleanupAutoPositioning=void 0))},this.hideTooltipByEscape=t=>{"Escape"===t.key&&(p().body.removeEventListener("keyup",this.hideTooltipByEscape),this.hideTooltip())},this.addListeners=t=>{t.addEventListener("mouseover",this.incrementOverFocusCount),t.addEventListener("focus",this.incrementOverFocusCount),t.addEventListener("mouseout",this.decrementOverFocusCount),t.addEventListener("blur",this.decrementOverFocusCount)},this.removeListeners=t=>{t.removeEventListener("mouseover",this.incrementOverFocusCount),t.removeEventListener("focus",this.incrementOverFocusCount),t.removeEventListener("mouseout",this.decrementOverFocusCount),t.removeEventListener("blur",this.decrementOverFocusCount)},this.resyncListeners=t=>{this.removeListeners(t),this.addListeners(t)},this.catchHostElement=t=>{t&&(this.previousSibling=t.previousElementSibling,this.previousSibling&&this.resyncListeners(this.previousSibling))},this.catchTooltipElement=t=>{this.tooltipElement=t,this.tooltipElement&&this.resyncListeners(this.tooltipElement)},this.catchArrowElement=t=>{this.arrowElement=t},this.overFocusCount=0,this.incrementOverFocusCount=()=>{this.overFocusCount++,this.showOrHideTooltip()},this.decrementOverFocusCount=()=>{this.overFocusCount--,this.showOrHideTooltip()},this.showOrHideTooltip=()=>{clearTimeout(this.overFocusTimeout),this.overFocusTimeout=setTimeout((()=>{clearTimeout(this.overFocusTimeout),this.overFocusCount>0?this.showTooltip():this.hideTooltip()}),250)},this._align="top",this._id=void 0,this._label=void 0,this.state={_align:"top",_id:c(),_label:"…"}}render(){return t(s,{ref:this.catchHostElement},""!==this.state._label&&t("div",{id:"floating",ref:this.catchTooltipElement},t("div",{class:"area",id:"arrow",ref:this.catchArrowElement}),t("kol-span-wc",{class:"area",id:this.state._id,_label:this.state._label})))}validateAlign(t){r(this,"_align",t)}validateId(t){f(this,"_id",t)}validateLabel(t){d(this,t)}componentWillLoad(){this.validateAlign(this._align),this.validateId(this._id),this.validateLabel(this._label)}disconnectedCallback(){this.previousSibling&&this.removeListeners(this.previousSibling),this.tooltipElement&&this.removeListeners(this.tooltipElement),this.cleanupAutoPositioning&&this.cleanupAutoPositioning()}static get watchers(){return{_align:["validateAlign"],_id:["validateId"],_label:["validateLabel"]}}};y.style=x;export{y as kol_tooltip};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* KoliBri - The accessible HTML-Standard
|
|
3
3
|
*/
|
|
4
|
-
import{r as i,h as t}from"./index-2c046ff1.js";import{v as e}from"./label-
|
|
4
|
+
import{r as i,h as t}from"./index-2c046ff1.js";import{v as e}from"./label-bd9566f6.js";import"./a11y.tipps-e607b8b3.js";import"./dev.utils-8aef00f6.js";import"./reuse-c2156413.js";import"./prop.validators-683bb1d0.js";import"./index-37b5cbcf.js";var n;!function(e){e.Violett="#5f316e",e.Dunkelrot="#780f2d",e.Rot="#c0003c",e.Orange="#cd5038",e.Hellorange="#f7bb3d",e.Gelb="#f9e03a",e["Hellgrün"]="#c1ca31",e.Oliv="#597c39",e["Dunkelgrün"]="#005c45",e["Grün"]="#00854a",e["Türkis"]="#00818b",e.Hellblau="#80cdec",e.Blau="#0077b6",e.Petrol="#007194",e.Dunkelblau="#004b76",e.Dunkelgrau="#576164",e.Hellgrau="#bec5c9"}(n||(n={}));const o=":host{--a11y-min-size:44px;font-size:inherit}*{hyphens:auto;letter-spacing:inherit;word-break:break-word;word-spacing:inherit}[role='button'],button:not([role='link']),kol-input .input{min-height:var(--a11y-min-size);min-width:var(--a11y-min-size)}a,button,h1,h2,h3,h4,h5,h6,input,option,select,textarea{font-family:inherit;font-size:inherit}:is(a,button){background-color:transparent;border:none;margin:0;padding:0;width:100%;}:host{max-width:100%}*{box-sizing:border-box}kol-span-wc{display:grid;place-items:center}kol-span-wc>span{display:flex;place-items:center}a,button{cursor:pointer}button,input,option,select,textarea{font-family:inherit}.icon-only>kol-span-wc>span>span{display:none}",a=class{constructor(e){i(this,e),this._label=void 0,this._version=void 0,this.state={_label:"0.0.0-alpha.0"}}render(){return t("kol-badge",{_color:n.Hellgrau,_icon:"codicon codicon-versions",_label:`v${this.state._label}`})}validateLabel(t){e(this,t)}validateVersion(e){this.validateLabel(e)}componentWillLoad(){this.validateLabel(this._label||this._version)}static get watchers(){return{_label:["validateLabel"],_version:["validateVersion"]}}};a.style={default:o};export{a as kol_version};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* KoliBri - The accessible HTML-Standard
|
|
3
|
+
*/
|
|
4
|
+
import{a as t,u as e}from"./a11y.tipps-e607b8b3.js";import{a as o}from"./prop.validators-683bb1d0.js";const a=/[a-zA-Z0-9äöüÄÖÜß]/g,s=/^\d+$/;function n(t){var e;return"string"==typeof t&&(null===(e=t.match(a))||void 0===e?void 0:e.length)||0}function r(t,e=1){return n(t)>=e}function i(t){return s.test(t)}function l(o){var a;return{hooks:{afterPatch:(a,n,s,l)=>{var c,f;"function"==typeof(null===(c=o.hooks)||void 0===c?void 0:c.afterPatch)&&(null===(f=o.hooks)||void 0===f||f.afterPatch(a,n,s,l)),"string"==typeof a&&!1===r(a,3)&&!1===i(a)&&t(`The heading or label ("${a}") is not accessible. A label should consist of at least three readable characters.`),"string"==typeof a&&a.length>80&&e("A heading or label should not be longer than 80 characters.")},beforePatch:null===(a=o.hooks)||void 0===a?void 0:a.beforePatch}}}const f=new Set(["string"]),c=(t,e,a={})=>{o(t,"_label",(t=>"string"==typeof t),f,e,l(a))},d=new Set(["string","false"]),u=(t,e,a={})=>{""!==e&&"false"!==e||(e=!1),o(t,"_label",(t=>!1===t||"string"==typeof t),d,e,l(a))};export{u as a,i as c,r as h,c as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["READABLE_CHARS","ONLY_NUMBERS","countReadableChars","str","_a","match","length","hasEnoughReadableChars","min","containsOnlyNumbers","test","getValidationOptions","options","hooks","afterPatch","value","state","component","key","_b","a11yHint","uiUxHint","beforePatch","LABEL_VALUES","Set","validateLabel","watchValidator","LABEL_WITH_EXPERT_SLOT_VALUES","validateLabelWithExpertSlot"],"sources":["src/types/props/label.ts"],"sourcesContent":["import { Generic } from '@a11y-ui/core';\n\nimport { a11yHint, uiUxHint } from '../../utils/a11y.tipps';\nimport { WatchStringOptions, watchValidator } from '../../utils/prop.validators';\n\n/* types */\n\n/**\n * This is a regular expression that matches all readable characters.\n *\n * Interesting: https://stackoverflow.com/questions/150033/regular-expression-to-match-non-english-characters\n */\nconst READABLE_CHARS = /[a-zA-Z0-9äöüÄÖÜß]/g;\n\n/**\n * This is a regular expression that matches only numbers.\n */\nconst ONLY_NUMBERS = /^\\d+$/;\n\n/**\n * This function counts the number of readable characters in a string.\n * @param str The string to count.\n * @returns The number of readable characters in the string.\n */\nfunction countReadableChars(str: string): number {\n\treturn typeof str === 'string' ? str.match(READABLE_CHARS)?.length || 0 : 0;\n}\n\n/**\n * This function checks if a string has at least a certain number of readable characters.\n * @param str The string to check.\n * @param min The minimum number of readable characters.\n * @returns True if the string has at least the minimum number of readable characters, false otherwise.\n */\nexport function hasEnoughReadableChars(str: string, min = 1): boolean {\n\treturn countReadableChars(str) >= min;\n}\n\n/**\n * This function checks if a string contains only numbers.\n * @param str The string to check.\n * @returns True if the string contains only numbers, false otherwise.\n */\nexport function containsOnlyNumbers(str: string): boolean {\n\treturn ONLY_NUMBERS.test(str);\n}\n\n/**\n * Defines the type of the label property.\n */\nexport type LabelPropType = string;\n\n/**\n * Defines the type of the label with expert-slot toggle property.\n */\nexport type LabelWithExpertSlotPropType = LabelPropType | false;\n\n/**\n * The label property is used to label different elements:\n * - abbr -> title text\n * - button -> label text\n * - heading -> headline text\n * - input, select and textarea -> label text\n * - summary -> summary text\n * - quote, table -> caption text\n * - version -> version text\n * - etc.\n *\n * The label is often a mandatory attribute. If the value of the label is false,\n * the expert-slot will be used. Otherwise, the value of the label must be a string\n * and the expert-slot will be ignored.\n */\nexport type PropLabel = {\n\tlabel: LabelPropType;\n};\nexport type PropLabelWithExpertSlot = {\n\tlabel: LabelWithExpertSlotPropType;\n};\n\nexport type LabelProp = Generic.Element.Members<PropLabel, unknown>;\n// type LabelWithExpertSlotProp = Generic.Element.Members<PropLabelWithExpertSlot, unknown>;\n\nfunction getValidationOptions(options: WatchStringOptions): WatchStringOptions {\n\treturn {\n\t\thooks: {\n\t\t\tafterPatch: (value, state, component, key) => {\n\t\t\t\tif (typeof options.hooks?.afterPatch === 'function') {\n\t\t\t\t\toptions.hooks?.afterPatch(value, state, component, key);\n\t\t\t\t}\n\t\t\t\tif (typeof value === 'string' && hasEnoughReadableChars(value, 3) === false && containsOnlyNumbers(value) === false) {\n\t\t\t\t\ta11yHint(`The heading or label (\"${value}\") is not accessible. A label should consist of at least three readable characters.`);\n\t\t\t\t}\n\t\t\t\tif (typeof value === 'string' && value.length > 80) {\n\t\t\t\t\tuiUxHint(`A heading or label should not be longer than 80 characters.`);\n\t\t\t\t}\n\t\t\t},\n\t\t\tbeforePatch: options.hooks?.beforePatch,\n\t\t},\n\t};\n}\n\nconst LABEL_VALUES = new Set(['string']);\nexport const validateLabel = (component: Generic.Element.Component, value?: LabelPropType, options: WatchStringOptions = {}): void => {\n\twatchValidator(component, '_label', (value) => typeof value === 'string', LABEL_VALUES, value, getValidationOptions(options));\n};\n\nconst LABEL_WITH_EXPERT_SLOT_VALUES = new Set(['string', 'false']);\nexport const validateLabelWithExpertSlot = (\n\tcomponent: Generic.Element.Component,\n\tvalue?: LabelWithExpertSlotPropType,\n\toptions: WatchStringOptions = {}\n): void => {\n\tif (value === '') {\n\t\tvalue = false; // TODO: remove this workaround in v2\n\t}\n\twatchValidator(\n\t\tcomponent,\n\t\t'_label',\n\t\t(value) => value === false || typeof value === 'string',\n\t\tLABEL_WITH_EXPERT_SLOT_VALUES,\n\t\tvalue,\n\t\tgetValidationOptions(options)\n\t);\n};\n\n// TODO: Validation for labelWithExpertSlot\n"],"mappings":";;;sGAYA,MAAMA,EAAiB,sBAKvB,MAAMC,EAAe,QAOrB,SAASC,EAAmBC,G,MAC3B,cAAcA,IAAQ,WAAWC,EAAAD,EAAIE,MAAML,MAAe,MAAAI,SAAA,SAAAA,EAAEE,SAAU,EAAI,CAC3E,C,SAQgBC,EAAuBJ,EAAaK,EAAM,GACzD,OAAON,EAAmBC,IAAQK,CACnC,C,SAOgBC,EAAoBN,GACnC,OAAOF,EAAaS,KAAKP,EAC1B,CAqCA,SAASQ,EAAqBC,G,MAC7B,MAAO,CACNC,MAAO,CACNC,WAAY,CAACC,EAAOC,EAAOC,EAAWC,K,QACrC,WAAWd,EAAAQ,EAAQC,SAAK,MAAAT,SAAA,SAAAA,EAAEU,cAAe,WAAY,EACpDK,EAAAP,EAAQC,SAAK,MAAAM,SAAA,SAAAA,EAAEL,WAAWC,EAAOC,EAAOC,EAAWC,E,CAEpD,UAAWH,IAAU,UAAYR,EAAuBQ,EAAO,KAAO,OAASN,EAAoBM,KAAW,MAAO,CACpHK,EAAS,0BAA0BL,uF,CAEpC,UAAWA,IAAU,UAAYA,EAAMT,OAAS,GAAI,CACnDe,EAAS,8D,GAGXC,aAAalB,EAAAQ,EAAQC,SAAK,MAAAT,SAAA,SAAAA,EAAEkB,aAG/B,CAEA,MAAMC,EAAe,IAAIC,IAAI,CAAC,W,MACjBC,EAAgB,CAACR,EAAsCF,EAAuBH,EAA8B,MACxHc,EAAeT,EAAW,UAAWF,UAAiBA,IAAU,UAAUQ,EAAcR,EAAOJ,EAAqBC,GAAS,EAG9H,MAAMe,EAAgC,IAAIH,IAAI,CAAC,SAAU,U,MAC5CI,EAA8B,CAC1CX,EACAF,EACAH,EAA8B,MAE9B,GAAIG,IAAU,
|
|
1
|
+
{"version":3,"names":["READABLE_CHARS","ONLY_NUMBERS","countReadableChars","str","_a","match","length","hasEnoughReadableChars","min","containsOnlyNumbers","test","getValidationOptions","options","hooks","afterPatch","value","state","component","key","_b","a11yHint","uiUxHint","beforePatch","LABEL_VALUES","Set","validateLabel","watchValidator","LABEL_WITH_EXPERT_SLOT_VALUES","validateLabelWithExpertSlot"],"sources":["src/types/props/label.ts"],"sourcesContent":["import { Generic } from '@a11y-ui/core';\n\nimport { a11yHint, uiUxHint } from '../../utils/a11y.tipps';\nimport { WatchStringOptions, watchValidator } from '../../utils/prop.validators';\n\n/* types */\n\n/**\n * This is a regular expression that matches all readable characters.\n *\n * Interesting: https://stackoverflow.com/questions/150033/regular-expression-to-match-non-english-characters\n */\nconst READABLE_CHARS = /[a-zA-Z0-9äöüÄÖÜß]/g;\n\n/**\n * This is a regular expression that matches only numbers.\n */\nconst ONLY_NUMBERS = /^\\d+$/;\n\n/**\n * This function counts the number of readable characters in a string.\n * @param str The string to count.\n * @returns The number of readable characters in the string.\n */\nfunction countReadableChars(str: string): number {\n\treturn typeof str === 'string' ? str.match(READABLE_CHARS)?.length || 0 : 0;\n}\n\n/**\n * This function checks if a string has at least a certain number of readable characters.\n * @param str The string to check.\n * @param min The minimum number of readable characters.\n * @returns True if the string has at least the minimum number of readable characters, false otherwise.\n */\nexport function hasEnoughReadableChars(str: string, min = 1): boolean {\n\treturn countReadableChars(str) >= min;\n}\n\n/**\n * This function checks if a string contains only numbers.\n * @param str The string to check.\n * @returns True if the string contains only numbers, false otherwise.\n */\nexport function containsOnlyNumbers(str: string): boolean {\n\treturn ONLY_NUMBERS.test(str);\n}\n\n/**\n * Defines the type of the label property.\n */\nexport type LabelPropType = string;\n\n/**\n * Defines the type of the label with expert-slot toggle property.\n */\nexport type LabelWithExpertSlotPropType = LabelPropType | false;\n\n/**\n * The label property is used to label different elements:\n * - abbr -> title text\n * - button -> label text\n * - heading -> headline text\n * - input, select and textarea -> label text\n * - summary -> summary text\n * - quote, table -> caption text\n * - version -> version text\n * - etc.\n *\n * The label is often a mandatory attribute. If the value of the label is false,\n * the expert-slot will be used. Otherwise, the value of the label must be a string\n * and the expert-slot will be ignored.\n */\nexport type PropLabel = {\n\tlabel: LabelPropType;\n};\nexport type PropLabelWithExpertSlot = {\n\tlabel: LabelWithExpertSlotPropType;\n};\n\nexport type LabelProp = Generic.Element.Members<PropLabel, unknown>;\n// type LabelWithExpertSlotProp = Generic.Element.Members<PropLabelWithExpertSlot, unknown>;\n\nfunction getValidationOptions(options: WatchStringOptions): WatchStringOptions {\n\treturn {\n\t\thooks: {\n\t\t\tafterPatch: (value, state, component, key) => {\n\t\t\t\tif (typeof options.hooks?.afterPatch === 'function') {\n\t\t\t\t\toptions.hooks?.afterPatch(value, state, component, key);\n\t\t\t\t}\n\t\t\t\tif (typeof value === 'string' && hasEnoughReadableChars(value, 3) === false && containsOnlyNumbers(value) === false) {\n\t\t\t\t\ta11yHint(`The heading or label (\"${value}\") is not accessible. A label should consist of at least three readable characters.`);\n\t\t\t\t}\n\t\t\t\tif (typeof value === 'string' && value.length > 80) {\n\t\t\t\t\tuiUxHint(`A heading or label should not be longer than 80 characters.`);\n\t\t\t\t}\n\t\t\t},\n\t\t\tbeforePatch: options.hooks?.beforePatch,\n\t\t},\n\t};\n}\n\nconst LABEL_VALUES = new Set(['string']);\nexport const validateLabel = (component: Generic.Element.Component, value?: LabelPropType, options: WatchStringOptions = {}): void => {\n\twatchValidator(component, '_label', (value) => typeof value === 'string', LABEL_VALUES, value, getValidationOptions(options));\n};\n\nconst LABEL_WITH_EXPERT_SLOT_VALUES = new Set(['string', 'false']);\nexport const validateLabelWithExpertSlot = (\n\tcomponent: Generic.Element.Component,\n\tvalue?: LabelWithExpertSlotPropType,\n\toptions: WatchStringOptions = {}\n): void => {\n\tif (value === '' || value === 'false') {\n\t\tvalue = false; // TODO: remove this workaround in v2\n\t}\n\twatchValidator(\n\t\tcomponent,\n\t\t'_label',\n\t\t(value) => value === false || typeof value === 'string',\n\t\tLABEL_WITH_EXPERT_SLOT_VALUES,\n\t\tvalue,\n\t\tgetValidationOptions(options)\n\t);\n};\n\n// TODO: Validation for labelWithExpertSlot\n"],"mappings":";;;sGAYA,MAAMA,EAAiB,sBAKvB,MAAMC,EAAe,QAOrB,SAASC,EAAmBC,G,MAC3B,cAAcA,IAAQ,WAAWC,EAAAD,EAAIE,MAAML,MAAe,MAAAI,SAAA,SAAAA,EAAEE,SAAU,EAAI,CAC3E,C,SAQgBC,EAAuBJ,EAAaK,EAAM,GACzD,OAAON,EAAmBC,IAAQK,CACnC,C,SAOgBC,EAAoBN,GACnC,OAAOF,EAAaS,KAAKP,EAC1B,CAqCA,SAASQ,EAAqBC,G,MAC7B,MAAO,CACNC,MAAO,CACNC,WAAY,CAACC,EAAOC,EAAOC,EAAWC,K,QACrC,WAAWd,EAAAQ,EAAQC,SAAK,MAAAT,SAAA,SAAAA,EAAEU,cAAe,WAAY,EACpDK,EAAAP,EAAQC,SAAK,MAAAM,SAAA,SAAAA,EAAEL,WAAWC,EAAOC,EAAOC,EAAWC,E,CAEpD,UAAWH,IAAU,UAAYR,EAAuBQ,EAAO,KAAO,OAASN,EAAoBM,KAAW,MAAO,CACpHK,EAAS,0BAA0BL,uF,CAEpC,UAAWA,IAAU,UAAYA,EAAMT,OAAS,GAAI,CACnDe,EAAS,8D,GAGXC,aAAalB,EAAAQ,EAAQC,SAAK,MAAAT,SAAA,SAAAA,EAAEkB,aAG/B,CAEA,MAAMC,EAAe,IAAIC,IAAI,CAAC,W,MACjBC,EAAgB,CAACR,EAAsCF,EAAuBH,EAA8B,MACxHc,EAAeT,EAAW,UAAWF,UAAiBA,IAAU,UAAUQ,EAAcR,EAAOJ,EAAqBC,GAAS,EAG9H,MAAMe,EAAgC,IAAIH,IAAI,CAAC,SAAU,U,MAC5CI,EAA8B,CAC1CX,EACAF,EACAH,EAA8B,MAE9B,GAAIG,IAAU,IAAMA,IAAU,QAAS,CACtCA,EAAQ,K,CAETW,EACCT,EACA,UACCF,GAAUA,IAAU,cAAgBA,IAAU,UAC/CY,EACAZ,EACAJ,EAAqBC,GACrB,S"}
|
package/doc/modal.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Vielen Dank, dass Sie diese Komponente zur Umsetzung eines Modals verwenden wollen. Inzwischen ist das native `<dialog>` Element sehr gut unterstützt ([caniuse](https://caniuse.com/?search=dialog)), barrierefrei, einfach zu benutzen und performanter (da nativ), daher empfehlen wir dieses zu verwenden. Wenn Sie aufgrund von Abwärtskompatibilität, oder weil Sie die **Modal**-Komponente bereits eingebaut haben, die Dokumentation zu unserem KolModal suchen, finden Sie diese etwas weiter unten. Die **Modal**-Komponente wird in Version 2 noch zur Verfügung stehen.
|
|
4
4
|
|
|
5
|
-
## Verwendung von
|
|
5
|
+
## Verwendung von `dialog`-Tag
|
|
6
6
|
|
|
7
7
|
Die Dokumentation des `<dialog>` finden Sie [hier(MDN)](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog).
|
|
8
8
|
Das **Dialog**-Element kann wie jedes andere HTML-Tag verwendet werden, alle Elemente innerhalb werden wie gewohnt dargestellt.
|