@haiilo/catalyst 2.5.0 → 3.0.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 (94) hide show
  1. package/dist/catalyst/catalyst.css +2411 -2
  2. package/dist/catalyst/catalyst.esm.js +1 -1
  3. package/dist/catalyst/catalyst.esm.js.map +1 -1
  4. package/dist/catalyst/index.cdn.js +1 -0
  5. package/dist/catalyst/p-1c6eace6.js +3 -0
  6. package/dist/catalyst/p-1c6eace6.js.map +1 -0
  7. package/dist/catalyst/p-d5ac868d.entry.js +10 -0
  8. package/dist/catalyst/p-d5ac868d.entry.js.map +1 -0
  9. package/dist/catalyst/scss/_variables.tokens.scss +2 -2
  10. package/dist/catalyst/scss/core/_dialog.scss +66 -0
  11. package/dist/catalyst/scss/core/_notification.scss +10 -10
  12. package/dist/catalyst/scss/core/_typography.scss +1 -1
  13. package/dist/catalyst/scss/index.scss +1 -0
  14. package/dist/catalyst/scss/utils/_media.mixins.scss +1 -0
  15. package/dist/cjs/cat-alert_24.cjs.entry.js +1361 -43
  16. package/dist/cjs/cat-alert_24.cjs.entry.js.map +1 -1
  17. package/dist/cjs/catalyst.cjs.js +2 -2
  18. package/dist/cjs/{index-e540e911.js → index-22e41d18.js} +1 -4
  19. package/dist/cjs/index-22e41d18.js.map +1 -0
  20. package/dist/cjs/loader.cjs.js +2 -2
  21. package/dist/collection/collection-manifest.json +0 -1
  22. package/dist/collection/components/cat-button/cat-button.js +23 -6
  23. package/dist/collection/components/cat-button/cat-button.js.map +1 -1
  24. package/dist/collection/components/cat-icon/cat-icon.js +21 -9
  25. package/dist/collection/components/cat-icon/cat-icon.js.map +1 -1
  26. package/dist/collection/components/cat-input/cat-input.css +10 -0
  27. package/dist/collection/components/cat-scrollable/cat-scrollable.js +18 -14
  28. package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -1
  29. package/dist/collection/components/cat-textarea/cat-textarea.css +5 -0
  30. package/dist/collection/index.cdn.js +1 -0
  31. package/dist/collection/scss/_variables.tokens.scss +2 -2
  32. package/dist/collection/scss/core/_dialog.scss +66 -0
  33. package/dist/collection/scss/core/_notification.scss +10 -10
  34. package/dist/collection/scss/core/_typography.scss +1 -1
  35. package/dist/collection/scss/index.scss +1 -0
  36. package/dist/collection/scss/utils/_media.mixins.scss +1 -0
  37. package/dist/components/cat-badge.js.map +1 -1
  38. package/dist/components/cat-button2.js +7 -6
  39. package/dist/components/cat-button2.js.map +1 -1
  40. package/dist/components/cat-card.js.map +1 -1
  41. package/dist/components/cat-dropdown2.js +759 -2
  42. package/dist/components/cat-dropdown2.js.map +1 -1
  43. package/dist/components/cat-icon2.js +2 -5
  44. package/dist/components/cat-icon2.js.map +1 -1
  45. package/dist/components/cat-input.js +1 -1
  46. package/dist/components/cat-input.js.map +1 -1
  47. package/dist/components/cat-scrollable2.js +241 -14
  48. package/dist/components/cat-scrollable2.js.map +1 -1
  49. package/dist/components/cat-select-demo.js +2 -2
  50. package/dist/components/cat-select2.js +2 -187
  51. package/dist/components/cat-select2.js.map +1 -1
  52. package/dist/components/cat-textarea.js +1 -1
  53. package/dist/components/cat-textarea.js.map +1 -1
  54. package/dist/components/index.d.ts +0 -1
  55. package/dist/components/index.js +0 -1
  56. package/dist/components/index.js.map +1 -1
  57. package/dist/esm/cat-alert_24.entry.js +1355 -37
  58. package/dist/esm/cat-alert_24.entry.js.map +1 -1
  59. package/dist/esm/catalyst.js +2 -2
  60. package/dist/esm/{index-c2a28ebb.js → index-7b85fb91.js} +1 -4
  61. package/dist/esm/index-7b85fb91.js.map +1 -0
  62. package/dist/esm/loader.js +2 -2
  63. package/dist/types/components/cat-button/cat-button.d.ts +5 -0
  64. package/dist/types/components/cat-icon/cat-icon.d.ts +5 -1
  65. package/dist/types/components/cat-scrollable/cat-scrollable.d.ts +3 -0
  66. package/dist/types/components.d.ts +17 -26
  67. package/package.json +2 -2
  68. package/dist/catalyst/p-2fdb52c9.entry.js +0 -2
  69. package/dist/catalyst/p-2fdb52c9.entry.js.map +0 -1
  70. package/dist/catalyst/p-53a1db22.js +0 -3
  71. package/dist/catalyst/p-53a1db22.js.map +0 -1
  72. package/dist/catalyst/p-5bfc70e3.entry.js +0 -2
  73. package/dist/catalyst/p-5bfc70e3.entry.js.map +0 -1
  74. package/dist/catalyst/p-60a20ebe.js +0 -10
  75. package/dist/catalyst/p-60a20ebe.js.map +0 -1
  76. package/dist/cjs/cat-modal.cjs.entry.js +0 -74
  77. package/dist/cjs/cat-modal.cjs.entry.js.map +0 -1
  78. package/dist/cjs/first-tabbable-7966cf1c.js +0 -1288
  79. package/dist/cjs/first-tabbable-7966cf1c.js.map +0 -1
  80. package/dist/cjs/index-e540e911.js.map +0 -1
  81. package/dist/collection/components/cat-modal/cat-modal.css +0 -65
  82. package/dist/collection/components/cat-modal/cat-modal.js +0 -117
  83. package/dist/collection/components/cat-modal/cat-modal.js.map +0 -1
  84. package/dist/components/cat-modal.d.ts +0 -11
  85. package/dist/components/cat-modal.js +0 -111
  86. package/dist/components/cat-modal.js.map +0 -1
  87. package/dist/components/focus-trap.esm.js +0 -763
  88. package/dist/components/focus-trap.esm.js.map +0 -1
  89. package/dist/esm/cat-modal.entry.js +0 -70
  90. package/dist/esm/cat-modal.entry.js.map +0 -1
  91. package/dist/esm/first-tabbable-4a00de61.js +0 -1284
  92. package/dist/esm/first-tabbable-4a00de61.js.map +0 -1
  93. package/dist/esm/index-c2a28ebb.js.map +0 -1
  94. package/dist/types/components/cat-modal/cat-modal.d.ts +0 -20
@@ -166,20 +166,20 @@ export class CatButton {
166
166
  }
167
167
  }
168
168
  get isIconButton() {
169
- return Boolean(this.icon) && this._iconOnly;
169
+ return (Boolean(this.icon) || Boolean(this.iconSrc)) && this._iconOnly;
170
170
  }
171
171
  get hasPrefixIcon() {
172
- return Boolean(this.icon) && !this._iconOnly && !this.iconRight;
172
+ return (Boolean(this.icon) || Boolean(this.iconSrc)) && !this._iconOnly && !this.iconRight;
173
173
  }
174
174
  get hasSuffixIcon() {
175
- return Boolean(this.icon) && !this._iconOnly && this.iconRight;
175
+ return (Boolean(this.icon) || Boolean(this.iconSrc)) && !this._iconOnly && this.iconRight;
176
176
  }
