@haiilo/catalyst 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/catalyst/catalyst.css +1 -1403
  2. package/dist/catalyst/catalyst.esm.js +1 -126
  3. package/dist/catalyst/index.esm.js +0 -1
  4. package/dist/catalyst/p-22fac0fb.js +1 -0
  5. package/dist/catalyst/p-2dc28db3.entry.js +11 -0
  6. package/dist/catalyst/{p-f3fad7a0.js → p-e08f13c7.js} +1 -1
  7. package/dist/cjs/{app-globals-8908fe44.js → app-globals-814f34aa.js} +5 -2
  8. package/dist/cjs/cat-alert_7.cjs.entry.js +3115 -0
  9. package/dist/cjs/{cat-icon-registry-da00f7d6.js → cat-icon-registry-909e38e7.js} +65 -1
  10. package/dist/cjs/catalyst.cjs.js +7 -114
  11. package/dist/cjs/loader.cjs.js +5 -20
  12. package/dist/collection/collection-manifest.json +6 -2
  13. package/dist/collection/components/cat-alert/cat-alert.css +57 -0
  14. package/dist/collection/components/cat-alert/cat-alert.js +49 -0
  15. package/dist/collection/components/cat-badge/cat-badge.css +154 -0
  16. package/dist/collection/components/cat-badge/cat-badge.js +141 -0
  17. package/dist/collection/components/cat-button/cat-button.css +43 -8
  18. package/dist/collection/components/cat-button/cat-button.js +28 -6
  19. package/dist/collection/components/cat-icon/cat-icon.css +2 -1
  20. package/dist/collection/components/cat-menu/cat-menu.css +33 -0
  21. package/dist/collection/components/cat-menu/cat-menu.js +185 -0
  22. package/dist/collection/components/cat-skeleton/cat-skeleton.css +177 -0
  23. package/dist/collection/components/cat-skeleton/cat-skeleton.js +130 -0
  24. package/dist/components/cat-alert.d.ts +11 -0
  25. package/dist/components/cat-alert.js +42 -0
  26. package/dist/components/cat-badge.d.ts +11 -0
  27. package/dist/components/cat-badge.js +66 -0
  28. package/dist/components/cat-button.js +14 -42
  29. package/dist/components/cat-icon2.js +4 -5
  30. package/dist/components/cat-menu.d.ts +11 -0
  31. package/dist/components/cat-menu.js +2377 -0
  32. package/dist/components/cat-skeleton.d.ts +11 -0
  33. package/dist/components/cat-skeleton.js +76 -0
  34. package/dist/components/cat-spinner2.js +3 -4
  35. package/dist/components/index.d.ts +1 -1
  36. package/dist/components/index.js +4 -575
  37. package/dist/esm/{app-globals-000601ea.js → app-globals-e1679c2d.js} +5 -2
  38. package/dist/esm/cat-alert_7.entry.js +3105 -0
  39. package/dist/esm/{cat-icon-registry-b66e3f57.js → cat-icon-registry-4d02ee6c.js} +65 -2
  40. package/dist/esm/catalyst.js +6 -113
  41. package/dist/esm/loader.js +4 -19
  42. package/dist/esm/polyfills/css-shim.js +1 -1
  43. package/dist/types/components/cat-alert/cat-alert.d.ts +12 -0
  44. package/dist/types/components/cat-badge/cat-badge.d.ts +28 -0
  45. package/dist/types/components/cat-button/cat-button.d.ts +5 -0
  46. package/dist/types/components/cat-menu/cat-menu.d.ts +32 -0
  47. package/dist/types/components/cat-skeleton/cat-skeleton.d.ts +28 -0
  48. package/dist/types/components.d.ts +153 -0
  49. package/package.json +12 -9
  50. package/dist/catalyst/app-globals-622e4f87.js +0 -704
  51. package/dist/catalyst/cat-button.entry.js +0 -629
  52. package/dist/catalyst/cat-icon-registry-59da2e37.js +0 -43
  53. package/dist/catalyst/cat-icon.entry.js +0 -27
  54. package/dist/catalyst/cat-spinner.entry.js +0 -21
  55. package/dist/catalyst/css-shim-20dbffa5.js +0 -4
  56. package/dist/catalyst/dom-c5ed0ba5.js +0 -73
  57. package/dist/catalyst/index-72a1bbba.js +0 -3031
  58. package/dist/catalyst/p-17a20657.js +0 -1
  59. package/dist/catalyst/p-582935bb.entry.js +0 -1
  60. package/dist/catalyst/shadow-css-8c625855.js +0 -388
  61. package/dist/cjs/app-globals-fe9ff8ba.js +0 -706
  62. package/dist/cjs/cat-button.cjs.entry.js +0 -633
  63. package/dist/cjs/cat-button_3.cjs.entry.js +0 -645
  64. package/dist/cjs/cat-icon-registry-850c538c.js +0 -45
  65. package/dist/cjs/cat-icon.cjs.entry.js +0 -31
  66. package/dist/cjs/cat-spinner.cjs.entry.js +0 -25
  67. package/dist/cjs/css-shim-3bfdba4f.js +0 -6
  68. package/dist/cjs/dom-8ac1ad03.js +0 -75
  69. package/dist/cjs/index-083488c8.js +0 -3065
  70. package/dist/cjs/shadow-css-41d9783d.js +0 -390
  71. package/dist/esm/app-globals-622e4f87.js +0 -704
  72. package/dist/esm/cat-button.entry.js +0 -629
  73. package/dist/esm/cat-button_3.entry.js +0 -639
  74. package/dist/esm/cat-icon-registry-59da2e37.js +0 -43
  75. package/dist/esm/cat-icon.entry.js +0 -27
  76. package/dist/esm/cat-spinner.entry.js +0 -21
  77. package/dist/esm/css-shim-20dbffa5.js +0 -4
  78. package/dist/esm/dom-c5ed0ba5.js +0 -73
  79. package/dist/esm/index-72a1bbba.js +0 -3031
  80. package/dist/esm/shadow-css-8c625855.js +0 -388
