@haiilo/catalyst 2.4.8 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/catalyst.esm.js.map +1 -1
- package/dist/catalyst/index.cdn.js +1 -0
- package/dist/catalyst/index.esm.js +1 -1
- package/dist/catalyst/p-2fdb52c9.entry.js +2 -0
- package/dist/catalyst/p-2fdb52c9.entry.js.map +1 -0
- package/dist/catalyst/p-ccfebe33.js +2 -0
- package/dist/catalyst/p-ccfebe33.js.map +1 -0
- package/dist/catalyst/scss/_variables.scss +11 -11
- package/dist/cjs/{cat-alert_23.cjs.entry.js → cat-alert_24.cjs.entry.js} +65 -10
- package/dist/cjs/cat-alert_24.cjs.entry.js.map +1 -0
- package/dist/cjs/{cat-icon-registry-32ed379a.js → cat-icon-registry-671af264.js} +60 -32
- package/dist/cjs/cat-icon-registry-671af264.js.map +1 -0
- package/dist/cjs/catalyst.cjs.js +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/cat-form-group/cat-form-group.css +3 -0
- package/dist/collection/components/cat-form-group/cat-form-group.js +66 -0
- package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -0
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js +28 -7
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +1 -1
- package/dist/collection/components/cat-icon/cat-icon-registry.js +31 -24
- package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -1
- package/dist/collection/components/cat-icon/cat-icon.js +2 -3
- package/dist/collection/components/cat-icon/cat-icon.js.map +1 -1
- package/dist/collection/components/cat-input/cat-input.js +27 -1
- package/dist/collection/components/cat-input/cat-input.js.map +1 -1
- package/dist/collection/components/cat-label/cat-label.js +27 -1
- package/dist/collection/components/cat-label/cat-label.js.map +1 -1
- package/dist/collection/components/cat-select/cat-select.js +47 -4
- package/dist/collection/components/cat-select/cat-select.js.map +1 -1
- package/dist/collection/components/cat-select-demo/cat-select-demo.js +1 -1
- package/dist/collection/components/cat-select-demo/cat-select-demo.js.map +1 -1
- package/dist/collection/components/cat-textarea/cat-textarea.js +31 -1
- package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
- package/dist/collection/index.cdn.js +1 -0
- package/dist/collection/scss/_variables.scss +11 -11
- package/dist/components/cat-form-group.d.ts +11 -0
- package/dist/components/cat-form-group.js +64 -0
- package/dist/components/cat-form-group.js.map +1 -0
- package/dist/components/cat-i18n-registry.js +28 -7
- package/dist/components/cat-i18n-registry.js.map +1 -1
- package/dist/components/cat-icon2.js +32 -26
- package/dist/components/cat-icon2.js.map +1 -1
- package/dist/components/cat-input.js +6 -1
- package/dist/components/cat-input.js.map +1 -1
- package/dist/components/cat-label.js +6 -1
- package/dist/components/cat-label.js.map +1 -1
- package/dist/components/cat-select-demo.js +1 -1
- package/dist/components/cat-select-demo.js.map +1 -1
- package/dist/components/cat-select2.js +8 -2
- package/dist/components/cat-select2.js.map +1 -1
- package/dist/components/cat-textarea.js +7 -1
- package/dist/components/cat-textarea.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/esm/{cat-alert_23.entry.js → cat-alert_24.entry.js} +65 -11
- package/dist/esm/cat-alert_24.entry.js.map +1 -0
- package/dist/esm/{cat-icon-registry-7c4007ff.js → cat-icon-registry-d6b80490.js} +60 -32
- package/dist/esm/cat-icon-registry-d6b80490.js.map +1 -0
- package/dist/esm/catalyst.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/cat-form-group/cat-form-group.d.ts +16 -0
- package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +3 -2
- package/dist/types/components/cat-icon/cat-icon-registry.d.ts +3 -5
- package/dist/types/components/cat-icon/cat-icon.d.ts +0 -1
- package/dist/types/components/cat-input/cat-input.d.ts +4 -0
- package/dist/types/components/cat-label/cat-label.d.ts +4 -0
- package/dist/types/components/cat-select/cat-select.d.ts +13 -5
- package/dist/types/components/cat-textarea/cat-textarea.d.ts +4 -0
- package/dist/types/components.d.ts +63 -2
- package/package.json +2 -2
- package/dist/catalyst/p-5362e648.js +0 -2
- package/dist/catalyst/p-5362e648.js.map +0 -1
- package/dist/catalyst/p-c2bf7e26.entry.js +0 -2
- package/dist/catalyst/p-c2bf7e26.entry.js.map +0 -1
- package/dist/cjs/cat-alert_23.cjs.entry.js.map +0 -1
- package/dist/cjs/cat-icon-registry-32ed379a.js.map +0 -1
- package/dist/esm/cat-alert_23.entry.js.map +0 -1
- package/dist/esm/cat-icon-registry-7c4007ff.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var n=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function e(n,e,i){return i={path:e,exports:{},require:function(n,e){return t()}},n(i,i.exports),i.exports}function t(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var i=e((function(e){(function(n,t){if(e.exports){e.exports=t()}else{n.log=t()}})(n,(function(){var n=function(){};var e="undefined";var t=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent);var i=["trace","debug","info","warn","error"];function o(n,e){var t=n[e];if(typeof t.bind==="function"){return t.bind(n)}else{try{return Function.prototype.bind.call(t,n)}catch(e){return function(){return Function.prototype.apply.apply(t,[n,arguments])}}}}function r(){if(console.log){if(console.log.apply){console.log.apply(console,arguments)}else{Function.prototype.apply.apply(console.log,[console,arguments])}}if(console.trace)console.trace()}function s(i){if(i==="debug"){i="log"}if(typeof console===e){return false}else if(i==="trace"&&t){return r}else if(console[i]!==undefined){return o(console,i)}else if(console.log!==undefined){return o(console,"log")}else{return n}}function c(e,t){for(var o=0;o<i.length;o++){var r=i[o];this[r]=o<e?n:this.methodFactory(r,e,t)}this.log=this.debug}function f(n,t,i){return function(){if(typeof console!==e){c.call(this,t,i);this[n].apply(this,arguments)}}}function u(n,e,t){return s(n)||f.apply(this,arguments)}function a(n,t,o){var r=this;var s;t=t==null?"WARN":t;var f="loglevel";if(typeof n==="string"){f+=":"+n}else if(typeof n==="symbol"){f=undefined}function a(n){var t=(i[n]||"silent").toUpperCase();if(typeof window===e||!f)return;try{window.localStorage[f]=t;return}catch(n){}try{window.document.cookie=encodeURIComponent(f)+"="+t+";"}catch(n){}}function d(){var n;if(typeof window===e||!f)return;try{n=window.localStorage[f]}catch(n){}if(typeof n===e){try{var t=window.document.cookie;var i=t.indexOf(encodeURIComponent(f)+"=");if(i!==-1){n=/^([^;]+)/.exec(t.slice(i))[1]}}catch(n){}}if(r.levels[n]===undefined){n=undefined}return n}function l(){if(typeof window===e||!f)return;try{window.localStorage.removeItem(f);return}catch(n){}try{window.document.cookie=encodeURIComponent(f)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(n){}}r.name=n;r.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5};r.methodFactory=o||u;r.getLevel=function(){return s};r.setLevel=function(t,i){if(typeof t==="string"&&r.levels[t.toUpperCase()]!==undefined){t=r.levels[t.toUpperCase()]}if(typeof t==="number"&&t>=0&&t<=r.levels.SILENT){s=t;if(i!==false){a(t)}c.call(r,t,n);if(typeof console===e&&t<r.levels.SILENT){return"No console available for logging"}}else{throw"log.setLevel() called with invalid level: "+t}};r.setDefaultLevel=function(n){t=n;if(!d()){r.setLevel(n,false)}};r.resetLevel=function(){r.setLevel(t,false);l()};r.enableAll=function(n){r.setLevel(r.levels.TRACE,n)};r.disableAll=function(n){r.setLevel(r.levels.SILENT,n)};var w=d();if(w==null){w=t}r.setLevel(w,false)}var d=new a;var l={};d.getLogger=function n(e){if(typeof e!=="symbol"&&typeof e!=="string"||e===""){throw new TypeError("You must supply a name when creating a logger.")}var t=l[e];if(!t){t=l[e]=new a(e,d.getLevel(),d.methodFactory)}return t};var w=typeof window!==e?window.log:undefined;d.noConflict=function(){if(typeof window!==e&&window.log===d){window.log=w}return d};d.getLoggers=function n(){return l};d["default"]=d;return d}))}));class o{constructor(){this.id=(Math.random()+1).toString(36).substring(2);this.i18n=new Map;window.addEventListener("cat-i18n-set",(n=>{const{detail:e}=n||{};if(e&&e.id!==this.id){this.set(e.i18n,true)}}));window.addEventListener("cat-i18n-clear",(n=>{const{detail:e}=n||{};if(e&&e.id!==this.id){this.clear(true)}}))}static getInstance(){if(!o.instance){o.instance=new o}return o.instance}set(n,e=false){const t=Object.entries(n);t.forEach((([n,e])=>this.i18n.set(n,e)));i.info(`[CatI18nRegistry] Registered ${t.length!==1?"messages":"message"}`);!e&&window.dispatchEvent(this.buildEvent("cat-i18n-set",{i18n:n,id:this.id}))}clear(n=false){this.i18n.clear();i.info(`[CatI18nRegistry] Cleared messages`);!n&&window.dispatchEvent(this.buildEvent("cat-i18n-clear"))}t(n,e){const t=this.i18n.get(n);if(t===undefined){i.error(`[CatI18nRegistry] Unknown message key: ${n}`);return n}return t.replace(/{{\s*([-a-zA-Z._]+)\s*}}/g,((n,t)=>{var i;return`${(i=e===null||e===void 0?void 0:e[t])!==null&&i!==void 0?i:""}`}))}buildEvent(n,e){return new CustomEvent(n,{bubbles:true,composed:true,detail:e})}}const r=o.getInstance();class s{constructor(){this.id=(Math.random()+1).toString(36).substring(2);this.icons=new Map;window.addEventListener("cat-icons-added",(n=>{const{detail:e}=n||{};if(e&&e.id!==this.id){this.addIcons(e.icons,e.setName,true)}}));window.addEventListener("cat-icons-removed",(n=>{const{detail:e}=n||{};if(e&&e.id!==this.id){this.removeIcons(e.names,e.setName,true)}}))}static getInstance(){if(!s.instance){s.instance=new s}return s.instance}getIcon(n,e){const t=this.icons.get(this.buildName(n,e));if(!t){i.error(`[CatIconRegistry] Unknown icon${e?` in set ${e}`:""}: ${n}`)}return t}addIcons(n,e,t=false){const o=Object.entries(n);const r=o.length;o.forEach((([n,t])=>this.icons.set(this.buildName(n,e),t)));i.info(`[CatIconRegistry] Added ${r!==1?"icons":"icon"}${e?` to set ${e}`:""}`);!t&&window.dispatchEvent(this.buildEvent("cat-icons-added",{id:this.id,icons:n,setName:e}));return this}removeIcons(n,e,t=false){const o=n.length;n.forEach((n=>this.icons.delete(this.buildName(n,e))));i.info(`[CatIconRegistry] Removed ${o!==1?"icons":"icon"}${e?` from set ${e}`:""}`);!t&&window.dispatchEvent(this.buildEvent("cat-icons-removed",{id:this.id,names:n,setName:e}));return this}buildName(n,e){return e?`${e}:name`:n}buildEvent(n,e){return new CustomEvent(n,{bubbles:true,composed:true,detail:e})}}const c=s.getInstance();export{o as C,n as a,r as b,e as c,c as d,s as e,i as l};
|
|
2
|
+
//# sourceMappingURL=p-ccfebe33.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../node_modules/loglevel/lib/loglevel.js","src/components/cat-i18n/cat-i18n-registry.ts","src/components/cat-icon/cat-icon-registry.ts"],"names":["root","definition","module","exports","log","this","noop","undefinedType","isIE","window","navigator","test","userAgent","logMethods","bindMethod","obj","methodName","method","bind","Function","prototype","call","e","apply","arguments","traceForIE","console","trace","realMethod","undefined","replaceLoggingMethods","level","loggerName","i","length","methodFactory","debug","enableLoggingWhenConsoleArrives","defaultMethodFactory","Logger","name","defaultLevel","factory","self","currentLevel","storageKey","persistLevelIfPossible","levelNum","levelName","toUpperCase","localStorage","ignore","document","cookie","encodeURIComponent","getPersistedLevel","storedLevel","location","indexOf","exec","slice","levels","clearPersistedLevel","removeItem","TRACE","DEBUG","INFO","WARN","ERROR","SILENT","getLevel","setLevel","persist","setDefaultLevel","resetLevel","enableAll","disableAll","initialLevel","defaultLogger","_loggersByName","getLogger","TypeError","logger","_log","noConflict","getLoggers","CatI18nRegistry","[object Object]","id","Math","random","toString","substring","i18n","Map","addEventListener","event","detail","set","clear","instance","silent","i18nEntries","Object","entries","forEach","key","message","info","dispatchEvent","buildEvent","params","get","error","replace","_match","_a","CustomEvent","bubbles","composed","catI18nRegistry","getInstance","CatIconRegistry","icons","addIcons","setName","removeIcons","names","icon","buildName","iconEntries","iconSize","data","delete","catIconRegistry"],"mappings":"iYAMC,SAAUA,EAAMC,GAIN,GAAkCC,EAAOC,QAAS,CACrDD,EAAAC,QAAiBF,QACd,CACHD,EAAKI,IAAMH,MAPnB,CASEI,GAAM,WAIJ,IAAIC,EAAO,aACX,IAAIC,EAAgB,YACpB,IAAIC,SAAeC,SAAWF,UAA0BE,OAAOC,YAAcH,GACzE,kBAAkBI,KAAKF,OAAOC,UAAUE,WAG5C,IAAIC,EAAa,CACb,QACA,QACA,OACA,OACA,SAIJ,SAASC,EAAWC,EAAKC,GACrB,IAAIC,EAASF,EAAIC,GACjB,UAAWC,EAAOC,OAAS,WAAY,CACnC,OAAOD,EAAOC,KAAKH,OAChB,CACH,IACI,OAAOI,SAASC,UAAUF,KAAKG,KAAKJ,EAAQF,GAC9C,MAAOO,GAEL,OAAO,WACH,OAAOH,SAASC,UAAUG,MAAMA,MAAMN,EAAQ,CAACF,EAAKS,eAOpE,SAASC,IACL,GAAIC,QAAQtB,IAAK,CACb,GAAIsB,QAAQtB,IAAImB,MAAO,CACnBG,QAAQtB,IAAImB,MAAMG,QAASF,eACxB,CAEHL,SAASC,UAAUG,MAAMA,MAAMG,QAAQtB,IAAK,CAACsB,QAASF,aAG9D,GAAIE,QAAQC,MAAOD,QAAQC,QAK/B,SAASC,EAAWZ,GAChB,GAAIA,IAAe,QAAS,CACxBA,EAAa,MAGjB,UAAWU,UAAYnB,EAAe,CAClC,OAAO,WACJ,GAAIS,IAAe,SAAWR,EAAM,CACvC,OAAOiB,OACJ,GAAIC,QAAQV,KAAgBa,UAAW,CAC1C,OAAOf,EAAWY,QAASV,QACxB,GAAIU,QAAQtB,MAAQyB,UAAW,CAClC,OAAOf,EAAWY,QAAS,WACxB,CACH,OAAOpB,GAMf,SAASwB,EAAsBC,EA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terry/loglevel\n*\n* Copyright (c) 2013 Tim Perry\n* Licensed under the MIT license.\n*/\n(function (root, definition) {\n \"use strict\";\n if (typeof define === 'function' && define.amd) {\n define(definition);\n } else if (typeof module === 'object' && module.exports) {\n module.exports = definition();\n } else {\n root.log = definition();\n }\n}(this, function () {\n \"use strict\";\n\n // Slightly dubious tricks to cut down minimized file size\n var noop = function() {};\n var undefinedType = \"undefined\";\n var isIE = (typeof window !== undefinedType) && (typeof window.navigator !== undefinedType) && (\n /Trident\\/|MSIE /.test(window.navigator.userAgent)\n );\n\n var logMethods = [\n \"trace\",\n \"debug\",\n \"info\",\n \"warn\",\n \"error\"\n ];\n\n // Cross-browser bind equivalent that works at least back to IE6\n function bindMethod(obj, methodName) {\n var method = obj[methodName];\n if (typeof method.bind === 'function') {\n return method.bind(obj);\n } else {\n try {\n return Function.prototype.bind.call(method, obj);\n } catch (e) {\n // Missing bind shim or IE8 + Modernizr, fallback to wrapping\n return function() {\n return Function.prototype.apply.apply(method, [obj, arguments]);\n };\n }\n }\n }\n\n // Trace() doesn't print the message in IE, so for that case we need to wrap it\n function traceForIE() {\n if (console.log) {\n if (console.log.apply) {\n console.log.apply(console, arguments);\n } else {\n // In old IE, native console methods themselves don't have apply().\n Function.prototype.apply.apply(console.log, [console, arguments]);\n }\n }\n if (console.trace) console.trace();\n }\n\n // Build the best logging method possible for this env\n // Wherever possible we want to bind, not wrap, to preserve stack traces\n function realMethod(methodName) {\n if (methodName === 'debug') {\n methodName = 'log';\n }\n\n if (typeof console === undefinedType) {\n return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives\n } else if (methodName === 'trace' && isIE) {\n return traceForIE;\n } else if (console[methodName] !== undefined) {\n return bindMethod(console, methodName);\n } else if (console.log !== undefined) {\n return bindMethod(console, 'log');\n } else {\n return noop;\n }\n }\n\n // These private functions always need `this` to be set properly\n\n function replaceLoggingMethods(level, loggerName) {\n /*jshint validthis:true */\n for (var i = 0; i < logMethods.length; i++) {\n var methodName = logMethods[i];\n this[methodName] = (i < level) ?\n noop :\n this.methodFactory(methodName, level, loggerName);\n }\n\n // Define log.log as an alias for log.debug\n this.log = this.debug;\n }\n\n // In old IE versions, the console isn't present until you first open it.\n // We build realMethod() replacements here that regenerate logging methods\n function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {\n return function () {\n if (typeof console !== undefinedType) {\n replaceLoggingMethods.call(this, level, loggerName);\n this[methodName].apply(this, arguments);\n }\n };\n }\n\n // By default, we use closely bound real methods wherever possible, and\n // otherwise we wait for a console to appear, and then try again.\n function defaultMethodFactory(methodName, level, loggerName) {\n /*jshint validthis:true */\n return realMethod(methodName) ||\n enableLoggingWhenConsoleArrives.apply(this, arguments);\n }\n\n function Logger(name, defaultLevel, factory) {\n var self = this;\n var currentLevel;\n defaultLevel = defaultLevel == null ? \"WARN\" : defaultLevel;\n\n var storageKey = \"loglevel\";\n if (typeof name === \"string\") {\n storageKey += \":\" + name;\n } else if (typeof name === \"symbol\") {\n storageKey = undefined;\n }\n\n function persistLevelIfPossible(levelNum) {\n var levelName = (logMethods[levelNum] || 'silent').toUpperCase();\n\n if (typeof window === undefinedType || !storageKey) return;\n\n // Use localStorage if available\n try {\n window.localStorage[storageKey] = levelName;\n return;\n } catch (ignore) {}\n\n // Use session cookie as fallback\n try {\n window.document.cookie =\n encodeURIComponent(storageKey) + \"=\" + levelName + \";\";\n } catch (ignore) {}\n }\n\n function getPersistedLevel() {\n var storedLevel;\n\n if (typeof window === undefinedType || !storageKey) return;\n\n try {\n storedLevel = window.localStorage[storageKey];\n } catch (ignore) {}\n\n // Fallback to cookies if local storage gives us nothing\n if (typeof storedLevel === undefinedType) {\n try {\n var cookie = window.document.cookie;\n var location = cookie.indexOf(\n encodeURIComponent(storageKey) + \"=\");\n if (location !== -1) {\n storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1];\n }\n } catch (ignore) {}\n }\n\n // If the stored level is not valid, treat it as if nothing was stored.\n if (self.levels[storedLevel] === undefined) {\n storedLevel = undefined;\n }\n\n return storedLevel;\n }\n\n function clearPersistedLevel() {\n if (typeof window === undefinedType || !storageKey) return;\n\n // Use localStorage if available\n try {\n window.localStorage.removeItem(storageKey);\n return;\n } catch (ignore) {}\n\n // Use session cookie as fallback\n try {\n window.document.cookie =\n encodeURIComponent(storageKey) + \"=; expires=Thu, 01 Jan 1970 00:00:00 UTC\";\n } catch (ignore) {}\n }\n\n /*\n *\n * Public logger API - see https://github.com/pimterry/loglevel for details\n *\n */\n\n self.name = name;\n\n self.levels = { \"TRACE\": 0, \"DEBUG\": 1, \"INFO\": 2, \"WARN\": 3,\n \"ERROR\": 4, \"SILENT\": 5};\n\n self.methodFactory = factory || defaultMethodFactory;\n\n self.getLevel = function () {\n return currentLevel;\n };\n\n self.setLevel = function (level, persist) {\n if (typeof level === \"string\" && self.levels[level.toUpperCase()] !== undefined) {\n level = self.levels[level.toUpperCase()];\n }\n if (typeof level === \"number\" && level >= 0 && level <= self.levels.SILENT) {\n currentLevel = level;\n if (persist !== false) { // defaults to true\n persistLevelIfPossible(level);\n }\n replaceLoggingMethods.call(self, level, name);\n if (typeof console === undefinedType && level < self.levels.SILENT) {\n return \"No console available for logging\";\n }\n } else {\n throw \"log.setLevel() called with invalid level: \" + level;\n }\n };\n\n self.setDefaultLevel = function (level) {\n defaultLevel = level;\n if (!getPersistedLevel()) {\n self.setLevel(level, false);\n }\n };\n\n self.resetLevel = function () {\n self.setLevel(defaultLevel, false);\n clearPersistedLevel();\n };\n\n self.enableAll = function(persist) {\n self.setLevel(self.levels.TRACE, persist);\n };\n\n self.disableAll = function(persist) {\n self.setLevel(self.levels.SILENT, persist);\n };\n\n // Initialize with the right level\n var initialLevel = getPersistedLevel();\n if (initialLevel == null) {\n initialLevel = defaultLevel;\n }\n self.setLevel(initialLevel, false);\n }\n\n /*\n *\n * Top-level API\n *\n */\n\n var defaultLogger = new Logger();\n\n var _loggersByName = {};\n defaultLogger.getLogger = function getLogger(name) {\n if ((typeof name !== \"symbol\" && typeof name !== \"string\") || name === \"\") {\n throw new TypeError(\"You must supply a name when creating a logger.\");\n }\n\n var logger = _loggersByName[name];\n if (!logger) {\n logger = _loggersByName[name] = new Logger(\n name, defaultLogger.getLevel(), defaultLogger.methodFactory);\n }\n return logger;\n };\n\n // Grab the current global log variable in case of overwrite\n var _log = (typeof window !== undefinedType) ? window.log : undefined;\n defaultLogger.noConflict = function() {\n if (typeof window !== undefinedType &&\n window.log === defaultLogger) {\n window.log = _log;\n }\n\n return defaultLogger;\n };\n\n defaultLogger.getLoggers = function getLoggers() {\n return _loggersByName;\n };\n\n // ES6 default export, for compatibility\n defaultLogger['default'] = defaultLogger;\n\n return defaultLogger;\n}));\n","import log from 'loglevel';\n\nexport class CatI18nRegistry {\n private static instance: CatI18nRegistry;\n\n private readonly id = (Math.random() + 1).toString(36).substring(2);\n private readonly i18n: Map<string, string> = new Map();\n\n private constructor() {\n // hide constructor\n\n // In rare cases, the registry can be initialized twice. This can happen in\n // a micro frontend architecture where the registry is initialized in the\n // host application and in the micro frontend. To prevent the registry in\n // one application from overwriting the registry in the other, we listen for\n // events that are dispatched when messages are added or removed in other\n // applications and add or remove messages if the event was not dispatched\n // by this registry.\n window.addEventListener('cat-i18n-set', event => {\n const { detail } = (event as CustomEvent) || {};\n if (detail && detail.id !== this.id) {\n this.set(detail.i18n, true);\n }\n });\n window.addEventListener('cat-i18n-clear', event => {\n const { detail } = (event as CustomEvent) || {};\n if (detail && detail.id !== this.id) {\n this.clear(true);\n }\n });\n }\n\n static getInstance(): CatI18nRegistry {\n if (!CatI18nRegistry.instance) {\n CatI18nRegistry.instance = new CatI18nRegistry();\n }\n return CatI18nRegistry.instance;\n }\n\n set(i18n: { [key: string]: string }, silent = false): void {\n const i18nEntries = Object.entries(i18n);\n i18nEntries.forEach(([key, message]) => this.i18n.set(key, message));\n log.info(`[CatI18nRegistry] Registered ${i18nEntries.length !== 1 ? 'messages' : 'message'}`);\n !silent && window.dispatchEvent(this.buildEvent('cat-i18n-set', { i18n, id: this.id }));\n }\n\n clear(silent = false): void {\n this.i18n.clear();\n log.info(`[CatI18nRegistry] Cleared messages`);\n !silent && window.dispatchEvent(this.buildEvent('cat-i18n-clear'));\n }\n\n t(key: string, params?: { [key: string]: string | number }): string {\n const message = this.i18n.get(key);\n if (message === undefined) {\n log.error(`[CatI18nRegistry] Unknown message key: ${key}`);\n return key;\n }\n return message.replace(/{{\\s*([-a-zA-Z._]+)\\s*}}/g, (_match, key) => `${params?.[key] ?? ''}`);\n }\n\n private buildEvent<T>(name: string, detail?: T) {\n return new CustomEvent(name, {\n bubbles: true,\n composed: true,\n detail\n });\n }\n}\n\nexport const catI18nRegistry = CatI18nRegistry.getInstance();\n","import log from 'loglevel';\n\nexport class CatIconRegistry {\n private static instance: CatIconRegistry;\n\n private readonly id = (Math.random() + 1).toString(36).substring(2);\n private readonly icons: Map<string, string> = new Map();\n\n private constructor() {\n // hide constructor\n\n // In rare cases, the registry can be initialized twice. This can happen in\n // a micro frontend architecture where the registry is initialized in the\n // host application and in the micro frontend. To prevent the registry in\n // one application from overwriting the registry in the other, we listen for\n // events that are dispatched when icons are added or removed in other\n // applications and add or remove icons if the event was not dispatched by\n // this registry.\n window.addEventListener('cat-icons-added', event => {\n const { detail } = (event as CustomEvent) || {};\n if (detail && detail.id !== this.id) {\n this.addIcons(detail.icons, detail.setName, true);\n }\n });\n window.addEventListener('cat-icons-removed', event => {\n const { detail } = (event as CustomEvent) || {};\n if (detail && detail.id !== this.id) {\n this.removeIcons(detail.names, detail.setName, true);\n }\n });\n }\n\n static getInstance(): CatIconRegistry {\n if (!CatIconRegistry.instance) {\n CatIconRegistry.instance = new CatIconRegistry();\n }\n return CatIconRegistry.instance;\n }\n\n getIcon(name: string, setName?: string): string | undefined {\n const icon = this.icons.get(this.buildName(name, setName));\n if (!icon) {\n log.error(`[CatIconRegistry] Unknown icon${setName ? ` in set ${setName}` : ''}: ${name}`);\n }\n return icon;\n }\n\n addIcons(icons: { [name: string]: string }, setName?: string, silent = false): CatIconRegistry {\n const iconEntries = Object.entries(icons);\n const iconSize = iconEntries.length;\n iconEntries.forEach(([name, data]) => this.icons.set(this.buildName(name, setName), data));\n log.info(`[CatIconRegistry] Added ${iconSize !== 1 ? 'icons' : 'icon'}${setName ? ` to set ${setName}` : ''}`);\n !silent && window.dispatchEvent(this.buildEvent('cat-icons-added', { id: this.id, icons, setName }));\n return this;\n }\n\n removeIcons(names: string[], setName?: string, silent = false): CatIconRegistry {\n const iconSize = names.length;\n names.forEach(name => this.icons.delete(this.buildName(name, setName)));\n log.info(`[CatIconRegistry] Removed ${iconSize !== 1 ? 'icons' : 'icon'}${setName ? ` from set ${setName}` : ''}`);\n !silent && window.dispatchEvent(this.buildEvent('cat-icons-removed', { id: this.id, names, setName }));\n return this;\n }\n\n private buildName(name: string, setName?: string) {\n return setName ? `${setName}:name` : name;\n }\n\n private buildEvent<T>(name: string, detail?: T) {\n return new CustomEvent(name, {\n bubbles: true,\n composed: true,\n detail\n });\n }\n}\n\nexport const catIconRegistry = CatIconRegistry.getInstance();\n"]}
|
|
@@ -31,34 +31,34 @@ $cat-elevation: (
|
|
|
31
31
|
0: none,
|
|
32
32
|
1: (
|
|
33
33
|
0 0 0 1px cat-token('color.ui.border.default'),
|
|
34
|
-
0 1px 2px rgba(27, 31, 38,
|
|
34
|
+
0 1px 2px rgba(27, 31, 38, 5%)
|
|
35
35
|
),
|
|
36
36
|
2: (
|
|
37
37
|
0 0 0 1px cat-token('color.ui.border.default'),
|
|
38
|
-
0 1px 2px rgba(27, 31, 38,
|
|
39
|
-
0 1px 3px rgba(27, 31, 38,
|
|
38
|
+
0 1px 2px rgba(27, 31, 38, 6%),
|
|
39
|
+
0 1px 3px rgba(27, 31, 38, 10%)
|
|
40
40
|
),
|
|
41
41
|
3: (
|
|
42
42
|
0 0 0 1px cat-token('color.ui.border.default'),
|
|
43
|
-
0 2px 4px -2px rgba(27, 31, 38,
|
|
44
|
-
0 4px 8px -2px rgba(27, 31, 38,
|
|
43
|
+
0 2px 4px -2px rgba(27, 31, 38, 6%),
|
|
44
|
+
0 4px 8px -2px rgba(27, 31, 38, 10%)
|
|
45
45
|
),
|
|
46
46
|
4: (
|
|
47
47
|
0 0 0 1px cat-token('color.ui.border.default'),
|
|
48
|
-
0 4px 6px -2px rgba(27, 31, 38,
|
|
49
|
-
0 12px 16px -4px rgba(27, 31, 38,
|
|
48
|
+
0 4px 6px -2px rgba(27, 31, 38, 3%),
|
|
49
|
+
0 12px 16px -4px rgba(27, 31, 38, 8%)
|
|
50
50
|
),
|
|
51
51
|
5: (
|
|
52
52
|
0 0 0 1px cat-token('color.ui.border.default'),
|
|
53
|
-
0 8px 8px -4px rgba(27, 31, 38,
|
|
54
|
-
0 20px 24px -4px rgba(27, 31, 38,
|
|
53
|
+
0 8px 8px -4px rgba(27, 31, 38, 3%),
|
|
54
|
+
0 20px 24px -4px rgba(27, 31, 38, 8%)
|
|
55
55
|
),
|
|
56
56
|
6: (
|
|
57
57
|
0 0 0 1px cat-token('color.ui.border.default'),
|
|
58
|
-
0 24px 48px -12px rgba(27, 31, 38,
|
|
58
|
+
0 24px 48px -12px rgba(27, 31, 38, 18%)
|
|
59
59
|
),
|
|
60
60
|
7: (
|
|
61
61
|
0 0 0 1px cat-token('color.ui.border.default'),
|
|
62
|
-
0 32px 64px -12px rgba(27, 31, 38,
|
|
62
|
+
0 32px 64px -12px rgba(27, 31, 38, 14%)
|
|
63
63
|
)
|
|
64
64
|
);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-e540e911.js');
|
|
6
|
-
const catIconRegistry = require('./cat-icon-registry-
|
|
6
|
+
const catIconRegistry = require('./cat-icon-registry-671af264.js');
|
|
7
7
|
const firstTabbable = require('./first-tabbable-7966cf1c.js');
|
|
8
8
|
|
|
9
9
|
function setAttributeDefault(host, attr, value) {
|
|
@@ -1887,12 +1887,50 @@ const CatDropdown = class {
|
|
|
1887
1887
|
CatDropdown.OFFSET = 4;
|
|
1888
1888
|
CatDropdown.style = catDropdownCss;
|
|
1889
1889
|
|
|
1890
|
+
const catFormGroupCss = ":host{display:block}";
|
|
1891
|
+
|
|
1892
|
+
const CatFormGroup = class {
|
|
1893
|
+
constructor(hostRef) {
|
|
1894
|
+
index.registerInstance(this, hostRef);
|
|
1895
|
+
this.formElements = [];
|
|
1896
|
+
/**
|
|
1897
|
+
* Whether the labels need a marker to shown if the forms fields are required or optional.<br /><br />
|
|
1898
|
+
* By default, it is set to auto, it will display the mark depending on the number of required and optional fields: <br />
|
|
1899
|
+
* - If there are more required, the optional will be marked.<br />
|
|
1900
|
+
* - If there are less required, it will mark the required.<br /><br />
|
|
1901
|
+
* If a form field had "!", the requiredMarked of the field would not change.
|
|
1902
|
+
*/
|
|
1903
|
+
this.requiredMarker = 'auto';
|
|
1904
|
+
}
|
|
1905
|
+
onRequiredMarker(newRequiredMarker) {
|
|
1906
|
+
const updateMarker = newRequiredMarker === 'auto' ? this.calculate(this.formElements) : newRequiredMarker;
|
|
1907
|
+
this.formElements.forEach(element => { var _a; return !((_a = element.requiredMarker) === null || _a === void 0 ? void 0 : _a.endsWith('!')) && (element.requiredMarker = updateMarker); });
|
|
1908
|
+
}
|
|
1909
|
+
render() {
|
|
1910
|
+
return (index.h(index.Host, null, index.h("slot", { onSlotchange: this.onSlotChange.bind(this) })));
|
|
1911
|
+
}
|
|
1912
|
+
onSlotChange() {
|
|
1913
|
+
this.formElements = Array.from(this.hostElement.querySelectorAll('cat-textarea, cat-input, cat-select, cat-label'));
|
|
1914
|
+
this.onRequiredMarker(this.requiredMarker);
|
|
1915
|
+
}
|
|
1916
|
+
calculate(elements) {
|
|
1917
|
+
const formFields = elements.filter(value => value.tagName !== 'CAT-LABEL');
|
|
1918
|
+
const optionalFields = formFields.filter(value => !value.required).length;
|
|
1919
|
+
const requiredFields = formFields.length - optionalFields;
|
|
1920
|
+
return requiredFields >= optionalFields ? 'optional' : 'required';
|
|
1921
|
+
}
|
|
1922
|
+
get hostElement() { return index.getElement(this); }
|
|
1923
|
+
static get watchers() { return {
|
|
1924
|
+
"requiredMarker": ["onRequiredMarker"]
|
|
1925
|
+
}; }
|
|
1926
|
+
};
|
|
1927
|
+
CatFormGroup.style = catFormGroupCss;
|
|
1928
|
+
|
|
1890
1929
|
const catIconCss = ":host{display:inline-flex;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}span{display:inline-flex}svg{fill:currentColor;stroke:none;transform-origin:center center;height:1em;width:calc(var(--cat-icon-ratio, 1) * 1em)}.icon-xs svg{font-size:0.75rem}.icon-s svg{font-size:1rem}.icon-m svg{font-size:1.25rem}.icon-l svg{font-size:1.5rem}.icon-xl svg{font-size:1.75rem}";
|
|
1891
1930
|
|
|
1892
1931
|
const CatIcon = class {
|
|
1893
1932
|
constructor(hostRef) {
|
|
1894
1933
|
index.registerInstance(this, hostRef);
|
|
1895
|
-
this.iconRegistry = catIconRegistry.CatIconRegistry.getInstance();
|
|
1896
1934
|
/**
|
|
1897
1935
|
* The name of the icon.
|
|
1898
1936
|
*/
|
|
@@ -1903,7 +1941,7 @@ const CatIcon = class {
|
|
|
1903
1941
|
this.size = 'm';
|
|
1904
1942
|
}
|
|
1905
1943
|
render() {
|
|
1906
|
-
return (index.h("span", { innerHTML:
|
|
1944
|
+
return (index.h("span", { innerHTML: catIconRegistry.catIconRegistry.getIcon(this.icon), "aria-label": this.a11yLabel, "aria-hidden": this.a11yLabel ? null : 'true', part: "icon", class: {
|
|
1907
1945
|
icon: true,
|
|
1908
1946
|
[`icon-${this.size}`]: this.size !== 'inline'
|
|
1909
1947
|
} }));
|
|
@@ -1922,6 +1960,10 @@ const CatInput = class {
|
|
|
1922
1960
|
this.catBlur = index.createEvent(this, "catBlur", 7);
|
|
1923
1961
|
this._id = `cat-input-${nextUniqueId$6++}`;
|
|
1924
1962
|
this.hasSlottedLabel = false;
|
|
1963
|
+
/**
|
|
1964
|
+
* Whether the label need a marker to shown if the input is required or optional.
|
|
1965
|
+
*/
|
|
1966
|
+
this.requiredMarker = 'optional';
|
|
1925
1967
|
/**
|
|
1926
1968
|
* Whether the input should show a clear button.
|
|
1927
1969
|
*/
|
|
@@ -1998,7 +2040,7 @@ const CatInput = class {
|
|
|
1998
2040
|
this.value = '';
|
|
1999
2041
|
}
|
|
2000
2042
|
render() {
|
|
2001
|
-
return (index.h(index.Host, null, (this.hasSlottedLabel || this.label) && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label, !this.required && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.optional'), ")"))))), index.h("div", { class: {
|
|
2043
|
+
return (index.h(index.Host, null, (this.hasSlottedLabel || this.label) && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label, !this.required && this.requiredMarker.startsWith('optional') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.required'), ")"))))), index.h("div", { class: {
|
|
2002
2044
|
'input-wrapper': true,
|
|
2003
2045
|
'input-round': this.round,
|
|
2004
2046
|
'input-disabled': this.disabled
|
|
@@ -2029,6 +2071,10 @@ const catLabelCss = ":host{display:inline-flex;align-items:center;min-height:2.5
|
|
|
2029
2071
|
const CatLabel = class {
|
|
2030
2072
|
constructor(hostRef) {
|
|
2031
2073
|
index.registerInstance(this, hostRef);
|
|
2074
|
+
/**
|
|
2075
|
+
* Whether the label need a marker to shown if the input is required or optional.
|
|
2076
|
+
*/
|
|
2077
|
+
this.requiredMarker = 'optional';
|
|
2032
2078
|
/**
|
|
2033
2079
|
* A value is required or must be check for the form to be submittable.
|
|
2034
2080
|
*/
|
|
@@ -2042,7 +2088,7 @@ const CatLabel = class {
|
|
|
2042
2088
|
}
|
|
2043
2089
|
}
|
|
2044
2090
|
render() {
|
|
2045
|
-
return (index.h(index.Host, null, index.h("label", { htmlFor: this.for, onClick: this.onClick.bind(this) }, index.h("slot", null), !this.required && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.optional'), ")")))));
|
|
2091
|
+
return (index.h(index.Host, null, index.h("label", { htmlFor: this.for, onClick: this.onClick.bind(this) }, index.h("slot", null), !this.required && this.requiredMarker.startsWith('optional') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.required'), ")")))));
|
|
2046
2092
|
}
|
|
2047
2093
|
findShadowTarget(id) {
|
|
2048
2094
|
var _a;
|
|
@@ -4212,6 +4258,10 @@ const CatSelect = class {
|
|
|
4212
4258
|
this.valueChangedBySelection = false;
|
|
4213
4259
|
this.state = INIT_STATE;
|
|
4214
4260
|
this.hasSlottedLabel = false;
|
|
4261
|
+
/**
|
|
4262
|
+
* Whether the label need a marker to shown if the select is required or optional.
|
|
4263
|
+
*/
|
|
4264
|
+
this.requiredMarker = 'optional';
|
|
4215
4265
|
/**
|
|
4216
4266
|
* Enable multiple selection.
|
|
4217
4267
|
*/
|
|
@@ -4445,7 +4495,7 @@ const CatSelect = class {
|
|
|
4445
4495
|
});
|
|
4446
4496
|
}
|
|
4447
4497
|
render() {
|
|
4448
|
-
return (index.h(index.Host, null, (this.hasSlottedLabel || this.label) && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label, !this.required && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.optional'), ")"))))), index.h("div", { class: { 'select-wrapper': true, 'select-disabled': this.disabled }, ref: el => (this.trigger = el), id: this.id, role: "combobox", "aria-expanded": this.state.isOpen || this.isPillboxActive(), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-required": this.required, "aria-activedescendant": this.activeDescendant, onClick: e => this.onClick(e) }, index.h("div", { class: "select-wrapper-inner" }, this.multiple && this.state.selection.length ? (index.h("div", { id: `select-pillbox-${this.id}`, role: "listbox", "aria-orientation": "horizontal", class: "select-pills" }, this.state.selection.map((item, i) => (index.h("span", { class: {
|
|
4498
|
+
return (index.h(index.Host, null, (this.hasSlottedLabel || this.label) && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label, !this.required && this.requiredMarker.startsWith('optional') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.required'), ")"))))), index.h("div", { class: { 'select-wrapper': true, 'select-disabled': this.disabled }, ref: el => (this.trigger = el), id: this.id, role: "combobox", "aria-expanded": this.state.isOpen || this.isPillboxActive(), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-required": this.required ? 'true' : false, "aria-activedescendant": this.activeDescendant, onClick: e => this.onClick(e) }, index.h("div", { class: "select-wrapper-inner" }, this.multiple && this.state.selection.length ? (index.h("div", { id: `select-pillbox-${this.id}`, role: "listbox", "aria-orientation": "horizontal", class: "select-pills" }, this.state.selection.map((item, i) => (index.h("span", { class: {
|
|
4449
4499
|
pill: true,
|
|
4450
4500
|
'select-no-open': true,
|
|
4451
4501
|
'select-option-active': this.state.activeSelectionIndex === i
|
|
@@ -4455,7 +4505,7 @@ const CatSelect = class {
|
|
|
4455
4505
|
this.clearable ? (index.h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "cross-circle-outlined", variant: "text", size: "s", a11yLabel: catIconRegistry.catI18nRegistry.t('input.clear'), onClick: () => this.clear() })) : null, !this.state.isResolving && (index.h("cat-button", { iconOnly: true, icon: "chevron-down-outlined", class: { 'select-btn': true, 'select-btn-open': this.state.isOpen }, variant: "text", size: "s", a11yLabel: this.state.isOpen ? catIconRegistry.catI18nRegistry.t('select.close') : catIconRegistry.catI18nRegistry.t('select.open'), "aria-controls": `select-listbox-${this.id}`, "aria-expanded": this.state.isOpen, tabIndex: -1, disabled: this.disabled || this.state.isResolving }))), this.hintSection, index.h("div", { class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (index.h("cat-scrollable", { class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, index.h("ul", { class: "select-options", role: "listbox", "aria-multiselectable": this.multiple, "aria-setsize": this.state.totalElements, id: `select-listbox-${this.id}` }, this.optionsList, this.state.isLoading
|
|
4456
4506
|
? Array.from(Array(CatSelect.SKELETON_COUNT)).map(() => (index.h("li", { class: "select-option-loading" }, index.h("cat-skeleton", { variant: "body", lines: 1 }), index.h("cat-skeleton", { variant: "body", lines: 1 }))))
|
|
4457
4507
|
: !this.state.options.length &&
|
|
4458
|
-
!this.tags && index.h("li", { class: "select-option-empty" }, catIconRegistry.catI18nRegistry.t('select.empty'))))))));
|
|
4508
|
+
!this.tags && (index.h("li", { class: "select-option-empty" }, this.noItems ? this.noItems : catIconRegistry.catI18nRegistry.t('select.empty')))))))));
|
|
4459
4509
|
}
|
|
4460
4510
|
get optionsList() {
|
|
4461
4511
|
return this.state.options.map((item, i) => {
|
|
@@ -4882,7 +4932,7 @@ const CatSelectTest = class {
|
|
|
4882
4932
|
setTimeout(() => this.multipleSelect && (this.multipleSelect.value = []), 5000);
|
|
4883
4933
|
}
|
|
4884
4934
|
render() {
|
|
4885
|
-
return (index.h(index.Host, { style: { display: 'flex', flexDirection: 'column' } }, index.h("cat-select", { label: "Multiple Select", hint: "This is a hint!", ref: el => (this.multipleSelect = el), value: ['1'], placeholder: "Hello World", onCatChange: () => { var _a; return console.log((_a = this.multipleSelect) === null || _a === void 0 ? void 0 : _a.value); }, onCatBlur: e => console.log('Multiple blur', e), multiple: true, clearable: true }, index.h("span", { slot: "hint" }, "Searching for \"no\" -", '>', " no options are returned!")), index.h("cat-select", { label: "Multiple with img", ref: el => (this.multipleSelectAvatar = el), value: ['1'], placeholder: "Hello World", multiple: true, clearable: true }), index.h("cat-select", { label: "Multiple with tagging support", hint: "This is a hint!", ref: el => (this.multipleSelectTagging = el), value: { ids: ['1'], tags: ['Test', 'Albania', 'Algeria'] }, placeholder: "Select country", onCatChange: () => { var _a; return console.log((_a = this.multipleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, multiple: true, tags: true, clearable: true }), index.h("cat-select", { label: "Single Select", hint: "This is a hint!", ref: el => (this.singleSelect = el), placeholder: "Search for a country or capital", onCatBlur: e => console.log('Single blur', e), clearable: true }), index.h("cat-select", { label: "Single with img", ref: el => (this.singleSelectAvatar = el), value: '1', onCatChange: () => { var _a; return console.log((_a = this.singleSelectAvatar) === null || _a === void 0 ? void 0 : _a.value); }, placeholder: "Search for a country or capital", clearable: true }), index.h("cat-dropdown", { overflow: true, noAutoClose: true }, index.h("cat-button", { slot: "trigger", style: { width: '50%' } }, "Open select"), index.h("div", { slot: "content", style: { width: '400px' } }, index.h("cat-select", { label: "Single with tagging support", ref: el => (this.singleSelectTagging = el), value: { id: '', tag: 'Albania' }, placeholder: "Search for a country or capital", onCatChange: () => { var _a; return console.log('Single', (_a = this.singleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, tagHint: "new country", tags: true, clearable: true, style: { width: '90%' } })))));
|
|
4935
|
+
return (index.h(index.Host, { style: { display: 'flex', flexDirection: 'column' } }, index.h("cat-select", { label: "Multiple Select", hint: "This is a hint!", ref: el => (this.multipleSelect = el), value: ['1'], placeholder: "Hello World", onCatChange: () => { var _a; return console.log((_a = this.multipleSelect) === null || _a === void 0 ? void 0 : _a.value); }, onCatBlur: e => console.log('Multiple blur', e), multiple: true, noItems: "No results", clearable: true }, index.h("span", { slot: "hint" }, "Searching for \"no\" -", '>', " no options are returned!")), index.h("cat-select", { label: "Multiple with img", ref: el => (this.multipleSelectAvatar = el), value: ['1'], placeholder: "Hello World", multiple: true, clearable: true }), index.h("cat-select", { label: "Multiple with tagging support", hint: "This is a hint!", ref: el => (this.multipleSelectTagging = el), value: { ids: ['1'], tags: ['Test', 'Albania', 'Algeria'] }, placeholder: "Select country", onCatChange: () => { var _a; return console.log((_a = this.multipleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, multiple: true, tags: true, clearable: true }), index.h("cat-select", { label: "Single Select", hint: "This is a hint!", ref: el => (this.singleSelect = el), placeholder: "Search for a country or capital", onCatBlur: e => console.log('Single blur', e), clearable: true }), index.h("cat-select", { label: "Single with img", ref: el => (this.singleSelectAvatar = el), value: '1', onCatChange: () => { var _a; return console.log((_a = this.singleSelectAvatar) === null || _a === void 0 ? void 0 : _a.value); }, placeholder: "Search for a country or capital", clearable: true }), index.h("cat-dropdown", { overflow: true, noAutoClose: true }, index.h("cat-button", { slot: "trigger", style: { width: '50%' } }, "Open select"), index.h("div", { slot: "content", style: { width: '400px' } }, index.h("cat-select", { label: "Single with tagging support", ref: el => (this.singleSelectTagging = el), value: { id: '', tag: 'Albania' }, placeholder: "Search for a country or capital", onCatChange: () => { var _a; return console.log('Single', (_a = this.singleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, tagHint: "new country", tags: true, clearable: true, style: { width: '90%' } })))));
|
|
4886
4936
|
}
|
|
4887
4937
|
get countryConnector() {
|
|
4888
4938
|
return {
|
|
@@ -6329,6 +6379,10 @@ const CatTextarea = class {
|
|
|
6329
6379
|
this.catBlur = index.createEvent(this, "catBlur", 7);
|
|
6330
6380
|
this._id = `cat-textarea-${nextUniqueId$2++}`;
|
|
6331
6381
|
this.hasSlottedLabel = false;
|
|
6382
|
+
/**
|
|
6383
|
+
* Whether the label need a marker to shown if the textarea is required or optional.
|
|
6384
|
+
*/
|
|
6385
|
+
this.requiredMarker = 'optional';
|
|
6332
6386
|
/**
|
|
6333
6387
|
* Whether the textarea is disabled.
|
|
6334
6388
|
*/
|
|
@@ -6390,7 +6444,7 @@ const CatTextarea = class {
|
|
|
6390
6444
|
this.textarea.click();
|
|
6391
6445
|
}
|
|
6392
6446
|
render() {
|
|
6393
|
-
return (index.h(index.Host, null, (this.hasSlottedLabel || this.label) && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label, !this.required && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(
|
|
6447
|
+
return (index.h(index.Host, null, (this.hasSlottedLabel || this.label) && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label, !this.required && this.requiredMarker.startsWith('optional') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.required'), ")"))))), index.h("textarea", { ref: el => (this.textarea = el), id: this.id, disabled: this.disabled, maxlength: this.maxLength, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, rows: this.rows, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), this.hintSection));
|
|
6394
6448
|
}
|
|
6395
6449
|
get hintSection() {
|
|
6396
6450
|
const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
@@ -6656,6 +6710,7 @@ exports.cat_button = CatButton;
|
|
|
6656
6710
|
exports.cat_card = CatCard;
|
|
6657
6711
|
exports.cat_checkbox = CatCheckbox;
|
|
6658
6712
|
exports.cat_dropdown = CatDropdown;
|
|
6713
|
+
exports.cat_form_group = CatFormGroup;
|
|
6659
6714
|
exports.cat_icon = CatIcon;
|
|
6660
6715
|
exports.cat_input = CatInput;
|
|
6661
6716
|
exports.cat_label = CatLabel;
|
|
@@ -6673,4 +6728,4 @@ exports.cat_textarea = CatTextarea;
|
|
|
6673
6728
|
exports.cat_toggle = CatToggle;
|
|
6674
6729
|
exports.cat_tooltip = CatTooltip;
|
|
6675
6730
|
|
|
6676
|
-
//# sourceMappingURL=cat-
|
|
6731
|
+
//# sourceMappingURL=cat-alert_24.cjs.entry.js.map
|