177
177
  get content() {
178
178
  return [
179
- this.hasPrefixIcon ? h("cat-icon", { icon: this.icon, size: this.iconSize, part: "prefix" }) : null,
180
- this.isIconButton ? (h("cat-icon", { icon: this.icon, size: this.iconSize })) : (h("span", { class: "cat-button-content", part: "content" },
179
+ this.hasPrefixIcon ? (h("cat-icon", { icon: this.icon, iconSrc: this.iconSrc, size: this.iconSize, part: "prefix" })) : null,
180
+ this.isIconButton ? (h("cat-icon", { icon: this.icon, iconSrc: this.iconSrc, size: this.iconSize })) : (h("span", { class: "cat-button-content", part: "content" },
181
181
  h("slot", null))),
182
- this.hasSuffixIcon ? h("cat-icon", { icon: this.icon, size: this.iconSize, part: "suffix" }) : null,
182
+ this.hasSuffixIcon ? (h("cat-icon", { icon: this.icon, iconSrc: this.iconSrc, size: this.iconSize, part: "suffix" })) : null,
183
183
  this.loading ? h("cat-spinner", { size: this.spinnerSize }) : null
184
184
  ];
185
185
  }
@@ -448,6 +448,23 @@ export class CatButton {
448
448
  "attribute": "icon",
449
449
  "reflect": false
450
450
  },
451
+ "iconSrc": {
452
+ "type": "string",
453
+ "mutable": false,
454
+ "complexType": {
455
+ "original": "string",
456
+ "resolved": "string | undefined",
457
+ "references": {}
458
+ },
459
+ "required": false,
460
+ "optional": true,
461
+ "docs": {
462
+ "tags": [],
463
+ "text": "The SVG source of an icon to be displayed in the button. This takes\nprecenedence over the `icon` name."
464
+ },
465
+ "attribute": "icon-src",
466
+ "reflect": false
467
+ },
451
468
  "iconOnly": {
452
469
  "type": "any",
453
470
  "mutable": false,
@@ -1 +1 @@
1
- {"version":3,"file":"cat-button.js","sourceRoot":"","sources":["../../../src/components/cat-button/cat-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,M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il/core';\nimport log from 'loglevel';\nimport { Breakpoint, Breakpoints, isBreakpoint } from '../../utils/breakpoints';\nimport { MediaMatcher } from '../../utils/media-matcher';\n\n/**\n * Buttons are used for interface actions. Primary style should be used only\n * once per view for main call-to-action.\n *\n * @part button - The native anchor or button element.\n * @part content - The textual content of the button.\n * @part prefix - The prefix icon.\n * @part suffix - The suffix icon.\n */\n@Component({\n tag: 'cat-button',\n styleUrl: 'cat-button.scss',\n shadow: true\n})\nexport class CatButton {\n private button!: HTMLButtonElement | HTMLAnchorElement;\n private mediaMatcher?: MediaMatcher;\n private mediaQueryList?: MediaQueryList;\n private mediaQueryListener?: (event: MediaQueryListEvent) => void;\n\n @State() _iconOnly = true;\n\n /**\n * The rendering style of the button.\n */\n @Prop() variant: 'filled' | 'outlined' | 'text' = 'outlined';\n\n /**\n * The color palette of the button.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'secondary';\n\n /**\n * Set the button into an active state.\n */\n @Prop() active = false;\n\n /**\n * The size of the button.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * The name of the button, which gets paired with the button's value when\n * submitted as part of a form. Corresponds with the native HTML name\n * attribute.\n */\n @Prop() name?: string;\n\n /**\n * The value of the button, which gets paired with the button's name when\n * submitted as part of a form. Corresponds with the native HTML value\n * attribute.\n */\n @Prop() value?: string;\n\n /**\n * Specifies that the button should be disabled. A disabled button is unusable\n * and un-clickable. Corresponds with the native HTML disabled attribute.\n */\n @Prop() disabled = false;\n\n /**\n * Displays the button in a loading state with a spinner. Just like a disabled\n * button, an inactive button is unusable and un-clickable. However, it\n * retains the current focus state.\n */\n @Prop() loading = false;\n\n /**\n * Allows the button to submit a form.\n */\n @Prop() submit = false;\n\n /**\n * Disables ellipse overflowing button content.\n */\n @Prop() noEllipsis = false;\n\n /**\n * Use round button edges.\n */\n @Prop() round = false;\n\n /**\n * A destination to link to, rendered in the href attribute of a link.\n */\n @Prop() url?: string;\n\n /**\n * Specifies where to open the linked document.\n */\n @Prop() urlTarget?: '_blank' | '_self';\n\n /**\n * The name of an icon to be displayed in the button.\n */\n @Prop() icon?: string;\n\n /**\n * Hide the actual button content and only display the icon.\n */\n @Prop() iconOnly: boolean | Breakpoint = false;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * Adds a unique identifier for the button. Please note that with this\n * particular component this ID is added inside the web component. If you need\n * an ID on the HTML element, use the regular `id` attribute instead.\n */\n @Prop() buttonId?: string;\n\n /**\n * Adds accessible label for the button that is only shown for screen\n * readers. Typically, this label text replaces the visible text on the\n * button for users who use assistive technology.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n /**\n * Sets the `aria-current` attribute on the button.\n */\n @Prop({ attribute: 'a11y-current' }) a11yCurrent?: string;\n\n @Watch('iconOnly')\n onIconOnlyChanged(value: boolean | Breakpoint): void {\n // teardown\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.mediaQueryList?.removeEventListener('change', this.mediaQueryListener!);\n this.mediaQueryList = undefined;\n this.mediaQueryListener = undefined;\n // setup\n if (isBreakpoint(value)) {\n this.mediaMatcher ??= new MediaMatcher();\n this.mediaQueryList = this.mediaMatcher.matchMedia(Breakpoints[value]);\n this.mediaQueryListener = (event: MediaQueryListEvent) => (this._iconOnly = event.matches);\n this.mediaQueryList.addEventListener('change', this.mediaQueryListener);\n this._iconOnly = this.mediaQueryList.matches;\n } else {\n this._iconOnly = value;\n }\n }\n\n /**\n * Emitted when the button is clicked.\n */\n @Event() catClick!: EventEmitter<MouseEvent>;\n\n /**\n * Emitted when the button received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the button loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillLoad(): void {\n this.onIconOnlyChanged(this.iconOnly);\n }\n\n componentWillRender(): void {\n if (this.isIconButton && !this.a11yLabel) {\n log.warn('[A11y] Missing ARIA label on icon button', this);\n }\n }\n\n @Listen('click')\n haltDisabledEvents(event: Event): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n /**\n * Programmatically move focus to the button. Use this method instead of\n * `button.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async doFocus(options?: FocusOptions): Promise<void> {\n this.button.focus(options);\n }\n\n /**\n * Programmatically remove focus from the button. Use this method instead of\n * `button.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.button.blur();\n }\n\n /**\n * Programmatically simulate a click on the button.\n */\n @Method()\n async doClick(): Promise<void> {\n this.button.click();\n }\n\n render() {\n if (this.url) {\n return (\n <a\n ref={el => (this.button = el as HTMLAnchorElement)}\n href={this.disabled ? undefined : this.url}\n target={this.urlTarget}\n aria-disabled={this.disabled ? 'true' : null}\n aria-label={this.a11yLabel}\n aria-current={this.a11yCurrent}\n id={this.buttonId}\n part=\"button\"\n class={{\n 'cat-button': true,\n 'cat-button-active': this.active,\n 'cat-button-icon': this.isIconButton,\n 'cat-button-round': this.round,\n 'cat-button-loading': this.loading,\n 'cat-button-disabled': this.disabled,\n 'cat-button-ellipsed': !this.noEllipsis && !this.isIconButton,\n [`cat-button-${this.variant}`]: Boolean(this.variant),\n [`cat-button-${this.color}`]: Boolean(this.color),\n [`cat-button-${this.size}`]: Boolean(this.size)\n }}\n onClick={this.onClick.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n >\n {this.content}\n </a>\n );\n } else {\n return (\n <button\n ref={el => (this.button = el as HTMLButtonElement)}\n type={this.submit ? 'submit' : 'button'}\n name={this.name}\n value={this.value}\n disabled={this.disabled}\n aria-disabled={this.disabled ? 'true' : null}\n aria-label={this.a11yLabel}\n aria-current={this.a11yCurrent}\n id={this.buttonId}\n part=\"button\"\n class={{\n 'cat-button': true,\n 'cat-button-active': this.active,\n 'cat-button-icon': this.isIconButton,\n 'cat-button-round': this.round ?? this.isIconButton,\n 'cat-button-loading': this.loading,\n 'cat-button-disabled': this.disabled,\n 'cat-button-ellipsed': !this.noEllipsis && !this.isIconButton,\n [`cat-button-${this.variant}`]: Boolean(this.variant),\n [`cat-button-${this.color}`]: Boolean(this.color),\n [`cat-button-${this.size}`]: Boolean(this.size)\n }}\n onClick={this.onClick.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n >\n {this.content}\n </button>\n );\n }\n }\n\n private get iconSize(): 'xs' | 's' | 'm' | 'l' | 'xl' {\n switch (this.size) {\n case 'xs':\n return 's';\n default:\n return 'l';\n }\n }\n\n private get spinnerSize(): 'xs' | 's' | 'm' | 'l' | 'xl' {\n switch (this.size) {\n case 'xs':\n return 'xs';\n default:\n return 'm';\n }\n }\n\n private get isIconButton() {\n return Boolean(this.icon) && this._iconOnly;\n }\n\n private get hasPrefixIcon() {\n return Boolean(this.icon) && !this._iconOnly && !this.iconRight;\n }\n\n private get hasSuffixIcon() {\n return Boolean(this.icon) && !this._iconOnly && this.iconRight;\n }\n\n private get content() {\n return [\n this.hasPrefixIcon ? <cat-icon icon={this.icon} size={this.iconSize} part=\"prefix\"></cat-icon> : null,\n this.isIconButton ? (\n <cat-icon icon={this.icon} size={this.iconSize}></cat-icon>\n ) : (\n <span class=\"cat-button-content\" part=\"content\">\n <slot></slot>\n </span>\n ),\n this.hasSuffixIcon ? <cat-icon icon={this.icon} size={this.iconSize} part=\"suffix\"></cat-icon> : null,\n this.loading ? <cat-spinner size={this.spinnerSize}></cat-spinner> : null\n ];\n }\n\n private onClick(event: MouseEvent) {\n this.catClick.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
1
+ {"version":3,"file":"cat-button.js","sourceRoot":"","sources":["../../../src/components/cat-button/cat-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, h, Listen, Method, Prop, State, Watch } from '@stencil/core';\nimport log from 'loglevel';\nimport { Breakpoint, Breakpoints, isBreakpoint } from '../../utils/breakpoints';\nimport { MediaMatcher } from '../../utils/media-matcher';\n\n/**\n * Buttons are used for interface actions. Primary style should be used only\n * once per view for main call-to-action.\n *\n * @part button - The native anchor or button element.\n * @part content - The textual content of the button.\n * @part prefix - The prefix icon.\n * @part suffix - The suffix icon.\n */\n@Component({\n tag: 'cat-button',\n styleUrl: 'cat-button.scss',\n shadow: true\n})\nexport class CatButton {\n private button!: HTMLButtonElement | HTMLAnchorElement;\n private mediaMatcher?: MediaMatcher;\n private mediaQueryList?: MediaQueryList;\n private mediaQueryListener?: (event: MediaQueryListEvent) => void;\n\n @State() _iconOnly = true;\n\n /**\n * The rendering style of the button.\n */\n @Prop() variant: 'filled' | 'outlined' | 'text' = 'outlined';\n\n /**\n * The color palette of the button.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'secondary';\n\n /**\n * Set the button into an active state.\n */\n @Prop() active = false;\n\n /**\n * The size of the button.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * The name of the button, which gets paired with the button's value when\n * submitted as part of a form. Corresponds with the native HTML name\n * attribute.\n */\n @Prop() name?: string;\n\n /**\n * The value of the button, which gets paired with the button's name when\n * submitted as part of a form. Corresponds with the native HTML value\n * attribute.\n */\n @Prop() value?: string;\n\n /**\n * Specifies that the button should be disabled. A disabled button is unusable\n * and un-clickable. Corresponds with the native HTML disabled attribute.\n */\n @Prop() disabled = false;\n\n /**\n * Displays the button in a loading state with a spinner. Just like a disabled\n * button, an inactive button is unusable and un-clickable. However, it\n * retains the current focus state.\n */\n @Prop() loading = false;\n\n /**\n * Allows the button to submit a form.\n */\n @Prop() submit = false;\n\n /**\n * Disables ellipse overflowing button content.\n */\n @Prop() noEllipsis = false;\n\n /**\n * Use round button edges.\n */\n @Prop() round = false;\n\n /**\n * A destination to link to, rendered in the href attribute of a link.\n */\n @Prop() url?: string;\n\n /**\n * Specifies where to open the linked document.\n */\n @Prop() urlTarget?: '_blank' | '_self';\n\n /**\n * The name of an icon to be displayed in the button.\n */\n @Prop() icon?: string;\n\n /**\n * The SVG source of an icon to be displayed in the button. This takes\n * precenedence over the `icon` name.\n */\n @Prop() iconSrc?: string;\n\n /**\n * Hide the actual button content and only display the icon.\n */\n @Prop() iconOnly: boolean | Breakpoint = false;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * Adds a unique identifier for the button. Please note that with this\n * particular component this ID is added inside the web component. If you need\n * an ID on the HTML element, use the regular `id` attribute instead.\n */\n @Prop() buttonId?: string;\n\n /**\n * Adds accessible label for the button that is only shown for screen\n * readers. Typically, this label text replaces the visible text on the\n * button for users who use assistive technology.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n /**\n * Sets the `aria-current` attribute on the button.\n */\n @Prop({ attribute: 'a11y-current' }) a11yCurrent?: string;\n\n @Watch('iconOnly')\n onIconOnlyChanged(value: boolean | Breakpoint): void {\n // teardown\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.mediaQueryList?.removeEventListener('change', this.mediaQueryListener!);\n this.mediaQueryList = undefined;\n this.mediaQueryListener = undefined;\n // setup\n if (isBreakpoint(value)) {\n this.mediaMatcher ??= new MediaMatcher();\n this.mediaQueryList = this.mediaMatcher.matchMedia(Breakpoints[value]);\n this.mediaQueryListener = (event: MediaQueryListEvent) => (this._iconOnly = event.matches);\n this.mediaQueryList.addEventListener('change', this.mediaQueryListener);\n this._iconOnly = this.mediaQueryList.matches;\n } else {\n this._iconOnly = value;\n }\n }\n\n /**\n * Emitted when the button is clicked.\n */\n @Event() catClick!: EventEmitter<MouseEvent>;\n\n /**\n * Emitted when the button received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the button loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillLoad(): void {\n this.onIconOnlyChanged(this.iconOnly);\n }\n\n componentWillRender(): void {\n if (this.isIconButton && !this.a11yLabel) {\n log.warn('[A11y] Missing ARIA label on icon button', this);\n }\n }\n\n @Listen('click')\n haltDisabledEvents(event: Event): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n /**\n * Programmatically move focus to the button. Use this method instead of\n * `button.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async doFocus(options?: FocusOptions): Promise<void> {\n this.button.focus(options);\n }\n\n /**\n * Programmatically remove focus from the button. Use this method instead of\n * `button.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.button.blur();\n }\n\n /**\n * Programmatically simulate a click on the button.\n */\n @Method()\n async doClick(): Promise<void> {\n this.button.click();\n }\n\n render() {\n if (this.url) {\n return (\n <a\n ref={el => (this.button = el as HTMLAnchorElement)}\n href={this.disabled ? undefined : this.url}\n target={this.urlTarget}\n aria-disabled={this.disabled ? 'true' : null}\n aria-label={this.a11yLabel}\n aria-current={this.a11yCurrent}\n id={this.buttonId}\n part=\"button\"\n class={{\n 'cat-button': true,\n 'cat-button-active': this.active,\n 'cat-button-icon': this.isIconButton,\n 'cat-button-round': this.round,\n 'cat-button-loading': this.loading,\n 'cat-button-disabled': this.disabled,\n 'cat-button-ellipsed': !this.noEllipsis && !this.isIconButton,\n [`cat-button-${this.variant}`]: Boolean(this.variant),\n [`cat-button-${this.color}`]: Boolean(this.color),\n [`cat-button-${this.size}`]: Boolean(this.size)\n }}\n onClick={this.onClick.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n >\n {this.content}\n </a>\n );\n } else {\n return (\n <button\n ref={el => (this.button = el as HTMLButtonElement)}\n type={this.submit ? 'submit' : 'button'}\n name={this.name}\n value={this.value}\n disabled={this.disabled}\n aria-disabled={this.disabled ? 'true' : null}\n aria-label={this.a11yLabel}\n aria-current={this.a11yCurrent}\n id={this.buttonId}\n part=\"button\"\n class={{\n 'cat-button': true,\n 'cat-button-active': this.active,\n 'cat-button-icon': this.isIconButton,\n 'cat-button-round': this.round ?? this.isIconButton,\n 'cat-button-loading': this.loading,\n 'cat-button-disabled': this.disabled,\n 'cat-button-ellipsed': !this.noEllipsis && !this.isIconButton,\n [`cat-button-${this.variant}`]: Boolean(this.variant),\n [`cat-button-${this.color}`]: Boolean(this.color),\n [`cat-button-${this.size}`]: Boolean(this.size)\n }}\n onClick={this.onClick.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n >\n {this.content}\n </button>\n );\n }\n }\n\n private get iconSize(): 'xs' | 's' | 'm' | 'l' | 'xl' {\n switch (this.size) {\n case 'xs':\n return 's';\n default:\n return 'l';\n }\n }\n\n private get spinnerSize(): 'xs' | 's' | 'm' | 'l' | 'xl' {\n switch (this.size) {\n case 'xs':\n return 'xs';\n default:\n return 'm';\n }\n }\n\n private get isIconButton() {\n return (Boolean(this.icon) || Boolean(this.iconSrc)) && this._iconOnly;\n }\n\n private get hasPrefixIcon() {\n return (Boolean(this.icon) || Boolean(this.iconSrc)) && !this._iconOnly && !this.iconRight;\n }\n\n private get hasSuffixIcon() {\n return (Boolean(this.icon) || Boolean(this.iconSrc)) && !this._iconOnly && this.iconRight;\n }\n\n private get content() {\n return [\n this.hasPrefixIcon ? (\n <cat-icon icon={this.icon} iconSrc={this.iconSrc} size={this.iconSize} part=\"prefix\"></cat-icon>\n ) : null,\n this.isIconButton ? (\n <cat-icon icon={this.icon} iconSrc={this.iconSrc} size={this.iconSize}></cat-icon>\n ) : (\n <span class=\"cat-button-content\" part=\"content\">\n <slot></slot>\n </span>\n ),\n this.hasSuffixIcon ? (\n <cat-icon icon={this.icon} iconSrc={this.iconSrc} size={this.iconSize} part=\"suffix\"></cat-icon>\n ) : null,\n this.loading ? <cat-spinner size={this.spinnerSize}></cat-spinner> : null\n ];\n }\n\n private onClick(event: MouseEvent) {\n this.catClick.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
@@ -8,17 +8,13 @@ import { catIconRegistry as icons } from './cat-icon-registry';
8
8
  */
9
9
  export class CatIcon {
10
10
  constructor() {
11
- /**
12
- * The name of the icon.
13
- */
14
- this.icon = '';
15
11
  /**
16
12
  * The size of the icon.
17
13
  */
18
14
  this.size = 'm';
19
15
  }
20
16
  render() {
21
- return (h("span", { innerHTML: icons.getIcon(this.icon), "aria-label": this.a11yLabel, "aria-hidden": this.a11yLabel ? null : 'true', part: "icon", class: {
17
+ return (h("span", { innerHTML: this.iconSrc || (this.icon ? icons.getIcon(this.icon) : ''), "aria-label": this.a11yLabel, "aria-hidden": this.a11yLabel ? null : 'true', part: "icon", class: {
22
18
  icon: true,
23
19
  [`icon-${this.size}`]: this.size !== 'inline'
24
20
  } }));
@@ -37,18 +33,34 @@ export class CatIcon {
37
33
  "mutable": false,
38
34
  "complexType": {
39
35
  "original": "string",
40
- "resolved": "string",
36
+ "resolved": "string | undefined",
41
37
  "references": {}
42
38
  },
43
39
  "required": false,
44
- "optional": false,
40
+ "optional": true,
45
41
  "docs": {
46
42
  "tags": [],
47
43
  "text": "The name of the icon."
48
44
  },
49
45
  "attribute": "icon",
50
- "reflect": false,
51
- "defaultValue": "''"
46
+ "reflect": false
47
+ },
48
+ "iconSrc": {
49
+ "type": "string",
50
+ "mutable": false,
51
+ "complexType": {
52
+ "original": "string",
53
+ "resolved": "string | undefined",
54
+ "references": {}
55
+ },
56
+ "required": false,
57
+ "optional": true,
58
+ "docs": {
59
+ "tags": [],
60
+ "text": "The SVG source of the icon. This takes precenedence over the `icon` name."
61
+ },
62
+ "attribute": "icon-src",
63
+ "reflect": false
52
64
  },
53
65
  "size": {
54
66
  "type": "string",
@@ -1 +1 @@
1
- {"version":3,"file":"cat-icon.js","sourceRoot":"","sources":["../../../src/components/cat-icon/cat-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,eAAe,IAAI,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;;;;GAKG;AAMH,MAAM,OAAO,OAAO;EALpB;IAME;;OAEG;IACK,SAAI,GAAG,EAAE,CAAC;IAElB;;OAEG;IACK,SAAI,GAA6C,GAAG,CAAC;GAsB9D;EAdC,MAAM;IACJ,OAAO,CACL,YACE,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,gBACvB,IAAI,CAAC,SAAS,iBACb,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAC3C,IAAI,EAAC,MAAM,EACX,KAAK,EAAE;QACL,IAAI,EAAE,IAAI;QACV,CAAC,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,KAAK,QAAQ;OAC9C,GACK,CACT,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop } from '@stencil/core';\nimport { catIconRegistry as icons } from './cat-icon-registry';\n\n/**\n * Icons are used to provide additional meaning or in places where text label\n * doesn't fit.\n *\n * @part icon - The span element wrapping the SVG icon.\n */\n@Component({\n tag: 'cat-icon',\n styleUrl: 'cat-icon.scss',\n shadow: true\n})\nexport class CatIcon {\n /**\n * The name of the icon.\n */\n @Prop() icon = '';\n\n /**\n * The size of the icon.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' | 'inline' = 'm';\n\n /**\n * Adds accessible label for the icon that is only shown for screen\n * readers. The `aria-hidden` attribute will be set if no label is present.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n render() {\n return (\n <span\n innerHTML={icons.getIcon(this.icon)}\n aria-label={this.a11yLabel}\n aria-hidden={this.a11yLabel ? null : 'true'}\n part=\"icon\"\n class={{\n icon: true,\n [`icon-${this.size}`]: this.size !== 'inline'\n }}\n ></span>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"cat-icon.js","sourceRoot":"","sources":["../../../src/components/cat-icon/cat-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,eAAe,IAAI,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;;;;GAKG;AAMH,MAAM,OAAO,OAAO;EALpB;IAgBE;;OAEG;IACK,SAAI,GAA6C,GAAG,CAAC;GAsB9D;EAdC,MAAM;IACJ,OAAO,CACL,YACE,SAAS,EAAE,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,gBAC1D,IAAI,CAAC,SAAS,iBACb,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAC3C,IAAI,EAAC,MAAM,EACX,KAAK,EAAE;QACL,IAAI,EAAE,IAAI;QACV,CAAC,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,KAAK,QAAQ;OAC9C,GACK,CACT,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop } from '@stencil/core';\nimport { catIconRegistry as icons } from './cat-icon-registry';\n\n/**\n * Icons are used to provide additional meaning or in places where text label\n * doesn't fit.\n *\n * @part icon - The span element wrapping the SVG icon.\n */\n@Component({\n tag: 'cat-icon',\n styleUrl: 'cat-icon.scss',\n shadow: true\n})\nexport class CatIcon {\n /**\n * The name of the icon.\n */\n @Prop() icon?: string;\n\n /**\n * The SVG source of the icon. This takes precenedence over the `icon` name.\n */\n @Prop() iconSrc?: string;\n\n /**\n * The size of the icon.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' | 'inline' = 'm';\n\n /**\n * Adds accessible label for the icon that is only shown for screen\n * readers. The `aria-hidden` attribute will be set if no label is present.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n render() {\n return (\n <span\n innerHTML={this.iconSrc || (this.icon ? icons.getIcon(this.icon) : '')}\n aria-label={this.a11yLabel}\n aria-hidden={this.a11yLabel ? null : 'true'}\n part=\"icon\"\n class={{\n icon: true,\n [`icon-${this.size}`]: this.size !== 'inline'\n }}\n ></span>\n );\n }\n}\n"]}
@@ -42,6 +42,8 @@
42
42
  border-radius: var(--cat-border-radius-m, 0.25rem);
43
43
  box-shadow: 0 0 0 1px rgb(var(--cat-border-color-dark, 215, 219, 224));
44
44
  transition: box-shadow 0.13s linear;
45
+ /* stylelint-disable property-no-vendor-prefix */
46
+ /* stylelint-enable property-no-vendor-prefix */
45
47
  }
46
48
  .input-wrapper.input-round {
47
49
  border-radius: 10rem;
@@ -57,6 +59,9 @@
57
59
  .input-wrapper:not(.input-disabled):focus-within {
58
60
  outline: 2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));
59
61
  }
62
+ .input-wrapper:has(input:-webkit-autofill), .input-wrapper:has(input:-webkit-autofill):hover, .input-wrapper:has(input:-webkit-autofill):focus {
63
+ background-color: #e8f0fe;
64
+ }
60
65
 
61
66
  :host(.cat-error) .input-wrapper {
62
67
  box-shadow: 0 0 0 1px rgb(var(--cat-danger-bg, 217, 52, 13));
@@ -130,6 +135,8 @@ input {
130
135
  border: none;
131
136
  outline: none;
132
137
  background: none;
138
+ /* stylelint-disable property-no-vendor-prefix */
139
+ /* stylelint-enable property-no-vendor-prefix */
133
140
  }
134
141
  .input-disabled input {
135
142
  cursor: not-allowed;
@@ -141,6 +148,9 @@ input.has-clearable {
141
148
  input::placeholder {
142
149
  color: rgb(var(--cat-font-color-muted, 105, 118, 135));
143
150
  }
151
+ input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
152
+ -webkit-box-shadow: 0 0 0 9999px #e8f0fe inset;
153
+ }
144
154
 
145
155
  .clearable {
146
156
  position: absolute;
@@ -1,6 +1,6 @@
1
1
  import { Component, Event, h, Prop } from '@stencil/core';
2
2
  import { fromEvent, merge, Subject } from 'rxjs';
3
- import { distinctUntilChanged, filter, map, takeUntil } from 'rxjs/operators';
3
+ import { auditTime, distinctUntilChanged, filter, map, takeUntil } from 'rxjs/operators';
4
4
  /**
5
5
  * An element to display scrollable content.
6
6
  */
@@ -8,6 +8,8 @@ export class CatScrollable {
8
8
  constructor() {
9
9
  this.init = new Subject();
10
10
  this.destroyed = new Subject();
11
+ this.resizedEntries = new Subject();
12
+ this.resizedObserver = new ResizeObserver(entries => this.resizedEntries.next(entries));
11
13
  /** Flags to disable/enable scroll shadowX. */
12
14
  this.noShadowX = false;
13
15
  /** Flags to disable/enable scroll shadowY. */
@@ -30,13 +32,17 @@ export class CatScrollable {
30
32
  componentDidRender() {
31
33
  if (this.scrollElement) {
32
34
  this.scrolled = fromEvent(this.scrollElement, 'scroll').pipe(takeUntil(this.destroyed));
35
+ this.resizedObserver.observe(this.scrollElement);
33
36
  }
34
- this.attachEmitter('left', this.scrolledLeft, this.scrolledBuffer);
35
- this.attachEmitter('right', this.scrolledRight, this.scrolledBuffer);
36
- this.attachEmitter('bottom', this.scrolledBottom, this.scrolledBuffer);
37
- this.attachEmitter('top', this.scrolledTop, this.scrolledBuffer);
38
- merge(this.init, this.scrolled)
39
- .pipe(map(() => ({
37
+ if (this.scrollWrapperElement) {
38
+ this.resizedObserver.observe(this.scrollWrapperElement);
39
+ }
40
+ this.attachEmitter('left', this.scrolledLeft);
41
+ this.attachEmitter('right', this.scrolledRight);
42
+ this.attachEmitter('bottom', this.scrolledBottom);
43
+ this.attachEmitter('top', this.scrolledTop);
44
+ merge(this.init, this.scrolled, this.resizedEntries)
45
+ .pipe(auditTime(CatScrollable.THROTTLE), map(() => ({
40
46
  top: this.getScrollOffset('top') > 0,
41
47
  left: this.getScrollOffset('left') > 0,
42
48
  right: this.getScrollOffset('right') > 0,
@@ -58,6 +64,7 @@ export class CatScrollable {
58
64
  this.init.complete();
59
65
  this.destroyed.next();
60
66
  this.destroyed.complete();
67
+ this.resizedObserver.disconnect();
61
68
  }
62
69
  render() {
63
70
  return [
@@ -75,13 +82,9 @@ export class CatScrollable {
75
82
  h("slot", null))
76
83
  ];
77
84
  }
78
- attachEmitter(from, emitter, buffer) {
79
- merge(this.init, this.scrolled)
80
- .pipe(map(() => this.getScrollOffset(from)))
81
- .pipe(map(offset => offset <= buffer))
82
- .pipe(distinctUntilChanged())
83
- .pipe(filter(isLower => isLower))
84
- .pipe(takeUntil(this.destroyed))
85
+ attachEmitter(from, emitter) {
86
+ merge(this.init, this.scrolled, this.resizedEntries)
87
+ .pipe(auditTime(CatScrollable.THROTTLE), map(() => this.getScrollOffset(from)), map(offset => offset <= this.scrolledBuffer), distinctUntilChanged(), filter(isLower => isLower), takeUntil(this.destroyed))
85
88
  .subscribe(() => emitter.emit());
86
89
  }
87
90
  getScrollOffset(from) {
@@ -308,4 +311,5 @@ export class CatScrollable {
308
311
  }
309
312
  }]; }
310
313
  }
314
+ CatScrollable.THROTTLE = 50;
311
315
  //# sourceMappingURL=cat-scrollable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cat-scrollable.js","sourceRoot":"","sources":["../../../src/components/cat-scrollable/cat-scrollable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAc,OAAO,EAAE,MAAM,MAAM,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE9E;;GAEG;AAMH,MAAM,OAAO,aAAa;EAL1B;IAQmB,SAAI,GAAG,IAAI,OAAO,EAAQ,CAAC;IAC3B,cAAS,GAAG,IAAI,OAAO,EAAQ,CAAC;IAGjD,8CAA8C;IAE9C,cAAS,GAAG,KAAK,CAAC;IAElB,8CAA8C;IAE9C,cAAS,GAAG,KAAK,CAAC;IAElB,yCAAyC;IAEzC,gBAAW,GAAG,KAAK,CAAC;IAEpB,yCAAyC;IAEzC,gBAAW,GAAG,KAAK,CAAC;IAEpB,kDAAkD;IAElD,iBAAY,GAAG,KAAK,CAAC;IAErB;;OAEG;IACK,mBAAc,GAAG,KAAK,CAAC;IAE/B;;OAEG;IACK,mBAAc,GAAG,CAAC,CAAC;GAsH5B;EAhGC,kBAAkB;IAChB,IAAI,IAAI,CAAC,aAAa,EAAE;MACtB,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;KACzF;IACD,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACnE,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,cAAc,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component, Event, EventEmitter, h, Prop } from '@stencil/core';\nimport { fromEvent, merge, Observable, Subject } from 'rxjs';\nimport { distinctUntilChanged, filter, map, takeUntil } from 'rxjs/operators';\n\n/**\n * An element to display scrollable content.\n */\n@Component({\n tag: 'cat-scrollable',\n styleUrl: 'cat-scrollable.scss',\n shadow: true\n})\nexport class CatScrollable {\n scrollElement?: HTMLElement;\n scrollWrapperElement?: HTMLElement;\n private readonly init = new Subject<void>();\n private readonly destroyed = new Subject<void>();\n private scrolled!: Observable<Event>;\n\n /** Flags to disable/enable scroll shadowX. */\n @Prop()\n noShadowX = false;\n\n /** Flags to disable/enable scroll shadowY. */\n @Prop()\n noShadowY = false;\n\n /** Flags to disable/enable overflowX. */\n @Prop()\n noOverflowX = false;\n\n /** Flags to disable/enable overflowY. */\n @Prop()\n noOverflowY = false;\n\n /** Flag to disable/enable overscroll behavior. */\n @Prop()\n noOverscroll = false;\n\n /**\n * Flag to not fire an initial event after content initialization.\n */\n @Prop() noScrolledInit = false;\n\n /**\n * Buffer to be used to calculate the scroll distance.\n */\n @Prop() scrolledBuffer = 0;\n\n /**\n * Emitted when the content is fully scrolled to the top.\n */\n @Event() scrolledTop!: EventEmitter<void>;\n\n /**\n * Emitted when the content is fully scrolled to the left.\n */\n @Event() scrolledLeft!: EventEmitter<void>;\n\n /**\n * Emitted when the content is fully scrolled to the right.\n */\n @Event() scrolledRight!: EventEmitter<void>;\n\n /**\n * Emitted when the content is fully scrolled to the bottom.\n */\n @Event() scrolledBottom!: EventEmitter<void>;\n\n componentDidRender() {\n if (this.scrollElement) {\n this.scrolled = fromEvent(this.scrollElement, 'scroll').pipe(takeUntil(this.destroyed));\n }\n this.attachEmitter('left', this.scrolledLeft, this.scrolledBuffer);\n this.attachEmitter('right', this.scrolledRight, this.scrolledBuffer);\n this.attachEmitter('bottom', this.scrolledBottom, this.scrolledBuffer);\n this.attachEmitter('top', this.scrolledTop, this.scrolledBuffer);\n merge(this.init, this.scrolled)\n .pipe(\n map(() => ({\n top: this.getScrollOffset('top') > 0,\n left: this.getScrollOffset('left') > 0,\n right: this.getScrollOffset('right') > 0,\n bottom: this.getScrollOffset('bottom') > 0\n })),\n distinctUntilChanged(),\n takeUntil(this.destroyed)\n )\n .subscribe(({ top, left, right, bottom }) => {\n this.toggleClass('cat-scrollable-top', top);\n this.toggleClass('cat-scrollable-left', left);\n this.toggleClass('cat-scrollable-right', right);\n this.toggleClass('cat-scrollable-bottom', bottom);\n });\n }\n\n componentDidLoad() {\n if (!this.noScrolledInit) {\n this.init.next();\n }\n }\n\n disconnectedCallback() {\n this.init.complete();\n this.destroyed.next();\n this.destroyed.complete();\n }\n\n render() {\n return [\n <div class=\"scrollable-wrapper\" ref={el => (this.scrollWrapperElement = el)}>\n {!this.noShadowY && <div class=\"shadow-top\"></div>}\n {!this.noShadowX && <div class=\"shadow-left\"></div>}\n {!this.noShadowX && <div class=\"shadow-right\"></div>}\n {!this.noShadowY && <div class=\"shadow-bottom\"></div>}\n </div>,\n <div\n ref={el => (this.scrollElement = el)}\n class={{\n 'scrollable-content': true,\n 'scroll-x': !this.noOverflowX,\n 'scroll-y': !this.noOverflowY,\n 'no-overscroll': this.noOverscroll\n }}\n >\n <slot></slot>\n </div>\n ];\n }\n\n private attachEmitter(from: 'top' | 'left' | 'right' | 'bottom', emitter: EventEmitter<void>, buffer: number) {\n merge(this.init, this.scrolled)\n .pipe(map(() => this.getScrollOffset(from)))\n .pipe(map(offset => offset <= buffer))\n .pipe(distinctUntilChanged())\n .pipe(filter(isLower => isLower))\n .pipe(takeUntil(this.destroyed))\n .subscribe(() => emitter.emit());\n }\n\n private getScrollOffset(from: 'top' | 'left' | 'right' | 'bottom') {\n if (this.scrollElement) {\n switch (from) {\n case 'top':\n return this.scrollElement.scrollTop;\n case 'left':\n return this.scrollElement.scrollLeft;\n case 'right':\n return this.scrollElement.scrollWidth - this.scrollElement.clientWidth - this.scrollElement.scrollLeft;\n case 'bottom':\n return this.scrollElement.scrollHeight - this.scrollElement.clientHeight - this.scrollElement.scrollTop;\n default:\n return 0;\n }\n }\n return 0;\n }\n\n private toggleClass(name: string, value: boolean) {\n if (value) {\n this.scrollWrapperElement?.classList.add(name);\n } else {\n this.scrollWrapperElement?.classList.remove(name);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"cat-scrollable.js","sourceRoot":"","sources":["../../../src/components/cat-scrollable/cat-scrollable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAc,OAAO,EAAE,MAAM,MAAM,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEzF;;GAEG;AAMH,MAAM,OAAO,aAAa;EAL1B;IASmB,SAAI,GAAG,IAAI,OAAO,EAAQ,CAAC;IAC3B,cAAS,GAAG,IAAI,OAAO,EAAQ,CAAC;IAChC,mBAAc,GAAG,IAAI,OAAO,EAAyB,CAAC;IACtD,oBAAe,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAGpG,8CAA8C;IAE9C,cAAS,GAAG,KAAK,CAAC;IAElB,8CAA8C;IAE9C,cAAS,GAAG,KAAK,CAAC;IAElB,yCAAyC;IAEzC,gBAAW,GAAG,KAAK,CAAC;IAEpB,yCAAyC;IAEzC,gBAAW,GAAG,KAAK,CAAC;IAEpB,kDAAkD;IAElD,iBAAY,GAAG,KAAK,CAAC;IAErB;;OAEG;IACK,mBAAc,GAAG,KAAK,CAAC;IAE/B;;OAEG;IACK,mBAAc,GAAG,CAAC,CAAC;GA+H5B;EAzGC,kBAAkB;IAChB,IAAI,IAAI,CAAC,aAAa,EAAE;MACtB,IAAI,CAAC,QAAQ,GAAG,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O,WAAW,CAAC,IAAY,EAAE,KAAc;;IAC9C,IAAI,KAAK,EAAE;MACT,MAAA,IAAI,CAAC,oBAAoB,0CAAE,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KAChD;SAAM;MACL,MAAA,IAAI,CAAC,oBAAoB,0CAAE,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACnD;EACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAnKuB,sBAAQ,GAAG,EAAG,CAAA","sourcesContent":["import { Component, Event, EventEmitter, h, Prop } from '@stencil/core';\nimport { fromEvent, merge, Observable, Subject } from 'rxjs';\nimport { auditTime, distinctUntilChanged, filter, map, takeUntil } from 'rxjs/operators';\n\n/**\n * An element to display scrollable content.\n */\n@Component({\n tag: 'cat-scrollable',\n styleUrl: 'cat-scrollable.scss',\n shadow: true\n})\nexport class CatScrollable {\n private static readonly THROTTLE = 50;\n scrollElement?: HTMLElement;\n scrollWrapperElement?: HTMLElement;\n private readonly init = new Subject<void>();\n private readonly destroyed = new Subject<void>();\n private readonly resizedEntries = new Subject<ResizeObserverEntry[]>();\n private readonly resizedObserver = new ResizeObserver(entries => this.resizedEntries.next(entries));\n private scrolled!: Observable<Event>;\n\n /** Flags to disable/enable scroll shadowX. */\n @Prop()\n noShadowX = false;\n\n /** Flags to disable/enable scroll shadowY. */\n @Prop()\n noShadowY = false;\n\n /** Flags to disable/enable overflowX. */\n @Prop()\n noOverflowX = false;\n\n /** Flags to disable/enable overflowY. */\n @Prop()\n noOverflowY = false;\n\n /** Flag to disable/enable overscroll behavior. */\n @Prop()\n noOverscroll = false;\n\n /**\n * Flag to not fire an initial event after content initialization.\n */\n @Prop() noScrolledInit = false;\n\n /**\n * Buffer to be used to calculate the scroll distance.\n */\n @Prop() scrolledBuffer = 0;\n\n /**\n * Emitted when the content is fully scrolled to the top.\n */\n @Event() scrolledTop!: EventEmitter<void>;\n\n /**\n * Emitted when the content is fully scrolled to the left.\n */\n @Event() scrolledLeft!: EventEmitter<void>;\n\n /**\n * Emitted when the content is fully scrolled to the right.\n */\n @Event() scrolledRight!: EventEmitter<void>;\n\n /**\n * Emitted when the content is fully scrolled to the bottom.\n */\n @Event() scrolledBottom!: EventEmitter<void>;\n\n componentDidRender() {\n if (this.scrollElement) {\n this.scrolled = fromEvent(this.scrollElement, 'scroll').pipe(takeUntil(this.destroyed));\n this.resizedObserver.observe(this.scrollElement);\n }\n if (this.scrollWrapperElement) {\n this.resizedObserver.observe(this.scrollWrapperElement);\n }\n this.attachEmitter('left', this.scrolledLeft);\n this.attachEmitter('right', this.scrolledRight);\n this.attachEmitter('bottom', this.scrolledBottom);\n this.attachEmitter('top', this.scrolledTop);\n merge(this.init, this.scrolled, this.resizedEntries)\n .pipe(\n auditTime(CatScrollable.THROTTLE),\n map(() => ({\n top: this.getScrollOffset('top') > 0,\n left: this.getScrollOffset('left') > 0,\n right: this.getScrollOffset('right') > 0,\n bottom: this.getScrollOffset('bottom') > 0\n })),\n distinctUntilChanged(),\n takeUntil(this.destroyed)\n )\n .subscribe(({ top, left, right, bottom }) => {\n this.toggleClass('cat-scrollable-top', top);\n this.toggleClass('cat-scrollable-left', left);\n this.toggleClass('cat-scrollable-right', right);\n this.toggleClass('cat-scrollable-bottom', bottom);\n });\n }\n\n componentDidLoad() {\n if (!this.noScrolledInit) {\n this.init.next();\n }\n }\n\n disconnectedCallback() {\n this.init.complete();\n this.destroyed.next();\n this.destroyed.complete();\n this.resizedObserver.disconnect();\n }\n\n render() {\n return [\n <div class=\"scrollable-wrapper\" ref={el => (this.scrollWrapperElement = el)}>\n {!this.noShadowY && <div class=\"shadow-top\"></div>}\n {!this.noShadowX && <div class=\"shadow-left\"></div>}\n {!this.noShadowX && <div class=\"shadow-right\"></div>}\n {!this.noShadowY && <div class=\"shadow-bottom\"></div>}\n </div>,\n <div\n ref={el => (this.scrollElement = el)}\n class={{\n 'scrollable-content': true,\n 'scroll-x': !this.noOverflowX,\n 'scroll-y': !this.noOverflowY,\n 'no-overscroll': this.noOverscroll\n }}\n >\n <slot></slot>\n </div>\n ];\n }\n\n private attachEmitter(from: 'top' | 'left' | 'right' | 'bottom', emitter: EventEmitter<void>) {\n merge(this.init, this.scrolled, this.resizedEntries)\n .pipe(\n auditTime(CatScrollable.THROTTLE),\n map(() => this.getScrollOffset(from)),\n map(offset => offset <= this.scrolledBuffer),\n distinctUntilChanged(),\n filter(isLower => isLower),\n takeUntil(this.destroyed)\n )\n .subscribe(() => emitter.emit());\n }\n\n private getScrollOffset(from: 'top' | 'left' | 'right' | 'bottom') {\n if (this.scrollElement) {\n switch (from) {\n case 'top':\n return this.scrollElement.scrollTop;\n case 'left':\n return this.scrollElement.scrollLeft;\n case 'right':\n return this.scrollElement.scrollWidth - this.scrollElement.clientWidth - this.scrollElement.scrollLeft;\n case 'bottom':\n return this.scrollElement.scrollHeight - this.scrollElement.clientHeight - this.scrollElement.scrollTop;\n default:\n return 0;\n }\n }\n return 0;\n }\n\n private toggleClass(name: string, value: boolean) {\n if (value) {\n this.scrollWrapperElement?.classList.add(name);\n } else {\n this.scrollWrapperElement?.classList.remove(name);\n }\n }\n}\n"]}
@@ -65,6 +65,8 @@ textarea {
65
65
  box-shadow: 0 0 0 1px rgb(var(--cat-border-color-dark, 215, 219, 224));
66
66
  transition: box-shadow 0.13s linear;
67
67
  resize: vertical;
68
+ /* stylelint-disable property-no-vendor-prefix */
69
+ /* stylelint-enable property-no-vendor-prefix */
68
70
  }
69
71
  textarea:disabled {
70
72
  background: #f2f4f7;
@@ -80,4 +82,7 @@ textarea:focus {
80
82
  }
81
83
  textarea::placeholder {
82
84
  color: rgb(var(--cat-font-color-muted, 105, 118, 135));
85
+ }
86
+ textarea:-webkit-autofill, textarea:-webkit-autofill:hover, textarea:-webkit-autofill:focus {
87
+ -webkit-box-shadow: 0 0 0 9999px #e8f0fe inset;
83
88
  }
@@ -23,6 +23,7 @@
23
23
 
24
24
  catIconRegistry.addIcons(ci);
25
25
  catI18nRegistry.set({
26
+ 'dialog.close': 'Close',
26
27
  'input.clear': 'Clear',
27
28
  'input.optional': 'Optional',
28
29
  'input.required': 'Required',
@@ -49,7 +49,7 @@
49
49
 
50
50
  @function cat-token-wrap($value, $alpha: 1) {
51
51
  @if meta.type-of($value) == 'string' {
52
- @if $alpha < 1 {
52
+ @if meta.type-of($alpha) != 'number' or $alpha < 1 {
53
53
  @return rgba($value, $alpha);
54
54
  } @else {
55
55
  @return rgb($value);
@@ -80,7 +80,7 @@
80
80
  @if string.index($key, 'color.') == 1 {
81
81
  @if $wrap {
82
82
  @return cat-token-wrap($value, $alpha);
83
- } @else if $alpha < 1 {
83
+ } @else if meta.type-of($alpha) != 'number' or $alpha < 1 {
84
84
  @return $value, $alpha;
85
85
  }
86
86
  }
@@ -0,0 +1,66 @@
1
+ @use '../variables' as *;
2
+ @use '../mixins' as *;
3
+
4
+ /**
5
+ * Dialog makes assumptions about the DOM structure of the dialog content.
6
+ * The following selectors are used to style the dialog content based on its
7
+ * position in the DOM hierarchy.
8
+ *
9
+ * .cat-backdrop
10
+ * |- .cat-dialog
11
+ * |- .cat-dialog-header
12
+ * |- .cat-dialog-header-content
13
+ * |- .cat-dialog-content
14
+ * |- .cat-dialog-actions
15
+ **/
16
+
17
+ $-dialog-padding: 1.5rem;
18
+
19
+ .cat-backdrop {
20
+ background-color: cat-token('color.ui.background.backdrop', cat-token('opacity.backdrop'));
21
+ }
22
+
23
+ .cat-dialog {
24
+ background-color: cat-token('color.ui.background.surface');
25
+ border-radius: cat-border-radius('l');
26
+ @include cat-elevation(7);
27
+ container: dialog / inline-size;
28
+ }
29
+
30
+ .cat-dialog-header {
31
+ display: flex;
32
+ align-items: center;
33
+ gap: 1rem;
34
+ padding: $-dialog-padding;
35
+ }
36
+
37
+ .cat-dialog-header-content {
38
+ flex: 1 1 auto;
39
+ display: flex;
40
+ flex-direction: column;
41
+ gap: 0.5rem;
42
+ word-wrap: break-word;
43
+ word-break: break-word;
44
+ }
45
+
46
+ .cat-dialog-content {
47
+ overflow: auto;
48
+ padding: 0 $-dialog-padding;
49
+
50
+ > *:last-child {
51
+ margin-bottom: 0;
52
+ }
53
+ }
54
+
55
+ .cat-dialog-actions {
56
+ display: flex;
57
+ padding: $-dialog-padding;
58
+ gap: 0.5rem;
59
+ flex-wrap: wrap;
60
+
61
+ @container dialog (max-width: 360px) {
62
+ cat-button {
63
+ width: 100%;
64
+ }
65
+ }
66
+ }
@@ -4,7 +4,7 @@
4
4
  .cat-toastify {
5
5
  display: flex;
6
6
  border-radius: cat-border-radius('l');
7
- background: cat-token('color.ui.background.body');
7
+ background: cat-token('color.ui.background.surface');
8
8
  padding: 1.25rem;
9
9
  box-shadow: none;
10
10
  color: cat-token('color.ui.font.body');
@@ -13,15 +13,15 @@
13
13
  cursor: unset;
14
14
 
15
15
  &.cat-toastify-dark {
16
- --cat-font-color-head: #{cat-token('color.ui.font.headDark', $wrap: false)};
17
- --cat-font-color-body: #{cat-token('color.ui.font.bodyDark', $wrap: false)};
18
- --cat-primary-text: #{cat-token('color.theme.primaryDark.text', $wrap: false)};
19
- --cat-primary-text-hover: #{cat-token('color.theme.primaryDark.textHover', $wrap: false)};
20
- --cat-primary-text-active: #{cat-token('color.theme.primaryDark.textActive', $wrap: false)};
21
- --cat-secondary-text: #{cat-token('color.theme.secondaryDark.text', $wrap: false)};
22
- --cat-secondary-text-hover: #{cat-token('color.theme.secondaryDark.textHover', $wrap: false)};
23
- --cat-secondary-text-active: #{cat-token('color.theme.secondaryDark.textActive', $wrap: false)};
24
- background: cat-token('color.ui.background.bodyDark');
16
+ --cat-font-color-head: #{cat-token('color.ui.font.headInverted', $wrap: false)};
17
+ --cat-font-color-body: #{cat-token('color.ui.font.bodyInverted', $wrap: false)};
18
+ --cat-primary-text: #{cat-token('color.theme.primaryInverted.text', $wrap: false)};
19
+ --cat-primary-text-hover: #{cat-token('color.theme.primaryInverted.textHover', $wrap: false)};
20
+ --cat-primary-text-active: #{cat-token('color.theme.primaryInverted.textActive', $wrap: false)};
21
+ --cat-secondary-text: #{cat-token('color.theme.secondaryInverted.text', $wrap: false)};
22
+ --cat-secondary-text-hover: #{cat-token('color.theme.secondaryInverted.textHover', $wrap: false)};
23
+ --cat-secondary-text-active: #{cat-token('color.theme.secondaryInverted.textActive', $wrap: false)};
24
+ background: cat-token('color.ui.background.surfaceInverted');
25
25
  }
26
26
  }
27
27
 
@@ -221,7 +221,7 @@ kbd,
221
221
  code {
222
222
  margin: 0 0.125rem;
223
223
  color: cat-token('color.ui.font.muted');
224
- background: cat-token('color.ui.background.body');
224
+ background: cat-token('color.ui.background.surface');
225
225
  box-shadow: 0 0 0 2px cat-token('color.ui.border.default');
226
226
  border-radius: cat-border-radius('s');
227
227
  }
@@ -10,6 +10,7 @@
10
10
 
11
11
  // -- Core
12
12
  @import 'core/base';
13
+ @import 'core/dialog';
13
14
  @import 'core/form';
14
15
  @import 'core/nav';
15
16
  @import 'core/notification';
@@ -3,6 +3,7 @@
3
3
  // ---- Responsive
4
4
 
5
5
  @mixin until($size, $media-type: screen) {
6
+ @debug 'until', $size;
6
7
  @media #{$media-type} and (max-width: #{cat-token('size.screen.#{$size}') - 1px}) {
7
8
  @content;
8
9
  }
@@ -1 +1 @@
1
- {"file":"cat-badge.js","mappings":";;AAAA,MAAM,WAAW,GAAG,+jFAA+jF;;MCWtkFA,UAAQ;EALrB;;;;;;;IAW2B,YAAO,GAA0B,QAAQ,CAAC;;;;IAK1C,UAAK,GAA+D,SAAS,CAAC;;;;IAK9E,SAAI,GAAkC,GAAG,CAAC;;;;IAK1C,UAAK,GAAG,KAAK,CAAC;;;;IAKd,UAAK,GAAG,KAAK,CAAC;GAKxC;EAHC,MAAM;IACJ,OAAO,eAAa,CAAC;GACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatBadge"],"sources":["./src/components/cat-badge/cat-badge.scss?tag=cat-badge&encapsulation=shadow","./src/components/cat-badge/cat-badge.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'sass:map';\n\n// -----\n\n$-sizes: (\n 'xl': 3rem,\n 'l': 2.5rem,\n 'm': 2rem,\n 's': 1.5rem,\n 'xs': 1rem\n);\n$-paddings: (\n 'xl': 0 1rem,\n 'l': 0 1rem,\n 'm': 0 0.75rem,\n 's': 0 0.5rem,\n 'xs': 0 0.25rem\n);\n\n// -----\n\n:host([hidden]) {\n display: none;\n}\n\n:host {\n display: inline-flex;\n max-width: 100%;\n vertical-align: baseline;\n align-items: center;\n justify-content: center;\n border-radius: cat-border-radius('m');\n text-decoration: none;\n line-height: 1.5;\n\n slot {\n display: inline-block;\n @include cat-ellipsis;\n }\n}\n\n// ----- round\n\n:host([round]) {\n border-radius: 10rem;\n}\n\n// ----- theme\n\n:host([variant='filled']) {\n background-color: cat-token-wrap(var(--bg), 0.1);\n color: cat-token-wrap(var(--text));\n font-weight: 600;\n @include cat-font-smooth;\n}\n\n$-outline: inset 0 0 0 1px cat-token-wrap(var(--border), $alpha: 0.2);\n\n:host([variant='outlined']) {\n background-color: cat-token('color.ui.background.body');\n box-shadow: $-outline;\n color: cat-token-wrap(var(--text));\n}\n\n@mixin theme($theme) {\n :host([color='#{$theme}']) {\n --bg: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n --fill: #{cat-token('color.theme.#{$theme}.fill', $wrap: false)};\n --text: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n @if $theme == 'secondary' {\n --border: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n } @else {\n --border: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n }\n }\n}\n\n@include theme('primary');\n@include theme('secondary');\n@include theme('success');\n@include theme('warning');\n@include theme('danger');\n\n// ----- size\n\n@mixin size($size, $fontSize) {\n :host([size='#{$size}']) {\n height: map.get($-sizes, $size);\n min-width: map.get($-sizes, $size);\n font-size: cat-body-font-size($fontSize);\n padding: map.get($-paddings, $size);\n }\n}\n\n@include size('xs', 'xs');\n@include size('s', 'xs');\n@include size('m', 's');\n@include size('l', 'm');\n@include size('xl', 'l');\n\n// ----- pulse\n\n$-pulse-0: 0 0 0 0 cat-token-wrap(var(--bg));\n$-pulse-70: transparent 0 0 0 0.5rem;\n$-pulse-100: transparent 0 0 0 0;\n\n:host([pulse][variant='filled']) {\n animation: 1.5s ease 0s infinite normal none running pulse;\n}\n\n:host([pulse][variant='outlined']) {\n animation: 1.5s ease 0s infinite normal none running pulse-outlined;\n}\n\n@keyframes pulse {\n 0% {\n box-shadow: $-pulse-0;\n }\n\n 70% {\n box-shadow: $-pulse-70;\n }\n\n 100% {\n box-shadow: $-pulse-100;\n }\n}\n\n@keyframes pulse-outlined {\n 0% {\n box-shadow: $-pulse-0, $-outline;\n }\n\n 70% {\n box-shadow: $-pulse-70, $-outline;\n }\n\n 100% {\n box-shadow: $-pulse-100, $-outline;\n }\n}\n","import { Component, Element, h, Prop } from '@stencil/core';\n\n/**\n * Badges are used to inform users of the status of an object or of an action\n * that’s been taken.\n */\n@Component({\n tag: 'cat-badge',\n styleUrl: 'cat-badge.scss',\n shadow: true\n})\nexport class CatBadge {\n @Element() hostElement!: HTMLElement;\n\n /**\n * The rendering style of the badge.\n */\n @Prop({ reflect: true }) variant: 'filled' | 'outlined' = 'filled';\n\n /**\n * The color palette of the badge.\n */\n @Prop({ reflect: true }) color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'primary';\n\n /**\n * The size of the badge.\n */\n @Prop({ reflect: true }) size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * Use round badge edges.\n */\n @Prop({ reflect: true }) round = false;\n\n /**\n * Draw attention to the badge with a subtle animation.\n */\n @Prop({ reflect: true }) pulse = false;\n\n render() {\n return <slot></slot>;\n }\n}\n"],"version":3}
1
+ {"file":"cat-badge.js","mappings":";;AAAA,MAAM,WAAW,GAAG,+jFAA+jF;;MCWtkFA,UAAQ;EALrB;;;;;;;IAW2B,YAAO,GAA0B,QAAQ,CAAC;;;;IAK1C,UAAK,GAA+D,SAAS,CAAC;;;;IAK9E,SAAI,GAAkC,GAAG,CAAC;;;;IAK1C,UAAK,GAAG,KAAK,CAAC;;;;IAKd,UAAK,GAAG,KAAK,CAAC;GAKxC;EAHC,MAAM;IACJ,OAAO,eAAa,CAAC;GACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatBadge"],"sources":["./src/components/cat-badge/cat-badge.scss?tag=cat-badge&encapsulation=shadow","./src/components/cat-badge/cat-badge.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'sass:map';\n\n// -----\n\n$-sizes: (\n 'xl': 3rem,\n 'l': 2.5rem,\n 'm': 2rem,\n 's': 1.5rem,\n 'xs': 1rem\n);\n$-paddings: (\n 'xl': 0 1rem,\n 'l': 0 1rem,\n 'm': 0 0.75rem,\n 's': 0 0.5rem,\n 'xs': 0 0.25rem\n);\n\n// -----\n\n:host([hidden]) {\n display: none;\n}\n\n:host {\n display: inline-flex;\n max-width: 100%;\n vertical-align: baseline;\n align-items: center;\n justify-content: center;\n border-radius: cat-border-radius('m');\n text-decoration: none;\n line-height: 1.5;\n\n slot {\n display: inline-block;\n @include cat-ellipsis;\n }\n}\n\n// ----- round\n\n:host([round]) {\n border-radius: 10rem;\n}\n\n// ----- theme\n\n:host([variant='filled']) {\n background-color: cat-token-wrap(var(--bg), 0.1);\n color: cat-token-wrap(var(--text));\n font-weight: 600;\n @include cat-font-smooth;\n}\n\n$-outline: inset 0 0 0 1px cat-token-wrap(var(--border), $alpha: 0.2);\n\n:host([variant='outlined']) {\n background-color: cat-token('color.ui.background.surface');\n box-shadow: $-outline;\n color: cat-token-wrap(var(--text));\n}\n\n@mixin theme($theme) {\n :host([color='#{$theme}']) {\n --bg: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n --fill: #{cat-token('color.theme.#{$theme}.fill', $wrap: false)};\n --text: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n @if $theme == 'secondary' {\n --border: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n } @else {\n --border: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n }\n }\n}\n\n@include theme('primary');\n@include theme('secondary');\n@include theme('success');\n@include theme('warning');\n@include theme('danger');\n\n// ----- size\n\n@mixin size($size, $fontSize) {\n :host([size='#{$size}']) {\n height: map.get($-sizes, $size);\n min-width: map.get($-sizes, $size);\n font-size: cat-body-font-size($fontSize);\n padding: map.get($-paddings, $size);\n }\n}\n\n@include size('xs', 'xs');\n@include size('s', 'xs');\n@include size('m', 's');\n@include size('l', 'm');\n@include size('xl', 'l');\n\n// ----- pulse\n\n$-pulse-0: 0 0 0 0 cat-token-wrap(var(--bg));\n$-pulse-70: transparent 0 0 0 0.5rem;\n$-pulse-100: transparent 0 0 0 0;\n\n:host([pulse][variant='filled']) {\n animation: 1.5s ease 0s infinite normal none running pulse;\n}\n\n:host([pulse][variant='outlined']) {\n animation: 1.5s ease 0s infinite normal none running pulse-outlined;\n}\n\n@keyframes pulse {\n 0% {\n box-shadow: $-pulse-0;\n }\n\n 70% {\n box-shadow: $-pulse-70;\n }\n\n 100% {\n box-shadow: $-pulse-100;\n }\n}\n\n@keyframes pulse-outlined {\n 0% {\n box-shadow: $-pulse-0, $-outline;\n }\n\n 70% {\n box-shadow: $-pulse-70, $-outline;\n }\n\n 100% {\n box-shadow: $-pulse-100, $-outline;\n }\n}\n","import { Component, Element, h, Prop } from '@stencil/core';\n\n/**\n * Badges are used to inform users of the status of an object or of an action\n * that’s been taken.\n */\n@Component({\n tag: 'cat-badge',\n styleUrl: 'cat-badge.scss',\n shadow: true\n})\nexport class CatBadge {\n @Element() hostElement!: HTMLElement;\n\n /**\n * The rendering style of the badge.\n */\n @Prop({ reflect: true }) variant: 'filled' | 'outlined' = 'filled';\n\n /**\n * The color palette of the badge.\n */\n @Prop({ reflect: true }) color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'primary';\n\n /**\n * The size of the badge.\n */\n @Prop({ reflect: true }) size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * Use round badge edges.\n */\n @Prop({ reflect: true }) round = false;\n\n /**\n * Draw attention to the badge with a subtle animation.\n */\n @Prop({ reflect: true }) pulse = false;\n\n render() {\n return <slot></slot>;\n }\n}\n"],"version":3}
@@ -281,19 +281,19 @@ const CatButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
281
281
  }
282
282
  }
283
283
  get isIconButton() {
284
- return Boolean(this.icon) && this._iconOnly;
284
+ return (Boolean(this.icon) || Boolean(this.iconSrc)) && this._iconOnly;
285
285
  }
286
286
  get hasPrefixIcon() {
287
- return Boolean(this.icon) && !this._iconOnly && !this.iconRight;
287
+ return (Boolean(this.icon) || Boolean(this.iconSrc)) && !this._iconOnly && !this.iconRight;
288
288
  }
289
289
  get hasSuffixIcon() {
290
- return Boolean(this.icon) && !this._iconOnly && this.iconRight;
290
+ return (Boolean(this.icon) || Boolean(this.iconSrc)) && !this._iconOnly && this.iconRight;
291
291
  }
292
292
  get content() {
293
293
  return [
294
- this.hasPrefixIcon ? h("cat-icon", { icon: this.icon, size: this.iconSize, part: "prefix" }) : null,
295
- this.isIconButton ? (h("cat-icon", { icon: this.icon, size: this.iconSize })) : (h("span", { class: "cat-button-content", part: "content" }, h("slot", null))),
296
- this.hasSuffixIcon ? h("cat-icon", { icon: this.icon, size: this.iconSize, part: "suffix" }) : null,
294
+ this.hasPrefixIcon ? (h("cat-icon", { icon: this.icon, iconSrc: this.iconSrc, size: this.iconSize, part: "prefix" })) : null,
295
+ this.isIconButton ? (h("cat-icon", { icon: this.icon, iconSrc: this.iconSrc, size: this.iconSize })) : (h("span", { class: "cat-button-content", part: "content" }, h("slot", null))),
296
+ this.hasSuffixIcon ? (h("cat-icon", { icon: this.icon, iconSrc: this.iconSrc, size: this.iconSize, part: "suffix" })) : null,
297
297
  this.loading ? h("cat-spinner", { size: this.spinnerSize }) : null
298
298
  ];
299
299
  }
@@ -325,6 +325,7 @@ const CatButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
325
325
  "url": [1],
326
326
  "urlTarget": [1, "url-target"],
327
327
  "icon": [1],
328
+ "iconSrc": [1, "icon-src"],
328
329
  "iconOnly": [8, "icon-only"],
329
330
  "iconRight": [4, "icon-right"],
330
331
  "buttonId": [1, "button-id"],