@@ -1,633 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-083488c8.js');
6
-
7
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8
-
9
- function getDefaultExportFromCjs (x) {
10
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
11
- }
12
-
13
- function createCommonjsModule(fn, basedir, module) {
14
- return module = {
15
- path: basedir,
16
- exports: {},
17
- require: function (path, base) {
18
- return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
19
- }
20
- }, fn(module, module.exports), module.exports;
21
- }
22
-
23
- function getDefaultExportFromNamespaceIfPresent (n) {
24
- return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
25
- }
26
-
27
- function getDefaultExportFromNamespaceIfNotNamed (n) {
28
- return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
29
- }
30
-
31
- function getAugmentedNamespace(n) {
32
- if (n.__esModule) return n;
33
- var a = Object.defineProperty({}, '__esModule', {value: true});
34
- Object.keys(n).forEach(function (k) {
35
- var d = Object.getOwnPropertyDescriptor(n, k);
36
- Object.defineProperty(a, k, d.get ? d : {
37
- enumerable: true,
38
- get: function () {
39
- return n[k];
40
- }
41
- });
42
- });
43
- return a;
44
- }
45
-
46
- function commonjsRequire () {
47
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
48
- }
49
-
50
- var loglevel = createCommonjsModule(function (module) {
51
- /*
52
- * loglevel - https://github.com/pimterry/loglevel
53
- *
54
- * Copyright (c) 2013 Tim Perry
55
- * Licensed under the MIT license.
56
- */
57
- (function (root, definition) {
58
- "use strict";
59
- if (typeof undefined === 'function' && undefined.amd) {
60
- undefined(definition);
61
- } else if ('object' === 'object' && module.exports) {
62
- module.exports = definition();
63
- } else {
64
- root.log = definition();
65
- }
66
- }(commonjsGlobal, function () {
67
- "use strict";
68
-
69
- // Slightly dubious tricks to cut down minimized file size
70
- var noop = function() {};
71
- var undefinedType = "undefined";
72
- var isIE = (typeof window !== undefinedType) && (typeof window.navigator !== undefinedType) && (
73
- /Trident\/|MSIE /.test(window.navigator.userAgent)
74
- );
75
-
76
- var logMethods = [
77
- "trace",
78
- "debug",
79
- "info",
80
- "warn",
81
- "error"
82
- ];
83
-
84
- // Cross-browser bind equivalent that works at least back to IE6
85
- function bindMethod(obj, methodName) {
86
- var method = obj[methodName];
87
- if (typeof method.bind === 'function') {
88
- return method.bind(obj);
89
- } else {
90
- try {
91
- return Function.prototype.bind.call(method, obj);
92
- } catch (e) {
93
- // Missing bind shim or IE8 + Modernizr, fallback to wrapping
94
- return function() {
95
- return Function.prototype.apply.apply(method, [obj, arguments]);
96
- };
97
- }
98
- }
99
- }
100
-
101
- // Trace() doesn't print the message in IE, so for that case we need to wrap it
102
- function traceForIE() {
103
- if (console.log) {
104
- if (console.log.apply) {
105
- console.log.apply(console, arguments);
106
- } else {
107
- // In old IE, native console methods themselves don't have apply().
108
- Function.prototype.apply.apply(console.log, [console, arguments]);
109
- }
110
- }
111
- if (console.trace) console.trace();
112
- }
113
-
114
- // Build the best logging method possible for this env
115
- // Wherever possible we want to bind, not wrap, to preserve stack traces
116
- function realMethod(methodName) {
117
- if (methodName === 'debug') {
118
- methodName = 'log';
119
- }
120
-
121
- if (typeof console === undefinedType) {
122
- return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives
123
- } else if (methodName === 'trace' && isIE) {
124
- return traceForIE;
125
- } else if (console[methodName] !== undefined) {
126
- return bindMethod(console, methodName);
127
- } else if (console.log !== undefined) {
128
- return bindMethod(console, 'log');
129
- } else {
130
- return noop;
131
- }
132
- }
133
-
134
- // These private functions always need `this` to be set properly
135
-
136
- function replaceLoggingMethods(level, loggerName) {
137
- /*jshint validthis:true */
138
- for (var i = 0; i < logMethods.length; i++) {
139
- var methodName = logMethods[i];
140
- this[methodName] = (i < level) ?
141
- noop :
142
- this.methodFactory(methodName, level, loggerName);
143
- }
144
-
145
- // Define log.log as an alias for log.debug
146
- this.log = this.debug;
147
- }
148
-
149
- // In old IE versions, the console isn't present until you first open it.
150
- // We build realMethod() replacements here that regenerate logging methods
151
- function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {
152
- return function () {
153
- if (typeof console !== undefinedType) {
154
- replaceLoggingMethods.call(this, level, loggerName);
155
- this[methodName].apply(this, arguments);
156
- }
157
- };
158
- }
159
-
160
- // By default, we use closely bound real methods wherever possible, and
161
- // otherwise we wait for a console to appear, and then try again.
162
- function defaultMethodFactory(methodName, level, loggerName) {
163
- /*jshint validthis:true */
164
- return realMethod(methodName) ||
165
- enableLoggingWhenConsoleArrives.apply(this, arguments);
166
- }
167
-
168
- function Logger(name, defaultLevel, factory) {
169
- var self = this;
170
- var currentLevel;
171
- defaultLevel = defaultLevel == null ? "WARN" : defaultLevel;
172
-
173
- var storageKey = "loglevel";
174
- if (typeof name === "string") {
175
- storageKey += ":" + name;
176
- } else if (typeof name === "symbol") {
177
- storageKey = undefined;
178
- }
179
-
180
- function persistLevelIfPossible(levelNum) {
181
- var levelName = (logMethods[levelNum] || 'silent').toUpperCase();
182
-
183
- if (typeof window === undefinedType || !storageKey) return;
184
-
185
- // Use localStorage if available
186
- try {
187
- window.localStorage[storageKey] = levelName;
188
- return;
189
- } catch (ignore) {}
190
-
191
- // Use session cookie as fallback
192
- try {
193
- window.document.cookie =
194
- encodeURIComponent(storageKey) + "=" + levelName + ";";
195
- } catch (ignore) {}
196
- }
197
-
198
- function getPersistedLevel() {
199
- var storedLevel;
200
-
201
- if (typeof window === undefinedType || !storageKey) return;
202
-
203
- try {
204
- storedLevel = window.localStorage[storageKey];
205
- } catch (ignore) {}
206
-
207
- // Fallback to cookies if local storage gives us nothing
208
- if (typeof storedLevel === undefinedType) {
209
- try {
210
- var cookie = window.document.cookie;
211
- var location = cookie.indexOf(
212
- encodeURIComponent(storageKey) + "=");
213
- if (location !== -1) {
214
- storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1];
215
- }
216
- } catch (ignore) {}
217
- }
218
-
219
- // If the stored level is not valid, treat it as if nothing was stored.
220
- if (self.levels[storedLevel] === undefined) {
221
- storedLevel = undefined;
222
- }
223
-
224
- return storedLevel;
225
- }
226
-
227
- function clearPersistedLevel() {
228
- if (typeof window === undefinedType || !storageKey) return;
229
-
230
- // Use localStorage if available
231
- try {
232
- window.localStorage.removeItem(storageKey);
233
- return;
234
- } catch (ignore) {}
235
-
236
- // Use session cookie as fallback
237
- try {
238
- window.document.cookie =
239
- encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
240
- } catch (ignore) {}
241
- }
242
-
243
- /*
244
- *
245
- * Public logger API - see https://github.com/pimterry/loglevel for details
246
- *
247
- */
248
-
249
- self.name = name;
250
-
251
- self.levels = { "TRACE": 0, "DEBUG": 1, "INFO": 2, "WARN": 3,
252
- "ERROR": 4, "SILENT": 5};
253
-
254
- self.methodFactory = factory || defaultMethodFactory;
255
-
256
- self.getLevel = function () {
257
- return currentLevel;
258
- };
259
-
260
- self.setLevel = function (level, persist) {
261
- if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) {
262
- level = self.levels[level.toUpperCase()];
263
- }
264
- if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {
265
- currentLevel = level;
266
- if (persist !== false) { // defaults to true
267
- persistLevelIfPossible(level);
268
- }
269
- replaceLoggingMethods.call(self, level, name);
270
- if (typeof console === undefinedType && level < self.levels.SILENT) {
271
- return "No console available for logging";
272
- }
273
- } else {
274
- throw "log.setLevel() called with invalid level: " + level;
275
- }
276
- };
277
-
278
- self.setDefaultLevel = function (level) {
279
- defaultLevel = level;
280
- if (!getPersistedLevel()) {
281
- self.setLevel(level, false);
282
- }
283
- };
284
-
285
- self.resetLevel = function () {
286
- self.setLevel(defaultLevel, false);
287
- clearPersistedLevel();
288
- };
289
-
290
- self.enableAll = function(persist) {
291
- self.setLevel(self.levels.TRACE, persist);
292
- };
293
-
294
- self.disableAll = function(persist) {
295
- self.setLevel(self.levels.SILENT, persist);
296
- };
297
-
298
- // Initialize with the right level
299
- var initialLevel = getPersistedLevel();
300
- if (initialLevel == null) {
301
- initialLevel = defaultLevel;
302
- }
303
- self.setLevel(initialLevel, false);
304
- }
305
-
306
- /*
307
- *
308
- * Top-level API
309
- *
310
- */
311
-
312
- var defaultLogger = new Logger();
313
-
314
- var _loggersByName = {};
315
- defaultLogger.getLogger = function getLogger(name) {
316
- if ((typeof name !== "symbol" && typeof name !== "string") || name === "") {
317
- throw new TypeError("You must supply a name when creating a logger.");
318
- }
319
-
320
- var logger = _loggersByName[name];
321
- if (!logger) {
322
- logger = _loggersByName[name] = new Logger(
323
- name, defaultLogger.getLevel(), defaultLogger.methodFactory);
324
- }
325
- return logger;
326
- };
327
-
328
- // Grab the current global log variable in case of overwrite
329
- var _log = (typeof window !== undefinedType) ? window.log : undefined;
330
- defaultLogger.noConflict = function() {
331
- if (typeof window !== undefinedType &&
332
- window.log === defaultLogger) {
333
- window.log = _log;
334
- }
335
-
336
- return defaultLogger;
337
- };
338
-
339
- defaultLogger.getLoggers = function getLoggers() {
340
- return _loggersByName;
341
- };
342
-
343
- // ES6 default export, for compatibility
344
- defaultLogger['default'] = defaultLogger;
345
-
346
- return defaultLogger;
347
- }));
348
- });
349
-
350
- const _breakpoints = ['xs', 's', 'm', 'l', 'xl'];
351
- const Breakpoints = {
352
- xs: '(max-width: 539.98px)',
353
- s: '(max-width: 767.98px)',
354
- m: '(max-width: 991.98px)',
355
- l: '(max-width: 1199.98px)',
356
- xl: '(max-width: 1399.98px)'
357
- };
358
- function isBreakpoint(value) {
359
- return typeof value === 'string' && _breakpoints.includes(value);
360
- }
361
-
362
- // https://github.com/angular/components/blob/master/src/cdk/platform/platform.ts
363
- // Whether the current platform supports the V8 Break Iterator. The V8 check
364
- // is necessary to detect all Blink based browsers.
365
- let hasV8BreakIterator;
366
- // We need a try/catch around the reference to `Intl`, because accessing it in some cases can
367
- // cause IE to throw. These cases are tied to particular versions of Windows and can happen if
368
- // the consumer is providing a polyfilled `Map`. See:
369
- // https://github.com/Microsoft/ChakraCore/issues/3189
370
- // https://github.com/angular/components/issues/15687
371
- try {
372
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
373
- hasV8BreakIterator = typeof Intl !== 'undefined' && Intl.v8BreakIterator;
374
- }
375
- catch (_a) {
376
- hasV8BreakIterator = false;
377
- }
378
- class Platform {
379
- constructor() {
380
- /** Whether the current browser is Microsoft Edge. */
381
- this.EDGE = /(edge)/i.test(navigator.userAgent);
382
- /** Whether the current rendering engine is Microsoft Trident. */
383
- this.TRIDENT = /(msie|trident)/i.test(navigator.userAgent);
384
- // EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.
385
- /** Whether the current rendering engine is Blink. */
386
- this.BLINK =
387
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
388
- !!(window.chrome || hasV8BreakIterator) && typeof CSS !== 'undefined' && !this.EDGE && !this.TRIDENT;
389
- // Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to
390
- // ensure that Webkit runs standalone and is not used as another engine's base.
391
- /** Whether the current rendering engine is WebKit. */
392
- this.WEBKIT = /AppleWebKit/i.test(navigator.userAgent) && !this.BLINK && !this.EDGE && !this.TRIDENT;
393
- /** Whether the current platform is Apple iOS. */
394
- this.IOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !('MSStream' in window);
395
- // It's difficult to detect the plain Gecko engine, because most of the browsers identify
396
- // them self as Gecko-like browsers and modify the userAgent's according to that.
397
- // Since we only cover one explicit Firefox case, we can simply check for Firefox
398
- // instead of having an unstable check for Gecko.
399
- /** Whether the current browser is Firefox. */
400
- this.FIREFOX = /(firefox|minefield)/i.test(navigator.userAgent);
401
- /** Whether the current platform is Android. */
402
- // Trident on mobile adds the android platform to the userAgent to trick detections.
403
- this.ANDROID = /android/i.test(navigator.userAgent) && !this.TRIDENT;
404
- // Safari browsers will include the Safari keyword in their userAgent. Some browsers may fake
405
- // this and just place the Safari keyword in the userAgent. To be more safe about Safari every
406
- // Safari browser should also use Webkit as its layout engine.
407
- /** Whether the current browser is Safari. */
408
- this.SAFARI = /safari/i.test(navigator.userAgent) && this.WEBKIT;
409
- }
410
- }
411
-
412
- // https://github.com/angular/components/blob/master/src/cdk/layout/media-matcher.ts
413
- /** Global registry for all dynamically-created, injected media queries. */
414
- const mediaQueriesForWebkitCompatibility = new Set();
415
- /** Style tag that holds all of the dynamically-created media queries. */
416
- let mediaQueryStyleNode;
417
- /** A utility for calling matchMedia queries. */
418
- class MediaMatcher {
419
- constructor() {
420
- this._platform = new Platform();
421
- this._matchMedia = window.matchMedia.bind(window);
422
- }
423
- /**
424
- * Evaluates the given media query and returns the native MediaQueryList from which results
425
- * can be retrieved.
426
- * Confirms the layout engine will trigger for the selector query provided and returns the
427
- * MediaQueryList for the query provided.
428
- */
429
- matchMedia(query) {
430
- if (this._platform.WEBKIT || this._platform.BLINK) {
431
- createEmptyStyleRule(query);
432
- }
433
- return this._matchMedia(query);
434
- }
435
- }
436
- /**
437
- * Creates an empty stylesheet that is used to work around browser inconsistencies related to
438
- * `matchMedia`. At the time of writing, it handles the following cases:
439
- * 1. On WebKit browsers, a media query has to have at least one rule in order for `matchMedia`
440
- * to fire. We work around it by declaring a dummy stylesheet with a `@media` declaration.
441
- * 2. In some cases Blink browsers will stop firing the `matchMedia` listener if none of the rules
442
- * inside the `@media` match existing elements on the page. We work around it by having one rule
443
- * targeting the `body`. See https://github.com/angular/components/issues/23546.
444
- */
445
- function createEmptyStyleRule(query) {
446
- if (mediaQueriesForWebkitCompatibility.has(query)) {
447
- return;
448
- }
449
- try {
450
- if (!mediaQueryStyleNode) {
451
- mediaQueryStyleNode = document.createElement('style');
452
- mediaQueryStyleNode.setAttribute('type', 'text/css');
453
- document.head.appendChild(mediaQueryStyleNode);
454
- }
455
- if (mediaQueryStyleNode.sheet) {
456
- mediaQueryStyleNode.sheet.insertRule(`@media ${query} {body{ }}`, 0);
457
- mediaQueriesForWebkitCompatibility.add(query);
458
- }
459
- }
460
- catch (e) {
461
- loglevel.error(e);
462
- }
463
- }
464
-
465
- const catButtonCss = ":host{display:inline-block;max-width:100%;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host[hidden]{display:none}.cat-button{font:inherit;display:flex;align-items:center;justify-content:center;border:none;border-radius:0.25rem;text-decoration:none;width:100%;box-sizing:border-box;cursor:pointer;transition:color 0.13s linear, border-color 0.13s linear, background-color 0.13s linear, box-shadow 0.13s linear}.cat-button:focus-visible{outline:2px solid #0071ff;outline-offset:1px}.cat-button-content{flex:1 1 auto;text-align:center}.cat-button-ellipsed .cat-button-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.cat-button-disabled{cursor:not-allowed;opacity:0.65;filter:grayscale(100%)}.cat-button-round{border-radius:10rem}.cat-button-loading{cursor:default}.cat-button-loading cat-spinner{position:absolute}.cat-button-loading>*:not(cat-spinner){visibility:hidden}.cat-button-filled{background-color:rgb(var(--bg));color:rgb(var(--fill));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}.cat-button-outlined{background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--base), 0.2);color:rgb(var(--text))}.cat-button-outlined:hover:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.05)}.cat-button-outlined:active:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-text{background-color:transparent;color:rgb(var(--text));text-decoration:none}.cat-button-text:hover:not(.cat-button-disabled):not(.cat-button-loading){text-decoration:underline}.cat-button-primary{--bg:var(--cat-primary-bg, 32, 127, 138);--fill:var(--cat-primary-fill, 255, 255, 255);--text:var(--cat-primary-text, 32, 127, 138);--base:var(--cat-primary-text, 32, 127, 138)}.cat-button-primary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-hover, 28, 112, 122);--fill:var(--cat-primary-fill-hover, 255, 255, 255);--text:var(--cat-primary-text-hover, 28, 112, 122)}.cat-button-primary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-active, 25, 101, 110);--fill:var(--cat-primary-fill-active, 255, 255, 255);--text:var(--cat-primary-text-active, 25, 101, 110)}.cat-button-secondary{--bg:248, 248, 251;--fill:0, 0, 0;--text:0, 0, 0;--base:248, 248, 251}.cat-button-secondary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:235, 236, 240;--fill:0, 0, 0;--text:0, 0, 0}.cat-button-secondary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:235, 236, 240;--fill:0, 0, 0;--text:0, 0, 0}.cat-button-success{--bg:0, 132, 88;--fill:255, 255, 255;--text:0, 132, 88;--base:0, 132, 88}.cat-button-success:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:0, 117, 78;--fill:255, 255, 255;--text:0, 117, 78}.cat-button-success:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:0, 105, 70;--fill:255, 255, 255;--text:0, 105, 70}.cat-button-warning{--bg:255, 206, 128;--fill:0, 0, 0;--text:159, 97, 0;--base:159, 97, 0}.cat-button-warning:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:255, 214, 148;--fill:0, 0, 0;--text:159, 97, 0}.cat-button-warning:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:255, 222, 168;--fill:0, 0, 0;--text:159, 97, 0}.cat-button-danger{--bg:217, 52, 13;--fill:255, 255, 255;--text:217, 52, 13;--base:217, 52, 13}.cat-button-danger:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:194, 46, 11;--fill:255, 255, 255;--text:194, 46, 11}.cat-button-danger:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:174, 42, 10;--fill:255, 255, 255;--text:174, 42, 10}.cat-button-xs{min-width:1.5rem;padding:0.25rem 0.25rem;font-size:0.875rem;line-height:1rem}.cat-button-xs .cat-button-prefix{margin-right:0.25rem}.cat-button-xs .cat-button-suffix{margin-left:0.25rem}.cat-button-xs.cat-button-icon{width:1.5rem;padding-left:0;padding-right:0}.cat-button-s{min-width:2rem;padding:0.375rem 0.5rem;font-size:0.9375rem;line-height:1.25rem}.cat-button-s .cat-button-prefix{margin-right:0.25rem}.cat-button-s .cat-button-suffix{margin-left:0.25rem}.cat-button-s cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-s.cat-button-icon{width:2rem;padding-left:0;padding-right:0}.cat-button-m{min-width:2.5rem;padding:0.625rem 0.75rem;font-size:0.9375rem;line-height:1.25rem}.cat-button-m .cat-button-prefix{margin-right:0.25rem}.cat-button-m .cat-button-suffix{margin-left:0.25rem}.cat-button-m cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-m.cat-button-icon{width:2.5rem;padding-left:0;padding-right:0}.cat-button-l{min-width:3rem;padding:0.875rem 1rem;font-size:0.9375rem;line-height:1.25rem}.cat-button-l .cat-button-prefix{margin-right:0.25rem}.cat-button-l .cat-button-suffix{margin-left:0.25rem}.cat-button-l cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-l.cat-button-icon{width:3rem;padding-left:0;padding-right:0}.cat-button-xl{min-width:3.5rem;padding:1rem 1.25rem;font-size:1.125rem;line-height:1.5rem}.cat-button-xl .cat-button-prefix{margin-right:0.25rem}.cat-button-xl .cat-button-suffix{margin-left:0.25rem}.cat-button-xl.cat-button-icon{width:3.5rem;padding-left:0;padding-right:0}";
466
-
467
- let CatButton = class {
468
- constructor(hostRef) {
469
- index.registerInstance(this, hostRef);
470
- this.catFocus = index.createEvent(this, "catFocus", 7);
471
- this.catBlur = index.createEvent(this, "catBlur", 7);
472
- this._iconOnly = true;
473
- /**
474
- * The rendering style of the button.
475
- */
476
- this.variant = 'filled';
477
- /**
478
- * The color palette of the button.
479
- */
480
- this.color = 'primary';
481
- /**
482
- * The size of the button.
483
- */
484
- this.size = 'm';
485
- /**
486
- * Specifies that the button should be disabled. A disabled button is unusable
487
- * and un-clickable. Corresponds with the native HTML disabled attribute.
488
- */
489
- this.disabled = false;
490
- /**
491
- * Displays the button in a loading state with a spinner. Just like a disabled
492
- * button, an inactive button is unusable and un-clickable. However, it
493
- * retains the current focus state.
494
- */
495
- this.loading = false;
496
- /**
497
- * Allows the button to submit a form.
498
- */
499
- this.submit = false;
500
- /**
501
- * Ellipse overflowing button content.
502
- */
503
- this.ellipsed = true;
504
- /**
505
- * Use round button edges.
506
- */
507
- this.round = false;
508
- /**
509
- * Hide the actual button content and only display the icon.
510
- */
511
- this.iconOnly = false;
512
- /**
513
- * Display the icon as a suffix.
514
- */
515
- this.iconSuffix = false;
516
- }
517
- onIconOnlyChanged(value) {
518
- var _a, _b;
519
- // teardown
520
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
521
- (_a = this.mediaQueryList) === null || _a === void 0 ? void 0 : _a.removeEventListener('change', this.mediaQueryListener);
522
- this.mediaQueryList = undefined;
523
- this.mediaQueryListener = undefined;
524
- // setup
525
- if (isBreakpoint(value)) {
526
- (_b = this.mediaMatcher) !== null && _b !== void 0 ? _b : (this.mediaMatcher = new MediaMatcher());
527
- this.mediaQueryList = this.mediaMatcher.matchMedia(Breakpoints[value]);
528
- this.mediaQueryListener = (event) => (this._iconOnly = event.matches);
529
- this.mediaQueryList.addEventListener('change', this.mediaQueryListener);
530
- this._iconOnly = this.mediaQueryList.matches;
531
- }
532
- else {
533
- this._iconOnly = value;
534
- }
535
- }
536
- componentWillLoad() {
537
- this.onIconOnlyChanged(this.iconOnly);
538
- }
539
- componentWillRender() {
540
- if (this.isIconButton && !this.a11yLabel) {
541
- loglevel.warn('[A11y] Missing ARIA label on icon button', this);
542
- }
543
- }
544
- haltDisabledEvents(event) {
545
- if (this.disabled || this.loading) {
546
- event.preventDefault();
547
- event.stopImmediatePropagation();
548
- }
549
- }
550
- /**
551
- * Sets focus on the button. Use this method instead of `button.focus()`.
552
- *
553
- * @param options An optional object providing options to control aspects of
554
- * the focusing process.
555
- */
556
- async setFocus(options) {
557
- this.button.focus(options);
558
- }
559
- render() {
560
- var _a;
561
- if (this.url) {
562
- return (index.h("a", { ref: el => (this.button = el), href: this.disabled ? undefined : this.url, target: this.urlTarget, "aria-disabled": this.disabled ? 'true' : null, "aria-label": this.a11yLabel, id: this.buttonId, part: "button", class: {
563
- 'cat-button': true,
564
- 'cat-button-icon': this.isIconButton,
565
- 'cat-button-round': this.round,
566
- 'cat-button-loading': this.loading,
567
- 'cat-button-disabled': this.disabled,
568
- 'cat-button-ellipsed': this.ellipsed && !this.isIconButton,
569
- [`cat-button-${this.variant}`]: Boolean(this.variant),
570
- [`cat-button-${this.color}`]: Boolean(this.color),
571
- [`cat-button-${this.size}`]: Boolean(this.size)
572
- }, onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }, this.content));
573
- }
574
- else {
575
- return (index.h("button", { ref: el => (this.button = el), type: this.submit ? 'submit' : 'button', name: this.name, value: this.value, disabled: this.disabled, "aria-disabled": this.disabled ? 'true' : null, "aria-label": this.a11yLabel, id: this.buttonId, part: "button", class: {
576
- 'cat-button': true,
577
- 'cat-button-icon': this.isIconButton,
578
- 'cat-button-round': (_a = this.round) !== null && _a !== void 0 ? _a : this.isIconButton,
579
- 'cat-button-loading': this.loading,
580
- 'cat-button-disabled': this.disabled,
581
- 'cat-button-ellipsed': this.ellipsed && !this.isIconButton,
582
- [`cat-button-${this.variant}`]: Boolean(this.variant),
583
- [`cat-button-${this.color}`]: Boolean(this.color),
584
- [`cat-button-${this.size}`]: Boolean(this.size)
585
- }, onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }, this.content));
586
- }
587
- }
588
- get iconSize() {
589
- switch (this.size) {
590
- case 'xs':
591
- return 's';
592
- default:
593
- return 'l';
594
- }
595
- }
596
- get spinnerSize() {
597
- switch (this.size) {
598
- case 'xs':
599
- return 'xs';
600
- default:
601
- return 'm';
602
- }
603
- }
604
- get isIconButton() {
605
- return Boolean(this.icon) && this._iconOnly;
606
- }
607
- get hasPrefixIcon() {
608
- return Boolean(this.icon) && !this._iconOnly && !this.iconSuffix;
609
- }
610
- get hasSuffixIcon() {
611
- return Boolean(this.icon) && !this._iconOnly && this.iconSuffix;
612
- }
613
- get content() {
614
- return [
615
- this.hasPrefixIcon ? (index.h("cat-icon", { icon: this.icon, size: this.iconSize, class: "cat-button-prefix", part: "prefix" })) : null,
616
- this.isIconButton ? (index.h("cat-icon", { icon: this.icon, size: this.iconSize })) : (index.h("span", { class: "cat-button-content", part: "content" }, index.h("slot", null))),
617
- this.hasSuffixIcon ? (index.h("cat-icon", { icon: this.icon, size: this.iconSize, class: "cat-button-suffix", part: "suffix" })) : null,
618
- this.loading ? index.h("cat-spinner", { size: this.spinnerSize }) : null
619
- ];
620
- }
621
- onFocus(event) {
622
- this.catFocus.emit(event);
623
- }
624
- onBlur(event) {
625
- this.catBlur.emit(event);
626
- }
627
- static get watchers() { return {
628
- "iconOnly": ["onIconOnlyChanged"]
629
- }; }
630
- };
631
- CatButton.style = catButtonCss;
632
-
633
- exports.cat_button = CatButton;