@haiilo/catalyst 2.4.9 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalyst/catalyst.css +2411 -2
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/catalyst.esm.js.map +1 -1
- package/dist/catalyst/index.cdn.js +2 -0
- package/dist/catalyst/p-52f9fea7.entry.js +2 -0
- package/dist/catalyst/{p-5bfc70e3.entry.js.map → p-52f9fea7.entry.js.map} +1 -1
- package/dist/catalyst/p-557c8009.entry.js +2 -0
- package/dist/catalyst/p-557c8009.entry.js.map +1 -0
- package/dist/catalyst/scss/_variables.scss +11 -11
- package/dist/catalyst/scss/_variables.tokens.scss +2 -2
- package/dist/catalyst/scss/core/_dialog.scss +66 -0
- package/dist/catalyst/scss/index.scss +1 -0
- package/dist/catalyst/scss/utils/_media.mixins.scss +1 -0
- package/dist/cjs/{cat-alert_23.cjs.entry.js → cat-alert_24.cjs.entry.js} +70 -18
- package/dist/cjs/cat-alert_24.cjs.entry.js.map +1 -0
- package/dist/cjs/cat-modal.cjs.entry.js +1 -1
- package/dist/cjs/cat-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/catalyst.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/cat-button/cat-button.js +23 -6
- package/dist/collection/components/cat-button/cat-button.js.map +1 -1
- package/dist/collection/components/cat-form-group/cat-form-group.css +3 -0
- package/dist/collection/components/cat-form-group/cat-form-group.js +66 -0
- package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -0
- package/dist/collection/components/cat-icon/cat-icon.js +21 -9
- package/dist/collection/components/cat-icon/cat-icon.js.map +1 -1
- package/dist/collection/components/cat-input/cat-input.js +27 -1
- package/dist/collection/components/cat-input/cat-input.js.map +1 -1
- package/dist/collection/components/cat-label/cat-label.js +27 -1
- package/dist/collection/components/cat-label/cat-label.js.map +1 -1
- package/dist/collection/components/cat-modal/cat-modal.css +1 -1
- package/dist/collection/components/cat-select/cat-select.js +47 -4
- package/dist/collection/components/cat-select/cat-select.js.map +1 -1
- package/dist/collection/components/cat-select-demo/cat-select-demo.js +1 -1
- package/dist/collection/components/cat-select-demo/cat-select-demo.js.map +1 -1
- package/dist/collection/components/cat-textarea/cat-textarea.js +31 -1
- package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
- package/dist/collection/index.cdn.js +2 -0
- package/dist/collection/scss/_variables.scss +11 -11
- package/dist/collection/scss/_variables.tokens.scss +2 -2
- package/dist/collection/scss/core/_dialog.scss +66 -0
- package/dist/collection/scss/index.scss +1 -0
- package/dist/collection/scss/utils/_media.mixins.scss +1 -0
- package/dist/components/cat-button2.js +7 -6
- package/dist/components/cat-button2.js.map +1 -1
- package/dist/components/cat-dropdown2.js.map +1 -1
- package/dist/components/cat-form-group.d.ts +11 -0
- package/dist/components/cat-form-group.js +64 -0
- package/dist/components/cat-form-group.js.map +1 -0
- package/dist/components/cat-icon2.js +2 -5
- package/dist/components/cat-icon2.js.map +1 -1
- package/dist/components/cat-input.js +6 -1
- package/dist/components/cat-input.js.map +1 -1
- package/dist/components/cat-label.js +6 -1
- package/dist/components/cat-label.js.map +1 -1
- package/dist/components/cat-modal.js +1 -1
- package/dist/components/cat-modal.js.map +1 -1
- package/dist/components/cat-select-demo.js +1 -1
- package/dist/components/cat-select-demo.js.map +1 -1
- package/dist/components/cat-select2.js +8 -2
- package/dist/components/cat-select2.js.map +1 -1
- package/dist/components/cat-textarea.js +7 -1
- package/dist/components/cat-textarea.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/esm/{cat-alert_23.entry.js → cat-alert_24.entry.js} +70 -19
- package/dist/esm/cat-alert_24.entry.js.map +1 -0
- package/dist/esm/cat-modal.entry.js +1 -1
- package/dist/esm/cat-modal.entry.js.map +1 -1
- package/dist/esm/catalyst.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/cat-button/cat-button.d.ts +5 -0
- package/dist/types/components/cat-form-group/cat-form-group.d.ts +16 -0
- package/dist/types/components/cat-icon/cat-icon.d.ts +5 -1
- package/dist/types/components/cat-input/cat-input.d.ts +4 -0
- package/dist/types/components/cat-label/cat-label.d.ts +4 -0
- package/dist/types/components/cat-select/cat-select.d.ts +13 -5
- package/dist/types/components/cat-textarea/cat-textarea.d.ts +4 -0
- package/dist/types/components.d.ts +80 -3
- package/package.json +2 -2
- package/dist/catalyst/p-5bfc70e3.entry.js +0 -2
- package/dist/catalyst/p-602c38be.entry.js +0 -2
- package/dist/catalyst/p-602c38be.entry.js.map +0 -1
- package/dist/cjs/cat-alert_23.cjs.entry.js.map +0 -1
- package/dist/esm/cat-alert_23.entry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"cat-button2.js","mappings":";;;;;AAAA,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAU,CAAC;AAInD,MAAM,WAAW,GAA2C;EACjE,EAAE,EAAE,uBAAuB;EAC3B,CAAC,EAAE,uBAAuB;EAC1B,CAAC,EAAE,uBAAuB;EAC1B,CAAC,EAAE,wBAAwB;EAC3B,EAAE,EAAE,wBAAwB;CAC7B,CAAC;SAEc,YAAY,CAAC,KAAc;EACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAmB,CAAC,CAAC;AACjF;;ACdA;AAEA;AACA;AACA,IAAI,kBAA2B,CAAC;AAEhC;AACA;AACA;AACA;AACA;AACA,IAAI;;EAEF,kBAAkB,GAAG,OAAO,IAAI,KAAK,WAAW,IAAK,IAAY,CAAC,eAAe,CAAC;CACnF;AAAC,WAAM;EACN,kBAAkB,GAAG,KAAK,CAAC;CAC5B;MAEY,QAAQ;EAArB;;IAEE,SAAI,GAAY,SAAS,CAA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ACD,IAAI,CAAC,aAAa,GAAG,gBAAU,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAC,QAAQ,GAAY,GAAG,IAAI;MACrG,IAAI,CAAC,OAAO,GAAG,mBAAa,IAAI,EAAE,IAAI,CAAC,WAAW,GAAgB,GAAG,IAAI;KAC1E,CAAC;GACH;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC3B;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC3B;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["log"],"sources":["./src/utils/breakpoints.ts","./src/utils/platform.ts","./src/utils/media-matcher.ts","./src/components/cat-button/cat-button.scss?tag=cat-button&encapsulation=shadow","./src/components/cat-button/cat-button.tsx"],"sourcesContent":["const _breakpoints = ['xs', 's', 'm', 'l', 'xl'] as const;\n\nexport type Breakpoint = typeof _breakpoints[number];\n\nexport const Breakpoints: { [breakpoint in Breakpoint]: string } = {\n xs: '(max-width: 539.98px)',\n s: '(max-width: 767.98px)',\n m: '(max-width: 991.98px)',\n l: '(max-width: 1199.98px)',\n xl: '(max-width: 1399.98px)'\n};\n\nexport function isBreakpoint(value: unknown): value is Breakpoint {\n return typeof value === 'string' && _breakpoints.includes(value as Breakpoint);\n}\n","// https://github.com/angular/components/blob/master/src/cdk/platform/platform.ts\n\n// Whether the current platform supports the V8 Break Iterator. The V8 check\n// is necessary to detect all Blink based browsers.\nlet hasV8BreakIterator: boolean;\n\n// We need a try/catch around the reference to `Intl`, because accessing it in some cases can\n// cause IE to throw. These cases are tied to particular versions of Windows and can happen if\n// the consumer is providing a polyfilled `Map`. See:\n// https://github.com/Microsoft/ChakraCore/issues/3189\n// https://github.com/angular/components/issues/15687\ntry {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n hasV8BreakIterator = typeof Intl !== 'undefined' && (Intl as any).v8BreakIterator;\n} catch {\n hasV8BreakIterator = false;\n}\n\nexport class Platform {\n /** Whether the current browser is Microsoft Edge. */\n EDGE: boolean = /(edge)/i.test(navigator.userAgent);\n\n /** Whether the current rendering engine is Microsoft Trident. */\n TRIDENT: boolean = /(msie|trident)/i.test(navigator.userAgent);\n\n // EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.\n /** Whether the current rendering engine is Blink. */\n BLINK: boolean =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n !!((window as any).chrome || hasV8BreakIterator) && typeof CSS !== 'undefined' && !this.EDGE && !this.TRIDENT;\n\n // Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to\n // ensure that Webkit runs standalone and is not used as another engine's base.\n /** Whether the current rendering engine is WebKit. */\n WEBKIT: boolean = /AppleWebKit/i.test(navigator.userAgent) && !this.BLINK && !this.EDGE && !this.TRIDENT;\n\n /** Whether the current platform is Apple iOS. */\n IOS: boolean = /iPad|iPhone|iPod/.test(navigator.userAgent) && !('MSStream' in window);\n\n // It's difficult to detect the plain Gecko engine, because most of the browsers identify\n // them self as Gecko-like browsers and modify the userAgent's according to that.\n // Since we only cover one explicit Firefox case, we can simply check for Firefox\n // instead of having an unstable check for Gecko.\n /** Whether the current browser is Firefox. */\n FIREFOX: boolean = /(firefox|minefield)/i.test(navigator.userAgent);\n\n /** Whether the current platform is Android. */\n // Trident on mobile adds the android platform to the userAgent to trick detections.\n ANDROID: boolean = /android/i.test(navigator.userAgent) && !this.TRIDENT;\n\n // Safari browsers will include the Safari keyword in their userAgent. Some browsers may fake\n // this and just place the Safari keyword in the userAgent. To be more safe about Safari every\n // Safari browser should also use Webkit as its layout engine.\n /** Whether the current browser is Safari. */\n SAFARI: boolean = /safari/i.test(navigator.userAgent) && this.WEBKIT;\n}\n","import log from 'loglevel';\nimport { Platform } from './platform';\n\n// https://github.com/angular/components/blob/master/src/cdk/layout/media-matcher.ts\n\n/** Global registry for all dynamically-created, injected media queries. */\nconst mediaQueriesForWebkitCompatibility: Set<string> = new Set<string>();\n\n/** Style tag that holds all of the dynamically-created media queries. */\nlet mediaQueryStyleNode: HTMLStyleElement | undefined;\n\n/** A utility for calling matchMedia queries. */\nexport class MediaMatcher {\n private _platform;\n private _matchMedia: (query: string) => MediaQueryList;\n\n constructor() {\n this._platform = new Platform();\n this._matchMedia = window.matchMedia.bind(window);\n }\n\n /**\n * Evaluates the given media query and returns the native MediaQueryList from which results\n * can be retrieved.\n * Confirms the layout engine will trigger for the selector query provided and returns the\n * MediaQueryList for the query provided.\n */\n matchMedia(query: string): MediaQueryList {\n if (this._platform.WEBKIT || this._platform.BLINK) {\n createEmptyStyleRule(query);\n }\n return this._matchMedia(query);\n }\n}\n\n/**\n * Creates an empty stylesheet that is used to work around browser inconsistencies related to\n * `matchMedia`. At the time of writing, it handles the following cases:\n * 1. On WebKit browsers, a media query has to have at least one rule in order for `matchMedia`\n * to fire. We work around it by declaring a dummy stylesheet with a `@media` declaration.\n * 2. In some cases Blink browsers will stop firing the `matchMedia` listener if none of the rules\n * inside the `@media` match existing elements on the page. We work around it by having one rule\n * targeting the `body`. See https://github.com/angular/components/issues/23546.\n */\nfunction createEmptyStyleRule(query: string) {\n if (mediaQueriesForWebkitCompatibility.has(query)) {\n return;\n }\n\n try {\n if (!mediaQueryStyleNode) {\n mediaQueryStyleNode = document.createElement('style');\n mediaQueryStyleNode.setAttribute('type', 'text/css');\n document.head.appendChild(mediaQueryStyleNode);\n }\n if (mediaQueryStyleNode.sheet) {\n mediaQueryStyleNode.sheet.insertRule(`@media ${query} {body{ }}`, 0);\n mediaQueriesForWebkitCompatibility.add(query);\n }\n } catch (e) {\n log.error(e);\n }\n}\n","@use 'variables' as *;\n@use 'mixins' as *;\n@use 'sass:map';\n\n$button-sizes: (\n 'xl': 3.5rem,\n 'l': 3rem,\n 'm': 2.5rem,\n 's': 2rem,\n 'xs': 1.5rem\n);\n\n:host {\n display: inline-block;\n max-width: 100%;\n vertical-align: middle;\n @include cat-select(none);\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.cat-button {\n position: relative;\n font: inherit;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: cat-border-radius('m');\n text-decoration: none;\n width: 100%;\n box-sizing: border-box;\n cursor: pointer;\n transition: color cat-token('time.transition.s') linear, border-color cat-token('time.transition.s') linear,\n background-color cat-token('time.transition.s') linear, box-shadow cat-token('time.transition.s') linear;\n\n &:focus-visible {\n outline: 2px solid cat-token('color.ui.border.focus');\n outline-offset: 1px;\n }\n}\n\n// ----- content\n\n.cat-button-content {\n @include cat-break-word;\n\n .cat-button-ellipsed & {\n @include cat-ellipsis;\n }\n}\n\n// ----- disabled\n\n.cat-button-disabled {\n cursor: not-allowed;\n}\n\n// ----- round\n\n.cat-button-round {\n border-radius: 10rem;\n}\n\n// ----- loading\n\n.cat-button-loading {\n cursor: default;\n\n cat-spinner {\n position: absolute;\n }\n\n > *:not(cat-spinner) {\n visibility: hidden;\n }\n}\n\n// ----- theme\n\n.cat-button-filled {\n background-color: cat-token-wrap(var(--bg));\n color: cat-token-wrap(var(--fill));\n font-weight: 600;\n @include cat-font-smooth;\n\n &.cat-button-disabled {\n --bg: #{cat-token('color.ui.background.muted', $wrap: false)};\n --fill: #{cat-token('color.ui.font.muted', $wrap: false)};\n }\n}\n\n.cat-button-outlined {\n background-color: cat-token('color.ui.background.body');\n box-shadow: inset 0 0 0 1px cat-token-wrap(var(--base), $alpha: 0.2);\n color: cat-token-wrap(var(--text));\n\n &.cat-button-disabled {\n --base: #{cat-token('color.ui.font.muted', $wrap: false)};\n --text: #{cat-token('color.ui.font.muted', $wrap: false)};\n }\n\n &:hover:not(.cat-button-disabled):not(.cat-button-loading) {\n background-color: cat-token-wrap(var(--base), $alpha: 0.05);\n }\n\n &.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading) {\n background-color: cat-token-wrap(var(--base), $alpha: 0.1);\n }\n\n &:active:not(.cat-button-disabled):not(.cat-button-loading) {\n background-color: cat-token-wrap(var(--base), $alpha: 0.1);\n }\n}\n\n.cat-button-text {\n background-color: transparent;\n color: cat-token-wrap(var(--text));\n text-decoration: cat-token('font.decoration.linkButton');\n\n &.cat-button-disabled {\n --text: #{cat-token('color.ui.font.muted', $wrap: false)};\n }\n\n &:hover:not(.cat-button-disabled):not(.cat-button-loading) {\n text-decoration: cat-token('font.decoration.linkButtonHover');\n background-color: rgba(var(--base), 0.05);\n }\n\n &.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading) {\n text-decoration: cat-token('font.decoration.linkButtonHover');\n background-color: rgba(var(--base), 0.1);\n }\n}\n\n@mixin theme($theme) {\n .cat-button-#{$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 --base: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n } @else {\n --base: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n }\n\n &:hover:not(.cat-button-disabled):not(.cat-button-loading) {\n --bg: #{cat-token('color.theme.#{$theme}.bgHover', $wrap: false)};\n --fill: #{cat-token('color.theme.#{$theme}.fillHover', $wrap: false)};\n --text: #{cat-token('color.theme.#{$theme}.textHover', $wrap: false)};\n }\n\n &.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),\n &:active:not(.cat-button-disabled):not(.cat-button-loading) {\n --bg: #{cat-token('color.theme.#{$theme}.bgActive', $wrap: false)};\n --fill: #{cat-token('color.theme.#{$theme}.fillActive', $wrap: false)};\n --text: #{cat-token('color.theme.#{$theme}.textActive', $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, $padding) {\n $-line-height: cat-body-line-height($fontSize);\n\n $-total-height: map.get($button-sizes, $size);\n $-padding-v: ($-total-height - $-line-height) * 0.5;\n $-padding-h: $padding;\n\n .cat-button-#{$size} {\n min-width: map.get($button-sizes, $size);\n padding: $-padding-v $-padding-h;\n @include cat-body($fontSize, null);\n gap: 0.25rem;\n\n // normalize icon size for line height\n @if $fontSize == 'm' {\n cat-icon {\n margin-top: -0.125rem;\n margin-bottom: -0.125rem;\n }\n }\n\n &.cat-button-icon {\n width: $-total-height;\n padding-left: 0;\n padding-right: 0;\n }\n }\n\n :host(.cat-button-pull[size='#{$size}']) {\n margin: $-padding-v * -1 $-padding-h * -1;\n }\n\n :host(.cat-button-pull-h[size='#{$size}']) {\n margin-left: $-padding-h * -1;\n margin-right: $-padding-h * -1;\n }\n\n :host(.cat-button-pull-v[size='#{$size}']) {\n margin-top: $-padding-v * -1;\n margin-bottom: $-padding-v * -1;\n }\n\n :host(.cat-button-pull-t[size='#{$size}']) {\n margin-top: $-padding-v * -1;\n }\n\n :host(.cat-button-pull-l[size='#{$size}']) {\n margin-left: $-padding-h * -1;\n }\n\n :host(.cat-button-pull-b[size='#{$size}']) {\n margin-bottom: $-padding-v * -1;\n }\n\n :host(.cat-button-pull-r[size='#{$size}']) {\n margin-right: $-padding-h * -1;\n }\n}\n\n:host(.cat-button-pull:not([size])) {\n margin: -0.625rem -0.75rem;\n}\n\n:host(.cat-button-pull-h:not([size])) {\n margin-left: -0.75rem;\n margin-right: -0.75rem;\n}\n\n:host(.cat-button-pull-v:not([size])) {\n margin-top: -0.625rem;\n margin-bottom: -0.625rem;\n}\n\n:host(.cat-button-pull-t:not([size])) {\n margin-top: -0.625rem;\n}\n\n:host(.cat-button-pull-l:not([size])) {\n margin-left: -0.75rem;\n}\n\n:host(.cat-button-pull-b:not([size])) {\n margin-bottom: -0.625rem;\n}\n\n:host(.cat-button-pull-r:not([size])) {\n margin-right: -0.75rem;\n}\n\n@include size('xs', 's', 0.25rem);\n@include size('s', 'm', 0.5rem);\n@include size('m', 'm', 0.75rem);\n@include size('l', 'm', 1rem);\n@include size('xl', 'l', 1.25rem);\n\n// ----- tabs\n\n:host(.cat-tab-active:not(:hover)) {\n --cat-primary-text: transparent;\n}\n\n// ----- alignment\n\n:host(.cat-text-left) .cat-button {\n justify-content: left;\n}\n\n:host(.cat-text-right) .cat-button {\n justify-content: right;\n}\n\n// ----- navigation\n\n:host(.cat-nav-item) {\n width: 100%;\n\n .cat-button {\n box-shadow: none;\n border-radius: 0;\n justify-content: left;\n padding-left: $cat-nav-padding-horizontal;\n padding-right: $cat-nav-padding-horizontal;\n gap: 0.5rem;\n\n &:focus-visible {\n outline-offset: -2px;\n }\n }\n}\n","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 * 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"],"version":3}
|
|
1
|
+
{"file":"cat-button2.js","mappings":";;;;;AAAA,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAU,CAAC;AAInD,MAAM,WAAW,GAA2C;EACjE,EAAE,EAAE,uBAAuB;EAC3B,CAAC,EAAE,uBAAuB;EAC1B,CAAC,EAAE,uBAAuB;EAC1B,CAAC,EAAE,wBAAwB;EAC3B,EAAE,EAAE,wBAAwB;CAC7B,CAAC;SAEc,YAAY,CAAC,KAAc;EACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAmB,CAAC,CAAC;AACjF;;ACdA;AAEA;AACA;AACA,IAAI,kBAA2B,CAAC;AAEhC;AACA;AACA;AACA;AACA;AACA,IAAI;;EAEF,kBAAkB,GAAG,OAAO,IAAI,KAAK,WAAW,IAAK,IAAY,CAAC,eAAe,CAAC;CACnF;AAAC,WAAM;EACN,kBAAkB,GAAG,KAAK,CAAC;CAC5B;MAEY,QAAQ;EAArB;;IAEE,SAAI,GAAY,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;;IAGpD,YAAO,GAAY,iBA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,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,GAAa,KAElF,YAAM,KAAK,EAAC,oBAAoB,EAAC,IAAI,EAAC,SAAS,IAC7C,eAAa,CACR,CACR;MACD,IAAI,CAAC,aAAa,IAChB,gBAAU,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAC,QAAQ,GAAY,IAC9F,IAAI;MACR,IAAI,CAAC,OAAO,GAAG,mBAAa,IAAI,EAAE,IAAI,CAAC,WAAW,GAAgB,GAAG,IAAI;KAC1E,CAAC;GACH;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC3B;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC3B;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["log"],"sources":["./src/utils/breakpoints.ts","./src/utils/platform.ts","./src/utils/media-matcher.ts","./src/components/cat-button/cat-button.scss?tag=cat-button&encapsulation=shadow","./src/components/cat-button/cat-button.tsx"],"sourcesContent":["const _breakpoints = ['xs', 's', 'm', 'l', 'xl'] as const;\n\nexport type Breakpoint = typeof _breakpoints[number];\n\nexport const Breakpoints: { [breakpoint in Breakpoint]: string } = {\n xs: '(max-width: 539.98px)',\n s: '(max-width: 767.98px)',\n m: '(max-width: 991.98px)',\n l: '(max-width: 1199.98px)',\n xl: '(max-width: 1399.98px)'\n};\n\nexport function isBreakpoint(value: unknown): value is Breakpoint {\n return typeof value === 'string' && _breakpoints.includes(value as Breakpoint);\n}\n","// https://github.com/angular/components/blob/master/src/cdk/platform/platform.ts\n\n// Whether the current platform supports the V8 Break Iterator. The V8 check\n// is necessary to detect all Blink based browsers.\nlet hasV8BreakIterator: boolean;\n\n// We need a try/catch around the reference to `Intl`, because accessing it in some cases can\n// cause IE to throw. These cases are tied to particular versions of Windows and can happen if\n// the consumer is providing a polyfilled `Map`. See:\n// https://github.com/Microsoft/ChakraCore/issues/3189\n// https://github.com/angular/components/issues/15687\ntry {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n hasV8BreakIterator = typeof Intl !== 'undefined' && (Intl as any).v8BreakIterator;\n} catch {\n hasV8BreakIterator = false;\n}\n\nexport class Platform {\n /** Whether the current browser is Microsoft Edge. */\n EDGE: boolean = /(edge)/i.test(navigator.userAgent);\n\n /** Whether the current rendering engine is Microsoft Trident. */\n TRIDENT: boolean = /(msie|trident)/i.test(navigator.userAgent);\n\n // EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.\n /** Whether the current rendering engine is Blink. */\n BLINK: boolean =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n !!((window as any).chrome || hasV8BreakIterator) && typeof CSS !== 'undefined' && !this.EDGE && !this.TRIDENT;\n\n // Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to\n // ensure that Webkit runs standalone and is not used as another engine's base.\n /** Whether the current rendering engine is WebKit. */\n WEBKIT: boolean = /AppleWebKit/i.test(navigator.userAgent) && !this.BLINK && !this.EDGE && !this.TRIDENT;\n\n /** Whether the current platform is Apple iOS. */\n IOS: boolean = /iPad|iPhone|iPod/.test(navigator.userAgent) && !('MSStream' in window);\n\n // It's difficult to detect the plain Gecko engine, because most of the browsers identify\n // them self as Gecko-like browsers and modify the userAgent's according to that.\n // Since we only cover one explicit Firefox case, we can simply check for Firefox\n // instead of having an unstable check for Gecko.\n /** Whether the current browser is Firefox. */\n FIREFOX: boolean = /(firefox|minefield)/i.test(navigator.userAgent);\n\n /** Whether the current platform is Android. */\n // Trident on mobile adds the android platform to the userAgent to trick detections.\n ANDROID: boolean = /android/i.test(navigator.userAgent) && !this.TRIDENT;\n\n // Safari browsers will include the Safari keyword in their userAgent. Some browsers may fake\n // this and just place the Safari keyword in the userAgent. To be more safe about Safari every\n // Safari browser should also use Webkit as its layout engine.\n /** Whether the current browser is Safari. */\n SAFARI: boolean = /safari/i.test(navigator.userAgent) && this.WEBKIT;\n}\n","import log from 'loglevel';\nimport { Platform } from './platform';\n\n// https://github.com/angular/components/blob/master/src/cdk/layout/media-matcher.ts\n\n/** Global registry for all dynamically-created, injected media queries. */\nconst mediaQueriesForWebkitCompatibility: Set<string> = new Set<string>();\n\n/** Style tag that holds all of the dynamically-created media queries. */\nlet mediaQueryStyleNode: HTMLStyleElement | undefined;\n\n/** A utility for calling matchMedia queries. */\nexport class MediaMatcher {\n private _platform;\n private _matchMedia: (query: string) => MediaQueryList;\n\n constructor() {\n this._platform = new Platform();\n this._matchMedia = window.matchMedia.bind(window);\n }\n\n /**\n * Evaluates the given media query and returns the native MediaQueryList from which results\n * can be retrieved.\n * Confirms the layout engine will trigger for the selector query provided and returns the\n * MediaQueryList for the query provided.\n */\n matchMedia(query: string): MediaQueryList {\n if (this._platform.WEBKIT || this._platform.BLINK) {\n createEmptyStyleRule(query);\n }\n return this._matchMedia(query);\n }\n}\n\n/**\n * Creates an empty stylesheet that is used to work around browser inconsistencies related to\n * `matchMedia`. At the time of writing, it handles the following cases:\n * 1. On WebKit browsers, a media query has to have at least one rule in order for `matchMedia`\n * to fire. We work around it by declaring a dummy stylesheet with a `@media` declaration.\n * 2. In some cases Blink browsers will stop firing the `matchMedia` listener if none of the rules\n * inside the `@media` match existing elements on the page. We work around it by having one rule\n * targeting the `body`. See https://github.com/angular/components/issues/23546.\n */\nfunction createEmptyStyleRule(query: string) {\n if (mediaQueriesForWebkitCompatibility.has(query)) {\n return;\n }\n\n try {\n if (!mediaQueryStyleNode) {\n mediaQueryStyleNode = document.createElement('style');\n mediaQueryStyleNode.setAttribute('type', 'text/css');\n document.head.appendChild(mediaQueryStyleNode);\n }\n if (mediaQueryStyleNode.sheet) {\n mediaQueryStyleNode.sheet.insertRule(`@media ${query} {body{ }}`, 0);\n mediaQueriesForWebkitCompatibility.add(query);\n }\n } catch (e) {\n log.error(e);\n }\n}\n","@use 'variables' as *;\n@use 'mixins' as *;\n@use 'sass:map';\n\n$button-sizes: (\n 'xl': 3.5rem,\n 'l': 3rem,\n 'm': 2.5rem,\n 's': 2rem,\n 'xs': 1.5rem\n);\n\n:host {\n display: inline-block;\n max-width: 100%;\n vertical-align: middle;\n @include cat-select(none);\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.cat-button {\n position: relative;\n font: inherit;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: cat-border-radius('m');\n text-decoration: none;\n width: 100%;\n box-sizing: border-box;\n cursor: pointer;\n transition: color cat-token('time.transition.s') linear, border-color cat-token('time.transition.s') linear,\n background-color cat-token('time.transition.s') linear, box-shadow cat-token('time.transition.s') linear;\n\n &:focus-visible {\n outline: 2px solid cat-token('color.ui.border.focus');\n outline-offset: 1px;\n }\n}\n\n// ----- content\n\n.cat-button-content {\n @include cat-break-word;\n\n .cat-button-ellipsed & {\n @include cat-ellipsis;\n }\n}\n\n// ----- disabled\n\n.cat-button-disabled {\n cursor: not-allowed;\n}\n\n// ----- round\n\n.cat-button-round {\n border-radius: 10rem;\n}\n\n// ----- loading\n\n.cat-button-loading {\n cursor: default;\n\n cat-spinner {\n position: absolute;\n }\n\n > *:not(cat-spinner) {\n visibility: hidden;\n }\n}\n\n// ----- theme\n\n.cat-button-filled {\n background-color: cat-token-wrap(var(--bg));\n color: cat-token-wrap(var(--fill));\n font-weight: 600;\n @include cat-font-smooth;\n\n &.cat-button-disabled {\n --bg: #{cat-token('color.ui.background.muted', $wrap: false)};\n --fill: #{cat-token('color.ui.font.muted', $wrap: false)};\n }\n}\n\n.cat-button-outlined {\n background-color: cat-token('color.ui.background.body');\n box-shadow: inset 0 0 0 1px cat-token-wrap(var(--base), $alpha: 0.2);\n color: cat-token-wrap(var(--text));\n\n &.cat-button-disabled {\n --base: #{cat-token('color.ui.font.muted', $wrap: false)};\n --text: #{cat-token('color.ui.font.muted', $wrap: false)};\n }\n\n &:hover:not(.cat-button-disabled):not(.cat-button-loading) {\n background-color: cat-token-wrap(var(--base), $alpha: 0.05);\n }\n\n &.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading) {\n background-color: cat-token-wrap(var(--base), $alpha: 0.1);\n }\n\n &:active:not(.cat-button-disabled):not(.cat-button-loading) {\n background-color: cat-token-wrap(var(--base), $alpha: 0.1);\n }\n}\n\n.cat-button-text {\n background-color: transparent;\n color: cat-token-wrap(var(--text));\n text-decoration: cat-token('font.decoration.linkButton');\n\n &.cat-button-disabled {\n --text: #{cat-token('color.ui.font.muted', $wrap: false)};\n }\n\n &:hover:not(.cat-button-disabled):not(.cat-button-loading) {\n text-decoration: cat-token('font.decoration.linkButtonHover');\n background-color: rgba(var(--base), 0.05);\n }\n\n &.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading) {\n text-decoration: cat-token('font.decoration.linkButtonHover');\n background-color: rgba(var(--base), 0.1);\n }\n}\n\n@mixin theme($theme) {\n .cat-button-#{$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 --base: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n } @else {\n --base: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n }\n\n &:hover:not(.cat-button-disabled):not(.cat-button-loading) {\n --bg: #{cat-token('color.theme.#{$theme}.bgHover', $wrap: false)};\n --fill: #{cat-token('color.theme.#{$theme}.fillHover', $wrap: false)};\n --text: #{cat-token('color.theme.#{$theme}.textHover', $wrap: false)};\n }\n\n &.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),\n &:active:not(.cat-button-disabled):not(.cat-button-loading) {\n --bg: #{cat-token('color.theme.#{$theme}.bgActive', $wrap: false)};\n --fill: #{cat-token('color.theme.#{$theme}.fillActive', $wrap: false)};\n --text: #{cat-token('color.theme.#{$theme}.textActive', $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, $padding) {\n $-line-height: cat-body-line-height($fontSize);\n\n $-total-height: map.get($button-sizes, $size);\n $-padding-v: ($-total-height - $-line-height) * 0.5;\n $-padding-h: $padding;\n\n .cat-button-#{$size} {\n min-width: map.get($button-sizes, $size);\n padding: $-padding-v $-padding-h;\n @include cat-body($fontSize, null);\n gap: 0.25rem;\n\n // normalize icon size for line height\n @if $fontSize == 'm' {\n cat-icon {\n margin-top: -0.125rem;\n margin-bottom: -0.125rem;\n }\n }\n\n &.cat-button-icon {\n width: $-total-height;\n padding-left: 0;\n padding-right: 0;\n }\n }\n\n :host(.cat-button-pull[size='#{$size}']) {\n margin: $-padding-v * -1 $-padding-h * -1;\n }\n\n :host(.cat-button-pull-h[size='#{$size}']) {\n margin-left: $-padding-h * -1;\n margin-right: $-padding-h * -1;\n }\n\n :host(.cat-button-pull-v[size='#{$size}']) {\n margin-top: $-padding-v * -1;\n margin-bottom: $-padding-v * -1;\n }\n\n :host(.cat-button-pull-t[size='#{$size}']) {\n margin-top: $-padding-v * -1;\n }\n\n :host(.cat-button-pull-l[size='#{$size}']) {\n margin-left: $-padding-h * -1;\n }\n\n :host(.cat-button-pull-b[size='#{$size}']) {\n margin-bottom: $-padding-v * -1;\n }\n\n :host(.cat-button-pull-r[size='#{$size}']) {\n margin-right: $-padding-h * -1;\n }\n}\n\n:host(.cat-button-pull:not([size])) {\n margin: -0.625rem -0.75rem;\n}\n\n:host(.cat-button-pull-h:not([size])) {\n margin-left: -0.75rem;\n margin-right: -0.75rem;\n}\n\n:host(.cat-button-pull-v:not([size])) {\n margin-top: -0.625rem;\n margin-bottom: -0.625rem;\n}\n\n:host(.cat-button-pull-t:not([size])) {\n margin-top: -0.625rem;\n}\n\n:host(.cat-button-pull-l:not([size])) {\n margin-left: -0.75rem;\n}\n\n:host(.cat-button-pull-b:not([size])) {\n margin-bottom: -0.625rem;\n}\n\n:host(.cat-button-pull-r:not([size])) {\n margin-right: -0.75rem;\n}\n\n@include size('xs', 's', 0.25rem);\n@include size('s', 'm', 0.5rem);\n@include size('m', 'm', 0.75rem);\n@include size('l', 'm', 1rem);\n@include size('xl', 'l', 1.25rem);\n\n// ----- tabs\n\n:host(.cat-tab-active:not(:hover)) {\n --cat-primary-text: transparent;\n}\n\n// ----- alignment\n\n:host(.cat-text-left) .cat-button {\n justify-content: left;\n}\n\n:host(.cat-text-right) .cat-button {\n justify-content: right;\n}\n\n// ----- navigation\n\n:host(.cat-nav-item) {\n width: 100%;\n\n .cat-button {\n box-shadow: none;\n border-radius: 0;\n justify-content: left;\n padding-left: $cat-nav-padding-horizontal;\n padding-right: $cat-nav-padding-horizontal;\n gap: 0.5rem;\n\n &:focus-visible {\n outline-offset: -2px;\n }\n }\n}\n","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"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"cat-dropdown2.js","mappings":";;;;;AAAA;AACA;AACA;AA+OO,MAAM,eAAe,GAAG,GAAG;;ACjPlC,MAAM,cAAc,GAAG,yhCAAyhC;;ACOhjC,IAAI,YAAY,GAAG,CAAC,CAAC;MAOR,WAAW;EALxB;;;;;;IAOmB,OAAE,GAAG,YAAY,EAAE,CAAC;IAM7B,WAAM,GAAmB,KAAK,CAAC;;;;IAK/B,cAAS,GAAc,cAAc,CAAC;;;;IAKtC,gBAAW,GAAG,KAAK,CAAC;;;;IAKpB,aAAQ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AAC,OAAO,EAAE;QAC1C,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,UAAU,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC;OACjD,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE;QAC1B,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;UAChC,IAAI,EAAE,GAAG,CAAC,IAAI;UACd,GAAG,EAAE,GAAG,CAAC,IAAI;SACd,CAAC,CAAC;OACJ,CAAC,CAAC;KACJ;GACF;;;;;;;;AAhMuB,kBAAM,GAAG,CAAE,CAAA;;;;;;;;;;;;;;;;;","names":["focusTrap.createFocusTrap"],"sources":["../tokens/dist/js/variables.js","./src/components/cat-dropdown/cat-dropdown.scss?tag=cat-dropdown&encapsulation=shadow","./src/components/cat-dropdown/cat-dropdown.tsx"],"sourcesContent":["/**\n * Auto-generated file. Do not edit directly.\n */\n\nexport const assetFontDmSansName = \"DM Sans\";\nexport const assetFontDmSansWoff2Bold = \"DMSans-Bold.woff2\";\nexport const assetFontDmSansWoff2BoldItalic = \"DMSans-BoldItalic.woff2\";\nexport const assetFontDmSansWoff2Italic = \"DMSans-Italic.woff2\";\nexport const assetFontDmSansWoff2Medium = \"DMSans-Medium.woff2\";\nexport const assetFontDmSansWoff2MediumItalic = \"DMSans-MediumItalic.woff2\";\nexport const assetFontDmSansWoff2Regular = \"DMSans-Regular.woff2\";\nexport const assetFontLatoName = \"Lato\";\nexport const assetFontLatoWoffBlack = \"Lato-Black.woff\";\nexport const assetFontLatoWoff2Black = \"Lato-Black.woff2\";\nexport const assetFontLatoWoffBlackItalic = \"Lato-BlackItalic.woff\";\nexport const assetFontLatoWoff2BlackItalic = \"Lato-BlackItalic.woff2\";\nexport const assetFontLatoWoffBold = \"Lato-Bold.woff\";\nexport const assetFontLatoWoff2Bold = \"Lato-Bold.woff2\";\nexport const assetFontLatoWoffBoldItalic = \"Lato-BoldItalic.woff\";\nexport const assetFontLatoWoff2BoldItalic = \"Lato-BoldItalic.woff2\";\nexport const assetFontLatoWoffHairline = \"Lato-Hairline.woff\";\nexport const assetFontLatoWoff2Hairline = \"Lato-Hairline.woff2\";\nexport const assetFontLatoWoffHairlineItalic = \"Lato-HairlineItalic.woff\";\nexport const assetFontLatoWoff2HairlineItalic = \"Lato-HairlineItalic.woff2\";\nexport const assetFontLatoWoffHeavy = \"Lato-Heavy.woff\";\nexport const assetFontLatoWoff2Heavy = \"Lato-Heavy.woff2\";\nexport const assetFontLatoWoffHeavyItalic = \"Lato-HeavyItalic.woff\";\nexport const assetFontLatoWoff2HeavyItalic = \"Lato-HeavyItalic.woff2\";\nexport const assetFontLatoWoffItalic = \"Lato-Italic.woff\";\nexport const assetFontLatoWoff2Italic = \"Lato-Italic.woff2\";\nexport const assetFontLatoWoffLight = \"Lato-Light.woff\";\nexport const assetFontLatoWoff2Light = \"Lato-Light.woff2\";\nexport const assetFontLatoWoffLightItalic = \"Lato-LightItalic.woff\";\nexport const assetFontLatoWoff2LightItalic = \"Lato-LightItalic.woff2\";\nexport const assetFontLatoWoffMedium = \"Lato-Medium.woff\";\nexport const assetFontLatoWoff2Medium = \"Lato-Medium.woff2\";\nexport const assetFontLatoWoffMediumItalic = \"Lato-MediumItalic.woff\";\nexport const assetFontLatoWoff2MediumItalic = \"Lato-MediumItalic.woff2\";\nexport const assetFontLatoWoffRegular = \"Lato-Regular.woff\";\nexport const assetFontLatoWoff2Regular = \"Lato-Regular.woff2\";\nexport const assetFontLatoWoffSemibold = \"Lato-Semibold.woff\";\nexport const assetFontLatoWoff2Semibold = \"Lato-Semibold.woff2\";\nexport const assetFontLatoWoffSemiboldItalic = \"Lato-SemiboldItalic.woff\";\nexport const assetFontLatoWoff2SemiboldItalic = \"Lato-SemiboldItalic.woff2\";\nexport const assetFontLatoWoffThin = \"Lato-Thin.woff\";\nexport const assetFontLatoWoff2Thin = \"Lato-Thin.woff2\";\nexport const assetFontLatoWoffThinItalic = \"Lato-ThinItalic.woff\";\nexport const assetFontLatoWoff2ThinItalic = \"Lato-ThinItalic.woff2\";\nexport const assetFontAzeretMonoName = \"Azeret Mono\";\nexport const assetFontAzeretMonoWoff2Regular = \"AzeretMono-Regular.woff2\";\nexport const colorBaseWhite = \"#ffffff\";\nexport const colorBaseBlack = \"#000000\";\nexport const colorBaseNeutral100 = \"#f2f4f7\";\nexport const colorBaseNeutral200 = \"#ebecf0\";\nexport const colorBaseNeutral300 = \"#d7dbe0\";\nexport const colorBaseNeutral400 = \"#697687\";\nexport const colorBaseNeutral500 = \"#515c6c\";\nexport const colorBaseNeutral600 = \"#394251\";\nexport const colorBaseNeutral700 = \"#1b1f26\";\nexport const colorBaseNeutralDark400 = \"#697687\";\nexport const colorBaseBrand100 = \"#c9e5e8\";\nexport const colorBaseBrand200 = \"#2db3c3\";\nexport const colorBaseBrand300 = \"#29a3b1\";\nexport const colorBaseBrand400 = \"#008194\";\nexport const colorBaseBrand500 = \"#017384\";\nexport const colorBaseBrand600 = \"#026371\";\nexport const colorBaseBrand700 = \"#175b63\";\nexport const colorBaseBrandDark400 = \"#93b4f2\";\nexport const colorBaseBrandDark500 = \"#93b4f2\";\nexport const colorBaseBrandDark600 = \"#93b4f2\";\nexport const colorBaseGreen100 = \"#d4ede4\";\nexport const colorBaseGreen200 = \"#00bb7d\";\nexport const colorBaseGreen300 = \"#00aa71\";\nexport const colorBaseGreen400 = \"#008458\";\nexport const colorBaseGreen500 = \"#00754e\";\nexport const colorBaseGreen600 = \"#006946\";\nexport const colorBaseGreen700 = \"#005f40\";\nexport const colorBaseOrange100 = \"#ffdea8\";\nexport const colorBaseOrange200 = \"#ffd694\";\nexport const colorBaseOrange300 = \"#ffce80\";\nexport const colorBaseOrange400 = \"#ebb663\";\nexport const colorBaseOrange500 = \"#d6a75a\";\nexport const colorBaseOrange600 = \"#b0853e\";\nexport const colorBaseOrange700 = \"#9f6100\";\nexport const colorBaseRed100 = \"#fbc7bb\";\nexport const colorBaseRed200 = \"#f68368\";\nexport const colorBaseRed300 = \"#f46a49\";\nexport const colorBaseRed400 = \"#d9340d\";\nexport const colorBaseRed500 = \"#c22e0b\";\nexport const colorBaseRed600 = \"#ae2a0a\";\nexport const colorBaseRed700 = \"#9e2609\";\nexport const colorThemePrimaryBg = \"#008194\";\nexport const colorThemePrimaryBgHover = \"#017384\";\nexport const colorThemePrimaryBgActive = \"#026371\";\nexport const colorThemePrimaryFill = \"#ffffff\";\nexport const colorThemePrimaryFillHover = \"#ffffff\";\nexport const colorThemePrimaryFillActive = \"#ffffff\";\nexport const colorThemePrimaryText = \"#008194\";\nexport const colorThemePrimaryTextHover = \"#017384\";\nexport const colorThemePrimaryTextActive = \"#026371\";\nexport const colorThemePrimaryDarkBg = \"#93b4f2\";\nexport const colorThemePrimaryDarkBgHover = \"#93b4f2\";\nexport const colorThemePrimaryDarkBgActive = \"#93b4f2\";\nexport const colorThemePrimaryDarkFill = \"#000000\";\nexport const colorThemePrimaryDarkFillHover = \"#000000\";\nexport const colorThemePrimaryDarkFillActive = \"#000000\";\nexport const colorThemePrimaryDarkText = \"#93b4f2\";\nexport const colorThemePrimaryDarkTextHover = \"#93b4f2\";\nexport const colorThemePrimaryDarkTextActive = \"#93b4f2\";\nexport const colorThemeSecondaryBg = \"#697687\";\nexport const colorThemeSecondaryBgHover = \"#697687\";\nexport const colorThemeSecondaryBgActive = \"#697687\";\nexport const colorThemeSecondaryFill = \"#ffffff\";\nexport const colorThemeSecondaryFillHover = \"#ffffff\";\nexport const colorThemeSecondaryFillActive = \"#ffffff\";\nexport const colorThemeSecondaryText = \"#000000\";\nexport const colorThemeSecondaryTextHover = \"#000000\";\nexport const colorThemeSecondaryTextActive = \"#000000\";\nexport const colorThemeSecondaryDarkBg = \"#697687\";\nexport const colorThemeSecondaryDarkBgHover = \"#697687\";\nexport const colorThemeSecondaryDarkBgActive = \"#697687\";\nexport const colorThemeSecondaryDarkFill = \"#000000\";\nexport const colorThemeSecondaryDarkFillHover = \"#000000\";\nexport const colorThemeSecondaryDarkFillActive = \"#000000\";\nexport const colorThemeSecondaryDarkText = \"#ffffff\";\nexport const colorThemeSecondaryDarkTextHover = \"#ffffff\";\nexport const colorThemeSecondaryDarkTextActive = \"#ffffff\";\nexport const colorThemeSuccessBg = \"#008458\";\nexport const colorThemeSuccessBgHover = \"#00754e\";\nexport const colorThemeSuccessBgActive = \"#006946\";\nexport const colorThemeSuccessFill = \"#ffffff\";\nexport const colorThemeSuccessFillHover = \"#ffffff\";\nexport const colorThemeSuccessFillActive = \"#ffffff\";\nexport const colorThemeSuccessText = \"#008458\";\nexport const colorThemeSuccessTextHover = \"#00754e\";\nexport const colorThemeSuccessTextActive = \"#006946\";\nexport const colorThemeWarningBg = \"#ffce80\";\nexport const colorThemeWarningBgHover = \"#ffd694\";\nexport const colorThemeWarningBgActive = \"#ffdea8\";\nexport const colorThemeWarningFill = \"#000000\";\nexport const colorThemeWarningFillHover = \"#000000\";\nexport const colorThemeWarningFillActive = \"#000000\";\nexport const colorThemeWarningText = \"#9f6100\";\nexport const colorThemeWarningTextHover = \"#9f6100\";\nexport const colorThemeWarningTextActive = \"#9f6100\";\nexport const colorThemeDangerBg = \"#d9340d\";\nexport const colorThemeDangerBgHover = \"#c22e0b\";\nexport const colorThemeDangerBgActive = \"#ae2a0a\";\nexport const colorThemeDangerFill = \"#ffffff\";\nexport const colorThemeDangerFillHover = \"#ffffff\";\nexport const colorThemeDangerFillActive = \"#ffffff\";\nexport const colorThemeDangerText = \"#d9340d\";\nexport const colorThemeDangerTextHover = \"#c22e0b\";\nexport const colorThemeDangerTextActive = \"#ae2a0a\";\nexport const colorUiBackgroundCanvas = \"#f2f4f7\";\nexport const colorUiBackgroundBody = \"#ffffff\";\nexport const colorUiBackgroundBodyDark = \"#1b1f26\";\nexport const colorUiBackgroundMuted = \"#f2f4f7\";\nexport const colorUiBackgroundInput = \"#ffffff\";\nexport const colorUiBackgroundSkeleton = \"#ebecf0\";\nexport const colorUiBackgroundSkeletonHighlight = \"#d7dbe0\";\nexport const colorUiBackgroundTooltip = \"#000000\";\nexport const colorUiBackgroundBackdrop = \"#000000\";\nexport const colorUiBorderLight = \"#f2f4f7\";\nexport const colorUiBorderDefault = \"#ebecf0\";\nexport const colorUiBorderDark = \"#d7dbe0\";\nexport const colorUiBorderFocus = \"#0071ff\";\nexport const colorUiBorderQuote = \"#697687\";\nexport const colorUiFontHead = \"#000000\";\nexport const colorUiFontHeadDark = \"#ffffff\";\nexport const colorUiFontBody = \"#000000\";\nexport const colorUiFontBodyDark = \"#ffffff\";\nexport const colorUiFontMono = \"#000000\";\nexport const colorUiFontMonoDark = \"#ffffff\";\nexport const colorUiFontMuted = \"#697687\";\nexport const colorUiFontQuote = \"#697687\";\nexport const colorUiFontTooltip = \"#ffffff\";\nexport const fontFamilyHead = \"Lato\";\nexport const fontFamilyBody = \"Lato\";\nexport const fontFamilyMono = \"Azeret Mono\";\nexport const fontFamilyEmoji = \"''\";\nexport const fontWeightHead = 500;\nexport const fontWeightBody = 400;\nexport const fontWeightMono = 400;\nexport const fontDecorationLink = \"none\";\nexport const fontDecorationLinkHover = \"underline\";\nexport const fontDecorationLinkButton = \"none\";\nexport const fontDecorationLinkButtonHover = \"none\";\nexport const opacityDisabled = 0.65;\nexport const opacityBackdrop = 0.6;\nexport const opacityTooltip = 1;\nexport const sizeBorderRadiusL = \"0.5rem\";\nexport const sizeBorderRadiusM = \"0.25rem\";\nexport const sizeBorderRadiusS = \"0.125rem\";\nexport const sizeFontHead1 = \"1.75rem\";\nexport const sizeFontHead2 = \"1.5rem\";\nexport const sizeFontHead3 = \"1.25rem\";\nexport const sizeFontHead4 = \"1.125rem\";\nexport const sizeFontHead5 = \"0.9375rem\";\nexport const sizeFontHead6 = \"0.875rem\";\nexport const sizeFontBodyXl = \"1.25rem\";\nexport const sizeFontBodyL = \"1.125rem\";\nexport const sizeFontBodyM = \"0.9375rem\";\nexport const sizeFontBodyS = \"0.875rem\";\nexport const sizeFontBodyXs = \"0.75rem\";\nexport const sizeFontMonoXl = \"1.125rem\";\nexport const sizeFontMonoL = \"0.9375rem\";\nexport const sizeFontMonoM = \"0.875rem\";\nexport const sizeFontMonoS = \"0.75rem\";\nexport const sizeFontMonoXs = \"0.625rem\";\nexport const sizeLineHead1 = \"2rem\";\nexport const sizeLineHead2 = \"1.75rem\";\nexport const sizeLineHead3 = \"1.5rem\";\nexport const sizeLineHead4 = \"1.5rem\";\nexport const sizeLineHead5 = \"1.25rem\";\nexport const sizeLineHead6 = \"1rem\";\nexport const sizeLineBodyXl = \"1.5rem\";\nexport const sizeLineBodyL = \"1.5rem\";\nexport const sizeLineBodyM = \"1.25rem\";\nexport const sizeLineBodyS = \"1rem\";\nexport const sizeLineBodyXs = \"1rem\";\nexport const sizeLineMonoXl = \"1.5rem\";\nexport const sizeLineMonoL = \"1.25rem\";\nexport const sizeLineMonoM = \"1.125rem\";\nexport const sizeLineMonoS = \"1rem\";\nexport const sizeLineMonoXs = \"0.875rem\";\nexport const sizeModalS = \"400rem\";\nexport const sizeModalM = \"600rem\";\nexport const sizeModalL = \"800rem\";\nexport const sizeScreenXs = \"540rem\";\nexport const sizeScreenS = \"768rem\";\nexport const sizeScreenM = \"992rem\";\nexport const sizeScreenL = \"1200rem\";\nexport const sizeScreenXl = \"1400rem\";\nexport const sizeSpacingXl = \"2rem\";\nexport const sizeSpacingL = \"1.5rem\";\nexport const sizeSpacingM = \"1rem\";\nexport const sizeSpacingS = \"0.5rem\";\nexport const sizeSpacingXs = \"0.25rem\";\nexport const timeTransitionL = 500;\nexport const timeTransitionM = 250;\nexport const timeTransitionS = 125;\nexport const timeDelayL = 500;\nexport const timeDelayM = 250;\nexport const timeDelayS = 125;\nexport const timeDurationL = 1000;\nexport const timeDurationM = 500;\nexport const timeDurationS = 250;","@import 'variables';\n@import 'mixins';\n\n$-min-width: 8rem;\n$-max-width: 16rem;\n$-min-height: 2rem;\n$-max-height: calc(100vh - 48px);\n\n:host {\n display: contents;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n::slotted(nav) {\n padding-top: $cat-body-margin-bottom * 0.5;\n padding-bottom: $cat-body-margin-bottom * 0.5;\n min-width: $-min-width;\n max-width: $-max-width;\n}\n\n.content {\n position: absolute;\n background: cat-token('color.ui.background.body');\n display: none;\n -webkit-overflow-scrolling: touch;\n min-height: $-min-height;\n max-height: $-max-height;\n @include cat-elevation(4);\n border-radius: cat-border-radius('m');\n z-index: $cat-dropdown-z-index;\n opacity: 0;\n transition: transform cat-token('time.transition.s') cubic-bezier(0.3, 0, 0.8, 0.15),\n opacity cat-token('time.transition.s') cubic-bezier(0.3, 0, 0.8, 0.15);\n\n &[data-placement^='top'] {\n transform: translateY(1rem);\n }\n\n &[data-placement^='left'] {\n transform: translateX(1rem);\n }\n\n &[data-placement^='right'] {\n transform: translateX(-1rem);\n }\n\n &[data-placement^='bottom'] {\n transform: translateY(-1rem);\n }\n\n &.show {\n opacity: 1;\n transform: translateX(0);\n transform: translateY(0);\n transition: transform cat-token('time.transition.l') cubic-bezier(0.05, 0.7, 0.1, 1),\n opacity cat-token('time.transition.l') cubic-bezier(0.05, 0.7, 0.1, 1);\n }\n\n &.overflow-auto {\n overflow: auto;\n }\n}\n","import { autoUpdate, computePosition, flip, offset, Placement } from '@floating-ui/dom';\nimport { timeTransitionS } from '@haiilo/catalyst-tokens';\nimport { Component, Event, EventEmitter, h, Host, Listen, Method, Prop } from '@stencil/core';\nimport * as focusTrap from 'focus-trap';\nimport { FocusableElement, tabbable } from 'tabbable';\nimport firstTabbable from '../../utils/first-tabbable';\n\nlet nextUniqueId = 0;\n\n@Component({\n tag: 'cat-dropdown',\n styleUrl: 'cat-dropdown.scss',\n shadow: true\n})\nexport class CatDropdown {\n private static readonly OFFSET = 4;\n private readonly id = nextUniqueId++;\n private triggerSlot!: HTMLSlotElement;\n private trigger?: FocusableElement;\n private content!: HTMLElement;\n private trap?: focusTrap.FocusTrap;\n private keyListener?: (event: KeyboardEvent) => void;\n private isOpen: boolean | null = false;\n\n /**\n * The placement of the dropdown.\n */\n @Prop() placement: Placement = 'bottom-start';\n\n /**\n * Do not close the dropdown on outside clicks.\n */\n @Prop() noAutoClose = false;\n\n /**\n * Allow overflow when dropdown is open.\n */\n @Prop() overflow = false;\n\n /**\n * Emitted when the dropdown is opened.\n */\n @Event() catOpen!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the dropdown is closed.\n */\n @Event() catClose!: EventEmitter<FocusEvent>;\n\n @Listen('catClick')\n clickHandler(event: CustomEvent<MouseEvent>) {\n // we need to delay the initialization of the trigger until first,\n // interaction because the element might still be hidden (and thus not\n // tabbable) if contained in another Stencil web component\n if (!this.trigger) {\n this.initTrigger();\n this.toggle();\n }\n\n // hide dropdown on button click\n if (!this.noAutoClose && event.composedPath().includes(this.content)) {\n this.close();\n }\n }\n\n /**\n * Toggles the dropdown.\n */\n async toggle(): Promise<void> {\n this.isOpen ? this.close() : this.open();\n }\n\n /**\n * Opens the dropdown.\n */\n async open(): Promise<void> {\n if (this.isOpen === null) {\n return; // busy\n }\n\n this.isOpen = null;\n this.content.style.display = 'block';\n // give CSS transition time to apply\n setTimeout(() => {\n this.isOpen = true;\n this.content.classList.add('show');\n this.trigger?.setAttribute('aria-expanded', 'true');\n this.catOpen.emit();\n this.trap = this.trap\n ? this.trap.updateContainerElements(this.content)\n : focusTrap.createFocusTrap(this.content, {\n tabbableOptions: {\n getShadowRoot: true\n },\n allowOutsideClick: true,\n clickOutsideDeactivates: event =>\n !this.noAutoClose &&\n !event.composedPath().includes(this.content) &&\n (!this.trigger || !event.composedPath().includes(this.trigger)),\n onPostDeactivate: () => this.close()\n });\n this.trap.activate();\n });\n }\n\n /**\n * Closes the dropdown.\n */\n @Method()\n async close(): Promise<void> {\n if (this.isOpen === null) {\n return; // busy\n }\n\n this.isOpen = null;\n this.content.classList.remove('show');\n // give CSS transition time to apply\n setTimeout(() => {\n this.isOpen = false;\n this.content.classList.remove('show');\n this.content.style.display = '';\n this.trigger?.setAttribute('aria-expanded', 'false');\n this.trap?.deactivate();\n this.catClose.emit();\n }, timeTransitionS);\n }\n\n componentDidLoad(): void {\n this.keyListener = event => {\n if (this.isOpen && ['ArrowDown', 'ArrowUp'].includes(event.key)) {\n const targetElements = tabbable(this.content, { includeContainer: false, getShadowRoot: true });\n const activeElement = firstTabbable(document.activeElement);\n const activeIdx = activeElement ? targetElements.indexOf(activeElement) : -1;\n const activeOff = event.key === 'ArrowDown' ? 1 : -1;\n const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;\n targetElements[targetIdx].focus();\n event.preventDefault();\n }\n };\n document.addEventListener('keydown', this.keyListener);\n }\n\n disconnectedCallback(): void {\n if (this.keyListener) {\n document.removeEventListener('keydown', this.keyListener);\n }\n }\n\n render() {\n return (\n <Host>\n <slot name=\"trigger\" ref={el => (this.triggerSlot = el as HTMLSlotElement)}></slot>\n <div\n id={this.contentId}\n class={{ content: true, 'overflow-auto': !this.overflow }}\n ref={el => (this.content = el as HTMLElement)}\n >\n <slot name=\"content\"></slot>\n </div>\n </Host>\n );\n }\n\n private get contentId() {\n return `cat-dropdown-${this.id}`;\n }\n\n private initTrigger() {\n this.trigger = this.findTrigger();\n this.trigger.setAttribute('aria-haspopup', 'true');\n this.trigger.setAttribute('aria-expanded', 'false');\n this.trigger.setAttribute('aria-controls', this.contentId);\n this.trigger.addEventListener('click', () => this.toggle());\n autoUpdate(this.trigger, this.content, () => this.update());\n }\n\n private findTrigger() {\n let trigger: FocusableElement | undefined;\n const elems = this.triggerSlot?.assignedElements?.() || [];\n while (!trigger && elems.length) {\n const elem = elems.shift();\n trigger = elem?.hasAttribute('data-trigger')\n ? (elem as HTMLElement)\n : elem?.querySelector('[data-trigger]') ?? undefined;\n }\n if (!trigger) {\n trigger = firstTabbable(this.triggerSlot);\n }\n if (!trigger) {\n throw new Error('Cannot find tabbable element. Use [data-trigger] to set the trigger.');\n }\n return trigger;\n }\n\n private update() {\n if (this.trigger) {\n computePosition(this.trigger, this.content, {\n placement: this.placement,\n middleware: [offset(CatDropdown.OFFSET), flip()]\n }).then(({ x, y, placement }) => {\n this.content.dataset.placement = placement;\n Object.assign(this.content.style, {\n left: `${x}px`,\n top: `${y}px`\n });\n });\n }\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"cat-dropdown2.js","mappings":";;;;;AAAA;AACA;AACA;AA+OO,MAAM,eAAe,GAAG,GAAG;;ACjPlC,MAAM,cAAc,GAAG,yhCAAyhC;;ACOhjC,IAAI,YAAY,GAAG,CAAC,CAAC;MAOR,WAAW;EALxB;;;;;;IAOmB,OAAE,GAAG,YAAY,EAAE,CAAC;IAM7B,WAAM,GAAmB,KAAK,CAAC;;;;IAK/B,cAAS,GAAc,cAAc,CAAC;;;;IAKtC,gBAAW,GAAG,KAAK,CAAC;;;;IAKpB,aAAQ,GAAG,KAAK,CAAC;GA2K1B;EA9JC,YAAY,CAAC,KAA8B;;;;IAIzC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;MACjB,IAAI,CAAC,WAAW,EAAE,CAAC;MACnB,IAAI,CAAC,MAAM,EAAE,CAAC;KACf;;IAGD,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;MACpE,IAAI,CAAC,KAAK,EAAE,CAAC;KACd;GACF;;;;EAKD,MAAM,MAAM;IACV,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;GAC1C;;;;EAKD,MAAM,IAAI;IACR,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE;MACxB,OAAO;KACR;IAED,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACnB,IAAI,CAAC,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?tag=cat-dropdown&encapsulation=shadow","./src/components/cat-dropdown/cat-dropdown.tsx"],"sourcesContent":["/**\n * Auto-generated file. Do not edit directly.\n */\n\nexport const assetFontDmSansName = \"DM Sans\";\nexport const assetFontDmSansWoff2Bold = \"DMSans-Bold.woff2\";\nexport const assetFontDmSansWoff2BoldItalic = \"DMSans-BoldItalic.woff2\";\nexport const assetFontDmSansWoff2Italic = \"DMSans-Italic.woff2\";\nexport const assetFontDmSansWoff2Medium = \"DMSans-Medium.woff2\";\nexport const assetFontDmSansWoff2MediumItalic = \"DMSans-MediumItalic.woff2\";\nexport const assetFontDmSansWoff2Regular = \"DMSans-Regular.woff2\";\nexport const assetFontLatoName = \"Lato\";\nexport const assetFontLatoWoffBlack = \"Lato-Black.woff\";\nexport const assetFontLatoWoff2Black = \"Lato-Black.woff2\";\nexport const assetFontLatoWoffBlackItalic = \"Lato-BlackItalic.woff\";\nexport const assetFontLatoWoff2BlackItalic = \"Lato-BlackItalic.woff2\";\nexport const assetFontLatoWoffBold = \"Lato-Bold.woff\";\nexport const assetFontLatoWoff2Bold = \"Lato-Bold.woff2\";\nexport const assetFontLatoWoffBoldItalic = \"Lato-BoldItalic.woff\";\nexport const assetFontLatoWoff2BoldItalic = \"Lato-BoldItalic.woff2\";\nexport const assetFontLatoWoffHairline = \"Lato-Hairline.woff\";\nexport const assetFontLatoWoff2Hairline = \"Lato-Hairline.woff2\";\nexport const assetFontLatoWoffHairlineItalic = \"Lato-HairlineItalic.woff\";\nexport const assetFontLatoWoff2HairlineItalic = \"Lato-HairlineItalic.woff2\";\nexport const assetFontLatoWoffHeavy = \"Lato-Heavy.woff\";\nexport const assetFontLatoWoff2Heavy = \"Lato-Heavy.woff2\";\nexport const assetFontLatoWoffHeavyItalic = \"Lato-HeavyItalic.woff\";\nexport const assetFontLatoWoff2HeavyItalic = \"Lato-HeavyItalic.woff2\";\nexport const assetFontLatoWoffItalic = \"Lato-Italic.woff\";\nexport const assetFontLatoWoff2Italic = \"Lato-Italic.woff2\";\nexport const assetFontLatoWoffLight = \"Lato-Light.woff\";\nexport const assetFontLatoWoff2Light = \"Lato-Light.woff2\";\nexport const assetFontLatoWoffLightItalic = \"Lato-LightItalic.woff\";\nexport const assetFontLatoWoff2LightItalic = \"Lato-LightItalic.woff2\";\nexport const assetFontLatoWoffMedium = \"Lato-Medium.woff\";\nexport const assetFontLatoWoff2Medium = \"Lato-Medium.woff2\";\nexport const assetFontLatoWoffMediumItalic = \"Lato-MediumItalic.woff\";\nexport const assetFontLatoWoff2MediumItalic = \"Lato-MediumItalic.woff2\";\nexport const assetFontLatoWoffRegular = \"Lato-Regular.woff\";\nexport const assetFontLatoWoff2Regular = \"Lato-Regular.woff2\";\nexport const assetFontLatoWoffSemibold = \"Lato-Semibold.woff\";\nexport const assetFontLatoWoff2Semibold = \"Lato-Semibold.woff2\";\nexport const assetFontLatoWoffSemiboldItalic = \"Lato-SemiboldItalic.woff\";\nexport const assetFontLatoWoff2SemiboldItalic = \"Lato-SemiboldItalic.woff2\";\nexport const assetFontLatoWoffThin = \"Lato-Thin.woff\";\nexport const assetFontLatoWoff2Thin = \"Lato-Thin.woff2\";\nexport const assetFontLatoWoffThinItalic = \"Lato-ThinItalic.woff\";\nexport const assetFontLatoWoff2ThinItalic = \"Lato-ThinItalic.woff2\";\nexport const assetFontAzeretMonoName = \"Azeret Mono\";\nexport const assetFontAzeretMonoWoff2Regular = \"AzeretMono-Regular.woff2\";\nexport const colorBaseWhite = \"#ffffff\";\nexport const colorBaseBlack = \"#000000\";\nexport const colorBaseNeutral100 = \"#f2f4f7\";\nexport const colorBaseNeutral200 = \"#ebecf0\";\nexport const colorBaseNeutral300 = \"#d7dbe0\";\nexport const colorBaseNeutral400 = \"#697687\";\nexport const colorBaseNeutral500 = \"#515c6c\";\nexport const colorBaseNeutral600 = \"#394251\";\nexport const colorBaseNeutral700 = \"#1b1f26\";\nexport const colorBaseNeutralDark400 = \"#697687\";\nexport const colorBaseBrand100 = \"#c9e5e8\";\nexport const colorBaseBrand200 = \"#2db3c3\";\nexport const colorBaseBrand300 = \"#29a3b1\";\nexport const colorBaseBrand400 = \"#008194\";\nexport const colorBaseBrand500 = \"#017384\";\nexport const colorBaseBrand600 = \"#026371\";\nexport const colorBaseBrand700 = \"#175b63\";\nexport const colorBaseBrandDark400 = \"#93b4f2\";\nexport const colorBaseBrandDark500 = \"#93b4f2\";\nexport const colorBaseBrandDark600 = \"#93b4f2\";\nexport const colorBaseGreen100 = \"#d4ede4\";\nexport const colorBaseGreen200 = \"#00bb7d\";\nexport const colorBaseGreen300 = \"#00aa71\";\nexport const colorBaseGreen400 = \"#008458\";\nexport const colorBaseGreen500 = \"#00754e\";\nexport const colorBaseGreen600 = \"#006946\";\nexport const colorBaseGreen700 = \"#005f40\";\nexport const colorBaseOrange100 = \"#ffdea8\";\nexport const colorBaseOrange200 = \"#ffd694\";\nexport const colorBaseOrange300 = \"#ffce80\";\nexport const colorBaseOrange400 = \"#ebb663\";\nexport const colorBaseOrange500 = \"#d6a75a\";\nexport const colorBaseOrange600 = \"#b0853e\";\nexport const colorBaseOrange700 = \"#9f6100\";\nexport const colorBaseRed100 = \"#fbc7bb\";\nexport const colorBaseRed200 = \"#f68368\";\nexport const colorBaseRed300 = \"#f46a49\";\nexport const colorBaseRed400 = \"#d9340d\";\nexport const colorBaseRed500 = \"#c22e0b\";\nexport const colorBaseRed600 = \"#ae2a0a\";\nexport const colorBaseRed700 = \"#9e2609\";\nexport const colorThemePrimaryBg = \"#008194\";\nexport const colorThemePrimaryBgHover = \"#017384\";\nexport const colorThemePrimaryBgActive = \"#026371\";\nexport const colorThemePrimaryFill = \"#ffffff\";\nexport const colorThemePrimaryFillHover = \"#ffffff\";\nexport const colorThemePrimaryFillActive = \"#ffffff\";\nexport const colorThemePrimaryText = \"#008194\";\nexport const colorThemePrimaryTextHover = \"#017384\";\nexport const colorThemePrimaryTextActive = \"#026371\";\nexport const colorThemePrimaryDarkBg = \"#93b4f2\";\nexport const colorThemePrimaryDarkBgHover = \"#93b4f2\";\nexport const colorThemePrimaryDarkBgActive = \"#93b4f2\";\nexport const colorThemePrimaryDarkFill = \"#000000\";\nexport const colorThemePrimaryDarkFillHover = \"#000000\";\nexport const colorThemePrimaryDarkFillActive = \"#000000\";\nexport const colorThemePrimaryDarkText = \"#93b4f2\";\nexport const colorThemePrimaryDarkTextHover = \"#93b4f2\";\nexport const colorThemePrimaryDarkTextActive = \"#93b4f2\";\nexport const colorThemeSecondaryBg = \"#697687\";\nexport const colorThemeSecondaryBgHover = \"#697687\";\nexport const colorThemeSecondaryBgActive = \"#697687\";\nexport const colorThemeSecondaryFill = \"#ffffff\";\nexport const colorThemeSecondaryFillHover = \"#ffffff\";\nexport const colorThemeSecondaryFillActive = \"#ffffff\";\nexport const colorThemeSecondaryText = \"#000000\";\nexport const colorThemeSecondaryTextHover = \"#000000\";\nexport const colorThemeSecondaryTextActive = \"#000000\";\nexport const colorThemeSecondaryDarkBg = \"#697687\";\nexport const colorThemeSecondaryDarkBgHover = \"#697687\";\nexport const colorThemeSecondaryDarkBgActive = \"#697687\";\nexport const colorThemeSecondaryDarkFill = \"#000000\";\nexport const colorThemeSecondaryDarkFillHover = \"#000000\";\nexport const colorThemeSecondaryDarkFillActive = \"#000000\";\nexport const colorThemeSecondaryDarkText = \"#ffffff\";\nexport const colorThemeSecondaryDarkTextHover = \"#ffffff\";\nexport const colorThemeSecondaryDarkTextActive = \"#ffffff\";\nexport const colorThemeSuccessBg = \"#008458\";\nexport const colorThemeSuccessBgHover = \"#00754e\";\nexport const colorThemeSuccessBgActive = \"#006946\";\nexport const colorThemeSuccessFill = \"#ffffff\";\nexport const colorThemeSuccessFillHover = \"#ffffff\";\nexport const colorThemeSuccessFillActive = \"#ffffff\";\nexport const colorThemeSuccessText = \"#008458\";\nexport const colorThemeSuccessTextHover = \"#00754e\";\nexport const colorThemeSuccessTextActive = \"#006946\";\nexport const colorThemeWarningBg = \"#ffce80\";\nexport const colorThemeWarningBgHover = \"#ffd694\";\nexport const colorThemeWarningBgActive = \"#ffdea8\";\nexport const colorThemeWarningFill = \"#000000\";\nexport const colorThemeWarningFillHover = \"#000000\";\nexport const colorThemeWarningFillActive = \"#000000\";\nexport const colorThemeWarningText = \"#9f6100\";\nexport const colorThemeWarningTextHover = \"#9f6100\";\nexport const colorThemeWarningTextActive = \"#9f6100\";\nexport const colorThemeDangerBg = \"#d9340d\";\nexport const colorThemeDangerBgHover = \"#c22e0b\";\nexport const colorThemeDangerBgActive = \"#ae2a0a\";\nexport const colorThemeDangerFill = \"#ffffff\";\nexport const colorThemeDangerFillHover = \"#ffffff\";\nexport const colorThemeDangerFillActive = \"#ffffff\";\nexport const colorThemeDangerText = \"#d9340d\";\nexport const colorThemeDangerTextHover = \"#c22e0b\";\nexport const colorThemeDangerTextActive = \"#ae2a0a\";\nexport const colorUiBackgroundCanvas = \"#f2f4f7\";\nexport const colorUiBackgroundBody = \"#ffffff\";\nexport const colorUiBackgroundBodyDark = \"#1b1f26\";\nexport const colorUiBackgroundMuted = \"#f2f4f7\";\nexport const colorUiBackgroundInput = \"#ffffff\";\nexport const colorUiBackgroundSkeleton = \"#ebecf0\";\nexport const colorUiBackgroundSkeletonHighlight = \"#d7dbe0\";\nexport const colorUiBackgroundTooltip = \"#000000\";\nexport const colorUiBackgroundBackdrop = \"#1b1f26\";\nexport const colorUiBorderLight = \"#f2f4f7\";\nexport const colorUiBorderDefault = \"#ebecf0\";\nexport const colorUiBorderDark = \"#d7dbe0\";\nexport const colorUiBorderFocus = \"#0071ff\";\nexport const colorUiBorderQuote = \"#697687\";\nexport const colorUiFontHead = \"#000000\";\nexport const colorUiFontHeadDark = \"#ffffff\";\nexport const colorUiFontBody = \"#000000\";\nexport const colorUiFontBodyDark = \"#ffffff\";\nexport const colorUiFontMono = \"#000000\";\nexport const colorUiFontMonoDark = \"#ffffff\";\nexport const colorUiFontMuted = \"#697687\";\nexport const colorUiFontQuote = \"#697687\";\nexport const colorUiFontTooltip = \"#ffffff\";\nexport const fontFamilyHead = \"Lato\";\nexport const fontFamilyBody = \"Lato\";\nexport const fontFamilyMono = \"Azeret Mono\";\nexport const fontFamilyEmoji = \"''\";\nexport const fontWeightHead = 500;\nexport const fontWeightBody = 400;\nexport const fontWeightMono = 400;\nexport const fontDecorationLink = \"none\";\nexport const fontDecorationLinkHover = \"underline\";\nexport const fontDecorationLinkButton = \"none\";\nexport const fontDecorationLinkButtonHover = \"none\";\nexport const opacityDisabled = 0.65;\nexport const opacityBackdrop = 0.4;\nexport const opacityTooltip = 1;\nexport const sizeBorderRadiusL = \"0.5rem\";\nexport const sizeBorderRadiusM = \"0.25rem\";\nexport const sizeBorderRadiusS = \"0.125rem\";\nexport const sizeFontHead1 = \"1.75rem\";\nexport const sizeFontHead2 = \"1.5rem\";\nexport const sizeFontHead3 = \"1.25rem\";\nexport const sizeFontHead4 = \"1.125rem\";\nexport const sizeFontHead5 = \"0.9375rem\";\nexport const sizeFontHead6 = \"0.875rem\";\nexport const sizeFontBodyXl = \"1.25rem\";\nexport const sizeFontBodyL = \"1.125rem\";\nexport const sizeFontBodyM = \"0.9375rem\";\nexport const sizeFontBodyS = \"0.875rem\";\nexport const sizeFontBodyXs = \"0.75rem\";\nexport const sizeFontMonoXl = \"1.125rem\";\nexport const sizeFontMonoL = \"0.9375rem\";\nexport const sizeFontMonoM = \"0.875rem\";\nexport const sizeFontMonoS = \"0.75rem\";\nexport const sizeFontMonoXs = \"0.625rem\";\nexport const sizeLineHead1 = \"2rem\";\nexport const sizeLineHead2 = \"1.75rem\";\nexport const sizeLineHead3 = \"1.5rem\";\nexport const sizeLineHead4 = \"1.5rem\";\nexport const sizeLineHead5 = \"1.25rem\";\nexport const sizeLineHead6 = \"1rem\";\nexport const sizeLineBodyXl = \"1.5rem\";\nexport const sizeLineBodyL = \"1.5rem\";\nexport const sizeLineBodyM = \"1.25rem\";\nexport const sizeLineBodyS = \"1rem\";\nexport const sizeLineBodyXs = \"1rem\";\nexport const sizeLineMonoXl = \"1.5rem\";\nexport const sizeLineMonoL = \"1.25rem\";\nexport const sizeLineMonoM = \"1.125rem\";\nexport const sizeLineMonoS = \"1rem\";\nexport const sizeLineMonoXs = \"0.875rem\";\nexport const sizeModalS = \"400rem\";\nexport const sizeModalM = \"600rem\";\nexport const sizeModalL = \"800rem\";\nexport const sizeScreenXs = \"540rem\";\nexport const sizeScreenS = \"768rem\";\nexport const sizeScreenM = \"992rem\";\nexport const sizeScreenL = \"1200rem\";\nexport const sizeScreenXl = \"1400rem\";\nexport const sizeSpacingXl = \"2rem\";\nexport const sizeSpacingL = \"1.5rem\";\nexport const sizeSpacingM = \"1rem\";\nexport const sizeSpacingS = \"0.5rem\";\nexport const sizeSpacingXs = \"0.25rem\";\nexport const timeTransitionL = 500;\nexport const timeTransitionM = 250;\nexport const timeTransitionS = 125;\nexport const timeDelayL = 500;\nexport const timeDelayM = 250;\nexport const timeDelayS = 125;\nexport const timeDurationL = 1000;\nexport const timeDurationM = 500;\nexport const timeDurationS = 250;","@import 'variables';\n@import 'mixins';\n\n$-min-width: 8rem;\n$-max-width: 16rem;\n$-min-height: 2rem;\n$-max-height: calc(100vh - 48px);\n\n:host {\n display: contents;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n::slotted(nav) {\n padding-top: $cat-body-margin-bottom * 0.5;\n padding-bottom: $cat-body-margin-bottom * 0.5;\n min-width: $-min-width;\n max-width: $-max-width;\n}\n\n.content {\n position: absolute;\n background: cat-token('color.ui.background.body');\n display: none;\n -webkit-overflow-scrolling: touch;\n min-height: $-min-height;\n max-height: $-max-height;\n @include cat-elevation(4);\n border-radius: cat-border-radius('m');\n z-index: $cat-dropdown-z-index;\n opacity: 0;\n transition: transform cat-token('time.transition.s') cubic-bezier(0.3, 0, 0.8, 0.15),\n opacity cat-token('time.transition.s') cubic-bezier(0.3, 0, 0.8, 0.15);\n\n &[data-placement^='top'] {\n transform: translateY(1rem);\n }\n\n &[data-placement^='left'] {\n transform: translateX(1rem);\n }\n\n &[data-placement^='right'] {\n transform: translateX(-1rem);\n }\n\n &[data-placement^='bottom'] {\n transform: translateY(-1rem);\n }\n\n &.show {\n opacity: 1;\n transform: translateX(0);\n transform: translateY(0);\n transition: transform cat-token('time.transition.l') cubic-bezier(0.05, 0.7, 0.1, 1),\n opacity cat-token('time.transition.l') cubic-bezier(0.05, 0.7, 0.1, 1);\n }\n\n &.overflow-auto {\n overflow: auto;\n }\n}\n","import { autoUpdate, computePosition, flip, offset, Placement } from '@floating-ui/dom';\nimport { timeTransitionS } from '@haiilo/catalyst-tokens';\nimport { Component, Event, EventEmitter, h, Host, Listen, Method, Prop } from '@stencil/core';\nimport * as focusTrap from 'focus-trap';\nimport { FocusableElement, tabbable } from 'tabbable';\nimport firstTabbable from '../../utils/first-tabbable';\n\nlet nextUniqueId = 0;\n\n@Component({\n tag: 'cat-dropdown',\n styleUrl: 'cat-dropdown.scss',\n shadow: true\n})\nexport class CatDropdown {\n private static readonly OFFSET = 4;\n private readonly id = nextUniqueId++;\n private triggerSlot!: HTMLSlotElement;\n private trigger?: FocusableElement;\n private content!: HTMLElement;\n private trap?: focusTrap.FocusTrap;\n private keyListener?: (event: KeyboardEvent) => void;\n private isOpen: boolean | null = false;\n\n /**\n * The placement of the dropdown.\n */\n @Prop() placement: Placement = 'bottom-start';\n\n /**\n * Do not close the dropdown on outside clicks.\n */\n @Prop() noAutoClose = false;\n\n /**\n * Allow overflow when dropdown is open.\n */\n @Prop() overflow = false;\n\n /**\n * Emitted when the dropdown is opened.\n */\n @Event() catOpen!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the dropdown is closed.\n */\n @Event() catClose!: EventEmitter<FocusEvent>;\n\n @Listen('catClick')\n clickHandler(event: CustomEvent<MouseEvent>) {\n // we need to delay the initialization of the trigger until first,\n // interaction because the element might still be hidden (and thus not\n // tabbable) if contained in another Stencil web component\n if (!this.trigger) {\n this.initTrigger();\n this.toggle();\n }\n\n // hide dropdown on button click\n if (!this.noAutoClose && event.composedPath().includes(this.content)) {\n this.close();\n }\n }\n\n /**\n * Toggles the dropdown.\n */\n async toggle(): Promise<void> {\n this.isOpen ? this.close() : this.open();\n }\n\n /**\n * Opens the dropdown.\n */\n async open(): Promise<void> {\n if (this.isOpen === null) {\n return; // busy\n }\n\n this.isOpen = null;\n this.content.style.display = 'block';\n // give CSS transition time to apply\n setTimeout(() => {\n this.isOpen = true;\n this.content.classList.add('show');\n this.trigger?.setAttribute('aria-expanded', 'true');\n this.catOpen.emit();\n this.trap = this.trap\n ? this.trap.updateContainerElements(this.content)\n : focusTrap.createFocusTrap(this.content, {\n tabbableOptions: {\n getShadowRoot: true\n },\n allowOutsideClick: true,\n clickOutsideDeactivates: event =>\n !this.noAutoClose &&\n !event.composedPath().includes(this.content) &&\n (!this.trigger || !event.composedPath().includes(this.trigger)),\n onPostDeactivate: () => this.close()\n });\n this.trap.activate();\n });\n }\n\n /**\n * Closes the dropdown.\n */\n @Method()\n async close(): Promise<void> {\n if (this.isOpen === null) {\n return; // busy\n }\n\n this.isOpen = null;\n this.content.classList.remove('show');\n // give CSS transition time to apply\n setTimeout(() => {\n this.isOpen = false;\n this.content.classList.remove('show');\n this.content.style.display = '';\n this.trigger?.setAttribute('aria-expanded', 'false');\n this.trap?.deactivate();\n this.catClose.emit();\n }, timeTransitionS);\n }\n\n componentDidLoad(): void {\n this.keyListener = event => {\n if (this.isOpen && ['ArrowDown', 'ArrowUp'].includes(event.key)) {\n const targetElements = tabbable(this.content, { includeContainer: false, getShadowRoot: true });\n const activeElement = firstTabbable(document.activeElement);\n const activeIdx = activeElement ? targetElements.indexOf(activeElement) : -1;\n const activeOff = event.key === 'ArrowDown' ? 1 : -1;\n const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;\n targetElements[targetIdx].focus();\n event.preventDefault();\n }\n };\n document.addEventListener('keydown', this.keyListener);\n }\n\n disconnectedCallback(): void {\n if (this.keyListener) {\n document.removeEventListener('keydown', this.keyListener);\n }\n }\n\n render() {\n return (\n <Host>\n <slot name=\"trigger\" ref={el => (this.triggerSlot = el as HTMLSlotElement)}></slot>\n <div\n id={this.contentId}\n class={{ content: true, 'overflow-auto': !this.overflow }}\n ref={el => (this.content = el as HTMLElement)}\n >\n <slot name=\"content\"></slot>\n </div>\n </Host>\n );\n }\n\n private get contentId() {\n return `cat-dropdown-${this.id}`;\n }\n\n private initTrigger() {\n this.trigger = this.findTrigger();\n this.trigger.setAttribute('aria-haspopup', 'true');\n this.trigger.setAttribute('aria-expanded', 'false');\n this.trigger.setAttribute('aria-controls', this.contentId);\n this.trigger.addEventListener('click', () => this.toggle());\n autoUpdate(this.trigger, this.content, () => this.update());\n }\n\n private findTrigger() {\n let trigger: FocusableElement | undefined;\n const elems = this.triggerSlot?.assignedElements?.() || [];\n while (!trigger && elems.length) {\n const elem = elems.shift();\n trigger = elem?.hasAttribute('data-trigger')\n ? (elem as HTMLElement)\n : elem?.querySelector('[data-trigger]') ?? undefined;\n }\n if (!trigger) {\n trigger = firstTabbable(this.triggerSlot);\n }\n if (!trigger) {\n throw new Error('Cannot find tabbable element. Use [data-trigger] to set the trigger.');\n }\n return trigger;\n }\n\n private update() {\n if (this.trigger) {\n computePosition(this.trigger, this.content, {\n placement: this.placement,\n middleware: [offset(CatDropdown.OFFSET), flip()]\n }).then(({ x, y, placement }) => {\n this.content.dataset.placement = placement;\n Object.assign(this.content.style, {\n left: `${x}px`,\n top: `${y}px`\n });\n });\n }\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface CatFormGroup extends Components.CatFormGroup, HTMLElement {}
|
|
4
|
+
export const CatFormGroup: {
|
|
5
|
+
prototype: CatFormGroup;
|
|
6
|
+
new (): CatFormGroup;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const catFormGroupCss = ":host{display:block}";
|
|
4
|
+
|
|
5
|
+
const CatFormGroup$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
this.formElements = [];
|
|
11
|
+
/**
|
|
12
|
+
* Whether the labels need a marker to shown if the forms fields are required or optional.<br /><br />
|
|
13
|
+
* By default, it is set to auto, it will display the mark depending on the number of required and optional fields: <br />
|
|
14
|
+
* - If there are more required, the optional will be marked.<br />
|
|
15
|
+
* - If there are less required, it will mark the required.<br /><br />
|
|
16
|
+
* If a form field had "!", the requiredMarked of the field would not change.
|
|
17
|
+
*/
|
|
18
|
+
this.requiredMarker = 'auto';
|
|
19
|
+
}
|
|
20
|
+
onRequiredMarker(newRequiredMarker) {
|
|
21
|
+
const updateMarker = newRequiredMarker === 'auto' ? this.calculate(this.formElements) : newRequiredMarker;
|
|
22
|
+
this.formElements.forEach(element => { var _a; return !((_a = element.requiredMarker) === null || _a === void 0 ? void 0 : _a.endsWith('!')) && (element.requiredMarker = updateMarker); });
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return (h(Host, null, h("slot", { onSlotchange: this.onSlotChange.bind(this) })));
|
|
26
|
+
}
|
|
27
|
+
onSlotChange() {
|
|
28
|
+
this.formElements = Array.from(this.hostElement.querySelectorAll('cat-textarea, cat-input, cat-select, cat-label'));
|
|
29
|
+
this.onRequiredMarker(this.requiredMarker);
|
|
30
|
+
}
|
|
31
|
+
calculate(elements) {
|
|
32
|
+
const formFields = elements.filter(value => value.tagName !== 'CAT-LABEL');
|
|
33
|
+
const optionalFields = formFields.filter(value => !value.required).length;
|
|
34
|
+
const requiredFields = formFields.length - optionalFields;
|
|
35
|
+
return requiredFields >= optionalFields ? 'optional' : 'required';
|
|
36
|
+
}
|
|
37
|
+
get hostElement() { return this; }
|
|
38
|
+
static get watchers() { return {
|
|
39
|
+
"requiredMarker": ["onRequiredMarker"]
|
|
40
|
+
}; }
|
|
41
|
+
static get style() { return catFormGroupCss; }
|
|
42
|
+
}, [1, "cat-form-group", {
|
|
43
|
+
"requiredMarker": [1, "required-marker"]
|
|
44
|
+
}]);
|
|
45
|
+
function defineCustomElement$1() {
|
|
46
|
+
if (typeof customElements === "undefined") {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const components = ["cat-form-group"];
|
|
50
|
+
components.forEach(tagName => { switch (tagName) {
|
|
51
|
+
case "cat-form-group":
|
|
52
|
+
if (!customElements.get(tagName)) {
|
|
53
|
+
customElements.define(tagName, CatFormGroup$1);
|
|
54
|
+
}
|
|
55
|
+
break;
|
|
56
|
+
} });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const CatFormGroup = CatFormGroup$1;
|
|
60
|
+
const defineCustomElement = defineCustomElement$1;
|
|
61
|
+
|
|
62
|
+
export { CatFormGroup, defineCustomElement };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=cat-form-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"cat-form-group.js","mappings":";;AAAA,MAAM,eAAe,GAAG,sBAAsB;;MCajCA,cAAY;EALzB;;;;IAMU,iBAAY,GAA8B,EAAE,CAAC;;;;;;;;IAW7C,mBAAc,GAA8C,MAAM,CAAC;GA+B5E;EA5BC,gBAAgB,CAAC,iBAA4D;IAC3E,MAAM,YAAY,GAAG,iBAAiB,KAAK,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,iBAAiB,CAAC;IAC1G,IAAI,CAAC,YAAY,CAAC,OAAO,CACvB,OAAO,cAAI,OAAA,EAAC,MAAA,OAAO,CAAC,cAAc,0CAAE,QAAQ,CAAC,GAAG,CAAC,CAAA,KAAK,OAAO,CAAC,cAAc,GAAG,YAAY,CAAC,CAAA,EAAA,CAC7F,CAAC;GACH;EAED,MAAM;IACJ,QACE,EAAC,IAAI,QACH,YAAM,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAS,CACpD,EACP;GACH;EAEO,YAAY;IAClB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,IAAI,CAC5B,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,gDAAgD,CAAC,CACvD,CAAC;IAC/B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;GAC5C;EAEO,SAAS,CAAC,QAAmC;IACnD,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,KAAK,WAAW,CAAC,CAAC;IAC3E,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;IAC1E,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,GAAG,cAAc,CAAC;IAC1D,OAAO,cAAc,IAAI,cAAc,GAAG,UAAU,GAAG,UAAU,CAAC;GACnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatFormGroup"],"sources":["./src/components/cat-form-group/cat-form-group.scss?tag=cat-form-group&encapsulation=shadow","./src/components/cat-form-group/cat-form-group.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, Element, h, Host, Prop, Watch } from '@stencil/core';\n\ntype HTMLCatFormFieldElement =\n | HTMLCatInputElement\n | HTMLCatTextareaElement\n | HTMLCatSelectElement\n | HTMLCatLabelElement;\n\n@Component({\n tag: 'cat-form-group',\n styleUrl: 'cat-form-group.scss',\n shadow: true\n})\nexport class CatFormGroup {\n private formElements: HTMLCatFormFieldElement[] = [];\n\n @Element() hostElement!: HTMLElement;\n\n /**\n * Whether the labels need a marker to shown if the forms fields are required or optional.<br /><br />\n * By default, it is set to auto, it will display the mark depending on the number of required and optional fields: <br />\n * - If there are more required, the optional will be marked.<br />\n * - If there are less required, it will mark the required.<br /><br />\n * If a form field had \"!\", the requiredMarked of the field would not change.\n */\n @Prop() requiredMarker: 'none' | 'required' | 'optional' | 'auto' = 'auto';\n\n @Watch('requiredMarker')\n onRequiredMarker(newRequiredMarker: 'none' | 'required' | 'optional' | 'auto') {\n const updateMarker = newRequiredMarker === 'auto' ? this.calculate(this.formElements) : newRequiredMarker;\n this.formElements.forEach(\n element => !element.requiredMarker?.endsWith('!') && (element.requiredMarker = updateMarker)\n );\n }\n\n render() {\n return (\n <Host>\n <slot onSlotchange={this.onSlotChange.bind(this)}></slot>\n </Host>\n );\n }\n\n private onSlotChange(): void {\n this.formElements = Array.from(\n this.hostElement.querySelectorAll('cat-textarea, cat-input, cat-select, cat-label')\n ) as HTMLCatFormFieldElement[];\n this.onRequiredMarker(this.requiredMarker);\n }\n\n private calculate(elements: HTMLCatFormFieldElement[]): 'optional' | 'required' {\n const formFields = elements.filter(value => value.tagName !== 'CAT-LABEL');\n const optionalFields = formFields.filter(value => !value.required).length;\n const requiredFields = formFields.length - optionalFields;\n return requiredFields >= optionalFields ? 'optional' : 'required';\n }\n}\n"],"version":3}
|
|
@@ -74,17 +74,13 @@ const CatIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
74
74
|
super();
|
|
75
75
|
this.__registerHost();
|
|
76
76
|
this.__attachShadow();
|
|
77
|
-
/**
|
|
78
|
-
* The name of the icon.
|
|
79
|
-
*/
|
|
80
|
-
this.icon = '';
|
|
81
77
|
/**
|
|
82
78
|
* The size of the icon.
|
|
83
79
|
*/
|
|
84
80
|
this.size = 'm';
|
|
85
81
|
}
|
|
86
82
|
render() {
|
|
87
|
-
return (h("span", { innerHTML: catIconRegistry.getIcon(this.icon), "aria-label": this.a11yLabel, "aria-hidden": this.a11yLabel ? null : 'true', part: "icon", class: {
|
|
83
|
+
return (h("span", { innerHTML: this.iconSrc || (this.icon ? catIconRegistry.getIcon(this.icon) : ''), "aria-label": this.a11yLabel, "aria-hidden": this.a11yLabel ? null : 'true', part: "icon", class: {
|
|
88
84
|
icon: true,
|
|
89
85
|
[`icon-${this.size}`]: this.size !== 'inline'
|
|
90
86
|
} }));
|
|
@@ -92,6 +88,7 @@ const CatIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
92
88
|
static get style() { return catIconCss; }
|
|
93
89
|
}, [1, "cat-icon", {
|
|
94
90
|
"icon": [1],
|
|
91
|
+
"iconSrc": [1, "icon-src"],
|
|
95
92
|
"size": [1],
|
|
96
93
|
"a11yLabel": [1, "a11y-label"]
|
|
97
94
|
}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"cat-icon2.js","mappings":";;;MAEa,eAAe;EAM1B;;IAHiB,OAAE,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACnD,UAAK,GAAwB,IAAI,GAAG,EAAE,CAAC;;;;;;;;IAYtD,MAAM,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,KAAK;MAC9C,MAAM,EAAE,MAAM,EAAE,GAAI,KAAqB,IAAI,EAAE,CAAC;MAChD,IAAI,MAAM,IAAI,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,EAAE;QACnC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;OACnD;KACF,CAAC,CAAC;IACH,MAAM,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,KAAK;MAChD,MAAM,EAAE,MAAM,EAAE,GAAI,KAAqB,IAAI,EAAE,CAAC;MAChD,IAAI,MAAM,IAAI,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,EAAE;QACnC,IAAI,CAAC,WAAW,CAAC,MAAM,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CAAC;IACvG,OAAO,IAAI,CAAC;GACb;EAEO,SAAS,CAAC,IAAY,EAAE,OAAgB;IAC9C,OAAO,OAAO,GAAG,GAAG,OAAO,OAAO,GAAG,IAAI,CAAC;GAC3C;EAEO,UAAU,CAAI,IAAY,EAAE,MAAU;IAC5C,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE;MAC3B,OAAO,EAAE,IAAI;MACb,QAAQ,EAAE,IAAI;MACd,MAAM;KACP,CAAC,CAAC;GACJ;CACF;MAEY,eAAe,GAAG,eAAe,CAAC,WAAW;;AC7E1D,MAAM,UAAU,GAAG,mbAAmb;;MCczb,OAAO;EALpB;;;;;;;IAmBU,SAAI,GAA6C,GAAG,CAAC;GAsB9D;EAdC,MAAM;IACJ,QACE,YACE,SAAS,EAAE,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,IAAI,GAAGC,eAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,gBAC1D,IAAI,CAAC,SAAS,iBACb,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,MAAM,EAC3C,IAAI,EAAC,MAAM,EACX,KAAK,EAAE;QACL,IAAI,EAAE,IAAI;QACV,CAAC,QAAQ,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,KAAK,QAAQ;OAC9C,GACK,EACR;GACH;;;;;;;;;;;;;;;;;;;;;;;;","names":["log","icons"],"sources":["./src/components/cat-icon/cat-icon-registry.ts","./src/components/cat-icon/cat-icon.scss?tag=cat-icon&encapsulation=shadow","./src/components/cat-icon/cat-icon.tsx"],"sourcesContent":["import log from 'loglevel';\n\nexport class CatIconRegistry {\n private static instance: CatIconRegistry;\n\n private readonly id = (Math.random() + 1).toString(36).substring(2);\n private readonly icons: Map<string, string> = new Map();\n\n private constructor() {\n // hide constructor\n\n // In rare cases, the registry can be initialized twice. This can happen in\n // a micro frontend architecture where the registry is initialized in the\n // host application and in the micro frontend. To prevent the registry in\n // one application from overwriting the registry in the other, we listen for\n // events that are dispatched when icons are added or removed in other\n // applications and add or remove icons if the event was not dispatched by\n // this registry.\n window.addEventListener('cat-icons-added', event => {\n const { detail } = (event as CustomEvent) || {};\n if (detail && detail.id !== this.id) {\n this.addIcons(detail.icons, detail.setName, true);\n }\n });\n window.addEventListener('cat-icons-removed', event => {\n const { detail } = (event as CustomEvent) || {};\n if (detail && detail.id !== this.id) {\n this.removeIcons(detail.names, detail.setName, true);\n }\n });\n }\n\n static getInstance(): CatIconRegistry {\n if (!CatIconRegistry.instance) {\n CatIconRegistry.instance = new CatIconRegistry();\n }\n return CatIconRegistry.instance;\n }\n\n getIcon(name: string, setName?: string): string | undefined {\n const icon = this.icons.get(this.buildName(name, setName));\n if (!icon) {\n log.error(`[CatIconRegistry] Unknown icon${setName ? ` in set ${setName}` : ''}: ${name}`);\n }\n return icon;\n }\n\n addIcons(icons: { [name: string]: string }, setName?: string, silent = false): CatIconRegistry {\n const iconEntries = Object.entries(icons);\n const iconSize = iconEntries.length;\n iconEntries.forEach(([name, data]) => this.icons.set(this.buildName(name, setName), data));\n log.info(`[CatIconRegistry] Added ${iconSize !== 1 ? 'icons' : 'icon'}${setName ? ` to set ${setName}` : ''}`);\n !silent && window.dispatchEvent(this.buildEvent('cat-icons-added', { id: this.id, icons, setName }));\n return this;\n }\n\n removeIcons(names: string[], setName?: string, silent = false): CatIconRegistry {\n const iconSize = names.length;\n names.forEach(name => this.icons.delete(this.buildName(name, setName)));\n log.info(`[CatIconRegistry] Removed ${iconSize !== 1 ? 'icons' : 'icon'}${setName ? ` from set ${setName}` : ''}`);\n !silent && window.dispatchEvent(this.buildEvent('cat-icons-removed', { id: this.id, names, setName }));\n return this;\n }\n\n private buildName(name: string, setName?: string) {\n return setName ? `${setName}:name` : name;\n }\n\n private buildEvent<T>(name: string, detail?: T) {\n return new CustomEvent(name, {\n bubbles: true,\n composed: true,\n detail\n });\n }\n}\n\nexport const catIconRegistry = CatIconRegistry.getInstance();\n","@use 'variables' as *;\n@use 'mixins' as *;\n@use 'sass:map';\n\n$icon-sizes: (\n 'xl': 1.75rem,\n 'l': 1.5rem,\n 'm': 1.25rem,\n 's': 1rem,\n 'xs': 0.75rem\n);\n\n:host {\n /**\n * @prop --cat-icon-ratio: The aspect ratio of the avatar.\n */\n display: inline-flex;\n vertical-align: middle;\n @include cat-select(none);\n}\n\n:host([hidden]) {\n display: none;\n}\n\nspan {\n display: inline-flex;\n}\n\nsvg {\n fill: currentColor;\n stroke: none;\n transform-origin: center center;\n height: 1em;\n width: calc(var(--cat-icon-ratio, 1) * 1em);\n}\n\n// ----- size\n\n@mixin size($size) {\n .icon-#{$size} svg {\n font-size: map.get($icon-sizes, $size);\n }\n}\n\n@include size('xs');\n@include size('s');\n@include size('m');\n@include size('l');\n@include size('xl');\n","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"],"version":3}
|
|
@@ -19,6 +19,10 @@ const CatInput$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
19
19
|
this.catBlur = createEvent(this, "catBlur", 7);
|
|
20
20
|
this._id = `cat-input-${nextUniqueId++}`;
|
|
21
21
|
this.hasSlottedLabel = false;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the label need a marker to shown if the input is required or optional.
|
|
24
|
+
*/
|
|
25
|
+
this.requiredMarker = 'optional';
|
|
22
26
|
/**
|
|
23
27
|
* Whether the input should show a clear button.
|
|
24
28
|
*/
|
|
@@ -95,7 +99,7 @@ const CatInput$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
95
99
|
this.value = '';
|
|
96
100
|
}
|
|
97
101
|
render() {
|
|
98
|
-
return (h(Host, null, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, h("span", { part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, !this.required && (h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.optional'), ")"))))), h("div", { class: {
|
|
102
|
+
return (h(Host, null, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, h("span", { part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, !this.required && this.requiredMarker.startsWith('optional') && (h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.required'), ")"))))), h("div", { class: {
|
|
99
103
|
'input-wrapper': true,
|
|
100
104
|
'input-round': this.round,
|
|
101
105
|
'input-disabled': this.disabled
|
|
@@ -120,6 +124,7 @@ const CatInput$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
120
124
|
get hostElement() { return this; }
|
|
121
125
|
static get style() { return catInputCss; }
|
|
122
126
|
}, [1, "cat-input", {
|
|
127
|
+
"requiredMarker":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,EACL,IAAI,CAAC,WAAW,CACZ,EACP;GACH;EAED,IAAY,WAAW;IACrB,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IACzE,QACE,CAAC,IAAI,CAAC,IAAI,IAAI,cAAc,MAC1B,EAAC,WAAW,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,cAAc,IAAI,YAAM,IAAI,EAAC,MAAM,GAAQ,GAAI,CAC3F,EACD;GACH;EAEO,OAAO,CAAC,KAAY;IAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAC9B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC5B;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC3B;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatInput","log","i18n"],"sources":["./src/components/cat-input/cat-input.scss?tag=cat-input&encapsulation=shadow","./src/components/cat-input/cat-input.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'src/components/cat-form-hint/cat-form-hint';\n\n:host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n @include cat-body('m');\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.input-wrapper {\n display: flex;\n align-items: stretch;\n gap: 0.75rem;\n padding: 0 0.75rem;\n height: 2.5rem;\n overflow: hidden;\n background: cat-token('color.ui.background.input');\n border-radius: cat-border-radius('m');\n box-shadow: 0 0 0 1px cat-token('color.ui.border.dark');\n transition: box-shadow cat-token('time.transition.s') linear;\n\n &.input-round {\n border-radius: 10rem;\n }\n\n &.input-disabled {\n background: cat-token('color.ui.background.muted');\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n }\n\n &:not(.input-disabled) {\n &:hover {\n box-shadow: 0 0 0 2px cat-token('color.ui.border.dark');\n }\n\n &:focus-within {\n outline: 2px solid cat-token('color.ui.border.focus');\n }\n }\n}\n\n:host(.cat-error) {\n .input-wrapper {\n box-shadow: 0 0 0 1px cat-token('color.theme.danger.bg');\n\n &:not(.input-disabled):hover {\n box-shadow: 0 0 0 2px cat-token('color.theme.danger.bg');\n }\n }\n}\n\nlabel {\n align-self: flex-start;\n\n &.hidden {\n @include cat-visually-hidden;\n }\n}\n\n.input-optional {\n margin-left: 0.25rem;\n @include cat-body('xs');\n color: cat-token('color.ui.font.muted');\n}\n\n.text-prefix,\n.text-suffix {\n display: inline-flex;\n align-items: center;\n @include cat-select(none);\n}\n\n.text-prefix {\n border-right: 1px solid cat-token('color.ui.border.dark');\n padding-right: 0.75rem;\n}\n\n.text-suffix {\n border-left: 1px solid cat-token('color.ui.border.dark');\n padding-left: 0.75rem;\n}\n\n.icon-prefix,\n.icon-suffix {\n align-self: center;\n}\n\n.input-inner-wrapper {\n display: flex;\n align-items: center;\n position: relative;\n flex: 1 1 auto;\n}\n\ninput {\n font: inherit;\n margin: 0;\n padding: 0;\n width: 100%;\n min-width: 0;\n border: none;\n outline: none;\n background: none;\n\n .input-disabled & {\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n }\n\n &.has-clearable {\n padding-right: 1.5rem;\n }\n\n &::placeholder {\n color: cat-token('color.ui.font.muted');\n }\n}\n\n.clearable {\n position: absolute;\n top: calc(50% - 1rem);\n right: -0.5rem;\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\nimport { InputType } from './input-type';\n\nlet nextUniqueId = 0;\n\n/**\n * Inputs are used to allow users to provide text input when the expected input\n * is short. As well as plain text, Input supports various types of text,\n * including passwords and numbers.\n *\n * @slot hint - Optional hint element to be displayed with the input.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part label - The label content.\n * @part prefix - The text prefix.\n * @part suffix - The text suffix.\n */\n@Component({\n tag: 'cat-input',\n styleUrl: 'cat-input.scss',\n shadow: true\n})\nexport class CatInput {\n private readonly _id = `cat-input-${nextUniqueId++}`;\n private get id() {\n return this.identifier || this._id;\n }\n\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label for the input.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum value for date, time and numeric values.\n */\n @Prop() max?: number | string;\n\n /**\n * A maximum length (number of characters) for textual values.\n */\n @Prop() maxLength?: number;\n\n /**\n * A minimum value for date, time and numeric values.\n */\n @Prop() min?: number | string;\n\n /**\n * A minimum length (number of characters) for textual values.\n */\n @Prop() minLength?: number;\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name?: string;\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Use round input edges.\n */\n @Prop() round = false;\n\n /**\n * Type of form control.\n */\n @Prop() type: InputType = 'text';\n\n /**\n * The value of the control.\n */\n @Prop({ mutable: true }) value?: string | number;\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.warn('[A11y] Missing ARIA label on input', this);\n }\n }\n\n /**\n * Programmatically move focus to the input. Use this method instead of\n * `input.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.input.focus(options);\n }\n\n /**\n * Programmatically remove focus from the input. Use this method instead of\n * `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.input.blur();\n }\n\n /**\n * Programmatically simulate a click on the input.\n */\n @Method()\n async doClick(): Promise<void> {\n this.input.click();\n }\n\n /**\n * Clear the input.\n */\n @Method()\n async clear(): Promise<void> {\n this.value = '';\n }\n\n render() {\n return (\n <Host>\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n {!this.required && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({i18n.t('input.optional')})\n </span>\n )}\n </span>\n </label>\n )}\n <div\n class={{\n 'input-wrapper': true,\n 'input-round': this.round,\n 'input-disabled': this.disabled\n }}\n onClick={() => this.input.focus()}\n >\n {this.textPrefix && (\n <span class=\"text-prefix\" part=\"prefix\">\n {this.textPrefix}\n </span>\n )}\n {this.icon && !this.iconRight && <cat-icon icon={this.icon} class=\"icon-prefix\" size=\"l\"></cat-icon>}\n <div class=\"input-inner-wrapper\">\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n class={{\n 'has-clearable': this.clearable && !this.disabled\n }}\n autocomplete={this.autoComplete}\n disabled={this.disabled}\n max={this.max}\n maxlength={this.maxLength}\n min={this.min}\n minlength={this.minLength}\n name={this.name}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n type={this.type}\n value={this.value}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n ></input>\n {this.clearable && !this.disabled && this.value && (\n <cat-button\n class=\"clearable\"\n icon=\"cross-circle-outlined\"\n icon-only=\"true\"\n size=\"s\"\n variant=\"text\"\n a11y-label={i18n.t('input.clear')}\n onClick={this.clear.bind(this)}\n ></cat-button>\n )}\n </div>\n {this.icon && this.iconRight && <cat-icon icon={this.icon} class=\"icon-suffix\" size=\"l\"></cat-icon>}\n {this.textSuffix && (\n <span class=\"text-suffix\" part=\"suffix\">\n {this.textSuffix}\n </span>\n )}\n </div>\n {this.hintSection}\n </Host>\n );\n }\n\n private get hintSection() {\n const hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n return (\n (this.hint || hasSlottedHint) && (\n <CatFormHint hint={this.hint} slottedHint={hasSlottedHint && <slot name=\"hint\"></slot>} />\n )\n );\n }\n\n private onInput(event: Event) {\n this.value = this.input.value;\n this.catChange.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"],"version":3}
|
|
1
|
+
{"file":"cat-input.js","mappings":";;;;;;;;AAAA,MAAM,WAAW,GAAG,gkFAAgkF;;ACMplF,IAAI,YAAY,GAAG,CAAC,CAAC;M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AC,QAAQ,IACpC,IAAI,CAAC,UAAU,CACX,CACR,CACG,EACL,IAAI,CAAC,WAAW,CACZ,EACP;GACH;EAED,IAAY,WAAW;IACrB,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IACzE,QACE,CAAC,IAAI,CAAC,IAAI,IAAI,cAAc,MAC1B,EAAC,WAAW,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,cAAc,IAAI,YAAM,IAAI,EAAC,MAAM,GAAQ,GAAI,CAC3F,EACD;GACH;EAEO,OAAO,CAAC,KAAY;IAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAC9B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC5B;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC3B;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatInput","log","i18n"],"sources":["./src/components/cat-input/cat-input.scss?tag=cat-input&encapsulation=shadow","./src/components/cat-input/cat-input.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'src/components/cat-form-hint/cat-form-hint';\n\n:host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n @include cat-body('m');\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.input-wrapper {\n display: flex;\n align-items: stretch;\n gap: 0.75rem;\n padding: 0 0.75rem;\n height: 2.5rem;\n overflow: hidden;\n background: cat-token('color.ui.background.input');\n border-radius: cat-border-radius('m');\n box-shadow: 0 0 0 1px cat-token('color.ui.border.dark');\n transition: box-shadow cat-token('time.transition.s') linear;\n\n &.input-round {\n border-radius: 10rem;\n }\n\n &.input-disabled {\n background: cat-token('color.ui.background.muted');\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n }\n\n &:not(.input-disabled) {\n &:hover {\n box-shadow: 0 0 0 2px cat-token('color.ui.border.dark');\n }\n\n &:focus-within {\n outline: 2px solid cat-token('color.ui.border.focus');\n }\n }\n}\n\n:host(.cat-error) {\n .input-wrapper {\n box-shadow: 0 0 0 1px cat-token('color.theme.danger.bg');\n\n &:not(.input-disabled):hover {\n box-shadow: 0 0 0 2px cat-token('color.theme.danger.bg');\n }\n }\n}\n\nlabel {\n align-self: flex-start;\n\n &.hidden {\n @include cat-visually-hidden;\n }\n}\n\n.input-optional {\n margin-left: 0.25rem;\n @include cat-body('xs');\n color: cat-token('color.ui.font.muted');\n}\n\n.text-prefix,\n.text-suffix {\n display: inline-flex;\n align-items: center;\n @include cat-select(none);\n}\n\n.text-prefix {\n border-right: 1px solid cat-token('color.ui.border.dark');\n padding-right: 0.75rem;\n}\n\n.text-suffix {\n border-left: 1px solid cat-token('color.ui.border.dark');\n padding-left: 0.75rem;\n}\n\n.icon-prefix,\n.icon-suffix {\n align-self: center;\n}\n\n.input-inner-wrapper {\n display: flex;\n align-items: center;\n position: relative;\n flex: 1 1 auto;\n}\n\ninput {\n font: inherit;\n margin: 0;\n padding: 0;\n width: 100%;\n min-width: 0;\n border: none;\n outline: none;\n background: none;\n\n .input-disabled & {\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n }\n\n &.has-clearable {\n padding-right: 1.5rem;\n }\n\n &::placeholder {\n color: cat-token('color.ui.font.muted');\n }\n}\n\n.clearable {\n position: absolute;\n top: calc(50% - 1rem);\n right: -0.5rem;\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\nimport { InputType } from './input-type';\n\nlet nextUniqueId = 0;\n\n/**\n * Inputs are used to allow users to provide text input when the expected input\n * is short. As well as plain text, Input supports various types of text,\n * including passwords and numbers.\n *\n * @slot hint - Optional hint element to be displayed with the input.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part label - The label content.\n * @part prefix - The text prefix.\n * @part suffix - The text suffix.\n */\n@Component({\n tag: 'cat-input',\n styleUrl: 'cat-input.scss',\n shadow: true\n})\nexport class CatInput {\n private readonly _id = `cat-input-${nextUniqueId++}`;\n private get id() {\n return this.identifier || this._id;\n }\n\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * Whether the label need a marker to shown if the input is required or optional.\n */\n @Prop() requiredMarker: 'none' | 'required' | 'optional' | 'none!' | 'optional!' | 'required!' = 'optional';\n\n /**\n * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label for the input.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum value for date, time and numeric values.\n */\n @Prop() max?: number | string;\n\n /**\n * A maximum length (number of characters) for textual values.\n */\n @Prop() maxLength?: number;\n\n /**\n * A minimum value for date, time and numeric values.\n */\n @Prop() min?: number | string;\n\n /**\n * A minimum length (number of characters) for textual values.\n */\n @Prop() minLength?: number;\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name?: string;\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Use round input edges.\n */\n @Prop() round = false;\n\n /**\n * Type of form control.\n */\n @Prop() type: InputType = 'text';\n\n /**\n * The value of the control.\n */\n @Prop({ mutable: true }) value?: string | number;\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.warn('[A11y] Missing ARIA label on input', this);\n }\n }\n\n /**\n * Programmatically move focus to the input. Use this method instead of\n * `input.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.input.focus(options);\n }\n\n /**\n * Programmatically remove focus from the input. Use this method instead of\n * `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.input.blur();\n }\n\n /**\n * Programmatically simulate a click on the input.\n */\n @Method()\n async doClick(): Promise<void> {\n this.input.click();\n }\n\n /**\n * Clear the input.\n */\n @Method()\n async clear(): Promise<void> {\n this.value = '';\n }\n\n render() {\n return (\n <Host>\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n {!this.required && this.requiredMarker.startsWith('optional') && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({i18n.t('input.optional')})\n </span>\n )}\n {this.required && this.requiredMarker.startsWith('required') && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({i18n.t('input.required')})\n </span>\n )}\n </span>\n </label>\n )}\n <div\n class={{\n 'input-wrapper': true,\n 'input-round': this.round,\n 'input-disabled': this.disabled\n }}\n onClick={() => this.input.focus()}\n >\n {this.textPrefix && (\n <span class=\"text-prefix\" part=\"prefix\">\n {this.textPrefix}\n </span>\n )}\n {this.icon && !this.iconRight && <cat-icon icon={this.icon} class=\"icon-prefix\" size=\"l\"></cat-icon>}\n <div class=\"input-inner-wrapper\">\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n class={{\n 'has-clearable': this.clearable && !this.disabled\n }}\n autocomplete={this.autoComplete}\n disabled={this.disabled}\n max={this.max}\n maxlength={this.maxLength}\n min={this.min}\n minlength={this.minLength}\n name={this.name}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n type={this.type}\n value={this.value}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n ></input>\n {this.clearable && !this.disabled && this.value && (\n <cat-button\n class=\"clearable\"\n icon=\"cross-circle-outlined\"\n icon-only=\"true\"\n size=\"s\"\n variant=\"text\"\n a11y-label={i18n.t('input.clear')}\n onClick={this.clear.bind(this)}\n ></cat-button>\n )}\n </div>\n {this.icon && this.iconRight && <cat-icon icon={this.icon} class=\"icon-suffix\" size=\"l\"></cat-icon>}\n {this.textSuffix && (\n <span class=\"text-suffix\" part=\"suffix\">\n {this.textSuffix}\n </span>\n )}\n </div>\n {this.hintSection}\n </Host>\n );\n }\n\n private get hintSection() {\n const hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n return (\n (this.hint || hasSlottedHint) && (\n <CatFormHint hint={this.hint} slottedHint={hasSlottedHint && <slot name=\"hint\"></slot>} />\n )\n );\n }\n\n private onInput(event: Event) {\n this.value = this.input.value;\n this.catChange.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"],"version":3}
|
|
@@ -8,6 +8,10 @@ const CatLabel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
8
8
|
super();
|
|
9
9
|
this.__registerHost();
|
|
10
10
|
this.__attachShadow();
|
|
11
|
+
/**
|
|
12
|
+
* Whether the label need a marker to shown if the input is required or optional.
|
|
13
|
+
*/
|
|
14
|
+
this.requiredMarker = 'optional';
|
|
11
15
|
/**
|
|
12
16
|
* A value is required or must be check for the form to be submittable.
|
|
13
17
|
*/
|
|
@@ -21,7 +25,7 @@ const CatLabel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
27
|
render() {
|
|
24
|
-
return (h(Host, null, h("label", { htmlFor: this.for, onClick: this.onClick.bind(this) }, h("slot", null), !this.required && (h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.optional'), ")")))));
|
|
28
|
+
return (h(Host, null, h("label", { htmlFor: this.for, onClick: this.onClick.bind(this) }, h("slot", null), !this.required && this.requiredMarker.startsWith('optional') && (h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.required'), ")")))));
|
|
25
29
|
}
|
|
26
30
|
findShadowTarget(id) {
|
|
27
31
|
var _a;
|
|
@@ -38,6 +42,7 @@ const CatLabel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
38
42
|
}
|
|
39
43
|
static get style() { return catLabelCss; }
|
|
40
44
|
}, [1, "cat-label", {
|
|
45
|
+
"requiredMarker": [1, "required-marker"],
|
|
41
46
|
"for": [1],
|
|
42
47
|
"required": [4]
|
|
43
48
|
}]);
|